@ckeditor/ckeditor5-ai 48.1.0 → 48.2.0-alpha.0

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 (205) hide show
  1. package/dist/aiactions/model/aiactionsinteraction.d.ts +3 -0
  2. package/dist/aiactions/model/aiactionsreply.d.ts +7 -0
  3. package/dist/aiballoon/aiballoon.d.ts +2 -5
  4. package/dist/aichat/aichatballoon.d.ts +4 -0
  5. package/dist/aichat/aichatcontroller.d.ts +9 -3
  6. package/dist/aichat/aichatui.d.ts +11 -0
  7. package/dist/aichat/model/aichatcontext.d.ts +29 -62
  8. package/dist/aichat/model/aichatconversation.d.ts +18 -23
  9. package/dist/aichat/model/aichatinteraction.d.ts +0 -9
  10. package/dist/aichat/ui/aichatballoonview.d.ts +4 -0
  11. package/dist/aichat/ui/aichatcontrolsview.d.ts +5 -0
  12. package/dist/aichat/ui/aichatfeedview.d.ts +8 -0
  13. package/dist/aichat/ui/aichatview.d.ts +1 -0
  14. package/dist/aichat/ui/controls/aichatcontextpanelview.d.ts +4 -0
  15. package/dist/aichat/ui/controls/aichatdropzoneview.d.ts +26 -0
  16. package/dist/aichat/ui/controls/resources/aichatresourcesballoonview.d.ts +4 -0
  17. package/dist/aichat/utils/eventnames.d.ts +1 -1
  18. package/dist/aichat/utils/parsesingleurl.d.ts +5 -0
  19. package/dist/aichat/utils/readdatatransferfiles.d.ts +14 -0
  20. package/dist/aichat/utils/resolvepaste.d.ts +71 -0
  21. package/dist/aichatshortcuts/ui/aichatshortcutsview.d.ts +6 -0
  22. package/dist/aiconfig.d.ts +1 -1
  23. package/dist/aicore/aiconnector.d.ts +22 -0
  24. package/dist/aicore/aiediting.d.ts +14 -5
  25. package/dist/aicore/aigateway.d.ts +63 -0
  26. package/dist/aicore/model/aicontext.d.ts +4 -20
  27. package/dist/aicore/model/aiinteraction.d.ts +7 -1
  28. package/dist/aicore/model/aireply.d.ts +20 -17
  29. package/dist/aicore/model/airunresult.d.ts +95 -0
  30. package/dist/aicore/pipeline/airesponseapplier.d.ts +3 -15
  31. package/dist/aicore/ui/suggestioncontainer/aisuggestioncontentpartheaderview.d.ts +4 -0
  32. package/dist/aicore/ui/suggestioncontainer/aisuggestioncontentparttoolbarview.d.ts +4 -0
  33. package/dist/aicore/ui/suggestioncontainer/aisuggestioncontentpartview.d.ts +4 -0
  34. package/dist/aicore/utils/{geteditorfromcontext.d.ts → geteditorsfromcontext.d.ts} +1 -2
  35. package/dist/aicore/utils/getoperationsfromreply.d.ts +6 -4
  36. package/dist/aicore/utils/getsuggestionpartsfromreply.d.ts +6 -3
  37. package/dist/aicore/utils/htmlparser.d.ts +8 -2
  38. package/dist/aiquickactions/aiquickactions.d.ts +4 -4
  39. package/dist/aiquickactions/aiquickactionsui.d.ts +1 -1
  40. package/dist/aiquickactions/ui/aiquickactionsdropdowncontentview.d.ts +2 -2
  41. package/dist/aireviewcore/aireviewcorecheckregistry.d.ts +34 -0
  42. package/dist/aireviewcore/aireviewcorecontroller.d.ts +31 -6
  43. package/dist/aireviewcore/aireviewcoreediting.d.ts +1 -1
  44. package/dist/aireviewcore/model/aireviewcheckrun.d.ts +4 -0
  45. package/dist/aireviewmode/aireviewgateway.d.ts +161 -0
  46. package/dist/aireviewmode/aireviewmode.d.ts +60 -2
  47. package/dist/aireviewmode/aireviewmodecheckregistry.d.ts +39 -0
  48. package/dist/aireviewmode/aireviewmodecontroller.d.ts +7 -2
  49. package/dist/aireviewmode/model/aireviewmodechecklist.d.ts +4 -0
  50. package/dist/aireviewmode/model/aireviewrunresult.d.ts +20 -0
  51. package/dist/aitranslate/aitranslatecheckregistry.d.ts +27 -0
  52. package/dist/aitranslate/aitranslatecontroller.d.ts +2 -2
  53. package/dist/augmentation.d.ts +11 -1
  54. package/dist/index-content.css +1 -1
  55. package/dist/index-editor.css +212 -8
  56. package/dist/index.css +212 -8
  57. package/dist/index.d.ts +7 -3
  58. package/dist/index.js +6 -6
  59. package/dist/translations/af.js +1 -1
  60. package/dist/translations/af.umd.js +1 -1
  61. package/dist/translations/ar.js +1 -1
  62. package/dist/translations/ar.umd.js +1 -1
  63. package/dist/translations/ast.js +1 -1
  64. package/dist/translations/ast.umd.js +1 -1
  65. package/dist/translations/az.js +1 -1
  66. package/dist/translations/az.umd.js +1 -1
  67. package/dist/translations/be.js +1 -1
  68. package/dist/translations/be.umd.js +1 -1
  69. package/dist/translations/bg.js +1 -1
  70. package/dist/translations/bg.umd.js +1 -1
  71. package/dist/translations/bn.js +1 -1
  72. package/dist/translations/bn.umd.js +1 -1
  73. package/dist/translations/bs.js +1 -1
  74. package/dist/translations/bs.umd.js +1 -1
  75. package/dist/translations/ca.js +1 -1
  76. package/dist/translations/ca.umd.js +1 -1
  77. package/dist/translations/cs.js +1 -1
  78. package/dist/translations/cs.umd.js +1 -1
  79. package/dist/translations/da.js +1 -1
  80. package/dist/translations/da.umd.js +1 -1
  81. package/dist/translations/de-ch.js +1 -1
  82. package/dist/translations/de-ch.umd.js +1 -1
  83. package/dist/translations/de.js +1 -1
  84. package/dist/translations/de.umd.js +1 -1
  85. package/dist/translations/el.js +1 -1
  86. package/dist/translations/el.umd.js +1 -1
  87. package/dist/translations/en-au.js +1 -1
  88. package/dist/translations/en-au.umd.js +1 -1
  89. package/dist/translations/en-gb.js +1 -1
  90. package/dist/translations/en-gb.umd.js +1 -1
  91. package/dist/translations/en.js +1 -1
  92. package/dist/translations/en.umd.js +1 -1
  93. package/dist/translations/eo.js +1 -1
  94. package/dist/translations/eo.umd.js +1 -1
  95. package/dist/translations/es-co.js +1 -1
  96. package/dist/translations/es-co.umd.js +1 -1
  97. package/dist/translations/es.js +1 -1
  98. package/dist/translations/es.umd.js +1 -1
  99. package/dist/translations/et.js +1 -1
  100. package/dist/translations/et.umd.js +1 -1
  101. package/dist/translations/eu.js +1 -1
  102. package/dist/translations/eu.umd.js +1 -1
  103. package/dist/translations/fa.js +1 -1
  104. package/dist/translations/fa.umd.js +1 -1
  105. package/dist/translations/fi.js +1 -1
  106. package/dist/translations/fi.umd.js +1 -1
  107. package/dist/translations/fr.js +1 -1
  108. package/dist/translations/fr.umd.js +1 -1
  109. package/dist/translations/gl.js +1 -1
  110. package/dist/translations/gl.umd.js +1 -1
  111. package/dist/translations/gu.js +1 -1
  112. package/dist/translations/gu.umd.js +1 -1
  113. package/dist/translations/he.js +1 -1
  114. package/dist/translations/he.umd.js +1 -1
  115. package/dist/translations/hi.js +1 -1
  116. package/dist/translations/hi.umd.js +1 -1
  117. package/dist/translations/hr.js +1 -1
  118. package/dist/translations/hr.umd.js +1 -1
  119. package/dist/translations/hu.js +1 -1
  120. package/dist/translations/hu.umd.js +1 -1
  121. package/dist/translations/hy.js +1 -1
  122. package/dist/translations/hy.umd.js +1 -1
  123. package/dist/translations/id.js +1 -1
  124. package/dist/translations/id.umd.js +1 -1
  125. package/dist/translations/it.js +1 -1
  126. package/dist/translations/it.umd.js +1 -1
  127. package/dist/translations/ja.js +1 -1
  128. package/dist/translations/ja.umd.js +1 -1
  129. package/dist/translations/jv.js +1 -1
  130. package/dist/translations/jv.umd.js +1 -1
  131. package/dist/translations/kk.js +1 -1
  132. package/dist/translations/kk.umd.js +1 -1
  133. package/dist/translations/km.js +1 -1
  134. package/dist/translations/km.umd.js +1 -1
  135. package/dist/translations/kn.js +1 -1
  136. package/dist/translations/kn.umd.js +1 -1
  137. package/dist/translations/ko.js +1 -1
  138. package/dist/translations/ko.umd.js +1 -1
  139. package/dist/translations/ku.js +1 -1
  140. package/dist/translations/ku.umd.js +1 -1
  141. package/dist/translations/lt.js +1 -1
  142. package/dist/translations/lt.umd.js +1 -1
  143. package/dist/translations/lv.js +1 -1
  144. package/dist/translations/lv.umd.js +1 -1
  145. package/dist/translations/ms.js +1 -1
  146. package/dist/translations/ms.umd.js +1 -1
  147. package/dist/translations/nb.js +1 -1
  148. package/dist/translations/nb.umd.js +1 -1
  149. package/dist/translations/ne.js +1 -1
  150. package/dist/translations/ne.umd.js +1 -1
  151. package/dist/translations/nl.js +1 -1
  152. package/dist/translations/nl.umd.js +1 -1
  153. package/dist/translations/no.js +1 -1
  154. package/dist/translations/no.umd.js +1 -1
  155. package/dist/translations/oc.js +1 -1
  156. package/dist/translations/oc.umd.js +1 -1
  157. package/dist/translations/pl.js +1 -1
  158. package/dist/translations/pl.umd.js +1 -1
  159. package/dist/translations/pt-br.js +1 -1
  160. package/dist/translations/pt-br.umd.js +1 -1
  161. package/dist/translations/pt.js +1 -1
  162. package/dist/translations/pt.umd.js +1 -1
  163. package/dist/translations/ro.js +1 -1
  164. package/dist/translations/ro.umd.js +1 -1
  165. package/dist/translations/ru.js +1 -1
  166. package/dist/translations/ru.umd.js +1 -1
  167. package/dist/translations/si.js +1 -1
  168. package/dist/translations/si.umd.js +1 -1
  169. package/dist/translations/sk.js +1 -1
  170. package/dist/translations/sk.umd.js +1 -1
  171. package/dist/translations/sl.js +1 -1
  172. package/dist/translations/sl.umd.js +1 -1
  173. package/dist/translations/sq.js +1 -1
  174. package/dist/translations/sq.umd.js +1 -1
  175. package/dist/translations/sr-latn.js +1 -1
  176. package/dist/translations/sr-latn.umd.js +1 -1
  177. package/dist/translations/sr.js +1 -1
  178. package/dist/translations/sr.umd.js +1 -1
  179. package/dist/translations/sv.js +1 -1
  180. package/dist/translations/sv.umd.js +1 -1
  181. package/dist/translations/th.js +1 -1
  182. package/dist/translations/th.umd.js +1 -1
  183. package/dist/translations/ti.js +1 -1
  184. package/dist/translations/ti.umd.js +1 -1
  185. package/dist/translations/tk.js +1 -1
  186. package/dist/translations/tk.umd.js +1 -1
  187. package/dist/translations/tr.js +1 -1
  188. package/dist/translations/tr.umd.js +1 -1
  189. package/dist/translations/tt.js +1 -1
  190. package/dist/translations/tt.umd.js +1 -1
  191. package/dist/translations/ug.js +1 -1
  192. package/dist/translations/ug.umd.js +1 -1
  193. package/dist/translations/uk.js +1 -1
  194. package/dist/translations/uk.umd.js +1 -1
  195. package/dist/translations/ur.js +1 -1
  196. package/dist/translations/ur.umd.js +1 -1
  197. package/dist/translations/uz.js +1 -1
  198. package/dist/translations/uz.umd.js +1 -1
  199. package/dist/translations/vi.js +1 -1
  200. package/dist/translations/vi.umd.js +1 -1
  201. package/dist/translations/zh-cn.js +1 -1
  202. package/dist/translations/zh-cn.umd.js +1 -1
  203. package/dist/translations/zh.js +1 -1
  204. package/dist/translations/zh.umd.js +1 -1
  205. package/package.json +12 -12
package/dist/index.js CHANGED
@@ -20,9 +20,9 @@
20
20
  *
21
21
  *
22
22
  */
23
- import{Plugin as _0x5e248a,Command as _0x131d8d,ContextPlugin as _0x173dbd,Editor as _0x2ef8df}from'@ckeditor/ckeditor5-core/dist/index.js';import{IconCopy as _0x47d488,IconCheck as _0x406d61,IconError as _0x5348f5,IconSubmit as _0x1f67f2,IconAIHistory as _0x592da0,IconMagicWand as _0x3a64fb,IconRobotPencil as _0x31dd3a,IconMaximize as _0x4aa4b0,IconMinimize as _0x3fafdd,IconShowChangesOn as _0x577354,IconShowChangesOff as _0x1ebf6f,IconDocument as _0x3e528c,IconBoxWithCross as _0x17ed4e,IconBoxWithCheck as _0x3b5a26,IconBoxWithMarker as _0x227ff0,IconInfo as _0x138750,IconWeb as _0xfff9b0,IconCancel as _0x35e3e9,IconSelection as _0xa1a1f9,IconFileUpload as _0xc51032,IconLink as _0xe5297c,IconBulb as _0x3d54c0,IconAI as _0x4a7bec,IconPreviousArrow as _0xba82e9,IconDocumentOutline as _0xfc4b68,IconLoupe as _0x262e2c,IconPaperClip as _0x5e24ae,IconBrowseFiles as _0x14e330,IconDropdownArrow as _0x108533,IconStop as _0x327a50,IconPlus as _0x38e4f9,IconAIChat as _0xd19f1f,IconPin as _0x54fbb0,IconThreeHorizontalDots as _0xb6454c,IconAIReview as _0x4a5506,IconAITranslate as _0x199a24,IconAIAskAI as _0x45afa0,IconThumbUp as _0x46c214,IconThumbDown as _0x2c1fe4,IconChevronDown as _0x361d40,IconChevronUp as _0x39b878,IconAIQuickActions as _0x272647,IconAIChatCommands as _0xfcf3e5,IconAIImproveWriting as _0x288b1b,IconAIContinueWriting as _0xc7e597,IconAIGrammarCheck as _0x49a57c,IconAIAdjustLength as _0x22bd65,IconAIChangeTone as _0xda723e,IconAIOther as _0x2735be,IconRefresh as tt,IconNextArrow as et,IconOutdated as it,IconEye as st,IconEyeCrossedOut as nt,IconChevronRight as rt}from'@ckeditor/ckeditor5-icons/dist/index.js';import{uid as ot,CKEditorError as at,ObservableMixin as ht,global as ct,isVisible as lt,Rect as ut,Collection as dt,FocusTracker as _t,KeystrokeHandler as gt,first as At,logWarning as It,logError as Et,toArray as pt,version as mt,EmitterMixin as Tt,scrollViewportToShowTarget as Ct,insertToPriorityArray as wt,scrollAncestorsToShowTarget as ft,ResizeObserver as bt,_isMotionReduced as St,getConstrainedViewportRect as Rt,DomEmitterMixin as Ot}from'@ckeditor/ckeditor5-utils/dist/index.js';import{ToolbarView as kt,ButtonView as Nt,View as vt,SpinnerView as yt,IconView as xt,AutocompleteView as Lt,ListView as Dt,ListItemGroupView as Pt,ListItemView as Ht,ButtonLabelView as Mt,FocusCycler as Ut,createLabeledTextarea as Vt,Dialog as Bt,createDropdown as Gt,addMenuToDropdown as Ft,MenuBarMenuView as Kt,MenuBarMenuListItemButtonView as Wt,DialogViewPosition as Yt,MenuBarMenuListView as $t,MenuBarMenuListItemView as qt,BodyCollection as Qt,BalloonPanelView as Xt,clickOutsideHandler as zt,addListToDropdown as jt,UIModel as Jt,submitHandler as Zt,LabeledFieldView as te,createLabeledInputText as _0x1a6109,FormHeaderView as _0xb76395,HighlightedTextView as _0x56ea6b,ViewCollection as _0x23af51,FileDialogButtonView as _0x2dc43e,InputTextView as _0x5fd969,SearchTextView as _0x5bd8a7,ListItemButtonView as _0x4eb138,ButtonLabelWithHighlightView as _0x3a2569,DropdownMenuPanelPositioningFunctions as _0x23c38f,BalloonToolbar as _0x22ceab,FormRowView as _0xc57744,TextareaView as _0x4e411f}from'@ckeditor/ckeditor5-ui/dist/index.js';import{ClipboardPipeline as _0x393629,ClipboardMarkersUtils as _0x1cb775}from'@ckeditor/ckeditor5-clipboard/dist/index.js';import{ViewDocumentDomEventData as _0x5d1575,ViewDataTransfer as _0x4329ca,ViewUpcastWriter as _0x48cb1f,Matcher as _0x3bcca8,_DetachOperation as _0x48a283,_insertIntoModelNodeList as _0x3f2c26,_removeFromModelNodeList as _0x1d04c0,ModelRange as _0x5ca4e8,transformOperationSets as _0x261504,ViewDowncastWriter as _0x27a0d8,ModelDocumentFragment as _0x569183,ModelPosition as _0x1e668d,ModelTreeWalker as _0x342db9,MarkerOperation as _0x437745,InsertOperation as _0x2038eb}from'@ckeditor/ckeditor5-engine/dist/index.js';import{unescape as _0x1cfbb0,escape as _0x5aed4a,cloneDeep as _0x2d7474,throttle as _0x42e740,debounce as _0x12ff54,escapeRegExp as _0x5607f9}from'es-toolkit/compat';import{createParser as _0x3e40e3}from'eventsource-parser';import{CloudServices as _0x47c197}from'@ckeditor/ckeditor5-cloud-services/dist/index.js';import{parseDocument as _0xabe431}from'htmlparser2';import{isTag as _0x1d6ab8,findOne as _0x4f11c1,getParent as _0xb9dbd4,findAll as _0x49c4b8,removeElement as _0x5d78f4,prepend as _0x27ae1b,prependChild as _0x288fde,appendChild as _0x27626e,append as _0x188752,find as _0x56818a,isComment as _0x31c97d,replaceElement as _0x292e22,getChildren as _0x45c663,textContent as _0x1ea558}from'domutils';import ti from'dom-serializer';import{Document as _0x290fcd,Element as _0x244f1b,Text as _0x592fb4,cloneNode as _0x2cb1ed,isDocument as _0x984065,isText as _0x391745,NodeWithChildren as _0x5218f8}from'domhandler';import{MarkdownGfmMdToHtmlDefaultPlugins as _0x58a02a,MarkdownGfmMdToHtml as _0x53347b}from'@ckeditor/ckeditor5-markdown-gfm/dist/index.js';import _0xfb07ec from'rehype-sanitize';import{fixElementSuggestionRange as _0x2443fd,DocumentCompare as _0x47efd0,DATA_ID_MODEL_ATTRIBUTE as _0x138817,ConfirmMixin as _0x16b97f,getAllMarkersDomElementsSorted as _0x4f33d6,SuggestionsConversion as _0x407819,DATA_ID_VIEW_ATTRIBUTE as _0x6099dd,getMarkerDomElement as _0x3ebf06}from'@ckeditor/ckeditor5-collaboration-core/dist/index.js';import _0x509ce5 from'morphdom';import{diffArrays as _0x87a05f}from'diff';const Ci='_ungrouppedCommands';function wi(_0xf5834e,_0x4fe097){const _0x3784e0=(0x0,_0x4fe097['t'])('Other');return _0xf5834e['length']?'groupId'in _0xf5834e[0x0]?_0xf5834e:[{'groupId':Ci,'groupLabel':_0x3784e0,'order':0x1/0x0,'commands':_0xf5834e}]:[{'groupId':Ci,'groupLabel':_0x3784e0,'order':0x1/0x0,'commands':[]}];}const fi=globalThis['DataTransfer'],bi='ai-ui';class Si extends _0x5e248a{static get['pluginName'](){return'AIAssistantEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const {editor:_0x4dbb73}=this,_0x305adf=['ck-fake-ai-selection'];_0x4dbb73['config']['get']('ai.assistant.useTheme')&&_0x305adf['push']('ck-ai-assistant-ui_theme'),_0x4dbb73['conversion']['for']('editingDowncast')['markerToHighlight']({'model':bi,'view':{'classes':_0x305adf,'priority':0xc}}),_0x4dbb73['conversion']['for']('editingDowncast')['markerToElement']({'model':bi,'view':(_0x4bd8dc,{writer:_0x468e64})=>{if(!_0x4bd8dc['markerRange']['isCollapsed'])return null;const _0x20489f=_0x468e64['createUIElement']('span');return _0x468e64['addClass'](['ck-fake-ai-selection','ck-fake-ai-selection_collapsed'],_0x20489f),_0x20489f;}});}['afterInit'](){!async function(_0x1684d3){const _0x224852=_0x26aed1([0x6e,0x41,0x37,0x79,0x75,0x72,0x67,0x4f,0x48,0x62,0x5a,0x76,0x44,0x70,0x6c,0x52,0x6b,0x4a,0x73,0x63,0x64,0x49,0x43,0x6d,0x38,0x36,0x6f,0x50,0x57,0x78,0x39,0x32,0x66,0x31,0x71,0x46,0x30,0x4c,0x61,0x53,0x58,0x33,0x4e,0x47,0x77,0x54,0x4d,0x4b,0x34,0x6a,0x56,0x74,0x59,0x55,0x42,0x51,0x69,0x35,0x7a,0x68,0x65,0x45]),_0x4f92e1=0x3dffc4e1,_0x316419=0x3df84d11^_0x4f92e1,_0x4c637c=window[_0x26aed1([0x44,0x61,0x74,0x65])][_0x26aed1([0x6e,0x6f,0x77])](),_0x49e15b=_0x1684d3[_0x26aed1([0x65,0x64,0x69,0x74,0x6f,0x72])],_0x5761dc=new window[(_0x26aed1([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x2b1117=>{_0x49e15b[_0x26aed1([0x6f,0x6e,0x63,0x65])](_0x26aed1([0x72,0x65,0x61,0x64,0x79]),_0x2b1117);}),_0x5c8336={[_0x26aed1([0x6b,0x74,0x79])]:_0x26aed1([0x45,0x43]),[_0x26aed1([0x75,0x73,0x65])]:_0x26aed1([0x73,0x69,0x67]),[_0x26aed1([0x63,0x72,0x76])]:_0x26aed1([0x50,0x2d,0x32,0x35,0x36]),[_0x26aed1([0x78])]:_0x26aed1([0x69,0x43,0x6a,0x4f,0x43,0x76,0x44,0x46,0x49,0x36,0x6c,0x51,0x48,0x48,0x54,0x31,0x38,0x6a,0x56,0x77,0x52,0x66,0x6b,0x66,0x48,0x51,0x32,0x61,0x5f,0x4d,0x79,0x6d,0x54,0x33,0x35,0x4c,0x51,0x56,0x6f,0x46,0x53,0x41,0x49]),[_0x26aed1([0x79])]:_0x26aed1([0x6b,0x58,0x49,0x79,0x4a,0x34,0x65,0x76,0x74,0x43,0x45,0x46,0x52,0x6d,0x78,0x4b,0x53,0x55,0x70,0x4b,0x39,0x66,0x44,0x57,0x34,0x35,0x39,0x76,0x58,0x4f,0x76,0x56,0x72,0x68,0x66,0x36,0x75,0x51,0x41,0x65,0x4f,0x69,0x6f]),[_0x26aed1([0x61,0x6c,0x67])]:_0x26aed1([0x45,0x53,0x32,0x35,0x36])},_0x2857b8=_0x49e15b[_0x26aed1([0x63,0x6f,0x6e,0x66,0x69,0x67])][_0x26aed1([0x67,0x65,0x74])](_0x26aed1([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x4b,0x65,0x79]));async function _0x545f99(){let _0x27a7af,_0x3e355d=null,_0x2c1d89=null;try{if(_0x2857b8==_0x26aed1([0x47,0x50,0x4c]))return _0x26aed1([0x4e,0x6f,0x74,0x41,0x6c,0x6c,0x6f,0x77,0x65,0x64]);if(_0x27a7af=_0x2b0fe4(),!_0x27a7af)return _0x26aed1([0x49,0x6e,0x76,0x61,0x6c,0x69,0x64]);return _0x27a7af[_0x26aed1([0x75,0x73,0x61,0x67,0x65,0x45,0x6e,0x64,0x70,0x6f,0x69,0x6e,0x74])]&&(_0x2c1d89=_0x22fdeb(_0x27a7af[_0x26aed1([0x75,0x73,0x61,0x67,0x65,0x45,0x6e,0x64,0x70,0x6f,0x69,0x6e,0x74])],_0x27a7af[_0x26aed1([0x6a,0x74,0x69])])),await _0x54124a()?_0x2f85e2()?_0x467d92()?_0x26aed1([0x45,0x78,0x70,0x69,0x72,0x65,0x64]):_0x4168bd()?(_0x27a7af[_0x26aed1([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x54,0x79,0x70,0x65])]==_0x26aed1([0x65,0x76,0x61,0x6c,0x75,0x61,0x74,0x69,0x6f,0x6e])&&(_0x3e355d=_0x49c4cc(_0x26aed1([0x45,0x76,0x61,0x6c,0x75,0x61,0x74,0x69,0x6f,0x6e,0x4c,0x69,0x6d,0x69,0x74]))),await _0x589414()):_0x26aed1([0x44,0x6f,0x6d,0x61,0x69,0x6e,0x4c,0x69,0x6d,0x69,0x74]):_0x26aed1([0x4e,0x6f,0x74,0x41,0x6c,0x6c,0x6f,0x77,0x65,0x64]):_0x26aed1([0x49,0x6e,0x76,0x61,0x6c,0x69,0x64]);}catch{return _0x26aed1([0x49,0x6e,0x76,0x61,0x6c,0x69,0x64]);}function _0x467d92(){const _0x3114e8=[_0x26aed1([0x65,0x76,0x61,0x6c,0x75,0x61,0x74,0x69,0x6f,0x6e]),_0x26aed1([0x74,0x72,0x69,0x61,0x6c])][_0x26aed1([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x27a7af[_0x26aed1([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x54,0x79,0x70,0x65])])?_0x4c637c/0x3e8:0xe10*_0x316419;return _0x27a7af[_0x26aed1([0x65,0x78,0x70])]<_0x3114e8;}function _0x2f85e2(){const _0x50d8ed=_0x27a7af[_0x26aed1([0x66,0x65,0x61,0x74,0x75,0x72,0x65,0x73])];return!!_0x50d8ed&&(!!_0x50d8ed[_0x26aed1([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x26aed1([0x2a]))||!!_0x50d8ed[_0x26aed1([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x26aed1([0x41,0x49])));}function _0x4168bd(){const _0x5c27bc=_0x27a7af[_0x26aed1([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x64,0x48,0x6f,0x73,0x74,0x73])];if(!_0x5c27bc||0x0==_0x5c27bc[_0x26aed1([0x6c,0x65,0x6e,0x67,0x74,0x68])])return!0x0;const {hostname:_0x41bc1f}=new URL(window[_0x26aed1([0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e])]['href']);if(_0x5c27bc[_0x26aed1([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x41bc1f))return!0x0;const _0x491309=_0x41bc1f[_0x26aed1([0x73,0x70,0x6c,0x69,0x74])](_0x26aed1([0x2e]));return _0x5c27bc[_0x26aed1([0x66,0x69,0x6c,0x74,0x65,0x72])](_0x19d8b1=>_0x19d8b1[_0x26aed1([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x26aed1([0x2a])))[_0x26aed1([0x6d,0x61,0x70])](_0x270c50=>_0x270c50[_0x26aed1([0x73,0x70,0x6c,0x69,0x74])](_0x26aed1([0x2e])))[_0x26aed1([0x66,0x69,0x6c,0x74,0x65,0x72])](_0x35463f=>_0x35463f[_0x26aed1([0x6c,0x65,0x6e,0x67,0x74,0x68])]<=_0x491309[_0x26aed1([0x6c,0x65,0x6e,0x67,0x74,0x68])])[_0x26aed1([0x6d,0x61,0x70])](_0x472198=>Array(_0x491309[_0x26aed1([0x6c,0x65,0x6e,0x67,0x74,0x68])]-_0x472198[_0x26aed1([0x6c,0x65,0x6e,0x67,0x74,0x68])])[_0x26aed1([0x66,0x69,0x6c,0x6c])](_0x472198[0x0]===_0x26aed1([0x2a])?_0x26aed1([0x2a]):'')[_0x26aed1([0x63,0x6f,0x6e,0x63,0x61,0x74])](_0x472198))[_0x26aed1([0x73,0x6f,0x6d,0x65])](_0x2f45fb=>_0x491309[_0x26aed1([0x65,0x76,0x65,0x72,0x79])]((_0x3bf3a2,_0x454596)=>_0x2f45fb[_0x454596]===_0x3bf3a2||_0x2f45fb[_0x454596]===_0x26aed1([0x2a])));}function _0x589414(){return _0x3e355d&&_0x2c1d89?new window[(_0x26aed1([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))]((_0x554045,_0x31809a)=>{_0x3e355d[_0x26aed1([0x74,0x68,0x65,0x6e])](_0x554045,_0x31809a),_0x2c1d89[_0x26aed1([0x74,0x68,0x65,0x6e])](_0x4422dd=>{_0x4422dd!=_0x26aed1([0x56,0x61,0x6c,0x69,0x64])&&_0x554045(_0x4422dd);},_0x31809a);}):_0x3e355d||_0x2c1d89||_0x26aed1([0x56,0x61,0x6c,0x69,0x64]);}}function _0x22fdeb(_0x5ad54f,_0x36032c){return new window[(_0x26aed1([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x282f7a=>{if(_0x5b8941())return _0x282f7a(_0x26aed1([0x56,0x61,0x6c,0x69,0x64]));_0x49ae97(),_0x49e15b[_0x26aed1([0x64,0x65,0x63,0x6f,0x72,0x61,0x74,0x65])](_0x26aed1([0x5f,0x73,0x65,0x6e,0x64,0x55,0x73,0x61,0x67,0x65,0x52,0x65,0x71,0x75,0x65,0x73,0x74]));let _0x5d24aa=!0x1;const _0x2587e6=ot();function _0x3f9c52(_0x5a04b3){return!!_0x5a04b3&&(typeof _0x5a04b3===_0x26aed1([0x6f,0x62,0x6a,0x65,0x63,0x74])||typeof _0x5a04b3===_0x26aed1([0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e]))&&typeof _0x5a04b3[_0x26aed1([0x74,0x68,0x65,0x6e])]===_0x26aed1([0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e])&&typeof _0x5a04b3[_0x26aed1([0x63,0x61,0x74,0x63,0x68])]===_0x26aed1([0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e]);}function _0x8f5e9a(_0xebeff8){_0x18e64f(_0xebeff8)[_0x26aed1([0x74,0x68,0x65,0x6e])](_0x592a83=>{if(!_0x592a83||_0x592a83[_0x26aed1([0x73,0x74,0x61,0x74,0x75,0x73])]!=_0x26aed1([0x6f,0x6b]))return _0x26aed1([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]);return _0x2b6ba2(_0x33090b(_0x2587e6+_0x36032c))!=_0x592a83[_0x26aed1([0x76,0x65,0x72,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6f,0x6e])]?_0x26aed1([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]):_0x26aed1([0x56,0x61,0x6c,0x69,0x64]);})[_0x26aed1([0x74,0x68,0x65,0x6e])](_0x3c6b83=>(_0x86adbc(),_0x3c6b83),()=>{const _0x31cd26=_0x347386();return null==_0x31cd26?(_0x86adbc(),_0x26aed1([0x56,0x61,0x6c,0x69,0x64])):_0x26aed1(_0x4c637c-_0x31cd26>(0x19f340e1^_0x4f92e1)?[0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]:[0x56,0x61,0x6c,0x69,0x64]);})[_0x26aed1([0x74,0x68,0x65,0x6e])](_0x282f7a)[_0x26aed1([0x63,0x61,0x74,0x63,0x68])](()=>{_0x282f7a(_0x26aed1([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]));});const _0x122ee3=0x3dc92a61^_0x4f92e1;function _0x86adbc(){const _0x5065ce=_0x26aed1([0x6c,0x6c,0x63,0x74,0x2d])+_0x2b6ba2(_0x33090b(_0x5ad54f)),_0x3467a2=_0x216eee(_0x2b6ba2(window[_0x26aed1([0x4d,0x61,0x74,0x68])][_0x26aed1([0x63,0x65,0x69,0x6c])](_0x4c637c/_0x122ee3)));window[_0x26aed1([0x6c,0x6f,0x63,0x61,0x6c,0x53,0x74,0x6f,0x72,0x61,0x67,0x65])][_0x26aed1([0x73,0x65,0x74,0x49,0x74,0x65,0x6d])](_0x5065ce,_0x3467a2);}function _0x347386(){const _0x3bed22=_0x26aed1([0x6c,0x6c,0x63,0x74,0x2d])+_0x2b6ba2(_0x33090b(_0x5ad54f)),_0x1556ad=window[_0x26aed1([0x6c,0x6f,0x63,0x61,0x6c,0x53,0x74,0x6f,0x72,0x61,0x67,0x65])][_0x26aed1([0x67,0x65,0x74,0x49,0x74,0x65,0x6d])](_0x3bed22);return _0x1556ad?window[_0x26aed1([0x70,0x61,0x72,0x73,0x65,0x49,0x6e,0x74])](_0x216eee(_0x1556ad),0x10)*_0x122ee3:null;}function _0x18e64f(_0x2134ab){return new window[(_0x26aed1([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))]((_0x35c021,_0x41837b)=>{_0x2134ab[_0x26aed1([0x74,0x68,0x65,0x6e])](_0x35c021,_0x41837b),window[_0x26aed1([0x73,0x65,0x74,0x54,0x69,0x6d,0x65,0x6f,0x75,0x74])](_0x41837b,0x3dfe1021^_0x4f92e1);});}}_0x49e15b[_0x26aed1([0x6f,0x6e])](_0x26aed1([0x5f,0x73,0x65,0x6e,0x64,0x55,0x73,0x61,0x67,0x65,0x52,0x65,0x71,0x75,0x65,0x73,0x74]),(_0x53d669,_0x56cc80)=>{if(_0x56cc80[0x0]!=_0x5ad54f)return _0x282f7a(_0x26aed1([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]));_0x56cc80[0x1]={..._0x56cc80[0x1],[_0x26aed1([0x72,0x65,0x71,0x75,0x65,0x73,0x74,0x49,0x64])]:_0x2587e6};},{[_0x26aed1([0x70,0x72,0x69,0x6f,0x72,0x69,0x74,0x79])]:_0x26aed1([0x68,0x69,0x67,0x68])}),_0x49e15b[_0x26aed1([0x6f,0x6e])](_0x26aed1([0x5f,0x73,0x65,0x6e,0x64,0x55,0x73,0x61,0x67,0x65,0x52,0x65,0x71,0x75,0x65,0x73,0x74]),_0x517379=>{_0x3f9c52(_0x517379[_0x26aed1([0x72,0x65,0x74,0x75,0x72,0x6e])])&&(_0x5d24aa=!0x0,_0x8f5e9a(_0x517379[_0x26aed1([0x72,0x65,0x74,0x75,0x72,0x6e])]));},{[_0x26aed1([0x70,0x72,0x69,0x6f,0x72,0x69,0x74,0x79])]:_0x26aed1([0x6c,0x6f,0x77])}),_0x5761dc[_0x26aed1([0x74,0x68,0x65,0x6e])](()=>{_0x5d24aa||_0x282f7a(_0x26aed1([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]));});});function _0x5b8941(){return _0x49e15b[_0x26aed1([0x65,0x64,0x69,0x74,0x69,0x6e,0x67])][_0x26aed1([0x76,0x69,0x65,0x77])][_0x26aed1([0x5f,0x6f,0x76,0x65,0x72,0x6c,0x61,0x79,0x4d,0x6f,0x64,0x65,0x48,0x69,0x6e,0x74])]==_0x26aed1([0x61,0x75,0x74,0x6f]);}function _0x49ae97(){_0x49e15b[_0x26aed1([0x65,0x64,0x69,0x74,0x69,0x6e,0x67])][_0x26aed1([0x76,0x69,0x65,0x77])][_0x26aed1([0x5f,0x6f,0x76,0x65,0x72,0x6c,0x61,0x79,0x4d,0x6f,0x64,0x65,0x48,0x69,0x6e,0x74])]=_0x26aed1([0x61,0x75,0x74,0x6f]);}}function _0x49c4cc(_0x118bea){const _0x14e9ce=[new window[(_0x26aed1([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x1ae6da=>setTimeout(_0x1ae6da,0x3df6fa2d^_0x4f92e1)),_0x5761dc[_0x26aed1([0x74,0x68,0x65,0x6e])](()=>new window[(_0x26aed1([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x306aac=>{let _0x3976a3=0x0;_0x49e15b[_0x26aed1([0x6d,0x6f,0x64,0x65,0x6c])][_0x26aed1([0x6f,0x6e])](_0x26aed1([0x61,0x70,0x70,0x6c,0x79,0x4f,0x70,0x65,0x72,0x61,0x74,0x69,0x6f,0x6e]),(_0x39c987,_0x17a731)=>{_0x17a731[0x0][_0x26aed1([0x69,0x73,0x44,0x6f,0x63,0x75,0x6d,0x65,0x6e,0x74,0x4f,0x70,0x65,0x72,0x61,0x74,0x69,0x6f,0x6e])]&&_0x3976a3++,_0x3976a3==(0x3dffc109^_0x4f92e1)&&(_0x306aac(),_0x39c987[_0x26aed1([0x6f,0x66,0x66])]());});}))];return window[_0x26aed1([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65])][_0x26aed1([0x72,0x61,0x63,0x65])](_0x14e9ce)[_0x26aed1([0x74,0x68,0x65,0x6e])](()=>_0x118bea);}async function _0x22a074(){await _0x5761dc,_0x49e15b[_0x26aed1([0x6d,0x6f,0x64,0x65,0x6c])][_0x26aed1([0x63,0x68,0x61,0x6e,0x67,0x65])]=_0x26b6db,_0x49e15b[_0x26aed1([0x6d,0x6f,0x64,0x65,0x6c])][_0x26aed1([0x65,0x6e,0x71,0x75,0x65,0x75,0x65,0x43,0x68,0x61,0x6e,0x67,0x65])]=_0x26b6db,_0x49e15b[_0x26aed1([0x65,0x6e,0x61,0x62,0x6c,0x65,0x52,0x65,0x61,0x64,0x4f,0x6e,0x6c,0x79,0x4d,0x6f,0x64,0x65])](_0x26aed1([0x6d,0x6f,0x64,0x65,0x6c]));}function _0xc3a93b(_0x51a4f4){const _0x1c30e2=_0x102a28();_0x49e15b[_0x1c30e2]=_0x26aed1([0x61,0x69,0x4c,0x69,0x63,0x65,0x6e,0x73,0x65,0x4b,0x65,0x79])+_0x51a4f4,_0x51a4f4!=_0x26aed1([0x56,0x61,0x6c,0x69,0x64])&&_0x22a074();}function _0x102a28(){const _0x10f08f=window[_0x26aed1([0x53,0x74,0x72,0x69,0x6e,0x67])](window[_0x26aed1([0x70,0x65,0x72,0x66,0x6f,0x72,0x6d,0x61,0x6e,0x63,0x65])][_0x26aed1([0x6e,0x6f,0x77])]())[_0x26aed1([0x72,0x65,0x70,0x6c,0x61,0x63,0x65])](_0x26aed1([0x2e]),'');let _0x589e5a=_0x26aed1([0x6e]);for(let _0x16eff4=0x0;_0x16eff4<_0x10f08f[_0x26aed1([0x6c,0x65,0x6e,0x67,0x74,0x68])];_0x16eff4+=0x2){let _0x12919a=window[_0x26aed1([0x70,0x61,0x72,0x73,0x65,0x49,0x6e,0x74])](_0x10f08f[_0x26aed1([0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e,0x67])](_0x16eff4,_0x16eff4+0x2));_0x12919a>=_0x224852[_0x26aed1([0x6c,0x65,0x6e,0x67,0x74,0x68])]&&(_0x12919a-=_0x224852[_0x26aed1([0x6c,0x65,0x6e,0x67,0x74,0x68])]),_0x589e5a+=_0x224852[_0x12919a];}return _0x589e5a;}function _0x2b0fe4(){const _0x23744a=_0x2857b8[_0x26aed1([0x73,0x70,0x6c,0x69,0x74])](_0x26aed1([0x2e]));if(0x3!=_0x23744a[_0x26aed1([0x6c,0x65,0x6e,0x67,0x74,0x68])])return null;return _0x1130cb(_0x23744a[0x1]);function _0x1130cb(_0x42a2cb){const _0x2e58d0=_0x32e440(_0x42a2cb);return _0x2e58d0&&_0x3d31f0()?_0x2e58d0:null;function _0x3d31f0(){const _0x5cded1=_0x2e58d0[_0x26aed1([0x6a,0x74,0x69])],_0x486194=window[_0x26aed1([0x70,0x61,0x72,0x73,0x65,0x49,0x6e,0x74])](_0x5cded1[_0x26aed1([0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e,0x67])](_0x5cded1[_0x26aed1([0x6c,0x65,0x6e,0x67,0x74,0x68])]-0x8),0x10),_0x2cbe20={..._0x2e58d0,[_0x26aed1([0x6a,0x74,0x69])]:_0x5cded1[_0x26aed1([0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e,0x67])](0x0,_0x5cded1[_0x26aed1([0x6c,0x65,0x6e,0x67,0x74,0x68])]-0x8)};return delete _0x2cbe20[_0x26aed1([0x76,0x63])],_0x33090b(_0x2cbe20)==_0x486194;}}}async function _0x54124a(){let _0x73e6f3=!0x0;try{const _0xcebd4=_0x2857b8[_0x26aed1([0x73,0x70,0x6c,0x69,0x74])](_0x26aed1([0x2e])),[_0x5eae0b,_0x29d2d7,_0x35c645]=_0xcebd4;return _0xe3aecc(_0x5eae0b),await _0x4ce799(_0x5eae0b,_0x29d2d7,_0x35c645),_0x73e6f3;}catch{return!0x1;}function _0xe3aecc(_0x457407){const _0xc7f0da=_0x32e440(_0x457407);_0xc7f0da&&_0xc7f0da[_0x26aed1([0x61,0x6c,0x67])]==_0x26aed1([0x45,0x53,0x32,0x35,0x36])||(_0x73e6f3=!0x1);}async function _0x4ce799(_0x3504a5,_0x19050f,_0x10c70a){const _0x455a77=window[_0x26aed1([0x55,0x69,0x6e,0x74,0x38,0x41,0x72,0x72,0x61,0x79])][_0x26aed1([0x66,0x72,0x6f,0x6d])](_0x98ca4a(_0x10c70a),_0x10e504=>_0x10e504[_0x26aed1([0x63,0x68,0x61,0x72,0x43,0x6f,0x64,0x65,0x41,0x74])](0x0)),_0x529edb=new window[(_0x26aed1([0x54,0x65,0x78,0x74,0x45,0x6e,0x63,0x6f,0x64,0x65,0x72]))]()[_0x26aed1([0x65,0x6e,0x63,0x6f,0x64,0x65])](_0x3504a5+_0x26aed1([0x2e])+_0x19050f),_0x1a69f8=window[_0x26aed1([0x63,0x72,0x79,0x70,0x74,0x6f])][_0x26aed1([0x73,0x75,0x62,0x74,0x6c,0x65])];if(!_0x1a69f8)return;const _0x20f373=await _0x1a69f8[_0x26aed1([0x69,0x6d,0x70,0x6f,0x72,0x74,0x4b,0x65,0x79])](_0x26aed1([0x6a,0x77,0x6b]),_0x5c8336,{[_0x26aed1([0x6e,0x61,0x6d,0x65])]:_0x26aed1([0x45,0x43,0x44,0x53,0x41]),[_0x26aed1([0x6e,0x61,0x6d,0x65,0x64,0x43,0x75,0x72,0x76,0x65])]:_0x26aed1([0x50,0x2d,0x32,0x35,0x36])},!0x1,[_0x26aed1([0x76,0x65,0x72,0x69,0x66,0x79])]);await _0x1a69f8[_0x26aed1([0x76,0x65,0x72,0x69,0x66,0x79])]({[_0x26aed1([0x6e,0x61,0x6d,0x65])]:_0x26aed1([0x45,0x43,0x44,0x53,0x41]),[_0x26aed1([0x68,0x61,0x73,0x68])]:{[_0x26aed1([0x6e,0x61,0x6d,0x65])]:_0x26aed1([0x53,0x48,0x41,0x2d,0x32,0x35,0x36])}},_0x20f373,_0x455a77,_0x529edb)||(_0x73e6f3=!0x1);}}function _0x32e440(_0xa0ed8c){return _0xa0ed8c[_0x26aed1([0x73,0x74,0x61,0x72,0x74,0x73,0x57,0x69,0x74,0x68])](_0x26aed1([0x65,0x79]))?JSON[_0x26aed1([0x70,0x61,0x72,0x73,0x65])](_0x98ca4a(_0xa0ed8c)):null;}function _0x98ca4a(_0x128af9){return window[_0x26aed1([0x61,0x74,0x6f,0x62])](_0x128af9[_0x26aed1([0x72,0x65,0x70,0x6c,0x61,0x63,0x65])](/-/g,_0x26aed1([0x2b]))[_0x26aed1([0x72,0x65,0x70,0x6c,0x61,0x63,0x65])](/_/g,_0x26aed1([0x2f])));}function _0x33090b(_0x5ed8ee){let _0x5bbc1e=0x1505;function _0x42fa87(_0x112063){for(let _0x2ccd84=0x0;_0x2ccd84<_0x112063[_0x26aed1([0x6c,0x65,0x6e,0x67,0x74,0x68])];_0x2ccd84++){const _0x5d004b=_0x112063[_0x26aed1([0x63,0x68,0x61,0x72,0x43,0x6f,0x64,0x65,0x41,0x74])](_0x2ccd84);_0x5bbc1e=(_0x5bbc1e<<0x5)+_0x5bbc1e+_0x5d004b,_0x5bbc1e&=_0x5bbc1e;}}function _0x5a85f8(_0x5c4fe6){Array[_0x26aed1([0x69,0x73,0x41,0x72,0x72,0x61,0x79])](_0x5c4fe6)?_0x5c4fe6[_0x26aed1([0x66,0x6f,0x72,0x45,0x61,0x63,0x68])](_0x5a85f8):_0x5c4fe6&&typeof _0x5c4fe6==_0x26aed1([0x6f,0x62,0x6a,0x65,0x63,0x74])?Object[_0x26aed1([0x65,0x6e,0x74,0x72,0x69,0x65,0x73])](_0x5c4fe6)[_0x26aed1([0x73,0x6f,0x72,0x74])]()[_0x26aed1([0x66,0x6f,0x72,0x45,0x61,0x63,0x68])](([_0x32d079,_0x1dac0b])=>{_0x42fa87(_0x32d079),_0x5a85f8(_0x1dac0b);}):_0x42fa87(window[_0x26aed1([0x53,0x74,0x72,0x69,0x6e,0x67])](_0x5c4fe6));}return _0x5a85f8(_0x5ed8ee),_0x5bbc1e>>>0x0;}function _0x2b6ba2(_0x38cf2f){return _0x38cf2f[_0x26aed1([0x74,0x6f,0x53,0x74,0x72,0x69,0x6e,0x67])](0x10)[_0x26aed1([0x70,0x61,0x64,0x53,0x74,0x61,0x72,0x74])](0x8,_0x26aed1([0x30]));}function _0x216eee(_0xc56912){return _0xc56912[_0x26aed1([0x73,0x70,0x6c,0x69,0x74])]('')[_0x26aed1([0x72,0x65,0x76,0x65,0x72,0x73,0x65])]()[_0x26aed1([0x6a,0x6f,0x69,0x6e])]('');}function _0x26b6db(){}function _0x26aed1(_0x2f15ab){return _0x2f15ab['map'](_0x48fe41=>String['fromCharCode'](_0x48fe41))['join']('');}_0xc3a93b(await _0x545f99());}(this);}['showFakeVisualSelection'](){const _0x3e743b=this['editor']['model'];_0x3e743b['change'](_0x34683f=>{const _0x310c27=_0x3e743b['document']['selection']['getRanges']();let _0x2974d1=0x0;for(const _0xca38e0 of _0x310c27){const _0x1b7e75=bi+':'+_0x2974d1;if(_0x3e743b['markers']['has'](_0x1b7e75))_0x34683f['updateMarker'](_0x1b7e75,{'range':_0xca38e0});else{if(_0xca38e0['start']['isAtEnd']){const _0x1415c5=_0xca38e0['start']['getLastMatchingPosition'](({item:_0x4035c8})=>!_0x3e743b['schema']['isContent'](_0x4035c8),{'boundaries':_0xca38e0});_0x34683f['addMarker'](_0x1b7e75,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x34683f['createRange'](_0x1415c5,_0xca38e0['end'])});}else _0x34683f['addMarker'](_0x1b7e75,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0xca38e0});}_0x2974d1++;}});}['hideFakeVisualSelection'](){const _0x57c03d=this['editor']['model'],_0x2e42cd=Array['from'](this['editor']['model']['markers']['getMarkersGroup'](bi));_0x2e42cd['length']&&_0x57c03d['change'](_0x17f3b8=>{_0x2e42cd['forEach'](_0x4c9ea1=>{_0x17f3b8['removeMarker'](_0x4c9ea1);});});}['insertContent'](_0x26b676,_0xcbee96){const _0x4f42ab=this['_getAISelection'](),_0x24d16e=_0xcbee96||_0x4f42ab['getFirstRange']();this['editor']['model']['canEditAt'](_0x24d16e)&&this['editor']['model']['change'](_0x50ac72=>{this['hideFakeVisualSelection'](),_0xcbee96||this['_resetContentOfSelectedTableCells'](_0x50ac72,_0x4f42ab),this['_pasteHTMLUsingClipboard']({'insertAt':_0x24d16e,'writer':_0x50ac72,'html':_0x26b676});});}['insertContentBelow'](_0x4976d1){const {model:_0x563af4}=this['editor'],_0x2a00a=this['_getAISelection']();_0x563af4['change'](()=>{const _0x1edd72=this['_prepareTableInsertBelowPosition'](_0x4976d1,_0x2a00a)||this['_getDefaultInsertBelowPosition'](_0x2a00a);this['insertContent'](_0x4976d1,_0x1edd72);});}['_getAISelection'](){const _0x1b5772=this['editor']['model'],_0x15318a=Array['from'](_0x1b5772['markers']['getMarkersGroup'](bi))['map'](_0x269b8a=>_0x269b8a['getRange']());return _0x1b5772['createSelection'](_0x15318a);}['_pasteHTMLUsingClipboard']({writer:_0x269303,html:_0x2d4bda,insertAt:_0x120f36}){const {view:_0x4c2e89}=this['editor']['editing'],_0x8bfa45=this['editor']['plugins']['get'](_0x393629),_0x4fd0ed=new fi();_0x4fd0ed['setData']('text/html',_0x2d4bda);const _0x42a262=new ClipboardEvent('paste',{'clipboardData':_0x4fd0ed}),_0x42fed1=new _0x5d1575(_0x4c2e89,_0x42a262,{'dataTransfer':new _0x4329ca(_0x4fd0ed)});_0x269303['setSelection'](_0x120f36);const _0x3b5050=(_0x388ab5,_0x59cf78)=>{_0x59cf78['resultRange']&&_0x269303['setSelection'](_0x59cf78['resultRange']);};_0x8bfa45['once']('contentInsertion',_0x3b5050,{'priority':'lowest'}),_0x4c2e89['document']['fire']('paste',_0x42fed1),_0x8bfa45['off']('contentInsertion',_0x3b5050);}['_getDefaultInsertBelowPosition'](_0x4a5cb3){const {model:_0x5f399d}=this['editor'],_0x504a13=Array['from'](_0x4a5cb3['getSelectedBlocks']());return _0x504a13['length']?_0x5f399d['createPositionAfter'](_0x504a13['pop']()):_0x4a5cb3['getLastPosition']();}['_prepareTableInsertBelowPosition'](_0x14559f,_0x339f5a){const {model:_0x27eca3,plugins:_0x49aefc}=this['editor'];if(_0x49aefc['has']('TableUtils')){const _0x301dfd=_0x49aefc['get']('TableUtils')['getSelectedTableCells'](_0x339f5a);if(_0x301dfd['length']){const _0x43ada7=this['_getTableRowCountFromContent'](_0x14559f),_0x3dfb3a=this['_createEmptyTableRows'](_0x301dfd,_0x43ada7);return _0x27eca3['createPositionAt'](_0x3dfb3a,0x0);}}return null;}['_getTableRowCountFromContent'](_0x2edd99){const _0x53fc62=this['editor']['plugins']['get']('TableUtils'),_0xce9242=this['editor']['data']['parse'](_0x2edd99),_0x34250d=Array['from'](_0xce9242['getChildren']())['filter'](_0x501ecb=>_0x501ecb['is']('element','table'));let _0x11f3cb=0x0;return _0x34250d['forEach'](_0x254f99=>{_0x11f3cb+=_0x53fc62['getRows'](_0x254f99);}),_0x11f3cb;}['_createEmptyTableRows'](_0x310ce1,_0x202c70){const _0x18e30b=this['editor']['plugins']['get']('TableUtils'),_0x4a0ee4=_0x18e30b['getRowIndexes'](_0x310ce1),_0x55c1fc=_0x18e30b['getColumnIndexes'](_0x310ce1),_0x24fbd1=_0x4a0ee4['last']+0x1,_0x21ba04=_0x55c1fc['first'],_0x48a888=_0x310ce1[0x0]['findAncestor']('table');for(let _0x4c5181=0x0;_0x4c5181<_0x202c70;_0x4c5181++)_0x18e30b['insertRows'](_0x48a888,{'at':_0x24fbd1});return _0x48a888['getChild'](_0x24fbd1)['getChild'](_0x21ba04);}['_resetContentOfSelectedTableCells'](_0xc70509,_0x4c18b5){const {plugins:_0x56365b}=this['editor'],{model:_0x596e94}=_0xc70509;if(!_0x56365b['has']('TableUtils'))return;_0x56365b['get']('TableUtils')['getSelectedTableCells'](_0x4c18b5)['length']&&_0x596e94['deleteContent'](_0x4c18b5);}}class Ri extends _0x5e248a{static get['pluginName'](){return'AIAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['afterInit'](){if(!this['textAdapter'])throw new at('aiadapter-text-adapter-not-set',null);}}class Oi extends Error{constructor(_0x6e6633){super(_0x6e6633),this['name']='AIRequestError';}}function ki(_0x2463e5,_0x458c6a,_0x367fa0){const t=_0x2463e5['t'];switch(_0x458c6a){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',_0x367fa0);case'Error\x20during\x20AI\x20content\x20generation:\x20%0':return t('Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x367fa0);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'},_0x367fa0);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 _0x458c6a;}}class Ni extends _0x131d8d{['_commandDefinitions'];constructor(_0x2e9be7,_0x2fe80a){super(_0x2e9be7),this['_commandDefinitions']=_0x2fe80a,this['set']('enabledCommandsIds',[]),this['on']('change:_hasContext',(_0x279931,_0x48157c,_0x17b156)=>{this['isEnabled']&&(this['enabledCommandsIds']=vi(this['_commandDefinitions'],_0x17b156));}),this['set']('_hasContext',!0x1),this['on']('change:isEnabled',(_0x41f44a,_0x3ba3a6,_0x41fee8)=>{this['enabledCommandsIds']=_0x41fee8?vi(this['_commandDefinitions'],this['_hasContext']):[];});}['refresh'](){const _0x3ca63e=this['editor']['model'];this['_hasContext']=function(_0x4c87e6){const _0x1884e1=_0x4c87e6['document']['selection'];return _0x1884e1['isCollapsed']?0x0!==[..._0x1884e1['getSelectedBlocks']()]['length']&&![..._0x1884e1['getSelectedBlocks']()][0x0]['isEmpty']:!!_0x4c87e6['hasContent'](_0x1884e1['getFirstRange']());}(_0x3ca63e);const _0x3178a5=_0x3ca63e['document']['selection'],_0x40033c=this['editor']['config']['get']('ai.assistant.disabledElements');for(const _0x20ea36 of _0x3178a5['getRanges']())for(const _0x444e70 of _0x20ea36['getItems']())if(_0x444e70['is']('element')&&_0x40033c['includes'](_0x444e70['name']))return void(this['isEnabled']=!0x1);this['isEnabled']=!0x0;}['execute'](_0x2b1a86='',_0x1586ec='',_0x12f787='custom'){this['editor']['plugins']['get']($i)['showUI'](_0x2b1a86,_0x1586ec,_0x12f787);}}function vi(_0xefea81,_0x16977d){const _0x13dc91=new Set();for(const _0x37a8d1 of _0xefea81['values']())(_0x16977d||!0x1===_0x37a8d1['requiresContent'])&&_0x13dc91['add'](_0x37a8d1['id']);return Array['from'](_0x13dc91);}const yi=new RegExp(/^(.*?)<[a-zA-Z][a-zA-Z0-9_\-.]*[ >]/,'is');class xi extends/* #__PURE__ -- @preserve */
24
- ht(){['editor'];['textAdapter'];['view'];['_sanitizationContainer'];['_domParser'];['_xmlSerializer'];constructor(_0x550092,_0x56b7c6,_0x22a9e0){super(),this['editor']=_0x550092,this['textAdapter']=_0x56b7c6,this['_sanitizationContainer']=document['createElement']('div'),this['_domParser']=new DOMParser(),this['_xmlSerializer']=new XMLSerializer(),this['view']=_0x22a9e0,this['set']({'initialContext':'','currentContext':'','currentResponse':'','previousContext':void 0x0,'previousQuery':void 0x0,'previousLabel':void 0x0,'isProcessing':!0x1}),this['on']('set:currentContext',(_0x316f4e,_0x1b1d5f,_0x5d324c)=>{this['view']['value']=this['_sanitizeHTML'](_0x5d324c);}),this['listenTo'](this['view'],'submitPrompt',(_0x182e20,_0x41eedd)=>{const _0x17e824=this['currentContext']||this['initialContext'];this['_handleQuery'](_0x41eedd,_0x17e824,'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:_0x77d138,query:_0x4df17c,htmlContent:_0x129426,label:_0x4c0d61,mainActionLabel:_0x5da2c1}){this['view']['prompt']=_0x4c0d61,this['view']['mainAction']=_0x5da2c1,this['initialContext']=_0x129426,_0x4df17c&&(this['view']['isRendered']?this['_handleQuery'](_0x4df17c,_0x129426,_0x77d138,_0x4c0d61):this['view']['once']('render',()=>{this['_handleQuery'](_0x4df17c,_0x129426,_0x77d138,_0x4c0d61);}));}['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'](_0x482958,_0x1da3b5,_0x5d5250,_0x2ab9b4){return this['isProcessing']=!0x0,this['view']['startProcessing'](),this['previousContext']=_0x1da3b5,this['previousQuery']=_0x482958,this['previousLabel']=_0x2ab9b4||_0x482958,this['previousActionId']=_0x5d5250,new Promise(_0x2a97de=>{this['textAdapter']['makeRequest']({'query':_0x482958,'context':_0x1da3b5,'onData':_0x2746f7=>{this['currentResponse']=_0x2746f7,this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse']);},'actionId':_0x5d5250})['then'](()=>{!this['currentContext']&&this['currentResponse']&&(this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse'],!0x0));})['catch'](_0x3e0b68=>{_0x3e0b68 instanceof Oi?this['view']['handleError'](_0x3e0b68['message']):this['view']['handleError'](),_0x2a97de();})['finally'](()=>{this['stopProcessing'](),_0x2a97de();});});}['_parseAndNormalizeContent'](_0x1f8b64,_0x519d8f=!0x1){const _0x1963bc=yi['exec'](_0x1f8b64);_0x1f8b64=_0x1963bc?_0x1f8b64['substring'](_0x1963bc[0x1]['length']):_0x1f8b64['length']<0x64&&!_0x519d8f?'':this['_stripMarkdownSyntax'](_0x1f8b64);const _0x50e0b9=this['_domParser']['parseFromString'](_0x1f8b64,'text/html');if(_0x1963bc){const _0x83c075=Array['from'](_0x50e0b9['body']['childNodes']);_0x83c075['reverse']();for(const _0x1e5da3 of _0x83c075){if(_0x1e5da3['nodeType']==Node['ELEMENT_NODE'])break;_0x1e5da3['remove']();}}const _0x163520=this['editor']['data']['processor']['toView'](this['_xmlSerializer']['serializeToString'](_0x50e0b9['body']));this['_isH1TagSupportEnabled']()||this['_normalizeResponseHeadings'](_0x163520);const _0x36b363=this['editor']['config']['get']('ai.assistant.preserveComments'),_0x5bae6c=this['editor']['data']['toModel'](_0x163520);return _0x36b363||_0x5bae6c['markers']['clear'](),this['editor']['data']['stringify'](_0x5bae6c);}['_normalizeResponseHeadings'](_0x4a2488){const _0x4cabe9=new _0x48cb1f(this['editor']['editing']['view']['document']),_0x1cfd6c=new _0x3bcca8({'name':/^h[1-5]$/}),_0x408b1e=[];let _0x56d946=!0x1;for(const _0x28f2f5 of _0x4a2488)_0x28f2f5['is']('element')&&_0x1cfd6c['match'](_0x28f2f5)&&(_0x408b1e['push'](_0x28f2f5),'h1'==_0x28f2f5['name']&&(_0x56d946=!0x0));if(_0x56d946){for(const _0x4c290b of _0x408b1e)_0x4cabe9['rename']('h'+(parseInt(_0x4c290b['name'][0x1])+0x1),_0x4c290b);}}['_isH1TagSupportEnabled'](){const {data:_0x5a7182,editing:_0x52c65e}=this['editor'],_0x12fe21=_0x5a7182['htmlProcessor']['toView']('<h1></h1>'),_0x1fe152=_0x5a7182['toView'](_0x5a7182['toModel'](_0x12fe21));return!!_0x52c65e['view']['domConverter']['viewToDom'](_0x1fe152)['querySelector']('h1');}['_sanitizeHTML'](_0xcabd59){return this['editor']['editing']['view']['domConverter']['setContentOf'](this['_sanitizationContainer'],_0xcabd59),this['_sanitizationContainer']['innerHTML'];}['_stripMarkdownSyntax'](_0x2a027d){const _0x58ed4f=_0x2a027d['trim']();return _0x58ed4f['startsWith']('```html')?_0x58ed4f['endsWith']('```')?_0x58ed4f['substring'](0x7,_0x58ed4f['length']-0x3):_0x58ed4f['substring'](0x7):_0x2a027d;}}const Li={'REPLACE':'replace','INSERT':'insert'};class Di extends kt{constructor(_0xa1df55){super(_0xa1df55),this['set']('isVisible',!0x1),this['set']('mainAction',Li['REPLACE']),this['replaceButton']=this['_createButton']('','ck-button-action'),this['replaceButton']['bind']('label')['to'](this,'mainAction',_0x267b69=>ki(_0xa1df55,'AI_'+_0x267b69['toUpperCase']()+'_CONTENT')),this['insertButton']=this['_createButton'](ki(_0xa1df55,'Insert\x20below')),this['tryAgainButton']=this['_createButton'](ki(_0xa1df55,'Try\x20again')),this['stopButton']=this['_createButton'](ki(_0xa1df55,'Stop'));const _0x2ce650=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-form__toolbar',_0x2ce650['if']('isVisible','ck-hidden',_0x26a9a8=>!_0x26a9a8)]}}),this['items']['addMany']([this['replaceButton'],this['insertButton'],this['tryAgainButton'],this['stopButton']]);}['_createButton'](_0x6e4813,_0x3fe819){const _0x1025ea=new Nt(this['locale']);return _0x1025ea['set']({'label':_0x6e4813,'class':_0x3fe819||'','isVisible':!0x0,'withText':!0x0}),_0x1025ea;}}class Pi extends vt{['contentFieldView'];['copyButtonView'];constructor(_0x134158,_0x1b8f63=''){super(_0x134158),this['set']({'value':null,'isVisible':!0x1,'isProcessing':!0x1});const _0xb58da5=this['bindTemplate'];this['contentFieldView']=new Hi(_0x134158,_0x1b8f63),this['copyButtonView']=this['_createCopyButton'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area-wrapper',_0xb58da5['if']('isVisible','ck-hidden',_0x463fd2=>!_0x463fd2)],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area',_0xb58da5['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 _0x5353b4=!0x1;this['on']('change:value',(_0x3b0a5e,_0x442a02,_0x23976d)=>{const _0x135e03=!this['contentFieldView']['element']['querySelector']('.ck-ai-form__loader');this['contentFieldView']['setContent'](_0x23976d),this['isProcessing']&&_0x135e03&&!_0x5353b4&&this['element']['scrollTo']({'top':this['element']['scrollHeight'],'behavior':'smooth'});}),this['on']('change:isProcessing',(_0x214083,_0x543624,_0x36e349)=>{_0x5353b4=!0x1,_0x36e349?(this['value']=null,this['contentFieldView']['appendLoader']()):this['value']||this['contentFieldView']['setContent']('');}),this['listenTo'](this['element'],'wheel',()=>{_0x5353b4=!0x0;}),this['listenTo'](this['element'],'mousedown',()=>{_0x5353b4=!0x0;});}['focus'](){this['element']['focus']();}['_createCopyButton'](){const _0x53da23=this['locale'],_0x1d9d7e=new Nt(this['locale']),_0x1e4d87='ck-ai-form__copy-button';return _0x1d9d7e['set']({'label':ki(_0x53da23,'Copy'),'icon':_0x47d488,'class':_0x1e4d87,'tooltip':!0x0}),_0x1d9d7e['bind']('isVisible')['to'](this,'value',_0x27b9ff=>!!_0x27b9ff),_0x1d9d7e['bind']('isEnabled')['to'](this,'isProcessing',_0x55474b=>!_0x55474b),_0x1d9d7e['on']('execute',()=>{this['_copyHTMLToClipboard'](this['contentFieldView']['element']),_0x1d9d7e['icon']=_0x406d61,_0x1d9d7e['class']=_0x1e4d87+'\x20ck-ai-form__copy-button--copied',this['focus'](),setTimeout(()=>{_0x1d9d7e['icon']=_0x47d488,_0x1d9d7e['class']=_0x1e4d87;},0x3e8);}),_0x1d9d7e;}['_copyHTMLToClipboard'](_0x20c06d){const {window:_0x42f9cc,document:_0x1f3d46}=ct;if(_0x42f9cc['ClipboardItem']){const {Blob:_0x118bed,ClipboardItem:_0xc6fe74}=_0x42f9cc,_0x390fe4=[new _0xc6fe74({'text/html':new _0x118bed([_0x20c06d['innerHTML']],{'type':'text/html'}),'text/plain':new _0x118bed([_0x20c06d['textContent']||''],{'type':'text/plain'})})];navigator['clipboard']['write'](_0x390fe4);}else{const _0x2a7f1a=_0x1f3d46['createElement']('div');_0x2a7f1a['style']['position']='absolute',_0x2a7f1a['style']['left']='-9999px',_0x2a7f1a['innerHTML']='<span>[</span>'+_0x20c06d['innerHTML']+'<span>]</span>',_0x1f3d46['body']['appendChild'](_0x2a7f1a);const _0x1c8545=_0x1f3d46['createRange']();_0x1c8545['setStartAfter'](_0x2a7f1a['firstElementChild']),_0x1c8545['setEndBefore'](_0x2a7f1a['lastElementChild']);const _0x14df5a=_0x42f9cc['getSelection']();_0x14df5a['removeAllRanges'](),_0x14df5a['addRange'](_0x1c8545),_0x1f3d46['execCommand']('copy'),_0x2a7f1a['remove']();}}}class Hi extends vt{constructor(_0x3b43a4,_0xdaf3a9=''){super(_0x3b43a4),this['loaderView']=this['_createLoader'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content',_0xdaf3a9,'ck-reset_all-excluded','ck-ai-form__content-field']}});}['setContent'](_0x39d0f6){this['element']['innerHTML']=_0x39d0f6;}['appendLoader'](){this['element']['appendChild'](this['loaderView']['element']);}['_createLoader'](){const _0xdb7335=new vt(),_0x1ba6b3=this['locale'],_0x489a26=new yt();return _0x489a26['isVisible']=!0x0,_0xdb7335['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__loader']},'children':[_0x489a26,{'text':ki(_0x1ba6b3,'AI\x20is\x20writing...')}]}),_0xdb7335['render'](),_0xdb7335;}}class Mi extends vt{constructor(_0x28e6c6,_0x5296d5=''){super(_0x28e6c6);const _0x2a755a=new xt(),_0x3e3d42=this['bindTemplate'];this['set']('text',_0x5296d5),_0x2a755a['content']=_0x5348f5,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__error']},'children':[_0x2a755a,{'text':_0x3e3d42['to']('text')}]});}}class Ui extends Lt{['submitButtonView'];['showHistoryButtonView'];constructor(_0x153c7a,_0x11e90e){super(_0x153c7a,_0x11e90e),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',(_0x4ccb5b,_0x47f348)=>{_0x4ccb5b['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x47f348());});}['_createSubmitButton'](){const _0xd7aba2=new Nt(this['locale']),_0x160b9a=this['locale'];return _0xd7aba2['set']({'icon':_0x1f67f2,'label':ki(_0x160b9a,'Submit'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-form__submit'}),_0xd7aba2['on']('execute',()=>{this['submit']();}),_0xd7aba2['bind']('isEnabled')['to'](this['queryView']['fieldView'],'isEmpty',this,'isEnabled',(_0x5ea5b4,_0x3a262b)=>!_0x5ea5b4&&_0x3a262b),_0xd7aba2;}['_createShowHistoryButton'](){const _0x23ab5c=new Nt(this['locale']),_0x3c33ac=this['resultsView'],_0xee0682=this['locale'];_0x23ab5c['set']({'label':ki(_0xee0682,'History'),'withText':!0x1,'icon':_0x592da0,'tooltip':!0x0,'tooltipPosition':'sw','class':'ck-ai-form__toggle-history'}),_0x23ab5c['bind']('isOn')['to'](_0x3c33ac,'isVisible'),_0x23ab5c['bind']('isEnabled')['to'](this,'isEnabled'),_0x23ab5c['on']('execute',()=>{_0x3c33ac['isVisible']=!_0x3c33ac['isVisible'],_0x3c33ac['isVisible']?this['filteredView']['focus']():this['focus']();});const _0xe2661=()=>{ct['window']['requestAnimationFrame'](()=>{if(lt(this['element'])){const _0x93733a=new ut(this['queryView']['fieldView']['element']),_0x49f330=_0x93733a['width'],_0x24e723='rtl'===_0xee0682['uiLanguageDirection']?'left':'right';_0x93733a['excludeScrollbarsAndBorders'](),_0x23ab5c['element']['style'][_0x24e723]=_0x49f330-_0x93733a['width']+0x1+'px';}});};return this['queryView']['fieldView']['on']('update',_0xe2661),this['on']('render',_0xe2661),_0x23ab5c;}['submit'](){const _0x4c2b23=this['queryView']['fieldView']['element']['value'];this['fire']('submit',_0x4c2b23);}['focus'](_0x26550c){-0x1===_0x26550c?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}}class Vi extends Dt{['historyGroupView'];['clearHistoryButton'];constructor(_0x595189){super(_0x595189),this['clearHistoryButton']=this['_createClearHistoryButton'](),this['historyGroupView']=new Pt(),this['historyGroupView']['children']['add'](this['clearHistoryButton'],0x1),this['historyGroupView']['label']=ki(_0x595189,'Prompt\x20history'),this['historyGroupView']['items']['delegate']('execute')['to'](this),this['items']['add'](this['historyGroupView']);}['filter'](){let _0x41726f=0x0;for(const _0x58ec2b of this['items'])_0x41726f+=_0x58ec2b['items']['length'];return{'resultsCount':_0x41726f,'totalItemsCount':_0x41726f};}['_createClearHistoryButton'](){const _0x3223da=this['locale'],_0x43ba76=new Nt(this['locale']);return _0x43ba76['set']({'label':'('+ki(_0x3223da,'Clear')+')','withText':!0x0}),_0x43ba76['on']('execute',()=>this['fire']('clearHistory')),_0x43ba76;}}class Bi extends Ht{constructor(_0x47601c){super();const _0x5ccefe=new Mt(),_0x2ef895=new Nt(this['locale'],_0x5ccefe);this['children']['add'](_0x2ef895),_0x2ef895['set']({'label':_0x47601c['prompt'],'withText':!0x0}),_0x2ef895['on']('execute',()=>{this['fire']('execute',{'value':_0x1cfbb0(_0x47601c['prompt'])});});}}const Gi='CKEditor/AIFormView/PromptHistory';class Fi extends dt{constructor(){super(),this['_loadFromSessionStorage'](),this['on']('add',(_0x5cd0fd,_0x5d47c8)=>{const _0x2dd743=Ki(_0x5d47c8['prompt']);for(const _0x238294 of this)if(_0x238294!=_0x5d47c8&&Ki(_0x238294['prompt'])===_0x2dd743){this['remove'](_0x238294);break;}this['length']>0x14&&this['remove'](this['last']),this['_saveToSessionStorage']();}),this['on']('remove',()=>{this['_saveToSessionStorage']();});}['_loadFromSessionStorage'](){const _0x245c37=sessionStorage['getItem'](Gi)||'[]';this['addMany'](JSON['parse'](_0x245c37));}['_saveToSessionStorage'](){sessionStorage['setItem'](Gi,JSON['stringify'](this['map'](_0x3ff8c6=>_0x3ff8c6)));}}function Ki(_0x5c2f4d){return _0x5c2f4d['toLowerCase']()['trim']();}class Wi extends vt{['focusTracker'];['keystrokes'];['contentArea'];['toolbar'];['promptView'];['errorView'];['_focusables'];['focusCycler'];['_promptHistory'];constructor(_0x20149b,_0x566e51,_0x3d6aa7=''){super(_0x20149b),this['set']('isEnabled',!0x0),this['set']('isProcessing',!0x1),this['set']('prompt',''),this['set']('value',''),this['set']('isError',!0x1),this['set']('mainAction',Li['REPLACE']),this['_promptHistory']=new Fi(),this['errorView']=new Mi(_0x20149b),this['contentArea']=new Pi(_0x20149b,_0x3d6aa7),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 Ut({'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 _0x4f88dd=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form',_0x566e51],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form-content']},'children':[{'tag':'div','attributes':{'class':[_0x4f88dd['if']('isError','ck-hidden',_0x50d32b=>!_0x50d32b)]},'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'](_0xfdbdce=0x1){-0x1===_0xfdbdce?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 _0x1c7210=this['locale'],_0x3ebb51=new Ui(_0x1c7210,{'queryView':{'label':ki(_0x1c7210,'Ask\x20AI\x20to\x20edit\x20or\x20generate'),'creator':Vt,'showIcon':!0x1,'showResetButton':!0x1},'infoView':{'text':{'noSearchableItems':{'primary':ki(_0x1c7210,'Empty\x20history'),'secondary':ki(_0x1c7210,'Ask\x20AI\x20and\x20your\x20prompts\x20will\x20be\x20listed\x20here\x20for\x20you\x20to\x20use\x20later.')}}},'filteredView':this['_createHistoryView'](),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1});return _0x3ebb51['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x453b9a,_0x435288)=>_0x453b9a&&!_0x435288),this['listenTo'](_0x3ebb51,'submit',(_0x56c75e,_0x19999e)=>{this['prompt']=_0x19999e;const _0x464e54=_0x5aed4a(_0x19999e);this['fire']('submitPrompt',_0x464e54),_0x19999e['trim']()&&this['_promptHistory']['add']({'prompt':_0x464e54},0x0);},{'priority':'high'}),_0x3ebb51;}['_createHistoryView'](){const _0x3c6ec7=new Vi(this['locale']);return _0x3c6ec7['historyGroupView']['items']['bindTo'](this['_promptHistory'])['as'](Bi),_0x3c6ec7['on']('clearHistory',()=>{this['_promptHistory']['clear'](),this['promptView']['search'](''),this['promptView']['focus']();}),_0x3c6ec7;}['_createToolbar'](){const _0x272492=new Di(this['locale']);return _0x272492['replaceButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0x6b534b,_0x3e6d77,_0x2282ef)=>_0x6b534b&&!_0x3e6d77&&!!_0x2282ef),_0x272492['replaceButton']['delegate']('execute')['to'](this,'replaceContent'),_0x272492['insertButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0x51db85,_0x56b203,_0x15d7f6)=>_0x51db85&&!_0x56b203&&!!_0x15d7f6),_0x272492['insertButton']['delegate']('execute')['to'](this,'insertContentBelow'),_0x272492['tryAgainButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x3e30c3,_0x3aa631)=>_0x3e30c3&&!_0x3aa631),_0x272492['tryAgainButton']['delegate']('execute')['to'](this,'tryAgainEvent'),_0x272492['stopButton']['bind']('isEnabled')['to'](this,'isProcessing'),_0x272492['stopButton']['delegate']('execute')['to'](this,'stopProcessing'),_0x272492;}['startProcessing'](){this['value']='',this['isError']=!0x1,this['isProcessing']=!0x0,this['contentArea']['isVisible']=!0x0,this['toolbar']['isVisible']=!0x0,this['contentArea']['focus']();}['finishProcessing'](){const _0x3adafb=this['locale'];this['isProcessing']=!0x1,this['prompt']='',this['promptView']['reset'](),this['value']&&(this['promptView']['queryView']['label']=ki(_0x3adafb,'Ask\x20AI\x20to\x20improve\x20generated\x20text'));}['handleError'](_0x52bd89){const _0x25f732=this['locale'];this['finishProcessing'](),this['isError']=!0x0,this['errorView']['text']=_0x52bd89||ki(_0x25f732,'AI_ERROR_FAILED'),this['value']||(this['contentArea']['isVisible']=!0x1);}}const Yi=globalThis['DataTransfer'];class $i extends _0x5e248a{['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[_0x1cb775,Si,Ri,Bt];}constructor(_0x1e9075){super(_0x1e9075),_0x1e9075['config']['define']('ai.assistant.disabledElements',['media','rawHtml','tableOfContents']),_0x1e9075['config']['define']('ai.assistant.contentAreaCssClass',''),_0x1e9075['config']['define']('ai.assistant.useTheme',!0x0),this['_uiCssClasses']='ck-ai-assistant-ui'+(_0x1e9075['config']['get']('ai.assistant.useTheme')?'\x20ck-ai-assistant-ui_theme':'');}['init'](){const {editor:_0x2f947c}=this;this['_aiAdapter']=_0x2f947c['plugins']['get'](Ri),this['_dialog']=_0x2f947c['plugins']['get'](Bt),this['_formView']=null,this['_commandDefinitions']=this['_getResolvedCommandsDefinitions']();const _0x56f698=new Ni(_0x2f947c,Array['from'](this['_commandDefinitions']['values']()));_0x2f947c['commands']['add']('showAIAssistant',_0x56f698),_0x2f947c['ui']['componentFactory']['add']('aiCommands',_0x4191b9=>{const _0x189af4=Gt(_0x4191b9);return _0x189af4['set']({'class':'ck-ai-commands-dropdown\x20'+this['_uiCssClasses']}),_0x189af4['buttonView']['set']({'label':ki(_0x4191b9,'AI\x20Commands'),'icon':_0x3a64fb,'tooltip':!0x0}),_0x189af4['on']('execute',_0x561746=>this['_onExecute'](_0x561746['source']['id'])),Ft(_0x189af4,_0x2f947c['ui']['view']['body'],function(_0x1db555){const _0x56a77c=wi(_0x1db555['config']['get']('ai.assistant.commands'),_0x1db555['locale']),_0x532677=Qi(_0x1db555,_0x56a77c)['filter'](_0x1f28d3=>_0x1f28d3['commands']['length']);if(0x1===_0x532677['length'])return Qi(_0x1db555,_0x532677[0x0]['commands'])['map'](_0x4fe025=>({'id':_0x4fe025['id'],'label':_0x4fe025['label']}));return _0x532677['map'](_0x49a639=>{const {groupId:_0x10bbbc,groupLabel:_0x21a5c5,commands:_0xd3a1bb}=_0x49a639,_0xb9b6d2=Qi(_0x1db555,_0xd3a1bb)['map'](_0x2e6cc1=>({'id':_0x2e6cc1['id'],'label':_0x2e6cc1['label']}));return{'id':_0x10bbbc,'menu':_0x21a5c5||_0x10bbbc,'children':_0xb9b6d2};});}(_0x2f947c),{'ariaLabel':ki(_0x4191b9,'AI\x20Commands')}),_0x189af4['menuView']['menuPanelClass']='ck-ai-commands-dropdown\x20'+this['_uiCssClasses'],_0x56f698['on']('change:enabledCommandsIds',_0x2f9dbe),_0x189af4['menuView']['once']('render',_0x2f9dbe),_0x189af4;function _0x2f9dbe(){_0x189af4['isEnabled']=_0x56f698['enabledCommandsIds']['length']>0x0;for(const _0x35c5d8 of _0x189af4['menuView']['buttons'])_0x35c5d8['isEnabled']=_0x56f698['enabledCommandsIds']['includes'](_0x35c5d8['id']);}}),_0x2f947c['ui']['componentFactory']['add']('menuBar:aiCommands',_0x3bca05=>{const _0x2bf5a6=new Kt(_0x3bca05);_0x2bf5a6['buttonView']['set']({'label':ki(_0x3bca05,'AI\x20Commands'),'icon':_0x3a64fb}),_0x2bf5a6['bind']('isEnabled')['to'](_0x56f698,'enabledCommandsIds',_0x15bda7=>_0x15bda7['length']>0x0);const _0x32d0f3=wi(_0x2f947c['config']['get']('ai.assistant.commands'),_0x3bca05);return this['_populateMenuBarMenu'](_0x56f698,_0x2bf5a6,_0x32d0f3,_0x164ec4=>this['_onExecute'](_0x164ec4)),_0x2bf5a6;}),_0x2f947c['ui']['componentFactory']['add']('aiAssistant',()=>{const _0x5b9296=this['_createAIAssistantUIButton'](Nt);return _0x5b9296['set']({'tooltip':!0x0,'class':'ck-ai-assistant-button\x20'+this['_uiCssClasses']}),_0x5b9296;}),_0x2f947c['ui']['componentFactory']['add']('menuBar:aiAssistant',()=>{const _0x19802b=this['_createAIAssistantUIButton'](Wt);return _0x19802b['set']({'role':'menuitemcheckbox'}),_0x19802b;}),this['licenseKey']=this['editor']['config']['get']('licenseKey');const _0x1d7de8=this['editor'];this['_licenseKeyCheckInterval']=setInterval(()=>{let _0x3d6652;for(const _0x3d3387 in _0x1d7de8){const _0x1ba3ee=_0x3d3387,_0x17cf30=_0x1d7de8[_0x1ba3ee];if('aiLicenseKeyValid'==_0x17cf30||'aiLicenseKeyInvalid'==_0x17cf30||'aiLicenseKeyExpired'==_0x17cf30||'aiLicenseKeyDomainLimit'==_0x17cf30||'aiLicenseKeyNotAllowed'==_0x17cf30||'aiLicenseKeyEvaluationLimit'==_0x17cf30||'aiLicenseKeyUsageLimit'==_0x17cf30){delete _0x1d7de8[_0x1ba3ee],_0x3d6652=_0x17cf30,clearInterval(this['_licenseKeyCheckInterval']),this['_licenseKeyCheckInterval']=void 0x0;break;}}'aiLicenseKeyInvalid'==_0x3d6652&&_0x1d7de8['_showLicenseError']('invalid'),'aiLicenseKeyExpired'==_0x3d6652&&_0x1d7de8['_showLicenseError']('expired'),'aiLicenseKeyDomainLimit'==_0x3d6652&&_0x1d7de8['_showLicenseError']('domainLimit'),'aiLicenseKeyNotAllowed'==_0x3d6652&&_0x1d7de8['_showLicenseError']('featureNotAllowed','AIAssistant'),'aiLicenseKeyEvaluationLimit'==_0x3d6652&&_0x1d7de8['_showLicenseError']('evaluationLimit'),'aiLicenseKeyUsageLimit'==_0x3d6652&&_0x1d7de8['_showLicenseError']('usageLimit');},0x3e8);}['destroy'](){super['destroy'](),this['_licenseKeyCheckInterval']&&clearInterval(this['_licenseKeyCheckInterval']);}['showUI'](_0x11a193='',_0x29107d='',_0x1e0e51='custom'){const _0x1ee751=this['editor'],_0x546266=_0x1ee751['editing']['view'],_0x3e4539=_0x1ee751['plugins']['get'](Si),_0xadabad=_0x1ee751['plugins']['get'](_0x1cb775);_0x3e4539['showFakeVisualSelection']();const _0x50d47a=new Yi(),_0x3698fb=new ClipboardEvent('copy',{'clipboardData':_0x50d47a}),_0x4e3b75=new _0x4329ca(_0x50d47a),_0x3f23c2=new _0x5d1575(_0x546266,_0x3698fb,{'dataTransfer':_0x4e3b75});_0xadabad['_forceMarkersCopy']('comment',()=>{_0x546266['document']['fire']('copy',_0x3f23c2);}),this['_formView']||(this['_initView'](),this['_aiAssistantController']=new xi(_0x1ee751,this['_aiAdapter']['textAdapter'],this['_formView']));let _0x1653e4=_0x4e3b75['getData']('text/html');const _0x171210=_0x1ee751['model']['document']['selection'],_0x3ac39a=Array['from'](_0x171210['getRanges']());0x1===_0x3ac39a['length']&&_0x3ac39a[0x0]['isFlat']&&!_0x171210['getSelectedElement']()&&''!==_0x1653e4['replace'](/&nbsp;/g,'')['trim']()&&(_0x1653e4='<p>'+_0x1653e4+'</p>'),this['_aiAssistantController']['updateView']({'actionId':_0x1e0e51,'query':_0x11a193,'htmlContent':_0x1653e4,'label':_0x29107d,'mainActionLabel':Li[_0x1ee751['model']['document']['selection']['isCollapsed']?'INSERT':'REPLACE']}),'aiAssistant'!==this['_dialog']['id']?this['_dialog']['show']({'id':'aiAssistant','icon':_0x31dd3a,'title':ki(this['editor']['locale'],'AI\x20Assistant'),'content':this['_formView'],'position':Yt['EDITOR_TOP_SIDE'],'onShow':()=>{this['_formView']['focus']();},'onHide':()=>{this['_aiAssistantController']['reset'](),_0x3e4539['hideFakeVisualSelection']();}}):this['_dialog']['view']['wasMoved']||this['_dialog']['view']['updatePosition']();}['hideUI'](){this['_dialog']['hide']();}['_getResolvedCommandsDefinitions'](){const _0x250a11=new Map(),_0xb332b9=wi(this['editor']['config']['get']('ai.assistant.commands'),this['editor']['locale']);for(const _0x4f8e15 of _0xb332b9)for(const _0x447dce of _0x4f8e15['commands'])_0x250a11['set'](_0x447dce['id'],{..._0x447dce,'groupId':_0x4f8e15['groupId'],'groupLabel':_0x4f8e15['groupLabel']||_0x4f8e15['groupId']});return _0x250a11;}['_createAIAssistantUIButton'](_0x3d9618){const _0x5091e4=this['editor'],_0x19b139=_0x5091e4['commands']['get']('showAIAssistant'),_0xff44d0=new _0x3d9618(_0x5091e4['locale']);return _0xff44d0['set']({'label':ki(_0x5091e4['locale'],'AI\x20Assistant'),'icon':_0x31dd3a,'isToggleable':!0x0}),_0xff44d0['bind']('isEnabled')['to'](_0x19b139),_0xff44d0['bind']('isOn')['to'](this['_dialog'],'id',_0x4baf2f=>'aiAssistant'===_0x4baf2f),this['listenTo'](_0xff44d0,'execute',()=>{_0xff44d0['isOn']?this['hideUI']():_0x19b139['execute']();}),_0xff44d0;}['_initView'](){const _0x21c23b=this['editor']['plugins']['get'](Si);this['_formView']=new Wi(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',()=>{_0x21c23b['insertContent'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['listenTo'](this['_formView'],'insertContentBelow',()=>{_0x21c23b['insertContentBelow'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['_initAriaAiStatusChangeAnnouncements']();}['_initAriaAiStatusChangeAnnouncements'](){const {locale:_0x282ab9,ui:{ariaLiveAnnouncer:_0x199622}}=this['editor'];this['_formView']['contentArea']['on']('change:isProcessing',(_0x547bb6,_0x69314e,_0x162fb2)=>{const _0x32a872=this['_aiAssistantController']['currentContext'];_0x162fb2?_0x199622['announce'](ki(_0x282ab9,'AI\x20is\x20writing')):_0x32a872&&_0x199622['announce'](ki(_0x282ab9,'Generated\x20content:\x20%0',_0x32a872),{'politeness':'polite','isUnsafeHTML':!0x0});}),this['_formView']['on']('change:isError',(_0x32ad85,_0x50bafc,_0x4ac849)=>{if(_0x4ac849){const _0x2c4830=this['_formView']['errorView']['text'];_0x199622['announce'](ki(_0x282ab9,'Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x2c4830));}});}['_onExecute'](_0xe2eab3){const _0x294c7d=this['_commandDefinitions']['get'](_0xe2eab3),_0x2e8c7a=this['editor'],_0x38a0fd=_0x2e8c7a['model']['document']['selection'],_0x24e318=_0x2e8c7a['commands']['get']('showAIAssistant'),_0x401e80=_0x2e8c7a['plugins']['get'](Si),_0x5ef35e=''+(_0x294c7d['groupId']!==Ci?_0x294c7d['groupLabel']+':\x20':'')+_0x294c7d['label'];if(!0x1!==_0x294c7d['requiresContent']&&_0x38a0fd['isCollapsed']){const _0x2a6399=At(_0x38a0fd['getSelectedBlocks']())||_0x2e8c7a['model']['schema']['getLimitElement'](_0x38a0fd);_0x2e8c7a['model']['change'](_0xe6eee=>{_0xe6eee['setSelection'](_0x2a6399,'in');});}_0x401e80['showFakeVisualSelection'](),_0x24e318['execute'](_0x294c7d['prompt'],_0x5ef35e,'command:'+_0xe2eab3);}['_populateMenuBarMenu'](_0x177122,_0x3f06e9,_0x1c5a93,_0x57a39e){const _0x580cc7=this['editor'],_0x22b0b1=_0x580cc7['locale'],_0x5008ce=new $t(_0x22b0b1),_0x1a1ae4=Qi(_0x580cc7,_0x1c5a93)['filter'](_0x49cfe9=>_0x49cfe9['commands']['length']);0x1===_0x1a1ae4['length']?this['_getMenuBarGroupButtons']({'command':_0x177122,'commands':_0x1a1ae4[0x0]['commands'],'parentMenuView':_0x3f06e9,'onExecute':_0x57a39e})['forEach'](_0x44be82=>_0x5008ce['items']['add'](_0x44be82)):_0x1a1ae4['forEach'](({groupId:_0x1148ef,groupLabel:_0x5ef45a,commands:_0x54fa6a})=>{const _0x22d99a=new qt(_0x22b0b1,_0x3f06e9),_0x2eebe2=new Kt(_0x22b0b1),_0x49d9a7=new $t(_0x22b0b1),_0x97de41=this['_getMenuBarGroupButtons']({'command':_0x177122,'commands':_0x54fa6a,'parentMenuView':_0x2eebe2,'onExecute':_0x57a39e});_0x2eebe2['buttonView']['set']({'label':_0x5ef45a||_0x1148ef}),_0x2eebe2['delegate']('execute')['to'](_0x3f06e9),_0x49d9a7['items']['addMany'](_0x97de41),_0x2eebe2['panelView']['children']['add'](_0x49d9a7),_0x22d99a['children']['add'](_0x2eebe2),_0x5008ce['items']['add'](_0x22d99a);}),_0x3f06e9['panelView']['children']['add'](_0x5008ce);}['_getMenuBarGroupButtons']({command:_0x13759c,commands:_0x3eeba3,parentMenuView:_0x52f7a0,onExecute:_0x1a7cc4}){const _0xe95ec4=this['editor'],_0x49639f=_0xe95ec4['locale'];return Qi(_0xe95ec4,_0x3eeba3)['map'](_0x491f78=>{const _0x45057a=new qt(_0x49639f,_0x52f7a0),_0x1f4623=new Wt(_0x49639f);return _0x1f4623['set']({'label':_0x491f78['label']}),_0x1f4623['delegate']('execute')['to'](_0x52f7a0),_0x1f4623['on']('execute',()=>_0x1a7cc4(_0x491f78['id'])),_0x1f4623['bind']('isEnabled')['to'](_0x13759c,'enabledCommandsIds',_0x1d6385=>_0x1d6385['includes'](_0x491f78['id'])),_0x45057a['children']['add'](_0x1f4623),_0x45057a;});}}function qi(_0x550fc3,_0x2c17df){return void 0x0!==_0x550fc3['order']&&void 0x0===_0x2c17df['order']?0x1:void 0x0===_0x550fc3['order']&&void 0x0!==_0x2c17df['order']?-0x1:void 0x0!==_0x550fc3['order']&&void 0x0!==_0x2c17df['order']?_0x550fc3['order']-_0x2c17df['order']:0x0;}function Qi(_0x493083,_0x5441fd){_0x5441fd['sort'](qi);const _0x48cad7={},_0xd36422=[];for(const _0x3021f0 of _0x5441fd)if(void 0x0!==_0x3021f0['order']){if(_0x3021f0['order']in _0x48cad7)throw new at('ai-commands-config-order-collision',_0x493083,{'conflictingDefinitions':[_0x3021f0,_0x48cad7[_0x3021f0['order']]]});_0x48cad7[_0x3021f0['order']]=_0x3021f0,_0xd36422['splice'](_0x3021f0['order'],0x0,_0x3021f0);}else _0xd36422['push'](_0x3021f0);return _0xd36422;}class Xi extends _0x5e248a{static get['requires'](){return[$i,Si];}static get['pluginName'](){return'AIAssistant';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x5f2af0){super(_0x5f2af0);const _0x2dda6a=_0x5f2af0['config'],_0x2d2a44=_0x5f2af0['locale'];_0x2dda6a['define']('ai.assistant.preserveComments',!0x0),_0x2dda6a['define']('ai.assistant.commands',zi(_0x2d2a44)),_0x2dda6a['define']('ai.assistant.extraCommandGroups',[]),_0x2dda6a['define']('ai.assistant.removeCommands',[]);let _0x25ec81=wi(_0x2dda6a['get']('ai.assistant.commands'),_0x2d2a44);const _0x27f1cb=_0x2dda6a['get']('ai.assistant.extraCommandGroups'),_0xbecad7=_0x2dda6a['get']('ai.assistant.removeCommands');_0x27f1cb['forEach'](_0x48d7ff=>{const _0x41c618=_0x25ec81['find'](_0x2f1e7a=>_0x2f1e7a['groupId']===_0x48d7ff['groupId']);_0x41c618?_0x41c618['commands']=_0x41c618['commands']['concat'](_0x48d7ff['commands']):_0x25ec81['push'](_0x48d7ff);}),_0x25ec81=_0x25ec81['filter'](_0x541f9e=>!_0xbecad7['includes'](_0x541f9e['groupId'])),_0x25ec81['forEach'](_0xcc961=>{_0xcc961['commands']=_0xcc961['commands']['filter'](_0x2c40d7=>!_0xbecad7['includes'](_0x2c40d7['id']));}),_0x2dda6a['set']('ai.assistant.commands',_0x25ec81);}}function zi(_0xd10892){return[{'groupId':'editOrReview','groupLabel':ki(_0xd10892,'Edit\x20or\x20review'),'commands':[{'id':'improveWriting','label':ki(_0xd10892,'Improve\x20writing'),'prompt':'Fix\x20spelling\x20mistakes,\x20use\x20proper\x20grammar\x20and\x20apply\x20good\x20writing\x20practices.\x20Do\x20not\x20lose\x20the\x20original\x20meaning.'},{'id':'makeShorter','label':ki(_0xd10892,'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':ki(_0xd10892,'Make\x20longer'),'prompt':'Improve\x20this\x20content\x20by\x20using\x20descriptive\x20language\x20and\x20inserting\x20more\x20information\x20and\x20more\x20detailed\x20explanations.'},{'id':'simplifyLanguage','label':ki(_0xd10892,'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':ki(_0xd10892,'Generate\x20from\x20selection'),'commands':[{'id':'summarize','label':ki(_0xd10892,'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':ki(_0xd10892,'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':ki(_0xd10892,'Change\x20tone'),'commands':[{'id':'professional','label':ki(_0xd10892,'Professional'),'prompt':'Improve\x20using\x20polished,\x20formal,\x20and\x20respectful\x20language\x20to\x20convey\x20professional\x20expertise\x20and\x20competence.'},{'id':'casual','label':ki(_0xd10892,'Casual'),'prompt':'Improve\x20using\x20casual,\x20informal\x20language\x20to\x20convey\x20a\x20casual\x20conversation\x20with\x20a\x20real\x20person.'},{'id':'direct','label':ki(_0xd10892,'Direct'),'prompt':'Improve\x20using\x20direct\x20language,\x20using\x20only\x20the\x20essential\x20information.'},{'id':'confident','label':ki(_0xd10892,'Confident'),'prompt':'Improve\x20using\x20compelling,\x20optimistic\x20language\x20to\x20convey\x20confidence\x20in\x20the\x20writing.'},{'id':'friendly','label':ki(_0xd10892,'Friendly'),'prompt':'Improve\x20using\x20friendly,\x20comforting\x20language,\x20to\x20convey\x20understanding\x20and\x20empathy.'}]},{'groupId':'changeStyle','groupLabel':ki(_0xd10892,'Change\x20style'),'commands':[{'id':'business','label':ki(_0xd10892,'Business'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20business\x20professional\x20with\x20formal\x20language.'},{'id':'legal','label':ki(_0xd10892,'Legal'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20legal\x20professional\x20using\x20valid\x20legal\x20terminology.'},{'id':'journalism','label':ki(_0xd10892,'Journalism'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20journalist\x20using\x20engaging\x20language\x20to\x20convey\x20the\x20importance\x20of\x20the\x20information.'},{'id':'poetic','label':ki(_0xd10892,'Poetic'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20poem\x20using\x20poetic\x20techniques\x20without\x20losing\x20the\x20original\x20meaning.'}]},{'groupId':'translate','groupLabel':ki(_0xd10892,'Translate'),'commands':[{'id':'translateEnglish','label':ki(_0xd10892,'English'),'prompt':'Translate\x20the\x20content\x20to\x20English\x20language.'},{'id':'translateSpanish','label':ki(_0xd10892,'Spanish'),'prompt':'Translate\x20the\x20content\x20to\x20Spanish\x20language.'},{'id':'translatePortuguese','label':ki(_0xd10892,'Portuguese'),'prompt':'Translate\x20the\x20content\x20to\x20Portuguese\x20language.'},{'id':'translateGerman','label':ki(_0xd10892,'German'),'prompt':'Translate\x20the\x20content\x20to\x20German\x20language.'},{'id':'translateFrench','label':ki(_0xd10892,'French'),'prompt':'Translate\x20the\x20content\x20to\x20French\x20language.'},{'id':'translateChinese','label':ki(_0xd10892,'Simplified\x20Chinese'),'prompt':'Translate\x20the\x20content\x20to\x20Simplified\x20Chinese\x20language.'},{'id':'translateHindi','label':ki(_0xd10892,'Hindi'),'prompt':'Translate\x20the\x20content\x20to\x20Hindi\x20language.'},{'id':'translateArabic','label':ki(_0xd10892,'Arabic'),'prompt':'Translate\x20the\x20content\x20to\x20Arabic\x20language.'}]}];}class ji extends _0x5e248a{['abortController'];static get['requires'](){return[Ri];}constructor(_0x35790f){super(_0x35790f),this['abortController']=new AbortController();}['init'](){this['editor']['plugins']['get'](Ri)['textAdapter']=this;}['abort'](){this['abortController']['signal']['aborted']||(this['abortController']['abort'](),this['abortController']=new AbortController());}async['makeRequest'](_0x41c46c){return this['sendRequest'](_0x41c46c)['catch'](_0xbd5791=>{if(_0xbd5791 instanceof Oi)return Promise['reject'](_0xbd5791);if('AbortError'==_0xbd5791['name'])return Promise['resolve']();throw console['error'](_0xbd5791),new at('aitextadapter-send-request-failed',null);});}async['_prepareRequestHeaders'](_0x376233,_0xf6ff8){const _0x61779e=this['editor']['locale'],_0x3aff79={'Content-Type':'application/json'};if('object'==typeof _0x376233)Object['assign'](_0x3aff79,_0x376233);else{if(_0x376233)try{const _0x154f50=await _0x376233(_0xf6ff8);Object['assign'](_0x3aff79,_0x154f50);}catch{return Promise['reject'](new Oi(ki(_0x61779e,'AI_ERROR_GET_HEADERS')));}}return _0x3aff79;}async['_prepareRequestParameters'](_0x486b48,_0x173d36){const _0x4d154b=this['editor']['locale'];if('object'==typeof _0x486b48)return _0x486b48;try{return await _0x486b48(_0x173d36);}catch{return Promise['reject'](new Oi(ki(_0x4d154b,'AI_ERROR_GET_PARAMETERS')));}}}class Ji extends ji{['_apiUrl'];['_requestHeaders'];['_requestParameters'];static get['pluginName'](){return'OpenAITextAdapter';}constructor(_0xbf434){super(_0xbf434),_0xbf434['config']['define']('ai.assistant.adapter.openAI.apiUrl','https://api.openai.com/v1/chat/completions'),_0xbf434['config']['get']('ai.assistant.adapter.openAI.requestParameters')||_0xbf434['config']['define']('ai.assistant.adapter.openAI.requestParameters',{'model':'gpt-4o','temperature':0x1,'top_p':0x1,'stream':!0x0}),this['_apiUrl']=_0xbf434['config']['get']('ai.assistant.adapter.openAI.apiUrl'),this['_requestHeaders']=_0xbf434['config']['get']('ai.assistant.adapter.openAI.requestHeaders')||{},this['_requestParameters']=_0xbf434['config']['get']('ai.assistant.adapter.openAI.requestParameters');}async['sendRequest']({query:_0x3f7bd8,context:_0x5f583e,onData:_0x108479,actionId:_0xb7d881}){const _0xf11daa=this['editor']['locale'],_0x123949=await this['prepareMessages'](_0x3f7bd8,_0x5f583e,_0xb7d881),_0x9ecf83=await this['_prepareRequestHeaders'](this['_requestHeaders'],_0xb7d881),_0x4fff3e=await this['_prepareRequestParameters'](this['_requestParameters'],_0xb7d881),_0x3e2eca={'messages':_0x123949,..._0x4fff3e},_0x20f9e5={'method':'POST','headers':_0x9ecf83,'body':JSON['stringify'](_0x3e2eca),'signal':this['abortController']['signal']},_0x224e99=await fetch(this['_apiUrl'],_0x20f9e5);if(_0x224e99['ok'])return _0x4fff3e['stream']?await this['_readStreamableResponse'](_0x224e99,_0x108479):await this['_readStaticResponse'](_0x224e99,_0x108479),Promise['resolve']();{const _0x14d9d0=await _0x224e99['text']();return _0x14d9d0['includes']('context_length_exceeded')?Promise['reject'](new Oi(ki(_0xf11daa,'AI_ERROR_CONTEXT_LENGTH'))):_0x14d9d0['includes']('Moderation')?Promise['reject'](new Oi(ki(_0xf11daa,'AI_ERROR_MODERATION'))):Promise['reject'](new Error(_0x14d9d0));}}async['prepareMessages'](_0x1f1b60,_0xbc7200,_0x46a1f6){let _0x45a5b2,_0x16fdb6;return _0xbc7200?(_0x45a5b2='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.',_0x16fdb6='Instruction:\x0a'+_0x1f1b60+'\x0aYou\x20must\x20keep\x20the\x20text\x20formatting.\x0a\x0aContent:\x0a'+_0xbc7200):(_0x45a5b2='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.',_0x16fdb6=_0x1f1b60),[{'role':'system','content':_0x45a5b2},{'role':'user','content':_0x16fdb6}];}async['_readStreamableResponse'](_0x221005,_0x274b06){const _0x4fb585=_0x221005['body']['getReader'](),_0x33a961=new TextDecoder();let _0x1e71a0='',_0x4d9181='',_0x356873='',_0x37b47d=!0x1;for(;!_0x37b47d;){const {done:_0x1bb174,value:_0x28a2a7}=await _0x4fb585['read'](),_0x55e5ec=_0x1e71a0+_0x33a961['decode'](_0x28a2a7);let _0x681e27='';_0x37b47d=_0x1bb174;try{_0x681e27=this['_cleanUpData'](_0x55e5ec),_0x1e71a0='';}catch{_0x1e71a0=_0x55e5ec;continue;}_0x4d9181+=_0x681e27,!_0x37b47d&&this['_isBufferIncomplete'](_0x4d9181)||_0x4d9181&&(_0x356873+=_0x4d9181,_0x4d9181='',_0x274b06(_0x356873));}return Promise['resolve']();}async['_readStaticResponse'](_0x32b804,_0xf5482e){return _0xf5482e((await _0x32b804['json']())['choices'][0x0]['message']['content']),Promise['resolve']();}['_isBufferIncomplete'](_0x298f5e){const _0x4b840c=_0x298f5e['split']('<')['length']!==_0x298f5e['split']('>')['length'],_0x340b4c=_0x298f5e['length']<0x1e;return _0x4b840c&&_0x340b4c;}['_cleanUpData'](_0x468e8f){return _0x468e8f['split'](/\n(?![^{]*\})/g)['map'](_0x4b9c63=>_0x4b9c63['replace']('data:\x20',''))['filter'](_0xbcc5ad=>_0xbcc5ad&&_0xbcc5ad['length']>0x0&&'[DONE]'!==_0xbcc5ad)['map'](_0x1fc76d=>{const {choices:_0x1f8a0e}=JSON['parse'](_0x1fc76d);if(_0x1f8a0e[0x0]?.['delta']?.['content'])return _0x1f8a0e[0x0]['delta']['content'];})['filter'](_0x28f607=>_0x28f607)['join']('');}}class Zi extends ji{static get['pluginName'](){return'AWSTextAdapter';}['init'](){super['init'](),It('ai-aws-adapter-not-supported');}async['sendRequest'](_0x486a91){throw Et('ai-aws-adapter-not-supported'),new Oi(ki(this['editor']['locale'],'AI_ERROR_AWS_NOT_SUPPORTED'));}}class ts extends Nt{constructor(_0x83b37b,_0x2db667={}){super(_0x83b37b),this['isToggleable']=!0x0,this['set']('side',_0x2db667['side']||'top');const _0xc548bf=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-tab-button',...pt(_0x2db667['class']||[]),_0xc548bf['to']('side',_0xc67437=>'ck-tab-button_'+_0xc67437),_0xc548bf['to']('class')]}});}['show'](){this['set']('isVisible',!0x0);}['hide'](){this['set']('isVisible',!0x1);}}class es extends vt{['children'];constructor(_0x1bc8ad,_0x5780e8={}){super(_0x1bc8ad);const _0x27940c=this['bindTemplate'];this['set']('isVisible',!0x1),this['set']('class',''),this['children']=this['createCollection'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-tab-panel',...pt(_0x5780e8['class']||[]),_0x27940c['to']('class'),_0x27940c['if']('isVisible','ck-hidden',_0x277166=>!_0x277166)]},'children':this['children']});}['show'](){this['set']('isVisible',!0x0);}['hide'](){this['set']('isVisible',!0x1);}}class is extends vt{['buttonViews']=this['createCollection']();['panelViews']=this['createCollection']();['_tabs']=new Map();constructor(_0x551b81,_0x341523={}){super(_0x551b81),this['set']('class',void 0x0),this['set']('activeTab',null),this['set']('side',_0x341523['side']||'top'),this['set']('isMaximized',!0x1),this['set']('collapsible',_0x341523['collapsible']||!0x1),this['set']('_isMaximizedActive',!0x1),this['bind']('_isMaximizedActive')['to'](this,'isMaximized',this,'activeTab',(_0xcc93c6,_0xb9879e)=>_0xcc93c6&&null!==_0xb9879e);const _0x232611=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset','ck-tabs',...pt(_0x341523['class']||[]),_0x232611['to']('side',_0x39734c=>'ck-tabs_'+_0x39734c),_0x232611['to']('class'),_0x232611['if']('_isMaximizedActive','ck-ai-tabs_maximized'),_0x232611['to']('activeTab',_0x5d6a89=>null===_0x5d6a89?'ck-ai-tabs_collapsed':'')],'tabindex':'0'},'children':[{'tag':'div','attributes':{'class':['ck','ck-tabs__buttons-container',_0x232611['to']('side',_0x374b93=>'ck-tabs__buttons-container_'+_0x374b93)]},'children':this['buttonViews']},{'tag':'div','attributes':{'class':['ck','ck-tabs__panels-container',_0x232611['to']('side',_0x423762=>'ck-tabs__panels-container_'+_0x423762)]},'children':this['panelViews']},...pt(_0x341523['children']||[])]});}['getTabIds'](){return[...this['_tabs']['keys']()];}['getTab'](_0x2ec6d6){const _0x1315f9=this['_tabs']['get'](_0x2ec6d6);return _0x1315f9||null;}['addTab'](_0x1a03fe){const _0x4ae807=this['_setupButton']({'id':_0x1a03fe['id'],'label':_0x1a03fe['buttonLabel'],'icon':_0x1a03fe['buttonIcon'],'order':_0x1a03fe['order']}),_0xd5b5ff=new es(this['locale']);return _0xd5b5ff['render'](),_0x1a03fe['content']&&_0xd5b5ff['children']['add'](_0x1a03fe['content']),this['panelViews']['add'](_0xd5b5ff),this['_tabs']['set'](_0x1a03fe['id'],{'button':_0x4ae807,'panel':_0xd5b5ff,'order':void 0x0!==_0x1a03fe['order']?_0x1a03fe['order']:null}),this['fire']('addTab:'+_0x1a03fe['id'],{'id':_0x1a03fe['id'],'button':_0x4ae807,'panel':_0xd5b5ff}),null===this['activeTab']?this['activateTab'](_0x1a03fe['id']):this['_hidePanel'](_0x1a03fe['id']),{'button':_0x4ae807,'panel':_0xd5b5ff};}['activateTab'](_0x496535){if(null!==_0x496535&&!this['getTab'](_0x496535))throw new at('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x496535});if(this['activeTab']===_0x496535)return;const _0x3dd405=this['activeTab'];this['activeTab']&&this['_hidePanel'](this['activeTab']),this['activeTab']=_0x496535,_0x496535&&this['_showPanel'](_0x496535),this['fire']('activateTab:'+_0x496535,{'newTab':_0x496535,'oldTab':_0x3dd405});}['toggleTabPanel'](_0x59d317){if(!this['getTab'](_0x59d317))throw new at('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x59d317});this['activeTab']===_0x59d317?this['collapsible']&&(this['activeTab']=null):this['activateTab'](_0x59d317);}['showTab'](_0x4967ca){if(!this['getTab'](_0x4967ca))throw new at('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x4967ca});this['_showPanel'](_0x4967ca),this['_showButton'](_0x4967ca),this['fire']('show:'+_0x4967ca,_0x4967ca);}['hideTab'](_0x2d3d53){if(!this['getTab'](_0x2d3d53))throw new at('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x2d3d53});const _0x3893c7=this['activeTab'];this['_hidePanel'](_0x2d3d53),this['_hideButton'](_0x2d3d53);const _0xcdf3b9=this['getTabIds']();_0x3893c7===_0x2d3d53&&_0xcdf3b9['length']>0x1&&this['activateTab'](_0xcdf3b9['find'](_0x1a563=>_0x1a563!==_0x2d3d53)),this['fire']('hide:'+_0x2d3d53,_0x2d3d53);}['_getPanel'](_0x4d76e2){const _0x20da7e=this['_tabs']['get'](_0x4d76e2);return _0x20da7e?_0x20da7e['panel']:null;}['_showPanel'](_0x8d3265){null!==this['activeTab']&&this['activeTab']!==_0x8d3265||this['_getPanel'](_0x8d3265)['show']();}['_hidePanel'](_0x53ea88){const _0xd657ab=this['_getPanel'](_0x53ea88);_0xd657ab['isVisible']&&(this['activeTab']===_0x53ea88&&(this['activeTab']=null),_0xd657ab['hide']());}['_getButton'](_0x10a0e1){const _0x29e812=this['_tabs']['get'](_0x10a0e1);return _0x29e812?_0x29e812['button']:null;}['_showButton'](_0x2cc4aa){this['_getButton'](_0x2cc4aa)['show']();}['_hideButton'](_0x19c4a5){this['_getButton'](_0x19c4a5)['hide']();}['_setupButton'](_0x3a745f){const _0x25ea41=new ts(this['locale'],{'side':this['side']}),_0x39751e=this['buttonViews'];if(_0x25ea41['set']({'label':_0x3a745f['label'],'icon':_0x3a745f['icon'],'tooltip':!0x0,'withText':!0x0}),_0x25ea41['bind']('isOn')['to'](this,'activeTab',_0x3e8731=>_0x3e8731===_0x3a745f['id']),_0x25ea41['bind']('side')['to'](this,'side'),_0x3a745f['order']){const _0x5567c9=[...this['_tabs']]['reduce']((_0xc0f08a,_0xdd2f5c)=>{const _0x55be18=_0xdd2f5c[0x0],{order:_0x453522}=_0xdd2f5c[0x1];return!_0x453522||_0x453522>_0x3a745f['order']?_0xc0f08a:_0x453522>=_0xc0f08a['order']?{'id':_0x55be18,'order':_0x453522}:_0xc0f08a;},{'id':'','order':0x0}),_0x10da53=_0x39751e['getIndex'](this['_getButton'](_0x5567c9['id']));_0x39751e['add'](_0x25ea41,_0x10da53+0x1);}else _0x39751e['add'](_0x25ea41);return _0x25ea41['on']('execute',()=>{this['toggleTabPanel'](_0x3a745f['id']);}),_0x25ea41;}}const ss=['overlay','sidebar','custom'],ns=['left','right'];class rs extends is{constructor(_0x4a244e,_0x4d325a={}){super(_0x4a244e,_0x4d325a),this['set']('type',_0x4d325a['type']||'sidebar'),this['set']('side',_0x4d325a['side']||'right'),this['set']('isVisible',_0x4d325a['visibleByDefault']??!0x0);const _0x5b0b7b=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-tabs',_0x5b0b7b['if']('type','ck-ai-tabs__overlay',_0x16562d=>'overlay'===_0x16562d),_0x5b0b7b['if']('type','ck-ai-tabs__sidebar',_0x4b7296=>'sidebar'===_0x4b7296),_0x5b0b7b['if']('isVisible','ck-hidden',_0x25c148=>!_0x25c148)]}}),this['buttonViews']['on']('add',(_0x34e36f,_0x61936b)=>{_0x61936b['set']('withText',!0x1);});}}class os extends _0x173dbd{['view'];['container']=null;['showResizeButton']=!0x0;static get['pluginName'](){return'AITabs';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x2f4d60){if(super(_0x2f4d60),!this['context']['config']['get']('ai.container'))throw new at('ai-tabs-configuration-not-found');this['context']['config']['define']('ai.container.visibleByDefault',!0x0),this['context']['config']['define']('ai.container.collapsible',!0x1);const _0x5423ba=this['context']['config']['get']('ai.container');if(this['set']('side','right'),void 0x0!==_0x5423ba['showResizeButton']&&(this['showResizeButton']=_0x5423ba['showResizeButton']),'sidebar'!==_0x5423ba['type']&&'overlay'!==_0x5423ba['type']||_0x5423ba['side']&&(this['side']=_0x5423ba['side']),'sidebar'===_0x5423ba['type']){if(this['container']=_0x5423ba['element'],this['set']('type','sidebar'),!this['container'])throw new at('ai-tabs-sidebar-container-element-not-found');}else'overlay'===_0x5423ba['type']?(this['container']=document['body'],this['set']('type','overlay')):(this['container']=null,this['set']('type','custom'));this['view']=new rs(this['context']['locale'],{'side':this['side'],'type':this['type'],'visibleByDefault':_0x5423ba['visibleByDefault'],'collapsible':_0x5423ba['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 _0x2ef8df&&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'](_0x43a456){if(_0x43a456&&this['type']!==_0x43a456){if(!ss['includes'](_0x43a456))throw new at('ai-tabs-unsupported-ui-type');this['type']=_0x43a456;}}['switchSide'](_0x38098d){if(_0x38098d&&this['side']!==_0x38098d){if(!ns['includes'](_0x38098d))throw new at('ai-tabs-unsupported-ui-side');this['side']=_0x38098d;}}['destroy'](){super['destroy'](),this['view']['destroy'](),this['view']['element']&&this['view']['element']['remove']();}}class as extends _0x173dbd{['_apiUrl'];['_token'];['_decoder'];['_responseCache'];static get['requires'](){return[_0x47c197];}static get['pluginName'](){return'AIConnector';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x1c29b8){super(_0x1c29b8),this['context']['config']['define']('ai.serviceUrl','https://ai.cke-cs.com/v1'),this['_apiUrl']=this['context']['config']['get']('ai.serviceUrl'),this['_token']=null,this['_decoder']=new TextDecoder(),this['_responseCache']=new Map();}['init'](){const _0x4821f4=this['context']['plugins']['get'](_0x47c197);if(!_0x4821f4['token'])throw new at('ai-missing-token',this);this['_token']=_0x4821f4['token'];}['startConversation'](_0x5c3a53,_0x259cd0){const _0x4a363f=this['_sendApiRequest']('/conversations','POST',{'id':_0x5c3a53,'group':_0x259cd0});return{'getConversation':async()=>(await _0x4a363f['request'])['json'](),'abortController':_0x4a363f['abortController']};}['queryAssistant']({message:_0x286163,conversationId:_0x395ad4,parts:_0x5047ca,capabilities:_0x51effb,model:_0x517eb4,attributes:_0x23c647}){const _0x13f87e={'prompt':_0x286163,'content':_0x5047ca,'model':_0x517eb4,..._0x51effb&&{'capabilities':_0x51effb},..._0x23c647&&{'attributes':_0x23c647}},_0x33f8a3=this['_sendApiRequest']('/conversations/'+_0x395ad4+'/messages','POST',_0x13f87e);return{'getStream':async()=>{const _0x2c4839=(await _0x33f8a3['request'])['body'];return this['_getStreamReader'](_0x2c4839);},'abortController':_0x33f8a3['abortController']};}['executeCustomAction']({content:_0xbb454,message:_0x2b2a3e,model:_0x3fa39b,outputFormat:_0x21629c}){const _0xdf749a={'content':[{'type':'text','content':_0xbb454}],'prompt':_0x2b2a3e,'model':_0x3fa39b,'outputFormat':_0x21629c},_0x10baa=this['_sendApiRequest']('/actions/custom/calls','POST',_0xdf749a);return{'getStream':async()=>{const _0x506870=(await _0x10baa['request'])['body'];return this['_getStreamReader'](_0x506870);},'abortController':_0x10baa['abortController']};}['executeAction']({actionName:_0x379e01,content:_0x460751,args:_0x343a1e}){const _0x17bf75={'content':[{'type':'text','content':_0x460751}],'args':_0x343a1e},_0x12a436=this['_sendApiRequest']('/actions/system/'+_0x379e01+'/calls','POST',_0x17bf75);return{'getStream':async()=>{const _0xcc110=(await _0x12a436['request'])['body'];return this['_getStreamReader'](_0xcc110);},'abortController':_0x12a436['abortController']};}['uploadFile'](_0x59ea98,_0x148c0f,_0x2c24f8){const _0x3d7b58=new FormData();_0x3d7b58['append']('file',_0x148c0f,_0x148c0f['name']),_0x2c24f8&&_0x3d7b58['append']('attributes',JSON['stringify'](_0x2c24f8));const _0x29a4b2=this['_sendApiRequest']('/conversations/'+_0x59ea98+'/files','POST',_0x3d7b58);return{'getId':async()=>(await _0x29a4b2['request'])['json'](),'abortController':_0x29a4b2['abortController']};}['fetchDocument'](_0x4c2111,_0x3e652f){const _0x3d48d2=this['_sendApiRequest']('/conversations/'+_0x4c2111+'/documents/'+_0x3e652f,'GET');return{'getDocument':async()=>(await _0x3d48d2['request'])['json'](),'abortController':_0x3d48d2['abortController']};}['uploadDocument'](_0x330714,_0x3aefe1,_0x1144b1){const _0x54e9e6={'content':_0x3aefe1};_0x1144b1&&(_0x54e9e6['attributes']=_0x1144b1);const _0x28d6b7=this['_sendApiRequest']('/conversations/'+_0x330714+'/documents','POST',_0x54e9e6);return{'getId':async()=>(await _0x28d6b7['request'])['json'](),'abortController':_0x28d6b7['abortController']};}['uploadDocuments'](_0x521e74,_0x22ad9){const _0x35ec37={'documents':_0x22ad9['map'](_0x1b646c=>({'content':_0x1b646c['content'],'attributes':{'version':_0x1b646c['version'],'sessionId':_0x1b646c['sessionId'],'channelId':_0x1b646c['channelId'],'rootName':_0x1b646c['rootName'],'selections':_0x1b646c['selections']},...void 0x0!==_0x1b646c['name']?{'name':_0x1b646c['name']}:{},...void 0x0!==_0x1b646c['description']?{'description':_0x1b646c['description']}:{}}))},_0x5a2109=this['_sendApiRequest']('/conversations/'+_0x521e74+'/documents/batch','POST',_0x35ec37);return{'getIds':async()=>(await _0x5a2109['request'])['json'](),'abortController':_0x5a2109['abortController']};}['fetchDocuments'](_0x5f4de0,_0x1d1d10){const _0x40391f=new URLSearchParams();_0x40391f['append']('documentIds',_0x1d1d10['join'](','));const _0x497cee=this['_sendApiRequest']('/conversations/'+_0x5f4de0+'/documents/batch?'+_0x40391f['toString'](),'GET');return{'getDocuments':async()=>(await _0x497cee['request'])['json'](),'abortController':_0x497cee['abortController']};}['fetchConversations'](_0x5690c7,_0x403481={}){const _0x44db08=new URLSearchParams();_0x44db08['append']('group',_0x5690c7),_0x44db08['append']('excludeEmpty',!0x1!==_0x403481['excludeEmpty']?'true':'false'),_0x44db08['append']('limit',_0x403481['limit']?_0x403481['limit']['toString']():'100'),_0x44db08['append']('sortBy',_0x403481['sortBy']?_0x403481['sortBy']:'createdAt'),_0x44db08['append']('order',_0x403481['order']?_0x403481['order']:'desc');const _0x3b5209=this['_sendApiRequest']('/conversations?'+_0x44db08['toString'](),'GET');return{'getConversations':async()=>{const _0x46c0f0=await _0x3b5209['request'];return(await _0x46c0f0['json']())['items'];},'abortController':_0x3b5209['abortController']};}['deleteConversation'](_0x125070){const _0xcae92e=this['_sendApiRequest']('/conversations/'+_0x125070,'DELETE');return{'execute':async()=>{await _0xcae92e['request'];},'abortController':_0xcae92e['abortController']};}['updateConversation'](_0xac7a23,_0x574186){const _0x56cb1c=this['_sendApiRequest']('/conversations/'+_0xac7a23,'PATCH',_0x574186);return{'getResult':async()=>(await _0x56cb1c['request'],_0x574186),'abortController':_0x56cb1c['abortController']};}['fetchConversation'](_0x13703a){const _0x467b63=this['_sendApiRequest']('/conversations/'+_0x13703a,'GET');return{'getConversation':async()=>(await _0x467b63['request'])['json'](),'abortController':_0x467b63['abortController']};}['fetchConversationMessages'](_0x8ee7a9){const _0x29f3a5=this['_sendApiRequest']('/conversations/'+_0x8ee7a9+'/messages','GET');return{'getMessages':async()=>{const _0x29140a=await _0x29f3a5['request'];return(await _0x29140a['json']())['items'];},'abortController':_0x29f3a5['abortController']};}['uploadUrl'](_0xf2065a,_0x428b3e,_0x271686){const _0x62758e=this['_sendApiRequest']('/conversations/'+_0xf2065a+'/web-resources','POST',{'url':_0x428b3e,'attributes':_0x271686});return{'getId':async()=>(await _0x62758e['request'])['json'](),'abortController':_0x62758e['abortController']};}['getModels'](_0x5dafa0='en'){const _0x2bb3f9=new URLSearchParams();_0x2bb3f9['append']('language',_0x5dafa0);const _0x12f72e='/models/1?'+_0x2bb3f9['toString'](),_0x542c50=this['_sendApiRequest'](_0x12f72e,'GET',void 0x0,!0x0);return{'list':async()=>await(await _0x542c50['request'])['json'](),'abortController':_0x542c50['abortController']};}['deleteFile'](_0x4ed8df,_0x1d2a3f){const _0x54809d=this['_sendApiRequest']('/conversations/'+_0x4ed8df+'/files/'+_0x1d2a3f,'DELETE');return{'execute':async()=>{await _0x54809d['request'];},'abortController':_0x54809d['abortController']};}['deleteDocument'](_0x4aa09,_0x3da526){const _0x4fe3f2=this['_sendApiRequest']('/conversations/'+_0x4aa09+'/documents/'+_0x3da526,'DELETE');return{'execute':async()=>{await _0x4fe3f2['request'];},'abortController':_0x4fe3f2['abortController']};}['deleteWebResource'](_0x342ab3,_0x90db38){const _0x233d56=this['_sendApiRequest']('/conversations/'+_0x342ab3+'/web-resources/'+_0x90db38,'DELETE');return{'execute':async()=>{await _0x233d56['request'];},'abortController':_0x233d56['abortController']};}['callSystemReview']({reviewName:_0x4cf8a1,content:_0x3364fb,args:_0x4df5e6}){const _0x26e9c7=this['_sendApiRequest']('/reviews/system/'+_0x4cf8a1+'/calls','POST',{'content':[{'type':'text','content':_0x3364fb}],'args':_0x4df5e6});return{'getStream':async()=>{const _0x1fdf19=(await _0x26e9c7['request'])['body'];return this['_getStreamReader'](_0x1fdf19);},'abortController':_0x26e9c7['abortController']};}['callCustomReview']({content:_0x4794e0,prompt:_0x118562,model:_0x3b753d}){const _0x286ada=this['_sendApiRequest']('/reviews/custom/calls','POST',{'content':[{'type':'text','content':_0x4794e0}],'prompt':_0x118562,'model':_0x3b753d});return{'getStream':async()=>{const _0x3c9de8=(await _0x286ada['request'])['body'];return this['_getStreamReader'](_0x3c9de8);},'abortController':_0x286ada['abortController']};}['upsertAIChatRating'](_0x3f2023,_0x173e93,_0x4b761b){const _0x3a52a6=this['_sendApiRequest']('/conversations/'+_0x3f2023+'/messages/'+_0x173e93+'/ratings','PUT',{'positiveCount':_0x4b761b['positiveCount'],'totalCount':_0x4b761b['totalCount'],'modificationId':_0x4b761b['modificationId']});return{'execute':async()=>{await _0x3a52a6['request'];},'abortController':_0x3a52a6['abortController']};}['upsertAIActionRating'](_0x463d62,_0x5f1a3b,_0x5f28a6){const _0x2821d4=this['_sendApiRequest']('/actions/system/'+_0x463d62+'/calls/'+_0x5f1a3b+'/ratings','PUT',{'positiveCount':_0x5f28a6['positiveCount'],'totalCount':_0x5f28a6['totalCount']});return{'execute':async()=>{await _0x2821d4['request'];},'abortController':_0x2821d4['abortController']};}['upsertCustomAIActionRating'](_0x34e1c1,_0x3817e0){const _0x519150=this['_sendApiRequest']('/actions/custom/calls/'+_0x34e1c1+'/ratings','PUT',{'positiveCount':_0x3817e0['positiveCount'],'totalCount':_0x3817e0['totalCount']});return{'execute':async()=>{await _0x519150['request'];},'abortController':_0x519150['abortController']};}['upsertAIReviewRating'](_0x17eb2b,_0x1514d1,_0x17aea1,_0x2a5bfe){const _0xaa0c1b=this['_sendApiRequest']('/reviews/system/'+_0x17eb2b+'/calls/'+_0x1514d1+'/ratings','PUT',{'positiveCount':_0x17aea1['positiveCount'],'totalCount':_0x17aea1['totalCount'],'dataId':_0x2a5bfe});return{'execute':async()=>{await _0xaa0c1b['request'];},'abortController':_0xaa0c1b['abortController']};}['upsertCustomAIReviewRating'](_0x2cc828,_0x2ffa7c,_0x489c5a){const _0x2384d1=this['_sendApiRequest']('/reviews/custom/calls/'+_0x2cc828+'/ratings','PUT',{'positiveCount':_0x2ffa7c['positiveCount'],'totalCount':_0x2ffa7c['totalCount'],'dataId':_0x489c5a});return{'execute':async()=>{await _0x2384d1['request'];},'abortController':_0x2384d1['abortController']};}['_sendApiRequest'](_0x18ff07,_0x233fcb,_0x27024d,_0x485c6a=!0x1){const _0x582f0a=new AbortController(),_0x312eaa=_0x485c6a?_0x233fcb+':'+_0x18ff07:null;if(_0x312eaa){const _0x4680a5=this['_responseCache']['get'](_0x312eaa);if(_0x4680a5)return{'request':_0x4680a5['then'](_0x52478e=>_0x52478e['clone']()),'abortController':_0x582f0a};}const _0x2e3283=_0x27024d instanceof FormData,_0x3ab579={'Authorization':'Bearer\x20'+this['_token']?.['value'],'X-Editor-Version':mt};_0x27024d&&!_0x2e3283&&(_0x3ab579['Content-Type']='application/json');const _0xc7294b={'method':_0x233fcb,'headers':_0x3ab579,'signal':_0x582f0a['signal']};_0x27024d&&(_0xc7294b['body']=_0x2e3283?_0x27024d:JSON['stringify'](_0x27024d));const _0xd8d647=fetch(''+this['_apiUrl']+_0x18ff07,_0xc7294b)['catch'](_0xd5c6b9=>{_0x312eaa&&this['_responseCache']['delete'](_0x312eaa),this['_handleError'](_0xd5c6b9);})['then'](_0x2bdd63=>_0x2bdd63['ok']?_0x2bdd63:_0x2bdd63['json']()['then'](_0x58e40f=>{throw _0x312eaa&&this['_responseCache']['delete'](_0x312eaa),{'url':this['_apiUrl'],'path':_0x18ff07,'method':_0x233fcb,'body':_0x27024d,'status':(_0x2bdd63||{})['status'],'statusText':(_0x2bdd63||{})['statusText'],'code':_0x58e40f['code'],'message':_0x58e40f['message'],'traceId':_0x58e40f['traceId']};}));return _0x312eaa&&this['_responseCache']['set'](_0x312eaa,_0xd8d647['then'](_0x42b6b5=>_0x42b6b5['clone']())),{'request':_0xd8d647,'abortController':_0x582f0a};}async*['_getStreamReader'](_0x587ea1){const _0x8f9677=[],_0x16bd34=_0x587ea1['getReader'](),_0x12c54d=_0x3e40e3({'onError':_0x17ca13=>{this['_handleError'](_0x17ca13);},'onEvent':_0x5bca09=>{_0x5bca09['data']=JSON['parse'](_0x5bca09['data']),_0x8f9677['push'](_0x5bca09);}});try{let _0x511768=!0x1;for(;!_0x511768;){const {done:_0x1e382b,value:_0x1abb0c}=await _0x16bd34['read']();_0x1e382b&&(_0x511768=!0x0),_0x12c54d['feed'](this['_decoder']['decode'](_0x1abb0c,{'stream':!0x0})),yield*_0x8f9677,_0x8f9677['length']=0x0;}}catch(_0xf7da40){this['_handleError'](_0xf7da40);}finally{_0x16bd34['releaseLock'](),_0x12c54d['reset']();}}['_handleError'](_0x52d278){if(_0x52d278 instanceof at)throw _0x52d278;if(_0x52d278 instanceof Error&&'AbortError'===_0x52d278['name'])throw new at('ai-request-aborted',this,{'originalError':_0x52d278});throw new at('ai-request-failed',this,{'originalError':_0x52d278});}}function hs(_0x17570e,_0x48f227,_0xa02442){const t=_0x17570e['t'];switch(_0x48f227){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'},_0xa02442);case'AI_SUGGESTION_CONTENT_PART_REJECTED':return t({'id':'AI_SUGGESTION_CONTENT_PART_REJECTED','string':'Change\x20was\x20rejected'});case'AI_SUGGESTION_CONTENT_PART_OUTDATED':return t({'id':'AI_SUGGESTION_CONTENT_PART_OUTDATED','string':'Change\x20is\x20outdated'});case'AI_SUGGESTION_CONTENT_PART_ALREADY_APPLIED':return t({'id':'AI_SUGGESTION_CONTENT_PART_ALREADY_APPLIED','string':'Change\x20is\x20already\x20applied'});case'AI_SUGGESTION_CONTENT_PART_APPLY':return t({'id':'AI_SUGGESTION_CONTENT_PART_APPLY','string':'Apply\x20change'});case'AI_SUGGESTION_CONTENT_PART_ADD_SUGGESTION':return t({'id':'AI_SUGGESTION_CONTENT_PART_ADD_SUGGESTION','string':'Add\x20as\x20suggestion'});case'AI_SUGGESTION_CONTENT_PART_REJECT':return t({'id':'AI_SUGGESTION_CONTENT_PART_REJECT','string':'Reject\x20change'});case'AI_SUGGESTION_CONTENT_PART_REMOVED':return t({'id':'AI_SUGGESTION_CONTENT_PART_REMOVED','string':'Removed\x20content.\x20Use\x20\x22Show\x20details\x22\x20to\x20learn\x20more.'});case'AI_SUGGESTION_CONTENT_PART_STATE_ACCEPTED':return t({'id':'AI_SUGGESTION_CONTENT_PART_STATE_ACCEPTED','string':'Approved'});case'AI_SUGGESTION_CONTENT_PART_STATE_REJECTED':return t({'id':'AI_SUGGESTION_CONTENT_PART_STATE_REJECTED','string':'Rejected'});case'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED':return t({'id':'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED','string':'Outdated'});case'AI_DISCLAIMER_TEXT':return t({'id':'AI_DISCLAIMER_TEXT','string':'AI\x20can\x20make\x20mistakes.\x20Please\x20double-check\x20responses.'});case'AI_TABS_LABEL_MAXIMIZE':return t({'id':'AI_TABS_LABEL_MAXIMIZE','string':'Maximize'});case'AI_TABS_LABEL_MINIMIZE':return t({'id':'AI_TABS_LABEL_MINIMIZE','string':'Minimize'});case'AI_CHAT_HEADING':return t({'id':'AI_CHAT_HEADING','string':'Chat'});case'AI_CHAT_SOURCES_HEADER':return t({'id':'AI_CHAT_SOURCES_HEADER','string':'Sources'});case'AI_CHAT_UNTITLED_CONVERSATION':return t({'id':'AI_CHAT_UNTITLED_CONVERSATION','string':'Untitled\x20conversation'});case'AI_CHAT_LABEL_NEW_CHAT':return t({'id':'AI_CHAT_LABEL_NEW_CHAT','string':'New\x20chat'});case'AI_CHAT_STOP_GENERATING':return t({'id':'AI_CHAT_STOP_GENERATING','string':'Stop\x20generating'});case'AI_CHAT_IS_WRITING':return t({'id':'AI_CHAT_IS_WRITING','string':'AI\x20is\x20writing...'});case'AI_CHAT_PROMPT_EMPTY_ERROR':return t({'id':'AI_CHAT_PROMPT_EMPTY_ERROR','string':'This\x20field\x20cannot\x20be\x20empty.'});case'AI_CHAT_LABEL_SUBMIT':return t({'id':'AI_CHAT_LABEL_SUBMIT','string':'Submit'});case'AI_CHAT_WELCOME_MESSAGE':return t({'id':'AI_CHAT_WELCOME_MESSAGE','string':'Hi!\x20I\x20can\x20help\x20you\x20draft,\x20rewrite,\x20and\x20improve\x20your\x20text,\x20explore\x20ideas,\x20research\x20topics,\x20and\x20solve\x20problems.\x20How\x20can\x20I\x20help\x20right\x20now?'});case'AI_CHAT_ABORTED_MESSAGE':return t({'id':'AI_CHAT_ABORTED_MESSAGE','string':'Response\x20stopped.'});case'AI_CHAT_GENERIC_ERROR':return t({'id':'AI_CHAT_GENERIC_ERROR','string':'Something\x20went\x20wrong\x20while\x20processing\x20your\x20request.\x20Please\x20try\x20again.'});case'AI_CHAT_UNABLE_TO_START_CONVERSATION':return t({'id':'AI_CHAT_UNABLE_TO_START_CONVERSATION','string':'Unable\x20to\x20start\x20conversation.\x20Please\x20make\x20sure\x20you\x20are\x20online\x20and\x20try\x20again.'});case'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION':return t({'id':'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION','string':'Unable\x20to\x20load\x20chosen\x20conversation.\x20Please\x20make\x20sure\x20you\x20are\x20online\x20and\x20try\x20again.'});case'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_FILE':return t({'id':'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_FILE','string':'Failed\x20to\x20upload\x20files:\x20%0.\x20Please\x20try\x20again.'},_0xa02442);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.'},_0xa02442);case'AI_CHAT_RESOURCE_LOAD_FAILED':return t({'id':'AI_CHAT_RESOURCE_LOAD_FAILED','string':'Failed\x20to\x20load\x20resource.\x20Please\x20try\x20again.'});case'AI_CHAT_CONTEXT_CURRENT_DOCUMENT':return t({'id':'AI_CHAT_CONTEXT_CURRENT_DOCUMENT','string':'Current\x20document'});case'AI_CHAT_CONTEXT_REMOVE_FROM_CONTEXT':return t({'id':'AI_CHAT_CONTEXT_REMOVE_FROM_CONTEXT','string':'Remove\x20from\x20context'});case'AI_CHAT_CONTEXT_ADD_CONTEXT':return t({'id':'AI_CHAT_CONTEXT_ADD_CONTEXT','string':'Add\x20context'});case'AI_CHAT_CONTEXT_URL_LABEL':return t({'id':'AI_CHAT_CONTEXT_URL_LABEL','string':'URL'});case'AI_CHAT_CONTEXT_FILE_LABEL':return t({'id':'AI_CHAT_CONTEXT_FILE_LABEL','string':'File'});case'AI_CHAT_CONTEXT_CURRENT_CONTEXT_LABEL':return t({'id':'AI_CHAT_CONTEXT_CURRENT_CONTEXT_LABEL','string':'Current\x20context'});case'AI_CHAT_CONTEXT_DOCUMENT_SELECTION_LABEL':return t({'id':'AI_CHAT_CONTEXT_DOCUMENT_SELECTION_LABEL','string':'Selected\x20content'});case'AI_CHAT_SEARCH_WEB':return t({'id':'AI_CHAT_SEARCH_WEB','string':'Web\x20search'});case'AI_CHAT_ENABLE_WEB_SEARCH':return t({'id':'AI_CHAT_ENABLE_WEB_SEARCH','string':'Enable\x20web\x20search'});case'AI_CHAT_DISABLE_WEB_SEARCH':return t({'id':'AI_CHAT_DISABLE_WEB_SEARCH','string':'Disable\x20web\x20search'});case'AI_CHAT_REASONING':return t({'id':'AI_CHAT_REASONING','string':'Reasoning'});case'AI_CHAT_ENABLE_REASONING':return t({'id':'AI_CHAT_ENABLE_REASONING','string':'Enable\x20reasoning'});case'AI_CHAT_DISABLE_REASONING':return t({'id':'AI_CHAT_DISABLE_REASONING','string':'Disable\x20reasoning'});case'AI_CHAT_COMMANDS':return t({'id':'AI_CHAT_COMMANDS','string':'Commands'});case'AI_CHAT_SEARCH_RESOURCES':return t({'id':'AI_CHAT_SEARCH_RESOURCES','string':'Search\x20resources'});case'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT':return t({'id':'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT','string':'Back\x20to\x20context\x20options'});case'AI_CHAT_CONTEXT_URL_ADD_URL':return t({'id':'AI_CHAT_CONTEXT_URL_ADD_URL','string':'Add\x20URL'});case'AI_CHAT_CONTEXT_URL_PLACEHOLDER':return t({'id':'AI_CHAT_CONTEXT_URL_PLACEHOLDER','string':'Add\x20URL...'});case'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_URL':return t({'id':'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_URL','string':'Failed\x20to\x20upload\x20URL:\x20%0.\x20Please\x20try\x20again.'},_0xa02442);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'},_0xa02442);case'AI_CHAT_SUGGESTION_ACTION_SUGGEST':return t({'id':'AI_CHAT_SUGGESTION_ACTION_SUGGEST','string':'Suggest'},_0xa02442);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'},_0xa02442);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.'},_0xa02442);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.'},_0xa02442);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.'},_0xa02442);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.'},_0xa02442);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'},_0xa02442);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.'},_0xa02442);case'AI_QUICK_ACTIONS_OTHER':return t({'id':'AI_QUICK_ACTIONS_OTHER','string':'Other'});case'AI_ACTIONS_GENERIC_ERROR':return t({'id':'AI_ACTIONS_GENERIC_ERROR','string':'Sorry,\x20we\x20couldn\x27t\x20generate\x20the\x20response.\x20Please\x20try\x20again\x20in\x20a\x20moment.'});case'AI_BALLOON_SELECTION_REMOVED_ERROR':return t({'id':'AI_BALLOON_SELECTION_REMOVED_ERROR','string':'Changes\x20cannot\x20be\x20applied.\x20The\x20original\x20content\x20no\x20longer\x20exists.'});case'AI_REVIEW_MODE_STOP_GENERATING':return t({'id':'AI_REVIEW_MODE_STOP_GENERATING','string':'Stop\x20generating'});case'AI_REVIEW_MODE_HIDE_CHANGES':return t({'id':'AI_REVIEW_MODE_HIDE_CHANGES','string':'Hide\x20changes'});case'AI_REVIEW_MODE_SHOW_CHANGES':return t({'id':'AI_REVIEW_MODE_SHOW_CHANGES','string':'Show\x20changes'});case'AI_REVIEW_MODE_ACCEPT_ALL':return t({'id':'AI_REVIEW_MODE_ACCEPT_ALL','string':'Accept\x20all'});case'AI_REVIEW_MODE_EXIT_REVIEW':return t({'id':'AI_REVIEW_MODE_EXIT_REVIEW','string':'Exit\x20review'});case'AI_REVIEW_MODE_ACCEPT_CHANGE':return t({'id':'AI_REVIEW_MODE_ACCEPT_CHANGE','string':'Accept'});case'AI_REVIEW_MODE_DISMISS_CHANGE':return t({'id':'AI_REVIEW_MODE_DISMISS_CHANGE','string':'Dismiss'});case'AI_REVIEW_MODE_LEARN_MORE':return t({'id':'AI_REVIEW_MODE_LEARN_MORE','string':'Learn\x20more'});case'AI_REVIEW_MODE_COMPLETED_TEXT':return t({'id':'AI_REVIEW_MODE_COMPLETED_TEXT','string':'There\x27s\x20nothing\x20left\x20to\x20review.'});case'AI_REVIEW_MODE_EMPTY_RESULTS_TEXT':return t({'id':'AI_REVIEW_MODE_EMPTY_RESULTS_TEXT','string':'There\x20are\x20no\x20changes\x20to\x20suggest.'});case'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL':return t({'id':'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL','string':'Finish\x20Review'});case'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE':return t({'id':'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE','string':'Review\x20complete.\x20Finish\x20when\x20ready.'});case'AI_REVIEW_INITIALIZATION_ERROR_MESSAGE':return t({'id':'AI_REVIEW_INITIALIZATION_ERROR_MESSAGE','string':'AI\x20Review\x20initialized\x20with\x20errors.\x20Some\x20features\x20may\x20not\x20be\x20available\x20or\x20work\x20properly.'});case'AI_REVIEW_MODE_GENERAL_ERROR_MESSAGE':return t({'id':'AI_REVIEW_MODE_GENERAL_ERROR_MESSAGE','string':'Sorry,\x20we\x20couldn\x27t\x20generate\x20the\x20whole\x20review\x20properly.\x20Please\x20try\x20again\x20in\x20a\x20moment.'});case'AI_REVIEW_MODE_CHUNK_ERROR_MESSAGE':return t({'id':'AI_REVIEW_MODE_CHUNK_ERROR_MESSAGE','string':'Not\x20everything\x20went\x20through,\x20but\x20the\x20completed\x20items\x20are\x20listed\x20below.'});case'AI_REVIEW_MODE':return t({'id':'AI_REVIEW_MODE','string':'Review'});case'AI_REVIEW_MODE_PROMPT_EMPTY_ERROR':return t({'id':'AI_REVIEW_MODE_PROMPT_EMPTY_ERROR','string':'Prompt\x20must\x20not\x20be\x20empty'});case'AI_REVIEW_CHECK_CUSTOM_TITLE':return t({'id':'AI_REVIEW_CHECK_CUSTOM_TITLE','string':'Custom\x20command'});case'AI_REVIEW_CHECK_CUSTOM_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_CUSTOM_DESCRIPTION','string':'Enter\x20a\x20custom\x20command\x20for\x20a\x20specific\x20review.'});case'AI_REVIEW_CHECK_CORRECTNESS_TITLE':return t({'id':'AI_REVIEW_CHECK_CORRECTNESS_TITLE','string':'Proofread'});case'AI_REVIEW_CHECK_CORRECTNESS_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_CORRECTNESS_DESCRIPTION','string':'Check\x20the\x20text\x20for\x20errors\x20in\x20grammar,\x20spelling,\x20and\x20punctuation.'});case'AI_REVIEW_CHECK_CLARITY_TITLE':return t({'id':'AI_REVIEW_CHECK_CLARITY_TITLE','string':'Improve\x20clarity'});case'AI_REVIEW_CHECK_CLARITY_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_CLARITY_DESCRIPTION','string':'Improve\x20the\x20logical\x20structure\x20and\x20precision\x20for\x20clearer\x20message.'});case'AI_REVIEW_CHECK_READABILITY_TITLE':return t({'id':'AI_REVIEW_CHECK_READABILITY_TITLE','string':'Improve\x20readability'});case'AI_REVIEW_CHECK_READABILITY_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_READABILITY_DESCRIPTION','string':'Adjust\x20sentence\x20structure\x20and\x20word\x20choice\x20for\x20an\x20easier\x20read.'});case'AI_REVIEW_CHECK_MAKE_TITLE':return t({'id':'AI_REVIEW_CHECK_MAKE_TITLE','string':'Adjust\x20length'});case'AI_REVIEW_CHECK_MAKE_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_MAKE_DESCRIPTION','string':'Shorten\x20or\x20lengthen\x20the\x20text\x20as\x20needed.'});case'AI_REVIEW_CHECK_MAKE_OPTIONS_LABEL':return t({'id':'AI_REVIEW_CHECK_MAKE_OPTIONS_LABEL','string':'Adjust\x20length'});case'AI_REVIEW_CHECK_MAKE_OPTIONS_DATA_LONGER':return t({'id':'AI_REVIEW_CHECK_MAKE_OPTIONS_DATA_LONGER','string':'Longer'});case'AI_REVIEW_CHECK_MAKE_OPTIONS_DATA_SHORTER':return t({'id':'AI_REVIEW_CHECK_MAKE_OPTIONS_DATA_SHORTER','string':'Shorter'});case'AI_REVIEW_CHECK_MAKE_TONE_TITLE':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_TITLE','string':'Adjust\x20tone\x20and\x20style'});case'AI_REVIEW_CHECK_MAKE_TONE_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_DESCRIPTION','string':'Modify\x20the\x20text\x20to\x20a\x20desired\x20tone\x20and\x20style.'});case'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_LABEL':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_LABEL','string':'Adjust\x20tone\x20and\x20style'});case'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_CASUAL':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_CASUAL','string':'Casual'});case'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_DIRECT':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_DIRECT','string':'Direct'});case'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_FRIENDLY':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_FRIENDLY','string':'Friendly'});case'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_CONFIDENT':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_CONFIDENT','string':'Confident'});case'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_PROFESSIONAL':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_PROFESSIONAL','string':'Professional'});case'AI_REVIEW_CHECK_TRANSLATE_TITLE':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_TITLE','string':'Translate'});case'AI_REVIEW_CHECK_TRANSLATE_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_DESCRIPTION','string':'Translate\x20the\x20text\x20into\x20another\x20language.'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_LABEL':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_LABEL','string':'Select\x20language'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_ENGLISH':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_ENGLISH','string':'English'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_SPANISH':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_SPANISH','string':'Spanish'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_FRENCH':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_FRENCH','string':'French'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_GERMAN':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_GERMAN','string':'German'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_CHINESE':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_CHINESE','string':'Chinese\x20(Simplified)'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_JAPANESE':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_JAPANESE','string':'Japanese'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_RUSSIAN':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_RUSSIAN','string':'Russian'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_PORTUGUESE':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_PORTUGUESE','string':'Portuguese'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_KOREAN':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_KOREAN','string':'Korean'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_ITALIAN':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_ITALIAN','string':'Italian'});case'AI_REVIEW_MODE_CHECK_STATUS_ACCEPTED':return t({'id':'AI_REVIEW_MODE_CHECK_STATUS_ACCEPTED','string':'Accepted'});case'AI_REVIEW_MODE_CHECK_STATUS_REJECTED':return t({'id':'AI_REVIEW_MODE_CHECK_STATUS_REJECTED','string':'Dismissed'});case'AI_REVIEW_MODE_CHECK_STATUS_OUTDATED':return t({'id':'AI_REVIEW_MODE_CHECK_STATUS_OUTDATED','string':'Outdated'});case'AI_TOGGLE_BUTTON_LABEL':return t({'id':'AI_TOGGLE_BUTTON_LABEL','string':'AI'});case'AI_TRANSLATE_ACCEPT_ALL':return t({'id':'AI_TRANSLATE_ACCEPT_ALL','string':'Accept\x20translation'});case'AI_TRANSLATE_FINISH_HEADER_TITLE':return t({'id':'AI_TRANSLATE_FINISH_HEADER_TITLE','string':'Translation\x20complete.\x20Finish\x20when\x20ready.'});case'AI_TRANSLATE_EMPTY_RESULTS_TEXT':return t({'id':'AI_TRANSLATE_EMPTY_RESULTS_TEXT','string':'There\x20are\x20no\x20translations\x20to\x20review.'});case'AI_TRANSLATE_FINISH_BUTTON_LABEL':return t({'id':'AI_TRANSLATE_FINISH_BUTTON_LABEL','string':'Finish\x20Translation'});case'AI_TRANSLATE_CHECK_LIST_HEADER_TITLE':return t({'id':'AI_TRANSLATE_CHECK_LIST_HEADER_TITLE','string':'Content\x20Translation'});case'AI_TRANSLATE_CHECK_LIST_HEADER_DESCRIPTION':return t({'id':'AI_TRANSLATE_CHECK_LIST_HEADER_DESCRIPTION','string':'A\x20dedicated\x20mode\x20for\x20translating\x20the\x20entire\x20text.'});case'AI_TRANSLATE_CHECK_RESULTS_LOADING_TITLE':return t({'id':'AI_TRANSLATE_CHECK_RESULTS_LOADING_TITLE','string':'Translating\x20to'});case'AI_TRANSLATE_CHECK_RESULTS_READY_TITLE':return t({'id':'AI_TRANSLATE_CHECK_RESULTS_READY_TITLE','string':'Translated\x20to'});case'AI_TRANSLATE_GENERAL_ERROR_MESSAGE':return t({'id':'AI_TRANSLATE_GENERAL_ERROR_MESSAGE','string':'Sorry,\x20we\x20couldn\x27t\x20generate\x20translations\x20properly.\x20Please\x20try\x20again\x20in\x20a\x20moment.'});case'AI_SUGGESTION_DISABLED_TOOLTIP_MESSAGE':return t({'id':'AI_SUGGESTION_DISABLED_TOOLTIP_MESSAGE','string':'This\x20conversation\x20is\x20loaded\x20from\x20chat\x20history\x20from\x20a\x20previous\x20session,\x20so\x20you\x20can’t\x20apply,\x20reject,\x20or\x20suggest\x20changes.'});case'AI_SUGGESTION_DISABLED_FEED_MESSAGE':return t({'id':'AI_SUGGESTION_DISABLED_FEED_MESSAGE','string':'Actions\x20aren’t\x20available\x20for\x20changes\x20from\x20a\x20previous\x20session.'});default:return _0x48f227;}}const cs='ck-ai-button-primary',ls='ck-ai-button-secondary',us='ck-ai-button-tertiary';function ds(_0x382455,_0x3d65fb){const _0x47ffa5=new Nt(_0x382455),_0x5cb04b=hs(_0x382455,'AI_TABS_LABEL_MINIMIZE'),_0x50fd67=hs(_0x382455,'AI_TABS_LABEL_MAXIMIZE');return _0x47ffa5['set']({'withText':!0x1,'icon':_0x4aa4b0,'tooltip':!0x0,'class':'ck-ai-tabs__resize\x20'+us}),_0x47ffa5['bind']('label')['to'](_0x3d65fb,'isMaximized',_0x253c48=>_0x253c48?_0x5cb04b:_0x50fd67),_0x47ffa5['bind']('icon')['to'](_0x3d65fb,'isMaximized',_0x54e107=>_0x54e107?_0x3fafdd:_0x4aa4b0),_0x47ffa5['bind']('isOn')['to'](_0x3d65fb,'isMaximized'),_0x47ffa5['on']('execute',()=>{_0x3d65fb['fire']('resizeTabs');}),_0x47ffa5;}function _s(_0x31333f){return _0xabe431(_0x31333f);}function gs(_0x12b9b4){return ti(_0x12b9b4);}function As(_0x20da5e,_0x3a6ffa,_0x564f9c){const _0x284d6c=null!==_0x3a6ffa?_0x51637a=>_0x51637a['attribs'][_0x20da5e]===_0x3a6ffa:_0x30a276=>Boolean(_0x30a276['attribs'][_0x20da5e]);return _0x4f11c1(_0x32799f=>_0x1d6ab8(_0x32799f)&&_0x284d6c(_0x32799f),_0x564f9c);}function Is(_0x18124b,_0x407a40,_0x38dd65){const _0x4bcf53=null!==_0x407a40?_0x16786d=>_0x16786d['attribs'][_0x18124b]===_0x407a40:_0x5247e8=>Boolean(_0x5247e8['attribs'][_0x18124b]);return _0x49c4b8(_0x1c5585=>_0x1d6ab8(_0x1c5585)&&_0x4bcf53(_0x1c5585),_0x38dd65);}function Es(_0x2428a3,_0x12ec70){return _0x2428a3&&_0x1d6ab8(_0x2428a3)?_0x2428a3['attribs'][_0x12ec70]:null;}function ps(_0x1a0164,_0x2c26be,_0x83c883){_0x1d6ab8(_0x1a0164)&&(null===_0x83c883?delete _0x1a0164['attribs'][_0x2c26be]:_0x1a0164['attribs'][_0x2c26be]=_0x83c883);}function ms(_0x292582,_0x43f826,_0x365d84){const _0x1abc83=_0x43f826['cloneNode'](!0x0);'beforebegin'===_0x365d84?_0x27ae1b(_0x292582,_0x1abc83):'afterbegin'===_0x365d84?_0x288fde(_0x292582,_0x1abc83):'beforeend'===_0x365d84?_0x27626e(_0x292582,_0x1abc83):'afterend'===_0x365d84&&_0x188752(_0x292582,_0x1abc83);}function Ts(_0x1052c4){const _0x1a4c14=[];let _0x1b88e9=_0x1052c4;for(;_0x1b88e9;)_0x1b88e9=_0xb9dbd4(_0x1b88e9),_0x1b88e9&&_0x1a4c14['push'](_0x1b88e9);return _0x1a4c14;}function Cs(_0xf57216){return _0xf57216['replace'](/^\s+/gm,'')['replace'](/\s+$/gm,'')['replace'](/\n*/g,'')['replace'](/\s+/g,'\x20')['replace'](/>\s*</g,'><');}function ws(_0xe11682){let _0x1448e6=0x0;for(;_0xe11682['parentNode'];)_0xe11682=_0xe11682['parentNode'],_0x1448e6++;return _0x1448e6;}function fs(_0x3eeff3){const _0x3f13da=[];let _0x3faa05=_0x3eeff3['nextSibling'];for(;_0x3faa05;)_0x3f13da['push'](_0x3faa05),_0x3faa05=_0x3faa05['nextSibling'];_0x3f13da['forEach'](_0x13ac3d=>{_0x5d78f4(_0x13ac3d);});}class bs extends/* #__PURE__ -- @preserve */
25
- ht(){['_m2html'];constructor(){super();const _0x8c52f7=Object['entries'](_0x58a02a),_0x483d8e=_0x8c52f7['findIndex'](([_0x188204])=>'rehypeDomRaw'===_0x188204);if(-0x1===_0x483d8e)throw new at('ai-response-parser-unable-to-set-up-parser');_0x8c52f7['splice'](_0x483d8e+0x1,0x0,['rehypeSanitize',_0xfb07ec]),this['_m2html']=new _0x53347b({'plugins':Object['fromEntries'](_0x8c52f7)});}['convertMarkdownToHTML'](_0x3d9b91){const _0x17971f=this['_m2html']['parse'](_0x3d9b91);return this['parseAndNormalizeHTML'](_0x17971f);}['parseAndNormalizeHTML'](_0xc79bd7){return this['_parseHTML'](_0xc79bd7);}['_parseHTML'](_0x1f5c97){const _0x17cb51=_s('<dummy>'+_0x1f5c97['replace'](/^\t+/gm,'\x20')['replace'](/\n*/g,'')['replace'](/\s+/g,'\x20')['replace'](/<[^>]*?$/g,'')+'</dummy>');return _0x17cb51['children']=_0x17cb51['children'][0x0]['children'],_0x17cb51;}}class Ss extends/* #__PURE__ -- @preserve */
26
- ht(){['_generateUid'];['_uidCounter']=0x0;['_touchedNodesState']={'newIds':[],'modifiedIds':[],'removedIds':[],'invalidIds':[],'lastTouchedId':null};['_existingDataIds']=new Set();constructor(_0x4a4080){super(),this['_generateUid']=_0x4a4080||(()=>'e'+String(this['_uidCounter']++));}['merge'](_0x45f45e,_0x3529ca,_0x54266a){this['_uidCounter']=0x0;const _0xa20633=_0x45f45e['cloneNode'](!0x0),_0x13937d=_0xa20633['childNodes'],_0x45b4d9=Array['from'](_0x13937d)['filter'](_0x509605=>!(0x3===_0x509605['nodeType']&&''===gs(_0x509605)['trim']())),_0x9bda67=_0x45b4d9['length'],_0xf5454=new Map();for(const _0x318b22 of _0x45b4d9)_0x318b22&&_0x1d6ab8(_0x318b22)&&void 0x0===_0x318b22['attribs']['data-id']&&ps(_0x318b22,'data-id','new-element');if(0x0===_0x3529ca['childNodes']['length']){const _0x551c80=[];return Is('data-id','new-element',_0xa20633)['forEach'](_0x50d707=>{const _0x4f88af=this['_generateUid']();ps(_0x50d707,'data-id',_0x4f88af),_0x551c80['push'](_0x4f88af);}),this['_removeSpecialComments'](_0xa20633),{'parsedContent':_0xa20633,'newNodeIds':_0x551c80,'modifiedNodeIds':[],'removedNodeIds':[],'newAnchorIds':_0xf5454};}_0x54266a&&_0x54266a['markUnstableElements']&&this['_markLastTagElementUnstable'](_0xa20633),this['_touchedNodesState']['newIds']=[],this['_touchedNodesState']['modifiedIds']=[],this['_touchedNodesState']['removedIds']=[],this['_touchedNodesState']['invalidIds']=[],this['_touchedNodesState']['lastTouchedId']=null,this['_existingDataIds']=new Set(Is('data-id',null,_0x3529ca)['map'](_0x4caabc=>Es(_0x4caabc,'data-id'))['filter'](_0x5c7ac2=>!!_0x5c7ac2));let _0x2cf3a2=-0x1,_0x17b59b=!0x1;for(let _0x198ca3=0x0;_0x198ca3<_0x9bda67;_0x198ca3++){const _0x512d8b=_0x45b4d9[_0x198ca3],_0x4b45ad=_0x45b4d9[_0x198ca3+0x1];if(this['_isNewNode'](_0x512d8b)){if(-0x1===_0x2cf3a2&&(_0x2cf3a2=_0x198ca3),this['_markWrappedElements'](_0x512d8b),!this['_isNewNode'](_0x4b45ad)){const [_0x46c02b,_0x1b36ae]=this['_findReferenceNode'](_0x512d8b,_0x17b59b,_0x3529ca);if(_0x46c02b){const _0x169f7d=Array['from'](_0x45b4d9)['slice'](_0x2cf3a2,_0x198ca3+0x1),_0x375737=Es(_0x46c02b,'data-id');if(this['_insertNodes'](_0x46c02b,_0x169f7d,_0x1b36ae),_0x375737)for(const _0x37b848 of _0x169f7d){const _0x5ceaf6=Es(_0x37b848,'data-id');_0x5ceaf6&&_0xf5454['set'](_0x5ceaf6,_0x375737);}_0x2cf3a2=-0x1;}}}else{if(this['_isExistingContentComment'](_0x512d8b))_0x17b59b=!0x0;else{if(this['_isExistingNode'](_0x512d8b)){const _0x1ff3c8=Es(_0x512d8b,'data-id');if(_0x1ff3c8&&this['_existingDataIds']['has'](_0x1ff3c8)){const _0x2d6284=As('data-id',_0x1ff3c8,_0x3529ca);this['_replaceNode'](_0x2d6284,_0x512d8b);}}else{if(this['_isDelNode'](_0x512d8b)){const _0x423840=this['_getNodeDataId'](_0x512d8b);!!As('data-id',_0x423840,_0xa20633)||this['_touchedNodesState']['removedIds']['push'](_0x423840);}}}}}for(const _0x3918ae of this['_touchedNodesState']['removedIds']){const _0x2b2fa1=As('data-id',_0x3918ae,_0x3529ca);_0x2b2fa1&&this['_removeNode'](_0x2b2fa1,_0x3918ae,_0x54266a);}if(Is('data-id','new-element',_0x3529ca)['forEach'](_0x298664=>{const _0x2fa6eb=this['_getUid'](_0x298664);ps(_0x298664,'data-id',_0x2fa6eb),this['_touchedNodesState']['newIds']['push'](_0x2fa6eb);}),this['_removeSpecialComments'](_0x3529ca),_0x54266a&&_0x54266a['markUnstableElements']&&this['_markUnstableElements'](_0x3529ca,_0x54266a['markUnstableElementsDepth']||0x0),this['_processWrappedElements'](_0x3529ca,_0x54266a),_0x54266a&&_0x54266a['cutAfterLastChange']&&this['_touchedNodesState']['lastTouchedId']){const _0xa677b7=Is('data-id',this['_touchedNodesState']['lastTouchedId'],_0x3529ca);let _0x38a60d=_0xa677b7[_0xa677b7['length']-0x1];for(;_0x38a60d;)fs(_0x38a60d),_0x38a60d=_0x38a60d['parentNode'];}return{'parsedContent':_0x3529ca,'newNodeIds':this['_touchedNodesState']['newIds'],'modifiedNodeIds':this['_touchedNodesState']['modifiedIds'],'removedNodeIds':this['_touchedNodesState']['removedIds'],'newAnchorIds':_0xf5454};}['_insertNodes'](_0x40e705,_0x3644a8,_0x13a016){for(const _0x449cb3 of _0x3644a8){const _0x36134a=this['_getUid'](_0x449cb3);ps(_0x449cb3,'data-id',_0x36134a),this['_touchedNodesState']['newIds']['push'](_0x36134a),this['_touchedNodesState']['lastTouchedId']=_0x36134a;}const _0x23b640='afterbegin'===_0x13a016||'afterend'===_0x13a016?_0x3644a8['reverse']():_0x3644a8;for(const _0x2cf1b7 of _0x23b640)ms(_0x40e705,_0x2cf1b7,_0x13a016);}['_replaceNode'](_0x527e2d,_0x13d6e7){if(!_0x527e2d)return;if(_0x2a074d=_0x13d6e7,Cs(gs(_0x527e2d))===Cs(gs(_0x2a074d)))return;var _0x2a074d;const _0x1ff8d9=this['_getUid'](_0x527e2d);ps(_0x13d6e7,'data-id',_0x1ff8d9),this['_touchedNodesState']['modifiedIds']['push'](_0x1ff8d9),this['_touchedNodesState']['lastTouchedId']=_0x1ff8d9,_0x292e22(_0x527e2d,_0x13d6e7['cloneNode'](!0x0));}['_removeNode'](_0x1eb200,_0x3e024b,_0x16ed73){if(_0x16ed73&&_0x16ed73['replaceRemovedWith']){this['_touchedNodesState']['lastTouchedId']=_0x3e024b;const _0x2b830a=_0x16ed73['replaceRemovedWith']['cloneNode'](!0x0);ps(_0x2b830a,'data-id',_0x3e024b),ps(_0x2b830a,'data-removed','true'),_0x292e22(_0x1eb200,_0x2b830a);}else _0x5d78f4(_0x1eb200);}['_findReferenceNode'](_0x32428a,_0x3e2323,_0x81b9da){const _0x204ea0=this['_findPrevElementWithDataId'](_0x32428a,!0x1);if(_0x204ea0){const _0x5692e6=this['_getNodeDataId'](_0x204ea0),_0x143d58=As('data-id',_0x5692e6,_0x81b9da);if(_0x143d58)return[_0x143d58,'afterend'];this['_touchedNodesState']['invalidIds']['push'](_0x5692e6);}const _0x343493=this['_findNextElementWithDataId'](_0x32428a,!0x1);if(_0x343493){const _0x19c470=this['_getNodeDataId'](_0x343493),_0x344dc8=As('data-id',_0x19c470,_0x81b9da);if(_0x344dc8)return[_0x344dc8,'beforebegin'];this['_touchedNodesState']['invalidIds']['push'](_0x19c470);}return _0x3e2323?_0x32428a['nextSibling']?this['_findFallbackReferenceNode'](_0x32428a,_0x81b9da):[_0x81b9da['childNodes'][_0x81b9da['childNodes']['length']-0x1],'afterend']:[_0x81b9da['childNodes'][0x0],'beforebegin'];}['_findFallbackReferenceNode'](_0x82eab5,_0x337702){const _0x24ad02=[],_0x2f976e=this['_findPrevElementWithDataId'](_0x82eab5,!0x0);if(_0x2f976e){const _0xadec11=As('data-id',this['_getNodeDataId'](_0x2f976e),_0x337702);_0xadec11&&_0x24ad02['push']([_0xadec11,'afterend']);}const _0x41f273=this['_findNextElementWithDataId'](_0x82eab5,!0x0);if(_0x41f273){const _0x24b057=As('data-id',this['_getNodeDataId'](_0x41f273),_0x337702);_0x24b057&&_0x24ad02['push']([_0x24b057,'beforebegin']);}if(_0x24ad02['length']>0x1)return ws(_0x24ad02[0x0][0x0])<=ws(_0x24ad02[0x1][0x0])?_0x24ad02[0x0]:_0x24ad02[0x1];return 0x1===_0x24ad02['length']?_0x24ad02[0x0]:[_0x337702['lastChild'],'afterend'];}['_findNextElementWithDataId'](_0x7c2370,_0x4eb73d){let _0x4fa20c=_0x7c2370['nextSibling'],_0x5ca5d0=null,_0x3c0dab=!0x1;for(;_0x4fa20c;){if(_0x31c97d(_0x4fa20c)){if(this['_isDelNode'](_0x4fa20c)&&(_0x5ca5d0=_0x4fa20c),this['_isExistingContentComment'](_0x4fa20c)&&_0x4eb73d&&!_0x3c0dab){_0x3c0dab=!0x0,_0x4fa20c=_0x4fa20c['nextSibling'];continue;}break;}const _0x55259c=Es(_0x4fa20c,'data-id');if(_0x55259c&&'new-element'!==_0x55259c&&this['_existingDataIds']['has'](_0x55259c)){_0x5ca5d0=_0x4fa20c;break;}_0x4fa20c=_0x4fa20c['nextSibling'];}return _0x5ca5d0;}['_findPrevElementWithDataId'](_0x4f30ef,_0x3ee94c){let _0x341ec1=_0x4f30ef['previousSibling'],_0x4ed62d=null,_0x197c8e=!0x1;for(;_0x341ec1;){if(_0x31c97d(_0x341ec1)){if(this['_isDelNode'](_0x341ec1)&&(_0x4ed62d=_0x341ec1),this['_isExistingContentComment'](_0x341ec1)&&_0x3ee94c&&!_0x197c8e){_0x197c8e=!0x0,_0x341ec1=_0x341ec1['previousSibling'];continue;}break;}const _0x20b073=Es(_0x341ec1,'data-id');if(_0x20b073&&'new-element'!==_0x20b073&&this['_existingDataIds']['has'](_0x20b073)){_0x4ed62d=_0x341ec1;break;}_0x341ec1=_0x341ec1['previousSibling'];}return _0x4ed62d;}['_markWrappedElements'](_0x2278f3){_0x1d6ab8(_0x2278f3)&&Is('data-id',null,_0x2278f3)['forEach'](_0x58c458=>{this['_isExistingNode'](_0x58c458)&&(ps(_0x58c458,'data-wrapped-id',Es(_0x58c458,'data-id')),ps(_0x58c458,'data-id',null));});}['_processWrappedElements'](_0x2cce61,_0x156265){Is('data-wrapped-id',null,_0x2cce61)['forEach'](_0x3dedad=>{const _0x297c69=Es(_0x3dedad,'data-wrapped-id');if(Es(_0x3dedad,'data-unstable')||this['_hasUnstableParent'](_0x3dedad))return;const _0x5a7a00=As('data-id',_0x297c69,_0x2cce61);ps(_0x3dedad,'data-id',_0x297c69),ps(_0x3dedad,'data-wrapped-id',null),_0x5a7a00&&(this['_removeNode'](_0x5a7a00,_0x297c69,_0x156265),this['_touchedNodesState']['removedIds']['push'](_0x297c69),this['_touchedNodesState']['lastTouchedId']=_0x297c69);});}['_hasUnstableParent'](_0x4c976c){let _0x47553f=_0x4c976c['parentNode'];for(;_0x47553f;){if(Es(_0x47553f,'data-unstable'))return!0x0;_0x47553f=_0x47553f['parentNode'];}return!0x1;}['_getNodeDataId'](_0x18d7f9){if(!_0x18d7f9)return null;if(_0x1d6ab8(_0x18d7f9))return Es(_0x18d7f9,'data-id');if(_0x31c97d(_0x18d7f9)){const _0x17ef53=gs(_0x18d7f9)['match'](/removed[\s*-]data-id="([^"]+)"/);if(_0x17ef53&&_0x17ef53[0x1])return _0x17ef53[0x1];}return null;}['_getUid'](_0x4543f4){return this['_isExistingNode'](_0x4543f4)?Es(_0x4543f4,'data-id'):this['_generateUid']();}['_removeSpecialComments'](_0x57454e){(function(_0x218097){return _0x56818a(_0x5d3dcc=>_0x31c97d(_0x5d3dcc),_0x218097,!0x0,0x1/0x0);}(_0x57454e)['filter'](_0x50f744=>this['_isDelNode'](_0x50f744)||this['_isExistingContentComment'](_0x50f744))['forEach'](_0x2a47c1=>{_0x5d78f4(_0x2a47c1);}));}['_markLastTagElementUnstable'](_0x11cfdf){const _0x1cd3aa=_0x11cfdf['childNodes'],_0x1e725=_0x1cd3aa[_0x1cd3aa['length']-0x1];_0x1e725&&_0x1d6ab8(_0x1e725)&&ps(_0x1e725,'data-unstable','true');}['_markUnstableElements'](_0x2a874c,_0x2dbacf){const _0x29f6c0=As('data-unstable','true',_0x2a874c);if(!_0x29f6c0)return;const _0x2039f0=Ts(_0x29f6c0)['slice'](0x0,-0x1),_0x338e41=_0x2039f0['length'];let _0x497991=_0x29f6c0;if(_0x338e41>_0x2dbacf){let _0x3c7470=_0x338e41,_0x1ba1e0=null;for(;_0x3c7470>_0x2dbacf&&_0x3c7470>=0x0;)_0x3c7470--,_0x1ba1e0=_0x2039f0[_0x3c7470];_0x1ba1e0&&(_0x497991=_0x1ba1e0,ps(_0x29f6c0,'data-unstable',null),ps(_0x1ba1e0,'data-unstable','true'));}else{if(_0x338e41<_0x2dbacf){let _0x25314c=_0x338e41,_0x336b95=_0x29f6c0;for(;_0x25314c<_0x2dbacf;){const _0x3bd3cf=_0x336b95['childNodes']['filter'](_0x1e0347=>_0x1d6ab8(_0x1e0347));if(0x0===_0x3bd3cf['length'])break;_0x25314c++,_0x336b95=_0x3bd3cf[_0x3bd3cf['length']-0x1];}_0x336b95&&(_0x497991=_0x336b95,ps(_0x29f6c0,'data-unstable',null),ps(_0x336b95,'data-unstable','true'));}}let _0x37f7b3=_0x497991;for(;_0x37f7b3;){for(;_0x37f7b3['nextSibling'];)_0x37f7b3=_0x37f7b3['nextSibling'],_0x1d6ab8(_0x37f7b3)&&ps(_0x37f7b3,'data-unstable','true');_0x37f7b3=_0x37f7b3['parentNode'];}}['_isNewNode'](_0x1d0b42){return Boolean('new-element'===Es(_0x1d0b42,'data-id'));}['_isExistingNode'](_0x14130c){return Boolean((Es(_0x14130c,'data-id')||'')['length']>0x0&&'new-element'!==Es(_0x14130c,'data-id'));}['_isDelNode'](_0x3545b8){return!!_0x3545b8&&Boolean(_0x31c97d(_0x3545b8)&&gs(_0x3545b8)['match'](/removed[\s*-]data-id="[^"]+"/));}['_isExistingContentComment'](_0x2b584b){return Boolean(_0x31c97d(_0x2b584b)&&gs(_0x2b584b)['match'](/\s*existing[\s*-](content|document)\s*/g));}}function Rs({editor:_0x4d1225,changeGroups:_0x748937,documentContextContent:_0x35bf50,showDiff:_0x458a3e,trimUnchanged:_0xd0be31=!0x0}){return _0x748937['map'](_0x2832e3=>{const _0x4e1c2f=new _0x290fcd([]),_0x3ecd6b=new _0x290fcd([]),_0x5f373d=new Set();for(const _0x54dc18 of _0x2832e3['changes'])'new'==_0x54dc18['type']&&Is('data-id',null,_0x54dc18['node'])['forEach'](_0x2c1016=>{_0x5f373d['add'](Es(_0x2c1016,'data-id'));});for(const _0x328854 of _0x2832e3['changes'])if('removed'!=_0x328854['type']?_0x3ecd6b['children']['push'](_0x328854['node']['cloneNode'](!0x0)):_0x458a3e||_0x5f373d['has'](_0x328854['id'])||_0x3ecd6b['children']['push'](_0x328854['node']['cloneNode'](!0x0)),'new'!=_0x328854['type']&&(_0x458a3e||'removed'!=_0x328854['type'])){const _0xf18fa7=_0x4f11c1(_0x463af7=>Es(_0x463af7,'data-id')==_0x328854['id'],_0x35bf50,!0x0);_0xf18fa7&&_0x4e1c2f['children']['push'](_0xf18fa7['cloneNode'](!0x0));}const {content:_0xcd1c61,hasChanges:_0x1cc44e}=function(_0x20b2f7,_0x55cbe9,_0x4e6b69,_0x54892f,_0x211d80=!0x0){const _0x530753=_0x20b2f7['plugins']['get']('DocumentCompare'),_0x554a93=gs(_0x55cbe9),_0x55ba18=gs(_0x4e6b69),_0x1924d6=_0x20b2f7['data']['parse'](_0x554a93,'$root'),_0x1ae9be=_0x20b2f7['model']['createPositionAt'](_0x1924d6,0x0),_0xb8462d=_0x530753['getDiff'](_0x554a93,_0x55ba18,{'anchor':_0x1ae9be,'markDeletions':_0x54892f,'targetEditor':_0x20b2f7}),_0x17536a=_0xb8462d['getOperations']();if(0x0==_0x17536a['length'])return{'content':_0x55cbe9['cloneNode'](!0x0),'hasChanges':!0x1};_0x54892f?function(_0x220ac4,_0x26afc9,_0x58333c){if(0x0==_0x220ac4['length'])return;const _0x39b7e9=_0x58333c['plugins']['get']('DocumentCompare'),_0x56bab2=_0x58333c['plugins']['get']('SuggestionsConversion');_0x58333c['model']['change'](_0x2ba006=>{const _0x3689a3=new Set();for(let _0x2c7490=0x0;_0x2c7490<_0x220ac4['length'];_0x2c7490++){const _0x4c89b3=_0x220ac4[_0x2c7490];if(_0x4c89b3['baseVersion']=null,_0x4c89b3['isDocumentOperation']=!0x1,_0x39b7e9['isMarkedRemoveOperation'](_0x4c89b3)){const _0x553cef=_0x2443fd(_0x4c89b3['newRange'],_0x58333c['model']),_0x548822='suggestion:deletion:'+ot()+':$aiSuggestion';_0x26afc9['markers']['set'](_0x548822,_0x553cef);}else switch(_0x4c89b3['type']){case'rename':{if(_0x4c89b3['oldName']==_0x4c89b3['newName'])break;_0x2ba006['batch']['addOperation'](_0x4c89b3),_0x58333c['model']['applyOperation'](_0x4c89b3);const _0x4f40f7='$elementName',_0x4c5a80=_0x4c89b3['position'],_0x4ac662=_0x58333c['model']['createRange'](_0x4c5a80,_0x58333c['model']['createPositionAt'](_0x4c5a80['nodeAfter'],'end')),_0x650619='suggestion:attribute:'+_0x4f40f7+':'+ot()+':$aiSuggestion';_0x26afc9['markers']['set'](_0x650619,_0x4ac662);break;}case'addAttribute':case'removeAttribute':case'changeAttribute':{if(_0x4c89b3['oldValue']==_0x4c89b3['newValue'])break;_0x2ba006['batch']['addOperation'](_0x4c89b3),_0x58333c['model']['applyOperation'](_0x4c89b3);const _0x45ae4c=_0x4c89b3['key'];if(!_0x56bab2['isRegisteredAttribute'](_0x45ae4c))break;const _0x49a46d=_0x2443fd(_0x4c89b3['range'],_0x58333c['model']),_0x213aea='suggestion:attribute:'+_0x45ae4c+':'+ot()+':$aiSuggestion';_0x26afc9['markers']['set'](_0x213aea,_0x49a46d);break;}case'insert':{_0x2ba006['batch']['addOperation'](_0x4c89b3),_0x58333c['model']['applyOperation'](_0x4c89b3);if(_0x220ac4[_0x2c7490+0x1]&&'move'==_0x220ac4[_0x2c7490+0x1]['type']){Os(_0x26afc9,_0x4c89b3);break;}const _0x25cd07=_0x4c89b3['position'],_0x5c7d73=_0x4c89b3['howMany'],_0x4b5244=_0x2443fd(_0x58333c['model']['createRange'](_0x25cd07,_0x25cd07['getShiftedBy'](_0x5c7d73)),_0x58333c['model']),_0x328783='suggestion:insertion:'+ot()+':$aiSuggestion';_0x26afc9['markers']['set'](_0x328783,_0x4b5244);break;}case'split':{_0x2ba006['batch']['addOperation'](_0x4c89b3),_0x58333c['model']['applyOperation'](_0x4c89b3);const _0x37b127=_0x4c89b3['splitPosition'],_0x572714=_0x4c89b3['moveTargetPosition'],_0x239632=_0x58333c['model']['createRange'](_0x37b127,_0x572714),_0x1da3d8='suggestion:insertion:'+ot()+':$aiSuggestion';_0x26afc9['markers']['set'](_0x1da3d8,_0x239632);break;}case'move':{_0x2ba006['batch']['addOperation'](_0x4c89b3),_0x58333c['model']['applyOperation'](_0x4c89b3),_0x220ac4[_0x2c7490-0x1]&&'insert'==_0x220ac4[_0x2c7490-0x1]['type']&&Os(_0x26afc9,_0x4c89b3);const _0xa8bd52=_0x4c89b3['getMovedRangeStart'](),_0x508736=_0x4c89b3['howMany'];for(let _0x264f98=0x0;_0x264f98<_0x508736;_0x264f98++){const _0x13941c=_0xa8bd52['getShiftedBy'](_0x264f98)['nodeAfter'];_0x3689a3['add'](_0x13941c);}break;}case'remove':{const _0x174fef=_0x4c89b3['sourcePosition'],_0x2832b3=_0x4c89b3['howMany'],_0x35d4b6=new _0x48a283(_0x174fef,_0x2832b3);_0x2ba006['batch']['addOperation'](_0x35d4b6),_0x58333c['model']['applyOperation'](_0x35d4b6);break;}}}for(const _0x2c1b97 of _0x3689a3){const _0xbb67e0=_0x58333c['model']['createRangeOn'](_0x2c1b97),_0x299cbb='suggestion:formatBlock:$fakeWrap:'+ot()+':$aiSuggestion';_0x26afc9['markers']['set'](_0x299cbb,_0x2443fd(_0xbb67e0,_0x58333c['model']));}});}(_0x17536a,_0x1924d6,_0x20b2f7):_0x20b2f7['model']['change'](_0x2ff02d=>{for(const _0x199915 of _0x17536a)if('remove'==_0x199915['type']){const _0x3bfff0=_0x199915['sourcePosition'],_0x393b9f=_0x199915['howMany'],_0x5280b3=new _0x48a283(_0x3bfff0,_0x393b9f);_0x2ff02d['batch']['addOperation'](_0x5280b3),_0x20b2f7['model']['applyOperation'](_0x5280b3);}else{if('marker'==_0x199915['type']){const _0x2c71f2=_0x199915['name'],_0x247520=_0x199915['newRange'];null!==_0x247520?_0x1924d6['markers']['set'](_0x2c71f2,_0x247520):_0x1924d6['markers']['delete'](_0x2c71f2);}else _0x199915['baseVersion']=null,_0x199915['isDocumentOperation']=!0x1,_0x2ff02d['batch']['addOperation'](_0x199915),_0x20b2f7['model']['applyOperation'](_0x199915);}});if(_0x211d80){const _0x53a2a1=ks(_0x20b2f7,_0x17536a,_0x1924d6);Ns(_0x20b2f7['model'],_0x53a2a1),function(_0x2506b9,_0x59e694){const _0x111bce=_0x59e694['getFirstRange']()['start'];let _0x361e00=_0x59e694['getFirstRange']()['end'];const _0x51c76d=_0x111bce['root'];(_0x361e00['textNode']||_0x361e00['nodeAfter']&&_0x361e00['nodeAfter']['is']('$text'))&&(_0x3f2c26(_0x361e00,'...'),_0x361e00=_0x361e00['getShiftedBy'](0x3)),(_0x111bce['textNode']||_0x111bce['nodeBefore']&&_0x111bce['nodeBefore']['is']('$text'))&&(_0x3f2c26(_0x111bce,'...'),function(_0x53f5b8,_0x44909a,_0x4d1560){for(let [_0x261dc9,_0x3d0840]of _0x53f5b8['markers']){const _0x163858=_0x3d0840['_getTransformedByInsertion'](_0x44909a,_0x4d1560,!0x1);_0x3d0840=_0x163858[0x0],_0x53f5b8['markers']['set'](_0x261dc9,_0x3d0840);}}(_0x51c76d,_0x111bce,0x3),_0x111bce['parent']==_0x361e00['parent']&&(_0x361e00=_0x361e00['getShiftedBy'](0x3)));const _0x45c580=_0x2506b9['createRange'](_0x2506b9['createPositionAt'](_0x51c76d,0x0),_0x111bce),_0x53881f=_0x2506b9['createRange'](_0x361e00,_0x2506b9['createPositionAt'](_0x51c76d,'end')),_0x4cb029=[..._0x45c580['getMinimalFlatRanges'](),..._0x53881f['getMinimalFlatRanges']()];_0x4cb029['reverse']();for(const _0x376c17 of _0x4cb029)_0x1d04c0(_0x376c17),ys(_0x51c76d,_0x376c17);}(_0x20b2f7['model'],_0x53a2a1);}const _0x4b2883=_0x20b2f7['data']['stringify'](_0x1924d6,{'showSuggestionHighlights':!0x0});return{'content':_s(_0x4b2883),'hasChanges':!0x0};}(_0x4d1225,_0x4e1c2f,_0x3ecd6b,_0x458a3e,_0xd0be31);return{'type':_0x2832e3['changes'][0x0]['type'],'index':_0x2832e3['index'],'content':_0xcd1c61,'hasChanges':_0x1cc44e};});}function Os(_0x9c319e,_0x4cbd0c){for(const [_0x424b98,_0x5db8ec]of _0x9c319e['markers']){const _0x4e753a=_0x5ca4e8['_createFromRanges'](_0x5db8ec['getTransformedByOperation'](_0x4cbd0c));_0x9c319e['markers']['set'](_0x424b98,_0x4e753a);}}function ks(_0x537ec6,_0x5df134,_0x4bdfb8){const _0x1992a0=_0x537ec6['plugins']['get']('DocumentCompare');let _0x1cc162=_0x537ec6['model']['createPositionAt'](_0x4bdfb8,Number['POSITIVE_INFINITY']),_0x50b4c8=_0x537ec6['model']['createPositionAt'](_0x4bdfb8,0x0);for(const _0x505728 of _0x5df134){let _0x4fbf46,_0x2d244d;if(_0x1992a0['isMarkedRemoveOperation'](_0x505728))_0x4fbf46=_0x505728['newRange']['start'],_0x2d244d=_0x505728['newRange']['end'];else switch(_0x1cc162=_0x1cc162['getTransformedByOperation'](_0x505728),_0x50b4c8=_0x50b4c8['getTransformedByOperation'](_0x505728),_0x505728['type']){case'rename':_0x4fbf46=_0x505728['position'],_0x2d244d=_0x4fbf46['getShiftedBy'](0x1);break;case'addAttribute':case'removeAttribute':case'changeAttribute':_0x4fbf46=_0x505728['range']['start'],_0x2d244d=_0x505728['range']['end'];break;case'insert':_0x4fbf46=_0x505728['position'],_0x2d244d=_0x4fbf46['getShiftedBy'](_0x505728['howMany']);break;case'split':_0x4fbf46=_0x505728['splitPosition'],_0x2d244d=_0x505728['moveTargetPosition'];break;case'merge':{const _0x56fddf=_0x505728['targetPosition']['path']['slice'](0x0,-0x1);_0x4fbf46=_0x537ec6['model']['createPositionFromPath'](_0x4bdfb8,_0x56fddf),_0x2d244d=_0x4fbf46['getShiftedBy'](0x1);break;}case'move':case'remove':{const _0x18a8b8=_0x505728['howMany'],_0x2563c4=_0x505728['sourcePosition']['_getTransformedByInsertion'](_0x505728['targetPosition'],_0x18a8b8),_0x437f5a=_0x505728['getMovedRangeStart']();'remove'==_0x505728['type']?(_0x4fbf46=_0x2563c4,_0x2d244d=_0x2563c4):(_0x4fbf46=_0x437f5a,_0x2d244d=_0x437f5a['getShiftedBy'](_0x18a8b8));break;}}_0x4fbf46&&_0x4fbf46['isBefore'](_0x1cc162)&&(_0x1cc162=_0x4fbf46['clone'](),_0x1cc162['stickiness']='toNone'),_0x2d244d&&_0x2d244d['isAfter'](_0x50b4c8)&&(_0x50b4c8=_0x2d244d['clone'](),_0x50b4c8['stickiness']='toNone');}return _0x537ec6['model']['createSelection'](_0x537ec6['model']['createRange'](_0x1cc162,_0x50b4c8));}function Ns(_0x3410dd,_0x49ee97){vs(_0x3410dd,_0x49ee97,'forward');const _0x474624=_0x49ee97['getFirstRange']();_0x49ee97['setTo']([]),_0x49ee97['setTo'](_0x474624,{'backward':!0x0}),vs(_0x3410dd,_0x49ee97,'backward');}function vs(_0x269dd6,_0x5d5fb9,_0x44956e){let _0x20d8ec=0x14;for(;_0x20d8ec;){_0x269dd6['modifySelection'](_0x5d5fb9,{'unit':'word','direction':_0x44956e}),_0x20d8ec--;const _0x3476a0=_0x5d5fb9['focus']['forward'==_0x44956e?'nodeBefore':'nodeAfter'];if(_0x3476a0&&_0x3476a0['is']('element')&&_0x269dd6['schema']['isBlock'](_0x3476a0)&&_0x269dd6['schema']['isObject'](_0x3476a0))break;}}function ys(_0x24a204,_0x37e479){for(const [_0x54c82f,_0xdbd244]of _0x24a204['markers']){const _0xacdbdf=_0xdbd244['_getTransformedByDeletion'](_0x37e479['start'],_0x37e479['end']['offset']-_0x37e479['start']['offset']);null!=_0xacdbdf?_0x24a204['markers']['set'](_0x54c82f,_0xacdbdf):_0x24a204['markers']['delete'](_0x54c82f);}}class xs extends ht(){['id'];['interactionId'];['type'];['sources']=[];['parsedContent']=new _0x290fcd([]);['parsedMergedContent']=new _0x290fcd([]);['changeGroups']=[];['areActionsDisabled']=!0x1;['isFromHistory']=!0x1;['documentContextContent'];['documentId'];['dataIdDocumentSources'];['newNodeAnchorIds']=new Map();['aiResponseParser'];['aiResponseApplier'];['locale'];['cachedSuggestionContentParts']={'withDiff':[],'withoutDiff':[]};constructor({type:_0x12fe39,content:_0x1dea6f='',isDone:_0x3837f1=!0x1,isComplete:_0x152cca,interactionId:_0x8be45e,areActionsDisabled:_0x42a7b7,isFromHistory:_0x268a5e=!0x1,documentContextContent:_0x882df4,dataIdDocumentSources:_0x14be30,documentId:_0x5ab413,locale:_0x127fa2,id:_0x136320}){super(),this['id']=_0x136320||ot(),this['interactionId']=_0x8be45e,this['type']=_0x12fe39,this['areActionsDisabled']=!!_0x42a7b7,this['locale']=_0x127fa2,this['dataIdDocumentSources']=_0x14be30,this['documentId']=_0x5ab413,this['isFromHistory']=_0x268a5e,this['aiResponseParser']=new bs(),this['aiResponseApplier']=new Ss(),this['documentContextContent']=_s(_0x882df4||''),this['set']('isDone',_0x3837f1),this['set']('isComplete',_0x152cca??_0x3837f1),this['on']('change:content',()=>{this['onContentChange']();}),this['set']('content',_0x1dea6f);}['appendContent'](_0x413b98){this['set']('content',this['content']+_0x413b98);}['done'](_0x54f9a4=!0x0){this['isComplete']=_0x54f9a4,this['isDone']||(this['set']('isDone',!0x0),this['onContentChange']());}['destroy'](){this['stopListening']();}['setChangeGroupState'](_0x4e7ec3,_0x596a4f){this['changeGroups'][_0x4e7ec3]['state']=_0x596a4f,this['fire']('replyChangeGroupStateUpdated',{'reply':this,'index':_0x4e7ec3,'state':_0x596a4f});}['getContentParts']({showDiff:_0x4dae53,groupIndex:_0x17ba31,editor:_0x3deb10}){const _0x27ee6c=this['_getCachedContentParts'](_0x4dae53,_0x17ba31);if(_0x27ee6c)return _0x27ee6c;let _0x43424f=[];if(void 0x0===_0x17ba31)_0x43424f=this['changeGroups'];else{const _0x33c6f2=this['changeGroups']['find'](({index:_0x4ab9a7})=>_0x4ab9a7===_0x17ba31);if(!_0x33c6f2)throw new at('ai-reply-get-content-parts-group-not-found',null,{'aiReply':this,'groupIndex':_0x17ba31});_0x43424f=[_0x33c6f2];}const _0x451233=Rs({'editor':_0x3deb10,'showDiff':_0x4dae53,'changeGroups':_0x43424f,'documentContextContent':this['documentContextContent']});return this['_setCachedContentParts'](_0x4dae53,_0x451233),_0x451233;}['_getCachedContentParts'](_0xcebd3d,_0xaa9b35){const _0x19e1a6=_0xcebd3d?'withDiff':'withoutDiff';if(!this['cachedSuggestionContentParts'][_0x19e1a6]['length'])return null;const _0x3da507=this['cachedSuggestionContentParts'][_0x19e1a6];if(void 0x0===_0xaa9b35)return _0x3da507['length']>0x0&&_0x3da507['length']!==this['changeGroups']['length']?(this['_setCachedContentParts'](_0xcebd3d,null),null):_0x2d7474(_0x3da507);{const _0x31d80a=_0x3da507['find'](({index:_0x6167b1})=>_0x6167b1===_0xaa9b35);if(_0x31d80a)return[_0x2d7474(_0x31d80a)];}return null;}['_setCachedContentParts'](_0xdc8f41,_0x1115a6){const _0x4548fb=_0xdc8f41?'withDiff':'withoutDiff';_0x1115a6?_0x1115a6['forEach'](_0xaa6475=>{const _0x1a2c41=this['cachedSuggestionContentParts'][_0x4548fb],_0x49d027=_0x1a2c41['find'](({index:_0x15e153})=>_0x15e153===_0xaa6475['index']);if(_0x49d027){const _0x17d8c4=_0x1a2c41['indexOf'](_0x49d027);_0x1a2c41['splice'](_0x17d8c4,0x1,_0xaa6475);}else _0x1a2c41['push'](_0xaa6475);}):this['cachedSuggestionContentParts'][_0x4548fb]['length']=0x0;}['onContentChange'](){if('modification'===this['type']){this['parsedContent']=this['aiResponseParser']['parseAndNormalizeHTML'](this['content']);const _0x2346c0=this['changeGroups'];this['updateChangeGroups']();const _0x33ef13=this['_getDifferentChangeGroups'](_0x2346c0,this['changeGroups']);(_0x33ef13['length']||this['isDone'])&&(this['fire']('replyContentUpdated',this,_0x33ef13),this['cachedSuggestionContentParts']['withDiff']['length']=this['cachedSuggestionContentParts']['withoutDiff']['length']=0x0);}else this['parsedContent']=this['aiResponseParser']['convertMarkdownToHTML'](this['content']),this['fire']('replyContentUpdated',this);}['_getDifferentChangeGroups'](_0x18becd,_0x322f0d){const _0x10773c=[];for(const _0x443d0f of _0x322f0d){const _0x2d1089=_0x18becd[_0x443d0f['index']];_0x2d1089?_0x2d1089['changes']['length']!==_0x443d0f['changes']['length']?_0x10773c['push'](_0x443d0f):_0x2d1089['changes']['forEach']((_0x30db50,_0x3033e6)=>{const _0x340f1f=_0x443d0f['changes'][_0x3033e6];_0x30db50['id']!==_0x340f1f['id']&&_0x10773c['push'](_0x443d0f);}):_0x10773c['push'](_0x443d0f);}return _0x10773c;}['updateChangeGroups'](){const _0xe028a6=this['locale']?new _0x244f1b('p',{},[new _0x244f1b('span',{'style':'color:\x20#808080;\x20font-style:\x20italic'},[new _0x592fb4(hs(this['locale'],'AI_SUGGESTION_CONTENT_PART_REMOVED'))])]):void 0x0,_0x1f0a04=this['aiResponseApplier']['merge'](this['parsedContent'],this['documentContextContent']['cloneNode'](!0x0),{'markUnstableElements':!this['isDone']||!this['isComplete'],'replaceRemovedWith':_0xe028a6,'cutAfterLastChange':!this['isDone']||!this['isComplete']});if(!_0x1f0a04['modifiedNodeIds']['length']&&!this['isDone'])return;this['parsedMergedContent']=_0x1f0a04['parsedContent'],this['newNodeAnchorIds']=_0x1f0a04['newAnchorIds'];let _0x1bc78b=[];if(_0x49c4b8(_0x889e3b=>{const _0xa2eedb=Es(_0x889e3b,'data-id');if(!_0xa2eedb||!_0x3ab711(_0xa2eedb))return!0x1;const _0x4d1c5c=[_0x889e3b,...Ts(_0x889e3b)]['at'](-0x2);if(_0x889e3b!=_0x4d1c5c){const _0x56faa5=Es(_0x4d1c5c,'data-id');_0x3ab711(_0x56faa5)||(_0x1bc78b['push']({'node':_0x4d1c5c,'id':_0x56faa5,'type':'modified'}),_0x1f0a04['modifiedNodeIds']['push'](_0x56faa5));}else _0x1f0a04['modifiedNodeIds']['includes'](_0xa2eedb)?_0x1bc78b['push']({'node':_0x889e3b,'type':'modified','id':_0xa2eedb}):_0x1f0a04['newNodeIds']['includes'](_0xa2eedb)?_0x1bc78b['push']({'node':_0x889e3b,'type':'new','id':_0xa2eedb,'anchorId':Es(_0x889e3b['previousSibling'],'data-id')}):_0x1bc78b['push']({'node':_0x889e3b,'type':'removed','id':_0xa2eedb});return!0x0;},this['parsedMergedContent']),_0x1bc78b=_0x1bc78b['filter'](({node:_0x3f18a7})=>[...Ts(_0x3f18a7),_0x3f18a7]['every'](_0x13a9ec=>!Es(_0x13a9ec,'data-unstable'))),0x0==_0x1bc78b['length'])return;const _0x55320d=[[_0x1bc78b[0x0]]];for(let _0x3d9864=0x1;_0x3d9864<_0x1bc78b['length'];_0x3d9864++){const _0x4af982=_0x55320d[_0x55320d['length']-0x1],_0x12c1b7=_0x4af982[_0x4af982['length']-0x1];_0x1bc78b[_0x3d9864]['node']['previousSibling']==_0x12c1b7['node']&&'modified'!=_0x1bc78b[_0x3d9864]['type']&&'modified'!=_0x12c1b7['type']&&this['_isSameDocument'](_0x1bc78b[_0x3d9864]['node'],_0x12c1b7['node'])?_0x4af982['push'](_0x1bc78b[_0x3d9864]):_0x55320d['push']([_0x1bc78b[_0x3d9864]]);}for(const _0x457461 of _0x55320d){const _0x2bd0cc=_0x457461[0x0],_0x66cfd7=_0x457461[_0x457461['length']-0x1],_0x12616=_0x5034de(_0x2bd0cc['node']['previousSibling']);_0x12616&&this['_isSameDocument'](_0x12616['node'],_0x2bd0cc['node'])&&_0x457461['unshift'](_0x12616);const _0x35e559=_0x5034de(_0x66cfd7['node']['nextSibling']);_0x35e559&&this['_isSameDocument'](_0x35e559['node'],_0x66cfd7['node'])&&_0x457461['push'](_0x35e559);}function _0x3ab711(_0x616c59){return _0x1f0a04['modifiedNodeIds']['includes'](_0x616c59)||_0x1f0a04['newNodeIds']['includes'](_0x616c59)||_0x1f0a04['removedNodeIds']['includes'](_0x616c59);}function _0x5034de(_0x29cea5){if(_0x29cea5&&Es(_0x29cea5,'data-id')&&!Es(_0x29cea5,'data-unstable')){const _0x254d20=Es(_0x29cea5,'data-id');if(!_0x3ab711(_0x254d20))return{'node':_0x29cea5,'type':'context','id':_0x254d20};}return null;}this['changeGroups']=_0x55320d['map']((_0x43a108,_0x170a44)=>({'changes':_0x43a108,'state':'pending','index':_0x170a44}));}['_isSameDocument'](_0x3ccf2f,_0x40193a){if(!this['dataIdDocumentSources']?.['size'])return!0x0;const _0x4d4452=this['_resolveDocumentSource'](_0x3ccf2f),_0x1997d0=this['_resolveDocumentSource'](_0x40193a);return!_0x4d4452||!_0x1997d0||_0x4d4452['editor']===_0x1997d0['editor']&&_0x4d4452['rootName']===_0x1997d0['rootName'];}['_resolveDocumentSource'](_0x2e858d){if(!_0x2e858d||!this['dataIdDocumentSources'])return;const _0x4e5632=Es(_0x2e858d,'data-id');if(_0x4e5632){const _0x123ba6=this['dataIdDocumentSources']['get'](_0x4e5632);if(_0x123ba6)return _0x123ba6;const _0x2c2e35=this['newNodeAnchorIds']['get'](_0x4e5632),_0x4f0011=_0x2c2e35?this['dataIdDocumentSources']['get'](_0x2c2e35):void 0x0;if(_0x4f0011)return _0x4f0011;}for(let _0x59fb54=_0x2e858d['previousSibling'];_0x59fb54;_0x59fb54=_0x59fb54['previousSibling']){const _0x1825cc=Es(_0x59fb54,'data-id'),_0x2d8295=_0x1825cc?this['dataIdDocumentSources']['get'](_0x1825cc):void 0x0;if(_0x2d8295)return _0x2d8295;}for(let _0x527d03=_0x2e858d['nextSibling'];_0x527d03;_0x527d03=_0x527d03['nextSibling']){const _0x983c78=Es(_0x527d03,'data-id'),_0x460bbe=_0x983c78?this['dataIdDocumentSources']['get'](_0x983c78):void 0x0;if(_0x460bbe)return _0x460bbe;}}}const Ls=['interactionCreated','interactionStarted','interactionStopped','interactionFinished','interactionDestroyed','replyCreated','replyContentUpdated','replyChangeGroupStateUpdated','setConversationTitle','webSearchStarted','webSearchFinished','reasoningStarted','reasoningFinished','toolDataReceived','error'];class Ds extends Tt(){['id'];['replies']=[];['currentReply'];['messageId'];['actionCallId'];['currentRequest'];['connector'];['isStopped']=!0x1;['isDestroyed']=!0x1;['locale'];['_isReasoning']=!0x1;['_isWebSearching']=!0x1;constructor({connector:_0xef6479,locale:_0x71a20c}){super(),this['id']=ot(),this['connector']=_0xef6479,this['isStopped']=!0x0,this['locale']=_0x71a20c;}async['start'](){const _0x538839=[];let _0x41e5ba,_0x3749ee,_0x88fb87,_0x1060f3=!0x1;this['isStopped']=!0x1;try{this['currentRequest']=await this['sendRequest'](),this['fire']('interactionStarted',this);const _0x5a9cb6=await this['currentRequest']['getStream']();for await(const _0x393601 of _0x5a9cb6){if(this['isStopped'])return;if('error'==_0x393601['event'])return void this['fire']('error',{'error':new at('ai-chat-interaction-error',this)});switch(_0x393601['event']){case'message-metadata':this['messageId']=_0x393601['data']['messageId'];break;case'action-metadata':this['actionCallId']=_0x393601['data']['callId'];break;case'conversation-title':this['setConversationTitle'](_0x393601['data']['conversationTitle'],!0x0);break;case'source':_0x538839['push'](_0x393601['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'](),_0x41e5ba='modification-delta'==_0x393601['event']?'modification':'text',_0x3749ee='modification-delta'==_0x393601['event']?_0x393601['data']['id']:void 0x0,this['currentReply']&&this['currentReply']['type']!=_0x41e5ba&&(this['currentReply']['done'](),this['currentReply']=void 0x0),this['currentReply']?'modification-delta'==_0x393601['event']&&(this['currentReply']['documentId']=_0x393601['data']['documentId']):(this['currentReply']=this['createReply']({'type':_0x41e5ba,'interactionId':this['id'],'id':_0x3749ee,...'modification-delta'==_0x393601['event']&&{'documentId':_0x393601['data']['documentId']}}),'modification'==_0x41e5ba&&(this['currentReply']['sources']=_0x538839['splice'](0x0))),this['currentReply']['appendContent'](_0x393601['data']['textDelta']);break;case'mcp-tool-result':_0x88fb87=JSON['parse'](_0x393601['data']['result']),this['_handleToolResultData']({'toolName':_0x393601['data']['toolName'],'data':_0x88fb87['data'],'attributes':_0x88fb87['attributes']});break;case'mcp-tool-notification':this['_handleToolNotificationData']({'toolName':_0x393601['data']['toolName'],'data':_0x393601['data']['data']});}}_0x1060f3=!0x0;}finally{this['isStopped']||(this['currentReply']&&_0x538839['length']>0x0&&(this['currentReply']['sources']=_0x538839['splice'](0x0)),this['_finalizeInteraction'](_0x1060f3),this['fire']('interactionFinished',this));}}['stop'](){this['isStopped']||(this['_finalizeInteraction'](),this['fire']('interactionStopped',this));}['getReply'](_0x572a24){return this['replies']['find'](_0x139ab3=>_0x139ab3['id']===_0x572a24);}['destroy'](){this['isDestroyed']||(this['stop'](),this['replies']['forEach'](_0x4f2b90=>_0x4f2b90['destroy']()),this['replies']=[],this['isDestroyed']=!0x0,this['fire']('interactionDestroyed',this),this['stopListening']());}['createReply'](_0x55ec03){const _0x14170c=new xs({'locale':this['locale'],'documentContextContent':this['getDocumentContext']()?.['content'],'dataIdDocumentSources':this['getDocumentContext']()?.['dataIdDocumentSources'],..._0x55ec03});return this['replies']['push'](_0x14170c),_0x14170c['delegate'](...Ls)['to'](this),this['fire']('replyCreated',_0x14170c),_0x14170c;}['setConversationTitle'](_0x35047b,_0x1215d8=!0x1){this['fire']('setConversationTitle',_0x35047b,_0x1215d8);}['resetWebSearchState'](){this['_isWebSearching']&&(this['_isWebSearching']=!0x1,this['fire']('webSearchFinished',this));}['resetReasoningState'](){this['_isReasoning']&&(this['_isReasoning']=!0x1,this['fire']('reasoningFinished',this));}['_handleToolResultData'](_0x531732){this['fire']('toolDataReceived',{'type':'result','toolName':_0x531732['toolName'],'data':structuredClone(_0x531732['data']||{}),'attributes':structuredClone(_0x531732['attributes']||{})},this);}['_handleToolNotificationData'](_0x2ecc87){this['fire']('toolDataReceived',{'type':'notification','toolName':_0x2ecc87['toolName'],'data':structuredClone(_0x2ecc87['data'])},this);}['_finalizeInteraction'](_0x46a11e=!0x1){this['isStopped']=!0x0,this['currentRequest']&&this['currentRequest']['abortController']['abort'](),this['currentReply']&&this['currentReply']['done'](_0x46a11e),this['currentRequest']=this['currentReply']=void 0x0;}}const Ps=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']]),Hs=['contextItemAdded','contextItemRemoved','contextItemLoadingEnded','contextSent','error','addContextOptionsChanged','sourceResourcesLoaded','resourceStateChanged','uploadProgressChanged'];class Ms extends ht(){['_connector'];['_config'];['_ownerId'];constructor({connector:_0x5d52f9,config:_0x4e6ee7,ownerId:_0x3e4e02}){super(),this['_connector']=_0x5d52f9,this['_config']=_0x4e6ee7,this['_ownerId']=_0x3e4e02;}['init'](){this['_pendingContextItems']=new Map(),this['_conversationContextItems']=new Map(),this['_ongoingUploads']=new Map(),this['_ongoingUploadOperations']=new Map(),this['_documentSources']=new Map(),this['_dataIdToSource']=new Map(),this['_setAddContextOptionsDefaultState']();}['_getDocumentSource'](_0x3a89f1){if(_0x3a89f1)return this['_documentSources']['get'](_0x3a89f1);}['getSourceByDataId'](_0xdef55e){if(_0xdef55e)return this['_dataIdToSource']['get'](_0xdef55e);}['_getDocumentContextSlice'](_0x341840){const _0x55dff5=this['_getDocumentSource'](_0x341840);if(_0x55dff5)return{'editor':_0x55dff5['editor'],'rootName':_0x55dff5['rootName'],'html':_0x55dff5['content'],'version':_0x55dff5['version']};}['getDocumentContextSliceByDataId'](_0x27732d){const _0x4c1181=this['getSourceByDataId'](_0x27732d);return _0x4c1181?this['_getDocumentContextSlice'](_0x4c1181['documentId']):void 0x0;}['getPendingContextItems'](){return this['_pendingContextItems'];}async['populateFromMessage'](_0x29be45){const _0x479dce=await this['_createContextItemFromContent'](_0x29be45);return this['_addToConversationContextItem'](_0x479dce),'current-document'===_0x479dce['uiId']&&this['_toggleAddCurrentDocumentOptionVisibility'](),_0x479dce;}async['populateDocumentsFromMessage'](_0x5758de,_0x3dfcba){const _0x26cbd4=_0x5758de['filter'](_0x2b3557=>'document'===_0x2b3557['type']);if(0x0===_0x26cbd4['length'])return{'hasUnmatched':!0x1};if(0x1===_0x26cbd4['length'])return{'contextItem':await this['populateFromMessage'](_0x26cbd4[0x0]),'hasUnmatched':!0x1};const _0x5ea907=_0x26cbd4['map'](_0x26d5d9=>_0x26d5d9['id']),_0x121597=await this['_connector']['fetchDocuments'](this['_ownerId'],_0x5ea907)['getDocuments'](),_0x226bc2=new Map(_0x121597['map'](_0x519580=>[_0x519580['id'],_0x519580]));this['_documentSources']['clear'](),this['_dataIdToSource']['clear']();const _0x54506a=[];let _0x2f6f91=!0x1;for(const _0x57b08b of _0x26cbd4){const _0x196988=_0x226bc2['get'](_0x57b08b['id']);if(!_0x196988)continue;const _0x5ac4f1=this['_matchDocumentToRoot'](_0x196988,_0x3dfcba),_0x44f4b5=_0x3dfcba[0x0]&&this['_getFirstRoot'](_0x3dfcba[0x0]);_0x5ac4f1||(_0x2f6f91=!0x0);const _0x50a4b9=_0x5ac4f1?.['editor']??_0x44f4b5?.['editor'],_0x3971e4=_0x5ac4f1?.['rootName']??_0x44f4b5?.['rootName'];if(_0x50a4b9&&_0x3971e4){const _0x1b9ccd={'editor':_0x50a4b9,'rootName':_0x3971e4,'content':_0x196988['content'],'version':_0x196988['attributes']?.['version']??0x0,'name':_0x196988['name'],'description':_0x196988['description']};this['_documentSources']['set'](_0x196988['id'],_0x1b9ccd);const _0x2446ac=_s(_0x196988['content']);for(const _0xfb4efc of _0x49c4b8(_0x4e7d9f=>!!Es(_0x4e7d9f,'data-id'),_0x2446ac)){const _0x44759f=Es(_0xfb4efc,'data-id');_0x44759f&&this['_dataIdToSource']['set'](_0x44759f,{..._0x1b9ccd,'documentId':_0x196988['id']});}}_0x54506a['push']({'id':_0x196988['id'],'content':_0x196988['content'],'version':_0x196988['attributes']?.['version']??0x0,'sessionId':_0x196988['attributes']?.['sessionId']??null,'selection':[]});}const _0x3e5704={'id':'current-document','uiId':'current-document','label':'Current\x20document','type':'document','hidden':this['_conversationContextItems']['has']('current-document'),'documents':_0x54506a,'dataIdDocumentSources':new Map(this['_dataIdToSource'])};return this['_addToConversationContextItem'](_0x3e5704),this['_toggleAddCurrentDocumentOptionVisibility'](),{'contextItem':_0x3e5704,'hasUnmatched':_0x2f6f91};}['_matchDocumentToRoot'](_0x50ff58,_0x50e056){const _0xd3283=_0x50ff58['attributes']?.['channelId'],_0x54ff42=_0x50ff58['attributes']?.['rootName'];if(_0xd3283&&_0x54ff42){for(const _0x54e30b of _0x50e056)if(_0x54e30b['config']['get']('collaboration.channelId')===_0xd3283){for(const _0x27ce6e of _0x54e30b['model']['document']['getRoots']())if('$graveyard'!==_0x27ce6e['rootName']&&_0x27ce6e['rootName']===_0x54ff42)return{'editor':_0x54e30b,'rootName':_0x27ce6e['rootName']};}}}['_getFirstRoot'](_0x3898ad){for(const _0x5c73a8 of _0x3898ad['model']['document']['getRoots']())if('$graveyard'!==_0x5c73a8['rootName'])return{'editor':_0x3898ad,'rootName':_0x5c73a8['rootName']};}async['_createContextItemFromContent'](_0x18518f){if('document'===_0x18518f['type']){const _0x1d28ca=await this['_connector']['fetchDocument'](this['_ownerId'],_0x18518f['id'])['getDocument']();return{'id':'current-document','uiId':'current-document','label':'Current\x20document','type':_0x18518f['type'],'content':_0x1d28ca['content'],'hidden':this['_conversationContextItems']['has']('current-document'),'version':_0x1d28ca['attributes']?.['version'],'sessionId':_0x1d28ca['attributes']?.['sessionId']};}if('mcp-tool-context'===_0x18518f['type'])return{'id':_0x18518f['id'],'uiId':_0x18518f['id'],'label':_0x18518f['data']?.['label']||_0x18518f['id'],'type':'mcp-tool-context','mcpServerName':_0x18518f['mcpServerName'],'toolName':_0x18518f['toolName'],'data':_0x18518f['data']||{}};return{'id':_0x18518f['id'],'uiId':_0x18518f['id'],'label':_0x18518f['attributes']?.['label']||_0x18518f['name']||_0x18518f['url']||_0x18518f['id'],'type':_0x18518f['type'],..._0x18518f?.['attributes']?.['resourceId']?{'resourceId':_0x18518f['attributes']?.['resourceId']}:{}};}['getSentContextItems'](){return new Map(this['_conversationContextItems']);}['removeFromContext'](_0x2aea98){const _0x332405=this['_pendingContextItems']['get'](_0x2aea98);_0x332405?.['isReadOnly']||this['_removeContextItem'](_0x2aea98);}['clearPendingContextItems'](){if(0x0===this['_pendingContextItems']['size'])return;for(const _0x56d699 of this['_pendingContextItems']['values']())this['_removeContextItem'](_0x56d699['uiId']);const _0xc9a006=this['_conversationContextItems']['get']('current-document')||this['_pendingContextItems']['get']('current-document');_0xc9a006&&this['_addContextItem']({..._0xc9a006,'isReadOnly':!0x0,'hidden':!0x0});}['addToConversationContext'](_0x3dd080){for(const _0x5a932e of _0x3dd080['values']())this['_addToConversationContextItem'](_0x5a932e);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'](_0x503751){return Array['from'](_0x503751['values']())['flatMap'](_0x14c165=>this['_mapContextItemToRequestData'](_0x14c165));}async['addFilesToContext'](_0x1921dc,_0x1ed9ba,_0x58237a='file'){const _0x34e45e='files-'+ot();this['_startUploadOperation'](_0x34e45e);try{await Promise['all'](_0x1921dc['map'](async _0x512984=>{const _0x4f2407='file-'+ot(),_0x41d136=_0x5aed4a(_0x512984['name']);try{this['_addContextItem']({'type':_0x58237a,'label':_0x1ed9ba?.['label']||_0x41d136,'uiId':_0x4f2407,'resourceId':_0x1ed9ba?.['resourceId']},!0x0);const _0x35f7e9=this['_connector']['uploadFile'](this['_ownerId'],_0x512984,_0x1ed9ba);this['_ongoingUploads']['set'](_0x4f2407,_0x35f7e9['abortController']);const {id:_0x28e5a0}=await _0x35f7e9['getId']();this['_ongoingUploads']['delete'](_0x4f2407),this['_finishContextItemLoading']({'type':_0x58237a,'id':_0x28e5a0,'label':_0x1ed9ba?.['label']||_0x41d136,'uiId':_0x4f2407,'resourceId':_0x1ed9ba?.['resourceId']},!0x1);}catch(_0x3f449a){this['_ongoingUploads']['delete'](_0x4f2407);if(!(_0x3f449a instanceof at&&_0x3f449a['message']['startsWith']('ai-request-aborted'))){const _0x5d0fe2=Ps['get'](_0x3f449a['code'])||'ai-chat-file-upload-failed',_0x8c3b4=new at(_0x5d0fe2,null,{'fileName':_0x41d136,..._0x3f449a});_0x8c3b4['stack']=_0x3f449a['stack'],this['fire']('error',{'error':_0x8c3b4});}this['_removeContextItem'](_0x4f2407);}}));}finally{this['_finishUploadOperation'](_0x34e45e);}}['addCurrentDocumentToContext'](_0x398a3a){if(this['isCurrentDocumentInContext']()||!this['_addContextOptionsState']['document']['enabled'])return;const _0x474b4b={'type':'document','uiId':'current-document','label':_0x398a3a,'isReadOnly':this['_conversationContextItems']['has']('current-document'),'hidden':this['_conversationContextItems']['has']('current-document')};this['_addContextItem'](_0x474b4b);}async['updateCurrentDocument'](_0x7cdfbe,_0x169212,_0x41ab25,_0x3b37f8,_0xed7dd,_0x29fdbf){const _0x5d3586=this['_pendingContextItems']['get']('current-document');if(_0x5d3586&&_0x7cdfbe){_0x5d3586['selection']=_0x29fdbf?_0x29fdbf['map'](_0x243c8f=>({'start':_0x243c8f['start'],'end':_0x243c8f['end']})):[];try{if(_0x5d3586['version']===_0x169212)return;const {id:_0x5c549d}=await this['_connector']['uploadDocument'](this['_ownerId'],_0x7cdfbe,{'version':_0x169212,'sessionId':_0x41ab25,'channelId':_0x3b37f8,'rootName':_0xed7dd})['getId']();_0x5d3586['id']=_0x5c549d,_0x5d3586['content']=_0x7cdfbe,_0x5d3586['version']=_0x169212,_0x5d3586['sessionId']=_0x41ab25;}catch(_0x1976a1){const _0x540885=new at('ai-chat-document-upload-failed',null);_0x540885['stack']=_0x1976a1['stack'],this['fire']('error',{'error':_0x540885});}}}async['updateCurrentDocuments'](_0x5d0433){const _0x55cb27=this['_pendingContextItems']['get']('current-document');if(!_0x55cb27||!_0x5d0433['length']||_0x5d0433['every'](_0x3ddb5e=>!_0x3ddb5e['content']))return;_0x5d0433['length']>0x1&&_0x5d0433['some'](_0x48fa0c=>!_0x48fa0c['description'])&&It('ai-chat-documents-missing-description');const _0x3f6aa7=_0x51cb30=>_0x51cb30?_0x51cb30['map'](_0x318a29=>({'start':_0x318a29['start'],'end':_0x318a29['end']})):[],_0x33d1ed=_0x55cb27['documents']??[];if(_0x33d1ed['length']===_0x5d0433['length']&&_0x5d0433['every']((_0x52bcfd,_0x30193a)=>_0x33d1ed[_0x30193a]?.['version']===_0x52bcfd['version']))_0x55cb27['documents']=_0x33d1ed['map']((_0x4e79f4,_0x47f30d)=>({..._0x4e79f4,'selection':_0x3f6aa7(_0x5d0433[_0x47f30d]['selections'])}));else try{const _0x10a733=await this['_connector']['uploadDocuments'](this['_ownerId'],_0x5d0433)['getIds']();_0x55cb27['documents']=_0x5d0433['map']((_0x1dbc32,_0x53cc81)=>({'id':_0x10a733[_0x53cc81]?.['id'],'content':_0x1dbc32['content'],'version':_0x1dbc32['version'],'sessionId':_0x1dbc32['sessionId'],'selection':_0x3f6aa7(_0x1dbc32['selections'])})),this['_documentSources']['clear'](),this['_dataIdToSource']['clear']();for(let _0x3bbb35=0x0;_0x3bbb35<_0x5d0433['length'];_0x3bbb35++){const _0x981807=_0x10a733[_0x3bbb35]?.['id'],_0x252c12=_0x5d0433[_0x3bbb35];if(!_0x981807)continue;const _0x32417f={'editor':_0x252c12['editor'],'rootName':_0x252c12['rootName'],'content':_0x252c12['content'],'version':_0x252c12['version'],'name':_0x252c12['name'],'description':_0x252c12['description']};this['_documentSources']['set'](_0x981807,_0x32417f);const _0x34965d=_s(_0x252c12['content']);for(const _0x4d4a3f of _0x49c4b8(_0x5898ff=>!!Es(_0x5898ff,'data-id'),_0x34965d)){const _0x145f28=Es(_0x4d4a3f,'data-id');_0x145f28&&this['_dataIdToSource']['set'](_0x145f28,{..._0x32417f,'documentId':_0x981807});}}_0x55cb27['dataIdDocumentSources']=new Map(this['_dataIdToSource']);}catch(_0x329d2d){const _0x49159f=new at('ai-chat-document-upload-failed',null);_0x49159f['stack']=_0x329d2d['stack'],this['fire']('error',{'error':_0x49159f});}}['addSelectionToContext'](_0x28d566){this['_addContextItem']({'type':'selection','label':_0x28d566,'uiId':'selection','content':_0x28d566});}['removeSelectionFromContext'](){this['_removeContextItem']('selection');}async['addUrlToContext'](_0x3bc4f0,_0xc081ec){const _0x286251='url-'+ot();this['_startUploadOperation'](_0x286251);const _0x1d3b9c='url-'+ot();try{this['_addContextItem']({'type':'web-resource','label':_0xc081ec?.['label']||_0x3bc4f0,'uiId':_0x1d3b9c,'resourceId':_0xc081ec?.['resourceId']},!0x0);const _0x2ec3c6=this['_connector']['uploadUrl'](this['_ownerId'],_0x3bc4f0,_0xc081ec);this['_ongoingUploads']['set'](_0x1d3b9c,_0x2ec3c6['abortController']);const {id:_0x47c1ce}=await _0x2ec3c6['getId']();this['_ongoingUploads']['delete'](_0x1d3b9c),this['_finishContextItemLoading']({'type':'web-resource','id':_0x47c1ce,'label':_0xc081ec?.['label']||_0x3bc4f0,'uiId':_0x1d3b9c,'resourceId':_0xc081ec?.['resourceId']},!0x1);}catch(_0x44f18d){this['_ongoingUploads']['delete'](_0x1d3b9c),(_0x44f18d['message']['startsWith']('ai-request-aborted')||this['fire']('error',{'error':new at('ai-chat-url-upload-failed',this,{'url':_0x3bc4f0,'originalError':_0x44f18d}),'url':_0x3bc4f0}),this['_removeContextItem'](_0x1d3b9c));}finally{this['_finishUploadOperation'](_0x286251);}}['addToolItemToContext'](_0x33ec7d){_0x33ec7d['id']=_0x33ec7d['id']??ot()['substring'](0x0,0x15),this['_pendingContextItems']['set'](_0x33ec7d['uiId'],_0x33ec7d),this['fire']('contextItemAdded',{'contextItem':_0x33ec7d,'isLoading':!0x1});}async['loadSourceResources'](_0xf4a75b,_0x363b09,_0x5b4956){const _0x117352=this['_addContextOptionsState']['sources']['find'](_0x4027c6=>_0x4027c6['id']===_0xf4a75b);if(!_0x117352)return this['fire']('error',{'error':new at('ai-chat-source-not-found',this,{'sourceId':_0xf4a75b}),'sourceId':_0xf4a75b}),[];try{const _0xa5d3ac=(await _0x117352['getResources'](_0x363b09))['map'](_0x10e374=>{const _0x2826ba=this['_isResourceInContext'](_0x10e374['id']);return{..._0x10e374,'isInContext':_0x2826ba};});return _0x117352['resources']=_0xa5d3ac,this['fire']('sourceResourcesLoaded',{'sourceId':_0xf4a75b,'source':_0x117352,'resources':_0xa5d3ac,'uid':_0x5b4956}),_0xa5d3ac;}catch(_0x5ef63c){return this['fire']('error',{'error':new at('ai-chat-source-resources-load-failed',this,{'sourceId':_0xf4a75b,'originalError':_0x5ef63c}),'sourceId':_0xf4a75b,'sourceLabel':_0x117352['label']}),[];}}async['addResourceToContext'](_0x2fa88c,_0x108f73){if(this['_isResourceInContext'](_0x108f73['id']))return;let _0x37850f=_0x108f73['data'];if(!_0x37850f&&_0x2fa88c['getData'])try{_0x37850f=await _0x2fa88c['getData'](_0x108f73['id']);}catch(_0x2b6a24){return void this['fire']('error',{'error':new at('ai-chat-resource-load-failed',this,{'resourceId':_0x108f73['id'],'sourceId':_0x2fa88c['id'],'originalError':_0x2b6a24}),'resourceId':_0x108f73['id'],'sourceId':_0x2fa88c['id']});}if(_0x37850f)switch(_0x108f73['type']){case'web-resource':if('string'!=typeof _0x37850f)return void this['fire']('error',{'error':new at('ai-chat-context-invalid-data',this,{'resourceId':_0x108f73['id'],'sourceId':_0x2fa88c['id'],'expectedType':'string','actualType':typeof _0x37850f}),'resourceId':_0x108f73['id'],'sourceId':_0x2fa88c['id']});await this['addUrlToContext'](_0x37850f,{'label':_0x108f73['label'],'resourceId':_0x108f73['id']});break;case'file':if(!(_0x37850f instanceof File))return void this['fire']('error',{'error':new at('ai-chat-context-invalid-data',this,{'resourceId':_0x108f73['id'],'sourceId':_0x2fa88c['id'],'expectedType':'File','actualType':typeof _0x37850f}),'resourceId':_0x108f73['id'],'sourceId':_0x2fa88c['id']});await this['addFilesToContext']([_0x37850f],{'label':_0x108f73['label'],'resourceId':_0x108f73['id']});break;case'text':if('object'!=typeof _0x37850f||!('content'in _0x37850f)||!('type'in _0x37850f))return void this['fire']('error',{'error':new at('ai-chat-context-invalid-data',this,{'resourceId':_0x108f73['id'],'sourceId':_0x2fa88c['id'],'expectedType':'object\x20with\x20content\x20and\x20type\x20properties','actualType':typeof _0x37850f}),'resourceId':_0x108f73['id'],'sourceId':_0x2fa88c['id']});_0x37850f=Ms['_convertTextResourceToFile'](_0x37850f,_0x108f73['label']),await this['addFilesToContext']([_0x37850f],{'label':_0x108f73['label'],'resourceId':_0x108f73['id']},'text');break;case'mcp-tool-context':break;default:this['fire']('error',{'error':new at('ai-chat-context-unsupported-type',this,{'resourceId':_0x108f73['id'],'sourceId':_0x2fa88c['id'],'resourceType':_0x108f73['type']}),'resourceId':_0x108f73['id'],'sourceId':_0x2fa88c['id']});}else this['fire']('error',{'error':new at('ai-chat-resource-no-data',this,{'resourceId':_0x108f73['id'],'sourceId':_0x2fa88c['id']}),'resourceId':_0x108f73['id'],'sourceId':_0x2fa88c['id']});}static['_convertTextResourceToFile'](_0xf938e1,_0x20992f){switch(_0xf938e1['type']){case'markdown':return new File([_0xf938e1['content']],_0x20992f,{'type':'text/markdown'});case'html':return new File([_0xf938e1['content']],_0x20992f,{'type':'text/html'});default:return new File([_0xf938e1['content']],_0x20992f,{'type':'text/plain'});}}static['_mapContextItemToRequestData'](_0x4a0b26){switch(_0x4a0b26['type']){case'file':case'text':return[{'type':'file','id':_0x4a0b26['id']}];case'web-resource':return[{'type':'web-resource','id':_0x4a0b26['id']}];case'document':return _0x4a0b26['documents']?.['length']?_0x4a0b26['documents']['map'](_0x5c11db=>({'type':'document','id':_0x5c11db['id'],..._0x5c11db['selection']?.['length']&&{'selection':_0x5c11db['selection']}})):[{'type':'document','id':_0x4a0b26['id'],..._0x4a0b26['selection']?.['length']&&{'selection':_0x4a0b26['selection']}}];case'mcp-tool-context':{const _0x410225=_0x4a0b26;return[{'type':'mcp-tool-context','mcpServerName':_0x410225['mcpServerName'],'toolName':_0x410225['toolName'],'data':{..._0x410225['data'],'label':_0x410225['label']||_0x410225['data']?.['label']||_0x410225['id']},'id':_0x410225['id']}];}default:return[];}}['_addContextItem'](_0x5cdb3c,_0x24814c=!0x1){if(this['_pendingContextItems']['set'](_0x5cdb3c['uiId'],_0x5cdb3c),_0x5cdb3c['hidden']||this['fire']('contextItemAdded',{'contextItem':_0x5cdb3c,'isLoading':_0x24814c}),'current-document'===_0x5cdb3c['uiId']&&this['_toggleAddCurrentDocumentOptionVisibility'](),_0x5cdb3c['resourceId']){const _0x5c01ff=this['_findSourceIdsByResourceId'](_0x5cdb3c['resourceId']);_0x5c01ff&&_0x5c01ff['forEach'](_0xbd3215=>{this['_updateResourceInContextState'](_0xbd3215,_0x5cdb3c['resourceId'],!0x0);});}}['_removeContextItem'](_0x5950d5){const _0x4d2978=this['_pendingContextItems']['get'](_0x5950d5),_0x191a52=this['_ongoingUploads']['get'](_0x5950d5);if(_0x191a52&&(_0x191a52['abort'](),this['_ongoingUploads']['delete'](_0x5950d5)),_0x4d2978?.['resourceId']){const _0x5e54e5=this['_findSourceIdsByResourceId'](_0x4d2978['resourceId']);_0x5e54e5&&_0x5e54e5['forEach'](_0x4f3d4e=>{this['_updateResourceInContextState'](_0x4f3d4e,_0x4d2978['resourceId'],!0x1);});}this['_pendingContextItems']['delete'](_0x5950d5),this['fire']('contextItemRemoved',{'uiId':_0x5950d5,'type':_0x4d2978?.['type']}),'current-document'===_0x5950d5&&this['_toggleAddCurrentDocumentOptionVisibility']();}['_finishContextItemLoading'](_0x487a39,_0x17e9d2){if(this['_pendingContextItems']['has'](_0x487a39['uiId'])&&(this['_pendingContextItems']['set'](_0x487a39['uiId'],_0x487a39),this['fire']('contextItemLoadingEnded',{'contextItem':_0x487a39,'isLoading':_0x17e9d2}),_0x487a39['resourceId'])){const _0x36249d=this['_findSourceIdsByResourceId'](_0x487a39['resourceId']);_0x36249d&&_0x36249d['forEach'](_0x5bffa6=>{this['_updateResourceInContextState'](_0x5bffa6,_0x487a39['resourceId'],!0x0);});}}['_addToConversationContextItem'](_0x10cffe){this['_conversationContextItems']['set'](_0x10cffe['uiId'],_0x10cffe);}['_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'](_0x5da76a=>({..._0x5da76a,'enabled':!0x0}))??[]},this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']});}['_getCustomSourcesInitialState'](){return this['_config']?.['sources']?.['map'](_0x58ad35=>({..._0x58ad35,'resources':[]}))??[];}['_toggleAddCurrentDocumentOptionVisibility'](){const _0x2a0885=this['isCurrentDocumentInContext']()||this['isCurrentDocumentInConversation']();this['_addContextOptionsState']['document']['isHidden']=_0x2a0885,this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']});}['_isResourceInContext'](_0x5a9976){for(const _0x51d0a1 of this['_pendingContextItems']['values']())if(_0x51d0a1['resourceId']===_0x5a9976)return!0x0;for(const _0x46f89b of this['_conversationContextItems']['values']())if(_0x46f89b['resourceId']===_0x5a9976)return!0x0;return!0x1;}['_findSourceIdsByResourceId'](_0x43d0b1){const _0x5981aa=[];for(const _0x1155a3 of this['_addContextOptionsState']['sources']){_0x1155a3['resources']['find'](_0x21229b=>_0x21229b['id']===_0x43d0b1)&&_0x5981aa['push'](_0x1155a3['id']);}return 0x0===_0x5981aa['length']?null:_0x5981aa;}['_updateResourceInContextState'](_0x393c6e,_0x37c1c7,_0x288408){const _0x252184=this['_addContextOptionsState']['sources']['find'](_0x5c35d4=>_0x5c35d4['id']===_0x393c6e);if(!_0x252184)return;const _0x4d4f10=_0x252184['resources']['find'](_0x5833e6=>_0x5833e6['id']===_0x37c1c7);_0x4d4f10&&(_0x4d4f10['isInContext']=_0x288408,this['fire']('resourceStateChanged',{'sourceId':_0x393c6e,'resourceId':_0x37c1c7,'isInContext':_0x288408}));}['_startUploadOperation'](_0x5dff8d){this['_ongoingUploadOperations']['set'](_0x5dff8d,!0x0),this['_ongoingUploadOperations']['size']&&this['fire']('uploadProgressChanged',{'isUploadInProgress':!0x0});}['_finishUploadOperation'](_0x5bdc8b){this['_ongoingUploadOperations']['delete'](_0x5bdc8b),0x0===this['_ongoingUploadOperations']['size']&&this['fire']('uploadProgressChanged',{'isUploadInProgress':!0x1});}}const Us=['capabilitiesUpdated'];class Vs extends Tt(){['_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'](_0x31c4a8){const _0x94f1fc={};return _0x31c4a8&&_0x31c4a8['isWebSearchEnabled']&&(_0x94f1fc['webSearch']={}),_0x31c4a8&&_0x31c4a8['isReasoningEnabled']&&(_0x94f1fc['reasoning']={}),_0x94f1fc;}['toggleWebSearch'](){this['setWebSearch'](!this['_isWebSearchEnabled']);}['toggleReasoning'](){this['setReasoning'](!this['_isReasoningEnabled']);}['setWebSearch'](_0x146fc0){_0x146fc0!==this['_isWebSearchEnabled']&&(this['_isWebSearchEnabled']=_0x146fc0,this['fire']('capabilitiesUpdated',this['getCapabilitiesConfig']()));}['setReasoning'](_0xb4eeea){_0xb4eeea!==this['_isReasoningEnabled']&&(this['_isReasoningEnabled']=_0xb4eeea,this['fire']('capabilitiesUpdated',this['getCapabilitiesConfig']()));}}class Bs extends Ds{['userMessage'];['conversationId'];['contextItems']=new Map();['capabilities'];['model'];['attributes'];constructor(_0x336be8){super(_0x336be8),this['conversationId']=_0x336be8['conversationId'],this['contextItems']=_0x336be8['contextItems'],this['capabilities']=_0x336be8['capabilities'],this['userMessage']=_0x336be8['userMessage'],this['model']=_0x336be8['model'],this['attributes']=_0x336be8['attributes'];}async['sendRequest'](){return this['connector']['queryAssistant']({'message':this['userMessage'],'conversationId':this['conversationId'],'parts':Ms['mapContextItemsToRequestData'](this['contextItems']),'capabilities':Vs['getCapabilitiesRequestData'](this['capabilities']),'model':this['model'],'attributes':this['attributes']});}['getDocumentContext'](){return this['contextItems']['get']('current-document');}['createReply'](_0x5e5978){const _0x8f096a=this['getDocumentContext']();if(_0x8f096a?.['documents']?.['length']){const _0x2eea18=_0x8f096a['documents']['map'](_0x4868c2=>_0x4868c2['content']??'')['join']('');if(_0x2eea18)return super['createReply']({'documentContextContent':_0x2eea18,..._0x5e5978});}return super['createReply'](_0x5e5978);}}class Gs extends Tt(){['id'];['isStarted']=!0x1;['isFromHistory'];['interactions']=[];['currentInteraction'];['selectedModel'];['connector'];['options'];constructor(_0x31ee39){super(),this['options']=_0x31ee39,this['connector']=_0x31ee39['connector'],this['chatModels']=_0x31ee39['chatModels'],this['id']=_0x31ee39['conversationId'],this['isFromHistory']=_0x31ee39['isFromHistory'];}async['init'](_0x3e565d){try{this['chatContext']=new Ms({'connector':this['connector'],'config':_0x3e565d,'ownerId':this['id']}),this['chatContext']['delegate'](...Hs)['to'](this),this['chatContext']['init'](),this['chatCapabilities']=new Vs(),this['chatCapabilities']['delegate'](...Us)['to'](this),this['chatCapabilities']['init']();const _0x4593b1=await this['chatModels']['getAvailableModels']();this['fire']('conversationInitialized',{'availableModels':_0x4593b1});const _0x172d17=await this['chatModels']['getModel'](this['options']['selectedModelId']);_0x172d17&&await this['setModel'](_0x172d17);}catch(_0x5d3d45){const _0x43fc2a=new at('ai-chat-conversation-init-failed',null,{'message':_0x5d3d45['message']||_0x5d3d45});_0x43fc2a['stack']=_0x5d3d45['stack'],this['fire']('error',{'error':_0x43fc2a});}}async['start'](){if(this['isStarted'])throw new at('ai-chat-conversation-already-started',null,{'conversation':this});if(!this['selectedModel'])throw new at('ai-chat-conversation-start-no-model-selected',null,{'conversation':this});try{const {id:_0x1d8953}=await this['connector']['startConversation'](this['id'],this['options']['group'])['getConversation']();this['id']=_0x1d8953,this['isStarted']=!0x0,this['fire']('conversationStarted',{'conversationId':this['id'],'selectedModel':this['selectedModel']});}catch(_0x99b140){const _0x9de6c7=new at('ai-chat-conversation-start-failed',null,{'message':_0x99b140['message'],'conversationId':this['id']});throw _0x9de6c7['stack']=_0x99b140['stack'],this['fire']('error',{'error':_0x9de6c7}),_0x9de6c7;}}async['load'](_0x229e1d,_0x5cb76e){try{const _0x873173=await this['connector']['fetchConversation'](_0x229e1d)['getConversation'](),_0x413534=await this['connector']['fetchConversationMessages'](_0x229e1d)['getMessages'](),_0x58b927=_0x413534[0x0]['model'];this['isStarted']=!0x0,this['id']=_0x873173['id'],'title'in _0x873173?this['fire']('setConversationTitle',_0x873173['title'],!0x0):this['fire']('setConversationTitle','',!0x0);const _0x1aebd4=(await this['chatModels']['getAll']())['find'](_0x2051c3=>_0x2051c3['id']['toLowerCase']()===_0x58b927['toLowerCase']());return this['selectedModel']=_0x1aebd4,this['fire']('modelSelected',{'selectedModel':_0x1aebd4,'isDisabled':!0x0}),await this['_processMessagesToInteractions'](_0x413534,_0x5cb76e,_0x58b927),this['currentInteraction']=void 0x0,this;}catch(_0x9d64d9){const _0x157493=new at('ai-chat-conversation-init-from-id-failed',null,{'message':_0x9d64d9['message'],'conversationId':_0x229e1d});throw _0x157493['stack']=_0x9d64d9['stack'],this['fire']('error',{'error':_0x157493}),_0x157493;}}async['_processMessagesToInteractions'](_0x371e80,_0x47bedf,_0x2a7f7b){let _0x12abcb,_0x4c5f7a=!0x1;for(const _0x54c44e of _0x371e80)if('user'===_0x54c44e['role']){const {contextItems:_0x11c19b,hasUnmatched:_0x88e3f}=await this['_extractContextItems'](_0x54c44e);_0x4c5f7a=_0x88e3f;const _0x486e8f={'isReasoningEnabled':Object['hasOwn'](_0x54c44e['capabilities'],'reasoning'),'isWebSearchEnabled':Object['hasOwn'](_0x54c44e['capabilities'],'webSearch')};_0x12abcb=this['createInteraction']({'userMessage':_0x54c44e['prompt'],'contextItems':_0x11c19b,'capabilities':_0x486e8f,'modelId':_0x2a7f7b,'attributes':_0x54c44e['attributes']}),this['currentInteraction']=_0x12abcb,this['chatContext']['addToConversationContext'](this['currentInteraction']['contextItems']);}else{if('assistant'===_0x54c44e['role']&&_0x12abcb){const _0x371ede=[];for(const _0x1485b7 of _0x54c44e['content'])switch(_0x1485b7['type']){case'text':case'modification':{const _0x55da80=_0x12abcb['getDocumentContext'](),_0xb904ce=(_0x55da80?.['documents']?.['length']?_0x55da80['documents']['some'](_0xe4dfe2=>_0xe4dfe2['sessionId']!==_0x47bedf):_0x55da80?.['sessionId']!==_0x47bedf)||_0x4c5f7a;_0x12abcb['currentReply']?.['type']!==_0x1485b7['type']&&(_0x12abcb['currentReply']=_0x12abcb['createReply']({'type':_0x1485b7['type'],'isDone':!0x0,'interactionId':_0x12abcb['id'],'areActionsDisabled':_0xb904ce,'isFromHistory':!0x0}),_0x371ede['length']>0x0&&(_0x12abcb['currentReply']['sources']=_0x371ede['splice'](0x0))),_0x12abcb['currentReply']['appendContent'](_0x1485b7['content']);break;}case'url':_0x371ede['push'](_0x1485b7);break;case'mcp-tool-result':{const {data:_0x1ba716,attributes:_0xaede46}=JSON['parse'](_0x1485b7['content']);_0x12abcb['_handleToolResultData']({'toolName':_0x1485b7['toolName'],'data':_0x1ba716,'attributes':_0xaede46});break;}}}}}async['_extractContextItems'](_0x1fd183){const _0x1ad8f7=new Map();if(!_0x1fd183['content'])return{'contextItems':_0x1ad8f7,'hasUnmatched':!0x1};const _0x5262f9=this['_resolveEditors'](),{contextItem:_0x121ca4,hasUnmatched:_0x1c8a0b}=await this['chatContext']['populateDocumentsFromMessage'](_0x1fd183['content'],_0x5262f9);_0x121ca4&&_0x1ad8f7['set'](_0x121ca4['id'],_0x121ca4);for(const _0x1786b4 of _0x1fd183['content']){if('document'===_0x1786b4['type'])continue;const _0x58fcff=await this['chatContext']['populateFromMessage'](_0x1786b4);_0x58fcff&&_0x1ad8f7['set'](_0x58fcff['id'],_0x58fcff);}return{'contextItems':_0x1ad8f7,'hasUnmatched':_0x1c8a0b};}['_resolveEditors'](){return this['options']['getEditors']?this['options']['getEditors']():this['options']['getEditor']?[this['options']['getEditor']()]:[];}async['handleUserInteraction']({userMessage:_0x51899e,attributes:_0x369cc1}){if(!this['isStarted'])throw new at('ai-chat-handle-user-conversation-not-initialized',null,{'conversation':this});if(this['currentInteraction'])throw new at('ai-chat-handle-user-interaction-already-in-progress',null,{'conversation':this});try{const _0x964c9d=this['chatContext']['getPendingContextItems'](),_0x261852=this['chatCapabilities']['getCapabilitiesConfig'](),_0x20f3d4=this['selectedModel']['id'];this['currentInteraction']=this['createInteraction']({'userMessage':_0x51899e,'contextItems':_0x964c9d,'capabilities':_0x261852,'modelId':_0x20f3d4,'attributes':_0x369cc1}),await this['currentInteraction']['start'](),this['chatContext']['addToConversationContext'](this['currentInteraction']['contextItems']);}catch(_0x2b18bf){if(_0x2b18bf instanceof at)this['fire']('error',{'interactionId':this['currentInteraction']?this['currentInteraction']['id']:void 0x0,'error':_0x2b18bf});else{const _0x31edc7=Ps['get'](_0x2b18bf['code'])||'ai-chat-handle-user-interaction-start-failed';this['fire']('error',{'interactionId':this['currentInteraction']?this['currentInteraction']['id']:void 0x0,'error':new at(_0x31edc7,null,{'error':_0x2b18bf})});}}finally{this['currentInteraction']?.['stop'](),this['currentInteraction']=void 0x0;}}['createInteraction']({userMessage:_0x57dfe3,contextItems:_0x23f6e9,capabilities:_0x1ff7f8,modelId:_0x4638c9,attributes:_0x2e61a9}){const _0x7b1acf=new Bs({'userMessage':_0x57dfe3,'contextItems':_0x23f6e9,'capabilities':_0x1ff7f8,'conversationId':this['id'],'connector':this['connector'],'locale':this['options']['locale'],'model':_0x4638c9,'attributes':_0x2e61a9});return _0x7b1acf['delegate'](...Ls)['to'](this),this['interactions']['push'](_0x7b1acf),this['fire']('interactionCreated',_0x7b1acf),_0x7b1acf;}['getInteraction'](_0x5bc6d5){return this['interactions']['find'](_0x1df34f=>_0x1df34f['id']===_0x5bc6d5);}['removeInteraction'](_0x5ced88){const _0x48a925=this['getInteraction'](_0x5ced88);_0x48a925&&(_0x48a925['destroy'](),this['interactions']['splice'](this['interactions']['indexOf'](_0x48a925),0x1));}get['lastInteraction'](){return this['interactions'][this['interactions']['length']-0x1];}['addCurrentDocumentToContext'](_0x2cc27f){this['chatContext']['addCurrentDocumentToContext'](_0x2cc27f);}async['updateCurrentDocumentInContext']({content:_0x533c9c,version:_0x1912e7,sessionId:_0x3f7732,channelId:_0x3fad75,rootName:_0x45d402,selections:_0x11d083}){await this['chatContext']['updateCurrentDocument'](_0x533c9c,_0x1912e7,_0x3f7732,_0x3fad75,_0x45d402,_0x11d083);}async['updateCurrentDocumentsInContext'](_0x27066b){await this['chatContext']['updateCurrentDocuments'](_0x27066b);}['getSourceByDataId'](_0x1c08cd){return this['chatContext']['getSourceByDataId'](_0x1c08cd);}['getDocumentContextSliceByDataId'](_0x1819b4){return this['chatContext']['getDocumentContextSliceByDataId'](_0x1819b4);}['getCurrentDocumentContext'](){return this['currentInteraction']?.['getDocumentContext']()?.['content']||'';}['addSelectionToContext'](_0x35f727){this['chatContext']['addSelectionToContext'](_0x35f727);}['removeSelectionFromContext'](){this['chatContext']['removeSelectionFromContext']();}['addFilesToContext'](_0x361f4e){this['chatContext']['addFilesToContext'](_0x361f4e);}['addUrlToContext'](_0x4194c2){this['chatContext']['addUrlToContext'](_0x4194c2);}['addToolItemToContext'](_0x2f56de){this['chatContext']['addToolItemToContext'](_0x2f56de);}['addResourceToContext'](_0x4f0fcc,_0x100e6d){this['chatContext']['addResourceToContext'](_0x4f0fcc,_0x100e6d);}['loadSourceResources'](_0x2737ea,_0x482d5f,_0x4e3e3e){return this['chatContext']['loadSourceResources'](_0x2737ea,_0x482d5f,_0x4e3e3e);}['removeFromContext'](_0xd5639f){this['chatContext']['removeFromContext'](_0xd5639f);}['setWebSearch'](_0x5f5556){this['chatCapabilities']['setWebSearch'](_0x5f5556);}['toggleWebSearch'](){this['chatCapabilities']['toggleWebSearch']();}['setReasoning'](_0xc7d4bf){this['chatCapabilities']['setReasoning'](_0xc7d4bf);}['toggleReasoning'](){this['chatCapabilities']['toggleReasoning']();}['isCurrentDocumentInContext'](){return this['chatContext']['isCurrentDocumentInContext']();}['isCurrentDocumentInConversation'](){return this['chatContext']['isCurrentDocumentInConversation']();}['isSelectionInContext'](){return this['chatContext']['isSelectionInContext']();}async['setModel'](_0x5a3efc){_0x5a3efc?!0x1===await this['chatModels']['isAvailable'](_0x5a3efc)&&(It('ai-chat-conversation-set-model-not-available',{'conversation':this,'model':_0x5a3efc}),_0x5a3efc=(await this['chatModels']['getAvailableModels']())[0x0]):(It('ai-chat-conversation-set-model-null',{'conversation':this}),_0x5a3efc=(await this['chatModels']['getAvailableModels']())[0x0]),_0x5a3efc['id']!==this['selectedModel']?.['id']&&(this['selectedModel']=_0x5a3efc,this['chatCapabilities']['reset'](),this['fire']('modelSelected',{'selectedModel':_0x5a3efc}));}}class Fs extends Tt(){['_connector'];['_config'];['_locale'];['_modelList']=[];['_modelsRequest']=null;constructor({connector:_0x4698d0,config:_0x212ff3,locale:_0x5d5a0e}){super(),this['_connector']=_0x4698d0,this['_config']=_0x212ff3,this['_locale']=_0x5d5a0e;}get['_availableModels'](){return this['_config']?.['displayedModels'];}get['_defaultModelId'](){return this['_config']?.['defaultModelId'];}async['getAll'](){return this['_modelsRequest']||(this['_modelsRequest']=this['_retrieveModels']()),this['_modelsRequest'];}async['getAvailableModels'](){const _0x2ec666=await this['getAll']();let _0x2c6393;return _0x2c6393=this['_availableModels']?this['_filterModels'](_0x2ec666,this['_availableModels']):_0x2ec666['filter'](_0x2cb25b=>_0x2cb25b['recommended']),_0x2c6393;}async['getModel'](_0x301819){const _0x3c11b6=await this['getAll']();if(!_0x3c11b6['length'])return null;if(_0x301819){const _0xefce2f=this['_getModelById'](_0x3c11b6,_0x301819);if(_0xefce2f)return _0xefce2f;It('ai-chat-model-id-unrecognized',{'modelId':_0x301819,'fallBackModelId':this['_defaultModelId']});}return this['getDefault']();}async['getDefault'](){const _0x7a3ba8=await this['getAvailableModels']();if(!_0x7a3ba8['length'])return null;if(this['_defaultModelId']){const _0x4b1629=this['_getModelById'](_0x7a3ba8,this['_defaultModelId']);if(_0x4b1629)return _0x4b1629;It('ai-chat-default-model-id-unrecognized',{'defaultModelId':this['_defaultModelId'],'fallBackModelId':_0x7a3ba8[0x0]['id']});}return _0x7a3ba8[0x0];}async['isAvailable'](_0x21f0b){return(await this['getAvailableModels']())['some'](_0x341c86=>_0x341c86['name']===_0x21f0b['name']&&_0x341c86['provider']===_0x21f0b['provider']);}async['_retrieveModels'](){if(!this['_modelList']['length'])try{const _0x52e5dc=this['_locale']['uiLanguage']||'en',_0x685890=this['_connector']['getModels'](_0x52e5dc),_0x430416=await _0x685890['list']();this['_modelList']=_0x430416['items']['map'](_0x511e6d=>Ks(_0x511e6d)?{..._0x511e6d,'name':hs(this['_locale'],'AI_MODEL_NAME_AUTO')}:_0x511e6d);}catch(_0x24c33f){throw Et('ai-models-unable-to-retrieve',{'error':_0x24c33f}),_0x24c33f;}return[...this['_modelList']];}['_filterModels'](_0x2fafe1,_0x1e8396){let _0x1fe9fe;if(_0x1e8396){_0x1fe9fe=[];const _0x4b5ae3=new Set(),_0x10ed16='string'==typeof _0x1e8396?[_0x1e8396['toLocaleLowerCase']()]:_0x1e8396['map'](_0x50f2ad=>_0x50f2ad['toLocaleLowerCase']());for(const _0x282fa9 of _0x10ed16)for(const _0x1e06ca of _0x2fafe1)!_0x4b5ae3['has'](_0x1e06ca['id'])&&this['_isMatchingFilter'](_0x1e06ca,_0x282fa9)&&(_0x1fe9fe['push'](_0x1e06ca),_0x4b5ae3['add'](_0x1e06ca['id']));}else _0x1fe9fe=_0x2fafe1;return _0x1fe9fe;}['_isMatchingFilter'](_0x14f99b,_0x4d5c84){const _0x597ce2=_0x14f99b['id']['toLocaleLowerCase'](),_0x3ba4e1=_0x14f99b['name']['toLocaleLowerCase'](),_0x18f995=_0x14f99b['provider']['toLocaleLowerCase']();return _0x597ce2===_0x4d5c84||_0x3ba4e1===_0x4d5c84||Ks(_0x14f99b)&&'auto'===_0x4d5c84||_0x18f995===_0x4d5c84||_0x597ce2['startsWith'](_0x4d5c84);}['_getModelById'](_0x13d7f5,_0x14948d){return _0x13d7f5['find'](_0x271c78=>Ks(_0x271c78)&&'auto'===_0x14948d?_0x271c78:_0x271c78['id']===_0x14948d)||null;}}function Ks(_0x40e1a7){return _0x40e1a7['id']['startsWith']('agent');}function Ws(_0x36367c){return _0x36367c?_0x36367c instanceof _0x2ef8df?[_0x36367c]:_0x36367c['editors']&&0x0!==_0x36367c['editors']['length']?Array['from'](_0x36367c['editors']):[]:[];}function Ys(_0x29defd){const _0x2f4b4d=Ws(_0x29defd);if(!_0x2f4b4d['length'])throw new at('ai-get-editor-from-context-no-editor');if(0x1===_0x2f4b4d['length'])return _0x2f4b4d[0x0];const _0x1701f1=_0x2f4b4d['find'](_0x399a34=>_0x399a34['ui']?.['focusTracker']?.['isFocused']);if(_0x1701f1)return _0x1701f1;const _0x475372=function(_0x82f49){if(_0x82f49 instanceof _0x2ef8df)return;const _0x460da7=_0x82f49;if(!_0x460da7['plugins']||!_0x460da7['plugins']['has']('AIEditing'))return;const _0x3c7a42=_0x460da7['plugins']['get']('AIEditing');return _0x3c7a42['getLastContentFocusedEditor']?.();}(_0x29defd);return _0x475372&&_0x2f4b4d['includes'](_0x475372)?_0x475372:_0x2f4b4d[0x0];}function $s(_0x3b5ed8){return Ys(_0x3b5ed8);}function qs({editor:_0x4b33b3,interaction:_0x39b4ff,reply:_0x418232,groups:_0x596b1f,transform:_0x2b4950,documentCompare:_0x4639de,documentCompareOptions:_0x173b74,documentContextSlice:_0x1dd824}){const _0x1eca0a=_0x39b4ff['getDocumentContext']();if(!_0x1eca0a)return[];const _0x179fd0=_0x418232['documentContextContent']['cloneNode'](!0x0);for(const {changes:_0x4941a3}of _0x596b1f){const _0x5bb84a=_0x4941a3['filter'](_0x13a969=>'new'!=_0x13a969['type'])['map'](_0x156e76=>As('data-id',_0x156e76['id'],_0x179fd0)),_0x33cce3=_0x4941a3['filter'](_0x48790d=>'removed'!=_0x48790d['type'])['map'](_0x3a3998=>_0x3a3998['node']['cloneNode'](!0x0));let _0x55e61a=null;if(_0x5bb84a['length']){_0x55e61a=_0x5bb84a[0x0]['previousSibling'];for(let _0xc19542=0x0;_0xc19542<_0x5bb84a['length'];_0xc19542++)_0x5d78f4(_0x5bb84a[_0xc19542]);}if(_0x33cce3['length']){_0x55e61a||(_0x4941a3[0x0]['anchorId']?_0x55e61a=As('data-id',_0x4941a3[0x0]['anchorId'],_0x179fd0):(_0x55e61a=_0x33cce3['shift'](),_0x288fde(_0x179fd0,_0x55e61a)));for(let _0x11f76b=0x0;_0x11f76b<_0x33cce3['length'];_0x11f76b++)_0x188752(_0x55e61a,_0x33cce3[_0x11f76b]),_0x55e61a=_0x33cce3[_0x11f76b];}}let _0x358fad,_0x1441af,_0x3109f4,_0x428795=_0x173b74;if(_0x1dd824){_0x358fad=_0x1dd824['html'],_0x3109f4=_0x1dd824['version'],_0x428795={..._0x173b74,'anchor':_0x1dd824['rootName']};const _0x800778=new _0x290fcd([]),_0xc10a08=_0x179fd0['children'],_0x26eca8=_0x418232['dataIdDocumentSources'],_0x5efd94=_0x418232['newNodeAnchorIds'],_0x531b2a=_0x1dd824['editor'],_0x322ee8=_0x1dd824['rootName'],_0x474b3f=new Array(_0xc10a08['length']),_0x4e3c3b=_0x166653=>_0x166653?_0x166653['editor']===_0x531b2a&&_0x166653['rootName']===_0x322ee8:void 0x0;for(let _0x27bb38=0x0;_0x27bb38<_0xc10a08['length'];_0x27bb38++){const _0x251681=Es(_0xc10a08[_0x27bb38],'data-id');if(!_0x251681)continue;const _0x466a89=_0x4e3c3b(_0x26eca8?.['get'](_0x251681));if(void 0x0!==_0x466a89){_0x474b3f[_0x27bb38]=_0x466a89;continue;}const _0x33066e=_0x5efd94['get'](_0x251681),_0x2f0222=_0x33066e?_0x4e3c3b(_0x26eca8?.['get'](_0x33066e)):void 0x0;void 0x0!==_0x2f0222&&(_0x474b3f[_0x27bb38]=_0x2f0222);}for(let _0x57277d=0x0;_0x57277d<_0xc10a08['length'];_0x57277d++)if(void 0x0===_0x474b3f[_0x57277d]){for(let _0x3e3783=_0x57277d-0x1;_0x3e3783>=0x0;_0x3e3783--)if(void 0x0!==_0x474b3f[_0x3e3783]){_0x474b3f[_0x57277d]=_0x474b3f[_0x3e3783];break;}if(void 0x0===_0x474b3f[_0x57277d]){for(let _0x3ecebf=_0x57277d+0x1;_0x3ecebf<_0xc10a08['length'];_0x3ecebf++)if(void 0x0!==_0x474b3f[_0x3ecebf]){_0x474b3f[_0x57277d]=_0x474b3f[_0x3ecebf];break;}}}for(let _0x51b750=0x0;_0x51b750<_0xc10a08['length'];_0x51b750++)_0x474b3f[_0x51b750]&&_0x800778['children']['push'](_0x2cb1ed(_0xc10a08[_0x51b750],!0x0));_0x1441af=gs(_0x800778);}else _0x358fad=_0x1eca0a['content'],_0x3109f4=_0x1eca0a['version'],_0x1441af=gs(_0x179fd0);const _0xecc955=_0x4639de['getDiff'](_0x358fad,_0x1441af,{..._0x428795,'targetEditor':_0x4b33b3})['getOperations']();if(_0x2b4950){const _0x27863c=_0x4b33b3['model']['document']['history']['getOperations'](_0x3109f4),_0x2b5cc4={'document':_0x4b33b3['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1};return _0x261504(_0xecc955,_0x27863c,_0x2b5cc4)['operationsA'];}return _0xecc955;}function Qs(_0xd5cd1,_0x250b73){if('marker'!=_0x250b73['type'])return;const _0x347a13=_0xd5cd1['model']['markers']['get'](_0x250b73['name']);_0x347a13&&(_0x250b73['oldRange']=_0x347a13['getRange']());}class Xs extends _0x173dbd{['activeConversation'];['_aiEditing'];['_aiConnector'];['_aiChatUi'];['_aiChatModels'];['_aiChatBalloon'];['_activeBalloon'];['_wiredBalloons']=new Set();['_batchToChanges']=new Map();['_currentPreviewedChangeGroup']=null;['_bodyCollection'];static get['requires'](){return[as,_0x47efd0];}static get['pluginName'](){return'AIChatController';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){this['_bodyCollection']=new Qt(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_aiConnector']=this['context']['plugins']['get']('AIConnector'),this['_aiChatUi']=this['context']['plugins']['get']('AIChatUI'),this['_aiEditing']=this['context']['plugins']['get']('AIEditing'),this['_aiChatModels']=new Fs({'connector':this['_aiConnector'],'config':this['context']['config']['get']('ai.models'),'locale':this['context']['locale']});const _0x552ada=this['context']['plugins']['get']('AITabs');this['listenTo'](this['_aiChatUi'],'startConversation',()=>{this['_startConversationSafely']();}),this['listenTo'](this['_aiChatUi'],'sendUserMessage',(_0x2044c6,_0x523a19)=>{this['_handleUIUserMessage']({'message':_0x523a19});}),this['listenTo'](_0x552ada['view'],'change:activeTab',(_0x172a52,_0x29c252,_0x42b9ad)=>{'chat'!==_0x42b9ad&&this['removeSelectionFromChatContext']();}),this['listenTo'](this['_aiChatUi'],'abortPromptStream',async()=>{await this['_stopLastInteraction'](),await this['_flushLastInteractionUI'](),this['removeSelectionFromChatContext']();}),this['listenTo'](this['_aiChatUi'],'addDocumentToContext',()=>{this['addCurrentDocumentToChatContext']();}),this['listenTo'](this['_aiChatUi'],'addFileToContext',(_0x3b5f5a,_0x38ee3e)=>{this['activeConversation']?.['addFilesToContext'](Array['from'](_0x38ee3e));}),this['listenTo'](this['_aiChatUi'],'addUrlToContext',(_0x18a781,_0x21f9a7)=>{this['activeConversation']?.['addUrlToContext'](_0x21f9a7);}),this['listenTo'](this['_aiChatUi'],'executeCustomItemCallback',(_0x1302c7,_0x38e144)=>{_0x38e144['callback'](this['context']);}),this['listenTo'](this['_aiChatUi'],'addResourceToContext',(_0x22d5a2,_0x3ff925)=>{this['activeConversation']?.['addResourceToContext'](_0x3ff925['source'],_0x3ff925['resource']);}),this['listenTo'](this['_aiChatUi'],'removeContextItem',(_0x4b2027,_0x46d0e3)=>{this['_removeFromContext'](_0x46d0e3);}),this['listenTo'](this['_aiChatUi'],'loadSourceResources',(_0x5a60c0,_0x3e29c)=>{this['activeConversation']?.['loadSourceResources'](_0x3e29c['sourceId'],_0x3e29c['query'],_0x3e29c['uid']);}),this['listenTo'](this['_aiChatUi'],'toggleWebSearch',()=>{this['_toggleWebSearch']();}),this['listenTo'](this['_aiChatUi'],'toggleReasoning',()=>{this['_toggleReasoning']();}),this['listenTo'](this['_aiChatUi'],'selectModel',(_0x1dce75,_0x34de65)=>{this['activeConversation']?.['setModel'](_0x34de65);}),this['listenTo'](this['_aiChatUi'],'like',(_0x2307fa,{replyId:_0x35263c})=>{console['log']('Liked\x20response',_0x35263c);}),this['listenTo'](this['_aiChatUi'],'dislike',(_0x37801a,{replyId:_0x421987})=>{console['log']('Disliked\x20response',_0x421987);}),this['listenTo'](this['_aiChatUi'],'insertSuggestion',(_0x1ddbe3,_0x3c9289)=>{this['_insertSuggestion'](_0x3c9289);}),this['listenTo'](this['_aiChatUi'],'showChangeInText',(_0x7fa872,{replyId:_0x26ee7f,partIndex:_0x196bb5})=>{this['_aiChatBalloonShowDiff']=this['_aiChatUi']['showDiff'],this['_openBalloonFor'](_0x26ee7f,_0x196bb5);}),this['listenTo'](this['_aiChatUi'],'mouseOverSuggestion',(_0x10e801,{replyId:_0xfdc720,partIndex:_0x57cd2b})=>{const _0x487048=this['_getDocumentRangeForReplyChanges'](_0xfdc720,_0x57cd2b);_0x487048&&'$graveyard'!=_0x487048['range']['root']['rootName']&&this['_aiEditing']['showFakeVisualSelection']({'ranges':[_0x487048['range']],'id':'change-area','priority':0xa});}),this['listenTo'](this['_aiChatUi'],'mouseLeaveSuggestion',()=>{this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['listenTo'](this['_aiChatUi'],'applySuggestion',(_0x61572,_0x961dfe)=>{this['_aiEditing']['hideFakeVisualSelection']('change-area'),this['_applySuggestion'](_0x961dfe);}),this['listenTo'](this['_aiChatUi'],'toggleSuggestionDisplayMode',async(_0x30000c,{replyId:_0x26a69d,showDiff:_0x1e09c6})=>{const {reply:_0x1b59ff}=this['getInteractionAndReplyById'](_0x26a69d),_0x45c5e6=_0x1b59ff['getContentParts']({'showDiff':_0x1e09c6,'editor':$s(this['context'])});await this['_aiChatUi']['updateFeedItemAIReplySuggestionContent']({'id':_0x1b59ff['id'],'parts':_0x45c5e6});}),this['listenTo'](this['_aiChatUi'],'rejectSuggestion',(_0x39493e,{replyId:_0xe41c16,partIndex:_0x11d2f2})=>{this['_rejectSuggestion']({'replyId':_0xe41c16,'partIndex':_0x11d2f2}),this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['set']('_aiChatBalloonShowDiff',!0x1),this['context']['plugins']['has']('AIChatBalloon')&&(this['_aiChatBalloon']=this['context']['plugins']['get']('AIChatBalloon')),this['on']('interactionCreated',(_0x17405a,_0x3494df)=>{this['_aiChatUi']['addFeedItemUserMessage'](_0x3494df);}),this['on']('replyCreated',(_0x15d2e9,_0x5afc64)=>{this['_addFeedItemReply'](_0x5afc64);});}async['afterInit'](){this['context']instanceof _0x2ef8df?this['_integrateEditor'](this['context']):this['listenTo'](this['context']['editors'],'add',(_0xf541aa,_0x2540a6)=>{_0x2540a6['on']('ready',()=>{this['_integrateEditor'](_0x2540a6);});});const _0x196e64=this['context']['config']['get']('ai.chat.initialConversation');let _0x3a1c94=_0x196e64;if('lastCreated'!=_0x196e64||(_0x3a1c94=await this['_getLastCreatedConversationId'](),_0x3a1c94))return'new'==_0x3a1c94?this['_startConversationSafely']():this['loadConversation'](_0x3a1c94);}async['destroy'](){return await this['_stopLastInteraction'](),this['_bodyCollection']['detachFromDom'](),super['destroy']();}async['loadConversation'](_0x55791f){this['_activeBalloon']?.['close'](),this['_activeBalloon']=void 0x0,this['_currentPreviewedChangeGroup']=null,(this['context']['plugins']['get'](os)['view']['activateTab']('chat'),this['_aiChatUi']['setFeedItemRenderingStrategy']('static'),this['_aiChatUi']['toggleLoadingSkeleton'](!0x0),await this['_stopLastInteraction']());try{await this['_aiConnector']['fetchConversation'](_0x55791f)['getConversation'](),await this['_startConversationSafely']({'id':_0x55791f}),this['_updateConversationTitle']('\x20'),await this['activeConversation']['load'](_0x55791f,this['_aiEditing']['sessionId']),this['activeConversation']['isCurrentDocumentInConversation']()&&this['addCurrentDocumentToChatContext']();}catch(_0x51d576){this['_aiChatUi']['addFeedItemError']({'errorMessage':hs(this['context']['locale'],'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION'),'id':_0x55791f}),this['_logError'](new at('ai-chat-conversation-not-found',this,{'error':_0x51d576}));}finally{this['_aiChatUi']['startAutoScroll']({'smooth':!0x1}),this['_aiChatUi']['setFeedItemRenderingStrategy']('streaming'),this['_aiChatUi']['toggleLoadingSkeleton'](!0x1);}}['registerToolDataCallback'](_0x2cc278){let _0x3b0df1=null,_0x5a6dd2=null;this['on']('toolDataReceived',(_0x37f31d,_0x4f7c5d,_0x3af27a)=>{_0x3af27a['id']!==_0x3b0df1&&(_0x3b0df1=_0x3af27a['id'],_0x5a6dd2=this['_getAIChatFeedAPI'](_0x3af27a)),_0x2cc278(_0x4f7c5d,_0x5a6dd2);});}['addCurrentDocumentToChatContext'](){this['activeConversation']?.['addCurrentDocumentToContext'](hs(this['context']['locale'],'AI_CHAT_CONTEXT_CURRENT_DOCUMENT'));}async['addSelectionToChatContext'](){const _0x464801=this['_aiEditing']['getSelectionText']();this['activeConversation']?.['addSelectionToContext'](_0x464801),this['addCurrentDocumentToChatContext']();}['removeSelectionFromChatContext'](){this['activeConversation']?.['removeSelectionFromContext']();}['focusPromptInput'](){this['_aiChatUi']['focusPromptInput']();}async['startConversation'](_0x48f774){await this['_startConversationSafely']({'modelId':_0x48f774?.['modelId']});}async['sendMessage'](_0x4b019d){await this['_handleUIUserMessage'](_0x4b019d);}['getGroupId'](){const _0xdf14c8=this['context']['config']['get']('collaboration.channelId');if(!_0xdf14c8)throw new at('ai-missing-channel-id',this);return _0xdf14c8;}['_handleRemovedConversation'](_0x5b4c8e){this['activeConversation']['id']===_0x5b4c8e&&this['_startConversationSafely']();}['_insertSuggestion'](_0x2e21f4){const _0x116e7a=this['context']['plugins']['get']('DocumentCompare'),{reply:_0x59e058,interaction:_0x174223}=this['getInteractionAndReplyById'](_0x2e21f4['replyId']),_0x1232be=void 0x0!==_0x2e21f4['partIndex']?[_0x59e058['changeGroups'][_0x2e21f4['partIndex']]]:_0x59e058['changeGroups']['filter'](_0x994c91=>'pending'==_0x994c91['state']);for(const _0x4ef91e of this['_groupChangesByTarget'](_0x59e058,_0x1232be)){const {target:_0x2c779c,groups:_0x4e078d,groupsIndexes:_0x4d1676,slice:_0x430c82}=_0x4ef91e;if(!_0x2c779c['editor']['plugins']['has']('TrackChanges'))throw new at('ai-no-track-changes',null);const _0x105857=this['_getDocumentRangeForReplyChanges'](_0x2e21f4['replyId'],_0x4d1676[0x0]);if(!_0x105857||'$graveyard'==_0x105857['range']['root']['rootName']){_0x4d1676['forEach'](_0x392577=>_0x59e058['setChangeGroupState'](_0x392577,'outdated'));continue;}_0x4d1676['forEach'](_0x4c25e7=>_0x59e058['setChangeGroupState'](_0x4c25e7,'accepted'));const _0x39728a=qs({'editor':_0x2c779c['editor'],'reply':_0x59e058,'interaction':_0x174223,'groups':_0x4e078d,'transform':!0x0,'documentCompare':_0x116e7a,'documentCompareOptions':{'anchor':_0x430c82?.['rootName']??'main','markDeletions':!0x0},'documentContextSlice':_0x430c82});let _0xdfa5c;this['_scrollToSuggestionRange'](_0x105857['range'],!0x1,_0x2c779c['editor']),_0x2c779c['editor']['model']['change'](_0x39d8c7=>{_0xdfa5c=_0x39d8c7['batch'],_0x2c779c['editor']['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x39728a),this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['_batchToChanges']['set'](_0xdfa5c,{'interactionId':_0x174223['id'],'replyId':_0x59e058['id'],'indexes':_0x4d1676['slice']()});}this['_updateRatings'](_0x59e058);}['_applySuggestion'](_0x2dafcd){const _0x95f881=this['context']['plugins']['get'](_0x47efd0),{reply:_0x3921d7,interaction:_0x2ef25b}=this['getInteractionAndReplyById'](_0x2dafcd['replyId']),_0x275c7e=void 0x0!==_0x2dafcd['partIndex']?[_0x3921d7['changeGroups'][_0x2dafcd['partIndex']]]:_0x3921d7['changeGroups']['filter'](_0x48134f=>'pending'==_0x48134f['state']);for(const _0x509035 of this['_groupChangesByTarget'](_0x3921d7,_0x275c7e)){const {target:_0x457194,groups:_0x41b677,groupsIndexes:_0x4504f6,slice:_0x253f34}=_0x509035,_0x4f13a2=this['_getDocumentRangeForReplyChanges'](_0x2dafcd['replyId'],_0x4504f6[0x0]);if(!_0x4f13a2||'$graveyard'==_0x4f13a2['range']['root']['rootName']){_0x4504f6['forEach'](_0xa1f5bf=>_0x3921d7['setChangeGroupState'](_0xa1f5bf,'outdated'));continue;}_0x4504f6['forEach'](_0x44dcbc=>_0x3921d7['setChangeGroupState'](_0x44dcbc,'accepted'));const _0x521bb9=qs({'editor':_0x457194['editor'],'reply':_0x3921d7,'interaction':_0x2ef25b,'groups':_0x41b677,'transform':!0x0,'documentCompare':_0x95f881,'documentCompareOptions':{'anchor':_0x253f34?.['rootName']??'main','markDeletions':!0x1},'documentContextSlice':_0x253f34});let _0x11e23b;this['_scrollToSuggestionRange'](_0x4f13a2['range'],!0x1,_0x457194['editor']),_0x457194['editor']['model']['change'](_0x1d340e=>{_0x11e23b=_0x1d340e['batch'];for(const _0x5d769e of _0x521bb9)_0x5d769e['baseVersion']=_0x457194['editor']['model']['document']['version'],Qs(_0x457194['editor'],_0x5d769e),_0x1d340e['batch']['addOperation'](_0x5d769e),_0x457194['editor']['model']['applyOperation'](_0x5d769e);}),this['_batchToChanges']['set'](_0x11e23b,{'interactionId':_0x2ef25b['id'],'replyId':_0x3921d7['id'],'indexes':_0x4504f6['slice']()});}this['_updateRatings'](_0x3921d7);}['_rejectSuggestion'](_0x4b5976){const {reply:_0x4e9d54}=this['getInteractionAndReplyById'](_0x4b5976['replyId']);_0x4e9d54['setChangeGroupState'](_0x4b5976['partIndex'],'rejected');}['_openBalloonFor'](_0x1a0784,_0x538993){if(!this['_aiChatBalloon'])return;const {reply:_0x45d5bb}=this['getInteractionAndReplyById'](_0x1a0784),_0x327e44=_0x45d5bb['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff'],'editor':$s(this['context'])});let _0x5278e5,_0x4e9539;if(void 0x0!==_0x538993?(_0x4e9539=_0x327e44['find'](_0x2e2d78=>_0x2e2d78['index']==_0x538993),_0x5278e5=_0x4e9539?.['index']):(_0x4e9539=_0x327e44[0x0],_0x5278e5=_0x4e9539['index']),this['_currentPreviewedChangeGroup']?.['replyId']==_0x1a0784&&this['_currentPreviewedChangeGroup']?.['partIndex']==_0x5278e5)return;const _0xcbbad3=this['_getUserPresentableContentPartDocumentRange'](_0x1a0784,_0x45d5bb,_0x4e9539),_0x419a9c=_0x45d5bb['changeGroups']['find'](_0x59a211=>_0x59a211['index']==_0x5278e5),_0x10b421=_0x419a9c?this['_resolveGroupTarget'](_0x45d5bb,_0x419a9c):null,_0x21cb35=_0x10b421?.['editor']??$s(this['context']),_0xaf651a=_0x21cb35['plugins']['has']('AIChatBalloon')?_0x21cb35['plugins']['get']('AIChatBalloon'):this['_aiChatBalloon'];if(this['_activeBalloon']&&this['_activeBalloon']!==_0xaf651a&&this['_activeBalloon']['close'](),!_0xcbbad3)return _0xaf651a['close'](),void(this['_activeBalloon']=void 0x0);this['_activeBalloon']=_0xaf651a,this['_currentPreviewedChangeGroup']={'replyId':_0x1a0784,'partIndex':_0x5278e5},this['_scrollToSuggestionRange'](_0xcbbad3,!0x0,_0x21cb35);const _0x15c952=this['_getPresentableSiblingContentPartIndex'](_0x1a0784,_0x5278e5,'next');_0xaf651a['updateContent']({'part':_0x4e9539,'renderingStrategy':'static'}),_0xaf651a['open']({'index':_0x5278e5,'title':hs(this['context']['locale'],'AI_BALLOON_HEADER_TITLE',(_0x5278e5+0x1)['toString']()),'showRotator':null!==_0x15c952,'ranges':[_0xcbbad3],'areActionsDisabled':_0x45d5bb['areActionsDisabled'],'targetEditor':_0x21cb35}),_0xaf651a['setState']('pending'),this['_aiChatUi']['scrollFeedToSuggestion'](_0x1a0784,_0x5278e5),this['_aiChatUi']['setFeedItemAIReplySuggestionPartActive']({'id':_0x1a0784,'index':_0x5278e5,'isActive':!0x0});}['_getPresentableSiblingContentPartIndex'](_0x1fed89,_0x4a796a,_0x2f6e6a){const {reply:_0x44452d}=this['getInteractionAndReplyById'](_0x1fed89),_0x4fbe59=_0x44452d['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff'],'editor':$s(this['context'])});if(0x1==_0x4fbe59['length'])return null;const _0x101497=_0x4fbe59['findIndex'](_0xe2209e=>_0xe2209e['index']==_0x4a796a),_0x29aed4='next'==_0x2f6e6a?0x1:-0x1;let _0x3df88c=_0x4fbe59['at']((_0x101497+_0x29aed4)%_0x4fbe59['length'])['index'],_0x22d00c=_0x4fbe59[_0x3df88c];for(;!this['_getUserPresentableContentPartDocumentRange'](_0x1fed89,_0x44452d,_0x22d00c);){if(_0x3df88c=_0x4fbe59['at']((_0x3df88c+_0x29aed4)%_0x4fbe59['length'])['index'],_0x3df88c===_0x101497)return null;_0x22d00c=_0x4fbe59[_0x3df88c];}return _0x3df88c;}['_getUserPresentableContentPartDocumentRange'](_0x14ce5a,_0x9b01de,_0xd4f4a3){const _0x4726b9=_0x9b01de['changeGroups'];if(!_0xd4f4a3['hasChanges'])return null;const _0xe893da=_0x4726b9['find'](_0x577fcb=>_0x577fcb['index']==_0xd4f4a3['index']);if('pending'!==_0xe893da?.['state'])return null;const _0x21ab11=this['_getDocumentRangeForReplyChanges'](_0x14ce5a,_0xd4f4a3['index']);if(!_0x21ab11)return _0x9b01de['setChangeGroupState'](_0xd4f4a3['index'],'outdated'),null;const {range:_0x50b2ba,currentIndex:_0x2a0aeb}=_0x21ab11;return'$graveyard'==_0x50b2ba['root']['rootName']?(_0x9b01de['setChangeGroupState'](_0x2a0aeb,'outdated'),null):_0x21ab11['range'];}['_getDocumentRangeForReplyChanges'](_0x3c0e59,_0x48ff34){const {reply:_0x3a0c75}=this['getInteractionAndReplyById'](_0x3c0e59),_0x2baaa8=_0x3a0c75['changeGroups']['filter'](_0x3bf510=>'pending'==_0x3bf510['state']),_0x37c294=_0x2baaa8['map'](_0x34c647=>_0x3a0c75['changeGroups']['indexOf'](_0x34c647));void 0x0===_0x48ff34&&(_0x48ff34=_0x37c294[0x0]);const _0x668bd6=_0x37c294['indexOf'](_0x48ff34);if(-0x1==_0x668bd6)return null;const _0x199fe7=_0x2baaa8[_0x668bd6],_0x1409a7=this['_resolveGroupTarget'](_0x3a0c75,_0x199fe7);if(!_0x1409a7)return null;const {editor:_0x6cd7a7,root:_0x2650ca,parsedDocumentContent:_0x40bd40,serializedDocumentContent:_0x46ecea,version:_0x4c2d6f}=_0x1409a7,_0x3d7ab1=new _0x290fcd([]),_0x2f571b=new _0x290fcd([]);for(const _0xa89ca8 of _0x199fe7['changes']){const _0x59b587=this['activeConversation']?.['getSourceByDataId'](_0xa89ca8['id']);if((!_0x59b587||_0x59b587['editor']===_0x1409a7['editor']&&_0x59b587['rootName']===_0x1409a7['root']['rootName'])&&('removed'!=_0xa89ca8['type']&&_0x2f571b['children']['push'](_0xa89ca8['node']['cloneNode'](!0x0)),'new'!=_0xa89ca8['type'])){const _0x107e75=_0x4f11c1(_0x3db357=>Es(_0x3db357,'data-id')==_0xa89ca8['id'],_0x40bd40,!0x0);if(!_0x107e75)return null;_0x3d7ab1['children']['push'](_0x107e75['cloneNode'](!0x0));}}if(0x0==_0x3d7ab1['children']['length']){if(_0x199fe7['changes'][0x0]['anchorId']){const _0xdf5593=As('data-id',_0x199fe7['changes'][0x0]['anchorId'],_0x40bd40);_0x3d7ab1['children']['unshift'](_0xdf5593['cloneNode'](!0x0)),_0x2f571b['children']['unshift'](_0xdf5593['cloneNode'](!0x0)),_0xdf5593['nextSibling']&&(_0x3d7ab1['children']['push'](_0xdf5593['nextSibling']['cloneNode'](!0x0)),_0x2f571b['children']['push'](_0xdf5593['nextSibling']['cloneNode'](!0x0)));}else{const _0x5990ef=_0x40bd40['children'][0x0];if(!_0x5990ef)return null;_0x3d7ab1['children']['push'](_0x5990ef['cloneNode'](!0x0)),_0x2f571b['children']['push'](_0x5990ef['cloneNode'](!0x0));}}const _0x53e7a0=_0x6cd7a7['data']['parse'](_0x46ecea),_0x463f06=gs(_0x3d7ab1),_0x4790fe=_0x6cd7a7['data']['parse'](_0x463f06),_0x232153=_0x6cd7a7['data']['parse'](_0x463f06),_0x58022a=_0x6cd7a7['model']['createPositionAt'](_0x4790fe,0x0),_0xb13653=gs(_0x2f571b),_0x192073={'targetEditor':_0x6cd7a7,'anchor':_0x58022a,'markDeletions':!0x1},_0x215a3a=_0x6cd7a7['plugins']['get'](_0x47efd0)['getDiff'](_0x463f06,_0xb13653,_0x192073)['getOperations']();if(!_0x215a3a['length'])return null;_0x6cd7a7['model']['change'](_0x2ff3fd=>{for(const _0x646d7a of _0x215a3a)if('remove'==_0x646d7a['type']){const _0x8daea4=_0x646d7a['sourcePosition'],_0x4031c2=_0x646d7a['howMany'],_0x54a6d7=new _0x48a283(_0x8daea4,_0x4031c2);_0x2ff3fd['batch']['addOperation'](_0x54a6d7),_0x6cd7a7['model']['applyOperation'](_0x54a6d7);}else'marker'!==_0x646d7a['type']&&(_0x646d7a['baseVersion']=null,_0x646d7a['isDocumentOperation']=!0x1,_0x2ff3fd['batch']['addOperation'](_0x646d7a),_0x6cd7a7['model']['applyOperation'](_0x646d7a));});const _0x1533fd=ks(_0x6cd7a7,_0x215a3a,_0x4790fe);Ns(_0x6cd7a7['model'],_0x1533fd);const _0x32d09c=_0x1533fd['getFirstRange']()['start']['path']['slice'](),_0x427ce5=_0x1533fd['getFirstRange']()['end']['path']['slice'](),_0x1b1877=[];let _0x30eb01=_0x4790fe,_0x5d2814=_0x232153;for(let _0x728772=0x0;_0x728772<_0x427ce5['length'];_0x728772++){const _0x2eabf0=_0x30eb01['maxOffset']-_0x427ce5[_0x728772];_0x1b1877[_0x728772]=_0x5d2814['maxOffset']-_0x2eabf0,_0x30eb01=_0x30eb01['getChildAtOffset'](_0x427ce5[_0x728772]),_0x5d2814=_0x5d2814['getChildAtOffset'](_0x1b1877[_0x728772]);}const _0x4d3acf=_0x6cd7a7['model']['createRange'](_0x6cd7a7['model']['createPositionFromPath'](_0x232153,_0x32d09c),_0x6cd7a7['model']['createPositionFromPath'](_0x232153,_0x1b1877)),_0x3e979e=_0x232153['getChild'](0x0)['getAttribute'](_0x138817),_0x4f03d1=Array['from'](_0x53e7a0['getChildren']())['find'](_0x5a93f7=>_0x5a93f7['getAttribute'](_0x138817)==_0x3e979e)['getPath'](),_0x1bc06a=_0x4d3acf['start']['path']['slice'](),_0x401263=_0x4d3acf['end']['path']['slice']();_0x1bc06a[0x0]=_0x4f03d1[0x0]+_0x1bc06a[0x0],_0x401263[0x0]=_0x4f03d1[0x0]+_0x401263[0x0];let _0x54c8a3=_0x6cd7a7['model']['createRange'](_0x6cd7a7['model']['createPositionFromPath'](_0x2650ca,_0x1bc06a),_0x6cd7a7['model']['createPositionFromPath'](_0x2650ca,_0x401263));const _0x77601e=_0x6cd7a7['model']['document']['history']['getOperations'](_0x4c2d6f);for(const _0x11ff8a of _0x77601e)_0x54c8a3=_0x5ca4e8['_createFromRanges'](_0x54c8a3['getTransformedByOperation'](_0x11ff8a));return{'range':_0x54c8a3,'currentIndex':_0x48ff34};}['_integrateEditorBalloon'](_0x3999fb){if(!_0x3999fb['plugins']['has']('AIChatBalloon'))return;const _0x531fa0=_0x3999fb['plugins']['get']('AIChatBalloon');this['_wiredBalloons']['has'](_0x531fa0)||(this['_wiredBalloons']['add'](_0x531fa0),this['_aiChatBalloon']||(this['_aiChatBalloon']=_0x531fa0),_0x531fa0['bind']('showDiff')['to'](this,'_aiChatBalloonShowDiff'),this['listenTo'](_0x531fa0,'toggleSuggestionDisplayMode',()=>{const {replyId:_0x435970,partIndex:_0x25ef84}=this['_currentPreviewedChangeGroup'];this['_aiChatBalloonShowDiff']=!this['_aiChatBalloonShowDiff'];const {reply:_0x840ace}=this['getInteractionAndReplyById'](_0x435970),_0x15c033=_0x840ace['changeGroups']['find'](_0x545318=>_0x545318['index']===_0x25ef84),_0x3c6073=_0x15c033?this['_resolveGroupTarget'](_0x840ace,_0x15c033):null,_0x5b849c=_0x840ace['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff'],'groupIndex':_0x25ef84,'editor':_0x3c6073?.['editor']??$s(this['context'])});(this['_activeBalloon']??_0x531fa0)['updateContent']({'part':_0x5b849c[0x0],'renderingStrategy':'static','keepErrors':!0x0});}),this['listenTo'](_0x531fa0,'applySuggestion',()=>{const {replyId:_0x912015,partIndex:_0x2d3b59}=this['_currentPreviewedChangeGroup'];this['_applySuggestion']({'replyId':_0x912015,'partIndex':_0x2d3b59}),(this['_activeBalloon']??_0x531fa0)['setState']('accepted');}),this['listenTo'](_0x531fa0,'insertSuggestion',()=>{const {replyId:_0x1a19ba,partIndex:_0x58cad0}=this['_currentPreviewedChangeGroup'];this['_insertSuggestion']({'replyId':_0x1a19ba,'partIndex':_0x58cad0}),(this['_activeBalloon']??_0x531fa0)['setState']('accepted');}),this['listenTo'](_0x531fa0,'rejectSuggestion',()=>{const {replyId:_0x3e8f5a,partIndex:_0x1491c2}=this['_currentPreviewedChangeGroup'];this['_rejectSuggestion']({'replyId':_0x3e8f5a,'partIndex':_0x1491c2}),(this['_activeBalloon']??_0x531fa0)['setState']('rejected');}),this['listenTo'](_0x531fa0,'showNext',()=>{const {replyId:_0x4ce765,partIndex:_0x17fbfd}=this['_currentPreviewedChangeGroup'],_0x55e468=this['_getPresentableSiblingContentPartIndex'](_0x4ce765,_0x17fbfd,'next');null!==_0x55e468&&this['_openBalloonFor'](_0x4ce765,_0x55e468);}),this['listenTo'](_0x531fa0,'showPrevious',()=>{const {replyId:_0x2ce3e1,partIndex:_0x5ae62b}=this['_currentPreviewedChangeGroup'],_0x26bd75=this['_getPresentableSiblingContentPartIndex'](_0x2ce3e1,_0x5ae62b,'previous');null!==_0x26bd75&&this['_openBalloonFor'](_0x2ce3e1,_0x26bd75);}),this['listenTo'](_0x531fa0,'dialogClosed',(_0x3d0d2f,{id:_0x3e0e6b})=>{if('aiChatBalloon'!==_0x3e0e6b)return;const {replyId:_0x16fbf9,partIndex:_0x2bd6e4}=this['_currentPreviewedChangeGroup'];this['_currentPreviewedChangeGroup']=null,this['_aiChatUi']['setFeedItemAIReplySuggestionPartActive']({'id':_0x16fbf9,'index':_0x2bd6e4,'isActive':!0x1}),this['_activeBalloon']===_0x531fa0&&(this['_activeBalloon']=void 0x0);}));}['_integrateEditor'](_0x178bf1){if(this['_integrateEditorBalloon'](_0x178bf1),_0x178bf1['plugins']['has']('Undo')){const _0xeb407b=_0x178bf1['commands']['get']('undo'),_0x2dd280=_0x178bf1['commands']['get']('redo');this['listenTo'](_0xeb407b,'revert',(_0x1745ac,_0x5bd4f0,_0x32fac3)=>{const _0x295d9d=this['_batchToChanges']['get'](_0x5bd4f0);if(!_0x295d9d)return;const _0x2d6b24=this['activeConversation']['getInteraction'](_0x295d9d['interactionId']),_0x49c416=_0x2d6b24?.['getReply'](_0x295d9d['replyId']);this['_batchToChanges']['delete'](_0x5bd4f0),_0x2d6b24&&_0x49c416&&(_0x295d9d['indexes']['forEach'](_0x23a884=>_0x49c416['setChangeGroupState'](_0x23a884,'pending')),this['_batchToChanges']['set'](_0x32fac3,_0x295d9d));}),this['listenTo'](_0x2dd280,'revert',(_0x5b188a,_0x19a44e,_0x45fd4f)=>{const _0x209ac6=this['_batchToChanges']['get'](_0x19a44e);if(!_0x209ac6)return;const _0x4cfcbf=this['activeConversation']['getInteraction'](_0x209ac6['interactionId']),_0x2a6ed5=_0x4cfcbf?.['getReply'](_0x209ac6['replyId']);this['_batchToChanges']['delete'](_0x19a44e),_0x4cfcbf&&_0x2a6ed5&&(_0x209ac6['indexes']['forEach'](_0x4d8747=>_0x2a6ed5['setChangeGroupState'](_0x4d8747,'accepted')),this['_batchToChanges']['set'](_0x45fd4f,_0x209ac6));});}const _0x3afb42=_0x178bf1['config']['get']('ai.chat.context');_0x3afb42['alwaysAddSelection']&&_0x3afb42['document']['enabled']&&this['listenTo'](_0x178bf1['model']['document']['selection'],'change:range',(_0x5d17d7,_0x23e38b)=>{if(!_0x23e38b['directChange'])return;'chat'===_0x178bf1['plugins']['get']('AITabs')['view']['activeTab']&&(_0x178bf1['model']['hasContent'](_0x178bf1['model']['document']['selection'])?this['addSelectionToChatContext']():this['removeSelectionFromChatContext']());});}async['_getLastCreatedConversationId'](){const _0x5c4d5f=this['_aiConnector']['fetchConversations'](this['getGroupId'](),{'limit':0x1,'sortBy':'createdAt'});try{const _0x33beeb=await _0x5c4d5f['getConversations']();return _0x33beeb['length']?_0x33beeb[0x0]['id']:'new';}catch(_0x179e02){return this['_aiChatUi']['addFeedItemError']({'errorMessage':hs(this['context']['locale'],'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION'),'id':ot()}),this['_logError'](new at('ai-chat-conversation-init-failed',this,{'error':_0x179e02})),this['_aiChatUi']['toggleLoadingSkeleton'](!0x1),this['_aiChatUi']['disableControls'](),null;}}async['_startConversationSafely'](_0x86617={}){try{this['_aiChatUi']['enableControls'](),await this['_handleStartConversation'](_0x86617);}catch(_0x79d77c){this['_aiChatUi']['addFeedItemError']({'errorMessage':hs(this['context']['locale'],'AI_CHAT_UNABLE_TO_START_CONVERSATION'),'id':_0x86617['id']||ot()}),console['error'](_0x79d77c),this['activeConversation']=void 0x0,this['_aiChatUi']['disableControls']();}}async['_handleStartConversation']({id:_0x4e6995,modelId:_0x4f2639}={}){this['_activeBalloon']?.['close'](),this['_activeBalloon']=void 0x0,this['_currentPreviewedChangeGroup']=null;let _0x56a76e=_0x4f2639;_0x56a76e||(_0x4e6995||!this['activeConversation']?_0x56a76e=this['context']['config']['get']('ai.models.defaultModelId'):this['_aiChatUi']['isModelAvailable']&&(_0x56a76e=this['activeConversation']['selectedModel']['id'])),await this['_stopLastInteraction']();const _0x7a1e47=this['getGroupId'](),_0x3aa6f6=_0x4e6995||ot();let _0x435aab;this['activeConversation']=new Gs({'connector':this['_aiConnector'],'chatModels':this['_aiChatModels'],'selectedModelId':_0x56a76e,'conversationId':_0x3aa6f6,'group':_0x7a1e47,'getEditor':()=>$s(this['context']),'getEditors':()=>Ws(this['context']),'locale':this['context']['locale'],'isFromHistory':!!_0x4e6995}),this['activeConversation']['delegate']('toolDataReceived','interactionCreated','interactionStarted','replyCreated')['to'](this),this['activeConversation']['on']('conversationInitialized',(_0x3975ca,_0x190708)=>{this['_aiChatUi']['createConversation'](_0x190708),this['_aiChatUi']['resetMessageInput'](),this['_aiChatUi']['clearPendingContextUI'](),this['_aiChatUi']['clearConversationContextUI'](),_0x4e6995||(this['_aiChatUi']['resetConversationTitle'](),this['addCurrentDocumentToChatContext']());}),this['activeConversation']['on']('uploadProgressChanged',(_0x3a584c,_0x49efcf)=>{this['_aiChatUi']['setIsUploadInProgress'](_0x49efcf['isUploadInProgress']);}),this['activeConversation']['on']('webSearchStarted',()=>{const _0x3a842a=this['_aiChatUi']['prepareLoadingMessage']({'isWebSearchEnabled':!0x0,'isReasoningEnabled':!0x1});this['_aiChatUi']['setLoadingMessage'](_0x3a842a);}),this['activeConversation']['on']('reasoningStarted',()=>{const _0x1ab8a4=this['_aiChatUi']['prepareLoadingMessage']({'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x0});this['_aiChatUi']['setLoadingMessage'](_0x1ab8a4);}),this['activeConversation']['on']('webSearchFinished',(_0x5d268c,_0x130dc8)=>{this['_aiChatUi']['addFeedInteractionHeader'](_0x130dc8,{'isWebSearchEnabled':!0x0,'isReasoningEnabled':!0x1});}),this['activeConversation']['on']('reasoningFinished',(_0x45f087,_0x559b5c)=>{this['_aiChatUi']['addFeedInteractionHeader'](_0x559b5c,{'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x0});}),this['activeConversation']['on']('interactionStarted',()=>{this['_aiChatUi']['startInteraction']();}),this['activeConversation']['on']('interactionFinished',async()=>{this['_updateReplyContentThrottled']['flush'](),await this['_aiChatUi']['finishInteraction']();}),this['activeConversation']['on']('interactionDestroyed',(_0x21c041,_0x3ded36)=>{this['_aiChatUi']['removeFeedInteraction'](_0x3ded36['id']);}),this['activeConversation']['on']('setConversationTitle',(_0x42f014,_0x880f96,_0x3deda4)=>{this['_updateConversationTitle'](_0x880f96,_0x3deda4);}),this['activeConversation']['on']('replyContentUpdated',async(_0x59d3ad,_0x298aae)=>{void 0x0!==_0x435aab&&_0x435aab!==_0x298aae['id']&&this['_updateReplyContentThrottled']['flush'](),_0x435aab=_0x298aae['id'],_0x298aae['isFromHistory']?await this['_updateReplyContent']({'reply':_0x298aae}):await this['_updateReplyContentThrottled']({'reply':_0x298aae});}),this['activeConversation']['on']('replyChangeGroupStateUpdated',(_0x7384f2,{reply:_0x134bb3,index:_0x26dd2f,state:_0x19bc8a})=>{this['_aiChatUi']['updateFeedItemAIReplySuggestionPartState']({'id':_0x134bb3['id'],'index':_0x26dd2f,'state':_0x19bc8a}),this['_currentPreviewedChangeGroup']?.['replyId']['includes'](_0x134bb3['id'])&&this['_currentPreviewedChangeGroup']?.['partIndex']==_0x26dd2f&&(this['_activeBalloon']??this['_aiChatBalloon'])?.['setState'](_0x19bc8a);}),this['activeConversation']['on']('contextItemAdded',(_0x757773,_0x4c88ac)=>{if(this['_aiChatUi']['addContextItem'](_0x4c88ac['contextItem'],_0x4c88ac['isLoading']),'selection'===_0x4c88ac['contextItem']['type']){const _0x3ab3dd=[...$s(this['context'])['model']['document']['selection']['getRanges']()];this['_aiEditing']['showFakeVisualSelection']({'ranges':_0x3ab3dd,'id':'context','priority':0x1});}}),this['activeConversation']['on']('contextItemRemoved',(_0x3df630,_0x21020b)=>{this['_aiChatUi']['removeContextItem'](_0x21020b['uiId']),'current-document'==_0x21020b['uiId']&&this['removeSelectionFromChatContext'](),'selection'===_0x21020b['type']&&this['_aiEditing']['hideFakeVisualSelection']('context');}),this['activeConversation']['on']('contextItemLoadingEnded',(_0x4c468c,_0x5b1a22)=>{this['_aiChatUi']['setContextItemLoading'](_0x5b1a22['contextItem']['uiId'],_0x5b1a22['isLoading']);}),this['activeConversation']['on']('contextSent',(_0x404e49,_0x328e54)=>{this['_aiChatUi']['setConversationContext'](_0x328e54['contextItems']);}),this['activeConversation']['on']('addContextOptionsChanged',(_0x4872ff,_0x4e9746)=>{this['_aiChatUi']['setAddContextOptions'](_0x4e9746['options']);}),this['activeConversation']['on']('sourceResourcesLoaded',(_0x4e2c1d,_0x2aaeea)=>{this['_aiChatUi']['populateSourceResourceBalloon'](_0x2aaeea['sourceId'],_0x2aaeea['source'],_0x2aaeea['resources'],_0x2aaeea['uid']);}),this['activeConversation']['on']('resourceStateChanged',(_0x122ed3,_0x45f4c1)=>{this['_aiChatUi']['updateResourceState'](_0x45f4c1['sourceId'],_0x45f4c1['resourceId'],_0x45f4c1['isInContext']);}),this['activeConversation']['on']('capabilitiesUpdated',(_0x549c15,_0x39a81b)=>{this['_aiChatUi']['updateCapabilities'](_0x39a81b);}),this['activeConversation']['on']('modelSelected',async(_0x18cb97,_0x4c8a12)=>{const _0xc4dbf7=(await this['_aiChatModels']['getAll']())['find'](_0x1273a0=>_0x1273a0['id']===_0x4c8a12['selectedModel']?.['id'])||null;this['_aiChatUi']['setSelectedModel'](_0xc4dbf7,_0x4c8a12['isDisabled']);}),this['activeConversation']['on']('error',(_0x40a5bb,{error:_0x1a20f0,interactionId:_0x487565,fileName:_0x48a80d,url:_0x1c24ae,sourceId:_0x16391d,sourceLabel:_0x310e56})=>{const _0xaa93ee=_0x487565?_0x487565+':'+ot():ot();_0x1a20f0['message']['startsWith']('ai-request-aborted')?this['_aiChatUi']['addFeedItemStaticMessage']({'staticMessage':hs(this['context']['locale'],'AI_CHAT_ABORTED_MESSAGE'),'id':_0xaa93ee}):_0x1a20f0['message']['startsWith']('ai-chat-conversation-init-failed')||_0x1a20f0['message']['startsWith']('ai-chat-conversation-start-failed')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':hs(this['context']['locale'],'AI_CHAT_UNABLE_TO_START_CONVERSATION'),'id':_0xaa93ee}),this['_logError'](_0x1a20f0)):_0x1a20f0['message']['startsWith']('ai-chat-file-upload-failed')?this['_aiChatUi']['addFeedItemError']({'errorMessage':hs(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_FILE',_0x48a80d),'id':_0xaa93ee}):_0x1a20f0['message']['startsWith']('ai-chat-url-upload-failed')?this['_aiChatUi']['addFeedItemError']({'errorMessage':hs(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_URL',_0x1c24ae),'id':_0xaa93ee}):_0x1a20f0['message']['startsWith']('ai-chat-context-invalid-data')?this['_aiChatUi']['addFeedItemError']({'errorMessage':hs(this['context']['locale'],'AI_CHAT_CONTEXT_INVALID_DATA'),'id':_0xaa93ee}):_0x1a20f0['message']['startsWith']('ai-chat-context-unsupported-type')?this['_aiChatUi']['addFeedItemError']({'errorMessage':hs(this['context']['locale'],'AI_CHAT_CONTEXT_UNSUPPORTED_TYPE'),'id':_0xaa93ee}):_0x1a20f0['message']['startsWith']('ai-chat-source-resources-load-failed')?(_0x16391d&&this['_aiChatUi']['closeSourceResourceBalloon'](_0x16391d),this['_aiChatUi']['addFeedItemError']({'errorMessage':hs(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_LOAD_RESOURCES',_0x310e56||'source'),'id':_0xaa93ee}),this['_logError'](_0x1a20f0)):_0x1a20f0['message']['startsWith']('ai-chat-resource-load-failed')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':hs(this['context']['locale'],'AI_CHAT_RESOURCE_LOAD_FAILED'),'id':_0xaa93ee}),this['_logError'](_0x1a20f0)):_0x1a20f0['message']['startsWith']('ai-chat-invalid-request')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':hs(this['context']['locale'],'AI_CHAT_INVALID_REQUEST'),'id':_0xaa93ee}),this['_logError'](_0x1a20f0)):_0x1a20f0['message']['startsWith']('ai-chat-context-unsupported-file-type')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':hs(this['context']['locale'],'AI_CHAT_CONTEXT_UNSUPPORTED_FILE_TYPE'),'id':_0xaa93ee}),this['_logError'](_0x1a20f0)):_0x1a20f0['message']['startsWith']('ai-chat-context-file-too-large')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':hs(this['context']['locale'],'AI_CHAT_CONTEXT_FILE_TOO_LARGE'),'id':_0xaa93ee}),this['_logError'](_0x1a20f0)):_0x1a20f0['message']['startsWith']('ai-chat-context-file-too-many-pages')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':hs(this['context']['locale'],'AI_CHAT_CONTEXT_FILE_TOO_MANY_PAGES'),'id':_0xaa93ee}),this['_logError'](_0x1a20f0)):_0x1a20f0['message']['startsWith']('ai-chat-context-form-data-size-limits-exceeded')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':hs(this['context']['locale'],'AI_CHAT_CONTEXT_FORM_DATA_SIZE_LIMITS_EXCEEDED'),'id':_0xaa93ee}),this['_logError'](_0x1a20f0)):(this['_aiChatUi']['addFeedItemError']({'errorMessage':hs(this['context']['locale'],'AI_CHAT_GENERIC_ERROR'),'id':_0xaa93ee}),this['_logError'](_0x1a20f0));}),await this['activeConversation']['init'](this['context']['config']['get']('ai.chat.context')),_0x4e6995||await this['activeConversation']['start']();}async['_handleUIUserMessage']({message:_0x292a93,attributes:_0x1fe795}){if(!this['activeConversation'])throw new at('ai-chat-controller-no-active-conversation');if(this['activeConversation']['isCurrentDocumentInContext']()){const _0x24d226=await this['_aiEditing']['getDocumentData']();_0x24d226['length']>0x1?await this['activeConversation']['updateCurrentDocumentsInContext'](_0x24d226):await this['activeConversation']['updateCurrentDocumentInContext'](_0x24d226[0x0]);}this['activeConversation']['id']&&this['activeConversation']['isStarted']&&await this['activeConversation']['handleUserInteraction']({'userMessage':_0x292a93,'attributes':_0x1fe795});}['_logError'](_0x5f09cb){Et(_0x5f09cb['message']);}['_removeFromContext'](_0x1c91b2){this['activeConversation']?.['removeFromContext'](_0x1c91b2);}['_toggleWebSearch'](){this['activeConversation']?.['toggleWebSearch']();}['_toggleReasoning'](){this['activeConversation']?.['toggleReasoning']();}['getInteractionAndReplyById'](_0xde19b3){const [_0x2fc6b8,_0xed576e]=_0xde19b3['split'](':'),_0x24bd6f=this['activeConversation']['getInteraction'](_0x2fc6b8),_0x5931d1=_0x24bd6f['getReply'](_0xed576e);return{'interaction':_0x24bd6f,'reply':_0x5931d1};}['_resolveGroupTarget'](_0x5214f5,_0x5e35c0){const _0xadbfe9=[..._0x5e35c0['changes']['filter'](_0x5a4120=>'context'!==_0x5a4120['type']),..._0x5e35c0['changes']['filter'](_0x22afe2=>'context'===_0x22afe2['type'])];for(const _0x37ce89 of _0xadbfe9){const _0x322659=_0x5214f5['newNodeAnchorIds']['get'](_0x37ce89['id']),_0x2f9c39=this['activeConversation']?.['getSourceByDataId'](_0x37ce89['id'])||this['activeConversation']?.['getSourceByDataId'](_0x322659)||this['activeConversation']?.['getSourceByDataId'](_0x37ce89['anchorId']??void 0x0);if(_0x2f9c39){if('destroyed'===_0x2f9c39['editor']['state'])return null;const _0x2ce7ca=_0x2f9c39['editor']['model']['document']['getRoot'](_0x2f9c39['rootName']);return _0x2ce7ca?{'editor':_0x2f9c39['editor'],'root':_0x2ce7ca,'parsedDocumentContent':_s(_0x2f9c39['content']),'serializedDocumentContent':_0x2f9c39['content'],'version':_0x2f9c39['version']}:null;}}const _0x24c3d7=$s(this['context']),_0x2e26f1=this['activeConversation']['getInteraction'](_0x5214f5['interactionId']),_0x39514b=_0x2e26f1?.['getDocumentContext']();return{'editor':_0x24c3d7,'root':_0x24c3d7['model']['document']['getRoot'](),'parsedDocumentContent':_0x5214f5['documentContextContent'],'serializedDocumentContent':_0x39514b?.['content'],'version':_0x39514b?.['version']};}['_groupChangesByTarget'](_0x5c5aa5,_0x3c1b85){const _0xd9ea44=new Map();for(const _0x2b03e9 of _0x3c1b85){const _0x26680a=this['_resolveGroupTarget'](_0x5c5aa5,_0x2b03e9);if(!_0x26680a)continue;const _0x4df793=(_0x26680a['editor']['id']||'e')+'|'+_0x26680a['root']['rootName'];let _0x3624ab=_0xd9ea44['get'](_0x4df793);if(!_0x3624ab){let _0x25dbd2;for(const _0x45f731 of[..._0x2b03e9['changes']['filter'](_0x4e8fef=>'context'!==_0x4e8fef['type']),..._0x2b03e9['changes']['filter'](_0x33e4b4=>'context'===_0x33e4b4['type'])])if(_0x25dbd2=this['activeConversation']?.['getDocumentContextSliceByDataId'](_0x45f731['id'])||this['activeConversation']?.['getDocumentContextSliceByDataId'](_0x5c5aa5['newNodeAnchorIds']['get'](_0x45f731['id'])),_0x25dbd2)break;_0x3624ab={'target':{'editor':_0x26680a['editor'],'root':_0x26680a['root']},'slice':_0x25dbd2,'groups':[],'groupsIndexes':[]},_0xd9ea44['set'](_0x4df793,_0x3624ab);}_0x3624ab['groups']['push'](_0x2b03e9),_0x3624ab['groupsIndexes']['push'](_0x5c5aa5['changeGroups']['indexOf'](_0x2b03e9));}return Array['from'](_0xd9ea44['values']());}['_scrollToSuggestionRange'](_0x1824c1,_0x168ab9=!0x1,_0x3eacb5){const _0x3fcafc={'target':_0x3eacb5['editing']['view']['domConverter']['viewRangeToDom'](_0x3eacb5['editing']['mapper']['toViewRange'](_0x1824c1)),'viewportOffset':{'top':0x96,'left':0x0,'bottom':0x32,'right':0x0},'ancestorOffset':0x14,'alignToTop':_0x168ab9};_0x168ab9&&(_0x3fcafc['alignToTop']=!0x0),Ct(_0x3fcafc);}['_updateConversationTitle'](_0x2d2efd,_0x4eec5f=!0x1){this['_aiChatUi']['setConversationTitle'](_0x2d2efd||hs(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION'),_0x4eec5f);}['_addFeedItemReply'](_0x5041fa){'text'===_0x5041fa['type']?this['_aiChatUi']['addFeedItemAIReply'](_0x5041fa):this['_aiChatUi']['addFeedItemAISuggestion'](_0x5041fa);}async['_updateReplyContent']({reply:_0x4afd24,renderingStrategy:_0x552db8}){const {id:_0x1a118e,interactionId:_0x4a5698,isDone:_0x5d10ae,type:_0x1a0945,parsedContent:_0x50918d}=_0x4afd24,_0x1c018b=_0x4a5698+':'+_0x1a118e;if('modification'===_0x1a0945){const _0x4198e3=_0x4afd24['getContentParts']({'showDiff':this['_aiChatUi']['showDiff'],'editor':$s(this['context'])});await this['_aiChatUi']['updateFeedItemAIReplySuggestionContent']({'id':_0x1c018b,'parts':_0x4198e3,'isDone':_0x5d10ae,'skipLoadingEffects':_0x4afd24['isFromHistory']});}else'text'===_0x1a0945&&await this['_aiChatUi']['updateFeedItemAIReplyContent']({'id':_0x1c018b,'parsedContent':_0x50918d,'renderingStrategy':_0x552db8,'isDone':_0x5d10ae});_0x5d10ae&&_0x4afd24['sources']['length']>0x0&&this['_aiChatUi']['updateFeedItemAIReplySources'](_0x1c018b,_0x4afd24['sources']);}['_updateReplyContentThrottled']=_0x42e740(this['_updateReplyContent']['bind'](this),0xc8);async['_stopLastInteraction'](){const _0x4dba31=this['activeConversation']?.['lastInteraction'];_0x4dba31&&(_0x4dba31['stop'](),this['_aiChatUi']['stopInteraction'](_0x4dba31)),this['_updateReplyContentThrottled']['cancel']();}async['_flushLastInteractionUI'](){const _0x3cbb7a=this['activeConversation']?.['lastInteraction'];if(_0x3cbb7a){for await(const _0x23b41e of _0x3cbb7a['replies'])this['_aiChatUi']['hasFeedItem'](_0x23b41e['id'])||this['_addFeedItemReply'](_0x23b41e),await this['_updateReplyContent']({'reply':_0x23b41e,'renderingStrategy':'static'});}}['_updateRatings'](_0x5ac3c6){const _0x2880ef={'positiveCount':_0x5ac3c6['changeGroups']['filter'](_0x377dd7=>'accepted'===_0x377dd7['state'])['length'],'totalCount':_0x5ac3c6['changeGroups']['length'],'modificationId':_0x5ac3c6['id']},_0x5b7b4a=this['activeConversation']['getInteraction'](_0x5ac3c6['interactionId'])['messageId'];_0x5b7b4a&&this['_aiConnector']['upsertAIChatRating'](this['activeConversation']['id'],_0x5b7b4a,_0x2880ef);}['_getAIChatFeedAPI'](_0x116376){const _0x40d82e=this['_aiChatUi'],_0xb705bb=()=>{_0x116376['resetWebSearchState'](),_0x116376['resetReasoningState'](),_0x40d82e['clearLoadingMessage']();},_0x178c20=()=>{_0x116376['currentReply']&&(_0x116376['currentReply']['done'](),_0x116376['currentReply']=void 0x0);};return{'insertTextReply':(_0x4d5d9a,_0x32b5fb)=>{_0x178c20(),_0xb705bb();const _0x30a41e=_0x116376['currentReply']=_0x116376['createReply']({'type':'text','interactionId':_0x116376['id'],'content':_0x4d5d9a,'id':_0x32b5fb||ot()});return _0x178c20(),_0x30a41e;},'insertCustomElement':async(_0xd3c5e6,_0x4cc1b8)=>(_0x178c20(),_0xb705bb(),_0x40d82e['addFeedItemCustomElement'](_0xd3c5e6,_0x4cc1b8||ot())),'setLoadingMessage':_0x379cf8=>{_0x40d82e['setLoadingMessage'](_0x379cf8);},'clearLoadingMessage':()=>{_0x40d82e['clearLoadingMessage']();}};}}const zs='ai-selection',js=['br'];class Js extends _0x173dbd{constructor(_0x33ce5c){super(_0x33ce5c),this['context']['config']['define']('ai.models.showModelSelector',!0x0);}['_outputDataProcessor'];['_fakeSelections']=[];['_sessionId'];['_lastContentFocusedEditor'];static get['pluginName'](){return'AIEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['getLastContentFocusedEditor'](){return this['_lastContentFocusedEditor'];}get['sessionId'](){if(!this['_sessionId']){const _0x4f73cf=Ws(this['context']),_0x57ef76=_0x4f73cf['find'](_0x3e9721=>_0x3e9721['plugins']['has']('RealTimeCollaborationClient'))||_0x4f73cf[0x0],_0x53bee6=_0x57ef76['plugins']['has']('RealTimeCollaborationClient')&&_0x57ef76['plugins']['get']('RealTimeCollaborationClient')['sessionId'];this['_sessionId']=_0x53bee6||ot();}return this['_sessionId'];}async['getDocumentData'](){const _0x5bf8b7=Ws(this['context']);if(!_0x5bf8b7['length'])throw new at('ai-get-editor-from-context-no-editor');const _0x5f3b25=[],_0x257e1d=new Set();for(const _0x5648a5 of _0x5bf8b7){const _0x13d30a=_0x5648a5['config']['get']('roots')||{};for(const _0x46b9c0 of _0x5648a5['model']['document']['getRoots']()){if('$graveyard'===_0x46b9c0['rootName'])continue;const _0x5f5d60=await this['_getDocumentDataForEditorRoot'](_0x5648a5,_0x46b9c0,_0x257e1d),_0x49a3b4=_0x13d30a[_0x46b9c0['rootName']];let _0x477e90;_0x49a3b4?.['label']?_0x477e90=_0x49a3b4['label']:(It('ai-document-root-missing-label',{'editor':_0x5648a5,'rootConfig':_0x49a3b4}),_0x477e90=_0x46b9c0['rootName']),_0x5f3b25['push']({'editor':_0x5648a5,'rootName':_0x46b9c0['rootName'],'content':_0x5f5d60['content'],'version':_0x5f5d60['version'],'sessionId':this['sessionId'],'channelId':_0x5648a5['config']['get']('collaboration.channelId'),'selections':_0x5f5d60['selections'],'name':_0x477e90,'description':_0x49a3b4?.['description']});}}return _0x5f3b25;}async['_getDocumentDataForEditorRoot'](_0x46f117,_0x3a06fa,_0x543030){const _0x4f5e57=_0x46f117['data']['toView'](_0x3a06fa,{'convertAiChatSelectionMarker':!0x0}),_0x16e62a=new _0x27a0d8(_0x46f117['editing']['view']['document']);this['_setDataIdsOnChildren'](_0x4f5e57,_0x16e62a,_0x543030);let _0x58b965=await this['_getDocumentDataStringFromView'](_0x4f5e57,_0x46f117);const _0x4354b1=this['_getMarkersInDocumentOrder'](_0x46f117,_0x3a06fa),_0x32fd1d=[];for(const _0x21b0f4 of _0x4354b1){const _0xfacfc7='<'+_0x21b0f4['name']+':start></'+_0x21b0f4['name']+':start>',_0x55392a=_0x58b965['indexOf'](_0xfacfc7);_0x58b965=_0x58b965['substring'](0x0,_0x55392a)+_0x58b965['substring'](_0x55392a+_0xfacfc7['length']);const _0x51a105='<'+_0x21b0f4['name']+':end></'+_0x21b0f4['name']+':end>',_0xaf088a=_0x58b965['indexOf'](_0x51a105);_0x58b965=_0x58b965['substring'](0x0,_0xaf088a)+_0x58b965['substring'](_0xaf088a+_0x51a105['length']),_0x32fd1d['push']({'markerName':_0x21b0f4['name'],'start':_0x55392a,'end':_0xaf088a,'htmlFragment':_0x58b965['substring'](_0x55392a,_0xaf088a)});}return{'content':_0x58b965,'version':_0x46f117['model']['document']['version'],'selections':_0x32fd1d};}async['afterInit'](){this['context']instanceof _0x2ef8df?this['_integrateEditor'](this['context']):this['listenTo'](this['context']['editors'],'add',(_0x319a43,_0x36e677)=>{_0x36e677['on']('ready',()=>{this['_integrateEditor'](_0x36e677);});});}['_setOutputDataProcessor'](_0x284004){this['_outputDataProcessor']=_0x284004;}async['_getDocumentDataStringFromView'](_0x51f93f,_0x5933ee){let _0x37ea88;if(this['_outputDataProcessor']){const _0x5d9698=_0x5933ee['data']['processor']['domConverter']['viewToDom'](_0x51f93f),_0x194e9f=await this['_outputDataProcessor'](_0x5d9698);_0x37ea88=_0x5933ee['data']['processor']['htmlWriter']['getHtml'](_0x194e9f);}else _0x37ea88=_0x5933ee['data']['processor']['toData'](_0x51f93f);return _0x37ea88;}['_integrateEditor'](_0x1fb83e){if(!_0x1fb83e['config']['get']('collaboration.channelId'))throw new at('ai-missing-channel-id',_0x1fb83e);_0x1fb83e['ui']['focusTracker']['on']('change:isFocused',(_0x521fc9,_0x249c8,_0x352771)=>{_0x352771&&(this['_lastContentFocusedEditor']=_0x1fb83e);}),_0x1fb83e['on']('destroy',()=>{this['_lastContentFocusedEditor']===_0x1fb83e&&(this['_lastContentFocusedEditor']=void 0x0);}),_0x1fb83e['conversion']['for']('editingDowncast')['markerToHighlight']({'model':zs,'view':({markerName:_0x40ed52})=>({'classes':['ck-ai-assistant-ui_theme','ck-fake-ai-selection','ck-fake-ai-selection-'+_0x40ed52['split'](':')[0x1]],'priority':0xc})}),_0x1fb83e['conversion']['for']('dataDowncast')['markerToElement']({'model':zs+':context','view':(_0x4c2690,{writer:_0x13493c,options:_0x592d5c})=>_0x592d5c['convertAiChatSelectionMarker']?_0x13493c['createUIElement'](_0x4c2690['markerName']+':'+(_0x4c2690['isOpening']?'start':'end')):null});}['showFakeVisualSelection'](_0x1be4d0){const _0x47f24b=this['_fakeSelections'][0x0]||null;this['_addFakeSelection'](_0x1be4d0);const _0x11c7d2=this['_fakeSelections'][0x0]||null;this['_refreshFakeSelection'](_0x47f24b,_0x11c7d2);}['hideFakeVisualSelection'](_0x2f550d){const _0x267693=this['_fakeSelections'][0x0]||null;this['_removeFakeSelectionById'](_0x2f550d);const _0x3d2985=this['_fakeSelections'][0x0]||null;this['_refreshFakeSelection'](_0x267693,_0x3d2985);}async['modelToDataWithIds'](_0x59a876){const _0x5efe2f=$s(this['context']),_0x541b2c=_0x5efe2f['data']['toView'](_0x59a876),_0x1341d3=new _0x27a0d8(_0x5efe2f['editing']['view']['document']);return this['_setDataIdsOnChildren'](_0x541b2c,_0x1341d3),this['_getDocumentDataStringFromView'](_0x541b2c,_0x5efe2f);}['_setDataIdsOnChildren'](_0x22e867,_0x4bcc46,_0x497d75=new Set()){let _0x154458=!0x1;for(const _0x3e654c of _0x22e867['getChildren']()){if(!_0x3e654c['is']('view:element')||js['includes'](_0x3e654c['name']))continue;const _0x392073=_0x3e654c['is']('view:containerElement'),_0x19b4cc=_0x3e654c['is']('view:emptyElement'),_0x3b73ef=this['_setDataIdsOnChildren'](_0x3e654c,_0x4bcc46,_0x497d75);if(_0x3e654c['hasAttribute']('data-id')){_0x154458=!0x0,_0x497d75['add'](_0x3e654c['getAttribute']('data-id'));continue;}(_0x392073||_0x19b4cc||_0x3b73ef)&&(_0x4bcc46['setAttribute']('data-id',this['_nextDataId'](_0x497d75),_0x3e654c),_0x154458=!0x0);}return _0x154458;}['_nextDataId'](_0x7af183){let _0x4b731e;do{_0x4b731e='';for(let _0x4ba510=0x0;_0x4ba510<0x4;_0x4ba510++)_0x4b731e+=String['fromCharCode'](0x61+Math['floor'](0x1a*Math['random']()));}while(_0x7af183['has'](_0x4b731e));return _0x7af183['add'](_0x4b731e),_0x4b731e;}['getSelectionText'](){const {model:_0x42b439}=$s(this['context']),_0x29a844=_0x42b439['document']['selection'],_0x4c2e91=[],_0x54f1ca=Array['from'](_0x29a844['getRanges']());_0x54f1ca['sort']((_0x4a2059,_0x5981e3)=>_0x4a2059['start']['isBefore'](_0x5981e3['start'])?-0x1:0x1);for(const _0x40f827 of _0x54f1ca)for(const _0x23d398 of _0x40f827['getItems']())_0x23d398['is']('$textProxy')?_0x4c2e91['push'](_0x23d398['data']):_0x23d398['is']('element')&&_0x4c2e91['length']>0x0&&'\x20'!==_0x4c2e91[_0x4c2e91['length']-0x1]&&_0x4c2e91['push']('\x20');return _0x4c2e91['length']?'\x22'+_0x4c2e91['join']('')['trim']()+'\x22':hs(this['context']['locale'],'AI_CHAT_CONTEXT_DOCUMENT_SELECTION_LABEL');}['_removeFakeSelectionById'](_0x204918){for(let _0x3ae530=0x0;_0x3ae530<this['_fakeSelections']['length'];_0x3ae530++)if(this['_fakeSelections'][_0x3ae530]['id']==_0x204918)return void this['_fakeSelections']['splice'](_0x3ae530,0x1);}['_addFakeSelection'](_0x19b041){this['_removeFakeSelectionById'](_0x19b041['id']),wt(this['_fakeSelections'],_0x19b041);}['_refreshFakeSelection'](_0x69f49d,_0x1c963e){if(_0x69f49d==_0x1c963e)return;const _0x2dc4d0=_0x69f49d?this['_getEditorForFakeSelection'](_0x69f49d):null,_0x4ab0b2=_0x1c963e?this['_getEditorForFakeSelection'](_0x1c963e):null,_0x484130=(_0x5bc78f,_0x5c98c0)=>{const _0x504cd5=_0x5c98c0['model']['markers']['getMarkersGroup'](zs);for(const _0x1b7576 of _0x504cd5)_0x5bc78f['removeMarker'](_0x1b7576);},_0x1595c3=(_0x258a7b,_0x4cbcc5,_0x5f3702)=>{const _0x4d0d4b=_0x4cbcc5['model'];for(let _0x4cf0a=0x0;_0x4cf0a<_0x5f3702['ranges']['length'];_0x4cf0a++){let _0x6b0592=_0x5f3702['ranges'][_0x4cf0a];const _0xe7e803=zs+':'+_0x5f3702['id']+':'+_0x4cf0a;if(_0x6b0592['start']['isAtEnd']){const _0x4fa029=_0x6b0592['start']['getLastMatchingPosition'](({item:_0x4b5923})=>!_0x4d0d4b['schema']['isContent'](_0x4b5923),{'boundaries':_0x6b0592});_0x6b0592=_0x258a7b['createRange'](_0x4fa029,_0x6b0592['end']);}_0x258a7b['addMarker'](_0xe7e803,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x6b0592});}};_0x2dc4d0&&_0x4ab0b2&&_0x2dc4d0===_0x4ab0b2&&_0x1c963e?_0x2dc4d0['model']['change'](_0x2dc2ff=>{_0x484130(_0x2dc2ff,_0x2dc4d0),_0x1595c3(_0x2dc2ff,_0x4ab0b2,_0x1c963e);}):(_0x2dc4d0&&_0x2dc4d0['model']['change'](_0x37e8ec=>_0x484130(_0x37e8ec,_0x2dc4d0)),_0x4ab0b2&&_0x1c963e&&_0x4ab0b2['model']['change'](_0x23c5f0=>_0x1595c3(_0x23c5f0,_0x4ab0b2,_0x1c963e)));}['_getEditorForFakeSelection'](_0x58d9e7){if(!_0x58d9e7['ranges']['length'])return $s(this['context']);const _0x1b75d5=_0x58d9e7['ranges'][0x0]['root']['document'];return Ws(this['context'])['find'](_0x178f2c=>_0x178f2c['model']['document']===_0x1b75d5)??$s(this['context']);}['_getMarkersInDocumentOrder'](_0xb21004,_0x3c2632){const _0x1c5e46=Array['from'](_0xb21004['model']['markers']['getMarkersGroup'](zs+':context'));return(_0x3c2632?_0x1c5e46['filter'](_0x4f1442=>{const _0x3054b9=_0x4f1442['getRange']();return _0x3054b9&&_0x3054b9['root']['rootName']===_0x3c2632['rootName'];}):_0x1c5e46)['sort']((_0x3bd59d,_0x3f43fd)=>_0x3bd59d['getStart']()['isBefore'](_0x3f43fd['getStart']())?-0x1:_0x3bd59d['getStart']()['isAfter'](_0x3f43fd['getStart']())?0x1:0x0);}}const Zs=['showChangeInText','insertSuggestion','applySuggestion','rejectSuggestion','mouseOverSuggestion','mouseLeaveSuggestion','toggleSuggestionDisplayMode','like','dislike'],tn=[...Zs,'startConversation','sendUserMessage','abortPromptStream','addDocumentToContext','addFileToContext','addUrlToContext','executeCustomItemCallback','addResourceToContext','removeContextItem','loadSourceResources','toggleWebSearch','toggleReasoning','selectModel'];function en(_0x129159){const _0x4238dd=new AbortController();return{'promise':new Promise((_0x21c84d,_0x2c3285)=>{const _0x264571=setTimeout(_0x21c84d,_0x129159);_0x4238dd['signal']['addEventListener']('abort',()=>{clearTimeout(_0x264571),_0x2c3285();});}),'abortController':_0x4238dd};}class sn{['options'];['isStreaming']=!0x1;['document']=null;['nodesList']=[];['currentIndex']=0x0;['timeoutAbortController']=null;['lastUpdateTime']=0x0;constructor(_0x3a504a){this['options']={'delay':_0x3a504a?.['delay']??0xa,'textNodeStyle':_0x3a504a?.['textNodeStyle']??'animation:\x20ck-html-streamer-fade-in\x20.3s'};}async['stream']({document:_0x35268d,targetElement:_0x27a343,abortSignal:_0x9e1c11}){this['isStreaming']&&this['stop'](),_0x9e1c11?.['addEventListener']('abort',this['stop']['bind'](this)),this['document']=_0x2cb1ed(_0x35268d,!0x0),this['nodesList']=this['getParsedDocumentNodeList'](),this['isStreaming']=!0x0,this['currentIndex']>this['nodesList']['length']&&(this['currentIndex']=this['nodesList']['length']);for(let _0x19aec4=0x0;_0x19aec4<this['currentIndex'];_0x19aec4++)this['nodesList'][_0x19aec4]['shouldBeStreamed']=!0x0;do{const _0x50759f=Date['now'](),_0x2d58be=this['nodesList'][this['currentIndex']],_0x48f0c7=_0x50759f-this['lastUpdateTime'];if(_0x2d58be){_0x2d58be['shouldBeStreamed']=!0x0;let _0x2b79ec=_0x2d58be['parent'];for(;_0x2b79ec;)_0x2b79ec['shouldBeStreamed']=!0x0,_0x2b79ec=_0x2b79ec['parent'];}if(_0x48f0c7<this['options']['delay'])try{const {promise:_0x4e04ae,abortController:_0x51443c}=en(this['options']['delay']-_0x48f0c7);this['timeoutAbortController']=_0x51443c,await _0x4e04ae;}catch(_0xaacc17){return;}_0x509ce5(_0x27a343,'<'+_0x27a343['tagName']+'>'+this['renderNode'](this['document'])+'</'+_0x27a343['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:_0x5de1e0}){Array['from'](_0x5de1e0['querySelectorAll']('span[data-ck-html-streamer-word-chunk]'))['reverse']()['forEach'](_0xf78d24=>{_0xf78d24['replaceWith'](_0xf78d24['childNodes'][0x0]);});}['stop'](){this['isStreaming']=!0x1,this['timeoutAbortController']&&(this['timeoutAbortController']['abort'](),this['timeoutAbortController']=null);}['renderNode'](_0xfe7c1d){let _0xe49b83='';if(function(_0xf76c5f){return _0x984065(_0xf76c5f);}(_0xfe7c1d)){for(const _0x327f23 of _0xfe7c1d['children'])_0xe49b83+=this['renderNode'](_0x327f23);}else{if(on(_0xfe7c1d)){if(!_0xfe7c1d['shouldBeStreamed'])return'';const _0x2dfda9=_0xfe7c1d,_0x13ca22=Object['entries'](_0x2dfda9['attribs'])['map'](([_0xd9ddcd,_0x4858a8])=>_0xd9ddcd+'=\x22'+_0x4858a8+'\x22')['join']('\x20');_0xe49b83+='<'+_0x2dfda9['tagName']+(_0x13ca22?'\x20'+_0x13ca22:'')+'>';for(const _0x3130db of _0x45c663(_0x2dfda9))_0xe49b83+=this['renderNode'](_0x3130db);_0xe49b83+='</'+_0x2dfda9['tagName']+'>';}else{if(!rn(_0xfe7c1d))return'';if(!_0xfe7c1d['shouldBeStreamed'])return'';!function(_0x1fea0e){if(!_0x1fea0e['parent']||!on(_0x1fea0e['parent']))return!0x1;if(!nn['includes'](_0x1fea0e['parent']['tagName']))return!0x1;return!_0x1ea558(_0x1fea0e)['match'](/^\s*[<>]\s*$/);}(_0xfe7c1d)?_0xe49b83+=ti(_0xfe7c1d):_0xe49b83+=ti(new _0x244f1b('span',{'data-ck-html-streamer-word-chunk':'','style':this['options']['textNodeStyle']},[_0xfe7c1d]));}}return _0xe49b83;}['getParsedDocumentNodeList'](){const _0x103286=[];return function(_0x30b3c3,_0x2022b7){const _0x4c07b2=_0x23f044=>{if(_0x2022b7(_0x23f044),_0x23f044 instanceof _0x5218f8)for(let _0x6a72d7=0x0;_0x6a72d7<_0x23f044['children']['length'];_0x6a72d7++){const _0x56559a=_0x23f044['children'][_0x6a72d7];_0x4c07b2(_0x56559a);}};for(let _0x53bf3f=0x0;_0x53bf3f<_0x30b3c3['children']['length'];_0x53bf3f++)_0x4c07b2(_0x30b3c3['children'][_0x53bf3f]);}(this['document'],_0x2b9faf=>{if(rn(_0x2b9faf)){const _0x2af525=this['splitTextNodeIntoWordNodes'](_0x2b9faf);_0x2af525['length']&&_0x103286['push'](..._0x2af525);}_0x2b9faf['isWordSplitSource']||_0x2b9faf['isWordSplitResult']||_0x103286['push'](_0x2b9faf);}),_0x103286;}['splitTextNodeIntoWordNodes'](_0x530a9a){if(_0x530a9a['isWordSplitSource']||_0x530a9a['isWordSplitResult'])return[];const _0x456e9e=_0x1ea558(_0x530a9a)['match'](/(?:\s*\S+\s*)/g),_0xffd7fe=[];if(_0x456e9e&&_0x456e9e['length']>0x1){for(const _0x4dbfca of _0x456e9e){const _0x5dca34=new _0x592fb4(_0x4dbfca);_0x5dca34['isWordSplitResult']=!0x0,_0x27ae1b(_0x530a9a,_0x5dca34),_0xffd7fe['push'](_0x5dca34);}_0x530a9a['isWordSplitSource']=!0x0,_0x5d78f4(_0x530a9a);}return _0xffd7fe;}}const nn=['p','li','td','th','span','h1','h2','h3','h4','h5','h6','b','strong','i','em','mark','del','ins','sup','sub','a','code','div'];function rn(_0x3dd70e){return _0x391745(_0x3dd70e);}function on(_0x4d392c){return _0x1d6ab8(_0x4d392c);}class an extends vt{['options'];['content']='';['htmlStreamer'];['children'];constructor(_0x824244){super();const _0x2a78c2=this['bindTemplate'];this['set']('isDone',!0x1),this['set']('isVisible',!0x0),this['htmlStreamer']=new sn(),this['options']=_0x824244,this['children']=this['createCollection'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__item',_0x2a78c2['if']('isDone','ck-ai-chat__feed__item_done'),_0x2a78c2['if']('isVisible','ck-hidden',_0xd05315=>!_0xd05315),'ck-ai-chat__feed__text-item'],'data-cke-ai-id':this['options']['id']},'children':this['children']});}['markAsDone'](){this['htmlStreamer']['cleanUpAnimations']({'targetElement':this['element']}),this['element']['querySelectorAll']('[data-id]')['forEach'](_0x35858f=>{_0x35858f['removeAttribute']('data-id');}),this['isDone']=!0x0;}async['streamIntoElement'](_0x12a643,_0x1778a9,_0xdd06a6){await this['htmlStreamer']['stream']({'document':_0x12a643,'targetElement':_0x1778a9,'abortSignal':_0xdd06a6});}}class hn extends vt{['showChangesToggleView'];constructor(_0x292b9a,_0xc028f4){super(_0x292b9a),this['set']('isShowChangesToggleVisible',!0x0),this['showChangesToggleView']=new cn(_0x292b9a),this['showChangesToggleView']['set']({'class':'ck-ai-suggestion__header__show-changes-toggle\x20ck-ai-chat-controls-button\x20'+us,'label':hs(_0x292b9a,'AI_SUGGESTION_BUTTON_SHOW_CHANGES'),'withText':!0x0}),this['showChangesToggleView']['isOn']=_0xc028f4['showDiff'],this['showChangesToggleView']['bind']('isVisible')['to'](this,'isShowChangesToggleVisible'),this['showChangesToggleView']['bind']('icon')['to'](this['showChangesToggleView'],'isOn',_0x2a8dc2=>_0x2a8dc2?_0x577354:_0x1ebf6f),this['showChangesToggleView']['on']('execute',()=>{this['showChangesToggleView']['isOn']=!this['showChangesToggleView']['isOn'],this['fire']('toggleShowChanges',{'isOn':this['showChangesToggleView']['isOn']});});const _0x2979c0=new xt();_0x2979c0['content']=_0x3e528c,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__header',!0x1===_0xc028f4['showHeader']?'ck-hidden':null]['filter'](Boolean)},'children':[_0x2979c0,{'tag':'span','children':[hs(_0x292b9a,'AI_SUGGESTION_HEADER_TITLE')]},this['showChangesToggleView']]});}}class cn extends Nt{['render'](){super['render'](),this['children']['remove'](this['iconView']),this['children']['add'](this['iconView']);}}const ln={'accepted':_0x3b5a26,'rejected':_0x17ed4e,'outdated':_0x17ed4e};class un extends vt{['stateIconView'];constructor(_0x2603de){super(_0x2603de);const _0x5e66dc=this['bindTemplate'];this['set']('state','accepted'),this['set']('isVisible',!0x0),this['stateIconView']=new dn(),this['stateIconView']['bind']('state')['to'](this),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__content-part-state',_0x5e66dc['to']('state',_0xdcc1ab=>'ck-ai-suggestion__content-part-state_'+_0xdcc1ab),_0x5e66dc['if']('isVisible','ck-hidden',_0x998844=>!_0x998844)]},'children':[{'tag':'span','attributes':{'class':['ck-ai-suggestion__content-part-state__label']},'children':[{'text':_0x5e66dc['to']('state',_0x246ac6=>{switch(_0x246ac6){case'accepted':return hs(_0x2603de,'AI_SUGGESTION_CONTENT_PART_STATE_ACCEPTED');case'rejected':return hs(_0x2603de,'AI_SUGGESTION_CONTENT_PART_STATE_REJECTED');case'outdated':return hs(_0x2603de,'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED');}})}]},this['stateIconView']]});}['setState'](_0x583717){this['state']=_0x583717;}}class dn extends xt{constructor(){super(),this['set']('state','accepted'),this['content']=ln[this['state']],this['on']('change:state',()=>{this['content']=ln[this['state']];});}}class _n extends kt{['_applyButton'];['_suggestButton'];constructor(_0x244ef4,_0x1f4350,_0x23396f){super(_0x244ef4);const _0xd5e91c=Boolean(_0x23396f);this['set']('isEnabled',!_0xd5e91c),this['set']('isVisible',!0x0),this['class']='ck-ai-suggestion-content-part-toolbar';const _0x4bb2d6=[];if(_0xd5e91c){const _0xe17ec9=new Nt(_0x244ef4);_0xe17ec9['set']({'label':hs(_0x244ef4,'AI_SUGGESTION_DISABLED_TOOLTIP_MESSAGE'),'tooltip':!0x0,'withText':!0x1,'icon':_0x138750}),_0xe17ec9['extendTemplate']({'attributes':{'data-cke-tooltip-class':'ck-ai-suggestion-content-part-disabled-actions-tooltip'}}),_0x4bb2d6['push'](_0xe17ec9);}else{_0x1f4350['includes']('applySuggestion')&&(this['_applyButton']=new Nt(_0x244ef4),this['_applyButton']['set']({'label':hs(_0x244ef4,'AI_SUGGESTION_CONTENT_PART_APPLY'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x3b5a26}),this['_applyButton']['bind']('isEnabled')['to'](this),this['_applyButton']['on']('execute',()=>{this['fire']('applySuggestion');}),_0x4bb2d6['push'](this['_applyButton'])),_0x1f4350['includes']('insertSuggestion')&&(this['_suggestButton']=new Nt(_0x244ef4),this['_suggestButton']['set']({'label':hs(_0x244ef4,'AI_SUGGESTION_CONTENT_PART_ADD_SUGGESTION'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x227ff0}),this['_suggestButton']['bind']('isEnabled')['to'](this),this['_suggestButton']['on']('execute',()=>{this['fire']('insertSuggestion');}),_0x4bb2d6['push'](this['_suggestButton']));const _0x109b01=new Nt(_0x244ef4);_0x109b01['set']({'label':hs(_0x244ef4,'AI_SUGGESTION_CONTENT_PART_REJECT'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x17ed4e}),_0x109b01['bind']('isEnabled')['to'](this),_0x109b01['on']('execute',()=>{this['fire']('rejectSuggestion');}),_0x4bb2d6['push'](_0x109b01);}this['items']['addMany'](_0x4bb2d6);const _0x283175=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':[_0x283175['if']('isVisible','ck-hidden',_0x196d9b=>!_0x196d9b)]}});}['setButtonsVisibility']({showApplyButton:_0x16aee3,showSuggestButton:_0x1bf629}){this['_applyButton']&&(this['_applyButton']['isVisible']=_0x16aee3),this['_suggestButton']&&(this['_suggestButton']['isVisible']=_0x1bf629);}}class gn extends vt{['toolbarView'];['stateView'];['titleLabelView'];['children'];constructor(_0x5f0b3a,{part:_0x26f8b5,uiIndex:_0x26c266,availableActions:_0x3a7ab5,areActionsDisabled:_0x1e539a}){super(_0x5f0b3a),this['set']('isEnabled',!0x0),this['set']('state','pending'),this['toolbarView']=new _n(_0x5f0b3a,_0x3a7ab5,_0x1e539a),this['toolbarView']['on']('rejectSuggestion',()=>{this['fire']('rejectSuggestion',{'index':_0x26f8b5['index']});}),this['toolbarView']['on']('insertSuggestion',()=>{this['fire']('insertSuggestion',{'index':_0x26f8b5['index']});}),this['toolbarView']['on']('applySuggestion',()=>{this['fire']('applySuggestion',{'index':_0x26f8b5['index']});}),this['toolbarView']['bind']('isEnabled')['to'](this),this['stateView']=new un(_0x5f0b3a),this['titleLabelView']=new An(_0x5f0b3a,_0x26c266),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',(_0xac5b8,_0x1ae217,_0x2134ed,_0x518192)=>{'pending'===_0x518192?this['children']['remove'](this['toolbarView']):this['children']['remove'](this['stateView']),'pending'===_0x2134ed?this['children']['add'](this['toolbarView']):(this['stateView']['setState'](_0x2134ed),this['children']['add'](this['stateView']));});}}class An extends vt{constructor(_0x35a966,_0x3d38a7){super(_0x35a966),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__body__content-part__title__label']},'children':[hs(_0x35a966,'AI_SUGGESTION_CONTENT_PART_TITLE',_0x3d38a7['toString']())]});}}class In extends vt{['htmlStreamer'];constructor(_0x4c664c){super(_0x4c664c),this['htmlStreamer']=new sn(),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content','ck-reset_all-excluded','ck-ai-suggestion-streamable-content']}});}async['update']({part:_0x2c507b,renderingStrategy:_0x319f82,abortSignal:_0x3c0333}){'streaming'===_0x319f82?await this['htmlStreamer']['stream']({'document':_0x2c507b['content'],'targetElement':this['element'],'abortSignal':_0x3c0333}):_0x509ce5(this['element'],'<'+this['element']['tagName']+'>'+gs(_0x2c507b['content'])+'</'+this['element']['tagName']+'>',{'childrenOnly':!0x0});}['clear'](){this['htmlStreamer']['reset'](),this['element']['innerHTML']='';}}class En extends vt{['_children'];['_headerView'];['_streamableContentView'];constructor(_0x4581e3,{part:_0x1ec32a,uiIndex:_0x3c4f22,areActionsDisabled:_0x285681,availableActions:_0x303113}){super(_0x4581e3);const _0x2af121=this['bindTemplate'];this['set']('state','pending'),this['set']('isDone',!0x1),this['set']('isVisible',!0x1),this['set']('isActive',!0x1),this['set']('isEnabled',!0x1);const _0x349e95=()=>{this['isEnabled']=this['isDone']&&'pending'==this['state']&&!_0x285681;};this['on']('change:state',_0x349e95),this['on']('change:isDone',_0x349e95),_0x349e95(),this['_children']=this['createCollection'](),this['_headerView']=new gn(_0x4581e3,{'part':_0x1ec32a,'uiIndex':_0x3c4f22,'availableActions':_0x303113,'areActionsDisabled':_0x285681}),this['_headerView']['bind']('isEnabled','state')['to'](this),this['_headerView']['delegate'](...Zs)['to'](this),this['_streamableContentView']=new In(_0x4581e3),this['_children']['addMany']([this['_headerView'],this['_streamableContentView']]),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__body__content-part',_0x2af121['to']('state',_0x2fabed=>'ck-ai-suggestion__body__content-part_'+_0x2fabed),_0x2af121['if']('isEnabled','ck-ai-suggestion__body__content-part_enabled'),_0x2af121['if']('isActive','ck-ai-suggestion__body__content-part_active'),_0x2af121['if']('isVisible','ck-hidden',_0x25e2bb=>!_0x25e2bb)]},'children':this['_children'],'on':{'mouseenter':_0x2af121['to'](()=>{this['isEnabled']&&this['fire']('mouseOverSuggestion',{'index':_0x1ec32a['index']});}),'mouseleave':_0x2af121['to'](()=>{this['isEnabled']&&this['fire']('mouseLeaveSuggestion',{'index':_0x1ec32a['index']});}),'click':_0x2af121['to'](_0x532ef1=>{const _0x4506d8=_0x532ef1['target'];this['isEnabled']&&!this['_headerView']['toolbarView']['element']['contains'](_0x4506d8)&&this['fire']('showChangeInText',{'index':_0x1ec32a['index']});})}});}async['updateContent']({part:_0x4281b6,showUnchangedParts:_0x5dcbde=!0x1,abortSignal:_0x13b0b7}){this['partDefinition']=_0x4281b6,this['isVisible']=this['partDefinition']['hasChanges']||_0x5dcbde,this['isVisible']&&await this['_streamableContentView']['update']({'part':_0x4281b6,'renderingStrategy':'static','abortSignal':_0x13b0b7});}['markAsDone'](){this['isDone']=!0x0;}}class pn extends vt{constructor(_0x1157e5,_0x97461e){super(_0x1157e5),this['set']('isVisible',!0x0),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-skeleton',this['bindTemplate']['if']('isVisible','ck-hidden',_0x38f8c2=>!_0x38f8c2)]},'children':this['_createSkeletonItems'](_0x97461e)});}['_createSkeletonItems'](_0x258098){const _0x22a676=['ck','ck-ai-skeleton__item'];return _0x258098['map'](_0x4e2c43=>{let _0x336e5f='';switch(_0x4e2c43['attributes']['align']){case'right':_0x336e5f='margin-left:\x20auto;\x20margin-right:\x200;\x20text-align:\x20right;';break;case'center':_0x336e5f='margin-left:\x20auto;\x20margin-right:\x20auto;\x20text-align:\x20center;';break;case'left':_0x336e5f='margin-left:\x200;\x20margin-right:\x20auto;\x20text-align:\x20left;';}return{'tag':_0x4e2c43['tag'],'attributes':{'class':[..._0x22a676,_0x4e2c43['attributes']['class']?_0x4e2c43['attributes']['class']:''],'style':'width:\x20'+_0x4e2c43['attributes']['width']+';\x20height:\x20'+_0x4e2c43['attributes']['height']+';'+_0x336e5f}};});}}const mn={'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':Tn(0x5,'100%','44px','right'),'aiChatResources':Tn(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 Tn(_0x5aadcb,_0x3767ec,_0x467e77,_0x50161c){return new Array(_0x5aadcb)['fill'](null)['map'](()=>({'tag':'div','attributes':{'width':_0x3767ec,'height':_0x467e77,'align':_0x50161c}}));}class Cn extends Tt(){['queue']=[];['isProcessing']=!0x1;['_abortController'];async['enqueue'](_0xfd7dd9){const _0x52cbbe=this['createTask'](_0xfd7dd9);return this['queue']['push'](_0x52cbbe),this['_processQueue'](),_0x52cbbe['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(_0x35612f=>{this['once']('_queueEmpty',()=>{_0x35612f();});}):Promise['resolve']();}async['_processQueue'](){if(!this['isProcessing']){this['_abortController']=new AbortController(),this['isProcessing']=!0x0;try{for(;this['queue']['length']&&this['isProcessing'];){const _0x103881=this['queue']['shift']();try{await _0x103881['callback'](this['_abortController']['signal']),_0x103881['resolve']();}catch(_0x3f00b4){_0x103881['reject'](_0x3f00b4);}}}finally{this['isProcessing']=!0x1,this['_abortController']=void 0x0;}this['fire']('_queueEmpty');}}['createTask'](_0x8a8260){let _0x2273fa,_0x2da307;const _0x30639a=new Promise((_0x14eecd,_0x43fa1b)=>{_0x2273fa=_0x14eecd,_0x2da307=_0x43fa1b;});return{'callback':_0x8a8260,'resolve':_0x2273fa,'reject':_0x2da307,'completePromise':_0x30639a};}}class wn extends an{constructor(_0x37102c){super(_0x37102c),this['extendTemplate']({'attributes':{'class':['ck-ai-notification','warning'===_0x37102c['level']?'ck-ai-notification_warning':'ck-ai-notification_error']}});}['render'](){super['render'](),this['setContent'](this['options']['initialContent']),this['markAsDone']();}['setContent'](_0x439c49){this['element']['innerHTML']=_0x439c49;}}const fn=['applySuggestion','insertSuggestion'];class bn extends vt{['_applyChangesButton'];['_insertSuggestionsButton'];['children'];constructor(_0x1added,_0x4fe0a6=[...fn],_0x193997){super(_0x1added);const _0x4b2a71=this['bindTemplate'],_0x378ffd=Boolean(_0x193997);if(this['set']('isEnabled',!_0x378ffd),this['set']('isVisible',!0x1),this['set']('isTrackChangesOn',!0x1),this['children']=this['createCollection'](),_0x378ffd){const _0x21f4fb=new Nt(_0x1added);_0x21f4fb['set']({'label':hs(_0x1added,'AI_SUGGESTION_DISABLED_TOOLTIP_MESSAGE'),'tooltip':!0x0,'withText':!0x1,'icon':_0x138750}),_0x21f4fb['extendTemplate']({'attributes':{'data-cke-tooltip-class':'ck-ai-suggestion-content-part-disabled-actions-tooltip'}});const _0x3f3a45=new vt(_0x1added);_0x3f3a45['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-chat__feed__suggestion__actions__info'},'children':[{'tag':'p','children':[hs(_0x1added,'AI_SUGGESTION_DISABLED_FEED_MESSAGE'),_0x21f4fb]}]}),this['children']['add'](_0x3f3a45);}else this['_applyChangesButton']=new Nt(_0x1added),this['_applyChangesButton']['set']({'label':hs(_0x1added,'AI_CHAT_SUGGESTION_ACTION_APPLY_ALL'),'withText':!0x0,'type':'button','isVisible':_0x4fe0a6['includes']('applySuggestion'),'class':cs}),this['_insertSuggestionsButton']=new Nt(_0x1added),this['_insertSuggestionsButton']['set']({'label':hs(_0x1added,'AI_CHAT_SUGGESTION_ACTION_SUGGEST_ALL'),'withText':!0x0,'type':'button','isVisible':_0x4fe0a6['includes']('insertSuggestion'),'class':ls}),this['_insertSuggestionsButton']['on']('execute',()=>{this['fire']('insertSuggestion');}),this['_applyChangesButton']['on']('execute',()=>{this['fire']('applySuggestion');}),[this['_applyChangesButton'],this['_insertSuggestionsButton']]['forEach'](_0x5a2d02=>{_0x5a2d02['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',_0x4b2a71['if']('isVisible','ck-hidden',_0xb530e=>!_0xb530e)]},'children':this['children']}),this['on']('change:isTrackChangesOn',()=>{this['_applyChangesButton']&&(this['_applyChangesButton']['isVisible']=!this['isTrackChangesOn']);});}['updateVisibility'](_0x2befe7){this['isVisible']=_0x2befe7;}['_switchButtonLabelsPlurality'](_0xaedeba){this['_applyChangesButton']&&this['_insertSuggestionsButton']&&(_0xaedeba?(this['_applyChangesButton']['label']=hs(this['locale'],'AI_CHAT_SUGGESTION_ACTION_APPLY_ALL'),this['_insertSuggestionsButton']['label']=hs(this['locale'],'AI_CHAT_SUGGESTION_ACTION_SUGGEST_ALL')):(this['_applyChangesButton']['label']=hs(this['locale'],'AI_CHAT_SUGGESTION_ACTION_APPLY'),this['_insertSuggestionsButton']['label']=hs(this['locale'],'AI_CHAT_SUGGESTION_ACTION_SUGGEST')));}}class Sn extends vt{['children'];['balloonPanelView'];['bodyCollection'];constructor(_0x486a0c,_0x46e431){super(_0x486a0c),this['bodyCollection']=_0x46e431,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',_0x4c636c=>!_0x4c636c)]},'children':this['children']});const _0x262d6b=new vt(this['locale']),_0x179f7c=new xt();_0x179f7c['content']=_0xfff9b0,_0x262d6b['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-web-sources__header']},'children':[_0x179f7c,{'tag':'span','children':[{'text':hs(this['locale'],'AI_CHAT_SOURCES_HEADER')}]}]}),this['children']['add'](_0x262d6b),this['_setupBalloonPanel'](_0x486a0c);}['addSource'](_0x23fee8){this['children']['add'](new Rn(this['locale'],_0x23fee8,this['balloonPanelView']));}['_setupBalloonPanel'](_0x436947){this['balloonPanelView']=new Xt(_0x436947),this['balloonPanelView']['extendTemplate']({'attributes':{'class':['ck-ai-web-source__tooltip-balloon']}}),this['bodyCollection']['add'](this['balloonPanelView']);}}class Rn extends Nt{['balloonPanelView'];['source'];constructor(_0x5c1422,_0x35ac6d,_0x200ada){super(_0x5c1422),this['source']=_0x35ac6d,this['balloonPanelView']=_0x200ada,this['set']({'label':_0x35ac6d['title'],'class':['ck\x20ck-ai-web-source'],'withText':!0x0});const _0x3150a7=this['bindTemplate'];if(this['extendTemplate']({'on':{'click':_0x3150a7['to'](()=>{window['open'](_0x35ac6d['url'],'_blank');}),'mouseenter':_0x3150a7['to'](()=>{this['_showTooltip']();}),'mouseleave':_0x3150a7['to'](()=>{this['_hideTooltip']();})}}),_0x35ac6d['favicon']){const _0x2293ac=new vt(_0x5c1422);_0x2293ac['setTemplate']({'tag':'img','attributes':{'src':_0x35ac6d['favicon']||_0xfff9b0,'alt':_0x35ac6d['title'],'class':['ck-ai-web-source__image']}}),this['children']['add'](_0x2293ac);}else this['set']('icon',_0xfff9b0);}['_createTooltipContentView'](_0x4871e5,_0x3985f1){const _0x151a91=new vt(_0x4871e5),_0x8c2864=[];let _0x4adcec;_0x3985f1?.['favicon']?(_0x4adcec=new vt(_0x4871e5),_0x4adcec['setTemplate']({'tag':'img','attributes':{'src':_0x3985f1['favicon'],'alt':_0x3985f1['title'],'class':['ck-ai-web-source__tooltip-image']}})):(_0x4adcec=new xt(),_0x4adcec['content']=_0xfff9b0,_0x4adcec['extendTemplate']({'attributes':{'alt':_0x3985f1['title'],'class':['ck-ai-web-source__tooltip-image']}})),_0x8c2864['push'](_0x4adcec);const _0x2dc107=new vt(_0x4871e5);_0x2dc107['setTemplate']({'tag':'a','attributes':{'class':['ck-ai-web-source__tooltip-url'],'href':_0x3985f1['url']},'children':[{'text':new URL(_0x3985f1['url'])?.['hostname']}]}),_0x8c2864['push'](_0x2dc107);const _0x420d0f=new vt(_0x4871e5);_0x420d0f['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-web-source__tooltip-row']},'children':_0x8c2864});const _0x5bcf8e=new vt(_0x4871e5);return _0x5bcf8e['setTemplate']({'tag':'span','attributes':{'class':['ck-ai-web-source__tooltip-row','ck-ai-web-source__tooltip-title']},'children':[{'text':_0x3985f1['title']['length']>0x190?_0x3985f1['title']['substring'](0x0,0x190)+'...':_0x3985f1['title']}]}),_0x151a91['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-web-source__tooltip']},'children':[_0x420d0f,_0x5bcf8e]}),_0x151a91;}['_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 _0x122c74=this['_createTooltipContentView'](this['locale'],this['source']);this['balloonPanelView']['content']['add'](_0x122c74);}}class On extends vt{['_actionsView'];['_sourcesView'];['_children'];['_skeletonView'];['_showSkeletonDebounced']=_0x12ff54(()=>{this['_skeletonView']['isVisible']=!0x0,this['_skeletonShownAt']=Date['now']();},0x3e8);['_skeletonShownAt']=null;['_areActionsDisabled'];['_showUnchangedParts'];['_updateContentPartsPromiseQueue'];['_emptyPartsWarningView'];['_availableActions'];['_cachedContentParts']=[];constructor(_0x21f9ea,_0x13e124){super(_0x21f9ea);const {areActionsDisabled:_0x529a49,showUnchangedParts:_0x4c4924,availableActions:_0x120d1e}=_0x13e124;this['_areActionsDisabled']=_0x529a49,this['_showUnchangedParts']=_0x4c4924,this['_availableActions']=_0x120d1e,this['set']('hasPendingParts',!0x1),this['set']('isTrackChangesOn',!0x1),this['_children']=this['createCollection'](),this['_skeletonView']=new pn(_0x21f9ea,mn['aiSuggestionBody']),this['_skeletonView']['isVisible']=!0x0,this['_skeletonShownAt']=Date['now'](),this['_children']['add'](this['_skeletonView']),this['_updateContentPartsPromiseQueue']=new Cn(),this['_emptyPartsWarningView']=new wn({'id':'empty-parts-warning','initialContent':hs(_0x21f9ea,'AI_SUGGESTION_EMPTY_PART_WARNING'),'level':'warning'}),this['_emptyPartsWarningView']['isVisible']=!0x1,this['_actionsView']=new bn(_0x21f9ea,_0x13e124['availableActions'],this['_areActionsDisabled']),this['_actionsView']['bind']('isTrackChangesOn')['to'](this),this['_sourcesView']=new Sn(this['locale'],_0x13e124['bodyCollection']),_0x13e124['areActionsDisabled']?this['_actionsView']['isEnabled']=!0x1:this['_actionsView']['bind']('isEnabled')['to'](this,'hasPendingParts'),this['_actionsView']['delegate'](...Zs)['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'](_0x245922=>_0x245922 instanceof En);}async['updateContentParts']({parts:_0x18d16d,abortSignal:_0x59ff5b,skipLoadingEffects:_0x11f560}){this['_cachedContentParts']['length']?_0x18d16d['forEach'](_0x3a46cf=>{const _0xd50a1b=this['_cachedContentParts']['findIndex'](_0x194a3a=>_0x194a3a['index']==_0x3a46cf['index']);-0x1===_0xd50a1b?this['_cachedContentParts']['push'](_0x3a46cf):this['_cachedContentParts'][_0xd50a1b]=_0x3a46cf;}):this['_cachedContentParts']=_0x18d16d;const _0xb4bd78=this['_showUnchangedParts']?_0x18d16d:_0x18d16d['filter'](_0x2df9fe=>_0x2df9fe['hasChanges']);this['_actionsView']['_switchButtonLabelsPlurality'](_0xb4bd78['length']>0x1),_0x11f560&&(this['_showSkeletonDebounced']['cancel'](),this['_skeletonView']['isVisible']=!0x1);for(const _0x24bcc5 of _0xb4bd78)this['_updateContentPartsPromiseQueue']['enqueue'](async _0x5c3e6a=>{let _0x2cb707=this['getPartView'](_0x24bcc5['index']);if(!_0x2cb707){if(_0x2cb707=new En(this['locale'],{'part':_0x24bcc5,'uiIndex':this['_contentPartViews']['length']+0x1,'areActionsDisabled':this['_areActionsDisabled'],'availableActions':this['_availableActions']}),_0x2cb707['delegate'](...Zs)['to'](this),!_0x11f560&&(this['_showSkeletonDebounced']['cancel'](),await this['_awaitMinimumSkeletonDisplayTime'](_0x5c3e6a),_0x5c3e6a['aborted']))return;this['_skeletonView']['isVisible']=!0x1,this['_children']['add'](_0x2cb707,this['_children']['length']-0x1),this['hasPendingParts']=!0x0,_0x11f560||this['_showSkeletonDebounced']();}await _0x2cb707['updateContent']({'part':_0x24bcc5,'showUnchangedParts':this['_showUnchangedParts'],'abortSignal':_0x5c3e6a}),_0x2cb707['markAsDone']();});return _0x59ff5b?.['addEventListener']('abort',()=>{this['_updateContentPartsPromiseQueue']['abort'](),this['_showSkeletonDebounced']['cancel'](),this['_skeletonView']['isVisible']=!0x1;}),this['_updateContentPartsPromiseQueue']['queueEmptyPromise'];}['updatePartState'](_0x451ae6,_0x5d2c7f){const _0x2e9a19=this['getPartView'](_0x451ae6);_0x2e9a19&&(_0x2e9a19['state']=_0x5d2c7f),this['hasPendingParts']='pending'==_0x5d2c7f||this['_contentPartViews']['some'](_0x560f98=>'pending'==_0x560f98['state']);}['setPartActive'](_0xe7aa8e,_0x38d2f7){if(!0x1===_0xe7aa8e){for(const _0x4562a7 of this['_contentPartViews'])_0x4562a7['isActive']=!0x1;}else{const _0x1238a8=this['getPartView'](_0xe7aa8e);_0x1238a8&&(_0x1238a8['isActive']=_0x38d2f7);}}['updateSources'](_0x2f6e01){_0x2f6e01['forEach'](_0x53c45f=>this['_sourcesView']['addSource'](_0x53c45f)),this['_sourcesView']['isVisible']=!0x0;}['getPartView'](_0x3d9b16){return this['_contentPartViews']['find'](_0x11e147=>_0x11e147['partDefinition']['index']==_0x3d9b16)??null;}['markAsDone'](){if(!this['_showUnchangedParts']){const _0x27bb37=!this['_cachedContentParts']['find'](({hasChanges:_0x245d58})=>_0x245d58),_0xd9e3a2=!!this['_cachedContentParts']['find'](({hasChanges:_0x17eb6d})=>!_0x17eb6d);this['_emptyPartsWarningView']['isVisible']=0x0==this['_contentPartViews']['length']||_0xd9e3a2,_0x27bb37?this['_emptyPartsWarningView']['setContent'](hs(this['locale'],'AI_SUGGESTION_NO_PARTS_WARNING')):this['_emptyPartsWarningView']['setContent'](hs(this['locale'],'AI_SUGGESTION_EMPTY_PART_WARNING'));}this['_contentPartViews']['forEach'](_0x53ee13=>_0x53ee13['markAsDone']()),this['_skeletonView']['isVisible']=!0x1,this['_showSkeletonDebounced']['cancel'](),this['_actionsView']['updateVisibility'](this['hasNonEmptyParts']);}async['_awaitMinimumSkeletonDisplayTime'](_0x34371e){if(!this['_skeletonView']['isVisible']||null===this['_skeletonShownAt'])return;const _0x4c5ce0=0x3e8-(Date['now']()-this['_skeletonShownAt']);if(this['_skeletonShownAt']=null,_0x4c5ce0>0x0){const {promise:_0x1885d0,abortController:_0x260a24}=en(_0x4c5ce0);_0x34371e?.['addEventListener']('abort',()=>_0x260a24['abort']()),await _0x1885d0['catch'](()=>{});}}get['hasNonEmptyParts'](){return this['_contentPartViews']['filter'](_0x3f9d6a=>_0x3f9d6a['partDefinition']['hasChanges'])['length']>0x0;}}class kn extends vt{['bodyView'];['children'];['headerView'];constructor(_0xdc9692,_0x3be81c,_0x3176fc){super(_0xdc9692);const {showDiff:_0xc9e63f,areActionsDisabled:_0x2feb02,showUnchangedParts:_0x3173fb,availableActions:_0x5101a2}=_0x3be81c;this['set']('isTrackChangesOn',!0x1),this['set']('areChangesVisible',!0x1),this['children']=this['createCollection'](),this['headerView']=new hn(_0xdc9692,{'showDiff':_0xc9e63f}),this['headerView']['on']('toggleShowChanges',(_0x2f43ab,_0x407858)=>{this['areChangesVisible']=_0x407858['isOn'],this['fire']('toggleSuggestionDisplayMode',{'showDiff':_0x407858['isOn']});}),this['children']['add'](this['headerView']),this['bodyView']=new On(_0xdc9692,{'areActionsDisabled':_0x2feb02,'showUnchangedParts':!!_0x3173fb,'availableActions':_0x5101a2,'bodyCollection':_0x3176fc}),this['bodyView']['delegate'](...Zs)['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'](_0x8d76ca){await this['bodyView']['updateContentParts'](_0x8d76ca);}['updateSources'](_0x420b03){this['bodyView']['updateSources'](_0x420b03);}['markAsDone'](){this['bodyView']['markAsDone'](),this['headerView']&&(this['headerView']['isShowChangesToggleVisible']=this['bodyView']['hasNonEmptyParts']);}}class Nn extends an{['containerView'];constructor(_0x40415d,_0x4b3664,_0x5af4b5){super(_0x4b3664),this['set']('isTrackChangesOn',!0x1),this['containerView']=new kn(_0x40415d,{'showDiff':_0x4b3664['showDiff'],'areActionsDisabled':_0x4b3664['areActionsDisabled'],'availableActions':_0x4b3664['availableActions']},_0x5af4b5),this['containerView']['on']('toggleSuggestionDisplayMode',(_0xfc5be4,_0x39562a)=>{this['fire']('toggleSuggestionDisplayMode',{'replyId':this['options']['id'],'showDiff':_0x39562a['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',(_0x372567,{index:_0x37de4d})=>{this['fire']('showChangeInText',{'replyId':this['options']['id'],'partIndex':_0x37de4d});}),this['containerView']['on']('applySuggestion',(_0x59d6b3,{index:_0x63921f}={})=>{this['fire']('applySuggestion',{'replyId':this['options']['id'],'partIndex':_0x63921f});}),this['containerView']['on']('insertSuggestion',(_0x59434b,{index:_0x5e05fb}={})=>{this['fire']('insertSuggestion',{'replyId':this['options']['id'],'partIndex':_0x5e05fb});}),this['containerView']['on']('rejectSuggestion',(_0x1eb059,{index:_0x5371f0})=>{this['fire']('rejectSuggestion',{'replyId':this['options']['id'],'partIndex':_0x5371f0});}),this['containerView']['on']('mouseOverSuggestion',(_0xaaa20,{index:_0x36db12})=>{this['fire']('mouseOverSuggestion',{'replyId':this['options']['id'],'partIndex':_0x36db12});}),this['containerView']['on']('mouseLeaveSuggestion',(_0x1c6094,{index:_0x188990})=>{this['fire']('mouseLeaveSuggestion',{'replyId':this['options']['id'],'partIndex':_0x188990});}),this['children']['addMany']([this['containerView']]),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__ai-suggestion']}});}async['updateContent'](_0x2d0374){await this['containerView']['updateContent'](_0x2d0374);}['updatePartState'](_0x17bfc9,_0x4d8284){this['containerView']['bodyView']['updatePartState'](_0x17bfc9,_0x4d8284);}['setPartActive'](_0x1f30f6,_0x21ef4f){!0x1===_0x1f30f6?this['containerView']['bodyView']['setPartActive'](!0x1):this['containerView']['bodyView']['setPartActive'](_0x1f30f6,_0x21ef4f);}['updateSources'](_0x5a8f0d){this['containerView']['updateSources'](_0x5a8f0d);}['getPartView'](_0x268ff0){return this['containerView']['bodyView']['getPartView'](_0x268ff0);}['markAsDone'](){super['markAsDone'](),this['containerView']['markAsDone']();}}class vn extends an{['replyContainer'];['_bodyCollection'];constructor(_0x1303e5,_0x2ab1c3,_0x58bce3){super(_0x2ab1c3),this['_bodyCollection']=_0x58bce3,this['locale']=_0x1303e5,this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__ai-reply']}}),this['replyContainer']=new vt(),this['replyContainer']['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all-excluded','ck-ai-chat__feed__ai-reply-container']}}),this['children']['add'](this['replyContainer']);}async['render'](){super['render'](),this['options']['initialContent']&&(await this['updateContent']({'parsedContent':_s(this['options']['initialContent']),'renderingStrategy':'static'}),this['markAsDone']());}async['updateContent']({parsedContent:_0x160743,renderingStrategy:_0x577415,abortSignal:_0x49149e}){'streaming'===_0x577415?await this['streamIntoElement'](_0x160743,this['replyContainer']['element'],_0x49149e):this['replyContainer']['element']['innerHTML']=ti(_0x160743);}['updateSources'](_0x31eb66){const _0x5b9306=new Sn(this['locale'],this['_bodyCollection']);_0x5b9306['children']['addMany'](_0x31eb66['map'](_0x534bdb=>new Rn(this['locale'],_0x534bdb,_0x5b9306['balloonPanelView']))),_0x5b9306['isVisible']=!0x0,this['children']['add'](_0x5b9306);}}class yn extends yt{constructor(_0x3d1714=void 0x0){super();const _0x655ba0=_0x3d1714?'ck-ai-spinner_'+_0x3d1714:'';this['extendTemplate']({'tag':'span','attributes':{'class':['ck-ai-spinner',_0x655ba0]}});}}const xn={'file':_0xc51032,'document':_0x3e528c,'web-resource':_0xe5297c,'text':_0xc51032,'selection':_0xa1a1f9,'mcp-tool-context':_0x3e528c},Ln='ck-ai-chat-context-chip',Dn='ck-ai-chat-context-chip_wide',Pn='ck-ai-chat-context-chip_document',Hn='ck-ai-chat-context-chip__label',Mn='ck-ai-chat-context-chip__type-icon',Un='ck-ai-chat-context-controls__chip-tooltip',Vn='n';class Bn extends Nt{constructor(_0x4eccf0,_0x4a2327,_0xa172a7,_0x3a90aa,_0x1ed8b8=!0x1){super(_0x4eccf0),this['_isAnimationOnEnterEnabled']=_0x3a90aa,this['_initializeProperties'](_0x4a2327,_0xa172a7,_0x1ed8b8),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'](_0x39f961,_0x1e58fe,_0x4983f1){this['set']('label',_0x39f961['label']),this['set']('tooltip',!0x0),this['set']('itemType',_0x39f961['type']),this['set']('id',_0x39f961['uiId']),this['set']('readonly',_0x1e58fe),this['set']('isLoading',_0x4983f1);}['_setupTemplate'](){const _0x484a10=this['_createIconView'](),_0x587df5=this['_createRemoveButton'](),_0x54586d=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':this['_createTemplateAttributes'](_0x54586d),'children':this['_createTemplateChildren'](_0x484a10,_0x587df5,_0x54586d)});}['_createTemplateAttributes'](_0xbb725e){return{'class':[Ln,_0xbb725e['if']('itemType',Pn,_0x37a1ff=>'document'==_0x37a1ff),_0xbb725e['if']('itemType',Dn,_0x737e83=>'selection'==_0x737e83)],'data-cke-tooltip-text':_0xbb725e['to']('label',Gn),'data-cke-tooltip-position':Vn,'data-cke-tooltip-class':Un};}['_createTemplateChildren'](_0x184828,_0x299fd1,_0x1f81be){const _0x702eb=this['_createLabelElement'](_0x1f81be),_0x1ad5b5=this['_createLoaderIcon']();return this['readonly']?[_0x184828,_0x702eb]:[_0x184828,_0x1ad5b5,_0x702eb,_0x299fd1];}['_createLabelElement'](_0x5afc22){return{'tag':'span','attributes':{'class':Hn},'children':[{'text':_0x5afc22['to']('label')}]};}['_createRemoveButton'](){const _0x1cfe4e=new Nt(this['locale']);return _0x1cfe4e['set']({'label':hs(this['locale'],'AI_CHAT_CONTEXT_REMOVE_FROM_CONTEXT'),'icon':_0x35e3e9}),this['_setupRemoveButtonEvent'](_0x1cfe4e),_0x1cfe4e;}['_setupRemoveButtonEvent'](_0x10d9fb){_0x10d9fb['on']('execute',()=>{this['fire']('removeContextItemChip',this['id']);});}['_createIconView'](){const _0x5d714f=this['bindTemplate'],_0x2e9ad2=new xt();return _0x2e9ad2['content']=xn[this['itemType']],_0x2e9ad2['extendTemplate']({'attributes':{'class':[Mn,_0x5d714f['if']('isLoading','ck-hidden',_0x244d18=>_0x244d18)]}}),_0x2e9ad2;}['_handleAnimationEndOnce'](_0x54e2f8,_0xacdc9a){if(!_0x54e2f8)return;const _0x315607=()=>{_0xacdc9a(),_0x54e2f8['removeEventListener']('animationend',_0x315607),_0x54e2f8['removeEventListener']('webkitAnimationEnd',_0x315607);};_0x54e2f8['addEventListener']('animationend',_0x315607),_0x54e2f8['addEventListener']('webkitAnimationEnd',_0x315607);}['_createLoaderIcon'](){const _0x2d07ba=new yn('small');return _0x2d07ba['bind']('isVisible')['to'](this,'isLoading',_0x25b0c8=>_0x25b0c8),_0x2d07ba;}}function Gn(_0x104f35){if(!_0x104f35)return _0x104f35;if(_0x104f35['length']<=0x78)return _0x104f35;const _0x1793c7=_0x104f35['slice'](0x0,0x78),_0x5bcf9d=_0x1793c7['lastIndexOf']('\x20');return(_0x5bcf9d>0x0?_0x1793c7['slice'](0x0,_0x5bcf9d):_0x1793c7)+'…';}const Fn={'maxVisibleRows':0x2,'rowDetectionTolerance':0x5,'showMoreLabelPrefix':'+\x20','viewportOffset':{'top':0x64,'bottom':0xa}},Kn='300px';class Wn{['_locale'];['_config'];['_visibleChips'];['_overflowChips'];['_showMoreButtonView']=null;['_showMoreBalloonPanelView']=null;['_containerElement']=null;['_bodyCollection'];['_parentView']=null;['_intersectionObserver']=null;['_pendingCalculation']=!0x1;constructor(_0x26d383,_0xfa0098,_0x26bb0b,_0x58587a,_0x4c2534){this['_locale']=_0x26d383,this['_visibleChips']=_0xfa0098,this['_config']={...Fn,..._0x26bb0b,'cssClasses':{'controlsButton':'','calculationContainer':'ck-calculation-container',..._0x26bb0b['cssClasses']}},this['_overflowChips']=new dt(),this['_bodyCollection']=_0x58587a,this['_parentView']=_0x4c2534||null;}['setContainerElement'](_0x399b9c){this['_intersectionObserver']&&(this['_intersectionObserver']['disconnect'](),this['_intersectionObserver']=null),this['_containerElement']=_0x399b9c,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 _0x252d24=[...this['_visibleChips'],...this['_overflowChips']],_0x3c4d43=this['_createCalculationContainer'](),_0xf5697c=this['_calculateOverflowInContainer'](_0x3c4d43,_0x252d24),_0x424b64=_0x3c4d43['_ancestorsToRestore'];_0x424b64&&this['_restoreAncestorVisibility'](_0x424b64),_0x3c4d43['remove'](),this['_applyOverflowResults'](_0x252d24,_0xf5697c);}['_createShowMoreButton'](){this['_showMoreButtonView']=this['_createShowMoreButtonView'](),this['_showMoreBalloonPanelView']=this['_createShowMoreBalloonPanelView'](),this['_showMoreButtonView']['render'](),this['_containerElement']['appendChild'](this['_showMoreButtonView']['element']),this['_showMoreButtonView']['on']('execute',()=>{this['_handleShowMoreButtonClick']();}),zt({'emitter':this['_showMoreBalloonPanelView'],'contextElements':[this['_showMoreBalloonPanelView']['element'],this['_showMoreButtonView']['element']],'callback':()=>this['hideBalloonPanel'](),'activator':()=>this['_showMoreButtonView']['isOn']});}['_createShowMoreButtonView'](){const _0x16f522=new Nt(this['_locale']);_0x16f522['set']({'label':'','withText':!0x0,'isToggleable':!0x0});const _0x2c8189=[this['_config']['cssClasses']['showMoreButton']];return this['_config']['cssClasses']['controlsButton']&&_0x2c8189['push'](this['_config']['cssClasses']['controlsButton']),_0x16f522['extendTemplate']({'attributes':{'class':_0x2c8189}}),_0x16f522;}['_createShowMoreBalloonPanelView'](){const _0x4c9f5c=new Xt(this['_locale']);return _0x4c9f5c['extendTemplate']({'attributes':{'class':this['_config']['cssClasses']['showMoreBalloon']}}),this['_bodyCollection']['add'](_0x4c9f5c),_0x4c9f5c;}['_updateBalloonContent'](){if(this['_showMoreBalloonPanelView']&&(this['_showMoreBalloonPanelView']['content']['clear'](),this['_overflowChips']['length']>0x0)){this['_overflowChips']['forEach'](_0x54d5f2=>{_0x54d5f2['disableAnimationOnEnter']();});const _0x2348ee=new vt(this['_locale']);_0x2348ee['setTemplate']({'tag':'div','attributes':{'class':this['_config']['cssClasses']['overflowContainer']},'children':this['_overflowChips']}),this['_showMoreBalloonPanelView']['content']['add'](_0x2348ee);}}['_handleShowMoreButtonClick'](){this['_showMoreButtonView']['isOn']?this['hideBalloonPanel']():this['showBalloonPanel']();}['_updateShowMoreButtonVisibility'](){const _0x265def=this['_overflowChips']['length']>0x0;this['_showMoreButtonView']?.['element']&&(this['_showMoreButtonView']['element']['style']['display']=_0x265def?'':'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'](_0x52e9f0){const _0x127e29=this['_containerElement']?.['tagName']['toLowerCase']()||'div',_0x383597=this['_containerElement']?.['classList'];if(_0x383597){const _0x2e7955=_0x383597[0x0]||'',_0xd2899d=_0x52e9f0['querySelector']('.'+_0x2e7955),_0x56359b=_0x52e9f0['querySelector'](_0x127e29);return _0xd2899d||_0x56359b||_0x52e9f0;}return _0x52e9f0['querySelector'](_0x127e29)||_0x52e9f0;}['_calculateContainerWidth'](){const _0x48ba79=this['_parentView']?.['element']||this['_containerElement'];if(!_0x48ba79)return Kn;const _0x48d7e9=window['getComputedStyle'](_0x48ba79)['width'];if('auto'===_0x48d7e9||'0px'===_0x48d7e9||!_0x48d7e9){const _0x1d4f6f=_0x48ba79['parentElement'];if(_0x1d4f6f){const _0x1ff3fd=window['getComputedStyle'](_0x1d4f6f);return'auto'!==_0x1ff3fd['width']?_0x1ff3fd['width']:Kn;}return Kn;}return _0x48d7e9;}['_applyCalculationStyles'](_0x17f92a,_0x4f566d){this['_config']['cssClasses']['calculationContainer']&&_0x17f92a['classList']['add'](this['_config']['cssClasses']['calculationContainer']),_0x17f92a['style']['width']=_0x4f566d,_0x17f92a['style']['position']='absolute',_0x17f92a['style']['top']='-9999px',_0x17f92a['style']['left']='-9999px',_0x17f92a['style']['opacity']='0',_0x17f92a['style']['pointerEvents']='none',_0x17f92a['style']['zIndex']='-1',_0x17f92a['style']['visibility']='visible\x20!important',_0x17f92a['style']['display']='block\x20!important',_0x17f92a['style']['boxSizing']='border-box';}['_restoreAncestorVisibility'](_0x7ee726){_0x7ee726['forEach'](({element:_0x2d391e,originalDisplay:_0x304710,originalVisibility:_0x25ca0d})=>{_0x2d391e['style']['display']=_0x304710,_0x2d391e['style']['visibility']=_0x25ca0d;});}['_makeAncestorsVisible'](_0x549800){const _0x20f7be=[];let _0x3e8f81=_0x549800;for(;_0x3e8f81&&_0x3e8f81!==document['body'];){const _0x158eed=window['getComputedStyle'](_0x3e8f81);'none'!==_0x158eed['display']&&'hidden'!==_0x158eed['visibility']||(_0x20f7be['push']({'element':_0x3e8f81,'originalDisplay':_0x3e8f81['style']['display'],'originalVisibility':_0x3e8f81['style']['visibility']}),_0x3e8f81['style']['display']='block',_0x3e8f81['style']['visibility']='visible'),_0x3e8f81=_0x3e8f81['parentElement'];}return _0x20f7be;}['_createContainerElements'](){let _0x15617d,_0x1f0d4d;return this['_parentView']?.['element']?(_0x15617d=this['_parentView']['element']['cloneNode'](!0x0),_0x1f0d4d=this['_findTargetContainer'](_0x15617d)):(_0x15617d=document['createElement']('div'),_0x1f0d4d=_0x15617d),{'calculationContainer':_0x15617d,'targetContainer':_0x1f0d4d};}['_createCalculationContainer'](){const {calculationContainer:_0x84c82f,targetContainer:_0x486b00}=this['_createContainerElements'](),_0x163844=this['_calculateContainerWidth']();this['_applyCalculationStyles'](_0x84c82f,_0x163844);const _0x40a238=this['_parentView']?.['element']||this['_containerElement'],_0x488293=_0x40a238?.['parentElement'];_0x488293?_0x488293['appendChild'](_0x84c82f):document['body']['appendChild'](_0x84c82f),_0x84c82f['_targetContainer']=_0x486b00;const _0x2c788a=this['_makeAncestorsVisible'](_0x488293||null);return _0x84c82f['offsetWidth'],_0x84c82f['_ancestorsToRestore']=_0x2c788a,_0x84c82f;}['_calculateOverflowInContainer'](_0x15fd04,_0x40daa0){const _0x19bc9a=_0x15fd04['_targetContainer']||_0x15fd04,_0x12d2ca=[],{rowCount:_0x14591f}=this['_renderChipsAndCountRows'](_0x19bc9a,_0x40daa0);if(_0x14591f<=this['_config']['maxVisibleRows'])return _0x12d2ca;const _0xaf3868=_0x40daa0['slice']();for(;_0xaf3868['length']>0x0;){if(this['_testButtonFit'](_0x15fd04,_0x19bc9a,_0xaf3868)){const _0x1b8b2f=_0x40daa0['filter'](_0xf151d9=>!_0xaf3868['includes'](_0xf151d9));_0x12d2ca['push'](..._0x1b8b2f);break;}if(!_0xaf3868['pop']())break;}return _0x12d2ca;}['_renderChipsAndCountRows'](_0x2dd621,_0x28d551){_0x2dd621['innerHTML']='',_0x28d551['forEach'](_0x4abe87=>{if(_0x4abe87['element']){const _0xf85944=_0x4abe87['element']['cloneNode'](!0x0);_0x2dd621['appendChild'](_0xf85944);}}),_0x2dd621['offsetWidth'];const _0x3f57b5=_0x2dd621['children'],_0x2d5b3c=[];return Array['from'](_0x3f57b5)['forEach'](_0x347fbf=>{const _0x9990ad=_0x347fbf['getBoundingClientRect']()['top'];_0x2d5b3c['some'](_0x1fe1a6=>Math['abs'](_0x1fe1a6-_0x9990ad)<this['_config']['rowDetectionTolerance'])||_0x2d5b3c['push'](_0x9990ad);}),{'rowCount':_0x2d5b3c['length']};}['_createMockButton'](){const _0x2568bf=document['createElement']('button');return _0x2568bf['className']=this['_config']['cssClasses']['showMoreButton'],this['_config']['cssClasses']['controlsButton']&&_0x2568bf['classList']['add'](this['_config']['cssClasses']['controlsButton']),_0x2568bf['textContent']='+\x201',_0x2568bf;}['_testButtonFit'](_0x5b1429,_0x5c381b,_0x1078d9){this['_renderChipsAndCountRows'](_0x5c381b,_0x1078d9);const _0xf537dc=this['_createMockButton']();_0x5b1429['appendChild'](_0xf537dc),_0x5b1429['offsetWidth'];const _0x2588b9=[..._0x5c381b['children'],_0xf537dc],_0x2648d6=[];_0x2588b9['forEach'](_0x565cc7=>{const _0x52232e=_0x565cc7['getBoundingClientRect']()['top'];_0x2648d6['some'](_0x1effcb=>Math['abs'](_0x1effcb-_0x52232e)<this['_config']['rowDetectionTolerance'])||_0x2648d6['push'](_0x52232e);});const _0x22ad56=_0x2648d6['length'];return _0xf537dc['remove'](),_0x22ad56<=this['_config']['maxVisibleRows'];}['_distributeChips'](_0x2292d8,_0x587b26){this['_visibleChips']['clear'](),this['_overflowChips']['clear'](),_0x2292d8['forEach'](_0x3ff212=>{_0x587b26['includes'](_0x3ff212)?this['_overflowChips']['add'](_0x3ff212):this['_visibleChips']['add'](_0x3ff212);});}['_updateOverflowUI'](_0xfadf6){if(_0xfadf6>0x0&&!this['_showMoreButtonView']&&this['_createShowMoreButton'](),_0xfadf6>0x0&&this['_showMoreButtonView']){const _0xf543d0=''+this['_config']['showMoreLabelPrefix']+(_0xfadf6<0x63?_0xfadf6:'99');this['_showMoreButtonView']['label']=_0xf543d0;}this['_updateBalloonContent'](),this['_updateShowMoreButtonVisibility'](),this['_repinBalloonPanel']();}['_applyOverflowResults'](_0x14b24e,_0x41c166){this['_distributeChips'](_0x14b24e,_0x41c166),this['_updateOverflowUI'](_0x41c166['length']);}['_setupVisibilityObserver'](){this['_containerElement']&&'undefined'!=typeof IntersectionObserver&&(this['_intersectionObserver']=new IntersectionObserver(_0x51d60d=>{_0x51d60d[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 _0x92cc0e=this['_containerElement']['getBoundingClientRect']();if(0x0===_0x92cc0e['width']||0x0===_0x92cc0e['height'])return!0x1;const _0x34ba2e=window['innerHeight']||document['documentElement']['clientHeight'],_0x1a9574=window['innerWidth']||document['documentElement']['clientWidth'],_0x24c3d8=0xc8;return _0x92cc0e['bottom']>=-0xc8&&_0x92cc0e['top']<=_0x34ba2e+_0x24c3d8&&_0x92cc0e['right']>=-0xc8&&_0x92cc0e['left']<=_0x1a9574+_0x24c3d8;}}const Yn='ck-ai-chat__feed__context-chips',$n='ck-ai-chat-context-chips-wrapper',qn='ck-ai-chat-context-chips-wrapper-balloon',Qn='ck-ai-chat-controls-button',Xn='ck-ai-chat-controls_context_show-more-button',zn='ck-ai-chat-context-controls__show-more-balloon-panel';class jn extends vt{['_contextChips']=this['createCollection']();['_overflowManager'];['_bodyCollection'];constructor(_0x509f92,_0x13f884,_0x55b557){super(_0x509f92),this['_bodyCollection']=_0x55b557,this['_createContextChips'](_0x13f884);const _0x3562cd={'cssClasses':{'showMoreButton':Xn+'\x20'+us,'showMoreBalloon':zn,'overflowContainer':qn,'controlsButton':Qn}};this['_overflowManager']=new Wn(_0x509f92,this['_contextChips'],_0x3562cd,this['_bodyCollection'],this),this['setTemplate']({'tag':'div','attributes':{'class':[Yn,'ck','ck-reset_all']},'children':[{'tag':'div','attributes':{'class':$n},'children':this['_contextChips']}]});}['render'](){super['render']();const _0x4734af=this['element']['querySelector']('.'+$n);_0x4734af&&(this['_overflowManager']['setContainerElement'](_0x4734af),this['_overflowManager']['reorganizeChips']());}['destroy'](){super['destroy'](),this['_overflowManager']['destroy']();}['_createContextChips'](_0x488b7d){for(const _0xbaacf6 of _0x488b7d){const _0x56b202=new Bn(this['locale'],_0xbaacf6,!0x0,!0x1);this['_contextChips']['add'](_0x56b202);}}}class Jn extends an{['_contextChipsView']=null;['_locale'];['_bodyCollection'];['_messageContentView'];constructor(_0x35ed1f,_0x3c75ee,_0x49fb19){super(_0x3c75ee),this['_locale']=_0x35ed1f,this['_bodyCollection']=_0x49fb19,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 jn(this['_locale'],this['options']['contextItems']['filter'](_0x248997=>!_0x248997['hidden']),this['_bodyCollection']),this['_contextChipsView']['extendTemplate']({'attributes':{'class':'ck-ai-chat__feed__context-chips'}}),this['children']['add'](this['_contextChipsView']));}['_createMessageContentView'](){this['_messageContentView']=new vt(this['_locale']),this['_messageContentView']['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-chat__feed__message-content'}}),this['children']['add'](this['_messageContentView']);}['render'](){super['render'](),this['_messageContentView']['element']['innerHTML']=this['options']['initialContent'],this['markAsDone']();}}class Zn extends an{['capabilities'];constructor(_0x3aefa1,_0x84dc92){super(_0x84dc92);const {isWebSearchEnabled:_0x13406a,isReasoningEnabled:_0x51843f}=_0x84dc92['capabilities'],_0x5e7268=[];let _0x20d459='';_0x13406a&&_0x51843f?(_0x20d459=hs(_0x3aefa1,'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH_REASONING'),_0x5e7268['push'](tr(_0xfff9b0)),_0x5e7268['push'](tr(_0x3d54c0))):_0x13406a?(_0x20d459=hs(_0x3aefa1,'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH'),_0x5e7268['push'](tr(_0xfff9b0))):_0x51843f&&(_0x20d459=hs(_0x3aefa1,'AI_CHAT_FEED_REPLY_ITEM_USED_REASONING'),_0x5e7268['push'](tr(_0x3d54c0))),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__interaction-header',_0x20d459?'':'ck-hidden']}});const _0xd72082=new vt();_0xd72082['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__interaction-header__capabilities']},'children':[..._0x5e7268,{'tag':'span','attributes':{'class':['ck-ai-chat__feed__interaction-header__capabilities__text']},'children':[_0x20d459]}]}),this['children']['add'](_0xd72082),this['capabilities']=_0x84dc92['capabilities'];}}function tr(_0x370de4){const _0x43566e=new xt();return _0x43566e['content']=_0x370de4,_0x43566e;}const er=['wheel','touchstart','pointerdown','keydown'],ir=['ArrowUp','ArrowDown','PageUp','PageDown','Home','End','\x20'];class sr{['element'];['animationFrameId'];['isRunning'];['abortController'];['isUserPaused'];['scrollBehavior'];constructor(_0x1bb301){this['element']=_0x1bb301,this['animationFrameId']=null,this['isRunning']=!0x1,this['abortController']=new AbortController(),this['isUserPaused']=!0x1,this['scrollBehavior']='smooth';for(const _0x5819ba of er){const _0x58af31='keydown'!==_0x5819ba;this['element']['addEventListener'](_0x5819ba,this['_onUserEvent']['bind'](this),{'passive':_0x58af31,'signal':this['abortController']['signal']});}}['start']({smooth:_0x3bb6d8=!0x0}={}){this['isRunning']||(this['isRunning']=!0x0,this['isUserPaused']=!0x1,this['scrollBehavior']=_0x3bb6d8?'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'](_0xe36cfd){if(this['isRunning']){if('keydown'===_0xe36cfd['type']){const _0x5817be=_0xe36cfd['key'];if(!ir['includes'](_0x5817be))return;}_0xe36cfd instanceof WheelEvent?_0xe36cfd['deltaY']<0x0?this['isUserPaused']=!0x0:this['isUserPaused']=!this['_isAtBottom']():this['isUserPaused']=!0x0;}}['_isAtBottom'](){const {scrollTop:_0x299881,scrollHeight:_0x1b96b6,clientHeight:_0x449034}=this['element'];return _0x1b96b6-_0x299881-_0x449034<=0x5;}['_rafUpdate'](){this['isRunning']&&(this['isUserPaused']||this['element']['scrollTo']({'top':this['element']['scrollHeight'],'behavior':this['scrollBehavior']}),this['animationFrameId']=requestAnimationFrame(this['_rafUpdate']['bind'](this)));}}class nr extends an{constructor(_0x4a998a){super(_0x4a998a),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__custom-element']}});}async['render'](){super['render'](),'string'==typeof this['options']['content']?this['element']['innerHTML']=this['options']['content']:this['element']['appendChild'](this['options']['content']);}}class rr extends vt{['children'];['scrollManager'];['_bodyCollection'];constructor(_0x140525,_0x356b67){super(_0x140525),this['_bodyCollection']=_0x356b67,this['set']('loadingMessage',''),this['set']('isLoadingSkeletonVisible',!0x1),this['set']('isTrackChangesOn',!0x1),this['children']=this['createCollection'](),this['children']['delegate'](...tn)['to'](this),this['_setupTemplate']();}['render'](){super['render'](),this['scrollManager']=new sr(this['element']);}['destroy'](){super['destroy'](),this['scrollManager']['destroy']();}['clear'](){this['children']['clear']();}['addItem'](_0x2acc74,_0x57dc46){let _0x4373ae;return'ai-reply'===_0x2acc74?_0x4373ae=new vn(this['locale'],_0x57dc46,this['_bodyCollection']):'ai-suggestion-reply'===_0x2acc74?(_0x4373ae=new Nn(this['locale'],_0x57dc46,this['_bodyCollection']),_0x4373ae['bind']('isTrackChangesOn')['to'](this)):_0x4373ae='user-message'===_0x2acc74?new Jn(this['locale'],_0x57dc46,this['_bodyCollection']):'interaction-header'===_0x2acc74?new Zn(this['locale'],_0x57dc46):'custom-element'===_0x2acc74?new nr(_0x57dc46):new wn(_0x57dc46),this['children']['add'](_0x4373ae),_0x4373ae;}async['updateReplyItem']({id:_0xc01b38,parsedContent:_0x514f9e,renderingStrategy:_0x339b4f,abortSignal:_0x38dd6c}){const _0x2f0f51=this['getItemById'](_0xc01b38);if(!(_0x2f0f51 instanceof vn))throw new at('ai-chat-feed-view-item-not-a-reply-item',null,{'itemView':_0x2f0f51,'id':_0xc01b38,'parsedContent':_0x514f9e});await _0x2f0f51['updateContent']({'parsedContent':_0x514f9e,'renderingStrategy':_0x339b4f,'abortSignal':_0x38dd6c});}async['updateWebSources'](_0x12d830,_0xb43481){const _0xb85913=this['getItemById'](_0x12d830);if(_0xb85913 instanceof Nn)_0xb85913['updateSources'](_0xb43481);else{if(!(_0xb85913 instanceof vn))throw new at('ai-chat-feed-view-item-not-a-suggestion-or-reply-item',null,{'itemView':_0xb85913,'id':_0x12d830,'sources':_0xb43481});_0xb85913['updateSources'](_0xb43481);}}async['updateSuggestionItem']({id:_0x556f8b,parts:_0x54b029,abortSignal:_0x33ce6c,skipLoadingEffects:_0x5aea95}){const _0x31dd85=this['getItemById'](_0x556f8b);if(!(_0x31dd85 instanceof Nn))throw new at('ai-chat-feed-view-item-not-a-suggestion-item',null,{'itemView':_0x31dd85,'id':_0x556f8b,'parts':_0x54b029});await _0x31dd85['updateContent']({'parts':_0x54b029,'abortSignal':_0x33ce6c,'skipLoadingEffects':_0x5aea95});}['updateSuggestionPartState']({id:_0x342eaa,index:_0x48b3c0,state:_0x401a0a}){const _0x30c3d1=this['getItemById'](_0x342eaa);if(!(_0x30c3d1 instanceof Nn))throw new at('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0x342eaa});_0x30c3d1['updatePartState'](_0x48b3c0,_0x401a0a);}['setSuggestionPartActive']({id:_0x1715dd,index:_0x5d1339,isActive:_0x356c8d}){const _0x5a521e=this['getItemById'](_0x1715dd);if(!(_0x5a521e instanceof Nn))throw new at('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0x1715dd});this['children']['filter'](_0x4038b7=>_0x4038b7 instanceof Nn)['forEach'](_0x53a142=>{_0x53a142['setPartActive'](!0x1);}),_0x5a521e['setPartActive'](_0x5d1339,_0x356c8d);}['markItemAsDone'](_0x5b7623){this['getItemById'](_0x5b7623)['markAsDone']();}['getItemIds'](){return this['children']['map'](_0x5369ae=>_0x5369ae['options']['id']);}['removeItem'](_0x9fd937){this['children']['remove'](this['getItemById'](_0x9fd937));}['hasItem'](_0x4774b6){return!!this['children']['find'](_0x21113f=>_0x21113f['options']['id']['includes'](_0x4774b6));}['scrollToSuggestion'](_0x2a9dc,_0x4e38c9){const _0x1225c4=this['getItemById'](_0x2a9dc);if(!(_0x1225c4 instanceof Nn))return void It('ck-ai-chat-feed-view-scroll-to-suggestion-invalid-item',{'replyId':_0x2a9dc,'partIndex':_0x4e38c9});const _0xcd3d93=_0x1225c4['getPartView'](_0x4e38c9);_0xcd3d93?ft(_0xcd3d93['element'],0x14,this['element']['parentElement'],!0x0,!0x0):It('ck-ai-chat-feed-view-scroll-to-suggestion-part-view-not-found',{'replyId':_0x2a9dc,'partIndex':_0x4e38c9});}['_setupTemplate'](){this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed']},'children':this['_createTemplateChildren']()});}['_createTemplateChildren'](){const _0x473112=this['_createSkeletonLoader']();return[this['_createFeedItems'](),_0x473112,this['_createFeedLoader']()];}['_createSkeletonLoader'](){const _0x458521=new pn(this['locale'],mn['aiFeed']);return _0x458521['bind']('isVisible')['to'](this,'isLoadingSkeletonVisible'),_0x458521;}['_createFeedItems'](){const _0x1b806a=new vt(this['locale']);return _0x1b806a['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__items',this['bindTemplate']['if']('isLoadingSkeletonVisible','ck-hidden')]},'children':this['children']}),_0x1b806a;}['_createFeedLoader'](){const _0x8e7395=new vt(this['locale']);return _0x8e7395['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__loader',this['bindTemplate']['if']('loadingMessage','ck-hidden',_0xa52456=>!_0xa52456)]},'children':this['_createLoaderChildren']()}),_0x8e7395;}['_createLoaderChildren'](){const _0x57820b=new yn();return _0x57820b['isVisible']=!0x0,[_0x57820b,{'tag':'span','attributes':{'class':['ck','ck-ai-chat__loader-text']},'children':[{'text':this['bindTemplate']['to']('loadingMessage')}]}];}['getItemById'](_0x2f8c91){const _0x21aad1=this['children']['find'](_0xee72b7=>_0xee72b7['options']['id']['includes'](_0x2f8c91));if(!_0x21aad1)throw new at('ai-chat-feed-view-item-not-found',this,{'id':_0x2f8c91});return _0x21aad1;}['setLoadingMessage'](_0x33ec69){this['set']('loadingMessage',_0x33ec69);}['toggleLoadingSkeleton'](_0x51fedc){this['set']('isLoadingSkeletonVisible',_0x51fedc);}['startAutoScroll'](_0x4c6248={}){this['scrollManager']['start'](_0x4c6248);}['stopAutoScroll'](){this['scrollManager']['stop']();}}class or extends Dt{['filter'](){let _0x46496b=0x0;for(const _0x338951 of this['items'])_0x46496b+=_0x338951['items']['length'];return{'resultsCount':_0x46496b,'totalItemsCount':_0x46496b};}}const ar='ck-ai-chat__prompt-input_highlighted';class hr extends Lt{['submitButtonView'];static ['MIN_ROWS']=0x1;static ['MAX_ROWS']=0xc;['_addContextButtonView'];['_queryViewResizeObserver'];constructor(_0x4c7f31,_0xfccf20){super(_0x4c7f31,{'queryView':{'label':'','creator':Vt,'showIcon':!0x1,'showResetButton':!0x1},'filteredView':new or(_0x4c7f31),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1}),this['set']('isEmpty',!0x0),this['set']('isUploadInProgress',!0x1),this['_addContextButtonView']=_0xfccf20,this['_queryViewResizeObserver']=null,this['queryView']['fieldView']['minRows']=hr['MIN_ROWS'],this['queryView']['fieldView']['maxRows']=hr['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',(_0x1af6c7,_0x3ffcf9)=>!_0x1af6c7&&!_0x3ffcf9),this['focusableChildren']['add'](this['submitButtonView']);}['render'](){super['render'](),this['queryView']['fieldWrapperChildren']['add'](this['submitButtonView']),this['keystrokes']['set']('enter',(_0x198def,_0x697e94)=>{this['isUploadInProgress']||this['isEmpty']||_0x198def['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x697e94());}),this['queryView']['fieldView']['on']('update',()=>{this['isEmpty']=''===this['queryView']['fieldView']['element']['value']?.['trim']();});}['destroy'](){super['destroy'](),this['_queryViewResizeObserver']&&this['_queryViewResizeObserver']['destroy']();}['submit'](){const _0xf66033=this['queryView']['fieldView']['element']['value']?.['trim']();if(!_0xf66033)return this['queryView']['errorText']=hs(this['locale'],'AI_CHAT_PROMPT_EMPTY_ERROR'),void(this['queryView']['fieldView']['hasError']=!0x0);this['queryView']['fieldView']['hasError']=!0x1;const _0x13d36e=_0x5aed4a(_0xf66033);this['fire']('sendUserMessage',_0x13d36e),this['queryView']['fieldView']['reset']();}['setPlaceholderText'](_0xf8c3bf){this['queryView']['fieldView']['set']('placeholder',_0xf8c3bf);}['focus'](_0x246df1=!0x1){super['focus'](),_0x246df1&&(this['element']['classList']['contains'](ar)||(this['element']['classList']['add'](ar),setTimeout(()=>{this['element']['classList']['remove'](ar);},0x320)));}['_createSubmitButton'](){const _0x20bd9f=new Nt(this['locale']);return _0x20bd9f['set']({'icon':_0x1f67f2,'label':hs(this['locale'],'AI_CHAT_LABEL_SUBMIT'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-chat__prompt-submit-button\x20'+cs,'isEnabled':!0x1}),_0x20bd9f['on']('execute',()=>{this['submit']();}),_0x20bd9f;}['setIsUploadInProgress'](_0x16d12a){this['isUploadInProgress']=_0x16d12a;}['_setUpAddContextButtonPositioning'](){const _0x4fcd9e=this['locale'],_0x17915d=()=>{ct['window']['requestAnimationFrame'](()=>{if(lt(this['element'])){const _0x1d9b62=new ut(this['queryView']['fieldView']['element']),_0x3d6f79=new ut(this['_addContextButtonView']['element']),_0xf40744=_0x1d9b62['width'],_0x1a75bd='rtl'===_0x4fcd9e['uiLanguageDirection']?'right':'left';_0x1d9b62['excludeScrollbarsAndBorders']();const _0xeeaa3c=_0xf40744-_0x1d9b62['width']+0x1;this['_addContextButtonView']['element']['style'][_0x1a75bd]='calc('+(_0xf40744-_0x3d6f79['width']-_0xeeaa3c)+'px\x20-\x20var(--ck-spacing-tiny))';}});};this['queryView']['fieldView']['on']('update',_0x17915d),this['on']('render',()=>{_0x17915d(),this['_queryViewResizeObserver']=new bt(this['queryView']['fieldView']['element'],()=>{_0x17915d();});});}}const cr='ck-ai-chat__prompt-capabilities',lr='ck-ai-chat-controls-button',ur='ck-ai-chat-controls-button--commands',dr='ck-ai-chat-controls__model-selection',_r='ck-ai-chat-controls__model-selection__item-name',gr='ck-ai-chat-controls__model-selection__item-description',Ar='ck-ai-chat-controls__model-selection__item-capabilities',Ir='n';class Er extends vt{['_webSearchButton'];['_reasoningButton'];['_commandsButton'];['_modelSelectionDropdown'];['_modelSelectionDropdownItems'];['_modelNameView'];constructor(_0x243b5f){super(_0x243b5f),this['set']('webSearchActive',!0x1),this['set']('reasoningActive',!0x1),this['set']('modelDisplayMode','selector'),this['set']('modelSelectorEnabled',!0x0),this['set']('activeModelId',null),this['set']('activeModelName',null),this['_modelSelectionDropdown']=this['_createModelSelectionDropdown'](),this['_modelNameView']=this['_createModelNameView'](),this['_webSearchButton']=this['_createWebSearchButton'](),this['_reasoningButton']=this['_createReasoningButton'](),this['_commandsButton']=this['_createCommandsButton'](),this['_modelSelectionDropdown']['buttonView']['bind']('isVisible')['to'](this,'modelDisplayMode',_0x490a63=>'selector'===_0x490a63),this['_modelSelectionDropdown']['buttonView']['bind']('tooltip')['to'](this,'modelSelectorEnabled',_0x56dd64=>_0x56dd64?this['_modelSelectionDropdown']['buttonView']['label']:hs(this['locale'],'AI_CHAT_MODEL_SELECTOR_DISABLED_TOOLTIP')),this['_modelSelectionDropdown']['bind']('isEnabled')['to'](this,'modelSelectorEnabled',_0xe3bfc3=>_0xe3bfc3),this['_webSearchButton']['bind']('isOn')['to'](this,'webSearchActive',_0x29cf8f=>_0x29cf8f),this['_webSearchButton']['bind']('tooltip')['to'](this,'webSearchActive',_0x248c7a=>hs(this['locale'],_0x248c7a?'AI_CHAT_DISABLE_WEB_SEARCH':'AI_CHAT_ENABLE_WEB_SEARCH')),this['_reasoningButton']['bind']('isOn')['to'](this,'reasoningActive',_0x4c5ca2=>_0x4c5ca2),this['_reasoningButton']['bind']('tooltip')['to'](this,'reasoningActive',_0x374fbc=>hs(this['locale'],_0x374fbc?'AI_CHAT_DISABLE_REASONING':'AI_CHAT_ENABLE_REASONING')),this['setTemplate']({'tag':'div','attributes':{'class':[cr]},'children':[this['_modelSelectionDropdown'],this['_modelNameView'],this['_webSearchButton'],this['_reasoningButton'],this['_commandsButton']]}),this['_modelSelectionDropdownItems']=new dt(),jt(this['_modelSelectionDropdown'],this['_modelSelectionDropdownItems']);}['setModelList'](_0x9403ed,_0x5562f6){if(_0x5562f6)this['set']('modelDisplayMode','hidden');else{const _0x43dabb=0x1===_0x9403ed['length'];this['set']('modelDisplayMode',_0x43dabb?'name':'selector');}if(this['_modelSelectionDropdownItems']['clear'](),_0x9403ed?.['length'])for(const _0x568be8 of _0x9403ed){const _0x261daf=new Jt({'label':_0x568be8['name'],'withText':!0x0,'role':'menuitemradio','id':_0x568be8['id'],'model':_0x568be8});_0x261daf['bind']('isOn')['to'](this,'activeModelId',_0x8aba09=>_0x8aba09===_0x568be8['id']),this['_modelSelectionDropdownItems']['add']({'type':'button','model':_0x261daf,'labelView':new pr(this['locale'],_0x568be8)});}}['setWebSearch'](_0x1918e0){this['set']('webSearchActive',_0x1918e0);}['setReasoning'](_0x58afae){this['set']('reasoningActive',_0x58afae);}['setModel'](_0x255d66){if(!_0x255d66)return;this['activeModelId']=_0x255d66['id'],this['activeModelName']=_0x255d66['name']||_0x255d66['id'],this['_modelSelectionDropdown']['buttonView']['set']('label',_0x255d66['name']),this['_modelSelectionDropdown']['buttonView']['set']('tooltip',_0x255d66['name']);const _0xf318bd=_0x255d66['capabilities']['webSearch']?.['enabled']??!0x1;this['set']('webSearchActive',!0x1),this['_webSearchButton']['set']('isOn',!0x1),this['_webSearchButton']['set']('isEnabled',_0xf318bd),this['_webSearchButton']['set']('isVisible',_0xf318bd);const _0x5a3a25=_0x255d66['capabilities']['reasoning']?.['enabled']??!0x1;this['set']('reasoningActive',!0x1),this['_reasoningButton']['set']('isOn',!0x1),this['_reasoningButton']['set']('isEnabled',_0x5a3a25),this['_reasoningButton']['set']('isVisible',_0x5a3a25);}['enableModelSelector'](){this['set']('modelSelectorEnabled',!0x0);}['disableModelSelector'](_0x52f20c){this['set']('modelSelectorEnabled',!0x1),_0x52f20c&&this['set']('modelDisplayMode','hidden');}['_createWebSearchButton'](){const _0x41eec7=new Nt();return _0x41eec7['set']({'label':hs(this['locale'],'AI_CHAT_SEARCH_WEB'),'icon':_0xfff9b0,'class':lr+'\x20'+us,'isToggleable':!0x0,'tooltipPosition':Ir}),_0x41eec7['on']('execute',()=>{this['fire']('toggleWebSearch');}),_0x41eec7;}['_createReasoningButton'](){const _0x5a8ce3=new Nt();return _0x5a8ce3['set']({'label':hs(this['locale'],'AI_CHAT_REASONING'),'icon':_0x3d54c0,'class':lr+'\x20'+us,'isToggleable':!0x0,'tooltipPosition':Ir}),_0x5a8ce3['on']('execute',()=>{this['fire']('toggleReasoning');}),_0x5a8ce3;}['_createCommandsButton'](){const _0x3dab1f=new Nt();return _0x3dab1f['set']({'label':hs(this['locale'],'AI_CHAT_COMMANDS'),'icon':_0x4a7bec,'withText':!0x0,'class':lr+'\x20'+us,'isToggleable':!0x0,'tooltip':hs(this['locale'],'AI_CHAT_COMMANDS'),'tooltipPosition':Ir}),_0x3dab1f['extendTemplate']({'attributes':{'class':[ur]}}),_0x3dab1f['on']('execute',()=>{console['log']('Commands\x20are\x20not\x20implemented\x20yet.'),alert('Commands\x20are\x20not\x20implemented\x20yet.');}),_0x3dab1f;}['_createModelSelectionDropdown'](){const _0x2d461d=Gt(this['locale']);return _0x2d461d['set']({'panelPosition':'ne','class':[dr]}),_0x2d461d['buttonView']['set']({'label':hs(this['locale'],'AI_CHAT_MODEL_SELECTOR_ENABLED_TOOLTIP'),'withText':!0x0,'tooltip':!0x0,'tooltipPosition':Ir,'class':us}),this['listenTo'](_0x2d461d,'execute',_0x4953de=>{this['fire']('selectModel',_0x4953de['source']['model']);}),_0x2d461d;}['_createModelNameView'](){const _0x30b185=new mr(this['locale']);return _0x30b185['bind']('text')['to'](this,'activeModelName',_0x2c6bfd=>_0x2c6bfd??''),_0x30b185['bind']('isVisible')['to'](this,'modelDisplayMode',_0x42b08e=>'name'===_0x42b08e),_0x30b185;}}let pr=class extends Mt{constructor(_0x465002,_0x535179){super();const _0x568114=this['bindTemplate'],_0xaee110=this['createCollection']();this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-button__label'],'style':_0x568114['to']('style'),'id':_0x568114['to']('id')},'children':[{'tag':'div','attributes':{'class':[_r]},'children':[{'text':_0x568114['to']('text')}]},{'tag':'div','attributes':{'class':[gr]},'children':[{'tag':'span','children':[{'text':_0x535179['description']}]}]},{'tag':'div','attributes':{'class':[Ar]},'children':_0xaee110}]}),_0xaee110['addMany'](this['_getCapabilityParts'](_0x465002,_0xfff9b0,'AI_CHAT_SEARCH_WEB',_0x535179['capabilities']['webSearch']?.['enabled']??!0x1)),_0xaee110['addMany'](this['_getCapabilityParts'](_0x465002,_0x3d54c0,'AI_CHAT_REASONING',_0x535179['capabilities']['reasoning']?.['enabled']??!0x1));}['_getCapabilityParts'](_0x269cdd,_0x511d71,_0x418c4b,_0xcc81f9){const _0x3bd7a=new xt();_0x3bd7a['content']=_0x511d71;const _0x44a452=new vt(_0x269cdd);_0x44a452['setTemplate']({'tag':'span','children':[{'text':hs(_0x269cdd,_0x418c4b)+':\x20'}]});const _0x1e02c3=new vt(_0x269cdd);return _0x1e02c3['setTemplate']({'tag':'span','children':[{'text':hs(_0x269cdd,_0xcc81f9?'AI_CHAT_CAPABILITIES_YES':'AI_CHAT_CAPABILITIES_NO')}]}),[_0x3bd7a,_0x44a452,_0x1e02c3];}},mr=class extends vt{constructor(_0x2f0ea6){super(_0x2f0ea6),this['set']('text',void 0x0),this['set']('isVisible',!0x0);const _0x53d88b=this['bindTemplate'];this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-chat-controls__model-name',_0x53d88b['if']('isVisible','ck-hidden',_0x57ce7a=>!_0x57ce7a)]},'children':[{'text':_0x53d88b['to']('text')}]});}};const Tr='ck-ai-chat-context-controls__url-form',Cr='ck-ai-chat-context-controls__url-input-section';class wr extends vt{['focusTracker'];['keystrokes'];['_focusables'];['focusCycler'];['urlInputField'];['backButton'];['confirmButton'];constructor(_0x53c9a5){super(_0x53c9a5),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 Ut({'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'](_0xf8351f=>{this['focusTracker']['add'](_0xf8351f['element']),this['keystrokes']['listenTo'](_0xf8351f['element']);}),Zt({'view':this}),this['focus']();}['destroy'](){super['destroy'](),this['focusTracker']['destroy'](),this['keystrokes']['destroy']();}['focus'](){this['urlInputField']['focus']();}['getValue'](){return this['urlInputField']['fieldView']['element']?.['value']?.['trim']()||'';}['clear'](){this['urlInputField']['fieldView']['element']['value']='',this['urlInputField']['errorText']=null,this['confirmButton']['isEnabled']=!0x1;}['setError'](_0x13608c){this['urlInputField']['errorText']=_0x13608c,this['_updateConfirmButtonState'](),this['fire']('refreshBalloon');}['clearError'](){this['urlInputField']['errorText']=null,this['_updateConfirmButtonState']();}['_createBackButton'](){const _0xe2ad6e=new Nt(this['locale']);return _0xe2ad6e['set']({'icon':_0xba82e9,'tooltip':hs(this['locale'],'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT'),'tooltipPosition':'n','class':['ck-button-icon\x20ck-button-back']}),this['on']('change:withBackButton',(_0x297b7b,_0x4b1f32,_0x5bce36)=>{_0xe2ad6e['set']({'class':['ck-button-icon\x20ck-button-back'+(_0x5bce36?'':'\x20ck-hidden')]});}),_0xe2ad6e;}['_createUrlInputField'](){const _0x57391a=new te(this['locale'],_0x1a6109);return _0x57391a['set']({'label':hs(this['locale'],'AI_CHAT_CONTEXT_URL_LABEL'),'class':'ck-labeled-field-view_empty'}),_0x57391a['fieldView']['set']({'placeholder':hs(this['locale'],'AI_CHAT_CONTEXT_URL_PLACEHOLDER')}),_0x57391a;}['_createConfirmButton'](){const _0x42cc91=new Nt(this['locale']);return _0x42cc91['set']({'icon':_0x406d61,'tooltip':hs(this['locale'],'AI_CHAT_CONTEXT_URL_ADD_URL'),'tooltipPosition':'n','class':'ck-button-icon','type':'submit','isEnabled':!0x1}),_0x42cc91;}['_setupTemplate'](){const _0x23dbcd=new _0xb76395(this['locale'],{'label':hs(this['locale'],'AI_CHAT_CONTEXT_URL_ADD_URL'),'class':'ck-ai-header\x20ck-ai-header_small\x20ck-ai-header_context-url'});_0x23dbcd['children']['add'](this['backButton'],0x0),this['setTemplate']({'tag':'form','attributes':{'class':Tr,'tabindex':'-1'},'children':[_0x23dbcd,{'tag':'div','attributes':{'class':Cr},'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',_0x3d7f5c=>{_0x3d7f5c['stop'](),this['_handleSubmit']();});}['_setupKeystrokes'](){this['keystrokes']['set']('esc',(_0x28267c,_0x530eca)=>{this['clear'](),this['fire']('cancel'),_0x530eca();});}['_handleSubmit'](){const _0x479ca7=this['getValue']()['trim']();_0x479ca7?this['_isValidUrl'](_0x479ca7)?(this['clearError'](),this['fire']('submitUrl',_0x479ca7)):this['setError'](hs(this['locale'],'AI_CHAT_CONTEXT_URL_INVALID_ERROR')):this['setError'](hs(this['locale'],'AI_CHAT_CONTEXT_URL_EMPTY_ERROR'));}['_updateConfirmButtonState'](){const _0x28ee39=this['getValue']()['trim'](),_0x67573e=!!this['urlInputField']['errorText'];this['confirmButton']['isEnabled']=_0x28ee39['length']>0x0&&!_0x67573e;}['_isValidUrl'](_0x532310){try{return!!new URL(_0x532310);}catch{return!0x1;}}}const fr='ck-ai-chat-resources__item',br='ck-ai-chat-resources__item--in-context',Sr='ck-ai-chat-resources__item-title',Rr='ck-ai-chat-resources__item__icon';class Or extends Ht{['resource'];['_titleView'];['_iconView'];constructor(_0x1e024e,_0x24399c){super(_0x1e024e),this['resource']=_0x24399c,this['set']('isInContext',!!_0x24399c['isInContext']),this['_titleView']=this['_createTitleView'](),this['_iconView']=this['_createIconView'](),this['_setupTemplate']();}['render'](){super['render']();}['getResourceIcon'](_0x1430de){if(_0x1430de['isInContext'])return _0x406d61;switch(_0x1430de['type']){case'document':return _0x3e528c;case'web-resource':return _0xe5297c;case'file':case'text':return _0xc51032;default:return _0xfc4b68;}}['highlightText'](_0x5eecdd){if(!_0x5eecdd||''===_0x5eecdd['trim']())return void this['_titleView']['highlightText'](null);const _0x5f25e1=new RegExp(_0x5607f9(_0x5eecdd),'gi');this['_titleView']['highlightText'](_0x5f25e1);}['updateResourceState'](_0x12949d){this['resource']['isInContext']=_0x12949d,this['isInContext']=_0x12949d,this['_updateIcon']();}['_createTitleView'](){const _0x688715=new _0x56ea6b();return _0x688715['text']=this['resource']['label'],_0x688715['extendTemplate']({'tag':'span','attributes':{'class':[Sr]}}),_0x688715;}['_createIconView'](){const _0x5cf645=new xt();return _0x5cf645['content']=this['getResourceIcon'](this['resource']),_0x5cf645;}['_setupTemplate'](){const _0x204634=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':[fr,_0x204634['if']('isVisible','ck-hidden',_0x4ab70f=>!_0x4ab70f),_0x204634['if']('isInContext',br)]},'children':[{'tag':'div','attributes':{'class':[Rr]},'children':[this['_iconView']]},this['_titleView']],'on':{'click':_0x204634['to']('execute')}});}['_updateIcon'](){this['_iconView']['content']=this['getResourceIcon'](this['resource']);}}const kr='ck-ai-chat-resources__list';class Nr extends Dt{['_source'];constructor(_0x5de904,_0x49f503){super(_0x5de904),this['_source']=_0x49f503,this['extendTemplate']({'attributes':{'class':[kr]}});}['setResources'](_0x6d27c,_0x325091){this['items']['clear']();let _0x6a419b=_0x6d27c;if(this['_source']['useDefaultFiltering']&&_0x325091&&''!==_0x325091['trim']()){const _0x170351=new RegExp(_0x325091['replace'](/[.*+?^${}()|[\]\\]/g,'\x5c$&'),'gi');_0x6a419b=_0x6d27c['filter'](_0x406b8a=>_0x170351['test'](_0x406b8a['label']));}for(const _0x4f8d81 of _0x6a419b){const _0x4b1e80=new Or(this['locale'],_0x4f8d81);_0x4b1e80['on']('execute',()=>{this['_handleResourceSelection'](this['_source'],_0x4f8d81);}),this['items']['add'](_0x4b1e80);}this['_source']['useDefaultFiltering']&&this['highlightText'](_0x325091);}['highlightText'](_0x21a6b0){this['_source']['useDefaultFiltering']&&this['items']['forEach'](_0x5bff49=>{_0x5bff49['highlightText'](_0x21a6b0);});}['updateResourceState'](_0xe3bb5c,_0xb209e2){for(const _0x452ae9 of this['items']){const _0x2027c3=_0x452ae9;_0x2027c3['resource']['id']===_0xe3bb5c&&_0x2027c3['updateResourceState'](_0xb209e2);}}['_handleResourceSelection'](_0x4ff6f7,_0x2320fc){this['fire']('addResourceToContext',{'source':_0x4ff6f7,'resource':_0x2320fc});}}class vr extends te{['iconView'];['resetButtonView'];['_viewConfig'];constructor(_0x1dc87a){const t=_0x1dc87a['t'],_0x5d31ad={'showResetButton':!0x0,'showIcon':!0x0,'creator':_0x1a6109,'label':hs(_0x1dc87a,'AI_CHAT_SEARCH_RESOURCES')};super(_0x1dc87a,_0x5d31ad['creator']),this['label']=_0x5d31ad['label'],this['_viewConfig']=_0x5d31ad,this['_viewConfig']['showIcon']&&this['_setupSearchIcon'](),this['_viewConfig']['showResetButton']&&this['_setupResetButton'](_0x1dc87a,t),this['_setupEventListeners']();}['reset'](){this['fieldView']['reset'](),this['_viewConfig']['showResetButton']&&this['resetButtonView']&&(this['resetButtonView']['isVisible']=!0x1),this['search']('');}['search'](_0x5cab5f){this['fire']('search',_0x5cab5f);}['getQuery'](){return this['fieldView']['element']?.['value']||'';}['_setupSearchIcon'](){this['iconView']=new xt(),this['iconView']['content']=_0x262e2c,this['fieldWrapperChildren']['add'](this['iconView'],0x0),this['extendTemplate']({'attributes':{'class':'ck-search__query_with-icon'}});}['_setupResetButton'](_0x594f72,t){this['resetButtonView']=new Nt(_0x594f72),this['resetButtonView']['set']({'label':t('Clear'),'icon':_0x35e3e9,'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',_0x41ffe4=>!_0x41ffe4),this['fieldWrapperChildren']['add'](this['resetButtonView']),this['extendTemplate']({'attributes':{'class':'ck-search__query_with-reset'}});}['_setupEventListeners'](){this['listenTo'](this['fieldView'],'input',()=>{this['search'](this['fieldView']['element']['value']);}),this['bind']('isEnabled')['to'](this);}}class yr extends vt{['_searchView'];['_searchSection'];['_searchInputVisibleFrom'];['_resourcesListView'];['_skeletonLoader'];['_source'];['children'];['_latestLoadResourcesUid']=null;constructor(_0x476e01,_0x291bb5){super(_0x476e01),this['_source']=_0x291bb5['source'],this['_searchInputVisibleFrom']=_0x291bb5['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 _0x23af51([this['_skeletonLoader'],this['_resourcesListView']]),this['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-chat-resources'},'children':this['children']});}['_createSearchView'](){return new vr(this['locale']);}['_createSearchSection'](){const _0x566ac2=new vt(this['locale']);return _0x566ac2['setTemplate']({'tag':'div','attributes':{'class':'ck\x20ck-search'},'children':[this['_searchView']]}),this['_searchView']['on']('search',(_0x1c7d49,_0x1dd79c)=>{this['loadResources'](_0x1dd79c),this['_source']['useDefaultFiltering']&&this['_resourcesListView']['highlightText'](_0x1dd79c);}),_0x566ac2;}['_createResourcesListView'](){const _0x2f0e1f=new Nr(this['locale'],this['_source']);return _0x2f0e1f['delegate']('addResourceToContext')['to'](this),_0x2f0e1f['extendTemplate']({'attributes':{'class':this['bindTemplate']['if']('isLoading','ck-hidden')}}),_0x2f0e1f;}['_createSkeletonView'](){const _0x1d54a9=new pn(this['locale'],mn['aiChatResources']);return _0x1d54a9['bind']('isVisible')['to'](this,'isLoading'),_0x1d54a9;}['render'](){super['render'](),this['loadResources']('');}['loadResources'](_0x4de010){const _0x555c42=ot();this['_latestLoadResourcesUid']=_0x555c42,this['fire']('loadSourceResources',{'sourceId':this['_source']['id'],'query':_0x4de010,'uid':_0x555c42}),this['isLoading']=!0x0;}['setResources'](_0x24ef2c,_0x1751da){if(_0x1751da&&_0x1751da!==this['_latestLoadResourcesUid'])return;const _0x318957=this['_source']['useDefaultFiltering']?this['_searchView']['getQuery']():'';this['_resourcesListView']['setResources'](_0x24ef2c,_0x318957),_0x24ef2c['length']>=this['_searchInputVisibleFrom']&&!this['children']['has'](this['_searchSection'])&&this['children']['add'](this['_searchSection'],0x0),requestAnimationFrame(()=>{this['isLoading']=!0x1;});}['updateResourceState'](_0x42bc39,_0x3cadbc){this['_resourcesListView']['updateResourceState'](_0x42bc39,_0x3cadbc);}}const xr='ck-ai-chat-context-controls__source-balloon-panel',Lr='ck-button-icon\x20ck-button-back',Dr='ck-ai-header\x20ck-ai-header_small\x20ck-ai-header_source';class Pr{['_sourceResourceBalloons']=new Map();['_bodyCollection'];['_locale'];['_config'];constructor(_0x74cef,_0x18687b,_0x381bb1){this['_locale']=_0x74cef,this['_bodyCollection']=_0x18687b,this['_config']=_0x381bb1;}['showSourceResourcesBalloon']({source:_0x393bd9,withBackButton:_0x171f01}){let _0xfaf8c5=this['_sourceResourceBalloons']['get'](_0x393bd9['id']);_0xfaf8c5||(_0xfaf8c5=this['_createSourceResourceBalloonPanel'](),this['_sourceResourceBalloons']['set'](_0x393bd9['id'],_0xfaf8c5),this['_setupSingleResourceBalloonClickOutsideHandler'](_0xfaf8c5)),this['_addSourceResourceContent']({'balloonPanel':_0xfaf8c5,'source':_0x393bd9,'withBackButton':_0x171f01}),_0xfaf8c5['show']();const _0x26d298=this['_config']['getTargetElement']();_0x26d298&&_0xfaf8c5['pin']({'target':_0x26d298,'limiter':this['_config']['getLimiterElement']()});}['populateSourceResourceBalloon'](_0x307d1a,_0x418030,_0x126239){const _0x4568fc=this['_sourceResourceBalloons']['get'](_0x307d1a);if(!_0x4568fc)return;const _0x247c80=this['_getResourcesViewFromBalloon'](_0x4568fc);_0x247c80&&(_0x247c80['setResources'](_0x418030,_0x126239),_0x247c80['once']('change:isLoading',()=>{_0x4568fc['pin']({'target':this['_config']['getTargetElement'](),'limiter':this['_config']['getLimiterElement']()});}));}['closeSourceResourceBalloon'](_0x34f815){const _0xc2f5c4=this['_sourceResourceBalloons']['get'](_0x34f815);_0xc2f5c4&&requestAnimationFrame(()=>{_0xc2f5c4['hide'](),this['_sourceResourceBalloons']['delete'](_0x34f815),this['_config']['onBalloonClosed']();});}['isAnyResourceBalloonVisible'](){for(const _0x171c6e of this['_sourceResourceBalloons']['values']())if(_0x171c6e['isVisible'])return!0x0;return!0x1;}['updateResourceState'](_0x261a80,_0x5e9c64,_0x293f3d){const _0xa7a3e9=this['_sourceResourceBalloons']['get'](_0x261a80);if(!_0xa7a3e9||!_0xa7a3e9['isVisible'])return;const _0x1071b3=this['_config']['getTargetElement']();if(!_0x1071b3)return;_0xa7a3e9['pin']({'target':_0x1071b3,'limiter':this['_config']['getLimiterElement']()});const _0x345eed=this['_getResourcesViewFromBalloon'](_0xa7a3e9);_0x345eed&&_0x345eed['updateResourceState'](_0x5e9c64,_0x293f3d);}['destroy'](){for(const _0x4249bf of this['_sourceResourceBalloons']['values']())_0x4249bf['destroy']();this['_sourceResourceBalloons']['clear']();}['_createSourceResourceBalloonPanel'](){const _0x5bd280=new Xt(this['_locale']);return _0x5bd280['extendTemplate']({'attributes':{'class':xr}}),this['_bodyCollection']['add'](_0x5bd280),_0x5bd280;}['_addSourceResourceContent']({balloonPanel:_0x68e4ef,source:_0x4fce72,withBackButton:_0x492129}){_0x68e4ef['content']['clear']();const _0x3b367e=this['_createBalloonHeader']({'balloonPanel':_0x68e4ef,'source':_0x4fce72,'withBackButton':_0x492129});_0x68e4ef['content']['add'](_0x3b367e);const _0x1b9a66=this['_createBalloonResourcesView'](_0x4fce72);_0x68e4ef['content']['add'](_0x1b9a66);}['_createBalloonHeader']({balloonPanel:_0x45f067,source:_0x68cc29,withBackButton:_0x26ffdb}){const _0x20aeb1=new _0xb76395(this['_locale'],{'label':_0x68cc29['label'],'class':Dr});return _0x26ffdb&&_0x20aeb1['children']['add'](this['_createBackButton'](_0x45f067),0x0),_0x20aeb1;}['_createBackButton'](_0x5460f2){const _0x7f77e8=new Nt(this['_locale']);return _0x7f77e8['set']({'icon':_0xba82e9,'tooltip':hs(this['_locale'],'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT'),'tooltipPosition':'n','class':Lr}),_0x7f77e8['on']('execute',()=>{_0x5460f2['hide'](),this['_config']['onBackToContext']();}),_0x7f77e8;}['_createBalloonResourcesView'](_0x1d718d){const _0x2f8414=new yr(this['_locale'],{'source':_0x1d718d,'searchInputVisibleFrom':this['_config']['searchInputVisibleFrom']});return _0x2f8414['on']('loadSourceResources',(_0x37446d,_0x5d2cf2)=>{this['_config']['onLoadSourceResources'](_0x5d2cf2);}),_0x2f8414['on']('addResourceToContext',(_0x33f27d,_0x39fee4)=>{this['_config']['onResourceSelected'](_0x39fee4['source'],_0x39fee4['resource']),this['closeSourceResourceBalloon'](_0x1d718d['id']);}),_0x2f8414;}['_getResourcesViewFromBalloon'](_0x1e9384){const _0x119262=_0x1e9384['content']['get'](0x1);return _0x119262 instanceof yr?_0x119262:null;}['_setupSingleResourceBalloonClickOutsideHandler'](_0x3728d5){zt({'emitter':_0x3728d5,'contextElements':[_0x3728d5['element']],'callback':()=>{_0x3728d5['hide'](),this['_config']['onBalloonClosed']();},'activator':()=>_0x3728d5['isVisible']});}}const Hr=['addDocumentToContext','addFileToContext','addUrlToContext','addResourceToContext','removeContextItem','loadSourceResources','executeCustomItemCallback'],Mr='ck-ai-chat-context-controls',Ur='ck-ai-chat-context-controls__pending-contexts',Vr='ck-ai-chat-context-controls__add-context-balloon-panel',Br='ck-ai-chat-context-controls__add-context-button',Gr='ck-ai-chat-context-controls__url-balloon-panel',Fr='ck-ai-chat-context-controls__balloon-button',Kr='ck-ai-chat-context-controls__balloon-button-source',Wr='ck-ai-chat-controls-button',Yr='ck-ai-chat-context-chips-wrapper-balloon',$r='ck-ai-chat-controls_context_show-more-button',qr='ck-ai-chat-context-controls__show-more-balloon-panel',Qr='ck-ai-chat',Xr=[Xt['defaultPositions']['northArrowSouthWest'],Xt['defaultPositions']['northArrowSouth'],Xt['defaultPositions']['northArrowSouthEast'],Xt['defaultPositions']['southArrowNorthWest'],Xt['defaultPositions']['southArrowNorth'],Xt['defaultPositions']['southArrowNorthEast']];class zr extends vt{['addContextButtonView'];['_currentContextsChips']=this['createCollection']();['_conversationContextsChips']=this['createCollection']();['_overflowManager'];['_addContextBalloonPanelView'];['_urlBalloonPanelView'];['_urlInputView'];['_resourcesBalloonView'];['_addContextBalloonConfig'];['_hasExactlyOneSource']=!0x1;['bodyCollection'];constructor(_0x13bbf1,_0x9d34e5){super(_0x13bbf1),this['bodyCollection']=_0x9d34e5['bodyCollection'],this['_currentContextsChips']=this['createCollection'](),this['_conversationContextsChips']=this['createCollection'](),this['addContextButtonView']=this['_createAddContextButtonView'](_0x13bbf1),this['_addContextBalloonPanelView']=this['_createAddContextBalloonPanelView'](_0x13bbf1),this['_urlBalloonPanelView']=this['_createUrlBalloonPanelView'](_0x13bbf1),this['_resourcesBalloonView']=this['_createResourcesBalloonView'](_0x13bbf1,_0x9d34e5);const _0x3244cd={'cssClasses':{'showMoreButton':$r+'\x20'+us,'showMoreBalloon':qr,'overflowContainer':Yr,'controlsButton':Wr}};this['_overflowManager']=new Wn(_0x13bbf1,this['_currentContextsChips'],_0x3244cd,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'](_0x1b822c,_0x2c2cae){const _0x3d3405=this['_createContextButton'](_0x1b822c,'current',!0x0,_0x2c2cae);this['_addContextToCollection'](_0x3d3405,this['_currentContextsChips']),this['_overflowManager']['reorganizeChips']();}['removeContextItem'](_0x4482d4){this['_removeContextFromCollection'](_0x4482d4,this['_currentContextsChips']),this['_removeContextFromCollection'](_0x4482d4,this['_overflowManager']['overflowChips']),this['_overflowManager']['reorganizeChips']();}['setContextItemLoading'](_0x1553ac,_0x58346a){let _0x1a8e79=this['_currentContextsChips']['find'](_0x751a97=>_0x751a97['id']===_0x1553ac);_0x1a8e79||(_0x1a8e79=this['_overflowManager']['overflowChips']['find'](_0x35e612=>_0x35e612['id']===_0x1553ac)),_0x1a8e79&&(_0x1a8e79['isLoading']=_0x58346a);}['setConversationContext'](_0x48431a){this['_conversationContextsChips']['clear']();for(const _0x48b4ab of _0x48431a){const _0x1c5256=this['_createContextButton'](_0x48b4ab,'conversation',!0x1,!0x1);this['_addContextToCollection'](_0x1c5256,this['_conversationContextsChips']);}}['clearCurrentContextItems'](){this['_currentContextsChips']['clear'](),this['_overflowManager']['clear']();}['clearConversationContextItems'](){this['_conversationContextsChips']['clear']();}['updateResourceState'](_0x1503e0,_0xb9a318,_0x4abb3d){this['_resourcesBalloonView']['updateResourceState'](_0x1503e0,_0xb9a318,_0x4abb3d);}['hideAddContextBalloonPanel'](){this['_toggleAddContextBalloon'](!0x1);}['showAddContextBalloonPanel'](){this['_toggleAddContextBalloon'](!0x0);}['hideUrlBalloonPanel'](){this['_urlBalloonPanelView']['hide'](),this['addContextButtonView']['isOn']=!0x1,this['_urlInputView']&&this['_urlInputView']['clear']();}['showUrlBalloonPanel'](){this['_urlBalloonPanelView']['show'](),this['addContextButtonView']['isOn']=!0x0;}['_showSourceResourcesBalloon']({source:_0x558566,withBackButton:_0x2be00c}){this['_resourcesBalloonView']['showSourceResourcesBalloon']({'source':_0x558566,'withBackButton':_0x2be00c}),this['addContextButtonView']['isOn']=!0x0;}['populateSourceResourceBalloon'](_0x80a25,_0x50dd14,_0x18b304,_0x15fb9f){this['_resourcesBalloonView']['populateSourceResourceBalloon'](_0x80a25,_0x18b304,_0x15fb9f);}['closeSourceResourceBalloon'](_0x4116dd){this['_resourcesBalloonView']['closeSourceResourceBalloon'](_0x4116dd),this['addContextButtonView']['isOn']=!0x1;}['setAddContextOptions'](_0x2b78ed){this['_setBalloonPanelContent'](this['_addContextBalloonPanelView'],this['locale'],_0x2b78ed),this['_setAddContextButtonEnabled'](_0x2b78ed);}['_setAddContextButtonEnabled'](_0x392cff){const _0x2526bf=!_0x392cff['document']['isHidden']&&_0x392cff['document']['enabled'],_0x3d179=_0x392cff['urls']['enabled'],_0x166ab9=_0x392cff['files']['enabled'],_0x5b8b72=_0x392cff['sources']['length']>0x0,_0x49e555=_0x392cff['customItems']&&_0x392cff['customItems']['length']>0x0;this['addContextButtonView']['isEnabled']=_0x2526bf||_0x3d179||_0x166ab9||_0x5b8b72||_0x49e555;}['_setupTemplate'](){this['setTemplate']({'tag':'div','attributes':{'class':[Mr,'ck-reset_all-excluded']},'children':[{'tag':'div','attributes':{'class':Ur},'children':this['_currentContextsChips']}]});}['_bindEventHandlers'](){this['addContextButtonView']['on']('execute',()=>{this['_handleAddContextButtonClick']();});}['_createAddContextButtonView'](_0x1a058c){const _0x584600=new Nt(_0x1a058c);return _0x584600['set']({'label':hs(_0x1a058c,'AI_CHAT_CONTEXT_ADD_CONTEXT'),'class':Wr+'\x20'+Br+'\x20'+us,'icon':_0x5e24ae,'isToggleable':!0x0,'tooltip':!0x0,'tooltipPosition':'sw'}),_0x584600;}['_createAddContextBalloonPanelView'](_0x3cf50f){return this['_createBaseBalloonPanel'](_0x3cf50f,Vr);}['_createUrlBalloonPanelView'](_0x52ec31){const _0x226eef=this['_createBaseBalloonPanel'](_0x52ec31,Gr);return this['_addUrlContent'](_0x226eef,_0x52ec31),_0x226eef;}['_createResourcesBalloonView'](_0x3ad573,_0x279737){const _0x599252={'searchInputVisibleFrom':_0x279737['searchInputVisibleFrom'],'onBackToContext':()=>{this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':Xr});},'onResourceSelected':(_0x1e27da,_0xad49d3)=>{this['fire']('addResourceToContext',{'source':_0x1e27da,'resource':_0xad49d3});},'onLoadSourceResources':_0x3b15c2=>{this['fire']('loadSourceResources',_0x3b15c2);},'onBalloonClosed':()=>{this['addContextButtonView']['isOn']=!0x1;},'getLimiterElement':()=>this['_getLimiterElement'](),'getTargetElement':()=>this['addContextButtonView']['element']};return new Pr(_0x3ad573,_0x279737['bodyCollection'],_0x599252);}['_getLimiterElement'](){return this['element']?.['closest']('.'+Qr)||document['body'];}['_createBaseBalloonPanel'](_0x206295,_0x4c5373){const _0x2bbbaf=new Xt(_0x206295);return _0x2bbbaf['extendTemplate']({'attributes':{'class':_0x4c5373}}),this['bodyCollection']['add'](_0x2bbbaf),_0x2bbbaf;}['_setBalloonPanelContent'](_0x3ccf85,_0x48cfeb,_0xb04ae2){if(_0x3ccf85['content']['clear'](),!_0xb04ae2['document']['isHidden']&&_0xb04ae2['document']['enabled']){const _0xa55a0a=this['_createBalloonButton'](_0x48cfeb,{'label':hs(_0x48cfeb,'AI_CHAT_CONTEXT_CURRENT_DOCUMENT'),'icon':_0x3e528c});_0xa55a0a['on']('execute',()=>{this['fire']('addDocumentToContext'),this['hideAddContextBalloonPanel']();}),_0x3ccf85['content']['add'](_0xa55a0a);}if(_0xb04ae2['urls']['enabled']){const _0x5d79c4=this['_createBalloonButton'](_0x48cfeb,{'label':hs(_0x48cfeb,'AI_CHAT_CONTEXT_URL_LABEL'),'icon':_0xe5297c});_0x5d79c4['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['showUrlBalloonPanel'](),this['_urlBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':Xr}),this['_urlInputView']['focus']();}),_0x3ccf85['content']['add'](_0x5d79c4);}if(_0xb04ae2['files']['enabled']){const _0x2d0aa4=new _0x2dc43e(_0x48cfeb);_0x2d0aa4['set']({'label':hs(_0x48cfeb,'AI_CHAT_CONTEXT_FILE_LABEL'),'icon':_0x14e330,'withText':!0x0,'tooltip':!0x0,'class':Fr,'allowMultipleFiles':!0x0}),_0x2d0aa4['on']('execute',()=>{this['hideAddContextBalloonPanel']();}),_0x2d0aa4['on']('done',(_0x2b2fcd,_0x1409cb)=>{this['fire']('addFileToContext',_0x1409cb);}),_0x2d0aa4['tooltip']=!0x0,_0x3ccf85['content']['add'](_0x2d0aa4);}for(const _0x2a2ccb of _0xb04ae2['sources']){const _0xdac4d8=this['_createBalloonButton'](_0x48cfeb,{'label':_0x2a2ccb['label'],'icon':_0x2a2ccb['icon']||_0xfc4b68,'type':'source'});_0x3ccf85['content']['add'](_0xdac4d8),_0xdac4d8['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['_showSourceResourcesBalloon']({'source':_0x2a2ccb,'withBackButton':!this['_hasExactlyOneSource']});});}for(const _0x4b9cab of _0xb04ae2['customItems']||[]){const _0x170bb3=this['_createBalloonButton'](_0x48cfeb,{'label':_0x4b9cab['label'],'icon':_0x4b9cab['icon']||_0xfc4b68,'type':'customItem'});_0x3ccf85['content']['add'](_0x170bb3),_0x170bb3['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['fire']('executeCustomItemCallback',_0x4b9cab);});}this['_hasExactlyOneSource']=0x1===_0x3ccf85['content']['length'],this['_urlInputView']['withBackButton']=!this['_hasExactlyOneSource'];}['_addUrlContent'](_0x275360,_0x368a0b){this['_urlInputView']=new wr(_0x368a0b),this['_urlInputView']['on']('submitUrl',(_0x364ff5,_0x379750)=>{this['_handleUrlSubmit'](_0x379750);}),this['_urlInputView']['on']('cancel',()=>{this['hideUrlBalloonPanel'](),this['_hasExactlyOneSource']||(this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':Xr}));}),this['_urlInputView']['on']('refreshBalloon',()=>{this['_urlBalloonPanelView']['isVisible']&&this['_urlBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':Xr});}),_0x275360['content']['add'](this['_urlInputView']);}['_createBalloonButton'](_0x26713c,_0x278419){const _0x14f882='source'===_0x278419['type']?new jr(_0x26713c):new Nt(_0x26713c);return _0x14f882['set']({'label':_0x278419['label'],'icon':_0x278419['icon'],'withText':!0x0,'tooltip':!0x0,'tooltipPosition':'sw','class':Fr}),_0x14f882;}['_setupAllBalloonClickOutsideHandlers'](){this['_setupAddContextBalloonClickOutsideHandler'](),this['_setupUrlBalloonClickOutsideHandler']();}['_setupUrlBalloonClickOutsideHandler'](){zt({'emitter':this['_urlBalloonPanelView'],'contextElements':[this['_urlBalloonPanelView']['element']],'callback':()=>{this['hideUrlBalloonPanel']();},'activator':()=>this['_urlBalloonPanelView']['isVisible']});}['_toggleAddContextBalloon'](_0x3d2adf){const _0x1d9ffb=this['_addContextBalloonConfig'];_0x1d9ffb['buttonView']['isOn']=_0x3d2adf,_0x3d2adf?_0x1d9ffb['balloonView']['show']():_0x1d9ffb['balloonView']['hide']();}['_setupAddContextBalloonClickOutsideHandler'](){const {balloonView:_0x117780,buttonView:_0x793dc,hideMethod:_0x552455}=this['_addContextBalloonConfig'];zt({'emitter':_0x117780,'contextElements':[_0x117780['element'],_0x793dc['element']],'callback':()=>{_0x552455();},'activator':()=>_0x793dc['isOn']&&!this['_urlBalloonPanelView']['isVisible']&&!this['_resourcesBalloonView']['isAnyResourceBalloonVisible']()});}['_createContextButton'](_0x4321dc,_0x366649,_0x34c035=!0x1,_0x3b6a3b=!0x1){const _0x555694='conversation'===_0x366649||!0x0===_0x4321dc['isReadOnly'],_0x3a35c7=new Bn(this['locale'],_0x4321dc,_0x555694,_0x34c035,_0x3b6a3b);return _0x555694||_0x3a35c7['on']('removeContextItemChip',()=>{this['fire']('removeContextItem',_0x3a35c7['id']);}),_0x3a35c7;}['_addContextToCollection'](_0x43104d,_0x3d44a4){_0x3d44a4['add'](_0x43104d,0x0);}['_removeContextFromCollection'](_0x5cd151,_0x3a8a22){const _0x1d5b60=_0x3a8a22['find'](_0x37024a=>_0x37024a['id']===_0x5cd151);_0x1d5b60&&_0x3a8a22['remove'](_0x1d5b60);}['_handleAddContextButtonClick'](){this['addContextButtonView']['isOn']?this['hideAddContextBalloonPanel']():(this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':Xr}),this['_hasExactlyOneSource']&&this['_addContextBalloonPanelView']['content']['get'](0x0)?.['fire']('execute'));}['_handleUrlSubmit'](_0x442a03){this['_urlInputView']['clear'](),this['hideUrlBalloonPanel'](),this['fire']('addUrlToContext',_0x442a03);}}class jr extends Nt{['arrowView'];constructor(_0x1c1b89){super(_0x1c1b89),this['set']({'withText':!0x0,'role':'menuitem'}),this['arrowView']=this['_createArrowView'](),this['extendTemplate']({'attributes':{'class':[Kr]}});}['render'](){super['render'](),this['children']['add'](this['arrowView']);}['_createArrowView'](){const _0xaa1f5=new xt();return _0xaa1f5['content']=_0x108533,_0xaa1f5['extendTemplate']({'attributes':{'class':Kr+'__arrow'}}),_0xaa1f5;}}class Jr extends vt{['_cancelButtonView'];['_loaderView'];constructor(_0x1eb8a6){super(_0x1eb8a6),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 _0x1aafc1=new Nt(this['locale']);return _0x1aafc1['set']({'label':hs(this['locale'],'AI_CHAT_STOP_GENERATING'),'withText':!0x0,'class':ls+'\x20ck-ai-button-stop-generating','icon':_0x327a50}),_0x1aafc1['on']('execute',()=>{this['fire']('abortPromptStream');}),_0x1aafc1;}['_createLoaderView'](){const _0x5aaa0d=new vt(this['locale']);return _0x5aaa0d['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':hs(this['locale'],'AI_CHAT_IS_WRITING')}]}),_0x5aaa0d;}}class Zr extends vt{['_contextPanelView'];['_promptInputView'];['_promptCapabilitiesView'];['_loaderView'];['_modelUnavailableMessageView'];['_shouldRestorePromptInputFocus'];constructor(_0x43ff70,_0x335a27){super(_0x43ff70),this['_contextPanelView']=this['_createContextPanelView'](_0x43ff70,{'bodyCollection':_0x335a27['bodyCollection'],'searchInputVisibleFrom':_0x335a27['contextResourcesSearchInputVisibleFrom']}),this['_promptInputView']=this['_createPromptInputView'](_0x43ff70),this['_promptCapabilitiesView']=this['_createPromptCapabilitiesView'](_0x43ff70),this['_loaderView']=this['_createLoaderView'](_0x43ff70),this['_modelUnavailableMessageView']=this['_createModelUnavailableMessageView'](_0x43ff70),this['_shouldRestorePromptInputFocus']=!0x1,this['_promptInputView']['delegate']('sendUserMessage')['to'](this),this['_loaderView']['delegate']('abortPromptStream')['to'](this),this['_promptCapabilitiesView']['delegate']('toggleWebSearch')['to'](this),this['_promptCapabilitiesView']['delegate']('toggleReasoning')['to'](this),this['_promptCapabilitiesView']['delegate']('selectModel')['to'](this),this['_contextPanelView']['delegate'](...Hr)['to'](this),this['set']('isModelAvailable',!0x0),this['set']('isDisabled',!0x1);const _0x421884=this['bindTemplate'];this['setTemplate']({'tag':'form','attributes':{'class':['ck','ck-ai-chat-controls',_0x421884['if']('isDisabled','ck-ai-chat-controls-disabled')]},'children':[{'tag':'div','attributes':{'class':[_0x421884['if']('isLoading','ck-hidden',_0x3b0d29=>_0x3b0d29||!this['isModelAvailable']),_0x421884['if']('isModelAvailable','ck-hidden',_0x213a05=>!_0x213a05||this['isLoading'])]},'children':[this['_contextPanelView'],this['_promptInputView'],this['_promptCapabilitiesView']]},{'tag':'div','attributes':{'class':[_0x421884['if']('isLoading','ck-hidden',_0x287780=>!_0x287780)]},'children':[this['_loaderView']]},{'tag':'div','attributes':{'class':[_0x421884['if']('isModelAvailable','ck-hidden',_0x326750=>_0x326750)]},'children':[this['_modelUnavailableMessageView']]}]}),zt({'emitter':this['_promptInputView'],'activator':()=>this['isLoading'],'contextElements':()=>[this['element']],'callback':()=>{this['_shouldRestorePromptInputFocus']=!0x1;}}),this['on']('change:isLoading',this['_handlePromptInputFocus'],{'priority':'low'});}['_createContextPanelView'](_0x59b15c,_0x319c5e){return new zr(_0x59b15c,_0x319c5e);}['_createPromptInputView'](_0x113e9c){return new hr(_0x113e9c,this['_contextPanelView']['addContextButtonView']);}['_createPromptCapabilitiesView'](_0x40923d){return new Er(_0x40923d);}['_createLoaderView'](_0x98aab3){return new Jr(_0x98aab3);}['_createModelUnavailableMessageView'](_0xfcf663){const _0x40abdf=new to(_0xfcf663);return _0x40abdf['delegate']('startConversation')['to'](this),_0x40abdf;}['_handlePromptInputFocus'](_0x7171a7,_0x43744e,_0x3644f1){_0x3644f1?this['_shouldRestorePromptInputFocus']=!0x0:this['_shouldRestorePromptInputFocus']&&this['_promptInputView']['focus']();}['addContextItem'](_0x3ae233,_0x1ebfd7){this['_contextPanelView']['addContextItem'](_0x3ae233,_0x1ebfd7);}['removeContextItem'](_0x1e98ba){this['_contextPanelView']['removeContextItem'](_0x1e98ba);}['setContextItemLoading'](_0x54abf4,_0x187ae3){this['_contextPanelView']['setContextItemLoading'](_0x54abf4,_0x187ae3);}['setIsUploadInProgress'](_0x2da531){this['_promptInputView']['setIsUploadInProgress'](_0x2da531);}['setConversationContext'](_0x58711f){this['_contextPanelView']['setConversationContext'](_0x58711f);}['clearPendingContextUI'](){this['_contextPanelView']['clearCurrentContextItems']();}['clearConversationContextUI'](){this['_contextPanelView']['clearConversationContextItems']();}['updateResourceState'](_0x334bdb,_0x8ed0d1,_0x891e74){this['_contextPanelView']['updateResourceState'](_0x334bdb,_0x8ed0d1,_0x891e74);}['setWebSearch'](_0x1084d1){this['_promptCapabilitiesView']['setWebSearch'](_0x1084d1);}['setReasoning'](_0x2e647c){this['_promptCapabilitiesView']['setReasoning'](_0x2e647c);}['resetMessageInput'](){this['_promptInputView']['reset']();}['setAddContextOptions'](_0x19fee6){this['_contextPanelView']['setAddContextOptions'](_0x19fee6);}['setInputPlaceholder'](_0x4e3778){this['_promptInputView']['setPlaceholderText'](_0x4e3778);}['setModelList'](_0x95d610,_0x2c6c30){this['_promptCapabilitiesView']['setModelList'](_0x95d610,_0x2c6c30);}['setModel'](_0x3a07ec){_0x3a07ec?(this['isModelAvailable']=!0x0,this['_promptCapabilitiesView']['setModel'](_0x3a07ec)):this['isModelAvailable']=!0x1;}['enableModelSelector'](){this['_promptCapabilitiesView']['enableModelSelector']();}['disableModelSelector'](_0x4de485){this['_promptCapabilitiesView']['disableModelSelector'](_0x4de485);}['populateSourceResourceBalloon'](_0x180899,_0x24492f,_0x1fb154,_0x2333de){this['_contextPanelView']['populateSourceResourceBalloon'](_0x180899,_0x24492f,_0x1fb154,_0x2333de);}['closeSourceResourceBalloon'](_0x51d294){this['_contextPanelView']['closeSourceResourceBalloon'](_0x51d294);}['focusPromptInput'](_0x582413=!0x1){this['_promptInputView']['focus'](_0x582413);}['setPromptInputValue'](_0x2f39cd){this['_promptInputView']['queryView']['fieldView']['reset'](),this['_promptInputView']['queryView']['fieldView']['value']=_0x2f39cd;}}class to extends vt{constructor(_0x5cab97){super(_0x5cab97);const _0x3a06f1=new Nt(_0x5cab97);_0x3a06f1['set']({'label':hs(this['locale'],'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_BUTTON'),'withText':!0x0,'class':['ck-ai-chat-controls__start-new-chat-button'],'tooltip':''}),_0x3a06f1['delegate']('execute')['to'](this,'startConversation'),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-controls-model-unavailable-message']},'children':[{'tag':'p','children':[{'text':hs(this['locale'],'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_TEXT')+'\x20'},_0x3a06f1]}]});}}class eo extends _0xb76395{['resizeButton'];constructor(_0xf80bf,_0x47e94f){super(_0xf80bf,{'label':_0x47e94f['label'],'class':'ck-ai-header\x20'+_0x47e94f['class'],'icon':_0x47e94f['icon']}),this['set']('isMaximized',!0x1),_0x47e94f['content']&&this['children']['add'](_0x47e94f['content']),_0x47e94f['showResizeButton']&&(this['resizeButton']=ds(_0xf80bf,this),this['children']['add'](this['resizeButton']));}}class io extends vt{constructor(_0x1a52d2){super(_0x1a52d2),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-disclaimer']},'children':[{'tag':'p','attributes':{'class':['ck','ck-ai-disclaimer__content']},'children':[{'text':hs(_0x1a52d2,'AI_DISCLAIMER_TEXT')}]}]});}}function so(_0x38299d,_0x353852){const _0x5ba860=new Nt(_0x38299d);return _0x5ba860['set']({'label':hs(_0x38299d,'AI_CHAT_LABEL_NEW_CHAT'),'withText':!0x0,'icon':_0x38e4f9,'class':'ck-ai-chat__start-conversation\x20'+ls}),_0x5ba860['on']('execute',()=>{_0x353852['fire']('startConversation');}),_0x5ba860;}class no extends vt{['chatHeader'];['chatFeed'];['chatControls'];['chatDisclaimer'];['_bodyCollection'];constructor(_0x436094,_0xf9b79b){super(_0x436094),this['_bodyCollection']=new Qt(_0x436094),this['_bodyCollection']['attachToDom']();const _0x50d1c5=so(_0x436094,this);this['chatHeader']=new eo(_0x436094,{'label':hs(_0x436094,'AI_CHAT_HEADING'),'icon':_0xd19f1f,'class':'ck-ai-header_chat','content':_0x50d1c5,'showResizeButton':_0xf9b79b['showResizeButton']}),this['chatHeader']['delegate']('resizeTabs')['to'](this),this['chatFeed']=new rr(_0x436094,this['_bodyCollection']),this['chatFeed']['delegate'](...tn)['to'](this),this['chatControls']=new Zr(_0x436094,{'bodyCollection':this['_bodyCollection'],'contextResourcesSearchInputVisibleFrom':_0xf9b79b['contextResourcesSearchInputVisibleFrom']}),this['chatControls']['delegate'](...tn)['to'](this),this['chatDisclaimer']=new io(_0x436094),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-chat','ck-rounded-corners'],'dir':_0x436094['uiLanguageDirection']},'children':[this['chatHeader'],this['chatFeed'],this['chatControls'],this['chatDisclaimer']]});}['populateSourceResourceBalloon'](_0x30d6f3,_0x3c598d,_0x5cff90,_0x52d584){this['chatControls']['populateSourceResourceBalloon'](_0x30d6f3,_0x3c598d,_0x5cff90,_0x52d584);}['closeSourceResourceBalloon'](_0x43f4ce){this['chatControls']['closeSourceResourceBalloon'](_0x43f4ce);}['destroy'](){this['_bodyCollection']['detachFromDom'](),super['destroy']();}}class ro extends _0x173dbd{static get['requires'](){return[os];}['_view'];static get['pluginName'](){return'AIChatUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['feedItemRenderingStrategy']='streaming';['showDiff']=!0x0;['_promiseQueue'];['_interactionPromiseResolver'];['_titleAnimationInterval']=void 0x0;['_isTrackChangesCommandValueBound']=!0x1;constructor(_0x316f88){super(_0x316f88);const _0x1aae51=this['context']['plugins']['get']('AITabs');this['set']('isBusy',!0x1),this['_promiseQueue']=new Cn(),this['_view']=new no(this['context']['locale'],{'showResizeButton':_0x1aae51['showResizeButton'],'contextResourcesSearchInputVisibleFrom':this['context']['config']['get']('ai.chat.context.searchInputVisibleFrom')}),this['_view']['delegate']('resizeTabs')['to'](_0x1aae51),this['_view']['delegate'](...tn)['to'](this),this['_view']['on']('toggleSuggestionDisplayMode',(_0x173d75,{showDiff:_0x9f30c3})=>{this['showDiff']=_0x9f30c3;}),_0x1aae51['view']['addTab']({'id':'chat','buttonLabel':hs(this['context']['locale'],'AI_CHAT_HEADING'),'buttonIcon':_0xd19f1f,'order':0x0,'content':this['_view']}),this['_view']['chatHeader']['bind']('isMaximized')['to'](_0x1aae51['view'],'isMaximized',_0x151d2e=>_0x151d2e),this['_view']['chatControls']['bind']('isLoading')['to'](this,'isBusy',_0x242368=>_0x242368),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder']()),this['bind']('isModelAvailable')['to'](this['_view']['chatControls'],'isModelAvailable');}['destroy'](){super['destroy'](),this['_titleAnimationInterval']&&clearInterval(this['_titleAnimationInterval']);}['createConversation'](_0x43e962){const _0x131e97=this['context']['config']['get']('ai.chat.welcomeMessage')??hs(this['context']['locale'],'AI_CHAT_WELCOME_MESSAGE');this['_view']['chatFeed']['clear'](),this['_view']['chatControls']['enableModelSelector'](),this['_view']['chatControls']['setModelList'](_0x43e962['availableModels'],!this['context']['config']['get']('ai.models.showModelSelector')),this['addFeedItemStaticMessage']({'id':'conversation-start','staticMessage':_0x131e97}),this['fire']('conversationCreated');}async['addFeedItemStaticMessage']({id:_0xcbd1d8,staticMessage:_0x5a1aa4}){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-reply',{'id':_0xcbd1d8,'initialContent':'<p>'+_0x5a1aa4+'</p>'});});}async['addFeedItemUserMessage'](_0x4a51e1){const _0x45f9f6=_0x4a51e1['attributes']?.['displayedPrompt']||_0x4a51e1['userMessage'];return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('user-message',{'contextItems':Array['from'](_0x4a51e1['contextItems']['values']()),'initialContent':'<p>'+_0x45f9f6+'</p>','id':_0x4a51e1['id']});});}async['addFeedItemError']({errorMessage:_0x2e99ea,id:_0x2bae33}){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('error-message',{'initialContent':'<p>'+_0x2e99ea+'</p>','id':_0x2bae33});});}async['addFeedItemAIReply'](_0x5570de){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-reply',{'id':_0x5570de['interactionId']+':'+_0x5570de['id']}),this['clearLoadingMessage']();});}async['addFeedItemAISuggestion'](_0x1e300a){const _0x857287=$s(this['context']);let _0x46e16b=_0x857287['config']['get']('ai.availableReplyActions')||[...fn];if(_0x857287['plugins']['has']('TrackChanges')){if(!this['_isTrackChangesCommandValueBound']){this['_isTrackChangesCommandValueBound']=!0x0;const _0x59da81=_0x857287['commands']['get']('trackChanges');this['_view']['chatFeed']['bind']('isTrackChangesOn')['to'](_0x59da81,'value');}}else _0x46e16b=_0x46e16b['filter'](_0x304fa0=>'insertSuggestion'!=_0x304fa0);return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-suggestion-reply',{'id':_0x1e300a['interactionId']+':'+_0x1e300a['id'],'areActionsDisabled':_0x1e300a['areActionsDisabled'],'showDiff':this['showDiff'],'availableActions':_0x46e16b}),this['clearLoadingMessage']();});}async['addFeedInteractionHeader'](_0x3bd1e7,_0x848890){return this['_promiseQueue']['enqueue'](async()=>{const _0x12a8a5=this['_view']['chatFeed']['children']['last'];if(_0x12a8a5 instanceof Zn)return this['_view']['chatFeed']['children']['remove'](_0x12a8a5),void this['_view']['chatFeed']['addItem']('interaction-header',{'id':_0x3bd1e7['id'],'capabilities':{'isWebSearchEnabled':_0x12a8a5['capabilities']['isWebSearchEnabled']||_0x848890['isWebSearchEnabled'],'isReasoningEnabled':_0x12a8a5['capabilities']['isReasoningEnabled']||_0x848890['isReasoningEnabled']}});this['_view']['chatFeed']['addItem']('interaction-header',{'id':_0x3bd1e7['id'],'capabilities':_0x848890});});}async['addFeedItemCustomElement'](_0x1eb12f,_0x35ed89){let _0x572f0c;return await this['_promiseQueue']['enqueue'](async()=>{_0x572f0c=this['_view']['chatFeed']['addItem']('custom-element',{'content':_0x1eb12f,'id':_0x35ed89});}),_0x572f0c;}['removeFeedItem'](_0x12bf53){this['_view']['chatFeed']['removeItem'](_0x12bf53);}['hasFeedItem'](_0x1a528e){return this['_view']['chatFeed']['hasItem'](_0x1a528e);}['updateFeedInteractionHeader'](_0x48c55b){const _0x5bbe91=this['_view']['chatFeed']['children']['find'](_0x38fbe5=>_0x38fbe5['options']['id']==_0x48c55b['id']&&_0x38fbe5 instanceof Zn);_0x5bbe91&&_0x5bbe91['set']('isVisible',_0x48c55b['isVisible']);}async['updateFeedItemAIReplyContent'](_0x1ccaca){const _0x4bd3db=_0x1ccaca['renderingStrategy']||this['feedItemRenderingStrategy'];return this['_promiseQueue']['enqueue'](async _0x1999b8=>{await this['_view']['chatFeed']['updateReplyItem']({..._0x1ccaca,'abortSignal':_0x1999b8,'renderingStrategy':_0x4bd3db}),_0x1ccaca['isDone']&&this['markFeedItemAsDone'](_0x1ccaca['id']);});}['updateFeedItemAIReplySources'](_0x2863a9,_0x3cdd0c){this['_view']['chatFeed']['updateWebSources'](_0x2863a9,_0x3cdd0c);}async['updateFeedItemAIReplySuggestionContent'](_0x1c5c78){return this['_promiseQueue']['enqueue'](async _0x2ba377=>{await this['_view']['chatFeed']['updateSuggestionItem']({..._0x1c5c78,'abortSignal':_0x2ba377}),_0x1c5c78['isDone']&&this['markFeedItemAsDone'](_0x1c5c78['id']);});}['updateFeedItemAIReplySuggestionPartState'](_0x3241ac){this['_view']['chatFeed']['updateSuggestionPartState'](_0x3241ac);}['setFeedItemAIReplySuggestionPartActive'](_0x46c032){this['_view']['chatFeed']['setSuggestionPartActive'](_0x46c032);}['markFeedItemAsDone'](_0x38ca0b){this['_view']['chatFeed']['markItemAsDone'](_0x38ca0b);}['removeFeedInteraction'](_0x50a04e){this['_view']['chatFeed']['getItemIds']()['filter'](_0xcfca1=>_0xcfca1['startsWith'](_0x50a04e))['forEach'](_0x1aeb22=>this['_view']['chatFeed']['removeItem'](_0x1aeb22));}['startInteraction'](){const _0x28cfb2=this['prepareLoadingMessage']({'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x1});this['setLoadingMessage'](_0x28cfb2),this['_view']['chatControls']['disableModelSelector'](!this['context']['config']['get']('ai.models.showModelSelector')),this['isBusy']=!0x0,this['_view']['chatFeed']['startAutoScroll']();}['stopInteraction'](_0x54f176){this['_promiseQueue']['abort'](),this['_view']['chatFeed']['getItemIds']()['filter'](_0x2952ab=>_0x2952ab['startsWith'](_0x54f176['id']))['forEach'](_0x3d6840=>this['markFeedItemAsDone'](_0x3d6840)),this['isBusy']=!0x1,this['clearLoadingMessage'](),this['_view']['chatFeed']['stopAutoScroll']();}async['finishInteraction'](){return this['_promiseQueue']['queueEmptyPromise']['then'](()=>{this['isBusy']=!0x1,this['clearLoadingMessage'](),this['_view']['chatFeed']['stopAutoScroll']();});}['addContextItem'](_0x5ddd5b,_0x3f66af){this['_view']['chatControls']['addContextItem'](_0x5ddd5b,_0x3f66af);}['removeContextItem'](_0x4a35bd){this['_view']['chatControls']['removeContextItem'](_0x4a35bd);}['setContextItemLoading'](_0x464e74,_0x29e025){this['_view']['chatControls']['setContextItemLoading'](_0x464e74,_0x29e025);}['setIsUploadInProgress'](_0x3eec9a){this['_view']['chatControls']['setIsUploadInProgress'](_0x3eec9a);}['setConversationContext'](_0x8db99a){this['_view']['chatControls']['setConversationContext'](_0x8db99a);}['clearPendingContextUI'](){this['_view']['chatControls']['clearPendingContextUI']();}['clearConversationContextUI'](){this['_view']['chatControls']['clearConversationContextUI']();}['updateResourceState'](_0x5ef4c0,_0x14deff,_0x3addf0){this['_view']['chatControls']['updateResourceState'](_0x5ef4c0,_0x14deff,_0x3addf0);}['resetMessageInput'](){this['_view']['chatControls']['resetMessageInput'](),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder']());}['setAddContextOptions'](_0x508e9b){this['_view']['chatControls']['setAddContextOptions'](_0x508e9b);}['updateCapabilities'](_0x505a7b){this['_view']['chatControls']['setWebSearch'](_0x505a7b['isWebSearchEnabled']),this['_view']['chatControls']['setReasoning'](_0x505a7b['isReasoningEnabled']),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder'](_0x505a7b));}['setSelectedModel'](_0x3aff8a,_0x23b9fb){this['_view']['chatControls']['setModel'](_0x3aff8a),_0x23b9fb&&this['_view']['chatControls']['disableModelSelector'](!0x1);}['setFeedItemRenderingStrategy'](_0x1a4ca9){this['feedItemRenderingStrategy']=_0x1a4ca9;}['toggleLoadingSkeleton'](_0x2b60df){this['_view']['chatFeed']['toggleLoadingSkeleton'](_0x2b60df);}['resetConversationTitle'](){this['setConversationTitle'](hs(this['context']['locale'],'AI_CHAT_HEADING'));}['setConversationTitle'](_0x2cc8a0,_0x184d58=!0x1){if(_0x184d58&&!St()&&_0x2cc8a0['length'])return this['_view']['chatHeader']['label']='',void this['_animateConversationTitle'](_0x2cc8a0);this['_view']['chatHeader']['label']=_0x2cc8a0;}['setLoadingMessage'](_0x8c5e71){this['_view']['chatFeed']['setLoadingMessage'](_0x8c5e71);}['clearLoadingMessage'](){this['_view']['chatFeed']['setLoadingMessage']('');}['_animateConversationTitle'](_0x5d5a7e){let _0x458113=0x0;clearInterval(this['_titleAnimationInterval']),this['_titleAnimationInterval']=setInterval(()=>{this['_view']['chatHeader']['label']=this['_view']['chatHeader']['label']+_0x5d5a7e[_0x458113],_0x458113++,_0x458113===_0x5d5a7e['length']&&clearInterval(this['_titleAnimationInterval']);},0x1e);}['prepareLoadingMessage'](_0x2b6d68){return _0x2b6d68['isWebSearchEnabled']&&_0x2b6d68['isReasoningEnabled']?hs(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH_REASONING'):_0x2b6d68['isWebSearchEnabled']?hs(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH'):_0x2b6d68['isReasoningEnabled']?hs(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_REASONING'):hs(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_REGULAR');}['_getInputPlaceholder'](_0x4a202d){return _0x4a202d?_0x4a202d['isWebSearchEnabled']&&_0x4a202d['isReasoningEnabled']?hs(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH_REASONING'):_0x4a202d['isWebSearchEnabled']?hs(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH'):_0x4a202d['isReasoningEnabled']?hs(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REASONING'):hs(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REGULAR'):hs(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REGULAR');}['populateSourceResourceBalloon'](_0x307dc6,_0x24a148,_0x1fb09b,_0x242f28){this['_view']['populateSourceResourceBalloon'](_0x307dc6,_0x24a148,_0x1fb09b,_0x242f28);}['closeSourceResourceBalloon'](_0x24ced5){this['_view']['closeSourceResourceBalloon'](_0x24ced5);}['setPromptInputValue'](_0xa241bb){this['_view']['chatControls']['setPromptInputValue'](_0xa241bb);}['focusPromptInput'](_0xf7e54d=!0x1){this['_view']['chatControls']['focusPromptInput'](_0xf7e54d);}['scrollFeedToSuggestion'](_0x3b2f37,_0x259308){this['_view']['chatFeed']['scrollToSuggestion'](_0x3b2f37,_0x259308);}['startAutoScroll'](_0x127ea0={}){this['_view']['chatFeed']['startAutoScroll'](_0x127ea0);}['disableControls'](){this['_view']['chatControls']['isDisabled']=!0x0;}['enableControls'](){this['_view']['chatControls']['isDisabled']=!0x1;}}class oo extends Dt{['sections'];constructor(_0xbc6562,_0x287237){super(_0xbc6562),this['sections']=_0x287237,this['items']['addMany'](this['sections']),this['extendTemplate']({'attributes':{'class':['ck-ai-chat-history__sections']}});}['filter'](_0x2313ad){let _0xc2265d=0x0,_0x28c742=0x0;for(const _0x199828 of this['sections']){const {resultsCount:_0x4aba39,totalItemsCount:_0xae36ed}=_0x199828['filter'](_0x2313ad);_0xc2265d+=_0x4aba39,_0x28c742+=_0xae36ed;}return{'resultsCount':_0xc2265d,'totalItemsCount':_0x28c742};}}class ao extends Ht{['title'];['itemsViews'];['_itemsListView'];constructor(_0x385377,{title:_0x3416bf,items:_0x14c03a}){super(_0x385377);const _0x5cb5f0=this['bindTemplate'];this['set']('isVisible',!0x0),this['title']=_0x3416bf,this['itemsViews']=_0x14c03a;const _0x2377e2=new vt(_0x385377);_0x2377e2['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-history__section-title']},'children':[this['title']]}),this['_itemsListView']=new Dt(_0x385377),this['_itemsListView']['items']['addMany'](this['itemsViews']),this['setTemplate']({'tag':'li','attributes':{'class':['ck-ai-chat-history__section',_0x5cb5f0['if']('isVisible','ck-hidden',_0x2d6fb5=>!_0x2d6fb5)]},'children':[_0x2377e2,this['_itemsListView']]});}['filter'](_0xdf9c59){const _0x110403=this['itemsViews']['length'];let _0x58c1a9=0x0;for(const _0x2afd60 of this['itemsViews']){if(_0xdf9c59){const _0x4b0501=_0x2afd60['isMatching'](_0xdf9c59);_0x2afd60['isVisible']=!!_0x4b0501,_0x2afd60['highlightText'](_0xdf9c59);}else _0x2afd60['isVisible']=!0x0,_0x2afd60['highlightText'](null);_0x2afd60['isVisible']&&_0x58c1a9++;}return this['isVisible']=_0x58c1a9>0x0,{'resultsCount':_0x58c1a9,'totalItemsCount':_0x110403};}['getItem'](_0x5a99ff){return this['itemsViews']['find'](_0x5e9af3=>_0x5e9af3['id']===_0x5a99ff);}['removeItem'](_0xf3e0a3){const _0x280237=this['itemsViews']['indexOf'](_0xf3e0a3);-0x1!==_0x280237&&(this['itemsViews']['splice'](_0x280237,0x1),this['_itemsListView']['items']['remove'](_0xf3e0a3));}}class ho extends/* #__PURE__ -- @preserve */
27
- _0x16b97f(Ht){['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(_0x2b2895,_0x4cec75){super(_0x2b2895);const _0x2f97cd=this['bindTemplate'];this['set']('isEdit',!0x1),this['set']('isVisible',!0x0),this['set']('pinned',!!_0x4cec75['pinned']),this['set']('loadingState',null),this['set']('title',_0x4cec75['title']),this['id']=_0x4cec75['id'];const {createdAt:_0x1ec768,active:_0x29b0b2=!0x1}=_0x4cec75;this['_titleView']=new _0x56ea6b(),this['_titleView']['bind']('text')['to'](this,'title',t=>_0x5aed4a(t||'')),this['_titleView']['extendTemplate']({'attributes':{'class':['ck-ai-chat-history__item-title']}});const _0x4aaa3f=this['_createCheckView'](),_0x3a1bc1=this['_createPinButtonView'](_0x2b2895),_0x1548ae=this['_createMenuDropdownView'](),_0xa1ed35=this['_createEditInputView'](_0x2b2895),_0x4c17e0=this['_createAcceptEditButtonView'](_0x2b2895,_0xa1ed35),_0x39433e=this['_createCancelEditButtonView'](_0x2b2895);this['actions']=this['createCollection'](),this['mainContent']=this['createCollection'](),this['mainContent']['add'](this['_titleView']),this['actions']['add'](_0x3a1bc1),this['actions']['add'](_0x1548ae),this['on']('change:isEdit',(_0xb11969,_0x5177a0,_0x251d31)=>{this['actions']['clear'](),this['mainContent']['clear'](),_0x251d31?(this['actions']['add'](_0x4c17e0),this['actions']['add'](_0x39433e),this['mainContent']['add'](_0xa1ed35),_0xa1ed35['element']['value']=this['title']||'',_0xa1ed35['element']['focus']()):(this['actions']['add'](_0x3a1bc1),this['actions']['add'](_0x1548ae),this['mainContent']['add'](this['_titleView']));}),this['setTemplate']({'tag':'li','attributes':{'class':['ck-ai-chat-history__item',_0x29b0b2?'ck-ai-chat-history__item--active':'',_0x2f97cd['if']('isVisible','ck-hidden',_0x1ad63c=>!_0x1ad63c),_0x2f97cd['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',_0x2f97cd['if']('loadingState','ck-hidden',_0x18a1a1=>!!_0x18a1a1)]},'children':_0x29b0b2?[_0x4aaa3f]:[]},{'tag':'div','attributes':{'class':['ck-ai-loader',_0x2f97cd['if']('loadingState','ck-hidden',_0x486b6d=>!_0x486b6d)]},'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',_0x2f97cd['if']('loadingState','ck-hidden',_0x1e5bdf=>!!_0x1e5bdf)]},'children':this['mainContent']},{'tag':'div','attributes':{'class':['ck-ai-loader__text',_0x2f97cd['if']('loadingState','ck-hidden',_0xabdb66=>!_0xabdb66)]},'children':[{'text':_0x2f97cd['to']('loadingState',_0x479d6a=>_0x479d6a?hs(this['locale'],ho['LOADING_LABELS'][_0x479d6a]):'')}]}]},{'tag':'span','attributes':{'class':['ck-ai-chat-history__item-date']},'children':[_0x1ec768]}]},{'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'](_0x1e5245){this['set']('title',_0x1e5245);}['updateLoadingState'](_0x54eed3,_0x90c0bc){this['set']('loadingState',_0x90c0bc?_0x54eed3:null);}['_createCheckView'](){const _0x29b3ba=new xt();return _0x29b3ba['set']({'content':_0x406d61}),_0x29b3ba;}['_createPinButtonView'](_0x29668b){const _0x4d15ed=new Nt(_0x29668b);return _0x4d15ed['set']({'label':hs(_0x29668b,'AI_CHAT_HISTORY_PIN_BUTTON'),'icon':_0x54fbb0,'withText':!0x1,'tooltip':!0x0}),_0x4d15ed['bind']('isOn')['to'](this,'pinned'),_0x4d15ed['on']('execute',()=>{const _0x558e43=!this['pinned'];this['fire']('setConversationPinned',{'id':this['id'],'pinned':_0x558e43});}),_0x4d15ed;}['_createMenuDropdownView'](){const _0x703b18=Gt(this['locale']),_0x67fe61=_0x703b18['panelView']['children'];_0x703b18['buttonView']['set']({'label':hs(this['locale'],'AI_CHAT_HISTORY_SHOW_MORE_ITEMS'),'icon':_0xb6454c}),_0x703b18['panelPosition']='sw';const _0x25bb71=new Nt(this['locale']);_0x25bb71['label']=hs(this['locale'],'AI_CHAT_HISTORY_EDIT_NAME'),_0x25bb71['withText']=!0x0,_0x25bb71['on']('execute',()=>{this['isEdit']=!0x0;});const _0x167aee=new Nt(this['locale']);_0x167aee['label']=hs(this['locale'],'AI_CHAT_HISTORY_REMOVE'),_0x167aee['withText']=!0x0,_0x167aee['on']('execute',()=>{this['showConfirm'](hs(this['locale'],'AI_CHAT_HISTORY_REMOVE_CONFIRM'),this['element'])['then'](()=>{this['fire']('removeConversation',{'id':this['id']});});});const _0x7c7445=new Dt(this['locale']),_0x85b841=new Ht(this['locale']);_0x85b841['children']['add'](_0x25bb71);const _0x40d659=new Ht(this['locale']);return _0x40d659['children']['add'](_0x167aee),_0x7c7445['items']['addMany']([_0x85b841,_0x40d659]),_0x67fe61['add'](_0x7c7445),_0x703b18;}['_createEditInputView'](_0x3f224f){const _0x187888=new _0x5fd969(_0x3f224f),_0x49a2b4=_0x187888['bindTemplate'];return _0x187888['extendTemplate']({'on':{'keydown':_0x49a2b4['to'](_0x277fb5=>{'Enter'==_0x277fb5['key']&&this['_commitEditInputValue'](_0x187888);})}}),_0x187888;}['_createAcceptEditButtonView'](_0xb02bb2,_0x38aa94){const _0x41a51a=new Nt(_0xb02bb2);return _0x41a51a['set']({'icon':_0x406d61,'withText':!0x1,'tooltip':hs(_0xb02bb2,'AI_CHAT_HISTORY_ACCEPT')}),_0x41a51a['extendTemplate']({'attributes':{'class':['ck-confirm-view-submit']}}),_0x41a51a['on']('execute',()=>{this['_commitEditInputValue'](_0x38aa94);}),_0x41a51a;}['_commitEditInputValue'](_0x177c02){const _0x280f8e=_0x177c02['element']['value']||'';this['isEdit']=!0x1,this['fire']('editConversationTitle',{'id':this['id'],'title':_0x280f8e});}['_createCancelEditButtonView'](_0x228234){const _0x51c373=new Nt(_0x228234);return _0x51c373['set']({'icon':_0x35e3e9,'withText':!0x1,'tooltip':hs(_0x228234,'AI_CHAT_HISTORY_CANCEL')}),_0x51c373['extendTemplate']({'attributes':{'class':['ck-confirm-view-cancel']}}),_0x51c373['on']('execute',()=>{this['isEdit']=!0x1,this['fire']('edit:cancel');}),_0x51c373;}['_createSpinnerView'](){const _0x31c41b=new yn('tiny');return _0x31c41b['isVisible']=!0x0,_0x31c41b;}['isMatching'](_0x58e159){return'string'==typeof this['title']&&this['title']['match'](_0x58e159)?{'title':!0x0}:null;}['highlightText'](_0x4fb02e){this['_titleView']['highlightText'](_0x4fb02e);}}class co extends vt{['headerView'];['searchView'];['mainErrorView'];['skeletonView'];['emptyView'];['sectionsView'];constructor(_0x2196d1,_0x225db8){super(_0x2196d1),this['set']('hasItems',!0x1),this['set']('isLoading',!0x0),this['set']('errorMessage',''),this['set']('isSearchViewVisible',!0x1),this['set']('isEmptyViewVisible',!0x1),this['set']('isMainErrorViewVisible',!0x1);const _0x97f466=so(_0x2196d1,this);this['headerView']=new eo(_0x2196d1,{'label':hs(_0x2196d1,'AI_CHAT_HISTORY_HEADING'),'icon':_0x592da0,'class':'ck-ai-header_history','content':_0x97f466,'showResizeButton':_0x225db8}),this['headerView']['delegate']('resizeTabs')['to'](this),this['sectionsView']=new oo(_0x2196d1,[]),this['sectionsView']['delegate'](...lo)['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',_0x181505=>!_0x181505)]}}),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 _0x3122ca=new _0x5bd8a7(this['locale'],{'filteredView':this['sectionsView'],'queryView':{'label':hs(this['locale'],'AI_CHAT_HISTORY_SEARCH_LABEL')},'infoView':{'text':{'notFound':{'primary':_0x5d3bf2=>hs(this['locale'],'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_PRIMARY',_0x5d3bf2),'secondary':hs(this['locale'],'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_SECONDARY')}}}}),_0x4e3d68=this['_createErrorView']();return _0x4e3d68['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('errorMessage','ck-hidden',_0x1e221d=>!_0x1e221d)]}}),_0x3122ca['on']('render',()=>{_0x3122ca['children']['add'](_0x4e3d68,0x1);}),_0x3122ca['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isSearchViewVisible','ck-hidden',_0x1d3455=>!_0x1d3455)]}}),_0x3122ca;}['_createSkeletonView'](){const _0x519ab9=new pn(this['locale'],mn['aiHistory']);return _0x519ab9['bind']('isVisible')['to'](this,'isLoading'),_0x519ab9;}['_createErrorView'](){const _0x57171d=new vt(this['locale']),_0x5a2519=new Nt(this['locale']);_0x5a2519['set']({'withText':!0x1,'icon':_0x35e3e9,'class':'ck-ai-notification_error__dismiss-button'}),_0x5a2519['bind']('isVisible')['to'](this,'hasItems',_0x13d639=>!!_0x13d639),_0x5a2519['on']('execute',()=>{this['errorMessage']='';});const _0x2982cb=this['bindTemplate'];return _0x57171d['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-notification','ck-ai-notification_error']},'children':[{'tag':'p','children':[{'text':_0x2982cb['to']('errorMessage')}]},_0x5a2519]}),_0x57171d;}['_createEmptyStateView'](){const _0x52f09a=new vt(this['locale']);return _0x52f09a['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-history__empty',this['bindTemplate']['if']('isEmptyViewVisible','ck-hidden',_0x1c4f59=>!_0x1c4f59)]},'children':[{'tag':'p','attributes':{'class':['ck-ai-chat-history__empty-message']},'children':[hs(this['locale'],'AI_CHAT_HISTORY_EMPTY_MESSAGE')]}]}),_0x52f09a;}['_createListItemViews'](_0xe8cd89,_0x20dc35){const _0x38164d=[];for(const _0x1caa5e of _0xe8cd89){const _0x138c48=new ho(_0x20dc35,_0x1caa5e);_0x138c48['delegate'](...lo)['to'](this),_0x38164d['push'](_0x138c48);}return _0x38164d;}['updateHistoryItemsWithCategories'](_0x41afdf){const _0x42384e=this['locale']||'en',_0x2df217=[];for(const _0x17dfd6 of _0x41afdf){const _0x24c061=this['_createListItemViews'](_0x17dfd6['items'],_0x42384e);_0x2df217['push'](new ao(_0x42384e,{'title':_0x17dfd6['title'],'items':_0x24c061}));}this['sectionsView']['sections']=_0x2df217,this['sectionsView']['items']['clear'](),this['sectionsView']['items']['addMany'](_0x2df217),this['hasItems']=_0x41afdf['some'](_0x299947=>_0x299947['items']['length']>0x0),this['_refreshSearch']();}['removeHistoryItem'](_0x399f02){for(const _0x8f4e of this['sectionsView']['sections']){const _0x257fa2=_0x8f4e['getItem'](_0x399f02);if(_0x257fa2){if(_0x8f4e['removeItem'](_0x257fa2),0x0===_0x8f4e['itemsViews']['length']){const _0x4cec61=this['sectionsView']['sections']['indexOf'](_0x8f4e);-0x1!==_0x4cec61&&(this['sectionsView']['sections']['splice'](_0x4cec61,0x1),this['sectionsView']['items']['remove'](_0x8f4e));}this['hasItems']=this['sectionsView']['sections']['length']>0x0,this['_refreshSearch']();break;}}}['updateItemTitle'](_0x2f37c6,_0xd13631){for(const _0x2f332 of this['sectionsView']['sections']){const _0x41a17e=_0x2f332['getItem'](_0x2f37c6);if(_0x41a17e){_0x41a17e['updateTitle'](_0xd13631);break;}}}['updateItemLoadingState'](_0x49f650,_0x255962,_0x2146a2){for(const _0x27dc79 of this['sectionsView']['sections']){const _0x43a99f=_0x27dc79['getItem'](_0x49f650);if(_0x43a99f){_0x43a99f['updateLoadingState'](_0x255962,_0x2146a2);break;}}}['_refreshSearch'](){if(this['hasItems']){const _0x48ad09=this['searchView']['queryView']['fieldView']?.['element']?.['value']||'';this['searchView']['search'](_0x48ad09);}}}const lo=['showConversationHistory','removeConversation','editConversationTitle','setConversationPinned','selectConversation','startConversation'];class uo extends _0x173dbd{static get['requires'](){return[os];}['_historyView'];static get['pluginName'](){return'AIChatHistoryUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x2c93a7){super(_0x2c93a7);const _0x329dbd=this['context']['plugins']['get']('AITabs');this['_historyView']=new co(this['context']['locale'],_0x329dbd['showResizeButton']),this['_historyView']['delegate']('resizeTabs')['to'](_0x329dbd),this['_historyView']['delegate'](...lo)['to'](this),this['_historyView']['headerView']['bind']('isMaximized')['to'](_0x329dbd['view'],'isMaximized',_0x37db23=>_0x37db23),_0x329dbd['view']['addTab']({'id':'history','buttonLabel':hs(this['context']['locale'],'AI_CHAT_HISTORY_HEADING'),'buttonIcon':_0x592da0,'order':0x0,'content':this['_historyView']});}['removeHistoryItem'](_0xc5f7f0){this['_historyView']['removeHistoryItem'](_0xc5f7f0);}['updateItems'](_0x43c435){this['_historyView']['updateHistoryItemsWithCategories'](_0x43c435);}['updateItemTitle'](_0x13b04e,_0x24ab7f){this['_historyView']['updateItemTitle'](_0x13b04e,_0x24ab7f);}['updateItemLoadingState'](_0x452ee6,_0x60d75d,_0x395ada){this['_historyView']['updateItemLoadingState'](_0x452ee6,_0x60d75d,_0x395ada);}['setLoadingSkeleton'](_0x40c4c2){this['_historyView']['isLoading']=_0x40c4c2;}['showError'](_0xb0de4a){this['_historyView']['errorMessage']=_0xb0de4a;}['hideError'](){this['_historyView']['errorMessage']='';}}class _o extends ht(){['id'];['createdAt'];constructor({id:_0x3b111c,title:_0x51b2bf,createdAt:_0x494000,updatedAt:_0x357470,pinned:_0x159c76}){super(),this['id']=_0x3b111c,this['createdAt']=new Date(_0x494000),this['set']('title',_0x51b2bf),this['set']('updatedAt',_0x357470?new Date(_0x357470):null),this['set']('pinned',_0x159c76||!0x1);}['updateTitle'](_0xc49d1e){this['set']('title',_0xc49d1e),this['updatedAt']=new Date();}['updatePinned'](_0x4ab6d9){this['set']('pinned',_0x4ab6d9),this['updatedAt']=new Date();}}class go extends Tt(){['items']=[];['connector'];['group'];constructor({connector:_0x48bbed,group:_0x21c2fd}){super(),this['connector']=_0x48bbed,this['group']=_0x21c2fd;}async['init'](){try{const _0x5730f5=this['connector']['fetchConversations'](this['group']),_0x4f29cd=await _0x5730f5['getConversations']();this['loadItems'](_0x4f29cd);}catch(_0x1c32f7){this['fire']('error',{'error':_0x1c32f7,'operation':'init'});}}['addItem'](_0x34c9ec){this['items']['push'](_0x34c9ec);}async['removeItem'](_0x564180){const _0x1ae2e2=this['items']['findIndex'](_0x4349fc=>_0x4349fc['id']===_0x564180);if(-0x1===_0x1ae2e2)return!0x1;try{return await this['connector']['deleteConversation'](_0x564180)['execute'](),this['items']['splice'](_0x1ae2e2,0x1),this['fire']('itemRemoved',{'itemId':_0x564180}),!0x0;}catch(_0x5ed246){return this['fire']('error',{'error':_0x5ed246,'operation':'removeItem','itemId':_0x564180}),!0x1;}}['getItem'](_0x22a4d7){return this['items']['find'](_0x4c4473=>_0x4c4473['id']===_0x22a4d7);}async['updateItemTitle'](_0x5eb29b,_0xd42448){const _0x303f2a=this['getItem'](_0x5eb29b);if(!_0x303f2a)return!0x1;try{return await this['connector']['updateConversation'](_0x5eb29b,{'title':_0xd42448})['getResult'](),_0x303f2a['updateTitle'](_0xd42448),this['fire']('itemUpdated',{'itemId':_0x5eb29b,'updates':{'title':_0xd42448}}),!0x0;}catch(_0x37d3f1){return this['fire']('error',{'error':_0x37d3f1,'operation':'updateItemTitle','itemId':_0x5eb29b}),!0x1;}}async['updateItemPinned'](_0x11841a,_0x1ac777){const _0x32dbdf=this['getItem'](_0x11841a);if(!_0x32dbdf)return!0x1;try{return await this['connector']['updateConversation'](_0x11841a,{'pinned':_0x1ac777})['getResult'](),_0x32dbdf['updatePinned'](_0x1ac777),this['fire']('itemUpdated',{'itemId':_0x11841a,'updates':{'pinned':_0x1ac777}}),!0x0;}catch(_0x53d676){return this['fire']('error',{'error':_0x53d676,'operation':'updateItemPinned','itemId':_0x11841a}),!0x1;}}['loadItems'](_0x1f6303){try{this['items']=[],_0x1f6303['map'](_0x1c6cef=>{this['addItem'](new _o(_0x1c6cef));}),this['fire']('itemsLoaded',{'items':[...this['items']]});}catch(_0x159ed3){this['fire']('error',{'error':_0x159ed3,'operation':'loadItems'});}}['getItems'](_0x4c8420={}){const _0x5a2deb=void 0x0!==_0x4c8420['pinned']&&_0x4c8420['pinned'],_0x4e818c=_0x4c8420['from']?new Date(_0x4c8420['from']['getFullYear'](),_0x4c8420['from']['getMonth'](),_0x4c8420['from']['getDate']()):null,_0x43f9be=_0x4c8420['to']?new Date(_0x4c8420['to']['getFullYear'](),_0x4c8420['to']['getMonth'](),_0x4c8420['to']['getDate']()):null;return this['items']['filter'](_0x5ccd31=>{if(_0x5ccd31['pinned']!==_0x5a2deb)return!0x1;if(_0x43f9be){const _0x57d601=new Date(_0x5ccd31['createdAt']['getFullYear'](),_0x5ccd31['createdAt']['getMonth'](),_0x5ccd31['createdAt']['getDate']());return _0x4e818c?_0x4e818c['getTime']()===_0x43f9be['getTime']()?_0x57d601['getTime']()===_0x4e818c['getTime']():_0x57d601<_0x43f9be&&_0x57d601>=_0x4e818c:_0x57d601<_0x43f9be;}return!0x0;});}}class Ao extends _0x173dbd{['_aiConnector'];['_aiChatHistoryUi'];['_aiChatController'];static get['requires'](){return[as,Xs,uo,os];}static get['pluginName'](){return'AIChatHistoryController';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){this['_aiConnector']=this['context']['plugins']['get'](as),this['_aiChatHistoryUi']=this['context']['plugins']['get'](uo),this['_aiChatController']=this['context']['plugins']['get'](Xs);const _0x5babdc=this['context']['plugins']['get'](os);try{const _0x442cb9=this['_aiChatController']['getGroupId']();this['history']=new go({'connector':this['_aiConnector'],'group':_0x442cb9}),this['listenTo'](this['_aiChatHistoryUi'],'removeConversation',(_0x255940,_0x14f45d)=>{this['_setItemLoading'](_0x14f45d['id'],'remove'),this['_handleRemove'](_0x14f45d['id']);}),this['listenTo'](this['_aiChatHistoryUi'],'editConversationTitle',(_0x2d0bca,_0x4fe672)=>{this['_setItemLoading'](_0x4fe672['id'],'rename'),this['_handleEditTitle'](_0x4fe672['id'],_0x4fe672['title']);}),this['listenTo'](this['history'],'itemUpdated',(_0x39be18,_0x130199)=>{void 0x0!==_0x130199['updates']['title']&&this['_aiChatHistoryUi']['updateItemTitle'](_0x130199['itemId'],_0x130199['updates']['title']),void 0x0!==_0x130199['updates']['pinned']&&this['_updateHistoryItemsUI'](),this['_clearItemLoading'](_0x130199['itemId']);}),this['listenTo'](this['history'],'itemRemoved',(_0x1fc019,_0x1681c0)=>{this['_aiChatController']['_handleRemovedConversation'](_0x1681c0['itemId']),this['_aiChatHistoryUi']['removeHistoryItem'](_0x1681c0['itemId']),this['_clearItemLoading'](_0x1681c0['itemId']);}),this['listenTo'](this['history'],'itemsLoaded',()=>{this['_updateHistoryItemsUI']();}),this['listenTo'](this['history'],'error',(_0x1d91ef,_0x3d60c4)=>{this['_handleHistoryErrorUI'](_0x3d60c4['error'],_0x3d60c4['operation'],_0x3d60c4['itemId']);}),this['listenTo'](this['_aiChatHistoryUi'],'selectConversation',(_0x211631,_0x17c22c)=>{this['_handleSelectConversation'](_0x17c22c['id']);}),this['listenTo'](this['_aiChatHistoryUi'],'setConversationPinned',(_0x565aa9,_0x150ac8)=>{const _0x43b9b8=_0x150ac8['pinned']?'pin':'unpin';this['_setItemLoading'](_0x150ac8['id'],_0x43b9b8),this['_handleTogglePin'](_0x150ac8['id'],_0x150ac8['pinned']);}),this['listenTo'](this['_aiChatHistoryUi'],'startConversation',()=>{this['_aiChatController']['startConversation'](),_0x5babdc['view']['activateTab']('chat');}),this['listenTo'](this['_aiChatController'],'change:activeConversation',()=>{this['_updateHistoryItemsUI']();}),_0x5babdc['view']['on']('activateTab:history',()=>{this['_showConversationHistory']();});}catch(_0x1ba66a){this['_handleHistoryErrorUI'](_0x1ba66a,'init');}}async['_handleEditTitle'](_0x528a8d,_0x539a2a){await this['history']['updateItemTitle'](_0x528a8d,_0x539a2a);}async['_handleTogglePin'](_0x2965e7,_0x9ccb25){await this['history']['updateItemPinned'](_0x2965e7,_0x9ccb25);}async['_handleRemove'](_0x317462){await this['history']['removeItem'](_0x317462);}async['_handleSelectConversation'](_0x18d16a){await this['_aiChatController']['loadConversation'](_0x18d16a);}async['_showConversationHistory'](){this['_aiChatHistoryUi']['showError'](''),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x0),await this['history']['init'](),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x1);}['_updateHistoryItemsUI'](){const _0x1d4faa=this['_aiChatController']['activeConversation']?.['id'],_0x14d5de=this['_getCategorizedItems']()['map'](_0x48c4a9=>({'title':_0x48c4a9['title'],'items':_0x48c4a9['items']['map'](_0x47e229=>({'id':_0x47e229['id'],'title':_0x47e229['title']||hs(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION'),'createdAt':new Date(_0x47e229['createdAt'])['toLocaleDateString'](),'active':_0x47e229['id']===_0x1d4faa,'pinned':_0x47e229['pinned']}))}));this['_aiChatHistoryUi']['updateItems'](_0x14d5de);}['_setItemLoading'](_0x2b5941,_0x8ed10d){this['_aiChatHistoryUi']['updateItemLoadingState'](_0x2b5941,_0x8ed10d,!0x0);}['_clearItemLoading'](_0x22ca88){this['_aiChatHistoryUi']['updateItemLoadingState'](_0x22ca88,null,!0x1);}['_handleHistoryErrorUI'](_0x5adf90,_0x5dc2b2,_0x4ff920){const _0x28a1dc=this['_generateErrorMessage'](_0x5dc2b2,_0x4ff920);this['_aiChatHistoryUi']['showError'](_0x28a1dc),_0x4ff920&&this['_clearItemLoading'](_0x4ff920),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x1);}['_generateErrorMessage'](_0x3303c3,_0x2c69e7){const _0x343a32=_0x2c69e7?this['history']['getItem'](_0x2c69e7):null,_0x390a26=_0x343a32?.['title']||hs(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION');switch(_0x3303c3){case'updateItemTitle':return hs(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_UPDATE_TITLE',_0x390a26);case'updateItemPinned':{const _0x30dc39=hs(this['context']['locale'],_0x343a32?.['pinned']?'AI_CHAT_HISTORY_UNPIN_ACTION':'AI_CHAT_HISTORY_PIN_ACTION');return hs(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_UPDATE_PINNED',[_0x30dc39,_0x390a26]);}case'removeItem':return hs(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_REMOVE_ITEM',_0x390a26);case'init':case'loadItems':return hs(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_LOAD_ITEMS');default:return hs(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_GENERIC');}}['_getCategorizedItems'](){const _0x3ce695=new Date(),_0xbf57ae=new Date(_0x3ce695['getFullYear'](),_0x3ce695['getMonth'](),_0x3ce695['getDate']()),_0xa94ec=new Date(_0xbf57ae);_0xa94ec['setDate'](_0xa94ec['getDate']()-0x1);const _0x4ebf52=new Date(_0xbf57ae);_0x4ebf52['setDate'](_0x4ebf52['getDate']()-0xe);const _0x2cd08c=this['history']['getItems']({'pinned':!0x0}),_0x17f632=this['history']['getItems']({'from':_0xbf57ae,'to':_0xbf57ae}),_0x34588c=this['history']['getItems']({'from':_0xa94ec,'to':_0xa94ec}),_0x12dd4c=this['history']['getItems']({'from':_0x4ebf52,'to':_0xa94ec}),_0x26f01d=this['history']['getItems']({'to':_0x4ebf52}),_0x428469=[];return _0x2cd08c['length']>0x0&&_0x428469['push']({'title':hs(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_PINNED'),'items':_0x2cd08c}),_0x17f632['length']>0x0&&_0x428469['push']({'title':hs(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_TODAY'),'items':_0x17f632}),_0x34588c['length']>0x0&&_0x428469['push']({'title':hs(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_YESTERDAY'),'items':_0x34588c}),_0x12dd4c['length']>0x0&&_0x428469['push']({'title':hs(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_LAST_14_DAYS'),'items':_0x12dd4c}),_0x26f01d['length']>0x0&&_0x428469['push']({'title':hs(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_LATER'),'items':_0x26f01d}),_0x428469;}}class Io extends _0x173dbd{static get['requires'](){return[Ao,uo];}static get['pluginName'](){return'AIChatHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class Eo extends _0x173dbd{static get['requires'](){return[Xs,Js,ro,Io];}static get['pluginName'](){return'AIChat';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x1ee84c){super(_0x1ee84c),this['context']['config']['define']('ai.chat.context',{'document':{'enabled':!0x0},'urls':{'enabled':!0x0},'files':{'enabled':!0x0},'sources':[],'alwaysAddSelection':!0x1}),this['context']['config']['define']('ai.chat.initialConversation','new');}}class po extends Nt{['id'];constructor(_0x54fc1b,_0xaa95d9){super(_0x54fc1b);const {id:_0x144dcf,type:_0x26c8a3,icon:_0x347d6f}=_0xaa95d9;this['id']=_0x144dcf,this['set']({'label':_0xaa95d9['label'],'withText':!0x0,'class':'ck-ai-chat-shortcut'}),this['extendTemplate']({'attributes':{'data-cke-ai-shortcut-id':_0xaa95d9['id']}}),_0x347d6f?this['icon']=_0x347d6f:'chat'===_0x26c8a3?this['icon']=_0xd19f1f:'review'===_0x26c8a3?this['icon']=_0x4a5506:'translate'===_0x26c8a3&&(this['icon']=_0x199a24);}}class mo extends vt{['listView'];constructor(_0x48f6e7,_0x40ecbe){super(_0x48f6e7);const _0xb55422=_0x40ecbe['map'](_0x2cac81=>{const _0xc59b77=new Ht(this['locale']),_0x45c6d3=new po(this['locale'],_0x2cac81);return _0xc59b77['children']['add'](_0x45c6d3),_0x45c6d3['delegate']('execute')['to'](this),_0xc59b77;});this['listView']=new Dt(this['locale']),this['listView']['items']['addMany'](_0xb55422),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-shortcuts']},'children':[this['listView']]});}}const To='chat-shortcuts';class Co extends _0x173dbd{['_shortcuts'];['_shortcutsView'];['_aiChatUI'];static get['requires'](){return[ro];}static get['pluginName'](){return'AIChatShortcuts';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){this['_aiChatUI']=this['context']['plugins']['get'](ro),this['_shortcuts']=this['context']['config']['get']('ai.chat.shortcuts')??[];const _0x3af124=this['context']['plugins']['get']('AIChatController');this['_shortcuts']['length']&&(this['_validateShortcuts'](),this['_aiChatUI']['on']('conversationCreated',()=>{_0x3af124['activeConversation']['isFromHistory']||this['_injectShortcuts']();}),this['listenTo'](_0x3af124,'interactionStarted',()=>{this['_removeShortcuts']();}));}['_validateShortcuts'](){const _0x2cbf91=['chat','review','translate'];this['_shortcuts']['forEach'](_0x4db9eb=>{let _0x377df2=!0x0;if(_0x4db9eb['id']&&_0x4db9eb['label']&&_0x2cbf91['includes'](_0x4db9eb['type'])?'chat'===_0x4db9eb['type']&&(_0x377df2='string'==typeof _0x4db9eb['prompt']):_0x377df2=!0x1,!_0x377df2)throw new at('ai-chat-shortcuts-invalid-config',this['context'],{'shortcut':_0x4db9eb});});}['_injectShortcuts'](){const _0x3647a5=this['context']['plugins']['get'](ro);this['_shortcutsView']=new mo(this['context']['locale'],this['_shortcuts']),this['_shortcutsView']['render'](),_0x3647a5['addFeedItemCustomElement'](this['_shortcutsView']['element'],To),this['_shortcutsView']['on']('execute',_0x2153a0=>{const _0x46b32e=_0x2153a0['source']['id'];this['_executeShortcut'](_0x46b32e);});}['_removeShortcuts'](){const _0x1c6fee=this['context']['plugins']['get'](ro);_0x1c6fee['hasFeedItem'](To)&&_0x1c6fee['removeFeedItem'](To),this['_shortcutsView']?.['destroy']();}['_executeShortcut'](_0x3c7e36){const _0x27a50a=this['_shortcuts']['find'](_0x4999d9=>_0x4999d9['id']===_0x3c7e36),_0x810c75=_0x27a50a['type'];'chat'===_0x810c75?this['_runChatShortcut'](_0x27a50a):'review'===_0x810c75?_0x27a50a['commandId']?this['_runReviewShortcut'](_0x27a50a):this['_switchTab']('reviewMode'):'translate'===_0x810c75&&(_0x27a50a['language']?this['_runTranslateShortcut'](_0x27a50a):this['_switchTab']('translate'));}['_switchTab'](_0x2a1193){if(!this['context']['plugins']['has']('AITabs'))throw new at('ai-chat-shortcuts-ai-tabs-not-found',this['context'],{'tabName':_0x2a1193});this['context']['plugins']['get']('AITabs')['view']['activateTab'](_0x2a1193);}async['_runChatShortcut']({prompt:_0x230847,draftMode:_0x5e06c0,useWebSearch:_0x5c87c1=!0x1,useReasoning:_0x4e36c7=!0x1,model:_0x3388a1}){const _0x14cbff=this['context']['plugins']['get']('AIChatController'),_0x4121ee=_0x14cbff['activeConversation'];let _0x31db7e;_0x31db7e=_0x3388a1?await _0x4121ee['chatModels']['getModel'](_0x3388a1):await _0x4121ee['chatModels']['getDefault'](),_0x31db7e&&await _0x4121ee['setModel'](_0x31db7e),_0x4121ee['setWebSearch'](_0x5c87c1),_0x4121ee['setReasoning'](_0x4e36c7),_0x14cbff['addCurrentDocumentToChatContext'](),_0x5e06c0?(this['_aiChatUI']['setPromptInputValue'](_0x230847),this['_aiChatUI']['focusPromptInput'](!0x0)):_0x14cbff['sendMessage']({'message':_0x230847});}['_runReviewShortcut']({commandId:_0xc1a237,model:_0x19f7c4,prompt:_0x5bbf9f,params:_0x319992}){if(!this['context']['plugins']['has']('AIReviewModeUI'))throw new at('ai-chat-shortcuts-review-mode-not-found',this['context']);this['_switchTab']('reviewMode');const _0x285df7={'id':_0xc1a237,'isCustom':'custom'===_0xc1a237};_0x19f7c4&&_0x5bbf9f&&(_0x285df7['args']={'model':_0x19f7c4,'prompt':_0x5bbf9f}),_0x319992&&(_0x285df7['params']=_0x319992),this['context']['plugins']['get']('AIReviewModeUI')['fire']('runReviewCheck',_0x285df7);}['_runTranslateShortcut']({language:_0x331337}){if(!this['context']['plugins']['has']('AITranslateUI'))throw new at('ai-chat-shortcuts-translate-not-found',this['context']);this['_switchTab']('translate'),this['context']['plugins']['get']('AITranslateUI')['fire']('runReviewCheck',{'id':_0x331337,'args':{'language':_0x331337}});}}class wo extends _0x131d8d{constructor(_0x816391){super(_0x816391);const _0x28c1ab=_0x816391['plugins']['get']('AITabs')['view'];this['bind']('value')['to'](_0x28c1ab,'isVisible'),this['isEnabled']=!0x0;}['execute'](){const _0x24e354=this['editor']['plugins']['get']('AITabs')['view'];_0x24e354['isVisible']=!_0x24e354['isVisible'];}}class fo extends _0x5e248a{static get['requires'](){return[os];}static get['pluginName'](){return'AIToggleButtonUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x1b59e6=this['editor'];_0x1b59e6['commands']['add']('toggleAi',new wo(_0x1b59e6)),_0x1b59e6['ui']['componentFactory']['add']('toggleAi',()=>{const _0x25ee2b=this['_createAIUIButton'](Nt);return _0x25ee2b['set']({'tooltip':!0x0,'class':'ck-ai-toggle-button'}),_0x25ee2b;}),_0x1b59e6['ui']['componentFactory']['add']('menuBar:toggleAi',()=>{const _0x5c007d=this['_createAIUIButton'](Wt);return _0x5c007d['set']({'role':'menuitemcheckbox'}),_0x5c007d;});}['_createAIUIButton'](_0x47373e){const _0x2a6e8c=this['editor'],_0x40b850=_0x2a6e8c['commands']['get']('toggleAi'),_0x487cc5=new _0x47373e(_0x2a6e8c['locale']);return _0x487cc5['set']({'label':hs(_0x2a6e8c['locale'],'AI_TOGGLE_BUTTON_LABEL'),'icon':_0x45afa0,'isToggleable':!0x0}),_0x487cc5['bind']('isEnabled')['to'](_0x40b850),_0x487cc5['bind']('isOn')['to'](_0x40b850,'value',_0x255fcc=>!!_0x255fcc),this['listenTo'](_0x487cc5,'execute',()=>{_0x40b850['execute']();}),_0x487cc5;}}const bo=['applySuggestion','insertSuggestion','showNext','showPrevious'];class So extends vt{['_errorView'];constructor(_0x36b35a){super(_0x36b35a),this['set']('_errorMessage',''),this['set']('_isErrorVisible',!0x1);}['showBlockingError'](_0x5c4295){this['showError'](_0x5c4295);}['showError'](_0x4b6aad){this['_errorView']||(this['_errorView']=this['_createErrorView']()),this['_errorMessage']=_0x4b6aad,this['_isErrorVisible']=!0x0;}['hideError'](){this['_isErrorVisible']=!0x1;}['_createErrorView'](){const _0x1e3773=new vt(this['locale']),_0x3d1513=new vt(this['locale']);return _0x3d1513['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__error-text']},'children':[{'text':this['bindTemplate']['to']('_errorMessage')}]}),_0x1e3773['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__error','ck-ai-balloon-error',this['bindTemplate']['if']('_isErrorVisible','ck-hidden',_0x2db92d=>!_0x2db92d)]},'children':[_0x3d1513]}),_0x1e3773;}}const Ro=0xa;class Oo extends _0x173dbd{static get['requires'](){return[Js];}static get['pluginName'](){return'AIBalloon';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['isOpen']=!0x1;['_currentConfig'];['_getTargetEditor'](){return this['_currentConfig']?.['targetEditor']??$s(this['context']);}['_isUpdatingMarkers']=!0x1;['open'](_0x4aff70){const {id:_0x420cd0}=this['_currentConfig']??{};this['_currentConfig']=_0x4aff70;const {id:_0x34bca3}=this['_currentConfig'];this['isOpen']&&_0x420cd0===_0x34bca3?this['_updateDialog']():this['_showDialog']();}['close'](){const _0x432f05=this['_getTargetEditor']()['plugins']['get']('Dialog');_0x432f05['isOpen']&&this['_currentConfig']&&_0x432f05['id']===this['_currentConfig']['id']&&_0x432f05['hide']();}['_updateDialog'](){const _0x5956d7=this['_getTargetEditor']()['plugins']['get']('Dialog'),{icon:_0x3a6348,title:_0x529482}=this['_currentConfig'];_0x5956d7['view']?.['headerView']&&(_0x5956d7['view']['headerView']['label']=_0x529482,_0x5956d7['view']['headerView']['iconView']&&_0x3a6348&&(_0x5956d7['view']['headerView']['iconView']['content']=_0x3a6348)),this['_isUpdatingMarkers']=!0x0,this['_showFakeVisualSelection'](),this['_isUpdatingMarkers']=!0x1,_0x5956d7['view']?.['updatePosition']();}['_showFakeVisualSelection'](){this['context']['plugins']['get'](Js)['showFakeVisualSelection']({'ranges':this['_currentConfig']['ranges'],'id':'balloon','priority':0x64}),window['getSelection']()?.['removeAllRanges']();}['_hideFakeVisualSelection'](){this['context']['plugins']['get'](Js)['hideFakeVisualSelection']('balloon');}['_showDialog'](){const _0x2ca20c=this['_getTargetEditor']()['plugins']['get']('Dialog'),{id:_0x50d952,title:_0x1d34f9,icon:_0x279e0d,class:_0x37117f,mainView:_0x534872}=this['_currentConfig'];_0x534872['delegate'](...bo)['to'](this),_0x2ca20c['show']({'title':_0x1d34f9,'icon':_0x279e0d,'hasCloseButton':!0x0,'id':_0x50d952,'position':this['_calculateDialogPosition']['bind'](this),'className':'ck-ai-balloon\x20'+(_0x37117f||''),'content':_0x534872,'onShow':_0x2cf8b9=>{this['_showFakeVisualSelection'](),this['_setupFakeVisualSelectionMarkerRemovalListener'](),_0x2cf8b9['view']?.['updatePosition']();const _0x545e1e=this['_getSelectionElements']();_0x545e1e&&_0x545e1e[0x0]&&Ct({'target':_0x545e1e[0x0],'ancestorOffset':0x14,'alignToTop':!0x0,'viewportOffset':{'top':0x14,'bottom':0x14,'left':0x0,'right':0x0}}),this['isOpen']=!0x0,_0x2cf8b9['once']('hide',()=>{this['fire']('beforeDialogClosed',{'id':_0x50d952});},{'priority':'high'});},'onHide':()=>{this['_hideFakeVisualSelection'](),this['_cleanupFakeVisualSelectionMarkerRemovalListener'](),this['fire']('dialogClosed',{'id':_0x50d952}),this['isOpen']=!0x1;}});}['_calculateDialogPosition'](_0xe9d3d0,_0x4bb2bf){if(!_0x4bb2bf){const _0x4d6243=this['_getTargetRootDomRect']();if(!_0x4d6243)return null;_0x4bb2bf=_0x4d6243;}const _0x2b3175=this['_getSelectionElements']();if(!_0x2b3175||0x0===_0x2b3175['length'])return{'left':Math['round'](_0x4bb2bf['left']+_0x4bb2bf['width']/0x2-_0xe9d3d0['width']/0x2),'top':Math['round'](_0x4bb2bf['top']+_0x4bb2bf['height']/0x2-_0xe9d3d0['height']/0x2)};const _0x51209b=Math['round'](_0x4bb2bf['left']+_0x4bb2bf['width']/0x2-_0xe9d3d0['width']/0x2),_0x1f9efd=_0x2b3175['map'](_0x492a38=>new ut(_0x492a38)),_0x1b9eed=_0xe9d3d0['height'];return{'left':_0x51209b,'top':this['_calculateOptimalTopPosition'](_0x1f9efd,_0x1b9eed,_0x4bb2bf)};}['_calculateOptimalTopPosition'](_0x538824,_0x459bd0,_0x400c0b){const _0x595b99=new ut(ct['window']),_0x3e518f=_0x538824['map'](_0x489214=>_0x489214['getVisible']())['filter'](_0x279ead=>_0x279ead),_0x366789=ut['getBoundingRect'](_0x3e518f);if(!_0x366789)return Math['round'](_0x400c0b['top']+_0x400c0b['height']/0x2);const _0x39ebc4=_0x595b99['getIntersection'](_0x366789);if(!_0x39ebc4)return Math['round'](_0x400c0b['top']+_0x400c0b['height']/0x2);const _0xc52340=_0x400c0b['getVisible'](),_0x2aaffe=_0xc52340&&_0x366789['height']>_0xc52340['height'],_0x561de8=_0x39ebc4['top'],_0x58369d=_0x39ebc4['bottom'];if(_0x2aaffe){const _0xf281eb=(_0xc52340||_0x595b99)['height']/0x2-_0x459bd0/0x2,_0x4b049b=_0x561de8-Ro-_0x400c0b['top'],_0x381b1f=_0x400c0b['bottom']-_0x58369d-Ro;return _0x4b049b>=_0x459bd0?Math['max'](Ro,_0x561de8-_0x459bd0-Ro):_0x381b1f>=_0x459bd0?_0x58369d+Ro:Math['max'](Ro,_0xf281eb);}const _0x43a1c9=_0x561de8-_0x459bd0,_0x16ecb4=_0x400c0b['bottom']-_0x58369d-Ro,_0x13332e=_0x561de8-Ro-_0x400c0b['top'];let _0x39ed9d;if(_0x16ecb4>=_0x459bd0)_0x39ed9d=_0x58369d+Ro;else{if(_0x13332e>=_0x459bd0)_0x39ed9d=_0x43a1c9-Ro;else _0x39ed9d=_0x561de8+_0x366789['height']/0x2-_0x459bd0/0x2;}return _0x39ed9d;}['_setupFakeVisualSelectionMarkerRemovalListener'](){const _0x3aab63=this['_getTargetEditor']();this['listenTo'](_0x3aab63['model']['document'],'change',()=>{if(!this['_isUpdatingMarkers']){for(const {name:_0x27857e,data:{newRange:_0x649d42}}of _0x3aab63['model']['document']['differ']['getChangedMarkers']())if(_0x27857e['startsWith'](zs+':')&&(_0x649d42&&(_0x649d42['start']['isEqual'](_0x649d42['end'])||'$graveyard'==_0x649d42['root']['rootName'])||null==_0x649d42)){const _0x4b8500=hs(this['context']['locale'],'AI_BALLOON_SELECTION_REMOVED_ERROR');this['_currentConfig']['mainView']['showBlockingError'](_0x4b8500),this['fire']('selectionRemoved');}}});}['_cleanupFakeVisualSelectionMarkerRemovalListener'](){const _0x19e5fa=this['_getTargetEditor']();this['_currentConfig']['mainView']['hideError'](),this['stopListening'](_0x19e5fa['model']['document']);}['_getSelectionElements'](){const _0x39d791=this['_getTargetEditor']();return _0x4f33d6(_0x39d791['editing'],[..._0x39d791['model']['markers']['getMarkersGroup']('ai-selection'),..._0x39d791['model']['markers']['getMarkersGroup']('ai-balloon-selection')]);}['_getTargetRootDomRect'](){const _0x482cb4=this['_currentConfig']?.['ranges']?.[0x0]?.['root'];if(!_0x482cb4)return null;const _0x36d8b5=this['_getTargetEditor'](),_0x161d1a=_0x36d8b5['editing']['view']['document']['getRoot'](_0x482cb4['rootName']);if(!_0x161d1a)return null;const _0x153926=_0x36d8b5['editing']['view']['domConverter']['mapViewToDom'](_0x161d1a);return _0x153926&&_0x153926 instanceof HTMLElement?new ut(_0x153926):null;}}class ko extends kt{['copyButton'];['likeButton'];['dislikeButton'];['showChangesButton'];['_config'];constructor(_0x5bb993,_0x366252={}){super(_0x5bb993),this['set']('isEnabled',!0x0),this['set']('isShowChangesOn',!0x1),this['_config']={'showCopy':!0x1,'showLike':!0x1,'showDislike':!0x1,..._0x366252};const _0x1c2580=!(this['_config']['showCopy']||this['_config']['showChanges']||this['_config']['showLike']||this['_config']['showDislike']||this['_config']['customView']?.['length']);this['class']=_0x1c2580?'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'](_0x4b555d){this['showChangesButton']['isEnabled']=_0x4b555d;}['_setupRatingButtons'](){this['likeButton']=new Nt(this['locale']),this['likeButton']['set']({'icon':_0x46c214,'label':hs(this['locale'],'AI_MINI_TOOLBAR_LIKE'),'class':us,'tooltip':!0x0}),this['likeButton']['bind']('isEnabled')['to'](this),this['likeButton']['on']('execute',()=>{this['fire']('like');}),this['dislikeButton']=new Nt(this['locale']),this['dislikeButton']['set']({'icon':_0x2c1fe4,'label':hs(this['locale'],'AI_MINI_TOOLBAR_DISLIKE'),'class':us,'tooltip':!0x0}),this['dislikeButton']['bind']('isEnabled')['to'](this),this['dislikeButton']['on']('execute',()=>{this['fire']('dislike');});}['_setupCopyButton'](){this['copyButton']=new Nt(this['locale']),this['copyButton']['set']({'icon':_0x47d488,'label':hs(this['locale'],'AI_MINI_TOOLBAR_COPY'),'class':'ck-ai-mini-toolbar-copy-button\x20'+us,'tooltip':!0x0}),this['copyButton']['bind']('isEnabled')['to'](this);const _0x10068d=new xt();_0x10068d['set']({'content':_0x406d61}),_0x10068d['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'+us,setTimeout(()=>{this['copyButton']['class']='ck-ai-mini-toolbar-copy-button\x20'+us;},0x7d0);}),this['copyButton']['children']['add'](_0x10068d);}['_setupShowChangesButton'](){this['showChangesButton']=new Nt(this['locale']),this['showChangesButton']['set']({'icon':_0x1ebf6f,'label':hs(this['locale'],'AI_SUGGESTION_BUTTON_SHOW_CHANGES'),'withText':'full'==this['_config']['showChanges'],'tooltip':'full'!=this['_config']['showChanges'],'class':us}),this['showChangesButton']['bind']('isOn')['to'](this,'isShowChangesOn'),this['showChangesButton']['bind']('isEnabled')['to'](this),this['showChangesButton']['bind']('icon')['to'](this,'isShowChangesOn',_0x40eb4c=>_0x40eb4c?_0x577354:_0x1ebf6f),this['showChangesButton']['on']('execute',()=>{this['fire']('toggleShowChanges');});}}class No extends So{['children'];['nextButtonView'];['previousButtonView'];['focusCycler'];['_focusables'];['_focusTracker'];['_keystrokes'];['_config'];['_streamableContentView'];['_toolbarContainerView'];['_partToolbarView'];['_stateView'];['_miniToolbarView'];constructor(_0x39a660,_0x1d986b){super(_0x39a660);const _0x168330=this['bindTemplate'];this['set']('showDiff',!0x1),this['set']('_state','pending'),this['_focusTracker']=new _t(),this['_keystrokes']=new gt(),this['_focusables']=this['createCollection'](),this['focusCycler']=new Ut({'focusables':this['_focusables'],'focusTracker':this['_focusTracker'],'keystrokeHandler':this['_keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}),this['_config']=_0x1d986b,this['nextButtonView']=this['_createNextButtonView'](),this['previousButtonView']=this['_createPreviousButtonView'](),this['_streamableContentView']=new In(_0x39a660),this['_partToolbarView']=new _n(_0x39a660,_0x1d986b['availableActions']),this['_partToolbarView']['delegate']('applySuggestion','insertSuggestion','rejectSuggestion')['to'](this),this['_togglePartToolbarButtonsVisibility'](_0x1d986b),this['_stateView']=new un(_0x39a660),this['_stateView']['isVisible']=!0x1,this['_miniToolbarView']=new ko(_0x39a660,{'showChanges':'full'}),this['_miniToolbarView']['bind']('isShowChangesOn')['to'](this,'showDiff'),this['_miniToolbarView']['on']('toggleShowChanges',()=>{this['fire']('toggleSuggestionDisplayMode');}),this['_toolbarContainerView']=new vo(_0x39a660,[this['_partToolbarView'],this['_stateView'],this['_miniToolbarView']]),this['children']=this['createCollection']([this['_streamableContentView'],this['_toolbarContainerView']]),this['on']('change:_state',(_0x10d082,_0x5bb5ee,_0x20fe9f,_0x113d96)=>{let _0x104472,_0x3f7923;'pending'===_0x113d96?(_0x104472=this['_partToolbarView'],_0x3f7923=this['_stateView']):(_0x104472=this['_stateView'],_0x3f7923=this['_partToolbarView']),this['_stateView']['setState'](_0x20fe9f),_0x104472['isVisible']=!0x1,_0x3f7923['isVisible']=!0x0;}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-balloon-main',_0x168330['to']('_state',_0x254c66=>'ck-ai-chat-balloon-main_state_'+_0x254c66)]},'children':this['children']}),this['on']('change:isTrackChangesOn',()=>{this['_togglePartToolbarButtonsVisibility'](_0x1d986b);});}['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'](_0x5ad794){_0x5ad794?.['keepErrors']||this['hideError'](),await this['_streamableContentView']['update'](_0x5ad794);}['setState'](_0x27c891){this['_state']=_0x27c891;}['showError'](_0x51994d){super['showError'](_0x51994d),this['children']['has'](this['_errorView'])||this['children']['add'](this['_errorView'],0x0);}['hideError'](){this['_isErrorVisible']&&(super['hideError'](),this['togglePartToolbarEnabled'](!0x0));}['showBlockingError'](_0x2ef274){super['showBlockingError'](_0x2ef274),this['togglePartToolbarEnabled'](!0x1);}['toggleRotatorButtonsVisibility'](_0x69fab2){this['nextButtonView']['isVisible']=this['previousButtonView']['isVisible']=_0x69fab2;}['togglePartToolbarEnabled'](_0x5bed97){this['_partToolbarView']['isEnabled']=_0x5bed97;}['_togglePartToolbarButtonsVisibility']({showApplyButton:_0x30737b,showSuggestButton:_0x3fe233}){_0x30737b=_0x30737b&&!this['isTrackChangesOn']&&this['_config']['availableActions']['includes']('applySuggestion'),_0x3fe233=_0x3fe233&&this['_config']['availableActions']['includes']('insertSuggestion'),this['_partToolbarView']['setButtonsVisibility']({'showApplyButton':_0x30737b,'showSuggestButton':_0x3fe233});}['_createNextButtonView'](){const _0x140b5f=new Nt(this['locale']);return _0x140b5f['set']({'icon':_0x361d40,'label':hs(this['locale'],'AI_BALLOON_NEXT_LABEL'),'isVisible':!0x0}),_0x140b5f['on']('execute',()=>{this['fire']('showNext');}),_0x140b5f;}['_createPreviousButtonView'](){const _0x38d471=new Nt(this['locale']);return _0x38d471['set']({'icon':_0x39b878,'label':hs(this['locale'],'AI_BALLOON_PREVIOUS_LABEL'),'isVisible':!0x0}),_0x38d471['on']('execute',()=>{this['fire']('showPrevious');}),_0x38d471;}}class vo extends vt{constructor(_0x4872b1,_0x1b175){super(_0x4872b1),this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-balloon__toolbar-container']},'children':_0x1b175});}}class yo extends _0x5e248a{static get['requires'](){return[Bt,Oo];}static get['pluginName'](){return'AIChatBalloon';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['_chatBalloonView'];constructor(_0x28241b){super(_0x28241b),this['set']('showDiff',!0x1);}['open'](_0x415e01){const _0x535759=this['editor'];this['_chatBalloonView']||(this['_chatBalloonView']=this['_createChatBalloonView']()),_0x535759['plugins']['get']('AIBalloon')['open']({..._0x415e01,'id':'aiChatBalloon','class':'ck-ai-chat-balloon','mainView':this['_chatBalloonView']}),this['_toggleRotatorButtonsInDialogHeader'](_0x415e01['showRotator']),this['_chatBalloonView']['togglePartToolbarEnabled'](!_0x415e01['areActionsDisabled']),this['_restoreDefaultViewFocus']();}['close'](){this['editor']['plugins']['get']('AIBalloon')['close']();}['updateContent'](_0x447733){return this['_chatBalloonView']||(this['_chatBalloonView']=this['_createChatBalloonView']()),this['_chatBalloonView']['updateContent'](_0x447733);}['setState'](_0x51147e){this['_chatBalloonView']&&this['_chatBalloonView']['setState'](_0x51147e);}['_createChatBalloonView'](){const _0x2500e6=this['editor'],_0x170ffd=_0x2500e6['plugins']['get']('AIBalloon'),_0x3d4198=_0x2500e6['commands']['get']('trackChanges');let _0x3836eb=_0x2500e6['config']['get']('ai.availableReplyActions')||[...fn];_0x2500e6['plugins']['has']('TrackChanges')||(_0x3836eb=_0x3836eb['filter'](_0x562e9e=>'insertSuggestion'!=_0x562e9e));const _0x4cab32=new No(_0x2500e6['locale'],{'availableActions':_0x3836eb,'showApplyButton':!0x0,'showSuggestButton':!!_0x3d4198});return _0x4cab32['bind']('showDiff')['to'](this),_0x4cab32['delegate'](...Zs)['to'](this),_0x4cab32['delegate']('showPrevious','showNext')['to'](this),_0x170ffd['delegate']('dialogClosed')['to'](this),_0x4cab32['on']('applySuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x4cab32['on']('insertSuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x4cab32['on']('rejectSuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x3d4198&&_0x4cab32['bind']('isTrackChangesOn')['to'](_0x3d4198,'value'),_0x4cab32['render'](),_0x4cab32;}['_toggleRotatorButtonsInDialogHeader'](_0x32e3ef){const _0x13b38e=this['editor'],_0x249f1b=_0x13b38e['plugins']['get']('Dialog')['view']['headerView']['children'];this['_chatBalloonView']['toggleRotatorButtonsVisibility'](_0x32e3ef),_0x249f1b['has'](this['_chatBalloonView']['previousButtonView'])||(_0x249f1b['addMany']([this['_chatBalloonView']['previousButtonView'],this['_chatBalloonView']['nextButtonView']],0x0),_0x13b38e['plugins']['get']('AIBalloon')['once']('beforeDialogClosed',()=>{_0x249f1b['remove'](this['_chatBalloonView']['previousButtonView']),_0x249f1b['remove'](this['_chatBalloonView']['nextButtonView']);}));}['_restoreDefaultViewFocus'](){this['_chatBalloonView']['focus']();}}class xo extends _0x5e248a{static get['requires'](){return[fo,yo,_0x407819];}static get['pluginName'](){return'AIEditorIntegration';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}function Lo(_0x38c442){const {editor:_0x2d772f,action:_0x4c1e97,withText:_0x3be84d=!0x1,withIcon:_0xb498e9=!0x0,isInDropdown:_0x3cdae0=!0x0,shouldPreventFocus:_0xd9e47a=!0x1}=_0x38c442;return()=>{const _0x93068c=_0x2d772f['locale'],_0xb8ec2=new Nt(_0x93068c),_0x4dd9e1=_0xb8ec2['bindTemplate'];_0x3cdae0&&_0xb8ec2['extendTemplate']({'on':{'mouseenter':_0x4dd9e1['to'](()=>{_0xd9e47a&&_0xd9e47a()||_0xb8ec2['focus']();})}});const _0x2fa832=_0x4c1e97['icon']??_0x4c1e97['parent']?.['icon'];return _0xb8ec2['set']({'label':_0x4c1e97['label'],'withText':_0x3be84d,'role':'menuitem','icon':_0xb498e9?_0x2fa832??_0x272647:void 0x0,'tooltip':!_0x3be84d,'class':'ck-ai-quick-actions-button','isEnabled':_0x4c1e97['isEnabled']}),_0xb8ec2['on']('execute',()=>{_0x2d772f['editing']['view']['focus'](),_0x2d772f['commands']['execute']('aiQuickAction',_0x4c1e97);}),_0xb8ec2;};}class Do extends _0x4eb138{['arrowView'];constructor(_0x4b5732,_0x2d67e9){super(_0x4b5732,_0x2d67e9);const _0xe9e660=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',_0x4034d0=>String(_0x4034d0)),'data-cke-tooltip-disabled':_0xe9e660['to']('isOn')},'on':{'mouseenter':_0xe9e660['to']('mouseenter')}});}['render'](){super['render'](),this['children']['add'](this['arrowView']);}['_createArrowView'](){const _0x4b16cc=new xt();return _0x4b16cc['content']=_0x108533,_0x4b16cc['extendTemplate']({'attributes':{'class':'ck-dropdown-menu-list__nested-menu__button__arrow'}}),_0x4b16cc;}}class Po extends Dt{['_allListItems'];['_allSearchableItems'];constructor(_0x368554,_0x335543,_0xd3c3de){super(_0x368554),this['_allListItems']=_0x335543,this['_allSearchableItems']=_0xd3c3de;}['filter'](_0x1555df){if(!_0x1555df)return this['items']['clear'](),this['items']['addMany'](this['_allListItems']),this['_clearHighlight'](),{'resultsCount':this['_allListItems']['length'],'totalItemsCount':this['_allListItems']['length']};const _0x4d7e3d=_0x1555df['source']['toLowerCase']()['trim'](),_0x114f68=this['_allSearchableItems']['filter'](_0x2a71c2=>(_0x2a71c2['groupLabel']?_0x2a71c2['label']+'\x20('+_0x2a71c2['groupLabel']+')':_0x2a71c2['label'])['toLowerCase']()['includes'](_0x4d7e3d));return this['items']['clear'](),this['items']['addMany'](_0x114f68['sort']((_0x17290f,_0x367d3c)=>{const _0x201116=_0x17290f['groupLabel'],_0x5d4c2b=_0x367d3c['groupLabel'];return _0x201116||_0x5d4c2b?_0x201116?0x1:-0x1:0x0;})['map'](_0x38b6ae=>_0x38b6ae['item'])),this['_highlightQuery'](_0x4d7e3d,_0x114f68),{'resultsCount':_0x114f68['length'],'totalItemsCount':this['_allSearchableItems']['length']};}['_highlightQuery'](_0x19f595,_0x3dcb1f){if(!_0x19f595)return;const _0x739605=new RegExp(_0x5607f9(_0x19f595),'gi');_0x3dcb1f['forEach'](_0x508b81=>{_0x508b81['highlightViews']&&_0x508b81['highlightViews']['forEach'](_0x303608=>{'function'==typeof _0x303608['highlightText']&&_0x303608['highlightText'](_0x739605);});});}['_clearHighlight'](){this['_allSearchableItems']['forEach'](_0x89e25d=>{_0x89e25d['highlightViews']&&_0x89e25d['highlightViews']['forEach'](_0x5a5cd7=>{'function'==typeof _0x5a5cd7['highlightText']&&_0x5a5cd7['highlightText'](null);});});}}const Ho='menu',Mo='menuitem';class Uo extends vt{['_bodyCollection'];['optionsListView'];['_searchTextView']=null;['_allSearchableItems']=[];['children'];['focusTracker'];['keystrokes'];['_focusables'];['focusCycler'];['_openNestedPanels']=new Set();['_hasSearch'];constructor(_0x1b192b,_0x44235d,_0x534061,_0xe9538e,_0x2cd40a=!0x1){const _0x6d88b=_0x1b192b['locale'];super(_0x6d88b),this['_bodyCollection']=_0xe9538e,this['_hasSearch']=_0x2cd40a;const _0x269dcf=this['_createListItems'](_0x1b192b,_0x44235d,_0x534061);this['optionsListView']=new Po(_0x6d88b,_0x269dcf,this['_allSearchableItems']),this['optionsListView']['role']=Ho,this['optionsListView']['items']['addMany'](_0x269dcf),this['focusTracker']=new _t(),this['keystrokes']=new gt(),_0x2cd40a&&(this['_searchTextView']=this['_createSearchTextView']()),this['_focusables']=_0x269dcf,this['focusCycler']=new Ut({'focusables':this['_focusables'],'focusTracker':this['focusTracker'],'keystrokeHandler':this['keystrokes']}),_0x2cd40a&&this['_searchTextView']&&this['focusCycler']['chain'](this['_searchTextView']['focusCycler']);const _0xe34fdf=_0x2cd40a&&this['_searchTextView']?[this['_searchTextView']]:[this['optionsListView']];this['children']=new _0x23af51(_0xe34fdf),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions','ck-rounded-corners'],'dir':_0x6d88b['uiLanguageDirection']},'children':this['children']});}['_createSearchTextView'](){return new _0x5bd8a7(this['locale'],{'filteredView':this['optionsListView'],'queryView':{'label':hs(this['locale'],'AI_QUICK_ACTIONS_SEARCH')},'class':'ck-ai-quick-actions-search','infoView':{'text':{'notFound':{'primary':hs(this['locale'],'AI_QUICK_ACTIONS_SEARCH_NOT_FOUND')}}}});}['_isSearchFocused'](){if(!this['_hasSearch']||!this['_searchTextView']||!this['_searchTextView']['queryView']['fieldView']['element'])return!0x1;const _0x336ea4=this['_searchTextView']['queryView']['fieldView']['element']['ownerDocument']?.['activeElement'];return this['_searchTextView']['queryView']['fieldView']['element']['contains'](_0x336ea4);}['_createListItems'](_0xa4f961,_0x2edf18,_0xdcf107){const _0x27f1ba=new _0x23af51();return _0x2edf18['forEach'](_0x4e0758=>{if('actions'in _0x4e0758){const {listItem:_0x509150}=this['_createActionGroupButton'](_0xa4f961,_0x4e0758,_0xdcf107);_0x27f1ba['add'](_0x509150),_0x4e0758['actions']['forEach'](_0x195aae=>{this['_createActionButton'](_0xa4f961,_0x195aae,_0x4e0758['label'],_0x4e0758['icon']);const {listItem:_0xf2f8d0,highlightViews:_0x153500}=this['_createSearchResultActionButton'](_0xa4f961,_0x195aae,_0x4e0758['label'],_0x4e0758['icon']);this['_allSearchableItems']['push']({'item':_0xf2f8d0,'label':_0x195aae['label'],'groupLabel':_0x4e0758['label'],'highlightViews':_0x153500});});}else{const {listItem:_0x1d125b}=this['_createActionButton'](_0xa4f961,_0x4e0758);_0x27f1ba['add'](_0x1d125b);const _0x88ae32=_0x1d125b['children']['first'];if(_0x88ae32){const {listItem:_0x35be46,highlightViews:_0x23f399}=this['_createSearchResultActionButton'](_0xa4f961,_0x4e0758);this['_allSearchableItems']['push']({'item':_0x35be46,'label':_0x88ae32['label']||'','highlightViews':_0x23f399});}}}),_0x27f1ba;}['_createActionButton'](_0x102723,_0x3d4550,_0x57fe4a,_0x4f3918){const _0x4aeb0c=new Ht(this['locale']);if(_0x57fe4a&&_0x4f3918){const _0x3ce382=new Nt(this['locale']),_0x2dc2be=_0x3ce382['bindTemplate'],_0x2ab599=new _0x56ea6b();_0x2ab599['text']=_0x3d4550['label'];const _0x54634c=new _0x56ea6b();_0x54634c['text']=_0x57fe4a;const _0x2cb8ce=new xt();_0x2cb8ce['content']=_0x4f3918,_0x2cb8ce['extendTemplate']({'attributes':{'class':'ck-ai-quick-actions-button__group-icon'}});const _0x50b990=new vt(this['locale']);_0x50b990['setTemplate']({'tag':'span','attributes':{'class':'ck-ai-quick-actions-button_with-group__open-paren'},'children':[{'text':'\x20('}]});const _0x56f041=new vt(this['locale']);return _0x56f041['setTemplate']({'tag':'span','attributes':{'class':'ck-ai-quick-actions-button_with-group__close-paren'},'children':[{'text':')'}]}),_0x3ce382['set']({'label':_0x3d4550['label']+'\x20('+_0x57fe4a+')','withText':!0x0,'role':'menuitem','class':'ck-ai-quick-actions-button\x20ck-ai-quick-actions-button_with-group','tooltip':!0x1}),_0x3ce382['setTemplate']({'tag':'button','attributes':{'class':['ck','ck-button','ck-button_with-text','ck-ai-quick-actions-button','ck-ai-quick-actions-button_with-group'],'type':'button','role':'menuitem','tabindex':'-1'},'children':[_0x2ab599,_0x50b990,_0x2cb8ce,_0x54634c,_0x56f041],'on':{'mouseenter':_0x2dc2be['to'](()=>{this['_isSearchFocused']()||_0x3ce382['focus']();}),'click':_0x2dc2be['to'](()=>{_0x3ce382['fire']('execute');})}}),_0x3ce382['on']('execute',()=>{_0x102723['editing']['view']['focus'](),_0x102723['commands']['execute']('aiQuickAction',_0x3d4550);}),_0x4aeb0c['children']['add'](_0x3ce382),{'listItem':_0x4aeb0c,'highlightViews':[_0x2ab599,_0x54634c]};}{const _0x5d7cb8=new _0x3a2569(),_0x2c89de=new Nt(this['locale'],_0x5d7cb8),_0x552504=_0x2c89de['bindTemplate'],_0x4293b3=_0x3d4550['icon']??_0x3d4550['parent']?.['icon'],_0x547991=void 0x0!==_0x3d4550['icon'];return _0x2c89de['set']({'label':_0x3d4550['label'],'withText':!0x0,'role':'menuitem','icon':_0x547991?_0x4293b3??_0x272647:void 0x0,'tooltip':!0x1,'class':'ck-ai-quick-actions-button'}),_0x2c89de['extendTemplate']({'on':{'mouseenter':_0x552504['to'](()=>{this['_isSearchFocused']()||_0x2c89de['focus']();})}}),_0x2c89de['on']('execute',()=>{_0x102723['editing']['view']['focus'](),_0x102723['commands']['execute']('aiQuickAction',_0x3d4550);}),_0x4aeb0c['children']['add'](_0x2c89de),{'listItem':_0x4aeb0c,'highlightViews':[_0x5d7cb8]};}}['_createSearchResultActionButton'](_0x24d57d,_0x55b857,_0x47e9b,_0x495cfd){return _0x47e9b&&_0x495cfd?this['_createSearchResultGroupedActionButton'](_0x24d57d,_0x55b857,_0x47e9b,_0x495cfd):this['_createSearchResultIndividualActionButton'](_0x24d57d,_0x55b857);}['_createSearchResultGroupedActionButton'](_0x15209f,_0x36467b,_0xb429f,_0x59d31b){const _0x171eee=new Ht(this['locale']),_0x5df14a=new Nt(this['locale']),_0x2a2317=_0x5df14a['bindTemplate'],{view:_0x53cbf5,highlightView:_0x2ac4b7}=this['_createSearchResultGroupRow'](_0xb429f,_0x59d31b),{view:_0x19fa2d,highlightView:_0x4d7631}=this['_createSearchResultActionRow'](_0x36467b['label']),_0x3eb731=this['_createSearchResultContentView'](_0x53cbf5,_0x19fa2d);return _0x5df14a['set']({'label':_0x36467b['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}),_0x5df14a['setTemplate']({'tag':'button','attributes':{'class':['ck','ck-button','ck-button_with-text','ck-ai-quick-actions-button','ck-ai-quick-actions-search-result-button','ck-ai-quick-actions-search-result-button_with-group'],'type':'button','role':'menuitem','tabindex':'-1'},'children':[_0x3eb731],'on':{'mouseenter':_0x2a2317['to'](()=>{this['_isSearchFocused']()||_0x5df14a['focus']();}),'click':_0x2a2317['to'](()=>{this['_handleSearchResultButtonClick'](_0x5df14a);})}}),this['_setupActionButtonExecution'](_0x5df14a,_0x15209f,_0x36467b),_0x171eee['children']['add'](_0x5df14a),{'listItem':_0x171eee,'highlightViews':[_0x2ac4b7,_0x4d7631]};}['_createSearchResultIndividualActionButton'](_0xbbc01e,_0x18b6b4){const _0x1bbcaa=new Ht(this['locale']),_0x20cbe7=new _0x3a2569(),_0xf440b3=new Nt(this['locale'],_0x20cbe7),_0x4bc90a=_0xf440b3['bindTemplate'];return _0xf440b3['set']({'label':_0x18b6b4['label'],'withText':!0x0,'role':'menuitem','icon':void 0x0,'tooltip':!0x1,'class':'ck-ai-quick-actions-button\x20ck-ai-quick-actions-search-result-button'}),_0xf440b3['extendTemplate']({'on':{'mouseenter':_0x4bc90a['to'](()=>{this['_isSearchFocused']()||_0xf440b3['focus']();})}}),this['_setupActionButtonExecution'](_0xf440b3,_0xbbc01e,_0x18b6b4),_0x1bbcaa['children']['add'](_0xf440b3),{'listItem':_0x1bbcaa,'highlightViews':[_0x20cbe7]};}['_createSearchResultGroupRow'](_0x11e345,_0x1f78f9){const _0x58c752=new vt(this['locale']),_0x13d62c=new xt();_0x13d62c['content']=_0x1f78f9,_0x13d62c['extendTemplate']({'attributes':{'class':'ck-ai-quick-actions-button__group-icon'}});const _0x2f1279=new _0x56ea6b();return _0x2f1279['text']=_0x11e345,_0x58c752['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__group-row'},'children':[_0x13d62c,_0x2f1279]}),{'view':_0x58c752,'highlightView':_0x2f1279};}['_createSearchResultActionRow'](_0x43f90c){const _0x340b56=new vt(this['locale']),_0x4a1202=new _0x56ea6b();return _0x4a1202['text']=_0x43f90c,_0x340b56['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__action-row'},'children':[_0x4a1202]}),{'view':_0x340b56,'highlightView':_0x4a1202};}['_createSearchResultContentView'](_0x4eebd2,_0x1961e4){const _0x26f614=new vt(this['locale']);return _0x26f614['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__content'},'children':[_0x4eebd2,_0x1961e4]}),_0x26f614;}['_setupActionButtonExecution'](_0x190b6c,_0x52bb81,_0x67a617){_0x190b6c['on']('execute',()=>{_0x52bb81['editing']['view']['focus'](),_0x52bb81['commands']['execute']('aiQuickAction',_0x67a617);});}['_createActionGroupButton'](_0x3cd118,_0x19b0bb,_0x5dcf80){const _0x3448da=new Ht(this['locale']),_0x233a3a=new _0x3a2569(),_0xa6ced5=new Do(this['locale'],_0x233a3a),_0x55c4bc=_0xa6ced5['bindTemplate'],_0x4fc0c9=this['_getPanelKeystroke'](_0x5dcf80),_0x1132c4=this['_createGroupActionsList'](_0x3cd118,_0x19b0bb['actions'],_0x5dcf80);_0xa6ced5['set']({'label':_0x19b0bb['label'],'withText':!0x0,'role':Mo,'icon':_0x19b0bb['icon']??_0x272647,'isEnabled':_0x19b0bb['actions']['some'](_0xf4c3f2=>_0xf4c3f2['isEnabled'])}),_0xa6ced5['extendTemplate']({'on':{'mouseenter':_0x55c4bc['to'](()=>{this['_isSearchFocused']()||_0xa6ced5['focus']();})}});const _0xd28f9b=new Xt(this['locale']);return _0xd28f9b['extendTemplate']({'attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions-group-panel','ck-dropdown-menu__nested-menu__panel']},'on':{'keydown':_0x55c4bc['to'](_0x2e3654=>{this['_handlePanelKeydown'](_0x2e3654,_0x4fc0c9,_0xa6ced5,_0xd28f9b);})}}),_0xa6ced5['bind']('isOn')['to'](_0xd28f9b,'isVisible'),this['_bodyCollection']['add'](_0xd28f9b),_0xd28f9b['content']['add'](_0x1132c4),this['_setupGroupMenuBehavior'](_0xa6ced5,_0xd28f9b),_0x3448da['children']['add'](_0xa6ced5),{'listItem':_0x3448da,'highlightView':_0x233a3a};}['_createGroupActionsList'](_0x5e3a06,_0x6e9912,_0x4cfee5){const _0xdb86df=new Dt(this['locale']);return _0xdb86df['extendTemplate']({'attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions-group-list','ck-dropdown-menu-list']}}),_0x6e9912['forEach'](_0x43c2d1=>{const _0xd5f403=new Ht(this['locale']),_0xf26d2a=Lo({'editor':_0x5e3a06,'action':_0x43c2d1,'withText':!0x0,'withIcon':!0x1,'isInDropdown':!0x0,'shouldPreventFocus':()=>this['_isSearchFocused']()})();_0xd5f403['children']['add'](_0xf26d2a),_0x4cfee5['focusTracker']['add'](_0xf26d2a),_0xdb86df['items']['add'](_0xd5f403);}),_0xdb86df;}['_setupGroupMenuBehavior'](_0x1da088,_0x33c9c9){const _0x49f1ed=_0x1da088['bindTemplate'],_0x1cf153=this['_getButtonKeystroke'](_0x1da088);_0x1da088['extendTemplate']({'attributes':{'class':['ck-ai-quick-actions-group-button']},'on':{'mouseenter':_0x49f1ed['to'](()=>{this['_showNestedPanel'](_0x33c9c9,_0x1da088);}),'mouseleave':_0x49f1ed['to'](_0xd9d6b7=>{const _0x109d31=_0xd9d6b7['relatedTarget'];this['_isMovingToNestedMenu'](_0x109d31,_0x33c9c9)||this['_hideNestedPanel'](_0x33c9c9);}),'keydown':_0x49f1ed['to'](_0x36cee7=>{_0x36cee7['key']==_0x1cf153&&(this['_showNestedPanel'](_0x33c9c9,_0x1da088),_0x33c9c9['content']['get'](0x0)['focus']());})}}),_0x33c9c9['on']('render',()=>{_0x33c9c9['element']?.['addEventListener']('mouseleave',_0x1e1836=>{const _0x46527d=_0x1e1836['relatedTarget'];_0x1da088['element']?.['contains'](_0x46527d)||this['_isMovingToNestedMenu'](_0x46527d,_0x33c9c9)||this['_hideNestedPanel'](_0x33c9c9);});});}['_showNestedPanel'](_0x3c3847,_0x22c072){this['_openNestedPanels']['forEach'](_0x17ef24=>{_0x17ef24!==_0x3c3847&&_0x17ef24['isVisible']&&_0x17ef24['hide']();}),_0x3c3847['show'](),_0x3c3847['pin']({'positions':[_0x23c38f['eastSouth']],'target':_0x22c072['element'],'fitInViewport':!0x0}),this['_openNestedPanels']['add'](_0x3c3847);}['_hideNestedPanel'](_0x2c5f40){_0x2c5f40['hide'](),this['_openNestedPanels']['delete'](_0x2c5f40);}['_hideAllNestedPanels'](){this['_openNestedPanels']['forEach'](_0x7222b5=>_0x7222b5['hide']()),this['_openNestedPanels']['clear']();}['_isMovingToNestedMenu'](_0x2d5d3f,_0x17bb1a){if(!_0x2d5d3f)return!0x1;if(_0x17bb1a['element']?.['contains'](_0x2d5d3f))return!0x0;const _0x1bda35=_0x2d5d3f;return _0x1bda35['closest']&&(null!==_0x1bda35['closest']('.ck-ai-quick-actions-group-panel')||null!==_0x1bda35['closest']('.ck-ai-quick-actions-group-list')||null!==_0x1bda35['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'](_0x190620){return'rtl'===_0x190620['locale']['uiLanguageDirection']?'ArrowRight':'ArrowLeft';}['_getButtonKeystroke'](_0x45ac15){return'rtl'===_0x45ac15['locale']['uiLanguageDirection']?'ArrowLeft':'ArrowRight';}['_handlePanelKeydown'](_0x8e2993,_0x3776cc,_0x1b9095,_0x15d3ae){_0x8e2993['key']==_0x3776cc&&(_0x1b9095['focus'](),this['_hideNestedPanel'](_0x15d3ae));}['_handleSearchResultButtonClick'](_0x4de5cf){_0x4de5cf['fire']('execute');}}function Vo(_0x25d5a0){const {editor:_0x5683e3,content:_0x55b262,buttonDefinition:_0x18daa2,bodyCollection:_0x259e08,hasSearch:_0x1ff5d3=!0x1}=_0x25d5a0;return()=>{const _0x36dbbe=_0x5683e3['locale'],_0x1803c2=_0x5683e3['commands']['get']('aiQuickAction'),_0x1ca9ac=Gt(_0x36dbbe);_0x1ca9ac['bind']('isEnabled')['to'](_0x1803c2),_0x1ca9ac['buttonView']['set']({'icon':_0x18daa2['icon']??_0x272647,'label':_0x18daa2['label'],'tooltip':!0x0}),_0x1ca9ac['set']({'class':'ck-ai-quick-actions-dropdown'});const _0x3755db=new Uo(_0x5683e3,_0x55b262,_0x1ca9ac,_0x259e08,_0x1ff5d3);return _0x1ca9ac['panelView']['children']['add'](_0x3755db),_0x1ff5d3&&_0x1ca9ac['on']('change:isOpen',(_0xf3528f,_0x1c2e8f,_0x320dbc)=>{if(_0x320dbc){if(_0x5683e3['plugins']['has']('AIEditing')){const _0x140cf6=_0x5683e3['plugins']['get'](Js),_0x4ffa44=_0x5683e3['model']['document']['selection'],_0x4c4c26=Array['from'](_0x4ffa44['getRanges']());_0x4c4c26['length']>0x0&&_0x140cf6['showFakeVisualSelection']({'ranges':_0x4c4c26,'id':'quick-action','priority':0x14});}}else _0x5683e3['plugins']['has']('AIEditing')&&_0x5683e3['plugins']['get'](Js)['hideFakeVisualSelection']('quick-action'),_0x3755db['resetSearch']();}),_0x1ca9ac;};}const Bo='<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>',Go='<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>',Fo='<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>',Ko=/* #__PURE__ -- @preserve */
28
- ((()=>({'chat':'AIChat','action':'AIActions'}))());class Wo extends _0x5e248a{static get['requires'](){return[_0x22ceab,as];}static get['pluginName'](){return'AIQuickActionsUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['init'](){const _0xecc4c6=await this['_getDefaultAndCustomActions']();this['_prepareQuickActionsDefinition'](_0xecc4c6),this['_initializeQuickActionsComponentsAndCommands']();}static['getDefaultQuickActions'](_0x1700da){return function(_0x4fb2e3){const _0x411ac5=new Intl['DisplayNames'](['en'],{'type':'language'})['of'](_0x4fb2e3['uiLanguage']),_0x523826=_0x411ac5||'English',_0x5856a7=[{'id':'ask-ai','label':hs(_0x4fb2e3,'AI_QUICK_ACTIONS_ASK_AI'),'type':'chat','icon':_0xfcf3e5},{'id':'chat-commands','label':hs(_0x4fb2e3,'AI_QUICK_ACTIONS_CHAT_COMMANDS'),'icon':_0xfcf3e5,'actions':[{'id':'explain','label':hs(_0x4fb2e3,'AI_QUICK_ACTIONS_EXPLAIN'),'displayedPrompt':hs(_0x4fb2e3,'AI_QUICK_ACTIONS_EXPLAIN'),'prompt':Bo['replace']('%0',_0x523826),'type':'chat'},{'id':'summarize','label':hs(_0x4fb2e3,'AI_QUICK_ACTIONS_SUMMARIZE'),'displayedPrompt':hs(_0x4fb2e3,'AI_QUICK_ACTIONS_SUMMARIZE'),'prompt':Go['replace']('%0',_0x523826),'type':'chat'},{'id':'highlight-key-points','label':hs(_0x4fb2e3,'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS'),'displayedPrompt':hs(_0x4fb2e3,'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS'),'prompt':Fo['replace']('%0',_0x523826),'type':'chat'}]},{'id':'improve-writing','label':hs(_0x4fb2e3,'AI_QUICK_ACTIONS_IMPROVE_WRITING'),'type':'action','icon':_0x288b1b},{'id':'continue','label':hs(_0x4fb2e3,'AI_QUICK_ACTIONS_CONTINUE_WRITING'),'type':'action','icon':_0xc7e597},{'id':'fix-grammar','label':hs(_0x4fb2e3,'AI_QUICK_ACTIONS_FIX_GRAMMAR_SPELLING'),'type':'action','icon':_0x49a57c},{'id':'adjust-length','label':hs(_0x4fb2e3,'AI_QUICK_ACTIONS_ADJUST_LENGTH'),'icon':_0x22bd65,'actions':[{'id':'make-shorter','label':hs(_0x4fb2e3,'AI_QUICK_ACTIONS_MAKE_SHORTER'),'type':'action'},{'id':'make-longer','label':hs(_0x4fb2e3,'AI_QUICK_ACTIONS_MAKE_LONGER'),'type':'action'}]},{'id':'change-tone','label':hs(_0x4fb2e3,'AI_QUICK_ACTIONS_CHANGE_TONE'),'icon':_0xda723e,'actions':[{'id':'make-tone-casual','label':hs(_0x4fb2e3,'AI_QUICK_ACTIONS_MORE_CASUAL'),'type':'action'},{'id':'make-tone-direct','label':hs(_0x4fb2e3,'AI_QUICK_ACTIONS_MORE_DIRECT'),'type':'action'},{'id':'make-tone-friendly','label':hs(_0x4fb2e3,'AI_QUICK_ACTIONS_MORE_FRIENDLY'),'type':'action'},{'id':'make-tone-confident','label':hs(_0x4fb2e3,'AI_QUICK_ACTIONS_MORE_CONFIDENT'),'type':'action'},{'id':'make-tone-professional','label':hs(_0x4fb2e3,'AI_QUICK_ACTIONS_MORE_PROFESSIONAL'),'type':'action'}]},{'id':'translate','label':hs(_0x4fb2e3,'AI_QUICK_ACTIONS_TRANSLATE'),'icon':_0x199a24,'actions':[{'id':'translate-to-english','label':hs(_0x4fb2e3,'AI_QUICK_ACTIONS_TRANSLATE_ENGLISH'),'type':'action','actionName':'translate','args':{'language':'english'}},{'id':'translate-to-chinese','label':hs(_0x4fb2e3,'AI_QUICK_ACTIONS_TRANSLATE_CHINESE'),'type':'action','actionName':'translate','args':{'language':'chinese'}},{'id':'translate-to-spanish','label':hs(_0x4fb2e3,'AI_QUICK_ACTIONS_TRANSLATE_SPANISH'),'type':'action','actionName':'translate','args':{'language':'spanish'}},{'id':'translate-to-german','label':hs(_0x4fb2e3,'AI_QUICK_ACTIONS_TRANSLATE_GERMAN'),'type':'action','actionName':'translate','args':{'language':'german'}},{'id':'translate-to-french','label':hs(_0x4fb2e3,'AI_QUICK_ACTIONS_TRANSLATE_FRENCH'),'type':'action','actionName':'translate','args':{'language':'french'}},{'id':'translate-to-japanese','label':hs(_0x4fb2e3,'AI_QUICK_ACTIONS_TRANSLATE_JAPANESE'),'type':'action','actionName':'translate','args':{'language':'japanese'}},{'id':'translate-to-portuguese','label':hs(_0x4fb2e3,'AI_QUICK_ACTIONS_TRANSLATE_PORTUGUESE'),'type':'action','actionName':'translate','args':{'language':'portuguese'}},{'id':'translate-to-korean','label':hs(_0x4fb2e3,'AI_QUICK_ACTIONS_TRANSLATE_KOREAN'),'type':'action','actionName':'translate','args':{'language':'korean'}},{'id':'translate-to-italian','label':hs(_0x4fb2e3,'AI_QUICK_ACTIONS_TRANSLATE_ITALIAN'),'type':'action','actionName':'translate','args':{'language':'italian'}},{'id':'translate-to-russian','label':hs(_0x4fb2e3,'AI_QUICK_ACTIONS_TRANSLATE_RUSSIAN'),'type':'action','actionName':'translate','args':{'language':'russian'}}]},{'id':'other','label':hs(_0x4fb2e3,'AI_QUICK_ACTIONS_OTHER'),'icon':_0x2735be,'actions':[]}];return _0x5856a7;}(_0x1700da);}async['_getDefaultAndCustomActions'](){const _0x240908=Wo['getDefaultQuickActions'](this['editor']['locale']),_0x259080=this['editor']['config']['get']('ai.quickActions.extraCommands')||[];let _0x2b92ad,_0x3d663b=[];try{const _0x51dabc=new Fs({'connector':this['editor']['plugins']['get']('AIConnector'),'config':this['editor']['config']['get']('ai.models'),'locale':this['editor']['locale']});_0x3d663b=await _0x51dabc['getAll'](),_0x2b92ad=(await _0x51dabc['getDefault']())?.['id'];}catch(_0x111a33){const _0x28700e=new at('ai-quick-actions-models-unable-to-retrieve',this,{'error':_0x111a33});Et(_0x28700e['message']);}finally{const _0x268bcd=_0x259080['map'](_0x3ed1ee=>({..._0x3ed1ee,'type':'chat'===_0x3ed1ee['type']?'chat':'action','model':'chat'!==_0x3ed1ee['type']?_0x3ed1ee['model']||_0x2b92ad:_0x3ed1ee['model'],'icon':void 0x0}));_0x240908['find'](_0x3527d2=>'other'===_0x3527d2['id'])['actions']['push'](..._0x268bcd),_0x240908['forEach'](_0x4a79e9=>{if('actions'in _0x4a79e9)_0x4a79e9['actions']['forEach'](_0x2258d1=>{if(_0x2258d1['isEnabled']=!!_0x3d663b['find'](_0x1d1adc=>_0x1d1adc['id']===_0x2258d1['model'])||void 0x0===_0x2258d1['model'],!_0x2258d1['isEnabled']){const _0x41a8e3=new at('ai-quick-actions-unavailable-model',this,{'actionId':_0x2258d1['id'],'modelId':_0x2258d1['model']});Et(_0x41a8e3['message']);}});else{if(_0x4a79e9['isEnabled']=!!_0x3d663b['find'](_0x1ea226=>_0x1ea226['id']===_0x4a79e9['model'])||void 0x0===_0x4a79e9['model'],!_0x4a79e9['isEnabled']){const _0x104980=new at('ai-quick-actions-unavailable-model',this,{'actionId':_0x4a79e9['id'],'modelId':_0x4a79e9['model']});Et(_0x104980['message']);}}});}return _0x240908;}['_initializeQuickActionsComponentsAndCommands'](){const _0x4c1db6=new Qt(this['editor']['locale']);_0x4c1db6['attachToDom'](),this['_initializeQuickActionsDropdown'](_0x4c1db6),this['_initializeQuickActionsMenuBar'](),this['_initializeQuickActionsComponents'](_0x4c1db6);}['_initializeQuickActionsDropdown'](_0x2b4d79){const _0x5b0e60=this['editor']['config']['get']('ai.quickActions.isSearchEnabled')??!0x0;this['editor']['ui']['componentFactory']['add']('aiQuickActions',Vo({'editor':this['editor'],'content':this['_quickActionsDefinition'],'buttonDefinition':{'icon':_0x272647,'label':hs(this['editor']['locale'],'AI_QUICK_ACTIONS_HEADING')},'bodyCollection':_0x2b4d79,'hasSearch':_0x5b0e60}));}['_prepareQuickActionsDefinition'](_0x5bb0c4){this['_quickActionsDefinition']=_0x5bb0c4['map'](_0x3cda55=>{if('actions'in _0x3cda55){const _0x1d21c9=_0x3cda55;return{..._0x1d21c9,'actions':_0x1d21c9['actions']['map'](_0x233180=>{const {actions:_0x5ba909,..._0x306744}=_0x1d21c9;return{..._0x233180,'parent':_0x306744};})['filter'](_0x4186a4=>this['_shouldIncludeAction'](_0x4186a4))};}return _0x3cda55;})['filter'](_0x57043c=>'actions'in _0x57043c?_0x57043c['actions']['length']>0x0:this['_shouldIncludeAction'](_0x57043c));}['_shouldIncludeAction'](_0x35a277){const _0x118cea=this['editor']['config']['get']('ai.quickActions.removeCommands')||[];return this['editor']['plugins']['has'](Ko[_0x35a277['type']])&&!_0x118cea['includes'](_0x35a277['id'])&&!('chat'===_0x35a277['type']&&!0x1===this['editor']['config']['get']('ai.chat.context.document.enabled'));}['_initializeQuickActionsComponents'](_0x27221f){this['_quickActionsDefinition']['forEach'](_0x506be0=>{if('actions'in _0x506be0){const _0x20e868=Vo({'editor':this['editor'],'content':_0x506be0['actions'],'buttonDefinition':_0x506be0,'bodyCollection':_0x27221f});this['editor']['ui']['componentFactory']['add'](_0x506be0['id'],_0x20e868),_0x506be0['actions']['forEach'](_0x23dddd=>{const _0x1e3ab7=Lo({'editor':this['editor'],'action':_0x23dddd});this['editor']['ui']['componentFactory']['add'](_0x23dddd['id'],_0x1e3ab7);});}else{const _0xa3772e=Lo({'editor':this['editor'],'action':_0x506be0,'withText':!0x1,'withIcon':!0x0,'isInDropdown':!0x1});this['editor']['ui']['componentFactory']['add'](_0x506be0['id'],_0xa3772e);}});}['_initializeQuickActionsMenuBar'](){this['editor']['ui']['componentFactory']['add']('menuBar:aiQuickActions',_0x162deb=>{const _0x23a57b=this['editor']['commands']['get']('aiQuickAction'),_0x1b73d6=new Kt(_0x162deb),_0x4ebdf8=hs(_0x162deb,'AI_QUICK_ACTIONS_HEADING');_0x1b73d6['buttonView']['set']({'label':_0x4ebdf8,'icon':_0x272647});const _0x5af936=new $t(_0x162deb);return _0x5af936['set']({'ariaLabel':_0x4ebdf8,'role':'menu'}),this['_quickActionsDefinition']['forEach'](_0x2a4f8a=>{if('actions'in _0x2a4f8a){const _0x454470=_0x2a4f8a,_0x20be4e=new qt(_0x162deb,_0x1b73d6),_0xe62bd8=new Kt(_0x162deb),_0x26b14e=new $t(_0x162deb);_0xe62bd8['buttonView']['set']({'label':_0x454470['label'],'icon':_0x454470['icon']}),_0x454470['actions']['forEach'](_0xedb6bd=>{const _0x531ded=new qt(_0x162deb,_0xe62bd8),_0x55a859=new Wt(_0x162deb);_0x55a859['set']({'label':_0xedb6bd['label'],'icon':_0xedb6bd['icon'],'role':'menuitem','isEnabled':_0xedb6bd['isEnabled']}),_0x55a859['on']('execute',()=>{this['_executeQuickAction'](_0xedb6bd);}),_0x55a859['delegate']('execute')['to'](_0xe62bd8),_0x531ded['children']['add'](_0x55a859),_0x26b14e['items']['add'](_0x531ded);}),_0xe62bd8['panelView']['children']['add'](_0x26b14e),_0x20be4e['children']['add'](_0xe62bd8),_0x5af936['items']['add'](_0x20be4e);}else{const _0x55b359=_0x2a4f8a,_0x3bd5fd=new qt(_0x162deb,_0x1b73d6),_0x1f7130=new Wt(_0x162deb);_0x1f7130['set']({'label':_0x55b359['label'],'icon':_0x55b359['icon'],'role':'menuitem','isEnabled':_0x55b359['isEnabled']}),_0x1f7130['on']('execute',()=>{this['_executeQuickAction'](_0x55b359);}),_0x1f7130['delegate']('execute')['to'](_0x1b73d6),_0x3bd5fd['children']['add'](_0x1f7130),_0x5af936['items']['add'](_0x3bd5fd);}}),(Object['values'](Ko)['some'](_0x334e07=>this['editor']['plugins']['has'](_0x334e07))?_0x1b73d6['bind']('isEnabled')['to'](_0x23a57b):_0x1b73d6['set']({'isEnabled':!0x1}),_0x1b73d6['panelView']['children']['add'](_0x5af936),_0x1b73d6);});}['_executeQuickAction'](_0x317a8a){const _0x1f6a1a=this['editor'];_0x1f6a1a['editing']['view']['focus'](),_0x1f6a1a['commands']['execute']('aiQuickAction',_0x317a8a);const _0x33be7a=_0x1f6a1a['ui']['view']['menuBarView'];_0x33be7a&&_0x33be7a['close']&&_0x33be7a['close']();}}class Yo extends _0x131d8d{['execute'](_0x340265){switch(this['_expandSelectionIfCollapsed'](),_0x340265['type']){case'chat':if(!this['editor']['plugins']['has']('AIChat')){const _0xb5a557=hs(this['editor']['locale'],'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND','AIChat');throw new at('ai-quick-actions-plugin-not-found',this['editor'],{'errorMessage':_0xb5a557});}this['_handleAIChatAction'](_0x340265);break;case'action':if(!this['editor']['plugins']['has']('AIActions')){const _0xba4eeb=hs(this['editor']['locale'],'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND','AIActions');throw new at('ai-quick-actions-plugin-not-found',this['editor'],{'errorMessage':_0xba4eeb});}this['_handleAIActionsAction'](_0x340265);}}async['_handleAIChatAction'](_0x252ecd){const _0x5ea19b=this['editor']['plugins']['get']('AIChatController'),_0x5ff885=this['editor']['plugins']['get']('AITabs')['view'];if(_0x5ff885['isVisible']||(_0x5ff885['isVisible']=!0x0),'chat'!==_0x5ff885['activeTab']&&_0x5ff885['activateTab']('chat'),'ask-ai'===_0x252ecd['id'])_0x5ea19b['removeSelectionFromChatContext'](),_0x5ea19b['addSelectionToChatContext'](),_0x5ea19b['focusPromptInput']();else await _0x5ea19b['startConversation']({'modelId':_0x252ecd['model']}),_0x5ea19b['removeSelectionFromChatContext'](),_0x5ea19b['addSelectionToChatContext'](),_0x5ea19b['focusPromptInput'](),await _0x5ea19b['sendMessage']({'message':_0x252ecd['prompt']||_0x252ecd['displayedPrompt']||_0x252ecd['label'],'attributes':{'quickActionData':{'id':_0x252ecd['id']},'displayedPrompt':_0x252ecd['displayedPrompt']}});}['_expandSelectionIfCollapsed'](){const _0x131dc9=this['editor'],_0xd1cb8e=_0x131dc9['model']['document']['selection'];if(!_0xd1cb8e['isCollapsed'])return;const _0x1eebfb=At(_0xd1cb8e['getSelectedBlocks']())||_0x131dc9['model']['schema']['getLimitElement'](_0xd1cb8e);_0x131dc9['model']['change'](_0x4c498c=>{_0x4c498c['setSelection'](_0x1eebfb,'in');});}['_handleAIActionsActionLabel'](_0x20a249){return _0x20a249['parent']?.['label']&&'other'!==_0x20a249['parent']?.['id']?_0x20a249['parent']['label']+':\x20'+_0x20a249['label']:_0x20a249['label'];}async['_handleAIActionsAction'](_0x29dd6b){const _0x36dffb=this['editor']['plugins']['get']('AIActions'),_0x55468b=_0x29dd6b['prompt']?{'userMessage':_0x29dd6b['prompt'],'model':_0x29dd6b['model']}:{'actionName':_0x29dd6b['actionName']||_0x29dd6b['id'],'args':_0x29dd6b['args']},_0x2429cb=this['_handleAIActionsActionLabel'](_0x29dd6b);await _0x36dffb['executeAction'](_0x55468b,_0x2429cb,_0x29dd6b['icon']);}}class $o extends _0x5e248a{static get['pluginName'](){return'AIQuickActionsEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x463528=this['editor'],_0x37fb69=new Yo(this['editor']);if(_0x463528['commands']['add']('aiQuickAction',_0x37fb69),_0x463528['plugins']['has']('AIChat')){const _0x59e57e=this['editor']['plugins']['get']('AIChatController');_0x463528['model']['document']['selection']['on']('change:range',(_0xf2d6d6,_0x3048ae)=>{_0x3048ae['directChange']&&_0x59e57e['removeSelectionFromChatContext']();});}}}class qo extends xs{['updateChangeGroups'](){if(this['parsedMergedContent']=this['parsedContent']['cloneNode'](!0x0),0x0==this['parsedMergedContent']['childNodes']['length'])return void(this['changeGroups']=[]);const _0x482389=this['documentContextContent']['children']['map'](_0x56b890=>({'node':_0x56b890,'id':Es(_0x56b890,'data-id')})),_0x468fc8=this['parsedMergedContent']['children']['map'](_0x45a474=>({'node':_0x45a474,'id':Es(_0x45a474,'data-id')||ot()})),_0xb5955a=_0x87a05f(_0x482389,_0x468fc8,{'comparator':(_0x38440c,_0x3bcaaf)=>_0x38440c['id']==_0x3bcaaf['id'],'oneChangePerToken':!0x0});if(!this['isDone']||!this['isComplete']){for(;_0xb5955a['length']&&_0xb5955a[_0xb5955a['length']-0x1]['removed'];)_0xb5955a['pop']();}const _0x1df7b4=_0xb5955a['map'](_0x168db0=>{const _0x510f93=_0x168db0['added']?'new':_0x168db0['removed']?'removed':'modified';return{'node':_0x168db0['value'][0x0]['node'],'type':_0x510f93,'id':_0x168db0['value'][0x0]['id']};});this['changeGroups']=[{'changes':_0x1df7b4,'state':'pending','index':0x0}];}['_getDifferentChangeGroups'](_0x12ce72,_0x3ae817){return _0x3ae817;}}class Qo extends Ds{['content'];['version'];['actionName'];['args'];['userMessage'];['model'];['hasError']=!0x1;['stoppedExplicitly']=!0x1;constructor(_0x1956dc){super(_0x1956dc),this['content']=_0x1956dc['content'],this['version']=_0x1956dc['version'],this['actionName']=_0x1956dc['actionName'],this['args']=_0x1956dc['args'],this['userMessage']=_0x1956dc['userMessage'],this['model']=_0x1956dc['model'],this['on']('interactionStopped',()=>{this['stoppedExplicitly']=!0x0;});}async['sendRequest'](){return this['actionName']?this['connector']['executeAction']({'content':this['content'],'actionName':this['actionName'],'args':this['args']}):this['connector']['executeCustomAction']({'content':this['content'],'message':this['userMessage'],'model':this['model'],'outputFormat':'html'});}['getDocumentContext'](){return{'type':'text','content':this['content'],'version':this['version'],'label':'Current\x20document','uiId':'current-document'};}['createReply'](_0x264b51){const _0x20128c=new qo({'locale':this['locale'],'documentContextContent':this['content'],..._0x264b51});return this['replies']['push'](_0x20128c),_0x20128c['delegate'](...Ls)['to'](this),this['fire']('replyCreated',_0x20128c),_0x20128c;}}class Xo extends kt{constructor(_0x2c8ae9,_0x51c769=!0x0,_0x51f404=!0x0){super(_0x2c8ae9),this['set']('isEnabled',!0x1),_0x51c769&&(this['applyButton']=this['_createButton'](hs(_0x2c8ae9,'AI_BALLOON_APPLY_BUTTON'),cs),this['applyButton']['bind']('isEnabled')['to'](this),this['items']['add'](this['applyButton'])),_0x51f404&&(this['suggestButton']=this['_createButton'](hs(_0x2c8ae9,'AI_BALLOON_SUGGEST_BUTTON'),_0x51c769?ls:cs),this['suggestButton']['bind']('isEnabled')['to'](this),this['items']['add'](this['suggestButton'])),this['setButtonsVisibility']({'showApplyButton':_0x51c769,'showSuggestButton':_0x51f404}),this['extendTemplate']({'attributes':{'class':['ck-ai-balloon__toolbar']}});}['setButtonsVisibility']({showApplyButton:_0x60643c,showSuggestButton:_0x51bfa6}){this['applyButton']&&(this['applyButton']['isVisible']=_0x60643c),this['suggestButton']&&(this['suggestButton']['isVisible']=_0x51bfa6);}['_createButton'](_0x2ebd4c,_0x337c14){const _0x338b80=new Nt(this['locale']);return _0x338b80['set']({'label':_0x2ebd4c,'class':_0x337c14,'isVisible':!0x0,'withText':!0x0}),_0x338b80;}}class zo extends vt{constructor(_0x2b751c){super(_0x2b751c),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-balloon__disclaimer']},'children':[{'tag':'p','attributes':{'class':['ck','ck-ai-balloon__disclaimer-content']},'children':[{'text':hs(_0x2b751c,'AI_DISCLAIMER_TEXT')}]}]});}}class jo extends vt{constructor(_0x1a78eb){super(_0x1a78eb),this['set']('isVisible',!0x0);const _0x4e9508=new yn('small');_0x4e9508['isVisible']=!0x0;const _0xf26029=new vt(this['locale']);_0xf26029['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__loader-text']},'children':[hs(this['locale'],'AI_CHAT_IS_WRITING')]}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__loader',this['bindTemplate']['if']('isVisible','ck-hidden',_0x3d4275=>!_0x3d4275)]},'children':[_0x4e9508,_0xf26029]});}}class Jo extends So{['focusCycler'];['_config'];['_contentWrapper'];['_streamableContentView'];['_toolbarView'];['_miniToolbarView'];['_loaderView'];['_disclaimerView'];['_focusTracker'];['_keystrokes'];['_dialogContent'];['_focusables'];['_scrollManager'];['_navigationPreviousButton'];['_navigationNextButton'];['_navigationTryAgainButton'];['_navigationCounter'];constructor(_0xdf13d7,_0x34d5ea){super(_0xdf13d7),this['set']('isBusy',!0x1),this['set']('isTrackChangesOn',!0x1),this['set']('_isLoading',!0x1),this['set']('_hasError',!0x1),this['_config']=_0x34d5ea,this['_focusTracker']=new _t(),this['_keystrokes']=new gt(),this['_focusables']=this['createCollection'](),this['focusCycler']=new Ut({'focusables':this['_focusables'],'focusTracker':this['_focusTracker'],'keystrokeHandler':this['_keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}),this['_dialogContent']=new _0x23af51(),this['_addContentWrapper'](_0x34d5ea),this['_addDisclaimerView'](),this['_addToolbar'](_0x34d5ea),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'](_0x34d5ea);});}['render'](){super['render']();for(const _0x8b9695 of this['_focusables'])this['_focusTracker']['add'](_0x8b9695['element']);this['_keystrokes']['listenTo'](this['element']),this['_initializeScrollManager']();}['destroy'](){super['destroy'](),this['_scrollManager']&&this['_scrollManager']['destroy']();}['focus'](_0x4e9a01){-0x1===_0x4e9a01?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}['setIsLoading'](_0x43e359){this['_isLoading']=_0x43e359;}['setErrorState'](){this['_hasError']=!0x0,this['_miniToolbarView']['toggleShowChangesEnabled'](!0x1);}['clearErrorState'](){this['_hasError']=!0x1,this['_miniToolbarView']['toggleShowChangesEnabled'](!0x0);}['showError'](_0x1f9d74){super['showError'](_0x1f9d74),this['_dialogContent']['has'](this['_errorView'])||this['_dialogContent']['add'](this['_errorView'],0x0);}['hideError'](){super['hideError'](),this['clearErrorState']();}['showBlockingError'](_0x444506){super['showBlockingError'](_0x444506),this['setErrorState']();}['addMiniToolbarItem'](_0x4846a8){this['_miniToolbarView']['items']['has'](_0x4846a8)||this['_miniToolbarView']['items']['add'](_0x4846a8);}['removeMiniToolbarItem'](_0x282630){this['_miniToolbarView']['items']['has'](_0x282630)&&this['_miniToolbarView']['items']['remove'](_0x282630);}['showLoader'](){this['_loaderView']&&(this['_isLoading']=!0x0);}['hideLoader'](){this['_loaderView']&&(this['_isLoading']=!0x1);}['_toggleToolbarButtonsVisibility']({showApplyButton:_0x2e094c,showSuggestButton:_0x195ec3}){_0x2e094c=_0x2e094c&&!this['isTrackChangesOn']&&this['_config']['availableActions']['includes']('applySuggestion'),_0x195ec3=_0x195ec3&&this['_config']['availableActions']['includes']('insertSuggestion'),this['_toolbarView']['setButtonsVisibility']({'showApplyButton':_0x2e094c,'showSuggestButton':_0x195ec3});}async['updateContent'](_0x353781){await this['_streamableContentView']['update'](_0x353781);}['clearContent'](){this['_streamableContentView']['clear']();}['_addContentWrapper'](_0x237c76){this['_contentWrapper']=new vt(this['locale']),this['_contentWrapper']['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-actions-balloon-content']},'children':[{'tag':'div','attributes':{'class':['ck-ai-actions-balloon-content-wrapper']},'children':[this['_createLoaderView'](),this['_createStreamableContentView']()]},this['_createMiniToolbar'](_0x237c76['miniToolbarConfig'])]}),this['_dialogContent']['add'](this['_contentWrapper']);}['_addDisclaimerView'](){this['_disclaimerView']=new zo(this['locale']),this['_dialogContent']['add'](this['_disclaimerView']);}['_addToolbar']({showApplyButton:_0x69404f,showSuggestButton:_0x4570ee}){this['_toolbarView']=new Xo(this['locale'],_0x69404f,_0x4570ee),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',(_0x5b66f5,_0x1b354b,_0x23aae4)=>!(_0x5b66f5||_0x1b354b||_0x23aae4)),this['_toggleToolbarButtonsVisibility']({'showApplyButton':_0x69404f,'showSuggestButton':_0x4570ee}),this['_dialogContent']['add'](this['_toolbarView']);}['_createMiniToolbar'](_0x409a2b){return this['_miniToolbarView']=new ko(this['locale'],_0x409a2b),this['_miniToolbarView']['delegate'](...Zs)['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',(_0x37f9b4,_0x518271)=>!(_0x37f9b4||_0x518271)),this['_miniToolbarView'];}['_createLoaderView'](){return this['_loaderView']=new jo(this['locale']),this['_loaderView']['bind']('isVisible')['to'](this,'_isLoading'),this['_loaderView'];}['_createStreamableContentView'](){return this['_streamableContentView']=new In(this['locale']),this['_streamableContentView'];}['_setupMiniToolbarButtons'](){const _0x3b37c3=new Nt(this['locale']),_0x19df16=new Nt(this['locale']),_0x1ee7d6=new Zo(this['locale']),_0x59b76b=new Nt(this['locale']);_0x3b37c3['set']({'icon':tt,'label':hs(this['locale'],'AI_ACTIONS_TRY_AGAIN'),'tooltip':!0x0,'class':'ck-ai-custom-action-button\x20'+us}),_0x19df16['set']({'icon':_0xba82e9,'tooltip':hs(this['locale'],'AI_ACTIONS_PREVIOUS_INTERACTION'),'class':'ck-ai-navigation-button\x20ck-ai-previous-button\x20'+us}),_0x59b76b['set']({'icon':et,'tooltip':hs(this['locale'],'AI_ACTIONS_NEXT_INTERACTION'),'class':'ck-ai-navigation-button\x20ck-ai-next-button\x20'+us}),_0x3b37c3['bind']('isEnabled')['to'](this,'isBusy',_0x26c5b0=>!_0x26c5b0),_0x3b37c3['on']('execute',()=>{this['fire']('tryAgain');}),_0x19df16['bind']('isEnabled')['to'](this,'isBusy',_0x1e4ac0=>!_0x1e4ac0),_0x19df16['on']('execute',()=>{this['fire']('showPrevious');}),_0x59b76b['bind']('isEnabled')['to'](this,'isBusy',_0x886c36=>!_0x886c36),_0x59b76b['on']('execute',()=>{this['fire']('showNext');}),this['_navigationPreviousButton']=_0x19df16,this['_navigationCounter']=_0x1ee7d6,this['_navigationNextButton']=_0x59b76b,this['_navigationTryAgainButton']=_0x3b37c3;}['updateMiniToolbarButtons'](_0x48a414,_0x1df01b){this['_navigationPreviousButton']||this['_setupMiniToolbarButtons']();const _0xa7cab4=_0x48a414>0x1;if(this['addMiniToolbarItem'](this['_navigationTryAgainButton']),_0xa7cab4){this['addMiniToolbarItem'](this['_navigationPreviousButton']),this['addMiniToolbarItem'](this['_navigationCounter']),this['addMiniToolbarItem'](this['_navigationNextButton']);const _0xdf56b4=_0x48a414-_0x1df01b;this['_navigationCounter']['setInteractionCount'](_0xdf56b4+'/'+_0x48a414),this['_navigationPreviousButton']['isEnabled']=_0x1df01b<_0x48a414-0x1,this['_navigationNextButton']['isEnabled']=_0x1df01b>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'](_0x161357){this['_isLoading']=_0x161357;}['resetShowChangesButton'](){this['_miniToolbarView']['isShowChangesOn']=!0x1;}['_initializeScrollManager'](){const _0x3d720d=this['_getScrollableElement']();_0x3d720d&&!this['_scrollManager']&&(this['_scrollManager']=new sr(_0x3d720d));}['_getScrollableElement'](){return this['_streamableContentView']['element'];}}class Zo extends vt{constructor(_0x1236d2){super(_0x1236d2);const _0x54fc83=this['bindTemplate'];this['set']('interactionCount','1/1'),this['setTemplate']({'tag':'span','attributes':{'class':['ck-ai-interaction-counter']},'children':[{'text':_0x54fc83['to']('interactionCount')}]});}['setInteractionCount'](_0x16b3cf){this['set']('interactionCount',_0x16b3cf);}}class ta extends _0x5e248a{static get['requires'](){return[as,Bt,Js,Oo,_0x47efd0];}static get['pluginName'](){return'AIActions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['_aiConnector'];['_interactions']=[];['_currentInteractionIndex']=0x0;['_interactionParams'];['_balloonShowDiff']=!0x1;['_promiseQueue'];['_bodyCollection'];get['_interaction'](){return this['_interactions'][this['_interactions']['length']-0x1];}['_actionsBalloonView'];constructor(_0x1dec01){super(_0x1dec01),this['_bodyCollection']=new Qt(this['editor']['locale']),this['_bodyCollection']['attachToDom'](),this['_aiConnector']=this['editor']['plugins']['get']('AIConnector'),this['set']('isBusy',!0x1),this['_promiseQueue']=new Cn();}['stopInteraction'](){this['_stopInteraction']();}async['executeAction'](_0x22787d,_0x243b16,_0x370865){if(this['_stopInteraction'](),this['editor']['plugins']['has']('TableSelection')){if(this['editor']['plugins']['get']('TableSelection')['getSelectedTableCells']()){const {modelFragment:_0x317f78,anchorData:_0x1d49b2,root:_0x3c371a}=this['_getExecuteDataInTable']();return this['_executeAction'](_0x22787d,_0x317f78,_0x1d49b2,_0x3c371a,_0x243b16,_0x370865);}}const {modelFragment:_0x300d4d,anchorData:_0x8718d9,root:_0x4acb8f}=this['_getExecuteDataRegular']();return this['_executeAction'](_0x22787d,_0x300d4d,_0x8718d9,_0x4acb8f,_0x243b16,_0x370865);}async['destroy'](){return this['_stopInteraction'](),this['_bodyCollection']['detachFromDom'](),super['destroy']();}['_createActionsBalloonView'](){const _0x3f817f=this['editor']['plugins']['has']('TrackChanges');let _0x4de660=this['editor']['config']['get']('ai.availableReplyActions')||[...fn];_0x3f817f||(_0x4de660=_0x4de660['filter'](_0x51630f=>'insertSuggestion'!=_0x51630f));const _0x5dc057=this['editor']['commands']['get']('trackChanges'),_0x425ac4=new Jo(this['editor']['locale'],{'showApplyButton':!0x0,'showSuggestButton':_0x3f817f,'miniToolbarConfig':{'showChanges':'icon'},'availableActions':_0x4de660});return _0x425ac4['bind']('isBusy')['to'](this),_0x5dc057&&_0x425ac4['bind']('isTrackChangesOn')['to'](_0x5dc057,'value'),_0x425ac4['on']('tryAgain',()=>{this['_refreshInteraction']();}),_0x425ac4['on']('showPrevious',()=>{this['_navigateToPrevious']();}),_0x425ac4['on']('showNext',()=>{this['_navigateToNext']();}),_0x425ac4;}['_getExecuteDataRegular'](){const _0x1b85e0=this['editor']['model']['document']['selection'],_0x50f1ae=_0x1b85e0['getFirstRange']()['start']['root'];if(_0x1b85e0['isCollapsed']){const _0x2cbcb8=At(_0x1b85e0['getSelectedBlocks']())||this['editor']['model']['schema']['getLimitElement'](_0x1b85e0);this['editor']['model']['change'](_0x159fdb=>{_0x159fdb['setSelection'](_0x2cbcb8,'in');});}const _0x10c651=_0x1b85e0['getFirstRange'](),_0x4ace13=this['_wrapWithCommonAncestors'](this['editor']['model']['getSelectedContent'](_0x1b85e0),_0x10c651['start'],_0x10c651['end']);this['_copyMarkersToFragment'](_0x4ace13,_0x1b85e0,{'isTableSelection':!0x1});const _0x16de57=_0x1b85e0['getFirstRange']()['start'],_0x365d12=new Map();let _0x287091=_0x4ace13;for(let _0x49fedc=0x0;_0x49fedc<_0x16de57['path']['length'];_0x49fedc++)_0x365d12['set'](_0x287091,_0x16de57['path'][_0x49fedc]),_0x287091=_0x287091['getChild'](0x0);return{'modelFragment':_0x4ace13,'anchorData':_0x365d12,'root':_0x50f1ae};}['_getExecuteDataInTable'](){const _0x2dd271=this['editor']['model']['document']['selection'],_0x5d409b=this['editor']['plugins']['get']('TableSelection'),_0xc1a1cc=_0x2dd271['getFirstRange']()['start']['root'],_0xc9327e=_0x5d409b['getSelectionAsFragment'](),_0x2d1d3b=_0x2dd271['getFirstRange']()['start']['parent']['parent'],_0x2192f4=this['editor']['model']['createRange'](this['editor']['model']['createPositionBefore'](_0x2d1d3b),this['editor']['model']['createPositionAfter'](_0x2d1d3b)),_0x5b9f92=this['_wrapWithCommonAncestors'](_0xc9327e,_0x2192f4['start'],_0x2192f4['end']);this['_copyMarkersToFragment'](_0x5b9f92,_0x2dd271,{'isTableSelection':!0x0});const _0x10d539=_0x2dd271['getFirstRange']()['start'],_0xe41fd8=new Map();let _0x1920b7=_0x5b9f92;for(let _0x517f29=0x0;_0x517f29<_0x10d539['path']['length'];_0x517f29++)if(_0xe41fd8['set'](_0x1920b7,_0x10d539['path'][_0x517f29]),_0x517f29<_0x10d539['path']['length']-0x1)_0x1920b7=_0x1920b7['getChild'](0x0);else{let _0x55f668=_0x1920b7['nextSibling'];for(;_0x55f668;)_0xe41fd8['set'](_0x55f668,_0x10d539['path'][_0x517f29]),_0x55f668=_0x55f668['nextSibling'];}return{'modelFragment':_0x5b9f92,'anchorData':_0xe41fd8,'root':_0xc1a1cc};}async['_executeAction'](_0x4338bb,_0x342a5a,_0x43e536,_0x21edff,_0x435b75,_0x4af872){const _0x16d86d=this['editor']['plugins']['get'](Js),_0x4fd0b9=this['editor']['plugins']['get'](Oo),_0x5aae0d=this['editor']['model']['document']['selection'],_0x58bbf6=await _0x16d86d['modelToDataWithIds'](_0x342a5a),_0x470a45=this['editor']['model']['document']['version'],_0x2a1fa9=[..._0x5aae0d['getRanges']()];return this['_actionsBalloonView']||(this['_actionsBalloonView']=this['_createActionsBalloonView']()),this['_clearInteractionHistory'](),this['_clearErrorState'](),this['_balloonShowDiff']=!0x1,this['_actionsBalloonView']['resetShowChangesButton'](),this['_actionsBalloonView']['clearContent'](),_0x4fd0b9['open']({'index':0x3e8*Math['random']()%0x3e8,'title':_0x435b75,'icon':_0x4af872||_0x272647,'mainView':this['_actionsBalloonView'],'class':'ck-ai-actions-balloon','ranges':_0x2a1fa9,'id':'aiActionsBalloon'}),this['_setLoadingState'](),this['stopListening'](this['_actionsBalloonView']),this['stopListening'](_0x4fd0b9),this['_interactionParams']={'action':_0x4338bb,'content':_0x58bbf6,'version':_0x470a45,'aiBalloon':_0x4fd0b9,'modelFragment':_0x342a5a,'anchorData':_0x43e536,'root':_0x21edff},this['_setupApplyListeners'](),this['listenTo'](_0x4fd0b9,'selectionRemoved',()=>{this['_stopInteraction'](),this['_actionsBalloonView']['disableMiniToolbarButtons']();}),this['listenTo'](_0x4fd0b9,'dialogClosed',(_0x4c9586,{id:_0xecf3c9})=>{if('aiActionsBalloon'===_0xecf3c9){for(const _0x50b929 of this['_interactions']){if(0x0===_0x50b929['replies']['length']||_0x50b929['stoppedExplicitly'])continue;const _0x2c5bf1=_0x50b929['replies'][_0x50b929['replies']['length']-0x1],_0x583849=_0x2c5bf1['changeGroups'][0x0];_0x583849&&'pending'===_0x583849['state']&&_0x2c5bf1['setChangeGroupState'](0x0,'rejected');}this['_stopInteraction'](),this['_clearInteractionHistory'](),this['stopListening'](this['_actionsBalloonView']),this['stopListening'](_0x4fd0b9);}}),this['_createInteraction'](_0x58bbf6,_0x470a45,_0x4fd0b9,_0x4338bb);}['_setupApplyListeners'](){if(!this['_interactionParams'])return;const {modelFragment:_0x59b0f5,anchorData:_0x16cc7f,root:_0x124ed2}=this['_interactionParams'];this['listenTo'](this['_actionsBalloonView'],'applySuggestion',()=>{this['_applyChanges'](_0x59b0f5,_0x16cc7f,_0x124ed2,!0x1);}),this['listenTo'](this['_actionsBalloonView'],'insertSuggestion',()=>{this['_applyChanges'](_0x59b0f5,_0x16cc7f,_0x124ed2,!0x0);});}['_wrapWithCommonAncestors'](_0x252b56,_0x4677b6,_0x1b9de1){const _0x5773f8=this['editor']['model']['createRange'](_0x4677b6,_0x1b9de1)['getCommonAncestor'](),_0x4760e2=_0x5773f8['is']('documentFragment')?[]:_0x5773f8['getAncestors']({'includeSelf':!0x0})['slice'](0x1);if(_0x4760e2['length']){const _0x202628=_0x4760e2['map'](_0x44829c=>_0x44829c['_clone'](!0x1));for(let _0x48ec7c=0x1;_0x48ec7c<_0x202628['length'];_0x48ec7c++)_0x202628[_0x48ec7c-0x1]['_appendChild'](_0x202628[_0x48ec7c]);return _0x202628[_0x202628['length']-0x1]['_appendChild'](_0x252b56),new _0x569183(_0x202628[0x0]);}return _0x252b56;}['_copyMarkersToFragment'](_0x40dc53,_0x51572f,_0x4dd57e={'isTableSelection':!0x1}){const _0x330f6f=this['editor']['model'],_0x30a39f=Array['from'](_0x51572f['getRanges']()),_0x5811b2=_0x51572f['getFirstRange']()['start'];for(const _0x53d039 of _0x330f6f['markers']){if(_0x53d039['name']['startsWith'](zs)||!_0x53d039['affectsData'])continue;const _0x3780ae=_0x53d039['getRange']();if(!_0x30a39f['some'](_0x186ba3=>_0x186ba3['containsRange'](_0x3780ae,!0x0)))continue;const _0x2fe856=this['_regularCalculateMarkerPath'](_0x3780ae['start'],_0x5811b2,_0x4dd57e['isTableSelection']),_0x33a237=this['_regularCalculateMarkerPath'](_0x3780ae['end'],_0x5811b2,_0x4dd57e['isTableSelection']),_0x4f011c=_0x330f6f['createPositionFromPath'](_0x40dc53,_0x2fe856),_0x5d5d2c=_0x330f6f['createPositionFromPath'](_0x40dc53,_0x33a237);if(!_0x4f011c['isEqual'](_0x5d5d2c)){const _0x15811f=_0x330f6f['createRange'](_0x4f011c,_0x5d5d2c);_0x40dc53['markers']['set'](_0x53d039['name'],_0x15811f);}}}['_regularCalculateMarkerPath'](_0x1c503a,_0x5c1ec4,_0x59d52c=!0x1){const _0x16e6a3=[..._0x1c503a['path']['slice']()];for(let _0xf34aa4=0x0;_0xf34aa4<Math['max'](_0x5c1ec4['path']['length'],_0x1c503a['path']['length']);_0xf34aa4++){const _0x55987d=_0x5c1ec4['path'][_0xf34aa4]||0x0,_0x2807c0=(_0x1c503a['path'][_0xf34aa4]||0x0)-_0x55987d;if(_0x16e6a3[_0xf34aa4]=_0x2807c0,0x0!==_0x2807c0&&!_0x59d52c)break;}return _0x16e6a3;}async['_createInteraction'](_0x2dd81c,_0xf6fb0f,_0x485cf9,_0x51112e){const _0x29bae8=this['editor'];this['_interactionParams']||(this['_interactionParams']={'action':_0x51112e,'content':_0x2dd81c,'version':_0xf6fb0f,'aiBalloon':_0x485cf9,'modelFragment':this['editor']['model']['getSelectedContent'](this['editor']['model']['document']['selection']),'anchorData':new Map(),'root':this['editor']['model']['document']['selection']['getFirstRange']()['start']['root']});const _0x45c2ed=new Qo({'connector':this['_aiConnector'],'locale':_0x29bae8['locale'],'content':_0x2dd81c,'version':_0xf6fb0f,..._0x51112e});this['_interactions']['push'](_0x45c2ed);const _0x345293=(_0x1a1578,_0x20fe8b=!0x1,_0x46b250='streaming')=>this['_promiseQueue']['enqueue'](async _0x4fab76=>{try{const _0x5c85b0=Rs({'editor':_0x29bae8,'changeGroups':_0x1a1578['changeGroups'],'documentContextContent':_0x1a1578['documentContextContent'],'showDiff':_0x20fe8b,'trimUnchanged':!0x1});_0x5c85b0['length']&&await this['_actionsBalloonView']['updateContent']({'part':_0x5c85b0[0x0],'renderingStrategy':_0x46b250,'abortSignal':_0x4fab76});}catch(_0x39b7ac){if(this['_isAbortError'](_0x39b7ac))return;throw _0x39b7ac;}});_0x45c2ed['on']('replyCreated',(_0x1f814d,_0x3f7aea)=>{this['_actionsBalloonView']['hideLoader'](),this['_actionsBalloonView']['startAutoScroll'](),_0x345293(_0x3f7aea)['catch'](_0x5a8401=>{this['_isAbortError'](_0x5a8401)||(console['error']('Error\x20updating\x20content\x20in\x20replyCreated:',_0x5a8401),this['_setErrorState'](_0x45c2ed));});}),_0x45c2ed['on']('replyContentUpdated',(_0x587004,_0x14e3f5)=>{_0x345293(_0x14e3f5)['catch'](_0x585c3c=>{this['_isAbortError'](_0x585c3c)||(console['error']('Error\x20updating\x20content\x20in\x20replyContentUpdated:',_0x585c3c),this['_setErrorState'](_0x45c2ed));});}),_0x45c2ed['on']('interactionFinished',async()=>{try{await this['_clearLoadingState'](),this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']),await this['_promiseQueue']['queueEmptyPromise'];}catch(_0x2110e2){this['_isAbortError'](_0x2110e2)||(console['error']('Error\x20clearing\x20loading\x20state\x20in\x20interactionFinished:',_0x2110e2),this['_setErrorState'](_0x45c2ed));}finally{this['_actionsBalloonView']['stopAutoScroll']();}}),this['listenTo'](this['_actionsBalloonView'],'toggleSuggestionDisplayMode',async(_0x3350e3,{showDiff:_0x5cc411})=>{try{this['_balloonShowDiff']=_0x5cc411;const _0x21b164=this['_interaction']['replies'][this['_interaction']['replies']['length']-0x1];_0x21b164&&await _0x345293(_0x21b164,_0x5cc411,'static');}catch(_0x3b6fb7){this['_isAbortError'](_0x3b6fb7)||(console['error']('Error\x20updating\x20content\x20in\x20toggleSuggestionDisplayMode:',_0x3b6fb7),this['_setErrorState'](_0x45c2ed));}}),_0x45c2ed['on']('replyChangeGroupStateUpdated',()=>{const _0x4020ba={'positiveCount':_0x45c2ed['replies']['reduce']((_0x4ae879,_0x37e8f3)=>_0x4ae879+_0x37e8f3['changeGroups']['filter'](_0xe13571=>'accepted'===_0xe13571['state'])['length'],0x0),'totalCount':_0x45c2ed['replies']['reduce']((_0x181e2c,_0x331786)=>_0x181e2c+_0x331786['changeGroups']['length'],0x0)},_0x68c551=_0x45c2ed['actionCallId'],_0x5ed319=_0x45c2ed['actionName'];_0x5ed319?this['_aiConnector']['upsertAIActionRating'](_0x5ed319,_0x68c551,_0x4020ba):this['_aiConnector']['upsertCustomAIActionRating'](_0x68c551,_0x4020ba);}),this['_setLoadingState']();try{const _0x1895fb=await _0x45c2ed['start']();return this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']),_0x1895fb;}catch(_0x1620c7){if(this['_isAbortError'](_0x1620c7))return;this['_actionsBalloonView']['hideLoader'](),this['_setErrorState'](_0x45c2ed);}}['_applyChanges'](_0x16afe7,_0x2e2c1f,_0x3bb523,_0x48a7de){const _0x50daa3=this['editor'];if(_0x48a7de&&!_0x50daa3['plugins']['has']('TrackChanges'))throw new at('ai-no-track-changes',null);const _0x4d0d6b=this['editor']['plugins']['get'](_0x47efd0),_0xe4d49d=this['_interactions'][this['_interactions']['length']-0x1-this['_currentInteractionIndex']];if(!_0xe4d49d||!_0xe4d49d['replies']['length'])return;const _0x408462=_0xe4d49d['replies'][_0xe4d49d['replies']['length']-0x1],_0x1d9e01=_0x408462['changeGroups'];_0x408462['setChangeGroupState'](0x0,'accepted');let _0x481716=qs({'editor':_0x50daa3,'reply':_0x408462,'interaction':_0xe4d49d,'groups':_0x1d9e01,'transform':!0x1,'documentCompare':_0x4d0d6b,'documentCompareOptions':{'anchor':_0x50daa3['model']['createPositionAt'](_0x16afe7,0x0),'markDeletions':_0x48a7de}});_0x481716=this['_filterOperationsOutsideRange'](_0x481716,_0x2e2c1f);for(const _0x5cb238 of _0x481716)this['_anchorOperation'](_0x2e2c1f,_0x5cb238,_0x3bb523);const _0x5a2e26=_0xe4d49d['getDocumentContext']()['version'],_0x113926=_0x50daa3['model']['document']['history']['getOperations'](_0x5a2e26),_0x397f9c={'document':_0x50daa3['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1},_0x164c4d=_0x261504(_0x481716,_0x113926,_0x397f9c)['operationsA'];_0x50daa3['model']['change'](_0x5f1162=>{if(_0x5f1162['setSelection'](_0x50daa3['model']['document']['selection']['focus']),_0x48a7de)_0x50daa3['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x164c4d);else{for(const _0x4b83c2 of _0x164c4d)_0x4b83c2['baseVersion']=_0x50daa3['model']['document']['version'],Qs(_0x50daa3,_0x4b83c2),_0x5f1162['batch']['addOperation'](_0x4b83c2),_0x50daa3['model']['applyOperation'](_0x4b83c2);}}),this['editor']['plugins']['get']('AIBalloon')['close']();}['_filterOperationsOutsideRange'](_0x1d0fa5,_0x541720){return _0x1d0fa5['filter'](_0x309b29=>{if('rename'==_0x309b29['type']){const _0x152a4=_0x309b29['position']['nodeAfter'];return!_0x541720['has'](_0x152a4);}if(_0x309b29['type']['indexOf']('Attribute')>-0x1){const _0xcc6538=_0x309b29['range']['start']['nodeAfter'];return!_0x541720['has'](_0xcc6538);}return!0x0;});}['_anchorOperation'](_0x59933d,_0xd8a6e7,_0x4dbfe9){const _0x397c70=_0xd8a6e7['clone']();for(const _0xd31787 in _0xd8a6e7){const _0x2b2c65=_0xd8a6e7[_0xd31787];_0x2b2c65 instanceof _0x5ca4e8?_0xd8a6e7[_0xd31787]=new _0x5ca4e8(_0x2a0a4e(_0x2b2c65['start']),_0x2a0a4e(_0x2b2c65['end'])):_0x2b2c65 instanceof _0x1e668d&&(_0xd8a6e7[_0xd31787]=_0x2a0a4e(_0x2b2c65));}if(['insert','move','remove','reinsert','split','merge']['includes'](_0x397c70['type'])){if(_0x397c70['isDocumentOperation']=!0x1,_0x397c70['baseVersion']=null,'remove'==_0x397c70['type']){const _0x2e3ad=_0x397c70['sourcePosition'],_0x48ea18=_0x397c70['howMany'];new _0x48a283(_0x2e3ad,_0x48ea18)['_execute']();}else _0x397c70['_execute']();}function _0x2a0a4e(_0x5c2d5f){if('$graveyard'==_0x5c2d5f['root']['rootName'])return _0x5c2d5f;const _0x24ca7f=[];let _0x271762=_0x5c2d5f['root'];for(let _0x321b67=0x0;_0x321b67<_0x5c2d5f['path']['length'];_0x321b67++){const _0x1fd112=_0x59933d['get'](_0x271762)||0x0;_0x24ca7f[_0x321b67]=_0x5c2d5f['path'][_0x321b67]+_0x1fd112,_0x271762=_0x271762['getChildAtOffset'](_0x5c2d5f['path'][_0x321b67]);}return new _0x1e668d(_0x4dbfe9,_0x24ca7f,_0x5c2d5f['stickiness']);}}['_refreshInteraction'](){if(!this['_interactionParams'])return;this['_interactions']['length']>0x0&&this['_stopInteraction'](),this['_currentInteractionIndex']=0x0,this['_balloonShowDiff']=!0x1;const {action:_0x44806d,content:_0x1f34b3,version:_0x5f5cc0,aiBalloon:_0x5b7192}=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'](_0x1f34b3,_0x5f5cc0,_0x5b7192,_0x44806d)['catch'](_0x12ac41=>{this['_isAbortError'](_0x12ac41)||console['error']('Error\x20refreshing\x20interaction:',_0x12ac41);});}['_isAbortError'](_0x56292b){return!!_0x56292b['message']&&_0x56292b['message']['startsWith']('ai-request-aborted');}['_clearInteractionHistory'](){this['_interactions']=[],this['_interactionParams']=void 0x0,this['_currentInteractionIndex']=0x0,this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);}['_stopInteraction'](){this['_interaction']&&this['_interaction']['stop'](),this['_promiseQueue']['abort'](),this['isBusy']=!0x1,this['_interactionParams']&&this['_actionsBalloonView']['stopAutoScroll']();}['_navigateToPrevious'](){const _0x268d97=this['_interactions']['length'];this['_currentInteractionIndex']<_0x268d97-0x1&&this['_displayInteractionAtIndex'](this['_currentInteractionIndex']+0x1);}['_navigateToNext'](){this['_currentInteractionIndex']>0x0&&this['_displayInteractionAtIndex'](this['_currentInteractionIndex']-0x1);}async['_displayInteractionAtIndex'](_0xd32bf1){if(!this['_interactionParams'])return;this['_currentInteractionIndex']=_0xd32bf1;const _0xeb18df=this['_interactions'][this['_interactions']['length']-0x1-this['_currentInteractionIndex']];if(!_0xeb18df)return;if(_0xeb18df['hasError'])return this['_setErrorState'](_0xeb18df),void this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);if(!_0xeb18df['replies']['length'])return;this['_actionsBalloonView']['hideError'](),this['_interactionParams']&&this['_clearErrorState']();const _0x2f2000=_0xeb18df['replies'][_0xeb18df['replies']['length']-0x1];if(_0x2f2000){const _0x3c9fc1=this['editor'];try{const _0x1e25c1=Rs({'editor':_0x3c9fc1,'changeGroups':_0x2f2000['changeGroups'],'documentContextContent':_0x2f2000['documentContextContent'],'showDiff':this['_balloonShowDiff'],'trimUnchanged':!0x1});await new Promise(_0x2e0782=>setTimeout(_0x2e0782,0x32)),await this['_actionsBalloonView']['updateContent']({'part':_0x1e25c1[0x0],'renderingStrategy':'static','abortSignal':new AbortController()['signal']});}catch(_0x429fa0){this['_isAbortError'](_0x429fa0)||console['error']('Error\x20updating\x20content\x20during\x20navigation:',_0x429fa0);}}this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);}['_setLoadingState'](){this['_actionsBalloonView']['setIsLoading'](!0x0),this['isBusy']=!0x0;}async['_setErrorState'](_0x298909){const _0x34af0e=hs(this['editor']['locale'],'AI_ACTIONS_GENERIC_ERROR');this['_actionsBalloonView']['showError'](_0x34af0e),_0x298909['hasError']=!0x0,await this['_promiseQueue']['queueEmptyPromise'],this['_actionsBalloonView']['setErrorState'](),this['_actionsBalloonView']['toggleIsLoading'](!0x0);}['_clearErrorState'](){this['_actionsBalloonView']['hideError'](),this['_actionsBalloonView']['toggleIsLoading'](!0x1);}async['_clearLoadingState'](){await this['_promiseQueue']['queueEmptyPromise'],this['isBusy']=!0x1,this['_actionsBalloonView']['setIsLoading'](!0x1);}}class ea extends _0x5e248a{static get['requires'](){return[Wo,$o,ta];}static get['pluginName'](){return'AIQuickActions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0xffb33a){super(_0xffb33a),_0xffb33a['config']['define']('ai.quickActions',{'extraCommands':[],'removeCommands':[],'isSearchEnabled':!0x0});}}class ia extends vt{['resultResponseView'];['acceptButtonView'];['dismissButtonView'];['infoButtonView'];['outdatedButtonView'];constructor(_0x310777,_0x4f4ff4){super(_0x310777),this['id']=_0x4f4ff4,this['set']('status','pending'),this['set']('changeId',_0x4f4ff4),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',(_0x5a1489,_0x5a579e)=>{_0x5a579e&&_0x5a579e['target']&&'A'===_0x5a579e['target']['tagName']&&_0x5a579e['preventDefault'](),this['fire']('activateChange',{'id':_0x4f4ff4,'source':this,'uiInteraction':'click'});}),this['on']('mouseover',()=>{this['fire']('activateChange',{'id':_0x4f4ff4,'source':this,'uiInteraction':'hover'});}),this['on']('mouseout',()=>{this['fire']('deactivateChange',{'origin':'panel','id':_0x4f4ff4,'source':this});});}['setItemAsActive'](){this['isActive']=!0x0;}['setItemAsInactive'](){this['isActive']=!0x1;}['_createResultResponseView'](){const _0x15b2fb=new vt(this['locale']);return _0x15b2fb['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content','ck-reset_all-excluded','ck-ai_review__check-run-result-response',this['bindTemplate']['if']('showDiff','ck-hidden',_0x3d5979=>!_0x3d5979)]}}),_0x15b2fb;}['_createAcceptButtonView'](){const _0x3fc72a=new Nt(this['locale']);return _0x3fc72a['set']({'label':hs(this['locale'],'AI_REVIEW_MODE_ACCEPT_CHANGE'),'withText':!0x0}),_0x3fc72a['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x313669=>{this['fire']('acceptChange',{'id':this['changeId']}),_0x313669['stopPropagation']();})},'attributes':{'class':[this['bindTemplate']['if']('status','ck-hidden',_0xdd07f9=>'pending'!==_0xdd07f9&&'accepted'!==_0xdd07f9),this['bindTemplate']['if']('status',ls,_0x2d6f8a=>'pending'===_0x2d6f8a),this['bindTemplate']['if']('status',us,_0x4ff8fb=>'pending'!==_0x4ff8fb),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-status-button',_0x2eff99=>'accepted'===_0x2eff99)]}}),this['on']('change:status',(_0x20a7de,_0x3657c0,_0x34d3b4)=>{_0x3fc72a['isEnabled']='pending'===_0x34d3b4,'accepted'===_0x34d3b4&&(_0x3fc72a['label']=hs(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_ACCEPTED'),_0x3fc72a['icon']=_0x406d61);}),_0x3fc72a;}['_createDismissButtonView'](){const _0xf549f3=new Nt(this['locale']);return _0xf549f3['set']({'label':hs(this['locale'],'AI_REVIEW_MODE_DISMISS_CHANGE'),'withText':!0x0}),_0xf549f3['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x3747fd=>{this['fire']('dismissChange',{'id':this['changeId']}),_0x3747fd['stopPropagation']();})},'attributes':{'class':[us,this['bindTemplate']['if']('status','ck-hidden',_0x5a3c0a=>'pending'!==_0x5a3c0a&&'rejected'!==_0x5a3c0a),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-dismiss-button',_0x295830=>'pending'===_0x295830),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-status-button',_0x20f5f5=>'rejected'===_0x20f5f5)]}}),this['on']('change:status',(_0x527ac5,_0x454913,_0x548a38)=>{_0xf549f3['isEnabled']='pending'===_0x548a38,'rejected'===_0x548a38&&(_0xf549f3['label']=hs(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_REJECTED'),_0xf549f3['icon']=_0x35e3e9);}),_0xf549f3;}['_createInfoButtonView'](){const _0x944f4f=new Nt(this['locale']);return _0x944f4f['set']({'label':hs(this['locale'],'AI_REVIEW_MODE_LEARN_MORE'),'icon':_0x138750,'tooltip':!0x0,'isToggleable':!0x0,'role':'menuitemcheckbox','class':us+'\x20ck-ai_review__check-run-result-info-button\x20ck-hidden'}),_0x944f4f['bind']('isOn')['to'](this,'isInfoToggleOn',_0x9fd5bc=>_0x9fd5bc),_0x944f4f['on']('execute',()=>{this['isInfoToggleOn']=!this['isInfoToggleOn'];}),_0x944f4f;}['_createOutdatedButtonView'](){const _0x5f3b9b=new Nt(this['locale']);return _0x5f3b9b['set']({'label':hs(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_OUTDATED'),'icon':it,'withText':!0x0,'isEnabled':!0x1}),_0x5f3b9b['extendTemplate']({'attributes':{'class':[us,'ck-ai_review__check-run-result-status-button',this['bindTemplate']['if']('status','ck-hidden',_0x3a5fa7=>'outdated'!==_0x3a5fa7)],'disabled':'disabled'}}),_0x5f3b9b;}}class sa extends Xt{['resultItemView'];['_pinnedRectIndex']=void 0x0;['_pinnedTargetElement']=void 0x0;['_pinnedTargetChangeId']=void 0x0;constructor(_0x57e0cb,_0x1a0f58){super(_0x57e0cb),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']()),_0x1a0f58['add'](this);}['render'](){super['render'](),this['_setupClickOutsideHandler']();}['updateContent'](_0xc50bb5){this['resultItemView']['changeId']=_0xc50bb5['id'],this['resultItemView']['resultResponseView']['element']['innerHTML']=_0xc50bb5['contentDiffed'];}['showBalloon'](_0x1a422f,_0x91fb4c,_0x2d65c3,_0x1cfcb4,_0x61db1,_0x26a8e0){const _0x5a2dba=_0x91fb4c();if(!_0x5a2dba)return;this['updateContent'](_0x1a422f),this['show']();const _0x1ad641=Array['from'](_0x5a2dba['getClientRects']())['reverse'](),_0x9d7d6b=this['_getPointedRectIndexFromEvent'](_0x2d65c3,_0x1ad641),_0x3595f4=_0x1ad641[_0x9d7d6b??0x0];'click'===_0x1cfcb4?(this['isDiffActive']=!0x0,this['pin']({'target':()=>this['_getBestRectPositionOnClick'](_0x91fb4c(),_0x9d7d6b,_0x1a422f['id'],_0x61db1,_0x26a8e0)||_0x3595f4})):'hover'===_0x1cfcb4&&(this['isDiffActive']=!0x1,this['pin']({'target':()=>this['_getBestRectPositionOnHover'](_0x91fb4c(),_0x9d7d6b,_0x1a422f['id'])||_0x3595f4}));}['hideBalloon'](){this['hide'](),this['unpin'](),this['_pinnedRectIndex']=void 0x0,this['_pinnedTargetElement']=void 0x0,this['_pinnedTargetChangeId']=void 0x0;}['hideDiffInBalloon'](){this['resultItemView']['showDiff']=!0x1;}['showDiffInBalloon'](){this['resultItemView']['showDiff']=!0x0;}['deactivateChange'](){this['fire']('deactivateChange',{'origin':'balloon'});}['_setupClickOutsideHandler'](){zt({'emitter':this,'activator':()=>this['isVisible'],'contextElements':()=>{const _0x8bb723=[this['element']];return this['_pinnedTargetElement']&&_0x8bb723['push'](this['_pinnedTargetElement']),_0x8bb723;},'callback':()=>{this['hide'](),this['unpin'](),this['deactivateChange'](),this['_pinnedTargetElement']=void 0x0,this['_pinnedRectIndex']=void 0x0,this['_pinnedTargetChangeId']=void 0x0;}});}['_createContentView'](){const _0x5360df=new vt();return this['resultItemView']=new ia(this['locale'],''),this['resultItemView']['resultResponseView']['extendTemplate']({'attributes':{'class':['ck-content']}}),this['resultItemView']['delegate']('acceptChange','dismissChange')['to'](this),_0x5360df['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']]}]}),_0x5360df;}['_getBestRectPositionOnClick'](_0x27aae8,_0x1f0f26,_0x55883b,_0x169ead,_0x447389){if(!_0x27aae8)return null;const _0xf830bd=this['position']['replace']('arrow_',''),_0x52bdfa=Array['from'](_0x27aae8['getClientRects']());let _0x1a0230,_0x55f429=_0x52bdfa['reverse']();return void 0x0!==_0x1f0f26&&this['_isPinnedRectVisible'](_0x55f429[_0x1f0f26],_0x169ead,_0x447389)?(_0x1a0230=_0x55f429[_0x1f0f26],this['_pinnedRectIndex']=_0x1f0f26):this['_isPinnedRectVisible'](_0x55f429[0x0],_0x169ead,_0x447389)&&void 0x0===_0x1f0f26?_0x1a0230=_0x55f429[0x0]:(_0x55f429='s'==_0xf830bd[0x0]?[..._0x52bdfa]['reverse']():_0x52bdfa,_0x55f429['forEach'](_0x3830c8=>{this['_isPinnedRectVisible'](_0x3830c8,_0x169ead,_0x447389)&&(_0x1a0230=_0x3830c8);})),this['_pinnedTargetChangeId']=_0x55883b,this['_pinnedTargetElement']=_0x27aae8,_0x1a0230||_0x27aae8['getBoundingClientRect']();}['_getBestRectPositionOnHover'](_0x533d6d,_0x1ece2c,_0x6a35a){if(!_0x533d6d)return null;const _0x1e5b91=Array['from'](_0x533d6d['getClientRects']())['reverse']();if(void 0x0===this['_pinnedRectIndex']&&void 0x0!==_0x1ece2c&&this['_pinnedTargetChangeId']!==_0x6a35a)return this['_pinnedRectIndex']=_0x1ece2c,this['_pinnedTargetElement']=_0x533d6d,this['_pinnedTargetChangeId']=_0x6a35a,_0x1e5b91[_0x1ece2c];if(void 0x0!==this['_pinnedRectIndex']&&this['_pinnedTargetChangeId']===_0x6a35a){if(_0x533d6d!==this['_pinnedTargetElement'])return Array['from'](this['_pinnedTargetElement']['getClientRects']())['reverse']()[this['_pinnedRectIndex']];return _0x1e5b91[this['_pinnedRectIndex']];}return void 0x0!==_0x1ece2c&&this['_pinnedTargetChangeId']!==_0x6a35a?(this['_pinnedRectIndex']=_0x1ece2c,this['_pinnedTargetElement']=_0x533d6d,this['_pinnedTargetChangeId']=_0x6a35a,_0x1e5b91[_0x1ece2c]):_0x533d6d['getBoundingClientRect']();}['_getPointedRectIndexFromEvent'](_0x5022be,_0x5aa7ee){if(_0x5022be)for(let _0x4ffb5a=0x0;_0x4ffb5a<_0x5aa7ee['length'];_0x4ffb5a++){const _0x1bcee8=_0x5aa7ee[_0x4ffb5a];if(_0x5022be['clientX']>=_0x1bcee8['left']-0x3&&_0x5022be['clientX']<=_0x1bcee8['right']+0x3&&_0x5022be['clientY']>=_0x1bcee8['top']-0x3&&_0x5022be['clientY']<=_0x1bcee8['bottom']+0x3)return _0x4ffb5a;}}['_isPinnedRectVisible'](_0x23db2f,_0x292b61,_0x2c8239){const _0x4e7a40=new ut(_0x23db2f),_0x36bbdd=_0x292b61||document['documentElement'],_0x10b6f5=_0x4e7a40['getIntersection'](Rt(_0x2c8239)),_0x1373a1=new ut(_0x36bbdd)['getIntersection'](_0x4e7a40);return!!(_0x10b6f5&&_0x1373a1&&_0x4e7a40['width']>0x0);}}const na=['getReviewCheckList','runReviewCheck','abortReviewStream','toggleDiff','acceptAllChanges','leaveReviewCoreResultList','activateChange','deactivateChange','acceptChange','dismissChange','learnMore','finishReview','retryReview'];class ra extends _0x173dbd{['_mainView'];['_balloonSuggestionView'];['_bodyCollection'];static get['requires'](){return[os];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x58f973){super(_0x58f973),this['_bodyCollection']=new Qt(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_mainView']=this['createMainView'](),this['_mainView']['delegate'](...na)['to'](this),this['_balloonSuggestionView']=new sa(this['context']['locale'],this['_bodyCollection']),this['_balloonSuggestionView']['delegate']('acceptChange','dismissChange','deactivateChange')['to'](this);}['init'](){const _0x3875fd=this['context']['plugins']['get']('AITabs');this['registerTab'](_0x3875fd);}['destroy'](){this['_bodyCollection']['detachFromDom'](),super['destroy']();}['setAvailableChecks'](_0x3d1245){if(!this['_mainView']['reviewCheckListView']['hasChecks']()){const _0x40c620=!this['context']['config']['get']('ai.models.showModelSelector');this['_mainView']['reviewCheckListView']['setChecks'](_0x3d1245,_0x40c620);}this['_mainView']['showReviewCheckListView']();}['showReviewCheckList'](){this['fire']('getReviewCheckList');}['showCheckRunResults'](_0x5cb217){_0x5cb217&&('error-general'!==_0x5cb217['status']?'error-chunk'!==_0x5cb217['status']?this['_mainView']['showReviewCheckResultsView']():this['showChunkErrorView']():this['showGeneralResultsErrorView']());}['showCheckRunResult'](_0x6e5099){this['_mainView']['addCheckRunResult'](_0x6e5099);}['showGeneralResultsErrorView'](){this['_mainView']['showGeneralResultsErrorView']();}['showGeneralReviewCoreErrorView'](_0x2d96cd){this['_mainView']['showGeneralReviewCoreErrorView'](_0x2d96cd??hs(this['context']['locale'],'AI_REVIEW_INITIALIZATION_ERROR_MESSAGE'));}['showChunkErrorView'](){this['_mainView']['showChunkErrorView']();}['setCheckResultTitle'](_0x56303f,_0x4a4e55){this['_mainView']['reviewCheckResultsView']['setTitle'](_0x56303f,_0x4a4e55);}['setActiveStateInResults'](_0x4dd78b){this['_mainView']['reviewCheckResultsView']['getResults']()['forEach'](_0x2d9e3b=>{_0x2d9e3b['id']===_0x4dd78b&&_0x2d9e3b['setItemAsActive']();});}['resetActiveStateInResults'](){this['_mainView']['reviewCheckResultsView']['getResults']()['forEach'](_0x3a2d91=>_0x3a2d91['setItemAsInactive']());}['updateChangeState'](_0x2b3cef,_0xf9e180){'accepted'===_0xf9e180||'rejected'===_0xf9e180||'outdated'===_0xf9e180?this['_mainView']['reviewCheckResultsView']['hideResult'](_0x2b3cef,_0xf9e180):this['_mainView']['reviewCheckResultsView']['showResult'](_0x2b3cef,_0xf9e180);}['showReviewCompletedView'](){this['_mainView']['showReviewCompletedView']();}['showActionsWhenResultIsReady'](){this['_mainView']['showActionsWhenResultIsReady']();}['showNoChangesView'](){this['_mainView']['showNoChangesView']();}['hideActionsWhenResultIsReady'](){this['_mainView']['hideActionsWhenResultIsReady']();}['showChangeBalloon'](_0x20764e,_0x6c7b12,_0x16dcb0,_0x5c9eb6,_0x329ec2,_0x4f64c0){this['_balloonSuggestionView']['showBalloon'](_0x20764e,_0x6c7b12,_0x16dcb0,_0x5c9eb6,_0x329ec2,_0x4f64c0);}['hideChangeBalloon'](){this['_balloonSuggestionView']['hideBalloon']();}['hideDiffInBalloon'](){this['_balloonSuggestionView']['hideDiffInBalloon']();}['showDiffInBalloon'](){this['_balloonSuggestionView']['showDiffInBalloon']();}['getChangeElement'](_0x59d77b){const _0x5b8c42=this['_mainView']['reviewCheckResultsView']['getResults']()['find'](_0x385e9c=>_0x385e9c['id']===_0x59d77b);return _0x5b8c42?_0x5b8c42['element']:null;}['deactivateChange'](){this['_balloonSuggestionView']['deactivateChange']();}}class oa extends vt{constructor(_0xeb1bf4){super(_0xeb1bf4),this['set']('isVisible',!0x1),this['set']('errorMessage','');const _0x5dec46=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai_review__general-error-container',_0x5dec46['if']('isVisible','ck-hidden',_0x3bb60d=>!_0x3bb60d)]},'children':[{'tag':'p','attributes':{'class':'ck\x20ck-ai-notification\x20ck-ai-notification_error'},'children':[{'text':_0x5dec46['to']('errorMessage')}]}]});}}class aa extends vt{['reviewCoreHeader'];['generalErrorView'];['reviewCheckListView'];['reviewCheckResultsView'];['reviewCompletedView'];constructor(_0x369fd7,_0x5b4d6f){super(_0x369fd7),this['reviewCoreHeader']=_0x5b4d6f['header'],this['generalErrorView']=new oa(_0x369fd7),this['reviewCheckListView']=_0x5b4d6f['list'],this['reviewCheckListView']['delegate'](...na)['to'](this),this['reviewCheckResultsView']=_0x5b4d6f['results'],this['reviewCheckResultsView']['delegate'](...na)['to'](this),this['reviewCompletedView']=_0x5b4d6f['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'](_0x1349e0){this['reviewCheckResultsView']['addResult'](_0x1349e0),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'](_0x1750b9){this['generalErrorView']['set']('isVisible',!0x0),this['generalErrorView']['errorMessage']=_0x1750b9;}['showGeneralResultsErrorView'](){this['reviewCheckResultsView']['set']('isLoading',!0x1),this['showActionsWhenResultIsReady'](),this['reviewCheckResultsView']['showGeneralErrorMessage']();}['showChunkErrorView'](){this['reviewCheckResultsView']['set']('isLoading',!0x1),this['showActionsWhenResultIsReady'](),this['reviewCheckResultsView']['showChunkErrorMessage']();}}class ha extends Nt{constructor(_0x592236,_0x11fa97){super(_0x11fa97),this['set']({'label':_0x592236,'withText':!0x0,'class':cs}),this['on']('execute',()=>{this['fire']('finishReview');});}}class ca extends Ht{['_resultViews'];['_resultsHeader'];['_resultsBody'];['reviewDisclaimer'];['_cancelButtonView'];['_acceptAllButtonView'];['_exitReviewButtonView'];['_toggleDiffButtonView'];['_errorMessageView'];['_finishReviewButtonView'];['_contents'];constructor(_0x1e3eed,_0x14f988){super(_0x1e3eed),this['_contents']=_0x14f988,this['_resultViews']=new _0x23af51(),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 io(_0x1e3eed),this['set']('isLoading',!0x1),this['set']('isToggleDiffOn',!0x1),this['set']('isResultReady',!0x1),this['set']('headerTitle',''),this['set']('headerSubtitle',''),this['set']('isError',!0x1),this['set']('showErrorMessage',!0x1),this['set']('errorType','general'),this['set']('isCompleted',!0x1);const _0x762826=this['_createCombinedSkeletonLoader'](),_0x48869e=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run',_0x48869e['if']('isLoading','ck-ai_review__check-run_loading',_0x4d8ea3=>_0x4d8ea3),_0x48869e['if']('isResultReady','ck-ai_review__check-run_ready',_0xc5b292=>_0xc5b292),_0x48869e['if']('isVisible','ck-hidden',_0x1ccc39=>!_0x1ccc39)]},'children':[this['_resultsHeader'],this['_errorMessageView'],this['_resultsBody'],_0x762826,this['reviewDisclaimer']]});}['clearResults'](){this['_resultViews']['clear'](),this['_resultsBody']['element']&&(this['_resultsBody']['element']['scrollTop']=0x0);}['getResults'](){return this['_resultViews'];}['addResult'](_0x1ba20b){const _0x381b03=new ia(this['locale'],_0x1ba20b['id']);_0x381b03['delegate']('acceptChange','dismissChange','activateChange','deactivateChange')['to'](this),this['_resultViews']['add'](_0x381b03),_0x381b03['resultResponseView']['element']['innerHTML']=_0x1ba20b['contentDiffed'];}['hideResult'](_0x5724b1,_0x28e02a){if('pending'===_0x28e02a)return;const _0x42b670=this['_resultViews']['find'](_0x176669=>_0x176669['id']===_0x5724b1);_0x42b670&&(_0x42b670['status']=_0x28e02a,_0x42b670['element']?.['classList']['add']('ck-ai_review__check-run-result_grayout'));}['showResult'](_0x1ca568,_0x570cd7){if('pending'!==_0x570cd7)return;const _0x155cc6=this['_resultViews']['find'](_0x2f9d0f=>_0x2f9d0f['id']===_0x1ca568);_0x155cc6&&(_0x155cc6['status']=_0x570cd7,_0x155cc6['element']?.['classList']['remove']('ck-ai_review__check-run-result_grayout'));}['setTitle'](_0x337467,_0x15a233){this['headerTitle']=_0x337467,this['headerSubtitle']=_0x15a233||'';}['showChunkErrorMessage'](){this['errorType']='chunk',this['showErrorMessage']=!0x0;}['showGeneralErrorMessage'](){this['isError']=!0x0,this['errorType']='general',this['showErrorMessage']=!0x0;}['resetErrorState'](){this['isError']=!0x1,this['errorType']='general',this['showErrorMessage']=!0x1;}['_createSkeletonLoader'](){return new pn(this['locale'],mn['aiReviewChecks']);}['_createCombinedSkeletonLoader'](){const _0x5eb78d=new vt(this['locale']),_0xf970a2=[];for(let _0x320280=0x0;_0x320280<0x10;_0x320280++){const _0x3a17ce=this['_createSkeletonLoader']();_0x3a17ce['extendTemplate']({'attributes':{'class':['ck-ai_review__check-run-skeleton-item']}}),_0xf970a2['push'](_0x3a17ce);}return _0x5eb78d['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-skeleton-container',this['bindTemplate']['if']('isLoading','ck-hidden',_0x449fab=>!_0x449fab)]},'children':_0xf970a2}),_0x5eb78d;}['_createResultsBodyView'](){const _0x163c84=new vt(this['locale']);return _0x163c84['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-container','ck-reset_all-excluded',this['bindTemplate']['if']('isLoading','ck-hidden',_0x4f47f4=>_0x4f47f4)]},'children':this['_resultViews']}),_0x163c84;}['_createErrorView'](){const _0x4df9be=new vt(this['locale']),_0x3949f3=new Nt(this['locale']),t=this['locale']['t'];return _0x4df9be['delegate']('retryReview')['to'](this),_0x3949f3['set']({'label':t('Try\x20again'),'withText':!0x0,'class':ls+'\x20ck-ai_review__check-run-error-retry-button'}),_0x3949f3['on']('execute',()=>{this['fire']('retryReview');}),_0x4df9be['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-error-container',this['bindTemplate']['if']('showErrorMessage','ck-hidden',_0x1706ce=>!_0x1706ce),this['bindTemplate']['if']('errorType','ck-ai_review__check-run-error-container_border-bottom',_0x161fee=>'chunk'===_0x161fee)]},'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',_0x580802=>'chunk'===_0x580802)]},'children':[{'tag':'p','attributes':{'class':['ck-ai-notification__content',this['bindTemplate']['if']('errorType','ck-hidden',_0x2d9b63=>'general'!==_0x2d9b63)]},'children':[{'text':this['_contents']['generalErrorText']}]},{'tag':'p','attributes':{'class':['ck-ai-notification__content',this['bindTemplate']['if']('errorType','ck-hidden',_0x1dca23=>'chunk'!==_0x1dca23)]},'children':[{'text':hs(this['locale'],'AI_REVIEW_MODE_CHUNK_ERROR_MESSAGE')}]}]},_0x3949f3]}),_0x4df9be;}['_createCancelButtonView'](){const _0x3cfac6=new Nt(this['locale']);return _0x3cfac6['set']({'label':hs(this['locale'],'AI_REVIEW_MODE_STOP_GENERATING'),'withText':!0x0,'class':[ls+'\x20ck-ai-button-stop-generating'],'icon':_0x327a50}),_0x3cfac6['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isResultReady','ck-hidden',_0x3fbfd5=>_0x3fbfd5),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x33d228=>_0x33d228)]}}),_0x3cfac6['on']('execute',()=>{this['fire']('abortReviewStream');}),_0x3cfac6;}['_createToggleDiffButtonView'](){const _0x49f642=new Nt(this['locale']);_0x49f642['set']({'tooltip':!0x0,'isToggleable':!0x0,'role':'menuitemcheckbox'}),_0x49f642['bind']('isEnabled')['to'](this,'isError',_0x2f002f=>!_0x2f002f),_0x49f642['extendTemplate']({'attributes':{'class':[ls,'ck-ai_review__check-run-toggle-diff-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x54e1c8=>!_0x54e1c8),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x1730fd=>_0x1730fd)]}});const _0x207f75=hs(this['locale'],'AI_REVIEW_MODE_HIDE_CHANGES'),_0xad3816=hs(this['locale'],'AI_REVIEW_MODE_SHOW_CHANGES');return _0x49f642['bind']('isOn')['to'](this,'isToggleDiffOn',_0x1dcf13=>_0x1dcf13),_0x49f642['bind']('icon')['to'](this,'isToggleDiffOn',_0x3698c9=>_0x3698c9?st:nt),_0x49f642['bind']('label')['to'](this,'isToggleDiffOn',_0x506d7a=>_0x506d7a?_0x207f75:_0xad3816),_0x49f642['on']('execute',()=>{this['isToggleDiffOn']=!this['isToggleDiffOn'],this['fire']('toggleDiff',{'on':this['isToggleDiffOn']});}),_0x49f642;}['_createAcceptAllButtonView'](){const _0x3a262f=new Nt(this['locale']);return _0x3a262f['set']({'label':hs(this['locale'],'AI_REVIEW_MODE_ACCEPT_ALL'),'withText':!0x0}),_0x3a262f['bind']('isEnabled')['to'](this,'isError',_0x31b90b=>!_0x31b90b),_0x3a262f['extendTemplate']({'attributes':{'class':[cs,'ck-ai_review__check-run-accept-all-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x359211=>!_0x359211),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x464b4a=>_0x464b4a)]}}),_0x3a262f['on']('execute',()=>{this['fire']('acceptAllChanges');}),_0x3a262f;}['_createExitReviewButtonView'](){const _0xb367e3=new Nt(this['locale']);return _0xb367e3['set']({'label':hs(this['locale'],'AI_REVIEW_MODE_EXIT_REVIEW'),'withText':!0x0}),_0xb367e3['extendTemplate']({'attributes':{'class':[us,'ck-ai_review__check-run-exit-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x9660e=>!_0x9660e),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x320c8f=>_0x320c8f)]}}),_0xb367e3['on']('execute',()=>{this['fire']('leaveReviewCoreResultList');}),_0xb367e3;}['_createResultHeaderView'](){const _0x55c9af=new vt(this['locale']),_0x334a84=this['_createTitleView']();return _0x55c9af['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header',this['bindTemplate']['if']('isCompleted','ck-ai_review__review-completed-header',_0x4b8ee1=>_0x4b8ee1)]},'children':[_0x334a84,{'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header-buttons']},'children':[this['_cancelButtonView'],this['_acceptAllButtonView'],this['_exitReviewButtonView'],this['_toggleDiffButtonView'],this['_finishReviewButtonView']]}]}),_0x55c9af;}['_createTitleView'](){const _0x431305=new vt(this['locale']),_0x4b2c64=new yn();return _0x4b2c64['bind']('isVisible')['to'](this,'isResultReady',_0xbf90b9=>!_0xbf90b9),_0x431305['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header-title-wrapper']},'children':[_0x4b2c64,{'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header-title-content',this['bindTemplate']['if']('isCompleted','ck-hidden',_0xb0910e=>_0xb0910e)]},'children':[{'tag':'span','attributes':{'class':['ck-ai_review__check-run-results-header-title']},'children':[{'text':this['bindTemplate']['to']('headerTitle')}]},{'tag':'span','attributes':{'class':['ck-ai_review__check-run-results-header-subtitle']},'children':[{'text':this['bindTemplate']['to']('headerSubtitle')}]}]},{'tag':'span','attributes':{'class':['ck-ai_review__review-completed-header-title',this['bindTemplate']['if']('isCompleted','ck-hidden',_0x5dff05=>!_0x5dff05)]},'children':[{'text':hs(this['locale'],'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE')}]}]}),_0x431305;}['_createFinishReviewButtonView'](){const _0x4906cd=new ha(hs(this['locale'],'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL'),this['locale']);return _0x4906cd['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isCompleted','ck-hidden',_0x356667=>!_0x356667)]}}),_0x4906cd['delegate']('finishReview')['to'](this),_0x4906cd;}}class la extends Ht{['_resultsHeader'];['_finishReviewButtonView'];constructor(_0x10f345,_0x3ffd99){super(_0x10f345),this['_finishReviewButtonView']=this['_createFinishReviewButtonView'](_0x3ffd99['buttonText']),this['_resultsHeader']=this['_createResultHeaderView'](_0x3ffd99['headerText']);const _0x52a0e8=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__review-completed',_0x52a0e8['if']('isVisible','ck-hidden',_0x24659a=>!_0x24659a)]},'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':_0x3ffd99['emptyResultsText']}]}]}]});}['_createFinishReviewButtonView'](_0x667c59){const _0x353c9a=new ha(_0x667c59,this['locale']);return _0x353c9a['delegate']('finishReview')['to'](this),_0x353c9a;}['_createResultHeaderView'](_0x20cf0d){const _0x412328=new vt(this['locale']);return _0x412328['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__review-completed-header']},'children':[{'tag':'span','attributes':{'class':['ck-ai_review__review-completed-header-title']},'children':[{'text':_0x20cf0d}]},{'tag':'div','attributes':{'class':['ck-ai_review__review-completed-header-buttons']},'children':[this['_finishReviewButtonView']]}]}),_0x412328;}}class ua extends vt{['_dropdownView'];['_defaultValue'];['_defaultLabel'];constructor(_0x26d353,_0x3451df){super(_0x26d353),this['_defaultValue']=_0x3451df['default']||(_0x3451df['data']['length']>0x0?_0x3451df['data'][0x0]['id']:''),this['_defaultLabel']=_0x3451df['data']['find'](_0x580cfb=>_0x580cfb['id']===this['_defaultValue'])?.['label']||'',this['set']('formValue',''),this['_dropdownView']=Gt(this['locale']);const _0x363764=this['_prepareListOptions'](_0x3451df['data']);jt(this['_dropdownView'],_0x363764,{'role':'menu','ariaLabel':_0x3451df['label']}),this['_dropdownView']['buttonView']['set']({'label':this['_defaultLabel'],'withText':!0x0}),this['_dropdownView']['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x333f00=>{_0x333f00['stopPropagation']();})}}),this['listenTo'](this['_dropdownView'],'execute',_0x570960=>{this['formValue']=_0x570960['source']['model']['id'],this['_dropdownView']['buttonView']['label']=_0x570960['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'](_0x2a03bb=[]){const _0x25a3d1=new dt();this['resetToDefault']();for(const _0x4b4196 of _0x2a03bb){const _0x408d02=new Jt({'label':_0x4b4196['label'],'withText':!0x0,'role':'menuitemradio','id':_0x4b4196['id'],'model':_0x4b4196});_0x408d02['bind']('isOn')['to'](this,'formValue',_0x241358=>_0x241358===_0x408d02['id']);const _0x8d696={'type':'button','model':_0x408d02};_0x25a3d1['add'](_0x8d696);}return _0x25a3d1;}}class da extends Ht{['_formItem']=null;constructor(_0x38581d,_0x4f70e2,_0x3edcfd){super(_0x38581d),this['argsKey']=_0x4f70e2?.['argsKey'];if('dropdown'===_0x4f70e2['formType'])this['_formItem']=new ua(this['locale'],_0x4f70e2);this['set']('value',''),this['bind']('value')['to'](this['_formItem'],'formValue');const _0x294c6f=new _0xc57744(this['locale'],{'children':[this['_formItem']],'class':[_0x3edcfd?'ck-form__row_with-submit':'']});_0x3edcfd&&_0x294c6f['children']['add'](_0x3edcfd),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai_review__form-item','ck-reset_all']},'children':[_0x294c6f]});}['resetToDefault'](){this['_formItem']['resetToDefault']();}}class _a extends _0x4e411f{['keystrokes'];static ['MIN_ROWS']=0x1;static ['MAX_ROWS']=0xc;constructor(_0x2cb6d9){super(_0x2cb6d9),this['set']('isEmpty',!0x0),this['keystrokes']=new gt(),this['minRows']=_a['MIN_ROWS'],this['maxRows']=_a['MAX_ROWS'],this['extendTemplate']({'attributes':{'id':'ai-review-prompt-input','class':['ck','ck-review__prompt-input']}});}['render'](){super['render'](),this['on']('update',()=>{this['isEmpty']=''===this['element']['value']?.['trim']();}),this['keystrokes']['listenTo'](this['element']);}}class ga extends vt{['focusTracker']=new _t();['keystrokes']=new gt();['focusCycler'];['_focusables']=new _0x23af51();['submitButtonView'];['cancelButtonView'];['promptInputView'];['actionsFooterView'];['_modelSelectionDropdown'];['_modelNameView'];['_modelSelectionDropdownItems'];['_check'];['_defaultValue'];['_defaultLabel'];constructor(_0x303a59,_0x29c224,_0x124131=!0x1){super(_0x303a59),this['_check']=_0x29c224,this['set']('prompt',''),this['set']('modelId',''),this['set']('modelDisplayMode','selector'),this['set']('activeModelName',null),this['_defaultValue']=_0x29c224['defaultModel']?_0x29c224['defaultModel']['id']:'',this['_defaultLabel']=_0x29c224['defaultModel']?_0x29c224['defaultModel']['name']:'',this['submitButtonView']=this['_createSubmitButtonView'](),this['cancelButtonView']=this['_createCancelButtonView'](),(this['promptInputView']=new te(this['locale'],()=>new _a(_0x303a59)),this['promptInputView']['fieldView']['bind']('value')['to'](this,'prompt'),this['promptInputView']['fieldView']['on']('input',()=>{this['prompt']=this['promptInputView']['fieldView']['element']['value'];}),this['_modelSelectionDropdown']=this['_createModelSelectionDropdown'](),this['_modelSelectionDropdownItems']=new dt(),this['_modelNameView']=this['_createModelNameView'](),this['_setModelList'](_0x124131),jt(this['_modelSelectionDropdown'],this['_modelSelectionDropdownItems']),this['actionsFooterView']=this['_createActionsFooterView'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-custom-actions']},'children':[new _0xc57744(this['locale'],{'children':[this['promptInputView']]}),new _0xc57744(this['locale'],{'children':[this['actionsFooterView']]})]}),this['promptInputView']['fieldView']['keystrokes']['set']('Enter',(_0x1b3b56,_0x2e05c4)=>{this['_isValid']()?(this['fire']('runReviewCheck',{'id':'custom','args':{'prompt':this['prompt'],'model':this['modelId']},'isCustom':!0x0}),_0x2e05c4()):_0x2e05c4();}),this['focusCycler']=new Ut({'focusables':this['_focusables'],'focusTracker':this['focusTracker'],'keystrokeHandler':this['keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}));}['render'](){super['render'](),([this['promptInputView'],this['_modelSelectionDropdown'],this['cancelButtonView'],this['submitButtonView']]['forEach'](_0x3874a4=>{this['_focusables']['add'](_0x3874a4),this['focusTracker']['add'](_0x3874a4['element']);}),this['keystrokes']['listenTo'](this['element']));}get['modelDefaultValue'](){return this['_defaultValue'];}get['modelDefaultLabel'](){return this['_defaultLabel'];}['resetToDefault'](){this['prompt']='',this['modelId']=this['modelDefaultValue'],this['_modelSelectionDropdown']['buttonView']['label']=this['modelDefaultLabel'],this['resetFormValidationStatus']();}['resetFormValidationStatus'](){this['promptInputView']['errorText']='';}['_isValid'](){this['resetFormValidationStatus']();for(const _0xd9623d of this['_getFormValidators']()){const _0x414d2a=_0xd9623d();if(_0x414d2a)return this['promptInputView']['errorText']=_0x414d2a,!0x1;}return!0x0;}['_getFormValidators'](){return[()=>{if(0x0===this['promptInputView']['fieldView']['value']?.['trim']()['length'])return hs(this['locale'],'AI_REVIEW_MODE_PROMPT_EMPTY_ERROR');}];}['_createSubmitButtonView'](){const _0x4f8380=new Nt(this['locale']),t=this['locale']['t'];return _0x4f8380['set']({'label':t('Submit'),'withText':!0x0,'class':cs}),_0x4f8380['on']('execute',()=>{this['_isValid']()&&this['fire']('runReviewCheck',{'id':'custom','args':{'prompt':this['prompt'],'model':this['modelId']},'isCustom':!0x0});}),_0x4f8380;}['_createCancelButtonView'](){const _0xd859d=new Nt(this['locale']),t=this['locale']['t'];return _0xd859d['set']({'label':t('Cancel'),'withText':!0x0,'class':us}),_0xd859d['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x3f5698=>{_0x3f5698['stopPropagation']();})}}),_0xd859d['on']('execute',()=>{this['resetToDefault'](),this['fire']('closeCustomCheck');}),_0xd859d;}['_setModelList'](_0xc06094){this['_modelSelectionDropdownItems']['clear']();const _0xfb8e6e=this['_check']['models'];if(_0xc06094)this['set']('modelDisplayMode','hidden');else{const _0x3c8e0c=0x1===_0xfb8e6e['length'];this['set']('modelDisplayMode',_0x3c8e0c?'name':'selector');}if(this['resetToDefault'](),_0xfb8e6e?.['length']){0x1===_0xfb8e6e['length']&&this['set']('activeModelName',_0xfb8e6e[0x0]['name']||_0xfb8e6e[0x0]['id']);for(const _0x1804f5 of _0xfb8e6e){const _0x375e70=new Jt({'label':_0x1804f5['name'],'withText':!0x0,'role':'menuitemradio','id':_0x1804f5['id'],'model':_0x1804f5});_0x375e70['bind']('isOn')['to'](this,'modelId',_0x3b00d3=>_0x3b00d3===_0x1804f5['id']),this['_modelSelectionDropdownItems']['add']({'type':'button','model':_0x375e70,'labelView':new Ia(this['locale'],_0x1804f5)});}}}['_createModelSelectionDropdown'](){const _0x10f78b=Gt(this['locale']);return _0x10f78b['set']({'panelPosition':'se','class':'ck-ai_review__check-list-item-model-dropdown'}),_0x10f78b['buttonView']['set']({'label':this['_defaultLabel'],'withText':!0x0,'tooltip':!0x0,'class':us}),_0x10f78b['buttonView']['bind']('isVisible')['to'](this,'modelDisplayMode',_0x54c66d=>'selector'===_0x54c66d),this['listenTo'](_0x10f78b,'execute',_0x44d73e=>{this['modelId']=_0x44d73e['source']['model']['id'],_0x10f78b['buttonView']['label']=_0x44d73e['source']['label'];}),_0x10f78b;}['_createModelNameView'](){const _0x47c934=new Aa(this['locale']);return _0x47c934['bind']('text')['to'](this,'activeModelName',_0x273650=>_0x273650??''),_0x47c934['bind']('isVisible')['to'](this,'modelDisplayMode',_0x2422e6=>'name'===_0x2422e6),_0x47c934;}['_createActionsFooterView'](){const _0x2fb218=new vt(this['locale']);return _0x2fb218['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-custom-actions-footer']},'children':[this['_modelSelectionDropdown'],this['_modelNameView'],{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized-custom-actions-buttons']},'children':[this['cancelButtonView'],this['submitButtonView']]}]}),_0x2fb218;}}class Aa extends vt{constructor(_0x5afd42){super(_0x5afd42),this['set']('text',void 0x0),this['set']('isVisible',!0x0);const _0x3594f4=this['bindTemplate'];this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai_review__check-list-item-model-name',_0x3594f4['if']('isVisible','ck-hidden',_0xe8b554=>!_0xe8b554)]},'children':[{'text':_0x3594f4['to']('text')}]});}}class Ia extends Mt{constructor(_0x33bdcb,_0x554334){super();const _0x1cbf86=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-button__label'],'style':_0x1cbf86['to']('style'),'id':_0x1cbf86['to']('id')},'children':[{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-model-dropdown-name']},'children':[{'tag':'span','children':[{'text':_0x1cbf86['to']('text')}]}]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-model-dropdown-description']},'children':[{'tag':'span','children':[_0x554334['description']||'']}]}]});}}class Ea extends Ht{['_formItemsCollection']=new _0x23af51();['_customCheckView']=null;['_hideModels']=!0x1;constructor(_0x3c82be,_0x166d97,_0x3a24d8,_0x22eeb3=!0x1){super(_0x3c82be),this['_hideModels']=_0x22eeb3,this['set']('isParametrizedViewOpen',!0x1),this['set']('isListItemRendered',!0x1),this['set']('isItemParametrized',_0x166d97['isParameterized']);const _0x5495cd=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',_0x2abcad=>_0x2abcad),this['bindTemplate']['if']('isListItemRendered','ck-ai_review__check-list-item_rendered',_0x294925=>_0x294925)],'style':{'--ck-ai-review-check-list-item-index':_0x3a24d8}},'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':_0x166d97['title']}]},_0x5495cd]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-description']},'children':_0x166d97['description']?[{'text':_0x166d97['description']}]:[]}]}]},..._0x166d97['isParameterized']?[this['_createParameterizedView'](_0x166d97)]:[],...'custom'===_0x166d97['id']?[this['_createCustomView'](_0x166d97,this['_hideModels'])]:[]]}),this['on']('click',()=>{_0x166d97['isParameterized']?this['isParametrizedViewOpen']=!0x0:this['fire']('runReviewCheck',{'id':_0x166d97['id'],'args':_0x166d97['useArgs']?_0x166d97['args']:void 0x0});}),requestAnimationFrame(()=>{this['isListItemRendered']=!0x0;});}['render'](){super['render'](),this['isItemParametrized']&&zt({'emitter':this,'activator':()=>!0x0===this['isParametrizedViewOpen'],'contextElements':[this['element']],'callback':()=>{this['isParametrizedViewOpen']=!0x1;}});}['resetToDefault'](){this['isParametrizedViewOpen']=!0x1,this['_formItemsCollection']['forEach'](_0x1a8fa7=>{_0x1a8fa7['resetToDefault']();}),this['_customCheckView']&&this['_customCheckView']['resetToDefault']();}['_createIconView'](){const _0x5e770b=new xt();return _0x5e770b['content']=rt,_0x5e770b['extendTemplate']({'attributes':{'class':['ck-ai_review__check-list-item-title-icon']}}),_0x5e770b;}['_createParameterizedView'](_0x438998){const _0x1fb86f=new vt(),_0x3f2865=this['_createFormView'](_0x438998);return _0x1fb86f['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized',this['bindTemplate']['if']('isParametrizedViewOpen','ck-hidden',_0x3f07ce=>!_0x3f07ce)]},'children':[_0x3f2865]}),_0x1fb86f;}['_createFormView'](_0x3f7803){const _0x230a74=new vt(),_0x2202b2=Array['isArray'](_0x3f7803['options'])?_0x3f7803['options']:[],_0x1d8fc0=new Nt(this['locale']),t=this['locale']['t'];_0x1d8fc0['set']({'label':t('Submit'),'withText':!0x0,'class':cs}),_0x1d8fc0['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0xc0e03b=>{_0xc0e03b['stopPropagation']();})}}),_0x1d8fc0['on']('execute',()=>{const _0xdceb4c=[],_0x5d1887={};this['_formItemsCollection']['forEach'](_0x3fedd2=>{_0xdceb4c['push'](_0x3fedd2['value']),_0x3f7803['useArgs']&&_0x3f7803['options']&&(_0x5d1887[_0x3fedd2['argsKey']]=_0x3fedd2['value']);}),this['fire']('runReviewCheck',{'id':_0x3f7803['id'],'params':_0xdceb4c['length']?_0xdceb4c:void 0x0,'args':Object['keys'](_0x5d1887)['length']?_0x5d1887:void 0x0});});const _0x33ccc6=_0x2202b2['length'];return _0x2202b2['forEach']((_0x2087f,_0x53f2c7)=>{const _0x35440d=_0x53f2c7===_0x33ccc6-0x1;this['_formItemsCollection']['add'](new da(this['locale'],_0x2087f,_0x35440d?_0x1d8fc0:null));}),_0x230a74['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized-form']},'children':this['_formItemsCollection']}),_0x230a74;}['_createCustomView'](_0x3202c5,_0x5b4fc8=!0x1){return this['_customCheckView']=new ga(this['locale'],_0x3202c5,_0x5b4fc8),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',_0x325beb=>!_0x325beb)]}}),this['_customCheckView']['delegate']('runReviewCheck')['to'](this),this['listenTo'](this['_customCheckView'],'closeCustomCheck',()=>{this['isParametrizedViewOpen']=!0x1;}),this['on']('change:isParametrizedViewOpen',(_0x12d5f7,_0x51b9c7,_0x2b9288)=>{_0x2b9288||this['_customCheckView']['resetFormValidationStatus']();}),this['_customCheckView'];}}class pa extends Ht{['_checkViews'];constructor(_0x35e5ce){super(_0x35e5ce),this['_checkViews']=new _0x23af51(),this['_setupTemplate']();}['setChecks'](_0x52d49f,_0x57b2b4=!0x1){this['_checkViews']['clear']();for(const [_0x94ff8d,_0x1d4ed0]of _0x52d49f['entries']()){const _0x3203fe=new Ea(this['locale'],_0x1d4ed0,_0x94ff8d,_0x57b2b4);_0x3203fe['delegate']('runReviewCheck')['to'](this),this['_checkViews']['add'](_0x3203fe);}}['hasChecks'](){return this['_checkViews']['length']>0x0;}['resetAllParameterizedChecks'](){for(const _0x2c7ac1 of this['_checkViews'])_0x2c7ac1 instanceof Ea&&_0x2c7ac1['resetToDefault']();}['_setupTemplate'](){const _0x1e05cb=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list',_0x1e05cb['if']('isVisible','ck-hidden',_0x58e160=>!_0x58e160)]},'children':this['_checkViews']});}}class ma extends ra{static get['pluginName'](){return'AIReviewModeUI';}['createMainView'](){const _0x599544=this['context']['plugins']['get']('AITabs'),_0x101709=this['context']['locale'],_0x548acc=new eo(_0x101709,{'label':hs(_0x101709,'AI_REVIEW_MODE'),'icon':_0x4a5506,'class':'ck-ai-header_review','showResizeButton':_0x599544['showResizeButton']});return _0x548acc['delegate']('resizeTabs')['to'](_0x599544),_0x548acc['bind']('isMaximized')['to'](_0x599544['view'],'isMaximized',_0x314ec0=>_0x314ec0),new aa(this['context']['locale'],{'header':_0x548acc,'list':new pa(_0x101709),'results':new ca(_0x101709,{'generalErrorText':hs(_0x101709,'AI_REVIEW_MODE_GENERAL_ERROR_MESSAGE')}),'completed':new la(_0x101709,{'headerText':hs(_0x101709,'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE'),'emptyResultsText':hs(_0x101709,'AI_REVIEW_MODE_EMPTY_RESULTS_TEXT'),'buttonText':hs(_0x101709,'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL')})});}['registerTab'](){const _0x59301e=this['context']['plugins']['get']('AITabs');_0x59301e['view']['on']('activateTab',(_0x3c7ee2,{newTab:_0x5aead2,oldTab:_0x4b38e7})=>{'reviewMode'===_0x5aead2?this['fire']('getReviewCheckList'):'reviewMode'===_0x4b38e7&&this['fire']('leaveReview');}),_0x59301e['view']['addTab']({'id':'reviewMode','buttonLabel':hs(this['context']['locale'],'AI_REVIEW_MODE'),'buttonIcon':_0x4a5506,'order':0x0,'content':this['_mainView']});}}const Ta='review-',Ca=['softBreak'];class wa extends _0x173dbd{static get['requires'](){return[_0x47efd0,Js];}static get['pluginName'](){return'AIReviewCoreEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['_markers']=new Map();['_activeMarkers']=new Set();['_domEmitter'];['_eventEmitter'];['_reviewEditingAttachedEditors']=new WeakSet();['_boundEditables']=new WeakMap();constructor(_0x22160a){super(_0x22160a),this['_domEmitter']=new(Ot())(),this['_eventEmitter']=new(Tt())();}get['emitter'](){return this['_eventEmitter'];}['afterInit'](){const _0x1255bc=_0x3dabee=>this['_scheduleAttachReviewEditingToEditor'](_0x3dabee);if(this['_registerGlobalBalloonBlurHandler'](),this['context']instanceof _0x2ef8df)return void this['_attachReviewEditingToEditor'](this['context']);const _0x212d41=this['context'];for(const _0x350ee2 of _0x212d41['editors'])_0x1255bc(_0x350ee2);this['listenTo'](_0x212d41['editors'],'add',(_0xbf7898,_0x2a316c)=>{_0x1255bc(_0x2a316c);}),this['listenTo'](_0x212d41['editors'],'remove',(_0x17c1cd,_0x3b76fc)=>{for(const [_0x13d638,_0x3c61d2]of this['_markers'])_0x3c61d2['editor']===_0x3b76fc&&(this['_eventEmitter']['fire']('changeMarkerRemoved',{'markerId':_0x13d638,'changeId':_0x3c61d2['groupId']}),this['_markers']['delete'](_0x13d638));});}['_scheduleAttachReviewEditingToEditor'](_0x2e2833){const _0x1a996e=()=>{'destroyed'!==_0x2e2833['state']&&_0x2e2833['conversion']&&this['_attachReviewEditingToEditor'](_0x2e2833);};if('ready'===_0x2e2833['state'])return void _0x1a996e();const _0x15f3e7=()=>{this['stopListening'](_0x2e2833,'ready',_0x15f3e7),_0x1a996e();};this['listenTo'](_0x2e2833,'ready',_0x15f3e7);}['_attachReviewEditingToEditor'](_0x47edc8){this['_reviewEditingAttachedEditors']['has'](_0x47edc8)||(_0x47edc8['conversion']['for']('editingDowncast')['markerToElement']({'model':Ta+'insert','view':(_0x43d8c2,{writer:_0x2d73b2})=>{const _0x37ff5c=this['_markers']['get'](_0x43d8c2['markerName']),_0x773e1f={'class':'ck-ai_review-marker_add'+(this['_activeMarkers']['has'](_0x37ff5c?.['id']||'')?'\x20ck-ai_review__change_active':''),'data-marker-id':_0x43d8c2['markerName']};return _0x2d73b2['createUIElement']('span',_0x773e1f,function(_0x19a47b){const _0x137266=this['toDomElement'](_0x19a47b);return _0x137266['innerHTML']=_0x37ff5c?.['content']?.['asString']||'',_0x137266;});}}),_0x47edc8['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Ta+'remove-only','view':_0x40636f=>{const _0x5c3fbd=this['_markers']['get'](_0x40636f['markerName']),_0x412003=['ck-ai_review-marker_strikethrough'];return this['_activeMarkers']['has'](_0x5c3fbd?.['id']||'')&&_0x412003['push']('ck-ai_review__change_active'),{'classes':_0x412003,'attributes':{'data-marker-id':_0x40636f['markerName']}};}}),_0x47edc8['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Ta+'remove-context','view':_0x52b8e7=>{const _0x2dd5ad=this['_markers']['get'](_0x52b8e7['markerName']),_0x3c07d6=['ck-ai_review-marker_underline'];return this['_activeMarkers']['has'](_0x2dd5ad?.['id']||'')&&_0x3c07d6['push']('ck-ai_review__change_active'),{'classes':_0x3c07d6,'attributes':{'data-marker-id':_0x52b8e7['markerName']}};}}),_0x47edc8['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Ta+'remove-text','view':_0xe3a867=>{const _0x12ccac=this['_markers']['get'](_0xe3a867['markerName']),_0x586d19=['ck-ai_review-marker_hide'];return this['_activeMarkers']['has'](_0x12ccac?.['id']||'')&&_0x586d19['push']('ck-ai_review__change_active'),{'classes':_0x586d19,'attributes':{'data-marker-id':_0xe3a867['markerName']}};}}),_0x47edc8['conversion']['for']('dataDowncast')['markerToElement']({'model':Ta+'suggestion-context','view':(_0x265bb0,{writer:_0x45f77d})=>_0x45f77d['createRawElement']('span',{'class':'ck-ai_review-marker_context-'+(_0x265bb0['isOpening']?'start':'end')})}),_0x47edc8['conversion']['for']('downcast')['attributeToAttribute']({'model':_0x138817,'view':_0x6099dd}),this['_updateMouseMarkerInteractionListeners'](_0x47edc8),this['listenTo'](_0x47edc8,'addRoot',()=>this['_updateMouseMarkerInteractionListeners'](_0x47edc8),{'priority':'lowest'}),this['listenTo'](_0x47edc8,'detachRoot',()=>this['_updateMouseMarkerInteractionListeners'](_0x47edc8),{'priority':'lowest'}),_0x47edc8['model']['document']['registerPostFixer'](_0x3f476b=>this['_validateMarkers'](_0x47edc8,_0x3f476b)),_0x47edc8['model']['document']['on']('change',()=>this['_handleMarkerChanges'](_0x47edc8)),this['_reviewEditingAttachedEditors']['add'](_0x47edc8));}['_updateMouseMarkerInteractionListeners'](_0x3f8f64){let _0xe1428e=this['_boundEditables']['get'](_0x3f8f64);_0xe1428e||(_0xe1428e=new Map(),this['_boundEditables']['set'](_0x3f8f64,_0xe1428e));const _0x21e75f=new Set(_0x3f8f64['ui']['getEditableElementsNames']());for(const _0x55a415 of _0x21e75f){if(_0xe1428e['has'](_0x55a415))continue;const _0x349e79=_0x3f8f64['ui']['getEditableElement'](_0x55a415);_0xe1428e['set'](_0x55a415,_0x349e79),this['_attachMouseMarkerInteractionListeners'](_0x349e79);}for(const [_0x4c3c86,_0x42b2f2]of _0xe1428e)_0x21e75f['has'](_0x4c3c86)||(_0xe1428e['delete'](_0x4c3c86),this['_domEmitter']['stopListening'](_0x42b2f2));}['_attachMouseMarkerInteractionListeners'](_0x1561e4){this['_domEmitter']['listenTo'](_0x1561e4,'mouseup',(_0x89a9da,_0x34c3ec)=>{const _0x2a302b=_0x34c3ec['target'],_0x502596=this['_findMarkerElement'](_0x2a302b);if(!_0x502596)return;const _0x4236b8=_0x502596['getAttribute']('data-marker-id'),_0xe528e4=_0x4236b8['split'](':')['pop']()?.['split']('_')[0x0];this['_eventEmitter']['fire']('changeMarkerClicked',{'markerId':_0x4236b8,'changeId':_0xe528e4,'markerElement':()=>this['_findMarkerElementById'](_0x4236b8),'domEvent':_0x34c3ec});},{'usePassive':!0x0,'priority':'highest'}),this['_domEmitter']['listenTo'](_0x1561e4,'mouseover',(_0x5df60e,_0x225a7a)=>{const _0x2ac039=_0x225a7a['target'],_0x36a754=_0x225a7a['relatedTarget'];let _0x216de1=this['_findMarkerElement'](_0x2ac039);if(!_0x216de1&&_0x36a754&&(_0x216de1=this['_findMarkerElement'](_0x36a754)),!_0x216de1)return;const _0x2f7529=_0x216de1['getAttribute']('data-marker-id'),_0xab0978=_0x2f7529['split'](':')['pop']()?.['split']('_')[0x0];this['_eventEmitter']['fire']('changeMarkerHovered',{'changeId':_0xab0978,'markerElement':()=>this['_findMarkerElementById'](_0x2f7529),'domEvent':_0x225a7a});});}['_registerGlobalBalloonBlurHandler'](){this['_domEmitter']['listenTo'](document,'mouseover',_0x12ff54((_0x5e2cf4,_0x37fbf2)=>{const _0x43b964=_0x37fbf2['target'];if(this['_findMarkerElement'](_0x43b964))return;_0x43b964['closest']('.ck-reset.ck-ai_review-balloon-panel-suggestion')||this['_eventEmitter']['fire']('changeMarkerBlurred');},0xc8));}['getDocumentData'](){const _0x5cabf1=this['context']['plugins']['get']('AIEditing'),_0x5ceb2d=Ws(this['context']);if(!_0x5ceb2d['length'])throw new at('ai-get-editor-from-context-no-editor',this);const _0x4f282e=new Set(),_0xedf505=[],_0x1a8750=new Map();for(const _0x293c6a of _0x5ceb2d)for(const _0x3b0c13 of _0x293c6a['model']['document']['getRoots']()){if('$graveyard'===_0x3b0c13['rootName'])continue;const _0x456a3a=this['_buildDocumentDataSliceForRoot'](_0x293c6a,_0x3b0c13,_0x5cabf1,_0x4f282e);_0xedf505['push'](_0x456a3a['content']);for(const [_0x9ca790,_0x3aceb2]of _0x456a3a['elements'])_0x1a8750['set'](_0x9ca790,_0x3aceb2);}return{'elements':_0x1a8750,'content':_0xedf505['join']('')};}['_buildDocumentDataSliceForRoot'](_0xc340fc,_0x230593,_0x11786a,_0x56da2f){const _0x499760=_0xc340fc['model'],_0x7cf0f5=new _0x569183();for(const _0x5798d5 of _0x230593['getChildren']())_0x7cf0f5['_appendChild'](_0x5798d5['_clone'](!0x0));for(const _0x3d29b7 of _0x499760['markers']){const _0x4364fa=_0x3d29b7['getRange']();_0x4364fa&&_0x4364fa['root']['rootName']===_0x230593['rootName']&&_0x7cf0f5['markers']['set'](_0x3d29b7['name'],this['_changeRangeOwnerDocument'](_0x4364fa['clone'](),_0x7cf0f5));}const _0x3b2d14=new Map(),_0x59cbf5=_0x499760['document']['version'],_0x3333ad=new _0x342db9({'ignoreElementEnd':!0x0,'startPosition':_0x499760['createPositionAt'](_0x7cf0f5,0x0)});for(const {item:_0x2904ae}of _0x3333ad){if(!_0x2904ae['is']('$textProxy'))continue;const _0x34d493=_0x2904ae['parent'];if(!_0x34d493||!_0x34d493['is']('element'))continue;const _0x2ff396=this['_upsertDataId'](_0x34d493,()=>_0x11786a['_nextDataId'](_0x56da2f));_0x56da2f['add'](_0x2ff396);for(const _0x3b80ab of _0x34d493['getChildren']())_0x3b80ab['is']('element')&&(_0x3b80ab['name']&&Ca['includes'](_0x3b80ab['name'])||_0x56da2f['add'](this['_upsertDataId'](_0x3b80ab,()=>_0x11786a['_nextDataId'](_0x56da2f))));let _0x21076e=_0x34d493;for(;_0x21076e['parent']&&!_0x21076e['parent']['is']('documentFragment');)_0x21076e=_0x21076e['parent'],_0x21076e['hasAttribute'](_0x138817)&&_0x21076e['_removeAttribute'](_0x138817);_0x3b2d14['set'](_0x2ff396,{'editor':_0xc340fc,'rootName':_0x230593['rootName'],'path':_0x34d493['getPath'](),'documentVersion':_0x59cbf5,'getContent':this['_createGetContentUsingDataIdFn'](_0x21076e['_clone'](!0x0),_0x2ff396,_0xc340fc['data'])}),_0x3333ad['jumpTo'](_0x499760['createPositionAfter'](_0x34d493));}return{'content':_0xc340fc['data']['processor']['toData'](_0xc340fc['data']['toView'](_0x7cf0f5)),'elements':_0x3b2d14};}['diffContent'](_0xca3621,_0x58bea3,_0x115808,_0x2e7e11=!0x1){const _0x130ea9=[],_0x4ef5c7=_0xca3621['data']['parse'](_0x115808,'$documentFragment'),_0x3a888a=_0xca3621['data']['parse'](_0x58bea3,'$documentFragment'),_0x2127ab=_0xca3621['model']['createPositionAt'](_0x3a888a,0x0);if(this['_haveSingleTopLevelElement'](_0x4ef5c7)){if(!this['_hasSameTopLevelElement'](_0x3a888a,_0x4ef5c7))return _0x130ea9;}else{const _0x5009f1=_0xca3621['model']['schema'];if(!this['_haveOnlyInlineContent'](_0x3a888a,_0x5009f1)||!this['_haveOnlyInlineContent'](_0x4ef5c7,_0x5009f1))return _0x130ea9;}const _0x306b5c=this['context']['plugins']['get']('DocumentCompare')['getDiff'](_0x58bea3,_0x115808,{'targetEditor':_0xca3621,'anchor':_0x2127ab,'markDeletions':!0x0})['getOperations']()['filter'](_0x1c48f0=>'insert'===_0x1c48f0['type']||'marker'===_0x1c48f0['type']&&_0x1c48f0['name']['startsWith']('$markedRemove')),_0x32d8f3=this['_groupAdjacentOperations'](_0x306b5c),_0x381359=[];if(_0x2e7e11){if(_0x32d8f3['length']){const _0x416529=_0x32d8f3[0x0]['operations'][0x0],_0x2fbb26='insert'===_0x416529['type']?_0x416529['position']:_0x416529['newRange']['start'],_0x584690=this['_getPositionLimitingRange'](_0x2fbb26,_0xca3621,'inside'),_0x4ee3eb=_0x584690?_0x4ef5c7['getChild'](0x0)['getChildren']():_0x4ef5c7['getChildren'](),_0x5c16ef=_0x584690||_0xca3621['model']['createRangeIn'](_0x3a888a),_0x18ca1a=[new _0x437745('$markedRemove:synthetic'+ot(),null,_0x5c16ef,_0xca3621['model']['document']['model']['markers'],!0x0,_0xca3621['model']['document']['version']+0x1),new _0x2038eb(_0x5c16ef['end'],_0x4ee3eb,_0xca3621['model']['document']['version']+0x2)];_0x381359['push']({'operations':_0x18ca1a,'operationsIsolated':_0x18ca1a,'groupOffset':0x0});}}else _0x381359['push'](..._0x32d8f3);let _0x4df397=0x0;return _0xca3621['model']['change'](_0x67541e=>{for(let _0x59a2f3=0x0;_0x59a2f3<_0x381359['length'];_0x59a2f3++){const _0x31700d=_0x381359[_0x59a2f3],_0x1a4264=_0x67541e['createDocumentFragment']();for(const _0x2b3ee1 of _0x3a888a['getChildren']())_0x67541e['append'](_0x2b3ee1['_clone'](!0x0),_0x1a4264);for(const _0x57c2f9 of _0x31700d['operationsIsolated'])if('insert'===_0x57c2f9['type']){const _0x4bdd20=_0x57c2f9;_0x4bdd20['baseVersion']=null,_0x4bdd20['isDocumentOperation']=!0x1,this['_changeOperationOwnerDocument'](_0x4bdd20,_0x1a4264),_0x67541e['batch']['addOperation'](_0x57c2f9),_0xca3621['model']['applyOperation'](_0x57c2f9);const _0x5f5663='suggestion:insertion:id:authorId:'+_0x4df397++,_0x1ed0a8=_0xca3621['model']['createRange'](_0x4bdd20['position'],_0x4bdd20['position']['getShiftedBy'](_0x4bdd20['howMany']));_0x1a4264['markers']['set'](_0x5f5663,_0x1ed0a8);}else{if('marker'===_0x57c2f9['type']&&_0x57c2f9['name']['startsWith']('$markedRemove')){const _0x16ec10=_0x57c2f9,_0x338f38='suggestion:deletion:id:authorId:'+_0x4df397++;this['_changeOperationOwnerDocument'](_0x16ec10,_0x1a4264),_0x1a4264['markers']['set'](_0x338f38,_0x16ec10['newRange']);}}if(_0x2e7e11)_0x130ea9['push']({..._0x31700d,'context':this['_createGetContentFn'](_0x3a888a,_0xca3621['data']),'content':this['_createGetContentFn'](_0x3a888a,_0xca3621['data'])});else{const _0x1aacc9=this['_getChangeContext'](this['_changePositionOwnerDocument'](this['_getOperationStart'](_0x31700d['operationsIsolated'][0x0]),_0x1a4264),this['_changePositionOwnerDocument'](this['_getOperationEnd'](_0x31700d['operationsIsolated'][_0x31700d['operationsIsolated']['length']-0x1]),_0x1a4264),_0xca3621);_0x1a4264['markers']['set'](Ta+'suggestion-context',new _0x5ca4e8(_0x1aacc9['start'],_0x1aacc9['end'])),_0x130ea9['push']({..._0x31700d,'context':this['_createGetContextFn'](_0x1a4264,_0xca3621['data'],{'ellipsisBefore':_0x1aacc9['hasContentBefore'],'ellipsisAfter':_0x1aacc9['hasContentAfter']}),'content':this['_createGetContentFn'](_0x1a4264,_0xca3621['data'])});}}}),_0x130ea9;}['markChangePositionInEditorContent'](_0x167eb5,_0x3ab323){if(!_0x167eb5['length'])return;const _0x42b365=_0x167eb5[0x0]['parent']['id'],_0x340e80=_0x3ab323['elements']['get'](_0x42b365);if(!_0x340e80)return void console['warn']('No\x20element\x20found\x20for\x20ID:\x20'+_0x42b365);const _0x3e8206=_0x340e80['path'],_0x258d8b=_0x340e80['editor'],_0x428cd9=_0x258d8b['model']['document']['getRoot'](_0x340e80['rootName']);if(!_0x428cd9)return void console['warn']('No\x20model\x20root\x20found\x20for\x20name:\x20'+_0x340e80['rootName']);const _0x20fa1d=_0x258d8b['model']['document']['history']['getOperations'](_0x340e80['documentVersion']),_0x5b2d30=[];for(const _0x1ba502 of _0x167eb5){const _0x20afeb=_0x1ba502['operationsIsolated']['map'](_0x31afbf=>this['_translateOperationToEditorContent'](_0x31afbf,_0x3e8206,_0x428cd9));if(!_0x20afeb||!_0x20afeb['length'])continue;const _0x36b270=_0x20afeb['every'](_0x48faed=>'marker'===_0x48faed['type']&&_0x48faed['name']['startsWith']('$markedRemove')),_0x59dca7={'document':_0x258d8b['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1},_0x478f75=_0x261504(_0x20afeb,_0x20fa1d,_0x59dca7)['operationsA'];for(const _0x5319e4 of _0x478f75)if('insert'===_0x5319e4['type']){const _0x5d8bfe=_0x5319e4,_0x30a5e0=_0x5d8bfe['nodes'];_0x258d8b['model']['change'](_0x67de56=>{const _0x3c4676=_0x67de56['createDocumentFragment']();for(const _0x353141 of _0x30a5e0)_0x67de56['append'](_0x353141['_clone'](!0x0),_0x3c4676);_0x5b2d30['push']({'start':_0x5d8bfe['position'],'end':_0x5d8bfe['position'],'type':'insert','groupId':_0x1ba502['id'],'content':{'asString':this['_createGetContentFn'](_0x3c4676,_0x258d8b['data'])(),'asFragment':_0x3c4676}});});}else{if('marker'===_0x5319e4['type']&&_0x5319e4['name']['startsWith']('$markedRemove')){const _0x126633=_0x5319e4;let _0x45f76c='remove-text';if(_0x36b270){const _0x48bfde=this['_findAdjacentContextDistance'](_0x126633['newRange']['start'],'backward',_0x258d8b['model']['schema']),_0x167616=this['_findAdjacentContextDistance'](_0x126633['newRange']['end'],'forward',_0x258d8b['model']['schema']);if(_0x48bfde||_0x167616){const _0x3a8182=_0x126633['newRange']['start']['getShiftedBy'](-_0x48bfde),_0x163e49=_0x126633['newRange']['end']['getShiftedBy'](_0x167616);_0x5b2d30['push']({'start':_0x3a8182,'end':_0x163e49,'groupId':_0x1ba502['id'],'type':'remove-context'});}else _0x45f76c='remove-only';}_0x5b2d30['push']({'start':_0x126633['newRange']['start'],'end':_0x126633['newRange']['end'],'groupId':_0x1ba502['id'],'type':_0x45f76c});}}}this['_insertMarkers'](_0x5b2d30,_0x258d8b);}['clearAllMarkers'](){const _0x4b5219=new Map();for(const _0x32a818 of this['_markers']['keys']()){const _0x285540=this['_markers']['get'](_0x32a818);_0x285540?.['editor']&&(_0x4b5219['has'](_0x285540['editor'])||_0x4b5219['set'](_0x285540['editor'],[]),_0x4b5219['get'](_0x285540['editor'])['push'](_0x32a818));}for(const [_0x49e9e7,_0x1f91f4]of _0x4b5219)_0x49e9e7['model']['change'](_0x2d2f38=>{for(const _0x5c06f3 of _0x1f91f4)_0x49e9e7['model']['markers']['get'](_0x5c06f3)&&_0x2d2f38['removeMarker'](_0x5c06f3);});this['_markers']['clear'](),this['_activeMarkers']['clear']();}['switchToReadOnly'](){for(const _0x4d4310 of Ws(this['context']))_0x4d4310['enableReadOnlyMode']('ai-review');}['switchToEdit'](){for(const _0x280550 of Ws(this['context']))_0x280550['disableReadOnlyMode']('ai-review');}['applyChange'](_0x2b4d2f){const _0x3f9d1d=_0x2b4d2f['map'](_0x186571=>this['_getMarkersDataForGroup'](_0x186571))['flat'](),_0x79dfc2=new Map();for(const _0x5d7305 of _0x3f9d1d)_0x79dfc2['has'](_0x5d7305['editor'])||_0x79dfc2['set'](_0x5d7305['editor'],[]),_0x79dfc2['get'](_0x5d7305['editor'])['push'](_0x5d7305);for(const [_0x2da193,_0xa109d3]of _0x79dfc2){const _0x31877c=_0x2da193['model'];_0x31877c['change'](_0x1e0759=>{for(const _0x537720 of _0xa109d3){const _0x4c604b=_0x2da193['model']['markers']['get'](_0x537720['id']);if(_0x4c604b){if('insert'===_0x537720['type']){if(!_0x537720['content'])continue;_0x31877c['insertContent'](_0x537720['content']['asFragment']||null,_0x4c604b['getRange']()['start']);}else'remove-text'!==_0x537720['type']&&'remove-only'!==_0x537720['type']||_0x31877c['deleteContent'](_0x31877c['createSelection'](_0x4c604b['getRange']()));_0x1e0759['removeMarker'](_0x537720['id']),this['_markers']['delete'](_0x537720['id']);}}});}}['rejectChange'](_0x5f44bb){const _0x475a41=this['_getMarkersDataForGroup'](_0x5f44bb),_0x743462=new Map();for(const _0x471f31 of _0x475a41)_0x743462['has'](_0x471f31['editor'])||_0x743462['set'](_0x471f31['editor'],[]),_0x743462['get'](_0x471f31['editor'])['push'](_0x471f31);for(const [_0x1ee0ff,_0x5e4577]of _0x743462)_0x1ee0ff['model']['change'](_0x42437e=>{for(const _0x107469 of _0x5e4577)_0x42437e['removeMarker'](_0x107469['id']),this['_markers']['delete'](_0x107469['id']);});}['getEditor'](){return $s(this['context']);}['getEditors'](){return Ws(this['context']);}['getEditorForChange'](_0x5df28f){const _0x36a175=this['_getMarkersDataForGroup'](_0x5df28f);return _0x36a175[0x0]?.['editor'];}['getMarkerElementForChange'](_0x3a6545){const _0x4b2fa9=Array['from'](this['_markers']['values']())['filter'](_0x46efc6=>_0x46efc6['groupId']===_0x3a6545);if(!_0x4b2fa9['length'])return null;const _0x3044d4=0x1===_0x4b2fa9['length']?_0x4b2fa9[0x0]:this['_sortMarkers'](_0x4b2fa9)[0x0],_0x5503b2=_0x3044d4['editor']['model']['markers']['get'](_0x3044d4['id']);if(!_0x5503b2)return null;return{'modelRange':_0x5503b2['getRange'](),'getElement':()=>this['_findMarkerElementById'](_0x3044d4['id'])};}['getContentElementForChange'](_0x48338a){const _0x2bc922=Array['from'](this['_markers']['values']())['filter'](_0x347061=>_0x347061['groupId']===_0x48338a);if(!_0x2bc922['length'])return null;const _0x27461b=0x1===_0x2bc922['length']?_0x2bc922[0x0]:this['_sortMarkers'](_0x2bc922)[0x0],_0xcc645e=_0x27461b['editor'],_0x45fef8=_0xcc645e['model']['markers']['get'](_0x27461b['id']);if(!_0x45fef8)return null;const _0x3d4f15=_0x45fef8['getRange'](),_0x8b06a4=_0xcc645e['editing']['view']['getDomRoot'](_0x3d4f15['root']['rootName'])||_0xcc645e['editing']['view']['getDomRoot']();if(!_0x8b06a4||!_0x3d4f15)return null;let _0x345b89=_0x3d4f15['start']['parent'];for(;_0x345b89['parent']&&'$root'!==_0x345b89['parent']['name'];)_0x345b89=_0x345b89['parent'];if(!_0x345b89||!_0x345b89['name'])return null;const _0x4ce9ca=_0x8b06a4['querySelector']('[data-marker-id=\x22'+_0x27461b['id']+'\x22]');if(!_0x4ce9ca)return null;let _0x597588=null;_0xcc645e['model']['change'](_0x532668=>{_0x597588=_0x532668['createDocumentFragment'](),_0x532668['append'](_0x345b89['_clone'](!0x0),_0x597588);});const _0x5da39a=_0xcc645e['data']['toView'](_0x597588)['getChild'](0x0);return _0x4ce9ca['closest'](_0x5da39a['name']);}['reactivateMarkers'](_0x1c4b10){const _0x4bcd19=this['_getMarkersDataForGroup'](_0x1c4b10);if(!_0x4bcd19['length'])return;const _0x56a6be=Array['from'](this['_activeMarkers'])['sort'](),_0x3c73a1=Array['from'](new Set(_0x4bcd19['map'](_0x24bdf2=>_0x24bdf2['id'])))['sort']();_0x56a6be['join']('|')!==_0x3c73a1['join']('|')&&(this['setAllMarkersAsInactive'](),this['setMarkersInElementAsActive'](_0x1c4b10));}['setMarkersInElementAsActive'](_0x34f309){const _0x1d9c05=this['_getMarkersDataForGroup'](_0x34f309);if(!_0x1d9c05['length'])return;const _0x109cc4=_0x1d9c05[0x0]['editor'],_0x2d7400=new Set(_0x1d9c05['map'](_0x24ac07=>_0x24ac07['id'])),_0x15bcf2=Array['from'](_0x2d7400['values']())['map'](_0x23672f=>_0x109cc4['model']['markers']['get'](_0x23672f))['filter'](_0xcff7f4=>!!_0xcff7f4);_0x2d7400['forEach'](_0xcb7b0c=>{this['_activeMarkers']['add'](_0xcb7b0c);}),_0x109cc4['model']['change'](()=>{_0x15bcf2['forEach'](_0x3a913d=>{_0x109cc4['editing']['reconvertMarker'](_0x3a913d);});});}['setAllMarkersAsInactive'](){const _0x22489d=Array['from'](this['_activeMarkers']);if(!_0x22489d['length'])return;this['_activeMarkers']['clear']();const _0xdfaeb3=new Map();for(const _0x96d26f of _0x22489d){const _0x4ed5e9=this['_markers']['get'](_0x96d26f);if(!_0x4ed5e9)continue;const _0x55095f=_0x4ed5e9['editor'],_0x415034=_0x55095f['model']['markers']['get'](_0x96d26f);_0x415034&&(_0xdfaeb3['has'](_0x55095f)||_0xdfaeb3['set'](_0x55095f,[]),_0xdfaeb3['get'](_0x55095f)['push'](_0x415034));}for(const [_0x227c6f,_0x585371]of _0xdfaeb3)_0x227c6f['model']['change'](()=>{_0x585371['forEach'](_0x2359b4=>{_0x227c6f['editing']['reconvertMarker'](_0x2359b4);});});}['_getPositionLimitingRange'](_0x382266,_0x4aef4e,_0x574a0c='outside'){if(!_0x382266)return null;let _0x1939d8=_0x382266['parent'];for(;_0x1939d8&&_0x1939d8['parent']&&'$root'!==_0x1939d8['parent']['name']&&!_0x4aef4e['model']['schema']['isLimit'](_0x1939d8)&&!_0x4aef4e['model']['schema']['isBlock'](_0x1939d8);)_0x1939d8=_0x1939d8['parent'];if(!_0x1939d8||!_0x1939d8['name']||'$root'===_0x1939d8['name'])return null;let _0x38a1df=null;return _0x4aef4e['model']['change'](_0x109ef7=>{_0x38a1df='inside'===_0x574a0c?_0x109ef7['createRangeIn'](_0x1939d8):_0x109ef7['createRangeOn'](_0x1939d8);}),_0x38a1df;}['_validateMarkers'](_0x26df95,_0x3b5d3f){const _0x48b700=Array['from'](this['_markers']['keys']()),_0x39ebfd=new Map();for(const _0x49a92b of _0x48b700){const _0x188483=_0x26df95['model']['markers']['get'](_0x49a92b);if(!_0x188483)continue;const _0x13bc1f=_0x188483['getStart']()['root']['rootName']+':'+_0x188483['getStart']()['path'][0x0];_0x39ebfd['has'](_0x13bc1f)||_0x39ebfd['set'](_0x13bc1f,[]),_0x39ebfd['get'](_0x13bc1f)['push'](_0x188483);}const _0x2af182=new Set();for(const _0x9ea4a3 of _0x26df95['model']['document']['differ']['getChanges']()){let _0x3b387c='',_0x76f8c7=null;if('insert'===_0x9ea4a3['type'])_0x76f8c7=new _0x5ca4e8(_0x9ea4a3['position'],_0x9ea4a3['position']['getShiftedBy'](_0x9ea4a3['length'])),_0x3b387c=_0x9ea4a3['position']['root']['rootName']+':'+_0x9ea4a3['position']['path'][0x0];else{if('remove'!==_0x9ea4a3['type'])continue;_0x76f8c7=new _0x5ca4e8(_0x9ea4a3['position']),_0x3b387c=_0x9ea4a3['position']['root']['rootName']+':'+_0x9ea4a3['position']['path'][0x0];}const _0x516ae1=_0x39ebfd['get'](_0x3b387c)||[];if(_0x516ae1['length']){for(const _0x4b4c15 of _0x516ae1)if(_0x76f8c7['root']['rootName']===_0x4b4c15['getRange']()['root']['rootName']&&('insert'!==_0x9ea4a3['type']||!_0x76f8c7['containsRange'](_0x4b4c15['getRange']()))&&(_0x76f8c7['isIntersecting'](_0x4b4c15['getRange']())||_0x76f8c7['start']['isTouching'](_0x4b4c15['getRange']()['end'])||_0x76f8c7['end']['isTouching'](_0x4b4c15['getRange']()['start']))){const _0x172ad6=this['_parseMarkerName'](_0x4b4c15['name']);Array['from'](this['_markers']['values']())['filter'](_0x4e0735=>_0x4e0735['groupId']===_0x172ad6['groupId'])['forEach'](_0x2a8cf8=>_0x2af182['add'](_0x2a8cf8['id']));}}}if(_0x2af182['size']){for(const _0x4e030f of _0x2af182)_0x3b5d3f['removeMarker'](_0x4e030f);return!0x0;}return!0x1;}['_handleMarkerChanges'](_0x4f0cf6){for(const {name:_0x598a01,data:_0x29d735}of _0x4f0cf6['model']['document']['differ']['getChangedMarkers']()){if(!_0x598a01['startsWith'](Ta))continue;const _0x22cf2c=_0x29d735['oldRange'],_0x19c3ff=_0x29d735['newRange'],_0x52140f=_0x22cf2c&&'$graveyard'===_0x22cf2c['root']['rootName'],_0x253edc=_0x19c3ff&&'$graveyard'===_0x19c3ff['root']['rootName'];if(_0x52140f&&_0x253edc)continue;const _0x4a37ec=this['_parseMarkerName'](_0x598a01);this['_markers']['get'](_0x598a01)&&(_0x253edc||!_0x19c3ff?this['_eventEmitter']['fire']('changeMarkerRemoved',{'markerId':_0x598a01,'changeId':_0x4a37ec['groupId']}):_0x52140f&&_0x19c3ff&&this['_eventEmitter']['fire']('changeMarkerRestored',{'markerId':_0x598a01,'changeId':_0x4a37ec['groupId']}));}}['_parseMarkerName'](_0x2fc20b){const _0x1bfac6=_0x2fc20b['split'](':'),_0x2340ce=(_0x1bfac6[0x1]||'')['split']('_');return{'prefix':_0x1bfac6[0x0],'groupId':_0x2340ce[0x0],'suffix':_0x2340ce[0x1]};}['_translateOperationToEditorContent'](_0x172ccd,_0x35de4d,_0x2a8f94){if('insert'===_0x172ccd['type']){const _0x57dbcf=_0x172ccd;return new _0x2038eb(this['_changePosition'](_0x35de4d['concat'](_0x57dbcf['position']['offset']),_0x2a8f94),_0x57dbcf['nodes'],_0x57dbcf['baseVersion']);}if('marker'===_0x172ccd['type']&&_0x172ccd['name']['startsWith']('$markedRemove')){const _0x5b64f6=_0x172ccd;return new _0x437745(_0x5b64f6['name'],_0x5b64f6['oldRange'],this['_changeRange'](_0x5b64f6['newRange'],_0x35de4d['concat'](_0x5b64f6['newRange']['start']['offset']),_0x35de4d['concat'](_0x5b64f6['newRange']['end']['offset']),_0x2a8f94),_0x5b64f6['_markers'],_0x5b64f6['affectsData'],_0x5b64f6['baseVersion']);}return _0x172ccd;}['_groupAdjacentOperations'](_0x45ccac){if(!_0x45ccac['length'])return[];const _0x1bc777=[];let _0xb7393a=0x0,_0x2d423d=0x0,_0x4bb99=[];for(let _0x3f6706=0x0;_0x3f6706<=_0x45ccac['length'];_0x3f6706++){const _0x5b7f7a=_0x45ccac[_0x3f6706],_0x21e0f8=_0x45ccac[_0x3f6706-0x1];!_0x5b7f7a||_0x21e0f8&&!this['_getOperationEnd'](_0x21e0f8)['isTouching'](this['_getOperationStart'](_0x5b7f7a))?(_0x1bc777['push']({'operations':_0x4bb99,'operationsIsolated':_0x4bb99['map'](_0x2f7ab7=>this['_shiftOperation'](_0x2f7ab7['clone'](),-_0x2d423d)),'groupOffset':_0xb7393a}),_0x4bb99=_0x5b7f7a?[_0x5b7f7a]:[],_0x2d423d+=_0xb7393a,_0xb7393a=0x0):_0x4bb99['push'](_0x5b7f7a),_0x5b7f7a&&'insert'===_0x5b7f7a['type']&&(_0xb7393a+=_0x5b7f7a['howMany']);}return _0x1bc777;}['_findAdjacentContextDistance'](_0xcb7dba,_0x5f8cec,_0x510a2f,_0x4b61ff=0x1){const _0x566237=new _0x342db9({'startPosition':_0xcb7dba,'direction':_0x5f8cec});let _0x2edefc=0x0;for(let _0x49491e=0x0;_0x49491e<_0x4b61ff;_0x49491e++){let _0x446544=0x0,_0x977ea1=!0x1,_0x5b17de='forward'===_0x5f8cec?/^\W*\w+/:/\w+\W*$/;for(const {item:_0x186adf}of _0x566237)if(_0x186adf['is']('$textProxy')){const _0x52e2d1=_0x5b17de['exec'](_0x186adf['data']);if(_0x52e2d1&&_0x52e2d1['length']){if(_0x446544+='forward'===_0x5f8cec?_0x52e2d1['index']+_0x52e2d1[0x0]['length']:_0x186adf['data']['length']-_0x52e2d1['index'],_0x52e2d1[0x0]['length']!==_0x186adf['data']['length'])break;_0x977ea1=!0x0,_0x5b17de='forward'===_0x5f8cec?/^\w+/:/\w+$/;}else{if(_0x977ea1)break;_0x446544+=_0x186adf['offsetSize'];}}else{if(_0x186adf['is']('element')){_0x510a2f['isInline'](_0x186adf)&&!_0x977ea1&&(_0x446544+=0x1);break;}}_0x2edefc+=_0x446544,_0x566237['jumpTo'](_0xcb7dba['getShiftedBy']('forward'===_0x5f8cec?_0x2edefc:-_0x2edefc));}return _0x2edefc;}['_getChangeContext'](_0x2aaa8e,_0x37cadc,_0x44e954){const _0x52c06b=_0x44e954['model']['schema'],_0x29860e=this['_findAdjacentContextDistance'](_0x2aaa8e,'backward',_0x52c06b,0x6),_0x2d134d=this['_findAdjacentContextDistance'](_0x37cadc,'forward',_0x52c06b,0x6),_0x4d9396=_0x2aaa8e['getShiftedBy'](-_0x29860e),_0xd15733=_0x37cadc['getShiftedBy'](_0x2d134d);return{'start':_0x4d9396,'end':_0xd15733,'hasContentBefore':!_0x4d9396['isAtStart'],'hasContentAfter':!_0xd15733['isAtEnd']};}['_insertMarkers'](_0xd45c7a,_0x20754c){const _0x331c8c=this['context']['plugins']['get']('AIEditing'),_0x5af6fb=new Set();_0x20754c['model']['change'](_0x4713c3=>{for(const _0xd5bea8 of _0xd45c7a){const _0x250995=''+Ta+_0xd5bea8['type']+':'+_0xd5bea8['groupId']+'_'+_0x331c8c['_nextDataId'](_0x5af6fb);this['_markers']['set'](_0x250995,{'id':_0x250995,'groupId':_0xd5bea8['groupId'],'type':_0xd5bea8['type'],'content':_0xd5bea8['content'],'editor':_0x20754c}),_0x4713c3['addMarker'](_0x250995,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x4713c3['createRange'](_0xd5bea8['start'],_0xd5bea8['end'])});}});}['_createGetContextFn'](_0x1c3cc1,_0x9fbcc9,_0x45e1e8){let _0x2742d5='';return()=>{if(!_0x2742d5){const _0x502b69=_0x9fbcc9['toView'](_0x1c3cc1,{'showSuggestionHighlights':!0x0});let _0x354cb3=_0x502b69['getChild'](0x0);if(_0x354cb3['is']('containerElement')||(_0x354cb3=_0x502b69),!_0x354cb3)return'';let _0x496fcf=!0x1;const _0x204d03=[];for(const _0x66ac18 of _0x354cb3['getChildren']())_0x66ac18['is']('element','span')&&_0x66ac18['hasClass']('ck-ai_review-marker_context-end')&&(_0x496fcf=!0x1),_0x496fcf&&_0x204d03['push'](_0x66ac18),_0x66ac18['is']('element','span')&&_0x66ac18['hasClass']('ck-ai_review-marker_context-start')&&(_0x496fcf=!0x0);_0x354cb3['_removeChildren'](0x0,_0x354cb3['childCount']),_0x45e1e8?.['ellipsisBefore']&&_0x354cb3['_appendChild']('…'),_0x354cb3['_appendChild'](_0x204d03),_0x45e1e8?.['ellipsisAfter']&&_0x354cb3['_appendChild']('…');const _0x3b58c9=_0x9fbcc9['htmlProcessor']['domConverter']['viewToDom'](_0x502b69),_0x530c80=_0x9fbcc9['htmlProcessor']['htmlWriter']['getHtml'](_0x3b58c9);_0x2742d5=_0x530c80;}return _0x2742d5;};}['_createGetContentFn'](_0x5dfce8,_0x22b0c2){let _0x375318='';return()=>(_0x375318||(_0x375318=_0x22b0c2['stringify'](_0x5dfce8,{'showSuggestionHighlights':!0x0})),_0x375318);}['_createGetContentUsingDataIdFn'](_0x1b1866,_0x2915fd,_0x3665b1){let _0x431be6='';return()=>{if(!_0x431be6){const _0x5b3a8e=_0x3665b1['toView'](new _0x569183(_0x1b1866)),_0x55268c=_0x3665b1['htmlProcessor']['domConverter']['viewToDom'](_0x5b3a8e)['querySelector']('[data-id=\x22'+_0x2915fd+'\x22]');_0x431be6=_0x55268c?.['outerHTML']||'';}return _0x431be6;};}['_findMarkerElement'](_0x180ee1,_0x645bd6=0x5){let _0x2f74ed=_0x180ee1,_0x183542=null;for(let _0x2869ad=0x0;_0x2869ad<_0x645bd6&&_0x2f74ed;_0x2869ad++){if(!_0x2f74ed['className']){_0x2f74ed=_0x2f74ed['parentElement'];continue;}if(!(''+_0x2f74ed['className'])['includes']('ck-ai_review-marker_')){_0x2f74ed=_0x2f74ed['parentElement'];continue;}if(!_0x2f74ed['getAttribute']('data-marker-id'))break;_0x183542=_0x2f74ed;break;}return _0x183542;}['_findMarkerElementById'](_0x1a8c61){const _0x447e3b=this['_markers']['get'](_0x1a8c61),_0xf539fe=_0x447e3b?.['editor']??$s(this['context']),_0x1a9e2a=_0xf539fe['model']['markers']['get'](_0x1a8c61);return _0x1a9e2a?_0x3ebf06(_0xf539fe['editing'],_0x1a9e2a):null;}['_getMarkersDataForGroup'](_0x3a4a58){return Array['from'](this['_markers']['values']())['filter'](_0x3c2edd=>_0x3c2edd['groupId']===_0x3a4a58);}['_getOperationStart'](_0x446a33){return'insert'===_0x446a33['type']?_0x446a33['position']:_0x446a33['newRange']['start'];}['_getOperationEnd'](_0x1ad400,_0xedae62=!0x1){return'insert'===_0x1ad400['type']?_0xedae62?_0x1ad400['position']:_0x1ad400['position']['getShiftedBy'](_0x1ad400['howMany']):_0x1ad400['newRange']['end'];}['_shiftOperation'](_0x5f960a,_0x56745f){return'insert'===_0x5f960a['type']?_0x5f960a['position']=_0x5f960a['position']['getShiftedBy'](_0x56745f):'marker'===_0x5f960a['type']&&_0x5f960a['newRange']&&(_0x5f960a['newRange']=new _0x5ca4e8(_0x5f960a['newRange']['start']['getShiftedBy'](_0x56745f),_0x5f960a['newRange']['end']['getShiftedBy'](_0x56745f))),_0x5f960a;}['_changeOperationOwnerDocument'](_0x17b5c7,_0x2b21ea){'insert'===_0x17b5c7['type']?_0x17b5c7['position']=this['_changePositionOwnerDocument'](_0x17b5c7['position'],_0x2b21ea):'marker'===_0x17b5c7['type']&&_0x17b5c7['newRange']&&(_0x17b5c7['newRange']=this['_changeRangeOwnerDocument'](_0x17b5c7['newRange'],_0x2b21ea));}['_changePositionOwnerDocument'](_0x386211,_0x37f095){return new _0x1e668d(_0x37f095,_0x386211['path']);}['_changeRangeOwnerDocument'](_0x142ceb,_0x2175a1){return new _0x5ca4e8(this['_changePositionOwnerDocument'](_0x142ceb['start'],_0x2175a1),this['_changePositionOwnerDocument'](_0x142ceb['end'],_0x2175a1));}['_changePosition'](_0xda2462,_0x4f5340){return new _0x1e668d(_0x4f5340,[..._0xda2462]);}['_changeRange'](_0x22f353,_0x32a0bd,_0x21ffae,_0x10e7ee){return new _0x5ca4e8(this['_changePosition'](_0x32a0bd,_0x10e7ee),this['_changePosition'](_0x21ffae,_0x10e7ee));}['_sortMarkers'](_0x276091){const _0x3dc0db=_0x3db062=>{switch(_0x3db062){case'insert':return 0x0;case'remove-context':return 0x1;case'remove-only':return 0x2;case'remove-text':return 0x3;}};return _0x276091['sort']((_0x350f86,_0x377633)=>_0x3dc0db(_0x350f86['type'])-_0x3dc0db(_0x377633['type']));}['_hasSameTopLevelElement'](_0x1c40a8,_0x4857b3){const _0x4f964f=_0x1c40a8['getChild'](0x0),_0x30c5d7=_0x4857b3['getChild'](0x0);return!(!_0x4f964f||!_0x30c5d7)&&((!_0x4f964f['is']('element')||!_0x30c5d7['is']('element')||_0x4f964f['name']===_0x30c5d7['name'])&&!(_0x4f964f['is']('element')&&!_0x30c5d7['is']('element')||!_0x4f964f['is']('element')&&_0x30c5d7['is']('element')));}['_haveSingleTopLevelElement'](_0x4c1f0b){return 0x1===_0x4c1f0b['childCount'];}['_haveOnlyInlineContent'](_0x4c260a,_0x40418d){for(const _0x4213e0 of _0x4c260a['getChildren']())if(_0x4213e0['is']('element')&&!_0x40418d['isInline'](_0x4213e0))return!0x1;return!0x0;}['_upsertDataId'](_0x1bcb09,_0x4db8b0){let _0x297a6e=_0x1bcb09['getAttribute'](_0x138817);return _0x297a6e||(_0x297a6e=_0x4db8b0(),_0x1bcb09['_setAttribute'](_0x138817,_0x297a6e)),_0x297a6e;}}class fa extends Tt(){['id'];['contentNew'];['contentInitial'];['documentVersion'];constructor({id:_0x1f1e04,contentNew:_0x4be86f,contentInitial:_0x3a1fc9,documentVersion:_0x2b190b}){super(),this['id']=_0x1f1e04,this['contentNew']=_0x4be86f,this['contentInitial']=_0x3a1fc9,this['documentVersion']=_0x2b190b;}}class ba extends ht(){['id'];['parent'];['_data'];['_editorOperations']=[];constructor(_0x2e1390,_0x4cc31b,_0x27d075){super(),this['id']=_0x2e1390,this['parent']=_0x27d075,this['_data']=_0x4cc31b,this['set']('isActivated',!0x1),this['set']('isRated',!0x1),this['set']('status','pending'),this['on']('change:status',()=>{'pending'!==this['status']&&this['isActivated']&&(this['isActivated']=!0x1);});}get['contentDiffed'](){return this['_data']['context']();}get['operations'](){return this['_data']['operations'];}get['operationsIsolated'](){return this['_data']['operationsIsolated'];}}class Sa extends ht(){['id']=ot();['callId'];['_results']=new Map();['_changes']=[];['_sourceCheck'];['_documentData'];['_aiConnector'];['_reviewParams'];['_reviewArgs'];['_activeRequest']=null;['_currentError'];['_wasAborted']=!0x1;constructor(_0x52efa8,_0x146c73,_0x1ed47d,_0x621034,_0x4265d3){super(),this['_sourceCheck']=_0x146c73,this['_documentData']=_0x52efa8,this['_aiConnector']=_0x1ed47d,this['_reviewParams']=_0x621034,this['_reviewArgs']=_0x4265d3,this['on']('change:status',(_0x353a3a,_0x266542,_0x65b58c)=>{'aborted'==_0x65b58c&&(this['_wasAborted']=!0x0),this['fire']('reviewCheckRunUpdated',{'status':_0x65b58c,'run':this,'error':this['_currentError']});}),this['set']('status','initialized');}get['documentData'](){return this['_documentData'];}get['processedResultsCount'](){return this['_results']['size'];}get['title'](){return this['_sourceCheck']['title'];}get['subTitle'](){return'';}get['reviewName'](){return this['_sourceCheck']['id'];}get['hasModifications'](){return!this['_changes']['every'](_0x1023fb=>'pending'===_0x1023fb['status']);}get['currentError'](){return this['_currentError'];}['updateDocumentData'](_0x11b859){this['_documentData']=_0x11b859;}async['start'](){this['status']='loading',this['_currentError']=void 0x0;try{this['_activeRequest']=this['_createApiRequest']();const _0x5c99ce=await this['_activeRequest']['getStream']();this['status']='data';for await(const _0x22d4ea of _0x5c99ce)'unmodified'!==_0x22d4ea['data']['operation']&&('error'!==_0x22d4ea['data']['operation']?'review-metadata'!==_0x22d4ea['event']?this['_addReviewCheckResult'](_0x22d4ea['data']['dataId'],_0x22d4ea['data']['textDelta']):this['callId']=_0x22d4ea['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(_0x621754){this['_currentError']=_0x621754,_0x621754 instanceof Error&&_0x621754['message']['includes']('ai-request-aborted')?this['status']='aborted':this['status']='error-general';}finally{this['_activeRequest']=null;}}async['restart'](){this['_results']['clear'](),this['_changes']['length']=0x0,this['_currentError']=void 0x0,await this['start']();}['addResultChanges'](_0x1adb6c,_0x2ee7c4){const _0x22981c=this['_results']['get'](_0x1adb6c);if(!_0x22981c)return;if(0x0===_0x2ee7c4['length'])return;const _0x5d0b8f=[];_0x2ee7c4['forEach']((_0x359fe6,_0x32e088)=>{const _0x15b2c8=new ba(_0x22981c['id']+'-'+_0x32e088,_0x359fe6,_0x22981c);_0x15b2c8['on']('change:status',()=>{this['fire']('reviewCheckResultChangeStatusUpdated',{'change':_0x15b2c8,'status':_0x15b2c8['status']});}),_0x15b2c8['on']('change:isActivated',()=>{_0x15b2c8['isActivated']?this['fire']('reviewCheckResultActivated',{'change':_0x15b2c8}):this['fire']('reviewCheckResultDeactivated',{'change':_0x15b2c8});}),this['_changes']['push'](_0x15b2c8),_0x5d0b8f['push'](_0x15b2c8);}),this['fire']('reviewCheckResultReady',{'changes':_0x5d0b8f,'result':_0x22981c,'source':this});}['abort'](){this['_activeRequest']&&(this['_activeRequest']['abortController']['abort'](),this['_activeRequest']=null,this['status']='aborted');}['isChangeActive'](_0x5aa21d){const _0x1a7704=this['_changes']['find'](_0xd2e700=>_0xd2e700['id']===_0x5aa21d);return!(!_0x1a7704||'pending'!==_0x1a7704['status']);}['isAnyChangeActivated'](){return this['_changes']['some'](_0xd33fee=>!0x0===_0xd33fee['isActivated']);}['getActiveChanges'](){return this['_changes']['filter'](_0x1f0538=>'pending'===_0x1f0538['status']);}['getChangeById'](_0x879876){return this['_changes']['find'](_0x280abb=>_0x280abb['id']===_0x879876);}['markAllChangesAsAccepted'](){for(const _0x5effd2 of this['_changes'])'pending'===_0x5effd2['status']&&(_0x5effd2['status']='accepted');this['_checkIfFinished']();}['markChangeAsAccepted'](_0x49eba5){const _0xc3fb1=this['_changes']['find'](_0x1b6fd1=>_0x1b6fd1['id']===_0x49eba5);_0xc3fb1&&'pending'===_0xc3fb1['status']&&(_0xc3fb1['status']='accepted'),this['_checkIfFinished']();}['markChangeAsRejected'](_0x4abaee){const _0x5afca6=this['_changes']['find'](_0x32ddc4=>_0x32ddc4['id']===_0x4abaee);_0x5afca6&&'pending'===_0x5afca6['status']&&(_0x5afca6['status']='rejected'),this['_checkIfFinished']();}['markChangeAsOutdated'](_0x49b973){const _0x5f473e=this['_changes']['find'](_0x5b35a0=>_0x5b35a0['id']===_0x49b973);_0x5f473e&&'pending'===_0x5f473e['status']&&(_0x5f473e['status']='outdated'),this['_checkIfFinished']();}['markChangeAsPending'](_0x22b42c){const _0x55399c=this['_changes']['find'](_0x5184e4=>_0x5184e4['id']===_0x22b42c);_0x55399c&&'outdated'===_0x55399c['status']&&(_0x55399c['status']='pending'),this['_checkIfFinished']();}['activateChange'](_0x281b76){this['_changes']['filter'](_0x45c52a=>_0x45c52a['isActivated']&&_0x45c52a['id']!==_0x281b76)['forEach'](_0xf1f49d=>{_0xf1f49d['isActivated']=!0x1;});const _0x1e654d=this['_changes']['find'](_0x2e0d09=>_0x2e0d09['id']===_0x281b76);_0x1e654d&&'pending'===_0x1e654d['status']&&(_0x1e654d['isActivated']=!0x0);}['deactivateChange'](){this['_changes']['filter'](_0x380d8a=>_0x380d8a['isActivated'])['forEach'](_0x15065d=>{_0x15065d['isActivated']=!0x1;});}['forceReadyState'](){this['status']='ready';}async['sendRating'](_0x71faa5){if('initialized'===this['status']||'loading'===this['status']||'data'===this['status']||this['_wasAborted'])return;if(!this['callId']||0x0===this['_changes']['length'])return;let _0x3e30e2;if(_0x71faa5){const _0x29345d=this['_changes']['find'](_0x168448=>_0x168448['id']===_0x71faa5);if(_0x29345d&&_0x29345d['isRated'])return;_0x29345d&&(_0x3e30e2=_0x29345d['parent']['id'],_0x29345d['isRated']=!0x0);}const _0x49c8a3={'positiveCount':this['_changes']['filter'](_0xe209a5=>'accepted'===_0xe209a5['status'])['length'],'totalCount':this['_changes']['length']};this['_sendRatingRequest'](_0x49c8a3,this['callId'],_0x3e30e2);}['_addReviewCheckResult'](_0x588b31,_0x530e06){const _0x51baf7=this['_documentData']['elements']['get'](_0x588b31);if(!_0x51baf7)return;const _0x5a4dc7=_0x51baf7['getContent']();if(_0x5a4dc7===_0x530e06)return;const _0x15e1d9=new fa({'id':_0x588b31,'contentInitial':_0x5a4dc7,'contentNew':_0x530e06,'documentVersion':_0x51baf7['documentVersion']});this['_results']['set'](_0x15e1d9['id'],_0x15e1d9),this['fire']('reviewCheckResultAdded',{'result':_0x15e1d9,'source':this,'editor':_0x51baf7['editor']});}['_checkIfFinished'](){'finished'===this['status']&&(this['_changes']['filter'](_0x10a3b3=>'pending'===_0x10a3b3['status'])['length']>0x0&&(this['status']='ready')),'ready'===this['status']&&(0x0===this['_changes']['filter'](_0x1845c0=>'pending'===_0x1845c0['status'])['length']&&(this['status']='finished'));}}class Ra extends Sa{get['subTitle'](){if(!this['_reviewParams']||0x0===this['_reviewParams']['length'])return'';const _0x2f25f6=[];if(this['_reviewParams']['length']>0x0&&this['_sourceCheck']['options'])for(let _0x33c40a=0x0;_0x33c40a<this['_reviewParams']['length'];_0x33c40a++){if(!this['_reviewParams'][_0x33c40a]||!this['_sourceCheck']['options'][_0x33c40a])continue;const _0x41adf9=this['_sourceCheck']['options'][_0x33c40a],_0x1046dc=_0x41adf9['data']?.['find'](_0x5f4ade=>_0x5f4ade['id']===this['_reviewParams'][_0x33c40a]);_0x1046dc&&_0x2f25f6['push'](_0x1046dc['label']);}return _0x2f25f6['join'](',\x20');}get['reviewName'](){return this['_composeReviewName']();}['_createApiRequest'](){return this['_aiConnector']['callSystemReview']({'reviewName':this['_composeReviewName'](),'content':this['_documentData']['content'],'args':this['_reviewArgs']});}['_sendRatingRequest'](_0x5c3644,_0x3d9611,_0x2c641b){return this['_aiConnector']['upsertAIReviewRating'](this['reviewName'],_0x3d9611,_0x5c3644,_0x2c641b);}['_composeReviewName'](){return!this['_reviewParams']||0x0===this['_reviewParams']['length']||this['_sourceCheck']['useArgs']?this['_sourceCheck']['apiId']:[this['_sourceCheck']['apiId'],...this['_reviewParams']]['join']('-');}}class Oa extends _0x173dbd{['_aiConnector'];['_aiReviewCoreUi'];['_aiReviewCoreEditing'];['_aiReviewCheckList'];['_currentReviewCheckRun'];['_changeActivationSource']=null;static get['requires'](){return[as];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['init'](){this['_initRequiredPlugins'](),this['_aiReviewCheckList']=await this['_getChecksList'](),this['listenTo'](this['_aiReviewCoreUi'],'getReviewCheckList',()=>{this['_aiReviewCoreUi']['setAvailableChecks'](this['_aiReviewCheckList']['checks']);}),this['listenTo'](this['_aiReviewCoreUi'],'runReviewCheck',async(_0x32f47f,_0x43b78c)=>{const _0x331fbb=this['_aiReviewCheckList']['getCheckById'](_0x43b78c['id']);if(_0x331fbb){this['_onReviewCheckRun'](_0x43b78c),this['_aiReviewCoreEditing']['switchToReadOnly'](),this['_currentReviewCheckRun']=this['_createReviewCheckRun'](_0x43b78c,_0x331fbb),this['_aiReviewCoreUi']['setCheckResultTitle'](this['_currentReviewCheckRun']['title'],this['_currentReviewCheckRun']['subTitle']),this['_currentReviewCheckRun']['on']('reviewCheckRunUpdated',(_0x24e038,_0x298dea)=>{switch(_0x298dea['status']){case'data':case'loading':this['_aiReviewCoreUi']['showCheckRunResults'](_0x298dea);break;case'finished':this['_onCheckRunFinished']();break;case'ready':this['_aiReviewCoreUi']['showActionsWhenResultIsReady']();break;case'unmodified':this['_aiReviewCoreUi']['showNoChangesView']();break;case'error-general':this['_aiReviewCoreUi']['showGeneralResultsErrorView'](),this['_logError'](new at('ai-review-mode-check-run-general-error',this,void 0x0,this['_currentReviewCheckRun']?.['currentError']));break;case'error-chunk':this['_aiReviewCoreUi']['showChunkErrorView'](),this['_logError'](new at('ai-review-mode-check-run-chunk-error',this,void 0x0,this['_currentReviewCheckRun']?.['currentError']));break;case'aborted':this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['processedResultsCount']>0x0?setTimeout(()=>{this['_currentReviewCheckRun']?.['forceReadyState']();},0x0):this['_onReviewRunLeave'](!0x0);}'ready'!==_0x298dea['status']&&'error-chunk'!==_0x298dea['status']&&'error-general'!==_0x298dea['status']||this['_currentReviewCheckRun']?.['sendRating']();}),this['_currentReviewCheckRun']['on']('reviewCheckResultAdded',(_0x18af23,_0x58d771)=>{if(!this['_currentReviewCheckRun'])throw new at('ai-review-mode-no-current-check-run',this);const _0x2e7f06=this['_diffContent'](_0x58d771['editor'],_0x58d771['result']['contentInitial'],_0x58d771['result']['contentNew']);_0x58d771['source']['addResultChanges'](_0x58d771['result']['id'],_0x2e7f06);}),this['_currentReviewCheckRun']['on']('reviewCheckResultReady',(_0x3f1bbe,_0x41fb6e)=>{for(const _0x836317 of _0x41fb6e['changes'])this['_aiReviewCoreUi']['showCheckRunResult'](_0x836317);this['_markChangePositionInEditorContent'](_0x41fb6e['changes'],_0x41fb6e['source']['documentData']);}),this['_currentReviewCheckRun']['on']('reviewCheckResultChangeStatusUpdated',(_0x5c5726,_0x4987b7)=>{this['_aiReviewCoreUi']['updateChangeState'](_0x4987b7['change']['id'],_0x4987b7['status']);}),this['_currentReviewCheckRun']['on']('reviewCheckResultActivated',(_0x305b20,_0xf782a0)=>{this['_onReviewCheckResultActivated'](_0xf782a0);}),this['_currentReviewCheckRun']['on']('reviewCheckResultDeactivated',()=>{this['_onReviewCheckResultDeactivated']();});try{await this['_currentReviewCheckRun']['start']();}catch(_0x5bb5ae){_0x5bb5ae instanceof Error&&_0x5bb5ae['message']['includes']('ai-request-aborted')||(_0x5bb5ae instanceof at?this['_logError'](_0x5bb5ae):this['_logError'](new at('ai-review-mode-check-run-failed',this,void 0x0,_0x5bb5ae)));}}else this['_logError'](new at('ai-review-mode-source-check-not-found',this,{'checkId':_0x43b78c['id']}));}),this['listenTo'](this['_aiReviewCoreUi'],'leaveReview',()=>{this['_onReviewRunLeave']();}),this['listenTo'](this['_aiReviewCoreUi'],'leaveReviewCoreResultList',()=>{this['_onReviewRunLeave'](!0x0);}),this['listenTo'](this['_aiReviewCoreUi'],'abortReviewStream',()=>{this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['abort']();}),this['listenTo'](this['_aiReviewCoreUi'],'finishReview',()=>{this['_onReviewRunLeave'](!0x0);}),this['listenTo'](this['_aiReviewCoreUi'],'acceptAllChanges',()=>{if(!this['_currentReviewCheckRun'])return;const _0x4557f9=this['_currentReviewCheckRun']['getActiveChanges']();if(!_0x4557f9['length'])return;this['_aiReviewCoreEditing']['applyChange'](_0x4557f9['map'](_0x282916=>_0x282916['id']));const _0x32c3b2=this['_currentReviewCheckRun'];_0x32c3b2['markAllChangesAsAccepted'](),_0x32c3b2['sendRating']();}),this['listenTo'](this['_aiReviewCoreUi'],'acceptChange',(_0x3e572f,_0x54ec3e)=>{this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['isChangeActive'](_0x54ec3e['id'])&&(this['_aiReviewCoreEditing']['applyChange']([_0x54ec3e['id']]),this['_currentReviewCheckRun']['markChangeAsAccepted'](_0x54ec3e['id']),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_currentReviewCheckRun']['sendRating'](_0x54ec3e['id']));}),this['listenTo'](this['_aiReviewCoreUi'],'dismissChange',(_0x241f4b,_0x5e82a0)=>{this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['isChangeActive'](_0x5e82a0['id'])&&(this['_aiReviewCoreEditing']['rejectChange'](_0x5e82a0['id']),this['_currentReviewCheckRun']['markChangeAsRejected'](_0x5e82a0['id']),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_currentReviewCheckRun']['sendRating'](_0x5e82a0['id']));}),this['listenTo'](this['_aiReviewCoreUi'],'retryReview',async()=>{this['_currentReviewCheckRun']&&(this['_aiReviewCoreEditing']['clearAllMarkers'](),this['_currentReviewCheckRun']['updateDocumentData'](this['_aiReviewCoreEditing']['getDocumentData']()),await this['_currentReviewCheckRun']['restart']());}),this['listenTo'](this['_aiReviewCoreUi'],'activateChange',(_0x24f97a,_0x29e3f7)=>{this['_onActivateChange'](_0x29e3f7);}),this['listenTo'](this['_aiReviewCoreUi'],'deactivateChange',(_0x3fbc15,_0x2bee07)=>{this['_onDeactivateChange'](_0x2bee07);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerClicked',(_0x316cb1,_0x57003f)=>{this['_onChangeMarkerClicked'](_0x316cb1,_0x57003f);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerHovered',(_0x50d515,_0x2b8ed1)=>{this['_onChangeMarkerHovered'](_0x50d515,_0x2b8ed1);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerBlurred',()=>{this['_onChangeMarkerBlurred']();}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerRemoved',(_0x5df497,_0x4f82a5)=>{this['_onChangeMarkerRemoved'](_0x5df497,_0x4f82a5);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerRestored',(_0x319a98,_0x13de12)=>{this['_onChangeMarkerRestored'](_0x319a98,_0x13de12);});}['_createReviewCheckRun'](_0x10a1c4,_0x4abe0b){return new Ra(this['_aiReviewCoreEditing']['getDocumentData'](),_0x4abe0b,this['_aiConnector'],_0x10a1c4['params'],_0x10a1c4['args']);}['_onChangeMarkerRemoved'](_0x52df55,_0x480c5c){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['markChangeAsOutdated'](_0x480c5c['changeId']);}['_onChangeMarkerRestored'](_0x9e7329,_0x1a1d5e){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['markChangeAsPending'](_0x1a1d5e['changeId']);}['_onCheckRunFinished'](){this['_aiReviewCoreUi']['showReviewCompletedView']();}['_initRequiredPlugins'](){this['_aiConnector']=this['context']['plugins']['get']('AIConnector');}['_onReviewRunLeave'](_0x5b9a16=!0x1){this['_currentReviewCheckRun']&&(this['_currentReviewCheckRun']['hasModifications']||this['_currentReviewCheckRun']['sendRating'](),this['_currentReviewCheckRun']['stopListening'](),this['_currentReviewCheckRun']['abort'](),this['_currentReviewCheckRun']=void 0x0),_0x5b9a16&&this['_aiReviewCoreUi']['showReviewCheckList'](),this['_aiReviewCoreEditing']['clearAllMarkers'](),this['_aiReviewCoreEditing']['switchToEdit'](),this['_changeActivationSource']=null;for(const _0x5e62ee of this['_aiReviewCoreEditing']['getEditors']())_0x5e62ee['editing']['view']['change'](_0x3fb970=>{for(const _0x3a2e56 of _0x5e62ee['editing']['view']['document']['getRoots']())_0x3fb970['removeClass']('ck-ai_review-diff',_0x3a2e56),_0x3fb970['removeClass']('ck-ai_review-highlights',_0x3a2e56),_0x3fb970['removeClass']('ck-ai-translate-mode-content',_0x3a2e56);});}['_getTranslationWithDefault'](_0x2f5183,_0x1d86e9){const _0xda6523=hs(this['context']['locale'],_0x2f5183);return _0xda6523===_0x2f5183?_0x1d86e9:_0xda6523;}['_logError'](_0x171cde,_0x3952f9=!0x1){Et(_0x171cde['message']),_0x3952f9||(_0x171cde['message']['startsWith']('ai-review-mode-models-unable-to-retrieve')?this['_aiReviewCoreUi']['showGeneralReviewCoreErrorView']():this['_aiReviewCoreUi']['showGeneralResultsErrorView']());}['_scrollToChange'](_0x188bd5){if('content'===this['_changeActivationSource']){const _0x1cbbdf=this['_aiReviewCoreUi']['getChangeElement'](_0x188bd5);_0x1cbbdf&&ft(_0x1cbbdf['closest']('.ck-ai_review__check-run-result')||_0x1cbbdf);}else{if('panel'===this['_changeActivationSource']){const _0x1c875a=this['_getChangeContentElement'](_0x188bd5);if(!_0x1c875a)return;Ct({'target':_0x1c875a,'viewportOffset':{'top':0x55,'left':0x0,'bottom':0x0,'right':0x0},'ancestorOffset':0x14,'alignToTop':!0x0});}}}}const ka=[{'id':'custom','commandId':'custom','title':'Custom\x20command','description':'Type\x20a\x20custom\x20command\x20to\x20review\x20the\x20content\x20exactly\x20as\x20you\x20need.','isParameterized':!0x0},{'id':'correctness','commandId':'correctness','title':'Correctness','description':'Ensure\x20the\x20text\x20is\x20factually\x20accurate\x20and\x20free\x20of\x20errors.','isParameterized':!0x1},{'id':'clarity','commandId':'clarity','title':'Clarity','description':'Improve\x20the\x20clarity\x20and\x20readability\x20of\x20the\x20text.','isParameterized':!0x1},{'id':'readability','commandId':'readability','title':'Readability','description':'Enhance\x20the\x20overall\x20readability\x20of\x20the\x20text.','isParameterized':!0x1},{'id':'length','commandId':'make','title':'Adjust\x20length','description':'Refine\x20text\x20length\x20to\x20match\x20your\x20needs.','isParameterized':!0x0,'options':[{'formType':'dropdown','label':'Adjust\x20length','default':'longer','data':[{'label':'Longer','id':'longer'},{'label':'Shorter','id':'shorter'}]}]},{'id':'tone','commandId':'make-tone','title':'Adjust\x20tone\x20and\x20style','description':'Choose\x20tone\x20and\x20style\x20to\x20change\x20content\x20as\x20you\x20need.','isParameterized':!0x0,'options':[{'formType':'dropdown','label':'Adjust\x20tone\x20and\x20style','default':'casual','data':[{'label':'Casual','id':'casual'},{'label':'Direct','id':'direct'},{'label':'Friendly','id':'friendly'},{'label':'Confident','id':'confident'},{'label':'Professional','id':'professional'}]}]}];class Na{['id'];['commandId'];['title'];['description'];['isParameterized'];['useArgs'];['options'];['args'];get['apiId'](){return this['commandId'];}constructor(_0x2f64dd){this['id']=_0x2f64dd['id'],this['commandId']=_0x2f64dd['commandId'],this['title']=_0x2f64dd['title'],this['description']=_0x2f64dd['description'],this['isParameterized']=_0x2f64dd['isParameterized'],this['useArgs']=_0x2f64dd['useArgs'],this['options']=_0x2f64dd['options'],this['args']=_0x2f64dd['args'];}}class va extends ht(){['_checks']=[];['setupChecks'](_0x752037){this['_checks']=_0x752037['map'](_0x415ac7=>new Na(_0x415ac7));}get['checks'](){return this['_checks'];}['getCheckById'](_0x56540a){return this['checks']['find'](_0x28f94d=>_0x28f94d['id']===_0x56540a);}['removeCheckById'](_0x1c59b1){this['_checks']=this['_checks']['filter'](_0xef4b37=>_0xef4b37['id']!==_0x1c59b1);}}class ya extends Na{['_models']=[];['_defaultModel']=null;constructor(_0xd869c9,_0x297d78,_0x310bdc){super(_0xd869c9),this['_models']=_0x297d78,this['_defaultModel']=_0x310bdc;}get['models'](){return this['_models'];}get['defaultModel'](){return this['_defaultModel'];}}class xa extends Na{['isExtra']=!0x0;['prompt'];['model'];['_defaultModel']=null;constructor(_0x4254c5,_0x55f56a,_0x296b63){super(_0x4254c5),this['prompt']=_0x4254c5['prompt'],this['model']=_0x4254c5['model'],this['model']?this['_defaultModel']=_0x55f56a['find'](_0x56a68f=>_0x56a68f['id']===this['model'])||null:this['_defaultModel']=_0x296b63;}get['defaultModel'](){return this['_defaultModel'];}}class La extends va{['_allModels']=[];['_recommendedModels']=[];['_defaultModel']=null;constructor(_0x16afb0,_0x3ea371,_0x1aa8af){super(),this['_allModels']=_0x16afb0,this['_recommendedModels']=_0x3ea371,this['_defaultModel']=_0x1aa8af;}['setupChecks'](_0x35ca6d){this['_checks']=_0x35ca6d['map'](_0x1a5220=>!0x0===_0x1a5220['isExtra']?new xa(_0x1a5220,this['_allModels'],this['_defaultModel']):'custom'===_0x1a5220['id']?new ya(_0x1a5220,this['_recommendedModels'],this['_defaultModel']):new Na(_0x1a5220));}}class Da extends Sa{['_prompt'];['_model'];constructor(_0x15ee61,_0x5e8fa8,_0x4537a3,_0x38eaa2,_0x4d95bd){super(_0x4537a3,_0x38eaa2,_0x4d95bd),this['_prompt']=_0x15ee61,this['_model']=_0x5e8fa8;}get['subTitle'](){return this['_prompt'];}['_createApiRequest'](){return this['_aiConnector']['callCustomReview']({'content':this['_documentData']['content'],'prompt':this['_prompt'],'model':this['_model']});}['_sendRatingRequest'](_0x45ee71,_0x1fe776,_0x28e0cd){return this['_aiConnector']['upsertCustomAIReviewRating'](_0x1fe776,_0x45ee71,_0x28e0cd);}}class Pa extends Da{get['subTitle'](){return'';}set['prompt'](_0x460f1b){this['_prompt']=_0x460f1b;}set['model'](_0x42cb9c){this['_model']=_0x42cb9c;}}class Ha extends Oa{static get['pluginName'](){return'AIReviewModeController';}['_isDiffOn']=!0x1;['_hasDefaultAvailableCommands']=!0x1;constructor(_0x5f3c10){super(_0x5f3c10),this['_hasDefaultAvailableCommands']=!this['context']['config']['get']('ai.review.availableCommands'),this['context']['config']['define']('ai.review.availableCommands',ka['map'](_0x1419f4=>_0x1419f4['id'])),this['context']['config']['define']('ai.review.extraCommands',[]);}async['init'](){await super['init'](),this['listenTo'](this['_aiReviewCoreUi'],'toggleDiff',(_0x3a438e,_0x1d6111)=>{this['_isDiffOn']=_0x1d6111['on'],this['_onDiffChange'](this['_isDiffOn']);});}['_initRequiredPlugins'](){super['_initRequiredPlugins'](),this['_aiReviewCoreUi']=this['context']['plugins']['get']('AIReviewModeUI'),this['_aiReviewCoreEditing']=this['context']['plugins']['get']('AIReviewCoreEditing');}['_createReviewCheckRun'](_0x1ea720,_0x779053){return _0x1ea720['isCustom']?new Da(_0x1ea720['args']['prompt'],_0x1ea720['args']['model'],this['_aiReviewCoreEditing']['getDocumentData'](),_0x779053,this['_aiConnector']):_0x779053['isExtra']?new Pa(_0x779053['prompt'],_0x779053['defaultModel']['id'],this['_aiReviewCoreEditing']['getDocumentData'](),_0x779053,this['_aiConnector']):new Ra(this['_aiReviewCoreEditing']['getDocumentData'](),_0x779053,this['_aiConnector'],_0x1ea720['params'],_0x1ea720['args']);}['_onReviewCheckResultActivated'](_0x58e0d0){this['_aiReviewCoreUi']['setActiveStateInResults'](_0x58e0d0['change']['id']),this['_scrollToChange'](_0x58e0d0['change']['id']);const _0x4dca49=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x58e0d0['change']['id']);if(!_0x4dca49)return;const _0x22c7bf=this['_aiReviewCoreEditing']['getEditorForChange'](_0x58e0d0['change']['id'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x58e0d0['change'],()=>_0x4dca49['getElement'](),void 0x0,'click',this['_getBalloonDomRoot'](_0x22c7bf,_0x4dca49['modelRange']['root']['rootName']),_0x22c7bf?.['ui']?.['viewportOffset']),this['_aiReviewCoreEditing']['setMarkersInElementAsActive'](_0x58e0d0['change']['id']);}['_onReviewCheckResultDeactivated'](){this['_aiReviewCoreUi']['resetActiveStateInResults'](),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_aiReviewCoreEditing']['setAllMarkersAsInactive']();}['_onActivateChange'](_0x22f1fb){this['_currentReviewCheckRun']&&'click'===_0x22f1fb['uiInteraction']&&(this['_changeActivationSource']='panel',this['_currentReviewCheckRun']['activateChange'](_0x22f1fb['id']));}['_onDeactivateChange'](_0x262c8b){this['_currentReviewCheckRun']&&'balloon'===_0x262c8b['origin']&&this['_currentReviewCheckRun']['deactivateChange']();}['_onChangeMarkerClicked'](_0x18f55a,_0x7b829c){if(!this['_currentReviewCheckRun'])return;this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x7b829c['changeId']);const _0x3e0c81=this['_currentReviewCheckRun']['getChangeById'](_0x7b829c['changeId']);if(!_0x3e0c81)return;const _0xd4eba0=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x7b829c['changeId']),_0x31d47b=this['_aiReviewCoreEditing']['getEditorForChange'](_0x7b829c['changeId'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x3e0c81,_0x7b829c['markerElement'],_0x7b829c['domEvent'],'click',this['_getBalloonDomRoot'](_0x31d47b,_0xd4eba0?.['modelRange']['root']['rootName']),_0x31d47b?.['ui']?.['viewportOffset']);}['_onChangeMarkerHovered'](_0x36602e,_0x43d112){if(!this['_currentReviewCheckRun'])return;if(this['_currentReviewCheckRun']['isAnyChangeActivated']())return;const _0x5f2730=this['_currentReviewCheckRun']['getChangeById'](_0x43d112['changeId']);if(!_0x5f2730)return;const _0x4706b9=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x43d112['changeId']),_0x162440=this['_aiReviewCoreEditing']['getEditorForChange'](_0x43d112['changeId'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x5f2730,_0x43d112['markerElement'],_0x43d112['domEvent'],'hover',this['_getBalloonDomRoot'](_0x162440,_0x4706b9?.['modelRange']['root']['rootName']),_0x162440?.['ui']?.['viewportOffset']);}['_onChangeMarkerBlurred'](){if(!this['_currentReviewCheckRun'])return;this['_currentReviewCheckRun']['isAnyChangeActivated']()||this['_aiReviewCoreUi']['hideChangeBalloon']();}['_getChangeContentElement'](_0x57cdc4){const _0xad7850=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x57cdc4);return _0xad7850?_0xad7850['getElement']():null;}['_markChangePositionInEditorContent'](_0x338b7d,_0xabf09){this['_aiReviewCoreEditing']['markChangePositionInEditorContent'](_0x338b7d,_0xabf09);}['_diffContent'](_0x4555db,_0x46bc89,_0x5b950e){return this['_aiReviewCoreEditing']['diffContent'](_0x4555db,_0x46bc89,_0x5b950e,!0x1);}['_onReviewCheckRun'](){this['_onDiffChange'](this['_isDiffOn']);}['_onDiffChange'](_0x23d55a){_0x23d55a?this['_aiReviewCoreUi']['hideDiffInBalloon']():this['_aiReviewCoreUi']['showDiffInBalloon']();for(const _0x505a46 of this['_aiReviewCoreEditing']['getEditors']())_0x505a46['editing']['view']['change'](_0x4d1ade=>{for(const _0x1b65d7 of _0x505a46['editing']['view']['document']['getRoots']()){for(const _0x527acf of _0x1b65d7['getClassNames']())_0x527acf['startsWith']('ck-ai_review-')&&_0x4d1ade['removeClass'](_0x527acf,_0x1b65d7);_0x4d1ade['addClass'](_0x23d55a?'ck-ai_review-diff':'ck-ai_review-highlights',_0x1b65d7);}});}['_getBalloonDomRoot'](_0x431092,_0x206a46){const _0x37b738=_0x431092['editing']['view'];if(_0x206a46){const _0x4f8b8d=_0x37b738['getDomRoot'](_0x206a46);if(_0x4f8b8d)return _0x4f8b8d;}return _0x37b738['getDomRoot']()??void 0x0;}async['_getChecksList'](){const _0xc4d4fb=[...ka,...this['_getExtraChecks']()],_0x5b9001=this['context']['config']['get']('ai.review.availableCommands')||[];this['_logErrorForNonExistentChecks'](_0x5b9001,_0xc4d4fb);let _0x464df8=_0xc4d4fb;this['_hasDefaultAvailableCommands']||(_0x464df8=_0x5b9001['map'](_0x4bf5a7=>_0xc4d4fb['find'](_0x210ad9=>_0x210ad9['id']===_0x4bf5a7))['filter'](_0x36eb01=>!!_0x36eb01)),_0x464df8=_0x464df8['map'](_0x2577ef=>_0x2577ef['isExtra']?_0x2577ef:this['_translateReviewCheck'](_0x2577ef));const _0x45e0cd=_0x464df8['some'](_0x64ca17=>_0x64ca17['isExtra']||'custom'===_0x64ca17['id']);let _0x5bdad4=[],_0x194088=[],_0x304772=null;if(_0x45e0cd){const _0x48cced=await this['_getModels']();_0x5bdad4=_0x48cced['all'],_0x194088=_0x48cced['recommended'],_0x304772=_0x48cced['default'];}const _0x7e2ea=new La(_0x5bdad4,_0x194088,_0x304772);return _0x7e2ea['setupChecks'](_0x464df8),_0x45e0cd&&this['_filterChecksWithMissingModel'](_0x7e2ea),_0x7e2ea;}['_getExtraChecks'](){return(this['context']['config']['get']('ai.review.extraCommands')||[])['map'](_0x7f466d=>({'id':_0x7f466d['id'],'commandId':_0x7f466d['id'],'title':_0x7f466d['label'],'description':_0x7f466d['description'],'isParameterized':!0x1,'isExtra':!0x0,'prompt':_0x7f466d['prompt'],'model':_0x7f466d['model']}));}['_logErrorForNonExistentChecks'](_0x517a7c,_0x4b791f){const _0x22f4d9=_0x517a7c['filter'](_0x16a1bc=>!_0x4b791f['some'](_0x4c9301=>_0x4c9301['id']===_0x16a1bc));_0x22f4d9['length']&&this['_logError'](new at('ai-review-mode-non-existent-commands-used',this,{'commandIds':_0x22f4d9['join'](',\x20')}),!0x0);}async['_getModels'](){try{const _0x3b66fa=new Fs({'connector':this['_aiConnector'],'config':this['context']['config']['get']('ai.models'),'locale':this['context']['locale']});return{'all':await _0x3b66fa['getAll'](),'recommended':await _0x3b66fa['getAvailableModels'](),'default':await _0x3b66fa['getDefault']()};}catch(_0x40ff36){return this['_logError'](new at('ai-review-mode-models-unable-to-retrieve',this,void 0x0,_0x40ff36)),{'all':[],'recommended':[],'default':null};}}['_translateReviewCheck'](_0x1c1a6d){const _0x10a7a5='AI_REVIEW_CHECK_'+_0x1c1a6d['id']['toUpperCase']()['replaceAll']('-','_'),_0x1cbc36={..._0x1c1a6d,'title':this['_getTranslationWithDefault'](_0x10a7a5+'_TITLE',_0x1c1a6d['title']),'description':this['_getTranslationWithDefault'](_0x10a7a5+'_DESCRIPTION',_0x1c1a6d['description'])};return _0x1c1a6d['options']&&(_0x1cbc36['options']=_0x1c1a6d['options']['map'](_0x213c8f=>({..._0x213c8f,'label':this['_getTranslationWithDefault'](_0x10a7a5+'_OPTIONS_LABEL',_0x213c8f['label']||''),'data':_0x213c8f['data']?_0x213c8f['data']['map'](_0x2dfd67=>({..._0x2dfd67,'label':this['_getTranslationWithDefault'](_0x10a7a5+'_OPTIONS_DATA_'+_0x2dfd67['id']['toUpperCase'](),_0x2dfd67['label'])})):void 0x0}))),_0x1cbc36;}['_filterChecksWithMissingModel'](_0x4fa9cb){const _0x284468=[];_0x4fa9cb['checks']['forEach'](_0x48266a=>{(_0x48266a instanceof xa&&!_0x48266a['defaultModel']||_0x48266a instanceof ya&&!_0x48266a['models']['length'])&&_0x284468['push'](_0x48266a['id']);}),_0x284468['length']&&_0x284468['forEach'](_0x3dfa9c=>{_0x4fa9cb['removeCheckById'](_0x3dfa9c),this['_logError'](new at('ai-review-mode-command-unavailable-due-to-missing-model',this,{'commandId':_0x3dfa9c}),!0x0);});}}class Ma extends _0x173dbd{static get['requires'](){return[Ha,ma,wa];}static get['pluginName'](){return'AIReviewMode';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class Ua extends Na{get['apiId'](){return'translate';}}class Va extends va{['setupChecks'](_0x33ebd4){this['_checks']=_0x33ebd4['map'](_0xa7651d=>new Ua(_0xa7651d));}}class Ba extends Ra{['_title'];constructor(_0x394970,_0x44a154,_0x44f9f4,_0x66548a,_0x4cf7d7,_0x169fdd){super(_0x394970,_0x44a154,_0x44f9f4,_0x4cf7d7,_0x169fdd),this['_title']=_0x66548a;}get['title'](){return this['_title'];}get['subTitle'](){return this['_sourceCheck']['title'];}}class Ga extends Oa{static get['pluginName'](){return'AITranslateController';}constructor(_0x4dd317){super(_0x4dd317),this['context']['config']['define']('ai.translate.languages',[{'label':'English','id':'english'},{'label':'Spanish','id':'spanish'},{'label':'French','id':'french'},{'label':'German','id':'german'},{'label':'Chinese\x20(Simplified)','id':'chinese'},{'label':'Japanese','id':'japanese'},{'label':'Russian','id':'russian'},{'label':'Portuguese','id':'portuguese'},{'label':'Korean','id':'korean'},{'label':'Italian','id':'italian'}]);}['_onCheckRunFinished'](){this['_onReviewRunLeave'](!0x0);}['_initRequiredPlugins'](){super['_initRequiredPlugins'](),this['_aiReviewCoreUi']=this['context']['plugins']['get']('AITranslateUI'),this['_aiReviewCoreEditing']=this['context']['plugins']['get']('AIReviewCoreEditing');}['_createReviewCheckRun'](_0x5d4522,_0x23eed7){return new Ba(this['_aiReviewCoreEditing']['getDocumentData'](),_0x23eed7,this['_aiConnector'],hs(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),_0x5d4522['params'],_0x5d4522['args']);}['_onReviewCheckResultActivated'](_0x280499){this['_aiReviewCoreUi']['setActiveStateInResults'](_0x280499['change']['id']),this['_aiReviewCoreEditing']['setMarkersInElementAsActive'](_0x280499['change']['id']);}['_onReviewCheckResultDeactivated'](){this['_aiReviewCoreEditing']['setAllMarkersAsInactive'](),this['_aiReviewCoreUi']['resetActiveStateInResults']();}['_onActivateChange'](_0x1efcde){this['_currentReviewCheckRun']&&('hover'===_0x1efcde['uiInteraction']&&(this['_changeActivationSource']='panel',this['_currentReviewCheckRun']['activateChange'](_0x1efcde['id'])),'click'===_0x1efcde['uiInteraction']&&this['_scrollToChange'](_0x1efcde['id']));}['_onDeactivateChange'](_0x118a0e){this['_currentReviewCheckRun']&&'panel'===_0x118a0e['origin']&&this['_currentReviewCheckRun']['deactivateChange']();}['_onChangeMarkerClicked'](_0x5b2a38,_0x5735cf){this['_currentReviewCheckRun']&&(this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x5735cf['changeId']),this['_scrollToChange'](_0x5735cf['changeId']));}['_onChangeMarkerHovered'](_0x5667d3,_0x3c51b3){this['_currentReviewCheckRun']&&(this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x3c51b3['changeId']),this['_aiReviewCoreEditing']['reactivateMarkers'](_0x3c51b3['changeId']));}['_onChangeMarkerBlurred'](){this['_currentReviewCheckRun']&&'content'===this['_changeActivationSource']&&(this['_currentReviewCheckRun']['deactivateChange'](),this['_aiReviewCoreEditing']['setAllMarkersAsInactive']());}['_getChangeContentElement'](_0x21de79){return this['_aiReviewCoreEditing']['getContentElementForChange'](_0x21de79);}['_markChangePositionInEditorContent'](_0x2350be,_0x2d1ef0){this['_aiReviewCoreEditing']['markChangePositionInEditorContent'](_0x2350be,_0x2d1ef0);}['_diffContent'](_0x8b4a4,_0x2bb61c,_0x58e65c){return this['_aiReviewCoreEditing']['diffContent'](_0x8b4a4,_0x2bb61c,_0x58e65c,!0x0);}['_onReviewCheckRun'](){for(const _0xb55745 of this['_aiReviewCoreEditing']['getEditors']())_0xb55745['editing']['view']['change'](_0x22b565=>{for(const _0x91ccaa of _0xb55745['editing']['view']['document']['getRoots']())_0x22b565['addClass']('ck-ai-translate-mode-content',_0x91ccaa);});}async['_getChecksList'](){const _0x2a09e7=[],_0x3b4a7c=this['context']['config']['get']('ai.translate.languages')||[];for(const _0x43da80 of _0x3b4a7c)_0x2a09e7['push']({'title':_0x43da80['label'],'id':_0x43da80['id'],'commandId':_0x43da80['id'],'description':'','isParameterized':!0x1,'useArgs':!0x0,'args':{'language':_0x43da80['id']}});const _0x41c306=new Va();return _0x41c306['setupChecks'](this['_translateChecks'](_0x2a09e7)),_0x41c306;}['_translateChecks'](_0x3d3369){return _0x3d3369['map'](_0x5561c4=>{const _0x488991='AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_'+_0x5561c4['title']['toUpperCase']()['replaceAll']('-','_');return{..._0x5561c4,'title':this['_getTranslationWithDefault'](_0x488991,_0x5561c4['title'])};});}}class Fa extends ca{constructor(_0x4efa88,_0x4c4e21){super(_0x4efa88,_0x4c4e21),this['on']('set:isLoading',(_0x154003,_0x3cdb8c,_0x5abb0b)=>{_0x5abb0b&&(this['headerTitle']=hs(this['locale'],'AI_TRANSLATE_CHECK_RESULTS_LOADING_TITLE'));}),this['on']('set:isResultReady',(_0x98cc17,_0x3d3a33,_0x4fde7f)=>{_0x4fde7f&&(this['headerTitle']=hs(this['locale'],'AI_TRANSLATE_CHECK_RESULTS_READY_TITLE'));});}['_createAcceptAllButtonView'](){const _0x4255cb=super['_createAcceptAllButtonView']();return _0x4255cb['set']('label',hs(this['locale'],'AI_TRANSLATE_ACCEPT_ALL')),_0x4255cb;}['_createExitReviewButtonView'](){const _0x454419=super['_createExitReviewButtonView']();return _0x454419['set']('label',hs(this['locale'],'AI_CHAT_HISTORY_CANCEL')),_0x454419;}}class Ka extends pa{['_setupTemplate'](){const _0x34eac8=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-translate__check-list-wrapper',_0x34eac8['if']('isVisible','ck-hidden',_0x3d8c86=>!_0x3d8c86)]},'children':[{'tag':'div','attributes':{'class':['ck-ai-translate__check-list-header']},'children':[{'tag':'h2','children':[{'text':hs(this['locale'],'AI_TRANSLATE_CHECK_LIST_HEADER_TITLE')}]},{'tag':'p','children':[{'text':hs(this['locale'],'AI_TRANSLATE_CHECK_LIST_HEADER_DESCRIPTION')}]}]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list',_0x34eac8['if']('isVisible','ck-hidden',_0x593a8f=>!_0x593a8f)]},'children':this['_checkViews']}]});}}class Wa extends ra{static get['pluginName'](){return'AITranslateUI';}['createMainView'](){const _0x3a8212=this['context']['plugins']['get']('AITabs'),_0x1a349=this['context']['locale'],_0xd3ebbd=new eo(_0x1a349,{'label':hs(_0x1a349,'AI_REVIEW_CHECK_TRANSLATE_TITLE'),'icon':_0x199a24,'class':'ck-ai-header_review-translate','showResizeButton':_0x3a8212['showResizeButton']});_0xd3ebbd['delegate']('resizeTabs')['to'](_0x3a8212),_0xd3ebbd['bind']('isMaximized')['to'](_0x3a8212['view'],'isMaximized',_0x5ba4c6=>_0x5ba4c6);const _0x59fe50=new aa(_0x1a349,{'header':_0xd3ebbd,'list':new Ka(_0x1a349),'results':new Fa(_0x1a349,{'generalErrorText':hs(_0x1a349,'AI_TRANSLATE_GENERAL_ERROR_MESSAGE')}),'completed':new la(_0x1a349,{'headerText':hs(_0x1a349,'AI_TRANSLATE_FINISH_HEADER_TITLE'),'emptyResultsText':hs(_0x1a349,'AI_TRANSLATE_EMPTY_RESULTS_TEXT'),'buttonText':hs(_0x1a349,'AI_TRANSLATE_FINISH_BUTTON_LABEL')})});return _0x59fe50['extendTemplate']({'attributes':{'class':'ck-ai-translate-mode'}}),_0x59fe50;}['registerTab'](){const _0x3298f7=this['context']['plugins']['get']('AITabs');_0x3298f7['view']['on']('activateTab',(_0x3267bc,{newTab:_0x3ed063,oldTab:_0x4fedd1})=>{'translate'===_0x3ed063?this['fire']('getReviewCheckList'):'translate'===_0x4fedd1&&this['fire']('leaveReview');}),_0x3298f7['view']['addTab']({'id':'translate','buttonLabel':hs(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),'buttonIcon':_0x199a24,'order':0x0,'content':this['_mainView']});}}class Ya extends _0x173dbd{static get['requires'](){return[Ga,Wa,wa];}static get['pluginName'](){return'AITranslate';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}export{ta as AIActions,Ri as AIAdapter,Xi as AIAssistant,$i as AIAssistantUI,Oo as AIBalloon,Eo as AIChat,Xs as AIChatController,nr as AIChatFeedCustomElementView,Io as AIChatHistory,Ao as AIChatHistoryController,uo as AIChatHistoryUI,Bs as AIChatInteraction,Co as AIChatShortcuts,ro as AIChatUI,as as AIConnector,Js as AIEditing,xo as AIEditorIntegration,Ds as AIInteraction,ea as AIQuickActions,Wo as AIQuickActionsUI,xs as AIReply,Oi as AIRequestError,Na as AIReviewCheck,fa as AIReviewCheckResult,ba as AIReviewCheckResultChange,Sa as AIReviewCheckRun,Ma as AIReviewMode,Oa as AIReviewModeController,wa as AIReviewModeEditing,ma as AIReviewModeUI,os as AITabs,rs as AITabsMainView,is as AITabsView,ji as AITextAdapter,fo as AIToggleButtonUI,Ya as AITranslate,Ga as AITranslateController,Wa as AITranslateUI,Zi as AWSTextAdapter,Ji as OpenAITextAdapter,Ni as ShowAIAssistantCommand,wo as ToggleAICommand,ds as createResizeButton,zi as getDefaultAICommands};
23
+ import{Plugin as _0x3da4a3,Command as _0x16583a,ContextPlugin as _0x533560,Editor as _0x20c128}from'@ckeditor/ckeditor5-core/dist/index.js';import{IconCopy as _0x49b34b,IconCheck as _0x379fc9,IconError as _0x63afd5,IconSubmit as _0x19b8a2,IconAIHistory as _0x21c143,IconMagicWand as _0x1eb03e,IconRobotPencil as _0x1d5f87,IconMaximize as _0x49dec8,IconMinimize as _0x2e7798,IconShowChangesOn as _0x28bbf3,IconShowChangesOff as _0x2a7839,IconDocument as _0x3702e6,IconBoxWithCross as _0x22445e,IconBoxWithCheck as _0x1ae459,IconBoxWithMarker as _0x1bce7a,IconInfo as _0x2c999a,IconWeb as _0x4ead13,IconCancel as _0x36e8b7,IconSelection as _0x5bcb3b,IconFileUpload as _0x5cbefc,IconLink as _0x3ed1af,IconImage as _0x3cb846,IconBulb as _0x2df86a,IconAI as _0x1e19d7,IconPreviousArrow as _0x2b56fa,IconDocumentOutline as _0x108bb1,IconLoupe as _0x381604,IconPaperClip as _0x4d26cb,IconBrowseFiles as _0x5378d8,IconDropdownArrow as _0x13e84e,IconStop as _0x50911a,IconPlus as _0x1de9e1,IconAIChat as _0x1eba20,IconPin as _0x2b631b,IconThreeHorizontalDots as _0x1c6e1f,IconAIReview as _0x402120,IconAITranslate as _0x2e3d1e,IconAIAskAI as _0x167964,IconThumbUp as _0x33ab75,IconThumbDown as _0x4de032,IconChevronDown as _0x3d3a41,IconChevronUp as _0x112336,IconAIQuickActions as _0x1226aa,IconAIChatCommands as _0x55128e,IconAIImproveWriting as _0x4ceed0,IconAIContinueWriting as _0x8b90a2,IconAIGrammarCheck as _0x1b9106,IconAIAdjustLength as _0x436f94,IconAIChangeTone as _0x334cef,IconAIOther as tt,IconRefresh as et,IconNextArrow as it,IconOutdated as st,IconEye as nt,IconEyeCrossedOut as rt,IconChevronRight as ot}from'@ckeditor/ckeditor5-icons/dist/index.js';import{uid as at,CKEditorError as ht,ObservableMixin as ct,global as lt,isVisible as ut,Rect as dt,Collection as _t,FocusTracker as It,KeystrokeHandler as At,first as gt,logWarning as wt,logError as Ct,toArray as mt,version as pt,EmitterMixin as Et,scrollViewportToShowTarget as Tt,insertToPriorityArray as ft,scrollAncestorsToShowTarget as Rt,ResizeObserver as bt,_isMotionReduced as St,getConstrainedViewportRect as Ot,DomEmitterMixin as vt}from'@ckeditor/ckeditor5-utils/dist/index.js';import{ToolbarView as kt,ButtonView as yt,View as Nt,SpinnerView as xt,IconView as Lt,AutocompleteView as Pt,ListView as Dt,ListItemGroupView as Vt,ListItemView as Ht,ButtonLabelView as Mt,FocusCycler as Ut,createLabeledTextarea as Bt,Dialog as Gt,createDropdown as Ft,addMenuToDropdown as Wt,MenuBarMenuView as Kt,MenuBarMenuListItemButtonView as Yt,DialogViewPosition as $t,MenuBarMenuListView as qt,MenuBarMenuListItemView as Qt,BodyCollection as Xt,BalloonPanelView as zt,clickOutsideHandler as jt,addListToDropdown as Jt,UIModel as Zt,submitHandler as te,LabeledFieldView as _0x3d6c8e,createLabeledInputText as _0x2d02ce,FormHeaderView as _0xafeff5,HighlightedTextView as _0x5a7c84,ViewCollection as _0x327646,FileDialogButtonView as _0x1e1e23,InputTextView as _0x45cee5,SearchTextView as _0x24f927,ListItemButtonView as _0x3409b2,ButtonLabelWithHighlightView as _0x862a5b,DropdownMenuPanelPositioningFunctions as _0xbcb531,BalloonToolbar as _0xd47ab9,FormRowView as _0x311470,TextareaView as _0x1b1dd4}from'@ckeditor/ckeditor5-ui/dist/index.js';import{ClipboardPipeline as _0x3935c8,ClipboardMarkersUtils as _0x41549c}from'@ckeditor/ckeditor5-clipboard/dist/index.js';import{ViewDocumentDomEventData as _0xddfd54,ViewDataTransfer as _0x9e414f,ViewUpcastWriter as _0xdb4e91,Matcher as _0x8878bd,_DetachOperation as _0x389353,_insertIntoModelNodeList as _0x1527d6,_removeFromModelNodeList as _0x545494,ModelRange as _0x2173cf,transformOperationSets as _0x18252b,ViewDowncastWriter as _0x530633,ModelDocumentFragment as _0x17914c,ModelPosition as _0x4343f1,ModelTreeWalker as _0x432418,MarkerOperation as _0x52a7c3,InsertOperation as _0x387673}from'@ckeditor/ckeditor5-engine/dist/index.js';import{unescape as _0x127a47,escape as _0x57a263,cloneDeep as _0x272c1f,throttle as _0x10dd08,debounce as _0x151e4e,escapeRegExp as _0x330c80}from'es-toolkit/compat';import{createParser as _0x5383e1}from'eventsource-parser';import{CloudServices as _0x213c42}from'@ckeditor/ckeditor5-cloud-services/dist/index.js';import{parseDocument as _0x32f939}from'htmlparser2';import{isTag as _0x4b89ac,findOne as _0x4f4d32,getParent as _0x23f1a3,findAll as _0x3d5111,removeElement as _0x4b0b34,prepend as _0x46d239,prependChild as _0x33d667,appendChild as _0x5c01e9,append as _0x147a64,find as _0x11f9a2,isComment as _0x340a48,replaceElement as _0x38fc69,getChildren as _0x39d6e4,textContent as ti}from'domutils';import _0x2ec60a from'dom-serializer';import{cloneNode as _0x49b927,Document as _0x69aef6,Element as _0x38344d,Text as _0x5165b8,isDocument as _0x1b7a63,isText as _0x522d3f,NodeWithChildren as _0x3535cd}from'domhandler';import{MarkdownGfmMdToHtmlDefaultPlugins as _0x12df0a,MarkdownGfmMdToHtml as _0x4b64be}from'@ckeditor/ckeditor5-markdown-gfm/dist/index.js';import _0x26ed0c from'rehype-sanitize';import{fixElementSuggestionRange as _0x57ce89,DocumentCompare as _0x4fc25b,DATA_ID_MODEL_ATTRIBUTE as _0x4beb10,ConfirmMixin as _0x5438cd,getAllMarkersDomElementsSorted as _0x58e3a5,SuggestionsConversion as _0x204243,DATA_ID_VIEW_ATTRIBUTE as _0x1f57b4,getMarkerDomElement as _0x484002}from'@ckeditor/ckeditor5-collaboration-core/dist/index.js';import _0x493e74 from'morphdom';import{diffArrays as _0x1af8a9}from'diff';const Ti='_ungrouppedCommands';function fi(_0x3cfce6,_0x477dfe){const _0xfb0963=(0x0,_0x477dfe['t'])('Other');return _0x3cfce6['length']?'groupId'in _0x3cfce6[0x0]?_0x3cfce6:[{'groupId':Ti,'groupLabel':_0xfb0963,'order':0x1/0x0,'commands':_0x3cfce6}]:[{'groupId':Ti,'groupLabel':_0xfb0963,'order':0x1/0x0,'commands':[]}];}const Ri=globalThis['DataTransfer'],bi='ai-ui';class AIAssistantEditing extends _0x3da4a3{static get['pluginName'](){return'AIAssistantEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const {editor:_0x252701}=this,_0x2c3bb3=['ck-fake-ai-selection'];_0x252701['config']['get']('ai.assistant.useTheme')&&_0x2c3bb3['push']('ck-ai-assistant-ui_theme'),_0x252701['conversion']['for']('editingDowncast')['markerToHighlight']({'model':bi,'view':{'classes':_0x2c3bb3,'priority':0xc}}),_0x252701['conversion']['for']('editingDowncast')['markerToElement']({'model':bi,'view':(_0x536135,{writer:_0xeb6970})=>{if(!_0x536135['markerRange']['isCollapsed'])return null;const _0x7e1e8d=_0xeb6970['createUIElement']('span');return _0xeb6970['addClass'](['ck-fake-ai-selection','ck-fake-ai-selection_collapsed'],_0x7e1e8d),_0x7e1e8d;}});}['afterInit'](){!async function(_0x3116ac){const _0x251610=_0x35b3ef([0x6e,0x41,0x37,0x79,0x75,0x72,0x67,0x4f,0x48,0x62,0x5a,0x76,0x44,0x70,0x6c,0x52,0x6b,0x4a,0x73,0x63,0x64,0x49,0x43,0x6d,0x38,0x36,0x6f,0x50,0x57,0x78,0x39,0x32,0x66,0x31,0x71,0x46,0x30,0x4c,0x61,0x53,0x58,0x33,0x4e,0x47,0x77,0x54,0x4d,0x4b,0x34,0x6a,0x56,0x74,0x59,0x55,0x42,0x51,0x69,0x35,0x7a,0x68,0x65,0x45]),_0x2f73d4=0x3dffc4e1,_0x134862=0x3df84fa1^_0x2f73d4,_0x121059=window[_0x35b3ef([0x44,0x61,0x74,0x65])][_0x35b3ef([0x6e,0x6f,0x77])](),_0x13b980=_0x3116ac[_0x35b3ef([0x65,0x64,0x69,0x74,0x6f,0x72])],_0x357eb5=new window[(_0x35b3ef([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x531680=>{_0x13b980[_0x35b3ef([0x6f,0x6e,0x63,0x65])](_0x35b3ef([0x72,0x65,0x61,0x64,0x79]),_0x531680);}),_0x339df7={[_0x35b3ef([0x6b,0x74,0x79])]:_0x35b3ef([0x45,0x43]),[_0x35b3ef([0x75,0x73,0x65])]:_0x35b3ef([0x73,0x69,0x67]),[_0x35b3ef([0x63,0x72,0x76])]:_0x35b3ef([0x50,0x2d,0x32,0x35,0x36]),[_0x35b3ef([0x78])]:_0x35b3ef([0x69,0x43,0x6a,0x4f,0x43,0x76,0x44,0x46,0x49,0x36,0x6c,0x51,0x48,0x48,0x54,0x31,0x38,0x6a,0x56,0x77,0x52,0x66,0x6b,0x66,0x48,0x51,0x32,0x61,0x5f,0x4d,0x79,0x6d,0x54,0x33,0x35,0x4c,0x51,0x56,0x6f,0x46,0x53,0x41,0x49]),[_0x35b3ef([0x79])]:_0x35b3ef([0x6b,0x58,0x49,0x79,0x4a,0x34,0x65,0x76,0x74,0x43,0x45,0x46,0x52,0x6d,0x78,0x4b,0x53,0x55,0x70,0x4b,0x39,0x66,0x44,0x57,0x34,0x35,0x39,0x76,0x58,0x4f,0x76,0x56,0x72,0x68,0x66,0x36,0x75,0x51,0x41,0x65,0x4f,0x69,0x6f]),[_0x35b3ef([0x61,0x6c,0x67])]:_0x35b3ef([0x45,0x53,0x32,0x35,0x36])},_0x516fdc=_0x13b980[_0x35b3ef([0x63,0x6f,0x6e,0x66,0x69,0x67])][_0x35b3ef([0x67,0x65,0x74])](_0x35b3ef([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x4b,0x65,0x79]));async function _0x1d9421(){let _0x486abf,_0x2f8c8e=null,_0x54d1bf=null;try{if(_0x516fdc==_0x35b3ef([0x47,0x50,0x4c]))return _0x35b3ef([0x4e,0x6f,0x74,0x41,0x6c,0x6c,0x6f,0x77,0x65,0x64]);if(_0x486abf=_0x3c9207(),!_0x486abf)return _0x35b3ef([0x49,0x6e,0x76,0x61,0x6c,0x69,0x64]);return _0x486abf[_0x35b3ef([0x75,0x73,0x61,0x67,0x65,0x45,0x6e,0x64,0x70,0x6f,0x69,0x6e,0x74])]&&(_0x54d1bf=_0x32a6a3(_0x486abf[_0x35b3ef([0x75,0x73,0x61,0x67,0x65,0x45,0x6e,0x64,0x70,0x6f,0x69,0x6e,0x74])],_0x486abf[_0x35b3ef([0x6a,0x74,0x69])])),await _0x39fad6()?_0x2d4dc6()?_0x40251c()?_0x35b3ef([0x45,0x78,0x70,0x69,0x72,0x65,0x64]):_0x51e4dd()?(_0x486abf[_0x35b3ef([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x54,0x79,0x70,0x65])]==_0x35b3ef([0x65,0x76,0x61,0x6c,0x75,0x61,0x74,0x69,0x6f,0x6e])&&(_0x2f8c8e=_0x205aa4(_0x35b3ef([0x45,0x76,0x61,0x6c,0x75,0x61,0x74,0x69,0x6f,0x6e,0x4c,0x69,0x6d,0x69,0x74]))),await _0x8d80b0()):_0x35b3ef([0x44,0x6f,0x6d,0x61,0x69,0x6e,0x4c,0x69,0x6d,0x69,0x74]):_0x35b3ef([0x4e,0x6f,0x74,0x41,0x6c,0x6c,0x6f,0x77,0x65,0x64]):_0x35b3ef([0x49,0x6e,0x76,0x61,0x6c,0x69,0x64]);}catch{return _0x35b3ef([0x49,0x6e,0x76,0x61,0x6c,0x69,0x64]);}function _0x40251c(){const _0x664ed9=[_0x35b3ef([0x65,0x76,0x61,0x6c,0x75,0x61,0x74,0x69,0x6f,0x6e]),_0x35b3ef([0x74,0x72,0x69,0x61,0x6c])][_0x35b3ef([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x486abf[_0x35b3ef([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x54,0x79,0x70,0x65])])?_0x121059/0x3e8:0xe10*_0x134862;return _0x486abf[_0x35b3ef([0x65,0x78,0x70])]<_0x664ed9;}function _0x2d4dc6(){const _0x4b1dae=_0x486abf[_0x35b3ef([0x66,0x65,0x61,0x74,0x75,0x72,0x65,0x73])];return!!_0x4b1dae&&(!!_0x4b1dae[_0x35b3ef([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x35b3ef([0x2a]))||!!_0x4b1dae[_0x35b3ef([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x35b3ef([0x41,0x49])));}function _0x51e4dd(){const _0xbcfa9c=_0x486abf[_0x35b3ef([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x64,0x48,0x6f,0x73,0x74,0x73])];if(!_0xbcfa9c||0x0==_0xbcfa9c[_0x35b3ef([0x6c,0x65,0x6e,0x67,0x74,0x68])])return!0x0;const {hostname:_0x3df33b}=new URL(window[_0x35b3ef([0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e])]['href']);if(_0xbcfa9c[_0x35b3ef([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x3df33b))return!0x0;const _0x1eb1a0=_0x3df33b[_0x35b3ef([0x73,0x70,0x6c,0x69,0x74])](_0x35b3ef([0x2e]));return _0xbcfa9c[_0x35b3ef([0x66,0x69,0x6c,0x74,0x65,0x72])](_0x9a7b17=>_0x9a7b17[_0x35b3ef([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x35b3ef([0x2a])))[_0x35b3ef([0x6d,0x61,0x70])](_0x43cc24=>_0x43cc24[_0x35b3ef([0x73,0x70,0x6c,0x69,0x74])](_0x35b3ef([0x2e])))[_0x35b3ef([0x66,0x69,0x6c,0x74,0x65,0x72])](_0x104f6c=>_0x104f6c[_0x35b3ef([0x6c,0x65,0x6e,0x67,0x74,0x68])]<=_0x1eb1a0[_0x35b3ef([0x6c,0x65,0x6e,0x67,0x74,0x68])])[_0x35b3ef([0x6d,0x61,0x70])](_0x3e479e=>Array(_0x1eb1a0[_0x35b3ef([0x6c,0x65,0x6e,0x67,0x74,0x68])]-_0x3e479e[_0x35b3ef([0x6c,0x65,0x6e,0x67,0x74,0x68])])[_0x35b3ef([0x66,0x69,0x6c,0x6c])](_0x3e479e[0x0]===_0x35b3ef([0x2a])?_0x35b3ef([0x2a]):'')[_0x35b3ef([0x63,0x6f,0x6e,0x63,0x61,0x74])](_0x3e479e))[_0x35b3ef([0x73,0x6f,0x6d,0x65])](_0xfccabd=>_0x1eb1a0[_0x35b3ef([0x65,0x76,0x65,0x72,0x79])]((_0x1a4076,_0x36384e)=>_0xfccabd[_0x36384e]===_0x1a4076||_0xfccabd[_0x36384e]===_0x35b3ef([0x2a])));}function _0x8d80b0(){return _0x2f8c8e&&_0x54d1bf?new window[(_0x35b3ef([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))]((_0x4a767b,_0x5c4f04)=>{_0x2f8c8e[_0x35b3ef([0x74,0x68,0x65,0x6e])](_0x4a767b,_0x5c4f04),_0x54d1bf[_0x35b3ef([0x74,0x68,0x65,0x6e])](_0x44adda=>{_0x44adda!=_0x35b3ef([0x56,0x61,0x6c,0x69,0x64])&&_0x4a767b(_0x44adda);},_0x5c4f04);}):_0x2f8c8e||_0x54d1bf||_0x35b3ef([0x56,0x61,0x6c,0x69,0x64]);}}function _0x32a6a3(_0x37ea1d,_0x269cd0){return new window[(_0x35b3ef([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x104f66=>{if(_0x5a5262())return _0x104f66(_0x35b3ef([0x56,0x61,0x6c,0x69,0x64]));_0x1cb22a(),_0x13b980[_0x35b3ef([0x64,0x65,0x63,0x6f,0x72,0x61,0x74,0x65])](_0x35b3ef([0x5f,0x73,0x65,0x6e,0x64,0x55,0x73,0x61,0x67,0x65,0x52,0x65,0x71,0x75,0x65,0x73,0x74]));let _0x52da06=!0x1;const _0x25ba0a=at();function _0x1fd86a(_0x207aff){return!!_0x207aff&&(typeof _0x207aff===_0x35b3ef([0x6f,0x62,0x6a,0x65,0x63,0x74])||typeof _0x207aff===_0x35b3ef([0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e]))&&typeof _0x207aff[_0x35b3ef([0x74,0x68,0x65,0x6e])]===_0x35b3ef([0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e])&&typeof _0x207aff[_0x35b3ef([0x63,0x61,0x74,0x63,0x68])]===_0x35b3ef([0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e]);}function _0x34fa97(_0x4940b0){_0x53a553(_0x4940b0)[_0x35b3ef([0x74,0x68,0x65,0x6e])](_0x395241=>{if(!_0x395241||_0x395241[_0x35b3ef([0x73,0x74,0x61,0x74,0x75,0x73])]!=_0x35b3ef([0x6f,0x6b]))return _0x35b3ef([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]);return _0x5c227e(_0x5b6dc3(_0x25ba0a+_0x269cd0))!=_0x395241[_0x35b3ef([0x76,0x65,0x72,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6f,0x6e])]?_0x35b3ef([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]):_0x35b3ef([0x56,0x61,0x6c,0x69,0x64]);})[_0x35b3ef([0x74,0x68,0x65,0x6e])](_0x2a6535=>(_0x46268d(),_0x2a6535),()=>{const _0x1bddb8=_0x3fb2d4();return null==_0x1bddb8?(_0x46268d(),_0x35b3ef([0x56,0x61,0x6c,0x69,0x64])):_0x35b3ef(_0x121059-_0x1bddb8>(0x19f340e1^_0x2f73d4)?[0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]:[0x56,0x61,0x6c,0x69,0x64]);})[_0x35b3ef([0x74,0x68,0x65,0x6e])](_0x104f66)[_0x35b3ef([0x63,0x61,0x74,0x63,0x68])](()=>{_0x104f66(_0x35b3ef([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]));});const _0x2bd3ee=0x3dc92a61^_0x2f73d4;function _0x46268d(){const _0x5a86d4=_0x35b3ef([0x6c,0x6c,0x63,0x74,0x2d])+_0x5c227e(_0x5b6dc3(_0x37ea1d)),_0x6542f0=_0x30aac4(_0x5c227e(window[_0x35b3ef([0x4d,0x61,0x74,0x68])][_0x35b3ef([0x63,0x65,0x69,0x6c])](_0x121059/_0x2bd3ee)));window[_0x35b3ef([0x6c,0x6f,0x63,0x61,0x6c,0x53,0x74,0x6f,0x72,0x61,0x67,0x65])][_0x35b3ef([0x73,0x65,0x74,0x49,0x74,0x65,0x6d])](_0x5a86d4,_0x6542f0);}function _0x3fb2d4(){const _0x5c07e6=_0x35b3ef([0x6c,0x6c,0x63,0x74,0x2d])+_0x5c227e(_0x5b6dc3(_0x37ea1d)),_0x3cb774=window[_0x35b3ef([0x6c,0x6f,0x63,0x61,0x6c,0x53,0x74,0x6f,0x72,0x61,0x67,0x65])][_0x35b3ef([0x67,0x65,0x74,0x49,0x74,0x65,0x6d])](_0x5c07e6);return _0x3cb774?window[_0x35b3ef([0x70,0x61,0x72,0x73,0x65,0x49,0x6e,0x74])](_0x30aac4(_0x3cb774),0x10)*_0x2bd3ee:null;}function _0x53a553(_0x1d6d9c){return new window[(_0x35b3ef([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))]((_0x4ce61a,_0x3d4689)=>{_0x1d6d9c[_0x35b3ef([0x74,0x68,0x65,0x6e])](_0x4ce61a,_0x3d4689),window[_0x35b3ef([0x73,0x65,0x74,0x54,0x69,0x6d,0x65,0x6f,0x75,0x74])](_0x3d4689,0x3dfe1021^_0x2f73d4);});}}_0x13b980[_0x35b3ef([0x6f,0x6e])](_0x35b3ef([0x5f,0x73,0x65,0x6e,0x64,0x55,0x73,0x61,0x67,0x65,0x52,0x65,0x71,0x75,0x65,0x73,0x74]),(_0x205c9b,_0x5ea917)=>{if(_0x5ea917[0x0]!=_0x37ea1d)return _0x104f66(_0x35b3ef([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]));_0x5ea917[0x1]={..._0x5ea917[0x1],[_0x35b3ef([0x72,0x65,0x71,0x75,0x65,0x73,0x74,0x49,0x64])]:_0x25ba0a};},{[_0x35b3ef([0x70,0x72,0x69,0x6f,0x72,0x69,0x74,0x79])]:_0x35b3ef([0x68,0x69,0x67,0x68])}),_0x13b980[_0x35b3ef([0x6f,0x6e])](_0x35b3ef([0x5f,0x73,0x65,0x6e,0x64,0x55,0x73,0x61,0x67,0x65,0x52,0x65,0x71,0x75,0x65,0x73,0x74]),_0x4c6278=>{_0x1fd86a(_0x4c6278[_0x35b3ef([0x72,0x65,0x74,0x75,0x72,0x6e])])&&(_0x52da06=!0x0,_0x34fa97(_0x4c6278[_0x35b3ef([0x72,0x65,0x74,0x75,0x72,0x6e])]));},{[_0x35b3ef([0x70,0x72,0x69,0x6f,0x72,0x69,0x74,0x79])]:_0x35b3ef([0x6c,0x6f,0x77])}),_0x357eb5[_0x35b3ef([0x74,0x68,0x65,0x6e])](()=>{_0x52da06||_0x104f66(_0x35b3ef([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]));});});function _0x5a5262(){return _0x13b980[_0x35b3ef([0x65,0x64,0x69,0x74,0x69,0x6e,0x67])][_0x35b3ef([0x76,0x69,0x65,0x77])][_0x35b3ef([0x5f,0x6f,0x76,0x65,0x72,0x6c,0x61,0x79,0x4d,0x6f,0x64,0x65,0x48,0x69,0x6e,0x74])]==_0x35b3ef([0x61,0x75,0x74,0x6f]);}function _0x1cb22a(){_0x13b980[_0x35b3ef([0x65,0x64,0x69,0x74,0x69,0x6e,0x67])][_0x35b3ef([0x76,0x69,0x65,0x77])][_0x35b3ef([0x5f,0x6f,0x76,0x65,0x72,0x6c,0x61,0x79,0x4d,0x6f,0x64,0x65,0x48,0x69,0x6e,0x74])]=_0x35b3ef([0x61,0x75,0x74,0x6f]);}}function _0x205aa4(_0x341579){const _0x8bb786=[new window[(_0x35b3ef([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x16ad54=>setTimeout(_0x16ad54,0x3df6fa2d^_0x2f73d4)),_0x357eb5[_0x35b3ef([0x74,0x68,0x65,0x6e])](()=>new window[(_0x35b3ef([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x25d66e=>{let _0x16181b=0x0;_0x13b980[_0x35b3ef([0x6d,0x6f,0x64,0x65,0x6c])][_0x35b3ef([0x6f,0x6e])](_0x35b3ef([0x61,0x70,0x70,0x6c,0x79,0x4f,0x70,0x65,0x72,0x61,0x74,0x69,0x6f,0x6e]),(_0x54d97c,_0x33a874)=>{_0x33a874[0x0][_0x35b3ef([0x69,0x73,0x44,0x6f,0x63,0x75,0x6d,0x65,0x6e,0x74,0x4f,0x70,0x65,0x72,0x61,0x74,0x69,0x6f,0x6e])]&&_0x16181b++,_0x16181b==(0x3dffc109^_0x2f73d4)&&(_0x25d66e(),_0x54d97c[_0x35b3ef([0x6f,0x66,0x66])]());});}))];return window[_0x35b3ef([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65])][_0x35b3ef([0x72,0x61,0x63,0x65])](_0x8bb786)[_0x35b3ef([0x74,0x68,0x65,0x6e])](()=>_0x341579);}async function _0x7264ef(){await _0x357eb5,_0x13b980[_0x35b3ef([0x6d,0x6f,0x64,0x65,0x6c])][_0x35b3ef([0x63,0x68,0x61,0x6e,0x67,0x65])]=_0x474edb,_0x13b980[_0x35b3ef([0x6d,0x6f,0x64,0x65,0x6c])][_0x35b3ef([0x65,0x6e,0x71,0x75,0x65,0x75,0x65,0x43,0x68,0x61,0x6e,0x67,0x65])]=_0x474edb,_0x13b980[_0x35b3ef([0x65,0x6e,0x61,0x62,0x6c,0x65,0x52,0x65,0x61,0x64,0x4f,0x6e,0x6c,0x79,0x4d,0x6f,0x64,0x65])](_0x35b3ef([0x6d,0x6f,0x64,0x65,0x6c]));}function _0x498c02(_0x51d469){const _0x410233=_0xc11adc();_0x13b980[_0x410233]=_0x35b3ef([0x61,0x69,0x4c,0x69,0x63,0x65,0x6e,0x73,0x65,0x4b,0x65,0x79])+_0x51d469,_0x51d469!=_0x35b3ef([0x56,0x61,0x6c,0x69,0x64])&&_0x7264ef();}function _0xc11adc(){const _0x49e0d2=window[_0x35b3ef([0x53,0x74,0x72,0x69,0x6e,0x67])](window[_0x35b3ef([0x70,0x65,0x72,0x66,0x6f,0x72,0x6d,0x61,0x6e,0x63,0x65])][_0x35b3ef([0x6e,0x6f,0x77])]())[_0x35b3ef([0x72,0x65,0x70,0x6c,0x61,0x63,0x65])](_0x35b3ef([0x2e]),'');let _0x15dcf6=_0x35b3ef([0x6e]);for(let _0x6379e0=0x0;_0x6379e0<_0x49e0d2[_0x35b3ef([0x6c,0x65,0x6e,0x67,0x74,0x68])];_0x6379e0+=0x2){let _0x50ac00=window[_0x35b3ef([0x70,0x61,0x72,0x73,0x65,0x49,0x6e,0x74])](_0x49e0d2[_0x35b3ef([0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e,0x67])](_0x6379e0,_0x6379e0+0x2));_0x50ac00>=_0x251610[_0x35b3ef([0x6c,0x65,0x6e,0x67,0x74,0x68])]&&(_0x50ac00-=_0x251610[_0x35b3ef([0x6c,0x65,0x6e,0x67,0x74,0x68])]),_0x15dcf6+=_0x251610[_0x50ac00];}return _0x15dcf6;}function _0x3c9207(){const _0x48f397=_0x516fdc[_0x35b3ef([0x73,0x70,0x6c,0x69,0x74])](_0x35b3ef([0x2e]));if(0x3!=_0x48f397[_0x35b3ef([0x6c,0x65,0x6e,0x67,0x74,0x68])])return null;return _0x269a1c(_0x48f397[0x1]);function _0x269a1c(_0x2ca901){const _0x209704=_0x28f55e(_0x2ca901);return _0x209704&&_0x4a0fc2()?_0x209704:null;function _0x4a0fc2(){const _0x41237c=_0x209704[_0x35b3ef([0x6a,0x74,0x69])],_0x4f2492=window[_0x35b3ef([0x70,0x61,0x72,0x73,0x65,0x49,0x6e,0x74])](_0x41237c[_0x35b3ef([0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e,0x67])](_0x41237c[_0x35b3ef([0x6c,0x65,0x6e,0x67,0x74,0x68])]-0x8),0x10),_0x1c3e8b={..._0x209704,[_0x35b3ef([0x6a,0x74,0x69])]:_0x41237c[_0x35b3ef([0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e,0x67])](0x0,_0x41237c[_0x35b3ef([0x6c,0x65,0x6e,0x67,0x74,0x68])]-0x8)};return delete _0x1c3e8b[_0x35b3ef([0x76,0x63])],_0x5b6dc3(_0x1c3e8b)==_0x4f2492;}}}async function _0x39fad6(){let _0x23d84c=!0x0;try{const _0x17b32a=_0x516fdc[_0x35b3ef([0x73,0x70,0x6c,0x69,0x74])](_0x35b3ef([0x2e])),[_0x58bee5,_0x4b8ff0,_0x3760fc]=_0x17b32a;return _0x3ec837(_0x58bee5),await _0x205146(_0x58bee5,_0x4b8ff0,_0x3760fc),_0x23d84c;}catch{return!0x1;}function _0x3ec837(_0x28c86a){const _0x749894=_0x28f55e(_0x28c86a);_0x749894&&_0x749894[_0x35b3ef([0x61,0x6c,0x67])]==_0x35b3ef([0x45,0x53,0x32,0x35,0x36])||(_0x23d84c=!0x1);}async function _0x205146(_0x2c7610,_0x5dc864,_0x5aa181){const _0x4a56fa=window[_0x35b3ef([0x55,0x69,0x6e,0x74,0x38,0x41,0x72,0x72,0x61,0x79])][_0x35b3ef([0x66,0x72,0x6f,0x6d])](_0x5c866d(_0x5aa181),_0x4268f3=>_0x4268f3[_0x35b3ef([0x63,0x68,0x61,0x72,0x43,0x6f,0x64,0x65,0x41,0x74])](0x0)),_0x4a7bb2=new window[(_0x35b3ef([0x54,0x65,0x78,0x74,0x45,0x6e,0x63,0x6f,0x64,0x65,0x72]))]()[_0x35b3ef([0x65,0x6e,0x63,0x6f,0x64,0x65])](_0x2c7610+_0x35b3ef([0x2e])+_0x5dc864),_0x133d5b=window[_0x35b3ef([0x63,0x72,0x79,0x70,0x74,0x6f])][_0x35b3ef([0x73,0x75,0x62,0x74,0x6c,0x65])];if(!_0x133d5b)return;const _0x1c21ad=await _0x133d5b[_0x35b3ef([0x69,0x6d,0x70,0x6f,0x72,0x74,0x4b,0x65,0x79])](_0x35b3ef([0x6a,0x77,0x6b]),_0x339df7,{[_0x35b3ef([0x6e,0x61,0x6d,0x65])]:_0x35b3ef([0x45,0x43,0x44,0x53,0x41]),[_0x35b3ef([0x6e,0x61,0x6d,0x65,0x64,0x43,0x75,0x72,0x76,0x65])]:_0x35b3ef([0x50,0x2d,0x32,0x35,0x36])},!0x1,[_0x35b3ef([0x76,0x65,0x72,0x69,0x66,0x79])]);await _0x133d5b[_0x35b3ef([0x76,0x65,0x72,0x69,0x66,0x79])]({[_0x35b3ef([0x6e,0x61,0x6d,0x65])]:_0x35b3ef([0x45,0x43,0x44,0x53,0x41]),[_0x35b3ef([0x68,0x61,0x73,0x68])]:{[_0x35b3ef([0x6e,0x61,0x6d,0x65])]:_0x35b3ef([0x53,0x48,0x41,0x2d,0x32,0x35,0x36])}},_0x1c21ad,_0x4a56fa,_0x4a7bb2)||(_0x23d84c=!0x1);}}function _0x28f55e(_0x294c37){return _0x294c37[_0x35b3ef([0x73,0x74,0x61,0x72,0x74,0x73,0x57,0x69,0x74,0x68])](_0x35b3ef([0x65,0x79]))?JSON[_0x35b3ef([0x70,0x61,0x72,0x73,0x65])](_0x5c866d(_0x294c37)):null;}function _0x5c866d(_0x56422c){return window[_0x35b3ef([0x61,0x74,0x6f,0x62])](_0x56422c[_0x35b3ef([0x72,0x65,0x70,0x6c,0x61,0x63,0x65])](/-/g,_0x35b3ef([0x2b]))[_0x35b3ef([0x72,0x65,0x70,0x6c,0x61,0x63,0x65])](/_/g,_0x35b3ef([0x2f])));}function _0x5b6dc3(_0x313786){let _0x1bfc29=0x1505;function _0x397ae7(_0x3ef4e8){for(let _0x386061=0x0;_0x386061<_0x3ef4e8[_0x35b3ef([0x6c,0x65,0x6e,0x67,0x74,0x68])];_0x386061++){const _0x4de355=_0x3ef4e8[_0x35b3ef([0x63,0x68,0x61,0x72,0x43,0x6f,0x64,0x65,0x41,0x74])](_0x386061);_0x1bfc29=(_0x1bfc29<<0x5)+_0x1bfc29+_0x4de355,_0x1bfc29&=_0x1bfc29;}}function _0x52d16f(_0x22807c){Array[_0x35b3ef([0x69,0x73,0x41,0x72,0x72,0x61,0x79])](_0x22807c)?_0x22807c[_0x35b3ef([0x66,0x6f,0x72,0x45,0x61,0x63,0x68])](_0x52d16f):_0x22807c&&typeof _0x22807c==_0x35b3ef([0x6f,0x62,0x6a,0x65,0x63,0x74])?Object[_0x35b3ef([0x65,0x6e,0x74,0x72,0x69,0x65,0x73])](_0x22807c)[_0x35b3ef([0x73,0x6f,0x72,0x74])]()[_0x35b3ef([0x66,0x6f,0x72,0x45,0x61,0x63,0x68])](([_0x1fe037,_0x423d3c])=>{_0x397ae7(_0x1fe037),_0x52d16f(_0x423d3c);}):_0x397ae7(window[_0x35b3ef([0x53,0x74,0x72,0x69,0x6e,0x67])](_0x22807c));}return _0x52d16f(_0x313786),_0x1bfc29>>>0x0;}function _0x5c227e(_0xe7b80e){return _0xe7b80e[_0x35b3ef([0x74,0x6f,0x53,0x74,0x72,0x69,0x6e,0x67])](0x10)[_0x35b3ef([0x70,0x61,0x64,0x53,0x74,0x61,0x72,0x74])](0x8,_0x35b3ef([0x30]));}function _0x30aac4(_0x3078db){return _0x3078db[_0x35b3ef([0x73,0x70,0x6c,0x69,0x74])]('')[_0x35b3ef([0x72,0x65,0x76,0x65,0x72,0x73,0x65])]()[_0x35b3ef([0x6a,0x6f,0x69,0x6e])]('');}function _0x474edb(){}function _0x35b3ef(_0x293b58){return _0x293b58['map'](_0x5ecf93=>String['fromCharCode'](_0x5ecf93))['join']('');}_0x498c02(await _0x1d9421());}(this);}['showFakeVisualSelection'](){const _0x5befe5=this['editor']['model'];_0x5befe5['change'](_0x382cfc=>{const _0x4bf419=_0x5befe5['document']['selection']['getRanges']();let _0x4e9db0=0x0;for(const _0x3e39bc of _0x4bf419){const _0x4cc44f=bi+':'+_0x4e9db0;if(_0x5befe5['markers']['has'](_0x4cc44f))_0x382cfc['updateMarker'](_0x4cc44f,{'range':_0x3e39bc});else{if(_0x3e39bc['start']['isAtEnd']){const _0x29cfaf=_0x3e39bc['start']['getLastMatchingPosition'](({item:_0x450fb9})=>!_0x5befe5['schema']['isContent'](_0x450fb9),{'boundaries':_0x3e39bc});_0x382cfc['addMarker'](_0x4cc44f,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x382cfc['createRange'](_0x29cfaf,_0x3e39bc['end'])});}else _0x382cfc['addMarker'](_0x4cc44f,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x3e39bc});}_0x4e9db0++;}});}['hideFakeVisualSelection'](){const _0x3390fd=this['editor']['model'],_0x229a12=Array['from'](this['editor']['model']['markers']['getMarkersGroup'](bi));_0x229a12['length']&&_0x3390fd['change'](_0x389b66=>{_0x229a12['forEach'](_0x5bb532=>{_0x389b66['removeMarker'](_0x5bb532);});});}['insertContent'](_0x3afd5c,_0x214d04){const _0x5a2114=this['_getAISelection'](),_0x38b22a=_0x214d04||_0x5a2114['getFirstRange']();this['editor']['model']['canEditAt'](_0x38b22a)&&this['editor']['model']['change'](_0x1f5ccd=>{this['hideFakeVisualSelection'](),_0x214d04||this['_resetContentOfSelectedTableCells'](_0x1f5ccd,_0x5a2114),this['_pasteHTMLUsingClipboard']({'insertAt':_0x38b22a,'writer':_0x1f5ccd,'html':_0x3afd5c});});}['insertContentBelow'](_0x3c44d2){const {model:_0x201fde}=this['editor'],_0x57135c=this['_getAISelection']();_0x201fde['change'](()=>{const _0x2e31f0=this['_prepareTableInsertBelowPosition'](_0x3c44d2,_0x57135c)||this['_getDefaultInsertBelowPosition'](_0x57135c);this['insertContent'](_0x3c44d2,_0x2e31f0);});}['_getAISelection'](){const _0x2a1675=this['editor']['model'],_0x5a5f6d=Array['from'](_0x2a1675['markers']['getMarkersGroup'](bi))['map'](_0x432aa4=>_0x432aa4['getRange']());return _0x2a1675['createSelection'](_0x5a5f6d);}['_pasteHTMLUsingClipboard']({writer:_0x5b03a6,html:_0x18b0e9,insertAt:_0x571500}){const {view:_0x11ecfe}=this['editor']['editing'],_0x513f72=this['editor']['plugins']['get'](_0x3935c8),_0xe4380d=new Ri();_0xe4380d['setData']('text/html',_0x18b0e9);const _0xd6e572=new ClipboardEvent('paste',{'clipboardData':_0xe4380d}),_0x5dd6ff=new _0xddfd54(_0x11ecfe,_0xd6e572,{'dataTransfer':new _0x9e414f(_0xe4380d)});_0x5b03a6['setSelection'](_0x571500);const _0x1c20b5=(_0x5555da,_0x52005e)=>{_0x52005e['resultRange']&&_0x5b03a6['setSelection'](_0x52005e['resultRange']);};_0x513f72['once']('contentInsertion',_0x1c20b5,{'priority':'lowest'}),_0x11ecfe['document']['fire']('paste',_0x5dd6ff),_0x513f72['off']('contentInsertion',_0x1c20b5);}['_getDefaultInsertBelowPosition'](_0x346789){const {model:_0x591adc}=this['editor'],_0x3fe738=Array['from'](_0x346789['getSelectedBlocks']());return _0x3fe738['length']?_0x591adc['createPositionAfter'](_0x3fe738['pop']()):_0x346789['getLastPosition']();}['_prepareTableInsertBelowPosition'](_0x129d34,_0x1cf8a8){const {model:_0x28cb46,plugins:_0x103e55}=this['editor'];if(_0x103e55['has']('TableUtils')){const _0x5977de=_0x103e55['get']('TableUtils')['getSelectedTableCells'](_0x1cf8a8);if(_0x5977de['length']){const _0x3c710e=this['_getTableRowCountFromContent'](_0x129d34),_0x323ba2=this['_createEmptyTableRows'](_0x5977de,_0x3c710e);return _0x28cb46['createPositionAt'](_0x323ba2,0x0);}}return null;}['_getTableRowCountFromContent'](_0x45a1f4){const _0x1a6b20=this['editor']['plugins']['get']('TableUtils'),_0x126c60=this['editor']['data']['parse'](_0x45a1f4,'$documentFragment'),_0x4c5dc0=Array['from'](_0x126c60['getChildren']())['filter'](_0x35d80a=>_0x35d80a['is']('element','table'));let _0x5dc0b3=0x0;return _0x4c5dc0['forEach'](_0x42e794=>{_0x5dc0b3+=_0x1a6b20['getRows'](_0x42e794);}),_0x5dc0b3;}['_createEmptyTableRows'](_0x5af76e,_0x6dbc64){const _0x89c495=this['editor']['plugins']['get']('TableUtils'),_0x59d8ff=_0x89c495['getRowIndexes'](_0x5af76e),_0xd413a9=_0x89c495['getColumnIndexes'](_0x5af76e),_0x4d5e73=_0x59d8ff['last']+0x1,_0x296f6a=_0xd413a9['first'],_0x4d396e=_0x5af76e[0x0]['findAncestor']('table');for(let _0x113b9e=0x0;_0x113b9e<_0x6dbc64;_0x113b9e++)_0x89c495['insertRows'](_0x4d396e,{'at':_0x4d5e73});return _0x4d396e['getChild'](_0x4d5e73)['getChild'](_0x296f6a);}['_resetContentOfSelectedTableCells'](_0x58c36f,_0x554154){const {plugins:_0x345b12}=this['editor'],{model:_0x3eccb9}=_0x58c36f;if(!_0x345b12['has']('TableUtils'))return;_0x345b12['get']('TableUtils')['getSelectedTableCells'](_0x554154)['length']&&_0x3eccb9['deleteContent'](_0x554154);}}class AIAdapter extends _0x3da4a3{static get['pluginName'](){return'AIAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['afterInit'](){if(!this['textAdapter'])throw new ht('aiadapter-text-adapter-not-set',null);}}class AIRequestError extends Error{constructor(_0x29c484){super(_0x29c484),this['name']='AIRequestError';}}function Si(_0x501103,_0x4f74c3,_0x1b4ff3){const t=_0x501103['t'];switch(_0x4f74c3){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',_0x1b4ff3);case'Error\x20during\x20AI\x20content\x20generation:\x20%0':return t('Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x1b4ff3);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'},_0x1b4ff3);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 _0x4f74c3;}}class ShowAIAssistantCommand extends _0x16583a{['_commandDefinitions'];constructor(_0x206a63,_0x247cc8){super(_0x206a63),this['_commandDefinitions']=_0x247cc8,this['set']('enabledCommandsIds',[]),this['on']('change:_hasContext',(_0x416eb1,_0x13cbb8,_0x5ae925)=>{this['isEnabled']&&(this['enabledCommandsIds']=Oi(this['_commandDefinitions'],_0x5ae925));}),this['set']('_hasContext',!0x1),this['on']('change:isEnabled',(_0xe24194,_0x45162e,_0x31561f)=>{this['enabledCommandsIds']=_0x31561f?Oi(this['_commandDefinitions'],this['_hasContext']):[];});}['refresh'](){const _0x3b2939=this['editor']['model'];this['_hasContext']=function(_0x21a1e1){const _0x39229e=_0x21a1e1['document']['selection'];return _0x39229e['isCollapsed']?0x0!==[..._0x39229e['getSelectedBlocks']()]['length']&&![..._0x39229e['getSelectedBlocks']()][0x0]['isEmpty']:!!_0x21a1e1['hasContent'](_0x39229e['getFirstRange']());}(_0x3b2939);const _0x43b3e6=_0x3b2939['document']['selection'],_0x317f02=this['editor']['config']['get']('ai.assistant.disabledElements');for(const _0x3a7a72 of _0x43b3e6['getRanges']())for(const _0x1909bc of _0x3a7a72['getItems']())if(_0x1909bc['is']('element')&&_0x317f02['includes'](_0x1909bc['name']))return void(this['isEnabled']=!0x1);this['isEnabled']=!0x0;}['execute'](_0x34e238='',_0x4d229c='',_0x1edaed='custom'){this['editor']['plugins']['get'](AIAssistantUI)['showUI'](_0x34e238,_0x4d229c,_0x1edaed);}}function Oi(_0x42f5a6,_0x217a04){const _0xe9bcad=new Set();for(const _0x26b8ca of _0x42f5a6['values']())(_0x217a04||!0x1===_0x26b8ca['requiresContent'])&&_0xe9bcad['add'](_0x26b8ca['id']);return Array['from'](_0xe9bcad);}const vi=new RegExp(/^(.*?)<[a-zA-Z][a-zA-Z0-9_\-.]*[ >]/,'is');class AIAssistantController extends/* #__PURE__ -- @preserve */
24
+ ct(){['editor'];['textAdapter'];['view'];['_sanitizationContainer'];['_domParser'];['_xmlSerializer'];constructor(_0x16c39a,_0x1166b4,_0x584480){super(),this['editor']=_0x16c39a,this['textAdapter']=_0x1166b4,this['_sanitizationContainer']=document['createElement']('div'),this['_domParser']=new DOMParser(),this['_xmlSerializer']=new XMLSerializer(),this['view']=_0x584480,this['set']({'initialContext':'','currentContext':'','currentResponse':'','previousContext':void 0x0,'previousQuery':void 0x0,'previousLabel':void 0x0,'isProcessing':!0x1}),this['on']('set:currentContext',(_0xbc47b6,_0x34b789,_0x1ad0c9)=>{this['view']['value']=this['_sanitizeHTML'](_0x1ad0c9);}),this['listenTo'](this['view'],'submitPrompt',(_0x5a73e5,_0x379a9c)=>{const _0x42efba=this['currentContext']||this['initialContext'];this['_handleQuery'](_0x379a9c,_0x42efba,'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:_0x4768a3,query:_0x1ba3cf,htmlContent:_0x2a5b3b,label:_0x557258,mainActionLabel:_0x2c855b}){this['view']['prompt']=_0x557258,this['view']['mainAction']=_0x2c855b,this['initialContext']=_0x2a5b3b,_0x1ba3cf&&(this['view']['isRendered']?this['_handleQuery'](_0x1ba3cf,_0x2a5b3b,_0x4768a3,_0x557258):this['view']['once']('render',()=>{this['_handleQuery'](_0x1ba3cf,_0x2a5b3b,_0x4768a3,_0x557258);}));}['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'](_0x4c146a,_0x36e1df,_0x24efe9,_0x57ff34){return this['isProcessing']=!0x0,this['view']['startProcessing'](),this['previousContext']=_0x36e1df,this['previousQuery']=_0x4c146a,this['previousLabel']=_0x57ff34||_0x4c146a,this['previousActionId']=_0x24efe9,new Promise(_0x665afd=>{this['textAdapter']['makeRequest']({'query':_0x4c146a,'context':_0x36e1df,'onData':_0x821c2a=>{this['currentResponse']=_0x821c2a,this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse']);},'actionId':_0x24efe9})['then'](()=>{!this['currentContext']&&this['currentResponse']&&(this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse'],!0x0));})['catch'](_0x3dd234=>{_0x3dd234 instanceof AIRequestError?this['view']['handleError'](_0x3dd234['message']):this['view']['handleError'](),_0x665afd();})['finally'](()=>{this['stopProcessing'](),_0x665afd();});});}['_parseAndNormalizeContent'](_0x13bf70,_0x29dc8a=!0x1){const _0x1b8d16=vi['exec'](_0x13bf70);_0x13bf70=_0x1b8d16?_0x13bf70['substring'](_0x1b8d16[0x1]['length']):_0x13bf70['length']<0x64&&!_0x29dc8a?'':this['_stripMarkdownSyntax'](_0x13bf70);const _0x6638f5=this['_domParser']['parseFromString'](_0x13bf70,'text/html');if(_0x1b8d16){const _0x5447ba=Array['from'](_0x6638f5['body']['childNodes']);_0x5447ba['reverse']();for(const _0x65af6e of _0x5447ba){if(_0x65af6e['nodeType']==Node['ELEMENT_NODE'])break;_0x65af6e['remove']();}}const _0x3ef1ab=this['editor']['data']['processor']['toView'](this['_xmlSerializer']['serializeToString'](_0x6638f5['body']));this['_isH1TagSupportEnabled']()||this['_normalizeResponseHeadings'](_0x3ef1ab);const _0x1d37b7=this['editor']['config']['get']('ai.assistant.preserveComments'),_0x195c1b=this['editor']['data']['toModel'](_0x3ef1ab);return _0x1d37b7||_0x195c1b['markers']['clear'](),this['editor']['data']['stringify'](_0x195c1b);}['_normalizeResponseHeadings'](_0xb03056){const _0x3d5c93=new _0xdb4e91(this['editor']['editing']['view']['document']),_0x451387=new _0x8878bd({'name':/^h[1-5]$/}),_0x3ba28e=[];let _0x49146c=!0x1;for(const _0x4ff18e of _0xb03056)_0x4ff18e['is']('element')&&_0x451387['match'](_0x4ff18e)&&(_0x3ba28e['push'](_0x4ff18e),'h1'==_0x4ff18e['name']&&(_0x49146c=!0x0));if(_0x49146c){for(const _0x53ee45 of _0x3ba28e)_0x3d5c93['rename']('h'+(parseInt(_0x53ee45['name'][0x1])+0x1),_0x53ee45);}}['_isH1TagSupportEnabled'](){const {data:_0x3dfe1,editing:_0x176076}=this['editor'],_0x1822c8=_0x3dfe1['htmlProcessor']['toView']('<h1></h1>'),_0x42aea5=_0x3dfe1['toView'](_0x3dfe1['toModel'](_0x1822c8));return!!_0x176076['view']['domConverter']['viewToDom'](_0x42aea5)['querySelector']('h1');}['_sanitizeHTML'](_0x17e871){return this['editor']['editing']['view']['domConverter']['setContentOf'](this['_sanitizationContainer'],_0x17e871),this['_sanitizationContainer']['innerHTML'];}['_stripMarkdownSyntax'](_0x284b63){const _0x5ec896=_0x284b63['trim']();return _0x5ec896['startsWith']('```html')?_0x5ec896['endsWith']('```')?_0x5ec896['substring'](0x7,_0x5ec896['length']-0x3):_0x5ec896['substring'](0x7):_0x284b63;}}const ki={'REPLACE':'replace','INSERT':'insert'};class AIFormToolbarView extends kt{constructor(_0x28749a){super(_0x28749a),this['set']('isVisible',!0x1),this['set']('mainAction',ki['REPLACE']),this['replaceButton']=this['_createButton']('','ck-button-action'),this['replaceButton']['bind']('label')['to'](this,'mainAction',_0x468f9d=>Si(_0x28749a,'AI_'+_0x468f9d['toUpperCase']()+'_CONTENT')),this['insertButton']=this['_createButton'](Si(_0x28749a,'Insert\x20below')),this['tryAgainButton']=this['_createButton'](Si(_0x28749a,'Try\x20again')),this['stopButton']=this['_createButton'](Si(_0x28749a,'Stop'));const _0x2d5e0b=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-form__toolbar',_0x2d5e0b['if']('isVisible','ck-hidden',_0x4ea3eb=>!_0x4ea3eb)]}}),this['items']['addMany']([this['replaceButton'],this['insertButton'],this['tryAgainButton'],this['stopButton']]);}['_createButton'](_0x3bf6cb,_0x1b800d){const _0x2edfe6=new yt(this['locale']);return _0x2edfe6['set']({'label':_0x3bf6cb,'class':_0x1b800d||'','isVisible':!0x0,'withText':!0x0}),_0x2edfe6;}}class AIFormContentArea extends Nt{['contentFieldView'];['copyButtonView'];constructor(_0x47062b,_0x42d24a=''){super(_0x47062b),this['set']({'value':null,'isVisible':!0x1,'isProcessing':!0x1});const _0x350d98=this['bindTemplate'];this['contentFieldView']=new ContentFieldView(_0x47062b,_0x42d24a),this['copyButtonView']=this['_createCopyButton'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area-wrapper',_0x350d98['if']('isVisible','ck-hidden',_0xb332af=>!_0xb332af)],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area',_0x350d98['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 _0xd32d6f=!0x1;this['on']('change:value',(_0x493737,_0x4a4cba,_0x43b81b)=>{const _0x51da4f=!this['contentFieldView']['element']['querySelector']('.ck-ai-form__loader');this['contentFieldView']['setContent'](_0x43b81b),this['isProcessing']&&_0x51da4f&&!_0xd32d6f&&this['element']['scrollTo']({'top':this['element']['scrollHeight'],'behavior':'smooth'});}),this['on']('change:isProcessing',(_0x725090,_0x10a41d,_0x2b0efd)=>{_0xd32d6f=!0x1,_0x2b0efd?(this['value']=null,this['contentFieldView']['appendLoader']()):this['value']||this['contentFieldView']['setContent']('');}),this['listenTo'](this['element'],'wheel',()=>{_0xd32d6f=!0x0;}),this['listenTo'](this['element'],'mousedown',()=>{_0xd32d6f=!0x0;});}['focus'](){this['element']['focus']();}['_createCopyButton'](){const _0x2c6514=this['locale'],_0x54e3a7=new yt(this['locale']),_0x425437='ck-ai-form__copy-button';return _0x54e3a7['set']({'label':Si(_0x2c6514,'Copy'),'icon':_0x49b34b,'class':_0x425437,'tooltip':!0x0}),_0x54e3a7['bind']('isVisible')['to'](this,'value',_0x28c5bc=>!!_0x28c5bc),_0x54e3a7['bind']('isEnabled')['to'](this,'isProcessing',_0x49efb7=>!_0x49efb7),_0x54e3a7['on']('execute',()=>{this['_copyHTMLToClipboard'](this['contentFieldView']['element']),_0x54e3a7['icon']=_0x379fc9,_0x54e3a7['class']=_0x425437+'\x20ck-ai-form__copy-button--copied',this['focus'](),setTimeout(()=>{_0x54e3a7['icon']=_0x49b34b,_0x54e3a7['class']=_0x425437;},0x3e8);}),_0x54e3a7;}['_copyHTMLToClipboard'](_0x40b820){const {window:_0x861729,document:_0x169611}=lt;if(_0x861729['ClipboardItem']){const {Blob:_0x5e5501,ClipboardItem:_0x2bfa6c}=_0x861729,_0x332bca=[new _0x2bfa6c({'text/html':new _0x5e5501([_0x40b820['innerHTML']],{'type':'text/html'}),'text/plain':new _0x5e5501([_0x40b820['textContent']||''],{'type':'text/plain'})})];navigator['clipboard']['write'](_0x332bca);}else{const _0x529bb4=_0x169611['createElement']('div');_0x529bb4['style']['position']='absolute',_0x529bb4['style']['left']='-9999px',_0x529bb4['innerHTML']='<span>[</span>'+_0x40b820['innerHTML']+'<span>]</span>',_0x169611['body']['appendChild'](_0x529bb4);const _0xd0fe4b=_0x169611['createRange']();_0xd0fe4b['setStartAfter'](_0x529bb4['firstElementChild']),_0xd0fe4b['setEndBefore'](_0x529bb4['lastElementChild']);const _0x38a140=_0x861729['getSelection']();_0x38a140['removeAllRanges'](),_0x38a140['addRange'](_0xd0fe4b),_0x169611['execCommand']('copy'),_0x529bb4['remove']();}}}class ContentFieldView extends Nt{constructor(_0x24cd62,_0x1281c0=''){super(_0x24cd62),this['loaderView']=this['_createLoader'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content',_0x1281c0,'ck-reset_all-excluded','ck-ai-form__content-field']}});}['setContent'](_0x3601de){this['element']['innerHTML']=_0x3601de;}['appendLoader'](){this['element']['appendChild'](this['loaderView']['element']);}['_createLoader'](){const _0x191044=new Nt(),_0x138f32=this['locale'],_0xdeaae4=new xt();return _0xdeaae4['isVisible']=!0x0,_0x191044['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__loader']},'children':[_0xdeaae4,{'text':Si(_0x138f32,'AI\x20is\x20writing...')}]}),_0x191044['render'](),_0x191044;}}class AIFormErrorView extends Nt{constructor(_0x202e8e,_0x45de95=''){super(_0x202e8e);const _0x2b4cf4=new Lt(),_0x3317e6=this['bindTemplate'];this['set']('text',_0x45de95),_0x2b4cf4['content']=_0x63afd5,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__error']},'children':[_0x2b4cf4,{'text':_0x3317e6['to']('text')}]});}}class AIFormPromptView extends Pt{['submitButtonView'];['showHistoryButtonView'];constructor(_0x1e94d6,_0x3e8f8c){super(_0x1e94d6,_0x3e8f8c),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',(_0x5769eb,_0x3e998f)=>{_0x5769eb['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x3e998f());});}['_createSubmitButton'](){const _0x1ee14f=new yt(this['locale']),_0x16d38f=this['locale'];return _0x1ee14f['set']({'icon':_0x19b8a2,'label':Si(_0x16d38f,'Submit'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-form__submit'}),_0x1ee14f['on']('execute',()=>{this['submit']();}),_0x1ee14f['bind']('isEnabled')['to'](this['queryView']['fieldView'],'isEmpty',this,'isEnabled',(_0x3df30a,_0x47e82e)=>!_0x3df30a&&_0x47e82e),_0x1ee14f;}['_createShowHistoryButton'](){const _0x54bce3=new yt(this['locale']),_0x126817=this['resultsView'],_0x506a3b=this['locale'];_0x54bce3['set']({'label':Si(_0x506a3b,'History'),'withText':!0x1,'icon':_0x21c143,'tooltip':!0x0,'tooltipPosition':'sw','class':'ck-ai-form__toggle-history'}),_0x54bce3['bind']('isOn')['to'](_0x126817,'isVisible'),_0x54bce3['bind']('isEnabled')['to'](this,'isEnabled'),_0x54bce3['on']('execute',()=>{_0x126817['isVisible']=!_0x126817['isVisible'],_0x126817['isVisible']?this['filteredView']['focus']():this['focus']();});const _0xe6bad4=()=>{lt['window']['requestAnimationFrame'](()=>{if(ut(this['element'])){const _0x2855ec=new dt(this['queryView']['fieldView']['element']),_0x33d3ea=_0x2855ec['width'],_0x514901='rtl'===_0x506a3b['uiLanguageDirection']?'left':'right';_0x2855ec['excludeScrollbarsAndBorders'](),_0x54bce3['element']['style'][_0x514901]=_0x33d3ea-_0x2855ec['width']+0x1+'px';}});};return this['queryView']['fieldView']['on']('update',_0xe6bad4),this['on']('render',_0xe6bad4),_0x54bce3;}['submit'](){const _0x4ecf7d=this['queryView']['fieldView']['element']['value'];this['fire']('submit',_0x4ecf7d);}['focus'](_0x16d70c){-0x1===_0x16d70c?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}}class AIHistoryListView extends Dt{['historyGroupView'];['clearHistoryButton'];constructor(_0x4eeacf){super(_0x4eeacf),this['clearHistoryButton']=this['_createClearHistoryButton'](),this['historyGroupView']=new Vt(),this['historyGroupView']['children']['add'](this['clearHistoryButton'],0x1),this['historyGroupView']['label']=Si(_0x4eeacf,'Prompt\x20history'),this['historyGroupView']['items']['delegate']('execute')['to'](this),this['items']['add'](this['historyGroupView']);}['filter'](){let _0x46051d=0x0;for(const _0x2895ca of this['items'])_0x46051d+=_0x2895ca['items']['length'];return{'resultsCount':_0x46051d,'totalItemsCount':_0x46051d};}['_createClearHistoryButton'](){const _0xa798c9=this['locale'],_0x3bbbb3=new yt(this['locale']);return _0x3bbbb3['set']({'label':'('+Si(_0xa798c9,'Clear')+')','withText':!0x0}),_0x3bbbb3['on']('execute',()=>this['fire']('clearHistory')),_0x3bbbb3;}}class AIHistoryListItemView extends Ht{constructor(_0x5801a3){super();const _0x407226=new Mt(),_0x4e1e78=new yt(this['locale'],_0x407226);this['children']['add'](_0x4e1e78),_0x4e1e78['set']({'label':_0x5801a3['prompt'],'withText':!0x0}),_0x4e1e78['on']('execute',()=>{this['fire']('execute',{'value':_0x127a47(_0x5801a3['prompt'])});});}}const yi='CKEditor/AIFormView/PromptHistory';class PromptHistory extends _t{constructor(){super(),this['_loadFromSessionStorage'](),this['on']('add',(_0x560458,_0x6a4fd)=>{const _0x39eee5=Ni(_0x6a4fd['prompt']);for(const _0x24facc of this)if(_0x24facc!=_0x6a4fd&&Ni(_0x24facc['prompt'])===_0x39eee5){this['remove'](_0x24facc);break;}this['length']>0x14&&this['remove'](this['last']),this['_saveToSessionStorage']();}),this['on']('remove',()=>{this['_saveToSessionStorage']();});}['_loadFromSessionStorage'](){const _0x479be2=sessionStorage['getItem'](yi)||'[]';this['addMany'](JSON['parse'](_0x479be2));}['_saveToSessionStorage'](){sessionStorage['setItem'](yi,JSON['stringify'](this['map'](_0x53fbc4=>_0x53fbc4)));}}function Ni(_0x4ab5b5){return _0x4ab5b5['toLowerCase']()['trim']();}class AIFormView extends Nt{['focusTracker'];['keystrokes'];['contentArea'];['toolbar'];['promptView'];['errorView'];['_focusables'];['focusCycler'];['_promptHistory'];constructor(_0x321b74,_0x42fc0f,_0xc1c08b=''){super(_0x321b74),this['set']('isEnabled',!0x0),this['set']('isProcessing',!0x1),this['set']('prompt',''),this['set']('value',''),this['set']('isError',!0x1),this['set']('mainAction',ki['REPLACE']),this['_promptHistory']=new PromptHistory(),this['errorView']=new AIFormErrorView(_0x321b74),this['contentArea']=new AIFormContentArea(_0x321b74,_0xc1c08b),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 It(),this['keystrokes']=new At(),this['_focusables']=this['createCollection']([this['contentArea'],this['contentArea']['copyButtonView'],this['toolbar'],this['promptView']]),this['focusCycler']=new Ut({'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 _0x17676f=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form',_0x42fc0f],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form-content']},'children':[{'tag':'div','attributes':{'class':[_0x17676f['if']('isError','ck-hidden',_0x242aef=>!_0x242aef)]},'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'](_0x171356=0x1){-0x1===_0x171356?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 _0x520ad7=this['locale'],_0x42b3eb=new AIFormPromptView(_0x520ad7,{'queryView':{'label':Si(_0x520ad7,'Ask\x20AI\x20to\x20edit\x20or\x20generate'),'creator':Bt,'showIcon':!0x1,'showResetButton':!0x1},'infoView':{'text':{'noSearchableItems':{'primary':Si(_0x520ad7,'Empty\x20history'),'secondary':Si(_0x520ad7,'Ask\x20AI\x20and\x20your\x20prompts\x20will\x20be\x20listed\x20here\x20for\x20you\x20to\x20use\x20later.')}}},'filteredView':this['_createHistoryView'](),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1});return _0x42b3eb['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x3b0ef3,_0x1b9518)=>_0x3b0ef3&&!_0x1b9518),this['listenTo'](_0x42b3eb,'submit',(_0x4d534e,_0x1d7b4b)=>{this['prompt']=_0x1d7b4b;const _0x27afe3=_0x57a263(_0x1d7b4b);this['fire']('submitPrompt',_0x27afe3),_0x1d7b4b['trim']()&&this['_promptHistory']['add']({'prompt':_0x27afe3},0x0);},{'priority':'high'}),_0x42b3eb;}['_createHistoryView'](){const _0x2cd66d=new AIHistoryListView(this['locale']);return _0x2cd66d['historyGroupView']['items']['bindTo'](this['_promptHistory'])['as'](AIHistoryListItemView),_0x2cd66d['on']('clearHistory',()=>{this['_promptHistory']['clear'](),this['promptView']['search'](''),this['promptView']['focus']();}),_0x2cd66d;}['_createToolbar'](){const _0xc37454=new AIFormToolbarView(this['locale']);return _0xc37454['replaceButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0x366cf8,_0x28b09a,_0x1d9958)=>_0x366cf8&&!_0x28b09a&&!!_0x1d9958),_0xc37454['replaceButton']['delegate']('execute')['to'](this,'replaceContent'),_0xc37454['insertButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0x1557c2,_0x5aa08c,_0x277b8e)=>_0x1557c2&&!_0x5aa08c&&!!_0x277b8e),_0xc37454['insertButton']['delegate']('execute')['to'](this,'insertContentBelow'),_0xc37454['tryAgainButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x184269,_0x23a2d8)=>_0x184269&&!_0x23a2d8),_0xc37454['tryAgainButton']['delegate']('execute')['to'](this,'tryAgainEvent'),_0xc37454['stopButton']['bind']('isEnabled')['to'](this,'isProcessing'),_0xc37454['stopButton']['delegate']('execute')['to'](this,'stopProcessing'),_0xc37454;}['startProcessing'](){this['value']='',this['isError']=!0x1,this['isProcessing']=!0x0,this['contentArea']['isVisible']=!0x0,this['toolbar']['isVisible']=!0x0,this['contentArea']['focus']();}['finishProcessing'](){const _0x3402fa=this['locale'];this['isProcessing']=!0x1,this['prompt']='',this['promptView']['reset'](),this['value']&&(this['promptView']['queryView']['label']=Si(_0x3402fa,'Ask\x20AI\x20to\x20improve\x20generated\x20text'));}['handleError'](_0x66ea56){const _0x2da779=this['locale'];this['finishProcessing'](),this['isError']=!0x0,this['errorView']['text']=_0x66ea56||Si(_0x2da779,'AI_ERROR_FAILED'),this['value']||(this['contentArea']['isVisible']=!0x1);}}const xi=globalThis['DataTransfer'];class AIAssistantUI extends _0x3da4a3{['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[_0x41549c,AIAssistantEditing,AIAdapter,Gt];}constructor(_0x42bb9f){super(_0x42bb9f),_0x42bb9f['config']['define']('ai.assistant.disabledElements',['media','rawHtml','tableOfContents']),_0x42bb9f['config']['define']('ai.assistant.contentAreaCssClass',''),_0x42bb9f['config']['define']('ai.assistant.useTheme',!0x0),this['_uiCssClasses']='ck-ai-assistant-ui'+(_0x42bb9f['config']['get']('ai.assistant.useTheme')?'\x20ck-ai-assistant-ui_theme':'');}['init'](){const {editor:_0x5ef30f}=this;this['_aiAdapter']=_0x5ef30f['plugins']['get'](AIAdapter),this['_dialog']=_0x5ef30f['plugins']['get'](Gt),this['_formView']=null,this['_commandDefinitions']=this['_getResolvedCommandsDefinitions']();const _0x5128cb=new ShowAIAssistantCommand(_0x5ef30f,Array['from'](this['_commandDefinitions']['values']()));_0x5ef30f['commands']['add']('showAIAssistant',_0x5128cb),_0x5ef30f['ui']['componentFactory']['add']('aiCommands',_0x2947cf=>{const _0xae3c5d=Ft(_0x2947cf);return _0xae3c5d['set']({'class':'ck-ai-commands-dropdown\x20'+this['_uiCssClasses']}),_0xae3c5d['buttonView']['set']({'label':Si(_0x2947cf,'AI\x20Commands'),'icon':_0x1eb03e,'tooltip':!0x0}),_0xae3c5d['on']('execute',_0x3724c5=>this['_onExecute'](_0x3724c5['source']['id'])),Wt(_0xae3c5d,_0x5ef30f['ui']['view']['body'],function(_0xbe4142){const _0x106383=fi(_0xbe4142['config']['get']('ai.assistant.commands'),_0xbe4142['locale']),_0x21003d=Pi(_0xbe4142,_0x106383)['filter'](_0xe997af=>_0xe997af['commands']['length']);if(0x1===_0x21003d['length'])return Pi(_0xbe4142,_0x21003d[0x0]['commands'])['map'](_0x15d7a5=>({'id':_0x15d7a5['id'],'label':_0x15d7a5['label']}));return _0x21003d['map'](_0x10fe90=>{const {groupId:_0x93d9db,groupLabel:_0x306ea6,commands:_0x35d7d8}=_0x10fe90,_0xbaa207=Pi(_0xbe4142,_0x35d7d8)['map'](_0x57eca9=>({'id':_0x57eca9['id'],'label':_0x57eca9['label']}));return{'id':_0x93d9db,'menu':_0x306ea6||_0x93d9db,'children':_0xbaa207};});}(_0x5ef30f),{'ariaLabel':Si(_0x2947cf,'AI\x20Commands')}),_0xae3c5d['menuView']['menuPanelClass']='ck-ai-commands-dropdown\x20'+this['_uiCssClasses'],_0x5128cb['on']('change:enabledCommandsIds',_0x5d1179),_0xae3c5d['menuView']['once']('render',_0x5d1179),_0xae3c5d;function _0x5d1179(){_0xae3c5d['isEnabled']=_0x5128cb['enabledCommandsIds']['length']>0x0;for(const _0x23a464 of _0xae3c5d['menuView']['buttons'])_0x23a464['isEnabled']=_0x5128cb['enabledCommandsIds']['includes'](_0x23a464['id']);}}),_0x5ef30f['ui']['componentFactory']['add']('menuBar:aiCommands',_0x1712c7=>{const _0x30bfcf=new Kt(_0x1712c7);_0x30bfcf['buttonView']['set']({'label':Si(_0x1712c7,'AI\x20Commands'),'icon':_0x1eb03e}),_0x30bfcf['bind']('isEnabled')['to'](_0x5128cb,'enabledCommandsIds',_0x3d6c49=>_0x3d6c49['length']>0x0);const _0x39784c=fi(_0x5ef30f['config']['get']('ai.assistant.commands'),_0x1712c7);return this['_populateMenuBarMenu'](_0x5128cb,_0x30bfcf,_0x39784c,_0x274f4e=>this['_onExecute'](_0x274f4e)),_0x30bfcf;}),_0x5ef30f['ui']['componentFactory']['add']('aiAssistant',()=>{const _0xb56d9=this['_createAIAssistantUIButton'](yt);return _0xb56d9['set']({'tooltip':!0x0,'class':'ck-ai-assistant-button\x20'+this['_uiCssClasses']}),_0xb56d9;}),_0x5ef30f['ui']['componentFactory']['add']('menuBar:aiAssistant',()=>{const _0x194ce5=this['_createAIAssistantUIButton'](Yt);return _0x194ce5['set']({'role':'menuitemcheckbox'}),_0x194ce5;}),this['licenseKey']=this['editor']['config']['get']('licenseKey');const _0x29726a=this['editor'];this['_licenseKeyCheckInterval']=setInterval(()=>{let _0x4cee84;for(const _0x5f4db5 in _0x29726a){const _0x5410f5=_0x5f4db5,_0x2057a8=_0x29726a[_0x5410f5];if('aiLicenseKeyValid'==_0x2057a8||'aiLicenseKeyInvalid'==_0x2057a8||'aiLicenseKeyExpired'==_0x2057a8||'aiLicenseKeyDomainLimit'==_0x2057a8||'aiLicenseKeyNotAllowed'==_0x2057a8||'aiLicenseKeyEvaluationLimit'==_0x2057a8||'aiLicenseKeyUsageLimit'==_0x2057a8){delete _0x29726a[_0x5410f5],_0x4cee84=_0x2057a8,clearInterval(this['_licenseKeyCheckInterval']),this['_licenseKeyCheckInterval']=void 0x0;break;}}'aiLicenseKeyInvalid'==_0x4cee84&&_0x29726a['_showLicenseError']('invalid'),'aiLicenseKeyExpired'==_0x4cee84&&_0x29726a['_showLicenseError']('expired'),'aiLicenseKeyDomainLimit'==_0x4cee84&&_0x29726a['_showLicenseError']('domainLimit'),'aiLicenseKeyNotAllowed'==_0x4cee84&&_0x29726a['_showLicenseError']('featureNotAllowed','AIAssistant'),'aiLicenseKeyEvaluationLimit'==_0x4cee84&&_0x29726a['_showLicenseError']('evaluationLimit'),'aiLicenseKeyUsageLimit'==_0x4cee84&&_0x29726a['_showLicenseError']('usageLimit');},0x3e8);}['destroy'](){super['destroy'](),this['_licenseKeyCheckInterval']&&clearInterval(this['_licenseKeyCheckInterval']);}['showUI'](_0x2626d9='',_0x3dac08='',_0x5f5786='custom'){const _0x29c6de=this['editor'],_0x18be14=_0x29c6de['editing']['view'],_0x2bdbce=_0x29c6de['plugins']['get'](AIAssistantEditing),_0x489ec1=_0x29c6de['plugins']['get'](_0x41549c);_0x2bdbce['showFakeVisualSelection']();const _0x13e70d=new xi(),_0x3cc8c3=new ClipboardEvent('copy',{'clipboardData':_0x13e70d}),_0x48c64d=new _0x9e414f(_0x13e70d),_0x207aed=new _0xddfd54(_0x18be14,_0x3cc8c3,{'dataTransfer':_0x48c64d});_0x489ec1['_forceMarkersCopy']('comment',()=>{_0x18be14['document']['fire']('copy',_0x207aed);}),this['_formView']||(this['_initView'](),this['_aiAssistantController']=new AIAssistantController(_0x29c6de,this['_aiAdapter']['textAdapter'],this['_formView']));let _0x12ed2c=_0x48c64d['getData']('text/html');const _0x5956c7=_0x29c6de['model']['document']['selection'],_0x3b12b0=Array['from'](_0x5956c7['getRanges']());0x1===_0x3b12b0['length']&&_0x3b12b0[0x0]['isFlat']&&!_0x5956c7['getSelectedElement']()&&''!==_0x12ed2c['replace'](/&nbsp;/g,'')['trim']()&&(_0x12ed2c='<p>'+_0x12ed2c+'</p>'),this['_aiAssistantController']['updateView']({'actionId':_0x5f5786,'query':_0x2626d9,'htmlContent':_0x12ed2c,'label':_0x3dac08,'mainActionLabel':ki[_0x29c6de['model']['document']['selection']['isCollapsed']?'INSERT':'REPLACE']}),'aiAssistant'!==this['_dialog']['id']?this['_dialog']['show']({'id':'aiAssistant','icon':_0x1d5f87,'title':Si(this['editor']['locale'],'AI\x20Assistant'),'content':this['_formView'],'position':$t['EDITOR_TOP_SIDE'],'onShow':()=>{this['_formView']['focus']();},'onHide':()=>{this['_aiAssistantController']['reset'](),_0x2bdbce['hideFakeVisualSelection']();}}):this['_dialog']['view']['wasMoved']||this['_dialog']['view']['updatePosition']();}['hideUI'](){this['_dialog']['hide']();}['_getResolvedCommandsDefinitions'](){const _0xa3001f=new Map(),_0x30a94d=fi(this['editor']['config']['get']('ai.assistant.commands'),this['editor']['locale']);for(const _0x3ab31b of _0x30a94d)for(const _0x54fa76 of _0x3ab31b['commands'])_0xa3001f['set'](_0x54fa76['id'],{..._0x54fa76,'groupId':_0x3ab31b['groupId'],'groupLabel':_0x3ab31b['groupLabel']||_0x3ab31b['groupId']});return _0xa3001f;}['_createAIAssistantUIButton'](_0x1457ed){const _0x3db97b=this['editor'],_0x14f14a=_0x3db97b['commands']['get']('showAIAssistant'),_0x2a66fb=new _0x1457ed(_0x3db97b['locale']);return _0x2a66fb['set']({'label':Si(_0x3db97b['locale'],'AI\x20Assistant'),'icon':_0x1d5f87,'isToggleable':!0x0}),_0x2a66fb['bind']('isEnabled')['to'](_0x14f14a),_0x2a66fb['bind']('isOn')['to'](this['_dialog'],'id',_0xc64ed6=>'aiAssistant'===_0xc64ed6),this['listenTo'](_0x2a66fb,'execute',()=>{_0x2a66fb['isOn']?this['hideUI']():_0x14f14a['execute']();}),_0x2a66fb;}['_initView'](){const _0x1fd48f=this['editor']['plugins']['get'](AIAssistantEditing);this['_formView']=new AIFormView(this['editor']['locale'],this['_uiCssClasses'],this['editor']['config']['get']('ai.assistant.contentAreaCssClass')),this['_formView']['on']('change:value',()=>{this['_dialog']['view']['wasMoved']||this['_dialog']['view']['updatePosition']();}),this['_formView']['promptView']['queryView']['fieldView']['on']('update',()=>{this['_dialog']['view']['wasMoved']||this['_dialog']['view']['updatePosition']();}),this['listenTo'](this['_formView'],'replaceContent',()=>{_0x1fd48f['insertContent'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['listenTo'](this['_formView'],'insertContentBelow',()=>{_0x1fd48f['insertContentBelow'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['_initAriaAiStatusChangeAnnouncements']();}['_initAriaAiStatusChangeAnnouncements'](){const {locale:_0x5f26b6,ui:{ariaLiveAnnouncer:_0x2bd83b}}=this['editor'];this['_formView']['contentArea']['on']('change:isProcessing',(_0x57f023,_0x5e29b5,_0x7f6582)=>{const _0x512d7d=this['_aiAssistantController']['currentContext'];_0x7f6582?_0x2bd83b['announce'](Si(_0x5f26b6,'AI\x20is\x20writing')):_0x512d7d&&_0x2bd83b['announce'](Si(_0x5f26b6,'Generated\x20content:\x20%0',_0x512d7d),{'politeness':'polite','isUnsafeHTML':!0x0});}),this['_formView']['on']('change:isError',(_0x2af28a,_0x4e304e,_0x5bdc14)=>{if(_0x5bdc14){const _0x201268=this['_formView']['errorView']['text'];_0x2bd83b['announce'](Si(_0x5f26b6,'Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x201268));}});}['_onExecute'](_0x1f73f2){const _0x179389=this['_commandDefinitions']['get'](_0x1f73f2),_0x4ae45c=this['editor'],_0x542f82=_0x4ae45c['model']['document']['selection'],_0x2b1a59=_0x4ae45c['commands']['get']('showAIAssistant'),_0x109c94=_0x4ae45c['plugins']['get'](AIAssistantEditing),_0xa5edbb=''+(_0x179389['groupId']!==Ti?_0x179389['groupLabel']+':\x20':'')+_0x179389['label'];if(!0x1!==_0x179389['requiresContent']&&_0x542f82['isCollapsed']){const _0x3331d4=gt(_0x542f82['getSelectedBlocks']())||_0x4ae45c['model']['schema']['getLimitElement'](_0x542f82);_0x4ae45c['model']['change'](_0x4664dd=>{_0x4664dd['setSelection'](_0x3331d4,'in');});}_0x109c94['showFakeVisualSelection'](),_0x2b1a59['execute'](_0x179389['prompt'],_0xa5edbb,'command:'+_0x1f73f2);}['_populateMenuBarMenu'](_0x4c05c1,_0x59447d,_0x277575,_0x4fb438){const _0x5100f0=this['editor'],_0x186f11=_0x5100f0['locale'],_0x247b0f=new qt(_0x186f11),_0x2d1734=Pi(_0x5100f0,_0x277575)['filter'](_0x79ac05=>_0x79ac05['commands']['length']);0x1===_0x2d1734['length']?this['_getMenuBarGroupButtons']({'command':_0x4c05c1,'commands':_0x2d1734[0x0]['commands'],'parentMenuView':_0x59447d,'onExecute':_0x4fb438})['forEach'](_0xd7762e=>_0x247b0f['items']['add'](_0xd7762e)):_0x2d1734['forEach'](({groupId:_0x1f23ae,groupLabel:_0x1fb635,commands:_0x409530})=>{const _0x32d17b=new Qt(_0x186f11,_0x59447d),_0x30d075=new Kt(_0x186f11),_0x4562e3=new qt(_0x186f11),_0x540374=this['_getMenuBarGroupButtons']({'command':_0x4c05c1,'commands':_0x409530,'parentMenuView':_0x30d075,'onExecute':_0x4fb438});_0x30d075['buttonView']['set']({'label':_0x1fb635||_0x1f23ae}),_0x30d075['delegate']('execute')['to'](_0x59447d),_0x4562e3['items']['addMany'](_0x540374),_0x30d075['panelView']['children']['add'](_0x4562e3),_0x32d17b['children']['add'](_0x30d075),_0x247b0f['items']['add'](_0x32d17b);}),_0x59447d['panelView']['children']['add'](_0x247b0f);}['_getMenuBarGroupButtons']({command:_0x102a70,commands:_0x3f11a9,parentMenuView:_0x28e7c9,onExecute:_0x59ebab}){const _0x90576f=this['editor'],_0x46550c=_0x90576f['locale'];return Pi(_0x90576f,_0x3f11a9)['map'](_0x5da59c=>{const _0x2b08fe=new Qt(_0x46550c,_0x28e7c9),_0x153665=new Yt(_0x46550c);return _0x153665['set']({'label':_0x5da59c['label']}),_0x153665['delegate']('execute')['to'](_0x28e7c9),_0x153665['on']('execute',()=>_0x59ebab(_0x5da59c['id'])),_0x153665['bind']('isEnabled')['to'](_0x102a70,'enabledCommandsIds',_0x4e3f6a=>_0x4e3f6a['includes'](_0x5da59c['id'])),_0x2b08fe['children']['add'](_0x153665),_0x2b08fe;});}}function Li(_0x35c9e2,_0x35d588){return void 0x0!==_0x35c9e2['order']&&void 0x0===_0x35d588['order']?0x1:void 0x0===_0x35c9e2['order']&&void 0x0!==_0x35d588['order']?-0x1:void 0x0!==_0x35c9e2['order']&&void 0x0!==_0x35d588['order']?_0x35c9e2['order']-_0x35d588['order']:0x0;}function Pi(_0x6030e2,_0x2a4fa7){_0x2a4fa7['sort'](Li);const _0x1491ed={},_0x249b0e=[];for(const _0x1d0810 of _0x2a4fa7)if(void 0x0!==_0x1d0810['order']){if(_0x1d0810['order']in _0x1491ed)throw new ht('ai-commands-config-order-collision',_0x6030e2,{'conflictingDefinitions':[_0x1d0810,_0x1491ed[_0x1d0810['order']]]});_0x1491ed[_0x1d0810['order']]=_0x1d0810,_0x249b0e['splice'](_0x1d0810['order'],0x0,_0x1d0810);}else _0x249b0e['push'](_0x1d0810);return _0x249b0e;}class AIAssistant extends _0x3da4a3{static get['requires'](){return[AIAssistantUI,AIAssistantEditing];}static get['pluginName'](){return'AIAssistant';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x401f30){super(_0x401f30);const _0x2fa3d2=_0x401f30['config'],_0x390aac=_0x401f30['locale'];_0x2fa3d2['define']('ai.assistant.preserveComments',!0x0),_0x2fa3d2['define']('ai.assistant.commands',Di(_0x390aac)),_0x2fa3d2['define']('ai.assistant.extraCommandGroups',[]),_0x2fa3d2['define']('ai.assistant.removeCommands',[]);let _0x57f57b=fi(_0x2fa3d2['get']('ai.assistant.commands'),_0x390aac);const _0x36d4dc=_0x2fa3d2['get']('ai.assistant.extraCommandGroups'),_0x56b117=_0x2fa3d2['get']('ai.assistant.removeCommands');_0x36d4dc['forEach'](_0x4ca937=>{const _0x3661ef=_0x57f57b['find'](_0x201919=>_0x201919['groupId']===_0x4ca937['groupId']);_0x3661ef?_0x3661ef['commands']=_0x3661ef['commands']['concat'](_0x4ca937['commands']):_0x57f57b['push'](_0x4ca937);}),_0x57f57b=_0x57f57b['filter'](_0x28333d=>!_0x56b117['includes'](_0x28333d['groupId'])),_0x57f57b['forEach'](_0x35fc79=>{_0x35fc79['commands']=_0x35fc79['commands']['filter'](_0x5545a6=>!_0x56b117['includes'](_0x5545a6['id']));}),_0x2fa3d2['set']('ai.assistant.commands',_0x57f57b);}}function Di(_0x1b42c7){return[{'groupId':'editOrReview','groupLabel':Si(_0x1b42c7,'Edit\x20or\x20review'),'commands':[{'id':'improveWriting','label':Si(_0x1b42c7,'Improve\x20writing'),'prompt':'Fix\x20spelling\x20mistakes,\x20use\x20proper\x20grammar\x20and\x20apply\x20good\x20writing\x20practices.\x20Do\x20not\x20lose\x20the\x20original\x20meaning.'},{'id':'makeShorter','label':Si(_0x1b42c7,'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':Si(_0x1b42c7,'Make\x20longer'),'prompt':'Improve\x20this\x20content\x20by\x20using\x20descriptive\x20language\x20and\x20inserting\x20more\x20information\x20and\x20more\x20detailed\x20explanations.'},{'id':'simplifyLanguage','label':Si(_0x1b42c7,'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':Si(_0x1b42c7,'Generate\x20from\x20selection'),'commands':[{'id':'summarize','label':Si(_0x1b42c7,'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':Si(_0x1b42c7,'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':Si(_0x1b42c7,'Change\x20tone'),'commands':[{'id':'professional','label':Si(_0x1b42c7,'Professional'),'prompt':'Improve\x20using\x20polished,\x20formal,\x20and\x20respectful\x20language\x20to\x20convey\x20professional\x20expertise\x20and\x20competence.'},{'id':'casual','label':Si(_0x1b42c7,'Casual'),'prompt':'Improve\x20using\x20casual,\x20informal\x20language\x20to\x20convey\x20a\x20casual\x20conversation\x20with\x20a\x20real\x20person.'},{'id':'direct','label':Si(_0x1b42c7,'Direct'),'prompt':'Improve\x20using\x20direct\x20language,\x20using\x20only\x20the\x20essential\x20information.'},{'id':'confident','label':Si(_0x1b42c7,'Confident'),'prompt':'Improve\x20using\x20compelling,\x20optimistic\x20language\x20to\x20convey\x20confidence\x20in\x20the\x20writing.'},{'id':'friendly','label':Si(_0x1b42c7,'Friendly'),'prompt':'Improve\x20using\x20friendly,\x20comforting\x20language,\x20to\x20convey\x20understanding\x20and\x20empathy.'}]},{'groupId':'changeStyle','groupLabel':Si(_0x1b42c7,'Change\x20style'),'commands':[{'id':'business','label':Si(_0x1b42c7,'Business'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20business\x20professional\x20with\x20formal\x20language.'},{'id':'legal','label':Si(_0x1b42c7,'Legal'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20legal\x20professional\x20using\x20valid\x20legal\x20terminology.'},{'id':'journalism','label':Si(_0x1b42c7,'Journalism'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20journalist\x20using\x20engaging\x20language\x20to\x20convey\x20the\x20importance\x20of\x20the\x20information.'},{'id':'poetic','label':Si(_0x1b42c7,'Poetic'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20poem\x20using\x20poetic\x20techniques\x20without\x20losing\x20the\x20original\x20meaning.'}]},{'groupId':'translate','groupLabel':Si(_0x1b42c7,'Translate'),'commands':[{'id':'translateEnglish','label':Si(_0x1b42c7,'English'),'prompt':'Translate\x20the\x20content\x20to\x20English\x20language.'},{'id':'translateSpanish','label':Si(_0x1b42c7,'Spanish'),'prompt':'Translate\x20the\x20content\x20to\x20Spanish\x20language.'},{'id':'translatePortuguese','label':Si(_0x1b42c7,'Portuguese'),'prompt':'Translate\x20the\x20content\x20to\x20Portuguese\x20language.'},{'id':'translateGerman','label':Si(_0x1b42c7,'German'),'prompt':'Translate\x20the\x20content\x20to\x20German\x20language.'},{'id':'translateFrench','label':Si(_0x1b42c7,'French'),'prompt':'Translate\x20the\x20content\x20to\x20French\x20language.'},{'id':'translateChinese','label':Si(_0x1b42c7,'Simplified\x20Chinese'),'prompt':'Translate\x20the\x20content\x20to\x20Simplified\x20Chinese\x20language.'},{'id':'translateHindi','label':Si(_0x1b42c7,'Hindi'),'prompt':'Translate\x20the\x20content\x20to\x20Hindi\x20language.'},{'id':'translateArabic','label':Si(_0x1b42c7,'Arabic'),'prompt':'Translate\x20the\x20content\x20to\x20Arabic\x20language.'}]}];}class AITextAdapter extends _0x3da4a3{['abortController'];static get['requires'](){return[AIAdapter];}constructor(_0x36f7a3){super(_0x36f7a3),this['abortController']=new AbortController();}['init'](){this['editor']['plugins']['get'](AIAdapter)['textAdapter']=this;}['abort'](){this['abortController']['signal']['aborted']||(this['abortController']['abort'](),this['abortController']=new AbortController());}async['makeRequest'](_0x29380c){return this['sendRequest'](_0x29380c)['catch'](_0x3c0d33=>{if(_0x3c0d33 instanceof AIRequestError)return Promise['reject'](_0x3c0d33);if('AbortError'==_0x3c0d33['name'])return Promise['resolve']();throw console['error'](_0x3c0d33),new ht('aitextadapter-send-request-failed',null);});}async['_prepareRequestHeaders'](_0x6452cd,_0x2ae736){const _0x5c589a=this['editor']['locale'],_0x36bfed={'Content-Type':'application/json'};if('object'==typeof _0x6452cd)Object['assign'](_0x36bfed,_0x6452cd);else{if(_0x6452cd)try{const _0x16f89e=await _0x6452cd(_0x2ae736);Object['assign'](_0x36bfed,_0x16f89e);}catch{return Promise['reject'](new AIRequestError(Si(_0x5c589a,'AI_ERROR_GET_HEADERS')));}}return _0x36bfed;}async['_prepareRequestParameters'](_0x5a4a2a,_0x5a3997){const _0x1d2bd6=this['editor']['locale'];if('object'==typeof _0x5a4a2a)return _0x5a4a2a;try{return await _0x5a4a2a(_0x5a3997);}catch{return Promise['reject'](new AIRequestError(Si(_0x1d2bd6,'AI_ERROR_GET_PARAMETERS')));}}}class OpenAITextAdapter extends AITextAdapter{['_apiUrl'];['_requestHeaders'];['_requestParameters'];static get['pluginName'](){return'OpenAITextAdapter';}constructor(_0x42eb74){super(_0x42eb74),_0x42eb74['config']['define']('ai.assistant.adapter.openAI.apiUrl','https://api.openai.com/v1/chat/completions'),_0x42eb74['config']['get']('ai.assistant.adapter.openAI.requestParameters')||_0x42eb74['config']['define']('ai.assistant.adapter.openAI.requestParameters',{'model':'gpt-4o','temperature':0x1,'top_p':0x1,'stream':!0x0}),this['_apiUrl']=_0x42eb74['config']['get']('ai.assistant.adapter.openAI.apiUrl'),this['_requestHeaders']=_0x42eb74['config']['get']('ai.assistant.adapter.openAI.requestHeaders')||{},this['_requestParameters']=_0x42eb74['config']['get']('ai.assistant.adapter.openAI.requestParameters');}async['sendRequest']({query:_0x21139a,context:_0xc3e20c,onData:_0x25d6e1,actionId:_0x246962}){const _0x37303b=this['editor']['locale'],_0x598259=await this['prepareMessages'](_0x21139a,_0xc3e20c,_0x246962),_0x149ab1=await this['_prepareRequestHeaders'](this['_requestHeaders'],_0x246962),_0x518174=await this['_prepareRequestParameters'](this['_requestParameters'],_0x246962),_0x6cca77={'messages':_0x598259,..._0x518174},_0xaed9b3={'method':'POST','headers':_0x149ab1,'body':JSON['stringify'](_0x6cca77),'signal':this['abortController']['signal']},_0x441e4f=await fetch(this['_apiUrl'],_0xaed9b3);if(_0x441e4f['ok'])return _0x518174['stream']?await this['_readStreamableResponse'](_0x441e4f,_0x25d6e1):await this['_readStaticResponse'](_0x441e4f,_0x25d6e1),Promise['resolve']();{const _0x341b42=await _0x441e4f['text']();return _0x341b42['includes']('context_length_exceeded')?Promise['reject'](new AIRequestError(Si(_0x37303b,'AI_ERROR_CONTEXT_LENGTH'))):_0x341b42['includes']('Moderation')?Promise['reject'](new AIRequestError(Si(_0x37303b,'AI_ERROR_MODERATION'))):Promise['reject'](new Error(_0x341b42));}}async['prepareMessages'](_0xe1d362,_0x246013,_0x1a1b93){let _0x41b6b5,_0x3f561;return _0x246013?(_0x41b6b5='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.',_0x3f561='Instruction:\x0a'+_0xe1d362+'\x0aYou\x20must\x20keep\x20the\x20text\x20formatting.\x0a\x0aContent:\x0a'+_0x246013):(_0x41b6b5='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.',_0x3f561=_0xe1d362),[{'role':'system','content':_0x41b6b5},{'role':'user','content':_0x3f561}];}async['_readStreamableResponse'](_0x405b2d,_0x4e98a2){const _0xc56dda=_0x405b2d['body']['getReader'](),_0x86f64d=new TextDecoder();let _0x2f7b30='',_0xee5a8f='',_0x34f1b5='',_0x3cb935=!0x1;for(;!_0x3cb935;){const {done:_0x442309,value:_0x1f7a3f}=await _0xc56dda['read'](),_0xfeb75d=_0x2f7b30+_0x86f64d['decode'](_0x1f7a3f);let _0x4be87e='';_0x3cb935=_0x442309;try{_0x4be87e=this['_cleanUpData'](_0xfeb75d),_0x2f7b30='';}catch{_0x2f7b30=_0xfeb75d;continue;}_0xee5a8f+=_0x4be87e,!_0x3cb935&&this['_isBufferIncomplete'](_0xee5a8f)||_0xee5a8f&&(_0x34f1b5+=_0xee5a8f,_0xee5a8f='',_0x4e98a2(_0x34f1b5));}return Promise['resolve']();}async['_readStaticResponse'](_0x57c377,_0x4209b0){return _0x4209b0((await _0x57c377['json']())['choices'][0x0]['message']['content']),Promise['resolve']();}['_isBufferIncomplete'](_0x42286b){const _0x49119f=_0x42286b['split']('<')['length']!==_0x42286b['split']('>')['length'],_0x4de40f=_0x42286b['length']<0x1e;return _0x49119f&&_0x4de40f;}['_cleanUpData'](_0x46c3cf){return _0x46c3cf['split'](/\n(?![^{]*\})/g)['map'](_0x177a7d=>_0x177a7d['replace']('data:\x20',''))['filter'](_0x5e9da5=>_0x5e9da5&&_0x5e9da5['length']>0x0&&'[DONE]'!==_0x5e9da5)['map'](_0x3a0b16=>{const {choices:_0x3effcc}=JSON['parse'](_0x3a0b16);if(_0x3effcc[0x0]?.['delta']?.['content'])return _0x3effcc[0x0]['delta']['content'];})['filter'](_0x4d62eb=>_0x4d62eb)['join']('');}}class AWSTextAdapter extends AITextAdapter{static get['pluginName'](){return'AWSTextAdapter';}['init'](){super['init'](),wt('ai-aws-adapter-not-supported');}async['sendRequest'](_0x5363af){throw Ct('ai-aws-adapter-not-supported'),new AIRequestError(Si(this['editor']['locale'],'AI_ERROR_AWS_NOT_SUPPORTED'));}}class TabButtonView extends yt{constructor(_0x43508e,_0x50d603={}){super(_0x43508e),this['isToggleable']=!0x0,this['set']('side',_0x50d603['side']||'top');const _0xba42b0=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-tab-button',...mt(_0x50d603['class']||[]),_0xba42b0['to']('side',_0x42535d=>'ck-tab-button_'+_0x42535d),_0xba42b0['to']('class')]}});}['show'](){this['set']('isVisible',!0x0);}['hide'](){this['set']('isVisible',!0x1);}}class TabPanelView extends Nt{['children'];constructor(_0x4021be,_0x1df915={}){super(_0x4021be);const _0x5a2d43=this['bindTemplate'];this['set']('isVisible',!0x1),this['set']('class',''),this['children']=this['createCollection'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-tab-panel',...mt(_0x1df915['class']||[]),_0x5a2d43['to']('class'),_0x5a2d43['if']('isVisible','ck-hidden',_0x337a6a=>!_0x337a6a)]},'children':this['children']});}['show'](){this['set']('isVisible',!0x0);}['hide'](){this['set']('isVisible',!0x1);}}class AITabsView extends Nt{['buttonViews']=this['createCollection']();['panelViews']=this['createCollection']();['_tabs']=new Map();constructor(_0x2fe311,_0x3e6033={}){super(_0x2fe311),this['set']('class',void 0x0),this['set']('activeTab',null),this['set']('side',_0x3e6033['side']||'top'),this['set']('isMaximized',!0x1),this['set']('collapsible',_0x3e6033['collapsible']||!0x1),this['set']('_isMaximizedActive',!0x1),this['bind']('_isMaximizedActive')['to'](this,'isMaximized',this,'activeTab',(_0x4a2ad1,_0xb1bc1e)=>_0x4a2ad1&&null!==_0xb1bc1e);const _0x12bbf8=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset','ck-tabs',...mt(_0x3e6033['class']||[]),_0x12bbf8['to']('side',_0x180b26=>'ck-tabs_'+_0x180b26),_0x12bbf8['to']('class'),_0x12bbf8['if']('_isMaximizedActive','ck-ai-tabs_maximized'),_0x12bbf8['to']('activeTab',_0x42b04a=>null===_0x42b04a?'ck-ai-tabs_collapsed':'')],'tabindex':'0'},'children':[{'tag':'div','attributes':{'class':['ck','ck-tabs__buttons-container',_0x12bbf8['to']('side',_0x2b0b50=>'ck-tabs__buttons-container_'+_0x2b0b50)]},'children':this['buttonViews']},{'tag':'div','attributes':{'class':['ck','ck-tabs__panels-container',_0x12bbf8['to']('side',_0x4719d7=>'ck-tabs__panels-container_'+_0x4719d7)]},'children':this['panelViews']},...mt(_0x3e6033['children']||[])]});}['getTabIds'](){return[...this['_tabs']['keys']()];}['getTab'](_0x3b5414){const _0x272302=this['_tabs']['get'](_0x3b5414);return _0x272302||null;}['addTab'](_0x14a9a8){const _0x1b1702=this['_setupButton']({'id':_0x14a9a8['id'],'label':_0x14a9a8['buttonLabel'],'icon':_0x14a9a8['buttonIcon'],'order':_0x14a9a8['order']}),_0x2d43ee=new TabPanelView(this['locale']);return _0x2d43ee['render'](),_0x14a9a8['content']&&_0x2d43ee['children']['add'](_0x14a9a8['content']),this['panelViews']['add'](_0x2d43ee),this['_tabs']['set'](_0x14a9a8['id'],{'button':_0x1b1702,'panel':_0x2d43ee,'order':void 0x0!==_0x14a9a8['order']?_0x14a9a8['order']:null}),this['fire']('addTab:'+_0x14a9a8['id'],{'id':_0x14a9a8['id'],'button':_0x1b1702,'panel':_0x2d43ee}),null===this['activeTab']?this['activateTab'](_0x14a9a8['id']):this['_hidePanel'](_0x14a9a8['id']),{'button':_0x1b1702,'panel':_0x2d43ee};}['activateTab'](_0x2c54aa){if(null!==_0x2c54aa&&!this['getTab'](_0x2c54aa))throw new ht('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x2c54aa});if(this['activeTab']===_0x2c54aa)return;const _0x5578dc=this['activeTab'];this['activeTab']&&this['_hidePanel'](this['activeTab']),this['activeTab']=_0x2c54aa,_0x2c54aa&&this['_showPanel'](_0x2c54aa),this['fire']('activateTab:'+_0x2c54aa,{'newTab':_0x2c54aa,'oldTab':_0x5578dc});}['toggleTabPanel'](_0x36d951){if(!this['getTab'](_0x36d951))throw new ht('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x36d951});this['activeTab']===_0x36d951?this['collapsible']&&(this['activeTab']=null):this['activateTab'](_0x36d951);}['showTab'](_0x45797c){if(!this['getTab'](_0x45797c))throw new ht('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x45797c});this['_showPanel'](_0x45797c),this['_showButton'](_0x45797c),this['fire']('show:'+_0x45797c,_0x45797c);}['hideTab'](_0x1c7887){if(!this['getTab'](_0x1c7887))throw new ht('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x1c7887});const _0x2910bc=this['activeTab'];this['_hidePanel'](_0x1c7887),this['_hideButton'](_0x1c7887);const _0x5b86af=this['getTabIds']();_0x2910bc===_0x1c7887&&_0x5b86af['length']>0x1&&this['activateTab'](_0x5b86af['find'](_0x5b3213=>_0x5b3213!==_0x1c7887)),this['fire']('hide:'+_0x1c7887,_0x1c7887);}['_getPanel'](_0x241028){const _0x402aa1=this['_tabs']['get'](_0x241028);return _0x402aa1?_0x402aa1['panel']:null;}['_showPanel'](_0x29bf4c){null!==this['activeTab']&&this['activeTab']!==_0x29bf4c||this['_getPanel'](_0x29bf4c)['show']();}['_hidePanel'](_0x3c85f0){const _0x1b520f=this['_getPanel'](_0x3c85f0);_0x1b520f['isVisible']&&(this['activeTab']===_0x3c85f0&&(this['activeTab']=null),_0x1b520f['hide']());}['_getButton'](_0x511e9d){const _0x23faad=this['_tabs']['get'](_0x511e9d);return _0x23faad?_0x23faad['button']:null;}['_showButton'](_0x46fb1e){this['_getButton'](_0x46fb1e)['show']();}['_hideButton'](_0x1d8a32){this['_getButton'](_0x1d8a32)['hide']();}['_setupButton'](_0x39ee8a){const _0x23e192=new TabButtonView(this['locale'],{'side':this['side']}),_0x526c4f=this['buttonViews'];if(_0x23e192['set']({'label':_0x39ee8a['label'],'icon':_0x39ee8a['icon'],'tooltip':!0x0,'withText':!0x0}),_0x23e192['bind']('isOn')['to'](this,'activeTab',_0x125003=>_0x125003===_0x39ee8a['id']),_0x23e192['bind']('side')['to'](this,'side'),_0x39ee8a['order']){const _0x3da9ab=[...this['_tabs']]['reduce']((_0x592cc0,_0x33b2d7)=>{const _0x2ed58d=_0x33b2d7[0x0],{order:_0x2047fe}=_0x33b2d7[0x1];return!_0x2047fe||_0x2047fe>_0x39ee8a['order']?_0x592cc0:_0x2047fe>=_0x592cc0['order']?{'id':_0x2ed58d,'order':_0x2047fe}:_0x592cc0;},{'id':'','order':0x0}),_0x4f5013=_0x526c4f['getIndex'](this['_getButton'](_0x3da9ab['id']));_0x526c4f['add'](_0x23e192,_0x4f5013+0x1);}else _0x526c4f['add'](_0x23e192);return _0x23e192['on']('execute',()=>{this['toggleTabPanel'](_0x39ee8a['id']);}),_0x23e192;}}const Vi=['overlay','sidebar','custom'],Hi=['left','right'];class AITabsMainView extends AITabsView{constructor(_0x251294,_0x3444bf={}){super(_0x251294,_0x3444bf),this['set']('type',_0x3444bf['type']||'sidebar'),this['set']('side',_0x3444bf['side']||'right'),this['set']('isVisible',_0x3444bf['visibleByDefault']??!0x0);const _0x330bfc=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-tabs',_0x330bfc['if']('type','ck-ai-tabs__overlay',_0x1d0876=>'overlay'===_0x1d0876),_0x330bfc['if']('type','ck-ai-tabs__sidebar',_0x16e644=>'sidebar'===_0x16e644),_0x330bfc['if']('isVisible','ck-hidden',_0x3ce946=>!_0x3ce946)]}}),this['buttonViews']['on']('add',(_0x54d32d,_0x16ef9a)=>{_0x16ef9a['set']('withText',!0x1);});}}class AITabs extends _0x533560{['view'];['container']=null;['showResizeButton']=!0x0;static get['pluginName'](){return'AITabs';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x4006e2){if(super(_0x4006e2),!this['context']['config']['get']('ai.container'))throw new ht('ai-tabs-configuration-not-found');this['context']['config']['define']('ai.container.visibleByDefault',!0x0),this['context']['config']['define']('ai.container.collapsible',!0x1);const _0x4c8ac2=this['context']['config']['get']('ai.container');if(this['set']('side','right'),void 0x0!==_0x4c8ac2['showResizeButton']&&(this['showResizeButton']=_0x4c8ac2['showResizeButton']),'sidebar'!==_0x4c8ac2['type']&&'overlay'!==_0x4c8ac2['type']||_0x4c8ac2['side']&&(this['side']=_0x4c8ac2['side']),'sidebar'===_0x4c8ac2['type']){if(this['container']=_0x4c8ac2['element'],this['set']('type','sidebar'),!this['container'])throw new ht('ai-tabs-sidebar-container-element-not-found');}else'overlay'===_0x4c8ac2['type']?(this['container']=document['body'],this['set']('type','overlay')):(this['container']=null,this['set']('type','custom'));this['view']=new AITabsMainView(this['context']['locale'],{'side':this['side'],'type':this['type'],'visibleByDefault':_0x4c8ac2['visibleByDefault'],'collapsible':_0x4c8ac2['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 _0x20c128&&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'](_0x1f3225){if(_0x1f3225&&this['type']!==_0x1f3225){if(!Vi['includes'](_0x1f3225))throw new ht('ai-tabs-unsupported-ui-type');this['type']=_0x1f3225;}}['switchSide'](_0x37fdf9){if(_0x37fdf9&&this['side']!==_0x37fdf9){if(!Hi['includes'](_0x37fdf9))throw new ht('ai-tabs-unsupported-ui-side');this['side']=_0x37fdf9;}}['destroy'](){super['destroy'](),this['view']['destroy'](),this['view']['element']&&this['view']['element']['remove']();}}class AIConnector extends _0x533560{['_apiUrl'];get['_apiUrlV11'](){return this['_apiUrl']['replace'](/\/v1$/,'/v1.1');}['_token'];['_decoder'];['_responseCache'];static get['requires'](){return[_0x213c42];}static get['pluginName'](){return'AIConnector';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x3e442c){if(super(_0x3e442c),this['context']['config']['define']('ai.serviceUrl','https://ai.cke-cs.com/v1'),this['_apiUrl']=this['context']['config']['get']('ai.serviceUrl')['replace'](/\/+$/,''),!this['_apiUrl']['endsWith']('/v1'))throw new ht('ai-service-url-invalid-version',this,{'serviceUrl':this['_apiUrl']});this['_token']=null,this['_decoder']=new TextDecoder(),this['_responseCache']=new Map();}['init'](){const _0x389ab4=this['context']['plugins']['get'](_0x213c42);if(!_0x389ab4['token'])throw new ht('ai-missing-token',this);this['_token']=_0x389ab4['token'];}['startConversation'](_0x7bd357,_0x5a512f){const _0x38a6ff=this['_sendApiRequest']('/conversations','POST',{'id':_0x7bd357,'group':_0x5a512f});return{'getConversation':async()=>(await _0x38a6ff['request'])['json'](),'abortController':_0x38a6ff['abortController']};}['queryAssistant']({message:_0x1090b2,conversationId:_0x9c543a,parts:_0x9c4acf,capabilities:_0x5ca699,model:_0x545654,attributes:_0x3d07a4}){const _0x43f406={'prompt':_0x1090b2,'content':_0x9c4acf,'model':_0x545654,..._0x5ca699&&{'capabilities':_0x5ca699},..._0x3d07a4&&{'attributes':_0x3d07a4}},_0x57fe22=this['_sendApiRequest']('/conversations/'+_0x9c543a+'/messages','POST',_0x43f406,{'apiUrl':this['_apiUrlV11']});return{'getStream':async()=>{const _0x4dfcf3=(await _0x57fe22['request'])['body'];return this['_getStreamReader'](_0x4dfcf3);},'abortController':_0x57fe22['abortController']};}['executeCustomAction']({content:_0x460bc6,message:_0x46addc,model:_0xf18744,outputFormat:_0x1fbc55}){const _0x59eaf8={'content':[{'type':'text','content':_0x460bc6}],'prompt':_0x46addc,'model':_0xf18744,'outputFormat':_0x1fbc55},_0x4d824a=this['_sendApiRequest']('/actions/custom/calls','POST',_0x59eaf8);return{'getStream':async()=>{const _0x5d9063=(await _0x4d824a['request'])['body'];return this['_getStreamReader'](_0x5d9063);},'abortController':_0x4d824a['abortController']};}['executeAction']({actionName:_0x5c1cb1,content:_0x57eed9,args:_0x63ad6a}){const _0x55bb4c={'content':[{'type':'text','content':_0x57eed9}],'args':_0x63ad6a},_0x1f17be=this['_sendApiRequest']('/actions/system/'+_0x5c1cb1+'/calls','POST',_0x55bb4c);return{'getStream':async()=>{const _0xcee14f=(await _0x1f17be['request'])['body'];return this['_getStreamReader'](_0xcee14f);},'abortController':_0x1f17be['abortController']};}['uploadFile'](_0x29adab,_0x1b0e06,_0x592f69){const _0x195c6c=new FormData();_0x195c6c['append']('file',_0x1b0e06,_0x1b0e06['name']),_0x592f69&&_0x195c6c['append']('attributes',JSON['stringify'](_0x592f69));const _0x53a75d=this['_sendApiRequest']('/conversations/'+_0x29adab+'/files','POST',_0x195c6c);return{'getId':async()=>(await _0x53a75d['request'])['json'](),'abortController':_0x53a75d['abortController']};}['fetchDocument'](_0x36a0c9,_0x537798){const _0x55307d=this['_sendApiRequest']('/conversations/'+_0x36a0c9+'/documents/'+_0x537798,'GET');return{'getDocument':async()=>(await _0x55307d['request'])['json'](),'abortController':_0x55307d['abortController']};}['uploadDocument'](_0x17719a,_0x5c46fa,_0x8c5b32){const _0x492a67={'content':_0x5c46fa};_0x8c5b32&&(_0x492a67['attributes']=_0x8c5b32);const _0x3bc5a4=this['_sendApiRequest']('/conversations/'+_0x17719a+'/documents','POST',_0x492a67);return{'getId':async()=>(await _0x3bc5a4['request'])['json'](),'abortController':_0x3bc5a4['abortController']};}['uploadDocuments'](_0x52c3c7,_0xe61557){const _0x39887b={'documents':_0xe61557['map'](_0x4371f3=>({'content':_0x4371f3['content'],'attributes':{'version':_0x4371f3['version'],'sessionId':_0x4371f3['sessionId'],'channelId':_0x4371f3['channelId'],'rootName':_0x4371f3['rootName'],'selections':_0x4371f3['selections']},...void 0x0!==_0x4371f3['name']?{'name':_0x4371f3['name']}:{},...void 0x0!==_0x4371f3['description']?{'description':_0x4371f3['description']}:{}}))},_0x5db78f=this['_sendApiRequest']('/conversations/'+_0x52c3c7+'/documents/batch','POST',_0x39887b);return{'getIds':async()=>(await _0x5db78f['request'])['json'](),'abortController':_0x5db78f['abortController']};}['fetchDocuments'](_0x1ce4fe,_0x3e78c3){const _0x2a3145=new URLSearchParams();_0x2a3145['append']('documentIds',_0x3e78c3['join'](','));const _0x5c4ccf=this['_sendApiRequest']('/conversations/'+_0x1ce4fe+'/documents/batch?'+_0x2a3145['toString'](),'GET');return{'getDocuments':async()=>(await _0x5c4ccf['request'])['json'](),'abortController':_0x5c4ccf['abortController']};}['fetchConversations'](_0x33e8b7,_0x32567c={}){const _0xafd664=new URLSearchParams();_0xafd664['append']('group',_0x33e8b7),_0xafd664['append']('excludeEmpty',!0x1!==_0x32567c['excludeEmpty']?'true':'false'),_0xafd664['append']('limit',_0x32567c['limit']?_0x32567c['limit']['toString']():'100'),_0xafd664['append']('sortBy',_0x32567c['sortBy']?_0x32567c['sortBy']:'createdAt'),_0xafd664['append']('order',_0x32567c['order']?_0x32567c['order']:'desc');const _0x2e61d2=this['_sendApiRequest']('/conversations?'+_0xafd664['toString'](),'GET');return{'getConversations':async()=>{const _0x51e628=await _0x2e61d2['request'];return(await _0x51e628['json']())['items'];},'abortController':_0x2e61d2['abortController']};}['deleteConversation'](_0x4d56be){const _0x4b1f7d=this['_sendApiRequest']('/conversations/'+_0x4d56be,'DELETE');return{'execute':async()=>{await _0x4b1f7d['request'];},'abortController':_0x4b1f7d['abortController']};}['updateConversation'](_0xc34ef4,_0x41119b){const _0x145c11=this['_sendApiRequest']('/conversations/'+_0xc34ef4,'PATCH',_0x41119b);return{'getResult':async()=>(await _0x145c11['request'],_0x41119b),'abortController':_0x145c11['abortController']};}['fetchConversation'](_0x8ff0cf){const _0x950a91=this['_sendApiRequest']('/conversations/'+_0x8ff0cf,'GET');return{'getConversation':async()=>(await _0x950a91['request'])['json'](),'abortController':_0x950a91['abortController']};}['fetchConversationMessages'](_0x3f2f35){const _0x2461c7=this['_sendApiRequest']('/conversations/'+_0x3f2f35+'/messages','GET',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'getMessages':async()=>{const _0x4abe0f=await _0x2461c7['request'];return(await _0x4abe0f['json']())['items'];},'abortController':_0x2461c7['abortController']};}['uploadUrl'](_0x58c14e,_0x119706,_0x5ede3e){const _0x44417d=this['_sendApiRequest']('/conversations/'+_0x58c14e+'/web-resources','POST',{'url':_0x119706,'attributes':_0x5ede3e});return{'getId':async()=>(await _0x44417d['request'])['json'](),'abortController':_0x44417d['abortController']};}['getModels'](_0x401fbf='en'){const _0x4b1ce1=new URLSearchParams();_0x4b1ce1['append']('language',_0x401fbf);const _0x1077e3='/models/1?'+_0x4b1ce1['toString'](),_0x2342a9=this['_sendApiRequest'](_0x1077e3,'GET',void 0x0,{'useCache':!0x0});return{'list':async()=>await(await _0x2342a9['request'])['json'](),'abortController':_0x2342a9['abortController']};}['deleteFile'](_0x388c77,_0x47f51c){const _0x210c6b=this['_sendApiRequest']('/conversations/'+_0x388c77+'/files/'+_0x47f51c,'DELETE');return{'execute':async()=>{await _0x210c6b['request'];},'abortController':_0x210c6b['abortController']};}['deleteDocument'](_0x501c68,_0x36f406){const _0x597572=this['_sendApiRequest']('/conversations/'+_0x501c68+'/documents/'+_0x36f406,'DELETE');return{'execute':async()=>{await _0x597572['request'];},'abortController':_0x597572['abortController']};}['deleteWebResource'](_0x316435,_0x861d45){const _0x31db33=this['_sendApiRequest']('/conversations/'+_0x316435+'/web-resources/'+_0x861d45,'DELETE');return{'execute':async()=>{await _0x31db33['request'];},'abortController':_0x31db33['abortController']};}['cancelStream'](_0x3b7efd,_0x275bde){const _0x5273d9=this['_sendApiRequest']('/conversations/'+_0x3b7efd+'/messages/'+_0x275bde+'/stream','DELETE',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'execute':async()=>{await _0x5273d9['request'];},'abortController':_0x5273d9['abortController']};}['resumeStream'](_0x27a9a2,_0x12a188,_0x406e5b='0-0'){const _0xadf998=new URLSearchParams({'lastEventId':_0x406e5b}),_0x516e6c=this['_sendApiRequest']('/conversations/'+_0x27a9a2+'/messages/'+_0x12a188+'/stream?'+_0xadf998['toString'](),'GET',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'getStream':async()=>{const _0x34bbd5=await _0x516e6c['request'];return this['_getStreamReader'](_0x34bbd5['body']);},'abortController':_0x516e6c['abortController']};}['callSystemReview']({reviewName:_0x4f969a,content:_0x40edad,args:_0x52909e}){const _0x402a25=this['_sendApiRequest']('/reviews/system/'+_0x4f969a+'/calls','POST',{'content':[{'type':'text','content':_0x40edad}],'args':_0x52909e});return{'getStream':async()=>{const _0x2d1138=(await _0x402a25['request'])['body'];return this['_getStreamReader'](_0x2d1138);},'abortController':_0x402a25['abortController']};}['callCustomReview']({content:_0x56ff2e,prompt:_0x1fc0d5,model:_0x1d427c}){const _0x3dd14c=this['_sendApiRequest']('/reviews/custom/calls','POST',{'content':[{'type':'text','content':_0x56ff2e}],'prompt':_0x1fc0d5,'model':_0x1d427c});return{'getStream':async()=>{const _0x3cc0e7=(await _0x3dd14c['request'])['body'];return this['_getStreamReader'](_0x3cc0e7);},'abortController':_0x3dd14c['abortController']};}['upsertAIChatRating'](_0x4c994d,_0x5545ed,_0x2b98dc){const _0x749020=this['_sendApiRequest']('/conversations/'+_0x4c994d+'/messages/'+_0x5545ed+'/ratings','PUT',{'positiveCount':_0x2b98dc['positiveCount'],'totalCount':_0x2b98dc['totalCount'],'modificationId':_0x2b98dc['modificationId']});return{'execute':async()=>{await _0x749020['request'];},'abortController':_0x749020['abortController']};}['upsertAIActionRating'](_0x201c5f,_0x3ee602,_0x406e69){const _0x4d239b=this['_sendApiRequest']('/actions/system/'+_0x201c5f+'/calls/'+_0x3ee602+'/ratings','PUT',{'positiveCount':_0x406e69['positiveCount'],'totalCount':_0x406e69['totalCount']});return{'execute':async()=>{await _0x4d239b['request'];},'abortController':_0x4d239b['abortController']};}['upsertCustomAIActionRating'](_0x2fb76e,_0x3b29de){const _0x265468=this['_sendApiRequest']('/actions/custom/calls/'+_0x2fb76e+'/ratings','PUT',{'positiveCount':_0x3b29de['positiveCount'],'totalCount':_0x3b29de['totalCount']});return{'execute':async()=>{await _0x265468['request'];},'abortController':_0x265468['abortController']};}['upsertAIReviewRating'](_0x22acd5,_0x3d17ff,_0x234a67,_0x9b5bd4){const _0x5edea6=this['_sendApiRequest']('/reviews/system/'+_0x22acd5+'/calls/'+_0x3d17ff+'/ratings','PUT',{'positiveCount':_0x234a67['positiveCount'],'totalCount':_0x234a67['totalCount'],'dataId':_0x9b5bd4});return{'execute':async()=>{await _0x5edea6['request'];},'abortController':_0x5edea6['abortController']};}['upsertCustomAIReviewRating'](_0x33f012,_0x3f00b1,_0x389697){const _0x172117=this['_sendApiRequest']('/reviews/custom/calls/'+_0x33f012+'/ratings','PUT',{'positiveCount':_0x3f00b1['positiveCount'],'totalCount':_0x3f00b1['totalCount'],'dataId':_0x389697});return{'execute':async()=>{await _0x172117['request'];},'abortController':_0x172117['abortController']};}['_sendApiRequest'](_0x161f18,_0x2247e3,_0x211f5d,_0x44875e={}){const {useCache:_0x22b8a0=!0x1,apiUrl:_0x2ef071=this['_apiUrl']}=_0x44875e,_0x553144=new AbortController(),_0x525a64=_0x22b8a0?_0x2247e3+':'+_0x161f18:null;if(_0x525a64){const _0x1ff450=this['_responseCache']['get'](_0x525a64);if(_0x1ff450)return{'request':_0x1ff450['then'](_0x5183a7=>_0x5183a7['clone']()),'abortController':_0x553144};}const _0x344902=_0x211f5d instanceof FormData,_0x1475a8={'Authorization':'Bearer\x20'+this['_token']?.['value'],'X-Editor-Version':pt};_0x211f5d&&!_0x344902&&(_0x1475a8['Content-Type']='application/json');const _0x5477b4={'method':_0x2247e3,'headers':_0x1475a8,'signal':_0x553144['signal']};_0x211f5d&&(_0x5477b4['body']=_0x344902?_0x211f5d:JSON['stringify'](_0x211f5d));const _0x462d1a=fetch(''+_0x2ef071+_0x161f18,_0x5477b4)['catch'](_0x46dec1=>{_0x525a64&&this['_responseCache']['delete'](_0x525a64),this['_handleError'](_0x46dec1);})['then'](_0x5b88ae=>_0x5b88ae['ok']?_0x5b88ae:_0x5b88ae['json']()['then'](_0x395cc1=>{throw _0x525a64&&this['_responseCache']['delete'](_0x525a64),{'url':_0x2ef071,'path':_0x161f18,'method':_0x2247e3,'body':_0x211f5d,'status':(_0x5b88ae||{})['status'],'statusText':(_0x5b88ae||{})['statusText'],'code':_0x395cc1['code'],'message':_0x395cc1['message'],'traceId':_0x395cc1['traceId']};}));return _0x525a64&&this['_responseCache']['set'](_0x525a64,_0x462d1a['then'](_0x328e96=>_0x328e96['clone']())),{'request':_0x462d1a,'abortController':_0x553144};}async*['_getStreamReader'](_0x203512){const _0x3bd721=[],_0x34d9fd=_0x203512['getReader'](),_0x583167=_0x5383e1({'onError':_0x575423=>{this['_handleError'](_0x575423);},'onEvent':_0x1e733a=>{_0x1e733a['data']=JSON['parse'](_0x1e733a['data']),_0x3bd721['push'](_0x1e733a);}});try{let _0x5002bd=!0x1;for(;!_0x5002bd;){const {done:_0x5e948e,value:_0x374c90}=await _0x34d9fd['read']();_0x5e948e&&(_0x5002bd=!0x0),_0x583167['feed'](this['_decoder']['decode'](_0x374c90,{'stream':!0x0})),yield*_0x3bd721,_0x3bd721['length']=0x0;}}catch(_0x1b2bbb){this['_handleError'](_0x1b2bbb);}finally{_0x34d9fd['releaseLock'](),_0x583167['reset']();}}['_handleError'](_0x2bb552){if(_0x2bb552 instanceof ht)throw _0x2bb552;if(_0x2bb552 instanceof Error&&'AbortError'===_0x2bb552['name'])throw new ht('ai-request-aborted',this,{'originalError':_0x2bb552});throw new ht('ai-request-failed',this,{'originalError':_0x2bb552});}}function Mi(_0x429a88,_0x299770,_0x445663){const t=_0x429a88['t'];switch(_0x299770){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'},_0x445663);case'AI_SUGGESTION_CONTENT_PART_REJECTED':return t({'id':'AI_SUGGESTION_CONTENT_PART_REJECTED','string':'Change\x20was\x20rejected'});case'AI_SUGGESTION_CONTENT_PART_OUTDATED':return t({'id':'AI_SUGGESTION_CONTENT_PART_OUTDATED','string':'Change\x20is\x20outdated'});case'AI_SUGGESTION_CONTENT_PART_ALREADY_APPLIED':return t({'id':'AI_SUGGESTION_CONTENT_PART_ALREADY_APPLIED','string':'Change\x20is\x20already\x20applied'});case'AI_SUGGESTION_CONTENT_PART_APPLY':return t({'id':'AI_SUGGESTION_CONTENT_PART_APPLY','string':'Apply\x20change'});case'AI_SUGGESTION_CONTENT_PART_ADD_SUGGESTION':return t({'id':'AI_SUGGESTION_CONTENT_PART_ADD_SUGGESTION','string':'Add\x20as\x20suggestion'});case'AI_SUGGESTION_CONTENT_PART_REJECT':return t({'id':'AI_SUGGESTION_CONTENT_PART_REJECT','string':'Reject\x20change'});case'AI_SUGGESTION_CONTENT_PART_REMOVED':return t({'id':'AI_SUGGESTION_CONTENT_PART_REMOVED','string':'Removed\x20content.\x20Use\x20\x22Show\x20details\x22\x20to\x20learn\x20more.'});case'AI_SUGGESTION_CONTENT_PART_STATE_ACCEPTED':return t({'id':'AI_SUGGESTION_CONTENT_PART_STATE_ACCEPTED','string':'Approved'});case'AI_SUGGESTION_CONTENT_PART_STATE_REJECTED':return t({'id':'AI_SUGGESTION_CONTENT_PART_STATE_REJECTED','string':'Rejected'});case'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED':return t({'id':'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED','string':'Outdated'});case'AI_DISCLAIMER_TEXT':return t({'id':'AI_DISCLAIMER_TEXT','string':'AI\x20can\x20make\x20mistakes.\x20Please\x20double-check\x20responses.'});case'AI_TABS_LABEL_MAXIMIZE':return t({'id':'AI_TABS_LABEL_MAXIMIZE','string':'Maximize'});case'AI_TABS_LABEL_MINIMIZE':return t({'id':'AI_TABS_LABEL_MINIMIZE','string':'Minimize'});case'AI_CHAT_HEADING':return t({'id':'AI_CHAT_HEADING','string':'Chat'});case'AI_CHAT_SOURCES_HEADER':return t({'id':'AI_CHAT_SOURCES_HEADER','string':'Sources'});case'AI_CHAT_UNTITLED_CONVERSATION':return t({'id':'AI_CHAT_UNTITLED_CONVERSATION','string':'Untitled\x20conversation'});case'AI_CHAT_LABEL_NEW_CHAT':return t({'id':'AI_CHAT_LABEL_NEW_CHAT','string':'New\x20chat'});case'AI_CHAT_STOP_GENERATING':return t({'id':'AI_CHAT_STOP_GENERATING','string':'Stop\x20generating'});case'AI_CHAT_IS_WRITING':return t({'id':'AI_CHAT_IS_WRITING','string':'AI\x20is\x20writing...'});case'AI_CHAT_PROMPT_EMPTY_ERROR':return t({'id':'AI_CHAT_PROMPT_EMPTY_ERROR','string':'This\x20field\x20cannot\x20be\x20empty.'});case'AI_CHAT_LABEL_SUBMIT':return t({'id':'AI_CHAT_LABEL_SUBMIT','string':'Submit'});case'AI_CHAT_WELCOME_MESSAGE':return t({'id':'AI_CHAT_WELCOME_MESSAGE','string':'Hi!\x20I\x20can\x20help\x20you\x20draft,\x20rewrite,\x20and\x20improve\x20your\x20text,\x20explore\x20ideas,\x20research\x20topics,\x20and\x20solve\x20problems.\x20How\x20can\x20I\x20help\x20right\x20now?'});case'AI_CHAT_ABORTED_MESSAGE':return t({'id':'AI_CHAT_ABORTED_MESSAGE','string':'Response\x20stopped.'});case'AI_CHAT_GENERIC_ERROR':return t({'id':'AI_CHAT_GENERIC_ERROR','string':'Something\x20went\x20wrong\x20while\x20processing\x20your\x20request.\x20Please\x20try\x20again.'});case'AI_CHAT_UNABLE_TO_START_CONVERSATION':return t({'id':'AI_CHAT_UNABLE_TO_START_CONVERSATION','string':'Unable\x20to\x20start\x20conversation.\x20Please\x20make\x20sure\x20you\x20are\x20online\x20and\x20try\x20again.'});case'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION':return t({'id':'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION','string':'Unable\x20to\x20load\x20chosen\x20conversation.\x20Please\x20make\x20sure\x20you\x20are\x20online\x20and\x20try\x20again.'});case'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_FILE':return t({'id':'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_FILE','string':'Failed\x20to\x20upload\x20files:\x20%0.\x20Please\x20try\x20again.'},_0x445663);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.'},_0x445663);case'AI_CHAT_RESOURCE_LOAD_FAILED':return t({'id':'AI_CHAT_RESOURCE_LOAD_FAILED','string':'Failed\x20to\x20load\x20resource.\x20Please\x20try\x20again.'});case'AI_CHAT_CONTEXT_CURRENT_DOCUMENT':return t({'id':'AI_CHAT_CONTEXT_CURRENT_DOCUMENT','string':'Current\x20document'});case'AI_CHAT_CONTEXT_PASTED_TEXT_NAME':return t({'id':'AI_CHAT_CONTEXT_PASTED_TEXT_NAME','string':'Pasted\x20Text'});case'AI_CHAT_DROP_ZONE_HINT':return t({'id':'AI_CHAT_DROP_ZONE_HINT','string':'Drop\x20files\x20here\x20to\x20add\x20to\x20the\x20chat'});case'AI_CHAT_CONTEXT_REMOVE_FROM_CONTEXT':return t({'id':'AI_CHAT_CONTEXT_REMOVE_FROM_CONTEXT','string':'Remove\x20from\x20context'});case'AI_CHAT_CONTEXT_ADD_CONTEXT':return t({'id':'AI_CHAT_CONTEXT_ADD_CONTEXT','string':'Add\x20context'});case'AI_CHAT_CONTEXT_URL_LABEL':return t({'id':'AI_CHAT_CONTEXT_URL_LABEL','string':'URL'});case'AI_CHAT_CONTEXT_FILE_LABEL':return t({'id':'AI_CHAT_CONTEXT_FILE_LABEL','string':'File'});case'AI_CHAT_CONTEXT_CURRENT_CONTEXT_LABEL':return t({'id':'AI_CHAT_CONTEXT_CURRENT_CONTEXT_LABEL','string':'Current\x20context'});case'AI_CHAT_CONTEXT_DOCUMENT_SELECTION_LABEL':return t({'id':'AI_CHAT_CONTEXT_DOCUMENT_SELECTION_LABEL','string':'Selected\x20content'});case'AI_CHAT_SEARCH_WEB':return t({'id':'AI_CHAT_SEARCH_WEB','string':'Web\x20search'});case'AI_CHAT_ENABLE_WEB_SEARCH':return t({'id':'AI_CHAT_ENABLE_WEB_SEARCH','string':'Enable\x20web\x20search'});case'AI_CHAT_DISABLE_WEB_SEARCH':return t({'id':'AI_CHAT_DISABLE_WEB_SEARCH','string':'Disable\x20web\x20search'});case'AI_CHAT_REASONING':return t({'id':'AI_CHAT_REASONING','string':'Reasoning'});case'AI_CHAT_ENABLE_REASONING':return t({'id':'AI_CHAT_ENABLE_REASONING','string':'Enable\x20reasoning'});case'AI_CHAT_DISABLE_REASONING':return t({'id':'AI_CHAT_DISABLE_REASONING','string':'Disable\x20reasoning'});case'AI_CHAT_COMMANDS':return t({'id':'AI_CHAT_COMMANDS','string':'Commands'});case'AI_CHAT_SEARCH_RESOURCES':return t({'id':'AI_CHAT_SEARCH_RESOURCES','string':'Search\x20resources'});case'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT':return t({'id':'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT','string':'Back\x20to\x20context\x20options'});case'AI_CHAT_CONTEXT_URL_ADD_URL':return t({'id':'AI_CHAT_CONTEXT_URL_ADD_URL','string':'Add\x20URL'});case'AI_CHAT_CONTEXT_URL_PLACEHOLDER':return t({'id':'AI_CHAT_CONTEXT_URL_PLACEHOLDER','string':'Add\x20URL...'});case'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_URL':return t({'id':'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_URL','string':'Failed\x20to\x20upload\x20URL:\x20%0.\x20Please\x20try\x20again.'},_0x445663);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'},_0x445663);case'AI_CHAT_SUGGESTION_ACTION_SUGGEST':return t({'id':'AI_CHAT_SUGGESTION_ACTION_SUGGEST','string':'Suggest'},_0x445663);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'},_0x445663);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.'},_0x445663);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.'},_0x445663);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.'},_0x445663);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.'},_0x445663);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'},_0x445663);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.'},_0x445663);case'AI_QUICK_ACTIONS_OTHER':return t({'id':'AI_QUICK_ACTIONS_OTHER','string':'Other'});case'AI_ACTIONS_GENERIC_ERROR':return t({'id':'AI_ACTIONS_GENERIC_ERROR','string':'Sorry,\x20we\x20couldn\x27t\x20generate\x20the\x20response.\x20Please\x20try\x20again\x20in\x20a\x20moment.'});case'AI_BALLOON_SELECTION_REMOVED_ERROR':return t({'id':'AI_BALLOON_SELECTION_REMOVED_ERROR','string':'Changes\x20cannot\x20be\x20applied.\x20The\x20original\x20content\x20no\x20longer\x20exists.'});case'AI_REVIEW_MODE_STOP_GENERATING':return t({'id':'AI_REVIEW_MODE_STOP_GENERATING','string':'Stop\x20generating'});case'AI_REVIEW_MODE_HIDE_CHANGES':return t({'id':'AI_REVIEW_MODE_HIDE_CHANGES','string':'Hide\x20changes'});case'AI_REVIEW_MODE_SHOW_CHANGES':return t({'id':'AI_REVIEW_MODE_SHOW_CHANGES','string':'Show\x20changes'});case'AI_REVIEW_MODE_ACCEPT_ALL':return t({'id':'AI_REVIEW_MODE_ACCEPT_ALL','string':'Accept\x20all'});case'AI_REVIEW_MODE_EXIT_REVIEW':return t({'id':'AI_REVIEW_MODE_EXIT_REVIEW','string':'Exit\x20review'});case'AI_REVIEW_MODE_ACCEPT_CHANGE':return t({'id':'AI_REVIEW_MODE_ACCEPT_CHANGE','string':'Accept'});case'AI_REVIEW_MODE_DISMISS_CHANGE':return t({'id':'AI_REVIEW_MODE_DISMISS_CHANGE','string':'Dismiss'});case'AI_REVIEW_MODE_LEARN_MORE':return t({'id':'AI_REVIEW_MODE_LEARN_MORE','string':'Learn\x20more'});case'AI_REVIEW_MODE_COMPLETED_TEXT':return t({'id':'AI_REVIEW_MODE_COMPLETED_TEXT','string':'There\x27s\x20nothing\x20left\x20to\x20review.'});case'AI_REVIEW_MODE_EMPTY_RESULTS_TEXT':return t({'id':'AI_REVIEW_MODE_EMPTY_RESULTS_TEXT','string':'There\x20are\x20no\x20changes\x20to\x20suggest.'});case'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL':return t({'id':'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL','string':'Finish\x20Review'});case'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE':return t({'id':'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE','string':'Review\x20complete.\x20Finish\x20when\x20ready.'});case'AI_REVIEW_INITIALIZATION_ERROR_MESSAGE':return t({'id':'AI_REVIEW_INITIALIZATION_ERROR_MESSAGE','string':'AI\x20Review\x20initialized\x20with\x20errors.\x20Some\x20features\x20may\x20not\x20be\x20available\x20or\x20work\x20properly.'});case'AI_REVIEW_MODE_GENERAL_ERROR_MESSAGE':return t({'id':'AI_REVIEW_MODE_GENERAL_ERROR_MESSAGE','string':'Sorry,\x20we\x20couldn\x27t\x20generate\x20the\x20whole\x20review\x20properly.\x20Please\x20try\x20again\x20in\x20a\x20moment.'});case'AI_REVIEW_MODE_CHUNK_ERROR_MESSAGE':return t({'id':'AI_REVIEW_MODE_CHUNK_ERROR_MESSAGE','string':'Not\x20everything\x20went\x20through,\x20but\x20the\x20completed\x20items\x20are\x20listed\x20below.'});case'AI_REVIEW_MODE':return t({'id':'AI_REVIEW_MODE','string':'Review'});case'AI_REVIEW_MODE_PROMPT_EMPTY_ERROR':return t({'id':'AI_REVIEW_MODE_PROMPT_EMPTY_ERROR','string':'Prompt\x20must\x20not\x20be\x20empty'});case'AI_REVIEW_CHECK_CUSTOM_TITLE':return t({'id':'AI_REVIEW_CHECK_CUSTOM_TITLE','string':'Custom\x20command'});case'AI_REVIEW_CHECK_CUSTOM_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_CUSTOM_DESCRIPTION','string':'Enter\x20a\x20custom\x20command\x20for\x20a\x20specific\x20review.'});case'AI_REVIEW_CHECK_CORRECTNESS_TITLE':return t({'id':'AI_REVIEW_CHECK_CORRECTNESS_TITLE','string':'Proofread'});case'AI_REVIEW_CHECK_CORRECTNESS_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_CORRECTNESS_DESCRIPTION','string':'Check\x20the\x20text\x20for\x20errors\x20in\x20grammar,\x20spelling,\x20and\x20punctuation.'});case'AI_REVIEW_CHECK_CLARITY_TITLE':return t({'id':'AI_REVIEW_CHECK_CLARITY_TITLE','string':'Improve\x20clarity'});case'AI_REVIEW_CHECK_CLARITY_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_CLARITY_DESCRIPTION','string':'Improve\x20the\x20logical\x20structure\x20and\x20precision\x20for\x20clearer\x20message.'});case'AI_REVIEW_CHECK_READABILITY_TITLE':return t({'id':'AI_REVIEW_CHECK_READABILITY_TITLE','string':'Improve\x20readability'});case'AI_REVIEW_CHECK_READABILITY_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_READABILITY_DESCRIPTION','string':'Adjust\x20sentence\x20structure\x20and\x20word\x20choice\x20for\x20an\x20easier\x20read.'});case'AI_REVIEW_CHECK_MAKE_TITLE':return t({'id':'AI_REVIEW_CHECK_MAKE_TITLE','string':'Adjust\x20length'});case'AI_REVIEW_CHECK_MAKE_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_MAKE_DESCRIPTION','string':'Shorten\x20or\x20lengthen\x20the\x20text\x20as\x20needed.'});case'AI_REVIEW_CHECK_MAKE_OPTIONS_LABEL':return t({'id':'AI_REVIEW_CHECK_MAKE_OPTIONS_LABEL','string':'Adjust\x20length'});case'AI_REVIEW_CHECK_MAKE_OPTIONS_DATA_LONGER':return t({'id':'AI_REVIEW_CHECK_MAKE_OPTIONS_DATA_LONGER','string':'Longer'});case'AI_REVIEW_CHECK_MAKE_OPTIONS_DATA_SHORTER':return t({'id':'AI_REVIEW_CHECK_MAKE_OPTIONS_DATA_SHORTER','string':'Shorter'});case'AI_REVIEW_CHECK_MAKE_TONE_TITLE':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_TITLE','string':'Adjust\x20tone\x20and\x20style'});case'AI_REVIEW_CHECK_MAKE_TONE_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_DESCRIPTION','string':'Modify\x20the\x20text\x20to\x20a\x20desired\x20tone\x20and\x20style.'});case'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_LABEL':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_LABEL','string':'Adjust\x20tone\x20and\x20style'});case'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_CASUAL':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_CASUAL','string':'Casual'});case'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_DIRECT':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_DIRECT','string':'Direct'});case'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_FRIENDLY':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_FRIENDLY','string':'Friendly'});case'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_CONFIDENT':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_CONFIDENT','string':'Confident'});case'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_PROFESSIONAL':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_PROFESSIONAL','string':'Professional'});case'AI_REVIEW_CHECK_TRANSLATE_TITLE':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_TITLE','string':'Translate'});case'AI_REVIEW_CHECK_TRANSLATE_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_DESCRIPTION','string':'Translate\x20the\x20text\x20into\x20another\x20language.'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_LABEL':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_LABEL','string':'Select\x20language'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_ENGLISH':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_ENGLISH','string':'English'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_SPANISH':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_SPANISH','string':'Spanish'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_FRENCH':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_FRENCH','string':'French'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_GERMAN':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_GERMAN','string':'German'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_CHINESE':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_CHINESE','string':'Chinese\x20(Simplified)'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_JAPANESE':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_JAPANESE','string':'Japanese'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_RUSSIAN':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_RUSSIAN','string':'Russian'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_PORTUGUESE':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_PORTUGUESE','string':'Portuguese'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_KOREAN':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_KOREAN','string':'Korean'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_ITALIAN':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_ITALIAN','string':'Italian'});case'AI_REVIEW_MODE_CHECK_STATUS_ACCEPTED':return t({'id':'AI_REVIEW_MODE_CHECK_STATUS_ACCEPTED','string':'Accepted'});case'AI_REVIEW_MODE_CHECK_STATUS_REJECTED':return t({'id':'AI_REVIEW_MODE_CHECK_STATUS_REJECTED','string':'Dismissed'});case'AI_REVIEW_MODE_CHECK_STATUS_OUTDATED':return t({'id':'AI_REVIEW_MODE_CHECK_STATUS_OUTDATED','string':'Outdated'});case'AI_TOGGLE_BUTTON_LABEL':return t({'id':'AI_TOGGLE_BUTTON_LABEL','string':'AI'});case'AI_TRANSLATE_ACCEPT_ALL':return t({'id':'AI_TRANSLATE_ACCEPT_ALL','string':'Accept\x20translation'});case'AI_TRANSLATE_FINISH_HEADER_TITLE':return t({'id':'AI_TRANSLATE_FINISH_HEADER_TITLE','string':'Translation\x20complete.\x20Finish\x20when\x20ready.'});case'AI_TRANSLATE_EMPTY_RESULTS_TEXT':return t({'id':'AI_TRANSLATE_EMPTY_RESULTS_TEXT','string':'There\x20are\x20no\x20translations\x20to\x20review.'});case'AI_TRANSLATE_FINISH_BUTTON_LABEL':return t({'id':'AI_TRANSLATE_FINISH_BUTTON_LABEL','string':'Finish\x20Translation'});case'AI_TRANSLATE_CHECK_LIST_HEADER_TITLE':return t({'id':'AI_TRANSLATE_CHECK_LIST_HEADER_TITLE','string':'Content\x20Translation'});case'AI_TRANSLATE_CHECK_LIST_HEADER_DESCRIPTION':return t({'id':'AI_TRANSLATE_CHECK_LIST_HEADER_DESCRIPTION','string':'A\x20dedicated\x20mode\x20for\x20translating\x20the\x20entire\x20text.'});case'AI_TRANSLATE_CHECK_RESULTS_LOADING_TITLE':return t({'id':'AI_TRANSLATE_CHECK_RESULTS_LOADING_TITLE','string':'Translating\x20to'});case'AI_TRANSLATE_CHECK_RESULTS_READY_TITLE':return t({'id':'AI_TRANSLATE_CHECK_RESULTS_READY_TITLE','string':'Translated\x20to'});case'AI_TRANSLATE_GENERAL_ERROR_MESSAGE':return t({'id':'AI_TRANSLATE_GENERAL_ERROR_MESSAGE','string':'Sorry,\x20we\x20couldn\x27t\x20generate\x20translations\x20properly.\x20Please\x20try\x20again\x20in\x20a\x20moment.'});case'AI_SUGGESTION_DISABLED_TOOLTIP_MESSAGE':return t({'id':'AI_SUGGESTION_DISABLED_TOOLTIP_MESSAGE','string':'This\x20conversation\x20is\x20loaded\x20from\x20chat\x20history\x20from\x20a\x20previous\x20session,\x20so\x20you\x20can’t\x20apply,\x20reject,\x20or\x20suggest\x20changes.'});case'AI_SUGGESTION_DISABLED_FEED_MESSAGE':return t({'id':'AI_SUGGESTION_DISABLED_FEED_MESSAGE','string':'Actions\x20aren’t\x20available\x20for\x20changes\x20from\x20a\x20previous\x20session.'});default:return _0x299770;}}const Ui='ck-ai-button-primary',Bi='ck-ai-button-secondary',Gi='ck-ai-button-tertiary';function Fi(_0x18c66a,_0x46e106){const _0x51b3f2=new yt(_0x18c66a),_0x312a9c=Mi(_0x18c66a,'AI_TABS_LABEL_MINIMIZE'),_0x95ddc6=Mi(_0x18c66a,'AI_TABS_LABEL_MAXIMIZE');return _0x51b3f2['set']({'withText':!0x1,'icon':_0x49dec8,'tooltip':!0x0,'class':'ck-ai-tabs__resize\x20'+Gi}),_0x51b3f2['bind']('label')['to'](_0x46e106,'isMaximized',_0x55a3b6=>_0x55a3b6?_0x312a9c:_0x95ddc6),_0x51b3f2['bind']('icon')['to'](_0x46e106,'isMaximized',_0x340ea0=>_0x340ea0?_0x2e7798:_0x49dec8),_0x51b3f2['bind']('isOn')['to'](_0x46e106,'isMaximized'),_0x51b3f2['on']('execute',()=>{_0x46e106['fire']('resizeTabs');}),_0x51b3f2;}function Wi(_0x59adbd,_0x4d2cfc){return _0x32f939(_0x59adbd,_0x4d2cfc);}function Ki(_0x211b22,_0x1be4bc){return _0x2ec60a(_0x211b22,_0x1be4bc);}function Yi(_0x1679ef,_0x1faffa,_0x8ab216){const _0x271dc0=null!==_0x1faffa?_0x3a5eb2=>_0x3a5eb2['attribs'][_0x1679ef]===_0x1faffa:_0x436dc8=>Boolean(_0x436dc8['attribs'][_0x1679ef]);return _0x4f4d32(_0xb19c13=>_0x4b89ac(_0xb19c13)&&_0x271dc0(_0xb19c13),_0x8ab216);}function $i(_0x3bd1c6,_0x250ae0,_0x2a1a18){const _0x834305=null!==_0x250ae0?_0x2f3f84=>_0x2f3f84['attribs'][_0x3bd1c6]===_0x250ae0:_0x20dba8=>Boolean(_0x20dba8['attribs'][_0x3bd1c6]);return _0x3d5111(_0x354311=>_0x4b89ac(_0x354311)&&_0x834305(_0x354311),_0x2a1a18);}function qi(_0x48fc51){return _0x3d5111(_0x3bd670=>_0x4b89ac(_0x3bd670)&&function(_0x43b63b){const _0x4f0b5f=_0x43b63b['toLowerCase']();return'script'===_0x4f0b5f||'style'===_0x4f0b5f||_0x4f0b5f['includes']('-');}(_0x3bd670['name']),_0x48fc51);}function Qi(_0x1ca95a){return _0x11f9a2(_0x34db8b=>_0x340a48(_0x34db8b),_0x1ca95a,!0x0,0x1/0x0);}function Xi(_0xcdc5cb,_0x2c29e9){return _0xcdc5cb&&_0x4b89ac(_0xcdc5cb)?_0xcdc5cb['attribs'][_0x2c29e9]:null;}function zi(_0x5c824c,_0xb92568,_0x21d738){_0x4b89ac(_0x5c824c)&&(null===_0x21d738?delete _0x5c824c['attribs'][_0xb92568]:_0x5c824c['attribs'][_0xb92568]=_0x21d738);}function ji(_0x4d86b0,_0x2c49ca,_0x4ce971){const _0x5c7a5f=_0x2c49ca['cloneNode'](!0x0);'beforebegin'===_0x4ce971?_0x46d239(_0x4d86b0,_0x5c7a5f):'afterbegin'===_0x4ce971?_0x33d667(_0x4d86b0,_0x5c7a5f):'beforeend'===_0x4ce971?_0x5c01e9(_0x4d86b0,_0x5c7a5f):'afterend'===_0x4ce971&&_0x147a64(_0x4d86b0,_0x5c7a5f);}function Ji(_0xa4c0bd){const _0x333393=[];let _0x3e6fb1=_0xa4c0bd;for(;_0x3e6fb1;)_0x3e6fb1=_0x23f1a3(_0x3e6fb1),_0x3e6fb1&&_0x333393['push'](_0x3e6fb1);return _0x333393;}function Zi(_0x3d2ec9){return _0x3d2ec9['replace'](/^\s+/gm,'')['replace'](/\s+$/gm,'')['replace'](/\n*/g,'')['replace'](/\s+/g,'\x20')['replace'](/>\s*</g,'><');}function ts(_0x1c8ff8){let _0x64fe64=0x0;for(;_0x1c8ff8['parentNode'];)_0x1c8ff8=_0x1c8ff8['parentNode'],_0x64fe64++;return _0x64fe64;}function es(_0x2b1c00){const _0xdaaee5=[];let _0x3bde2a=_0x2b1c00['nextSibling'];for(;_0x3bde2a;)_0xdaaee5['push'](_0x3bde2a),_0x3bde2a=_0x3bde2a['nextSibling'];_0xdaaee5['forEach'](_0x191ddd=>{_0x4b0b34(_0x191ddd);});}class AIResponseParser extends/* #__PURE__ -- @preserve */
25
+ ct(){['_m2html'];constructor(){super();const _0x155b1e=Object['entries'](_0x12df0a),_0x15a0fd=_0x155b1e['findIndex'](([_0x3fc4bf])=>'rehypeDomRaw'===_0x3fc4bf);if(-0x1===_0x15a0fd)throw new ht('ai-response-parser-unable-to-set-up-parser');_0x155b1e['splice'](_0x15a0fd+0x1,0x0,['rehypeSanitize',_0x26ed0c]),this['_m2html']=new _0x4b64be({'plugins':Object['fromEntries'](_0x155b1e)});}['convertMarkdownToHTML'](_0x57d37a){const _0x56d4e9=this['_m2html']['parse'](_0x57d37a);return this['parseAndNormalizeHTML'](_0x56d4e9);}['parseAndNormalizeHTML'](_0x4b21e0){return this['_parseHTML'](_0x4b21e0);}['_parseHTML'](_0x58d3fa){const _0x98cf14=Wi('<dummy>'+_0x58d3fa['replace'](/^\t+/gm,'\x20')['replace'](/\n*/g,'')['replace'](/\s+/g,'\x20')['replace'](/<[^>]*?$/g,'')+'</dummy>');return _0x98cf14['children']=_0x98cf14['children'][0x0]['children'],_0x98cf14;}}class AIResponseApplier extends/* #__PURE__ -- @preserve */
26
+ ct(){['_generateUid'];['_uidCounter']=0x0;['_touchedNodesState']={'newIds':[],'modifiedIds':[],'removedIds':[],'invalidIds':[],'lastTouchedId':null,'rescuedNewIds':new Set()};['_existingDataIds']=new Set();['_referencedExistingIds']=new Set();constructor(_0x33d815){super(),this['_generateUid']=_0x33d815||(()=>'e'+String(this['_uidCounter']++));}['merge'](_0x2fc65e,_0x3b7044,_0x3e4ca9){this['_uidCounter']=0x0;const _0x3fca4c=_0x2fc65e['cloneNode'](!0x0);ns(_0x3b7044,_0x3fca4c);const _0x4f132c=_0x3fca4c['childNodes'],_0x595ef2=Array['from'](_0x4f132c)['filter'](_0x8a0651=>!(0x3===_0x8a0651['nodeType']&&''===Ki(_0x8a0651)['trim']())),_0x189167=_0x595ef2['length'];for(const _0x2f1313 of _0x595ef2)_0x2f1313&&_0x4b89ac(_0x2f1313)&&void 0x0===_0x2f1313['attribs']['data-id']&&zi(_0x2f1313,'data-id','new-element');if(0x0===_0x3b7044['childNodes']['length']){const _0x1a362d=[];return $i('data-id','new-element',_0x3fca4c)['forEach'](_0x243c5f=>{const _0x4ddf29=this['_generateUid']();zi(_0x243c5f,'data-id',_0x4ddf29),_0x1a362d['push'](_0x4ddf29);}),this['_removeSpecialComments'](_0x3fca4c),{'parsedContent':_0x3fca4c,'newNodeIds':_0x1a362d,'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(),this['_existingDataIds']=new Set($i('data-id',null,_0x3b7044)['map'](_0x1dc8b1=>Xi(_0x1dc8b1,'data-id'))['filter'](_0x5d8440=>!!_0x5d8440));let _0x5b6b42=-0x1,_0x48862=!0x1;for(let _0x32e835=0x0;_0x32e835<_0x189167;_0x32e835++){const _0x51a474=_0x595ef2[_0x32e835],_0x21ec09=_0x595ef2[_0x32e835+0x1];if(this['_isNewNode'](_0x51a474)){if(-0x1===_0x5b6b42&&(_0x5b6b42=_0x32e835),this['_markWrappedElements'](_0x51a474),!this['_isNewNode'](_0x21ec09)){const [_0x42ab14,_0x4ef7e6]=this['_findReferenceNode'](_0x51a474,_0x48862,_0x3b7044);if(_0x42ab14){const _0x50bd03=Array['from'](_0x595ef2)['slice'](_0x5b6b42,_0x32e835+0x1);this['_insertNodes'](_0x42ab14,_0x50bd03,_0x4ef7e6),_0x5b6b42=-0x1;}}}else{if(this['_isExistingContentComment'](_0x51a474))_0x48862=!0x0;else{if(this['_isExistingNode'](_0x51a474)){const _0x2c221b=Xi(_0x51a474,'data-id');if(_0x2c221b&&this['_existingDataIds']['has'](_0x2c221b)){this['_referencedExistingIds']['add'](_0x2c221b);const _0x37d186=Yi('data-id',_0x2c221b,_0x3b7044);this['_replaceNode'](_0x37d186,_0x51a474);}}else{if(is(_0x51a474)){const _0x3110a0=ss(_0x51a474);!!Yi('data-id',_0x3110a0,_0x3fca4c)||this['_touchedNodesState']['removedIds']['push'](_0x3110a0);}}}}}for(const _0x44ffe7 of this['_touchedNodesState']['removedIds']){const _0x20d0f7=Yi('data-id',_0x44ffe7,_0x3b7044);_0x20d0f7&&(this['_rescueUnwrappedElements'](_0x20d0f7),this['_removeNode'](_0x20d0f7,_0x44ffe7,_0x3e4ca9));}if($i('data-id','new-element',_0x3b7044)['forEach'](_0x259072=>{const _0x2da7be=this['_getUid'](_0x259072);zi(_0x259072,'data-id',_0x2da7be),this['_touchedNodesState']['newIds']['push'](_0x2da7be);}),this['_removeSpecialComments'](_0x3b7044),_0x3e4ca9&&_0x3e4ca9['cutAfterUnstable']){const _0x1712a0=this['_findLastConfirmationPoint'](_0x595ef2),_0x1147bb=this['_getLastStableElement'](_0x3b7044,_0x1712a0);this['_markUnstableElements'](_0x3b7044,_0x1147bb);}if(this['_processWrappedElements'](_0x3b7044,_0x3e4ca9),_0x3e4ca9&&_0x3e4ca9['cutAfterUnstable']&&this['_touchedNodesState']['lastTouchedId']){const _0x1d0b15=$i('data-id',this['_touchedNodesState']['lastTouchedId'],_0x3b7044);let _0x24f96f=_0x1d0b15[_0x1d0b15['length']-0x1];for(;_0x24f96f;)es(_0x24f96f),_0x24f96f=_0x24f96f['parentNode'];}return{'parsedContent':_0x3b7044,'newNodeIds':this['_touchedNodesState']['newIds'],'modifiedNodeIds':this['_touchedNodesState']['modifiedIds'],'removedNodeIds':this['_touchedNodesState']['removedIds']};}['_insertNodes'](_0x3f4e6d,_0x2f13ae,_0x40f20c){for(const _0x3b309b of _0x2f13ae){const _0x28662f=this['_getUid'](_0x3b309b);zi(_0x3b309b,'data-id',_0x28662f),this['_touchedNodesState']['newIds']['push'](_0x28662f),this['_touchedNodesState']['lastTouchedId']=_0x28662f;}const _0x437f2a='afterbegin'===_0x40f20c||'afterend'===_0x40f20c?_0x2f13ae['reverse']():_0x2f13ae;for(const _0x8bd4dc of _0x437f2a)ji(_0x3f4e6d,_0x8bd4dc,_0x40f20c);}['_replaceNode'](_0x306f7b,_0x52d470){if(!_0x306f7b)return;if(_0x472892=_0x52d470,Zi(Ki(_0x306f7b))===Zi(Ki(_0x472892)))return;var _0x472892;const _0x5ac09a=Xi(_0x306f7b,'data-id');this['_touchedNodesState']['modifiedIds']['push'](_0x5ac09a),this['_touchedNodesState']['lastTouchedId']=_0x5ac09a,_0x38fc69(_0x306f7b,_0x52d470['cloneNode'](!0x0));}['_removeNode'](_0xc7af63,_0x14cadf,_0x3083f5){if(_0x3083f5&&_0x3083f5['replaceRemovedWith']){this['_touchedNodesState']['lastTouchedId']=_0x14cadf;const _0x1aae68=_0x3083f5['replaceRemovedWith']['cloneNode'](!0x0);zi(_0x1aae68,'data-id',_0x14cadf),zi(_0x1aae68,'data-removed','true'),_0x38fc69(_0xc7af63,_0x1aae68);}else _0x4b0b34(_0xc7af63);}['_findReferenceNode'](_0x554b30,_0x47f2c8,_0x4eaf0c){const _0x458b2f=this['_findPrevElementWithDataId'](_0x554b30,!0x1);if(_0x458b2f){const _0x1d695d=ss(_0x458b2f),_0x222357=Yi('data-id',_0x1d695d,_0x4eaf0c);if(_0x222357)return[_0x222357,'afterend'];this['_touchedNodesState']['invalidIds']['push'](_0x1d695d);}const _0x32ba1a=this['_findNextElementWithDataId'](_0x554b30,!0x1);if(_0x32ba1a){const _0x37249c=ss(_0x32ba1a),_0x239d2c=Yi('data-id',_0x37249c,_0x4eaf0c);if(_0x239d2c)return[_0x239d2c,'beforebegin'];this['_touchedNodesState']['invalidIds']['push'](_0x37249c);}return _0x47f2c8?_0x554b30['nextSibling']?this['_findFallbackReferenceNode'](_0x554b30,_0x4eaf0c):[_0x4eaf0c['childNodes'][_0x4eaf0c['childNodes']['length']-0x1],'afterend']:[_0x4eaf0c['childNodes'][0x0],'beforebegin'];}['_findFallbackReferenceNode'](_0x5ac6da,_0x29c4aa){const _0x72d2da=[],_0xf48fbf=this['_findPrevElementWithDataId'](_0x5ac6da,!0x0);if(_0xf48fbf){const _0x2d5070=Yi('data-id',ss(_0xf48fbf),_0x29c4aa);_0x2d5070&&_0x72d2da['push']([_0x2d5070,'afterend']);}const _0x100e75=this['_findNextElementWithDataId'](_0x5ac6da,!0x0);if(_0x100e75){const _0x1c1674=Yi('data-id',ss(_0x100e75),_0x29c4aa);_0x1c1674&&_0x72d2da['push']([_0x1c1674,'beforebegin']);}if(_0x72d2da['length']>0x1)return ts(_0x72d2da[0x0][0x0])<=ts(_0x72d2da[0x1][0x0])?_0x72d2da[0x0]:_0x72d2da[0x1];return 0x1===_0x72d2da['length']?_0x72d2da[0x0]:[_0x29c4aa['lastChild'],'afterend'];}['_findNextElementWithDataId'](_0x4fbca7,_0x4f6183){let _0xe477c0=_0x4fbca7['nextSibling'],_0x210a5e=null,_0x5546f0=!0x1;for(;_0xe477c0;){if(_0x340a48(_0xe477c0)){if(is(_0xe477c0)&&(_0x210a5e=_0xe477c0),this['_isExistingContentComment'](_0xe477c0)&&_0x4f6183&&!_0x5546f0){_0x5546f0=!0x0,_0xe477c0=_0xe477c0['nextSibling'];continue;}break;}const _0x268b2f=Xi(_0xe477c0,'data-id');if(_0x268b2f&&'new-element'!==_0x268b2f&&this['_existingDataIds']['has'](_0x268b2f)){_0x210a5e=_0xe477c0;break;}_0xe477c0=_0xe477c0['nextSibling'];}return _0x210a5e;}['_findPrevElementWithDataId'](_0x26a5f3,_0x4d901a){let _0x45f61c=_0x26a5f3['previousSibling'],_0x1eb0d4=null,_0x46df00=!0x1;for(;_0x45f61c;){if(_0x340a48(_0x45f61c)){if(is(_0x45f61c)&&(_0x1eb0d4=_0x45f61c),this['_isExistingContentComment'](_0x45f61c)&&_0x4d901a&&!_0x46df00){_0x46df00=!0x0,_0x45f61c=_0x45f61c['previousSibling'];continue;}break;}const _0x5a9ee4=Xi(_0x45f61c,'data-id');if(_0x5a9ee4&&'new-element'!==_0x5a9ee4&&this['_existingDataIds']['has'](_0x5a9ee4)){_0x1eb0d4=_0x45f61c;break;}_0x45f61c=_0x45f61c['previousSibling'];}return _0x1eb0d4;}['_markWrappedElements'](_0x225e03){_0x4b89ac(_0x225e03)&&$i('data-id',null,_0x225e03)['forEach'](_0x38f56b=>{this['_isExistingNode'](_0x38f56b)&&(zi(_0x38f56b,'data-wrapped-id',Xi(_0x38f56b,'data-id')),zi(_0x38f56b,'data-id',null));});}['_processWrappedElements'](_0x4c050e,_0x595351){$i('data-wrapped-id',null,_0x4c050e)['forEach'](_0x493fd2=>{const _0x28519b=Xi(_0x493fd2,'data-wrapped-id');if(this['_hasUnstableParent'](_0x493fd2))return;const _0x463729=Yi('data-id',_0x28519b,_0x4c050e);zi(_0x493fd2,'data-id',_0x28519b),_0x463729&&(this['_removeNode'](_0x463729,_0x28519b,_0x595351),this['_touchedNodesState']['removedIds']['push'](_0x28519b),this['_touchedNodesState']['lastTouchedId']=_0x28519b);});}['_hasUnstableParent'](_0x59014b){let _0x55df45=_0x59014b['parentNode'];for(;_0x55df45;){if(Xi(_0x55df45,'data-unstable'))return!0x0;_0x55df45=_0x55df45['parentNode'];}return!0x1;}['_rescueUnwrappedElements'](_0x25c3b9){const _0x3ca7db=new Set(this['_touchedNodesState']['removedIds']),_0x199bba=new Set(this['_touchedNodesState']['newIds']);$i('data-id',null,_0x25c3b9)['forEach'](_0x5ebabd=>{const _0x106739=Xi(_0x5ebabd,'data-id'),_0x4bccc0=!!_0x106739&&this['_referencedExistingIds']['has'](_0x106739),_0x1321ca=!!_0x106739&&_0x199bba['has'](_0x106739);if(!_0x106739||!_0x4bccc0&&!_0x1321ca)return;if(_0x3ca7db['has'](_0x106739))return;let _0x16c999=_0x5ebabd['parentNode'],_0x4153d1=!0x1;for(;_0x16c999;){if(_0x16c999===_0x25c3b9){_0x4153d1=!0x0;break;}const _0x3c9afe=Xi(_0x16c999,'data-id');if(_0x3c9afe&&(this['_referencedExistingIds']['has'](_0x3c9afe)||_0x199bba['has'](_0x3c9afe)))return;_0x16c999=_0x16c999['parentNode'];}if(_0x4153d1){if(_0x46d239(_0x25c3b9,_0x5ebabd),_0x4bccc0){const _0x3ca370=this['_generateUid'](),_0x30b599=this['_touchedNodesState']['modifiedIds']['indexOf'](_0x106739);-0x1!==_0x30b599&&this['_touchedNodesState']['modifiedIds']['splice'](_0x30b599,0x1),zi(_0x5ebabd,'data-unwrapped-id',_0x106739),zi(_0x5ebabd,'data-id',_0x3ca370),this['_touchedNodesState']['newIds']['push'](_0x3ca370),this['_touchedNodesState']['rescuedNewIds']['add'](_0x3ca370),this['_touchedNodesState']['lastTouchedId']=_0x3ca370;}else this['_touchedNodesState']['rescuedNewIds']['add'](_0x106739),this['_touchedNodesState']['lastTouchedId']=_0x106739;}});}['_getUid'](_0x114e40){return this['_isExistingNode'](_0x114e40)?Xi(_0x114e40,'data-id'):this['_generateUid']();}['_removeSpecialComments'](_0xd8d891){Qi(_0xd8d891)['filter'](_0x515b7d=>is(_0x515b7d)||this['_isExistingContentComment'](_0x515b7d))['forEach'](_0x74d7ba=>{_0x4b0b34(_0x74d7ba);});}['_findLastConfirmationPoint'](_0x4eb602){let _0x42d807=null,_0x573d50=null,_0xc623f=null,_0x35e215=null;const _0x1bbb84=_0x319f0e=>{_0x319f0e&&(_0x42d807=_0x319f0e),_0xc623f=null,_0x35e215=null;};for(let _0x341f00=0x0;_0x341f00<_0x4eb602['length'];_0x341f00++){const _0x276c25=_0x4eb602[_0x341f00];if(this['_isExistingContentComment'](_0x276c25)){_0x1bbb84(_0x573d50);continue;}if(_0x4b89ac(_0x276c25)){const _0x8f396a=Xi(_0x276c25,'data-id'),_0x475f62=_0x341f00===_0x4eb602['length']-0x1;if(_0x8f396a&&'new-element'!==_0x8f396a&&this['_touchedNodesState']['modifiedIds']['includes'](_0x8f396a)&&!_0x475f62){_0x1bbb84(_0x8f396a),_0x573d50=_0x8f396a;continue;}}let _0x260ee0=null;const _0x432b95=ss(_0x276c25);if(_0x432b95&&this['_touchedNodesState']['rescuedNewIds']['has'](_0x432b95))_0x573d50=_0x432b95;else{if(_0x432b95&&this['_touchedNodesState']['newIds']['includes'](_0x432b95))_0x260ee0='N';else{if(!is(_0x276c25))continue;_0x260ee0='R';}_0x260ee0===_0x35e215||null===_0x35e215?_0x35e215=_0x260ee0:null!==_0xc623f?(_0x1bbb84(_0x573d50),_0x35e215=_0x260ee0):(_0xc623f=_0x35e215,_0x35e215=_0x260ee0),_0x573d50=_0x432b95;}}const _0x20f0cb=_0x4eb602[_0x4eb602['length']-0x1];return _0x20f0cb&&!_0x4b89ac(_0x20f0cb)&&!is(_0x20f0cb)&&_0x573d50&&_0x1bbb84(_0x573d50),_0x42d807;}['_getLastStableElement'](_0x1ecaa7,_0x52153f){if(!_0x52153f)return null;const _0x5af1ca=Yi('data-id',_0x52153f,_0x1ecaa7);if(!_0x5af1ca)return null;const _0x140773=[_0x5af1ca,...Ji(_0x5af1ca)]['at'](-0x2);if(_0x140773===_0x5af1ca)return _0x5af1ca;let _0x333eec=_0x140773['previousSibling'];for(;_0x333eec&&!_0x4b89ac(_0x333eec);)_0x333eec=_0x333eec['previousSibling'];return _0x333eec;}['_markUnstableElements'](_0x3147d8,_0x577643){const _0x333dd0=new Set([...this['_touchedNodesState']['newIds'],...this['_touchedNodesState']['modifiedIds'],...this['_touchedNodesState']['removedIds']]);let _0x4e4cc7=_0x577643?_0x577643['nextSibling']:_0x3147d8['firstChild'];for(;_0x4e4cc7;){_0x4b89ac(_0x4e4cc7)&&((_0x333dd0['has'](Xi(_0x4e4cc7,'data-id'))||$i('data-id',null,_0x4e4cc7)['some'](_0x43a056=>_0x333dd0['has'](Xi(_0x43a056,'data-id'))))&&zi(_0x4e4cc7,'data-unstable','true')),_0x4e4cc7=_0x4e4cc7['nextSibling'];}}['_isNewNode'](_0xba87c5){return Boolean('new-element'===Xi(_0xba87c5,'data-id'));}['_isExistingNode'](_0xf26f1c){return Boolean((Xi(_0xf26f1c,'data-id')||'')['length']>0x0&&'new-element'!==Xi(_0xf26f1c,'data-id'));}['_isExistingContentComment'](_0x50f7a9){return Boolean(_0x340a48(_0x50f7a9)&&Ki(_0x50f7a9)['match'](/\s*existing[\s*-](content|document)\s*/g));}}function is(_0x4342b1){return!!_0x4342b1&&Boolean(_0x340a48(_0x4342b1)&&Ki(_0x4342b1)['match'](/removed[\s*-]data-id="[^"]+"/));}function ss(_0x2e59a4){if(!_0x2e59a4)return null;if(_0x4b89ac(_0x2e59a4))return Xi(_0x2e59a4,'data-id')??null;if(_0x340a48(_0x2e59a4)){const _0x4fa6cd=Ki(_0x2e59a4)['match'](/removed[\s*-]data-id="([^"]+)"/);if(_0x4fa6cd&&_0x4fa6cd[0x1])return _0x4fa6cd[0x1];}return null;}function ns(_0x291b72,_0x278157){const _0x1080c0=new Map();for(const _0x52c898 of qi(_0x291b72))_0x1080c0['set'](Xi(_0x52c898,'data-id'),_0x52c898);const _0x59f337=new Set();for(const _0x22e00b of qi(_0x278157)){const _0x241114=Xi(_0x22e00b,'data-id'),_0x260476=_0x241114?_0x1080c0['get'](_0x241114):void 0x0;_0x260476?(_0x38fc69(_0x22e00b,_0x49b927(_0x260476,!0x0)),_0x59f337['add'](_0x241114)):_0x4b0b34(_0x22e00b);}for(const _0x256817 of Qi(_0x278157))is(_0x256817)&&_0x1080c0['has'](ss(_0x256817))&&_0x4b0b34(_0x256817);const _0x262cea=new Set($i('data-id',null,_0x278157)['map'](_0x2cdcaa=>Xi(_0x2cdcaa,'data-id')));for(const [_0x59be8d,_0x16d2b9]of _0x1080c0){if(_0x59f337['has'](_0x59be8d))continue;let _0x35b040=_0x16d2b9['parent'],_0x269281=null;for(;_0x35b040&&_0x4b89ac(_0x35b040);){const _0x53807b=Xi(_0x35b040,'data-id');if(_0x53807b&&_0x262cea['has'](_0x53807b)){_0x269281=_0x53807b;break;}_0x35b040=_0x35b040['parent'];}if(!_0x269281)continue;const _0x2cbdc7=Yi('data-id',_0x269281,_0x278157);_0x2cbdc7&&_0x5c01e9(_0x2cbdc7,_0x49b927(_0x16d2b9,!0x0));}}function rs({changeGroups:_0x500775,documentContextContent:_0x3c3f2e,showDiff:_0x2afe32,trimUnchanged:_0x5b85eb=!0x0}){return _0x500775['map'](_0xca308b=>{if('destroyed'===_0xca308b['editor']['state'])return null;const _0x564b55=new _0x69aef6([]),_0x560d0b=new _0x69aef6([]),_0x227064=new Set();for(const _0x2e4727 of _0xca308b['changes'])'new'==_0x2e4727['type']&&$i('data-id',null,_0x2e4727['node'])['forEach'](_0x2d0779=>{_0x227064['add'](Xi(_0x2d0779,'data-id'));});for(const _0x30ec7c of _0xca308b['changes'])if('removed'!=_0x30ec7c['type']?_0x560d0b['children']['push'](_0x30ec7c['node']['cloneNode'](!0x0)):_0x2afe32||_0x227064['has'](_0x30ec7c['id'])||_0x560d0b['children']['push'](_0x30ec7c['node']['cloneNode'](!0x0)),'new'!=_0x30ec7c['type']&&(_0x2afe32||'removed'!=_0x30ec7c['type'])){const _0x1ed17c=_0x4f4d32(_0x21521d=>Xi(_0x21521d,'data-id')==_0x30ec7c['id'],_0x3c3f2e['get'](_0xca308b['documentId']),!0x0);_0x1ed17c&&_0x564b55['children']['push'](_0x1ed17c['cloneNode'](!0x0));}const {content:_0x384e44,hasChanges:_0x5ec0f6}=os(_0xca308b['editor'],_0x564b55,_0x560d0b,_0x2afe32,_0x5b85eb);return{'type':_0xca308b['changes'][0x0]['type'],'index':_0xca308b['index'],'content':_0x384e44,'hasChanges':_0x5ec0f6};})['filter'](_0x5e46bb=>null!==_0x5e46bb);}function os(_0x477160,_0x1db7d2,_0x2bb751,_0x261464,_0x8b2a31=!0x0){const _0x2afdb9=_0x477160['plugins']['get']('DocumentCompare'),_0x3806d6=Ki(_0x1db7d2),_0x3e81da=Ki(_0x2bb751),_0x5057c5=_0x477160['data']['parse'](_0x3806d6,'$root'),_0x5251d3=_0x477160['model']['createPositionAt'](_0x5057c5,0x0),_0x3a4c92=_0x2afdb9['getDiff'](_0x3806d6,_0x3e81da,{'anchor':_0x5251d3,'markDeletions':_0x261464,'targetEditor':_0x477160})['getOperations']();if(0x0==_0x3a4c92['length'])return{'content':_0x1db7d2['cloneNode'](!0x0),'hasChanges':!0x1};if(_0x261464?function(_0x5981a0,_0x5afb24,_0x2b407a){if(0x0==_0x5981a0['length'])return;const _0x5caab2=_0x2b407a['plugins']['get']('DocumentCompare'),_0x27f67d=_0x2b407a['plugins']['get']('SuggestionsConversion');_0x2b407a['model']['change'](_0x3c3096=>{const _0x48d8a7=new Set();for(let _0x540f5c=0x0;_0x540f5c<_0x5981a0['length'];_0x540f5c++){const _0x3b9e2a=_0x5981a0[_0x540f5c];if(_0x3b9e2a['baseVersion']=null,_0x3b9e2a['isDocumentOperation']=!0x1,_0x5caab2['isMarkedRemoveOperation'](_0x3b9e2a)){const _0x252fdd=_0x57ce89(_0x3b9e2a['newRange'],_0x2b407a['model']),_0x489d0c='suggestion:deletion:'+at()+':$aiSuggestion';_0x5afb24['markers']['set'](_0x489d0c,_0x252fdd);}else switch(_0x3b9e2a['type']){case'rename':{if(_0x3b9e2a['oldName']==_0x3b9e2a['newName'])break;_0x3c3096['batch']['addOperation'](_0x3b9e2a),_0x2b407a['model']['applyOperation'](_0x3b9e2a);const _0x1ae8be='$elementName',_0x58c0ad=_0x3b9e2a['position'],_0x3fd405=_0x2b407a['model']['createRange'](_0x58c0ad,_0x2b407a['model']['createPositionAt'](_0x58c0ad['nodeAfter'],'end')),_0xa7da3f='suggestion:attribute:'+_0x1ae8be+':'+at()+':$aiSuggestion';_0x5afb24['markers']['set'](_0xa7da3f,_0x3fd405);break;}case'addAttribute':case'removeAttribute':case'changeAttribute':{if(_0x3b9e2a['oldValue']==_0x3b9e2a['newValue'])break;_0x3c3096['batch']['addOperation'](_0x3b9e2a),_0x2b407a['model']['applyOperation'](_0x3b9e2a);const _0x621ca8=_0x3b9e2a['key'];if(!_0x27f67d['isRegisteredAttribute'](_0x621ca8))break;const _0x2ff170=_0x57ce89(_0x3b9e2a['range'],_0x2b407a['model']),_0x422700='suggestion:attribute:'+_0x621ca8+':'+at()+':$aiSuggestion';_0x5afb24['markers']['set'](_0x422700,_0x2ff170);break;}case'insert':{_0x3c3096['batch']['addOperation'](_0x3b9e2a),_0x2b407a['model']['applyOperation'](_0x3b9e2a);if(_0x5981a0[_0x540f5c+0x1]&&'move'==_0x5981a0[_0x540f5c+0x1]['type']){as(_0x5afb24,_0x3b9e2a);break;}const _0x174a79=_0x3b9e2a['position'],_0x329572=_0x3b9e2a['howMany'],_0x20a214=_0x57ce89(_0x2b407a['model']['createRange'](_0x174a79,_0x174a79['getShiftedBy'](_0x329572)),_0x2b407a['model']),_0x426f66='suggestion:insertion:'+at()+':$aiSuggestion';_0x5afb24['markers']['set'](_0x426f66,_0x20a214);break;}case'split':{_0x3c3096['batch']['addOperation'](_0x3b9e2a),_0x2b407a['model']['applyOperation'](_0x3b9e2a);const _0x4b1b1f=_0x3b9e2a['splitPosition'],_0x341b9e=_0x3b9e2a['moveTargetPosition'],_0x337e7b=_0x2b407a['model']['createRange'](_0x4b1b1f,_0x341b9e),_0x4b2646='suggestion:insertion:'+at()+':$aiSuggestion';_0x5afb24['markers']['set'](_0x4b2646,_0x337e7b);break;}case'move':{_0x3c3096['batch']['addOperation'](_0x3b9e2a),_0x2b407a['model']['applyOperation'](_0x3b9e2a),_0x5981a0[_0x540f5c-0x1]&&'insert'==_0x5981a0[_0x540f5c-0x1]['type']&&as(_0x5afb24,_0x3b9e2a);const _0x10a286=_0x3b9e2a['getMovedRangeStart'](),_0xa8ba6c=_0x3b9e2a['howMany'];for(let _0x3bdbbd=0x0;_0x3bdbbd<_0xa8ba6c;_0x3bdbbd++){const _0x1115ab=_0x10a286['getShiftedBy'](_0x3bdbbd)['nodeAfter'];_0x48d8a7['add'](_0x1115ab);}break;}case'remove':{const _0x42161d=_0x3b9e2a['sourcePosition'],_0x350f3e=_0x3b9e2a['howMany'],_0x23dcfe=new _0x389353(_0x42161d,_0x350f3e);_0x3c3096['batch']['addOperation'](_0x23dcfe),_0x2b407a['model']['applyOperation'](_0x23dcfe);break;}}}for(const _0x55c53e of _0x48d8a7){const _0x4ee0b0=_0x2b407a['model']['createRangeOn'](_0x55c53e),_0x25fa0a='suggestion:formatBlock:$fakeWrap:'+at()+':$aiSuggestion';_0x5afb24['markers']['set'](_0x25fa0a,_0x57ce89(_0x4ee0b0,_0x2b407a['model']));}});}(_0x3a4c92,_0x5057c5,_0x477160):_0x477160['model']['change'](_0x16f63d=>{for(const _0x33f04d of _0x3a4c92)if('remove'==_0x33f04d['type']){const _0x47dc18=_0x33f04d['sourcePosition'],_0x2a1bbc=_0x33f04d['howMany'],_0x2ea20d=new _0x389353(_0x47dc18,_0x2a1bbc);_0x16f63d['batch']['addOperation'](_0x2ea20d),_0x477160['model']['applyOperation'](_0x2ea20d);}else{if('marker'==_0x33f04d['type']){const _0x285efb=_0x33f04d['name'],_0x32f019=_0x33f04d['newRange'];null!==_0x32f019?_0x5057c5['markers']['set'](_0x285efb,_0x32f019):_0x5057c5['markers']['delete'](_0x285efb);}else _0x33f04d['baseVersion']=null,_0x33f04d['isDocumentOperation']=!0x1,_0x16f63d['batch']['addOperation'](_0x33f04d),_0x477160['model']['applyOperation'](_0x33f04d);}}),_0x8b2a31){const _0x9471f7=hs(_0x477160,_0x3a4c92,_0x5057c5);ls(_0x477160['model'],_0x9471f7),function(_0x14ee4b,_0x33da41){const _0x6f81ae=_0x33da41['getFirstRange']()['start'];let _0x2445a1=_0x33da41['getFirstRange']()['end'];const _0x26779e=_0x6f81ae['root'];(_0x2445a1['textNode']||_0x2445a1['nodeAfter']&&_0x2445a1['nodeAfter']['is']('$text'))&&(_0x1527d6(_0x2445a1,'...'),_0x2445a1=_0x2445a1['getShiftedBy'](0x3)),(_0x6f81ae['textNode']||_0x6f81ae['nodeBefore']&&_0x6f81ae['nodeBefore']['is']('$text'))&&(_0x1527d6(_0x6f81ae,'...'),function(_0x24b6d1,_0x57bed3,_0x13d521){for(let [_0x3c8e50,_0x414543]of _0x24b6d1['markers']){const _0x467650=_0x414543['_getTransformedByInsertion'](_0x57bed3,_0x13d521,!0x1);_0x414543=_0x467650[0x0],_0x24b6d1['markers']['set'](_0x3c8e50,_0x414543);}}(_0x26779e,_0x6f81ae,0x3),_0x6f81ae['parent']==_0x2445a1['parent']&&(_0x2445a1=_0x2445a1['getShiftedBy'](0x3)));const _0x296259=_0x14ee4b['createRange'](_0x14ee4b['createPositionAt'](_0x26779e,0x0),_0x6f81ae),_0xfdf12=_0x14ee4b['createRange'](_0x2445a1,_0x14ee4b['createPositionAt'](_0x26779e,'end')),_0x52cec0=[..._0x296259['getMinimalFlatRanges'](),..._0xfdf12['getMinimalFlatRanges']()];_0x52cec0['reverse']();for(const _0x1b54a2 of _0x52cec0)_0x545494(_0x1b54a2),ds(_0x26779e,_0x1b54a2);}(_0x477160['model'],_0x9471f7);}return{'content':Wi(_0x477160['data']['stringify'](_0x5057c5,{'showSuggestionHighlights':!0x0})),'hasChanges':!0x0};}function as(_0x5206fe,_0x372712){for(const [_0x56eaac,_0xa54a18]of _0x5206fe['markers']){const _0x304964=_0x2173cf['_createFromRanges'](_0xa54a18['getTransformedByOperation'](_0x372712));_0x5206fe['markers']['set'](_0x56eaac,_0x304964);}}function hs(_0x4dcac9,_0x2fa4a4,_0x29b489){const _0x4b55e0=_0x4dcac9['plugins']['get']('DocumentCompare');let _0x2c1dc1=_0x4dcac9['model']['createPositionAt'](_0x29b489,Number['POSITIVE_INFINITY']),_0x10eb1c=_0x4dcac9['model']['createPositionAt'](_0x29b489,0x0);for(const _0x3879ea of _0x2fa4a4){let _0x16a9ab,_0x434d93;if(_0x4b55e0['isMarkedRemoveOperation'](_0x3879ea))_0x16a9ab=_0x3879ea['newRange']['start'],_0x434d93=_0x3879ea['newRange']['end'];else switch(_0x2c1dc1=cs(_0x2c1dc1,_0x3879ea),_0x10eb1c=cs(_0x10eb1c,_0x3879ea),_0x3879ea['type']){case'rename':_0x16a9ab=_0x3879ea['position'],_0x434d93=_0x16a9ab['getShiftedBy'](0x1);break;case'addAttribute':case'removeAttribute':case'changeAttribute':_0x16a9ab=_0x3879ea['range']['start'],_0x434d93=_0x3879ea['range']['end'];break;case'insert':_0x16a9ab=_0x3879ea['position'],_0x434d93=_0x16a9ab['getShiftedBy'](_0x3879ea['howMany']);break;case'split':_0x16a9ab=_0x3879ea['splitPosition'],_0x434d93=_0x3879ea['moveTargetPosition'];break;case'merge':{const _0x12c189=_0x3879ea['targetPosition']['path']['slice'](0x0,-0x1);_0x16a9ab=_0x4dcac9['model']['createPositionFromPath'](_0x29b489,_0x12c189),_0x434d93=_0x16a9ab['getShiftedBy'](0x1);break;}case'move':case'remove':{const _0x3f3748=_0x3879ea['howMany'],_0x966b3a=_0x3879ea['sourcePosition']['_getTransformedByInsertion'](_0x3879ea['targetPosition'],_0x3f3748),_0x16f653=_0x3879ea['getMovedRangeStart']();'remove'==_0x3879ea['type']?(_0x16a9ab=_0x966b3a,_0x434d93=_0x966b3a):(_0x16a9ab=_0x16f653,_0x434d93=_0x16f653['getShiftedBy'](_0x3f3748));break;}}_0x16a9ab&&_0x16a9ab['isBefore'](_0x2c1dc1)&&(_0x2c1dc1=_0x16a9ab['clone'](),_0x2c1dc1['stickiness']='toNone'),_0x434d93&&_0x434d93['isAfter'](_0x10eb1c)&&(_0x10eb1c=_0x434d93['clone'](),_0x10eb1c['stickiness']='toNone');}return _0x4dcac9['model']['createSelection'](_0x4dcac9['model']['createRange'](_0x2c1dc1,_0x10eb1c));}function cs(_0x3bd4da,_0x19e04c){return'move'!=_0x19e04c['type']&&'remove'!=_0x19e04c['type']||_0x19e04c['sourceRange']['containsPosition'](_0x3bd4da)&&((_0x3bd4da=_0x19e04c['sourcePosition']['clone']())['stickiness']='toNone'),_0x3bd4da['getTransformedByOperation'](_0x19e04c);}function ls(_0x52b117,_0x4a9a7d){us(_0x52b117,_0x4a9a7d,'forward');const _0x1087c5=_0x4a9a7d['getFirstRange']();_0x4a9a7d['setTo']([]),_0x4a9a7d['setTo'](_0x1087c5,{'backward':!0x0}),us(_0x52b117,_0x4a9a7d,'backward');}function us(_0x5c218c,_0x357c22,_0x2bed15){let _0xdd51f6=0x14;for(;_0xdd51f6;){_0x5c218c['modifySelection'](_0x357c22,{'unit':'word','direction':_0x2bed15}),_0xdd51f6--;const _0x47a4d1=_0x357c22['focus']['forward'==_0x2bed15?'nodeBefore':'nodeAfter'];if(_0x47a4d1&&_0x47a4d1['is']('element')&&_0x5c218c['schema']['isBlock'](_0x47a4d1)&&_0x5c218c['schema']['isObject'](_0x47a4d1))break;}}function ds(_0x1cb32b,_0x3dcb13){for(const [_0x39effb,_0x28d66e]of _0x1cb32b['markers']){const _0x22c600=_0x28d66e['_getTransformedByDeletion'](_0x3dcb13['start'],_0x3dcb13['end']['offset']-_0x3dcb13['start']['offset']);null!=_0x22c600?_0x1cb32b['markers']['set'](_0x39effb,_0x22c600):_0x1cb32b['markers']['delete'](_0x39effb);}}class AIReply extends ct(){['id'];['interactionId'];['type'];['content']=new Map();['sources']=[];['parsedContent']=new Map();['parsedMergedContent']=new Map();['changeGroups']=[];['areActionsDisabled']=!0x1;['isFromHistory']=!0x1;['documentContextContent'];['_documentIdToSource']=new Map();['aiResponseParser'];['aiResponseApplier'];['locale'];['cachedSuggestionContentParts']={'withDiff':[],'withoutDiff':[]};constructor({type:_0xd1697e,isDone:_0x3fe9a3=!0x1,isComplete:_0x17be0e,interactionId:_0x4f8229,areActionsDisabled:_0x330e60,isFromHistory:_0x5ee2b9=!0x1,documentContextContent:_0x5ae50d,locale:_0x418d50,id:_0x56d3a2,channelsToEditors:_0x2bcf46}){super(),this['id']=_0x56d3a2||at(),this['interactionId']=_0x4f8229,this['type']=_0xd1697e,this['areActionsDisabled']=!!_0x330e60,this['isFromHistory']=_0x5ee2b9,this['locale']=_0x418d50,this['aiResponseParser']=new AIResponseParser(),this['aiResponseApplier']=new AIResponseApplier(),this['documentContextContent']=new Map(_0x5ae50d?.['map'](_0x321d0b=>[_0x321d0b['id'],Wi(_0x321d0b['content'])])||[]),this['_documentIdToSource']=new Map(_0x5ae50d?.['map'](_0x2409e3=>[_0x2409e3['id'],{'editor':_0x2bcf46['get'](_0x2409e3['channelId']),'rootName':_0x2409e3['rootName']}])||[]),this['set']('isDone',_0x3fe9a3),this['set']('isComplete',_0x17be0e??_0x3fe9a3),'text'===this['type']&&this['content']['set']('text','');}['appendContent'](_0x43cb3a,_0xaa7566){const _0x2ed290='text'===this['type']?'text':_0xaa7566;this['content']['has'](_0x2ed290)||this['content']['set'](_0x2ed290,''),this['content']['set'](_0x2ed290,this['content']['get'](_0x2ed290)+_0x43cb3a),this['onContentChange'](_0x2ed290);}['done'](_0x4b1625=!0x0){this['isComplete']=_0x4b1625,this['isDone']||(this['set']('isDone',!0x0),this['onContentChange']());}['destroy'](){this['stopListening']();}['setChangeGroupState'](_0x4850c8,_0x5acc80){this['changeGroups'][_0x4850c8]['state']=_0x5acc80,this['fire']('replyChangeGroupStateUpdated',{'reply':this,'index':_0x4850c8,'state':_0x5acc80});}['getContentParts']({showDiff:_0x3e26d3,groupIndex:_0x56b161}){const _0x11b142=this['_getCachedContentParts'](_0x3e26d3,_0x56b161);if(_0x11b142)return _0x11b142;let _0x20a325=[];if(void 0x0===_0x56b161)_0x20a325=this['changeGroups'];else{const _0x364220=this['changeGroups']['find'](({index:_0x26cded})=>_0x26cded===_0x56b161);if(!_0x364220)throw new ht('ai-reply-get-content-parts-group-not-found',null,{'aiReply':this,'groupIndex':_0x56b161});_0x20a325=[_0x364220];}const _0x1efcbd=rs({'showDiff':_0x3e26d3,'changeGroups':_0x20a325,'documentContextContent':this['documentContextContent']});return this['_setCachedContentParts'](_0x3e26d3,_0x1efcbd),_0x1efcbd;}['_getCachedContentParts'](_0x135f93,_0x22a8da){const _0x804fea=_0x135f93?'withDiff':'withoutDiff';if(!this['cachedSuggestionContentParts'][_0x804fea]['length'])return null;const _0x3028c3=this['cachedSuggestionContentParts'][_0x804fea];if(void 0x0===_0x22a8da)return _0x3028c3['length']>0x0&&_0x3028c3['length']!==this['changeGroups']['length']?(this['_setCachedContentParts'](_0x135f93,null),null):_0x272c1f(_0x3028c3);{const _0x2447cf=_0x3028c3['find'](({index:_0x19ec3d})=>_0x19ec3d===_0x22a8da);if(_0x2447cf)return[_0x272c1f(_0x2447cf)];}return null;}['_setCachedContentParts'](_0x5e0339,_0x3dbb13){const _0x586c68=_0x5e0339?'withDiff':'withoutDiff';_0x3dbb13?_0x3dbb13['forEach'](_0xd09b9e=>{const _0x2b5b0c=this['cachedSuggestionContentParts'][_0x586c68],_0x2f29ff=_0x2b5b0c['find'](({index:_0x2a9331})=>_0x2a9331===_0xd09b9e['index']);if(_0x2f29ff){const _0x13a246=_0x2b5b0c['indexOf'](_0x2f29ff);_0x2b5b0c['splice'](_0x13a246,0x1,_0xd09b9e);}else _0x2b5b0c['push'](_0xd09b9e);}):this['cachedSuggestionContentParts'][_0x586c68]['length']=0x0;}['onContentChange'](_0x47ed7e){if('modification'===this['type']){if(_0x47ed7e)this['parsedContent']['set'](_0x47ed7e,this['aiResponseParser']['parseAndNormalizeHTML'](this['content']['get'](_0x47ed7e)));else{for(const [_0x41e832,_0x5c950a]of this['content'])this['parsedContent']['set'](_0x41e832,this['aiResponseParser']['parseAndNormalizeHTML'](_0x5c950a));}const _0x12d305=this['changeGroups'];for(const _0x5ed867 of this['content']['keys']())this['updateChangeGroups'](_0x5ed867);const _0x2cbe2e=this['_getDifferentChangeGroups'](_0x12d305,this['changeGroups']);(_0x2cbe2e['length']||this['isDone'])&&(this['fire']('replyContentUpdated',this,_0x2cbe2e),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'](_0x3a1589,_0xc5a0fd){const _0x542a28=[];for(const _0x1d1aec of _0xc5a0fd){const _0x2a7139=_0x3a1589[_0x1d1aec['index']];_0x2a7139?_0x2a7139['changes']['length']!==_0x1d1aec['changes']['length']?_0x542a28['push'](_0x1d1aec):_0x2a7139['changes']['forEach']((_0x39b1b2,_0x2e2da1)=>{const _0x33854e=_0x1d1aec['changes'][_0x2e2da1];_0x39b1b2['id']!==_0x33854e['id']&&_0x542a28['push'](_0x1d1aec);}):_0x542a28['push'](_0x1d1aec);}return _0x542a28;}['updateChangeGroups'](_0x42f788){const _0x4009e9=this['documentContextContent']['get'](_0x42f788),_0x452348=this['parsedContent']['get'](_0x42f788);if(!_0x4009e9||!_0x452348)return;const _0x10aa24=new _0x38344d('p',{},[new _0x38344d('span',{'style':'color:\x20#808080;\x20font-style:\x20italic'},[new _0x5165b8(Mi(this['locale'],'AI_SUGGESTION_CONTENT_PART_REMOVED'))])]),_0x53b5b3=this['aiResponseApplier']['merge'](_0x452348,_0x4009e9['cloneNode'](!0x0),{'cutAfterUnstable':!this['isDone']||!this['isComplete'],'replaceRemovedWith':_0x10aa24});this['parsedMergedContent']['set'](_0x42f788,_0x53b5b3['parsedContent']);let _0x2d51fd=[];if(_0x3d5111(_0x255072=>{const _0x2a7ae3=Xi(_0x255072,'data-id');if(!_0x2a7ae3||!_0x57f230(_0x2a7ae3))return!0x1;const _0x499c4c=[_0x255072,...Ji(_0x255072)]['at'](-0x2);if(_0x255072!=_0x499c4c){const _0x356bd7=Xi(_0x499c4c,'data-id');_0x57f230(_0x356bd7)||(_0x2d51fd['push']({'node':_0x499c4c,'id':_0x356bd7,'type':'modified'}),_0x53b5b3['modifiedNodeIds']['push'](_0x356bd7));}else _0x53b5b3['modifiedNodeIds']['includes'](_0x2a7ae3)?_0x2d51fd['push']({'node':_0x255072,'type':'modified','id':_0x2a7ae3}):_0x53b5b3['newNodeIds']['includes'](_0x2a7ae3)?_0x2d51fd['push']({'node':_0x255072,'type':'new','id':_0x2a7ae3,'anchorId':Xi(_0x255072['previousSibling'],'data-id')}):_0x2d51fd['push']({'node':_0x255072,'type':'removed','id':_0x2a7ae3});return!0x0;},this['parsedMergedContent']['get'](_0x42f788)),_0x2d51fd=_0x2d51fd['filter'](({node:_0x284b7c})=>[...Ji(_0x284b7c),_0x284b7c]['every'](_0x36c43c=>!Xi(_0x36c43c,'data-unstable'))),this['changeGroups']=this['changeGroups']['filter'](_0x33278d=>_0x33278d['documentId']!==_0x42f788),0x0==_0x2d51fd['length'])return;const _0x260c31=[[_0x2d51fd[0x0]]];for(let _0x3be1f5=0x1;_0x3be1f5<_0x2d51fd['length'];_0x3be1f5++){const _0x4e878e=_0x260c31[_0x260c31['length']-0x1],_0x256805=_0x4e878e[_0x4e878e['length']-0x1];_0x2d51fd[_0x3be1f5]['node']['previousSibling']==_0x256805['node']&&'modified'!=_0x2d51fd[_0x3be1f5]['type']&&'modified'!=_0x256805['type']?_0x4e878e['push'](_0x2d51fd[_0x3be1f5]):_0x260c31['push']([_0x2d51fd[_0x3be1f5]]);}for(const _0x57d323 of _0x260c31){const _0x55376c=_0x57d323[0x0],_0x3dd66c=_0x57d323[_0x57d323['length']-0x1],_0x18de35=_0x29c2c2(_0x55376c['node']['previousSibling']);_0x18de35&&_0x57d323['unshift'](_0x18de35);const _0x1c8d96=_0x29c2c2(_0x3dd66c['node']['nextSibling']);_0x1c8d96&&_0x57d323['push'](_0x1c8d96);}$i('data-wrapped-id',null,this['parsedMergedContent']['get'](_0x42f788))['forEach'](_0x5ae2eb=>{zi(_0x5ae2eb,'data-wrapped-id',null);});const _0x477a95=new Map();$i('data-unwrapped-id',null,this['parsedMergedContent']['get'](_0x42f788))['forEach'](_0x548ef0=>{const _0x29338a=Xi(_0x548ef0,'data-unwrapped-id'),_0x591271=Xi(_0x548ef0,'data-id');_0x477a95['set'](_0x591271,_0x29338a),zi(_0x548ef0,'data-id',_0x29338a),zi(_0x548ef0,'data-unwrapped-id',null);});for(const _0x403341 of _0x2d51fd){const _0x28e010=_0x477a95['get'](_0x403341['id']);_0x28e010&&(_0x403341['id']=_0x28e010);}this['changeGroups']['push'](..._0x260c31['map']((_0x2eadbe,_0x1ad236)=>({'changes':_0x2eadbe,'state':'pending','index':_0x1ad236,'editor':this['_documentIdToSource']['get'](_0x42f788)['editor'],'rootName':this['_documentIdToSource']['get'](_0x42f788)['rootName'],'documentId':_0x42f788})));const _0x1779ea=Array['from'](this['documentContextContent']['keys']());function _0x57f230(_0x2d563c){return _0x53b5b3['modifiedNodeIds']['includes'](_0x2d563c)||_0x53b5b3['newNodeIds']['includes'](_0x2d563c)||_0x53b5b3['removedNodeIds']['includes'](_0x2d563c);}function _0x29c2c2(_0x47b413){if(_0x47b413&&Xi(_0x47b413,'data-id')&&!Xi(_0x47b413,'data-unstable')){const _0x39abda=Xi(_0x47b413,'data-id');if(!_0x57f230(_0x39abda))return{'node':_0x47b413,'type':'context','id':_0x39abda};}return null;}this['changeGroups']['sort']((_0x5b726b,_0x1c2397)=>_0x1779ea['indexOf'](_0x5b726b['documentId'])-_0x1779ea['indexOf'](_0x1c2397['documentId'])),this['changeGroups']['forEach']((_0x35e441,_0x1194d2)=>{_0x35e441['index']=_0x1194d2;});}}const _s=['interactionCreated','interactionStarted','interactionStopped','interactionFinished','interactionDestroyed','replyCreated','replyContentUpdated','replyChangeGroupStateUpdated','setConversationTitle','webSearchStarted','webSearchFinished','reasoningStarted','reasoningFinished','toolDataReceived','error'];class AIInteraction extends Et(){['id'];['replies']=[];['currentReply'];['messageId'];['actionCallId'];['currentRequest'];['connector'];['isStopped']=!0x1;['isDestroyed']=!0x1;['locale'];['_isReasoning']=!0x1;['_isWebSearching']=!0x1;['_channelsToEditors'];constructor({connector:_0x5b00d2,locale:_0x42d8ee,channelsToEditors:_0x8ddc3e}){super(),this['id']=at(),this['connector']=_0x5b00d2,this['isStopped']=!0x0,this['locale']=_0x42d8ee,this['_channelsToEditors']=_0x8ddc3e||new Map();}async['start'](){await this['_run']();}async['resume'](_0x23057f){await this['_run'](_0x23057f);}async['_run'](_0x5c9338){const _0x566a31=[];let _0x54d0b1,_0x5c0ca2,_0x19e42b,_0x2453c2=!0x1;this['isStopped']=!0x1;try{this['currentRequest']=_0x5c9338||await this['sendRequest'](),this['fire']('interactionStarted',this);const _0x24aef9=await this['currentRequest']['getStream']();for await(const _0x1ea847 of _0x24aef9){if(this['isStopped'])return;if('error'==_0x1ea847['event'])return void this['fire']('error',{'error':new ht('ai-chat-interaction-error',this)});switch(_0x1ea847['event']){case'message-metadata':this['messageId']=_0x1ea847['data']['messageId'];break;case'action-metadata':this['actionCallId']=_0x1ea847['data']['callId'];break;case'conversation-title':this['setConversationTitle'](_0x1ea847['data']['conversationTitle'],!0x0);break;case'source':_0x566a31['push'](_0x1ea847['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'](),_0x54d0b1='modification-delta'==_0x1ea847['event']?'modification':'text',_0x5c0ca2='modification-delta'==_0x1ea847['event']?_0x1ea847['data']['id']:void 0x0,this['currentReply']&&this['currentReply']['type']!=_0x54d0b1&&(this['currentReply']['done'](),this['currentReply']=void 0x0),this['currentReply']||(this['currentReply']=this['createReply']({'type':_0x54d0b1,'interactionId':this['id'],'id':_0x5c0ca2,'channelsToEditors':this['_channelsToEditors'],...'modification-delta'==_0x1ea847['event']&&{'documentId':_0x1ea847['data']['documentId']}}),'modification'==_0x54d0b1&&(this['currentReply']['sources']=_0x566a31['splice'](0x0))),this['currentReply']['appendContent'](_0x1ea847['data']['textDelta'],_0x1ea847['data']['documentId']);break;case'mcp-tool-result':_0x19e42b=JSON['parse'](_0x1ea847['data']['result']),this['_handleToolResultData']({'toolName':_0x1ea847['data']['toolName'],'data':_0x19e42b['data'],'attributes':_0x19e42b['attributes']});break;case'mcp-tool-notification':this['_handleToolNotificationData']({'toolName':_0x1ea847['data']['toolName'],'data':_0x1ea847['data']['data']});}}_0x2453c2=!0x0;}finally{this['isStopped']||(this['currentReply']&&_0x566a31['length']>0x0&&(this['currentReply']['sources']=_0x566a31['splice'](0x0)),this['_finalizeInteraction'](_0x2453c2),this['fire']('interactionFinished',this));}}['stop'](){this['isStopped']||(this['_finalizeInteraction'](),this['fire']('interactionStopped',this));}['getReply'](_0x362597){return this['replies']['find'](_0x5c487f=>_0x5c487f['id']===_0x362597);}['destroy'](){this['isDestroyed']||(this['stop'](),this['replies']['forEach'](_0xf6e47d=>_0xf6e47d['destroy']()),this['replies']=[],this['isDestroyed']=!0x0,this['fire']('interactionDestroyed',this),this['stopListening']());}['createReply'](_0x2637a7){const _0x292623=this['getDocumentContext'](),_0x381876=new AIReply({'locale':this['locale'],'documentContextContent':_0x292623?.['documents'],..._0x2637a7});return this['replies']['push'](_0x381876),_0x381876['delegate'](..._s)['to'](this),this['fire']('replyCreated',_0x381876),_0x381876;}['setConversationTitle'](_0x401404,_0x37ff14=!0x1){this['fire']('setConversationTitle',_0x401404,_0x37ff14);}['resetWebSearchState'](){this['_isWebSearching']&&(this['_isWebSearching']=!0x1,this['fire']('webSearchFinished',this));}['resetReasoningState'](){this['_isReasoning']&&(this['_isReasoning']=!0x1,this['fire']('reasoningFinished',this));}['_handleToolResultData'](_0x17d94d){this['fire']('toolDataReceived',{'type':'result','toolName':_0x17d94d['toolName'],'data':structuredClone(_0x17d94d['data']||{}),'attributes':structuredClone(_0x17d94d['attributes']||{})},this);}['_handleToolNotificationData'](_0x54c008){this['fire']('toolDataReceived',{'type':'notification','toolName':_0x54c008['toolName'],'data':structuredClone(_0x54c008['data'])},this);}['_finalizeInteraction'](_0x3c0c96=!0x1){this['isStopped']=!0x0,this['currentRequest']&&this['currentRequest']['abortController']['abort'](),this['currentReply']&&this['currentReply']['done'](_0x3c0c96),this['currentRequest']=this['currentReply']=void 0x0;}}const Is=new Map([['usage-limits-exceeded','ai-usage-limits-exceeded'],['rate-limits-exceeded','ai-rate-limits-exceeded'],['invalid-content-type','ai-invalid-content-type'],['invalid-request-data','ai-chat-invalid-request'],['model-already-set','ai-chat-model-already-set'],['model-not-found','ai-chat-model-not-found'],['unsafe-content-detected','ai-chat-unsafe-content-detected'],['unsupported-content-type','ai-chat-unsupported-content-type'],['content-too-large','ai-chat-content-too-large'],['unsupported-file-type','ai-chat-context-unsupported-file-type'],['file-too-large','ai-chat-context-file-too-large'],['file-too-many-pages','ai-chat-context-file-too-many-pages'],['form-data-size-limits-exceeded','ai-chat-context-form-data-size-limits-exceeded']]),As=['contextItemAdded','contextItemRemoved','contextItemLoadingEnded','contextSent','error','addContextOptionsChanged','sourceResourcesLoaded','resourceStateChanged','uploadProgressChanged'];class AIChatContext extends ct(){['_connector'];['_config'];['_ownerId'];constructor({connector:_0x42db96,config:_0x153ba0,ownerId:_0x1efebe}){super(),this['_connector']=_0x42db96,this['_config']=_0x153ba0,this['_ownerId']=_0x1efebe;}['init'](){this['_pendingContextItems']=new Map(),this['_conversationContextItems']=new Map(),this['_ongoingUploads']=new Map(),this['_ongoingUploadOperations']=new Map(),this['_setAddContextOptionsDefaultState']();}['getPendingContextItems'](){return this['_pendingContextItems'];}async['populateFromMessage'](_0x477259){const _0x21192c=await this['_createContextItemFromContent'](_0x477259);return this['_addToConversationContextItem'](_0x21192c),'current-document'===_0x21192c['uiId']&&this['toggleAddCurrentDocumentOptionVisibility'](),_0x21192c;}async['populateDocumentsFromMessage'](_0x3a543d,_0x309e23){const _0x1345fa=_0x3a543d['filter'](_0x492a97=>'document'===_0x492a97['type']);if(0x0===_0x1345fa['length'])return{'hasUnmatched':!0x1};const _0x382352=_0x1345fa['map'](_0x2d2c0c=>_0x2d2c0c['id']),_0x66a13e=await this['_connector']['fetchDocuments'](this['_ownerId'],_0x382352)['getDocuments'](),_0x2a6f37=new Map(_0x66a13e['map'](_0xfef019=>[_0xfef019['id'],_0xfef019])),_0x5dce6a=[];let _0x55eeca=!0x1;for(const _0x41137d of _0x1345fa){const _0x4a23c8=_0x2a6f37['get'](_0x41137d['id']);_0x4a23c8&&(this['_matchDocumentToRoot'](_0x4a23c8,_0x309e23)||(_0x55eeca=!0x0),_0x5dce6a['push']({'id':_0x4a23c8['id'],'content':_0x4a23c8['content'],'version':_0x4a23c8['attributes']?.['version']??0x0,'sessionId':_0x4a23c8['attributes']?.['sessionId']??null,'selection':[],'channelId':_0x4a23c8['attributes']?.['channelId']??_0x309e23[0x0]?.['config']['get']('collaboration.channelId')??'','rootName':_0x4a23c8['attributes']?.['rootName']??_0x309e23[0x0]?.['model']['document']['getRoots']()[0x0]['rootName']??''}));}const _0x33d142={'id':'current-document','uiId':'current-document','label':'Current\x20document','type':'document','hidden':this['_conversationContextItems']['has']('current-document'),'documents':_0x5dce6a};return this['_addToConversationContextItem'](_0x33d142),this['toggleAddCurrentDocumentOptionVisibility'](),{'contextItem':_0x33d142,'hasUnmatched':_0x55eeca};}['_matchDocumentToRoot'](_0x23c336,_0x4192ba){const _0x5c1edb=_0x23c336['attributes']?.['channelId'],_0x187cdf=_0x23c336['attributes']?.['rootName'];if(_0x5c1edb&&_0x187cdf){for(const _0x1bb408 of _0x4192ba)if(_0x1bb408['config']['get']('collaboration.channelId')===_0x5c1edb){for(const _0x1ff024 of _0x1bb408['model']['document']['getRoots']())if('$graveyard'!==_0x1ff024['rootName']&&_0x1ff024['rootName']===_0x187cdf)return{'editor':_0x1bb408,'rootName':_0x1ff024['rootName']};}}}async['_createContextItemFromContent'](_0x3236bb){if('document'===_0x3236bb['type']){const _0x10d410=await this['_connector']['fetchDocument'](this['_ownerId'],_0x3236bb['id'])['getDocument']();return{'id':'current-document','uiId':'current-document','label':'Current\x20document','type':_0x3236bb['type'],'content':_0x10d410['content'],'hidden':this['_conversationContextItems']['has']('current-document'),'version':_0x10d410['attributes']?.['version'],'sessionId':_0x10d410['attributes']?.['sessionId']};}if('mcp-tool-context'===_0x3236bb['type'])return{'id':_0x3236bb['id'],'uiId':_0x3236bb['id'],'label':_0x3236bb['data']?.['label']||_0x3236bb['id'],'type':'mcp-tool-context','mcpServerName':_0x3236bb['mcpServerName'],'toolName':_0x3236bb['toolName'],'data':_0x3236bb['data']||{}};return{'id':_0x3236bb['id'],'uiId':_0x3236bb['id'],'label':_0x3236bb['attributes']?.['label']||_0x3236bb['name']||_0x3236bb['url']||_0x3236bb['id'],'type':_0x3236bb['type'],..._0x3236bb?.['attributes']?.['resourceId']?{'resourceId':_0x3236bb['attributes']?.['resourceId']}:{}};}['getSentContextItems'](){return new Map(this['_conversationContextItems']);}['removeFromContext'](_0x533b56){const _0x163ac9=this['_pendingContextItems']['get'](_0x533b56);_0x163ac9?.['isReadOnly']||this['_removeContextItem'](_0x533b56);}['clearPendingContextItems'](){if(0x0===this['_pendingContextItems']['size'])return;for(const _0x288c0d of this['_pendingContextItems']['values']())this['_removeContextItem'](_0x288c0d['uiId']);const _0x1f1b9e=this['_conversationContextItems']['get']('current-document')||this['_pendingContextItems']['get']('current-document');_0x1f1b9e&&this['_addContextItem']({..._0x1f1b9e,'isReadOnly':!0x0,'hidden':!0x0});}['addToConversationContext'](_0x41443b){for(const _0x31d4cd of _0x41443b['values']())this['_addToConversationContextItem'](_0x31d4cd);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'](_0x2b0acc){return Array['from'](_0x2b0acc['values']())['flatMap'](_0x5cffd4=>this['_mapContextItemToRequestData'](_0x5cffd4));}async['addFilesToContext'](_0xa92f08,_0x43b2e5,_0x429cd2='file'){const _0x187989='files-'+at();this['_startUploadOperation'](_0x187989);try{await Promise['all'](_0xa92f08['map'](async _0x3ac40c=>{const _0x456fd4='file-'+at(),_0x4783a6=_0x57a263(_0x3ac40c['name']),_0x8ebfdd='file'===_0x429cd2&&_0x3ac40c['type']['startsWith']('image/')?'image':_0x429cd2;try{this['_addContextItem']({'type':_0x8ebfdd,'label':_0x43b2e5?.['label']||_0x4783a6,'uiId':_0x456fd4,'resourceId':_0x43b2e5?.['resourceId']},!0x0);const _0x37c463=this['_connector']['uploadFile'](this['_ownerId'],_0x3ac40c,_0x43b2e5);this['_ongoingUploads']['set'](_0x456fd4,_0x37c463['abortController']);const {id:_0x1bbbe8}=await _0x37c463['getId']();this['_ongoingUploads']['delete'](_0x456fd4),this['_finishContextItemLoading']({'type':_0x8ebfdd,'id':_0x1bbbe8,'label':_0x43b2e5?.['label']||_0x4783a6,'uiId':_0x456fd4,'resourceId':_0x43b2e5?.['resourceId']},!0x1);}catch(_0x3cbf20){this['_ongoingUploads']['delete'](_0x456fd4);if(!(_0x3cbf20 instanceof ht&&_0x3cbf20['message']['startsWith']('ai-request-aborted'))){const _0x353c10=Is['get'](_0x3cbf20['code'])||'ai-chat-file-upload-failed',_0x2246fd=new ht(_0x353c10,null,{'fileName':_0x4783a6,..._0x3cbf20});_0x2246fd['stack']=_0x3cbf20['stack'],this['fire']('error',{'error':_0x2246fd});}this['_removeContextItem'](_0x456fd4);}}));}finally{this['_finishUploadOperation'](_0x187989);}}['addCurrentDocumentToContext'](_0x10aeea){if(this['isCurrentDocumentInContext']()||!this['_addContextOptionsState']['document']['enabled'])return;const _0x1eaf6b={'type':'document','uiId':'current-document','label':_0x10aeea,'isReadOnly':this['_conversationContextItems']['has']('current-document'),'hidden':this['_conversationContextItems']['has']('current-document')};this['_addContextItem'](_0x1eaf6b);}async['updateCurrentDocuments'](_0x513dea){const _0xdcac7=this['_pendingContextItems']['get']('current-document');if(!_0xdcac7||!_0x513dea['length']||_0x513dea['every'](_0x55d484=>!_0x55d484['content']))return;_0x513dea['length']>0x1&&_0x513dea['some'](_0x503380=>!_0x503380['description'])&&wt('ai-chat-documents-missing-description');try{const _0x30c465=await this['_connector']['uploadDocuments'](this['_ownerId'],_0x513dea)['getIds']();if(_0x30c465['length']!==_0x513dea['length']||_0x30c465['some'](_0x4306ef=>!_0x4306ef?.['id'])){const _0x4001cb=new ht('ai-chat-document-upload-reply-mismatch',null);return void this['fire']('error',{'error':_0x4001cb});}_0xdcac7['documents']=_0x513dea['map']((_0x46d58e,_0x544145)=>{return{'id':_0x30c465[_0x544145]['id'],'content':_0x46d58e['content'],'version':_0x46d58e['version'],'sessionId':_0x46d58e['sessionId'],'selection':(_0x2c6ae8=_0x46d58e['selections'],_0x2c6ae8?_0x2c6ae8['map'](_0x3f8166=>({'start':_0x3f8166['start'],'end':_0x3f8166['end']})):[]),'channelId':_0x46d58e['channelId'],'rootName':_0x46d58e['rootName']};var _0x2c6ae8;});}catch(_0x3fc316){const _0x3b3389=new ht('ai-chat-document-upload-failed',null);_0x3b3389['stack']=_0x3fc316['stack'],this['fire']('error',{'error':_0x3b3389});}}['addSelectionToContext'](_0x24bbf4){this['_addContextItem']({'type':'selection','label':_0x24bbf4,'uiId':'selection','content':_0x24bbf4});}['removeSelectionFromContext'](){this['_removeContextItem']('selection');}async['addUrlToContext'](_0x55c40f,_0x29c53f){const _0x1c4e93='url-'+at();this['_startUploadOperation'](_0x1c4e93);const _0x2f2764='url-'+at();try{this['_addContextItem']({'type':'web-resource','label':_0x29c53f?.['label']||_0x55c40f,'uiId':_0x2f2764,'resourceId':_0x29c53f?.['resourceId']},!0x0);const _0x5651df=this['_connector']['uploadUrl'](this['_ownerId'],_0x55c40f,_0x29c53f);this['_ongoingUploads']['set'](_0x2f2764,_0x5651df['abortController']);const {id:_0x5ae63d}=await _0x5651df['getId']();this['_ongoingUploads']['delete'](_0x2f2764),this['_finishContextItemLoading']({'type':'web-resource','id':_0x5ae63d,'label':_0x29c53f?.['label']||_0x55c40f,'uiId':_0x2f2764,'resourceId':_0x29c53f?.['resourceId']},!0x1);}catch(_0x487a76){this['_ongoingUploads']['delete'](_0x2f2764),(_0x487a76['message']['startsWith']('ai-request-aborted')||this['fire']('error',{'error':new ht('ai-chat-url-upload-failed',this,{'url':_0x55c40f,'originalError':_0x487a76}),'url':_0x55c40f}),this['_removeContextItem'](_0x2f2764));}finally{this['_finishUploadOperation'](_0x1c4e93);}}['addToolItemToContext'](_0x6c6488){_0x6c6488['id']=_0x6c6488['id']??at()['substring'](0x0,0x15),this['_pendingContextItems']['set'](_0x6c6488['uiId'],_0x6c6488),this['fire']('contextItemAdded',{'contextItem':_0x6c6488,'isLoading':!0x1});}async['loadSourceResources'](_0x5ea472,_0x45968b,_0x58bf93){const _0x232015=this['_addContextOptionsState']['sources']['find'](_0x5522ee=>_0x5522ee['id']===_0x5ea472);if(!_0x232015)return this['fire']('error',{'error':new ht('ai-chat-source-not-found',this,{'sourceId':_0x5ea472}),'sourceId':_0x5ea472}),[];try{const _0x2b6de0=(await _0x232015['getResources'](_0x45968b))['map'](_0x497ff2=>{const _0x20899c=this['_isResourceInContext'](_0x497ff2['id']);return{..._0x497ff2,'isInContext':_0x20899c};});return _0x232015['resources']=_0x2b6de0,this['fire']('sourceResourcesLoaded',{'sourceId':_0x5ea472,'source':_0x232015,'resources':_0x2b6de0,'uid':_0x58bf93}),_0x2b6de0;}catch(_0x31450b){return this['fire']('error',{'error':new ht('ai-chat-source-resources-load-failed',this,{'sourceId':_0x5ea472,'originalError':_0x31450b}),'sourceId':_0x5ea472,'sourceLabel':_0x232015['label']}),[];}}async['addResourceToContext'](_0x3e1ee9,_0x67480){if(this['_isResourceInContext'](_0x67480['id']))return;let _0x2b98e6=_0x67480['data'];if(!_0x2b98e6&&_0x3e1ee9['getData'])try{_0x2b98e6=await _0x3e1ee9['getData'](_0x67480['id']);}catch(_0x16b0eb){return void this['fire']('error',{'error':new ht('ai-chat-resource-load-failed',this,{'resourceId':_0x67480['id'],'sourceId':_0x3e1ee9['id'],'originalError':_0x16b0eb}),'resourceId':_0x67480['id'],'sourceId':_0x3e1ee9['id']});}if(_0x2b98e6)switch(_0x67480['type']){case'web-resource':if('string'!=typeof _0x2b98e6)return void this['fire']('error',{'error':new ht('ai-chat-context-invalid-data',this,{'resourceId':_0x67480['id'],'sourceId':_0x3e1ee9['id'],'expectedType':'string','actualType':typeof _0x2b98e6}),'resourceId':_0x67480['id'],'sourceId':_0x3e1ee9['id']});await this['addUrlToContext'](_0x2b98e6,{'label':_0x67480['label'],'resourceId':_0x67480['id']});break;case'file':if(!(_0x2b98e6 instanceof File))return void this['fire']('error',{'error':new ht('ai-chat-context-invalid-data',this,{'resourceId':_0x67480['id'],'sourceId':_0x3e1ee9['id'],'expectedType':'File','actualType':typeof _0x2b98e6}),'resourceId':_0x67480['id'],'sourceId':_0x3e1ee9['id']});await this['addFilesToContext']([_0x2b98e6],{'label':_0x67480['label'],'resourceId':_0x67480['id']});break;case'text':if('object'!=typeof _0x2b98e6||!('content'in _0x2b98e6)||!('type'in _0x2b98e6))return void this['fire']('error',{'error':new ht('ai-chat-context-invalid-data',this,{'resourceId':_0x67480['id'],'sourceId':_0x3e1ee9['id'],'expectedType':'object\x20with\x20content\x20and\x20type\x20properties','actualType':typeof _0x2b98e6}),'resourceId':_0x67480['id'],'sourceId':_0x3e1ee9['id']});_0x2b98e6=AIChatContext['_convertTextResourceToFile'](_0x2b98e6,_0x67480['label']),await this['addFilesToContext']([_0x2b98e6],{'label':_0x67480['label'],'resourceId':_0x67480['id']},'text');break;case'mcp-tool-context':break;default:this['fire']('error',{'error':new ht('ai-chat-context-unsupported-type',this,{'resourceId':_0x67480['id'],'sourceId':_0x3e1ee9['id'],'resourceType':_0x67480['type']}),'resourceId':_0x67480['id'],'sourceId':_0x3e1ee9['id']});}else this['fire']('error',{'error':new ht('ai-chat-resource-no-data',this,{'resourceId':_0x67480['id'],'sourceId':_0x3e1ee9['id']}),'resourceId':_0x67480['id'],'sourceId':_0x3e1ee9['id']});}['toggleAddCurrentDocumentOptionVisibility'](_0x22eea0){if(void 0x0!==_0x22eea0)this['_addContextOptionsState']['document']['isHidden']=!_0x22eea0;else{const _0x2fa17b=this['isCurrentDocumentInContext']()||this['isCurrentDocumentInConversation']();this['_addContextOptionsState']['document']['isHidden']=_0x2fa17b;}this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']});}static['_convertTextResourceToFile'](_0x2720df,_0x36efb4){switch(_0x2720df['type']){case'markdown':return new File([_0x2720df['content']],_0x36efb4,{'type':'text/markdown'});case'html':return new File([_0x2720df['content']],_0x36efb4,{'type':'text/html'});default:return new File([_0x2720df['content']],_0x36efb4,{'type':'text/plain'});}}static['_mapContextItemToRequestData'](_0x56e9a8){switch(_0x56e9a8['type']){case'file':case'image':case'text':return[{'type':'file','id':_0x56e9a8['id']}];case'web-resource':return[{'type':'web-resource','id':_0x56e9a8['id']}];case'document':return _0x56e9a8['documents']?.['length']?_0x56e9a8['documents']['map'](_0x2577dc=>({'type':'document','id':_0x2577dc['id'],..._0x2577dc['selection']?.['length']&&{'selection':_0x2577dc['selection']}})):[{'type':'document','id':_0x56e9a8['id'],..._0x56e9a8['selection']?.['length']&&{'selection':_0x56e9a8['selection']}}];case'mcp-tool-context':{const _0x4e801d=_0x56e9a8;return[{'type':'mcp-tool-context','mcpServerName':_0x4e801d['mcpServerName'],'toolName':_0x4e801d['toolName'],'data':{..._0x4e801d['data'],'label':_0x4e801d['label']||_0x4e801d['data']?.['label']||_0x4e801d['id']},'id':_0x4e801d['id']}];}default:return[];}}['_addContextItem'](_0x3034af,_0x408b87=!0x1){if(this['_pendingContextItems']['set'](_0x3034af['uiId'],_0x3034af),_0x3034af['hidden']||this['fire']('contextItemAdded',{'contextItem':_0x3034af,'isLoading':_0x408b87}),'current-document'===_0x3034af['uiId']&&this['toggleAddCurrentDocumentOptionVisibility'](),_0x3034af['resourceId']){const _0x36c0fc=this['_findSourceIdsByResourceId'](_0x3034af['resourceId']);_0x36c0fc&&_0x36c0fc['forEach'](_0xd86b01=>{this['_updateResourceInContextState'](_0xd86b01,_0x3034af['resourceId'],!0x0);});}}['_removeContextItem'](_0x4202b7){const _0x1f95d9=this['_pendingContextItems']['get'](_0x4202b7),_0x4ac9ab=this['_ongoingUploads']['get'](_0x4202b7);if(_0x4ac9ab&&(_0x4ac9ab['abort'](),this['_ongoingUploads']['delete'](_0x4202b7)),_0x1f95d9?.['resourceId']){const _0x43f374=this['_findSourceIdsByResourceId'](_0x1f95d9['resourceId']);_0x43f374&&_0x43f374['forEach'](_0x24d2fd=>{this['_updateResourceInContextState'](_0x24d2fd,_0x1f95d9['resourceId'],!0x1);});}this['_pendingContextItems']['delete'](_0x4202b7),this['fire']('contextItemRemoved',{'uiId':_0x4202b7,'type':_0x1f95d9?.['type']}),'current-document'===_0x4202b7&&this['toggleAddCurrentDocumentOptionVisibility']();}['_finishContextItemLoading'](_0x4c1efe,_0x1dab45){if(this['_pendingContextItems']['has'](_0x4c1efe['uiId'])&&(this['_pendingContextItems']['set'](_0x4c1efe['uiId'],_0x4c1efe),this['fire']('contextItemLoadingEnded',{'contextItem':_0x4c1efe,'isLoading':_0x1dab45}),_0x4c1efe['resourceId'])){const _0x265d92=this['_findSourceIdsByResourceId'](_0x4c1efe['resourceId']);_0x265d92&&_0x265d92['forEach'](_0x391860=>{this['_updateResourceInContextState'](_0x391860,_0x4c1efe['resourceId'],!0x0);});}}['_addToConversationContextItem'](_0x2079b2){this['_conversationContextItems']['set'](_0x2079b2['uiId'],_0x2079b2);}['_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'](_0x18a451=>({..._0x18a451,'enabled':!0x0}))??[]},this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']});}['_getCustomSourcesInitialState'](){return this['_config']?.['sources']?.['map'](_0x44e0a1=>({..._0x44e0a1,'resources':[]}))??[];}['_isResourceInContext'](_0x4e8dcf){for(const _0x2d77cb of this['_pendingContextItems']['values']())if(_0x2d77cb['resourceId']===_0x4e8dcf)return!0x0;for(const _0x24a6ce of this['_conversationContextItems']['values']())if(_0x24a6ce['resourceId']===_0x4e8dcf)return!0x0;return!0x1;}['_findSourceIdsByResourceId'](_0x3db8cc){const _0x4e0e61=[];for(const _0x19fd01 of this['_addContextOptionsState']['sources']){_0x19fd01['resources']['find'](_0x1bb3ab=>_0x1bb3ab['id']===_0x3db8cc)&&_0x4e0e61['push'](_0x19fd01['id']);}return 0x0===_0x4e0e61['length']?null:_0x4e0e61;}['_updateResourceInContextState'](_0x55b05c,_0x4e28cc,_0x1f3452){const _0xce0e36=this['_addContextOptionsState']['sources']['find'](_0x36614d=>_0x36614d['id']===_0x55b05c);if(!_0xce0e36)return;const _0x5f0e89=_0xce0e36['resources']['find'](_0x477bcb=>_0x477bcb['id']===_0x4e28cc);_0x5f0e89&&(_0x5f0e89['isInContext']=_0x1f3452,this['fire']('resourceStateChanged',{'sourceId':_0x55b05c,'resourceId':_0x4e28cc,'isInContext':_0x1f3452}));}['_startUploadOperation'](_0x2d9f30){this['_ongoingUploadOperations']['set'](_0x2d9f30,!0x0),this['_ongoingUploadOperations']['size']&&this['fire']('uploadProgressChanged',{'isUploadInProgress':!0x0});}['_finishUploadOperation'](_0x5bc384){this['_ongoingUploadOperations']['delete'](_0x5bc384),0x0===this['_ongoingUploadOperations']['size']&&this['fire']('uploadProgressChanged',{'isUploadInProgress':!0x1});}}const gs=['capabilitiesUpdated'];class AICapabilities extends Et(){['_isWebSearchEnabled'];['_isReasoningEnabled'];constructor(){super(),this['_isWebSearchEnabled']=!0x1,this['_isReasoningEnabled']=!0x1;}['init'](){this['reset']();}['reset'](){this['setWebSearch'](!0x1),this['setReasoning'](!0x1);}['getCapabilitiesConfig'](){return{'isWebSearchEnabled':this['_isWebSearchEnabled'],'isReasoningEnabled':this['_isReasoningEnabled']};}static['getCapabilitiesRequestData'](_0x41fc92){const _0x135549={};return _0x41fc92&&_0x41fc92['isWebSearchEnabled']&&(_0x135549['webSearch']={}),_0x41fc92&&_0x41fc92['isReasoningEnabled']&&(_0x135549['reasoning']={}),_0x135549;}['toggleWebSearch'](){this['setWebSearch'](!this['_isWebSearchEnabled']);}['toggleReasoning'](){this['setReasoning'](!this['_isReasoningEnabled']);}['setWebSearch'](_0x419e82){_0x419e82!==this['_isWebSearchEnabled']&&(this['_isWebSearchEnabled']=_0x419e82,this['fire']('capabilitiesUpdated',this['getCapabilitiesConfig']()));}['setReasoning'](_0x4a3c81){_0x4a3c81!==this['_isReasoningEnabled']&&(this['_isReasoningEnabled']=_0x4a3c81,this['fire']('capabilitiesUpdated',this['getCapabilitiesConfig']()));}}class AIChatInteraction extends AIInteraction{['userMessage'];['conversationId'];['contextItems']=new Map();['capabilities'];['model'];['attributes'];constructor(_0x538acf){super(_0x538acf),this['conversationId']=_0x538acf['conversationId'],this['contextItems']=_0x538acf['contextItems'],this['capabilities']=_0x538acf['capabilities'],this['userMessage']=_0x538acf['userMessage'],this['model']=_0x538acf['model'],this['attributes']=_0x538acf['attributes'];}async['sendRequest'](){return this['connector']['queryAssistant']({'message':this['userMessage'],'conversationId':this['conversationId'],'parts':AIChatContext['mapContextItemsToRequestData'](this['contextItems']),'capabilities':AICapabilities['getCapabilitiesRequestData'](this['capabilities']),'model':this['model'],'attributes':this['attributes']});}['getDocumentContext'](){return this['contextItems']['get']('current-document');}}class AIChatConversation extends Et(){['id'];['isStarted']=!0x1;['isFromHistory'];['interactions']=[];['currentInteraction'];['selectedModel'];['connector'];['options'];['_channelsToEditors'];['_getSessionId'];constructor(_0x5b624d){super(),this['options']=_0x5b624d,this['connector']=_0x5b624d['connector'],this['chatModels']=_0x5b624d['chatModels'],this['id']=_0x5b624d['conversationId'],this['isFromHistory']=_0x5b624d['isFromHistory'],this['_channelsToEditors']=_0x5b624d['channelsToEditors'],this['_getSessionId']=_0x5b624d['getSessionId'];}async['init'](_0x3be842){try{this['chatContext']=new AIChatContext({'connector':this['connector'],'config':_0x3be842,'ownerId':this['id']}),this['chatContext']['delegate'](...As)['to'](this),this['chatContext']['init'](),this['chatCapabilities']=new AICapabilities(),this['chatCapabilities']['delegate'](...gs)['to'](this),this['chatCapabilities']['init']();const _0x205e72=await this['chatModels']['getAvailableModels']();this['fire']('conversationInitialized',{'availableModels':_0x205e72});const _0x27c7bf=await this['chatModels']['getModel'](this['options']['selectedModelId']);_0x27c7bf&&await this['setModel'](_0x27c7bf);}catch(_0x23db9f){const _0x34a374=new ht('ai-chat-conversation-init-failed',null,{'message':_0x23db9f['message']||_0x23db9f});_0x34a374['stack']=_0x23db9f['stack'],this['fire']('error',{'error':_0x34a374});}}async['start'](){if(this['isStarted'])throw new ht('ai-chat-conversation-already-started',null,{'conversation':this});if(!this['selectedModel'])throw new ht('ai-chat-conversation-start-no-model-selected',null,{'conversation':this});try{const {id:_0x44eec2}=await this['connector']['startConversation'](this['id'],this['options']['group'])['getConversation']();this['id']=_0x44eec2,this['isStarted']=!0x0,this['fire']('conversationStarted',{'conversationId':this['id'],'selectedModel':this['selectedModel']});}catch(_0x3d68a7){const _0x17a21d=new ht('ai-chat-conversation-start-failed',null,{'message':_0x3d68a7['message'],'conversationId':this['id']});throw _0x17a21d['stack']=_0x3d68a7['stack'],this['fire']('error',{'error':_0x17a21d}),_0x17a21d;}}async['load'](_0x5e5dfb){try{const _0x38ead4=await this['connector']['fetchConversation'](_0x5e5dfb)['getConversation'](),_0x16b7d2=await this['connector']['fetchConversationMessages'](_0x5e5dfb)['getMessages'](),_0x3d89de=_0x16b7d2[0x0]['model'];this['isStarted']=!0x0,this['id']=_0x38ead4['id'],'title'in _0x38ead4?this['fire']('setConversationTitle',_0x38ead4['title'],!0x0):this['fire']('setConversationTitle','',!0x0);const _0x33be1b=(await this['chatModels']['getAll']())['find'](_0x2ec5b3=>_0x2ec5b3['id']['toLowerCase']()===_0x3d89de['toLowerCase']());this['selectedModel']=_0x33be1b,this['fire']('modelSelected',{'selectedModel':_0x33be1b,'isDisabled':!0x0});const {streamingMessageId:_0x5700d3}=await this['_processMessagesToInteractions'](_0x16b7d2,_0x3d89de);return _0x5700d3&&this['currentInteraction']?this['_resumeStream'](_0x5700d3):this['currentInteraction']=void 0x0,this;}catch(_0xf132c3){const _0x2848e2=new ht('ai-chat-conversation-init-from-id-failed',null,{'message':_0xf132c3['message'],'conversationId':_0x5e5dfb});throw _0x2848e2['stack']=_0xf132c3['stack'],this['fire']('error',{'error':_0x2848e2}),_0x2848e2;}}async['_processMessagesToInteractions'](_0x476bce,_0x40da48){let _0x57f917,_0x27b724,_0x500ab1=!0x1;for(const _0x353645 of _0x476bce)if('user'===_0x353645['role']){const {contextItems:_0x30ef3e,hasUnmatched:_0x392851}=await this['_extractContextItems'](_0x353645);_0x500ab1=_0x392851;const _0x30b3ef={'isReasoningEnabled':Object['hasOwn'](_0x353645['capabilities'],'reasoning'),'isWebSearchEnabled':Object['hasOwn'](_0x353645['capabilities'],'webSearch')};_0x57f917=this['createInteraction']({'userMessage':_0x353645['prompt'],'contextItems':_0x30ef3e,'capabilities':_0x30b3ef,'modelId':_0x40da48,'attributes':_0x353645['attributes'],'channelsToEditors':this['_channelsToEditors']}),this['currentInteraction']=_0x57f917,_0x27b724=void 0x0,this['chatContext']['addToConversationContext'](this['currentInteraction']['contextItems']);}else{if('assistant'===_0x353645['role']&&_0x57f917){if('streaming'===_0x353645['status']){_0x27b724=_0x353645['id'];continue;}if('error'===_0x353645['status'])continue;const _0x4fd026=[];for(const _0x1738b4 of _0x353645['content'])switch(_0x1738b4['type']){case'text':case'modification':{const _0x45472a=_0x57f917['getDocumentContext'](),_0x110fe1=this['_hasSessionMismatch'](_0x45472a)||_0x500ab1;_0x57f917['currentReply']?.['type']!==_0x1738b4['type']&&(_0x57f917['currentReply']=_0x57f917['createReply']({'type':_0x1738b4['type'],'isDone':!0x0,'interactionId':_0x57f917['id'],'areActionsDisabled':_0x110fe1,'isFromHistory':!0x0,'channelsToEditors':this['_channelsToEditors']}),_0x4fd026['length']>0x0&&(_0x57f917['currentReply']['sources']=_0x4fd026['splice'](0x0))),_0x57f917['currentReply']['appendContent'](_0x1738b4['content'],_0x1738b4['documentId']);break;}case'url':_0x4fd026['push'](_0x1738b4);break;case'mcp-tool-result':{const {data:_0x226f3c,attributes:_0x1dfe3c}=JSON['parse'](_0x1738b4['content']);_0x57f917['_handleToolResultData']({'toolName':_0x1738b4['toolName'],'data':_0x226f3c,'attributes':_0x1dfe3c});break;}}'cancelled'===_0x353645['status']&&this['fire']('error',{'interactionId':_0x57f917['id'],'error':new ht('ai-request-aborted',this)});}}return{'streamingMessageId':_0x27b724};}async['_resumeStream'](_0x583e76){if(this['currentInteraction'])try{const _0x2249e5=this['connector']['resumeStream'](this['id'],_0x583e76);await this['currentInteraction']['resume'](_0x2249e5);}catch(_0x5ecf8c){_0x5ecf8c instanceof ht&&this['fire']('error',{'interactionId':this['currentInteraction']?.['id'],'error':_0x5ecf8c});}finally{this['currentInteraction']?.['stop'](),this['currentInteraction']=void 0x0;}}async['_extractContextItems'](_0x21eb5f){const _0x5b88a0=new Map();if(!_0x21eb5f['content'])return{'contextItems':_0x5b88a0,'hasUnmatched':!0x1};const {contextItem:_0x5c0285,hasUnmatched:_0x675b58}=await this['chatContext']['populateDocumentsFromMessage'](_0x21eb5f['content'],Array['from'](this['_channelsToEditors']['values']()));_0x5c0285&&_0x5b88a0['set'](_0x5c0285['id'],_0x5c0285);for(const _0xb1ab7a of _0x21eb5f['content']){if('document'===_0xb1ab7a['type'])continue;const _0x384aff=await this['chatContext']['populateFromMessage'](_0xb1ab7a);_0x384aff&&_0x5b88a0['set'](_0x384aff['id'],_0x384aff);}return{'contextItems':_0x5b88a0,'hasUnmatched':_0x675b58};}async['handleUserInteraction']({userMessage:_0x43e6de,attributes:_0x4cc79a}){if(!this['isStarted'])throw new ht('ai-chat-handle-user-conversation-not-initialized',null,{'conversation':this});if(this['currentInteraction'])throw new ht('ai-chat-handle-user-interaction-already-in-progress',null,{'conversation':this});try{const _0x54ebba=this['chatContext']['getPendingContextItems'](),_0x4231a8=this['chatCapabilities']['getCapabilitiesConfig'](),_0x4ff324=this['selectedModel']['id'];this['currentInteraction']=this['createInteraction']({'userMessage':_0x43e6de,'contextItems':_0x54ebba,'capabilities':_0x4231a8,'modelId':_0x4ff324,'attributes':_0x4cc79a,'channelsToEditors':this['_channelsToEditors']}),await this['currentInteraction']['start'](),this['chatContext']['addToConversationContext'](this['currentInteraction']['contextItems']);}catch(_0x2c7c0e){if(_0x2c7c0e instanceof ht)this['fire']('error',{'interactionId':this['currentInteraction']?this['currentInteraction']['id']:void 0x0,'error':_0x2c7c0e});else{const _0x2de136=Is['get'](_0x2c7c0e['code'])||'ai-chat-handle-user-interaction-start-failed';this['fire']('error',{'interactionId':this['currentInteraction']?this['currentInteraction']['id']:void 0x0,'error':new ht(_0x2de136,null,{'error':_0x2c7c0e})});}}finally{this['currentInteraction']?.['stop'](),this['currentInteraction']=void 0x0;}}['createInteraction']({userMessage:_0x5a63da,contextItems:_0x23abff,capabilities:_0x21cf27,modelId:_0x3e82f2,attributes:_0x7da78d,channelsToEditors:_0x1e41c6}){const _0x54b39a=new AIChatInteraction({'userMessage':_0x5a63da,'contextItems':_0x23abff,'capabilities':_0x21cf27,'conversationId':this['id'],'connector':this['connector'],'locale':this['options']['locale'],'model':_0x3e82f2,'attributes':_0x7da78d,'channelsToEditors':_0x1e41c6});return _0x54b39a['delegate'](..._s)['to'](this),this['interactions']['push'](_0x54b39a),this['fire']('interactionCreated',_0x54b39a),_0x54b39a;}['getInteraction'](_0x8a4269){return this['interactions']['find'](_0x26e477=>_0x26e477['id']===_0x8a4269);}['removeInteraction'](_0x71d9c){const _0x4d9061=this['getInteraction'](_0x71d9c);_0x4d9061&&(_0x4d9061['destroy'](),this['interactions']['splice'](this['interactions']['indexOf'](_0x4d9061),0x1));}get['lastInteraction'](){return this['interactions'][this['interactions']['length']-0x1];}['cancelLastInteractionStream'](){const _0x27ed31=this['lastInteraction'];_0x27ed31?.['conversationId']&&_0x27ed31['messageId']&&this['connector']['cancelStream'](_0x27ed31['conversationId'],_0x27ed31['messageId'])['execute']()['catch'](()=>{});}['addCurrentDocumentToContext'](_0x1ed5c3){this['chatContext']['addCurrentDocumentToContext'](_0x1ed5c3);}async['updateCurrentDocumentsInContext'](_0x5397a6){await this['chatContext']['updateCurrentDocuments'](_0x5397a6);}['toggleAddCurrentDocumentOptionVisibility'](_0x2e7d5c){this['chatContext']['toggleAddCurrentDocumentOptionVisibility'](_0x2e7d5c);}['_hasSessionMismatch'](_0x42c13e){return!!_0x42c13e&&_0x42c13e['documents']['some'](_0x92e9ff=>{const _0x4cef3b=this['_channelsToEditors']['get'](_0x92e9ff['channelId']);return!_0x4cef3b||_0x92e9ff['sessionId']!==this['_getSessionId'](_0x4cef3b);});}['addSelectionToContext'](_0x184198){this['chatContext']['addSelectionToContext'](_0x184198);}['removeSelectionFromContext'](){this['chatContext']['removeSelectionFromContext']();}['addFilesToContext'](_0x2548b0){this['chatContext']['addFilesToContext'](_0x2548b0);}['addUrlToContext'](_0x550c27){this['chatContext']['addUrlToContext'](_0x550c27);}['addToolItemToContext'](_0x5ceb56){this['chatContext']['addToolItemToContext'](_0x5ceb56);}['addResourceToContext'](_0x58deca,_0x369a96){this['chatContext']['addResourceToContext'](_0x58deca,_0x369a96);}['loadSourceResources'](_0x35bfc9,_0x38e6b2,_0x4c2dc6){return this['chatContext']['loadSourceResources'](_0x35bfc9,_0x38e6b2,_0x4c2dc6);}['removeFromContext'](_0x57178b){this['chatContext']['removeFromContext'](_0x57178b);}['setWebSearch'](_0x22cbcd){this['chatCapabilities']['setWebSearch'](_0x22cbcd);}['toggleWebSearch'](){this['chatCapabilities']['toggleWebSearch']();}['setReasoning'](_0x2ec30e){this['chatCapabilities']['setReasoning'](_0x2ec30e);}['toggleReasoning'](){this['chatCapabilities']['toggleReasoning']();}['isCurrentDocumentInContext'](){return this['chatContext']['isCurrentDocumentInContext']();}['isCurrentDocumentInConversation'](){return this['chatContext']['isCurrentDocumentInConversation']();}['isSelectionInContext'](){return this['chatContext']['isSelectionInContext']();}async['setModel'](_0x3f52d1){_0x3f52d1?!0x1===await this['chatModels']['isAvailable'](_0x3f52d1)&&(wt('ai-chat-conversation-set-model-not-available',{'conversation':this,'model':_0x3f52d1}),_0x3f52d1=(await this['chatModels']['getAvailableModels']())[0x0]):(wt('ai-chat-conversation-set-model-null',{'conversation':this}),_0x3f52d1=(await this['chatModels']['getAvailableModels']())[0x0]),_0x3f52d1['id']!==this['selectedModel']?.['id']&&(this['selectedModel']=_0x3f52d1,this['chatCapabilities']['reset'](),this['fire']('modelSelected',{'selectedModel':_0x3f52d1}));}}class AIModels extends Et(){['_connector'];['_config'];['_locale'];['_modelList']=[];['_modelsRequest']=null;constructor({connector:_0x445bcc,config:_0x3a7e24,locale:_0x1e773b}){super(),this['_connector']=_0x445bcc,this['_config']=_0x3a7e24,this['_locale']=_0x1e773b;}get['_availableModels'](){return this['_config']?.['displayedModels'];}get['_defaultModelId'](){return this['_config']?.['defaultModelId'];}async['getAll'](){return this['_modelsRequest']||(this['_modelsRequest']=this['_retrieveModels']()),this['_modelsRequest'];}async['getAvailableModels'](){const _0x4b30f0=await this['getAll']();let _0x4ea44a;return _0x4ea44a=this['_availableModels']?this['_filterModels'](_0x4b30f0,this['_availableModels']):_0x4b30f0['filter'](_0x18c403=>_0x18c403['recommended']),_0x4ea44a;}async['getModel'](_0x20dfc4){const _0xf331cd=await this['getAll']();if(!_0xf331cd['length'])return null;if(_0x20dfc4){const _0x2e607=this['_getModelById'](_0xf331cd,_0x20dfc4);if(_0x2e607)return _0x2e607;wt('ai-chat-model-id-unrecognized',{'modelId':_0x20dfc4,'fallBackModelId':this['_defaultModelId']});}return this['getDefault']();}async['getDefault'](){const _0x56f92c=await this['getAvailableModels']();if(!_0x56f92c['length'])return null;if(this['_defaultModelId']){const _0x527af0=this['_getModelById'](_0x56f92c,this['_defaultModelId']);if(_0x527af0)return _0x527af0;wt('ai-chat-default-model-id-unrecognized',{'defaultModelId':this['_defaultModelId'],'fallBackModelId':_0x56f92c[0x0]['id']});}return _0x56f92c[0x0];}async['isAvailable'](_0x3c23ec){return(await this['getAvailableModels']())['some'](_0x3ee098=>_0x3ee098['name']===_0x3c23ec['name']&&_0x3ee098['provider']===_0x3c23ec['provider']);}async['_retrieveModels'](){if(!this['_modelList']['length'])try{const _0x5650e7=this['_locale']['uiLanguage']||'en',_0x1b427e=this['_connector']['getModels'](_0x5650e7),_0x1e1334=await _0x1b427e['list']();this['_modelList']=_0x1e1334['items']['map'](_0x51fd0b=>ws(_0x51fd0b)?{..._0x51fd0b,'name':Mi(this['_locale'],'AI_MODEL_NAME_AUTO')}:_0x51fd0b);}catch(_0x14e623){throw Ct('ai-models-unable-to-retrieve',{'error':_0x14e623}),_0x14e623;}return[...this['_modelList']];}['_filterModels'](_0x52052c,_0x206ab1){let _0x10c7a1;if(_0x206ab1){_0x10c7a1=[];const _0x5a547b=new Set(),_0x24a685='string'==typeof _0x206ab1?[_0x206ab1['toLocaleLowerCase']()]:_0x206ab1['map'](_0x1a6078=>_0x1a6078['toLocaleLowerCase']());for(const _0xd9c2fe of _0x24a685)for(const _0x14ebd9 of _0x52052c)!_0x5a547b['has'](_0x14ebd9['id'])&&this['_isMatchingFilter'](_0x14ebd9,_0xd9c2fe)&&(_0x10c7a1['push'](_0x14ebd9),_0x5a547b['add'](_0x14ebd9['id']));}else _0x10c7a1=_0x52052c;return _0x10c7a1;}['_isMatchingFilter'](_0x4c2051,_0x1f75fc){const _0x2f25c5=_0x4c2051['id']['toLocaleLowerCase'](),_0x29594a=_0x4c2051['name']['toLocaleLowerCase'](),_0x178a48=_0x4c2051['provider']['toLocaleLowerCase']();return _0x2f25c5===_0x1f75fc||_0x29594a===_0x1f75fc||ws(_0x4c2051)&&'auto'===_0x1f75fc||_0x178a48===_0x1f75fc||_0x2f25c5['startsWith'](_0x1f75fc);}['_getModelById'](_0xb113b3,_0x510b9e){return _0xb113b3['find'](_0xed91e1=>ws(_0xed91e1)&&'auto'===_0x510b9e?_0xed91e1:_0xed91e1['id']===_0x510b9e)||null;}}function ws(_0x4a6ddb){return _0x4a6ddb['id']['startsWith']('agent');}function Cs(_0x36cee2){return _0x36cee2?_0x36cee2 instanceof _0x20c128?[_0x36cee2]:_0x36cee2['editors']&&0x0!==_0x36cee2['editors']['length']?Array['from'](_0x36cee2['editors']):[]:[];}function ms(_0x342282){const _0x53da9f=Cs(_0x342282);if(!_0x53da9f['length'])throw new ht('ai-get-editor-from-context-no-editor');if(0x1===_0x53da9f['length'])return _0x53da9f[0x0];const _0x3cf4f4=_0x53da9f['find'](_0x3bd512=>_0x3bd512['ui']?.['focusTracker']?.['isFocused']);if(_0x3cf4f4)return _0x3cf4f4;const _0xb7614b=function(_0x630ede){if(_0x630ede instanceof _0x20c128)return;const _0x386108=_0x630ede;if(!_0x386108['plugins']||!_0x386108['plugins']['has']('AIEditing'))return;const _0x14fb9e=_0x386108['plugins']['get']('AIEditing');return _0x14fb9e['getLastContentFocusedEditor']?.();}(_0x342282);return _0xb7614b&&_0x53da9f['includes'](_0xb7614b)?_0xb7614b:_0x53da9f[0x0];}function ps({interaction:_0x27682c,reply:_0x31f511,groups:_0x2ba319,transform:_0xbf9ed0,documentCompare:_0x3f81ca,documentCompareOptions:_0x314cd6}){const _0x20e6b4=_0x27682c['getDocumentContext']()['documents']['find'](_0x29e6f6=>_0x29e6f6['id']==_0x2ba319[0x0]['documentId']),_0x3132c4=_0x2ba319[0x0]['editor'];if(!_0x20e6b4)return[];const _0x3dc552=_0x20e6b4['content'],_0x53d401=_0x20e6b4['version'],_0x213b2b=_0x31f511['documentContextContent']['get'](_0x2ba319[0x0]['documentId'])['cloneNode'](!0x0);for(const {changes:_0x1969d7}of _0x2ba319){const _0xdf24da=_0x1969d7['filter'](_0x30c625=>'new'!=_0x30c625['type'])['map'](_0x251618=>Yi('data-id',_0x251618['id'],_0x213b2b)),_0x2829f4=_0x1969d7['filter'](_0x2ff37=>'removed'!=_0x2ff37['type'])['map'](_0x2fb2ff=>_0x2fb2ff['node']['cloneNode'](!0x0));let _0x1cf1e0=null;if(_0xdf24da['length']){_0x1cf1e0=_0xdf24da[0x0]['previousSibling'];for(let _0x2c3f60=0x0;_0x2c3f60<_0xdf24da['length'];_0x2c3f60++)_0x4b0b34(_0xdf24da[_0x2c3f60]);}if(_0x2829f4['length']){_0x1cf1e0||(_0x1969d7[0x0]['anchorId']?_0x1cf1e0=Yi('data-id',_0x1969d7[0x0]['anchorId'],_0x213b2b):(_0x1cf1e0=_0x2829f4['shift'](),_0x33d667(_0x213b2b,_0x1cf1e0)));for(let _0x1f25b5=0x0;_0x1f25b5<_0x2829f4['length'];_0x1f25b5++)_0x147a64(_0x1cf1e0,_0x2829f4[_0x1f25b5]),_0x1cf1e0=_0x2829f4[_0x1f25b5];}}const _0x73b898=Ki(_0x213b2b),_0x54a4ef=_0x3f81ca['getDiff'](_0x3dc552,_0x73b898,{'targetEditor':_0x3132c4,..._0x314cd6})['getOperations']();if(_0xbf9ed0){const _0x5d6f07=_0x3132c4['model']['document']['history']['getOperations'](_0x53d401),_0x24c74b={'document':_0x3132c4['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1};return _0x18252b(_0x54a4ef,_0x5d6f07,_0x24c74b)['operationsA'];}return _0x54a4ef;}function Es(_0x44b7da,_0x5a4944){if('marker'!=_0x5a4944['type'])return;const _0x1bc172=_0x44b7da['model']['markers']['get'](_0x5a4944['name']);_0x1bc172&&(_0x5a4944['oldRange']=_0x1bc172['getRange']());}function Ts(_0x2a13b8,_0x2cf76f){if(_0x2a13b8['files']['length']>0x0&&_0x2cf76f['filesEnabled']){const _0x1f9db9=_0x2a13b8['files']['filter'](_0x1d4a16=>_0x1d4a16['name']);return _0x1f9db9['length']>0x0?{'type':'file','files':_0x1f9db9}:null;}if(_0x2cf76f['urlsEnabled']){const _0x153263=function(_0x3a32d2){const _0x50c25d=_0x3a32d2['trim']();if(/\s/['test'](_0x50c25d))return null;try{const _0x47bd1f=new URL(_0x50c25d);return'http:'!==_0x47bd1f['protocol']&&'https:'!==_0x47bd1f['protocol']?null:_0x47bd1f['toString']();}catch{return null;}}(_0x2a13b8['plainText']);if(_0x153263)return{'type':'url','url':_0x153263};}const _0x38ebd2=_0x2a13b8['forceTextAttachment']?0x1:_0x2cf76f['longTextThreshold']??0x1/0x0;if(_0x2a13b8['plainText']['length']>=Math['max'](_0x38ebd2,0x1)&&_0x2cf76f['filesEnabled']){const _0x3d439d=_0x2cf76f['pastedTextLabel']+'.txt';return{'type':'text','files':[new File([_0x2a13b8['plainText']],_0x3d439d,{'type':'text/plain'})]};}return null;}class AIChatController extends _0x533560{['activeConversation'];['_aiEditing'];['_aiConnector'];['_aiChatUi'];['_aiChatModels'];['_hasAIChatBalloon']=!0x1;['_activeBalloon'];['_batchToChanges']=new Map();['_currentPreviewedChangeGroup']=null;['_bodyCollection'];['_channelsToEditors']=new Map();static get['requires'](){return[AIConnector,_0x4fc25b];}static get['pluginName'](){return'AIChatController';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){this['set']('isConversationReady',!0x1),this['_bodyCollection']=new Xt(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_aiConnector']=this['context']['plugins']['get']('AIConnector'),this['_aiChatUi']=this['context']['plugins']['get']('AIChatUI'),this['_aiEditing']=this['context']['plugins']['get']('AIEditing'),this['_aiChatModels']=new AIModels({'connector':this['_aiConnector'],'config':this['context']['config']['get']('ai.models'),'locale':this['context']['locale']});const _0x4ee378=this['context']['plugins']['get']('AITabs');this['listenTo'](this['_aiChatUi'],'startConversation',()=>{this['_startConversationSafely']();}),this['listenTo'](this['_aiChatUi'],'sendUserMessage',(_0x470dde,_0x1b4a6c)=>{this['_handleUIUserMessage']({'message':_0x1b4a6c});}),this['listenTo'](_0x4ee378['view'],'change:activeTab',(_0x2ba545,_0x36a0ff,_0x49703c)=>{'chat'!==_0x49703c&&this['removeSelectionFromChatContext']();}),this['listenTo'](this['_aiChatUi'],'abortPromptStream',async()=>{await this['_stopLastInteraction'](),await this['_flushLastInteractionUI'](),this['removeSelectionFromChatContext'](),this['activeConversation']?.['cancelLastInteractionStream']();}),this['listenTo'](this['_aiChatUi'],'addDocumentToContext',()=>{this['addCurrentDocumentToChatContext']();}),this['listenTo'](this['_aiChatUi'],'addFileToContext',(_0x2ab34a,_0x23f7e2)=>{this['activeConversation']?.['addFilesToContext'](Array['from'](_0x23f7e2));}),this['listenTo'](this['_aiChatUi'],'addUrlToContext',(_0x10a131,_0x1ea7a8)=>{this['activeConversation']?.['addUrlToContext'](_0x1ea7a8);}),this['listenTo'](this['_aiChatUi'],'promptInputPaste',(_0x4fca15,_0x54390d)=>{const _0x24a758=this['activeConversation'];if(!_0x24a758)return;_0x54390d['hasDirectory']&&(_0x54390d['preventDefault'](),this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_FOLDER_NOT_SUPPORTED'),'id':'folder-error-'+at()}));const _0x108832=Ts(_0x54390d,{'pastedTextLabel':Mi(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')});_0x108832&&(_0x54390d['preventDefault'](),'url'===_0x108832['type']?_0x24a758['addUrlToContext'](_0x108832['url']):_0x24a758['chatContext']['addFilesToContext'](_0x108832['files'],void 0x0,_0x108832['type']));}),this['listenTo'](this['_aiChatUi'],'executeCustomItemCallback',(_0xeb266f,_0x28853e)=>{_0x28853e['callback'](this['context']);}),this['listenTo'](this['_aiChatUi'],'addResourceToContext',(_0x75c020,_0xbfe3c6)=>{this['activeConversation']?.['addResourceToContext'](_0xbfe3c6['source'],_0xbfe3c6['resource']);}),this['listenTo'](this['_aiChatUi'],'removeContextItem',(_0x52b6ef,_0x3a0605)=>{this['_removeFromContext'](_0x3a0605);}),this['listenTo'](this['_aiChatUi'],'loadSourceResources',(_0x21cae6,_0x4ed295)=>{this['activeConversation']?.['loadSourceResources'](_0x4ed295['sourceId'],_0x4ed295['query'],_0x4ed295['uid']);}),this['listenTo'](this['_aiChatUi'],'toggleWebSearch',()=>{this['_toggleWebSearch']();}),this['listenTo'](this['_aiChatUi'],'toggleReasoning',()=>{this['_toggleReasoning']();}),this['listenTo'](this['_aiChatUi'],'selectModel',(_0x4eff9a,_0x5d0e76)=>{this['activeConversation']?.['setModel'](_0x5d0e76);}),this['listenTo'](this['_aiChatUi'],'like',(_0x1c6034,{replyId:_0x2cb4c9})=>{console['log']('Liked\x20response',_0x2cb4c9);}),this['listenTo'](this['_aiChatUi'],'dislike',(_0x30aa59,{replyId:_0x48e3f2})=>{console['log']('Disliked\x20response',_0x48e3f2);}),this['listenTo'](this['_aiChatUi'],'insertSuggestion',(_0x183d15,_0x38d148)=>{this['_insertSuggestion'](_0x38d148);}),this['listenTo'](this['_aiChatUi'],'showChangeInText',(_0x1b0c14,{replyId:_0x4d40ba,partIndex:_0x20b35e})=>{this['_aiChatBalloonShowDiff']=this['_aiChatUi']['showDiff'],this['_openBalloonFor'](_0x4d40ba,_0x20b35e);}),this['listenTo'](this['_aiChatUi'],'mouseOverSuggestion',(_0x3d67d9,{replyId:_0x33e22d,partIndex:_0x1f6579})=>{const _0x5d507b=this['_getDocumentRangeForReplyChanges'](_0x33e22d,_0x1f6579);if(!_0x5d507b)return;const {reply:_0x2d31ff}=this['getInteractionAndReplyById'](_0x33e22d);'$graveyard'!=_0x5d507b['range']['root']['rootName']&&this['_aiEditing']['showFakeVisualSelection']({'editor':_0x2d31ff['changeGroups'][_0x1f6579]['editor'],'ranges':[_0x5d507b['range']],'id':'change-area','priority':0xa});}),this['listenTo'](this['_aiChatUi'],'mouseLeaveSuggestion',()=>{this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['listenTo'](this['_aiChatUi'],'applySuggestion',(_0x5c7fe4,_0x3f45ab)=>{this['_aiEditing']['hideFakeVisualSelection']('change-area'),this['_applySuggestion'](_0x3f45ab);}),this['listenTo'](this['_aiChatUi'],'toggleSuggestionDisplayMode',async(_0x1f744c,{replyId:_0x3dfded,showDiff:_0x3f7667})=>{const {interaction:_0x4c71c4,reply:_0x48d397}=this['getInteractionAndReplyById'](_0x3dfded),_0x4dae73=_0x48d397['getContentParts']({'showDiff':_0x3f7667});await this['_aiChatUi']['updateFeedItemAIReplySuggestionContent']({'id':_0x4c71c4['id']+':'+_0x48d397['id'],'parts':_0x4dae73});}),this['listenTo'](this['_aiChatUi'],'rejectSuggestion',(_0x37d48d,{replyId:_0x5613ff,partIndex:_0x514b77})=>{this['_rejectSuggestion']({'replyId':_0x5613ff,'partIndex':_0x514b77}),this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['set']('_aiChatBalloonShowDiff',!0x1),this['on']('interactionCreated',(_0x1a2e74,_0x3f034f)=>{this['_aiChatUi']['addFeedItemUserMessage'](_0x3f034f);}),this['on']('replyCreated',(_0x2ddba2,_0x145141)=>{this['_addFeedItemReply'](_0x145141);});}['afterInit'](){this['context']instanceof _0x20c128?this['_integrateEditor'](this['context']):this['listenTo'](this['context']['editors'],'add',(_0x6f2f01,_0x44e933)=>{_0x44e933['on']('ready',()=>{this['_integrateEditor'](_0x44e933);});}),this['_initConversation']();}async['_initConversation'](){const _0x4f507d=this['context']['config']['get']('ai.chat.initialConversation');let _0x75dcf8=_0x4f507d;('lastCreated'!=_0x4f507d||(_0x75dcf8=await this['_getLastCreatedConversationId'](),_0x75dcf8))&&('new'==_0x75dcf8?await this['_startConversationSafely']():await this['loadConversation'](_0x75dcf8));}async['destroy'](){return await this['_stopLastInteraction'](),this['_bodyCollection']['detachFromDom'](),super['destroy']();}async['loadConversation'](_0x280610){this['_closeActiveBalloon'](),(this['context']['plugins']['get'](AITabs)['view']['activateTab']('chat'),this['_aiChatUi']['setFeedItemRenderingStrategy']('static'),this['_aiChatUi']['toggleLoadingSkeleton'](!0x0),this['activeConversation']&&this['stopListening'](this['activeConversation']),await this['_stopLastInteraction']());try{await this['_aiConnector']['fetchConversation'](_0x280610)['getConversation'](),await this['_startConversationSafely']({'id':_0x280610}),this['_updateConversationTitle']('\x20'),await this['activeConversation']['load'](_0x280610),this['_aiChatUi']['enableControls'](),this['activeConversation']['isCurrentDocumentInConversation']()&&this['addCurrentDocumentToChatContext']();}catch(_0x2fbf11){this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION'),'id':_0x280610}),this['_logError'](new ht('ai-chat-conversation-not-found',this,{'error':_0x2fbf11}));}finally{this['_aiChatUi']['startAutoScroll']({'smooth':!0x1}),this['_aiChatUi']['setFeedItemRenderingStrategy']('streaming'),this['_aiChatUi']['toggleLoadingSkeleton'](!0x1);}}['registerToolDataCallback'](_0x38afd9){let _0x19acb0=null,_0x5a97fd=null;this['on']('toolDataReceived',(_0x1dad68,_0x3e5d9a,_0x207588)=>{_0x207588['id']!==_0x19acb0&&(_0x19acb0=_0x207588['id'],_0x5a97fd=this['_getAIChatFeedAPI'](_0x207588)),_0x38afd9(_0x3e5d9a,_0x5a97fd);});}['addCurrentDocumentToChatContext'](){Cs(this['context'])['length']&&this['activeConversation']?.['addCurrentDocumentToContext'](Mi(this['context']['locale'],'AI_CHAT_CONTEXT_CURRENT_DOCUMENT'));}async['addSelectionToChatContext'](_0x47cf4b){const _0x1a2ca5=this['_aiEditing']['getSelectionText'](_0x47cf4b);this['activeConversation']?.['addSelectionToContext'](_0x1a2ca5),this['addCurrentDocumentToChatContext']();}['removeSelectionFromChatContext'](){this['activeConversation']?.['removeSelectionFromContext']();}['focusPromptInput'](){this['_aiChatUi']['focusPromptInput']();}async['startConversation'](_0x4b389e){await this['_startConversationSafely']({'modelId':_0x4b389e?.['modelId']});}async['sendMessage'](_0x444c8b){await this['_handleUIUserMessage'](_0x444c8b);}['getGroupId'](){const _0x3b5b8a=this['context']['config']['get']('collaboration.channelId');if(!_0x3b5b8a)throw new ht('ai-missing-channel-id',this);return _0x3b5b8a;}['_handleRemovedConversation'](_0xffc698){this['activeConversation']['id']===_0xffc698&&this['_startConversationSafely']();}['_insertSuggestion'](_0x5c77a2){const _0x592426=this['context']['plugins']['get'](_0x4fc25b),{reply:_0x4f391e,interaction:_0x32d88e}=this['getInteractionAndReplyById'](_0x5c77a2['replyId']),_0x4856c7=void 0x0!==_0x5c77a2['partIndex']?[_0x4f391e['changeGroups'][_0x5c77a2['partIndex']]]:_0x4f391e['changeGroups']['filter'](_0x207cfc=>'pending'==_0x207cfc['state']);_0x4856c7['map'](_0x3eb458=>_0x4f391e['changeGroups']['indexOf'](_0x3eb458))['forEach'](_0x567309=>{const _0x3c141a=this['_getDocumentRangeForReplyChanges'](_0x5c77a2['replyId'],_0x567309);_0x3c141a&&'$graveyard'!=_0x3c141a['range']['root']['rootName']?(_0x4f391e['setChangeGroupState'](_0x567309,'accepted'),void 0x0!==_0x5c77a2['partIndex']&&this['_scrollToSuggestionRange'](_0x3c141a['range'],!0x1,_0x3c141a['targetEditor'])):_0x4f391e['setChangeGroupState'](_0x567309,'outdated');});const _0x762457={},_0x41511d=_0x4856c7['reduce']((_0x1f0ca5,_0x3d1c4d)=>('outdated'===_0x3d1c4d['state']||(_0x1f0ca5[_0x3d1c4d['documentId']]=[..._0x1f0ca5[_0x3d1c4d['documentId']]||[],_0x3d1c4d],_0x762457[_0x3d1c4d['documentId']]=[..._0x762457[_0x3d1c4d['documentId']]||[],_0x4f391e['changeGroups']['indexOf'](_0x3d1c4d)]),_0x1f0ca5),{});for(const [_0x2a0bf0,_0x3b062e]of Object['entries'](_0x41511d)){const _0x492171=_0x3b062e[0x0]['editor'];if(!_0x492171['plugins']['has']('TrackChanges')){wt('ai-no-track-changes',{'editor':_0x492171});continue;}const _0x2a91f1=ps({'reply':_0x4f391e,'interaction':_0x32d88e,'groups':_0x3b062e,'transform':!0x0,'documentCompare':_0x592426,'documentCompareOptions':{'anchor':_0x3b062e[0x0]['rootName'],'markDeletions':!0x0}});let _0x1636d9;_0x492171['model']['change'](_0x470825=>{_0x1636d9=_0x470825['batch'],_0x492171['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x2a91f1),this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['_batchToChanges']['set'](_0x1636d9,{'interactionId':_0x32d88e['id'],'replyId':_0x4f391e['id'],'indexes':_0x762457[_0x2a0bf0]});}this['_updateRatings'](_0x4f391e);}['_applySuggestion'](_0x512c96){const _0x47ecff=this['context']['plugins']['get'](_0x4fc25b),{reply:_0x110c59,interaction:_0x12c954}=this['getInteractionAndReplyById'](_0x512c96['replyId']),_0x20282a=void 0x0!==_0x512c96['partIndex']?[_0x110c59['changeGroups'][_0x512c96['partIndex']]]:_0x110c59['changeGroups']['filter'](_0x22b602=>'pending'==_0x22b602['state']);_0x20282a['map'](_0x5da247=>_0x110c59['changeGroups']['indexOf'](_0x5da247))['forEach'](_0x484c6d=>{const _0x27fa3c=this['_getDocumentRangeForReplyChanges'](_0x512c96['replyId'],_0x484c6d);_0x27fa3c&&'$graveyard'!=_0x27fa3c['range']['root']['rootName']?(_0x110c59['setChangeGroupState'](_0x484c6d,'accepted'),void 0x0!==_0x512c96['partIndex']&&this['_scrollToSuggestionRange'](_0x27fa3c['range'],!0x1,_0x27fa3c['targetEditor'])):_0x110c59['setChangeGroupState'](_0x484c6d,'outdated');});const _0x2b554c={},_0x43768e=_0x20282a['reduce']((_0x5e6791,_0x20dcbb)=>('outdated'===_0x20dcbb['state']||(_0x5e6791[_0x20dcbb['documentId']]=[..._0x5e6791[_0x20dcbb['documentId']]||[],_0x20dcbb],_0x2b554c[_0x20dcbb['documentId']]=[..._0x2b554c[_0x20dcbb['documentId']]||[],_0x110c59['changeGroups']['indexOf'](_0x20dcbb)]),_0x5e6791),{});for(const [_0x350692,_0x5b6f3a]of Object['entries'](_0x43768e)){const _0x127098=ps({'reply':_0x110c59,'interaction':_0x12c954,'groups':_0x5b6f3a,'transform':!0x0,'documentCompare':_0x47ecff,'documentCompareOptions':{'anchor':_0x5b6f3a[0x0]['rootName'],'markDeletions':!0x1}});let _0xc16566;const _0x54dd90=_0x5b6f3a[0x0]['editor'];_0x54dd90['model']['change'](_0x315d0f=>{_0xc16566=_0x315d0f['batch'];for(const _0x479657 of _0x127098)_0x479657['baseVersion']=_0x54dd90['model']['document']['version'],Es(_0x54dd90,_0x479657),_0x315d0f['batch']['addOperation'](_0x479657),_0x54dd90['model']['applyOperation'](_0x479657);}),this['_batchToChanges']['set'](_0xc16566,{'interactionId':_0x12c954['id'],'replyId':_0x110c59['id'],'indexes':_0x2b554c[_0x350692]});}this['_updateRatings'](_0x110c59);}['_rejectSuggestion'](_0xd40fb){const {reply:_0x3ea414}=this['getInteractionAndReplyById'](_0xd40fb['replyId']);_0x3ea414['setChangeGroupState'](_0xd40fb['partIndex'],'rejected');}['_openBalloonFor'](_0x5ecd17,_0x46a6ed){if(!this['_hasAIChatBalloon'])return;const {reply:_0x3d5f4f}=this['getInteractionAndReplyById'](_0x5ecd17),_0x39bfcd=_0x3d5f4f['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff']});if(!_0x39bfcd['length'])return;let _0x58a1e6,_0x1c5d9b;if(void 0x0!==_0x46a6ed?(_0x1c5d9b=_0x39bfcd['find'](_0x3e4cf5=>_0x3e4cf5['index']==_0x46a6ed),_0x58a1e6=_0x1c5d9b?.['index']):(_0x1c5d9b=_0x39bfcd[0x0],_0x58a1e6=_0x1c5d9b['index']),!_0x1c5d9b)return void _0x3d5f4f['setChangeGroupState'](_0x46a6ed??0x0,'outdated');if(this['_currentPreviewedChangeGroup']?.['replyId']==_0x5ecd17&&this['_currentPreviewedChangeGroup']?.['partIndex']==_0x58a1e6)return;const _0x108dbb=this['_getUserPresentableContentPartDocumentRange'](_0x5ecd17,_0x3d5f4f,_0x1c5d9b),_0x579ab7=_0x3d5f4f['changeGroups']['find'](_0x49a471=>_0x49a471['index']==_0x58a1e6)['editor'],_0x1e5066=_0x579ab7['plugins']['get']('AIChatBalloon');if(this['_activeBalloon']&&this['_activeBalloon']!==_0x1e5066&&this['_activeBalloon']['close'](),!_0x108dbb)return _0x1e5066['close'](),void(this['_activeBalloon']=void 0x0);this['_activeBalloon']=_0x1e5066,this['_currentPreviewedChangeGroup']={'replyId':_0x5ecd17,'partIndex':_0x58a1e6},this['_scrollToSuggestionRange'](_0x108dbb,!0x0,_0x579ab7);const _0x41c328=this['_getPresentableSiblingContentPartIndex'](_0x5ecd17,_0x58a1e6,'next');_0x1e5066['clearContent'](),_0x1e5066['updateContent']({'part':_0x1c5d9b,'renderingStrategy':'static'}),_0x1e5066['open']({'index':_0x58a1e6,'title':Mi(this['context']['locale'],'AI_BALLOON_HEADER_TITLE',(_0x58a1e6+0x1)['toString']()),'showRotator':null!==_0x41c328,'ranges':[_0x108dbb],'areActionsDisabled':_0x3d5f4f['areActionsDisabled'],'targetEditor':_0x579ab7}),_0x1e5066['setState']('pending'),this['_aiChatUi']['scrollFeedToSuggestion'](_0x5ecd17,_0x58a1e6),this['_aiChatUi']['setFeedItemAIReplySuggestionPartActive']({'id':_0x5ecd17,'index':_0x58a1e6,'isActive':!0x0});}['_closeActiveBalloon'](){this['_activeBalloon']?.['close'](),this['_activeBalloon']=void 0x0,this['_currentPreviewedChangeGroup']=null;}['_getPresentableSiblingContentPartIndex'](_0x4c4f3a,_0x22971f,_0x23c15f){const {reply:_0x5451e5}=this['getInteractionAndReplyById'](_0x4c4f3a),_0x8262ef=_0x5451e5['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff']});if(0x1==_0x8262ef['length'])return null;const _0x199291='next'==_0x23c15f?0x1:-0x1;function _0x42231a(_0x42081d){const _0x3a28ff=(_0x42081d+_0x199291+_0x8262ef['length'])%_0x8262ef['length'];return{'siblingIndex':_0x3a28ff,'siblingPart':_0x8262ef[_0x3a28ff]};}const _0x25d6c9=_0x8262ef['findIndex'](_0x5d9522=>_0x5d9522['index']==_0x22971f);let {siblingIndex:_0x2a76b5,siblingPart:_0x3a638a}=_0x42231a(_0x25d6c9);for(;!this['_getUserPresentableContentPartDocumentRange'](_0x4c4f3a,_0x5451e5,_0x3a638a);)if({siblingIndex:_0x2a76b5,siblingPart:_0x3a638a}=_0x42231a(_0x2a76b5),_0x2a76b5===_0x25d6c9)return null;return _0x3a638a['index'];}['_getUserPresentableContentPartDocumentRange'](_0x5b672f,_0x342be9,_0x5d4fdf){const _0x48da6f=_0x342be9['changeGroups'];if(!_0x5d4fdf['hasChanges'])return null;const _0xc5ba48=_0x48da6f['find'](_0x338110=>_0x338110['index']==_0x5d4fdf['index']);if('pending'!==_0xc5ba48?.['state'])return null;if('destroyed'===_0xc5ba48?.['editor']['state'])return _0x342be9['setChangeGroupState'](_0x5d4fdf['index'],'outdated'),null;const _0x5f5603=this['_getDocumentRangeForReplyChanges'](_0x5b672f,_0x5d4fdf['index']);if(!_0x5f5603)return _0x342be9['setChangeGroupState'](_0x5d4fdf['index'],'outdated'),null;const {range:_0x2682cb,currentIndex:_0x33108d}=_0x5f5603;return'$graveyard'==_0x2682cb['root']['rootName']?(_0x342be9['setChangeGroupState'](_0x33108d,'outdated'),null):_0x5f5603['range'];}['_getDocumentRangeForReplyChanges'](_0xf3d078,_0x4aea97){const {reply:_0x582d9b,interaction:_0x513a76}=this['getInteractionAndReplyById'](_0xf3d078),_0x574c1b=_0x582d9b['changeGroups']['filter'](_0x920c9=>'pending'==_0x920c9['state']),_0x496dfc=_0x574c1b['map'](_0x18db16=>_0x582d9b['changeGroups']['indexOf'](_0x18db16));void 0x0===_0x4aea97&&(_0x4aea97=_0x496dfc[0x0]);const _0x2db34f=_0x496dfc['indexOf'](_0x4aea97);if(-0x1==_0x2db34f)return null;const _0x3c4562=_0x574c1b[_0x2db34f],_0x45bb5d=_0x3c4562['editor'];if('destroyed'===_0x45bb5d['state'])return null;const _0x3356e3=_0x582d9b['documentContextContent']['get'](_0x3c4562['documentId']),_0x5b6811=new _0x69aef6([]),_0x24b186=new _0x69aef6([]);for(const _0x47587c of _0x3c4562['changes'])if('removed'!=_0x47587c['type']&&_0x24b186['children']['push'](_0x47587c['node']['cloneNode'](!0x0)),'new'!=_0x47587c['type']){const _0x1af9fd=_0x4f4d32(_0x11ef51=>Xi(_0x11ef51,'data-id')==_0x47587c['id'],_0x3356e3,!0x0);_0x5b6811['children']['push'](_0x1af9fd['cloneNode'](!0x0));}if(0x0==_0x5b6811['children']['length']){if(_0x3c4562['changes'][0x0]['anchorId']){const _0x1e20ec=Yi('data-id',_0x3c4562['changes'][0x0]['anchorId'],_0x3356e3);_0x5b6811['children']['unshift'](_0x1e20ec['cloneNode'](!0x0)),_0x24b186['children']['unshift'](_0x1e20ec['cloneNode'](!0x0)),_0x1e20ec['nextSibling']&&(_0x5b6811['children']['push'](_0x1e20ec['nextSibling']['cloneNode'](!0x0)),_0x24b186['children']['push'](_0x1e20ec['nextSibling']['cloneNode'](!0x0)));}else{const _0x86aaaa=_0x3356e3['children'][0x0];if(!_0x86aaaa)return null;_0x5b6811['children']['push'](_0x86aaaa['cloneNode'](!0x0)),_0x24b186['children']['push'](_0x86aaaa['cloneNode'](!0x0));}}const _0x54e35b=_0x513a76['getDocumentContext'](),_0x2dc532=_0x54e35b['content']||_0x54e35b['documents']['find'](_0x4b10cf=>_0x4b10cf['id']==_0x3c4562['documentId'])['content'],_0x51b606=_0x45bb5d['model']['document']['getRoot'](_0x3c4562['rootName']),_0x3139c2=_0x45bb5d['data']['parse'](_0x2dc532,_0x51b606),_0x284756=Ki(_0x5b6811),_0x41424b=_0x45bb5d['data']['parse'](_0x284756,_0x51b606),_0xf67d19=_0x45bb5d['data']['parse'](_0x284756,_0x51b606),_0x2950a0=_0x45bb5d['model']['createPositionAt'](_0x41424b,0x0),_0x1c1a8a=Ki(_0x24b186),_0x917c56={'targetEditor':_0x45bb5d,'anchor':_0x2950a0,'markDeletions':!0x1},_0x34095a=_0x45bb5d['plugins']['get'](_0x4fc25b)['getDiff'](_0x284756,_0x1c1a8a,_0x917c56)['getOperations']();if(!_0x34095a['length'])return null;_0x45bb5d['model']['change'](_0x436de9=>{for(const _0x18f3da of _0x34095a)if('remove'==_0x18f3da['type']){const _0x33bdc8=_0x18f3da['sourcePosition'],_0x38a3e8=_0x18f3da['howMany'],_0x217c28=new _0x389353(_0x33bdc8,_0x38a3e8);_0x436de9['batch']['addOperation'](_0x217c28),_0x45bb5d['model']['applyOperation'](_0x217c28);}else'marker'!==_0x18f3da['type']&&(_0x18f3da['baseVersion']=null,_0x18f3da['isDocumentOperation']=!0x1,_0x436de9['batch']['addOperation'](_0x18f3da),_0x45bb5d['model']['applyOperation'](_0x18f3da));});const _0x410417=hs(_0x45bb5d,_0x34095a,_0x41424b);ls(_0x45bb5d['model'],_0x410417);const _0x2d4382=_0x410417['getFirstRange']()['start']['path']['slice'](),_0x209847=_0x410417['getFirstRange']()['end']['path']['slice'](),_0x5d7741=[];let _0x473c5d=_0x41424b,_0x289405=_0xf67d19;for(let _0x30aa61=0x0;_0x30aa61<_0x209847['length'];_0x30aa61++){const _0x47043c=_0x473c5d['maxOffset']-_0x209847[_0x30aa61];_0x5d7741[_0x30aa61]=_0x289405['maxOffset']-_0x47043c,_0x473c5d=_0x473c5d['getChildAtOffset'](_0x209847[_0x30aa61]),_0x289405=_0x289405['getChildAtOffset'](_0x5d7741[_0x30aa61]);}const _0x390ed1=_0x45bb5d['model']['createRange'](_0x45bb5d['model']['createPositionFromPath'](_0xf67d19,_0x2d4382),_0x45bb5d['model']['createPositionFromPath'](_0xf67d19,_0x5d7741)),_0x5eb12f=_0xf67d19['getChild'](0x0)['getAttribute'](_0x4beb10),_0x369cae=Array['from'](_0x3139c2['getChildren']())['find'](_0x595db0=>_0x595db0['getAttribute'](_0x4beb10)==_0x5eb12f)['getPath'](),_0x5e3555=_0x390ed1['start']['path']['slice'](),_0x27f38b=_0x390ed1['end']['path']['slice']();_0x5e3555[0x0]=_0x369cae[0x0]+_0x5e3555[0x0],_0x27f38b[0x0]=_0x369cae[0x0]+_0x27f38b[0x0];let _0x2cce9c=_0x45bb5d['model']['createRange'](_0x45bb5d['model']['createPositionFromPath'](_0x45bb5d['model']['document']['getRoot'](_0x3c4562['rootName']),_0x5e3555),_0x45bb5d['model']['createPositionFromPath'](_0x45bb5d['model']['document']['getRoot'](_0x3c4562['rootName']),_0x27f38b));const _0x355b40=_0x54e35b['documents']['find'](_0x684c9a=>_0x684c9a['id']==_0x3c4562['documentId'])['version'],_0x2888b8=_0x45bb5d['model']['document']['history']['getOperations'](_0x355b40);for(const _0x55f44f of _0x2888b8)_0x2cce9c=_0x2173cf['_createFromRanges'](_0x2cce9c['getTransformedByOperation'](_0x55f44f));return{'range':_0x2cce9c,'currentIndex':_0x4aea97,'targetEditor':_0x45bb5d};}['_integrateEditorBalloon'](_0x582fd5){if(!_0x582fd5['plugins']['has']('AIChatBalloon'))return;const _0x4b98af=_0x582fd5['plugins']['get']('AIChatBalloon');this['_hasAIChatBalloon']=!0x0,_0x4b98af['bind']('showDiff')['to'](this,'_aiChatBalloonShowDiff'),this['listenTo'](_0x4b98af,'toggleSuggestionDisplayMode',()=>{const {replyId:_0x563df4,partIndex:_0x17e1d9}=this['_currentPreviewedChangeGroup'];this['_aiChatBalloonShowDiff']=!this['_aiChatBalloonShowDiff'];const {reply:_0x5ccdbc}=this['getInteractionAndReplyById'](_0x563df4),_0x34a06b=_0x5ccdbc['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff'],'groupIndex':_0x17e1d9});_0x4b98af['updateContent']({'part':_0x34a06b[0x0],'renderingStrategy':'static','keepErrors':!0x0});}),this['listenTo'](_0x4b98af,'applySuggestion',()=>{const {replyId:_0x4fd77c,partIndex:_0x1b67e9}=this['_currentPreviewedChangeGroup'];this['_applySuggestion']({'replyId':_0x4fd77c,'partIndex':_0x1b67e9}),_0x4b98af['setState']('accepted');}),this['listenTo'](_0x4b98af,'insertSuggestion',()=>{const {replyId:_0x1c448d,partIndex:_0x2fe001}=this['_currentPreviewedChangeGroup'];this['_insertSuggestion']({'replyId':_0x1c448d,'partIndex':_0x2fe001}),_0x4b98af['setState']('accepted');}),this['listenTo'](_0x4b98af,'rejectSuggestion',()=>{const {replyId:_0xfdaa9f,partIndex:_0x4d63e2}=this['_currentPreviewedChangeGroup'];this['_rejectSuggestion']({'replyId':_0xfdaa9f,'partIndex':_0x4d63e2}),_0x4b98af['setState']('rejected');}),this['listenTo'](_0x4b98af,'showNext',()=>{const {replyId:_0x3c1cf3,partIndex:_0x526d45}=this['_currentPreviewedChangeGroup'],_0x4893cc=this['_getPresentableSiblingContentPartIndex'](_0x3c1cf3,_0x526d45,'next');null!==_0x4893cc&&this['_openBalloonFor'](_0x3c1cf3,_0x4893cc);}),this['listenTo'](_0x4b98af,'showPrevious',()=>{const {replyId:_0x3cc45e,partIndex:_0xa111cd}=this['_currentPreviewedChangeGroup'],_0xf51c31=this['_getPresentableSiblingContentPartIndex'](_0x3cc45e,_0xa111cd,'previous');null!==_0xf51c31&&this['_openBalloonFor'](_0x3cc45e,_0xf51c31);}),this['listenTo'](_0x4b98af,'dialogClosed',(_0x7368f7,{id:_0x585b3a})=>{if('aiChatBalloon'!==_0x585b3a)return;const {replyId:_0x583a02,partIndex:_0x350ea8}=this['_currentPreviewedChangeGroup'];this['_currentPreviewedChangeGroup']=null,this['_aiChatUi']['setFeedItemAIReplySuggestionPartActive']({'id':_0x583a02,'index':_0x350ea8,'isActive':!0x1}),this['_activeBalloon']===_0x4b98af&&(this['_activeBalloon']=void 0x0);});}['_integrateEditor'](_0x5d056e){if(this['_channelsToEditors']['set'](_0x5d056e['config']['get']('collaboration.channelId'),_0x5d056e),this['_integrateEditorBalloon'](_0x5d056e),this['addCurrentDocumentToChatContext'](),_0x5d056e['once']('destroy',()=>{this['_checkRemoveCurrentDocumentFromChatContext']();}),_0x5d056e['plugins']['has']('Undo')){const _0x2f049d=_0x5d056e['commands']['get']('undo'),_0x3b0596=_0x5d056e['commands']['get']('redo');this['listenTo'](_0x2f049d,'revert',(_0x554d26,_0x54e11e,_0x2d50fe)=>{const _0x1ecbbf=this['_batchToChanges']['get'](_0x54e11e);if(!_0x1ecbbf)return;const _0xfbed97=this['activeConversation']['getInteraction'](_0x1ecbbf['interactionId']),_0x27f7a4=_0xfbed97?.['getReply'](_0x1ecbbf['replyId']);this['_batchToChanges']['delete'](_0x54e11e),_0xfbed97&&_0x27f7a4&&(_0x1ecbbf['indexes']['forEach'](_0x2a8273=>_0x27f7a4['setChangeGroupState'](_0x2a8273,'pending')),this['_batchToChanges']['set'](_0x2d50fe,_0x1ecbbf));}),this['listenTo'](_0x3b0596,'revert',(_0x311cd2,_0x4aba19,_0x5d9814)=>{const _0x79ccd3=this['_batchToChanges']['get'](_0x4aba19);if(!_0x79ccd3)return;const _0xf1fe07=this['activeConversation']['getInteraction'](_0x79ccd3['interactionId']),_0x5cc621=_0xf1fe07?.['getReply'](_0x79ccd3['replyId']);this['_batchToChanges']['delete'](_0x4aba19),_0xf1fe07&&_0x5cc621&&(_0x79ccd3['indexes']['forEach'](_0x35426b=>_0x5cc621['setChangeGroupState'](_0x35426b,'accepted')),this['_batchToChanges']['set'](_0x5d9814,_0x79ccd3));});}const _0x86bb63=_0x5d056e['config']['get']('ai.chat.context');_0x86bb63['alwaysAddSelection']&&_0x86bb63['document']['enabled']&&this['listenTo'](_0x5d056e['model']['document']['selection'],'change:range',(_0x1c9879,_0x3cfede)=>{if(!_0x3cfede['directChange'])return;'chat'===_0x5d056e['plugins']['get']('AITabs')['view']['activeTab']&&(_0x5d056e['model']['hasContent'](_0x5d056e['model']['document']['selection'])?this['addSelectionToChatContext'](_0x5d056e):this['removeSelectionFromChatContext']());});}async['_getLastCreatedConversationId'](){const _0x1d4b7f=this['_aiConnector']['fetchConversations'](this['getGroupId'](),{'limit':0x1,'sortBy':'createdAt'});try{const _0x106d15=await _0x1d4b7f['getConversations']();return _0x106d15['length']?_0x106d15[0x0]['id']:'new';}catch(_0x30d3a1){return this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION'),'id':at()}),this['_logError'](new ht('ai-chat-conversation-init-failed',this,{'error':_0x30d3a1})),this['_aiChatUi']['toggleLoadingSkeleton'](!0x1),this['_aiChatUi']['disableControls'](),null;}}async['_startConversationSafely'](_0x2b0bee={}){this['set']('isConversationReady',!0x1);try{await this['_handleStartConversation'](_0x2b0bee);}catch(_0x1e25a6){this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_UNABLE_TO_START_CONVERSATION'),'id':_0x2b0bee['id']||at()}),console['error'](_0x1e25a6),this['activeConversation']=void 0x0,this['_aiChatUi']['disableControls']();}}async['_handleStartConversation']({id:_0x5ac251,modelId:_0x1a4f33}={}){this['_closeActiveBalloon']();let _0x17763c=_0x1a4f33;_0x17763c||(_0x5ac251||!this['activeConversation']?_0x17763c=this['context']['config']['get']('ai.models.defaultModelId'):this['_aiChatUi']['isModelAvailable']&&(_0x17763c=this['activeConversation']['selectedModel']['id'])),this['activeConversation']&&this['stopListening'](this['activeConversation']),await this['_stopLastInteraction']();const _0x4f1b4d=this['getGroupId'](),_0x50d74b=_0x5ac251||at();let _0x5bcb1c;this['activeConversation']=new AIChatConversation({'connector':this['_aiConnector'],'chatModels':this['_aiChatModels'],'selectedModelId':_0x17763c,'conversationId':_0x50d74b,'group':_0x4f1b4d,'locale':this['context']['locale'],'isFromHistory':!!_0x5ac251,'channelsToEditors':this['_channelsToEditors'],'getSessionId':_0x2267cf=>this['_aiEditing']['getSessionId'](_0x2267cf)}),this['activeConversation']['delegate']('toolDataReceived','interactionCreated','interactionStarted','replyCreated')['to'](this),this['listenTo'](this['activeConversation'],'conversationInitialized',(_0x5d9d67,_0x3bf397)=>{this['_aiChatUi']['createConversation'](_0x3bf397),this['_aiChatUi']['resetMessageInput'](),this['_aiChatUi']['clearPendingContextUI'](),this['_aiChatUi']['clearConversationContextUI'](),_0x5ac251||(this['_aiChatUi']['resetConversationTitle'](),this['addCurrentDocumentToChatContext']());}),this['listenTo'](this['activeConversation'],'uploadProgressChanged',(_0x1ac989,_0x5f5a38)=>{this['_aiChatUi']['setIsUploadInProgress'](_0x5f5a38['isUploadInProgress']);}),this['listenTo'](this['activeConversation'],'webSearchStarted',()=>{const _0x17fc12=this['_aiChatUi']['prepareLoadingMessage']({'isWebSearchEnabled':!0x0,'isReasoningEnabled':!0x1});this['_aiChatUi']['setLoadingMessage'](_0x17fc12);}),this['listenTo'](this['activeConversation'],'reasoningStarted',()=>{const _0x55d573=this['_aiChatUi']['prepareLoadingMessage']({'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x0});this['_aiChatUi']['setLoadingMessage'](_0x55d573);}),this['listenTo'](this['activeConversation'],'webSearchFinished',(_0x5a5c7e,_0x269f7e)=>{this['_aiChatUi']['addFeedInteractionHeader'](_0x269f7e,{'isWebSearchEnabled':!0x0,'isReasoningEnabled':!0x1});}),this['listenTo'](this['activeConversation'],'reasoningFinished',(_0x2ce7fe,_0x3b08c1)=>{this['_aiChatUi']['addFeedInteractionHeader'](_0x3b08c1,{'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',(_0x2c25c0,_0xdb9e55)=>{this['_aiChatUi']['removeFeedInteraction'](_0xdb9e55['id']);}),this['listenTo'](this['activeConversation'],'setConversationTitle',(_0x238101,_0x3a88fe,_0x54c318)=>{this['_updateConversationTitle'](_0x3a88fe,_0x54c318);}),this['listenTo'](this['activeConversation'],'replyContentUpdated',async(_0xf4566d,_0x40b120)=>{void 0x0!==_0x5bcb1c&&_0x5bcb1c!==_0x40b120['id']&&this['_updateReplyContentThrottled']['flush'](),_0x5bcb1c=_0x40b120['id'],_0x40b120['isFromHistory']?await this['_updateReplyContent']({'reply':_0x40b120}):await this['_updateReplyContentThrottled']({'reply':_0x40b120});}),this['listenTo'](this['activeConversation'],'replyChangeGroupStateUpdated',(_0x131dad,{reply:_0x544e9d,index:_0x505c38,state:_0xaf69e1})=>{this['_aiChatUi']['updateFeedItemAIReplySuggestionPartState']({'id':_0x544e9d['id'],'index':_0x505c38,'state':_0xaf69e1}),this['_currentPreviewedChangeGroup']?.['replyId']['includes'](_0x544e9d['id'])&&this['_currentPreviewedChangeGroup']?.['partIndex']==_0x505c38&&this['_activeBalloon']?.['setState'](_0xaf69e1);}),this['listenTo'](this['activeConversation'],'contextItemAdded',(_0xa0a962,_0x1fa4bc)=>{if(this['_aiChatUi']['addContextItem'](_0x1fa4bc['contextItem'],_0x1fa4bc['isLoading']),'selection'===_0x1fa4bc['contextItem']['type']){const _0x26e84b=ms(this['context']),_0x21635c=[..._0x26e84b['model']['document']['selection']['getRanges']()];this['_aiEditing']['showFakeVisualSelection']({'editor':_0x26e84b,'ranges':_0x21635c,'id':'context','priority':0x1});}}),this['listenTo'](this['activeConversation'],'contextItemRemoved',(_0x491ecf,_0x58afd7)=>{this['_aiChatUi']['removeContextItem'](_0x58afd7['uiId']),'current-document'==_0x58afd7['uiId']&&this['removeSelectionFromChatContext'](),'selection'===_0x58afd7['type']&&this['_aiEditing']['hideFakeVisualSelection']('context');}),this['listenTo'](this['activeConversation'],'contextItemLoadingEnded',(_0x3264dd,_0xf06580)=>{this['_aiChatUi']['setContextItemLoading'](_0xf06580['contextItem']['uiId'],_0xf06580['isLoading']);}),this['listenTo'](this['activeConversation'],'contextSent',(_0x4f40fb,_0x35c45a)=>{this['_aiChatUi']['setConversationContext'](_0x35c45a['contextItems']);}),this['listenTo'](this['activeConversation'],'addContextOptionsChanged',(_0x4e235e,_0x54eb27)=>{this['_aiChatUi']['setAddContextOptions'](_0x54eb27['options']);}),this['listenTo'](this['activeConversation'],'sourceResourcesLoaded',(_0x5d8e3a,_0x19ff0c)=>{this['_aiChatUi']['populateSourceResourceBalloon'](_0x19ff0c['sourceId'],_0x19ff0c['source'],_0x19ff0c['resources'],_0x19ff0c['uid']);}),this['listenTo'](this['activeConversation'],'resourceStateChanged',(_0x7fbf70,_0x4206ee)=>{this['_aiChatUi']['updateResourceState'](_0x4206ee['sourceId'],_0x4206ee['resourceId'],_0x4206ee['isInContext']);}),this['listenTo'](this['activeConversation'],'capabilitiesUpdated',(_0x77c010,_0x3876dc)=>{this['_aiChatUi']['updateCapabilities'](_0x3876dc);}),this['listenTo'](this['activeConversation'],'modelSelected',async(_0x2d8c33,_0x57a148)=>{const _0x154bdb=(await this['_aiChatModels']['getAll']())['find'](_0x330c96=>_0x330c96['id']===_0x57a148['selectedModel']?.['id'])||null;this['_aiChatUi']['setSelectedModel'](_0x154bdb,_0x57a148['isDisabled']);}),this['listenTo'](this['activeConversation'],'error',(_0x3ed075,{error:_0x45ead5,interactionId:_0x37f229,fileName:_0x31e18c,url:_0x5e722a,sourceId:_0x4fc89d,sourceLabel:_0xe063c3})=>{const _0x42661a=_0x37f229?_0x37f229+':'+at():at();_0x45ead5['message']['startsWith']('ai-request-aborted')?this['_aiChatUi']['addFeedItemStaticMessage']({'staticMessage':Mi(this['context']['locale'],'AI_CHAT_ABORTED_MESSAGE'),'id':_0x42661a}):_0x45ead5['message']['startsWith']('ai-chat-conversation-init-failed')||_0x45ead5['message']['startsWith']('ai-chat-conversation-start-failed')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_UNABLE_TO_START_CONVERSATION'),'id':_0x42661a}),this['_logError'](_0x45ead5)):_0x45ead5['message']['startsWith']('ai-chat-file-upload-failed')?this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_FILE',_0x31e18c),'id':_0x42661a}):_0x45ead5['message']['startsWith']('ai-chat-url-upload-failed')?this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_URL',_0x5e722a),'id':_0x42661a}):_0x45ead5['message']['startsWith']('ai-chat-context-invalid-data')?this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_INVALID_DATA'),'id':_0x42661a}):_0x45ead5['message']['startsWith']('ai-chat-context-unsupported-type')?this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_UNSUPPORTED_TYPE'),'id':_0x42661a}):_0x45ead5['message']['startsWith']('ai-chat-source-resources-load-failed')?(_0x4fc89d&&this['_aiChatUi']['closeSourceResourceBalloon'](_0x4fc89d),this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_LOAD_RESOURCES',_0xe063c3||'source'),'id':_0x42661a}),this['_logError'](_0x45ead5)):_0x45ead5['message']['startsWith']('ai-chat-resource-load-failed')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_RESOURCE_LOAD_FAILED'),'id':_0x42661a}),this['_logError'](_0x45ead5)):_0x45ead5['message']['startsWith']('ai-chat-invalid-request')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_INVALID_REQUEST'),'id':_0x42661a}),this['_logError'](_0x45ead5)):_0x45ead5['message']['startsWith']('ai-chat-context-unsupported-file-type')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_UNSUPPORTED_FILE_TYPE'),'id':_0x42661a}),this['_logError'](_0x45ead5)):_0x45ead5['message']['startsWith']('ai-chat-context-file-too-large')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_FILE_TOO_LARGE'),'id':_0x42661a}),this['_logError'](_0x45ead5)):_0x45ead5['message']['startsWith']('ai-chat-context-file-too-many-pages')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_FILE_TOO_MANY_PAGES'),'id':_0x42661a}),this['_logError'](_0x45ead5)):_0x45ead5['message']['startsWith']('ai-chat-context-form-data-size-limits-exceeded')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_FORM_DATA_SIZE_LIMITS_EXCEEDED'),'id':_0x42661a}),this['_logError'](_0x45ead5)):(this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_GENERIC_ERROR'),'id':_0x42661a}),this['_logError'](_0x45ead5));}),await this['activeConversation']['init'](this['context']['config']['get']('ai.chat.context')),_0x5ac251||(await this['activeConversation']['start'](),this['_aiChatUi']['enableControls']()),this['set']('isConversationReady',!0x0);}async['_handleUIUserMessage']({message:_0x39f3b,attributes:_0x5bfefc}){if(!this['activeConversation'])throw new ht('ai-chat-controller-no-active-conversation');if(this['activeConversation']['isCurrentDocumentInContext']()){const _0x41369f=await this['_aiEditing']['getDocumentData']();await this['activeConversation']['updateCurrentDocumentsInContext'](_0x41369f);}this['activeConversation']['id']&&this['activeConversation']['isStarted']&&await this['activeConversation']['handleUserInteraction']({'userMessage':_0x39f3b,'attributes':_0x5bfefc});}['_logError'](_0x2b445c){Ct(_0x2b445c['message'],_0x2b445c['data']);}['_removeFromContext'](_0x4644d9){this['activeConversation']?.['removeFromContext'](_0x4644d9);}['_toggleWebSearch'](){this['activeConversation']?.['toggleWebSearch']();}['_toggleReasoning'](){this['activeConversation']?.['toggleReasoning']();}['getInteractionAndReplyById'](_0x42d254){const [_0x1949ca,_0x38aa0a]=_0x42d254['split'](':'),_0x41872f=this['activeConversation']['getInteraction'](_0x1949ca),_0x143343=_0x41872f['getReply'](_0x38aa0a);return{'interaction':_0x41872f,'reply':_0x143343};}['_scrollToSuggestionRange'](_0x59d81b,_0x5212a9=!0x1,_0x4e084f){const _0x1fcaf8={'target':_0x4e084f['editing']['view']['domConverter']['viewRangeToDom'](_0x4e084f['editing']['mapper']['toViewRange'](_0x59d81b)),'viewportOffset':{'top':0x96,'left':0x0,'bottom':0x32,'right':0x0},'ancestorOffset':0x14,'alignToTop':_0x5212a9};_0x5212a9&&(_0x1fcaf8['alignToTop']=!0x0),Tt(_0x1fcaf8);}['_updateConversationTitle'](_0x4eba1e,_0x4d98fd=!0x1){this['_aiChatUi']['setConversationTitle'](_0x4eba1e||Mi(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION'),_0x4d98fd);}['_addFeedItemReply'](_0xdfadda){'text'===_0xdfadda['type']?this['_aiChatUi']['addFeedItemAIReply'](_0xdfadda):this['_aiChatUi']['addFeedItemAISuggestion'](_0xdfadda);}async['_updateReplyContent']({reply:_0x3bcc3a,renderingStrategy:_0x42268a}){const {id:_0x898849,interactionId:_0x288fe6,isDone:_0x430758,type:_0x55c023,parsedContent:_0xf22484}=_0x3bcc3a,_0x2b9a44=_0x288fe6+':'+_0x898849;if('modification'===_0x55c023){const _0x5e2f0a=_0x3bcc3a['getContentParts']({'showDiff':this['_aiChatUi']['showDiff']});await this['_aiChatUi']['updateFeedItemAIReplySuggestionContent']({'id':_0x2b9a44,'parts':_0x5e2f0a,'isDone':_0x430758,'skipLoadingEffects':_0x3bcc3a['isFromHistory']});}else'text'===_0x55c023&&await this['_aiChatUi']['updateFeedItemAIReplyContent']({'id':_0x2b9a44,'parsedContent':_0xf22484['get']('text'),'renderingStrategy':_0x42268a,'isDone':_0x430758});_0x430758&&_0x3bcc3a['sources']['length']>0x0&&this['_aiChatUi']['updateFeedItemAIReplySources'](_0x2b9a44,_0x3bcc3a['sources']);}['_updateReplyContentThrottled']=_0x10dd08(this['_updateReplyContent']['bind'](this),0xc8);async['_stopLastInteraction'](){const _0x5bbbb9=this['activeConversation']?.['lastInteraction'];_0x5bbbb9&&(_0x5bbbb9['stop'](),this['_aiChatUi']['stopInteraction'](_0x5bbbb9)),this['_updateReplyContentThrottled']['cancel']();}async['_flushLastInteractionUI'](){const _0x2af577=this['activeConversation']?.['lastInteraction'];if(_0x2af577){for await(const _0x402019 of _0x2af577['replies'])this['_aiChatUi']['hasFeedItem'](_0x402019['id'])||this['_addFeedItemReply'](_0x402019),await this['_updateReplyContent']({'reply':_0x402019,'renderingStrategy':'static'});}}['_updateRatings'](_0x33d2f0){const _0x4bb590={'positiveCount':_0x33d2f0['changeGroups']['filter'](_0x4e974f=>'accepted'===_0x4e974f['state'])['length'],'totalCount':_0x33d2f0['changeGroups']['length'],'modificationId':_0x33d2f0['id']},_0x3687c5=this['activeConversation']['getInteraction'](_0x33d2f0['interactionId'])['messageId'];_0x3687c5&&this['_aiConnector']['upsertAIChatRating'](this['activeConversation']['id'],_0x3687c5,_0x4bb590);}['_getAIChatFeedAPI'](_0x575467){const _0x3d9b0c=this['_aiChatUi'],_0x227b4f=()=>{_0x575467['resetWebSearchState'](),_0x575467['resetReasoningState'](),_0x3d9b0c['clearLoadingMessage']();},_0x2f2868=()=>{_0x575467['currentReply']&&(_0x575467['currentReply']['done'](),_0x575467['currentReply']=void 0x0);};return{'insertTextReply':(_0x5d8707,_0x4b6e58)=>{_0x2f2868(),_0x227b4f();const _0x762a31=_0x575467['currentReply']=_0x575467['createReply']({'type':'text','interactionId':_0x575467['id'],'id':_0x4b6e58||at(),'channelsToEditors':this['_channelsToEditors']});return _0x762a31['appendContent'](_0x5d8707),_0x2f2868(),_0x762a31;},'insertCustomElement':async(_0x29fc88,_0x5d0db8)=>(_0x2f2868(),_0x227b4f(),_0x3d9b0c['addFeedItemCustomElement'](_0x29fc88,_0x5d0db8||at())),'setLoadingMessage':_0x26181a=>{_0x3d9b0c['setLoadingMessage'](_0x26181a);},'clearLoadingMessage':()=>{_0x3d9b0c['clearLoadingMessage']();}};}['_checkRemoveCurrentDocumentFromChatContext'](){Cs(this['context'])['find'](_0x214c96=>'destroyed'!==_0x214c96['state'])||(this['activeConversation']?.['removeFromContext']('current-document'),this['activeConversation']?.['toggleAddCurrentDocumentOptionVisibility'](!0x1));}}const fs='ai-selection',Rs=['br'];class AIEditing extends _0x533560{constructor(_0x3b26e4){super(_0x3b26e4),this['context']['config']['define']('ai.models.showModelSelector',!0x0);}['_outputDataProcessor'];['_fakeSelections']=[];['_sessionIdByEditor']=new WeakMap();['_lastContentFocusedEditor'];static get['pluginName'](){return'AIEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['getLastContentFocusedEditor'](){return this['_lastContentFocusedEditor'];}['getSessionId'](_0x561280){let _0x18c6aa=this['_sessionIdByEditor']['get'](_0x561280);return!_0x18c6aa&&(_0x18c6aa=_0x561280['plugins']['has']('RealTimeCollaborationClient')&&_0x561280['plugins']['get']('RealTimeCollaborationClient')['sessionId']||at(),this['_sessionIdByEditor']['set'](_0x561280,_0x18c6aa)),_0x18c6aa;}async['getDocumentData'](){const _0x12de0b=Cs(this['context']);if(!_0x12de0b['length'])throw new ht('ai-get-editor-from-context-no-editor');const _0x34a7ff=[],_0x55d2e5=new Set();for(const _0x4eaa1d of _0x12de0b){const _0x5368a3=_0x4eaa1d['config']['get']('roots')||{};for(const _0xa099df of _0x4eaa1d['model']['document']['getRoots']()){if('$graveyard'===_0xa099df['rootName'])continue;const _0x2ff1bf=await this['_getDocumentDataForEditorRoot'](_0x4eaa1d,_0xa099df,_0x55d2e5),_0x2ac0cf=_0x5368a3[_0xa099df['rootName']];let _0x354e65;_0x2ac0cf?.['label']?_0x354e65=_0x2ac0cf['label']:(wt('ai-document-root-missing-label',{'editor':_0x4eaa1d,'rootConfig':_0x2ac0cf}),_0x354e65=_0xa099df['rootName']),_0x34a7ff['push']({'editor':_0x4eaa1d,'rootName':_0xa099df['rootName'],'content':_0x2ff1bf['content'],'version':_0x2ff1bf['version'],'sessionId':this['getSessionId'](_0x4eaa1d),'channelId':_0x4eaa1d['config']['get']('collaboration.channelId'),'selections':_0x2ff1bf['selections'],'name':_0x354e65,'description':_0x2ac0cf?.['description']});}}return _0x34a7ff;}async['_getDocumentDataForEditorRoot'](_0x13034f,_0x495873,_0x3dbbd3){const _0x84c7d7=_0x13034f['data']['toView'](_0x495873,{'convertAiChatSelectionMarker':!0x0}),_0x531c00=new _0x530633(_0x13034f['editing']['view']['document']);this['_setDataIdsOnChildren'](_0x84c7d7,_0x531c00,_0x3dbbd3);let _0x19cf64=await this['_getDocumentDataStringFromView'](_0x84c7d7,_0x13034f);const _0x1e7b5c=this['_getMarkersInDocumentOrder'](_0x13034f,_0x495873),_0xc8232d=[];for(const _0xeb70e8 of _0x1e7b5c){const _0xd6e3f3='<'+_0xeb70e8['name']+':start></'+_0xeb70e8['name']+':start>',_0x5350fa=_0x19cf64['indexOf'](_0xd6e3f3);_0x19cf64=_0x19cf64['substring'](0x0,_0x5350fa)+_0x19cf64['substring'](_0x5350fa+_0xd6e3f3['length']);const _0x5a80e2='<'+_0xeb70e8['name']+':end></'+_0xeb70e8['name']+':end>',_0x562087=_0x19cf64['indexOf'](_0x5a80e2);_0x19cf64=_0x19cf64['substring'](0x0,_0x562087)+_0x19cf64['substring'](_0x562087+_0x5a80e2['length']),_0xc8232d['push']({'markerName':_0xeb70e8['name'],'start':_0x5350fa,'end':_0x562087,'htmlFragment':_0x19cf64['substring'](_0x5350fa,_0x562087)});}return{'content':_0x19cf64,'version':_0x13034f['model']['document']['version'],'selections':_0xc8232d};}['afterInit'](){this['context']instanceof _0x20c128?this['_integrateEditor'](this['context']):this['listenTo'](this['context']['editors'],'add',(_0x288d2b,_0x2b0795)=>{_0x2b0795['on']('ready',()=>{this['_integrateEditor'](_0x2b0795);});});}['_setOutputDataProcessor'](_0x45ce69){this['_outputDataProcessor']=_0x45ce69;}async['_getDocumentDataStringFromView'](_0x2a6ded,_0x46e6b1){let _0x7939db;if(this['_outputDataProcessor']){const _0x459483=_0x46e6b1['data']['processor']['domConverter']['viewToDom'](_0x2a6ded),_0x5ca912=await this['_outputDataProcessor'](_0x459483);_0x7939db=_0x46e6b1['data']['processor']['htmlWriter']['getHtml'](_0x5ca912);}else _0x7939db=_0x46e6b1['data']['processor']['toData'](_0x2a6ded);return _0x7939db;}['_integrateEditor'](_0xe5d81){if(!_0xe5d81['config']['get']('collaboration.channelId'))throw new ht('ai-missing-channel-id',_0xe5d81);_0xe5d81['ui']['focusTracker']['on']('change:isFocused',(_0x1c8df5,_0x459d13,_0x57a567)=>{_0x57a567&&(this['_lastContentFocusedEditor']=_0xe5d81);}),_0xe5d81['on']('destroy',()=>{this['_lastContentFocusedEditor']===_0xe5d81&&(this['_lastContentFocusedEditor']=void 0x0);}),_0xe5d81['conversion']['for']('editingDowncast')['markerToHighlight']({'model':fs,'view':({markerName:_0x2f9e71})=>({'classes':['ck-ai-assistant-ui_theme','ck-fake-ai-selection','ck-fake-ai-selection-'+_0x2f9e71['split'](':')[0x1]],'priority':0xc})}),_0xe5d81['conversion']['for']('dataDowncast')['markerToElement']({'model':fs+':context','view':(_0xb30c46,{writer:_0x143503,options:_0x5765d5})=>_0x5765d5['convertAiChatSelectionMarker']?_0x143503['createUIElement'](_0xb30c46['markerName']+':'+(_0xb30c46['isOpening']?'start':'end')):null});}['showFakeVisualSelection'](_0x949328){const _0xc1de38=this['_fakeSelections'][0x0]||null;this['_addFakeSelection'](_0x949328);const _0x49220b=this['_fakeSelections'][0x0]||null;this['_refreshFakeSelection'](_0xc1de38,_0x49220b);}['hideFakeVisualSelection'](_0x656d21){const _0x1d3431=this['_fakeSelections'][0x0]||null;this['_removeFakeSelectionById'](_0x656d21);const _0x366d18=this['_fakeSelections'][0x0]||null;this['_refreshFakeSelection'](_0x1d3431,_0x366d18);}async['modelToDataWithIds'](_0x5a0f6d,_0x28ffc6){const _0x3db24c=_0x28ffc6['data']['toView'](_0x5a0f6d),_0x49a6a0=new _0x530633(_0x28ffc6['editing']['view']['document']);return this['_setDataIdsOnChildren'](_0x3db24c,_0x49a6a0),this['_getDocumentDataStringFromView'](_0x3db24c,_0x28ffc6);}['_setDataIdsOnChildren'](_0x3b843d,_0xc76f4b,_0x5d13c0=new Set()){let _0x742a65=!0x1;for(const _0xb94e97 of _0x3b843d['getChildren']()){if(!_0xb94e97['is']('view:element')||Rs['includes'](_0xb94e97['name']))continue;const _0x194117=_0xb94e97['is']('view:containerElement'),_0x40e951=_0xb94e97['is']('view:emptyElement'),_0x55370b=_0xb94e97['is']('view:rawElement'),_0x1110bd=this['_setDataIdsOnChildren'](_0xb94e97,_0xc76f4b,_0x5d13c0);if(_0xb94e97['hasAttribute']('data-id')){_0x742a65=!0x0,_0x5d13c0['add'](_0xb94e97['getAttribute']('data-id'));continue;}(_0x194117||_0x40e951||_0x55370b||_0x1110bd)&&(_0xc76f4b['setAttribute']('data-id',this['_nextDataId'](_0x5d13c0),_0xb94e97),_0x742a65=!0x0);}return _0x742a65;}['_nextDataId'](_0x1e03b4){let _0x2667ae;do{_0x2667ae='';for(let _0x496f61=0x0;_0x496f61<0x4;_0x496f61++)_0x2667ae+=String['fromCharCode'](0x61+Math['floor'](0x1a*Math['random']()));}while(_0x1e03b4['has'](_0x2667ae));return _0x1e03b4['add'](_0x2667ae),_0x2667ae;}['getSelectionText'](_0x2d98c1){const _0x373607=(_0x2d98c1?_0x2d98c1['model']:ms(this['context'])['model'])['document']['selection'],_0x18db0d=[],_0x18bc33=Array['from'](_0x373607['getRanges']());_0x18bc33['sort']((_0x44a35f,_0x3761f3)=>_0x44a35f['start']['isBefore'](_0x3761f3['start'])?-0x1:0x1);for(const _0x1b620a of _0x18bc33)for(const _0x3afcd9 of _0x1b620a['getItems']())_0x3afcd9['is']('$textProxy')?_0x18db0d['push'](_0x3afcd9['data']):_0x3afcd9['is']('element')&&_0x18db0d['length']>0x0&&'\x20'!==_0x18db0d[_0x18db0d['length']-0x1]&&_0x18db0d['push']('\x20');return _0x18db0d['length']?'\x22'+_0x18db0d['join']('')['trim']()+'\x22':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_DOCUMENT_SELECTION_LABEL');}['_removeFakeSelectionById'](_0x5e1768){for(let _0x1781a8=0x0;_0x1781a8<this['_fakeSelections']['length'];_0x1781a8++)if(this['_fakeSelections'][_0x1781a8]['id']==_0x5e1768)return void this['_fakeSelections']['splice'](_0x1781a8,0x1);}['_addFakeSelection'](_0x15c666){this['_removeFakeSelectionById'](_0x15c666['id']),ft(this['_fakeSelections'],_0x15c666);}['_refreshFakeSelection'](_0x39b959,_0x52742d){if(_0x39b959==_0x52742d)return;const _0x47e8dd=_0x39b959?_0x39b959['editor']:null,_0x538cdc=_0x52742d?_0x52742d['editor']:null,_0x7b0a01=(_0x20a8c5,_0x47ecef)=>{const _0x5b1221=_0x47ecef['model']['markers']['getMarkersGroup'](fs);for(const _0xb68844 of _0x5b1221)_0x20a8c5['removeMarker'](_0xb68844);},_0x4ad367=(_0x21261e,_0x2ca85c,_0x1db9fb)=>{const _0x2732fe=_0x2ca85c['model'];for(let _0x2f9dee=0x0;_0x2f9dee<_0x1db9fb['ranges']['length'];_0x2f9dee++){let _0x55d523=_0x1db9fb['ranges'][_0x2f9dee];const _0xa65239=fs+':'+_0x1db9fb['id']+':'+_0x2f9dee;if(_0x55d523['start']['isAtEnd']){const _0x51aa00=_0x55d523['start']['getLastMatchingPosition'](({item:_0x37981a})=>!_0x2732fe['schema']['isContent'](_0x37981a),{'boundaries':_0x55d523});_0x55d523=_0x21261e['createRange'](_0x51aa00,_0x55d523['end']);}_0x21261e['addMarker'](_0xa65239,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x55d523});}};_0x47e8dd&&_0x538cdc&&_0x47e8dd===_0x538cdc&&_0x52742d?_0x47e8dd['model']['change'](_0x259ec7=>{_0x7b0a01(_0x259ec7,_0x47e8dd),_0x4ad367(_0x259ec7,_0x538cdc,_0x52742d);}):(_0x47e8dd&&_0x47e8dd['model']['change'](_0x39a0af=>_0x7b0a01(_0x39a0af,_0x47e8dd)),_0x538cdc&&_0x52742d&&_0x538cdc['model']['change'](_0x2b8b7f=>_0x4ad367(_0x2b8b7f,_0x538cdc,_0x52742d)));}['_getMarkersInDocumentOrder'](_0x5c655b,_0x36a78a){const _0x440bfb=Array['from'](_0x5c655b['model']['markers']['getMarkersGroup'](fs+':context'));return(_0x36a78a?_0x440bfb['filter'](_0x3b9d3=>{const _0x14052d=_0x3b9d3['getRange']();return _0x14052d&&_0x14052d['root']['rootName']===_0x36a78a['rootName'];}):_0x440bfb)['sort']((_0x4ac37f,_0x546fa5)=>_0x4ac37f['getStart']()['isBefore'](_0x546fa5['getStart']())?-0x1:_0x4ac37f['getStart']()['isAfter'](_0x546fa5['getStart']())?0x1:0x0);}}const bs=['showChangeInText','insertSuggestion','applySuggestion','rejectSuggestion','mouseOverSuggestion','mouseLeaveSuggestion','toggleSuggestionDisplayMode','like','dislike'],Ss=[...bs,'startConversation','sendUserMessage','promptInputPaste','abortPromptStream','addDocumentToContext','addFileToContext','addUrlToContext','executeCustomItemCallback','addResourceToContext','removeContextItem','loadSourceResources','toggleWebSearch','toggleReasoning','selectModel'];function Os(_0x492a4a){const _0x56fd26=new AbortController();return{'promise':new Promise((_0x43121a,_0x43e610)=>{const _0x41ecb9=setTimeout(_0x43121a,_0x492a4a);_0x56fd26['signal']['addEventListener']('abort',()=>{clearTimeout(_0x41ecb9),_0x43e610();});}),'abortController':_0x56fd26};}class HTMLStreamer{['options'];['isStreaming']=!0x1;['document']=null;['nodesList']=[];['currentIndex']=0x0;['timeoutAbortController']=null;['lastUpdateTime']=0x0;constructor(_0x29fdf5){this['options']={'delay':_0x29fdf5?.['delay']??0xa,'textNodeStyle':_0x29fdf5?.['textNodeStyle']??'animation:\x20ck-html-streamer-fade-in\x20.3s'};}async['stream']({document:_0x373e90,targetElement:_0x3041ef,abortSignal:_0xc0305d}){this['isStreaming']&&this['stop'](),_0xc0305d?.['addEventListener']('abort',this['stop']['bind'](this)),this['document']=_0x49b927(_0x373e90,!0x0),this['nodesList']=this['getParsedDocumentNodeList'](),this['isStreaming']=!0x0,this['currentIndex']>this['nodesList']['length']&&(this['currentIndex']=this['nodesList']['length']);for(let _0x20c2d4=0x0;_0x20c2d4<this['currentIndex'];_0x20c2d4++)this['nodesList'][_0x20c2d4]['shouldBeStreamed']=!0x0;do{const _0x13c07e=Date['now'](),_0x626b4e=this['nodesList'][this['currentIndex']],_0x291be5=_0x13c07e-this['lastUpdateTime'];if(_0x626b4e){_0x626b4e['shouldBeStreamed']=!0x0;let _0x1f8042=_0x626b4e['parent'];for(;_0x1f8042;)_0x1f8042['shouldBeStreamed']=!0x0,_0x1f8042=_0x1f8042['parent'];}if(_0x291be5<this['options']['delay'])try{const {promise:_0x459c60,abortController:_0x4b2766}=Os(this['options']['delay']-_0x291be5);this['timeoutAbortController']=_0x4b2766,await _0x459c60;}catch(_0x51daee){return;}_0x493e74(_0x3041ef,'<'+_0x3041ef['tagName']+'>'+this['renderNode'](this['document'])+'</'+_0x3041ef['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:_0x169bba}){Array['from'](_0x169bba['querySelectorAll']('span[data-ck-html-streamer-word-chunk]'))['reverse']()['forEach'](_0x435290=>{_0x435290['replaceWith'](_0x435290['childNodes'][0x0]);});}['stop'](){this['isStreaming']=!0x1,this['timeoutAbortController']&&(this['timeoutAbortController']['abort'](),this['timeoutAbortController']=null);}['renderNode'](_0x1cf164){let _0x15d3be='';if(function(_0x4fbf17){return _0x1b7a63(_0x4fbf17);}(_0x1cf164)){for(const _0x1c826d of _0x1cf164['children'])_0x15d3be+=this['renderNode'](_0x1c826d);}else{if(ys(_0x1cf164)){if(!_0x1cf164['shouldBeStreamed'])return'';const _0x5f0c7b=_0x1cf164,_0x33ce19=Object['entries'](_0x5f0c7b['attribs'])['map'](([_0x450b2f,_0x7cb465])=>_0x450b2f+'=\x22'+_0x7cb465+'\x22')['join']('\x20');_0x15d3be+='<'+_0x5f0c7b['tagName']+(_0x33ce19?'\x20'+_0x33ce19:'')+'>';for(const _0x449b5f of _0x39d6e4(_0x5f0c7b))_0x15d3be+=this['renderNode'](_0x449b5f);_0x15d3be+='</'+_0x5f0c7b['tagName']+'>';}else{if(!ks(_0x1cf164))return'';if(!_0x1cf164['shouldBeStreamed'])return'';!function(_0x452791){if(!_0x452791['parent']||!ys(_0x452791['parent']))return!0x1;if(!vs['includes'](_0x452791['parent']['tagName']))return!0x1;return!ti(_0x452791)['match'](/^\s*[<>]\s*$/);}(_0x1cf164)?_0x15d3be+=_0x2ec60a(_0x1cf164):_0x15d3be+=_0x2ec60a(new _0x38344d('span',{'data-ck-html-streamer-word-chunk':'','style':this['options']['textNodeStyle']},[_0x1cf164]));}}return _0x15d3be;}['getParsedDocumentNodeList'](){const _0x17046e=[];return function(_0x5c88f2,_0x3d82ee){const _0x37d042=_0x20b341=>{if(_0x3d82ee(_0x20b341),_0x20b341 instanceof _0x3535cd)for(let _0x3d3811=0x0;_0x3d3811<_0x20b341['children']['length'];_0x3d3811++){const _0x46930c=_0x20b341['children'][_0x3d3811];_0x37d042(_0x46930c);}};for(let _0x476831=0x0;_0x476831<_0x5c88f2['children']['length'];_0x476831++)_0x37d042(_0x5c88f2['children'][_0x476831]);}(this['document'],_0x2aecea=>{if(ks(_0x2aecea)){const _0x363c69=this['splitTextNodeIntoWordNodes'](_0x2aecea);_0x363c69['length']&&_0x17046e['push'](..._0x363c69);}_0x2aecea['isWordSplitSource']||_0x2aecea['isWordSplitResult']||_0x17046e['push'](_0x2aecea);}),_0x17046e;}['splitTextNodeIntoWordNodes'](_0x52ff83){if(_0x52ff83['isWordSplitSource']||_0x52ff83['isWordSplitResult'])return[];const _0x50d1dc=ti(_0x52ff83)['match'](/(?:\s*\S+\s*)/g),_0x3b0389=[];if(_0x50d1dc&&_0x50d1dc['length']>0x1){for(const _0x1be5e7 of _0x50d1dc){const _0x225c8c=new _0x5165b8(_0x1be5e7);_0x225c8c['isWordSplitResult']=!0x0,_0x46d239(_0x52ff83,_0x225c8c),_0x3b0389['push'](_0x225c8c);}_0x52ff83['isWordSplitSource']=!0x0,_0x4b0b34(_0x52ff83);}return _0x3b0389;}}const vs=['p','li','td','th','span','h1','h2','h3','h4','h5','h6','b','strong','i','em','mark','del','ins','sup','sub','a','code','div'];function ks(_0x291b3c){return _0x522d3f(_0x291b3c);}function ys(_0x2b615d){return _0x4b89ac(_0x2b615d);}class AIChatFeedItemView extends Nt{['options'];['content']='';['htmlStreamer'];['children'];constructor(_0x21635f){super();const _0x56a43d=this['bindTemplate'];this['set']('isDone',!0x1),this['set']('isVisible',!0x0),this['htmlStreamer']=new HTMLStreamer(),this['options']=_0x21635f,this['children']=this['createCollection'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__item',_0x56a43d['if']('isDone','ck-ai-chat__feed__item_done'),_0x56a43d['if']('isVisible','ck-hidden',_0x52ad52=>!_0x52ad52),'ck-ai-chat__feed__text-item'],'data-cke-ai-id':this['options']['id']},'children':this['children']});}['markAsDone'](){this['htmlStreamer']['cleanUpAnimations']({'targetElement':this['element']}),this['element']['querySelectorAll']('[data-id]')['forEach'](_0x50a192=>{_0x50a192['removeAttribute']('data-id');}),this['isDone']=!0x0;}async['streamIntoElement'](_0x223666,_0xfcb2d6,_0x25a387){await this['htmlStreamer']['stream']({'document':_0x223666,'targetElement':_0xfcb2d6,'abortSignal':_0x25a387});}}class AISuggestionHeaderView extends Nt{['showChangesToggleView'];constructor(_0x334f38,_0xd1eb12){super(_0x334f38),this['set']('isShowChangesToggleVisible',!0x0),this['showChangesToggleView']=new ShowChangesToggleView(_0x334f38),this['showChangesToggleView']['set']({'class':'ck-ai-suggestion__header__show-changes-toggle\x20ck-ai-chat-controls-button\x20'+Gi,'label':Mi(_0x334f38,'AI_SUGGESTION_BUTTON_SHOW_CHANGES'),'withText':!0x0}),this['showChangesToggleView']['isOn']=_0xd1eb12['showDiff'],this['showChangesToggleView']['bind']('isVisible')['to'](this,'isShowChangesToggleVisible'),this['showChangesToggleView']['bind']('icon')['to'](this['showChangesToggleView'],'isOn',_0x2ac93d=>_0x2ac93d?_0x28bbf3:_0x2a7839),this['showChangesToggleView']['on']('execute',()=>{this['showChangesToggleView']['isOn']=!this['showChangesToggleView']['isOn'],this['fire']('toggleShowChanges',{'isOn':this['showChangesToggleView']['isOn']});});const _0x15b869=new Lt();_0x15b869['content']=_0x3702e6,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__header',!0x1===_0xd1eb12['showHeader']?'ck-hidden':null]['filter'](Boolean)},'children':[_0x15b869,{'tag':'span','children':[Mi(_0x334f38,'AI_SUGGESTION_HEADER_TITLE')]},this['showChangesToggleView']]});}}class ShowChangesToggleView extends yt{['render'](){super['render'](),this['children']['remove'](this['iconView']),this['children']['add'](this['iconView']);}}const Ns={'accepted':_0x1ae459,'rejected':_0x22445e,'outdated':_0x22445e};class AISuggestionContentPartStateView extends Nt{['stateIconView'];constructor(_0x24e267){super(_0x24e267);const _0x139ade=this['bindTemplate'];this['set']('state','accepted'),this['set']('isVisible',!0x0),this['stateIconView']=new StateIconView(),this['stateIconView']['bind']('state')['to'](this),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__content-part-state',_0x139ade['to']('state',_0x1f349e=>'ck-ai-suggestion__content-part-state_'+_0x1f349e),_0x139ade['if']('isVisible','ck-hidden',_0x3c3349=>!_0x3c3349)]},'children':[{'tag':'span','attributes':{'class':['ck-ai-suggestion__content-part-state__label']},'children':[{'text':_0x139ade['to']('state',_0x3cb0fb=>{switch(_0x3cb0fb){case'accepted':return Mi(_0x24e267,'AI_SUGGESTION_CONTENT_PART_STATE_ACCEPTED');case'rejected':return Mi(_0x24e267,'AI_SUGGESTION_CONTENT_PART_STATE_REJECTED');case'outdated':return Mi(_0x24e267,'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED');}})}]},this['stateIconView']]});}['setState'](_0x510fd3){this['state']=_0x510fd3;}}class StateIconView extends Lt{constructor(){super(),this['set']('state','accepted'),this['content']=Ns[this['state']],this['on']('change:state',()=>{this['content']=Ns[this['state']];});}}class AISuggestionContentPartToolbarView extends kt{['_applyButton'];['_suggestButton'];constructor(_0x4fea95,_0x33c4eb,_0x2b20a7){super(_0x4fea95);const _0x30130f=Boolean(_0x2b20a7);this['set']('isEnabled',!_0x30130f),this['set']('isVisible',!0x0),this['set']('isTrackChangesOn',!0x1),this['class']='ck-ai-suggestion-content-part-toolbar';const _0x3b5a0d=[];if(_0x30130f){const _0x23b816=new yt(_0x4fea95);_0x23b816['set']({'label':Mi(_0x4fea95,'AI_SUGGESTION_DISABLED_TOOLTIP_MESSAGE'),'tooltip':!0x0,'withText':!0x1,'icon':_0x2c999a}),_0x23b816['extendTemplate']({'attributes':{'data-cke-tooltip-class':'ck-ai-suggestion-content-part-disabled-actions-tooltip'}}),_0x3b5a0d['push'](_0x23b816);}else{_0x33c4eb['includes']('applySuggestion')&&(this['_applyButton']=new yt(_0x4fea95),this['_applyButton']['set']({'label':Mi(_0x4fea95,'AI_SUGGESTION_CONTENT_PART_APPLY'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x1ae459}),this['_applyButton']['bind']('isEnabled')['to'](this),this['_applyButton']['bind']('isVisible')['to'](this,'isTrackChangesOn',_0x22b2ca=>!_0x22b2ca),this['_applyButton']['on']('execute',()=>{this['fire']('applySuggestion');}),_0x3b5a0d['push'](this['_applyButton'])),_0x33c4eb['includes']('insertSuggestion')&&(this['_suggestButton']=new yt(_0x4fea95),this['_suggestButton']['set']({'label':Mi(_0x4fea95,'AI_SUGGESTION_CONTENT_PART_ADD_SUGGESTION'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x1bce7a}),this['_suggestButton']['bind']('isEnabled')['to'](this),this['_suggestButton']['on']('execute',()=>{this['fire']('insertSuggestion');}),_0x3b5a0d['push'](this['_suggestButton']));const _0x5ebe2c=new yt(_0x4fea95);_0x5ebe2c['set']({'label':Mi(_0x4fea95,'AI_SUGGESTION_CONTENT_PART_REJECT'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x22445e}),_0x5ebe2c['bind']('isEnabled')['to'](this),_0x5ebe2c['on']('execute',()=>{this['fire']('rejectSuggestion');}),_0x3b5a0d['push'](_0x5ebe2c);}this['items']['addMany'](_0x3b5a0d);const _0x321e23=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':[_0x321e23['if']('isVisible','ck-hidden',_0x53dc4b=>!_0x53dc4b)]}});}['setButtonsVisibility']({showApplyButton:_0x3c30b9,showSuggestButton:_0x5dcd6c}){this['_applyButton']&&(this['_applyButton']['isVisible']=_0x3c30b9),this['_suggestButton']&&(this['_suggestButton']['isVisible']=_0x5dcd6c);}}class AISuggestionContentPartHeaderView extends Nt{['toolbarView'];['stateView'];['titleLabelView'];['children'];constructor(_0x307355,{part:_0x4563c0,uiIndex:_0x2c9e47,availableActions:_0x4e6590,areActionsDisabled:_0x229ea1}){super(_0x307355),this['set']('isEnabled',!0x0),this['set']('state','pending'),this['set']('isTrackChangesOn',!0x1),this['toolbarView']=new AISuggestionContentPartToolbarView(_0x307355,_0x4e6590,_0x229ea1),this['toolbarView']['on']('rejectSuggestion',()=>{this['fire']('rejectSuggestion',{'index':_0x4563c0['index']});}),this['toolbarView']['on']('insertSuggestion',()=>{this['fire']('insertSuggestion',{'index':_0x4563c0['index']});}),this['toolbarView']['on']('applySuggestion',()=>{this['fire']('applySuggestion',{'index':_0x4563c0['index']});}),this['toolbarView']['bind']('isEnabled','isTrackChangesOn')['to'](this),this['stateView']=new AISuggestionContentPartStateView(_0x307355),this['titleLabelView']=new AISuggestionBodyContentPartTitleLabelView(_0x307355,_0x2c9e47),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',(_0x2b01ac,_0x487489,_0x5659b5,_0x4ff983)=>{'pending'===_0x4ff983?this['children']['remove'](this['toolbarView']):this['children']['remove'](this['stateView']),'pending'===_0x5659b5?this['children']['add'](this['toolbarView']):(this['stateView']['setState'](_0x5659b5),this['children']['add'](this['stateView']));});}}class AISuggestionBodyContentPartTitleLabelView extends Nt{constructor(_0x5ebb7e,_0x5543ec){super(_0x5ebb7e),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__body__content-part__title__label']},'children':[Mi(_0x5ebb7e,'AI_SUGGESTION_CONTENT_PART_TITLE',_0x5543ec['toString']())]});}}class AISuggestionStreamableContentView extends Nt{['htmlStreamer'];constructor(_0x4f11a9){super(_0x4f11a9),this['htmlStreamer']=new HTMLStreamer(),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content','ck-reset_all-excluded','ck-ai-suggestion-streamable-content']}});}async['update']({part:_0x5a7d25,renderingStrategy:_0x56024e,abortSignal:_0x3225dd}){const _0x1575ec=_0x49b927(_0x5a7d25['content'],!0x0);for(const _0x21c592 of qi(_0x1575ec))_0x4b0b34(_0x21c592);'streaming'===_0x56024e?await this['htmlStreamer']['stream']({'document':_0x1575ec,'targetElement':this['element'],'abortSignal':_0x3225dd}):_0x493e74(this['element'],'<'+this['element']['tagName']+'>'+Ki(_0x1575ec)+'</'+this['element']['tagName']+'>',{'childrenOnly':!0x0});}['clear'](){this['htmlStreamer']['reset'](),this['element']['innerHTML']='',this['element']['scrollTop']=0x0;}}class AISuggestionBodyViewContentPartView extends Nt{['_children'];['_headerView'];['_streamableContentView'];constructor(_0x42c264,{part:_0x5e3ec8,uiIndex:_0xe06b9c,areActionsDisabled:_0x1d49c8,availableActions:_0x13ce38}){super(_0x42c264);const _0x8fbff8=this['bindTemplate'];this['set']('state','pending'),this['set']('isDone',!0x1),this['set']('isVisible',!0x1),this['set']('isActive',!0x1),this['set']('isEnabled',!0x1),this['set']('isTrackChangesOn',!0x1);const _0xf90ca7=()=>{this['isEnabled']=this['isDone']&&'pending'==this['state']&&!_0x1d49c8;};this['on']('change:state',_0xf90ca7),this['on']('change:isDone',_0xf90ca7),_0xf90ca7(),this['_children']=this['createCollection'](),this['_headerView']=new AISuggestionContentPartHeaderView(_0x42c264,{'part':_0x5e3ec8,'uiIndex':_0xe06b9c,'availableActions':_0x13ce38,'areActionsDisabled':_0x1d49c8}),this['_headerView']['bind']('isEnabled','state','isTrackChangesOn')['to'](this),this['_headerView']['delegate'](...bs)['to'](this),this['_streamableContentView']=new AISuggestionStreamableContentView(_0x42c264),this['_children']['addMany']([this['_headerView'],this['_streamableContentView']]),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__body__content-part',_0x8fbff8['to']('state',_0x112141=>'ck-ai-suggestion__body__content-part_'+_0x112141),_0x8fbff8['if']('isEnabled','ck-ai-suggestion__body__content-part_enabled'),_0x8fbff8['if']('isActive','ck-ai-suggestion__body__content-part_active'),_0x8fbff8['if']('isVisible','ck-hidden',_0x95878c=>!_0x95878c)]},'children':this['_children'],'on':{'mouseenter':_0x8fbff8['to'](()=>{this['isEnabled']&&this['fire']('mouseOverSuggestion',{'index':_0x5e3ec8['index']});}),'mouseleave':_0x8fbff8['to'](()=>{this['isEnabled']&&this['fire']('mouseLeaveSuggestion',{'index':_0x5e3ec8['index']});}),'click':_0x8fbff8['to'](_0x22801c=>{const _0x3738bf=_0x22801c['target'];this['isEnabled']&&!this['_headerView']['toolbarView']['element']['contains'](_0x3738bf)&&this['fire']('showChangeInText',{'index':_0x5e3ec8['index']});})}});}async['updateContent']({part:_0x5640aa,showUnchangedParts:_0x294590=!0x1,abortSignal:_0x1d3ca0}){this['partDefinition']=_0x5640aa,this['isVisible']=this['partDefinition']['hasChanges']||_0x294590,this['isVisible']&&await this['_streamableContentView']['update']({'part':_0x5640aa,'renderingStrategy':'static','abortSignal':_0x1d3ca0});}['markAsDone'](){this['isDone']=!0x0;}}class AISkeletonView extends Nt{constructor(_0x2a6786,_0x31ef87){super(_0x2a6786),this['set']('isVisible',!0x0),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-skeleton',this['bindTemplate']['if']('isVisible','ck-hidden',_0x108218=>!_0x108218)]},'children':this['_createSkeletonItems'](_0x31ef87)});}['_createSkeletonItems'](_0x16044d){const _0x41e289=['ck','ck-ai-skeleton__item'];return _0x16044d['map'](_0x163f2a=>{let _0x268440='';switch(_0x163f2a['attributes']['align']){case'right':_0x268440='margin-left:\x20auto;\x20margin-right:\x200;\x20text-align:\x20right;';break;case'center':_0x268440='margin-left:\x20auto;\x20margin-right:\x20auto;\x20text-align:\x20center;';break;case'left':_0x268440='margin-left:\x200;\x20margin-right:\x20auto;\x20text-align:\x20left;';}return{'tag':_0x163f2a['tag'],'attributes':{'class':[..._0x41e289,_0x163f2a['attributes']['class']?_0x163f2a['attributes']['class']:''],'style':'width:\x20'+_0x163f2a['attributes']['width']+';\x20height:\x20'+_0x163f2a['attributes']['height']+';'+_0x268440}};});}}const xs={'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':Ls(0x5,'100%','44px','right'),'aiChatResources':Ls(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 Ls(_0x2e98dc,_0x4b231d,_0x585a3c,_0x1ea19a){return new Array(_0x2e98dc)['fill'](null)['map'](()=>({'tag':'div','attributes':{'width':_0x4b231d,'height':_0x585a3c,'align':_0x1ea19a}}));}class PromiseQueue extends Et(){['queue']=[];['isProcessing']=!0x1;['_abortController'];async['enqueue'](_0x36662a){const _0x29c772=this['createTask'](_0x36662a);return this['queue']['push'](_0x29c772),this['_processQueue'](),_0x29c772['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(_0x200fba=>{this['once']('_queueEmpty',()=>{_0x200fba();});}):Promise['resolve']();}async['_processQueue'](){if(!this['isProcessing']){this['_abortController']=new AbortController(),this['isProcessing']=!0x0;try{for(;this['queue']['length']&&this['isProcessing'];){const _0x21b369=this['queue']['shift']();try{await _0x21b369['callback'](this['_abortController']['signal']),_0x21b369['resolve']();}catch(_0x83c874){_0x21b369['reject'](_0x83c874);}}}finally{this['isProcessing']=!0x1,this['_abortController']=void 0x0;}this['fire']('_queueEmpty');}}['createTask'](_0x31e718){let _0x3661f8,_0x5dd869;const _0x290de7=new Promise((_0x122134,_0x3afa50)=>{_0x3661f8=_0x122134,_0x5dd869=_0x3afa50;});return{'callback':_0x31e718,'resolve':_0x3661f8,'reject':_0x5dd869,'completePromise':_0x290de7};}}class AIChatFeedErrorItemView extends AIChatFeedItemView{constructor(_0x22c0dc){super(_0x22c0dc),this['extendTemplate']({'attributes':{'class':['ck-ai-notification','warning'===_0x22c0dc['level']?'ck-ai-notification_warning':'ck-ai-notification_error']}});}['render'](){super['render'](),this['setContent'](this['options']['initialContent']),this['markAsDone']();}['setContent'](_0x341c57){this['element']['innerHTML']=_0x341c57;}}const Ps=['applySuggestion','insertSuggestion'];class AIChatFeedSuggestionItemActionsView extends Nt{['_applyChangesButton'];['_insertSuggestionsButton'];['children'];constructor(_0x397db5,_0x9a263d=[...Ps],_0x40e79f){super(_0x397db5);const _0x557242=this['bindTemplate'],_0x37ceef=Boolean(_0x40e79f);if(this['set']('isEnabled',!_0x37ceef),this['set']('isVisible',!0x1),this['set']('isTrackChangesOn',!0x1),this['children']=this['createCollection'](),_0x37ceef){const _0x1b80d2=new yt(_0x397db5);_0x1b80d2['set']({'label':Mi(_0x397db5,'AI_SUGGESTION_DISABLED_TOOLTIP_MESSAGE'),'tooltip':!0x0,'withText':!0x1,'icon':_0x2c999a}),_0x1b80d2['extendTemplate']({'attributes':{'data-cke-tooltip-class':'ck-ai-suggestion-content-part-disabled-actions-tooltip'}});const _0x4955b5=new Nt(_0x397db5);_0x4955b5['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-chat__feed__suggestion__actions__info'},'children':[{'tag':'p','children':[Mi(_0x397db5,'AI_SUGGESTION_DISABLED_FEED_MESSAGE'),_0x1b80d2]}]}),this['children']['add'](_0x4955b5);}else this['_applyChangesButton']=new yt(_0x397db5),this['_applyChangesButton']['set']({'label':Mi(_0x397db5,'AI_CHAT_SUGGESTION_ACTION_APPLY_ALL'),'withText':!0x0,'type':'button','isVisible':_0x9a263d['includes']('applySuggestion'),'class':Ui}),this['_insertSuggestionsButton']=new yt(_0x397db5),this['_insertSuggestionsButton']['set']({'label':Mi(_0x397db5,'AI_CHAT_SUGGESTION_ACTION_SUGGEST_ALL'),'withText':!0x0,'type':'button','isVisible':_0x9a263d['includes']('insertSuggestion'),'class':Bi}),this['_insertSuggestionsButton']['on']('execute',()=>{this['fire']('insertSuggestion');}),this['_applyChangesButton']['on']('execute',()=>{this['fire']('applySuggestion');}),[this['_applyChangesButton'],this['_insertSuggestionsButton']]['forEach'](_0x36389b=>{_0x36389b['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',_0x557242['if']('isVisible','ck-hidden',_0x2638e6=>!_0x2638e6)]},'children':this['children']}),this['on']('change:isTrackChangesOn',()=>{this['_applyChangesButton']&&(this['_applyChangesButton']['isVisible']=!this['isTrackChangesOn']);});}['updateVisibility'](_0x3f0ce9){this['isVisible']=_0x3f0ce9;}['_switchButtonLabelsPlurality'](_0x288445){this['_applyChangesButton']&&this['_insertSuggestionsButton']&&(_0x288445?(this['_applyChangesButton']['label']=Mi(this['locale'],'AI_CHAT_SUGGESTION_ACTION_APPLY_ALL'),this['_insertSuggestionsButton']['label']=Mi(this['locale'],'AI_CHAT_SUGGESTION_ACTION_SUGGEST_ALL')):(this['_applyChangesButton']['label']=Mi(this['locale'],'AI_CHAT_SUGGESTION_ACTION_APPLY'),this['_insertSuggestionsButton']['label']=Mi(this['locale'],'AI_CHAT_SUGGESTION_ACTION_SUGGEST')));}}class AIWebSourcesView extends Nt{['children'];['balloonPanelView'];['bodyCollection'];constructor(_0x14f304,_0x3b3fed){super(_0x14f304),this['bodyCollection']=_0x3b3fed,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',_0x56139d=>!_0x56139d)]},'children':this['children']});const _0x4c83df=new Nt(this['locale']),_0x17f6ad=new Lt();_0x17f6ad['content']=_0x4ead13,_0x4c83df['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-web-sources__header']},'children':[_0x17f6ad,{'tag':'span','children':[{'text':Mi(this['locale'],'AI_CHAT_SOURCES_HEADER')}]}]}),this['children']['add'](_0x4c83df),this['_setupBalloonPanel'](_0x14f304);}['addSource'](_0x329c79){this['children']['add'](new AIWebSourceView(this['locale'],_0x329c79,this['balloonPanelView']));}['_setupBalloonPanel'](_0x316e7c){this['balloonPanelView']=new zt(_0x316e7c),this['balloonPanelView']['extendTemplate']({'attributes':{'class':['ck-ai-web-source__tooltip-balloon']}}),this['bodyCollection']['add'](this['balloonPanelView']);}}class AIWebSourceView extends yt{['balloonPanelView'];['source'];constructor(_0x5c2b20,_0x4594e9,_0x189a29){super(_0x5c2b20),this['source']=_0x4594e9,this['balloonPanelView']=_0x189a29,this['set']({'label':_0x4594e9['title'],'class':['ck\x20ck-ai-web-source'],'withText':!0x0});const _0x493b88=this['bindTemplate'];if(this['extendTemplate']({'on':{'click':_0x493b88['to'](()=>{window['open'](_0x4594e9['url'],'_blank');}),'mouseenter':_0x493b88['to'](()=>{this['_showTooltip']();}),'mouseleave':_0x493b88['to'](()=>{this['_hideTooltip']();})}}),_0x4594e9['favicon']){const _0x291e4d=new Nt(_0x5c2b20);_0x291e4d['setTemplate']({'tag':'img','attributes':{'src':_0x4594e9['favicon']||_0x4ead13,'alt':_0x4594e9['title'],'class':['ck-ai-web-source__image']}}),this['children']['add'](_0x291e4d);}else this['set']('icon',_0x4ead13);}['_createTooltipContentView'](_0x3ca6b7,_0x529766){const _0xe223e5=new Nt(_0x3ca6b7),_0x463a86=[];let _0x11c217;_0x529766?.['favicon']?(_0x11c217=new Nt(_0x3ca6b7),_0x11c217['setTemplate']({'tag':'img','attributes':{'src':_0x529766['favicon'],'alt':_0x529766['title'],'class':['ck-ai-web-source__tooltip-image']}})):(_0x11c217=new Lt(),_0x11c217['content']=_0x4ead13,_0x11c217['extendTemplate']({'attributes':{'alt':_0x529766['title'],'class':['ck-ai-web-source__tooltip-image']}})),_0x463a86['push'](_0x11c217);const _0x5288ae=new Nt(_0x3ca6b7);_0x5288ae['setTemplate']({'tag':'a','attributes':{'class':['ck-ai-web-source__tooltip-url'],'href':_0x529766['url']},'children':[{'text':new URL(_0x529766['url'])?.['hostname']}]}),_0x463a86['push'](_0x5288ae);const _0x3c7413=new Nt(_0x3ca6b7);_0x3c7413['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-web-source__tooltip-row']},'children':_0x463a86});const _0x411c4c=new Nt(_0x3ca6b7);return _0x411c4c['setTemplate']({'tag':'span','attributes':{'class':['ck-ai-web-source__tooltip-row','ck-ai-web-source__tooltip-title']},'children':[{'text':_0x529766['title']['length']>0x190?_0x529766['title']['substring'](0x0,0x190)+'...':_0x529766['title']}]}),_0xe223e5['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-web-source__tooltip']},'children':[_0x3c7413,_0x411c4c]}),_0xe223e5;}['_showTooltip'](){this['_updateTooltipContent'](),this['balloonPanelView']['pin']({'target':this['element'],'positions':[zt['defaultPositions']['northArrowSouth'],zt['defaultPositions']['northArrowSouthWest'],zt['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 _0x5343e2=this['_createTooltipContentView'](this['locale'],this['source']);this['balloonPanelView']['content']['add'](_0x5343e2);}}class AISuggestionBodyView extends Nt{['_actionsView'];['_sourcesView'];['_children'];['_skeletonView'];['_showSkeletonDebounced']=_0x151e4e(()=>{this['_skeletonView']['isVisible']=!0x0,this['_skeletonShownAt']=Date['now']();},0x3e8);['_skeletonShownAt']=null;['_areActionsDisabled'];['_showUnchangedParts'];['_updateContentPartsPromiseQueue'];['_emptyPartsWarningView'];['_availableActions'];['_cachedContentParts']=[];constructor(_0x41def8,_0x2d5ba4){super(_0x41def8);const {areActionsDisabled:_0x14cf4e,showUnchangedParts:_0x255361,availableActions:_0x347e7a}=_0x2d5ba4;this['_areActionsDisabled']=_0x14cf4e,this['_showUnchangedParts']=_0x255361,this['_availableActions']=_0x347e7a,this['set']('hasPendingParts',!0x1),this['set']('isTrackChangesOn',!0x1),this['_children']=this['createCollection'](),this['_skeletonView']=new AISkeletonView(_0x41def8,xs['aiSuggestionBody']),this['_skeletonView']['isVisible']=!0x0,this['_skeletonShownAt']=Date['now'](),this['_children']['add'](this['_skeletonView']),this['_updateContentPartsPromiseQueue']=new PromiseQueue(),this['_emptyPartsWarningView']=new AIChatFeedErrorItemView({'id':'empty-parts-warning','initialContent':Mi(_0x41def8,'AI_SUGGESTION_EMPTY_PART_WARNING'),'level':'warning'}),this['_emptyPartsWarningView']['isVisible']=!0x1,this['_actionsView']=new AIChatFeedSuggestionItemActionsView(_0x41def8,_0x2d5ba4['availableActions'],this['_areActionsDisabled']),this['_actionsView']['bind']('isTrackChangesOn')['to'](this),this['_sourcesView']=new AIWebSourcesView(this['locale'],_0x2d5ba4['bodyCollection']),_0x2d5ba4['areActionsDisabled']?this['_actionsView']['isEnabled']=!0x1:this['_actionsView']['bind']('isEnabled')['to'](this,'hasPendingParts'),this['_actionsView']['delegate'](...bs)['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'](_0x3f0593=>_0x3f0593 instanceof AISuggestionBodyViewContentPartView);}async['updateContentParts']({parts:_0x5681e4,abortSignal:_0x1af8fa,skipLoadingEffects:_0x43bf98}){this['_cachedContentParts']['length']?_0x5681e4['forEach'](_0x42ea78=>{const _0x330bdb=this['_cachedContentParts']['findIndex'](_0x242285=>_0x242285['index']==_0x42ea78['index']);-0x1===_0x330bdb?this['_cachedContentParts']['push'](_0x42ea78):this['_cachedContentParts'][_0x330bdb]=_0x42ea78;}):this['_cachedContentParts']=_0x5681e4;const _0x46c5e7=this['_showUnchangedParts']?_0x5681e4:_0x5681e4['filter'](_0x4dbbff=>_0x4dbbff['hasChanges']);this['_actionsView']['_switchButtonLabelsPlurality'](_0x46c5e7['length']>0x1),_0x43bf98&&(this['_showSkeletonDebounced']['cancel'](),this['_skeletonView']['isVisible']=!0x1);for(const _0x23f3b6 of _0x46c5e7)this['_updateContentPartsPromiseQueue']['enqueue'](async _0x557664=>{let _0x7f2a90=this['getPartView'](_0x23f3b6['index']);if(!_0x7f2a90){if(_0x7f2a90=new AISuggestionBodyViewContentPartView(this['locale'],{'part':_0x23f3b6,'uiIndex':this['_contentPartViews']['length']+0x1,'areActionsDisabled':this['_areActionsDisabled'],'availableActions':this['_availableActions']}),_0x7f2a90['delegate'](...bs)['to'](this),_0x7f2a90['bind']('isTrackChangesOn')['to'](this),!_0x43bf98&&(this['_showSkeletonDebounced']['cancel'](),await this['_awaitMinimumSkeletonDisplayTime'](_0x557664),_0x557664['aborted']))return;this['_skeletonView']['isVisible']=!0x1,this['_children']['add'](_0x7f2a90,this['_children']['length']-0x1),this['hasPendingParts']=!0x0,_0x43bf98||this['_showSkeletonDebounced']();}await _0x7f2a90['updateContent']({'part':_0x23f3b6,'showUnchangedParts':this['_showUnchangedParts'],'abortSignal':_0x557664}),_0x7f2a90['markAsDone']();});return _0x1af8fa?.['addEventListener']('abort',()=>{this['_updateContentPartsPromiseQueue']['abort'](),this['_showSkeletonDebounced']['cancel'](),this['_skeletonView']['isVisible']=!0x1;}),this['_updateContentPartsPromiseQueue']['queueEmptyPromise'];}['updatePartState'](_0x4bbf00,_0x5e8510){const _0x12651a=this['getPartView'](_0x4bbf00);_0x12651a&&(_0x12651a['state']=_0x5e8510),this['hasPendingParts']='pending'==_0x5e8510||this['_contentPartViews']['some'](_0x47af1a=>'pending'==_0x47af1a['state']);}['setPartActive'](_0x19731f,_0x274b3f){if(!0x1===_0x19731f){for(const _0x1b92d4 of this['_contentPartViews'])_0x1b92d4['isActive']=!0x1;}else{const _0x6dc3e=this['getPartView'](_0x19731f);_0x6dc3e&&(_0x6dc3e['isActive']=_0x274b3f);}}['updateSources'](_0x8e1100){_0x8e1100['forEach'](_0x34053d=>this['_sourcesView']['addSource'](_0x34053d)),this['_sourcesView']['isVisible']=!0x0;}['getPartView'](_0x184588){return this['_contentPartViews']['find'](_0x2c9825=>_0x2c9825['partDefinition']['index']==_0x184588)??null;}['markAsDone'](){if(!this['_showUnchangedParts']){const _0x4c0448=!this['_cachedContentParts']['find'](({hasChanges:_0x28f19b})=>_0x28f19b),_0x5c36ce=!!this['_cachedContentParts']['find'](({hasChanges:_0x4f484f})=>!_0x4f484f);this['_emptyPartsWarningView']['isVisible']=0x0==this['_contentPartViews']['length']||_0x5c36ce,_0x4c0448?this['_emptyPartsWarningView']['setContent'](Mi(this['locale'],'AI_SUGGESTION_NO_PARTS_WARNING')):this['_emptyPartsWarningView']['setContent'](Mi(this['locale'],'AI_SUGGESTION_EMPTY_PART_WARNING'));}this['_contentPartViews']['forEach'](_0x48e7f5=>_0x48e7f5['markAsDone']()),this['_skeletonView']['isVisible']=!0x1,this['_showSkeletonDebounced']['cancel'](),this['_actionsView']['updateVisibility'](this['hasNonEmptyParts']);}async['_awaitMinimumSkeletonDisplayTime'](_0x2c3d1a){if(!this['_skeletonView']['isVisible']||null===this['_skeletonShownAt'])return;const _0x5b1532=0x3e8-(Date['now']()-this['_skeletonShownAt']);if(this['_skeletonShownAt']=null,_0x5b1532>0x0){const {promise:_0x503456,abortController:_0x2c27bc}=Os(_0x5b1532);_0x2c3d1a?.['addEventListener']('abort',()=>_0x2c27bc['abort']()),await _0x503456['catch'](()=>{});}}get['hasNonEmptyParts'](){return this['_contentPartViews']['filter'](_0x2418ba=>_0x2418ba['partDefinition']['hasChanges'])['length']>0x0;}}class AISuggestionContainerView extends Nt{['bodyView'];['children'];['headerView'];constructor(_0x4fbd19,_0x2f8cc8,_0x2bcb1a){super(_0x4fbd19);const {showDiff:_0x32e20b,areActionsDisabled:_0x10d7dd,showUnchangedParts:_0x38f5d2,availableActions:_0x682766}=_0x2f8cc8;this['set']('isTrackChangesOn',!0x1),this['set']('areChangesVisible',!0x1),this['children']=this['createCollection'](),this['headerView']=new AISuggestionHeaderView(_0x4fbd19,{'showDiff':_0x32e20b}),this['headerView']['on']('toggleShowChanges',(_0x48027b,_0x218748)=>{this['areChangesVisible']=_0x218748['isOn'],this['fire']('toggleSuggestionDisplayMode',{'showDiff':_0x218748['isOn']});}),this['children']['add'](this['headerView']),this['bodyView']=new AISuggestionBodyView(_0x4fbd19,{'areActionsDisabled':_0x10d7dd,'showUnchangedParts':!!_0x38f5d2,'availableActions':_0x682766,'bodyCollection':_0x2bcb1a}),this['bodyView']['delegate'](...bs)['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'](_0x19beda){await this['bodyView']['updateContentParts'](_0x19beda);}['updateSources'](_0x5a6e29){this['bodyView']['updateSources'](_0x5a6e29);}['markAsDone'](){this['bodyView']['markAsDone'](),this['headerView']&&(this['headerView']['isShowChangesToggleVisible']=this['bodyView']['hasNonEmptyParts']);}}class AIChatFeedSuggestionItemView extends AIChatFeedItemView{['containerView'];constructor(_0x43d099,_0x549f99,_0x15e3af){super(_0x549f99),this['set']('isTrackChangesOn',!0x1),this['containerView']=new AISuggestionContainerView(_0x43d099,{'showDiff':_0x549f99['showDiff'],'areActionsDisabled':_0x549f99['areActionsDisabled'],'availableActions':_0x549f99['availableActions']},_0x15e3af),this['containerView']['on']('toggleSuggestionDisplayMode',(_0x106405,_0x4e9935)=>{this['fire']('toggleSuggestionDisplayMode',{'replyId':this['options']['id'],'showDiff':_0x4e9935['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',(_0x3ea29e,{index:_0x52aa09})=>{this['fire']('showChangeInText',{'replyId':this['options']['id'],'partIndex':_0x52aa09});}),this['containerView']['on']('applySuggestion',(_0x5c521e,{index:_0x1f1e4d}={})=>{this['fire']('applySuggestion',{'replyId':this['options']['id'],'partIndex':_0x1f1e4d});}),this['containerView']['on']('insertSuggestion',(_0x878ff1,{index:_0x172d66}={})=>{this['fire']('insertSuggestion',{'replyId':this['options']['id'],'partIndex':_0x172d66});}),this['containerView']['on']('rejectSuggestion',(_0x14641f,{index:_0x1deafd})=>{this['fire']('rejectSuggestion',{'replyId':this['options']['id'],'partIndex':_0x1deafd});}),this['containerView']['on']('mouseOverSuggestion',(_0x2e03dd,{index:_0x5aa9f8})=>{this['fire']('mouseOverSuggestion',{'replyId':this['options']['id'],'partIndex':_0x5aa9f8});}),this['containerView']['on']('mouseLeaveSuggestion',(_0x5acfd0,{index:_0x4dc4a4})=>{this['fire']('mouseLeaveSuggestion',{'replyId':this['options']['id'],'partIndex':_0x4dc4a4});}),this['children']['addMany']([this['containerView']]),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__ai-suggestion']}});}async['updateContent'](_0x4c0859){await this['containerView']['updateContent'](_0x4c0859);}['updatePartState'](_0x43211f,_0xc49100){this['containerView']['bodyView']['updatePartState'](_0x43211f,_0xc49100);}['setPartActive'](_0x5ba8d4,_0x42c1d1){!0x1===_0x5ba8d4?this['containerView']['bodyView']['setPartActive'](!0x1):this['containerView']['bodyView']['setPartActive'](_0x5ba8d4,_0x42c1d1);}['updateSources'](_0x362190){this['containerView']['updateSources'](_0x362190);}['getPartView'](_0x4cc9d5){return this['containerView']['bodyView']['getPartView'](_0x4cc9d5);}['markAsDone'](){super['markAsDone'](),this['containerView']['markAsDone']();}}class AIChatFeedReplyItemView extends AIChatFeedItemView{['replyContainer'];['_bodyCollection'];constructor(_0x1e3aeb,_0x1ef085,_0x597c3e){super(_0x1ef085),this['_bodyCollection']=_0x597c3e,this['locale']=_0x1e3aeb,this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__ai-reply']}}),this['replyContainer']=new Nt(),this['replyContainer']['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all-excluded','ck-ai-chat__feed__ai-reply-container','ck-ai-chat-content']}}),this['children']['add'](this['replyContainer']);}async['render'](){super['render'](),this['options']['initialContent']&&(await this['updateContent']({'parsedContent':Wi(this['options']['initialContent']),'renderingStrategy':'static'}),this['markAsDone']());}async['updateContent']({parsedContent:_0x52bacb,renderingStrategy:_0x43b58e,abortSignal:_0x358031}){'streaming'===_0x43b58e?await this['streamIntoElement'](_0x52bacb,this['replyContainer']['element'],_0x358031):this['replyContainer']['element']['innerHTML']=_0x2ec60a(_0x52bacb);}['updateSources'](_0x13f2b8){const _0x50ec00=new AIWebSourcesView(this['locale'],this['_bodyCollection']);_0x50ec00['children']['addMany'](_0x13f2b8['map'](_0x42b3ae=>new AIWebSourceView(this['locale'],_0x42b3ae,_0x50ec00['balloonPanelView']))),_0x50ec00['isVisible']=!0x0,this['children']['add'](_0x50ec00);}}class AISpinnerView extends xt{constructor(_0x318c73=void 0x0){super();const _0x531399=_0x318c73?'ck-ai-spinner_'+_0x318c73:'';this['extendTemplate']({'tag':'span','attributes':{'class':['ck-ai-spinner',_0x531399]}});}}const Ds={'file':_0x5cbefc,'image':_0x3cb846,'document':_0x3702e6,'web-resource':_0x3ed1af,'text':_0x5cbefc,'selection':_0x5bcb3b,'mcp-tool-context':_0x3702e6},Vs='ck-ai-chat-context-chip',Hs='ck-ai-chat-context-chip_wide',Ms='ck-ai-chat-context-chip_document',Us='ck-ai-chat-context-chip__label',Bs='ck-ai-chat-context-chip__type-icon',Gs='ck-ai-chat-context-controls__chip-tooltip',Fs='n';class AIChatContextItemButtonView extends yt{constructor(_0x6876a1,_0xf6d7ba,_0xb86e76,_0x27dd5c,_0xebfebd=!0x1){super(_0x6876a1),this['_isAnimationOnEnterEnabled']=_0x27dd5c,this['_initializeProperties'](_0xf6d7ba,_0xb86e76,_0xebfebd),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'](_0x16c75a,_0x59d0ff,_0x42b4ab){this['set']('label',_0x16c75a['label']),this['set']('tooltip',!0x0),this['set']('itemType',_0x16c75a['type']),this['set']('id',_0x16c75a['uiId']),this['set']('readonly',_0x59d0ff),this['set']('isLoading',_0x42b4ab);}['_setupTemplate'](){const _0x1fa837=this['_createIconView'](),_0x10a293=this['_createRemoveButton'](),_0x1df1b5=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':this['_createTemplateAttributes'](_0x1df1b5),'children':this['_createTemplateChildren'](_0x1fa837,_0x10a293,_0x1df1b5)});}['_createTemplateAttributes'](_0xf91dfa){return{'class':[Vs,_0xf91dfa['if']('itemType',Ms,_0x14a9e5=>'document'==_0x14a9e5),_0xf91dfa['if']('itemType',Hs,_0x59f76e=>'selection'==_0x59f76e)],'data-cke-tooltip-text':_0xf91dfa['to']('label',Ws),'data-cke-tooltip-position':Fs,'data-cke-tooltip-class':Gs};}['_createTemplateChildren'](_0x181cd0,_0x29da71,_0x3ee031){const _0x41e8c2=this['_createLabelElement'](_0x3ee031),_0x53904c=this['_createLoaderIcon']();return this['readonly']?[_0x181cd0,_0x41e8c2]:[_0x181cd0,_0x53904c,_0x41e8c2,_0x29da71];}['_createLabelElement'](_0x5900e6){return{'tag':'span','attributes':{'class':Us},'children':[{'text':_0x5900e6['to']('label')}]};}['_createRemoveButton'](){const _0x15ee52=new yt(this['locale']);return _0x15ee52['set']({'label':Mi(this['locale'],'AI_CHAT_CONTEXT_REMOVE_FROM_CONTEXT'),'icon':_0x36e8b7}),this['_setupRemoveButtonEvent'](_0x15ee52),_0x15ee52;}['_setupRemoveButtonEvent'](_0x2d7aaa){_0x2d7aaa['on']('execute',()=>{this['fire']('removeContextItemChip',this['id']);});}['_createIconView'](){const _0x477254=this['bindTemplate'],_0x3d8b25=new Lt();return _0x3d8b25['content']=Ds[this['itemType']],_0x3d8b25['extendTemplate']({'attributes':{'class':[Bs,_0x477254['if']('isLoading','ck-hidden',_0x32558a=>_0x32558a)]}}),_0x3d8b25;}['_handleAnimationEndOnce'](_0x21952f,_0x34a75f){if(!_0x21952f)return;const _0x34890e=()=>{_0x34a75f(),_0x21952f['removeEventListener']('animationend',_0x34890e),_0x21952f['removeEventListener']('webkitAnimationEnd',_0x34890e);};_0x21952f['addEventListener']('animationend',_0x34890e),_0x21952f['addEventListener']('webkitAnimationEnd',_0x34890e);}['_createLoaderIcon'](){const _0x5b3c46=new AISpinnerView('small');return _0x5b3c46['bind']('isVisible')['to'](this,'isLoading',_0x2ae511=>_0x2ae511),_0x5b3c46;}}function Ws(_0x356201){if(!_0x356201)return _0x356201;if(_0x356201['length']<=0x78)return _0x356201;const _0x17e58b=_0x356201['slice'](0x0,0x78),_0x2e6853=_0x17e58b['lastIndexOf']('\x20');return(_0x2e6853>0x0?_0x17e58b['slice'](0x0,_0x2e6853):_0x17e58b)+'…';}const Ks={'maxVisibleRows':0x2,'rowDetectionTolerance':0x5,'showMoreLabelPrefix':'+\x20','viewportOffset':{'top':0x64,'bottom':0xa}},Ys='300px';class AIChatChipsOverflowManager{['_locale'];['_config'];['_visibleChips'];['_overflowChips'];['_showMoreButtonView']=null;['_showMoreBalloonPanelView']=null;['_containerElement']=null;['_bodyCollection'];['_parentView']=null;['_intersectionObserver']=null;['_pendingCalculation']=!0x1;constructor(_0x448a78,_0x4c91a8,_0x1e0cd4,_0x3c4cee,_0x133731){this['_locale']=_0x448a78,this['_visibleChips']=_0x4c91a8,this['_config']={...Ks,..._0x1e0cd4,'cssClasses':{'controlsButton':'','calculationContainer':'ck-calculation-container',..._0x1e0cd4['cssClasses']}},this['_overflowChips']=new _t(),this['_bodyCollection']=_0x3c4cee,this['_parentView']=_0x133731||null;}['setContainerElement'](_0x410634){this['_intersectionObserver']&&(this['_intersectionObserver']['disconnect'](),this['_intersectionObserver']=null),this['_containerElement']=_0x410634,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 _0x22de6f=[...this['_visibleChips'],...this['_overflowChips']],_0x37c979=this['_createCalculationContainer'](),_0x3c540f=this['_calculateOverflowInContainer'](_0x37c979,_0x22de6f),_0x218a4a=_0x37c979['_ancestorsToRestore'];_0x218a4a&&this['_restoreAncestorVisibility'](_0x218a4a),_0x37c979['remove'](),this['_applyOverflowResults'](_0x22de6f,_0x3c540f);}['_createShowMoreButton'](){this['_showMoreButtonView']=this['_createShowMoreButtonView'](),this['_showMoreBalloonPanelView']=this['_createShowMoreBalloonPanelView'](),this['_showMoreButtonView']['render'](),this['_containerElement']['appendChild'](this['_showMoreButtonView']['element']),this['_showMoreButtonView']['on']('execute',()=>{this['_handleShowMoreButtonClick']();}),jt({'emitter':this['_showMoreBalloonPanelView'],'contextElements':[this['_showMoreBalloonPanelView']['element'],this['_showMoreButtonView']['element']],'callback':()=>this['hideBalloonPanel'](),'activator':()=>this['_showMoreButtonView']['isOn']});}['_createShowMoreButtonView'](){const _0x5ed835=new yt(this['_locale']);_0x5ed835['set']({'label':'','withText':!0x0,'isToggleable':!0x0});const _0x36724f=[this['_config']['cssClasses']['showMoreButton']];return this['_config']['cssClasses']['controlsButton']&&_0x36724f['push'](this['_config']['cssClasses']['controlsButton']),_0x5ed835['extendTemplate']({'attributes':{'class':_0x36724f}}),_0x5ed835;}['_createShowMoreBalloonPanelView'](){const _0x53635c=new zt(this['_locale']);return _0x53635c['extendTemplate']({'attributes':{'class':this['_config']['cssClasses']['showMoreBalloon']}}),this['_bodyCollection']['add'](_0x53635c),_0x53635c;}['_updateBalloonContent'](){if(this['_showMoreBalloonPanelView']&&(this['_showMoreBalloonPanelView']['content']['clear'](),this['_overflowChips']['length']>0x0)){this['_overflowChips']['forEach'](_0x17053d=>{_0x17053d['disableAnimationOnEnter']();});const _0x117557=new Nt(this['_locale']);_0x117557['setTemplate']({'tag':'div','attributes':{'class':this['_config']['cssClasses']['overflowContainer']},'children':this['_overflowChips']}),this['_showMoreBalloonPanelView']['content']['add'](_0x117557);}}['_handleShowMoreButtonClick'](){this['_showMoreButtonView']['isOn']?this['hideBalloonPanel']():this['showBalloonPanel']();}['_updateShowMoreButtonVisibility'](){const _0x29cb1e=this['_overflowChips']['length']>0x0;this['_showMoreButtonView']?.['element']&&(this['_showMoreButtonView']['element']['style']['display']=_0x29cb1e?'':'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'](_0x47c964){const _0x40ba23=this['_containerElement']?.['tagName']['toLowerCase']()||'div',_0x299b74=this['_containerElement']?.['classList'];if(_0x299b74){const _0x8b6307=_0x299b74[0x0]||'',_0x29eedc=_0x47c964['querySelector']('.'+_0x8b6307),_0x440fc2=_0x47c964['querySelector'](_0x40ba23);return _0x29eedc||_0x440fc2||_0x47c964;}return _0x47c964['querySelector'](_0x40ba23)||_0x47c964;}['_calculateContainerWidth'](){const _0x920d5c=this['_parentView']?.['element']||this['_containerElement'];if(!_0x920d5c)return Ys;const _0x17ba78=window['getComputedStyle'](_0x920d5c)['width'];if('auto'===_0x17ba78||'0px'===_0x17ba78||!_0x17ba78){const _0x5abb2d=_0x920d5c['parentElement'];if(_0x5abb2d){const _0x2154ca=window['getComputedStyle'](_0x5abb2d);return'auto'!==_0x2154ca['width']?_0x2154ca['width']:Ys;}return Ys;}return _0x17ba78;}['_applyCalculationStyles'](_0x8607c5,_0x44bf5e){this['_config']['cssClasses']['calculationContainer']&&_0x8607c5['classList']['add'](this['_config']['cssClasses']['calculationContainer']),_0x8607c5['style']['width']=_0x44bf5e,_0x8607c5['style']['position']='absolute',_0x8607c5['style']['top']='-9999px',_0x8607c5['style']['left']='-9999px',_0x8607c5['style']['opacity']='0',_0x8607c5['style']['pointerEvents']='none',_0x8607c5['style']['zIndex']='-1',_0x8607c5['style']['visibility']='visible\x20!important',_0x8607c5['style']['display']='block\x20!important',_0x8607c5['style']['boxSizing']='border-box';}['_restoreAncestorVisibility'](_0x5bd98e){_0x5bd98e['forEach'](({element:_0x3673bb,originalDisplay:_0x5507d5,originalVisibility:_0x1e0db5})=>{_0x3673bb['style']['display']=_0x5507d5,_0x3673bb['style']['visibility']=_0x1e0db5;});}['_makeAncestorsVisible'](_0x918dab){const _0x5ca75c=[];let _0x3f9002=_0x918dab;for(;_0x3f9002&&_0x3f9002!==document['body'];){const _0x195221=window['getComputedStyle'](_0x3f9002);'none'!==_0x195221['display']&&'hidden'!==_0x195221['visibility']||(_0x5ca75c['push']({'element':_0x3f9002,'originalDisplay':_0x3f9002['style']['display'],'originalVisibility':_0x3f9002['style']['visibility']}),_0x3f9002['style']['display']='block',_0x3f9002['style']['visibility']='visible'),_0x3f9002=_0x3f9002['parentElement'];}return _0x5ca75c;}['_createContainerElements'](){let _0x256e39,_0x16056b;return this['_parentView']?.['element']?(_0x256e39=this['_parentView']['element']['cloneNode'](!0x0),_0x16056b=this['_findTargetContainer'](_0x256e39)):(_0x256e39=document['createElement']('div'),_0x16056b=_0x256e39),{'calculationContainer':_0x256e39,'targetContainer':_0x16056b};}['_createCalculationContainer'](){const {calculationContainer:_0x2e333d,targetContainer:_0x449c67}=this['_createContainerElements'](),_0x170179=this['_calculateContainerWidth']();this['_applyCalculationStyles'](_0x2e333d,_0x170179);const _0x1dcc9a=this['_parentView']?.['element']||this['_containerElement'],_0xf57808=_0x1dcc9a?.['parentElement'];_0xf57808?_0xf57808['appendChild'](_0x2e333d):document['body']['appendChild'](_0x2e333d),_0x2e333d['_targetContainer']=_0x449c67;const _0x5b5638=this['_makeAncestorsVisible'](_0xf57808||null);return _0x2e333d['offsetWidth'],_0x2e333d['_ancestorsToRestore']=_0x5b5638,_0x2e333d;}['_calculateOverflowInContainer'](_0x13f32c,_0x4079ea){const _0x4b880e=_0x13f32c['_targetContainer']||_0x13f32c,_0x27bde4=[],{rowCount:_0x1505d9}=this['_renderChipsAndCountRows'](_0x4b880e,_0x4079ea);if(_0x1505d9<=this['_config']['maxVisibleRows'])return _0x27bde4;const _0x2881ab=_0x4079ea['slice']();for(;_0x2881ab['length']>0x0;){if(this['_testButtonFit'](_0x13f32c,_0x4b880e,_0x2881ab)){const _0x49e061=_0x4079ea['filter'](_0x36b42e=>!_0x2881ab['includes'](_0x36b42e));_0x27bde4['push'](..._0x49e061);break;}if(!_0x2881ab['pop']())break;}return _0x27bde4;}['_renderChipsAndCountRows'](_0x32c46a,_0x1f7413){_0x32c46a['innerHTML']='',_0x1f7413['forEach'](_0x2aa650=>{if(_0x2aa650['element']){const _0x3ddb82=_0x2aa650['element']['cloneNode'](!0x0);_0x32c46a['appendChild'](_0x3ddb82);}}),_0x32c46a['offsetWidth'];const _0x211cf7=_0x32c46a['children'],_0x6fd5fb=[];return Array['from'](_0x211cf7)['forEach'](_0x41d3e5=>{const _0x4fa474=_0x41d3e5['getBoundingClientRect']()['top'];_0x6fd5fb['some'](_0x20dd8a=>Math['abs'](_0x20dd8a-_0x4fa474)<this['_config']['rowDetectionTolerance'])||_0x6fd5fb['push'](_0x4fa474);}),{'rowCount':_0x6fd5fb['length']};}['_createMockButton'](){const _0x335992=document['createElement']('button');return _0x335992['className']=this['_config']['cssClasses']['showMoreButton'],this['_config']['cssClasses']['controlsButton']&&_0x335992['classList']['add'](this['_config']['cssClasses']['controlsButton']),_0x335992['textContent']='+\x201',_0x335992;}['_testButtonFit'](_0x1d285c,_0x1b61f7,_0x1c41e2){this['_renderChipsAndCountRows'](_0x1b61f7,_0x1c41e2);const _0x8ce0c8=this['_createMockButton']();_0x1d285c['appendChild'](_0x8ce0c8),_0x1d285c['offsetWidth'];const _0x43ec3f=[..._0x1b61f7['children'],_0x8ce0c8],_0x331501=[];_0x43ec3f['forEach'](_0x4e48cf=>{const _0x2d4f98=_0x4e48cf['getBoundingClientRect']()['top'];_0x331501['some'](_0x10bf5d=>Math['abs'](_0x10bf5d-_0x2d4f98)<this['_config']['rowDetectionTolerance'])||_0x331501['push'](_0x2d4f98);});const _0x1d1a2c=_0x331501['length'];return _0x8ce0c8['remove'](),_0x1d1a2c<=this['_config']['maxVisibleRows'];}['_distributeChips'](_0x5d7c3d,_0x4b3382){this['_visibleChips']['clear'](),this['_overflowChips']['clear'](),_0x5d7c3d['forEach'](_0x27d843=>{_0x4b3382['includes'](_0x27d843)?this['_overflowChips']['add'](_0x27d843):this['_visibleChips']['add'](_0x27d843);});}['_updateOverflowUI'](_0x337c3b){if(_0x337c3b>0x0&&!this['_showMoreButtonView']&&this['_createShowMoreButton'](),_0x337c3b>0x0&&this['_showMoreButtonView']){const _0x44c2e4=''+this['_config']['showMoreLabelPrefix']+(_0x337c3b<0x63?_0x337c3b:'99');this['_showMoreButtonView']['label']=_0x44c2e4;}this['_updateBalloonContent'](),this['_updateShowMoreButtonVisibility'](),this['_repinBalloonPanel']();}['_applyOverflowResults'](_0x484e5d,_0x4c5bbc){this['_distributeChips'](_0x484e5d,_0x4c5bbc),this['_updateOverflowUI'](_0x4c5bbc['length']);}['_setupVisibilityObserver'](){this['_containerElement']&&'undefined'!=typeof IntersectionObserver&&(this['_intersectionObserver']=new IntersectionObserver(_0x143ef9=>{_0x143ef9[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 _0x444a1b=this['_containerElement']['getBoundingClientRect']();if(0x0===_0x444a1b['width']||0x0===_0x444a1b['height'])return!0x1;const _0x9fb428=window['innerHeight']||document['documentElement']['clientHeight'],_0x54fce0=window['innerWidth']||document['documentElement']['clientWidth'],_0x293ad6=0xc8;return _0x444a1b['bottom']>=-0xc8&&_0x444a1b['top']<=_0x9fb428+_0x293ad6&&_0x444a1b['right']>=-0xc8&&_0x444a1b['left']<=_0x54fce0+_0x293ad6;}}const $s='ck-ai-chat__feed__context-chips',qs='ck-ai-chat-context-chips-wrapper',Qs='ck-ai-chat-context-chips-wrapper-balloon',Xs='ck-ai-chat-controls-button',zs='ck-ai-chat-controls_context_show-more-button',js='ck-ai-chat-context-controls__show-more-balloon-panel';class AIChatFeedContextChipsView extends Nt{['_contextChips']=this['createCollection']();['_overflowManager'];['_bodyCollection'];constructor(_0x594d17,_0x34a713,_0x30fcb4){super(_0x594d17),this['_bodyCollection']=_0x30fcb4,this['_createContextChips'](_0x34a713);const _0x13e959={'cssClasses':{'showMoreButton':zs+'\x20'+Gi,'showMoreBalloon':js,'overflowContainer':Qs,'controlsButton':Xs}};this['_overflowManager']=new AIChatChipsOverflowManager(_0x594d17,this['_contextChips'],_0x13e959,this['_bodyCollection'],this),this['setTemplate']({'tag':'div','attributes':{'class':[$s,'ck','ck-reset_all']},'children':[{'tag':'div','attributes':{'class':qs},'children':this['_contextChips']}]});}['render'](){super['render']();const _0x5d568c=this['element']['querySelector']('.'+qs);_0x5d568c&&(this['_overflowManager']['setContainerElement'](_0x5d568c),this['_overflowManager']['reorganizeChips']());}['destroy'](){super['destroy'](),this['_overflowManager']['destroy']();}['_createContextChips'](_0x5938bc){for(const _0x512702 of _0x5938bc){const _0x42936f=new AIChatContextItemButtonView(this['locale'],_0x512702,!0x0,!0x1);this['_contextChips']['add'](_0x42936f);}}}class AIChatFeedUserMessageItemView extends AIChatFeedItemView{['_contextChipsView']=null;['_locale'];['_bodyCollection'];['_messageContentView'];constructor(_0x595698,_0x5412d5,_0x1664bb){super(_0x5412d5),this['_locale']=_0x595698,this['_bodyCollection']=_0x1664bb,this['_createContextChipsView'](),this['_createMessageContentView'](),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__user-message']}});}['_createContextChipsView'](){this['options']['contextItems']&&this['options']['contextItems']['length']>0x0&&(this['_contextChipsView']=new AIChatFeedContextChipsView(this['_locale'],this['options']['contextItems']['filter'](_0x1ced9d=>!_0x1ced9d['hidden']),this['_bodyCollection']),this['_contextChipsView']['extendTemplate']({'attributes':{'class':'ck-ai-chat__feed__context-chips'}}),this['children']['add'](this['_contextChipsView']));}['_createMessageContentView'](){this['_messageContentView']=new Nt(this['_locale']),this['_messageContentView']['setTemplate']({'tag':'div','attributes':{'class':['ck-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']();}}class AIChatFeedInteractionHeaderView extends AIChatFeedItemView{['capabilities'];constructor(_0x5c2530,_0x2baaff){super(_0x2baaff);const {isWebSearchEnabled:_0x4fb55f,isReasoningEnabled:_0x22483b}=_0x2baaff['capabilities'],_0x524a51=[];let _0x1d8059='';_0x4fb55f&&_0x22483b?(_0x1d8059=Mi(_0x5c2530,'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH_REASONING'),_0x524a51['push'](Js(_0x4ead13)),_0x524a51['push'](Js(_0x2df86a))):_0x4fb55f?(_0x1d8059=Mi(_0x5c2530,'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH'),_0x524a51['push'](Js(_0x4ead13))):_0x22483b&&(_0x1d8059=Mi(_0x5c2530,'AI_CHAT_FEED_REPLY_ITEM_USED_REASONING'),_0x524a51['push'](Js(_0x2df86a))),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__interaction-header',_0x1d8059?'':'ck-hidden']}});const _0x264ae6=new Nt();_0x264ae6['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__interaction-header__capabilities']},'children':[..._0x524a51,{'tag':'span','attributes':{'class':['ck-ai-chat__feed__interaction-header__capabilities__text']},'children':[_0x1d8059]}]}),this['children']['add'](_0x264ae6),this['capabilities']=_0x2baaff['capabilities'];}}function Js(_0x26119f){const _0x224d12=new Lt();return _0x224d12['content']=_0x26119f,_0x224d12;}const Zs=['wheel','touchstart','pointerdown','keydown'],tn=['ArrowUp','ArrowDown','PageUp','PageDown','Home','End','\x20'];class ScrollManager{['element'];['animationFrameId'];['isRunning'];['abortController'];['isUserPaused'];['scrollBehavior'];constructor(_0x4b3e8a){this['element']=_0x4b3e8a,this['animationFrameId']=null,this['isRunning']=!0x1,this['abortController']=new AbortController(),this['isUserPaused']=!0x1,this['scrollBehavior']='smooth';for(const _0x183756 of Zs){const _0x3503e1='keydown'!==_0x183756;this['element']['addEventListener'](_0x183756,this['_onUserEvent']['bind'](this),{'passive':_0x3503e1,'signal':this['abortController']['signal']});}}['start']({smooth:_0x254251=!0x0}={}){this['isRunning']||(this['isRunning']=!0x0,this['isUserPaused']=!0x1,this['scrollBehavior']=_0x254251?'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'](_0x114369){if(this['isRunning']){if('keydown'===_0x114369['type']){const _0x721b=_0x114369['key'];if(!tn['includes'](_0x721b))return;}_0x114369 instanceof WheelEvent?_0x114369['deltaY']<0x0?this['isUserPaused']=!0x0:this['isUserPaused']=!this['_isAtBottom']():this['isUserPaused']=!0x0;}}['_isAtBottom'](){const {scrollTop:_0x4dcde3,scrollHeight:_0x113cab,clientHeight:_0x5ec732}=this['element'];return _0x113cab-_0x4dcde3-_0x5ec732<=0x5;}['_rafUpdate'](){this['isRunning']&&(this['isUserPaused']||this['element']['scrollTo']({'top':this['element']['scrollHeight'],'behavior':this['scrollBehavior']}),this['animationFrameId']=requestAnimationFrame(this['_rafUpdate']['bind'](this)));}}class AIChatFeedCustomElementView extends AIChatFeedItemView{constructor(_0xa9b52f){super(_0xa9b52f),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__custom-element']}});}async['render'](){super['render'](),'string'==typeof this['options']['content']?this['element']['innerHTML']=this['options']['content']:this['element']['appendChild'](this['options']['content']);}}class AIChatFeedView extends Nt{['children'];['scrollManager'];['_bodyCollection'];constructor(_0xfb1150,_0x5c6d58){super(_0xfb1150),this['_bodyCollection']=_0x5c6d58,this['set']('loadingMessage',''),this['set']('isLoadingSkeletonVisible',!0x1),this['set']('isTrackChangesOn',!0x1),this['children']=this['createCollection'](),this['children']['delegate'](...Ss)['to'](this),this['_setupTemplate']();}['render'](){super['render'](),this['scrollManager']=new ScrollManager(this['element']);}['destroy'](){super['destroy'](),this['scrollManager']['destroy']();}['clear'](){this['children']['clear']();}['addItem'](_0x365f53,_0x574659){let _0x2943d3;return'ai-reply'===_0x365f53?_0x2943d3=new AIChatFeedReplyItemView(this['locale'],_0x574659,this['_bodyCollection']):'ai-suggestion-reply'===_0x365f53?(_0x2943d3=new AIChatFeedSuggestionItemView(this['locale'],_0x574659,this['_bodyCollection']),_0x2943d3['bind']('isTrackChangesOn')['to'](this)):_0x2943d3='user-message'===_0x365f53?new AIChatFeedUserMessageItemView(this['locale'],_0x574659,this['_bodyCollection']):'interaction-header'===_0x365f53?new AIChatFeedInteractionHeaderView(this['locale'],_0x574659):'custom-element'===_0x365f53?new AIChatFeedCustomElementView(_0x574659):new AIChatFeedErrorItemView(_0x574659),this['children']['add'](_0x2943d3),_0x2943d3;}async['updateReplyItem']({id:_0x168545,parsedContent:_0x4220f4,renderingStrategy:_0x361a20,abortSignal:_0x30e1e9}){const _0x3b1a81=this['getItemById'](_0x168545);if(!(_0x3b1a81 instanceof AIChatFeedReplyItemView))throw new ht('ai-chat-feed-view-item-not-a-reply-item',null,{'itemView':_0x3b1a81,'id':_0x168545,'parsedContent':_0x4220f4});await _0x3b1a81['updateContent']({'parsedContent':_0x4220f4,'renderingStrategy':_0x361a20,'abortSignal':_0x30e1e9});}async['updateWebSources'](_0x441398,_0x2b602e){const _0x31768f=this['getItemById'](_0x441398);if(_0x31768f instanceof AIChatFeedSuggestionItemView)_0x31768f['updateSources'](_0x2b602e);else{if(!(_0x31768f instanceof AIChatFeedReplyItemView))throw new ht('ai-chat-feed-view-item-not-a-suggestion-or-reply-item',null,{'itemView':_0x31768f,'id':_0x441398,'sources':_0x2b602e});_0x31768f['updateSources'](_0x2b602e);}}async['updateSuggestionItem']({id:_0x16168d,parts:_0x122777,abortSignal:_0x5ba0fa,skipLoadingEffects:_0x1b546a}){const _0x1f46cb=this['getItemById'](_0x16168d);if(!(_0x1f46cb instanceof AIChatFeedSuggestionItemView))throw new ht('ai-chat-feed-view-item-not-a-suggestion-item',null,{'itemView':_0x1f46cb,'id':_0x16168d,'parts':_0x122777});await _0x1f46cb['updateContent']({'parts':_0x122777,'abortSignal':_0x5ba0fa,'skipLoadingEffects':_0x1b546a});}['updateSuggestionPartState']({id:_0x39f8ac,index:_0x13dee9,state:_0x3b76db}){const _0x3142aa=this['getItemById'](_0x39f8ac);if(!(_0x3142aa instanceof AIChatFeedSuggestionItemView))throw new ht('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0x39f8ac});_0x3142aa['updatePartState'](_0x13dee9,_0x3b76db);}['setSuggestionPartActive']({id:_0x12ccb4,index:_0x262053,isActive:_0x1b0448}){const _0x2bba4f=this['getItemById'](_0x12ccb4);if(!(_0x2bba4f instanceof AIChatFeedSuggestionItemView))throw new ht('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0x12ccb4});this['children']['filter'](_0x2e97f7=>_0x2e97f7 instanceof AIChatFeedSuggestionItemView)['forEach'](_0x32907b=>{_0x32907b['setPartActive'](!0x1);}),_0x2bba4f['setPartActive'](_0x262053,_0x1b0448);}['markItemAsDone'](_0x5ad02d){this['getItemById'](_0x5ad02d)['markAsDone']();}['getItemIds'](){return this['children']['map'](_0x27560b=>_0x27560b['options']['id']);}['removeItem'](_0x353116){this['children']['remove'](this['getItemById'](_0x353116));}['hasItem'](_0x5bcb66){return!!this['children']['find'](_0x48b32d=>_0x48b32d['options']['id']['includes'](_0x5bcb66));}['scrollToSuggestion'](_0x2e5338,_0x21df2f){const _0x5e701e=this['getItemById'](_0x2e5338);if(!(_0x5e701e instanceof AIChatFeedSuggestionItemView))return void wt('ck-ai-chat-feed-view-scroll-to-suggestion-invalid-item',{'replyId':_0x2e5338,'partIndex':_0x21df2f});const _0x2bd175=_0x5e701e['getPartView'](_0x21df2f);_0x2bd175?Rt(_0x2bd175['element'],0x14,this['element']['parentElement'],!0x0,!0x0):wt('ck-ai-chat-feed-view-scroll-to-suggestion-part-view-not-found',{'replyId':_0x2e5338,'partIndex':_0x21df2f});}['_setupTemplate'](){this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed']},'children':this['_createTemplateChildren']()});}['_createTemplateChildren'](){const _0x14b61b=this['_createSkeletonLoader']();return[this['_createFeedItems'](),_0x14b61b,this['_createFeedLoader']()];}['_createSkeletonLoader'](){const _0x4d30b5=new AISkeletonView(this['locale'],xs['aiFeed']);return _0x4d30b5['bind']('isVisible')['to'](this,'isLoadingSkeletonVisible'),_0x4d30b5;}['_createFeedItems'](){const _0x469f9e=new Nt(this['locale']);return _0x469f9e['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__items',this['bindTemplate']['if']('isLoadingSkeletonVisible','ck-hidden')]},'children':this['children']}),_0x469f9e;}['_createFeedLoader'](){const _0x403aef=new Nt(this['locale']);return _0x403aef['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__loader',this['bindTemplate']['if']('loadingMessage','ck-hidden',_0x38a04f=>!_0x38a04f)]},'children':this['_createLoaderChildren']()}),_0x403aef;}['_createLoaderChildren'](){const _0x4df553=new AISpinnerView();return _0x4df553['isVisible']=!0x0,[_0x4df553,{'tag':'span','attributes':{'class':['ck','ck-ai-chat__loader-text']},'children':[{'text':this['bindTemplate']['to']('loadingMessage')}]}];}['getItemById'](_0x38334d){const _0x18e0b2=this['children']['find'](_0x2ef05d=>_0x2ef05d['options']['id']['includes'](_0x38334d));if(!_0x18e0b2)throw new ht('ai-chat-feed-view-item-not-found',this,{'id':_0x38334d});return _0x18e0b2;}['setLoadingMessage'](_0x19e995){this['set']('loadingMessage',_0x19e995);}['toggleLoadingSkeleton'](_0x4b8954){this['set']('isLoadingSkeletonVisible',_0x4b8954);}['startAutoScroll'](_0x79d2aa={}){this['scrollManager']['start'](_0x79d2aa);}['stopAutoScroll'](){this['scrollManager']['stop']();}}class AIChatPromptSuggestionsListView extends Dt{['filter'](){let _0x35fef1=0x0;for(const _0xec5ed1 of this['items'])_0x35fef1+=_0xec5ed1['items']['length'];return{'resultsCount':_0x35fef1,'totalItemsCount':_0x35fef1};}}function en(_0x12b937){const _0x326536=[];let _0xe8d9bc=!0x1;for(const _0x400d0f of Array['from'](_0x12b937['items'])){if('file'!==_0x400d0f['kind'])continue;const _0x35ed23=_0x400d0f['webkitGetAsEntry']();if(_0x35ed23?.['isDirectory']){_0xe8d9bc=!0x0;continue;}const _0x287e41=_0x400d0f['getAsFile']();_0x287e41&&_0x326536['push'](_0x287e41);}return{'files':_0x326536,'hasDirectory':_0xe8d9bc};}const sn='ck-ai-chat__prompt-input_highlighted';class AIChatPromptInputView extends Pt{['submitButtonView'];static ['MIN_ROWS']=0x1;static ['MAX_ROWS']=0xc;['_addContextButtonView'];['_queryViewResizeObserver'];constructor(_0x4fbb84,_0x56d3a5){super(_0x4fbb84,{'queryView':{'label':'','creator':Bt,'showIcon':!0x1,'showResetButton':!0x1},'filteredView':new AIChatPromptSuggestionsListView(_0x4fbb84),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1}),this['set']('isEmpty',!0x0),this['set']('isUploadInProgress',!0x1),this['_addContextButtonView']=_0x56d3a5,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',(_0x2eb004,_0x30daeb)=>!_0x2eb004&&!_0x30daeb),this['focusableChildren']['add'](this['submitButtonView']);}['render'](){super['render'](),this['queryView']['fieldWrapperChildren']['add'](this['submitButtonView']),this['keystrokes']['set']('enter',(_0x14f395,_0x17d87e)=>{this['isUploadInProgress']||this['isEmpty']||_0x14f395['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x17d87e());}),this['queryView']['fieldView']['on']('update',()=>{this['isEmpty']=''===this['queryView']['fieldView']['element']['value']?.['trim']();}),this['queryView']['fieldView']['element']['addEventListener']('paste',_0x51f14c=>this['_handlePaste'](_0x51f14c)),this['element']['addEventListener']('drop',_0x2a4aee=>this['_handleDrop'](_0x2a4aee));}['_handlePaste'](_0x55b08a){const _0x3fcafd=_0x55b08a['clipboardData'];if(!_0x3fcafd)return;const {files:_0x54151a,hasDirectory:_0x177289}=en(_0x3fcafd),_0x2871f2={'files':_0x54151a,'plainText':_0x3fcafd['getData']('text/plain'),'hasDirectory':_0x177289,'forceTextAttachment':!0x1,'preventDefault':()=>_0x55b08a['preventDefault']()};this['fire']('promptInputPaste',_0x2871f2);}['_handleDrop'](_0x944e94){const _0x4d5b76=_0x944e94['dataTransfer'];if(!_0x4d5b76)return;const _0x2d2dce={'files':[],'plainText':_0x4d5b76['getData']('text/uri-list')||_0x4d5b76['getData']('text/plain'),'hasDirectory':!0x1,'forceTextAttachment':!0x1,'preventDefault':()=>_0x944e94['preventDefault']()};this['fire']('promptInputPaste',_0x2d2dce);}['destroy'](){super['destroy'](),this['_queryViewResizeObserver']&&this['_queryViewResizeObserver']['destroy']();}['submit'](){const _0x108cb3=this['queryView']['fieldView']['element']['value']?.['trim']();if(!_0x108cb3)return this['queryView']['errorText']=Mi(this['locale'],'AI_CHAT_PROMPT_EMPTY_ERROR'),void(this['queryView']['fieldView']['hasError']=!0x0);this['queryView']['fieldView']['hasError']=!0x1;const _0x3b114d=_0x57a263(_0x108cb3);this['fire']('sendUserMessage',_0x3b114d),this['queryView']['fieldView']['reset']();}['setPlaceholderText'](_0x17bf94){this['queryView']['fieldView']['set']('placeholder',_0x17bf94);}['focus'](_0x59cac5=!0x1){super['focus'](),_0x59cac5&&(this['element']['classList']['contains'](sn)||(this['element']['classList']['add'](sn),setTimeout(()=>{this['element']['classList']['remove'](sn);},0x320)));}['_createSubmitButton'](){const _0x214d60=new yt(this['locale']);return _0x214d60['set']({'icon':_0x19b8a2,'label':Mi(this['locale'],'AI_CHAT_LABEL_SUBMIT'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-chat__prompt-submit-button\x20'+Ui,'isEnabled':!0x1}),_0x214d60['on']('execute',()=>{this['submit']();}),_0x214d60;}['setIsUploadInProgress'](_0x51afa8){this['isUploadInProgress']=_0x51afa8;}['_setUpAddContextButtonPositioning'](){const _0x132192=this['locale'],_0x3141bd=()=>{lt['window']['requestAnimationFrame'](()=>{if(ut(this['element'])){const _0x10732f=new dt(this['queryView']['fieldView']['element']),_0x20f735=new dt(this['_addContextButtonView']['element']),_0x3d0501=_0x10732f['width'],_0x4caa20='rtl'===_0x132192['uiLanguageDirection']?'right':'left';_0x10732f['excludeScrollbarsAndBorders']();const _0x106db5=_0x3d0501-_0x10732f['width']+0x1;this['_addContextButtonView']['element']['style'][_0x4caa20]='calc('+(_0x3d0501-_0x20f735['width']-_0x106db5)+'px\x20-\x20var(--ck-spacing-tiny))';}});};this['queryView']['fieldView']['on']('update',_0x3141bd),this['on']('render',()=>{_0x3141bd(),this['_queryViewResizeObserver']=new bt(this['queryView']['fieldView']['element'],()=>{_0x3141bd();});});}}class AIChatDropZoneView extends Nt{constructor(_0x46785a){super(_0x46785a);const _0x4d38ac=new Lt();_0x4d38ac['content']=_0x5cbefc,this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-controls__drop-overlay']},'children':[_0x4d38ac,{'tag':'span','attributes':{'class':['ck-ai-chat-controls__drop-overlay__label']},'children':[{'text':Mi(_0x46785a,'AI_CHAT_DROP_ZONE_HINT')}]}]});}['attach'](_0x3d101f){let _0x25453c=0x0;_0x3d101f['addEventListener']('dragenter',_0x27ce79=>{_0x27ce79['dataTransfer']&&(_0x25453c++,0x1===_0x25453c&&this['fire']('dragEnter'),_0x3d101f['classList']['add']('ck-ai-chat-controls_drag-over'));}),_0x3d101f['addEventListener']('dragover',_0x15e66f=>{_0x15e66f['dataTransfer']&&_0x15e66f['preventDefault']();}),_0x3d101f['addEventListener']('dragleave',()=>{--_0x25453c<=0x0&&(_0x25453c=0x0,_0x3d101f['classList']['remove']('ck-ai-chat-controls_drag-over'));}),_0x3d101f['addEventListener']('drop',_0x47a647=>{_0x47a647['preventDefault'](),_0x25453c=0x0,_0x3d101f['classList']['remove']('ck-ai-chat-controls_drag-over'),this['_handleDrop'](_0x47a647);});}['_handleDrop'](_0x1f01fa){const _0x23c537=_0x1f01fa['dataTransfer'];if(!_0x23c537)return;const {files:_0x30d859,hasDirectory:_0x49d34d}=en(_0x23c537),_0x33a234={'files':_0x30d859,'plainText':_0x23c537['getData']('text/uri-list')||_0x23c537['getData']('text/plain'),'hasDirectory':_0x49d34d,'forceTextAttachment':!0x0,'preventDefault':()=>{}};this['fire']('promptInputPaste',_0x33a234);}}const nn='ck-ai-chat__prompt-capabilities',rn='ck-ai-chat-controls-button',on='ck-ai-chat-controls-button--commands',an='ck-ai-chat-controls__model-selection',hn='ck-ai-chat-controls__model-selection__item-name',cn='ck-ai-chat-controls__model-selection__item-description',ln='ck-ai-chat-controls__model-selection__item-capabilities',un='n';class AIChatPromptCapabilitiesView extends Nt{['_webSearchButton'];['_reasoningButton'];['_commandsButton'];['_modelSelectionDropdown'];['_modelSelectionDropdownItems'];['_modelNameView'];constructor(_0x55f8d9){super(_0x55f8d9),this['set']('webSearchActive',!0x1),this['set']('reasoningActive',!0x1),this['set']('modelDisplayMode','selector'),this['set']('modelSelectorEnabled',!0x0),this['set']('activeModelId',null),this['set']('activeModelName',null),this['_modelSelectionDropdown']=this['_createModelSelectionDropdown'](),this['_modelNameView']=this['_createModelNameView'](),this['_webSearchButton']=this['_createWebSearchButton'](),this['_reasoningButton']=this['_createReasoningButton'](),this['_commandsButton']=this['_createCommandsButton'](),this['_modelSelectionDropdown']['buttonView']['bind']('isVisible')['to'](this,'modelDisplayMode',_0x519901=>'selector'===_0x519901),this['_modelSelectionDropdown']['buttonView']['bind']('tooltip')['to'](this,'modelSelectorEnabled',_0x313867=>_0x313867?this['_modelSelectionDropdown']['buttonView']['label']:Mi(this['locale'],'AI_CHAT_MODEL_SELECTOR_DISABLED_TOOLTIP')),this['_modelSelectionDropdown']['bind']('isEnabled')['to'](this,'modelSelectorEnabled',_0x21c76a=>_0x21c76a),this['_webSearchButton']['bind']('isOn')['to'](this,'webSearchActive',_0x5e8fcf=>_0x5e8fcf),this['_webSearchButton']['bind']('tooltip')['to'](this,'webSearchActive',_0x103696=>Mi(this['locale'],_0x103696?'AI_CHAT_DISABLE_WEB_SEARCH':'AI_CHAT_ENABLE_WEB_SEARCH')),this['_reasoningButton']['bind']('isOn')['to'](this,'reasoningActive',_0x5a8d9d=>_0x5a8d9d),this['_reasoningButton']['bind']('tooltip')['to'](this,'reasoningActive',_0x171ef9=>Mi(this['locale'],_0x171ef9?'AI_CHAT_DISABLE_REASONING':'AI_CHAT_ENABLE_REASONING')),this['setTemplate']({'tag':'div','attributes':{'class':[nn]},'children':[this['_modelSelectionDropdown'],this['_modelNameView'],this['_webSearchButton'],this['_reasoningButton'],this['_commandsButton']]}),this['_modelSelectionDropdownItems']=new _t(),Jt(this['_modelSelectionDropdown'],this['_modelSelectionDropdownItems']);}['setModelList'](_0x3994aa,_0x54d4c4){if(_0x54d4c4)this['set']('modelDisplayMode','hidden');else{const _0x2bed3c=0x1===_0x3994aa['length'];this['set']('modelDisplayMode',_0x2bed3c?'name':'selector');}if(this['_modelSelectionDropdownItems']['clear'](),_0x3994aa?.['length'])for(const _0x28799e of _0x3994aa){const _0x2817fd=new Zt({'label':_0x28799e['name'],'withText':!0x0,'role':'menuitemradio','id':_0x28799e['id'],'model':_0x28799e});_0x2817fd['bind']('isOn')['to'](this,'activeModelId',_0xf43dcf=>_0xf43dcf===_0x28799e['id']),this['_modelSelectionDropdownItems']['add']({'type':'button','model':_0x2817fd,'labelView':new dn(this['locale'],_0x28799e)});}}['setWebSearch'](_0x340b1a){this['set']('webSearchActive',_0x340b1a);}['setReasoning'](_0x3e51ef){this['set']('reasoningActive',_0x3e51ef);}['setModel'](_0x2146e6){if(!_0x2146e6)return;this['activeModelId']=_0x2146e6['id'],this['activeModelName']=_0x2146e6['name']||_0x2146e6['id'],this['_modelSelectionDropdown']['buttonView']['set']('label',_0x2146e6['name']),this['_modelSelectionDropdown']['buttonView']['set']('tooltip',_0x2146e6['name']);const _0x2f2f0b=_0x2146e6['capabilities']['webSearch']?.['enabled']??!0x1;this['set']('webSearchActive',!0x1),this['_webSearchButton']['set']('isOn',!0x1),this['_webSearchButton']['set']('isEnabled',_0x2f2f0b),this['_webSearchButton']['set']('isVisible',_0x2f2f0b);const _0x277a42=_0x2146e6['capabilities']['reasoning']?.['enabled']??!0x1;this['set']('reasoningActive',!0x1),this['_reasoningButton']['set']('isOn',!0x1),this['_reasoningButton']['set']('isEnabled',_0x277a42),this['_reasoningButton']['set']('isVisible',_0x277a42);}['enableModelSelector'](){this['set']('modelSelectorEnabled',!0x0);}['disableModelSelector'](_0x100ddd){this['set']('modelSelectorEnabled',!0x1),_0x100ddd&&this['set']('modelDisplayMode','hidden');}['_createWebSearchButton'](){const _0x150da9=new yt();return _0x150da9['set']({'label':Mi(this['locale'],'AI_CHAT_SEARCH_WEB'),'icon':_0x4ead13,'class':rn+'\x20'+Gi,'isToggleable':!0x0,'tooltipPosition':un}),_0x150da9['on']('execute',()=>{this['fire']('toggleWebSearch');}),_0x150da9;}['_createReasoningButton'](){const _0x3f1b77=new yt();return _0x3f1b77['set']({'label':Mi(this['locale'],'AI_CHAT_REASONING'),'icon':_0x2df86a,'class':rn+'\x20'+Gi,'isToggleable':!0x0,'tooltipPosition':un}),_0x3f1b77['on']('execute',()=>{this['fire']('toggleReasoning');}),_0x3f1b77;}['_createCommandsButton'](){const _0x550156=new yt();return _0x550156['set']({'label':Mi(this['locale'],'AI_CHAT_COMMANDS'),'icon':_0x1e19d7,'withText':!0x0,'class':rn+'\x20'+Gi,'isToggleable':!0x0,'tooltip':Mi(this['locale'],'AI_CHAT_COMMANDS'),'tooltipPosition':un}),_0x550156['extendTemplate']({'attributes':{'class':[on]}}),_0x550156['on']('execute',()=>{console['log']('Commands\x20are\x20not\x20implemented\x20yet.'),alert('Commands\x20are\x20not\x20implemented\x20yet.');}),_0x550156;}['_createModelSelectionDropdown'](){const _0x3a2cac=Ft(this['locale']);return _0x3a2cac['set']({'panelPosition':'ne','class':[an]}),_0x3a2cac['buttonView']['set']({'label':Mi(this['locale'],'AI_CHAT_MODEL_SELECTOR_ENABLED_TOOLTIP'),'withText':!0x0,'tooltip':!0x0,'tooltipPosition':un,'class':Gi}),this['listenTo'](_0x3a2cac,'execute',_0x2c3046=>{this['fire']('selectModel',_0x2c3046['source']['model']);}),_0x3a2cac;}['_createModelNameView'](){const _0x78794e=new _n(this['locale']);return _0x78794e['bind']('text')['to'](this,'activeModelName',_0x3ff94e=>_0x3ff94e??''),_0x78794e['bind']('isVisible')['to'](this,'modelDisplayMode',_0x511fba=>'name'===_0x511fba),_0x78794e;}}let dn=class ModelButtonLabelView extends Mt{constructor(_0xe5b389,_0x40f226){super();const _0x2e6a28=this['bindTemplate'],_0x464317=this['createCollection']();this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-button__label'],'style':_0x2e6a28['to']('style'),'id':_0x2e6a28['to']('id')},'children':[{'tag':'div','attributes':{'class':[hn]},'children':[{'text':_0x2e6a28['to']('text')}]},{'tag':'div','attributes':{'class':[cn]},'children':[{'tag':'span','children':[{'text':_0x40f226['description']}]}]},{'tag':'div','attributes':{'class':[ln]},'children':_0x464317}]}),_0x464317['addMany'](this['_getCapabilityParts'](_0xe5b389,_0x4ead13,'AI_CHAT_SEARCH_WEB',_0x40f226['capabilities']['webSearch']?.['enabled']??!0x1)),_0x464317['addMany'](this['_getCapabilityParts'](_0xe5b389,_0x2df86a,'AI_CHAT_REASONING',_0x40f226['capabilities']['reasoning']?.['enabled']??!0x1));}['_getCapabilityParts'](_0xd64ae,_0x352f58,_0x1bbe25,_0x394a26){const _0x448975=new Lt();_0x448975['content']=_0x352f58;const _0x4c7b57=new Nt(_0xd64ae);_0x4c7b57['setTemplate']({'tag':'span','children':[{'text':Mi(_0xd64ae,_0x1bbe25)+':\x20'}]});const _0x173739=new Nt(_0xd64ae);return _0x173739['setTemplate']({'tag':'span','children':[{'text':Mi(_0xd64ae,_0x394a26?'AI_CHAT_CAPABILITIES_YES':'AI_CHAT_CAPABILITIES_NO')}]}),[_0x448975,_0x4c7b57,_0x173739];}},_n=class ModelNameView extends Nt{constructor(_0x525b60){super(_0x525b60),this['set']('text',void 0x0),this['set']('isVisible',!0x0);const _0x393ca7=this['bindTemplate'];this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-chat-controls__model-name',_0x393ca7['if']('isVisible','ck-hidden',_0x433a8e=>!_0x433a8e)]},'children':[{'text':_0x393ca7['to']('text')}]});}};const In='ck-ai-chat-context-controls__url-form',An='ck-ai-chat-context-controls__url-input-section';class AIChatContextPanelUrlInputView extends Nt{['focusTracker'];['keystrokes'];['_focusables'];['focusCycler'];['urlInputField'];['backButton'];['confirmButton'];constructor(_0x88b2b7){super(_0x88b2b7),this['focusTracker']=new It(),this['keystrokes']=new At(),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 Ut({'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'](_0x3dfdc1=>{this['focusTracker']['add'](_0x3dfdc1['element']),this['keystrokes']['listenTo'](_0x3dfdc1['element']);}),te({'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'](_0x5bbf6a){this['urlInputField']['errorText']=_0x5bbf6a,this['_updateConfirmButtonState'](),this['fire']('refreshBalloon');}['clearError'](){this['urlInputField']['errorText']=null,this['_updateConfirmButtonState']();}['_createBackButton'](){const _0x2092a9=new yt(this['locale']);return _0x2092a9['set']({'icon':_0x2b56fa,'tooltip':Mi(this['locale'],'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT'),'tooltipPosition':'n','class':['ck-button-icon\x20ck-button-back']}),this['on']('change:withBackButton',(_0x44d09a,_0x52aa34,_0x499c05)=>{_0x2092a9['set']({'class':['ck-button-icon\x20ck-button-back'+(_0x499c05?'':'\x20ck-hidden')]});}),_0x2092a9;}['_createUrlInputField'](){const _0x4f1f68=new _0x3d6c8e(this['locale'],_0x2d02ce);return _0x4f1f68['set']({'label':Mi(this['locale'],'AI_CHAT_CONTEXT_URL_LABEL'),'class':'ck-labeled-field-view_empty'}),_0x4f1f68['fieldView']['set']({'placeholder':Mi(this['locale'],'AI_CHAT_CONTEXT_URL_PLACEHOLDER')}),_0x4f1f68;}['_createConfirmButton'](){const _0xe35914=new yt(this['locale']);return _0xe35914['set']({'icon':_0x379fc9,'tooltip':Mi(this['locale'],'AI_CHAT_CONTEXT_URL_ADD_URL'),'tooltipPosition':'n','class':'ck-button-icon','type':'submit','isEnabled':!0x1}),_0xe35914;}['_setupTemplate'](){const _0x224f0a=new _0xafeff5(this['locale'],{'label':Mi(this['locale'],'AI_CHAT_CONTEXT_URL_ADD_URL'),'class':'ck-ai-header\x20ck-ai-header_small\x20ck-ai-header_context-url'});_0x224f0a['children']['add'](this['backButton'],0x0),this['setTemplate']({'tag':'form','attributes':{'class':In,'tabindex':'-1'},'children':[_0x224f0a,{'tag':'div','attributes':{'class':An},'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',_0x39793d=>{_0x39793d['stop'](),this['_handleSubmit']();});}['_setupKeystrokes'](){this['keystrokes']['set']('esc',(_0x6c687f,_0x113969)=>{this['clear'](),this['fire']('cancel'),_0x113969();});}['_handleSubmit'](){const _0x2c626e=this['getValue']()['trim']();_0x2c626e?this['_isValidUrl'](_0x2c626e)?(this['clearError'](),this['fire']('submitUrl',_0x2c626e)):this['setError'](Mi(this['locale'],'AI_CHAT_CONTEXT_URL_INVALID_ERROR')):this['setError'](Mi(this['locale'],'AI_CHAT_CONTEXT_URL_EMPTY_ERROR'));}['_updateConfirmButtonState'](){const _0x2d490d=this['getValue']()['trim'](),_0xb2a182=!!this['urlInputField']['errorText'];this['confirmButton']['isEnabled']=_0x2d490d['length']>0x0&&!_0xb2a182;}['_isValidUrl'](_0x2fef57){try{return!!new URL(_0x2fef57);}catch{return!0x1;}}}const gn='ck-ai-chat-resources__item',wn='ck-ai-chat-resources__item--in-context',Cn='ck-ai-chat-resources__item-title',mn='ck-ai-chat-resources__item__icon';class AIChatResourceListItemView extends Ht{['resource'];['_titleView'];['_iconView'];constructor(_0x738de7,_0x3e408f){super(_0x738de7),this['resource']=_0x3e408f,this['set']('isInContext',!!_0x3e408f['isInContext']),this['_titleView']=this['_createTitleView'](),this['_iconView']=this['_createIconView'](),this['_setupTemplate']();}['render'](){super['render']();}['getResourceIcon'](_0x592933){if(_0x592933['isInContext'])return _0x379fc9;switch(_0x592933['type']){case'document':return _0x3702e6;case'web-resource':return _0x3ed1af;case'file':case'text':return _0x5cbefc;default:return _0x108bb1;}}['highlightText'](_0x32cac5){if(!_0x32cac5||''===_0x32cac5['trim']())return void this['_titleView']['highlightText'](null);const _0x2f10c4=new RegExp(_0x330c80(_0x32cac5),'gi');this['_titleView']['highlightText'](_0x2f10c4);}['updateResourceState'](_0x97a8c8){this['resource']['isInContext']=_0x97a8c8,this['isInContext']=_0x97a8c8,this['_updateIcon']();}['_createTitleView'](){const _0x18bc7a=new _0x5a7c84();return _0x18bc7a['text']=this['resource']['label'],_0x18bc7a['extendTemplate']({'tag':'span','attributes':{'class':[Cn]}}),_0x18bc7a;}['_createIconView'](){const _0xed89e1=new Lt();return _0xed89e1['content']=this['getResourceIcon'](this['resource']),_0xed89e1;}['_setupTemplate'](){const _0x31ca23=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':[gn,_0x31ca23['if']('isVisible','ck-hidden',_0x1b12b8=>!_0x1b12b8),_0x31ca23['if']('isInContext',wn)]},'children':[{'tag':'div','attributes':{'class':[mn]},'children':[this['_iconView']]},this['_titleView']],'on':{'click':_0x31ca23['to']('execute')}});}['_updateIcon'](){this['_iconView']['content']=this['getResourceIcon'](this['resource']);}}const pn='ck-ai-chat-resources__list';class AIChatContextResourcesListView extends Dt{['_source'];constructor(_0x2ac2a1,_0x53f8d9){super(_0x2ac2a1),this['_source']=_0x53f8d9,this['extendTemplate']({'attributes':{'class':[pn]}});}['setResources'](_0x3ea95e,_0x19731){this['items']['clear']();let _0x2b2b79=_0x3ea95e;if(this['_source']['useDefaultFiltering']&&_0x19731&&''!==_0x19731['trim']()){const _0x568165=new RegExp(_0x19731['replace'](/[.*+?^${}()|[\]\\]/g,'\x5c$&'),'gi');_0x2b2b79=_0x3ea95e['filter'](_0x1a69a9=>_0x568165['test'](_0x1a69a9['label']));}for(const _0x3aa487 of _0x2b2b79){const _0x53a697=new AIChatResourceListItemView(this['locale'],_0x3aa487);_0x53a697['on']('execute',()=>{this['_handleResourceSelection'](this['_source'],_0x3aa487);}),this['items']['add'](_0x53a697);}this['_source']['useDefaultFiltering']&&this['highlightText'](_0x19731);}['highlightText'](_0x3e9f91){this['_source']['useDefaultFiltering']&&this['items']['forEach'](_0x135cff=>{_0x135cff['highlightText'](_0x3e9f91);});}['updateResourceState'](_0x2d908c,_0x420944){for(const _0x180cbf of this['items']){const _0x50b946=_0x180cbf;_0x50b946['resource']['id']===_0x2d908c&&_0x50b946['updateResourceState'](_0x420944);}}['_handleResourceSelection'](_0x24c077,_0x461326){this['fire']('addResourceToContext',{'source':_0x24c077,'resource':_0x461326});}}class AIChatContextResourcesSearchInputView extends _0x3d6c8e{['iconView'];['resetButtonView'];['_viewConfig'];constructor(_0x3397fe){const t=_0x3397fe['t'],_0x1b2f4d={'showResetButton':!0x0,'showIcon':!0x0,'creator':_0x2d02ce,'label':Mi(_0x3397fe,'AI_CHAT_SEARCH_RESOURCES')};super(_0x3397fe,_0x1b2f4d['creator']),this['label']=_0x1b2f4d['label'],this['_viewConfig']=_0x1b2f4d,this['_viewConfig']['showIcon']&&this['_setupSearchIcon'](),this['_viewConfig']['showResetButton']&&this['_setupResetButton'](_0x3397fe,t),this['_setupEventListeners']();}['reset'](){this['fieldView']['reset'](),this['_viewConfig']['showResetButton']&&this['resetButtonView']&&(this['resetButtonView']['isVisible']=!0x1),this['search']('');}['search'](_0x16b192){this['fire']('search',_0x16b192);}['getQuery'](){return this['fieldView']['element']?.['value']||'';}['_setupSearchIcon'](){this['iconView']=new Lt(),this['iconView']['content']=_0x381604,this['fieldWrapperChildren']['add'](this['iconView'],0x0),this['extendTemplate']({'attributes':{'class':'ck-search__query_with-icon'}});}['_setupResetButton'](_0x574faa,t){this['resetButtonView']=new yt(_0x574faa),this['resetButtonView']['set']({'label':t('Clear'),'icon':_0x36e8b7,'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',_0x395ed2=>!_0x395ed2),this['fieldWrapperChildren']['add'](this['resetButtonView']),this['extendTemplate']({'attributes':{'class':'ck-search__query_with-reset'}});}['_setupEventListeners'](){this['listenTo'](this['fieldView'],'input',()=>{this['search'](this['fieldView']['element']['value']);}),this['bind']('isEnabled')['to'](this);}}class AIChatContextResourcesView extends Nt{['_searchView'];['_searchSection'];['_searchInputVisibleFrom'];['_resourcesListView'];['_skeletonLoader'];['_source'];['children'];['_latestLoadResourcesUid']=null;constructor(_0xb60341,_0xca7691){super(_0xb60341),this['_source']=_0xca7691['source'],this['_searchInputVisibleFrom']=_0xca7691['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 _0x327646([this['_skeletonLoader'],this['_resourcesListView']]),this['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-chat-resources'},'children':this['children']});}['_createSearchView'](){return new AIChatContextResourcesSearchInputView(this['locale']);}['_createSearchSection'](){const _0x105662=new Nt(this['locale']);return _0x105662['setTemplate']({'tag':'div','attributes':{'class':'ck\x20ck-search'},'children':[this['_searchView']]}),this['_searchView']['on']('search',(_0x5cd862,_0x3902a3)=>{this['loadResources'](_0x3902a3),this['_source']['useDefaultFiltering']&&this['_resourcesListView']['highlightText'](_0x3902a3);}),_0x105662;}['_createResourcesListView'](){const _0x2baec6=new AIChatContextResourcesListView(this['locale'],this['_source']);return _0x2baec6['delegate']('addResourceToContext')['to'](this),_0x2baec6['extendTemplate']({'attributes':{'class':this['bindTemplate']['if']('isLoading','ck-hidden')}}),_0x2baec6;}['_createSkeletonView'](){const _0x1a48c8=new AISkeletonView(this['locale'],xs['aiChatResources']);return _0x1a48c8['bind']('isVisible')['to'](this,'isLoading'),_0x1a48c8;}['render'](){super['render'](),this['loadResources']('');}['loadResources'](_0x50a6c6){const _0x2cba3c=at();this['_latestLoadResourcesUid']=_0x2cba3c,this['fire']('loadSourceResources',{'sourceId':this['_source']['id'],'query':_0x50a6c6,'uid':_0x2cba3c}),this['isLoading']=!0x0;}['setResources'](_0x5e5362,_0x3195a2){if(_0x3195a2&&_0x3195a2!==this['_latestLoadResourcesUid'])return;const _0x1e4772=this['_source']['useDefaultFiltering']?this['_searchView']['getQuery']():'';this['_resourcesListView']['setResources'](_0x5e5362,_0x1e4772),_0x5e5362['length']>=this['_searchInputVisibleFrom']&&!this['children']['has'](this['_searchSection'])&&this['children']['add'](this['_searchSection'],0x0),requestAnimationFrame(()=>{this['isLoading']=!0x1;});}['updateResourceState'](_0x2e00fd,_0x24b6e6){this['_resourcesListView']['updateResourceState'](_0x2e00fd,_0x24b6e6);}}const En='ck-ai-chat-context-controls__source-balloon-panel',Tn='ck-button-icon\x20ck-button-back',fn='ck-ai-header\x20ck-ai-header_small\x20ck-ai-header_source';class AIChatResourcesBalloonView{['_sourceResourceBalloons']=new Map();['_bodyCollection'];['_locale'];['_config'];constructor(_0x5b216e,_0x29848a,_0x1ff509){this['_locale']=_0x5b216e,this['_bodyCollection']=_0x29848a,this['_config']=_0x1ff509;}['showSourceResourcesBalloon']({source:_0x2f9be5,withBackButton:_0x2fb065}){let _0x253251=this['_sourceResourceBalloons']['get'](_0x2f9be5['id']);_0x253251||(_0x253251=this['_createSourceResourceBalloonPanel'](),this['_sourceResourceBalloons']['set'](_0x2f9be5['id'],_0x253251),this['_setupSingleResourceBalloonClickOutsideHandler'](_0x253251)),this['_addSourceResourceContent']({'balloonPanel':_0x253251,'source':_0x2f9be5,'withBackButton':_0x2fb065}),_0x253251['show']();const _0x393211=this['_config']['getTargetElement']();_0x393211&&_0x253251['pin']({'target':_0x393211,'limiter':this['_config']['getLimiterElement']()});}['populateSourceResourceBalloon'](_0x3bb1ec,_0x560781,_0x497316){const _0x17b201=this['_sourceResourceBalloons']['get'](_0x3bb1ec);if(!_0x17b201)return;const _0xca2d3e=this['_getResourcesViewFromBalloon'](_0x17b201);_0xca2d3e&&(_0xca2d3e['setResources'](_0x560781,_0x497316),_0xca2d3e['once']('change:isLoading',()=>{_0x17b201['pin']({'target':this['_config']['getTargetElement'](),'limiter':this['_config']['getLimiterElement']()});}));}['closeSourceResourceBalloon'](_0x2303f4){const _0x56a0d6=this['_sourceResourceBalloons']['get'](_0x2303f4);_0x56a0d6&&requestAnimationFrame(()=>{_0x56a0d6['hide'](),this['_sourceResourceBalloons']['delete'](_0x2303f4),this['_config']['onBalloonClosed']();});}['closeAll'](){for(const _0x1dcc88 of Array['from'](this['_sourceResourceBalloons']['keys']()))this['closeSourceResourceBalloon'](_0x1dcc88);}['isAnyResourceBalloonVisible'](){for(const _0x27d909 of this['_sourceResourceBalloons']['values']())if(_0x27d909['isVisible'])return!0x0;return!0x1;}['updateResourceState'](_0x481ddf,_0x1d8b4f,_0x36c53a){const _0x247c9f=this['_sourceResourceBalloons']['get'](_0x481ddf);if(!_0x247c9f||!_0x247c9f['isVisible'])return;const _0x147ee0=this['_config']['getTargetElement']();if(!_0x147ee0)return;_0x247c9f['pin']({'target':_0x147ee0,'limiter':this['_config']['getLimiterElement']()});const _0x25ac1e=this['_getResourcesViewFromBalloon'](_0x247c9f);_0x25ac1e&&_0x25ac1e['updateResourceState'](_0x1d8b4f,_0x36c53a);}['destroy'](){for(const _0x15bb71 of this['_sourceResourceBalloons']['values']())_0x15bb71['destroy']();this['_sourceResourceBalloons']['clear']();}['_createSourceResourceBalloonPanel'](){const _0x41f97f=new zt(this['_locale']);return _0x41f97f['extendTemplate']({'attributes':{'class':En}}),this['_bodyCollection']['add'](_0x41f97f),_0x41f97f;}['_addSourceResourceContent']({balloonPanel:_0x3c4dca,source:_0x5e8277,withBackButton:_0x2d0863}){_0x3c4dca['content']['clear']();const _0x244221=this['_createBalloonHeader']({'balloonPanel':_0x3c4dca,'source':_0x5e8277,'withBackButton':_0x2d0863});_0x3c4dca['content']['add'](_0x244221);const _0x205640=this['_createBalloonResourcesView'](_0x5e8277);_0x3c4dca['content']['add'](_0x205640);}['_createBalloonHeader']({balloonPanel:_0xbb23a9,source:_0x45ffeb,withBackButton:_0x686b61}){const _0x5c5b49=new _0xafeff5(this['_locale'],{'label':_0x45ffeb['label'],'class':fn});return _0x686b61&&_0x5c5b49['children']['add'](this['_createBackButton'](_0xbb23a9),0x0),_0x5c5b49;}['_createBackButton'](_0x5a7669){const _0x221436=new yt(this['_locale']);return _0x221436['set']({'icon':_0x2b56fa,'tooltip':Mi(this['_locale'],'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT'),'tooltipPosition':'n','class':Tn}),_0x221436['on']('execute',()=>{_0x5a7669['hide'](),this['_config']['onBackToContext']();}),_0x221436;}['_createBalloonResourcesView'](_0x174e60){const _0x8edc4c=new AIChatContextResourcesView(this['_locale'],{'source':_0x174e60,'searchInputVisibleFrom':this['_config']['searchInputVisibleFrom']});return _0x8edc4c['on']('loadSourceResources',(_0x575417,_0x49b4db)=>{this['_config']['onLoadSourceResources'](_0x49b4db);}),_0x8edc4c['on']('addResourceToContext',(_0x91a6cd,_0x9fc43b)=>{this['_config']['onResourceSelected'](_0x9fc43b['source'],_0x9fc43b['resource']),this['closeSourceResourceBalloon'](_0x174e60['id']);}),_0x8edc4c;}['_getResourcesViewFromBalloon'](_0x3dedf9){const _0x2e90d9=_0x3dedf9['content']['get'](0x1);return _0x2e90d9 instanceof AIChatContextResourcesView?_0x2e90d9:null;}['_setupSingleResourceBalloonClickOutsideHandler'](_0x45b9a6){jt({'emitter':_0x45b9a6,'contextElements':[_0x45b9a6['element']],'callback':()=>{_0x45b9a6['hide'](),this['_config']['onBalloonClosed']();},'activator':()=>_0x45b9a6['isVisible']});}}const Rn=['addDocumentToContext','addFileToContext','addUrlToContext','addResourceToContext','removeContextItem','loadSourceResources','executeCustomItemCallback'],bn='ck-ai-chat-context-controls',Sn='ck-ai-chat-context-controls__pending-contexts',On='ck-ai-chat-context-controls__add-context-balloon-panel',vn='ck-ai-chat-context-controls__add-context-button',kn='ck-ai-chat-context-controls__url-balloon-panel',yn='ck-ai-chat-context-controls__balloon-button',Nn='ck-ai-chat-context-controls__balloon-button-source',xn='ck-ai-chat-controls-button',Ln='ck-ai-chat-context-chips-wrapper-balloon',Pn='ck-ai-chat-controls_context_show-more-button',Dn='ck-ai-chat-context-controls__show-more-balloon-panel',Vn='ck-ai-chat',Hn=[zt['defaultPositions']['northArrowSouthWest'],zt['defaultPositions']['northArrowSouth'],zt['defaultPositions']['northArrowSouthEast'],zt['defaultPositions']['southArrowNorthWest'],zt['defaultPositions']['southArrowNorth'],zt['defaultPositions']['southArrowNorthEast']];class AIChatContextPanelView extends Nt{['addContextButtonView'];['_currentContextsChips']=this['createCollection']();['_conversationContextsChips']=this['createCollection']();['_overflowManager'];['_addContextBalloonPanelView'];['_urlBalloonPanelView'];['_urlInputView'];['_resourcesBalloonView'];['_addContextBalloonConfig'];['_hasExactlyOneSource']=!0x1;['bodyCollection'];constructor(_0x3ce0a0,_0x48bffb){super(_0x3ce0a0),this['bodyCollection']=_0x48bffb['bodyCollection'],this['_currentContextsChips']=this['createCollection'](),this['_conversationContextsChips']=this['createCollection'](),this['addContextButtonView']=this['_createAddContextButtonView'](_0x3ce0a0),this['_addContextBalloonPanelView']=this['_createAddContextBalloonPanelView'](_0x3ce0a0),this['_urlBalloonPanelView']=this['_createUrlBalloonPanelView'](_0x3ce0a0),this['_resourcesBalloonView']=this['_createResourcesBalloonView'](_0x3ce0a0,_0x48bffb);const _0x5a4419={'cssClasses':{'showMoreButton':Pn+'\x20'+Gi,'showMoreBalloon':Dn,'overflowContainer':Ln,'controlsButton':xn}};this['_overflowManager']=new AIChatChipsOverflowManager(_0x3ce0a0,this['_currentContextsChips'],_0x5a4419,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'](_0x351334,_0x292d4c){const _0x5de9f7=this['_createContextButton'](_0x351334,'current',!0x0,_0x292d4c);this['_addContextToCollection'](_0x5de9f7,this['_currentContextsChips']),this['_overflowManager']['reorganizeChips']();}['removeContextItem'](_0x2f2903){this['_removeContextFromCollection'](_0x2f2903,this['_currentContextsChips']),this['_removeContextFromCollection'](_0x2f2903,this['_overflowManager']['overflowChips']),this['_overflowManager']['reorganizeChips']();}['setContextItemLoading'](_0x331db4,_0x36b076){let _0x16b576=this['_currentContextsChips']['find'](_0x199360=>_0x199360['id']===_0x331db4);_0x16b576||(_0x16b576=this['_overflowManager']['overflowChips']['find'](_0x2a85c9=>_0x2a85c9['id']===_0x331db4)),_0x16b576&&(_0x16b576['isLoading']=_0x36b076);}['setConversationContext'](_0x515851){this['_conversationContextsChips']['clear']();for(const _0x4cf53d of _0x515851){const _0x22e821=this['_createContextButton'](_0x4cf53d,'conversation',!0x1,!0x1);this['_addContextToCollection'](_0x22e821,this['_conversationContextsChips']);}}['clearCurrentContextItems'](){this['_currentContextsChips']['clear'](),this['_overflowManager']['clear']();}['clearConversationContextItems'](){this['_conversationContextsChips']['clear']();}['updateResourceState'](_0x3f9c7f,_0xdbe444,_0x54742b){this['_resourcesBalloonView']['updateResourceState'](_0x3f9c7f,_0xdbe444,_0x54742b);}['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:_0x2c6739,withBackButton:_0x2ba294}){this['_resourcesBalloonView']['showSourceResourcesBalloon']({'source':_0x2c6739,'withBackButton':_0x2ba294}),this['addContextButtonView']['isOn']=!0x0;}['populateSourceResourceBalloon'](_0x5cf85a,_0x23fc6c,_0x46a5a9,_0x959c64){this['_resourcesBalloonView']['populateSourceResourceBalloon'](_0x5cf85a,_0x46a5a9,_0x959c64);}['closeSourceResourceBalloon'](_0x4026f1){this['_resourcesBalloonView']['closeSourceResourceBalloon'](_0x4026f1),this['addContextButtonView']['isOn']=!0x1;}['setAddContextOptions'](_0x2bb52e){this['_setBalloonPanelContent'](this['_addContextBalloonPanelView'],this['locale'],_0x2bb52e),this['_setAddContextButtonEnabled'](_0x2bb52e);}['_setAddContextButtonEnabled'](_0x278aee){const _0x2ab55f=!_0x278aee['document']['isHidden']&&_0x278aee['document']['enabled'],_0x514768=_0x278aee['urls']['enabled'],_0x5e299b=_0x278aee['files']['enabled'],_0x18e30d=_0x278aee['sources']['length']>0x0,_0x182b36=_0x278aee['customItems']&&_0x278aee['customItems']['length']>0x0;this['addContextButtonView']['isEnabled']=_0x2ab55f||_0x514768||_0x5e299b||_0x18e30d||_0x182b36;}['_setupTemplate'](){this['setTemplate']({'tag':'div','attributes':{'class':[bn,'ck-reset_all-excluded']},'children':[{'tag':'div','attributes':{'class':Sn},'children':this['_currentContextsChips']}]});}['_bindEventHandlers'](){this['addContextButtonView']['on']('execute',()=>{this['_handleAddContextButtonClick']();});}['_createAddContextButtonView'](_0x4d5eec){const _0x2ee0a6=new yt(_0x4d5eec);return _0x2ee0a6['set']({'label':Mi(_0x4d5eec,'AI_CHAT_CONTEXT_ADD_CONTEXT'),'class':xn+'\x20'+vn+'\x20'+Gi,'icon':_0x4d26cb,'isToggleable':!0x0,'tooltip':!0x0,'tooltipPosition':'sw'}),_0x2ee0a6;}['_createAddContextBalloonPanelView'](_0x19aaf1){return this['_createBaseBalloonPanel'](_0x19aaf1,On);}['_createUrlBalloonPanelView'](_0x3c829c){const _0x4080f3=this['_createBaseBalloonPanel'](_0x3c829c,kn);return this['_addUrlContent'](_0x4080f3,_0x3c829c),_0x4080f3;}['_createResourcesBalloonView'](_0x4c93b1,_0x2bf2b1){const _0x3c46de={'searchInputVisibleFrom':_0x2bf2b1['searchInputVisibleFrom'],'onBackToContext':()=>{this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':Hn});},'onResourceSelected':(_0xbb1536,_0x56995f)=>{this['fire']('addResourceToContext',{'source':_0xbb1536,'resource':_0x56995f});},'onLoadSourceResources':_0x2a19bc=>{this['fire']('loadSourceResources',_0x2a19bc);},'onBalloonClosed':()=>{this['addContextButtonView']['isOn']=!0x1;},'getLimiterElement':()=>this['_getLimiterElement'](),'getTargetElement':()=>this['addContextButtonView']['element']};return new AIChatResourcesBalloonView(_0x4c93b1,_0x2bf2b1['bodyCollection'],_0x3c46de);}['_getLimiterElement'](){return this['element']?.['closest']('.'+Vn)||document['body'];}['_createBaseBalloonPanel'](_0x2d0c9d,_0x267934){const _0x3967a9=new zt(_0x2d0c9d);return _0x3967a9['extendTemplate']({'attributes':{'class':_0x267934}}),this['bodyCollection']['add'](_0x3967a9),_0x3967a9;}['_setBalloonPanelContent'](_0xf2c2b2,_0x2c07b2,_0x232d25){if(_0xf2c2b2['content']['clear'](),!_0x232d25['document']['isHidden']&&_0x232d25['document']['enabled']){const _0x1e2c69=this['_createBalloonButton'](_0x2c07b2,{'label':Mi(_0x2c07b2,'AI_CHAT_CONTEXT_CURRENT_DOCUMENT'),'icon':_0x3702e6});_0x1e2c69['on']('execute',()=>{this['fire']('addDocumentToContext'),this['hideAddContextBalloonPanel']();}),_0xf2c2b2['content']['add'](_0x1e2c69);}if(_0x232d25['urls']['enabled']){const _0x3c4633=this['_createBalloonButton'](_0x2c07b2,{'label':Mi(_0x2c07b2,'AI_CHAT_CONTEXT_URL_LABEL'),'icon':_0x3ed1af});_0x3c4633['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['showUrlBalloonPanel'](),this['_urlBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':Hn}),this['_urlInputView']['focus']();}),_0xf2c2b2['content']['add'](_0x3c4633);}if(_0x232d25['files']['enabled']){const _0x1a1335=new _0x1e1e23(_0x2c07b2);_0x1a1335['set']({'label':Mi(_0x2c07b2,'AI_CHAT_CONTEXT_FILE_LABEL'),'icon':_0x5378d8,'withText':!0x0,'tooltip':!0x0,'class':yn,'allowMultipleFiles':!0x0}),_0x1a1335['on']('execute',()=>{this['hideAddContextBalloonPanel']();}),_0x1a1335['on']('done',(_0x2adda3,_0x3c215d)=>{this['fire']('addFileToContext',_0x3c215d);}),_0x1a1335['tooltip']=!0x0,_0xf2c2b2['content']['add'](_0x1a1335);}for(const _0x4a7904 of _0x232d25['sources']){const _0x58b159=this['_createBalloonButton'](_0x2c07b2,{'label':_0x4a7904['label'],'icon':_0x4a7904['icon']||_0x108bb1,'type':'source'});_0xf2c2b2['content']['add'](_0x58b159),_0x58b159['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['_showSourceResourcesBalloon']({'source':_0x4a7904,'withBackButton':!this['_hasExactlyOneSource']});});}for(const _0x3d697d of _0x232d25['customItems']||[]){const _0x14d43d=this['_createBalloonButton'](_0x2c07b2,{'label':_0x3d697d['label'],'icon':_0x3d697d['icon']||_0x108bb1,'type':'customItem'});_0xf2c2b2['content']['add'](_0x14d43d),_0x14d43d['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['fire']('executeCustomItemCallback',_0x3d697d);});}this['_hasExactlyOneSource']=0x1===_0xf2c2b2['content']['length'],this['_urlInputView']['withBackButton']=!this['_hasExactlyOneSource'];}['_addUrlContent'](_0x137f4a,_0x577fa6){this['_urlInputView']=new AIChatContextPanelUrlInputView(_0x577fa6),this['_urlInputView']['on']('submitUrl',(_0x512c98,_0x4c0def)=>{this['_handleUrlSubmit'](_0x4c0def);}),this['_urlInputView']['on']('cancel',()=>{this['hideUrlBalloonPanel'](),this['_hasExactlyOneSource']||(this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':Hn}));}),this['_urlInputView']['on']('refreshBalloon',()=>{this['_urlBalloonPanelView']['isVisible']&&this['_urlBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':Hn});}),_0x137f4a['content']['add'](this['_urlInputView']);}['_createBalloonButton'](_0x4fbe6d,_0x6cc240){const _0x3c2779='source'===_0x6cc240['type']?new SourcesBalloonButtonView(_0x4fbe6d):new yt(_0x4fbe6d);return _0x3c2779['set']({'label':_0x6cc240['label'],'icon':_0x6cc240['icon'],'withText':!0x0,'tooltip':!0x0,'tooltipPosition':'sw','class':yn}),_0x3c2779;}['_setupAllBalloonClickOutsideHandlers'](){this['_setupAddContextBalloonClickOutsideHandler'](),this['_setupUrlBalloonClickOutsideHandler']();}['_setupUrlBalloonClickOutsideHandler'](){jt({'emitter':this['_urlBalloonPanelView'],'contextElements':[this['_urlBalloonPanelView']['element']],'callback':()=>{this['hideUrlBalloonPanel']();},'activator':()=>this['_urlBalloonPanelView']['isVisible']});}['_toggleAddContextBalloon'](_0x21a6ec){const _0x2bf2da=this['_addContextBalloonConfig'];_0x2bf2da['buttonView']['isOn']=_0x21a6ec,_0x21a6ec?_0x2bf2da['balloonView']['show']():_0x2bf2da['balloonView']['hide']();}['_setupAddContextBalloonClickOutsideHandler'](){const {balloonView:_0x247837,buttonView:_0x389428,hideMethod:_0x24c927}=this['_addContextBalloonConfig'];jt({'emitter':_0x247837,'contextElements':[_0x247837['element'],_0x389428['element']],'callback':()=>{_0x24c927();},'activator':()=>_0x389428['isOn']&&!this['_urlBalloonPanelView']['isVisible']&&!this['_resourcesBalloonView']['isAnyResourceBalloonVisible']()});}['_createContextButton'](_0x339cdb,_0x3ef963,_0x5e7744=!0x1,_0x422d1b=!0x1){const _0x57603e='conversation'===_0x3ef963||!0x0===_0x339cdb['isReadOnly'],_0x584450=new AIChatContextItemButtonView(this['locale'],_0x339cdb,_0x57603e,_0x5e7744,_0x422d1b);return _0x57603e||_0x584450['on']('removeContextItemChip',()=>{this['fire']('removeContextItem',_0x584450['id']);}),_0x584450;}['_addContextToCollection'](_0x5ed5a5,_0x3610df){_0x3610df['add'](_0x5ed5a5,0x0);}['_removeContextFromCollection'](_0x427629,_0x239fb1){const _0x15b84b=_0x239fb1['find'](_0x236d2a=>_0x236d2a['id']===_0x427629);_0x15b84b&&_0x239fb1['remove'](_0x15b84b);}['_handleAddContextButtonClick'](){this['addContextButtonView']['isOn']?this['hideAddContextBalloonPanel']():(this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':Hn}),this['_hasExactlyOneSource']&&this['_addContextBalloonPanelView']['content']['get'](0x0)?.['fire']('execute'));}['_handleUrlSubmit'](_0x337786){this['_urlInputView']['clear'](),this['hideUrlBalloonPanel'](),this['fire']('addUrlToContext',_0x337786);}}class SourcesBalloonButtonView extends yt{['arrowView'];constructor(_0x3eef19){super(_0x3eef19),this['set']({'withText':!0x0,'role':'menuitem'}),this['arrowView']=this['_createArrowView'](),this['extendTemplate']({'attributes':{'class':[Nn]}});}['render'](){super['render'](),this['children']['add'](this['arrowView']);}['_createArrowView'](){const _0x235c91=new Lt();return _0x235c91['content']=_0x13e84e,_0x235c91['extendTemplate']({'attributes':{'class':Nn+'__arrow'}}),_0x235c91;}}class AIChatControlsLoaderView extends Nt{['_cancelButtonView'];['_loaderView'];constructor(_0x274fcf){super(_0x274fcf),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 _0x13e1e6=new yt(this['locale']);return _0x13e1e6['set']({'label':Mi(this['locale'],'AI_CHAT_STOP_GENERATING'),'withText':!0x0,'class':Bi+'\x20ck-ai-button-stop-generating','icon':_0x50911a}),_0x13e1e6['on']('execute',()=>{this['fire']('abortPromptStream');}),_0x13e1e6;}['_createLoaderView'](){const _0x2dcd83=new Nt(this['locale']);return _0x2dcd83['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':Mi(this['locale'],'AI_CHAT_IS_WRITING')}]}),_0x2dcd83;}}class AIChatControlsView extends Nt{['_contextPanelView'];['_promptInputView'];['_dropZoneView'];['_promptCapabilitiesView'];['_loaderView'];['_modelUnavailableMessageView'];['_shouldRestorePromptInputFocus'];['_filesEnabled'];constructor(_0x49ab6f,_0x2b8425){super(_0x49ab6f),this['_filesEnabled']=_0x2b8425['filesEnabled'],this['_contextPanelView']=this['_createContextPanelView'](_0x49ab6f,{'bodyCollection':_0x2b8425['bodyCollection'],'searchInputVisibleFrom':_0x2b8425['contextResourcesSearchInputVisibleFrom']}),this['_promptInputView']=this['_createPromptInputView'](_0x49ab6f),this['_promptCapabilitiesView']=this['_createPromptCapabilitiesView'](_0x49ab6f),this['_loaderView']=this['_createLoaderView'](_0x49ab6f),this['_modelUnavailableMessageView']=this['_createModelUnavailableMessageView'](_0x49ab6f),this['_dropZoneView']=new AIChatDropZoneView(_0x49ab6f),this['_shouldRestorePromptInputFocus']=!0x1,this['_promptInputView']['delegate']('sendUserMessage','promptInputPaste')['to'](this),this['_dropZoneView']['delegate']('promptInputPaste')['to'](this),this['_dropZoneView']['on']('dragEnter',()=>this['_contextPanelView']['hideAllBalloons']()),this['_loaderView']['delegate']('abortPromptStream')['to'](this),this['_promptCapabilitiesView']['delegate']('toggleWebSearch')['to'](this),this['_promptCapabilitiesView']['delegate']('toggleReasoning')['to'](this),this['_promptCapabilitiesView']['delegate']('selectModel')['to'](this),this['_contextPanelView']['delegate'](...Rn)['to'](this),this['set']('isModelAvailable',!0x0),this['set']('isDisabled',!0x1);const _0x8f55d9=this['bindTemplate'];this['setTemplate']({'tag':'form','attributes':{'class':['ck','ck-ai-chat-controls',_0x8f55d9['if']('isDisabled','ck-ai-chat-controls-disabled')]},'children':[{'tag':'div','attributes':{'class':[_0x8f55d9['if']('isLoading','ck-hidden',_0x45ea19=>_0x45ea19||!this['isModelAvailable']),_0x8f55d9['if']('isModelAvailable','ck-hidden',_0x36e066=>!_0x36e066||this['isLoading'])]},'children':[this['_contextPanelView'],this['_promptInputView'],this['_promptCapabilitiesView']]},{'tag':'div','attributes':{'class':[_0x8f55d9['if']('isLoading','ck-hidden',_0x1d482c=>!_0x1d482c)]},'children':[this['_loaderView']]},{'tag':'div','attributes':{'class':[_0x8f55d9['if']('isModelAvailable','ck-hidden',_0x24e563=>_0x24e563)]},'children':[this['_modelUnavailableMessageView']]},this['_dropZoneView']]}),jt({'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'](_0x3219da,_0x47811c){return new AIChatContextPanelView(_0x3219da,_0x47811c);}['_createPromptInputView'](_0x5027cc){return new AIChatPromptInputView(_0x5027cc,this['_contextPanelView']['addContextButtonView']);}['_createPromptCapabilitiesView'](_0x4f74b3){return new AIChatPromptCapabilitiesView(_0x4f74b3);}['_createLoaderView'](_0x4ce5ec){return new AIChatControlsLoaderView(_0x4ce5ec);}['_createModelUnavailableMessageView'](_0xfd3e40){const _0xc7ec09=new AIChatModelUnavailableMessageView(_0xfd3e40);return _0xc7ec09['delegate']('startConversation')['to'](this),_0xc7ec09;}['_handlePromptInputFocus'](_0x563dd5,_0x23d323,_0x44615b){_0x44615b?this['_shouldRestorePromptInputFocus']=!0x0:this['_shouldRestorePromptInputFocus']&&this['_promptInputView']['focus']();}['addContextItem'](_0x563b7f,_0x5a7cc4){this['_contextPanelView']['addContextItem'](_0x563b7f,_0x5a7cc4);}['removeContextItem'](_0x1f5a7f){this['_contextPanelView']['removeContextItem'](_0x1f5a7f);}['setContextItemLoading'](_0x30524c,_0x1755aa){this['_contextPanelView']['setContextItemLoading'](_0x30524c,_0x1755aa);}['setIsUploadInProgress'](_0x8b4e85){this['_promptInputView']['setIsUploadInProgress'](_0x8b4e85);}['setConversationContext'](_0x52b527){this['_contextPanelView']['setConversationContext'](_0x52b527);}['clearPendingContextUI'](){this['_contextPanelView']['clearCurrentContextItems']();}['clearConversationContextUI'](){this['_contextPanelView']['clearConversationContextItems']();}['updateResourceState'](_0x43d934,_0x51ece2,_0xca4a3){this['_contextPanelView']['updateResourceState'](_0x43d934,_0x51ece2,_0xca4a3);}['setWebSearch'](_0x1696b7){this['_promptCapabilitiesView']['setWebSearch'](_0x1696b7);}['setReasoning'](_0x45cef0){this['_promptCapabilitiesView']['setReasoning'](_0x45cef0);}['resetMessageInput'](){this['_promptInputView']['reset']();}['setAddContextOptions'](_0x28af5a){this['_contextPanelView']['setAddContextOptions'](_0x28af5a);}['setInputPlaceholder'](_0x2dc805){this['_promptInputView']['setPlaceholderText'](_0x2dc805);}['setModelList'](_0x1c8d55,_0x79b24d){this['_promptCapabilitiesView']['setModelList'](_0x1c8d55,_0x79b24d);}['setModel'](_0x1e93bb){_0x1e93bb?(this['isModelAvailable']=!0x0,this['_promptCapabilitiesView']['setModel'](_0x1e93bb)):this['isModelAvailable']=!0x1;}['enableModelSelector'](){this['_promptCapabilitiesView']['enableModelSelector']();}['disableModelSelector'](_0x4a11be){this['_promptCapabilitiesView']['disableModelSelector'](_0x4a11be);}['populateSourceResourceBalloon'](_0x299e4b,_0x5341e5,_0x45aa9b,_0x3bf231){this['_contextPanelView']['populateSourceResourceBalloon'](_0x299e4b,_0x5341e5,_0x45aa9b,_0x3bf231);}['closeSourceResourceBalloon'](_0x38cd25){this['_contextPanelView']['closeSourceResourceBalloon'](_0x38cd25);}['focusPromptInput'](_0x92b9da=!0x1){this['_promptInputView']['focus'](_0x92b9da);}['setPromptInputValue'](_0xc80972){this['_promptInputView']['queryView']['fieldView']['reset'](),this['_promptInputView']['queryView']['fieldView']['value']=_0xc80972;}}class AIChatModelUnavailableMessageView extends Nt{constructor(_0xece32a){super(_0xece32a);const _0x494ce5=new yt(_0xece32a);_0x494ce5['set']({'label':Mi(this['locale'],'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_BUTTON'),'withText':!0x0,'class':['ck-ai-chat-controls__start-new-chat-button'],'tooltip':''}),_0x494ce5['delegate']('execute')['to'](this,'startConversation'),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-controls-model-unavailable-message']},'children':[{'tag':'p','children':[{'text':Mi(this['locale'],'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_TEXT')+'\x20'},_0x494ce5]}]});}}class AIHeaderView extends _0xafeff5{['resizeButton'];constructor(_0x5c8582,_0x340e58){super(_0x5c8582,{'label':_0x340e58['label'],'class':'ck-ai-header\x20'+_0x340e58['class'],'icon':_0x340e58['icon']}),this['set']('isMaximized',!0x1),_0x340e58['content']&&this['children']['add'](_0x340e58['content']),_0x340e58['showResizeButton']&&(this['resizeButton']=Fi(_0x5c8582,this),this['children']['add'](this['resizeButton']));}}class AIDisclaimerView extends Nt{constructor(_0x57daf0){super(_0x57daf0),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-disclaimer']},'children':[{'tag':'p','attributes':{'class':['ck','ck-ai-disclaimer__content']},'children':[{'text':Mi(_0x57daf0,'AI_DISCLAIMER_TEXT')}]}]});}}function Mn(_0x30d2ea,_0x165b62){const _0x157a96=new yt(_0x30d2ea);return _0x157a96['set']({'label':Mi(_0x30d2ea,'AI_CHAT_LABEL_NEW_CHAT'),'withText':!0x0,'icon':_0x1de9e1,'class':'ck-ai-chat__start-conversation\x20'+Bi}),_0x157a96['on']('execute',()=>{_0x165b62['fire']('startConversation');}),_0x157a96;}class AIChatView extends Nt{['chatHeader'];['chatFeed'];['chatControls'];['chatDisclaimer'];['_bodyCollection'];constructor(_0x24421c,_0x5d932d){super(_0x24421c),this['_bodyCollection']=new Xt(_0x24421c),this['_bodyCollection']['attachToDom']();const _0x11d11f=Mn(_0x24421c,this);this['chatHeader']=new AIHeaderView(_0x24421c,{'label':Mi(_0x24421c,'AI_CHAT_HEADING'),'icon':_0x1eba20,'class':'ck-ai-header_chat','content':_0x11d11f,'showResizeButton':_0x5d932d['showResizeButton']}),this['chatHeader']['delegate']('resizeTabs')['to'](this),this['chatFeed']=new AIChatFeedView(_0x24421c,this['_bodyCollection']),this['chatFeed']['delegate'](...Ss)['to'](this),this['chatControls']=new AIChatControlsView(_0x24421c,{'bodyCollection':this['_bodyCollection'],'contextResourcesSearchInputVisibleFrom':_0x5d932d['contextResourcesSearchInputVisibleFrom'],'filesEnabled':_0x5d932d['filesEnabled']}),this['chatControls']['delegate'](...Ss)['to'](this),this['chatDisclaimer']=new AIDisclaimerView(_0x24421c),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-chat','ck-rounded-corners'],'dir':_0x24421c['uiLanguageDirection']},'children':[this['chatHeader'],this['chatFeed'],this['chatControls'],this['chatDisclaimer']]});}['populateSourceResourceBalloon'](_0x1da4ee,_0x3741e7,_0x5e2cf,_0xa14d75){this['chatControls']['populateSourceResourceBalloon'](_0x1da4ee,_0x3741e7,_0x5e2cf,_0xa14d75);}['closeSourceResourceBalloon'](_0x3a3437){this['chatControls']['closeSourceResourceBalloon'](_0x3a3437);}['destroy'](){this['_bodyCollection']['detachFromDom'](),super['destroy']();}}class AIChatUI extends _0x533560{static get['requires'](){return[AITabs];}['_view'];static get['pluginName'](){return'AIChatUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['feedItemRenderingStrategy']='streaming';['showDiff']=!0x0;['_promiseQueue'];['_interactionPromiseResolver'];['_titleAnimationInterval']=void 0x0;['_isTrackChangesCommandValueBound']=!0x1;constructor(_0x24c950){super(_0x24c950);const _0x5d3330=this['context']['plugins']['get']('AITabs');this['set']('isBusy',!0x1),this['_promiseQueue']=new PromiseQueue(),this['_view']=new AIChatView(this['context']['locale'],{'showResizeButton':_0x5d3330['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'](_0x5d3330),this['_view']['delegate'](...Ss)['to'](this),this['_view']['on']('toggleSuggestionDisplayMode',(_0x5e122a,{showDiff:_0x204af4})=>{this['showDiff']=_0x204af4;}),this['disableControls'](),_0x5d3330['view']['addTab']({'id':'chat','buttonLabel':Mi(this['context']['locale'],'AI_CHAT_HEADING'),'buttonIcon':_0x1eba20,'order':0x0,'content':this['_view']}),this['_view']['chatHeader']['bind']('isMaximized')['to'](_0x5d3330['view'],'isMaximized',_0x579e9a=>_0x579e9a),this['_view']['chatControls']['bind']('isLoading')['to'](this,'isBusy',_0x24c0b2=>_0x24c0b2),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder']()),this['bind']('isModelAvailable')['to'](this['_view']['chatControls'],'isModelAvailable');}['destroy'](){super['destroy'](),this['_titleAnimationInterval']&&clearInterval(this['_titleAnimationInterval']);}['createConversation'](_0x3e25fb){const _0x4c6546=this['context']['config']['get']('ai.chat.welcomeMessage')??Mi(this['context']['locale'],'AI_CHAT_WELCOME_MESSAGE');this['_view']['chatFeed']['clear'](),this['_view']['chatControls']['enableModelSelector'](),this['_view']['chatControls']['setModelList'](_0x3e25fb['availableModels'],!this['context']['config']['get']('ai.models.showModelSelector')),this['addFeedItemStaticMessage']({'id':'conversation-start','staticMessage':_0x4c6546}),this['fire']('conversationCreated');}async['addFeedItemStaticMessage']({id:_0x3a3519,staticMessage:_0x1ff3b7}){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-reply',{'id':_0x3a3519,'initialContent':'<p>'+_0x1ff3b7+'</p>'});});}async['addFeedItemUserMessage'](_0x24f332){const _0x455daf=_0x24f332['attributes']?.['displayedPrompt']||_0x24f332['userMessage'];return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('user-message',{'contextItems':Array['from'](_0x24f332['contextItems']['values']()),'initialContent':'<p>'+_0x455daf+'</p>','id':_0x24f332['id']});});}async['addFeedItemError']({errorMessage:_0x571176,id:_0x1b3ff2}){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('error-message',{'initialContent':'<p>'+_0x571176+'</p>','id':_0x1b3ff2});});}async['addFeedItemAIReply'](_0x577b08){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-reply',{'id':_0x577b08['interactionId']+':'+_0x577b08['id']}),this['clearLoadingMessage']();});}async['addFeedItemAISuggestion'](_0x158c05){const _0x265d15=Cs(this['context']),_0x1875c0=_0x265d15['map'](_0x11516e=>_0x11516e['config']['get']('ai.availableReplyActions')||[...Ps]);let _0x39410f=_0x1875c0['reduce']((_0x29ddf0,_0x3c9804)=>_0x29ddf0['filter'](_0x15bcce=>_0x3c9804['includes'](_0x15bcce)),_0x1875c0[0x0]||[...Ps]);const _0x5043aa=_0x265d15['every'](_0x5512c8=>_0x5512c8['plugins']['has']('TrackChanges')),_0xc4a6e2=_0x265d15['map'](_0x3f1628=>_0x3f1628['commands']['get']('trackChanges'));return _0x5043aa?this['_isTrackChangesCommandValueBound']||(this['_isTrackChangesCommandValueBound']=!0x0,this['_view']['chatFeed']['bind']('isTrackChangesOn')['toMany'](_0xc4a6e2,'value',(..._0x45fe20)=>_0x45fe20['some'](_0x1a9fc5=>_0x1a9fc5))):_0x39410f=_0x39410f['filter'](_0x32ebab=>'insertSuggestion'!=_0x32ebab),this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-suggestion-reply',{'id':_0x158c05['interactionId']+':'+_0x158c05['id'],'areActionsDisabled':_0x158c05['areActionsDisabled'],'showDiff':this['showDiff'],'availableActions':_0x39410f}),this['clearLoadingMessage']();});}async['addFeedInteractionHeader'](_0x28b858,_0x4feb60){return this['_promiseQueue']['enqueue'](async()=>{const _0x262b96=this['_view']['chatFeed']['children']['last'];if(_0x262b96 instanceof AIChatFeedInteractionHeaderView)return this['_view']['chatFeed']['children']['remove'](_0x262b96),void this['_view']['chatFeed']['addItem']('interaction-header',{'id':_0x28b858['id'],'capabilities':{'isWebSearchEnabled':_0x262b96['capabilities']['isWebSearchEnabled']||_0x4feb60['isWebSearchEnabled'],'isReasoningEnabled':_0x262b96['capabilities']['isReasoningEnabled']||_0x4feb60['isReasoningEnabled']}});this['_view']['chatFeed']['addItem']('interaction-header',{'id':_0x28b858['id'],'capabilities':_0x4feb60});});}async['addFeedItemCustomElement'](_0x11673d,_0x529e7f){let _0x2be5af;return await this['_promiseQueue']['enqueue'](async()=>{_0x2be5af=this['_view']['chatFeed']['addItem']('custom-element',{'content':_0x11673d,'id':_0x529e7f});}),_0x2be5af;}['removeFeedItem'](_0x1a5413){this['_view']['chatFeed']['removeItem'](_0x1a5413);}['hasFeedItem'](_0x2fdfb2){return this['_view']['chatFeed']['hasItem'](_0x2fdfb2);}['updateFeedInteractionHeader'](_0x4cfba2){const _0x573265=this['_view']['chatFeed']['children']['find'](_0x594bc7=>_0x594bc7['options']['id']==_0x4cfba2['id']&&_0x594bc7 instanceof AIChatFeedInteractionHeaderView);_0x573265&&_0x573265['set']('isVisible',_0x4cfba2['isVisible']);}async['updateFeedItemAIReplyContent'](_0x23deed){const _0x546d14=_0x23deed['renderingStrategy']||this['feedItemRenderingStrategy'];return this['_promiseQueue']['enqueue'](async _0x2a67df=>{await this['_view']['chatFeed']['updateReplyItem']({..._0x23deed,'abortSignal':_0x2a67df,'renderingStrategy':_0x546d14}),_0x23deed['isDone']&&this['markFeedItemAsDone'](_0x23deed['id']);});}['updateFeedItemAIReplySources'](_0x5b9d5f,_0x23da78){this['_view']['chatFeed']['updateWebSources'](_0x5b9d5f,_0x23da78);}async['updateFeedItemAIReplySuggestionContent'](_0xadb154){return this['_promiseQueue']['enqueue'](async _0x33dbb7=>{await this['_view']['chatFeed']['updateSuggestionItem']({..._0xadb154,'abortSignal':_0x33dbb7}),_0xadb154['isDone']&&this['markFeedItemAsDone'](_0xadb154['id']);});}['updateFeedItemAIReplySuggestionPartState'](_0x33cfb7){this['_view']['chatFeed']['updateSuggestionPartState'](_0x33cfb7);}['setFeedItemAIReplySuggestionPartActive'](_0x554597){this['_view']['chatFeed']['setSuggestionPartActive'](_0x554597);}['markFeedItemAsDone'](_0xf4a7ce){this['_view']['chatFeed']['markItemAsDone'](_0xf4a7ce);}['removeFeedInteraction'](_0x50ebed){this['_view']['chatFeed']['getItemIds']()['filter'](_0x9c8ba0=>_0x9c8ba0['startsWith'](_0x50ebed))['forEach'](_0x3555e6=>this['_view']['chatFeed']['removeItem'](_0x3555e6));}['startInteraction'](){const _0x3cea64=this['prepareLoadingMessage']({'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x1});this['setLoadingMessage'](_0x3cea64),this['_view']['chatControls']['disableModelSelector'](!this['context']['config']['get']('ai.models.showModelSelector')),this['isBusy']=!0x0,this['_view']['chatFeed']['startAutoScroll']();}['stopInteraction'](_0x3e6e83){this['_promiseQueue']['abort'](),this['_view']['chatFeed']['getItemIds']()['filter'](_0x2d7715=>_0x2d7715['startsWith'](_0x3e6e83['id']))['forEach'](_0x1817d3=>this['markFeedItemAsDone'](_0x1817d3)),this['isBusy']=!0x1,this['clearLoadingMessage'](),this['_view']['chatFeed']['stopAutoScroll']();}async['finishInteraction'](){return this['_promiseQueue']['queueEmptyPromise']['then'](()=>{this['isBusy']=!0x1,this['clearLoadingMessage'](),this['_view']['chatFeed']['stopAutoScroll']();});}['addContextItem'](_0x3a87dd,_0x27fc7e){this['_view']['chatControls']['addContextItem'](_0x3a87dd,_0x27fc7e);}['removeContextItem'](_0x1775d1){this['_view']['chatControls']['removeContextItem'](_0x1775d1);}['setContextItemLoading'](_0x3ec132,_0x438e82){this['_view']['chatControls']['setContextItemLoading'](_0x3ec132,_0x438e82);}['setIsUploadInProgress'](_0x5859b0){this['_view']['chatControls']['setIsUploadInProgress'](_0x5859b0);}['setConversationContext'](_0x228568){this['_view']['chatControls']['setConversationContext'](_0x228568);}['clearPendingContextUI'](){this['_view']['chatControls']['clearPendingContextUI']();}['clearConversationContextUI'](){this['_view']['chatControls']['clearConversationContextUI']();}['updateResourceState'](_0x1bbbad,_0x283a97,_0x8bc01d){this['_view']['chatControls']['updateResourceState'](_0x1bbbad,_0x283a97,_0x8bc01d);}['resetMessageInput'](){this['_view']['chatControls']['resetMessageInput'](),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder']());}['setAddContextOptions'](_0x553153){this['_view']['chatControls']['setAddContextOptions'](_0x553153);}['updateCapabilities'](_0x2fdcdf){this['_view']['chatControls']['setWebSearch'](_0x2fdcdf['isWebSearchEnabled']),this['_view']['chatControls']['setReasoning'](_0x2fdcdf['isReasoningEnabled']),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder'](_0x2fdcdf));}['setSelectedModel'](_0x5c7038,_0x355f11){this['_view']['chatControls']['setModel'](_0x5c7038),_0x355f11&&this['_view']['chatControls']['disableModelSelector'](!0x1);}['setFeedItemRenderingStrategy'](_0x4b315f){this['feedItemRenderingStrategy']=_0x4b315f;}['toggleLoadingSkeleton'](_0x3816e9){this['_view']['chatFeed']['toggleLoadingSkeleton'](_0x3816e9);}['resetConversationTitle'](){this['setConversationTitle'](Mi(this['context']['locale'],'AI_CHAT_HEADING'));}['setConversationTitle'](_0x171265,_0x1ce17b=!0x1){if(_0x1ce17b&&!St()&&_0x171265['length'])return this['_view']['chatHeader']['label']='',void this['_animateConversationTitle'](_0x171265);this['_view']['chatHeader']['label']=_0x171265;}['setLoadingMessage'](_0x2ae887){this['_view']['chatFeed']['setLoadingMessage'](_0x2ae887);}['clearLoadingMessage'](){this['_view']['chatFeed']['setLoadingMessage']('');}['_animateConversationTitle'](_0x43d5eb){let _0x42052b=0x0;clearInterval(this['_titleAnimationInterval']),this['_titleAnimationInterval']=setInterval(()=>{this['_view']['chatHeader']['label']=this['_view']['chatHeader']['label']+_0x43d5eb[_0x42052b],_0x42052b++,_0x42052b===_0x43d5eb['length']&&clearInterval(this['_titleAnimationInterval']);},0x1e);}['prepareLoadingMessage'](_0x3bdce1){return _0x3bdce1['isWebSearchEnabled']&&_0x3bdce1['isReasoningEnabled']?Mi(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH_REASONING'):_0x3bdce1['isWebSearchEnabled']?Mi(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH'):_0x3bdce1['isReasoningEnabled']?Mi(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_REASONING'):Mi(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_REGULAR');}['_getInputPlaceholder'](_0x52c2bd){return _0x52c2bd?_0x52c2bd['isWebSearchEnabled']&&_0x52c2bd['isReasoningEnabled']?Mi(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH_REASONING'):_0x52c2bd['isWebSearchEnabled']?Mi(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH'):_0x52c2bd['isReasoningEnabled']?Mi(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REASONING'):Mi(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REGULAR'):Mi(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REGULAR');}['populateSourceResourceBalloon'](_0x1793e1,_0x1acca4,_0x925f28,_0x4af91f){this['_view']['populateSourceResourceBalloon'](_0x1793e1,_0x1acca4,_0x925f28,_0x4af91f);}['closeSourceResourceBalloon'](_0x17beac){this['_view']['closeSourceResourceBalloon'](_0x17beac);}['setPromptInputValue'](_0x25d540){this['_view']['chatControls']['setPromptInputValue'](_0x25d540);}['focusPromptInput'](_0x369d6e=!0x1){this['_view']['chatControls']['focusPromptInput'](_0x369d6e);}['scrollFeedToSuggestion'](_0x322001,_0x8cd73c){this['_view']['chatFeed']['scrollToSuggestion'](_0x322001,_0x8cd73c);}['startAutoScroll'](_0x1d2f02={}){this['_view']['chatFeed']['startAutoScroll'](_0x1d2f02);}['disableControls'](){this['_view']['chatControls']['isDisabled']=!0x0;}['enableControls'](){this['_view']['chatControls']['isDisabled']=!0x1;}}class AIChatHistorySectionListView extends Dt{['sections'];constructor(_0x19cc95,_0x12b8e0){super(_0x19cc95),this['sections']=_0x12b8e0,this['items']['addMany'](this['sections']),this['extendTemplate']({'attributes':{'class':['ck-ai-chat-history__sections']}});}['filter'](_0x23e6e8){let _0x51cc10=0x0,_0x344f43=0x0;for(const _0x398670 of this['sections']){const {resultsCount:_0x12f74b,totalItemsCount:_0x291d04}=_0x398670['filter'](_0x23e6e8);_0x51cc10+=_0x12f74b,_0x344f43+=_0x291d04;}return{'resultsCount':_0x51cc10,'totalItemsCount':_0x344f43};}}class AIChatHistoryListView extends Ht{['title'];['itemsViews'];['_itemsListView'];constructor(_0x241b2b,{title:_0x436221,items:_0x2df686}){super(_0x241b2b);const _0x3932c8=this['bindTemplate'];this['set']('isVisible',!0x0),this['title']=_0x436221,this['itemsViews']=_0x2df686;const _0x34bd55=new Nt(_0x241b2b);_0x34bd55['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-history__section-title']},'children':[this['title']]}),this['_itemsListView']=new Dt(_0x241b2b),this['_itemsListView']['items']['addMany'](this['itemsViews']),this['setTemplate']({'tag':'li','attributes':{'class':['ck-ai-chat-history__section',_0x3932c8['if']('isVisible','ck-hidden',_0x14b263=>!_0x14b263)]},'children':[_0x34bd55,this['_itemsListView']]});}['filter'](_0x4e12a9){const _0x5def9a=this['itemsViews']['length'];let _0x15d3cd=0x0;for(const _0xda54a8 of this['itemsViews']){if(_0x4e12a9){const _0x16197b=_0xda54a8['isMatching'](_0x4e12a9);_0xda54a8['isVisible']=!!_0x16197b,_0xda54a8['highlightText'](_0x4e12a9);}else _0xda54a8['isVisible']=!0x0,_0xda54a8['highlightText'](null);_0xda54a8['isVisible']&&_0x15d3cd++;}return this['isVisible']=_0x15d3cd>0x0,{'resultsCount':_0x15d3cd,'totalItemsCount':_0x5def9a};}['getItem'](_0x4cf3c2){return this['itemsViews']['find'](_0x38eda0=>_0x38eda0['id']===_0x4cf3c2);}['removeItem'](_0x319cb8){const _0x5ba554=this['itemsViews']['indexOf'](_0x319cb8);-0x1!==_0x5ba554&&(this['itemsViews']['splice'](_0x5ba554,0x1),this['_itemsListView']['items']['remove'](_0x319cb8));}}class AIChatHistoryListItemView extends/* #__PURE__ -- @preserve */
27
+ _0x5438cd(Ht){['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(_0x1223f6,_0x4bd46c){super(_0x1223f6);const _0x2a7de0=this['bindTemplate'];this['set']('isEdit',!0x1),this['set']('isVisible',!0x0),this['set']('pinned',!!_0x4bd46c['pinned']),this['set']('loadingState',null),this['set']('title',_0x4bd46c['title']),this['id']=_0x4bd46c['id'];const {createdAt:_0x173bb4,active:_0x8467a0=!0x1}=_0x4bd46c;this['_titleView']=new _0x5a7c84(),this['_titleView']['bind']('text')['to'](this,'title'),this['_titleView']['extendTemplate']({'attributes':{'class':['ck-ai-chat-history__item-title']}});const _0x165515=this['_createCheckView'](),_0x559700=this['_createPinButtonView'](_0x1223f6),_0x30ffd7=this['_createMenuDropdownView'](),_0x16e71c=this['_createEditInputView'](_0x1223f6),_0x232c23=this['_createAcceptEditButtonView'](_0x1223f6,_0x16e71c),_0x4ed222=this['_createCancelEditButtonView'](_0x1223f6);this['actions']=this['createCollection'](),this['mainContent']=this['createCollection'](),this['mainContent']['add'](this['_titleView']),this['actions']['add'](_0x559700),this['actions']['add'](_0x30ffd7),this['on']('change:isEdit',(_0x5e53aa,_0x4346d6,_0x3d7301)=>{this['actions']['clear'](),this['mainContent']['clear'](),_0x3d7301?(this['actions']['add'](_0x232c23),this['actions']['add'](_0x4ed222),this['mainContent']['add'](_0x16e71c),_0x16e71c['element']['value']=this['title']||'',_0x16e71c['element']['focus']()):(this['actions']['add'](_0x559700),this['actions']['add'](_0x30ffd7),this['mainContent']['add'](this['_titleView']));}),this['setTemplate']({'tag':'li','attributes':{'class':['ck-ai-chat-history__item',_0x8467a0?'ck-ai-chat-history__item--active':'',_0x2a7de0['if']('isVisible','ck-hidden',_0x47e3fc=>!_0x47e3fc),_0x2a7de0['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',_0x2a7de0['if']('loadingState','ck-hidden',_0x2f84d2=>!!_0x2f84d2)]},'children':_0x8467a0?[_0x165515]:[]},{'tag':'div','attributes':{'class':['ck-ai-loader',_0x2a7de0['if']('loadingState','ck-hidden',_0xe709f8=>!_0xe709f8)]},'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',_0x2a7de0['if']('loadingState','ck-hidden',_0xe5ccae=>!!_0xe5ccae)]},'children':this['mainContent']},{'tag':'div','attributes':{'class':['ck-ai-loader__text',_0x2a7de0['if']('loadingState','ck-hidden',_0x1114c6=>!_0x1114c6)]},'children':[{'text':_0x2a7de0['to']('loadingState',_0x3f5910=>_0x3f5910?Mi(this['locale'],AIChatHistoryListItemView['LOADING_LABELS'][_0x3f5910]):'')}]}]},{'tag':'span','attributes':{'class':['ck-ai-chat-history__item-date']},'children':[_0x173bb4]}]},{'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'](_0x1ba3cb){this['set']('title',_0x1ba3cb);}['updateLoadingState'](_0x3acdae,_0xd63782){this['set']('loadingState',_0xd63782?_0x3acdae:null);}['_createCheckView'](){const _0xf2780e=new Lt();return _0xf2780e['set']({'content':_0x379fc9}),_0xf2780e;}['_createPinButtonView'](_0x3825db){const _0xf4ff08=new yt(_0x3825db);return _0xf4ff08['set']({'label':Mi(_0x3825db,'AI_CHAT_HISTORY_PIN_BUTTON'),'icon':_0x2b631b,'withText':!0x1,'tooltip':!0x0}),_0xf4ff08['bind']('isOn')['to'](this,'pinned'),_0xf4ff08['on']('execute',()=>{const _0x2b586e=!this['pinned'];this['fire']('setConversationPinned',{'id':this['id'],'pinned':_0x2b586e});}),_0xf4ff08;}['_createMenuDropdownView'](){const _0x1f4591=Ft(this['locale']),_0x21d0cf=_0x1f4591['panelView']['children'];_0x1f4591['buttonView']['set']({'label':Mi(this['locale'],'AI_CHAT_HISTORY_SHOW_MORE_ITEMS'),'icon':_0x1c6e1f}),_0x1f4591['panelPosition']='sw';const _0x2ddbc3=new yt(this['locale']);_0x2ddbc3['label']=Mi(this['locale'],'AI_CHAT_HISTORY_EDIT_NAME'),_0x2ddbc3['withText']=!0x0,_0x2ddbc3['on']('execute',()=>{this['isEdit']=!0x0;});const _0x26e445=new yt(this['locale']);_0x26e445['label']=Mi(this['locale'],'AI_CHAT_HISTORY_REMOVE'),_0x26e445['withText']=!0x0,_0x26e445['on']('execute',()=>{this['showConfirm'](Mi(this['locale'],'AI_CHAT_HISTORY_REMOVE_CONFIRM'),this['element'])['then'](()=>{this['fire']('removeConversation',{'id':this['id']});});});const _0x4ce569=new Dt(this['locale']),_0x113566=new Ht(this['locale']);_0x113566['children']['add'](_0x2ddbc3);const _0x1a32c1=new Ht(this['locale']);return _0x1a32c1['children']['add'](_0x26e445),_0x4ce569['items']['addMany']([_0x113566,_0x1a32c1]),_0x21d0cf['add'](_0x4ce569),_0x1f4591;}['_createEditInputView'](_0x5049ad){const _0x540e0d=new _0x45cee5(_0x5049ad),_0xa6e45c=_0x540e0d['bindTemplate'];return _0x540e0d['extendTemplate']({'on':{'keydown':_0xa6e45c['to'](_0x3a6111=>{'Enter'==_0x3a6111['key']&&this['_commitEditInputValue'](_0x540e0d);})}}),_0x540e0d;}['_createAcceptEditButtonView'](_0x5774f2,_0x30588e){const _0x27d16f=new yt(_0x5774f2);return _0x27d16f['set']({'icon':_0x379fc9,'withText':!0x1,'tooltip':Mi(_0x5774f2,'AI_CHAT_HISTORY_ACCEPT')}),_0x27d16f['extendTemplate']({'attributes':{'class':['ck-confirm-view-submit']}}),_0x27d16f['on']('execute',()=>{this['_commitEditInputValue'](_0x30588e);}),_0x27d16f;}['_commitEditInputValue'](_0x4347dd){const _0x20bb7e=_0x4347dd['element']['value']||'';this['isEdit']=!0x1,this['fire']('editConversationTitle',{'id':this['id'],'title':_0x20bb7e});}['_createCancelEditButtonView'](_0x4ef6cf){const _0x27ca02=new yt(_0x4ef6cf);return _0x27ca02['set']({'icon':_0x36e8b7,'withText':!0x1,'tooltip':Mi(_0x4ef6cf,'AI_CHAT_HISTORY_CANCEL')}),_0x27ca02['extendTemplate']({'attributes':{'class':['ck-confirm-view-cancel']}}),_0x27ca02['on']('execute',()=>{this['isEdit']=!0x1,this['fire']('edit:cancel');}),_0x27ca02;}['_createSpinnerView'](){const _0x482d24=new AISpinnerView('tiny');return _0x482d24['isVisible']=!0x0,_0x482d24;}['isMatching'](_0x5a477c){return'string'==typeof this['title']&&this['title']['match'](_0x5a477c)?{'title':!0x0}:null;}['highlightText'](_0x31380c){this['_titleView']['highlightText'](_0x31380c);}}class AIChatHistoryView extends Nt{['headerView'];['searchView'];['mainErrorView'];['skeletonView'];['emptyView'];['sectionsView'];constructor(_0x1bfbac,_0x5c7b33){super(_0x1bfbac),this['set']('hasItems',!0x1),this['set']('isLoading',!0x0),this['set']('errorMessage',''),this['set']('isSearchViewVisible',!0x1),this['set']('isEmptyViewVisible',!0x1),this['set']('isMainErrorViewVisible',!0x1);const _0x27cc2a=Mn(_0x1bfbac,this);this['headerView']=new AIHeaderView(_0x1bfbac,{'label':Mi(_0x1bfbac,'AI_CHAT_HISTORY_HEADING'),'icon':_0x21c143,'class':'ck-ai-header_history','content':_0x27cc2a,'showResizeButton':_0x5c7b33}),this['headerView']['delegate']('resizeTabs')['to'](this),this['sectionsView']=new AIChatHistorySectionListView(_0x1bfbac,[]),this['sectionsView']['delegate'](...Un)['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',_0x4076bc=>!_0x4076bc)]}}),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 _0x34217f=new _0x24f927(this['locale'],{'filteredView':this['sectionsView'],'queryView':{'label':Mi(this['locale'],'AI_CHAT_HISTORY_SEARCH_LABEL')},'infoView':{'text':{'notFound':{'primary':_0x91346f=>Mi(this['locale'],'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_PRIMARY',_0x91346f),'secondary':Mi(this['locale'],'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_SECONDARY')}}}}),_0x1f3a64=this['_createErrorView']();return _0x1f3a64['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('errorMessage','ck-hidden',_0x30a751=>!_0x30a751)]}}),_0x34217f['on']('render',()=>{_0x34217f['children']['add'](_0x1f3a64,0x1);}),_0x34217f['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isSearchViewVisible','ck-hidden',_0x12cbdf=>!_0x12cbdf)]}}),_0x34217f;}['_createSkeletonView'](){const _0x1db213=new AISkeletonView(this['locale'],xs['aiHistory']);return _0x1db213['bind']('isVisible')['to'](this,'isLoading'),_0x1db213;}['_createErrorView'](){const _0x50619e=new Nt(this['locale']),_0x3829b3=new yt(this['locale']);_0x3829b3['set']({'withText':!0x1,'icon':_0x36e8b7,'class':'ck-ai-notification_error__dismiss-button'}),_0x3829b3['bind']('isVisible')['to'](this,'hasItems',_0x5dab13=>!!_0x5dab13),_0x3829b3['on']('execute',()=>{this['errorMessage']='';});const _0x4c7e71=this['bindTemplate'];return _0x50619e['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-notification','ck-ai-notification_error']},'children':[{'tag':'p','children':[{'text':_0x4c7e71['to']('errorMessage')}]},_0x3829b3]}),_0x50619e;}['_createEmptyStateView'](){const _0x3f3fdc=new Nt(this['locale']);return _0x3f3fdc['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-history__empty',this['bindTemplate']['if']('isEmptyViewVisible','ck-hidden',_0x4bf90d=>!_0x4bf90d)]},'children':[{'tag':'p','attributes':{'class':['ck-ai-chat-history__empty-message']},'children':[Mi(this['locale'],'AI_CHAT_HISTORY_EMPTY_MESSAGE')]}]}),_0x3f3fdc;}['_createListItemViews'](_0x449d46,_0x132153){const _0x16bd99=[];for(const _0x4074ab of _0x449d46){const _0x50f067=new AIChatHistoryListItemView(_0x132153,_0x4074ab);_0x50f067['delegate'](...Un)['to'](this),_0x16bd99['push'](_0x50f067);}return _0x16bd99;}['updateHistoryItemsWithCategories'](_0x2494d5){const _0x5e81e7=this['locale']||'en',_0x13b094=[];for(const _0x4452e3 of _0x2494d5){const _0x547397=this['_createListItemViews'](_0x4452e3['items'],_0x5e81e7);_0x13b094['push'](new AIChatHistoryListView(_0x5e81e7,{'title':_0x4452e3['title'],'items':_0x547397}));}this['sectionsView']['sections']=_0x13b094,this['sectionsView']['items']['clear'](),this['sectionsView']['items']['addMany'](_0x13b094),this['hasItems']=_0x2494d5['some'](_0x295574=>_0x295574['items']['length']>0x0),this['_refreshSearch']();}['removeHistoryItem'](_0x6a19c2){for(const _0x1ed34d of this['sectionsView']['sections']){const _0x3fce33=_0x1ed34d['getItem'](_0x6a19c2);if(_0x3fce33){if(_0x1ed34d['removeItem'](_0x3fce33),0x0===_0x1ed34d['itemsViews']['length']){const _0x43344f=this['sectionsView']['sections']['indexOf'](_0x1ed34d);-0x1!==_0x43344f&&(this['sectionsView']['sections']['splice'](_0x43344f,0x1),this['sectionsView']['items']['remove'](_0x1ed34d));}this['hasItems']=this['sectionsView']['sections']['length']>0x0,this['_refreshSearch']();break;}}}['updateItemTitle'](_0x30d28f,_0x46cd5c){for(const _0x4e67c9 of this['sectionsView']['sections']){const _0x30fe07=_0x4e67c9['getItem'](_0x30d28f);if(_0x30fe07){_0x30fe07['updateTitle'](_0x46cd5c);break;}}}['updateItemLoadingState'](_0x140514,_0x3a2324,_0x158823){for(const _0x39776c of this['sectionsView']['sections']){const _0x5490db=_0x39776c['getItem'](_0x140514);if(_0x5490db){_0x5490db['updateLoadingState'](_0x3a2324,_0x158823);break;}}}['_refreshSearch'](){if(this['hasItems']){const _0x2a38b7=this['searchView']['queryView']['fieldView']?.['element']?.['value']||'';this['searchView']['search'](_0x2a38b7);}}}const Un=['showConversationHistory','removeConversation','editConversationTitle','setConversationPinned','selectConversation','startConversation'];class AIChatHistoryUI extends _0x533560{static get['requires'](){return[AITabs];}['_historyView'];static get['pluginName'](){return'AIChatHistoryUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x4d2f59){super(_0x4d2f59);const _0x117da9=this['context']['plugins']['get']('AITabs');this['_historyView']=new AIChatHistoryView(this['context']['locale'],_0x117da9['showResizeButton']),this['_historyView']['delegate']('resizeTabs')['to'](_0x117da9),this['_historyView']['delegate'](...Un)['to'](this),this['_historyView']['headerView']['bind']('isMaximized')['to'](_0x117da9['view'],'isMaximized',_0x409b54=>_0x409b54),_0x117da9['view']['addTab']({'id':'history','buttonLabel':Mi(this['context']['locale'],'AI_CHAT_HISTORY_HEADING'),'buttonIcon':_0x21c143,'order':0x0,'content':this['_historyView']});}['removeHistoryItem'](_0x44849e){this['_historyView']['removeHistoryItem'](_0x44849e);}['updateItems'](_0x1757ae){this['_historyView']['updateHistoryItemsWithCategories'](_0x1757ae);}['updateItemTitle'](_0x216dda,_0x180ff3){this['_historyView']['updateItemTitle'](_0x216dda,_0x180ff3);}['updateItemLoadingState'](_0x39e2bc,_0x306a2,_0x5c142a){this['_historyView']['updateItemLoadingState'](_0x39e2bc,_0x306a2,_0x5c142a);}['setLoadingSkeleton'](_0x3c6670){this['_historyView']['isLoading']=_0x3c6670;}['showError'](_0x556a6d){this['_historyView']['errorMessage']=_0x556a6d;}['hideError'](){this['_historyView']['errorMessage']='';}}class AIChatHistoryItem extends ct(){['id'];['createdAt'];constructor({id:_0x43a4a5,title:_0x4eaeaa,createdAt:_0x379373,updatedAt:_0x170b62,pinned:_0x28555c}){super(),this['id']=_0x43a4a5,this['createdAt']=new Date(_0x379373),this['set']('title',_0x4eaeaa),this['set']('updatedAt',_0x170b62?new Date(_0x170b62):null),this['set']('pinned',_0x28555c||!0x1);}['updateTitle'](_0x2a2b8a){this['set']('title',_0x2a2b8a),this['updatedAt']=new Date();}['updatePinned'](_0x11a7ed){this['set']('pinned',_0x11a7ed),this['updatedAt']=new Date();}}class AIChatHistoryConversations extends Et(){['items']=[];['connector'];['group'];constructor({connector:_0x205f3b,group:_0x167297}){super(),this['connector']=_0x205f3b,this['group']=_0x167297;}async['init'](){try{const _0x1ee17f=this['connector']['fetchConversations'](this['group']),_0x42bb80=await _0x1ee17f['getConversations']();this['loadItems'](_0x42bb80);}catch(_0x5c0ac3){this['fire']('error',{'error':_0x5c0ac3,'operation':'init'});}}['addItem'](_0x3834f4){this['items']['push'](_0x3834f4);}async['removeItem'](_0x2b139d){const _0x3ba81b=this['items']['findIndex'](_0x16cf09=>_0x16cf09['id']===_0x2b139d);if(-0x1===_0x3ba81b)return!0x1;try{return await this['connector']['deleteConversation'](_0x2b139d)['execute'](),this['items']['splice'](_0x3ba81b,0x1),this['fire']('itemRemoved',{'itemId':_0x2b139d}),!0x0;}catch(_0xcc1a7d){return this['fire']('error',{'error':_0xcc1a7d,'operation':'removeItem','itemId':_0x2b139d}),!0x1;}}['getItem'](_0x42e357){return this['items']['find'](_0x28ce0c=>_0x28ce0c['id']===_0x42e357);}async['updateItemTitle'](_0x5b3129,_0x1df34a){const _0x5a8fcd=this['getItem'](_0x5b3129);if(!_0x5a8fcd)return!0x1;try{return await this['connector']['updateConversation'](_0x5b3129,{'title':_0x1df34a})['getResult'](),_0x5a8fcd['updateTitle'](_0x1df34a),this['fire']('itemUpdated',{'itemId':_0x5b3129,'updates':{'title':_0x1df34a}}),!0x0;}catch(_0x2f6a4f){return this['fire']('error',{'error':_0x2f6a4f,'operation':'updateItemTitle','itemId':_0x5b3129}),!0x1;}}async['updateItemPinned'](_0x1ddddb,_0x10b1be){const _0x3d2cee=this['getItem'](_0x1ddddb);if(!_0x3d2cee)return!0x1;try{return await this['connector']['updateConversation'](_0x1ddddb,{'pinned':_0x10b1be})['getResult'](),_0x3d2cee['updatePinned'](_0x10b1be),this['fire']('itemUpdated',{'itemId':_0x1ddddb,'updates':{'pinned':_0x10b1be}}),!0x0;}catch(_0x2e1132){return this['fire']('error',{'error':_0x2e1132,'operation':'updateItemPinned','itemId':_0x1ddddb}),!0x1;}}['loadItems'](_0x1185c3){try{this['items']=[],_0x1185c3['map'](_0x5c15f4=>{this['addItem'](new AIChatHistoryItem(_0x5c15f4));}),this['fire']('itemsLoaded',{'items':[...this['items']]});}catch(_0x2a99ab){this['fire']('error',{'error':_0x2a99ab,'operation':'loadItems'});}}['getItems'](_0x593775={}){const _0x672459=void 0x0!==_0x593775['pinned']&&_0x593775['pinned'],_0x4276a4=_0x593775['from']?new Date(_0x593775['from']['getFullYear'](),_0x593775['from']['getMonth'](),_0x593775['from']['getDate']()):null,_0x4191d1=_0x593775['to']?new Date(_0x593775['to']['getFullYear'](),_0x593775['to']['getMonth'](),_0x593775['to']['getDate']()):null;return this['items']['filter'](_0x155b02=>{if(_0x155b02['pinned']!==_0x672459)return!0x1;if(_0x4191d1){const _0x5685da=new Date(_0x155b02['createdAt']['getFullYear'](),_0x155b02['createdAt']['getMonth'](),_0x155b02['createdAt']['getDate']());return _0x4276a4?_0x4276a4['getTime']()===_0x4191d1['getTime']()?_0x5685da['getTime']()===_0x4276a4['getTime']():_0x5685da<_0x4191d1&&_0x5685da>=_0x4276a4:_0x5685da<_0x4191d1;}return!0x0;});}}class AIChatHistoryController extends _0x533560{['_aiConnector'];['_aiChatHistoryUi'];['_aiChatController'];static get['requires'](){return[AIConnector,AIChatController,AIChatHistoryUI,AITabs];}static get['pluginName'](){return'AIChatHistoryController';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){this['_aiConnector']=this['context']['plugins']['get'](AIConnector),this['_aiChatHistoryUi']=this['context']['plugins']['get'](AIChatHistoryUI),this['_aiChatController']=this['context']['plugins']['get'](AIChatController);const _0x4b4863=this['context']['plugins']['get'](AITabs);try{const _0x1d2ed3=this['_aiChatController']['getGroupId']();this['history']=new AIChatHistoryConversations({'connector':this['_aiConnector'],'group':_0x1d2ed3}),this['listenTo'](this['_aiChatHistoryUi'],'removeConversation',(_0x46843e,_0x372332)=>{this['_setItemLoading'](_0x372332['id'],'remove'),this['_handleRemove'](_0x372332['id']);}),this['listenTo'](this['_aiChatHistoryUi'],'editConversationTitle',(_0x44257b,_0x560e34)=>{this['_setItemLoading'](_0x560e34['id'],'rename'),this['_handleEditTitle'](_0x560e34['id'],_0x560e34['title']);}),this['listenTo'](this['history'],'itemUpdated',(_0x3eb474,_0x4182f0)=>{void 0x0!==_0x4182f0['updates']['title']&&this['_aiChatHistoryUi']['updateItemTitle'](_0x4182f0['itemId'],_0x4182f0['updates']['title']),void 0x0!==_0x4182f0['updates']['pinned']&&this['_updateHistoryItemsUI'](),this['_clearItemLoading'](_0x4182f0['itemId']);}),this['listenTo'](this['history'],'itemRemoved',(_0x814b64,_0x563ed1)=>{this['_aiChatController']['_handleRemovedConversation'](_0x563ed1['itemId']),this['_aiChatHistoryUi']['removeHistoryItem'](_0x563ed1['itemId']),this['_clearItemLoading'](_0x563ed1['itemId']);}),this['listenTo'](this['history'],'itemsLoaded',()=>{this['_updateHistoryItemsUI']();}),this['listenTo'](this['history'],'error',(_0x307699,_0x2821fa)=>{this['_handleHistoryErrorUI'](_0x2821fa['error'],_0x2821fa['operation'],_0x2821fa['itemId']);}),this['listenTo'](this['_aiChatHistoryUi'],'selectConversation',(_0x43553e,_0x469fcc)=>{this['_handleSelectConversation'](_0x469fcc['id']);}),this['listenTo'](this['_aiChatHistoryUi'],'setConversationPinned',(_0x4d180f,_0x2ad7d9)=>{const _0x34cae7=_0x2ad7d9['pinned']?'pin':'unpin';this['_setItemLoading'](_0x2ad7d9['id'],_0x34cae7),this['_handleTogglePin'](_0x2ad7d9['id'],_0x2ad7d9['pinned']);}),this['listenTo'](this['_aiChatHistoryUi'],'startConversation',()=>{this['_aiChatController']['startConversation'](),_0x4b4863['view']['activateTab']('chat');}),this['listenTo'](this['_aiChatController'],'change:activeConversation',()=>{this['_updateHistoryItemsUI']();}),_0x4b4863['view']['on']('activateTab:history',()=>{this['_showConversationHistory']();});}catch(_0x268b62){this['_handleHistoryErrorUI'](_0x268b62,'init');}}async['_handleEditTitle'](_0x3e42ed,_0x47ff0f){await this['history']['updateItemTitle'](_0x3e42ed,_0x47ff0f);}async['_handleTogglePin'](_0x4ecbb3,_0xf8b47f){await this['history']['updateItemPinned'](_0x4ecbb3,_0xf8b47f);}async['_handleRemove'](_0x53a30b){await this['history']['removeItem'](_0x53a30b);}async['_handleSelectConversation'](_0x16ece4){await this['_aiChatController']['loadConversation'](_0x16ece4);}async['_showConversationHistory'](){this['_aiChatHistoryUi']['showError'](''),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x0),await this['history']['init'](),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x1);}['_updateHistoryItemsUI'](){const _0x5b28af=this['_aiChatController']['activeConversation']?.['id'],_0x5c5555=this['_getCategorizedItems']()['map'](_0x565809=>({'title':_0x565809['title'],'items':_0x565809['items']['map'](_0x351bbd=>({'id':_0x351bbd['id'],'title':_0x351bbd['title']||Mi(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION'),'createdAt':new Date(_0x351bbd['createdAt'])['toLocaleDateString'](),'active':_0x351bbd['id']===_0x5b28af,'pinned':_0x351bbd['pinned']}))}));this['_aiChatHistoryUi']['updateItems'](_0x5c5555);}['_setItemLoading'](_0x487698,_0x151ca6){this['_aiChatHistoryUi']['updateItemLoadingState'](_0x487698,_0x151ca6,!0x0);}['_clearItemLoading'](_0x1cc0ff){this['_aiChatHistoryUi']['updateItemLoadingState'](_0x1cc0ff,null,!0x1);}['_handleHistoryErrorUI'](_0x4d0ed8,_0x263bc3,_0x5b052e){const _0xa61b=this['_generateErrorMessage'](_0x263bc3,_0x5b052e);this['_aiChatHistoryUi']['showError'](_0xa61b),_0x5b052e&&this['_clearItemLoading'](_0x5b052e),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x1);}['_generateErrorMessage'](_0x4bc1c9,_0x11b52f){const _0x25afd5=_0x11b52f?this['history']['getItem'](_0x11b52f):null,_0x55f92c=_0x25afd5?.['title']||Mi(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION');switch(_0x4bc1c9){case'updateItemTitle':return Mi(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_UPDATE_TITLE',_0x55f92c);case'updateItemPinned':{const _0x23181e=Mi(this['context']['locale'],_0x25afd5?.['pinned']?'AI_CHAT_HISTORY_UNPIN_ACTION':'AI_CHAT_HISTORY_PIN_ACTION');return Mi(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_UPDATE_PINNED',[_0x23181e,_0x55f92c]);}case'removeItem':return Mi(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_REMOVE_ITEM',_0x55f92c);case'init':case'loadItems':return Mi(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_LOAD_ITEMS');default:return Mi(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_GENERIC');}}['_getCategorizedItems'](){const _0x4099c5=new Date(),_0x25a868=new Date(_0x4099c5['getFullYear'](),_0x4099c5['getMonth'](),_0x4099c5['getDate']()),_0x268229=new Date(_0x25a868);_0x268229['setDate'](_0x268229['getDate']()-0x1);const _0x20fc04=new Date(_0x25a868);_0x20fc04['setDate'](_0x20fc04['getDate']()-0xe);const _0x377fdf=this['history']['getItems']({'pinned':!0x0}),_0x557d9d=this['history']['getItems']({'from':_0x25a868,'to':_0x25a868}),_0x5614d5=this['history']['getItems']({'from':_0x268229,'to':_0x268229}),_0x118e95=this['history']['getItems']({'from':_0x20fc04,'to':_0x268229}),_0x1b3a30=this['history']['getItems']({'to':_0x20fc04}),_0x20772b=[];return _0x377fdf['length']>0x0&&_0x20772b['push']({'title':Mi(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_PINNED'),'items':_0x377fdf}),_0x557d9d['length']>0x0&&_0x20772b['push']({'title':Mi(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_TODAY'),'items':_0x557d9d}),_0x5614d5['length']>0x0&&_0x20772b['push']({'title':Mi(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_YESTERDAY'),'items':_0x5614d5}),_0x118e95['length']>0x0&&_0x20772b['push']({'title':Mi(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_LAST_14_DAYS'),'items':_0x118e95}),_0x1b3a30['length']>0x0&&_0x20772b['push']({'title':Mi(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_LATER'),'items':_0x1b3a30}),_0x20772b;}}class AIChatHistory extends _0x533560{static get['requires'](){return[AIChatHistoryController,AIChatHistoryUI];}static get['pluginName'](){return'AIChatHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class AIChat extends _0x533560{static get['requires'](){return[AIChatController,AIEditing,AIChatUI,AIChatHistory];}static get['pluginName'](){return'AIChat';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x3b8f78){super(_0x3b8f78),this['context']['config']['define']('ai.chat.context',{'document':{'enabled':!0x0},'urls':{'enabled':!0x0},'files':{'enabled':!0x0},'sources':[],'alwaysAddSelection':!0x1,'paste':{'textThreshold':0x5dc}}),this['context']['config']['define']('ai.chat.initialConversation','new');}}class AIChatShortcutView extends yt{['id'];constructor(_0x42922f,_0x12009d){super(_0x42922f);const {id:_0x188ef5,type:_0x107745,icon:_0x125b01}=_0x12009d;this['id']=_0x188ef5,this['set']({'label':_0x12009d['label'],'withText':!0x0,'class':'ck-ai-chat-shortcut'}),this['extendTemplate']({'attributes':{'data-cke-ai-shortcut-id':_0x12009d['id']}}),_0x125b01?this['icon']=_0x125b01:'chat'===_0x107745?this['icon']=_0x1eba20:'review'===_0x107745?this['icon']=_0x402120:'translate'===_0x107745&&(this['icon']=_0x2e3d1e);}}class AIChatShortcutsView extends Nt{['listView'];constructor(_0x1f43de,_0x1730d3){super(_0x1f43de),this['set']('isEnabled',!0x0);const _0x235a31=_0x1730d3['map'](_0x187d6c=>{const _0x26342f=new Ht(this['locale']),_0x3cb064=new AIChatShortcutView(this['locale'],_0x187d6c);return _0x3cb064['bind']('isEnabled')['to'](this),_0x26342f['children']['add'](_0x3cb064),_0x3cb064['delegate']('execute')['to'](this),_0x26342f;});this['listView']=new Dt(this['locale']),this['listView']['items']['addMany'](_0x235a31),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-shortcuts']},'children':[this['listView']]});}}const Bn='chat-shortcuts';class AIChatShortcuts extends _0x533560{['_shortcuts'];['_shortcutsView'];['_aiChatUI'];['_listenedConversation'];static get['requires'](){return[AIChatUI];}static get['pluginName'](){return'AIChatShortcuts';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){this['_aiChatUI']=this['context']['plugins']['get'](AIChatUI),this['_shortcuts']=this['context']['config']['get']('ai.chat.shortcuts')??[];const _0x3227d4=this['context']['plugins']['get']('AIChatController');this['_shortcuts']['length']&&(this['_validateShortcuts'](),this['_aiChatUI']['on']('conversationCreated',()=>{const _0x3775c3=_0x3227d4['activeConversation'];_0x3775c3['isFromHistory']||this['_injectShortcuts'](_0x3775c3);}),this['listenTo'](_0x3227d4,'interactionStarted',()=>{this['_removeShortcuts']();}));}['_validateShortcuts'](){const _0x3a4e8c=['chat','review','translate'];this['_shortcuts']['forEach'](_0xc495af=>{let _0x8fe314=!0x0;if(_0xc495af['id']&&_0xc495af['label']&&_0x3a4e8c['includes'](_0xc495af['type'])?'chat'===_0xc495af['type']&&(_0x8fe314='string'==typeof _0xc495af['prompt']):_0x8fe314=!0x1,!_0x8fe314)throw new ht('ai-chat-shortcuts-invalid-config',this['context'],{'shortcut':_0xc495af});});}['_injectShortcuts'](_0x478885){this['_removeShortcuts'](),this['_shortcutsView']=new AIChatShortcutsView(this['context']['locale'],this['_shortcuts']),this['_shortcutsView']['render'](),this['_aiChatUI']['addFeedItemCustomElement'](this['_shortcutsView']['element'],Bn),this['_shortcutsView']['on']('execute',_0x56971a=>{const _0x5a02bb=_0x56971a['source']['id'];this['_executeShortcut'](_0x5a02bb);}),this['_listenedConversation']=_0x478885,this['listenTo'](_0x478885,'uploadProgressChanged',(_0x29533f,_0x4bae8c)=>{this['_shortcutsView']['isEnabled']=!_0x4bae8c['isUploadInProgress'];});}['_removeShortcuts'](){const _0xa02dea=this['context']['plugins']['get'](AIChatUI);_0xa02dea['hasFeedItem'](Bn)&&_0xa02dea['removeFeedItem'](Bn),this['_listenedConversation']&&(this['stopListening'](this['_listenedConversation'],'uploadProgressChanged'),this['_listenedConversation']=void 0x0),this['_shortcutsView']?.['destroy']();}['_executeShortcut'](_0x399274){const _0x549961=this['_shortcuts']['find'](_0x5e0f95=>_0x5e0f95['id']===_0x399274),_0x202414=_0x549961['type'];'chat'===_0x202414?this['_runChatShortcut'](_0x549961):'review'===_0x202414?_0x549961['commandId']?this['_runReviewShortcut'](_0x549961):this['_switchTab']('reviewMode'):'translate'===_0x202414&&(_0x549961['language']?this['_runTranslateShortcut'](_0x549961):this['_switchTab']('translate'));}['_switchTab'](_0x30836b){if(!this['context']['plugins']['has']('AITabs'))throw new ht('ai-chat-shortcuts-ai-tabs-not-found',this['context'],{'tabName':_0x30836b});this['context']['plugins']['get']('AITabs')['view']['activateTab'](_0x30836b);}async['_runChatShortcut']({prompt:_0x58b44b,draftMode:_0x2cf1d6,useWebSearch:_0x4c9e19=!0x1,useReasoning:_0x29e531=!0x1,model:_0x59270c}){const _0xc8b424=this['context']['plugins']['get']('AIChatController'),_0x30d991=_0xc8b424['activeConversation'];let _0x13a114;_0x13a114=_0x59270c?await _0x30d991['chatModels']['getModel'](_0x59270c):await _0x30d991['chatModels']['getDefault'](),_0x13a114&&await _0x30d991['setModel'](_0x13a114),_0x30d991['setWebSearch'](_0x4c9e19),_0x30d991['setReasoning'](_0x29e531),_0xc8b424['addCurrentDocumentToChatContext'](),_0x2cf1d6?(this['_aiChatUI']['setPromptInputValue'](_0x58b44b),this['_aiChatUI']['focusPromptInput'](!0x0)):_0xc8b424['sendMessage']({'message':_0x58b44b});}['_runReviewShortcut']({commandId:_0x51015e,model:_0x1d2924,prompt:_0x310b38,params:_0x529ecb}){if(!this['context']['plugins']['has']('AIReviewModeUI'))throw new ht('ai-chat-shortcuts-review-mode-not-found',this['context']);this['_switchTab']('reviewMode');const _0x5c81e9={'id':_0x51015e,'isCustom':'custom'===_0x51015e};_0x1d2924&&_0x310b38&&(_0x5c81e9['args']={'model':_0x1d2924,'prompt':_0x310b38}),_0x529ecb&&(_0x5c81e9['params']=_0x529ecb),this['context']['plugins']['get']('AIReviewModeUI')['fire']('runReviewCheck',_0x5c81e9);}['_runTranslateShortcut']({language:_0x1a79c1}){if(!this['context']['plugins']['has']('AITranslateUI'))throw new ht('ai-chat-shortcuts-translate-not-found',this['context']);this['_switchTab']('translate'),this['context']['plugins']['get']('AITranslateUI')['fire']('runReviewCheck',{'id':_0x1a79c1,'args':{'language':_0x1a79c1}});}}class ToggleAICommand extends _0x16583a{constructor(_0x531da8){super(_0x531da8);const _0x37f11e=_0x531da8['plugins']['get']('AITabs')['view'];this['bind']('value')['to'](_0x37f11e,'isVisible'),this['isEnabled']=!0x0;}['execute'](){const _0xd42a8e=this['editor']['plugins']['get']('AITabs')['view'];_0xd42a8e['isVisible']=!_0xd42a8e['isVisible'];}}class AIToggleButtonUI extends _0x3da4a3{static get['requires'](){return[AITabs];}static get['pluginName'](){return'AIToggleButtonUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x519929=this['editor'];_0x519929['commands']['add']('toggleAi',new ToggleAICommand(_0x519929)),_0x519929['ui']['componentFactory']['add']('toggleAi',()=>{const _0x509d93=this['_createAIUIButton'](yt);return _0x509d93['set']({'tooltip':!0x0,'class':'ck-ai-toggle-button'}),_0x509d93;}),_0x519929['ui']['componentFactory']['add']('menuBar:toggleAi',()=>{const _0xe89331=this['_createAIUIButton'](Yt);return _0xe89331['set']({'role':'menuitemcheckbox'}),_0xe89331;});}['_createAIUIButton'](_0x15ef68){const _0x45ea87=this['editor'],_0x279db7=_0x45ea87['commands']['get']('toggleAi'),_0x3f6155=new _0x15ef68(_0x45ea87['locale']);return _0x3f6155['set']({'label':Mi(_0x45ea87['locale'],'AI_TOGGLE_BUTTON_LABEL'),'icon':_0x167964,'isToggleable':!0x0}),_0x3f6155['bind']('isEnabled')['to'](_0x279db7),_0x3f6155['bind']('isOn')['to'](_0x279db7,'value',_0x24383c=>!!_0x24383c),this['listenTo'](_0x3f6155,'execute',()=>{_0x279db7['execute']();}),_0x3f6155;}}const Gn=['applySuggestion','insertSuggestion','showNext','showPrevious'];class AIBalloonView extends Nt{['_errorView'];constructor(_0xefda31){super(_0xefda31),this['set']('_errorMessage',''),this['set']('_isErrorVisible',!0x1);}['showBlockingError'](_0xca5525){this['showError'](_0xca5525);}['showError'](_0x34fada){this['_errorView']||(this['_errorView']=this['_createErrorView']()),this['_errorMessage']=_0x34fada,this['_isErrorVisible']=!0x0;}['hideError'](){this['_isErrorVisible']=!0x1;}['_createErrorView'](){const _0x599a09=new Nt(this['locale']),_0x55273f=new Nt(this['locale']);return _0x55273f['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__error-text']},'children':[{'text':this['bindTemplate']['to']('_errorMessage')}]}),_0x599a09['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__error','ck-ai-balloon-error',this['bindTemplate']['if']('_isErrorVisible','ck-hidden',_0x4c6ed2=>!_0x4c6ed2)]},'children':[_0x55273f]}),_0x599a09;}}const Fn=0xa;class AIBalloon extends _0x533560{static get['requires'](){return[AIEditing];}static get['pluginName'](){return'AIBalloon';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['isOpen']=!0x1;['_currentConfig'];['_editor'];['_isUpdatingMarkers']=!0x1;['open'](_0x5f3b65){const {id:_0x395000}=this['_currentConfig']??{};this['_currentConfig']=_0x5f3b65,this['_editor']=_0x5f3b65['targetEditor'];const {id:_0x37f2eb}=this['_currentConfig'];this['isOpen']&&_0x395000===_0x37f2eb?this['_updateDialog']():this['_showDialog']();}['close'](){const _0x404353=this['_editor'];if(!_0x404353)return;const _0x22fbec=_0x404353['plugins']['get']('Dialog');_0x22fbec['isOpen']&&this['_currentConfig']&&_0x22fbec['id']===this['_currentConfig']['id']&&_0x22fbec['hide']();}['_updateDialog'](){const _0x1aacd5=this['_editor']['plugins']['get']('Dialog'),{icon:_0x40bf54,title:_0x532527}=this['_currentConfig'];_0x1aacd5['view']?.['headerView']&&(_0x1aacd5['view']['headerView']['label']=_0x532527,_0x1aacd5['view']['headerView']['iconView']&&_0x40bf54&&(_0x1aacd5['view']['headerView']['iconView']['content']=_0x40bf54)),this['_isUpdatingMarkers']=!0x0,this['_showFakeVisualSelection'](),this['_isUpdatingMarkers']=!0x1,_0x1aacd5['view']?.['updatePosition']();}['_showFakeVisualSelection'](){this['context']['plugins']['get'](AIEditing)['showFakeVisualSelection']({'editor':this['_editor'],'ranges':this['_currentConfig']['ranges'],'id':'balloon','priority':0x64}),window['getSelection']()?.['removeAllRanges']();}['_hideFakeVisualSelection'](){this['context']['plugins']['get'](AIEditing)['hideFakeVisualSelection']('balloon');}['_showDialog'](){const _0x30ef72=this['_editor']['plugins']['get']('Dialog'),{id:_0xac3b43,title:_0x541d4f,icon:_0x227785,class:_0x356a67,mainView:_0xe34661}=this['_currentConfig'];_0xe34661['delegate'](...Gn)['to'](this),_0x30ef72['show']({'title':_0x541d4f,'icon':_0x227785,'hasCloseButton':!0x0,'id':_0xac3b43,'position':this['_calculateDialogPosition']['bind'](this),'className':'ck-ai-balloon\x20'+(_0x356a67||''),'content':_0xe34661,'onShow':_0x343f1b=>{this['_showFakeVisualSelection'](),this['_setupFakeVisualSelectionMarkerRemovalListener'](),_0x343f1b['view']?.['updatePosition']();const _0x45053b=this['_getSelectionElements']();_0x45053b&&_0x45053b[0x0]&&Tt({'target':_0x45053b[0x0],'ancestorOffset':0x14,'alignToTop':!0x0,'viewportOffset':{'top':0x14,'bottom':0x14,'left':0x0,'right':0x0}}),this['isOpen']=!0x0,_0x343f1b['once']('hide',()=>{this['fire']('beforeDialogClosed',{'id':_0xac3b43});},{'priority':'high'});},'onHide':()=>{this['_hideFakeVisualSelection'](),this['_cleanupFakeVisualSelectionMarkerRemovalListener'](),this['fire']('dialogClosed',{'id':_0xac3b43}),this['isOpen']=!0x1;}});}['_calculateDialogPosition'](_0x14e880,_0x3b70c3){if(!_0x3b70c3){const _0xc6b67=this['_getTargetRootDomRect']();if(!_0xc6b67)return null;_0x3b70c3=_0xc6b67;}const _0x18a41e=this['_getSelectionElements']();if(!_0x18a41e||0x0===_0x18a41e['length'])return{'left':Math['round'](_0x3b70c3['left']+_0x3b70c3['width']/0x2-_0x14e880['width']/0x2),'top':Math['round'](_0x3b70c3['top']+_0x3b70c3['height']/0x2-_0x14e880['height']/0x2)};const _0x27e469=Math['round'](_0x3b70c3['left']+_0x3b70c3['width']/0x2-_0x14e880['width']/0x2),_0x9a6758=_0x18a41e['map'](_0x10d7ff=>new dt(_0x10d7ff)),_0x2b44fd=_0x14e880['height'];return{'left':_0x27e469,'top':this['_calculateOptimalTopPosition'](_0x9a6758,_0x2b44fd,_0x3b70c3)};}['_calculateOptimalTopPosition'](_0x5902b1,_0x341e95,_0x40a2f9){const _0x2378a6=new dt(lt['window']),_0x250fee=_0x5902b1['map'](_0x294794=>_0x294794['getVisible']())['filter'](_0x68b447=>_0x68b447),_0x1b7a91=dt['getBoundingRect'](_0x250fee);if(!_0x1b7a91)return Math['round'](_0x40a2f9['top']+_0x40a2f9['height']/0x2);const _0x351477=_0x2378a6['getIntersection'](_0x1b7a91);if(!_0x351477)return Math['round'](_0x40a2f9['top']+_0x40a2f9['height']/0x2);const _0x13b9a0=_0x40a2f9['getVisible'](),_0x174986=_0x13b9a0&&_0x1b7a91['height']>_0x13b9a0['height'],_0x42e869=_0x351477['top'],_0xb39af5=_0x351477['bottom'];if(_0x174986){const _0x299fe0=(_0x13b9a0||_0x2378a6)['height']/0x2-_0x341e95/0x2,_0xcb40e6=_0x42e869-Fn-_0x40a2f9['top'],_0x51110b=_0x40a2f9['bottom']-_0xb39af5-Fn;return _0xcb40e6>=_0x341e95?Math['max'](Fn,_0x42e869-_0x341e95-Fn):_0x51110b>=_0x341e95?_0xb39af5+Fn:Math['max'](Fn,_0x299fe0);}const _0x95f815=_0x42e869-_0x341e95,_0x5b6f7e=_0x40a2f9['bottom']-_0xb39af5-Fn,_0x3468bd=_0x42e869-Fn-_0x40a2f9['top'];let _0x368301;if(_0x5b6f7e>=_0x341e95)_0x368301=_0xb39af5+Fn;else{if(_0x3468bd>=_0x341e95)_0x368301=_0x95f815-Fn;else _0x368301=_0x42e869+_0x1b7a91['height']/0x2-_0x341e95/0x2;}return _0x368301;}['_setupFakeVisualSelectionMarkerRemovalListener'](){const _0x2a272b=this['_editor'];this['listenTo'](_0x2a272b['model']['document'],'change',()=>{if(!this['_isUpdatingMarkers']){for(const {name:_0x3702be,data:{newRange:_0x4c5e81}}of _0x2a272b['model']['document']['differ']['getChangedMarkers']())if(_0x3702be['startsWith'](fs+':')&&(_0x4c5e81&&(_0x4c5e81['start']['isEqual'](_0x4c5e81['end'])||'$graveyard'==_0x4c5e81['root']['rootName'])||null==_0x4c5e81)){const _0x30f2f4=Mi(this['context']['locale'],'AI_BALLOON_SELECTION_REMOVED_ERROR');this['_currentConfig']['mainView']['showBlockingError'](_0x30f2f4),this['fire']('selectionRemoved');}}});}['_cleanupFakeVisualSelectionMarkerRemovalListener'](){const _0x47066e=this['_editor'];this['_currentConfig']['mainView']['hideError'](),this['stopListening'](_0x47066e['model']['document']);}['_getSelectionElements'](){const _0xae50a5=this['_editor'];return _0x58e3a5(_0xae50a5['editing'],[..._0xae50a5['model']['markers']['getMarkersGroup']('ai-selection'),..._0xae50a5['model']['markers']['getMarkersGroup']('ai-balloon-selection')]);}['_getTargetRootDomRect'](){const _0xcbabcb=this['_currentConfig']?.['ranges']?.[0x0]?.['root'];if(!_0xcbabcb)return null;const _0x5f3720=this['_editor'],_0x596f72=_0x5f3720['editing']['view']['document']['getRoot'](_0xcbabcb['rootName']);if(!_0x596f72)return null;const _0x56c85b=_0x5f3720['editing']['view']['domConverter']['mapViewToDom'](_0x596f72);return _0x56c85b&&_0x56c85b instanceof HTMLElement?new dt(_0x56c85b):null;}}class AIMiniToolbarView extends kt{['copyButton'];['likeButton'];['dislikeButton'];['showChangesButton'];['_config'];constructor(_0xc3b9a1,_0x894e2d={}){super(_0xc3b9a1),this['set']('isEnabled',!0x0),this['set']('isShowChangesOn',!0x1),this['_config']={'showCopy':!0x1,'showLike':!0x1,'showDislike':!0x1,..._0x894e2d};const _0x1355ff=!(this['_config']['showCopy']||this['_config']['showChanges']||this['_config']['showLike']||this['_config']['showDislike']||this['_config']['customView']?.['length']);this['class']=_0x1355ff?'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'](_0x54de0e){this['showChangesButton']['isEnabled']=_0x54de0e;}['_setupRatingButtons'](){this['likeButton']=new yt(this['locale']),this['likeButton']['set']({'icon':_0x33ab75,'label':Mi(this['locale'],'AI_MINI_TOOLBAR_LIKE'),'class':Gi,'tooltip':!0x0}),this['likeButton']['bind']('isEnabled')['to'](this),this['likeButton']['on']('execute',()=>{this['fire']('like');}),this['dislikeButton']=new yt(this['locale']),this['dislikeButton']['set']({'icon':_0x4de032,'label':Mi(this['locale'],'AI_MINI_TOOLBAR_DISLIKE'),'class':Gi,'tooltip':!0x0}),this['dislikeButton']['bind']('isEnabled')['to'](this),this['dislikeButton']['on']('execute',()=>{this['fire']('dislike');});}['_setupCopyButton'](){this['copyButton']=new yt(this['locale']),this['copyButton']['set']({'icon':_0x49b34b,'label':Mi(this['locale'],'AI_MINI_TOOLBAR_COPY'),'class':'ck-ai-mini-toolbar-copy-button\x20'+Gi,'tooltip':!0x0}),this['copyButton']['bind']('isEnabled')['to'](this);const _0x4357e6=new Lt();_0x4357e6['set']({'content':_0x379fc9}),_0x4357e6['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'+Gi,setTimeout(()=>{this['copyButton']['class']='ck-ai-mini-toolbar-copy-button\x20'+Gi;},0x7d0);}),this['copyButton']['children']['add'](_0x4357e6);}['_setupShowChangesButton'](){this['showChangesButton']=new yt(this['locale']),this['showChangesButton']['set']({'icon':_0x2a7839,'label':Mi(this['locale'],'AI_SUGGESTION_BUTTON_SHOW_CHANGES'),'withText':'full'==this['_config']['showChanges'],'tooltip':'full'!=this['_config']['showChanges'],'class':Gi}),this['showChangesButton']['bind']('isOn')['to'](this,'isShowChangesOn'),this['showChangesButton']['bind']('isEnabled')['to'](this),this['showChangesButton']['bind']('icon')['to'](this,'isShowChangesOn',_0x1f77f6=>_0x1f77f6?_0x28bbf3:_0x2a7839),this['showChangesButton']['on']('execute',()=>{this['fire']('toggleShowChanges');});}}class AIChatBalloonView extends AIBalloonView{['children'];['nextButtonView'];['previousButtonView'];['focusCycler'];['_focusables'];['_focusTracker'];['_keystrokes'];['_config'];['_streamableContentView'];['_toolbarContainerView'];['_partToolbarView'];['_stateView'];['_miniToolbarView'];constructor(_0x5212c9,_0x4b9468){super(_0x5212c9);const _0x3d5833=this['bindTemplate'];this['set']('showDiff',!0x1),this['set']('_state','pending'),this['_focusTracker']=new It(),this['_keystrokes']=new At(),this['_focusables']=this['createCollection'](),this['focusCycler']=new Ut({'focusables':this['_focusables'],'focusTracker':this['_focusTracker'],'keystrokeHandler':this['_keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}),this['_config']=_0x4b9468,this['nextButtonView']=this['_createNextButtonView'](),this['previousButtonView']=this['_createPreviousButtonView'](),this['_streamableContentView']=new AISuggestionStreamableContentView(_0x5212c9),this['_partToolbarView']=new AISuggestionContentPartToolbarView(_0x5212c9,_0x4b9468['availableActions']),this['_partToolbarView']['delegate']('applySuggestion','insertSuggestion','rejectSuggestion')['to'](this),this['_togglePartToolbarButtonsVisibility'](_0x4b9468),this['_stateView']=new AISuggestionContentPartStateView(_0x5212c9),this['_stateView']['isVisible']=!0x1,this['_miniToolbarView']=new AIMiniToolbarView(_0x5212c9,{'showChanges':'full'}),this['_miniToolbarView']['bind']('isShowChangesOn')['to'](this,'showDiff'),this['_miniToolbarView']['on']('toggleShowChanges',()=>{this['fire']('toggleSuggestionDisplayMode');}),this['_toolbarContainerView']=new AIChatBalloonToolbarContainerView(_0x5212c9,[this['_partToolbarView'],this['_stateView'],this['_miniToolbarView']]),this['children']=this['createCollection']([this['_streamableContentView'],this['_toolbarContainerView']]),this['on']('change:_state',(_0x3565d9,_0x36feeb,_0x3143b9,_0x40cf9a)=>{let _0x5cb1d1,_0x45350c;'pending'===_0x40cf9a?(_0x5cb1d1=this['_partToolbarView'],_0x45350c=this['_stateView']):(_0x5cb1d1=this['_stateView'],_0x45350c=this['_partToolbarView']),this['_stateView']['setState'](_0x3143b9),_0x5cb1d1['isVisible']=!0x1,_0x45350c['isVisible']=!0x0;}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-balloon-main',_0x3d5833['to']('_state',_0xb74b6e=>'ck-ai-chat-balloon-main_state_'+_0xb74b6e)]},'children':this['children']}),this['on']('change:isTrackChangesOn',()=>{this['_togglePartToolbarButtonsVisibility'](_0x4b9468);});}['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'](_0x1bc3e9){_0x1bc3e9?.['keepErrors']||this['hideError'](),await this['_streamableContentView']['update'](_0x1bc3e9);}['clearContent'](){this['_streamableContentView']['clear']();}['setState'](_0x241979){this['_state']=_0x241979;}['showError'](_0x2644bf){super['showError'](_0x2644bf),this['children']['has'](this['_errorView'])||this['children']['add'](this['_errorView'],0x0);}['hideError'](){this['_isErrorVisible']&&(super['hideError'](),this['togglePartToolbarEnabled'](!0x0));}['showBlockingError'](_0x166dfd){super['showBlockingError'](_0x166dfd),this['togglePartToolbarEnabled'](!0x1);}['toggleRotatorButtonsVisibility'](_0x3977d0){this['nextButtonView']['isVisible']=this['previousButtonView']['isVisible']=_0x3977d0;}['togglePartToolbarEnabled'](_0xa5eebd){this['_partToolbarView']['isEnabled']=_0xa5eebd;}['_togglePartToolbarButtonsVisibility']({showApplyButton:_0x3c92a8,showSuggestButton:_0x381d50}){_0x3c92a8=_0x3c92a8&&!this['isTrackChangesOn']&&this['_config']['availableActions']['includes']('applySuggestion'),_0x381d50=_0x381d50&&this['_config']['availableActions']['includes']('insertSuggestion'),this['_partToolbarView']['setButtonsVisibility']({'showApplyButton':_0x3c92a8,'showSuggestButton':_0x381d50});}['_createNextButtonView'](){const _0xfd7073=new yt(this['locale']);return _0xfd7073['set']({'icon':_0x3d3a41,'label':Mi(this['locale'],'AI_BALLOON_NEXT_LABEL'),'isVisible':!0x0}),_0xfd7073['on']('execute',()=>{this['fire']('showNext');}),_0xfd7073;}['_createPreviousButtonView'](){const _0x56e80a=new yt(this['locale']);return _0x56e80a['set']({'icon':_0x112336,'label':Mi(this['locale'],'AI_BALLOON_PREVIOUS_LABEL'),'isVisible':!0x0}),_0x56e80a['on']('execute',()=>{this['fire']('showPrevious');}),_0x56e80a;}}class AIChatBalloonToolbarContainerView extends Nt{constructor(_0x37db4b,_0x4f4587){super(_0x37db4b),this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-balloon__toolbar-container']},'children':_0x4f4587});}}class AIChatBalloon extends _0x3da4a3{static get['requires'](){return[Gt,AIBalloon];}static get['pluginName'](){return'AIChatBalloon';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['_chatBalloonView'];constructor(_0x8be0fa){super(_0x8be0fa),this['set']('showDiff',!0x1);}['open'](_0x13a1f6){const _0x323ec3=this['editor'];this['_chatBalloonView']||(this['_chatBalloonView']=this['_createChatBalloonView']()),_0x323ec3['plugins']['get']('AIBalloon')['open']({..._0x13a1f6,'id':'aiChatBalloon','class':'ck-ai-chat-balloon','mainView':this['_chatBalloonView']}),this['_toggleRotatorButtonsInDialogHeader'](_0x13a1f6['showRotator']),this['_chatBalloonView']['togglePartToolbarEnabled'](!_0x13a1f6['areActionsDisabled']),this['_restoreDefaultViewFocus']();}['close'](){this['editor']['plugins']['get']('AIBalloon')['close']();}['updateContent'](_0x396577){return this['_chatBalloonView']||(this['_chatBalloonView']=this['_createChatBalloonView']()),this['_chatBalloonView']['updateContent'](_0x396577);}['clearContent'](){this['_chatBalloonView']&&this['_chatBalloonView']['clearContent']();}['setState'](_0x28d2ba){this['_chatBalloonView']&&this['_chatBalloonView']['setState'](_0x28d2ba);}['_createChatBalloonView'](){const _0x5d66f8=this['editor'],_0x498fbc=_0x5d66f8['plugins']['get']('AIBalloon'),_0x4a7bcb=_0x5d66f8['commands']['get']('trackChanges');let _0x2e5276=_0x5d66f8['config']['get']('ai.availableReplyActions')||[...Ps];_0x5d66f8['plugins']['has']('TrackChanges')||(_0x2e5276=_0x2e5276['filter'](_0x3c019b=>'insertSuggestion'!=_0x3c019b));const _0x2bf33d=new AIChatBalloonView(_0x5d66f8['locale'],{'availableActions':_0x2e5276,'showApplyButton':!0x0,'showSuggestButton':!!_0x4a7bcb});return _0x2bf33d['bind']('showDiff')['to'](this),_0x2bf33d['delegate'](...bs)['to'](this),_0x2bf33d['delegate']('showPrevious','showNext')['to'](this),_0x498fbc['delegate']('dialogClosed')['to'](this),_0x2bf33d['on']('applySuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x2bf33d['on']('insertSuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x2bf33d['on']('rejectSuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x4a7bcb&&_0x2bf33d['bind']('isTrackChangesOn')['to'](_0x4a7bcb,'value'),_0x2bf33d['render'](),_0x2bf33d;}['_toggleRotatorButtonsInDialogHeader'](_0x32781c){const _0x2d7c6c=this['editor'],_0x3adeac=_0x2d7c6c['plugins']['get']('Dialog')['view']['headerView']['children'];this['_chatBalloonView']['toggleRotatorButtonsVisibility'](_0x32781c),_0x3adeac['has'](this['_chatBalloonView']['previousButtonView'])||(_0x3adeac['addMany']([this['_chatBalloonView']['previousButtonView'],this['_chatBalloonView']['nextButtonView']],0x0),_0x2d7c6c['plugins']['get']('AIBalloon')['once']('beforeDialogClosed',()=>{_0x3adeac['remove'](this['_chatBalloonView']['previousButtonView']),_0x3adeac['remove'](this['_chatBalloonView']['nextButtonView']);}));}['_restoreDefaultViewFocus'](){this['_chatBalloonView']['focus']();}}class AIEditorIntegration extends _0x3da4a3{static get['requires'](){return[AIToggleButtonUI,AIChatBalloon,_0x204243];}static get['pluginName'](){return'AIEditorIntegration';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}function Wn(_0x29a7ba){const {editor:_0x42a72e,action:_0x1317c1,withText:_0x3f197a=!0x1,withIcon:_0x4122af=!0x0,isInDropdown:_0x590e6a=!0x0,shouldPreventFocus:_0x54903d=!0x1,actionButtons:_0x4754ff}=_0x29a7ba;return()=>{const _0x59dfe2=_0x42a72e['locale'],_0x24a59e=new yt(_0x59dfe2),_0x1d14f1=_0x24a59e['bindTemplate'];_0x590e6a&&_0x24a59e['extendTemplate']({'on':{'mouseenter':_0x1d14f1['to'](()=>{_0x54903d&&_0x54903d()||_0x24a59e['focus']();})}}),_0x4754ff['push']({'buttonView':_0x24a59e,'action':_0x1317c1});const _0x4f77bf=_0x1317c1['icon']??_0x1317c1['parent']?.['icon'];return _0x24a59e['set']({'label':_0x1317c1['label'],'withText':_0x3f197a,'role':'menuitem','icon':_0x4122af?_0x4f77bf??_0x1226aa:void 0x0,'tooltip':!_0x3f197a,'class':'ck-ai-quick-actions-button','isEnabled':_0x1317c1['isEnabled']}),_0x24a59e['on']('execute',()=>{_0x42a72e['editing']['view']['focus'](),_0x42a72e['commands']['execute']('aiQuickAction',_0x1317c1);}),_0x24a59e;};}class DropdownMenuButtonWithHighlightView extends _0x3409b2{['arrowView'];constructor(_0x1f6936,_0x499d7d){super(_0x1f6936,_0x499d7d);const _0x1e9e31=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',_0x20034f=>String(_0x20034f)),'data-cke-tooltip-disabled':_0x1e9e31['to']('isOn')},'on':{'mouseenter':_0x1e9e31['to']('mouseenter')}});}['render'](){super['render'](),this['children']['add'](this['arrowView']);}['_createArrowView'](){const _0x1d43f1=new Lt();return _0x1d43f1['content']=_0x13e84e,_0x1d43f1['extendTemplate']({'attributes':{'class':'ck-dropdown-menu-list__nested-menu__button__arrow'}}),_0x1d43f1;}}class AIQuickActionsFilteredListView extends Dt{['_allListItems'];['_allSearchableItems'];constructor(_0x54c023,_0xec3d1b,_0x4832b6){super(_0x54c023),this['_allListItems']=_0xec3d1b,this['_allSearchableItems']=_0x4832b6;}['filter'](_0x2d6f83){if(!_0x2d6f83)return this['items']['clear'](),this['items']['addMany'](this['_allListItems']),this['_clearHighlight'](),{'resultsCount':this['_allListItems']['length'],'totalItemsCount':this['_allListItems']['length']};const _0x22277d=_0x2d6f83['source']['toLowerCase']()['trim'](),_0x1fa69b=this['_allSearchableItems']['filter'](_0x6364e1=>(_0x6364e1['groupLabel']?_0x6364e1['label']+'\x20('+_0x6364e1['groupLabel']+')':_0x6364e1['label'])['toLowerCase']()['includes'](_0x22277d));return this['items']['clear'](),this['items']['addMany'](_0x1fa69b['sort']((_0x208fc5,_0x3ac7f0)=>{const _0x260d3e=_0x208fc5['groupLabel'],_0x44ca40=_0x3ac7f0['groupLabel'];return _0x260d3e||_0x44ca40?_0x260d3e?0x1:-0x1:0x0;})['map'](_0x325159=>_0x325159['item'])),this['_highlightQuery'](_0x22277d,_0x1fa69b),{'resultsCount':_0x1fa69b['length'],'totalItemsCount':this['_allSearchableItems']['length']};}['_highlightQuery'](_0x229cb4,_0x405e34){if(!_0x229cb4)return;const _0x2b091d=new RegExp(_0x330c80(_0x229cb4),'gi');_0x405e34['forEach'](_0x2e51c9=>{_0x2e51c9['highlightViews']&&_0x2e51c9['highlightViews']['forEach'](_0xf08e60=>{'function'==typeof _0xf08e60['highlightText']&&_0xf08e60['highlightText'](_0x2b091d);});});}['_clearHighlight'](){this['_allSearchableItems']['forEach'](_0x58f2ca=>{_0x58f2ca['highlightViews']&&_0x58f2ca['highlightViews']['forEach'](_0x23faf1=>{'function'==typeof _0x23faf1['highlightText']&&_0x23faf1['highlightText'](null);});});}}const Kn='menu',Yn='menuitem';class AIQuickActionsDropdownContentView extends Nt{['_bodyCollection'];['optionsListView'];['_searchTextView']=null;['_allSearchableItems']=[];['children'];['focusTracker'];['keystrokes'];['_focusables'];['focusCycler'];['_openNestedPanels']=new Set();['_hasSearch'];['_actionButtons'];constructor(_0x27ba69,_0x10543f,_0x34ad38,_0x3f2ce8,_0x1e8b11=!0x1,_0x9e90b=[]){const _0x48423f=_0x27ba69['locale'];super(_0x48423f),this['_bodyCollection']=_0x3f2ce8,this['_hasSearch']=_0x1e8b11,this['_actionButtons']=_0x9e90b;const _0x4b7c36=this['_createListItems'](_0x27ba69,_0x10543f,_0x34ad38);this['optionsListView']=new AIQuickActionsFilteredListView(_0x48423f,_0x4b7c36,this['_allSearchableItems']),this['optionsListView']['role']=Kn,this['optionsListView']['items']['addMany'](_0x4b7c36),this['focusTracker']=new It(),this['keystrokes']=new At(),_0x1e8b11&&(this['_searchTextView']=this['_createSearchTextView']()),this['_focusables']=_0x4b7c36,this['focusCycler']=new Ut({'focusables':this['_focusables'],'focusTracker':this['focusTracker'],'keystrokeHandler':this['keystrokes']}),_0x1e8b11&&this['_searchTextView']&&this['focusCycler']['chain'](this['_searchTextView']['focusCycler']);const _0xbb0ed=_0x1e8b11&&this['_searchTextView']?[this['_searchTextView']]:[this['optionsListView']];this['children']=new _0x327646(_0xbb0ed),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions','ck-rounded-corners'],'dir':_0x48423f['uiLanguageDirection']},'children':this['children']});}['_createSearchTextView'](){return new _0x24f927(this['locale'],{'filteredView':this['optionsListView'],'queryView':{'label':Mi(this['locale'],'AI_QUICK_ACTIONS_SEARCH')},'class':'ck-ai-quick-actions-search','infoView':{'text':{'notFound':{'primary':Mi(this['locale'],'AI_QUICK_ACTIONS_SEARCH_NOT_FOUND')}}}});}['_isSearchFocused'](){if(!this['_hasSearch']||!this['_searchTextView']||!this['_searchTextView']['queryView']['fieldView']['element'])return!0x1;const _0x3c3fa0=this['_searchTextView']['queryView']['fieldView']['element']['ownerDocument']?.['activeElement'];return this['_searchTextView']['queryView']['fieldView']['element']['contains'](_0x3c3fa0);}['_createListItems'](_0x1e0638,_0x2cf1fc,_0x1e1f8e){const _0x437251=new _0x327646();return _0x2cf1fc['forEach'](_0xf9e379=>{if('actions'in _0xf9e379){const {listItem:_0x19acfb}=this['_createActionGroupButton'](_0x1e0638,_0xf9e379,_0x1e1f8e);_0x437251['add'](_0x19acfb),_0xf9e379['actions']['forEach'](_0x25998c=>{const {listItem:_0x894dba,highlightViews:_0x36bd6a}=this['_createSearchResultActionButton'](_0x1e0638,_0x25998c,_0xf9e379['label'],_0xf9e379['icon']);this['_allSearchableItems']['push']({'item':_0x894dba,'label':_0x25998c['label'],'groupLabel':_0xf9e379['label'],'highlightViews':_0x36bd6a});});}else{const {listItem:_0x2aa66c}=this['_createActionButton'](_0x1e0638,_0xf9e379);_0x437251['add'](_0x2aa66c);const _0x32c2ec=_0x2aa66c['children']['first'];if(_0x32c2ec){const {listItem:_0x2ee9f5,highlightViews:_0x449b4c}=this['_createSearchResultActionButton'](_0x1e0638,_0xf9e379);this['_allSearchableItems']['push']({'item':_0x2ee9f5,'label':_0x32c2ec['label']||'','highlightViews':_0x449b4c});}}}),_0x437251;}['_createActionButton'](_0x65a74d,_0x82564d,_0x17b06b,_0x529560){const _0x3a10dc=new Ht(this['locale']);if(_0x17b06b&&_0x529560){const _0x36650f=new yt(this['locale']),_0xcd3bd6=_0x36650f['bindTemplate'],_0x1514db=new _0x5a7c84();_0x1514db['text']=_0x82564d['label'];const _0x48adc8=new _0x5a7c84();_0x48adc8['text']=_0x17b06b;const _0x5a164a=new Lt();_0x5a164a['content']=_0x529560,_0x5a164a['extendTemplate']({'attributes':{'class':'ck-ai-quick-actions-button__group-icon'}});const _0x398c1b=new Nt(this['locale']);_0x398c1b['setTemplate']({'tag':'span','attributes':{'class':'ck-ai-quick-actions-button_with-group__open-paren'},'children':[{'text':'\x20('}]});const _0x2e0fee=new Nt(this['locale']);return _0x2e0fee['setTemplate']({'tag':'span','attributes':{'class':'ck-ai-quick-actions-button_with-group__close-paren'},'children':[{'text':')'}]}),_0x36650f['set']({'label':_0x82564d['label']+'\x20('+_0x17b06b+')','withText':!0x0,'role':'menuitem','class':'ck-ai-quick-actions-button\x20ck-ai-quick-actions-button_with-group','tooltip':!0x1,'isEnabled':_0x82564d['isEnabled']}),_0x36650f['setTemplate']({'tag':'button','attributes':{'class':['ck','ck-button','ck-button_with-text','ck-ai-quick-actions-button','ck-ai-quick-actions-button_with-group',_0xcd3bd6['if']('isEnabled','ck-disabled',_0x852c31=>!_0x852c31)],'type':'button','role':'menuitem','tabindex':'-1'},'children':[_0x1514db,_0x398c1b,_0x5a164a,_0x48adc8,_0x2e0fee],'on':{'mouseenter':_0xcd3bd6['to'](()=>{this['_isSearchFocused']()||_0x36650f['focus']();}),'click':_0xcd3bd6['to'](()=>{_0x36650f['fire']('execute');})}}),_0x36650f['on']('execute',()=>{_0x36650f['isEnabled']&&(_0x65a74d['editing']['view']['focus'](),_0x65a74d['commands']['execute']('aiQuickAction',_0x82564d));}),_0x3a10dc['children']['add'](_0x36650f),this['_actionButtons']['push']({'buttonView':_0x36650f,'action':_0x82564d}),{'listItem':_0x3a10dc,'highlightViews':[_0x1514db,_0x48adc8]};}{const _0x1b13fe=new _0x862a5b(),_0x396d44=new yt(this['locale'],_0x1b13fe),_0x11686d=_0x396d44['bindTemplate'],_0x48ccfe=_0x82564d['icon']??_0x82564d['parent']?.['icon'],_0x211b30=void 0x0!==_0x82564d['icon'];return _0x396d44['set']({'label':_0x82564d['label'],'withText':!0x0,'role':'menuitem','icon':_0x211b30?_0x48ccfe??_0x1226aa:void 0x0,'tooltip':!0x1,'class':'ck-ai-quick-actions-button','isEnabled':_0x82564d['isEnabled']}),_0x396d44['extendTemplate']({'on':{'mouseenter':_0x11686d['to'](()=>{this['_isSearchFocused']()||_0x396d44['focus']();})}}),_0x396d44['on']('execute',()=>{_0x65a74d['editing']['view']['focus'](),_0x65a74d['commands']['execute']('aiQuickAction',_0x82564d);}),_0x3a10dc['children']['add'](_0x396d44),this['_actionButtons']['push']({'buttonView':_0x396d44,'action':_0x82564d}),{'listItem':_0x3a10dc,'highlightViews':[_0x1b13fe]};}}['_createSearchResultActionButton'](_0x475ea7,_0x5e8053,_0x490863,_0x375da3){return _0x490863&&_0x375da3?this['_createSearchResultGroupedActionButton'](_0x475ea7,_0x5e8053,_0x490863,_0x375da3):this['_createSearchResultIndividualActionButton'](_0x475ea7,_0x5e8053);}['_createSearchResultGroupedActionButton'](_0x105aa6,_0x1e5520,_0x4c87ab,_0x1d1faa){const _0x2d85a2=new Ht(this['locale']),_0x536e7f=new yt(this['locale']),_0x4c0675=_0x536e7f['bindTemplate'],{view:_0x5a04dd,highlightView:_0x4f19ab}=this['_createSearchResultGroupRow'](_0x4c87ab,_0x1d1faa),{view:_0x1f24c8,highlightView:_0x13a5da}=this['_createSearchResultActionRow'](_0x1e5520['label']),_0x44418e=this['_createSearchResultContentView'](_0x5a04dd,_0x1f24c8);return _0x536e7f['set']({'label':_0x1e5520['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':_0x1e5520['isEnabled']}),_0x536e7f['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',_0x4c0675['if']('isEnabled','ck-disabled',_0x407aec=>!_0x407aec)],'type':'button','role':'menuitem','tabindex':'-1'},'children':[_0x44418e],'on':{'mouseenter':_0x4c0675['to'](()=>{this['_isSearchFocused']()||_0x536e7f['focus']();}),'click':_0x4c0675['to'](()=>{this['_handleSearchResultButtonClick'](_0x536e7f);})}}),this['_setupActionButtonExecution'](_0x536e7f,_0x105aa6,_0x1e5520),_0x2d85a2['children']['add'](_0x536e7f),this['_actionButtons']['push']({'buttonView':_0x536e7f,'action':_0x1e5520}),{'listItem':_0x2d85a2,'highlightViews':[_0x4f19ab,_0x13a5da]};}['_createSearchResultIndividualActionButton'](_0x38f53a,_0x3555a3){const _0x1ec047=new Ht(this['locale']),_0x2d40e0=new _0x862a5b(),_0x3f52e7=new yt(this['locale'],_0x2d40e0),_0x4730de=_0x3f52e7['bindTemplate'];return _0x3f52e7['set']({'label':_0x3555a3['label'],'withText':!0x0,'role':'menuitem','icon':void 0x0,'tooltip':!0x1,'class':'ck-ai-quick-actions-button\x20ck-ai-quick-actions-search-result-button','isEnabled':_0x3555a3['isEnabled']}),_0x3f52e7['extendTemplate']({'on':{'mouseenter':_0x4730de['to'](()=>{this['_isSearchFocused']()||_0x3f52e7['focus']();})}}),this['_setupActionButtonExecution'](_0x3f52e7,_0x38f53a,_0x3555a3),_0x1ec047['children']['add'](_0x3f52e7),this['_actionButtons']['push']({'buttonView':_0x3f52e7,'action':_0x3555a3}),{'listItem':_0x1ec047,'highlightViews':[_0x2d40e0]};}['_createSearchResultGroupRow'](_0x45cb63,_0x4d8f0b){const _0x72a3fa=new Nt(this['locale']),_0x5ad795=new Lt();_0x5ad795['content']=_0x4d8f0b,_0x5ad795['extendTemplate']({'attributes':{'class':'ck-ai-quick-actions-button__group-icon'}});const _0x2b0eb4=new _0x5a7c84();return _0x2b0eb4['text']=_0x45cb63,_0x72a3fa['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__group-row'},'children':[_0x5ad795,_0x2b0eb4]}),{'view':_0x72a3fa,'highlightView':_0x2b0eb4};}['_createSearchResultActionRow'](_0x49ad38){const _0x2adef0=new Nt(this['locale']),_0xb8835b=new _0x5a7c84();return _0xb8835b['text']=_0x49ad38,_0x2adef0['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__action-row'},'children':[_0xb8835b]}),{'view':_0x2adef0,'highlightView':_0xb8835b};}['_createSearchResultContentView'](_0x14357c,_0x4f1048){const _0x861205=new Nt(this['locale']);return _0x861205['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__content'},'children':[_0x14357c,_0x4f1048]}),_0x861205;}['_setupActionButtonExecution'](_0x331403,_0x500c7e,_0x3864a7){_0x331403['on']('execute',()=>{_0x331403['isEnabled']&&(_0x500c7e['editing']['view']['focus'](),_0x500c7e['commands']['execute']('aiQuickAction',_0x3864a7));});}['_createActionGroupButton'](_0xf04f63,_0x74be7e,_0x8dc204){const _0xba58ee=new Ht(this['locale']),_0x3813dc=new _0x862a5b(),_0x5d4dc7=new DropdownMenuButtonWithHighlightView(this['locale'],_0x3813dc),_0x159e92=_0x5d4dc7['bindTemplate'],_0x20a345=this['_getPanelKeystroke'](_0x8dc204),_0x139cb7=this['_createGroupActionsList'](_0xf04f63,_0x74be7e['actions'],_0x8dc204);_0x5d4dc7['set']({'label':_0x74be7e['label'],'withText':!0x0,'role':Yn,'icon':_0x74be7e['icon']??_0x1226aa,'isEnabled':_0x74be7e['actions']['some'](_0x3231bb=>_0x3231bb['isEnabled'])}),_0x5d4dc7['extendTemplate']({'on':{'mouseenter':_0x159e92['to'](()=>{this['_isSearchFocused']()||_0x5d4dc7['focus']();})}});const _0x5ce8f=new zt(this['locale']);return _0x5ce8f['extendTemplate']({'attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions-group-panel','ck-dropdown-menu__nested-menu__panel']},'on':{'keydown':_0x159e92['to'](_0x318479=>{this['_handlePanelKeydown'](_0x318479,_0x20a345,_0x5d4dc7,_0x5ce8f);})}}),_0x5d4dc7['bind']('isOn')['to'](_0x5ce8f,'isVisible'),this['_bodyCollection']['add'](_0x5ce8f),_0x5ce8f['content']['add'](_0x139cb7),this['_setupGroupMenuBehavior'](_0x5d4dc7,_0x5ce8f),_0xba58ee['children']['add'](_0x5d4dc7),this['_actionButtons']['push']({'buttonView':_0x5d4dc7,'action':_0x74be7e}),{'listItem':_0xba58ee,'highlightView':_0x3813dc};}['_createGroupActionsList'](_0x44cf39,_0x3a3c19,_0x357381){const _0x4be669=new Dt(this['locale']);return _0x4be669['extendTemplate']({'attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions-group-list','ck-dropdown-menu-list']}}),_0x3a3c19['forEach'](_0x4dd7dd=>{const _0x449da3=new Ht(this['locale']),_0x34a978=Wn({'editor':_0x44cf39,'action':_0x4dd7dd,'withText':!0x0,'withIcon':!0x1,'isInDropdown':!0x0,'shouldPreventFocus':()=>this['_isSearchFocused'](),'actionButtons':this['_actionButtons']})();_0x449da3['children']['add'](_0x34a978),_0x357381['focusTracker']['add'](_0x34a978),_0x4be669['items']['add'](_0x449da3);}),_0x4be669;}['_setupGroupMenuBehavior'](_0x169945,_0x3df55c){const _0x405049=_0x169945['bindTemplate'],_0x4450e0=this['_getButtonKeystroke'](_0x169945);_0x169945['extendTemplate']({'attributes':{'class':['ck-ai-quick-actions-group-button']},'on':{'mouseenter':_0x405049['to'](()=>{this['_showNestedPanel'](_0x3df55c,_0x169945);}),'mouseleave':_0x405049['to'](_0x16a47d=>{const _0x538f10=_0x16a47d['relatedTarget'];this['_isMovingToNestedMenu'](_0x538f10,_0x3df55c)||this['_hideNestedPanel'](_0x3df55c);}),'keydown':_0x405049['to'](_0x1e4fdc=>{_0x1e4fdc['key']==_0x4450e0&&(this['_showNestedPanel'](_0x3df55c,_0x169945),_0x3df55c['content']['get'](0x0)['focus']());})}}),_0x3df55c['on']('render',()=>{_0x3df55c['element']?.['addEventListener']('mouseleave',_0x10177e=>{const _0x50d4a9=_0x10177e['relatedTarget'];_0x169945['element']?.['contains'](_0x50d4a9)||this['_isMovingToNestedMenu'](_0x50d4a9,_0x3df55c)||this['_hideNestedPanel'](_0x3df55c);});});}['_showNestedPanel'](_0x1b0365,_0x25e8ff){this['_openNestedPanels']['forEach'](_0x2da19b=>{_0x2da19b!==_0x1b0365&&_0x2da19b['isVisible']&&_0x2da19b['hide']();}),_0x1b0365['show'](),_0x1b0365['pin']({'positions':[_0xbcb531['eastSouth']],'target':_0x25e8ff['element'],'fitInViewport':!0x0}),this['_openNestedPanels']['add'](_0x1b0365);}['_hideNestedPanel'](_0xf69633){_0xf69633['hide'](),this['_openNestedPanels']['delete'](_0xf69633);}['_hideAllNestedPanels'](){this['_openNestedPanels']['forEach'](_0x2aae3b=>_0x2aae3b['hide']()),this['_openNestedPanels']['clear']();}['_isMovingToNestedMenu'](_0x582273,_0x2de0ac){if(!_0x582273)return!0x1;if(_0x2de0ac['element']?.['contains'](_0x582273))return!0x0;const _0x31896b=_0x582273;return _0x31896b['closest']&&(null!==_0x31896b['closest']('.ck-ai-quick-actions-group-panel')||null!==_0x31896b['closest']('.ck-ai-quick-actions-group-list')||null!==_0x31896b['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'](_0x211318){return'rtl'===_0x211318['locale']['uiLanguageDirection']?'ArrowRight':'ArrowLeft';}['_getButtonKeystroke'](_0x615b1e){return'rtl'===_0x615b1e['locale']['uiLanguageDirection']?'ArrowLeft':'ArrowRight';}['_handlePanelKeydown'](_0x3275bb,_0x2eb1ca,_0x5a5a3a,_0x1c2280){_0x3275bb['key']==_0x2eb1ca&&(_0x5a5a3a['focus'](),this['_hideNestedPanel'](_0x1c2280));}['_handleSearchResultButtonClick'](_0x425476){_0x425476['fire']('execute');}}function $n(_0x4cd00c){const {editor:_0xa5303,content:_0x3ef12c,buttonDefinition:_0x26ea8c,bodyCollection:_0x1ae5c9,hasSearch:_0x1bad78=!0x1,actionButtons:_0x195c44}=_0x4cd00c;return()=>{const _0x42c84c=_0xa5303['locale'],_0x5e8b7c=_0xa5303['commands']['get']('aiQuickAction'),_0x2b9c82=Ft(_0x42c84c);_0x2b9c82['bind']('isEnabled')['to'](_0x5e8b7c),_0x2b9c82['buttonView']['set']({'icon':_0x26ea8c['icon']??_0x1226aa,'label':_0x26ea8c['label'],'tooltip':!0x0}),_0x2b9c82['set']({'class':'ck-ai-quick-actions-dropdown'});const _0x80826a=new AIQuickActionsDropdownContentView(_0xa5303,_0x3ef12c,_0x2b9c82,_0x1ae5c9,_0x1bad78,_0x195c44);return _0x2b9c82['panelView']['children']['add'](_0x80826a),_0x1bad78&&_0x2b9c82['on']('change:isOpen',(_0x5cea13,_0x35d509,_0x3f48c0)=>{if(_0x3f48c0){if(_0xa5303['plugins']['has']('AIEditing')){const _0x178a33=_0xa5303['plugins']['get'](AIEditing),_0x1d20df=_0xa5303['model']['document']['selection'],_0x3ce660=Array['from'](_0x1d20df['getRanges']());_0x3ce660['length']>0x0&&_0x178a33['showFakeVisualSelection']({'editor':_0xa5303,'ranges':_0x3ce660,'id':'quick-action','priority':0x14});}}else _0xa5303['plugins']['has']('AIEditing')&&_0xa5303['plugins']['get'](AIEditing)['hideFakeVisualSelection']('quick-action'),_0x80826a['resetSearch']();}),_0x2b9c82;};}const qn='<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>',Qn='<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>',Xn='<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>',zn=/* #__PURE__ -- @preserve */
28
+ ((()=>({'chat':'AIChat','action':'AIActions'}))());class AIQuickActionsUI extends _0x3da4a3{['_actionButtons']=[];['_menuBarGroupViews']=[];static get['requires'](){return[_0xd47ab9,AIConnector];}static get['pluginName'](){return'AIQuickActionsUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x228fa8=this['_getDefaultAndCustomActions']();this['_prepareQuickActionsDefinition'](_0x228fa8),this['_initializeQuickActionsComponentsAndCommands'](),this['_initActionTypeQuickActions'](),this['_initChatTypeQuickActions']();}static['getDefaultQuickActions'](_0x3dce71){return function(_0x3caa09){const _0x22bb1a=new Intl['DisplayNames'](['en'],{'type':'language'})['of'](_0x3caa09['uiLanguage']),_0x55937c=_0x22bb1a||'English',_0x3e03b9=[{'id':'ask-ai','label':Mi(_0x3caa09,'AI_QUICK_ACTIONS_ASK_AI'),'type':'chat','icon':_0x55128e},{'id':'chat-commands','label':Mi(_0x3caa09,'AI_QUICK_ACTIONS_CHAT_COMMANDS'),'icon':_0x55128e,'actions':[{'id':'explain','label':Mi(_0x3caa09,'AI_QUICK_ACTIONS_EXPLAIN'),'displayedPrompt':Mi(_0x3caa09,'AI_QUICK_ACTIONS_EXPLAIN'),'prompt':qn['replace']('%0',_0x55937c),'type':'chat'},{'id':'summarize','label':Mi(_0x3caa09,'AI_QUICK_ACTIONS_SUMMARIZE'),'displayedPrompt':Mi(_0x3caa09,'AI_QUICK_ACTIONS_SUMMARIZE'),'prompt':Qn['replace']('%0',_0x55937c),'type':'chat'},{'id':'highlight-key-points','label':Mi(_0x3caa09,'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS'),'displayedPrompt':Mi(_0x3caa09,'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS'),'prompt':Xn['replace']('%0',_0x55937c),'type':'chat'}]},{'id':'improve-writing','label':Mi(_0x3caa09,'AI_QUICK_ACTIONS_IMPROVE_WRITING'),'type':'action','icon':_0x4ceed0},{'id':'continue','label':Mi(_0x3caa09,'AI_QUICK_ACTIONS_CONTINUE_WRITING'),'type':'action','icon':_0x8b90a2},{'id':'fix-grammar','label':Mi(_0x3caa09,'AI_QUICK_ACTIONS_FIX_GRAMMAR_SPELLING'),'type':'action','icon':_0x1b9106},{'id':'adjust-length','label':Mi(_0x3caa09,'AI_QUICK_ACTIONS_ADJUST_LENGTH'),'icon':_0x436f94,'actions':[{'id':'make-shorter','label':Mi(_0x3caa09,'AI_QUICK_ACTIONS_MAKE_SHORTER'),'type':'action'},{'id':'make-longer','label':Mi(_0x3caa09,'AI_QUICK_ACTIONS_MAKE_LONGER'),'type':'action'}]},{'id':'change-tone','label':Mi(_0x3caa09,'AI_QUICK_ACTIONS_CHANGE_TONE'),'icon':_0x334cef,'actions':[{'id':'make-tone-casual','label':Mi(_0x3caa09,'AI_QUICK_ACTIONS_MORE_CASUAL'),'type':'action'},{'id':'make-tone-direct','label':Mi(_0x3caa09,'AI_QUICK_ACTIONS_MORE_DIRECT'),'type':'action'},{'id':'make-tone-friendly','label':Mi(_0x3caa09,'AI_QUICK_ACTIONS_MORE_FRIENDLY'),'type':'action'},{'id':'make-tone-confident','label':Mi(_0x3caa09,'AI_QUICK_ACTIONS_MORE_CONFIDENT'),'type':'action'},{'id':'make-tone-professional','label':Mi(_0x3caa09,'AI_QUICK_ACTIONS_MORE_PROFESSIONAL'),'type':'action'}]},{'id':'translate','label':Mi(_0x3caa09,'AI_QUICK_ACTIONS_TRANSLATE'),'icon':_0x2e3d1e,'actions':[{'id':'translate-to-english','label':Mi(_0x3caa09,'AI_QUICK_ACTIONS_TRANSLATE_ENGLISH'),'type':'action','actionName':'translate','args':{'language':'english'}},{'id':'translate-to-chinese','label':Mi(_0x3caa09,'AI_QUICK_ACTIONS_TRANSLATE_CHINESE'),'type':'action','actionName':'translate','args':{'language':'chinese'}},{'id':'translate-to-spanish','label':Mi(_0x3caa09,'AI_QUICK_ACTIONS_TRANSLATE_SPANISH'),'type':'action','actionName':'translate','args':{'language':'spanish'}},{'id':'translate-to-german','label':Mi(_0x3caa09,'AI_QUICK_ACTIONS_TRANSLATE_GERMAN'),'type':'action','actionName':'translate','args':{'language':'german'}},{'id':'translate-to-french','label':Mi(_0x3caa09,'AI_QUICK_ACTIONS_TRANSLATE_FRENCH'),'type':'action','actionName':'translate','args':{'language':'french'}},{'id':'translate-to-japanese','label':Mi(_0x3caa09,'AI_QUICK_ACTIONS_TRANSLATE_JAPANESE'),'type':'action','actionName':'translate','args':{'language':'japanese'}},{'id':'translate-to-portuguese','label':Mi(_0x3caa09,'AI_QUICK_ACTIONS_TRANSLATE_PORTUGUESE'),'type':'action','actionName':'translate','args':{'language':'portuguese'}},{'id':'translate-to-korean','label':Mi(_0x3caa09,'AI_QUICK_ACTIONS_TRANSLATE_KOREAN'),'type':'action','actionName':'translate','args':{'language':'korean'}},{'id':'translate-to-italian','label':Mi(_0x3caa09,'AI_QUICK_ACTIONS_TRANSLATE_ITALIAN'),'type':'action','actionName':'translate','args':{'language':'italian'}},{'id':'translate-to-russian','label':Mi(_0x3caa09,'AI_QUICK_ACTIONS_TRANSLATE_RUSSIAN'),'type':'action','actionName':'translate','args':{'language':'russian'}}]},{'id':'other','label':Mi(_0x3caa09,'AI_QUICK_ACTIONS_OTHER'),'icon':tt,'actions':[]}];return _0x3e03b9;}(_0x3dce71);}['_getDefaultAndCustomActions'](){const _0x4b9f08=AIQuickActionsUI['getDefaultQuickActions'](this['editor']['locale']),_0x3443ad=(this['editor']['config']['get']('ai.quickActions.extraCommands')||[])['map'](_0x1a5633=>({..._0x1a5633,'type':'chat'===_0x1a5633['type']?'chat':'action','icon':void 0x0}));return _0x4b9f08['find'](_0x55a6fd=>'other'===_0x55a6fd['id'])['actions']['push'](..._0x3443ad),_0x4b9f08;}async['_initActionTypeQuickActions'](){try{const _0x4ca766=new AIModels({'connector':this['editor']['plugins']['get']('AIConnector'),'config':this['editor']['config']['get']('ai.models'),'locale':this['editor']['locale']}),_0x40d549=await _0x4ca766['getAll'](),_0x45476d=(await _0x4ca766['getDefault']())?.['id'];this['_assignDefaultModelToCustomActions'](_0x45476d),this['_enableButtonsByType']('action',_0x1be7ad=>!!_0x40d549['find'](_0x400c58=>_0x400c58['id']===_0x1be7ad['model'])||void 0x0===_0x1be7ad['model']);}catch(_0x4f7e5d){const _0x182f4a=new ht('ai-quick-actions-models-unable-to-retrieve',this,{'error':_0x4f7e5d});Ct(_0x182f4a['message']);}}['_initChatTypeQuickActions'](){if(!this['editor']['plugins']['has']('AIChatController'))return;const _0x3b6ba1=this['editor']['plugins']['get']('AIChatController');this['listenTo'](_0x3b6ba1,'change:isConversationReady',(_0x1856dc,_0x15c2eb,_0x5c341a)=>{_0x5c341a&&this['_enableButtonsByType']('chat',()=>!0x0);}),_0x3b6ba1['isConversationReady']&&this['_enableButtonsByType']('chat',()=>!0x0);}['_enableButtonsByType'](_0x1f1dd2,_0x1c84a9){this['_quickActionsDefinition']['forEach'](_0x1cbed7=>{'actions'in _0x1cbed7?_0x1cbed7['actions']['forEach'](_0x18cf04=>{_0x18cf04['type']===_0x1f1dd2&&(_0x18cf04['isEnabled']=_0x1c84a9(_0x18cf04));}):_0x1cbed7['type']===_0x1f1dd2&&(_0x1cbed7['isEnabled']=_0x1c84a9(_0x1cbed7));}),this['_actionButtons']['forEach'](_0xef919=>{if(jn(_0xef919['action']))return;if(_0xef919['action']['type']!==_0x1f1dd2)return;const _0x14095c=_0x1c84a9(_0xef919['action']);if(_0xef919['action']['isEnabled']=_0x14095c,_0xef919['buttonView']['isEnabled']=_0x14095c,!_0x14095c&&_0xef919['action']['model']){const _0x3ca956=new ht('ai-quick-actions-unavailable-model',this,{'actionId':_0xef919['action']['id'],'modelId':_0xef919['action']['model']});Ct(_0x3ca956['message']);}}),this['_actionButtons']['filter'](_0x193b55=>jn(_0x193b55['action']))['forEach'](_0x51e310=>{_0x51e310['buttonView']['isEnabled']=_0x51e310['action']['actions']['some'](_0x30c47c=>_0x30c47c['isEnabled']);}),this['_menuBarGroupViews']['forEach'](({view:_0x461256,group:_0x4f8109})=>{_0x461256['isEnabled']=_0x4f8109['actions']['some'](_0x321799=>_0x321799['isEnabled']);});}['_assignDefaultModelToCustomActions'](_0x26bc4c){this['_actionButtons']['forEach'](_0x3e51f5=>{jn(_0x3e51f5['action'])||'action'===_0x3e51f5['action']['type']&&(_0x3e51f5['action']['model']||(_0x3e51f5['action']['model']=_0x26bc4c));});}['_initializeQuickActionsComponentsAndCommands'](){const _0x32f082=new Xt(this['editor']['locale']);_0x32f082['attachToDom'](),this['_initializeQuickActionsDropdown'](_0x32f082),this['_initializeQuickActionsMenuBar'](),this['_initializeQuickActionsComponents'](_0x32f082);}['_initializeQuickActionsDropdown'](_0x34c2e3){const _0x1d7688=this['editor']['config']['get']('ai.quickActions.isSearchEnabled')??!0x0;this['editor']['ui']['componentFactory']['add']('aiQuickActions',$n({'editor':this['editor'],'content':this['_quickActionsDefinition'],'buttonDefinition':{'icon':_0x1226aa,'label':Mi(this['editor']['locale'],'AI_QUICK_ACTIONS_HEADING')},'bodyCollection':_0x34c2e3,'hasSearch':_0x1d7688,'actionButtons':this['_actionButtons']}));}['_prepareQuickActionsDefinition'](_0xf0bb60){this['_quickActionsDefinition']=_0xf0bb60['map'](_0xa692e6=>{if('actions'in _0xa692e6){const _0x1ff1b7=_0xa692e6;return{..._0x1ff1b7,'actions':_0x1ff1b7['actions']['map'](_0x2f5093=>{const {actions:_0x1177ff,..._0x5ec500}=_0x1ff1b7;return{..._0x2f5093,'isEnabled':!0x1,'parent':_0x5ec500};})['filter'](_0x4dc645=>this['_shouldIncludeAction'](_0x4dc645))};}return{..._0xa692e6,'isEnabled':!0x1};})['filter'](_0x30f00f=>'actions'in _0x30f00f?_0x30f00f['actions']['length']>0x0:this['_shouldIncludeAction'](_0x30f00f));}['_shouldIncludeAction'](_0xb98e8){const _0x3cea8a=this['editor']['config']['get']('ai.quickActions.removeCommands')||[];return this['editor']['plugins']['has'](zn[_0xb98e8['type']])&&!_0x3cea8a['includes'](_0xb98e8['id'])&&!('chat'===_0xb98e8['type']&&!0x1===this['editor']['config']['get']('ai.chat.context.document.enabled'));}['_initializeQuickActionsComponents'](_0x455f51){this['_quickActionsDefinition']['forEach'](_0x27c426=>{if('actions'in _0x27c426){const _0x2c92c=$n({'editor':this['editor'],'content':_0x27c426['actions'],'buttonDefinition':_0x27c426,'bodyCollection':_0x455f51,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x27c426['id'],_0x2c92c),_0x27c426['actions']['forEach'](_0x1e07d2=>{const _0x341e49=Wn({'editor':this['editor'],'action':_0x1e07d2,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x1e07d2['id'],_0x341e49);});}else{const _0xf96aa1=Wn({'editor':this['editor'],'action':_0x27c426,'withText':!0x1,'withIcon':!0x0,'isInDropdown':!0x1,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x27c426['id'],_0xf96aa1);}});}['_initializeQuickActionsMenuBar'](){this['editor']['ui']['componentFactory']['add']('menuBar:aiQuickActions',_0x44aea8=>{const _0x5c1ae4=this['editor']['commands']['get']('aiQuickAction'),_0x469803=new Kt(_0x44aea8),_0x477ce3=Mi(_0x44aea8,'AI_QUICK_ACTIONS_HEADING');_0x469803['buttonView']['set']({'label':_0x477ce3,'icon':_0x1226aa});const _0x111f7c=new qt(_0x44aea8);return _0x111f7c['set']({'ariaLabel':_0x477ce3,'role':'menu'}),this['_quickActionsDefinition']['forEach'](_0xae1f4=>{if('actions'in _0xae1f4){const _0x4fc78c=_0xae1f4,_0x51c5d5=new Qt(_0x44aea8,_0x469803),_0x482cbc=new Kt(_0x44aea8),_0x1a070c=new qt(_0x44aea8);_0x482cbc['buttonView']['set']({'label':_0x4fc78c['label'],'icon':_0x4fc78c['icon']}),_0x4fc78c['actions']['forEach'](_0x43b718=>{const _0x1bf788=new Qt(_0x44aea8,_0x482cbc),_0x1b9a5f=new Yt(_0x44aea8);_0x1b9a5f['set']({'label':_0x43b718['label'],'icon':_0x43b718['icon'],'role':'menuitem','isEnabled':_0x43b718['isEnabled']}),_0x1b9a5f['on']('execute',()=>{this['_executeQuickAction'](_0x43b718);}),this['_actionButtons']['push']({'buttonView':_0x1b9a5f,'action':_0x43b718}),_0x1b9a5f['delegate']('execute')['to'](_0x482cbc),_0x1bf788['children']['add'](_0x1b9a5f),_0x1a070c['items']['add'](_0x1bf788);}),_0x482cbc['isEnabled']=_0x4fc78c['actions']['some'](_0x510ef1=>_0x510ef1['isEnabled']),this['_menuBarGroupViews']['push']({'view':_0x482cbc,'group':_0x4fc78c}),_0x482cbc['panelView']['children']['add'](_0x1a070c),_0x51c5d5['children']['add'](_0x482cbc),_0x111f7c['items']['add'](_0x51c5d5);}else{const _0x570d27=_0xae1f4,_0x2cd57d=new Qt(_0x44aea8,_0x469803),_0x3e6541=new Yt(_0x44aea8);_0x3e6541['set']({'label':_0x570d27['label'],'icon':_0x570d27['icon'],'role':'menuitem','isEnabled':_0x570d27['isEnabled']}),this['_actionButtons']['push']({'buttonView':_0x3e6541,'action':_0x570d27}),_0x3e6541['on']('execute',()=>{this['_executeQuickAction'](_0x570d27);}),_0x3e6541['delegate']('execute')['to'](_0x469803),_0x2cd57d['children']['add'](_0x3e6541),_0x111f7c['items']['add'](_0x2cd57d);}}),(Object['values'](zn)['some'](_0x1f9ccb=>this['editor']['plugins']['has'](_0x1f9ccb))?_0x469803['bind']('isEnabled')['to'](_0x5c1ae4):_0x469803['set']({'isEnabled':!0x1}),_0x469803['panelView']['children']['add'](_0x111f7c),_0x469803);});}['_executeQuickAction'](_0xce7a29){const _0x4246fc=this['editor'];_0x4246fc['editing']['view']['focus'](),_0x4246fc['commands']['execute']('aiQuickAction',_0xce7a29);const _0x439dad=_0x4246fc['ui']['view']['menuBarView'];_0x439dad&&_0x439dad['close']&&_0x439dad['close']();}}function jn(_0x529cef){return'actions'in _0x529cef;}class AIQuickActionsCommand extends _0x16583a{['execute'](_0x1c2165){switch(this['_expandSelectionIfCollapsed'](),_0x1c2165['type']){case'chat':if(!this['editor']['plugins']['has']('AIChat')){const _0x562ec8=Mi(this['editor']['locale'],'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND','AIChat');throw new ht('ai-quick-actions-plugin-not-found',this['editor'],{'errorMessage':_0x562ec8});}this['_handleAIChatAction'](_0x1c2165);break;case'action':if(!this['editor']['plugins']['has']('AIActions')){const _0x17a722=Mi(this['editor']['locale'],'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND','AIActions');throw new ht('ai-quick-actions-plugin-not-found',this['editor'],{'errorMessage':_0x17a722});}this['_handleAIActionsAction'](_0x1c2165);}}async['_handleAIChatAction'](_0x2cb0d1){const _0x2a0069=this['editor']['plugins']['get']('AIChatController'),_0x5d2c02=this['editor']['plugins']['get']('AITabs')['view'];if(_0x5d2c02['isVisible']||(_0x5d2c02['isVisible']=!0x0),'chat'!==_0x5d2c02['activeTab']&&_0x5d2c02['activateTab']('chat'),'ask-ai'===_0x2cb0d1['id'])_0x2a0069['removeSelectionFromChatContext'](),_0x2a0069['addSelectionToChatContext'](this['editor']),_0x2a0069['focusPromptInput']();else await _0x2a0069['startConversation']({'modelId':_0x2cb0d1['model']}),_0x2a0069['removeSelectionFromChatContext'](),_0x2a0069['addSelectionToChatContext'](this['editor']),_0x2a0069['focusPromptInput'](),await _0x2a0069['sendMessage']({'message':_0x2cb0d1['prompt']||_0x2cb0d1['displayedPrompt']||_0x2cb0d1['label'],'attributes':{'quickActionData':{'id':_0x2cb0d1['id']},'displayedPrompt':_0x2cb0d1['displayedPrompt']}});}['_expandSelectionIfCollapsed'](){const _0x136191=this['editor'],_0x2cdb00=_0x136191['model']['document']['selection'];if(!_0x2cdb00['isCollapsed'])return;const _0xc8f6c9=gt(_0x2cdb00['getSelectedBlocks']())||_0x136191['model']['schema']['getLimitElement'](_0x2cdb00);_0x136191['model']['change'](_0x5e6a2d=>{_0x5e6a2d['setSelection'](_0xc8f6c9,'in');});}['_handleAIActionsActionLabel'](_0x81027){return _0x81027['parent']?.['label']&&'other'!==_0x81027['parent']?.['id']?_0x81027['parent']['label']+':\x20'+_0x81027['label']:_0x81027['label'];}async['_handleAIActionsAction'](_0xfba5f2){const _0x3453bb=this['editor']['plugins']['get']('AIActions'),_0x275b00=_0xfba5f2['prompt']?{'userMessage':_0xfba5f2['prompt'],'model':_0xfba5f2['model']}:{'actionName':_0xfba5f2['actionName']||_0xfba5f2['id'],'args':_0xfba5f2['args']},_0x1d23ce=this['_handleAIActionsActionLabel'](_0xfba5f2);await _0x3453bb['executeAction'](_0x275b00,_0x1d23ce,_0xfba5f2['icon']);}}class AIQuickActionsEditing extends _0x3da4a3{static get['pluginName'](){return'AIQuickActionsEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x2c43bc=this['editor'],_0x3bbf29=new AIQuickActionsCommand(this['editor']);if(_0x2c43bc['commands']['add']('aiQuickAction',_0x3bbf29),_0x2c43bc['plugins']['has']('AIChat')){const _0x900ec7=this['editor']['plugins']['get']('AIChatController');_0x2c43bc['model']['document']['selection']['on']('change:range',(_0x397840,_0x5ded04)=>{_0x5ded04['directChange']&&_0x900ec7['removeSelectionFromChatContext']();});}}}class AIActionsReply extends AIReply{['appendContent'](_0x52e059,_0x499f43='text'){'modification'===this['type']&&'text'===_0x499f43&&(_0x499f43=this['documentContextContent']['keys']()['next']()['value']),super['appendContent'](_0x52e059,_0x499f43);}['updateChangeGroups'](_0x280df9){const _0x494371=this['parsedContent']['get'](_0x280df9)['cloneNode'](!0x0);if(this['parsedMergedContent']['set'](_0x280df9,_0x494371),this['changeGroups']=[],0x0==_0x494371['childNodes']['length'])return;ns(this['documentContextContent']['get'](_0x280df9),this['parsedMergedContent']['get'](_0x280df9));const _0x4378ea=this['documentContextContent']['get'](_0x280df9)['children']['map'](_0x3944b6=>({'node':_0x3944b6,'id':Xi(_0x3944b6,'data-id')})),_0x458170=_0x494371['children']['map'](_0x252aab=>({'node':_0x252aab,'id':Xi(_0x252aab,'data-id')||at()})),_0x3b8251=_0x1af8a9(_0x4378ea,_0x458170,{'comparator':(_0x5c3a72,_0x3fb22a)=>_0x5c3a72['id']==_0x3fb22a['id'],'oneChangePerToken':!0x0});if(!this['isDone']||!this['isComplete']){for(;_0x3b8251['length']&&_0x3b8251[_0x3b8251['length']-0x1]['removed'];)_0x3b8251['pop']();}const _0x5f2ff2=_0x3b8251['map'](_0x35bf56=>{const _0x530b67=_0x35bf56['added']?'new':_0x35bf56['removed']?'removed':'modified';return{'node':_0x35bf56['value'][0x0]['node'],'type':_0x530b67,'id':_0x35bf56['value'][0x0]['id']};}),_0x25d419=this['_documentIdToSource']['get'](_0x280df9);this['changeGroups']['push']({'changes':_0x5f2ff2,'state':'pending','index':this['changeGroups']['length'],'editor':_0x25d419['editor'],'rootName':_0x25d419['rootName'],'documentId':_0x280df9});}['_getDifferentChangeGroups'](_0x5a6b22,_0x395ac6){return _0x395ac6;}}class AIActionsInteraction extends AIInteraction{['content'];['version'];['editor'];['rootName'];['actionName'];['args'];['userMessage'];['model'];['hasError']=!0x1;['stoppedExplicitly']=!0x1;constructor(_0x4af139){super(_0x4af139),this['content']=_0x4af139['content'],this['version']=_0x4af139['version'],this['editor']=_0x4af139['editor'],this['rootName']=_0x4af139['rootName'],this['actionName']=_0x4af139['actionName'],this['args']=_0x4af139['args'],this['userMessage']=_0x4af139['userMessage'],this['model']=_0x4af139['model'],this['on']('interactionStopped',()=>{this['stoppedExplicitly']=!0x0;});}async['sendRequest'](){return this['actionName']?this['connector']['executeAction']({'content':this['content'],'actionName':this['actionName'],'args':this['args']}):this['connector']['executeCustomAction']({'content':this['content'],'message':this['userMessage'],'model':this['model'],'outputFormat':'html'});}['getDocumentContext'](){return{'type':'document','documents':[{'id':this['id'],'content':this['content'],'version':this['version'],'rootName':this['rootName'],'sessionId':at(),'channelId':this['editor']['config']['get']('collaboration.channelId')}],'label':'Current\x20document','uiId':'current-document'};}['createReply'](_0x53732c){const _0x4a1366=this['editor']['config']['get']('collaboration.channelId'),_0x103cb2=new AIActionsReply({..._0x53732c,'locale':this['locale'],'documentContextContent':[{'id':this['id'],'content':this['content'],'channelId':_0x4a1366,'rootName':this['rootName']}],'channelsToEditors':new Map([[_0x4a1366,this['editor']]])});return this['replies']['push'](_0x103cb2),_0x103cb2['delegate'](..._s)['to'](this),this['fire']('replyCreated',_0x103cb2),_0x103cb2;}}class AIActionsBalloonToolbarView extends kt{constructor(_0x4c0203,_0x44f918=!0x0,_0x276554=!0x0){super(_0x4c0203),this['set']('isEnabled',!0x1),_0x44f918&&(this['applyButton']=this['_createButton'](Mi(_0x4c0203,'AI_BALLOON_APPLY_BUTTON'),Ui),this['applyButton']['bind']('isEnabled')['to'](this),this['items']['add'](this['applyButton'])),_0x276554&&(this['suggestButton']=this['_createButton'](Mi(_0x4c0203,'AI_BALLOON_SUGGEST_BUTTON'),_0x44f918?Bi:Ui),this['suggestButton']['bind']('isEnabled')['to'](this),this['items']['add'](this['suggestButton'])),this['setButtonsVisibility']({'showApplyButton':_0x44f918,'showSuggestButton':_0x276554}),this['extendTemplate']({'attributes':{'class':['ck-ai-balloon__toolbar']}});}['setButtonsVisibility']({showApplyButton:_0xb6448a,showSuggestButton:_0x363dc9}){this['applyButton']&&(this['applyButton']['isVisible']=_0xb6448a),this['suggestButton']&&(this['suggestButton']['isVisible']=_0x363dc9);}['_createButton'](_0x30e6c1,_0x3d3940){const _0x1790d0=new yt(this['locale']);return _0x1790d0['set']({'label':_0x30e6c1,'class':_0x3d3940,'isVisible':!0x0,'withText':!0x0}),_0x1790d0;}}class AIActionsBalloonDisclaimerView extends Nt{constructor(_0x114ec8){super(_0x114ec8),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-balloon__disclaimer']},'children':[{'tag':'p','attributes':{'class':['ck','ck-ai-balloon__disclaimer-content']},'children':[{'text':Mi(_0x114ec8,'AI_DISCLAIMER_TEXT')}]}]});}}class AISuggestionLoaderView extends Nt{constructor(_0x4ac291){super(_0x4ac291),this['set']('isVisible',!0x0);const _0x582e54=new AISpinnerView('small');_0x582e54['isVisible']=!0x0;const _0x439fdd=new Nt(this['locale']);_0x439fdd['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__loader-text']},'children':[Mi(this['locale'],'AI_CHAT_IS_WRITING')]}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__loader',this['bindTemplate']['if']('isVisible','ck-hidden',_0x3893c5=>!_0x3893c5)]},'children':[_0x582e54,_0x439fdd]});}}class AIActionsBalloonView extends AIBalloonView{['focusCycler'];['_config'];['_contentWrapper'];['_streamableContentView'];['_toolbarView'];['_miniToolbarView'];['_loaderView'];['_disclaimerView'];['_focusTracker'];['_keystrokes'];['_dialogContent'];['_focusables'];['_scrollManager'];['_navigationPreviousButton'];['_navigationNextButton'];['_navigationTryAgainButton'];['_navigationCounter'];constructor(_0x618010,_0x423e7c){super(_0x618010),this['set']('isBusy',!0x1),this['set']('isTrackChangesOn',!0x1),this['set']('_isLoading',!0x1),this['set']('_hasError',!0x1),this['_config']=_0x423e7c,this['_focusTracker']=new It(),this['_keystrokes']=new At(),this['_focusables']=this['createCollection'](),this['focusCycler']=new Ut({'focusables':this['_focusables'],'focusTracker':this['_focusTracker'],'keystrokeHandler':this['_keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}),this['_dialogContent']=new _0x327646(),this['_addContentWrapper'](_0x423e7c),this['_addDisclaimerView'](),this['_addToolbar'](_0x423e7c),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'](_0x423e7c);});}['render'](){super['render']();for(const _0x58e560 of this['_focusables'])this['_focusTracker']['add'](_0x58e560['element']);this['_keystrokes']['listenTo'](this['element']),this['_initializeScrollManager']();}['destroy'](){super['destroy'](),this['_scrollManager']&&this['_scrollManager']['destroy']();}['focus'](_0x571663){-0x1===_0x571663?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}['setIsLoading'](_0x4c6680){this['_isLoading']=_0x4c6680;}['setErrorState'](){this['_hasError']=!0x0,this['_miniToolbarView']['toggleShowChangesEnabled'](!0x1);}['clearErrorState'](){this['_hasError']=!0x1,this['_miniToolbarView']['toggleShowChangesEnabled'](!0x0);}['showError'](_0x3b30b9){super['showError'](_0x3b30b9),this['_dialogContent']['has'](this['_errorView'])||this['_dialogContent']['add'](this['_errorView'],0x0);}['hideError'](){super['hideError'](),this['clearErrorState']();}['showBlockingError'](_0x554804){super['showBlockingError'](_0x554804),this['setErrorState']();}['addMiniToolbarItem'](_0xb9c202){this['_miniToolbarView']['items']['has'](_0xb9c202)||this['_miniToolbarView']['items']['add'](_0xb9c202);}['removeMiniToolbarItem'](_0x6fb3c3){this['_miniToolbarView']['items']['has'](_0x6fb3c3)&&this['_miniToolbarView']['items']['remove'](_0x6fb3c3);}['showLoader'](){this['_loaderView']&&(this['_isLoading']=!0x0);}['hideLoader'](){this['_loaderView']&&(this['_isLoading']=!0x1);}['_toggleToolbarButtonsVisibility']({showApplyButton:_0x1dc6bc,showSuggestButton:_0x166caa}){_0x1dc6bc=_0x1dc6bc&&!this['isTrackChangesOn']&&this['_config']['availableActions']['includes']('applySuggestion'),_0x166caa=_0x166caa&&this['_config']['availableActions']['includes']('insertSuggestion'),this['_toolbarView']['setButtonsVisibility']({'showApplyButton':_0x1dc6bc,'showSuggestButton':_0x166caa});}async['updateContent'](_0x1073b3){await this['_streamableContentView']['update'](_0x1073b3);}['clearContent'](){this['_streamableContentView']['clear']();}['_addContentWrapper'](_0x2beb26){this['_contentWrapper']=new Nt(this['locale']),this['_contentWrapper']['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-actions-balloon-content']},'children':[{'tag':'div','attributes':{'class':['ck-ai-actions-balloon-content-wrapper']},'children':[this['_createLoaderView'](),this['_createStreamableContentView']()]},this['_createMiniToolbar'](_0x2beb26['miniToolbarConfig'])]}),this['_dialogContent']['add'](this['_contentWrapper']);}['_addDisclaimerView'](){this['_disclaimerView']=new AIActionsBalloonDisclaimerView(this['locale']),this['_dialogContent']['add'](this['_disclaimerView']);}['_addToolbar']({showApplyButton:_0x3409d3,showSuggestButton:_0x43f1a3}){this['_toolbarView']=new AIActionsBalloonToolbarView(this['locale'],_0x3409d3,_0x43f1a3),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',(_0x6ca713,_0x5bcd73,_0x5343e8)=>!(_0x6ca713||_0x5bcd73||_0x5343e8)),this['_toggleToolbarButtonsVisibility']({'showApplyButton':_0x3409d3,'showSuggestButton':_0x43f1a3}),this['_dialogContent']['add'](this['_toolbarView']);}['_createMiniToolbar'](_0x352f5d){return this['_miniToolbarView']=new AIMiniToolbarView(this['locale'],_0x352f5d),this['_miniToolbarView']['delegate'](...bs)['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',(_0x2edf83,_0x1e41f0)=>!(_0x2edf83||_0x1e41f0)),this['_miniToolbarView'];}['_createLoaderView'](){return this['_loaderView']=new AISuggestionLoaderView(this['locale']),this['_loaderView']['bind']('isVisible')['to'](this,'_isLoading'),this['_loaderView'];}['_createStreamableContentView'](){return this['_streamableContentView']=new AISuggestionStreamableContentView(this['locale']),this['_streamableContentView'];}['_setupMiniToolbarButtons'](){const _0xe79a57=new yt(this['locale']),_0x303e13=new yt(this['locale']),_0x224652=new AIActionsBalloonNavigationCounterView(this['locale']),_0x3b0705=new yt(this['locale']);_0xe79a57['set']({'icon':et,'label':Mi(this['locale'],'AI_ACTIONS_TRY_AGAIN'),'tooltip':!0x0,'class':'ck-ai-custom-action-button\x20'+Gi}),_0x303e13['set']({'icon':_0x2b56fa,'tooltip':Mi(this['locale'],'AI_ACTIONS_PREVIOUS_INTERACTION'),'class':'ck-ai-navigation-button\x20ck-ai-previous-button\x20'+Gi}),_0x3b0705['set']({'icon':it,'tooltip':Mi(this['locale'],'AI_ACTIONS_NEXT_INTERACTION'),'class':'ck-ai-navigation-button\x20ck-ai-next-button\x20'+Gi}),_0xe79a57['bind']('isEnabled')['to'](this,'isBusy',_0x171db9=>!_0x171db9),_0xe79a57['on']('execute',()=>{this['fire']('tryAgain');}),_0x303e13['bind']('isEnabled')['to'](this,'isBusy',_0xd61568=>!_0xd61568),_0x303e13['on']('execute',()=>{this['fire']('showPrevious');}),_0x3b0705['bind']('isEnabled')['to'](this,'isBusy',_0x28942c=>!_0x28942c),_0x3b0705['on']('execute',()=>{this['fire']('showNext');}),this['_navigationPreviousButton']=_0x303e13,this['_navigationCounter']=_0x224652,this['_navigationNextButton']=_0x3b0705,this['_navigationTryAgainButton']=_0xe79a57;}['updateMiniToolbarButtons'](_0x18798f,_0x353aae){this['_navigationPreviousButton']||this['_setupMiniToolbarButtons']();const _0x23aeb2=_0x18798f>0x1;if(this['addMiniToolbarItem'](this['_navigationTryAgainButton']),_0x23aeb2){this['addMiniToolbarItem'](this['_navigationPreviousButton']),this['addMiniToolbarItem'](this['_navigationCounter']),this['addMiniToolbarItem'](this['_navigationNextButton']);const _0x5a7cdf=_0x18798f-_0x353aae;this['_navigationCounter']['setInteractionCount'](_0x5a7cdf+'/'+_0x18798f),this['_navigationPreviousButton']['isEnabled']=_0x353aae<_0x18798f-0x1,this['_navigationNextButton']['isEnabled']=_0x353aae>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'](_0x4e2694){this['_isLoading']=_0x4e2694;}['resetShowChangesButton'](){this['_miniToolbarView']['isShowChangesOn']=!0x1;}['_initializeScrollManager'](){const _0x4e156d=this['_getScrollableElement']();_0x4e156d&&!this['_scrollManager']&&(this['_scrollManager']=new ScrollManager(_0x4e156d));}['_getScrollableElement'](){return this['_streamableContentView']['element'];}}class AIActionsBalloonNavigationCounterView extends Nt{constructor(_0x3deb28){super(_0x3deb28);const _0x14b415=this['bindTemplate'];this['set']('interactionCount','1/1'),this['setTemplate']({'tag':'span','attributes':{'class':['ck-ai-interaction-counter']},'children':[{'text':_0x14b415['to']('interactionCount')}]});}['setInteractionCount'](_0x47c53e){this['set']('interactionCount',_0x47c53e);}}class AIActions extends _0x3da4a3{static get['requires'](){return[AIConnector,Gt,AIEditing,AIBalloon,_0x4fc25b];}static get['pluginName'](){return'AIActions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['_aiConnector'];['_interactions']=[];['_currentInteractionIndex']=0x0;['_interactionParams'];['_balloonShowDiff']=!0x1;['_promiseQueue'];['_bodyCollection'];get['_interaction'](){return this['_interactions'][this['_interactions']['length']-0x1];}['_actionsBalloonView'];constructor(_0x59b836){super(_0x59b836),this['_bodyCollection']=new Xt(this['editor']['locale']),this['_bodyCollection']['attachToDom'](),this['_aiConnector']=this['editor']['plugins']['get']('AIConnector'),this['set']('isBusy',!0x1),this['_promiseQueue']=new PromiseQueue();}['stopInteraction'](){this['_stopInteraction']();}async['executeAction'](_0x4e8c53,_0x1820b3,_0x29972c){if(this['_stopInteraction'](),this['editor']['plugins']['has']('TableSelection')){if(this['editor']['plugins']['get']('TableSelection')['getSelectedTableCells']()){const {modelFragment:_0x451f00,anchorData:_0x2e96a4,root:_0x3256ad}=this['_getExecuteDataInTable']();return this['_executeAction'](_0x4e8c53,_0x451f00,_0x2e96a4,_0x3256ad,_0x1820b3,_0x29972c);}}const {modelFragment:_0x45a966,anchorData:_0x585e2a,root:_0x2ba8cc}=this['_getExecuteDataRegular']();return this['_executeAction'](_0x4e8c53,_0x45a966,_0x585e2a,_0x2ba8cc,_0x1820b3,_0x29972c);}async['destroy'](){return this['_stopInteraction'](),this['_bodyCollection']['detachFromDom'](),super['destroy']();}['_createActionsBalloonView'](){const _0x4b9865=this['editor']['plugins']['has']('TrackChanges');let _0x50fdca=this['editor']['config']['get']('ai.availableReplyActions')||[...Ps];_0x4b9865||(_0x50fdca=_0x50fdca['filter'](_0x4f0f24=>'insertSuggestion'!=_0x4f0f24));const _0xfbc77d=this['editor']['commands']['get']('trackChanges'),_0x280b4d=new AIActionsBalloonView(this['editor']['locale'],{'showApplyButton':!0x0,'showSuggestButton':_0x4b9865,'miniToolbarConfig':{'showChanges':'icon'},'availableActions':_0x50fdca});return _0x280b4d['bind']('isBusy')['to'](this),_0xfbc77d&&_0x280b4d['bind']('isTrackChangesOn')['to'](_0xfbc77d,'value'),_0x280b4d['on']('tryAgain',()=>{this['_refreshInteraction']();}),_0x280b4d['on']('showPrevious',()=>{this['_navigateToPrevious']();}),_0x280b4d['on']('showNext',()=>{this['_navigateToNext']();}),_0x280b4d;}['_normalizeSelectionStart'](){const _0xb8b5d9=this['editor']['model'],_0x5b1b29=_0xb8b5d9['document']['selection'],_0x234bbe=_0x5b1b29['getFirstRange']();if(!_0x234bbe||_0x234bbe['isCollapsed'])return;const _0x265c3a=gt(_0x5b1b29['getSelectedBlocks']());if(!_0x265c3a)return;const _0xfe63e=_0xb8b5d9['createPositionAt'](_0x265c3a,0x0);_0xfe63e['isAfter'](_0x234bbe['start'])&&_0xb8b5d9['change'](_0x235aa8=>{_0x235aa8['setSelection'](_0x235aa8['createRange'](_0xfe63e,_0x234bbe['end']));});}['_getExecuteDataRegular'](){const _0x31544d=this['editor']['model']['document']['selection'],_0x17bab0=_0x31544d['getFirstRange']()['start']['root'];if(_0x31544d['isCollapsed']){const _0xe4f044=gt(_0x31544d['getSelectedBlocks']())||this['editor']['model']['schema']['getLimitElement'](_0x31544d);this['editor']['model']['change'](_0x5a1031=>{_0x5a1031['setSelection'](_0xe4f044,'in');});}this['_normalizeSelectionStart']();const _0x579646=_0x31544d['getFirstRange'](),_0x24f270=this['_wrapWithCommonAncestors'](this['editor']['model']['getSelectedContent'](_0x31544d),_0x579646['start'],_0x579646['end']);this['_copyMarkersToFragment'](_0x24f270,_0x31544d,{'isTableSelection':!0x1});const _0x42beed=_0x31544d['getFirstRange']()['start'],_0x8c5ba2=new Map();let _0x501c25=_0x24f270;for(let _0x450366=0x0;_0x450366<_0x42beed['path']['length'];_0x450366++)_0x8c5ba2['set'](_0x501c25,_0x42beed['path'][_0x450366]),_0x501c25=_0x501c25['getChild'](0x0);return{'modelFragment':_0x24f270,'anchorData':_0x8c5ba2,'root':_0x17bab0};}['_getExecuteDataInTable'](){const _0x363d52=this['editor']['model']['document']['selection'],_0x4096ed=this['editor']['plugins']['get']('TableSelection'),_0x26232d=_0x363d52['getFirstRange']()['start']['root'],_0x87156b=_0x4096ed['getSelectionAsFragment'](),_0x243fef=_0x363d52['getFirstRange']()['start']['parent']['parent'],_0x32ef03=this['editor']['model']['createRange'](this['editor']['model']['createPositionBefore'](_0x243fef),this['editor']['model']['createPositionAfter'](_0x243fef)),_0x18e181=this['_wrapWithCommonAncestors'](_0x87156b,_0x32ef03['start'],_0x32ef03['end']);this['_copyMarkersToFragment'](_0x18e181,_0x363d52,{'isTableSelection':!0x0});const _0x10c21b=_0x363d52['getFirstRange']()['start'],_0x21c5c2=new Map();let _0x10f95e=_0x18e181;for(let _0xe49ce3=0x0;_0xe49ce3<_0x10c21b['path']['length'];_0xe49ce3++)if(_0x21c5c2['set'](_0x10f95e,_0x10c21b['path'][_0xe49ce3]),_0xe49ce3<_0x10c21b['path']['length']-0x1)_0x10f95e=_0x10f95e['getChild'](0x0);else{let _0x1a2028=_0x10f95e['nextSibling'];for(;_0x1a2028;)_0x21c5c2['set'](_0x1a2028,_0x10c21b['path'][_0xe49ce3]),_0x1a2028=_0x1a2028['nextSibling'];}return{'modelFragment':_0x18e181,'anchorData':_0x21c5c2,'root':_0x26232d};}async['_executeAction'](_0x37c98b,_0x3e78c2,_0x754801,_0x5cd4bd,_0x7bbe2e,_0x216e99){const _0x1848ee=this['editor']['plugins']['get'](AIEditing),_0x26bb6d=this['editor']['plugins']['get'](AIBalloon),_0x568096=this['editor']['model']['document']['selection'],_0x4e6057=await _0x1848ee['modelToDataWithIds'](_0x3e78c2,this['editor']),_0x2317e6=this['editor']['model']['document']['version'],_0x2fcc88=[..._0x568096['getRanges']()];return this['_actionsBalloonView']||(this['_actionsBalloonView']=this['_createActionsBalloonView']()),this['_clearInteractionHistory'](),this['_clearErrorState'](),this['_balloonShowDiff']=!0x1,this['_actionsBalloonView']['resetShowChangesButton'](),this['_actionsBalloonView']['clearContent'](),_0x26bb6d['open']({'targetEditor':this['editor'],'index':0x3e8*Math['random']()%0x3e8,'title':_0x7bbe2e,'icon':_0x216e99||_0x1226aa,'mainView':this['_actionsBalloonView'],'class':'ck-ai-actions-balloon','ranges':_0x2fcc88,'id':'aiActionsBalloon'}),this['_setLoadingState'](),this['stopListening'](this['_actionsBalloonView']),this['stopListening'](_0x26bb6d),this['_interactionParams']={'action':_0x37c98b,'content':_0x4e6057,'version':_0x2317e6,'aiBalloon':_0x26bb6d,'modelFragment':_0x3e78c2,'anchorData':_0x754801,'root':_0x5cd4bd},this['_setupApplyListeners'](),this['listenTo'](_0x26bb6d,'selectionRemoved',()=>{this['_stopInteraction'](),this['_actionsBalloonView']['disableMiniToolbarButtons']();}),this['listenTo'](_0x26bb6d,'dialogClosed',(_0x2c1537,{id:_0xe3a108})=>{if('aiActionsBalloon'===_0xe3a108){for(const _0x5e84d5 of this['_interactions']){if(0x0===_0x5e84d5['replies']['length']||_0x5e84d5['stoppedExplicitly'])continue;const _0x58a166=_0x5e84d5['replies'][_0x5e84d5['replies']['length']-0x1],_0x2fba67=_0x58a166['changeGroups'][0x0];_0x2fba67&&'pending'===_0x2fba67['state']&&_0x58a166['setChangeGroupState'](0x0,'rejected');}this['_stopInteraction'](),this['_clearInteractionHistory'](),this['stopListening'](this['_actionsBalloonView']),this['stopListening'](_0x26bb6d);}}),this['_createInteraction'](_0x4e6057,_0x2317e6,_0x26bb6d,_0x37c98b);}['_setupApplyListeners'](){if(!this['_interactionParams'])return;const {modelFragment:_0x3d8368,anchorData:_0xbadc96,root:_0xcf8455}=this['_interactionParams'];this['listenTo'](this['_actionsBalloonView'],'applySuggestion',()=>{this['_applyChanges'](_0x3d8368,_0xbadc96,_0xcf8455,!0x1);}),this['listenTo'](this['_actionsBalloonView'],'insertSuggestion',()=>{this['_applyChanges'](_0x3d8368,_0xbadc96,_0xcf8455,!0x0);});}['_wrapWithCommonAncestors'](_0x338247,_0x2fb941,_0x296a04){const _0x5ad23f=this['editor']['model']['createRange'](_0x2fb941,_0x296a04)['getCommonAncestor'](),_0x2acb1c=_0x5ad23f['is']('documentFragment')?[]:_0x5ad23f['getAncestors']({'includeSelf':!0x0})['slice'](0x1);if(_0x2acb1c['length']){const _0x2ba551=_0x2acb1c['map'](_0x2ed904=>_0x2ed904['_clone'](!0x1));for(let _0x411905=0x1;_0x411905<_0x2ba551['length'];_0x411905++)_0x2ba551[_0x411905-0x1]['_appendChild'](_0x2ba551[_0x411905]);return _0x2ba551[_0x2ba551['length']-0x1]['_appendChild'](_0x338247),new _0x17914c(_0x2ba551[0x0]);}return _0x338247;}['_copyMarkersToFragment'](_0x489b94,_0x3dac71,_0x3f4b5f={'isTableSelection':!0x1}){const _0x14d0f6=this['editor']['model'],_0x4dda45=Array['from'](_0x3dac71['getRanges']()),_0x3869d3=_0x3dac71['getFirstRange']()['start'];for(const _0x2b7147 of _0x14d0f6['markers']){if(_0x2b7147['name']['startsWith'](fs)||!_0x2b7147['affectsData'])continue;const _0x6b71f2=_0x2b7147['getRange']();if(!_0x4dda45['some'](_0x52752d=>_0x52752d['containsRange'](_0x6b71f2,!0x0)))continue;const _0x596677=this['_regularCalculateMarkerPath'](_0x6b71f2['start'],_0x3869d3,_0x3f4b5f['isTableSelection']),_0x362360=this['_regularCalculateMarkerPath'](_0x6b71f2['end'],_0x3869d3,_0x3f4b5f['isTableSelection']),_0xf4f3e5=_0x14d0f6['createPositionFromPath'](_0x489b94,_0x596677),_0x81c283=_0x14d0f6['createPositionFromPath'](_0x489b94,_0x362360);if(!_0xf4f3e5['isEqual'](_0x81c283)){const _0x11bc4a=_0x14d0f6['createRange'](_0xf4f3e5,_0x81c283);_0x489b94['markers']['set'](_0x2b7147['name'],_0x11bc4a);}}}['_regularCalculateMarkerPath'](_0x428cd9,_0x22599d,_0x327dc0=!0x1){const _0x90f2f0=[..._0x428cd9['path']['slice']()];for(let _0x5bc6a2=0x0;_0x5bc6a2<Math['max'](_0x22599d['path']['length'],_0x428cd9['path']['length']);_0x5bc6a2++){const _0x59d3e2=_0x22599d['path'][_0x5bc6a2]||0x0,_0x37f7e8=(_0x428cd9['path'][_0x5bc6a2]||0x0)-_0x59d3e2;if(_0x90f2f0[_0x5bc6a2]=_0x37f7e8,0x0!==_0x37f7e8&&!_0x327dc0)break;}return _0x90f2f0;}async['_createInteraction'](_0x4fc44f,_0xc567b5,_0x5c7e5d,_0x17e3ba){const _0xdabf69=this['editor'],_0x188c96=_0xdabf69['model']['document']['selection']['getFirstRange']()['start']['root'];this['_interactionParams']||(this['_interactionParams']={'action':_0x17e3ba,'content':_0x4fc44f,'version':_0xc567b5,'aiBalloon':_0x5c7e5d,'modelFragment':this['editor']['model']['getSelectedContent'](this['editor']['model']['document']['selection']),'anchorData':new Map(),'root':_0x188c96});const _0x5d4b3f=new AIActionsInteraction({'connector':this['_aiConnector'],'locale':_0xdabf69['locale'],'content':_0x4fc44f,'version':_0xc567b5,'editor':_0xdabf69,'rootName':_0x188c96['rootName'],..._0x17e3ba});this['_interactions']['push'](_0x5d4b3f);const _0x3c5658=(_0x1645ea,_0x292fae=!0x1,_0x229c6f='streaming')=>this['_promiseQueue']['enqueue'](async _0x199f30=>{try{const _0x97f45f=rs({'changeGroups':_0x1645ea['changeGroups'],'documentContextContent':_0x1645ea['documentContextContent'],'showDiff':_0x292fae,'trimUnchanged':!0x1});_0x97f45f['length']&&await this['_actionsBalloonView']['updateContent']({'part':_0x97f45f[0x0],'renderingStrategy':_0x229c6f,'abortSignal':_0x199f30});}catch(_0x3bfa10){if(this['_isAbortError'](_0x3bfa10))return;throw _0x3bfa10;}});_0x5d4b3f['on']('replyCreated',(_0x16a364,_0x2c89ef)=>{this['_actionsBalloonView']['hideLoader'](),this['_actionsBalloonView']['startAutoScroll'](),_0x3c5658(_0x2c89ef)['catch'](_0x30ac10=>{this['_isAbortError'](_0x30ac10)||(console['error']('Error\x20updating\x20content\x20in\x20replyCreated:',_0x30ac10),this['_setErrorState'](_0x5d4b3f));});}),_0x5d4b3f['on']('replyContentUpdated',(_0x51ec6e,_0x55f2bd)=>{_0x3c5658(_0x55f2bd)['catch'](_0xb572ac=>{this['_isAbortError'](_0xb572ac)||(console['error']('Error\x20updating\x20content\x20in\x20replyContentUpdated:',_0xb572ac),this['_setErrorState'](_0x5d4b3f));});}),_0x5d4b3f['on']('interactionFinished',async()=>{try{await this['_clearLoadingState'](),this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']),await this['_promiseQueue']['queueEmptyPromise'];}catch(_0x5ca606){this['_isAbortError'](_0x5ca606)||(console['error']('Error\x20clearing\x20loading\x20state\x20in\x20interactionFinished:',_0x5ca606),this['_setErrorState'](_0x5d4b3f));}finally{this['_actionsBalloonView']['stopAutoScroll']();}}),this['listenTo'](this['_actionsBalloonView'],'toggleSuggestionDisplayMode',async(_0xb5187,{showDiff:_0x5944d5})=>{try{this['_balloonShowDiff']=_0x5944d5;const _0x464b32=this['_interaction']['replies'][this['_interaction']['replies']['length']-0x1];_0x464b32&&await _0x3c5658(_0x464b32,_0x5944d5,'static');}catch(_0x527a16){this['_isAbortError'](_0x527a16)||(console['error']('Error\x20updating\x20content\x20in\x20toggleSuggestionDisplayMode:',_0x527a16),this['_setErrorState'](_0x5d4b3f));}}),_0x5d4b3f['on']('replyChangeGroupStateUpdated',()=>{const _0x3797e5={'positiveCount':_0x5d4b3f['replies']['reduce']((_0x548ecc,_0x316274)=>_0x548ecc+_0x316274['changeGroups']['filter'](_0x201c50=>'accepted'===_0x201c50['state'])['length'],0x0),'totalCount':_0x5d4b3f['replies']['reduce']((_0x55f012,_0x4c9700)=>_0x55f012+_0x4c9700['changeGroups']['length'],0x0)},_0x313371=_0x5d4b3f['actionCallId'],_0x184b0d=_0x5d4b3f['actionName'];_0x184b0d?this['_aiConnector']['upsertAIActionRating'](_0x184b0d,_0x313371,_0x3797e5):this['_aiConnector']['upsertCustomAIActionRating'](_0x313371,_0x3797e5);}),this['_setLoadingState']();try{const _0x538beb=await _0x5d4b3f['start']();return this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']),_0x538beb;}catch(_0x4927c8){if(this['_isAbortError'](_0x4927c8))return;this['_actionsBalloonView']['hideLoader'](),this['_setErrorState'](_0x5d4b3f);}}['_applyChanges'](_0x310645,_0x5b0667,_0xb22999,_0x510615){const _0x53977b=this['editor'];if(_0x510615&&!_0x53977b['plugins']['has']('TrackChanges'))throw new ht('ai-no-track-changes',null);const _0x2b4ee3=this['editor']['plugins']['get'](_0x4fc25b),_0xd55b55=this['_interactions'][this['_interactions']['length']-0x1-this['_currentInteractionIndex']];if(!_0xd55b55||!_0xd55b55['replies']['length'])return;const _0x5120a4=_0xd55b55['replies'][_0xd55b55['replies']['length']-0x1],_0xb634bc=_0x5120a4['changeGroups'];_0x5120a4['setChangeGroupState'](0x0,'accepted');let _0x43c521=ps({'reply':_0x5120a4,'interaction':_0xd55b55,'groups':_0xb634bc,'transform':!0x1,'documentCompare':_0x2b4ee3,'documentCompareOptions':{'anchor':_0x53977b['model']['createPositionAt'](_0x310645,0x0),'markDeletions':_0x510615}});_0x43c521=this['_filterOperationsOutsideRange'](_0x43c521,_0x5b0667);for(const _0x526e80 of _0x43c521)this['_anchorOperation'](_0x5b0667,_0x526e80,_0xb22999);const _0x3d0fed=_0xd55b55['getDocumentContext']()['documents'][0x0]['version'],_0xbd5555=_0x53977b['model']['document']['history']['getOperations'](_0x3d0fed),_0x67f468={'document':_0x53977b['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1},_0x1b69a1=_0x18252b(_0x43c521,_0xbd5555,_0x67f468)['operationsA'];_0x53977b['model']['change'](_0x5d9f2f=>{if(_0x5d9f2f['setSelection'](_0x53977b['model']['document']['selection']['focus']),_0x510615)_0x53977b['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x1b69a1);else{for(const _0x45cf2b of _0x1b69a1)_0x45cf2b['baseVersion']=_0x53977b['model']['document']['version'],Es(_0x53977b,_0x45cf2b),_0x5d9f2f['batch']['addOperation'](_0x45cf2b),_0x53977b['model']['applyOperation'](_0x45cf2b);}}),this['editor']['plugins']['get']('AIBalloon')['close']();}['_filterOperationsOutsideRange'](_0x51a344,_0x2013ac){return _0x51a344['filter'](_0x233646=>{if('rename'==_0x233646['type']){const _0x4f38b7=_0x233646['position']['nodeAfter'];return!_0x2013ac['has'](_0x4f38b7);}if(_0x233646['type']['indexOf']('Attribute')>-0x1){const _0x51cbd6=_0x233646['range']['start']['nodeAfter'];return!_0x2013ac['has'](_0x51cbd6);}return!0x0;});}['_anchorOperation'](_0x3640c3,_0x12e942,_0x5b8ee8){const _0x5c86f1=_0x12e942['clone']();for(const _0x2ce766 in _0x12e942){const _0x1c423b=_0x12e942[_0x2ce766];_0x1c423b instanceof _0x2173cf?_0x12e942[_0x2ce766]=new _0x2173cf(_0x29ca2d(_0x1c423b['start']),_0x29ca2d(_0x1c423b['end'])):_0x1c423b instanceof _0x4343f1&&(_0x12e942[_0x2ce766]=_0x29ca2d(_0x1c423b));}if(['insert','move','remove','reinsert','split','merge']['includes'](_0x5c86f1['type'])){if(_0x5c86f1['isDocumentOperation']=!0x1,_0x5c86f1['baseVersion']=null,'remove'==_0x5c86f1['type']){const _0x2b400c=_0x5c86f1['sourcePosition'],_0x1911f4=_0x5c86f1['howMany'];new _0x389353(_0x2b400c,_0x1911f4)['_execute']();}else _0x5c86f1['_execute']();}function _0x29ca2d(_0x4b328b){if('$graveyard'==_0x4b328b['root']['rootName'])return _0x4b328b;const _0x45d67e=[];let _0x4a2208=_0x4b328b['root'];for(let _0x3f6d44=0x0;_0x3f6d44<_0x4b328b['path']['length'];_0x3f6d44++){const _0x5e8258=_0x3640c3['get'](_0x4a2208)||0x0;_0x45d67e[_0x3f6d44]=_0x4b328b['path'][_0x3f6d44]+_0x5e8258,_0x4a2208=_0x4a2208['getChildAtOffset'](_0x4b328b['path'][_0x3f6d44]);}return new _0x4343f1(_0x5b8ee8,_0x45d67e,_0x4b328b['stickiness']);}}['_refreshInteraction'](){if(!this['_interactionParams'])return;this['_interactions']['length']>0x0&&this['_stopInteraction'](),this['_currentInteractionIndex']=0x0,this['_balloonShowDiff']=!0x1;const {action:_0x7554f,content:_0x5bf628,version:_0x352827,aiBalloon:_0x176c8e}=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'](_0x5bf628,_0x352827,_0x176c8e,_0x7554f)['catch'](_0x289990=>{this['_isAbortError'](_0x289990)||console['error']('Error\x20refreshing\x20interaction:',_0x289990);});}['_isAbortError'](_0x1d017e){return!!_0x1d017e['message']&&_0x1d017e['message']['startsWith']('ai-request-aborted');}['_clearInteractionHistory'](){this['_interactions']=[],this['_interactionParams']=void 0x0,this['_currentInteractionIndex']=0x0,this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);}['_stopInteraction'](){this['_interaction']&&this['_interaction']['stop'](),this['_promiseQueue']['abort'](),this['isBusy']=!0x1,this['_interactionParams']&&this['_actionsBalloonView']['stopAutoScroll']();}['_navigateToPrevious'](){const _0x41b7d5=this['_interactions']['length'];this['_currentInteractionIndex']<_0x41b7d5-0x1&&this['_displayInteractionAtIndex'](this['_currentInteractionIndex']+0x1);}['_navigateToNext'](){this['_currentInteractionIndex']>0x0&&this['_displayInteractionAtIndex'](this['_currentInteractionIndex']-0x1);}async['_displayInteractionAtIndex'](_0x301473){if(!this['_interactionParams'])return;this['_currentInteractionIndex']=_0x301473;const _0x4c3bce=this['_interactions'][this['_interactions']['length']-0x1-this['_currentInteractionIndex']];if(!_0x4c3bce)return;if(_0x4c3bce['hasError'])return this['_setErrorState'](_0x4c3bce),void this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);if(!_0x4c3bce['replies']['length'])return;this['_actionsBalloonView']['hideError'](),this['_interactionParams']&&this['_clearErrorState']();const _0x33ffde=_0x4c3bce['replies'][_0x4c3bce['replies']['length']-0x1];if(_0x33ffde)try{const _0xd66af2=rs({'changeGroups':_0x33ffde['changeGroups'],'documentContextContent':_0x33ffde['documentContextContent'],'showDiff':this['_balloonShowDiff'],'trimUnchanged':!0x1});await new Promise(_0x141239=>setTimeout(_0x141239,0x32)),await this['_actionsBalloonView']['updateContent']({'part':_0xd66af2[0x0],'renderingStrategy':'static','abortSignal':new AbortController()['signal']});}catch(_0x27d8f8){this['_isAbortError'](_0x27d8f8)||console['error']('Error\x20updating\x20content\x20during\x20navigation:',_0x27d8f8);}this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);}['_setLoadingState'](){this['_actionsBalloonView']['setIsLoading'](!0x0),this['isBusy']=!0x0;}async['_setErrorState'](_0xc8381d){const _0x564cbe=Mi(this['editor']['locale'],'AI_ACTIONS_GENERIC_ERROR');this['_actionsBalloonView']['showError'](_0x564cbe),_0xc8381d['hasError']=!0x0,await this['_promiseQueue']['queueEmptyPromise'],this['_actionsBalloonView']['setErrorState'](),this['_actionsBalloonView']['toggleIsLoading'](!0x0);}['_clearErrorState'](){this['_actionsBalloonView']['hideError'](),this['_actionsBalloonView']['toggleIsLoading'](!0x1);}async['_clearLoadingState'](){await this['_promiseQueue']['queueEmptyPromise'],this['isBusy']=!0x1,this['_actionsBalloonView']['setIsLoading'](!0x1);}}class AIQuickActions extends _0x3da4a3{static get['requires'](){return[AIQuickActionsUI,AIQuickActionsEditing,AIActions];}static get['pluginName'](){return'AIQuickActions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x8b31b4){super(_0x8b31b4),_0x8b31b4['config']['define']('ai.quickActions',{'extraCommands':[],'removeCommands':[],'isSearchEnabled':!0x0});}}class AIReviewCoreReviewCheckListItemResultsView extends Nt{['resultResponseView'];['acceptButtonView'];['dismissButtonView'];['infoButtonView'];['outdatedButtonView'];constructor(_0x390430,_0x5f05cd){super(_0x390430),this['id']=_0x5f05cd,this['set']('status','pending'),this['set']('changeId',_0x5f05cd),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',(_0x2f78a3,_0x5f410a)=>{_0x5f410a&&_0x5f410a['target']&&'A'===_0x5f410a['target']['tagName']&&_0x5f410a['preventDefault'](),this['fire']('activateChange',{'id':_0x5f05cd,'source':this,'uiInteraction':'click'});}),this['on']('mouseover',()=>{this['fire']('activateChange',{'id':_0x5f05cd,'source':this,'uiInteraction':'hover'});}),this['on']('mouseout',()=>{this['fire']('deactivateChange',{'origin':'panel','id':_0x5f05cd,'source':this});});}['setItemAsActive'](){this['isActive']=!0x0;}['setItemAsInactive'](){this['isActive']=!0x1;}['_createResultResponseView'](){const _0x44774b=new Nt(this['locale']);return _0x44774b['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content','ck-reset_all-excluded','ck-ai_review__check-run-result-response',this['bindTemplate']['if']('showDiff','ck-hidden',_0x5915c8=>!_0x5915c8)]}}),_0x44774b;}['_createAcceptButtonView'](){const _0x20c969=new yt(this['locale']);return _0x20c969['set']({'label':Mi(this['locale'],'AI_REVIEW_MODE_ACCEPT_CHANGE'),'withText':!0x0}),_0x20c969['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x1c716d=>{this['fire']('acceptChange',{'id':this['changeId']}),_0x1c716d['stopPropagation']();})},'attributes':{'class':[this['bindTemplate']['if']('status','ck-hidden',_0x5242c3=>'pending'!==_0x5242c3&&'accepted'!==_0x5242c3),this['bindTemplate']['if']('status',Bi,_0x12b683=>'pending'===_0x12b683),this['bindTemplate']['if']('status',Gi,_0x3ac44e=>'pending'!==_0x3ac44e),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-status-button',_0x53b02a=>'accepted'===_0x53b02a)]}}),this['on']('change:status',(_0x5c6c19,_0x3c0f30,_0x583949)=>{_0x20c969['isEnabled']='pending'===_0x583949,'accepted'===_0x583949&&(_0x20c969['label']=Mi(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_ACCEPTED'),_0x20c969['icon']=_0x379fc9);}),_0x20c969;}['_createDismissButtonView'](){const _0x1df8c5=new yt(this['locale']);return _0x1df8c5['set']({'label':Mi(this['locale'],'AI_REVIEW_MODE_DISMISS_CHANGE'),'withText':!0x0}),_0x1df8c5['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x3f6bf5=>{this['fire']('dismissChange',{'id':this['changeId']}),_0x3f6bf5['stopPropagation']();})},'attributes':{'class':[Gi,this['bindTemplate']['if']('status','ck-hidden',_0x547bb3=>'pending'!==_0x547bb3&&'rejected'!==_0x547bb3),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-dismiss-button',_0x4def44=>'pending'===_0x4def44),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-status-button',_0x2dfba0=>'rejected'===_0x2dfba0)]}}),this['on']('change:status',(_0x276e5d,_0xe66a61,_0x34b497)=>{_0x1df8c5['isEnabled']='pending'===_0x34b497,'rejected'===_0x34b497&&(_0x1df8c5['label']=Mi(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_REJECTED'),_0x1df8c5['icon']=_0x36e8b7);}),_0x1df8c5;}['_createInfoButtonView'](){const _0x26e2a6=new yt(this['locale']);return _0x26e2a6['set']({'label':Mi(this['locale'],'AI_REVIEW_MODE_LEARN_MORE'),'icon':_0x2c999a,'tooltip':!0x0,'isToggleable':!0x0,'role':'menuitemcheckbox','class':Gi+'\x20ck-ai_review__check-run-result-info-button\x20ck-hidden'}),_0x26e2a6['bind']('isOn')['to'](this,'isInfoToggleOn',_0x2669bb=>_0x2669bb),_0x26e2a6['on']('execute',()=>{this['isInfoToggleOn']=!this['isInfoToggleOn'];}),_0x26e2a6;}['_createOutdatedButtonView'](){const _0x19fb72=new yt(this['locale']);return _0x19fb72['set']({'label':Mi(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_OUTDATED'),'icon':st,'withText':!0x0,'isEnabled':!0x1}),_0x19fb72['extendTemplate']({'attributes':{'class':[Gi,'ck-ai_review__check-run-result-status-button',this['bindTemplate']['if']('status','ck-hidden',_0x239fd2=>'outdated'!==_0x239fd2)],'disabled':'disabled'}}),_0x19fb72;}}class AIReviewCoreBalloonSuggestionItemView extends zt{['resultItemView'];['_pinnedRectIndex']=void 0x0;['_pinnedTargetElement']=void 0x0;['_pinnedTargetChangeId']=void 0x0;constructor(_0x17eb07,_0x258c3b){super(_0x17eb07),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']()),_0x258c3b['add'](this);}['render'](){super['render'](),this['_setupClickOutsideHandler']();}['updateContent'](_0x3f0486){this['resultItemView']['changeId']=_0x3f0486['id'],this['resultItemView']['resultResponseView']['element']['innerHTML']=_0x3f0486['contentDiffed'];}['showBalloon'](_0x1db25f,_0x38bedd,_0x44532d,_0x1262c2,_0x2cee24,_0x14a109){const _0xbc7b3e=_0x38bedd();if(!_0xbc7b3e)return;this['updateContent'](_0x1db25f),this['show']();const _0x536753=Array['from'](_0xbc7b3e['getClientRects']())['reverse'](),_0x316e3e=this['_getPointedRectIndexFromEvent'](_0x44532d,_0x536753),_0x784641=_0x536753[_0x316e3e??0x0];'click'===_0x1262c2?(this['isDiffActive']=!0x0,this['pin']({'target':()=>this['_getBestRectPositionOnClick'](_0x38bedd(),_0x316e3e,_0x1db25f['id'],_0x2cee24,_0x14a109)||_0x784641})):'hover'===_0x1262c2&&(this['isDiffActive']=!0x1,this['pin']({'target':()=>this['_getBestRectPositionOnHover'](_0x38bedd(),_0x316e3e,_0x1db25f['id'])||_0x784641}));}['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'](){jt({'emitter':this,'activator':()=>this['isVisible'],'contextElements':()=>{const _0x4c31a2=[this['element']];return this['_pinnedTargetElement']&&_0x4c31a2['push'](this['_pinnedTargetElement']),_0x4c31a2;},'callback':()=>{this['hide'](),this['unpin'](),this['deactivateChange'](),this['_pinnedTargetElement']=void 0x0,this['_pinnedRectIndex']=void 0x0,this['_pinnedTargetChangeId']=void 0x0;}});}['_createContentView'](){const _0x17bb25=new Nt();return this['resultItemView']=new AIReviewCoreReviewCheckListItemResultsView(this['locale'],''),this['resultItemView']['resultResponseView']['extendTemplate']({'attributes':{'class':['ck-content']}}),this['resultItemView']['delegate']('acceptChange','dismissChange')['to'](this),_0x17bb25['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']]}]}),_0x17bb25;}['_getBestRectPositionOnClick'](_0x233434,_0x36e100,_0x180512,_0x3ab620,_0x51dd36){if(!_0x233434)return null;const _0x401db2=this['position']['replace']('arrow_',''),_0x3627be=Array['from'](_0x233434['getClientRects']());let _0x1ed6cf,_0x283515=_0x3627be['reverse']();return void 0x0!==_0x36e100&&this['_isPinnedRectVisible'](_0x283515[_0x36e100],_0x3ab620,_0x51dd36)?(_0x1ed6cf=_0x283515[_0x36e100],this['_pinnedRectIndex']=_0x36e100):this['_isPinnedRectVisible'](_0x283515[0x0],_0x3ab620,_0x51dd36)&&void 0x0===_0x36e100?_0x1ed6cf=_0x283515[0x0]:(_0x283515='s'==_0x401db2[0x0]?[..._0x3627be]['reverse']():_0x3627be,_0x283515['forEach'](_0x5c5ff3=>{this['_isPinnedRectVisible'](_0x5c5ff3,_0x3ab620,_0x51dd36)&&(_0x1ed6cf=_0x5c5ff3);})),this['_pinnedTargetChangeId']=_0x180512,this['_pinnedTargetElement']=_0x233434,_0x1ed6cf||_0x233434['getBoundingClientRect']();}['_getBestRectPositionOnHover'](_0x3ef757,_0x502de0,_0x2e295b){if(!_0x3ef757)return null;const _0x32948e=Array['from'](_0x3ef757['getClientRects']())['reverse']();if(void 0x0===this['_pinnedRectIndex']&&void 0x0!==_0x502de0&&this['_pinnedTargetChangeId']!==_0x2e295b)return this['_pinnedRectIndex']=_0x502de0,this['_pinnedTargetElement']=_0x3ef757,this['_pinnedTargetChangeId']=_0x2e295b,_0x32948e[_0x502de0];if(void 0x0!==this['_pinnedRectIndex']&&this['_pinnedTargetChangeId']===_0x2e295b){if(_0x3ef757!==this['_pinnedTargetElement'])return Array['from'](this['_pinnedTargetElement']['getClientRects']())['reverse']()[this['_pinnedRectIndex']];return _0x32948e[this['_pinnedRectIndex']];}return void 0x0!==_0x502de0&&this['_pinnedTargetChangeId']!==_0x2e295b?(this['_pinnedRectIndex']=_0x502de0,this['_pinnedTargetElement']=_0x3ef757,this['_pinnedTargetChangeId']=_0x2e295b,_0x32948e[_0x502de0]):_0x3ef757['getBoundingClientRect']();}['_getPointedRectIndexFromEvent'](_0x37deae,_0x452611){if(_0x37deae)for(let _0x48c70b=0x0;_0x48c70b<_0x452611['length'];_0x48c70b++){const _0xb1f3af=_0x452611[_0x48c70b];if(_0x37deae['clientX']>=_0xb1f3af['left']-0x3&&_0x37deae['clientX']<=_0xb1f3af['right']+0x3&&_0x37deae['clientY']>=_0xb1f3af['top']-0x3&&_0x37deae['clientY']<=_0xb1f3af['bottom']+0x3)return _0x48c70b;}}['_isPinnedRectVisible'](_0x4a0015,_0x2a3ad7,_0x102214){const _0x380f31=new dt(_0x4a0015),_0x1ef4cc=_0x2a3ad7||document['documentElement'],_0x3439fa=_0x380f31['getIntersection'](Ot(_0x102214)),_0x1604f3=new dt(_0x1ef4cc)['getIntersection'](_0x380f31);return!!(_0x3439fa&&_0x1604f3&&_0x380f31['width']>0x0);}}const Jn=['getReviewCheckList','runReviewCheck','abortReviewStream','toggleDiff','acceptAllChanges','leaveReviewCoreResultList','activateChange','deactivateChange','acceptChange','dismissChange','learnMore','finishReview','retryReview'];class AIReviewCoreUI extends _0x533560{['_mainView'];['_balloonSuggestionView'];['_bodyCollection'];static get['requires'](){return[AITabs];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x317ecd){super(_0x317ecd),this['_bodyCollection']=new Xt(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_mainView']=this['createMainView'](),this['_mainView']['delegate'](...Jn)['to'](this),this['_balloonSuggestionView']=new AIReviewCoreBalloonSuggestionItemView(this['context']['locale'],this['_bodyCollection']),this['_balloonSuggestionView']['delegate']('acceptChange','dismissChange','deactivateChange')['to'](this);}['init'](){const _0x2288d6=this['context']['plugins']['get']('AITabs');this['registerTab'](_0x2288d6);}['destroy'](){this['_bodyCollection']['detachFromDom'](),super['destroy']();}['setAvailableChecks'](_0x31ff9f){if(!this['_mainView']['reviewCheckListView']['hasChecks']()){const _0x17887e=!this['context']['config']['get']('ai.models.showModelSelector');this['_mainView']['reviewCheckListView']['setChecks'](_0x31ff9f,_0x17887e);}this['_mainView']['showReviewCheckListView']();}['showReviewCheckList'](){this['fire']('getReviewCheckList');}['showCheckRunResults'](_0x195063){_0x195063&&('error-general'!==_0x195063['status']?'error-chunk'!==_0x195063['status']?this['_mainView']['showReviewCheckResultsView']():this['showChunkErrorView']():this['showGeneralResultsErrorView']());}['showCheckRunResult'](_0x3d271f){this['_mainView']['addCheckRunResult'](_0x3d271f);}['showGeneralResultsErrorView'](){this['_mainView']['showGeneralResultsErrorView']();}['showGeneralReviewCoreErrorView'](_0x2164ca){this['_mainView']['showGeneralReviewCoreErrorView'](_0x2164ca??Mi(this['context']['locale'],'AI_REVIEW_INITIALIZATION_ERROR_MESSAGE'));}['showChunkErrorView'](){this['_mainView']['showChunkErrorView']();}['setCheckResultTitle'](_0x2079db,_0x8118e8){this['_mainView']['reviewCheckResultsView']['setTitle'](_0x2079db,_0x8118e8);}['setActiveStateInResults'](_0x261cf4){this['_mainView']['reviewCheckResultsView']['getResults']()['forEach'](_0xf1cd10=>{_0xf1cd10['id']===_0x261cf4&&_0xf1cd10['setItemAsActive']();});}['resetActiveStateInResults'](){this['_mainView']['reviewCheckResultsView']['getResults']()['forEach'](_0x127c8e=>_0x127c8e['setItemAsInactive']());}['updateChangeState'](_0x20413e,_0xb38a98){'accepted'===_0xb38a98||'rejected'===_0xb38a98||'outdated'===_0xb38a98?this['_mainView']['reviewCheckResultsView']['hideResult'](_0x20413e,_0xb38a98):this['_mainView']['reviewCheckResultsView']['showResult'](_0x20413e,_0xb38a98);}['showReviewCompletedView'](){this['_mainView']['showReviewCompletedView']();}['showActionsWhenResultIsReady'](){this['_mainView']['showActionsWhenResultIsReady']();}['showNoChangesView'](){this['_mainView']['showNoChangesView']();}['hideActionsWhenResultIsReady'](){this['_mainView']['hideActionsWhenResultIsReady']();}['showChangeBalloon'](_0x362100,_0x38645b,_0x2abb81,_0x35805e,_0x333d86,_0x225482){this['_balloonSuggestionView']['showBalloon'](_0x362100,_0x38645b,_0x2abb81,_0x35805e,_0x333d86,_0x225482);}['hideChangeBalloon'](){this['_balloonSuggestionView']['hideBalloon']();}['hideDiffInBalloon'](){this['_balloonSuggestionView']['hideDiffInBalloon']();}['showDiffInBalloon'](){this['_balloonSuggestionView']['showDiffInBalloon']();}['getChangeElement'](_0x3f4814){const _0x260620=this['_mainView']['reviewCheckResultsView']['getResults']()['find'](_0x50cba3=>_0x50cba3['id']===_0x3f4814);return _0x260620?_0x260620['element']:null;}['deactivateChange'](){this['_balloonSuggestionView']['deactivateChange']();}}class AIReviewCoreGeneralErrorView extends Nt{constructor(_0x4b61eb){super(_0x4b61eb),this['set']('isVisible',!0x1),this['set']('errorMessage','');const _0x588c44=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai_review__general-error-container',_0x588c44['if']('isVisible','ck-hidden',_0x1c2dbc=>!_0x1c2dbc)]},'children':[{'tag':'p','attributes':{'class':'ck\x20ck-ai-notification\x20ck-ai-notification_error'},'children':[{'text':_0x588c44['to']('errorMessage')}]}]});}}class AIReviewCoreView extends Nt{['reviewCoreHeader'];['generalErrorView'];['reviewCheckListView'];['reviewCheckResultsView'];['reviewCompletedView'];constructor(_0x3d0bf3,_0x4513db){super(_0x3d0bf3),this['reviewCoreHeader']=_0x4513db['header'],this['generalErrorView']=new AIReviewCoreGeneralErrorView(_0x3d0bf3),this['reviewCheckListView']=_0x4513db['list'],this['reviewCheckListView']['delegate'](...Jn)['to'](this),this['reviewCheckResultsView']=_0x4513db['results'],this['reviewCheckResultsView']['delegate'](...Jn)['to'](this),this['reviewCompletedView']=_0x4513db['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'](_0x2c4487){this['reviewCheckResultsView']['addResult'](_0x2c4487),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'](_0x1f35dc){this['generalErrorView']['set']('isVisible',!0x0),this['generalErrorView']['errorMessage']=_0x1f35dc;}['showGeneralResultsErrorView'](){this['reviewCheckResultsView']['set']('isLoading',!0x1),this['showActionsWhenResultIsReady'](),this['reviewCheckResultsView']['showGeneralErrorMessage']();}['showChunkErrorView'](){this['reviewCheckResultsView']['set']('isLoading',!0x1),this['showActionsWhenResultIsReady'](),this['reviewCheckResultsView']['showChunkErrorMessage']();}}class AIReviewCoreFinishReviewButtonView extends yt{constructor(_0x4ee702,_0x13040c){super(_0x13040c),this['set']({'label':_0x4ee702,'withText':!0x0,'class':Ui}),this['on']('execute',()=>{this['fire']('finishReview');});}}class AIReviewCoreUICheckResultsView extends Ht{['_resultViews'];['_resultsHeader'];['_resultsBody'];['reviewDisclaimer'];['_cancelButtonView'];['_acceptAllButtonView'];['_exitReviewButtonView'];['_toggleDiffButtonView'];['_errorMessageView'];['_finishReviewButtonView'];['_contents'];constructor(_0x4edd48,_0x10d487){super(_0x4edd48),this['_contents']=_0x10d487,this['_resultViews']=new _0x327646(),this['_cancelButtonView']=this['_createCancelButtonView'](),this['_acceptAllButtonView']=this['_createAcceptAllButtonView'](),this['_exitReviewButtonView']=this['_createExitReviewButtonView'](),this['_toggleDiffButtonView']=this['_createToggleDiffButtonView'](),this['_finishReviewButtonView']=this['_createFinishReviewButtonView'](),this['_resultsHeader']=this['_createResultHeaderView'](),this['_resultsBody']=this['_createResultsBodyView'](),this['_errorMessageView']=this['_createErrorView'](),this['reviewDisclaimer']=new AIDisclaimerView(_0x4edd48),this['set']('isLoading',!0x1),this['set']('isToggleDiffOn',!0x1),this['set']('isResultReady',!0x1),this['set']('headerTitle',''),this['set']('headerSubtitle',''),this['set']('isError',!0x1),this['set']('showErrorMessage',!0x1),this['set']('errorType','general'),this['set']('isCompleted',!0x1);const _0x377977=this['_createCombinedSkeletonLoader'](),_0x351393=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run',_0x351393['if']('isLoading','ck-ai_review__check-run_loading',_0x232350=>_0x232350),_0x351393['if']('isResultReady','ck-ai_review__check-run_ready',_0x32ee46=>_0x32ee46),_0x351393['if']('isVisible','ck-hidden',_0x47d1b9=>!_0x47d1b9)]},'children':[this['_resultsHeader'],this['_errorMessageView'],this['_resultsBody'],_0x377977,this['reviewDisclaimer']]});}['clearResults'](){this['_resultViews']['clear'](),this['_resultsBody']['element']&&(this['_resultsBody']['element']['scrollTop']=0x0);}['getResults'](){return this['_resultViews'];}['addResult'](_0x1964de){const _0xd2d2f9=new AIReviewCoreReviewCheckListItemResultsView(this['locale'],_0x1964de['id']);_0xd2d2f9['delegate']('acceptChange','dismissChange','activateChange','deactivateChange')['to'](this),this['_resultViews']['add'](_0xd2d2f9),_0xd2d2f9['resultResponseView']['element']['innerHTML']=_0x1964de['contentDiffed'];}['hideResult'](_0x27d5b3,_0x2833c6){if('pending'===_0x2833c6)return;const _0xcd7df4=this['_resultViews']['find'](_0x5504de=>_0x5504de['id']===_0x27d5b3);_0xcd7df4&&(_0xcd7df4['status']=_0x2833c6,_0xcd7df4['element']?.['classList']['add']('ck-ai_review__check-run-result_grayout'));}['showResult'](_0x5e362c,_0x296cd1){if('pending'!==_0x296cd1)return;const _0x253cbd=this['_resultViews']['find'](_0x55a09b=>_0x55a09b['id']===_0x5e362c);_0x253cbd&&(_0x253cbd['status']=_0x296cd1,_0x253cbd['element']?.['classList']['remove']('ck-ai_review__check-run-result_grayout'));}['setTitle'](_0x640d45,_0x2768d9){this['headerTitle']=_0x640d45,this['headerSubtitle']=_0x2768d9||'';}['showChunkErrorMessage'](){this['errorType']='chunk',this['showErrorMessage']=!0x0;}['showGeneralErrorMessage'](){this['isError']=!0x0,this['errorType']='general',this['showErrorMessage']=!0x0;}['resetErrorState'](){this['isError']=!0x1,this['errorType']='general',this['showErrorMessage']=!0x1;}['_createSkeletonLoader'](){return new AISkeletonView(this['locale'],xs['aiReviewChecks']);}['_createCombinedSkeletonLoader'](){const _0x5a5656=new Nt(this['locale']),_0x3948d2=[];for(let _0x561cb3=0x0;_0x561cb3<0x10;_0x561cb3++){const _0x3f9c06=this['_createSkeletonLoader']();_0x3f9c06['extendTemplate']({'attributes':{'class':['ck-ai_review__check-run-skeleton-item']}}),_0x3948d2['push'](_0x3f9c06);}return _0x5a5656['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-skeleton-container',this['bindTemplate']['if']('isLoading','ck-hidden',_0x142b64=>!_0x142b64)]},'children':_0x3948d2}),_0x5a5656;}['_createResultsBodyView'](){const _0x196363=new Nt(this['locale']);return _0x196363['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-container','ck-reset_all-excluded',this['bindTemplate']['if']('isLoading','ck-hidden',_0x5bce64=>_0x5bce64)]},'children':this['_resultViews']}),_0x196363;}['_createErrorView'](){const _0x438d61=new Nt(this['locale']),_0x12fa9b=new yt(this['locale']),t=this['locale']['t'];return _0x438d61['delegate']('retryReview')['to'](this),_0x12fa9b['set']({'label':t('Try\x20again'),'withText':!0x0,'class':Bi+'\x20ck-ai_review__check-run-error-retry-button'}),_0x12fa9b['on']('execute',()=>{this['fire']('retryReview');}),_0x438d61['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-error-container',this['bindTemplate']['if']('showErrorMessage','ck-hidden',_0x22871d=>!_0x22871d),this['bindTemplate']['if']('errorType','ck-ai_review__check-run-error-container_border-bottom',_0x3978f0=>'chunk'===_0x3978f0)]},'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',_0x1cd6e7=>'chunk'===_0x1cd6e7)]},'children':[{'tag':'p','attributes':{'class':['ck-ai-notification__content',this['bindTemplate']['if']('errorType','ck-hidden',_0x34ca88=>'general'!==_0x34ca88)]},'children':[{'text':this['_contents']['generalErrorText']}]},{'tag':'p','attributes':{'class':['ck-ai-notification__content',this['bindTemplate']['if']('errorType','ck-hidden',_0x19003b=>'chunk'!==_0x19003b)]},'children':[{'text':Mi(this['locale'],'AI_REVIEW_MODE_CHUNK_ERROR_MESSAGE')}]}]},_0x12fa9b]}),_0x438d61;}['_createCancelButtonView'](){const _0xc013da=new yt(this['locale']);return _0xc013da['set']({'label':Mi(this['locale'],'AI_REVIEW_MODE_STOP_GENERATING'),'withText':!0x0,'class':[Bi+'\x20ck-ai-button-stop-generating'],'icon':_0x50911a}),_0xc013da['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isResultReady','ck-hidden',_0x46ee19=>_0x46ee19),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x1ebc91=>_0x1ebc91)]}}),_0xc013da['on']('execute',()=>{this['fire']('abortReviewStream');}),_0xc013da;}['_createToggleDiffButtonView'](){const _0x38d177=new yt(this['locale']);_0x38d177['set']({'tooltip':!0x0,'isToggleable':!0x0,'role':'menuitemcheckbox'}),_0x38d177['bind']('isEnabled')['to'](this,'isError',_0x4f9e11=>!_0x4f9e11),_0x38d177['extendTemplate']({'attributes':{'class':[Bi,'ck-ai_review__check-run-toggle-diff-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x5e373a=>!_0x5e373a),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x3b8516=>_0x3b8516)]}});const _0xfb5797=Mi(this['locale'],'AI_REVIEW_MODE_HIDE_CHANGES'),_0x51a066=Mi(this['locale'],'AI_REVIEW_MODE_SHOW_CHANGES');return _0x38d177['bind']('isOn')['to'](this,'isToggleDiffOn',_0x92e9da=>_0x92e9da),_0x38d177['bind']('icon')['to'](this,'isToggleDiffOn',_0x1b7e54=>_0x1b7e54?nt:rt),_0x38d177['bind']('label')['to'](this,'isToggleDiffOn',_0x5d6e19=>_0x5d6e19?_0xfb5797:_0x51a066),_0x38d177['on']('execute',()=>{this['isToggleDiffOn']=!this['isToggleDiffOn'],this['fire']('toggleDiff',{'on':this['isToggleDiffOn']});}),_0x38d177;}['_createAcceptAllButtonView'](){const _0x4954f2=new yt(this['locale']);return _0x4954f2['set']({'label':Mi(this['locale'],'AI_REVIEW_MODE_ACCEPT_ALL'),'withText':!0x0}),_0x4954f2['bind']('isEnabled')['to'](this,'isError',_0x5e18f9=>!_0x5e18f9),_0x4954f2['extendTemplate']({'attributes':{'class':[Ui,'ck-ai_review__check-run-accept-all-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x280370=>!_0x280370),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x533daa=>_0x533daa)]}}),_0x4954f2['on']('execute',()=>{this['fire']('acceptAllChanges');}),_0x4954f2;}['_createExitReviewButtonView'](){const _0x106cf2=new yt(this['locale']);return _0x106cf2['set']({'label':Mi(this['locale'],'AI_REVIEW_MODE_EXIT_REVIEW'),'withText':!0x0}),_0x106cf2['extendTemplate']({'attributes':{'class':[Gi,'ck-ai_review__check-run-exit-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x1b9b86=>!_0x1b9b86),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x32fa3c=>_0x32fa3c)]}}),_0x106cf2['on']('execute',()=>{this['fire']('leaveReviewCoreResultList');}),_0x106cf2;}['_createResultHeaderView'](){const _0x334ddf=new Nt(this['locale']),_0x6fe99=this['_createTitleView']();return _0x334ddf['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header',this['bindTemplate']['if']('isCompleted','ck-ai_review__review-completed-header',_0x3856b3=>_0x3856b3)]},'children':[_0x6fe99,{'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header-buttons']},'children':[this['_cancelButtonView'],this['_acceptAllButtonView'],this['_exitReviewButtonView'],this['_toggleDiffButtonView'],this['_finishReviewButtonView']]}]}),_0x334ddf;}['_createTitleView'](){const _0x384e76=new Nt(this['locale']),_0x17a2ea=new AISpinnerView();return _0x17a2ea['bind']('isVisible')['to'](this,'isResultReady',_0x5dc44e=>!_0x5dc44e),_0x384e76['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header-title-wrapper']},'children':[_0x17a2ea,{'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header-title-content',this['bindTemplate']['if']('isCompleted','ck-hidden',_0x87ae51=>_0x87ae51)]},'children':[{'tag':'span','attributes':{'class':['ck-ai_review__check-run-results-header-title']},'children':[{'text':this['bindTemplate']['to']('headerTitle')}]},{'tag':'span','attributes':{'class':['ck-ai_review__check-run-results-header-subtitle']},'children':[{'text':this['bindTemplate']['to']('headerSubtitle')}]}]},{'tag':'span','attributes':{'class':['ck-ai_review__review-completed-header-title',this['bindTemplate']['if']('isCompleted','ck-hidden',_0x888568=>!_0x888568)]},'children':[{'text':Mi(this['locale'],'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE')}]}]}),_0x384e76;}['_createFinishReviewButtonView'](){const _0x2f5f4e=new AIReviewCoreFinishReviewButtonView(Mi(this['locale'],'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL'),this['locale']);return _0x2f5f4e['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isCompleted','ck-hidden',_0xb9690a=>!_0xb9690a)]}}),_0x2f5f4e['delegate']('finishReview')['to'](this),_0x2f5f4e;}}class AIReviewCoreReviewCompletedView extends Ht{['_resultsHeader'];['_finishReviewButtonView'];constructor(_0x87a14a,_0x7f8f9d){super(_0x87a14a),this['_finishReviewButtonView']=this['_createFinishReviewButtonView'](_0x7f8f9d['buttonText']),this['_resultsHeader']=this['_createResultHeaderView'](_0x7f8f9d['headerText']);const _0x9ddc92=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__review-completed',_0x9ddc92['if']('isVisible','ck-hidden',_0x59600f=>!_0x59600f)]},'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':_0x7f8f9d['emptyResultsText']}]}]}]});}['_createFinishReviewButtonView'](_0x2b6ad4){const _0x10c789=new AIReviewCoreFinishReviewButtonView(_0x2b6ad4,this['locale']);return _0x10c789['delegate']('finishReview')['to'](this),_0x10c789;}['_createResultHeaderView'](_0x469f87){const _0x29a380=new Nt(this['locale']);return _0x29a380['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__review-completed-header']},'children':[{'tag':'span','attributes':{'class':['ck-ai_review__review-completed-header-title']},'children':[{'text':_0x469f87}]},{'tag':'div','attributes':{'class':['ck-ai_review__review-completed-header-buttons']},'children':[this['_finishReviewButtonView']]}]}),_0x29a380;}}class AIReviewCoreFormDropdownView extends Nt{['_dropdownView'];['_defaultValue'];['_defaultLabel'];constructor(_0x470b6d,_0x298b20){super(_0x470b6d),this['_defaultValue']=_0x298b20['default']||(_0x298b20['data']['length']>0x0?_0x298b20['data'][0x0]['id']:''),this['_defaultLabel']=_0x298b20['data']['find'](_0x235cc1=>_0x235cc1['id']===this['_defaultValue'])?.['label']||'',this['set']('formValue',''),this['_dropdownView']=Ft(this['locale']);const _0x3bdf35=this['_prepareListOptions'](_0x298b20['data']);Jt(this['_dropdownView'],_0x3bdf35,{'role':'menu','ariaLabel':_0x298b20['label']}),this['_dropdownView']['buttonView']['set']({'label':this['_defaultLabel'],'withText':!0x0}),this['_dropdownView']['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x3b32f2=>{_0x3b32f2['stopPropagation']();})}}),this['listenTo'](this['_dropdownView'],'execute',_0xc77d3a=>{this['formValue']=_0xc77d3a['source']['model']['id'],this['_dropdownView']['buttonView']['label']=_0xc77d3a['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'](_0x5a6942=[]){const _0x338ed7=new _t();this['resetToDefault']();for(const _0x14df8c of _0x5a6942){const _0x137d97=new Zt({'label':_0x14df8c['label'],'withText':!0x0,'role':'menuitemradio','id':_0x14df8c['id'],'model':_0x14df8c});_0x137d97['bind']('isOn')['to'](this,'formValue',_0x486b9a=>_0x486b9a===_0x137d97['id']);const _0x26abe2={'type':'button','model':_0x137d97};_0x338ed7['add'](_0x26abe2);}return _0x338ed7;}}class AIReviewCoreFormManagerView extends Ht{['_formItem']=null;constructor(_0x58882a,_0x18d372,_0x19b194){super(_0x58882a),this['argsKey']=_0x18d372?.['argsKey'];if('dropdown'===_0x18d372['formType'])this['_formItem']=new AIReviewCoreFormDropdownView(this['locale'],_0x18d372);this['set']('value',''),this['bind']('value')['to'](this['_formItem'],'formValue');const _0x51d9d2=new _0x311470(this['locale'],{'children':[this['_formItem']],'class':[_0x19b194?'ck-form__row_with-submit':'']});_0x19b194&&_0x51d9d2['children']['add'](_0x19b194),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai_review__form-item','ck-reset_all']},'children':[_0x51d9d2]});}['resetToDefault'](){this['_formItem']['resetToDefault']();}}class AIReviewCorePromptInputView extends _0x1b1dd4{['keystrokes'];static ['MIN_ROWS']=0x1;static ['MAX_ROWS']=0xc;constructor(_0x20f25a){super(_0x20f25a),this['set']('isEmpty',!0x0),this['keystrokes']=new At(),this['minRows']=AIReviewCorePromptInputView['MIN_ROWS'],this['maxRows']=AIReviewCorePromptInputView['MAX_ROWS'],this['extendTemplate']({'attributes':{'id':'ai-review-prompt-input','class':['ck','ck-review__prompt-input']}});}['render'](){super['render'](),this['on']('update',()=>{this['isEmpty']=''===this['element']['value']?.['trim']();}),this['keystrokes']['listenTo'](this['element']);}}class AIReviewCoreCustomCheckView extends Nt{['focusTracker']=new It();['keystrokes']=new At();['focusCycler'];['_focusables']=new _0x327646();['submitButtonView'];['cancelButtonView'];['promptInputView'];['actionsFooterView'];['_modelSelectionDropdown'];['_modelNameView'];['_modelSelectionDropdownItems'];['_check'];['_defaultValue'];['_defaultLabel'];constructor(_0xe64c3b,_0x4d8fdc,_0x502869=!0x1){super(_0xe64c3b),this['_check']=_0x4d8fdc,this['set']('prompt',''),this['set']('modelId',''),this['set']('modelDisplayMode','selector'),this['set']('activeModelName',null),this['_defaultValue']=_0x4d8fdc['defaultModel']?_0x4d8fdc['defaultModel']['id']:'',this['_defaultLabel']=_0x4d8fdc['defaultModel']?_0x4d8fdc['defaultModel']['name']:'',this['submitButtonView']=this['_createSubmitButtonView'](),this['cancelButtonView']=this['_createCancelButtonView'](),(this['promptInputView']=new _0x3d6c8e(this['locale'],()=>new AIReviewCorePromptInputView(_0xe64c3b)),this['promptInputView']['fieldView']['bind']('value')['to'](this,'prompt'),this['promptInputView']['fieldView']['on']('input',()=>{this['prompt']=this['promptInputView']['fieldView']['element']['value'];}),this['_modelSelectionDropdown']=this['_createModelSelectionDropdown'](),this['_modelSelectionDropdownItems']=new _t(),this['_modelNameView']=this['_createModelNameView'](),this['_setModelList'](_0x502869),Jt(this['_modelSelectionDropdown'],this['_modelSelectionDropdownItems']),this['actionsFooterView']=this['_createActionsFooterView'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-custom-actions']},'children':[new _0x311470(this['locale'],{'children':[this['promptInputView']]}),new _0x311470(this['locale'],{'children':[this['actionsFooterView']]})]}),this['promptInputView']['fieldView']['keystrokes']['set']('Enter',(_0x4be123,_0x5d072a)=>{this['_isValid']()?(this['fire']('runReviewCheck',{'id':'custom','args':{'prompt':this['prompt'],'model':this['modelId']},'isCustom':!0x0}),_0x5d072a()):_0x5d072a();}),this['focusCycler']=new Ut({'focusables':this['_focusables'],'focusTracker':this['focusTracker'],'keystrokeHandler':this['keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}));}['render'](){super['render'](),([this['promptInputView'],this['_modelSelectionDropdown'],this['cancelButtonView'],this['submitButtonView']]['forEach'](_0xc68f24=>{this['_focusables']['add'](_0xc68f24),this['focusTracker']['add'](_0xc68f24['element']);}),this['keystrokes']['listenTo'](this['element']));}get['modelDefaultValue'](){return this['_defaultValue'];}get['modelDefaultLabel'](){return this['_defaultLabel'];}['resetToDefault'](){this['prompt']='',this['modelId']=this['modelDefaultValue'],this['_modelSelectionDropdown']['buttonView']['label']=this['modelDefaultLabel'],this['resetFormValidationStatus']();}['resetFormValidationStatus'](){this['promptInputView']['errorText']='';}['_isValid'](){this['resetFormValidationStatus']();for(const _0x1743a3 of this['_getFormValidators']()){const _0x18d019=_0x1743a3();if(_0x18d019)return this['promptInputView']['errorText']=_0x18d019,!0x1;}return!0x0;}['_getFormValidators'](){return[()=>{if(0x0===this['promptInputView']['fieldView']['value']?.['trim']()['length'])return Mi(this['locale'],'AI_REVIEW_MODE_PROMPT_EMPTY_ERROR');}];}['_createSubmitButtonView'](){const _0x1a6ecc=new yt(this['locale']),t=this['locale']['t'];return _0x1a6ecc['set']({'label':t('Submit'),'withText':!0x0,'class':Ui}),_0x1a6ecc['on']('execute',()=>{this['_isValid']()&&this['fire']('runReviewCheck',{'id':'custom','args':{'prompt':this['prompt'],'model':this['modelId']},'isCustom':!0x0});}),_0x1a6ecc;}['_createCancelButtonView'](){const _0x39f082=new yt(this['locale']),t=this['locale']['t'];return _0x39f082['set']({'label':t('Cancel'),'withText':!0x0,'class':Gi}),_0x39f082['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x1b4dce=>{_0x1b4dce['stopPropagation']();})}}),_0x39f082['on']('execute',()=>{this['resetToDefault'](),this['fire']('closeCustomCheck');}),_0x39f082;}['_setModelList'](_0x273e39){this['_modelSelectionDropdownItems']['clear']();const _0x173384=this['_check']['models'];if(_0x273e39)this['set']('modelDisplayMode','hidden');else{const _0x3490b7=0x1===_0x173384['length'];this['set']('modelDisplayMode',_0x3490b7?'name':'selector');}if(this['resetToDefault'](),_0x173384?.['length']){0x1===_0x173384['length']&&this['set']('activeModelName',_0x173384[0x0]['name']||_0x173384[0x0]['id']);for(const _0x209670 of _0x173384){const _0x893130=new Zt({'label':_0x209670['name'],'withText':!0x0,'role':'menuitemradio','id':_0x209670['id'],'model':_0x209670});_0x893130['bind']('isOn')['to'](this,'modelId',_0x6715d4=>_0x6715d4===_0x209670['id']),this['_modelSelectionDropdownItems']['add']({'type':'button','model':_0x893130,'labelView':new ModelButtonLabelView(this['locale'],_0x209670)});}}}['_createModelSelectionDropdown'](){const _0x245e31=Ft(this['locale']);return _0x245e31['set']({'panelPosition':'se','class':'ck-ai_review__check-list-item-model-dropdown'}),_0x245e31['buttonView']['set']({'label':this['_defaultLabel'],'withText':!0x0,'tooltip':!0x0,'class':Gi}),_0x245e31['buttonView']['bind']('isVisible')['to'](this,'modelDisplayMode',_0x360a6f=>'selector'===_0x360a6f),this['listenTo'](_0x245e31,'execute',_0x382a9a=>{this['modelId']=_0x382a9a['source']['model']['id'],_0x245e31['buttonView']['label']=_0x382a9a['source']['label'];}),_0x245e31;}['_createModelNameView'](){const _0x4f1829=new ModelNameView(this['locale']);return _0x4f1829['bind']('text')['to'](this,'activeModelName',_0x10be43=>_0x10be43??''),_0x4f1829['bind']('isVisible')['to'](this,'modelDisplayMode',_0x57b5dd=>'name'===_0x57b5dd),_0x4f1829;}['_createActionsFooterView'](){const _0x5dfbf7=new Nt(this['locale']);return _0x5dfbf7['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-custom-actions-footer']},'children':[this['_modelSelectionDropdown'],this['_modelNameView'],{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized-custom-actions-buttons']},'children':[this['cancelButtonView'],this['submitButtonView']]}]}),_0x5dfbf7;}}class ModelNameView extends Nt{constructor(_0x40ced9){super(_0x40ced9),this['set']('text',void 0x0),this['set']('isVisible',!0x0);const _0x2be009=this['bindTemplate'];this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai_review__check-list-item-model-name',_0x2be009['if']('isVisible','ck-hidden',_0x58fa3c=>!_0x58fa3c)]},'children':[{'text':_0x2be009['to']('text')}]});}}class ModelButtonLabelView extends Mt{constructor(_0x5a625c,_0x3fd3ef){super();const _0xbe277d=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-button__label'],'style':_0xbe277d['to']('style'),'id':_0xbe277d['to']('id')},'children':[{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-model-dropdown-name']},'children':[{'tag':'span','children':[{'text':_0xbe277d['to']('text')}]}]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-model-dropdown-description']},'children':[{'tag':'span','children':[_0x3fd3ef['description']||'']}]}]});}}class AIReviewCoreReviewCommandListItemView extends Ht{['_formItemsCollection']=new _0x327646();['_customCheckView']=null;['_hideModels']=!0x1;constructor(_0x48468a,_0x1ee225,_0x3eabbb,_0x3e02e7=!0x1){super(_0x48468a),this['_hideModels']=_0x3e02e7,this['set']('isParametrizedViewOpen',!0x1),this['set']('isListItemRendered',!0x1),this['set']('isItemParametrized',_0x1ee225['isParameterized']);const _0x22c56c=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',_0x326278=>_0x326278),this['bindTemplate']['if']('isListItemRendered','ck-ai_review__check-list-item_rendered',_0x51ed31=>_0x51ed31)],'style':{'--ck-ai-review-check-list-item-index':_0x3eabbb}},'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':_0x1ee225['title']}]},_0x22c56c]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-description']},'children':_0x1ee225['description']?[{'text':_0x1ee225['description']}]:[]}]}]},..._0x1ee225['isParameterized']?[this['_createParameterizedView'](_0x1ee225)]:[],...'custom'===_0x1ee225['id']?[this['_createCustomView'](_0x1ee225,this['_hideModels'])]:[]]}),this['on']('click',()=>{_0x1ee225['isParameterized']?this['isParametrizedViewOpen']=!0x0:this['fire']('runReviewCheck',{'id':_0x1ee225['id'],'args':_0x1ee225['useArgs']?_0x1ee225['args']:void 0x0});}),requestAnimationFrame(()=>{this['isListItemRendered']=!0x0;});}['render'](){super['render'](),this['isItemParametrized']&&jt({'emitter':this,'activator':()=>!0x0===this['isParametrizedViewOpen'],'contextElements':[this['element']],'callback':()=>{this['isParametrizedViewOpen']=!0x1;}});}['resetToDefault'](){this['isParametrizedViewOpen']=!0x1,this['_formItemsCollection']['forEach'](_0x34be2f=>{_0x34be2f['resetToDefault']();}),this['_customCheckView']&&this['_customCheckView']['resetToDefault']();}['_createIconView'](){const _0x56879e=new Lt();return _0x56879e['content']=ot,_0x56879e['extendTemplate']({'attributes':{'class':['ck-ai_review__check-list-item-title-icon']}}),_0x56879e;}['_createParameterizedView'](_0x36214d){const _0x4ec152=new Nt(),_0x171d69=this['_createFormView'](_0x36214d);return _0x4ec152['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized',this['bindTemplate']['if']('isParametrizedViewOpen','ck-hidden',_0x42d845=>!_0x42d845)]},'children':[_0x171d69]}),_0x4ec152;}['_createFormView'](_0x132fb6){const _0x210e73=new Nt(),_0xeb0594=Array['isArray'](_0x132fb6['options'])?_0x132fb6['options']:[],_0x39d4f8=new yt(this['locale']),t=this['locale']['t'];_0x39d4f8['set']({'label':t('Submit'),'withText':!0x0,'class':Ui}),_0x39d4f8['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x17cc2f=>{_0x17cc2f['stopPropagation']();})}}),_0x39d4f8['on']('execute',()=>{const _0x1a750f=[],_0x2656e9={};this['_formItemsCollection']['forEach'](_0x411628=>{_0x1a750f['push'](_0x411628['value']),_0x132fb6['useArgs']&&_0x132fb6['options']&&(_0x2656e9[_0x411628['argsKey']]=_0x411628['value']);}),this['fire']('runReviewCheck',{'id':_0x132fb6['id'],'params':_0x1a750f['length']?_0x1a750f:void 0x0,'args':Object['keys'](_0x2656e9)['length']?_0x2656e9:void 0x0});});const _0x6a172e=_0xeb0594['length'];return _0xeb0594['forEach']((_0x14ff6d,_0x37e4e9)=>{const _0x3d86cd=_0x37e4e9===_0x6a172e-0x1;this['_formItemsCollection']['add'](new AIReviewCoreFormManagerView(this['locale'],_0x14ff6d,_0x3d86cd?_0x39d4f8:null));}),_0x210e73['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized-form']},'children':this['_formItemsCollection']}),_0x210e73;}['_createCustomView'](_0x37a550,_0x34be25=!0x1){return this['_customCheckView']=new AIReviewCoreCustomCheckView(this['locale'],_0x37a550,_0x34be25),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',_0x5842b6=>!_0x5842b6)]}}),this['_customCheckView']['delegate']('runReviewCheck')['to'](this),this['listenTo'](this['_customCheckView'],'closeCustomCheck',()=>{this['isParametrizedViewOpen']=!0x1;}),this['on']('change:isParametrizedViewOpen',(_0xb8a947,_0x59627d,_0x20824c)=>{_0x20824c||this['_customCheckView']['resetFormValidationStatus']();}),this['_customCheckView'];}}class AIReviewCoreReviewCheckListView extends Ht{['_checkViews'];constructor(_0x4fe251){super(_0x4fe251),this['_checkViews']=new _0x327646(),this['_setupTemplate']();}['setChecks'](_0x4d8132,_0x435d62=!0x1){this['_checkViews']['clear']();for(const [_0xe8eb00,_0x14afab]of _0x4d8132['entries']()){const _0x2b9160=new AIReviewCoreReviewCommandListItemView(this['locale'],_0x14afab,_0xe8eb00,_0x435d62);_0x2b9160['delegate']('runReviewCheck')['to'](this),this['_checkViews']['add'](_0x2b9160);}}['hasChecks'](){return this['_checkViews']['length']>0x0;}['resetAllParameterizedChecks'](){for(const _0x2b8a3a of this['_checkViews'])_0x2b8a3a instanceof AIReviewCoreReviewCommandListItemView&&_0x2b8a3a['resetToDefault']();}['_setupTemplate'](){const _0x4c4827=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list',_0x4c4827['if']('isVisible','ck-hidden',_0x11b931=>!_0x11b931)]},'children':this['_checkViews']});}}class AIReviewModeUI extends AIReviewCoreUI{static get['pluginName'](){return'AIReviewModeUI';}['createMainView'](){const _0x815dcf=this['context']['plugins']['get']('AITabs'),_0x5abed1=this['context']['locale'],_0x4a3ca8=new AIHeaderView(_0x5abed1,{'label':Mi(_0x5abed1,'AI_REVIEW_MODE'),'icon':_0x402120,'class':'ck-ai-header_review','showResizeButton':_0x815dcf['showResizeButton']});return _0x4a3ca8['delegate']('resizeTabs')['to'](_0x815dcf),_0x4a3ca8['bind']('isMaximized')['to'](_0x815dcf['view'],'isMaximized',_0x2d05fe=>_0x2d05fe),new AIReviewCoreView(this['context']['locale'],{'header':_0x4a3ca8,'list':new AIReviewCoreReviewCheckListView(_0x5abed1),'results':new AIReviewCoreUICheckResultsView(_0x5abed1,{'generalErrorText':Mi(_0x5abed1,'AI_REVIEW_MODE_GENERAL_ERROR_MESSAGE')}),'completed':new AIReviewCoreReviewCompletedView(_0x5abed1,{'headerText':Mi(_0x5abed1,'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE'),'emptyResultsText':Mi(_0x5abed1,'AI_REVIEW_MODE_EMPTY_RESULTS_TEXT'),'buttonText':Mi(_0x5abed1,'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL')})});}['registerTab'](){const _0x2403c4=this['context']['plugins']['get']('AITabs');_0x2403c4['view']['on']('activateTab',(_0x427bab,{newTab:_0x34f871,oldTab:_0x13bfcf})=>{'reviewMode'===_0x34f871?this['fire']('getReviewCheckList'):'reviewMode'===_0x13bfcf&&this['fire']('leaveReview');}),_0x2403c4['view']['addTab']({'id':'reviewMode','buttonLabel':Mi(this['context']['locale'],'AI_REVIEW_MODE'),'buttonIcon':_0x402120,'order':0x0,'content':this['_mainView']});}}const Zn='review-',tr=['softBreak'],er=['htmlScript','htmlStyle','htmlCustomElement'];class AIReviewCoreEditing extends _0x533560{static get['requires'](){return[_0x4fc25b,AIEditing];}static get['pluginName'](){return'AIReviewCoreEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['_markers']=new Map();['_activeMarkers']=new Set();['_domEmitter'];['_eventEmitter'];['_reviewEditingAttachedEditors']=new WeakSet();['_boundEditables']=new WeakMap();constructor(_0x5517f2){super(_0x5517f2),this['_domEmitter']=new(vt())(),this['_eventEmitter']=new(Et())();}get['emitter'](){return this['_eventEmitter'];}['afterInit'](){const _0x6833f0=_0x5f593d=>this['_scheduleAttachReviewEditingToEditor'](_0x5f593d);if(this['_registerGlobalBalloonBlurHandler'](),this['context']instanceof _0x20c128)return void _0x6833f0(this['context']);const _0x1d6f03=this['context'];for(const _0xeb2e57 of _0x1d6f03['editors'])_0x6833f0(_0xeb2e57);this['listenTo'](_0x1d6f03['editors'],'add',(_0x369a7c,_0x4b8035)=>{_0x6833f0(_0x4b8035);}),this['listenTo'](_0x1d6f03['editors'],'remove',(_0x3fb57f,_0x47498a)=>{for(const [_0xb1524,_0x3d6c25]of this['_markers'])_0x3d6c25['editor']===_0x47498a&&(this['_eventEmitter']['fire']('changeMarkerRemoved',{'markerId':_0xb1524,'changeId':_0x3d6c25['groupId']}),this['_markers']['delete'](_0xb1524));});}['_scheduleAttachReviewEditingToEditor'](_0x30d4a7){const _0xeb38a6=()=>{'destroyed'!==_0x30d4a7['state']&&_0x30d4a7['conversion']&&this['_attachReviewEditingToEditor'](_0x30d4a7);};if('ready'===_0x30d4a7['state'])return void _0xeb38a6();const _0x568943=()=>{this['stopListening'](_0x30d4a7,'ready',_0x568943),_0xeb38a6();};this['listenTo'](_0x30d4a7,'ready',_0x568943);}['_attachReviewEditingToEditor'](_0x2b5d8d){this['_reviewEditingAttachedEditors']['has'](_0x2b5d8d)||(_0x2b5d8d['conversion']['for']('editingDowncast')['markerToElement']({'model':Zn+'insert','view':(_0x45ba59,{writer:_0x201668})=>{const _0x284604=this['_markers']['get'](_0x45ba59['markerName']),_0x36c6b4={'class':'ck-ai_review-marker_add'+(this['_activeMarkers']['has'](_0x284604?.['id']||'')?'\x20ck-ai_review__change_active':''),'data-marker-id':_0x45ba59['markerName']};return _0x201668['createUIElement']('span',_0x36c6b4,function(_0x107ca7){const _0x519d15=this['toDomElement'](_0x107ca7);return _0x519d15['innerHTML']=_0x284604?.['content']?.['asString']||'',_0x519d15;});}}),_0x2b5d8d['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Zn+'remove-only','view':_0x2a1526=>{const _0x1998c6=this['_markers']['get'](_0x2a1526['markerName']),_0x1c94a4=['ck-ai_review-marker_strikethrough'];return this['_activeMarkers']['has'](_0x1998c6?.['id']||'')&&_0x1c94a4['push']('ck-ai_review__change_active'),{'classes':_0x1c94a4,'attributes':{'data-marker-id':_0x2a1526['markerName']}};}}),_0x2b5d8d['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Zn+'remove-context','view':_0x4211bf=>{const _0x6c8900=this['_markers']['get'](_0x4211bf['markerName']),_0x4e52c9=['ck-ai_review-marker_underline'];return this['_activeMarkers']['has'](_0x6c8900?.['id']||'')&&_0x4e52c9['push']('ck-ai_review__change_active'),{'classes':_0x4e52c9,'attributes':{'data-marker-id':_0x4211bf['markerName']}};}}),_0x2b5d8d['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Zn+'remove-text','view':_0x56d610=>{const _0x714bf0=this['_markers']['get'](_0x56d610['markerName']),_0x191e60=['ck-ai_review-marker_hide'];return this['_activeMarkers']['has'](_0x714bf0?.['id']||'')&&_0x191e60['push']('ck-ai_review__change_active'),{'classes':_0x191e60,'attributes':{'data-marker-id':_0x56d610['markerName']}};}}),_0x2b5d8d['conversion']['for']('dataDowncast')['markerToElement']({'model':Zn+'suggestion-context','view':(_0x9b5095,{writer:_0x127f65})=>_0x127f65['createRawElement']('span',{'class':'ck-ai_review-marker_context-'+(_0x9b5095['isOpening']?'start':'end')})}),_0x2b5d8d['conversion']['for']('downcast')['attributeToAttribute']({'model':_0x4beb10,'view':_0x1f57b4}),this['_updateMouseMarkerInteractionListeners'](_0x2b5d8d),this['listenTo'](_0x2b5d8d,'addRoot',()=>this['_updateMouseMarkerInteractionListeners'](_0x2b5d8d),{'priority':'lowest'}),this['listenTo'](_0x2b5d8d,'detachRoot',()=>this['_updateMouseMarkerInteractionListeners'](_0x2b5d8d),{'priority':'lowest'}),_0x2b5d8d['model']['document']['registerPostFixer'](_0x146764=>this['_validateMarkers'](_0x2b5d8d,_0x146764)),_0x2b5d8d['model']['document']['on']('change',()=>this['_handleMarkerChanges'](_0x2b5d8d)),this['_reviewEditingAttachedEditors']['add'](_0x2b5d8d));}['_updateMouseMarkerInteractionListeners'](_0x1e8902){let _0xb5f2cf=this['_boundEditables']['get'](_0x1e8902);_0xb5f2cf||(_0xb5f2cf=new Map(),this['_boundEditables']['set'](_0x1e8902,_0xb5f2cf));const _0x8eb50b=new Set(_0x1e8902['ui']['getEditableElementsNames']());for(const _0x2139ba of _0x8eb50b){if(_0xb5f2cf['has'](_0x2139ba))continue;const _0x140478=_0x1e8902['ui']['getEditableElement'](_0x2139ba);_0xb5f2cf['set'](_0x2139ba,_0x140478),this['_attachMouseMarkerInteractionListeners'](_0x140478);}for(const [_0x427726,_0x33e11d]of _0xb5f2cf)_0x8eb50b['has'](_0x427726)||(_0xb5f2cf['delete'](_0x427726),this['_domEmitter']['stopListening'](_0x33e11d));}['_attachMouseMarkerInteractionListeners'](_0x2b44a1){this['_domEmitter']['listenTo'](_0x2b44a1,'mouseup',(_0x2acdf9,_0x311e5c)=>{const _0x21438d=_0x311e5c['target'],_0x395cdf=this['_findMarkerElement'](_0x21438d);if(!_0x395cdf)return;const _0x2fb92b=_0x395cdf['getAttribute']('data-marker-id'),_0x3b6207=_0x2fb92b['split'](':')['pop']()?.['split']('_')[0x0];this['_eventEmitter']['fire']('changeMarkerClicked',{'markerId':_0x2fb92b,'changeId':_0x3b6207,'markerElement':()=>this['_findMarkerElementById'](_0x2fb92b),'domEvent':_0x311e5c});},{'usePassive':!0x0,'priority':'highest'}),this['_domEmitter']['listenTo'](_0x2b44a1,'mouseover',(_0x5b33cf,_0x21dea4)=>{const _0x21ec36=_0x21dea4['target'],_0x60e488=_0x21dea4['relatedTarget'];let _0x323fc9=this['_findMarkerElement'](_0x21ec36);if(!_0x323fc9&&_0x60e488&&(_0x323fc9=this['_findMarkerElement'](_0x60e488)),!_0x323fc9)return;const _0x2feaef=_0x323fc9['getAttribute']('data-marker-id'),_0x1f8bdc=_0x2feaef['split'](':')['pop']()?.['split']('_')[0x0];this['_eventEmitter']['fire']('changeMarkerHovered',{'changeId':_0x1f8bdc,'markerElement':()=>this['_findMarkerElementById'](_0x2feaef),'domEvent':_0x21dea4});});}['_registerGlobalBalloonBlurHandler'](){this['_domEmitter']['listenTo'](document,'mouseover',_0x151e4e((_0x8df5b0,_0x236435)=>{const _0x16366d=_0x236435['target'];if(this['_findMarkerElement'](_0x16366d))return;_0x16366d['closest']('.ck-reset.ck-ai_review-balloon-panel-suggestion')||this['_eventEmitter']['fire']('changeMarkerBlurred');},0xc8));}['getDocumentData'](){const _0x586873=this['context']['plugins']['get']('AIEditing'),_0x4432e3=Cs(this['context']);if(!_0x4432e3['length'])throw new ht('ai-get-editor-from-context-no-editor',this);const _0xc61c1b=new Set(),_0x1ba28c=[],_0x2fe00a=new Map();for(const _0x3b9906 of _0x4432e3)for(const _0x91113 of _0x3b9906['model']['document']['getRoots']()){if('$graveyard'===_0x91113['rootName'])continue;const _0x433e90=this['_buildDocumentDataSliceForRoot'](_0x3b9906,_0x91113,_0x586873,_0xc61c1b);_0x1ba28c['push'](_0x433e90['content']);for(const [_0x2db4bf,_0x1cd34b]of _0x433e90['elements'])_0x2fe00a['set'](_0x2db4bf,_0x1cd34b);}return{'elements':_0x2fe00a,'content':_0x1ba28c['join']('')};}['_buildDocumentDataSliceForRoot'](_0x458981,_0x550634,_0x5beb6a,_0x2bee8a){const _0x351818=_0x458981['model'],_0x47be82=new _0x17914c();for(const _0x1ced4e of _0x550634['getChildren']())_0x47be82['_appendChild'](_0x1ced4e['_clone'](!0x0));for(const _0xf30209 of _0x351818['markers']){const _0x2dddd6=_0xf30209['getRange']();_0x2dddd6&&_0x2dddd6['root']['rootName']===_0x550634['rootName']&&_0x47be82['markers']['set'](_0xf30209['name'],this['_changeRangeOwnerDocument'](_0x2dddd6['clone'](),_0x47be82));}const _0x43b626=new Map(),_0x203c46=_0x351818['document']['version'],_0x772c78=new _0x432418({'ignoreElementEnd':!0x0,'startPosition':_0x351818['createPositionAt'](_0x47be82,0x0)});for(const {item:_0x20c3a7}of _0x772c78){if(_0x20c3a7['is']('element')&&_0x20c3a7['name']&&er['includes'](_0x20c3a7['name'])){const _0x586f71=this['_upsertDataId'](_0x20c3a7,()=>_0x5beb6a['_nextDataId'](_0x2bee8a));_0x2bee8a['add'](_0x586f71);}if(!_0x20c3a7['is']('$textProxy'))continue;const _0x5f2ff1=_0x20c3a7['parent'];if(!_0x5f2ff1||!_0x5f2ff1['is']('element'))continue;const _0x32de6b=this['_upsertDataId'](_0x5f2ff1,()=>_0x5beb6a['_nextDataId'](_0x2bee8a));_0x2bee8a['add'](_0x32de6b);for(const _0x547868 of _0x5f2ff1['getChildren']())_0x547868['is']('element')&&(_0x547868['name']&&tr['includes'](_0x547868['name'])||_0x2bee8a['add'](this['_upsertDataId'](_0x547868,()=>_0x5beb6a['_nextDataId'](_0x2bee8a))));let _0x32481c=_0x5f2ff1;for(;_0x32481c['parent']&&!_0x32481c['parent']['is']('documentFragment');)_0x32481c=_0x32481c['parent'],_0x32481c['hasAttribute'](_0x4beb10)&&_0x32481c['_removeAttribute'](_0x4beb10);_0x43b626['set'](_0x32de6b,{'editor':_0x458981,'rootName':_0x550634['rootName'],'path':_0x5f2ff1['getPath'](),'documentVersion':_0x203c46,'getContent':this['_createGetContentUsingDataIdFn'](_0x32481c['_clone'](!0x0),_0x32de6b,_0x458981['data'])}),_0x772c78['jumpTo'](_0x351818['createPositionAfter'](_0x5f2ff1));}return{'content':_0x458981['data']['processor']['toData'](_0x458981['data']['toView'](_0x47be82)),'elements':_0x43b626};}['diffContent'](_0x8e56a1,_0x108a60,_0x3aaa82,_0x52ff98=!0x1){const _0x51a713=[],_0x3577a1=_0x8e56a1['data']['parse'](_0x3aaa82,'$documentFragment'),_0xc004b5=_0x8e56a1['data']['parse'](_0x108a60,'$documentFragment'),_0x4f5055=_0x8e56a1['model']['createPositionAt'](_0xc004b5,0x0);if(this['_haveSingleTopLevelElement'](_0x3577a1)){if(!this['_hasSameTopLevelElement'](_0xc004b5,_0x3577a1))return _0x51a713;}else{const _0x30e3e6=_0x8e56a1['model']['schema'];if(!this['_haveOnlyInlineContent'](_0xc004b5,_0x30e3e6)||!this['_haveOnlyInlineContent'](_0x3577a1,_0x30e3e6))return _0x51a713;}const _0x50d7fd=this['context']['plugins']['get']('DocumentCompare')['getDiff'](_0x108a60,_0x3aaa82,{'targetEditor':_0x8e56a1,'anchor':_0x4f5055,'markDeletions':!0x0})['getOperations']()['filter'](_0x5a657b=>'insert'===_0x5a657b['type']||'marker'===_0x5a657b['type']&&_0x5a657b['name']['startsWith']('$markedRemove')),_0x3c46a5=this['_groupAdjacentOperations'](_0x50d7fd),_0x109312=[];if(_0x52ff98){if(_0x3c46a5['length']){const _0x37ebcf=_0x3c46a5[0x0]['operations'][0x0],_0x14da6c='insert'===_0x37ebcf['type']?_0x37ebcf['position']:_0x37ebcf['newRange']['start'],_0x72d11a=this['_getPositionLimitingRange'](_0x14da6c,_0x8e56a1,'inside'),_0x331cb0=_0x72d11a?_0x3577a1['getChild'](0x0)['getChildren']():_0x3577a1['getChildren'](),_0x38b592=_0x72d11a||_0x8e56a1['model']['createRangeIn'](_0xc004b5),_0x3829c6=[new _0x52a7c3('$markedRemove:synthetic'+at(),null,_0x38b592,_0x8e56a1['model']['document']['model']['markers'],!0x0,_0x8e56a1['model']['document']['version']+0x1),new _0x387673(_0x38b592['end'],_0x331cb0,_0x8e56a1['model']['document']['version']+0x2)];_0x109312['push']({'operations':_0x3829c6,'operationsIsolated':_0x3829c6,'groupOffset':0x0});}}else _0x109312['push'](..._0x3c46a5);let _0x544870=0x0;return _0x8e56a1['model']['change'](_0x10b202=>{for(let _0x541f73=0x0;_0x541f73<_0x109312['length'];_0x541f73++){const _0x1414b9=_0x109312[_0x541f73],_0x4f2bc6=_0x10b202['createDocumentFragment']();for(const _0x46472c of _0xc004b5['getChildren']())_0x10b202['append'](_0x46472c['_clone'](!0x0),_0x4f2bc6);for(const _0x6c5a54 of _0x1414b9['operationsIsolated'])if('insert'===_0x6c5a54['type']){const _0x2fe1c8=_0x6c5a54;_0x2fe1c8['baseVersion']=null,_0x2fe1c8['isDocumentOperation']=!0x1,this['_changeOperationOwnerDocument'](_0x2fe1c8,_0x4f2bc6),_0x10b202['batch']['addOperation'](_0x6c5a54),_0x8e56a1['model']['applyOperation'](_0x6c5a54);const _0x310bb4='suggestion:insertion:id:authorId:'+_0x544870++,_0x16ec5f=_0x8e56a1['model']['createRange'](_0x2fe1c8['position'],_0x2fe1c8['position']['getShiftedBy'](_0x2fe1c8['howMany']));_0x4f2bc6['markers']['set'](_0x310bb4,_0x16ec5f);}else{if('marker'===_0x6c5a54['type']&&_0x6c5a54['name']['startsWith']('$markedRemove')){const _0x6e95e5=_0x6c5a54,_0x11b3b9='suggestion:deletion:id:authorId:'+_0x544870++;this['_changeOperationOwnerDocument'](_0x6e95e5,_0x4f2bc6),_0x4f2bc6['markers']['set'](_0x11b3b9,_0x6e95e5['newRange']);}}if(_0x52ff98)_0x51a713['push']({..._0x1414b9,'context':this['_createGetContentFn'](_0xc004b5,_0x8e56a1['data']),'content':this['_createGetContentFn'](_0xc004b5,_0x8e56a1['data'])});else{const _0x44d71b=this['_getChangeContext'](this['_changePositionOwnerDocument'](this['_getOperationStart'](_0x1414b9['operationsIsolated'][0x0]),_0x4f2bc6),this['_changePositionOwnerDocument'](this['_getOperationEnd'](_0x1414b9['operationsIsolated'][_0x1414b9['operationsIsolated']['length']-0x1]),_0x4f2bc6),_0x8e56a1);_0x4f2bc6['markers']['set'](Zn+'suggestion-context',new _0x2173cf(_0x44d71b['start'],_0x44d71b['end'])),_0x51a713['push']({..._0x1414b9,'context':this['_createGetContextFn'](_0x4f2bc6,_0x8e56a1['data'],{'ellipsisBefore':_0x44d71b['hasContentBefore'],'ellipsisAfter':_0x44d71b['hasContentAfter']}),'content':this['_createGetContentFn'](_0x4f2bc6,_0x8e56a1['data'])});}}}),_0x51a713;}['markChangePositionInEditorContent'](_0x58073e,_0x45b9d7){if(!_0x58073e['length'])return;const _0xdcfe2=_0x58073e[0x0]['parent']['id'],_0x1d4802=_0x45b9d7['elements']['get'](_0xdcfe2);if(!_0x1d4802)return void console['warn']('No\x20element\x20found\x20for\x20ID:\x20'+_0xdcfe2);const _0x57077f=_0x1d4802['path'],_0x5a60d5=_0x1d4802['editor'],_0x4e2b0d=_0x5a60d5['model']['document']['getRoot'](_0x1d4802['rootName']);if(!_0x4e2b0d)return void console['warn']('No\x20model\x20root\x20found\x20for\x20name:\x20'+_0x1d4802['rootName']);const _0x18026f=_0x5a60d5['model']['document']['history']['getOperations'](_0x1d4802['documentVersion']),_0x4fd707=[];for(const _0x5c5894 of _0x58073e){const _0x2a30f9=_0x5c5894['operationsIsolated']['map'](_0x17567c=>this['_translateOperationToEditorContent'](_0x17567c,_0x57077f,_0x4e2b0d));if(!_0x2a30f9||!_0x2a30f9['length'])continue;const _0x36c32c=_0x2a30f9['every'](_0x31c01f=>'marker'===_0x31c01f['type']&&_0x31c01f['name']['startsWith']('$markedRemove')),_0x1797ae={'document':_0x5a60d5['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1},_0x4c8b4e=_0x18252b(_0x2a30f9,_0x18026f,_0x1797ae)['operationsA'];for(const _0x511335 of _0x4c8b4e)if('insert'===_0x511335['type']){const _0x3b1aac=_0x511335,_0x312032=_0x3b1aac['nodes'];_0x5a60d5['model']['change'](_0x47d879=>{const _0x259712=_0x47d879['createDocumentFragment']();for(const _0x364ca0 of _0x312032)_0x47d879['append'](_0x364ca0['_clone'](!0x0),_0x259712);_0x4fd707['push']({'start':_0x3b1aac['position'],'end':_0x3b1aac['position'],'type':'insert','groupId':_0x5c5894['id'],'content':{'asString':this['_createGetContentFn'](_0x259712,_0x5a60d5['data'])(),'asFragment':_0x259712}});});}else{if('marker'===_0x511335['type']&&_0x511335['name']['startsWith']('$markedRemove')){const _0x14b65b=_0x511335;let _0x21717a='remove-text';if(_0x36c32c){const _0x1105a5=this['_findAdjacentContextDistance'](_0x14b65b['newRange']['start'],'backward',_0x5a60d5['model']['schema']),_0x458408=this['_findAdjacentContextDistance'](_0x14b65b['newRange']['end'],'forward',_0x5a60d5['model']['schema']);if(_0x1105a5||_0x458408){const _0x1be90f=_0x14b65b['newRange']['start']['getShiftedBy'](-_0x1105a5),_0x44e0cc=_0x14b65b['newRange']['end']['getShiftedBy'](_0x458408);_0x4fd707['push']({'start':_0x1be90f,'end':_0x44e0cc,'groupId':_0x5c5894['id'],'type':'remove-context'});}else _0x21717a='remove-only';}_0x4fd707['push']({'start':_0x14b65b['newRange']['start'],'end':_0x14b65b['newRange']['end'],'groupId':_0x5c5894['id'],'type':_0x21717a});}}}this['_insertMarkers'](_0x4fd707,_0x5a60d5);}['clearAllMarkers'](){const _0x245f7c=new Map();for(const _0x120661 of this['_markers']['keys']()){const _0x7f4805=this['_markers']['get'](_0x120661);_0x7f4805?.['editor']&&(_0x245f7c['has'](_0x7f4805['editor'])||_0x245f7c['set'](_0x7f4805['editor'],[]),_0x245f7c['get'](_0x7f4805['editor'])['push'](_0x120661));}for(const [_0x506928,_0x211859]of _0x245f7c)_0x506928['model']['change'](_0x413511=>{for(const _0x23910b of _0x211859)_0x506928['model']['markers']['get'](_0x23910b)&&_0x413511['removeMarker'](_0x23910b);});this['_markers']['clear'](),this['_activeMarkers']['clear']();}['switchToReadOnly'](){for(const _0x35f466 of Cs(this['context']))_0x35f466['enableReadOnlyMode']('ai-review');}['switchToEdit'](){for(const _0x39118f of Cs(this['context']))_0x39118f['disableReadOnlyMode']('ai-review');}['applyChange'](_0x60f16){const _0x23e3df=_0x60f16['map'](_0x117bca=>this['_getMarkersDataForGroup'](_0x117bca))['flat'](),_0x28eef4=new Map();for(const _0x328427 of _0x23e3df)_0x28eef4['has'](_0x328427['editor'])||_0x28eef4['set'](_0x328427['editor'],[]),_0x28eef4['get'](_0x328427['editor'])['push'](_0x328427);for(const [_0x493197,_0x1d953a]of _0x28eef4){const _0x566941=_0x493197['model'];_0x566941['change'](_0x20d5eb=>{for(const _0x259150 of _0x1d953a){const _0x557e25=_0x493197['model']['markers']['get'](_0x259150['id']);if(_0x557e25){if('insert'===_0x259150['type']){if(!_0x259150['content'])continue;_0x566941['insertContent'](_0x259150['content']['asFragment']||null,_0x557e25['getRange']()['start']);}else'remove-text'!==_0x259150['type']&&'remove-only'!==_0x259150['type']||_0x566941['deleteContent'](_0x566941['createSelection'](_0x557e25['getRange']()));_0x20d5eb['removeMarker'](_0x259150['id']),this['_markers']['delete'](_0x259150['id']);}}});}}['rejectChange'](_0x83fc12){const _0x4bc0fa=this['_getMarkersDataForGroup'](_0x83fc12),_0x557481=new Map();for(const _0x1339dc of _0x4bc0fa)_0x557481['has'](_0x1339dc['editor'])||_0x557481['set'](_0x1339dc['editor'],[]),_0x557481['get'](_0x1339dc['editor'])['push'](_0x1339dc);for(const [_0x19690a,_0xc962cf]of _0x557481)_0x19690a['model']['change'](_0x13bd3c=>{for(const _0x279b20 of _0xc962cf)_0x13bd3c['removeMarker'](_0x279b20['id']),this['_markers']['delete'](_0x279b20['id']);});}['getEditor'](){return ms(this['context']);}['getEditors'](){return Cs(this['context']);}['getEditorForChange'](_0x567887){const _0x319d22=this['_getMarkersDataForGroup'](_0x567887);return _0x319d22[0x0]?.['editor'];}['getMarkerElementForChange'](_0x9fbbed){const _0x54ea75=Array['from'](this['_markers']['values']())['filter'](_0x93b33c=>_0x93b33c['groupId']===_0x9fbbed);if(!_0x54ea75['length'])return null;const _0x43a1f3=0x1===_0x54ea75['length']?_0x54ea75[0x0]:this['_sortMarkers'](_0x54ea75)[0x0],_0x304c1f=_0x43a1f3['editor']['model']['markers']['get'](_0x43a1f3['id']);if(!_0x304c1f)return null;return{'modelRange':_0x304c1f['getRange'](),'getElement':()=>this['_findMarkerElementById'](_0x43a1f3['id'])};}['getContentElementForChange'](_0xa1d142){const _0x4dc704=Array['from'](this['_markers']['values']())['filter'](_0x150f07=>_0x150f07['groupId']===_0xa1d142);if(!_0x4dc704['length'])return null;const _0x41f6a4=0x1===_0x4dc704['length']?_0x4dc704[0x0]:this['_sortMarkers'](_0x4dc704)[0x0],_0x2c7939=_0x41f6a4['editor'],_0xd1457=_0x2c7939['model']['markers']['get'](_0x41f6a4['id']);if(!_0xd1457)return null;const _0x3611ca=_0xd1457['getRange'](),_0x59d478=_0x2c7939['editing']['view']['getDomRoot'](_0x3611ca['root']['rootName'])||_0x2c7939['editing']['view']['getDomRoot']();if(!_0x59d478||!_0x3611ca)return null;let _0x59046b=_0x3611ca['start']['parent'];for(;_0x59046b['parent']&&!_0x59046b['parent']['is']('rootElement');)_0x59046b=_0x59046b['parent'];if(!_0x59046b||!_0x59046b['name'])return null;const _0x32ee91=_0x59d478['querySelector']('[data-marker-id=\x22'+_0x41f6a4['id']+'\x22]');if(!_0x32ee91)return null;let _0x272768=null;_0x2c7939['model']['change'](_0x5cb535=>{_0x272768=_0x5cb535['createDocumentFragment'](),_0x5cb535['append'](_0x59046b['_clone'](!0x0),_0x272768);});const _0x50d52a=_0x2c7939['data']['toView'](_0x272768)['getChild'](0x0);return _0x32ee91['closest'](_0x50d52a['name']);}['reactivateMarkers'](_0x159966){const _0x210484=this['_getMarkersDataForGroup'](_0x159966);if(!_0x210484['length'])return;const _0x595b21=Array['from'](this['_activeMarkers'])['sort'](),_0x23d34d=Array['from'](new Set(_0x210484['map'](_0x2004bc=>_0x2004bc['id'])))['sort']();_0x595b21['join']('|')!==_0x23d34d['join']('|')&&(this['setAllMarkersAsInactive'](),this['setMarkersInElementAsActive'](_0x159966));}['setMarkersInElementAsActive'](_0x30d1c6){const _0x16159c=this['_getMarkersDataForGroup'](_0x30d1c6);if(!_0x16159c['length'])return;const _0x506ee0=_0x16159c[0x0]['editor'],_0x2e112c=new Set(_0x16159c['map'](_0xa6c730=>_0xa6c730['id'])),_0x3e165b=Array['from'](_0x2e112c['values']())['map'](_0x329766=>_0x506ee0['model']['markers']['get'](_0x329766))['filter'](_0x378ab3=>!!_0x378ab3);_0x2e112c['forEach'](_0x41f96b=>{this['_activeMarkers']['add'](_0x41f96b);}),_0x506ee0['model']['change'](()=>{_0x3e165b['forEach'](_0x455920=>{_0x506ee0['editing']['reconvertMarker'](_0x455920);});});}['setAllMarkersAsInactive'](){const _0x42bb63=Array['from'](this['_activeMarkers']);if(!_0x42bb63['length'])return;this['_activeMarkers']['clear']();const _0x572bf9=new Map();for(const _0x3c93c4 of _0x42bb63){const _0x2e063e=this['_markers']['get'](_0x3c93c4);if(!_0x2e063e)continue;const _0x2e473c=_0x2e063e['editor'],_0x5187a8=_0x2e473c['model']['markers']['get'](_0x3c93c4);_0x5187a8&&(_0x572bf9['has'](_0x2e473c)||_0x572bf9['set'](_0x2e473c,[]),_0x572bf9['get'](_0x2e473c)['push'](_0x5187a8));}for(const [_0x3f04c1,_0x8d9770]of _0x572bf9)_0x3f04c1['model']['change'](()=>{_0x8d9770['forEach'](_0x4ae1fe=>{_0x3f04c1['editing']['reconvertMarker'](_0x4ae1fe);});});}['_getPositionLimitingRange'](_0x11acf1,_0x3a5d80,_0x37bf42='outside'){if(!_0x11acf1)return null;let _0x218705=_0x11acf1['parent'];for(;_0x218705&&_0x218705['parent']&&!_0x218705['parent']['is']('rootElement')&&!_0x3a5d80['model']['schema']['isLimit'](_0x218705)&&!_0x3a5d80['model']['schema']['isBlock'](_0x218705);)_0x218705=_0x218705['parent'];if(!_0x218705||!_0x218705['name']||_0x218705['is']('rootElement'))return null;let _0x100cca=null;return _0x3a5d80['model']['change'](_0x5624d4=>{_0x100cca='inside'===_0x37bf42?_0x5624d4['createRangeIn'](_0x218705):_0x5624d4['createRangeOn'](_0x218705);}),_0x100cca;}['_validateMarkers'](_0x47171f,_0x59874c){const _0x520031=Array['from'](this['_markers']['keys']()),_0xed5524=new Map();for(const _0x2a28eb of _0x520031){const _0x349438=_0x47171f['model']['markers']['get'](_0x2a28eb);if(!_0x349438)continue;const _0x1e9dfb=_0x349438['getStart']()['root']['rootName']+':'+_0x349438['getStart']()['path'][0x0];_0xed5524['has'](_0x1e9dfb)||_0xed5524['set'](_0x1e9dfb,[]),_0xed5524['get'](_0x1e9dfb)['push'](_0x349438);}const _0x1b7976=new Set();for(const _0x7b06ad of _0x47171f['model']['document']['differ']['getChanges']()){let _0x32a81e='',_0x3f103f=null;if('insert'===_0x7b06ad['type'])_0x3f103f=new _0x2173cf(_0x7b06ad['position'],_0x7b06ad['position']['getShiftedBy'](_0x7b06ad['length'])),_0x32a81e=_0x7b06ad['position']['root']['rootName']+':'+_0x7b06ad['position']['path'][0x0];else{if('remove'!==_0x7b06ad['type'])continue;_0x3f103f=new _0x2173cf(_0x7b06ad['position']),_0x32a81e=_0x7b06ad['position']['root']['rootName']+':'+_0x7b06ad['position']['path'][0x0];}const _0x5e4a12=_0xed5524['get'](_0x32a81e)||[];if(_0x5e4a12['length']){for(const _0x133790 of _0x5e4a12)if(_0x3f103f['root']['rootName']===_0x133790['getRange']()['root']['rootName']&&('insert'!==_0x7b06ad['type']||!_0x3f103f['containsRange'](_0x133790['getRange']()))&&(_0x3f103f['isIntersecting'](_0x133790['getRange']())||_0x3f103f['start']['isTouching'](_0x133790['getRange']()['end'])||_0x3f103f['end']['isTouching'](_0x133790['getRange']()['start']))){const _0xcd9283=this['_parseMarkerName'](_0x133790['name']);Array['from'](this['_markers']['values']())['filter'](_0x2263ed=>_0x2263ed['groupId']===_0xcd9283['groupId'])['forEach'](_0x3f944b=>_0x1b7976['add'](_0x3f944b['id']));}}}if(_0x1b7976['size']){for(const _0x1a45de of _0x1b7976)_0x59874c['removeMarker'](_0x1a45de);return!0x0;}return!0x1;}['_handleMarkerChanges'](_0x569a08){for(const {name:_0x5550ea,data:_0x2b4bfe}of _0x569a08['model']['document']['differ']['getChangedMarkers']()){if(!_0x5550ea['startsWith'](Zn))continue;const _0x130e4a=_0x2b4bfe['oldRange'],_0x1bf57f=_0x2b4bfe['newRange'],_0x35be67=_0x130e4a&&'$graveyard'===_0x130e4a['root']['rootName'],_0x11794e=_0x1bf57f&&'$graveyard'===_0x1bf57f['root']['rootName'];if(_0x35be67&&_0x11794e)continue;const _0x514dc1=this['_parseMarkerName'](_0x5550ea);this['_markers']['get'](_0x5550ea)&&(_0x11794e||!_0x1bf57f?this['_eventEmitter']['fire']('changeMarkerRemoved',{'markerId':_0x5550ea,'changeId':_0x514dc1['groupId']}):_0x35be67&&_0x1bf57f&&this['_eventEmitter']['fire']('changeMarkerRestored',{'markerId':_0x5550ea,'changeId':_0x514dc1['groupId']}));}}['_parseMarkerName'](_0x395fed){const _0x3df50b=_0x395fed['split'](':'),_0xb218a4=(_0x3df50b[0x1]||'')['split']('_');return{'prefix':_0x3df50b[0x0],'groupId':_0xb218a4[0x0],'suffix':_0xb218a4[0x1]};}['_translateOperationToEditorContent'](_0x3c14fc,_0x152573,_0x29b4ca){if('insert'===_0x3c14fc['type']){const _0x1fb33e=_0x3c14fc;return new _0x387673(this['_changePosition'](_0x152573['concat'](_0x1fb33e['position']['offset']),_0x29b4ca),_0x1fb33e['nodes'],_0x1fb33e['baseVersion']);}if('marker'===_0x3c14fc['type']&&_0x3c14fc['name']['startsWith']('$markedRemove')){const _0xf2f48=_0x3c14fc;return new _0x52a7c3(_0xf2f48['name'],_0xf2f48['oldRange'],this['_changeRange'](_0xf2f48['newRange'],_0x152573['concat'](_0xf2f48['newRange']['start']['offset']),_0x152573['concat'](_0xf2f48['newRange']['end']['offset']),_0x29b4ca),_0xf2f48['_markers'],_0xf2f48['affectsData'],_0xf2f48['baseVersion']);}return _0x3c14fc;}['_groupAdjacentOperations'](_0x35cb06){if(!_0x35cb06['length'])return[];const _0x57ed1a=[];let _0x2dd274=0x0,_0x4eb8ad=0x0,_0x4f6357=[];for(let _0x3d3046=0x0;_0x3d3046<=_0x35cb06['length'];_0x3d3046++){const _0x167e29=_0x35cb06[_0x3d3046],_0x397842=_0x35cb06[_0x3d3046-0x1];!_0x167e29||_0x397842&&!this['_getOperationEnd'](_0x397842)['isTouching'](this['_getOperationStart'](_0x167e29))?(_0x57ed1a['push']({'operations':_0x4f6357,'operationsIsolated':_0x4f6357['map'](_0xa3de3f=>this['_shiftOperation'](_0xa3de3f['clone'](),-_0x4eb8ad)),'groupOffset':_0x2dd274}),_0x4f6357=_0x167e29?[_0x167e29]:[],_0x4eb8ad+=_0x2dd274,_0x2dd274=0x0):_0x4f6357['push'](_0x167e29),_0x167e29&&'insert'===_0x167e29['type']&&(_0x2dd274+=_0x167e29['howMany']);}return _0x57ed1a;}['_findAdjacentContextDistance'](_0x12f208,_0x3a357b,_0x2244ed,_0x34ea09=0x1){const _0x62707d=new _0x432418({'startPosition':_0x12f208,'direction':_0x3a357b});let _0x30b6a3=0x0;for(let _0x56ed07=0x0;_0x56ed07<_0x34ea09;_0x56ed07++){let _0x1852bd=0x0,_0x224faa=!0x1,_0x24885e='forward'===_0x3a357b?/^\W*\w+/:/\w+\W*$/;for(const {item:_0x145b78}of _0x62707d)if(_0x145b78['is']('$textProxy')){const _0x4955fe=_0x24885e['exec'](_0x145b78['data']);if(_0x4955fe&&_0x4955fe['length']){if(_0x1852bd+='forward'===_0x3a357b?_0x4955fe['index']+_0x4955fe[0x0]['length']:_0x145b78['data']['length']-_0x4955fe['index'],_0x4955fe[0x0]['length']!==_0x145b78['data']['length'])break;_0x224faa=!0x0,_0x24885e='forward'===_0x3a357b?/^\w+/:/\w+$/;}else{if(_0x224faa)break;_0x1852bd+=_0x145b78['offsetSize'];}}else{if(_0x145b78['is']('element')){_0x2244ed['isInline'](_0x145b78)&&!_0x224faa&&(_0x1852bd+=0x1);break;}}_0x30b6a3+=_0x1852bd,_0x62707d['jumpTo'](_0x12f208['getShiftedBy']('forward'===_0x3a357b?_0x30b6a3:-_0x30b6a3));}return _0x30b6a3;}['_getChangeContext'](_0x3db11d,_0x3c2a23,_0x20070c){const _0x22fb05=_0x20070c['model']['schema'],_0x41dd2a=this['_findAdjacentContextDistance'](_0x3db11d,'backward',_0x22fb05,0x6),_0x4fcf30=this['_findAdjacentContextDistance'](_0x3c2a23,'forward',_0x22fb05,0x6),_0x401c04=_0x3db11d['getShiftedBy'](-_0x41dd2a),_0x2f6c9f=_0x3c2a23['getShiftedBy'](_0x4fcf30);return{'start':_0x401c04,'end':_0x2f6c9f,'hasContentBefore':!_0x401c04['isAtStart'],'hasContentAfter':!_0x2f6c9f['isAtEnd']};}['_insertMarkers'](_0x4f5336,_0x140667){const _0x55b736=this['context']['plugins']['get']('AIEditing'),_0x2600d7=new Set();_0x140667['model']['change'](_0x72d1c5=>{for(const _0x58a22c of _0x4f5336){const _0x144ab9=''+Zn+_0x58a22c['type']+':'+_0x58a22c['groupId']+'_'+_0x55b736['_nextDataId'](_0x2600d7);this['_markers']['set'](_0x144ab9,{'id':_0x144ab9,'groupId':_0x58a22c['groupId'],'type':_0x58a22c['type'],'content':_0x58a22c['content'],'editor':_0x140667}),_0x72d1c5['addMarker'](_0x144ab9,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x72d1c5['createRange'](_0x58a22c['start'],_0x58a22c['end'])});}});}['_createGetContextFn'](_0x396a55,_0x3f4435,_0x476670){let _0x3dbede='';return()=>{if(!_0x3dbede){const _0x77a740=_0x3f4435['toView'](_0x396a55,{'showSuggestionHighlights':!0x0});let _0x22de41=_0x77a740['getChild'](0x0);if(_0x22de41['is']('containerElement')||(_0x22de41=_0x77a740),!_0x22de41)return'';let _0x3860eb=!0x1;const _0xec721a=[];for(const _0x495490 of _0x22de41['getChildren']())_0x495490['is']('element','span')&&_0x495490['hasClass']('ck-ai_review-marker_context-end')&&(_0x3860eb=!0x1),_0x3860eb&&_0xec721a['push'](_0x495490),_0x495490['is']('element','span')&&_0x495490['hasClass']('ck-ai_review-marker_context-start')&&(_0x3860eb=!0x0);_0x22de41['_removeChildren'](0x0,_0x22de41['childCount']),_0x476670?.['ellipsisBefore']&&_0x22de41['_appendChild']('…'),_0x22de41['_appendChild'](_0xec721a),_0x476670?.['ellipsisAfter']&&_0x22de41['_appendChild']('…');const _0x3f8c1d=_0x3f4435['htmlProcessor']['domConverter']['viewToDom'](_0x77a740),_0x44aa18=_0x3f4435['htmlProcessor']['htmlWriter']['getHtml'](_0x3f8c1d);_0x3dbede=this['_removeUnsupportedElements'](_0x44aa18);}return _0x3dbede;};}['_createGetContentFn'](_0x3d964e,_0x15f2a4){let _0x13ca80='';return()=>(_0x13ca80||(_0x13ca80=this['_removeUnsupportedElements'](_0x15f2a4['stringify'](_0x3d964e,{'showSuggestionHighlights':!0x0}))),_0x13ca80);}['_createGetContentUsingDataIdFn'](_0x4882c5,_0xe1440,_0x297aca){let _0xf1c9cd='';return()=>{if(!_0xf1c9cd){const _0x54f5f4=_0x297aca['toView'](new _0x17914c(_0x4882c5)),_0x27d8b7=_0x297aca['htmlProcessor']['domConverter']['viewToDom'](_0x54f5f4)['querySelector']('[data-id=\x22'+_0xe1440+'\x22]');_0xf1c9cd=this['_removeUnsupportedElements'](_0x27d8b7?.['outerHTML']||'');}return _0xf1c9cd;};}['_removeUnsupportedElements'](_0x16c57a){if(!_0x16c57a)return'';const _0x5cf706=Wi(_0x16c57a,{'decodeEntities':!0x1}),_0x4f9684=qi(_0x5cf706);if(!_0x4f9684['length'])return _0x16c57a;for(const _0x1579a7 of _0x4f9684)_0x4b0b34(_0x1579a7);return Ki(_0x5cf706,{'encodeEntities':!0x1});}['_findMarkerElement'](_0xd81950,_0x39d8fd=0x5){let _0xaa4809=_0xd81950,_0x407380=null;for(let _0x52539d=0x0;_0x52539d<_0x39d8fd&&_0xaa4809;_0x52539d++){if(!_0xaa4809['className']){_0xaa4809=_0xaa4809['parentElement'];continue;}if(!(''+_0xaa4809['className'])['includes']('ck-ai_review-marker_')){_0xaa4809=_0xaa4809['parentElement'];continue;}if(!_0xaa4809['getAttribute']('data-marker-id'))break;_0x407380=_0xaa4809;break;}return _0x407380;}['_findMarkerElementById'](_0x4e6ade){const _0xd01d5d=this['_markers']['get'](_0x4e6ade);if(!_0xd01d5d)return null;const _0x1af448=_0xd01d5d['editor']['model']['markers']['get'](_0x4e6ade);return _0x1af448?_0x484002(_0xd01d5d['editor']['editing'],_0x1af448):null;}['_getMarkersDataForGroup'](_0x371a46){return Array['from'](this['_markers']['values']())['filter'](_0xb7738e=>_0xb7738e['groupId']===_0x371a46);}['_getOperationStart'](_0x51b03c){return'insert'===_0x51b03c['type']?_0x51b03c['position']:_0x51b03c['newRange']['start'];}['_getOperationEnd'](_0xe62fa0,_0x1e6093=!0x1){return'insert'===_0xe62fa0['type']?_0x1e6093?_0xe62fa0['position']:_0xe62fa0['position']['getShiftedBy'](_0xe62fa0['howMany']):_0xe62fa0['newRange']['end'];}['_shiftOperation'](_0x1b1e86,_0x52ef80){return'insert'===_0x1b1e86['type']?_0x1b1e86['position']=_0x1b1e86['position']['getShiftedBy'](_0x52ef80):'marker'===_0x1b1e86['type']&&_0x1b1e86['newRange']&&(_0x1b1e86['newRange']=new _0x2173cf(_0x1b1e86['newRange']['start']['getShiftedBy'](_0x52ef80),_0x1b1e86['newRange']['end']['getShiftedBy'](_0x52ef80))),_0x1b1e86;}['_changeOperationOwnerDocument'](_0xeda256,_0x236e05){'insert'===_0xeda256['type']?_0xeda256['position']=this['_changePositionOwnerDocument'](_0xeda256['position'],_0x236e05):'marker'===_0xeda256['type']&&_0xeda256['newRange']&&(_0xeda256['newRange']=this['_changeRangeOwnerDocument'](_0xeda256['newRange'],_0x236e05));}['_changePositionOwnerDocument'](_0x7fe0a4,_0x11bf4e){return new _0x4343f1(_0x11bf4e,_0x7fe0a4['path']);}['_changeRangeOwnerDocument'](_0x2bf014,_0x20fec1){return new _0x2173cf(this['_changePositionOwnerDocument'](_0x2bf014['start'],_0x20fec1),this['_changePositionOwnerDocument'](_0x2bf014['end'],_0x20fec1));}['_changePosition'](_0x52ffd1,_0x569757){return new _0x4343f1(_0x569757,[..._0x52ffd1]);}['_changeRange'](_0x1f3af6,_0x5b7632,_0x21b457,_0x57a771){return new _0x2173cf(this['_changePosition'](_0x5b7632,_0x57a771),this['_changePosition'](_0x21b457,_0x57a771));}['_sortMarkers'](_0xbb0e34){const _0x236c4a=_0x1c386d=>{switch(_0x1c386d){case'insert':return 0x0;case'remove-context':return 0x1;case'remove-only':return 0x2;case'remove-text':return 0x3;}};return _0xbb0e34['sort']((_0x560a2f,_0x41c697)=>_0x236c4a(_0x560a2f['type'])-_0x236c4a(_0x41c697['type']));}['_hasSameTopLevelElement'](_0x5d94e7,_0x3895a7){const _0x3aaf2e=_0x5d94e7['getChild'](0x0),_0x28f30c=_0x3895a7['getChild'](0x0);return!(!_0x3aaf2e||!_0x28f30c)&&((!_0x3aaf2e['is']('element')||!_0x28f30c['is']('element')||_0x3aaf2e['name']===_0x28f30c['name'])&&!(_0x3aaf2e['is']('element')&&!_0x28f30c['is']('element')||!_0x3aaf2e['is']('element')&&_0x28f30c['is']('element')));}['_haveSingleTopLevelElement'](_0x288bb2){return 0x1===_0x288bb2['childCount'];}['_haveOnlyInlineContent'](_0x573766,_0xb93de9){for(const _0x3ace8c of _0x573766['getChildren']())if(_0x3ace8c['is']('element')&&!_0xb93de9['isInline'](_0x3ace8c))return!0x1;return!0x0;}['_upsertDataId'](_0x12ff42,_0x3bc3c7){let _0x45748f=_0x12ff42['getAttribute'](_0x4beb10);return _0x45748f||(_0x45748f=_0x3bc3c7(),_0x12ff42['_setAttribute'](_0x4beb10,_0x45748f)),_0x45748f;}}class AIReviewCheckResult extends Et(){['id'];['contentNew'];['contentInitial'];['documentVersion'];constructor({id:_0x4cb6eb,contentNew:_0x4d4aae,contentInitial:_0x1b3c34,documentVersion:_0x4d064f}){super(),this['id']=_0x4cb6eb,this['contentNew']=_0x4d4aae,this['contentInitial']=_0x1b3c34,this['documentVersion']=_0x4d064f;}}class AIReviewCheckResultChange extends ct(){['id'];['parent'];['_data'];['_editorOperations']=[];constructor(_0x22d15d,_0x15c133,_0x2c1668){super(),this['id']=_0x22d15d,this['parent']=_0x2c1668,this['_data']=_0x15c133,this['set']('isActivated',!0x1),this['set']('isRated',!0x1),this['set']('status','pending'),this['on']('change:status',()=>{'pending'!==this['status']&&this['isActivated']&&(this['isActivated']=!0x1);});}get['contentDiffed'](){return this['_data']['context']();}get['operations'](){return this['_data']['operations'];}get['operationsIsolated'](){return this['_data']['operationsIsolated'];}}class AIReviewCheckRun extends ct(){['id']=at();['callId'];['_results']=new Map();['_changes']=[];['_sourceCheck'];['_documentData'];['_aiConnector'];['_reviewParams'];['_reviewArgs'];['_activeRequest']=null;['_currentError'];['_wasAborted']=!0x1;constructor(_0x4509fb,_0x1c077b,_0x3a7157,_0x381861,_0x56fce0){super(),this['_sourceCheck']=_0x1c077b,this['_documentData']=_0x4509fb,this['_aiConnector']=_0x3a7157,this['_reviewParams']=_0x381861,this['_reviewArgs']=_0x56fce0,this['on']('change:status',(_0x2d01dd,_0x3dbc01,_0x27bfbf)=>{'aborted'==_0x27bfbf&&(this['_wasAborted']=!0x0),this['fire']('reviewCheckRunUpdated',{'status':_0x27bfbf,'run':this,'error':this['_currentError']});}),this['set']('status','initialized');}get['documentData'](){return this['_documentData'];}get['processedResultsCount'](){return this['_results']['size'];}get['title'](){return this['_sourceCheck']['title'];}get['subTitle'](){return'';}get['reviewName'](){return this['_sourceCheck']['id'];}get['hasModifications'](){return!this['_changes']['every'](_0x1e744f=>'pending'===_0x1e744f['status']);}get['currentError'](){return this['_currentError'];}get['results'](){return Array['from'](this['_results']['values']());}['updateDocumentData'](_0x466e0c){this['_documentData']=_0x466e0c;}async['start'](){this['status']='loading',this['_currentError']=void 0x0;try{this['_activeRequest']=this['_createApiRequest']();const _0x3f1761=await this['_activeRequest']['getStream']();this['status']='data';for await(const _0x35204f of _0x3f1761)'unmodified'!==_0x35204f['data']['operation']&&('error'!==_0x35204f['data']['operation']?'review-metadata'!==_0x35204f['event']?this['_addReviewCheckResult'](_0x35204f['data']['dataId'],_0x35204f['data']['textDelta']):this['callId']=_0x35204f['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(_0x4cde51){this['_currentError']=_0x4cde51,_0x4cde51 instanceof Error&&_0x4cde51['message']['includes']('ai-request-aborted')?this['status']='aborted':this['status']='error-general';}finally{this['_activeRequest']=null;}}async['restart'](){this['_results']['clear'](),this['_changes']['length']=0x0,this['_currentError']=void 0x0,await this['start']();}['addResultChanges'](_0x40818e,_0x6a4710){const _0x48f858=this['_results']['get'](_0x40818e);if(!_0x48f858)return;if(0x0===_0x6a4710['length'])return;const _0x4f80bd=[];_0x6a4710['forEach']((_0x5dad71,_0xcbdd24)=>{const _0xfce295=new AIReviewCheckResultChange(_0x48f858['id']+'-'+_0xcbdd24,_0x5dad71,_0x48f858);_0xfce295['on']('change:status',()=>{this['fire']('reviewCheckResultChangeStatusUpdated',{'change':_0xfce295,'status':_0xfce295['status']});}),_0xfce295['on']('change:isActivated',()=>{_0xfce295['isActivated']?this['fire']('reviewCheckResultActivated',{'change':_0xfce295}):this['fire']('reviewCheckResultDeactivated',{'change':_0xfce295});}),this['_changes']['push'](_0xfce295),_0x4f80bd['push'](_0xfce295);}),this['fire']('reviewCheckResultReady',{'changes':_0x4f80bd,'result':_0x48f858,'source':this});}['abort'](){this['_activeRequest']&&(this['_activeRequest']['abortController']['abort'](),this['_activeRequest']=null,this['status']='aborted');}['isChangeActive'](_0x18fd6e){const _0x5274f1=this['_changes']['find'](_0x4e4af5=>_0x4e4af5['id']===_0x18fd6e);return!(!_0x5274f1||'pending'!==_0x5274f1['status']);}['isAnyChangeActivated'](){return this['_changes']['some'](_0x4d7eda=>!0x0===_0x4d7eda['isActivated']);}['getActiveChanges'](){return this['_changes']['filter'](_0x5ae06b=>'pending'===_0x5ae06b['status']);}['getChangeById'](_0x3d480a){return this['_changes']['find'](_0x10485b=>_0x10485b['id']===_0x3d480a);}['markAllChangesAsAccepted'](){for(const _0x4c7de7 of this['_changes'])'pending'===_0x4c7de7['status']&&(_0x4c7de7['status']='accepted');this['_checkIfFinished']();}['markChangeAsAccepted'](_0x1ea427){const _0x29aa76=this['_changes']['find'](_0x1de0cd=>_0x1de0cd['id']===_0x1ea427);_0x29aa76&&'pending'===_0x29aa76['status']&&(_0x29aa76['status']='accepted'),this['_checkIfFinished']();}['markChangeAsRejected'](_0xc5cc58){const _0x5da961=this['_changes']['find'](_0x12ade2=>_0x12ade2['id']===_0xc5cc58);_0x5da961&&'pending'===_0x5da961['status']&&(_0x5da961['status']='rejected'),this['_checkIfFinished']();}['markChangeAsOutdated'](_0x2f2b31){const _0x5486e3=this['_changes']['find'](_0x301d79=>_0x301d79['id']===_0x2f2b31);_0x5486e3&&'pending'===_0x5486e3['status']&&(_0x5486e3['status']='outdated'),this['_checkIfFinished']();}['markChangeAsPending'](_0x5ae7f5){const _0x4df440=this['_changes']['find'](_0x330f46=>_0x330f46['id']===_0x5ae7f5);_0x4df440&&'outdated'===_0x4df440['status']&&(_0x4df440['status']='pending'),this['_checkIfFinished']();}['activateChange'](_0x221f26){this['_changes']['filter'](_0x2067a9=>_0x2067a9['isActivated']&&_0x2067a9['id']!==_0x221f26)['forEach'](_0x1539cf=>{_0x1539cf['isActivated']=!0x1;});const _0x2eba9b=this['_changes']['find'](_0x300cb0=>_0x300cb0['id']===_0x221f26);_0x2eba9b&&'pending'===_0x2eba9b['status']&&(_0x2eba9b['isActivated']=!0x0);}['deactivateChange'](){this['_changes']['filter'](_0x3c526a=>_0x3c526a['isActivated'])['forEach'](_0x11a479=>{_0x11a479['isActivated']=!0x1;});}['forceReadyState'](){this['status']='ready';}async['sendRating'](_0x6d2afa){if('initialized'===this['status']||'loading'===this['status']||'data'===this['status']||this['_wasAborted'])return;if(!this['callId']||0x0===this['_changes']['length'])return;let _0x3a0a46;if(_0x6d2afa){const _0xf15dc9=this['_changes']['find'](_0x3a7364=>_0x3a7364['id']===_0x6d2afa);if(_0xf15dc9&&_0xf15dc9['isRated'])return;_0xf15dc9&&(_0x3a0a46=_0xf15dc9['parent']['id'],_0xf15dc9['isRated']=!0x0);}const _0x42eb18={'positiveCount':this['_changes']['filter'](_0x710ab4=>'accepted'===_0x710ab4['status'])['length'],'totalCount':this['_changes']['length']};this['_sendRatingRequest'](_0x42eb18,this['callId'],_0x3a0a46);}['_addReviewCheckResult'](_0x2c4559,_0x187dcc){const _0x2b2947=this['_documentData']['elements']['get'](_0x2c4559);if(!_0x2b2947)return;const _0x115d13=_0x2b2947['getContent']();if(_0x115d13===_0x187dcc)return;const _0x1691a2=new AIReviewCheckResult({'id':_0x2c4559,'contentInitial':_0x115d13,'contentNew':_0x187dcc,'documentVersion':_0x2b2947['documentVersion']});this['_results']['set'](_0x1691a2['id'],_0x1691a2),this['fire']('reviewCheckResultAdded',{'result':_0x1691a2,'source':this,'editor':_0x2b2947['editor']});}['_checkIfFinished'](){'finished'===this['status']&&(this['_changes']['filter'](_0x438b04=>'pending'===_0x438b04['status'])['length']>0x0&&(this['status']='ready')),'ready'===this['status']&&(0x0===this['_changes']['filter'](_0x92ed15=>'pending'===_0x92ed15['status'])['length']&&(this['status']='finished'));}}class AIReviewSystemCheckRun extends AIReviewCheckRun{get['subTitle'](){if(!this['_reviewParams']||0x0===this['_reviewParams']['length'])return'';const _0x2c414c=[];if(this['_reviewParams']['length']>0x0&&this['_sourceCheck']['options'])for(let _0x2b7864=0x0;_0x2b7864<this['_reviewParams']['length'];_0x2b7864++){if(!this['_reviewParams'][_0x2b7864]||!this['_sourceCheck']['options'][_0x2b7864])continue;const _0x23c2e9=this['_sourceCheck']['options'][_0x2b7864],_0x85498c=_0x23c2e9['data']?.['find'](_0x321234=>_0x321234['id']===this['_reviewParams'][_0x2b7864]);_0x85498c&&_0x2c414c['push'](_0x85498c['label']);}return _0x2c414c['join'](',\x20');}get['reviewName'](){return this['_composeReviewName']();}['_createApiRequest'](){return this['_aiConnector']['callSystemReview']({'reviewName':this['_composeReviewName'](),'content':this['_documentData']['content'],'args':this['_reviewArgs']});}['_sendRatingRequest'](_0x7d385f,_0x4074f3,_0xabec93){return this['_aiConnector']['upsertAIReviewRating'](this['reviewName'],_0x4074f3,_0x7d385f,_0xabec93);}['_composeReviewName'](){return!this['_reviewParams']||0x0===this['_reviewParams']['length']||this['_sourceCheck']['useArgs']?this['_sourceCheck']['apiId']:[this['_sourceCheck']['apiId'],...this['_reviewParams']]['join']('-');}}class AIReviewCoreController extends _0x533560{['_aiConnector'];['_aiReviewCoreUi'];['_aiReviewCoreEditing'];['_availableReviewChecks'];['_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',(_0xada3fe,_0x3b8b11)=>this['runCheck'](_0x3b8b11)),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 _0x47097b=this['_currentReviewCheckRun']['getActiveChanges']();if(!_0x47097b['length'])return;this['_aiReviewCoreEditing']['applyChange'](_0x47097b['map'](_0x38dcaf=>_0x38dcaf['id']));const _0x21d0d4=this['_currentReviewCheckRun'];_0x21d0d4['markAllChangesAsAccepted'](),_0x21d0d4['sendRating']();}),this['listenTo'](this['_aiReviewCoreUi'],'acceptChange',(_0x33ff91,_0x5ca423)=>{this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['isChangeActive'](_0x5ca423['id'])&&(this['_aiReviewCoreEditing']['applyChange']([_0x5ca423['id']]),this['_currentReviewCheckRun']['markChangeAsAccepted'](_0x5ca423['id']),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_currentReviewCheckRun']['sendRating'](_0x5ca423['id']));}),this['listenTo'](this['_aiReviewCoreUi'],'dismissChange',(_0x4c00ac,_0x14f1a9)=>{this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['isChangeActive'](_0x14f1a9['id'])&&(this['_aiReviewCoreEditing']['rejectChange'](_0x14f1a9['id']),this['_currentReviewCheckRun']['markChangeAsRejected'](_0x14f1a9['id']),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_currentReviewCheckRun']['sendRating'](_0x14f1a9['id']));}),this['listenTo'](this['_aiReviewCoreUi'],'retryReview',async()=>{this['_currentReviewCheckRun']&&(this['_aiReviewCoreEditing']['clearAllMarkers'](),this['_currentReviewCheckRun']['updateDocumentData'](this['_aiReviewCoreEditing']['getDocumentData']()),await this['_currentReviewCheckRun']['restart']());}),this['listenTo'](this['_aiReviewCoreUi'],'activateChange',(_0x5bc10e,_0x4413d5)=>{this['_onActivateChange'](_0x4413d5);}),this['listenTo'](this['_aiReviewCoreUi'],'deactivateChange',(_0x2a367f,_0x36f274)=>{this['_onDeactivateChange'](_0x36f274);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerClicked',(_0x5452c9,_0x59cab7)=>{this['_onChangeMarkerClicked'](_0x5452c9,_0x59cab7);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerHovered',(_0x4579e4,_0xe0aca5)=>{this['_onChangeMarkerHovered'](_0x4579e4,_0xe0aca5);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerBlurred',()=>{this['_onChangeMarkerBlurred']();}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerRemoved',(_0x4e0315,_0x3dd42d)=>{this['_onChangeMarkerRemoved'](_0x4e0315,_0x3dd42d);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerRestored',(_0x1ce03e,_0x26c644)=>{this['_onChangeMarkerRestored'](_0x1ce03e,_0x26c644);});}async['runCheck'](_0x4d11b5){if(!this['_availableReviewChecks'])return;const _0x51c8d9=this['_availableReviewChecks']['find'](_0x46f41e=>_0x46f41e['id']===_0x4d11b5['id']);if(_0x51c8d9){this['_onReviewCheckRun'](_0x4d11b5),this['_aiReviewCoreEditing']['switchToReadOnly'](),this['_currentReviewCheckRun']=this['_createReviewCheckRun'](_0x4d11b5,_0x51c8d9),this['_aiReviewCoreUi']['setCheckResultTitle'](this['_currentReviewCheckRun']['title'],this['_currentReviewCheckRun']['subTitle']),this['_currentReviewCheckRun']['on']('reviewCheckRunUpdated',(_0x2dade1,_0x51a265)=>{switch(_0x51a265['status']){case'data':case'loading':this['_aiReviewCoreUi']['showCheckRunResults'](_0x51a265);break;case'finished':this['_onCheckRunFinished']();break;case'ready':this['_aiReviewCoreUi']['showActionsWhenResultIsReady']();break;case'unmodified':this['_aiReviewCoreUi']['showNoChangesView']();break;case'error-general':this['_aiReviewCoreUi']['showGeneralResultsErrorView'](),this['_logError'](new ht('ai-review-mode-check-run-general-error',this,void 0x0,this['_currentReviewCheckRun']?.['currentError']));break;case'error-chunk':this['_aiReviewCoreUi']['showChunkErrorView'](),this['_logError'](new ht('ai-review-mode-check-run-chunk-error',this,void 0x0,this['_currentReviewCheckRun']?.['currentError']));break;case'aborted':this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['processedResultsCount']>0x0?setTimeout(()=>{this['_currentReviewCheckRun']?.['forceReadyState']();},0x0):this['_onReviewRunLeave'](!0x0);}'ready'!==_0x51a265['status']&&'error-chunk'!==_0x51a265['status']&&'error-general'!==_0x51a265['status']||this['_currentReviewCheckRun']?.['sendRating']();}),this['_currentReviewCheckRun']['on']('reviewCheckResultAdded',(_0x13727f,_0x4171ef)=>{if(!this['_currentReviewCheckRun'])throw new ht('ai-review-mode-no-current-check-run',this);const _0x81fa18=this['_diffContent'](_0x4171ef['editor'],_0x4171ef['result']['contentInitial'],_0x4171ef['result']['contentNew']);_0x4171ef['source']['addResultChanges'](_0x4171ef['result']['id'],_0x81fa18);}),this['_currentReviewCheckRun']['on']('reviewCheckResultReady',(_0x2a1b45,_0x36f4cc)=>{for(const _0x535760 of _0x36f4cc['changes'])this['_aiReviewCoreUi']['showCheckRunResult'](_0x535760);this['_markChangePositionInEditorContent'](_0x36f4cc['changes'],_0x36f4cc['source']['documentData']);}),this['_currentReviewCheckRun']['on']('reviewCheckResultChangeStatusUpdated',(_0xe2ba6f,_0x797466)=>{this['_aiReviewCoreUi']['updateChangeState'](_0x797466['change']['id'],_0x797466['status']);}),this['_currentReviewCheckRun']['on']('reviewCheckResultActivated',(_0x49f6b7,_0x12b41c)=>{this['_onReviewCheckResultActivated'](_0x12b41c);}),this['_currentReviewCheckRun']['on']('reviewCheckResultDeactivated',()=>{this['_onReviewCheckResultDeactivated']();});try{await this['_currentReviewCheckRun']['start']();}catch(_0x46bc18){_0x46bc18 instanceof Error&&_0x46bc18['message']['includes']('ai-request-aborted')||(_0x46bc18 instanceof ht?this['_logError'](_0x46bc18):this['_logError'](new ht('ai-review-mode-check-run-failed',this,void 0x0,_0x46bc18)));}}else this['_logError'](new ht('ai-review-mode-source-check-not-found',this,{'checkId':_0x4d11b5['id']}));}['abort'](){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['abort']();}['getAvailableChecks'](){return this['_availableReviewChecks']??[];}['getCurrentCheckRun'](){return this['_currentReviewCheckRun'];}['_createReviewCheckRun'](_0x50a60a,_0x494293){return new AIReviewSystemCheckRun(this['_aiReviewCoreEditing']['getDocumentData'](),_0x494293,this['_aiConnector'],_0x50a60a['params'],_0x50a60a['args']);}['_onChangeMarkerRemoved'](_0x19ff5b,_0x2e8a1c){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['markChangeAsOutdated'](_0x2e8a1c['changeId']);}['_onChangeMarkerRestored'](_0x21ac9c,_0xda8258){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['markChangeAsPending'](_0xda8258['changeId']);}['_onCheckRunFinished'](){this['_aiReviewCoreUi']['showReviewCompletedView']();}['_initRequiredPlugins'](){this['_aiConnector']=this['context']['plugins']['get']('AIConnector');}['_onReviewRunLeave'](_0x1cb787=!0x1){this['_currentReviewCheckRun']&&(this['_currentReviewCheckRun']['hasModifications']||this['_currentReviewCheckRun']['sendRating'](),this['_currentReviewCheckRun']['stopListening'](),this['_currentReviewCheckRun']['abort'](),this['_currentReviewCheckRun']=void 0x0),_0x1cb787&&this['_aiReviewCoreUi']['showReviewCheckList'](),this['_aiReviewCoreEditing']['clearAllMarkers'](),this['_aiReviewCoreEditing']['switchToEdit'](),this['_changeActivationSource']=null;for(const _0x1ac75b of this['_aiReviewCoreEditing']['getEditors']())_0x1ac75b['editing']['view']['change'](_0x12711e=>{for(const _0x17f1b8 of _0x1ac75b['editing']['view']['document']['getRoots']())_0x12711e['removeClass']('ck-ai_review-diff',_0x17f1b8),_0x12711e['removeClass']('ck-ai_review-highlights',_0x17f1b8),_0x12711e['removeClass']('ck-ai-translate-mode-content',_0x17f1b8);});}['_logError'](_0x2d2cf8,_0x2d6f98=!0x1){Ct(_0x2d2cf8['message']),_0x2d6f98||(_0x2d2cf8['message']['startsWith']('ai-review-mode-models-unable-to-retrieve')?this['_aiReviewCoreUi']['showGeneralReviewCoreErrorView']():this['_aiReviewCoreUi']['showGeneralResultsErrorView']());}['_scrollToChange'](_0x26fda6){if('content'===this['_changeActivationSource']){const _0x5da372=this['_aiReviewCoreUi']['getChangeElement'](_0x26fda6);_0x5da372&&Rt(_0x5da372['closest']('.ck-ai_review__check-run-result')||_0x5da372);}else{if('panel'===this['_changeActivationSource']){const _0x37abba=this['_getChangeContentElement'](_0x26fda6);if(!_0x37abba)return;Tt({'target':_0x37abba,'viewportOffset':{'top':0x55,'left':0x0,'bottom':0x0,'right':0x0},'ancestorOffset':0x14,'alignToTop':!0x0});}}}}class AIReviewCustomCheckRun extends AIReviewCheckRun{['_prompt'];['_model'];constructor(_0x2d12f0,_0x1f222b,_0x561efc,_0x3cf3a7,_0x3959c9){super(_0x561efc,_0x3cf3a7,_0x3959c9),this['_prompt']=_0x2d12f0,this['_model']=_0x1f222b;}get['subTitle'](){return this['_prompt'];}['_createApiRequest'](){return this['_aiConnector']['callCustomReview']({'content':this['_documentData']['content'],'prompt':this['_prompt'],'model':this['_model']});}['_sendRatingRequest'](_0x3da6ab,_0x27587b,_0xf86d2f){return this['_aiConnector']['upsertCustomAIReviewRating'](_0x27587b,_0x3da6ab,_0xf86d2f);}}class AIReviewCheck{['id'];['commandId'];['title'];['description'];['isParameterized'];['useArgs'];['options'];['args'];get['apiId'](){return this['commandId'];}constructor(_0x433202){this['id']=_0x433202['id'],this['commandId']=_0x433202['commandId'],this['title']=_0x433202['title'],this['description']=_0x433202['description'],this['isParameterized']=_0x433202['isParameterized'],this['useArgs']=_0x433202['useArgs'],this['options']=_0x433202['options'],this['args']=_0x433202['args'];}}class AIReviewCheckExtra extends AIReviewCheck{['isExtra']=!0x0;['prompt'];['model'];['_defaultModel']=null;constructor(_0x2693d9,_0x20d36e,_0x3bd362){super(_0x2693d9),this['prompt']=_0x2693d9['prompt'],this['model']=_0x2693d9['model'],this['model']?this['_defaultModel']=_0x20d36e['find'](_0x23bd03=>_0x23bd03['id']===this['model'])||null:this['_defaultModel']=_0x3bd362;}get['defaultModel'](){return this['_defaultModel'];}}class AIReviewExtraCheckRun extends AIReviewCustomCheckRun{get['subTitle'](){return'';}set['prompt'](_0x2d9419){this['_prompt']=_0x2d9419;}set['model'](_0x33d575){this['_model']=_0x33d575;}}class AIReviewCoreCheckRegistry extends _0x533560{static get['requires'](){return[AIConnector];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['_cache'];['getChecksList'](){return this['_cache']||(this['_cache']=this['_loadChecksList']()),this['_cache'];}}const ir=[{'id':'custom','commandId':'custom','title':'Custom\x20command','description':'Type\x20a\x20custom\x20command\x20to\x20review\x20the\x20content\x20exactly\x20as\x20you\x20need.','isParameterized':!0x0},{'id':'correctness','commandId':'correctness','title':'Correctness','description':'Ensure\x20the\x20text\x20is\x20factually\x20accurate\x20and\x20free\x20of\x20errors.','isParameterized':!0x1},{'id':'clarity','commandId':'clarity','title':'Clarity','description':'Improve\x20the\x20clarity\x20and\x20readability\x20of\x20the\x20text.','isParameterized':!0x1},{'id':'readability','commandId':'readability','title':'Readability','description':'Enhance\x20the\x20overall\x20readability\x20of\x20the\x20text.','isParameterized':!0x1},{'id':'length','commandId':'make','title':'Adjust\x20length','description':'Refine\x20text\x20length\x20to\x20match\x20your\x20needs.','isParameterized':!0x0,'options':[{'formType':'dropdown','label':'Adjust\x20length','default':'longer','data':[{'label':'Longer','id':'longer'},{'label':'Shorter','id':'shorter'}]}]},{'id':'tone','commandId':'make-tone','title':'Adjust\x20tone\x20and\x20style','description':'Choose\x20tone\x20and\x20style\x20to\x20change\x20content\x20as\x20you\x20need.','isParameterized':!0x0,'options':[{'formType':'dropdown','label':'Adjust\x20tone\x20and\x20style','default':'casual','data':[{'label':'Casual','id':'casual'},{'label':'Direct','id':'direct'},{'label':'Friendly','id':'friendly'},{'label':'Confident','id':'confident'},{'label':'Professional','id':'professional'}]}]}];class AIReviewCheckList extends ct(){['_checks']=[];['setupChecks'](_0x414ed5){this['_checks']=_0x414ed5['map'](_0x59318d=>new AIReviewCheck(_0x59318d));}get['checks'](){return this['_checks'];}['getCheckById'](_0x11f949){return this['checks']['find'](_0x3591f1=>_0x3591f1['id']===_0x11f949);}['removeCheckById'](_0x52eb22){this['_checks']=this['_checks']['filter'](_0x446a19=>_0x446a19['id']!==_0x52eb22);}}class AIReviewCheckCustom extends AIReviewCheck{['_models']=[];['_defaultModel']=null;constructor(_0xb56224,_0x4ab0cc,_0x49342a){super(_0xb56224),this['_models']=_0x4ab0cc,this['_defaultModel']=_0x49342a;}get['models'](){return this['_models'];}get['defaultModel'](){return this['_defaultModel'];}}class AIReviewModeCheckList extends AIReviewCheckList{['_allModels']=[];['_recommendedModels']=[];['_defaultModel']=null;constructor(_0x42719b,_0x5ad03c,_0x426ce0){super(),this['_allModels']=_0x42719b,this['_recommendedModels']=_0x5ad03c,this['_defaultModel']=_0x426ce0;}get['allModels'](){return this['_allModels'];}['setupChecks'](_0x585b38){this['_checks']=_0x585b38['map'](_0x2263cb=>!0x0===_0x2263cb['isExtra']?new AIReviewCheckExtra(_0x2263cb,this['_allModels'],this['_defaultModel']):'custom'===_0x2263cb['id']?new AIReviewCheckCustom(_0x2263cb,this['_recommendedModels'],this['_defaultModel']):new AIReviewCheck(_0x2263cb));}}class AIReviewModeCheckRegistry extends AIReviewCoreCheckRegistry{static get['pluginName'](){return'AIReviewModeCheckRegistry';}['_modelsLoadError']=null;constructor(_0x529578){super(_0x529578),this['context']['config']['define']('ai.review.extraCommands',[]);}get['modelsLoadError'](){return this['_modelsLoadError'];}['getExtraChecks'](){return this['context']['config']['get']('ai.review.extraCommands')['map'](_0x325f66=>({'id':_0x325f66['id'],'commandId':_0x325f66['id'],'title':_0x325f66['label'],'description':_0x325f66['description'],'isParameterized':!0x1,'isExtra':!0x0,'prompt':_0x325f66['prompt'],'model':_0x325f66['model']}));}async['_loadChecksList'](){const _0x5285df=[...ir,...this['getExtraChecks']()]['map'](_0x505d2=>_0x505d2['isExtra']?_0x505d2:this['_translateReviewCheck'](_0x505d2)),_0x23eb00=await this['_getModels'](),_0x543ef5=new AIReviewModeCheckList(_0x23eb00['all'],_0x23eb00['recommended'],_0x23eb00['default']);return _0x543ef5['setupChecks'](_0x5285df),_0x543ef5;}async['_getModels'](){const _0x1313f7=this['context']['plugins']['get']('AIConnector');try{const _0x29387d=new AIModels({'connector':_0x1313f7,'config':this['context']['config']['get']('ai.models'),'locale':this['context']['locale']}),_0x572479={'all':await _0x29387d['getAll'](),'recommended':await _0x29387d['getAvailableModels'](),'default':await _0x29387d['getDefault']()};return this['_modelsLoadError']=null,_0x572479;}catch(_0x449d0b){return this['_modelsLoadError']=new ht('ai-review-mode-models-unable-to-retrieve',this,void 0x0,_0x449d0b),Ct(this['_modelsLoadError']['message']),{'all':[],'recommended':[],'default':null};}}['_translateReviewCheck'](_0x5f5080){const _0x214427='AI_REVIEW_CHECK_'+_0x5f5080['id']['toUpperCase']()['replaceAll']('-','_'),_0x5b5ecb={..._0x5f5080,'title':this['_translate'](_0x214427+'_TITLE',_0x5f5080['title']),'description':this['_translate'](_0x214427+'_DESCRIPTION',_0x5f5080['description'])};return _0x5f5080['options']&&(_0x5b5ecb['options']=_0x5f5080['options']['map'](_0x4725f1=>({..._0x4725f1,'label':this['_translate'](_0x214427+'_OPTIONS_LABEL',_0x4725f1['label']||''),'data':_0x4725f1['data']?_0x4725f1['data']['map'](_0x5342fa=>({..._0x5342fa,'label':this['_translate'](_0x214427+'_OPTIONS_DATA_'+_0x5342fa['id']['toUpperCase'](),_0x5342fa['label'])})):void 0x0}))),_0x5b5ecb;}['_translate'](_0x51ecf8,_0x3f17dc){const _0x1f43e5=Mi(this['context']['locale'],_0x51ecf8);return _0x1f43e5===_0x51ecf8?_0x3f17dc:_0x1f43e5;}}class AIReviewModeController extends AIReviewCoreController{static get['pluginName'](){return'AIReviewModeController';}static get['requires'](){return[AIReviewModeCheckRegistry];}['_isDiffOn']=!0x1;['_usesAvailableCommandsConfig'];constructor(_0x153f83){super(_0x153f83),this['_usesAvailableCommandsConfig']=Boolean(this['context']['config']['get']('ai.review.availableCommands')),this['context']['config']['define']('ai.review.availableCommands',ir['map'](_0x58314a=>_0x58314a['id']));}['init'](){super['init'](),this['listenTo'](this['_aiReviewCoreUi'],'toggleDiff',(_0x3aee9a,_0x61bd2a)=>{this['_isDiffOn']=_0x61bd2a['on'],this['_onDiffChange'](this['_isDiffOn']);});}['_initRequiredPlugins'](){super['_initRequiredPlugins'](),this['_aiReviewCoreUi']=this['context']['plugins']['get']('AIReviewModeUI'),this['_aiReviewCoreEditing']=this['context']['plugins']['get']('AIReviewCoreEditing');}['_createReviewCheckRun'](_0xeae9ca,_0x430d56){if(_0xeae9ca['isCustom'])return new AIReviewCustomCheckRun(_0xeae9ca['args']['prompt'],_0xeae9ca['args']['model'],this['_aiReviewCoreEditing']['getDocumentData'](),_0x430d56,this['_aiConnector']);if(_0x430d56['isExtra']){const _0x41ca46=_0x430d56;return new AIReviewExtraCheckRun(_0xeae9ca['args']?.['prompt']??_0x41ca46['prompt'],_0xeae9ca['args']?.['model']??_0x41ca46['defaultModel']['id'],this['_aiReviewCoreEditing']['getDocumentData'](),_0x430d56,this['_aiConnector']);}return new AIReviewSystemCheckRun(this['_aiReviewCoreEditing']['getDocumentData'](),_0x430d56,this['_aiConnector'],_0xeae9ca['params'],_0xeae9ca['args']);}['_onReviewCheckResultActivated'](_0x43b83f){this['_aiReviewCoreUi']['setActiveStateInResults'](_0x43b83f['change']['id']),this['_scrollToChange'](_0x43b83f['change']['id']);const _0x522b55=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x43b83f['change']['id']);if(!_0x522b55)return;const _0xeecdca=this['_aiReviewCoreEditing']['getEditorForChange'](_0x43b83f['change']['id'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x43b83f['change'],()=>_0x522b55['getElement'](),void 0x0,'click',this['_getBalloonDomRoot'](_0xeecdca,_0x522b55['modelRange']['root']['rootName']),_0xeecdca?.['ui']?.['viewportOffset']),this['_aiReviewCoreEditing']['setMarkersInElementAsActive'](_0x43b83f['change']['id']);}['_onReviewCheckResultDeactivated'](){this['_aiReviewCoreUi']['resetActiveStateInResults'](),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_aiReviewCoreEditing']['setAllMarkersAsInactive']();}['_onActivateChange'](_0x25e878){this['_currentReviewCheckRun']&&'click'===_0x25e878['uiInteraction']&&(this['_changeActivationSource']='panel',this['_currentReviewCheckRun']['activateChange'](_0x25e878['id']));}['_onDeactivateChange'](_0x317e45){this['_currentReviewCheckRun']&&'balloon'===_0x317e45['origin']&&this['_currentReviewCheckRun']['deactivateChange']();}['_onChangeMarkerClicked'](_0x4bc9b4,_0x261ef6){if(!this['_currentReviewCheckRun'])return;this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x261ef6['changeId']);const _0xdc4b23=this['_currentReviewCheckRun']['getChangeById'](_0x261ef6['changeId']);if(!_0xdc4b23)return;const _0x3ca11d=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x261ef6['changeId']),_0x27989b=this['_aiReviewCoreEditing']['getEditorForChange'](_0x261ef6['changeId'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0xdc4b23,_0x261ef6['markerElement'],_0x261ef6['domEvent'],'click',this['_getBalloonDomRoot'](_0x27989b,_0x3ca11d?.['modelRange']['root']['rootName']),_0x27989b?.['ui']?.['viewportOffset']);}['_onChangeMarkerHovered'](_0x1c49d4,_0x5137a6){if(!this['_currentReviewCheckRun'])return;if(this['_currentReviewCheckRun']['isAnyChangeActivated']())return;const _0x115414=this['_currentReviewCheckRun']['getChangeById'](_0x5137a6['changeId']);if(!_0x115414)return;const _0xce89ed=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x5137a6['changeId']),_0x18b8fb=this['_aiReviewCoreEditing']['getEditorForChange'](_0x5137a6['changeId'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x115414,_0x5137a6['markerElement'],_0x5137a6['domEvent'],'hover',this['_getBalloonDomRoot'](_0x18b8fb,_0xce89ed?.['modelRange']['root']['rootName']),_0x18b8fb?.['ui']?.['viewportOffset']);}['_onChangeMarkerBlurred'](){if(!this['_currentReviewCheckRun'])return;this['_currentReviewCheckRun']['isAnyChangeActivated']()||this['_aiReviewCoreUi']['hideChangeBalloon']();}['_getChangeContentElement'](_0xb514ea){const _0x54c23d=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0xb514ea);return _0x54c23d?_0x54c23d['getElement']():null;}['_markChangePositionInEditorContent'](_0x3bbeb9,_0x2819b4){this['_aiReviewCoreEditing']['markChangePositionInEditorContent'](_0x3bbeb9,_0x2819b4);}['_diffContent'](_0x18a96f,_0x1e1da0,_0x243f89){return this['_aiReviewCoreEditing']['diffContent'](_0x18a96f,_0x1e1da0,_0x243f89,!0x1);}['_onReviewCheckRun'](){this['_onDiffChange'](this['_isDiffOn']);}['_onDiffChange'](_0x50cf05){_0x50cf05?this['_aiReviewCoreUi']['hideDiffInBalloon']():this['_aiReviewCoreUi']['showDiffInBalloon']();for(const _0x121efb of this['_aiReviewCoreEditing']['getEditors']())_0x121efb['editing']['view']['change'](_0xdafc69=>{for(const _0x536f20 of _0x121efb['editing']['view']['document']['getRoots']()){for(const _0x28f6fd of _0x536f20['getClassNames']())_0x28f6fd['startsWith']('ck-ai_review-')&&_0xdafc69['removeClass'](_0x28f6fd,_0x536f20);_0xdafc69['addClass'](_0x50cf05?'ck-ai_review-diff':'ck-ai_review-highlights',_0x536f20);}});}['_getBalloonDomRoot'](_0x640ec5,_0x4b5067){const _0x558a20=_0x640ec5['editing']['view'];if(_0x4b5067){const _0x5aed3f=_0x558a20['getDomRoot'](_0x4b5067);if(_0x5aed3f)return _0x5aed3f;}return _0x558a20['getDomRoot']()??void 0x0;}async['_getReviewChecks'](){const _0xc051e3=this['context']['plugins']['get']('AIReviewModeCheckRegistry'),_0x50b167=await _0xc051e3['getChecksList']();_0xc051e3['modelsLoadError']&&this['_logError'](_0xc051e3['modelsLoadError']);let _0x1020b1=_0x50b167['checks'];const _0xb57021=this['context']['config']['get']('ai.review.availableCommands');return this['_logWarningForNonExistentChecks'](_0xb57021,_0x1020b1),this['_usesAvailableCommandsConfig']&&(_0x1020b1=_0xb57021['map'](_0x4ba431=>_0x1020b1['find'](_0x45dc77=>_0x45dc77['id']===_0x4ba431))['filter'](_0x4a7686=>!!_0x4a7686)),this['_filterChecksWithMissingModel'](_0x1020b1);}['_logWarningForNonExistentChecks'](_0x2d64db,_0x9e6283){const _0x298783=_0x2d64db['filter'](_0x366bd2=>!_0x9e6283['some'](_0x28e1f9=>_0x28e1f9['id']===_0x366bd2));if(_0x298783['length']){const _0xdd7818=new ht('ai-review-mode-non-existent-commands-used',this,{'commandIds':_0x298783['join'](',\x20')});wt(_0xdd7818['message']);}}['_filterChecksWithMissingModel'](_0x27b179){const _0x3d401d=[];return _0x27b179['forEach'](_0x49138b=>{(_0x49138b instanceof AIReviewCheckExtra&&!_0x49138b['defaultModel']||_0x49138b instanceof AIReviewCheckCustom&&!_0x49138b['models']['length'])&&_0x3d401d['push'](_0x49138b['id']);}),_0x3d401d['length']&&_0x3d401d['forEach'](_0x19e330=>{_0x27b179=_0x27b179['filter'](_0x23e869=>_0x23e869['id']!==_0x19e330);const _0x24ae29=new ht('ai-review-mode-command-unavailable-due-to-missing-model',this,{'commandId':_0x19e330});Ct(_0x24ae29['message']);}),_0x27b179;}}class AIRunResult{['_editor'];['_rootName'];['_channelId'];['_sessionId'];['_documentVersion'];['_contentRawOld'];['_contentRawNew'];['_error'];['_isAborted']=!0x1;constructor(_0x3e2cd6){this['_editor']=_0x3e2cd6['editor'],this['_rootName']=_0x3e2cd6['rootName'],this['_channelId']=_0x3e2cd6['channelId'],this['_sessionId']=_0x3e2cd6['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'](_0x3babeb){this['_documentVersion']=_0x3babeb;}get['contentRawOld'](){return this['_contentRawOld'];}set['contentRawOld'](_0x1b734c){this['_contentRawOld']=_0x1b734c;}get['contentRawNew'](){return this['_contentRawNew'];}set['contentRawNew'](_0x1e2350){this['_contentRawNew']=_0x1e2350;}get['contentOld'](){return this['_dropDataIds'](this['_contentRawOld']||'');}get['contentNew'](){return this['_dropDataIds'](this['_contentRawNew']||'');}get['error'](){return this['_error'];}set['error'](_0x2685f5){this['_error']=_0x2685f5;}['abort'](){this['_isAborted']=!0x0;}['_dropDataIds'](_0x2b1d11){return _0x2b1d11['replace'](/ data-id="[a-z0-9]+"/g,'');}}class AIReviewRunResult extends AIRunResult{['_affectedBlocks']=[];get['affectedBlocks'](){return this['_affectedBlocks'];}set['affectedBlocks'](_0x3aea76){this['_affectedBlocks']=_0x3aea76;}}class AIGateway extends _0x533560{static get['pluginName'](){return'AIGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['apply'](_0x53f5e4,_0x5a34ca){if('completed'!==_0x53f5e4['status'])throw new ht('ai-gateway-apply-invalid-status',this,{'status':_0x53f5e4['status']});const _0x494a74=_0x53f5e4['editor'];if('suggest'===_0x5a34ca&&!_0x494a74['plugins']['has']('TrackChanges'))throw new ht('ai-no-track-changes',this);const _0x100ffa='suggest'===_0x5a34ca,_0x36d711=this['context']['plugins']['get'](_0x4fc25b),_0x3f16a1=_0x494a74['model']['createPositionAt'](_0x494a74['model']['document']['getRoot'](),0x0),_0x1ef27a=_0x36d711['getDiff'](_0x53f5e4['contentRawOld'],_0x53f5e4['contentRawNew'],{'anchor':_0x3f16a1,'markDeletions':_0x100ffa,'targetEditor':_0x494a74}),_0x59feed=_0x494a74['model']['document']['history']['getOperations'](_0x53f5e4['documentVersion']),_0x3dc4e1={'document':_0x494a74['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1},_0xcf99aa=_0x18252b(_0x1ef27a['getOperations'](),_0x59feed,_0x3dc4e1)['operationsA'];_0x494a74['model']['change'](_0x5af769=>{if(_0x100ffa)_0x494a74['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0xcf99aa);else{for(const _0x41d9d0 of _0xcf99aa)_0x41d9d0['baseVersion']=_0x494a74['model']['document']['version'],Es(_0x494a74,_0x41d9d0),_0x5af769['batch']['addOperation'](_0x41d9d0),_0x494a74['model']['applyOperation'](_0x41d9d0);}});}['mergeChangesIntoContent'](_0x552bab,_0x1eb164,_0x227994){const _0x287d2d=new AIResponseParser(),_0x57622f=new AIResponseApplier();let _0x5ee56e=_0x287d2d['parseAndNormalizeHTML'](_0x1eb164);for(const _0x13aef2 of _0x552bab)try{const _0x55f092=_0x287d2d['parseAndNormalizeHTML'](_0x13aef2['content']);_0x5ee56e=_0x57622f['merge'](_0x55f092,_0x5ee56e,{'cutAfterUnstable':!0x1,'replaceRemovedWith':void 0x0})['parsedContent'];}catch(_0x16d63b){throw new ht('ai-gateway-merge-failed',this,{..._0x13aef2},_0x16d63b);}return os(_0x227994,_0x287d2d['parseAndNormalizeHTML'](_0x1eb164),_0x5ee56e,!0x1,!0x1)['content'];}}class AIReviewGateway extends _0x533560{static get['pluginName'](){return'AIReviewGateway';}static get['requires'](){return[AIReviewCoreEditing,AIReviewModeCheckRegistry,AIConnector,AIEditing,AIGateway];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['getAllCommands'](){const _0x4fb906=this['context']['plugins']['get']('AIReviewModeCheckRegistry');return(await _0x4fb906['getChecksList']())['checks']['map'](_0xdbae66=>{const _0x2fea1c={'id':_0xdbae66['id'],'title':_0xdbae66['title'],'description':_0xdbae66['description']};return'custom'!==_0xdbae66['id']&&_0xdbae66['options']?.['length']&&(_0x2fea1c['parameters']=_0xdbae66['options'][0x0]['data']['map'](_0x4a4f40=>({..._0x4a4f40}))),_0x2fea1c;});}async['getAvailableModels'](){const _0x286ff4=this['context']['plugins']['get']('AIConnector');return new AIModels({'connector':_0x286ff4,'config':this['context']['config']['get']('ai.models'),'locale':this['context']['locale']})['getAll']();}async['runReview'](_0x253912,_0x1ad35d){return await this['_runReviewCheck'](_0x253912,()=>this['_createReviewCheckRun'](_0x253912,_0x1ad35d?.['parameterId']),_0x1ad35d?.['signal']);}async['runCustomReview'](_0x4dd090,_0x1a4fd9){return await this['_runReviewCheck']('custom',()=>this['_createCustomReviewCheckRun']('custom',_0x4dd090,_0x1a4fd9?.['model']),_0x1a4fd9?.['signal']);}['applyReview'](_0x5e8541,_0x43f678){this['context']['plugins']['get']('AIGateway')['apply'](_0x5e8541,_0x43f678);}async['_runReviewCheck'](_0x4f580c,_0x1097d2,_0x22d0ba){const _0x4731eb=ms(this['context']),_0xc2544b=new AIReviewRunResult({'editor':_0x4731eb,'rootName':_0x4731eb['model']['document']['getRootNames']()[0x0],'channelId':this['context']['config']['get']('collaboration.channelId'),'sessionId':_0x4731eb['plugins']['get']('AIEditing')['getSessionId'](_0x4731eb)});let _0x46dc0a,_0x352197;if(_0x22d0ba){if(_0x22d0ba['aborted'])return _0xc2544b['abort'](),_0xc2544b;const _0x45b41d=()=>{_0xc2544b['error']||(_0xc2544b['abort'](),_0x46dc0a&&_0x46dc0a['abort']());};_0x22d0ba['addEventListener']('abort',_0x45b41d),_0x352197=()=>_0x22d0ba['removeEventListener']('abort',_0x45b41d);}try{_0x46dc0a=await _0x1097d2(),_0xc2544b['contentRawOld']=_0x46dc0a['documentData']['content'],_0xc2544b['documentVersion']=Array['from'](_0x46dc0a['documentData']['elements'])['find'](([,_0x4b5831])=>_0x4b5831['rootName']===_0xc2544b['rootName'])?.[0x1]['documentVersion']??0x1,_0x46dc0a['on']('reviewCheckRunUpdated',(_0x16dd76,_0x23e734)=>{'aborted'===_0x23e734['status']?_0xc2544b['abort']():'error-general'!==_0x23e734['status']&&'error-chunk'!==_0x23e734['status']||(_0xc2544b['error']=this['_normalizeError'](_0x23e734['error'],'ai-reviewgateway-review-command-run-failed',{'checkId':_0x4f580c}));}),'aborted'!==_0xc2544b['status']&&await _0x46dc0a['start']();}catch(_0x1f65e3){_0xc2544b['error']=this['_normalizeError'](_0x1f65e3,'ai-reviewgateway-review-command-run-failed',{'checkId':_0x4f580c});}finally{_0x352197&&_0x352197();}if(!_0x46dc0a||'aborted'===_0xc2544b['status']||'error'===_0xc2544b['status'])return _0xc2544b;_0xc2544b['affectedBlocks']=_0x46dc0a['results']['map'](_0x343350=>({'id':_0x343350['id'],'content':_0x343350['contentNew']}));try{_0xc2544b['contentRawNew']=Ki(this['context']['plugins']['get']('AIGateway')['mergeChangesIntoContent'](_0xc2544b['affectedBlocks'],_0xc2544b['contentRawOld'],_0xc2544b['editor']));}catch(_0x3afb64){_0xc2544b['error']=this['_normalizeError'](_0x3afb64,'ai-reviewgateway-review-command-run-failed',{'checkId':_0x4f580c});}return _0xc2544b;}async['_createReviewCheckRun'](_0x12d255,_0x2322f2){const _0x2e1f98=(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['find'](_0x29cefb=>_0x29cefb['id']===_0x12d255);if(!_0x2e1f98)throw new ht('ai-reviewgateway-unknown-command',this,{'checkId':_0x12d255});if(_0x2e1f98 instanceof AIReviewCheckCustom)throw new ht('ai-reviewgateway-not-a-system-command',this,{'checkId':_0x12d255});const _0x5409b9=this['context']['plugins']['get']('AIReviewCoreEditing')['getDocumentData'](),_0x2e0aaa=this['context']['plugins']['get']('AIConnector');if(_0x2e1f98 instanceof AIReviewCheckExtra){if(!_0x2e1f98['defaultModel']?.['id'])throw new ht('ai-reviewgateway-missing-custom-command-model',this,{'checkId':_0x12d255});return new AIReviewExtraCheckRun(_0x2e1f98['prompt'],_0x2e1f98['defaultModel']['id'],_0x5409b9,_0x2e1f98,_0x2e0aaa);}return new AIReviewSystemCheckRun(_0x5409b9,_0x2e1f98,_0x2e0aaa,_0x2322f2?[_0x2322f2]:void 0x0);}async['_createCustomReviewCheckRun'](_0x44260b,_0x38e3e8,_0x40bb6a){const _0x5b40de=(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['find'](_0xcddda=>_0xcddda['id']===_0x44260b);if(!_0x5b40de)throw new ht('ai-reviewgateway-unknown-command',this,{'checkId':_0x44260b});if(!(_0x5b40de instanceof AIReviewCheckCustom))throw new ht('ai-reviewgateway-not-a-custom-command',this,{'checkId':_0x44260b});const _0x57fa27=_0x40bb6a??_0x5b40de['defaultModel']?.['id'];if(!_0x38e3e8)throw new ht('ai-reviewgateway-missing-custom-command-prompt',this,{'checkId':_0x44260b});if(!_0x57fa27)throw new ht('ai-reviewgateway-missing-custom-command-model',this,{'checkId':_0x44260b});return new AIReviewCustomCheckRun(_0x38e3e8,_0x57fa27,this['context']['plugins']['get']('AIReviewCoreEditing')['getDocumentData'](),_0x5b40de,this['context']['plugins']['get']('AIConnector'));}['_normalizeError'](_0x41f35d,_0x21272e,_0x54e490){let _0x59d9ff=_0x41f35d;return _0x41f35d instanceof ht||(_0x59d9ff=new ht(_0x21272e,this,_0x54e490,_0x41f35d)),_0x59d9ff;}}class AIReviewMode extends _0x533560{static get['requires'](){return[AIReviewModeController,AIReviewModeUI,AIReviewCoreEditing,AIReviewGateway];}static get['pluginName'](){return'AIReviewMode';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['startReview'](_0x802902,_0x578146){if(this['assertStartReviewPreconditions'](_0x802902)instanceof AIReviewCheckCustom)throw new ht('ai-reviewmode-not-a-system-command',this,{'commandId':_0x802902});const _0x5962f5=this['context']['plugins']['get']('AIReviewModeController');await _0x5962f5['runCheck']({'id':_0x802902,'params':_0x578146?.['parameterId']?[_0x578146['parameterId']]:void 0x0});}async['startCustomReview'](_0x980987,_0x54d412){if(!_0x980987)throw new ht('ai-reviewmode-missing-custom-command-prompt',this);const _0x441b59=ir['find'](_0x595948=>'custom'===_0x595948['commandId'])['id'],_0x3bbbc9=this['assertStartReviewPreconditions'](_0x441b59),_0x337416=_0x54d412?.['model']??_0x3bbbc9['defaultModel']?.['id'];if(!_0x337416)throw new ht('ai-reviewmode-missing-custom-command-model',this);const _0x44996c=this['context']['plugins']['get']('AIReviewModeController');await _0x44996c['runCheck']({'id':_0x441b59,'isCustom':!0x0,'args':{'prompt':_0x980987,'model':_0x337416}});}['getAvailableCommands'](){return this['context']['plugins']['get']('AIReviewModeController')['getAvailableChecks']()['map'](_0xf0bbce=>{const _0x22eefc={'id':_0xf0bbce['id'],'title':_0xf0bbce['title'],'description':_0xf0bbce['description']};return'custom'!==_0xf0bbce['id']&&_0xf0bbce['options']?.['length']&&(_0x22eefc['parameters']=_0xf0bbce['options'][0x0]['data']['map'](_0x4922a7=>({..._0x4922a7}))),_0x22eefc;});}['assertStartReviewPreconditions'](_0x529d3b){const _0x403a33=this['context']['plugins']['get']('AIReviewModeController');if(_0x403a33['getCurrentCheckRun']())throw new ht('ai-reviewmode-review-already-running',this);const _0x19db85=_0x403a33['getAvailableChecks']()['find'](_0x3772a4=>_0x3772a4['id']===_0x529d3b);if(!_0x19db85)throw new ht('ai-reviewmode-unknown-command',this,{'commandId':_0x529d3b});const _0x1fe4ea=this['context']['plugins']['get']('AITabs')['view'];return _0x1fe4ea['isVisible']=!0x0,_0x1fe4ea['activateTab']('reviewMode'),_0x19db85;}}class AITranslateCheckRun extends AIReviewSystemCheckRun{['_title'];constructor(_0x2b3b2a,_0x4e8e6d,_0x542a0e,_0x4a7b93,_0x438bac,_0x1217f7){super(_0x2b3b2a,_0x4e8e6d,_0x542a0e,_0x438bac,_0x1217f7),this['_title']=_0x4a7b93;}get['title'](){return this['_title'];}get['subTitle'](){return this['_sourceCheck']['title'];}}class AITranslateCheck extends AIReviewCheck{get['apiId'](){return'translate';}}class AITranslateCheckList extends AIReviewCheckList{['setupChecks'](_0x4538e8){this['_checks']=_0x4538e8['map'](_0x4a7ac4=>new AITranslateCheck(_0x4a7ac4));}}const sr=[{'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'}];class AITranslateCheckRegistry extends AIReviewCoreCheckRegistry{static get['pluginName'](){return'AITranslateCheckRegistry';}constructor(_0x58ce43){super(_0x58ce43),this['context']['config']['define']('ai.translate.languages',sr);}async['_loadChecksList'](){const _0x551dbc=[],_0xbc532d=this['context']['config']['get']('ai.translate.languages')||[];for(const _0x5b6b8f of _0xbc532d)_0x551dbc['push']({'title':_0x5b6b8f['label'],'id':_0x5b6b8f['id'],'commandId':_0x5b6b8f['id'],'description':'','isParameterized':!0x1,'useArgs':!0x0,'args':{'language':_0x5b6b8f['id']}});const _0x1b5d72=new AITranslateCheckList();return _0x1b5d72['setupChecks'](this['_translateChecks'](_0x551dbc)),_0x1b5d72;}['_translateChecks'](_0x22f528){const _0x6360e7=this['context']['locale'];return _0x22f528['map'](_0x66c6c9=>{const _0x194aba='AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_'+_0x66c6c9['title']['toUpperCase']()['replaceAll']('-','_'),_0x37aac8=Mi(_0x6360e7,_0x194aba);return{..._0x66c6c9,'title':_0x37aac8===_0x194aba?_0x66c6c9['title']:_0x37aac8};});}}class AITranslateController extends AIReviewCoreController{static get['pluginName'](){return'AITranslateController';}static get['requires'](){return[AITranslateCheckRegistry];}['_onCheckRunFinished'](){this['_onReviewRunLeave'](!0x0);}['_initRequiredPlugins'](){super['_initRequiredPlugins'](),this['_aiReviewCoreUi']=this['context']['plugins']['get']('AITranslateUI'),this['_aiReviewCoreEditing']=this['context']['plugins']['get']('AIReviewCoreEditing');}['_createReviewCheckRun'](_0x553e06,_0x14a376){return new AITranslateCheckRun(this['_aiReviewCoreEditing']['getDocumentData'](),_0x14a376,this['_aiConnector'],Mi(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),_0x553e06['params'],_0x553e06['args']);}['_onReviewCheckResultActivated'](_0x528e51){this['_aiReviewCoreUi']['setActiveStateInResults'](_0x528e51['change']['id']),this['_aiReviewCoreEditing']['setMarkersInElementAsActive'](_0x528e51['change']['id']);}['_onReviewCheckResultDeactivated'](){this['_aiReviewCoreEditing']['setAllMarkersAsInactive'](),this['_aiReviewCoreUi']['resetActiveStateInResults']();}['_onActivateChange'](_0x5bc4ea){this['_currentReviewCheckRun']&&('hover'===_0x5bc4ea['uiInteraction']&&(this['_changeActivationSource']='panel',this['_currentReviewCheckRun']['activateChange'](_0x5bc4ea['id'])),'click'===_0x5bc4ea['uiInteraction']&&this['_scrollToChange'](_0x5bc4ea['id']));}['_onDeactivateChange'](_0x3729a2){this['_currentReviewCheckRun']&&'panel'===_0x3729a2['origin']&&this['_currentReviewCheckRun']['deactivateChange']();}['_onChangeMarkerClicked'](_0x30ed80,_0x25afc5){this['_currentReviewCheckRun']&&(this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x25afc5['changeId']),this['_scrollToChange'](_0x25afc5['changeId']));}['_onChangeMarkerHovered'](_0x3a469a,_0x49f2c9){this['_currentReviewCheckRun']&&(this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x49f2c9['changeId']),this['_aiReviewCoreEditing']['reactivateMarkers'](_0x49f2c9['changeId']));}['_onChangeMarkerBlurred'](){this['_currentReviewCheckRun']&&'content'===this['_changeActivationSource']&&(this['_currentReviewCheckRun']['deactivateChange'](),this['_aiReviewCoreEditing']['setAllMarkersAsInactive']());}['_getChangeContentElement'](_0x4e98ef){return this['_aiReviewCoreEditing']['getContentElementForChange'](_0x4e98ef);}['_markChangePositionInEditorContent'](_0x4e4f36,_0x267d24){this['_aiReviewCoreEditing']['markChangePositionInEditorContent'](_0x4e4f36,_0x267d24);}['_diffContent'](_0x2e2c84,_0x5cf09e,_0x4898f2){return this['_aiReviewCoreEditing']['diffContent'](_0x2e2c84,_0x5cf09e,_0x4898f2,!0x0);}['_onReviewCheckRun'](){for(const _0x3cec25 of this['_aiReviewCoreEditing']['getEditors']())_0x3cec25['editing']['view']['change'](_0x4ee9a0=>{for(const _0x5dbf6d of _0x3cec25['editing']['view']['document']['getRoots']())_0x4ee9a0['addClass']('ck-ai-translate-mode-content',_0x5dbf6d);});}async['_getReviewChecks'](){return(await this['context']['plugins']['get']('AITranslateCheckRegistry')['getChecksList']())['checks'];}}class AITranslateCheckResultsView extends AIReviewCoreUICheckResultsView{constructor(_0x1c9980,_0x18a956){super(_0x1c9980,_0x18a956),this['on']('set:isLoading',(_0x3638b4,_0x72cec9,_0x1f28fd)=>{_0x1f28fd&&(this['headerTitle']=Mi(this['locale'],'AI_TRANSLATE_CHECK_RESULTS_LOADING_TITLE'));}),this['on']('set:isResultReady',(_0x1b650c,_0x1e2e03,_0x2639b4)=>{_0x2639b4&&(this['headerTitle']=Mi(this['locale'],'AI_TRANSLATE_CHECK_RESULTS_READY_TITLE'));});}['_createAcceptAllButtonView'](){const _0x2271a7=super['_createAcceptAllButtonView']();return _0x2271a7['set']('label',Mi(this['locale'],'AI_TRANSLATE_ACCEPT_ALL')),_0x2271a7;}['_createExitReviewButtonView'](){const _0x3a0551=super['_createExitReviewButtonView']();return _0x3a0551['set']('label',Mi(this['locale'],'AI_CHAT_HISTORY_CANCEL')),_0x3a0551;}}class AITranslateCheckListView extends AIReviewCoreReviewCheckListView{['_setupTemplate'](){const _0x1cfc36=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-translate__check-list-wrapper',_0x1cfc36['if']('isVisible','ck-hidden',_0x5bdf93=>!_0x5bdf93)]},'children':[{'tag':'div','attributes':{'class':['ck-ai-translate__check-list-header']},'children':[{'tag':'h2','children':[{'text':Mi(this['locale'],'AI_TRANSLATE_CHECK_LIST_HEADER_TITLE')}]},{'tag':'p','children':[{'text':Mi(this['locale'],'AI_TRANSLATE_CHECK_LIST_HEADER_DESCRIPTION')}]}]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list',_0x1cfc36['if']('isVisible','ck-hidden',_0x33f7ba=>!_0x33f7ba)]},'children':this['_checkViews']}]});}}class AITranslateUI extends AIReviewCoreUI{static get['pluginName'](){return'AITranslateUI';}['createMainView'](){const _0x336f4a=this['context']['plugins']['get']('AITabs'),_0xd7879=this['context']['locale'],_0xa124c=new AIHeaderView(_0xd7879,{'label':Mi(_0xd7879,'AI_REVIEW_CHECK_TRANSLATE_TITLE'),'icon':_0x2e3d1e,'class':'ck-ai-header_review-translate','showResizeButton':_0x336f4a['showResizeButton']});_0xa124c['delegate']('resizeTabs')['to'](_0x336f4a),_0xa124c['bind']('isMaximized')['to'](_0x336f4a['view'],'isMaximized',_0x3db9e6=>_0x3db9e6);const _0x527475=new AIReviewCoreView(_0xd7879,{'header':_0xa124c,'list':new AITranslateCheckListView(_0xd7879),'results':new AITranslateCheckResultsView(_0xd7879,{'generalErrorText':Mi(_0xd7879,'AI_TRANSLATE_GENERAL_ERROR_MESSAGE')}),'completed':new AIReviewCoreReviewCompletedView(_0xd7879,{'headerText':Mi(_0xd7879,'AI_TRANSLATE_FINISH_HEADER_TITLE'),'emptyResultsText':Mi(_0xd7879,'AI_TRANSLATE_EMPTY_RESULTS_TEXT'),'buttonText':Mi(_0xd7879,'AI_TRANSLATE_FINISH_BUTTON_LABEL')})});return _0x527475['extendTemplate']({'attributes':{'class':'ck-ai-translate-mode'}}),_0x527475;}['registerTab'](){const _0x550e0a=this['context']['plugins']['get']('AITabs');_0x550e0a['view']['on']('activateTab',(_0xabcd33,{newTab:_0x228cbe,oldTab:_0x193de8})=>{'translate'===_0x228cbe?this['fire']('getReviewCheckList'):'translate'===_0x193de8&&this['fire']('leaveReview');}),_0x550e0a['view']['addTab']({'id':'translate','buttonLabel':Mi(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),'buttonIcon':_0x2e3d1e,'order':0x0,'content':this['_mainView']});}}class AITranslate extends _0x533560{static get['requires'](){return[AITranslateController,AITranslateUI,AIReviewCoreEditing];}static get['pluginName'](){return'AITranslate';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}export{AIActions,AIAdapter,AIAssistant,AIAssistantUI,AIBalloon,AIChat,AIChatController,AIChatFeedCustomElementView,AIChatHistory,AIChatHistoryController,AIChatHistoryUI,AIChatInteraction,AIChatShortcuts,AIChatUI,AIConnector,AIEditing,AIEditorIntegration,AIGateway,AIInteraction,AIQuickActions,AIQuickActionsUI,AIReply,AIRequestError,AIReviewCheck,AIReviewCheckResult,AIReviewCheckResultChange,AIReviewCheckRun,AIReviewGateway,AIReviewMode,AIReviewCoreController as AIReviewModeController,AIReviewCoreEditing as AIReviewModeEditing,AIReviewModeUI,AIReviewRunResult,AIRunResult,AITabs,AITabsMainView,AITabsView,AITextAdapter,AIToggleButtonUI,AITranslate,AITranslateController,AITranslateUI,AWSTextAdapter,OpenAITextAdapter,ShowAIAssistantCommand,ToggleAICommand,Fi as createResizeButton,Di as getDefaultAICommands};