@ckeditor/ckeditor5-real-time-collaboration 48.4.0-alpha.6 → 48.4.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 (148) hide show
  1. package/dist/index.js +6 -6
  2. package/dist/translations/af.js +1 -1
  3. package/dist/translations/af.umd.js +1 -1
  4. package/dist/translations/ar.js +1 -1
  5. package/dist/translations/ar.umd.js +1 -1
  6. package/dist/translations/ast.js +1 -1
  7. package/dist/translations/ast.umd.js +1 -1
  8. package/dist/translations/az.js +1 -1
  9. package/dist/translations/az.umd.js +1 -1
  10. package/dist/translations/be.js +1 -1
  11. package/dist/translations/be.umd.js +1 -1
  12. package/dist/translations/bg.js +1 -1
  13. package/dist/translations/bg.umd.js +1 -1
  14. package/dist/translations/bn.js +1 -1
  15. package/dist/translations/bn.umd.js +1 -1
  16. package/dist/translations/bs.js +1 -1
  17. package/dist/translations/bs.umd.js +1 -1
  18. package/dist/translations/ca.js +1 -1
  19. package/dist/translations/ca.umd.js +1 -1
  20. package/dist/translations/cs.js +1 -1
  21. package/dist/translations/cs.umd.js +1 -1
  22. package/dist/translations/da.js +1 -1
  23. package/dist/translations/da.umd.js +1 -1
  24. package/dist/translations/de-ch.js +1 -1
  25. package/dist/translations/de-ch.umd.js +1 -1
  26. package/dist/translations/de.js +1 -1
  27. package/dist/translations/de.umd.js +1 -1
  28. package/dist/translations/el.js +1 -1
  29. package/dist/translations/el.umd.js +1 -1
  30. package/dist/translations/en-au.js +1 -1
  31. package/dist/translations/en-au.umd.js +1 -1
  32. package/dist/translations/en-gb.js +1 -1
  33. package/dist/translations/en-gb.umd.js +1 -1
  34. package/dist/translations/en.js +1 -1
  35. package/dist/translations/en.umd.js +1 -1
  36. package/dist/translations/eo.js +1 -1
  37. package/dist/translations/eo.umd.js +1 -1
  38. package/dist/translations/es-co.js +1 -1
  39. package/dist/translations/es-co.umd.js +1 -1
  40. package/dist/translations/es.js +1 -1
  41. package/dist/translations/es.umd.js +1 -1
  42. package/dist/translations/et.js +1 -1
  43. package/dist/translations/et.umd.js +1 -1
  44. package/dist/translations/eu.js +1 -1
  45. package/dist/translations/eu.umd.js +1 -1
  46. package/dist/translations/fa.js +1 -1
  47. package/dist/translations/fa.umd.js +1 -1
  48. package/dist/translations/fi.js +1 -1
  49. package/dist/translations/fi.umd.js +1 -1
  50. package/dist/translations/fr.js +1 -1
  51. package/dist/translations/fr.umd.js +1 -1
  52. package/dist/translations/gl.js +1 -1
  53. package/dist/translations/gl.umd.js +1 -1
  54. package/dist/translations/gu.js +1 -1
  55. package/dist/translations/gu.umd.js +1 -1
  56. package/dist/translations/he.js +1 -1
  57. package/dist/translations/he.umd.js +1 -1
  58. package/dist/translations/hi.js +1 -1
  59. package/dist/translations/hi.umd.js +1 -1
  60. package/dist/translations/hr.js +1 -1
  61. package/dist/translations/hr.umd.js +1 -1
  62. package/dist/translations/hu.js +1 -1
  63. package/dist/translations/hu.umd.js +1 -1
  64. package/dist/translations/hy.js +1 -1
  65. package/dist/translations/hy.umd.js +1 -1
  66. package/dist/translations/id.js +1 -1
  67. package/dist/translations/id.umd.js +1 -1
  68. package/dist/translations/it.js +1 -1
  69. package/dist/translations/it.umd.js +1 -1
  70. package/dist/translations/ja.js +1 -1
  71. package/dist/translations/ja.umd.js +1 -1
  72. package/dist/translations/jv.js +1 -1
  73. package/dist/translations/jv.umd.js +1 -1
  74. package/dist/translations/kk.js +1 -1
  75. package/dist/translations/kk.umd.js +1 -1
  76. package/dist/translations/km.js +1 -1
  77. package/dist/translations/km.umd.js +1 -1
  78. package/dist/translations/kn.js +1 -1
  79. package/dist/translations/kn.umd.js +1 -1
  80. package/dist/translations/ko.js +1 -1
  81. package/dist/translations/ko.umd.js +1 -1
  82. package/dist/translations/ku.js +1 -1
  83. package/dist/translations/ku.umd.js +1 -1
  84. package/dist/translations/lt.js +1 -1
  85. package/dist/translations/lt.umd.js +1 -1
  86. package/dist/translations/lv.js +1 -1
  87. package/dist/translations/lv.umd.js +1 -1
  88. package/dist/translations/ms.js +1 -1
  89. package/dist/translations/ms.umd.js +1 -1
  90. package/dist/translations/nb.js +1 -1
  91. package/dist/translations/nb.umd.js +1 -1
  92. package/dist/translations/ne.js +1 -1
  93. package/dist/translations/ne.umd.js +1 -1
  94. package/dist/translations/nl.js +1 -1
  95. package/dist/translations/nl.umd.js +1 -1
  96. package/dist/translations/no.js +1 -1
  97. package/dist/translations/no.umd.js +1 -1
  98. package/dist/translations/oc.js +1 -1
  99. package/dist/translations/oc.umd.js +1 -1
  100. package/dist/translations/pl.js +1 -1
  101. package/dist/translations/pl.umd.js +1 -1
  102. package/dist/translations/pt-br.js +1 -1
  103. package/dist/translations/pt-br.umd.js +1 -1
  104. package/dist/translations/pt.js +1 -1
  105. package/dist/translations/pt.umd.js +1 -1
  106. package/dist/translations/ro.js +1 -1
  107. package/dist/translations/ro.umd.js +1 -1
  108. package/dist/translations/ru.js +1 -1
  109. package/dist/translations/ru.umd.js +1 -1
  110. package/dist/translations/si.js +1 -1
  111. package/dist/translations/si.umd.js +1 -1
  112. package/dist/translations/sk.js +1 -1
  113. package/dist/translations/sk.umd.js +1 -1
  114. package/dist/translations/sl.js +1 -1
  115. package/dist/translations/sl.umd.js +1 -1
  116. package/dist/translations/sq.js +1 -1
  117. package/dist/translations/sq.umd.js +1 -1
  118. package/dist/translations/sr-latn.js +1 -1
  119. package/dist/translations/sr-latn.umd.js +1 -1
  120. package/dist/translations/sr.js +1 -1
  121. package/dist/translations/sr.umd.js +1 -1
  122. package/dist/translations/sv.js +1 -1
  123. package/dist/translations/sv.umd.js +1 -1
  124. package/dist/translations/th.js +1 -1
  125. package/dist/translations/th.umd.js +1 -1
  126. package/dist/translations/ti.js +1 -1
  127. package/dist/translations/ti.umd.js +1 -1
  128. package/dist/translations/tk.js +1 -1
  129. package/dist/translations/tk.umd.js +1 -1
  130. package/dist/translations/tr.js +1 -1
  131. package/dist/translations/tr.umd.js +1 -1
  132. package/dist/translations/tt.js +1 -1
  133. package/dist/translations/tt.umd.js +1 -1
  134. package/dist/translations/ug.js +1 -1
  135. package/dist/translations/ug.umd.js +1 -1
  136. package/dist/translations/uk.js +1 -1
  137. package/dist/translations/uk.umd.js +1 -1
  138. package/dist/translations/ur.js +1 -1
  139. package/dist/translations/ur.umd.js +1 -1
  140. package/dist/translations/uz.js +1 -1
  141. package/dist/translations/uz.umd.js +1 -1
  142. package/dist/translations/vi.js +1 -1
  143. package/dist/translations/vi.umd.js +1 -1
  144. package/dist/translations/zh-cn.js +1 -1
  145. package/dist/translations/zh-cn.umd.js +1 -1
  146. package/dist/translations/zh.js +1 -1
  147. package/dist/translations/zh.umd.js +1 -1
  148. package/package.json +12 -12
package/dist/index.js CHANGED
@@ -20,9 +20,9 @@
20
20
  *
21
21
  *
22
22
  */
