@ckeditor/ckeditor5-ai 48.4.0-alpha.1 → 48.4.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (148) hide show
  1. package/dist/index.js +19 -19
  2. package/dist/translations/af.js +1 -1
  3. package/dist/translations/af.umd.js +1 -1
  4. package/dist/translations/ar.js +1 -1
  5. package/dist/translations/ar.umd.js +1 -1
  6. package/dist/translations/ast.js +1 -1
  7. package/dist/translations/ast.umd.js +1 -1
  8. package/dist/translations/az.js +1 -1
  9. package/dist/translations/az.umd.js +1 -1
  10. package/dist/translations/be.js +1 -1
  11. package/dist/translations/be.umd.js +1 -1
  12. package/dist/translations/bg.js +1 -1
  13. package/dist/translations/bg.umd.js +1 -1
  14. package/dist/translations/bn.js +1 -1
  15. package/dist/translations/bn.umd.js +1 -1
  16. package/dist/translations/bs.js +1 -1
  17. package/dist/translations/bs.umd.js +1 -1
  18. package/dist/translations/ca.js +1 -1
  19. package/dist/translations/ca.umd.js +1 -1
  20. package/dist/translations/cs.js +1 -1
  21. package/dist/translations/cs.umd.js +1 -1
  22. package/dist/translations/da.js +1 -1
  23. package/dist/translations/da.umd.js +1 -1
  24. package/dist/translations/de-ch.js +1 -1
  25. package/dist/translations/de-ch.umd.js +1 -1
  26. package/dist/translations/de.js +1 -1
  27. package/dist/translations/de.umd.js +1 -1
  28. package/dist/translations/el.js +1 -1
  29. package/dist/translations/el.umd.js +1 -1
  30. package/dist/translations/en-au.js +1 -1
  31. package/dist/translations/en-au.umd.js +1 -1
  32. package/dist/translations/en-gb.js +1 -1
  33. package/dist/translations/en-gb.umd.js +1 -1
  34. package/dist/translations/en.js +1 -1
  35. package/dist/translations/en.umd.js +1 -1
  36. package/dist/translations/eo.js +1 -1
  37. package/dist/translations/eo.umd.js +1 -1
  38. package/dist/translations/es-co.js +1 -1
  39. package/dist/translations/es-co.umd.js +1 -1
  40. package/dist/translations/es.js +1 -1
  41. package/dist/translations/es.umd.js +1 -1
  42. package/dist/translations/et.js +1 -1
  43. package/dist/translations/et.umd.js +1 -1
  44. package/dist/translations/eu.js +1 -1
  45. package/dist/translations/eu.umd.js +1 -1
  46. package/dist/translations/fa.js +1 -1
  47. package/dist/translations/fa.umd.js +1 -1
  48. package/dist/translations/fi.js +1 -1
  49. package/dist/translations/fi.umd.js +1 -1
  50. package/dist/translations/fr.js +1 -1
  51. package/dist/translations/fr.umd.js +1 -1
  52. package/dist/translations/gl.js +1 -1
  53. package/dist/translations/gl.umd.js +1 -1
  54. package/dist/translations/gu.js +1 -1
  55. package/dist/translations/gu.umd.js +1 -1
  56. package/dist/translations/he.js +1 -1
  57. package/dist/translations/he.umd.js +1 -1
  58. package/dist/translations/hi.js +1 -1
  59. package/dist/translations/hi.umd.js +1 -1
  60. package/dist/translations/hr.js +1 -1
  61. package/dist/translations/hr.umd.js +1 -1
  62. package/dist/translations/hu.js +1 -1
  63. package/dist/translations/hu.umd.js +1 -1
  64. package/dist/translations/hy.js +1 -1
  65. package/dist/translations/hy.umd.js +1 -1
  66. package/dist/translations/id.js +1 -1
  67. package/dist/translations/id.umd.js +1 -1
  68. package/dist/translations/it.js +1 -1
  69. package/dist/translations/it.umd.js +1 -1
  70. package/dist/translations/ja.js +1 -1
  71. package/dist/translations/ja.umd.js +1 -1
  72. package/dist/translations/jv.js +1 -1
  73. package/dist/translations/jv.umd.js +1 -1
  74. package/dist/translations/kk.js +1 -1
  75. package/dist/translations/kk.umd.js +1 -1
  76. package/dist/translations/km.js +1 -1
  77. package/dist/translations/km.umd.js +1 -1
  78. package/dist/translations/kn.js +1 -1
  79. package/dist/translations/kn.umd.js +1 -1
  80. package/dist/translations/ko.js +1 -1
  81. package/dist/translations/ko.umd.js +1 -1
  82. package/dist/translations/ku.js +1 -1
  83. package/dist/translations/ku.umd.js +1 -1
  84. package/dist/translations/lt.js +1 -1
  85. package/dist/translations/lt.umd.js +1 -1
  86. package/dist/translations/lv.js +1 -1
  87. package/dist/translations/lv.umd.js +1 -1
  88. package/dist/translations/ms.js +1 -1
  89. package/dist/translations/ms.umd.js +1 -1
  90. package/dist/translations/nb.js +1 -1
  91. package/dist/translations/nb.umd.js +1 -1
  92. package/dist/translations/ne.js +1 -1
  93. package/dist/translations/ne.umd.js +1 -1
  94. package/dist/translations/nl.js +1 -1
  95. package/dist/translations/nl.umd.js +1 -1
  96. package/dist/translations/no.js +1 -1
  97. package/dist/translations/no.umd.js +1 -1
  98. package/dist/translations/oc.js +1 -1
  99. package/dist/translations/oc.umd.js +1 -1
  100. package/dist/translations/pl.js +1 -1
  101. package/dist/translations/pl.umd.js +1 -1
  102. package/dist/translations/pt-br.js +1 -1
  103. package/dist/translations/pt-br.umd.js +1 -1
  104. package/dist/translations/pt.js +1 -1
  105. package/dist/translations/pt.umd.js +1 -1
  106. package/dist/translations/ro.js +1 -1
  107. package/dist/translations/ro.umd.js +1 -1
  108. package/dist/translations/ru.js +1 -1
  109. package/dist/translations/ru.umd.js +1 -1
  110. package/dist/translations/si.js +1 -1
  111. package/dist/translations/si.umd.js +1 -1
  112. package/dist/translations/sk.js +1 -1
  113. package/dist/translations/sk.umd.js +1 -1
  114. package/dist/translations/sl.js +1 -1
  115. package/dist/translations/sl.umd.js +1 -1
  116. package/dist/translations/sq.js +1 -1
  117. package/dist/translations/sq.umd.js +1 -1
  118. package/dist/translations/sr-latn.js +1 -1
  119. package/dist/translations/sr-latn.umd.js +1 -1
  120. package/dist/translations/sr.js +1 -1
  121. package/dist/translations/sr.umd.js +1 -1
  122. package/dist/translations/sv.js +1 -1
  123. package/dist/translations/sv.umd.js +1 -1
  124. package/dist/translations/th.js +1 -1
  125. package/dist/translations/th.umd.js +1 -1
  126. package/dist/translations/ti.js +1 -1
  127. package/dist/translations/ti.umd.js +1 -1
  128. package/dist/translations/tk.js +1 -1
  129. package/dist/translations/tk.umd.js +1 -1
  130. package/dist/translations/tr.js +1 -1
  131. package/dist/translations/tr.umd.js +1 -1
  132. package/dist/translations/tt.js +1 -1
  133. package/dist/translations/tt.umd.js +1 -1
  134. package/dist/translations/ug.js +1 -1
  135. package/dist/translations/ug.umd.js +1 -1
  136. package/dist/translations/uk.js +1 -1
  137. package/dist/translations/uk.umd.js +1 -1
  138. package/dist/translations/ur.js +1 -1
  139. package/dist/translations/ur.umd.js +1 -1
  140. package/dist/translations/uz.js +1 -1
  141. package/dist/translations/uz.umd.js +1 -1
  142. package/dist/translations/vi.js +1 -1
  143. package/dist/translations/vi.umd.js +1 -1
  144. package/dist/translations/zh-cn.js +1 -1
  145. package/dist/translations/zh-cn.umd.js +1 -1
  146. package/dist/translations/zh.js +1 -1
  147. package/dist/translations/zh.umd.js +1 -1
  148. 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'](/&nbsp;/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(_0x5de5ca){const _0x266efe={};if(!_0x5de5ca)return _0x266efe;('isWebSearchEnabled'in _0x5de5ca?_0x5de5ca['isWebSearchEnabled']:_0x5de5ca['webSearch'])&&(_0x266efe['webSearch']={});const _0x2de72e='isReasoningEnabled'in _0x5de5ca?_0x5de5ca['isReasoningEnabled']:_0x5de5ca['reasoning'];return _0x2de72e&&(_0x266efe['reasoning']='string'==typeof _0x2de72e?{'level':_0x2de72e}:{}),_0x266efe;}toggleWebSearch(){this['setWebSearch'](!this['_isWebSearchEnabled']);}toggleReasoning(){this['setReasoning'](!this['_isReasoningEnabled']);}setWebSearch(_0x362bf8){_0x362bf8!==this['_isWebSearchEnabled']&&(this['_isWebSearchEnabled']=_0x362bf8,this['fire']('capabilitiesUpdated',this['getCapabilitiesConfig']()));}setReasoning(_0x187c80){_0x187c80!==this['_isReasoningEnabled']&&(this['_isReasoningEnabled']=_0x187c80,this['fire']('capabilitiesUpdated',this['getCapabilitiesConfig']()));}};function bn(_0x3aaa35,_0xf4b05d,_0x3d321a,_0x27de58){if(_0x3aaa35 instanceof ct)return _0x3aaa35;const _0x5454fa=_0x3aaa35?.['data'];return new ct(_0xf4b05d,_0x3d321a,void 0x0!==_0x5454fa?{..._0x27de58,'backendData':_0x5454fa}:_0x27de58,_0x3aaa35);}var Sn=class{_editor;_rootName;['_channelId'];['_sessionId'];_documentVersion;_contentRawOld;_contentRawNew;['_error'];_isAborted=!0x1;_droppedUnsupportedInlineChange=!0x1;constructor(_0x3dd74c){this['_editor']=_0x3dd74c['editor'],this['_rootName']=_0x3dd74c['rootName'],this['_channelId']=_0x3dd74c['channelId'],this['_sessionId']=_0x3dd74c['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(_0x39c15){this['_documentVersion']=_0x39c15;}get contentRawOld(){return this['_contentRawOld'];}set contentRawOld(_0x733999){this['_contentRawOld']=_0x733999;}get contentRawNew(){return this['_contentRawNew'];}set contentRawNew(_0x377c20){this['_contentRawNew']=_0x377c20;}get contentOld(){return this['_dropDataIds'](this['_contentRawOld']||'');}get contentNew(){return this['_dropDataIds'](this['_contentRawNew']||'');}get['error'](){return this['_error'];}set['error'](_0x339625){this['_error']=_0x339625;}get droppedUnsupportedInlineChange(){return this['_droppedUnsupportedInlineChange'];}set droppedUnsupportedInlineChange(_0x7c082b){this['_droppedUnsupportedInlineChange']=_0x7c082b;}abort(){this['_isAborted']=!0x0;}_dropDataIds(_0x251676){return _0x251676['replace'](/ data-id="[a-z0-9]+"/g,'');}},Rn=class extends Sn{['_summary']='';get['summary'](){return this['_summary'];}set['summary'](_0x516ee){this['_summary']=_0x516ee;}},On=class{_results;constructor(_0xa7961=[]){this['_results']=_0xa7961;}_status='initialized';['_error'];abort(){'error'!==this['_status']&&(this['_status']='aborted');}get status(){return this['_status'];}set status(_0x126c56){this['_status']=_0x126c56;}get['error'](){return this['_error'];}set['error'](_0x596ed5){this['_status']='error',this['_error']=_0x596ed5;}get results(){return this['_results'];}addResult(..._0x1a2d9f){this['_results']['push'](..._0x1a2d9f);}},vn=class extends _0x77cfae{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(_0x3a7629,_0x240b0c){if(!_0x3a7629)throw new ct('ai-documentprocessinggateway-missing-prompt',this);const _0x5f0b0e=await this['context']['plugins']['get'](tn)['getDocumentData'](),_0x4da85d=_0x240b0c['roots'];if(0x0===(_0x4da85d??_0x5f0b0e)['length'])throw new ct('ai-documentprocessinggateway-empty-roots',this);if(_0x4da85d){for(const _0x138438 of _0x4da85d)if(!_0x5f0b0e['some'](_0x15dcaa=>_0x15dcaa['rootName']===_0x138438['rootName']&&_0x15dcaa['channelId']===_0x138438['channelId']))throw new ct('ai-documentprocessinggateway-root-not-found',this,{'channelId':_0x138438['channelId'],'rootName':_0x138438['rootName']});}const _0x2edc53=_0x4da85d?_0x5f0b0e['filter'](_0x2de6f3=>_0x4da85d['some'](_0x59cd13=>_0x59cd13['rootName']===_0x2de6f3['rootName']&&_0x59cd13['channelId']===_0x2de6f3['channelId'])):_0x5f0b0e,_0x1145f4=[],_0x26eed1=[];for(const _0x7fa73b of _0x2edc53){const _0x49a0ab={'editor':_0x7fa73b['editor'],'rootName':_0x7fa73b['rootName'],'sessionId':_0x7fa73b['sessionId'],'channelId':_0x7fa73b['channelId'],'contentRawOld':_0x7fa73b['content'],'documentVersion':_0x7fa73b['version']};_0x1145f4['push'](_0x49a0ab),_0x26eed1['push']({'type':'document','content':_0x49a0ab['contentRawOld']});}const _0x39900a=this['context']['plugins']['get']('AIConnector')['processDocument']({'content':_0x26eed1,'prompt':_0x3a7629,'model':_0x240b0c['model'],'capabilities':fn['getCapabilitiesRequestData'](_0x240b0c['capabilities']),'contexts':_0x240b0c['contexts']});let _0xdcfeaf;if(_0x240b0c?.['signal']){_0x240b0c['signal']['aborted']&&_0x39900a['abortController']['abort']();const _0x120e74=_0x240b0c['signal'],_0x4d7d95=()=>_0x39900a['abortController']['abort']();_0x120e74['addEventListener']('abort',_0x4d7d95),_0xdcfeaf=()=>_0x120e74['removeEventListener']('abort',_0x4d7d95);}const _0x1a20f5=new On();let _0x161c40=[];try{if(_0x161c40=(await _0x39900a['getResult']())['documents'],!(_0x161c40&&_0x161c40['length']>0x0))throw new ct('ai-documentprocessinggateway-empty-reply',this);if(_0x161c40['length']!==_0x26eed1['length'])throw new ct('ai-documentprocessinggateway-reply-count-mismatch',this,{'expected':_0x26eed1['length'],'received':_0x161c40['length']});const _0x2e9bd9=_0x161c40['findIndex'](({document:_0x4166f8})=>!_0x4166f8['length']);if(-0x1!==_0x2e9bd9){const _0x4a06cc=_0x1145f4[_0x2e9bd9];throw new ct('ai-documentprocessinggateway-empty-root-content',this,{'channelId':_0x4a06cc['channelId'],'rootName':_0x4a06cc['rootName']});}_0x1a20f5['status']='completed';}catch(_0x511e98){_0x511e98 instanceof Error&&_0x511e98['message']['includes']('ai-request-aborted')?_0x1a20f5['abort']():_0x1a20f5['error']=bn(_0x511e98,'ai-documentprocessinggateway-run-failed',this);}finally{_0xdcfeaf&&_0xdcfeaf();}if('completed'===_0x1a20f5['status'])for(const [_0x56a531,_0x4a768f]of _0x1145f4['entries']()){const {channelId:_0x241121,contentRawOld:_0x2a65e8,documentVersion:_0x26cf17,editor:_0x572b17,rootName:_0xb309a0,sessionId:_0x3db633}=_0x4a768f,_0x4a7ff2=new Rn({'channelId':_0x241121,'editor':_0x572b17,'rootName':_0xb309a0,'sessionId':_0x3db633});_0x4a7ff2['contentRawOld']=_0x2a65e8,_0x4a7ff2['documentVersion']=_0x26cf17,_0x4a7ff2['contentRawNew']=_0x161c40[_0x56a531]['document'],_0x4a7ff2['summary']=_0x161c40[_0x56a531]['summary'],_0x1a20f5['addResult'](_0x4a7ff2);}return _0x1a20f5;}applyResult(_0xe65397,_0x47542e){this['context']['plugins']['get']('AIGateway')['apply'](_0xe65397,_0x47542e);}};function kn(_0x2f86a2){return _0x2f86a2 instanceof Error&&('AbortError'===_0x2f86a2['name']||('AICoreError'===_0x2f86a2['name']?!0x0===_0x2f86a2['isAbort']:_0x2f86a2['message']['startsWith']('ai-request-aborted')));}var yn=class extends Error{['code'];severity;type;context;isAbort;constructor(_0x19cf2b){super(_0x19cf2b['code'],_0x19cf2b['cause']instanceof Error?{'cause':_0x19cf2b['cause']}:void 0x0),this['name']='AICoreError',this['code']=_0x19cf2b['code'],this['severity']=_0x19cf2b['severity']??'error',this['type']=_0x19cf2b['type']??'system',this['context']=_0x19cf2b['context'],this['isAbort']=_0x19cf2b['isAbort']??kn(_0x19cf2b['cause']);}},Nn=class extends _0x77cfae{static get['pluginName'](){return'AIErrorSink';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}createReporter(_0x209515){return new xn(this,_0x209515);}},xn=class{['_sink'];_component;constructor(_0x1306ee,_0x48b842){this['_sink']=_0x1306ee,this['_component']=_0x48b842;}['logError'](_0x58effe,_0x20dca7={}){this['_emit'](_0x58effe,_0x20dca7),this['_defaultLog'](_0x58effe);}reportError(_0x3e02ed,_0x3e311={}){this['_emit'](_0x3e02ed,_0x3e311);}_emit(_0x2a9243,_0x2830ca){kn(_0x2a9243)||this['_sink']['fire']('error',{'error':_0x2a9243,'component':this['_component'],'context':_0x2830ca['context']});}_defaultLog(_0x498294){if(!kn(_0x498294)){if(_0x498294 instanceof yn){if('user'===_0x498294['type']||'network'===_0x498294['type'])return;if('warning'===_0x498294['severity'])return void console['warn'](this['_component'],_0x498294);}console['error'](this['_component'],_0x498294);}}};const Ln='ck-ai-button-primary',Pn='ck-ai-button-secondary',Dn='ck-ai-button-tertiary';function Hn(_0x2a2cb7,_0x29e01c){const _0x22999e=new Mt(_0x2a2cb7),_0x150963=Es(_0x2a2cb7,'AI_TABS_LABEL_MINIMIZE'),_0x34c6b6=Es(_0x2a2cb7,'AI_TABS_LABEL_MAXIMIZE');return _0x22999e['set']({'withText':!0x1,'icon':_0x4f4ffb,'tooltip':!0x0,'class':'ck-ai-tabs__resize\x20'+Dn}),_0x22999e['bind']('label')['to'](_0x29e01c,'isMaximized',_0x635dcd=>_0x635dcd?_0x150963:_0x34c6b6),_0x22999e['bind']('icon')['to'](_0x29e01c,'isMaximized',_0x2f6c95=>_0x2f6c95?_0x24bdae:_0x4f4ffb),_0x22999e['bind']('isOn')['to'](_0x29e01c,'isMaximized'),_0x22999e['on']('execute',()=>{_0x29e01c['fire']('resizeTabs');}),_0x22999e;}function Mn(_0x599d31){const _0x2c0f8a=new Pt(_0x599d31);return _0x2c0f8a['attachToDom'](),_0x2c0f8a['bodyCollectionContainer']['classList']['add']('ck-ai-body'),_0x2c0f8a;}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:_0x4d9da8,isDone:_0x596b05=!0x1,isComplete:_0x36da21,interactionId:_0x20c68e,areActionsDisabled:_0x438933,outdatedReasonByDocumentId:_0x3ced6d,isFromHistory:_0x3adf20=!0x1,documentContextContent:_0x18188d,locale:_0x35c3a2,id:_0x1156a7,channelsToEditors:_0x112b93}){super(),this['id']=_0x1156a7||kt(),this['interactionId']=_0x20c68e,this['type']=_0x4d9da8,this['areActionsDisabled']=!!_0x438933,this['_outdatedReasonByDocumentId']=_0x3ced6d,this['isFromHistory']=_0x3adf20,this['locale']=_0x35c3a2,this['aiResponseParser']=new hn(),this['aiResponseApplier']=new sn(),this['documentContextContent']=new Map(_0x18188d?.['map'](_0x17c659=>[_0x17c659['id'],Rs(_0x17c659['content'])])||[]),this['_documentIdToSource']=new Map(_0x18188d?.['map'](_0x49f3fe=>[_0x49f3fe['id'],{'editor':_0x112b93['get'](_0x49f3fe['channelId']),'rootName':_0x49f3fe['rootName']}])||[]),this['set']('isDone',_0x596b05),this['set']('isComplete',_0x36da21??_0x596b05),'text'===this['type']&&this['content']['set']('text','');}appendContent(_0x3c5692,_0x155af1){const _0x5bb080='text'===this['type']?'text':_0x155af1;this['content']['has'](_0x5bb080)||this['content']['set'](_0x5bb080,''),this['content']['set'](_0x5bb080,this['content']['get'](_0x5bb080)+_0x3c5692),this['onContentChange'](_0x5bb080);}['done'](_0x154806=!0x0){this['isComplete']=_0x154806,this['isDone']||(this['set']('isDone',!0x0),this['onContentChange']());}destroy(){this['stopListening']();}setChangeGroupState(_0xa28739,_0x25ebb0,_0x385863){this['changeGroups'][_0xa28739]['state']=_0x25ebb0,this['changeGroups'][_0xa28739]['outdatedReason']=_0x385863,this['fire']('replyChangeGroupStateUpdated',{'reply':this,'index':_0xa28739,'state':_0x25ebb0,'outdatedReason':_0x385863});}getContentParts({showDiff:_0x20220b,groupIndex:_0x591671}){const _0x76dcae=this['_getCachedContentParts'](_0x20220b,_0x591671);if(_0x76dcae)return _0x76dcae;let _0x4aff06;if(void 0x0===_0x591671)_0x4aff06=this['changeGroups'];else{const _0x420dd5=this['changeGroups']['find'](({index:_0x1e211f})=>_0x1e211f===_0x591671);if(!_0x420dd5)throw new ct('ai-reply-get-content-parts-group-not-found',null,{'aiReply':this,'groupIndex':_0x591671});_0x4aff06=[_0x420dd5];}const _0x1de6b2=ln({'showDiff':_0x20220b,'changeGroups':_0x4aff06,'documentContextContent':this['documentContextContent']});return this['_setCachedContentParts'](_0x20220b,_0x1de6b2),_0x1de6b2;}_getCachedContentParts(_0x5da7ed,_0x1a02e0){const _0x5dbe24=_0x5da7ed?'withDiff':'withoutDiff';if(!this['cachedSuggestionContentParts'][_0x5dbe24]['length'])return null;const _0x554cbf=this['cachedSuggestionContentParts'][_0x5dbe24];if(void 0x0===_0x1a02e0)return _0x554cbf['length']>0x0&&_0x554cbf['length']!==this['changeGroups']['length']?(this['_setCachedContentParts'](_0x5da7ed,null),null):_0x182e99(_0x554cbf);{const _0x64a9c2=_0x554cbf['find'](({index:_0x36718f})=>_0x36718f===_0x1a02e0);if(_0x64a9c2)return[_0x182e99(_0x64a9c2)];}return null;}_setCachedContentParts(_0x402cab,_0x140a7c){const _0x5130a9=_0x402cab?'withDiff':'withoutDiff';_0x140a7c?_0x140a7c['forEach'](_0x3a8492=>{const _0x9e1516=this['cachedSuggestionContentParts'][_0x5130a9],_0x4286af=_0x9e1516['find'](({index:_0x380021})=>_0x380021===_0x3a8492['index']);if(_0x4286af){const _0x4e42a8=_0x9e1516['indexOf'](_0x4286af);_0x9e1516['splice'](_0x4e42a8,0x1,_0x3a8492);}else _0x9e1516['push'](_0x3a8492);}):this['cachedSuggestionContentParts'][_0x5130a9]['length']=0x0;}onContentChange(_0x4a8deb){if('modification'===this['type']){if(_0x4a8deb)this['parsedContent']['set'](_0x4a8deb,this['aiResponseParser']['parseAndNormalizeHTML'](this['content']['get'](_0x4a8deb)));else{for(const [_0x403c21,_0x48ce6d]of this['content'])this['parsedContent']['set'](_0x403c21,this['aiResponseParser']['parseAndNormalizeHTML'](_0x48ce6d));}const _0x44591f=this['changeGroups'];for(const _0x5239d0 of this['content']['keys']())this['updateChangeGroups'](_0x5239d0);const _0x241e7e=this['_getDifferentChangeGroups'](_0x44591f,this['changeGroups']);(_0x241e7e['length']||this['isDone'])&&(this['fire']('replyContentUpdated',this,_0x241e7e),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(_0xe0f66d,_0x10756b){const _0x425edb=[];for(const _0x227e08 of _0x10756b){const _0x5a550b=_0xe0f66d[_0x227e08['index']];_0x5a550b?_0x5a550b['changes']['length']!==_0x227e08['changes']['length']?_0x425edb['push'](_0x227e08):_0x5a550b['changes']['forEach']((_0x546c09,_0x48a2ab)=>{const _0x10829c=_0x227e08['changes'][_0x48a2ab];_0x546c09['id']!==_0x10829c['id']&&_0x425edb['push'](_0x227e08);}):_0x425edb['push'](_0x227e08);}return _0x425edb;}updateChangeGroups(_0x253584){const _0xd8ef37=this['documentContextContent']['get'](_0x253584),_0x5480af=this['parsedContent']['get'](_0x253584);if(!_0xd8ef37||!_0x5480af)return;const _0x2c2e9c=new _0x122249('p',{},[new _0x122249('span',{'style':'color:\x20#808080;\x20font-style:\x20italic'},[new _0x36754e(Es(this['locale'],'AI_SUGGESTION_CONTENT_PART_REMOVED'))])]),_0x149101=this['aiResponseApplier']['merge'](_0x5480af,_0xd8ef37['cloneNode'](!0x0),{'cutAfterUnstable':!this['isDone']||!this['isComplete'],'replaceRemovedWith':_0x2c2e9c});this['parsedMergedContent']['set'](_0x253584,_0x149101['parsedContent']);let _0x30ca85=[];if(_0xbb5ed2(_0x4809a3=>{const _0x224be3=Ps(_0x4809a3,'data-id');if(!_0x224be3||!_0x303750(_0x224be3))return!0x1;const _0x2837e7=[_0x4809a3,...Ms(_0x4809a3)]['at'](-0x2);if(_0x4809a3!=_0x2837e7){const _0x496abb=Ps(_0x2837e7,'data-id');_0x303750(_0x496abb)||(_0x30ca85['push']({'node':_0x2837e7,'id':_0x496abb,'type':'modified'}),_0x149101['modifiedNodeIds']['push'](_0x496abb));}else _0x149101['modifiedNodeIds']['includes'](_0x224be3)?_0x30ca85['push']({'node':_0x4809a3,'type':'modified','id':_0x224be3}):_0x149101['newNodeIds']['includes'](_0x224be3)?_0x30ca85['push']({'node':_0x4809a3,'type':'new','id':_0x224be3,'anchorId':Ps(_0x4809a3['previousSibling'],'data-id')}):_0x30ca85['push']({'node':_0x4809a3,'type':'removed','id':_0x224be3});return!0x0;},this['parsedMergedContent']['get'](_0x253584)),_0x30ca85=_0x30ca85['filter'](({node:_0x3716bc})=>[...Ms(_0x3716bc),_0x3716bc]['every'](_0x595345=>!Ps(_0x595345,'data-unstable'))),this['changeGroups']=this['changeGroups']['filter'](_0xd60e2c=>_0xd60e2c['documentId']!==_0x253584),0x0==_0x30ca85['length'])return;const _0x4c4f2b=[[_0x30ca85[0x0]]];for(let _0x1fc661=0x1;_0x1fc661<_0x30ca85['length'];_0x1fc661++){const _0x1b391e=_0x4c4f2b[_0x4c4f2b['length']-0x1],_0x468e88=_0x1b391e[_0x1b391e['length']-0x1];_0x30ca85[_0x1fc661]['node']['previousSibling']==_0x468e88['node']&&'modified'!=_0x30ca85[_0x1fc661]['type']&&'modified'!=_0x468e88['type']?_0x1b391e['push'](_0x30ca85[_0x1fc661]):_0x4c4f2b['push']([_0x30ca85[_0x1fc661]]);}for(const _0x45b7f2 of _0x4c4f2b){const _0xb83892=_0x45b7f2[0x0],_0x35221f=_0x45b7f2[_0x45b7f2['length']-0x1],_0x43de30=_0x49aa49(_0xb83892['node']['previousSibling']);_0x43de30&&_0x45b7f2['unshift'](_0x43de30);const _0x54abb5=_0x49aa49(_0x35221f['node']['nextSibling']);_0x54abb5&&_0x45b7f2['push'](_0x54abb5);}ks('data-wrapped-id',null,this['parsedMergedContent']['get'](_0x253584))['forEach'](_0x2c2ae2=>{Ds(_0x2c2ae2,'data-wrapped-id',null);});const _0x5206de=new Map();ks('data-unwrapped-id',null,this['parsedMergedContent']['get'](_0x253584))['forEach'](_0x47adb1=>{const _0x4d66f1=Ps(_0x47adb1,'data-unwrapped-id'),_0x3bef97=Ps(_0x47adb1,'data-id');_0x5206de['set'](_0x3bef97,_0x4d66f1),Ds(_0x47adb1,'data-id',_0x4d66f1),Ds(_0x47adb1,'data-unwrapped-id',null);});for(const _0x12dd81 of _0x30ca85){const _0xeac10a=_0x5206de['get'](_0x12dd81['id']);_0xeac10a&&(_0x12dd81['id']=_0xeac10a);}this['changeGroups']['push'](..._0x4c4f2b['map']((_0x32b85e,_0xc1aca4)=>{const _0x5a8b58=this['_documentIdToSource']['get'](_0x253584),_0x3afc7b=this['_outdatedReasonByDocumentId']?.['get'](_0x253584),_0x4dffc7=this['areActionsDisabled']||void 0x0!==_0x3afc7b;return{'changes':_0x32b85e,'state':_0x4dffc7?'outdated':'pending','outdatedReason':_0x4dffc7?_0x3afc7b:void 0x0,'index':_0xc1aca4,'editor':_0x5a8b58['editor'],'rootName':_0x5a8b58['rootName'],'documentId':_0x253584};}));const _0xcf5402=Array['from'](this['documentContextContent']['keys']());function _0x303750(_0x18cbfc){return _0x149101['modifiedNodeIds']['includes'](_0x18cbfc)||_0x149101['newNodeIds']['includes'](_0x18cbfc)||_0x149101['removedNodeIds']['includes'](_0x18cbfc);}function _0x49aa49(_0x38526e){if(_0x38526e&&Ps(_0x38526e,'data-id')&&!Ps(_0x38526e,'data-unstable')){const _0x12a9bf=Ps(_0x38526e,'data-id');if(!_0x303750(_0x12a9bf))return{'node':_0x38526e,'type':'context','id':_0x12a9bf};}return null;}this['changeGroups']['sort']((_0x58c98e,_0x14b47d)=>_0xcf5402['indexOf'](_0x58c98e['documentId'])-_0xcf5402['indexOf'](_0x14b47d['documentId'])),this['changeGroups']['forEach']((_0x5c660d,_0x7818c)=>{_0x5c660d['index']=_0x7818c;});}};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:_0xe2e315,locale:_0x1392fe,channelsToEditors:_0x3d9f4e}){super(),this['id']=kt(),this['connector']=_0xe2e315,this['isStopped']=!0x0,this['locale']=_0x1392fe,this['_channelsToEditors']=_0x3d9f4e||new Map();}async start(){await this['_run']();}async['resume'](_0x5921de){await this['_run'](_0x5921de);}async['_run'](_0x3d479e){const _0x2eeddf=[];let _0x3d3712,_0x95f08a,_0x376e64,_0x4341bb=!0x1;this['isStopped']=!0x1;try{this['currentRequest']=_0x3d479e||this['sendRequest'](),this['fire']('interactionStarted',this);const _0x2617f5=await this['currentRequest']['getStream']();for await(const _0x31940c of _0x2617f5){if(this['isStopped'])return;if('error'==_0x31940c['event'])return void this['fire']('error',{'error':new ct('ai-chat-interaction-error',this)});switch(_0x31940c['event']){case'message-metadata':this['messageId']=_0x31940c['data']['messageId'];break;case'action-metadata':this['actionCallId']=_0x31940c['data']['callId'];break;case'conversation-title':this['setConversationTitle'](_0x31940c['data']['conversationTitle'],!0x0);break;case'source':_0x2eeddf['push'](_0x31940c['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'](),_0x3d3712='modification-delta'==_0x31940c['event']?'modification':'text',_0x95f08a='modification-delta'==_0x31940c['event']?_0x31940c['data']['id']:void 0x0,this['currentReply']&&this['currentReply']['type']!=_0x3d3712&&(this['currentReply']['done'](),this['currentReply']=void 0x0),this['currentReply']||(this['currentReply']=this['createReply']({'type':_0x3d3712,'interactionId':this['id'],'id':_0x95f08a,'channelsToEditors':this['_channelsToEditors'],...'modification-delta'==_0x31940c['event']&&{'documentId':_0x31940c['data']['documentId']}}),'modification'==_0x3d3712&&(this['currentReply']['sources']=_0x2eeddf['splice'](0x0))),this['currentReply']['appendContent'](_0x31940c['data']['textDelta'],_0x31940c['data']['documentId']);break;case'mcp-tool-result':_0x376e64=JSON['parse'](_0x31940c['data']['result']),this['_handleToolResultData']({'toolName':_0x31940c['data']['toolName'],'data':_0x376e64['data'],'attributes':_0x376e64['attributes']});break;case'mcp-tool-notification':this['_handleToolNotificationData']({'toolName':_0x31940c['data']['toolName'],'data':_0x31940c['data']['data']});}}_0x4341bb=!0x0;}finally{this['isStopped']||(this['currentReply']&&_0x2eeddf['length']>0x0&&(this['currentReply']['sources']=_0x2eeddf['splice'](0x0)),this['_finalizeInteraction'](_0x4341bb),this['fire']('interactionFinished',this));}}stop(){this['isStopped']||(this['_finalizeInteraction'](),this['fire']('interactionStopped',this));}getReply(_0x1ad618){return this['replies']['find'](_0x2f4758=>_0x2f4758['id']===_0x1ad618);}destroy(){this['isDestroyed']||(this['stop'](),this['replies']['forEach'](_0x1e2e20=>_0x1e2e20['destroy']()),this['replies']=[],this['isDestroyed']=!0x0,this['fire']('interactionDestroyed',this),this['stopListening']());}createReply(_0x535f8f){const _0xaa086d=this['getDocumentContext'](),_0x3153e4=new Vn({'locale':this['locale'],'documentContextContent':_0xaa086d?.['documents'],..._0x535f8f});return this['replies']['push'](_0x3153e4),_0x3153e4['delegate'](...Gn)['to'](this),this['fire']('replyCreated',_0x3153e4),_0x3153e4;}setConversationTitle(_0x3251b4,_0x2da4a1=!0x1){this['fire']('setConversationTitle',_0x3251b4,_0x2da4a1);}resetWebSearchState(){this['_isWebSearching']&&(this['_isWebSearching']=!0x1,this['fire']('webSearchFinished',this));}resetReasoningState(){this['_isReasoning']&&(this['_isReasoning']=!0x1,this['fire']('reasoningFinished',this));}_handleToolResultData(_0x25656a){this['fire']('toolDataReceived',{'type':'result','toolName':_0x25656a['toolName'],'data':structuredClone(_0x25656a['data']||{}),'attributes':structuredClone(_0x25656a['attributes']||{})},this);}_handleToolNotificationData(_0x3c6990){this['fire']('toolDataReceived',{'type':'notification','toolName':_0x3c6990['toolName'],'data':structuredClone(_0x3c6990['data'])},this);}_finalizeInteraction(_0x225531=!0x1){this['isStopped']=!0x0,this['currentRequest']&&this['currentRequest']['abortController']['abort'](),this['currentReply']&&this['currentReply']['done'](_0x225531),this['currentRequest']=this['currentReply']=void 0x0;}};const Kn='defaultContextIds',Wn=/* #__PURE__ -- @preserve */
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:_0x5b2ad2,title:_0x1a1c4d,createdAt:_0x3c6b13,updatedAt:_0x1cf9b3,pinned:_0x439c13}){super(),this['id']=_0x5b2ad2,this['createdAt']=new Date(_0x3c6b13),this['set']('title',_0x1a1c4d),this['set']('updatedAt',_0x1cf9b3?new Date(_0x1cf9b3):null),this['set']('pinned',_0x439c13||!0x1);}updateTitle(_0x37afdf){this['set']('title',_0x37afdf),this['updatedAt']=new Date();}updatePinned(_0x498209){this['set']('pinned',_0x498209),this['updatedAt']=new Date();}};const Sa=/* #__PURE__ -- @preserve */
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:_0x56ca62,contentNew:_0x2d1676,contentInitial:_0x1aa3a1,documentVersion:_0x558b01}){super(),this['id']=_0x56ca62,this['contentNew']=_0x2d1676,this['contentInitial']=_0x1aa3a1,this['documentVersion']=_0x558b01;}};const Vh=/* #__PURE__ -- @preserve */
39
- At();var Bh=class extends Vh{['id'];parent;editor;_data;_editorOperations=[];constructor(_0x23d09d,_0x21ed51,_0x43c84a,_0x44127b){super(),this['id']=_0x23d09d,this['parent']=_0x43c84a,this['editor']=_0x44127b,this['_data']=_0x21ed51,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(_0xccb157){const _0x4c195f=Rs(_0xccb157)['children']['filter'](_0x40b07f);return 0x1!==_0x4c195f['length']?_0xccb157:_0x4c195f[0x0]['children']['map'](_0xbd44d8=>Os(_0xbd44d8))['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(_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 _0x2d31d9,ContextPlugin as _0x212144,Editor as _0x2a0bfb,Plugin as _0x19488e,rootAcceptsBlocks as _0x1dc860}from'@ckeditor/ckeditor5-core';import{IconAI as _0x3236d4,IconAIAdjustLength as _0x2dada8,IconAIAskAI as _0x7ab78f,IconAIChangeTone as _0x3007be,IconAIChat as _0x23ba37,IconAIChatCommands as _0xedc76b,IconAIContinueWriting as _0x28e5af,IconAIGrammarCheck as _0x56be77,IconAIHistory as _0x462166,IconAIImproveWriting as _0x23eeb2,IconAIOther as _0x3cb71d,IconAIQuickActions as _0x13034c,IconAIReview as _0x1f8cfb,IconAITranslate as _0x1bcc6c,IconBoxWithCheck as _0xc68c2d,IconBoxWithCross as _0x17c14c,IconBoxWithMarker as _0x4745b9,IconBrowseFiles as _0x2adbc2,IconBulb as _0x588d47,IconCancel as _0xabec2d,IconCheck as _0x5517bf,IconChevronDown as _0x43d5c7,IconChevronRight as _0xec4159,IconChevronUp as _0x4c02c1,IconCopy as _0x208a90,IconDocument as _0x38d218,IconDocumentOutline as _0x17766e,IconDropdownArrow as _0x2d80b8,IconError as _0x4f387d,IconEye as _0x1d1512,IconEyeCrossedOut as _0x2e2674,IconFileUpload as _0x544acb,IconImage as _0x46256d,IconInfo as _0x4790d7,IconLink as _0x43c1c8,IconLoupe as _0x69c189,IconMagicWand as _0x49d247,IconMaximize as _0x579826,IconMinimize as _0x10e858,IconNextArrow as _0x4cec77,IconOutdated as _0xa15aa9,IconPaperClip as _0x98a188,IconPin as _0x94766d,IconPlus as _0x129a73,IconPreviousArrow as _0x202389,IconRefresh as _0x1de2fd,IconRevisionHistory as _0x57bdce,IconRobotPencil as _0x2f6a93,IconSelection as tt,IconShowChangesOff as et,IconShowChangesOn as it,IconStop as st,IconSubmit as nt,IconThreeHorizontalDots as rt,IconThumbDown as ot,IconThumbUp as at,IconWeb as ht}from'@ckeditor/ckeditor5-icons';import{CKEditorError as ct,Collection as lt,DomEmitterMixin as ut,EmitterMixin as dt,FocusTracker as _t,KeystrokeHandler as gt,ObservableMixin as At,Rect as It,ResizeObserver as pt,_isMotionReduced as Et,first as mt,getConstrainedViewportRect as Tt,global as wt,insertToPriorityArray as Ct,isVisible as ft,logError as bt,logWarning as St,scrollAncestorsToShowTarget as Rt,scrollViewportToShowTarget as Ot,toArray as vt,uid as kt,version as yt}from'@ckeditor/ckeditor5-utils';import{AutocompleteView as Nt,BalloonPanelView as xt,BalloonToolbar as Lt,BodyCollection as Pt,ButtonLabelView as Dt,ButtonLabelWithHighlightView as Ht,ButtonView as Mt,Dialog as Ut,DialogViewPosition as Vt,DropdownMenuPanelPositioningFunctions as Bt,FileDialogButtonView as Gt,FocusCycler as Ft,FormHeaderView as Kt,FormRowView as Wt,HighlightedTextView as Yt,IconView as $t,InputTextView as qt,LabeledFieldView as Qt,ListItemButtonView as Xt,ListItemGroupView as zt,ListItemView as jt,ListView as Jt,MenuBarMenuListItemButtonView as Zt,MenuBarMenuListItemView as te,MenuBarMenuListView as _0x164ccd,MenuBarMenuView as _0x4888f9,SearchTextView as _0x10e0e0,SpinnerView as _0x5a896c,Template as _0x4937f3,TextareaView as _0x3a49c8,ToolbarView as _0x24660c,UIModel as _0xd62086,View as _0x4ff2da,ViewCollection as _0x50bc02,addListToDropdown as _0x3196cc,addMenuToDropdown as _0xf691cd,clickOutsideHandler as _0x341840,createDropdown as _0x5a954d,createLabeledInputText as _0x3b9224,createLabeledTextarea as _0x293ea1,submitHandler as _0x5875a6}from'@ckeditor/ckeditor5-ui';import{ClipboardMarkersUtils as _0x592e3f,ClipboardPipeline as _0x4c2163}from'@ckeditor/ckeditor5-clipboard';import{InsertOperation as _0x86d081,MarkerOperation as _0x171060,Matcher as _0x1deb35,ModelDocumentFragment as _0x5eb9f7,ModelPosition as _0x53921a,ModelRange as _0x2af2ad,ModelTreeWalker as _0x2a0ccb,ViewDataTransfer as _0x381edb,ViewDocumentDomEventData as _0x2b7cc4,ViewDowncastWriter as _0x24fafe,ViewUpcastWriter as _0x10bc29,_DetachOperation as _0x19e331,_insertIntoModelNodeList as _0x1b6802,_removeFromModelNodeList as _0x4f5333,transformOperationSets as _0x3b7a23}from'@ckeditor/ckeditor5-engine';import{cloneDeep as _0x54d2c3,debounce as _0x220e40,escape as _0x34830a,escapeRegExp as _0x306a2e,omit as _0x5a008a,throttle as _0x43ff3d,unescape as _0x39f176}from'es-toolkit/compat';import{createParser as _0x4df230}from'eventsource-parser';import{CloudServices as _0x1ec8f8}from'@ckeditor/ckeditor5-cloud-services';import{parseDocument as _0x5bea4e}from'htmlparser2';import{append as _0x10069f,appendChild as _0x2cdc39,find as _0x3932c0,findAll as _0x26a2ae,findOne as _0xdb5da,getChildren as _0xe31aff,getParent as _0x1f37eb,isComment as _0x36dce3,isTag as _0x438723,prepend as ti,prependChild as _0xf08298,removeElement as _0x4ebff9,replaceElement as _0x444916,textContent as _0x39a5c5}from'domutils';import _0x3a1450 from'dom-serializer';import{Document as _0x35605c,Element as _0x5b6203,NodeWithChildren as _0x4eb033,Text as _0x5be0d8,cloneNode as _0x246402,isDocument as _0x4591e9,isText as _0x8a421e}from'domhandler';import{ConfirmMixin as _0x4002ba,DATA_ID_MODEL_ATTRIBUTE as _0x4274f2,DATA_ID_VIEW_ATTRIBUTE as _0x552318,DocumentCompare as _0x5388eb,PillView as _0x18ca88,SuggestionsConversion as _0x11ff4f,fixElementSuggestionRange as _0x283dbd,getAllMarkersDomElementsSorted as _0x37a243,getMarkerDomElement as _0x196856,isInvalidAttributeOperation as _0x22fa04}from'@ckeditor/ckeditor5-collaboration-core';import{MarkdownGfmMdToHtml as _0x37f450,MarkdownGfmMdToHtmlDefaultPlugins as _0x3d6e18}from'@ckeditor/ckeditor5-markdown-gfm';import _0x158f1a from'rehype-sanitize';import _0x1f22dd from'morphdom';import{diffArrays as _0x285f11}from'diff';const vi='_ungrouppedCommands';function ki(_0x357887,_0x268fbe){const _0x28e06d=(0x0,_0x268fbe['t'])('Other');return _0x357887['length']?'groupId'in _0x357887[0x0]?_0x357887:[{'groupId':vi,'groupLabel':_0x28e06d,'order':0x1/0x0,'commands':_0x357887}]:[{'groupId':vi,'groupLabel':_0x28e06d,'order':0x1/0x0,'commands':[]}];}const yi=globalThis['DataTransfer'],Ni='ai-ui';var xi=class extends _0x19488e{static get['pluginName'](){return'AIAssistantEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const {editor:_0x52bfea}=this,_0x4aa43f=['ck-fake-ai-selection'];_0x52bfea['config']['get']('ai.assistant.useTheme')&&_0x4aa43f['push']('ck-ai-assistant-ui_theme'),_0x52bfea['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Ni,'view':{'classes':_0x4aa43f,'priority':0xc}}),_0x52bfea['conversion']['for']('editingDowncast')['markerToElement']({'model':Ni,'view':(_0x2a3211,{writer:_0x25e036})=>{if(!_0x2a3211['markerRange']['isCollapsed'])return null;const _0x5a59f9=_0x25e036['createUIElement']('span');return _0x25e036['addClass'](['ck-fake-ai-selection','ck-fake-ai-selection_collapsed'],_0x5a59f9),_0x5a59f9;}});}afterInit(){!async function(_0x3d517d){const _0x1c49ff='nA7yurgOHbZvDplRkJscdICm86oPWx92f1qF0LaSX3NGwTMK4jVtYUBQi5zheE',_0x21d760=0x79158,_0x149aef=window['Date']['now'](),_0x435adf=_0x3d517d['editor'],_0x5e30bb=new window['Promise'](_0xed3f36=>{_0x435adf['once']('ready',_0xed3f36);}),_0x1c305f={'kty':'EC','use':'sig','crv':'P-256','x':'iCjOCvDFI6lQHHT18jVwRfkfHQ2a_MymT35LQVoFSAI','y':'kXIyJ4evtCEFRmxKSUpK9fDW459vXOvVrhf6uQAeOio','alg':'ES256'},_0x1778db=_0x435adf['config']['get']('licenseKey');async function _0x468413(){let _0x5f2af4,_0x33d01d=null,_0x19060e=null;try{return'GPL'==_0x1778db?'NotAllowed':(_0x5f2af4=_0x29cbb6(),_0x5f2af4?(_0x5f2af4['usageEndpoint']&&(_0x19060e=_0x1ea737(_0x5f2af4['usageEndpoint'],_0x5f2af4['jti'])),await _0x17cb48()?_0x96529c()?_0x3db2c8()?'Expired':_0xbb6f8e()?('evaluation'==_0x5f2af4['licenseType']&&(_0x33d01d=_0x52faf0('EvaluationLimit')),await _0x2267fa()):'DomainLimit':'NotAllowed':'Invalid'):'Invalid');}catch{return'Invalid';}function _0x3db2c8(){const _0x39b2d4=['evaluation','trial']['includes'](_0x5f2af4['licenseType'])?_0x149aef/0x3e8:0xe10*_0x21d760;return _0x5f2af4['exp']<_0x39b2d4;}function _0x96529c(){const _0x3659ff=_0x5f2af4['features'];return!!_0x3659ff&&(!!_0x3659ff['includes']('*')||!!_0x3659ff['includes']('AI'));}function _0xbb6f8e(){const _0x50d4bb=_0x5f2af4['licensedHosts'];if(!_0x50d4bb||0x0==_0x50d4bb['length'])return!0x0;const {hostname:_0x255005}=new URL(window['location']['href']);if(_0x50d4bb['includes'](_0x255005))return!0x0;const _0x17cac0=_0x255005['split']('.');return _0x50d4bb['filter'](_0x483026=>_0x483026['includes']('*'))['map'](_0x3e52cf=>_0x3e52cf['split']('.'))['filter'](_0x2bf42b=>_0x2bf42b['length']<=_0x17cac0['length'])['map'](_0x4986d0=>Array(_0x17cac0['length']-_0x4986d0['length'])['fill']('*'===_0x4986d0[0x0]?'*':'')['concat'](_0x4986d0))['some'](_0x2ad81a=>_0x17cac0['every']((_0x231085,_0x496b0a)=>_0x2ad81a[_0x496b0a]===_0x231085||'*'===_0x2ad81a[_0x496b0a]));}function _0x2267fa(){return _0x33d01d&&_0x19060e?new window['Promise']((_0x42ecfb,_0x22492a)=>{_0x33d01d['then'](_0x42ecfb,_0x22492a),_0x19060e['then'](_0xbf8894=>{'Valid'!=_0xbf8894&&_0x42ecfb(_0xbf8894);},_0x22492a);}):_0x33d01d||_0x19060e||'Valid';}}function _0x1ea737(_0x37bca2,_0x4bd4ea){return new window['Promise'](_0x1df9d0=>{if(_0x236e07())return _0x1df9d0('Valid');_0x4f13d0(),_0x435adf['decorate']('_sendUsageRequest');let _0x4191bb=!0x1;const _0x2f6863=kt();function _0x29870d(_0xaa6ae4){return!!_0xaa6ae4&&('object'==typeof _0xaa6ae4||'function'==typeof _0xaa6ae4)&&'function'==typeof _0xaa6ae4['then']&&'function'==typeof _0xaa6ae4['catch'];}function _0x2b1f77(_0x12b0f7){_0x2f83e2(_0x12b0f7)['then'](_0x4905b3=>_0x4905b3&&'ok'==_0x4905b3['status']?_0x423d58(_0x42b23b(_0x2f6863+_0x4bd4ea))!=_0x4905b3['verification']?'UsageLimit':'Valid':'UsageLimit')['then'](_0xe69150=>(_0x36bd8e(),_0xe69150),()=>{const _0x5cc4b4=_0x4425b4();return null==_0x5cc4b4?(_0x36bd8e(),'Valid'):_0x149aef-_0x5cc4b4>0x240c8400?'UsageLimit':'Valid';})['then'](_0x1df9d0)['catch'](()=>{_0x1df9d0('UsageLimit');});const _0x3342a1=0x36ee80;function _0x36bd8e(){const _0x1a1562='llct-'+_0x423d58(_0x42b23b(_0x37bca2)),_0xb51964=_0x3be111(_0x423d58(window['Math']['ceil'](_0x149aef/_0x3342a1)));window['localStorage']['setItem'](_0x1a1562,_0xb51964);}function _0x4425b4(){const _0xaaa990='llct-'+_0x423d58(_0x42b23b(_0x37bca2)),_0x1683a7=window['localStorage']['getItem'](_0xaaa990);return _0x1683a7?window['parseInt'](_0x3be111(_0x1683a7),0x10)*_0x3342a1:null;}function _0x2f83e2(_0x3a51d1){return new window['Promise']((_0x318ba1,_0x6d5bc)=>{_0x3a51d1['then'](_0x318ba1,_0x6d5bc),window['setTimeout'](_0x6d5bc,0x1d4c0);});}}_0x435adf['on']('_sendUsageRequest',(_0x3d8b8f,_0x2f6d7b)=>{if(_0x2f6d7b[0x0]!=_0x37bca2)return _0x1df9d0('UsageLimit');_0x2f6d7b[0x1]={..._0x2f6d7b[0x1],'requestId':_0x2f6863};},{'priority':'high'}),_0x435adf['on']('_sendUsageRequest',_0x1016b0=>{_0x29870d(_0x1016b0['return'])&&(_0x4191bb=!0x0,_0x2b1f77(_0x1016b0['return']));},{'priority':'low'}),_0x5e30bb['then'](()=>{_0x4191bb||_0x1df9d0('UsageLimit');});});function _0x236e07(){return'auto'==_0x435adf['editing']['view']['_overlayModeHint'];}function _0x4f13d0(){_0x435adf['editing']['view']['_overlayModeHint']='auto';}}function _0x52faf0(_0xf35e03){const _0x2692dd=[new window['Promise'](_0x2e646f=>setTimeout(_0x2e646f,0x93ecc)),_0x5e30bb['then'](()=>new window['Promise'](_0x481eeb=>{let _0x544402=0x0;_0x435adf['model']['on']('applyOperation',(_0x24d184,_0x533dc7)=>{_0x533dc7[0x0]['isDocumentOperation']&&_0x544402++,0x5e8==_0x544402&&(_0x481eeb(),_0x24d184['off']());});}))];return window['Promise']['race'](_0x2692dd)['then'](()=>_0xf35e03);}async function _0x4c8ae3(){await _0x5e30bb,_0x435adf['model']['change']=_0x40229b,_0x435adf['model']['enqueueChange']=_0x40229b,_0x435adf['enableReadOnlyMode']('model');}function _0x3b66ab(_0x5c9ea2){const _0x86125c=_0x4c8244();_0x435adf[_0x86125c]='aiLicenseKey'+_0x5c9ea2,'Valid'!=_0x5c9ea2&&_0x4c8ae3();}function _0x4c8244(){const _0x600a20=window['String'](window['performance']['now']())['replace']('.','');let _0x1822bf='n';for(let _0x309690=0x0;_0x309690<_0x600a20['length'];_0x309690+=0x2){let _0x3b2bae=window['parseInt'](_0x600a20['substring'](_0x309690,_0x309690+0x2));_0x3b2bae>=0x3e&&(_0x3b2bae-=0x3e),_0x1822bf+=_0x1c49ff[_0x3b2bae];}return _0x1822bf;}function _0x29cbb6(){const _0x440ebc=_0x1778db['split']('.');if(0x3!=_0x440ebc['length'])return null;return _0x48a2e5(_0x440ebc[0x1]);function _0x48a2e5(_0x15b816){const _0x4e4b51=_0x44f231(_0x15b816);return _0x4e4b51&&_0x218bfa()?_0x4e4b51:null;function _0x218bfa(){const _0xcb66e1=_0x4e4b51['jti'],_0x117ed5=window['parseInt'](_0xcb66e1['substring'](_0xcb66e1['length']-0x8),0x10),_0x2dbfc3={..._0x4e4b51,'jti':_0xcb66e1['substring'](0x0,_0xcb66e1['length']-0x8)};return delete _0x2dbfc3['vc'],_0x42b23b(_0x2dbfc3)==_0x117ed5;}}}async function _0x17cb48(){let _0x2ff706=!0x0;try{const [_0x3913f7,_0xc24d01,_0x2bfd63]=_0x1778db['split']('.');return _0x1a4c02(_0x3913f7),await _0x17079b(_0x3913f7,_0xc24d01,_0x2bfd63),_0x2ff706;}catch{return!0x1;}function _0x1a4c02(_0x5747f8){const _0x1c7b28=_0x44f231(_0x5747f8);_0x1c7b28&&'ES256'==_0x1c7b28['alg']||(_0x2ff706=!0x1);}async function _0x17079b(_0x145244,_0x5b15b0,_0xc2c1b1){const _0x1ebfc0=window['Uint8Array']['from'](_0x43a028(_0xc2c1b1),_0x1d3b02=>_0x1d3b02['charCodeAt'](0x0)),_0x2d04cd=new window['TextEncoder']()['encode'](_0x145244+'.'+_0x5b15b0),_0x420dee=window['crypto']['subtle'];if(!_0x420dee)return;const _0x4d921c=await _0x420dee['importKey']('jwk',_0x1c305f,{'name':'ECDSA','namedCurve':'P-256'},!0x1,['verify']);await _0x420dee['verify']({'name':'ECDSA','hash':{'name':'SHA-256'}},_0x4d921c,_0x1ebfc0,_0x2d04cd)||(_0x2ff706=!0x1);}}function _0x44f231(_0xcba195){return _0xcba195['startsWith']('ey')?JSON['parse'](_0x43a028(_0xcba195)):null;}function _0x43a028(_0x357638){return window['atob'](_0x357638['replace'](/-/g,'+')['replace'](/_/g,'/'));}function _0x42b23b(_0xc6f15b){let _0x5edff2=0x1505;function _0xced889(_0x20b691){for(let _0xf2c576=0x0;_0xf2c576<_0x20b691['length'];_0xf2c576++){const _0x1ef0d2=_0x20b691['charCodeAt'](_0xf2c576);_0x5edff2=(_0x5edff2<<0x5)+_0x5edff2+_0x1ef0d2,_0x5edff2&=_0x5edff2;}}function _0x14b312(_0x53e592){Array['isArray'](_0x53e592)?_0x53e592['forEach'](_0x14b312):_0x53e592&&'object'==typeof _0x53e592?Object['entries'](_0x53e592)['sort']()['forEach'](([_0x106fc7,_0x37086b])=>{_0xced889(_0x106fc7),_0x14b312(_0x37086b);}):_0xced889(window['String'](_0x53e592));}return _0x14b312(_0xc6f15b),_0x5edff2>>>0x0;}function _0x423d58(_0x423360){return _0x423360['toString'](0x10)['padStart'](0x8,'0');}function _0x3be111(_0x2407e9){return _0x2407e9['split']('')['reverse']()['join']('');}function _0x40229b(){}_0x3b66ab(await _0x468413());}(this);}showFakeVisualSelection(){const _0x70fe68=this['editor']['model'];_0x70fe68['change'](_0x2cd3e3=>{const _0x44a2f5=_0x70fe68['document']['selection']['getRanges']();let _0x3dd1f5=0x0;for(const _0x1d2f8c of _0x44a2f5){const _0x1ee7f9=Ni+':'+_0x3dd1f5;if(_0x70fe68['markers']['has'](_0x1ee7f9))_0x2cd3e3['updateMarker'](_0x1ee7f9,{'range':_0x1d2f8c});else{if(_0x1d2f8c['start']['isAtEnd']){const _0x2833ed=_0x1d2f8c['start']['getLastMatchingPosition'](({item:_0x558080})=>!_0x70fe68['schema']['isContent'](_0x558080),{'boundaries':_0x1d2f8c});_0x2cd3e3['addMarker'](_0x1ee7f9,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x2cd3e3['createRange'](_0x2833ed,_0x1d2f8c['end'])});}else _0x2cd3e3['addMarker'](_0x1ee7f9,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x1d2f8c});}_0x3dd1f5++;}});}hideFakeVisualSelection(){const _0x50f8bb=this['editor']['model'],_0x28a8d8=Array['from'](this['editor']['model']['markers']['getMarkersGroup'](Ni));_0x28a8d8['length']&&_0x50f8bb['change'](_0x29f642=>{_0x28a8d8['forEach'](_0xf7b4cb=>{_0x29f642['removeMarker'](_0xf7b4cb);});});}insertContent(_0x2647b6,_0x39591b){const _0x312eeb=this['_getAISelection'](),_0x117e82=_0x39591b||_0x312eeb['getFirstRange']();this['editor']['model']['canEditAt'](_0x117e82)&&this['editor']['model']['change'](_0x1ec9fe=>{this['hideFakeVisualSelection'](),_0x39591b||this['_resetContentOfSelectedTableCells'](_0x1ec9fe,_0x312eeb),this['_pasteHTMLUsingClipboard']({'insertAt':_0x117e82,'writer':_0x1ec9fe,'html':_0x2647b6});});}insertContentBelow(_0x430f50){const {model:_0xf1dd20}=this['editor'],_0x2d7d13=this['_getAISelection']();_0xf1dd20['change'](()=>{const _0x5a5811=this['_prepareTableInsertBelowPosition'](_0x430f50,_0x2d7d13)||this['_getDefaultInsertBelowPosition'](_0x2d7d13);this['insertContent'](_0x430f50,_0x5a5811);});}_getAISelection(){const _0x142e01=this['editor']['model'],_0x168e8c=Array['from'](_0x142e01['markers']['getMarkersGroup'](Ni))['map'](_0x3fea1f=>_0x3fea1f['getRange']());return _0x142e01['createSelection'](_0x168e8c);}_pasteHTMLUsingClipboard({writer:_0xa98a58,html:_0x1f0d57,insertAt:_0x492bf2}){const {view:_0x716878}=this['editor']['editing'],_0x26f380=this['editor']['plugins']['get'](_0x4c2163),_0x25dbf1=new yi();_0x25dbf1['setData']('text/html',_0x1f0d57);const _0x182a74=new _0x2b7cc4(_0x716878,new ClipboardEvent('paste',{'clipboardData':_0x25dbf1}),{'dataTransfer':new _0x381edb(_0x25dbf1)});_0xa98a58['setSelection'](_0x492bf2);const _0x269613=(_0x55aef9,_0x2cd437)=>{_0x2cd437['resultRange']&&_0xa98a58['setSelection'](_0x2cd437['resultRange']);};_0x26f380['once']('contentInsertion',_0x269613,{'priority':'lowest'}),_0x716878['document']['fire']('paste',_0x182a74),_0x26f380['off']('contentInsertion',_0x269613);}_getDefaultInsertBelowPosition(_0x2c1598){const {model:_0x50a60a}=this['editor'],_0xf42edb=Array['from'](_0x2c1598['getSelectedBlocks']());return _0xf42edb['length']?_0x50a60a['createPositionAfter'](_0xf42edb['pop']()):_0x2c1598['getLastPosition']();}_prepareTableInsertBelowPosition(_0x2cb961,_0x2a90f9){const {model:_0x909e43,plugins:_0x4f8bf1}=this['editor'];if(_0x4f8bf1['has']('TableUtils')){const _0x4ff77d=_0x4f8bf1['get']('TableUtils')['getSelectedTableCells'](_0x2a90f9);if(_0x4ff77d['length']){const _0x48829b=this['_getTableRowCountFromContent'](_0x2cb961),_0x262076=this['_createEmptyTableRows'](_0x4ff77d,_0x48829b);return _0x909e43['createPositionAt'](_0x262076,0x0);}}return null;}_getTableRowCountFromContent(_0x29035d){const _0x11ac89=this['editor']['plugins']['get']('TableUtils'),_0x1304fe=this['editor']['data']['parse'](_0x29035d,'$documentFragment'),_0x149053=Array['from'](_0x1304fe['getChildren']())['filter'](_0x483bc8=>_0x483bc8['is']('element','table'));let _0x45ac59=0x0;return _0x149053['forEach'](_0x2b8eb1=>{_0x45ac59+=_0x11ac89['getRows'](_0x2b8eb1);}),_0x45ac59;}_createEmptyTableRows(_0x27d15c,_0x4bd120){const _0x3d48ae=this['editor']['plugins']['get']('TableUtils'),_0x701ed5=_0x3d48ae['getRowIndexes'](_0x27d15c),_0x5a8299=_0x3d48ae['getColumnIndexes'](_0x27d15c),_0x1d127f=_0x701ed5['last']+0x1,_0x2bddc9=_0x5a8299['first'],_0x2250c3=_0x27d15c[0x0]['findAncestor']('table');for(let _0xa0ee37=0x0;_0xa0ee37<_0x4bd120;_0xa0ee37++)_0x3d48ae['insertRows'](_0x2250c3,{'at':_0x1d127f});return _0x2250c3['getChild'](_0x1d127f)['getChild'](_0x2bddc9);}_resetContentOfSelectedTableCells(_0x106ad9,_0x1ae439){const {plugins:_0x3312bb}=this['editor'],{model:_0x1c1d97}=_0x106ad9;_0x3312bb['has']('TableUtils')&&_0x3312bb['get']('TableUtils')['getSelectedTableCells'](_0x1ae439)['length']&&_0x1c1d97['deleteContent'](_0x1ae439);}},Li=class extends _0x19488e{static get['pluginName'](){return'AIAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}afterInit(){if(!this['textAdapter'])throw new ct('aiadapter-text-adapter-not-set',null);}},Pi=class extends Error{constructor(_0x557dca){super(_0x557dca),this['name']='AIRequestError';}};function Di(_0x254e9d,_0x2b8067,_0x47d95e){const t=_0x254e9d['t'];switch(_0x2b8067){case'Edit\x20or\x20review':return t('Edit\x20or\x20review');case'Improve\x20writing':return t('Improve\x20writing');case'Make\x20shorter':return t('Make\x20shorter');case'Make\x20longer':return t('Make\x20longer');case'Simplify\x20language':return t('Simplify\x20language');case'Generate\x20from\x20selection':return t('Generate\x20from\x20selection');case'Summarize':return t('Summarize');case'Continue':return t('Continue');case'Change\x20tone':return t('Change\x20tone');case'Professional':return t('Professional');case'Casual':return t('Casual');case'Direct':return t('Direct');case'Confident':return t('Confident');case'Friendly':return t('Friendly');case'Change\x20style':return t('Change\x20style');case'Business':return t('Business');case'Legal':return t('Legal');case'Journalism':return t('Journalism');case'Poetic':return t('Poetic');case'Translate':return t('Translate');case'English':return t('English');case'Spanish':return t('Spanish');case'German':return t('German');case'Portuguese':return t('Portuguese');case'French':return t('French');case'Simplified\x20Chinese':return t('Simplified\x20Chinese');case'Hindi':return t('Hindi');case'Arabic':return t('Arabic');case'AI\x20Assistant':return t('AI\x20Assistant');case'AI\x20Commands':return t('AI\x20Commands');case'Ask\x20AI\x20to\x20edit\x20or\x20generate':return t('Ask\x20AI\x20to\x20edit\x20or\x20generate');case'Ask\x20AI\x20to\x20improve\x20generated\x20text':return t('Ask\x20AI\x20to\x20improve\x20generated\x20text');case'Copy':return t('Copy');case'Submit':return t('Submit');case'Insert\x20below':return t('Insert\x20below');case'Try\x20again':return t('Try\x20again');case'Stop':return t('Stop');case'AI\x20is\x20writing...':return t('AI\x20is\x20writing...');case'AI\x20is\x20writing':return t('AI\x20is\x20writing');case'Generated\x20content:\x20%0':return t('Generated\x20content:\x20%0',_0x47d95e);case'Error\x20during\x20AI\x20content\x20generation:\x20%0':return t('Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x47d95e);case'History':return t('History');case'Empty\x20history':return t('Empty\x20history');case'Ask\x20AI\x20and\x20your\x20prompts\x20will\x20be\x20listed\x20here\x20for\x20you\x20to\x20use\x20later.':return t('Ask\x20AI\x20and\x20your\x20prompts\x20will\x20be\x20listed\x20here\x20for\x20you\x20to\x20use\x20later.');case'Prompt\x20history':return t('Prompt\x20history');case'Clear':return t('Clear');case'AI_REPLACE_CONTENT':return t({'id':'AI_REPLACE_CONTENT','string':'Replace'});case'AI_INSERT_CONTENT':return t({'id':'AI_INSERT_CONTENT','string':'Insert'});case'AI_ERROR_GET_HEADERS':return t({'id':'AI_ERROR_GET_HEADERS','string':'Preparing\x20request\x20headers\x20failed'});case'AI_ERROR_GET_PARAMETERS':return t({'id':'AI_ERROR_GET_PARAMETERS','string':'Preparing\x20request\x20parameters\x20failed'});case'AI_ERROR_UNSUPPORTED_MODEL':return t({'id':'AI_ERROR_UNSUPPORTED_MODEL','string':'The\x20requested\x20AI\x20model\x20(\x22%0\x22)\x20is\x20not\x20supported'},_0x47d95e);case'AI_ERROR_CONTEXT_LENGTH':return t({'id':'AI_ERROR_CONTEXT_LENGTH','string':'Selected\x20content\x20is\x20too\x20long'});case'AI_ERROR_MODERATION':return t({'id':'AI_ERROR_MODERATION','string':'Requested\x20query\x20does\x20not\x20pass\x20moderation\x20rules'});case'AI_ERROR_AWS_NOT_SUPPORTED':return t({'id':'AI_ERROR_AWS_NOT_SUPPORTED','string':'The\x20AWS\x20integration\x20is\x20no\x20longer\x20supported.\x20Please\x20contact\x20the\x20support.'});case'AI_ERROR_FAILED':return t({'id':'AI_ERROR_FAILED','string':'Failed\x20to\x20communicate\x20with\x20the\x20AI\x20service'});default:return _0x2b8067;}}var Hi=class extends _0x2d31d9{_commandDefinitions;constructor(_0x1b8536,_0x47ebcd){super(_0x1b8536),this['_commandDefinitions']=_0x47ebcd,this['set']('enabledCommandsIds',[]),this['on']('change:_hasContext',(_0x357eaa,_0x4ae7a6,_0x579070)=>{this['isEnabled']&&(this['enabledCommandsIds']=Mi(this['_commandDefinitions'],_0x579070));}),this['set']('_hasContext',!0x1),this['on']('change:isEnabled',(_0x368be6,_0x56f24a,_0x4688e4)=>{this['enabledCommandsIds']=_0x4688e4?Mi(this['_commandDefinitions'],this['_hasContext']):[];});}['refresh'](){const _0x2a4a7b=this['editor']['model'];this['_hasContext']=function(_0x52bcf5){const _0x2be887=_0x52bcf5['document']['selection'];return _0x2be887['isCollapsed']?0x0!==[..._0x2be887['getSelectedBlocks']()]['length']&&![..._0x2be887['getSelectedBlocks']()][0x0]['isEmpty']:!!_0x52bcf5['hasContent'](_0x2be887['getFirstRange']());}(_0x2a4a7b);const _0xa2ade2=_0x2a4a7b['document']['selection'],_0x32a563=this['editor']['config']['get']('ai.assistant.disabledElements');for(const _0x22d815 of _0xa2ade2['getRanges']())for(const _0x21cf15 of _0x22d815['getItems']())if(_0x21cf15['is']('element')&&_0x32a563['includes'](_0x21cf15['name']))return void(this['isEnabled']=!0x1);this['isEnabled']=!0x0;}execute(_0x1e5dae='',_0x7004be='',_0x3ee9b9='custom'){this['editor']['plugins']['get'](ts)['showUI'](_0x1e5dae,_0x7004be,_0x3ee9b9);}};function Mi(_0x396496,_0x34bba7){const _0x4bae13=new Set();for(const _0x44e24d of _0x396496['values']())(_0x34bba7||!0x1===_0x44e24d['requiresContent'])&&_0x4bae13['add'](_0x44e24d['id']);return Array['from'](_0x4bae13);}const Ui=new RegExp(/^(.*?)<[a-zA-Z][a-zA-Z0-9_\-.]*[ >]/,'is'),Vi=/* #__PURE__ -- @preserve */
24
+ At();var Bi=class extends Vi{editor;textAdapter;['view'];_sanitizationContainer;['_domParser'];['_xmlSerializer'];constructor(_0x484f5b,_0x4ac0ec,_0x363f68){super(),this['editor']=_0x484f5b,this['textAdapter']=_0x4ac0ec,this['_sanitizationContainer']=document['createElement']('div'),this['_domParser']=new DOMParser(),this['_xmlSerializer']=new XMLSerializer(),this['view']=_0x363f68,this['set']({'initialContext':'','currentContext':'','currentResponse':'','previousContext':void 0x0,'previousQuery':void 0x0,'previousLabel':void 0x0,'isProcessing':!0x1}),this['on']('set:currentContext',(_0x150750,_0x4b5b74,_0x6707f9)=>{this['view']['value']=this['_sanitizeHTML'](_0x6707f9);}),this['listenTo'](this['view'],'submitPrompt',(_0x393d01,_0x47910b)=>{const _0x5450f5=this['currentContext']||this['initialContext'];this['_handleQuery'](_0x47910b,_0x5450f5,'custom');}),this['listenTo'](this['view'],'tryAgainEvent',()=>{this['view']['prompt']=this['previousLabel'],this['_handleQuery'](this['previousQuery'],this['previousContext'],this['previousActionId'],this['previousLabel']);}),this['listenTo'](this['view'],'stopProcessing',()=>{this['stopProcessing']();});}destroy(){this['stopListening']();}async updateView({actionId:_0x3531e8,query:_0x3d973d,htmlContent:_0x509fa5,label:_0x2cbea4,mainActionLabel:_0x42865b}){this['view']['prompt']=_0x2cbea4,this['view']['mainAction']=_0x42865b,this['initialContext']=_0x509fa5,_0x3d973d&&(this['view']['isRendered']?this['_handleQuery'](_0x3d973d,_0x509fa5,_0x3531e8,_0x2cbea4):this['view']['once']('render',()=>{this['_handleQuery'](_0x3d973d,_0x509fa5,_0x3531e8,_0x2cbea4);}));}stopProcessing(){this['isProcessing']&&(this['isProcessing']=!0x1,this['view']['finishProcessing'](),this['textAdapter']['abort']());}reset(){this['initialContext']='',this['currentContext']='',this['currentResponse']='',this['previousContext']='',this['previousQuery']='',this['previousLabel']='',this['previousActionId']=void 0x0,this['view']['reset'](),this['stopProcessing']();}async['_handleQuery'](_0x288d51,_0x2aee1d,_0x4cad55,_0x10bf6a){return this['isProcessing']=!0x0,this['view']['startProcessing'](),this['previousContext']=_0x2aee1d,this['previousQuery']=_0x288d51,this['previousLabel']=_0x10bf6a||_0x288d51,this['previousActionId']=_0x4cad55,new Promise(_0xa35e43=>{this['textAdapter']['makeRequest']({'query':_0x288d51,'context':_0x2aee1d,'onData':_0x5def3e=>{this['currentResponse']=_0x5def3e,this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse']);},'actionId':_0x4cad55})['then'](()=>{!this['currentContext']&&this['currentResponse']&&(this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse'],!0x0));})['catch'](_0x1b01c0=>{_0x1b01c0 instanceof Pi?this['view']['handleError'](_0x1b01c0['message']):this['view']['handleError'](),_0xa35e43();})['finally'](()=>{this['stopProcessing'](),_0xa35e43();});});}_parseAndNormalizeContent(_0x613a60,_0x33af43=!0x1){const _0x3010d5=Ui['exec'](_0x613a60);_0x613a60=_0x3010d5?_0x613a60['substring'](_0x3010d5[0x1]['length']):_0x613a60['length']<0x64&&!_0x33af43?'':this['_stripMarkdownSyntax'](_0x613a60);const _0x5f4bdb=this['_domParser']['parseFromString'](_0x613a60,'text/html');if(_0x3010d5){const _0x55d0c6=Array['from'](_0x5f4bdb['body']['childNodes']);_0x55d0c6['reverse']();for(const _0x27daa7 of _0x55d0c6){if(_0x27daa7['nodeType']==Node['ELEMENT_NODE'])break;_0x27daa7['remove']();}}const _0x384f96=this['editor']['data']['processor']['toView'](this['_xmlSerializer']['serializeToString'](_0x5f4bdb['body']));this['_isH1TagSupportEnabled']()||this['_normalizeResponseHeadings'](_0x384f96);const _0x4e2595=this['editor']['config']['get']('ai.assistant.preserveComments'),_0x1f929e=this['editor']['data']['toModel'](_0x384f96);return _0x4e2595||_0x1f929e['markers']['clear'](),this['editor']['data']['stringify'](_0x1f929e);}['_normalizeResponseHeadings'](_0x449471){const _0x109a85=new _0x10bc29(this['editor']['editing']['view']['document']),_0x2303a0=new _0x1deb35({'name':/^h[1-5]$/}),_0x591df7=[];let _0xc61a04=!0x1;for(const _0x9ec2d5 of _0x449471)_0x9ec2d5['is']('element')&&_0x2303a0['match'](_0x9ec2d5)&&(_0x591df7['push'](_0x9ec2d5),'h1'==_0x9ec2d5['name']&&(_0xc61a04=!0x0));if(_0xc61a04){for(const _0x590824 of _0x591df7)_0x109a85['rename']('h'+(parseInt(_0x590824['name'][0x1])+0x1),_0x590824);}}_isH1TagSupportEnabled(){const {data:_0x1de5cf,editing:_0xd87017}=this['editor'],_0x475697=_0x1de5cf['htmlProcessor']['toView']('<h1></h1>'),_0x48a796=_0x1de5cf['toView'](_0x1de5cf['toModel'](_0x475697));return!!_0xd87017['view']['domConverter']['viewToDom'](_0x48a796)['querySelector']('h1');}_sanitizeHTML(_0x552711){return this['editor']['editing']['view']['domConverter']['setContentOf'](this['_sanitizationContainer'],_0x552711),this['_sanitizationContainer']['innerHTML'];}_stripMarkdownSyntax(_0x105187){const _0x1e1659=_0x105187['trim']();return _0x1e1659['startsWith']('```html')?_0x1e1659['endsWith']('```')?_0x1e1659['substring'](0x7,_0x1e1659['length']-0x3):_0x1e1659['substring'](0x7):_0x105187;}};const Gi={'REPLACE':'replace','INSERT':'insert'};var Fi=class extends _0x24660c{constructor(_0x55266e){super(_0x55266e),this['set']('isVisible',!0x1),this['set']('mainAction',Gi['REPLACE']),this['replaceButton']=this['_createButton']('','ck-button-action'),this['replaceButton']['bind']('label')['to'](this,'mainAction',_0x276057=>Di(_0x55266e,'AI_'+_0x276057['toUpperCase']()+'_CONTENT')),this['insertButton']=this['_createButton'](Di(_0x55266e,'Insert\x20below')),this['tryAgainButton']=this['_createButton'](Di(_0x55266e,'Try\x20again')),this['stopButton']=this['_createButton'](Di(_0x55266e,'Stop'));const _0x3e709c=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-form__toolbar',_0x3e709c['if']('isVisible','ck-hidden',_0x97d592=>!_0x97d592)]}}),this['items']['addMany']([this['replaceButton'],this['insertButton'],this['tryAgainButton'],this['stopButton']]);}_createButton(_0x568593,_0x35eec5){const _0xbb1f88=new Mt(this['locale']);return _0xbb1f88['set']({'label':_0x568593,'class':_0x35eec5||'','isVisible':!0x0,'withText':!0x0}),_0xbb1f88;}},Ki=class extends _0x4ff2da{contentFieldView;copyButtonView;constructor(_0xce1471,_0x5022b7=''){super(_0xce1471),this['set']({'value':null,'isVisible':!0x1,'isProcessing':!0x1});const _0x56bc44=this['bindTemplate'];this['contentFieldView']=new Wi(_0xce1471,_0x5022b7),this['copyButtonView']=this['_createCopyButton'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area-wrapper',_0x56bc44['if']('isVisible','ck-hidden',_0x15be2c=>!_0x15be2c)],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area',_0x56bc44['if']('isProcessing','ck-ai-form__content-area--processing')]},'children':[this['contentFieldView'],{'tag':'div','attributes':{'class':['ck','ck-ai-form__copy-button-wrapper']},'children':[this['copyButtonView']]}]}]});}['render'](){super['render'](),this['value']&&this['contentFieldView']['setContent'](this['value']);let _0x556cb7=!0x1;this['on']('change:value',(_0x58b2de,_0x3e46c1,_0x4f951b)=>{const _0x4c0381=!this['contentFieldView']['element']['querySelector']('.ck-ai-form__loader');this['contentFieldView']['setContent'](_0x4f951b),this['isProcessing']&&_0x4c0381&&!_0x556cb7&&this['element']['scrollTo']({'top':this['element']['scrollHeight'],'behavior':'smooth'});}),this['on']('change:isProcessing',(_0x43171a,_0x25a113,_0x169451)=>{_0x556cb7=!0x1,_0x169451?(this['value']=null,this['contentFieldView']['appendLoader']()):this['value']||this['contentFieldView']['setContent']('');}),this['listenTo'](this['element'],'wheel',()=>{_0x556cb7=!0x0;}),this['listenTo'](this['element'],'mousedown',()=>{_0x556cb7=!0x0;});}['focus'](){this['element']['focus']();}_createCopyButton(){const _0x2a8795=this['locale'],_0x4cef5b=new Mt(this['locale']),_0x5d1edb='ck-ai-form__copy-button';return _0x4cef5b['set']({'label':Di(_0x2a8795,'Copy'),'icon':_0x208a90,'class':_0x5d1edb,'tooltip':!0x0}),_0x4cef5b['bind']('isVisible')['to'](this,'value',_0x14b113=>!!_0x14b113),_0x4cef5b['bind']('isEnabled')['to'](this,'isProcessing',_0x1457eb=>!_0x1457eb),_0x4cef5b['on']('execute',()=>{this['_copyHTMLToClipboard'](this['contentFieldView']['element']),_0x4cef5b['icon']=_0x5517bf,_0x4cef5b['class']=_0x5d1edb+'\x20ck-ai-form__copy-button--copied',this['focus'](),setTimeout(()=>{_0x4cef5b['icon']=_0x208a90,_0x4cef5b['class']=_0x5d1edb;},0x3e8);}),_0x4cef5b;}['_copyHTMLToClipboard'](_0x2746f4){const {window:_0x121056,document:_0x2e8b8b}=wt;if(_0x121056['ClipboardItem']){const {Blob:_0x5cd857,ClipboardItem:_0x105e9e}=_0x121056,_0x5971d7=[new _0x105e9e({'text/html':new _0x5cd857([_0x2746f4['innerHTML']],{'type':'text/html'}),'text/plain':new _0x5cd857([_0x2746f4['textContent']||''],{'type':'text/plain'})})];navigator['clipboard']['write'](_0x5971d7);}else{const _0x6b9616=_0x2e8b8b['createElement']('div');_0x6b9616['style']['position']='absolute',_0x6b9616['style']['left']='-9999px',_0x6b9616['innerHTML']='<span>[</span>'+_0x2746f4['innerHTML']+'<span>]</span>',_0x2e8b8b['body']['appendChild'](_0x6b9616);const _0x20da04=_0x2e8b8b['createRange']();_0x20da04['setStartAfter'](_0x6b9616['firstElementChild']),_0x20da04['setEndBefore'](_0x6b9616['lastElementChild']);const _0x2f254a=_0x121056['getSelection']();_0x2f254a['removeAllRanges'](),_0x2f254a['addRange'](_0x20da04),_0x2e8b8b['execCommand']('copy'),_0x6b9616['remove']();}}},Wi=class extends _0x4ff2da{constructor(_0x20b8df,_0x551ba0=''){super(_0x20b8df),this['loaderView']=this['_createLoader'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content',_0x551ba0,'ck-reset_all-excluded','ck-ai-form__content-field']}});}setContent(_0xf8cc5){this['element']['innerHTML']=_0xf8cc5;}['appendLoader'](){this['element']['appendChild'](this['loaderView']['element']);}_createLoader(){const _0x9d72e2=new _0x4ff2da(),_0x31c1eb=this['locale'],_0x11898e=new _0x5a896c();return _0x11898e['isVisible']=!0x0,_0x9d72e2['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__loader']},'children':[_0x11898e,{'text':Di(_0x31c1eb,'AI\x20is\x20writing...')}]}),_0x9d72e2['render'](),_0x9d72e2;}},Yi=class extends _0x4ff2da{constructor(_0x20f120,_0x1bba04=''){super(_0x20f120);const _0x45392f=new $t(),_0xe5f016=this['bindTemplate'];this['set']('text',_0x1bba04),_0x45392f['content']=_0x4f387d,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__error']},'children':[_0x45392f,{'text':_0xe5f016['to']('text')}]});}},$i=class extends Nt{submitButtonView;showHistoryButtonView;constructor(_0x5aa36a,_0x5a1804){super(_0x5aa36a,_0x5a1804),this['queryView']['fieldView']['minRows']=0x1,this['queryView']['fieldView']['maxRows']=0x3,this['submitButtonView']=this['_createSubmitButton'](),this['showHistoryButtonView']=this['_createShowHistoryButton'](),this['focusableChildren']['add'](this['showHistoryButtonView'],0x1),this['focusableChildren']['add'](this['submitButtonView']);}['render'](){super['render'](),this['queryView']['fieldWrapperChildren']['add'](this['showHistoryButtonView']),this['children']['add'](this['submitButtonView']),this['keystrokes']['set']('enter',(_0x4eeecf,_0x161715)=>{_0x4eeecf['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x161715());});}_createSubmitButton(){const _0x37d040=new Mt(this['locale']),_0x12bf80=this['locale'];return _0x37d040['set']({'icon':nt,'label':Di(_0x12bf80,'Submit'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-form__submit'}),_0x37d040['on']('execute',()=>{this['submit']();}),_0x37d040['bind']('isEnabled')['to'](this['queryView']['fieldView'],'isEmpty',this,'isEnabled',(_0x5f4f46,_0x1a6610)=>!_0x5f4f46&&_0x1a6610),_0x37d040;}_createShowHistoryButton(){const _0x401741=new Mt(this['locale']),_0x48ad0b=this['resultsView'],_0x5b0d42=this['locale'];_0x401741['set']({'label':Di(_0x5b0d42,'History'),'withText':!0x1,'icon':_0x462166,'tooltip':!0x0,'tooltipPosition':'sw','class':'ck-ai-form__toggle-history'}),_0x401741['bind']('isOn')['to'](_0x48ad0b,'isVisible'),_0x401741['bind']('isEnabled')['to'](this,'isEnabled'),_0x401741['on']('execute',()=>{_0x48ad0b['isVisible']=!_0x48ad0b['isVisible'],_0x48ad0b['isVisible']?this['filteredView']['focus']():this['focus']();});const _0x1d1585=()=>{wt['window']['requestAnimationFrame'](()=>{if(ft(this['element'])){const _0xda5055=new It(this['queryView']['fieldView']['element']),_0x58862b=_0xda5055['width'],_0xc3ce7f='rtl'===_0x5b0d42['uiLanguageDirection']?'left':'right';_0xda5055['excludeScrollbarsAndBorders'](),_0x401741['element']['style'][_0xc3ce7f]=_0x58862b-_0xda5055['width']+0x1+'px';}});};return this['queryView']['fieldView']['on']('update',_0x1d1585),this['on']('render',_0x1d1585),_0x401741;}submit(){const _0x427a16=this['queryView']['fieldView']['element']['value'];this['fire']('submit',_0x427a16);}['focus'](_0x17f4fd){-0x1===_0x17f4fd?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}},qi=class extends Jt{historyGroupView;clearHistoryButton;constructor(_0x44d49d){super(_0x44d49d),this['clearHistoryButton']=this['_createClearHistoryButton'](),this['historyGroupView']=new zt(),this['historyGroupView']['children']['add'](this['clearHistoryButton'],0x1),this['historyGroupView']['label']=Di(_0x44d49d,'Prompt\x20history'),this['historyGroupView']['items']['delegate']('execute')['to'](this),this['items']['add'](this['historyGroupView']);}filter(){let _0x1cb7bf=0x0;for(const _0xd540bf of this['items'])_0x1cb7bf+=_0xd540bf['items']['length'];return{'resultsCount':_0x1cb7bf,'totalItemsCount':_0x1cb7bf};}_createClearHistoryButton(){const _0x174c39=this['locale'],_0x421920=new Mt(this['locale']);return _0x421920['set']({'label':'('+Di(_0x174c39,'Clear')+')','withText':!0x0}),_0x421920['on']('execute',()=>this['fire']('clearHistory')),_0x421920;}},Qi=class extends jt{constructor(_0x2a76b3){super();const _0x204991=new Dt(),_0x466036=new Mt(this['locale'],_0x204991);this['children']['add'](_0x466036),_0x466036['set']({'label':_0x2a76b3['prompt'],'withText':!0x0}),_0x466036['on']('execute',()=>{this['fire']('execute',{'value':_0x39f176(_0x2a76b3['prompt'])});});}};const Xi='CKEditor/AIFormView/PromptHistory';var zi=class extends lt{constructor(){super(),this['_loadFromSessionStorage'](),this['on']('add',(_0x5d5e1b,_0x5f18c0)=>{const _0x1c528a=ji(_0x5f18c0['prompt']);for(const _0x204962 of this)if(_0x204962!=_0x5f18c0&&ji(_0x204962['prompt'])===_0x1c528a){this['remove'](_0x204962);break;}this['length']>0x14&&this['remove'](this['last']),this['_saveToSessionStorage']();}),this['on']('remove',()=>{this['_saveToSessionStorage']();});}_loadFromSessionStorage(){const _0x134e06=sessionStorage['getItem'](Xi)||'[]';this['addMany'](JSON['parse'](_0x134e06));}_saveToSessionStorage(){sessionStorage['setItem'](Xi,JSON['stringify'](this['map'](_0x41c583=>_0x41c583)));}};function ji(_0x14d295){return _0x14d295['toLowerCase']()['trim']();}var Ji=class extends _0x4ff2da{['focusTracker'];keystrokes;contentArea;toolbar;promptView;['errorView'];['_focusables'];['focusCycler'];_promptHistory;constructor(_0x1be416,_0x5aca3c,_0x48b640=''){super(_0x1be416),this['set']('isEnabled',!0x0),this['set']('isProcessing',!0x1),this['set']('prompt',''),this['set']('value',''),this['set']('isError',!0x1),this['set']('mainAction',Gi['REPLACE']),this['_promptHistory']=new zi(),this['errorView']=new Yi(_0x1be416),this['contentArea']=new Ki(_0x1be416,_0x48b640),this['contentArea']['bind']('isProcessing')['to'](this),this['contentArea']['bind']('value')['to'](this),this['toolbar']=this['_createToolbar'](),this['toolbar']['bind']('mainAction')['to'](this),this['promptView']=this['_createPromptView'](),this['focusTracker']=new _t(),this['keystrokes']=new gt(),this['_focusables']=this['createCollection']([this['contentArea'],this['contentArea']['copyButtonView'],this['toolbar'],this['promptView']]),this['focusCycler']=new Ft({'focusables':this['_focusables'],'focusTracker':this['focusTracker'],'keystrokeHandler':this['keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}),this['focusCycler']['chain'](this['promptView']['focusCycler']),this['promptView']['queryView']['fieldView']['bind']('value')['to'](this,'prompt');const _0xcbde24=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form',_0x5aca3c],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form-content']},'children':[{'tag':'div','attributes':{'class':[_0xcbde24['if']('isError','ck-hidden',_0x2ccd56=>!_0x2ccd56)]},'children':[this['errorView']]},this['contentArea'],this['toolbar'],this['promptView']]}]});}['render'](){super['render'](),this['focusTracker']['add'](this['contentArea']['element']),this['focusTracker']['add'](this['contentArea']['copyButtonView']['element']),this['focusTracker']['add'](this['toolbar']['element']),this['focusTracker']['add'](this['promptView']['element']),this['keystrokes']['listenTo'](this['element']);}['focus'](_0x4ff7b1=0x1){-0x1===_0x4ff7b1?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}reset(){this['prompt']='',this['value']='',this['isError']=!0x1,this['promptView']['reset'](),this['contentArea']['isVisible']=!0x1,this['toolbar']['isVisible']=!0x1;}_createPromptView(){const _0x3f1dac=this['locale'],_0x1b48af=new $i(_0x3f1dac,{'queryView':{'label':Di(_0x3f1dac,'Ask\x20AI\x20to\x20edit\x20or\x20generate'),'creator':_0x293ea1,'showIcon':!0x1,'showResetButton':!0x1},'infoView':{'text':{'noSearchableItems':{'primary':Di(_0x3f1dac,'Empty\x20history'),'secondary':Di(_0x3f1dac,'Ask\x20AI\x20and\x20your\x20prompts\x20will\x20be\x20listed\x20here\x20for\x20you\x20to\x20use\x20later.')}}},'filteredView':this['_createHistoryView'](),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1});return _0x1b48af['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x57afee,_0x21dd7e)=>_0x57afee&&!_0x21dd7e),this['listenTo'](_0x1b48af,'submit',(_0x35732b,_0x463ea2)=>{this['prompt']=_0x463ea2;const _0x137c80=_0x34830a(_0x463ea2);this['fire']('submitPrompt',_0x137c80),_0x463ea2['trim']()&&this['_promptHistory']['add']({'prompt':_0x137c80},0x0);},{'priority':'high'}),_0x1b48af;}_createHistoryView(){const _0x4ca751=new qi(this['locale']);return _0x4ca751['historyGroupView']['items']['bindTo'](this['_promptHistory'])['as'](Qi),_0x4ca751['on']('clearHistory',()=>{this['_promptHistory']['clear'](),this['promptView']['search'](''),this['promptView']['focus']();}),_0x4ca751;}_createToolbar(){const _0x20ba05=new Fi(this['locale']);return _0x20ba05['replaceButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0xc70851,_0x136c2d,_0x47b31e)=>_0xc70851&&!_0x136c2d&&!!_0x47b31e),_0x20ba05['replaceButton']['delegate']('execute')['to'](this,'replaceContent'),_0x20ba05['insertButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0x2ab3b6,_0x544de1,_0x209522)=>_0x2ab3b6&&!_0x544de1&&!!_0x209522),_0x20ba05['insertButton']['delegate']('execute')['to'](this,'insertContentBelow'),_0x20ba05['tryAgainButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x308be3,_0x1b2bfd)=>_0x308be3&&!_0x1b2bfd),_0x20ba05['tryAgainButton']['delegate']('execute')['to'](this,'tryAgainEvent'),_0x20ba05['stopButton']['bind']('isEnabled')['to'](this,'isProcessing'),_0x20ba05['stopButton']['delegate']('execute')['to'](this,'stopProcessing'),_0x20ba05;}startProcessing(){this['value']='',this['isError']=!0x1,this['isProcessing']=!0x0,this['contentArea']['isVisible']=!0x0,this['toolbar']['isVisible']=!0x0,this['contentArea']['focus']();}['finishProcessing'](){const _0x38a364=this['locale'];this['isProcessing']=!0x1,this['prompt']='',this['promptView']['reset'](),this['value']&&(this['promptView']['queryView']['label']=Di(_0x38a364,'Ask\x20AI\x20to\x20improve\x20generated\x20text'));}['handleError'](_0x214736){const _0x38bc65=this['locale'];this['finishProcessing'](),this['isError']=!0x0,this['errorView']['text']=_0x214736||Di(_0x38bc65,'AI_ERROR_FAILED'),this['value']||(this['contentArea']['isVisible']=!0x1);}};const Zi=globalThis['DataTransfer'];var ts=class extends _0x19488e{['licenseKey'];_licenseKeyCheckInterval;['_dialog'];['_formView'];_aiAdapter;_aiAssistantController;['_uiCssClasses']='';static get['pluginName'](){return'AIAssistantUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}static get requires(){return[_0x592e3f,xi,Li,Ut];}constructor(_0x8a7496){super(_0x8a7496),_0x8a7496['config']['define']('ai.assistant.disabledElements',['media','rawHtml','tableOfContents']),_0x8a7496['config']['define']('ai.assistant.contentAreaCssClass',''),_0x8a7496['config']['define']('ai.assistant.useTheme',!0x0),this['_uiCssClasses']='ck-ai-assistant-ui'+(_0x8a7496['config']['get']('ai.assistant.useTheme')?'\x20ck-ai-assistant-ui_theme':'');}init(){const {editor:_0x318123}=this;this['_aiAdapter']=_0x318123['plugins']['get'](Li),this['_dialog']=_0x318123['plugins']['get'](Ut),this['_formView']=null,this['_commandDefinitions']=this['_getResolvedCommandsDefinitions']();const _0x361d3d=new Hi(_0x318123,Array['from'](this['_commandDefinitions']['values']()));_0x318123['commands']['add']('showAIAssistant',_0x361d3d),_0x318123['ui']['componentFactory']['add']('aiCommands',_0x292d4c=>{const _0x28faaa=_0x5a954d(_0x292d4c);return _0x28faaa['set']({'class':'ck-ai-commands-dropdown\x20'+this['_uiCssClasses']}),_0x28faaa['buttonView']['set']({'label':Di(_0x292d4c,'AI\x20Commands'),'icon':_0x49d247,'tooltip':!0x0}),_0x28faaa['on']('execute',_0x2cf875=>this['_onExecute'](_0x2cf875['source']['id'])),_0xf691cd(_0x28faaa,_0x318123['ui']['view']['body'],function(_0x2b2523){const _0xe1bbee=is(_0x2b2523,ki(_0x2b2523['config']['get']('ai.assistant.commands'),_0x2b2523['locale']))['filter'](_0x59d5fb=>_0x59d5fb['commands']['length']);return 0x1===_0xe1bbee['length']?is(_0x2b2523,_0xe1bbee[0x0]['commands'])['map'](_0x25d25d=>({'id':_0x25d25d['id'],'label':_0x25d25d['label']})):_0xe1bbee['map'](_0x5838f2=>{const {groupId:_0xa05216,groupLabel:_0x556423,commands:_0x54c228}=_0x5838f2,_0xea9b5=is(_0x2b2523,_0x54c228)['map'](_0x2c7b3d=>({'id':_0x2c7b3d['id'],'label':_0x2c7b3d['label']}));return{'id':_0xa05216,'menu':_0x556423||_0xa05216,'children':_0xea9b5};});}(_0x318123),{'ariaLabel':Di(_0x292d4c,'AI\x20Commands')}),_0x28faaa['menuView']['menuPanelClass']='ck-ai-commands-dropdown\x20'+this['_uiCssClasses'],_0x361d3d['on']('change:enabledCommandsIds',_0x5d12fa),_0x28faaa['menuView']['once']('render',_0x5d12fa),_0x28faaa;function _0x5d12fa(){_0x28faaa['isEnabled']=_0x361d3d['enabledCommandsIds']['length']>0x0;for(const _0x42573a of _0x28faaa['menuView']['buttons'])_0x42573a['isEnabled']=_0x361d3d['enabledCommandsIds']['includes'](_0x42573a['id']);}}),_0x318123['ui']['componentFactory']['add']('menuBar:aiCommands',_0x514a9b=>{const _0x1aabad=new _0x4888f9(_0x514a9b);_0x1aabad['buttonView']['set']({'label':Di(_0x514a9b,'AI\x20Commands'),'icon':_0x49d247}),_0x1aabad['bind']('isEnabled')['to'](_0x361d3d,'enabledCommandsIds',_0x464fd8=>_0x464fd8['length']>0x0);const _0x58d61c=ki(_0x318123['config']['get']('ai.assistant.commands'),_0x514a9b);return this['_populateMenuBarMenu'](_0x361d3d,_0x1aabad,_0x58d61c,_0x56fb1b=>this['_onExecute'](_0x56fb1b)),_0x1aabad;}),_0x318123['ui']['componentFactory']['add']('aiAssistant',()=>{const _0x468ab3=this['_createAIAssistantUIButton'](Mt);return _0x468ab3['set']({'tooltip':!0x0,'class':'ck-ai-assistant-button\x20'+this['_uiCssClasses']}),_0x468ab3;}),_0x318123['ui']['componentFactory']['add']('menuBar:aiAssistant',()=>{const _0x1263c9=this['_createAIAssistantUIButton'](Zt);return _0x1263c9['set']({'role':'menuitemcheckbox'}),_0x1263c9;}),this['licenseKey']=this['editor']['config']['get']('licenseKey');const _0x29c14d=this['editor'];this['_licenseKeyCheckInterval']=setInterval(()=>{let _0x28a8d4;for(const _0x1f9af1 in _0x29c14d){const _0x5e7614=_0x1f9af1,_0x4a4a0f=_0x29c14d[_0x5e7614];if('aiLicenseKeyValid'==_0x4a4a0f||'aiLicenseKeyInvalid'==_0x4a4a0f||'aiLicenseKeyExpired'==_0x4a4a0f||'aiLicenseKeyDomainLimit'==_0x4a4a0f||'aiLicenseKeyNotAllowed'==_0x4a4a0f||'aiLicenseKeyEvaluationLimit'==_0x4a4a0f||'aiLicenseKeyUsageLimit'==_0x4a4a0f){delete _0x29c14d[_0x5e7614],_0x28a8d4=_0x4a4a0f,clearInterval(this['_licenseKeyCheckInterval']),this['_licenseKeyCheckInterval']=void 0x0;break;}}'aiLicenseKeyInvalid'==_0x28a8d4&&_0x29c14d['_showLicenseError']('invalid'),'aiLicenseKeyExpired'==_0x28a8d4&&_0x29c14d['_showLicenseError']('expired'),'aiLicenseKeyDomainLimit'==_0x28a8d4&&_0x29c14d['_showLicenseError']('domainLimit'),'aiLicenseKeyNotAllowed'==_0x28a8d4&&_0x29c14d['_showLicenseError']('featureNotAllowed','AIAssistant'),'aiLicenseKeyEvaluationLimit'==_0x28a8d4&&_0x29c14d['_showLicenseError']('evaluationLimit'),'aiLicenseKeyUsageLimit'==_0x28a8d4&&_0x29c14d['_showLicenseError']('usageLimit');},0x3e8);}destroy(){super['destroy'](),this['_licenseKeyCheckInterval']&&clearInterval(this['_licenseKeyCheckInterval']);}['showUI'](_0x576066='',_0x9715d9='',_0x346155='custom'){const _0x5ef78e=this['editor'],_0x5cd5d8=_0x5ef78e['editing']['view'],_0x4e6c74=_0x5ef78e['plugins']['get'](xi),_0x19658c=_0x5ef78e['plugins']['get'](_0x592e3f);_0x4e6c74['showFakeVisualSelection']();const _0x428697=new Zi(),_0x2f785f=new ClipboardEvent('copy',{'clipboardData':_0x428697}),_0x5c9cfb=new _0x381edb(_0x428697),_0x32e5e3=new _0x2b7cc4(_0x5cd5d8,_0x2f785f,{'dataTransfer':_0x5c9cfb});_0x19658c['_forceMarkersCopy']('comment',()=>{_0x5cd5d8['document']['fire']('copy',_0x32e5e3);}),this['_formView']||(this['_initView'](),this['_aiAssistantController']=new Bi(_0x5ef78e,this['_aiAdapter']['textAdapter'],this['_formView']));let _0x130846=_0x5c9cfb['getData']('text/html');const _0x43589d=_0x5ef78e['model']['document']['selection'],_0x28e3de=Array['from'](_0x43589d['getRanges']());0x1===_0x28e3de['length']&&_0x28e3de[0x0]['isFlat']&&!_0x43589d['getSelectedElement']()&&''!==_0x130846['replace'](/&nbsp;/g,'')['trim']()&&(_0x130846='<p>'+_0x130846+'</p>'),this['_aiAssistantController']['updateView']({'actionId':_0x346155,'query':_0x576066,'htmlContent':_0x130846,'label':_0x9715d9,'mainActionLabel':Gi[_0x5ef78e['model']['document']['selection']['isCollapsed']?'INSERT':'REPLACE']}),'aiAssistant'!==this['_dialog']['id']?this['_dialog']['show']({'id':'aiAssistant','icon':_0x2f6a93,'title':Di(this['editor']['locale'],'AI\x20Assistant'),'content':this['_formView'],'position':Vt['EDITOR_TOP_SIDE'],'onShow':()=>{this['_formView']['focus']();},'onHide':()=>{this['_aiAssistantController']['reset'](),_0x4e6c74['hideFakeVisualSelection']();}}):this['_dialog']['view']['wasMoved']||this['_dialog']['view']['updatePosition']();}['hideUI'](){this['_dialog']['hide']();}_getResolvedCommandsDefinitions(){const _0x45727d=new Map(),_0x3b6a50=ki(this['editor']['config']['get']('ai.assistant.commands'),this['editor']['locale']);for(const _0x5ba1ac of _0x3b6a50)for(const _0x2d1135 of _0x5ba1ac['commands'])_0x45727d['set'](_0x2d1135['id'],{..._0x2d1135,'groupId':_0x5ba1ac['groupId'],'groupLabel':_0x5ba1ac['groupLabel']||_0x5ba1ac['groupId']});return _0x45727d;}_createAIAssistantUIButton(_0x3eb9d2){const _0x52e106=this['editor'],_0x284088=_0x52e106['commands']['get']('showAIAssistant'),_0x1317e8=new _0x3eb9d2(_0x52e106['locale']);return _0x1317e8['set']({'label':Di(_0x52e106['locale'],'AI\x20Assistant'),'icon':_0x2f6a93,'isToggleable':!0x0}),_0x1317e8['bind']('isEnabled')['to'](_0x284088),_0x1317e8['bind']('isOn')['to'](this['_dialog'],'id',_0x5ca8ff=>'aiAssistant'===_0x5ca8ff),this['listenTo'](_0x1317e8,'execute',()=>{_0x1317e8['isOn']?this['hideUI']():_0x284088['execute']();}),_0x1317e8;}_initView(){const _0x526c6c=this['editor']['plugins']['get'](xi);this['_formView']=new Ji(this['editor']['locale'],this['_uiCssClasses'],this['editor']['config']['get']('ai.assistant.contentAreaCssClass')),this['_formView']['on']('change:value',()=>{this['_dialog']['view']['wasMoved']||this['_dialog']['view']['updatePosition']();}),this['_formView']['promptView']['queryView']['fieldView']['on']('update',()=>{this['_dialog']['view']['wasMoved']||this['_dialog']['view']['updatePosition']();}),this['listenTo'](this['_formView'],'replaceContent',()=>{_0x526c6c['insertContent'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['listenTo'](this['_formView'],'insertContentBelow',()=>{_0x526c6c['insertContentBelow'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['_initAriaAiStatusChangeAnnouncements']();}_initAriaAiStatusChangeAnnouncements(){const {locale:_0x511509,ui:{ariaLiveAnnouncer:_0x1ddd39}}=this['editor'];this['_formView']['contentArea']['on']('change:isProcessing',(_0x46784d,_0x4b251f,_0x4d6114)=>{const _0x4c5862=this['_aiAssistantController']['currentContext'];_0x4d6114?_0x1ddd39['announce'](Di(_0x511509,'AI\x20is\x20writing')):_0x4c5862&&_0x1ddd39['announce'](Di(_0x511509,'Generated\x20content:\x20%0',_0x4c5862),{'politeness':'polite','isUnsafeHTML':!0x0});}),this['_formView']['on']('change:isError',(_0x1e8224,_0x257c0c,_0x113036)=>{if(_0x113036){const _0x37f647=this['_formView']['errorView']['text'];_0x1ddd39['announce'](Di(_0x511509,'Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x37f647));}});}_onExecute(_0x53f71b){const _0x243923=this['_commandDefinitions']['get'](_0x53f71b),_0x4acf97=this['editor'],_0x50e6c6=_0x4acf97['model']['document']['selection'],_0x20ca81=_0x4acf97['commands']['get']('showAIAssistant'),_0x1bfe56=_0x4acf97['plugins']['get'](xi),_0x3127d5=''+('_ungrouppedCommands'!==_0x243923['groupId']?_0x243923['groupLabel']+':\x20':'')+_0x243923['label'];if(!0x1!==_0x243923['requiresContent']&&_0x50e6c6['isCollapsed']){const _0x4f9310=mt(_0x50e6c6['getSelectedBlocks']())||_0x4acf97['model']['schema']['getLimitElement'](_0x50e6c6);_0x4acf97['model']['change'](_0x5b01a8=>{_0x5b01a8['setSelection'](_0x4f9310,'in');});}_0x1bfe56['showFakeVisualSelection'](),_0x20ca81['execute'](_0x243923['prompt'],_0x3127d5,'command:'+_0x53f71b);}_populateMenuBarMenu(_0x4df5d8,_0x2038a1,_0x12e70d,_0x476489){const _0x88f432=this['editor'],_0x24afee=_0x88f432['locale'],_0x264aef=new _0x164ccd(_0x24afee),_0x2a7b23=is(_0x88f432,_0x12e70d)['filter'](_0x2529bd=>_0x2529bd['commands']['length']);0x1===_0x2a7b23['length']?this['_getMenuBarGroupButtons']({'command':_0x4df5d8,'commands':_0x2a7b23[0x0]['commands'],'parentMenuView':_0x2038a1,'onExecute':_0x476489})['forEach'](_0x5c580c=>_0x264aef['items']['add'](_0x5c580c)):_0x2a7b23['forEach'](({groupId:_0x8dceee,groupLabel:_0x68fc5,commands:_0x2a8788})=>{const _0x5256f3=new te(_0x24afee,_0x2038a1),_0x306696=new _0x4888f9(_0x24afee),_0x11d907=new _0x164ccd(_0x24afee),_0x5a2812=this['_getMenuBarGroupButtons']({'command':_0x4df5d8,'commands':_0x2a8788,'parentMenuView':_0x306696,'onExecute':_0x476489});_0x306696['buttonView']['set']({'label':_0x68fc5||_0x8dceee}),_0x306696['delegate']('execute')['to'](_0x2038a1),_0x11d907['items']['addMany'](_0x5a2812),_0x306696['panelView']['children']['add'](_0x11d907),_0x5256f3['children']['add'](_0x306696),_0x264aef['items']['add'](_0x5256f3);}),_0x2038a1['panelView']['children']['add'](_0x264aef);}_getMenuBarGroupButtons({command:_0xe3f68a,commands:_0x2d4cbc,parentMenuView:_0xa4bb83,onExecute:_0x46333b}){const _0x188e86=this['editor'],_0x5b9469=_0x188e86['locale'];return is(_0x188e86,_0x2d4cbc)['map'](_0x1c2ff4=>{const _0x19088e=new te(_0x5b9469,_0xa4bb83),_0x3378ee=new Zt(_0x5b9469);return _0x3378ee['set']({'label':_0x1c2ff4['label']}),_0x3378ee['delegate']('execute')['to'](_0xa4bb83),_0x3378ee['on']('execute',()=>_0x46333b(_0x1c2ff4['id'])),_0x3378ee['bind']('isEnabled')['to'](_0xe3f68a,'enabledCommandsIds',_0x3c9974=>_0x3c9974['includes'](_0x1c2ff4['id'])),_0x19088e['children']['add'](_0x3378ee),_0x19088e;});}};function es(_0x3c1923,_0x58064a){return void 0x0!==_0x3c1923['order']&&void 0x0===_0x58064a['order']?0x1:void 0x0===_0x3c1923['order']&&void 0x0!==_0x58064a['order']?-0x1:void 0x0!==_0x3c1923['order']&&void 0x0!==_0x58064a['order']?_0x3c1923['order']-_0x58064a['order']:0x0;}function is(_0x14998d,_0x58c2df){_0x58c2df['sort'](es);const _0x238e04={},_0x3f1937=[];for(const _0x5bc517 of _0x58c2df)if(void 0x0!==_0x5bc517['order']){if(_0x5bc517['order']in _0x238e04)throw new ct('ai-commands-config-order-collision',_0x14998d,{'conflictingDefinitions':[_0x5bc517,_0x238e04[_0x5bc517['order']]]});_0x238e04[_0x5bc517['order']]=_0x5bc517,_0x3f1937['splice'](_0x5bc517['order'],0x0,_0x5bc517);}else _0x3f1937['push'](_0x5bc517);return _0x3f1937;}var ss=class extends _0x19488e{static get requires(){return[ts,xi];}static get['pluginName'](){return'AIAssistant';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x165048){super(_0x165048);const _0x23c458=_0x165048['config'],_0x52b7aa=_0x165048['locale'];_0x23c458['define']('ai.assistant.preserveComments',!0x0),_0x23c458['define']('ai.assistant.commands',ns(_0x52b7aa)),_0x23c458['define']('ai.assistant.extraCommandGroups',[]),_0x23c458['define']('ai.assistant.removeCommands',[]);let _0x1c65b7=ki(_0x23c458['get']('ai.assistant.commands'),_0x52b7aa);const _0x3892bb=_0x23c458['get']('ai.assistant.extraCommandGroups'),_0x365ea1=_0x23c458['get']('ai.assistant.removeCommands');_0x3892bb['forEach'](_0x406686=>{const _0x1188fc=_0x1c65b7['find'](_0x2700aa=>_0x2700aa['groupId']===_0x406686['groupId']);_0x1188fc?_0x1188fc['commands']=_0x1188fc['commands']['concat'](_0x406686['commands']):_0x1c65b7['push'](_0x406686);}),_0x1c65b7=_0x1c65b7['filter'](_0x599b2a=>!_0x365ea1['includes'](_0x599b2a['groupId'])),_0x1c65b7['forEach'](_0x4f1c10=>{_0x4f1c10['commands']=_0x4f1c10['commands']['filter'](_0x279d82=>!_0x365ea1['includes'](_0x279d82['id']));}),_0x23c458['set']('ai.assistant.commands',_0x1c65b7);}};function ns(_0xc324f0){return[{'groupId':'editOrReview','groupLabel':Di(_0xc324f0,'Edit\x20or\x20review'),'commands':[{'id':'improveWriting','label':Di(_0xc324f0,'Improve\x20writing'),'prompt':'Fix\x20spelling\x20mistakes,\x20use\x20proper\x20grammar\x20and\x20apply\x20good\x20writing\x20practices.\x20Do\x20not\x20lose\x20the\x20original\x20meaning.'},{'id':'makeShorter','label':Di(_0xc324f0,'Make\x20shorter'),'prompt':'Remove\x20any\x20repetitive,\x20redundant,\x20or\x20non-essential\x20writing\x20in\x20this\x20content\x20without\x20changing\x20the\x20meaning\x20or\x20losing\x20any\x20key\x20information.'},{'id':'makeLonger','label':Di(_0xc324f0,'Make\x20longer'),'prompt':'Improve\x20this\x20content\x20by\x20using\x20descriptive\x20language\x20and\x20inserting\x20more\x20information\x20and\x20more\x20detailed\x20explanations.'},{'id':'simplifyLanguage','label':Di(_0xc324f0,'Simplify\x20language'),'prompt':'Simplify\x20the\x20writing\x20style\x20of\x20this\x20content\x20and\x20reduce\x20the\x20complexity,\x20so\x20that\x20the\x20content\x20is\x20easy\x20to\x20understand.'}]},{'groupId':'generate','groupLabel':Di(_0xc324f0,'Generate\x20from\x20selection'),'commands':[{'id':'summarize','label':Di(_0xc324f0,'Summarize'),'prompt':'Summarize\x20this\x20content\x20into\x20one\x20paragraph\x20of\x20text.\x20Include\x20only\x20the\x20key\x20ideas\x20and\x20conclusions.\x20Keep\x20it\x20short.\x20Do\x20not\x20keep\x20original\x20text\x20formatting.'},{'id':'continue','label':Di(_0xc324f0,'Continue'),'prompt':'Start\x20with\x20the\x20provided\x20content\x20and\x20write\x20at\x20the\x20end\x20of\x20it\x20continuing\x20this\x20topic.\x20Keep\x20the\x20added\x20part\x20short.'}]},{'groupId':'changeTone','groupLabel':Di(_0xc324f0,'Change\x20tone'),'commands':[{'id':'professional','label':Di(_0xc324f0,'Professional'),'prompt':'Improve\x20using\x20polished,\x20formal,\x20and\x20respectful\x20language\x20to\x20convey\x20professional\x20expertise\x20and\x20competence.'},{'id':'casual','label':Di(_0xc324f0,'Casual'),'prompt':'Improve\x20using\x20casual,\x20informal\x20language\x20to\x20convey\x20a\x20casual\x20conversation\x20with\x20a\x20real\x20person.'},{'id':'direct','label':Di(_0xc324f0,'Direct'),'prompt':'Improve\x20using\x20direct\x20language,\x20using\x20only\x20the\x20essential\x20information.'},{'id':'confident','label':Di(_0xc324f0,'Confident'),'prompt':'Improve\x20using\x20compelling,\x20optimistic\x20language\x20to\x20convey\x20confidence\x20in\x20the\x20writing.'},{'id':'friendly','label':Di(_0xc324f0,'Friendly'),'prompt':'Improve\x20using\x20friendly,\x20comforting\x20language,\x20to\x20convey\x20understanding\x20and\x20empathy.'}]},{'groupId':'changeStyle','groupLabel':Di(_0xc324f0,'Change\x20style'),'commands':[{'id':'business','label':Di(_0xc324f0,'Business'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20business\x20professional\x20with\x20formal\x20language.'},{'id':'legal','label':Di(_0xc324f0,'Legal'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20legal\x20professional\x20using\x20valid\x20legal\x20terminology.'},{'id':'journalism','label':Di(_0xc324f0,'Journalism'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20journalist\x20using\x20engaging\x20language\x20to\x20convey\x20the\x20importance\x20of\x20the\x20information.'},{'id':'poetic','label':Di(_0xc324f0,'Poetic'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20poem\x20using\x20poetic\x20techniques\x20without\x20losing\x20the\x20original\x20meaning.'}]},{'groupId':'translate','groupLabel':Di(_0xc324f0,'Translate'),'commands':[{'id':'translateEnglish','label':Di(_0xc324f0,'English'),'prompt':'Translate\x20the\x20content\x20to\x20English\x20language.'},{'id':'translateSpanish','label':Di(_0xc324f0,'Spanish'),'prompt':'Translate\x20the\x20content\x20to\x20Spanish\x20language.'},{'id':'translatePortuguese','label':Di(_0xc324f0,'Portuguese'),'prompt':'Translate\x20the\x20content\x20to\x20Portuguese\x20language.'},{'id':'translateGerman','label':Di(_0xc324f0,'German'),'prompt':'Translate\x20the\x20content\x20to\x20German\x20language.'},{'id':'translateFrench','label':Di(_0xc324f0,'French'),'prompt':'Translate\x20the\x20content\x20to\x20French\x20language.'},{'id':'translateChinese','label':Di(_0xc324f0,'Simplified\x20Chinese'),'prompt':'Translate\x20the\x20content\x20to\x20Simplified\x20Chinese\x20language.'},{'id':'translateHindi','label':Di(_0xc324f0,'Hindi'),'prompt':'Translate\x20the\x20content\x20to\x20Hindi\x20language.'},{'id':'translateArabic','label':Di(_0xc324f0,'Arabic'),'prompt':'Translate\x20the\x20content\x20to\x20Arabic\x20language.'}]}];}var rs=class extends _0x19488e{abortController;static get requires(){return[Li];}constructor(_0x573475){super(_0x573475),this['abortController']=new AbortController();}init(){this['editor']['plugins']['get'](Li)['textAdapter']=this;}abort(){this['abortController']['signal']['aborted']||(this['abortController']['abort'](),this['abortController']=new AbortController());}async makeRequest(_0x37fb49){return this['sendRequest'](_0x37fb49)['catch'](_0x4e6500=>{if(_0x4e6500 instanceof Pi)return Promise['reject'](_0x4e6500);if('AbortError'==_0x4e6500['name'])return Promise['resolve']();throw console['error'](_0x4e6500),new ct('aitextadapter-send-request-failed',null);});}async _prepareRequestHeaders(_0x39af82,_0x95d098){const _0xd11a3f=this['editor']['locale'],_0x52b670={'Content-Type':'application/json'};if('object'==typeof _0x39af82)Object['assign'](_0x52b670,_0x39af82);else{if(_0x39af82)try{const _0x194846=await _0x39af82(_0x95d098);Object['assign'](_0x52b670,_0x194846);}catch{return Promise['reject'](new Pi(Di(_0xd11a3f,'AI_ERROR_GET_HEADERS')));}}return _0x52b670;}async _prepareRequestParameters(_0x49eac2,_0x8d2cdf){const _0x290983=this['editor']['locale'];if('object'==typeof _0x49eac2)return _0x49eac2;try{return await _0x49eac2(_0x8d2cdf);}catch{return Promise['reject'](new Pi(Di(_0x290983,'AI_ERROR_GET_PARAMETERS')));}}},os=class extends rs{['_apiUrl'];_requestHeaders;_requestParameters;static get['pluginName'](){return'OpenAITextAdapter';}constructor(_0x148a65){super(_0x148a65),_0x148a65['config']['define']('ai.assistant.adapter.openAI.apiUrl','https://api.openai.com/v1/chat/completions'),_0x148a65['config']['get']('ai.assistant.adapter.openAI.requestParameters')||_0x148a65['config']['define']('ai.assistant.adapter.openAI.requestParameters',{'model':'gpt-4o','temperature':0x1,'top_p':0x1,'stream':!0x0}),this['_apiUrl']=_0x148a65['config']['get']('ai.assistant.adapter.openAI.apiUrl'),this['_requestHeaders']=_0x148a65['config']['get']('ai.assistant.adapter.openAI.requestHeaders')||{},this['_requestParameters']=_0x148a65['config']['get']('ai.assistant.adapter.openAI.requestParameters');}async sendRequest({query:_0x338a83,context:_0x52dc74,onData:_0x5e882a,actionId:_0x2c9a5d}){const _0x2e057b=this['editor']['locale'],_0xecca14=await this['prepareMessages'](_0x338a83,_0x52dc74,_0x2c9a5d),_0x64f751=await this['_prepareRequestHeaders'](this['_requestHeaders'],_0x2c9a5d),_0x26c5ff=await this['_prepareRequestParameters'](this['_requestParameters'],_0x2c9a5d),_0x46ec5b={'messages':_0xecca14,..._0x26c5ff},_0x99ef8e={'method':'POST','headers':_0x64f751,'body':JSON['stringify'](_0x46ec5b),'signal':this['abortController']['signal']},_0x36e359=await fetch(this['_apiUrl'],_0x99ef8e);if(_0x36e359['ok'])return _0x26c5ff['stream']?await this['_readStreamableResponse'](_0x36e359,_0x5e882a):await this['_readStaticResponse'](_0x36e359,_0x5e882a),Promise['resolve']();{const _0x5a4b74=await _0x36e359['text']();return _0x5a4b74['includes']('context_length_exceeded')?Promise['reject'](new Pi(Di(_0x2e057b,'AI_ERROR_CONTEXT_LENGTH'))):_0x5a4b74['includes']('Moderation')?Promise['reject'](new Pi(Di(_0x2e057b,'AI_ERROR_MODERATION'))):Promise['reject'](new Error(_0x5a4b74));}}async['prepareMessages'](_0x37d903,_0x442b5e,_0x5c355f){let _0x29dfb3,_0x40e2c1;return _0x442b5e?(_0x29dfb3='Your\x20task\x20is\x20to\x20execute\x20the\x20instruction\x20using\x20the\x20provided\x20HTML\x20content.\x20Follow\x20the\x20instruction\x20closely.\x20Your\x20answer\x20must\x20be\x20a\x20properly\x20formatted\x20HTML\x20code.\x20Do\x20not\x20add\x20any\x20additional\x20remarks\x20or\x20notes.\x20Do\x20not\x20act\x20like\x20a\x20chatbot\x20or\x20a\x20real\x20person.',_0x40e2c1='Instruction:\x0a'+_0x37d903+'\x0aYou\x20must\x20keep\x20the\x20text\x20formatting.\x0a\x0aContent:\x0a'+_0x442b5e):(_0x29dfb3='Your\x20task\x20is\x20to\x20generate\x20HTML\x20content\x20accordingly\x20to\x20the\x20given\x20instruction.\x20Never\x20include\x20<img>\x20tag\x20in\x20your\x20response\x20even\x20if\x20asked\x20for.\x20Your\x20answer\x20must\x20be\x20a\x20well-structured\x20and\x20properly\x20formatted\x20HTML\x20code.\x20Answer\x20only\x20with\x20the\x20generated\x20HTML\x20content.\x20Do\x20not\x20add\x20any\x20additional\x20remarks\x20or\x20notes.\x20Do\x20not\x20act\x20like\x20a\x20chatbot\x20or\x20a\x20real\x20person.',_0x40e2c1=_0x37d903),[{'role':'system','content':_0x29dfb3},{'role':'user','content':_0x40e2c1}];}async _readStreamableResponse(_0x42606a,_0x154afd){const _0x1a212e=_0x42606a['body']['getReader'](),_0xfaec85=new TextDecoder();let _0x515b5b='',_0x5b4a98='',_0x2c6853='',_0x237932=!0x1;for(;!_0x237932;){const {done:_0x3e8558,value:_0x3e4586}=await _0x1a212e['read'](),_0x33a07c=_0x515b5b+_0xfaec85['decode'](_0x3e4586);let _0x249f98;_0x237932=_0x3e8558;try{_0x249f98=this['_cleanUpData'](_0x33a07c),_0x515b5b='';}catch{_0x515b5b=_0x33a07c;continue;}_0x5b4a98+=_0x249f98,!_0x237932&&this['_isBufferIncomplete'](_0x5b4a98)||_0x5b4a98&&(_0x2c6853+=_0x5b4a98,_0x5b4a98='',_0x154afd(_0x2c6853));}return Promise['resolve']();}async _readStaticResponse(_0x212762,_0x5d84d8){return _0x5d84d8((await _0x212762['json']())['choices'][0x0]['message']['content']),Promise['resolve']();}_isBufferIncomplete(_0x1a7448){const _0x593141=_0x1a7448['split']('<')['length']!==_0x1a7448['split']('>')['length'],_0x4c6657=_0x1a7448['length']<0x1e;return _0x593141&&_0x4c6657;}_cleanUpData(_0x376dab){return _0x376dab['split'](/\n(?![^{]*\})/g)['map'](_0x5d1f72=>_0x5d1f72['replace']('data:\x20',''))['filter'](_0xbbb005=>_0xbbb005&&_0xbbb005['length']>0x0&&'[DONE]'!==_0xbbb005)['map'](_0x544605=>{const {choices:_0x42a1d8}=JSON['parse'](_0x544605);if(_0x42a1d8[0x0]?.['delta']?.['content'])return _0x42a1d8[0x0]['delta']['content'];})['filter'](_0x4debcc=>_0x4debcc)['join']('');}},as=class extends rs{static get['pluginName'](){return'AWSTextAdapter';}init(){super['init'](),St('ai-aws-adapter-not-supported');}async sendRequest(_0x14080e){throw bt('ai-aws-adapter-not-supported'),new Pi(Di(this['editor']['locale'],'AI_ERROR_AWS_NOT_SUPPORTED'));}},hs=class extends Mt{constructor(_0x12a49d,_0x29563d={}){super(_0x12a49d),this['isToggleable']=!0x0,this['set']('side',_0x29563d['side']||'top');const _0x1253dd=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-tab-button',...vt(_0x29563d['class']||[]),_0x1253dd['to']('side',_0x3a1ae8=>'ck-tab-button_'+_0x3a1ae8),_0x1253dd['to']('class')]}});}['show'](){this['set']('isVisible',!0x0);}['hide'](){this['set']('isVisible',!0x1);}},cs=class extends _0x4ff2da{['children'];constructor(_0x5c7629,_0x1f4b21={}){super(_0x5c7629);const _0x265d74=this['bindTemplate'];this['set']('isVisible',!0x1),this['set']('class',''),this['children']=this['createCollection'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-tab-panel',...vt(_0x1f4b21['class']||[]),_0x265d74['to']('class'),_0x265d74['if']('isVisible','ck-hidden',_0x4ec6a3=>!_0x4ec6a3)]},'children':this['children']});}['show'](){this['set']('isVisible',!0x0);}['hide'](){this['set']('isVisible',!0x1);}},ls=class extends _0x4ff2da{buttonViews=this['createCollection']();['panelViews']=this['createCollection']();_tabs=new Map();constructor(_0x164207,_0x2a8f8e={}){super(_0x164207),this['set']('class',void 0x0),this['set']('activeTab',null),this['set']('side',_0x2a8f8e['side']||'top'),this['set']('isMaximized',!0x1),this['set']('collapsible',_0x2a8f8e['collapsible']||!0x1),this['set']('isCollapsed',!0x1),this['set']('_isMaximizedActive',!0x1),this['bind']('_isMaximizedActive')['to'](this,'isMaximized',this,'isCollapsed',(_0x313cc7,_0x4037f)=>_0x313cc7&&!_0x4037f);const _0x5853a6=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset','ck-tabs',...vt(_0x2a8f8e['class']||[]),_0x5853a6['to']('side',_0x9d7b49=>'ck-tabs_'+_0x9d7b49),_0x5853a6['to']('class'),_0x5853a6['if']('_isMaximizedActive','ck-ai-tabs_maximized'),_0x5853a6['if']('isCollapsed','ck-ai-tabs_collapsed')],'tabindex':'0'},'children':[{'tag':'div','attributes':{'class':['ck','ck-tabs__buttons-container',_0x5853a6['to']('side',_0x5f44cf=>'ck-tabs__buttons-container_'+_0x5f44cf)]},'children':this['buttonViews']},{'tag':'div','attributes':{'class':['ck','ck-tabs__panels-container',_0x5853a6['to']('side',_0x1d432b=>'ck-tabs__panels-container_'+_0x1d432b)]},'children':this['panelViews']},...vt(_0x2a8f8e['children']||[])]});}getTabIds(){return[...this['_tabs']['keys']()];}getTab(_0x3578e6){const _0x550620=this['_tabs']['get'](_0x3578e6);return _0x550620||null;}['addTab'](_0xba7e7d){const _0x31b89a=this['_setupButton']({'id':_0xba7e7d['id'],'label':_0xba7e7d['buttonLabel'],'icon':_0xba7e7d['buttonIcon'],'order':_0xba7e7d['order']}),_0x11fcbf=new cs(this['locale']);return _0x11fcbf['render'](),_0xba7e7d['content']&&_0x11fcbf['children']['add'](_0xba7e7d['content']),this['panelViews']['add'](_0x11fcbf),this['_tabs']['set'](_0xba7e7d['id'],{'button':_0x31b89a,'panel':_0x11fcbf,'order':void 0x0!==_0xba7e7d['order']?_0xba7e7d['order']:null}),this['fire']('addTab:'+_0xba7e7d['id'],{'id':_0xba7e7d['id'],'button':_0x31b89a,'panel':_0x11fcbf}),null===this['activeTab']?this['activateTab'](_0xba7e7d['id']):this['_hidePanel'](_0xba7e7d['id']),{'button':_0x31b89a,'panel':_0x11fcbf};}activateTab(_0x1789cb){if(null!==_0x1789cb&&!this['getTab'](_0x1789cb))throw new ct('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x1789cb});if(this['isCollapsed']=!0x1,this['activeTab']===_0x1789cb)return;const _0x1bd83c=this['activeTab'];this['activeTab']&&this['_hidePanel'](this['activeTab']),this['activeTab']=_0x1789cb,_0x1789cb&&this['_showPanel'](_0x1789cb),this['fire']('activateTab:'+_0x1789cb,{'newTab':_0x1789cb,'oldTab':_0x1bd83c});}toggleTabPanel(_0x94f28f){this['activeTab']===_0x94f28f?this['collapsible']&&(this['isCollapsed']=!this['isCollapsed']):this['activateTab'](_0x94f28f);}['showTab'](_0x2370b7){if(!this['getTab'](_0x2370b7))throw new ct('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x2370b7});this['_showPanel'](_0x2370b7),this['_showButton'](_0x2370b7),this['fire']('show:'+_0x2370b7,_0x2370b7);}['hideTab'](_0xce69d5){if(!this['getTab'](_0xce69d5))throw new ct('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0xce69d5});const _0x157423=this['activeTab'];this['_hidePanel'](_0xce69d5),this['_hideButton'](_0xce69d5);const _0x55f7cf=this['getTabIds']();_0x157423===_0xce69d5&&_0x55f7cf['length']>0x1&&this['activateTab'](_0x55f7cf['find'](_0x1611cd=>_0x1611cd!==_0xce69d5)),this['fire']('hide:'+_0xce69d5,_0xce69d5);}_getPanel(_0x260777){const _0x238200=this['_tabs']['get'](_0x260777);return _0x238200?_0x238200['panel']:null;}['_showPanel'](_0x42d2e3){null!==this['activeTab']&&this['activeTab']!==_0x42d2e3||this['_getPanel'](_0x42d2e3)['show']();}['_hidePanel'](_0x497a9a){const _0x5ab228=this['_getPanel'](_0x497a9a);_0x5ab228['isVisible']&&(this['activeTab']===_0x497a9a&&(this['activeTab']=null),_0x5ab228['hide']());}_getButton(_0x47deb0){const _0x562021=this['_tabs']['get'](_0x47deb0);return _0x562021?_0x562021['button']:null;}_showButton(_0x174cb3){this['_getButton'](_0x174cb3)['show']();}_hideButton(_0x5a0ab9){this['_getButton'](_0x5a0ab9)['hide']();}_setupButton(_0x3dd0f5){const _0x3e2a2b=new hs(this['locale'],{'side':this['side']}),_0x4ea37a=this['buttonViews'];if(_0x3e2a2b['set']({'label':_0x3dd0f5['label'],'icon':_0x3dd0f5['icon'],'tooltip':!0x0,'withText':!0x0}),_0x3e2a2b['bind']('isOn')['to'](this,'activeTab',this,'isCollapsed',(_0x1efed7,_0xe4bffb)=>_0x1efed7===_0x3dd0f5['id']&&!_0xe4bffb),_0x3e2a2b['bind']('side')['to'](this,'side'),_0x3dd0f5['order']){const _0x432e49=[...this['_tabs']]['reduce']((_0x2e8ef6,_0x516292)=>{const _0x2d0c9b=_0x516292[0x0],{order:_0x1fc131}=_0x516292[0x1];return!_0x1fc131||_0x1fc131>_0x3dd0f5['order']?_0x2e8ef6:_0x1fc131>=_0x2e8ef6['order']?{'id':_0x2d0c9b,'order':_0x1fc131}:_0x2e8ef6;},{'id':'','order':0x0}),_0x432ca3=_0x4ea37a['getIndex'](this['_getButton'](_0x432e49['id']));_0x4ea37a['add'](_0x3e2a2b,_0x432ca3+0x1);}else _0x4ea37a['add'](_0x3e2a2b);return _0x3e2a2b['on']('execute',()=>{this['toggleTabPanel'](_0x3dd0f5['id']);}),_0x3e2a2b;}};const us=['overlay','sidebar','custom'],ds=['left','right'];var _s=class extends ls{constructor(_0x1ce403,_0x1fc49c={}){super(_0x1ce403,_0x1fc49c),this['set']('type',_0x1fc49c['type']||'sidebar'),this['set']('side',_0x1fc49c['side']||'right'),this['set']('isVisible',_0x1fc49c['visibleByDefault']??!0x0);const _0x3478a0=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-tabs',_0x3478a0['if']('type','ck-ai-tabs__overlay',_0xbce0d5=>'overlay'===_0xbce0d5),_0x3478a0['if']('type','ck-ai-tabs__sidebar',_0x5dfcfb=>'sidebar'===_0x5dfcfb),_0x3478a0['if']('isVisible','ck-hidden',_0x1597a1=>!_0x1597a1)]}}),this['buttonViews']['on']('add',(_0x487f63,_0x4b7576)=>{_0x4b7576['set']('withText',!0x1);});}},gs=class extends _0x212144{['view'];container=null;showResizeButton=!0x0;static get['pluginName'](){return'AITabs';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x41a6a6){if(super(_0x41a6a6),!this['context']['config']['get']('ai.container'))throw new ct('ai-tabs-configuration-not-found');this['context']['config']['define']('ai.container.visibleByDefault',!0x0),this['context']['config']['define']('ai.container.collapsible',!0x1);const _0xed6231=this['context']['config']['get']('ai.container');if(this['set']('side','right'),void 0x0!==_0xed6231['showResizeButton']&&(this['showResizeButton']=_0xed6231['showResizeButton']),'sidebar'!==_0xed6231['type']&&'overlay'!==_0xed6231['type']||_0xed6231['side']&&(this['side']=_0xed6231['side']),'sidebar'===_0xed6231['type']){if(this['container']=_0xed6231['element'],this['set']('type','sidebar'),!this['container'])throw new ct('ai-tabs-sidebar-container-element-not-found');}else'overlay'===_0xed6231['type']?(this['container']=document['body'],this['set']('type','overlay')):(this['container']=null,this['set']('type','custom'));this['view']=new _s(this['context']['locale'],{'side':this['side'],'type':this['type'],'visibleByDefault':_0xed6231['visibleByDefault'],'collapsible':_0xed6231['collapsible']}),this['view']['render'](),this['view']['bind']('side')['to'](this,'side'),this['view']['bind']('type')['to'](this,'type'),this['container']&&this['container']['appendChild'](this['view']['element']),this['context']instanceof _0x2a0bfb&&this['context']['ui']['focusTracker']['add'](this['view']['element']),this['listenTo'](this,'resizeTabs',()=>{this['view']['isMaximized']=!this['view']['isMaximized'],this['fire']('resizedTabs',this['view']['isMaximized']);});}switchType(_0x3a829e){if(_0x3a829e&&this['type']!==_0x3a829e){if(!us['includes'](_0x3a829e))throw new ct('ai-tabs-unsupported-ui-type');this['type']=_0x3a829e;}}switchSide(_0x400783){if(_0x400783&&this['side']!==_0x400783){if(!ds['includes'](_0x400783))throw new ct('ai-tabs-unsupported-ui-side');this['side']=_0x400783;}}destroy(){super['destroy'](),this['view']['destroy'](),this['view']['element']&&this['view']['element']['remove']();}};function As(_0x2ea4a2){return{..._0x2ea4a2,'type':'context'};}var Is=class extends _0x212144{['_apiUrl'];get['_apiUrlV11'](){return this['_apiUrl']['replace'](/\/v1$/,'/v1.1');}_token;['_decoder'];static get requires(){return[_0x1ec8f8];}static get['pluginName'](){return'AIConnector';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x1b82fa){if(super(_0x1b82fa),this['context']['config']['define']('ai.serviceUrl','https://ai.cke-cs.com/v1'),this['_apiUrl']=this['context']['config']['get']('ai.serviceUrl')['replace'](/\/+$/,''),!this['_apiUrl']['endsWith']('/v1'))throw new ct('ai-service-url-invalid-version',this,{'serviceUrl':this['_apiUrl']});this['_token']=null,this['_decoder']=new TextDecoder();}init(){const _0x5670fa=this['context']['plugins']['get'](_0x1ec8f8);if(!_0x5670fa['token'])throw new ct('ai-missing-token',this);this['_token']=_0x5670fa['token'];}_getExtraHttpHeaders(){const _0x22dec6=this['context']['config']['get']('ai.extraHttpHeaders'),_0x1c3f20='function'==typeof _0x22dec6?_0x22dec6():_0x22dec6;if(Array['isArray'](_0x1c3f20)&&_0x1c3f20['length'])return Object['fromEntries'](_0x1c3f20['map'](({domain:_0x13930a,headers:_0xa526ff})=>[_0x13930a,_0xa526ff]));}startConversation(_0x4c65bf,_0x55a0a8){const _0x3010fa=this['_sendApiRequest']('/conversations','POST',{'id':_0x4c65bf,'group':_0x55a0a8});return{'getConversation':async()=>(await _0x3010fa['request'])['json'](),'abortController':_0x3010fa['abortController']};}queryAssistant({message:_0x1b9186,conversationId:_0x470b6d,parts:_0x3379b4,capabilities:_0x20a762,model:_0x3036f2,attributes:_0x2858f3}){const _0x4f6c47=this['_getExtraHttpHeaders'](),_0x19e6ef={..._0x1b9186&&{'prompt':_0x1b9186},'content':_0x3379b4,'model':_0x3036f2,..._0x20a762&&{'capabilities':_0x20a762},..._0x2858f3&&{'attributes':_0x2858f3},..._0x4f6c47&&{'extraHttpHeaders':_0x4f6c47}},_0x5bd69b=this['_sendApiRequest']('/conversations/'+_0x470b6d+'/messages','POST',_0x19e6ef,{'apiUrl':this['_apiUrlV11']});return{'getStream':async()=>{const _0x152ce9=(await _0x5bd69b['request'])['body'];return this['_getStreamReader'](_0x152ce9);},'abortController':_0x5bd69b['abortController']};}executeCustomAction({content:_0x1d62d9,message:_0x1fe4e8,model:_0x113fa7,outputFormat:_0x4af7bb,contexts:_0x4fc3fa}){const _0x51660a={'content':[{'type':'text','content':_0x1d62d9}],..._0x1fe4e8&&{'prompt':_0x1fe4e8},'model':_0x113fa7,'outputFormat':_0x4af7bb,...ps(_0x4fc3fa)},_0x39a992=this['_sendApiRequest']('/actions/custom/calls','POST',_0x51660a);return{'getStream':async()=>{const _0x49cb2d=(await _0x39a992['request'])['body'];return this['_getStreamReader'](_0x49cb2d);},'abortController':_0x39a992['abortController']};}executeAction({actionName:_0x4eb0b7,content:_0x107b59,args:_0x17b83c,contexts:_0x5c5c4f}){const _0x32ecbf={'content':[{'type':'text','content':_0x107b59}],'args':_0x17b83c,...ps(_0x5c5c4f)},_0x2226c8=this['_sendApiRequest']('/actions/system/'+_0x4eb0b7+'/calls','POST',_0x32ecbf);return{'getStream':async()=>{const _0x4fa446=(await _0x2226c8['request'])['body'];return this['_getStreamReader'](_0x4fa446);},'abortController':_0x2226c8['abortController']};}['uploadFile'](_0x440478,_0x463f39,_0x51eba8){const _0x3c6c2a=new FormData();_0x3c6c2a['append']('file',_0x463f39,_0x463f39['name']),_0x51eba8&&_0x3c6c2a['append']('attributes',JSON['stringify'](_0x51eba8));const _0x52800c=this['_sendApiRequest']('/conversations/'+_0x440478+'/files','POST',_0x3c6c2a);return{'getId':async()=>(await _0x52800c['request'])['json'](),'abortController':_0x52800c['abortController']};}uploadDocuments(_0x30bcfb,_0x1c789b){const _0x48840e={'documents':_0x1c789b['map'](_0x5e3111=>({'content':_0x5e3111['content'],'attributes':{'version':_0x5e3111['version'],'sessionId':_0x5e3111['sessionId'],'channelId':_0x5e3111['channelId'],'rootName':_0x5e3111['rootName'],'selections':_0x5e3111['selections']},...void 0x0!==_0x5e3111['name']?{'name':_0x5e3111['name']}:{},...void 0x0!==_0x5e3111['description']?{'description':_0x5e3111['description']}:{}}))},_0x37529a=this['_sendApiRequest']('/conversations/'+_0x30bcfb+'/documents/batch','POST',_0x48840e);return{'getIds':async()=>(await _0x37529a['request'])['json'](),'abortController':_0x37529a['abortController']};}fetchDocuments(_0x300475,_0x58abe4){const _0x2ab29d=new URLSearchParams();_0x2ab29d['append']('documentIds',_0x58abe4['join'](','));const _0x34e8da=this['_sendApiRequest']('/conversations/'+_0x300475+'/documents/batch?'+_0x2ab29d['toString'](),'GET');return{'getDocuments':async()=>(await _0x34e8da['request'])['json'](),'abortController':_0x34e8da['abortController']};}fetchConversations(_0x1dd4f5,_0x4fc719={}){const _0x13afbd=new URLSearchParams();_0x13afbd['append']('group',_0x1dd4f5),_0x13afbd['append']('excludeEmpty',!0x1!==_0x4fc719['excludeEmpty']?'true':'false'),_0x13afbd['append']('limit',_0x4fc719['limit']?_0x4fc719['limit']['toString']():0x64['toString']()),_0x13afbd['append']('sortBy',_0x4fc719['sortBy']?_0x4fc719['sortBy']:'createdAt'),_0x13afbd['append']('order',_0x4fc719['order']?_0x4fc719['order']:'desc');const _0x1f7eed=this['_sendApiRequest']('/conversations?'+_0x13afbd['toString'](),'GET');return{'getConversations':async()=>(await(await _0x1f7eed['request'])['json']())['items'],'abortController':_0x1f7eed['abortController']};}deleteConversation(_0x55d12f){const _0x5602bf=this['_sendApiRequest']('/conversations/'+_0x55d12f,'DELETE');return{'execute':async()=>{await _0x5602bf['request'];},'abortController':_0x5602bf['abortController']};}updateConversation(_0x27c94d,_0x5a335d){const _0x9625ff=this['_sendApiRequest']('/conversations/'+_0x27c94d,'PATCH',_0x5a335d);return{'getResult':async()=>(await _0x9625ff['request'],_0x5a335d),'abortController':_0x9625ff['abortController']};}fetchConversation(_0x1c864c){const _0x1cebeb=this['_sendApiRequest']('/conversations/'+_0x1c864c,'GET');return{'getConversation':async()=>(await _0x1cebeb['request'])['json'](),'abortController':_0x1cebeb['abortController']};}fetchConversationMessages(_0x158ad7){const _0x39765e=this['_sendApiRequest']('/conversations/'+_0x158ad7+'/messages','GET',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'getMessages':async()=>(await(await _0x39765e['request'])['json']())['items'],'abortController':_0x39765e['abortController']};}['uploadUrl'](_0x281a75,_0x50f60a,_0x535d52){const _0x2fa833=this['_sendApiRequest']('/conversations/'+_0x281a75+'/web-resources','POST',{'url':_0x50f60a,'attributes':_0x535d52});return{'getId':async()=>(await _0x2fa833['request'])['json'](),'abortController':_0x2fa833['abortController']};}getModels(_0x5c3c42='en'){const _0x28a965=new URLSearchParams();_0x28a965['append']('language',_0x5c3c42);const _0x50d834='/models/1?'+_0x28a965['toString'](),_0x4c5087=this['_sendApiRequest'](_0x50d834,'GET');return{'list':async()=>await(await _0x4c5087['request'])['json'](),'abortController':_0x4c5087['abortController']};}listContexts(_0x12c239={}){const _0x1b07ad=new URLSearchParams();_0x1b07ad['append']('limit',_0x12c239['limit']?_0x12c239['limit']['toString']():0x64['toString']()),_0x12c239['cursor']&&_0x1b07ad['append']('cursor',_0x12c239['cursor']),_0x12c239['order']&&_0x1b07ad['append']('order',_0x12c239['order']);const _0x3bec09=this['_sendApiRequest']('/contexts?'+_0x1b07ad['toString'](),'GET');return{'getContexts':async()=>(await(await _0x3bec09['request'])['json']())['items'],'abortController':_0x3bec09['abortController']};}deleteFile(_0x313239,_0x59fa25){const _0x4eac9f=this['_sendApiRequest']('/conversations/'+_0x313239+'/files/'+_0x59fa25,'DELETE');return{'execute':async()=>{await _0x4eac9f['request'];},'abortController':_0x4eac9f['abortController']};}deleteDocument(_0x55808e,_0x3585a3){const _0x3cedc8=this['_sendApiRequest']('/conversations/'+_0x55808e+'/documents/'+_0x3585a3,'DELETE');return{'execute':async()=>{await _0x3cedc8['request'];},'abortController':_0x3cedc8['abortController']};}deleteWebResource(_0x52b0a9,_0x479be7){const _0x40233a=this['_sendApiRequest']('/conversations/'+_0x52b0a9+'/web-resources/'+_0x479be7,'DELETE');return{'execute':async()=>{await _0x40233a['request'];},'abortController':_0x40233a['abortController']};}cancelStream(_0x5445ac,_0x2cdce2){const _0x52f025=this['_sendApiRequest']('/conversations/'+_0x5445ac+'/messages/'+_0x2cdce2+'/stream','DELETE',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'execute':async()=>{await _0x52f025['request'];},'abortController':_0x52f025['abortController']};}resumeStream(_0x38f581,_0x549822,_0x3f3958='0-0'){const _0x174969=new URLSearchParams({'lastEventId':_0x3f3958}),_0x5e2d1a=this['_sendApiRequest']('/conversations/'+_0x38f581+'/messages/'+_0x549822+'/stream?'+_0x174969['toString'](),'GET',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'getStream':async()=>{const _0x13aa90=await _0x5e2d1a['request'];return this['_getStreamReader'](_0x13aa90['body']);},'abortController':_0x5e2d1a['abortController']};}callSystemReview({reviewName:_0x4f7008,content:_0x4822fe,args:_0x1898a,contexts:_0x8d9821}){const _0x1f6976=this['_sendApiRequest']('/reviews/system/'+_0x4f7008+'/calls','POST',{'content':[{'type':'text','content':_0x4822fe}],'args':_0x1898a,...ps(_0x8d9821)});return{'getStream':async()=>{const _0x47f762=(await _0x1f6976['request'])['body'];return this['_getStreamReader'](_0x47f762);},'abortController':_0x1f6976['abortController']};}processDocument({content:_0x3eeadc,prompt:_0x3acde6,model:_0x2b2206,capabilities:_0x1e3039,contexts:_0x220c80}){const _0x43c485=this['_getExtraHttpHeaders'](),_0x4f4ead=this['_sendApiRequest']('/documents/process','POST',{'content':_0x3eeadc,'prompt':_0x3acde6,'model':_0x2b2206,..._0x1e3039&&{'capabilities':_0x1e3039},...ps(_0x220c80),..._0x43c485&&{'extraHttpHeaders':_0x43c485}});return{'getResult':async()=>(await _0x4f4ead['request'])['json'](),'abortController':_0x4f4ead['abortController']};}callCustomReview({content:_0x233571,prompt:_0x5d124b,model:_0x463780,contexts:_0x20bd23}){const _0x3181eb=this['_sendApiRequest']('/reviews/custom/calls','POST',{'content':[{'type':'text','content':_0x233571}],..._0x5d124b&&{'prompt':_0x5d124b},'model':_0x463780,...ps(_0x20bd23)});return{'getStream':async()=>{const _0x22285d=(await _0x3181eb['request'])['body'];return this['_getStreamReader'](_0x22285d);},'abortController':_0x3181eb['abortController']};}upsertAIChatRating(_0x6c491b,_0x57413f,_0x3a8c64){const _0x20ffa8=this['_sendApiRequest']('/conversations/'+_0x6c491b+'/messages/'+_0x57413f+'/ratings','PUT',{'positiveCount':_0x3a8c64['positiveCount'],'totalCount':_0x3a8c64['totalCount'],'modificationId':_0x3a8c64['modificationId']});return{'execute':async()=>{await _0x20ffa8['request'];},'abortController':_0x20ffa8['abortController']};}upsertAIActionRating(_0x4f5dce,_0x16ec01,_0x37bb28){const _0x5ed3c8=this['_sendApiRequest']('/actions/system/'+_0x4f5dce+'/calls/'+_0x16ec01+'/ratings','PUT',{'positiveCount':_0x37bb28['positiveCount'],'totalCount':_0x37bb28['totalCount']});return{'execute':async()=>{await _0x5ed3c8['request'];},'abortController':_0x5ed3c8['abortController']};}upsertCustomAIActionRating(_0x142976,_0xb8107c){const _0xd212a2=this['_sendApiRequest']('/actions/custom/calls/'+_0x142976+'/ratings','PUT',{'positiveCount':_0xb8107c['positiveCount'],'totalCount':_0xb8107c['totalCount']});return{'execute':async()=>{await _0xd212a2['request'];},'abortController':_0xd212a2['abortController']};}upsertAIReviewRating(_0x42ea36,_0x1604c1,_0x5b16a4,_0x1a805c){const _0x175557=this['_sendApiRequest']('/reviews/system/'+_0x42ea36+'/calls/'+_0x1604c1+'/ratings','PUT',{'positiveCount':_0x5b16a4['positiveCount'],'totalCount':_0x5b16a4['totalCount'],'dataId':_0x1a805c});return{'execute':async()=>{await _0x175557['request'];},'abortController':_0x175557['abortController']};}upsertCustomAIReviewRating(_0x553133,_0x1597e4,_0x183b27){const _0x18eed3=this['_sendApiRequest']('/reviews/custom/calls/'+_0x553133+'/ratings','PUT',{'positiveCount':_0x1597e4['positiveCount'],'totalCount':_0x1597e4['totalCount'],'dataId':_0x183b27});return{'execute':async()=>{await _0x18eed3['request'];},'abortController':_0x18eed3['abortController']};}_sendApiRequest(_0x3e260e,_0x47084b,_0x5a874b,_0x35d073={}){const {apiUrl:_0x2b5f3f=this['_apiUrl']}=_0x35d073,_0x12f283=new AbortController(),_0x59cc51=_0x5a874b instanceof FormData,_0x2d278c={'Authorization':'Bearer\x20'+this['_token']?.['value'],'X-Editor-Version':yt};_0x5a874b&&!_0x59cc51&&(_0x2d278c['Content-Type']='application/json');const _0x3c47bd={'method':_0x47084b,'headers':_0x2d278c,'signal':_0x12f283['signal']};return _0x5a874b&&(_0x3c47bd['body']=_0x59cc51?_0x5a874b:JSON['stringify'](_0x5a874b)),{'request':fetch(''+_0x2b5f3f+_0x3e260e,_0x3c47bd)['catch'](_0x2b81d6=>{this['_handleError'](_0x2b81d6);})['then'](_0x5812b6=>_0x5812b6['ok']?_0x5812b6:_0x5812b6['json']()['then'](_0x10c1df=>{throw{'url':_0x2b5f3f,'path':_0x3e260e,'method':_0x47084b,'body':_0x5a874b,'status':(_0x5812b6||{})['status'],'statusText':(_0x5812b6||{})['statusText'],'code':_0x10c1df['code'],'message':_0x10c1df['message'],'traceId':_0x10c1df['traceId'],'data':_0x10c1df['data']};})),'abortController':_0x12f283};}async *_getStreamReader(_0x103443){const _0x247c22=[],_0x213345=_0x103443['getReader'](),_0xc6f8bd=_0x4df230({'onError':_0x31c33c=>{this['_handleError'](_0x31c33c);},'onEvent':_0x38c93=>{_0x38c93['data']=JSON['parse'](_0x38c93['data']),_0x247c22['push'](_0x38c93);}});try{let _0x36c28b=!0x1;for(;!_0x36c28b;){const {done:_0x395c9c,value:_0x5bbb77}=await _0x213345['read']();_0x395c9c&&(_0x36c28b=!0x0),_0xc6f8bd['feed'](this['_decoder']['decode'](_0x5bbb77,{'stream':!0x0})),yield*_0x247c22,_0x247c22['length']=0x0;}}catch(_0x336f54){this['_handleError'](_0x336f54);}finally{_0x213345['releaseLock'](),_0xc6f8bd['reset']();}}['_handleError'](_0x33bdfc){if(_0x33bdfc instanceof ct)throw _0x33bdfc;if(_0x33bdfc instanceof Error&&'AbortError'===_0x33bdfc['name'])throw new ct('ai-request-aborted',this,{'originalError':_0x33bdfc});throw new ct('ai-request-failed',this,{'originalError':_0x33bdfc});}};function ps(_0x44285b){return _0x44285b?.['length']?{'contexts':_0x44285b['map'](As)}:{};}function Es(_0x2b8891,_0x5c3b33,_0x184d6f){const t=_0x2b8891['t'];switch(_0x5c3b33){case'AI_SUGGESTION_HEADER_TITLE':return t({'id':'AI_SUGGESTION_HEADER_TITLE','string':'Proposed\x20changes'});case'AI_SUGGESTION_BUTTON_SHOW_CHANGES':return t({'id':'AI_SUGGESTION_BUTTON_SHOW_CHANGES','string':'Show\x20details'});case'AI_MINI_TOOLBAR_LIKE':return t({'id':'AI_MINI_TOOLBAR_LIKE','string':'I\x20like\x20this\x20response'});case'AI_MINI_TOOLBAR_DISLIKE':return t({'id':'AI_MINI_TOOLBAR_DISLIKE','string':'I\x20don\x27t\x20like\x20this\x20response'});case'AI_MINI_TOOLBAR_COPY':return t({'id':'AI_MINI_TOOLBAR_COPY','string':'Copy\x20to\x20clipboard'});case'AI_SUGGESTION_CONTENT_PART_TITLE':return t({'id':'AI_SUGGESTION_CONTENT_PART_TITLE','string':'Change\x20%0'},_0x184d6f);case'AI_SUGGESTION_CONTENT_PART_REJECTED':return t({'id':'AI_SUGGESTION_CONTENT_PART_REJECTED','string':'Change\x20was\x20rejected'});case'AI_SUGGESTION_CONTENT_PART_OUTDATED':return t({'id':'AI_SUGGESTION_CONTENT_PART_OUTDATED','string':'Change\x20is\x20outdated'});case'AI_SUGGESTION_CONTENT_PART_ALREADY_APPLIED':return t({'id':'AI_SUGGESTION_CONTENT_PART_ALREADY_APPLIED','string':'Change\x20is\x20already\x20applied'});case'AI_SUGGESTION_CONTENT_PART_APPLY':return t({'id':'AI_SUGGESTION_CONTENT_PART_APPLY','string':'Apply\x20change'});case'AI_SUGGESTION_CONTENT_PART_ADD_SUGGESTION':return t({'id':'AI_SUGGESTION_CONTENT_PART_ADD_SUGGESTION','string':'Add\x20as\x20suggestion'});case'AI_SUGGESTION_CONTENT_PART_REJECT':return t({'id':'AI_SUGGESTION_CONTENT_PART_REJECT','string':'Reject\x20change'});case'AI_SUGGESTION_CONTENT_PART_REMOVED':return t({'id':'AI_SUGGESTION_CONTENT_PART_REMOVED','string':'Removed\x20content.\x20Use\x20\x22Show\x20details\x22\x20to\x20learn\x20more.'});case'AI_SUGGESTION_CONTENT_PART_STATE_ACCEPTED':return t({'id':'AI_SUGGESTION_CONTENT_PART_STATE_ACCEPTED','string':'Approved'});case'AI_SUGGESTION_CONTENT_PART_STATE_REJECTED':return t({'id':'AI_SUGGESTION_CONTENT_PART_STATE_REJECTED','string':'Rejected'});case'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED':return t({'id':'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED','string':'Outdated'});case'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_TOOLTIP':return t({'id':'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_TOOLTIP','string':'Created\x20for\x20a\x20previous\x20version\x20of\x20the\x20document\x20and\x20can\x20no\x20longer\x20be\x20applied.'});case'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_CONTENT_REMOVED_TOOLTIP':return t({'id':'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_CONTENT_REMOVED_TOOLTIP','string':'Created\x20for\x20content\x20that\x20no\x20longer\x20exists.'});case'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_EDITOR_REMOVED_TOOLTIP':return t({'id':'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_EDITOR_REMOVED_TOOLTIP','string':'Created\x20for\x20content\x20that\x20no\x20longer\x20exists.'});case'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_SESSION_CHANGED_TOOLTIP':return t({'id':'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_SESSION_CHANGED_TOOLTIP','string':'Created\x20for\x20a\x20previous\x20version\x20of\x20the\x20document\x20and\x20can\x20no\x20longer\x20be\x20applied.'});case'AI_DISCLAIMER_TEXT':return t({'id':'AI_DISCLAIMER_TEXT','string':'AI\x20can\x20make\x20mistakes.\x20Please\x20double-check\x20responses.'});case'AI_TABS_LABEL_MAXIMIZE':return t({'id':'AI_TABS_LABEL_MAXIMIZE','string':'Maximize'});case'AI_TABS_LABEL_MINIMIZE':return t({'id':'AI_TABS_LABEL_MINIMIZE','string':'Minimize'});case'AI_CHAT_HEADING':return t({'id':'AI_CHAT_HEADING','string':'Chat'});case'AI_CHAT_SOURCES_HEADER':return t({'id':'AI_CHAT_SOURCES_HEADER','string':'Sources'});case'AI_CHAT_UNTITLED_CONVERSATION':return t({'id':'AI_CHAT_UNTITLED_CONVERSATION','string':'Untitled\x20conversation'});case'AI_CHAT_LABEL_NEW_CHAT':return t({'id':'AI_CHAT_LABEL_NEW_CHAT','string':'New\x20chat'});case'AI_CHAT_STOP_GENERATING':return t({'id':'AI_CHAT_STOP_GENERATING','string':'Stop\x20generating'});case'AI_CHAT_IS_WRITING':return t({'id':'AI_CHAT_IS_WRITING','string':'AI\x20is\x20writing...'});case'AI_CHAT_PROMPT_EMPTY_ERROR':return t({'id':'AI_CHAT_PROMPT_EMPTY_ERROR','string':'This\x20field\x20cannot\x20be\x20empty.'});case'AI_CHAT_LABEL_SUBMIT':return t({'id':'AI_CHAT_LABEL_SUBMIT','string':'Submit'});case'AI_CHAT_WELCOME_MESSAGE':return t({'id':'AI_CHAT_WELCOME_MESSAGE','string':'Hi!\x20I\x20can\x20help\x20you\x20draft,\x20rewrite,\x20and\x20improve\x20your\x20text,\x20explore\x20ideas,\x20research\x20topics,\x20and\x20solve\x20problems.\x20How\x20can\x20I\x20help\x20right\x20now?'});case'AI_CHAT_ABORTED_MESSAGE':return t({'id':'AI_CHAT_ABORTED_MESSAGE','string':'Response\x20stopped.'});case'AI_CHAT_GENERIC_ERROR':return t({'id':'AI_CHAT_GENERIC_ERROR','string':'Something\x20went\x20wrong\x20while\x20processing\x20your\x20request.\x20Please\x20try\x20again.'});case'AI_CHAT_UNABLE_TO_START_CONVERSATION':return t({'id':'AI_CHAT_UNABLE_TO_START_CONVERSATION','string':'Unable\x20to\x20start\x20conversation.\x20Please\x20make\x20sure\x20you\x20are\x20online\x20and\x20try\x20again.'});case'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION':return t({'id':'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION','string':'Unable\x20to\x20load\x20chosen\x20conversation.\x20Please\x20make\x20sure\x20you\x20are\x20online\x20and\x20try\x20again.'});case'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_FILE':return t({'id':'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_FILE','string':'Failed\x20to\x20upload\x20files:\x20%0.\x20Please\x20try\x20again.'},_0x184d6f);case'AI_CHAT_CONTEXT_FOLDER_NOT_SUPPORTED':return t({'id':'AI_CHAT_CONTEXT_FOLDER_NOT_SUPPORTED','string':'Folders\x20cannot\x20be\x20added\x20to\x20the\x20chat.\x20Try\x20adding\x20individual\x20files\x20instead.'});case'AI_CHAT_CONTEXT_UNABLE_TO_LOAD_RESOURCES':return t({'id':'AI_CHAT_CONTEXT_UNABLE_TO_LOAD_RESOURCES','string':'Unable\x20to\x20load\x20resources\x20from\x20%0.\x20Please\x20try\x20again.'},_0x184d6f);case'AI_CHAT_RESOURCE_LOAD_FAILED':return t({'id':'AI_CHAT_RESOURCE_LOAD_FAILED','string':'Failed\x20to\x20load\x20resource.\x20Please\x20try\x20again.'});case'AI_CHAT_CONTEXT_CURRENT_DOCUMENT':return t({'id':'AI_CHAT_CONTEXT_CURRENT_DOCUMENT','string':'Current\x20document'});case'AI_CHAT_CONTEXT_PASTED_TEXT_NAME':return t({'id':'AI_CHAT_CONTEXT_PASTED_TEXT_NAME','string':'Pasted\x20Text'});case'AI_CHAT_DROP_ZONE_HINT':return t({'id':'AI_CHAT_DROP_ZONE_HINT','string':'Drop\x20files\x20here\x20to\x20add\x20to\x20the\x20chat'});case'AI_CHAT_CONTEXT_REMOVE_FROM_CONTEXT':return t({'id':'AI_CHAT_CONTEXT_REMOVE_FROM_CONTEXT','string':'Remove\x20from\x20context'});case'AI_CHAT_CONTEXT_ADD_CONTEXT':return t({'id':'AI_CHAT_CONTEXT_ADD_CONTEXT','string':'Add\x20context'});case'AI_CHAT_CONTEXT_URL_LABEL':return t({'id':'AI_CHAT_CONTEXT_URL_LABEL','string':'URL'});case'AI_CHAT_CONTEXT_FILE_LABEL':return t({'id':'AI_CHAT_CONTEXT_FILE_LABEL','string':'File'});case'AI_CHAT_CONTEXT_LIBRARY_LABEL':return t({'id':'AI_CHAT_CONTEXT_LIBRARY_LABEL','string':'Context\x20library'});case'AI_CHAT_CONTEXT_CURRENT_CONTEXT_LABEL':return t({'id':'AI_CHAT_CONTEXT_CURRENT_CONTEXT_LABEL','string':'Current\x20context'});case'AI_CHAT_CONTEXT_DOCUMENT_SELECTION_LABEL':return t({'id':'AI_CHAT_CONTEXT_DOCUMENT_SELECTION_LABEL','string':'Selected\x20content'});case'AI_CHAT_SEARCH_WEB':return t({'id':'AI_CHAT_SEARCH_WEB','string':'Web\x20search'});case'AI_CHAT_ENABLE_WEB_SEARCH':return t({'id':'AI_CHAT_ENABLE_WEB_SEARCH','string':'Enable\x20web\x20search'});case'AI_CHAT_DISABLE_WEB_SEARCH':return t({'id':'AI_CHAT_DISABLE_WEB_SEARCH','string':'Disable\x20web\x20search'});case'AI_CHAT_REASONING':return t({'id':'AI_CHAT_REASONING','string':'Reasoning'});case'AI_CHAT_ENABLE_REASONING':return t({'id':'AI_CHAT_ENABLE_REASONING','string':'Enable\x20reasoning'});case'AI_CHAT_DISABLE_REASONING':return t({'id':'AI_CHAT_DISABLE_REASONING','string':'Disable\x20reasoning'});case'AI_CHAT_COMMANDS':return t({'id':'AI_CHAT_COMMANDS','string':'Commands'});case'AI_CHAT_SEARCH_RESOURCES':return t({'id':'AI_CHAT_SEARCH_RESOURCES','string':'Search\x20resources'});case'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT':return t({'id':'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT','string':'Back\x20to\x20context\x20options'});case'AI_CHAT_CONTEXT_URL_ADD_URL':return t({'id':'AI_CHAT_CONTEXT_URL_ADD_URL','string':'Add\x20URL'});case'AI_CHAT_CONTEXT_URL_PLACEHOLDER':return t({'id':'AI_CHAT_CONTEXT_URL_PLACEHOLDER','string':'Add\x20URL...'});case'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_URL':return t({'id':'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_URL','string':'Failed\x20to\x20upload\x20URL:\x20%0.\x20Please\x20try\x20again.'},_0x184d6f);case'AI_CHAT_CONTEXT_INVALID_DATA':return t({'id':'AI_CHAT_CONTEXT_INVALID_DATA','string':'Invalid\x20context\x20data\x20type\x20for\x20the\x20selected\x20resource.'});case'AI_CHAT_CONTEXT_UNSUPPORTED_TYPE':return t({'id':'AI_CHAT_CONTEXT_UNSUPPORTED_TYPE','string':'Unsupported\x20resource\x20type.\x20Only\x20files\x20and\x20URLs\x20are\x20supported.'});case'AI_CHAT_CONTEXT_URL_EMPTY_ERROR':return t({'id':'AI_CHAT_CONTEXT_URL_EMPTY_ERROR','string':'URL\x20cannot\x20be\x20empty.'});case'AI_CHAT_CONTEXT_URL_INVALID_ERROR':return t({'id':'AI_CHAT_CONTEXT_URL_INVALID_ERROR','string':'Please\x20enter\x20a\x20valid\x20URL.'});case'AI_CHAT_INVALID_REQUEST':return t({'id':'AI_CHAT_INVALID_REQUEST','string':'Something\x20went\x20wrong\x20while\x20processing\x20your\x20request.\x20Please\x20try\x20again.'});case'AI_CHAT_CONTEXT_UNSUPPORTED_FILE_TYPE':return t({'id':'AI_CHAT_CONTEXT_UNSUPPORTED_FILE_TYPE','string':'The\x20file\x20type\x20is\x20not\x20supported.\x20Please\x20upload\x20a\x20different\x20file.'});case'AI_CHAT_CONTEXT_FILE_TOO_LARGE':return t({'id':'AI_CHAT_CONTEXT_FILE_TOO_LARGE','string':'The\x20file\x20is\x20too\x20large.\x20Please\x20upload\x20a\x20smaller\x20file.'});case'AI_CHAT_CONTEXT_FILE_TOO_MANY_PAGES':return t({'id':'AI_CHAT_CONTEXT_FILE_TOO_MANY_PAGES','string':'The\x20file\x20has\x20too\x20many\x20pages.\x20Please\x20upload\x20a\x20file\x20with\x20fewer\x20pages.'});case'AI_CHAT_CONTEXT_FORM_DATA_SIZE_LIMITS_EXCEEDED':return t({'id':'AI_CHAT_CONTEXT_FORM_DATA_SIZE_LIMITS_EXCEEDED','string':'The\x20form\x20data\x20size\x20limits\x20are\x20exceeded.\x20Please\x20upload\x20a\x20smaller\x20file.'});case'AI_CHAT_FEED_LOADING_MESSAGE_REGULAR':return t({'id':'AI_CHAT_FEED_LOADING_MESSAGE_REGULAR','string':'AI\x20is\x20preparing\x20a\x20response...'});case'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH':return t({'id':'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH','string':'AI\x20is\x20searching\x20the\x20web\x20to\x20provide\x20the\x20most\x20accurate\x20answer...'});case'AI_CHAT_FEED_LOADING_MESSAGE_REASONING':return t({'id':'AI_CHAT_FEED_LOADING_MESSAGE_REASONING','string':'AI\x20is\x20using\x20reasoning\x20to\x20provide\x20the\x20most\x20accurate\x20answer...'});case'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH_REASONING':return t({'id':'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH_REASONING','string':'AI\x20is\x20using\x20reasoning\x20and\x20searching\x20the\x20web\x20to\x20provide\x20the\x20most\x20accurate\x20answer...'});case'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH':return t({'id':'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH','string':'Scanned\x20the\x20internet\x20for\x20insights'});case'AI_CHAT_FEED_REPLY_ITEM_USED_REASONING':return t({'id':'AI_CHAT_FEED_REPLY_ITEM_USED_REASONING','string':'AI\x20used\x20reasoning\x20to\x20improve\x20the\x20response'});case'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH_REASONING':return t({'id':'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH_REASONING','string':'AI\x20used\x20search\x20and\x20reasoning\x20to\x20improve\x20the\x20response'});case'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REGULAR':return t({'id':'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REGULAR','string':'Ask\x20AI\x20anything...'});case'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH':return t({'id':'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH','string':'Ask\x20AI\x20anything\x20(web\x20search\x20enabled)...'});case'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REASONING':return t({'id':'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REASONING','string':'Ask\x20AI\x20anything\x20(reasoning\x20enabled)...'});case'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH_REASONING':return t({'id':'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH_REASONING','string':'Ask\x20AI\x20anything\x20(web\x20search\x20and\x20reasoning\x20enabled)...'});case'AI_CHAT_SUGGESTION_ACTION_SUGGEST_ALL':return t({'id':'AI_CHAT_SUGGESTION_ACTION_SUGGEST_ALL','string':'Suggest\x20all'},_0x184d6f);case'AI_CHAT_SUGGESTION_ACTION_SUGGEST':return t({'id':'AI_CHAT_SUGGESTION_ACTION_SUGGEST','string':'Suggest'},_0x184d6f);case'AI_CHAT_SUGGESTION_ACTION_APPLY_ALL':return t({'id':'AI_CHAT_SUGGESTION_ACTION_APPLY_ALL','string':'Apply\x20all'});case'AI_CHAT_SUGGESTION_ACTION_APPLY':return t({'id':'AI_CHAT_SUGGESTION_ACTION_APPLY','string':'Apply'});case'AI_CHAT_SUGGESTION_MORE_OPTIONS_TOOLTIP':return t({'id':'AI_CHAT_SUGGESTION_MORE_OPTIONS_TOOLTIP','string':'More\x20options'},_0x184d6f);case'AI_CHAT_MODEL_SELECTOR_GROUP':return t({'id':'AI_CHAT_MODEL_SELECTOR_GROUP','string':'Models'});case'AI_CHAT_MODEL_SELECTOR_ENABLED_TOOLTIP':return t({'id':'AI_CHAT_MODEL_SELECTOR_ENABLED_TOOLTIP','string':'Select\x20a\x20model'});case'AI_CHAT_MODEL_SELECTOR_DISABLED_TOOLTIP':return t({'id':'AI_CHAT_MODEL_SELECTOR_DISABLED_TOOLTIP','string':'Start\x20a\x20new\x20conversation\x20to\x20change\x20the\x20model'});case'AI_CHAT_CAPABILITIES_YES':return t({'id':'AI_CHAT_CAPABILITIES_YES','string':'Yes'});case'AI_CHAT_CAPABILITIES_NO':return t({'id':'AI_CHAT_CAPABILITIES_NO','string':'No'});case'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_TEXT':return t({'id':'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_TEXT','string':'The\x20selected\x20model\x20is\x20no\x20longer\x20available,\x20so\x20you\x20cannot\x20continue\x20this\x20conversation.\x20Please\x20'});case'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_BUTTON':return t({'id':'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_BUTTON','string':'start\x20a\x20new\x20one.'});case'AI_CHAT_CONTEXT_SOURCES_LABEL':return t({'id':'AI_CHAT_CONTEXT_SOURCES_LABEL','string':'Sources'});case'AI_CHAT_HISTORY_HEADING':return t({'id':'AI_CHAT_HISTORY_HEADING','string':'Chat\x20History'});case'AI_CHAT_HISTORY_SEARCH_LABEL':return t({'id':'AI_CHAT_HISTORY_SEARCH_LABEL','string':'Search\x20history'});case'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_PRIMARY':return t({'id':'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_PRIMARY','string':'No\x20chats\x20were\x20found\x20matching\x20\x22%0\x22.'},_0x184d6f);case'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_SECONDARY':return t({'id':'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_SECONDARY','string':'Please\x20try\x20a\x20different\x20phrase\x20or\x20check\x20the\x20spelling.'});case'AI_CHAT_HISTORY_EMPTY_MESSAGE':return t({'id':'AI_CHAT_HISTORY_EMPTY_MESSAGE','string':'Your\x20chat\x20history\x20for\x20current\x20document\x20will\x20appear\x20here.'});case'AI_CHAT_HISTORY_GO_TO_CHAT_BUTTON':return t({'id':'AI_CHAT_HISTORY_GO_TO_CHAT_BUTTON','string':'Go\x20to\x20chat'});case'AI_CHAT_HISTORY_PIN_BUTTON':return t({'id':'AI_CHAT_HISTORY_PIN_BUTTON','string':'Pin'});case'AI_CHAT_HISTORY_SHOW_MORE_ITEMS':return t({'id':'AI_CHAT_HISTORY_SHOW_MORE_ITEMS','string':'Show\x20more\x20items'});case'AI_CHAT_HISTORY_EDIT_NAME':return t({'id':'AI_CHAT_HISTORY_EDIT_NAME','string':'Edit\x20name'});case'AI_CHAT_HISTORY_REMOVE':return t({'id':'AI_CHAT_HISTORY_REMOVE','string':'Remove'});case'AI_CHAT_HISTORY_REMOVE_CONFIRM':return t({'id':'AI_CHAT_HISTORY_REMOVE_CONFIRM','string':'Do\x20you\x20want\x20to\x20remove\x20this\x20chat?'});case'AI_CHAT_HISTORY_ACCEPT':return t({'id':'AI_CHAT_HISTORY_ACCEPT','string':'Accept'});case'AI_CHAT_HISTORY_CANCEL':return t({'id':'AI_CHAT_HISTORY_CANCEL','string':'Cancel'});case'AI_CHAT_HISTORY_LOADING_REMOVING':return t({'id':'AI_CHAT_HISTORY_LOADING_REMOVING','string':'Removing\x20the\x20chat...'});case'AI_CHAT_HISTORY_LOADING_RENAMING':return t({'id':'AI_CHAT_HISTORY_LOADING_RENAMING','string':'Renaming\x20the\x20chat...'});case'AI_CHAT_HISTORY_LOADING_PINNING':return t({'id':'AI_CHAT_HISTORY_LOADING_PINNING','string':'Pinning\x20the\x20chat...'});case'AI_CHAT_HISTORY_LOADING_UNPINNING':return t({'id':'AI_CHAT_HISTORY_LOADING_UNPINNING','string':'Unpinning\x20the\x20chat...'});case'AI_CHAT_HISTORY_CATEGORY_PINNED':return t({'id':'AI_CHAT_HISTORY_CATEGORY_PINNED','string':'Pinned'});case'AI_CHAT_HISTORY_CATEGORY_TODAY':return t({'id':'AI_CHAT_HISTORY_CATEGORY_TODAY','string':'Today'});case'AI_CHAT_HISTORY_CATEGORY_YESTERDAY':return t({'id':'AI_CHAT_HISTORY_CATEGORY_YESTERDAY','string':'Yesterday'});case'AI_CHAT_HISTORY_CATEGORY_LAST_14_DAYS':return t({'id':'AI_CHAT_HISTORY_CATEGORY_LAST_14_DAYS','string':'Last\x2014\x20days'});case'AI_CHAT_HISTORY_CATEGORY_LATER':return t({'id':'AI_CHAT_HISTORY_CATEGORY_LATER','string':'Later'});case'AI_CHAT_HISTORY_ERROR_UPDATE_TITLE':return t({'id':'AI_CHAT_HISTORY_ERROR_UPDATE_TITLE','string':'Failed\x20to\x20change\x20the\x20\x22%0\x22\x20chat\x20name.\x20Please\x20try\x20again\x20later.'},_0x184d6f);case'AI_CHAT_HISTORY_ERROR_UPDATE_PINNED':return t({'id':'AI_CHAT_HISTORY_ERROR_UPDATE_PINNED','string':'Failed\x20to\x20%0\x20the\x20\x22%1\x22\x20chat.\x20Please\x20try\x20again\x20later.'},_0x184d6f);case'AI_CHAT_HISTORY_ERROR_REMOVE_ITEM':return t({'id':'AI_CHAT_HISTORY_ERROR_REMOVE_ITEM','string':'Failed\x20to\x20delete\x20the\x20\x22%0\x22\x20chat.\x20Please\x20try\x20again\x20later.'},_0x184d6f);case'AI_CHAT_HISTORY_ERROR_LOAD_ITEMS':return t({'id':'AI_CHAT_HISTORY_ERROR_LOAD_ITEMS','string':'Failed\x20to\x20load\x20the\x20chat\x20history.\x20Please\x20try\x20again\x20later.'});case'AI_CHAT_HISTORY_ERROR_GENERIC':return t({'id':'AI_CHAT_HISTORY_ERROR_GENERIC','string':'Something\x20went\x20wrong.\x20Please\x20try\x20again\x20later.'});case'AI_CHAT_HISTORY_PIN_ACTION':return t({'id':'AI_CHAT_HISTORY_PIN_ACTION','string':'pin'});case'AI_CHAT_HISTORY_UNPIN_ACTION':return t({'id':'AI_CHAT_HISTORY_UNPIN_ACTION','string':'unpin'});case'AI_BALLOON_HEADER_TITLE':return t({'id':'AI_BALLOON_HEADER_TITLE','string':'Change\x20%0'},_0x184d6f);case'AI_BALLOON_APPLY_BUTTON':return t({'id':'AI_BALLOON_APPLY_BUTTON','string':'Apply'});case'AI_BALLOON_SUGGEST_BUTTON':return t({'id':'AI_BALLOON_SUGGEST_BUTTON','string':'Suggest'});case'AI_BALLOON_NEXT_LABEL':return t({'id':'AI_BALLOON_NEXT_LABEL','string':'Next'});case'AI_BALLOON_PREVIOUS_LABEL':return t({'id':'AI_BALLOON_PREVIOUS_LABEL','string':'Previous'});case'AI_SUGGESTION_NO_PARTS_WARNING':return t({'id':'AI_SUGGESTION_NO_PARTS_WARNING','string':'This\x20change\x20is\x20not\x20supported\x20by\x20the\x20editor\x20and\x20can\x27t\x20be\x20previewed\x20or\x20applied.'});case'AI_SUGGESTION_EMPTY_PART_WARNING':return t({'id':'AI_SUGGESTION_EMPTY_PART_WARNING','string':'Some\x20of\x20the\x20changes\x20are\x20not\x20supported\x20by\x20the\x20editor\x20and\x20can\x27t\x20be\x20previewed\x20or\x20applied.'});case'AI_ACTIONS_TRY_AGAIN':return t({'id':'AI_ACTIONS_TRY_AGAIN','string':'Retry'});case'AI_ACTIONS_PREVIOUS_INTERACTION':return t({'id':'AI_ACTIONS_PREVIOUS_INTERACTION','string':'Previous'});case'AI_ACTIONS_NEXT_INTERACTION':return t({'id':'AI_ACTIONS_NEXT_INTERACTION','string':'Next'});case'AI_MODEL_NAME_AUTO':return t({'id':'AI_MODEL_NAME_AUTO','string':'Auto'});case'AI_QUICK_ACTIONS_HEADING':return t({'id':'AI_QUICK_ACTIONS_HEADING','string':'AI\x20Quick\x20Actions'});case'AI_QUICK_ACTIONS_SEARCH':return t({'id':'AI_QUICK_ACTIONS_SEARCH','string':'Search\x20AI\x20commands'});case'AI_QUICK_ACTIONS_SEARCH_NOT_FOUND':return t({'id':'AI_QUICK_ACTIONS_SEARCH_NOT_FOUND','string':'No\x20AI\x20commands\x20found'});case'AI_QUICK_ACTIONS_ASK_AI':return t({'id':'AI_QUICK_ACTIONS_ASK_AI','string':'Ask\x20AI'});case'AI_QUICK_ACTIONS_CHAT_COMMANDS':return t({'id':'AI_QUICK_ACTIONS_CHAT_COMMANDS','string':'Chat\x20commands'});case'AI_QUICK_ACTIONS_IMPROVE_WRITING':return t({'id':'AI_QUICK_ACTIONS_IMPROVE_WRITING','string':'Improve\x20writing'});case'AI_QUICK_ACTIONS_CONTINUE_WRITING':return t({'id':'AI_QUICK_ACTIONS_CONTINUE_WRITING','string':'Continue\x20writing'});case'AI_QUICK_ACTIONS_FIX_GRAMMAR_SPELLING':return t({'id':'AI_QUICK_ACTIONS_FIX_GRAMMAR_SPELLING','string':'Fix\x20grammar\x20&\x20spelling'});case'AI_QUICK_ACTIONS_ADJUST_LENGTH':return t({'id':'AI_QUICK_ACTIONS_ADJUST_LENGTH','string':'Adjust\x20length'});case'AI_QUICK_ACTIONS_CHANGE_TONE':return t({'id':'AI_QUICK_ACTIONS_CHANGE_TONE','string':'Change\x20tone'});case'AI_QUICK_ACTIONS_TRANSLATE':return t({'id':'AI_QUICK_ACTIONS_TRANSLATE','string':'Translate'});case'AI_QUICK_ACTIONS_EXPLAIN':return t({'id':'AI_QUICK_ACTIONS_EXPLAIN','string':'Explain'});case'AI_QUICK_ACTIONS_SUMMARIZE':return t({'id':'AI_QUICK_ACTIONS_SUMMARIZE','string':'Summarize'});case'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS':return t({'id':'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS','string':'Highlight\x20key\x20points'});case'AI_QUICK_ACTIONS_MAKE_SHORTER':return t({'id':'AI_QUICK_ACTIONS_MAKE_SHORTER','string':'Make\x20shorter'});case'AI_QUICK_ACTIONS_MAKE_LONGER':return t({'id':'AI_QUICK_ACTIONS_MAKE_LONGER','string':'Make\x20longer'});case'AI_QUICK_ACTIONS_MORE_CASUAL':return t({'id':'AI_QUICK_ACTIONS_MORE_CASUAL','string':'More\x20casual'});case'AI_QUICK_ACTIONS_MORE_DIRECT':return t({'id':'AI_QUICK_ACTIONS_MORE_DIRECT','string':'More\x20direct'});case'AI_QUICK_ACTIONS_MORE_FRIENDLY':return t({'id':'AI_QUICK_ACTIONS_MORE_FRIENDLY','string':'More\x20friendly'});case'AI_QUICK_ACTIONS_MORE_CONFIDENT':return t({'id':'AI_QUICK_ACTIONS_MORE_CONFIDENT','string':'More\x20confident'});case'AI_QUICK_ACTIONS_MORE_PROFESSIONAL':return t({'id':'AI_QUICK_ACTIONS_MORE_PROFESSIONAL','string':'More\x20professional'});case'AI_QUICK_ACTIONS_ADJUST_BASED_ON_DOCUMENT':return t({'id':'AI_QUICK_ACTIONS_ADJUST_BASED_ON_DOCUMENT','string':'Adjust\x20based\x20on\x20the\x20rest\x20of\x20the\x20document'});case'AI_QUICK_ACTIONS_TRANSLATE_ENGLISH':return t({'id':'AI_QUICK_ACTIONS_TRANSLATE_ENGLISH','string':'English'});case'AI_QUICK_ACTIONS_TRANSLATE_CHINESE':return t({'id':'AI_QUICK_ACTIONS_TRANSLATE_CHINESE','string':'Chinese\x20(Simplified)'});case'AI_QUICK_ACTIONS_TRANSLATE_FRENCH':return t({'id':'AI_QUICK_ACTIONS_TRANSLATE_FRENCH','string':'French'});case'AI_QUICK_ACTIONS_TRANSLATE_JAPANESE':return t({'id':'AI_QUICK_ACTIONS_TRANSLATE_JAPANESE','string':'Japanese'});case'AI_QUICK_ACTIONS_TRANSLATE_PORTUGUESE':return t({'id':'AI_QUICK_ACTIONS_TRANSLATE_PORTUGUESE','string':'Portuguese'});case'AI_QUICK_ACTIONS_TRANSLATE_KOREAN':return t({'id':'AI_QUICK_ACTIONS_TRANSLATE_KOREAN','string':'Korean'});case'AI_QUICK_ACTIONS_TRANSLATE_ITALIAN':return t({'id':'AI_QUICK_ACTIONS_TRANSLATE_ITALIAN','string':'Italian'});case'AI_QUICK_ACTIONS_TRANSLATE_RUSSIAN':return t({'id':'AI_QUICK_ACTIONS_TRANSLATE_RUSSIAN','string':'Russian'});case'AI_QUICK_ACTIONS_TRANSLATE_SPANISH':return t({'id':'AI_QUICK_ACTIONS_TRANSLATE_SPANISH','string':'Spanish'});case'AI_QUICK_ACTIONS_TRANSLATE_GERMAN':return t({'id':'AI_QUICK_ACTIONS_TRANSLATE_GERMAN','string':'German'});case'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND':return t({'id':'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND','string':'%0\x20plugin\x20is\x20required\x20but\x20not\x20found.'},_0x184d6f);case'AI_QUICK_ACTIONS_OTHER':return t({'id':'AI_QUICK_ACTIONS_OTHER','string':'Other'});case'AI_ACTIONS_GENERIC_ERROR':return t({'id':'AI_ACTIONS_GENERIC_ERROR','string':'Sorry,\x20we\x20couldn\x27t\x20generate\x20the\x20response.\x20Please\x20try\x20again\x20in\x20a\x20moment.'});case'AI_BALLOON_SELECTION_REMOVED_ERROR':return t({'id':'AI_BALLOON_SELECTION_REMOVED_ERROR','string':'Changes\x20cannot\x20be\x20applied.\x20The\x20original\x20content\x20no\x20longer\x20exists.'});case'AI_REVIEW_MODE_STOP_GENERATING':return t({'id':'AI_REVIEW_MODE_STOP_GENERATING','string':'Stop\x20generating'});case'AI_REVIEW_MODE_HIDE_CHANGES':return t({'id':'AI_REVIEW_MODE_HIDE_CHANGES','string':'Hide\x20changes'});case'AI_REVIEW_MODE_SHOW_CHANGES':return t({'id':'AI_REVIEW_MODE_SHOW_CHANGES','string':'Show\x20changes'});case'AI_REVIEW_MODE_ACCEPT_ALL':return t({'id':'AI_REVIEW_MODE_ACCEPT_ALL','string':'Accept\x20all'});case'AI_REVIEW_MODE_EXIT_REVIEW':return t({'id':'AI_REVIEW_MODE_EXIT_REVIEW','string':'Exit\x20review'});case'AI_REVIEW_MODE_ACCEPT_CHANGE':return t({'id':'AI_REVIEW_MODE_ACCEPT_CHANGE','string':'Accept'});case'AI_REVIEW_MODE_DISMISS_CHANGE':return t({'id':'AI_REVIEW_MODE_DISMISS_CHANGE','string':'Dismiss'});case'AI_REVIEW_MODE_LEARN_MORE':return t({'id':'AI_REVIEW_MODE_LEARN_MORE','string':'Learn\x20more'});case'AI_REVIEW_MODE_COMPLETED_TEXT':return t({'id':'AI_REVIEW_MODE_COMPLETED_TEXT','string':'There\x27s\x20nothing\x20left\x20to\x20review.'});case'AI_REVIEW_MODE_EMPTY_RESULTS_TEXT':return t({'id':'AI_REVIEW_MODE_EMPTY_RESULTS_TEXT','string':'There\x20are\x20no\x20changes\x20to\x20suggest.'});case'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL':return t({'id':'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL','string':'Finish\x20Review'});case'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE':return t({'id':'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE','string':'Review\x20complete.\x20Finish\x20when\x20ready.'});case'AI_REVIEW_INITIALIZATION_ERROR_MESSAGE':return t({'id':'AI_REVIEW_INITIALIZATION_ERROR_MESSAGE','string':'AI\x20Review\x20initialized\x20with\x20errors.\x20Some\x20features\x20may\x20not\x20be\x20available\x20or\x20work\x20properly.'});case'AI_REVIEW_MODE_GENERAL_ERROR_MESSAGE':return t({'id':'AI_REVIEW_MODE_GENERAL_ERROR_MESSAGE','string':'Sorry,\x20we\x20couldn\x27t\x20generate\x20the\x20whole\x20review\x20properly.\x20Please\x20try\x20again\x20in\x20a\x20moment.'});case'AI_REVIEW_MODE_CHUNK_ERROR_MESSAGE':return t({'id':'AI_REVIEW_MODE_CHUNK_ERROR_MESSAGE','string':'Not\x20everything\x20went\x20through,\x20but\x20the\x20completed\x20items\x20are\x20listed\x20below.'});case'AI_REVIEW_MODE':return t({'id':'AI_REVIEW_MODE','string':'Review'});case'AI_REVIEW_MODE_PROMPT_EMPTY_ERROR':return t({'id':'AI_REVIEW_MODE_PROMPT_EMPTY_ERROR','string':'Prompt\x20must\x20not\x20be\x20empty'});case'AI_REVIEW_CHECK_CUSTOM_TITLE':return t({'id':'AI_REVIEW_CHECK_CUSTOM_TITLE','string':'Custom\x20command'});case'AI_REVIEW_CHECK_CUSTOM_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_CUSTOM_DESCRIPTION','string':'Enter\x20a\x20custom\x20command\x20for\x20a\x20specific\x20review.'});case'AI_REVIEW_CHECK_CORRECTNESS_TITLE':return t({'id':'AI_REVIEW_CHECK_CORRECTNESS_TITLE','string':'Proofread'});case'AI_REVIEW_CHECK_CORRECTNESS_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_CORRECTNESS_DESCRIPTION','string':'Check\x20the\x20text\x20for\x20errors\x20in\x20grammar,\x20spelling,\x20and\x20punctuation.'});case'AI_REVIEW_CHECK_CLARITY_TITLE':return t({'id':'AI_REVIEW_CHECK_CLARITY_TITLE','string':'Improve\x20clarity'});case'AI_REVIEW_CHECK_CLARITY_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_CLARITY_DESCRIPTION','string':'Improve\x20the\x20logical\x20structure\x20and\x20precision\x20for\x20clearer\x20message.'});case'AI_REVIEW_CHECK_READABILITY_TITLE':return t({'id':'AI_REVIEW_CHECK_READABILITY_TITLE','string':'Improve\x20readability'});case'AI_REVIEW_CHECK_READABILITY_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_READABILITY_DESCRIPTION','string':'Adjust\x20sentence\x20structure\x20and\x20word\x20choice\x20for\x20an\x20easier\x20read.'});case'AI_REVIEW_CHECK_MAKE_TITLE':return t({'id':'AI_REVIEW_CHECK_MAKE_TITLE','string':'Adjust\x20length'});case'AI_REVIEW_CHECK_MAKE_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_MAKE_DESCRIPTION','string':'Shorten\x20or\x20lengthen\x20the\x20text\x20as\x20needed.'});case'AI_REVIEW_CHECK_MAKE_OPTIONS_LABEL':return t({'id':'AI_REVIEW_CHECK_MAKE_OPTIONS_LABEL','string':'Adjust\x20length'});case'AI_REVIEW_CHECK_MAKE_OPTIONS_DATA_LONGER':return t({'id':'AI_REVIEW_CHECK_MAKE_OPTIONS_DATA_LONGER','string':'Longer'});case'AI_REVIEW_CHECK_MAKE_OPTIONS_DATA_SHORTER':return t({'id':'AI_REVIEW_CHECK_MAKE_OPTIONS_DATA_SHORTER','string':'Shorter'});case'AI_REVIEW_CHECK_MAKE_TONE_TITLE':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_TITLE','string':'Adjust\x20tone\x20and\x20style'});case'AI_REVIEW_CHECK_MAKE_TONE_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_DESCRIPTION','string':'Modify\x20the\x20text\x20to\x20a\x20desired\x20tone\x20and\x20style.'});case'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_LABEL':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_LABEL','string':'Adjust\x20tone\x20and\x20style'});case'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_CASUAL':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_CASUAL','string':'Casual'});case'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_DIRECT':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_DIRECT','string':'Direct'});case'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_FRIENDLY':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_FRIENDLY','string':'Friendly'});case'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_CONFIDENT':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_CONFIDENT','string':'Confident'});case'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_PROFESSIONAL':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_PROFESSIONAL','string':'Professional'});case'AI_REVIEW_CHECK_TRANSLATE_TITLE':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_TITLE','string':'Translate'});case'AI_REVIEW_CHECK_TRANSLATE_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_DESCRIPTION','string':'Translate\x20the\x20text\x20into\x20another\x20language.'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_LABEL':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_LABEL','string':'Select\x20language'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_ENGLISH':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_ENGLISH','string':'English'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_SPANISH':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_SPANISH','string':'Spanish'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_FRENCH':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_FRENCH','string':'French'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_GERMAN':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_GERMAN','string':'German'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_CHINESE':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_CHINESE','string':'Chinese\x20(Simplified)'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_JAPANESE':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_JAPANESE','string':'Japanese'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_RUSSIAN':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_RUSSIAN','string':'Russian'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_PORTUGUESE':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_PORTUGUESE','string':'Portuguese'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_KOREAN':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_KOREAN','string':'Korean'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_ITALIAN':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_ITALIAN','string':'Italian'});case'AI_REVIEW_MODE_CHECK_STATUS_ACCEPTED':return t({'id':'AI_REVIEW_MODE_CHECK_STATUS_ACCEPTED','string':'Accepted'});case'AI_REVIEW_MODE_CHECK_STATUS_REJECTED':return t({'id':'AI_REVIEW_MODE_CHECK_STATUS_REJECTED','string':'Dismissed'});case'AI_REVIEW_MODE_CHECK_STATUS_OUTDATED':return t({'id':'AI_REVIEW_MODE_CHECK_STATUS_OUTDATED','string':'Outdated'});case'AI_TOGGLE_BUTTON_LABEL':return t({'id':'AI_TOGGLE_BUTTON_LABEL','string':'AI'});case'AI_TRANSLATE_ACCEPT_ALL':return t({'id':'AI_TRANSLATE_ACCEPT_ALL','string':'Accept\x20translation'});case'AI_TRANSLATE_FINISH_HEADER_TITLE':return t({'id':'AI_TRANSLATE_FINISH_HEADER_TITLE','string':'Translation\x20complete.\x20Finish\x20when\x20ready.'});case'AI_TRANSLATE_EMPTY_RESULTS_TEXT':return t({'id':'AI_TRANSLATE_EMPTY_RESULTS_TEXT','string':'There\x20are\x20no\x20translations\x20to\x20review.'});case'AI_TRANSLATE_FINISH_BUTTON_LABEL':return t({'id':'AI_TRANSLATE_FINISH_BUTTON_LABEL','string':'Finish\x20Translation'});case'AI_TRANSLATE_CHECK_LIST_HEADER_TITLE':return t({'id':'AI_TRANSLATE_CHECK_LIST_HEADER_TITLE','string':'Content\x20Translation'});case'AI_TRANSLATE_CHECK_LIST_HEADER_DESCRIPTION':return t({'id':'AI_TRANSLATE_CHECK_LIST_HEADER_DESCRIPTION','string':'A\x20dedicated\x20mode\x20for\x20translating\x20the\x20entire\x20text.'});case'AI_TRANSLATE_CHECK_RESULTS_LOADING_TITLE':return t({'id':'AI_TRANSLATE_CHECK_RESULTS_LOADING_TITLE','string':'Translating\x20to'});case'AI_TRANSLATE_CHECK_RESULTS_READY_TITLE':return t({'id':'AI_TRANSLATE_CHECK_RESULTS_READY_TITLE','string':'Translated\x20to'});case'AI_TRANSLATE_GENERAL_ERROR_MESSAGE':return t({'id':'AI_TRANSLATE_GENERAL_ERROR_MESSAGE','string':'Sorry,\x20we\x20couldn\x27t\x20generate\x20translations\x20properly.\x20Please\x20try\x20again\x20in\x20a\x20moment.'});default:return _0x5c3b33;}}const ms=/* #__PURE__ -- @preserve */
25
+ dt();var Ts=class extends ms{_connector;['_config'];['_locale'];_modelList=[];_modelsRequest=null;constructor({connector:_0x1a1525,config:_0x461396,locale:_0x4dfd0d}){super(),this['_connector']=_0x1a1525,this['_config']=_0x461396,this['_locale']=_0x4dfd0d;}get['_availableModels'](){return this['_config']?.['displayedModels'];}get _defaultModelId(){return this['_config']?.['defaultModelId'];}async getAllModels(){return this['_modelsRequest']||(this['_modelsRequest']=this['_retrieveModels']()['catch'](_0x384bac=>{throw this['_modelsRequest']=null,_0x384bac;})),this['_modelsRequest'];}async getAvailableModels(){const _0x52bd5f=await this['getAllModels']();let _0x57ac3f;return _0x57ac3f=this['_availableModels']?this['_filterModels'](_0x52bd5f,this['_availableModels']):_0x52bd5f['filter'](_0x24f1f9=>_0x24f1f9['recommended']),_0x57ac3f;}async['resolveModel'](_0x181a3f){const _0x2696c8=await this['getAllModels']();if(!_0x2696c8['length'])return null;if(_0x181a3f){const _0x418ac7=this['_getModelById'](_0x2696c8,_0x181a3f);if(_0x418ac7)return _0x418ac7;St('ai-chat-model-id-unrecognized',{'modelId':_0x181a3f,'fallBackModelId':this['_defaultModelId']});}return this['getDefault']();}async getDefault(){const _0x13a215=await this['getAvailableModels']();if(!_0x13a215['length'])return null;if(this['_defaultModelId']){const _0x590652=this['_getModelById'](_0x13a215,this['_defaultModelId']);if(_0x590652)return _0x590652;St('ai-chat-default-model-id-unrecognized',{'defaultModelId':this['_defaultModelId'],'fallBackModelId':_0x13a215[0x0]['id']});}return _0x13a215[0x0];}async['isAvailable'](_0x1e2b58){return(await this['getAvailableModels']())['some'](_0x360627=>_0x360627['name']===_0x1e2b58['name']&&_0x360627['provider']===_0x1e2b58['provider']);}async getModel(_0x37f311){const _0x3ccd4c=await this['getAllModels']();return this['_getModelById'](_0x3ccd4c,_0x37f311)||null;}async _retrieveModels(){if(!this['_modelList']['length']){const _0x229b6a=this['_locale']['uiLanguage']||'en',_0x28555d=await this['_connector']['getModels'](_0x229b6a)['list']();this['_modelList']=_0x28555d['items']['map'](_0x3aff52=>ws(_0x3aff52)?{..._0x3aff52,'name':Es(this['_locale'],'AI_MODEL_NAME_AUTO')}:_0x3aff52);}return[...this['_modelList']];}_filterModels(_0x42e510,_0x576443){let _0x5cc0fb;if(_0x576443){_0x5cc0fb=[];const _0x2af6b5=new Set(),_0x2d45c3='string'==typeof _0x576443?[_0x576443['toLocaleLowerCase']()]:_0x576443['map'](_0x5c2f33=>_0x5c2f33['toLocaleLowerCase']());for(const _0x3ce16c of _0x2d45c3)for(const _0x550f4b of _0x42e510)!_0x2af6b5['has'](_0x550f4b['id'])&&this['_isMatchingFilter'](_0x550f4b,_0x3ce16c)&&(_0x5cc0fb['push'](_0x550f4b),_0x2af6b5['add'](_0x550f4b['id']));}else _0x5cc0fb=_0x42e510;return _0x5cc0fb;}_isMatchingFilter(_0x50e700,_0x40e2eb){const _0x2f5bd5=_0x50e700['id']['toLocaleLowerCase'](),_0x4cb4e4=_0x50e700['name']['toLocaleLowerCase'](),_0x59f32a=_0x50e700['provider']['toLocaleLowerCase']();return _0x2f5bd5===_0x40e2eb||_0x4cb4e4===_0x40e2eb||ws(_0x50e700)&&'auto'===_0x40e2eb||_0x59f32a===_0x40e2eb||_0x2f5bd5['startsWith'](_0x40e2eb);}_getModelById(_0x542f90,_0x366796){return _0x542f90['find'](_0x23f3de=>ws(_0x23f3de)&&'auto'===_0x366796?_0x23f3de:_0x23f3de['id']===_0x366796)||null;}};function ws(_0x13444a){return _0x13444a['id']['startsWith']('agent');}var Cs=class{_connector;_defaultContext;_contextsRequest=null;constructor({connector:_0x74f9a1,defaultContext:_0x360eee}){this['_connector']=_0x74f9a1,this['_defaultContext']=_0x360eee;}async getAllContexts(){return this['_contextsRequest']||(this['_contextsRequest']=this['_connector']['listContexts']()['getContexts']()['catch'](_0x22d5f3=>{throw this['_contextsRequest']=null,_0x22d5f3;})),[...await this['_contextsRequest']];}async getAvailableContexts(){const _0x1e6371=await this['getAllContexts'](),_0x2db270=new Set((this['_defaultContext']??[])['map'](_0x4d979b=>_0x4d979b['id']));return _0x1e6371['filter'](_0x1beb36=>!_0x2db270['has'](_0x1beb36['id']));}resolveContext({feature:_0x4aecc5,ids:_0x2c1b52=[],extraContexts:_0x1a46b1=[],idScopedOnly:_0x5081af=!0x1,context:_0x206508}){const _0x74f8bb=this['_resolveDefaultContext'](_0x4aecc5,_0x2c1b52,_0x5081af);return _0x206508['addDefaultContext']([..._0x74f8bb,..._0x1a46b1]),_0x206508;}_resolveDefaultContext(_0x467d9f,_0x36a78a,_0x575741=!0x1){if(!this['_defaultContext'])return[];const _0x44c7a7=[];for(const _0x4b775e of this['_defaultContext'])this['_entryAppliesToFeature'](_0x4b775e['features'],_0x467d9f,_0x36a78a)&&(_0x575741&&this['_entryAppliesToFeature'](_0x4b775e['features'],_0x467d9f,[])||_0x44c7a7['push'](this['_toContextRef'](_0x4b775e)));return _0x44c7a7;}_toContextRef(_0x77bcd){return'promptId'in _0x77bcd?{'id':_0x77bcd['id'],'promptId':_0x77bcd['promptId']}:'fileId'in _0x77bcd?{'id':_0x77bcd['id'],'fileId':_0x77bcd['fileId']}:{'id':_0x77bcd['id']};}_entryAppliesToFeature(_0x5cde00,_0x114565,_0x4ea861){if(!_0x5cde00)return!0x0;const _0x2d4c47=_0x5cde00[_0x114565];return!!_0x2d4c47&&(!0x0===_0x2d4c47||_0x4ea861['some'](_0x41fa8a=>_0x2d4c47['test'](_0x41fa8a)));}},fs=class extends _0x212144{['models'];contextLibrary;static get['pluginName'](){return'AICore';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}static get requires(){return[Is];}init(){const _0x416718=this['context']['plugins']['get'](Is);this['models']=new Ts({'connector':_0x416718,'config':this['context']['config']['get']('ai.models'),'locale':this['context']['locale']}),this['contextLibrary']=new Cs({'connector':_0x416718,'defaultContext':this['context']['config']['get']('ai.defaultContext')});}};function bs(_0x3d70db){return _0x3d70db?_0x3d70db instanceof _0x2a0bfb?[_0x3d70db]:_0x3d70db['editors']&&0x0!==_0x3d70db['editors']['length']?Array['from'](_0x3d70db['editors']):[]:[];}function Ss(_0x21b2a4){const _0x4c7e27=bs(_0x21b2a4);if(!_0x4c7e27['length'])throw new ct('ai-get-editor-from-context-no-editor');if(0x1===_0x4c7e27['length'])return _0x4c7e27[0x0];const _0xbeede9=_0x4c7e27['find'](_0x2a67c9=>_0x2a67c9['ui']?.['focusTracker']?.['isFocused']);if(_0xbeede9)return _0xbeede9;const _0x50f94a=function(_0x193c24){if(_0x193c24 instanceof _0x2a0bfb)return;const _0x43bd3b=_0x193c24;if(!_0x43bd3b['plugins']||!_0x43bd3b['plugins']['has']('AIEditing'))return;return _0x43bd3b['plugins']['get']('AIEditing')['getLastContentFocusedEditor']?.();}(_0x21b2a4);return _0x50f94a&&_0x4c7e27['includes'](_0x50f94a)?_0x50f94a:_0x4c7e27[0x0];}function Rs(_0x15a2b0,_0x24a926){return _0x5bea4e(_0x15a2b0,_0x24a926);}function Os(_0x3c37c2,_0x1e8c8a){return _0x3a1450(_0x3c37c2,_0x1e8c8a);}function vs(_0x5485ac,_0x49c642,_0x30c71b){const _0x26a5b8=null!==_0x49c642?_0x59adb3=>_0x59adb3['attribs'][_0x5485ac]===_0x49c642:_0x210c91=>Boolean(_0x210c91['attribs'][_0x5485ac]);return _0xdb5da(_0x3c408e=>_0x438723(_0x3c408e)&&_0x26a5b8(_0x3c408e),_0x30c71b);}function ks(_0x1cf2ef,_0x2b2c82,_0x57de07){const _0x4962ef=null!==_0x2b2c82?_0x212dc0=>_0x212dc0['attribs'][_0x1cf2ef]===_0x2b2c82:_0x1a53c6=>Boolean(_0x1a53c6['attribs'][_0x1cf2ef]);return _0x26a2ae(_0x442037=>_0x438723(_0x442037)&&_0x4962ef(_0x442037),_0x57de07);}function ys(_0x297ade){return _0x26a2ae(_0x56da54=>_0x438723(_0x56da54)&&function(_0x89fcaf){const _0xa7b5b6=_0x89fcaf['toLowerCase']();return'script'===_0xa7b5b6||'style'===_0xa7b5b6||_0xa7b5b6['includes']('-');}(_0x56da54['name']),_0x297ade);}const Ns=['comment-start','comment-end','suggestion-start','suggestion-end'];function xs(_0x1cbbb2){return _0x438723(_0x1cbbb2)&&Ns['includes'](_0x1cbbb2['name']['toLowerCase']());}function Ls(_0x5240fb){return _0x3932c0(_0x5be922=>_0x36dce3(_0x5be922),_0x5240fb,!0x0,0x1/0x0);}function Ps(_0x4a1c3d,_0x4e5e1d){return _0x4a1c3d&&_0x438723(_0x4a1c3d)?_0x4a1c3d['attribs'][_0x4e5e1d]:null;}function Ds(_0x1941c5,_0x5c4fb4,_0x4f1769){_0x438723(_0x1941c5)&&(null===_0x4f1769?delete _0x1941c5['attribs'][_0x5c4fb4]:_0x1941c5['attribs'][_0x5c4fb4]=_0x4f1769);}function Hs(_0x17c437,_0x41e775,_0x457c85){const _0x188f8b=_0x41e775['cloneNode'](!0x0);'beforebegin'===_0x457c85?ti(_0x17c437,_0x188f8b):'afterbegin'===_0x457c85?_0xf08298(_0x17c437,_0x188f8b):'beforeend'===_0x457c85?_0x2cdc39(_0x17c437,_0x188f8b):'afterend'===_0x457c85&&_0x10069f(_0x17c437,_0x188f8b);}function Ms(_0x503abc){const _0x4d2a73=[];let _0xe1ee9e=_0x503abc;for(;_0xe1ee9e;)_0xe1ee9e=_0x1f37eb(_0xe1ee9e),_0xe1ee9e&&_0x4d2a73['push'](_0xe1ee9e);return _0x4d2a73;}function Us(_0x3e79ce){return _0x3e79ce['replace'](/^\s+/gm,'')['replace'](/\s+$/gm,'')['replace'](/\n*/g,'')['replace'](/\s+/g,'\x20')['replace'](/>\s*</g,'><');}function Vs(_0x172469){let _0x4a6f3b=0x0;for(;_0x172469['parentNode'];)_0x172469=_0x172469['parentNode'],_0x4a6f3b++;return _0x4a6f3b;}function Bs(_0x21ffa9){const _0x2904d7=[];let _0x1ef932=_0x21ffa9['nextSibling'];for(;_0x1ef932;)_0x2904d7['push'](_0x1ef932),_0x1ef932=_0x1ef932['nextSibling'];_0x2904d7['forEach'](_0x21cd6f=>{_0x4ebff9(_0x21cd6f);});}function Gs(_0x51597d,_0x11431d){return!!_0x51597d['model']['document']['getRoot'](_0x11431d)&&!_0x1dc860(_0x51597d,_0x11431d);}function Fs(_0x531b70,_0x497115){return'<p\x20data-id=\x22'+_0x497115+'\x22>'+_0x531b70+'</p>';}function Ks(_0x208bd0){return'p'===_0x208bd0['name']['toLowerCase']()&&Boolean(_0x208bd0['attribs']['data-id']);}function Ws(_0x12f191){const _0x4814eb=Rs(_0x12f191)['children']['filter'](_0x438723);return 0x1===_0x4814eb['length']&&Ks(_0x4814eb[0x0])?_0x4814eb[0x0]['children']['map'](_0x588154=>Os(_0x588154))['join'](''):_0x12f191;}function Ys(_0xfa2be7,_0x5d6ab7){const _0x464f88=function(_0x288253){const _0x10a29e=_0x288253['children']['filter'](_0x438723);return 0x1===_0x10a29e['length']&&Ks(_0x10a29e[0x0])?_0x10a29e[0x0]['children']:_0x288253['children'];}(_0x5d6ab7),{blockElements:_0x5b189e}=_0xfa2be7['editing']['view']['domConverter'],_0x431fa3=_0x1298aa=>_0x1298aa['some'](_0x230e35=>_0x438723(_0x230e35)&&('p'!==_0x230e35['name']['toLowerCase']()&&_0x5b189e['includes'](_0x230e35['name']['toLowerCase']())||_0x431fa3(_0x230e35['children'])));if(_0x431fa3(_0x464f88))return!0x1;const _0x5ac49d=_0x464f88['map'](_0x403dfa=>Os(_0x403dfa))['join'](''),_0x292aad=_0xfa2be7['data']['parse'](_0x5ac49d,'$root'),{schema:_0x786aae}=_0xfa2be7['model'];let _0x2edec7=0x0;for(const {item:_0x39bfef}of _0xfa2be7['model']['createRangeIn'](_0x292aad))if(_0x39bfef['is']('element')&&_0x786aae['isBlock'](_0x39bfef)&&(++_0x2edec7>0x1||'paragraph'!==_0x39bfef['name']))return!0x1;return!0x0;}function $s(_0x3fab1b,_0xe6535f){const _0x593d5b=_0xe6535f['filter'](_0x45a2ec=>'new'!=_0x45a2ec['type'])['map'](_0x28f83c=>vs('data-id',_0x28f83c['id'],_0x3fab1b))['filter'](_0x24d23d=>null!==_0x24d23d),_0x48467e=_0xe6535f['filter'](_0x5aecbb=>'removed'!=_0x5aecbb['type'])['map'](_0x47106d=>_0x47106d['node']['cloneNode'](!0x0));let _0x38570a=null;if(_0x593d5b['length']){_0x38570a=_0x593d5b[0x0]['previousSibling'];for(let _0x44b773=0x0;_0x44b773<_0x593d5b['length'];_0x44b773++)_0x4ebff9(_0x593d5b[_0x44b773]);}if(_0x48467e['length']){_0x38570a||(_0xe6535f[0x0]['anchorId']?_0x38570a=vs('data-id',_0xe6535f[0x0]['anchorId'],_0x3fab1b):(_0x38570a=_0x48467e['shift'](),_0xf08298(_0x3fab1b,_0x38570a)));for(let _0x37bae0=0x0;_0x37bae0<_0x48467e['length'];_0x37bae0++)_0x10069f(_0x38570a,_0x48467e[_0x37bae0]),_0x38570a=_0x48467e[_0x37bae0];}}function qs(_0x23e80c,_0x1caa0b){const _0x164c9a=new Set();for(const _0x36aba3 of _0x23e80c){if(!_0x36aba3['editor']||'destroyed'===_0x36aba3['editor']['state']||!Gs(_0x36aba3['editor'],_0x36aba3['rootName']))continue;const _0x49461e=_0x1caa0b['get'](_0x36aba3['documentId']);let _0x456346;_0x49461e?(_0x456346=_0x49461e['cloneNode'](!0x0),$s(_0x456346,_0x36aba3['changes'])):_0x456346=new _0x35605c(_0x36aba3['changes']['filter'](_0x3006bf=>'removed'!=_0x3006bf['type'])['map'](_0x4c659a=>_0x4c659a['node']['cloneNode'](!0x0))),Ys(_0x36aba3['editor'],_0x456346)||_0x164c9a['add'](_0x36aba3['index']);}return _0x164c9a;}function Qs(_0xfe17ab,_0x1009ff,_0x1a0ece,_0x1d4f38){return Gs(_0xfe17ab,_0x1009ff)?Ys(_0xfe17ab,Rs(_0x1d4f38))?{'before':Ws(_0x1a0ece),'after':Ws(_0x1d4f38)}:null:{'before':_0x1a0ece,'after':_0x1d4f38};}function Xs(_0x229637,_0x17908d){return _0x5a008a(_0x229637,_0x17908d);}function zs(_0x18c0dc,_0x59ae63){return _0x18c0dc['map'](_0x592e83=>null!==_0x592e83&&'object'==typeof _0x592e83?Xs(_0x592e83,_0x59ae63):_0x592e83);}const js=[['BlockQuoteEditing','blockQuote'],['BoldEditing','bold'],['BookmarkEditing','bookmark'],['CodeEditing','code'],['HorizontalLineEditing','horizontalLine'],['HtmlEmbedEditing','htmlEmbed'],['ItalicEditing','italic'],['MathType','math'],['PageBreakEditing','pageBreak'],['Paragraph','paragraph'],['StandardEditingModeEditing','restrictedEditing'],['StrikethroughEditing','strikethrough'],['SubscriptEditing','subscript'],['SuperscriptEditing','superscript'],['TableOfContentsEditing','tableOfContents'],['Title','title'],['TodoListEditing','todoList'],['UnderlineEditing','underline']],Js='ai-selection',Zs=['br'];var tn=class extends _0x212144{constructor(_0x1410b1){super(_0x1410b1),this['context']['config']['define']('ai.models.showModelSelector',!0x0);}_outputDataProcessor;_fakeSelections=[];_sessionIdByEditor=new WeakMap();_editorsToConfigs=new WeakMap();_lastContentFocusedEditor;static get['pluginName'](){return'AIEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}getLastContentFocusedEditor(){return this['_lastContentFocusedEditor'];}getSessionId(_0x344a68){let _0x1e2eb2=this['_sessionIdByEditor']['get'](_0x344a68);return _0x1e2eb2||(_0x1e2eb2=_0x344a68['plugins']['has']('RealTimeCollaborationClient')&&_0x344a68['plugins']['get']('RealTimeCollaborationClient')['sessionId']||kt(),this['_sessionIdByEditor']['set'](_0x344a68,_0x1e2eb2)),_0x1e2eb2;}async getDocumentData(_0x146636){const _0x47fc7d=bs(this['context']),_0x1847ab=[],_0x51e793=new Set();for(const _0x411e57 of _0x47fc7d){if(_0x146636&&!_0x146636['has'](_0x411e57['config']['get']('collaboration.channelId')))continue;const _0x42720b=_0x411e57['config']['get']('roots')||{},_0x53644f=this['_getEditorSelectionSignature'](_0x411e57),_0x1b5897=_0x411e57['config']['get']('collaboration.channelId'),_0x41d06f=this['getSessionId'](_0x411e57);for(const _0x3b7fcc of _0x411e57['model']['document']['getRoots']()){if('$graveyard'===_0x3b7fcc['rootName'])continue;const _0x1f2f43=await this['_getDocumentDataForEditorRoot'](_0x411e57,_0x3b7fcc,_0x51e793),_0x2603c2=_0x42720b[_0x3b7fcc['rootName']],_0x4e1b21=_0x3b7fcc['getAttribute']('$description')??_0x2603c2?.['description'];let _0x515b38=_0x3b7fcc['getAttribute']('$title')??_0x2603c2?.['title'];_0x515b38||(_0x515b38=_0x3b7fcc['getAttribute']('$rootEditableOptions')?.['label']??_0x2603c2?.['label']),_0x515b38||(St('ai-document-root-missing-title',{'editor':_0x411e57,'rootName':_0x3b7fcc['rootName']}),_0x515b38=_0x3b7fcc['rootName']),_0x1847ab['push']({'editor':_0x411e57,'rootName':_0x3b7fcc['rootName'],'content':_0x1f2f43['content'],'version':_0x1f2f43['version'],'sessionId':_0x41d06f,'channelId':_0x1b5897,'selections':_0x1f2f43['selections'],'selectionSignature':_0x53644f,'editorConfig':this['_getEditorConfig'](_0x411e57),'name':_0x515b38,'description':_0x4e1b21});}}return _0x1847ab;}getEditorsVersions(){const _0x2219b8=bs(this['context']),_0x877356=new Map();for(const _0x400281 of _0x2219b8){const _0x2ba515=_0x400281['config']['get']('collaboration.channelId');_0x877356['set'](_0x2ba515,_0x400281['model']['document']['version']);}return _0x877356;}getEditorsSelections(){const _0x486422=bs(this['context']),_0x2527e6=new Map();for(const _0x1c919e of _0x486422){const _0x475481=_0x1c919e['config']['get']('collaboration.channelId'),_0x57c761=this['_getEditorSelectionSignature'](_0x1c919e);_0x2527e6['set'](_0x475481,_0x57c761);}return _0x2527e6;}_getEditorSelectionSignature(_0xd0a7f8){return this['_getMarkersInDocumentOrder'](_0xd0a7f8)['map'](_0x567c82=>{const _0x175785=_0x567c82['getRange']();return _0x175785['root']['rootName']+':'+_0x175785['start']['path']['join']('.')+'-'+_0x175785['end']['path']['join']('.');})['join']('|');}async _getDocumentDataForEditorRoot(_0x34f10f,_0x3499c2,_0x5f0acb){const _0x19e124=_0x34f10f['data']['toView'](_0x3499c2,{'convertAiChatSelectionMarker':!0x0}),_0x372939=new _0x24fafe(_0x34f10f['editing']['view']['document']);this['_setDataIdsOnChildren'](_0x19e124,_0x372939,_0x5f0acb);let _0x1a2f8d=await this['_getDocumentDataStringFromView'](_0x19e124,_0x34f10f);Gs(_0x34f10f,_0x3499c2['rootName'])&&(_0x1a2f8d=Fs(_0x1a2f8d,this['_nextDataId'](_0x5f0acb)));const _0x2d1d6b=this['_getMarkersInDocumentOrder'](_0x34f10f,_0x3499c2),_0x835ee8=[];for(const _0xda4fa of _0x2d1d6b){const _0x1f2767='<'+_0xda4fa['name']+':start></'+_0xda4fa['name']+':start>',_0x42c05a=_0x1a2f8d['indexOf'](_0x1f2767);_0x1a2f8d=_0x1a2f8d['substring'](0x0,_0x42c05a)+_0x1a2f8d['substring'](_0x42c05a+_0x1f2767['length']);const _0x457a64='<'+_0xda4fa['name']+':end></'+_0xda4fa['name']+':end>',_0x21a3af=_0x1a2f8d['indexOf'](_0x457a64);_0x1a2f8d=_0x1a2f8d['substring'](0x0,_0x21a3af)+_0x1a2f8d['substring'](_0x21a3af+_0x457a64['length']),_0x835ee8['push']({'markerName':_0xda4fa['name'],'start':_0x42c05a,'end':_0x21a3af,'htmlFragment':_0x1a2f8d['substring'](_0x42c05a,_0x21a3af)});}return{'content':_0x1a2f8d,'version':_0x34f10f['model']['document']['version'],'selections':_0x835ee8};}afterInit(){this['context']instanceof _0x2a0bfb?this['_integrateEditor'](this['context']):this['listenTo'](this['context']['editors'],'add',(_0x28735a,_0x3bc64a)=>{_0x3bc64a['on']('ready',()=>{this['_integrateEditor'](_0x3bc64a);});});}_setOutputDataProcessor(_0x531522){this['_outputDataProcessor']=_0x531522;}async _getDocumentDataStringFromView(_0xcf4231,_0x20c23b){let _0x544011;if(this['_outputDataProcessor']){const _0x5a5128=_0x20c23b['data']['processor']['domConverter']['viewToDom'](_0xcf4231),_0x31f78a=await this['_outputDataProcessor'](_0x5a5128);_0x544011=_0x20c23b['data']['processor']['htmlWriter']['getHtml'](_0x31f78a);}else _0x544011=_0x20c23b['data']['processor']['toData'](_0xcf4231);return _0x544011;}_integrateEditor(_0xe769a4){if(!_0xe769a4['config']['get']('collaboration.channelId'))throw new ct('ai-missing-channel-id',_0xe769a4);_0xe769a4['ui']['focusTracker']['on']('change:isFocused',(_0x38d0c3,_0x5aa9fc,_0xf66ab0)=>{_0xf66ab0&&(this['_lastContentFocusedEditor']=_0xe769a4);}),_0xe769a4['on']('destroy',()=>{this['_lastContentFocusedEditor']===_0xe769a4&&(this['_lastContentFocusedEditor']=void 0x0);}),_0xe769a4['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Js,'view':({markerName:_0x20317a})=>({'classes':['ck-ai-assistant-ui_theme','ck-fake-ai-selection','ck-fake-ai-selection-'+_0x20317a['split'](':')[0x1]],'priority':0xc})}),_0xe769a4['conversion']['for']('dataDowncast')['markerToElement']({'model':Js+':context','view':(_0x4c4650,{writer:_0x314c1d,options:_0x551a7c})=>_0x551a7c['convertAiChatSelectionMarker']?_0x314c1d['createUIElement'](_0x4c4650['markerName']+':'+(_0x4c4650['isOpening']?'start':'end')):null});}showFakeVisualSelection(_0x4402bb){const _0x3a4f33=this['_fakeSelections'][0x0]||null;this['_addFakeSelection'](_0x4402bb);const _0x4e253c=this['_fakeSelections'][0x0]||null;this['_refreshFakeSelection'](_0x3a4f33,_0x4e253c);}hideFakeVisualSelection(_0x286415){const _0x2691bc=this['_fakeSelections'][0x0]||null;this['_removeFakeSelectionById'](_0x286415);const _0x538d92=this['_fakeSelections'][0x0]||null;this['_refreshFakeSelection'](_0x2691bc,_0x538d92);}async modelToDataWithIds(_0x41c77b,_0x83f4fc,_0x1795b3){const _0x609cd0=_0x83f4fc['data']['toView'](_0x41c77b),_0x4f05c6=new _0x24fafe(_0x83f4fc['editing']['view']['document']),_0x5e9fd6=new Set();this['_setDataIdsOnChildren'](_0x609cd0,_0x4f05c6,_0x5e9fd6);const _0x332e5b=await this['_getDocumentDataStringFromView'](_0x609cd0,_0x83f4fc);return _0x1795b3&&Gs(_0x83f4fc,_0x1795b3)?Fs(_0x332e5b,this['_nextDataId'](_0x5e9fd6)):_0x332e5b;}_setDataIdsOnChildren(_0x48de54,_0x557c54,_0x2226f7=new Set()){let _0x1f1f09=!0x1;for(const _0x4bba44 of _0x48de54['getChildren']()){if(!_0x4bba44['is']('view:element')||Zs['includes'](_0x4bba44['name']))continue;const _0xddf4bb=_0x4bba44['is']('view:containerElement'),_0x143fdf=_0x4bba44['is']('view:emptyElement'),_0x4cc2b4=_0x4bba44['is']('view:rawElement'),_0x1a21a1=this['_setDataIdsOnChildren'](_0x4bba44,_0x557c54,_0x2226f7);_0x4bba44['hasAttribute']('data-id')?(_0x1f1f09=!0x0,_0x2226f7['add'](_0x4bba44['getAttribute']('data-id'))):(_0xddf4bb||_0x143fdf||_0x4cc2b4||_0x1a21a1)&&(_0x557c54['setAttribute']('data-id',this['_nextDataId'](_0x2226f7),_0x4bba44),_0x1f1f09=!0x0);}return _0x1f1f09;}_nextDataId(_0x3f6f6e){let _0x253fcd;do{_0x253fcd='';for(let _0x3453b0=0x0;_0x3453b0<0x4;_0x3453b0++)_0x253fcd+=String['fromCharCode'](0x61+Math['floor'](0x1a*Math['random']()));}while(_0x3f6f6e['has'](_0x253fcd));return _0x3f6f6e['add'](_0x253fcd),_0x253fcd;}getSelectionText(_0x18cbae){const _0x42dd14=(_0x18cbae?_0x18cbae['model']:Ss(this['context'])['model'])['document']['selection'],_0x129fac=[],_0xc3aa2a=Array['from'](_0x42dd14['getRanges']());_0xc3aa2a['sort']((_0x35e688,_0x22b1d8)=>_0x35e688['start']['isBefore'](_0x22b1d8['start'])?-0x1:0x1);for(const _0x30beb5 of _0xc3aa2a)for(const _0x2141f3 of _0x30beb5['getItems']())_0x2141f3['is']('$textProxy')?_0x129fac['push'](_0x2141f3['data']):_0x2141f3['is']('element')&&_0x129fac['length']>0x0&&'\x20'!==_0x129fac[_0x129fac['length']-0x1]&&_0x129fac['push']('\x20');return _0x129fac['length']?'\x22'+_0x129fac['join']('')['trim']()+'\x22':Es(this['context']['locale'],'AI_CHAT_CONTEXT_DOCUMENT_SELECTION_LABEL');}_removeFakeSelectionById(_0x53b8c6){for(let _0x3cfb4e=0x0;_0x3cfb4e<this['_fakeSelections']['length'];_0x3cfb4e++)if(this['_fakeSelections'][_0x3cfb4e]['id']==_0x53b8c6)return void this['_fakeSelections']['splice'](_0x3cfb4e,0x1);}_addFakeSelection(_0x26715f){this['_removeFakeSelectionById'](_0x26715f['id']),Ct(this['_fakeSelections'],_0x26715f);}_refreshFakeSelection(_0x58c439,_0x46736b){if(_0x58c439==_0x46736b)return;const _0x2cb155=_0x58c439?_0x58c439['editor']:null,_0x3c1e78=_0x46736b?_0x46736b['editor']:null,_0x588cf5=(_0x205fef,_0x40e1ac)=>{const _0x316cbe=_0x40e1ac['model']['markers']['getMarkersGroup'](Js);for(const _0xedbd0d of _0x316cbe)_0x205fef['removeMarker'](_0xedbd0d);},_0x2385f4=(_0x295ba9,_0x140d4b,_0x302c71)=>{const _0x36597a=_0x140d4b['model'];for(let _0x429e76=0x0;_0x429e76<_0x302c71['ranges']['length'];_0x429e76++){let _0x3bb29c=_0x302c71['ranges'][_0x429e76];const _0x4ba942=Js+':'+_0x302c71['id']+':'+_0x429e76;if(_0x3bb29c['start']['isAtEnd']){const _0x31c134=_0x3bb29c['start']['getLastMatchingPosition'](({item:_0xcab5c7})=>!_0x36597a['schema']['isContent'](_0xcab5c7),{'boundaries':_0x3bb29c});_0x3bb29c=_0x295ba9['createRange'](_0x31c134,_0x3bb29c['end']);}_0x295ba9['addMarker'](_0x4ba942,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x3bb29c});}};_0x2cb155&&_0x3c1e78&&_0x2cb155===_0x3c1e78&&_0x46736b?_0x2cb155['model']['change'](_0x225b8d=>{_0x588cf5(_0x225b8d,_0x2cb155),_0x2385f4(_0x225b8d,_0x3c1e78,_0x46736b);}):(_0x2cb155&&_0x2cb155['model']['change'](_0x208a7e=>_0x588cf5(_0x208a7e,_0x2cb155)),_0x3c1e78&&_0x46736b&&_0x3c1e78['model']['change'](_0x4d7708=>_0x2385f4(_0x4d7708,_0x3c1e78,_0x46736b)));}_getMarkersInDocumentOrder(_0x345c92,_0x3539c1){const _0xd2a13f=Array['from'](_0x345c92['model']['markers']['getMarkersGroup'](Js+':context'));return(_0x3539c1?_0xd2a13f['filter'](_0x34544c=>{const _0x25514d=_0x34544c['getRange']();return _0x25514d&&_0x25514d['root']['rootName']===_0x3539c1['rootName'];}):_0xd2a13f)['sort']((_0x4c664d,_0x42f21f)=>_0x4c664d['getStart']()['isBefore'](_0x42f21f['getStart']())?-0x1:_0x4c664d['getStart']()['isAfter'](_0x42f21f['getStart']())?0x1:0x0);}_getEditorConfig(_0x2d9c07){let _0x3f9fe1=this['_editorsToConfigs']['get'](_0x2d9c07);return _0x3f9fe1||(_0x3f9fe1=function(_0x5c38a3){const _0x30beae={};if(_0x5c38a3['plugins']['has']('AlignmentEditing')&&(_0x30beae['alignment']=_0x5c38a3['config']['get']('alignment')),_0x5c38a3['plugins']['has']('CodeBlockEditing')&&(_0x30beae['codeBlock']=_0x5c38a3['config']['get']('codeBlock')),_0x5c38a3['plugins']['has']('FontBackgroundColorEditing')&&(_0x30beae['fontBackgroundColor']=Xs(_0x5c38a3['config']['get']('fontBackgroundColor'),['documentColors','columns','colorPicker'])),_0x5c38a3['plugins']['has']('FontColorEditing')&&(_0x30beae['fontColor']=Xs(_0x5c38a3['config']['get']('fontColor'),['documentColors','columns','colorPicker'])),_0x5c38a3['plugins']['has']('FontFamilyEditing')&&(_0x30beae['fontFamily']=_0x5c38a3['config']['get']('fontFamily'),_0x30beae['fontFamily']&&_0x30beae['fontFamily']['options']&&(_0x30beae['fontFamily']['options']=zs(_0x30beae['fontFamily']['options'],['model','upcastAlso']))),_0x5c38a3['plugins']['has']('FontSizeEditing')&&(_0x30beae['fontSize']=_0x5c38a3['config']['get']('fontSize'),_0x30beae['fontSize']&&_0x30beae['fontSize']['options']&&(_0x30beae['fontSize']['options']=zs(_0x30beae['fontSize']['options'],['upcastAlso']))),_0x5c38a3['plugins']['has']('FootnotesEditing')){const _0x45e804=_0x5c38a3['config']['get']('footnotes')??{};_0x45e804['footnotesProperties']&&'object'==typeof _0x45e804['footnotesProperties']&&(_0x45e804['footnotesProperties']=Xs(_0x45e804['footnotesProperties'],['toolbar','listStyles'])),_0x30beae['footnotes']=_0x45e804;}if(_0x5c38a3['plugins']['has']('HeadingEditing')&&(_0x30beae['heading']=_0x5c38a3['config']['get']('heading'),_0x30beae['heading']&&_0x30beae['heading']['options']&&(_0x30beae['heading']['options']=zs(_0x30beae['heading']['options'],['model','icon','class','converterPriority','upcastAlso']))),_0x5c38a3['plugins']['has']('HighlightEditing')&&(_0x30beae['highlight']=_0x5c38a3['config']['get']('highlight'),_0x30beae['highlight']&&_0x30beae['highlight']['options']&&(_0x30beae['highlight']['options']=zs(_0x30beae['highlight']['options'],['model','color']))),_0x5c38a3['plugins']['has']('ImageBlockEditing')||_0x5c38a3['plugins']['has']('ImageInlineEditing')){const _0x4bbdc8=Xs(_0x5c38a3['config']['get']('image'),['toolbar','upload','insert','resizeOptions']);_0x5c38a3['plugins']['has']('ImageResizeEditing')||delete _0x4bbdc8['resizeUnit'],_0x5c38a3['plugins']['has']('ImageStyleEditing')?_0x4bbdc8['styles']?.['options']&&(_0x4bbdc8['styles']['options']=zs(_0x4bbdc8['styles']['options'],['icon'])):delete _0x4bbdc8['styles'],_0x30beae['image']=_0x4bbdc8;}if(_0x5c38a3['plugins']['has']('IndentBlock')&&(_0x30beae['indentBlock']=_0x5c38a3['config']['get']('indentBlock')),_0x5c38a3['plugins']['has']('LineHeightEditing')&&(_0x30beae['lineHeight']=_0x5c38a3['config']['get']('lineHeight'),_0x30beae['lineHeight']&&(delete _0x30beae['lineHeight']['supportAllValues'],_0x30beae['lineHeight']['options']&&(_0x30beae['lineHeight']['options']=zs(_0x30beae['lineHeight']['options'],['model'])))),_0x5c38a3['plugins']['has']('LinkEditing')&&(_0x30beae['link']=Xs(_0x5c38a3['config']['get']('link'),['toolbar'])),_0x5c38a3['plugins']['has']('ListEditing')){const _0x543fee=_0x5c38a3['config']['get']('list')??{};delete _0x543fee['enableListItemMarkerFormatting'],_0x5c38a3['plugins']['has']('ListPropertiesEditing')?_0x543fee['properties']&&_0x543fee['properties']['styles']&&'object'==typeof _0x543fee['properties']['styles']&&(_0x543fee['properties']['styles']=Xs(_0x543fee['properties']['styles'],['listStyleTypes'])):delete _0x543fee['properties'],_0x30beae['list']=_0x543fee;}if(_0x5c38a3['plugins']['has']('MediaEmbedEditing')&&(_0x30beae['mediaEmbed']=_0x5c38a3['config']['get']('mediaEmbed'),_0x30beae['mediaEmbed']&&(delete _0x30beae['mediaEmbed']['toolbar'],_0x5c38a3['plugins']['has']('MediaEmbedResizeEditing')?_0x30beae['mediaEmbed']['resizeOptions']&&(_0x30beae['mediaEmbed']['resizeOptions']=_0x30beae['mediaEmbed']['resizeOptions']['map'](_0x161dbd=>Xs(_0x161dbd,['icon','label']))):delete _0x30beae['mediaEmbed']['resizeOptions'],_0x5c38a3['plugins']['has']('MediaEmbedStyleEditing')?_0x30beae['mediaEmbed']['styles']&&_0x30beae['mediaEmbed']['styles']['options']&&(_0x30beae['mediaEmbed']['styles']['options']=zs(_0x30beae['mediaEmbed']['styles']['options'],['icon','title'])):delete _0x30beae['mediaEmbed']['styles'])),_0x5c38a3['plugins']['has']('MultiLevelListEditing')&&(_0x30beae['listMultiLevel']=_0x5c38a3['config']['get']('listMultiLevel')??{}),_0x5c38a3['plugins']['has']('MentionEditing')){const _0x2527a3=Xs(_0x5c38a3['config']['get']('mention'),['commitKeys','dropdownLimit']);_0x2527a3['feeds']&&(_0x2527a3['feeds']=_0x2527a3['feeds']['map'](_0xdeab1e=>Xs(_0xdeab1e,['minimumCharacters','itemRenderer','dropdownLimit']))),_0x30beae['mention']=_0x2527a3;}if(_0x5c38a3['plugins']['has']('MergeFieldsEditing')){const _0xa35c06=Xs(_0x5c38a3['config']['get']('mergeFields'),['previewModes','initialPreviewMode','previewHtmlValues','sanitizeHtml']);Array['isArray'](_0xa35c06['definitions'])&&(_0xa35c06['definitions']=_0xa35c06['definitions']['map'](_0xe506a8=>'groupId'in _0xe506a8?(Array['isArray'](_0xe506a8['definitions'])&&(_0xe506a8['definitions']=_0xe506a8['definitions']['map'](_0x262ffd=>Xs(_0x262ffd,['defaultValue']))),_0xe506a8):Xs(_0xe506a8,['defaultValue']))),_0x30beae['mergeFields']=_0xa35c06;}if(_0x5c38a3['plugins']['has']('StyleEditing')&&(_0x30beae['style']=_0x5c38a3['config']['get']('style')),_0x5c38a3['plugins']['has']('TableEditing')){const _0x6ee9e1=Xs(_0x5c38a3['config']['get']('table'),['contentToolbar','tableToolbar','showHiddenBorders']);_0x5c38a3['plugins']['has']('TablePropertiesEditing')?_0x6ee9e1['tableProperties']&&'object'==typeof _0x6ee9e1['tableProperties']&&(_0x6ee9e1['tableProperties']=Xs(_0x6ee9e1['tableProperties'],['colorPicker','borderColors','backgroundColors'])):delete _0x6ee9e1['tableProperties'],_0x5c38a3['plugins']['has']('TableCellPropertiesEditing')?_0x6ee9e1['tableCellProperties']&&'object'==typeof _0x6ee9e1['tableCellProperties']&&(_0x6ee9e1['tableCellProperties']=Xs(_0x6ee9e1['tableCellProperties'],['colorPicker','borderColors','backgroundColors'])):delete _0x6ee9e1['tableCellProperties'],_0x5c38a3['plugins']['has']('TableLayoutEditing')?_0x6ee9e1['tableLayout']||(_0x6ee9e1['tableLayout']={}):delete _0x6ee9e1['tableLayout'],_0x5c38a3['plugins']['has']('TableCaptionEditing')?_0x6ee9e1['tableCaption']||(_0x6ee9e1['tableCaption']={}):delete _0x6ee9e1['tableCaption'],_0x30beae['table']=_0x6ee9e1;}_0x5c38a3['plugins']['has']('TextPartLanguageEditing')&&(_0x30beae['textPartLanguage']=_0x5c38a3['config']['get']('language.textPartLanguage'));for(const [_0x5a340e,_0x283ae3]of js)_0x5c38a3['plugins']['has'](_0x5a340e)&&(_0x30beae[_0x283ae3]={});return _0x30beae;}(_0x2d9c07),this['_editorsToConfigs']['set'](_0x2d9c07,_0x3f9fe1)),_0x3f9fe1;}};const en=/* #__PURE__ -- @preserve */
26
+ At();var sn=class extends en{_generateUid;_uidCounter=0x0;_touchedNodesState={'newIds':[],'modifiedIds':[],'removedIds':[],'invalidIds':[],'lastTouchedId':null,'rescuedNewIds':new Set()};_existingDataIds=new Set();_referencedExistingIds=new Set();constructor(_0x4d49aa){super(),this['_generateUid']=_0x4d49aa||(()=>'e'+String(this['_uidCounter']++));}['merge'](_0x1fcc9c,_0x2b2af5,_0x276122){this['_uidCounter']=0x0;const _0x478f0a=_0x1fcc9c['cloneNode'](!0x0);on(_0x2b2af5,_0x478f0a);const _0x94af28=_0x478f0a['childNodes'],_0x39f66c=Array['from'](_0x94af28)['filter'](_0x57d4d7=>!(0x3===_0x57d4d7['nodeType']&&''===Os(_0x57d4d7)['trim']())),_0x2f860e=_0x39f66c['length'];this['_existingDataIds']=new Set(ks('data-id',null,_0x2b2af5)['map'](_0x8f8858=>Ps(_0x8f8858,'data-id'))['filter'](_0x376111=>!!_0x376111));for(const _0x413d13 of _0x39f66c)_0x413d13&&_0x438723(_0x413d13)&&void 0x0===_0x413d13['attribs']['data-id']&&Ds(_0x413d13,'data-id','new-element');if(ks('data-id',null,_0x478f0a)['forEach'](_0x18870f=>{const _0xc688e7=Ps(_0x18870f,'data-id');'new-element'===_0xc688e7||this['_existingDataIds']['has'](_0xc688e7)||Ds(_0x18870f,'data-id','new-element');}),0x0===_0x2b2af5['childNodes']['length']){const _0x15f320=[];return ks('data-id','new-element',_0x478f0a)['forEach'](_0x49a2e1=>{const _0x45491d=this['_generateUid']();Ds(_0x49a2e1,'data-id',_0x45491d),_0x15f320['push'](_0x45491d);}),this['_removeSpecialComments'](_0x478f0a),{'parsedContent':_0x478f0a,'newNodeIds':_0x15f320,'modifiedNodeIds':[],'removedNodeIds':[]};}this['_touchedNodesState']['newIds']=[],this['_touchedNodesState']['modifiedIds']=[],this['_touchedNodesState']['removedIds']=[],this['_touchedNodesState']['invalidIds']=[],this['_touchedNodesState']['lastTouchedId']=null,this['_touchedNodesState']['rescuedNewIds']=new Set(),this['_referencedExistingIds']=new Set();let _0x18bbb8=-0x1,_0x52cdc4=!0x1;for(let _0x5c4542=0x0;_0x5c4542<_0x2f860e;_0x5c4542++){const _0x59faef=_0x39f66c[_0x5c4542],_0x2be9f9=_0x39f66c[_0x5c4542+0x1];if(this['_isNewNode'](_0x59faef)){if(-0x1===_0x18bbb8&&(_0x18bbb8=_0x5c4542),this['_markWrappedElements'](_0x59faef),!this['_isNewNode'](_0x2be9f9)){const [_0x3b5b8b,_0x3b3cfa]=this['_findReferenceNode'](_0x59faef,_0x52cdc4,_0x2b2af5);if(_0x3b5b8b){const _0x32aa36=Array['from'](_0x39f66c)['slice'](_0x18bbb8,_0x5c4542+0x1);this['_insertNodes'](_0x3b5b8b,_0x32aa36,_0x3b3cfa),_0x18bbb8=-0x1;}}}else{if(this['_isExistingContentComment'](_0x59faef))_0x52cdc4=!0x0;else{if(this['_isExistingNode'](_0x59faef)){const _0x492792=Ps(_0x59faef,'data-id');if(_0x492792&&this['_existingDataIds']['has'](_0x492792)){this['_referencedExistingIds']['add'](_0x492792);const _0x25a04f=vs('data-id',_0x492792,_0x2b2af5);this['_replaceNode'](_0x25a04f,_0x59faef);}}else{if(nn(_0x59faef)){const _0x303018=rn(_0x59faef);vs('data-id',_0x303018,_0x478f0a)||this['_touchedNodesState']['removedIds']['push'](_0x303018);}}}}}for(const _0x5a25e1 of this['_touchedNodesState']['removedIds']){const _0x13786d=vs('data-id',_0x5a25e1,_0x2b2af5);_0x13786d&&(this['_rescueUnwrappedElements'](_0x13786d),this['_removeNode'](_0x13786d,_0x5a25e1,_0x276122));}if(ks('data-id','new-element',_0x2b2af5)['forEach'](_0x14a3b3=>{const _0x569fbe=this['_getUid'](_0x14a3b3);Ds(_0x14a3b3,'data-id',_0x569fbe),this['_touchedNodesState']['newIds']['push'](_0x569fbe);}),this['_removeSpecialComments'](_0x2b2af5),_0x276122&&_0x276122['cutAfterUnstable']){const _0x3fcd8e=this['_findLastConfirmationPoint'](_0x39f66c),_0x7acb4=this['_getLastStableElement'](_0x2b2af5,_0x3fcd8e);this['_markUnstableElements'](_0x2b2af5,_0x7acb4);}if(this['_processWrappedElements'](_0x2b2af5,_0x276122),_0x276122&&_0x276122['cutAfterUnstable']&&this['_touchedNodesState']['lastTouchedId']){const _0x3bcfdf=ks('data-id',this['_touchedNodesState']['lastTouchedId'],_0x2b2af5);let _0x2ad663=_0x3bcfdf[_0x3bcfdf['length']-0x1];for(;_0x2ad663;)Bs(_0x2ad663),_0x2ad663=_0x2ad663['parentNode'];}return{'parsedContent':_0x2b2af5,'newNodeIds':this['_touchedNodesState']['newIds'],'modifiedNodeIds':this['_touchedNodesState']['modifiedIds'],'removedNodeIds':this['_touchedNodesState']['removedIds']};}_insertNodes(_0x3b4619,_0x115c83,_0x380542){for(const _0x48bf36 of _0x115c83){const _0x3688af=this['_getUid'](_0x48bf36);Ds(_0x48bf36,'data-id',_0x3688af),this['_touchedNodesState']['newIds']['push'](_0x3688af),this['_touchedNodesState']['lastTouchedId']=_0x3688af;}const _0x51db04='afterbegin'===_0x380542||'afterend'===_0x380542?_0x115c83['reverse']():_0x115c83;for(const _0x4d6199 of _0x51db04)Hs(_0x3b4619,_0x4d6199,_0x380542);}['_replaceNode'](_0x27e937,_0x413a7d){if(!_0x27e937)return;if(_0x3cd340=_0x413a7d,Us(Os(_0x27e937))===Us(Os(_0x3cd340)))return;var _0x3cd340;const _0x45780c=Ps(_0x27e937,'data-id');this['_touchedNodesState']['modifiedIds']['push'](_0x45780c),this['_touchedNodesState']['lastTouchedId']=_0x45780c,_0x444916(_0x27e937,_0x413a7d['cloneNode'](!0x0));}['_removeNode'](_0x1b0d6d,_0x330672,_0x367e93){if(_0x367e93&&_0x367e93['replaceRemovedWith']){this['_touchedNodesState']['lastTouchedId']=_0x330672;const _0x11a6c0=_0x367e93['replaceRemovedWith']['cloneNode'](!0x0);Ds(_0x11a6c0,'data-id',_0x330672),Ds(_0x11a6c0,'data-removed','true'),_0x444916(_0x1b0d6d,_0x11a6c0);}else _0x4ebff9(_0x1b0d6d);}['_findReferenceNode'](_0x343013,_0x125063,_0x2e9014){const _0x1079f3=this['_findPrevElementWithDataId'](_0x343013,!0x1);if(_0x1079f3){const _0xa6c4df=rn(_0x1079f3),_0x1c9c40=vs('data-id',_0xa6c4df,_0x2e9014);if(_0x1c9c40)return[_0x1c9c40,'afterend'];this['_touchedNodesState']['invalidIds']['push'](_0xa6c4df);}const _0xf4b66d=this['_findNextElementWithDataId'](_0x343013,!0x1);if(_0xf4b66d){const _0x2edf04=rn(_0xf4b66d),_0x3561a9=vs('data-id',_0x2edf04,_0x2e9014);if(_0x3561a9)return[_0x3561a9,'beforebegin'];this['_touchedNodesState']['invalidIds']['push'](_0x2edf04);}return _0x125063?_0x343013['nextSibling']?this['_findFallbackReferenceNode'](_0x343013,_0x2e9014):[_0x2e9014['childNodes'][_0x2e9014['childNodes']['length']-0x1],'afterend']:[_0x2e9014['childNodes'][0x0],'beforebegin'];}['_findFallbackReferenceNode'](_0x18e8dc,_0x570547){const _0x5591d4=[],_0xd01171=this['_findPrevElementWithDataId'](_0x18e8dc,!0x0);if(_0xd01171){const _0x2cd7c3=vs('data-id',rn(_0xd01171),_0x570547);_0x2cd7c3&&_0x5591d4['push']([_0x2cd7c3,'afterend']);}const _0x2aaccf=this['_findNextElementWithDataId'](_0x18e8dc,!0x0);if(_0x2aaccf){const _0x661144=vs('data-id',rn(_0x2aaccf),_0x570547);_0x661144&&_0x5591d4['push']([_0x661144,'beforebegin']);}return _0x5591d4['length']>0x1?Vs(_0x5591d4[0x0][0x0])<=Vs(_0x5591d4[0x1][0x0])?_0x5591d4[0x0]:_0x5591d4[0x1]:0x1===_0x5591d4['length']?_0x5591d4[0x0]:[_0x570547['lastChild'],'afterend'];}_findNextElementWithDataId(_0x23b140,_0x221726){let _0x4bbe42=_0x23b140['nextSibling'],_0x1801d0=null,_0x29f36a=!0x1;for(;_0x4bbe42;){if(_0x36dce3(_0x4bbe42)){if(nn(_0x4bbe42)&&(_0x1801d0=_0x4bbe42),this['_isExistingContentComment'](_0x4bbe42)&&_0x221726&&!_0x29f36a){_0x29f36a=!0x0,_0x4bbe42=_0x4bbe42['nextSibling'];continue;}break;}const _0x441157=Ps(_0x4bbe42,'data-id');if(_0x441157&&'new-element'!==_0x441157&&this['_existingDataIds']['has'](_0x441157)){_0x1801d0=_0x4bbe42;break;}_0x4bbe42=_0x4bbe42['nextSibling'];}return _0x1801d0;}_findPrevElementWithDataId(_0x369811,_0x48ca9b){let _0x4e71ee=_0x369811['previousSibling'],_0x21eee2=null,_0x16b79e=!0x1;for(;_0x4e71ee;){if(_0x36dce3(_0x4e71ee)){if(nn(_0x4e71ee)&&(_0x21eee2=_0x4e71ee),this['_isExistingContentComment'](_0x4e71ee)&&_0x48ca9b&&!_0x16b79e){_0x16b79e=!0x0,_0x4e71ee=_0x4e71ee['previousSibling'];continue;}break;}const _0xfe989d=Ps(_0x4e71ee,'data-id');if(_0xfe989d&&'new-element'!==_0xfe989d&&this['_existingDataIds']['has'](_0xfe989d)){_0x21eee2=_0x4e71ee;break;}_0x4e71ee=_0x4e71ee['previousSibling'];}return _0x21eee2;}_markWrappedElements(_0x53c36e){_0x438723(_0x53c36e)&&ks('data-id',null,_0x53c36e)['forEach'](_0xc5a478=>{this['_isExistingNode'](_0xc5a478)&&(Ds(_0xc5a478,'data-wrapped-id',Ps(_0xc5a478,'data-id')),Ds(_0xc5a478,'data-id',null));});}_processWrappedElements(_0x24fa54,_0x346be5){ks('data-wrapped-id',null,_0x24fa54)['forEach'](_0x33875c=>{const _0x2e9f9=Ps(_0x33875c,'data-wrapped-id');if(this['_hasUnstableParent'](_0x33875c))return;const _0x28b305=vs('data-id',_0x2e9f9,_0x24fa54);Ds(_0x33875c,'data-id',_0x2e9f9),_0x28b305&&(this['_removeNode'](_0x28b305,_0x2e9f9,_0x346be5),this['_touchedNodesState']['removedIds']['push'](_0x2e9f9),this['_touchedNodesState']['lastTouchedId']=_0x2e9f9);});}_hasUnstableParent(_0x50d385){let _0x2673c0=_0x50d385['parentNode'];for(;_0x2673c0;){if(Ps(_0x2673c0,'data-unstable'))return!0x0;_0x2673c0=_0x2673c0['parentNode'];}return!0x1;}_rescueUnwrappedElements(_0x637b26){const _0x430748=new Set(this['_touchedNodesState']['removedIds']),_0x5c9038=new Set(this['_touchedNodesState']['newIds']);ks('data-id',null,_0x637b26)['forEach'](_0x3837c0=>{const _0x17f347=Ps(_0x3837c0,'data-id'),_0xd724c5=!!_0x17f347&&this['_referencedExistingIds']['has'](_0x17f347),_0xd88a14=!!_0x17f347&&_0x5c9038['has'](_0x17f347);if(!_0x17f347||!_0xd724c5&&!_0xd88a14)return;if(_0x430748['has'](_0x17f347))return;let _0x2d4d75=_0x3837c0['parentNode'],_0x4150dd=!0x1;for(;_0x2d4d75;){if(_0x2d4d75===_0x637b26){_0x4150dd=!0x0;break;}const _0x7b5e3a=Ps(_0x2d4d75,'data-id');if(_0x7b5e3a&&(this['_referencedExistingIds']['has'](_0x7b5e3a)||_0x5c9038['has'](_0x7b5e3a)))return;_0x2d4d75=_0x2d4d75['parentNode'];}if(_0x4150dd){if(ti(_0x637b26,_0x3837c0),_0xd724c5){const _0x229526=this['_generateUid'](),_0x330c9e=this['_touchedNodesState']['modifiedIds']['indexOf'](_0x17f347);-0x1!==_0x330c9e&&this['_touchedNodesState']['modifiedIds']['splice'](_0x330c9e,0x1),Ds(_0x3837c0,'data-unwrapped-id',_0x17f347),Ds(_0x3837c0,'data-id',_0x229526),this['_touchedNodesState']['newIds']['push'](_0x229526),this['_touchedNodesState']['rescuedNewIds']['add'](_0x229526),this['_touchedNodesState']['lastTouchedId']=_0x229526;}else this['_touchedNodesState']['rescuedNewIds']['add'](_0x17f347),this['_touchedNodesState']['lastTouchedId']=_0x17f347;}});}_getUid(_0x1a7cbb){return this['_isExistingNode'](_0x1a7cbb)?Ps(_0x1a7cbb,'data-id'):this['_generateUid']();}_removeSpecialComments(_0x4689dc){Ls(_0x4689dc)['filter'](_0x318171=>nn(_0x318171)||this['_isExistingContentComment'](_0x318171))['forEach'](_0x5a6226=>{_0x4ebff9(_0x5a6226);});}_findLastConfirmationPoint(_0x3dd782){let _0x50e685=null,_0x518c3f=null,_0x5e38a9=null,_0x48e7a6=null;const _0xd76937=_0x239c64=>{_0x239c64&&(_0x50e685=_0x239c64),_0x5e38a9=null,_0x48e7a6=null;};for(let _0x12ba5a=0x0;_0x12ba5a<_0x3dd782['length'];_0x12ba5a++){const _0x23e710=_0x3dd782[_0x12ba5a];if(this['_isExistingContentComment'](_0x23e710)){_0xd76937(_0x518c3f);continue;}if(_0x438723(_0x23e710)){const _0x4f8b=Ps(_0x23e710,'data-id'),_0xd8d634=_0x12ba5a===_0x3dd782['length']-0x1;if(_0x4f8b&&'new-element'!==_0x4f8b&&this['_touchedNodesState']['modifiedIds']['includes'](_0x4f8b)&&!_0xd8d634){_0xd76937(_0x4f8b),_0x518c3f=_0x4f8b;continue;}}let _0x5c73b5;const _0x3f1e00=rn(_0x23e710);if(_0x3f1e00&&this['_touchedNodesState']['rescuedNewIds']['has'](_0x3f1e00))_0x518c3f=_0x3f1e00;else{if(_0x3f1e00&&this['_touchedNodesState']['newIds']['includes'](_0x3f1e00))_0x5c73b5='N';else{if(!nn(_0x23e710))continue;_0x5c73b5='R';}_0x5c73b5===_0x48e7a6||null===_0x48e7a6?_0x48e7a6=_0x5c73b5:null!==_0x5e38a9?(_0xd76937(_0x518c3f),_0x48e7a6=_0x5c73b5):(_0x5e38a9=_0x48e7a6,_0x48e7a6=_0x5c73b5),_0x518c3f=_0x3f1e00;}}const _0x151558=_0x3dd782[_0x3dd782['length']-0x1];return _0x151558&&!_0x438723(_0x151558)&&!nn(_0x151558)&&_0x518c3f&&_0xd76937(_0x518c3f),_0x50e685;}_getLastStableElement(_0x6c485b,_0x3edfc0){if(!_0x3edfc0)return null;const _0x3cf036=vs('data-id',_0x3edfc0,_0x6c485b);if(!_0x3cf036)return null;const _0x32315e=[_0x3cf036,...Ms(_0x3cf036)]['at'](-0x2);if(_0x32315e===_0x3cf036)return _0x3cf036;let _0x3e1798=_0x32315e['previousSibling'];for(;_0x3e1798&&!_0x438723(_0x3e1798);)_0x3e1798=_0x3e1798['previousSibling'];return _0x3e1798;}_markUnstableElements(_0x2d46ad,_0x1b80ae){const _0x8fad1c=new Set([...this['_touchedNodesState']['newIds'],...this['_touchedNodesState']['modifiedIds'],...this['_touchedNodesState']['removedIds']]);let _0x1d22e1=_0x1b80ae?_0x1b80ae['nextSibling']:_0x2d46ad['firstChild'];for(;_0x1d22e1;)_0x438723(_0x1d22e1)&&(_0x8fad1c['has'](Ps(_0x1d22e1,'data-id'))||ks('data-id',null,_0x1d22e1)['some'](_0x211442=>_0x8fad1c['has'](Ps(_0x211442,'data-id'))))&&Ds(_0x1d22e1,'data-unstable','true'),_0x1d22e1=_0x1d22e1['nextSibling'];}['_isNewNode'](_0x3b3fbd){return Boolean('new-element'===Ps(_0x3b3fbd,'data-id'));}_isExistingNode(_0x3bb1f6){return Boolean((Ps(_0x3bb1f6,'data-id')||'')['length']>0x0&&'new-element'!==Ps(_0x3bb1f6,'data-id'));}_isExistingContentComment(_0x19da43){return Boolean(_0x36dce3(_0x19da43)&&Os(_0x19da43)['match'](/\s*existing[\s*-](content|document)\s*/g));}};function nn(_0x5e3e3d){return!!_0x5e3e3d&&Boolean(_0x36dce3(_0x5e3e3d)&&Os(_0x5e3e3d)['match'](/removed[\s*-]data-id="[^"]+"/));}function rn(_0x90334a){if(!_0x90334a)return null;if(_0x438723(_0x90334a))return Ps(_0x90334a,'data-id')??null;if(_0x36dce3(_0x90334a)){const _0xd04b6e=Os(_0x90334a)['match'](/removed[\s*-]data-id="([^"]+)"/);if(_0xd04b6e&&_0xd04b6e[0x1])return _0xd04b6e[0x1];}return null;}function on(_0x2ca103,_0x35da74){const _0x4cae3c=new Map();for(const _0x2474f3 of ys(_0x2ca103))xs(_0x2474f3)||_0x4cae3c['set'](Ps(_0x2474f3,'data-id'),_0x2474f3);const _0xe00352=new Set();for(const _0x311116 of ys(_0x35da74)){if(xs(_0x311116))continue;const _0x582c56=Ps(_0x311116,'data-id'),_0x2b3781=_0x582c56?_0x4cae3c['get'](_0x582c56):void 0x0;_0x2b3781?(_0x444916(_0x311116,_0x246402(_0x2b3781,!0x0)),_0xe00352['add'](_0x582c56)):_0x4ebff9(_0x311116);}for(const _0x41c4a1 of Ls(_0x35da74))nn(_0x41c4a1)&&_0x4cae3c['has'](rn(_0x41c4a1))&&_0x4ebff9(_0x41c4a1);const _0x582dd1=new Set(ks('data-id',null,_0x35da74)['map'](_0x47a774=>Ps(_0x47a774,'data-id')));for(const [_0x378de5,_0x19ea85]of _0x4cae3c){if(_0xe00352['has'](_0x378de5))continue;let _0x38ca19=_0x19ea85['parent'],_0x3db831=null;for(;_0x38ca19&&_0x438723(_0x38ca19);){const _0x496355=Ps(_0x38ca19,'data-id');if(_0x496355&&_0x582dd1['has'](_0x496355)){_0x3db831=_0x496355;break;}_0x38ca19=_0x38ca19['parent'];}if(!_0x3db831)continue;const _0x1dec5d=vs('data-id',_0x3db831,_0x35da74);_0x1dec5d&&_0x2cdc39(_0x1dec5d,_0x246402(_0x19ea85,!0x0));}}const an=/* #__PURE__ -- @preserve */
27
+ At();var hn=class extends an{_m2html;constructor(){super();const _0xef7b18=Object['entries'](_0x3d6e18),_0x1c3acd=_0xef7b18['findIndex'](([_0x2486b2])=>'rehypeDomRaw'===_0x2486b2);if(-0x1===_0x1c3acd)throw new ct('ai-response-parser-unable-to-set-up-parser');_0xef7b18['splice'](_0x1c3acd+0x1,0x0,['rehypeSanitize',_0x158f1a]),this['_m2html']=new _0x37f450({'plugins':Object['fromEntries'](_0xef7b18)});}convertMarkdownToHTML(_0x2f7aa0){const _0x1eb687=this['_m2html']['parse'](_0x2f7aa0);return this['parseAndNormalizeHTML'](_0x1eb687);}['parseAndNormalizeHTML'](_0x492f6e){return this['_parseHTML'](_0x492f6e);}['_parseHTML'](_0x566d35){const _0x5b92f2=Rs('<dummy>'+_0x566d35['replace'](/<[^>]*?$/g,'')+'</dummy>');return cn(_0x5b92f2),_0x5b92f2['children']=_0x5b92f2['children'][0x0]['children'],_0x5b92f2;}};function cn(_0x3b7511){for(const _0x4faf7b of _0x3b7511['children'])_0x438723(_0x4faf7b)?'pre'!==_0x4faf7b['name']&&cn(_0x4faf7b):_0x8a421e(_0x4faf7b)&&(_0x4faf7b['data']=_0x4faf7b['data']['replace'](/^\t+/gm,'\x20')['replace'](/\n*/g,'')['replace'](/[ \t\r\f\v]+/g,'\x20'));}function ln({changeGroups:_0x674142,documentContextContent:_0x2a9a77,showDiff:_0x8caf8,trimUnchanged:_0x1e8551=!0x0}){const _0x5e1996=qs(_0x674142,_0x2a9a77);return _0x674142['map'](_0x113b55=>{if(!_0x113b55['editor']||'destroyed'===_0x113b55['editor']['state'])return null;const _0x341b53=Gs(_0x113b55['editor'],_0x113b55['rootName']),_0x487b4c=new _0x35605c([]),_0x3b19ca=new _0x35605c([]),_0x1e66b4=new Set();for(const _0x82ad4e of _0x113b55['changes'])'new'==_0x82ad4e['type']&&ks('data-id',null,_0x82ad4e['node'])['forEach'](_0x5c15c3=>{_0x1e66b4['add'](Ps(_0x5c15c3,'data-id'));});for(const _0x1b0802 of _0x113b55['changes'])if('removed'!=_0x1b0802['type']?_0x3b19ca['children']['push'](_0x1b0802['node']['cloneNode'](!0x0)):_0x8caf8||_0x1e66b4['has'](_0x1b0802['id'])||_0x3b19ca['children']['push'](_0x1b0802['node']['cloneNode'](!0x0)),'new'!=_0x1b0802['type']&&(_0x8caf8||'removed'!=_0x1b0802['type'])){const _0x4f3d99=_0xdb5da(_0x34c780=>Ps(_0x34c780,'data-id')==_0x1b0802['id'],_0x2a9a77['get'](_0x113b55['documentId']),!0x0);_0x4f3d99&&_0x487b4c['children']['push'](_0x4f3d99['cloneNode'](!0x0));}if(_0x341b53&&_0x5e1996['has'](_0x113b55['index']))return{'type':_0x113b55['changes'][0x0]['type'],'index':_0x113b55['index'],'state':_0x113b55['state'],'outdatedReason':_0x113b55['outdatedReason'],'content':new _0x35605c([]),'hasChanges':!0x1};let _0x2ca3f9,_0x128260,_0x39ccc4;try{({content:_0x2ca3f9,hasChanges:_0x128260}=un(_0x113b55['editor'],_0x487b4c,_0x3b19ca,_0x8caf8,_0x1e8551));}catch{return{'type':_0x113b55['changes'][0x0]['type'],'index':_0x113b55['index'],'state':_0x113b55['state'],'outdatedReason':_0x113b55['outdatedReason'],'content':new _0x35605c([]),'hasChanges':!0x1};}if(_0x341b53){_0x39ccc4=_0x113b55['editor']['ui']['getEditableElement'](_0x113b55['rootName'])?.['tagName']['toLowerCase']();const _0x554f69=_0x2ca3f9['children']['filter'](_0x438723);0x1===_0x554f69['length']&&(_0x2ca3f9=new _0x35605c(_0x554f69[0x0]['children']));}return{'type':_0x113b55['changes'][0x0]['type'],'index':_0x113b55['index'],'state':_0x113b55['state'],'outdatedReason':_0x113b55['outdatedReason'],'content':_0x2ca3f9,'hasChanges':_0x128260,'wrapperTag':_0x39ccc4};})['filter'](_0x246fec=>null!==_0x246fec);}function un(_0x522448,_0x229eb0,_0x3d5ecf,_0xb8d82c,_0x4f72e7=!0x0){const _0x7f2754=_0x522448['plugins']['get']('DocumentCompare'),_0x40989f=Os(_0x229eb0),_0x34daa1=Os(_0x3d5ecf),_0x4c24d1=_0x522448['data']['parse'](_0x40989f,'$root'),_0x290f7b=_0x522448['model']['createPositionAt'](_0x4c24d1,0x0),_0x2d80a2=_0x7f2754['getDiff'](_0x40989f,_0x34daa1,{'anchor':_0x290f7b,'markDeletions':_0xb8d82c,'targetEditor':_0x522448})['getOperations']();if(0x0==_0x2d80a2['length'])return{'content':_0x229eb0['cloneNode'](!0x0),'hasChanges':!0x1};if(_0xb8d82c?function(_0x344047,_0x10349f,_0x1d5776){if(0x0==_0x344047['length'])return;const _0x21aa1d=_0x1d5776['plugins']['get']('DocumentCompare'),_0xc11609=_0x1d5776['plugins']['get']('SuggestionsConversion');_0x1d5776['model']['change'](_0xd71035=>{const _0x1b5b64=new Set();for(let _0xd0a2f7=0x0;_0xd0a2f7<_0x344047['length'];_0xd0a2f7++){const _0x214bf3=_0x344047[_0xd0a2f7];if(_0x214bf3['baseVersion']=null,_0x214bf3['isDocumentOperation']=!0x1,!_0x22fa04(_0x214bf3)){if(_0x21aa1d['isMarkedRemoveOperation'](_0x214bf3)){const _0x5b9ba4=_0x283dbd(_0x214bf3['newRange'],_0x1d5776['model']),_0x26b84f='suggestion:deletion:'+kt()+':$aiSuggestion';_0x10349f['markers']['set'](_0x26b84f,_0x5b9ba4);}else switch(_0x214bf3['type']){case'rename':{if(_0x214bf3['oldName']==_0x214bf3['newName'])break;_0xd71035['batch']['addOperation'](_0x214bf3),_0x1d5776['model']['applyOperation'](_0x214bf3);const _0x12ba5f='$elementName',_0x2a65ef=_0x214bf3['position'],_0x232e9d=_0x1d5776['model']['createRange'](_0x2a65ef,_0x1d5776['model']['createPositionAt'](_0x2a65ef['nodeAfter'],'end')),_0x353f36='suggestion:attribute:'+_0x12ba5f+':'+kt()+':$aiSuggestion';_0x10349f['markers']['set'](_0x353f36,_0x232e9d);break;}case'addAttribute':case'removeAttribute':case'changeAttribute':{if(_0x214bf3['oldValue']==_0x214bf3['newValue'])break;_0xd71035['batch']['addOperation'](_0x214bf3),_0x1d5776['model']['applyOperation'](_0x214bf3);const _0x19f95b=_0x214bf3['key'];if(!_0xc11609['isRegisteredAttribute'](_0x19f95b))break;const _0x2709d6=_0x283dbd(_0x214bf3['range'],_0x1d5776['model']),_0x4fa3f9='suggestion:attribute:'+_0x19f95b+':'+kt()+':$aiSuggestion';_0x10349f['markers']['set'](_0x4fa3f9,_0x2709d6);break;}case'insert':{if(_0xd71035['batch']['addOperation'](_0x214bf3),_0x1d5776['model']['applyOperation'](_0x214bf3),dn(_0x10349f,_0x214bf3),_0x344047[_0xd0a2f7+0x1]&&'move'==_0x344047[_0xd0a2f7+0x1]['type'])break;const _0x361505=_0x214bf3['position'],_0x1c9f1b=_0x214bf3['howMany'],_0x220167=_0x283dbd(_0x1d5776['model']['createRange'](_0x361505,_0x361505['getShiftedBy'](_0x1c9f1b)),_0x1d5776['model']),_0x4242a0='suggestion:insertion:'+kt()+':$aiSuggestion';_0x10349f['markers']['set'](_0x4242a0,_0x220167);break;}case'split':{_0xd71035['batch']['addOperation'](_0x214bf3),_0x1d5776['model']['applyOperation'](_0x214bf3),dn(_0x10349f,_0x214bf3);const _0x174fe=_0x214bf3['splitPosition'],_0x5d84ca=_0x214bf3['moveTargetPosition'],_0x3c0652=_0x1d5776['model']['createRange'](_0x174fe,_0x5d84ca),_0x582939='suggestion:insertion:'+kt()+':$aiSuggestion';_0x10349f['markers']['set'](_0x582939,_0x3c0652);break;}case'move':{_0xd71035['batch']['addOperation'](_0x214bf3),_0x1d5776['model']['applyOperation'](_0x214bf3),dn(_0x10349f,_0x214bf3);const _0x47de70=_0x214bf3['getMovedRangeStart'](),_0x54927e=_0x214bf3['howMany'];for(let _0x2df453=0x0;_0x2df453<_0x54927e;_0x2df453++){const _0x34c9a8=_0x47de70['getShiftedBy'](_0x2df453)['nodeAfter'];_0x1b5b64['add'](_0x34c9a8);}break;}case'remove':{const _0x5d9b83=_0x214bf3['sourcePosition'],_0x21cc14=_0x214bf3['howMany'],_0x4d6bde=new _0x19e331(_0x5d9b83,_0x21cc14);_0xd71035['batch']['addOperation'](_0x4d6bde),_0x1d5776['model']['applyOperation'](_0x4d6bde),dn(_0x10349f,_0x214bf3);break;}}}}for(const _0x570dda of _0x1b5b64){const _0x87e387=_0x1d5776['model']['createRangeOn'](_0x570dda),_0x137f62='suggestion:formatBlock:$fakeWrap:'+kt()+':$aiSuggestion';_0x10349f['markers']['set'](_0x137f62,_0x283dbd(_0x87e387,_0x1d5776['model']));}});}(_0x2d80a2,_0x4c24d1,_0x522448):_0x522448['model']['change'](_0x77dd8e=>{for(const _0x25b29f of _0x2d80a2)if(!_0x22fa04(_0x25b29f)){if('remove'==_0x25b29f['type']){const _0x1e4037=_0x25b29f['sourcePosition'],_0x505ece=_0x25b29f['howMany'],_0x466f1d=new _0x19e331(_0x1e4037,_0x505ece);_0x77dd8e['batch']['addOperation'](_0x466f1d),_0x522448['model']['applyOperation'](_0x466f1d),dn(_0x4c24d1,_0x25b29f);}else{if('marker'==_0x25b29f['type']){const _0x4d0602=_0x25b29f['name'],_0x454fbf=_0x25b29f['newRange'];null!==_0x454fbf?_0x4c24d1['markers']['set'](_0x4d0602,_0x454fbf):_0x4c24d1['markers']['delete'](_0x4d0602);}else _0x25b29f['baseVersion']=null,_0x25b29f['isDocumentOperation']=!0x1,_0x77dd8e['batch']['addOperation'](_0x25b29f),_0x522448['model']['applyOperation'](_0x25b29f),dn(_0x4c24d1,_0x25b29f);}}}),_0x4f72e7){const _0x3a57b7=_n(_0x522448,_0x2d80a2,_0x4c24d1);An(_0x522448['model'],_0x3a57b7),function(_0x36c8c2,_0x168811){const _0x16cc36=_0x168811['getFirstRange']()['start'];let _0x41baee=_0x168811['getFirstRange']()['end'];const _0x2d9f7d=_0x16cc36['root'];(_0x41baee['textNode']||_0x41baee['nodeAfter']&&_0x41baee['nodeAfter']['is']('$text'))&&(_0x1b6802(_0x41baee,'...'),En(_0x2d9f7d,_0x41baee,0x3),_0x41baee=_0x41baee['getShiftedBy'](0x3)),(_0x16cc36['textNode']||_0x16cc36['nodeBefore']&&_0x16cc36['nodeBefore']['is']('$text'))&&(_0x1b6802(_0x16cc36,'...'),En(_0x2d9f7d,_0x16cc36,0x3),_0x16cc36['parent']==_0x41baee['parent']&&(_0x41baee=_0x41baee['getShiftedBy'](0x3)));const _0x404217=_0x36c8c2['createRange'](_0x36c8c2['createPositionAt'](_0x2d9f7d,0x0),_0x16cc36),_0x2ee40c=_0x36c8c2['createRange'](_0x41baee,_0x36c8c2['createPositionAt'](_0x2d9f7d,'end')),_0x58f053=[..._0x404217['getMinimalFlatRanges'](),..._0x2ee40c['getMinimalFlatRanges']()];_0x58f053['reverse']();for(const _0x175f9d of _0x58f053)_0x4f5333(_0x175f9d),pn(_0x2d9f7d,_0x175f9d);}(_0x522448['model'],_0x3a57b7);}return{'content':Rs(_0x522448['data']['stringify'](_0x4c24d1,{'showSuggestionHighlights':!0x0})),'hasChanges':!0x0};}function dn(_0x42cc11,_0x14bb86){for(const [_0xa95739,_0x4f2044]of _0x42cc11['markers']){const _0x857ca8=_0x2af2ad['_createFromRanges'](_0x4f2044['getTransformedByOperation'](_0x14bb86));_0x857ca8['root']==_0x42cc11?_0x42cc11['markers']['set'](_0xa95739,_0x857ca8):_0x42cc11['markers']['delete'](_0xa95739);}}function _n(_0x2eecf6,_0x295605,_0x9c4dd8){const _0x373ca4=_0x2eecf6['plugins']['get']('DocumentCompare');let _0x2513eb=_0x2eecf6['model']['createPositionAt'](_0x9c4dd8,Number['POSITIVE_INFINITY']),_0x8e7ade=_0x2eecf6['model']['createPositionAt'](_0x9c4dd8,0x0);for(const _0x33fbae of _0x295605){let _0x182278,_0x30999c;if(_0x373ca4['isMarkedRemoveOperation'](_0x33fbae))_0x182278=_0x33fbae['newRange']['start'],_0x30999c=_0x33fbae['newRange']['end'];else switch(_0x2513eb=gn(_0x2513eb,_0x33fbae),_0x8e7ade=gn(_0x8e7ade,_0x33fbae),_0x33fbae['type']){case'rename':_0x182278=_0x33fbae['position'],_0x30999c=_0x182278['getShiftedBy'](0x1);break;case'addAttribute':case'removeAttribute':case'changeAttribute':_0x182278=_0x33fbae['range']['start'],_0x30999c=_0x33fbae['range']['end'];break;case'insert':_0x182278=_0x33fbae['position'],_0x30999c=_0x182278['getShiftedBy'](_0x33fbae['howMany']);break;case'split':_0x182278=_0x33fbae['splitPosition'],_0x30999c=_0x33fbae['moveTargetPosition'];break;case'merge':{const _0x331cb9=_0x33fbae['targetPosition']['path']['slice'](0x0,-0x1);_0x182278=_0x2eecf6['model']['createPositionFromPath'](_0x9c4dd8,_0x331cb9),_0x30999c=_0x182278['getShiftedBy'](0x1);break;}case'move':case'remove':{const _0x20ed93=_0x33fbae['howMany'],_0x27ac23=_0x33fbae['sourcePosition']['_getTransformedByInsertion'](_0x33fbae['targetPosition'],_0x20ed93),_0x1cb485=_0x33fbae['getMovedRangeStart']();'remove'==_0x33fbae['type']?(_0x182278=_0x27ac23,_0x30999c=_0x27ac23):(_0x182278=_0x1cb485,_0x30999c=_0x1cb485['getShiftedBy'](_0x20ed93));break;}}_0x182278&&_0x182278['isBefore'](_0x2513eb)&&(_0x2513eb=_0x182278['clone'](),_0x2513eb['stickiness']='toNone'),_0x30999c&&_0x30999c['isAfter'](_0x8e7ade)&&(_0x8e7ade=_0x30999c['clone'](),_0x8e7ade['stickiness']='toNone');}return _0x2eecf6['model']['createSelection'](_0x2eecf6['model']['createRange'](_0x2513eb,_0x8e7ade));}function gn(_0x36f00f,_0x4f57c1){return'move'!=_0x4f57c1['type']&&'remove'!=_0x4f57c1['type']||_0x4f57c1['sourceRange']['containsPosition'](_0x36f00f)&&((_0x36f00f=_0x4f57c1['sourcePosition']['clone']())['stickiness']='toNone'),_0x36f00f['getTransformedByOperation'](_0x4f57c1);}function An(_0x5422f7,_0x1a7d6c){In(_0x5422f7,_0x1a7d6c,'forward');const _0x115c36=_0x1a7d6c['getFirstRange']();_0x1a7d6c['setTo']([]),_0x1a7d6c['setTo'](_0x115c36,{'backward':!0x0}),In(_0x5422f7,_0x1a7d6c,'backward');}function In(_0x5ce831,_0x3050bb,_0x487dee){let _0x349dfa=0x14;for(;_0x349dfa;){_0x5ce831['modifySelection'](_0x3050bb,{'unit':'word','direction':_0x487dee}),_0x349dfa--;const _0x267009=_0x3050bb['focus']['forward'==_0x487dee?'nodeBefore':'nodeAfter'];if(_0x267009&&_0x267009['is']('element')&&_0x5ce831['schema']['isBlock'](_0x267009)&&_0x5ce831['schema']['isObject'](_0x267009))break;}}function pn(_0x14484c,_0xc2d3c1){for(const [_0x3db7d7,_0x3c688b]of _0x14484c['markers']){const _0x4610c4=_0x3c688b['_getTransformedByDeletion'](_0xc2d3c1['start'],_0xc2d3c1['end']['offset']-_0xc2d3c1['start']['offset']);null!=_0x4610c4?_0x14484c['markers']['set'](_0x3db7d7,_0x4610c4):_0x14484c['markers']['delete'](_0x3db7d7);}}function En(_0x1733ec,_0x4c4bdd,_0x465e44){for(let [_0x144230,_0x461d81]of _0x1733ec['markers'])_0x461d81=_0x461d81['_getTransformedByInsertion'](_0x4c4bdd,_0x465e44,!0x1)[0x0],_0x1733ec['markers']['set'](_0x144230,_0x461d81);}function mn(_0x5bba3c,_0x3de167){for(const _0x59da25 of _0x5bba3c)'noop'!==_0x59da25['type']&&(_0x59da25['_aiSource']=_0x3de167);}var Tn=class extends _0x212144{static get['pluginName'](){return'AIGateway';}static get requires(){return[_0x5388eb,fs];}get['models'](){return this['context']['plugins']['get'](fs)['models'];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['apply'](_0x165c8d,_0x1f6250){const {applyMethod:_0x5e627e,roots:_0x21b729}=_0x1f6250,_0x13db04='suggest'===_0x5e627e;if(_0x165c8d['error']||!_0x165c8d['results']['length'])throw new ct('ai-gateway-apply-invalid-status',this,{'status':_0x165c8d['status']});if(_0x21b729){if(0x0===_0x21b729['length'])throw new ct('ai-gateway-apply-empty-roots',this);for(const {channelId:_0x39ecec,rootName:_0x7c68e}of _0x21b729)if(!_0x165c8d['results']['some'](_0x4d4c2c=>_0x4d4c2c['channelId']===_0x39ecec&&_0x4d4c2c['rootName']===_0x7c68e))throw new ct('ai-gateway-apply-root-not-found',this,{'channelId':_0x39ecec,'rootName':_0x7c68e});}const _0x24aa9d=_0x165c8d['results']['reduce']((_0x99f627,_0x4fb3e7)=>{if(_0x21b729&&!_0x21b729['some'](_0x23281b=>_0x23281b['channelId']===_0x4fb3e7['channelId']&&_0x23281b['rootName']===_0x4fb3e7['rootName']))return _0x99f627;if('completed'!==_0x4fb3e7['status'])throw new ct('ai-gateway-apply-invalid-status',this,{'status':_0x4fb3e7['status'],'channelId':_0x4fb3e7['channelId'],'rootName':_0x4fb3e7['rootName']});if(_0x13db04&&!_0x4fb3e7['editor']['plugins']['has']('TrackChanges'))throw new ct('ai-no-track-changes',this,{'channelId':_0x4fb3e7['channelId'],'rootName':_0x4fb3e7['rootName']});let _0x6968dc=_0x99f627['get'](_0x4fb3e7['editor']);return _0x6968dc||(_0x6968dc=[],_0x99f627['set'](_0x4fb3e7['editor'],_0x6968dc)),_0x6968dc['push'](_0x4fb3e7),_0x99f627;},new Map()),_0x451fe1=this['context']['plugins']['get'](_0x5388eb);for(const [_0x8b8334,_0x39efb9]of _0x24aa9d){const _0x4c583e=_0x39efb9['map'](_0x29c3b3=>{const _0x33175a=_0x8b8334['model']['createPositionAt'](_0x8b8334['model']['document']['getRoot'](_0x29c3b3['rootName']),0x0),_0x22bdf6=Qs(_0x8b8334,_0x29c3b3['rootName'],_0x29c3b3['contentRawOld'],_0x29c3b3['contentRawNew']);if(!_0x22bdf6)return _0x29c3b3['droppedUnsupportedInlineChange']=!0x0,null;const _0x18c1d7=_0x451fe1['getDiff'](_0x22bdf6['before'],_0x22bdf6['after'],{'anchor':_0x33175a,'markDeletions':_0x13db04,'targetEditor':_0x8b8334}),_0x142162=_0x8b8334['model']['document']['history']['getOperations'](_0x29c3b3['documentVersion']),_0x14e336={'document':_0x8b8334['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1},_0x134ad4=_0x3b7a23(_0x18c1d7['getOperations'](),_0x142162,_0x14e336)['operationsA'];return mn(_0x134ad4,_0x1f6250['aiSource']??'api'),_0x134ad4;});_0x8b8334['model']['change'](_0x57a08e=>{for(const _0x57ed3d of _0x4c583e)_0x57ed3d&&(_0x13db04?_0x8b8334['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x57ed3d):_0x451fe1['applyOperations'](_0x57a08e,_0x57ed3d));});}}mergeChangesIntoContent(_0x13e2bd,_0x50c517,_0x5da382){const _0x28bda5=new hn(),_0x149a7e=new sn();let _0x5b0896=_0x28bda5['parseAndNormalizeHTML'](_0x50c517);for(const _0x2815f9 of _0x13e2bd)try{const _0x1277b4=_0x28bda5['parseAndNormalizeHTML'](_0x2815f9['content']);_0x5b0896=_0x149a7e['merge'](_0x1277b4,_0x5b0896,{'cutAfterUnstable':!0x1,'replaceRemovedWith':void 0x0})['parsedContent'];}catch(_0x1e826e){throw new ct('ai-gateway-merge-failed',this,{..._0x2815f9},_0x1e826e);}return un(_0x5da382,_0x28bda5['parseAndNormalizeHTML'](_0x50c517),_0x5b0896,!0x1,!0x1)['content'];}};const wn=/* #__PURE__ -- @preserve */
28
+ dt(),Cn=['capabilitiesUpdated'];var fn=class extends wn{['_isWebSearchEnabled'];['_isReasoningEnabled'];constructor(){super(),this['_isWebSearchEnabled']=!0x1,this['_isReasoningEnabled']=!0x1;}init(){this['reset']();}reset(){this['setWebSearch'](!0x1),this['setReasoning'](!0x1);}getCapabilitiesConfig(){return{'isWebSearchEnabled':this['_isWebSearchEnabled'],'isReasoningEnabled':this['_isReasoningEnabled']};}static getCapabilitiesRequestData(_0x404b15){const _0x38a72d={};if(!_0x404b15)return _0x38a72d;('isWebSearchEnabled'in _0x404b15?_0x404b15['isWebSearchEnabled']:_0x404b15['webSearch'])&&(_0x38a72d['webSearch']={});const _0x4b538b='isReasoningEnabled'in _0x404b15?_0x404b15['isReasoningEnabled']:_0x404b15['reasoning'];return _0x4b538b&&(_0x38a72d['reasoning']='string'==typeof _0x4b538b?{'level':_0x4b538b}:{}),_0x38a72d;}toggleWebSearch(){this['setWebSearch'](!this['_isWebSearchEnabled']);}toggleReasoning(){this['setReasoning'](!this['_isReasoningEnabled']);}setWebSearch(_0x425ddf){_0x425ddf!==this['_isWebSearchEnabled']&&(this['_isWebSearchEnabled']=_0x425ddf,this['fire']('capabilitiesUpdated',this['getCapabilitiesConfig']()));}setReasoning(_0x4e82cc){_0x4e82cc!==this['_isReasoningEnabled']&&(this['_isReasoningEnabled']=_0x4e82cc,this['fire']('capabilitiesUpdated',this['getCapabilitiesConfig']()));}};function bn(_0x2ee7cd,_0x1f7a18,_0x5049f7,_0x4e914d){if(_0x2ee7cd instanceof ct)return _0x2ee7cd;const _0x13dbad=_0x2ee7cd?.['data'];return new ct(_0x1f7a18,_0x5049f7,void 0x0!==_0x13dbad?{..._0x4e914d,'backendData':_0x13dbad}:_0x4e914d,_0x2ee7cd);}var Sn=class{_editor;_rootName;['_channelId'];['_sessionId'];_documentVersion;_contentRawOld;_contentRawNew;['_error'];_isAborted=!0x1;_droppedUnsupportedInlineChange=!0x1;constructor(_0x163600){this['_editor']=_0x163600['editor'],this['_rootName']=_0x163600['rootName'],this['_channelId']=_0x163600['channelId'],this['_sessionId']=_0x163600['sessionId'];}get status(){return this['_error']?'error':this['_isAborted']?'aborted':void 0x0!==this['_contentRawNew']?'completed':'initialized';}get editor(){return this['_editor'];}get rootName(){return this['_rootName'];}get['channelId'](){return this['_channelId'];}get['sessionId'](){return this['_sessionId'];}get documentVersion(){return this['_documentVersion'];}set documentVersion(_0x27e11e){this['_documentVersion']=_0x27e11e;}get contentRawOld(){return this['_contentRawOld'];}set contentRawOld(_0x57a9cb){this['_contentRawOld']=_0x57a9cb;}get contentRawNew(){return this['_contentRawNew'];}set contentRawNew(_0x4e0a71){this['_contentRawNew']=_0x4e0a71;}get contentOld(){return this['_dropDataIds'](this['_contentRawOld']||'');}get contentNew(){return this['_dropDataIds'](this['_contentRawNew']||'');}get['error'](){return this['_error'];}set['error'](_0x148524){this['_error']=_0x148524;}get droppedUnsupportedInlineChange(){return this['_droppedUnsupportedInlineChange'];}set droppedUnsupportedInlineChange(_0x1223df){this['_droppedUnsupportedInlineChange']=_0x1223df;}abort(){this['_isAborted']=!0x0;}_dropDataIds(_0x2b1394){return _0x2b1394['replace'](/ data-id="[a-z0-9]+"/g,'');}},Rn=class extends Sn{['_summary']='';get['summary'](){return this['_summary'];}set['summary'](_0x5b215e){this['_summary']=_0x5b215e;}},On=class{_results;constructor(_0x296050=[]){this['_results']=_0x296050;}_status='initialized';['_error'];abort(){'error'!==this['_status']&&(this['_status']='aborted');}get status(){return this['_status'];}set status(_0x78a5cb){this['_status']=_0x78a5cb;}get['error'](){return this['_error'];}set['error'](_0x48ffd5){this['_status']='error',this['_error']=_0x48ffd5;}get results(){return this['_results'];}addResult(..._0x4540d5){this['_results']['push'](..._0x4540d5);}},vn=class extends _0x212144{static get['pluginName'](){return'AIDocumentProcessingGateway';}static get requires(){return[Is,tn,Tn,fs];}get['models'](){return this['context']['plugins']['get'](fs)['models'];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async processDocument(_0x1a054b,_0x3e9be3){if(!_0x1a054b)throw new ct('ai-documentprocessinggateway-missing-prompt',this);const _0x28fb9b=await this['context']['plugins']['get'](tn)['getDocumentData'](),_0x3ab288=_0x3e9be3['roots'];if(0x0===(_0x3ab288??_0x28fb9b)['length'])throw new ct('ai-documentprocessinggateway-empty-roots',this);if(_0x3ab288){for(const _0x211eda of _0x3ab288)if(!_0x28fb9b['some'](_0x1f5d61=>_0x1f5d61['rootName']===_0x211eda['rootName']&&_0x1f5d61['channelId']===_0x211eda['channelId']))throw new ct('ai-documentprocessinggateway-root-not-found',this,{'channelId':_0x211eda['channelId'],'rootName':_0x211eda['rootName']});}const _0x303895=_0x3ab288?_0x28fb9b['filter'](_0x5947db=>_0x3ab288['some'](_0x34f5d1=>_0x34f5d1['rootName']===_0x5947db['rootName']&&_0x34f5d1['channelId']===_0x5947db['channelId'])):_0x28fb9b,_0x399b4c=[],_0x2e2505=[];for(const _0x40ecfd of _0x303895){const _0x575670={'editor':_0x40ecfd['editor'],'rootName':_0x40ecfd['rootName'],'sessionId':_0x40ecfd['sessionId'],'channelId':_0x40ecfd['channelId'],'contentRawOld':_0x40ecfd['content'],'documentVersion':_0x40ecfd['version']};_0x399b4c['push'](_0x575670),_0x2e2505['push']({'type':'document','content':_0x575670['contentRawOld']});}const _0x30e478=this['context']['plugins']['get']('AIConnector')['processDocument']({'content':_0x2e2505,'prompt':_0x1a054b,'model':_0x3e9be3['model'],'capabilities':fn['getCapabilitiesRequestData'](_0x3e9be3['capabilities']),'contexts':_0x3e9be3['contexts']});let _0x5c6eb5;if(_0x3e9be3?.['signal']){_0x3e9be3['signal']['aborted']&&_0x30e478['abortController']['abort']();const _0x50e68d=_0x3e9be3['signal'],_0x271f6c=()=>_0x30e478['abortController']['abort']();_0x50e68d['addEventListener']('abort',_0x271f6c),_0x5c6eb5=()=>_0x50e68d['removeEventListener']('abort',_0x271f6c);}const _0x576c07=new On();let _0x136115=[];try{if(_0x136115=(await _0x30e478['getResult']())['documents'],!(_0x136115&&_0x136115['length']>0x0))throw new ct('ai-documentprocessinggateway-empty-reply',this);if(_0x136115['length']!==_0x2e2505['length'])throw new ct('ai-documentprocessinggateway-reply-count-mismatch',this,{'expected':_0x2e2505['length'],'received':_0x136115['length']});const _0x530a49=_0x136115['findIndex'](({document:_0x21a046})=>!_0x21a046['length']);if(-0x1!==_0x530a49){const _0x4e58b8=_0x399b4c[_0x530a49];throw new ct('ai-documentprocessinggateway-empty-root-content',this,{'channelId':_0x4e58b8['channelId'],'rootName':_0x4e58b8['rootName']});}_0x576c07['status']='completed';}catch(_0x25bca4){_0x25bca4 instanceof Error&&_0x25bca4['message']['includes']('ai-request-aborted')?_0x576c07['abort']():_0x576c07['error']=bn(_0x25bca4,'ai-documentprocessinggateway-run-failed',this);}finally{_0x5c6eb5&&_0x5c6eb5();}if('completed'===_0x576c07['status'])for(const [_0x8d1a5e,_0x39fc2b]of _0x399b4c['entries']()){const {channelId:_0x541eb6,contentRawOld:_0x1a072e,documentVersion:_0x4f9ae9,editor:_0x204a37,rootName:_0x513b6c,sessionId:_0x5d4c9e}=_0x39fc2b,_0x560c82=new Rn({'channelId':_0x541eb6,'editor':_0x204a37,'rootName':_0x513b6c,'sessionId':_0x5d4c9e});_0x560c82['contentRawOld']=_0x1a072e,_0x560c82['documentVersion']=_0x4f9ae9,_0x560c82['contentRawNew']=_0x136115[_0x8d1a5e]['document'],_0x560c82['summary']=_0x136115[_0x8d1a5e]['summary'],_0x576c07['addResult'](_0x560c82);}return _0x576c07;}applyResult(_0x4baadc,_0x54136c){this['context']['plugins']['get']('AIGateway')['apply'](_0x4baadc,_0x54136c);}};function kn(_0x562a02){return _0x562a02 instanceof Error&&('AbortError'===_0x562a02['name']||('AICoreError'===_0x562a02['name']?!0x0===_0x562a02['isAbort']:_0x562a02['message']['startsWith']('ai-request-aborted')));}var yn=class extends Error{['code'];severity;type;context;isAbort;constructor(_0x78325e){super(_0x78325e['code'],_0x78325e['cause']instanceof Error?{'cause':_0x78325e['cause']}:void 0x0),this['name']='AICoreError',this['code']=_0x78325e['code'],this['severity']=_0x78325e['severity']??'error',this['type']=_0x78325e['type']??'system',this['context']=_0x78325e['context'],this['isAbort']=_0x78325e['isAbort']??kn(_0x78325e['cause']);}},Nn=class extends _0x212144{static get['pluginName'](){return'AIErrorSink';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}createReporter(_0x35c909){return new xn(this,_0x35c909);}},xn=class{['_sink'];_component;constructor(_0x5d2d51,_0x365deb){this['_sink']=_0x5d2d51,this['_component']=_0x365deb;}['logError'](_0x4d9fcc,_0x210558={}){this['_emit'](_0x4d9fcc,_0x210558),this['_defaultLog'](_0x4d9fcc);}reportError(_0x1742a7,_0x7c7e29={}){this['_emit'](_0x1742a7,_0x7c7e29);}_emit(_0x3560b7,_0x2cb3c5){kn(_0x3560b7)||this['_sink']['fire']('error',{'error':_0x3560b7,'component':this['_component'],'context':_0x2cb3c5['context']});}_defaultLog(_0x1df7c5){if(!kn(_0x1df7c5)){if(_0x1df7c5 instanceof yn){if('user'===_0x1df7c5['type']||'network'===_0x1df7c5['type'])return;if('warning'===_0x1df7c5['severity'])return void console['warn'](this['_component'],_0x1df7c5);}console['error'](this['_component'],_0x1df7c5);}}};const Ln='ck-ai-button-primary',Pn='ck-ai-button-secondary',Dn='ck-ai-button-tertiary';function Hn(_0x110a44,_0x13acde){const _0x37c32d=new Mt(_0x110a44),_0x2731e3=Es(_0x110a44,'AI_TABS_LABEL_MINIMIZE'),_0x4e533d=Es(_0x110a44,'AI_TABS_LABEL_MAXIMIZE');return _0x37c32d['set']({'withText':!0x1,'icon':_0x579826,'tooltip':!0x0,'class':'ck-ai-tabs__resize\x20'+Dn}),_0x37c32d['bind']('label')['to'](_0x13acde,'isMaximized',_0x49bc26=>_0x49bc26?_0x2731e3:_0x4e533d),_0x37c32d['bind']('icon')['to'](_0x13acde,'isMaximized',_0xb93935=>_0xb93935?_0x10e858:_0x579826),_0x37c32d['bind']('isOn')['to'](_0x13acde,'isMaximized'),_0x37c32d['on']('execute',()=>{_0x13acde['fire']('resizeTabs');}),_0x37c32d;}function Mn(_0x340219){const _0x4d5848=new Pt(_0x340219);return _0x4d5848['attachToDom'](),_0x4d5848['bodyCollectionContainer']['classList']['add']('ck-ai-body'),_0x4d5848;}const Un=/* #__PURE__ -- @preserve */
29
+ At();var Vn=class extends Un{['id'];interactionId;type;content=new Map();['sources']=[];parsedContent=new Map();parsedMergedContent=new Map();['changeGroups']=[];areActionsDisabled=!0x1;_outdatedReasonByDocumentId;isFromHistory=!0x1;documentContextContent;_documentIdToSource=new Map();['aiResponseParser'];['aiResponseApplier'];['locale'];cachedSuggestionContentParts={'withDiff':[],'withoutDiff':[]};constructor({type:_0x51e892,isDone:_0x506ac3=!0x1,isComplete:_0x57006c,interactionId:_0x17298e,areActionsDisabled:_0x5da263,outdatedReasonByDocumentId:_0x16576c,isFromHistory:_0x16240c=!0x1,documentContextContent:_0x264d53,locale:_0x2a8b43,id:_0x4aba9e,channelsToEditors:_0x51856f}){super(),this['id']=_0x4aba9e||kt(),this['interactionId']=_0x17298e,this['type']=_0x51e892,this['areActionsDisabled']=!!_0x5da263,this['_outdatedReasonByDocumentId']=_0x16576c,this['isFromHistory']=_0x16240c,this['locale']=_0x2a8b43,this['aiResponseParser']=new hn(),this['aiResponseApplier']=new sn(),this['documentContextContent']=new Map(_0x264d53?.['map'](_0x10f0cf=>[_0x10f0cf['id'],Rs(_0x10f0cf['content'])])||[]),this['_documentIdToSource']=new Map(_0x264d53?.['map'](_0xcc6b1a=>[_0xcc6b1a['id'],{'editor':_0x51856f['get'](_0xcc6b1a['channelId']),'rootName':_0xcc6b1a['rootName']}])||[]),this['set']('isDone',_0x506ac3),this['set']('isComplete',_0x57006c??_0x506ac3),'text'===this['type']&&this['content']['set']('text','');}appendContent(_0x40221d,_0x402553){const _0x29ad57='text'===this['type']?'text':_0x402553;this['content']['has'](_0x29ad57)||this['content']['set'](_0x29ad57,''),this['content']['set'](_0x29ad57,this['content']['get'](_0x29ad57)+_0x40221d),this['onContentChange'](_0x29ad57);}['done'](_0x178ad3=!0x0){this['isComplete']=_0x178ad3,this['isDone']||(this['set']('isDone',!0x0),this['onContentChange']());}destroy(){this['stopListening']();}setChangeGroupState(_0x21bf18,_0x1501ae,_0x5d37e4){this['changeGroups'][_0x21bf18]['state']=_0x1501ae,this['changeGroups'][_0x21bf18]['outdatedReason']=_0x5d37e4,this['fire']('replyChangeGroupStateUpdated',{'reply':this,'index':_0x21bf18,'state':_0x1501ae,'outdatedReason':_0x5d37e4});}getContentParts({showDiff:_0x4174f3,groupIndex:_0x4b34c0}){const _0x3f9505=this['_getCachedContentParts'](_0x4174f3,_0x4b34c0);if(_0x3f9505)return _0x3f9505;let _0xcfee76;if(void 0x0===_0x4b34c0)_0xcfee76=this['changeGroups'];else{const _0x109498=this['changeGroups']['find'](({index:_0x2c39b6})=>_0x2c39b6===_0x4b34c0);if(!_0x109498)throw new ct('ai-reply-get-content-parts-group-not-found',null,{'aiReply':this,'groupIndex':_0x4b34c0});_0xcfee76=[_0x109498];}const _0x246556=ln({'showDiff':_0x4174f3,'changeGroups':_0xcfee76,'documentContextContent':this['documentContextContent']});return this['_setCachedContentParts'](_0x4174f3,_0x246556),_0x246556;}_getCachedContentParts(_0x46b0bd,_0x2d1e1b){const _0x436d12=_0x46b0bd?'withDiff':'withoutDiff';if(!this['cachedSuggestionContentParts'][_0x436d12]['length'])return null;const _0x217898=this['cachedSuggestionContentParts'][_0x436d12];if(void 0x0===_0x2d1e1b)return _0x217898['length']>0x0&&_0x217898['length']!==this['changeGroups']['length']?(this['_setCachedContentParts'](_0x46b0bd,null),null):_0x54d2c3(_0x217898);{const _0xdef76d=_0x217898['find'](({index:_0x7ddfd2})=>_0x7ddfd2===_0x2d1e1b);if(_0xdef76d)return[_0x54d2c3(_0xdef76d)];}return null;}_setCachedContentParts(_0x3157fa,_0x210a35){const _0x553fbd=_0x3157fa?'withDiff':'withoutDiff';_0x210a35?_0x210a35['forEach'](_0x2a60a9=>{const _0x335f4e=this['cachedSuggestionContentParts'][_0x553fbd],_0x22c33e=_0x335f4e['find'](({index:_0x149050})=>_0x149050===_0x2a60a9['index']);if(_0x22c33e){const _0xf358cd=_0x335f4e['indexOf'](_0x22c33e);_0x335f4e['splice'](_0xf358cd,0x1,_0x2a60a9);}else _0x335f4e['push'](_0x2a60a9);}):this['cachedSuggestionContentParts'][_0x553fbd]['length']=0x0;}onContentChange(_0x1e3928){if('modification'===this['type']){if(_0x1e3928)this['parsedContent']['set'](_0x1e3928,this['aiResponseParser']['parseAndNormalizeHTML'](this['content']['get'](_0x1e3928)));else{for(const [_0x152ffe,_0x46fd9c]of this['content'])this['parsedContent']['set'](_0x152ffe,this['aiResponseParser']['parseAndNormalizeHTML'](_0x46fd9c));}const _0x56e4e3=this['changeGroups'];for(const _0x190a70 of this['content']['keys']())this['updateChangeGroups'](_0x190a70);const _0x176323=this['_getDifferentChangeGroups'](_0x56e4e3,this['changeGroups']);(_0x176323['length']||this['isDone'])&&(this['fire']('replyContentUpdated',this,_0x176323),this['cachedSuggestionContentParts']['withDiff']['length']=this['cachedSuggestionContentParts']['withoutDiff']['length']=0x0);}else this['parsedContent']['set']('text',this['aiResponseParser']['convertMarkdownToHTML'](this['content']['get']('text'))),this['fire']('replyContentUpdated',this);}_getDifferentChangeGroups(_0x27a516,_0x40af0c){const _0x564834=[];for(const _0x5cbdab of _0x40af0c){const _0x1ebef7=_0x27a516[_0x5cbdab['index']];_0x1ebef7?_0x1ebef7['changes']['length']!==_0x5cbdab['changes']['length']?_0x564834['push'](_0x5cbdab):_0x1ebef7['changes']['forEach']((_0x12a44d,_0x28df85)=>{const _0x5688f1=_0x5cbdab['changes'][_0x28df85];_0x12a44d['id']!==_0x5688f1['id']&&_0x564834['push'](_0x5cbdab);}):_0x564834['push'](_0x5cbdab);}return _0x564834;}updateChangeGroups(_0x449fa8){const _0x29b358=this['documentContextContent']['get'](_0x449fa8),_0xd153f8=this['parsedContent']['get'](_0x449fa8);if(!_0x29b358||!_0xd153f8)return;const _0x59ab62=new _0x5b6203('p',{},[new _0x5b6203('span',{'style':'color:\x20#808080;\x20font-style:\x20italic'},[new _0x5be0d8(Es(this['locale'],'AI_SUGGESTION_CONTENT_PART_REMOVED'))])]),_0x4d5060=this['aiResponseApplier']['merge'](_0xd153f8,_0x29b358['cloneNode'](!0x0),{'cutAfterUnstable':!this['isDone']||!this['isComplete'],'replaceRemovedWith':_0x59ab62});this['parsedMergedContent']['set'](_0x449fa8,_0x4d5060['parsedContent']);let _0xfc2d24=[];if(_0x26a2ae(_0x2e0595=>{const _0x41a422=Ps(_0x2e0595,'data-id');if(!_0x41a422||!_0x3d2743(_0x41a422))return!0x1;const _0x16b0b9=[_0x2e0595,...Ms(_0x2e0595)]['at'](-0x2);if(_0x2e0595!=_0x16b0b9){const _0x5a4949=Ps(_0x16b0b9,'data-id');_0x3d2743(_0x5a4949)||(_0xfc2d24['push']({'node':_0x16b0b9,'id':_0x5a4949,'type':'modified'}),_0x4d5060['modifiedNodeIds']['push'](_0x5a4949));}else _0x4d5060['modifiedNodeIds']['includes'](_0x41a422)?_0xfc2d24['push']({'node':_0x2e0595,'type':'modified','id':_0x41a422}):_0x4d5060['newNodeIds']['includes'](_0x41a422)?_0xfc2d24['push']({'node':_0x2e0595,'type':'new','id':_0x41a422,'anchorId':Ps(_0x2e0595['previousSibling'],'data-id')}):_0xfc2d24['push']({'node':_0x2e0595,'type':'removed','id':_0x41a422});return!0x0;},this['parsedMergedContent']['get'](_0x449fa8)),_0xfc2d24=_0xfc2d24['filter'](({node:_0x53e9f9})=>[...Ms(_0x53e9f9),_0x53e9f9]['every'](_0x390c3e=>!Ps(_0x390c3e,'data-unstable'))),this['changeGroups']=this['changeGroups']['filter'](_0x1edbb7=>_0x1edbb7['documentId']!==_0x449fa8),0x0==_0xfc2d24['length'])return;const _0x2a3dcc=[[_0xfc2d24[0x0]]];for(let _0x178929=0x1;_0x178929<_0xfc2d24['length'];_0x178929++){const _0x32c436=_0x2a3dcc[_0x2a3dcc['length']-0x1],_0x515193=_0x32c436[_0x32c436['length']-0x1];_0xfc2d24[_0x178929]['node']['previousSibling']==_0x515193['node']&&'modified'!=_0xfc2d24[_0x178929]['type']&&'modified'!=_0x515193['type']?_0x32c436['push'](_0xfc2d24[_0x178929]):_0x2a3dcc['push']([_0xfc2d24[_0x178929]]);}for(const _0x484f34 of _0x2a3dcc){const _0x360949=_0x484f34[0x0],_0x5686a6=_0x484f34[_0x484f34['length']-0x1],_0x1bfc5f=_0x35a44f(_0x360949['node']['previousSibling']);_0x1bfc5f&&_0x484f34['unshift'](_0x1bfc5f);const _0x5d1252=_0x35a44f(_0x5686a6['node']['nextSibling']);_0x5d1252&&_0x484f34['push'](_0x5d1252);}ks('data-wrapped-id',null,this['parsedMergedContent']['get'](_0x449fa8))['forEach'](_0x38ce63=>{Ds(_0x38ce63,'data-wrapped-id',null);});const _0x2aefbc=new Map();ks('data-unwrapped-id',null,this['parsedMergedContent']['get'](_0x449fa8))['forEach'](_0x5e2d8d=>{const _0xe910f5=Ps(_0x5e2d8d,'data-unwrapped-id'),_0x3c6016=Ps(_0x5e2d8d,'data-id');_0x2aefbc['set'](_0x3c6016,_0xe910f5),Ds(_0x5e2d8d,'data-id',_0xe910f5),Ds(_0x5e2d8d,'data-unwrapped-id',null);});for(const _0x14e45c of _0xfc2d24){const _0x10ffca=_0x2aefbc['get'](_0x14e45c['id']);_0x10ffca&&(_0x14e45c['id']=_0x10ffca);}this['changeGroups']['push'](..._0x2a3dcc['map']((_0x2b29e8,_0x303f2b)=>{const _0x19eb95=this['_documentIdToSource']['get'](_0x449fa8),_0x9939fa=this['_outdatedReasonByDocumentId']?.['get'](_0x449fa8),_0x16b32f=this['areActionsDisabled']||void 0x0!==_0x9939fa;return{'changes':_0x2b29e8,'state':_0x16b32f?'outdated':'pending','outdatedReason':_0x16b32f?_0x9939fa:void 0x0,'index':_0x303f2b,'editor':_0x19eb95['editor'],'rootName':_0x19eb95['rootName'],'documentId':_0x449fa8};}));const _0x54e3a1=Array['from'](this['documentContextContent']['keys']());function _0x3d2743(_0x55bb3e){return _0x4d5060['modifiedNodeIds']['includes'](_0x55bb3e)||_0x4d5060['newNodeIds']['includes'](_0x55bb3e)||_0x4d5060['removedNodeIds']['includes'](_0x55bb3e);}function _0x35a44f(_0x5930e1){if(_0x5930e1&&Ps(_0x5930e1,'data-id')&&!Ps(_0x5930e1,'data-unstable')){const _0x1b09f0=Ps(_0x5930e1,'data-id');if(!_0x3d2743(_0x1b09f0))return{'node':_0x5930e1,'type':'context','id':_0x1b09f0};}return null;}this['changeGroups']['sort']((_0x54ef46,_0x4fa301)=>_0x54e3a1['indexOf'](_0x54ef46['documentId'])-_0x54e3a1['indexOf'](_0x4fa301['documentId'])),this['changeGroups']['forEach']((_0x3e1fc7,_0x131f8b)=>{_0x3e1fc7['index']=_0x131f8b;});}};const Bn=/* #__PURE__ -- @preserve */
30
+ dt(),Gn=['interactionCreated','interactionStarted','interactionStopped','interactionFinished','interactionDestroyed','replyCreated','replyContentUpdated','replyChangeGroupStateUpdated','setConversationTitle','webSearchStarted','webSearchFinished','reasoningStarted','reasoningFinished','toolDataReceived','error'];var Fn=class extends Bn{['id'];['replies']=[];currentReply;['messageId'];actionCallId;currentRequest;connector;isStopped=!0x1;isDestroyed=!0x1;['locale'];['_isReasoning']=!0x1;['_isWebSearching']=!0x1;_channelsToEditors;constructor({connector:_0x204a65,locale:_0x47e5af,channelsToEditors:_0x9e18b3}){super(),this['id']=kt(),this['connector']=_0x204a65,this['isStopped']=!0x0,this['locale']=_0x47e5af,this['_channelsToEditors']=_0x9e18b3||new Map();}async start(){await this['_run']();}async['resume'](_0x1531df){await this['_run'](_0x1531df);}async['_run'](_0x543c0e){const _0x40f4ea=[];let _0x41b050,_0x1ea90f,_0x296a84,_0x420821=!0x1;this['isStopped']=!0x1;try{this['currentRequest']=_0x543c0e||this['sendRequest'](),this['fire']('interactionStarted',this);const _0x1bcf1a=await this['currentRequest']['getStream']();for await(const _0x288767 of _0x1bcf1a){if(this['isStopped'])return;if('error'==_0x288767['event'])return void this['fire']('error',{'error':new ct('ai-chat-interaction-error',this)});switch(_0x288767['event']){case'message-metadata':this['messageId']=_0x288767['data']['messageId'];break;case'action-metadata':this['actionCallId']=_0x288767['data']['callId'];break;case'conversation-title':this['setConversationTitle'](_0x288767['data']['conversationTitle'],!0x0);break;case'source':_0x40f4ea['push'](_0x288767['data']['source']);break;case'web-search':this['_isWebSearching']||(this['_isWebSearching']=!0x0,this['fire']('webSearchStarted',this));break;case'reasoning':this['_isReasoning']||(this['_isReasoning']=!0x0,this['fire']('reasoningStarted',this));break;case'modification-delta':case'text-delta':this['resetReasoningState'](),this['resetWebSearchState'](),_0x41b050='modification-delta'==_0x288767['event']?'modification':'text',_0x1ea90f='modification-delta'==_0x288767['event']?_0x288767['data']['id']:void 0x0,this['currentReply']&&this['currentReply']['type']!=_0x41b050&&(this['currentReply']['done'](),this['currentReply']=void 0x0),this['currentReply']||(this['currentReply']=this['createReply']({'type':_0x41b050,'interactionId':this['id'],'id':_0x1ea90f,'channelsToEditors':this['_channelsToEditors'],...'modification-delta'==_0x288767['event']&&{'documentId':_0x288767['data']['documentId']}}),'modification'==_0x41b050&&(this['currentReply']['sources']=_0x40f4ea['splice'](0x0))),this['currentReply']['appendContent'](_0x288767['data']['textDelta'],_0x288767['data']['documentId']);break;case'mcp-tool-result':_0x296a84=JSON['parse'](_0x288767['data']['result']),this['_handleToolResultData']({'toolName':_0x288767['data']['toolName'],'data':_0x296a84['data'],'attributes':_0x296a84['attributes']});break;case'mcp-tool-notification':this['_handleToolNotificationData']({'toolName':_0x288767['data']['toolName'],'data':_0x288767['data']['data']});}}_0x420821=!0x0;}finally{this['isStopped']||(this['currentReply']&&_0x40f4ea['length']>0x0&&(this['currentReply']['sources']=_0x40f4ea['splice'](0x0)),this['_finalizeInteraction'](_0x420821),this['fire']('interactionFinished',this));}}stop(){this['isStopped']||(this['_finalizeInteraction'](),this['fire']('interactionStopped',this));}getReply(_0x146276){return this['replies']['find'](_0xd4309a=>_0xd4309a['id']===_0x146276);}destroy(){this['isDestroyed']||(this['stop'](),this['replies']['forEach'](_0x1b1b60=>_0x1b1b60['destroy']()),this['replies']=[],this['isDestroyed']=!0x0,this['fire']('interactionDestroyed',this),this['stopListening']());}createReply(_0x45b622){const _0x49f587=this['getDocumentContext'](),_0x5ac4d8=new Vn({'locale':this['locale'],'documentContextContent':_0x49f587?.['documents'],..._0x45b622});return this['replies']['push'](_0x5ac4d8),_0x5ac4d8['delegate'](...Gn)['to'](this),this['fire']('replyCreated',_0x5ac4d8),_0x5ac4d8;}setConversationTitle(_0x61c032,_0x39a08e=!0x1){this['fire']('setConversationTitle',_0x61c032,_0x39a08e);}resetWebSearchState(){this['_isWebSearching']&&(this['_isWebSearching']=!0x1,this['fire']('webSearchFinished',this));}resetReasoningState(){this['_isReasoning']&&(this['_isReasoning']=!0x1,this['fire']('reasoningFinished',this));}_handleToolResultData(_0x30aa2c){this['fire']('toolDataReceived',{'type':'result','toolName':_0x30aa2c['toolName'],'data':structuredClone(_0x30aa2c['data']||{}),'attributes':structuredClone(_0x30aa2c['attributes']||{})},this);}_handleToolNotificationData(_0x2e4e8a){this['fire']('toolDataReceived',{'type':'notification','toolName':_0x2e4e8a['toolName'],'data':structuredClone(_0x2e4e8a['data'])},this);}_finalizeInteraction(_0x4f3142=!0x1){this['isStopped']=!0x0,this['currentRequest']&&this['currentRequest']['abortController']['abort'](),this['currentReply']&&this['currentReply']['done'](_0x4f3142),this['currentRequest']=this['currentReply']=void 0x0;}};const Kn='defaultContextIds',Wn=/* #__PURE__ -- @preserve */
31
+ At();var Yn=class AIContext extends Wn{['_refs'];constructor(_0x29a6ef=[]){super(),this['_refs']=[..._0x29a6ef];}get['refs'](){return[...this['_refs']];}get isEmpty(){return 0x0===this['_refs']['length'];}cloneWith(..._0x37f408){return new AIContext([...this['_refs'],..._0x37f408]);}addDefaultContext(_0x1b6600){this['_refs']=[...this['_refs'],..._0x1b6600];}toRequestParts(_0x1fd7cf=[]){return[...this['_refs']['map'](As),..._0x1fd7cf];}toMessageAttributes(_0x298e01){return this['isEmpty']?_0x298e01:{..._0x298e01,[Kn]:[...new Set(this['_refs']['map'](_0x6efe3f=>_0x6efe3f['id']))]};}static getDefaultContextIds(_0xfbda77){const _0x3e0afc=_0xfbda77&&_0xfbda77[Kn];return new Set(Array['isArray'](_0x3e0afc)?_0x3e0afc:[]);}};const $n=new Map([['usage-limits-exceeded','ai-usage-limits-exceeded'],['rate-limits-exceeded','ai-rate-limits-exceeded'],['invalid-content-type','ai-invalid-content-type'],['invalid-request-data','ai-chat-invalid-request'],['model-already-set','ai-chat-model-already-set'],['model-not-found','ai-chat-model-not-found'],['unsafe-content-detected','ai-chat-unsafe-content-detected'],['unsupported-content-type','ai-chat-unsupported-content-type'],['content-too-large','ai-chat-content-too-large'],['unsupported-file-type','ai-chat-context-unsupported-file-type'],['file-too-large','ai-chat-context-file-too-large'],['file-too-many-pages','ai-chat-context-file-too-many-pages'],['form-data-size-limits-exceeded','ai-chat-context-form-data-size-limits-exceeded']]),qn=['contextItemAdded','contextItemRemoved','contextItemLoadingEnded','contextSent','error','addContextOptionsChanged','sourceResourcesLoaded','resourceStateChanged','uploadProgressChanged'];var Qn=class AIChatContext extends Yn{_connector;['_config'];['_ownerId'];constructor({connector:_0x198ff2,config:_0x54fe6c,ownerId:_0xd0d9e0}){super(),this['_connector']=_0x198ff2,this['_config']=_0x54fe6c,this['_ownerId']=_0xd0d9e0;}init(){this['_pendingContextItems']=new Map(),this['_conversationContextItems']=new Map(),this['_ongoingUploads']=new Map(),this['_ongoingUploadOperations']=new Map(),this['_setAddContextOptionsDefaultState']();}getPendingContextItems(){return new Map(this['_pendingContextItems']);}async populateFromMessage(_0x1164b8,_0x32e41e,_0x5272a8=new Set()){const _0x3416d1=new Map(),{contextItem:_0x1df7d4,unmatchedDocumentIds:_0x2d2191}=await this['_populateDocumentContextItem'](_0x1164b8,_0x32e41e);_0x1df7d4&&_0x3416d1['set'](_0x1df7d4['id'],_0x1df7d4);for(const _0x25fb5a of _0x1164b8){if('document'===_0x25fb5a['type'])continue;const _0x2315fe=await this['_createContextItemFromContent'](_0x25fb5a,_0x5272a8);'context'!==_0x2315fe['type']&&this['_addToConversationContextItem'](_0x2315fe),_0x3416d1['set'](_0x2315fe['id'],_0x2315fe);}return{'contextItems':_0x3416d1,'hasUnmatched':_0x2d2191['size']>0x0,'unmatchedDocumentIds':_0x2d2191};}async _populateDocumentContextItem(_0x293dd6,_0x4dd906){const _0x11c860=_0x293dd6['filter'](_0x29430f=>'document'===_0x29430f['type']);if(0x0===_0x11c860['length'])return{'unmatchedDocumentIds':new Set()};const _0x42d36e=_0x11c860['map'](_0x5848d7=>_0x5848d7['id']),_0x19a719=await this['_connector']['fetchDocuments'](this['_ownerId'],_0x42d36e)['getDocuments'](),_0x261619=new Map(_0x19a719['map'](_0x3726df=>[_0x3726df['id'],_0x3726df])),_0x9e042c=[],_0x2f5777=new Set();for(const _0x1912e2 of _0x11c860){const _0x3cec6a=_0x261619['get'](_0x1912e2['id']);_0x3cec6a&&(this['_matchDocumentToRoot'](_0x3cec6a,_0x4dd906)||_0x2f5777['add'](_0x3cec6a['id']),_0x9e042c['push']({'id':_0x3cec6a['id'],'content':_0x3cec6a['content'],'version':_0x3cec6a['attributes']?.['version']??0x0,'sessionId':_0x3cec6a['attributes']?.['sessionId']??null,'selection':[],'selectionSignature':'','channelId':_0x3cec6a['attributes']?.['channelId']??_0x4dd906[0x0]?.['config']['get']('collaboration.channelId')??'','rootName':_0x3cec6a['attributes']?.['rootName']??_0x4dd906[0x0]?.['model']['document']['getRoots']()[0x0]['rootName']??'','editorConfig':_0x1912e2['editorConfig']}));}const _0x2af9c0={'id':'current-document','uiId':'current-document','label':'Current\x20document','type':'document','hidden':this['_conversationContextItems']['has']('current-document'),'documents':_0x9e042c};return this['_addToConversationContextItem'](_0x2af9c0),this['toggleAddCurrentDocumentOptionVisibility'](),{'contextItem':_0x2af9c0,'unmatchedDocumentIds':_0x2f5777};}_matchDocumentToRoot(_0x33778d,_0x2bc82d){const _0x95fc6d=_0x33778d['attributes']?.['channelId'],_0xc94b10=_0x33778d['attributes']?.['rootName'];if(_0x95fc6d&&_0xc94b10){for(const _0x210447 of _0x2bc82d)if(_0x210447['config']['get']('collaboration.channelId')===_0x95fc6d){for(const _0x298645 of _0x210447['model']['document']['getRoots']())if('$graveyard'!==_0x298645['rootName']&&_0x298645['rootName']===_0xc94b10)return{'editor':_0x210447,'rootName':_0x298645['rootName']};}}}async _createContextItemFromContent(_0x1e4a5e,_0x189bb2=new Set()){return'mcp-tool-context'===_0x1e4a5e['type']?{'id':_0x1e4a5e['id'],'uiId':_0x1e4a5e['id'],'label':_0x1e4a5e['data']?.['label']||_0x1e4a5e['id'],'type':'mcp-tool-context','mcpServerName':_0x1e4a5e['mcpServerName'],'toolName':_0x1e4a5e['toolName'],'data':_0x1e4a5e['data']||{}}:{'id':_0x1e4a5e['id'],'uiId':_0x1e4a5e['id'],'label':_0x1e4a5e['attributes']?.['label']||_0x1e4a5e['name']||_0x1e4a5e['url']||_0x1e4a5e['id'],'type':_0x1e4a5e['type'],..._0x1e4a5e?.['attributes']?.['resourceId']?{'resourceId':_0x1e4a5e['attributes']?.['resourceId']}:{},...'context'===_0x1e4a5e['type']&&_0x189bb2['has'](_0x1e4a5e['id'])?{'hidden':!0x0}:{}};}getSentContextItems(){return new Map(this['_conversationContextItems']);}removeFromContext(_0x151925){this['_pendingContextItems']['get'](_0x151925)?.['isReadOnly']||this['_removeContextItem'](_0x151925);}clearPendingContextItems(){if(0x0===this['_pendingContextItems']['size'])return;for(const _0x3e561d of this['_pendingContextItems']['values']())'context'!==_0x3e561d['type']&&this['_removeContextItem'](_0x3e561d['uiId']);const _0x2431b0=this['_conversationContextItems']['get']('current-document')||this['_pendingContextItems']['get']('current-document');_0x2431b0&&this['_addContextItem']({..._0x2431b0,'isReadOnly':!0x0,'hidden':!0x0});}addToConversationContext(_0x417869){for(const _0x302f7e of _0x417869['values']())'context'!==_0x302f7e['type']&&this['_addToConversationContextItem'](_0x302f7e);this['clearPendingContextItems'](),this['fire']('contextSent',{'contextItems':Array['from'](this['getSentContextItems']()['values']())});}isCurrentDocumentInContext(){return this['_pendingContextItems']['has']('current-document');}isSelectionInContext(){return this['_pendingContextItems']['has']('selection');}isCurrentDocumentInConversation(){return this['_conversationContextItems']['has']('current-document');}static mapContextItemsToRequestData(_0x424bc1){return Array['from'](_0x424bc1['values']())['flatMap'](_0x5c3a84=>this['_mapContextItemToRequestData'](_0x5c3a84));}async addFilesToContext(_0x3dd035,_0x76d026,_0x3ead41='file'){const _0x5a4a60='files-'+kt();this['_startUploadOperation'](_0x5a4a60);try{await Promise['all'](_0x3dd035['map'](async _0xc25225=>{const _0x1b5d54='file-'+kt(),_0x3dd81f=_0x34830a(_0xc25225['name']),_0x16469c='file'===_0x3ead41&&_0xc25225['type']['startsWith']('image/')?'image':_0x3ead41;try{this['_addContextItem']({'type':_0x16469c,'label':_0x76d026?.['label']||_0x3dd81f,'uiId':_0x1b5d54,'resourceId':_0x76d026?.['resourceId']},!0x0);const _0x2c782a=this['_connector']['uploadFile'](this['_ownerId'],_0xc25225,_0x76d026);this['_ongoingUploads']['set'](_0x1b5d54,_0x2c782a['abortController']);const {id:_0x1796bb}=await _0x2c782a['getId']();this['_ongoingUploads']['delete'](_0x1b5d54),this['_finishContextItemLoading']({'type':_0x16469c,'id':_0x1796bb,'label':_0x76d026?.['label']||_0x3dd81f,'uiId':_0x1b5d54,'resourceId':_0x76d026?.['resourceId']},!0x1);}catch(_0x55ba83){if(this['_ongoingUploads']['delete'](_0x1b5d54),!kn(_0x55ba83)){const _0x2d8d26=new yn({'code':$n['get'](_0x55ba83['code'])||'ai-chat-file-upload-failed','cause':_0x55ba83,'context':{'fileName':_0x3dd81f}});this['fire']('error',{'error':_0x2d8d26});}this['_removeContextItem'](_0x1b5d54);}}));}finally{this['_finishUploadOperation'](_0x5a4a60);}}addCurrentDocumentToContext(_0x4df428){if(this['isCurrentDocumentInContext']()||!this['_addContextOptionsState']['document']['enabled'])return;const _0x399734={'type':'document','uiId':'current-document','label':_0x4df428,'isReadOnly':this['_conversationContextItems']['has']('current-document'),'hidden':this['_conversationContextItems']['has']('current-document')};this['_addContextItem'](_0x399734);}getCurrentDocumentContext(){return this['_pendingContextItems']['get']('current-document');}async updateCurrentDocuments(_0x54df64,_0x6636fc){const _0x146645=this['getCurrentDocumentContext']();if(!_0x146645)return;_0x54df64['length']>0x1&&_0x54df64['some'](_0x304a43=>!_0x304a43['description'])&&St('ai-chat-documents-missing-description');try{const _0x275b27=(_0x146645['documents']||[])['filter'](_0x36bf86=>_0x6636fc['has'](_0x36bf86['channelId']));if(!_0x54df64['length'])return void(_0x146645['documents']=_0x275b27);const _0x1c44f4=await this['_connector']['uploadDocuments'](this['_ownerId'],_0x54df64)['getIds']();if(_0x1c44f4['length']!==_0x54df64['length']||_0x1c44f4['some'](_0x16ec49=>!_0x16ec49?.['id'])){const _0x2e2241=new ct('ai-chat-document-upload-reply-mismatch',null);return void this['fire']('error',{'error':_0x2e2241});}const _0x586611=_0x54df64['map']((_0x624a2f,_0x8b13f9)=>{return{'id':_0x1c44f4[_0x8b13f9]['id'],'content':_0x624a2f['content'],'version':_0x624a2f['version'],'sessionId':_0x624a2f['sessionId'],'selection':(_0x26ab0a=_0x624a2f['selections'],_0x26ab0a?_0x26ab0a['map'](_0x336724=>({'start':_0x336724['start'],'end':_0x336724['end']})):[]),'selectionSignature':_0x624a2f['selectionSignature'],'channelId':_0x624a2f['channelId'],'rootName':_0x624a2f['rootName'],'editorConfig':_0x624a2f['editorConfig']};var _0x26ab0a;});_0x146645['documents']=[..._0x275b27,..._0x586611];}catch(_0x46311d){throw new yn({'code':'ai-chat-document-upload-failed','type':'network','cause':_0x46311d});}}addSelectionToContext(_0x1dad18){this['_addContextItem']({'type':'selection','label':_0x1dad18,'uiId':'selection','content':_0x1dad18});}removeSelectionFromContext(){this['_removeContextItem']('selection');}async addUrlToContext(_0x26265b,_0x18cb79){const _0x3a4e5e='url-'+kt();this['_startUploadOperation'](_0x3a4e5e);const _0x1bd9e5='url-'+kt();try{this['_addContextItem']({'type':'web-resource','label':_0x18cb79?.['label']||_0x26265b,'uiId':_0x1bd9e5,'resourceId':_0x18cb79?.['resourceId']},!0x0);const _0x4c61d7=this['_connector']['uploadUrl'](this['_ownerId'],_0x26265b,_0x18cb79);this['_ongoingUploads']['set'](_0x1bd9e5,_0x4c61d7['abortController']);const {id:_0x190ac9}=await _0x4c61d7['getId']();this['_ongoingUploads']['delete'](_0x1bd9e5),this['_finishContextItemLoading']({'type':'web-resource','id':_0x190ac9,'label':_0x18cb79?.['label']||_0x26265b,'uiId':_0x1bd9e5,'resourceId':_0x18cb79?.['resourceId']},!0x1);}catch(_0x64692b){this['_ongoingUploads']['delete'](_0x1bd9e5),kn(_0x64692b)||this['fire']('error',{'error':new ct('ai-chat-url-upload-failed',this,{'url':_0x26265b,'originalError':_0x64692b}),'url':_0x26265b}),this['_removeContextItem'](_0x1bd9e5);}finally{this['_finishUploadOperation'](_0x3a4e5e);}}addToolItemToContext(_0x2bb684){_0x2bb684['id']=_0x2bb684['id']??kt()['substring'](0x0,0x15),this['_pendingContextItems']['set'](_0x2bb684['uiId'],_0x2bb684),this['fire']('contextItemAdded',{'contextItem':_0x2bb684,'isLoading':!0x1});}async['loadSourceResources'](_0x21d431,_0x1deea2,_0x4bb695){const _0x1b8f9b=this['_addContextOptionsState']['sources']['find'](_0x16309f=>_0x16309f['id']===_0x21d431);if(!_0x1b8f9b)return this['fire']('error',{'error':new ct('ai-chat-source-not-found',this,{'sourceId':_0x21d431}),'sourceId':_0x21d431}),[];try{const _0x3ec8b8=(await _0x1b8f9b['getResources'](_0x1deea2))['map'](_0x1ca1ac=>{const _0x91bc7b=this['_isResourceInContext'](_0x1ca1ac['id']);return{..._0x1ca1ac,'isInContext':_0x91bc7b};});return _0x1b8f9b['resources']=_0x3ec8b8,this['fire']('sourceResourcesLoaded',{'sourceId':_0x21d431,'source':_0x1b8f9b,'resources':_0x3ec8b8,'uid':_0x4bb695}),_0x3ec8b8;}catch(_0x1b4a0f){return this['fire']('error',{'error':new ct('ai-chat-source-resources-load-failed',this,{'sourceId':_0x21d431,'originalError':_0x1b4a0f}),'sourceId':_0x21d431,'sourceLabel':_0x1b8f9b['label']}),[];}}async addResourceToContext(_0x512ab7,_0x541037){if(this['_isResourceInContext'](_0x541037['id']))return;if('context'===_0x541037['type'])return void this['_addContextItem']({'type':'context','id':_0x541037['id'],'label':_0x541037['label'],'uiId':'context-'+kt(),'resourceId':_0x541037['id']});let _0x4f7c0e=_0x541037['data'];if(!_0x4f7c0e&&_0x512ab7['getData'])try{_0x4f7c0e=await _0x512ab7['getData'](_0x541037['id']);}catch(_0x32d978){return void this['fire']('error',{'error':new ct('ai-chat-resource-load-failed',this,{'resourceId':_0x541037['id'],'sourceId':_0x512ab7['id'],'originalError':_0x32d978}),'resourceId':_0x541037['id'],'sourceId':_0x512ab7['id']});}if(_0x4f7c0e)switch(_0x541037['type']){case'web-resource':if('string'!=typeof _0x4f7c0e)return void this['fire']('error',{'error':new ct('ai-chat-context-invalid-data',this,{'resourceId':_0x541037['id'],'sourceId':_0x512ab7['id'],'expectedType':'string','actualType':typeof _0x4f7c0e}),'resourceId':_0x541037['id'],'sourceId':_0x512ab7['id']});await this['addUrlToContext'](_0x4f7c0e,{'label':_0x541037['label'],'resourceId':_0x541037['id']});break;case'file':if(!(_0x4f7c0e instanceof File))return void this['fire']('error',{'error':new ct('ai-chat-context-invalid-data',this,{'resourceId':_0x541037['id'],'sourceId':_0x512ab7['id'],'expectedType':'File','actualType':typeof _0x4f7c0e}),'resourceId':_0x541037['id'],'sourceId':_0x512ab7['id']});await this['addFilesToContext']([_0x4f7c0e],{'label':_0x541037['label'],'resourceId':_0x541037['id']});break;case'text':if('object'!=typeof _0x4f7c0e||!('content'in _0x4f7c0e)||!('type'in _0x4f7c0e))return void this['fire']('error',{'error':new ct('ai-chat-context-invalid-data',this,{'resourceId':_0x541037['id'],'sourceId':_0x512ab7['id'],'expectedType':'object\x20with\x20content\x20and\x20type\x20properties','actualType':typeof _0x4f7c0e}),'resourceId':_0x541037['id'],'sourceId':_0x512ab7['id']});_0x4f7c0e=AIChatContext['_convertTextResourceToFile'](_0x4f7c0e,_0x541037['label']),await this['addFilesToContext']([_0x4f7c0e],{'label':_0x541037['label'],'resourceId':_0x541037['id']},'text');break;case'mcp-tool-context':break;default:this['fire']('error',{'error':new ct('ai-chat-context-unsupported-type',this,{'resourceId':_0x541037['id'],'sourceId':_0x512ab7['id'],'resourceType':_0x541037['type']}),'resourceId':_0x541037['id'],'sourceId':_0x512ab7['id']});}else this['fire']('error',{'error':new ct('ai-chat-resource-no-data',this,{'resourceId':_0x541037['id'],'sourceId':_0x512ab7['id']}),'resourceId':_0x541037['id'],'sourceId':_0x512ab7['id']});}addContextSource(_0x8c577e){this['_addContextOptionsState']['sources']['some'](_0x43e974=>_0x43e974['id']===_0x8c577e['id'])||(this['_addContextOptionsState']['sources']['push']({..._0x8c577e,'resources':[]}),this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']}));}toggleAddCurrentDocumentOptionVisibility(_0x4e6c26){if(void 0x0!==_0x4e6c26)this['_addContextOptionsState']['document']['isHidden']=!_0x4e6c26;else{const _0x350a9a=this['isCurrentDocumentInContext']()||this['isCurrentDocumentInConversation']();this['_addContextOptionsState']['document']['isHidden']=_0x350a9a;}this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']});}static _convertTextResourceToFile(_0x3b4efa,_0x2db1b9){switch(_0x3b4efa['type']){case'markdown':return new File([_0x3b4efa['content']],_0x2db1b9,{'type':'text/markdown'});case'html':return new File([_0x3b4efa['content']],_0x2db1b9,{'type':'text/html'});default:return new File([_0x3b4efa['content']],_0x2db1b9,{'type':'text/plain'});}}static _mapContextItemToRequestData(_0x21be0e){switch(_0x21be0e['type']){case'file':case'image':case'text':return[{'type':'file','id':_0x21be0e['id']}];case'web-resource':return[{'type':'web-resource','id':_0x21be0e['id']}];case'context':return[{'type':'context','id':_0x21be0e['id']}];case'document':return _0x21be0e['documents']?.['length']?_0x21be0e['documents']['map'](({id:_0x4916c0,editorConfig:_0x715e3a,selection:_0x3bdaec})=>({'type':'document','id':_0x4916c0,..._0x715e3a&&{'editorConfig':_0x715e3a},..._0x3bdaec?.['length']&&{'selection':_0x3bdaec}})):[];case'mcp-tool-context':{const _0xba51f4=_0x21be0e;return[{'type':'mcp-tool-context','mcpServerName':_0xba51f4['mcpServerName'],'toolName':_0xba51f4['toolName'],'data':{..._0xba51f4['data'],'label':_0xba51f4['label']||_0xba51f4['data']?.['label']||_0xba51f4['id']},'id':_0xba51f4['id']}];}default:return[];}}_addContextItem(_0x3dfd97,_0x578223=!0x1){if(this['_pendingContextItems']['set'](_0x3dfd97['uiId'],_0x3dfd97),_0x3dfd97['hidden']||this['fire']('contextItemAdded',{'contextItem':_0x3dfd97,'isLoading':_0x578223}),'current-document'===_0x3dfd97['uiId']&&this['toggleAddCurrentDocumentOptionVisibility'](),_0x3dfd97['resourceId']){const _0x2c43b6=this['_findSourceIdsByResourceId'](_0x3dfd97['resourceId']);_0x2c43b6&&_0x2c43b6['forEach'](_0x26c241=>{this['_updateResourceInContextState'](_0x26c241,_0x3dfd97['resourceId'],!0x0);});}}_removeContextItem(_0x1af91e){const _0x282cea=this['_pendingContextItems']['get'](_0x1af91e),_0x4b9e13=this['_ongoingUploads']['get'](_0x1af91e);if(_0x4b9e13&&(_0x4b9e13['abort'](),this['_ongoingUploads']['delete'](_0x1af91e)),_0x282cea?.['resourceId']){const _0x2c1622=this['_findSourceIdsByResourceId'](_0x282cea['resourceId']);_0x2c1622&&_0x2c1622['forEach'](_0xdd09f3=>{this['_updateResourceInContextState'](_0xdd09f3,_0x282cea['resourceId'],!0x1);});}this['_pendingContextItems']['delete'](_0x1af91e),this['fire']('contextItemRemoved',{'uiId':_0x1af91e,'type':_0x282cea?.['type']}),'current-document'===_0x1af91e&&this['toggleAddCurrentDocumentOptionVisibility']();}_finishContextItemLoading(_0x33101a,_0xc0e97){if(this['_pendingContextItems']['has'](_0x33101a['uiId'])&&(this['_pendingContextItems']['set'](_0x33101a['uiId'],_0x33101a),this['fire']('contextItemLoadingEnded',{'contextItem':_0x33101a,'isLoading':_0xc0e97}),_0x33101a['resourceId'])){const _0x3515d6=this['_findSourceIdsByResourceId'](_0x33101a['resourceId']);_0x3515d6&&_0x3515d6['forEach'](_0x143649=>{this['_updateResourceInContextState'](_0x143649,_0x33101a['resourceId'],!0x0);});}}_addToConversationContextItem(_0x330b3c){this['_conversationContextItems']['set'](_0x330b3c['uiId'],_0x330b3c);}_setAddContextOptionsDefaultState(){this['_addContextOptionsState']={'document':{'enabled':!0x1!==this['_config']?.['document']?.['enabled'],'isHidden':!0x1},'urls':{'enabled':!0x1!==this['_config']?.['urls']?.['enabled']},'files':{'enabled':!0x1!==this['_config']?.['files']?.['enabled']},'sources':this['_getCustomSourcesInitialState'](),'customItems':this['_config']?.['customItems']?.['map'](_0x2b62cc=>({..._0x2b62cc,'enabled':!0x0}))??[]},this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']});}_getCustomSourcesInitialState(){return this['_config']?.['sources']?.['map'](_0x4243f3=>({..._0x4243f3,'resources':[]}))??[];}_isResourceInContext(_0x6bda6b){for(const _0x8b7a2f of this['_pendingContextItems']['values']())if(_0x8b7a2f['resourceId']===_0x6bda6b)return!0x0;for(const _0x368252 of this['_conversationContextItems']['values']())if(_0x368252['resourceId']===_0x6bda6b)return!0x0;return!0x1;}['_findSourceIdsByResourceId'](_0x20201f){const _0x57678e=[];for(const _0x50f3ff of this['_addContextOptionsState']['sources'])_0x50f3ff['resources']['find'](_0x10034d=>_0x10034d['id']===_0x20201f)&&_0x57678e['push'](_0x50f3ff['id']);return 0x0===_0x57678e['length']?null:_0x57678e;}_updateResourceInContextState(_0x5f128a,_0x59ae1c,_0x2caf5d){const _0x16754a=this['_addContextOptionsState']['sources']['find'](_0x52aae3=>_0x52aae3['id']===_0x5f128a);if(!_0x16754a)return;const _0x163459=_0x16754a['resources']['find'](_0x5ac902=>_0x5ac902['id']===_0x59ae1c);_0x163459&&(_0x163459['isInContext']=_0x2caf5d,this['fire']('resourceStateChanged',{'sourceId':_0x5f128a,'resourceId':_0x59ae1c,'isInContext':_0x2caf5d}));}_startUploadOperation(_0x3a85c9){this['_ongoingUploadOperations']['set'](_0x3a85c9,!0x0),this['_ongoingUploadOperations']['size']&&this['fire']('uploadProgressChanged',{'isUploadInProgress':!0x0});}_finishUploadOperation(_0x1a43d2){this['_ongoingUploadOperations']['delete'](_0x1a43d2),0x0===this['_ongoingUploadOperations']['size']&&this['fire']('uploadProgressChanged',{'isUploadInProgress':!0x1});}},Xn=class extends Fn{['userMessage'];conversationId;contextItems=new Map();capabilities;['model'];attributes;context;constructor(_0x1d1d77){super(_0x1d1d77),this['conversationId']=_0x1d1d77['conversationId'],this['contextItems']=_0x1d1d77['contextItems'],this['capabilities']=_0x1d1d77['capabilities'],this['userMessage']=_0x1d1d77['userMessage'],this['model']=_0x1d1d77['model'],this['attributes']=_0x1d1d77['attributes'],this['context']=_0x1d1d77['context']??new Yn();}sendRequest(){const _0x549276=Qn['mapContextItemsToRequestData'](this['contextItems']),_0x4880fa=this['context']['toRequestParts'](_0x549276);return this['connector']['queryAssistant']({'message':this['userMessage'],'conversationId':this['conversationId'],'parts':_0x4880fa,'capabilities':fn['getCapabilitiesRequestData'](this['capabilities']),'model':this['model'],'attributes':this['context']['toMessageAttributes'](this['attributes'])});}getDocumentContext(){return this['contextItems']['get']('current-document');}};const zn=/* #__PURE__ -- @preserve */
32
+ dt();var jn=class extends zn{['id'];isStarted=!0x1;isFromHistory;interactions=[];currentInteraction;selectedModel;connector;options;_abortReject;_channelsToEditors;_getSessionId;constructor(_0x180afe){super(),this['options']=_0x180afe,this['connector']=_0x180afe['connector'],this['chatModels']=_0x180afe['chatModels'],this['id']=_0x180afe['conversationId'],this['isFromHistory']=_0x180afe['isFromHistory'],this['_channelsToEditors']=_0x180afe['channelsToEditors'],this['_getSessionId']=_0x180afe['getSessionId'];}async init(_0x564152){try{this['chatContext']=new Qn({'connector':this['connector'],'config':_0x564152,'ownerId':this['id']}),this['chatContext']['delegate'](...qn)['to'](this),this['chatContext']['init'](),this['options']['contextLibrary']?.['resolveContext']({'feature':'chat','extraContexts':this['options']['extraContexts'],'context':this['chatContext']}),this['chatCapabilities']=new fn(),this['chatCapabilities']['delegate'](...Cn)['to'](this),this['chatCapabilities']['init']();const _0x1fde85=await this['chatModels']['getAvailableModels']();this['fire']('conversationInitialized',{'availableModels':_0x1fde85});const _0x5420f0=await this['chatModels']['resolveModel'](this['options']['selectedModelId']);_0x5420f0&&await this['setModel'](_0x5420f0);}catch(_0x4f74fa){const _0x454516=new yn({'code':'ai-chat-conversation-init-failed','cause':_0x4f74fa,'type':'network'});this['fire']('error',{'error':_0x454516});}}async start(){if(this['isStarted'])throw new ct('ai-chat-conversation-already-started',null,{'conversation':this});if(!this['selectedModel'])throw new ct('ai-chat-conversation-start-no-model-selected',null,{'conversation':this});try{const {id:_0x1d2756}=await this['connector']['startConversation'](this['id'],this['options']['group'])['getConversation']();this['id']=_0x1d2756,this['isStarted']=!0x0,this['fire']('conversationStarted',{'conversationId':this['id'],'selectedModel':this['selectedModel']});}catch(_0x76757a){const _0x409721=new yn({'code':'ai-chat-conversation-start-failed','cause':_0x76757a,'type':'network','context':{'conversationId':this['id']}});throw this['fire']('error',{'error':_0x409721}),_0x409721;}}async['load'](_0x27f164){try{const _0x5e6e73=await this['connector']['fetchConversation'](_0x27f164)['getConversation'](),_0x26eae4=await this['connector']['fetchConversationMessages'](_0x27f164)['getMessages'](),_0x5301c2=_0x26eae4[0x0]['model'];this['isStarted']=!0x0,this['id']=_0x5e6e73['id'],'title'in _0x5e6e73?this['fire']('setConversationTitle',_0x5e6e73['title'],!this['isFromHistory']):this['fire']('setConversationTitle','',!this['isFromHistory']),this['selectedModel']=await this['chatModels']['getModel'](_0x5301c2)??void 0x0,this['fire']('modelSelected',{'selectedModel':this['selectedModel'],'isDisabled':!0x0});const {streamingMessageId:_0x45d31a}=await this['_processMessagesToInteractions'](_0x26eae4,_0x5301c2);return _0x45d31a&&this['currentInteraction']?this['_resumeStream'](_0x45d31a):this['currentInteraction']=void 0x0,this;}catch(_0x5c5e56){const _0x3db6a1=new yn({'code':'ai-chat-conversation-init-from-id-failed','cause':_0x5c5e56,'type':'network','context':{'conversationId':_0x27f164}});throw this['fire']('error',{'error':_0x3db6a1}),_0x3db6a1;}}async _processMessagesToInteractions(_0x25b4a7,_0x3f54c1){let _0x55bb96,_0x13dbe3,_0x10aaee=new Set();for(const _0x49cdb5 of _0x25b4a7)if('user'===_0x49cdb5['role']){const {contextItems:_0x140131,unmatchedDocumentIds:_0x3e05c4}=await this['_extractContextItems'](_0x49cdb5);_0x10aaee=_0x3e05c4;const _0x633e51={'isReasoningEnabled':Object['hasOwn'](_0x49cdb5['capabilities'],'reasoning'),'isWebSearchEnabled':Object['hasOwn'](_0x49cdb5['capabilities'],'webSearch')};_0x55bb96=this['createInteraction']({'userMessage':_0x49cdb5['prompt'],'contextItems':_0x140131,'capabilities':_0x633e51,'modelId':_0x3f54c1,'attributes':_0x49cdb5['attributes'],'channelsToEditors':this['_channelsToEditors']}),this['currentInteraction']=_0x55bb96,_0x13dbe3=void 0x0,this['chatContext']['addToConversationContext'](this['currentInteraction']['contextItems']);}else{if('assistant'===_0x49cdb5['role']&&_0x55bb96){if('streaming'===_0x49cdb5['status']){_0x13dbe3=_0x49cdb5['id'];continue;}if('error'===_0x49cdb5['status'])continue;const _0x3b909f=[];for(const _0x47bf5e of _0x49cdb5['content'])switch(_0x47bf5e['type']){case'text':case'modification':{const _0x3adff1=_0x55bb96['getDocumentContext'](),_0xc2b320=this['_getOutdatedReasonsByDocumentId'](_0x3adff1,_0x10aaee),_0xc7cd6b=_0x3adff1?.['documents']??[],_0x4de21e=_0xc7cd6b['length']>0x0&&_0xc7cd6b['every'](_0x3b1a1b=>_0xc2b320['has'](_0x3b1a1b['id']));_0x55bb96['currentReply']?.['type']!==_0x47bf5e['type']&&(_0x55bb96['currentReply']=_0x55bb96['createReply']({'type':_0x47bf5e['type'],'isDone':!0x0,'interactionId':_0x55bb96['id'],'areActionsDisabled':_0x4de21e,'outdatedReasonByDocumentId':_0xc2b320,'isFromHistory':!0x0,'channelsToEditors':this['_channelsToEditors']}),_0x3b909f['length']>0x0&&(_0x55bb96['currentReply']['sources']=_0x3b909f['splice'](0x0))),_0x55bb96['currentReply']['appendContent'](_0x47bf5e['content'],_0x47bf5e['documentId']);break;}case'url':_0x3b909f['push'](_0x47bf5e);break;case'mcp-tool-result':{const {data:_0x2a43a0,attributes:_0x1ceec5}=JSON['parse'](_0x47bf5e['content']);_0x55bb96['_handleToolResultData']({'toolName':_0x47bf5e['toolName'],'data':_0x2a43a0,'attributes':_0x1ceec5});break;}}'cancelled'===_0x49cdb5['status']&&this['fire']('error',{'interactionId':_0x55bb96['id'],'error':new ct('ai-request-aborted',this)});}}return{'streamingMessageId':_0x13dbe3};}async _resumeStream(_0x269abc){if(this['currentInteraction'])try{const _0x1a8793=this['connector']['resumeStream'](this['id'],_0x269abc);await this['currentInteraction']['resume'](_0x1a8793);}catch(_0x3b08cf){_0x3b08cf instanceof ct&&this['fire']('error',{'interactionId':this['currentInteraction']?.['id'],'error':_0x3b08cf});}finally{this['currentInteraction']?.['stop'](),this['currentInteraction']=void 0x0;}}async _extractContextItems(_0x18d884){return _0x18d884['content']?this['chatContext']['populateFromMessage'](_0x18d884['content'],Array['from'](this['_channelsToEditors']['values']()),Yn['getDefaultContextIds'](_0x18d884['attributes'])):{'contextItems':new Map(),'unmatchedDocumentIds':new Set()};}async handleUserInteraction({userMessage:_0x1a613a,attributes:_0x48836e}){if(!this['isStarted'])throw new ct('ai-chat-handle-user-conversation-not-initialized',null,{'conversation':this});if(this['currentInteraction'])throw new ct('ai-chat-handle-user-interaction-already-in-progress',null,{'conversation':this});try{const _0x17ad85=new Map(this['getPendingContextItems']()),_0x433c64=this['chatCapabilities']['getCapabilitiesConfig'](),_0x4d63fa=this['selectedModel']['id'];this['currentInteraction']=this['createInteraction']({'userMessage':_0x1a613a,'contextItems':_0x17ad85,'capabilities':_0x433c64,'modelId':_0x4d63fa,'attributes':_0x48836e,'channelsToEditors':this['_channelsToEditors']}),await this['updateCurrentDocumentsInContext'](),await this['currentInteraction']['start'](),this['chatContext']['addToConversationContext'](this['currentInteraction']['contextItems']);}catch(_0x538848){if(_0x538848 instanceof ct)this['fire']('error',{'interactionId':this['currentInteraction']?this['currentInteraction']['id']:void 0x0,'error':_0x538848});else{const _0x1398a9=$n['get'](_0x538848['code'])||'ai-chat-handle-user-interaction-start-failed';this['fire']('error',{'interactionId':this['currentInteraction']?this['currentInteraction']['id']:void 0x0,'error':new ct(_0x1398a9,null,{'error':_0x538848})});}}finally{this['stopProcessing']();}}stopProcessing(){this['_abortReject']&&(this['_abortReject'](),this['_abortReject']=void 0x0),this['currentInteraction']&&(this['currentInteraction']['stop'](),this['currentInteraction']=void 0x0);}createInteraction({userMessage:_0x4c6c63,contextItems:_0x23da38,capabilities:_0x4ae3b6,modelId:_0x58043a,attributes:_0xff8a43,channelsToEditors:_0x4f2ccb}){const _0x15e96e=new Xn({'userMessage':_0x4c6c63,'contextItems':_0x23da38,'capabilities':_0x4ae3b6,'conversationId':this['id'],'connector':this['connector'],'locale':this['options']['locale'],'model':_0x58043a,'attributes':_0xff8a43,'channelsToEditors':_0x4f2ccb,'context':this['chatContext']['isEmpty']?void 0x0:new Yn(this['chatContext']['refs'])});return _0x15e96e['delegate'](...Gn)['to'](this),this['interactions']['push'](_0x15e96e),this['fire']('interactionCreated',_0x15e96e),_0x15e96e;}getInteraction(_0x446883){return this['interactions']['find'](_0x24fc28=>_0x24fc28['id']===_0x446883);}removeInteraction(_0x3b338f){const _0x32fbdc=this['getInteraction'](_0x3b338f);_0x32fbdc&&(_0x32fbdc['destroy'](),this['interactions']['splice'](this['interactions']['indexOf'](_0x32fbdc),0x1));}get lastInteraction(){return this['interactions'][this['interactions']['length']-0x1];}cancelLastInteractionStream(){const _0x158893=this['lastInteraction'];_0x158893?.['conversationId']&&_0x158893['messageId']&&this['connector']['cancelStream'](_0x158893['conversationId'],_0x158893['messageId'])['execute']()['catch'](()=>{});}addCurrentDocumentToContext(_0x325794){this['chatContext']['addCurrentDocumentToContext'](_0x325794);}async updateCurrentDocumentsInContext(){if(!this['isCurrentDocumentInContext']())return;const {changedIds:_0x1baeeb,unchangedIds:_0x2c6292}=this['_compareEditorStateWithDocumentContext'](),_0x4fa821=new Promise((_0x244b44,_0x325795)=>{this['_abortReject']=()=>_0x325795(new ct('ai-request-aborted',this));}),_0x5232f2=await Promise['race']([this['options']['aiEditing']['getDocumentData'](_0x1baeeb),_0x4fa821]);await Promise['race']([this['chatContext']['updateCurrentDocuments'](_0x5232f2,_0x2c6292),_0x4fa821]);}_compareEditorStateWithDocumentContext(){const _0xae2372=new Set(),_0x141bb7=new Set(),_0x11e2b7=this['options']['aiEditing']['getEditorsVersions'](),_0x577e35=this['options']['aiEditing']['getEditorsSelections'](),_0x1abd41=this['chatContext']['getCurrentDocumentContext']()['documents']||[],_0x382126=new Map(_0x1abd41['map'](({channelId:_0x4c2d9c,version:_0x8f7af5})=>[_0x4c2d9c,_0x8f7af5])),_0x44a778=new Map(_0x1abd41['map'](({channelId:_0x599ba4,selectionSignature:_0x13b415})=>[_0x599ba4,_0x13b415]));for(const [_0x30d8e9,_0x31e17b]of _0x11e2b7){const _0x8c5129=_0x577e35['get'](_0x30d8e9);_0x382126['get'](_0x30d8e9)!=_0x31e17b||_0x44a778['get'](_0x30d8e9)!=_0x8c5129?_0xae2372['add'](_0x30d8e9):_0x382126['has'](_0x30d8e9)&&_0x141bb7['add'](_0x30d8e9);}return{'changedIds':_0xae2372,'unchangedIds':_0x141bb7};}toggleAddCurrentDocumentOptionVisibility(_0x2705fe){this['chatContext']['toggleAddCurrentDocumentOptionVisibility'](_0x2705fe);}_getOutdatedReasonsByDocumentId(_0x59c517,_0x245c64){const _0x1eaf71=new Map();if(!_0x59c517||!_0x59c517['documents'])return _0x1eaf71;for(const _0x59edb9 of _0x59c517['documents']){const _0x3989c6=this['_channelsToEditors']['get'](_0x59edb9['channelId']);_0x3989c6&&'destroyed'!==_0x3989c6['state']?_0x59edb9['sessionId']!==this['_getSessionId'](_0x3989c6)?_0x1eaf71['set'](_0x59edb9['id'],'session-changed'):_0x245c64['has'](_0x59edb9['id'])&&_0x1eaf71['set'](_0x59edb9['id'],'content-removed'):_0x1eaf71['set'](_0x59edb9['id'],'editor-removed');}return _0x1eaf71;}addSelectionToContext(_0x2f6218){this['chatContext']['addSelectionToContext'](_0x2f6218);}removeSelectionFromContext(){this['chatContext']['removeSelectionFromContext']();}addFilesToContext(_0x21fd9e){this['chatContext']['addFilesToContext'](_0x21fd9e);}addUrlToContext(_0x4152d9){this['chatContext']['addUrlToContext'](_0x4152d9);}addToolItemToContext(_0x3f90e9){this['chatContext']['addToolItemToContext'](_0x3f90e9);}addResourceToContext(_0x2465f5,_0x3f18c6){this['chatContext']['addResourceToContext'](_0x2465f5,_0x3f18c6);}['loadSourceResources'](_0xe1299e,_0x378b27,_0x36bb6a){return this['chatContext']['loadSourceResources'](_0xe1299e,_0x378b27,_0x36bb6a);}removeFromContext(_0x48669c){this['chatContext']['removeFromContext'](_0x48669c);}setWebSearch(_0x439a05){this['chatCapabilities']['setWebSearch'](_0x439a05);}toggleWebSearch(){this['chatCapabilities']['toggleWebSearch']();}setReasoning(_0x14d589){this['chatCapabilities']['setReasoning'](_0x14d589);}toggleReasoning(){this['chatCapabilities']['toggleReasoning']();}isCurrentDocumentInContext(){return this['chatContext']['isCurrentDocumentInContext']();}isCurrentDocumentInConversation(){return this['chatContext']['isCurrentDocumentInConversation']();}isSelectionInContext(){return this['chatContext']['isSelectionInContext']();}getPendingContextItems(){return this['chatContext']['getPendingContextItems']();}addDefaultContext(_0x3540d1){_0x3540d1['length']&&this['chatContext']['addDefaultContext'](_0x3540d1);}async setModel(_0x15cbe9){_0x15cbe9?!0x1===await this['chatModels']['isAvailable'](_0x15cbe9)&&(St('ai-chat-conversation-set-model-not-available',{'conversation':this,'model':_0x15cbe9}),_0x15cbe9=(await this['chatModels']['getAvailableModels']())[0x0]):(St('ai-chat-conversation-set-model-null',{'conversation':this}),_0x15cbe9=(await this['chatModels']['getAvailableModels']())[0x0]),_0x15cbe9['id']!==this['selectedModel']?.['id']&&(this['selectedModel']=_0x15cbe9,this['chatCapabilities']['reset'](),this['fire']('modelSelected',{'selectedModel':_0x15cbe9}));}};function Jn({documentSuggestions:_0x22942b,transform:_0x1420aa,documentCompare:_0x37ded3,documentCompareOptions:_0x5673ef}){const _0x2bf711=new Map();for(const [_0x4a15ec,{groups:_0x1ebd05,documentContext:_0x4a7b0d,documentContent:_0x2ab0aa,editor:_0x4c784f}]of _0x22942b){const _0x409f72=_0x4a7b0d['content'],_0x484901=_0x4a7b0d['version'],_0x49ae1a=_0x2ab0aa['cloneNode'](!0x0);for(const {changes:_0x4b8127}of _0x1ebd05)$s(_0x49ae1a,_0x4b8127);const _0x5e778e=Os(_0x49ae1a),_0x26ef7a=Qs(_0x4c784f,_0x4a7b0d['rootName'],_0x409f72,_0x5e778e);if(!_0x26ef7a)continue;const _0x47202a=_0x37ded3['getDiff'](_0x26ef7a['before'],_0x26ef7a['after'],{'targetEditor':_0x4c784f,'anchor':_0x4a7b0d['rootName'],..._0x5673ef})['getOperations']();if(_0x1420aa){const _0x59eb37=_0x4c784f['model']['document']['history']['getOperations'](_0x484901),_0x2a6499={'document':_0x4c784f['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1};_0x2bf711['set'](_0x4a15ec,_0x3b7a23(_0x47202a,_0x59eb37,_0x2a6499)['operationsA']);}else _0x2bf711['set'](_0x4a15ec,_0x47202a);}return _0x2bf711;}function Zn({groups:_0x4384fb,documentContextContent:_0xa5599b,documents:_0x471f1d}){const _0x3dd770=new Map();for(const _0x2cf5f4 of _0x4384fb){const {documentId:_0xe28a94}=_0x2cf5f4,_0x1bff38=_0x3dd770['get'](_0xe28a94);if(_0x1bff38)_0x1bff38['groups']['push'](_0x2cf5f4),_0x1bff38['indexes']['push'](_0x2cf5f4['index']);else{const _0x5c8bea=_0x471f1d['find'](_0x3bde3e=>_0x3bde3e['id']===_0xe28a94),_0x2f2475=_0xa5599b['get'](_0xe28a94);if(!_0x5c8bea||!_0x2f2475)continue;_0x3dd770['set'](_0xe28a94,{'groups':[_0x2cf5f4],'documentContext':_0x5c8bea,'documentContent':_0x2f2475,'editor':_0x2cf5f4['editor'],'indexes':[_0x2cf5f4['index']]});}}return _0x3dd770;}function tr(_0x46c6c2,_0x583cd3){const _0x902cff=_0x46c6c2['files']['length']>0x0&&_0x46c6c2['files']['every'](_0x2713e8=>_0x2713e8['type']['startsWith']('image/')),_0x32bb04=_0x46c6c2['plainText']['trim']()['length']>0x0;if(_0x46c6c2['files']['length']>0x0&&_0x583cd3['filesEnabled']&&(!_0x902cff||!_0x32bb04)){const _0x3b1e75=_0x46c6c2['files']['filter'](_0x4138ae=>_0x4138ae['name']);return _0x3b1e75['length']>0x0?{'type':'file','files':_0x3b1e75}:null;}if(_0x583cd3['urlsEnabled']){const _0x148f3c=function(_0x3dc20b){const _0x3d5d05=_0x3dc20b['trim']();if(/\s/['test'](_0x3d5d05))return null;try{const _0x4685ea=new URL(_0x3d5d05);return'http:'!==_0x4685ea['protocol']&&'https:'!==_0x4685ea['protocol']?null:_0x4685ea['toString']();}catch{return null;}}(_0x46c6c2['plainText']);if(_0x148f3c)return{'type':'url','url':_0x148f3c};}const _0x30688c=_0x46c6c2['forceTextAttachment']?0x1:_0x583cd3['longTextThreshold']??0x1/0x0;if(_0x46c6c2['plainText']['length']>=Math['max'](_0x30688c,0x1)&&_0x583cd3['filesEnabled']){const _0x5e9a39=_0x583cd3['pastedTextLabel']+'.txt';return{'type':'text','files':[new File([_0x46c6c2['plainText']],_0x5e9a39,{'type':'text/plain'})]};}return null;}var er=class extends _0x212144{activeConversation;_aiEditing;_aiConnector;_aiChatUi;['_aiModels'];_aiContextLibrary;_contextLibrarySource=null;_hasAIChatBalloon=!0x1;_activeBalloon;_reporter;_batchToChanges=new Map();_currentPreviewedChangeGroup=null;_bodyCollection;_channelsToEditors=new Map();static get requires(){return[Is,Nn,_0x5388eb,fs];}static get['pluginName'](){return'AIChatController';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){this['set']('isConversationReady',!0x1),this['_bodyCollection']=Mn(this['context']['locale']),this['_aiConnector']=this['context']['plugins']['get']('AIConnector'),this['_aiChatUi']=this['context']['plugins']['get']('AIChatUI'),this['_aiEditing']=this['context']['plugins']['get']('AIEditing'),this['_reporter']=this['context']['plugins']['get'](Nn)['createReporter']('aichat'),this['_aiModels']=this['context']['plugins']['get'](fs)['models'],this['_aiContextLibrary']=this['context']['plugins']['get'](fs)['contextLibrary'];const _0x4775fa=this['context']['plugins']['get']('AITabs');this['listenTo'](this['_aiChatUi'],'startConversation',()=>{this['_startConversationSafely']();}),this['listenTo'](this['_aiChatUi'],'sendUserMessage',(_0x374160,_0x3e6e18)=>{this['sendMessage']({'message':_0x3e6e18});}),this['listenTo'](this['_aiChatUi'],'abortPromptStream',()=>{this['activeConversation']?.['stopProcessing']();}),this['listenTo'](_0x4775fa['view'],'change:activeTab',(_0x1a27e8,_0x481673,_0x3becca)=>{'chat'!==_0x3becca&&this['removeSelectionFromChatContext']();}),this['listenTo'](this['_aiChatUi'],'addDocumentToContext',()=>{this['addCurrentDocumentToChatContext']();}),this['listenTo'](this['_aiChatUi'],'addFileToContext',(_0x22424d,_0x477e99)=>{this['activeConversation']?.['addFilesToContext'](Array['from'](_0x477e99));}),this['listenTo'](this['_aiChatUi'],'addUrlToContext',(_0x4aad1a,_0x5742bf)=>{this['activeConversation']?.['addUrlToContext'](_0x5742bf);}),this['listenTo'](this['_aiChatUi'],'promptInputPaste',(_0x447115,_0x2c8b44)=>{const _0x367eae=this['activeConversation'];if(!_0x367eae)return;_0x2c8b44['hasDirectory']&&(_0x2c8b44['preventDefault'](),this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_CONTEXT_FOLDER_NOT_SUPPORTED'),'id':'folder-error-'+kt()}));const _0x2efc97=tr(_0x2c8b44,{'pastedTextLabel':Es(this['context']['locale'],'AI_CHAT_CONTEXT_PASTED_TEXT_NAME'),'longTextThreshold':this['context']['config']['get']('ai.chat.context.paste.textThreshold'),'filesEnabled':!0x1!==this['context']['config']['get']('ai.chat.context.files.enabled'),'urlsEnabled':!0x1!==this['context']['config']['get']('ai.chat.context.urls.enabled')});_0x2efc97&&(_0x2c8b44['preventDefault'](),'url'===_0x2efc97['type']?_0x367eae['addUrlToContext'](_0x2efc97['url']):_0x367eae['chatContext']['addFilesToContext'](_0x2efc97['files'],void 0x0,_0x2efc97['type']));}),this['listenTo'](this['_aiChatUi'],'executeCustomItemCallback',(_0x5981b3,_0x57691c)=>{_0x57691c['callback'](this['context']);}),this['listenTo'](this['_aiChatUi'],'addResourceToContext',(_0x17bf8a,_0x1388fc)=>{this['activeConversation']?.['addResourceToContext'](_0x1388fc['source'],_0x1388fc['resource']);}),this['listenTo'](this['_aiChatUi'],'removeContextItem',(_0x2a7c31,_0x14728a)=>{this['_removeFromContext'](_0x14728a);}),this['listenTo'](this['_aiChatUi'],'loadSourceResources',(_0x3149ef,_0x2a83e2)=>{this['activeConversation']?.['loadSourceResources'](_0x2a83e2['sourceId'],_0x2a83e2['query'],_0x2a83e2['uid']);}),this['listenTo'](this['_aiChatUi'],'toggleWebSearch',()=>{this['_toggleWebSearch']();}),this['listenTo'](this['_aiChatUi'],'toggleReasoning',()=>{this['_toggleReasoning']();}),this['listenTo'](this['_aiChatUi'],'selectModel',(_0x3f0a9f,_0x44996d)=>{this['activeConversation']?.['setModel'](_0x44996d);}),this['listenTo'](this['_aiChatUi'],'like',(_0x20a492,{replyId:_0x57db37})=>{console['log']('Liked\x20response',_0x57db37);}),this['listenTo'](this['_aiChatUi'],'dislike',(_0x3c41a3,{replyId:_0x4bf43f})=>{console['log']('Disliked\x20response',_0x4bf43f);}),this['listenTo'](this['_aiChatUi'],'insertSuggestion',(_0x4b39fa,_0x3971b2)=>{this['_insertSuggestion'](_0x3971b2);}),this['listenTo'](this['_aiChatUi'],'showChangeInText',(_0x3f1652,{replyId:_0x1769cf,partIndex:_0x17447d})=>{this['_aiChatBalloonShowDiff']=this['_aiChatUi']['showDiff'],this['_openBalloonFor'](_0x1769cf,_0x17447d);}),this['listenTo'](this['_aiChatUi'],'mouseOverSuggestion',(_0x5ad375,{replyId:_0x4a26b3,partIndex:_0xc134ef})=>{const _0x5794f5=this['_getDocumentRangeForReplyChanges'](_0x4a26b3,_0xc134ef);if(!_0x5794f5)return;const {reply:_0x2b5c83}=this['getInteractionAndReplyById'](_0x4a26b3);'$graveyard'!=_0x5794f5['range']['root']['rootName']&&this['_aiEditing']['showFakeVisualSelection']({'editor':_0x2b5c83['changeGroups'][_0xc134ef]['editor'],'ranges':[_0x5794f5['range']],'id':'change-area','priority':0xa});}),this['listenTo'](this['_aiChatUi'],'mouseLeaveSuggestion',()=>{this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['listenTo'](this['_aiChatUi'],'applySuggestion',(_0x2356cd,_0x11e929)=>{this['_aiEditing']['hideFakeVisualSelection']('change-area'),this['_applySuggestion'](_0x11e929);}),this['listenTo'](this['_aiChatUi'],'toggleSuggestionDisplayMode',async(_0x159dbb,{replyId:_0x4d8047,showDiff:_0x133465})=>{const {interaction:_0x3f9a37,reply:_0x2773d0}=this['getInteractionAndReplyById'](_0x4d8047),_0x8490b2=_0x2773d0['getContentParts']({'showDiff':_0x133465});await this['_aiChatUi']['updateFeedItemAIReplySuggestionContent']({'id':_0x3f9a37['id']+':'+_0x2773d0['id'],'parts':_0x8490b2});}),this['listenTo'](this['_aiChatUi'],'rejectSuggestion',(_0x58ea0a,{replyId:_0x1e11e5,partIndex:_0x2ab041})=>{this['_rejectSuggestion']({'replyId':_0x1e11e5,'partIndex':_0x2ab041}),this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['set']('_aiChatBalloonShowDiff',!0x1),this['on']('interactionCreated',(_0x54d42a,_0x39d1d8)=>{this['_aiChatUi']['addFeedItemUserMessage'](_0x39d1d8);}),this['on']('replyCreated',(_0x324ea3,_0x229468)=>{this['_addFeedItemReply'](_0x229468);});}afterInit(){this['context']instanceof _0x2a0bfb?this['_integrateEditor'](this['context']):this['listenTo'](this['context']['editors'],'add',(_0x546cc4,_0x2f1584)=>{_0x2f1584['on']('ready',()=>{this['_integrateEditor'](_0x2f1584);});}),this['context']['config']['get']('ai.chat.context')?.['contextLibrary']?.['enabled']&&this['_setUpContextLibrarySource'](),this['_initConversation']();}async _initConversation(){const _0x1d97b6=this['context']['config']['get']('ai.chat.initialConversation');let _0x421348=_0x1d97b6;('lastCreated'!=_0x1d97b6||(_0x421348=await this['_getLastCreatedConversationId'](),_0x421348))&&('new'==_0x421348?await this['_startConversationSafely']():await this['loadConversation'](_0x421348));}async destroy(){return this['_stopLastInteraction'](),this['_bodyCollection']['detachFromDom'](),super['destroy']();}async loadConversation(_0x322b41){this['_closeActiveBalloon'](),this['context']['plugins']['get'](gs)['view']['activateTab']('chat'),this['_aiChatUi']['setFeedItemRenderingStrategy']('static'),this['_aiChatUi']['toggleLoadingSkeleton'](!0x0),this['_detachFromActiveConversation'](),this['_stopLastInteraction'](),this['_aiChatUi']['toggleConversationLoading'](!0x0);try{this['_aiChatUi']['emptyConversationTitle'](),await this['_aiConnector']['fetchConversation'](_0x322b41)['getConversation'](),await this['_startConversationSafely']({'id':_0x322b41}),await this['activeConversation']['load'](_0x322b41),this['activeConversation']['isCurrentDocumentInConversation']()&&this['addCurrentDocumentToChatContext'](),this['set']('isConversationReady',!0x0),this['activeConversation']?.['currentInteraction']?this['_aiChatUi']['enableControls']():this['_aiChatUi']['toggleConversationLoading'](!0x1);}catch(_0x173f8b){this['_aiChatUi']['resetConversationTitle'](),this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION'),'id':_0x322b41}),this['_reporter']['logError'](new ct('ai-chat-conversation-not-found',this,void 0x0,_0x173f8b),{'context':{'operation':'load-conversation'}}),await this['_stopLastInteraction'](),this['_aiChatUi']['disableControls'](),this['set']('isConversationReady',!0x1),this['_aiChatUi']['resetChatBusyStateToIdle'](),this['activeConversation']?.['cancelLastInteractionStream']();}finally{this['_aiChatUi']['startAutoScroll']({'smooth':!0x1}),this['_aiChatUi']['setFeedItemRenderingStrategy']('streaming'),this['_aiChatUi']['toggleLoadingSkeleton'](!0x1);}}registerToolDataCallback(_0x1becfe){let _0x26cf72=null,_0x5efa60=null;this['on']('toolDataReceived',(_0x4a5a19,_0x3cbe71,_0x4ced28)=>{_0x4ced28['id']!==_0x26cf72&&(_0x26cf72=_0x4ced28['id'],_0x5efa60=this['_getAIChatFeedAPI'](_0x4ced28)),_0x1becfe(_0x3cbe71,_0x5efa60);});}addCurrentDocumentToChatContext(){bs(this['context'])['length']&&this['activeConversation']?.['addCurrentDocumentToContext'](Es(this['context']['locale'],'AI_CHAT_CONTEXT_CURRENT_DOCUMENT'));}async addSelectionToChatContext(_0x12c75c){const _0x1ca951=this['_aiEditing']['getSelectionText'](_0x12c75c);this['activeConversation']?.['addSelectionToContext'](_0x1ca951),this['addCurrentDocumentToChatContext']();}removeSelectionFromChatContext(){this['activeConversation']?.['removeSelectionFromContext']();}focusPromptInput(){this['_aiChatUi']['focusPromptInput']();}async startConversation(_0x47d7ad){await this['_startConversationSafely']({'modelId':_0x47d7ad?.['modelId'],'contexts':_0x47d7ad?.['contexts']});}async['sendMessage']({message:_0x12652d,attributes:_0x233030}){if(!this['activeConversation'])throw new ct('ai-chat-controller-no-active-conversation');this['activeConversation']['id']&&this['activeConversation']['isStarted']&&(this['_aiChatUi']['startInteraction'](),await this['activeConversation']['handleUserInteraction']({'userMessage':_0x12652d,'attributes':_0x233030}));}getGroupId(){const _0x84f668=this['context']['config']['get']('collaboration.channelId');if(!_0x84f668)throw new ct('ai-missing-channel-id',this);return _0x84f668;}_handleRemovedConversation(_0x9c5471){this['activeConversation']['id']===_0x9c5471&&this['_startConversationSafely']();}['_isGroupReadOnly'](_0x56e3a9){return!(!_0x56e3a9['editor']||'destroyed'===_0x56e3a9['editor']['state']||!_0x56e3a9['editor']['isReadOnly']);}_isGroupWriteable(_0x3e2be1){return!(!_0x3e2be1['editor']||'destroyed'===_0x3e2be1['editor']['state']||_0x3e2be1['editor']['isReadOnly']);}_computeSuggestionGating(_0x2ee808){const _0x5a63ba=new Map();for(const _0x4e1690 of _0x2ee808['changeGroups'])_0x5a63ba['set'](_0x4e1690['index'],this['_isGroupReadOnly'](_0x4e1690));const _0x12ad3b=new Set(_0x2ee808['getContentParts']({'showDiff':this['_aiChatUi']['showDiff']})['filter'](_0x4f98f0=>_0x4f98f0['hasChanges'])['map'](_0x3bf35b=>_0x3bf35b['index']));return{'readOnlyByIndex':_0x5a63ba,'isAcceptAllEnabled':_0x2ee808['changeGroups']['some'](_0x539eb5=>'pending'===_0x539eb5['state']&&this['_isGroupWriteable'](_0x539eb5)&&_0x12ad3b['has'](_0x539eb5['index']))};}_refreshSuggestionGating(){if(this['activeConversation']){for(const _0x31b7e3 of this['activeConversation']['interactions'])for(const _0x1159ba of _0x31b7e3['replies'])'modification'===_0x1159ba['type']&&this['_aiChatUi']['hasFeedItem'](_0x1159ba['id'])&&this['_aiChatUi']['setSuggestionGating'](_0x1159ba['id'],this['_computeSuggestionGating'](_0x1159ba));}if(this['_activeBalloon']&&this['_currentPreviewedChangeGroup']){const {reply:_0x4bb97d}=this['getInteractionAndReplyById'](this['_currentPreviewedChangeGroup']['replyId']),_0x5ef874=_0x4bb97d['changeGroups']['find'](_0x51c562=>_0x51c562['index']===this['_currentPreviewedChangeGroup']['partIndex']);_0x5ef874&&this['_activeBalloon']['setTargetReadOnly'](this['_isGroupReadOnly'](_0x5ef874));}}_prepareDocumentSuggestions(_0x290135){const {reply:_0x32b7a5,interaction:_0x53a597}=this['getInteractionAndReplyById'](_0x290135['replyId']),_0x11abdb=void 0x0!==_0x290135['partIndex']?[_0x32b7a5['changeGroups'][_0x290135['partIndex']]]:_0x32b7a5['changeGroups']['filter'](_0x50d735=>'pending'===_0x50d735['state']&&!this['_isGroupReadOnly'](_0x50d735)),_0x1db40f=_0x11abdb['map'](_0x3c7955=>_0x32b7a5['changeGroups']['indexOf'](_0x3c7955)),_0x347d50=qs(_0x32b7a5['changeGroups'],_0x32b7a5['documentContextContent']);return _0x1db40f['forEach'](_0x5a2d92=>{if(_0x347d50['has'](_0x5a2d92))return;const _0x34189e=this['_getDocumentRangeForReplyChanges'](_0x290135['replyId'],_0x5a2d92);_0x34189e&&'$graveyard'!=_0x34189e['range']['root']['rootName']?(_0x32b7a5['setChangeGroupState'](_0x5a2d92,'accepted'),void 0x0!==_0x290135['partIndex']&&this['_scrollToSuggestionRange'](_0x34189e['range'],!0x1,_0x34189e['targetEditor'])):_0x32b7a5['setChangeGroupState'](_0x5a2d92,'outdated',this['_getOutdatedReason'](_0x32b7a5['changeGroups'][_0x5a2d92]));}),Zn({'groups':_0x11abdb['filter'](_0x43e5ad=>'accepted'===_0x43e5ad['state']),'documentContextContent':_0x32b7a5['documentContextContent'],'documents':_0x53a597['getDocumentContext']()?.['documents']??[]});}_insertSuggestion(_0x10dfc5){const _0x4fc297=this['context']['plugins']['get'](_0x5388eb),{reply:_0x211b3a,interaction:_0x393c8d}=this['getInteractionAndReplyById'](_0x10dfc5['replyId']),_0x240132=this['_prepareDocumentSuggestions'](_0x10dfc5),_0x2bced7=Jn({'documentSuggestions':_0x240132,'transform':!0x0,'documentCompare':_0x4fc297,'documentCompareOptions':{'markDeletions':!0x0}});for(const [_0x236c39,_0x5dca73]of _0x2bced7){const {editor:_0x4b0eef,indexes:_0x37cde7}=_0x240132['get'](_0x236c39);if(!_0x4b0eef['plugins']['has']('TrackChanges')){St('ai-no-track-changes',{'editor':_0x4b0eef});continue;}let _0xba2c6f;mn(_0x5dca73,'chat'),_0x4b0eef['model']['change'](_0x4cddfc=>{_0xba2c6f=_0x4cddfc['batch'],_0x4b0eef['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x5dca73),this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['_batchToChanges']['set'](_0xba2c6f,{'interactionId':_0x393c8d['id'],'replyId':_0x211b3a['id'],'indexes':_0x37cde7});}this['_updateRatings'](_0x211b3a);}_applySuggestion(_0x4f3388){const _0x59854d=this['context']['plugins']['get'](_0x5388eb),{reply:_0x8ffbd1,interaction:_0x3e98ee}=this['getInteractionAndReplyById'](_0x4f3388['replyId']),_0x5864e3=this['_prepareDocumentSuggestions'](_0x4f3388),_0x588d15=Jn({'documentSuggestions':_0x5864e3,'transform':!0x0,'documentCompare':_0x59854d,'documentCompareOptions':{'markDeletions':!0x1}});for(const [_0xafc9ba,_0x14cc5c]of _0x588d15){const {editor:_0x3163c2,indexes:_0x5ea787}=_0x5864e3['get'](_0xafc9ba);let _0x3dd931;mn(_0x14cc5c,'chat');try{_0x3163c2['model']['change'](_0x350789=>{_0x3dd931=_0x350789['batch'],_0x59854d['applyOperations'](_0x350789,_0x14cc5c);}),this['_batchToChanges']['set'](_0x3dd931,{'interactionId':_0x3e98ee['id'],'replyId':_0x8ffbd1['id'],'indexes':_0x5ea787});}catch(_0x1b5c35){throw this['_reporter']['logError'](new yn({'code':'ai-applying-suggestion-failed','type':'runtime','cause':_0x1b5c35})),_0x1b5c35;}}this['_updateRatings'](_0x8ffbd1);}_rejectSuggestion(_0x5148){const {reply:_0x40e590}=this['getInteractionAndReplyById'](_0x5148['replyId']);_0x40e590['setChangeGroupState'](_0x5148['partIndex'],'rejected');}['_openBalloonFor'](_0x2dc55a,_0x46d390){if(!this['_hasAIChatBalloon'])return;const {reply:_0x3fdfef}=this['getInteractionAndReplyById'](_0x2dc55a),_0x2004c1=_0x3fdfef['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff']});if(!_0x2004c1['length'])return;let _0x2fe180,_0xc8739e;if(void 0x0!==_0x46d390?(_0xc8739e=_0x2004c1['find'](_0x54265c=>_0x54265c['index']==_0x46d390),_0x2fe180=_0xc8739e?.['index']):(_0xc8739e=_0x2004c1[0x0],_0x2fe180=_0xc8739e['index']),!_0xc8739e)return void _0x3fdfef['setChangeGroupState'](_0x46d390??0x0,'outdated','editor-removed');if(this['_currentPreviewedChangeGroup']?.['replyId']==_0x2dc55a&&this['_currentPreviewedChangeGroup']?.['partIndex']==_0x2fe180)return;const _0x151d77=this['_getUserPresentableContentPartDocumentRange'](_0x2dc55a,_0x3fdfef,_0xc8739e),_0x25bddc=_0x3fdfef['changeGroups']['find'](_0x240f99=>_0x240f99['index']==_0x2fe180),_0x477490=_0x25bddc['editor'],_0x131dcf=_0x477490['plugins']['get']('AIChatBalloon');if(this['_activeBalloon']&&this['_activeBalloon']!==_0x131dcf&&this['_activeBalloon']['close'](),!_0x151d77)return _0x131dcf['close'](),void(this['_activeBalloon']=void 0x0);this['_activeBalloon']=_0x131dcf,this['_currentPreviewedChangeGroup']={'replyId':_0x2dc55a,'partIndex':_0x2fe180},this['_scrollToSuggestionRange'](_0x151d77,!0x0,_0x477490);const _0x2a3518=this['_getPresentableSiblingContentPartIndex'](_0x2dc55a,_0x2fe180,'next');_0x131dcf['clearContent'](),_0x131dcf['updateContent']({'part':_0xc8739e,'renderingStrategy':'static'}),_0x131dcf['open']({'index':_0x2fe180,'title':Es(this['context']['locale'],'AI_BALLOON_HEADER_TITLE',(_0x2fe180+0x1)['toString']()),'showRotator':null!==_0x2a3518,'ranges':[_0x151d77],'areActionsDisabled':_0x3fdfef['areActionsDisabled'],'targetEditor':_0x477490,'isTargetReadOnly':this['_isGroupReadOnly'](_0x25bddc)}),_0x131dcf['setState']('pending'),this['_aiChatUi']['scrollFeedToSuggestion'](_0x2dc55a,_0x2fe180),this['_aiChatUi']['setFeedItemAIReplySuggestionPartActive']({'id':_0x2dc55a,'index':_0x2fe180,'isActive':!0x0});}_closeActiveBalloon(){this['_activeBalloon']?.['close'](),this['_activeBalloon']=void 0x0,this['_currentPreviewedChangeGroup']=null;}_getPresentableSiblingContentPartIndex(_0x33eef3,_0x99e5e1,_0x1755bc){const {reply:_0x111dc3}=this['getInteractionAndReplyById'](_0x33eef3),_0x5efd88=_0x111dc3['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff']});if(0x1==_0x5efd88['length'])return null;const _0x3314f0='next'==_0x1755bc?0x1:-0x1;function _0x8ee6b8(_0x4d6f42){const _0x4f7262=(_0x4d6f42+_0x3314f0+_0x5efd88['length'])%_0x5efd88['length'];return{'siblingIndex':_0x4f7262,'siblingPart':_0x5efd88[_0x4f7262]};}const _0x1fd51b=_0x5efd88['findIndex'](_0x358ca6=>_0x358ca6['index']==_0x99e5e1);let {siblingIndex:_0xbdd4b2,siblingPart:_0x580f61}=_0x8ee6b8(_0x1fd51b);for(;!this['_getUserPresentableContentPartDocumentRange'](_0x33eef3,_0x111dc3,_0x580f61);)if({siblingIndex:_0xbdd4b2,siblingPart:_0x580f61}=_0x8ee6b8(_0xbdd4b2),_0xbdd4b2===_0x1fd51b)return null;return _0x580f61['index'];}_getOutdatedReason(_0x9d8013){return _0x9d8013?.['editor']&&'destroyed'!==_0x9d8013['editor']['state']?'content-removed':'editor-removed';}_getUserPresentableContentPartDocumentRange(_0x16f25f,_0x419f5f,_0x5b8c04){const _0x3a60b6=_0x419f5f['changeGroups'];if(!_0x5b8c04['hasChanges'])return null;const _0x29203c=_0x3a60b6['find'](_0x2efb8d=>_0x2efb8d['index']==_0x5b8c04['index']);if('pending'!==_0x29203c?.['state'])return null;if(!_0x29203c?.['editor']||'destroyed'===_0x29203c['editor']['state'])return _0x419f5f['setChangeGroupState'](_0x5b8c04['index'],'outdated',this['_getOutdatedReason'](_0x29203c)),null;const _0x748ab2=this['_getDocumentRangeForReplyChanges'](_0x16f25f,_0x5b8c04['index']);if(!_0x748ab2)return _0x419f5f['setChangeGroupState'](_0x5b8c04['index'],'outdated',this['_getOutdatedReason'](_0x29203c)),null;const {range:_0x563fd7,currentIndex:_0x21cc86}=_0x748ab2;return'$graveyard'==_0x563fd7['root']['rootName']?(_0x419f5f['setChangeGroupState'](_0x21cc86,'outdated',this['_getOutdatedReason'](_0x29203c)),null):_0x748ab2['range'];}_getDocumentRangeForReplyChanges(_0x177f8b,_0x117c3b){const {reply:_0x1158c5,interaction:_0x4cd6ba}=this['getInteractionAndReplyById'](_0x177f8b),_0x246548=_0x1158c5['changeGroups']['filter'](_0x1cc658=>'pending'==_0x1cc658['state']),_0x485251=_0x246548['map'](_0x47747d=>_0x1158c5['changeGroups']['indexOf'](_0x47747d));void 0x0===_0x117c3b&&(_0x117c3b=_0x485251[0x0]);const _0x2f2ba8=_0x485251['indexOf'](_0x117c3b);if(-0x1==_0x2f2ba8)return null;const _0x3927b3=_0x246548[_0x2f2ba8],_0xa4bb4a=_0x3927b3['editor'];if(!_0xa4bb4a||'destroyed'===_0xa4bb4a['state'])return null;const _0x5998c4=Gs(_0xa4bb4a,_0x3927b3['rootName']),_0x587125=_0x1158c5['documentContextContent']['get'](_0x3927b3['documentId']),_0x5bc2b8=new _0x35605c([]),_0x4f3a42=new _0x35605c([]);for(const _0xc7b180 of _0x3927b3['changes'])if('removed'!=_0xc7b180['type']&&_0x4f3a42['children']['push'](_0xc7b180['node']['cloneNode'](!0x0)),'new'!=_0xc7b180['type']){const _0xf6bb80=_0xdb5da(_0x47c3ff=>Ps(_0x47c3ff,'data-id')==_0xc7b180['id'],_0x587125,!0x0);_0x5bc2b8['children']['push'](_0xf6bb80['cloneNode'](!0x0));}if(0x0==_0x5bc2b8['children']['length']){if(_0x3927b3['changes'][0x0]['anchorId']){const _0x2f25a3=vs('data-id',_0x3927b3['changes'][0x0]['anchorId'],_0x587125);_0x5bc2b8['children']['unshift'](_0x2f25a3['cloneNode'](!0x0)),_0x4f3a42['children']['unshift'](_0x2f25a3['cloneNode'](!0x0)),_0x2f25a3['nextSibling']&&(_0x5bc2b8['children']['push'](_0x2f25a3['nextSibling']['cloneNode'](!0x0)),_0x4f3a42['children']['push'](_0x2f25a3['nextSibling']['cloneNode'](!0x0)));}else{const _0xd07d0a=_0x587125['children'][0x0];if(!_0xd07d0a)return null;_0x5bc2b8['children']['push'](_0xd07d0a['cloneNode'](!0x0)),_0x4f3a42['children']['push'](_0xd07d0a['cloneNode'](!0x0));}}if(_0x5998c4&&qs(_0x1158c5['changeGroups'],_0x1158c5['documentContextContent'])['has'](_0x3927b3['index']))return null;const _0x527220=_0x4cd6ba['getDocumentContext'](),_0x5320d1=_0x527220['documents']['find'](_0x4f4af8=>_0x4f4af8['id']==_0x3927b3['documentId'])['content'],_0x379ff4=_0xa4bb4a['model']['document']['getRoot'](_0x3927b3['rootName']),_0x29bb0f=_0xa4bb4a['data']['parse'](_0x5320d1,_0x379ff4),_0xb394b2=_0x5998c4?Ws(Os(_0x5bc2b8)):Os(_0x5bc2b8),_0x7321d5=_0xa4bb4a['data']['parse'](_0xb394b2,_0x379ff4),_0x5ee60d=_0xa4bb4a['data']['parse'](_0xb394b2,_0x379ff4),_0x481e84=_0xa4bb4a['model']['createPositionAt'](_0x7321d5,0x0),_0x3f3209=_0x5998c4?Ws(Os(_0x4f3a42)):Os(_0x4f3a42),_0x2a87ab={'targetEditor':_0xa4bb4a,'anchor':_0x481e84,'markDeletions':!0x1};let _0x9f6fe7;try{_0x9f6fe7=_0xa4bb4a['plugins']['get'](_0x5388eb)['getDiff'](_0xb394b2,_0x3f3209,_0x2a87ab)['getOperations']();}catch(_0x4399d4){return this['_reporter']['reportError'](new yn({'code':'ai-chat-suggestion-diff-failed','type':'runtime','severity':'warning','cause':_0x4399d4,'context':{'replyId':_0x177f8b,'partIndex':_0x117c3b}})),null;}if(!_0x9f6fe7['length'])return null;_0xa4bb4a['model']['change'](_0x51db3e=>{for(const _0x2088c7 of _0x9f6fe7)if(!_0x22fa04(_0x2088c7)){if('remove'==_0x2088c7['type']){const _0x31a1b8=_0x2088c7['sourcePosition'],_0x24ed91=_0x2088c7['howMany'],_0xf6c63=new _0x19e331(_0x31a1b8,_0x24ed91);_0x51db3e['batch']['addOperation'](_0xf6c63),_0xa4bb4a['model']['applyOperation'](_0xf6c63);}else'marker'!==_0x2088c7['type']&&(_0x2088c7['baseVersion']=null,_0x2088c7['isDocumentOperation']=!0x1,_0x51db3e['batch']['addOperation'](_0x2088c7),_0xa4bb4a['model']['applyOperation'](_0x2088c7));}});const _0x454a18=_n(_0xa4bb4a,_0x9f6fe7,_0x7321d5);An(_0xa4bb4a['model'],_0x454a18);const _0x50e4f9=_0x454a18['getFirstRange']()['start']['path']['slice'](),_0x255cc3=_0x454a18['getFirstRange']()['end']['path']['slice'](),_0x532c6b=[];let _0x4ae2cb=_0x7321d5,_0x39a4d8=_0x5ee60d;for(let _0x12addf=0x0;_0x12addf<_0x255cc3['length'];_0x12addf++){const _0x1a2dd9=_0x4ae2cb['maxOffset']-_0x255cc3[_0x12addf];_0x532c6b[_0x12addf]=_0x39a4d8['maxOffset']-_0x1a2dd9,_0x4ae2cb=_0x4ae2cb['getChildAtOffset'](_0x255cc3[_0x12addf]),_0x39a4d8=_0x39a4d8['getChildAtOffset'](_0x532c6b[_0x12addf]);}const _0x384f78=_0xa4bb4a['model']['createRange'](_0xa4bb4a['model']['createPositionFromPath'](_0x5ee60d,_0x50e4f9),_0xa4bb4a['model']['createPositionFromPath'](_0x5ee60d,_0x532c6b)),_0x596a9b=_0x384f78['start']['path']['slice'](),_0x165654=_0x384f78['end']['path']['slice']();if(!_0x5998c4){const _0x948d8a=_0x5ee60d['getChild'](0x0)['getAttribute'](_0x4274f2),_0x31e7c6=Array['from'](_0x29bb0f['getChildren']())['find'](_0x5e18b3=>_0x5e18b3['getAttribute'](_0x4274f2)==_0x948d8a)['getPath']();_0x596a9b[0x0]=_0x31e7c6[0x0]+_0x596a9b[0x0],_0x165654[0x0]=_0x31e7c6[0x0]+_0x165654[0x0];}let _0x500ce6=_0xa4bb4a['model']['createRange'](_0xa4bb4a['model']['createPositionFromPath'](_0xa4bb4a['model']['document']['getRoot'](_0x3927b3['rootName']),_0x596a9b),_0xa4bb4a['model']['createPositionFromPath'](_0xa4bb4a['model']['document']['getRoot'](_0x3927b3['rootName']),_0x165654));const _0xa9d133=_0x527220['documents']['find'](_0x586f3e=>_0x586f3e['id']==_0x3927b3['documentId'])['version'],_0x2dbcb3=_0xa4bb4a['model']['document']['history']['getOperations'](_0xa9d133);for(const _0x25a3ef of _0x2dbcb3)_0x500ce6=_0x2af2ad['_createFromRanges'](_0x500ce6['getTransformedByOperation'](_0x25a3ef));return{'range':_0x500ce6,'currentIndex':_0x117c3b,'targetEditor':_0xa4bb4a};}_integrateEditorBalloon(_0x2ebcdb){if(!_0x2ebcdb['plugins']['has']('AIChatBalloon'))return;const _0x6e4d8c=_0x2ebcdb['plugins']['get']('AIChatBalloon');this['_hasAIChatBalloon']=!0x0,_0x6e4d8c['bind']('showDiff')['to'](this,'_aiChatBalloonShowDiff'),this['listenTo'](_0x6e4d8c,'toggleSuggestionDisplayMode',()=>{const {replyId:_0x530adb,partIndex:_0x7130a4}=this['_currentPreviewedChangeGroup'];this['_aiChatBalloonShowDiff']=!this['_aiChatBalloonShowDiff'];const {reply:_0x3ce63b}=this['getInteractionAndReplyById'](_0x530adb),_0x28c94a=_0x3ce63b['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff'],'groupIndex':_0x7130a4});_0x6e4d8c['updateContent']({'part':_0x28c94a[0x0],'renderingStrategy':'static','keepErrors':!0x0});}),this['listenTo'](_0x6e4d8c,'applySuggestion',()=>{const {replyId:_0x3d15ff,partIndex:_0x4f2a13}=this['_currentPreviewedChangeGroup'];this['_applySuggestion']({'replyId':_0x3d15ff,'partIndex':_0x4f2a13}),_0x6e4d8c['setState']('accepted');}),this['listenTo'](_0x6e4d8c,'insertSuggestion',()=>{const {replyId:_0x38dac4,partIndex:_0x58dc5e}=this['_currentPreviewedChangeGroup'];this['_insertSuggestion']({'replyId':_0x38dac4,'partIndex':_0x58dc5e}),_0x6e4d8c['setState']('accepted');}),this['listenTo'](_0x6e4d8c,'rejectSuggestion',()=>{const {replyId:_0x451f28,partIndex:_0x37e0d0}=this['_currentPreviewedChangeGroup'];this['_rejectSuggestion']({'replyId':_0x451f28,'partIndex':_0x37e0d0}),_0x6e4d8c['setState']('rejected');}),this['listenTo'](_0x6e4d8c,'showNext',()=>{const {replyId:_0x140acd,partIndex:_0xee5dff}=this['_currentPreviewedChangeGroup'],_0x4a6925=this['_getPresentableSiblingContentPartIndex'](_0x140acd,_0xee5dff,'next');null!==_0x4a6925&&this['_openBalloonFor'](_0x140acd,_0x4a6925);}),this['listenTo'](_0x6e4d8c,'showPrevious',()=>{const {replyId:_0x4f56af,partIndex:_0x2f8624}=this['_currentPreviewedChangeGroup'],_0x314b37=this['_getPresentableSiblingContentPartIndex'](_0x4f56af,_0x2f8624,'previous');null!==_0x314b37&&this['_openBalloonFor'](_0x4f56af,_0x314b37);}),this['listenTo'](_0x6e4d8c,'dialogClosed',(_0x30bfeb,{id:_0x5ea14e})=>{if('aiChatBalloon'!==_0x5ea14e)return;const {replyId:_0x44ea2d,partIndex:_0x39974d}=this['_currentPreviewedChangeGroup'];this['_currentPreviewedChangeGroup']=null,this['_aiChatUi']['setFeedItemAIReplySuggestionPartActive']({'id':_0x44ea2d,'index':_0x39974d,'isActive':!0x1}),this['_activeBalloon']===_0x6e4d8c&&(this['_activeBalloon']=void 0x0);});}_integrateEditor(_0x39a789){if(this['_channelsToEditors']['set'](_0x39a789['config']['get']('collaboration.channelId'),_0x39a789),this['_integrateEditorBalloon'](_0x39a789),this['addCurrentDocumentToChatContext'](),this['listenTo'](_0x39a789,'change:isReadOnly',()=>this['_refreshSuggestionGating']()),_0x39a789['once']('destroy',()=>{this['_checkRemoveCurrentDocumentFromChatContext']();}),_0x39a789['plugins']['has']('Undo')){const _0x41a3a5=_0x39a789['commands']['get']('undo'),_0x3f3515=_0x39a789['commands']['get']('redo');this['listenTo'](_0x41a3a5,'revert',(_0x1cf42c,_0x44595c,_0x144e32)=>{const _0x33261e=this['_batchToChanges']['get'](_0x44595c);if(!_0x33261e)return;const _0x51deda=this['activeConversation']['getInteraction'](_0x33261e['interactionId']),_0x308a57=_0x51deda?.['getReply'](_0x33261e['replyId']);this['_batchToChanges']['delete'](_0x44595c),_0x51deda&&_0x308a57&&(_0x33261e['indexes']['forEach'](_0x38eb39=>_0x308a57['setChangeGroupState'](_0x38eb39,'pending')),this['_batchToChanges']['set'](_0x144e32,_0x33261e));}),this['listenTo'](_0x3f3515,'revert',(_0x437216,_0x24d063,_0xc0df72)=>{const _0x1ae229=this['_batchToChanges']['get'](_0x24d063);if(!_0x1ae229)return;const _0x447a81=this['activeConversation']['getInteraction'](_0x1ae229['interactionId']),_0x444885=_0x447a81?.['getReply'](_0x1ae229['replyId']);this['_batchToChanges']['delete'](_0x24d063),_0x447a81&&_0x444885&&(_0x1ae229['indexes']['forEach'](_0x5b5898=>_0x444885['setChangeGroupState'](_0x5b5898,'accepted')),this['_batchToChanges']['set'](_0xc0df72,_0x1ae229));});}const _0x11a5ff=_0x39a789['config']['get']('ai.chat.context');_0x11a5ff['alwaysAddSelection']&&_0x11a5ff['document']['enabled']&&this['listenTo'](_0x39a789['model']['document']['selection'],'change:range',(_0x43755d,_0x303d65)=>{_0x303d65['directChange']&&'chat'===_0x39a789['plugins']['get']('AITabs')['view']['activeTab']&&(_0x39a789['model']['hasContent'](_0x39a789['model']['document']['selection'])?this['addSelectionToChatContext'](_0x39a789):this['removeSelectionFromChatContext']());});}async _getLastCreatedConversationId(){const _0x50dd69=this['_aiConnector']['fetchConversations'](this['getGroupId'](),{'limit':0x1,'sortBy':'createdAt'});try{const _0xfc870d=await _0x50dd69['getConversations']();return _0xfc870d['length']?_0xfc870d[0x0]['id']:'new';}catch(_0x27c7bd){return this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION'),'id':kt()}),this['_reporter']['logError'](new ct('ai-chat-conversation-init-failed',this,{'error':_0x27c7bd})),this['_aiChatUi']['toggleLoadingSkeleton'](!0x1),this['_aiChatUi']['disableControls'](),null;}}async _startConversationSafely(_0x4fb091={}){this['set']('isConversationReady',!0x1);try{await this['_handleStartConversation'](_0x4fb091),_0x4fb091['id']||this['set']('isConversationReady',!0x0);}catch(_0x112982){this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_UNABLE_TO_START_CONVERSATION'),'id':_0x4fb091['id']||kt()}),this['_reporter']['logError'](_0x112982),this['activeConversation']=void 0x0,this['_aiChatUi']['disableControls']();}}_detachFromActiveConversation(){this['_aiChatUi']['setIsUploadInProgress'](!0x1),this['activeConversation']&&this['stopListening'](this['activeConversation']);}async _handleStartConversation({id:_0x4b33d4,modelId:_0x483a47,contexts:_0x501daf}={}){this['_detachFromActiveConversation'](),this['_closeActiveBalloon']();let _0x2864a0=_0x483a47;_0x2864a0||(_0x4b33d4||!this['activeConversation']?_0x2864a0=this['context']['config']['get']('ai.models.defaultModelId'):this['_aiChatUi']['isModelAvailable']&&(_0x2864a0=this['activeConversation']['selectedModel']?.['id'])),this['_stopLastInteraction']();const _0x1f851a=this['getGroupId'](),_0x42e574=_0x4b33d4||kt(),_0x14695a=await this['_aiModels']['getAvailableModels']();let _0x287c05;this['activeConversation']=new jn({'connector':this['_aiConnector'],'chatModels':this['_aiModels'],'selectedModelId':_0x2864a0,'conversationId':_0x42e574,'group':_0x1f851a,'locale':this['context']['locale'],'isFromHistory':!!_0x4b33d4,'channelsToEditors':this['_channelsToEditors'],'contextLibrary':this['_aiContextLibrary'],'extraContexts':_0x501daf,'getSessionId':_0x3a6375=>this['_aiEditing']['getSessionId'](_0x3a6375),'aiEditing':this['_aiEditing']}),this['activeConversation']['delegate']('toolDataReceived','interactionCreated','interactionStarted','replyCreated')['to'](this),this['listenTo'](this['activeConversation'],'conversationInitialized',()=>{this['_aiChatUi']['createConversation']({'availableModels':_0x14695a}),this['_aiChatUi']['resetMessageInput'](),this['_aiChatUi']['clearPendingContextUI'](),this['_aiChatUi']['clearConversationContextUI'](),_0x4b33d4||(this['_aiChatUi']['resetConversationTitle'](),this['addCurrentDocumentToChatContext']());}),this['listenTo'](this['activeConversation'],'uploadProgressChanged',(_0x5d9539,_0x16fec4)=>{this['_aiChatUi']['setIsUploadInProgress'](_0x16fec4['isUploadInProgress']);}),this['listenTo'](this['activeConversation'],'webSearchStarted',()=>{const _0x3ff824=this['_aiChatUi']['prepareLoadingMessage']({'isWebSearchEnabled':!0x0,'isReasoningEnabled':!0x1});this['_aiChatUi']['setLoadingMessage'](_0x3ff824);}),this['listenTo'](this['activeConversation'],'reasoningStarted',()=>{const _0x3cdcd5=this['_aiChatUi']['prepareLoadingMessage']({'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x0});this['_aiChatUi']['setLoadingMessage'](_0x3cdcd5);}),this['listenTo'](this['activeConversation'],'webSearchFinished',(_0x55faab,_0x3886df)=>{this['_aiChatUi']['addFeedInteractionHeader'](_0x3886df,{'isWebSearchEnabled':!0x0,'isReasoningEnabled':!0x1});}),this['listenTo'](this['activeConversation'],'reasoningFinished',(_0x62fa81,_0x1c9129)=>{this['_aiChatUi']['addFeedInteractionHeader'](_0x1c9129,{'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x0});}),this['listenTo'](this['activeConversation'],'interactionStarted',()=>{this['_aiChatUi']['startInteraction']();}),this['listenTo'](this['activeConversation'],'interactionFinished',async()=>{this['_updateReplyContentThrottled']['flush'](),await this['_aiChatUi']['finishInteraction']();}),this['listenTo'](this['activeConversation'],'interactionDestroyed',(_0x30dc2e,_0x7d5246)=>{this['_aiChatUi']['removeFeedInteraction'](_0x7d5246['id']);}),this['listenTo'](this['activeConversation'],'setConversationTitle',(_0x238a60,_0x6977c6,_0x478fdd)=>{this['_updateConversationTitle'](_0x6977c6,_0x478fdd);}),this['listenTo'](this['activeConversation'],'replyContentUpdated',async(_0x1ae2fc,_0x13e3a1)=>{void 0x0!==_0x287c05&&_0x287c05!==_0x13e3a1['id']&&this['_updateReplyContentThrottled']['flush'](),_0x287c05=_0x13e3a1['id'],_0x13e3a1['isFromHistory']?await this['_updateReplyContent']({'reply':_0x13e3a1}):await this['_updateReplyContentThrottled']({'reply':_0x13e3a1});}),this['listenTo'](this['activeConversation'],'replyChangeGroupStateUpdated',(_0x275076,{reply:_0x348c8f,index:_0x41722c,state:_0x413f98,outdatedReason:_0x554eaf})=>{this['_aiChatUi']['updateFeedItemAIReplySuggestionPartState']({'id':_0x348c8f['id'],'index':_0x41722c,'state':_0x413f98,'outdatedReason':_0x554eaf}),this['_aiChatUi']['hasFeedItem'](_0x348c8f['id'])&&this['_aiChatUi']['setSuggestionGating'](_0x348c8f['id'],this['_computeSuggestionGating'](_0x348c8f)),this['_currentPreviewedChangeGroup']?.['replyId']['includes'](_0x348c8f['id'])&&this['_currentPreviewedChangeGroup']?.['partIndex']==_0x41722c&&this['_activeBalloon']?.['setState'](_0x413f98,_0x554eaf);}),this['listenTo'](this['activeConversation'],'contextItemAdded',(_0x3eaaf8,_0x966b37)=>{if(this['_aiChatUi']['addContextItem'](_0x966b37['contextItem'],_0x966b37['isLoading']),'selection'===_0x966b37['contextItem']['type']){const _0x23dac7=Ss(this['context']),_0x4dd085=[..._0x23dac7['model']['document']['selection']['getRanges']()];this['_aiEditing']['showFakeVisualSelection']({'editor':_0x23dac7,'ranges':_0x4dd085,'id':'context','priority':0x1});}}),this['listenTo'](this['activeConversation'],'contextItemRemoved',(_0x1c0964,_0x3344b5)=>{this['_aiChatUi']['removeContextItem'](_0x3344b5['uiId']),'current-document'==_0x3344b5['uiId']&&this['removeSelectionFromChatContext'](),'selection'===_0x3344b5['type']&&this['_aiEditing']['hideFakeVisualSelection']('context');}),this['listenTo'](this['activeConversation'],'contextItemLoadingEnded',(_0xcc74f4,_0x5c7baf)=>{this['_aiChatUi']['setContextItemLoading'](_0x5c7baf['contextItem']['uiId'],_0x5c7baf['isLoading']);}),this['listenTo'](this['activeConversation'],'contextSent',(_0x272d6b,_0x26747c)=>{this['_aiChatUi']['setConversationContext'](_0x26747c['contextItems']);}),this['listenTo'](this['activeConversation'],'addContextOptionsChanged',(_0x597154,_0x3bcebc)=>{this['_aiChatUi']['setAddContextOptions'](_0x3bcebc['options']);}),this['listenTo'](this['activeConversation'],'sourceResourcesLoaded',(_0x9bf012,_0x3b752c)=>{this['_aiChatUi']['populateSourceResourceBalloon'](_0x3b752c['sourceId'],_0x3b752c['source'],_0x3b752c['resources'],_0x3b752c['uid']);}),this['listenTo'](this['activeConversation'],'resourceStateChanged',(_0x4570f0,_0x14c314)=>{this['_aiChatUi']['updateResourceState'](_0x14c314['sourceId'],_0x14c314['resourceId'],_0x14c314['isInContext']);}),this['listenTo'](this['activeConversation'],'capabilitiesUpdated',(_0x394653,_0x40b888)=>{this['_aiChatUi']['updateCapabilities'](_0x40b888);}),this['listenTo'](this['activeConversation'],'modelSelected',(_0x45a17c,_0x4fb2ea)=>{this['_aiChatUi']['setSelectedModel'](_0x4fb2ea['selectedModel']??null,_0x4fb2ea['isDisabled']);}),this['listenTo'](this['activeConversation'],'error',async(_0x55b086,{error:_0x1ee40d,interactionId:_0x606367,fileName:_0x3c3311,url:_0xb92f0f,sourceId:_0x15d2e7,sourceLabel:_0x522c9b})=>{let _0x2c7c3b;const _0x3ee8d2=_0x606367?_0x606367+':'+kt():kt();this['_reporter']['reportError'](_0x1ee40d),this['_aiChatUi']['startAutoScroll'](),_0x1ee40d['message']['startsWith']('ai-request-aborted')?(this['_cancelProcessing'](),this['activeConversation']?.['cancelLastInteractionStream'](),_0x2c7c3b=this['_aiChatUi']['addFeedItemStaticMessage']({'staticMessage':Es(this['context']['locale'],'AI_CHAT_ABORTED_MESSAGE'),'id':_0x3ee8d2})):_0x1ee40d['message']['startsWith']('ai-chat-conversation-init-failed')||_0x1ee40d['message']['startsWith']('ai-chat-conversation-start-failed')?_0x2c7c3b=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_UNABLE_TO_START_CONVERSATION'),'id':_0x3ee8d2}):_0x1ee40d['message']['startsWith']('ai-chat-file-upload-failed')?_0x2c7c3b=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_FILE',_0x3c3311),'id':_0x3ee8d2}):_0x1ee40d['message']['startsWith']('ai-chat-url-upload-failed')?_0x2c7c3b=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_URL',_0xb92f0f),'id':_0x3ee8d2}):_0x1ee40d['message']['startsWith']('ai-chat-context-invalid-data')?_0x2c7c3b=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_CONTEXT_INVALID_DATA'),'id':_0x3ee8d2}):_0x1ee40d['message']['startsWith']('ai-chat-context-unsupported-type')?_0x2c7c3b=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_CONTEXT_UNSUPPORTED_TYPE'),'id':_0x3ee8d2}):_0x1ee40d['message']['startsWith']('ai-chat-source-resources-load-failed')?(_0x15d2e7&&this['_aiChatUi']['closeSourceResourceBalloon'](_0x15d2e7),_0x2c7c3b=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_LOAD_RESOURCES',_0x522c9b||'source'),'id':_0x3ee8d2})):_0x1ee40d['message']['startsWith']('ai-chat-resource-load-failed')?_0x2c7c3b=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_RESOURCE_LOAD_FAILED'),'id':_0x3ee8d2}):_0x1ee40d['message']['startsWith']('ai-chat-invalid-request')?_0x2c7c3b=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_INVALID_REQUEST'),'id':_0x3ee8d2}):_0x1ee40d['message']['startsWith']('ai-chat-context-unsupported-file-type')?_0x2c7c3b=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_CONTEXT_UNSUPPORTED_FILE_TYPE'),'id':_0x3ee8d2}):_0x1ee40d['message']['startsWith']('ai-chat-context-file-too-large')?_0x2c7c3b=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_CONTEXT_FILE_TOO_LARGE'),'id':_0x3ee8d2}):_0x1ee40d['message']['startsWith']('ai-chat-context-file-too-many-pages')?_0x2c7c3b=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_CONTEXT_FILE_TOO_MANY_PAGES'),'id':_0x3ee8d2}):_0x1ee40d['message']['startsWith']('ai-chat-context-form-data-size-limits-exceeded')?_0x2c7c3b=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_CONTEXT_FORM_DATA_SIZE_LIMITS_EXCEEDED'),'id':_0x3ee8d2}):(this['_cancelProcessing'](),_0x2c7c3b=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_GENERIC_ERROR'),'id':_0x3ee8d2}));try{await Promise['race']([_0x2c7c3b,this['_aiChatUi']['idleUiPromise']]);}finally{this['_aiChatUi']['isBusy']||this['_aiChatUi']['stopAutoScroll']();}}),await this['activeConversation']['init'](this['_buildConversationContextConfig']()),_0x4b33d4||(await this['activeConversation']['start'](),this['_aiChatUi']['enableControls']());}_buildConversationContextConfig(){const _0x55d354=this['context']['config']['get']('ai.chat.context');return this['_contextLibrarySource']?{..._0x55d354,'sources':[..._0x55d354?.['sources']??[],this['_contextLibrarySource']]}:_0x55d354;}async _setUpContextLibrarySource(){const _0x319c37=await this['_createContextLibrarySource']();_0x319c37&&(this['_contextLibrarySource']=_0x319c37,this['activeConversation']&&this['activeConversation']['chatContext']['addContextSource'](_0x319c37));}async _createContextLibrarySource(){let _0x18342d;try{_0x18342d=await this['_aiContextLibrary']['getAvailableContexts']();}catch{return null;}if(!_0x18342d['length'])return null;const _0x2e4a15=_0x18342d['map'](_0x5a468a=>({'id':_0x5a468a['id'],'type':'context','label':_0x5a468a['name']||_0x5a468a['id']}));return{'id':'ck-ai-context-library','label':Es(this['context']['locale'],'AI_CHAT_CONTEXT_LIBRARY_LABEL'),'useDefaultFiltering':!0x0,'getResources':()=>Promise['resolve'](_0x2e4a15)};}_removeFromContext(_0x5c010b){this['activeConversation']?.['removeFromContext'](_0x5c010b);}_toggleWebSearch(){this['activeConversation']?.['toggleWebSearch']();}_toggleReasoning(){this['activeConversation']?.['toggleReasoning']();}getInteractionAndReplyById(_0x4314a1){const [_0x56222e,_0x3afa67]=_0x4314a1['split'](':'),_0x14e5b7=this['activeConversation']['getInteraction'](_0x56222e);return{'interaction':_0x14e5b7,'reply':_0x14e5b7['getReply'](_0x3afa67)};}_scrollToSuggestionRange(_0xe8419,_0x505381=!0x1,_0xb83e9){const _0x4b8901={'target':_0xb83e9['editing']['view']['domConverter']['viewRangeToDom'](_0xb83e9['editing']['mapper']['toViewRange'](_0xe8419)),'viewportOffset':{'top':0x96,'left':0x0,'bottom':0x32,'right':0x0},'ancestorOffset':0x14,'alignToTop':_0x505381};_0x505381&&(_0x4b8901['alignToTop']=!0x0),Ot(_0x4b8901);}_updateConversationTitle(_0x5ee513,_0x22a2b6=!0x1){this['_aiChatUi']['setConversationTitle'](_0x5ee513||Es(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION'),_0x22a2b6);}_addFeedItemReply(_0xb0654d){'text'===_0xb0654d['type']?this['_aiChatUi']['addFeedItemAIReply'](_0xb0654d):this['_aiChatUi']['addFeedItemAISuggestion'](_0xb0654d);}async _updateReplyContent({reply:_0x490fc6,renderingStrategy:_0x5424b9}){const {id:_0x343f8a,interactionId:_0x22288d,isDone:_0x2ac773,type:_0x4c04a0,parsedContent:_0x56c018}=_0x490fc6,_0xaae7e7=_0x22288d+':'+_0x343f8a;if('modification'===_0x4c04a0){const _0x423017=_0x490fc6['getContentParts']({'showDiff':this['_aiChatUi']['showDiff']});await this['_aiChatUi']['updateFeedItemAIReplySuggestionContent']({'id':_0xaae7e7,'parts':_0x423017,'isDone':_0x2ac773,'skipLoadingEffects':_0x490fc6['isFromHistory']}),this['_aiChatUi']['hasFeedItem'](_0x490fc6['id'])&&this['_aiChatUi']['setSuggestionGating'](_0x490fc6['id'],this['_computeSuggestionGating'](_0x490fc6));}else'text'===_0x4c04a0&&await this['_aiChatUi']['updateFeedItemAIReplyContent']({'id':_0xaae7e7,'parsedContent':_0x56c018['get']('text'),'renderingStrategy':_0x5424b9,'isDone':_0x2ac773});_0x2ac773&&_0x490fc6['sources']['length']>0x0&&this['_aiChatUi']['updateFeedItemAIReplySources'](_0xaae7e7,_0x490fc6['sources']);}_updateReplyContentThrottled=_0x43ff3d(this['_updateReplyContent']['bind'](this),0xc8);_stopLastInteraction(){this['activeConversation']?.['stopProcessing'](),this['_aiChatUi']['stopInteraction'](this['activeConversation']?.['lastInteraction']),this['_updateReplyContentThrottled']['cancel']();}async _flushLastInteractionUI(){const _0x381092=this['activeConversation']?.['lastInteraction'];if(_0x381092){for await(const _0x5e637f of _0x381092['replies'])this['_aiChatUi']['hasFeedItem'](_0x5e637f['id'])||this['_addFeedItemReply'](_0x5e637f),await this['_updateReplyContent']({'reply':_0x5e637f,'renderingStrategy':'static'});}}async['_cancelProcessing'](){this['_stopLastInteraction'](),await this['_flushLastInteractionUI'](),this['removeSelectionFromChatContext']();}_updateRatings(_0x585ab8){const _0x372562={'positiveCount':_0x585ab8['changeGroups']['filter'](_0x3916b8=>'accepted'===_0x3916b8['state'])['length'],'totalCount':_0x585ab8['changeGroups']['length'],'modificationId':_0x585ab8['id']},_0x31dc95=this['activeConversation']['getInteraction'](_0x585ab8['interactionId'])['messageId'];_0x31dc95&&this['_aiConnector']['upsertAIChatRating'](this['activeConversation']['id'],_0x31dc95,_0x372562);}_getAIChatFeedAPI(_0x7f16a1){const _0x26d20a=this['_aiChatUi'],_0x19c61e=()=>{_0x7f16a1['resetWebSearchState'](),_0x7f16a1['resetReasoningState'](),_0x26d20a['clearLoadingMessage']();},_0x30fc8f=()=>{_0x7f16a1['currentReply']&&(_0x7f16a1['currentReply']['done'](),_0x7f16a1['currentReply']=void 0x0);};return{'insertTextReply':(_0x5cd02a,_0xeb197c)=>{_0x30fc8f(),_0x19c61e();const _0x3ed752=_0x7f16a1['currentReply']=_0x7f16a1['createReply']({'type':'text','interactionId':_0x7f16a1['id'],'id':_0xeb197c||kt(),'channelsToEditors':this['_channelsToEditors']});return _0x3ed752['appendContent'](_0x5cd02a),_0x30fc8f(),_0x3ed752;},'insertCustomElement':async(_0x1ced56,_0x4c8606)=>(_0x30fc8f(),_0x19c61e(),_0x26d20a['addFeedItemCustomElement'](_0x1ced56,_0x4c8606||kt())),'setLoadingMessage':_0x5856fd=>{_0x26d20a['setLoadingMessage'](_0x5856fd);},'clearLoadingMessage':()=>{_0x26d20a['clearLoadingMessage']();}};}_checkRemoveCurrentDocumentFromChatContext(){bs(this['context'])['find'](_0x4361d1=>'destroyed'!==_0x4361d1['state'])||(this['activeConversation']?.['removeFromContext']('current-document'),this['activeConversation']?.['toggleAddCurrentDocumentOptionVisibility'](!0x1));}};const ir=['showChangeInText','insertSuggestion','applySuggestion','rejectSuggestion','mouseOverSuggestion','mouseLeaveSuggestion','toggleSuggestionDisplayMode','like','dislike'],sr=[...ir,'startConversation','sendUserMessage','promptInputPaste','abortPromptStream','addDocumentToContext','addFileToContext','addUrlToContext','executeCustomItemCallback','addResourceToContext','removeContextItem','loadSourceResources','toggleWebSearch','toggleReasoning','selectModel'];function nr(_0x498042){const _0x53a47d=new AbortController();return{'promise':new Promise((_0x1362ef,_0x38ccae)=>{const _0x15d44e=setTimeout(_0x1362ef,_0x498042);_0x53a47d['signal']['addEventListener']('abort',()=>{clearTimeout(_0x15d44e),_0x38ccae();});}),'abortController':_0x53a47d};}var rr=class{options;isStreaming=!0x1;document=null;nodesList=[];currentIndex=0x0;timeoutAbortController=null;lastUpdateTime=0x0;constructor(_0x133c97){this['options']={'delay':_0x133c97?.['delay']??0xa,'textNodeStyle':_0x133c97?.['textNodeStyle']??'animation:\x20ck-html-streamer-fade-in\x20.3s'};}async stream({document:_0x5bc8e1,targetElement:_0x4dda3c,abortSignal:_0x8ac0f4}){this['isStreaming']&&this['stop'](),_0x8ac0f4?.['addEventListener']('abort',this['stop']['bind'](this)),this['document']=_0x246402(_0x5bc8e1,!0x0),this['nodesList']=this['getParsedDocumentNodeList'](),this['isStreaming']=!0x0,this['currentIndex']>this['nodesList']['length']&&(this['currentIndex']=this['nodesList']['length']);for(let _0x5d1528=0x0;_0x5d1528<this['currentIndex'];_0x5d1528++)this['nodesList'][_0x5d1528]['shouldBeStreamed']=!0x0;do{const _0x5ead2c=Date['now'](),_0x7d06f=this['nodesList'][this['currentIndex']],_0x365799=_0x5ead2c-this['lastUpdateTime'];if(_0x7d06f){_0x7d06f['shouldBeStreamed']=!0x0;let _0x5c8aa0=_0x7d06f['parent'];for(;_0x5c8aa0;)_0x5c8aa0['shouldBeStreamed']=!0x0,_0x5c8aa0=_0x5c8aa0['parent'];}if(_0x365799<this['options']['delay'])try{const {promise:_0x151439,abortController:_0x3179f2}=nr(this['options']['delay']-_0x365799);this['timeoutAbortController']=_0x3179f2,await _0x151439;}catch(_0x4333a8){return;}_0x1f22dd(_0x4dda3c,'<'+_0x4dda3c['tagName']+'>'+this['renderNode'](this['document'])+'</'+_0x4dda3c['tagName']+'>',{'childrenOnly':!0x0}),this['currentIndex']++,this['lastUpdateTime']=Date['now']();}while(this['currentIndex']<this['nodesList']['length']);this['currentIndex']=this['nodesList']['length'],this['isStreaming']=!0x1;}reset(){this['isStreaming']=!0x1,this['document']=null,this['nodesList']=[],this['currentIndex']=0x0,this['timeoutAbortController']=null;}cleanUpAnimations({targetElement:_0x362875}){Array['from'](_0x362875['querySelectorAll']('span[data-ck-html-streamer-word-chunk]'))['reverse']()['forEach'](_0x4325ea=>{_0x4325ea['replaceWith'](_0x4325ea['childNodes'][0x0]);});}stop(){this['isStreaming']=!0x1,this['timeoutAbortController']&&(this['timeoutAbortController']['abort'](),this['timeoutAbortController']=null);}['renderNode'](_0x42f3fe){let _0x169514='';if(function(_0x30f336){return _0x4591e9(_0x30f336);}(_0x42f3fe)){for(const _0x31e350 of _0x42f3fe['children'])_0x169514+=this['renderNode'](_0x31e350);}else{if(hr(_0x42f3fe)){if(!_0x42f3fe['shouldBeStreamed'])return'';const _0x59e0df=_0x42f3fe,_0x6bdb4c=Object['entries'](_0x59e0df['attribs'])['map'](([_0xbbb342,_0x285288])=>_0xbbb342+'=\x22'+_0x285288+'\x22')['join']('\x20');_0x169514+='<'+_0x59e0df['tagName']+(_0x6bdb4c?'\x20'+_0x6bdb4c:'')+'>';for(const _0xd9410c of _0xe31aff(_0x59e0df))_0x169514+=this['renderNode'](_0xd9410c);_0x169514+='</'+_0x59e0df['tagName']+'>';}else{if(!ar(_0x42f3fe))return'';if(!_0x42f3fe['shouldBeStreamed'])return'';!function(_0x2068b7){return!(!_0x2068b7['parent']||!hr(_0x2068b7['parent']))&&(!!or['includes'](_0x2068b7['parent']['tagName'])&&!_0x39a5c5(_0x2068b7)['match'](/^\s*[<>]\s*$/));}(_0x42f3fe)?_0x169514+=_0x3a1450(_0x42f3fe):_0x169514+=_0x3a1450(new _0x5b6203('span',{'data-ck-html-streamer-word-chunk':'','style':this['options']['textNodeStyle']},[_0x42f3fe]));}}return _0x169514;}getParsedDocumentNodeList(){const _0x35daf0=[];return function(_0x1e4046,_0x35ec82){const _0x201501=_0x3d7005=>{if(_0x35ec82(_0x3d7005),_0x3d7005 instanceof _0x4eb033)for(let _0x1a957b=0x0;_0x1a957b<_0x3d7005['children']['length'];_0x1a957b++){const _0x45aecf=_0x3d7005['children'][_0x1a957b];_0x201501(_0x45aecf);}};for(let _0x5e1607=0x0;_0x5e1607<_0x1e4046['children']['length'];_0x5e1607++)_0x201501(_0x1e4046['children'][_0x5e1607]);}(this['document'],_0x309a16=>{if(ar(_0x309a16)){const _0xe9e6da=this['splitTextNodeIntoWordNodes'](_0x309a16);_0xe9e6da['length']&&_0x35daf0['push'](..._0xe9e6da);}_0x309a16['isWordSplitSource']||_0x309a16['isWordSplitResult']||_0x35daf0['push'](_0x309a16);}),_0x35daf0;}splitTextNodeIntoWordNodes(_0xa611c3){if(_0xa611c3['isWordSplitSource']||_0xa611c3['isWordSplitResult'])return[];const _0x18b454=_0x39a5c5(_0xa611c3)['match'](/(?:\s*\S+\s*)/g),_0x1b1ee1=[];if(_0x18b454&&_0x18b454['length']>0x1){for(const _0x2de784 of _0x18b454){const _0x5a9a27=new _0x5be0d8(_0x2de784);_0x5a9a27['isWordSplitResult']=!0x0,ti(_0xa611c3,_0x5a9a27),_0x1b1ee1['push'](_0x5a9a27);}_0xa611c3['isWordSplitSource']=!0x0,_0x4ebff9(_0xa611c3);}return _0x1b1ee1;}};const or=['p','li','td','th','span','h1','h2','h3','h4','h5','h6','b','strong','i','em','mark','del','ins','sup','sub','a','code','div'];function ar(_0x1bb611){return _0x8a421e(_0x1bb611);}function hr(_0x5114e4){return _0x438723(_0x5114e4);}function cr(_0x5ac03d,_0x2230cc){_0x5ac03d['cleanUpAnimations']({'targetElement':_0x2230cc}),_0x2230cc['querySelectorAll']('[data-id]')['forEach'](_0x5b5f85=>{_0x5b5f85['removeAttribute']('data-id');});}var lr=class extends _0x4ff2da{options;content='';htmlStreamer;['children'];constructor(_0x35e243){super();const _0x4a4c20=this['bindTemplate'];this['set']('isDone',!0x1),this['set']('isVisible',!0x0),this['htmlStreamer']=new rr(),this['options']=_0x35e243,this['children']=this['createCollection'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__item',_0x4a4c20['if']('isDone','ck-ai-chat__feed__item_done'),_0x4a4c20['if']('isVisible','ck-hidden',_0x5c04d3=>!_0x5c04d3),'ck-ai-chat__feed__text-item'],'data-cke-ai-id':this['options']['id']},'children':this['children']});}['markAsDone'](){cr(this['htmlStreamer'],this['element']),this['isDone']=!0x0;}async streamIntoElement(_0x3ee328,_0x2feb3b,_0x2bf7cc){await this['htmlStreamer']['stream']({'document':_0x3ee328,'targetElement':_0x2feb3b,'abortSignal':_0x2bf7cc});}},ur=class extends _0x4ff2da{['showChangesToggleView'];constructor(_0x43b9ae,_0xf60551){super(_0x43b9ae),this['set']('isShowChangesToggleVisible',!0x0),this['showChangesToggleView']=new dr(_0x43b9ae),this['showChangesToggleView']['set']({'class':'ck-ai-suggestion__header__show-changes-toggle\x20ck-ai-chat-controls-button\x20'+Dn,'label':Es(_0x43b9ae,'AI_SUGGESTION_BUTTON_SHOW_CHANGES'),'withText':!0x0}),this['showChangesToggleView']['isOn']=_0xf60551['showDiff'],this['showChangesToggleView']['bind']('isVisible')['to'](this,'isShowChangesToggleVisible'),this['showChangesToggleView']['bind']('icon')['to'](this['showChangesToggleView'],'isOn',_0x13929e=>_0x13929e?it:et),this['showChangesToggleView']['on']('execute',()=>{this['showChangesToggleView']['isOn']=!this['showChangesToggleView']['isOn'],this['fire']('toggleShowChanges',{'isOn':this['showChangesToggleView']['isOn']});});const _0x25fbe4=new $t();_0x25fbe4['content']=_0x38d218,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__header',!0x1===_0xf60551['showHeader']?'ck-hidden':null]['filter'](Boolean)},'children':[_0x25fbe4,{'tag':'span','children':[Es(_0x43b9ae,'AI_SUGGESTION_HEADER_TITLE')]},this['showChangesToggleView']]});}},dr=class extends Mt{['render'](){super['render'](),this['children']['remove'](this['iconView']),this['children']['add'](this['iconView']);}};const _r={'accepted':_0x5517bf,'rejected':_0xabec2d,'outdated':_0x57bdce};var gr=class extends _0x4ff2da{statePillView;constructor(_0x12e461){super(_0x12e461);const _0x3677d5=this['bindTemplate'];this['set']('state','accepted'),this['set']('outdatedReason',void 0x0),this['set']('isVisible',!0x0),this['statePillView']=new _0x18ca88(_0x12e461),this['statePillView']['bind']('label')['to'](this,'state',_0x54e9b4=>function(_0x203b7f,_0x41669b){return Es(_0x203b7f,'AI_SUGGESTION_CONTENT_PART_STATE_'+_0x41669b['toUpperCase']());}(_0x12e461,_0x54e9b4)),this['statePillView']['bind']('icon')['to'](this,'state',_0x19a103=>_r[_0x19a103]),this['statePillView']['bind']('class')['to'](this,'state',_0x4f45c3=>'ck-pill_'+_0x4f45c3),this['statePillView']['bind']('tooltip')['to'](this,'state',this,'outdatedReason',(_0x19dc7f,_0x30e330)=>function(_0x2e950e,_0xea328b,_0x239854){if('outdated'!==_0xea328b)return;return Es(_0x2e950e,_0x239854?Ar[_0x239854]:'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_TOOLTIP');}(_0x12e461,_0x19dc7f,_0x30e330)),this['statePillView']['tooltipPosition']='s',this['statePillView']['tooltipClass']='ck-tooltip_multi-line',this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__content-part-state',_0x3677d5['if']('isVisible','ck-hidden',_0x4aa3b6=>!_0x4aa3b6)]},'children':[this['statePillView']]});}setState(_0x55d732,_0x5a019c){this['state']=_0x55d732,this['outdatedReason']='outdated'===_0x55d732?_0x5a019c:void 0x0;}};const Ar={'content-removed':'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_CONTENT_REMOVED_TOOLTIP','editor-removed':'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_EDITOR_REMOVED_TOOLTIP','session-changed':'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_SESSION_CHANGED_TOOLTIP'};var Ir=class extends _0x24660c{_applyButton;_suggestButton;constructor(_0x4ed7ee,_0x3ac018,_0x180625){super(_0x4ed7ee);const _0x2bd413=Boolean(_0x180625);this['set']('isEnabled',!_0x2bd413),this['set']('isVisible',!0x0),this['set']('isTrackChangesOn',!0x1),this['set']('isTargetReadOnly',!0x1),this['class']='ck-ai-suggestion-content-part-toolbar';const _0x209ea9=[];if(!_0x2bd413){_0x3ac018['includes']('applySuggestion')&&(this['_applyButton']=new Mt(_0x4ed7ee),this['_applyButton']['set']({'label':Es(_0x4ed7ee,'AI_SUGGESTION_CONTENT_PART_APPLY'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0xc68c2d}),this['_applyButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isTargetReadOnly',(_0x1e382d,_0x468285)=>_0x1e382d&&!_0x468285),this['_applyButton']['bind']('isVisible')['to'](this,'isTrackChangesOn',_0xe7c8ab=>!_0xe7c8ab),this['_applyButton']['on']('execute',()=>{this['fire']('applySuggestion');}),_0x209ea9['push'](this['_applyButton'])),_0x3ac018['includes']('insertSuggestion')&&(this['_suggestButton']=new Mt(_0x4ed7ee),this['_suggestButton']['set']({'label':Es(_0x4ed7ee,'AI_SUGGESTION_CONTENT_PART_ADD_SUGGESTION'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x4745b9}),this['_suggestButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isTargetReadOnly',(_0x588d12,_0x189920)=>_0x588d12&&!_0x189920),this['_suggestButton']['on']('execute',()=>{this['fire']('insertSuggestion');}),_0x209ea9['push'](this['_suggestButton']));const _0xda07ee=new Mt(_0x4ed7ee);_0xda07ee['set']({'label':Es(_0x4ed7ee,'AI_SUGGESTION_CONTENT_PART_REJECT'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x17c14c}),_0xda07ee['bind']('isEnabled')['to'](this),_0xda07ee['on']('execute',()=>{this['fire']('rejectSuggestion');}),_0x209ea9['push'](_0xda07ee);}this['items']['addMany'](_0x209ea9);const _0x98cfb4=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':[_0x98cfb4['if']('isVisible','ck-hidden',_0x55a5c4=>!_0x55a5c4)]}});}setButtonsVisibility({showApplyButton:_0x1cb232,showSuggestButton:_0x3bb57f}){this['_applyButton']&&(this['_applyButton']['isVisible']=_0x1cb232),this['_suggestButton']&&(this['_suggestButton']['isVisible']=_0x3bb57f);}},pr=class extends _0x4ff2da{toolbarView;stateView;titleLabelView;['children'];constructor(_0x9e208c,{part:_0x507a98,uiIndex:_0x1475fc,availableActions:_0x14463d,areActionsDisabled:_0x19c283}){super(_0x9e208c),this['set']('isEnabled',!0x0),this['set']('state','pending'),this['set']('isTrackChangesOn',!0x1),this['set']('isTargetReadOnly',!0x1),this['toolbarView']=new Ir(_0x9e208c,_0x14463d,_0x19c283),this['toolbarView']['on']('rejectSuggestion',()=>{this['fire']('rejectSuggestion',{'index':_0x507a98['index']});}),this['toolbarView']['on']('insertSuggestion',()=>{this['fire']('insertSuggestion',{'index':_0x507a98['index']});}),this['toolbarView']['on']('applySuggestion',()=>{this['fire']('applySuggestion',{'index':_0x507a98['index']});}),this['toolbarView']['bind']('isEnabled','isTrackChangesOn','isTargetReadOnly')['to'](this),this['stateView']=new gr(_0x9e208c),this['titleLabelView']=new Er(_0x9e208c,_0x1475fc),this['children']=this['createCollection'](),this['children']['addMany']([this['titleLabelView'],this['toolbarView']]),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all-excluded','ck-ai-suggestion__body__content-part__title']},'children':this['children']}),this['on']('change:state',(_0x59cae5,_0x4fcdf9,_0x2de5b8,_0xb332c3)=>{'pending'===_0xb332c3?this['children']['remove'](this['toolbarView']):this['children']['remove'](this['stateView']),'pending'===_0x2de5b8?this['children']['add'](this['toolbarView']):(this['stateView']['setState'](_0x2de5b8,this['outdatedReason']),this['children']['add'](this['stateView']));});}},Er=class extends _0x4ff2da{constructor(_0x173a92,_0x2bdf77){super(_0x173a92),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__body__content-part__title__label']},'children':[Es(_0x173a92,'AI_SUGGESTION_CONTENT_PART_TITLE',_0x2bdf77['toString']())]});}},mr=class extends _0x4ff2da{htmlStreamer;constructor(_0x2c64c5){super(_0x2c64c5),this['htmlStreamer']=new rr(),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content','ck-reset_all-excluded','ck-ai-suggestion-streamable-content']}});}async update({part:_0x43da21,renderingStrategy:_0x565509,abortSignal:_0x5cce4d}){this['_ensureHostElementTag'](_0x43da21['wrapperTag']||'div');const _0x1146d4=_0x246402(_0x43da21['content'],!0x0);for(const _0x4cca89 of ys(_0x1146d4))_0x4ebff9(_0x4cca89);'streaming'===_0x565509?await this['htmlStreamer']['stream']({'document':_0x1146d4,'targetElement':this['element'],'abortSignal':_0x5cce4d}):_0x1f22dd(this['element'],'<'+this['element']['tagName']+'>'+Os(_0x1146d4)+'</'+this['element']['tagName']+'>',{'childrenOnly':!0x0});}['clear'](){this['htmlStreamer']['reset'](),this['element']['innerHTML']='',this['element']['scrollTop']=0x0;}cleanUpStreamingArtifacts(){cr(this['htmlStreamer'],this['element']);}_ensureHostElementTag(_0x57a3a0){if(!this['element']||this['element']['tagName']['toLowerCase']()===_0x57a3a0)return;const _0x237f5f=new _0x4937f3({'tag':_0x57a3a0,'attributes':{'class':this['element']['className']}})['render']();this['element']['replaceWith'](_0x237f5f),this['element']=_0x237f5f;}},Tr=class extends _0x4ff2da{['_children'];['_headerView'];_streamableContentView;constructor(_0x34d3f6,{part:_0x5ac6f9,uiIndex:_0x59b4ac,areActionsDisabled:_0x2aebee,availableActions:_0x34a0e2}){super(_0x34d3f6);const _0xc5d0d6=this['bindTemplate'];this['set']('state',_0x5ac6f9['state']),this['set']('outdatedReason',_0x5ac6f9['outdatedReason']),this['set']('isDone',!0x1),this['set']('isVisible',!0x1),this['set']('isActive',!0x1),this['set']('isEnabled',!0x1),this['set']('isTrackChangesOn',!0x1),this['set']('isTargetReadOnly',!0x1);const _0x5d1cb0=()=>{this['isEnabled']=this['isDone']&&'pending'==this['state']&&!_0x2aebee;};this['on']('change:state',_0x5d1cb0),this['on']('change:isDone',_0x5d1cb0),_0x5d1cb0(),this['_children']=this['createCollection'](),this['_headerView']=new pr(_0x34d3f6,{'part':_0x5ac6f9,'uiIndex':_0x59b4ac,'availableActions':_0x34a0e2,'areActionsDisabled':_0x2aebee}),this['_headerView']['bind']('isEnabled','outdatedReason','state','isTrackChangesOn','isTargetReadOnly')['to'](this),this['_headerView']['delegate'](...ir)['to'](this),this['_streamableContentView']=new mr(_0x34d3f6),this['_children']['addMany']([this['_headerView'],this['_streamableContentView']]),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__body__content-part',_0xc5d0d6['to']('state',_0x2058f3=>'ck-ai-suggestion__body__content-part_'+_0x2058f3),_0xc5d0d6['if']('isEnabled','ck-ai-suggestion__body__content-part_enabled'),_0xc5d0d6['if']('isActive','ck-ai-suggestion__body__content-part_active'),_0xc5d0d6['if']('isVisible','ck-hidden',_0x20a32c=>!_0x20a32c)]},'children':this['_children'],'on':{'mouseenter':_0xc5d0d6['to'](()=>{this['isEnabled']&&this['fire']('mouseOverSuggestion',{'index':_0x5ac6f9['index']});}),'mouseleave':_0xc5d0d6['to'](()=>{this['isEnabled']&&this['fire']('mouseLeaveSuggestion',{'index':_0x5ac6f9['index']});}),'click':_0xc5d0d6['to'](_0x2535f7=>{const _0x152f46=_0x2535f7['target'];this['isEnabled']&&!this['_headerView']['toolbarView']['element']['contains'](_0x152f46)&&this['fire']('showChangeInText',{'index':_0x5ac6f9['index']});})}});}async updateContent({part:_0x55b773,showUnchangedParts:_0x361c19=!0x1,abortSignal:_0x24f908}){this['partDefinition']=_0x55b773,this['isVisible']=this['partDefinition']['hasChanges']||_0x361c19,this['isVisible']&&await this['_streamableContentView']['update']({'part':_0x55b773,'renderingStrategy':'static','abortSignal':_0x24f908});}['markAsDone'](){this['isDone']=!0x0;}},wr=class extends _0x4ff2da{constructor(_0xa7f974,_0x12e800){super(_0xa7f974),this['set']('isVisible',!0x0),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-skeleton',this['bindTemplate']['if']('isVisible','ck-hidden',_0x5967cd=>!_0x5967cd)]},'children':this['_createSkeletonItems'](_0x12e800)});}_createSkeletonItems(_0x26057b){const _0x3bb103=['ck','ck-ai-skeleton__item'];return _0x26057b['map'](_0x580bce=>{let _0x1dc516='';switch(_0x580bce['attributes']['align']){case'right':_0x1dc516='margin-left:\x20auto;\x20margin-right:\x200;\x20text-align:\x20right;';break;case'center':_0x1dc516='margin-left:\x20auto;\x20margin-right:\x20auto;\x20text-align:\x20center;';break;case'left':_0x1dc516='margin-left:\x200;\x20margin-right:\x20auto;\x20text-align:\x20left;';}return{'tag':_0x580bce['tag'],'attributes':{'class':[..._0x3bb103,_0x580bce['attributes']['class']?_0x580bce['attributes']['class']:''],'style':'width:\x20'+_0x580bce['attributes']['width']+';\x20height:\x20'+_0x580bce['attributes']['height']+';'+_0x1dc516}};});}};const Cr={'aiSuggestionBody':[{'tag':'div','attributes':{'width':'50%','height':'24px','align':'left'}},{'tag':'div','attributes':{'width':'85%','height':'24px','align':'left'}},{'tag':'div','attributes':{'width':'100%','height':'24px','align':'left'}},{'tag':'div','attributes':{'width':'75%','height':'24px','align':'left'}},{'tag':'div','attributes':{'width':'100%','height':'24px','align':'left'}}],'aiFeed':[{'tag':'div','attributes':{'width':'100%','height':'72px','align':'right'}},{'tag':'div','attributes':{'width':'250px','height':'40px','align':'right'}},{'tag':'div','attributes':{'width':'100%','height':'88px','align':'right'}},{'tag':'div','attributes':{'width':'150px','height':'40px','align':'right'}},{'tag':'div','attributes':{'width':'100%','height':'140px','align':'right'}},{'tag':'div','attributes':{'width':'250px','height':'40px','align':'right'}},{'tag':'div','attributes':{'width':'100%','height':'88px','align':'right'}}],'aiHistory':fr(0x5,'100%','44px','right'),'aiChatResources':fr(0x8,'100%','24px','right'),'aiReviewChecks':[{'tag':'div','attributes':{'width':'128px','height':'24px','align':'left'}},{'tag':'div','attributes':{'width':'100%','height':'24px','align':'left'}},{'tag':'div','attributes':{'width':'128px','height':'24px','align':'left'}}]};function fr(_0x316bb6,_0xdc546d,_0x16208e,_0x5ae8ce){return new Array(_0x316bb6)['fill'](null)['map'](()=>({'tag':'div','attributes':{'width':_0xdc546d,'height':_0x16208e,'align':_0x5ae8ce}}));}const br=/* #__PURE__ -- @preserve */
33
+ dt();var Sr=class extends br{['queue']=[];['isProcessing']=!0x1;_abortController;async['enqueue'](_0x3901cc){const _0x1721b1=this['createTask'](_0x3901cc);return this['queue']['push'](_0x1721b1),this['_processQueue'](),_0x1721b1['completePromise'];}abort(){this['isProcessing']&&(this['_abortController']['abort'](),this['_abortController']=void 0x0,this['queue']=[],this['fire']('_queueEmpty'),this['isProcessing']=!0x1);}get queueEmptyPromise(){return this['queue']['length']||this['isProcessing']?new Promise(_0xaf5ae0=>{this['once']('_queueEmpty',()=>{_0xaf5ae0();});}):Promise['resolve']();}async['_processQueue'](){if(!this['isProcessing']){this['_abortController']=new AbortController(),this['isProcessing']=!0x0;try{for(;this['queue']['length']&&this['isProcessing'];){const _0x359ab2=this['queue']['shift']();try{await _0x359ab2['callback'](this['_abortController']['signal']),_0x359ab2['resolve']();}catch(_0x1ec077){_0x359ab2['reject'](_0x1ec077);}}}finally{this['isProcessing']=!0x1,this['_abortController']=void 0x0;}this['fire']('_queueEmpty');}}createTask(_0x1816a0){let _0x2774ff,_0x3f450e;const _0x28513c=new Promise((_0xc05891,_0x618a08)=>{_0x2774ff=_0xc05891,_0x3f450e=_0x618a08;});return{'callback':_0x1816a0,'resolve':_0x2774ff,'reject':_0x3f450e,'completePromise':_0x28513c};}},Rr=class extends lr{constructor(_0xa7ee74){super(_0xa7ee74),this['extendTemplate']({'attributes':{'class':['ck-ai-notification','warning'===_0xa7ee74['level']?'ck-ai-notification_warning':'ck-ai-notification_error']}});}['render'](){super['render'](),this['setContent'](this['options']['initialContent']),this['markAsDone']();}setContent(_0x5d26d3){this['element']['innerHTML']=_0x5d26d3;}};const Or=['applySuggestion','insertSuggestion'];var vr=class extends _0x4ff2da{_applyChangesButton;_insertSuggestionsButton;['children'];constructor(_0x1826be,_0x4b6d49=[...Or],_0x166146){super(_0x1826be);const _0x108e9b=this['bindTemplate'],_0x2e912c=Boolean(_0x166146);this['set']('isEnabled',!_0x2e912c),this['set']('isVisible',!0x1),this['set']('isTrackChangesOn',!0x1),this['children']=this['createCollection'](),_0x2e912c||(this['_applyChangesButton']=new Mt(_0x1826be),this['_applyChangesButton']['set']({'label':Es(_0x1826be,'AI_CHAT_SUGGESTION_ACTION_APPLY_ALL'),'withText':!0x0,'type':'button','isVisible':_0x4b6d49['includes']('applySuggestion'),'class':Ln}),this['_insertSuggestionsButton']=new Mt(_0x1826be),this['_insertSuggestionsButton']['set']({'label':Es(_0x1826be,'AI_CHAT_SUGGESTION_ACTION_SUGGEST_ALL'),'withText':!0x0,'type':'button','isVisible':_0x4b6d49['includes']('insertSuggestion'),'class':Pn}),this['_insertSuggestionsButton']['on']('execute',()=>{this['fire']('insertSuggestion');}),this['_applyChangesButton']['on']('execute',()=>{this['fire']('applySuggestion');}),[this['_applyChangesButton'],this['_insertSuggestionsButton']]['forEach'](_0x4c3022=>{_0x4c3022['bind']('isEnabled')['to'](this);}),this['children']['addMany']([this['_applyChangesButton'],this['_insertSuggestionsButton']])),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__ai-suggestion__actions',_0x108e9b['if']('isVisible','ck-hidden',_0x5c9a85=>!_0x5c9a85)]},'children':this['children']}),this['on']('change:isTrackChangesOn',()=>{this['_applyChangesButton']&&(this['_applyChangesButton']['isVisible']=!this['isTrackChangesOn']);});}updateVisibility(_0x4364aa){this['isVisible']=_0x4364aa;}_switchButtonLabelsPlurality(_0x268c68){this['_applyChangesButton']&&this['_insertSuggestionsButton']&&(_0x268c68?(this['_applyChangesButton']['label']=Es(this['locale'],'AI_CHAT_SUGGESTION_ACTION_APPLY_ALL'),this['_insertSuggestionsButton']['label']=Es(this['locale'],'AI_CHAT_SUGGESTION_ACTION_SUGGEST_ALL')):(this['_applyChangesButton']['label']=Es(this['locale'],'AI_CHAT_SUGGESTION_ACTION_APPLY'),this['_insertSuggestionsButton']['label']=Es(this['locale'],'AI_CHAT_SUGGESTION_ACTION_SUGGEST')));}},kr=class extends _0x4ff2da{['children'];['balloonPanelView'];bodyCollection;constructor(_0x26d6ca,_0x277bac){super(_0x26d6ca),this['bodyCollection']=_0x277bac,this['children']=this['createCollection'](),this['set']('isVisible',!0x1),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-web-sources',this['bindTemplate']['if']('isVisible','ck-hidden',_0x1dc2dc=>!_0x1dc2dc)]},'children':this['children']});const _0x623a31=new _0x4ff2da(this['locale']),_0x4cac85=new $t();_0x4cac85['content']=ht,_0x623a31['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-web-sources__header']},'children':[_0x4cac85,{'tag':'span','children':[{'text':Es(this['locale'],'AI_CHAT_SOURCES_HEADER')}]}]}),this['children']['add'](_0x623a31),this['_setupBalloonPanel'](_0x26d6ca);}['addSource'](_0x5a6f20){this['children']['add'](new yr(this['locale'],_0x5a6f20,this['balloonPanelView']));}_setupBalloonPanel(_0x315063){this['balloonPanelView']=new xt(_0x315063),this['balloonPanelView']['extendTemplate']({'attributes':{'class':['ck-ai-web-source__tooltip-balloon']}}),this['bodyCollection']['add'](this['balloonPanelView']);}},yr=class extends Mt{['balloonPanelView'];['source'];constructor(_0x518a95,_0x492c1a,_0x5298d5){super(_0x518a95),this['source']=_0x492c1a,this['balloonPanelView']=_0x5298d5,this['set']({'label':_0x492c1a['title'],'class':['ck\x20ck-ai-web-source'],'withText':!0x0});const _0x1444d2=this['bindTemplate'];if(this['extendTemplate']({'on':{'click':_0x1444d2['to'](()=>{window['open'](_0x492c1a['url'],'_blank');}),'mouseenter':_0x1444d2['to'](()=>{this['_showTooltip']();}),'mouseleave':_0x1444d2['to'](()=>{this['_hideTooltip']();})}}),_0x492c1a['favicon']){const _0x54c429=new _0x4ff2da(_0x518a95);_0x54c429['setTemplate']({'tag':'img','attributes':{'src':_0x492c1a['favicon']||ht,'alt':_0x492c1a['title'],'class':['ck-ai-web-source__image']}}),this['children']['add'](_0x54c429);}else this['set']('icon',ht);}_createTooltipContentView(_0x89482e,_0x2958de){const _0x41b567=new _0x4ff2da(_0x89482e),_0x2e610d=[];let _0x2136e0;_0x2958de?.['favicon']?(_0x2136e0=new _0x4ff2da(_0x89482e),_0x2136e0['setTemplate']({'tag':'img','attributes':{'src':_0x2958de['favicon'],'alt':_0x2958de['title'],'class':['ck-ai-web-source__tooltip-image']}})):(_0x2136e0=new $t(),_0x2136e0['content']=ht,_0x2136e0['extendTemplate']({'attributes':{'alt':_0x2958de['title'],'class':['ck-ai-web-source__tooltip-image']}})),_0x2e610d['push'](_0x2136e0);const _0x1b0f6d=new _0x4ff2da(_0x89482e);_0x1b0f6d['setTemplate']({'tag':'a','attributes':{'class':['ck-ai-web-source__tooltip-url'],'href':_0x2958de['url']},'children':[{'text':new URL(_0x2958de['url'])?.['hostname']}]}),_0x2e610d['push'](_0x1b0f6d);const _0x101553=new _0x4ff2da(_0x89482e);_0x101553['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-web-source__tooltip-row']},'children':_0x2e610d});const _0x1a9060=new _0x4ff2da(_0x89482e);return _0x1a9060['setTemplate']({'tag':'span','attributes':{'class':['ck-ai-web-source__tooltip-row','ck-ai-web-source__tooltip-title']},'children':[{'text':_0x2958de['title']['length']>0x190?_0x2958de['title']['substring'](0x0,0x190)+'...':_0x2958de['title']}]}),_0x41b567['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-web-source__tooltip']},'children':[_0x101553,_0x1a9060]}),_0x41b567;}_showTooltip(){this['_updateTooltipContent'](),this['balloonPanelView']['pin']({'target':this['element'],'positions':[xt['defaultPositions']['northArrowSouth'],xt['defaultPositions']['northArrowSouthWest'],xt['defaultPositions']['northArrowSouthEast']],'limiter':document['querySelector']('.ck-ai-chat')}),this['balloonPanelView']['show']();}_hideTooltip(){this['balloonPanelView']['hide']();}_updateTooltipContent(){this['balloonPanelView']['content']['get'](0x0)?.['destroy'](),this['balloonPanelView']['content']['clear']();const _0x5c0e63=this['_createTooltipContentView'](this['locale'],this['source']);this['balloonPanelView']['content']['add'](_0x5c0e63);}},Nr=class extends _0x4ff2da{_actionsView;['_readOnlyByIndex']=new Map();['_sourcesView'];['_children'];_skeletonView;_showSkeletonDebounced=_0x220e40(()=>{this['_skeletonView']['isVisible']=!0x0,this['_skeletonShownAt']=Date['now']();},0x3e8);_skeletonShownAt=null;_areActionsDisabled;_showUnchangedParts;_updateContentPartsPromiseQueue;_emptyPartsWarningView;_availableActions;_cachedContentParts=[];constructor(_0x127932,_0x36259f){super(_0x127932);const {areActionsDisabled:_0x354a33,showUnchangedParts:_0x18d75f,availableActions:_0x11df96}=_0x36259f;this['_areActionsDisabled']=_0x354a33,this['_showUnchangedParts']=_0x18d75f,this['_availableActions']=_0x11df96,this['set']('isTrackChangesOn',!0x1),this['set']('isAcceptAllEnabled',!0x1),this['_children']=this['createCollection'](),this['_skeletonView']=new wr(_0x127932,Cr['aiSuggestionBody']),this['_skeletonView']['isVisible']=!0x0,this['_skeletonShownAt']=Date['now'](),this['_children']['add'](this['_skeletonView']),this['_updateContentPartsPromiseQueue']=new Sr(),this['_emptyPartsWarningView']=new Rr({'id':'empty-parts-warning','initialContent':Es(_0x127932,'AI_SUGGESTION_EMPTY_PART_WARNING'),'level':'warning'}),this['_emptyPartsWarningView']['isVisible']=!0x1,this['_actionsView']=new vr(_0x127932,_0x36259f['availableActions'],this['_areActionsDisabled']),this['_actionsView']['bind']('isTrackChangesOn')['to'](this),this['_sourcesView']=new kr(this['locale'],_0x36259f['bodyCollection']),_0x36259f['areActionsDisabled']?this['_actionsView']['isEnabled']=!0x1:this['_actionsView']['bind']('isEnabled')['to'](this,'isAcceptAllEnabled'),this['_actionsView']['delegate'](...ir)['to'](this),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__body']},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__body__content-parts']},'children':this['_children']},this['_emptyPartsWarningView'],this['_actionsView'],this['_sourcesView']]});}destroy(){this['_updateContentPartsPromiseQueue']['abort'](),this['_showSkeletonDebounced']['cancel'](),super['destroy']();}get partsCount(){return this['_contentPartViews']['length'];}get _contentPartViews(){return Array['from'](this['_children'])['filter'](_0x21964f=>_0x21964f instanceof Tr);}async updateContentParts({parts:_0x2e58a6,abortSignal:_0x34185b,skipLoadingEffects:_0x352a30}){this['_cachedContentParts']['length']?_0x2e58a6['forEach'](_0x3271cd=>{const _0x22113c=this['_cachedContentParts']['findIndex'](_0x2f8413=>_0x2f8413['index']==_0x3271cd['index']);-0x1===_0x22113c?this['_cachedContentParts']['push'](_0x3271cd):this['_cachedContentParts'][_0x22113c]=_0x3271cd;}):this['_cachedContentParts']=_0x2e58a6;const _0x27e0f2=this['_showUnchangedParts']?_0x2e58a6:_0x2e58a6['filter'](_0x516f25=>_0x516f25['hasChanges']);this['_actionsView']['_switchButtonLabelsPlurality'](_0x27e0f2['length']>0x1),_0x352a30&&(this['_showSkeletonDebounced']['cancel'](),this['_skeletonView']['isVisible']=!0x1);for(const _0x414346 of _0x2e58a6)this['_updateContentPartsPromiseQueue']['enqueue'](async _0x474792=>{let _0x3e80f3=this['getPartView'](_0x414346['index']);if(_0x3e80f3||_0x414346['hasChanges']||this['_showUnchangedParts']){if(!_0x3e80f3){if(_0x3e80f3=new Tr(this['locale'],{'part':_0x414346,'uiIndex':this['_contentPartViews']['length']+0x1,'areActionsDisabled':this['_areActionsDisabled'],'availableActions':this['_availableActions']}),_0x3e80f3['delegate'](...ir)['to'](this),_0x3e80f3['bind']('isTrackChangesOn')['to'](this),!_0x352a30&&(this['_showSkeletonDebounced']['cancel'](),await this['_awaitMinimumSkeletonDisplayTime'](_0x474792),_0x474792['aborted']))return;_0x3e80f3['isTargetReadOnly']=this['_readOnlyByIndex']['get'](_0x414346['index'])??!0x1,this['_skeletonView']['isVisible']=!0x1,this['_children']['add'](_0x3e80f3,this['_children']['length']-0x1),_0x352a30||this['_showSkeletonDebounced']();}await _0x3e80f3['updateContent']({'part':_0x414346,'showUnchangedParts':this['_showUnchangedParts'],'abortSignal':_0x474792}),_0x3e80f3['markAsDone']();}});return _0x34185b?.['addEventListener']('abort',()=>{this['_updateContentPartsPromiseQueue']['abort'](),this['_showSkeletonDebounced']['cancel'](),this['_skeletonView']['isVisible']=!0x1;}),this['_updateContentPartsPromiseQueue']['queueEmptyPromise'];}updatePartState(_0x33f4a2,_0x312fd1,_0x1b2ac2){const _0x4e390c=this['getPartView'](_0x33f4a2);_0x4e390c&&(_0x4e390c['outdatedReason']=_0x1b2ac2,_0x4e390c['state']=_0x312fd1);}setGating({readOnlyByIndex:_0x5d98cf,isAcceptAllEnabled:_0x14b061}){this['_readOnlyByIndex']=_0x5d98cf,this['isAcceptAllEnabled']=_0x14b061;for(const _0x24175d of this['_contentPartViews'])_0x24175d['isTargetReadOnly']=_0x5d98cf['get'](_0x24175d['partDefinition']['index'])??!0x1;}setPartActive(_0x182bbc,_0x352f39){if(!0x1===_0x182bbc){for(const _0x38b113 of this['_contentPartViews'])_0x38b113['isActive']=!0x1;}else{const _0x305b58=this['getPartView'](_0x182bbc);_0x305b58&&(_0x305b58['isActive']=_0x352f39);}}updateSources(_0x550980){_0x550980['forEach'](_0x1427bf=>this['_sourcesView']['addSource'](_0x1427bf)),this['_sourcesView']['isVisible']=!0x0;}getPartView(_0x48b859){return this['_contentPartViews']['find'](_0x962826=>_0x962826['partDefinition']['index']==_0x48b859)??null;}['markAsDone'](){if(!this['_showUnchangedParts']){const _0x31c285=!this['_cachedContentParts']['find'](({hasChanges:_0x425f48})=>_0x425f48),_0x10ddd9=!!this['_cachedContentParts']['find'](({hasChanges:_0x2daa79})=>!_0x2daa79);this['_emptyPartsWarningView']['isVisible']=0x0==this['_contentPartViews']['length']||_0x10ddd9,_0x31c285?this['_emptyPartsWarningView']['setContent'](Es(this['locale'],'AI_SUGGESTION_NO_PARTS_WARNING')):this['_emptyPartsWarningView']['setContent'](Es(this['locale'],'AI_SUGGESTION_EMPTY_PART_WARNING'));}this['_contentPartViews']['forEach'](_0x3a4bb8=>_0x3a4bb8['markAsDone']()),this['_skeletonView']['isVisible']=!0x1,this['_showSkeletonDebounced']['cancel'](),this['_actionsView']['updateVisibility'](this['hasNonEmptyParts']&&!this['_areActionsDisabled']);}async _awaitMinimumSkeletonDisplayTime(_0x386f83){if(!this['_skeletonView']['isVisible']||null===this['_skeletonShownAt'])return;const _0x193ecb=0x3e8-(Date['now']()-this['_skeletonShownAt']);if(this['_skeletonShownAt']=null,_0x193ecb>0x0){const {promise:_0x5ed385,abortController:_0x1f80b7}=nr(_0x193ecb);_0x386f83?.['addEventListener']('abort',()=>_0x1f80b7['abort']()),await _0x5ed385['catch'](()=>{});}}get hasNonEmptyParts(){return this['_contentPartViews']['filter'](_0x1d4c65=>_0x1d4c65['partDefinition']['hasChanges'])['length']>0x0;}},xr=class extends _0x4ff2da{['bodyView'];['children'];['headerView'];constructor(_0x2c5611,_0x3a218f,_0x5e00d6){super(_0x2c5611);const {showDiff:_0x13252e,areActionsDisabled:_0xebbddc,showUnchangedParts:_0x216c9c,availableActions:_0x2ff3fe}=_0x3a218f;this['set']('isTrackChangesOn',!0x1),this['set']('areChangesVisible',!0x1),this['children']=this['createCollection'](),this['headerView']=new ur(_0x2c5611,{'showDiff':_0x13252e}),this['headerView']['on']('toggleShowChanges',(_0x20575f,_0x5eade7)=>{this['areChangesVisible']=_0x5eade7['isOn'],this['fire']('toggleSuggestionDisplayMode',{'showDiff':_0x5eade7['isOn']});}),this['children']['add'](this['headerView']),this['bodyView']=new Nr(_0x2c5611,{'areActionsDisabled':_0xebbddc,'showUnchangedParts':!!_0x216c9c,'availableActions':_0x2ff3fe,'bodyCollection':_0x5e00d6}),this['bodyView']['delegate'](...ir)['to'](this),this['bodyView']['bind']('isTrackChangesOn')['to'](this),this['children']['add'](this['bodyView']),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__container','ck-rounded-corners']},'children':this['children']});}async updateContent(_0x24fe66){await this['bodyView']['updateContentParts'](_0x24fe66);}updateSources(_0x3ec4fd){this['bodyView']['updateSources'](_0x3ec4fd);}['markAsDone'](){this['bodyView']['markAsDone'](),this['headerView']&&(this['headerView']['isShowChangesToggleVisible']=this['bodyView']['hasNonEmptyParts']);}},Lr=class extends lr{containerView;constructor(_0x4efecd,_0x5e6570,_0x18dd23){super(_0x5e6570),this['set']('isTrackChangesOn',!0x1),this['containerView']=new xr(_0x4efecd,{'showDiff':_0x5e6570['showDiff'],'areActionsDisabled':_0x5e6570['areActionsDisabled'],'availableActions':_0x5e6570['availableActions']},_0x18dd23),this['containerView']['on']('toggleSuggestionDisplayMode',(_0x484ceb,_0x3f4d03)=>{this['fire']('toggleSuggestionDisplayMode',{'replyId':this['options']['id'],'showDiff':_0x3f4d03['showDiff']});}),this['containerView']['bind']('isTrackChangesOn')['to'](this),this['containerView']['on']('like',()=>{this['fire']('like',{'replyId':this['options']['id']});}),this['containerView']['on']('dislike',()=>{this['fire']('dislike',{'replyId':this['options']['id']});}),this['containerView']['on']('showChangeInText',(_0x146e7f,{index:_0x267533})=>{this['fire']('showChangeInText',{'replyId':this['options']['id'],'partIndex':_0x267533});}),this['containerView']['on']('applySuggestion',(_0x3f9c7f,{index:_0x3fbd75}={})=>{this['fire']('applySuggestion',{'replyId':this['options']['id'],'partIndex':_0x3fbd75});}),this['containerView']['on']('insertSuggestion',(_0x1d9582,{index:_0x11c1e8}={})=>{this['fire']('insertSuggestion',{'replyId':this['options']['id'],'partIndex':_0x11c1e8});}),this['containerView']['on']('rejectSuggestion',(_0x57c29e,{index:_0x3d099c})=>{this['fire']('rejectSuggestion',{'replyId':this['options']['id'],'partIndex':_0x3d099c});}),this['containerView']['on']('mouseOverSuggestion',(_0xec02a7,{index:_0x4d3bf6})=>{this['fire']('mouseOverSuggestion',{'replyId':this['options']['id'],'partIndex':_0x4d3bf6});}),this['containerView']['on']('mouseLeaveSuggestion',(_0x123310,{index:_0x2daed7})=>{this['fire']('mouseLeaveSuggestion',{'replyId':this['options']['id'],'partIndex':_0x2daed7});}),this['children']['addMany']([this['containerView']]),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__ai-suggestion']}});}async updateContent(_0x44cfaf){await this['containerView']['updateContent'](_0x44cfaf);}updatePartState(_0x50fba7,_0x2d5fb9,_0x584319){this['containerView']['bodyView']['updatePartState'](_0x50fba7,_0x2d5fb9,_0x584319);}setPartActive(_0xf1c7c9,_0x452611){!0x1===_0xf1c7c9?this['containerView']['bodyView']['setPartActive'](!0x1):this['containerView']['bodyView']['setPartActive'](_0xf1c7c9,_0x452611);}updateSources(_0x18ac00){this['containerView']['updateSources'](_0x18ac00);}getPartView(_0x240cee){return this['containerView']['bodyView']['getPartView'](_0x240cee);}setGating(_0x4524f0){this['containerView']['bodyView']['setGating'](_0x4524f0);}['markAsDone'](){super['markAsDone'](),this['containerView']['markAsDone']();}},Pr=class extends lr{replyContainer;_bodyCollection;constructor(_0x5bc968,_0xb95d95,_0x4fdee8){super(_0xb95d95),this['_bodyCollection']=_0x4fdee8,this['locale']=_0x5bc968,this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__ai-reply']}}),this['replyContainer']=new _0x4ff2da(),this['replyContainer']['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all-excluded','ck-ai-chat__feed__ai-reply-container','ck-ai-chat-content']}}),this['children']['add'](this['replyContainer']);}async['render'](){super['render'](),this['options']['initialContent']&&(await this['updateContent']({'parsedContent':Rs(this['options']['initialContent']),'renderingStrategy':'static'}),this['markAsDone']());}async updateContent({parsedContent:_0x48d84b,renderingStrategy:_0x4c672a,abortSignal:_0x24c741}){'streaming'===_0x4c672a?await this['streamIntoElement'](_0x48d84b,this['replyContainer']['element'],_0x24c741):this['replyContainer']['element']['innerHTML']=_0x3a1450(_0x48d84b);}updateSources(_0x4b6d29){const _0x5715d1=new kr(this['locale'],this['_bodyCollection']);_0x5715d1['children']['addMany'](_0x4b6d29['map'](_0x53ef76=>new yr(this['locale'],_0x53ef76,_0x5715d1['balloonPanelView']))),_0x5715d1['isVisible']=!0x0,this['children']['add'](_0x5715d1);}},Dr=class extends _0x5a896c{constructor(_0xe6a9c4=void 0x0){super();const _0x5523c0=_0xe6a9c4?'ck-ai-spinner_'+_0xe6a9c4:'';this['extendTemplate']({'tag':'span','attributes':{'class':['ck-ai-spinner',_0x5523c0]}});}};const Hr={'file':_0x544acb,'image':_0x46256d,'document':_0x38d218,'web-resource':_0x43c1c8,'text':_0x544acb,'selection':tt,'mcp-tool-context':_0x38d218,'context':_0x38d218},Mr='ck-ai-chat-context-chip',Ur='ck-ai-chat-context-chip_wide',Vr='ck-ai-chat-context-chip_document',Br='ck-ai-chat-context-chip__label',Gr='ck-ai-chat-context-chip__type-icon',Fr='ck-ai-chat-context-controls__chip-tooltip',Kr='n';var Wr=class extends Mt{constructor(_0x1185c1,_0x4eb01b,_0x792987,_0x1f2c24,_0x7ae9c1=!0x1){super(_0x1185c1),this['_isAnimationOnEnterEnabled']=_0x1f2c24,this['_initializeProperties'](_0x4eb01b,_0x792987,_0x7ae9c1),this['_setupTemplate']();}['render'](){super['render'](),this['_isAnimationOnEnterEnabled']&&this['element']&&(this['element']['classList']['add']('ck-ai-chat-context-chip_new-chip'),this['_handleAnimationEndOnce'](this['element'],()=>{this['element']&&this['element']['classList']['remove']('ck-ai-chat-context-chip_new-chip');}));}disableAnimationOnEnter(){this['_isAnimationOnEnterEnabled']=!0x1,this['element']&&this['element']['classList']['remove']('ck-ai-chat-context-chip_new-chip');}_initializeProperties(_0x106170,_0x253f35,_0x230894){this['set']('label',_0x106170['label']),this['set']('tooltip',!0x0),this['set']('itemType',_0x106170['type']),this['set']('id',_0x106170['uiId']),this['set']('readonly',_0x253f35),this['set']('isLoading',_0x230894);}_setupTemplate(){const _0x1ad1c8=this['_createIconView'](),_0x4233f6=this['_createRemoveButton'](),_0x2518ca=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':this['_createTemplateAttributes'](_0x2518ca),'children':this['_createTemplateChildren'](_0x1ad1c8,_0x4233f6,_0x2518ca)});}_createTemplateAttributes(_0x423d64){return{'class':[Mr,_0x423d64['if']('itemType',Vr,_0x13f697=>'document'==_0x13f697),_0x423d64['if']('itemType',Ur,_0x1a4ec4=>'selection'==_0x1a4ec4)],'data-cke-tooltip-text':_0x423d64['to']('label',Yr),'data-cke-tooltip-position':Kr,'data-cke-tooltip-class':Fr};}_createTemplateChildren(_0x5cc22a,_0x2f05b7,_0x1f4eb0){const _0x3041f9=this['_createLabelElement'](_0x1f4eb0),_0x512089=this['_createLoaderIcon']();return this['readonly']?[_0x5cc22a,_0x3041f9]:[_0x5cc22a,_0x512089,_0x3041f9,_0x2f05b7];}_createLabelElement(_0x436263){return{'tag':'span','attributes':{'class':Br},'children':[{'text':_0x436263['to']('label')}]};}_createRemoveButton(){const _0x135303=new Mt(this['locale']);return _0x135303['set']({'label':Es(this['locale'],'AI_CHAT_CONTEXT_REMOVE_FROM_CONTEXT'),'icon':_0xabec2d}),this['_setupRemoveButtonEvent'](_0x135303),_0x135303;}_setupRemoveButtonEvent(_0x4acd1f){_0x4acd1f['on']('execute',()=>{this['fire']('removeContextItemChip',this['id']);});}_createIconView(){const _0x1aa537=this['bindTemplate'],_0x51c8d6=new $t();return _0x51c8d6['content']=Hr[this['itemType']],_0x51c8d6['extendTemplate']({'attributes':{'class':[Gr,_0x1aa537['if']('isLoading','ck-hidden',_0x22002f=>_0x22002f)]}}),_0x51c8d6;}_handleAnimationEndOnce(_0x3e75d8,_0x376d05){if(!_0x3e75d8)return;const _0x4dba7a=()=>{_0x376d05(),_0x3e75d8['removeEventListener']('animationend',_0x4dba7a),_0x3e75d8['removeEventListener']('webkitAnimationEnd',_0x4dba7a);};_0x3e75d8['addEventListener']('animationend',_0x4dba7a),_0x3e75d8['addEventListener']('webkitAnimationEnd',_0x4dba7a);}_createLoaderIcon(){const _0x229768=new Dr('small');return _0x229768['bind']('isVisible')['to'](this,'isLoading',_0x18680c=>_0x18680c),_0x229768;}};function Yr(_0x1640fa){if(!_0x1640fa)return _0x1640fa;if(_0x1640fa['length']<=0x78)return _0x1640fa;const _0x4f4cd2=_0x1640fa['slice'](0x0,0x78),_0x590bcb=_0x4f4cd2['lastIndexOf']('\x20');return(_0x590bcb>0x0?_0x4f4cd2['slice'](0x0,_0x590bcb):_0x4f4cd2)+'…';}const $r={'maxVisibleRows':0x2,'rowDetectionTolerance':0x5,'showMoreLabelPrefix':'+\x20','viewportOffset':{'top':0x64,'bottom':0xa}},qr='300px';var Qr=class{['_locale'];['_config'];['_visibleChips'];['_overflowChips'];_showMoreButtonView=null;['_showMoreBalloonPanelView']=null;_containerElement=null;_bodyCollection;_parentView=null;_intersectionObserver=null;_pendingCalculation=!0x1;constructor(_0x29807a,_0xb06118,_0x3cd42e,_0x28a991,_0x43f946){this['_locale']=_0x29807a,this['_visibleChips']=_0xb06118,this['_config']={...$r,..._0x3cd42e,'cssClasses':{'controlsButton':'','calculationContainer':'ck-calculation-container',..._0x3cd42e['cssClasses']}},this['_overflowChips']=new lt(),this['_bodyCollection']=_0x28a991,this['_parentView']=_0x43f946||null;}setContainerElement(_0x47cb6d){this['_intersectionObserver']&&(this['_intersectionObserver']['disconnect'](),this['_intersectionObserver']=null),this['_containerElement']=_0x47cb6d,this['_setupVisibilityObserver']();}get showMoreButtonView(){return this['_showMoreButtonView'];}get['overflowChips'](){return this['_overflowChips'];}['reorganizeChips'](){requestAnimationFrame(()=>{this['_checkAndHandleOverflow']();});}['showBalloonPanel'](){this['_showMoreButtonView']&&this['_showMoreBalloonPanelView']&&(this['_updateBalloonContent'](),this['_showMoreButtonView']['isOn']=!0x0,this['_showMoreBalloonPanelView']['show'](),this['_showMoreBalloonPanelView']['pin']({'target':this['_showMoreButtonView']['element'],'limiter':document['querySelector']('.ck-ai-chat')}));}['hideBalloonPanel'](){this['_showMoreButtonView']&&this['_showMoreBalloonPanelView']&&(this['_showMoreButtonView']['isOn']=!0x1,this['_showMoreBalloonPanelView']['hide']());}['clear'](){this['_overflowChips']['clear'](),this['hideBalloonPanel'](),this['_updateShowMoreButtonVisibility'](),this['_showMoreButtonView']&&(this['_showMoreButtonView']['label']=''),this['_showMoreBalloonPanelView']&&this['_showMoreBalloonPanelView']['content']['clear']();}destroy(){this['_intersectionObserver']&&(this['_intersectionObserver']['disconnect'](),this['_intersectionObserver']=null),this['_showMoreButtonView']&&(this['_showMoreButtonView']['destroy'](),this['_showMoreButtonView']=null),this['_showMoreBalloonPanelView']&&(this['_showMoreBalloonPanelView']['destroy'](),this['_showMoreBalloonPanelView']=null);}['_checkAndHandleOverflow'](){if(!this['_containerElement'])return;if(!this['_isContainerVisible']())return void(this['_pendingCalculation']=!0x0);this['_pendingCalculation']=!0x1;const _0x4953d7=[...this['_visibleChips'],...this['_overflowChips']],_0x43e65b=this['_createCalculationContainer'](),_0x550681=this['_calculateOverflowInContainer'](_0x43e65b,_0x4953d7),_0x450c26=_0x43e65b['_ancestorsToRestore'];_0x450c26&&this['_restoreAncestorVisibility'](_0x450c26),_0x43e65b['remove'](),this['_applyOverflowResults'](_0x4953d7,_0x550681);}_createShowMoreButton(){this['_showMoreButtonView']=this['_createShowMoreButtonView'](),this['_showMoreBalloonPanelView']=this['_createShowMoreBalloonPanelView'](),this['_showMoreButtonView']['render'](),this['_containerElement']['appendChild'](this['_showMoreButtonView']['element']),this['_showMoreButtonView']['on']('execute',()=>{this['_handleShowMoreButtonClick']();}),_0x341840({'emitter':this['_showMoreBalloonPanelView'],'contextElements':[this['_showMoreBalloonPanelView']['element'],this['_showMoreButtonView']['element']],'callback':()=>this['hideBalloonPanel'](),'activator':()=>this['_showMoreButtonView']['isOn']});}_createShowMoreButtonView(){const _0x2baae0=new Mt(this['_locale']);_0x2baae0['set']({'label':'','withText':!0x0,'isToggleable':!0x0});const _0x4a1ed7=[this['_config']['cssClasses']['showMoreButton']];return this['_config']['cssClasses']['controlsButton']&&_0x4a1ed7['push'](this['_config']['cssClasses']['controlsButton']),_0x2baae0['extendTemplate']({'attributes':{'class':_0x4a1ed7}}),_0x2baae0;}_createShowMoreBalloonPanelView(){const _0x1c6610=new xt(this['_locale']);return _0x1c6610['extendTemplate']({'attributes':{'class':this['_config']['cssClasses']['showMoreBalloon']}}),this['_bodyCollection']['add'](_0x1c6610),_0x1c6610;}_updateBalloonContent(){if(this['_showMoreBalloonPanelView']&&(this['_showMoreBalloonPanelView']['content']['clear'](),this['_overflowChips']['length']>0x0)){this['_overflowChips']['forEach'](_0x206a60=>{_0x206a60['disableAnimationOnEnter']();});const _0x5708e0=new _0x4ff2da(this['_locale']);_0x5708e0['setTemplate']({'tag':'div','attributes':{'class':this['_config']['cssClasses']['overflowContainer']},'children':this['_overflowChips']}),this['_showMoreBalloonPanelView']['content']['add'](_0x5708e0);}}_handleShowMoreButtonClick(){this['_showMoreButtonView']['isOn']?this['hideBalloonPanel']():this['showBalloonPanel']();}_updateShowMoreButtonVisibility(){const _0x1b4336=this['_overflowChips']['length']>0x0;this['_showMoreButtonView']?.['element']&&(this['_showMoreButtonView']['element']['style']['display']=_0x1b4336?'':'none');}['_repinBalloonPanel'](){this['_showMoreButtonView']?.['isOn']&&this['_showMoreBalloonPanelView']?.['isVisible']&&this['_showMoreButtonView']['element']&&this['_showMoreBalloonPanelView']['pin']({'target':this['_showMoreButtonView']['element'],'limiter':document['querySelector']('.ck-ai-chat')});}_findTargetContainer(_0x1393a5){const _0x37cfb5=this['_containerElement']?.['tagName']['toLowerCase']()||'div',_0x1a2658=this['_containerElement']?.['classList'];if(_0x1a2658){const _0xe8642c=_0x1a2658[0x0]||'',_0x378f90=_0x1393a5['querySelector']('.'+_0xe8642c),_0x5379e4=_0x1393a5['querySelector'](_0x37cfb5);return _0x378f90||_0x5379e4||_0x1393a5;}return _0x1393a5['querySelector'](_0x37cfb5)||_0x1393a5;}_calculateContainerWidth(){const _0x332a8a=this['_parentView']?.['element']||this['_containerElement'];if(!_0x332a8a)return qr;const _0x583d9e=window['getComputedStyle'](_0x332a8a)['width'];if('auto'===_0x583d9e||'0px'===_0x583d9e||!_0x583d9e){const _0x57c404=_0x332a8a['parentElement'];if(_0x57c404){const _0x3da5cd=window['getComputedStyle'](_0x57c404);return'auto'!==_0x3da5cd['width']?_0x3da5cd['width']:qr;}return qr;}return _0x583d9e;}_applyCalculationStyles(_0xedbcd0,_0x2b3750){this['_config']['cssClasses']['calculationContainer']&&_0xedbcd0['classList']['add'](this['_config']['cssClasses']['calculationContainer']),_0xedbcd0['style']['width']=_0x2b3750,_0xedbcd0['style']['position']='absolute',_0xedbcd0['style']['top']='-9999px',_0xedbcd0['style']['left']='-9999px',_0xedbcd0['style']['opacity']='0',_0xedbcd0['style']['pointerEvents']='none',_0xedbcd0['style']['zIndex']='-1',_0xedbcd0['style']['visibility']='visible\x20!important',_0xedbcd0['style']['display']='block\x20!important',_0xedbcd0['style']['boxSizing']='border-box';}_restoreAncestorVisibility(_0x212ee7){_0x212ee7['forEach'](({element:_0x4237b8,originalDisplay:_0x4a4702,originalVisibility:_0x4aa41f})=>{_0x4237b8['style']['display']=_0x4a4702,_0x4237b8['style']['visibility']=_0x4aa41f;});}_makeAncestorsVisible(_0x5cbb6f){const _0x5d20fd=[];let _0x5bb933=_0x5cbb6f;for(;_0x5bb933&&_0x5bb933!==document['body'];){const _0x218114=window['getComputedStyle'](_0x5bb933);'none'!==_0x218114['display']&&'hidden'!==_0x218114['visibility']||(_0x5d20fd['push']({'element':_0x5bb933,'originalDisplay':_0x5bb933['style']['display'],'originalVisibility':_0x5bb933['style']['visibility']}),_0x5bb933['style']['display']='block',_0x5bb933['style']['visibility']='visible'),_0x5bb933=_0x5bb933['parentElement'];}return _0x5d20fd;}_createContainerElements(){let _0x161542,_0x5322cd;return this['_parentView']?.['element']?(_0x161542=this['_parentView']['element']['cloneNode'](!0x0),_0x5322cd=this['_findTargetContainer'](_0x161542)):(_0x161542=document['createElement']('div'),_0x5322cd=_0x161542),{'calculationContainer':_0x161542,'targetContainer':_0x5322cd};}_createCalculationContainer(){const {calculationContainer:_0x3f7b6a,targetContainer:_0x2b9722}=this['_createContainerElements'](),_0x34caa1=this['_calculateContainerWidth']();this['_applyCalculationStyles'](_0x3f7b6a,_0x34caa1);const _0xfe209a=(this['_parentView']?.['element']||this['_containerElement'])?.['parentElement'];_0xfe209a?_0xfe209a['appendChild'](_0x3f7b6a):document['body']['appendChild'](_0x3f7b6a),_0x3f7b6a['_targetContainer']=_0x2b9722;const _0x391743=this['_makeAncestorsVisible'](_0xfe209a||null);return _0x3f7b6a['offsetWidth'],_0x3f7b6a['_ancestorsToRestore']=_0x391743,_0x3f7b6a;}_calculateOverflowInContainer(_0x2a0b3d,_0x56a624){const _0x2ab0bd=_0x2a0b3d['_targetContainer']||_0x2a0b3d,_0xc933dc=[],{rowCount:_0x417ce5}=this['_renderChipsAndCountRows'](_0x2ab0bd,_0x56a624);if(_0x417ce5<=this['_config']['maxVisibleRows'])return _0xc933dc;const _0x275f06=_0x56a624['slice']();for(;_0x275f06['length']>0x0;){if(this['_testButtonFit'](_0x2a0b3d,_0x2ab0bd,_0x275f06)){const _0x542655=_0x56a624['filter'](_0x2cfcf9=>!_0x275f06['includes'](_0x2cfcf9));_0xc933dc['push'](..._0x542655);break;}if(!_0x275f06['pop']())break;}return _0xc933dc;}_renderChipsAndCountRows(_0x3595e1,_0x120ece){_0x3595e1['innerHTML']='',_0x120ece['forEach'](_0x43bd4b=>{if(_0x43bd4b['element']){const _0x39e3c1=_0x43bd4b['element']['cloneNode'](!0x0);_0x3595e1['appendChild'](_0x39e3c1);}}),_0x3595e1['offsetWidth'];const _0x46fe79=_0x3595e1['children'],_0x541422=[];return Array['from'](_0x46fe79)['forEach'](_0x5e225e=>{const _0x5d4371=_0x5e225e['getBoundingClientRect']()['top'];_0x541422['some'](_0x9c8736=>Math['abs'](_0x9c8736-_0x5d4371)<this['_config']['rowDetectionTolerance'])||_0x541422['push'](_0x5d4371);}),{'rowCount':_0x541422['length']};}_createMockButton(){const _0x324407=document['createElement']('button');return _0x324407['className']=this['_config']['cssClasses']['showMoreButton'],this['_config']['cssClasses']['controlsButton']&&_0x324407['classList']['add'](this['_config']['cssClasses']['controlsButton']),_0x324407['textContent']='+\x201',_0x324407;}_testButtonFit(_0x4c8712,_0x30228d,_0x3d53dc){this['_renderChipsAndCountRows'](_0x30228d,_0x3d53dc);const _0x2c5295=this['_createMockButton']();_0x4c8712['appendChild'](_0x2c5295),_0x4c8712['offsetWidth'];const _0x13ed58=[..._0x30228d['children'],_0x2c5295],_0x179251=[];_0x13ed58['forEach'](_0x19f256=>{const _0x38074b=_0x19f256['getBoundingClientRect']()['top'];_0x179251['some'](_0x3c1ce3=>Math['abs'](_0x3c1ce3-_0x38074b)<this['_config']['rowDetectionTolerance'])||_0x179251['push'](_0x38074b);});const _0x4f3cbb=_0x179251['length'];return _0x2c5295['remove'](),_0x4f3cbb<=this['_config']['maxVisibleRows'];}_distributeChips(_0x247e77,_0xc8b700){this['_visibleChips']['clear'](),this['_overflowChips']['clear'](),_0x247e77['forEach'](_0x1335ef=>{_0xc8b700['includes'](_0x1335ef)?this['_overflowChips']['add'](_0x1335ef):this['_visibleChips']['add'](_0x1335ef);});}_updateOverflowUI(_0x3acef7){if(_0x3acef7>0x0&&!this['_showMoreButtonView']&&this['_createShowMoreButton'](),_0x3acef7>0x0&&this['_showMoreButtonView']){const _0x253166=''+this['_config']['showMoreLabelPrefix']+(_0x3acef7<0x63?_0x3acef7:'99');this['_showMoreButtonView']['label']=_0x253166;}this['_updateBalloonContent'](),this['_updateShowMoreButtonVisibility'](),this['_repinBalloonPanel']();}_applyOverflowResults(_0x75a1ec,_0x5c8703){this['_distributeChips'](_0x75a1ec,_0x5c8703),this['_updateOverflowUI'](_0x5c8703['length']);}_setupVisibilityObserver(){this['_containerElement']&&'undefined'!=typeof IntersectionObserver&&(this['_intersectionObserver']=new IntersectionObserver(_0x2c8f77=>{_0x2c8f77[0x0]['isIntersecting']&&this['_pendingCalculation']&&requestAnimationFrame(()=>{this['_checkAndHandleOverflow']();});},{'threshold':0.01,'rootMargin':'50px'}),this['_intersectionObserver']['observe'](this['_containerElement']));}_isContainerVisible(){if(!this['_containerElement'])return!0x1;if(!this['_containerElement']['isConnected'])return!0x1;const _0x2088e4=this['_containerElement']['getBoundingClientRect']();if(0x0===_0x2088e4['width']||0x0===_0x2088e4['height'])return!0x1;const _0x5b3f27=window['innerHeight']||document['documentElement']['clientHeight'],_0x1698d4=window['innerWidth']||document['documentElement']['clientWidth'];return _0x2088e4['bottom']>=-0xc8&&_0x2088e4['top']<=_0x5b3f27+0xc8&&_0x2088e4['right']>=-0xc8&&_0x2088e4['left']<=_0x1698d4+0xc8;}};const Xr='ck-ai-chat__feed__context-chips',zr='ck-ai-chat-context-chips-wrapper',jr='ck-ai-chat-context-chips-wrapper-balloon',Jr='ck-ai-chat-controls-button',Zr='ck-ai-chat-controls_context_show-more-button',to='ck-ai-chat-context-controls__show-more-balloon-panel';var eo=class extends _0x4ff2da{_contextChips=this['createCollection']();['_overflowManager'];_bodyCollection;constructor(_0x1c4880,_0x2caf3c,_0x288756){super(_0x1c4880),this['_bodyCollection']=_0x288756,this['_createContextChips'](_0x2caf3c);const _0x10ac8f={'cssClasses':{'showMoreButton':Zr+'\x20'+Dn,'showMoreBalloon':to,'overflowContainer':jr,'controlsButton':Jr}};this['_overflowManager']=new Qr(_0x1c4880,this['_contextChips'],_0x10ac8f,this['_bodyCollection'],this),this['setTemplate']({'tag':'div','attributes':{'class':[Xr,'ck','ck-reset_all']},'children':[{'tag':'div','attributes':{'class':zr},'children':this['_contextChips']}]});}['render'](){super['render']();const _0x55937d=this['element']['querySelector']('.'+zr);_0x55937d&&(this['_overflowManager']['setContainerElement'](_0x55937d),this['_overflowManager']['reorganizeChips']());}destroy(){super['destroy'](),this['_overflowManager']['destroy']();}_createContextChips(_0xbe6166){for(const _0x1e682a of _0xbe6166){const _0x2baec2=new Wr(this['locale'],_0x1e682a,!0x0,!0x1);this['_contextChips']['add'](_0x2baec2);}}},io=class extends lr{_contextChipsView=null;['_locale'];_bodyCollection;_messageContentView;constructor(_0x23b8a0,_0x1f9438,_0x7aa368){super(_0x1f9438),this['_locale']=_0x23b8a0,this['_bodyCollection']=_0x7aa368,this['_createContextChipsView'](),this['_createMessageContentView'](),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__user-message']}});}_createContextChipsView(){this['options']['contextItems']&&this['options']['contextItems']['length']>0x0&&(this['_contextChipsView']=new eo(this['_locale'],this['options']['contextItems']['filter'](_0x528b43=>!_0x528b43['hidden']),this['_bodyCollection']),this['_contextChipsView']['extendTemplate']({'attributes':{'class':'ck-ai-chat__feed__context-chips'}}),this['children']['add'](this['_contextChipsView']));}_createMessageContentView(){this['_messageContentView']=new _0x4ff2da(this['_locale']),this['_messageContentView']['setTemplate']({'tag':'div','attributes':{'class':['ck-reset_all-excluded','ck-ai-chat__feed__message-content','ck-ai-chat-content']}}),this['children']['add'](this['_messageContentView']);}['render'](){super['render'](),this['_messageContentView']['element']['innerHTML']=this['options']['initialContent'],this['markAsDone']();}},so=class extends lr{capabilities;constructor(_0x12c2ff,_0xaf4d4d){super(_0xaf4d4d);const {isWebSearchEnabled:_0x2c470c,isReasoningEnabled:_0x504648}=_0xaf4d4d['capabilities'],_0x2e91e7=[];let _0x199184='';_0x2c470c&&_0x504648?(_0x199184=Es(_0x12c2ff,'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH_REASONING'),_0x2e91e7['push'](no(ht)),_0x2e91e7['push'](no(_0x588d47))):_0x2c470c?(_0x199184=Es(_0x12c2ff,'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH'),_0x2e91e7['push'](no(ht))):_0x504648&&(_0x199184=Es(_0x12c2ff,'AI_CHAT_FEED_REPLY_ITEM_USED_REASONING'),_0x2e91e7['push'](no(_0x588d47))),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__interaction-header',_0x199184?'':'ck-hidden']}});const _0x142f6f=new _0x4ff2da();_0x142f6f['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__interaction-header__capabilities']},'children':[..._0x2e91e7,{'tag':'span','attributes':{'class':['ck-ai-chat__feed__interaction-header__capabilities__text']},'children':[_0x199184]}]}),this['children']['add'](_0x142f6f),this['capabilities']=_0xaf4d4d['capabilities'];}};function no(_0x5f2be4){const _0x466851=new $t();return _0x466851['content']=_0x5f2be4,_0x466851;}const ro=['wheel','touchstart','pointerdown','keydown'],oo=['ArrowUp','ArrowDown','PageUp','PageDown','Home','End','\x20'];var ao=class{element;animationFrameId;['isRunning'];abortController;['isUserPaused'];['scrollBehavior'];constructor(_0x52625a){this['element']=_0x52625a,this['animationFrameId']=null,this['isRunning']=!0x1,this['abortController']=new AbortController(),this['isUserPaused']=!0x1,this['scrollBehavior']='smooth';for(const _0x78dc23 of ro){const _0x128c55='keydown'!==_0x78dc23;this['element']['addEventListener'](_0x78dc23,this['_onUserEvent']['bind'](this),{'passive':_0x128c55,'signal':this['abortController']['signal']});}}start({smooth:_0xe19e6b=!0x0}={}){this['isRunning']||(this['isRunning']=!0x0,this['isUserPaused']=!0x1,this['scrollBehavior']=_0xe19e6b?'smooth':'auto',this['animationFrameId']=requestAnimationFrame(this['_rafUpdate']['bind'](this)));}stop(){requestAnimationFrame(()=>{this['_stop']();});}destroy(){this['_stop'](),this['abortController']['abort']();}_stop(){null!==this['animationFrameId']&&(cancelAnimationFrame(this['animationFrameId']),this['animationFrameId']=null),this['isRunning']&&(this['isRunning']=!0x1),this['isUserPaused']=!0x1;}_onUserEvent(_0x552d1e){if(this['isRunning']){if('keydown'===_0x552d1e['type']){const _0xa6654d=_0x552d1e['key'];if(!oo['includes'](_0xa6654d))return;}_0x552d1e instanceof WheelEvent?_0x552d1e['deltaY']<0x0?this['isUserPaused']=!0x0:this['isUserPaused']=!this['_isAtBottom']():this['isUserPaused']=!0x0;}}_isAtBottom(){const {scrollTop:_0x1bf5cc,scrollHeight:_0x15bf39,clientHeight:_0x101973}=this['element'];return _0x15bf39-_0x1bf5cc-_0x101973<=0x5;}_rafUpdate(){this['isRunning']&&(this['isUserPaused']||this['element']['scrollTo']({'top':this['element']['scrollHeight'],'behavior':this['scrollBehavior']}),this['animationFrameId']=requestAnimationFrame(this['_rafUpdate']['bind'](this)));}},ho=class extends lr{constructor(_0x2b9da7){super(_0x2b9da7),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__custom-element']}});}async['render'](){super['render'](),'string'==typeof this['options']['content']?this['element']['innerHTML']=this['options']['content']:this['element']['appendChild'](this['options']['content']);}},co=class extends _0x4ff2da{['children'];['scrollManager'];_bodyCollection;constructor(_0x221d06,_0x447557){super(_0x221d06),this['_bodyCollection']=_0x447557,this['set']('loadingMessage',''),this['set']('isLoadingSkeletonVisible',!0x1),this['set']('isTrackChangesOn',!0x1),this['children']=this['createCollection'](),this['children']['delegate'](...sr)['to'](this),this['_setupTemplate']();}['render'](){super['render'](),this['scrollManager']=new ao(this['element']);}destroy(){super['destroy'](),this['scrollManager']['destroy']();}['clear'](){this['children']['clear']();}addItem(_0x2c3c4b,_0x2384a4){let _0x109798;return'ai-reply'===_0x2c3c4b?_0x109798=new Pr(this['locale'],_0x2384a4,this['_bodyCollection']):'ai-suggestion-reply'===_0x2c3c4b?(_0x109798=new Lr(this['locale'],_0x2384a4,this['_bodyCollection']),_0x109798['bind']('isTrackChangesOn')['to'](this)):_0x109798='user-message'===_0x2c3c4b?new io(this['locale'],_0x2384a4,this['_bodyCollection']):'interaction-header'===_0x2c3c4b?new so(this['locale'],_0x2384a4):'custom-element'===_0x2c3c4b?new ho(_0x2384a4):new Rr(_0x2384a4),this['children']['add'](_0x109798),_0x109798;}async updateReplyItem({id:_0x44761f,parsedContent:_0xbf320c,renderingStrategy:_0x4808fd,abortSignal:_0x309e21}){const _0x1528f4=this['getItemById'](_0x44761f);if(!(_0x1528f4 instanceof Pr))throw new ct('ai-chat-feed-view-item-not-a-reply-item',null,{'itemView':_0x1528f4,'id':_0x44761f,'parsedContent':_0xbf320c});await _0x1528f4['updateContent']({'parsedContent':_0xbf320c,'renderingStrategy':_0x4808fd,'abortSignal':_0x309e21});}async updateWebSources(_0x1ac44e,_0x30738e){const _0x3554ce=this['getItemById'](_0x1ac44e);if(_0x3554ce instanceof Lr)_0x3554ce['updateSources'](_0x30738e);else{if(!(_0x3554ce instanceof Pr))throw new ct('ai-chat-feed-view-item-not-a-suggestion-or-reply-item',null,{'itemView':_0x3554ce,'id':_0x1ac44e,'sources':_0x30738e});_0x3554ce['updateSources'](_0x30738e);}}async updateSuggestionItem({id:_0x205cf9,parts:_0x371ac2,abortSignal:_0x39ff4b,skipLoadingEffects:_0x1852f6}){const _0x472e92=this['getItemById'](_0x205cf9);if(!(_0x472e92 instanceof Lr))throw new ct('ai-chat-feed-view-item-not-a-suggestion-item',null,{'itemView':_0x472e92,'id':_0x205cf9,'parts':_0x371ac2});await _0x472e92['updateContent']({'parts':_0x371ac2,'abortSignal':_0x39ff4b,'skipLoadingEffects':_0x1852f6});}updateSuggestionPartState({id:_0x4a0baf,index:_0x593a9c,state:_0x19c7ef,outdatedReason:_0xfab939}){const _0x1f9be2=this['getItemById'](_0x4a0baf);if(!(_0x1f9be2 instanceof Lr))throw new ct('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0x4a0baf});_0x1f9be2['updatePartState'](_0x593a9c,_0x19c7ef,_0xfab939);}updateSuggestionGating(_0x29eae6,_0x195044){const _0x155c04=this['getItemById'](_0x29eae6);if(!(_0x155c04 instanceof Lr))throw new ct('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0x29eae6});_0x155c04['setGating'](_0x195044);}setSuggestionPartActive({id:_0x5be46c,index:_0x13444e,isActive:_0x4e3046}){const _0x3b6846=this['getItemById'](_0x5be46c);if(!(_0x3b6846 instanceof Lr))throw new ct('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0x5be46c});this['children']['filter'](_0x55a894=>_0x55a894 instanceof Lr)['forEach'](_0x4e33e6=>{_0x4e33e6['setPartActive'](!0x1);}),_0x3b6846['setPartActive'](_0x13444e,_0x4e3046);}markItemAsDone(_0x1375bf){this['getItemById'](_0x1375bf)['markAsDone']();}getItemIds(){return this['children']['map'](_0x49e0b2=>_0x49e0b2['options']['id']);}removeItem(_0x21652e){this['children']['remove'](this['getItemById'](_0x21652e));}hasItem(_0x533c0b){return!!this['children']['find'](_0x2125ef=>_0x2125ef['options']['id']['includes'](_0x533c0b));}scrollToSuggestion(_0x59a84f,_0x48eede){const _0x5ce706=this['getItemById'](_0x59a84f);if(!(_0x5ce706 instanceof Lr))return void St('ck-ai-chat-feed-view-scroll-to-suggestion-invalid-item',{'replyId':_0x59a84f,'partIndex':_0x48eede});const _0x1751d4=_0x5ce706['getPartView'](_0x48eede);_0x1751d4?Rt(_0x1751d4['element'],0x14,this['element']['parentElement'],!0x0,!0x0):St('ck-ai-chat-feed-view-scroll-to-suggestion-part-view-not-found',{'replyId':_0x59a84f,'partIndex':_0x48eede});}_setupTemplate(){this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed']},'children':this['_createTemplateChildren']()});}_createTemplateChildren(){const _0xae7a36=this['_createSkeletonLoader']();return[this['_createFeedItems'](),_0xae7a36,this['_createFeedLoader']()];}_createSkeletonLoader(){const _0x1c8ae5=new wr(this['locale'],Cr['aiFeed']);return _0x1c8ae5['bind']('isVisible')['to'](this,'isLoadingSkeletonVisible'),_0x1c8ae5;}_createFeedItems(){const _0x48b228=new _0x4ff2da(this['locale']);return _0x48b228['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__items',this['bindTemplate']['if']('isLoadingSkeletonVisible','ck-hidden')]},'children':this['children']}),_0x48b228;}_createFeedLoader(){const _0x143618=new _0x4ff2da(this['locale']);return _0x143618['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__loader',this['bindTemplate']['if']('loadingMessage','ck-hidden',_0x1df5e7=>!_0x1df5e7)]},'children':this['_createLoaderChildren']()}),_0x143618;}_createLoaderChildren(){const _0x37bf02=new Dr();return _0x37bf02['isVisible']=!0x0,[_0x37bf02,{'tag':'span','attributes':{'class':['ck','ck-ai-chat__loader-text']},'children':[{'text':this['bindTemplate']['to']('loadingMessage')}]}];}getItemById(_0x43c03a){const _0x1dd580=this['children']['find'](_0x1bbbb7=>_0x1bbbb7['options']['id']['includes'](_0x43c03a));if(!_0x1dd580)throw new ct('ai-chat-feed-view-item-not-found',this,{'id':_0x43c03a});return _0x1dd580;}setLoadingMessage(_0x11e473){this['set']('loadingMessage',_0x11e473);}toggleLoadingSkeleton(_0x551a80){this['set']('isLoadingSkeletonVisible',_0x551a80);}startAutoScroll(_0x2ee9dc={}){this['scrollManager']['start'](_0x2ee9dc);}stopAutoScroll(){this['scrollManager']['stop']();}},lo=class extends Jt{filter(){let _0x2ca69a=0x0;for(const _0x2e9d13 of this['items'])_0x2ca69a+=_0x2e9d13['items']['length'];return{'resultsCount':_0x2ca69a,'totalItemsCount':_0x2ca69a};}};function uo(_0x16800c){const _0x417a8f=[];let _0x416618=!0x1;for(const _0x2bc9ec of Array['from'](_0x16800c['items'])){if('file'!==_0x2bc9ec['kind'])continue;if(_0x2bc9ec['webkitGetAsEntry']()?.['isDirectory']){_0x416618=!0x0;continue;}const _0x1fcc05=_0x2bc9ec['getAsFile']();_0x1fcc05&&_0x417a8f['push'](_0x1fcc05);}return{'files':_0x417a8f,'hasDirectory':_0x416618};}const _o='ck-ai-chat__prompt-input_highlighted';var go=class AIChatPromptInputView extends Nt{submitButtonView;static ['MIN_ROWS']=0x1;static ['MAX_ROWS']=0xc;_addContextButtonView;['_queryViewResizeObserver'];constructor(_0x3164d5,_0x5c26bc){super(_0x3164d5,{'queryView':{'label':'','creator':_0x293ea1,'showIcon':!0x1,'showResetButton':!0x1},'filteredView':new lo(_0x3164d5),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1}),this['set']('isEmpty',!0x0),this['set']('isUploadInProgress',!0x1),this['_addContextButtonView']=_0x5c26bc,this['_queryViewResizeObserver']=null,this['queryView']['fieldView']['minRows']=AIChatPromptInputView['MIN_ROWS'],this['queryView']['fieldView']['maxRows']=AIChatPromptInputView['MAX_ROWS'],this['queryView']['fieldWrapperChildren']['add'](this['_addContextButtonView']),this['_setUpAddContextButtonPositioning'](),this['extendTemplate']({'attributes':{'class':['ck','ck-ai-chat__prompt-input']}}),this['submitButtonView']=this['_createSubmitButton'](),this['submitButtonView']['bind']('isEnabled')['to'](this,'isEmpty',this,'isUploadInProgress',(_0x295931,_0x37bffd)=>!_0x295931&&!_0x37bffd),this['focusableChildren']['add'](this['submitButtonView']);}['render'](){super['render'](),this['queryView']['fieldWrapperChildren']['add'](this['submitButtonView']),this['keystrokes']['set']('enter',(_0x550e52,_0x13d46b)=>{this['isUploadInProgress']||this['isEmpty']||_0x550e52['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x13d46b());}),this['queryView']['fieldView']['on']('update',()=>{this['isEmpty']=''===this['queryView']['fieldView']['element']['value']?.['trim']();}),this['queryView']['fieldView']['element']['addEventListener']('paste',_0x8b8443=>this['_handlePaste'](_0x8b8443)),this['element']['addEventListener']('drop',_0x4e7fa1=>this['_handleDrop'](_0x4e7fa1));}_handlePaste(_0xd4fe5b){const _0x1bb0aa=_0xd4fe5b['clipboardData'];if(!_0x1bb0aa)return;const {files:_0x165807,hasDirectory:_0x3f2fb0}=uo(_0x1bb0aa),_0x14bffe={'files':_0x165807,'plainText':_0x1bb0aa['getData']('text/plain'),'hasDirectory':_0x3f2fb0,'forceTextAttachment':!0x1,'preventDefault':()=>_0xd4fe5b['preventDefault']()};this['fire']('promptInputPaste',_0x14bffe);}['_handleDrop'](_0x42edd6){const _0x58525c=_0x42edd6['dataTransfer'];if(!_0x58525c)return;const _0x883ca5={'files':[],'plainText':_0x58525c['getData']('text/uri-list')||_0x58525c['getData']('text/plain'),'hasDirectory':!0x1,'forceTextAttachment':!0x1,'preventDefault':()=>_0x42edd6['preventDefault']()};this['fire']('promptInputPaste',_0x883ca5);}destroy(){super['destroy'](),this['_queryViewResizeObserver']&&this['_queryViewResizeObserver']['destroy']();}submit(){const _0x2f671e=this['queryView']['fieldView']['element']['value']?.['trim']();if(!_0x2f671e)return this['queryView']['errorText']=Es(this['locale'],'AI_CHAT_PROMPT_EMPTY_ERROR'),void(this['queryView']['fieldView']['hasError']=!0x0);this['queryView']['fieldView']['hasError']=!0x1;const _0x189c4f=_0x34830a(_0x2f671e);this['fire']('sendUserMessage',_0x189c4f),this['queryView']['fieldView']['reset']();}setPlaceholderText(_0x559ade){this['queryView']['fieldView']['set']('placeholder',_0x559ade);}['focus'](_0x5330dd=!0x1){super['focus'](),_0x5330dd&&(this['element']['classList']['contains'](_o)||(this['element']['classList']['add'](_o),setTimeout(()=>{this['element']['classList']['remove'](_o);},0x320)));}_createSubmitButton(){const _0x40a952=new Mt(this['locale']);return _0x40a952['set']({'icon':nt,'label':Es(this['locale'],'AI_CHAT_LABEL_SUBMIT'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-chat__prompt-submit-button\x20'+Ln,'isEnabled':!0x1}),_0x40a952['on']('execute',()=>{this['submit']();}),_0x40a952;}setIsUploadInProgress(_0x15b898){this['isUploadInProgress']=_0x15b898;}_setUpAddContextButtonPositioning(){const _0x2a6a47=this['locale'],_0x5dcdb3=()=>{wt['window']['requestAnimationFrame'](()=>{if(ft(this['element'])){const _0x3b25f7=new It(this['queryView']['fieldView']['element']),_0x23a086=new It(this['_addContextButtonView']['element']),_0x7c79cd=_0x3b25f7['width'],_0x5e1c6b='rtl'===_0x2a6a47['uiLanguageDirection']?'right':'left';_0x3b25f7['excludeScrollbarsAndBorders']();const _0xb41bb2=_0x7c79cd-_0x3b25f7['width']+0x1;this['_addContextButtonView']['element']['style'][_0x5e1c6b]='calc('+(_0x7c79cd-_0x23a086['width']-_0xb41bb2)+'px\x20-\x20var(--ck-spacing-tiny))';}});};this['queryView']['fieldView']['on']('update',_0x5dcdb3),this['on']('render',()=>{_0x5dcdb3(),this['_queryViewResizeObserver']=new pt(this['queryView']['fieldView']['element'],()=>{_0x5dcdb3();});});}},Ao=class extends _0x4ff2da{constructor(_0x51c3af){super(_0x51c3af),this['set']('isEnabled',!0x0);const _0x2074b7=new $t();_0x2074b7['content']=_0x544acb,this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-controls__drop-overlay']},'children':[_0x2074b7,{'tag':'span','attributes':{'class':['ck-ai-chat-controls__drop-overlay__label']},'children':[{'text':Es(_0x51c3af,'AI_CHAT_DROP_ZONE_HINT')}]}]});}attach(_0x15b640){let _0x56cb1e=0x0;const _0x38d132=()=>{_0x15b640['classList']['toggle']('ck-ai-chat-controls_drag-over',this['isEnabled']&&_0x56cb1e>0x0);};this['on']('change:isEnabled',(_0x359ae7,_0x34bd89,_0x10268b)=>{_0x10268b&&_0x56cb1e>0x0&&this['fire']('dragEnter'),_0x38d132();}),_0x15b640['addEventListener']('dragenter',_0x39355c=>{_0x39355c['dataTransfer']&&(_0x56cb1e++,0x1===_0x56cb1e&&this['isEnabled']&&this['fire']('dragEnter'),_0x38d132());}),_0x15b640['addEventListener']('dragover',_0x49df93=>{_0x49df93['dataTransfer']&&_0x49df93['preventDefault']();}),_0x15b640['addEventListener']('dragleave',()=>{--_0x56cb1e<0x0&&(_0x56cb1e=0x0),_0x38d132();}),_0x15b640['addEventListener']('drop',_0x1fe3a8=>{_0x1fe3a8['preventDefault'](),_0x56cb1e=0x0,_0x38d132(),this['isEnabled']&&this['_handleDrop'](_0x1fe3a8);});}['_handleDrop'](_0x5c6e05){const _0x895c12=_0x5c6e05['dataTransfer'];if(!_0x895c12)return;const {files:_0x41dd69,hasDirectory:_0xd848a6}=uo(_0x895c12),_0x21734e={'files':_0x41dd69,'plainText':_0x895c12['getData']('text/uri-list')||_0x895c12['getData']('text/plain'),'hasDirectory':_0xd848a6,'forceTextAttachment':!0x0,'preventDefault':()=>{}};this['fire']('promptInputPaste',_0x21734e);}},Io=class extends _0x4ff2da{['dropdownView'];['nameView'];_items;['_config'];constructor(_0xd6fd53,_0x5d494e){super(_0xd6fd53),this['_config']=_0x5d494e,this['set']('modelDisplayMode','selector'),this['set']('activeModelId',null),this['set']('activeModelName',null),this['set']('isEnabled',!0x0),this['dropdownView']=this['_createDropdown'](),this['_items']=new lt(),_0x3196cc(this['dropdownView'],this['_items']),this['nameView']=new po(_0xd6fd53,_0x5d494e['nameClass']),this['nameView']['bind']('text')['to'](this,'activeModelName',_0x54e178=>_0x54e178??''),this['nameView']['bind']('isVisible')['to'](this,'modelDisplayMode',_0x2cd805=>'name'===_0x2cd805),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-model-selector']},'children':[this['dropdownView'],this['nameView']]});}setModels(_0x300760,_0x946c7){var _0x324478;this['set']('modelDisplayMode',(_0x324478=_0x300760['length'],_0x946c7?0x1===_0x324478?'name':'selector':'hidden')),this['_items']['clear'](),0x1===_0x300760['length']&&this['set']('activeModelName',_0x300760[0x0]['name']||_0x300760[0x0]['id']);for(const _0x4826f5 of _0x300760){const _0x5402f3=new _0xd62086({'label':_0x4826f5['name'],'withText':!0x0,'role':'menuitemradio','id':_0x4826f5['id'],'model':_0x4826f5});_0x5402f3['bind']('isOn')['to'](this,'activeModelId',_0x12b7e5=>_0x12b7e5===_0x4826f5['id']),this['_items']['add']({'type':'button','model':_0x5402f3,'labelView':new Eo(this['locale'],_0x4826f5,{'nameClass':this['_config']['itemClasses']['name'],'descriptionClass':this['_config']['itemClasses']['description'],'capabilitiesClass':this['_config']['itemClasses']['capabilities'],'extraContent':this['_config']['showCapabilities']?mo(this['locale'],_0x4826f5):void 0x0})});}}setSelectedModel(_0x211903){this['set']('activeModelId',_0x211903?_0x211903['id']:null),this['set']('activeModelName',_0x211903?_0x211903['name']||_0x211903['id']:null);}_createDropdown(){const _0x2aef03=_0x5a954d(this['locale']);return _0x2aef03['set']({'panelPosition':this['_config']['panelPosition'],'class':this['_config']['dropdownClass']}),_0x2aef03['buttonView']['set']({'withText':!0x0,'tooltipPosition':this['_config']['tooltipPosition'],'class':Dn}),_0x2aef03['buttonView']['bind']('label')['to'](this,'activeModelName',_0xeac1fd=>_0xeac1fd??this['_config']['defaultLabel']??''),_0x2aef03['buttonView']['bind']('tooltip')['to'](this,'activeModelName',this,'isEnabled',(_0x26adda,_0x3c6f29)=>!_0x3c6f29&&this['_config']['disabledTooltip']?this['_config']['disabledTooltip']:_0x26adda??this['_config']['defaultLabel']??''),_0x2aef03['buttonView']['bind']('isVisible')['to'](this,'modelDisplayMode',_0x5398a2=>'selector'===_0x5398a2),_0x2aef03['bind']('isEnabled')['to'](this,'isEnabled'),this['listenTo'](_0x2aef03,'execute',_0x78fa5e=>{this['fire']('selectModel',_0x78fa5e['source']['model']);}),_0x2aef03;}},po=class extends _0x4ff2da{constructor(_0x1b891f,_0xa1bb2d){super(_0x1b891f),this['set']('text',void 0x0),this['set']('isVisible',!0x0);const _0x57b9ee=this['bindTemplate'];this['setTemplate']({'tag':'span','attributes':{'class':['ck',_0xa1bb2d,_0x57b9ee['if']('isVisible','ck-hidden',_0x183a4b=>!_0x183a4b)]},'children':[{'text':_0x57b9ee['to']('text')}]});}},Eo=class extends Dt{constructor(_0x4060f8,_0x55a456,_0x2bf385){super();const _0x5141a3=this['bindTemplate'],_0x148731=[{'tag':'div','attributes':{'class':[_0x2bf385['nameClass']]},'children':[{'tag':'span','children':[{'text':_0x5141a3['to']('text')}]}]},{'tag':'div','attributes':{'class':[_0x2bf385['descriptionClass']]},'children':[{'tag':'span','children':[_0x55a456['description']||'']}]}];_0x2bf385['extraContent']?.['length']&&_0x2bf385['capabilitiesClass']&&_0x148731['push']({'tag':'div','attributes':{'class':[_0x2bf385['capabilitiesClass']]},'children':_0x2bf385['extraContent']}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-button__label'],'style':_0x5141a3['to']('style'),'id':_0x5141a3['to']('id')},'children':_0x148731});}};function mo(_0x3af205,_0x82d6e1){return[...To(_0x3af205,ht,'AI_CHAT_SEARCH_WEB',_0x82d6e1['capabilities']['webSearch']?.['enabled']??!0x1),...To(_0x3af205,_0x588d47,'AI_CHAT_REASONING',_0x82d6e1['capabilities']['reasoning']?.['enabled']??!0x1)];}function To(_0x35b2b3,_0x1ea829,_0x5c309f,_0x5d966b){const _0x167ff3=new $t();_0x167ff3['content']=_0x1ea829;const _0x4eeff3=new _0x4ff2da(_0x35b2b3);_0x4eeff3['setTemplate']({'tag':'span','children':[{'text':Es(_0x35b2b3,_0x5c309f)+':\x20'}]});const _0x523106=new _0x4ff2da(_0x35b2b3);return _0x523106['setTemplate']({'tag':'span','children':[{'text':Es(_0x35b2b3,_0x5d966b?'AI_CHAT_CAPABILITIES_YES':'AI_CHAT_CAPABILITIES_NO')}]}),[_0x167ff3,_0x4eeff3,_0x523106];}const wo='ck-ai-chat__prompt-capabilities',Co='ck-ai-chat-controls-button',fo='ck-ai-chat-controls-button--commands',bo='ck-ai-chat-controls__model-selection',So='ck-ai-chat-controls__model-selection__item-name',Ro='ck-ai-chat-controls__model-selection__item-description',Oo='ck-ai-chat-controls__model-selection__item-capabilities',vo='n';var ko=class extends _0x4ff2da{_webSearchButton;_reasoningButton;_commandsButton;_modelSelector;constructor(_0xa5ccc3){super(_0xa5ccc3),this['set']('webSearchActive',!0x1),this['set']('reasoningActive',!0x1),this['set']('modelSelectorEnabled',!0x0),this['_modelSelector']=function(_0x51fbd4){return new Io(_0x51fbd4,{'panelPosition':'ne','dropdownClass':[bo],'nameClass':'ck-ai-chat-controls__model-name','itemClasses':{'name':So,'description':Ro,'capabilities':Oo},'defaultLabel':Es(_0x51fbd4,'AI_CHAT_MODEL_SELECTOR_ENABLED_TOOLTIP'),'disabledTooltip':Es(_0x51fbd4,'AI_CHAT_MODEL_SELECTOR_DISABLED_TOOLTIP'),'tooltipPosition':vo,'showCapabilities':!0x0});}(_0xa5ccc3),this['_modelSelector']['bind']('isEnabled')['to'](this,'modelSelectorEnabled',_0x37ae6f=>_0x37ae6f),this['_modelSelector']['delegate']('selectModel')['to'](this),this['_webSearchButton']=this['_createWebSearchButton'](),this['_reasoningButton']=this['_createReasoningButton'](),this['_commandsButton']=this['_createCommandsButton'](),this['_webSearchButton']['bind']('isOn')['to'](this,'webSearchActive',_0x40e9b2=>_0x40e9b2),this['_webSearchButton']['bind']('tooltip')['to'](this,'webSearchActive',_0x20a66f=>Es(this['locale'],_0x20a66f?'AI_CHAT_DISABLE_WEB_SEARCH':'AI_CHAT_ENABLE_WEB_SEARCH')),this['_reasoningButton']['bind']('isOn')['to'](this,'reasoningActive',_0x405ef3=>_0x405ef3),this['_reasoningButton']['bind']('tooltip')['to'](this,'reasoningActive',_0x4ec595=>Es(this['locale'],_0x4ec595?'AI_CHAT_DISABLE_REASONING':'AI_CHAT_ENABLE_REASONING')),this['setTemplate']({'tag':'div','attributes':{'class':[wo]},'children':[this['_modelSelector'],this['_webSearchButton'],this['_reasoningButton'],this['_commandsButton']]});}setWebSearch(_0x192caa){this['set']('webSearchActive',_0x192caa);}setReasoning(_0x23a646){this['set']('reasoningActive',_0x23a646);}setModelList(_0x5362f6,_0x4a4111){this['_modelSelector']['setModels'](_0x5362f6,!_0x4a4111);}setModel(_0x332dcf){if(!_0x332dcf)return;this['_modelSelector']['setSelectedModel'](_0x332dcf);const _0x3c2390=_0x332dcf['capabilities']['webSearch']?.['enabled']??!0x1;this['set']('webSearchActive',!0x1),this['_webSearchButton']['set']('isOn',!0x1),this['_webSearchButton']['set']('isEnabled',_0x3c2390),this['_webSearchButton']['set']('isVisible',_0x3c2390);const _0x3acedd=_0x332dcf['capabilities']['reasoning']?.['enabled']??!0x1;this['set']('reasoningActive',!0x1),this['_reasoningButton']['set']('isOn',!0x1),this['_reasoningButton']['set']('isEnabled',_0x3acedd),this['_reasoningButton']['set']('isVisible',_0x3acedd);}enableModelSelector(){this['set']('modelSelectorEnabled',!0x0);}disableModelSelector(_0xae30c5){this['set']('modelSelectorEnabled',!0x1),_0xae30c5&&(this['_modelSelector']['modelDisplayMode']='hidden');}_createWebSearchButton(){const _0x36030a=new Mt();return _0x36030a['set']({'label':Es(this['locale'],'AI_CHAT_SEARCH_WEB'),'icon':ht,'class':Co+'\x20'+Dn,'isToggleable':!0x0,'tooltipPosition':vo}),_0x36030a['on']('execute',()=>{this['fire']('toggleWebSearch');}),_0x36030a;}_createReasoningButton(){const _0x2d7ac1=new Mt();return _0x2d7ac1['set']({'label':Es(this['locale'],'AI_CHAT_REASONING'),'icon':_0x588d47,'class':Co+'\x20'+Dn,'isToggleable':!0x0,'tooltipPosition':vo}),_0x2d7ac1['on']('execute',()=>{this['fire']('toggleReasoning');}),_0x2d7ac1;}_createCommandsButton(){const _0x5397ea=new Mt();return _0x5397ea['set']({'label':Es(this['locale'],'AI_CHAT_COMMANDS'),'icon':_0x3236d4,'withText':!0x0,'class':Co+'\x20'+Dn,'isToggleable':!0x0,'tooltip':Es(this['locale'],'AI_CHAT_COMMANDS'),'tooltipPosition':vo}),_0x5397ea['extendTemplate']({'attributes':{'class':[fo]}}),_0x5397ea['on']('execute',()=>{console['log']('Commands\x20are\x20not\x20implemented\x20yet.'),alert('Commands\x20are\x20not\x20implemented\x20yet.');}),_0x5397ea;}};const yo='ck-ai-chat-context-controls__url-form',No='ck-ai-chat-context-controls__url-input-section';var xo=class extends _0x4ff2da{['focusTracker'];keystrokes;['_focusables'];['focusCycler'];urlInputField;backButton;confirmButton;constructor(_0x492583){super(_0x492583),this['focusTracker']=new _t(),this['keystrokes']=new gt(),this['backButton']=this['_createBackButton'](),this['urlInputField']=this['_createUrlInputField'](),this['confirmButton']=this['_createConfirmButton'](),this['_focusables']=this['createCollection']([this['backButton'],this['urlInputField'],this['confirmButton']]),this['focusCycler']=new Ft({'focusables':this['_focusables'],'focusTracker':this['focusTracker'],'keystrokeHandler':this['keystrokes'],'actions':{'focusPrevious':'shift+tab','focusNext':'tab'}}),this['set']('withBackButton',!0x0),this['_setupTemplate'](),this['_setupEventHandlers'](),this['_setupKeystrokes']();}['render'](){super['render'](),this['_focusables']['forEach'](_0x5341e0=>{this['focusTracker']['add'](_0x5341e0['element']),this['keystrokes']['listenTo'](_0x5341e0['element']);}),_0x5875a6({'view':this}),this['focus']();}destroy(){super['destroy'](),this['focusTracker']['destroy'](),this['keystrokes']['destroy']();}['focus'](){this['urlInputField']['focus']();}getValue(){return this['urlInputField']['fieldView']['element']?.['value']?.['trim']()||'';}['clear'](){this['urlInputField']['fieldView']['element']['value']='',this['urlInputField']['errorText']=null,this['confirmButton']['isEnabled']=!0x1;}setError(_0x36b67a){this['urlInputField']['errorText']=_0x36b67a,this['_updateConfirmButtonState'](),this['fire']('refreshBalloon');}['clearError'](){this['urlInputField']['errorText']=null,this['_updateConfirmButtonState']();}_createBackButton(){const _0x141f9b=new Mt(this['locale']);return _0x141f9b['set']({'icon':_0x202389,'tooltip':Es(this['locale'],'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT'),'tooltipPosition':'n','class':['ck-button-icon\x20ck-button-back']}),this['on']('change:withBackButton',(_0x48b077,_0x2c2f27,_0x534518)=>{_0x141f9b['set']({'class':['ck-button-icon\x20ck-button-back'+(_0x534518?'':'\x20ck-hidden')]});}),_0x141f9b;}_createUrlInputField(){const _0x540c4c=new Qt(this['locale'],_0x3b9224);return _0x540c4c['set']({'label':Es(this['locale'],'AI_CHAT_CONTEXT_URL_LABEL'),'class':'ck-labeled-field-view_empty'}),_0x540c4c['fieldView']['set']({'placeholder':Es(this['locale'],'AI_CHAT_CONTEXT_URL_PLACEHOLDER')}),_0x540c4c;}_createConfirmButton(){const _0x3df65b=new Mt(this['locale']);return _0x3df65b['set']({'icon':_0x5517bf,'tooltip':Es(this['locale'],'AI_CHAT_CONTEXT_URL_ADD_URL'),'tooltipPosition':'n','class':'ck-button-icon','type':'submit','isEnabled':!0x1}),_0x3df65b;}_setupTemplate(){const _0x3412a4=new Kt(this['locale'],{'label':Es(this['locale'],'AI_CHAT_CONTEXT_URL_ADD_URL'),'class':'ck-ai-header\x20ck-ai-header_small\x20ck-ai-header_context-url'});_0x3412a4['children']['add'](this['backButton'],0x0),this['setTemplate']({'tag':'form','attributes':{'class':yo,'tabindex':'-1'},'children':[_0x3412a4,{'tag':'div','attributes':{'class':No},'children':[this['urlInputField'],this['confirmButton']]}]});}_setupEventHandlers(){this['backButton']['on']('execute',()=>{this['clear'](),this['fire']('cancel');}),this['urlInputField']['fieldView']['on']('input',()=>{this['clearError'](),this['_updateConfirmButtonState'](),this['fire']('refreshBalloon');}),this['on']('submit',_0x441f53=>{_0x441f53['stop'](),this['_handleSubmit']();});}_setupKeystrokes(){this['keystrokes']['set']('esc',(_0x36b74c,_0x1fc447)=>{this['clear'](),this['fire']('cancel'),_0x1fc447();});}_handleSubmit(){const _0x36e854=this['getValue']()['trim']();_0x36e854?this['_isValidUrl'](_0x36e854)?(this['clearError'](),this['fire']('submitUrl',_0x36e854)):this['setError'](Es(this['locale'],'AI_CHAT_CONTEXT_URL_INVALID_ERROR')):this['setError'](Es(this['locale'],'AI_CHAT_CONTEXT_URL_EMPTY_ERROR'));}_updateConfirmButtonState(){const _0x5b3ba3=this['getValue']()['trim'](),_0x19ccfd=!!this['urlInputField']['errorText'];this['confirmButton']['isEnabled']=_0x5b3ba3['length']>0x0&&!_0x19ccfd;}['_isValidUrl'](_0x80bc58){try{return!!new URL(_0x80bc58);}catch{return!0x1;}}};const Lo='ck-ai-chat-resources__item',Po='ck-ai-chat-resources__item--in-context',Do='ck-ai-chat-resources__item-title',Ho='ck-ai-chat-resources__item__icon';var Mo=class extends jt{['resource'];_titleView;['_iconView'];constructor(_0x196af9,_0x4128c2){super(_0x196af9),this['resource']=_0x4128c2,this['set']('isInContext',!!_0x4128c2['isInContext']),this['_titleView']=this['_createTitleView'](),this['_iconView']=this['_createIconView'](),this['_setupTemplate']();}['render'](){super['render']();}getResourceIcon(_0x3584cb){if(_0x3584cb['isInContext'])return _0x5517bf;switch(_0x3584cb['type']){case'document':return _0x38d218;case'web-resource':return _0x43c1c8;case'file':case'text':return _0x544acb;default:return _0x17766e;}}highlightText(_0x5d4508){if(!_0x5d4508||''===_0x5d4508['trim']())return void this['_titleView']['highlightText'](null);const _0x1cfef8=new RegExp(_0x306a2e(_0x5d4508),'gi');this['_titleView']['highlightText'](_0x1cfef8);}updateResourceState(_0x43431b){this['resource']['isInContext']=_0x43431b,this['isInContext']=_0x43431b,this['_updateIcon']();}_createTitleView(){const _0x2ec236=new Yt();return _0x2ec236['text']=this['resource']['label'],_0x2ec236['extendTemplate']({'tag':'span','attributes':{'class':[Do]}}),_0x2ec236;}_createIconView(){const _0x32abf6=new $t();return _0x32abf6['content']=this['getResourceIcon'](this['resource']),_0x32abf6;}_setupTemplate(){const _0x12e159=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':[Lo,_0x12e159['if']('isVisible','ck-hidden',_0x32386d=>!_0x32386d),_0x12e159['if']('isInContext',Po)]},'children':[{'tag':'div','attributes':{'class':[Ho]},'children':[this['_iconView']]},this['_titleView']],'on':{'click':_0x12e159['to']('execute')}});}_updateIcon(){this['_iconView']['content']=this['getResourceIcon'](this['resource']);}};const Uo='ck-ai-chat-resources__list';var Vo=class extends Jt{['_source'];constructor(_0x4a4c84,_0xda130a){super(_0x4a4c84),this['_source']=_0xda130a,this['extendTemplate']({'attributes':{'class':[Uo]}});}setResources(_0x500736,_0x53f4f4){this['items']['clear']();let _0x3cadfc=_0x500736;if(this['_source']['useDefaultFiltering']&&_0x53f4f4&&''!==_0x53f4f4['trim']()){const _0x2ab51f=new RegExp(_0x53f4f4['replace'](/[.*+?^${}()|[\]\\]/g,'\x5c$&'),'gi');_0x3cadfc=_0x500736['filter'](_0x2f5086=>_0x2ab51f['test'](_0x2f5086['label']));}for(const _0x966e0d of _0x3cadfc){const _0x315eb0=new Mo(this['locale'],_0x966e0d);_0x315eb0['on']('execute',()=>{this['_handleResourceSelection'](this['_source'],_0x966e0d);}),this['items']['add'](_0x315eb0);}this['_source']['useDefaultFiltering']&&this['highlightText'](_0x53f4f4);}highlightText(_0x21ba2f){this['_source']['useDefaultFiltering']&&this['items']['forEach'](_0x1033d5=>{_0x1033d5['highlightText'](_0x21ba2f);});}updateResourceState(_0x445a24,_0x2ff148){for(const _0x8d442e of this['items']){const _0x6e3091=_0x8d442e;_0x6e3091['resource']['id']===_0x445a24&&_0x6e3091['updateResourceState'](_0x2ff148);}}_handleResourceSelection(_0x3054f1,_0x5ba39a){this['fire']('addResourceToContext',{'source':_0x3054f1,'resource':_0x5ba39a});}},Bo=class extends Qt{['iconView'];resetButtonView;['_viewConfig'];constructor(_0x1d19d4){const t=_0x1d19d4['t'],_0x5ddc82={'showResetButton':!0x0,'showIcon':!0x0,'creator':_0x3b9224,'label':Es(_0x1d19d4,'AI_CHAT_SEARCH_RESOURCES')};super(_0x1d19d4,_0x5ddc82['creator']),this['label']=_0x5ddc82['label'],this['_viewConfig']=_0x5ddc82,this['_viewConfig']['showIcon']&&this['_setupSearchIcon'](),this['_viewConfig']['showResetButton']&&this['_setupResetButton'](_0x1d19d4,t),this['_setupEventListeners']();}reset(){this['fieldView']['reset'](),this['_viewConfig']['showResetButton']&&this['resetButtonView']&&(this['resetButtonView']['isVisible']=!0x1),this['search']('');}['search'](_0x33fbc9){this['fire']('search',_0x33fbc9);}getQuery(){return this['fieldView']['element']?.['value']||'';}_setupSearchIcon(){this['iconView']=new $t(),this['iconView']['content']=_0x69c189,this['fieldWrapperChildren']['add'](this['iconView'],0x0),this['extendTemplate']({'attributes':{'class':'ck-search__query_with-icon'}});}_setupResetButton(_0x2cd1e9,t){this['resetButtonView']=new Mt(_0x2cd1e9),this['resetButtonView']['set']({'label':t('Clear'),'icon':_0xabec2d,'class':'ck-search__reset','isVisible':!0x1,'tooltip':!0x0}),this['resetButtonView']['on']('execute',()=>{this['reset'](),this['focus'](),this['fire']('reset');}),this['resetButtonView']['bind']('isVisible')['to'](this['fieldView'],'isEmpty',_0x499bbd=>!_0x499bbd),this['fieldWrapperChildren']['add'](this['resetButtonView']),this['extendTemplate']({'attributes':{'class':'ck-search__query_with-reset'}});}_setupEventListeners(){this['listenTo'](this['fieldView'],'input',()=>{this['search'](this['fieldView']['element']['value']);}),this['bind']('isEnabled')['to'](this);}},Go=class extends _0x4ff2da{['_searchView'];_searchSection;_searchInputVisibleFrom;_resourcesListView;_skeletonLoader;['_source'];['children'];_latestLoadResourcesUid=null;constructor(_0x20bf5c,_0x4d662a){super(_0x20bf5c),this['_source']=_0x4d662a['source'],this['_searchInputVisibleFrom']=_0x4d662a['searchInputVisibleFrom']??0x7,this['set']('isLoading',!0x0),this['_searchView']=this['_createSearchView'](),this['_searchSection']=this['_createSearchSection'](),this['_resourcesListView']=this['_createResourcesListView'](),this['_skeletonLoader']=this['_createSkeletonView'](),this['children']=new _0x50bc02([this['_skeletonLoader'],this['_resourcesListView']]),this['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-chat-resources'},'children':this['children']});}_createSearchView(){return new Bo(this['locale']);}_createSearchSection(){const _0xf203e7=new _0x4ff2da(this['locale']);return _0xf203e7['setTemplate']({'tag':'div','attributes':{'class':'ck\x20ck-search'},'children':[this['_searchView']]}),this['_searchView']['on']('search',(_0x2530ce,_0x5ef328)=>{this['loadResources'](_0x5ef328),this['_source']['useDefaultFiltering']&&this['_resourcesListView']['highlightText'](_0x5ef328);}),_0xf203e7;}_createResourcesListView(){const _0x277f97=new Vo(this['locale'],this['_source']);return _0x277f97['delegate']('addResourceToContext')['to'](this),_0x277f97['extendTemplate']({'attributes':{'class':this['bindTemplate']['if']('isLoading','ck-hidden')}}),_0x277f97;}_createSkeletonView(){const _0x146336=new wr(this['locale'],Cr['aiChatResources']);return _0x146336['bind']('isVisible')['to'](this,'isLoading'),_0x146336;}['render'](){super['render'](),this['loadResources']('');}['loadResources'](_0x367e3f){const _0x1298fb=kt();this['_latestLoadResourcesUid']=_0x1298fb,this['fire']('loadSourceResources',{'sourceId':this['_source']['id'],'query':_0x367e3f,'uid':_0x1298fb}),this['isLoading']=!0x0;}setResources(_0x242298,_0x265ada){if(_0x265ada&&_0x265ada!==this['_latestLoadResourcesUid'])return;const _0x3b2186=this['_source']['useDefaultFiltering']?this['_searchView']['getQuery']():'';this['_resourcesListView']['setResources'](_0x242298,_0x3b2186),_0x242298['length']>=this['_searchInputVisibleFrom']&&!this['children']['has'](this['_searchSection'])&&this['children']['add'](this['_searchSection'],0x0),requestAnimationFrame(()=>{this['isLoading']=!0x1;});}updateResourceState(_0x42ea4d,_0x48caa2){this['_resourcesListView']['updateResourceState'](_0x42ea4d,_0x48caa2);}};const Fo='ck-ai-chat-context-controls__source-balloon-panel',Ko='ck-button-icon\x20ck-button-back',Wo='ck-ai-header\x20ck-ai-header_small\x20ck-ai-header_source';var Yo=class{['_sourceResourceBalloons']=new Map();_bodyCollection;['_locale'];['_config'];constructor(_0x3fa44f,_0xaf8e4e,_0xd39c04){this['_locale']=_0x3fa44f,this['_bodyCollection']=_0xaf8e4e,this['_config']=_0xd39c04;}['showSourceResourcesBalloon']({source:_0x97ae30,withBackButton:_0x59d1aa}){let _0xc728a=this['_sourceResourceBalloons']['get'](_0x97ae30['id']);_0xc728a||(_0xc728a=this['_createSourceResourceBalloonPanel'](),this['_sourceResourceBalloons']['set'](_0x97ae30['id'],_0xc728a),this['_setupSingleResourceBalloonClickOutsideHandler'](_0xc728a)),this['_addSourceResourceContent']({'balloonPanel':_0xc728a,'source':_0x97ae30,'withBackButton':_0x59d1aa}),_0xc728a['show']();const _0x296f5f=this['_config']['getTargetElement']();_0x296f5f&&_0xc728a['pin']({'target':_0x296f5f,'limiter':this['_config']['getLimiterElement']()});}populateSourceResourceBalloon(_0x3c26fe,_0x154a5a,_0x215492){const _0x15d9a1=this['_sourceResourceBalloons']['get'](_0x3c26fe);if(!_0x15d9a1)return;const _0x43582c=this['_getResourcesViewFromBalloon'](_0x15d9a1);_0x43582c&&(_0x43582c['setResources'](_0x154a5a,_0x215492),_0x43582c['once']('change:isLoading',()=>{_0x15d9a1['pin']({'target':this['_config']['getTargetElement'](),'limiter':this['_config']['getLimiterElement']()});}));}['closeSourceResourceBalloon'](_0x4430b9){const _0x2b6df3=this['_sourceResourceBalloons']['get'](_0x4430b9);_0x2b6df3&&requestAnimationFrame(()=>{_0x2b6df3['hide'](),this['_sourceResourceBalloons']['delete'](_0x4430b9),this['_config']['onBalloonClosed']();});}['closeAll'](){for(const _0x1075a0 of Array['from'](this['_sourceResourceBalloons']['keys']()))this['closeSourceResourceBalloon'](_0x1075a0);}['isAnyResourceBalloonVisible'](){for(const _0x1b71e3 of this['_sourceResourceBalloons']['values']())if(_0x1b71e3['isVisible'])return!0x0;return!0x1;}updateResourceState(_0x335432,_0x41542c,_0x219999){const _0x1674e2=this['_sourceResourceBalloons']['get'](_0x335432);if(!_0x1674e2||!_0x1674e2['isVisible'])return;const _0x3de579=this['_config']['getTargetElement']();if(!_0x3de579)return;_0x1674e2['pin']({'target':_0x3de579,'limiter':this['_config']['getLimiterElement']()});const _0x473e03=this['_getResourcesViewFromBalloon'](_0x1674e2);_0x473e03&&_0x473e03['updateResourceState'](_0x41542c,_0x219999);}destroy(){for(const _0x4ae0b4 of this['_sourceResourceBalloons']['values']())_0x4ae0b4['destroy']();this['_sourceResourceBalloons']['clear']();}_createSourceResourceBalloonPanel(){const _0x29d8f3=new xt(this['_locale']);return _0x29d8f3['extendTemplate']({'attributes':{'class':Fo}}),this['_bodyCollection']['add'](_0x29d8f3),_0x29d8f3;}_addSourceResourceContent({balloonPanel:_0x4e8787,source:_0x5a021d,withBackButton:_0x496b49}){_0x4e8787['content']['clear']();const _0x115043=this['_createBalloonHeader']({'balloonPanel':_0x4e8787,'source':_0x5a021d,'withBackButton':_0x496b49});_0x4e8787['content']['add'](_0x115043);const _0x4023ce=this['_createBalloonResourcesView'](_0x5a021d);_0x4e8787['content']['add'](_0x4023ce);}_createBalloonHeader({balloonPanel:_0x182015,source:_0x40f93c,withBackButton:_0x57e661}){const _0x58156f=new Kt(this['_locale'],{'label':_0x40f93c['label'],'class':Wo});return _0x57e661&&_0x58156f['children']['add'](this['_createBackButton'](_0x182015),0x0),_0x58156f;}_createBackButton(_0x2b7e31){const _0x422e4f=new Mt(this['_locale']);return _0x422e4f['set']({'icon':_0x202389,'tooltip':Es(this['_locale'],'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT'),'tooltipPosition':'n','class':Ko}),_0x422e4f['on']('execute',()=>{_0x2b7e31['hide'](),this['_config']['onBackToContext']();}),_0x422e4f;}_createBalloonResourcesView(_0x1dd5b9){const _0x3382e9=new Go(this['_locale'],{'source':_0x1dd5b9,'searchInputVisibleFrom':this['_config']['searchInputVisibleFrom']});return _0x3382e9['on']('loadSourceResources',(_0x1d001d,_0x71fdef)=>{this['_config']['onLoadSourceResources'](_0x71fdef);}),_0x3382e9['on']('addResourceToContext',(_0x54d3ab,_0x13b2b9)=>{this['_config']['onResourceSelected'](_0x13b2b9['source'],_0x13b2b9['resource']),this['closeSourceResourceBalloon'](_0x1dd5b9['id']);}),_0x3382e9;}_getResourcesViewFromBalloon(_0x48c582){const _0x2f4577=_0x48c582['content']['get'](0x1);return _0x2f4577 instanceof Go?_0x2f4577:null;}_setupSingleResourceBalloonClickOutsideHandler(_0x7b1591){_0x341840({'emitter':_0x7b1591,'contextElements':[_0x7b1591['element']],'callback':()=>{_0x7b1591['hide'](),this['_config']['onBalloonClosed']();},'activator':()=>_0x7b1591['isVisible']});}};const $o=['addDocumentToContext','addFileToContext','addUrlToContext','addResourceToContext','removeContextItem','loadSourceResources','executeCustomItemCallback'],qo='ck-ai-chat-context-controls',Qo='ck-ai-chat-context-controls__pending-contexts',Xo='ck-ai-chat-context-controls__add-context-balloon-panel',zo='ck-ai-chat-context-controls__add-context-button',jo='ck-ai-chat-context-controls__url-balloon-panel',Jo='ck-ai-chat-context-controls__balloon-button',Zo='ck-ai-chat-context-controls__balloon-button-source',ta='ck-ai-chat-controls-button',ea='ck-ai-chat-context-chips-wrapper-balloon',ia='ck-ai-chat-controls_context_show-more-button',sa='ck-ai-chat-context-controls__show-more-balloon-panel',na='ck-ai-chat',ra=[xt['defaultPositions']['northArrowSouthWest'],xt['defaultPositions']['northArrowSouth'],xt['defaultPositions']['northArrowSouthEast'],xt['defaultPositions']['southArrowNorthWest'],xt['defaultPositions']['southArrowNorth'],xt['defaultPositions']['southArrowNorthEast']];var oa=class extends _0x4ff2da{addContextButtonView;_currentContextsChips=this['createCollection']();_conversationContextsChips=this['createCollection']();['_overflowManager'];_addContextBalloonPanelView;['_urlBalloonPanelView'];_urlInputView;['_resourcesBalloonView'];_addContextBalloonConfig;_hasExactlyOneSource=!0x1;bodyCollection;constructor(_0x3a602d,_0x5769b2){super(_0x3a602d),this['bodyCollection']=_0x5769b2['bodyCollection'],this['_currentContextsChips']=this['createCollection'](),this['_conversationContextsChips']=this['createCollection'](),this['addContextButtonView']=this['_createAddContextButtonView'](_0x3a602d),this['_addContextBalloonPanelView']=this['_createAddContextBalloonPanelView'](_0x3a602d),this['_urlBalloonPanelView']=this['_createUrlBalloonPanelView'](_0x3a602d),this['_resourcesBalloonView']=this['_createResourcesBalloonView'](_0x3a602d,_0x5769b2);const _0x44c3d8={'cssClasses':{'showMoreButton':ia+'\x20'+Dn,'showMoreBalloon':sa,'overflowContainer':ea,'controlsButton':ta}};this['_overflowManager']=new Qr(_0x3a602d,this['_currentContextsChips'],_0x44c3d8,this['bodyCollection'],this),this['_addContextBalloonConfig']={'buttonView':this['addContextButtonView'],'balloonView':this['_addContextBalloonPanelView'],'hideMethod':this['hideAddContextBalloonPanel']['bind'](this),'showMethod':this['showAddContextBalloonPanel']['bind'](this)},this['_setupTemplate'](),this['_bindEventHandlers']();}['render'](){super['render'](),this['_setupAllBalloonClickOutsideHandlers'](),this['_overflowManager']['setContainerElement'](this['element']),this['_overflowManager']['reorganizeChips']();}destroy(){super['destroy'](),this['_overflowManager']['destroy'](),this['_resourcesBalloonView']['destroy']();}addContextItem(_0xfa8925,_0x229061){const _0x1a5f04=this['_createContextButton'](_0xfa8925,'current',!0x0,_0x229061);this['_addContextToCollection'](_0x1a5f04,this['_currentContextsChips']),this['_overflowManager']['reorganizeChips']();}removeContextItem(_0x15d595){this['_removeContextFromCollection'](_0x15d595,this['_currentContextsChips']),this['_removeContextFromCollection'](_0x15d595,this['_overflowManager']['overflowChips']),this['_overflowManager']['reorganizeChips']();}setContextItemLoading(_0x41b36b,_0x465b6f){let _0x4598e3=this['_currentContextsChips']['find'](_0x24f41b=>_0x24f41b['id']===_0x41b36b);_0x4598e3||(_0x4598e3=this['_overflowManager']['overflowChips']['find'](_0x40bf4e=>_0x40bf4e['id']===_0x41b36b)),_0x4598e3&&(_0x4598e3['isLoading']=_0x465b6f);}setConversationContext(_0x114e42){this['_conversationContextsChips']['clear']();for(const _0x5a110e of _0x114e42){const _0x486dca=this['_createContextButton'](_0x5a110e,'conversation',!0x1,!0x1);this['_addContextToCollection'](_0x486dca,this['_conversationContextsChips']);}}clearCurrentContextItems(){this['_currentContextsChips']['clear'](),this['_overflowManager']['clear']();}clearConversationContextItems(){this['_conversationContextsChips']['clear']();}updateResourceState(_0x358951,_0x465e61,_0x19d252){this['_resourcesBalloonView']['updateResourceState'](_0x358951,_0x465e61,_0x19d252);}hideAddContextBalloonPanel(){this['_toggleAddContextBalloon'](!0x1);}showAddContextBalloonPanel(){this['_toggleAddContextBalloon'](!0x0);}['hideUrlBalloonPanel'](){this['_urlBalloonPanelView']['hide'](),this['addContextButtonView']['isOn']=!0x1,this['_urlInputView']&&this['_urlInputView']['clear']();}['showUrlBalloonPanel'](){this['_urlBalloonPanelView']['show'](),this['addContextButtonView']['isOn']=!0x0;}['hideAllBalloons'](){this['hideAddContextBalloonPanel'](),this['hideUrlBalloonPanel'](),this['_resourcesBalloonView']['closeAll']();}['_showSourceResourcesBalloon']({source:_0x2bffa5,withBackButton:_0x54d065}){this['_resourcesBalloonView']['showSourceResourcesBalloon']({'source':_0x2bffa5,'withBackButton':_0x54d065}),this['addContextButtonView']['isOn']=!0x0;}populateSourceResourceBalloon(_0x410942,_0x3a5256,_0x22ded6,_0x4feeee){this['_resourcesBalloonView']['populateSourceResourceBalloon'](_0x410942,_0x22ded6,_0x4feeee);}['closeSourceResourceBalloon'](_0x21f91d){this['_resourcesBalloonView']['closeSourceResourceBalloon'](_0x21f91d),this['addContextButtonView']['isOn']=!0x1;}setAddContextOptions(_0x417d65){this['_setBalloonPanelContent'](this['_addContextBalloonPanelView'],this['locale'],_0x417d65),this['_setAddContextButtonEnabled'](_0x417d65);}_setAddContextButtonEnabled(_0x263c3a){const _0x1e760a=!_0x263c3a['document']['isHidden']&&_0x263c3a['document']['enabled'],_0x24f335=_0x263c3a['urls']['enabled'],_0x334502=_0x263c3a['files']['enabled'],_0x49caea=_0x263c3a['sources']['length']>0x0,_0x45a32b=_0x263c3a['customItems']&&_0x263c3a['customItems']['length']>0x0;this['addContextButtonView']['isEnabled']=_0x1e760a||_0x24f335||_0x334502||_0x49caea||_0x45a32b;}_setupTemplate(){this['setTemplate']({'tag':'div','attributes':{'class':[qo,'ck-reset_all-excluded']},'children':[{'tag':'div','attributes':{'class':Qo},'children':this['_currentContextsChips']}]});}_bindEventHandlers(){this['addContextButtonView']['on']('execute',()=>{this['_handleAddContextButtonClick']();});}_createAddContextButtonView(_0x1ddcd9){const _0x191118=new Mt(_0x1ddcd9);return _0x191118['set']({'label':Es(_0x1ddcd9,'AI_CHAT_CONTEXT_ADD_CONTEXT'),'class':ta+'\x20'+zo+'\x20'+Dn,'icon':_0x98a188,'isToggleable':!0x0,'tooltip':!0x0,'tooltipPosition':'sw'}),_0x191118;}_createAddContextBalloonPanelView(_0x5ab3e3){return this['_createBaseBalloonPanel'](_0x5ab3e3,Xo);}_createUrlBalloonPanelView(_0x4da2ac){const _0x1dd1a1=this['_createBaseBalloonPanel'](_0x4da2ac,jo);return this['_addUrlContent'](_0x1dd1a1,_0x4da2ac),_0x1dd1a1;}_createResourcesBalloonView(_0x9d2e54,_0x488efa){const _0x416219={'searchInputVisibleFrom':_0x488efa['searchInputVisibleFrom'],'onBackToContext':()=>{this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':ra});},'onResourceSelected':(_0x5676b0,_0x3b4187)=>{this['fire']('addResourceToContext',{'source':_0x5676b0,'resource':_0x3b4187});},'onLoadSourceResources':_0x3b97e4=>{this['fire']('loadSourceResources',_0x3b97e4);},'onBalloonClosed':()=>{this['addContextButtonView']['isOn']=!0x1;},'getLimiterElement':()=>this['_getLimiterElement'](),'getTargetElement':()=>this['addContextButtonView']['element']};return new Yo(_0x9d2e54,_0x488efa['bodyCollection'],_0x416219);}_getLimiterElement(){return this['element']?.['closest']('.'+na)||document['body'];}_createBaseBalloonPanel(_0xb50606,_0x88d84d){const _0x12474a=new xt(_0xb50606);return _0x12474a['extendTemplate']({'attributes':{'class':_0x88d84d}}),this['bodyCollection']['add'](_0x12474a),_0x12474a;}_setBalloonPanelContent(_0x429d42,_0x43a6db,_0x376e63){if(_0x429d42['content']['clear'](),!_0x376e63['document']['isHidden']&&_0x376e63['document']['enabled']){const _0x2693c5=this['_createBalloonButton'](_0x43a6db,{'label':Es(_0x43a6db,'AI_CHAT_CONTEXT_CURRENT_DOCUMENT'),'icon':_0x38d218});_0x2693c5['on']('execute',()=>{this['fire']('addDocumentToContext'),this['hideAddContextBalloonPanel']();}),_0x429d42['content']['add'](_0x2693c5);}if(_0x376e63['urls']['enabled']){const _0x20bd60=this['_createBalloonButton'](_0x43a6db,{'label':Es(_0x43a6db,'AI_CHAT_CONTEXT_URL_LABEL'),'icon':_0x43c1c8});_0x20bd60['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['showUrlBalloonPanel'](),this['_urlBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':ra}),this['_urlInputView']['focus']();}),_0x429d42['content']['add'](_0x20bd60);}if(_0x376e63['files']['enabled']){const _0x31eddc=new Gt(_0x43a6db);_0x31eddc['set']({'label':Es(_0x43a6db,'AI_CHAT_CONTEXT_FILE_LABEL'),'icon':_0x2adbc2,'withText':!0x0,'tooltip':!0x0,'class':Jo,'allowMultipleFiles':!0x0}),_0x31eddc['on']('execute',()=>{this['hideAddContextBalloonPanel']();}),_0x31eddc['on']('done',(_0x4066b8,_0x61486e)=>{this['fire']('addFileToContext',_0x61486e);}),_0x31eddc['tooltip']=!0x0,_0x429d42['content']['add'](_0x31eddc);}for(const _0xd9641f of _0x376e63['sources']){const _0x2275a0=this['_createBalloonButton'](_0x43a6db,{'label':_0xd9641f['label'],'icon':_0xd9641f['icon']||_0x17766e,'type':'source'});_0x429d42['content']['add'](_0x2275a0),_0x2275a0['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['_showSourceResourcesBalloon']({'source':_0xd9641f,'withBackButton':!this['_hasExactlyOneSource']});});}for(const _0x586130 of _0x376e63['customItems']||[]){const _0x5d34c0=this['_createBalloonButton'](_0x43a6db,{'label':_0x586130['label'],'icon':_0x586130['icon']||_0x17766e,'type':'customItem'});_0x429d42['content']['add'](_0x5d34c0),_0x5d34c0['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['fire']('executeCustomItemCallback',_0x586130);});}this['_hasExactlyOneSource']=0x1===_0x429d42['content']['length'],this['_urlInputView']['withBackButton']=!this['_hasExactlyOneSource'];}_addUrlContent(_0x86a178,_0x314713){this['_urlInputView']=new xo(_0x314713),this['_urlInputView']['on']('submitUrl',(_0x4b3d26,_0x2d341a)=>{this['_handleUrlSubmit'](_0x2d341a);}),this['_urlInputView']['on']('cancel',()=>{this['hideUrlBalloonPanel'](),this['_hasExactlyOneSource']||(this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':ra}));}),this['_urlInputView']['on']('refreshBalloon',()=>{this['_urlBalloonPanelView']['isVisible']&&this['_urlBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':ra});}),_0x86a178['content']['add'](this['_urlInputView']);}_createBalloonButton(_0x481084,_0xb00f29){const _0x569487='source'===_0xb00f29['type']?new aa(_0x481084):new Mt(_0x481084);return _0x569487['set']({'label':_0xb00f29['label'],'icon':_0xb00f29['icon'],'withText':!0x0,'tooltip':!0x0,'tooltipPosition':'sw','class':Jo}),_0x569487;}_setupAllBalloonClickOutsideHandlers(){this['_setupAddContextBalloonClickOutsideHandler'](),this['_setupUrlBalloonClickOutsideHandler']();}_setupUrlBalloonClickOutsideHandler(){_0x341840({'emitter':this['_urlBalloonPanelView'],'contextElements':[this['_urlBalloonPanelView']['element']],'callback':()=>{this['hideUrlBalloonPanel']();},'activator':()=>this['_urlBalloonPanelView']['isVisible']});}_toggleAddContextBalloon(_0x33924b){const _0x2d76cf=this['_addContextBalloonConfig'];_0x2d76cf['buttonView']['isOn']=_0x33924b,_0x33924b?_0x2d76cf['balloonView']['show']():_0x2d76cf['balloonView']['hide']();}_setupAddContextBalloonClickOutsideHandler(){const {balloonView:_0x8baadf,buttonView:_0x13d934,hideMethod:_0x616220}=this['_addContextBalloonConfig'];_0x341840({'emitter':_0x8baadf,'contextElements':[_0x8baadf['element'],_0x13d934['element']],'callback':()=>{_0x616220();},'activator':()=>_0x13d934['isOn']&&!this['_urlBalloonPanelView']['isVisible']&&!this['_resourcesBalloonView']['isAnyResourceBalloonVisible']()});}_createContextButton(_0x253017,_0x26910c,_0x1335dd=!0x1,_0x21bcef=!0x1){const _0x42a696='conversation'===_0x26910c||!0x0===_0x253017['isReadOnly'],_0x55b2b2=new Wr(this['locale'],_0x253017,_0x42a696,_0x1335dd,_0x21bcef);return _0x42a696||_0x55b2b2['on']('removeContextItemChip',()=>{this['fire']('removeContextItem',_0x55b2b2['id']);}),_0x55b2b2;}_addContextToCollection(_0x2ebaab,_0x1a9cba){_0x1a9cba['add'](_0x2ebaab,0x0);}_removeContextFromCollection(_0x3fffd6,_0x2dfe1e){const _0x550743=_0x2dfe1e['find'](_0x4d4840=>_0x4d4840['id']===_0x3fffd6);_0x550743&&_0x2dfe1e['remove'](_0x550743);}_handleAddContextButtonClick(){this['addContextButtonView']['isOn']?this['hideAddContextBalloonPanel']():(this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':ra}),this['_hasExactlyOneSource']&&this['_addContextBalloonPanelView']['content']['get'](0x0)?.['fire']('execute'));}_handleUrlSubmit(_0x3149bb){this['_urlInputView']['clear'](),this['hideUrlBalloonPanel'](),this['fire']('addUrlToContext',_0x3149bb);}},aa=class extends Mt{['arrowView'];constructor(_0x4dfe60){super(_0x4dfe60),this['set']({'withText':!0x0,'role':'menuitem'}),this['arrowView']=this['_createArrowView'](),this['extendTemplate']({'attributes':{'class':[Zo]}});}['render'](){super['render'](),this['children']['add'](this['arrowView']);}_createArrowView(){const _0x3eab92=new $t();return _0x3eab92['content']=_0x2d80b8,_0x3eab92['extendTemplate']({'attributes':{'class':Zo+'__arrow'}}),_0x3eab92;}},ha=class extends _0x4ff2da{_cancelButtonView;['_loaderView'];constructor(_0x175440){super(_0x175440),this['_cancelButtonView']=this['_createCancelButtonView'](),this['_loaderView']=this['_createLoaderView'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-controls-loader-wrapper','ck-reset_all']},'children':[this['_loaderView'],this['_cancelButtonView']]});}_createCancelButtonView(){const _0x1b16ab=new Mt(this['locale']);return _0x1b16ab['set']({'label':Es(this['locale'],'AI_CHAT_STOP_GENERATING'),'withText':!0x0,'class':Pn+'\x20ck-ai-button-stop-generating','icon':st}),_0x1b16ab['on']('execute',()=>{this['fire']('abortPromptStream');}),_0x1b16ab;}_createLoaderView(){const _0x79a509=new _0x4ff2da(this['locale']);return _0x79a509['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-controls-loader']},'children':[{'tag':'div','attributes':{'class':['ck-ai-chat-controls-loader-icon']},'children':[{'tag':'div','attributes':{'class':['ck-ai-chat-controls-loader-icon-dot']}},{'tag':'div','attributes':{'class':['ck-ai-chat-controls-loader-icon-dot']}},{'tag':'div','attributes':{'class':['ck-ai-chat-controls-loader-icon-dot']}}]},{'text':Es(this['locale'],'AI_CHAT_IS_WRITING')}]}),_0x79a509;}},ca=class extends _0x4ff2da{_contextPanelView;_promptInputView;['_dropZoneView'];_promptCapabilitiesView;['_loaderView'];['_modelUnavailableMessageView'];_shouldRestorePromptInputFocus;['_filesEnabled'];constructor(_0x392fa9,_0x5a2f82){super(_0x392fa9),this['_filesEnabled']=_0x5a2f82['filesEnabled'],this['_contextPanelView']=this['_createContextPanelView'](_0x392fa9,{'bodyCollection':_0x5a2f82['bodyCollection'],'searchInputVisibleFrom':_0x5a2f82['contextResourcesSearchInputVisibleFrom']}),this['_promptInputView']=this['_createPromptInputView'](_0x392fa9),this['_promptCapabilitiesView']=this['_createPromptCapabilitiesView'](_0x392fa9),this['_loaderView']=this['_createLoaderView'](_0x392fa9),this['_modelUnavailableMessageView']=this['_createModelUnavailableMessageView'](_0x392fa9),this['_dropZoneView']=new Ao(_0x392fa9),this['_shouldRestorePromptInputFocus']=!0x1,this['_promptInputView']['delegate']('sendUserMessage','promptInputPaste')['to'](this),this['_dropZoneView']['delegate']('promptInputPaste')['to'](this),this['_dropZoneView']['on']('dragEnter',()=>this['_contextPanelView']['hideAllBalloons']()),this['_dropZoneView']['bind']('isEnabled')['to'](this,'isLoading',_0x45b8c5=>!_0x45b8c5),this['_loaderView']['delegate']('abortPromptStream')['to'](this),this['_promptCapabilitiesView']['delegate']('toggleWebSearch')['to'](this),this['_promptCapabilitiesView']['delegate']('toggleReasoning')['to'](this),this['_promptCapabilitiesView']['delegate']('selectModel')['to'](this),this['_contextPanelView']['delegate'](...$o)['to'](this),this['set']('isModelAvailable',!0x0),this['set']('isDisabled',!0x1);const _0x2600b3=this['bindTemplate'];this['setTemplate']({'tag':'form','attributes':{'class':['ck','ck-ai-chat-controls',_0x2600b3['if']('isDisabled','ck-ai-chat-controls-disabled')]},'children':[{'tag':'div','attributes':{'class':[_0x2600b3['if']('isLoading','ck-hidden',_0x5cd0e6=>_0x5cd0e6||!this['isModelAvailable']),_0x2600b3['if']('isModelAvailable','ck-hidden',_0x1160b6=>!_0x1160b6||this['isLoading'])]},'children':[this['_contextPanelView'],this['_promptInputView'],this['_promptCapabilitiesView']]},{'tag':'div','attributes':{'class':[_0x2600b3['if']('isLoading','ck-hidden',_0xe8e8ea=>!_0xe8e8ea)]},'children':[this['_loaderView']]},{'tag':'div','attributes':{'class':[_0x2600b3['if']('isModelAvailable','ck-hidden',_0x48c6ec=>_0x48c6ec)]},'children':[this['_modelUnavailableMessageView']]},this['_dropZoneView']]}),_0x341840({'emitter':this['_promptInputView'],'activator':()=>this['isLoading'],'contextElements':()=>[this['element']],'callback':()=>{this['_shouldRestorePromptInputFocus']=!0x1;}}),this['on']('change:isLoading',this['_handlePromptInputFocus'],{'priority':'low'});}['render'](){super['render'](),this['_filesEnabled']&&this['_dropZoneView']['attach'](this['element']);}_createContextPanelView(_0x251e17,_0x192bbc){return new oa(_0x251e17,_0x192bbc);}_createPromptInputView(_0x4c6091){return new go(_0x4c6091,this['_contextPanelView']['addContextButtonView']);}_createPromptCapabilitiesView(_0x1c5ba8){return new ko(_0x1c5ba8);}_createLoaderView(_0x49d34a){return new ha(_0x49d34a);}_createModelUnavailableMessageView(_0x411fe4){const _0x41589b=new la(_0x411fe4);return _0x41589b['delegate']('startConversation')['to'](this),_0x41589b;}_handlePromptInputFocus(_0x847807,_0x126ac6,_0x20bfb8){_0x20bfb8?this['_shouldRestorePromptInputFocus']=!0x0:this['_shouldRestorePromptInputFocus']&&this['_promptInputView']['focus']();}addContextItem(_0x383a2b,_0x5cde82){this['_contextPanelView']['addContextItem'](_0x383a2b,_0x5cde82);}removeContextItem(_0x12c70f){this['_contextPanelView']['removeContextItem'](_0x12c70f);}setContextItemLoading(_0x54122c,_0x17c8c7){this['_contextPanelView']['setContextItemLoading'](_0x54122c,_0x17c8c7);}setIsUploadInProgress(_0x522b76){this['_promptInputView']['setIsUploadInProgress'](_0x522b76);}setConversationContext(_0x270468){this['_contextPanelView']['setConversationContext'](_0x270468);}clearPendingContextUI(){this['_contextPanelView']['clearCurrentContextItems']();}clearConversationContextUI(){this['_contextPanelView']['clearConversationContextItems']();}updateResourceState(_0x205f2e,_0x4bdd89,_0x4e6cdf){this['_contextPanelView']['updateResourceState'](_0x205f2e,_0x4bdd89,_0x4e6cdf);}setWebSearch(_0x19e20e){this['_promptCapabilitiesView']['setWebSearch'](_0x19e20e);}setReasoning(_0x794566){this['_promptCapabilitiesView']['setReasoning'](_0x794566);}resetMessageInput(){this['_promptInputView']['reset']();}setAddContextOptions(_0x4c5c19){this['_contextPanelView']['setAddContextOptions'](_0x4c5c19);}setInputPlaceholder(_0x2893d3){this['_promptInputView']['setPlaceholderText'](_0x2893d3);}setModelList(_0x3e025a,_0x4428ed){this['_promptCapabilitiesView']['setModelList'](_0x3e025a,_0x4428ed);}setModel(_0x4de66d){_0x4de66d?(this['isModelAvailable']=!0x0,this['_promptCapabilitiesView']['setModel'](_0x4de66d)):this['isModelAvailable']=!0x1;}enableModelSelector(){this['_promptCapabilitiesView']['enableModelSelector']();}disableModelSelector(_0x5217af){this['_promptCapabilitiesView']['disableModelSelector'](_0x5217af);}populateSourceResourceBalloon(_0x16eb92,_0x1aa5fe,_0x403701,_0x58908d){this['_contextPanelView']['populateSourceResourceBalloon'](_0x16eb92,_0x1aa5fe,_0x403701,_0x58908d);}['closeSourceResourceBalloon'](_0x31ac00){this['_contextPanelView']['closeSourceResourceBalloon'](_0x31ac00);}focusPromptInput(_0x460043=!0x1){this['_promptInputView']['focus'](_0x460043);}setPromptInputValue(_0x33d14d){this['_promptInputView']['queryView']['fieldView']['reset'](),this['_promptInputView']['queryView']['fieldView']['value']=_0x33d14d;}},la=class extends _0x4ff2da{constructor(_0x1bbe77){super(_0x1bbe77);const _0x285007=new Mt(_0x1bbe77);_0x285007['set']({'label':Es(this['locale'],'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_BUTTON'),'withText':!0x0,'class':['ck-ai-chat-controls__start-new-chat-button'],'tooltip':''}),_0x285007['delegate']('execute')['to'](this,'startConversation'),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-controls-model-unavailable-message']},'children':[{'tag':'p','children':[{'text':Es(this['locale'],'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_TEXT')+'\x20'},_0x285007]}]});}},ua=class extends Kt{resizeButton;constructor(_0x3a25de,_0x169121){super(_0x3a25de,{'label':_0x169121['label'],'class':'ck-ai-header\x20'+_0x169121['class'],'icon':_0x169121['icon']}),this['set']('isMaximized',!0x1),_0x169121['content']&&this['children']['add'](_0x169121['content']),_0x169121['showResizeButton']&&(this['resizeButton']=Hn(_0x3a25de,this),this['children']['add'](this['resizeButton']));}},da=class extends _0x4ff2da{constructor(_0x58b567){super(_0x58b567),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-disclaimer']},'children':[{'tag':'p','attributes':{'class':['ck','ck-ai-disclaimer__content']},'children':[{'text':Es(_0x58b567,'AI_DISCLAIMER_TEXT')}]}]});}};function _a(_0x50d8ef,_0x55ac10){const _0x4ebf42=new Mt(_0x50d8ef);return _0x4ebf42['set']({'label':Es(_0x50d8ef,'AI_CHAT_LABEL_NEW_CHAT'),'withText':!0x0,'icon':_0x129a73,'class':'ck-ai-chat__start-conversation\x20'+Pn}),_0x4ebf42['on']('execute',()=>{_0x55ac10['fire']('startConversation');}),_0x4ebf42;}var ga=class extends _0x4ff2da{chatHeader;chatFeed;chatControls;chatDisclaimer;_bodyCollection;constructor(_0x1d5135,_0x13d869){super(_0x1d5135),this['_bodyCollection']=Mn(_0x1d5135);const _0x6b527=_a(_0x1d5135,this);this['chatHeader']=new ua(_0x1d5135,{'label':Es(_0x1d5135,'AI_CHAT_HEADING'),'icon':_0x23ba37,'class':'ck-ai-header_chat','content':_0x6b527,'showResizeButton':_0x13d869['showResizeButton']}),this['chatHeader']['delegate']('resizeTabs')['to'](this),this['chatFeed']=new co(_0x1d5135,this['_bodyCollection']),this['chatFeed']['delegate'](...sr)['to'](this),this['chatControls']=new ca(_0x1d5135,{'bodyCollection':this['_bodyCollection'],'contextResourcesSearchInputVisibleFrom':_0x13d869['contextResourcesSearchInputVisibleFrom'],'filesEnabled':_0x13d869['filesEnabled']}),this['chatControls']['delegate'](...sr)['to'](this),this['chatDisclaimer']=new da(_0x1d5135),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-chat','ck-rounded-corners'],'dir':_0x1d5135['uiLanguageDirection']},'children':[this['chatHeader'],this['chatFeed'],this['chatControls'],this['chatDisclaimer']]});}populateSourceResourceBalloon(_0x5521f6,_0x267e88,_0x293a74,_0x2925f6){this['chatControls']['populateSourceResourceBalloon'](_0x5521f6,_0x267e88,_0x293a74,_0x2925f6);}['closeSourceResourceBalloon'](_0x2ad163){this['chatControls']['closeSourceResourceBalloon'](_0x2ad163);}destroy(){this['_bodyCollection']['detachFromDom'](),super['destroy']();}},Aa=class extends _0x212144{static get requires(){return[gs];}['_view'];static get['pluginName'](){return'AIChatUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}feedItemRenderingStrategy='streaming';['showDiff']=!0x0;['_promiseQueue'];_interactionPromiseResolver;_titleAnimationInterval=void 0x0;['_isTrackChangesCommandValueBound']=!0x1;get['idleUiPromise'](){return this['_promiseQueue']['queueEmptyPromise'];}constructor(_0x4cf38b){super(_0x4cf38b);const _0x2cf38e=this['context']['plugins']['get']('AITabs');this['set']('isBusy',!0x1),this['set']('isChatStreaming',!0x1),this['_promiseQueue']=new Sr(),this['_view']=new ga(this['context']['locale'],{'showResizeButton':_0x2cf38e['showResizeButton'],'contextResourcesSearchInputVisibleFrom':this['context']['config']['get']('ai.chat.context.searchInputVisibleFrom'),'filesEnabled':!0x1!==this['context']['config']['get']('ai.chat.context.files.enabled')}),this['_view']['delegate']('resizeTabs')['to'](_0x2cf38e),this['_view']['delegate'](...sr)['to'](this),this['_view']['on']('toggleSuggestionDisplayMode',(_0x22e53a,{showDiff:_0x3bbae3})=>{this['showDiff']=_0x3bbae3;}),this['disableControls'](),_0x2cf38e['view']['addTab']({'id':'chat','buttonLabel':Es(this['context']['locale'],'AI_CHAT_HEADING'),'buttonIcon':_0x23ba37,'order':0x0,'content':this['_view']}),this['_view']['chatHeader']['bind']('isMaximized')['to'](_0x2cf38e['view'],'isMaximized',_0xf43360=>_0xf43360),this['_view']['chatControls']['bind']('isLoading')['to'](this,'isChatStreaming',_0x43f2b6=>_0x43f2b6),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder']()),this['bind']('isModelAvailable')['to'](this['_view']['chatControls'],'isModelAvailable');}destroy(){super['destroy'](),this['_titleAnimationInterval']&&clearInterval(this['_titleAnimationInterval']);}createConversation({availableModels:_0x4d03c3}){const _0x1b0e1e=this['context']['config']['get']('ai.chat.welcomeMessage')??Es(this['context']['locale'],'AI_CHAT_WELCOME_MESSAGE');this['_view']['chatFeed']['clear'](),this['_view']['chatControls']['enableModelSelector'](),this['_view']['chatControls']['setModelList'](_0x4d03c3,!this['context']['config']['get']('ai.models.showModelSelector')),this['addFeedItemStaticMessage']({'id':'conversation-start','staticMessage':_0x1b0e1e}),this['fire']('conversationCreated');}async addFeedItemStaticMessage({id:_0x35afb6,staticMessage:_0x4fe02c}){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-reply',{'id':_0x35afb6,'initialContent':'<p>'+_0x4fe02c+'</p>'});});}async addFeedItemUserMessage(_0xecbb04){const _0x216e37=_0xecbb04['attributes']?.['displayedPrompt']||_0xecbb04['userMessage'];return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('user-message',{'contextItems':Array['from'](_0xecbb04['contextItems']['values']()),'initialContent':'<p>'+_0x216e37+'</p>','id':_0xecbb04['id']});});}async addFeedItemError({errorMessage:_0x163c47,id:_0x105f55}){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('error-message',{'initialContent':'<p>'+_0x163c47+'</p>','id':_0x105f55});});}async addFeedItemAIReply(_0x408098){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-reply',{'id':_0x408098['interactionId']+':'+_0x408098['id']}),this['clearLoadingMessage']();});}async addFeedItemAISuggestion(_0x4c9e43){const _0x5c8636=bs(this['context']),_0x5c4d5=_0x5c8636['map'](_0x133e13=>_0x133e13['config']['get']('ai.availableReplyActions')||[...Or]);let _0x4dbd9b=_0x5c4d5['reduce']((_0x5b235e,_0x3b5f2c)=>_0x5b235e['filter'](_0x3dbfe4=>_0x3b5f2c['includes'](_0x3dbfe4)),_0x5c4d5[0x0]||[...Or]);const _0xd8ea86=_0x5c8636['every'](_0x391e9b=>_0x391e9b['plugins']['has']('TrackChanges')),_0x34b1bf=_0x5c8636['map'](_0x4954a7=>_0x4954a7['commands']['get']('trackChanges'));return _0xd8ea86?this['_isTrackChangesCommandValueBound']||(this['_isTrackChangesCommandValueBound']=!0x0,this['_view']['chatFeed']['bind']('isTrackChangesOn')['toMany'](_0x34b1bf,'value',(..._0x297d11)=>_0x297d11['some'](_0x2534b1=>_0x2534b1))):_0x4dbd9b=_0x4dbd9b['filter'](_0x44d54b=>'insertSuggestion'!=_0x44d54b),this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-suggestion-reply',{'id':_0x4c9e43['interactionId']+':'+_0x4c9e43['id'],'areActionsDisabled':_0x4c9e43['areActionsDisabled'],'showDiff':this['showDiff'],'availableActions':_0x4dbd9b}),this['clearLoadingMessage']();});}async addFeedInteractionHeader(_0x19a5df,_0x4ad0a4){return this['_promiseQueue']['enqueue'](async()=>{const _0x30c81a=this['_view']['chatFeed']['children']['last'];if(_0x30c81a instanceof so)return this['_view']['chatFeed']['children']['remove'](_0x30c81a),void this['_view']['chatFeed']['addItem']('interaction-header',{'id':_0x19a5df['id'],'capabilities':{'isWebSearchEnabled':_0x30c81a['capabilities']['isWebSearchEnabled']||_0x4ad0a4['isWebSearchEnabled'],'isReasoningEnabled':_0x30c81a['capabilities']['isReasoningEnabled']||_0x4ad0a4['isReasoningEnabled']}});this['_view']['chatFeed']['addItem']('interaction-header',{'id':_0x19a5df['id'],'capabilities':_0x4ad0a4});});}async addFeedItemCustomElement(_0x54eec0,_0x56e661){let _0x540896;return await this['_promiseQueue']['enqueue'](async()=>{_0x540896=this['_view']['chatFeed']['addItem']('custom-element',{'content':_0x54eec0,'id':_0x56e661});}),_0x540896;}removeFeedItem(_0x57dd1c){this['_view']['chatFeed']['removeItem'](_0x57dd1c);}hasFeedItem(_0x3370ed){return this['_view']['chatFeed']['hasItem'](_0x3370ed);}updateFeedInteractionHeader(_0x40333b){const _0x1d9b4d=this['_view']['chatFeed']['children']['find'](_0x373f9e=>_0x373f9e['options']['id']==_0x40333b['id']&&_0x373f9e instanceof so);_0x1d9b4d&&_0x1d9b4d['set']('isVisible',_0x40333b['isVisible']);}async updateFeedItemAIReplyContent(_0x5a2021){const _0x5f4d0e=_0x5a2021['renderingStrategy']||this['feedItemRenderingStrategy'];return this['_promiseQueue']['enqueue'](async _0xa142cc=>{await this['_view']['chatFeed']['updateReplyItem']({..._0x5a2021,'abortSignal':_0xa142cc,'renderingStrategy':_0x5f4d0e}),_0x5a2021['isDone']&&this['markFeedItemAsDone'](_0x5a2021['id']);});}updateFeedItemAIReplySources(_0x4bf002,_0x37c79b){this['_view']['chatFeed']['updateWebSources'](_0x4bf002,_0x37c79b);}async updateFeedItemAIReplySuggestionContent(_0x448852){return this['_promiseQueue']['enqueue'](async _0x5583d7=>{await this['_view']['chatFeed']['updateSuggestionItem']({..._0x448852,'abortSignal':_0x5583d7}),_0x448852['isDone']&&this['markFeedItemAsDone'](_0x448852['id']);});}updateFeedItemAIReplySuggestionPartState(_0x3d321c){this['_view']['chatFeed']['updateSuggestionPartState'](_0x3d321c);}setSuggestionGating(_0x441a4f,_0x96cbf9){this['_view']['chatFeed']['updateSuggestionGating'](_0x441a4f,_0x96cbf9);}setFeedItemAIReplySuggestionPartActive(_0x39439c){this['_view']['chatFeed']['setSuggestionPartActive'](_0x39439c);}markFeedItemAsDone(_0x14bd5f){this['_view']['chatFeed']['markItemAsDone'](_0x14bd5f);}removeFeedInteraction(_0x3eb036){this['_view']['chatFeed']['getItemIds']()['filter'](_0x3fa7fe=>_0x3fa7fe['startsWith'](_0x3eb036))['forEach'](_0x1acd36=>this['_view']['chatFeed']['removeItem'](_0x1acd36));}startInteraction(){const _0x3f85ca=this['prepareLoadingMessage']({'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x1});this['setLoadingMessage'](_0x3f85ca),this['_view']['chatControls']['disableModelSelector'](!this['context']['config']['get']('ai.models.showModelSelector')),this['isBusy']=!0x0,this['isChatStreaming']=!0x0,this['_view']['chatFeed']['startAutoScroll']();}stopInteraction(_0x2187f1){this['_promiseQueue']['abort'](),_0x2187f1&&this['_view']['chatFeed']['getItemIds']()['filter'](_0x22c95b=>_0x22c95b['startsWith'](_0x2187f1['id']))['forEach'](_0xc6db08=>this['markFeedItemAsDone'](_0xc6db08)),this['resetChatBusyStateToIdle']();}resetChatBusyStateToIdle(){this['isBusy']=!0x1,this['isChatStreaming']=!0x1,this['clearLoadingMessage'](),this['_view']['chatFeed']['stopAutoScroll']();}async finishInteraction(){return this['_promiseQueue']['queueEmptyPromise']['then'](()=>{this['resetChatBusyStateToIdle']();});}addContextItem(_0x4b03a9,_0x4503d0){this['_view']['chatControls']['addContextItem'](_0x4b03a9,_0x4503d0);}removeContextItem(_0x3ea6fd){this['_view']['chatControls']['removeContextItem'](_0x3ea6fd);}setContextItemLoading(_0x536c5e,_0x3c8c1e){this['_view']['chatControls']['setContextItemLoading'](_0x536c5e,_0x3c8c1e);}setIsUploadInProgress(_0xe69730){this['_view']['chatControls']['setIsUploadInProgress'](_0xe69730);}setConversationContext(_0x46f8fd){this['_view']['chatControls']['setConversationContext'](_0x46f8fd);}clearPendingContextUI(){this['_view']['chatControls']['clearPendingContextUI']();}clearConversationContextUI(){this['_view']['chatControls']['clearConversationContextUI']();}updateResourceState(_0x2963ad,_0x5c54f4,_0x151ddd){this['_view']['chatControls']['updateResourceState'](_0x2963ad,_0x5c54f4,_0x151ddd);}resetMessageInput(){this['_view']['chatControls']['resetMessageInput'](),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder']());}setAddContextOptions(_0x2840d3){this['_view']['chatControls']['setAddContextOptions'](_0x2840d3);}updateCapabilities(_0x195538){this['_view']['chatControls']['setWebSearch'](_0x195538['isWebSearchEnabled']),this['_view']['chatControls']['setReasoning'](_0x195538['isReasoningEnabled']),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder'](_0x195538));}setSelectedModel(_0x4c3cac,_0x1203f0){this['_view']['chatControls']['setModel'](_0x4c3cac),_0x1203f0&&this['_view']['chatControls']['disableModelSelector'](!0x1);}setFeedItemRenderingStrategy(_0x1395c3){this['feedItemRenderingStrategy']=_0x1395c3;}toggleLoadingSkeleton(_0x23dac6){this['_view']['chatFeed']['toggleLoadingSkeleton'](_0x23dac6);}resetConversationTitle(){this['setConversationTitle'](Es(this['context']['locale'],'AI_CHAT_HEADING'));}emptyConversationTitle(){this['setConversationTitle']('');}setConversationTitle(_0x443553,_0xd450da=!0x1){if(clearInterval(this['_titleAnimationInterval']),_0xd450da&&!Et()&&_0x443553['length'])return this['_view']['chatHeader']['label']='',void this['_animateConversationTitle'](_0x443553);this['_view']['chatHeader']['label']=_0x443553;}setLoadingMessage(_0x2cf1d){this['_view']['chatFeed']['setLoadingMessage'](_0x2cf1d);}['clearLoadingMessage'](){this['_view']['chatFeed']['setLoadingMessage']('');}_animateConversationTitle(_0x229dc7){let _0x4ccfeb=0x0;this['_titleAnimationInterval']=setInterval(()=>{this['_view']['chatHeader']['label']=this['_view']['chatHeader']['label']+_0x229dc7[_0x4ccfeb],_0x4ccfeb++,_0x4ccfeb===_0x229dc7['length']&&clearInterval(this['_titleAnimationInterval']);},0x1e);}['prepareLoadingMessage'](_0x3eed94){return _0x3eed94['isWebSearchEnabled']&&_0x3eed94['isReasoningEnabled']?Es(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH_REASONING'):_0x3eed94['isWebSearchEnabled']?Es(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH'):_0x3eed94['isReasoningEnabled']?Es(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_REASONING'):Es(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_REGULAR');}_getInputPlaceholder(_0x54fb44){return _0x54fb44?_0x54fb44['isWebSearchEnabled']&&_0x54fb44['isReasoningEnabled']?Es(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH_REASONING'):_0x54fb44['isWebSearchEnabled']?Es(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH'):_0x54fb44['isReasoningEnabled']?Es(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REASONING'):Es(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REGULAR'):Es(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REGULAR');}populateSourceResourceBalloon(_0x825d9f,_0x3d89fc,_0x4d7f24,_0x4fffb1){this['_view']['populateSourceResourceBalloon'](_0x825d9f,_0x3d89fc,_0x4d7f24,_0x4fffb1);}['closeSourceResourceBalloon'](_0x13f71b){this['_view']['closeSourceResourceBalloon'](_0x13f71b);}setPromptInputValue(_0x411a85){this['_view']['chatControls']['setPromptInputValue'](_0x411a85);}focusPromptInput(_0x529731=!0x1){this['_view']['chatControls']['focusPromptInput'](_0x529731);}scrollFeedToSuggestion(_0x6f58da,_0x4afe5b){this['_view']['chatFeed']['scrollToSuggestion'](_0x6f58da,_0x4afe5b);}startAutoScroll(_0x12f352={}){this['_view']['chatFeed']['startAutoScroll'](_0x12f352);}stopAutoScroll(){this['_view']['chatFeed']['stopAutoScroll']();}disableControls(){this['_view']['chatControls']['isDisabled']=!0x0;}enableControls(){this['_view']['chatControls']['isDisabled']=!0x1;}toggleConversationLoading(_0x313df8){_0x313df8?(this['isBusy']=_0x313df8,this['disableControls']()):(this['enableControls'](),this['resetChatBusyStateToIdle']());}},Ia=class extends Jt{sections;constructor(_0x22a26f,_0x22eef2){super(_0x22a26f),this['sections']=_0x22eef2,this['items']['addMany'](this['sections']),this['extendTemplate']({'attributes':{'class':['ck-ai-chat-history__sections']}});}filter(_0xd2b537){let _0xd4d79a=0x0,_0x200aec=0x0;for(const _0x11061d of this['sections']){const {resultsCount:_0x162086,totalItemsCount:_0x2c6f54}=_0x11061d['filter'](_0xd2b537);_0xd4d79a+=_0x162086,_0x200aec+=_0x2c6f54;}return{'resultsCount':_0xd4d79a,'totalItemsCount':_0x200aec};}},pa=class extends jt{title;itemsViews;_itemsListView;constructor(_0x47d8ac,{title:_0x5bcba,items:_0x5e5e5c}){super(_0x47d8ac);const _0x44b212=this['bindTemplate'];this['set']('isVisible',!0x0),this['title']=_0x5bcba,this['itemsViews']=_0x5e5e5c;const _0x3eacd8=new _0x4ff2da(_0x47d8ac);_0x3eacd8['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-history__section-title']},'children':[this['title']]}),this['_itemsListView']=new Jt(_0x47d8ac),this['_itemsListView']['items']['addMany'](this['itemsViews']),this['setTemplate']({'tag':'li','attributes':{'class':['ck-ai-chat-history__section',_0x44b212['if']('isVisible','ck-hidden',_0x30aa78=>!_0x30aa78)]},'children':[_0x3eacd8,this['_itemsListView']]});}filter(_0xe2a8a2){const _0xfa85d8=this['itemsViews']['length'];let _0x2b34aa=0x0;for(const _0x7d746a of this['itemsViews'])_0xe2a8a2?(_0x7d746a['isVisible']=!!_0x7d746a['isMatching'](_0xe2a8a2),_0x7d746a['highlightText'](_0xe2a8a2)):(_0x7d746a['isVisible']=!0x0,_0x7d746a['highlightText'](null)),_0x7d746a['isVisible']&&_0x2b34aa++;return this['isVisible']=_0x2b34aa>0x0,{'resultsCount':_0x2b34aa,'totalItemsCount':_0xfa85d8};}getItem(_0x272728){return this['itemsViews']['find'](_0x46f78e=>_0x46f78e['id']===_0x272728);}removeItem(_0x3fbabf){const _0xf90ba3=this['itemsViews']['indexOf'](_0x3fbabf);-0x1!==_0xf90ba3&&(this['itemsViews']['splice'](_0xf90ba3,0x1),this['_itemsListView']['items']['remove'](_0x3fbabf));}};const Ea=/* #__PURE__ -- @preserve */
34
+ _0x4002ba(jt);var ma=class AIChatHistoryListItemView extends Ea{['id'];static ['LOADING_LABELS']={'remove':'AI_CHAT_HISTORY_LOADING_REMOVING','rename':'AI_CHAT_HISTORY_LOADING_RENAMING','pin':'AI_CHAT_HISTORY_LOADING_PINNING','unpin':'AI_CHAT_HISTORY_LOADING_UNPINNING'};actions;mainContent;_titleView;constructor(_0xf8ac81,_0x2c7faf){super(_0xf8ac81);const _0x5c5575=this['bindTemplate'];this['set']('isEdit',!0x1),this['set']('isVisible',!0x0),this['set']('pinned',!!_0x2c7faf['pinned']),this['set']('loadingState',null),this['set']('title',_0x2c7faf['title']),this['id']=_0x2c7faf['id'];const {createdAt:_0x733e0e,active:_0x358734=!0x1}=_0x2c7faf;this['_titleView']=new Yt(),this['_titleView']['bind']('text')['to'](this,'title'),this['_titleView']['extendTemplate']({'attributes':{'class':['ck-ai-chat-history__item-title']}});const _0x3cad6e=this['_createCheckView'](),_0x4e80ff=this['_createPinButtonView'](_0xf8ac81),_0x399056=this['_createMenuDropdownView'](),_0x56b80e=this['_createEditInputView'](_0xf8ac81),_0x53f8a8=this['_createAcceptEditButtonView'](_0xf8ac81,_0x56b80e),_0x496d47=this['_createCancelEditButtonView'](_0xf8ac81);this['actions']=this['createCollection'](),this['mainContent']=this['createCollection'](),this['mainContent']['add'](this['_titleView']),this['actions']['add'](_0x4e80ff),this['actions']['add'](_0x399056),this['on']('change:isEdit',(_0x40337a,_0x4d5d56,_0x4326eb)=>{this['actions']['clear'](),this['mainContent']['clear'](),_0x4326eb?(this['actions']['add'](_0x53f8a8),this['actions']['add'](_0x496d47),this['mainContent']['add'](_0x56b80e),_0x56b80e['element']['value']=this['title']||'',_0x56b80e['element']['focus']()):(this['actions']['add'](_0x4e80ff),this['actions']['add'](_0x399056),this['mainContent']['add'](this['_titleView']));}),this['setTemplate']({'tag':'li','attributes':{'class':['ck-ai-chat-history__item',_0x358734?'ck-ai-chat-history__item--active':'',_0x5c5575['if']('isVisible','ck-hidden',_0x34d7be=>!_0x34d7be),_0x5c5575['if']('isEdit','ck-ai-chat-history__item--edit')],'role':'listitem'},'children':[{'tag':'span','attributes':{'class':['ck-ai-chat-history__item-check-container']},'children':[{'tag':'div','attributes':{'class':['ck-ai-chat-history__item-check',_0x5c5575['if']('loadingState','ck-hidden',_0x481d6b=>!!_0x481d6b)]},'children':_0x358734?[_0x3cad6e]:[]},{'tag':'div','attributes':{'class':['ck-ai-loader',_0x5c5575['if']('loadingState','ck-hidden',_0xec8c3f=>!_0xec8c3f)]},'children':[this['_createSpinnerView']()]}]},{'tag':'div','attributes':{'class':['ck-ai-chat-history__item-row']},'children':[{'tag':'div','attributes':{'class':['ck-ai-chat-history__item-content']},'on':{'click':this['bindTemplate']['to']('click')},'children':[{'tag':'div','attributes':{'class':['ck-ai-chat-history__item-main-content']},'children':[{'tag':'div','attributes':{'class':['ck-ai-chat-history__item-title-container',_0x5c5575['if']('loadingState','ck-hidden',_0x10c190=>!!_0x10c190)]},'children':this['mainContent']},{'tag':'div','attributes':{'class':['ck-ai-loader__text',_0x5c5575['if']('loadingState','ck-hidden',_0x83644f=>!_0x83644f)]},'children':[{'text':_0x5c5575['to']('loadingState',_0x12357f=>_0x12357f?Es(this['locale'],AIChatHistoryListItemView['LOADING_LABELS'][_0x12357f]):'')}]}]},{'tag':'span','attributes':{'class':['ck-ai-chat-history__item-date']},'children':[_0x733e0e]}]},{'tag':'div','attributes':{'class':['ck-ai-chat-history__item-actions']},'children':this['actions']}]}]}),this['on']('click',()=>{this['isEdit']||this['fire']('selectConversation',{'id':this['id']});});}updateTitle(_0x5547c9){this['set']('title',_0x5547c9);}updateLoadingState(_0x31fa26,_0x7856de){this['set']('loadingState',_0x7856de?_0x31fa26:null);}_createCheckView(){const _0x94986e=new $t();return _0x94986e['set']({'content':_0x5517bf}),_0x94986e;}_createPinButtonView(_0x2b9cd4){const _0x2816f4=new Mt(_0x2b9cd4);return _0x2816f4['set']({'label':Es(_0x2b9cd4,'AI_CHAT_HISTORY_PIN_BUTTON'),'icon':_0x94766d,'withText':!0x1,'tooltip':!0x0}),_0x2816f4['bind']('isOn')['to'](this,'pinned'),_0x2816f4['on']('execute',()=>{const _0x1ddf49=!this['pinned'];this['fire']('setConversationPinned',{'id':this['id'],'pinned':_0x1ddf49});}),_0x2816f4;}_createMenuDropdownView(){const _0x28c874=_0x5a954d(this['locale']),_0x37e54f=_0x28c874['panelView']['children'];_0x28c874['buttonView']['set']({'label':Es(this['locale'],'AI_CHAT_HISTORY_SHOW_MORE_ITEMS'),'icon':rt}),_0x28c874['panelPosition']='sw';const _0x410420=new Mt(this['locale']);_0x410420['label']=Es(this['locale'],'AI_CHAT_HISTORY_EDIT_NAME'),_0x410420['withText']=!0x0,_0x410420['on']('execute',()=>{this['isEdit']=!0x0;});const _0x56b03e=new Mt(this['locale']);_0x56b03e['label']=Es(this['locale'],'AI_CHAT_HISTORY_REMOVE'),_0x56b03e['withText']=!0x0,_0x56b03e['on']('execute',()=>{this['showConfirm'](Es(this['locale'],'AI_CHAT_HISTORY_REMOVE_CONFIRM'),this['element'])['then'](()=>{this['fire']('removeConversation',{'id':this['id']});});});const _0x52a5ec=new Jt(this['locale']),_0x20bb10=new jt(this['locale']);_0x20bb10['children']['add'](_0x410420);const _0x33626f=new jt(this['locale']);return _0x33626f['children']['add'](_0x56b03e),_0x52a5ec['items']['addMany']([_0x20bb10,_0x33626f]),_0x37e54f['add'](_0x52a5ec),_0x28c874;}_createEditInputView(_0x103bc3){const _0x48eba2=new qt(_0x103bc3),_0x4f776b=_0x48eba2['bindTemplate'];return _0x48eba2['extendTemplate']({'on':{'keydown':_0x4f776b['to'](_0x4bd487=>{'Enter'==_0x4bd487['key']&&this['_commitEditInputValue'](_0x48eba2);})}}),_0x48eba2;}_createAcceptEditButtonView(_0x11c373,_0x9f574){const _0x5183c3=new Mt(_0x11c373);return _0x5183c3['set']({'icon':_0x5517bf,'withText':!0x1,'tooltip':Es(_0x11c373,'AI_CHAT_HISTORY_ACCEPT')}),_0x5183c3['extendTemplate']({'attributes':{'class':['ck-confirm-view-submit']}}),_0x5183c3['on']('execute',()=>{this['_commitEditInputValue'](_0x9f574);}),_0x5183c3;}_commitEditInputValue(_0x31c0c6){const _0x393861=_0x31c0c6['element']['value']||'';this['isEdit']=!0x1,this['fire']('editConversationTitle',{'id':this['id'],'title':_0x393861});}_createCancelEditButtonView(_0x5e83e5){const _0x5e9f59=new Mt(_0x5e83e5);return _0x5e9f59['set']({'icon':_0xabec2d,'withText':!0x1,'tooltip':Es(_0x5e83e5,'AI_CHAT_HISTORY_CANCEL')}),_0x5e9f59['extendTemplate']({'attributes':{'class':['ck-confirm-view-cancel']}}),_0x5e9f59['on']('execute',()=>{this['isEdit']=!0x1,this['fire']('edit:cancel');}),_0x5e9f59;}_createSpinnerView(){const _0x5d414b=new Dr('tiny');return _0x5d414b['isVisible']=!0x0,_0x5d414b;}isMatching(_0x260078){return'string'==typeof this['title']&&this['title']['match'](_0x260078)?{'title':!0x0}:null;}highlightText(_0x494389){this['_titleView']['highlightText'](_0x494389);}},Ta=class extends _0x4ff2da{['headerView'];['searchView'];['mainErrorView'];skeletonView;emptyView;sectionsView;constructor(_0x2233e1,_0x41fee3){super(_0x2233e1),this['set']('hasItems',!0x1),this['set']('isLoading',!0x0),this['set']('errorMessage',''),this['set']('isSearchViewVisible',!0x1),this['set']('isEmptyViewVisible',!0x1),this['set']('isMainErrorViewVisible',!0x1);const _0x1af5a5=_a(_0x2233e1,this);this['headerView']=new ua(_0x2233e1,{'label':Es(_0x2233e1,'AI_CHAT_HISTORY_HEADING'),'icon':_0x462166,'class':'ck-ai-header_history','content':_0x1af5a5,'showResizeButton':_0x41fee3}),this['headerView']['delegate']('resizeTabs')['to'](this),this['sectionsView']=new Ia(_0x2233e1,[]),this['sectionsView']['delegate'](...wa)['to'](this),this['mainErrorView']=this['_createErrorView'](),this['skeletonView']=this['_createSkeletonView'](),this['emptyView']=this['_createEmptyStateView'](),this['searchView']=this['_createSearchView'](),this['mainErrorView']['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isMainErrorViewVisible','ck-hidden',_0x5f5401=>!_0x5f5401)]}}),this['on']('change:isLoading',()=>this['_updateViewVisibility']()),this['on']('change:hasItems',()=>this['_updateViewVisibility']()),this['on']('change:errorMessage',()=>this['_updateViewVisibility']()),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-chat-history','ck-rounded-corners'],'dir':'ltr'},'children':[this['headerView'],{'tag':'div','attributes':{'class':['ck-ai-chat-history__content']},'children':[this['skeletonView'],this['mainErrorView'],this['emptyView'],this['searchView']]}]});}_updateViewVisibility(){this['isSearchViewVisible']=!this['isLoading']&&this['hasItems'],this['isEmptyViewVisible']=!this['isLoading']&&!this['hasItems']&&!this['errorMessage'],this['isMainErrorViewVisible']=!this['isSearchViewVisible']&&!!this['errorMessage'];}_createSearchView(){const _0x4ea335=new _0x10e0e0(this['locale'],{'filteredView':this['sectionsView'],'queryView':{'label':Es(this['locale'],'AI_CHAT_HISTORY_SEARCH_LABEL')},'infoView':{'text':{'notFound':{'primary':_0x3bcdab=>Es(this['locale'],'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_PRIMARY',_0x3bcdab),'secondary':Es(this['locale'],'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_SECONDARY')}}}}),_0x20164a=this['_createErrorView']();return _0x20164a['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('errorMessage','ck-hidden',_0x2ef6bf=>!_0x2ef6bf)]}}),_0x4ea335['on']('render',()=>{_0x4ea335['children']['add'](_0x20164a,0x1);}),_0x4ea335['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isSearchViewVisible','ck-hidden',_0x49fd23=>!_0x49fd23)]}}),_0x4ea335;}_createSkeletonView(){const _0x59cdbd=new wr(this['locale'],Cr['aiHistory']);return _0x59cdbd['bind']('isVisible')['to'](this,'isLoading'),_0x59cdbd;}_createErrorView(){const _0x376d39=new _0x4ff2da(this['locale']),_0x3b1c7f=new Mt(this['locale']);_0x3b1c7f['set']({'withText':!0x1,'icon':_0xabec2d,'class':'ck-ai-notification_error__dismiss-button'}),_0x3b1c7f['bind']('isVisible')['to'](this,'hasItems',_0x1b9f1c=>!!_0x1b9f1c),_0x3b1c7f['on']('execute',()=>{this['errorMessage']='';});const _0x46d6f8=this['bindTemplate'];return _0x376d39['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-notification','ck-ai-notification_error']},'children':[{'tag':'p','children':[{'text':_0x46d6f8['to']('errorMessage')}]},_0x3b1c7f]}),_0x376d39;}_createEmptyStateView(){const _0xc2b826=new _0x4ff2da(this['locale']);return _0xc2b826['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-history__empty',this['bindTemplate']['if']('isEmptyViewVisible','ck-hidden',_0x53fe98=>!_0x53fe98)]},'children':[{'tag':'p','attributes':{'class':['ck-ai-chat-history__empty-message']},'children':[Es(this['locale'],'AI_CHAT_HISTORY_EMPTY_MESSAGE')]}]}),_0xc2b826;}_createListItemViews(_0x86fccd,_0x2faaf9){const _0x18d756=[];for(const _0x1c6733 of _0x86fccd){const _0xb30e6d=new ma(_0x2faaf9,_0x1c6733);_0xb30e6d['delegate'](...wa)['to'](this),_0x18d756['push'](_0xb30e6d);}return _0x18d756;}updateHistoryItemsWithCategories(_0x275881){const _0x52b5bb=this['locale']||'en',_0x59b908=[];for(const _0x2b791f of _0x275881){const _0x3b9561=this['_createListItemViews'](_0x2b791f['items'],_0x52b5bb);_0x59b908['push'](new pa(_0x52b5bb,{'title':_0x2b791f['title'],'items':_0x3b9561}));}this['sectionsView']['sections']=_0x59b908,this['sectionsView']['items']['clear'](),this['sectionsView']['items']['addMany'](_0x59b908),this['hasItems']=_0x275881['some'](_0x3fadf7=>_0x3fadf7['items']['length']>0x0),this['_refreshSearch']();}removeHistoryItem(_0xfcd7a5){for(const _0x1c74e0 of this['sectionsView']['sections']){const _0x2da516=_0x1c74e0['getItem'](_0xfcd7a5);if(_0x2da516){if(_0x1c74e0['removeItem'](_0x2da516),0x0===_0x1c74e0['itemsViews']['length']){const _0x17dc12=this['sectionsView']['sections']['indexOf'](_0x1c74e0);-0x1!==_0x17dc12&&(this['sectionsView']['sections']['splice'](_0x17dc12,0x1),this['sectionsView']['items']['remove'](_0x1c74e0));}this['hasItems']=this['sectionsView']['sections']['length']>0x0,this['_refreshSearch']();break;}}}updateItemTitle(_0x30c486,_0x30ed70){for(const _0x379af4 of this['sectionsView']['sections']){const _0x275b85=_0x379af4['getItem'](_0x30c486);if(_0x275b85){_0x275b85['updateTitle'](_0x30ed70);break;}}}updateItemLoadingState(_0x4dd406,_0x3e1cdb,_0x221552){for(const _0x171327 of this['sectionsView']['sections']){const _0x3eabdf=_0x171327['getItem'](_0x4dd406);if(_0x3eabdf){_0x3eabdf['updateLoadingState'](_0x3e1cdb,_0x221552);break;}}}['_refreshSearch'](){if(this['hasItems']){const _0x5bab87=this['searchView']['queryView']['fieldView']?.['element']?.['value']||'';this['searchView']['search'](_0x5bab87);}}};const wa=['showConversationHistory','removeConversation','editConversationTitle','setConversationPinned','selectConversation','startConversation'];var Ca=class extends _0x212144{static get requires(){return[gs];}_historyView;static get['pluginName'](){return'AIChatHistoryUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x2a83b8){super(_0x2a83b8);const _0x3ad8cc=this['context']['plugins']['get']('AITabs');this['_historyView']=new Ta(this['context']['locale'],_0x3ad8cc['showResizeButton']),this['_historyView']['delegate']('resizeTabs')['to'](_0x3ad8cc),this['_historyView']['delegate'](...wa)['to'](this),this['_historyView']['headerView']['bind']('isMaximized')['to'](_0x3ad8cc['view'],'isMaximized',_0x152b80=>_0x152b80),_0x3ad8cc['view']['addTab']({'id':'history','buttonLabel':Es(this['context']['locale'],'AI_CHAT_HISTORY_HEADING'),'buttonIcon':_0x462166,'order':0x0,'content':this['_historyView']});}removeHistoryItem(_0x1c0960){this['_historyView']['removeHistoryItem'](_0x1c0960);}updateItems(_0x1f4f26){this['_historyView']['updateHistoryItemsWithCategories'](_0x1f4f26);}updateItemTitle(_0x3489a0,_0x1a0472){this['_historyView']['updateItemTitle'](_0x3489a0,_0x1a0472);}updateItemLoadingState(_0x1d38d4,_0x8fd645,_0x963674){this['_historyView']['updateItemLoadingState'](_0x1d38d4,_0x8fd645,_0x963674);}setLoadingSkeleton(_0x7fa136){this['_historyView']['isLoading']=_0x7fa136;}['showError'](_0x14b322){this['_historyView']['errorMessage']=_0x14b322;}['hideError'](){this['_historyView']['errorMessage']='';}};const fa=/* #__PURE__ -- @preserve */
35
+ At();var ba=class extends fa{['id'];createdAt;constructor({id:_0x405a8e,title:_0x5b4b5,createdAt:_0x2379b1,updatedAt:_0x29c71c,pinned:_0xbd6915}){super(),this['id']=_0x405a8e,this['createdAt']=new Date(_0x2379b1),this['set']('title',_0x5b4b5),this['set']('updatedAt',_0x29c71c?new Date(_0x29c71c):null),this['set']('pinned',_0xbd6915||!0x1);}updateTitle(_0x4c7e07){this['set']('title',_0x4c7e07),this['updatedAt']=new Date();}updatePinned(_0x448702){this['set']('pinned',_0x448702),this['updatedAt']=new Date();}};const Sa=/* #__PURE__ -- @preserve */
36
+ dt();var Ra=class extends Sa{items=[];connector;['group'];constructor({connector:_0x1c5fc8,group:_0x35d90c}){super(),this['connector']=_0x1c5fc8,this['group']=_0x35d90c;}async init(){try{const _0x22777d=await this['connector']['fetchConversations'](this['group'])['getConversations']();this['loadItems'](_0x22777d);}catch(_0x1af2a0){this['fire']('error',{'error':_0x1af2a0,'operation':'init'});}}addItem(_0x4ebec4){this['items']['push'](_0x4ebec4);}async removeItem(_0x4f414a){const _0x4eea5c=this['items']['findIndex'](_0x1b758c=>_0x1b758c['id']===_0x4f414a);if(-0x1===_0x4eea5c)return!0x1;try{return await this['connector']['deleteConversation'](_0x4f414a)['execute'](),this['items']['splice'](_0x4eea5c,0x1),this['fire']('itemRemoved',{'itemId':_0x4f414a}),!0x0;}catch(_0x350afa){return this['fire']('error',{'error':_0x350afa,'operation':'removeItem','itemId':_0x4f414a}),!0x1;}}getItem(_0x685ea9){return this['items']['find'](_0xcedff7=>_0xcedff7['id']===_0x685ea9);}async updateItemTitle(_0x4b87bf,_0x4fdcd6){const _0x4bb620=this['getItem'](_0x4b87bf);if(!_0x4bb620)return!0x1;try{return await this['connector']['updateConversation'](_0x4b87bf,{'title':_0x4fdcd6})['getResult'](),_0x4bb620['updateTitle'](_0x4fdcd6),this['fire']('itemUpdated',{'itemId':_0x4b87bf,'updates':{'title':_0x4fdcd6}}),!0x0;}catch(_0x1a7592){return this['fire']('error',{'error':_0x1a7592,'operation':'updateItemTitle','itemId':_0x4b87bf}),!0x1;}}async updateItemPinned(_0x419982,_0x1e0d18){const _0x3ce875=this['getItem'](_0x419982);if(!_0x3ce875)return!0x1;try{return await this['connector']['updateConversation'](_0x419982,{'pinned':_0x1e0d18})['getResult'](),_0x3ce875['updatePinned'](_0x1e0d18),this['fire']('itemUpdated',{'itemId':_0x419982,'updates':{'pinned':_0x1e0d18}}),!0x0;}catch(_0x255797){return this['fire']('error',{'error':_0x255797,'operation':'updateItemPinned','itemId':_0x419982}),!0x1;}}loadItems(_0x1f3706){try{this['items']=[],_0x1f3706['map'](_0x39bda9=>{this['addItem'](new ba(_0x39bda9));}),this['fire']('itemsLoaded',{'items':[...this['items']]});}catch(_0x3cf682){this['fire']('error',{'error':_0x3cf682,'operation':'loadItems'});}}getItems(_0x146ee3={}){const _0x30f206=void 0x0!==_0x146ee3['pinned']&&_0x146ee3['pinned'],_0xfea990=_0x146ee3['from']?new Date(_0x146ee3['from']['getFullYear'](),_0x146ee3['from']['getMonth'](),_0x146ee3['from']['getDate']()):null,_0x20c5d6=_0x146ee3['to']?new Date(_0x146ee3['to']['getFullYear'](),_0x146ee3['to']['getMonth'](),_0x146ee3['to']['getDate']()):null;return this['items']['filter'](_0x483567=>{if(_0x483567['pinned']!==_0x30f206)return!0x1;if(_0x20c5d6){const _0x2756bd=new Date(_0x483567['createdAt']['getFullYear'](),_0x483567['createdAt']['getMonth'](),_0x483567['createdAt']['getDate']());return _0xfea990?_0xfea990['getTime']()===_0x20c5d6['getTime']()?_0x2756bd['getTime']()===_0xfea990['getTime']():_0x2756bd<_0x20c5d6&&_0x2756bd>=_0xfea990:_0x2756bd<_0x20c5d6;}return!0x0;});}},Oa=class extends _0x212144{_aiConnector;_reporter;_aiChatHistoryUi;_aiChatController;static get requires(){return[Is,Nn,er,Ca,gs];}static get['pluginName'](){return'AIChatHistoryController';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){this['_aiConnector']=this['context']['plugins']['get'](Is),this['_aiChatHistoryUi']=this['context']['plugins']['get'](Ca),this['_aiChatController']=this['context']['plugins']['get'](er),this['_reporter']=this['context']['plugins']['get'](Nn)['createReporter']('aichathistory');const _0x17d3fc=this['context']['plugins']['get'](gs);try{const _0x5ab0b8=this['_aiChatController']['getGroupId']();this['history']=new Ra({'connector':this['_aiConnector'],'group':_0x5ab0b8}),this['listenTo'](this['_aiChatHistoryUi'],'removeConversation',(_0x13573e,_0x4bc55c)=>{this['_setItemLoading'](_0x4bc55c['id'],'remove'),this['_handleRemove'](_0x4bc55c['id']);}),this['listenTo'](this['_aiChatHistoryUi'],'editConversationTitle',(_0x369b13,_0x146353)=>{this['_setItemLoading'](_0x146353['id'],'rename'),this['_handleEditTitle'](_0x146353['id'],_0x146353['title']);}),this['listenTo'](this['history'],'itemUpdated',(_0x1f4673,_0x5817b8)=>{void 0x0!==_0x5817b8['updates']['title']&&this['_aiChatHistoryUi']['updateItemTitle'](_0x5817b8['itemId'],_0x5817b8['updates']['title']),void 0x0!==_0x5817b8['updates']['pinned']&&this['_updateHistoryItemsUI'](),this['_clearItemLoading'](_0x5817b8['itemId']);}),this['listenTo'](this['history'],'itemRemoved',(_0x213415,_0x495d2c)=>{this['_aiChatController']['_handleRemovedConversation'](_0x495d2c['itemId']),this['_aiChatHistoryUi']['removeHistoryItem'](_0x495d2c['itemId']),this['_clearItemLoading'](_0x495d2c['itemId']);}),this['listenTo'](this['history'],'itemsLoaded',()=>{this['_updateHistoryItemsUI']();}),this['listenTo'](this['history'],'error',(_0xd49d80,_0x46d265)=>{this['_handleHistoryErrorUI'](_0x46d265['error'],_0x46d265['operation'],_0x46d265['itemId']);}),this['listenTo'](this['_aiChatHistoryUi'],'selectConversation',(_0x43c9dd,_0x2cbbf1)=>{this['_handleSelectConversation'](_0x2cbbf1['id']);}),this['listenTo'](this['_aiChatHistoryUi'],'setConversationPinned',(_0xa99a1e,_0x110007)=>{const _0x1653ed=_0x110007['pinned']?'pin':'unpin';this['_setItemLoading'](_0x110007['id'],_0x1653ed),this['_handleTogglePin'](_0x110007['id'],_0x110007['pinned']);}),this['listenTo'](this['_aiChatHistoryUi'],'startConversation',()=>{this['_aiChatController']['startConversation'](),_0x17d3fc['view']['activateTab']('chat');}),this['listenTo'](this['_aiChatController'],'change:activeConversation',()=>{this['_updateHistoryItemsUI']();}),_0x17d3fc['view']['on']('activateTab:history',()=>{this['_showConversationHistory']();});}catch(_0x205a6b){this['_handleHistoryErrorUI'](_0x205a6b,'init');}}async _handleEditTitle(_0x4cdbbb,_0x3d9fb6){await this['history']['updateItemTitle'](_0x4cdbbb,_0x3d9fb6);}async['_handleTogglePin'](_0x27d394,_0x503fe3){await this['history']['updateItemPinned'](_0x27d394,_0x503fe3);}async['_handleRemove'](_0x134478){await this['history']['removeItem'](_0x134478);}async _handleSelectConversation(_0x312350){await this['_aiChatController']['loadConversation'](_0x312350);}async _showConversationHistory(){this['_aiChatHistoryUi']['showError'](''),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x0),await this['history']['init'](),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x1);}_updateHistoryItemsUI(){const _0x19e312=this['_aiChatController']['activeConversation']?.['id'],_0x54cb92=this['_getCategorizedItems']()['map'](_0x44314c=>({'title':_0x44314c['title'],'items':_0x44314c['items']['map'](_0x545792=>({'id':_0x545792['id'],'title':_0x545792['title']||Es(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION'),'createdAt':new Date(_0x545792['createdAt'])['toLocaleDateString'](),'active':_0x545792['id']===_0x19e312,'pinned':_0x545792['pinned']}))}));this['_aiChatHistoryUi']['updateItems'](_0x54cb92);}_setItemLoading(_0x4c1015,_0x57468e){this['_aiChatHistoryUi']['updateItemLoadingState'](_0x4c1015,_0x57468e,!0x0);}_clearItemLoading(_0x1865dd){this['_aiChatHistoryUi']['updateItemLoadingState'](_0x1865dd,null,!0x1);}_handleHistoryErrorUI(_0x5dfb1f,_0x217e09,_0x174666){const _0x2b18b2=this['_generateErrorMessage'](_0x217e09,_0x174666);this['_aiChatHistoryUi']['showError'](_0x2b18b2),this['_reporter']['reportError'](_0x5dfb1f,{'context':{'operation':_0x217e09}}),_0x174666&&this['_clearItemLoading'](_0x174666),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x1);}_generateErrorMessage(_0x56cea4,_0x4b2e98){const _0x200ad5=_0x4b2e98?this['history']['getItem'](_0x4b2e98):null,_0x3134cf=_0x200ad5?.['title']||Es(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION');switch(_0x56cea4){case'updateItemTitle':return Es(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_UPDATE_TITLE',_0x3134cf);case'updateItemPinned':{const _0xf9b4b=Es(this['context']['locale'],_0x200ad5?.['pinned']?'AI_CHAT_HISTORY_UNPIN_ACTION':'AI_CHAT_HISTORY_PIN_ACTION');return Es(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_UPDATE_PINNED',[_0xf9b4b,_0x3134cf]);}case'removeItem':return Es(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_REMOVE_ITEM',_0x3134cf);case'init':case'loadItems':return Es(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_LOAD_ITEMS');default:return Es(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_GENERIC');}}_getCategorizedItems(){const _0x1eb7f3=new Date(),_0x1c889d=new Date(_0x1eb7f3['getFullYear'](),_0x1eb7f3['getMonth'](),_0x1eb7f3['getDate']()),_0x380dec=new Date(_0x1c889d);_0x380dec['setDate'](_0x380dec['getDate']()-0x1);const _0x2ad04f=new Date(_0x1c889d);_0x2ad04f['setDate'](_0x2ad04f['getDate']()-0xe);const _0x312b99=this['history']['getItems']({'pinned':!0x0}),_0x5c937b=this['history']['getItems']({'from':_0x1c889d,'to':_0x1c889d}),_0x5d1518=this['history']['getItems']({'from':_0x380dec,'to':_0x380dec}),_0x338b0e=this['history']['getItems']({'from':_0x2ad04f,'to':_0x380dec}),_0x8f9e16=this['history']['getItems']({'to':_0x2ad04f}),_0x4e0c5a=[];return _0x312b99['length']>0x0&&_0x4e0c5a['push']({'title':Es(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_PINNED'),'items':_0x312b99}),_0x5c937b['length']>0x0&&_0x4e0c5a['push']({'title':Es(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_TODAY'),'items':_0x5c937b}),_0x5d1518['length']>0x0&&_0x4e0c5a['push']({'title':Es(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_YESTERDAY'),'items':_0x5d1518}),_0x338b0e['length']>0x0&&_0x4e0c5a['push']({'title':Es(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_LAST_14_DAYS'),'items':_0x338b0e}),_0x8f9e16['length']>0x0&&_0x4e0c5a['push']({'title':Es(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_LATER'),'items':_0x8f9e16}),_0x4e0c5a;}},va=class extends _0x212144{static get requires(){return[Oa,Ca];}static get['pluginName'](){return'AIChatHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},ka=class extends _0x212144{static get requires(){return[er,tn,Aa,va,vn];}static get['pluginName'](){return'AIChat';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x25f69d){super(_0x25f69d),this['context']['config']['define']('ai.chat.context',{'document':{'enabled':!0x0},'urls':{'enabled':!0x0},'files':{'enabled':!0x0},'contextLibrary':{'enabled':!0x1},'sources':[],'alwaysAddSelection':!0x1,'paste':{'textThreshold':0x5dc}}),this['context']['config']['define']('ai.chat.initialConversation','new');}},ya=class extends Mt{['id'];constructor(_0x15c1a8,_0x43858e){super(_0x15c1a8);const {id:_0x348d2f,type:_0x1ea752,icon:_0x169d3a}=_0x43858e;this['id']=_0x348d2f,this['set']({'label':_0x43858e['label'],'withText':!0x0,'class':'ck-ai-chat-shortcut'}),this['extendTemplate']({'attributes':{'data-cke-ai-shortcut-id':_0x43858e['id']}}),_0x169d3a?this['icon']=_0x169d3a:'chat'===_0x1ea752?this['icon']=_0x23ba37:'review'===_0x1ea752?this['icon']=_0x1f8cfb:'translate'===_0x1ea752&&(this['icon']=_0x1bcc6c);}},Na=class extends _0x4ff2da{listView;constructor(_0x4c8aca,_0x48946c){super(_0x4c8aca),this['set']('isEnabled',!0x0);const _0x5bc470=_0x48946c['map'](_0x5b099c=>{const _0x28e43d=new jt(this['locale']),_0x226a23=new ya(this['locale'],_0x5b099c);return _0x226a23['bind']('isEnabled')['to'](this),_0x28e43d['children']['add'](_0x226a23),_0x226a23['delegate']('execute')['to'](this),_0x28e43d;});this['listView']=new Jt(this['locale']),this['listView']['items']['addMany'](_0x5bc470),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-shortcuts']},'children':[this['listView']]});}};const xa='chat-shortcuts';var La=class extends _0x212144{_shortcuts;_shortcutsView;_aiChatUI;_listenedConversation;static get requires(){return[Aa,fs];}static get['pluginName'](){return'AIChatShortcuts';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){this['_aiChatUI']=this['context']['plugins']['get'](Aa),this['_shortcuts']=this['context']['config']['get']('ai.chat.shortcuts')??[];const _0x2dda9a=this['context']['plugins']['get']('AIChatController');this['_shortcuts']['length']&&(this['_validateShortcuts'](),this['_aiChatUI']['on']('conversationCreated',()=>{const _0x169598=_0x2dda9a['activeConversation'];_0x169598['isFromHistory']||this['_injectShortcuts'](_0x169598);}),this['listenTo'](_0x2dda9a,'interactionStarted',()=>{this['_removeShortcuts']();}));}_validateShortcuts(){const _0x510e96=['chat','review','translate'];this['_shortcuts']['forEach'](_0x15026d=>{let _0x172e74=!0x0;if(_0x15026d['id']&&_0x15026d['label']&&_0x510e96['includes'](_0x15026d['type'])?'chat'===_0x15026d['type']&&(_0x172e74='string'==typeof _0x15026d['prompt']):_0x172e74=!0x1,!_0x172e74)throw new ct('ai-chat-shortcuts-invalid-config',this['context'],{'shortcut':_0x15026d});});}_injectShortcuts(_0x55d930){this['_removeShortcuts'](),this['_shortcutsView']=new Na(this['context']['locale'],this['_shortcuts']),this['_shortcutsView']['render'](),this['_aiChatUI']['addFeedItemCustomElement'](this['_shortcutsView']['element'],xa),this['_shortcutsView']['on']('execute',_0x6bf96a=>{const _0x5f0a6f=_0x6bf96a['source']['id'];this['_executeShortcut'](_0x5f0a6f);}),this['_listenedConversation']=_0x55d930,this['listenTo'](_0x55d930,'uploadProgressChanged',(_0x95cf01,_0xfdb3be)=>{this['_shortcutsView']['isEnabled']=!_0xfdb3be['isUploadInProgress'];});}_removeShortcuts(){const _0x339b65=this['context']['plugins']['get'](Aa);_0x339b65['hasFeedItem'](xa)&&_0x339b65['removeFeedItem'](xa),this['_listenedConversation']&&(this['stopListening'](this['_listenedConversation'],'uploadProgressChanged'),this['_listenedConversation']=void 0x0),this['_shortcutsView']?.['destroy']();}_executeShortcut(_0x59e6ec){const _0x2b3edd=this['_shortcuts']['find'](_0x28d3b4=>_0x28d3b4['id']===_0x59e6ec),_0x1a7e3d=_0x2b3edd['type'];'chat'===_0x1a7e3d?this['_runChatShortcut'](_0x2b3edd):'review'===_0x1a7e3d?_0x2b3edd['commandId']?this['_runReviewShortcut'](_0x2b3edd):this['_switchTab']('reviewMode'):'translate'===_0x1a7e3d&&(_0x2b3edd['language']?this['_runTranslateShortcut'](_0x2b3edd):this['_switchTab']('translate'));}_switchTab(_0x32cc0e){if(!this['context']['plugins']['has']('AITabs'))throw new ct('ai-chat-shortcuts-ai-tabs-not-found',this['context'],{'tabName':_0x32cc0e});this['context']['plugins']['get']('AITabs')['view']['activateTab'](_0x32cc0e);}async _runChatShortcut({id:_0x5814b9,prompt:_0x133ed5,draftMode:_0x584877,useWebSearch:_0x28b0eb=!0x1,useReasoning:_0x416781=!0x1,model:_0x1c4328}){const _0x2217ac=this['context']['plugins']['get']('AIChatController'),_0x60ae15=_0x2217ac['activeConversation'],_0x22831a=this['context']['plugins']['get'](fs),_0x356595=await _0x22831a['models']['resolveModel'](_0x1c4328);_0x356595&&await _0x60ae15['setModel'](_0x356595),_0x60ae15['setWebSearch'](_0x28b0eb),_0x60ae15['setReasoning'](_0x416781);const _0x3f6c95=_0x22831a['contextLibrary']['resolveContext']({'feature':'chat','ids':[_0x5814b9],'idScopedOnly':!0x0,'context':new Yn()});_0x60ae15['addDefaultContext'](_0x3f6c95['refs']),_0x2217ac['addCurrentDocumentToChatContext'](),_0x584877?(this['_aiChatUI']['setPromptInputValue'](_0x133ed5),this['_aiChatUI']['focusPromptInput'](!0x0)):_0x2217ac['sendMessage']({'message':_0x133ed5});}_runReviewShortcut({commandId:_0x13a56b,model:_0x17a790,prompt:_0x259e1c,params:_0x37216e}){if(!this['context']['plugins']['has']('AIReviewModeUI'))throw new ct('ai-chat-shortcuts-review-mode-not-found',this['context']);this['_switchTab']('reviewMode');const _0x390590={'id':_0x13a56b,'isCustom':'custom'===_0x13a56b};_0x17a790&&_0x259e1c&&(_0x390590['args']={'model':_0x17a790,'prompt':_0x259e1c}),_0x37216e&&(_0x390590['params']=_0x37216e),this['context']['plugins']['get']('AIReviewModeUI')['fire']('runReviewCheck',_0x390590);}_runTranslateShortcut({language:_0x2e14e3}){if(!this['context']['plugins']['has']('AITranslateUI'))throw new ct('ai-chat-shortcuts-translate-not-found',this['context']);this['_switchTab']('translate'),this['context']['plugins']['get']('AITranslateUI')['fire']('runReviewCheck',{'id':_0x2e14e3,'args':{'language':_0x2e14e3}});}},Pa=class extends _0x2d31d9{constructor(_0x80d1f){super(_0x80d1f);const _0x464fcd=_0x80d1f['plugins']['get']('AITabs')['view'];this['bind']('value')['to'](_0x464fcd,'isVisible'),this['isEnabled']=!0x0;}execute(){const _0x4daeae=this['editor']['plugins']['get']('AITabs')['view'];_0x4daeae['isVisible']=!_0x4daeae['isVisible'];}},Da=class extends _0x19488e{static get requires(){return[gs];}static get['pluginName'](){return'AIToggleButtonUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const _0x175af3=this['editor'];_0x175af3['commands']['add']('toggleAi',new Pa(_0x175af3)),_0x175af3['ui']['componentFactory']['add']('toggleAi',()=>{const _0x45b184=this['_createAIUIButton'](Mt);return _0x45b184['set']({'tooltip':!0x0,'class':'ck-ai-toggle-button'}),_0x45b184;}),_0x175af3['ui']['componentFactory']['add']('menuBar:toggleAi',()=>{const _0x17119a=this['_createAIUIButton'](Zt);return _0x17119a['set']({'role':'menuitemcheckbox'}),_0x17119a;});}_createAIUIButton(_0x6d1556){const _0x494778=this['editor'],_0x2dfe02=_0x494778['commands']['get']('toggleAi'),_0xb04433=new _0x6d1556(_0x494778['locale']);return _0xb04433['set']({'label':Es(_0x494778['locale'],'AI_TOGGLE_BUTTON_LABEL'),'icon':_0x7ab78f,'isToggleable':!0x0}),_0xb04433['bind']('isEnabled')['to'](_0x2dfe02),_0xb04433['bind']('isOn')['to'](_0x2dfe02,'value',_0x5166eb=>!!_0x5166eb),this['listenTo'](_0xb04433,'execute',()=>{_0x2dfe02['execute']();}),_0xb04433;}};const Ha=['applySuggestion','insertSuggestion','showNext','showPrevious'];var Ma=class extends _0x4ff2da{['_errorView'];constructor(_0x26f2c7){super(_0x26f2c7),this['set']('_errorMessage',''),this['set']('_isErrorVisible',!0x1);}['showBlockingError'](_0x46b2f6){this['showError'](_0x46b2f6);}['showError'](_0x344ce5){this['_errorView']||(this['_errorView']=this['_createErrorView']()),this['_errorMessage']=_0x344ce5,this['_isErrorVisible']=!0x0;}['hideError'](){this['_isErrorVisible']=!0x1;}_createErrorView(){const _0x38430b=new _0x4ff2da(this['locale']),_0x4965fd=new _0x4ff2da(this['locale']);return _0x4965fd['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__error-text']},'children':[{'text':this['bindTemplate']['to']('_errorMessage')}]}),_0x38430b['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__error','ck-ai-balloon-error',this['bindTemplate']['if']('_isErrorVisible','ck-hidden',_0x6710c5=>!_0x6710c5)]},'children':[_0x4965fd]}),_0x38430b;}};const Ua=0xa;var Va=class extends _0x212144{static get requires(){return[tn];}static get['pluginName'](){return'AIBalloon';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['isOpen']=!0x1;_currentConfig;_editor;_isUpdatingMarkers=!0x1;['open'](_0x5b9f56){const {id:_0x54b827}=this['_currentConfig']??{};this['_currentConfig']=_0x5b9f56,this['_editor']=_0x5b9f56['targetEditor'];const {id:_0x50807e}=this['_currentConfig'];this['isOpen']&&_0x54b827===_0x50807e?this['_updateDialog']():this['_showDialog']();}['close'](){const _0x313467=this['_editor'];if(!_0x313467)return;const _0x1a10e7=_0x313467['plugins']['get']('Dialog');_0x1a10e7['isOpen']&&this['_currentConfig']&&_0x1a10e7['id']===this['_currentConfig']['id']&&_0x1a10e7['hide']();}_updateDialog(){const _0x3496c2=this['_editor']['plugins']['get']('Dialog'),{icon:_0x2fcb28,title:_0x330469}=this['_currentConfig'];_0x3496c2['view']?.['headerView']&&(_0x3496c2['view']['headerView']['label']=_0x330469,_0x3496c2['view']['headerView']['iconView']&&_0x2fcb28&&(_0x3496c2['view']['headerView']['iconView']['content']=_0x2fcb28)),this['_isUpdatingMarkers']=!0x0,this['_showFakeVisualSelection'](),this['_isUpdatingMarkers']=!0x1,_0x3496c2['view']?.['updatePosition']();}_showFakeVisualSelection(){this['context']['plugins']['get'](tn)['showFakeVisualSelection']({'editor':this['_editor'],'ranges':this['_currentConfig']['ranges'],'id':'balloon','priority':0x64}),window['getSelection']()?.['removeAllRanges']();}_hideFakeVisualSelection(){this['context']['plugins']['get'](tn)['hideFakeVisualSelection']('balloon');}['_showDialog'](){const _0x4ac30b=this['_editor']['plugins']['get']('Dialog'),{id:_0x14b465,title:_0x317559,icon:_0x222110,class:_0x5c602c,mainView:_0x2ff3dd}=this['_currentConfig'];_0x2ff3dd['delegate'](...Ha)['to'](this),_0x4ac30b['show']({'title':_0x317559,'icon':_0x222110,'hasCloseButton':!0x0,'id':_0x14b465,'position':this['_calculateDialogPosition']['bind'](this),'getRootName':this['_getCurrentDomRootName']['bind'](this),'className':'ck-ai-balloon\x20'+(_0x5c602c||''),'content':_0x2ff3dd,'onShow':_0x40a49f=>{this['_showFakeVisualSelection'](),this['_setupFakeVisualSelectionMarkerRemovalListener'](),_0x40a49f['view']?.['updatePosition']();const _0x104b71=this['_getSelectionElements']();_0x104b71&&_0x104b71[0x0]&&Ot({'target':_0x104b71[0x0],'ancestorOffset':0x14,'alignToTop':!0x0,'viewportOffset':{'top':0x14,'bottom':0x14,'left':0x0,'right':0x0}}),this['isOpen']=!0x0,_0x40a49f['once']('hide',()=>{this['fire']('beforeDialogClosed',{'id':_0x14b465});},{'priority':'high'});},'onHide':()=>{this['_hideFakeVisualSelection'](),this['_cleanupFakeVisualSelectionMarkerRemovalListener'](),this['fire']('dialogClosed',{'id':_0x14b465}),this['isOpen']=!0x1;}});}_calculateDialogPosition(_0x932c77,_0x4341c1,_0x23e475){const _0x32fc01=_0x4341c1||_0x23e475;if(!_0x32fc01)return null;const _0x4f6f8d=this['_getSelectionElements']();if(!_0x4f6f8d||0x0===_0x4f6f8d['length'])return{'left':Math['round'](_0x32fc01['left']+_0x32fc01['width']/0x2-_0x932c77['width']/0x2),'top':Math['round'](_0x32fc01['top']+_0x32fc01['height']/0x2-_0x932c77['height']/0x2)};const _0x4d646a=Math['round'](_0x32fc01['left']+_0x32fc01['width']/0x2-_0x932c77['width']/0x2),_0x25e6c5=_0x4f6f8d['map'](_0x5a4bbf=>new It(_0x5a4bbf)),_0x7de784=_0x932c77['height'];return{'left':_0x4d646a,'top':this['_calculateOptimalTopPosition'](_0x25e6c5,_0x7de784,_0x32fc01)};}_calculateOptimalTopPosition(_0x553bd2,_0x34ddcd,_0x189c8d){const _0x2ff1a3=new It(wt['window']),_0x2cfea3=_0x553bd2['map'](_0x1a65af=>_0x1a65af['getVisible']())['filter'](_0x105f42=>_0x105f42),_0x4cc6e9=It['getBoundingRect'](_0x2cfea3);if(!_0x4cc6e9)return Math['round'](_0x189c8d['top']+_0x189c8d['height']/0x2);const _0x408af9=_0x2ff1a3['getIntersection'](_0x4cc6e9);if(!_0x408af9)return Math['round'](_0x189c8d['top']+_0x189c8d['height']/0x2);const _0x3bd552=_0x189c8d['getVisible'](),_0x5c44d4=_0x3bd552&&_0x4cc6e9['height']>_0x3bd552['height'],_0x5d9daf=_0x408af9['top'],_0x3d8a96=_0x408af9['bottom'];if(_0x5c44d4){const _0x372eb4=_0x2ff1a3['top']+_0x2ff1a3['height']/0x2-_0x34ddcd/0x2,_0x45426b=_0x5d9daf-Ua-_0x2ff1a3['top'],_0x2f5657=_0x2ff1a3['bottom']-_0x3d8a96-Ua;return _0x45426b>=_0x34ddcd?Math['max'](Ua,_0x5d9daf-_0x34ddcd-Ua):_0x2f5657>=_0x34ddcd?_0x3d8a96+Ua:Math['max'](Ua,_0x372eb4);}const _0x21915c=_0x5d9daf-_0x34ddcd,_0x343e58=_0x2ff1a3['bottom']-_0x3d8a96-Ua,_0x56e274=_0x5d9daf-Ua-_0x2ff1a3['top'];let _0x5a1a78;return _0x5a1a78=_0x343e58>=_0x34ddcd?_0x3d8a96+Ua:_0x56e274>=_0x34ddcd?_0x21915c-Ua:_0x5d9daf+_0x4cc6e9['height']/0x2-_0x34ddcd/0x2,_0x5a1a78;}_setupFakeVisualSelectionMarkerRemovalListener(){const _0x32ac56=this['_editor'];this['listenTo'](_0x32ac56['model']['document'],'change',()=>{if(!this['_isUpdatingMarkers']){for(const {name:_0x450464,data:{newRange:_0x29354c}}of _0x32ac56['model']['document']['differ']['getChangedMarkers']())if(_0x450464['startsWith']('ai-selection:')&&(_0x29354c&&(_0x29354c['start']['isEqual'](_0x29354c['end'])||'$graveyard'==_0x29354c['root']['rootName'])||null==_0x29354c)){const _0x3f6fb9=Es(this['context']['locale'],'AI_BALLOON_SELECTION_REMOVED_ERROR');this['_currentConfig']['mainView']['showBlockingError'](_0x3f6fb9),this['fire']('selectionRemoved');}}});}_cleanupFakeVisualSelectionMarkerRemovalListener(){const _0x19a561=this['_editor'];this['_currentConfig']['mainView']['hideError'](),this['stopListening'](_0x19a561['model']['document']);}_getSelectionElements(){const _0x174d5f=this['_editor'];return _0x37a243(_0x174d5f['editing'],[..._0x174d5f['model']['markers']['getMarkersGroup']('ai-selection'),..._0x174d5f['model']['markers']['getMarkersGroup']('ai-balloon-selection')]);}_getCurrentDomRootName(){const _0x419bb1=this['_currentConfig']?.['ranges']?.[0x0]?.['root'];return _0x419bb1&&_0x419bb1['rootName']?_0x419bb1['rootName']:null;}},Ba=class extends _0x24660c{copyButton;likeButton;dislikeButton;showChangesButton;['_config'];constructor(_0x4ce700,_0x520e0b={}){super(_0x4ce700),this['set']('isEnabled',!0x0),this['set']('isShowChangesOn',!0x1),this['_config']={'showCopy':!0x1,'showLike':!0x1,'showDislike':!0x1,..._0x520e0b};const _0x1861f4=!(this['_config']['showCopy']||this['_config']['showChanges']||this['_config']['showLike']||this['_config']['showDislike']||this['_config']['customView']?.['length']);this['class']=_0x1861f4?'ck-ai-mini-toolbar\x20ck-hidden':'ck-ai-mini-toolbar',this['_config']['showCopy']&&(this['_setupCopyButton'](),this['items']['add'](this['copyButton'])),this['_config']['showChanges']&&(this['_setupShowChangesButton'](),this['items']['add'](this['showChangesButton'])),this['_setupRatingButtons'](),this['_config']['showLike']&&this['items']['add'](this['likeButton']),this['_config']['showDislike']&&this['items']['add'](this['dislikeButton']),this['_config']['customView']&&this['items']['addMany'](this['_config']['customView']);}toggleShowChangesEnabled(_0x5b69a2){this['showChangesButton']['isEnabled']=_0x5b69a2;}_setupRatingButtons(){this['likeButton']=new Mt(this['locale']),this['likeButton']['set']({'icon':at,'label':Es(this['locale'],'AI_MINI_TOOLBAR_LIKE'),'class':Dn,'tooltip':!0x0}),this['likeButton']['bind']('isEnabled')['to'](this),this['likeButton']['on']('execute',()=>{this['fire']('like');}),this['dislikeButton']=new Mt(this['locale']),this['dislikeButton']['set']({'icon':ot,'label':Es(this['locale'],'AI_MINI_TOOLBAR_DISLIKE'),'class':Dn,'tooltip':!0x0}),this['dislikeButton']['bind']('isEnabled')['to'](this),this['dislikeButton']['on']('execute',()=>{this['fire']('dislike');});}_setupCopyButton(){this['copyButton']=new Mt(this['locale']),this['copyButton']['set']({'icon':_0x208a90,'label':Es(this['locale'],'AI_MINI_TOOLBAR_COPY'),'class':'ck-ai-mini-toolbar-copy-button\x20'+Dn,'tooltip':!0x0}),this['copyButton']['bind']('isEnabled')['to'](this);const _0x1bb9ba=new $t();_0x1bb9ba['set']({'content':_0x5517bf}),_0x1bb9ba['extendTemplate']({'attributes':{'class':['ck-ai-mini-toolbar-copy-button__check-mark']}}),this['copyButton']['on']('execute',()=>{this['copyButton']['class']='ck-ai-mini-toolbar-copy-button\x20ck-ai-mini-toolbar-copy-button_copied\x20'+Dn,setTimeout(()=>{this['copyButton']['class']='ck-ai-mini-toolbar-copy-button\x20'+Dn;},0x7d0);}),this['copyButton']['children']['add'](_0x1bb9ba);}_setupShowChangesButton(){this['showChangesButton']=new Mt(this['locale']),this['showChangesButton']['set']({'icon':et,'label':Es(this['locale'],'AI_SUGGESTION_BUTTON_SHOW_CHANGES'),'withText':'full'==this['_config']['showChanges'],'tooltip':'full'!=this['_config']['showChanges'],'class':Dn}),this['showChangesButton']['bind']('isOn')['to'](this,'isShowChangesOn'),this['showChangesButton']['bind']('isEnabled')['to'](this),this['showChangesButton']['bind']('icon')['to'](this,'isShowChangesOn',_0x151832=>_0x151832?it:et),this['showChangesButton']['on']('execute',()=>{this['fire']('toggleShowChanges');});}},Ga=class extends Ma{['children'];nextButtonView;previousButtonView;['focusCycler'];['_focusables'];['_focusTracker'];_keystrokes;['_config'];_streamableContentView;_toolbarContainerView;_partToolbarView;_stateView;['_miniToolbarView'];constructor(_0x2e555a,_0x52158a){super(_0x2e555a);const _0x1003e4=this['bindTemplate'];this['set']('showDiff',!0x1),this['set']('_state','pending'),this['set']('_outdatedReason',void 0x0),this['set']('isTargetReadOnly',!0x1),this['set']('areActionsDisabled',!0x1),this['_focusTracker']=new _t(),this['_keystrokes']=new gt(),this['_focusables']=this['createCollection'](),this['focusCycler']=new Ft({'focusables':this['_focusables'],'focusTracker':this['_focusTracker'],'keystrokeHandler':this['_keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}),this['_config']=_0x52158a,this['nextButtonView']=this['_createNextButtonView'](),this['previousButtonView']=this['_createPreviousButtonView'](),this['_streamableContentView']=new mr(_0x2e555a),this['_partToolbarView']=new Ir(_0x2e555a,_0x52158a['availableActions']),this['_partToolbarView']['delegate']('applySuggestion','insertSuggestion','rejectSuggestion')['to'](this),this['_partToolbarView']['bind']('isTargetReadOnly')['to'](this),this['_partToolbarView']['bind']('isEnabled')['to'](this,'areActionsDisabled',this,'_isErrorVisible',(_0x38962c,_0x3161f0)=>!_0x38962c&&!_0x3161f0),this['_togglePartToolbarButtonsVisibility'](_0x52158a),this['_stateView']=new gr(_0x2e555a),this['_stateView']['isVisible']=!0x1,this['_miniToolbarView']=new Ba(_0x2e555a,{'showChanges':'full'}),this['_miniToolbarView']['bind']('isShowChangesOn')['to'](this,'showDiff'),this['_miniToolbarView']['on']('toggleShowChanges',()=>{this['fire']('toggleSuggestionDisplayMode');}),this['_toolbarContainerView']=new Fa(_0x2e555a,[this['_partToolbarView'],this['_stateView'],this['_miniToolbarView']]),this['children']=this['createCollection']([this['_streamableContentView'],this['_toolbarContainerView']]),this['on']('change:_state',(_0x3c5f2f,_0x3089e4,_0x506992,_0x1f44e5)=>{let _0xb518ea,_0x2e1e9b;'pending'===_0x1f44e5?(_0xb518ea=this['_partToolbarView'],_0x2e1e9b=this['_stateView']):(_0xb518ea=this['_stateView'],_0x2e1e9b=this['_partToolbarView']),this['_stateView']['setState'](_0x506992,this['_outdatedReason']),_0xb518ea['isVisible']=!0x1,_0x2e1e9b['isVisible']=!0x0;}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-balloon-main',_0x1003e4['to']('_state',_0x4eab84=>'ck-ai-chat-balloon-main_state_'+_0x4eab84)]},'children':this['children']}),this['on']('change:isTrackChangesOn',()=>{this['_togglePartToolbarButtonsVisibility'](_0x52158a);});}['render'](){super['render'](),this['nextButtonView']['render'](),this['previousButtonView']['render'](),this['_focusTracker']['add'](this['element']),this['_focusTracker']['add'](this['nextButtonView']),this['_focusTracker']['add'](this['previousButtonView']),this['_focusTracker']['add'](this['_miniToolbarView']),this['_focusTracker']['add'](this['_partToolbarView']),this['_keystrokes']['listenTo'](this['element']),this['_keystrokes']['listenTo'](this['nextButtonView']['element']),this['_keystrokes']['listenTo'](this['previousButtonView']['element']),this['_focusables']['addMany']([this['nextButtonView'],this['previousButtonView'],this['_partToolbarView'],this['_miniToolbarView']]);}destroy(){super['destroy'](),this['previousButtonView']['destroy'](),this['nextButtonView']['destroy']();}['focus'](){this['focusCycler']['focusFirst']();}focusLast(){this['focusCycler']['focusLast']();}async updateContent(_0x113a31){_0x113a31?.['keepErrors']||this['hideError'](),await this['_streamableContentView']['update'](_0x113a31);}clearContent(){this['_streamableContentView']['clear']();}setState(_0x5ae70e,_0x1fdfe1){this['_outdatedReason']=_0x1fdfe1,this['_state']=_0x5ae70e;}['showError'](_0x4fab8e){super['showError'](_0x4fab8e),this['children']['has'](this['_errorView'])||this['children']['add'](this['_errorView'],0x0);}toggleRotatorButtonsVisibility(_0x3cc6f5){this['nextButtonView']['isVisible']=this['previousButtonView']['isVisible']=_0x3cc6f5;}_togglePartToolbarButtonsVisibility({showApplyButton:_0x4e7aba,showSuggestButton:_0x173eb8}){_0x4e7aba=_0x4e7aba&&!this['isTrackChangesOn']&&this['_config']['availableActions']['includes']('applySuggestion'),_0x173eb8=_0x173eb8&&this['_config']['availableActions']['includes']('insertSuggestion'),this['_partToolbarView']['setButtonsVisibility']({'showApplyButton':_0x4e7aba,'showSuggestButton':_0x173eb8});}_createNextButtonView(){const _0x36c782=new Mt(this['locale']);return _0x36c782['set']({'icon':_0x43d5c7,'label':Es(this['locale'],'AI_BALLOON_NEXT_LABEL'),'isVisible':!0x0}),_0x36c782['on']('execute',()=>{this['fire']('showNext');}),_0x36c782;}_createPreviousButtonView(){const _0x6ac44=new Mt(this['locale']);return _0x6ac44['set']({'icon':_0x4c02c1,'label':Es(this['locale'],'AI_BALLOON_PREVIOUS_LABEL'),'isVisible':!0x0}),_0x6ac44['on']('execute',()=>{this['fire']('showPrevious');}),_0x6ac44;}},Fa=class extends _0x4ff2da{constructor(_0x3ce87d,_0x499379){super(_0x3ce87d),this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-balloon__toolbar-container']},'children':_0x499379});}},Ka=class extends _0x19488e{static get requires(){return[Ut,Va];}static get['pluginName'](){return'AIChatBalloon';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}_chatBalloonView;constructor(_0x2261e2){super(_0x2261e2),this['set']('showDiff',!0x1);}['open'](_0x1cc926){const _0x14e8ea=this['editor'];this['_chatBalloonView']||(this['_chatBalloonView']=this['_createChatBalloonView']()),_0x14e8ea['plugins']['get']('AIBalloon')['open']({..._0x1cc926,'id':'aiChatBalloon','class':'ck-ai-chat-balloon','mainView':this['_chatBalloonView']}),this['_toggleRotatorButtonsInDialogHeader'](_0x1cc926['showRotator']),this['_chatBalloonView']['areActionsDisabled']=_0x1cc926['areActionsDisabled'],this['_chatBalloonView']['isTargetReadOnly']=_0x1cc926['isTargetReadOnly'],this['_restoreDefaultViewFocus']();}['close'](){this['editor']['plugins']['get']('AIBalloon')['close']();}updateContent(_0x4d53ef){return this['_chatBalloonView']||(this['_chatBalloonView']=this['_createChatBalloonView']()),this['_chatBalloonView']['updateContent'](_0x4d53ef);}clearContent(){this['_chatBalloonView']&&this['_chatBalloonView']['clearContent']();}setState(_0x170678,_0x23c553){this['_chatBalloonView']&&this['_chatBalloonView']['setState'](_0x170678,_0x23c553);}setTargetReadOnly(_0x3582ff){this['_chatBalloonView']&&(this['_chatBalloonView']['isTargetReadOnly']=_0x3582ff);}_createChatBalloonView(){const _0x2c2b35=this['editor'],_0x195bc8=_0x2c2b35['plugins']['get']('AIBalloon'),_0xd7da29=_0x2c2b35['commands']['get']('trackChanges');let _0x516359=_0x2c2b35['config']['get']('ai.availableReplyActions')||[...Or];_0x2c2b35['plugins']['has']('TrackChanges')||(_0x516359=_0x516359['filter'](_0x3366b1=>'insertSuggestion'!=_0x3366b1));const _0x235072=new Ga(_0x2c2b35['locale'],{'availableActions':_0x516359,'showApplyButton':!0x0,'showSuggestButton':!!_0xd7da29});return _0x235072['bind']('showDiff')['to'](this),_0x235072['delegate'](...ir)['to'](this),_0x235072['delegate']('showPrevious','showNext')['to'](this),_0x195bc8['delegate']('dialogClosed')['to'](this),_0x235072['on']('applySuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x235072['on']('insertSuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x235072['on']('rejectSuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0xd7da29&&_0x235072['bind']('isTrackChangesOn')['to'](_0xd7da29,'value'),_0x235072['render'](),_0x235072;}_toggleRotatorButtonsInDialogHeader(_0x1fca73){const _0x805ee9=this['editor'],_0x5257e8=_0x805ee9['plugins']['get']('Dialog')['view']['headerView']['children'];this['_chatBalloonView']['toggleRotatorButtonsVisibility'](_0x1fca73),_0x5257e8['has'](this['_chatBalloonView']['previousButtonView'])||(_0x5257e8['addMany']([this['_chatBalloonView']['previousButtonView'],this['_chatBalloonView']['nextButtonView']],0x0),_0x805ee9['plugins']['get']('AIBalloon')['once']('beforeDialogClosed',()=>{_0x5257e8['remove'](this['_chatBalloonView']['previousButtonView']),_0x5257e8['remove'](this['_chatBalloonView']['nextButtonView']);}));}_restoreDefaultViewFocus(){this['_chatBalloonView']['focus']();}},Wa=class extends _0x19488e{static get requires(){return[Da,Ka,_0x11ff4f];}static get['pluginName'](){return'AIEditorIntegration';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}};function Ya(_0x52a5e1){const {editor:_0x2ee9ac,action:_0x2d738a,withText:_0x2732f4=!0x1,withIcon:_0x3a4440=!0x0,isInDropdown:_0x2f8f1d=!0x0,shouldPreventFocus:_0x2cb9d0=!0x1,actionButtons:_0x2e3034}=_0x52a5e1;return()=>{const _0x1ef673=_0x2ee9ac['locale'],_0x410697=new Mt(_0x1ef673),_0x3b6fcf=_0x410697['bindTemplate'];_0x2f8f1d&&_0x410697['extendTemplate']({'on':{'mouseenter':_0x3b6fcf['to'](()=>{_0x2cb9d0&&_0x2cb9d0()||_0x410697['focus']();})}}),_0x2e3034['push']({'buttonView':_0x410697,'action':_0x2d738a});const _0x26faf7=_0x2d738a['icon']??_0x2d738a['parent']?.['icon'];return _0x410697['set']({'label':_0x2d738a['label'],'withText':_0x2732f4,'role':'menuitem','icon':_0x3a4440?_0x26faf7??_0x13034c:void 0x0,'tooltip':!_0x2732f4,'class':'ck-ai-quick-actions-button','isEnabled':_0x2d738a['isEnabled']}),_0x410697['on']('execute',()=>{_0x2ee9ac['editing']['view']['focus'](),_0x2ee9ac['commands']['execute']('aiQuickAction',_0x2d738a);}),_0x410697;};}var $a=class extends Xt{['arrowView'];constructor(_0x2d71a7,_0x3d7efa){super(_0x2d71a7,_0x3d7efa);const _0x15f819=this['bindTemplate'];this['set']({'withText':!0x0,'role':'menuitem'}),this['arrowView']=this['_createArrowView'](),this['extendTemplate']({'attributes':{'class':['ck-dropdown-menu-list__nested-menu__button'],'aria-haspopup':!0x0,'aria-expanded':this['bindTemplate']['to']('isOn',_0x15f4c6=>String(_0x15f4c6)),'data-cke-tooltip-disabled':_0x15f819['to']('isOn')},'on':{'mouseenter':_0x15f819['to']('mouseenter')}});}['render'](){super['render'](),this['children']['add'](this['arrowView']);}_createArrowView(){const _0x4b7e3d=new $t();return _0x4b7e3d['content']=_0x2d80b8,_0x4b7e3d['extendTemplate']({'attributes':{'class':'ck-dropdown-menu-list__nested-menu__button__arrow'}}),_0x4b7e3d;}},qa=class extends Jt{_allListItems;_allSearchableItems;constructor(_0x555244,_0x498f0f,_0x1a16cd){super(_0x555244),this['_allListItems']=_0x498f0f,this['_allSearchableItems']=_0x1a16cd;}filter(_0x40ed0d){if(!_0x40ed0d)return this['items']['clear'](),this['items']['addMany'](this['_allListItems']),this['_clearHighlight'](),{'resultsCount':this['_allListItems']['length'],'totalItemsCount':this['_allListItems']['length']};const _0x369051=_0x40ed0d['source']['toLowerCase']()['trim'](),_0x480e1e=this['_allSearchableItems']['filter'](_0x5a1789=>(_0x5a1789['groupLabel']?_0x5a1789['label']+'\x20('+_0x5a1789['groupLabel']+')':_0x5a1789['label'])['toLowerCase']()['includes'](_0x369051));return this['items']['clear'](),this['items']['addMany'](_0x480e1e['sort']((_0x2d5e4e,_0x538009)=>{const _0x568639=_0x2d5e4e['groupLabel'],_0x490318=_0x538009['groupLabel'];return _0x568639||_0x490318?_0x568639?0x1:-0x1:0x0;})['map'](_0x1e67ba=>_0x1e67ba['item'])),this['_highlightQuery'](_0x369051,_0x480e1e),{'resultsCount':_0x480e1e['length'],'totalItemsCount':this['_allSearchableItems']['length']};}_highlightQuery(_0x20d9d4,_0x4f64fc){if(!_0x20d9d4)return;const _0x29662b=new RegExp(_0x306a2e(_0x20d9d4),'gi');_0x4f64fc['forEach'](_0x49e780=>{_0x49e780['highlightViews']&&_0x49e780['highlightViews']['forEach'](_0x33c2e4=>{'function'==typeof _0x33c2e4['highlightText']&&_0x33c2e4['highlightText'](_0x29662b);});});}_clearHighlight(){this['_allSearchableItems']['forEach'](_0xdc7759=>{_0xdc7759['highlightViews']&&_0xdc7759['highlightViews']['forEach'](_0x289c2e=>{'function'==typeof _0x289c2e['highlightText']&&_0x289c2e['highlightText'](null);});});}};const Qa='menu',Xa='menuitem';var za=class extends _0x4ff2da{_bodyCollection;optionsListView;_searchTextView=null;_allSearchableItems=[];['children'];['focusTracker'];keystrokes;['_focusables'];['focusCycler'];_openNestedPanels=new Set();['_hasSearch'];_actionButtons;constructor(_0x3021de,_0x29e228,_0x133f65,_0x47b44e,_0xafaef3=!0x1,_0x1a1540=[]){const _0x5e33e3=_0x3021de['locale'];super(_0x5e33e3),this['_bodyCollection']=_0x47b44e,this['_hasSearch']=_0xafaef3,this['_actionButtons']=_0x1a1540;const _0x271cfc=this['_createListItems'](_0x3021de,_0x29e228,_0x133f65);this['optionsListView']=new qa(_0x5e33e3,_0x271cfc,this['_allSearchableItems']),this['optionsListView']['role']=Qa,this['optionsListView']['items']['addMany'](_0x271cfc),this['focusTracker']=new _t(),this['keystrokes']=new gt(),_0xafaef3&&(this['_searchTextView']=this['_createSearchTextView']()),this['_focusables']=_0x271cfc,this['focusCycler']=new Ft({'focusables':this['_focusables'],'focusTracker':this['focusTracker'],'keystrokeHandler':this['keystrokes']}),_0xafaef3&&this['_searchTextView']&&this['focusCycler']['chain'](this['_searchTextView']['focusCycler']);const _0x400c9c=_0xafaef3&&this['_searchTextView']?[this['_searchTextView']]:[this['optionsListView']];this['children']=new _0x50bc02(_0x400c9c),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions','ck-rounded-corners'],'dir':_0x5e33e3['uiLanguageDirection']},'children':this['children']});}_createSearchTextView(){return new _0x10e0e0(this['locale'],{'filteredView':this['optionsListView'],'queryView':{'label':Es(this['locale'],'AI_QUICK_ACTIONS_SEARCH')},'class':'ck-ai-quick-actions-search','infoView':{'text':{'notFound':{'primary':Es(this['locale'],'AI_QUICK_ACTIONS_SEARCH_NOT_FOUND')}}}});}['_isSearchFocused'](){if(!this['_hasSearch']||!this['_searchTextView']||!this['_searchTextView']['queryView']['fieldView']['element'])return!0x1;const _0x5e09f8=this['_searchTextView']['queryView']['fieldView']['element']['ownerDocument']?.['activeElement'];return this['_searchTextView']['queryView']['fieldView']['element']['contains'](_0x5e09f8);}_createListItems(_0x345d36,_0x365344,_0x28bd30){const _0x2c890f=new _0x50bc02();return _0x365344['forEach'](_0x4b01ba=>{if('actions'in _0x4b01ba){const {listItem:_0x2f03d1}=this['_createActionGroupButton'](_0x345d36,_0x4b01ba,_0x28bd30);_0x2c890f['add'](_0x2f03d1),_0x4b01ba['actions']['forEach'](_0x50e1cc=>{const {listItem:_0xad0e92,highlightViews:_0x130087}=this['_createSearchResultActionButton'](_0x345d36,_0x50e1cc,_0x4b01ba['label'],_0x4b01ba['icon']);this['_allSearchableItems']['push']({'item':_0xad0e92,'label':_0x50e1cc['label'],'groupLabel':_0x4b01ba['label'],'highlightViews':_0x130087});});}else{const {listItem:_0x975265}=this['_createActionButton'](_0x345d36,_0x4b01ba);_0x2c890f['add'](_0x975265);const _0x3e878e=_0x975265['children']['first'];if(_0x3e878e){const {listItem:_0x3910a6,highlightViews:_0x2ceb28}=this['_createSearchResultActionButton'](_0x345d36,_0x4b01ba);this['_allSearchableItems']['push']({'item':_0x3910a6,'label':_0x3e878e['label']||'','highlightViews':_0x2ceb28});}}}),_0x2c890f;}_createActionButton(_0x395e23,_0x2ce84b,_0x1f2b46,_0xa83916){const _0x4b17ea=new jt(this['locale']);if(_0x1f2b46&&_0xa83916){const _0x517cb6=new Mt(this['locale']),_0x4eb348=_0x517cb6['bindTemplate'],_0x4985e7=new Yt();_0x4985e7['text']=_0x2ce84b['label'];const _0x3dced8=new Yt();_0x3dced8['text']=_0x1f2b46;const _0x187e57=new $t();_0x187e57['content']=_0xa83916,_0x187e57['extendTemplate']({'attributes':{'class':'ck-ai-quick-actions-button__group-icon'}});const _0x17d1b1=new _0x4ff2da(this['locale']);_0x17d1b1['setTemplate']({'tag':'span','attributes':{'class':'ck-ai-quick-actions-button_with-group__open-paren'},'children':[{'text':'\x20('}]});const _0x51de4d=new _0x4ff2da(this['locale']);return _0x51de4d['setTemplate']({'tag':'span','attributes':{'class':'ck-ai-quick-actions-button_with-group__close-paren'},'children':[{'text':')'}]}),_0x517cb6['set']({'label':_0x2ce84b['label']+'\x20('+_0x1f2b46+')','withText':!0x0,'role':'menuitem','class':'ck-ai-quick-actions-button\x20ck-ai-quick-actions-button_with-group','tooltip':!0x1,'isEnabled':_0x2ce84b['isEnabled']}),_0x517cb6['setTemplate']({'tag':'button','attributes':{'class':['ck','ck-button','ck-button_with-text','ck-ai-quick-actions-button','ck-ai-quick-actions-button_with-group',_0x4eb348['if']('isEnabled','ck-disabled',_0x15a40f=>!_0x15a40f)],'type':'button','role':'menuitem','tabindex':'-1'},'children':[_0x4985e7,_0x17d1b1,_0x187e57,_0x3dced8,_0x51de4d],'on':{'mouseenter':_0x4eb348['to'](()=>{this['_isSearchFocused']()||_0x517cb6['focus']();}),'click':_0x4eb348['to'](()=>{_0x517cb6['fire']('execute');})}}),_0x517cb6['on']('execute',()=>{_0x517cb6['isEnabled']&&(_0x395e23['editing']['view']['focus'](),_0x395e23['commands']['execute']('aiQuickAction',_0x2ce84b));}),_0x4b17ea['children']['add'](_0x517cb6),this['_actionButtons']['push']({'buttonView':_0x517cb6,'action':_0x2ce84b}),{'listItem':_0x4b17ea,'highlightViews':[_0x4985e7,_0x3dced8]};}{const _0x24fc52=new Ht(),_0x4c3cfe=new Mt(this['locale'],_0x24fc52),_0x355c3c=_0x4c3cfe['bindTemplate'],_0x36d538=_0x2ce84b['icon']??_0x2ce84b['parent']?.['icon'],_0x52f3f0=void 0x0!==_0x2ce84b['icon'];return _0x4c3cfe['set']({'label':_0x2ce84b['label'],'withText':!0x0,'role':'menuitem','icon':_0x52f3f0?_0x36d538??_0x13034c:void 0x0,'tooltip':!0x1,'class':'ck-ai-quick-actions-button','isEnabled':_0x2ce84b['isEnabled']}),_0x4c3cfe['extendTemplate']({'on':{'mouseenter':_0x355c3c['to'](()=>{this['_isSearchFocused']()||_0x4c3cfe['focus']();})}}),_0x4c3cfe['on']('execute',()=>{_0x395e23['editing']['view']['focus'](),_0x395e23['commands']['execute']('aiQuickAction',_0x2ce84b);}),_0x4b17ea['children']['add'](_0x4c3cfe),this['_actionButtons']['push']({'buttonView':_0x4c3cfe,'action':_0x2ce84b}),{'listItem':_0x4b17ea,'highlightViews':[_0x24fc52]};}}_createSearchResultActionButton(_0x28afb3,_0x1aaf55,_0x2eff5c,_0x237bce){return _0x2eff5c&&_0x237bce?this['_createSearchResultGroupedActionButton'](_0x28afb3,_0x1aaf55,_0x2eff5c,_0x237bce):this['_createSearchResultIndividualActionButton'](_0x28afb3,_0x1aaf55);}_createSearchResultGroupedActionButton(_0x1ac427,_0x43c16f,_0x25963d,_0x481f1a){const _0x44acc4=new jt(this['locale']),_0x27d387=new Mt(this['locale']),_0x3e4d18=_0x27d387['bindTemplate'],{view:_0x5a1b0e,highlightView:_0x423ef4}=this['_createSearchResultGroupRow'](_0x25963d,_0x481f1a),{view:_0x57728a,highlightView:_0x4fed03}=this['_createSearchResultActionRow'](_0x43c16f['label']),_0x4ff5ef=this['_createSearchResultContentView'](_0x5a1b0e,_0x57728a);return _0x27d387['set']({'label':_0x43c16f['label'],'withText':!0x0,'role':'menuitem','class':'ck-ai-quick-actions-button\x20ck-ai-quick-actions-search-result-button\x20ck-ai-quick-actions-search-result-button_with-group','tooltip':!0x1,'isEnabled':_0x43c16f['isEnabled']}),_0x27d387['setTemplate']({'tag':'button','attributes':{'class':['ck','ck-button','ck-button_with-text','ck-ai-quick-actions-button','ck-ai-quick-actions-search-result-button','ck-ai-quick-actions-search-result-button_with-group',_0x3e4d18['if']('isEnabled','ck-disabled',_0x1d1909=>!_0x1d1909)],'type':'button','role':'menuitem','tabindex':'-1'},'children':[_0x4ff5ef],'on':{'mouseenter':_0x3e4d18['to'](()=>{this['_isSearchFocused']()||_0x27d387['focus']();}),'click':_0x3e4d18['to'](()=>{this['_handleSearchResultButtonClick'](_0x27d387);})}}),this['_setupActionButtonExecution'](_0x27d387,_0x1ac427,_0x43c16f),_0x44acc4['children']['add'](_0x27d387),this['_actionButtons']['push']({'buttonView':_0x27d387,'action':_0x43c16f}),{'listItem':_0x44acc4,'highlightViews':[_0x423ef4,_0x4fed03]};}_createSearchResultIndividualActionButton(_0x8513d7,_0x4d812b){const _0x516218=new jt(this['locale']),_0x462a05=new Ht(),_0x1afb70=new Mt(this['locale'],_0x462a05),_0x1882d8=_0x1afb70['bindTemplate'];return _0x1afb70['set']({'label':_0x4d812b['label'],'withText':!0x0,'role':'menuitem','icon':void 0x0,'tooltip':!0x1,'class':'ck-ai-quick-actions-button\x20ck-ai-quick-actions-search-result-button','isEnabled':_0x4d812b['isEnabled']}),_0x1afb70['extendTemplate']({'on':{'mouseenter':_0x1882d8['to'](()=>{this['_isSearchFocused']()||_0x1afb70['focus']();})}}),this['_setupActionButtonExecution'](_0x1afb70,_0x8513d7,_0x4d812b),_0x516218['children']['add'](_0x1afb70),this['_actionButtons']['push']({'buttonView':_0x1afb70,'action':_0x4d812b}),{'listItem':_0x516218,'highlightViews':[_0x462a05]};}_createSearchResultGroupRow(_0x162acf,_0x2671d4){const _0x15b23c=new _0x4ff2da(this['locale']),_0x175e37=new $t();_0x175e37['content']=_0x2671d4,_0x175e37['extendTemplate']({'attributes':{'class':'ck-ai-quick-actions-button__group-icon'}});const _0x178c53=new Yt();return _0x178c53['text']=_0x162acf,_0x15b23c['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__group-row'},'children':[_0x175e37,_0x178c53]}),{'view':_0x15b23c,'highlightView':_0x178c53};}_createSearchResultActionRow(_0x92c329){const _0x5892ad=new _0x4ff2da(this['locale']),_0x519148=new Yt();return _0x519148['text']=_0x92c329,_0x5892ad['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__action-row'},'children':[_0x519148]}),{'view':_0x5892ad,'highlightView':_0x519148};}_createSearchResultContentView(_0x189508,_0x45db14){const _0x42db1c=new _0x4ff2da(this['locale']);return _0x42db1c['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__content'},'children':[_0x189508,_0x45db14]}),_0x42db1c;}_setupActionButtonExecution(_0x27fd79,_0x5e5ffd,_0x869bd0){_0x27fd79['on']('execute',()=>{_0x27fd79['isEnabled']&&(_0x5e5ffd['editing']['view']['focus'](),_0x5e5ffd['commands']['execute']('aiQuickAction',_0x869bd0));});}_createActionGroupButton(_0x1af0af,_0x288b18,_0x47cfc4){const _0x1d282b=new jt(this['locale']),_0x34b588=new Ht(),_0x34c78e=new $a(this['locale'],_0x34b588),_0x3a7161=_0x34c78e['bindTemplate'],_0x56a4ca=this['_getPanelKeystroke'](_0x47cfc4),_0x2123c1=this['_createGroupActionsList'](_0x1af0af,_0x288b18['actions'],_0x47cfc4);_0x34c78e['set']({'label':_0x288b18['label'],'withText':!0x0,'role':Xa,'icon':_0x288b18['icon']??_0x13034c,'isEnabled':_0x288b18['actions']['some'](_0x28a04f=>_0x28a04f['isEnabled'])}),_0x34c78e['extendTemplate']({'on':{'mouseenter':_0x3a7161['to'](()=>{this['_isSearchFocused']()||_0x34c78e['focus']();})}});const _0x4eb535=new xt(this['locale']);return _0x4eb535['extendTemplate']({'attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions-group-panel','ck-dropdown-menu__nested-menu__panel']},'on':{'keydown':_0x3a7161['to'](_0x4f69d9=>{this['_handlePanelKeydown'](_0x4f69d9,_0x56a4ca,_0x34c78e,_0x4eb535);})}}),_0x34c78e['bind']('isOn')['to'](_0x4eb535,'isVisible'),this['_bodyCollection']['add'](_0x4eb535),_0x4eb535['content']['add'](_0x2123c1),this['_setupGroupMenuBehavior'](_0x34c78e,_0x4eb535),_0x1d282b['children']['add'](_0x34c78e),this['_actionButtons']['push']({'buttonView':_0x34c78e,'action':_0x288b18}),{'listItem':_0x1d282b,'highlightView':_0x34b588};}_createGroupActionsList(_0x339d67,_0x315149,_0x2c169d){const _0x52daaf=new Jt(this['locale']);return _0x52daaf['extendTemplate']({'attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions-group-list','ck-dropdown-menu-list']}}),_0x315149['forEach'](_0x515c38=>{const _0x156db0=new jt(this['locale']),_0x347139=Ya({'editor':_0x339d67,'action':_0x515c38,'withText':!0x0,'withIcon':!0x1,'isInDropdown':!0x0,'shouldPreventFocus':()=>this['_isSearchFocused'](),'actionButtons':this['_actionButtons']})();_0x156db0['children']['add'](_0x347139),_0x2c169d['focusTracker']['add'](_0x347139),_0x52daaf['items']['add'](_0x156db0);}),_0x52daaf;}_setupGroupMenuBehavior(_0x3bc406,_0x6d6fe9){const _0xc36ce2=_0x3bc406['bindTemplate'],_0x585a94=this['_getButtonKeystroke'](_0x3bc406);_0x3bc406['extendTemplate']({'attributes':{'class':['ck-ai-quick-actions-group-button']},'on':{'mouseenter':_0xc36ce2['to'](()=>{this['_showNestedPanel'](_0x6d6fe9,_0x3bc406);}),'mouseleave':_0xc36ce2['to'](_0x5cd6e0=>{const _0x59d060=_0x5cd6e0['relatedTarget'];this['_isMovingToNestedMenu'](_0x59d060,_0x6d6fe9)||this['_hideNestedPanel'](_0x6d6fe9);}),'keydown':_0xc36ce2['to'](_0xe97e03=>{_0xe97e03['key']==_0x585a94&&(this['_showNestedPanel'](_0x6d6fe9,_0x3bc406),_0x6d6fe9['content']['get'](0x0)['focus']());})}}),_0x6d6fe9['on']('render',()=>{_0x6d6fe9['element']?.['addEventListener']('mouseleave',_0x389600=>{const _0x28c68c=_0x389600['relatedTarget'];_0x3bc406['element']?.['contains'](_0x28c68c)||this['_isMovingToNestedMenu'](_0x28c68c,_0x6d6fe9)||this['_hideNestedPanel'](_0x6d6fe9);});});}_showNestedPanel(_0x19d66c,_0x10a90b){this['_openNestedPanels']['forEach'](_0x5d01f0=>{_0x5d01f0!==_0x19d66c&&_0x5d01f0['isVisible']&&_0x5d01f0['hide']();}),_0x19d66c['show'](),_0x19d66c['pin']({'positions':[Bt['eastSouth']],'target':_0x10a90b['element'],'fitInViewport':!0x0}),this['_openNestedPanels']['add'](_0x19d66c);}_hideNestedPanel(_0x3337cb){_0x3337cb['hide'](),this['_openNestedPanels']['delete'](_0x3337cb);}_hideAllNestedPanels(){this['_openNestedPanels']['forEach'](_0x291339=>_0x291339['hide']()),this['_openNestedPanels']['clear']();}_isMovingToNestedMenu(_0x2b27a7,_0x2adcfb){if(!_0x2b27a7)return!0x1;if(_0x2adcfb['element']?.['contains'](_0x2b27a7))return!0x0;const _0x24fdd0=_0x2b27a7;return _0x24fdd0['closest']&&(null!==_0x24fdd0['closest']('.ck-ai-quick-actions-group-panel')||null!==_0x24fdd0['closest']('.ck-ai-quick-actions-group-list')||null!==_0x24fdd0['closest']('.ck-ai-quick-actions-group-button'));}resetSearch(){this['_searchTextView']&&this['_searchTextView']['reset']();}destroy(){this['_hideAllNestedPanels'](),this['_bodyCollection']['detachFromDom'](),super['destroy']();}['focus'](){this['_searchTextView']?this['_searchTextView']['focus']():this['optionsListView']['focus']();}_getPanelKeystroke(_0x491126){return'rtl'===_0x491126['locale']['uiLanguageDirection']?'ArrowRight':'ArrowLeft';}_getButtonKeystroke(_0x395d4f){return'rtl'===_0x395d4f['locale']['uiLanguageDirection']?'ArrowLeft':'ArrowRight';}['_handlePanelKeydown'](_0xbe556,_0x4db901,_0x2aac53,_0x317503){_0xbe556['key']==_0x4db901&&(_0x2aac53['focus'](),this['_hideNestedPanel'](_0x317503));}_handleSearchResultButtonClick(_0xd4c9d6){_0xd4c9d6['fire']('execute');}};function ja(_0x55f52c){const {editor:_0x417b7b,content:_0x4ea39c,buttonDefinition:_0x4ad113,bodyCollection:_0x38a4a6,hasSearch:_0x54827a=!0x1,actionButtons:_0x44ce23}=_0x55f52c;return()=>{const _0x292c61=_0x417b7b['locale'],_0x785e27=_0x417b7b['commands']['get']('aiQuickAction'),_0x5d63fc=_0x5a954d(_0x292c61);_0x5d63fc['bind']('isEnabled')['to'](_0x785e27),_0x5d63fc['buttonView']['set']({'icon':_0x4ad113['icon']??_0x13034c,'label':_0x4ad113['label'],'tooltip':!0x0}),_0x5d63fc['set']({'class':'ck-ai-quick-actions-dropdown'});const _0x544ea5=new za(_0x417b7b,_0x4ea39c,_0x5d63fc,_0x38a4a6,_0x54827a,_0x44ce23);return _0x5d63fc['panelView']['children']['add'](_0x544ea5),_0x54827a&&_0x5d63fc['on']('change:isOpen',(_0x2a8ec0,_0x341e92,_0x3b75a7)=>{if(_0x3b75a7){if(_0x417b7b['plugins']['has']('AIEditing')){const _0x58436b=_0x417b7b['plugins']['get'](tn),_0x1faff6=_0x417b7b['model']['document']['selection'],_0x18df8e=Array['from'](_0x1faff6['getRanges']());_0x18df8e['length']>0x0&&_0x58436b['showFakeVisualSelection']({'editor':_0x417b7b,'ranges':_0x18df8e,'id':'quick-action','priority':0x14});}}else _0x417b7b['plugins']['has']('AIEditing')&&_0x417b7b['plugins']['get'](tn)['hideFakeVisualSelection']('quick-action'),_0x544ea5['resetSearch']();}),_0x5d63fc;};}const Ja='<task>Explain\x20the\x20selected\x20part\x20of\x20the\x20document\x20in\x20plain,\x20simple\x20language.</task><rules>1.\x20Identify\x20what\x20type\x20of\x20text\x20it\x20is:-\x20If\x20it\x20looks\x20like\x20a\x20definition\x20explain\x20the\x20concept\x20in\x20simple\x20terms.-\x20If\x20it\x20looks\x20like\x20a\x20description\x20clarify\x20what\x20it\x20is\x20describing\x20and\x20why\x20it\x20matters.-\x20If\x20it\x20contains\x20technical\x20terms\x20or\x20jargon\x20break\x20them\x20down\x20into\x20everyday\x20language.-\x20If\x20it\x20looks\x20instructional\x20restate\x20as\x20clear\x20steps\x20someone\x20can\x20follow.-\x20If\x20it\x20provides\x20examples\x20explain\x20what\x20the\x20example\x20shows\x20and\x20why\x20it\x27s\x20relevant.-\x20If\x20it\x20presents\x20an\x20argument\x20or\x20claim\x20restate\x20the\x20claim\x20neutrally\x20and\x20explain\x20its\x20purpose.-\x20If\x20it\x20is\x20narrative/story-like\x20explain\x20what\x20event\x20or\x20situation\x20is\x20being\x20described.-\x20If\x20it\x20is\x20data-driven\x20(stats,\x20figures,\x20facts)\x20explain\x20what\x20the\x20data\x20indicates.-\x20If\x20it\x20is\x20a\x20quotation\x20explain\x20the\x20meaning\x20of\x20the\x20quote\x20in\x20context.-\x20If\x20it\x20compares/contrasts\x20things\x20explain\x20the\x20key\x20differences\x20or\x20similarities\x20simply.-\x20If\x20it\x20does\x20not\x20fit\x20any\x20of\x20the\x20categories\x20above\x20give\x20a\x20clear,\x20plain-language\x20explanation\x20of\x20its\x20meaning,\x20focusing\x20on\x20usefulness.2.\x20Provide\x20context\x20if\x20the\x20meaning\x20could\x20be\x20unclear\x20without\x20it.\x20(e.g.,\x20explain\x20where\x20such\x20a\x20term\x20might\x20be\x20used,\x20or\x20why\x20it\x20is\x20important).3.\x20Keep\x20the\x20explanation\x20short\x20but\x20complete\x20(2–5\x20sentences).-\x20Avoid\x20overly\x20technical\x20detail\x20unless\x20it\x20is\x20necessary\x20for\x20understanding.4.\x20Do\x20not\x20simply\x20repeat\x20the\x20original\x20text\x20—\x20restate\x20and\x20expand\x20it\x20in\x20plain\x20words.5.\x20If\x20possible,\x20add\x20a\x20short\x20example\x20or\x20analogy\x20to\x20make\x20it\x20easier\x20to\x20understand.6.\x20Use\x20the\x20context\x20of\x20the\x20whole\x20document,\x20but\x20focus\x20on\x20the\x20selected\x20part\x20when\x20creating\x20your\x20explanation.7.\x20Your\x20explanation\x20should\x20be\x20written\x20in\x20%0\x20language.</rules><output>For\x20this\x20response:\x20reply\x20with\x20only\x20the\x20text\x20explanation,\x20nothing\x20else.</output><scope>These\x20instructions\x20apply\x20to\x20this\x20response\x20only.\x20In\x20follow-up\x20messages,\x20respond\x20normally\x20as\x20a\x20helpful\x20assistant,\x20that\x20can\x20make\x20document\x20modifications\x20with\x20no\x20restrictions.</scope>',Za='<task>Summarize\x20the\x20selected\x20part\x20of\x20the\x20document\x20in\x202–4\x20clear\x20sentences,\x20capturing\x20only\x20the\x20essential\x20meaning.</task><rules>1.\x20Your\x20summary\x20should\x20be\x20short\x20and\x20clear:-\x20Aim\x20for\x202–4\x20sentences\x20unless\x20the\x20text\x20is\x20extremely\x20short.-\x20Focus\x20on\x20capturing\x20the\x20main\x20idea(s)\x20without\x20unnecessary\x20detail.2.\x20Identify\x20what\x20type\x20of\x20text\x20it\x20is\x20and\x20adapt\x20the\x20summary\x20style:-\x20If\x20it\x20is\x20descriptive\x20condense\x20the\x20description\x20into\x20its\x20core\x20idea.-\x20If\x20it\x20is\x20argumentative\x20or\x20opinion-based\x20summarize\x20the\x20main\x20claim\x20and\x20reasoning\x20neutrally.-\x20If\x20it\x20is\x20narrative/story-like\x20capture\x20the\x20main\x20event\x20or\x20outcome\x20without\x20side\x20details.-\x20If\x20it\x20is\x20data-driven\x20(stats,\x20figures,\x20facts)\x20summarize\x20what\x20the\x20data\x20shows\x20in\x20plain\x20language.-\x20If\x20it\x20is\x20instructional\x20restate\x20the\x20overall\x20purpose\x20of\x20the\x20steps\x20without\x20listing\x20every\x20step.-\x20If\x20it\x20does\x20not\x20fit\x20any\x20of\x20the\x20categories\x20above\x20provide\x20a\x20general\x20concise\x20summary.3.\x20Provide\x20context\x20if\x20necessary\x20for\x20clarity:-\x20Mention\x20the\x20subject\x20or\x20topic\x20explicitly\x20so\x20the\x20summary\x20can\x20stand\x20alone.4.\x20Do\x20not\x20simply\x20copy\x20sentences\x20from\x20the\x20original\x20text\x20—\x20rephrase\x20in\x20plain\x20language.5.\x20Avoid\x20adding\x20new\x20information\x20or\x20interpretation\x20not\x20present\x20in\x20the\x20text.6.\x20Summarize\x20in\x20a\x20way\x20that\x20would\x20make\x20sense\x20to\x20someone\x20who\x20has\x20not\x20read\x20the\x20original\x20text.7.\x20Use\x20the\x20context\x20of\x20the\x20whole\x20document,\x20but\x20focus\x20on\x20the\x20selected\x20part\x20when\x20creating\x20your\x20summary.8.\x20Your\x20summary\x20should\x20be\x20written\x20in\x20%0\x20language.</rules><output>For\x20this\x20response:\x20reply\x20with\x20only\x20the\x20text\x20summary,\x20nothing\x20else.</output><scope>These\x20instructions\x20apply\x20to\x20this\x20response\x20only.\x20In\x20follow-up\x20messages,\x20respond\x20normally\x20as\x20a\x20helpful\x20assistant\x20that\x20can\x20make\x20document\x20modifications\x20with\x20no\x20restrictions.</scope>',th='<task>Extract\x20and\x20present\x20the\x20key\x20points\x20from\x20the\x20selected\x20part\x20of\x20the\x20document\x20as\x20a\x20concise\x20bulleted\x20list.</task><rules>1.\x20Present\x20the\x20output\x20as\x20a\x20clear,\x20structured\x20list\x20(bullets\x20or\x20numbered).-\x20Each\x20point\x20should\x20be\x20concise\x20(one\x20sentence\x20or\x20less).-\x20Do\x20not\x20merge\x20distinct\x20ideas\x20into\x20one\x20bullet.2.\x20Identify\x20what\x20type\x20of\x20text\x20it\x20is\x20and\x20adapt\x20the\x20extraction\x20style:-\x20If\x20it\x20is\x20descriptive\x20capture\x20the\x20main\x20attributes\x20or\x20features.-\x20If\x20it\x20is\x20argumentative\x20extract\x20the\x20main\x20claim\x20and\x20supporting\x20reasons\x20separately.-\x20If\x20it\x20is\x20narrative/story-like\x20extract\x20the\x20main\x20events\x20in\x20chronological\x20order.-\x20If\x20it\x20is\x20data-driven\x20(stats,\x20figures,\x20facts)\x20highlight\x20the\x20most\x20important\x20facts\x20or\x20numbers.-\x20If\x20it\x20is\x20instructional\x20list\x20the\x20steps\x20or\x20main\x20actions\x20in\x20simplified\x20form-\x20If\x20it\x20provides\x20comparisons\x20extract\x20the\x20contrasted\x20items\x20and\x20their\x20differences/similarities.-\x20If\x20it\x20does\x20not\x20fit\x20any\x20category\x20above\x20extract\x20the\x20main\x20ideas\x20in\x20plain,\x20short\x20statements.3.\x20Keep\x20the\x20list\x20between\x203–7\x20items\x20where\x20possible.-\x20If\x20the\x20text\x20is\x20very\x20short,\x20fewer\x20items\x20are\x20fine.-\x20If\x20it\x20is\x20very\x20long,\x20focus\x20on\x20the\x20most\x20important\x20ideas\x20only.4.\x20Do\x20not\x20copy\x20long\x20text\x20fragments\x20—\x20restate\x20in\x20simple\x20words.5.\x20Do\x20not\x20add\x20interpretation,\x20evaluation,\x20or\x20commentary\x20beyond\x20the\x20text.6.\x20Ensure\x20the\x20list\x20can\x20stand\x20alone\x20without\x20requiring\x20the\x20reader\x20to\x20see\x20the\x20original\x20document.7.\x20Use\x20the\x20context\x20of\x20the\x20whole\x20document,\x20but\x20focus\x20on\x20the\x20selected\x20part\x20when\x20creating\x20your\x20key\x20points.8.\x20Your\x20key\x20points\x20should\x20be\x20written\x20in\x20%0\x20language.</rules><output>For\x20this\x20response:\x20reply\x20with\x20only\x20the\x20text\x20key\x20points\x20list,\x20nothing\x20else.</output><scope>These\x20instructions\x20apply\x20to\x20this\x20response\x20only.\x20In\x20follow-up\x20messages,\x20respond\x20normally\x20as\x20a\x20helpful\x20assistant\x20that\x20can\x20make\x20document\x20modifications\x20with\x20no\x20restrictions.</scope>',eh=/* #__PURE__ -- @preserve */
37
+ ((()=>({'chat':'AIChat','action':'AIActions'}))());var ih=class AIQuickActionsUI extends _0x19488e{_actionButtons=[];['_menuBarGroupViews']=[];_reporter;static get requires(){return[Lt,Is,Nn,fs];}static get['pluginName'](){return'AIQuickActionsUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){this['_reporter']=this['editor']['plugins']['get'](Nn)['createReporter']('aiquickactions');const _0x374a9e=this['_getDefaultAndCustomActions']();this['_prepareQuickActionsDefinition'](_0x374a9e),this['_initializeQuickActionsComponentsAndCommands'](),this['_initActionTypeQuickActions'](),this['_initChatTypeQuickActions']();}static getDefaultQuickActions(_0x2c4662){return function(_0x2f0718){const _0x11275f=new Intl['DisplayNames'](['en'],{'type':'language'})['of'](_0x2f0718['uiLanguage'])||'English';return[{'id':'ask-ai','label':Es(_0x2f0718,'AI_QUICK_ACTIONS_ASK_AI'),'type':'chat','icon':_0xedc76b},{'id':'chat-commands','label':Es(_0x2f0718,'AI_QUICK_ACTIONS_CHAT_COMMANDS'),'icon':_0xedc76b,'actions':[{'id':'explain','label':Es(_0x2f0718,'AI_QUICK_ACTIONS_EXPLAIN'),'displayedPrompt':Es(_0x2f0718,'AI_QUICK_ACTIONS_EXPLAIN'),'prompt':Ja['replace']('%0',_0x11275f),'type':'chat'},{'id':'summarize','label':Es(_0x2f0718,'AI_QUICK_ACTIONS_SUMMARIZE'),'displayedPrompt':Es(_0x2f0718,'AI_QUICK_ACTIONS_SUMMARIZE'),'prompt':Za['replace']('%0',_0x11275f),'type':'chat'},{'id':'highlight-key-points','label':Es(_0x2f0718,'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS'),'displayedPrompt':Es(_0x2f0718,'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS'),'prompt':th['replace']('%0',_0x11275f),'type':'chat'}]},{'id':'improve-writing','label':Es(_0x2f0718,'AI_QUICK_ACTIONS_IMPROVE_WRITING'),'type':'action','icon':_0x23eeb2},{'id':'continue','label':Es(_0x2f0718,'AI_QUICK_ACTIONS_CONTINUE_WRITING'),'type':'action','icon':_0x28e5af},{'id':'fix-grammar','label':Es(_0x2f0718,'AI_QUICK_ACTIONS_FIX_GRAMMAR_SPELLING'),'type':'action','icon':_0x56be77},{'id':'adjust-length','label':Es(_0x2f0718,'AI_QUICK_ACTIONS_ADJUST_LENGTH'),'icon':_0x2dada8,'actions':[{'id':'make-shorter','label':Es(_0x2f0718,'AI_QUICK_ACTIONS_MAKE_SHORTER'),'type':'action'},{'id':'make-longer','label':Es(_0x2f0718,'AI_QUICK_ACTIONS_MAKE_LONGER'),'type':'action'}]},{'id':'change-tone','label':Es(_0x2f0718,'AI_QUICK_ACTIONS_CHANGE_TONE'),'icon':_0x3007be,'actions':[{'id':'make-tone-casual','label':Es(_0x2f0718,'AI_QUICK_ACTIONS_MORE_CASUAL'),'type':'action'},{'id':'make-tone-direct','label':Es(_0x2f0718,'AI_QUICK_ACTIONS_MORE_DIRECT'),'type':'action'},{'id':'make-tone-friendly','label':Es(_0x2f0718,'AI_QUICK_ACTIONS_MORE_FRIENDLY'),'type':'action'},{'id':'make-tone-confident','label':Es(_0x2f0718,'AI_QUICK_ACTIONS_MORE_CONFIDENT'),'type':'action'},{'id':'make-tone-professional','label':Es(_0x2f0718,'AI_QUICK_ACTIONS_MORE_PROFESSIONAL'),'type':'action'}]},{'id':'translate','label':Es(_0x2f0718,'AI_QUICK_ACTIONS_TRANSLATE'),'icon':_0x1bcc6c,'actions':[{'id':'translate-to-english','label':Es(_0x2f0718,'AI_QUICK_ACTIONS_TRANSLATE_ENGLISH'),'type':'action','actionName':'translate','args':{'language':'english'}},{'id':'translate-to-chinese','label':Es(_0x2f0718,'AI_QUICK_ACTIONS_TRANSLATE_CHINESE'),'type':'action','actionName':'translate','args':{'language':'chinese'}},{'id':'translate-to-spanish','label':Es(_0x2f0718,'AI_QUICK_ACTIONS_TRANSLATE_SPANISH'),'type':'action','actionName':'translate','args':{'language':'spanish'}},{'id':'translate-to-german','label':Es(_0x2f0718,'AI_QUICK_ACTIONS_TRANSLATE_GERMAN'),'type':'action','actionName':'translate','args':{'language':'german'}},{'id':'translate-to-french','label':Es(_0x2f0718,'AI_QUICK_ACTIONS_TRANSLATE_FRENCH'),'type':'action','actionName':'translate','args':{'language':'french'}},{'id':'translate-to-japanese','label':Es(_0x2f0718,'AI_QUICK_ACTIONS_TRANSLATE_JAPANESE'),'type':'action','actionName':'translate','args':{'language':'japanese'}},{'id':'translate-to-portuguese','label':Es(_0x2f0718,'AI_QUICK_ACTIONS_TRANSLATE_PORTUGUESE'),'type':'action','actionName':'translate','args':{'language':'portuguese'}},{'id':'translate-to-korean','label':Es(_0x2f0718,'AI_QUICK_ACTIONS_TRANSLATE_KOREAN'),'type':'action','actionName':'translate','args':{'language':'korean'}},{'id':'translate-to-italian','label':Es(_0x2f0718,'AI_QUICK_ACTIONS_TRANSLATE_ITALIAN'),'type':'action','actionName':'translate','args':{'language':'italian'}},{'id':'translate-to-russian','label':Es(_0x2f0718,'AI_QUICK_ACTIONS_TRANSLATE_RUSSIAN'),'type':'action','actionName':'translate','args':{'language':'russian'}}]},{'id':'other','label':Es(_0x2f0718,'AI_QUICK_ACTIONS_OTHER'),'icon':_0x3cb71d,'actions':[]}];}(_0x2c4662);}_getDefaultAndCustomActions(){const _0x1a21ce=AIQuickActionsUI['getDefaultQuickActions'](this['editor']['locale']),_0x3b69b1=(this['editor']['config']['get']('ai.quickActions.extraCommands')||[])['map'](_0x9c12b6=>({..._0x9c12b6,'type':'chat'===_0x9c12b6['type']?'chat':'action','icon':void 0x0}));return _0x1a21ce['find'](_0x20c8b8=>'other'===_0x20c8b8['id'])['actions']['push'](..._0x3b69b1),_0x1a21ce;}async _initActionTypeQuickActions(){try{const _0x37433e=this['editor']['plugins']['get'](fs),_0x1d3418=await _0x37433e['models']['getAllModels'](),_0x2ec650=(await _0x37433e['models']['getDefault']())?.['id'];this['_assignDefaultModelToCustomActions'](_0x2ec650),this['_enableButtonsByType']('action',_0x274156=>!!_0x1d3418['find'](_0x7dddc2=>_0x7dddc2['id']===_0x274156['model'])||void 0x0===_0x274156['model']);}catch(_0x5d927c){const _0x4d2881=new ct('ai-quick-actions-models-unable-to-retrieve',this,{'error':_0x5d927c});this['_reporter']['logError'](_0x4d2881);}}_initChatTypeQuickActions(){if(!this['editor']['plugins']['has']('AIChatController'))return;const _0x32c95b=this['editor']['plugins']['get']('AIChatController'),_0x465895=this['editor']['plugins']['has']('AIChatUI')?this['editor']['plugins']['get']('AIChatUI'):null;this['listenTo'](_0x32c95b,'change:isConversationReady',(_0x422e64,_0x491e8c,_0x29fc7e)=>{this['_enableButtonsByType']('chat',()=>_0x29fc7e&&!_0x465895?.['isBusy']);}),_0x465895&&this['listenTo'](_0x465895,'change:isBusy',(_0x393337,_0x2cbcb5,_0x3d3a34)=>{this['_enableButtonsByType']('chat',()=>_0x32c95b['isConversationReady']&&!_0x3d3a34);}),this['_enableButtonsByType']('chat',()=>_0x32c95b['isConversationReady']&&!_0x465895?.['isBusy']);}_enableButtonsByType(_0x4ff84e,_0x1718f6){this['_quickActionsDefinition']['forEach'](_0x3adb10=>{'actions'in _0x3adb10?_0x3adb10['actions']['forEach'](_0xa3483a=>{_0xa3483a['type']===_0x4ff84e&&(_0xa3483a['isEnabled']=_0x1718f6(_0xa3483a));}):_0x3adb10['type']===_0x4ff84e&&(_0x3adb10['isEnabled']=_0x1718f6(_0x3adb10));}),this['_actionButtons']['forEach'](_0x1bf49f=>{if(sh(_0x1bf49f['action']))return;if(_0x1bf49f['action']['type']!==_0x4ff84e)return;const _0x457c14=_0x1718f6(_0x1bf49f['action']);if(_0x1bf49f['action']['isEnabled']=_0x457c14,_0x1bf49f['buttonView']['isEnabled']=_0x457c14,'action'===_0x4ff84e&&!_0x457c14&&_0x1bf49f['action']['model']){const _0xc5a2fd=new ct('ai-quick-actions-unavailable-model',this,{'actionId':_0x1bf49f['action']['id'],'modelId':_0x1bf49f['action']['model']});this['_reporter']['logError'](_0xc5a2fd);}}),this['_actionButtons']['filter'](_0x1e8cf4=>sh(_0x1e8cf4['action']))['forEach'](_0x4c65a4=>{_0x4c65a4['buttonView']['isEnabled']=_0x4c65a4['action']['actions']['some'](_0x307c98=>_0x307c98['isEnabled']);}),this['_menuBarGroupViews']['forEach'](({view:_0x26ca69,group:_0x288b47})=>{_0x26ca69['isEnabled']=_0x288b47['actions']['some'](_0x2fd79c=>_0x2fd79c['isEnabled']);});}_enableButtonById(_0x4b662f,_0x583641){this['_quickActionsDefinition']['forEach'](_0x51a9e4=>{'actions'in _0x51a9e4?_0x51a9e4['actions']['forEach'](_0x1208d6=>{_0x1208d6['id']===_0x4b662f&&(_0x1208d6['isEnabled']=_0x583641(_0x1208d6));}):_0x51a9e4['id']===_0x4b662f&&(_0x51a9e4['isEnabled']=_0x583641(_0x51a9e4));}),this['_actionButtons']['forEach'](_0xd25051=>{if(sh(_0xd25051['action']))return;if(_0xd25051['action']['id']!==_0x4b662f)return;const _0x16d4fe=_0x583641(_0xd25051['action']);_0xd25051['action']['isEnabled']=_0x16d4fe,_0xd25051['buttonView']['isEnabled']=_0x16d4fe;});}_assignDefaultModelToCustomActions(_0x4b61bf){this['_actionButtons']['forEach'](_0x436d28=>{sh(_0x436d28['action'])||'action'===_0x436d28['action']['type']&&(_0x436d28['action']['model']||(_0x436d28['action']['model']=_0x4b61bf));});}_initializeQuickActionsComponentsAndCommands(){const _0xf468db=new Pt(this['editor']['locale']);_0xf468db['attachToDom'](),this['_initializeQuickActionsDropdown'](_0xf468db),this['_initializeQuickActionsMenuBar'](),this['_initializeQuickActionsComponents'](_0xf468db);}_initializeQuickActionsDropdown(_0x3079c7){const _0x4de98f=this['editor']['config']['get']('ai.quickActions.isSearchEnabled')??!0x0;this['editor']['ui']['componentFactory']['add']('aiQuickActions',ja({'editor':this['editor'],'content':this['_quickActionsDefinition'],'buttonDefinition':{'icon':_0x13034c,'label':Es(this['editor']['locale'],'AI_QUICK_ACTIONS_HEADING')},'bodyCollection':_0x3079c7,'hasSearch':_0x4de98f,'actionButtons':this['_actionButtons']}));}_prepareQuickActionsDefinition(_0x13807e){this['_quickActionsDefinition']=_0x13807e['map'](_0x2981c9=>{if('actions'in _0x2981c9){const _0x46dba4=_0x2981c9;return{..._0x46dba4,'actions':_0x46dba4['actions']['map'](_0xd162d3=>{const {actions:_0x2c08ac,..._0x936273}=_0x46dba4;return{..._0xd162d3,'isEnabled':!0x1,'parent':_0x936273};})['filter'](_0x4a8645=>this['_shouldIncludeAction'](_0x4a8645))};}return{..._0x2981c9,'isEnabled':!0x1};})['filter'](_0x3c5db6=>'actions'in _0x3c5db6?_0x3c5db6['actions']['length']>0x0:this['_shouldIncludeAction'](_0x3c5db6));}_shouldIncludeAction(_0x2dd04b){const _0x834fea=this['editor']['config']['get']('ai.quickActions.removeCommands')||[];return this['editor']['plugins']['has'](eh[_0x2dd04b['type']])&&!_0x834fea['includes'](_0x2dd04b['id'])&&!('chat'===_0x2dd04b['type']&&!0x1===this['editor']['config']['get']('ai.chat.context.document.enabled'));}_initializeQuickActionsComponents(_0x599951){this['_quickActionsDefinition']['forEach'](_0x10425e=>{if('actions'in _0x10425e){const _0x1f6c9c=ja({'editor':this['editor'],'content':_0x10425e['actions'],'buttonDefinition':_0x10425e,'bodyCollection':_0x599951,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x10425e['id'],_0x1f6c9c),_0x10425e['actions']['forEach'](_0x4ba2e0=>{const _0x465d81=Ya({'editor':this['editor'],'action':_0x4ba2e0,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x4ba2e0['id'],_0x465d81);});}else{const _0x3e12f0=Ya({'editor':this['editor'],'action':_0x10425e,'withText':!0x1,'withIcon':!0x0,'isInDropdown':!0x1,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x10425e['id'],_0x3e12f0);}});}_initializeQuickActionsMenuBar(){this['editor']['ui']['componentFactory']['add']('menuBar:aiQuickActions',_0x22706d=>{const _0x41cfcb=this['editor']['commands']['get']('aiQuickAction'),_0x150dc6=new _0x4888f9(_0x22706d),_0x5700bf=Es(_0x22706d,'AI_QUICK_ACTIONS_HEADING');_0x150dc6['buttonView']['set']({'label':_0x5700bf,'icon':_0x13034c});const _0x554bc2=new _0x164ccd(_0x22706d);return _0x554bc2['set']({'ariaLabel':_0x5700bf,'role':'menu'}),this['_quickActionsDefinition']['forEach'](_0x519c20=>{if('actions'in _0x519c20){const _0x30edcb=_0x519c20,_0x3328bb=new te(_0x22706d,_0x150dc6),_0x1bee36=new _0x4888f9(_0x22706d),_0x22a0f0=new _0x164ccd(_0x22706d);_0x1bee36['buttonView']['set']({'label':_0x30edcb['label'],'icon':_0x30edcb['icon']}),_0x30edcb['actions']['forEach'](_0x46cca7=>{const _0x5e343a=new te(_0x22706d,_0x1bee36),_0xa2acb1=new Zt(_0x22706d);_0xa2acb1['set']({'label':_0x46cca7['label'],'icon':_0x46cca7['icon'],'role':'menuitem','isEnabled':_0x46cca7['isEnabled']}),_0xa2acb1['on']('execute',()=>{this['_executeQuickAction'](_0x46cca7);}),this['_actionButtons']['push']({'buttonView':_0xa2acb1,'action':_0x46cca7}),_0xa2acb1['delegate']('execute')['to'](_0x1bee36),_0x5e343a['children']['add'](_0xa2acb1),_0x22a0f0['items']['add'](_0x5e343a);}),_0x1bee36['isEnabled']=_0x30edcb['actions']['some'](_0x4ebf77=>_0x4ebf77['isEnabled']),this['_menuBarGroupViews']['push']({'view':_0x1bee36,'group':_0x30edcb}),_0x1bee36['panelView']['children']['add'](_0x22a0f0),_0x3328bb['children']['add'](_0x1bee36),_0x554bc2['items']['add'](_0x3328bb);}else{const _0x1a0b1b=_0x519c20,_0x5353fc=new te(_0x22706d,_0x150dc6),_0x119ab6=new Zt(_0x22706d);_0x119ab6['set']({'label':_0x1a0b1b['label'],'icon':_0x1a0b1b['icon'],'role':'menuitem','isEnabled':_0x1a0b1b['isEnabled']}),this['_actionButtons']['push']({'buttonView':_0x119ab6,'action':_0x1a0b1b}),_0x119ab6['on']('execute',()=>{this['_executeQuickAction'](_0x1a0b1b);}),_0x119ab6['delegate']('execute')['to'](_0x150dc6),_0x5353fc['children']['add'](_0x119ab6),_0x554bc2['items']['add'](_0x5353fc);}}),Object['values'](eh)['some'](_0x37dc5f=>this['editor']['plugins']['has'](_0x37dc5f))?_0x150dc6['bind']('isEnabled')['to'](_0x41cfcb):_0x150dc6['set']({'isEnabled':!0x1}),_0x150dc6['panelView']['children']['add'](_0x554bc2),_0x150dc6;});}_executeQuickAction(_0x4b02ec){const _0x3665cf=this['editor'];_0x3665cf['editing']['view']['focus'](),_0x3665cf['commands']['execute']('aiQuickAction',_0x4b02ec);const _0x5cd4e1=_0x3665cf['ui']['view']['menuBarView'];_0x5cd4e1&&_0x5cd4e1['close']&&_0x5cd4e1['close']();}};function sh(_0x14a4c5){return'actions'in _0x14a4c5;}function nh(_0x1a1810,_0x17aeb6){const _0x2ed0ef=_0x1a1810['plugins']['get']('AITabs')['view'];_0x2ed0ef['isVisible']=!0x0,_0x2ed0ef['activateTab'](_0x17aeb6);}var rh=class extends _0x2d31d9{execute(_0x3886c4){switch(this['_expandSelectionIfCollapsed'](),_0x3886c4['type']){case'chat':if(!this['editor']['plugins']['has']('AIChat')){const _0x2dea2a=Es(this['editor']['locale'],'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND','AIChat');throw new ct('ai-quick-actions-plugin-not-found',this['editor'],{'errorMessage':_0x2dea2a});}this['_handleAIChatAction'](_0x3886c4);break;case'action':if(!this['editor']['plugins']['has']('AIActions')){const _0x54f95f=Es(this['editor']['locale'],'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND','AIActions');throw new ct('ai-quick-actions-plugin-not-found',this['editor'],{'errorMessage':_0x54f95f});}this['_handleAIActionsAction'](_0x3886c4);}}async _handleAIChatAction(_0x184159){const _0x48fa5b=this['editor']['plugins']['get']('AIChatController');if(nh(this['editor'],'chat'),'ask-ai'===_0x184159['id'])_0x48fa5b['removeSelectionFromChatContext'](),_0x48fa5b['addSelectionToChatContext'](this['editor']),_0x48fa5b['focusPromptInput']();else await _0x48fa5b['startConversation']({'modelId':_0x184159['model'],'contexts':this['_resolveActionContexts'](_0x184159)}),_0x48fa5b['removeSelectionFromChatContext'](),_0x48fa5b['addSelectionToChatContext'](this['editor']),_0x48fa5b['focusPromptInput'](),await _0x48fa5b['sendMessage']({'message':_0x184159['prompt']||_0x184159['displayedPrompt']||_0x184159['label'],'attributes':{'quickActionData':{'id':_0x184159['id']},'displayedPrompt':_0x184159['displayedPrompt']}});}_expandSelectionIfCollapsed(){const _0x1e56b5=this['editor'],_0x436154=_0x1e56b5['model']['document']['selection'];if(!_0x436154['isCollapsed'])return;const _0x70021b=mt(_0x436154['getSelectedBlocks']())||_0x1e56b5['model']['schema']['getLimitElement'](_0x436154);_0x1e56b5['model']['change'](_0x1cab26=>{_0x1cab26['setSelection'](_0x70021b,'in');});}_handleAIActionsActionLabel(_0x26aceb){return _0x26aceb['parent']?.['label']&&'other'!==_0x26aceb['parent']?.['id']?_0x26aceb['parent']['label']+':\x20'+_0x26aceb['label']:_0x26aceb['label'];}async _handleAIActionsAction(_0x266caf){const _0x292857=this['editor']['plugins']['get']('AIActions'),_0x290164=this['_resolveActionContexts'](_0x266caf);let _0x9b6fa1;_0x9b6fa1=_0x266caf['prompt']?{'userMessage':_0x266caf['prompt'],'model':_0x266caf['model'],'contexts':_0x290164}:_0x266caf['context']?{'model':_0x266caf['model'],'contexts':_0x290164}:{'actionName':_0x266caf['actionName']||_0x266caf['id'],'args':_0x266caf['args'],'contexts':_0x290164};const _0x3dc324=this['_handleAIActionsActionLabel'](_0x266caf);await _0x292857['executeAction'](_0x9b6fa1,_0x3dc324,_0x266caf['icon']);}_resolveActionContexts(_0xcdbe7d){const _0x294c37=_0xcdbe7d['parent']?.['id']?[_0xcdbe7d['id'],_0xcdbe7d['parent']['id']]:[_0xcdbe7d['id']];return this['editor']['plugins']['get'](fs)['contextLibrary']['resolveContext']({'feature':'quickActions','ids':_0x294c37,'extraContexts':_0xcdbe7d['context']?[_0xcdbe7d['context']]:[],'context':new Yn()})['refs'];}},oh=class extends _0x19488e{static get['pluginName'](){return'AIQuickActionsEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const _0x1a9436=this['editor'],_0x3cfba0=new rh(this['editor']);if(_0x1a9436['commands']['add']('aiQuickAction',_0x3cfba0),_0x1a9436['plugins']['has']('AIChat')){const _0x9189d3=this['editor']['plugins']['get']('AIChatController');_0x1a9436['model']['document']['selection']['on']('change:range',(_0x30bf56,_0x345580)=>{_0x345580['directChange']&&_0x9189d3['removeSelectionFromChatContext']();});}}},ah=class extends Vn{appendContent(_0x154fff,_0x4e581='text'){'modification'===this['type']&&'text'===_0x4e581&&(_0x4e581=this['documentContextContent']['keys']()['next']()['value']),super['appendContent'](_0x154fff,_0x4e581);}updateChangeGroups(_0x1609a3){const _0x15e173=this['parsedContent']['get'](_0x1609a3)['cloneNode'](!0x0);if(this['parsedMergedContent']['set'](_0x1609a3,_0x15e173),this['changeGroups']=[],0x0==_0x15e173['childNodes']['length'])return;on(this['documentContextContent']['get'](_0x1609a3),this['parsedMergedContent']['get'](_0x1609a3));const _0x3372c9=_0x285f11(this['documentContextContent']['get'](_0x1609a3)['children']['map'](_0x2f1137=>({'node':_0x2f1137,'id':Ps(_0x2f1137,'data-id')})),_0x15e173['children']['map'](_0x4f4b09=>({'node':_0x4f4b09,'id':Ps(_0x4f4b09,'data-id')||kt()})),{'comparator':(_0x9a94b4,_0x3db289)=>_0x9a94b4['id']==_0x3db289['id'],'oneChangePerToken':!0x0});if(!this['isDone']||!this['isComplete']){for(;_0x3372c9['length']&&_0x3372c9[_0x3372c9['length']-0x1]['removed'];)_0x3372c9['pop']();}const _0x56d6b1=_0x3372c9['map'](_0x5486ee=>{const _0x275a32=_0x5486ee['added']?'new':_0x5486ee['removed']?'removed':'modified';return{'node':_0x5486ee['value'][0x0]['node'],'type':_0x275a32,'id':_0x5486ee['value'][0x0]['id']};}),_0x3947fb=this['_documentIdToSource']['get'](_0x1609a3);this['changeGroups']['push']({'changes':_0x56d6b1,'state':'pending','index':this['changeGroups']['length'],'editor':_0x3947fb['editor'],'rootName':_0x3947fb['rootName'],'documentId':_0x1609a3});}_getDifferentChangeGroups(_0x5a5e95,_0xcaef96){return _0xcaef96;}},hh=class extends Fn{content;['version'];editor;rootName;actionName;['args'];['userMessage'];['model'];contexts;['hasError']=!0x1;stoppedExplicitly=!0x1;constructor(_0x1ffdcb){super(_0x1ffdcb),this['content']=_0x1ffdcb['content'],this['version']=_0x1ffdcb['version'],this['editor']=_0x1ffdcb['editor'],this['rootName']=_0x1ffdcb['rootName'],this['actionName']=_0x1ffdcb['actionName'],this['args']=_0x1ffdcb['args'],this['userMessage']=_0x1ffdcb['userMessage'],this['model']=_0x1ffdcb['model'],this['contexts']=_0x1ffdcb['contexts'],this['on']('interactionStopped',()=>{this['stoppedExplicitly']=!0x0;});}sendRequest(){return this['actionName']?this['connector']['executeAction']({'content':this['content'],'actionName':this['actionName'],'args':this['args'],'contexts':this['contexts']}):this['connector']['executeCustomAction']({'content':this['content'],'message':this['userMessage'],'model':this['model'],'outputFormat':'html','contexts':this['contexts']});}getDocumentContext(){return{'type':'document','documents':[{'id':this['id'],'content':this['content'],'version':this['version'],'rootName':this['rootName'],'sessionId':kt(),'channelId':this['editor']['config']['get']('collaboration.channelId'),'selectionSignature':''}],'label':'Current\x20document','uiId':'current-document'};}createReply(_0x1e5be7){const _0x1f4ba7=this['editor']['config']['get']('collaboration.channelId'),_0x310663=new ah({..._0x1e5be7,'locale':this['locale'],'documentContextContent':[{'id':this['id'],'content':this['content'],'channelId':_0x1f4ba7,'rootName':this['rootName']}],'channelsToEditors':new Map([[_0x1f4ba7,this['editor']]])});return this['replies']['push'](_0x310663),_0x310663['delegate'](...Gn)['to'](this),this['fire']('replyCreated',_0x310663),_0x310663;}},ch=class extends _0x24660c{constructor(_0x180b8f,_0x1b4324=!0x0,_0x3e1500=!0x0){super(_0x180b8f),this['set']('isEnabled',!0x1),_0x1b4324&&(this['applyButton']=this['_createButton'](Es(_0x180b8f,'AI_BALLOON_APPLY_BUTTON'),Ln),this['applyButton']['bind']('isEnabled')['to'](this),this['items']['add'](this['applyButton'])),_0x3e1500&&(this['suggestButton']=this['_createButton'](Es(_0x180b8f,'AI_BALLOON_SUGGEST_BUTTON'),_0x1b4324?Pn:Ln),this['suggestButton']['bind']('isEnabled')['to'](this),this['items']['add'](this['suggestButton'])),this['setButtonsVisibility']({'showApplyButton':_0x1b4324,'showSuggestButton':_0x3e1500}),this['extendTemplate']({'attributes':{'class':['ck-ai-balloon__toolbar']}});}setButtonsVisibility({showApplyButton:_0x2d54b8,showSuggestButton:_0x3a07e9}){this['applyButton']&&(this['applyButton']['isVisible']=_0x2d54b8),this['suggestButton']&&(this['suggestButton']['isVisible']=_0x3a07e9);}_createButton(_0x20f004,_0x468246){const _0x38c1d6=new Mt(this['locale']);return _0x38c1d6['set']({'label':_0x20f004,'class':_0x468246,'isVisible':!0x0,'withText':!0x0}),_0x38c1d6;}},lh=class extends _0x4ff2da{constructor(_0x2357c9){super(_0x2357c9),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-balloon__disclaimer']},'children':[{'tag':'p','attributes':{'class':['ck','ck-ai-balloon__disclaimer-content']},'children':[{'text':Es(_0x2357c9,'AI_DISCLAIMER_TEXT')}]}]});}},uh=class extends _0x4ff2da{constructor(_0x2dae1e){super(_0x2dae1e),this['set']('isVisible',!0x0);const _0x26ed9b=new Dr('small');_0x26ed9b['isVisible']=!0x0;const _0x34b9a4=new _0x4ff2da(this['locale']);_0x34b9a4['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__loader-text']},'children':[Es(this['locale'],'AI_CHAT_IS_WRITING')]}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__loader',this['bindTemplate']['if']('isVisible','ck-hidden',_0x5813df=>!_0x5813df)]},'children':[_0x26ed9b,_0x34b9a4]});}},dh=class extends Ma{['focusCycler'];['_config'];_contentWrapper;_streamableContentView;_toolbarView;['_miniToolbarView'];['_loaderView'];['_disclaimerView'];['_focusTracker'];_keystrokes;_dialogContent;['_focusables'];['_scrollManager'];['_miniToolbarResizeObserver'];_navigationPreviousButton;_navigationNextButton;_navigationTryAgainButton;_navigationCounter;constructor(_0x1e15ce,_0x197b55){super(_0x1e15ce),this['set']('isBusy',!0x1),this['set']('isTargetReadOnly',!0x1),this['set']('isTrackChangesOn',!0x1),this['set']('_isLoading',!0x1),this['set']('_hasError',!0x1),this['_config']=_0x197b55,this['_focusTracker']=new _t(),this['_keystrokes']=new gt(),this['_focusables']=this['createCollection'](),this['focusCycler']=new Ft({'focusables':this['_focusables'],'focusTracker':this['_focusTracker'],'keystrokeHandler':this['_keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}),this['_dialogContent']=new _0x50bc02(),this['_addContentWrapper'](_0x197b55),this['_addDisclaimerView'](),this['_addToolbar'](_0x197b55),this['_focusables']['clear'](),this['_focusables']['addMany']([this['_toolbarView']]),this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-actions-balloon-main']},'children':this['_dialogContent']}),this['on']('change:isTrackChangesOn',()=>{this['_toggleToolbarButtonsVisibility'](_0x197b55);}),this['on']('render',()=>{this['_setupMiniToolbarPositioning']();});}['render'](){super['render']();for(const _0x399aa0 of this['_focusables'])this['_focusTracker']['add'](_0x399aa0['element']);this['_keystrokes']['listenTo'](this['element']),this['_initializeScrollManager']();}destroy(){super['destroy'](),this['_scrollManager']&&this['_scrollManager']['destroy'](),this['_miniToolbarResizeObserver']&&this['_miniToolbarResizeObserver']['destroy']();}['focus'](_0x13e146){-0x1===_0x13e146?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}setIsLoading(_0x27785e){this['_isLoading']=_0x27785e;}setErrorState(){this['_hasError']=!0x0,this['_miniToolbarView']['toggleShowChangesEnabled'](!0x1);}clearErrorState(){this['_hasError']=!0x1,this['_miniToolbarView']['toggleShowChangesEnabled'](!0x0);}['showError'](_0x1fe979){super['showError'](_0x1fe979),this['_dialogContent']['has'](this['_errorView'])||this['_dialogContent']['add'](this['_errorView'],0x0);}['hideError'](){super['hideError'](),this['clearErrorState']();}['showBlockingError'](_0x222185){super['showBlockingError'](_0x222185),this['setErrorState']();}addMiniToolbarItem(_0x3353d2){this['_miniToolbarView']['items']['has'](_0x3353d2)||this['_miniToolbarView']['items']['add'](_0x3353d2);}removeMiniToolbarItem(_0x434dd2){this['_miniToolbarView']['items']['has'](_0x434dd2)&&this['_miniToolbarView']['items']['remove'](_0x434dd2);}['showLoader'](){this['_loaderView']&&(this['_isLoading']=!0x0);}['hideLoader'](){this['_loaderView']&&(this['_isLoading']=!0x1);}_toggleToolbarButtonsVisibility({showApplyButton:_0x88f90f,showSuggestButton:_0x9be7e5}){_0x88f90f=_0x88f90f&&!this['isTrackChangesOn']&&this['_config']['availableActions']['includes']('applySuggestion'),_0x9be7e5=_0x9be7e5&&this['_config']['availableActions']['includes']('insertSuggestion'),this['_toolbarView']['setButtonsVisibility']({'showApplyButton':_0x88f90f,'showSuggestButton':_0x9be7e5});}async updateContent(_0x4fa827){await this['_streamableContentView']['update'](_0x4fa827);}finalizeContent(){this['_streamableContentView']['cleanUpStreamingArtifacts']();}clearContent(){this['_streamableContentView']['clear']();}_addContentWrapper(_0x2b8cf1){this['_contentWrapper']=new _0x4ff2da(this['locale']),this['_contentWrapper']['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-actions-balloon-content',this['bindTemplate']['if']('_isErrorVisible','ck-hidden')]},'children':[{'tag':'div','attributes':{'class':['ck-ai-actions-balloon-content-wrapper']},'children':[this['_createLoaderView'](),this['_createStreamableContentView']()]},this['_createMiniToolbar'](_0x2b8cf1['miniToolbarConfig'])]}),this['_dialogContent']['add'](this['_contentWrapper']);}['_addDisclaimerView'](){this['_disclaimerView']=new lh(this['locale']),this['_dialogContent']['add'](this['_disclaimerView']);}['_addToolbar']({showApplyButton:_0x42bc9e,showSuggestButton:_0x1d81e5}){this['_toolbarView']=new ch(this['locale'],_0x42bc9e,_0x1d81e5),this['_toolbarView']['applyButton']?.['on']('execute',()=>{this['fire']('applySuggestion');}),this['_toolbarView']['suggestButton']?.['on']('execute',()=>{this['fire']('insertSuggestion');}),this['_toolbarView']['bind']('isEnabled')['to'](this,'isBusy',this,'_isLoading',this,'_hasError',this,'isTargetReadOnly',(_0x4254e5,_0x16e3e9,_0x2cc9a3,_0x28a99f)=>!(_0x4254e5||_0x16e3e9||_0x2cc9a3||_0x28a99f)),this['_toggleToolbarButtonsVisibility']({'showApplyButton':_0x42bc9e,'showSuggestButton':_0x1d81e5}),this['_dialogContent']['add'](this['_toolbarView']);}_createMiniToolbar(_0x4829f4){return this['_miniToolbarView']=new Ba(this['locale'],_0x4829f4),this['_miniToolbarView']['delegate'](...ir)['to'](this),this['_miniToolbarView']['on']('toggleShowChanges',()=>{this['_miniToolbarView']['isShowChangesOn']=!this['_miniToolbarView']['isShowChangesOn'],this['fire']('toggleSuggestionDisplayMode',{'showDiff':this['_miniToolbarView']['isShowChangesOn']});}),this['_miniToolbarView']['bind']('isEnabled')['to'](this,'isBusy',this,'_isLoading',(_0x108c8c,_0x244184)=>!(_0x108c8c||_0x244184)),this['_miniToolbarView'];}_createLoaderView(){return this['_loaderView']=new uh(this['locale']),this['_loaderView']['bind']('isVisible')['to'](this,'_isLoading'),this['_loaderView'];}_createStreamableContentView(){return this['_streamableContentView']=new mr(this['locale']),this['_streamableContentView'];}_setupMiniToolbarButtons(){const _0x17b1b8=new Mt(this['locale']),_0x1c4684=new Mt(this['locale']),_0xd1020c=new _h(this['locale']),_0x5a45cb=new Mt(this['locale']);_0x17b1b8['set']({'icon':_0x1de2fd,'label':Es(this['locale'],'AI_ACTIONS_TRY_AGAIN'),'tooltip':!0x0,'class':'ck-ai-custom-action-button\x20'+Dn}),_0x1c4684['set']({'icon':_0x202389,'tooltip':Es(this['locale'],'AI_ACTIONS_PREVIOUS_INTERACTION'),'class':'ck-ai-navigation-button\x20ck-ai-previous-button\x20'+Dn}),_0x5a45cb['set']({'icon':_0x4cec77,'tooltip':Es(this['locale'],'AI_ACTIONS_NEXT_INTERACTION'),'class':'ck-ai-navigation-button\x20ck-ai-next-button\x20'+Dn}),_0x17b1b8['bind']('isEnabled')['to'](this,'isBusy',_0x3dec32=>!_0x3dec32),_0x17b1b8['on']('execute',()=>{this['fire']('tryAgain');}),_0x1c4684['bind']('isEnabled')['to'](this,'isBusy',_0x379f8f=>!_0x379f8f),_0x1c4684['on']('execute',()=>{this['fire']('showPrevious');}),_0x5a45cb['bind']('isEnabled')['to'](this,'isBusy',_0x1da24c=>!_0x1da24c),_0x5a45cb['on']('execute',()=>{this['fire']('showNext');}),this['_navigationPreviousButton']=_0x1c4684,this['_navigationCounter']=_0xd1020c,this['_navigationNextButton']=_0x5a45cb,this['_navigationTryAgainButton']=_0x17b1b8;}updateMiniToolbarButtons(_0x974a50,_0x34383b){this['_navigationPreviousButton']||this['_setupMiniToolbarButtons']();const _0x37d534=_0x974a50>0x1;if(this['addMiniToolbarItem'](this['_navigationTryAgainButton']),_0x37d534){this['addMiniToolbarItem'](this['_navigationPreviousButton']),this['addMiniToolbarItem'](this['_navigationCounter']),this['addMiniToolbarItem'](this['_navigationNextButton']);const _0x4a96ad=_0x974a50-_0x34383b;this['_navigationCounter']['setInteractionCount'](_0x4a96ad+'/'+_0x974a50),this['_navigationPreviousButton']['isEnabled']=_0x34383b<_0x974a50-0x1,this['_navigationNextButton']['isEnabled']=_0x34383b>0x0;}else this['removeMiniToolbarItem'](this['_navigationPreviousButton']),this['removeMiniToolbarItem'](this['_navigationCounter']),this['removeMiniToolbarItem'](this['_navigationNextButton']);}disableMiniToolbarButtons(){this['_navigationTryAgainButton']['isEnabled']=!0x1,this['_navigationPreviousButton']['isEnabled']=!0x1,this['_navigationNextButton']['isEnabled']=!0x1;}startAutoScroll(){this['_initializeScrollManager'](),this['_scrollManager']&&this['_scrollManager']['start']();}stopAutoScroll(){this['_scrollManager']&&this['_scrollManager']['stop']();}toggleIsLoading(_0xa56728){this['_isLoading']=_0xa56728;}resetShowChangesButton(){this['_miniToolbarView']['isShowChangesOn']=!0x1;}_setupMiniToolbarPositioning(){const _0x557e27=this['_streamableContentView']['element'],_0x359adf=this['_miniToolbarView']['element'],_0x54f812=()=>{wt['window']['requestAnimationFrame'](()=>{const _0x5bacbf=_0x557e27['offsetWidth']-_0x557e27['clientWidth'];_0x359adf['style']['right']='calc('+_0x5bacbf+'px\x20+\x20var(--ck-spacing-large))';});};_0x54f812(),this['_miniToolbarResizeObserver']=new pt(_0x557e27,()=>{_0x54f812();});}_initializeScrollManager(){const _0x306ed2=this['_getScrollableElement']();_0x306ed2&&!this['_scrollManager']&&(this['_scrollManager']=new ao(_0x306ed2));}_getScrollableElement(){return this['_streamableContentView']['element'];}},_h=class extends _0x4ff2da{constructor(_0x3d344a){super(_0x3d344a);const _0xc324e8=this['bindTemplate'];this['set']('interactionCount','1/1'),this['setTemplate']({'tag':'span','attributes':{'class':['ck-ai-interaction-counter']},'children':[{'text':_0xc324e8['to']('interactionCount')}]});}setInteractionCount(_0x19e3b4){this['set']('interactionCount',_0x19e3b4);}},gh=class extends _0x19488e{static get requires(){return[Is,Nn,Ut,tn,Va,_0x5388eb];}static get['pluginName'](){return'AIActions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}_aiConnector;_interactions=[];_currentInteractionIndex=0x0;_interactionParams;['_balloonShowDiff']=!0x1;['_promiseQueue'];get _interaction(){return this['_interactions'][this['_interactions']['length']-0x1];}_actionsBalloonView;_reporter;constructor(_0x264ea5){super(_0x264ea5),this['_aiConnector']=this['editor']['plugins']['get']('AIConnector'),this['_reporter']=this['editor']['plugins']['get'](Nn)['createReporter']('aiactions'),this['set']('isBusy',!0x1),this['_promiseQueue']=new Sr();}stopInteraction(){this['_stopInteraction']();}async executeAction(_0x29a0b5,_0x12e06c,_0x4445cf){if(this['_stopInteraction'](),this['editor']['plugins']['has']('TableSelection')&&this['editor']['plugins']['get']('TableSelection')['getSelectedTableCells']()){const {modelFragment:_0xfaffd6,anchorData:_0x7b9a14,root:_0x2b7386}=this['_getExecuteDataInTable']();return this['_executeAction'](_0x29a0b5,_0xfaffd6,_0x7b9a14,_0x2b7386,_0x12e06c,_0x4445cf);}const {modelFragment:_0x1714b9,anchorData:_0x204c68,root:_0x2504f1}=this['_getExecuteDataRegular']();return this['_executeAction'](_0x29a0b5,_0x1714b9,_0x204c68,_0x2504f1,_0x12e06c,_0x4445cf);}async destroy(){return this['_stopInteraction'](),super['destroy']();}_createActionsBalloonView(){const _0x2b0920=this['editor']['plugins']['has']('TrackChanges');let _0x56ab8c=this['editor']['config']['get']('ai.availableReplyActions')||[...Or];_0x2b0920||(_0x56ab8c=_0x56ab8c['filter'](_0xd1a89a=>'insertSuggestion'!=_0xd1a89a));const _0x153568=this['editor']['commands']['get']('trackChanges'),_0x4760f3=new dh(this['editor']['locale'],{'showApplyButton':!0x0,'showSuggestButton':_0x2b0920,'miniToolbarConfig':{'showChanges':'icon'},'availableActions':_0x56ab8c});return _0x4760f3['bind']('isBusy')['to'](this),_0x4760f3['bind']('isTargetReadOnly')['to'](this['editor'],'isReadOnly'),_0x153568&&_0x4760f3['bind']('isTrackChangesOn')['to'](_0x153568,'value'),_0x4760f3['on']('tryAgain',()=>{this['_refreshInteraction']();}),_0x4760f3['on']('showPrevious',()=>{this['_navigateToPrevious']();}),_0x4760f3['on']('showNext',()=>{this['_navigateToNext']();}),_0x4760f3;}_normalizeSelectionStart(){const _0x35c720=this['editor']['model'],_0x110fa0=_0x35c720['document']['selection'],_0x4c6874=_0x110fa0['getFirstRange']();if(!_0x4c6874||_0x4c6874['isCollapsed'])return;const _0x4a4848=mt(_0x110fa0['getSelectedBlocks']());if(!_0x4a4848)return;const _0x2a275c=_0x35c720['createPositionAt'](_0x4a4848,0x0);_0x2a275c['isAfter'](_0x4c6874['start'])&&_0x35c720['change'](_0xd22507=>{_0xd22507['setSelection'](_0xd22507['createRange'](_0x2a275c,_0x4c6874['end']));});}_getExecuteDataRegular(){const _0xafe90c=this['editor']['model']['document']['selection'],_0x4dd915=_0xafe90c['getFirstRange']()['start']['root'];if(_0xafe90c['isCollapsed']){const _0x438eb9=mt(_0xafe90c['getSelectedBlocks']())||this['editor']['model']['schema']['getLimitElement'](_0xafe90c);this['editor']['model']['change'](_0x55985b=>{_0x55985b['setSelection'](_0x438eb9,'in');});}this['_normalizeSelectionStart']();const _0x12284d=_0xafe90c['getFirstRange'](),_0x4d4641=this['_wrapWithCommonAncestors'](this['editor']['model']['getSelectedContent'](_0xafe90c),_0x12284d['start'],_0x12284d['end']);this['_copyMarkersToFragment'](_0x4d4641,_0xafe90c,{'isTableSelection':!0x1});const _0x2da9a0=_0xafe90c['getFirstRange']()['start'],_0x2ce2db=new Map();let _0x18ef1d=_0x4d4641;for(let _0x296f2f=0x0;_0x296f2f<_0x2da9a0['path']['length'];_0x296f2f++)_0x2ce2db['set'](_0x18ef1d,_0x2da9a0['path'][_0x296f2f]),_0x18ef1d=_0x18ef1d['getChild'](0x0);return{'modelFragment':_0x4d4641,'anchorData':_0x2ce2db,'root':_0x4dd915};}_getExecuteDataInTable(){const _0x59f3a4=this['editor']['model']['document']['selection'],_0x480629=this['editor']['plugins']['get']('TableSelection'),_0x4c4733=_0x59f3a4['getFirstRange']()['start']['root'],_0x82ca7a=_0x480629['getSelectionAsFragment'](),_0x6c7901=_0x59f3a4['getFirstRange']()['start']['parent']['parent'],_0x5495f7=this['editor']['model']['createRange'](this['editor']['model']['createPositionBefore'](_0x6c7901),this['editor']['model']['createPositionAfter'](_0x6c7901)),_0x5b7576=this['_wrapWithCommonAncestors'](_0x82ca7a,_0x5495f7['start'],_0x5495f7['end']);this['_copyMarkersToFragment'](_0x5b7576,_0x59f3a4,{'isTableSelection':!0x0});const _0x3ee594=_0x59f3a4['getFirstRange']()['start'],_0xeee3c3=new Map();let _0x75e050=_0x5b7576;for(let _0x396b0f=0x0;_0x396b0f<_0x3ee594['path']['length'];_0x396b0f++)if(_0xeee3c3['set'](_0x75e050,_0x3ee594['path'][_0x396b0f]),_0x396b0f<_0x3ee594['path']['length']-0x1)_0x75e050=_0x75e050['getChild'](0x0);else{let _0x212fcb=_0x75e050['nextSibling'];for(;_0x212fcb;)_0xeee3c3['set'](_0x212fcb,_0x3ee594['path'][_0x396b0f]),_0x212fcb=_0x212fcb['nextSibling'];}return{'modelFragment':_0x5b7576,'anchorData':_0xeee3c3,'root':_0x4c4733};}async _executeAction(_0x496338,_0x1fb741,_0x397224,_0x475e83,_0x2c877a,_0x585d7c){const _0x2bf472=this['editor']['plugins']['get'](tn),_0x35c8b5=this['editor']['plugins']['get'](Va),_0x24382d=this['editor']['model']['document']['selection'],_0x3454d8=await _0x2bf472['modelToDataWithIds'](_0x1fb741,this['editor'],_0x475e83['rootName']),_0x1b21a8=this['editor']['model']['document']['version'],_0x5c71f5=[..._0x24382d['getRanges']()];return this['_actionsBalloonView']||(this['_actionsBalloonView']=this['_createActionsBalloonView']()),this['_clearInteractionHistory'](),this['_clearErrorState'](),this['_balloonShowDiff']=!0x1,this['_actionsBalloonView']['resetShowChangesButton'](),this['_actionsBalloonView']['clearContent'](),_0x35c8b5['open']({'targetEditor':this['editor'],'index':0x3e8*Math['random']()%0x3e8,'title':_0x2c877a,'icon':_0x585d7c||_0x13034c,'mainView':this['_actionsBalloonView'],'class':'ck-ai-actions-balloon','ranges':_0x5c71f5,'id':'aiActionsBalloon'}),this['_setLoadingState'](),this['stopListening'](this['_actionsBalloonView']),this['stopListening'](_0x35c8b5),this['_interactionParams']={'action':_0x496338,'content':_0x3454d8,'version':_0x1b21a8,'aiBalloon':_0x35c8b5,'modelFragment':_0x1fb741,'anchorData':_0x397224,'root':_0x475e83},this['_setupApplyListeners'](),this['listenTo'](_0x35c8b5,'selectionRemoved',()=>{this['_stopInteraction'](),this['_actionsBalloonView']['disableMiniToolbarButtons']();}),this['listenTo'](_0x35c8b5,'dialogClosed',(_0x1fbdff,{id:_0x202318})=>{if('aiActionsBalloon'===_0x202318){for(const _0x153196 of this['_interactions']){if(0x0===_0x153196['replies']['length']||_0x153196['stoppedExplicitly'])continue;const _0x996862=_0x153196['replies'][_0x153196['replies']['length']-0x1],_0x51d5e7=_0x996862['changeGroups'][0x0];_0x51d5e7&&'pending'===_0x51d5e7['state']&&_0x996862['setChangeGroupState'](0x0,'rejected');}this['_stopInteraction'](),this['_clearInteractionHistory'](),this['stopListening'](this['_actionsBalloonView']),this['stopListening'](_0x35c8b5);}}),this['_createInteraction'](_0x3454d8,_0x1b21a8,_0x35c8b5,_0x496338);}_setupApplyListeners(){if(!this['_interactionParams'])return;const {modelFragment:_0xe52b9e,anchorData:_0x1874de,root:_0x3b6154}=this['_interactionParams'];this['listenTo'](this['_actionsBalloonView'],'applySuggestion',()=>{this['_applyChanges'](_0xe52b9e,_0x1874de,_0x3b6154,!0x1);}),this['listenTo'](this['_actionsBalloonView'],'insertSuggestion',()=>{this['_applyChanges'](_0xe52b9e,_0x1874de,_0x3b6154,!0x0);});}_wrapWithCommonAncestors(_0xc8bce7,_0x300e0f,_0x984271){const _0x19ddb1=this['editor']['model']['createRange'](_0x300e0f,_0x984271)['getCommonAncestor'](),_0x417540=_0x19ddb1['is']('documentFragment')?[]:_0x19ddb1['getAncestors']({'includeSelf':!0x0})['slice'](0x1);if(_0x417540['length']){const _0x1e067b=_0x417540['map'](_0x1c7a7c=>_0x1c7a7c['_clone'](!0x1));for(let _0x238bab=0x1;_0x238bab<_0x1e067b['length'];_0x238bab++)_0x1e067b[_0x238bab-0x1]['_appendChild'](_0x1e067b[_0x238bab]);return _0x1e067b[_0x1e067b['length']-0x1]['_appendChild'](_0xc8bce7),new _0x5eb9f7(_0x1e067b[0x0]);}return _0xc8bce7;}_copyMarkersToFragment(_0x1f3f66,_0x6342fe,_0x2e76b0={'isTableSelection':!0x1}){const _0x599917=this['editor']['model'],_0x2406e0=Array['from'](_0x6342fe['getRanges']()),_0x47e218=_0x6342fe['getFirstRange']()['start'];for(const _0x6518f5 of _0x599917['markers']){if(_0x6518f5['name']['startsWith']('ai-selection')||!_0x6518f5['affectsData'])continue;const _0x7f564f=_0x6518f5['getRange']();if(!_0x2406e0['some'](_0x51d46b=>_0x51d46b['containsRange'](_0x7f564f,!0x0)))continue;const _0x9884d2=this['_regularCalculateMarkerPath'](_0x7f564f['start'],_0x47e218,_0x2e76b0['isTableSelection']),_0x425287=this['_regularCalculateMarkerPath'](_0x7f564f['end'],_0x47e218,_0x2e76b0['isTableSelection']),_0x1c60d2=_0x599917['createPositionFromPath'](_0x1f3f66,_0x9884d2),_0x4013d1=_0x599917['createPositionFromPath'](_0x1f3f66,_0x425287);if(!_0x1c60d2['isEqual'](_0x4013d1)){const _0x7a02fd=_0x599917['createRange'](_0x1c60d2,_0x4013d1);_0x1f3f66['markers']['set'](_0x6518f5['name'],_0x7a02fd);}}}_regularCalculateMarkerPath(_0x20458,_0xd616c8,_0x5e8cfa=!0x1){const _0x2d9408=[..._0x20458['path']['slice']()];for(let _0x5e77d4=0x0;_0x5e77d4<Math['max'](_0xd616c8['path']['length'],_0x20458['path']['length']);_0x5e77d4++){const _0x1198fe=_0xd616c8['path'][_0x5e77d4]||0x0,_0x15def9=(_0x20458['path'][_0x5e77d4]||0x0)-_0x1198fe;if(_0x2d9408[_0x5e77d4]=_0x15def9,0x0!==_0x15def9&&!_0x5e8cfa)break;}return _0x2d9408;}async _createInteraction(_0x152551,_0x4de9ab,_0x3479a7,_0xabed0d){const _0x28fe67=this['editor'],_0x421604=_0x28fe67['model']['document']['selection']['getFirstRange']()['start']['root'];this['_interactionParams']||(this['_interactionParams']={'action':_0xabed0d,'content':_0x152551,'version':_0x4de9ab,'aiBalloon':_0x3479a7,'modelFragment':this['editor']['model']['getSelectedContent'](this['editor']['model']['document']['selection']),'anchorData':new Map(),'root':_0x421604});const _0x4a2cd8=new hh({'connector':this['_aiConnector'],'locale':_0x28fe67['locale'],'content':_0x152551,'version':_0x4de9ab,'editor':_0x28fe67,'rootName':_0x421604['rootName'],..._0xabed0d});this['_interactions']['push'](_0x4a2cd8);const _0x2fbe23=(_0x396360,_0x253194=!0x1,_0x20e050='streaming')=>{const {isDone:_0x475d7d}=_0x396360;return this['_promiseQueue']['enqueue'](async _0x30fb98=>{try{if(this['_isUnsupportedInlineRootChange'](_0x396360,_0x421604))return this['_actionsBalloonView']['showBlockingError'](Es(_0x28fe67['locale'],'AI_SUGGESTION_NO_PARTS_WARNING')),void(_0x475d7d&&this['_actionsBalloonView']['finalizeContent']());const _0x3aa63b=ln({'changeGroups':_0x396360['changeGroups'],'documentContextContent':_0x396360['documentContextContent'],'showDiff':_0x253194,'trimUnchanged':!0x1});_0x3aa63b['length']&&await this['_actionsBalloonView']['updateContent']({'part':_0x3aa63b[0x0],'renderingStrategy':_0x20e050,'abortSignal':_0x30fb98}),_0x475d7d&&this['_actionsBalloonView']['finalizeContent']();}catch(_0x35e57a){if(kn(_0x35e57a))return;throw _0x35e57a;}});};_0x4a2cd8['on']('replyCreated',(_0x5bce37,_0x5d4e81)=>{this['_actionsBalloonView']['hideLoader'](),this['_actionsBalloonView']['startAutoScroll'](),_0x2fbe23(_0x5d4e81)['catch'](_0x557c75=>{this['_reporter']['logError'](_0x557c75,{'context':{'operation':'reply-create'}}),this['_setErrorState'](_0x4a2cd8,_0x557c75);});}),_0x4a2cd8['on']('replyContentUpdated',(_0x1afea9,_0x48831f)=>{_0x2fbe23(_0x48831f)['catch'](_0x1c2038=>{this['_reporter']['logError'](_0x1c2038,{'context':{'operation':'reply-update'}}),this['_setErrorState'](_0x4a2cd8,_0x1c2038);});}),_0x4a2cd8['on']('interactionFinished',async()=>{try{await this['_clearLoadingState'](),this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']),await this['_promiseQueue']['queueEmptyPromise'];}catch(_0x32c0f2){this['_reporter']['logError'](_0x32c0f2,{'context':{'operation':'interaction-finish'}}),this['_setErrorState'](_0x4a2cd8,_0x32c0f2);}finally{this['_actionsBalloonView']['stopAutoScroll']();}}),this['listenTo'](this['_actionsBalloonView'],'toggleSuggestionDisplayMode',async(_0x1f18d2,{showDiff:_0x1219bb})=>{try{this['_balloonShowDiff']=_0x1219bb;const _0xc7632=this['_interaction']['replies'][this['_interaction']['replies']['length']-0x1];_0xc7632&&await _0x2fbe23(_0xc7632,_0x1219bb,'static');}catch(_0x3b68d3){this['_reporter']['logError'](_0x3b68d3,{'context':{'operation':'toggle-suggestion-display'}}),this['_setErrorState'](_0x4a2cd8,_0x3b68d3);}}),_0x4a2cd8['on']('replyChangeGroupStateUpdated',()=>{const _0x10006b={'positiveCount':_0x4a2cd8['replies']['reduce']((_0x1ef6ee,_0x3e77c3)=>_0x1ef6ee+_0x3e77c3['changeGroups']['filter'](_0x1de771=>'accepted'===_0x1de771['state'])['length'],0x0),'totalCount':_0x4a2cd8['replies']['reduce']((_0x37be35,_0x546ce7)=>_0x37be35+_0x546ce7['changeGroups']['length'],0x0)},_0x482080=_0x4a2cd8['actionCallId'],_0x2cd47d=_0x4a2cd8['actionName'];_0x2cd47d?this['_aiConnector']['upsertAIActionRating'](_0x2cd47d,_0x482080,_0x10006b):this['_aiConnector']['upsertCustomAIActionRating'](_0x482080,_0x10006b);}),this['_setLoadingState']();try{const _0x117c86=await _0x4a2cd8['start']();return this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']),_0x117c86;}catch(_0x1891c3){kn(_0x1891c3)||this['_actionsBalloonView']['hideLoader'](),this['_reporter']['logError'](_0x1891c3,{'context':{'operation':'create-interaction'}}),this['_setErrorState'](_0x4a2cd8,_0x1891c3);}}_isUnsupportedInlineRootChange(_0x297b3d,_0x4dbf4d){const _0x275c06=this['editor'];return!!Gs(_0x275c06,_0x4dbf4d['rootName'])&&!Ys(_0x275c06,new _0x35605c((_0x297b3d['changeGroups'][0x0]?.['changes']??[])['filter'](_0x801b0f=>'removed'!==_0x801b0f['type'])['map'](_0x3f8e18=>_0x3f8e18['node']['cloneNode'](!0x0))));}['_applyChanges'](_0x471f0c,_0x138c45,_0x172a39,_0x4e2893){const _0x5ebd0f=this['editor'];if(_0x4e2893&&!_0x5ebd0f['plugins']['has']('TrackChanges'))throw new ct('ai-no-track-changes',null);const _0x269dee=this['editor']['plugins']['get'](_0x5388eb),_0x5c4a5d=this['_interactions'][this['_interactions']['length']-0x1-this['_currentInteractionIndex']];if(!_0x5c4a5d||!_0x5c4a5d['replies']['length'])return;const _0x24b06f=_0x5c4a5d['replies'][_0x5c4a5d['replies']['length']-0x1];if(this['_isUnsupportedInlineRootChange'](_0x24b06f,_0x172a39))return void this['_actionsBalloonView']['showBlockingError'](Es(_0x5ebd0f['locale'],'AI_SUGGESTION_NO_PARTS_WARNING'));_0x24b06f['setChangeGroupState'](0x0,'accepted');const _0x37907b=Jn({'documentSuggestions':Zn({'groups':[_0x24b06f['changeGroups'][0x0]],'documentContextContent':_0x24b06f['documentContextContent'],'documents':_0x5c4a5d['getDocumentContext']()['documents']}),'transform':!0x1,'documentCompare':_0x269dee,'documentCompareOptions':{'anchor':_0x5ebd0f['model']['createPositionAt'](_0x471f0c,0x0),'markDeletions':_0x4e2893}})['values']()['next']()['value']??[],_0x1a2f65=this['_filterOperationsOutsideRange'](_0x37907b,_0x138c45);for(const _0x444030 of _0x1a2f65)this['_anchorOperation'](_0x138c45,_0x444030,_0x172a39);const _0x3e3ab2=_0x5c4a5d['getDocumentContext']()['documents'][0x0]['version'],_0x5e0bad=_0x3b7a23(_0x1a2f65,_0x5ebd0f['model']['document']['history']['getOperations'](_0x3e3ab2),{'document':_0x5ebd0f['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1})['operationsA'];mn(_0x5e0bad,'quickActions');try{_0x5ebd0f['model']['change'](_0x2bb4bc=>{_0x2bb4bc['setSelection'](_0x5ebd0f['model']['document']['selection']['focus']),_0x4e2893?_0x5ebd0f['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x5e0bad):_0x269dee['applyOperations'](_0x2bb4bc,_0x5e0bad);});}catch(_0x5cee14){throw this['_reporter']['logError'](new yn({'code':'ai-applying-suggestion-failed','type':'runtime','cause':_0x5cee14})),_0x5cee14;}this['editor']['plugins']['get']('AIBalloon')['close']();}_filterOperationsOutsideRange(_0x1b0106,_0x352fc5){return _0x1b0106['filter'](_0x1bcf02=>{if('rename'==_0x1bcf02['type']){const _0x3c3edb=_0x1bcf02['position']['nodeAfter'];return!_0x352fc5['has'](_0x3c3edb);}if(_0x1bcf02['type']['indexOf']('Attribute')>-0x1){const _0xbf72e3=_0x1bcf02['range']['start']['nodeAfter'];return!_0x352fc5['has'](_0xbf72e3);}return!0x0;});}_anchorOperation(_0x3dd2b0,_0x291197,_0x4b7bc4){const _0x80d6b2=_0x291197['clone']();for(const _0x306b15 in _0x291197){const _0x2b742e=_0x291197[_0x306b15];_0x2b742e instanceof _0x2af2ad?_0x291197[_0x306b15]=new _0x2af2ad(_0x30581c(_0x2b742e['start']),_0x30581c(_0x2b742e['end'])):_0x2b742e instanceof _0x53921a&&(_0x291197[_0x306b15]=_0x30581c(_0x2b742e));}if(['insert','move','remove','reinsert','split','merge']['includes'](_0x80d6b2['type'])){if(_0x80d6b2['isDocumentOperation']=!0x1,_0x80d6b2['baseVersion']=null,'remove'==_0x80d6b2['type']){const _0x18441c=_0x80d6b2['sourcePosition'],_0x35e2b6=_0x80d6b2['howMany'];new _0x19e331(_0x18441c,_0x35e2b6)['_execute']();}else _0x80d6b2['_execute']();}function _0x30581c(_0x20db85){if('$graveyard'==_0x20db85['root']['rootName'])return _0x20db85;const _0x5500eb=[];let _0x44a695=_0x20db85['root'];for(let _0x29e905=0x0;_0x29e905<_0x20db85['path']['length'];_0x29e905++){const _0x1029d7=_0x3dd2b0['get'](_0x44a695)||0x0;_0x5500eb[_0x29e905]=_0x20db85['path'][_0x29e905]+_0x1029d7,_0x44a695=_0x44a695['getChildAtOffset'](_0x20db85['path'][_0x29e905]);}return new _0x53921a(_0x4b7bc4,_0x5500eb,_0x20db85['stickiness']);}}_refreshInteraction(){if(!this['_interactionParams'])return;this['_interactions']['length']>0x0&&this['_stopInteraction'](),this['_currentInteractionIndex']=0x0,this['_balloonShowDiff']=!0x1;const {action:_0x37f6f2,content:_0x109d3a,version:_0x25e383,aiBalloon:_0x23030b}=this['_interactionParams'];this['_clearErrorState'](),this['_actionsBalloonView']['clearContent'](),this['_actionsBalloonView']['showLoader'](),this['_actionsBalloonView']['resetShowChangesButton'](),this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']),this['stopListening'](this['_actionsBalloonView']),this['_setupApplyListeners'](),this['_createInteraction'](_0x109d3a,_0x25e383,_0x23030b,_0x37f6f2)['catch'](_0x4014b8=>{this['_reporter']['logError'](_0x4014b8,{'context':{'operation':'refresh-interaction'}});});}_clearInteractionHistory(){this['_interactions']=[],this['_interactionParams']=void 0x0,this['_currentInteractionIndex']=0x0,this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);}_stopInteraction(){this['_interaction']&&this['_interaction']['stop'](),this['_promiseQueue']['abort'](),this['isBusy']=!0x1,this['_interactionParams']&&this['_actionsBalloonView']['stopAutoScroll']();}_navigateToPrevious(){const _0x1d2466=this['_interactions']['length'];this['_currentInteractionIndex']<_0x1d2466-0x1&&this['_displayInteractionAtIndex'](this['_currentInteractionIndex']+0x1);}_navigateToNext(){this['_currentInteractionIndex']>0x0&&this['_displayInteractionAtIndex'](this['_currentInteractionIndex']-0x1);}async _displayInteractionAtIndex(_0x11e668){if(!this['_interactionParams'])return;this['_currentInteractionIndex']=_0x11e668;const _0x36000b=this['_interactions'][this['_interactions']['length']-0x1-this['_currentInteractionIndex']];if(!_0x36000b)return;if(_0x36000b['hasError'])return this['_setErrorState'](_0x36000b),void this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);if(!_0x36000b['replies']['length'])return;this['_actionsBalloonView']['hideError'](),this['_interactionParams']&&this['_clearErrorState']();const _0x3219e2=_0x36000b['replies'][_0x36000b['replies']['length']-0x1];if(_0x3219e2)try{const _0x289a46=ln({'changeGroups':_0x3219e2['changeGroups'],'documentContextContent':_0x3219e2['documentContextContent'],'showDiff':this['_balloonShowDiff'],'trimUnchanged':!0x1});await new Promise(_0x505d53=>setTimeout(_0x505d53,0x32)),await this['_actionsBalloonView']['updateContent']({'part':_0x289a46[0x0],'renderingStrategy':'static','abortSignal':new AbortController()['signal']});}catch(_0x3e2e4d){this['_reporter']['logError'](_0x3e2e4d,{'context':{'operation':'navigation-update'}});}this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);}_setLoadingState(){this['_actionsBalloonView']['setIsLoading'](!0x0),this['isBusy']=!0x0;}async _setErrorState(_0x2bdff9,_0x210cf5){if(void 0x0!==_0x210cf5&&kn(_0x210cf5))return;const _0x275359=Es(this['editor']['locale'],'AI_ACTIONS_GENERIC_ERROR');this['_actionsBalloonView']['showError'](_0x275359),_0x2bdff9['hasError']=!0x0,await this['_promiseQueue']['queueEmptyPromise'],this['_actionsBalloonView']['setErrorState'](),this['_actionsBalloonView']['toggleIsLoading'](!0x0);}_clearErrorState(){this['_actionsBalloonView']['hideError'](),this['_actionsBalloonView']['toggleIsLoading'](!0x1);}async _clearLoadingState(){await this['_promiseQueue']['queueEmptyPromise'],this['isBusy']=!0x1,this['_actionsBalloonView']['setIsLoading'](!0x1);}},Ah=class extends _0x19488e{static get requires(){return[ih,oh,gh];}static get['pluginName'](){return'AIQuickActions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x35f449){super(_0x35f449),_0x35f449['config']['define']('ai.quickActions',{'extraCommands':[],'removeCommands':[],'isSearchEnabled':!0x0});}},Ih=class extends _0x4ff2da{resultResponseView;acceptButtonView;dismissButtonView;infoButtonView;outdatedButtonView;constructor(_0x340ca0,_0x750bd7){super(_0x340ca0),this['id']=_0x750bd7,this['set']('status','pending'),this['set']('changeId',_0x750bd7),this['resultResponseView']=this['_createResultResponseView'](),this['acceptButtonView']=this['_createAcceptButtonView'](),this['dismissButtonView']=this['_createDismissButtonView'](),this['infoButtonView']=this['_createInfoButtonView'](),this['outdatedButtonView']=this['_createOutdatedButtonView'](),this['set']('isInfoToggleOn',!0x1),this['set']('isActive',!0x1),this['set']('showDiff',!0x0),this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-result',this['bindTemplate']['if']('isActive','ck-ai_review__check-run-result_active')]},'on':{'click':this['bindTemplate']['to']('click'),'mouseover':this['bindTemplate']['to']('mouseover'),'mouseout':this['bindTemplate']['to']('mouseout')},'children':[this['resultResponseView'],{'tag':'div','attributes':{'class':['ck-ai_review__check-run-result-footer']},'children':[{'tag':'div','attributes':{'class':['ck-ai_review__check-run-result-action-buttons']},'children':[this['acceptButtonView'],this['dismissButtonView'],this['outdatedButtonView']]},this['infoButtonView']]}]}),this['on']('click',(_0xff00c2,_0x5a378b)=>{_0x5a378b&&_0x5a378b['target']&&'A'===_0x5a378b['target']['tagName']&&_0x5a378b['preventDefault'](),this['fire']('activateChange',{'id':_0x750bd7,'source':this,'uiInteraction':'click'});}),this['on']('mouseover',()=>{this['fire']('activateChange',{'id':_0x750bd7,'source':this,'uiInteraction':'hover'});}),this['on']('mouseout',()=>{this['fire']('deactivateChange',{'origin':'panel','id':_0x750bd7,'source':this});}),this['on']('change:showDiff',()=>this['_syncResponseVisibility']());}['render'](){super['render'](),this['_syncResponseVisibility']();}setItemAsActive(){this['isActive']=!0x0;}setItemAsInactive(){this['isActive']=!0x1;}_createResultResponseView(){const _0x55b5d2=new _0x4ff2da(this['locale']);return _0x55b5d2['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content','ck-reset_all-excluded','ck-ai_review__check-run-result-response']}}),_0x55b5d2;}updateResponseContent(_0x1adfdb,_0x420cd0){const _0x172e9e=_0x420cd0||'div',_0x3798cb=this['resultResponseView']['element'];if(_0x3798cb['tagName']['toLowerCase']()!==_0x172e9e){const _0x40582d=new _0x4937f3({'tag':_0x172e9e,'attributes':{'class':_0x3798cb['className']}})['render']();_0x3798cb['replaceWith'](_0x40582d),this['resultResponseView']['element']=_0x40582d,this['_syncResponseVisibility']();}this['resultResponseView']['element']['innerHTML']=_0x1adfdb;}_syncResponseVisibility(){this['resultResponseView']['element']?.['classList']['toggle']('ck-hidden',!this['showDiff']);}_createAcceptButtonView(){const _0x2d6262=new Mt(this['locale']);return _0x2d6262['set']({'label':Es(this['locale'],'AI_REVIEW_MODE_ACCEPT_CHANGE'),'withText':!0x0}),_0x2d6262['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x567339=>{this['fire']('acceptChange',{'id':this['changeId']}),_0x567339['stopPropagation']();})},'attributes':{'class':[this['bindTemplate']['if']('status','ck-hidden',_0x12b7f1=>'pending'!==_0x12b7f1&&'accepted'!==_0x12b7f1),this['bindTemplate']['if']('status',Pn,_0x428605=>'pending'===_0x428605),this['bindTemplate']['if']('status',Dn,_0x41af18=>'pending'!==_0x41af18),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-status-button',_0x41bcef=>'accepted'===_0x41bcef)]}}),this['on']('change:status',(_0x569b54,_0x38518b,_0x72b25b)=>{_0x2d6262['isEnabled']='pending'===_0x72b25b,'accepted'===_0x72b25b&&(_0x2d6262['label']=Es(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_ACCEPTED'),_0x2d6262['icon']=_0x5517bf);}),_0x2d6262;}_createDismissButtonView(){const _0x2285b8=new Mt(this['locale']);return _0x2285b8['set']({'label':Es(this['locale'],'AI_REVIEW_MODE_DISMISS_CHANGE'),'withText':!0x0}),_0x2285b8['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x592235=>{this['fire']('dismissChange',{'id':this['changeId']}),_0x592235['stopPropagation']();})},'attributes':{'class':[Dn,this['bindTemplate']['if']('status','ck-hidden',_0x2a8a9a=>'pending'!==_0x2a8a9a&&'rejected'!==_0x2a8a9a),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-dismiss-button',_0x2cbeb8=>'pending'===_0x2cbeb8),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-status-button',_0x2e2d4a=>'rejected'===_0x2e2d4a)]}}),this['on']('change:status',(_0x448647,_0xd0f2ef,_0x5464ff)=>{_0x2285b8['isEnabled']='pending'===_0x5464ff,'rejected'===_0x5464ff&&(_0x2285b8['label']=Es(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_REJECTED'),_0x2285b8['icon']=_0xabec2d);}),_0x2285b8;}_createInfoButtonView(){const _0x424653=new Mt(this['locale']);return _0x424653['set']({'label':Es(this['locale'],'AI_REVIEW_MODE_LEARN_MORE'),'icon':_0x4790d7,'tooltip':!0x0,'isToggleable':!0x0,'role':'menuitemcheckbox','class':Dn+'\x20ck-ai_review__check-run-result-info-button\x20ck-hidden'}),_0x424653['bind']('isOn')['to'](this,'isInfoToggleOn',_0x37a330=>_0x37a330),_0x424653['on']('execute',()=>{this['isInfoToggleOn']=!this['isInfoToggleOn'];}),_0x424653;}_createOutdatedButtonView(){const _0x479568=new Mt(this['locale']);return _0x479568['set']({'label':Es(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_OUTDATED'),'icon':_0xa15aa9,'withText':!0x0,'isEnabled':!0x1}),_0x479568['extendTemplate']({'attributes':{'class':[Dn,'ck-ai_review__check-run-result-status-button',this['bindTemplate']['if']('status','ck-hidden',_0x5bf8e4=>'outdated'!==_0x5bf8e4)],'disabled':'disabled'}}),_0x479568;}},ph=class extends xt{resultItemView;_pinnedRectIndex=void 0x0;_pinnedTargetElement=void 0x0;_pinnedTargetChangeId=void 0x0;constructor(_0x5d8a10,_0x2dfb83){super(_0x5d8a10),this['set']({'isVisible':!0x1,'position':'arrow_se','class':null,'top':0x0,'left':0x0}),this['extendTemplate']({'tag':'div','attributes':{'class':['ck-reset'],'tabindex':'-1'}}),this['set']('isDiffActive',!0x1),this['content']['add'](this['_createContentView']()),_0x2dfb83['add'](this);}['render'](){super['render'](),this['_setupClickOutsideHandler']();}updateContent(_0x3c41ca){this['resultItemView']['changeId']=_0x3c41ca['id'],this['resultItemView']['updateResponseContent'](_0x3c41ca['contentDiffed'],_0x3c41ca['wrapperTag']);}['showBalloon'](_0x403230,_0x6cd6ef,_0x471964,_0x4dba93,_0x5130ca,_0x3af775){const _0xfdc402=_0x6cd6ef();if(!_0xfdc402)return;this['updateContent'](_0x403230),this['show']();const _0x9e90ed=Array['from'](_0xfdc402['getClientRects']())['reverse'](),_0x10628e=this['_getPointedRectIndexFromEvent'](_0x471964,_0x9e90ed),_0x2f4e2f=_0x9e90ed[_0x10628e??0x0];'click'===_0x4dba93?(this['isDiffActive']=!0x0,this['pin']({'target':()=>this['_getBestRectPositionOnClick'](_0x6cd6ef(),_0x10628e,_0x403230['id'],_0x5130ca,_0x3af775)||_0x2f4e2f})):'hover'===_0x4dba93&&(this['isDiffActive']=!0x1,this['pin']({'target':()=>this['_getBestRectPositionOnHover'](_0x6cd6ef(),_0x10628e,_0x403230['id'])||_0x2f4e2f}));}['hideBalloon'](){this['hide'](),this['unpin'](),this['_pinnedRectIndex']=void 0x0,this['_pinnedTargetElement']=void 0x0,this['_pinnedTargetChangeId']=void 0x0;}['hideDiffInBalloon'](){this['resultItemView']['showDiff']=!0x1;}['showDiffInBalloon'](){this['resultItemView']['showDiff']=!0x0;}deactivateChange(){this['fire']('deactivateChange',{'origin':'balloon'});}_setupClickOutsideHandler(){_0x341840({'emitter':this,'activator':()=>this['isVisible'],'contextElements':()=>{const _0x5cb3b3=[this['element']];return this['_pinnedTargetElement']&&_0x5cb3b3['push'](this['_pinnedTargetElement']),_0x5cb3b3;},'callback':()=>{this['hide'](),this['unpin'](),this['deactivateChange'](),this['_pinnedTargetElement']=void 0x0,this['_pinnedRectIndex']=void 0x0,this['_pinnedTargetChangeId']=void 0x0;}});}_createContentView(){const _0x5aec1c=new _0x4ff2da();return this['resultItemView']=new Ih(this['locale'],''),this['resultItemView']['resultResponseView']['extendTemplate']({'attributes':{'class':['ck-content']}}),this['resultItemView']['delegate']('acceptChange','dismissChange')['to'](this),_0x5aec1c['setTemplate']({'tag':'div','attributes':{'class':['ck-reset','ck-ai_review-balloon-panel-suggestion',this['bindTemplate']['if']('isDiffActive','ck-ai_review-balloon-panel-suggestion_diff-active')]},'children':[{'tag':'p','attributes':{'class':['ck-ai_review__suggestion-text']},'children':[this['resultItemView']]}]}),_0x5aec1c;}_getBestRectPositionOnClick(_0x3814f4,_0x4a9acd,_0x1161bb,_0x3b2c55,_0x4f3e51){if(!_0x3814f4)return null;const _0x1b843f=this['position']['replace']('arrow_',''),_0x295f96=Array['from'](_0x3814f4['getClientRects']());let _0x39653c,_0x24611b=_0x295f96['reverse']();return void 0x0!==_0x4a9acd&&this['_isPinnedRectVisible'](_0x24611b[_0x4a9acd],_0x3b2c55,_0x4f3e51)?(_0x39653c=_0x24611b[_0x4a9acd],this['_pinnedRectIndex']=_0x4a9acd):this['_isPinnedRectVisible'](_0x24611b[0x0],_0x3b2c55,_0x4f3e51)&&void 0x0===_0x4a9acd?_0x39653c=_0x24611b[0x0]:(_0x24611b='s'==_0x1b843f[0x0]?[..._0x295f96]['reverse']():_0x295f96,_0x24611b['forEach'](_0x125c20=>{this['_isPinnedRectVisible'](_0x125c20,_0x3b2c55,_0x4f3e51)&&(_0x39653c=_0x125c20);})),this['_pinnedTargetChangeId']=_0x1161bb,this['_pinnedTargetElement']=_0x3814f4,_0x39653c||_0x3814f4['getBoundingClientRect']();}_getBestRectPositionOnHover(_0x3d337c,_0x179a35,_0x1e3bab){if(!_0x3d337c)return null;const _0x549dfa=Array['from'](_0x3d337c['getClientRects']())['reverse']();return void 0x0===this['_pinnedRectIndex']&&void 0x0!==_0x179a35&&this['_pinnedTargetChangeId']!==_0x1e3bab?(this['_pinnedRectIndex']=_0x179a35,this['_pinnedTargetElement']=_0x3d337c,this['_pinnedTargetChangeId']=_0x1e3bab,_0x549dfa[_0x179a35]):void 0x0!==this['_pinnedRectIndex']&&this['_pinnedTargetChangeId']===_0x1e3bab?_0x3d337c!==this['_pinnedTargetElement']?Array['from'](this['_pinnedTargetElement']['getClientRects']())['reverse']()[this['_pinnedRectIndex']]:_0x549dfa[this['_pinnedRectIndex']]:void 0x0!==_0x179a35&&this['_pinnedTargetChangeId']!==_0x1e3bab?(this['_pinnedRectIndex']=_0x179a35,this['_pinnedTargetElement']=_0x3d337c,this['_pinnedTargetChangeId']=_0x1e3bab,_0x549dfa[_0x179a35]):_0x3d337c['getBoundingClientRect']();}_getPointedRectIndexFromEvent(_0x19abe5,_0x4ea23a){if(_0x19abe5)for(let _0x22ab7f=0x0;_0x22ab7f<_0x4ea23a['length'];_0x22ab7f++){const _0xa8ad19=_0x4ea23a[_0x22ab7f];if(_0x19abe5['clientX']>=_0xa8ad19['left']-0x3&&_0x19abe5['clientX']<=_0xa8ad19['right']+0x3&&_0x19abe5['clientY']>=_0xa8ad19['top']-0x3&&_0x19abe5['clientY']<=_0xa8ad19['bottom']+0x3)return _0x22ab7f;}}_isPinnedRectVisible(_0x45f25f,_0x3841c3,_0x596055){const _0x66ccef=new It(_0x45f25f),_0x2b05b5=_0x3841c3||document['documentElement'],_0x328bad=_0x66ccef['getIntersection'](Tt(_0x596055)),_0x14463f=new It(_0x2b05b5)['getIntersection'](_0x66ccef);return!!(_0x328bad&&_0x14463f&&_0x66ccef['width']>0x0);}};const Eh=['getReviewCheckList','runReviewCheck','abortReviewStream','toggleDiff','acceptAllChanges','leaveReviewCoreResultList','activateChange','deactivateChange','acceptChange','dismissChange','learnMore','finishReview','retryReview'];var mh=class extends _0x212144{['_mainView'];_balloonSuggestionView;_bodyCollection;static get requires(){return[gs];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x11f85c){super(_0x11f85c),this['_bodyCollection']=Mn(this['context']['locale']),this['_mainView']=this['createMainView'](),this['_mainView']['delegate'](...Eh)['to'](this),this['_balloonSuggestionView']=new ph(this['context']['locale'],this['_bodyCollection']),this['_balloonSuggestionView']['delegate']('acceptChange','dismissChange','deactivateChange')['to'](this);}init(){const _0x133d97=this['context']['plugins']['get']('AITabs');this['registerTab'](_0x133d97);}destroy(){this['_bodyCollection']['detachFromDom'](),super['destroy']();}setAvailableChecks(_0x330084){if(!this['_mainView']['reviewCheckListView']['hasChecks']()){const _0x16e6a3=!this['context']['config']['get']('ai.models.showModelSelector');this['_mainView']['reviewCheckListView']['setChecks'](_0x330084,_0x16e6a3);}this['_mainView']['showReviewCheckListView']();}showReviewCheckList(){this['fire']('getReviewCheckList');}showCheckRunResults(_0x2453a0){_0x2453a0&&('error-general'!==_0x2453a0['status']?'error-chunk'!==_0x2453a0['status']?this['_mainView']['showReviewCheckResultsView']():this['showChunkErrorView']():this['showGeneralResultsErrorView']());}showCheckRunResult(_0x41d84b){this['_mainView']['addCheckRunResult'](_0x41d84b);}showGeneralResultsErrorView(){this['_mainView']['showGeneralResultsErrorView']();}['showGeneralReviewCoreErrorView'](_0x186512){this['_mainView']['showGeneralReviewCoreErrorView'](_0x186512??Es(this['context']['locale'],'AI_REVIEW_INITIALIZATION_ERROR_MESSAGE'));}['showChunkErrorView'](){this['_mainView']['showChunkErrorView']();}showUnsupportedInlineChangeView(){this['_mainView']['showUnsupportedInlineChangeView']();}setCheckResultTitle(_0x1c476b,_0x310d4d){this['_mainView']['reviewCheckResultsView']['setTitle'](_0x1c476b,_0x310d4d);}setAcceptAllEnabled(_0x9ff0e1){this['_mainView']['reviewCheckResultsView']['setAcceptAllEnabled'](_0x9ff0e1);}setActiveStateInResults(_0x3a1bfd){this['_mainView']['reviewCheckResultsView']['getResults']()['forEach'](_0x5651a4=>{_0x5651a4['id']===_0x3a1bfd&&_0x5651a4['setItemAsActive']();});}resetActiveStateInResults(){this['_mainView']['reviewCheckResultsView']['getResults']()['forEach'](_0x57bc61=>_0x57bc61['setItemAsInactive']());}updateChangeState(_0x110b16,_0x2669d0){'accepted'===_0x2669d0||'rejected'===_0x2669d0||'outdated'===_0x2669d0?this['_mainView']['reviewCheckResultsView']['hideResult'](_0x110b16,_0x2669d0):this['_mainView']['reviewCheckResultsView']['showResult'](_0x110b16,_0x2669d0);}showReviewCompletedView(){this['_mainView']['showReviewCompletedView']();}showActionsWhenResultIsReady(){this['_mainView']['showActionsWhenResultIsReady']();}['showNoChangesView'](){this['_mainView']['showNoChangesView']();}hideActionsWhenResultIsReady(){this['_mainView']['hideActionsWhenResultIsReady']();}['showChangeBalloon'](_0x20ab10,_0x2f2dc2,_0x115b07,_0x514399,_0x4edd4c,_0x307f15){this['_balloonSuggestionView']['showBalloon'](_0x20ab10,_0x2f2dc2,_0x115b07,_0x514399,_0x4edd4c,_0x307f15);}['hideChangeBalloon'](){this['_balloonSuggestionView']['hideBalloon']();}['hideDiffInBalloon'](){this['_balloonSuggestionView']['hideDiffInBalloon']();}['showDiffInBalloon'](){this['_balloonSuggestionView']['showDiffInBalloon']();}getChangeElement(_0x3ef98a){const _0x48b693=this['_mainView']['reviewCheckResultsView']['getResults']()['find'](_0xb77650=>_0xb77650['id']===_0x3ef98a);return _0x48b693?_0x48b693['element']:null;}deactivateChange(){this['_balloonSuggestionView']['deactivateChange']();}},Th=class extends _0x4ff2da{constructor(_0xecd406){super(_0xecd406),this['set']('isVisible',!0x1),this['set']('errorMessage','');const _0x2f7b3a=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai_review__general-error-container',_0x2f7b3a['if']('isVisible','ck-hidden',_0x177b1c=>!_0x177b1c)]},'children':[{'tag':'p','attributes':{'class':'ck\x20ck-ai-notification\x20ck-ai-notification_error'},'children':[{'text':_0x2f7b3a['to']('errorMessage')}]}]});}},wh=class extends _0x4ff2da{['reviewCoreHeader'];['generalErrorView'];reviewCheckListView;reviewCheckResultsView;reviewCompletedView;constructor(_0x2f17b1,_0x98aa1d){super(_0x2f17b1),this['reviewCoreHeader']=_0x98aa1d['header'],this['generalErrorView']=new Th(_0x2f17b1),this['reviewCheckListView']=_0x98aa1d['list'],this['reviewCheckListView']['delegate'](...Eh)['to'](this),this['reviewCheckResultsView']=_0x98aa1d['results'],this['reviewCheckResultsView']['delegate'](...Eh)['to'](this),this['reviewCompletedView']=_0x98aa1d['completed'],this['reviewCompletedView']['delegate']('finishReview')['to'](this),this['reviewCheckListView']['set']('isVisible',!0x1),this['reviewCheckResultsView']['set']('isVisible',!0x1),this['reviewCheckResultsView']['set']('isLoading',!0x1),this['reviewCheckResultsView']['set']('isResultReady',!0x1),this['reviewCompletedView']['set']('isVisible',!0x1),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-review','ck-rounded-corners'],'dir':'ltr'},'children':[this['reviewCoreHeader'],this['generalErrorView'],this['reviewCheckListView'],this['reviewCheckResultsView'],this['reviewCompletedView']]});}showReviewCheckListView(){this['reviewCheckListView']['resetAllParameterizedChecks'](),this['reviewCheckListView']['set']('isVisible',!0x0),this['reviewCheckResultsView']['set']('isVisible',!0x1),this['reviewCompletedView']['set']('isVisible',!0x1);}showReviewCheckResultsView(){this['hideActionsWhenResultIsReady'](),this['reviewCheckResultsView']['resetErrorState'](),this['reviewCheckListView']['set']('isVisible',!0x1),this['reviewCheckResultsView']['set']('isVisible',!0x0),this['reviewCheckResultsView']['clearResults'](),this['reviewCheckResultsView']['set']('isLoading',!0x0),this['reviewCheckResultsView']['set']('isCompleted',!0x1);}addCheckRunResult(_0x157585){this['reviewCheckResultsView']['addResult'](_0x157585),this['reviewCheckResultsView']['set']('isLoading',!0x1);}showReviewCompletedView(){this['reviewCheckResultsView']['set']('isVisible',!0x0),this['reviewCompletedView']['set']('isVisible',!0x1),this['reviewCheckResultsView']['set']('isCompleted',!0x0),this['reviewCheckListView']['set']('isVisible',!0x1);}showActionsWhenResultIsReady(){this['reviewCheckResultsView']['isResultReady']?(this['reviewCheckListView']['set']('isVisible',!0x1),this['reviewCheckResultsView']['set']('isVisible',!0x0),this['reviewCompletedView']['set']('isVisible',!0x1)):this['reviewCheckResultsView']['isResultReady']=!0x0;}['showNoChangesView'](){this['reviewCheckListView']['set']('isVisible',!0x1),this['reviewCheckResultsView']['set']('isVisible',!0x1),this['reviewCompletedView']['set']('isVisible',!0x0);}hideActionsWhenResultIsReady(){this['reviewCheckResultsView']['isResultReady']=!0x1;}['showGeneralReviewCoreErrorView'](_0x17ea9e){this['generalErrorView']['set']('isVisible',!0x0),this['generalErrorView']['errorMessage']=_0x17ea9e;}showGeneralResultsErrorView(){this['reviewCheckResultsView']['set']('isLoading',!0x1),this['showActionsWhenResultIsReady'](),this['reviewCheckResultsView']['showGeneralErrorMessage']();}['showChunkErrorView'](){this['reviewCheckResultsView']['set']('isLoading',!0x1),this['showActionsWhenResultIsReady'](),this['reviewCheckResultsView']['showChunkErrorMessage']();}showUnsupportedInlineChangeView(){this['reviewCheckResultsView']['set']('isLoading',!0x1),this['showActionsWhenResultIsReady'](),this['reviewCheckResultsView']['showUnsupportedInlineChangeMessage']();}},Ch=class extends Mt{constructor(_0x45e4ff,_0x29c2d5){super(_0x29c2d5),this['set']({'label':_0x45e4ff,'withText':!0x0,'class':Ln}),this['on']('execute',()=>{this['fire']('finishReview');});}},fh=class extends jt{_resultViews;_resultsHeader;_resultsBody;['reviewDisclaimer'];_cancelButtonView;_acceptAllButtonView;_exitReviewButtonView;_toggleDiffButtonView;['_errorMessageView'];_finishReviewButtonView;_contents;constructor(_0x383513,_0x2da639){super(_0x383513),this['_contents']=_0x2da639,this['_resultViews']=new _0x50bc02(),this['_cancelButtonView']=this['_createCancelButtonView'](),this['_acceptAllButtonView']=this['_createAcceptAllButtonView'](),this['_exitReviewButtonView']=this['_createExitReviewButtonView'](),this['_toggleDiffButtonView']=this['_createToggleDiffButtonView'](),this['_finishReviewButtonView']=this['_createFinishReviewButtonView'](),this['_resultsHeader']=this['_createResultHeaderView'](),this['_resultsBody']=this['_createResultsBodyView'](),this['_errorMessageView']=this['_createErrorView'](),this['reviewDisclaimer']=new da(_0x383513),this['set']('isLoading',!0x1),this['set']('isToggleDiffOn',!0x1),this['set']('isResultReady',!0x1),this['set']('headerTitle',''),this['set']('headerSubtitle',''),this['set']('isError',!0x1),this['set']('showErrorMessage',!0x1),this['set']('errorType','general'),this['set']('isCompleted',!0x1),this['set']('isAcceptAllEnabled',!0x1),this['_acceptAllButtonView']['bind']('isEnabled')['to'](this,'isAcceptAllEnabled',this,'isError',(_0x28034a,_0x542648)=>_0x28034a&&!_0x542648);const _0x431439=this['_createCombinedSkeletonLoader'](),_0x1d9a47=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run',_0x1d9a47['if']('isLoading','ck-ai_review__check-run_loading',_0x5f00f1=>_0x5f00f1),_0x1d9a47['if']('isResultReady','ck-ai_review__check-run_ready',_0x55c788=>_0x55c788),_0x1d9a47['if']('isVisible','ck-hidden',_0x4556af=>!_0x4556af)]},'children':[this['_resultsHeader'],this['_errorMessageView'],this['_resultsBody'],_0x431439,this['reviewDisclaimer']]});}clearResults(){this['_resultViews']['clear'](),this['_resultsBody']['element']&&(this['_resultsBody']['element']['scrollTop']=0x0);}getResults(){return this['_resultViews'];}addResult(_0x1021f6){const _0x1ec77f=new Ih(this['locale'],_0x1021f6['id']);_0x1ec77f['delegate']('acceptChange','dismissChange','activateChange','deactivateChange')['to'](this),this['_resultViews']['add'](_0x1ec77f),_0x1ec77f['updateResponseContent'](_0x1021f6['contentDiffed'],_0x1021f6['wrapperTag']);}hideResult(_0x5a28a0,_0xd17d78){if('pending'===_0xd17d78)return;const _0x20f974=this['_resultViews']['find'](_0x230cd0=>_0x230cd0['id']===_0x5a28a0);_0x20f974&&(_0x20f974['status']=_0xd17d78,_0x20f974['element']?.['classList']['add']('ck-ai_review__check-run-result_grayout'));}showResult(_0x5b0687,_0x50fa07){if('pending'!==_0x50fa07)return;const _0xed4c3a=this['_resultViews']['find'](_0x2eff85=>_0x2eff85['id']===_0x5b0687);_0xed4c3a&&(_0xed4c3a['status']=_0x50fa07,_0xed4c3a['element']?.['classList']['remove']('ck-ai_review__check-run-result_grayout'));}setTitle(_0x46d2b7,_0x3b601f){this['headerTitle']=_0x46d2b7,this['headerSubtitle']=_0x3b601f||'';}['showChunkErrorMessage'](){this['errorType']='chunk',this['showErrorMessage']=!0x0;}showUnsupportedInlineChangeMessage(){this['errorType']='unsupported-inline',this['showErrorMessage']=!0x0;}['showGeneralErrorMessage'](){this['isError']=!0x0,this['errorType']='general',this['showErrorMessage']=!0x0;}resetErrorState(){this['isError']=!0x1,this['errorType']='general',this['showErrorMessage']=!0x1;}setAcceptAllEnabled(_0x37a94c){this['isAcceptAllEnabled']=_0x37a94c;}_createSkeletonLoader(){return new wr(this['locale'],Cr['aiReviewChecks']);}_createCombinedSkeletonLoader(){const _0x1b3063=new _0x4ff2da(this['locale']),_0x2f4d1b=[];for(let _0x4856ed=0x0;_0x4856ed<0x10;_0x4856ed++){const _0x2c59df=this['_createSkeletonLoader']();_0x2c59df['extendTemplate']({'attributes':{'class':['ck-ai_review__check-run-skeleton-item']}}),_0x2f4d1b['push'](_0x2c59df);}return _0x1b3063['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-skeleton-container',this['bindTemplate']['if']('isLoading','ck-hidden',_0xd5e942=>!_0xd5e942)]},'children':_0x2f4d1b}),_0x1b3063;}_createResultsBodyView(){const _0x1471c0=new _0x4ff2da(this['locale']);return _0x1471c0['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-container','ck-reset_all-excluded',this['bindTemplate']['if']('isLoading','ck-hidden',_0x45c577=>_0x45c577)]},'children':this['_resultViews']}),_0x1471c0;}_createErrorView(){const _0x26f7fa=new _0x4ff2da(this['locale']),_0x5400fb=new Mt(this['locale']),t=this['locale']['t'];return _0x26f7fa['delegate']('retryReview')['to'](this),_0x5400fb['set']({'label':t('Try\x20again'),'withText':!0x0,'class':Pn+'\x20ck-ai_review__check-run-error-retry-button'}),_0x5400fb['on']('execute',()=>{this['fire']('retryReview');}),_0x26f7fa['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-error-container',this['bindTemplate']['if']('showErrorMessage','ck-hidden',_0x4d9e0c=>!_0x4d9e0c),this['bindTemplate']['if']('errorType','ck-ai_review__check-run-error-container_border-bottom',_0x459293=>'chunk'===_0x459293)]},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-notification','ck-ai-notification_error','ck-ai-notification__full-width','ck-ai_review__check-run-error-message',this['bindTemplate']['if']('errorType','ck-ai-notification_warning',_0x4da297=>'chunk'===_0x4da297||'unsupported-inline'===_0x4da297)]},'children':[{'tag':'p','attributes':{'class':['ck-ai-notification__content',this['bindTemplate']['if']('errorType','ck-hidden',_0x48d35c=>'general'!==_0x48d35c)]},'children':[{'text':this['_contents']['generalErrorText']}]},{'tag':'p','attributes':{'class':['ck-ai-notification__content',this['bindTemplate']['if']('errorType','ck-hidden',_0x5d075b=>'chunk'!==_0x5d075b)]},'children':[{'text':Es(this['locale'],'AI_REVIEW_MODE_CHUNK_ERROR_MESSAGE')}]},{'tag':'p','attributes':{'class':['ck-ai-notification__content',this['bindTemplate']['if']('errorType','ck-hidden',_0xd8eeb9=>'unsupported-inline'!==_0xd8eeb9)]},'children':[{'text':Es(this['locale'],'AI_SUGGESTION_NO_PARTS_WARNING')}]}]},_0x5400fb]}),_0x26f7fa;}_createCancelButtonView(){const _0x44c4e9=new Mt(this['locale']);return _0x44c4e9['set']({'label':Es(this['locale'],'AI_REVIEW_MODE_STOP_GENERATING'),'withText':!0x0,'class':[Pn+'\x20ck-ai-button-stop-generating'],'icon':st}),_0x44c4e9['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isResultReady','ck-hidden',_0x48a416=>_0x48a416),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x5b4500=>_0x5b4500)]}}),_0x44c4e9['on']('execute',()=>{this['fire']('abortReviewStream');}),_0x44c4e9;}_createToggleDiffButtonView(){const _0x41d68c=new Mt(this['locale']);_0x41d68c['set']({'tooltip':!0x0,'isToggleable':!0x0,'role':'menuitemcheckbox'}),_0x41d68c['bind']('isEnabled')['to'](this,'isError',_0x529c7c=>!_0x529c7c),_0x41d68c['extendTemplate']({'attributes':{'class':[Pn,'ck-ai_review__check-run-toggle-diff-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x4f60e2=>!_0x4f60e2),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x5c0473=>_0x5c0473)]}});const _0x57e803=Es(this['locale'],'AI_REVIEW_MODE_HIDE_CHANGES'),_0x4ce9c4=Es(this['locale'],'AI_REVIEW_MODE_SHOW_CHANGES');return _0x41d68c['bind']('isOn')['to'](this,'isToggleDiffOn',_0x59ffda=>_0x59ffda),_0x41d68c['bind']('icon')['to'](this,'isToggleDiffOn',_0xc54894=>_0xc54894?_0x1d1512:_0x2e2674),_0x41d68c['bind']('label')['to'](this,'isToggleDiffOn',_0x5602f3=>_0x5602f3?_0x57e803:_0x4ce9c4),_0x41d68c['on']('execute',()=>{this['isToggleDiffOn']=!this['isToggleDiffOn'],this['fire']('toggleDiff',{'on':this['isToggleDiffOn']});}),_0x41d68c;}_createAcceptAllButtonView(){const _0x560575=new Mt(this['locale']);return _0x560575['set']({'label':Es(this['locale'],'AI_REVIEW_MODE_ACCEPT_ALL'),'withText':!0x0}),_0x560575['extendTemplate']({'attributes':{'class':[Ln,'ck-ai_review__check-run-accept-all-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x41b7ef=>!_0x41b7ef),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x38dc51=>_0x38dc51)]}}),_0x560575['on']('execute',()=>{this['fire']('acceptAllChanges');}),_0x560575;}_createExitReviewButtonView(){const _0x13fd88=new Mt(this['locale']);return _0x13fd88['set']({'label':Es(this['locale'],'AI_REVIEW_MODE_EXIT_REVIEW'),'withText':!0x0}),_0x13fd88['extendTemplate']({'attributes':{'class':[Dn,'ck-ai_review__check-run-exit-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x52bdd6=>!_0x52bdd6),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x3b4bad=>_0x3b4bad)]}}),_0x13fd88['on']('execute',()=>{this['fire']('leaveReviewCoreResultList');}),_0x13fd88;}_createResultHeaderView(){const _0x7030f8=new _0x4ff2da(this['locale']),_0x390e51=this['_createTitleView']();return _0x7030f8['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header',this['bindTemplate']['if']('isCompleted','ck-ai_review__review-completed-header',_0x3895b0=>_0x3895b0)]},'children':[_0x390e51,{'tag':'span','attributes':{'class':['ck-ai_review__review-completed-header-title',this['bindTemplate']['if']('isCompleted','ck-hidden',_0x5117b1=>!_0x5117b1)],'title':Es(this['locale'],'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE')},'children':[{'text':Es(this['locale'],'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE')}]},{'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header-buttons']},'children':[this['_cancelButtonView'],this['_acceptAllButtonView'],this['_exitReviewButtonView'],this['_toggleDiffButtonView'],this['_finishReviewButtonView']]}]}),_0x7030f8;}_createTitleView(){const _0x5e1a81=new _0x4ff2da(this['locale']),_0x2e7645=new Dr();return _0x2e7645['bind']('isVisible')['to'](this,'isResultReady',_0xbfa6ae=>!_0xbfa6ae),_0x5e1a81['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header-title-wrapper',this['bindTemplate']['if']('isCompleted','ck-hidden',_0x53d45e=>_0x53d45e)]},'children':[_0x2e7645,{'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header-title-content']},'children':[{'tag':'span','attributes':{'class':['ck-ai_review__check-run-results-header-title']},'children':[{'text':this['bindTemplate']['to']('headerTitle')}]},{'tag':'span','attributes':{'class':['ck-ai_review__check-run-results-header-subtitle']},'children':[{'text':this['bindTemplate']['to']('headerSubtitle')}]}]}]}),_0x5e1a81;}_createFinishReviewButtonView(){const _0x3ccbab=new Ch(Es(this['locale'],'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL'),this['locale']);return _0x3ccbab['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isCompleted','ck-hidden',_0x300e62=>!_0x300e62)]}}),_0x3ccbab['delegate']('finishReview')['to'](this),_0x3ccbab;}},bh=class extends jt{_resultsHeader;_finishReviewButtonView;constructor(_0x1c90e0,_0x792c6e){super(_0x1c90e0),this['_finishReviewButtonView']=this['_createFinishReviewButtonView'](_0x792c6e['buttonText']),this['_resultsHeader']=this['_createResultHeaderView'](_0x792c6e['headerText']);const _0x336b4a=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__review-completed',_0x336b4a['if']('isVisible','ck-hidden',_0x553ee2=>!_0x553ee2)]},'children':[this['_resultsHeader'],{'tag':'div','attributes':{'class':['ck-ai_review__review-completed-content']},'children':[{'tag':'span','attributes':{'class':['ck-ai_review__review-completed-content-icon']},'children':[{'text':'👍'}]},{'tag':'p','attributes':{'class':['ck-ai_review__review-completed-content-text']},'children':[{'text':_0x792c6e['emptyResultsText']}]}]}]});}_createFinishReviewButtonView(_0x3e8456){const _0x43a5a9=new Ch(_0x3e8456,this['locale']);return _0x43a5a9['delegate']('finishReview')['to'](this),_0x43a5a9;}_createResultHeaderView(_0x45d535){const _0x57cb67=new _0x4ff2da(this['locale']);return _0x57cb67['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__review-completed-header']},'children':[{'tag':'span','attributes':{'class':['ck-ai_review__review-completed-header-title'],'title':_0x45d535},'children':[{'text':_0x45d535}]},{'tag':'div','attributes':{'class':['ck-ai_review__review-completed-header-buttons']},'children':[this['_finishReviewButtonView']]}]}),_0x57cb67;}},Sh=class extends _0x4ff2da{['_dropdownView'];_defaultValue;_defaultLabel;constructor(_0x2fd776,_0x133955){super(_0x2fd776),this['_defaultValue']=_0x133955['default']||(_0x133955['data']['length']>0x0?_0x133955['data'][0x0]['id']:''),this['_defaultLabel']=_0x133955['data']['find'](_0x1d4962=>_0x1d4962['id']===this['_defaultValue'])?.['label']||'',this['set']('formValue',''),this['_dropdownView']=_0x5a954d(this['locale']);const _0x670469=this['_prepareListOptions'](_0x133955['data']);_0x3196cc(this['_dropdownView'],_0x670469,{'role':'menu','ariaLabel':_0x133955['label']}),this['_dropdownView']['buttonView']['set']({'label':this['_defaultLabel'],'withText':!0x0}),this['_dropdownView']['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x12833f=>{_0x12833f['stopPropagation']();})}}),this['listenTo'](this['_dropdownView'],'execute',_0x46da17=>{this['formValue']=_0x46da17['source']['model']['id'],this['_dropdownView']['buttonView']['label']=_0x46da17['source']['model']['label'];}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai_review__check-list-item-parameterized-form-element','ck-ai_review__check-list-item-parameterized-form-element_dropdown']},'children':[this['_dropdownView']]});}resetToDefault(){this['formValue']=this['_defaultValue'],this['_dropdownView']['buttonView']['label']=this['_defaultLabel'];}_prepareListOptions(_0x243f03=[]){const _0x3a01c0=new lt();this['resetToDefault']();for(const _0x9664fc of _0x243f03){const _0x426789=new _0xd62086({'label':_0x9664fc['label'],'withText':!0x0,'role':'menuitemradio','id':_0x9664fc['id'],'model':_0x9664fc});_0x426789['bind']('isOn')['to'](this,'formValue',_0x11a79d=>_0x11a79d===_0x426789['id']);const _0x5514db={'type':'button','model':_0x426789};_0x3a01c0['add'](_0x5514db);}return _0x3a01c0;}},Rh=class extends jt{_formItem=null;constructor(_0x3a21ee,_0x4793e8,_0x137f37){if(super(_0x3a21ee),this['argsKey']=_0x4793e8?.['argsKey'],'dropdown'===_0x4793e8['formType'])this['_formItem']=new Sh(this['locale'],_0x4793e8);this['set']('value',''),this['bind']('value')['to'](this['_formItem'],'formValue');const _0x3b586a=new Wt(this['locale'],{'children':[this['_formItem']],'class':[_0x137f37?'ck-form__row_with-submit':'']});_0x137f37&&_0x3b586a['children']['add'](_0x137f37),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai_review__form-item','ck-reset_all']},'children':[_0x3b586a]});}resetToDefault(){this['_formItem']['resetToDefault']();}},Oh=class AIReviewCorePromptInputView extends _0x3a49c8{keystrokes;static ['MIN_ROWS']=0x1;static ['MAX_ROWS']=0xc;constructor(_0x5fc61c){super(_0x5fc61c),this['set']('isEmpty',!0x0),this['keystrokes']=new gt(),this['minRows']=AIReviewCorePromptInputView['MIN_ROWS'],this['maxRows']=AIReviewCorePromptInputView['MAX_ROWS'],this['extendTemplate']({'attributes':{'id':'ai-review-prompt-input','class':['ck','ck-review__prompt-input']}});}['render'](){super['render'](),this['on']('update',()=>{this['isEmpty']=''===this['element']['value']?.['trim']();}),this['keystrokes']['listenTo'](this['element']);}},vh=class extends _0x4ff2da{['focusTracker']=new _t();keystrokes=new gt();['focusCycler'];['_focusables']=new _0x50bc02();submitButtonView;cancelButtonView;promptInputView;actionsFooterView;_modelSelector;['_check'];constructor(_0x21f41b,_0x1a5787,_0xf16789=!0x1){super(_0x21f41b),this['_check']=_0x1a5787,this['set']('prompt',''),this['set']('modelId',''),this['submitButtonView']=this['_createSubmitButtonView'](),this['cancelButtonView']=this['_createCancelButtonView'](),(this['promptInputView']=new Qt(this['locale'],()=>new Oh(_0x21f41b)),this['promptInputView']['fieldView']['bind']('value')['to'](this,'prompt'),this['promptInputView']['fieldView']['on']('input',()=>{this['prompt']=this['promptInputView']['fieldView']['element']['value'];}),this['_modelSelector']=new Io(_0x21f41b,{'panelPosition':'se','dropdownClass':'ck-ai_review__check-list-item-model-dropdown','nameClass':'ck-ai_review__check-list-item-model-name','itemClasses':{'name':'ck-ai_review__check-list-item-model-dropdown-name','description':'ck-ai_review__check-list-item-model-dropdown-description'}}),this['listenTo'](this['_modelSelector'],'selectModel',(_0x2a417e,_0x4cb550)=>{this['modelId']=_0x4cb550['id'],this['_modelSelector']['setSelectedModel'](_0x4cb550);}),this['_setModelList'](_0xf16789),this['actionsFooterView']=this['_createActionsFooterView'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-custom-actions']},'children':[new Wt(this['locale'],{'children':[this['promptInputView']]}),new Wt(this['locale'],{'children':[this['actionsFooterView']]})]}),this['promptInputView']['fieldView']['keystrokes']['set']('Enter',(_0x36ea67,_0x3f84c0)=>{this['_isValid']()?(this['fire']('runReviewCheck',{'id':'custom','args':{'prompt':this['prompt'],'model':this['modelId']},'isCustom':!0x0}),_0x3f84c0()):_0x3f84c0();}),this['focusCycler']=new Ft({'focusables':this['_focusables'],'focusTracker':this['focusTracker'],'keystrokeHandler':this['keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}));}['render'](){super['render'](),[this['promptInputView'],this['_modelSelector']['dropdownView'],this['cancelButtonView'],this['submitButtonView']]['forEach'](_0x8f5041=>{this['_focusables']['add'](_0x8f5041),this['focusTracker']['add'](_0x8f5041['element']);}),this['keystrokes']['listenTo'](this['element']);}resetToDefault(){this['prompt']='',this['modelId']=this['_check']['defaultModel']?.['id']??'',this['_check']['defaultModel']&&this['_modelSelector']['setSelectedModel'](this['_check']['defaultModel']),this['resetFormValidationStatus']();}resetFormValidationStatus(){this['promptInputView']['errorText']='';}['_isValid'](){this['resetFormValidationStatus']();for(const _0x156047 of this['_getFormValidators']()){const _0x1fa68f=_0x156047();if(_0x1fa68f)return this['promptInputView']['errorText']=_0x1fa68f,!0x1;}return!0x0;}_getFormValidators(){return[()=>{if(0x0===this['promptInputView']['fieldView']['value']?.['trim']()['length'])return Es(this['locale'],'AI_REVIEW_MODE_PROMPT_EMPTY_ERROR');}];}_createSubmitButtonView(){const _0xe4d6e9=new Mt(this['locale']),t=this['locale']['t'];return _0xe4d6e9['set']({'label':t('Submit'),'withText':!0x0,'class':Ln}),_0xe4d6e9['on']('execute',()=>{this['_isValid']()&&this['fire']('runReviewCheck',{'id':'custom','args':{'prompt':this['prompt'],'model':this['modelId']},'isCustom':!0x0});}),_0xe4d6e9;}_createCancelButtonView(){const _0x44df6c=new Mt(this['locale']),t=this['locale']['t'];return _0x44df6c['set']({'label':t('Cancel'),'withText':!0x0,'class':Dn}),_0x44df6c['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x398c06=>{_0x398c06['stopPropagation']();})}}),_0x44df6c['on']('execute',()=>{this['resetToDefault'](),this['fire']('closeCustomCheck');}),_0x44df6c;}_setModelList(_0x571351){this['_modelSelector']['setModels'](this['_check']['models'],!_0x571351),this['resetToDefault']();}_createActionsFooterView(){const _0x5eab40=new _0x4ff2da(this['locale']);return _0x5eab40['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-custom-actions-footer']},'children':[this['_modelSelector'],{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized-custom-actions-buttons']},'children':[this['cancelButtonView'],this['submitButtonView']]}]}),_0x5eab40;}},kh=class extends jt{_formItemsCollection=new _0x50bc02();_customCheckView=null;['_hideModels']=!0x1;constructor(_0x258959,_0x40a88a,_0x297e89,_0x29af25=!0x1){super(_0x258959),this['_hideModels']=_0x29af25,this['set']('isParametrizedViewOpen',!0x1),this['set']('isListItemRendered',!0x1),this['set']('isItemParametrized',_0x40a88a['isParameterized']);const _0x269550=this['_createIconView']();this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item',this['bindTemplate']['if']('isParametrizedViewOpen','ck-ai_review__check-list-item_selected',_0x132e6d=>_0x132e6d),this['bindTemplate']['if']('isListItemRendered','ck-ai_review__check-list-item_rendered',_0x4c40b0=>_0x4c40b0)],'style':{'--ck-ai-review-check-list-item-index':_0x297e89}},'on':{'click':this['bindTemplate']['to']('click')},'children':[{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-content']},'children':[{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-main-content']},'children':[{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-title']},'children':[{'tag':'span','attributes':{'class':['ck-ai_review__check-list-item-title-text']},'children':[{'text':_0x40a88a['title']}]},_0x269550]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-description']},'children':_0x40a88a['description']?[{'text':_0x40a88a['description']}]:[]}]}]},..._0x40a88a['isParameterized']?[this['_createParameterizedView'](_0x40a88a)]:[],...'custom'===_0x40a88a['id']?[this['_createCustomView'](_0x40a88a,this['_hideModels'])]:[]]}),this['on']('click',()=>{_0x40a88a['isParameterized']?this['isParametrizedViewOpen']=!0x0:this['fire']('runReviewCheck',{'id':_0x40a88a['id'],'args':_0x40a88a['useArgs']?_0x40a88a['args']:void 0x0});}),requestAnimationFrame(()=>{this['isListItemRendered']=!0x0;});}['render'](){super['render'](),this['isItemParametrized']&&_0x341840({'emitter':this,'activator':()=>!0x0===this['isParametrizedViewOpen'],'contextElements':[this['element']],'callback':()=>{this['isParametrizedViewOpen']=!0x1;}});}resetToDefault(){this['isParametrizedViewOpen']=!0x1,this['_formItemsCollection']['forEach'](_0x23b28a=>{_0x23b28a['resetToDefault']();}),this['_customCheckView']&&this['_customCheckView']['resetToDefault']();}_createIconView(){const _0x39fa7b=new $t();return _0x39fa7b['content']=_0xec4159,_0x39fa7b['extendTemplate']({'attributes':{'class':['ck-ai_review__check-list-item-title-icon']}}),_0x39fa7b;}_createParameterizedView(_0xba9d9b){const _0x403bf4=new _0x4ff2da(),_0x363bee=this['_createFormView'](_0xba9d9b);return _0x403bf4['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized',this['bindTemplate']['if']('isParametrizedViewOpen','ck-hidden',_0x336823=>!_0x336823)]},'children':[_0x363bee]}),_0x403bf4;}_createFormView(_0x2642b0){const _0xc0f5bd=new _0x4ff2da(),_0x548f0a=Array['isArray'](_0x2642b0['options'])?_0x2642b0['options']:[],_0x429b83=new Mt(this['locale']),t=this['locale']['t'];_0x429b83['set']({'label':t('Submit'),'withText':!0x0,'class':Ln}),_0x429b83['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x4d1345=>{_0x4d1345['stopPropagation']();})}}),_0x429b83['on']('execute',()=>{const _0x4203e4=[],_0x1bcc6d={};this['_formItemsCollection']['forEach'](_0x55005f=>{_0x4203e4['push'](_0x55005f['value']),_0x2642b0['useArgs']&&_0x2642b0['options']&&(_0x1bcc6d[_0x55005f['argsKey']]=_0x55005f['value']);}),this['fire']('runReviewCheck',{'id':_0x2642b0['id'],'params':_0x4203e4['length']?_0x4203e4:void 0x0,'args':Object['keys'](_0x1bcc6d)['length']?_0x1bcc6d:void 0x0});});const _0x4669ad=_0x548f0a['length'];return _0x548f0a['forEach']((_0x2bc661,_0x5b4af8)=>{const _0x24a17b=_0x5b4af8===_0x4669ad-0x1;this['_formItemsCollection']['add'](new Rh(this['locale'],_0x2bc661,_0x24a17b?_0x429b83:null));}),_0xc0f5bd['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized-form']},'children':this['_formItemsCollection']}),_0xc0f5bd;}_createCustomView(_0x505097,_0x4cafee=!0x1){return this['_customCheckView']=new vh(this['locale'],_0x505097,_0x4cafee),this['_customCheckView']['extendTemplate']({'attributes':{'class':['ck-ai_review__check-list-item-parameterized','ck-ai_review__check-list-item-parameterized_custom',this['bindTemplate']['if']('isParametrizedViewOpen','ck-hidden',_0x16fa87=>!_0x16fa87)]}}),this['_customCheckView']['delegate']('runReviewCheck')['to'](this),this['listenTo'](this['_customCheckView'],'closeCustomCheck',()=>{this['isParametrizedViewOpen']=!0x1;}),this['on']('change:isParametrizedViewOpen',(_0x91fdac,_0x7716fe,_0x1a0351)=>{_0x1a0351||this['_customCheckView']['resetFormValidationStatus']();}),this['_customCheckView'];}},yh=class extends jt{['_checkViews'];constructor(_0x54312e){super(_0x54312e),this['_checkViews']=new _0x50bc02(),this['_setupTemplate']();}setChecks(_0x11ebfc,_0xffdb73=!0x1){this['_checkViews']['clear']();for(const [_0x4f4e84,_0x1fa2ed]of _0x11ebfc['entries']()){const _0x13b7b8=new kh(this['locale'],_0x1fa2ed,_0x4f4e84,_0xffdb73);_0x13b7b8['delegate']('runReviewCheck')['to'](this),this['_checkViews']['add'](_0x13b7b8);}}['hasChecks'](){return this['_checkViews']['length']>0x0;}resetAllParameterizedChecks(){for(const _0x59b3f2 of this['_checkViews'])_0x59b3f2 instanceof kh&&_0x59b3f2['resetToDefault']();}_setupTemplate(){const _0x483b7a=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list',_0x483b7a['if']('isVisible','ck-hidden',_0x3a3215=>!_0x3a3215)]},'children':this['_checkViews']});}},Nh=class extends mh{static get['pluginName'](){return'AIReviewModeUI';}createMainView(){const _0x1d6d37=this['context']['plugins']['get']('AITabs'),_0x2d0f94=this['context']['locale'],_0x211afa=new ua(_0x2d0f94,{'label':Es(_0x2d0f94,'AI_REVIEW_MODE'),'icon':_0x1f8cfb,'class':'ck-ai-header_review','showResizeButton':_0x1d6d37['showResizeButton']});return _0x211afa['delegate']('resizeTabs')['to'](_0x1d6d37),_0x211afa['bind']('isMaximized')['to'](_0x1d6d37['view'],'isMaximized',_0x9a99e8=>_0x9a99e8),new wh(this['context']['locale'],{'header':_0x211afa,'list':new yh(_0x2d0f94),'results':new fh(_0x2d0f94,{'generalErrorText':Es(_0x2d0f94,'AI_REVIEW_MODE_GENERAL_ERROR_MESSAGE')}),'completed':new bh(_0x2d0f94,{'headerText':Es(_0x2d0f94,'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE'),'emptyResultsText':Es(_0x2d0f94,'AI_REVIEW_MODE_EMPTY_RESULTS_TEXT'),'buttonText':Es(_0x2d0f94,'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL')})});}registerTab(){const _0x390af2=this['context']['plugins']['get']('AITabs');_0x390af2['view']['on']('activateTab',(_0x1cc41f,{newTab:_0x4ac06e,oldTab:_0x386f99})=>{'reviewMode'===_0x4ac06e?this['fire']('getReviewCheckList'):'reviewMode'===_0x386f99&&this['fire']('leaveReview');}),_0x390af2['view']['addTab']({'id':'reviewMode','buttonLabel':Es(this['context']['locale'],'AI_REVIEW_MODE'),'buttonIcon':_0x1f8cfb,'order':0x0,'content':this['_mainView']});}},xh=class extends Sn{_affectedBlocks=[];get affectedBlocks(){return this['_affectedBlocks']['slice']();}set affectedBlocks(_0x341c60){this['_affectedBlocks']=_0x341c60;}};const Lh='review-',Ph=['softBreak'],Dh=['htmlScript','htmlStyle','htmlCustomElement'];var Hh=class extends _0x212144{static get requires(){return[_0x5388eb,tn];}static get['pluginName'](){return'AIReviewCoreEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['_markers']=new Map();_activeMarkers=new Set();_domEmitter;_eventEmitter;_reviewEditingAttachedEditors=new WeakSet();_boundEditables=new WeakMap();_inlineRootDataIds=new WeakMap();constructor(_0x3ffff1){super(_0x3ffff1),this['_domEmitter']=new(ut())(),this['_eventEmitter']=new(dt())();}get emitter(){return this['_eventEmitter'];}afterInit(){const _0x6b4e58=_0x5c1467=>this['_scheduleAttachReviewEditingToEditor'](_0x5c1467);if(this['_registerGlobalBalloonBlurHandler'](),this['context']instanceof _0x2a0bfb)return void _0x6b4e58(this['context']);const _0x3a9040=this['context'];for(const _0x21e4e3 of _0x3a9040['editors'])_0x6b4e58(_0x21e4e3);this['listenTo'](_0x3a9040['editors'],'add',(_0x7a69e9,_0x5505a3)=>{_0x6b4e58(_0x5505a3);}),this['listenTo'](_0x3a9040['editors'],'remove',(_0x22bafd,_0x4fa6d4)=>{for(const [_0x20cc0a,_0x33e465]of this['_markers'])_0x33e465['editor']===_0x4fa6d4&&(this['_eventEmitter']['fire']('changeMarkerRemoved',{'markerId':_0x20cc0a,'changeId':_0x33e465['groupId']}),this['_markers']['delete'](_0x20cc0a));});}_scheduleAttachReviewEditingToEditor(_0x37a264){const _0x1dd9f0=()=>{'destroyed'!==_0x37a264['state']&&_0x37a264['conversion']&&this['_attachReviewEditingToEditor'](_0x37a264);};if('ready'===_0x37a264['state'])return void _0x1dd9f0();const _0x43b8ff=()=>{this['stopListening'](_0x37a264,'ready',_0x43b8ff),_0x1dd9f0();};this['listenTo'](_0x37a264,'ready',_0x43b8ff);}_attachReviewEditingToEditor(_0xd40e){this['_reviewEditingAttachedEditors']['has'](_0xd40e)||(_0xd40e['conversion']['for']('editingDowncast')['markerToElement']({'model':Lh+'insert','view':(_0x4374c9,{writer:_0x4cf937})=>{const _0x5d2b3f=this['_markers']['get'](_0x4374c9['markerName']),_0x549d0d={'class':'ck-ai_review-marker_add'+(this['_activeMarkers']['has'](_0x5d2b3f?.['id']||'')?'\x20ck-ai_review__change_active':''),'data-marker-id':_0x4374c9['markerName']};return _0x4cf937['createUIElement']('span',_0x549d0d,function(_0x1f5a53){const _0x457d1d=this['toDomElement'](_0x1f5a53);return _0x457d1d['innerHTML']=_0x5d2b3f?.['content']?.['asString']||'',_0x457d1d;});}}),_0xd40e['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Lh+'remove-only','view':_0x124f2e=>{const _0x155bd7=this['_markers']['get'](_0x124f2e['markerName']),_0x32ef26=['ck-ai_review-marker_strikethrough'];return this['_activeMarkers']['has'](_0x155bd7?.['id']||'')&&_0x32ef26['push']('ck-ai_review__change_active'),{'classes':_0x32ef26,'attributes':{'data-marker-id':_0x124f2e['markerName']}};}}),_0xd40e['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Lh+'remove-context','view':_0x2b73cc=>{const _0x18eb26=this['_markers']['get'](_0x2b73cc['markerName']),_0x4523b9=['ck-ai_review-marker_underline'];return this['_activeMarkers']['has'](_0x18eb26?.['id']||'')&&_0x4523b9['push']('ck-ai_review__change_active'),{'classes':_0x4523b9,'attributes':{'data-marker-id':_0x2b73cc['markerName']}};}}),_0xd40e['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Lh+'remove-text','view':_0x42c3e2=>{const _0x170928=this['_markers']['get'](_0x42c3e2['markerName']),_0x1f10a2=['ck-ai_review-marker_hide'];return this['_activeMarkers']['has'](_0x170928?.['id']||'')&&_0x1f10a2['push']('ck-ai_review__change_active'),{'classes':_0x1f10a2,'attributes':{'data-marker-id':_0x42c3e2['markerName']}};}}),_0xd40e['conversion']['for']('dataDowncast')['markerToElement']({'model':Lh+'suggestion-context','view':(_0x29e181,{writer:_0x34858d})=>_0x34858d['createRawElement']('span',{'class':'ck-ai_review-marker_context-'+(_0x29e181['isOpening']?'start':'end')})}),_0xd40e['conversion']['for']('downcast')['attributeToAttribute']({'model':_0x4274f2,'view':_0x552318}),this['_updateMouseMarkerInteractionListeners'](_0xd40e),this['listenTo'](_0xd40e,'addRoot',()=>this['_updateMouseMarkerInteractionListeners'](_0xd40e),{'priority':'lowest'}),this['listenTo'](_0xd40e,'detachRoot',()=>this['_updateMouseMarkerInteractionListeners'](_0xd40e),{'priority':'lowest'}),_0xd40e['model']['document']['registerPostFixer'](_0xbf5c98=>this['_validateMarkers'](_0xd40e,_0xbf5c98)),_0xd40e['model']['document']['on']('change',()=>this['_handleMarkerChanges'](_0xd40e)),this['_reviewEditingAttachedEditors']['add'](_0xd40e));}_updateMouseMarkerInteractionListeners(_0x2cd7b2){let _0x31344e=this['_boundEditables']['get'](_0x2cd7b2);_0x31344e||(_0x31344e=new Map(),this['_boundEditables']['set'](_0x2cd7b2,_0x31344e));const _0xd1dcf6=new Set(_0x2cd7b2['ui']['getEditableElementsNames']());for(const _0x20afb3 of _0xd1dcf6){if(_0x31344e['has'](_0x20afb3))continue;const _0x2350ca=_0x2cd7b2['ui']['getEditableElement'](_0x20afb3);_0x31344e['set'](_0x20afb3,_0x2350ca),this['_attachMouseMarkerInteractionListeners'](_0x2350ca);}for(const [_0x3a936c,_0x55a915]of _0x31344e)_0xd1dcf6['has'](_0x3a936c)||(_0x31344e['delete'](_0x3a936c),this['_domEmitter']['stopListening'](_0x55a915));}_attachMouseMarkerInteractionListeners(_0x31a0b1){this['_domEmitter']['listenTo'](_0x31a0b1,'mouseup',(_0x1a02ec,_0x2d041a)=>{const _0x51647d=_0x2d041a['target'],_0x14c25b=this['_findMarkerElement'](_0x51647d);if(!_0x14c25b)return;const _0x56a688=_0x14c25b['getAttribute']('data-marker-id'),_0x1e3683=_0x56a688['split'](':')['pop']()?.['split']('_')[0x0];this['_eventEmitter']['fire']('changeMarkerClicked',{'markerId':_0x56a688,'changeId':_0x1e3683,'markerElement':()=>this['_findMarkerElementById'](_0x56a688),'domEvent':_0x2d041a});},{'usePassive':!0x0,'priority':'highest'}),this['_domEmitter']['listenTo'](_0x31a0b1,'mouseover',(_0x43d817,_0x765d08)=>{const _0x29cd9b=_0x765d08['target'],_0x586e41=_0x765d08['relatedTarget'];let _0x11f7ff=this['_findMarkerElement'](_0x29cd9b);if(!_0x11f7ff&&_0x586e41&&(_0x11f7ff=this['_findMarkerElement'](_0x586e41)),!_0x11f7ff)return;const _0x558ff4=_0x11f7ff['getAttribute']('data-marker-id'),_0x1ef20d=_0x558ff4['split'](':')['pop']()?.['split']('_')[0x0];this['_eventEmitter']['fire']('changeMarkerHovered',{'changeId':_0x1ef20d,'markerElement':()=>this['_findMarkerElementById'](_0x558ff4),'domEvent':_0x765d08});});}_registerGlobalBalloonBlurHandler(){this['_domEmitter']['listenTo'](document,'mouseover',_0x220e40((_0x3fcc9e,_0x242b31)=>{const _0x20562b=_0x242b31['target'];this['_findMarkerElement'](_0x20562b)||_0x20562b['closest']('.ck-reset.ck-ai_review-balloon-panel-suggestion')||this['_eventEmitter']['fire']('changeMarkerBlurred');},0xc8));}getDocumentData(_0x4ba5c7){const _0x3980f9=this['context']['plugins']['get']('AIEditing'),_0x3ff575=bs(this['context']);if(!_0x3ff575['length'])throw new ct('ai-get-editor-from-context-no-editor',this);const _0x42a004=_0x4ba5c7?.['roots'];if(_0x42a004&&0x0===_0x42a004['length'])throw new ct('ai-reviewcoreediting-empty-roots',this);const _0x4ed3d3=_0x42a004?new Set(_0x42a004['map'](_0x2157ba=>_0x2157ba['channelId']+'\x00'+_0x2157ba['rootName'])):null,_0x35b74d=_0x4ed3d3?new Set():null,_0x435bc2=new Set(),_0x48ebd7=[],_0x56edb5=new Map(),_0x58e89f=[];for(const _0x3742ce of _0x3ff575){const _0x239f17=_0x3742ce['config']['get']('collaboration.channelId');for(const _0x37bd75 of _0x3742ce['model']['document']['getRoots']()){const _0x5a422f=_0x239f17+'\x00'+_0x37bd75['rootName'];if(_0x4ed3d3&&!_0x4ed3d3['has'](_0x5a422f))continue;const _0x40fc25=this['_buildDocumentDataSliceForRoot'](_0x3742ce,_0x37bd75,_0x3980f9,_0x435bc2);_0x48ebd7['push'](_0x40fc25['content']);for(const [_0x275577,_0x1dfa8c]of _0x40fc25['elements'])_0x56edb5['set'](_0x275577,_0x1dfa8c);_0x58e89f['push']({'channelId':_0x239f17,'rootName':_0x37bd75['rootName']}),_0x35b74d?.['add'](_0x5a422f);}}if(_0x42a004&&_0x35b74d['size']!==_0x4ed3d3['size']){const _0x2a08c8=_0x42a004['find'](_0x29e155=>!_0x35b74d['has'](_0x29e155['channelId']+'\x00'+_0x29e155['rootName']));throw new ct('ai-reviewcoreediting-root-not-found',this,{'channelId':_0x2a08c8['channelId'],'rootName':_0x2a08c8['rootName']});}return{'elements':_0x56edb5,'content':_0x48ebd7['join'](''),'roots':_0x58e89f};}async['runCheck'](_0x48880e,_0x53bedb){const _0x92f9a0=new On(),_0x26d75f=_0x53bedb?.['signal'];let _0x12aafe;const _0x53b08c=()=>{_0x92f9a0['abort'](),_0x48880e['abort']();};if(_0x26d75f){if(_0x26d75f['aborted'])return _0x53b08c(),_0x92f9a0;_0x26d75f['addEventListener']('abort',_0x53b08c),_0x12aafe=()=>_0x26d75f['removeEventListener']('abort',_0x53b08c);}const _0x4ef11c={'apiId':_0x48880e['sourceCheck']['apiId']};try{_0x48880e['on']('reviewCheckRunUpdated',(_0x215a50,_0xde11d2)=>{'aborted'===_0xde11d2['status']?_0x92f9a0['abort']():'error-general'!==_0xde11d2['status']&&'error-chunk'!==_0xde11d2['status']||(_0x92f9a0['error']=bn(_0xde11d2['error'],'ai-reviewcoreediting-check-run-failed',this,_0x4ef11c));}),'aborted'!==_0x92f9a0['status']&&await _0x48880e['start']();}catch(_0x35902b){_0x92f9a0['error']=bn(_0x35902b,'ai-reviewcoreediting-check-run-failed',this,_0x4ef11c);}finally{_0x12aafe&&_0x12aafe();}return'error'===_0x92f9a0['status']||'aborted'===_0x92f9a0['status']||(_0x92f9a0['addResult'](...this['_buildPerRootResults'](_0x48880e)),_0x92f9a0['status']='completed'),_0x92f9a0;}buildErrorContext(_0x3378f3){return{'apiId':_0x3378f3['sourceCheck']['apiId']};}_buildPerRootResults(_0x140bf0){const _0x3623e6=this['buildErrorContext'](_0x140bf0),_0x53a036=this['context']['plugins']['get']('AIEditing'),_0xd7a5d5=this['context']['plugins']['get']('AIGateway'),_0x2d79b8=this['_groupElementsByRoot'](_0x140bf0['documentData']['elements']),_0x1717ec=new Map();for(const _0x12817a of bs(this['context']))_0x1717ec['set'](_0x12817a['config']['get']('collaboration.channelId'),_0x12817a);return _0x140bf0['documentData']['roots']['map'](({channelId:_0x2ed371,rootName:_0x5523a6})=>{const _0x3aae91=_0x1717ec['get'](_0x2ed371),_0x224470=new xh({'editor':_0x3aae91,'rootName':_0x5523a6,'channelId':_0x2ed371,'sessionId':_0x53a036['getSessionId'](_0x3aae91)}),_0x590dc2=_0x2d79b8['get'](_0x224470['editor'])?.['get'](_0x224470['rootName'])??[];_0x224470['contentRawOld']=_0x590dc2['map'](_0x22c624=>_0x22c624['getContent']())['join'](''),_0x224470['documentVersion']=_0x590dc2[0x0]?.['documentVersion']??0x1;const _0x303fa7=this['_collectResultAffectedBlocks'](_0x224470,_0x140bf0['results'],_0x140bf0['documentData']['elements']);_0x224470['affectedBlocks']=_0x303fa7;try{_0x224470['contentRawNew']=Os(_0xd7a5d5['mergeChangesIntoContent'](_0x303fa7,_0x224470['contentRawOld'],_0x224470['editor']));}catch(_0x53a0ff){_0x224470['error']=bn(_0x53a0ff,'ai-reviewcoreediting-check-run-failed',this,_0x3623e6);}return _0x224470;});}_collectResultAffectedBlocks(_0x238a26,_0x3215ba,_0x2dc600){return _0x3215ba['filter'](_0x3e5af8=>{const _0x342d3b=_0x2dc600['get'](_0x3e5af8['id']);return!!_0x342d3b&&_0x342d3b['editor']===_0x238a26['editor']&&_0x342d3b['rootName']===_0x238a26['rootName'];})['map'](_0x1df668=>({'id':_0x1df668['id'],'content':_0x1df668['contentNew']}));}_groupElementsByRoot(_0x19a97e){const _0x38be70=new Map();for(const _0x646c of _0x19a97e['values']()){let _0x1e8294=_0x38be70['get'](_0x646c['editor']);_0x1e8294||(_0x1e8294=new Map(),_0x38be70['set'](_0x646c['editor'],_0x1e8294));let _0x506f73=_0x1e8294['get'](_0x646c['rootName']);_0x506f73||(_0x506f73=[],_0x1e8294['set'](_0x646c['rootName'],_0x506f73)),_0x506f73['push'](_0x646c);}return _0x38be70;}_buildDocumentDataSliceForRoot(_0x45cc97,_0x535f5b,_0x129c4c,_0x5c0dea){const _0x38155f=_0x45cc97['model'],_0x3c3200=new _0x5eb9f7();for(const _0x4f2a72 of _0x535f5b['getChildren']())_0x3c3200['_appendChild'](_0x4f2a72['_clone'](!0x0));for(const _0x97c3a8 of _0x38155f['markers']){const _0x55cfb7=_0x97c3a8['getRange']();_0x55cfb7&&_0x55cfb7['root']['rootName']===_0x535f5b['rootName']&&_0x3c3200['markers']['set'](_0x97c3a8['name'],this['_changeRangeOwnerDocument'](_0x55cfb7['clone'](),_0x3c3200));}const _0x513a1d=new Map(),_0x4374aa=_0x38155f['document']['version'];if(Gs(_0x45cc97,_0x535f5b['rootName'])){let _0x539284=this['_inlineRootDataIds']['get'](_0x535f5b);_0x539284?_0x5c0dea['add'](_0x539284):(_0x539284=_0x129c4c['_nextDataId'](_0x5c0dea),this['_inlineRootDataIds']['set'](_0x535f5b,_0x539284));const _0x3ea096=Fs(_0x45cc97['data']['processor']['toData'](_0x45cc97['data']['toView'](_0x3c3200)),_0x539284);return _0x513a1d['set'](_0x539284,{'editor':_0x45cc97,'rootName':_0x535f5b['rootName'],'path':[],'documentVersion':_0x4374aa,'getContent':()=>_0x3ea096}),{'content':_0x3ea096,'elements':_0x513a1d};}const _0x27d082=new _0x2a0ccb({'ignoreElementEnd':!0x0,'startPosition':_0x38155f['createPositionAt'](_0x3c3200,0x0)});for(const {item:_0x10d4a1}of _0x27d082){if(_0x10d4a1['is']('element')&&_0x10d4a1['name']&&Dh['includes'](_0x10d4a1['name'])){const _0x69662c=this['_upsertDataId'](_0x10d4a1,()=>_0x129c4c['_nextDataId'](_0x5c0dea));_0x5c0dea['add'](_0x69662c);}if(!_0x10d4a1['is']('$textProxy'))continue;const _0x3f2317=_0x10d4a1['parent'];if(!_0x3f2317||!_0x3f2317['is']('element'))continue;const _0x297086=this['_upsertDataId'](_0x3f2317,()=>_0x129c4c['_nextDataId'](_0x5c0dea));_0x5c0dea['add'](_0x297086);for(const _0x3ceacb of _0x3f2317['getChildren']())_0x3ceacb['is']('element')&&(_0x3ceacb['name']&&Ph['includes'](_0x3ceacb['name'])||_0x5c0dea['add'](this['_upsertDataId'](_0x3ceacb,()=>_0x129c4c['_nextDataId'](_0x5c0dea))));let _0x4b7935=_0x3f2317;for(;_0x4b7935['parent']&&!_0x4b7935['parent']['is']('documentFragment');)_0x4b7935=_0x4b7935['parent'],_0x4b7935['hasAttribute'](_0x4274f2)&&_0x4b7935['_removeAttribute'](_0x4274f2);_0x513a1d['set'](_0x297086,{'editor':_0x45cc97,'rootName':_0x535f5b['rootName'],'path':_0x3f2317['getPath'](),'documentVersion':_0x4374aa,'getContent':this['_createGetContentUsingDataIdFn'](_0x4b7935['_clone'](!0x0),_0x297086,_0x45cc97['data'])}),_0x27d082['jumpTo'](_0x38155f['createPositionAfter'](_0x3f2317));}return{'content':_0x45cc97['data']['processor']['toData'](_0x45cc97['data']['toView'](_0x3c3200)),'elements':_0x513a1d};}diffContent(_0x328f9b,_0x5dd076,_0x181fb3,_0x21695a=!0x1){const {contentInitial:_0x588981,contentNew:_0x1313ca}=this['_neutralizeChangesOnUnsupportedElements'](_0x5dd076,_0x181fb3),_0x28fbdb=[],_0x57c852=_0x328f9b['data']['parse'](_0x1313ca,'$documentFragment'),_0x3f9de9=_0x328f9b['data']['parse'](_0x588981,'$documentFragment'),_0x28ddcc=_0x328f9b['model']['createPositionAt'](_0x3f9de9,0x0);if(this['_haveSingleTopLevelElement'](_0x57c852)){if(!this['_hasSameTopLevelElement'](_0x3f9de9,_0x57c852))return _0x28fbdb;}else{const _0x2202f8=_0x328f9b['model']['schema'];if(!this['_haveOnlyInlineContent'](_0x3f9de9,_0x2202f8)||!this['_haveOnlyInlineContent'](_0x57c852,_0x2202f8))return _0x28fbdb;}const _0x1190cc=this['context']['plugins']['get']('DocumentCompare')['getDiff'](_0x588981,_0x1313ca,{'targetEditor':_0x328f9b,'anchor':_0x28ddcc,'markDeletions':!0x0})['getOperations']()['filter'](_0x1c8c43=>'insert'===_0x1c8c43['type']||'marker'===_0x1c8c43['type']&&_0x1c8c43['name']['startsWith']('$markedRemove')),_0x297640=this['_groupAdjacentOperations'](_0x1190cc),_0x5349db=[];if(_0x21695a){if(_0x297640['length']){const _0x1b27c9=_0x297640[0x0]['operations'][0x0],_0x4f53fa='insert'===_0x1b27c9['type']?_0x1b27c9['position']:_0x1b27c9['newRange']['start'],_0x18078a=this['_getPositionLimitingRange'](_0x4f53fa,_0x328f9b,'inside'),_0x28bfd7=_0x18078a?_0x57c852['getChild'](0x0)['getChildren']():_0x57c852['getChildren'](),_0x26d581=_0x18078a||_0x328f9b['model']['createRangeIn'](_0x3f9de9),_0x5a3935=[new _0x171060('$markedRemove:synthetic'+kt(),null,_0x26d581,_0x328f9b['model']['document']['model']['markers'],!0x0,_0x328f9b['model']['document']['version']+0x1),new _0x86d081(_0x26d581['end'],_0x28bfd7,_0x328f9b['model']['document']['version']+0x2)];_0x5349db['push']({'operations':_0x5a3935,'operationsIsolated':_0x5a3935,'groupOffset':0x0});}}else _0x5349db['push'](..._0x297640);let _0xd9f53f=0x0;return _0x328f9b['model']['change'](_0x507c10=>{for(let _0x20c44b=0x0;_0x20c44b<_0x5349db['length'];_0x20c44b++){const _0x42a4ee=_0x5349db[_0x20c44b],_0x4be194=_0x507c10['createDocumentFragment']();for(const _0x3c463b of _0x3f9de9['getChildren']())_0x507c10['append'](_0x3c463b['_clone'](!0x0),_0x4be194);for(const _0x9e93bf of _0x42a4ee['operationsIsolated'])if('insert'===_0x9e93bf['type']){const _0x5427a1=_0x9e93bf;_0x5427a1['baseVersion']=null,_0x5427a1['isDocumentOperation']=!0x1,this['_changeOperationOwnerDocument'](_0x5427a1,_0x4be194),_0x507c10['batch']['addOperation'](_0x9e93bf),_0x328f9b['model']['applyOperation'](_0x9e93bf);const _0x2affce='suggestion:insertion:id:authorId:'+_0xd9f53f++,_0x20d0d2=_0x328f9b['model']['createRange'](_0x5427a1['position'],_0x5427a1['position']['getShiftedBy'](_0x5427a1['howMany']));_0x4be194['markers']['set'](_0x2affce,_0x20d0d2);}else{if('marker'===_0x9e93bf['type']&&_0x9e93bf['name']['startsWith']('$markedRemove')){const _0x253a39=_0x9e93bf,_0x49d69d='suggestion:deletion:id:authorId:'+_0xd9f53f++;this['_changeOperationOwnerDocument'](_0x253a39,_0x4be194),_0x4be194['markers']['set'](_0x49d69d,_0x253a39['newRange']);}}if(_0x21695a)_0x28fbdb['push']({..._0x42a4ee,'context':this['_createGetContentFn'](_0x3f9de9,_0x328f9b['data']),'content':this['_createGetContentFn'](_0x3f9de9,_0x328f9b['data'])});else{const _0x5b1cb3=this['_getChangeContext'](this['_changePositionOwnerDocument'](this['_getOperationStart'](_0x42a4ee['operationsIsolated'][0x0]),_0x4be194),this['_changePositionOwnerDocument'](this['_getOperationEnd'](_0x42a4ee['operationsIsolated'][_0x42a4ee['operationsIsolated']['length']-0x1]),_0x4be194),_0x328f9b);_0x4be194['markers']['set'](Lh+'suggestion-context',new _0x2af2ad(_0x5b1cb3['start'],_0x5b1cb3['end'])),_0x28fbdb['push']({..._0x42a4ee,'context':this['_createGetContextFn'](_0x4be194,_0x328f9b['data'],{'ellipsisBefore':_0x5b1cb3['hasContentBefore'],'ellipsisAfter':_0x5b1cb3['hasContentAfter']}),'content':this['_createGetContentFn'](_0x4be194,_0x328f9b['data'])});}}}),_0x28fbdb;}markChangePositionInEditorContent(_0x31ca71,_0x31dc7d){if(!_0x31ca71['length'])return;const _0x4f42b3=_0x31ca71[0x0]['parent']['id'],_0x307f05=_0x31dc7d['elements']['get'](_0x4f42b3);if(!_0x307f05)return void console['warn']('No\x20element\x20found\x20for\x20ID:\x20'+_0x4f42b3);const _0x2eed60=_0x307f05['path'],_0x3a6e52=_0x307f05['editor'],_0x5c8085=_0x3a6e52['model']['document']['getRoot'](_0x307f05['rootName']);if(!_0x5c8085)return void console['warn']('No\x20model\x20root\x20found\x20for\x20name:\x20'+_0x307f05['rootName']);const _0xe4c064=_0x3a6e52['model']['document']['history']['getOperations'](_0x307f05['documentVersion']),_0x43e277=[];for(const _0x268700 of _0x31ca71){const _0x53c47f=_0x268700['operationsIsolated']['map'](_0x1bcbb6=>this['_translateOperationToEditorContent'](_0x1bcbb6,_0x2eed60,_0x5c8085));if(!_0x53c47f||!_0x53c47f['length'])continue;const _0x106041=_0x53c47f['every'](_0x3b59a7=>'marker'===_0x3b59a7['type']&&_0x3b59a7['name']['startsWith']('$markedRemove')),_0x2eaf74=_0x3b7a23(_0x53c47f,_0xe4c064,{'document':_0x3a6e52['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1})['operationsA'];for(const _0xf07be3 of _0x2eaf74)if('insert'===_0xf07be3['type']){const _0x91150b=_0xf07be3,_0x1ae8c2=_0x91150b['nodes'];_0x3a6e52['model']['change'](_0x44d90f=>{const _0x3c570b=_0x44d90f['createDocumentFragment']();for(const _0xdfac34 of _0x1ae8c2)_0x44d90f['append'](_0xdfac34['_clone'](!0x0),_0x3c570b);_0x43e277['push']({'start':_0x91150b['position'],'end':_0x91150b['position'],'type':'insert','groupId':_0x268700['id'],'content':{'asString':this['_createGetContentFn'](_0x3c570b,_0x3a6e52['data'])(),'asFragment':_0x3c570b}});});}else{if('marker'===_0xf07be3['type']&&_0xf07be3['name']['startsWith']('$markedRemove')){const _0x74a328=_0xf07be3;let _0x29cb66='remove-text';if(_0x106041){const _0xfe8137=this['_findAdjacentContextDistance'](_0x74a328['newRange']['start'],'backward',_0x3a6e52['model']['schema']),_0x1bf0f3=this['_findAdjacentContextDistance'](_0x74a328['newRange']['end'],'forward',_0x3a6e52['model']['schema']);if(_0xfe8137||_0x1bf0f3){const _0x5620ff=_0x74a328['newRange']['start']['getShiftedBy'](-_0xfe8137),_0x25602b=_0x74a328['newRange']['end']['getShiftedBy'](_0x1bf0f3);_0x43e277['push']({'start':_0x5620ff,'end':_0x25602b,'groupId':_0x268700['id'],'type':'remove-context'});}else _0x29cb66='remove-only';}_0x43e277['push']({'start':_0x74a328['newRange']['start'],'end':_0x74a328['newRange']['end'],'groupId':_0x268700['id'],'type':_0x29cb66});}}}this['_insertMarkers'](_0x43e277,_0x3a6e52);}['clearAllMarkers'](){const _0x5052a4=new Map();for(const _0x11d784 of this['_markers']['keys']()){const _0x50fb66=this['_markers']['get'](_0x11d784);_0x50fb66?.['editor']&&(_0x5052a4['has'](_0x50fb66['editor'])||_0x5052a4['set'](_0x50fb66['editor'],[]),_0x5052a4['get'](_0x50fb66['editor'])['push'](_0x11d784));}for(const [_0x2d919d,_0x29a268]of _0x5052a4)_0x2d919d['model']['change'](_0x14c14c=>{for(const _0x3969a2 of _0x29a268)_0x2d919d['model']['markers']['get'](_0x3969a2)&&_0x14c14c['removeMarker'](_0x3969a2);});this['_markers']['clear'](),this['_activeMarkers']['clear']();}switchToReadOnly(){for(const _0x43b55f of this['getEditors']())_0x43b55f['enableReadOnlyMode']('ai-review');}switchToEdit(){for(const _0x42db76 of this['getEditors']())_0x42db76['disableReadOnlyMode']('ai-review');}['applyChange'](_0x2bf3f0,_0x5d87bc=null){const _0x19d98e=_0x2bf3f0['map'](_0x255429=>this['_getMarkersDataForGroup'](_0x255429))['flat'](),_0x3acb1a=new Map();for(const _0x545d1e of _0x19d98e)_0x3acb1a['has'](_0x545d1e['editor'])||_0x3acb1a['set'](_0x545d1e['editor'],[]),_0x3acb1a['get'](_0x545d1e['editor'])['push'](_0x545d1e);for(const [_0x2a9581,_0x1c1667]of _0x3acb1a){const _0x228c6e=_0x2a9581['model'],_0x4c16cb=_0x2a9581['plugins']['has']('TrackChangesEditing')?_0x2a9581['plugins']['get']('TrackChangesEditing'):null,_0x4b9750=_0x5d87bc&&_0x4c16cb?new Set(_0x4c16cb['getSuggestions']()['map'](_0x3ecb73=>_0x3ecb73['id'])):null;_0x228c6e['change'](_0xb11341=>{const _0x1b7749=_0xb11341['batch']['operations']['length'];for(const _0x1b3daf of _0x1c1667){const _0x5be233=_0x2a9581['model']['markers']['get'](_0x1b3daf['id']);if(_0x5be233){if('insert'===_0x1b3daf['type']){if(!_0x1b3daf['content'])continue;_0x228c6e['insertContent'](_0x1b3daf['content']['asFragment']||null,_0x5be233['getRange']()['start']);}else'remove-text'!==_0x1b3daf['type']&&'remove-only'!==_0x1b3daf['type']||_0x228c6e['deleteContent'](_0x228c6e['createSelection'](_0x5be233['getRange']()));_0xb11341['removeMarker'](_0x1b3daf['id']),this['_markers']['delete'](_0x1b3daf['id']);}}if(_0x5d87bc&&(mn(_0xb11341['batch']['operations']['slice'](_0x1b7749),_0x5d87bc),_0x4c16cb)){for(const _0x23061f of _0x4c16cb['getSuggestions']())_0x4b9750['has'](_0x23061f['id'])||_0x23061f['setAttribute']('@ai',{'type':_0x5d87bc});}});}}rejectChange(_0x3b6b6f){const _0x18216d=this['_getMarkersDataForGroup'](_0x3b6b6f),_0x35a4db=new Map();for(const _0xc545d4 of _0x18216d)_0x35a4db['has'](_0xc545d4['editor'])||_0x35a4db['set'](_0xc545d4['editor'],[]),_0x35a4db['get'](_0xc545d4['editor'])['push'](_0xc545d4);for(const [_0x5cda8b,_0x905f24]of _0x35a4db)_0x5cda8b['model']['change'](_0x9a738f=>{for(const _0x174699 of _0x905f24)_0x9a738f['removeMarker'](_0x174699['id']),this['_markers']['delete'](_0x174699['id']);});}getEditor(){return Ss(this['context']);}getEditors(){return bs(this['context']);}getEditorForChange(_0x1a4e07){return this['_getMarkersDataForGroup'](_0x1a4e07)[0x0]?.['editor'];}getMarkerElementForChange(_0x3fd4ab){const _0x41c2d6=Array['from'](this['_markers']['values']())['filter'](_0x4ea420=>_0x4ea420['groupId']===_0x3fd4ab);if(!_0x41c2d6['length'])return null;const _0x44f7e0=0x1===_0x41c2d6['length']?_0x41c2d6[0x0]:this['_sortMarkers'](_0x41c2d6)[0x0],_0x25f940=_0x44f7e0['editor']['model']['markers']['get'](_0x44f7e0['id']);return _0x25f940?{'modelRange':_0x25f940['getRange'](),'getElement':()=>this['_findMarkerElementById'](_0x44f7e0['id'])}:null;}getContentElementForChange(_0x2c028c){const _0xf25f5f=Array['from'](this['_markers']['values']())['filter'](_0x102c7e=>_0x102c7e['groupId']===_0x2c028c);if(!_0xf25f5f['length'])return null;const _0x278ae5=0x1===_0xf25f5f['length']?_0xf25f5f[0x0]:this['_sortMarkers'](_0xf25f5f)[0x0],_0x192ef9=_0x278ae5['editor'],_0x5be9d2=_0x192ef9['model']['markers']['get'](_0x278ae5['id']);if(!_0x5be9d2)return null;const _0x12923b=_0x5be9d2['getRange'](),_0x19f0c4=_0x192ef9['editing']['view']['getDomRoot'](_0x12923b['root']['rootName'])||_0x192ef9['editing']['view']['getDomRoot']();if(!_0x19f0c4||!_0x12923b)return null;let _0x2845b7=_0x12923b['start']['parent'];for(;_0x2845b7['parent']&&!_0x2845b7['parent']['is']('rootElement');)_0x2845b7=_0x2845b7['parent'];if(!_0x2845b7||!_0x2845b7['name'])return null;const _0x1f652a=_0x19f0c4['querySelector']('[data-marker-id=\x22'+_0x278ae5['id']+'\x22]');if(!_0x1f652a)return null;if(_0x2845b7['is']('rootElement'))return _0x1f652a;let _0x195272=null;_0x192ef9['model']['change'](_0x516cab=>{_0x195272=_0x516cab['createDocumentFragment'](),_0x516cab['append'](_0x2845b7['_clone'](!0x0),_0x195272);});const _0x59a338=_0x192ef9['data']['toView'](_0x195272)['getChild'](0x0);return _0x1f652a['closest'](_0x59a338['name']);}reactivateMarkers(_0x3cac86){const _0xa60072=this['_getMarkersDataForGroup'](_0x3cac86);if(!_0xa60072['length'])return;const _0x4afa66=Array['from'](this['_activeMarkers'])['sort'](),_0x34a187=Array['from'](new Set(_0xa60072['map'](_0x308a5e=>_0x308a5e['id'])))['sort']();_0x4afa66['join']('|')!==_0x34a187['join']('|')&&(this['setAllMarkersAsInactive'](),this['setMarkersInElementAsActive'](_0x3cac86));}setMarkersInElementAsActive(_0x309bf6){const _0x4051af=this['_getMarkersDataForGroup'](_0x309bf6);if(!_0x4051af['length'])return;const _0x346cf5=_0x4051af[0x0]['editor'],_0x347811=new Set(_0x4051af['map'](_0x5b6f4e=>_0x5b6f4e['id'])),_0x113098=Array['from'](_0x347811['values']())['map'](_0x245bf6=>_0x346cf5['model']['markers']['get'](_0x245bf6))['filter'](_0x1e935a=>!!_0x1e935a);_0x347811['forEach'](_0x59910c=>{this['_activeMarkers']['add'](_0x59910c);}),_0x346cf5['model']['change'](()=>{_0x113098['forEach'](_0x34e7b0=>{_0x346cf5['editing']['reconvertMarker'](_0x34e7b0);});});}setAllMarkersAsInactive(){const _0x5f4506=Array['from'](this['_activeMarkers']);if(!_0x5f4506['length'])return;this['_activeMarkers']['clear']();const _0x1c5916=new Map();for(const _0x4fb849 of _0x5f4506){const _0x4f68c8=this['_markers']['get'](_0x4fb849);if(!_0x4f68c8)continue;const _0x43ce32=_0x4f68c8['editor'],_0x539774=_0x43ce32['model']['markers']['get'](_0x4fb849);_0x539774&&(_0x1c5916['has'](_0x43ce32)||_0x1c5916['set'](_0x43ce32,[]),_0x1c5916['get'](_0x43ce32)['push'](_0x539774));}for(const [_0x47c5c3,_0x3938b1]of _0x1c5916)_0x47c5c3['model']['change'](()=>{_0x3938b1['forEach'](_0x5635f7=>{_0x47c5c3['editing']['reconvertMarker'](_0x5635f7);});});}_getPositionLimitingRange(_0x29725c,_0x347af8,_0x1013f7='outside'){if(!_0x29725c)return null;let _0x4b7bbf=_0x29725c['parent'];for(;_0x4b7bbf&&_0x4b7bbf['parent']&&!_0x4b7bbf['parent']['is']('rootElement')&&!_0x347af8['model']['schema']['isLimit'](_0x4b7bbf)&&!_0x347af8['model']['schema']['isBlock'](_0x4b7bbf);)_0x4b7bbf=_0x4b7bbf['parent'];if(!_0x4b7bbf||!_0x4b7bbf['name']||_0x4b7bbf['is']('rootElement'))return null;let _0x482057=null;return _0x347af8['model']['change'](_0x32da07=>{_0x482057='inside'===_0x1013f7?_0x32da07['createRangeIn'](_0x4b7bbf):_0x32da07['createRangeOn'](_0x4b7bbf);}),_0x482057;}_validateMarkers(_0x1e1da4,_0xa081d6){const _0x2de8e8=Array['from'](this['_markers']['keys']()),_0x5b85b4=new Map();for(const _0x26658c of _0x2de8e8){const _0x386cb8=_0x1e1da4['model']['markers']['get'](_0x26658c);if(!_0x386cb8)continue;const _0x530ba7=_0x386cb8['getStart']()['root']['rootName']+':'+_0x386cb8['getStart']()['path'][0x0];_0x5b85b4['has'](_0x530ba7)||_0x5b85b4['set'](_0x530ba7,[]),_0x5b85b4['get'](_0x530ba7)['push'](_0x386cb8);}const _0x3d57ae=new Set();for(const _0x4a4402 of _0x1e1da4['model']['document']['differ']['getChanges']()){let _0x1d2579,_0x12eb80;if('insert'===_0x4a4402['type'])_0x12eb80=new _0x2af2ad(_0x4a4402['position'],_0x4a4402['position']['getShiftedBy'](_0x4a4402['length'])),_0x1d2579=_0x4a4402['position']['root']['rootName']+':'+_0x4a4402['position']['path'][0x0];else{if('remove'!==_0x4a4402['type'])continue;_0x12eb80=new _0x2af2ad(_0x4a4402['position']),_0x1d2579=_0x4a4402['position']['root']['rootName']+':'+_0x4a4402['position']['path'][0x0];}const _0x2d8ec6=_0x5b85b4['get'](_0x1d2579)||[];if(_0x2d8ec6['length']){for(const _0x406376 of _0x2d8ec6)if(_0x12eb80['root']['rootName']===_0x406376['getRange']()['root']['rootName']&&('insert'!==_0x4a4402['type']||!_0x12eb80['containsRange'](_0x406376['getRange']()))&&(_0x12eb80['isIntersecting'](_0x406376['getRange']())||_0x12eb80['start']['isTouching'](_0x406376['getRange']()['end'])||_0x12eb80['end']['isTouching'](_0x406376['getRange']()['start']))){const _0x526109=this['_parseMarkerName'](_0x406376['name']);Array['from'](this['_markers']['values']())['filter'](_0x38b833=>_0x38b833['groupId']===_0x526109['groupId'])['forEach'](_0x1c88c8=>_0x3d57ae['add'](_0x1c88c8['id']));}}}if(_0x3d57ae['size']){for(const _0x5dfd53 of _0x3d57ae)_0xa081d6['removeMarker'](_0x5dfd53);return!0x0;}return!0x1;}['_handleMarkerChanges'](_0x3599c4){for(const {name:_0xc87313,data:_0x2a46e2}of _0x3599c4['model']['document']['differ']['getChangedMarkers']()){if(!_0xc87313['startsWith'](Lh))continue;const _0x3c9f57=_0x2a46e2['oldRange'],_0x418a68=_0x2a46e2['newRange'],_0x2ab7c5=_0x3c9f57&&'$graveyard'===_0x3c9f57['root']['rootName'],_0x13409d=_0x418a68&&'$graveyard'===_0x418a68['root']['rootName'];if(_0x2ab7c5&&_0x13409d)continue;const _0x17c028=this['_parseMarkerName'](_0xc87313);this['_markers']['get'](_0xc87313)&&(_0x13409d||!_0x418a68?this['_eventEmitter']['fire']('changeMarkerRemoved',{'markerId':_0xc87313,'changeId':_0x17c028['groupId']}):_0x2ab7c5&&_0x418a68&&this['_eventEmitter']['fire']('changeMarkerRestored',{'markerId':_0xc87313,'changeId':_0x17c028['groupId']}));}}['_parseMarkerName'](_0x485c4c){const _0x32e15f=_0x485c4c['split'](':'),_0x4fcca2=(_0x32e15f[0x1]||'')['split']('_');return{'prefix':_0x32e15f[0x0],'groupId':_0x4fcca2[0x0],'suffix':_0x4fcca2[0x1]};}_translateOperationToEditorContent(_0x150517,_0x250fc8,_0x2205fb){if('insert'===_0x150517['type']){const _0xac3dd1=_0x150517;return new _0x86d081(this['_changePosition'](_0x250fc8['concat'](_0xac3dd1['position']['offset']),_0x2205fb),_0xac3dd1['nodes'],_0xac3dd1['baseVersion']);}if('marker'===_0x150517['type']&&_0x150517['name']['startsWith']('$markedRemove')){const _0x4f101c=_0x150517;return new _0x171060(_0x4f101c['name'],_0x4f101c['oldRange'],this['_changeRange'](_0x4f101c['newRange'],_0x250fc8['concat'](_0x4f101c['newRange']['start']['offset']),_0x250fc8['concat'](_0x4f101c['newRange']['end']['offset']),_0x2205fb),_0x4f101c['_markers'],_0x4f101c['affectsData'],_0x4f101c['baseVersion']);}return _0x150517;}_groupAdjacentOperations(_0x44f8e6){if(!_0x44f8e6['length'])return[];const _0x495b27=[];let _0x5d4df1=0x0,_0x1203db=0x0,_0x20323e=[];for(let _0x5672ce=0x0;_0x5672ce<=_0x44f8e6['length'];_0x5672ce++){const _0x41e0d5=_0x44f8e6[_0x5672ce],_0x4cc9f2=_0x44f8e6[_0x5672ce-0x1];!_0x41e0d5||_0x4cc9f2&&!this['_getOperationEnd'](_0x4cc9f2)['isTouching'](this['_getOperationStart'](_0x41e0d5))?(_0x495b27['push']({'operations':_0x20323e,'operationsIsolated':_0x20323e['map'](_0x498fb5=>this['_shiftOperation'](_0x498fb5['clone'](),-_0x1203db)),'groupOffset':_0x5d4df1}),_0x20323e=_0x41e0d5?[_0x41e0d5]:[],_0x1203db+=_0x5d4df1,_0x5d4df1=0x0):_0x20323e['push'](_0x41e0d5),_0x41e0d5&&'insert'===_0x41e0d5['type']&&(_0x5d4df1+=_0x41e0d5['howMany']);}return _0x495b27;}_findAdjacentContextDistance(_0x1a919f,_0x39eb62,_0x4c2a46,_0x3e3967=0x1){const _0x5c0850=new _0x2a0ccb({'startPosition':_0x1a919f,'direction':_0x39eb62});let _0x726d2f=0x0;for(let _0x5355f1=0x0;_0x5355f1<_0x3e3967;_0x5355f1++){let _0x251850=0x0,_0x3b73cc=!0x1,_0x5cdf4e='forward'===_0x39eb62?/^\W*\w+/:/\w+\W*$/;for(const {item:_0x1aac26}of _0x5c0850)if(_0x1aac26['is']('$textProxy')){const _0x591801=_0x5cdf4e['exec'](_0x1aac26['data']);if(_0x591801&&_0x591801['length']){if(_0x251850+='forward'===_0x39eb62?_0x591801['index']+_0x591801[0x0]['length']:_0x1aac26['data']['length']-_0x591801['index'],_0x591801[0x0]['length']!==_0x1aac26['data']['length'])break;_0x3b73cc=!0x0,_0x5cdf4e='forward'===_0x39eb62?/^\w+/:/\w+$/;}else{if(_0x3b73cc)break;_0x251850+=_0x1aac26['offsetSize'];}}else{if(_0x1aac26['is']('element')){_0x4c2a46['isInline'](_0x1aac26)&&!_0x3b73cc&&(_0x251850+=0x1);break;}}_0x726d2f+=_0x251850,_0x5c0850['jumpTo'](_0x1a919f['getShiftedBy']('forward'===_0x39eb62?_0x726d2f:-_0x726d2f));}return _0x726d2f;}_getChangeContext(_0x2d1b7a,_0x620e2b,_0x15980f){const _0x1d3e60=_0x15980f['model']['schema'],_0x3c7bda=this['_findAdjacentContextDistance'](_0x2d1b7a,'backward',_0x1d3e60,0x6),_0x95483a=this['_findAdjacentContextDistance'](_0x620e2b,'forward',_0x1d3e60,0x6),_0x56419c=_0x2d1b7a['getShiftedBy'](-_0x3c7bda),_0x2a0d25=_0x620e2b['getShiftedBy'](_0x95483a);return{'start':_0x56419c,'end':_0x2a0d25,'hasContentBefore':!_0x56419c['isAtStart'],'hasContentAfter':!_0x2a0d25['isAtEnd']};}_insertMarkers(_0x1533a0,_0x1a1228){const _0x26e2d=this['context']['plugins']['get']('AIEditing'),_0x5240b0=new Set();_0x1a1228['model']['change'](_0x21b148=>{for(const _0x42205c of _0x1533a0){const _0x5a51f7=''+Lh+_0x42205c['type']+':'+_0x42205c['groupId']+'_'+_0x26e2d['_nextDataId'](_0x5240b0);this['_markers']['set'](_0x5a51f7,{'id':_0x5a51f7,'groupId':_0x42205c['groupId'],'type':_0x42205c['type'],'content':_0x42205c['content'],'editor':_0x1a1228}),_0x21b148['addMarker'](_0x5a51f7,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x21b148['createRange'](_0x42205c['start'],_0x42205c['end'])});}});}_createGetContextFn(_0x26db13,_0x1581e6,_0x580e2b){let _0x2217d4='';return()=>{if(!_0x2217d4){const _0x4a7e0d=_0x1581e6['toView'](_0x26db13,{'showSuggestionHighlights':!0x0});let _0x3891a5=_0x4a7e0d['getChild'](0x0);if(_0x3891a5['is']('containerElement')||(_0x3891a5=_0x4a7e0d),!_0x3891a5)return'';let _0x4c2bdf=!0x1;const _0x21599b=[];for(const _0x2c28b0 of _0x3891a5['getChildren']())_0x2c28b0['is']('element','span')&&_0x2c28b0['hasClass']('ck-ai_review-marker_context-end')&&(_0x4c2bdf=!0x1),_0x4c2bdf&&_0x21599b['push'](_0x2c28b0),_0x2c28b0['is']('element','span')&&_0x2c28b0['hasClass']('ck-ai_review-marker_context-start')&&(_0x4c2bdf=!0x0);_0x3891a5['_removeChildren'](0x0,_0x3891a5['childCount']),_0x580e2b?.['ellipsisBefore']&&_0x3891a5['_appendChild']('…'),_0x3891a5['_appendChild'](_0x21599b),_0x580e2b?.['ellipsisAfter']&&_0x3891a5['_appendChild']('…');const _0x58b133=_0x1581e6['htmlProcessor']['domConverter']['viewToDom'](_0x4a7e0d),_0x295b49=_0x1581e6['htmlProcessor']['htmlWriter']['getHtml'](_0x58b133);_0x2217d4=this['_removeUnsupportedElements'](_0x295b49);}return _0x2217d4;};}_createGetContentFn(_0x241258,_0x1fe280){let _0x33af08='';return()=>(_0x33af08||(_0x33af08=this['_removeUnsupportedElements'](_0x1fe280['stringify'](_0x241258,{'showSuggestionHighlights':!0x0}))),_0x33af08);}_createGetContentUsingDataIdFn(_0xdd9fbe,_0x1d39dd,_0x1c79b8){let _0x1acda4='';return()=>{if(!_0x1acda4){const _0x30b1ea=_0x1c79b8['toView'](new _0x5eb9f7(_0xdd9fbe));_0x1acda4=_0x1c79b8['htmlProcessor']['domConverter']['viewToDom'](_0x30b1ea)['querySelector']('[data-id=\x22'+_0x1d39dd+'\x22]')?.['outerHTML']||'';}return _0x1acda4;};}_removeUnsupportedElements(_0x244a5e){if(!_0x244a5e)return'';const _0xf67c22=Rs(_0x244a5e,{'decodeEntities':!0x1}),_0x170992=ys(_0xf67c22);if(!_0x170992['length'])return _0x244a5e;for(const _0x389a25 of _0x170992)_0x4ebff9(_0x389a25);return Os(_0xf67c22,{'encodeEntities':!0x1});}_neutralizeChangesOnUnsupportedElements(_0x17dfa1,_0x2706ad){const _0x97fea0=Rs(_0x17dfa1,{'decodeEntities':!0x1}),_0x5365ee=Rs(_0x2706ad,{'decodeEntities':!0x1}),_0xe40cc1=ys(_0x97fea0),_0x4bb1a3=ys(_0x5365ee);if(!_0xe40cc1['length']&&!_0x4bb1a3['length'])return{'contentInitial':_0x17dfa1,'contentNew':_0x2706ad};const _0x58537c=new Map(),_0x494267=new Map();for(const _0x587c63 of _0xe40cc1){const _0x3017e6=Ps(_0x587c63,'data-id');if(_0x3017e6)_0x58537c['set'](_0x3017e6,_0x587c63);else{const _0x32e4d5=Os(_0x587c63,{'encodeEntities':!0x1}),_0x3d8aa7=_0x494267['get'](_0x32e4d5);_0x3d8aa7?_0x3d8aa7['push'](_0x587c63):_0x494267['set'](_0x32e4d5,[_0x587c63]);}}for(const _0x50a55a of _0x4bb1a3){const _0x1ccb83=Ps(_0x50a55a,'data-id');let _0x4f1c3a;if(_0x1ccb83)_0x4f1c3a=_0x58537c['get'](_0x1ccb83);else{const _0x589904=_0x494267['get'](Os(_0x50a55a,{'encodeEntities':!0x1}));_0x4f1c3a=_0x589904&&_0x589904['length']?_0x589904['shift']():void 0x0;}_0x4f1c3a?_0x444916(_0x50a55a,_0x246402(_0x4f1c3a,!0x0)):_0x4ebff9(_0x50a55a);}return{'contentInitial':Os(_0x97fea0,{'encodeEntities':!0x1}),'contentNew':Os(_0x5365ee,{'encodeEntities':!0x1})};}_findMarkerElement(_0x3fa6ed,_0x919512=0x5){let _0x2a435f=_0x3fa6ed,_0x54e0d6=null;for(let _0x59ac82=0x0;_0x59ac82<_0x919512&&_0x2a435f;_0x59ac82++)if(_0x2a435f['className']){if((''+_0x2a435f['className'])['includes']('ck-ai_review-marker_')){if(!_0x2a435f['getAttribute']('data-marker-id'))break;_0x54e0d6=_0x2a435f;break;}_0x2a435f=_0x2a435f['parentElement'];}else _0x2a435f=_0x2a435f['parentElement'];return _0x54e0d6;}_findMarkerElementById(_0x967ea2){const _0x3ac3e3=this['_markers']['get'](_0x967ea2);if(!_0x3ac3e3)return null;const _0x1805d4=_0x3ac3e3['editor']['model']['markers']['get'](_0x967ea2);return _0x1805d4?_0x196856(_0x3ac3e3['editor']['editing'],_0x1805d4):null;}_getMarkersDataForGroup(_0x332a44){return Array['from'](this['_markers']['values']())['filter'](_0xcf39c=>_0xcf39c['groupId']===_0x332a44);}_getOperationStart(_0x59ce16){return'insert'===_0x59ce16['type']?_0x59ce16['position']:_0x59ce16['newRange']['start'];}_getOperationEnd(_0x46f353,_0x268a0b=!0x1){return'insert'===_0x46f353['type']?_0x268a0b?_0x46f353['position']:_0x46f353['position']['getShiftedBy'](_0x46f353['howMany']):_0x46f353['newRange']['end'];}_shiftOperation(_0x44b41a,_0x4b0b29){return'insert'===_0x44b41a['type']?_0x44b41a['position']=_0x44b41a['position']['getShiftedBy'](_0x4b0b29):'marker'===_0x44b41a['type']&&_0x44b41a['newRange']&&(_0x44b41a['newRange']=new _0x2af2ad(_0x44b41a['newRange']['start']['getShiftedBy'](_0x4b0b29),_0x44b41a['newRange']['end']['getShiftedBy'](_0x4b0b29))),_0x44b41a;}_changeOperationOwnerDocument(_0x55d9fe,_0x3b8101){'insert'===_0x55d9fe['type']?_0x55d9fe['position']=this['_changePositionOwnerDocument'](_0x55d9fe['position'],_0x3b8101):'marker'===_0x55d9fe['type']&&_0x55d9fe['newRange']&&(_0x55d9fe['newRange']=this['_changeRangeOwnerDocument'](_0x55d9fe['newRange'],_0x3b8101));}_changePositionOwnerDocument(_0x2befac,_0x397563){return new _0x53921a(_0x397563,_0x2befac['path']);}_changeRangeOwnerDocument(_0x27544c,_0x1fb31c){return new _0x2af2ad(this['_changePositionOwnerDocument'](_0x27544c['start'],_0x1fb31c),this['_changePositionOwnerDocument'](_0x27544c['end'],_0x1fb31c));}_changePosition(_0x5173bb,_0x460732){return new _0x53921a(_0x460732,[..._0x5173bb]);}['_changeRange'](_0x4242cc,_0x1b0cd8,_0x52ffd9,_0x3dc90e){return new _0x2af2ad(this['_changePosition'](_0x1b0cd8,_0x3dc90e),this['_changePosition'](_0x52ffd9,_0x3dc90e));}_sortMarkers(_0x4d0923){const _0x1c6dc8=_0x2e2b2f=>{switch(_0x2e2b2f){case'insert':return 0x0;case'remove-context':return 0x1;case'remove-only':return 0x2;case'remove-text':return 0x3;}};return _0x4d0923['sort']((_0x19190c,_0x1b2e7a)=>_0x1c6dc8(_0x19190c['type'])-_0x1c6dc8(_0x1b2e7a['type']));}_hasSameTopLevelElement(_0x445526,_0x2eb88f){const _0x51591b=_0x445526['getChild'](0x0),_0x286df2=_0x2eb88f['getChild'](0x0);return!(!_0x51591b||!_0x286df2)&&((!_0x51591b['is']('element')||!_0x286df2['is']('element')||_0x51591b['name']===_0x286df2['name'])&&!(_0x51591b['is']('element')&&!_0x286df2['is']('element')||!_0x51591b['is']('element')&&_0x286df2['is']('element')));}_haveSingleTopLevelElement(_0x258490){return 0x1===_0x258490['childCount'];}_haveOnlyInlineContent(_0xcf2b1f,_0x13b256){for(const _0x2c63d0 of _0xcf2b1f['getChildren']())if(_0x2c63d0['is']('element')&&!_0x13b256['isInline'](_0x2c63d0))return!0x1;return!0x0;}_upsertDataId(_0x2c9a1d,_0x46b44e){let _0x2f1f8e=_0x2c9a1d['getAttribute'](_0x4274f2);return _0x2f1f8e||(_0x2f1f8e=_0x46b44e(),_0x2c9a1d['_setAttribute'](_0x4274f2,_0x2f1f8e)),_0x2f1f8e;}};const Mh=/* #__PURE__ -- @preserve */
38
+ dt();var Uh=class extends Mh{['id'];contentNew;contentInitial;documentVersion;constructor({id:_0x51a8c3,contentNew:_0x2ef53f,contentInitial:_0x1e6f94,documentVersion:_0x287964}){super(),this['id']=_0x51a8c3,this['contentNew']=_0x2ef53f,this['contentInitial']=_0x1e6f94,this['documentVersion']=_0x287964;}};const Vh=/* #__PURE__ -- @preserve */
39
+ At();var Bh=class extends Vh{['id'];parent;editor;_data;_editorOperations=[];constructor(_0x3d3b7d,_0x472a63,_0x1aef7e,_0x5001ab){super(),this['id']=_0x3d3b7d,this['parent']=_0x1aef7e,this['editor']=_0x5001ab,this['_data']=_0x472a63,this['set']('isActivated',!0x1),this['set']('isRated',!0x1),this['set']('status','pending'),this['on']('change:status',()=>{'pending'!==this['status']&&this['isActivated']&&(this['isActivated']=!0x1);});}get contentDiffed(){return this['_data']['wrapperTag']?function(_0x15db44){const _0x283ab3=Rs(_0x15db44)['children']['filter'](_0x438723);return 0x1!==_0x283ab3['length']?_0x15db44:_0x283ab3[0x0]['children']['map'](_0x56cdfe=>Os(_0x56cdfe))['join']('');}(this['_data']['context']()):this['_data']['context']();}get['wrapperTag'](){return this['_data']['wrapperTag'];}get operations(){return this['_data']['operations']['slice']();}get operationsIsolated(){return this['_data']['operationsIsolated']['slice']();}};const Gh=/* #__PURE__ -- @preserve */
40
+ At();var Fh=class extends Gh{['id']=kt();['callId'];_results=new Map();['_changes']=[];_hasUnsupportedInlineChange=!0x1;['_sourceCheck'];_documentData;_aiConnector;['_reviewParams'];['_reviewArgs'];_contexts;_activeRequest=null;_currentError;_wasAborted=!0x1;constructor(_0x22edcf,_0x51c1f1,_0x32be6d,_0x3457b8,_0x775b1f,_0xa9aab5){super(),this['_sourceCheck']=_0x51c1f1,this['_documentData']=_0x22edcf,this['_aiConnector']=_0x32be6d,this['_reviewParams']=_0x3457b8,this['_reviewArgs']=_0x775b1f,this['_contexts']=_0xa9aab5,this['on']('change:status',(_0x44530c,_0x47a0a1,_0x1bbf1b)=>{'aborted'==_0x1bbf1b&&(this['_wasAborted']=!0x0),this['fire']('reviewCheckRunUpdated',{'status':_0x1bbf1b,'run':this,'error':this['_currentError']});}),this['set']('status','initialized');}get documentData(){return this['_documentData'];}get['sourceCheck'](){return this['_sourceCheck'];}get processedResultsCount(){return this['_results']['size'];}get hasUnsupportedInlineChange(){return this['_hasUnsupportedInlineChange'];}get title(){return this['_sourceCheck']['title'];}get subTitle(){return'';}get['reviewName'](){return this['_sourceCheck']['id'];}get hasModifications(){return!this['_changes']['every'](_0x5e3981=>'pending'===_0x5e3981['status']);}get currentError(){return this['_currentError'];}get results(){return Array['from'](this['_results']['values']());}updateDocumentData(_0x3fd92c){this['_documentData']=_0x3fd92c;}async start(){this['status']='loading',this['_currentError']=void 0x0;try{this['_activeRequest']=this['_createApiRequest']();const _0x5aedc4=await this['_activeRequest']['getStream']();this['status']='data';for await(const _0x171a06 of _0x5aedc4)'unmodified'!==_0x171a06['data']['operation']&&('error'!==_0x171a06['data']['operation']?'review-metadata'!==_0x171a06['event']?this['_addReviewCheckResult'](_0x171a06['data']['dataId'],_0x171a06['data']['textDelta']):this['callId']=_0x171a06['data']['callId']:this['status']='error-chunk');'error-chunk'!==this['status']&&(0x0===this['_results']['size']||0x0===this['_changes']['length']?this['status']='unmodified':this['status']='ready');}catch(_0x275f4d){this['_currentError']=_0x275f4d,kn(_0x275f4d)?this['status']='aborted':this['status']='error-general';}finally{this['_activeRequest']=null;}}async restart(){this['_results']['clear'](),this['_changes']['length']=0x0,this['_currentError']=void 0x0,this['_hasUnsupportedInlineChange']=!0x1,await this['start']();}addResultChanges(_0x5521c9,_0x26438f){const _0x53c351=this['_results']['get'](_0x5521c9);if(!_0x53c351)return;if(0x0===_0x26438f['length'])return;const _0x207bbd=this['_documentData']['elements']['get'](_0x5521c9);if(!_0x207bbd)return;const _0x4c2715=[];_0x26438f['forEach']((_0x2aa830,_0x357faf)=>{const _0x4d15bb=new Bh(_0x53c351['id']+'-'+_0x357faf,_0x2aa830,_0x53c351,_0x207bbd['editor']);_0x4d15bb['on']('change:status',()=>{this['fire']('reviewCheckResultChangeStatusUpdated',{'change':_0x4d15bb,'status':_0x4d15bb['status']});}),_0x4d15bb['on']('change:isActivated',()=>{_0x4d15bb['isActivated']?this['fire']('reviewCheckResultActivated',{'change':_0x4d15bb}):this['fire']('reviewCheckResultDeactivated',{'change':_0x4d15bb});}),this['_changes']['push'](_0x4d15bb),_0x4c2715['push'](_0x4d15bb);}),this['fire']('reviewCheckResultReady',{'changes':_0x4c2715,'result':_0x53c351,'source':this});}abort(){this['_activeRequest']&&(this['_activeRequest']['abortController']['abort'](),this['_activeRequest']=null,this['status']='aborted');}isChangeActive(_0x220da3){const _0x2a1905=this['_changes']['find'](_0x2b3d1e=>_0x2b3d1e['id']===_0x220da3);return!(!_0x2a1905||'pending'!==_0x2a1905['status']);}isAnyChangeActivated(){return this['_changes']['some'](_0x46ee60=>!0x0===_0x46ee60['isActivated']);}getActiveChanges(){return this['_changes']['filter'](_0x16153e=>'pending'===_0x16153e['status']);}getChangeById(_0x122b1f){return this['_changes']['find'](_0x4cc1f1=>_0x4cc1f1['id']===_0x122b1f);}markAllChangesAsAccepted(){for(const _0x46398c of this['_changes'])'pending'===_0x46398c['status']&&(_0x46398c['status']='accepted');this['_checkIfFinished']();}markChangeAsAccepted(_0x275ca7){const _0x2c5f0d=this['_changes']['find'](_0x377d56=>_0x377d56['id']===_0x275ca7);_0x2c5f0d&&'pending'===_0x2c5f0d['status']&&(_0x2c5f0d['status']='accepted'),this['_checkIfFinished']();}markChangeAsRejected(_0x280569){const _0x56719f=this['_changes']['find'](_0x188e26=>_0x188e26['id']===_0x280569);_0x56719f&&'pending'===_0x56719f['status']&&(_0x56719f['status']='rejected'),this['_checkIfFinished']();}markChangeAsOutdated(_0xc37ba7){const _0x4b53cf=this['_changes']['find'](_0x387c9a=>_0x387c9a['id']===_0xc37ba7);_0x4b53cf&&'pending'===_0x4b53cf['status']&&(_0x4b53cf['status']='outdated'),this['_checkIfFinished']();}['markChangeAsPending'](_0x3af95a){const _0x5d3659=this['_changes']['find'](_0x65bd38=>_0x65bd38['id']===_0x3af95a);_0x5d3659&&'outdated'===_0x5d3659['status']&&(_0x5d3659['status']='pending'),this['_checkIfFinished']();}activateChange(_0x1fe74f){this['_changes']['filter'](_0x4aa71d=>_0x4aa71d['isActivated']&&_0x4aa71d['id']!==_0x1fe74f)['forEach'](_0x256ddb=>{_0x256ddb['isActivated']=!0x1;});const _0x496a57=this['_changes']['find'](_0x2dcd17=>_0x2dcd17['id']===_0x1fe74f);_0x496a57&&'pending'===_0x496a57['status']&&(_0x496a57['isActivated']=!0x0);}deactivateChange(){this['_changes']['filter'](_0x5cc8eb=>_0x5cc8eb['isActivated'])['forEach'](_0x201631=>{_0x201631['isActivated']=!0x1;});}forceReadyState(){this['status']='ready';}async sendRating(_0x63bf95){if('initialized'===this['status']||'loading'===this['status']||'data'===this['status']||this['_wasAborted'])return;if(!this['callId']||0x0===this['_changes']['length'])return;let _0x3aab46;if(_0x63bf95){const _0x1dfd30=this['_changes']['find'](_0x2a8e44=>_0x2a8e44['id']===_0x63bf95);if(_0x1dfd30&&_0x1dfd30['isRated'])return;_0x1dfd30&&(_0x3aab46=_0x1dfd30['parent']['id'],_0x1dfd30['isRated']=!0x0);}const _0x3bff84={'positiveCount':this['_changes']['filter'](_0x5893c2=>'accepted'===_0x5893c2['status'])['length'],'totalCount':this['_changes']['length']};this['_sendRatingRequest'](_0x3bff84,this['callId'],_0x3aab46);}_addReviewCheckResult(_0x5e4934,_0x83c69e){const _0x253897=this['_documentData']['elements']['get'](_0x5e4934);if(!_0x253897)return;if(Gs(_0x253897['editor'],_0x253897['rootName'])&&!Ys(_0x253897['editor'],Rs(_0x83c69e)))return void(this['_hasUnsupportedInlineChange']=!0x0);const _0x52f64c=_0x253897['getContent']();if(_0x52f64c===_0x83c69e)return;const _0x51aca7=new Uh({'id':_0x5e4934,'contentInitial':_0x52f64c,'contentNew':_0x83c69e,'documentVersion':_0x253897['documentVersion']});this['_results']['set'](_0x51aca7['id'],_0x51aca7),this['fire']('reviewCheckResultAdded',{'result':_0x51aca7,'source':this,'editor':_0x253897['editor'],'rootName':_0x253897['rootName']});}['_checkIfFinished'](){'finished'===this['status']&&this['_changes']['filter'](_0x49d83c=>'pending'===_0x49d83c['status'])['length']>0x0&&(this['status']='ready'),'ready'===this['status']&&0x0===this['_changes']['filter'](_0x2d2b8b=>'pending'===_0x2d2b8b['status'])['length']&&(this['status']='finished');}},Kh=class extends Fh{get subTitle(){if(!this['_reviewParams']||0x0===this['_reviewParams']['length'])return'';const _0x153475=[];if(this['_reviewParams']['length']>0x0&&this['_sourceCheck']['options'])for(let _0x41612c=0x0;_0x41612c<this['_reviewParams']['length'];_0x41612c++){if(!this['_reviewParams'][_0x41612c]||!this['_sourceCheck']['options'][_0x41612c])continue;const _0x25e77c=this['_sourceCheck']['options'][_0x41612c]['data']?.['find'](_0x206300=>_0x206300['id']===this['_reviewParams'][_0x41612c]);_0x25e77c&&_0x153475['push'](_0x25e77c['label']);}return _0x153475['join'](',\x20');}get['reviewName'](){return this['_composeReviewName']();}_createApiRequest(){return this['_aiConnector']['callSystemReview']({'reviewName':this['_composeReviewName'](),'content':this['_documentData']['content'],'args':this['_reviewArgs'],'contexts':this['_contexts']});}_sendRatingRequest(_0x5d37fa,_0x5069bf,_0x4677ef){return this['_aiConnector']['upsertAIReviewRating'](this['reviewName'],_0x5069bf,_0x5d37fa,_0x4677ef);}['_composeReviewName'](){return!this['_reviewParams']||0x0===this['_reviewParams']['length']||this['_sourceCheck']['useArgs']?this['_sourceCheck']['apiId']:[this['_sourceCheck']['apiId'],...this['_reviewParams']]['join']('-');}},Wh=class extends _0x212144{_aiConnector;['_aiReviewCoreUi'];_aiReviewCoreEditing;['_availableReviewChecks'];_reporter;_currentReviewCheckRun;_changeActivationSource=null;static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){this['_initRequiredPlugins'](),this['_initAvailableReviewChecks'](),this['_initUIListeners']();}async _initAvailableReviewChecks(){this['_availableReviewChecks']=await this['_getReviewChecks'](),this['_aiReviewCoreUi']['setAvailableChecks'](this['_availableReviewChecks']);}_initUIListeners(){this['listenTo'](this['_aiReviewCoreUi'],'getReviewCheckList',()=>{this['_availableReviewChecks']&&this['_aiReviewCoreUi']['setAvailableChecks'](this['_availableReviewChecks']);}),this['listenTo'](this['_aiReviewCoreUi'],'runReviewCheck',(_0x320c61,_0x1e1be2)=>this['runCheck'](_0x1e1be2)),this['listenTo'](this['_aiReviewCoreUi'],'leaveReview',()=>{this['_onReviewRunLeave']();}),this['listenTo'](this['_aiReviewCoreUi'],'leaveReviewCoreResultList',()=>{this['_onReviewRunLeave'](!0x0);}),this['listenTo'](this['_aiReviewCoreUi'],'abortReviewStream',()=>this['abort']()),this['listenTo'](this['_aiReviewCoreUi'],'finishReview',()=>{this['_onReviewRunLeave'](!0x0);}),this['listenTo'](this['_aiReviewCoreUi'],'acceptAllChanges',()=>{if(!this['_currentReviewCheckRun'])return;const _0x2e7b7c=this['_currentReviewCheckRun']['getActiveChanges']();if(!_0x2e7b7c['length'])return;this['_aiReviewCoreEditing']['applyChange'](_0x2e7b7c['map'](_0x19e246=>_0x19e246['id']),this['_aiSource']);const _0x5d4fca=this['_currentReviewCheckRun'];_0x5d4fca['markAllChangesAsAccepted'](),_0x5d4fca['sendRating']();}),this['listenTo'](this['_aiReviewCoreUi'],'acceptChange',(_0x597968,_0x4164d3)=>{this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['isChangeActive'](_0x4164d3['id'])&&(this['_aiReviewCoreEditing']['applyChange']([_0x4164d3['id']],this['_aiSource']),this['_currentReviewCheckRun']['markChangeAsAccepted'](_0x4164d3['id']),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_currentReviewCheckRun']['sendRating'](_0x4164d3['id']));}),this['listenTo'](this['_aiReviewCoreUi'],'dismissChange',(_0x3a5bee,_0x4f4ff8)=>{this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['isChangeActive'](_0x4f4ff8['id'])&&(this['_aiReviewCoreEditing']['rejectChange'](_0x4f4ff8['id']),this['_currentReviewCheckRun']['markChangeAsRejected'](_0x4f4ff8['id']),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_currentReviewCheckRun']['sendRating'](_0x4f4ff8['id']));}),this['listenTo'](this['_aiReviewCoreUi'],'retryReview',async()=>{this['_currentReviewCheckRun']&&(this['_aiReviewCoreEditing']['clearAllMarkers'](),this['_aiReviewCoreUi']['setAcceptAllEnabled'](!0x1),this['_currentReviewCheckRun']['updateDocumentData'](this['_aiReviewCoreEditing']['getDocumentData']()),await this['_currentReviewCheckRun']['restart']());}),this['listenTo'](this['_aiReviewCoreUi'],'activateChange',(_0x4e195d,_0x171f11)=>{this['_onActivateChange'](_0x171f11);}),this['listenTo'](this['_aiReviewCoreUi'],'deactivateChange',(_0x359206,_0x3d6cf4)=>{this['_onDeactivateChange'](_0x3d6cf4);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerClicked',(_0xebf68d,_0xba26f8)=>{this['_onChangeMarkerClicked'](_0xebf68d,_0xba26f8);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerHovered',(_0x43ad40,_0x573f8a)=>{this['_onChangeMarkerHovered'](_0x43ad40,_0x573f8a);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerBlurred',()=>{this['_onChangeMarkerBlurred']();}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerRemoved',(_0x4b862d,_0x38419e)=>{this['_onChangeMarkerRemoved'](_0x4b862d,_0x38419e);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerRestored',(_0x19bf2c,_0x104db6)=>{this['_onChangeMarkerRestored'](_0x19bf2c,_0x104db6);});}async['runCheck'](_0x4c6e6a){if(!this['_availableReviewChecks'])return;const _0x11ebe7=this['_availableReviewChecks']['find'](_0x4a713e=>_0x4a713e['id']===_0x4c6e6a['id']);if(!_0x11ebe7)return void this['_logError'](new ct('ai-review-mode-source-check-not-found',this,{'checkId':_0x4c6e6a['id']}));this['_onReviewCheckRun'](_0x4c6e6a),this['_aiReviewCoreEditing']['switchToReadOnly'](),this['_aiReviewCoreUi']['setAcceptAllEnabled'](!0x1);const _0x46fa53=this['context']['plugins']['get'](fs)['contextLibrary']['resolveContext']({'feature':this['_defaultContextFeature'],'ids':[_0x4c6e6a['id']],'context':new Yn()});this['_currentReviewCheckRun']=this['_createReviewCheckRun'](_0x4c6e6a,_0x11ebe7,_0x46fa53);const _0x88896c=this['_currentReviewCheckRun'];_0x88896c['on']('reviewCheckResultChangeStatusUpdated',(_0x20d02e,_0x5a2527)=>{this['_aiReviewCoreUi']['updateChangeState'](_0x5a2527['change']['id'],_0x5a2527['status']),this['_pushAcceptAllEnabled'](_0x88896c);}),this['_aiReviewCoreUi']['setCheckResultTitle'](this['_currentReviewCheckRun']['title'],this['_currentReviewCheckRun']['subTitle']),this['_currentReviewCheckRun']['on']('reviewCheckRunUpdated',(_0x216909,_0x521258)=>{switch(_0x521258['status']){case'data':case'loading':this['_aiReviewCoreUi']['showCheckRunResults'](_0x521258);break;case'finished':this['_onCheckRunFinished']();break;case'ready':this['_currentReviewCheckRun']?.['hasUnsupportedInlineChange']?this['_aiReviewCoreUi']['showUnsupportedInlineChangeView']():this['_aiReviewCoreUi']['showActionsWhenResultIsReady']();break;case'unmodified':this['_currentReviewCheckRun']?.['hasUnsupportedInlineChange']?this['_aiReviewCoreUi']['showUnsupportedInlineChangeView']():this['_aiReviewCoreUi']['showNoChangesView']();break;case'error-general':this['_aiReviewCoreUi']['showGeneralResultsErrorView'](),this['_logError'](new ct('ai-review-mode-check-run-general-error',this,void 0x0,this['_currentReviewCheckRun']?.['currentError']));break;case'error-chunk':this['_aiReviewCoreUi']['showChunkErrorView'](),this['_logError'](new ct('ai-review-mode-check-run-chunk-error',this,void 0x0,this['_currentReviewCheckRun']?.['currentError']));break;case'aborted':this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['processedResultsCount']>0x0?setTimeout(()=>{this['_currentReviewCheckRun']?.['forceReadyState']();},0x0):this['_onReviewRunLeave'](!0x0);}'ready'!==_0x521258['status']&&'error-chunk'!==_0x521258['status']&&'error-general'!==_0x521258['status']||this['_currentReviewCheckRun']?.['sendRating']();}),this['_currentReviewCheckRun']['on']('reviewCheckResultAdded',(_0x2977f3,_0x3f664e)=>{if(!this['_currentReviewCheckRun'])throw new ct('ai-review-mode-no-current-check-run',this);const _0x47d547=Gs(_0x3f664e['editor'],_0x3f664e['rootName']);let _0x376666=_0x3f664e['result']['contentInitial'],_0x130d07=_0x3f664e['result']['contentNew'];_0x47d547&&(_0x376666=Ws(_0x376666),_0x130d07=Ws(_0x130d07));const _0x5cc97b=this['_diffContent'](_0x3f664e['editor'],_0x376666,_0x130d07);if(_0x47d547){const _0xd045aa=_0x3f664e['editor']['ui']['getEditableElement'](_0x3f664e['rootName'])?.['tagName']['toLowerCase']();for(const _0x4c3eda of _0x5cc97b)_0x4c3eda['wrapperTag']=_0xd045aa;}_0x3f664e['source']['addResultChanges'](_0x3f664e['result']['id'],_0x5cc97b);}),this['_currentReviewCheckRun']['on']('reviewCheckResultReady',(_0x59aea6,_0xb3e476)=>{for(const _0x1e1c2b of _0xb3e476['changes'])this['_aiReviewCoreUi']['showCheckRunResult'](_0x1e1c2b);this['_pushAcceptAllEnabled'](_0xb3e476['source']),this['_markChangePositionInEditorContent'](_0xb3e476['changes'],_0xb3e476['source']['documentData']);}),this['_currentReviewCheckRun']['on']('reviewCheckResultActivated',(_0x2c13d5,_0xce020f)=>{this['_onReviewCheckResultActivated'](_0xce020f);}),this['_currentReviewCheckRun']['on']('reviewCheckResultDeactivated',()=>{this['_onReviewCheckResultDeactivated']();});try{await this['_currentReviewCheckRun']['start']();}catch(_0x263f83){if(kn(_0x263f83))return;_0x263f83 instanceof ct?this['_logError'](_0x263f83):this['_logError'](new ct('ai-review-mode-check-run-failed',this,void 0x0,_0x263f83));}}abort(){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['abort']();}getAvailableChecks(){return(this['_availableReviewChecks']??[])['slice']();}getCurrentCheckRun(){return this['_currentReviewCheckRun'];}_pushAcceptAllEnabled(_0x16f457){this['_aiReviewCoreUi']['setAcceptAllEnabled'](_0x16f457['getActiveChanges']()['length']>0x0);}_createReviewCheckRun(_0x23700c,_0x33a160,_0x402907=new Yn()){return new Kh(this['_aiReviewCoreEditing']['getDocumentData'](),_0x33a160,this['_aiConnector'],_0x23700c['params'],_0x23700c['args'],_0x402907['refs']);}['_onChangeMarkerRemoved'](_0x2b2585,_0x2f4fb2){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['markChangeAsOutdated'](_0x2f4fb2['changeId']);}_onChangeMarkerRestored(_0x59e92b,_0x2bf8e4){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['markChangeAsPending'](_0x2bf8e4['changeId']);}['_onCheckRunFinished'](){this['_aiReviewCoreUi']['showReviewCompletedView']();}_initRequiredPlugins(){this['_aiConnector']=this['context']['plugins']['get']('AIConnector'),this['_reporter']=this['context']['plugins']['get'](Nn)['createReporter']('aireview');}['_onReviewRunLeave'](_0x26a3b5=!0x1){this['_currentReviewCheckRun']&&(this['_currentReviewCheckRun']['hasModifications']||this['_currentReviewCheckRun']['sendRating'](),this['_currentReviewCheckRun']['stopListening'](),this['_currentReviewCheckRun']['abort'](),this['_currentReviewCheckRun']=void 0x0),_0x26a3b5&&this['_aiReviewCoreUi']['showReviewCheckList'](),this['_aiReviewCoreEditing']['clearAllMarkers'](),this['_aiReviewCoreEditing']['switchToEdit'](),this['_changeActivationSource']=null;for(const _0x2eaf72 of this['_aiReviewCoreEditing']['getEditors']())_0x2eaf72['editing']['view']['change'](_0x38f62a=>{for(const _0x2a9984 of _0x2eaf72['editing']['view']['document']['getRoots']())_0x38f62a['removeClass']('ck-ai_review-diff',_0x2a9984),_0x38f62a['removeClass']('ck-ai_review-highlights',_0x2a9984),_0x38f62a['removeClass']('ck-ai-translate-mode-content',_0x2a9984);});}['_logError'](_0x3ef0de){this['_reporter']['logError'](_0x3ef0de),'ai-review-mode-models-unable-to-retrieve'===function(_0x35bf8c){return _0x35bf8c instanceof yn?_0x35bf8c['code']:_0x35bf8c instanceof Error?_0x35bf8c['message']['match'](/^\S+/)?.[0x0]:void 0x0;}(_0x3ef0de)?this['_aiReviewCoreUi']['showGeneralReviewCoreErrorView']():this['_aiReviewCoreUi']['showGeneralResultsErrorView']();}['_scrollToChange'](_0x5db99b){if('content'===this['_changeActivationSource']){const _0x183d3e=this['_aiReviewCoreUi']['getChangeElement'](_0x5db99b);_0x183d3e&&Rt(_0x183d3e['closest']('.ck-ai_review__check-run-result')||_0x183d3e);}else{if('panel'===this['_changeActivationSource']){const _0x3b3f40=this['_getChangeContentElement'](_0x5db99b);if(!_0x3b3f40)return;Ot({'target':_0x3b3f40,'viewportOffset':{'top':0x55,'left':0x0,'bottom':0x0,'right':0x0},'ancestorOffset':0x14,'alignToTop':!0x0});}}}},Yh=class extends Fh{_prompt;['_model'];constructor(_0x405b23,_0x5283df,_0x3c73ae,_0x5d0f71,_0x4e8eeb,_0x382ebb){super(_0x3c73ae,_0x5d0f71,_0x4e8eeb,void 0x0,void 0x0,_0x382ebb),this['_prompt']=_0x405b23,this['_model']=_0x5283df;}get subTitle(){return this['_prompt']??'';}_createApiRequest(){return this['_aiConnector']['callCustomReview']({'content':this['_documentData']['content'],...void 0x0!==this['_prompt']&&{'prompt':this['_prompt']},'model':this['_model'],'contexts':this['_contexts']});}_sendRatingRequest(_0x596c4a,_0x3da051,_0xf887e3){return this['_aiConnector']['upsertCustomAIReviewRating'](_0x3da051,_0x596c4a,_0xf887e3);}},$h=class{['id'];['commandId'];title;description;isParameterized;['useArgs'];options;['args'];get['apiId'](){return this['commandId'];}constructor(_0xc34345){this['id']=_0xc34345['id'],this['commandId']=_0xc34345['commandId'],this['title']=_0xc34345['title'],this['description']=_0xc34345['description'],this['isParameterized']=_0xc34345['isParameterized'],this['useArgs']=_0xc34345['useArgs'],this['options']=_0xc34345['options'],this['args']=_0xc34345['args'];}},qh=class extends $h{isExtra=!0x0;prompt;context;['model'];_defaultModel=null;constructor(_0x495cd3,_0x211977,_0x98dc0a){super(_0x495cd3),this['prompt']=_0x495cd3['prompt'],this['context']=_0x495cd3['context'],this['model']=_0x495cd3['model'],this['model']?this['_defaultModel']=_0x211977['find'](_0x227c15=>_0x227c15['id']===this['model'])||null:this['_defaultModel']=_0x98dc0a;}get defaultModel(){return this['_defaultModel'];}},Qh=class extends Yh{get subTitle(){return'';}set prompt(_0x54c5bb){this['_prompt']=_0x54c5bb;}set['model'](_0x24e1ee){this['_model']=_0x24e1ee;}},Xh=class extends _0x212144{static get requires(){return[Is,Nn];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['_cache'];_reporter;init(){this['_reporter']=this['context']['plugins']['get'](Nn)['createReporter']('aireview');}getChecksList(){return this['_cache']||(this['_cache']=this['_loadChecksList']()),this['_cache'];}};const zh=[{'id':'custom','commandId':'custom','title':'Custom\x20command','description':'Type\x20a\x20custom\x20command\x20to\x20review\x20the\x20content\x20exactly\x20as\x20you\x20need.','isParameterized':!0x0},{'id':'correctness','commandId':'correctness','title':'Correctness','description':'Ensure\x20the\x20text\x20is\x20factually\x20accurate\x20and\x20free\x20of\x20errors.','isParameterized':!0x1},{'id':'clarity','commandId':'clarity','title':'Clarity','description':'Improve\x20the\x20clarity\x20and\x20readability\x20of\x20the\x20text.','isParameterized':!0x1},{'id':'readability','commandId':'readability','title':'Readability','description':'Enhance\x20the\x20overall\x20readability\x20of\x20the\x20text.','isParameterized':!0x1},{'id':'length','commandId':'make','title':'Adjust\x20length','description':'Refine\x20text\x20length\x20to\x20match\x20your\x20needs.','isParameterized':!0x0,'options':[{'formType':'dropdown','label':'Adjust\x20length','default':'longer','data':[{'label':'Longer','id':'longer'},{'label':'Shorter','id':'shorter'}]}]},{'id':'tone','commandId':'make-tone','title':'Adjust\x20tone\x20and\x20style','description':'Choose\x20tone\x20and\x20style\x20to\x20change\x20content\x20as\x20you\x20need.','isParameterized':!0x0,'options':[{'formType':'dropdown','label':'Adjust\x20tone\x20and\x20style','default':'casual','data':[{'label':'Casual','id':'casual'},{'label':'Direct','id':'direct'},{'label':'Friendly','id':'friendly'},{'label':'Confident','id':'confident'},{'label':'Professional','id':'professional'}]}]}],jh=/* #__PURE__ -- @preserve */
41
+ At();var Jh=class extends jh{['_checks']=[];setupChecks(_0x5ef3a9){this['_checks']=_0x5ef3a9['map'](_0x118191=>new $h(_0x118191));}get['checks'](){return this['_checks']['slice']();}getCheckById(_0x412f9e){return this['checks']['find'](_0xfae965=>_0xfae965['id']===_0x412f9e);}['removeCheckById'](_0x28807c){this['_checks']=this['_checks']['filter'](_0xa79a3f=>_0xa79a3f['id']!==_0x28807c);}},Zh=class extends $h{['_models']=[];_defaultModel=null;constructor(_0x174fc1,_0x3ba9e3,_0x33c4ab){super(_0x174fc1),this['_models']=_0x3ba9e3,this['_defaultModel']=_0x33c4ab;}get['models'](){return this['_models']['slice']();}get defaultModel(){return this['_defaultModel'];}},tc=class extends Jh{['_allModels']=[];['_recommendedModels']=[];_defaultModel=null;constructor(_0x240ae7,_0x3863bc,_0x2f2707){super(),this['_allModels']=_0x240ae7,this['_recommendedModels']=_0x3863bc,this['_defaultModel']=_0x2f2707;}get['allModels'](){return this['_allModels']['slice']();}setupChecks(_0x346763){this['_checks']=_0x346763['map'](_0x15ea47=>!0x0===_0x15ea47['isExtra']?new qh(_0x15ea47,this['_allModels'],this['_defaultModel']):'custom'===_0x15ea47['id']?new Zh(_0x15ea47,this['_recommendedModels'],this['_defaultModel']):new $h(_0x15ea47));}},ec=class extends Xh{static get['pluginName'](){return'AIReviewModeCheckRegistry';}static get requires(){return[Is,Nn,fs];}['_modelsLoadError']=null;constructor(_0x2dba09){super(_0x2dba09),this['context']['config']['define']('ai.review.extraCommands',[]);}get['modelsLoadError'](){return this['_modelsLoadError'];}getExtraChecks(){return this['context']['config']['get']('ai.review.extraCommands')['map'](_0x5ca1bc=>({'id':_0x5ca1bc['id'],'commandId':_0x5ca1bc['id'],'title':_0x5ca1bc['label'],'description':_0x5ca1bc['description'],'isParameterized':!0x1,'isExtra':!0x0,'prompt':_0x5ca1bc['prompt'],'context':_0x5ca1bc['context'],'model':_0x5ca1bc['model']}));}async _loadChecksList(){const _0x4b268a=[...zh,...this['getExtraChecks']()]['map'](_0x501174=>_0x501174['isExtra']?_0x501174:this['_translateReviewCheck'](_0x501174)),_0x41410a=this['context']['plugins']['get'](fs);let _0x178f88;try{_0x178f88=new tc(await _0x41410a['models']['getAllModels'](),await _0x41410a['models']['getAvailableModels'](),await _0x41410a['models']['getDefault']()),this['_modelsLoadError']=null;}catch(_0x24adce){this['_modelsLoadError']=new ct('ai-review-mode-models-unable-to-retrieve',this,void 0x0,_0x24adce),this['_reporter']['logError'](this['_modelsLoadError'],{'context':{'operation':'load-review-models'}}),_0x178f88=new tc([],[],null);}return _0x178f88['setupChecks'](_0x4b268a),_0x178f88;}_translateReviewCheck(_0x2b5ff2){const _0x30a129='AI_REVIEW_CHECK_'+_0x2b5ff2['commandId']['toUpperCase']()['replaceAll']('-','_'),_0x18f324={..._0x2b5ff2,'title':this['_translate'](_0x30a129+'_TITLE',_0x2b5ff2['title']),'description':this['_translate'](_0x30a129+'_DESCRIPTION',_0x2b5ff2['description'])};return _0x2b5ff2['options']&&(_0x18f324['options']=_0x2b5ff2['options']['map'](_0x189be4=>({..._0x189be4,'label':this['_translate'](_0x30a129+'_OPTIONS_LABEL',_0x189be4['label']||''),'data':_0x189be4['data']?_0x189be4['data']['map'](_0x39c9fc=>({..._0x39c9fc,'label':this['_translate'](_0x30a129+'_OPTIONS_DATA_'+_0x39c9fc['id']['toUpperCase'](),_0x39c9fc['label'])})):void 0x0}))),_0x18f324;}_translate(_0x5903c8,_0x513368){const _0x3ee3a5=Es(this['context']['locale'],_0x5903c8);return _0x3ee3a5===_0x5903c8?_0x513368:_0x3ee3a5;}},ic=class extends Wh{static get['pluginName'](){return'AIReviewModeController';}static get requires(){return[Nn,ec,fs];}get['_aiSource'](){return'review';}get _defaultContextFeature(){return'review';}['_isDiffOn']=!0x1;['_usesAvailableCommandsConfig'];constructor(_0x356ff0){super(_0x356ff0),this['_usesAvailableCommandsConfig']=Boolean(this['context']['config']['get']('ai.review.availableCommands')),this['context']['config']['define']('ai.review.availableCommands',zh['map'](_0x184d25=>_0x184d25['id']));}init(){super['init'](),this['listenTo'](this['_aiReviewCoreUi'],'toggleDiff',(_0xebaa0b,_0x31c7c1)=>{this['_isDiffOn']=_0x31c7c1['on'],this['_onDiffChange'](this['_isDiffOn']);});}_initRequiredPlugins(){super['_initRequiredPlugins'](),this['_aiReviewCoreUi']=this['context']['plugins']['get']('AIReviewModeUI'),this['_aiReviewCoreEditing']=this['context']['plugins']['get']('AIReviewCoreEditing');}_createReviewCheckRun(_0x557ffd,_0x540d6e,_0x37b07a=new Yn()){if(_0x557ffd['isCustom'])return new Yh(_0x557ffd['args']['prompt'],_0x557ffd['args']['model'],this['_aiReviewCoreEditing']['getDocumentData'](),_0x540d6e,this['_aiConnector'],_0x37b07a['refs']);if(_0x540d6e['isExtra']){const _0xec897f=_0x540d6e,_0x107e75=_0xec897f['context']?_0x37b07a['cloneWith'](_0xec897f['context'])['refs']:_0x37b07a['refs'];return new Qh(_0x557ffd['args']?.['prompt']??_0xec897f['prompt'],_0x557ffd['args']?.['model']??_0xec897f['defaultModel']['id'],this['_aiReviewCoreEditing']['getDocumentData'](),_0x540d6e,this['_aiConnector'],_0x107e75);}return new Kh(this['_aiReviewCoreEditing']['getDocumentData'](),_0x540d6e,this['_aiConnector'],_0x557ffd['params'],_0x557ffd['args'],_0x37b07a['refs']);}_onReviewCheckResultActivated(_0x5857d0){this['_aiReviewCoreUi']['setActiveStateInResults'](_0x5857d0['change']['id']),this['_scrollToChange'](_0x5857d0['change']['id']);const _0x3c5ae3=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x5857d0['change']['id']);if(!_0x3c5ae3)return;const _0x5dfed1=this['_aiReviewCoreEditing']['getEditorForChange'](_0x5857d0['change']['id'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x5857d0['change'],()=>_0x3c5ae3['getElement'](),void 0x0,'click',this['_getBalloonDomRoot'](_0x5dfed1,_0x3c5ae3['modelRange']['root']['rootName']),_0x5dfed1?.['ui']?.['viewportOffset']),this['_aiReviewCoreEditing']['setMarkersInElementAsActive'](_0x5857d0['change']['id']);}_onReviewCheckResultDeactivated(){this['_aiReviewCoreUi']['resetActiveStateInResults'](),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_aiReviewCoreEditing']['setAllMarkersAsInactive']();}_onActivateChange(_0x5b82ed){this['_currentReviewCheckRun']&&'click'===_0x5b82ed['uiInteraction']&&(this['_changeActivationSource']='panel',this['_currentReviewCheckRun']['activateChange'](_0x5b82ed['id']));}_onDeactivateChange(_0x4a92d3){this['_currentReviewCheckRun']&&'balloon'===_0x4a92d3['origin']&&this['_currentReviewCheckRun']['deactivateChange']();}['_onChangeMarkerClicked'](_0x49ce9a,_0x1dac76){if(!this['_currentReviewCheckRun'])return;this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x1dac76['changeId']);const _0x41cfb3=this['_currentReviewCheckRun']['getChangeById'](_0x1dac76['changeId']);if(!_0x41cfb3)return;const _0x4a2382=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x1dac76['changeId']),_0x86da73=this['_aiReviewCoreEditing']['getEditorForChange'](_0x1dac76['changeId'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x41cfb3,_0x1dac76['markerElement'],_0x1dac76['domEvent'],'click',this['_getBalloonDomRoot'](_0x86da73,_0x4a2382?.['modelRange']['root']['rootName']),_0x86da73?.['ui']?.['viewportOffset']);}['_onChangeMarkerHovered'](_0x23ca81,_0x5c4197){if(!this['_currentReviewCheckRun'])return;if(this['_currentReviewCheckRun']['isAnyChangeActivated']())return;const _0xbe6452=this['_currentReviewCheckRun']['getChangeById'](_0x5c4197['changeId']);if(!_0xbe6452)return;const _0x1eea04=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x5c4197['changeId']),_0x41ebee=this['_aiReviewCoreEditing']['getEditorForChange'](_0x5c4197['changeId'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0xbe6452,_0x5c4197['markerElement'],_0x5c4197['domEvent'],'hover',this['_getBalloonDomRoot'](_0x41ebee,_0x1eea04?.['modelRange']['root']['rootName']),_0x41ebee?.['ui']?.['viewportOffset']);}['_onChangeMarkerBlurred'](){this['_currentReviewCheckRun']&&(this['_currentReviewCheckRun']['isAnyChangeActivated']()||this['_aiReviewCoreUi']['hideChangeBalloon']());}_getChangeContentElement(_0x175ce0){const _0x3185cf=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x175ce0);return _0x3185cf?_0x3185cf['getElement']():null;}_markChangePositionInEditorContent(_0x34c69d,_0x104f3f){this['_aiReviewCoreEditing']['markChangePositionInEditorContent'](_0x34c69d,_0x104f3f);}_diffContent(_0x278f6f,_0xfe1f8,_0x19ba54){return this['_aiReviewCoreEditing']['diffContent'](_0x278f6f,_0xfe1f8,_0x19ba54,!0x1);}['_onReviewCheckRun'](){this['_onDiffChange'](this['_isDiffOn']);}['_onDiffChange'](_0x1d0be5){_0x1d0be5?this['_aiReviewCoreUi']['hideDiffInBalloon']():this['_aiReviewCoreUi']['showDiffInBalloon']();for(const _0x552789 of this['_aiReviewCoreEditing']['getEditors']())_0x552789['editing']['view']['change'](_0x16a6e7=>{for(const _0x37b514 of _0x552789['editing']['view']['document']['getRoots']()){for(const _0x433b24 of _0x37b514['getClassNames']())_0x433b24['startsWith']('ck-ai_review-')&&_0x16a6e7['removeClass'](_0x433b24,_0x37b514);_0x16a6e7['addClass'](_0x1d0be5?'ck-ai_review-diff':'ck-ai_review-highlights',_0x37b514);}});}_getBalloonDomRoot(_0xbf8933,_0x218142){const _0x126031=_0xbf8933['editing']['view'];if(_0x218142){const _0x41ac1c=_0x126031['getDomRoot'](_0x218142);if(_0x41ac1c)return _0x41ac1c;}return _0x126031['getDomRoot']()??void 0x0;}async _getReviewChecks(){const _0x1dbadf=this['context']['plugins']['get']('AIReviewModeCheckRegistry'),_0x5e588b=await _0x1dbadf['getChecksList']();_0x1dbadf['modelsLoadError']&&this['_logError'](_0x1dbadf['modelsLoadError']);let _0x3f2758=_0x5e588b['checks'];const _0x402db4=this['context']['config']['get']('ai.review.availableCommands');return this['_logWarningForNonExistentChecks'](_0x402db4,_0x3f2758),this['_usesAvailableCommandsConfig']&&(_0x3f2758=_0x402db4['map'](_0x28bf42=>_0x3f2758['find'](_0x2ad90d=>_0x2ad90d['id']===_0x28bf42))['filter'](_0x162bb2=>!!_0x162bb2)),this['_filterChecksWithMissingModel'](_0x3f2758);}_logWarningForNonExistentChecks(_0x121712,_0x35548b){const _0x3a126a=_0x121712['filter'](_0x32955f=>!_0x35548b['some'](_0x120772=>_0x120772['id']===_0x32955f));_0x3a126a['length']&&this['_reporter']['logError'](new yn({'code':'ai-review-mode-non-existent-commands-used','severity':'warning','context':{'commandIds':_0x3a126a['join'](',\x20')}}));}_filterChecksWithMissingModel(_0x219d23){const _0x1c647b=[];return _0x219d23['forEach'](_0x571ab5=>{(_0x571ab5 instanceof qh&&!_0x571ab5['defaultModel']||_0x571ab5 instanceof Zh&&!_0x571ab5['models']['length'])&&_0x1c647b['push'](_0x571ab5['id']);}),_0x1c647b['length']&&_0x1c647b['forEach'](_0x4b830f=>{_0x219d23=_0x219d23['filter'](_0x59525b=>_0x59525b['id']!==_0x4b830f),this['_reporter']['logError'](new yn({'code':'ai-review-mode-command-unavailable-due-to-missing-model','context':{'commandId':_0x4b830f}}));}),_0x219d23;}},sc=class extends _0x212144{static get['pluginName'](){return'AIReviewGateway';}static get requires(){return[Hh,ec,Is,tn,Tn,fs];}get['models'](){return this['context']['plugins']['get'](fs)['models'];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async getAllCommands(){return(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['map'](_0x4d1ea5=>{const _0x1fad13={'id':_0x4d1ea5['id'],'title':_0x4d1ea5['title'],'description':_0x4d1ea5['description']};return'custom'!==_0x4d1ea5['id']&&_0x4d1ea5['options']?.['length']&&(_0x1fad13['parameters']=_0x4d1ea5['options'][0x0]['data']['map'](_0xae901f=>({..._0xae901f}))),_0x1fad13;});}async['runReview'](_0xd6a4a8,_0x3c04e3){const _0x2aad19=await this['_resolveReviewCheck'](_0xd6a4a8),_0x5cb155=this['context']['plugins']['get']('AIReviewCoreEditing'),_0x23d12b=this['context']['plugins']['get']('AIConnector'),_0x3cff5b=_0x5cb155['getDocumentData']({'roots':_0x3c04e3?.['roots']}),_0x36d85f=this['_createReviewCheckRun'](_0x2aad19,_0x3cff5b,_0x23d12b,_0x3c04e3?.['parameterId'],_0x3c04e3?.['contexts']);return _0x5cb155['runCheck'](_0x36d85f,{'signal':_0x3c04e3?.['signal']});}async runCustomReview(_0x206a79,_0xb1d770){const {reviewCheck:_0x4519d1,resolvedModel:_0x3223fa}=await this['_resolveCustomReviewCheck'](_0x206a79,_0xb1d770?.['model']),_0x4eb4a7=this['context']['plugins']['get']('AIReviewCoreEditing'),_0x27a38e=this['context']['plugins']['get']('AIConnector'),_0x294a4f=new Yh(_0x206a79,_0x3223fa,_0x4eb4a7['getDocumentData']({'roots':_0xb1d770?.['roots']}),_0x4519d1,_0x27a38e,_0xb1d770?.['contexts']);return _0x4eb4a7['runCheck'](_0x294a4f,{'signal':_0xb1d770?.['signal']});}['applyReview'](_0x211d7b,_0x3f9df7){this['context']['plugins']['get']('AIGateway')['apply'](_0x211d7b,{'aiSource':'review',..._0x3f9df7});}async['_resolveReviewCheck'](_0x59ba12){const _0x3090b6=(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['find'](_0x477cfd=>_0x477cfd['id']===_0x59ba12);if(!_0x3090b6)throw new ct('ai-reviewgateway-unknown-command',this,{'checkId':_0x59ba12});if(_0x3090b6 instanceof Zh)throw new ct('ai-reviewgateway-not-a-system-command',this,{'checkId':_0x59ba12});if(_0x3090b6 instanceof qh&&!_0x3090b6['defaultModel']?.['id'])throw new ct('ai-reviewgateway-missing-custom-command-model',this,{'checkId':_0x59ba12});return _0x3090b6;}async _resolveCustomReviewCheck(_0x53b1ed,_0x36ae44){const _0x506d7a='custom',_0xe5c70c=(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['find'](_0x200fb3=>_0x200fb3['id']===_0x506d7a);if(!_0xe5c70c)throw new ct('ai-reviewgateway-unknown-command',this,{'checkId':_0x506d7a});if(!(_0xe5c70c instanceof Zh))throw new ct('ai-reviewgateway-not-a-custom-command',this,{'checkId':_0x506d7a});if(!_0x53b1ed)throw new ct('ai-reviewgateway-missing-custom-command-prompt',this,{'checkId':_0x506d7a});const _0x8d60d7=_0x36ae44??_0xe5c70c['defaultModel']?.['id'];if(!_0x8d60d7)throw new ct('ai-reviewgateway-missing-custom-command-model',this,{'checkId':_0x506d7a});return{'reviewCheck':_0xe5c70c,'resolvedModel':_0x8d60d7};}_createReviewCheckRun(_0x4417f3,_0xc07fc7,_0x4b4187,_0x5b567e,_0x29917a=[]){if(_0x4417f3 instanceof qh){const _0x4c727f=_0x4417f3['context']?[..._0x29917a,_0x4417f3['context']]:_0x29917a;return new Qh(_0x4417f3['prompt'],_0x4417f3['defaultModel']['id'],_0xc07fc7,_0x4417f3,_0x4b4187,_0x4c727f);}return new Kh(_0xc07fc7,_0x4417f3,_0x4b4187,_0x5b567e?[_0x5b567e]:void 0x0,void 0x0,_0x29917a);}},nc=class extends _0x212144{static get requires(){return[ic,Nh,Hh,sc];}static get['pluginName'](){return'AIReviewMode';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async startReview(_0x55ee26,_0x125c68){if(this['assertStartReviewPreconditions'](_0x55ee26)instanceof Zh)throw new ct('ai-reviewmode-not-a-system-command',this,{'commandId':_0x55ee26});nh(this['context'],'reviewMode'),await this['context']['plugins']['get']('AIReviewModeController')['runCheck']({'id':_0x55ee26,'params':_0x125c68?.['parameterId']?[_0x125c68['parameterId']]:void 0x0});}async startCustomReview(_0x35e5dc,_0x1d6c9d){if(!_0x35e5dc)throw new ct('ai-reviewmode-missing-custom-command-prompt',this);const _0x2e148a=zh['find'](_0x19d9e1=>'custom'===_0x19d9e1['commandId'])['id'],_0x1edda6=this['assertStartReviewPreconditions'](_0x2e148a),_0x710f40=_0x1d6c9d?.['model']??_0x1edda6['defaultModel']?.['id'];if(!_0x710f40)throw new ct('ai-reviewmode-missing-custom-command-model',this);nh(this['context'],'reviewMode'),await this['context']['plugins']['get']('AIReviewModeController')['runCheck']({'id':_0x2e148a,'isCustom':!0x0,'args':{'prompt':_0x35e5dc,'model':_0x710f40}});}getAvailableCommands(){return this['context']['plugins']['get']('AIReviewModeController')['getAvailableChecks']()['map'](_0x5237c9=>{const _0x102d59={'id':_0x5237c9['id'],'title':_0x5237c9['title'],'description':_0x5237c9['description']};return'custom'!==_0x5237c9['id']&&_0x5237c9['options']?.['length']&&(_0x102d59['parameters']=_0x5237c9['options'][0x0]['data']['map'](_0x245d6b=>({..._0x245d6b}))),_0x102d59;});}assertStartReviewPreconditions(_0x33a560){const _0x10b264=this['context']['plugins']['get']('AIReviewModeController');if(_0x10b264['getCurrentCheckRun']())throw new ct('ai-reviewmode-review-already-running',this);const _0xa6e862=_0x10b264['getAvailableChecks']()['find'](_0x3f06a7=>_0x3f06a7['id']===_0x33a560);if(!_0xa6e862)throw new ct('ai-reviewmode-unknown-command',this,{'commandId':_0x33a560});return _0xa6e862;}},rc=class extends Kh{_title;constructor(_0x44be6b,_0x5d05e0,_0x2fd4cc,_0x4380f6,_0x431743,_0x3898a4,_0x147cb8){super(_0x44be6b,_0x5d05e0,_0x2fd4cc,_0x431743,_0x3898a4,_0x147cb8),this['_title']=_0x4380f6;}get title(){return this['_title'];}get subTitle(){return this['_sourceCheck']['title'];}},oc=class extends $h{get['apiId'](){return'translate';}},ac=class extends Jh{setupChecks(_0x369c7b){this['_checks']=_0x369c7b['map'](_0x5dde85=>new oc(_0x5dde85));}};const hc=[{'label':'English','id':'english'},{'label':'Spanish','id':'spanish'},{'label':'French','id':'french'},{'label':'German','id':'german'},{'label':'Chinese\x20(Simplified)','id':'chinese'},{'label':'Japanese','id':'japanese'},{'label':'Russian','id':'russian'},{'label':'Portuguese','id':'portuguese'},{'label':'Korean','id':'korean'},{'label':'Italian','id':'italian'}];var cc=class extends Xh{static get['pluginName'](){return'AITranslateCheckRegistry';}constructor(_0x1f9f90){super(_0x1f9f90),this['context']['config']['define']('ai.translate.languages',hc);}async _loadChecksList(){const _0x27073c=[],_0x207e9d=this['context']['config']['get']('ai.translate.languages')||[];for(const _0x29cfc6 of _0x207e9d)_0x27073c['push']({'title':_0x29cfc6['label'],'id':_0x29cfc6['id'],'commandId':_0x29cfc6['id'],'description':'','isParameterized':!0x1,'useArgs':!0x0,'args':{'language':_0x29cfc6['id']}});const _0x10636f=new ac();return _0x10636f['setupChecks'](this['_translateChecks'](_0x27073c)),_0x10636f;}_translateChecks(_0x2458d7){const _0x16df42=this['context']['locale'];return _0x2458d7['map'](_0x4fbc21=>{const _0x27e888='AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_'+_0x4fbc21['title']['toUpperCase']()['replaceAll']('-','_'),_0x5d5e65=Es(_0x16df42,_0x27e888);return{..._0x4fbc21,'title':_0x5d5e65===_0x27e888?_0x4fbc21['title']:_0x5d5e65};});}},lc=class extends Wh{static get['pluginName'](){return'AITranslateController';}static get requires(){return[Nn,cc,fs];}get['_aiSource'](){return'translate';}get _defaultContextFeature(){return'translate';}['_onCheckRunFinished'](){this['_onReviewRunLeave'](!0x0);}_initRequiredPlugins(){super['_initRequiredPlugins'](),this['_aiReviewCoreUi']=this['context']['plugins']['get']('AITranslateUI'),this['_aiReviewCoreEditing']=this['context']['plugins']['get']('AIReviewCoreEditing');}_createReviewCheckRun(_0x4d8fb6,_0x4c4c67,_0x42f1ca){return new rc(this['_aiReviewCoreEditing']['getDocumentData'](),_0x4c4c67,this['_aiConnector'],Es(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),_0x4d8fb6['params'],_0x4d8fb6['args'],_0x42f1ca?.['refs']);}_onReviewCheckResultActivated(_0x811bab){this['_aiReviewCoreUi']['setActiveStateInResults'](_0x811bab['change']['id']),this['_aiReviewCoreEditing']['setMarkersInElementAsActive'](_0x811bab['change']['id']);}_onReviewCheckResultDeactivated(){this['_aiReviewCoreEditing']['setAllMarkersAsInactive'](),this['_aiReviewCoreUi']['resetActiveStateInResults']();}_onActivateChange(_0x41a533){this['_currentReviewCheckRun']&&('hover'===_0x41a533['uiInteraction']&&(this['_changeActivationSource']='panel',this['_currentReviewCheckRun']['activateChange'](_0x41a533['id'])),'click'===_0x41a533['uiInteraction']&&this['_scrollToChange'](_0x41a533['id']));}_onDeactivateChange(_0x4ff9f8){this['_currentReviewCheckRun']&&'panel'===_0x4ff9f8['origin']&&this['_currentReviewCheckRun']['deactivateChange']();}['_onChangeMarkerClicked'](_0x3c1f95,_0x3ea9a7){this['_currentReviewCheckRun']&&(this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x3ea9a7['changeId']),this['_scrollToChange'](_0x3ea9a7['changeId']));}['_onChangeMarkerHovered'](_0x4c03c8,_0x78db64){this['_currentReviewCheckRun']&&(this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x78db64['changeId']),this['_aiReviewCoreEditing']['reactivateMarkers'](_0x78db64['changeId']));}['_onChangeMarkerBlurred'](){this['_currentReviewCheckRun']&&'content'===this['_changeActivationSource']&&(this['_currentReviewCheckRun']['deactivateChange'](),this['_aiReviewCoreEditing']['setAllMarkersAsInactive']());}_getChangeContentElement(_0x144e44){return this['_aiReviewCoreEditing']['getContentElementForChange'](_0x144e44);}_markChangePositionInEditorContent(_0x56d154,_0x5e17b6){this['_aiReviewCoreEditing']['markChangePositionInEditorContent'](_0x56d154,_0x5e17b6);}_diffContent(_0x206455,_0x4ced38,_0x5d1c10){return this['_aiReviewCoreEditing']['diffContent'](_0x206455,_0x4ced38,_0x5d1c10,!0x0);}['_onReviewCheckRun'](){for(const _0x22ccd9 of this['_aiReviewCoreEditing']['getEditors']())_0x22ccd9['editing']['view']['change'](_0x495707=>{for(const _0x508cf4 of _0x22ccd9['editing']['view']['document']['getRoots']())_0x495707['addClass']('ck-ai-translate-mode-content',_0x508cf4);});}async _getReviewChecks(){return(await this['context']['plugins']['get']('AITranslateCheckRegistry')['getChecksList']())['checks'];}},uc=class extends fh{constructor(_0x1a5216,_0x3b233b){super(_0x1a5216,_0x3b233b),this['on']('set:isLoading',(_0x32f958,_0x79fb90,_0x4a23f1)=>{_0x4a23f1&&(this['headerTitle']=Es(this['locale'],'AI_TRANSLATE_CHECK_RESULTS_LOADING_TITLE'));}),this['on']('set:isResultReady',(_0x947a2c,_0x5d9cca,_0x10b9ab)=>{_0x10b9ab&&(this['headerTitle']=Es(this['locale'],'AI_TRANSLATE_CHECK_RESULTS_READY_TITLE'));});}_createAcceptAllButtonView(){const _0x16ed59=super['_createAcceptAllButtonView']();return _0x16ed59['set']('label',Es(this['locale'],'AI_TRANSLATE_ACCEPT_ALL')),_0x16ed59;}_createExitReviewButtonView(){const _0x386f8d=super['_createExitReviewButtonView']();return _0x386f8d['set']('label',Es(this['locale'],'AI_CHAT_HISTORY_CANCEL')),_0x386f8d;}},dc=class extends yh{_setupTemplate(){const _0x188f6d=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-translate__check-list-wrapper',_0x188f6d['if']('isVisible','ck-hidden',_0x8bd7ed=>!_0x8bd7ed)]},'children':[{'tag':'div','attributes':{'class':['ck-ai-translate__check-list-header']},'children':[{'tag':'h2','children':[{'text':Es(this['locale'],'AI_TRANSLATE_CHECK_LIST_HEADER_TITLE')}]},{'tag':'p','children':[{'text':Es(this['locale'],'AI_TRANSLATE_CHECK_LIST_HEADER_DESCRIPTION')}]}]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list',_0x188f6d['if']('isVisible','ck-hidden',_0x1026b1=>!_0x1026b1)]},'children':this['_checkViews']}]});}},_c=class extends mh{static get['pluginName'](){return'AITranslateUI';}createMainView(){const _0x2f3698=this['context']['plugins']['get']('AITabs'),_0x38be9c=this['context']['locale'],_0x58a57f=new ua(_0x38be9c,{'label':Es(_0x38be9c,'AI_REVIEW_CHECK_TRANSLATE_TITLE'),'icon':_0x1bcc6c,'class':'ck-ai-header_review-translate','showResizeButton':_0x2f3698['showResizeButton']});_0x58a57f['delegate']('resizeTabs')['to'](_0x2f3698),_0x58a57f['bind']('isMaximized')['to'](_0x2f3698['view'],'isMaximized',_0x1b42ab=>_0x1b42ab);const _0x2f9872=new wh(_0x38be9c,{'header':_0x58a57f,'list':new dc(_0x38be9c),'results':new uc(_0x38be9c,{'generalErrorText':Es(_0x38be9c,'AI_TRANSLATE_GENERAL_ERROR_MESSAGE')}),'completed':new bh(_0x38be9c,{'headerText':Es(_0x38be9c,'AI_TRANSLATE_FINISH_HEADER_TITLE'),'emptyResultsText':Es(_0x38be9c,'AI_TRANSLATE_EMPTY_RESULTS_TEXT'),'buttonText':Es(_0x38be9c,'AI_TRANSLATE_FINISH_BUTTON_LABEL')})});return _0x2f9872['extendTemplate']({'attributes':{'class':'ck-ai-translate-mode'}}),_0x2f9872;}registerTab(){const _0x39c5a1=this['context']['plugins']['get']('AITabs');_0x39c5a1['view']['on']('activateTab',(_0x53b709,{newTab:_0x3ff20e,oldTab:_0x4dc03a})=>{'translate'===_0x3ff20e?this['fire']('getReviewCheckList'):'translate'===_0x4dc03a&&this['fire']('leaveReview');}),_0x39c5a1['view']['addTab']({'id':'translate','buttonLabel':Es(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),'buttonIcon':_0x1bcc6c,'order':0x0,'content':this['_mainView']});}},gc=class extends _0x212144{static get['pluginName'](){return'AITranslateGateway';}static get requires(){return[Hh,Is,tn,Tn];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async runTranslate(_0x52e411,_0x873227){const _0x1b4659=this['context']['plugins']['get']('AIReviewCoreEditing'),_0x213c4f=this['context']['plugins']['get']('AIConnector'),_0x8ac477=new oc({'id':_0x52e411,'commandId':_0x52e411,'title':_0x52e411,'description':'','isParameterized':!0x1}),_0x178d9b=new Kh(_0x1b4659['getDocumentData']({'roots':_0x873227?.['roots']}),_0x8ac477,_0x213c4f,void 0x0,{'language':_0x52e411},_0x873227?.['contexts']);return _0x1b4659['runCheck'](_0x178d9b,{'signal':_0x873227?.['signal']});}applyTranslate(_0x39db61,_0x5923f4){this['context']['plugins']['get']('AIGateway')['apply'](_0x39db61,_0x5923f4);}},Ac=class extends _0x212144{static get requires(){return[lc,_c,Hh,gc];}static get['pluginName'](){return'AITranslate';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async startTranslate(_0x156e51){const _0x5c99a0=this['assertStartTranslatePreconditions'](_0x156e51);nh(this['context'],'translate'),await this['context']['plugins']['get']('AITranslateController')['runCheck']({'id':_0x5c99a0['id'],'args':_0x5c99a0['useArgs']?_0x5c99a0['args']:void 0x0});}getAvailableLanguages(){return this['context']['plugins']['get']('AITranslateController')['getAvailableChecks']()['map'](_0x1a7273=>({'id':_0x1a7273['id'],'label':_0x1a7273['title']}));}assertStartTranslatePreconditions(_0x36adc9){const _0x10f9e1=this['context']['plugins']['get']('AITranslateController');if(_0x10f9e1['getCurrentCheckRun']())throw new ct('ai-translate-translation-already-running',this);const _0x3a986b=_0x10f9e1['getAvailableChecks']()['find'](_0xb605a3=>_0xb605a3['id']===_0x36adc9);if(!_0x3a986b)throw new ct('ai-translate-unknown-language',this,{'languageId':_0x36adc9});return _0x3a986b;}};export{gh as AIActions,Li as AIAdapter,ss as AIAssistant,ts as AIAssistantUI,Va as AIBalloon,ka as AIChat,er as AIChatController,ho as AIChatFeedCustomElementView,va as AIChatHistory,Oa as AIChatHistoryController,Ca as AIChatHistoryUI,Xn as AIChatInteraction,La as AIChatShortcuts,Aa as AIChatUI,xh as AICheckRunSingleRootResult,Is as AIConnector,Yn as AIContext,Cs as AIContextLibrary,fs as AICore,yn as AICoreError,vn as AIDocumentProcessingGateway,Rn as AIDocumentProcessingRunResult,tn as AIEditing,Wa as AIEditorIntegration,xn as AIErrorReporter,Nn as AIErrorSink,Tn as AIGateway,Fn as AIInteraction,Ts as AIModels,Ah as AIQuickActions,ih as AIQuickActionsUI,Vn as AIReply,Pi as AIRequestError,$h as AIReviewCheck,Uh as AIReviewCheckResult,Bh as AIReviewCheckResultChange,Fh as AIReviewCheckRun,sc as AIReviewGateway,nc as AIReviewMode,Wh as AIReviewModeController,Hh as AIReviewModeEditing,Nh as AIReviewModeUI,On as AIRunResult,Sn as AIRunSingleRootResult,gs as AITabs,_s as AITabsMainView,ls as AITabsView,rs as AITextAdapter,Da as AIToggleButtonUI,Ac as AITranslate,lc as AITranslateController,gc as AITranslateGateway,_c as AITranslateUI,as as AWSTextAdapter,os as OpenAITextAdapter,Hi as ShowAIAssistantCommand,Pa as ToggleAICommand,Hn as createResizeButton,ns as getDefaultAICommands,mn as markOperationsAsAI};