23
- import{Context as _0x9ae67d,ContextPlugin as _0x3aa93e,PendingActions as _0x107a72,Plugin as _0x154ef0}from'@ckeditor/ckeditor5-core';import{CKEditorError as _0x5215b6,Collection as _0x7bbdee,DomEmitterMixin as _0x151f83,KeystrokeHandler as _0x5152c2,global as _0x8fcf5d,uid as _0x3290e7,version as _0xafa472}from'@ckeditor/ckeditor5-utils';import{BalloonPanelView as _0x46878c,BodyCollection as _0x2c299b,LabelView as _0x5d18b9,ListItemView as _0x941e32,ListView as _0x587fe3,Notification as _0x44bbc0,View as _0x2c1459,clickOutsideHandler as _0x4de315}from'@ckeditor/ckeditor5-ui';import{History as _0x54352f,InsertOperation as _0x32bb5c,MarkerOperation as _0x413fa2,ModelLiveRange as _0x456eb7,NoOperation as _0x2ec628,OperationFactory as _0x2b4517,RootAttributeOperation as _0x45d274,transformOperationSets as _0x30e6e6}from'@ckeditor/ckeditor5-engine';import{CloudServices as _0x204621}from'@ckeditor/ckeditor5-cloud-services';import{CollaborativeEditingService as _0x56ed59,CommentsService as _0x487668,EditorService as _0x4554c4,RevisionHistoryService as _0x169a8e,TrackChangesService as _0x52b3d3,User as _0x2b3046,WEB_SOCKET_GATEWAY_STATES as _0x4a6974,WebSocketGateway as _0x2137ca}from'@ckeditor/ckeditor-cloud-services-collaboration';import{UserView as _0x5e52fe,Users as _0x4c0308}from'@ckeditor/ckeditor5-collaboration-core';import{Compressor as _0x14a1a8}from'@ckeditor/ckeditor5-operations-compressor';import{TrackChanges as _0x1099e3,TrackChangesEditing as _0x5d1ba1}from'@ckeditor/ckeditor5-track-changes';import{Comments as _0x363913,CommentsEditing as _0x1496d8,CommentsRepository as _0x276c38}from'@ckeditor/ckeditor5-comments';import{RevisionHistory as _0x286dd0}from'@ckeditor/ckeditor5-revision-history';import{isElement as _0x2e44e9}from'es-toolkit/compat';var z=class WebSocketGateway extends _0x3aa93e{static WebSocketGateway=/* #__PURE__ -- @preserve */
24
- ((()=>_0x2137ca)());static initialReconnectionInterval=0x3e8;connection;_reconnectionStack;_shouldPluginsReconnect;_domEmitter;static get requires(){return[_0x204621,_0x44bbc0];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x3a6883){super(_0x3a6883),this['set']('state',_0x4a6974['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=new(_0x151f83())();}init(){const _0xad15bc=this['context'],_0x3c437a=_0xad15bc['plugins']['get'](_0x204621),_0x8dc0cc=_0xad15bc['plugins']['get'](_0x44bbc0);if(!_0x3c437a['token'])throw new _0x5215b6('websocketgateway-missing-token',this);if(!_0x3c437a['webSocketUrl'])throw new _0x5215b6('websocketgateway-missing-websocket-url',this);return this['_domEmitter']['listenTo'](window,'offline',()=>this['_isBrowserOffline']=!0x0),this['_domEmitter']['listenTo'](window,'online',()=>this['_isBrowserOffline']=!0x1),this['context']['config']['define']('cloudServices.connectionTimeout',0xa),this['context']['config']['define']('cloudServices.requestTimeout',0x14),WebSocketGateway['WebSocketGateway']['connect'](_0x3c437a['token'],_0x3c437a['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0x13c1df=>{if(this['connection']=_0x13c1df,this['bind']('state')['to'](_0x13c1df,'state',this,'_isBrowserOffline',(_0x502e9e,_0x45a791)=>('connected'!==_0x502e9e&&(this['_shouldPluginsReconnect']=!0x0),_0x45a791||_0x502e9e!==_0x4a6974['CONNECTED']?_0x4a6974['DISCONNECTED']:this['state']==_0x4a6974['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),_0x4a6974['CONNECTING']):_0x4a6974['CONNECTED'])),this['connection']['on']('error',(_0x501b57,_0x1f6c6b)=>{if('limitExceeded'!==_0x1f6c6b['code'])throw console['error'](_0x1f6c6b),new _0x5215b6('cloudservices-init',null,{'originalError':_0x1f6c6b});_0x8dc0cc['showWarning']('The\x20limit\x20of\x20maximum\x20concurrent\x20connections\x20that\x20the\x20collaboration\x20server\x20can\x20handle\x20has\x20been\x20reached.\x20Try\x20opening\x20the\x20document\x20again\x20in\x20a\x20few\x20minutes.\x20Please\x20contact\x20your\x20system\x20administrator\x20if\x20the\x20problem\x20persists.',{'title':'Connected\x20users\x20limit\x20exceeded','namespace':'real-time-collaboration'});}),!_0x13c1df['me'])return new Promise(_0x4e03d7=>_0x13c1df['on']('change:me',_0x4e03d7));})['catch'](_0x4ba03e=>{throw console['error'](_0x4ba03e),new _0x5215b6('cloudservices-init',null,{'originalError':_0x4ba03e});});}addToReconnectionStack(_0x275b46){if('function'!=typeof _0x275b46['reconnect'])throw new _0x5215b6('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0x275b46))throw new _0x5215b6('websocketgateway-plugin-already-registered',this,{'name':_0x275b46['constructor']['pluginName']});this['_reconnectionStack']['add'](_0x275b46);}removeFromReconnectionStack(_0x36f57d){this['_reconnectionStack']['delete'](_0x36f57d);}isInReconnectionStack(_0x11d88a){return this['_reconnectionStack']['has'](_0x11d88a);}_reconnect(){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0x590ce9=>_0x590ce9['reconnect']())))['then'](()=>this['state']=_0x4a6974['CONNECTED'])['catch'](_0x13c2c6=>{throw console['error'](_0x13c2c6),new _0x5215b6('cloudservices-reconnection-error',this['context']);});}disconnect(){this['connection']&&this['connection']['disconnect'](),this['state']=_0x4a6974['DISCONNECTED'],this['_domEmitter']['stopListening']();}destroy(){this['disconnect'](),super['destroy']();}},Y=class extends _0x3aa93e{['channelSessions'];channelConnectedUsers;allConnectedUsers;_registeredSessions;_uniqueUsersCount;['_users'];static get['pluginName'](){return'Sessions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}static get requires(){return[z,_0x4c0308];}constructor(_0x6c2979){super(_0x6c2979),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0x7bbdee(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x4c0308);}init(){const _0x4dbcf8=this['context']['plugins']['get'](z);this['listenTo'](_0x4dbcf8,'change:state',(_0x32d31b,_0x18dbc3,_0xbc0e7)=>{if('connected'!==_0xbc0e7)this['channelSessions']['forEach'](_0x322d39=>_0x322d39['clear']()),this['channelConnectedUsers']['forEach'](_0x2adba0=>_0x2adba0['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x214040,_0x170133]of this['_registeredSessions'])for(const _0x445981 of _0x170133)this['_handleSessionAdd'](_0x214040,_0x445981);}}),this['_createUser'](_0x4dbcf8['connection']['me'],!0x0);}register(_0x1284cd,_0x41e543){if(this['_registeredSessions']['has'](_0x1284cd))throw new _0x5215b6('sessions-register-already-registered',null,{'channelId':_0x1284cd});this['_registeredSessions']['set'](_0x1284cd,_0x41e543),this['channelSessions']['set'](_0x1284cd,new _0x7bbdee()),this['channelConnectedUsers']['set'](_0x1284cd,new _0x7bbdee()),this['listenTo'](_0x41e543,'add',(_0x2b79ef,_0x4a1f13)=>this['_handleSessionAdd'](_0x1284cd,_0x4a1f13)),this['listenTo'](_0x41e543,'remove',(_0x18a472,_0x58c5b4)=>this['_handleSessionRemove'](_0x1284cd,_0x58c5b4));for(const _0xbd86f2 of _0x41e543)this['_handleSessionAdd'](_0x1284cd,_0xbd86f2);}unregister(_0x4cb4cf){if(!this['_registeredSessions']['has'](_0x4cb4cf))throw new _0x5215b6('sessions-unregister-not-exist',null,{'channelId':_0x4cb4cf});const _0x54ccc1=this['_registeredSessions']['get'](_0x4cb4cf);this['stopListening'](_0x54ccc1);for(const _0x510370 of _0x54ccc1)'connected'===this['context']['plugins']['get'](z)['state']&&this['_handleSessionRemove'](_0x4cb4cf,_0x510370);this['_registeredSessions']['delete'](_0x4cb4cf),this['channelSessions']['delete'](_0x4cb4cf),this['channelConnectedUsers']['delete'](_0x4cb4cf);}get['mySessionId'](){return this['context']['plugins']['get'](z)['connection']['sessionId'];}getUserBySessionId(_0x12e13e){for(const _0x32181b of this['channelSessions']['values']())for(const _0x39bf47 of _0x32181b)if(_0x39bf47['id']===_0x12e13e)return _0x39bf47['user'];}getUserSessions(_0x5b1883,_0x5ccc10){const _0x29a2b6=_0x5ccc10?[this['channelSessions']['get'](_0x5ccc10)]:this['channelSessions']['values'](),_0x608044=new Set();for(const _0x2ac7a6 of _0x29a2b6)for(const _0x344fe5 of _0x2ac7a6)_0x344fe5['user']['id']===_0x5b1883['id']&&_0x608044['add'](_0x344fe5['id']);return _0x608044;}getUserRole(_0x5bc3b0){for(const _0x2ebab7 of this['channelSessions']['values']())for(const _0x57e79c of _0x2ebab7)if(_0x57e79c['user']===_0x5bc3b0)return _0x57e79c['role'];}['_handleSessionAdd'](_0x2f5194,_0x5a567e){if('connected'!==this['context']['plugins']['get'](z)['state'])return;const _0x4eebf2=_0x5a567e['user'],_0x1718f0=this['_users']['getUser'](_0x4eebf2['id'])||this['_createUser'](_0x4eebf2),_0x1cbeb2=Object['assign']({},_0x5a567e,{'user':_0x1718f0});if(this['channelSessions']['get'](_0x2f5194)['add'](_0x1cbeb2),!_0x4eebf2['hiddenInPresenceList']){const _0x474016=this['channelConnectedUsers']['get'](_0x2f5194);_0x474016['has'](_0x1718f0['id'])||_0x474016['add'](_0x1718f0),this['allConnectedUsers']['has'](_0x1718f0['id'])||_0x4eebf2['hiddenInPresenceList']||this['allConnectedUsers']['add'](_0x1718f0,_0x1718f0['isMe']?0x0:void 0x0);}this['fire']('sessionAdd:'+_0x2f5194,{'channelId':_0x2f5194,'session':_0x1cbeb2});}['_handleSessionRemove'](_0x17c9d4,_0x38b0a5){if('connected'!==this['context']['plugins']['get'](z)['state'])return;const _0x406478=this['channelConnectedUsers']['get'](_0x17c9d4),_0x157c1e=_0x38b0a5['user'];_0x157c1e['id']&&(this['channelSessions']['get'](_0x17c9d4)['remove'](_0x38b0a5['id']),_0x406478['has'](_0x157c1e['id'])&&!this['getUserSessions'](_0x157c1e,_0x17c9d4)['size']&&_0x406478['remove'](_0x157c1e['id']),this['allConnectedUsers']['get'](_0x157c1e['id'])&&!this['getUserSessions'](_0x157c1e)['size']&&this['allConnectedUsers']['remove'](_0x157c1e['id']));}_createUser(_0x48f016,_0x503169){const _0x3aed1c=this['_users']['addUser'](_0x48f016);return _0x503169&&this['_users']['defineMe'](_0x48f016['id']),_0x3aed1c['orderNumber']=this['_uniqueUsersCount']++,_0x3aed1c;}},K=class extends _0x154ef0{_domEmitter=new(_0x151f83())();static get requires(){return[Y];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const _0x24396e=this['editor'],_0x1888ca=_0x24396e['plugins']['get'](Y);_0x24396e['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x214e2e,{writer:_0x1d7b8b})=>function(_0x3e16be,_0x1e582d,_0x26e302,_0x2cb8eb){const _0x57568f=_0x3e16be['markerName']['split'](':')[0x2],_0x4306a3=_0x26e302['getUserBySessionId'](_0x57568f);if(!_0x4306a3||_0x57568f===_0x26e302['mySessionId'])return;if(!_0x2cb8eb['model']['schema']['checkChild'](_0x3e16be['markerRange']['start'],'$text'))return;const _0x30c436={'class':'ck-user__marker\x20'+_0x4306a3['color']['getMarkerClass'](),'style':Q(_0x4306a3),'data-name':_0x4306a3['name'],'data-session-id':_0x57568f},_0xbe3c7e=_0x2cb8eb['model']['markers']['get'](_0x3e16be['markerName'])['getStart'](),_0x233a83=_0xbe3c7e['nodeAfter'],_0x30c39b=_0x2cb8eb['model']['schema'];if(_0x233a83&&_0x30c39b['isObject'](_0x233a83)&&_0x30c39b['isInline'](_0x233a83)&&!_0x2cb8eb['model']['markers']['get']('user:range:'+_0x57568f)['getRange']()['isCollapsed'])return;const _0x51fbff=_0xbe3c7e['parent'];return _0x2cb8eb['model']['schema']['isLimit'](_0x51fbff)&&!_0x2cb8eb['model']['hasContent'](_0x51fbff)&&(_0x30c436['contenteditable']=!0x1),function(_0x77a8dd,_0x38036e,_0x3b2512){const _0x2fcc3f=_0x77a8dd['createUIElement']('span',_0x38036e);return _0x77a8dd['setCustomProperty']('userPositionMarker',!0x0,_0x2fcc3f),_0x2fcc3f['render']=function(_0xddb1ed){const _0x43e7b2=this['toDomElement'](_0xddb1ed),_0x4b9f6d=document['createElement']('span');return _0x4b9f6d['classList']['add']('ck-user__marker-tooltip'),_0x4b9f6d['setAttribute']('contenteditable','false'),_0x4b9f6d['setAttribute']('spellcheck','false'),_0x4b9f6d['textContent']=_0x3b2512['name'],_0x43e7b2['innerHTML']='⁠<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span>'+_0x4b9f6d['outerHTML']+'⁠',_0x43e7b2['addEventListener']('mouseenter',()=>{_0x43e7b2['classList']['add']('ck-user__marker_hovered');}),_0x43e7b2['addEventListener']('mouseleave',()=>{_0x43e7b2['classList']['remove']('ck-user__marker_hovered');}),_0x43e7b2;},_0x2fcc3f['isSimilar']=function(_0x561760){return!(!this['getCustomProperty']('userPositionMarker')||!_0x561760['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0x561760['getAttribute']('data-session-id'));},_0x2fcc3f;}(_0x1e582d,_0x30c436,_0x4306a3);}(_0x214e2e,_0x1d7b8b,_0x1888ca,_0x24396e)}),_0x24396e['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0xa88a42=>function(_0x52aab9,_0x432994){const _0xc91215=_0x52aab9['markerName']['split'](':')[0x2];if(_0xc91215===_0x432994['mySessionId'])return null;const _0x45d5d8=_0x432994['getUserBySessionId'](_0xc91215);return _0x45d5d8?{'id':_0xc91215,'classes':['ck-user__selection',_0x45d5d8['color']['getSelectionClass']()],'attributes':{'style':Q(_0x45d5d8),'data-session-id':_0xc91215},'priority':0x7d0+_0x45d5d8['orderNumber']}:{'id':_0xc91215,'classes':[]};}(_0xa88a42,_0x1888ca)}),function(_0x3e706a){const _0xbc4a66=_0x3e706a['model'],_0xe8071=new Map(),_0x45433f=_0x3e706a['plugins']['get'](Y);_0xbc4a66['markers']['on']('update:user:range',(_0x4c5a0b,_0x42ddc3,_0x2fe440,_0x12d759)=>{if(!_0x12d759&&_0xe8071['get'](_0x42ddc3['name']))return _0xe8071['get'](_0x42ddc3['name'])['detach'](),void _0xe8071['delete'](_0x42ddc3['name']);const _0x123018=_0x42ddc3['name']['split'](':')[0x2];if(_0x123018===_0x45433f['mySessionId'])return;const _0x59fae4='user:position:'+_0x123018;_0xbc4a66['markers']['has'](_0x59fae4)&&_0x3e706a['editing']['reconvertMarker'](_0x59fae4),_0x42ddc3['on']('change:range',(_0xdb37bb,_0x843ad9,_0x222d3f)=>{if('$graveyard'!=_0x843ad9['root']['rootName']&&'$graveyard'==_0x42ddc3['getRange']()['root']['rootName']&&!_0xe8071['has'](_0x42ddc3['name'])){const _0x1ba149=_0xbc4a66['schema']['getNearestSelectionRange'](_0x222d3f['deletionPosition']);if(_0x1ba149){const _0x2c867d=_0x456eb7['fromRange'](_0x1ba149);_0xe8071['set'](_0x42ddc3['name'],_0x2c867d),_0x2c867d['on']('change:range',(_0x466803,_0x17f4f4,_0x4e5bd7)=>{if('$graveyard'==_0x2c867d['root']['rootName']){const _0x2d0751=_0xbc4a66['schema']['getNearestSelectionRange'](_0x4e5bd7['deletionPosition']);_0x2d0751?(_0x2c867d['start']=_0x2d0751['start'],_0x2c867d['end']=_0x2d0751['end']):(_0xe8071['delete'](_0x42ddc3['name']),_0x2c867d['detach']());}});}}});}),_0xbc4a66['document']['on']('change',()=>{_0xe8071['size']>0x0&&_0xbc4a66['enqueueChange']({'isUndoable':!0x1},_0x4f2f57=>{for(const [_0xe43fa1,_0x57ef7c]of _0xe8071)'$graveyard'==_0xbc4a66['markers']['get'](_0xe43fa1)['getRange']()['root']['rootName']&&(J(_0xe43fa1['split'](':')[0x2],_0x57ef7c['toRange'](),_0xbc4a66,_0x4f2f57),_0x57ef7c['detach']());_0xe8071['clear']();});});}(_0x24396e),this['_domEmitter']['listenTo'](_0x8fcf5d['document'],'keydown',(_0xb536f1,{key:_0x25c55a})=>{'Escape'===_0x25c55a&&function(_0x1d471f){_0x1d471f['editing']['view']['change'](_0x253c2b=>{for(const _0x596ee2 of _0x1d471f['model']['markers']){if(!_0x596ee2['name']['startsWith']('user:position'))continue;const _0x56497b=_0x1d471f['editing']['mapper']['markerNameToElements'](_0x596ee2['name']);if(_0x56497b){for(const _0x17cab4 of _0x56497b)_0x253c2b['removeClass']('ck-user__marker_hovered',_0x17cab4);}}});}(_0x24396e);},{'useCapture':!0x0});}afterInit(){const _0x9b70f2=this['editor'],_0x2ad4b0=_0x9b70f2['commands']['get']('undo');_0x2ad4b0&&_0x9b70f2['model']['on']('applyOperation',(_0x2426c7,_0x45c39e)=>{const _0x1840f8=_0x45c39e[0x0];if(!_0x1840f8['isDocumentOperation'])return;if('marker'!=_0x1840f8['type']||!_0x1840f8['name']['startsWith']('user:'))return;const _0x289ac5=_0x1840f8['batch'];_0x2ad4b0['_createdBatches']['has'](_0x289ac5)&&(_0x1840f8['newRange']=_0x1840f8['oldRange']?_0x9b70f2['model']['createRange'](_0x1840f8['oldRange']['start'],_0x1840f8['oldRange']['end']):null);},{'priority':'highest'});}destroy(){return this['_domEmitter']['stopListening'](),super['destroy']();}createUserMarkerOperations(){const _0x282766=this['editor'],_0x70504b=_0x282766['model']['document'],_0x569a35=_0x282766['plugins']['get'](Y);_0x282766['model']['enqueueChange']({'isUndoable':!0x1},_0x5adb51=>{const _0x2830b7='user:range:'+_0x569a35['mySessionId'],_0x1fecd8='user:position:'+_0x569a35['mySessionId'],_0x1ff5f5=_0x282766['model']['markers']['has'](_0x2830b7);_0x282766['editing']['view']['hasDomSelection']?J(_0x569a35['mySessionId'],_0x70504b['selection']['getFirstRange'](),_0x282766['model'],_0x5adb51):_0x1ff5f5&&(_0x5adb51['removeMarker'](_0x2830b7),_0x5adb51['removeMarker'](_0x1fecd8));});}};function J(_0x24cebe,_0x437949,_0x504a62,_0x5a9b5f){const _0x54668f='user:range:'+_0x24cebe,_0x5deec0='user:position:'+_0x24cebe,_0x6d9365=_0x437949['getContainedElement']();let _0x1c566f=_0x437949['start'];if(_0x6d9365&&_0x6d9365['is']('element','tableCell')){const _0x4f9800=function(_0x4f4b05,_0x3f03ff){for(const _0x5d1933 of _0x4f4b05['getPositions']())if(_0x3f03ff['schema']['checkChild'](_0x5d1933,'$text'))return _0x5d1933;}(_0x437949,_0x504a62);_0x4f9800&&(_0x1c566f=_0x4f9800,_0x437949=_0x5a9b5f['createRange'](_0x1c566f));}const _0x3ed3a1=_0x5a9b5f['createRange'](_0x1c566f);_0x504a62['markers']['has'](_0x54668f)?(_0x5a9b5f['updateMarker'](_0x54668f,{'range':_0x437949}),_0x5a9b5f['updateMarker'](_0x5deec0,{'range':_0x3ed3a1})):(_0x5a9b5f['addMarker'](_0x54668f,{'range':_0x437949,'usingOperation':!0x0}),_0x5a9b5f['addMarker'](_0x5deec0,{'range':_0x3ed3a1,'usingOperation':!0x0}));}function Q(_0x142541){return'--ck-user-color:'+_0x142541['color']['getColorVariable']()+';--ck-user-color-alpha:'+_0x142541['color']['getColorAlphaVariable']()+';';}function X(_0x20f7f5,_0x18899c,_0x2e6ff0){const _0x5d99a4=_0x20f7f5['t'],t=_0x20f7f5['t'];switch(_0x18899c){case'PENDING_ACTION_SENDING_DATA':return t({'string':'Sending\x20data\x20to\x20the\x20server.','id':'PENDING_ACTION_SENDING_DATA'});case'The\x20local\x20document\x20and\x20server\x20document\x20differ\x20and\x20merging\x20them\x20can\x20cause\x20unexpected\x20behavior.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.':return t('The\x20local\x20document\x20and\x20server\x20document\x20differ\x20and\x20merging\x20them\x20can\x20cause\x20unexpected\x20behavior.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.');case'The\x20document\x20cannot\x20be\x20connected\x20back\x20to\x20the\x20server.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.':return t('The\x20document\x20cannot\x20be\x20connected\x20back\x20to\x20the\x20server.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.');case'The\x20document\x20details\x20could\x20not\x20be\x20taken\x20during\x20the\x20reconnection.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.':return t('The\x20document\x20details\x20could\x20not\x20be\x20taken\x20during\x20the\x20reconnection.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.');case'The\x20last\x20saved\x20version\x20of\x20the\x20document\x20does\x20not\x20match\x20the\x20local\x20version.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.':return t('The\x20last\x20saved\x20version\x20of\x20the\x20document\x20does\x20not\x20match\x20the\x20local\x20version.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.');case'Synchronization\x20issue':return t('Synchronization\x20issue');case'Connected\x20users\x20list\x20dropdown\x20menu':return t('Connected\x20users\x20list\x20dropdown\x20menu');case'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':return t('Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)');case'Connected\x20users\x20list':return t('Connected\x20users\x20list');case'PENDING_ACTION_REVISION_HISTORY':return _0x5d99a4({'string':'Unsaved\x20change\x20in\x20revision\x20history.','id':'PENDING_ACTION_REVISION_HISTORY'});case'CONNECTED_USERS':return t({'string':'1\x20connected\x20user\x20(me)','plural':'%0\x20connected\x20users','id':'CONNECTED_USERS'},_0x2e6ff0);default:return'';}}let Z=0x1;var tt=class RealTimeCollaborationClient extends _0x154ef0{static CollaborativeEditingService=/* #__PURE__ -- @preserve */
25
- ((()=>_0x56ed59)());_offset;['sessionId'];serverHistory;['_channelId'];['_service'];_document;['_compressor'];_bufferedOperations;_knownOperations;_knownRootNames;_pendingAction;_hasSelectionChanged;_sendBufferedOperationsDelayId;['_baseBufferDelay'];_currentBufferDelay;_lastSyncedOperationId;_disconnectionOperations;_operationIdentifier;static get requires(){return[z,Y,K,_0x107a72,_0x4c0308,_0x44bbc0];}static get['pluginName'](){return'RealTimeCollaborationClient';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}get cloudDocumentVersion(){return this['_lastServerVersion']+this['_offset'];}get _lastServerVersion(){return this['serverHistory']['version']-this['_offset'];}get lastSyncVersion(){const _0x56f48f=this['serverHistory']['getOperations']();for(let _0x32f020=_0x56f48f['length']-0x1;_0x32f020>=0x0;_0x32f020--){const _0x5e4c4b=_0x56f48f[_0x32f020];if(!this['_disconnectionOperations']['has'](_0x5e4c4b))return _0x5e4c4b['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0x293f9d){if(super(_0x293f9d),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x54352f(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0x5215b6('collaboration-missing-channelid',this);const _0x5936d9=_0x293f9d['config']['get']('cloudServices.bundleVersion')||_0xafa472;this['_service']=new RealTimeCollaborationClient['CollaborativeEditingService'](_0x5936d9,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0x14a1a8(),this['_bufferedOperations']=[],this['_knownOperations']=new WeakSet(),this['_knownRootNames']=new Set(),this['set']('_isPendingUpdate',!0x1),this['set']('_hasSynchronizationProblem',!0x1),this['_pendingAction']=null,this['_hasSelectionChanged']=!0x1,this['_sendBufferedOperationsDelayId']=null,this['_baseBufferDelay']=0x12c,this['_currentBufferDelay']=this['_baseBufferDelay'],this['_lastSyncedOperationId']=null,this['_disconnectionOperations']=new WeakSet(),this['_operationIdentifier']=new it(this['_disconnectionOperations']);}init(){const _0x34981b=this['editor'],_0x25cde6=_0x34981b['plugins']['get'](_0x4c0308),_0x17f92b=_0x34981b['plugins']['get'](z);this['listenTo'](_0x25cde6,'getOperationAuthor',(_0x452118,_0x36c648)=>{const _0x3b232e=_0x36c648[0x0];_0x3b232e['_authorId']&&(_0x452118['return']=_0x25cde6['getUser'](_0x3b232e['_authorId']),_0x452118['stop']()),null===_0x3b232e['_authorId']&&(_0x452118['return']=null,_0x452118['stop']());},{'priority':'high'}),this['listenTo'](_0x34981b['model']['document']['selection'],'change:range',(_0x38723b,_0x39f3f1)=>{_0x39f3f1['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x34981b['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x34981b['model']['on']('applyOperation',(_0x5614cc,_0x402ea0)=>{const _0xdcf045=_0x402ea0[0x0];_0xdcf045['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0xdcf045),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['set']('_isChannelFlushed',!0x1),this['bind']('_isEditingAllowed')['to'](_0x17f92b,'state',this,'_hasSynchronizationProblem',this,'_isChannelFlushed',(_0x541584,_0x176592,_0x22ae1f)=>'connected'===_0x541584&&!_0x176592&&!_0x22ae1f),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x34981b['disableReadOnlyMode']('rtc-offline'):_0x34981b['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x34981b['disableReadOnlyMode']('rtc-offline'):_0x34981b['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async reconnect(){const _0x2d27ad=this['editor']['plugins']['get'](Y),_0x4c4471=this['editor']['plugins']['get'](z);try{this['_isPendingUpdate']=!0x0,_0x2d27ad['unregister'](this['_channelId']);const _0x435d52=await this['_service']['reconnect'](_0x4c4471['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0x435d52)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x54eed3=await this['_service']['getConnectedSessions']();_0x2d27ad['register'](this['_channelId'],_0x54eed3),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x395642){if(function(_0x8483c0){return'404'===_0x8483c0['code'];}(_0x395642)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0x886619){return'409'===_0x886619['code'];}(_0x395642)){const _0x1e998a=X(this['editor']['locale'],'The\x20document\x20cannot\x20be\x20connected\x20back\x20to\x20the\x20server.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.');this['_handleReconnectionError'](_0x1e998a);}else{if(!(_0x395642 instanceof et))throw _0x395642;this['_handleReconnectionError']();}}}}destroy(){const _0x45d898=this['editor']['plugins']['get'](z),_0x16aa76=this['editor']['plugins']['get'](Y);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x16aa76['channelSessions']['has'](this['_channelId'])&&_0x16aa76['unregister'](this['_channelId']),_0x45d898['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async _handleReconnectionResponse(_0x346014){if(this['sessionId']!==_0x346014['sessionId']&&this['_lastSyncedOperationId']!==_0x346014['lastOperationId'])throw new et();return this['sessionId']=_0x346014['sessionId'],this['_handleServerResponse']([],{..._0x346014,'wereChangesApplied':!0x1,'data':_0x346014['data']},'reconnect');}async _connectService(_0x45c52c,_0x231c28=!0x1){const {connection:_0xe62dc5}=this['editor']['plugins']['get'](z);RealTimeCollaborationClient['CollaborativeEditingService']['getConnectedSessions'](_0xe62dc5,this['_channelId'])['then'](_0x53cb0c=>this['_initSessionsHandling'](_0x53cb0c))['catch'](_0x2eccb1=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x2eccb1);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x1936df,_0x49fb72)=>{this['_crash']('realtimecollaborationclient-init-service-internal-error',_0x49fb72);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_handleChannelDisconnected']();});const _0x55eff2=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x45c52c);this['_isPendingUpdate']=!0x0;const _0x5dda61=await this['_service']['connect'](_0xe62dc5,this['_compressOperations'](_0x45c52c),_0x55eff2);if(this['sessionId']=_0x5dda61['sessionId'],_0x231c28){if(!_0x5dda61['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x5dda61['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0x45c52c,_0x5dda61,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x5dda61,_0x45c52c);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}_handleSendingSelectionMarkers(){const _0x25f924=this['editor']['plugins']['get'](Y),_0x588a00=this['editor']['plugins']['get'](K),_0x284cd4=_0x25f924['channelSessions']['get'](this['_channelId']);_0x284cd4&&_0x284cd4['length']>0x1?_0x588a00['createUserMarkerOperations']():this['listenTo'](_0x25f924,'sessionAdd:'+this['_channelId'],()=>{0x2===_0x25f924['channelSessions']['get'](this['_channelId'])['length']&&_0x588a00['createUserMarkerOperations']();});}async _handleReceivedOperations(_0x3e957c,_0x4f3b5d,_0x15a344,_0x45142d){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x4f3b5d){const _0x1d8533=this['_decompressOperations'](_0x15a344,_0x45142d);await this['_fetchMissingUsers'](_0x1d8533),this['_handleExternalOperations'](_0x1d8533,_0x4f3b5d,_0x15a344['lastOperationId'])||this['_crash']('realtimecollaborationclient-init-service-incorrect-server-operation');}}async _connectAfterSessionHasBeenFlushed(){this['_disconnectService']();const {locale:_0x285f2c}=this['editor'];let _0x1d4d87;try{_0x1d4d87=await this['_service']['getDocumentDetails']();}catch{const _0x30cfbe=X(_0x285f2c,'The\x20document\x20details\x20could\x20not\x20be\x20taken\x20during\x20the\x20reconnection.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.');return void this['_handleReconnectionError'](_0x30cfbe);}const _0xc608e1=_0x1d4d87['currentDocumentSession']||_0x1d4d87['lastDocumentSession'];if(this['_lastSyncedOperationId']!==_0xc608e1['lastOperationId']){const _0x310ef9=X(_0x285f2c,'The\x20last\x20saved\x20version\x20of\x20the\x20document\x20does\x20not\x20match\x20the\x20local\x20version.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.');return void this['_handleReconnectionError'](_0x310ef9);}await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);}_handleChannelDisconnected(){const _0x538c15=this['editor']['plugins']['get'](z);if(this['_isConnected']=!0x1,!_0x538c15['connection']||'connected'!==_0x538c15['connection']['state'])return;this['_isChannelFlushed']=!0x0;const _0x18cfe4=this['editor']['plugins']['get'](Y);_0x18cfe4['channelSessions']['has'](this['_channelId'])&&_0x18cfe4['unregister'](this['_channelId']),_0x538c15['removeFromReconnectionStack'](this),this['_disconnectService']();}_disconnectService(){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['stopListening'](this['_service']);}_initSessionsHandling(_0x3a2c87){const _0x5f4c3a=this['editor']['plugins']['get'](Y);this['listenTo'](_0x5f4c3a,'sessionAdd:'+this['_channelId'],(_0x17f5c9,{session:_0x461598})=>{if(_0x461598['id']===_0x5f4c3a['mySessionId']){_0x17f5c9['off']();const _0x5bb4a3=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0x357c0d=_0x461598['permissions'];_0x5bb4a3&&_0x5bb4a3['isEnabled']&&(_0x357c0d=_0x357c0d['filter'](_0x5a940d=>'document:write'!==_0x5a940d)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0x357c0d,this['_channelId']);}}),_0x5f4c3a['register'](this['_channelId'],_0x3a2c87);}_initThrowingOnDataSet(){const _0x23af2e=this['editor']['data']['set'];this['editor']['data']['set']=(..._0x31c28d)=>{if(!_0x31c28d[_0x31c28d['length']-0x1]['suppressErrorInCollaboration'])throw new _0x5215b6('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x23af2e['apply'](this['editor']['data'],_0x31c28d);};}_setUpDataInit(){this['editor']['data']['on']('init',(_0x30d8a0,[_0xd9e786])=>{if(this['_document']['version'])throw new _0x5215b6('realtimecollaborationclient-init-document-already-initialized',this);_0x30d8a0['stop'](),this['_setPendingAction']();const _0xb9e0b4=Object['fromEntries'](Object['entries'](this['editor']['config']['get']('roots')||{})['filter'](([,_0x1af916])=>!_0x1af916['lazyLoad'])['map'](([_0x2dda19,_0x464e04])=>[_0x2dda19,_0x464e04['modelAttributes']||{}])),_0xd42897=this['_getOperationsFromInitData'](_0xd9e786,_0xb9e0b4);0x0==_0xd42897['length']&&_0xd42897['push'](new _0x2ec628(0x0)),_0x30d8a0['return']=this['_connectService'](_0xd42897)['then'](()=>{this['editor']['plugins']['get'](z)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x4ae3b8=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x4ae3b8))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x4bad16,[_0x1ea54c,_0x47796d])=>{_0x4bad16['stop']();const _0x286751=this['editor']['model']['document']['getRoot'](_0x1ea54c);if(!this['_knownRootNames']['has'](_0x1ea54c)){const _0x1eb8d7=_0x47796d&&_0x47796d['data']?_0x47796d['data']:'',_0x440747=_0x47796d&&_0x47796d['attributes']?_0x47796d['attributes']:{};await this['_loadRoot'](_0x1ea54c,_0x1eb8d7,_0x440747);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0x286751['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0x286751);});},{'priority':'high'});}async _fetchMissingUsers(_0x41c078){const _0x233c69=this['editor']['plugins']['get'](_0x4c0308),{connection:_0x4949a8}=this['editor']['plugins']['get'](z),_0x121171=new Set();for(const _0x404c15 of _0x41c078){const _0x3bb9d2=_0x404c15['_authorId'];_0x3bb9d2&&!_0x233c69['getUser'](_0x3bb9d2)&&_0x121171['add'](_0x3bb9d2);}if(0x0===_0x121171['size'])return;const _0x3c2939=await _0x2b3046['getMany'](_0x4949a8,Array['from'](_0x121171));for(const _0x271211 of _0x3c2939)_0x233c69['getUser'](_0x271211['id'])||_0x233c69['addUser'](_0x271211);}_getOperationsFromInitData(_0x3f4346,_0x56078e={}){const _0x314db9=this['editor']['model'],_0x1a5de8=[];let _0x16710c=0x0;const _0x541081='string'==typeof _0x3f4346?{'main':_0x3f4346}:_0x3f4346;for(const _0x5c473e of Object['keys'](_0x541081)){if(!this['_document']['roots']['has'](_0x5c473e))throw new _0x5215b6('realtimecollaborationclient-init-non-existent-root',this);const _0x4d4131=this['_document']['getRoot'](_0x5c473e),_0xd7f818=this['editor']['data']['parse'](_0x541081[_0x5c473e],_0x4d4131),_0x27a32e=new _0x32bb5c(_0x314db9['createPositionAt'](_0x4d4131,0x0),_0xd7f818,_0x16710c++);_0x1a5de8['push'](_0x27a32e);for(const [_0xdf53ef,_0x221d1a]of _0xd7f818['markers']){const _0x36e964=new _0x413fa2(_0xdf53ef,null,_0x314db9['createRange'](_0x314db9['createPositionFromPath'](_0x4d4131,_0x221d1a['start']['path']['slice']()),_0x314db9['createPositionFromPath'](_0x4d4131,_0x221d1a['end']['path']['slice']())),_0x314db9['markers'],!0x0,_0x16710c++);_0x1a5de8['push'](_0x36e964);}}if(_0x56078e)for(const [_0x2ad97f,_0x407486]of Object['entries'](_0x56078e)){const _0x1464ea=_0x314db9['document']['getRoot'](_0x2ad97f);if(!_0x1464ea)throw new _0x5215b6('multi-root-editor-root-attributes-no-root',null);for(const [_0x507266,_0x111885]of Object['entries'](_0x407486))if(null!==_0x111885){const _0x1ae21e=new _0x45d274(_0x1464ea,_0x507266,null,_0x111885,_0x16710c++);_0x1a5de8['push'](_0x1ae21e);}}return _0x1a5de8;}async _loadRoot(_0x50b709,_0x4f2236,_0x2d7e6a){this['_getOperationsFromInitData']({[_0x50b709]:_0x4f2236},{[_0x50b709]:_0x2d7e6a})['forEach']((_0x200228,_0x2e8721)=>{_0x200228['baseVersion']=this['_document']['version']+_0x2e8721,_0x200228['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x200228);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async _handleInitialConnectionData(_0x345375,_0x313c4e){let _0x28ea2e;this['_offset']=_0x345375['offset'];const _0x2e75b3=_0x345375['wereChangesApplied']&&!_0x345375['initData'],_0xbe46be=_0x2e75b3?0x0:_0x345375['data']['baseVersion'];if(_0x313c4e['forEach'](_0x327bbe=>{_0x327bbe['_isInit']=!0x0,_0x327bbe['createdAt']=_0x345375['sessionCreatedAt'],_0x327bbe['_authorId']=null;}),_0x2e75b3)_0x28ea2e=_0x313c4e,this['_applyOperationsSet'](_0x28ea2e,_0x2e75b3);else{if(_0x345375['initData']){const _0x3e1496=this['_getOperationsFromInitData'](_0x345375['initData']);this['_document']['history']['version']=-_0x3e1496['length'],_0x3e1496['forEach'](_0x42371c=>{_0x42371c['baseVersion']-=_0x3e1496['length'],_0x42371c['createdAt']=_0x345375['sessionCreatedAt'],_0x42371c['_isInit']=!0x0,_0x42371c['_authorId']=null;}),this['_applyOperationsSet'](_0x3e1496,!0x0),this['serverHistory']['version']=-_0x3e1496['length']+this['_offset'],this['_updateServerHistory'](_0x3e1496);}this['_document']['history']['version']=_0xbe46be,_0x28ea2e=this['_decompressOperations'](_0x345375['data'],_0x345375['metadata']),await this['_fetchMissingUsers'](_0x28ea2e),this['_applyOperationsSet'](_0x28ea2e,_0x2e75b3);}_0x345375['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x28ea2e,_0x345375['lastOperationId']),this['_lastSyncedOperationId']=_0x345375['lastOperationId']),this['serverHistory']['version']=_0xbe46be+this['_offset'],this['_updateServerHistory'](_0x28ea2e),_0x313c4e['filter'](_0x1a1c5d=>{const _0x47b3e5=this['_getAffectedRoot'](_0x1a1c5d);return _0x47b3e5&&!this['_knownRootNames']['has'](_0x47b3e5);})['forEach']((_0x5d4434,_0x3101fa)=>{_0x5d4434['baseVersion']=this['_document']['version']+_0x3101fa,this['_saveOperationInBuffer'](_0x5d4434);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x354e6c,_0x5ad599){const _0x43b740=_0x5ad599&&_0x5ad599['message'];if(_0x43b740&&_0x43b740['startsWith']('realtimecollaborationclient'))throw _0x5ad599;const _0x4585b4=this['editor']['plugins']['get'](z);throw this['_isPendingUpdate']=!0x0,_0x4585b4['disconnect'](),this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0x5215b6(_0x354e6c,this['editor'],_0x43b740?{'originalError':_0x43b740}:void 0x0);}_saveOperationInBuffer(_0x42813c){this['_knownOperations']['has'](_0x42813c)||(this['_knownOperations']['add'](_0x42813c),this['_bufferedOperations']['push'](_0x42813c),this['_pendingAction']||'marker'==_0x42813c['type']&&!_0x42813c['affectsData']||this['_setPendingAction']());}_sendBufferedOperationsDelayed(_0xdbd28f=!0x1){!_0xdbd28f&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0x557cd2=>{_0x557cd2&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0x4c01a5=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0xcb982e){return _0xcb982e['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0xcb982e['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0xcb982e['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0x4c01a5)||this['_crash'](_0x4c01a5['message'],_0x4c01a5);});},this['_currentBufferDelay']));}_waitUntilSynced(){return new Promise(_0x1d7e54=>{this['on']('change:_isPendingUpdate',()=>{_0x1d7e54();});});}async _sendBufferedOperations(){const _0x5ae0d8=this['editor']['plugins']['get'](K);if(this['_shouldSendSelectionUpdate']()&&(_0x5ae0d8['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x13112=[...this['_bufferedOperations']];for(const _0x44048d of _0x13112)_0x44048d['wasUndone']=this['_document']['history']['isUndoneOperation'](_0x44048d);const _0x2634fa=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x13112),_0x5abb36=Z++,_0x436322=this['_compressOperations'](_0x13112),_0x2b946d=await this['_service']['sendOperations'](_0x436322,_0x436322['baseVersion'],_0x2634fa);try{return await this['_handleServerResponse'](_0x13112,_0x2b946d,_0x5abb36);}catch(_0x384513){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0x384513);}}async['_handleServerResponse'](_0x3f3e92,_0x5d28c7,_0x23c8e3){if('error'in _0x5d28c7)throw _0x5d28c7['error'];let _0x3f9ac8;if(_0x5d28c7['wereChangesApplied']){_0x5d28c7['lastOperationId']&&(this['_lastSyncedOperationId']=_0x5d28c7['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x297363=>!_0x3f3e92['includes'](_0x297363));for(const _0x14eade of _0x3f3e92)_0x14eade['createdAt']='lastOperationAcceptedAt'in _0x5d28c7&&_0x5d28c7['lastOperationAcceptedAt']||void 0x0;st(_0x3f3e92,_0x5d28c7['version']-_0x3f3e92['length']),this['_updateServerHistory'](_0x3f3e92);const _0x243d66=_0x3f3e92['filter'](_0x3d9ac7=>{if(!_0x3d9ac7['_isInit'])return!0x1;const _0x40a3e1=this['_getAffectedRoot'](_0x3d9ac7);return _0x40a3e1&&!this['_knownRootNames']['has'](_0x40a3e1);});st(_0x243d66,this['_document']['version']),this['_applyOperationsSet'](_0x243d66),_0x3f9ac8=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0x1bca57=this['_decompressOperations'](_0x5d28c7['data'],_0x5d28c7['metadata'])['filter'](_0x4def25=>_0x4def25['baseVersion']>=this['_lastServerVersion']);_0x1bca57['forEach'](_0x4da731=>this['_addKnownRoot'](_0x4da731)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x5b2b15=>!_0x5b2b15['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x5b2b15))),this['_bufferedOperations']['length']&&st(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0x1bca57),_0x3f9ac8=this['_handleExternalOperations'](_0x1bca57,_0x5d28c7['version'],_0x5d28c7['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x3f9ac8?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}_handleExternalOperations(_0x280381,_0x1c42db,_0xa77c7a){try{const _0x2d49ad={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x349e4c,operationsB:_0x4e7f2e,originalOperations:_0x162c09}=_0x30e6e6(_0x280381,this['_bufferedOperations'],_0x2d49ad);st(_0x349e4c,this['_document']['version']),st(_0x4e7f2e,_0x1c42db);for(const _0x551127 of _0x349e4c){const _0x5edcfb=_0x162c09['get'](_0x551127);_0x5edcfb?(_0x551127['_authorId']=_0x5edcfb['_authorId'],'noop'!==_0x551127['type']&&(_0x551127['_aiSource']=_0x5edcfb['_aiSource'])):_0x551127['_authorId']=null;}for(const _0x153b66 of _0x4e7f2e)'noop'!==_0x153b66['type']&&(_0x153b66['_aiSource']=_0x162c09['get'](_0x153b66)?.['_aiSource']);_0xa77c7a&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x280381,_0xa77c7a),this['_lastSyncedOperationId']=_0xa77c7a),this['_bufferedOperations']=[..._0x4e7f2e],this['_applyOperationsSet'](_0x349e4c),this['_updateServerHistory'](_0x280381);}catch(_0x3a4cdd){return console['error'](_0x3a4cdd),!0x1;}return!0x0;}_applyOperationsSet(_0x575a70,_0x151d89=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0x504165=>{for(const _0x5be87b of _0x575a70)this['_knownOperations']['add'](_0x5be87b),this['_addKnownRoot'](_0x5be87b),_0x504165['batch']['addOperation'](_0x5be87b),this['editor']['model']['applyOperation'](_0x5be87b);});}_addKnownRoot(_0xb14030){const _0x4b5d7f=this['_getAffectedRoot'](_0xb14030);_0x4b5d7f&&this['_knownRootNames']['add'](_0x4b5d7f);}_getAffectedRoot(_0x35e75a){let _0x41fd8b,_0xe8c9bf;switch(_0x35e75a['type']){case'insert':_0x41fd8b=_0x35e75a['position']['root'];break;case'marker':if(_0xe8c9bf=_0x35e75a['newRange'],!_0xe8c9bf)return null;_0x41fd8b=_0xe8c9bf['root'];break;case'addRootAttribute':_0x41fd8b=_0x35e75a['root'];break;case'addRoot':_0x41fd8b=_0x35e75a['affectedSelectable'];break;case'move':_0x41fd8b=_0x35e75a['targetPosition']['root'];break;default:return null;}return _0x41fd8b['rootName'];}_updateServerHistory(_0xd1ff10){_0xd1ff10['forEach'](_0x5c1460=>{const _0x122e13=_0x5c1460['clone']();_0x122e13['_authorId']=_0x5c1460['_authorId'],_0x122e13['_isInit']=!!_0x5c1460['_isInit'],_0x122e13['_aiSource']=_0x5c1460['_aiSource'],_0x122e13['createdAt']=_0x5c1460['createdAt'],_0x122e13['baseVersion']+=this['_offset'],_0x5c1460['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x122e13),this['serverHistory']['addOperation'](_0x122e13);});}_handleReconnectionError(_0x4d3031){const _0x213f1d=this['editor']['plugins']['get']('Notification'),_0xc052ba=this['editor']['locale'];_0x4d3031||(_0x4d3031=X(_0xc052ba,'The\x20local\x20document\x20and\x20server\x20document\x20differ\x20and\x20merging\x20them\x20can\x20cause\x20unexpected\x20behavior.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.')),_0x213f1d['showWarning'](_0x4d3031,{'title':X(_0xc052ba,'Synchronization\x20issue'),'namespace':'real-time-collaboration'}),this['_hasSynchronizationProblem']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_bufferedOperations']=[],this['editor']['plugins']['get'](z)['disconnect']();}_setPendingAction(){this['_pendingAction']||(this['_pendingAction']=this['editor']['plugins']['get'](_0x107a72)['add'](X(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}_clearPendingAction(){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x107a72)['remove'](this['_pendingAction']),this['_pendingAction']=null);}_compressOperations(_0x268139){const _0x361c27=_0x268139['map'](_0x1ddab4=>_0x1ddab4['toJSON']());return this['_compressor']['compress'](_0x361c27);}_decompressOperations(_0x3b5a9c,_0x1414b5){return this['_compressor']['decompress'](_0x3b5a9c)['map']((_0x918ad1,_0x3fbc88)=>{const _0x24d353='init'==_0x1414b5[_0x3fbc88]['type'];if('InsertOperation'==_0x918ad1['__className']){const _0x1c3289=_0x918ad1['position']['root'];!this['_document']['getRoot'](_0x1c3289)&&(this['_document']['createRoot']('$unknown',_0x1c3289)['_isAttached']=!0x1);}else{if('RootOperation'==_0x918ad1['__className']){const _0x382d1e=this['_document']['getRoot'](_0x918ad1['rootName']);_0x382d1e&&'$unknown'==_0x382d1e['name']&&_0x918ad1['elementName']!=_0x382d1e['name']&&(_0x382d1e['name']=_0x918ad1['elementName']);}}const _0x5456ac=_0x2b4517['fromJSON'](_0x918ad1,this['_document']);return _0x5456ac['wasUndone']=_0x918ad1['wasUndone'],_0x5456ac['_isInit']=_0x24d353,_0x5456ac['_authorId']=_0x24d353?null:_0x1414b5[_0x3fbc88]['userId'],_0x5456ac['_isDisconnection']='cs:removeUser'===_0x1414b5[_0x3fbc88]['type'],_0x5456ac['_aiSource']=_0x918ad1['_aiSource']||void 0x0,_0x5456ac['createdAt']=_0x1414b5[_0x3fbc88]['createdAt'],_0x5456ac;});}_refreshUserSelectionMarkers(){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}_shouldSendSelectionUpdate(){const _0x25a9d3=this['editor']['plugins']['get'](Y)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0x25a9d3&&_0x25a9d3['length']>0x1&&this['_hasSelectionChanged'];}_shouldSendUpdate(){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}},et=class extends Error{};function st(_0x12e73b,_0x32890e){for(const _0x3b7fda of _0x12e73b)_0x3b7fda['baseVersion']=_0x32890e++;}var it=class{_ignoredOperations;_operationToId;constructor(_0x1cd03b){this['_ignoredOperations']=_0x1cd03b,this['_operationToId']=new WeakMap();}getIdOfTheLastOperation(_0x3d7dd5){let _0x43c17c=_0x3d7dd5['length'];for(;_0x43c17c--;){const _0x2b8c9b=_0x3d7dd5[_0x43c17c];if(!this['_ignoredOperations']['has'](_0x2b8c9b)){if(!this['_operationToId']['has'](_0x2b8c9b)){const _0x3e22c6=_0x3290e7()['slice'](0x1,0x12);this['_operationToId']['set'](_0x2b8c9b,_0x3e22c6);}return this['_operationToId']['get'](_0x2b8c9b);}}}setIdForTheLastOperation(_0x3a7aeb,_0x51d277){if(!_0x51d277)return;let _0x56ac38=_0x3a7aeb['length'];for(;_0x56ac38--;){const _0x2b0f6e=_0x3a7aeb[_0x56ac38];this['_ignoredOperations']['has'](_0x2b0f6e)||this['_operationToId']['set'](_0x2b0f6e,_0x51d277);}}},nt=class extends _0x154ef0{static get requires(){return[tt];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},ot=class CloudServicesCommentsAdapter extends _0x3aa93e{static CommentsService=/* #__PURE__ -- @preserve */
26
- ((()=>_0x487668)());['_services'];static get requires(){return[z,_0x276c38,Y,_0x4c0308];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x5108c9){super(_0x5108c9),this['_services']=new Map();}async init(){const _0x376f21=this['context'],_0x2cf8e2=_0x376f21['plugins']['get'](_0x276c38);if(_0x376f21['plugins']['get'](z)['addToReconnectionStack'](this),_0x2cf8e2['adapter']={'addCommentThread':async({channelId:_0x54fa63,threadId:_0x5b4159,comments:_0x59526c,resolvedAt:_0x4063d2,resolvedBy:_0x6b5763,context:_0x52144a,attributes:_0x3b1b44})=>{const _0x4acc1c=await this['_getService'](_0x54fa63)['addCommentThread']({'commentThreadId':_0x5b4159,'comments':_0x59526c['map'](_0x56734c=>function(_0x2737f7,_0x20e822,_0x1c0c8d){return{'commentThreadId':_0x1c0c8d,'commentId':_0x2737f7['commentId'],'userId':_0x2737f7['authorId'],'content':_0x2737f7['content'],'documentId':_0x20e822,'createdAt':_0x2737f7['createdAt'],'attributes':_0x2737f7['attributes']||{}};}(_0x56734c,_0x54fa63,_0x5b4159)),'resolvedAt':_0x4063d2,'resolvedBy':_0x6b5763,'context':_0x52144a,'attributes':_0x3b1b44})['catch'](ct);return{'threadId':_0x4acc1c['commentThreadId'],'comments':_0x4acc1c['comments']};},'getCommentThread':async({channelId:_0x25ce99,threadId:_0x142d46})=>{const _0x5b731f=await this['_getService'](_0x25ce99)['getCommentThread'](_0x142d46)['catch'](rt)['catch'](ct);return _0x5b731f?_0x5b731f['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0x5b731f]),{'threadId':_0x5b731f['commentThreadId'],'comments':_0x5b731f['comments']['map'](at),'context':_0x5b731f['context'],'resolvedAt':_0x5b731f['resolvedAt'],'resolvedBy':_0x5b731f['resolvedBy'],'attributes':_0x5b731f['attributes']||{}}):null;},'updateCommentThread':async({channelId:_0x207e85,threadId:_0x284e9e,context:_0x466e17,unlinkedAt:_0x44df34,attributes:_0xde569c})=>this['_getService'](_0x207e85)['updateCommentThread']({'commentThreadId':_0x284e9e,'context':_0x466e17,'attributes':_0xde569c,'unlinkedAt':_0x44df34})['catch'](rt)['catch'](ct),'resolveCommentThread':async({channelId:_0x90a046,threadId:_0x212f8e})=>{const _0xf17e10=await this['_getService'](_0x90a046)['resolveCommentThread'](_0x212f8e)['catch'](rt)['catch'](ct);return{'threadId':_0xf17e10['commentThreadId'],'resolvedAt':_0xf17e10['resolvedAt'],'resolvedBy':_0xf17e10['resolvedBy']};},'reopenCommentThread':async({channelId:_0x35f522,threadId:_0x5df5c0})=>this['_getService'](_0x35f522)['reopenCommentThread'](_0x5df5c0)['catch'](rt)['catch'](ct),'removeCommentThread':({channelId:_0x19ce3c,threadId:_0x8fe0cf})=>this['_getService'](_0x19ce3c)['removeCommentThread'](_0x8fe0cf)['catch'](rt)['catch'](ct),'addComment':({channelId:_0x17abf7,threadId:_0x4a1c33,commentId:_0x526446,content:_0x48bf53,attributes:_0x4899c4})=>this['_getService'](_0x17abf7)['addComment'](_0x4a1c33,_0x526446,_0x48bf53,_0x4899c4)['catch'](ct),'updateComment':({channelId:_0x385eb2,threadId:_0x2833fc,commentId:_0xf91d97,content:_0x8adf94,attributes:_0x547eb2})=>this['_getService'](_0x385eb2)['updateComment'](_0x2833fc,_0xf91d97,_0x8adf94,_0x547eb2)['catch'](rt)['catch'](ct),'removeComment':({channelId:_0x12f204,threadId:_0x334373,commentId:_0x59da19})=>this['_getService'](_0x12f204)['removeComment'](_0x334373,_0x59da19)['catch'](rt)['catch'](ct)},_0x376f21 instanceof _0x9ae67d){const _0x47deaa=_0x376f21['config']['get']('collaboration.channelId'),_0x1662a4=_0x376f21['plugins']['get'](Y);await this['_setUpService'](_0x47deaa);const _0x59b026=await this['_services']['get'](_0x47deaa)['getConnectedSessions']();this['listenTo'](_0x1662a4,'sessionAdd:'+_0x47deaa,(_0x5ab529,{session:_0x234ad9})=>{_0x234ad9['id']===_0x1662a4['mySessionId']&&(_0x5ab529['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x234ad9['permissions'],_0x47deaa));}),_0x1662a4['register'](_0x47deaa,_0x59b026);}}async _setUpService(_0xddbf09){if(this['_services']['has'](_0xddbf09))throw new _0x5215b6('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0xddbf09});const _0x17b002=this['context']['plugins']['get'](_0x276c38),_0x1f6304=new CloudServicesCommentsAdapter['CommentsService'](_0xddbf09);this['_services']['set'](_0xddbf09,_0x1f6304),this['listenTo'](_0x1f6304,'commentThreadAdded',(_0xa04f42,_0x7a0a54)=>{const {commentThreadId:_0x1eae24,documentId:_0x57e2c2,context:_0x334a10,attributes:_0x4e00b3,resolvedAt:_0x3cc657,resolvedBy:_0x401b24,comments:_0x32def1}=_0x7a0a54;_0x17b002['getCommentThread'](_0x1eae24)||_0x17b002['addCommentThread']({'threadId':_0x1eae24,'channelId':_0x57e2c2,'comments':_0x32def1?_0x32def1['map'](at):[],'context':_0x334a10,'attributes':_0x4e00b3,'resolvedAt':_0x3cc657,'resolvedBy':_0x401b24,'isFromAdapter':!0x0});}),this['listenTo'](_0x1f6304,'commentThreadUpdated',(_0x257612,{commentThreadId:_0x5bb865,documentId:_0xdf7ed7,context:_0x801160,unlinkedAt:_0x2f7473,attributes:_0x3c59da})=>{_0x17b002['getCommentThread'](_0x5bb865)&&_0x17b002['updateCommentThread']({'threadId':_0x5bb865,'channelId':_0xdf7ed7,'context':_0x801160,'unlinkedAt':_0x2f7473,'attributes':_0x3c59da,'isFromAdapter':!0x0});}),this['listenTo'](_0x1f6304,'commentThreadResolved',(_0x307d96,{commentThreadId:_0xb3bf84,resolvedBy:_0x9882da,resolvedAt:_0x5308f1})=>{const _0x3628ec=_0x17b002['getCommentThread'](_0xb3bf84);_0x3628ec&&_0x3628ec['resolve']({'resolvedBy':_0x9882da,'resolvedAt':_0x5308f1,'isFromAdapter':!0x0});}),this['listenTo'](_0x1f6304,'commentThreadReopened',(_0x3feff3,{commentThreadId:_0x52f28f})=>{const _0x519469=_0x17b002['getCommentThread'](_0x52f28f);_0x519469&&_0x519469['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0x1f6304,'commentThreadRemoved',(_0x5e7b50,{commentThreadId:_0x1ecff4})=>{const _0x29ac84=_0x17b002['getCommentThread'](_0x1ecff4);_0x29ac84&&_0x29ac84['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0x1f6304,'commentAdded',(_0x4b8190,_0x5857ac)=>{const _0x237811=_0x5857ac['commentThreadId'],_0x47940e=_0x17b002['getCommentThread'](_0x237811);_0x47940e&&_0x47940e['addComment']({...at(_0x5857ac),'isFromAdapter':!0x0});}),this['listenTo'](_0x1f6304,'commentUpdated',(_0x212141,{commentThreadId:_0x25f111,commentId:_0x2381b3,content:_0x150432,attributes:_0x32249d})=>{const _0x49553c=_0x17b002['getCommentThread'](_0x25f111);if(_0x49553c){const _0x3a1b47=_0x49553c['getComment'](_0x2381b3);_0x3a1b47&&_0x3a1b47['update']({'content':_0x150432,'attributes':_0x32249d,'isFromAdapter':!0x0});}}),this['listenTo'](_0x1f6304,'commentRemoved',(_0x3c736f,{commentThreadId:_0x4c1790,commentId:_0x10799a})=>{const _0x3fc6d1=_0x17b002['getCommentThread'](_0x4c1790);if(_0x3fc6d1){const _0x2c41a5=_0x3fc6d1['getComment'](_0x10799a);_0x2c41a5&&_0x2c41a5['remove']({'isFromAdapter':!0x0});}}),this['listenTo'](_0x1f6304,'disconnected',()=>{'connected'===this['context']['plugins']['get'](z)['connection']?.['state']&&(this['_services']['delete'](_0xddbf09),this['stopListening'](_0x1f6304));}),await this['_connectService'](_0xddbf09);}destroy(){if(this['context']instanceof _0x9ae67d){const _0x12428f=this['context']['config']['get']('collaboration.channelId');this['_services']['has'](_0x12428f)&&this['_terminateService'](_0x12428f);}}_terminateService(_0x42a5c7){if(!this['_services']['has'](_0x42a5c7))throw new _0x5215b6('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0x42a5c7});this['_getService'](_0x42a5c7)['disconnect'](),this['_services']['delete'](_0x42a5c7);}async reconnect(){for(const _0x3b9590 of this['_services']['keys']())await this['_connectService'](_0x3b9590);if(this['context']instanceof _0x9ae67d){const _0x575a2f=this['context']['config']['get']('collaboration.channelId');if(this['_services']['has'](_0x575a2f)){const _0x1f5630=this['context']['plugins']['get'](Y);_0x1f5630['unregister'](_0x575a2f);const _0x1e819f=await this['_services']['get'](_0x575a2f)['getConnectedSessions']();_0x1f5630['register'](_0x575a2f,_0x1e819f);}}}async _connectService(_0x249f8f){const {connection:_0x2fdb1d}=this['context']['plugins']['get'](z),_0x4d53b2=this['context']['plugins']['get'](_0x276c38),_0x19b462=await this['_services']['get'](_0x249f8f)['connect'](_0x2fdb1d);await this['_fetchMissingUsersForThreads'](_0x19b462);const _0x7221a3=new Set(Array['from'](_0x4d53b2['getCommentThreads']({'channelId':_0x249f8f}),_0x47de87=>_0x47de87['id']));for(const _0x2e3d83 of _0x19b462)_0x2e3d83['deletedAt']||_0x7221a3['delete'](_0x2e3d83['commentThreadId']);for(const _0x52d6eb of _0x7221a3)_0x4d53b2['getCommentThread'](_0x52d6eb)['remove']({'isFromAdapter':!0x0});for(const _0x103977 of _0x19b462){let _0x2d24bc=_0x4d53b2['getCommentThread'](_0x103977['commentThreadId']);const {commentThreadId:_0x5934c7,context:_0xaf59d2,attributes:_0x7ccea6,resolvedBy:_0x2715cf,resolvedAt:_0x2533df,unlinkedAt:_0x4d016c,deletedAt:_0x4d995e}=_0x103977;if(_0x4d995e)continue;_0x2d24bc||(_0x2d24bc=_0x4d53b2['addCommentThread']({'channelId':_0x249f8f,'threadId':_0x5934c7,'context':_0xaf59d2,'attributes':_0x7ccea6||{},'resolvedBy':_0x2715cf,'resolvedAt':_0x2533df,'unlinkedAt':_0x4d016c,'isFromAdapter':!0x0}));const _0x30ad96=new Set(Array['from'](_0x2d24bc['comments'],_0x1f8b3a=>_0x1f8b3a['id']));for(const _0x39c3b9 of _0x103977['comments'])_0x30ad96['delete'](_0x39c3b9['commentId']);for(const _0x5a222f of _0x30ad96)_0x2d24bc['getComment'](_0x5a222f)['remove']({'isFromAdapter':!0x0});for(const _0x11ce0d of _0x103977['comments']){const _0x5c4c84=_0x2d24bc['getComment'](_0x11ce0d['commentId']);_0x5c4c84?_0x5c4c84['content']!==_0x11ce0d['content']&&_0x5c4c84['update']({'content':_0x11ce0d['content'],'isFromAdapter':!0x0}):_0x2d24bc['addComment'](Object['assign'](at(_0x11ce0d),{'isFromAdapter':!0x0}));}}}_getService(_0x4d8358){if(!this['_services']['has'](_0x4d8358))throw new _0x5215b6('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0x4d8358});return this['_services']['get'](_0x4d8358);}async _fetchMissingUsersForThreads(_0x145f5b){const _0x4095c5=this['context']['plugins']['get'](_0x4c0308),{connection:_0x47933c}=this['context']['plugins']['get'](z),_0x75185e=new Set();for(const {resolvedBy:_0x1e6854,comments:_0xd7f85d}of _0x145f5b){_0x1e6854&&!_0x4095c5['getUser'](_0x1e6854)&&_0x75185e['add'](_0x1e6854);for(const {userId:_0x5b6451}of _0xd7f85d)_0x4095c5['getUser'](_0x5b6451)||_0x75185e['add'](_0x5b6451);}if(0x0===_0x75185e['size'])return;const _0x53db56=await _0x2b3046['getMany'](_0x47933c,Array['from'](_0x75185e));for(const _0x2737af of _0x53db56)_0x4095c5['getUser'](_0x2737af['id'])||_0x4095c5['addUser'](_0x2737af);}};async function rt(_0x139dd4){if('404'!==_0x139dd4['code'])throw _0x139dd4;}function ct(_0x2f3e9c){if((_0x26b37d=_0x2f3e9c)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0x26b37d['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x26b37d['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0x26b37d;throw _0x2f3e9c;}function at(_0x4b9279){return{'threadId':_0x4b9279['commentThreadId'],'commentId':_0x4b9279['commentId'],'content':_0x4b9279['content'],'createdAt':_0x4b9279['createdAt'],'authorId':_0x4b9279['userId'],'attributes':_0x4b9279['attributes']||{}};}var ht=class CloudServicesTrackChangesAdapter extends _0x154ef0{static ['TrackChangesService']=/* #__PURE__ -- @preserve */
27
- ((()=>_0x52b3d3)());_bufferedRequests;_trackChangesService;static get requires(){return[ot,_0x5d1ba1,z];}static get['pluginName'](){return'CloudServicesTrackChangesAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x46fc1f){super(_0x46fc1f);const _0x3680d5=this['editor']['config']['get']('collaboration.channelId');this['_bufferedRequests']=new Map(),this['_trackChangesService']=new CloudServicesTrackChangesAdapter['TrackChangesService'](_0x3680d5);}init(){const _0x182dbf=this['editor']['plugins']['get'](z),_0x4ee0b8=this['editor']['plugins']['get'](_0x5d1ba1);return _0x4ee0b8['adapter']={'getSuggestion':async _0x1f1fab=>{await this['_waitForServiceReady']();const _0x5c825f=await this['_trackChangesService']['get'](_0x1f1fab)['catch'](lt);return await this['_fetchMissingUsersForThreads']([_0x5c825f]),_0x5c825f;},'addSuggestion':async({id:_0x4bdc5f,type:_0x462430,data:_0x531393,originalSuggestionId:_0x1ab762,attributes:_0x8362ba})=>{await this['_waitForServiceReady']();const _0x4d5eca={'id':_0x4bdc5f,'type':_0x462430,'data':_0x531393,'originalSuggestionId':_0x1ab762,'attributes':_0x8362ba},_0x287b80=await this['_trackChangesService']['add'](_0x4bdc5f,_0x462430,_0x531393,_0x1ab762,_0x8362ba)['catch'](_0x1d74b5=>{if(dt(_0x1d74b5))return new Promise(_0x2bb613=>{this['_bufferedRequests']['set'](_0x4bdc5f,{'resolve':_0x2bb613,'suggestionData':_0x4d5eca});});throw _0x1d74b5;});return this['_bufferedRequests']['delete'](_0x4bdc5f),_0x287b80;},'updateSuggestion':async(_0x5af76d,_0xf9776)=>{if(await this['_waitForServiceReady'](),'open'!==_0xf9776['state'])return this['_trackChangesService']['update'](_0x5af76d,_0xf9776)['catch'](lt);}},this['listenTo'](this['_trackChangesService'],'suggestionUpdated',(_0x458ee8,_0x1ccbaf)=>{_0x4ee0b8['hasSuggestion'](_0x1ccbaf['id'])&&(_0x4ee0b8['getSuggestion'](_0x1ccbaf['id'])['attributes']=_0x1ccbaf['attributes']);}),this['listenTo'](this['_trackChangesService'],'disconnected',()=>{'connected'===_0x182dbf['connection']?.['state']&&(_0x182dbf['removeFromReconnectionStack'](this),this['stopListening'](this['_trackChangesService']));}),this['_trackChangesService']['connect'](_0x182dbf['connection'])['then'](_0x344ba3=>(_0x182dbf['addToReconnectionStack'](this),this['_fetchMissingUsersForThreads'](_0x344ba3)['then'](()=>{for(const _0x2bc57b of _0x344ba3){_0x4ee0b8['addSuggestionData'](_0x2bc57b)['_saved']=!0x0;}})));}async reconnect(){const _0x1bb4e3=this['editor']['plugins']['get']('TrackChangesEditing'),{connection:_0x277161}=this['editor']['plugins']['get'](z),_0x10528e=await this['_trackChangesService']['connect'](_0x277161);await this['_fetchMissingUsersForThreads'](_0x10528e);for(const {suggestionData:_0x2c4cfb,resolve:_0x533199}of this['_bufferedRequests']['values']()){let _0x427224=_0x10528e['find'](_0x1dde03=>_0x1dde03['id']===_0x2c4cfb['id']);_0x427224||(_0x427224=await this['_trackChangesService']['add'](_0x2c4cfb['id'],_0x2c4cfb['type'],_0x2c4cfb['data'],_0x2c4cfb['originalSuggestionId'])),_0x533199(_0x427224);}for(const _0x3498f0 of _0x10528e)_0x1bb4e3['hasSuggestion'](_0x3498f0['id'])||_0x1bb4e3['addSuggestionData'](_0x3498f0);}async _waitForServiceReady(){this['_trackChangesService']['isConnected']||await new Promise(_0x47ffe8=>{this['listenTo'](this['_trackChangesService'],'connected',_0x1deddd=>{_0x1deddd['off'](),_0x47ffe8();});});}async _fetchMissingUsersForThreads(_0x14ff2b){const _0x4d9e81=this['editor']['plugins']['get'](_0x4c0308),{connection:_0x38f11f}=this['editor']['plugins']['get'](z),_0xba9448=new Set();for(const {authorId:_0x595708}of _0x14ff2b)_0x4d9e81['getUser'](_0x595708)||_0xba9448['add'](_0x595708);if(0x0===_0xba9448['size'])return;const _0xeeebb5=await _0x2b3046['getMany'](_0x38f11f,Array['from'](_0xba9448));for(const _0x4265b1 of _0xeeebb5)_0x4d9e81['getUser'](_0x4265b1['id'])||_0x4d9e81['addUser'](_0x4265b1);}};function lt(_0x36b9da){if(dt(_0x36b9da))return new Promise(()=>{});throw _0x36b9da;}function dt(_0x2a8a3f){return _0x2a8a3f['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x2a8a3f['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}var ut=class extends _0x154ef0{static get requires(){return[_0x363913,ot,nt,z];}static get['pluginName'](){return'RealTimeCollaborativeComments';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const _0x2ab80c=this['editor']['plugins']['get'](z),_0xb3e7b1=this['editor']['plugins']['get'](_0x1496d8),_0xaced13=this['editor']['plugins']['get'](ot);return this['editor']['data']['once']('ready',()=>{this['listenTo'](_0x2ab80c,'change:state',(_0x2e7fd8,_0x4c9162,_0x1fa86d)=>{_0xb3e7b1['isThreadsLoadingPaused']='connected'!==_0x1fa86d;});}),this['listenTo'](_0x2ab80c,'change:state',(_0xa811b0,_0x43b47a,_0x21de11)=>{this['editor']['plugins']['get'](_0x276c38)['switchReadOnly']('connected'!==_0x21de11);}),_0xaced13['_setUpService'](this['editor']['config']['get']('collaboration.channelId'));}destroy(){const _0x335b8e=this['editor']['plugins']['get'](ot),_0xf63131=this['editor']['config']['get']('collaboration.channelId');_0x335b8e['_services']['has'](_0xf63131)&&_0x335b8e['_terminateService'](_0xf63131),super['destroy']();}},ft=class extends _0x154ef0{static get requires(){return[ut,ht,_0x1099e3];}static get['pluginName'](){return'RealTimeCollaborativeTrackChanges';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},mt=class CloudServicesRevisionHistoryAdapter extends _0x154ef0{static RevisionHistoryService=/* #__PURE__ -- @preserve */
28
- ((()=>_0x169a8e)());_lastRequestId;['_revisionTracker'];_revisionHistoryService;_oldOffset;static get requires(){return[z,tt,_0x286dd0,Y,_0x4c0308];}static get['pluginName'](){return'CloudServicesRevisionHistoryAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x43bbe4){super(_0x43bbe4);const _0x2d0057=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new CloudServicesRevisionHistoryAdapter['RevisionHistoryService'](_0x2d0057);}async init(){const _0x3dfea4=this['editor']['plugins']['get'](tt),_0x2c09b8=_0x3dfea4['serverHistory'],_0x5cca3e=this['editor']['plugins']['get'](z);this['_revisionTracker']['setSource']({'history':_0x2c09b8,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0x3dfea4['sessionId']});const _0x435ee7=this['editor']['config']['get']('cloudServices.bundleVersion')||_0xafa472,_0x22c82a=await _0x4554c4['isBundleUploaded'](_0x5cca3e['connection'],_0x435ee7);this['editor']['plugins']['get'](_0x286dd0)['adapter']={'getRevision':async({revisionId:_0x1c7594})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0x1c7594)),'updateRevisions':async _0x1a302a=>{await this['_waitForServiceReady']();const _0x270bdf=this['_revisionTracker']['currentRevision'];if(_0x22c82a&&0x1===_0x1a302a['length']&&_0x1a302a[0x0]['id']===_0x270bdf['id'])return _0x1a302a;for(const _0x1cad50 of _0x1a302a)_0x1cad50['id']===_0x270bdf['id']&&(_0x1cad50['isEmptyCurrent']=_0x1cad50['fromVersion']===_0x1cad50['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0x1a302a,this['_lastRequestId'])['then'](_0x145820=>(this['_lastRequestId']=_0x145820,_0x1a302a))['catch'](_0x12c3ae=>{if(pt(_0x12c3ae)||'400'===_0x12c3ae['code']&&void 0x0!==_0x12c3ae['data']['wrongRequestId']){for(const _0xe7e041 of _0x1a302a)this['_revisionTracker']['repository']['getRevision'](_0xe7e041['id'])&&this['_revisionTracker']['_bufferUpdate'](_0xe7e041['id'],_0xe7e041,!0x1);if(pt(_0x12c3ae)&&'destroyed'!==this['editor']['state'])throw _0x12c3ae;return _0x1a302a;}throw _0x12c3ae;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0x3f6904,{revisionsData:_0x570eca,requestId:_0x2fcfdd})=>{Math['max'](..._0x570eca['map'](_0x142cf6=>_0x142cf6['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0x570eca,_0x2fcfdd);}):this['_handleRevisionsUpdate'](_0x570eca,_0x2fcfdd);}),this['set']('_isServiceConnected',!0x1),this['listenTo'](this['_revisionHistoryService'],'connected',()=>{this['_isServiceConnected']=!0x0;}),this['listenTo'](this['_revisionHistoryService'],'disconnected',()=>{this['_isServiceConnected']=!0x1,'connected'===_0x5cca3e['connection']?.['state']&&(_0x5cca3e['removeFromReconnectionStack'](this),this['stopListening'](this['_revisionHistoryService']));});const {revisions:_0x2bb572,requestId:_0x5a73ff}=await this['_revisionHistoryService']['connect'](_0x5cca3e['connection']);_0x5cca3e['addToReconnectionStack'](this),this['_lastRequestId']=_0x5a73ff,await this['_fetchMissingUsers'](_0x2bb572);for(const _0x2b3d08 of _0x2bb572)this['_revisionTracker']['addRevisionData'](_0x2b3d08);this['listenTo'](_0x3dfea4,'change:_isConnected',(_0x36dd6c,_0x376afa,_0x2fd55d)=>{_0x2fd55d&&(this['_oldOffset']=_0x3dfea4['_offset'],_0x36dd6c['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](this,'_isServiceConnected');}async reconnect(){const _0x299845=this['editor']['plugins']['get'](z),_0x5cabe8=this['editor']['plugins']['get'](tt),_0x5abcd1=async()=>{const _0x14b01a=this['_revisionTracker']['currentRevision'],_0x5334b7=_0x14b01a['id'],_0x8a0bb=_0x5334b7!==_0x5cabe8['sessionId'];if(_0x8a0bb){const _0x264b4b=_0x5cabe8['_offset']-this['_oldOffset'],_0x1ffc90=this['_getLatestVersionFromServerOperations']();if(this['_revisionTracker']['_revisionDataBuilder']['reInit'](),_0x14b01a['toVersion']+_0x264b4b!==_0x1ffc90){const _0x5a2960=_0x14b01a['fromVersion']+_0x264b4b,_0x5226ce=this['editor']['plugins']['get'](_0x4c0308),_0x2cf7a7=this['_revisionTracker']['buildRevisionData']({'revision':_0x14b01a,'from':_0x5a2960,'to':_0x1ffc90});_0x2cf7a7['id']=_0x14b01a['id'];const _0x3c5456=_0x2cf7a7['authorsIds']['map'](_0x37451e=>_0x5226ce['getUser'](_0x37451e));_0x14b01a['_update']({..._0x2cf7a7,'authors':_0x3c5456},!0x0),this['_revisionTracker']['_bufferUpdate'](_0x14b01a['id'],_0x2cf7a7,!0x0);}this['_revisionTracker']['_startingVersion']=_0x1ffc90,_0x14b01a['toVersion']!==_0x14b01a['fromVersion']||this['_revisionTracker']['_bufferedUpdates']['has'](_0x5334b7)||this['_revisionTracker']['repository']['_revisions']['remove'](_0x5334b7),this['_revisionTracker']['_createCurrentRevision'](_0x1ffc90);}const {revisions:_0x263bb6,requestId:_0x5a5b8c}=await this['_revisionHistoryService']['reconnect'](_0x299845['connection'],this['_lastRequestId']);_0x8a0bb&&_0x263bb6['length']>0x0?_0x5cabe8['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x263bb6),this['_handleRevisionsUpdate'](_0x263bb6,_0x5a5b8c),this['_revisionTracker']['sendBufferedUpdates']());};return _0x5cabe8['_isConnected']?_0x5abcd1():new Promise((_0xd7579c,_0x347093)=>{_0x5cabe8['once']('change:_isConnected',()=>{_0x5abcd1()['then'](_0xd7579c)['catch'](_0x347093);});});}destroy(){super['destroy']();}async _waitForServiceReady(){this['_revisionHistoryService']['isConnected']||await new Promise(_0x10b3e4=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x20a755=>{_0x20a755['off'](),_0x10b3e4();});});}_getLatestVersionFromServerOperations(){const _0x258a01=this['editor']['plugins']['get'](tt)['serverHistory']['getOperations']()['reverse']();for(const _0x1d6663 of _0x258a01)if('marker'!==_0x1d6663['type']||_0x1d6663['affectsData'])return _0x1d6663['baseVersion']+0x1;}_getLatestVersion(){const _0x1b4d5c=this['editor']['plugins']['get'](tt);return new Promise(_0x459a84=>{_0x1b4d5c['_isPendingUpdate']?_0x1b4d5c['once']('change:_isPendingUpdate',()=>{_0x459a84(this['_getLatestVersionFromServerOperations']());}):_0x459a84(this['_getLatestVersionFromServerOperations']());});}_handleRevisionsUpdate(_0x37fc5e,_0x42af65){const _0x300fef=this['_revisionTracker']['repository'];this['_lastRequestId']=_0x42af65;for(const _0x8a5813 of _0x37fc5e){const _0x4334e9=_0x300fef['getRevision'](_0x8a5813['id']);if(_0x4334e9){if((_0x8a5813['fromVersion']||_0x8a5813['toVersion'])&&(_0x8a5813['diffData']=null),_0x4334e9===this['_revisionTracker']['currentRevision']){const _0x276b3f=Math['max'](_0x4334e9['toVersion'],_0x8a5813['toVersion']),_0x2dccb7=Math['max'](_0x4334e9['fromVersion'],_0x8a5813['fromVersion']);let _0xb9c902;_0x4334e9['toVersion']===_0x8a5813['toVersion']&&_0x4334e9['fromVersion']===_0x8a5813['fromVersion']?(_0xb9c902=!0x0,this['_preventResendingRevisionData'](_0x8a5813)):_0x8a5813['toVersion']===_0x276b3f&&_0x8a5813['fromVersion']===_0x2dccb7?_0xb9c902=!0x1:(_0x4334e9['toVersion']===_0x276b3f&&_0x4334e9['fromVersion']===_0x2dccb7||this['_fixRevision']({'revision':_0x4334e9,'from':_0x2dccb7,'to':_0x276b3f}),_0xb9c902=!0x0),_0xb9c902&&(delete _0x8a5813['fromVersion'],delete _0x8a5813['toVersion'],delete _0x8a5813['diffData'],delete _0x8a5813['createdAt'],delete _0x8a5813['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0x8a5813),this['_preventResendingRevisionData'](_0x8a5813);}else this['_revisionTracker']['addRevisionData'](_0x8a5813);}const _0x2ad972=_0x300fef['getRevisions']();_0x2ad972['reverse']();for(let _0x491684=0x0;_0x491684<_0x2ad972['length']-0x1;_0x491684++){const _0x5baf59=_0x2ad972[_0x491684],_0x4ab679=_0x2ad972[_0x491684+0x1];if(_0x5baf59['fromVersion']<_0x4ab679['toVersion']){const _0x139e7a=_0x4ab679['toVersion'],_0x54f1e7=Math['max'](_0x139e7a,_0x5baf59['toVersion']);this['_fixRevision']({'revision':_0x5baf59,'from':_0x139e7a,'to':_0x54f1e7});}}}['_fixRevision']({revision:_0x583209,from:_0x50601a,to:_0xce0158}={}){const _0x4ea567=this['editor']['plugins']['get'](_0x4c0308),_0x5e06f9=this['_revisionTracker']['buildRevisionData']({'revision':_0x583209,'from':_0x50601a,'to':_0xce0158});_0x5e06f9['authors']=_0x5e06f9['authorsIds']['map'](_0x2f2e54=>_0x4ea567['getUser'](_0x2f2e54)),_0x583209['_update'](_0x5e06f9);}_preventResendingRevisionData(_0x102877){const _0x1c472e={};_0x1c472e['id']=_0x102877['id'];for(const _0xb8ee97 of Object['keys'](_0x102877))'id'!==_0xb8ee97&&(_0x1c472e[_0xb8ee97]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0x1c472e['id'],_0x1c472e,!0x0);}async _fetchMissingUsers(_0x5822cc){const _0x1ea0ab=this['editor']['plugins']['get'](_0x4c0308),{connection:_0x121792}=this['editor']['plugins']['get'](z),_0x29606d=new Set();for(const _0x1347c5 of _0x5822cc){for(const _0x584284 of _0x1347c5['authorsIds'])_0x5e50af(_0x584284);_0x1347c5['creatorId']&&_0x5e50af(_0x1347c5['creatorId']);}if(0x0===_0x29606d['size'])return;const _0x39ae94=await _0x2b3046['getMany'](_0x121792,Array['from'](_0x29606d));for(const _0x14e474 of _0x39ae94)_0x1ea0ab['getUser'](_0x14e474['id'])||_0x1ea0ab['addUser'](_0x14e474);function _0x5e50af(_0x1147e0){_0x1ea0ab['getUser'](_0x1147e0)||_0x29606d['add'](_0x1147e0);}}};function pt(_0x5a71c9){return _0x5a71c9['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0x5a71c9['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x5a71c9['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}var gt=class extends _0x154ef0{static get requires(){return[_0x286dd0,mt,nt];}static get['pluginName'](){return'RealTimeCollaborativeRevisionHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},wt=class extends _0x2c1459{_collapseAt;constructor(_0x29730,_0x506ef7=0x6){super(_0x29730);const _0x4f6fee=this['bindTemplate'];this['set']('isHidden',!0x0),this['set']('usersCount',0x0),this['_collapseAt']=_0x506ef7,this['bind']('isHidden')['to'](this,'usersCount',_0x34f944=>_0x34f944<_0x506ef7),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item',_0x4f6fee['if']('isHidden','ck-presence-list__counter--hidden')],'role':'listitem'},'children':[{'tag':'div','attributes':{'class':['ck','ck-presence-list__users-counter']},'children':[{'tag':'div','attributes':{'class':['ck','ck-presence-list__users-counter__text']},'children':[{'text':_0x4f6fee['to']('usersCount',_0x5e0a7f=>'+'+(_0x5e0a7f-this['_collapseAt']+0x2)['toString']())}]}]}]});}},vt=class extends _0x2c1459{items;keystrokes;constructor(_0x2faba4){super(_0x2faba4);const _0x4b1926=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0x5152c2(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0x4b1926['if']('hasPopup'),'aria-expanded':_0x4b1926['to']('isExpanded',_0x6321c6=>this['hasPopup']&&String(_0x6321c6)),'aria-label':_0x4b1926['to']('hasPopup',_0x92f47d=>X(_0x2faba4,_0x92f47d?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0x4b1926['to']('hasPopup',_0x2bd951=>!!_0x2bd951&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items'],'on':{'mouseenter':_0x4b1926['to'](()=>this['fire']('presencelist:show')),'mouseleave':_0x4b1926['to'](_0x453452=>{const _0x5cd8af=_0x453452,_0x20c47e=document['querySelector']('.ck-presence-list__dropdown-list'),_0xb1b6d5=document['querySelector']('.ck-balloon-panel_with-arrow');_0x20c47e?.['contains'](_0x5cd8af['relatedTarget'])||_0xb1b6d5?.['contains'](_0x5cd8af['relatedTarget'])||this['fire']('presencelist:hide');})}}),this['on']('change:hasPopup',(_0x54eba8,_0x22e9da,_0x432834)=>{this['element']&&(_0x432834?this['element']['setAttribute']('aria-expanded',String(this['isExpanded'])):this['element']['removeAttribute']('aria-expanded'));});}['focus'](){this['element']['focus']();}['render'](){super['render'](),this['keystrokes']['listenTo'](this['element']);}},_t=class extends _0x2c1459{counterView;inlineListView;constructor(_0x6e5a01,_0x4b335c=0x6){super(_0x6e5a01);const _0x1b8128=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new wt(this['locale'],_0x4b335c),this['inlineListView']=new vt(_0x6e5a01),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x2958e2 of this['inlineListView']['items'])_0x2958e2['tooltipPosition']='s';this['inlineListView']['items']['first']&&(this['inlineListView']['items']['first']['tooltipPosition']='se');}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list','ck-reset','ck-rounded-corners',_0x1b8128['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['inlineListView']]});}},yt=class extends _0x2c1459{listWrapperView;constructor(_0x483869,_0x942a9c){super(_0x483869);const _0x443818=this['bindTemplate'];this['listWrapperView']=new bt(_0x483869,_0x942a9c),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':X(_0x483869,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']],'on':{'mouseleave':_0x443818['to'](_0xb4deb9=>{const _0x26be47=_0xb4deb9,_0x39166d=document['querySelector']('.ck-presence-list__list'),_0x60a05e=document['querySelector']('.ck-balloon-panel_with-arrow');_0x39166d?.['contains'](_0x26be47['relatedTarget'])||_0x60a05e?.['contains'](_0x26be47['relatedTarget'])||this['fire']('presencelist:hide');})}});}},bt=class extends _0x587fe3{constructor(_0x478659,_0x10e5af){super(_0x478659);const _0x1f7942=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0x10e5af?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0x1f7942['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0x1f7942['to']('role'),'aria-label':_0x1f7942['to']('ariaLabel'),'aria-labelledby':_0x1f7942['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0x8fcf5d['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0x563fe7=this['element'];_0x563fe7&&(this['_isScrollable']=Math['max'](_0x563fe7['scrollHeight'],_0x563fe7['clientHeight'])>0.8*window['innerHeight']);}},kt=class extends _0x941e32{['userView'];constructor(_0x181efc,_0x51d099,_0x4f9f1d){super(_0x181efc);const _0x55af66=this['bindTemplate'];this['userView']=new _0x5e52fe(_0x181efc,_0x51d099);const _0x535359={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0x51d099['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0x51d099['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x51d099['color']['getBackgroundColorClass']()],'style':{'--ck-user-color':_0x51d099['color']['getColorVariable'](),'--ck-user-color-alpha':_0x51d099['color']['getColorAlphaVariable']()},'aria-hidden':'true'}}]};_0x4f9f1d&&(_0x535359['tag']='button',_0x535359['on']={'click':_0x55af66['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x535359);}['focus'](){this['element']['focus']();}},It=class extends _0x2c1459{['userView'];['markerView'];constructor(_0x55e920,_0x4c706b,_0x3c67d9){super(_0x55e920);const _0x496be2=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new _0x5e52fe(_0x55e920,_0x4c706b),this['markerView']=new St(_0x55e920,_0x4c706b);const _0x297508=new _0x5d18b9(_0x55e920);_0x297508['template']['tag']='span',_0x297508['text']=_0x4c706b['name'];const _0xb40c3c={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0x496be2['to']('isFocusable',_0x4387aa=>!!_0x4387aa&&0x0),'aria-labelledby':_0x297508['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0x496be2['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0x496be2['to']('hasTooltip',_0x4c9ba0=>!_0x4c9ba0),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0x297508]};_0x3c67d9&&(_0xb40c3c['tag']='button',_0xb40c3c['on']={'click':_0x496be2['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0xb40c3c);}},St=class extends _0x2c1459{constructor(_0xf1375e,_0x24149c){super(_0xf1375e),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x24149c['color']['getBackgroundColorClass']()],'style':{'--ck-user-color':_0x24149c['color']['getColorVariable'](),'--ck-user-color-alpha':_0x24149c['color']['getColorAlphaVariable']()},'aria-hidden':'true'}});}};const Tt={'collapseAt':0x6,'displayMe':!0x0};var Ct=class extends _0x3aa93e{currentDisplayedUsers;['balloonPanelView'];['view'];['presenceDropdownView'];_bodyCollection=null;static get['pluginName'](){return'PresenceListUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x1f4e9f){super(_0x1f4e9f),this['context']['config']['define']('presenceList',Tt);const _0x26f0ae=_0x1f4e9f['config']['get']('presenceList.collapseAt');if('number'!=typeof _0x26f0ae)throw new _0x5215b6('presencelist-collapseat-invalid-format',this);if(_0x26f0ae<0x1)throw new _0x5215b6('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](Y)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0x7bbdee(),this['balloonPanelView']=new _0x46878c(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get requires(){return[Y];}init(){for(const _0x332fe0 of this['_allConnectedUsers'])this['_handleUserAdd'](_0x332fe0);this['listenTo'](this['_allConnectedUsers'],'add',(_0x55ddd3,_0x456346)=>{this['_handleUserAdd'](_0x456346);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0xc5e85c,_0x474b)=>{this['_handleUserRemove'](_0x474b);});}_createView(){const _0x372c7e=this['context'],_0x415df8=new _t(this['context']['locale'],this['context']['config']['get']('presenceList.collapseAt')),_0x4fcb6b=this['balloonPanelView'];if(!_0x2e44e9(_0x372c7e['config']['get']('presenceList.container')))throw new _0x5215b6('presencelist-missing-container',this);return _0x415df8['counterView']['bind']('usersCount')['to'](this),_0x415df8['bind']('isCollapsed')['to'](this,'usersCount',_0x66b360=>{const {collapseAt:_0x23afcd}=_0x372c7e['config']['get']('presenceList'),_0x4b9aee=_0x66b360>=_0x23afcd;if(_0x4b9aee&&!_0x415df8['inlineListView']['items']['find'](_0x38761c=>_0x38761c instanceof wt)){const _0x133af4=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['currentDisplayedUsers']['length']==_0x133af4&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](this['currentDisplayedUsers']['length']-0x1),_0x415df8['inlineListView']['items']['add'](_0x415df8['counterView']);}return _0x4b9aee||this['hideDropdown'](),_0x4b9aee;}),_0x415df8['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0x46dece=>{const _0x263f97=_0x372c7e['config']['get']('presenceList'),_0x1c2459=new It(_0x372c7e['locale'],_0x46dece,!!_0x263f97['onClick']);return _0x1c2459['bind']('hasTooltip')['to'](_0x415df8,'isCollapsed',_0x5b820d=>!_0x5b820d),_0x1c2459['bind']('isFocusable')['to'](_0x415df8,'isCollapsed',_0xe1a0e3=>!_0xe1a0e3),_0x263f97['onClick']&&this['listenTo'](_0x1c2459,'execute',()=>{this['view']['isCollapsed']||_0x263f97['onClick'](_0x46dece,_0x1c2459['element']);}),_0x1c2459;}),this['listenTo'](_0x415df8['inlineListView'],'presencelist:show',()=>{this['view']['isCollapsed']&&this['showDropdown']();}),this['listenTo'](_0x415df8['inlineListView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();}),_0x415df8['inlineListView']['keystrokes']['set']('Enter',(_0x21d202,_0x2cb808)=>{this['view']['isCollapsed']&&(this['showDropdown'](),_0x2cb808());}),_0x415df8['render'](),_0x4fcb6b['render'](),_0x4de315({'emitter':_0x415df8,'activator':()=>_0x4fcb6b['isVisible'],'contextElements':[_0x4fcb6b['element'],_0x415df8['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0x372c7e['config']['get']('presenceList.container')['appendChild'](_0x415df8['element']),this['_bodyCollection']=new _0x2c299b(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_bodyCollection']['add'](this['balloonPanelView']),_0x415df8;}['_handleUserAdd'](_0xf0836){if(!this['context']['config']['get']('presenceList.displayMe')&&_0xf0836['isMe'])return;const _0x21599d=this['context']['config']['get']('presenceList.collapseAt')-0x1;for(this['usersCount']++;this['currentDisplayedUsers']['length']>=_0x21599d-(this['view']['isCollapsed']?0x1:0x0)&&this['currentDisplayedUsers']['length']>0x1;)this['currentDisplayedUsers']['remove'](0x1);const _0xbe1121=_0xf0836['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0xf0836,_0xbe1121);}['_handleUserRemove'](_0x3f1dcb){this['usersCount']--;const {collapseAt:_0x5b120a}=this['context']['config']['get']('presenceList'),_0x5d7d8c=this['usersCount']>=_0x5b120a;if(this['currentDisplayedUsers']['get'](_0x3f1dcb['id']))this['currentDisplayedUsers']['remove'](_0x3f1dcb['id']);else{if(_0x5d7d8c&&this['currentDisplayedUsers']['length']+0x1===_0x5b120a-0x1)return;}if(this['currentDisplayedUsers']['length']+(_0x5d7d8c?0x1:0x0)<this['usersCount']){for(const _0x5799fe of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0x5799fe['id'])&&(this['currentDisplayedUsers']['add'](_0x5799fe,Math['min'](this['currentDisplayedUsers']['length']-(_0x5d7d8c?0x1:0x0),0x1)),this['currentDisplayedUsers']['length']+(_0x5d7d8c?0x1:0x0)===_0x5b120a-0x1))return;}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0x368d5d=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new yt(this['context']['locale'],!!_0x368d5d['onClick']),this['view']['inlineListView']['isExpanded']=!0x0,this['listenTo'](this['presenceDropdownView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();});const {listWrapperView:_0x1fb4cd}=this['presenceDropdownView'];_0x1fb4cd['items']['bindTo'](this['_allConnectedUsers'])['using'](_0x2f8f14=>{if(!_0x368d5d['displayMe']&&_0x2f8f14['isMe'])return null;const _0x1ea8b8=new kt(this['context']['locale'],_0x2f8f14,!!_0x368d5d['onClick']);return _0x368d5d['onClick']&&this['listenTo'](_0x1ea8b8,'execute',()=>{_0x368d5d['onClick'](_0x2f8f14,_0x1ea8b8['element']);}),_0x1ea8b8;}),this['balloonPanelView']['content']['add'](this['presenceDropdownView']),this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element']}),_0x1fb4cd['focus'](),_0x1fb4cd['checkIfScrollable']();const _0x20fa9e=(_0x465618,_0x3d754d)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0x3d754d();};_0x1fb4cd['keystrokes']['set']('Esc',_0x20fa9e),_0x1fb4cd['keystrokes']['set']('Shift+Tab',_0x20fa9e),_0x1fb4cd['keystrokes']['set']('Tab',(_0x2d7c1c,_0x552136)=>{!function(_0x1d283a){const _0x56fbc3=['a','button','input','select','textarea','[tabindex]','[contenteditable]']['map'](_0x49f1fe=>_0x49f1fe+':not([disabled]):not([tabindex=\x22-1\x22])')['join'](','),_0x5c7243=[...document['body']['querySelectorAll'](_0x56fbc3)]['filter'](_0x4b1741=>_0x4b1741===document['activeElement']||_0x4b1741['offsetWidth']+_0x4b1741['offsetHeight']>0x0)['sort']((_0x9c50f6,_0x6cf0c4)=>(_0x9c50f6['tabIndex']||0x0)-(_0x6cf0c4['tabIndex']||0x0)),_0xac842b=_0x5c7243[(_0x5c7243['indexOf'](_0x1d283a)+0x1)%_0x5c7243['length']];_0xac842b&&_0xac842b['focus']();}(this['view']['element']),this['hideDropdown'](),_0x552136();}),_0x1fb4cd['focusTracker']['add'](this['view']['element']),_0x1fb4cd['focusTracker']['on']('change:isFocused',(_0x44bfc7,_0x98e7b7,_0x6cf919)=>{_0x6cf919||this['hideDropdown']();});}['hideDropdown'](){this['presenceDropdownView']&&(this['view']['inlineListView']['isExpanded']=!0x1,this['balloonPanelView']['unpin'](),this['balloonPanelView']['content']['remove'](this['presenceDropdownView']),this['presenceDropdownView']['destroy'](),this['presenceDropdownView']=void 0x0);}destroy(){super['destroy'](),this['view']&&this['view']['isRendered']&&this['view']['destroy'](),this['_bodyCollection']&&(this['_bodyCollection']['detachFromDom'](),this['_bodyCollection']['destroy'](),this['_bodyCollection']=null);}},At=class extends _0x3aa93e{static get requires(){return[Y,Ct];}static get['pluginName'](){return'PresenceList';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}};export{ot as CloudServicesCommentsAdapter,mt as CloudServicesRevisionHistoryAdapter,ht as CloudServicesTrackChangesAdapter,At as PresenceList,Ct as PresenceListUI,tt as RealTimeCollaborationClient,ut as RealTimeCollaborativeComments,nt as RealTimeCollaborativeEditing,gt as RealTimeCollaborativeRevisionHistory,ft as RealTimeCollaborativeTrackChanges,Y as Sessions,z as WebSocketGateway};
23
+ import{Context as _0x3ecfdb,ContextPlugin as _0xd1e979,PendingActions as _0x9003cc,Plugin as _0x2fd2b9}from'@ckeditor/ckeditor5-core';import{CKEditorError as _0xacbaf9,Collection as _0x4a18c2,DomEmitterMixin as _0x33c29d,KeystrokeHandler as _0x243499,global as _0x5d7bba,uid as _0xeff1dd,version as _0xdf940c}from'@ckeditor/ckeditor5-utils';import{BalloonPanelView as _0x2b1718,BodyCollection as _0x1f77d5,LabelView as _0x58d76d,ListItemView as _0x35ef59,ListView as _0x223b82,Notification as _0x4da3fc,View as _0x49d4c1,clickOutsideHandler as _0x2ca82e}from'@ckeditor/ckeditor5-ui';import{History as _0x5b6931,InsertOperation as _0x94d6d2,MarkerOperation as _0x202700,ModelLiveRange as _0x4a154e,NoOperation as _0x55cc7a,OperationFactory as _0x46062f,RootAttributeOperation as _0x9153cb,transformOperationSets as _0x234e40}from'@ckeditor/ckeditor5-engine';import{CloudServices as _0x575e47}from'@ckeditor/ckeditor5-cloud-services';import{CollaborativeEditingService as _0x3d162c,CommentsService as _0x258961,EditorService as _0x2be39b,RevisionHistoryService as _0x50f15e,TrackChangesService as _0x4991bf,User as _0x52b3e1,WEB_SOCKET_GATEWAY_STATES as _0x4ad97d,WebSocketGateway as _0x5a2ce4}from'@ckeditor/ckeditor-cloud-services-collaboration';import{UserView as _0x11aedb,Users as _0x4a35a9}from'@ckeditor/ckeditor5-collaboration-core';import{Compressor as _0x10ac7d}from'@ckeditor/ckeditor5-operations-compressor';import{TrackChanges as _0x350040,TrackChangesEditing as _0x18f46a}from'@ckeditor/ckeditor5-track-changes';import{Comments as _0x18c06f,CommentsEditing as _0x394529,CommentsRepository as _0x39df5c}from'@ckeditor/ckeditor5-comments';import{RevisionHistory as _0x5811ff}from'@ckeditor/ckeditor5-revision-history';import{isElement as _0x25aa5f}from'es-toolkit/compat';var z=class WebSocketGateway extends _0xd1e979{static WebSocketGateway=/* #__PURE__ -- @preserve */
24
+ ((()=>_0x5a2ce4)());static initialReconnectionInterval=0x3e8;connection;_reconnectionStack;_shouldPluginsReconnect;_domEmitter;static get requires(){return[_0x575e47,_0x4da3fc];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x4049e0){super(_0x4049e0),this['set']('state',_0x4ad97d['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=new(_0x33c29d())();}init(){const _0x8eae42=this['context'],_0x228bfd=_0x8eae42['plugins']['get'](_0x575e47),_0x5dee63=_0x8eae42['plugins']['get'](_0x4da3fc);if(!_0x228bfd['token'])throw new _0xacbaf9('websocketgateway-missing-token',this);if(!_0x228bfd['webSocketUrl'])throw new _0xacbaf9('websocketgateway-missing-websocket-url',this);return this['_domEmitter']['listenTo'](window,'offline',()=>this['_isBrowserOffline']=!0x0),this['_domEmitter']['listenTo'](window,'online',()=>this['_isBrowserOffline']=!0x1),this['context']['config']['define']('cloudServices.connectionTimeout',0xa),this['context']['config']['define']('cloudServices.requestTimeout',0x14),WebSocketGateway['WebSocketGateway']['connect'](_0x228bfd['token'],_0x228bfd['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0x131988=>{if(this['connection']=_0x131988,this['bind']('state')['to'](_0x131988,'state',this,'_isBrowserOffline',(_0x57997b,_0x8d072a)=>('connected'!==_0x57997b&&(this['_shouldPluginsReconnect']=!0x0),_0x8d072a||_0x57997b!==_0x4ad97d['CONNECTED']?_0x4ad97d['DISCONNECTED']:this['state']==_0x4ad97d['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),_0x4ad97d['CONNECTING']):_0x4ad97d['CONNECTED'])),this['connection']['on']('error',(_0x1db85b,_0x3930dd)=>{if('limitExceeded'!==_0x3930dd['code'])throw console['error'](_0x3930dd),new _0xacbaf9('cloudservices-init',null,{'originalError':_0x3930dd});_0x5dee63['showWarning']('The\x20limit\x20of\x20maximum\x20concurrent\x20connections\x20that\x20the\x20collaboration\x20server\x20can\x20handle\x20has\x20been\x20reached.\x20Try\x20opening\x20the\x20document\x20again\x20in\x20a\x20few\x20minutes.\x20Please\x20contact\x20your\x20system\x20administrator\x20if\x20the\x20problem\x20persists.',{'title':'Connected\x20users\x20limit\x20exceeded','namespace':'real-time-collaboration'});}),!_0x131988['me'])return new Promise(_0x92403f=>_0x131988['on']('change:me',_0x92403f));})['catch'](_0x107e2d=>{throw console['error'](_0x107e2d),new _0xacbaf9('cloudservices-init',null,{'originalError':_0x107e2d});});}addToReconnectionStack(_0x5c00ce){if('function'!=typeof _0x5c00ce['reconnect'])throw new _0xacbaf9('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0x5c00ce))throw new _0xacbaf9('websocketgateway-plugin-already-registered',this,{'name':_0x5c00ce['constructor']['pluginName']});this['_reconnectionStack']['add'](_0x5c00ce);}removeFromReconnectionStack(_0x1a7ea8){this['_reconnectionStack']['delete'](_0x1a7ea8);}isInReconnectionStack(_0x133acd){return this['_reconnectionStack']['has'](_0x133acd);}_reconnect(){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0x2f5de9=>_0x2f5de9['reconnect']())))['then'](()=>this['state']=_0x4ad97d['CONNECTED'])['catch'](_0x1e8360=>{throw console['error'](_0x1e8360),new _0xacbaf9('cloudservices-reconnection-error',this['context']);});}disconnect(){this['connection']&&this['connection']['disconnect'](),this['state']=_0x4ad97d['DISCONNECTED'],this['_domEmitter']['stopListening']();}destroy(){this['disconnect'](),super['destroy']();}},Y=class extends _0xd1e979{['channelSessions'];channelConnectedUsers;allConnectedUsers;_registeredSessions;_uniqueUsersCount;['_users'];static get['pluginName'](){return'Sessions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}static get requires(){return[z,_0x4a35a9];}constructor(_0x413587){super(_0x413587),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0x4a18c2(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x4a35a9);}init(){const _0x3a7ad5=this['context']['plugins']['get'](z);this['listenTo'](_0x3a7ad5,'change:state',(_0x327dd5,_0x19654d,_0x3d8d75)=>{if('connected'!==_0x3d8d75)this['channelSessions']['forEach'](_0x54e281=>_0x54e281['clear']()),this['channelConnectedUsers']['forEach'](_0x5be45e=>_0x5be45e['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x96858a,_0xea58dd]of this['_registeredSessions'])for(const _0x37b58d of _0xea58dd)this['_handleSessionAdd'](_0x96858a,_0x37b58d);}}),this['_createUser'](_0x3a7ad5['connection']['me'],!0x0);}register(_0xa7cdfa,_0x237b26){if(this['_registeredSessions']['has'](_0xa7cdfa))throw new _0xacbaf9('sessions-register-already-registered',null,{'channelId':_0xa7cdfa});this['_registeredSessions']['set'](_0xa7cdfa,_0x237b26),this['channelSessions']['set'](_0xa7cdfa,new _0x4a18c2()),this['channelConnectedUsers']['set'](_0xa7cdfa,new _0x4a18c2()),this['listenTo'](_0x237b26,'add',(_0x385d8e,_0x32a197)=>this['_handleSessionAdd'](_0xa7cdfa,_0x32a197)),this['listenTo'](_0x237b26,'remove',(_0x4494ee,_0x4a9f13)=>this['_handleSessionRemove'](_0xa7cdfa,_0x4a9f13));for(const _0x1008c1 of _0x237b26)this['_handleSessionAdd'](_0xa7cdfa,_0x1008c1);}unregister(_0xb179ca){if(!this['_registeredSessions']['has'](_0xb179ca))throw new _0xacbaf9('sessions-unregister-not-exist',null,{'channelId':_0xb179ca});const _0x5b051f=this['_registeredSessions']['get'](_0xb179ca);this['stopListening'](_0x5b051f);for(const _0x1a4039 of _0x5b051f)'connected'===this['context']['plugins']['get'](z)['state']&&this['_handleSessionRemove'](_0xb179ca,_0x1a4039);this['_registeredSessions']['delete'](_0xb179ca),this['channelSessions']['delete'](_0xb179ca),this['channelConnectedUsers']['delete'](_0xb179ca);}get['mySessionId'](){return this['context']['plugins']['get'](z)['connection']['sessionId'];}getUserBySessionId(_0x3b993a){for(const _0x38f9f7 of this['channelSessions']['values']())for(const _0x7f9178 of _0x38f9f7)if(_0x7f9178['id']===_0x3b993a)return _0x7f9178['user'];}getUserSessions(_0x33b588,_0x4f2d18){const _0x5cd3ea=_0x4f2d18?[this['channelSessions']['get'](_0x4f2d18)]:this['channelSessions']['values'](),_0x39ab70=new Set();for(const _0x47c2ef of _0x5cd3ea)for(const _0x404ecb of _0x47c2ef)_0x404ecb['user']['id']===_0x33b588['id']&&_0x39ab70['add'](_0x404ecb['id']);return _0x39ab70;}getUserRole(_0x4d57a4){for(const _0x34dc34 of this['channelSessions']['values']())for(const _0x1bd0ad of _0x34dc34)if(_0x1bd0ad['user']===_0x4d57a4)return _0x1bd0ad['role'];}['_handleSessionAdd'](_0x1b1954,_0x62b2cd){if('connected'!==this['context']['plugins']['get'](z)['state'])return;const _0x5bfdae=_0x62b2cd['user'],_0x1bafe6=this['_users']['getUser'](_0x5bfdae['id'])||this['_createUser'](_0x5bfdae),_0x52035e=Object['assign']({},_0x62b2cd,{'user':_0x1bafe6});if(this['channelSessions']['get'](_0x1b1954)['add'](_0x52035e),!_0x5bfdae['hiddenInPresenceList']){const _0x38bbb0=this['channelConnectedUsers']['get'](_0x1b1954);_0x38bbb0['has'](_0x1bafe6['id'])||_0x38bbb0['add'](_0x1bafe6),this['allConnectedUsers']['has'](_0x1bafe6['id'])||_0x5bfdae['hiddenInPresenceList']||this['allConnectedUsers']['add'](_0x1bafe6,_0x1bafe6['isMe']?0x0:void 0x0);}this['fire']('sessionAdd:'+_0x1b1954,{'channelId':_0x1b1954,'session':_0x52035e});}['_handleSessionRemove'](_0x2ccf05,_0x46e1ec){if('connected'!==this['context']['plugins']['get'](z)['state'])return;const _0x1033a2=this['channelConnectedUsers']['get'](_0x2ccf05),_0x2ba8d2=_0x46e1ec['user'];_0x2ba8d2['id']&&(this['channelSessions']['get'](_0x2ccf05)['remove'](_0x46e1ec['id']),_0x1033a2['has'](_0x2ba8d2['id'])&&!this['getUserSessions'](_0x2ba8d2,_0x2ccf05)['size']&&_0x1033a2['remove'](_0x2ba8d2['id']),this['allConnectedUsers']['get'](_0x2ba8d2['id'])&&!this['getUserSessions'](_0x2ba8d2)['size']&&this['allConnectedUsers']['remove'](_0x2ba8d2['id']));}_createUser(_0xca74fb,_0xb3be23){const _0x3f2ea0=this['_users']['addUser'](_0xca74fb);return _0xb3be23&&this['_users']['defineMe'](_0xca74fb['id']),_0x3f2ea0['orderNumber']=this['_uniqueUsersCount']++,_0x3f2ea0;}},K=class extends _0x2fd2b9{_domEmitter=new(_0x33c29d())();static get requires(){return[Y];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const _0x1082d0=this['editor'],_0x46118f=_0x1082d0['plugins']['get'](Y);_0x1082d0['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x4e2ba8,{writer:_0x16de7b})=>function(_0x12fefc,_0x33669c,_0x5aa190,_0x106446){const _0x13233c=_0x12fefc['markerName']['split'](':')[0x2],_0x5058a3=_0x5aa190['getUserBySessionId'](_0x13233c);if(!_0x5058a3||_0x13233c===_0x5aa190['mySessionId'])return;if(!_0x106446['model']['schema']['checkChild'](_0x12fefc['markerRange']['start'],'$text'))return;const _0x108b86={'class':'ck-user__marker\x20'+_0x5058a3['color']['getMarkerClass'](),'style':Q(_0x5058a3),'data-name':_0x5058a3['name'],'data-session-id':_0x13233c},_0x3c59fd=_0x106446['model']['markers']['get'](_0x12fefc['markerName'])['getStart'](),_0x42d8fe=_0x3c59fd['nodeAfter'],_0x145a0b=_0x106446['model']['schema'];if(_0x42d8fe&&_0x145a0b['isObject'](_0x42d8fe)&&_0x145a0b['isInline'](_0x42d8fe)&&!_0x106446['model']['markers']['get']('user:range:'+_0x13233c)['getRange']()['isCollapsed'])return;const _0x403927=_0x3c59fd['parent'];return _0x106446['model']['schema']['isLimit'](_0x403927)&&!_0x106446['model']['hasContent'](_0x403927)&&(_0x108b86['contenteditable']=!0x1),function(_0x5d9a10,_0x3d1fc8,_0xe8db58){const _0x377d25=_0x5d9a10['createUIElement']('span',_0x3d1fc8);return _0x5d9a10['setCustomProperty']('userPositionMarker',!0x0,_0x377d25),_0x377d25['render']=function(_0xb43db6){const _0x3cdbbc=this['toDomElement'](_0xb43db6),_0x5bde5b=document['createElement']('span');return _0x5bde5b['classList']['add']('ck-user__marker-tooltip'),_0x5bde5b['setAttribute']('contenteditable','false'),_0x5bde5b['setAttribute']('spellcheck','false'),_0x5bde5b['textContent']=_0xe8db58['name'],_0x3cdbbc['innerHTML']='⁠<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span>'+_0x5bde5b['outerHTML']+'⁠',_0x3cdbbc['addEventListener']('mouseenter',()=>{_0x3cdbbc['classList']['add']('ck-user__marker_hovered');}),_0x3cdbbc['addEventListener']('mouseleave',()=>{_0x3cdbbc['classList']['remove']('ck-user__marker_hovered');}),_0x3cdbbc;},_0x377d25['isSimilar']=function(_0x205782){return!(!this['getCustomProperty']('userPositionMarker')||!_0x205782['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0x205782['getAttribute']('data-session-id'));},_0x377d25;}(_0x33669c,_0x108b86,_0x5058a3);}(_0x4e2ba8,_0x16de7b,_0x46118f,_0x1082d0)}),_0x1082d0['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0x4c6b3e=>function(_0x4f4ada,_0x5b3989){const _0x46437c=_0x4f4ada['markerName']['split'](':')[0x2];if(_0x46437c===_0x5b3989['mySessionId'])return null;const _0x1db3c7=_0x5b3989['getUserBySessionId'](_0x46437c);return _0x1db3c7?{'id':_0x46437c,'classes':['ck-user__selection',_0x1db3c7['color']['getSelectionClass']()],'attributes':{'style':Q(_0x1db3c7),'data-session-id':_0x46437c},'priority':0x7d0+_0x1db3c7['orderNumber']}:{'id':_0x46437c,'classes':[]};}(_0x4c6b3e,_0x46118f)}),function(_0x294565){const _0x281831=_0x294565['model'],_0x4e19a5=new Map(),_0x56679d=_0x294565['plugins']['get'](Y);_0x281831['markers']['on']('update:user:range',(_0x131715,_0x3c44a2,_0xdd2347,_0x5e7bf1)=>{if(!_0x5e7bf1&&_0x4e19a5['get'](_0x3c44a2['name']))return _0x4e19a5['get'](_0x3c44a2['name'])['detach'](),void _0x4e19a5['delete'](_0x3c44a2['name']);const _0x751742=_0x3c44a2['name']['split'](':')[0x2];if(_0x751742===_0x56679d['mySessionId'])return;const _0x1170df='user:position:'+_0x751742;_0x281831['markers']['has'](_0x1170df)&&_0x294565['editing']['reconvertMarker'](_0x1170df),_0x3c44a2['on']('change:range',(_0x20e78b,_0x13ad2b,_0x5a8175)=>{if('$graveyard'!=_0x13ad2b['root']['rootName']&&'$graveyard'==_0x3c44a2['getRange']()['root']['rootName']&&!_0x4e19a5['has'](_0x3c44a2['name'])){const _0x4d76b3=_0x281831['schema']['getNearestSelectionRange'](_0x5a8175['deletionPosition']);if(_0x4d76b3){const _0x1f3191=_0x4a154e['fromRange'](_0x4d76b3);_0x4e19a5['set'](_0x3c44a2['name'],_0x1f3191),_0x1f3191['on']('change:range',(_0x535f4b,_0x3a8d23,_0x4d77f5)=>{if('$graveyard'==_0x1f3191['root']['rootName']){const _0x278eb5=_0x281831['schema']['getNearestSelectionRange'](_0x4d77f5['deletionPosition']);_0x278eb5?(_0x1f3191['start']=_0x278eb5['start'],_0x1f3191['end']=_0x278eb5['end']):(_0x4e19a5['delete'](_0x3c44a2['name']),_0x1f3191['detach']());}});}}});}),_0x281831['document']['on']('change',()=>{_0x4e19a5['size']>0x0&&_0x281831['enqueueChange']({'isUndoable':!0x1},_0x186fbe=>{for(const [_0x4c7de3,_0x61d198]of _0x4e19a5)'$graveyard'==_0x281831['markers']['get'](_0x4c7de3)['getRange']()['root']['rootName']&&(J(_0x4c7de3['split'](':')[0x2],_0x61d198['toRange'](),_0x281831,_0x186fbe),_0x61d198['detach']());_0x4e19a5['clear']();});});}(_0x1082d0),this['_domEmitter']['listenTo'](_0x5d7bba['document'],'keydown',(_0x1ec19f,{key:_0x5759bd})=>{'Escape'===_0x5759bd&&function(_0x11fe1f){_0x11fe1f['editing']['view']['change'](_0x2a3c9c=>{for(const _0xed53b6 of _0x11fe1f['model']['markers']){if(!_0xed53b6['name']['startsWith']('user:position'))continue;const _0x246b4e=_0x11fe1f['editing']['mapper']['markerNameToElements'](_0xed53b6['name']);if(_0x246b4e){for(const _0x3aa88e of _0x246b4e)_0x2a3c9c['removeClass']('ck-user__marker_hovered',_0x3aa88e);}}});}(_0x1082d0);},{'useCapture':!0x0});}afterInit(){const _0x40a11f=this['editor'],_0x330dca=_0x40a11f['commands']['get']('undo');_0x330dca&&_0x40a11f['model']['on']('applyOperation',(_0x1dddce,_0x1a2192)=>{const _0x4bb796=_0x1a2192[0x0];if(!_0x4bb796['isDocumentOperation'])return;if('marker'!=_0x4bb796['type']||!_0x4bb796['name']['startsWith']('user:'))return;const _0x193500=_0x4bb796['batch'];_0x330dca['_createdBatches']['has'](_0x193500)&&(_0x4bb796['newRange']=_0x4bb796['oldRange']?_0x40a11f['model']['createRange'](_0x4bb796['oldRange']['start'],_0x4bb796['oldRange']['end']):null);},{'priority':'highest'});}destroy(){return this['_domEmitter']['stopListening'](),super['destroy']();}createUserMarkerOperations(){const _0x469be4=this['editor'],_0x22406b=_0x469be4['model']['document'],_0x434960=_0x469be4['plugins']['get'](Y);_0x469be4['model']['enqueueChange']({'isUndoable':!0x1},_0x1e04b9=>{const _0x40499b='user:range:'+_0x434960['mySessionId'],_0x426a71='user:position:'+_0x434960['mySessionId'],_0x143b8d=_0x469be4['model']['markers']['has'](_0x40499b);_0x469be4['editing']['view']['hasDomSelection']?J(_0x434960['mySessionId'],_0x22406b['selection']['getFirstRange'](),_0x469be4['model'],_0x1e04b9):_0x143b8d&&(_0x1e04b9['removeMarker'](_0x40499b),_0x1e04b9['removeMarker'](_0x426a71));});}};function J(_0x2c0c38,_0x281bcf,_0x569f8e,_0x13e36b){const _0x4dea64='user:range:'+_0x2c0c38,_0x5a02c2='user:position:'+_0x2c0c38,_0x11ecf4=_0x281bcf['getContainedElement']();let _0x91472=_0x281bcf['start'];if(_0x11ecf4&&_0x11ecf4['is']('element','tableCell')){const _0x491274=function(_0x5464e7,_0x3aca5b){for(const _0xa343cc of _0x5464e7['getPositions']())if(_0x3aca5b['schema']['checkChild'](_0xa343cc,'$text'))return _0xa343cc;}(_0x281bcf,_0x569f8e);_0x491274&&(_0x91472=_0x491274,_0x281bcf=_0x13e36b['createRange'](_0x91472));}const _0x2077c4=_0x13e36b['createRange'](_0x91472);_0x569f8e['markers']['has'](_0x4dea64)?(_0x13e36b['updateMarker'](_0x4dea64,{'range':_0x281bcf}),_0x13e36b['updateMarker'](_0x5a02c2,{'range':_0x2077c4})):(_0x13e36b['addMarker'](_0x4dea64,{'range':_0x281bcf,'usingOperation':!0x0}),_0x13e36b['addMarker'](_0x5a02c2,{'range':_0x2077c4,'usingOperation':!0x0}));}function Q(_0x2fd29f){return'--ck-user-color:'+_0x2fd29f['color']['getColorVariable']()+';--ck-user-color-alpha:'+_0x2fd29f['color']['getColorAlphaVariable']()+';';}function X(_0x4963fc,_0x32c5ec,_0x5bbd27){const _0x49886c=_0x4963fc['t'],t=_0x4963fc['t'];switch(_0x32c5ec){case'PENDING_ACTION_SENDING_DATA':return t({'string':'Sending\x20data\x20to\x20the\x20server.','id':'PENDING_ACTION_SENDING_DATA'});case'The\x20local\x20document\x20and\x20server\x20document\x20differ\x20and\x20merging\x20them\x20can\x20cause\x20unexpected\x20behavior.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.':return t('The\x20local\x20document\x20and\x20server\x20document\x20differ\x20and\x20merging\x20them\x20can\x20cause\x20unexpected\x20behavior.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.');case'The\x20document\x20cannot\x20be\x20connected\x20back\x20to\x20the\x20server.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.':return t('The\x20document\x20cannot\x20be\x20connected\x20back\x20to\x20the\x20server.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.');case'The\x20document\x20details\x20could\x20not\x20be\x20taken\x20during\x20the\x20reconnection.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.':return t('The\x20document\x20details\x20could\x20not\x20be\x20taken\x20during\x20the\x20reconnection.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.');case'The\x20last\x20saved\x20version\x20of\x20the\x20document\x20does\x20not\x20match\x20the\x20local\x20version.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.':return t('The\x20last\x20saved\x20version\x20of\x20the\x20document\x20does\x20not\x20match\x20the\x20local\x20version.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.');case'Synchronization\x20issue':return t('Synchronization\x20issue');case'Connected\x20users\x20list\x20dropdown\x20menu':return t('Connected\x20users\x20list\x20dropdown\x20menu');case'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':return t('Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)');case'Connected\x20users\x20list':return t('Connected\x20users\x20list');case'PENDING_ACTION_REVISION_HISTORY':return _0x49886c({'string':'Unsaved\x20change\x20in\x20revision\x20history.','id':'PENDING_ACTION_REVISION_HISTORY'});case'CONNECTED_USERS':return t({'string':'1\x20connected\x20user\x20(me)','plural':'%0\x20connected\x20users','id':'CONNECTED_USERS'},_0x5bbd27);default:return'';}}let Z=0x1;var tt=class RealTimeCollaborationClient extends _0x2fd2b9{static CollaborativeEditingService=/* #__PURE__ -- @preserve */
25
+ ((()=>_0x3d162c)());_offset;['sessionId'];serverHistory;['_channelId'];['_service'];_document;['_compressor'];_bufferedOperations;_knownOperations;_knownRootNames;_pendingAction;_hasSelectionChanged;_sendBufferedOperationsDelayId;['_baseBufferDelay'];_currentBufferDelay;_lastSyncedOperationId;_disconnectionOperations;_operationIdentifier;static get requires(){return[z,Y,K,_0x9003cc,_0x4a35a9,_0x4da3fc];}static get['pluginName'](){return'RealTimeCollaborationClient';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}get cloudDocumentVersion(){return this['_lastServerVersion']+this['_offset'];}get _lastServerVersion(){return this['serverHistory']['version']-this['_offset'];}get lastSyncVersion(){const _0x4d8f09=this['serverHistory']['getOperations']();for(let _0x329a12=_0x4d8f09['length']-0x1;_0x329a12>=0x0;_0x329a12--){const _0x48e92c=_0x4d8f09[_0x329a12];if(!this['_disconnectionOperations']['has'](_0x48e92c))return _0x48e92c['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0x1d2015){if(super(_0x1d2015),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x5b6931(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0xacbaf9('collaboration-missing-channelid',this);const _0x28c11d=_0x1d2015['config']['get']('cloudServices.bundleVersion')||_0xdf940c;this['_service']=new RealTimeCollaborationClient['CollaborativeEditingService'](_0x28c11d,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0x10ac7d(),this['_bufferedOperations']=[],this['_knownOperations']=new WeakSet(),this['_knownRootNames']=new Set(),this['set']('_isPendingUpdate',!0x1),this['set']('_hasSynchronizationProblem',!0x1),this['_pendingAction']=null,this['_hasSelectionChanged']=!0x1,this['_sendBufferedOperationsDelayId']=null,this['_baseBufferDelay']=0x12c,this['_currentBufferDelay']=this['_baseBufferDelay'],this['_lastSyncedOperationId']=null,this['_disconnectionOperations']=new WeakSet(),this['_operationIdentifier']=new it(this['_disconnectionOperations']);}init(){const _0x35f060=this['editor'],_0x5681b7=_0x35f060['plugins']['get'](_0x4a35a9),_0x2a5048=_0x35f060['plugins']['get'](z);this['listenTo'](_0x5681b7,'getOperationAuthor',(_0x3c9a85,_0x1a6908)=>{const _0x26c944=_0x1a6908[0x0];_0x26c944['_authorId']&&(_0x3c9a85['return']=_0x5681b7['getUser'](_0x26c944['_authorId']),_0x3c9a85['stop']()),null===_0x26c944['_authorId']&&(_0x3c9a85['return']=null,_0x3c9a85['stop']());},{'priority':'high'}),this['listenTo'](_0x35f060['model']['document']['selection'],'change:range',(_0x3e8abf,_0x54fa6a)=>{_0x54fa6a['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x35f060['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x35f060['model']['on']('applyOperation',(_0x339dcb,_0x2db595)=>{const _0x2f7b7d=_0x2db595[0x0];_0x2f7b7d['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0x2f7b7d),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['set']('_isChannelFlushed',!0x1),this['bind']('_isEditingAllowed')['to'](_0x2a5048,'state',this,'_hasSynchronizationProblem',this,'_isChannelFlushed',(_0x422ef5,_0x232095,_0x49e463)=>'connected'===_0x422ef5&&!_0x232095&&!_0x49e463),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x35f060['disableReadOnlyMode']('rtc-offline'):_0x35f060['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x35f060['disableReadOnlyMode']('rtc-offline'):_0x35f060['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async reconnect(){const _0x38633d=this['editor']['plugins']['get'](Y),_0x7591e1=this['editor']['plugins']['get'](z);try{this['_isPendingUpdate']=!0x0,_0x38633d['unregister'](this['_channelId']);const _0x200249=await this['_service']['reconnect'](_0x7591e1['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0x200249)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0xb701e=await this['_service']['getConnectedSessions']();_0x38633d['register'](this['_channelId'],_0xb701e),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x705ce1){if(function(_0x59a844){return'404'===_0x59a844['code'];}(_0x705ce1)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0x25c2de){return'409'===_0x25c2de['code'];}(_0x705ce1)){const _0x35c404=X(this['editor']['locale'],'The\x20document\x20cannot\x20be\x20connected\x20back\x20to\x20the\x20server.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.');this['_handleReconnectionError'](_0x35c404);}else{if(!(_0x705ce1 instanceof et))throw _0x705ce1;this['_handleReconnectionError']();}}}}destroy(){const _0x5a4354=this['editor']['plugins']['get'](z),_0x3a4afd=this['editor']['plugins']['get'](Y);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x3a4afd['channelSessions']['has'](this['_channelId'])&&_0x3a4afd['unregister'](this['_channelId']),_0x5a4354['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async _handleReconnectionResponse(_0x12a1ee){if(this['sessionId']!==_0x12a1ee['sessionId']&&this['_lastSyncedOperationId']!==_0x12a1ee['lastOperationId'])throw new et();return this['sessionId']=_0x12a1ee['sessionId'],this['_handleServerResponse']([],{..._0x12a1ee,'wereChangesApplied':!0x1,'data':_0x12a1ee['data']},'reconnect');}async _connectService(_0x504512,_0x55b211=!0x1){const {connection:_0x370ac2}=this['editor']['plugins']['get'](z);RealTimeCollaborationClient['CollaborativeEditingService']['getConnectedSessions'](_0x370ac2,this['_channelId'])['then'](_0x395f53=>this['_initSessionsHandling'](_0x395f53))['catch'](_0x43458f=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x43458f);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x1cf07f,_0x516abf)=>{this['_crash']('realtimecollaborationclient-init-service-internal-error',_0x516abf);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_handleChannelDisconnected']();});const _0x369169=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x504512);this['_isPendingUpdate']=!0x0;const _0x32c2f3=await this['_service']['connect'](_0x370ac2,this['_compressOperations'](_0x504512),_0x369169);if(this['sessionId']=_0x32c2f3['sessionId'],_0x55b211){if(!_0x32c2f3['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x32c2f3['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0x504512,_0x32c2f3,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x32c2f3,_0x504512);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}_handleSendingSelectionMarkers(){const _0x20357c=this['editor']['plugins']['get'](Y),_0x2497aa=this['editor']['plugins']['get'](K),_0x3329a9=_0x20357c['channelSessions']['get'](this['_channelId']);_0x3329a9&&_0x3329a9['length']>0x1?_0x2497aa['createUserMarkerOperations']():this['listenTo'](_0x20357c,'sessionAdd:'+this['_channelId'],()=>{0x2===_0x20357c['channelSessions']['get'](this['_channelId'])['length']&&_0x2497aa['createUserMarkerOperations']();});}async _handleReceivedOperations(_0x5bf8f5,_0x46778e,_0x1d5bee,_0x2a6130){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x46778e){const _0x4fbe85=this['_decompressOperations'](_0x1d5bee,_0x2a6130);await this['_fetchMissingUsers'](_0x4fbe85),this['_handleExternalOperations'](_0x4fbe85,_0x46778e,_0x1d5bee['lastOperationId'])||this['_crash']('realtimecollaborationclient-init-service-incorrect-server-operation');}}async _connectAfterSessionHasBeenFlushed(){this['_disconnectService']();const {locale:_0x5ed43f}=this['editor'];let _0x5d4623;try{_0x5d4623=await this['_service']['getDocumentDetails']();}catch{const _0x1c7c48=X(_0x5ed43f,'The\x20document\x20details\x20could\x20not\x20be\x20taken\x20during\x20the\x20reconnection.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.');return void this['_handleReconnectionError'](_0x1c7c48);}const _0x3f5342=_0x5d4623['currentDocumentSession']||_0x5d4623['lastDocumentSession'];if(this['_lastSyncedOperationId']!==_0x3f5342['lastOperationId']){const _0x1b779b=X(_0x5ed43f,'The\x20last\x20saved\x20version\x20of\x20the\x20document\x20does\x20not\x20match\x20the\x20local\x20version.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.');return void this['_handleReconnectionError'](_0x1b779b);}await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);}_handleChannelDisconnected(){const _0x74820c=this['editor']['plugins']['get'](z);if(this['_isConnected']=!0x1,!_0x74820c['connection']||'connected'!==_0x74820c['connection']['state'])return;this['_isChannelFlushed']=!0x0;const _0x1cc37b=this['editor']['plugins']['get'](Y);_0x1cc37b['channelSessions']['has'](this['_channelId'])&&_0x1cc37b['unregister'](this['_channelId']),_0x74820c['removeFromReconnectionStack'](this),this['_disconnectService']();}_disconnectService(){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['stopListening'](this['_service']);}_initSessionsHandling(_0x276316){const _0x2a0604=this['editor']['plugins']['get'](Y);this['listenTo'](_0x2a0604,'sessionAdd:'+this['_channelId'],(_0x36f0b9,{session:_0x4f7d9a})=>{if(_0x4f7d9a['id']===_0x2a0604['mySessionId']){_0x36f0b9['off']();const _0x3fe2a5=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0x404cc0=_0x4f7d9a['permissions'];_0x3fe2a5&&_0x3fe2a5['isEnabled']&&(_0x404cc0=_0x404cc0['filter'](_0x11ab64=>'document:write'!==_0x11ab64)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0x404cc0,this['_channelId']);}}),_0x2a0604['register'](this['_channelId'],_0x276316);}_initThrowingOnDataSet(){const _0x3b8404=this['editor']['data']['set'];this['editor']['data']['set']=(..._0x3d6eaa)=>{if(!_0x3d6eaa[_0x3d6eaa['length']-0x1]['suppressErrorInCollaboration'])throw new _0xacbaf9('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x3b8404['apply'](this['editor']['data'],_0x3d6eaa);};}_setUpDataInit(){this['editor']['data']['on']('init',(_0x463377,[_0x49f21c])=>{if(this['_document']['version'])throw new _0xacbaf9('realtimecollaborationclient-init-document-already-initialized',this);_0x463377['stop'](),this['_setPendingAction']();const _0xb22e6f=Object['fromEntries'](Object['entries'](this['editor']['config']['get']('roots')||{})['filter'](([,_0x2c4014])=>!_0x2c4014['lazyLoad'])['map'](([_0x11c0e1,_0x5b17f9])=>[_0x11c0e1,_0x5b17f9['modelAttributes']||{}])),_0x10ad76=this['_getOperationsFromInitData'](_0x49f21c,_0xb22e6f);0x0==_0x10ad76['length']&&_0x10ad76['push'](new _0x55cc7a(0x0)),_0x463377['return']=this['_connectService'](_0x10ad76)['then'](()=>{this['editor']['plugins']['get'](z)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x115162=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x115162))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0xfa363,[_0x32e613,_0x1db377])=>{_0xfa363['stop']();const _0x55582f=this['editor']['model']['document']['getRoot'](_0x32e613);if(!this['_knownRootNames']['has'](_0x32e613)){const _0x400745=_0x1db377&&_0x1db377['data']?_0x1db377['data']:'',_0x413a42=_0x1db377&&_0x1db377['attributes']?_0x1db377['attributes']:{};await this['_loadRoot'](_0x32e613,_0x400745,_0x413a42);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0x55582f['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0x55582f);});},{'priority':'high'});}async _fetchMissingUsers(_0x14b0e8){const _0x9f85c6=this['editor']['plugins']['get'](_0x4a35a9),{connection:_0x552729}=this['editor']['plugins']['get'](z),_0x248216=new Set();for(const _0x56f31b of _0x14b0e8){const _0x406267=_0x56f31b['_authorId'];_0x406267&&!_0x9f85c6['getUser'](_0x406267)&&_0x248216['add'](_0x406267);}if(0x0===_0x248216['size'])return;const _0x712672=await _0x52b3e1['getMany'](_0x552729,Array['from'](_0x248216));for(const _0x1b7c32 of _0x712672)_0x9f85c6['getUser'](_0x1b7c32['id'])||_0x9f85c6['addUser'](_0x1b7c32);}_getOperationsFromInitData(_0x1337c4,_0x315262={}){const _0x3c8d9f=this['editor']['model'],_0x5b547f=[];let _0x249c67=0x0;const _0x107595='string'==typeof _0x1337c4?{'main':_0x1337c4}:_0x1337c4;for(const _0x20192d of Object['keys'](_0x107595)){if(!this['_document']['roots']['has'](_0x20192d))throw new _0xacbaf9('realtimecollaborationclient-init-non-existent-root',this);const _0x26e5a3=this['_document']['getRoot'](_0x20192d),_0x4211ab=this['editor']['data']['parse'](_0x107595[_0x20192d],_0x26e5a3),_0x5bead2=new _0x94d6d2(_0x3c8d9f['createPositionAt'](_0x26e5a3,0x0),_0x4211ab,_0x249c67++);_0x5b547f['push'](_0x5bead2);for(const [_0x501078,_0x46786c]of _0x4211ab['markers']){const _0xdc9476=new _0x202700(_0x501078,null,_0x3c8d9f['createRange'](_0x3c8d9f['createPositionFromPath'](_0x26e5a3,_0x46786c['start']['path']['slice']()),_0x3c8d9f['createPositionFromPath'](_0x26e5a3,_0x46786c['end']['path']['slice']())),_0x3c8d9f['markers'],!0x0,_0x249c67++);_0x5b547f['push'](_0xdc9476);}}if(_0x315262)for(const [_0x503765,_0x5e213b]of Object['entries'](_0x315262)){const _0x3f2b18=_0x3c8d9f['document']['getRoot'](_0x503765);if(!_0x3f2b18)throw new _0xacbaf9('multi-root-editor-root-attributes-no-root',null);for(const [_0x2c9686,_0x192ca5]of Object['entries'](_0x5e213b))if(null!==_0x192ca5){const _0x51139a=new _0x9153cb(_0x3f2b18,_0x2c9686,null,_0x192ca5,_0x249c67++);_0x5b547f['push'](_0x51139a);}}return _0x5b547f;}async _loadRoot(_0x5d33aa,_0x467f6a,_0x5b90ec){this['_getOperationsFromInitData']({[_0x5d33aa]:_0x467f6a},{[_0x5d33aa]:_0x5b90ec})['forEach']((_0x49b95c,_0x3d44e2)=>{_0x49b95c['baseVersion']=this['_document']['version']+_0x3d44e2,_0x49b95c['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x49b95c);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async _handleInitialConnectionData(_0x305716,_0x130198){let _0x638f93;this['_offset']=_0x305716['offset'];const _0x54301e=_0x305716['wereChangesApplied']&&!_0x305716['initData'],_0x56d777=_0x54301e?0x0:_0x305716['data']['baseVersion'];if(_0x130198['forEach'](_0x1d25d9=>{_0x1d25d9['_isInit']=!0x0,_0x1d25d9['createdAt']=_0x305716['sessionCreatedAt'],_0x1d25d9['_authorId']=null;}),_0x54301e)_0x638f93=_0x130198,this['_applyOperationsSet'](_0x638f93,_0x54301e);else{if(_0x305716['initData']){const _0x24918b=this['_getOperationsFromInitData'](_0x305716['initData']);this['_document']['history']['version']=-_0x24918b['length'],_0x24918b['forEach'](_0x14bd94=>{_0x14bd94['baseVersion']-=_0x24918b['length'],_0x14bd94['createdAt']=_0x305716['sessionCreatedAt'],_0x14bd94['_isInit']=!0x0,_0x14bd94['_authorId']=null;}),this['_applyOperationsSet'](_0x24918b,!0x0),this['serverHistory']['version']=-_0x24918b['length']+this['_offset'],this['_updateServerHistory'](_0x24918b);}this['_document']['history']['version']=_0x56d777,_0x638f93=this['_decompressOperations'](_0x305716['data'],_0x305716['metadata']),await this['_fetchMissingUsers'](_0x638f93),this['_applyOperationsSet'](_0x638f93,_0x54301e);}_0x305716['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x638f93,_0x305716['lastOperationId']),this['_lastSyncedOperationId']=_0x305716['lastOperationId']),this['serverHistory']['version']=_0x56d777+this['_offset'],this['_updateServerHistory'](_0x638f93),_0x130198['filter'](_0x2aec30=>{const _0x316030=this['_getAffectedRoot'](_0x2aec30);return _0x316030&&!this['_knownRootNames']['has'](_0x316030);})['forEach']((_0x28f806,_0x136be5)=>{_0x28f806['baseVersion']=this['_document']['version']+_0x136be5,this['_saveOperationInBuffer'](_0x28f806);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x10cd8d,_0x2ddf31){const _0x4d6468=_0x2ddf31&&_0x2ddf31['message'];if(_0x4d6468&&_0x4d6468['startsWith']('realtimecollaborationclient'))throw _0x2ddf31;const _0x2a89d3=this['editor']['plugins']['get'](z);throw this['_isPendingUpdate']=!0x0,_0x2a89d3['disconnect'](),this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0xacbaf9(_0x10cd8d,this['editor'],_0x4d6468?{'originalError':_0x4d6468}:void 0x0);}_saveOperationInBuffer(_0x29ca01){this['_knownOperations']['has'](_0x29ca01)||(this['_knownOperations']['add'](_0x29ca01),this['_bufferedOperations']['push'](_0x29ca01),this['_pendingAction']||'marker'==_0x29ca01['type']&&!_0x29ca01['affectsData']||this['_setPendingAction']());}_sendBufferedOperationsDelayed(_0x23f3e2=!0x1){!_0x23f3e2&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0x1b9805=>{_0x1b9805&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0x29bf25=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0x1d7fb0){return _0x1d7fb0['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x1d7fb0['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0x1d7fb0['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0x29bf25)||this['_crash'](_0x29bf25['message'],_0x29bf25);});},this['_currentBufferDelay']));}_waitUntilSynced(){return new Promise(_0x503de9=>{this['on']('change:_isPendingUpdate',()=>{_0x503de9();});});}async _sendBufferedOperations(){const _0x5b5869=this['editor']['plugins']['get'](K);if(this['_shouldSendSelectionUpdate']()&&(_0x5b5869['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x43e6d1=[...this['_bufferedOperations']];for(const _0x51e882 of _0x43e6d1)_0x51e882['wasUndone']=this['_document']['history']['isUndoneOperation'](_0x51e882);const _0x660bf1=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x43e6d1),_0xb52c6c=Z++,_0x5d3e5e=this['_compressOperations'](_0x43e6d1),_0x32bfb0=await this['_service']['sendOperations'](_0x5d3e5e,_0x5d3e5e['baseVersion'],_0x660bf1);try{return await this['_handleServerResponse'](_0x43e6d1,_0x32bfb0,_0xb52c6c);}catch(_0x3b345b){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0x3b345b);}}async['_handleServerResponse'](_0x544fbe,_0x3d8176,_0xf2e9de){if('error'in _0x3d8176)throw _0x3d8176['error'];let _0x735506;if(_0x3d8176['wereChangesApplied']){_0x3d8176['lastOperationId']&&(this['_lastSyncedOperationId']=_0x3d8176['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x30311a=>!_0x544fbe['includes'](_0x30311a));for(const _0x302491 of _0x544fbe)_0x302491['createdAt']='lastOperationAcceptedAt'in _0x3d8176&&_0x3d8176['lastOperationAcceptedAt']||void 0x0;st(_0x544fbe,_0x3d8176['version']-_0x544fbe['length']),this['_updateServerHistory'](_0x544fbe);const _0x3df19f=_0x544fbe['filter'](_0x326813=>{if(!_0x326813['_isInit'])return!0x1;const _0x4fc0df=this['_getAffectedRoot'](_0x326813);return _0x4fc0df&&!this['_knownRootNames']['has'](_0x4fc0df);});st(_0x3df19f,this['_document']['version']),this['_applyOperationsSet'](_0x3df19f),_0x735506=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0x2311d6=this['_decompressOperations'](_0x3d8176['data'],_0x3d8176['metadata'])['filter'](_0x540631=>_0x540631['baseVersion']>=this['_lastServerVersion']);_0x2311d6['forEach'](_0x3e96a9=>this['_addKnownRoot'](_0x3e96a9)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x3f901f=>!_0x3f901f['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x3f901f))),this['_bufferedOperations']['length']&&st(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0x2311d6),_0x735506=this['_handleExternalOperations'](_0x2311d6,_0x3d8176['version'],_0x3d8176['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x735506?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}_handleExternalOperations(_0x5def37,_0x1b8875,_0x552624){try{const _0x31e7df={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x568357,operationsB:_0x33e552,originalOperations:_0x493f64}=_0x234e40(_0x5def37,this['_bufferedOperations'],_0x31e7df);st(_0x568357,this['_document']['version']),st(_0x33e552,_0x1b8875);for(const _0x183f6b of _0x568357){const _0x3bbc58=_0x493f64['get'](_0x183f6b);_0x3bbc58?(_0x183f6b['_authorId']=_0x3bbc58['_authorId'],'noop'!==_0x183f6b['type']&&(_0x183f6b['_aiSource']=_0x3bbc58['_aiSource'])):_0x183f6b['_authorId']=null;}for(const _0xa479d of _0x33e552)'noop'!==_0xa479d['type']&&(_0xa479d['_aiSource']=_0x493f64['get'](_0xa479d)?.['_aiSource']);_0x552624&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x5def37,_0x552624),this['_lastSyncedOperationId']=_0x552624),this['_bufferedOperations']=[..._0x33e552],this['_applyOperationsSet'](_0x568357),this['_updateServerHistory'](_0x5def37);}catch(_0x1f8161){return console['error'](_0x1f8161),!0x1;}return!0x0;}_applyOperationsSet(_0x383971,_0x5afb32=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0xba46ab=>{for(const _0x3fafc3 of _0x383971)this['_knownOperations']['add'](_0x3fafc3),this['_addKnownRoot'](_0x3fafc3),_0xba46ab['batch']['addOperation'](_0x3fafc3),this['editor']['model']['applyOperation'](_0x3fafc3);});}_addKnownRoot(_0x2d0654){const _0x437ef5=this['_getAffectedRoot'](_0x2d0654);_0x437ef5&&this['_knownRootNames']['add'](_0x437ef5);}_getAffectedRoot(_0xe45ac2){let _0x64883c,_0x3d7da4;switch(_0xe45ac2['type']){case'insert':_0x64883c=_0xe45ac2['position']['root'];break;case'marker':if(_0x3d7da4=_0xe45ac2['newRange'],!_0x3d7da4)return null;_0x64883c=_0x3d7da4['root'];break;case'addRootAttribute':_0x64883c=_0xe45ac2['root'];break;case'addRoot':_0x64883c=_0xe45ac2['affectedSelectable'];break;case'move':_0x64883c=_0xe45ac2['targetPosition']['root'];break;default:return null;}return _0x64883c['rootName'];}_updateServerHistory(_0x1f6a72){_0x1f6a72['forEach'](_0x2adcb7=>{const _0x439be8=_0x2adcb7['clone']();_0x439be8['_authorId']=_0x2adcb7['_authorId'],_0x439be8['_isInit']=!!_0x2adcb7['_isInit'],_0x439be8['_aiSource']=_0x2adcb7['_aiSource'],_0x439be8['createdAt']=_0x2adcb7['createdAt'],_0x439be8['baseVersion']+=this['_offset'],_0x2adcb7['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x439be8),this['serverHistory']['addOperation'](_0x439be8);});}_handleReconnectionError(_0x7b752b){const _0x3e262d=this['editor']['plugins']['get']('Notification'),_0x1105b3=this['editor']['locale'];_0x7b752b||(_0x7b752b=X(_0x1105b3,'The\x20local\x20document\x20and\x20server\x20document\x20differ\x20and\x20merging\x20them\x20can\x20cause\x20unexpected\x20behavior.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.')),_0x3e262d['showWarning'](_0x7b752b,{'title':X(_0x1105b3,'Synchronization\x20issue'),'namespace':'real-time-collaboration'}),this['_hasSynchronizationProblem']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_bufferedOperations']=[],this['editor']['plugins']['get'](z)['disconnect']();}_setPendingAction(){this['_pendingAction']||(this['_pendingAction']=this['editor']['plugins']['get'](_0x9003cc)['add'](X(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}_clearPendingAction(){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x9003cc)['remove'](this['_pendingAction']),this['_pendingAction']=null);}_compressOperations(_0x1dae3c){const _0x4eaf25=_0x1dae3c['map'](_0x4f21c7=>_0x4f21c7['toJSON']());return this['_compressor']['compress'](_0x4eaf25);}_decompressOperations(_0x39fb5b,_0x9a8284){return this['_compressor']['decompress'](_0x39fb5b)['map']((_0x2bfcf6,_0x45a29e)=>{const _0x5aa8c6='init'==_0x9a8284[_0x45a29e]['type'];if('InsertOperation'==_0x2bfcf6['__className']){const _0x5dde67=_0x2bfcf6['position']['root'];!this['_document']['getRoot'](_0x5dde67)&&(this['_document']['createRoot']('$unknown',_0x5dde67)['_isAttached']=!0x1);}else{if('RootOperation'==_0x2bfcf6['__className']){const _0x2d03ca=this['_document']['getRoot'](_0x2bfcf6['rootName']);_0x2d03ca&&'$unknown'==_0x2d03ca['name']&&_0x2bfcf6['elementName']!=_0x2d03ca['name']&&(_0x2d03ca['name']=_0x2bfcf6['elementName']);}}const _0x990da=_0x46062f['fromJSON'](_0x2bfcf6,this['_document']);return _0x990da['wasUndone']=_0x2bfcf6['wasUndone'],_0x990da['_isInit']=_0x5aa8c6,_0x990da['_authorId']=_0x5aa8c6?null:_0x9a8284[_0x45a29e]['userId'],_0x990da['_isDisconnection']='cs:removeUser'===_0x9a8284[_0x45a29e]['type'],_0x990da['_aiSource']=_0x2bfcf6['_aiSource']||void 0x0,_0x990da['createdAt']=_0x9a8284[_0x45a29e]['createdAt'],_0x990da;});}_refreshUserSelectionMarkers(){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}_shouldSendSelectionUpdate(){const _0x562686=this['editor']['plugins']['get'](Y)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0x562686&&_0x562686['length']>0x1&&this['_hasSelectionChanged'];}_shouldSendUpdate(){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}},et=class extends Error{};function st(_0x1bb6eb,_0x312ebc){for(const _0x207668 of _0x1bb6eb)_0x207668['baseVersion']=_0x312ebc++;}var it=class{_ignoredOperations;_operationToId;constructor(_0x5f156d){this['_ignoredOperations']=_0x5f156d,this['_operationToId']=new WeakMap();}getIdOfTheLastOperation(_0x512cf6){let _0x3eb7b2=_0x512cf6['length'];for(;_0x3eb7b2--;){const _0x40fcbd=_0x512cf6[_0x3eb7b2];if(!this['_ignoredOperations']['has'](_0x40fcbd)){if(!this['_operationToId']['has'](_0x40fcbd)){const _0x416120=_0xeff1dd()['slice'](0x1,0x12);this['_operationToId']['set'](_0x40fcbd,_0x416120);}return this['_operationToId']['get'](_0x40fcbd);}}}setIdForTheLastOperation(_0x188c6d,_0x4e48a2){if(!_0x4e48a2)return;let _0xc74e2d=_0x188c6d['length'];for(;_0xc74e2d--;){const _0x2a6e79=_0x188c6d[_0xc74e2d];this['_ignoredOperations']['has'](_0x2a6e79)||this['_operationToId']['set'](_0x2a6e79,_0x4e48a2);}}},nt=class extends _0x2fd2b9{static get requires(){return[tt];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},ot=class CloudServicesCommentsAdapter extends _0xd1e979{static CommentsService=/* #__PURE__ -- @preserve */
26
+ ((()=>_0x258961)());['_services'];static get requires(){return[z,_0x39df5c,Y,_0x4a35a9];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x518a44){super(_0x518a44),this['_services']=new Map();}async init(){const _0x275188=this['context'],_0x57aab1=_0x275188['plugins']['get'](_0x39df5c);if(_0x275188['plugins']['get'](z)['addToReconnectionStack'](this),_0x57aab1['adapter']={'addCommentThread':async({channelId:_0x3b53e2,threadId:_0x960512,comments:_0x3a1ba3,resolvedAt:_0x1f65a2,resolvedBy:_0xf1a2ab,context:_0x1770f0,attributes:_0x11de29})=>{const _0x50f2f2=await this['_getService'](_0x3b53e2)['addCommentThread']({'commentThreadId':_0x960512,'comments':_0x3a1ba3['map'](_0x57b8b0=>function(_0x5e2b1a,_0x2a31fa,_0x1138a3){return{'commentThreadId':_0x1138a3,'commentId':_0x5e2b1a['commentId'],'userId':_0x5e2b1a['authorId'],'content':_0x5e2b1a['content'],'documentId':_0x2a31fa,'createdAt':_0x5e2b1a['createdAt'],'attributes':_0x5e2b1a['attributes']||{}};}(_0x57b8b0,_0x3b53e2,_0x960512)),'resolvedAt':_0x1f65a2,'resolvedBy':_0xf1a2ab,'context':_0x1770f0,'attributes':_0x11de29})['catch'](ct);return{'threadId':_0x50f2f2['commentThreadId'],'comments':_0x50f2f2['comments']};},'getCommentThread':async({channelId:_0x32ea79,threadId:_0x49b82e})=>{const _0x16d6c3=await this['_getService'](_0x32ea79)['getCommentThread'](_0x49b82e)['catch'](rt)['catch'](ct);return _0x16d6c3?_0x16d6c3['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0x16d6c3]),{'threadId':_0x16d6c3['commentThreadId'],'comments':_0x16d6c3['comments']['map'](at),'context':_0x16d6c3['context'],'resolvedAt':_0x16d6c3['resolvedAt'],'resolvedBy':_0x16d6c3['resolvedBy'],'attributes':_0x16d6c3['attributes']||{}}):null;},'updateCommentThread':async({channelId:_0x157330,threadId:_0x2c2945,context:_0x5be877,unlinkedAt:_0x5c10cf,attributes:_0x49878d})=>this['_getService'](_0x157330)['updateCommentThread']({'commentThreadId':_0x2c2945,'context':_0x5be877,'attributes':_0x49878d,'unlinkedAt':_0x5c10cf})['catch'](rt)['catch'](ct),'resolveCommentThread':async({channelId:_0x193729,threadId:_0x317292})=>{const _0x5b2e5f=await this['_getService'](_0x193729)['resolveCommentThread'](_0x317292)['catch'](rt)['catch'](ct);return{'threadId':_0x5b2e5f['commentThreadId'],'resolvedAt':_0x5b2e5f['resolvedAt'],'resolvedBy':_0x5b2e5f['resolvedBy']};},'reopenCommentThread':async({channelId:_0x41feb5,threadId:_0x8a6c8b})=>this['_getService'](_0x41feb5)['reopenCommentThread'](_0x8a6c8b)['catch'](rt)['catch'](ct),'removeCommentThread':({channelId:_0xb30ee9,threadId:_0x107a02})=>this['_getService'](_0xb30ee9)['removeCommentThread'](_0x107a02)['catch'](rt)['catch'](ct),'addComment':({channelId:_0x530718,threadId:_0x1fccba,commentId:_0x5063eb,content:_0x581097,attributes:_0x184ab7})=>this['_getService'](_0x530718)['addComment'](_0x1fccba,_0x5063eb,_0x581097,_0x184ab7)['catch'](ct),'updateComment':({channelId:_0x126c71,threadId:_0x4462b3,commentId:_0x4a81a0,content:_0x16f87a,attributes:_0x3d65ca})=>this['_getService'](_0x126c71)['updateComment'](_0x4462b3,_0x4a81a0,_0x16f87a,_0x3d65ca)['catch'](rt)['catch'](ct),'removeComment':({channelId:_0x4f2d2d,threadId:_0xe9ed39,commentId:_0xf3c001})=>this['_getService'](_0x4f2d2d)['removeComment'](_0xe9ed39,_0xf3c001)['catch'](rt)['catch'](ct)},_0x275188 instanceof _0x3ecfdb){const _0x3ff763=_0x275188['config']['get']('collaboration.channelId'),_0x24d4c6=_0x275188['plugins']['get'](Y);await this['_setUpService'](_0x3ff763);const _0x2dce13=await this['_services']['get'](_0x3ff763)['getConnectedSessions']();this['listenTo'](_0x24d4c6,'sessionAdd:'+_0x3ff763,(_0x1228f0,{session:_0x1c4c46})=>{_0x1c4c46['id']===_0x24d4c6['mySessionId']&&(_0x1228f0['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x1c4c46['permissions'],_0x3ff763));}),_0x24d4c6['register'](_0x3ff763,_0x2dce13);}}async _setUpService(_0x893c9){if(this['_services']['has'](_0x893c9))throw new _0xacbaf9('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0x893c9});const _0x4bf7f5=this['context']['plugins']['get'](_0x39df5c),_0x4d45a6=new CloudServicesCommentsAdapter['CommentsService'](_0x893c9);this['_services']['set'](_0x893c9,_0x4d45a6),this['listenTo'](_0x4d45a6,'commentThreadAdded',(_0x48869d,_0x5c4ea0)=>{const {commentThreadId:_0x2c73e9,documentId:_0x31b0a3,context:_0xc66e73,attributes:_0x38ce59,resolvedAt:_0xd0b9f9,resolvedBy:_0xa1e8df,comments:_0x294409}=_0x5c4ea0;_0x4bf7f5['getCommentThread'](_0x2c73e9)||_0x4bf7f5['addCommentThread']({'threadId':_0x2c73e9,'channelId':_0x31b0a3,'comments':_0x294409?_0x294409['map'](at):[],'context':_0xc66e73,'attributes':_0x38ce59,'resolvedAt':_0xd0b9f9,'resolvedBy':_0xa1e8df,'isFromAdapter':!0x0});}),this['listenTo'](_0x4d45a6,'commentThreadUpdated',(_0x3ca7bd,{commentThreadId:_0xf03458,documentId:_0x4c6e07,context:_0x36f200,unlinkedAt:_0x3e222f,attributes:_0x42b044})=>{_0x4bf7f5['getCommentThread'](_0xf03458)&&_0x4bf7f5['updateCommentThread']({'threadId':_0xf03458,'channelId':_0x4c6e07,'context':_0x36f200,'unlinkedAt':_0x3e222f,'attributes':_0x42b044,'isFromAdapter':!0x0});}),this['listenTo'](_0x4d45a6,'commentThreadResolved',(_0xa019bd,{commentThreadId:_0x453759,resolvedBy:_0x3b0b5c,resolvedAt:_0x2a3d95})=>{const _0x19b09c=_0x4bf7f5['getCommentThread'](_0x453759);_0x19b09c&&_0x19b09c['resolve']({'resolvedBy':_0x3b0b5c,'resolvedAt':_0x2a3d95,'isFromAdapter':!0x0});}),this['listenTo'](_0x4d45a6,'commentThreadReopened',(_0x211d0b,{commentThreadId:_0x4f55ed})=>{const _0x22af0a=_0x4bf7f5['getCommentThread'](_0x4f55ed);_0x22af0a&&_0x22af0a['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0x4d45a6,'commentThreadRemoved',(_0x218ed8,{commentThreadId:_0x4115a3})=>{const _0x37580f=_0x4bf7f5['getCommentThread'](_0x4115a3);_0x37580f&&_0x37580f['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0x4d45a6,'commentAdded',(_0x2f3475,_0x44995c)=>{const _0x467995=_0x44995c['commentThreadId'],_0x3b5407=_0x4bf7f5['getCommentThread'](_0x467995);_0x3b5407&&_0x3b5407['addComment']({...at(_0x44995c),'isFromAdapter':!0x0});}),this['listenTo'](_0x4d45a6,'commentUpdated',(_0x1cb430,{commentThreadId:_0x48cc04,commentId:_0x5656a5,content:_0x20d241,attributes:_0x2e5193})=>{const _0x589e3a=_0x4bf7f5['getCommentThread'](_0x48cc04);if(_0x589e3a){const _0x429a09=_0x589e3a['getComment'](_0x5656a5);_0x429a09&&_0x429a09['update']({'content':_0x20d241,'attributes':_0x2e5193,'isFromAdapter':!0x0});}}),this['listenTo'](_0x4d45a6,'commentRemoved',(_0x2ee09f,{commentThreadId:_0x3b16ac,commentId:_0x2668a3})=>{const _0x54b2ef=_0x4bf7f5['getCommentThread'](_0x3b16ac);if(_0x54b2ef){const _0x28bbb9=_0x54b2ef['getComment'](_0x2668a3);_0x28bbb9&&_0x28bbb9['remove']({'isFromAdapter':!0x0});}}),this['listenTo'](_0x4d45a6,'disconnected',()=>{'connected'===this['context']['plugins']['get'](z)['connection']?.['state']&&(this['_services']['delete'](_0x893c9),this['stopListening'](_0x4d45a6));}),await this['_connectService'](_0x893c9);}destroy(){if(this['context']instanceof _0x3ecfdb){const _0x3ab25e=this['context']['config']['get']('collaboration.channelId');this['_services']['has'](_0x3ab25e)&&this['_terminateService'](_0x3ab25e);}}_terminateService(_0x59c8a4){if(!this['_services']['has'](_0x59c8a4))throw new _0xacbaf9('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0x59c8a4});this['_getService'](_0x59c8a4)['disconnect'](),this['_services']['delete'](_0x59c8a4);}async reconnect(){for(const _0x4daba6 of this['_services']['keys']())await this['_connectService'](_0x4daba6);if(this['context']instanceof _0x3ecfdb){const _0x42ded7=this['context']['config']['get']('collaboration.channelId');if(this['_services']['has'](_0x42ded7)){const _0x545af5=this['context']['plugins']['get'](Y);_0x545af5['unregister'](_0x42ded7);const _0x289e01=await this['_services']['get'](_0x42ded7)['getConnectedSessions']();_0x545af5['register'](_0x42ded7,_0x289e01);}}}async _connectService(_0x571332){const {connection:_0x232ef7}=this['context']['plugins']['get'](z),_0x55a01d=this['context']['plugins']['get'](_0x39df5c),_0x525433=await this['_services']['get'](_0x571332)['connect'](_0x232ef7);await this['_fetchMissingUsersForThreads'](_0x525433);const _0x199e2a=new Set(Array['from'](_0x55a01d['getCommentThreads']({'channelId':_0x571332}),_0x5b8ee0=>_0x5b8ee0['id']));for(const _0x56ced7 of _0x525433)_0x56ced7['deletedAt']||_0x199e2a['delete'](_0x56ced7['commentThreadId']);for(const _0x3c0829 of _0x199e2a)_0x55a01d['getCommentThread'](_0x3c0829)['remove']({'isFromAdapter':!0x0});for(const _0x44b6f1 of _0x525433){let _0x13709a=_0x55a01d['getCommentThread'](_0x44b6f1['commentThreadId']);const {commentThreadId:_0x5053a3,context:_0x2fc269,attributes:_0xecb3d5,resolvedBy:_0xe98ed,resolvedAt:_0x233896,unlinkedAt:_0x2c81ed,deletedAt:_0x3bdfb7}=_0x44b6f1;if(_0x3bdfb7)continue;_0x13709a||(_0x13709a=_0x55a01d['addCommentThread']({'channelId':_0x571332,'threadId':_0x5053a3,'context':_0x2fc269,'attributes':_0xecb3d5||{},'resolvedBy':_0xe98ed,'resolvedAt':_0x233896,'unlinkedAt':_0x2c81ed,'isFromAdapter':!0x0}));const _0x3543e4=new Set(Array['from'](_0x13709a['comments'],_0x36c447=>_0x36c447['id']));for(const _0x27f669 of _0x44b6f1['comments'])_0x3543e4['delete'](_0x27f669['commentId']);for(const _0x1df083 of _0x3543e4)_0x13709a['getComment'](_0x1df083)['remove']({'isFromAdapter':!0x0});for(const _0xda1909 of _0x44b6f1['comments']){const _0x498050=_0x13709a['getComment'](_0xda1909['commentId']);_0x498050?_0x498050['content']!==_0xda1909['content']&&_0x498050['update']({'content':_0xda1909['content'],'isFromAdapter':!0x0}):_0x13709a['addComment'](Object['assign'](at(_0xda1909),{'isFromAdapter':!0x0}));}}}_getService(_0xb81e2b){if(!this['_services']['has'](_0xb81e2b))throw new _0xacbaf9('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0xb81e2b});return this['_services']['get'](_0xb81e2b);}async _fetchMissingUsersForThreads(_0x45f77b){const _0x150d0f=this['context']['plugins']['get'](_0x4a35a9),{connection:_0x2ff140}=this['context']['plugins']['get'](z),_0x209392=new Set();for(const {resolvedBy:_0x448494,comments:_0x180991}of _0x45f77b){_0x448494&&!_0x150d0f['getUser'](_0x448494)&&_0x209392['add'](_0x448494);for(const {userId:_0x2ec7d6}of _0x180991)_0x150d0f['getUser'](_0x2ec7d6)||_0x209392['add'](_0x2ec7d6);}if(0x0===_0x209392['size'])return;const _0x2fb636=await _0x52b3e1['getMany'](_0x2ff140,Array['from'](_0x209392));for(const _0x509f00 of _0x2fb636)_0x150d0f['getUser'](_0x509f00['id'])||_0x150d0f['addUser'](_0x509f00);}};async function rt(_0x225515){if('404'!==_0x225515['code'])throw _0x225515;}function ct(_0x12acfe){if((_0x56fbbb=_0x12acfe)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0x56fbbb['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x56fbbb['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0x56fbbb;throw _0x12acfe;}function at(_0x3d4c31){return{'threadId':_0x3d4c31['commentThreadId'],'commentId':_0x3d4c31['commentId'],'content':_0x3d4c31['content'],'createdAt':_0x3d4c31['createdAt'],'authorId':_0x3d4c31['userId'],'attributes':_0x3d4c31['attributes']||{}};}var ht=class CloudServicesTrackChangesAdapter extends _0x2fd2b9{static ['TrackChangesService']=/* #__PURE__ -- @preserve */
27
+ ((()=>_0x4991bf)());_bufferedRequests;_trackChangesService;static get requires(){return[ot,_0x18f46a,z];}static get['pluginName'](){return'CloudServicesTrackChangesAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0xdf4148){super(_0xdf4148);const _0x568af4=this['editor']['config']['get']('collaboration.channelId');this['_bufferedRequests']=new Map(),this['_trackChangesService']=new CloudServicesTrackChangesAdapter['TrackChangesService'](_0x568af4);}init(){const _0x1de429=this['editor']['plugins']['get'](z),_0x5e813a=this['editor']['plugins']['get'](_0x18f46a);return _0x5e813a['adapter']={'getSuggestion':async _0x1a5923=>{await this['_waitForServiceReady']();const _0x3a2fb8=await this['_trackChangesService']['get'](_0x1a5923)['catch'](lt);return await this['_fetchMissingUsersForThreads']([_0x3a2fb8]),_0x3a2fb8;},'addSuggestion':async({id:_0x53d808,type:_0x4e9e59,data:_0x1c8402,originalSuggestionId:_0x59a685,attributes:_0x49653d})=>{await this['_waitForServiceReady']();const _0x5a92ac={'id':_0x53d808,'type':_0x4e9e59,'data':_0x1c8402,'originalSuggestionId':_0x59a685,'attributes':_0x49653d},_0x1d28f4=await this['_trackChangesService']['add'](_0x53d808,_0x4e9e59,_0x1c8402,_0x59a685,_0x49653d)['catch'](_0xe53950=>{if(dt(_0xe53950))return new Promise(_0x148c7f=>{this['_bufferedRequests']['set'](_0x53d808,{'resolve':_0x148c7f,'suggestionData':_0x5a92ac});});throw _0xe53950;});return this['_bufferedRequests']['delete'](_0x53d808),_0x1d28f4;},'updateSuggestion':async(_0x314744,_0x3fc394)=>{if(await this['_waitForServiceReady'](),'open'!==_0x3fc394['state'])return this['_trackChangesService']['update'](_0x314744,_0x3fc394)['catch'](lt);}},this['listenTo'](this['_trackChangesService'],'suggestionUpdated',(_0xb690f9,_0x1e3002)=>{_0x5e813a['hasSuggestion'](_0x1e3002['id'])&&(_0x5e813a['getSuggestion'](_0x1e3002['id'])['attributes']=_0x1e3002['attributes']);}),this['listenTo'](this['_trackChangesService'],'disconnected',()=>{'connected'===_0x1de429['connection']?.['state']&&(_0x1de429['removeFromReconnectionStack'](this),this['stopListening'](this['_trackChangesService']));}),this['_trackChangesService']['connect'](_0x1de429['connection'])['then'](_0x2a10fb=>(_0x1de429['addToReconnectionStack'](this),this['_fetchMissingUsersForThreads'](_0x2a10fb)['then'](()=>{for(const _0x525a4a of _0x2a10fb){_0x5e813a['addSuggestionData'](_0x525a4a)['_saved']=!0x0;}})));}async reconnect(){const _0x2f2b27=this['editor']['plugins']['get']('TrackChangesEditing'),{connection:_0x386b08}=this['editor']['plugins']['get'](z),_0x529972=await this['_trackChangesService']['connect'](_0x386b08);await this['_fetchMissingUsersForThreads'](_0x529972);for(const {suggestionData:_0x58b828,resolve:_0x522bf4}of this['_bufferedRequests']['values']()){let _0x5e48de=_0x529972['find'](_0x3bb970=>_0x3bb970['id']===_0x58b828['id']);_0x5e48de||(_0x5e48de=await this['_trackChangesService']['add'](_0x58b828['id'],_0x58b828['type'],_0x58b828['data'],_0x58b828['originalSuggestionId'])),_0x522bf4(_0x5e48de);}for(const _0x43192a of _0x529972)_0x2f2b27['hasSuggestion'](_0x43192a['id'])||_0x2f2b27['addSuggestionData'](_0x43192a);}async _waitForServiceReady(){this['_trackChangesService']['isConnected']||await new Promise(_0x1c0df5=>{this['listenTo'](this['_trackChangesService'],'connected',_0x2e0670=>{_0x2e0670['off'](),_0x1c0df5();});});}async _fetchMissingUsersForThreads(_0x4c6fcd){const _0x2126b9=this['editor']['plugins']['get'](_0x4a35a9),{connection:_0x147f29}=this['editor']['plugins']['get'](z),_0x13a945=new Set();for(const {authorId:_0x4be97d}of _0x4c6fcd)_0x2126b9['getUser'](_0x4be97d)||_0x13a945['add'](_0x4be97d);if(0x0===_0x13a945['size'])return;const _0xab9bda=await _0x52b3e1['getMany'](_0x147f29,Array['from'](_0x13a945));for(const _0xb8930e of _0xab9bda)_0x2126b9['getUser'](_0xb8930e['id'])||_0x2126b9['addUser'](_0xb8930e);}};function lt(_0x2fa295){if(dt(_0x2fa295))return new Promise(()=>{});throw _0x2fa295;}function dt(_0x527662){return _0x527662['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x527662['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}var ut=class extends _0x2fd2b9{static get requires(){return[_0x18c06f,ot,nt,z];}static get['pluginName'](){return'RealTimeCollaborativeComments';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const _0x5ed5cd=this['editor']['plugins']['get'](z),_0x5357c3=this['editor']['plugins']['get'](_0x394529),_0x27603d=this['editor']['plugins']['get'](ot);return this['editor']['data']['once']('ready',()=>{this['listenTo'](_0x5ed5cd,'change:state',(_0x40ea58,_0x25319f,_0x143d4f)=>{_0x5357c3['isThreadsLoadingPaused']='connected'!==_0x143d4f;});}),this['listenTo'](_0x5ed5cd,'change:state',(_0x12141b,_0x23e790,_0x1b95fb)=>{this['editor']['plugins']['get'](_0x39df5c)['switchReadOnly']('connected'!==_0x1b95fb);}),_0x27603d['_setUpService'](this['editor']['config']['get']('collaboration.channelId'));}destroy(){const _0x2dcce8=this['editor']['plugins']['get'](ot),_0x3dbb9a=this['editor']['config']['get']('collaboration.channelId');_0x2dcce8['_services']['has'](_0x3dbb9a)&&_0x2dcce8['_terminateService'](_0x3dbb9a),super['destroy']();}},ft=class extends _0x2fd2b9{static get requires(){return[ut,ht,_0x350040];}static get['pluginName'](){return'RealTimeCollaborativeTrackChanges';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},mt=class CloudServicesRevisionHistoryAdapter extends _0x2fd2b9{static RevisionHistoryService=/* #__PURE__ -- @preserve */
28
+ ((()=>_0x50f15e)());_lastRequestId;['_revisionTracker'];_revisionHistoryService;_oldOffset;static get requires(){return[z,tt,_0x5811ff,Y,_0x4a35a9];}static get['pluginName'](){return'CloudServicesRevisionHistoryAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x292251){super(_0x292251);const _0x2937cd=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new CloudServicesRevisionHistoryAdapter['RevisionHistoryService'](_0x2937cd);}async init(){const _0x1b1a97=this['editor']['plugins']['get'](tt),_0x4ce502=_0x1b1a97['serverHistory'],_0x3edbce=this['editor']['plugins']['get'](z);this['_revisionTracker']['setSource']({'history':_0x4ce502,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0x1b1a97['sessionId']});const _0x16a3be=this['editor']['config']['get']('cloudServices.bundleVersion')||_0xdf940c,_0x9ded84=await _0x2be39b['isBundleUploaded'](_0x3edbce['connection'],_0x16a3be);this['editor']['plugins']['get'](_0x5811ff)['adapter']={'getRevision':async({revisionId:_0x1bd7c8})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0x1bd7c8)),'updateRevisions':async _0x2c9812=>{await this['_waitForServiceReady']();const _0x24b62d=this['_revisionTracker']['currentRevision'];if(_0x9ded84&&0x1===_0x2c9812['length']&&_0x2c9812[0x0]['id']===_0x24b62d['id'])return _0x2c9812;for(const _0x43755d of _0x2c9812)_0x43755d['id']===_0x24b62d['id']&&(_0x43755d['isEmptyCurrent']=_0x43755d['fromVersion']===_0x43755d['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0x2c9812,this['_lastRequestId'])['then'](_0x2ae174=>(this['_lastRequestId']=_0x2ae174,_0x2c9812))['catch'](_0x442bac=>{if(pt(_0x442bac)||'400'===_0x442bac['code']&&void 0x0!==_0x442bac['data']['wrongRequestId']){for(const _0x397921 of _0x2c9812)this['_revisionTracker']['repository']['getRevision'](_0x397921['id'])&&this['_revisionTracker']['_bufferUpdate'](_0x397921['id'],_0x397921,!0x1);if(pt(_0x442bac)&&'destroyed'!==this['editor']['state'])throw _0x442bac;return _0x2c9812;}throw _0x442bac;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0x11c0a1,{revisionsData:_0x1a503d,requestId:_0x345845})=>{Math['max'](..._0x1a503d['map'](_0x128138=>_0x128138['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0x1a503d,_0x345845);}):this['_handleRevisionsUpdate'](_0x1a503d,_0x345845);}),this['set']('_isServiceConnected',!0x1),this['listenTo'](this['_revisionHistoryService'],'connected',()=>{this['_isServiceConnected']=!0x0;}),this['listenTo'](this['_revisionHistoryService'],'disconnected',()=>{this['_isServiceConnected']=!0x1,'connected'===_0x3edbce['connection']?.['state']&&(_0x3edbce['removeFromReconnectionStack'](this),this['stopListening'](this['_revisionHistoryService']));});const {revisions:_0x8c92ca,requestId:_0x70f09}=await this['_revisionHistoryService']['connect'](_0x3edbce['connection']);_0x3edbce['addToReconnectionStack'](this),this['_lastRequestId']=_0x70f09,await this['_fetchMissingUsers'](_0x8c92ca);for(const _0x56760a of _0x8c92ca)this['_revisionTracker']['addRevisionData'](_0x56760a);this['listenTo'](_0x1b1a97,'change:_isConnected',(_0x1ff198,_0x40274f,_0x4389f1)=>{_0x4389f1&&(this['_oldOffset']=_0x1b1a97['_offset'],_0x1ff198['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](this,'_isServiceConnected');}async reconnect(){const _0x398ff2=this['editor']['plugins']['get'](z),_0x51de11=this['editor']['plugins']['get'](tt),_0x34ee80=async()=>{const _0x1607f9=this['_revisionTracker']['currentRevision'],_0x454b90=_0x1607f9['id'],_0x4fad26=_0x454b90!==_0x51de11['sessionId'];if(_0x4fad26){const _0x5812a4=_0x51de11['_offset']-this['_oldOffset'],_0x59f41e=this['_getLatestVersionFromServerOperations']();if(this['_revisionTracker']['_revisionDataBuilder']['reInit'](),_0x1607f9['toVersion']+_0x5812a4!==_0x59f41e){const _0x5bc519=_0x1607f9['fromVersion']+_0x5812a4,_0x376969=this['editor']['plugins']['get'](_0x4a35a9),_0x1e7738=this['_revisionTracker']['buildRevisionData']({'revision':_0x1607f9,'from':_0x5bc519,'to':_0x59f41e});_0x1e7738['id']=_0x1607f9['id'];const _0x3f0fab=_0x1e7738['authorsIds']['map'](_0x22b414=>_0x376969['getUser'](_0x22b414));_0x1607f9['_update']({..._0x1e7738,'authors':_0x3f0fab},!0x0),this['_revisionTracker']['_bufferUpdate'](_0x1607f9['id'],_0x1e7738,!0x0);}this['_revisionTracker']['_startingVersion']=_0x59f41e,_0x1607f9['toVersion']!==_0x1607f9['fromVersion']||this['_revisionTracker']['_bufferedUpdates']['has'](_0x454b90)||this['_revisionTracker']['repository']['_revisions']['remove'](_0x454b90),this['_revisionTracker']['_createCurrentRevision'](_0x59f41e);}const {revisions:_0x268b83,requestId:_0x3e6a22}=await this['_revisionHistoryService']['reconnect'](_0x398ff2['connection'],this['_lastRequestId']);_0x4fad26&&_0x268b83['length']>0x0?_0x51de11['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x268b83),this['_handleRevisionsUpdate'](_0x268b83,_0x3e6a22),this['_revisionTracker']['sendBufferedUpdates']());};return _0x51de11['_isConnected']?_0x34ee80():new Promise((_0x5a003f,_0x345daf)=>{_0x51de11['once']('change:_isConnected',()=>{_0x34ee80()['then'](_0x5a003f)['catch'](_0x345daf);});});}destroy(){super['destroy']();}async _waitForServiceReady(){this['_revisionHistoryService']['isConnected']||await new Promise(_0xdba4e6=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x36cfd4=>{_0x36cfd4['off'](),_0xdba4e6();});});}_getLatestVersionFromServerOperations(){const _0x1d5007=this['editor']['plugins']['get'](tt)['serverHistory']['getOperations']()['reverse']();for(const _0x59e1b9 of _0x1d5007)if('marker'!==_0x59e1b9['type']||_0x59e1b9['affectsData'])return _0x59e1b9['baseVersion']+0x1;}_getLatestVersion(){const _0x10f3f9=this['editor']['plugins']['get'](tt);return new Promise(_0x210081=>{_0x10f3f9['_isPendingUpdate']?_0x10f3f9['once']('change:_isPendingUpdate',()=>{_0x210081(this['_getLatestVersionFromServerOperations']());}):_0x210081(this['_getLatestVersionFromServerOperations']());});}_handleRevisionsUpdate(_0x11873d,_0x4224cc){const _0x34c4a6=this['_revisionTracker']['repository'];this['_lastRequestId']=_0x4224cc;for(const _0x208f78 of _0x11873d){const _0x340c45=_0x34c4a6['getRevision'](_0x208f78['id']);if(_0x340c45){if((_0x208f78['fromVersion']||_0x208f78['toVersion'])&&(_0x208f78['diffData']=null),_0x340c45===this['_revisionTracker']['currentRevision']){const _0x1ea1d7=Math['max'](_0x340c45['toVersion'],_0x208f78['toVersion']),_0x5888af=Math['max'](_0x340c45['fromVersion'],_0x208f78['fromVersion']);let _0x128c1d;_0x340c45['toVersion']===_0x208f78['toVersion']&&_0x340c45['fromVersion']===_0x208f78['fromVersion']?(_0x128c1d=!0x0,this['_preventResendingRevisionData'](_0x208f78)):_0x208f78['toVersion']===_0x1ea1d7&&_0x208f78['fromVersion']===_0x5888af?_0x128c1d=!0x1:(_0x340c45['toVersion']===_0x1ea1d7&&_0x340c45['fromVersion']===_0x5888af||this['_fixRevision']({'revision':_0x340c45,'from':_0x5888af,'to':_0x1ea1d7}),_0x128c1d=!0x0),_0x128c1d&&(delete _0x208f78['fromVersion'],delete _0x208f78['toVersion'],delete _0x208f78['diffData'],delete _0x208f78['createdAt'],delete _0x208f78['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0x208f78),this['_preventResendingRevisionData'](_0x208f78);}else this['_revisionTracker']['addRevisionData'](_0x208f78);}const _0x597451=_0x34c4a6['getRevisions']();_0x597451['reverse']();for(let _0x173c43=0x0;_0x173c43<_0x597451['length']-0x1;_0x173c43++){const _0x1f7f77=_0x597451[_0x173c43],_0x3b700a=_0x597451[_0x173c43+0x1];if(_0x1f7f77['fromVersion']<_0x3b700a['toVersion']){const _0x424206=_0x3b700a['toVersion'],_0x37e395=Math['max'](_0x424206,_0x1f7f77['toVersion']);this['_fixRevision']({'revision':_0x1f7f77,'from':_0x424206,'to':_0x37e395});}}}['_fixRevision']({revision:_0x349311,from:_0x37f7fa,to:_0x420891}={}){const _0x53a950=this['editor']['plugins']['get'](_0x4a35a9),_0x313f62=this['_revisionTracker']['buildRevisionData']({'revision':_0x349311,'from':_0x37f7fa,'to':_0x420891});_0x313f62['authors']=_0x313f62['authorsIds']['map'](_0x1a68aa=>_0x53a950['getUser'](_0x1a68aa)),_0x349311['_update'](_0x313f62);}_preventResendingRevisionData(_0x219f49){const _0x4365b4={};_0x4365b4['id']=_0x219f49['id'];for(const _0x186b78 of Object['keys'](_0x219f49))'id'!==_0x186b78&&(_0x4365b4[_0x186b78]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0x4365b4['id'],_0x4365b4,!0x0);}async _fetchMissingUsers(_0x7d9651){const _0x4994a3=this['editor']['plugins']['get'](_0x4a35a9),{connection:_0x356884}=this['editor']['plugins']['get'](z),_0x2a5409=new Set();for(const _0x2b0193 of _0x7d9651){for(const _0x25f5b4 of _0x2b0193['authorsIds'])_0x140e3e(_0x25f5b4);_0x2b0193['creatorId']&&_0x140e3e(_0x2b0193['creatorId']);}if(0x0===_0x2a5409['size'])return;const _0x2039f1=await _0x52b3e1['getMany'](_0x356884,Array['from'](_0x2a5409));for(const _0xa9bee3 of _0x2039f1)_0x4994a3['getUser'](_0xa9bee3['id'])||_0x4994a3['addUser'](_0xa9bee3);function _0x140e3e(_0x3f9251){_0x4994a3['getUser'](_0x3f9251)||_0x2a5409['add'](_0x3f9251);}}};function pt(_0x5e75c5){return _0x5e75c5['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0x5e75c5['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x5e75c5['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}var gt=class extends _0x2fd2b9{static get requires(){return[_0x5811ff,mt,nt];}static get['pluginName'](){return'RealTimeCollaborativeRevisionHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},wt=class extends _0x49d4c1{_collapseAt;constructor(_0x4861bb,_0x5529b0=0x6){super(_0x4861bb);const _0x19e445=this['bindTemplate'];this['set']('isHidden',!0x0),this['set']('usersCount',0x0),this['_collapseAt']=_0x5529b0,this['bind']('isHidden')['to'](this,'usersCount',_0x1660d1=>_0x1660d1<_0x5529b0),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item',_0x19e445['if']('isHidden','ck-presence-list__counter--hidden')],'role':'listitem'},'children':[{'tag':'div','attributes':{'class':['ck','ck-presence-list__users-counter']},'children':[{'tag':'div','attributes':{'class':['ck','ck-presence-list__users-counter__text']},'children':[{'text':_0x19e445['to']('usersCount',_0x4659c6=>'+'+(_0x4659c6-this['_collapseAt']+0x2)['toString']())}]}]}]});}},vt=class extends _0x49d4c1{items;keystrokes;constructor(_0xc3e0b7){super(_0xc3e0b7);const _0x3cd97e=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0x243499(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0x3cd97e['if']('hasPopup'),'aria-expanded':_0x3cd97e['to']('isExpanded',_0x2a4cf4=>this['hasPopup']&&String(_0x2a4cf4)),'aria-label':_0x3cd97e['to']('hasPopup',_0x403f7a=>X(_0xc3e0b7,_0x403f7a?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0x3cd97e['to']('hasPopup',_0x50c260=>!!_0x50c260&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items'],'on':{'mouseenter':_0x3cd97e['to'](()=>this['fire']('presencelist:show')),'mouseleave':_0x3cd97e['to'](_0x2a044f=>{const _0x3c1b54=_0x2a044f,_0x529f6c=document['querySelector']('.ck-presence-list__dropdown-list'),_0x398e1c=document['querySelector']('.ck-balloon-panel_with-arrow');_0x529f6c?.['contains'](_0x3c1b54['relatedTarget'])||_0x398e1c?.['contains'](_0x3c1b54['relatedTarget'])||this['fire']('presencelist:hide');})}}),this['on']('change:hasPopup',(_0x84795d,_0x4bbd26,_0x4dd46e)=>{this['element']&&(_0x4dd46e?this['element']['setAttribute']('aria-expanded',String(this['isExpanded'])):this['element']['removeAttribute']('aria-expanded'));});}['focus'](){this['element']['focus']();}['render'](){super['render'](),this['keystrokes']['listenTo'](this['element']);}},_t=class extends _0x49d4c1{counterView;inlineListView;constructor(_0x5edc6e,_0x342385=0x6){super(_0x5edc6e);const _0xe94e92=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new wt(this['locale'],_0x342385),this['inlineListView']=new vt(_0x5edc6e),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x5d02d6 of this['inlineListView']['items'])_0x5d02d6['tooltipPosition']='s';this['inlineListView']['items']['first']&&(this['inlineListView']['items']['first']['tooltipPosition']='se');}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list','ck-reset','ck-rounded-corners',_0xe94e92['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['inlineListView']]});}},yt=class extends _0x49d4c1{listWrapperView;constructor(_0x42844e,_0x368da7){super(_0x42844e);const _0x6e688a=this['bindTemplate'];this['listWrapperView']=new bt(_0x42844e,_0x368da7),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':X(_0x42844e,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']],'on':{'mouseleave':_0x6e688a['to'](_0x447541=>{const _0x138546=_0x447541,_0x42c96e=document['querySelector']('.ck-presence-list__list'),_0x4118b6=document['querySelector']('.ck-balloon-panel_with-arrow');_0x42c96e?.['contains'](_0x138546['relatedTarget'])||_0x4118b6?.['contains'](_0x138546['relatedTarget'])||this['fire']('presencelist:hide');})}});}},bt=class extends _0x223b82{constructor(_0x33a087,_0x1d1533){super(_0x33a087);const _0x937161=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0x1d1533?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0x937161['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0x937161['to']('role'),'aria-label':_0x937161['to']('ariaLabel'),'aria-labelledby':_0x937161['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0x5d7bba['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0x2bbb3b=this['element'];_0x2bbb3b&&(this['_isScrollable']=Math['max'](_0x2bbb3b['scrollHeight'],_0x2bbb3b['clientHeight'])>0.8*window['innerHeight']);}},kt=class extends _0x35ef59{['userView'];constructor(_0x4c5546,_0xa840ef,_0x414c2c){super(_0x4c5546);const _0x172f2d=this['bindTemplate'];this['userView']=new _0x11aedb(_0x4c5546,_0xa840ef);const _0x323e4f={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0xa840ef['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0xa840ef['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0xa840ef['color']['getBackgroundColorClass']()],'style':{'--ck-user-color':_0xa840ef['color']['getColorVariable'](),'--ck-user-color-alpha':_0xa840ef['color']['getColorAlphaVariable']()},'aria-hidden':'true'}}]};_0x414c2c&&(_0x323e4f['tag']='button',_0x323e4f['on']={'click':_0x172f2d['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x323e4f);}['focus'](){this['element']['focus']();}},It=class extends _0x49d4c1{['userView'];['markerView'];constructor(_0x32083c,_0x27ac34,_0x116902){super(_0x32083c);const _0x1f39f6=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new _0x11aedb(_0x32083c,_0x27ac34),this['markerView']=new St(_0x32083c,_0x27ac34);const _0x594014=new _0x58d76d(_0x32083c);_0x594014['template']['tag']='span',_0x594014['text']=_0x27ac34['name'];const _0x117d00={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0x1f39f6['to']('isFocusable',_0x5961e0=>!!_0x5961e0&&0x0),'aria-labelledby':_0x594014['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0x1f39f6['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0x1f39f6['to']('hasTooltip',_0x5785fd=>!_0x5785fd),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0x594014]};_0x116902&&(_0x117d00['tag']='button',_0x117d00['on']={'click':_0x1f39f6['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x117d00);}},St=class extends _0x49d4c1{constructor(_0x3fd5b5,_0x4c8108){super(_0x3fd5b5),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x4c8108['color']['getBackgroundColorClass']()],'style':{'--ck-user-color':_0x4c8108['color']['getColorVariable'](),'--ck-user-color-alpha':_0x4c8108['color']['getColorAlphaVariable']()},'aria-hidden':'true'}});}};const Tt={'collapseAt':0x6,'displayMe':!0x0};var Ct=class extends _0xd1e979{currentDisplayedUsers;['balloonPanelView'];['view'];['presenceDropdownView'];_bodyCollection=null;static get['pluginName'](){return'PresenceListUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x36ffe9){super(_0x36ffe9),this['context']['config']['define']('presenceList',Tt);const _0x30a932=_0x36ffe9['config']['get']('presenceList.collapseAt');if('number'!=typeof _0x30a932)throw new _0xacbaf9('presencelist-collapseat-invalid-format',this);if(_0x30a932<0x1)throw new _0xacbaf9('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](Y)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0x4a18c2(),this['balloonPanelView']=new _0x2b1718(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get requires(){return[Y];}init(){for(const _0x13f20d of this['_allConnectedUsers'])this['_handleUserAdd'](_0x13f20d);this['listenTo'](this['_allConnectedUsers'],'add',(_0x487f4f,_0xa81a53)=>{this['_handleUserAdd'](_0xa81a53);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0x174b39,_0x3ecba2)=>{this['_handleUserRemove'](_0x3ecba2);});}_createView(){const _0x41ec62=this['context'],_0x13cda8=new _t(this['context']['locale'],this['context']['config']['get']('presenceList.collapseAt')),_0xf0a522=this['balloonPanelView'];if(!_0x25aa5f(_0x41ec62['config']['get']('presenceList.container')))throw new _0xacbaf9('presencelist-missing-container',this);return _0x13cda8['counterView']['bind']('usersCount')['to'](this),_0x13cda8['bind']('isCollapsed')['to'](this,'usersCount',_0x22e543=>{const {collapseAt:_0x5d7f65}=_0x41ec62['config']['get']('presenceList'),_0x4466c1=_0x22e543>=_0x5d7f65;if(_0x4466c1&&!_0x13cda8['inlineListView']['items']['find'](_0x1511f5=>_0x1511f5 instanceof wt)){const _0x342783=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['currentDisplayedUsers']['length']==_0x342783&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](this['currentDisplayedUsers']['length']-0x1),_0x13cda8['inlineListView']['items']['add'](_0x13cda8['counterView']);}return _0x4466c1||this['hideDropdown'](),_0x4466c1;}),_0x13cda8['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0x5b6b5a=>{const _0x32cfcd=_0x41ec62['config']['get']('presenceList'),_0x1ff663=new It(_0x41ec62['locale'],_0x5b6b5a,!!_0x32cfcd['onClick']);return _0x1ff663['bind']('hasTooltip')['to'](_0x13cda8,'isCollapsed',_0x495ad9=>!_0x495ad9),_0x1ff663['bind']('isFocusable')['to'](_0x13cda8,'isCollapsed',_0x4a948a=>!_0x4a948a),_0x32cfcd['onClick']&&this['listenTo'](_0x1ff663,'execute',()=>{this['view']['isCollapsed']||_0x32cfcd['onClick'](_0x5b6b5a,_0x1ff663['element']);}),_0x1ff663;}),this['listenTo'](_0x13cda8['inlineListView'],'presencelist:show',()=>{this['view']['isCollapsed']&&this['showDropdown']();}),this['listenTo'](_0x13cda8['inlineListView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();}),_0x13cda8['inlineListView']['keystrokes']['set']('Enter',(_0x9d1b5c,_0x4d61d4)=>{this['view']['isCollapsed']&&(this['showDropdown'](),_0x4d61d4());}),_0x13cda8['render'](),_0xf0a522['render'](),_0x2ca82e({'emitter':_0x13cda8,'activator':()=>_0xf0a522['isVisible'],'contextElements':[_0xf0a522['element'],_0x13cda8['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0x41ec62['config']['get']('presenceList.container')['appendChild'](_0x13cda8['element']),this['_bodyCollection']=new _0x1f77d5(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_bodyCollection']['add'](this['balloonPanelView']),_0x13cda8;}['_handleUserAdd'](_0x536d8b){if(!this['context']['config']['get']('presenceList.displayMe')&&_0x536d8b['isMe'])return;const _0x446132=this['context']['config']['get']('presenceList.collapseAt')-0x1;for(this['usersCount']++;this['currentDisplayedUsers']['length']>=_0x446132-(this['view']['isCollapsed']?0x1:0x0)&&this['currentDisplayedUsers']['length']>0x1;)this['currentDisplayedUsers']['remove'](0x1);const _0x59e8b4=_0x536d8b['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0x536d8b,_0x59e8b4);}['_handleUserRemove'](_0x11eb84){this['usersCount']--;const {collapseAt:_0x5cb96b}=this['context']['config']['get']('presenceList'),_0x28dd01=this['usersCount']>=_0x5cb96b;if(this['currentDisplayedUsers']['get'](_0x11eb84['id']))this['currentDisplayedUsers']['remove'](_0x11eb84['id']);else{if(_0x28dd01&&this['currentDisplayedUsers']['length']+0x1===_0x5cb96b-0x1)return;}if(this['currentDisplayedUsers']['length']+(_0x28dd01?0x1:0x0)<this['usersCount']){for(const _0x46298c of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0x46298c['id'])&&(this['currentDisplayedUsers']['add'](_0x46298c,Math['min'](this['currentDisplayedUsers']['length']-(_0x28dd01?0x1:0x0),0x1)),this['currentDisplayedUsers']['length']+(_0x28dd01?0x1:0x0)===_0x5cb96b-0x1))return;}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0x5b6c7d=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new yt(this['context']['locale'],!!_0x5b6c7d['onClick']),this['view']['inlineListView']['isExpanded']=!0x0,this['listenTo'](this['presenceDropdownView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();});const {listWrapperView:_0x4dc4d4}=this['presenceDropdownView'];_0x4dc4d4['items']['bindTo'](this['_allConnectedUsers'])['using'](_0xe057c4=>{if(!_0x5b6c7d['displayMe']&&_0xe057c4['isMe'])return null;const _0x17f963=new kt(this['context']['locale'],_0xe057c4,!!_0x5b6c7d['onClick']);return _0x5b6c7d['onClick']&&this['listenTo'](_0x17f963,'execute',()=>{_0x5b6c7d['onClick'](_0xe057c4,_0x17f963['element']);}),_0x17f963;}),this['balloonPanelView']['content']['add'](this['presenceDropdownView']),this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element']}),_0x4dc4d4['focus'](),_0x4dc4d4['checkIfScrollable']();const _0x49d8e3=(_0x5e5849,_0x3fbcf2)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0x3fbcf2();};_0x4dc4d4['keystrokes']['set']('Esc',_0x49d8e3),_0x4dc4d4['keystrokes']['set']('Shift+Tab',_0x49d8e3),_0x4dc4d4['keystrokes']['set']('Tab',(_0x318c2b,_0x4cc73e)=>{!function(_0x2edb2a){const _0xfcd84f=['a','button','input','select','textarea','[tabindex]','[contenteditable]']['map'](_0x240a8c=>_0x240a8c+':not([disabled]):not([tabindex=\x22-1\x22])')['join'](','),_0x1f0a64=[...document['body']['querySelectorAll'](_0xfcd84f)]['filter'](_0x13b693=>_0x13b693===document['activeElement']||_0x13b693['offsetWidth']+_0x13b693['offsetHeight']>0x0)['sort']((_0x50a7f1,_0x32ed93)=>(_0x50a7f1['tabIndex']||0x0)-(_0x32ed93['tabIndex']||0x0)),_0x395fd0=_0x1f0a64[(_0x1f0a64['indexOf'](_0x2edb2a)+0x1)%_0x1f0a64['length']];_0x395fd0&&_0x395fd0['focus']();}(this['view']['element']),this['hideDropdown'](),_0x4cc73e();}),_0x4dc4d4['focusTracker']['add'](this['view']['element']),_0x4dc4d4['focusTracker']['on']('change:isFocused',(_0x385d6f,_0xf17b54,_0x62eb8e)=>{_0x62eb8e||this['hideDropdown']();});}['hideDropdown'](){this['presenceDropdownView']&&(this['view']['inlineListView']['isExpanded']=!0x1,this['balloonPanelView']['unpin'](),this['balloonPanelView']['content']['remove'](this['presenceDropdownView']),this['presenceDropdownView']['destroy'](),this['presenceDropdownView']=void 0x0);}destroy(){super['destroy'](),this['view']&&this['view']['isRendered']&&this['view']['destroy'](),this['_bodyCollection']&&(this['_bodyCollection']['detachFromDom'](),this['_bodyCollection']['destroy'](),this['_bodyCollection']=null);}},At=class extends _0xd1e979{static get requires(){return[Y,Ct];}static get['pluginName'](){return'PresenceList';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}};export{ot as CloudServicesCommentsAdapter,mt as CloudServicesRevisionHistoryAdapter,ht as CloudServicesTrackChangesAdapter,At as PresenceList,Ct as PresenceListUI,tt as RealTimeCollaborationClient,ut as RealTimeCollaborativeComments,nt as RealTimeCollaborativeEditing,gt as RealTimeCollaborativeRevisionHistory,ft as RealTimeCollaborativeTrackChanges,Y as Sessions,z as WebSocketGateway};