@ckeditor/ckeditor5-real-time-collaboration 48.5.2 → 48.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/dist/index.js +6 -6
  2. package/dist/translations/af.umd.js +1 -1
  3. package/dist/translations/ar.umd.js +1 -1
  4. package/dist/translations/ast.umd.js +1 -1
  5. package/dist/translations/az.umd.js +1 -1
  6. package/dist/translations/be.umd.js +1 -1
  7. package/dist/translations/bg.umd.js +1 -1
  8. package/dist/translations/bn.umd.js +1 -1
  9. package/dist/translations/bs.umd.js +1 -1
  10. package/dist/translations/ca.umd.js +1 -1
  11. package/dist/translations/cs.umd.js +1 -1
  12. package/dist/translations/da.umd.js +1 -1
  13. package/dist/translations/de-ch.umd.js +1 -1
  14. package/dist/translations/de.umd.js +1 -1
  15. package/dist/translations/el.umd.js +1 -1
  16. package/dist/translations/en-au.umd.js +1 -1
  17. package/dist/translations/en-gb.umd.js +1 -1
  18. package/dist/translations/en.umd.js +1 -1
  19. package/dist/translations/eo.umd.js +1 -1
  20. package/dist/translations/es-co.umd.js +1 -1
  21. package/dist/translations/es.umd.js +1 -1
  22. package/dist/translations/et.umd.js +1 -1
  23. package/dist/translations/eu.umd.js +1 -1
  24. package/dist/translations/fa.umd.js +1 -1
  25. package/dist/translations/fi.umd.js +1 -1
  26. package/dist/translations/fr.umd.js +1 -1
  27. package/dist/translations/gl.umd.js +1 -1
  28. package/dist/translations/gu.umd.js +1 -1
  29. package/dist/translations/he.umd.js +1 -1
  30. package/dist/translations/hi.umd.js +1 -1
  31. package/dist/translations/hr.umd.js +1 -1
  32. package/dist/translations/hu.umd.js +1 -1
  33. package/dist/translations/hy.umd.js +1 -1
  34. package/dist/translations/id.umd.js +1 -1
  35. package/dist/translations/it.umd.js +1 -1
  36. package/dist/translations/ja.umd.js +1 -1
  37. package/dist/translations/jv.umd.js +1 -1
  38. package/dist/translations/kk.umd.js +1 -1
  39. package/dist/translations/km.umd.js +1 -1
  40. package/dist/translations/kn.umd.js +1 -1
  41. package/dist/translations/ko.umd.js +1 -1
  42. package/dist/translations/ku.umd.js +1 -1
  43. package/dist/translations/lt.umd.js +1 -1
  44. package/dist/translations/lv.umd.js +1 -1
  45. package/dist/translations/ms.umd.js +1 -1
  46. package/dist/translations/nb.umd.js +1 -1
  47. package/dist/translations/ne.umd.js +1 -1
  48. package/dist/translations/nl.umd.js +1 -1
  49. package/dist/translations/no.umd.js +1 -1
  50. package/dist/translations/oc.umd.js +1 -1
  51. package/dist/translations/pl.umd.js +1 -1
  52. package/dist/translations/pt-br.umd.js +1 -1
  53. package/dist/translations/pt.umd.js +1 -1
  54. package/dist/translations/ro.umd.js +1 -1
  55. package/dist/translations/ru.umd.js +1 -1
  56. package/dist/translations/si.umd.js +1 -1
  57. package/dist/translations/sk.umd.js +1 -1
  58. package/dist/translations/sl.umd.js +1 -1
  59. package/dist/translations/sq.umd.js +1 -1
  60. package/dist/translations/sr-latn.umd.js +1 -1
  61. package/dist/translations/sr.umd.js +1 -1
  62. package/dist/translations/sv.umd.js +1 -1
  63. package/dist/translations/th.umd.js +1 -1
  64. package/dist/translations/ti.umd.js +1 -1
  65. package/dist/translations/tk.umd.js +1 -1
  66. package/dist/translations/tr.umd.js +1 -1
  67. package/dist/translations/tt.umd.js +1 -1
  68. package/dist/translations/ug.umd.js +1 -1
  69. package/dist/translations/uk.umd.js +1 -1
  70. package/dist/translations/ur.umd.js +1 -1
  71. package/dist/translations/uz.umd.js +1 -1
  72. package/dist/translations/vi.umd.js +1 -1
  73. package/dist/translations/zh-cn.umd.js +1 -1
  74. package/dist/translations/zh.umd.js +1 -1
  75. package/package.json +12 -12
package/dist/index.js CHANGED
@@ -20,9 +20,9 @@
20
20
  *
21
21
  *
22
22
  */
23
- import{Context as _0x3ec41f,ContextPlugin as _0x41ec8a,PendingActions as _0x58253b,Plugin as _0x541bf0}from'@ckeditor/ckeditor5-core';import{CKEditorError as _0x1017f6,Collection as _0x436156,DomEmitterMixin as _0x19084b,KeystrokeHandler as _0x13efaf,global as _0x3a30e1,uid as _0x5596f7,version as _0x58523b}from'@ckeditor/ckeditor5-utils';import{BalloonPanelView as _0x1e027a,BodyCollection as _0x46f4ce,LabelView as _0x3344ca,ListItemView as _0x5d2e36,ListView as _0x4bba40,Notification as _0x488669,View as _0x5a12bf,clickOutsideHandler as _0x4b3948}from'@ckeditor/ckeditor5-ui';import{History as _0x3343ec,InsertOperation as _0x4f593d,MarkerOperation as _0x2d1415,ModelLiveRange as _0x50e818,NoOperation as _0x37ab6a,OperationFactory as _0x2dcce1,RootAttributeOperation as _0x1d5691,transformOperationSets as _0x2a7313}from'@ckeditor/ckeditor5-engine';import{CloudServices as _0x267fe9}from'@ckeditor/ckeditor5-cloud-services';import{CollaborativeEditingService as _0xa8576a,CommentsService as _0x128753,EditorService as _0xae3830,RevisionHistoryService as _0x3e2756,TrackChangesService as _0x5ebee1,User as _0x1c50bd,WEB_SOCKET_GATEWAY_STATES as _0x19faa9,WebSocketGateway as _0x237b33}from'@ckeditor/ckeditor-cloud-services-collaboration';import{UserView as _0x40ac71,Users as _0x580d16}from'@ckeditor/ckeditor5-collaboration-core';import{Compressor as _0x46e54b}from'@ckeditor/ckeditor5-operations-compressor';import{TrackChanges as _0x49978a,TrackChangesEditing as _0x3846ec}from'@ckeditor/ckeditor5-track-changes';import{Comments as _0x2c57cf,CommentsEditing as _0x3f474b,CommentsRepository as _0x24c16f}from'@ckeditor/ckeditor5-comments';import{RevisionHistory as _0xb062ae}from'@ckeditor/ckeditor5-revision-history';import{isElement as _0x3fb10f}from'es-toolkit/compat';var z=class WebSocketGateway extends _0x41ec8a{static WebSocketGateway=/* #__PURE__ -- @preserve */
24
- ((()=>_0x237b33)());static initialReconnectionInterval=0x3e8;connection;_reconnectionStack;_shouldPluginsReconnect;_domEmitter;static get requires(){return[_0x267fe9,_0x488669];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x17a9c4){super(_0x17a9c4),this['set']('state',_0x19faa9['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=new(_0x19084b())();}init(){const _0x472500=this['context'],_0x44be73=_0x472500['plugins']['get'](_0x267fe9),_0x37e190=_0x472500['plugins']['get'](_0x488669);if(!_0x44be73['token'])throw new _0x1017f6('websocketgateway-missing-token',this);if(!_0x44be73['webSocketUrl'])throw new _0x1017f6('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'](_0x44be73['token'],_0x44be73['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0x1ed67a=>{if(this['connection']=_0x1ed67a,this['bind']('state')['to'](_0x1ed67a,'state',this,'_isBrowserOffline',(_0x1c43c5,_0x1e6a19)=>('connected'!==_0x1c43c5&&(this['_shouldPluginsReconnect']=!0x0),_0x1e6a19||_0x1c43c5!==_0x19faa9['CONNECTED']?_0x19faa9['DISCONNECTED']:this['state']==_0x19faa9['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),_0x19faa9['CONNECTING']):_0x19faa9['CONNECTED'])),this['connection']['on']('error',(_0x5a4aaa,_0x55efb1)=>{if('limitExceeded'!==_0x55efb1['code'])throw console['error'](_0x55efb1),new _0x1017f6('cloudservices-init',null,{'originalError':_0x55efb1});_0x37e190['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'});}),!_0x1ed67a['me'])return new Promise(_0x2d4f03=>_0x1ed67a['on']('change:me',_0x2d4f03));})['catch'](_0x80f1c1=>{throw console['error'](_0x80f1c1),new _0x1017f6('cloudservices-init',null,{'originalError':_0x80f1c1});});}addToReconnectionStack(_0x5d1716){if('function'!=typeof _0x5d1716['reconnect'])throw new _0x1017f6('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0x5d1716))throw new _0x1017f6('websocketgateway-plugin-already-registered',this,{'name':_0x5d1716['constructor']['pluginName']});this['_reconnectionStack']['add'](_0x5d1716);}removeFromReconnectionStack(_0x25b9d9){this['_reconnectionStack']['delete'](_0x25b9d9);}isInReconnectionStack(_0x51872f){return this['_reconnectionStack']['has'](_0x51872f);}_reconnect(){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0x13161f=>_0x13161f['reconnect']())))['then'](()=>this['state']=_0x19faa9['CONNECTED'])['catch'](_0x496392=>{throw console['error'](_0x496392),new _0x1017f6('cloudservices-reconnection-error',this['context']);});}disconnect(){this['connection']&&this['connection']['disconnect'](),this['state']=_0x19faa9['DISCONNECTED'],this['_domEmitter']['stopListening']();}destroy(){this['disconnect'](),super['destroy']();}},Y=class extends _0x41ec8a{['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,_0x580d16];}constructor(_0x59c64a){super(_0x59c64a),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0x436156(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x580d16);}init(){const _0x2bc5c1=this['context']['plugins']['get'](z);this['listenTo'](_0x2bc5c1,'change:state',(_0xde6a62,_0x1b0234,_0x2891df)=>{if('connected'!==_0x2891df)this['channelSessions']['forEach'](_0x545a31=>_0x545a31['clear']()),this['channelConnectedUsers']['forEach'](_0x5b5ec0=>_0x5b5ec0['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x4a2aeb,_0x3fd934]of this['_registeredSessions'])for(const _0x3fd594 of _0x3fd934)this['_handleSessionAdd'](_0x4a2aeb,_0x3fd594);}}),this['_createUser'](_0x2bc5c1['connection']['me'],!0x0);}register(_0x45f218,_0x5c882b){if(this['_registeredSessions']['has'](_0x45f218))throw new _0x1017f6('sessions-register-already-registered',null,{'channelId':_0x45f218});this['_registeredSessions']['set'](_0x45f218,_0x5c882b),this['channelSessions']['set'](_0x45f218,new _0x436156()),this['channelConnectedUsers']['set'](_0x45f218,new _0x436156()),this['listenTo'](_0x5c882b,'add',(_0x420b17,_0x2745c9)=>this['_handleSessionAdd'](_0x45f218,_0x2745c9)),this['listenTo'](_0x5c882b,'remove',(_0x2dcd17,_0x510e51)=>this['_handleSessionRemove'](_0x45f218,_0x510e51));for(const _0x5e341d of _0x5c882b)this['_handleSessionAdd'](_0x45f218,_0x5e341d);}unregister(_0x5b06d2){if(!this['_registeredSessions']['has'](_0x5b06d2))throw new _0x1017f6('sessions-unregister-not-exist',null,{'channelId':_0x5b06d2});const _0xc16e8c=this['_registeredSessions']['get'](_0x5b06d2);this['stopListening'](_0xc16e8c);for(const _0x293b39 of _0xc16e8c)'connected'===this['context']['plugins']['get'](z)['state']&&this['_handleSessionRemove'](_0x5b06d2,_0x293b39);this['_registeredSessions']['delete'](_0x5b06d2),this['channelSessions']['delete'](_0x5b06d2),this['channelConnectedUsers']['delete'](_0x5b06d2);}get['mySessionId'](){return this['context']['plugins']['get'](z)['connection']['sessionId'];}getUserBySessionId(_0x3b017a){for(const _0x17086a of this['channelSessions']['values']())for(const _0x30ffff of _0x17086a)if(_0x30ffff['id']===_0x3b017a)return _0x30ffff['user'];}getUserSessions(_0x8df151,_0x59196b){const _0x565f55=_0x59196b?[this['channelSessions']['get'](_0x59196b)]:this['channelSessions']['values'](),_0x96c0cd=new Set();for(const _0x4244d7 of _0x565f55)for(const _0x3bb510 of _0x4244d7)_0x3bb510['user']['id']===_0x8df151['id']&&_0x96c0cd['add'](_0x3bb510['id']);return _0x96c0cd;}getUserRole(_0x4b2d06){for(const _0x3f3937 of this['channelSessions']['values']())for(const _0x1bd6da of _0x3f3937)if(_0x1bd6da['user']===_0x4b2d06)return _0x1bd6da['role'];}['_handleSessionAdd'](_0x52a8b0,_0x18afb4){if('connected'!==this['context']['plugins']['get'](z)['state'])return;const _0x43f6a2=_0x18afb4['user'],_0x22f35d=this['_users']['getUser'](_0x43f6a2['id'])||this['_createUser'](_0x43f6a2),_0x53ae33=Object['assign']({},_0x18afb4,{'user':_0x22f35d});if(this['channelSessions']['get'](_0x52a8b0)['add'](_0x53ae33),!_0x43f6a2['hiddenInPresenceList']){const _0x170457=this['channelConnectedUsers']['get'](_0x52a8b0);_0x170457['has'](_0x22f35d['id'])||_0x170457['add'](_0x22f35d),this['allConnectedUsers']['has'](_0x22f35d['id'])||_0x43f6a2['hiddenInPresenceList']||this['allConnectedUsers']['add'](_0x22f35d,_0x22f35d['isMe']?0x0:void 0x0);}this['fire']('sessionAdd:'+_0x52a8b0,{'channelId':_0x52a8b0,'session':_0x53ae33});}['_handleSessionRemove'](_0x175e2f,_0x8965ec){if('connected'!==this['context']['plugins']['get'](z)['state'])return;const _0x5192c7=this['channelConnectedUsers']['get'](_0x175e2f),_0x3bf0dd=_0x8965ec['user'];_0x3bf0dd['id']&&(this['channelSessions']['get'](_0x175e2f)['remove'](_0x8965ec['id']),_0x5192c7['has'](_0x3bf0dd['id'])&&!this['getUserSessions'](_0x3bf0dd,_0x175e2f)['size']&&_0x5192c7['remove'](_0x3bf0dd['id']),this['allConnectedUsers']['get'](_0x3bf0dd['id'])&&!this['getUserSessions'](_0x3bf0dd)['size']&&this['allConnectedUsers']['remove'](_0x3bf0dd['id']));}_createUser(_0x269081,_0x58e459){const _0x5c616b=this['_users']['addUser'](_0x269081);return _0x58e459&&this['_users']['defineMe'](_0x269081['id']),_0x5c616b['orderNumber']=this['_uniqueUsersCount']++,_0x5c616b;}},K=class extends _0x541bf0{_domEmitter=new(_0x19084b())();static get requires(){return[Y];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const _0x5c0b6a=this['editor'],_0x546314=_0x5c0b6a['plugins']['get'](Y);_0x5c0b6a['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x1669fa,{writer:_0xa292e})=>function(_0x2a50a6,_0x35266e,_0x54e310,_0x1cf63a){const _0xd17972=_0x2a50a6['markerName']['split'](':')[0x2],_0x344dc5=_0x54e310['getUserBySessionId'](_0xd17972);if(!_0x344dc5||_0xd17972===_0x54e310['mySessionId'])return;if(!_0x1cf63a['model']['schema']['checkChild'](_0x2a50a6['markerRange']['start'],'$text'))return;const _0x1c7d54={'class':'ck-user__marker\x20'+_0x344dc5['color']['getMarkerClass'](),'style':Q(_0x344dc5),'data-name':_0x344dc5['name'],'data-session-id':_0xd17972},_0x47c8ba=_0x1cf63a['model']['markers']['get'](_0x2a50a6['markerName'])['getStart'](),_0x529178=_0x47c8ba['nodeAfter'],_0x4cb04b=_0x1cf63a['model']['schema'];if(_0x529178&&_0x4cb04b['isObject'](_0x529178)&&_0x4cb04b['isInline'](_0x529178)&&!_0x1cf63a['model']['markers']['get']('user:range:'+_0xd17972)['getRange']()['isCollapsed'])return;const _0x3240dd=_0x47c8ba['parent'];return _0x1cf63a['model']['schema']['isLimit'](_0x3240dd)&&!_0x1cf63a['model']['hasContent'](_0x3240dd)&&(_0x1c7d54['contenteditable']=!0x1),function(_0x2fa202,_0x7e424b,_0x1ba8d6){const _0x4eb7e2=_0x2fa202['createUIElement']('span',_0x7e424b);return _0x2fa202['setCustomProperty']('userPositionMarker',!0x0,_0x4eb7e2),_0x4eb7e2['render']=function(_0x272c00){const _0x274faa=this['toDomElement'](_0x272c00),_0x32a02a=document['createElement']('span');return _0x32a02a['classList']['add']('ck-user__marker-tooltip'),_0x32a02a['setAttribute']('contenteditable','false'),_0x32a02a['setAttribute']('spellcheck','false'),_0x32a02a['textContent']=_0x1ba8d6['name'],_0x274faa['innerHTML']='⁠<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span>'+_0x32a02a['outerHTML']+'⁠',_0x274faa['addEventListener']('mouseenter',()=>{_0x274faa['classList']['add']('ck-user__marker_hovered');}),_0x274faa['addEventListener']('mouseleave',()=>{_0x274faa['classList']['remove']('ck-user__marker_hovered');}),_0x274faa;},_0x4eb7e2['isSimilar']=function(_0x4ae267){return!(!this['getCustomProperty']('userPositionMarker')||!_0x4ae267['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0x4ae267['getAttribute']('data-session-id'));},_0x4eb7e2;}(_0x35266e,_0x1c7d54,_0x344dc5);}(_0x1669fa,_0xa292e,_0x546314,_0x5c0b6a)}),_0x5c0b6a['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0x153ef9=>function(_0x1fd42e,_0x1b9d7b){const _0x42a1f1=_0x1fd42e['markerName']['split'](':')[0x2];if(_0x42a1f1===_0x1b9d7b['mySessionId'])return null;const _0x1ba287=_0x1b9d7b['getUserBySessionId'](_0x42a1f1);return _0x1ba287?{'id':_0x42a1f1,'classes':['ck-user__selection',_0x1ba287['color']['getSelectionClass']()],'attributes':{'style':Q(_0x1ba287),'data-session-id':_0x42a1f1},'priority':0x7d0+_0x1ba287['orderNumber']}:{'id':_0x42a1f1,'classes':[]};}(_0x153ef9,_0x546314)}),function(_0x477aca){const _0x5ad789=_0x477aca['model'],_0x32a650=new Map(),_0xefa6f8=_0x477aca['plugins']['get'](Y);_0x5ad789['markers']['on']('update:user:range',(_0x596961,_0x5525c1,_0x4909c8,_0x461f66)=>{if(!_0x461f66&&_0x32a650['get'](_0x5525c1['name']))return _0x32a650['get'](_0x5525c1['name'])['detach'](),void _0x32a650['delete'](_0x5525c1['name']);const _0x55d881=_0x5525c1['name']['split'](':')[0x2];if(_0x55d881===_0xefa6f8['mySessionId'])return;const _0x1795b1='user:position:'+_0x55d881;_0x5ad789['markers']['has'](_0x1795b1)&&_0x477aca['editing']['reconvertMarker'](_0x1795b1),_0x5525c1['on']('change:range',(_0x9806b8,_0x5295c0,_0x5b1a3c)=>{if('$graveyard'!=_0x5295c0['root']['rootName']&&'$graveyard'==_0x5525c1['getRange']()['root']['rootName']&&!_0x32a650['has'](_0x5525c1['name'])){const _0xfd19b2=_0x5ad789['schema']['getNearestSelectionRange'](_0x5b1a3c['deletionPosition']);if(_0xfd19b2){const _0x1699be=_0x50e818['fromRange'](_0xfd19b2);_0x32a650['set'](_0x5525c1['name'],_0x1699be),_0x1699be['on']('change:range',(_0xcfa795,_0x2789d4,_0x4933ec)=>{if('$graveyard'==_0x1699be['root']['rootName']){const _0x157d57=_0x5ad789['schema']['getNearestSelectionRange'](_0x4933ec['deletionPosition']);_0x157d57?(_0x1699be['start']=_0x157d57['start'],_0x1699be['end']=_0x157d57['end']):(_0x32a650['delete'](_0x5525c1['name']),_0x1699be['detach']());}});}}});}),_0x5ad789['document']['on']('change',()=>{_0x32a650['size']>0x0&&_0x5ad789['enqueueChange']({'isUndoable':!0x1},_0x3ad8ec=>{for(const [_0x3a9d70,_0x489c08]of _0x32a650)'$graveyard'==_0x5ad789['markers']['get'](_0x3a9d70)['getRange']()['root']['rootName']&&(J(_0x3a9d70['split'](':')[0x2],_0x489c08['toRange'](),_0x5ad789,_0x3ad8ec),_0x489c08['detach']());_0x32a650['clear']();});});}(_0x5c0b6a),this['_domEmitter']['listenTo'](_0x3a30e1['document'],'keydown',(_0x2006ca,{key:_0xfe9de8})=>{'Escape'===_0xfe9de8&&function(_0x3c5f56){_0x3c5f56['editing']['view']['change'](_0x456565=>{for(const _0x1042f0 of _0x3c5f56['model']['markers']){if(!_0x1042f0['name']['startsWith']('user:position'))continue;const _0x27ebaf=_0x3c5f56['editing']['mapper']['markerNameToElements'](_0x1042f0['name']);if(_0x27ebaf){for(const _0x176a43 of _0x27ebaf)_0x456565['removeClass']('ck-user__marker_hovered',_0x176a43);}}});}(_0x5c0b6a);},{'useCapture':!0x0});}afterInit(){const _0x25503d=this['editor'],_0x10d7fd=_0x25503d['commands']['get']('undo');_0x10d7fd&&_0x25503d['model']['on']('applyOperation',(_0x4d77e1,_0x578448)=>{const _0x2f60be=_0x578448[0x0];if(!_0x2f60be['isDocumentOperation'])return;if('marker'!=_0x2f60be['type']||!_0x2f60be['name']['startsWith']('user:'))return;const _0x3cdf72=_0x2f60be['batch'];_0x10d7fd['_createdBatches']['has'](_0x3cdf72)&&(_0x2f60be['newRange']=_0x2f60be['oldRange']?_0x25503d['model']['createRange'](_0x2f60be['oldRange']['start'],_0x2f60be['oldRange']['end']):null);},{'priority':'highest'});}destroy(){return this['_domEmitter']['stopListening'](),super['destroy']();}createUserMarkerOperations(){const _0x5d9ab5=this['editor'],_0x5af988=_0x5d9ab5['model']['document'],_0x20e9cd=_0x5d9ab5['plugins']['get'](Y);_0x5d9ab5['model']['enqueueChange']({'isUndoable':!0x1},_0x38001b=>{const _0x25b4ec='user:range:'+_0x20e9cd['mySessionId'],_0x73b119='user:position:'+_0x20e9cd['mySessionId'],_0x4ae212=_0x5d9ab5['model']['markers']['has'](_0x25b4ec);_0x5d9ab5['editing']['view']['hasDomSelection']?J(_0x20e9cd['mySessionId'],_0x5af988['selection']['getFirstRange'](),_0x5d9ab5['model'],_0x38001b):_0x4ae212&&(_0x38001b['removeMarker'](_0x25b4ec),_0x38001b['removeMarker'](_0x73b119));});}};function J(_0x2c97f9,_0x138bd0,_0x5c507f,_0x2eced3){const _0x452043='user:range:'+_0x2c97f9,_0x41c6ef='user:position:'+_0x2c97f9,_0x2e8a7c=_0x138bd0['getContainedElement']();let _0x124709=_0x138bd0['start'];if(_0x2e8a7c&&_0x2e8a7c['is']('element','tableCell')){const _0x5f172c=function(_0x13216d,_0x4066a0){for(const _0x2d52a1 of _0x13216d['getPositions']())if(_0x4066a0['schema']['checkChild'](_0x2d52a1,'$text'))return _0x2d52a1;}(_0x138bd0,_0x5c507f);_0x5f172c&&(_0x124709=_0x5f172c,_0x138bd0=_0x2eced3['createRange'](_0x124709));}const _0x5ac9ab=_0x2eced3['createRange'](_0x124709);_0x5c507f['markers']['has'](_0x452043)?(_0x2eced3['updateMarker'](_0x452043,{'range':_0x138bd0}),_0x2eced3['updateMarker'](_0x41c6ef,{'range':_0x5ac9ab})):(_0x2eced3['addMarker'](_0x452043,{'range':_0x138bd0,'usingOperation':!0x0}),_0x2eced3['addMarker'](_0x41c6ef,{'range':_0x5ac9ab,'usingOperation':!0x0}));}function Q(_0x309c4c){return'--ck-user-color:'+_0x309c4c['color']['getColorVariable']()+';--ck-user-color-alpha:'+_0x309c4c['color']['getColorAlphaVariable']()+';';}function X(_0x37ed22,_0x195b25,_0x143142){const _0xb91258=_0x37ed22['t'],t=_0x37ed22['t'];switch(_0x195b25){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 _0xb91258({'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'},_0x143142);default:return'';}}let Z=0x1;var tt=class RealTimeCollaborationClient extends _0x541bf0{static CollaborativeEditingService=/* #__PURE__ -- @preserve */
25
- ((()=>_0xa8576a)());_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,_0x58253b,_0x580d16,_0x488669];}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 _0x122bed=this['serverHistory']['getOperations']();for(let _0x102e85=_0x122bed['length']-0x1;_0x102e85>=0x0;_0x102e85--){const _0x5ab849=_0x122bed[_0x102e85];if(!this['_disconnectionOperations']['has'](_0x5ab849))return _0x5ab849['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0x16df19){if(super(_0x16df19),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x3343ec(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0x1017f6('collaboration-missing-channelid',this);const _0x5b856b=_0x16df19['config']['get']('cloudServices.bundleVersion')||_0x58523b;this['_service']=new RealTimeCollaborationClient['CollaborativeEditingService'](_0x5b856b,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0x46e54b(),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 _0x25bb85=this['editor'],_0x450bbc=_0x25bb85['plugins']['get'](_0x580d16),_0x5e8d31=_0x25bb85['plugins']['get'](z);this['listenTo'](_0x450bbc,'getOperationAuthor',(_0x157c26,_0x3c4592)=>{const _0x57b631=_0x3c4592[0x0];_0x57b631['_authorId']&&(_0x157c26['return']=_0x450bbc['getUser'](_0x57b631['_authorId']),_0x157c26['stop']()),null===_0x57b631['_authorId']&&(_0x157c26['return']=null,_0x157c26['stop']());},{'priority':'high'}),this['listenTo'](_0x25bb85['model']['document']['selection'],'change:range',(_0x12de58,_0x37be32)=>{_0x37be32['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x25bb85['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x25bb85['model']['on']('applyOperation',(_0x5b7729,_0x3e22d2)=>{const _0x3f72f6=_0x3e22d2[0x0];_0x3f72f6['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0x3f72f6),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['set']('_isChannelFlushed',!0x1),this['bind']('_isEditingAllowed')['to'](_0x5e8d31,'state',this,'_hasSynchronizationProblem',this,'_isChannelFlushed',(_0x504fca,_0x1d34ac,_0x5903f7)=>'connected'===_0x504fca&&!_0x1d34ac&&!_0x5903f7),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x25bb85['disableReadOnlyMode']('rtc-offline'):_0x25bb85['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x25bb85['disableReadOnlyMode']('rtc-offline'):_0x25bb85['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async reconnect(){const _0x3a55c9=this['editor']['plugins']['get'](Y),_0x2a183c=this['editor']['plugins']['get'](z);try{this['_isPendingUpdate']=!0x0,_0x3a55c9['unregister'](this['_channelId']);const _0x27a7ed=await this['_service']['reconnect'](_0x2a183c['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0x27a7ed)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x298111=await this['_service']['getConnectedSessions']();_0x3a55c9['register'](this['_channelId'],_0x298111),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0xb3710){if(function(_0x2af193){return'404'===_0x2af193['code'];}(_0xb3710)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0xc8ddf5){return'409'===_0xc8ddf5['code'];}(_0xb3710)){const _0x575449=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'](_0x575449);}else{if(!(_0xb3710 instanceof et))throw _0xb3710;this['_handleReconnectionError']();}}}}destroy(){const _0x3d5803=this['editor']['plugins']['get'](z),_0x467d11=this['editor']['plugins']['get'](Y);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x467d11['channelSessions']['has'](this['_channelId'])&&_0x467d11['unregister'](this['_channelId']),_0x3d5803['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async _handleReconnectionResponse(_0x478be8){if(this['sessionId']!==_0x478be8['sessionId']&&this['_lastSyncedOperationId']!==_0x478be8['lastOperationId'])throw new et();return this['sessionId']=_0x478be8['sessionId'],this['_handleServerResponse']([],{..._0x478be8,'wereChangesApplied':!0x1,'data':_0x478be8['data']},'reconnect');}async _connectService(_0x31f397,_0x2dd6c8=!0x1){const {connection:_0xb437e6}=this['editor']['plugins']['get'](z);RealTimeCollaborationClient['CollaborativeEditingService']['getConnectedSessions'](_0xb437e6,this['_channelId'])['then'](_0x296bcf=>this['_initSessionsHandling'](_0x296bcf))['catch'](_0x28f4e8=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x28f4e8);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x11fc5,_0x612ae9)=>{this['_crash']('realtimecollaborationclient-init-service-internal-error',_0x612ae9);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_handleChannelDisconnected']();});const _0x141f04=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x31f397);this['_isPendingUpdate']=!0x0;const _0x1f0086=await this['_service']['connect'](_0xb437e6,this['_compressOperations'](_0x31f397),_0x141f04);if(this['sessionId']=_0x1f0086['sessionId'],_0x2dd6c8){if(!_0x1f0086['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x1f0086['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0x31f397,_0x1f0086,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x1f0086,_0x31f397);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}_handleSendingSelectionMarkers(){const _0x3f1812=this['editor']['plugins']['get'](Y),_0x518b23=this['editor']['plugins']['get'](K),_0x21c4ee=_0x3f1812['channelSessions']['get'](this['_channelId']);_0x21c4ee&&_0x21c4ee['length']>0x1?_0x518b23['createUserMarkerOperations']():this['listenTo'](_0x3f1812,'sessionAdd:'+this['_channelId'],()=>{0x2===_0x3f1812['channelSessions']['get'](this['_channelId'])['length']&&_0x518b23['createUserMarkerOperations']();});}async _handleReceivedOperations(_0x2442ca,_0x386022,_0x580bf6,_0x505561){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x386022){const _0x4c1dd2=this['_decompressOperations'](_0x580bf6,_0x505561);await this['_fetchMissingUsers'](_0x4c1dd2),this['_handleExternalOperations'](_0x4c1dd2,_0x386022,_0x580bf6['lastOperationId'])||this['_crash']('realtimecollaborationclient-init-service-incorrect-server-operation');}}async _connectAfterSessionHasBeenFlushed(){this['_disconnectService']();const {locale:_0x4a0995}=this['editor'];let _0x468db0;try{_0x468db0=await this['_service']['getDocumentDetails']();}catch{const _0x4a43e5=X(_0x4a0995,'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'](_0x4a43e5);}const _0x3b7358=_0x468db0['currentDocumentSession']||_0x468db0['lastDocumentSession'];if(this['_lastSyncedOperationId']!==_0x3b7358['lastOperationId']){const _0x5e347b=X(_0x4a0995,'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'](_0x5e347b);}await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);}_handleChannelDisconnected(){const _0x1ee0f4=this['editor']['plugins']['get'](z);if(this['_isConnected']=!0x1,!_0x1ee0f4['connection']||'connected'!==_0x1ee0f4['connection']['state'])return;this['_isChannelFlushed']=!0x0;const _0x5eaa75=this['editor']['plugins']['get'](Y);_0x5eaa75['channelSessions']['has'](this['_channelId'])&&_0x5eaa75['unregister'](this['_channelId']),_0x1ee0f4['removeFromReconnectionStack'](this),this['_disconnectService']();}_disconnectService(){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['stopListening'](this['_service']);}_initSessionsHandling(_0x1cca6c){const _0x52f510=this['editor']['plugins']['get'](Y);this['listenTo'](_0x52f510,'sessionAdd:'+this['_channelId'],(_0x30a890,{session:_0x35af85})=>{if(_0x35af85['id']===_0x52f510['mySessionId']){_0x30a890['off']();const _0x11f41c=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0x4e7729=_0x35af85['permissions'];_0x11f41c&&_0x11f41c['isEnabled']&&(_0x4e7729=_0x4e7729['filter'](_0x48dd20=>'document:write'!==_0x48dd20)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0x4e7729,this['_channelId']);}}),_0x52f510['register'](this['_channelId'],_0x1cca6c);}_initThrowingOnDataSet(){const _0x21974e=this['editor']['data']['set'];this['editor']['data']['set']=(..._0x3bc1bc)=>{if(!_0x3bc1bc[_0x3bc1bc['length']-0x1]['suppressErrorInCollaboration'])throw new _0x1017f6('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x21974e['apply'](this['editor']['data'],_0x3bc1bc);};}_setUpDataInit(){this['editor']['data']['on']('init',(_0x2dc4df,[_0x3b8d90])=>{if(this['_document']['version'])throw new _0x1017f6('realtimecollaborationclient-init-document-already-initialized',this);_0x2dc4df['stop'](),this['_setPendingAction']();const _0x43fc48=Object['fromEntries'](Object['entries'](this['editor']['config']['get']('roots')||{})['filter'](([,_0x1ab8ce])=>!_0x1ab8ce['lazyLoad'])['map'](([_0x222768,_0x1057c9])=>[_0x222768,_0x1057c9['modelAttributes']||{}])),_0x43c436=this['_getOperationsFromInitData'](_0x3b8d90,_0x43fc48);0x0==_0x43c436['length']&&_0x43c436['push'](new _0x37ab6a(0x0)),_0x2dc4df['return']=this['_connectService'](_0x43c436)['then'](()=>{this['editor']['plugins']['get'](z)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x5df7d1=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x5df7d1))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x6f9dcc,[_0x19d6bd,_0xe56eb4])=>{_0x6f9dcc['stop']();const _0x2cac96=this['editor']['model']['document']['getRoot'](_0x19d6bd);if(!this['_knownRootNames']['has'](_0x19d6bd)){const _0x36f2e4=_0xe56eb4&&_0xe56eb4['data']?_0xe56eb4['data']:'',_0x1835d9=_0xe56eb4&&_0xe56eb4['attributes']?_0xe56eb4['attributes']:{};await this['_loadRoot'](_0x19d6bd,_0x36f2e4,_0x1835d9);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0x2cac96['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0x2cac96);});},{'priority':'high'});}async _fetchMissingUsers(_0x26aa42){const _0xcd975c=this['editor']['plugins']['get'](_0x580d16),{connection:_0x294100}=this['editor']['plugins']['get'](z),_0x625073=new Set();for(const _0x1f1302 of _0x26aa42){const _0x4c5e20=_0x1f1302['_authorId'];_0x4c5e20&&!_0xcd975c['getUser'](_0x4c5e20)&&_0x625073['add'](_0x4c5e20);}if(0x0===_0x625073['size'])return;const _0x2e5a9a=await _0x1c50bd['getMany'](_0x294100,Array['from'](_0x625073));for(const _0x2fc014 of _0x2e5a9a)_0xcd975c['getUser'](_0x2fc014['id'])||_0xcd975c['addUser'](_0x2fc014);}_getOperationsFromInitData(_0x40ac79,_0x5c174f={}){const _0x3466bb=this['editor']['model'],_0xe4f9a8=[];let _0x12a84f=0x0;const _0x282752='string'==typeof _0x40ac79?{'main':_0x40ac79}:_0x40ac79;for(const _0x18db4e of Object['keys'](_0x282752)){if(!this['_document']['roots']['has'](_0x18db4e))throw new _0x1017f6('realtimecollaborationclient-init-non-existent-root',this);const _0x21423a=this['_document']['getRoot'](_0x18db4e),_0x2d81a3=this['editor']['data']['parse'](_0x282752[_0x18db4e],_0x21423a),_0x331982=new _0x4f593d(_0x3466bb['createPositionAt'](_0x21423a,0x0),_0x2d81a3,_0x12a84f++);_0xe4f9a8['push'](_0x331982);for(const [_0x29c83e,_0x217341]of _0x2d81a3['markers']){const _0x4e3e4e=_0x3466bb['createRange'](_0x3466bb['createPositionFromPath'](_0x21423a,_0x217341['start']['path']['slice']()),_0x3466bb['createPositionFromPath'](_0x21423a,_0x217341['end']['path']['slice']())),_0x488fea=new _0x2d1415(_0x29c83e,null,_0x4e3e4e,_0x3466bb['markers'],!0x0,_0x12a84f++);_0xe4f9a8['push'](_0x488fea);}}if(_0x5c174f)for(const [_0x1f6a95,_0xb1f8f8]of Object['entries'](_0x5c174f)){const _0x18290a=_0x3466bb['document']['getRoot'](_0x1f6a95);if(!_0x18290a)throw new _0x1017f6('multi-root-editor-root-attributes-no-root',null);for(const [_0x1e14bc,_0x159f84]of Object['entries'](_0xb1f8f8))if(null!==_0x159f84){const _0x3c5417=new _0x1d5691(_0x18290a,_0x1e14bc,null,_0x159f84,_0x12a84f++);_0xe4f9a8['push'](_0x3c5417);}}return _0xe4f9a8;}async _loadRoot(_0x3d53f5,_0x106b2f,_0x1eb8a9){this['_getOperationsFromInitData']({[_0x3d53f5]:_0x106b2f},{[_0x3d53f5]:_0x1eb8a9})['forEach']((_0x5ba727,_0x143a61)=>{_0x5ba727['baseVersion']=this['_document']['version']+_0x143a61,_0x5ba727['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x5ba727);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async _handleInitialConnectionData(_0x4f625a,_0x23e3d1){let _0x566306;this['_offset']=_0x4f625a['offset'];const _0x420d30=_0x4f625a['wereChangesApplied']&&!_0x4f625a['initData'],_0x41a6f0=_0x420d30?0x0:_0x4f625a['data']['baseVersion'];if(_0x23e3d1['forEach'](_0x403798=>{_0x403798['_isInit']=!0x0,_0x403798['createdAt']=_0x4f625a['sessionCreatedAt'],_0x403798['_authorId']=null;}),_0x420d30)_0x566306=_0x23e3d1,this['_applyOperationsSet'](_0x566306,_0x420d30);else{if(_0x4f625a['initData']){const _0x30ba60=this['_getOperationsFromInitData'](_0x4f625a['initData']);this['_document']['history']['version']=-_0x30ba60['length'],_0x30ba60['forEach'](_0x31bb9c=>{_0x31bb9c['baseVersion']-=_0x30ba60['length'],_0x31bb9c['createdAt']=_0x4f625a['sessionCreatedAt'],_0x31bb9c['_isInit']=!0x0,_0x31bb9c['_authorId']=null;}),this['_applyOperationsSet'](_0x30ba60,!0x0),this['serverHistory']['version']=-_0x30ba60['length']+this['_offset'],this['_updateServerHistory'](_0x30ba60);}this['_document']['history']['version']=_0x41a6f0,_0x566306=this['_decompressOperations'](_0x4f625a['data'],_0x4f625a['metadata']),await this['_fetchMissingUsers'](_0x566306),this['_applyOperationsSet'](_0x566306,_0x420d30);}_0x4f625a['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x566306,_0x4f625a['lastOperationId']),this['_lastSyncedOperationId']=_0x4f625a['lastOperationId']),this['serverHistory']['version']=_0x41a6f0+this['_offset'],this['_updateServerHistory'](_0x566306),_0x23e3d1['filter'](_0x47da06=>{const _0x2ee780=this['_getAffectedRoot'](_0x47da06);return _0x2ee780&&!this['_knownRootNames']['has'](_0x2ee780);})['forEach']((_0x5663a1,_0x5d58ee)=>{_0x5663a1['baseVersion']=this['_document']['version']+_0x5d58ee,this['_saveOperationInBuffer'](_0x5663a1);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x59ead7,_0x1a6aec){const _0x159eb1=_0x1a6aec&&_0x1a6aec['message'];if(_0x159eb1&&_0x159eb1['startsWith']('realtimecollaborationclient'))throw _0x1a6aec;const _0x57e632=this['editor']['plugins']['get'](z);throw this['_isPendingUpdate']=!0x0,_0x57e632['disconnect'](),this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0x1017f6(_0x59ead7,this['editor'],_0x159eb1?{'originalError':_0x159eb1}:void 0x0);}_saveOperationInBuffer(_0x5d0d43){this['_knownOperations']['has'](_0x5d0d43)||(this['_knownOperations']['add'](_0x5d0d43),this['_bufferedOperations']['push'](_0x5d0d43),this['_pendingAction']||'marker'==_0x5d0d43['type']&&!_0x5d0d43['affectsData']||this['_setPendingAction']());}_sendBufferedOperationsDelayed(_0x1e3d06=!0x1){!_0x1e3d06&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0x262f7f=>{_0x262f7f&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0x11ea6b=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0x45a189){return _0x45a189['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x45a189['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0x45a189['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0x11ea6b)||this['_crash'](_0x11ea6b['message'],_0x11ea6b);});},this['_currentBufferDelay']));}_waitUntilSynced(){return new Promise(_0x441b3d=>{this['on']('change:_isPendingUpdate',()=>{_0x441b3d();});});}async _sendBufferedOperations(){const _0x238dc4=this['editor']['plugins']['get'](K);if(this['_shouldSendSelectionUpdate']()&&(_0x238dc4['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x4cec36=[...this['_bufferedOperations']];for(const _0x287bb3 of _0x4cec36)_0x287bb3['wasUndone']=this['_document']['history']['isUndoneOperation'](_0x287bb3);const _0x13a5fd=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x4cec36),_0x5289d2=Z++,_0x39fd3b=this['_compressOperations'](_0x4cec36),_0x4dadff=await this['_service']['sendOperations'](_0x39fd3b,_0x39fd3b['baseVersion'],_0x13a5fd);try{return await this['_handleServerResponse'](_0x4cec36,_0x4dadff,_0x5289d2);}catch(_0x2ed73f){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0x2ed73f);}}async['_handleServerResponse'](_0xe07329,_0x2aa9b3,_0x34e744){if('error'in _0x2aa9b3)throw _0x2aa9b3['error'];let _0x1e407f;if(_0x2aa9b3['wereChangesApplied']){_0x2aa9b3['lastOperationId']&&(this['_lastSyncedOperationId']=_0x2aa9b3['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0xb14f81=>!_0xe07329['includes'](_0xb14f81));for(const _0x272d12 of _0xe07329)_0x272d12['createdAt']='lastOperationAcceptedAt'in _0x2aa9b3&&_0x2aa9b3['lastOperationAcceptedAt']||void 0x0;st(_0xe07329,_0x2aa9b3['version']-_0xe07329['length']),this['_updateServerHistory'](_0xe07329);const _0x4076d5=_0xe07329['filter'](_0x460734=>{if(!_0x460734['_isInit'])return!0x1;const _0xcbebb0=this['_getAffectedRoot'](_0x460734);return _0xcbebb0&&!this['_knownRootNames']['has'](_0xcbebb0);});st(_0x4076d5,this['_document']['version']),this['_applyOperationsSet'](_0x4076d5),_0x1e407f=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0x5fd6fd=this['_decompressOperations'](_0x2aa9b3['data'],_0x2aa9b3['metadata'])['filter'](_0x133835=>_0x133835['baseVersion']>=this['_lastServerVersion']);_0x5fd6fd['forEach'](_0x5891bf=>this['_addKnownRoot'](_0x5891bf)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x30717a=>!_0x30717a['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x30717a))),this['_bufferedOperations']['length']&&st(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0x5fd6fd),_0x1e407f=this['_handleExternalOperations'](_0x5fd6fd,_0x2aa9b3['version'],_0x2aa9b3['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x1e407f?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}_handleExternalOperations(_0x3f2c0a,_0x19e5ad,_0x5c69e7){try{const _0x30fdb4={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x50aa2c,operationsB:_0x3dada3,originalOperations:_0x30bb96}=_0x2a7313(_0x3f2c0a,this['_bufferedOperations'],_0x30fdb4);st(_0x50aa2c,this['_document']['version']),st(_0x3dada3,_0x19e5ad);for(const _0x53aaab of _0x50aa2c){const _0x58f2fb=_0x30bb96['get'](_0x53aaab);_0x58f2fb?(_0x53aaab['_authorId']=_0x58f2fb['_authorId'],'noop'!==_0x53aaab['type']&&(_0x53aaab['_aiSource']=_0x58f2fb['_aiSource'])):_0x53aaab['_authorId']=null;}for(const _0x230eb5 of _0x3dada3)'noop'!==_0x230eb5['type']&&(_0x230eb5['_aiSource']=_0x30bb96['get'](_0x230eb5)?.['_aiSource']);_0x5c69e7&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x3f2c0a,_0x5c69e7),this['_lastSyncedOperationId']=_0x5c69e7),this['_bufferedOperations']=[..._0x3dada3],this['_applyOperationsSet'](_0x50aa2c),this['_updateServerHistory'](_0x3f2c0a);}catch(_0x2cad8a){return console['error'](_0x2cad8a),!0x1;}return!0x0;}_applyOperationsSet(_0x1633db,_0x5cd89d=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0x25e05a=>{for(const _0x336eba of _0x1633db)this['_knownOperations']['add'](_0x336eba),this['_addKnownRoot'](_0x336eba),_0x25e05a['batch']['addOperation'](_0x336eba),this['editor']['model']['applyOperation'](_0x336eba);});}_addKnownRoot(_0x49be6b){const _0x517043=this['_getAffectedRoot'](_0x49be6b);_0x517043&&this['_knownRootNames']['add'](_0x517043);}_getAffectedRoot(_0x5236f3){let _0x3cd37b,_0x140911;switch(_0x5236f3['type']){case'insert':_0x3cd37b=_0x5236f3['position']['root'];break;case'marker':if(_0x140911=_0x5236f3['newRange'],!_0x140911)return null;_0x3cd37b=_0x140911['root'];break;case'addRootAttribute':_0x3cd37b=_0x5236f3['root'];break;case'addRoot':_0x3cd37b=_0x5236f3['affectedSelectable'];break;case'move':_0x3cd37b=_0x5236f3['targetPosition']['root'];break;default:return null;}return _0x3cd37b['rootName'];}_updateServerHistory(_0x5ea8b6){_0x5ea8b6['forEach'](_0x32370e=>{const _0x51cf76=_0x32370e['clone']();_0x51cf76['_authorId']=_0x32370e['_authorId'],_0x51cf76['_isInit']=!!_0x32370e['_isInit'],_0x51cf76['_aiSource']=_0x32370e['_aiSource'],_0x51cf76['createdAt']=_0x32370e['createdAt'],_0x51cf76['baseVersion']+=this['_offset'],_0x32370e['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x51cf76),this['serverHistory']['addOperation'](_0x51cf76);});}_handleReconnectionError(_0x38177f){const _0x45003e=this['editor']['plugins']['get']('Notification'),_0x209db8=this['editor']['locale'];_0x38177f||(_0x38177f=X(_0x209db8,'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.')),_0x45003e['showWarning'](_0x38177f,{'title':X(_0x209db8,'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'](_0x58253b)['add'](X(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}_clearPendingAction(){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x58253b)['remove'](this['_pendingAction']),this['_pendingAction']=null);}_compressOperations(_0xf9ea2f){const _0x426e23=_0xf9ea2f['map'](_0xe40256=>_0xe40256['toJSON']());return this['_compressor']['compress'](_0x426e23);}_decompressOperations(_0x1163a9,_0x50cac7){return this['_compressor']['decompress'](_0x1163a9)['map']((_0x84ef71,_0x34b2fb)=>{const _0x57c885='init'==_0x50cac7[_0x34b2fb]['type'];if('InsertOperation'==_0x84ef71['__className']){const _0x5e9451=_0x84ef71['position']['root'];!this['_document']['getRoot'](_0x5e9451)&&(this['_document']['createRoot']('$unknown',_0x5e9451)['_isAttached']=!0x1);}else{if('RootOperation'==_0x84ef71['__className']){const _0xcc7b80=this['_document']['getRoot'](_0x84ef71['rootName']);_0xcc7b80&&'$unknown'==_0xcc7b80['name']&&_0x84ef71['elementName']!=_0xcc7b80['name']&&(_0xcc7b80['name']=_0x84ef71['elementName']);}}const _0x48e821=_0x2dcce1['fromJSON'](_0x84ef71,this['_document']);return _0x48e821['wasUndone']=_0x84ef71['wasUndone'],_0x48e821['_isInit']=_0x57c885,_0x48e821['_authorId']=_0x57c885?null:_0x50cac7[_0x34b2fb]['userId'],_0x48e821['_isDisconnection']='cs:removeUser'===_0x50cac7[_0x34b2fb]['type'],_0x48e821['_aiSource']=_0x84ef71['_aiSource']||void 0x0,_0x48e821['createdAt']=_0x50cac7[_0x34b2fb]['createdAt'],_0x48e821;});}_refreshUserSelectionMarkers(){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}_shouldSendSelectionUpdate(){const _0x33440d=this['editor']['plugins']['get'](Y)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0x33440d&&_0x33440d['length']>0x1&&this['_hasSelectionChanged'];}_shouldSendUpdate(){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}},et=class extends Error{};function st(_0x1f64a8,_0x451007){for(const _0x470ab9 of _0x1f64a8)_0x470ab9['baseVersion']=_0x451007++;}var it=class{_ignoredOperations;_operationToId;constructor(_0x33868b){this['_ignoredOperations']=_0x33868b,this['_operationToId']=new WeakMap();}getIdOfTheLastOperation(_0x3b9b54){let _0x223f46=_0x3b9b54['length'];for(;_0x223f46--;){const _0x1fcfff=_0x3b9b54[_0x223f46];if(!this['_ignoredOperations']['has'](_0x1fcfff)){if(!this['_operationToId']['has'](_0x1fcfff)){const _0x2ea4e9=_0x5596f7()['slice'](0x1,0x12);this['_operationToId']['set'](_0x1fcfff,_0x2ea4e9);}return this['_operationToId']['get'](_0x1fcfff);}}}setIdForTheLastOperation(_0x5eae5d,_0x37aa73){if(!_0x37aa73)return;let _0x10c3af=_0x5eae5d['length'];for(;_0x10c3af--;){const _0x1d8e9d=_0x5eae5d[_0x10c3af];this['_ignoredOperations']['has'](_0x1d8e9d)||this['_operationToId']['set'](_0x1d8e9d,_0x37aa73);}}},nt=class extends _0x541bf0{static get requires(){return[tt];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},ot=class CloudServicesCommentsAdapter extends _0x41ec8a{static CommentsService=/* #__PURE__ -- @preserve */
26
- ((()=>_0x128753)());['_services'];static get requires(){return[z,_0x24c16f,Y,_0x580d16];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x5d63e8){super(_0x5d63e8),this['_services']=new Map();}async init(){const _0x4b8a02=this['context'],_0x565f45=_0x4b8a02['plugins']['get'](_0x24c16f);if(_0x4b8a02['plugins']['get'](z)['addToReconnectionStack'](this),_0x565f45['adapter']={'addCommentThread':async({channelId:_0x167980,threadId:_0x21ad25,comments:_0x1dd7d2,resolvedAt:_0x2273d2,resolvedBy:_0x143cf0,context:_0x5ad081,attributes:_0x1c8802})=>{const _0xf24505=await this['_getService'](_0x167980)['addCommentThread']({'commentThreadId':_0x21ad25,'comments':_0x1dd7d2['map'](_0x29b64f=>function(_0x4a3827,_0x528e46,_0x4c14d0){return{'commentThreadId':_0x4c14d0,'commentId':_0x4a3827['commentId'],'userId':_0x4a3827['authorId'],'content':_0x4a3827['content'],'documentId':_0x528e46,'createdAt':_0x4a3827['createdAt'],'attributes':_0x4a3827['attributes']||{}};}(_0x29b64f,_0x167980,_0x21ad25)),'resolvedAt':_0x2273d2,'resolvedBy':_0x143cf0,'context':_0x5ad081,'attributes':_0x1c8802})['catch'](ct);return{'threadId':_0xf24505['commentThreadId'],'comments':_0xf24505['comments']};},'getCommentThread':async({channelId:_0x183d2c,threadId:_0x30b9f9})=>{const _0xaaac6b=await this['_getService'](_0x183d2c)['getCommentThread'](_0x30b9f9)['catch'](rt)['catch'](ct);return _0xaaac6b?_0xaaac6b['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0xaaac6b]),{'threadId':_0xaaac6b['commentThreadId'],'comments':_0xaaac6b['comments']['map'](at),'context':_0xaaac6b['context'],'resolvedAt':_0xaaac6b['resolvedAt'],'resolvedBy':_0xaaac6b['resolvedBy'],'attributes':_0xaaac6b['attributes']||{}}):null;},'updateCommentThread':async({channelId:_0x1691c4,threadId:_0x59b515,context:_0x3cb7d1,unlinkedAt:_0x59a45b,attributes:_0x452567})=>this['_getService'](_0x1691c4)['updateCommentThread']({'commentThreadId':_0x59b515,'context':_0x3cb7d1,'attributes':_0x452567,'unlinkedAt':_0x59a45b})['catch'](rt)['catch'](ct),'resolveCommentThread':async({channelId:_0xa90c78,threadId:_0x70303})=>{const _0x43c490=await this['_getService'](_0xa90c78)['resolveCommentThread'](_0x70303)['catch'](rt)['catch'](ct);return{'threadId':_0x43c490['commentThreadId'],'resolvedAt':_0x43c490['resolvedAt'],'resolvedBy':_0x43c490['resolvedBy']};},'reopenCommentThread':async({channelId:_0x48c3e5,threadId:_0x1cbad9})=>this['_getService'](_0x48c3e5)['reopenCommentThread'](_0x1cbad9)['catch'](rt)['catch'](ct),'removeCommentThread':({channelId:_0x19dd56,threadId:_0x360050})=>this['_getService'](_0x19dd56)['removeCommentThread'](_0x360050)['catch'](rt)['catch'](ct),'addComment':({channelId:_0x38b2ee,threadId:_0x5a82c5,commentId:_0x1148a5,content:_0x295091,attributes:_0x62e717})=>this['_getService'](_0x38b2ee)['addComment'](_0x5a82c5,_0x1148a5,_0x295091,_0x62e717)['catch'](ct),'updateComment':({channelId:_0x336235,threadId:_0x286a26,commentId:_0x54cc1b,content:_0x3aa51a,attributes:_0xa3cde5})=>this['_getService'](_0x336235)['updateComment'](_0x286a26,_0x54cc1b,_0x3aa51a,_0xa3cde5)['catch'](rt)['catch'](ct),'removeComment':({channelId:_0x250c70,threadId:_0xcad3e4,commentId:_0x431ac9})=>this['_getService'](_0x250c70)['removeComment'](_0xcad3e4,_0x431ac9)['catch'](rt)['catch'](ct)},_0x4b8a02 instanceof _0x3ec41f){const _0x2b9d42=_0x4b8a02['config']['get']('collaboration.channelId'),_0x20b2fb=_0x4b8a02['plugins']['get'](Y);await this['_setUpService'](_0x2b9d42);const _0x309843=await this['_services']['get'](_0x2b9d42)['getConnectedSessions']();this['listenTo'](_0x20b2fb,'sessionAdd:'+_0x2b9d42,(_0x15f39a,{session:_0x539588})=>{_0x539588['id']===_0x20b2fb['mySessionId']&&(_0x15f39a['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x539588['permissions'],_0x2b9d42));}),_0x20b2fb['register'](_0x2b9d42,_0x309843);}}async _setUpService(_0x450e72){if(this['_services']['has'](_0x450e72))throw new _0x1017f6('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0x450e72});const _0x13d4a3=this['context']['plugins']['get'](_0x24c16f),_0x23a55d=new CloudServicesCommentsAdapter['CommentsService'](_0x450e72);this['_services']['set'](_0x450e72,_0x23a55d),this['listenTo'](_0x23a55d,'commentThreadAdded',(_0x4f26a4,_0x44a4e2)=>{const {commentThreadId:_0x2e051d,documentId:_0x235cb5,context:_0x7e89cc,attributes:_0x562673,resolvedAt:_0x2a9229,resolvedBy:_0x1baf7f,comments:_0x385bbd}=_0x44a4e2;_0x13d4a3['getCommentThread'](_0x2e051d)||_0x13d4a3['addCommentThread']({'threadId':_0x2e051d,'channelId':_0x235cb5,'comments':_0x385bbd?_0x385bbd['map'](at):[],'context':_0x7e89cc,'attributes':_0x562673,'resolvedAt':_0x2a9229,'resolvedBy':_0x1baf7f,'isFromAdapter':!0x0});}),this['listenTo'](_0x23a55d,'commentThreadUpdated',(_0x15a4d0,{commentThreadId:_0x4a6b66,documentId:_0x12b461,context:_0x58b91d,unlinkedAt:_0x1fa629,attributes:_0x3b45de})=>{_0x13d4a3['getCommentThread'](_0x4a6b66)&&_0x13d4a3['updateCommentThread']({'threadId':_0x4a6b66,'channelId':_0x12b461,'context':_0x58b91d,'unlinkedAt':_0x1fa629,'attributes':_0x3b45de,'isFromAdapter':!0x0});}),this['listenTo'](_0x23a55d,'commentThreadResolved',(_0x3c6584,{commentThreadId:_0x63a356,resolvedBy:_0x5e617b,resolvedAt:_0x187f61})=>{const _0x4cad15=_0x13d4a3['getCommentThread'](_0x63a356);_0x4cad15&&_0x4cad15['resolve']({'resolvedBy':_0x5e617b,'resolvedAt':_0x187f61,'isFromAdapter':!0x0});}),this['listenTo'](_0x23a55d,'commentThreadReopened',(_0x52d809,{commentThreadId:_0x1d9c50})=>{const _0x188cf0=_0x13d4a3['getCommentThread'](_0x1d9c50);_0x188cf0&&_0x188cf0['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0x23a55d,'commentThreadRemoved',(_0x4b39a3,{commentThreadId:_0x432aa3})=>{const _0xe1b8c7=_0x13d4a3['getCommentThread'](_0x432aa3);_0xe1b8c7&&_0xe1b8c7['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0x23a55d,'commentAdded',(_0x4852a9,_0x1f1150)=>{const _0x52aaf9=_0x1f1150['commentThreadId'],_0x1de9c4=_0x13d4a3['getCommentThread'](_0x52aaf9);_0x1de9c4&&_0x1de9c4['addComment']({...at(_0x1f1150),'isFromAdapter':!0x0});}),this['listenTo'](_0x23a55d,'commentUpdated',(_0x2155a8,{commentThreadId:_0xabc72,commentId:_0x46ff61,content:_0x2b0c46,attributes:_0x36196e})=>{const _0x2b84b2=_0x13d4a3['getCommentThread'](_0xabc72);if(_0x2b84b2){const _0x483733=_0x2b84b2['getComment'](_0x46ff61);_0x483733&&_0x483733['update']({'content':_0x2b0c46,'attributes':_0x36196e,'isFromAdapter':!0x0});}}),this['listenTo'](_0x23a55d,'commentRemoved',(_0x342851,{commentThreadId:_0x50b0a7,commentId:_0x27651f})=>{const _0x5ed7e2=_0x13d4a3['getCommentThread'](_0x50b0a7);if(_0x5ed7e2){const _0x4ec0ec=_0x5ed7e2['getComment'](_0x27651f);_0x4ec0ec&&_0x4ec0ec['remove']({'isFromAdapter':!0x0});}}),this['listenTo'](_0x23a55d,'disconnected',()=>{'connected'===this['context']['plugins']['get'](z)['connection']?.['state']&&(this['_services']['delete'](_0x450e72),this['stopListening'](_0x23a55d));}),await this['_connectService'](_0x450e72);}destroy(){if(this['context']instanceof _0x3ec41f){const _0x18df38=this['context']['config']['get']('collaboration.channelId');this['_services']['has'](_0x18df38)&&this['_terminateService'](_0x18df38);}}_terminateService(_0x29c207){if(!this['_services']['has'](_0x29c207))throw new _0x1017f6('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0x29c207});this['_getService'](_0x29c207)['disconnect'](),this['_services']['delete'](_0x29c207);}async reconnect(){for(const _0x585b02 of this['_services']['keys']())await this['_connectService'](_0x585b02);if(this['context']instanceof _0x3ec41f){const _0x91940c=this['context']['config']['get']('collaboration.channelId');if(this['_services']['has'](_0x91940c)){const _0x117cd8=this['context']['plugins']['get'](Y);_0x117cd8['unregister'](_0x91940c);const _0x52f8bc=await this['_services']['get'](_0x91940c)['getConnectedSessions']();_0x117cd8['register'](_0x91940c,_0x52f8bc);}}}async _connectService(_0x5396fa){const {connection:_0x37db24}=this['context']['plugins']['get'](z),_0x4eee64=this['context']['plugins']['get'](_0x24c16f),_0x447885=await this['_services']['get'](_0x5396fa)['connect'](_0x37db24);await this['_fetchMissingUsersForThreads'](_0x447885);const _0x477dfc=new Set(Array['from'](_0x4eee64['getCommentThreads']({'channelId':_0x5396fa}),_0x36e275=>_0x36e275['id']));for(const _0x4a07a2 of _0x447885)_0x4a07a2['deletedAt']||_0x477dfc['delete'](_0x4a07a2['commentThreadId']);for(const _0x4ffe99 of _0x477dfc)_0x4eee64['getCommentThread'](_0x4ffe99)['remove']({'isFromAdapter':!0x0});for(const _0x4dc360 of _0x447885){let _0x4f9c62=_0x4eee64['getCommentThread'](_0x4dc360['commentThreadId']);const {commentThreadId:_0x1cb6ff,context:_0x30c5f0,attributes:_0x2abe30,resolvedBy:_0x59226a,resolvedAt:_0x45ac2b,unlinkedAt:_0x36eaf0,deletedAt:_0x1b5d7f}=_0x4dc360;if(_0x1b5d7f)continue;_0x4f9c62||(_0x4f9c62=_0x4eee64['addCommentThread']({'channelId':_0x5396fa,'threadId':_0x1cb6ff,'context':_0x30c5f0,'attributes':_0x2abe30||{},'resolvedBy':_0x59226a,'resolvedAt':_0x45ac2b,'unlinkedAt':_0x36eaf0,'isFromAdapter':!0x0}));const _0x281105=new Set(Array['from'](_0x4f9c62['comments'],_0xb22836=>_0xb22836['id']));for(const _0x560a90 of _0x4dc360['comments'])_0x281105['delete'](_0x560a90['commentId']);for(const _0xd93d6d of _0x281105)_0x4f9c62['getComment'](_0xd93d6d)['remove']({'isFromAdapter':!0x0});for(const _0x478698 of _0x4dc360['comments']){const _0x1f8831=_0x4f9c62['getComment'](_0x478698['commentId']);_0x1f8831?_0x1f8831['content']!==_0x478698['content']&&_0x1f8831['update']({'content':_0x478698['content'],'isFromAdapter':!0x0}):_0x4f9c62['addComment'](Object['assign'](at(_0x478698),{'isFromAdapter':!0x0}));}}}_getService(_0x20748c){if(!this['_services']['has'](_0x20748c))throw new _0x1017f6('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0x20748c});return this['_services']['get'](_0x20748c);}async _fetchMissingUsersForThreads(_0x46c980){const _0x44f2fc=this['context']['plugins']['get'](_0x580d16),{connection:_0x214c7d}=this['context']['plugins']['get'](z),_0x122597=new Set();for(const {resolvedBy:_0x2ed5bd,comments:_0x206578}of _0x46c980){_0x2ed5bd&&!_0x44f2fc['getUser'](_0x2ed5bd)&&_0x122597['add'](_0x2ed5bd);for(const {userId:_0x48f52e}of _0x206578)_0x44f2fc['getUser'](_0x48f52e)||_0x122597['add'](_0x48f52e);}if(0x0===_0x122597['size'])return;const _0x579c09=await _0x1c50bd['getMany'](_0x214c7d,Array['from'](_0x122597));for(const _0x5a042a of _0x579c09)_0x44f2fc['getUser'](_0x5a042a['id'])||_0x44f2fc['addUser'](_0x5a042a);}};async function rt(_0x555c19){if('404'!==_0x555c19['code'])throw _0x555c19;}function ct(_0x12f23d){if((_0xe29b3f=_0x12f23d)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0xe29b3f['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0xe29b3f['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0xe29b3f;throw _0x12f23d;}function at(_0x93538b){return{'threadId':_0x93538b['commentThreadId'],'commentId':_0x93538b['commentId'],'content':_0x93538b['content'],'createdAt':_0x93538b['createdAt'],'authorId':_0x93538b['userId'],'attributes':_0x93538b['attributes']||{}};}var ht=class CloudServicesTrackChangesAdapter extends _0x541bf0{static ['TrackChangesService']=/* #__PURE__ -- @preserve */
27
- ((()=>_0x5ebee1)());_bufferedRequests;_trackChangesService;static get requires(){return[ot,_0x3846ec,z];}static get['pluginName'](){return'CloudServicesTrackChangesAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x58df8b){super(_0x58df8b);const _0x2fba51=this['editor']['config']['get']('collaboration.channelId');this['_bufferedRequests']=new Map(),this['_trackChangesService']=new CloudServicesTrackChangesAdapter['TrackChangesService'](_0x2fba51);}init(){const _0xc71a09=this['editor']['plugins']['get'](z),_0x2a4c25=this['editor']['plugins']['get'](_0x3846ec);return _0x2a4c25['adapter']={'getSuggestion':async _0x4d0527=>{await this['_waitForServiceReady']();const _0x56716a=await this['_trackChangesService']['get'](_0x4d0527)['catch'](lt);return await this['_fetchMissingUsersForThreads']([_0x56716a]),_0x56716a;},'addSuggestion':async({id:_0x30c3f8,type:_0x45a9cc,data:_0x49f39c,originalSuggestionId:_0x25e430,attributes:_0x4191ad})=>{await this['_waitForServiceReady']();const _0x296d92={'id':_0x30c3f8,'type':_0x45a9cc,'data':_0x49f39c,'originalSuggestionId':_0x25e430,'attributes':_0x4191ad},_0xafaf0d=await this['_trackChangesService']['add'](_0x30c3f8,_0x45a9cc,_0x49f39c,_0x25e430,_0x4191ad)['catch'](_0xbba9a1=>{if(dt(_0xbba9a1))return new Promise(_0x4f87b4=>{this['_bufferedRequests']['set'](_0x30c3f8,{'resolve':_0x4f87b4,'suggestionData':_0x296d92});});throw _0xbba9a1;});return this['_bufferedRequests']['delete'](_0x30c3f8),_0xafaf0d;},'updateSuggestion':async(_0x1d5376,_0x15c785)=>{if(await this['_waitForServiceReady'](),'open'!==_0x15c785['state'])return this['_trackChangesService']['update'](_0x1d5376,_0x15c785)['catch'](lt);}},this['listenTo'](this['_trackChangesService'],'suggestionUpdated',(_0x1a07eb,_0x41ff49)=>{_0x2a4c25['hasSuggestion'](_0x41ff49['id'])&&(_0x2a4c25['getSuggestion'](_0x41ff49['id'])['attributes']=_0x41ff49['attributes']);}),this['listenTo'](this['_trackChangesService'],'disconnected',()=>{'connected'===_0xc71a09['connection']?.['state']&&(_0xc71a09['removeFromReconnectionStack'](this),this['stopListening'](this['_trackChangesService']));}),this['_trackChangesService']['connect'](_0xc71a09['connection'])['then'](_0x3a2c7b=>(_0xc71a09['addToReconnectionStack'](this),this['_fetchMissingUsersForThreads'](_0x3a2c7b)['then'](()=>{for(const _0x221942 of _0x3a2c7b){_0x2a4c25['addSuggestionData'](_0x221942)['_saved']=!0x0;}})));}async reconnect(){const _0x169cef=this['editor']['plugins']['get']('TrackChangesEditing'),{connection:_0x1cd311}=this['editor']['plugins']['get'](z),_0xea8f68=await this['_trackChangesService']['connect'](_0x1cd311);await this['_fetchMissingUsersForThreads'](_0xea8f68);for(const {suggestionData:_0x65c122,resolve:_0x5da5df}of this['_bufferedRequests']['values']()){let _0x14a12d=_0xea8f68['find'](_0x107cc9=>_0x107cc9['id']===_0x65c122['id']);_0x14a12d||(_0x14a12d=await this['_trackChangesService']['add'](_0x65c122['id'],_0x65c122['type'],_0x65c122['data'],_0x65c122['originalSuggestionId'])),_0x5da5df(_0x14a12d);}for(const _0x56c327 of _0xea8f68)_0x169cef['hasSuggestion'](_0x56c327['id'])||_0x169cef['addSuggestionData'](_0x56c327);}async _waitForServiceReady(){this['_trackChangesService']['isConnected']||await new Promise(_0x14b48d=>{this['listenTo'](this['_trackChangesService'],'connected',_0x188e23=>{_0x188e23['off'](),_0x14b48d();});});}async _fetchMissingUsersForThreads(_0x4dd66c){const _0x4c4629=this['editor']['plugins']['get'](_0x580d16),{connection:_0x144ac2}=this['editor']['plugins']['get'](z),_0x56eed9=new Set();for(const {authorId:_0x54d457}of _0x4dd66c)_0x4c4629['getUser'](_0x54d457)||_0x56eed9['add'](_0x54d457);if(0x0===_0x56eed9['size'])return;const _0x49fc93=await _0x1c50bd['getMany'](_0x144ac2,Array['from'](_0x56eed9));for(const _0x1a89ed of _0x49fc93)_0x4c4629['getUser'](_0x1a89ed['id'])||_0x4c4629['addUser'](_0x1a89ed);}};function lt(_0x554c1d){if(dt(_0x554c1d))return new Promise(()=>{});throw _0x554c1d;}function dt(_0xb9b7eb){return _0xb9b7eb['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0xb9b7eb['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}var ut=class extends _0x541bf0{static get requires(){return[_0x2c57cf,ot,nt,z];}static get['pluginName'](){return'RealTimeCollaborativeComments';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const _0x3f29ba=this['editor']['plugins']['get'](z),_0x20e82d=this['editor']['plugins']['get'](_0x3f474b),_0x10742c=this['editor']['plugins']['get'](ot);return this['editor']['data']['once']('ready',()=>{this['listenTo'](_0x3f29ba,'change:state',(_0x235c63,_0x14cacd,_0x23a7ef)=>{_0x20e82d['isThreadsLoadingPaused']='connected'!==_0x23a7ef;});}),this['listenTo'](_0x3f29ba,'change:state',(_0x16d7e2,_0x3efec9,_0x45893c)=>{this['editor']['plugins']['get'](_0x24c16f)['switchReadOnly']('connected'!==_0x45893c);}),_0x10742c['_setUpService'](this['editor']['config']['get']('collaboration.channelId'));}destroy(){const _0x5b92c5=this['editor']['plugins']['get'](ot),_0x5568ff=this['editor']['config']['get']('collaboration.channelId');_0x5b92c5['_services']['has'](_0x5568ff)&&_0x5b92c5['_terminateService'](_0x5568ff),super['destroy']();}},ft=class extends _0x541bf0{static get requires(){return[ut,ht,_0x49978a];}static get['pluginName'](){return'RealTimeCollaborativeTrackChanges';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},mt=class CloudServicesRevisionHistoryAdapter extends _0x541bf0{static RevisionHistoryService=/* #__PURE__ -- @preserve */
28
- ((()=>_0x3e2756)());_lastRequestId;['_revisionTracker'];_revisionHistoryService;_oldOffset;static get requires(){return[z,tt,_0xb062ae,Y,_0x580d16];}static get['pluginName'](){return'CloudServicesRevisionHistoryAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x315259){super(_0x315259);const _0xe00d10=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new CloudServicesRevisionHistoryAdapter['RevisionHistoryService'](_0xe00d10);}async init(){const _0x4e5b00=this['editor']['plugins']['get'](tt),_0x590512=_0x4e5b00['serverHistory'],_0x1471bd=this['editor']['plugins']['get'](z);this['_revisionTracker']['setSource']({'history':_0x590512,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0x4e5b00['sessionId']});const _0x423538=this['editor']['config']['get']('cloudServices.bundleVersion')||_0x58523b,_0x2185bc=await _0xae3830['isBundleUploaded'](_0x1471bd['connection'],_0x423538);this['editor']['plugins']['get'](_0xb062ae)['adapter']={'getRevision':async({revisionId:_0x4b646c})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0x4b646c)),'updateRevisions':async _0x1ba243=>{await this['_waitForServiceReady']();const _0x3fe5d7=this['_revisionTracker']['currentRevision'];if(_0x2185bc&&0x1===_0x1ba243['length']&&_0x1ba243[0x0]['id']===_0x3fe5d7['id'])return _0x1ba243;for(const _0x4612d7 of _0x1ba243)_0x4612d7['id']===_0x3fe5d7['id']&&(_0x4612d7['isEmptyCurrent']=_0x4612d7['fromVersion']===_0x4612d7['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0x1ba243,this['_lastRequestId'])['then'](_0x30396e=>(this['_lastRequestId']=_0x30396e,_0x1ba243))['catch'](_0x5c8598=>{if(pt(_0x5c8598)||'400'===_0x5c8598['code']&&void 0x0!==_0x5c8598['data']['wrongRequestId']){for(const _0x1e3f76 of _0x1ba243)this['_revisionTracker']['repository']['getRevision'](_0x1e3f76['id'])&&this['_revisionTracker']['_bufferUpdate'](_0x1e3f76['id'],_0x1e3f76,!0x1);if(pt(_0x5c8598)&&'destroyed'!==this['editor']['state'])throw _0x5c8598;return _0x1ba243;}throw _0x5c8598;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0xebca9d,{revisionsData:_0x4c8457,requestId:_0xe06318})=>{Math['max'](..._0x4c8457['map'](_0x2136f0=>_0x2136f0['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0x4c8457,_0xe06318);}):this['_handleRevisionsUpdate'](_0x4c8457,_0xe06318);}),this['set']('_isServiceConnected',!0x1),this['listenTo'](this['_revisionHistoryService'],'connected',()=>{this['_isServiceConnected']=!0x0;}),this['listenTo'](this['_revisionHistoryService'],'disconnected',()=>{this['_isServiceConnected']=!0x1,'connected'===_0x1471bd['connection']?.['state']&&(_0x1471bd['removeFromReconnectionStack'](this),this['stopListening'](this['_revisionHistoryService']));});const {revisions:_0x1fc83b,requestId:_0x18ff80}=await this['_revisionHistoryService']['connect'](_0x1471bd['connection']);_0x1471bd['addToReconnectionStack'](this),this['_lastRequestId']=_0x18ff80,await this['_fetchMissingUsers'](_0x1fc83b);for(const _0x463d88 of _0x1fc83b)this['_revisionTracker']['addRevisionData'](_0x463d88);this['listenTo'](_0x4e5b00,'change:_isConnected',(_0x4a1acf,_0x1bc779,_0x50b664)=>{_0x50b664&&(this['_oldOffset']=_0x4e5b00['_offset'],_0x4a1acf['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](this,'_isServiceConnected');}async reconnect(){const _0x54e6a7=this['editor']['plugins']['get'](z),_0x3cea47=this['editor']['plugins']['get'](tt),_0x38022c=async()=>{const _0x11d6c6=this['_revisionTracker']['currentRevision'],_0x424b73=_0x11d6c6['id'],_0x4d84f2=_0x424b73!==_0x3cea47['sessionId'];if(_0x4d84f2){const _0x2b8781=_0x3cea47['_offset']-this['_oldOffset'],_0x430823=this['_getLatestVersionFromServerOperations']();if(this['_revisionTracker']['_revisionDataBuilder']['reInit'](),_0x11d6c6['toVersion']+_0x2b8781!==_0x430823){const _0x471feb=_0x11d6c6['fromVersion']+_0x2b8781,_0x1bd297=this['editor']['plugins']['get'](_0x580d16),_0xe2cf04=this['_revisionTracker']['buildRevisionData']({'revision':_0x11d6c6,'from':_0x471feb,'to':_0x430823});_0xe2cf04['id']=_0x11d6c6['id'];const _0x5a6ca7=_0xe2cf04['authorsIds']['map'](_0x24ce82=>_0x1bd297['getUser'](_0x24ce82));_0x11d6c6['_update']({..._0xe2cf04,'authors':_0x5a6ca7},!0x0),this['_revisionTracker']['_bufferUpdate'](_0x11d6c6['id'],_0xe2cf04,!0x0);}this['_revisionTracker']['_startingVersion']=_0x430823,_0x11d6c6['toVersion']!==_0x11d6c6['fromVersion']||this['_revisionTracker']['_bufferedUpdates']['has'](_0x424b73)||this['_revisionTracker']['repository']['_revisions']['remove'](_0x424b73),this['_revisionTracker']['_createCurrentRevision'](_0x430823);}const {revisions:_0x39cb28,requestId:_0x3e574b}=await this['_revisionHistoryService']['reconnect'](_0x54e6a7['connection'],this['_lastRequestId']);_0x4d84f2&&_0x39cb28['length']>0x0?_0x3cea47['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x39cb28),this['_handleRevisionsUpdate'](_0x39cb28,_0x3e574b),this['_revisionTracker']['sendBufferedUpdates']());};return _0x3cea47['_isConnected']?_0x38022c():new Promise((_0x419987,_0x7c98cd)=>{_0x3cea47['once']('change:_isConnected',()=>{_0x38022c()['then'](_0x419987)['catch'](_0x7c98cd);});});}destroy(){super['destroy']();}async _waitForServiceReady(){this['_revisionHistoryService']['isConnected']||await new Promise(_0xed434d=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x455c43=>{_0x455c43['off'](),_0xed434d();});});}_getLatestVersionFromServerOperations(){const _0x20842b=this['editor']['plugins']['get'](tt)['serverHistory']['getOperations']()['reverse']();for(const _0x45e19c of _0x20842b)if('marker'!==_0x45e19c['type']||_0x45e19c['affectsData'])return _0x45e19c['baseVersion']+0x1;}_getLatestVersion(){const _0xf863f5=this['editor']['plugins']['get'](tt);return new Promise(_0x7a1cf2=>{_0xf863f5['_isPendingUpdate']?_0xf863f5['once']('change:_isPendingUpdate',()=>{_0x7a1cf2(this['_getLatestVersionFromServerOperations']());}):_0x7a1cf2(this['_getLatestVersionFromServerOperations']());});}_handleRevisionsUpdate(_0x210d1e,_0x3c2cd3){const _0x1900a1=this['_revisionTracker']['repository'];this['_lastRequestId']=_0x3c2cd3;for(const _0x3a5756 of _0x210d1e){const _0x296255=_0x1900a1['getRevision'](_0x3a5756['id']);if(_0x296255){if((_0x3a5756['fromVersion']||_0x3a5756['toVersion'])&&(_0x3a5756['diffData']=null),_0x296255===this['_revisionTracker']['currentRevision']){const _0x52ddf5=Math['max'](_0x296255['toVersion'],_0x3a5756['toVersion']),_0x3690ec=Math['max'](_0x296255['fromVersion'],_0x3a5756['fromVersion']);let _0xfdce2b;_0x296255['toVersion']===_0x3a5756['toVersion']&&_0x296255['fromVersion']===_0x3a5756['fromVersion']?(_0xfdce2b=!0x0,this['_preventResendingRevisionData'](_0x3a5756)):_0x3a5756['toVersion']===_0x52ddf5&&_0x3a5756['fromVersion']===_0x3690ec?_0xfdce2b=!0x1:(_0x296255['toVersion']===_0x52ddf5&&_0x296255['fromVersion']===_0x3690ec||this['_fixRevision']({'revision':_0x296255,'from':_0x3690ec,'to':_0x52ddf5}),_0xfdce2b=!0x0),_0xfdce2b&&(delete _0x3a5756['fromVersion'],delete _0x3a5756['toVersion'],delete _0x3a5756['diffData'],delete _0x3a5756['createdAt'],delete _0x3a5756['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0x3a5756),this['_preventResendingRevisionData'](_0x3a5756);}else this['_revisionTracker']['addRevisionData'](_0x3a5756);}const _0x3eaa1c=_0x1900a1['getRevisions']();_0x3eaa1c['reverse']();for(let _0x3c8131=0x0;_0x3c8131<_0x3eaa1c['length']-0x1;_0x3c8131++){const _0x4a2493=_0x3eaa1c[_0x3c8131],_0x33efe4=_0x3eaa1c[_0x3c8131+0x1];if(_0x4a2493['fromVersion']<_0x33efe4['toVersion']){const _0x305169=_0x33efe4['toVersion'],_0x1a1edc=Math['max'](_0x305169,_0x4a2493['toVersion']);this['_fixRevision']({'revision':_0x4a2493,'from':_0x305169,'to':_0x1a1edc});}}}['_fixRevision']({revision:_0x4be45b,from:_0x448998,to:_0xe22c3d}={}){const _0x440c61=this['editor']['plugins']['get'](_0x580d16),_0x3378f6=this['_revisionTracker']['buildRevisionData']({'revision':_0x4be45b,'from':_0x448998,'to':_0xe22c3d});_0x3378f6['authors']=_0x3378f6['authorsIds']['map'](_0x3f3099=>_0x440c61['getUser'](_0x3f3099)),_0x4be45b['_update'](_0x3378f6);}_preventResendingRevisionData(_0xac1d62){const _0x545497={};_0x545497['id']=_0xac1d62['id'];for(const _0x587e30 of Object['keys'](_0xac1d62))'id'!==_0x587e30&&(_0x545497[_0x587e30]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0x545497['id'],_0x545497,!0x0);}async _fetchMissingUsers(_0x1d6d81){const _0xe58d93=this['editor']['plugins']['get'](_0x580d16),{connection:_0xcf0bf1}=this['editor']['plugins']['get'](z),_0x54f02d=new Set();for(const _0xd7c2e6 of _0x1d6d81){for(const _0x38cc30 of _0xd7c2e6['authorsIds'])_0x3a498b(_0x38cc30);_0xd7c2e6['creatorId']&&_0x3a498b(_0xd7c2e6['creatorId']);}if(0x0===_0x54f02d['size'])return;const _0x23fc99=await _0x1c50bd['getMany'](_0xcf0bf1,Array['from'](_0x54f02d));for(const _0x493ce4 of _0x23fc99)_0xe58d93['getUser'](_0x493ce4['id'])||_0xe58d93['addUser'](_0x493ce4);function _0x3a498b(_0x41cbf0){_0xe58d93['getUser'](_0x41cbf0)||_0x54f02d['add'](_0x41cbf0);}}};function pt(_0x23c309){return _0x23c309['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0x23c309['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x23c309['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}var gt=class extends _0x541bf0{static get requires(){return[_0xb062ae,mt,nt];}static get['pluginName'](){return'RealTimeCollaborativeRevisionHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},wt=class extends _0x5a12bf{_collapseAt;constructor(_0x3f505d,_0x274e7d=0x6){super(_0x3f505d);const _0x55eecd=this['bindTemplate'];this['set']('isHidden',!0x0),this['set']('usersCount',0x0),this['_collapseAt']=_0x274e7d,this['bind']('isHidden')['to'](this,'usersCount',_0x28aba8=>_0x28aba8<_0x274e7d),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item',_0x55eecd['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':_0x55eecd['to']('usersCount',_0x470eef=>'+'+(_0x470eef-this['_collapseAt']+0x2)['toString']())}]}]}]});}},vt=class extends _0x5a12bf{items;keystrokes;constructor(_0x1892a1){super(_0x1892a1);const _0x34b9ed=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0x13efaf(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0x34b9ed['if']('hasPopup'),'aria-expanded':_0x34b9ed['to']('isExpanded',_0x51df1f=>this['hasPopup']&&String(_0x51df1f)),'aria-label':_0x34b9ed['to']('hasPopup',_0x4a80c2=>X(_0x1892a1,_0x4a80c2?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0x34b9ed['to']('hasPopup',_0x306afb=>!!_0x306afb&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items'],'on':{'mouseenter':_0x34b9ed['to'](()=>this['fire']('presencelist:show')),'mouseleave':_0x34b9ed['to'](_0x1f34a9=>{const _0x3dedbb=_0x1f34a9,_0x9bbf59=document['querySelector']('.ck-presence-list__dropdown-list'),_0x11fd04=document['querySelector']('.ck-balloon-panel_with-arrow');_0x9bbf59?.['contains'](_0x3dedbb['relatedTarget'])||_0x11fd04?.['contains'](_0x3dedbb['relatedTarget'])||this['fire']('presencelist:hide');})}}),this['on']('change:hasPopup',(_0x3ffd4c,_0x24aaf2,_0x22d63d)=>{this['element']&&(_0x22d63d?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 _0x5a12bf{counterView;inlineListView;constructor(_0xcf5af4,_0x237624=0x6){super(_0xcf5af4);const _0x2bd08b=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new wt(this['locale'],_0x237624),this['inlineListView']=new vt(_0xcf5af4),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x134ead of this['inlineListView']['items'])_0x134ead['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',_0x2bd08b['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['inlineListView']]});}},yt=class extends _0x5a12bf{listWrapperView;constructor(_0x4e1e3b,_0x29a38f){super(_0x4e1e3b);const _0x55abb9=this['bindTemplate'];this['listWrapperView']=new bt(_0x4e1e3b,_0x29a38f),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':X(_0x4e1e3b,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']],'on':{'mouseleave':_0x55abb9['to'](_0x10ca47=>{const _0x3e8b7d=_0x10ca47,_0x7d8e12=document['querySelector']('.ck-presence-list__list'),_0x473b7e=document['querySelector']('.ck-balloon-panel_with-arrow');_0x7d8e12?.['contains'](_0x3e8b7d['relatedTarget'])||_0x473b7e?.['contains'](_0x3e8b7d['relatedTarget'])||this['fire']('presencelist:hide');})}});}},bt=class extends _0x4bba40{constructor(_0xc3f955,_0x23b1bc){super(_0xc3f955);const _0x25d70c=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0x23b1bc?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0x25d70c['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0x25d70c['to']('role'),'aria-label':_0x25d70c['to']('ariaLabel'),'aria-labelledby':_0x25d70c['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0x3a30e1['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0x420bd7=this['element'];_0x420bd7&&(this['_isScrollable']=Math['max'](_0x420bd7['scrollHeight'],_0x420bd7['clientHeight'])>0.8*window['innerHeight']);}},kt=class extends _0x5d2e36{['userView'];constructor(_0x218c97,_0x253a14,_0x1d908a){super(_0x218c97);const _0x302e66=this['bindTemplate'];this['userView']=new _0x40ac71(_0x218c97,_0x253a14);const _0x2187e6={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0x253a14['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0x253a14['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x253a14['color']['getBackgroundColorClass']()],'style':{'--ck-user-color':_0x253a14['color']['getColorVariable'](),'--ck-user-color-alpha':_0x253a14['color']['getColorAlphaVariable']()},'aria-hidden':'true'}}]};_0x1d908a&&(_0x2187e6['tag']='button',_0x2187e6['on']={'click':_0x302e66['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x2187e6);}['focus'](){this['element']['focus']();}},It=class extends _0x5a12bf{['userView'];['markerView'];constructor(_0xa5af34,_0x3ce382,_0x370651){super(_0xa5af34);const _0xc1fe9a=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new _0x40ac71(_0xa5af34,_0x3ce382),this['markerView']=new St(_0xa5af34,_0x3ce382);const _0x3c213b=new _0x3344ca(_0xa5af34);_0x3c213b['template']['tag']='span',_0x3c213b['text']=_0x3ce382['name'];const _0x312176={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0xc1fe9a['to']('isFocusable',_0x13ac14=>!!_0x13ac14&&0x0),'aria-labelledby':_0x3c213b['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0xc1fe9a['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0xc1fe9a['to']('hasTooltip',_0x125d0a=>!_0x125d0a),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0x3c213b]};_0x370651&&(_0x312176['tag']='button',_0x312176['on']={'click':_0xc1fe9a['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x312176);}},St=class extends _0x5a12bf{constructor(_0x32353d,_0x10fad9){super(_0x32353d),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x10fad9['color']['getBackgroundColorClass']()],'style':{'--ck-user-color':_0x10fad9['color']['getColorVariable'](),'--ck-user-color-alpha':_0x10fad9['color']['getColorAlphaVariable']()},'aria-hidden':'true'}});}};const Tt={'collapseAt':0x6,'displayMe':!0x0};var Ct=class extends _0x41ec8a{currentDisplayedUsers;['balloonPanelView'];['view'];['presenceDropdownView'];_bodyCollection=null;static get['pluginName'](){return'PresenceListUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x1f54aa){super(_0x1f54aa),this['context']['config']['define']('presenceList',Tt);const _0x30af75=_0x1f54aa['config']['get']('presenceList.collapseAt');if('number'!=typeof _0x30af75)throw new _0x1017f6('presencelist-collapseat-invalid-format',this);if(_0x30af75<0x1)throw new _0x1017f6('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](Y)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0x436156(),this['balloonPanelView']=new _0x1e027a(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get requires(){return[Y];}init(){for(const _0x2ad890 of this['_allConnectedUsers'])this['_handleUserAdd'](_0x2ad890);this['listenTo'](this['_allConnectedUsers'],'add',(_0x3e77b5,_0x3f85bb)=>{this['_handleUserAdd'](_0x3f85bb);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0x44fa6f,_0x5697c3)=>{this['_handleUserRemove'](_0x5697c3);});}_createView(){const _0x587d10=this['context'],_0x5d5aa3=new _t(this['context']['locale'],this['context']['config']['get']('presenceList.collapseAt')),_0x28f7ee=this['balloonPanelView'];if(!_0x3fb10f(_0x587d10['config']['get']('presenceList.container')))throw new _0x1017f6('presencelist-missing-container',this);return _0x5d5aa3['counterView']['bind']('usersCount')['to'](this),_0x5d5aa3['bind']('isCollapsed')['to'](this,'usersCount',_0x48b8e6=>{const {collapseAt:_0x3f6731}=_0x587d10['config']['get']('presenceList'),_0x4560f6=_0x48b8e6>=_0x3f6731;if(_0x4560f6&&!_0x5d5aa3['inlineListView']['items']['find'](_0x110c4f=>_0x110c4f instanceof wt)){const _0x1e2eed=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['currentDisplayedUsers']['length']==_0x1e2eed&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](this['currentDisplayedUsers']['length']-0x1),_0x5d5aa3['inlineListView']['items']['add'](_0x5d5aa3['counterView']);}return _0x4560f6||this['hideDropdown'](),_0x4560f6;}),_0x5d5aa3['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0x3f7b62=>{const _0x4d2d19=_0x587d10['config']['get']('presenceList'),_0x1034c1=new It(_0x587d10['locale'],_0x3f7b62,!!_0x4d2d19['onClick']);return _0x1034c1['bind']('hasTooltip')['to'](_0x5d5aa3,'isCollapsed',_0x278f07=>!_0x278f07),_0x1034c1['bind']('isFocusable')['to'](_0x5d5aa3,'isCollapsed',_0x1f36cb=>!_0x1f36cb),_0x4d2d19['onClick']&&this['listenTo'](_0x1034c1,'execute',()=>{this['view']['isCollapsed']||_0x4d2d19['onClick'](_0x3f7b62,_0x1034c1['element']);}),_0x1034c1;}),this['listenTo'](_0x5d5aa3['inlineListView'],'presencelist:show',()=>{this['view']['isCollapsed']&&this['showDropdown']();}),this['listenTo'](_0x5d5aa3['inlineListView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();}),_0x5d5aa3['inlineListView']['keystrokes']['set']('Enter',(_0x51d0c8,_0x1b86c7)=>{this['view']['isCollapsed']&&(this['showDropdown'](),_0x1b86c7());}),_0x5d5aa3['render'](),_0x28f7ee['render'](),_0x4b3948({'emitter':_0x5d5aa3,'activator':()=>_0x28f7ee['isVisible'],'contextElements':[_0x28f7ee['element'],_0x5d5aa3['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0x587d10['config']['get']('presenceList.container')['appendChild'](_0x5d5aa3['element']),this['_bodyCollection']=new _0x46f4ce(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_bodyCollection']['add'](this['balloonPanelView']),_0x5d5aa3;}['_handleUserAdd'](_0x315d03){if(!this['context']['config']['get']('presenceList.displayMe')&&_0x315d03['isMe'])return;const _0x17cf09=this['context']['config']['get']('presenceList.collapseAt')-0x1;for(this['usersCount']++;this['currentDisplayedUsers']['length']>=_0x17cf09-(this['view']['isCollapsed']?0x1:0x0)&&this['currentDisplayedUsers']['length']>0x1;)this['currentDisplayedUsers']['remove'](0x1);const _0x4184e4=_0x315d03['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0x315d03,_0x4184e4);}['_handleUserRemove'](_0x4703fa){this['usersCount']--;const {collapseAt:_0x1a83cc}=this['context']['config']['get']('presenceList'),_0xe6e0cb=this['usersCount']>=_0x1a83cc;if(this['currentDisplayedUsers']['get'](_0x4703fa['id']))this['currentDisplayedUsers']['remove'](_0x4703fa['id']);else{if(_0xe6e0cb&&this['currentDisplayedUsers']['length']+0x1===_0x1a83cc-0x1)return;}if(this['currentDisplayedUsers']['length']+(_0xe6e0cb?0x1:0x0)<this['usersCount']){for(const _0x349558 of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0x349558['id'])&&(this['currentDisplayedUsers']['add'](_0x349558,Math['min'](this['currentDisplayedUsers']['length']-(_0xe6e0cb?0x1:0x0),0x1)),this['currentDisplayedUsers']['length']+(_0xe6e0cb?0x1:0x0)===_0x1a83cc-0x1))return;}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0x34d284=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new yt(this['context']['locale'],!!_0x34d284['onClick']),this['view']['inlineListView']['isExpanded']=!0x0,this['listenTo'](this['presenceDropdownView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();});const {listWrapperView:_0xbff6}=this['presenceDropdownView'];_0xbff6['items']['bindTo'](this['_allConnectedUsers'])['using'](_0xcba5f1=>{if(!_0x34d284['displayMe']&&_0xcba5f1['isMe'])return null;const _0x150241=new kt(this['context']['locale'],_0xcba5f1,!!_0x34d284['onClick']);return _0x34d284['onClick']&&this['listenTo'](_0x150241,'execute',()=>{_0x34d284['onClick'](_0xcba5f1,_0x150241['element']);}),_0x150241;}),this['balloonPanelView']['content']['add'](this['presenceDropdownView']),this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element']}),_0xbff6['focus'](),_0xbff6['checkIfScrollable']();const _0x8016f0=(_0x58c782,_0xc85fe2)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0xc85fe2();};_0xbff6['keystrokes']['set']('Esc',_0x8016f0),_0xbff6['keystrokes']['set']('Shift+Tab',_0x8016f0),_0xbff6['keystrokes']['set']('Tab',(_0x338d81,_0x20b0e5)=>{!function(_0xc52181){const _0x4e3998=['a','button','input','select','textarea','[tabindex]','[contenteditable]']['map'](_0x265b46=>_0x265b46+':not([disabled]):not([tabindex=\x22-1\x22])')['join'](','),_0x2cdffd=[...document['body']['querySelectorAll'](_0x4e3998)]['filter'](_0x1aede5=>_0x1aede5===document['activeElement']||_0x1aede5['offsetWidth']+_0x1aede5['offsetHeight']>0x0)['sort']((_0x4a4789,_0x1716d0)=>(_0x4a4789['tabIndex']||0x0)-(_0x1716d0['tabIndex']||0x0)),_0x5cd439=_0x2cdffd[(_0x2cdffd['indexOf'](_0xc52181)+0x1)%_0x2cdffd['length']];_0x5cd439&&_0x5cd439['focus']();}(this['view']['element']),this['hideDropdown'](),_0x20b0e5();}),_0xbff6['focusTracker']['add'](this['view']['element']),_0xbff6['focusTracker']['on']('change:isFocused',(_0x1691a2,_0x32f840,_0x566780)=>{_0x566780||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 _0x41ec8a{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 _0x3b8224,ContextPlugin as _0x199983,PendingActions as _0x462aee,Plugin as _0x4dea7b}from'@ckeditor/ckeditor5-core';import{CKEditorError as _0x4221a8,Collection as _0xbc07ad,DomEmitterMixin as _0x1e66e0,KeystrokeHandler as _0x1d53f5,global as _0x4e5766,uid as _0x26b330,version as _0x5f039b}from'@ckeditor/ckeditor5-utils';import{BalloonPanelView as _0x23dff2,BodyCollection as _0x52cb49,LabelView as _0x3f0acc,ListItemView as _0x3d822f,ListView as _0x2426d0,Notification as _0x509873,View as _0x19ada5,clickOutsideHandler as _0x1ce9fc}from'@ckeditor/ckeditor5-ui';import{History as _0x46d843,InsertOperation as _0x5e3756,MarkerOperation as _0x2d5d99,ModelLiveRange as _0x48dbc3,NoOperation as _0x533353,OperationFactory as _0x25c611,RootAttributeOperation as _0x54eaa8,transformOperationSets as _0x1b9d7f}from'@ckeditor/ckeditor5-engine';import{CloudServices as _0x383832}from'@ckeditor/ckeditor5-cloud-services';import{CollaborativeEditingService as _0x4ecff9,CommentsService as _0x8155c2,EditorService as _0x132713,RevisionHistoryService as _0x11ab20,TrackChangesService as _0x462a45,User as _0x5918aa,WEB_SOCKET_GATEWAY_STATES as _0x24ea0b,WebSocketGateway as _0x405022}from'@ckeditor/ckeditor-cloud-services-collaboration';import{UserView as _0x398431,Users as _0xc75193}from'@ckeditor/ckeditor5-collaboration-core';import{Compressor as _0x49b5f3}from'@ckeditor/ckeditor5-operations-compressor';import{TrackChanges as _0x19ed4c,TrackChangesEditing as _0x559281}from'@ckeditor/ckeditor5-track-changes';import{Comments as _0xb0d326,CommentsEditing as _0x7afca3,CommentsRepository as _0x5120b7}from'@ckeditor/ckeditor5-comments';import{RevisionHistory as _0x423746}from'@ckeditor/ckeditor5-revision-history';import{isElement as _0x139989}from'es-toolkit/compat';var z=class WebSocketGateway extends _0x199983{static WebSocketGateway=/* #__PURE__ -- @preserve */
24
+ ((()=>_0x405022)());static initialReconnectionInterval=0x3e8;connection;_reconnectionStack;_shouldPluginsReconnect;_domEmitter;static get requires(){return[_0x383832,_0x509873];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x91f262){super(_0x91f262),this['set']('state',_0x24ea0b['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=new(_0x1e66e0())();}init(){const _0xbfbf10=this['context'],_0x1b246f=_0xbfbf10['plugins']['get'](_0x383832),_0x37ed7e=_0xbfbf10['plugins']['get'](_0x509873);if(!_0x1b246f['token'])throw new _0x4221a8('websocketgateway-missing-token',this);if(!_0x1b246f['webSocketUrl'])throw new _0x4221a8('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'](_0x1b246f['token'],_0x1b246f['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0x4e0799=>{if(this['connection']=_0x4e0799,this['bind']('state')['to'](_0x4e0799,'state',this,'_isBrowserOffline',(_0x393e16,_0x1d1723)=>('connected'!==_0x393e16&&(this['_shouldPluginsReconnect']=!0x0),_0x1d1723||_0x393e16!==_0x24ea0b['CONNECTED']?_0x24ea0b['DISCONNECTED']:this['state']==_0x24ea0b['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),_0x24ea0b['CONNECTING']):_0x24ea0b['CONNECTED'])),this['connection']['on']('error',(_0x4c785c,_0x15bafc)=>{if('limitExceeded'!==_0x15bafc['code'])throw console['error'](_0x15bafc),new _0x4221a8('cloudservices-init',null,{'originalError':_0x15bafc});_0x37ed7e['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'});}),!_0x4e0799['me'])return new Promise(_0x129ab4=>_0x4e0799['on']('change:me',_0x129ab4));})['catch'](_0x2e7c96=>{throw console['error'](_0x2e7c96),new _0x4221a8('cloudservices-init',null,{'originalError':_0x2e7c96});});}addToReconnectionStack(_0x598e5a){if('function'!=typeof _0x598e5a['reconnect'])throw new _0x4221a8('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0x598e5a))throw new _0x4221a8('websocketgateway-plugin-already-registered',this,{'name':_0x598e5a['constructor']['pluginName']});this['_reconnectionStack']['add'](_0x598e5a);}removeFromReconnectionStack(_0x233e89){this['_reconnectionStack']['delete'](_0x233e89);}isInReconnectionStack(_0x47f6b0){return this['_reconnectionStack']['has'](_0x47f6b0);}_reconnect(){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0x20a6ca=>_0x20a6ca['reconnect']())))['then'](()=>this['state']=_0x24ea0b['CONNECTED'])['catch'](_0x1901e0=>{throw console['error'](_0x1901e0),new _0x4221a8('cloudservices-reconnection-error',this['context']);});}disconnect(){this['connection']&&this['connection']['disconnect'](),this['state']=_0x24ea0b['DISCONNECTED'],this['_domEmitter']['stopListening']();}destroy(){this['disconnect'](),super['destroy']();}},Y=class extends _0x199983{['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,_0xc75193];}constructor(_0x20ee2c){super(_0x20ee2c),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0xbc07ad(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0xc75193);}init(){const _0x4f61cd=this['context']['plugins']['get'](z);this['listenTo'](_0x4f61cd,'change:state',(_0x13f542,_0xe3cc5c,_0x274f8e)=>{if('connected'!==_0x274f8e)this['channelSessions']['forEach'](_0x47e908=>_0x47e908['clear']()),this['channelConnectedUsers']['forEach'](_0x1853c2=>_0x1853c2['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x41e6a0,_0x1dcf0a]of this['_registeredSessions'])for(const _0x2806b3 of _0x1dcf0a)this['_handleSessionAdd'](_0x41e6a0,_0x2806b3);}}),this['_createUser'](_0x4f61cd['connection']['me'],!0x0);}register(_0x36e0a9,_0x55f14d){if(this['_registeredSessions']['has'](_0x36e0a9))throw new _0x4221a8('sessions-register-already-registered',null,{'channelId':_0x36e0a9});this['_registeredSessions']['set'](_0x36e0a9,_0x55f14d),this['channelSessions']['set'](_0x36e0a9,new _0xbc07ad()),this['channelConnectedUsers']['set'](_0x36e0a9,new _0xbc07ad()),this['listenTo'](_0x55f14d,'add',(_0x5e5182,_0x4431c2)=>this['_handleSessionAdd'](_0x36e0a9,_0x4431c2)),this['listenTo'](_0x55f14d,'remove',(_0x57c071,_0x2b89a8)=>this['_handleSessionRemove'](_0x36e0a9,_0x2b89a8));for(const _0x1fed10 of _0x55f14d)this['_handleSessionAdd'](_0x36e0a9,_0x1fed10);}unregister(_0x369f80){if(!this['_registeredSessions']['has'](_0x369f80))throw new _0x4221a8('sessions-unregister-not-exist',null,{'channelId':_0x369f80});const _0x325a55=this['_registeredSessions']['get'](_0x369f80);this['stopListening'](_0x325a55);for(const _0x330df2 of _0x325a55)'connected'===this['context']['plugins']['get'](z)['state']&&this['_handleSessionRemove'](_0x369f80,_0x330df2);this['_registeredSessions']['delete'](_0x369f80),this['channelSessions']['delete'](_0x369f80),this['channelConnectedUsers']['delete'](_0x369f80);}get['mySessionId'](){return this['context']['plugins']['get'](z)['connection']['sessionId'];}getUserBySessionId(_0x2f1687){for(const _0x26db68 of this['channelSessions']['values']())for(const _0x5636d0 of _0x26db68)if(_0x5636d0['id']===_0x2f1687)return _0x5636d0['user'];}getUserSessions(_0x43b5a3,_0x45c335){const _0x4d1ced=_0x45c335?[this['channelSessions']['get'](_0x45c335)]:this['channelSessions']['values'](),_0x3744fc=new Set();for(const _0x18bc6e of _0x4d1ced)for(const _0x39dfb1 of _0x18bc6e)_0x39dfb1['user']['id']===_0x43b5a3['id']&&_0x3744fc['add'](_0x39dfb1['id']);return _0x3744fc;}getUserRole(_0x541e65){for(const _0x546536 of this['channelSessions']['values']())for(const _0x2a9ba9 of _0x546536)if(_0x2a9ba9['user']===_0x541e65)return _0x2a9ba9['role'];}['_handleSessionAdd'](_0x1e67be,_0x33abf6){if('connected'!==this['context']['plugins']['get'](z)['state'])return;const _0x250eeb=_0x33abf6['user'],_0x267c97=this['_users']['getUser'](_0x250eeb['id'])||this['_createUser'](_0x250eeb),_0x14a049=Object['assign']({},_0x33abf6,{'user':_0x267c97});if(this['channelSessions']['get'](_0x1e67be)['add'](_0x14a049),!_0x250eeb['hiddenInPresenceList']){const _0x5df07d=this['channelConnectedUsers']['get'](_0x1e67be);_0x5df07d['has'](_0x267c97['id'])||_0x5df07d['add'](_0x267c97),this['allConnectedUsers']['has'](_0x267c97['id'])||_0x250eeb['hiddenInPresenceList']||this['allConnectedUsers']['add'](_0x267c97,_0x267c97['isMe']?0x0:void 0x0);}this['fire']('sessionAdd:'+_0x1e67be,{'channelId':_0x1e67be,'session':_0x14a049});}['_handleSessionRemove'](_0x1181b7,_0x4a2862){if('connected'!==this['context']['plugins']['get'](z)['state'])return;const _0x1f64b1=this['channelConnectedUsers']['get'](_0x1181b7),_0x2e2cb9=_0x4a2862['user'];_0x2e2cb9['id']&&(this['channelSessions']['get'](_0x1181b7)['remove'](_0x4a2862['id']),_0x1f64b1['has'](_0x2e2cb9['id'])&&!this['getUserSessions'](_0x2e2cb9,_0x1181b7)['size']&&_0x1f64b1['remove'](_0x2e2cb9['id']),this['allConnectedUsers']['get'](_0x2e2cb9['id'])&&!this['getUserSessions'](_0x2e2cb9)['size']&&this['allConnectedUsers']['remove'](_0x2e2cb9['id']));}_createUser(_0x468f83,_0x2800d3){const _0x3b79ff=this['_users']['addUser'](_0x468f83);return _0x2800d3&&this['_users']['defineMe'](_0x468f83['id']),_0x3b79ff['orderNumber']=this['_uniqueUsersCount']++,_0x3b79ff;}},K=class extends _0x4dea7b{_domEmitter=new(_0x1e66e0())();static get requires(){return[Y];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const _0x312b4c=this['editor'],_0x501d19=_0x312b4c['plugins']['get'](Y);_0x312b4c['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x543a8e,{writer:_0x51c9f7})=>function(_0x39388b,_0x150b2f,_0x7c28db,_0x181c97){const _0x51b754=_0x39388b['markerName']['split'](':')[0x2],_0x2373f0=_0x7c28db['getUserBySessionId'](_0x51b754);if(!_0x2373f0||_0x51b754===_0x7c28db['mySessionId'])return;if(!_0x181c97['model']['schema']['checkChild'](_0x39388b['markerRange']['start'],'$text'))return;const _0x255a50={'class':'ck-user__marker\x20'+_0x2373f0['color']['getMarkerClass'](),'style':Q(_0x2373f0),'data-name':_0x2373f0['name'],'data-session-id':_0x51b754},_0xb9bb35=_0x181c97['model']['markers']['get'](_0x39388b['markerName'])['getStart'](),_0x50d5e7=_0xb9bb35['nodeAfter'],_0x4b684a=_0x181c97['model']['schema'];if(_0x50d5e7&&_0x4b684a['isObject'](_0x50d5e7)&&_0x4b684a['isInline'](_0x50d5e7)&&!_0x181c97['model']['markers']['get']('user:range:'+_0x51b754)['getRange']()['isCollapsed'])return;const _0x597501=_0xb9bb35['parent'];return _0x181c97['model']['schema']['isLimit'](_0x597501)&&!_0x181c97['model']['hasContent'](_0x597501)&&(_0x255a50['contenteditable']=!0x1),function(_0x53c634,_0x27e488,_0x5a5300){const _0x200d51=_0x53c634['createUIElement']('span',_0x27e488);return _0x53c634['setCustomProperty']('userPositionMarker',!0x0,_0x200d51),_0x200d51['render']=function(_0x3eed8c){const _0x5dbb4a=this['toDomElement'](_0x3eed8c),_0x473dd=document['createElement']('span');return _0x473dd['classList']['add']('ck-user__marker-tooltip'),_0x473dd['setAttribute']('contenteditable','false'),_0x473dd['setAttribute']('spellcheck','false'),_0x473dd['textContent']=_0x5a5300['name'],_0x5dbb4a['innerHTML']='⁠<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span>'+_0x473dd['outerHTML']+'⁠',_0x5dbb4a['addEventListener']('mouseenter',()=>{_0x5dbb4a['classList']['add']('ck-user__marker_hovered');}),_0x5dbb4a['addEventListener']('mouseleave',()=>{_0x5dbb4a['classList']['remove']('ck-user__marker_hovered');}),_0x5dbb4a;},_0x200d51['isSimilar']=function(_0x2b6a1d){return!(!this['getCustomProperty']('userPositionMarker')||!_0x2b6a1d['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0x2b6a1d['getAttribute']('data-session-id'));},_0x200d51;}(_0x150b2f,_0x255a50,_0x2373f0);}(_0x543a8e,_0x51c9f7,_0x501d19,_0x312b4c)}),_0x312b4c['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0x56c9b0=>function(_0x4b9e57,_0x36496b){const _0x6d1362=_0x4b9e57['markerName']['split'](':')[0x2];if(_0x6d1362===_0x36496b['mySessionId'])return null;const _0x2513b6=_0x36496b['getUserBySessionId'](_0x6d1362);return _0x2513b6?{'id':_0x6d1362,'classes':['ck-user__selection',_0x2513b6['color']['getSelectionClass']()],'attributes':{'style':Q(_0x2513b6),'data-session-id':_0x6d1362},'priority':0x7d0+_0x2513b6['orderNumber']}:{'id':_0x6d1362,'classes':[]};}(_0x56c9b0,_0x501d19)}),function(_0x45cf0e){const _0x33aae4=_0x45cf0e['model'],_0x4db5cf=new Map(),_0x3b8c4a=_0x45cf0e['plugins']['get'](Y);_0x33aae4['markers']['on']('update:user:range',(_0x374829,_0x49d9e5,_0x37cb36,_0xfde76b)=>{if(!_0xfde76b&&_0x4db5cf['get'](_0x49d9e5['name']))return _0x4db5cf['get'](_0x49d9e5['name'])['detach'](),void _0x4db5cf['delete'](_0x49d9e5['name']);const _0x13bbe9=_0x49d9e5['name']['split'](':')[0x2];if(_0x13bbe9===_0x3b8c4a['mySessionId'])return;const _0x1f9f56='user:position:'+_0x13bbe9;_0x33aae4['markers']['has'](_0x1f9f56)&&_0x45cf0e['editing']['reconvertMarker'](_0x1f9f56),_0x49d9e5['on']('change:range',(_0x40ad0c,_0x2b1247,_0x5ab008)=>{if('$graveyard'!=_0x2b1247['root']['rootName']&&'$graveyard'==_0x49d9e5['getRange']()['root']['rootName']&&!_0x4db5cf['has'](_0x49d9e5['name'])){const _0x3f23da=_0x33aae4['schema']['getNearestSelectionRange'](_0x5ab008['deletionPosition']);if(_0x3f23da){const _0x19a13a=_0x48dbc3['fromRange'](_0x3f23da);_0x4db5cf['set'](_0x49d9e5['name'],_0x19a13a),_0x19a13a['on']('change:range',(_0x288481,_0x3d7f34,_0x2f4abf)=>{if('$graveyard'==_0x19a13a['root']['rootName']){const _0x2c461e=_0x33aae4['schema']['getNearestSelectionRange'](_0x2f4abf['deletionPosition']);_0x2c461e?(_0x19a13a['start']=_0x2c461e['start'],_0x19a13a['end']=_0x2c461e['end']):(_0x4db5cf['delete'](_0x49d9e5['name']),_0x19a13a['detach']());}});}}});}),_0x33aae4['document']['on']('change',()=>{_0x4db5cf['size']>0x0&&_0x33aae4['enqueueChange']({'isUndoable':!0x1},_0x1a4bf6=>{for(const [_0x4b1d02,_0x254361]of _0x4db5cf)'$graveyard'==_0x33aae4['markers']['get'](_0x4b1d02)['getRange']()['root']['rootName']&&(J(_0x4b1d02['split'](':')[0x2],_0x254361['toRange'](),_0x33aae4,_0x1a4bf6),_0x254361['detach']());_0x4db5cf['clear']();});});}(_0x312b4c),this['_domEmitter']['listenTo'](_0x4e5766['document'],'keydown',(_0x3e219f,{key:_0x42a9be})=>{'Escape'===_0x42a9be&&function(_0x3d892a){_0x3d892a['editing']['view']['change'](_0x92a995=>{for(const _0xae81a5 of _0x3d892a['model']['markers']){if(!_0xae81a5['name']['startsWith']('user:position'))continue;const _0x1b4568=_0x3d892a['editing']['mapper']['markerNameToElements'](_0xae81a5['name']);if(_0x1b4568){for(const _0x48746c of _0x1b4568)_0x92a995['removeClass']('ck-user__marker_hovered',_0x48746c);}}});}(_0x312b4c);},{'useCapture':!0x0});}afterInit(){const _0x2055bf=this['editor'],_0x35fcb8=_0x2055bf['commands']['get']('undo');_0x35fcb8&&_0x2055bf['model']['on']('applyOperation',(_0x528b34,_0x1c3651)=>{const _0x1c4d4d=_0x1c3651[0x0];if(!_0x1c4d4d['isDocumentOperation'])return;if('marker'!=_0x1c4d4d['type']||!_0x1c4d4d['name']['startsWith']('user:'))return;const _0x5a89bb=_0x1c4d4d['batch'];_0x35fcb8['_createdBatches']['has'](_0x5a89bb)&&(_0x1c4d4d['newRange']=_0x1c4d4d['oldRange']?_0x2055bf['model']['createRange'](_0x1c4d4d['oldRange']['start'],_0x1c4d4d['oldRange']['end']):null);},{'priority':'highest'});}destroy(){return this['_domEmitter']['stopListening'](),super['destroy']();}createUserMarkerOperations(){const _0x366ea8=this['editor'],_0x59c957=_0x366ea8['model']['document'],_0x3bee22=_0x366ea8['plugins']['get'](Y);_0x366ea8['model']['enqueueChange']({'isUndoable':!0x1},_0x9d3bab=>{const _0xc129cd='user:range:'+_0x3bee22['mySessionId'],_0x34a22d='user:position:'+_0x3bee22['mySessionId'],_0xd526e1=_0x366ea8['model']['markers']['has'](_0xc129cd);_0x366ea8['editing']['view']['hasDomSelection']?J(_0x3bee22['mySessionId'],_0x59c957['selection']['getFirstRange'](),_0x366ea8['model'],_0x9d3bab):_0xd526e1&&(_0x9d3bab['removeMarker'](_0xc129cd),_0x9d3bab['removeMarker'](_0x34a22d));});}};function J(_0x21b4c9,_0x2176bb,_0x54ef81,_0x5aa546){const _0x1c52fb='user:range:'+_0x21b4c9,_0x4e857b='user:position:'+_0x21b4c9,_0x1a0d3f=_0x2176bb['getContainedElement']();let _0x491196=_0x2176bb['start'];if(_0x1a0d3f&&_0x1a0d3f['is']('element','tableCell')){const _0x4dc3b4=function(_0x2753cc,_0x4feaf0){for(const _0x297507 of _0x2753cc['getPositions']())if(_0x4feaf0['schema']['checkChild'](_0x297507,'$text'))return _0x297507;}(_0x2176bb,_0x54ef81);_0x4dc3b4&&(_0x491196=_0x4dc3b4,_0x2176bb=_0x5aa546['createRange'](_0x491196));}const _0x20f17b=_0x5aa546['createRange'](_0x491196);_0x54ef81['markers']['has'](_0x1c52fb)?(_0x5aa546['updateMarker'](_0x1c52fb,{'range':_0x2176bb}),_0x5aa546['updateMarker'](_0x4e857b,{'range':_0x20f17b})):(_0x5aa546['addMarker'](_0x1c52fb,{'range':_0x2176bb,'usingOperation':!0x0}),_0x5aa546['addMarker'](_0x4e857b,{'range':_0x20f17b,'usingOperation':!0x0}));}function Q(_0x4e46f7){return'--ck-user-color:'+_0x4e46f7['color']['getColorVariable']()+';--ck-user-color-alpha:'+_0x4e46f7['color']['getColorAlphaVariable']()+';';}function X(_0x8b869e,_0x4b7ec3,_0x940cea){const _0x540ee8=_0x8b869e['t'],t=_0x8b869e['t'];switch(_0x4b7ec3){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 _0x540ee8({'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'},_0x940cea);default:return'';}}let Z=0x1;var tt=class RealTimeCollaborationClient extends _0x4dea7b{static CollaborativeEditingService=/* #__PURE__ -- @preserve */
25
+ ((()=>_0x4ecff9)());_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,_0x462aee,_0xc75193,_0x509873];}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 _0x5dc317=this['serverHistory']['getOperations']();for(let _0x1425b1=_0x5dc317['length']-0x1;_0x1425b1>=0x0;_0x1425b1--){const _0x1b1e5d=_0x5dc317[_0x1425b1];if(!this['_disconnectionOperations']['has'](_0x1b1e5d))return _0x1b1e5d['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0xb8950c){if(super(_0xb8950c),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x46d843(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0x4221a8('collaboration-missing-channelid',this);const _0x55d56c=_0xb8950c['config']['get']('cloudServices.bundleVersion')||_0x5f039b;this['_service']=new RealTimeCollaborationClient['CollaborativeEditingService'](_0x55d56c,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0x49b5f3(),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 _0x5e5ab5=this['editor'],_0x814d29=_0x5e5ab5['plugins']['get'](_0xc75193),_0x103dd9=_0x5e5ab5['plugins']['get'](z);this['listenTo'](_0x814d29,'getOperationAuthor',(_0x4d1ff8,_0x5d0306)=>{const _0x3aeee6=_0x5d0306[0x0];_0x3aeee6['_authorId']&&(_0x4d1ff8['return']=_0x814d29['getUser'](_0x3aeee6['_authorId']),_0x4d1ff8['stop']()),null===_0x3aeee6['_authorId']&&(_0x4d1ff8['return']=null,_0x4d1ff8['stop']());},{'priority':'high'}),this['listenTo'](_0x5e5ab5['model']['document']['selection'],'change:range',(_0x37af6c,_0x8555d4)=>{_0x8555d4['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x5e5ab5['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x5e5ab5['model']['on']('applyOperation',(_0xa11fb4,_0x4c60dd)=>{const _0x30a079=_0x4c60dd[0x0];_0x30a079['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0x30a079),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['set']('_isChannelFlushed',!0x1),this['bind']('_isEditingAllowed')['to'](_0x103dd9,'state',this,'_hasSynchronizationProblem',this,'_isChannelFlushed',(_0x5a7dcf,_0x60c6e6,_0x38a418)=>'connected'===_0x5a7dcf&&!_0x60c6e6&&!_0x38a418),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x5e5ab5['disableReadOnlyMode']('rtc-offline'):_0x5e5ab5['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x5e5ab5['disableReadOnlyMode']('rtc-offline'):_0x5e5ab5['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async reconnect(){const _0x492837=this['editor']['plugins']['get'](Y),_0x1d3506=this['editor']['plugins']['get'](z);try{this['_isPendingUpdate']=!0x0,_0x492837['unregister'](this['_channelId']);const _0x1c6fc8=await this['_service']['reconnect'](_0x1d3506['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0x1c6fc8)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x37dd2e=await this['_service']['getConnectedSessions']();_0x492837['register'](this['_channelId'],_0x37dd2e),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x4992de){if(function(_0x55899f){return'404'===_0x55899f['code'];}(_0x4992de)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0x4afdf5){return'409'===_0x4afdf5['code'];}(_0x4992de)){const _0x2545a0=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'](_0x2545a0);}else{if(!(_0x4992de instanceof et))throw _0x4992de;this['_handleReconnectionError']();}}}}destroy(){const _0x39b42d=this['editor']['plugins']['get'](z),_0x5a1f40=this['editor']['plugins']['get'](Y);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x5a1f40['channelSessions']['has'](this['_channelId'])&&_0x5a1f40['unregister'](this['_channelId']),_0x39b42d['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async _handleReconnectionResponse(_0x3e61a9){if(this['sessionId']!==_0x3e61a9['sessionId']&&this['_lastSyncedOperationId']!==_0x3e61a9['lastOperationId'])throw new et();return this['sessionId']=_0x3e61a9['sessionId'],this['_handleServerResponse']([],{..._0x3e61a9,'wereChangesApplied':!0x1,'data':_0x3e61a9['data']},'reconnect');}async _connectService(_0x5c47da,_0x3223cc=!0x1){const {connection:_0x3f7278}=this['editor']['plugins']['get'](z);RealTimeCollaborationClient['CollaborativeEditingService']['getConnectedSessions'](_0x3f7278,this['_channelId'])['then'](_0x316a96=>this['_initSessionsHandling'](_0x316a96))['catch'](_0x2a3375=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x2a3375);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x334517,_0x8c8059)=>{this['_crash']('realtimecollaborationclient-init-service-internal-error',_0x8c8059);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_handleChannelDisconnected']();});const _0x59c094=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x5c47da);this['_isPendingUpdate']=!0x0;const _0x12ee90=await this['_service']['connect'](_0x3f7278,this['_compressOperations'](_0x5c47da),_0x59c094);if(this['sessionId']=_0x12ee90['sessionId'],_0x3223cc){if(!_0x12ee90['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x12ee90['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0x5c47da,_0x12ee90,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x12ee90,_0x5c47da);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}_handleSendingSelectionMarkers(){const _0x5b1c85=this['editor']['plugins']['get'](Y),_0x33c711=this['editor']['plugins']['get'](K),_0x447994=_0x5b1c85['channelSessions']['get'](this['_channelId']);_0x447994&&_0x447994['length']>0x1?_0x33c711['createUserMarkerOperations']():this['listenTo'](_0x5b1c85,'sessionAdd:'+this['_channelId'],()=>{0x2===_0x5b1c85['channelSessions']['get'](this['_channelId'])['length']&&_0x33c711['createUserMarkerOperations']();});}async _handleReceivedOperations(_0x354c53,_0x4885e6,_0xefe1fd,_0x5c6298){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x4885e6){const _0x1003d5=this['_decompressOperations'](_0xefe1fd,_0x5c6298);await this['_fetchMissingUsers'](_0x1003d5),this['_handleExternalOperations'](_0x1003d5,_0x4885e6,_0xefe1fd['lastOperationId'])||this['_crash']('realtimecollaborationclient-init-service-incorrect-server-operation');}}async _connectAfterSessionHasBeenFlushed(){this['_disconnectService']();const {locale:_0x11d2b7}=this['editor'];let _0xb5db62;try{_0xb5db62=await this['_service']['getDocumentDetails']();}catch{const _0x4578a7=X(_0x11d2b7,'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'](_0x4578a7);}const _0x20c034=_0xb5db62['currentDocumentSession']||_0xb5db62['lastDocumentSession'];if(this['_lastSyncedOperationId']!==_0x20c034['lastOperationId']){const _0x14344a=X(_0x11d2b7,'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'](_0x14344a);}await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);}_handleChannelDisconnected(){const _0xe87616=this['editor']['plugins']['get'](z);if(this['_isConnected']=!0x1,!_0xe87616['connection']||'connected'!==_0xe87616['connection']['state'])return;this['_isChannelFlushed']=!0x0;const _0x59a739=this['editor']['plugins']['get'](Y);_0x59a739['channelSessions']['has'](this['_channelId'])&&_0x59a739['unregister'](this['_channelId']),_0xe87616['removeFromReconnectionStack'](this),this['_disconnectService']();}_disconnectService(){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['stopListening'](this['_service']);}_initSessionsHandling(_0x1cd64c){const _0xdb8ef=this['editor']['plugins']['get'](Y);this['listenTo'](_0xdb8ef,'sessionAdd:'+this['_channelId'],(_0x41ec7c,{session:_0x24e02f})=>{if(_0x24e02f['id']===_0xdb8ef['mySessionId']){_0x41ec7c['off']();const _0x1d5974=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0xafe74a=_0x24e02f['permissions'];_0x1d5974&&_0x1d5974['isEnabled']&&(_0xafe74a=_0xafe74a['filter'](_0x467ef8=>'document:write'!==_0x467ef8)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0xafe74a,this['_channelId']);}}),_0xdb8ef['register'](this['_channelId'],_0x1cd64c);}_initThrowingOnDataSet(){const _0x4022ac=this['editor']['data']['set'];this['editor']['data']['set']=(..._0x2b304f)=>{if(!_0x2b304f[_0x2b304f['length']-0x1]['suppressErrorInCollaboration'])throw new _0x4221a8('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x4022ac['apply'](this['editor']['data'],_0x2b304f);};}_setUpDataInit(){this['editor']['data']['on']('init',(_0x472911,[_0x51ec92])=>{if(this['_document']['version'])throw new _0x4221a8('realtimecollaborationclient-init-document-already-initialized',this);_0x472911['stop'](),this['_setPendingAction']();const _0x272532=Object['fromEntries'](Object['entries'](this['editor']['config']['get']('roots')||{})['filter'](([,_0x3ebbf9])=>!_0x3ebbf9['lazyLoad'])['map'](([_0x56a928,_0x4369af])=>[_0x56a928,_0x4369af['modelAttributes']||{}])),_0x26f45b=this['_getOperationsFromInitData'](_0x51ec92,_0x272532);0x0==_0x26f45b['length']&&_0x26f45b['push'](new _0x533353(0x0)),_0x472911['return']=this['_connectService'](_0x26f45b)['then'](()=>{this['editor']['plugins']['get'](z)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x1c68f5=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x1c68f5))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x112dda,[_0x9f5bb7,_0x7bb6fc])=>{_0x112dda['stop']();const _0x2b4ed4=this['editor']['model']['document']['getRoot'](_0x9f5bb7);if(!this['_knownRootNames']['has'](_0x9f5bb7)){const _0x428c41=_0x7bb6fc&&_0x7bb6fc['data']?_0x7bb6fc['data']:'',_0x4558aa=_0x7bb6fc&&_0x7bb6fc['attributes']?_0x7bb6fc['attributes']:{};await this['_loadRoot'](_0x9f5bb7,_0x428c41,_0x4558aa);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0x2b4ed4['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0x2b4ed4);});},{'priority':'high'});}async _fetchMissingUsers(_0x541205){const _0x1b339a=this['editor']['plugins']['get'](_0xc75193),{connection:_0x1eab6f}=this['editor']['plugins']['get'](z),_0x403987=new Set();for(const _0x4f4ca9 of _0x541205){const _0x561173=_0x4f4ca9['_authorId'];_0x561173&&!_0x1b339a['getUser'](_0x561173)&&_0x403987['add'](_0x561173);}if(0x0===_0x403987['size'])return;const _0x1dd27b=await _0x5918aa['getMany'](_0x1eab6f,Array['from'](_0x403987));for(const _0x2b3fef of _0x1dd27b)_0x1b339a['getUser'](_0x2b3fef['id'])||_0x1b339a['addUser'](_0x2b3fef);}_getOperationsFromInitData(_0x8f6dbc,_0x4c725c={}){const _0x4334e8=this['editor']['model'],_0x100176=[];let _0x10459c=0x0;const _0x13be34='string'==typeof _0x8f6dbc?{'main':_0x8f6dbc}:_0x8f6dbc;for(const _0x5aee64 of Object['keys'](_0x13be34)){if(!this['_document']['roots']['has'](_0x5aee64))throw new _0x4221a8('realtimecollaborationclient-init-non-existent-root',this);const _0x1a0e8d=this['_document']['getRoot'](_0x5aee64),_0x4ee5db=this['editor']['data']['parse'](_0x13be34[_0x5aee64],_0x1a0e8d),_0x595ae3=new _0x5e3756(_0x4334e8['createPositionAt'](_0x1a0e8d,0x0),_0x4ee5db,_0x10459c++);_0x100176['push'](_0x595ae3);for(const [_0x50022c,_0x32b8c3]of _0x4ee5db['markers']){const _0x3aaf97=_0x4334e8['createRange'](_0x4334e8['createPositionFromPath'](_0x1a0e8d,_0x32b8c3['start']['path']['slice']()),_0x4334e8['createPositionFromPath'](_0x1a0e8d,_0x32b8c3['end']['path']['slice']())),_0x433224=new _0x2d5d99(_0x50022c,null,_0x3aaf97,_0x4334e8['markers'],!0x0,_0x10459c++);_0x100176['push'](_0x433224);}}if(_0x4c725c)for(const [_0x49b2c7,_0x1e0747]of Object['entries'](_0x4c725c)){const _0x257e21=_0x4334e8['document']['getRoot'](_0x49b2c7);if(!_0x257e21)throw new _0x4221a8('multi-root-editor-root-attributes-no-root',null);for(const [_0x46f2ef,_0x59b90c]of Object['entries'](_0x1e0747))if(null!==_0x59b90c){const _0xec4480=new _0x54eaa8(_0x257e21,_0x46f2ef,null,_0x59b90c,_0x10459c++);_0x100176['push'](_0xec4480);}}return _0x100176;}async _loadRoot(_0x289ca1,_0x58c434,_0x20980c){this['_getOperationsFromInitData']({[_0x289ca1]:_0x58c434},{[_0x289ca1]:_0x20980c})['forEach']((_0x460d28,_0x2dfdac)=>{_0x460d28['baseVersion']=this['_document']['version']+_0x2dfdac,_0x460d28['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x460d28);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async _handleInitialConnectionData(_0x539952,_0x7507bc){let _0x74ffb3;this['_offset']=_0x539952['offset'];const _0x201973=_0x539952['wereChangesApplied']&&!_0x539952['initData'],_0x4b631e=_0x201973?0x0:_0x539952['data']['baseVersion'];if(_0x7507bc['forEach'](_0x4ae361=>{_0x4ae361['_isInit']=!0x0,_0x4ae361['createdAt']=_0x539952['sessionCreatedAt'],_0x4ae361['_authorId']=null;}),_0x201973)_0x74ffb3=_0x7507bc,this['_applyOperationsSet'](_0x74ffb3,_0x201973);else{if(_0x539952['initData']){const _0x3a1100=this['_getOperationsFromInitData'](_0x539952['initData']);this['_document']['history']['version']=-_0x3a1100['length'],_0x3a1100['forEach'](_0x2f928f=>{_0x2f928f['baseVersion']-=_0x3a1100['length'],_0x2f928f['createdAt']=_0x539952['sessionCreatedAt'],_0x2f928f['_isInit']=!0x0,_0x2f928f['_authorId']=null;}),this['_applyOperationsSet'](_0x3a1100,!0x0),this['serverHistory']['version']=-_0x3a1100['length']+this['_offset'],this['_updateServerHistory'](_0x3a1100);}this['_document']['history']['version']=_0x4b631e,_0x74ffb3=this['_decompressOperations'](_0x539952['data'],_0x539952['metadata']),await this['_fetchMissingUsers'](_0x74ffb3),this['_applyOperationsSet'](_0x74ffb3,_0x201973);}_0x539952['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x74ffb3,_0x539952['lastOperationId']),this['_lastSyncedOperationId']=_0x539952['lastOperationId']),this['serverHistory']['version']=_0x4b631e+this['_offset'],this['_updateServerHistory'](_0x74ffb3),_0x7507bc['filter'](_0x225e6d=>{const _0x13b4ad=this['_getAffectedRoot'](_0x225e6d);return _0x13b4ad&&!this['_knownRootNames']['has'](_0x13b4ad);})['forEach']((_0x479819,_0x19a5c8)=>{_0x479819['baseVersion']=this['_document']['version']+_0x19a5c8,this['_saveOperationInBuffer'](_0x479819);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x4e6d5a,_0x20c8b7){const _0x4a809e=_0x20c8b7&&_0x20c8b7['message'];if(_0x4a809e&&_0x4a809e['startsWith']('realtimecollaborationclient'))throw _0x20c8b7;const _0x3cd6a8=this['editor']['plugins']['get'](z);throw this['_isPendingUpdate']=!0x0,_0x3cd6a8['disconnect'](),this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0x4221a8(_0x4e6d5a,this['editor'],_0x4a809e?{'originalError':_0x4a809e}:void 0x0);}_saveOperationInBuffer(_0x479c06){this['_knownOperations']['has'](_0x479c06)||(this['_knownOperations']['add'](_0x479c06),this['_bufferedOperations']['push'](_0x479c06),this['_pendingAction']||'marker'==_0x479c06['type']&&!_0x479c06['affectsData']||this['_setPendingAction']());}_sendBufferedOperationsDelayed(_0x2ac7b1=!0x1){!_0x2ac7b1&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0x8e120e=>{_0x8e120e&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0xcd1227=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0x5bffde){return _0x5bffde['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x5bffde['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0x5bffde['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0xcd1227)||this['_crash'](_0xcd1227['message'],_0xcd1227);});},this['_currentBufferDelay']));}_waitUntilSynced(){return new Promise(_0x28b96e=>{this['on']('change:_isPendingUpdate',()=>{_0x28b96e();});});}async _sendBufferedOperations(){const _0x39300e=this['editor']['plugins']['get'](K);if(this['_shouldSendSelectionUpdate']()&&(_0x39300e['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x1dabe2=[...this['_bufferedOperations']];for(const _0x26932e of _0x1dabe2)_0x26932e['wasUndone']=this['_document']['history']['isUndoneOperation'](_0x26932e);const _0x1cac95=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x1dabe2),_0xe5586e=Z++,_0x1b9646=this['_compressOperations'](_0x1dabe2),_0x33f5a6=await this['_service']['sendOperations'](_0x1b9646,_0x1b9646['baseVersion'],_0x1cac95);try{return await this['_handleServerResponse'](_0x1dabe2,_0x33f5a6,_0xe5586e);}catch(_0xbd8028){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0xbd8028);}}async['_handleServerResponse'](_0x31baf5,_0x3dff06,_0x190818){if('error'in _0x3dff06)throw _0x3dff06['error'];let _0x1167e6;if(_0x3dff06['wereChangesApplied']){_0x3dff06['lastOperationId']&&(this['_lastSyncedOperationId']=_0x3dff06['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x57f2d3=>!_0x31baf5['includes'](_0x57f2d3));for(const _0x2397fd of _0x31baf5)_0x2397fd['createdAt']='lastOperationAcceptedAt'in _0x3dff06&&_0x3dff06['lastOperationAcceptedAt']||void 0x0;st(_0x31baf5,_0x3dff06['version']-_0x31baf5['length']),this['_updateServerHistory'](_0x31baf5);const _0x35ddc9=_0x31baf5['filter'](_0x2b652e=>{if(!_0x2b652e['_isInit'])return!0x1;const _0x40472d=this['_getAffectedRoot'](_0x2b652e);return _0x40472d&&!this['_knownRootNames']['has'](_0x40472d);});st(_0x35ddc9,this['_document']['version']),this['_applyOperationsSet'](_0x35ddc9),_0x1167e6=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0x1b57f7=this['_decompressOperations'](_0x3dff06['data'],_0x3dff06['metadata'])['filter'](_0x2732cd=>_0x2732cd['baseVersion']>=this['_lastServerVersion']);_0x1b57f7['forEach'](_0x6af32b=>this['_addKnownRoot'](_0x6af32b)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x1232ce=>!_0x1232ce['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x1232ce))),this['_bufferedOperations']['length']&&st(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0x1b57f7),_0x1167e6=this['_handleExternalOperations'](_0x1b57f7,_0x3dff06['version'],_0x3dff06['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x1167e6?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}_handleExternalOperations(_0x2af192,_0x3292e1,_0x1e3b6d){try{const _0x119f36={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x277758,operationsB:_0x2911a7,originalOperations:_0x25e70e}=_0x1b9d7f(_0x2af192,this['_bufferedOperations'],_0x119f36);st(_0x277758,this['_document']['version']),st(_0x2911a7,_0x3292e1);for(const _0xa44f29 of _0x277758){const _0x4944b7=_0x25e70e['get'](_0xa44f29);_0x4944b7?(_0xa44f29['_authorId']=_0x4944b7['_authorId'],'noop'!==_0xa44f29['type']&&(_0xa44f29['_aiSource']=_0x4944b7['_aiSource'])):_0xa44f29['_authorId']=null;}for(const _0x357d07 of _0x2911a7)'noop'!==_0x357d07['type']&&(_0x357d07['_aiSource']=_0x25e70e['get'](_0x357d07)?.['_aiSource']);_0x1e3b6d&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x2af192,_0x1e3b6d),this['_lastSyncedOperationId']=_0x1e3b6d),this['_bufferedOperations']=[..._0x2911a7],this['_applyOperationsSet'](_0x277758),this['_updateServerHistory'](_0x2af192);}catch(_0xc4e257){return console['error'](_0xc4e257),!0x1;}return!0x0;}_applyOperationsSet(_0x3975c5,_0x356e50=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0x1926c1=>{for(const _0x5ebbf0 of _0x3975c5)this['_knownOperations']['add'](_0x5ebbf0),this['_addKnownRoot'](_0x5ebbf0),_0x1926c1['batch']['addOperation'](_0x5ebbf0),this['editor']['model']['applyOperation'](_0x5ebbf0);});}_addKnownRoot(_0x5f278f){const _0x130666=this['_getAffectedRoot'](_0x5f278f);_0x130666&&this['_knownRootNames']['add'](_0x130666);}_getAffectedRoot(_0x3efadd){let _0x49309e,_0x5d7340;switch(_0x3efadd['type']){case'insert':_0x49309e=_0x3efadd['position']['root'];break;case'marker':if(_0x5d7340=_0x3efadd['newRange'],!_0x5d7340)return null;_0x49309e=_0x5d7340['root'];break;case'addRootAttribute':_0x49309e=_0x3efadd['root'];break;case'addRoot':_0x49309e=_0x3efadd['affectedSelectable'];break;case'move':_0x49309e=_0x3efadd['targetPosition']['root'];break;default:return null;}return _0x49309e['rootName'];}_updateServerHistory(_0x750aab){_0x750aab['forEach'](_0x4ea965=>{const _0x471250=_0x4ea965['clone']();_0x471250['_authorId']=_0x4ea965['_authorId'],_0x471250['_isInit']=!!_0x4ea965['_isInit'],_0x471250['_aiSource']=_0x4ea965['_aiSource'],_0x471250['createdAt']=_0x4ea965['createdAt'],_0x471250['baseVersion']+=this['_offset'],_0x4ea965['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x471250),this['serverHistory']['addOperation'](_0x471250);});}_handleReconnectionError(_0x1e8b99){const _0x5d1600=this['editor']['plugins']['get']('Notification'),_0x1d0681=this['editor']['locale'];_0x1e8b99||(_0x1e8b99=X(_0x1d0681,'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.')),_0x5d1600['showWarning'](_0x1e8b99,{'title':X(_0x1d0681,'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'](_0x462aee)['add'](X(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}_clearPendingAction(){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x462aee)['remove'](this['_pendingAction']),this['_pendingAction']=null);}_compressOperations(_0x188206){const _0x3500a7=_0x188206['map'](_0x48e1b4=>_0x48e1b4['toJSON']());return this['_compressor']['compress'](_0x3500a7);}_decompressOperations(_0x45dc54,_0x5714dd){return this['_compressor']['decompress'](_0x45dc54)['map']((_0x2a0b54,_0x2ae9ea)=>{const _0x2582db='init'==_0x5714dd[_0x2ae9ea]['type'];if('InsertOperation'==_0x2a0b54['__className']){const _0x56f2dd=_0x2a0b54['position']['root'];!this['_document']['getRoot'](_0x56f2dd)&&(this['_document']['createRoot']('$unknown',_0x56f2dd)['_isAttached']=!0x1);}else{if('RootOperation'==_0x2a0b54['__className']){const _0x12851b=this['_document']['getRoot'](_0x2a0b54['rootName']);_0x12851b&&'$unknown'==_0x12851b['name']&&_0x2a0b54['elementName']!=_0x12851b['name']&&(_0x12851b['name']=_0x2a0b54['elementName']);}}const _0x1684f5=_0x25c611['fromJSON'](_0x2a0b54,this['_document']);return _0x1684f5['wasUndone']=_0x2a0b54['wasUndone'],_0x1684f5['_isInit']=_0x2582db,_0x1684f5['_authorId']=_0x2582db?null:_0x5714dd[_0x2ae9ea]['userId'],_0x1684f5['_isDisconnection']='cs:removeUser'===_0x5714dd[_0x2ae9ea]['type'],_0x1684f5['_aiSource']=_0x2a0b54['_aiSource']||void 0x0,_0x1684f5['createdAt']=_0x5714dd[_0x2ae9ea]['createdAt'],_0x1684f5;});}_refreshUserSelectionMarkers(){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}_shouldSendSelectionUpdate(){const _0x1646cd=this['editor']['plugins']['get'](Y)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0x1646cd&&_0x1646cd['length']>0x1&&this['_hasSelectionChanged'];}_shouldSendUpdate(){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}},et=class extends Error{};function st(_0x181f77,_0x2759fd){for(const _0x26267f of _0x181f77)_0x26267f['baseVersion']=_0x2759fd++;}var it=class{_ignoredOperations;_operationToId;constructor(_0x26b926){this['_ignoredOperations']=_0x26b926,this['_operationToId']=new WeakMap();}getIdOfTheLastOperation(_0x1fc0c0){let _0x29cb2e=_0x1fc0c0['length'];for(;_0x29cb2e--;){const _0x160cab=_0x1fc0c0[_0x29cb2e];if(!this['_ignoredOperations']['has'](_0x160cab)){if(!this['_operationToId']['has'](_0x160cab)){const _0x1dcca9=_0x26b330()['slice'](0x1,0x12);this['_operationToId']['set'](_0x160cab,_0x1dcca9);}return this['_operationToId']['get'](_0x160cab);}}}setIdForTheLastOperation(_0x37fea8,_0x137f40){if(!_0x137f40)return;let _0x15972c=_0x37fea8['length'];for(;_0x15972c--;){const _0x4e8139=_0x37fea8[_0x15972c];this['_ignoredOperations']['has'](_0x4e8139)||this['_operationToId']['set'](_0x4e8139,_0x137f40);}}},nt=class extends _0x4dea7b{static get requires(){return[tt];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},ot=class CloudServicesCommentsAdapter extends _0x199983{static CommentsService=/* #__PURE__ -- @preserve */
26
+ ((()=>_0x8155c2)());['_services'];static get requires(){return[z,_0x5120b7,Y,_0xc75193];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x2c3f71){super(_0x2c3f71),this['_services']=new Map();}async init(){const _0x18a22a=this['context'],_0x4c71e6=_0x18a22a['plugins']['get'](_0x5120b7);if(_0x18a22a['plugins']['get'](z)['addToReconnectionStack'](this),_0x4c71e6['adapter']={'addCommentThread':async({channelId:_0x252f40,threadId:_0x2838a3,comments:_0x5de31f,resolvedAt:_0x1cc075,resolvedBy:_0x3aa7c2,context:_0x1739fe,attributes:_0x389bac})=>{const _0x380466=await this['_getService'](_0x252f40)['addCommentThread']({'commentThreadId':_0x2838a3,'comments':_0x5de31f['map'](_0x212fbc=>function(_0x2bad31,_0x2aabfd,_0x408466){return{'commentThreadId':_0x408466,'commentId':_0x2bad31['commentId'],'userId':_0x2bad31['authorId'],'content':_0x2bad31['content'],'documentId':_0x2aabfd,'createdAt':_0x2bad31['createdAt'],'attributes':_0x2bad31['attributes']||{}};}(_0x212fbc,_0x252f40,_0x2838a3)),'resolvedAt':_0x1cc075,'resolvedBy':_0x3aa7c2,'context':_0x1739fe,'attributes':_0x389bac})['catch'](ct);return{'threadId':_0x380466['commentThreadId'],'comments':_0x380466['comments']};},'getCommentThread':async({channelId:_0x437cf8,threadId:_0x2a9fe1})=>{const _0x280bd2=await this['_getService'](_0x437cf8)['getCommentThread'](_0x2a9fe1)['catch'](rt)['catch'](ct);return _0x280bd2?_0x280bd2['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0x280bd2]),{'threadId':_0x280bd2['commentThreadId'],'comments':_0x280bd2['comments']['map'](at),'context':_0x280bd2['context'],'resolvedAt':_0x280bd2['resolvedAt'],'resolvedBy':_0x280bd2['resolvedBy'],'attributes':_0x280bd2['attributes']||{}}):null;},'updateCommentThread':async({channelId:_0x30f6b3,threadId:_0x17f7db,context:_0x2ea4b5,unlinkedAt:_0x1adcbf,attributes:_0x45fbd2})=>this['_getService'](_0x30f6b3)['updateCommentThread']({'commentThreadId':_0x17f7db,'context':_0x2ea4b5,'attributes':_0x45fbd2,'unlinkedAt':_0x1adcbf})['catch'](rt)['catch'](ct),'resolveCommentThread':async({channelId:_0x37c532,threadId:_0x51e330})=>{const _0x310282=await this['_getService'](_0x37c532)['resolveCommentThread'](_0x51e330)['catch'](rt)['catch'](ct);return{'threadId':_0x310282['commentThreadId'],'resolvedAt':_0x310282['resolvedAt'],'resolvedBy':_0x310282['resolvedBy']};},'reopenCommentThread':async({channelId:_0x295cb4,threadId:_0x3d5bd6})=>this['_getService'](_0x295cb4)['reopenCommentThread'](_0x3d5bd6)['catch'](rt)['catch'](ct),'removeCommentThread':({channelId:_0x5b3904,threadId:_0x524709})=>this['_getService'](_0x5b3904)['removeCommentThread'](_0x524709)['catch'](rt)['catch'](ct),'addComment':({channelId:_0x1439cf,threadId:_0x475108,commentId:_0x5a36ab,content:_0x1eb9c8,attributes:_0x2ba247})=>this['_getService'](_0x1439cf)['addComment'](_0x475108,_0x5a36ab,_0x1eb9c8,_0x2ba247)['catch'](ct),'updateComment':({channelId:_0x5370e0,threadId:_0x572b05,commentId:_0x4f055d,content:_0xbb84e0,attributes:_0x36275e})=>this['_getService'](_0x5370e0)['updateComment'](_0x572b05,_0x4f055d,_0xbb84e0,_0x36275e)['catch'](rt)['catch'](ct),'removeComment':({channelId:_0x3f3cc5,threadId:_0x188639,commentId:_0xb62b0a})=>this['_getService'](_0x3f3cc5)['removeComment'](_0x188639,_0xb62b0a)['catch'](rt)['catch'](ct)},_0x18a22a instanceof _0x3b8224){const _0x351ad6=_0x18a22a['config']['get']('collaboration.channelId'),_0x3e19ee=_0x18a22a['plugins']['get'](Y);await this['_setUpService'](_0x351ad6);const _0x102b44=await this['_services']['get'](_0x351ad6)['getConnectedSessions']();this['listenTo'](_0x3e19ee,'sessionAdd:'+_0x351ad6,(_0x38279e,{session:_0x5d166a})=>{_0x5d166a['id']===_0x3e19ee['mySessionId']&&(_0x38279e['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x5d166a['permissions'],_0x351ad6));}),_0x3e19ee['register'](_0x351ad6,_0x102b44);}}async _setUpService(_0x47caa6){if(this['_services']['has'](_0x47caa6))throw new _0x4221a8('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0x47caa6});const _0x3b9486=this['context']['plugins']['get'](_0x5120b7),_0x1329d5=new CloudServicesCommentsAdapter['CommentsService'](_0x47caa6);this['_services']['set'](_0x47caa6,_0x1329d5),this['listenTo'](_0x1329d5,'commentThreadAdded',(_0x245574,_0x3c2d8b)=>{const {commentThreadId:_0xdff74f,documentId:_0x3a9c42,context:_0x47190b,attributes:_0x332b32,resolvedAt:_0x4af224,resolvedBy:_0x14c1d2,comments:_0x33a8b1}=_0x3c2d8b;_0x3b9486['getCommentThread'](_0xdff74f)||_0x3b9486['addCommentThread']({'threadId':_0xdff74f,'channelId':_0x3a9c42,'comments':_0x33a8b1?_0x33a8b1['map'](at):[],'context':_0x47190b,'attributes':_0x332b32,'resolvedAt':_0x4af224,'resolvedBy':_0x14c1d2,'isFromAdapter':!0x0});}),this['listenTo'](_0x1329d5,'commentThreadUpdated',(_0x413acf,{commentThreadId:_0x54a314,documentId:_0x2d5918,context:_0x3218b4,unlinkedAt:_0x134d02,attributes:_0x1b717c})=>{_0x3b9486['getCommentThread'](_0x54a314)&&_0x3b9486['updateCommentThread']({'threadId':_0x54a314,'channelId':_0x2d5918,'context':_0x3218b4,'unlinkedAt':_0x134d02,'attributes':_0x1b717c,'isFromAdapter':!0x0});}),this['listenTo'](_0x1329d5,'commentThreadResolved',(_0x4846b3,{commentThreadId:_0x265c2b,resolvedBy:_0x5a0220,resolvedAt:_0x5e5313})=>{const _0x2aba07=_0x3b9486['getCommentThread'](_0x265c2b);_0x2aba07&&_0x2aba07['resolve']({'resolvedBy':_0x5a0220,'resolvedAt':_0x5e5313,'isFromAdapter':!0x0});}),this['listenTo'](_0x1329d5,'commentThreadReopened',(_0x175bd5,{commentThreadId:_0x4ae202})=>{const _0x4deb28=_0x3b9486['getCommentThread'](_0x4ae202);_0x4deb28&&_0x4deb28['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0x1329d5,'commentThreadRemoved',(_0x58cd69,{commentThreadId:_0x4b31cf})=>{const _0x28e36b=_0x3b9486['getCommentThread'](_0x4b31cf);_0x28e36b&&_0x28e36b['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0x1329d5,'commentAdded',(_0x7141dc,_0xdf64c5)=>{const _0x83b42=_0xdf64c5['commentThreadId'],_0x1ed3fc=_0x3b9486['getCommentThread'](_0x83b42);_0x1ed3fc&&_0x1ed3fc['addComment']({...at(_0xdf64c5),'isFromAdapter':!0x0});}),this['listenTo'](_0x1329d5,'commentUpdated',(_0x327c3b,{commentThreadId:_0x2a852f,commentId:_0x15f730,content:_0x2c2e6a,attributes:_0x50baa1})=>{const _0x4f76d5=_0x3b9486['getCommentThread'](_0x2a852f);if(_0x4f76d5){const _0x457a2f=_0x4f76d5['getComment'](_0x15f730);_0x457a2f&&_0x457a2f['update']({'content':_0x2c2e6a,'attributes':_0x50baa1,'isFromAdapter':!0x0});}}),this['listenTo'](_0x1329d5,'commentRemoved',(_0x2fa895,{commentThreadId:_0x18c8e8,commentId:_0xb25b8d})=>{const _0x4ae079=_0x3b9486['getCommentThread'](_0x18c8e8);if(_0x4ae079){const _0x3c9879=_0x4ae079['getComment'](_0xb25b8d);_0x3c9879&&_0x3c9879['remove']({'isFromAdapter':!0x0});}}),this['listenTo'](_0x1329d5,'disconnected',()=>{'connected'===this['context']['plugins']['get'](z)['connection']?.['state']&&(this['_services']['delete'](_0x47caa6),this['stopListening'](_0x1329d5));}),await this['_connectService'](_0x47caa6);}destroy(){if(this['context']instanceof _0x3b8224){const _0x3d0780=this['context']['config']['get']('collaboration.channelId');this['_services']['has'](_0x3d0780)&&this['_terminateService'](_0x3d0780);}}_terminateService(_0x5c97c8){if(!this['_services']['has'](_0x5c97c8))throw new _0x4221a8('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0x5c97c8});this['_getService'](_0x5c97c8)['disconnect'](),this['_services']['delete'](_0x5c97c8);}async reconnect(){for(const _0x34a235 of this['_services']['keys']())await this['_connectService'](_0x34a235);if(this['context']instanceof _0x3b8224){const _0xae420=this['context']['config']['get']('collaboration.channelId');if(this['_services']['has'](_0xae420)){const _0x49daa=this['context']['plugins']['get'](Y);_0x49daa['unregister'](_0xae420);const _0x302b9b=await this['_services']['get'](_0xae420)['getConnectedSessions']();_0x49daa['register'](_0xae420,_0x302b9b);}}}async _connectService(_0x13cf05){const {connection:_0x5302ad}=this['context']['plugins']['get'](z),_0x54cc5f=this['context']['plugins']['get'](_0x5120b7),_0x539b3d=await this['_services']['get'](_0x13cf05)['connect'](_0x5302ad);await this['_fetchMissingUsersForThreads'](_0x539b3d);const _0x52bffe=new Set(Array['from'](_0x54cc5f['getCommentThreads']({'channelId':_0x13cf05}),_0x1b90f6=>_0x1b90f6['id']));for(const _0x4e7358 of _0x539b3d)_0x4e7358['deletedAt']||_0x52bffe['delete'](_0x4e7358['commentThreadId']);for(const _0x1e3e9c of _0x52bffe)_0x54cc5f['getCommentThread'](_0x1e3e9c)['remove']({'isFromAdapter':!0x0});for(const _0x274f10 of _0x539b3d){let _0x27e6aa=_0x54cc5f['getCommentThread'](_0x274f10['commentThreadId']);const {commentThreadId:_0xfdadb7,context:_0x1918a8,attributes:_0x225f0b,resolvedBy:_0x586ec6,resolvedAt:_0x41f6f4,unlinkedAt:_0x371f64,deletedAt:_0x40f668}=_0x274f10;if(_0x40f668)continue;_0x27e6aa||(_0x27e6aa=_0x54cc5f['addCommentThread']({'channelId':_0x13cf05,'threadId':_0xfdadb7,'context':_0x1918a8,'attributes':_0x225f0b||{},'resolvedBy':_0x586ec6,'resolvedAt':_0x41f6f4,'unlinkedAt':_0x371f64,'isFromAdapter':!0x0}));const _0x20a57c=new Set(Array['from'](_0x27e6aa['comments'],_0x25b161=>_0x25b161['id']));for(const _0x10ea0f of _0x274f10['comments'])_0x20a57c['delete'](_0x10ea0f['commentId']);for(const _0x906341 of _0x20a57c)_0x27e6aa['getComment'](_0x906341)['remove']({'isFromAdapter':!0x0});for(const _0x3e44d2 of _0x274f10['comments']){const _0x1ca918=_0x27e6aa['getComment'](_0x3e44d2['commentId']);_0x1ca918?_0x1ca918['content']!==_0x3e44d2['content']&&_0x1ca918['update']({'content':_0x3e44d2['content'],'isFromAdapter':!0x0}):_0x27e6aa['addComment'](Object['assign'](at(_0x3e44d2),{'isFromAdapter':!0x0}));}}}_getService(_0x34fa0a){if(!this['_services']['has'](_0x34fa0a))throw new _0x4221a8('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0x34fa0a});return this['_services']['get'](_0x34fa0a);}async _fetchMissingUsersForThreads(_0x3e1f8f){const _0xae1aa0=this['context']['plugins']['get'](_0xc75193),{connection:_0x23d120}=this['context']['plugins']['get'](z),_0x589c5a=new Set();for(const {resolvedBy:_0x170ca8,comments:_0x3be095}of _0x3e1f8f){_0x170ca8&&!_0xae1aa0['getUser'](_0x170ca8)&&_0x589c5a['add'](_0x170ca8);for(const {userId:_0x29fb0e}of _0x3be095)_0xae1aa0['getUser'](_0x29fb0e)||_0x589c5a['add'](_0x29fb0e);}if(0x0===_0x589c5a['size'])return;const _0x365901=await _0x5918aa['getMany'](_0x23d120,Array['from'](_0x589c5a));for(const _0x488cc5 of _0x365901)_0xae1aa0['getUser'](_0x488cc5['id'])||_0xae1aa0['addUser'](_0x488cc5);}};async function rt(_0x448108){if('404'!==_0x448108['code'])throw _0x448108;}function ct(_0x24ca7d){if((_0x4b91f6=_0x24ca7d)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0x4b91f6['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x4b91f6['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0x4b91f6;throw _0x24ca7d;}function at(_0x1327df){return{'threadId':_0x1327df['commentThreadId'],'commentId':_0x1327df['commentId'],'content':_0x1327df['content'],'createdAt':_0x1327df['createdAt'],'authorId':_0x1327df['userId'],'attributes':_0x1327df['attributes']||{}};}var ht=class CloudServicesTrackChangesAdapter extends _0x4dea7b{static ['TrackChangesService']=/* #__PURE__ -- @preserve */
27
+ ((()=>_0x462a45)());_bufferedRequests;_trackChangesService;static get requires(){return[ot,_0x559281,z];}static get['pluginName'](){return'CloudServicesTrackChangesAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x377cb7){super(_0x377cb7);const _0x336e8a=this['editor']['config']['get']('collaboration.channelId');this['_bufferedRequests']=new Map(),this['_trackChangesService']=new CloudServicesTrackChangesAdapter['TrackChangesService'](_0x336e8a);}init(){const _0x223f0c=this['editor']['plugins']['get'](z),_0x240177=this['editor']['plugins']['get'](_0x559281);return _0x240177['adapter']={'getSuggestion':async _0x59f38a=>{await this['_waitForServiceReady']();const _0x33bc3c=await this['_trackChangesService']['get'](_0x59f38a)['catch'](lt);return await this['_fetchMissingUsersForThreads']([_0x33bc3c]),_0x33bc3c;},'addSuggestion':async({id:_0x1f9445,type:_0x13067e,data:_0x1ce53b,originalSuggestionId:_0xdca724,attributes:_0x1a39ad})=>{await this['_waitForServiceReady']();const _0x510303={'id':_0x1f9445,'type':_0x13067e,'data':_0x1ce53b,'originalSuggestionId':_0xdca724,'attributes':_0x1a39ad},_0x2f0ff5=await this['_trackChangesService']['add'](_0x1f9445,_0x13067e,_0x1ce53b,_0xdca724,_0x1a39ad)['catch'](_0x58dfa6=>{if(dt(_0x58dfa6))return new Promise(_0x1aba3c=>{this['_bufferedRequests']['set'](_0x1f9445,{'resolve':_0x1aba3c,'suggestionData':_0x510303});});throw _0x58dfa6;});return this['_bufferedRequests']['delete'](_0x1f9445),_0x2f0ff5;},'updateSuggestion':async(_0x397e6f,_0x77a354)=>{if(await this['_waitForServiceReady'](),'open'!==_0x77a354['state'])return this['_trackChangesService']['update'](_0x397e6f,_0x77a354)['catch'](lt);}},this['listenTo'](this['_trackChangesService'],'suggestionUpdated',(_0x19bfba,_0x561732)=>{_0x240177['hasSuggestion'](_0x561732['id'])&&(_0x240177['getSuggestion'](_0x561732['id'])['attributes']=_0x561732['attributes']);}),this['listenTo'](this['_trackChangesService'],'disconnected',()=>{'connected'===_0x223f0c['connection']?.['state']&&(_0x223f0c['removeFromReconnectionStack'](this),this['stopListening'](this['_trackChangesService']));}),this['_trackChangesService']['connect'](_0x223f0c['connection'])['then'](_0x934d5a=>(_0x223f0c['addToReconnectionStack'](this),this['_fetchMissingUsersForThreads'](_0x934d5a)['then'](()=>{for(const _0x3cd712 of _0x934d5a){_0x240177['addSuggestionData'](_0x3cd712)['_saved']=!0x0;}})));}async reconnect(){const _0x3900cf=this['editor']['plugins']['get']('TrackChangesEditing'),{connection:_0x51a6db}=this['editor']['plugins']['get'](z),_0x44daf7=await this['_trackChangesService']['connect'](_0x51a6db);await this['_fetchMissingUsersForThreads'](_0x44daf7);for(const {suggestionData:_0x449d43,resolve:_0x5c5c7c}of this['_bufferedRequests']['values']()){let _0x263ccf=_0x44daf7['find'](_0x18b21c=>_0x18b21c['id']===_0x449d43['id']);_0x263ccf||(_0x263ccf=await this['_trackChangesService']['add'](_0x449d43['id'],_0x449d43['type'],_0x449d43['data'],_0x449d43['originalSuggestionId'])),_0x5c5c7c(_0x263ccf);}for(const _0x39b242 of _0x44daf7)_0x3900cf['hasSuggestion'](_0x39b242['id'])||_0x3900cf['addSuggestionData'](_0x39b242);}async _waitForServiceReady(){this['_trackChangesService']['isConnected']||await new Promise(_0x44ff21=>{this['listenTo'](this['_trackChangesService'],'connected',_0x302534=>{_0x302534['off'](),_0x44ff21();});});}async _fetchMissingUsersForThreads(_0x69ae7d){const _0x4e89e4=this['editor']['plugins']['get'](_0xc75193),{connection:_0x42ce7b}=this['editor']['plugins']['get'](z),_0x599eb6=new Set();for(const {authorId:_0x4ca1f1}of _0x69ae7d)_0x4e89e4['getUser'](_0x4ca1f1)||_0x599eb6['add'](_0x4ca1f1);if(0x0===_0x599eb6['size'])return;const _0x312dce=await _0x5918aa['getMany'](_0x42ce7b,Array['from'](_0x599eb6));for(const _0x16e156 of _0x312dce)_0x4e89e4['getUser'](_0x16e156['id'])||_0x4e89e4['addUser'](_0x16e156);}};function lt(_0x45f1d){if(dt(_0x45f1d))return new Promise(()=>{});throw _0x45f1d;}function dt(_0x1b502d){return _0x1b502d['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x1b502d['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}var ut=class extends _0x4dea7b{static get requires(){return[_0xb0d326,ot,nt,z];}static get['pluginName'](){return'RealTimeCollaborativeComments';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const _0x583ec2=this['editor']['plugins']['get'](z),_0x1726c9=this['editor']['plugins']['get'](_0x7afca3),_0xa9e184=this['editor']['plugins']['get'](ot);return this['editor']['data']['once']('ready',()=>{this['listenTo'](_0x583ec2,'change:state',(_0x42e50d,_0x4b8a31,_0x313722)=>{_0x1726c9['isThreadsLoadingPaused']='connected'!==_0x313722;});}),this['listenTo'](_0x583ec2,'change:state',(_0x29ad25,_0x169ae4,_0xc85f2d)=>{this['editor']['plugins']['get'](_0x5120b7)['switchReadOnly']('connected'!==_0xc85f2d);}),_0xa9e184['_setUpService'](this['editor']['config']['get']('collaboration.channelId'));}destroy(){const _0x1d6562=this['editor']['plugins']['get'](ot),_0x5469fa=this['editor']['config']['get']('collaboration.channelId');_0x1d6562['_services']['has'](_0x5469fa)&&_0x1d6562['_terminateService'](_0x5469fa),super['destroy']();}},ft=class extends _0x4dea7b{static get requires(){return[ut,ht,_0x19ed4c];}static get['pluginName'](){return'RealTimeCollaborativeTrackChanges';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},mt=class CloudServicesRevisionHistoryAdapter extends _0x4dea7b{static RevisionHistoryService=/* #__PURE__ -- @preserve */
28
+ ((()=>_0x11ab20)());_lastRequestId;['_revisionTracker'];_revisionHistoryService;_oldOffset;static get requires(){return[z,tt,_0x423746,Y,_0xc75193];}static get['pluginName'](){return'CloudServicesRevisionHistoryAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x300e7b){super(_0x300e7b);const _0x5f49b8=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new CloudServicesRevisionHistoryAdapter['RevisionHistoryService'](_0x5f49b8);}async init(){const _0x5c6b06=this['editor']['plugins']['get'](tt),_0x1c126d=_0x5c6b06['serverHistory'],_0x155b9d=this['editor']['plugins']['get'](z);this['_revisionTracker']['setSource']({'history':_0x1c126d,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0x5c6b06['sessionId']});const _0x230822=this['editor']['config']['get']('cloudServices.bundleVersion')||_0x5f039b,_0x221459=await _0x132713['isBundleUploaded'](_0x155b9d['connection'],_0x230822);this['editor']['plugins']['get'](_0x423746)['adapter']={'getRevision':async({revisionId:_0x234017})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0x234017)),'updateRevisions':async _0x1f08d0=>{await this['_waitForServiceReady']();const _0x101e56=this['_revisionTracker']['currentRevision'];if(_0x221459&&0x1===_0x1f08d0['length']&&_0x1f08d0[0x0]['id']===_0x101e56['id'])return _0x1f08d0;for(const _0x387f7b of _0x1f08d0)_0x387f7b['id']===_0x101e56['id']&&(_0x387f7b['isEmptyCurrent']=_0x387f7b['fromVersion']===_0x387f7b['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0x1f08d0,this['_lastRequestId'])['then'](_0x38ed08=>(this['_lastRequestId']=_0x38ed08,_0x1f08d0))['catch'](_0x3a64c7=>{if(pt(_0x3a64c7)||'400'===_0x3a64c7['code']&&void 0x0!==_0x3a64c7['data']['wrongRequestId']){for(const _0x37b59c of _0x1f08d0)this['_revisionTracker']['repository']['getRevision'](_0x37b59c['id'])&&this['_revisionTracker']['_bufferUpdate'](_0x37b59c['id'],_0x37b59c,!0x1);if(pt(_0x3a64c7)&&'destroyed'!==this['editor']['state'])throw _0x3a64c7;return _0x1f08d0;}throw _0x3a64c7;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0xbbe71b,{revisionsData:_0x39d34f,requestId:_0x242d36})=>{Math['max'](..._0x39d34f['map'](_0x2b6a7b=>_0x2b6a7b['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0x39d34f,_0x242d36);}):this['_handleRevisionsUpdate'](_0x39d34f,_0x242d36);}),this['set']('_isServiceConnected',!0x1),this['listenTo'](this['_revisionHistoryService'],'connected',()=>{this['_isServiceConnected']=!0x0;}),this['listenTo'](this['_revisionHistoryService'],'disconnected',()=>{this['_isServiceConnected']=!0x1,'connected'===_0x155b9d['connection']?.['state']&&(_0x155b9d['removeFromReconnectionStack'](this),this['stopListening'](this['_revisionHistoryService']));});const {revisions:_0x5abada,requestId:_0x32dfa8}=await this['_revisionHistoryService']['connect'](_0x155b9d['connection']);_0x155b9d['addToReconnectionStack'](this),this['_lastRequestId']=_0x32dfa8,await this['_fetchMissingUsers'](_0x5abada);for(const _0x4ab92d of _0x5abada)this['_revisionTracker']['addRevisionData'](_0x4ab92d);this['listenTo'](_0x5c6b06,'change:_isConnected',(_0x42a9e3,_0x258179,_0x30e2f2)=>{_0x30e2f2&&(this['_oldOffset']=_0x5c6b06['_offset'],_0x42a9e3['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](this,'_isServiceConnected');}async reconnect(){const _0x5effb1=this['editor']['plugins']['get'](z),_0x548ed7=this['editor']['plugins']['get'](tt),_0x3420b2=async()=>{const _0x3552b0=this['_revisionTracker']['currentRevision'],_0x1a2038=_0x3552b0['id'],_0x1e1831=_0x1a2038!==_0x548ed7['sessionId'];if(_0x1e1831){const _0x353305=_0x548ed7['_offset']-this['_oldOffset'],_0x4f47e7=this['_getLatestVersionFromServerOperations']();if(this['_revisionTracker']['_revisionDataBuilder']['reInit'](),_0x3552b0['toVersion']+_0x353305!==_0x4f47e7){const _0x58cce9=_0x3552b0['fromVersion']+_0x353305,_0x2ced82=this['editor']['plugins']['get'](_0xc75193),_0x2dca5b=this['_revisionTracker']['buildRevisionData']({'revision':_0x3552b0,'from':_0x58cce9,'to':_0x4f47e7});_0x2dca5b['id']=_0x3552b0['id'];const _0x515e4c=_0x2dca5b['authorsIds']['map'](_0x382beb=>_0x2ced82['getUser'](_0x382beb));_0x3552b0['_update']({..._0x2dca5b,'authors':_0x515e4c},!0x0),this['_revisionTracker']['_bufferUpdate'](_0x3552b0['id'],_0x2dca5b,!0x0);}this['_revisionTracker']['_startingVersion']=_0x4f47e7,_0x3552b0['toVersion']!==_0x3552b0['fromVersion']||this['_revisionTracker']['_bufferedUpdates']['has'](_0x1a2038)||this['_revisionTracker']['repository']['_revisions']['remove'](_0x1a2038),this['_revisionTracker']['_createCurrentRevision'](_0x4f47e7);}const {revisions:_0x5d3fa1,requestId:_0x2b6698}=await this['_revisionHistoryService']['reconnect'](_0x5effb1['connection'],this['_lastRequestId']);_0x1e1831&&_0x5d3fa1['length']>0x0?_0x548ed7['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x5d3fa1),this['_handleRevisionsUpdate'](_0x5d3fa1,_0x2b6698),this['_revisionTracker']['sendBufferedUpdates']());};return _0x548ed7['_isConnected']?_0x3420b2():new Promise((_0x4ffd5a,_0x24f30a)=>{_0x548ed7['once']('change:_isConnected',()=>{_0x3420b2()['then'](_0x4ffd5a)['catch'](_0x24f30a);});});}destroy(){super['destroy']();}async _waitForServiceReady(){this['_revisionHistoryService']['isConnected']||await new Promise(_0x4f0ee8=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x3066d5=>{_0x3066d5['off'](),_0x4f0ee8();});});}_getLatestVersionFromServerOperations(){const _0xd1c994=this['editor']['plugins']['get'](tt)['serverHistory']['getOperations']()['reverse']();for(const _0xac796f of _0xd1c994)if('marker'!==_0xac796f['type']||_0xac796f['affectsData'])return _0xac796f['baseVersion']+0x1;}_getLatestVersion(){const _0x7ea920=this['editor']['plugins']['get'](tt);return new Promise(_0x4471c7=>{_0x7ea920['_isPendingUpdate']?_0x7ea920['once']('change:_isPendingUpdate',()=>{_0x4471c7(this['_getLatestVersionFromServerOperations']());}):_0x4471c7(this['_getLatestVersionFromServerOperations']());});}_handleRevisionsUpdate(_0x4eb039,_0x3106ca){const _0x2c9e19=this['_revisionTracker']['repository'];this['_lastRequestId']=_0x3106ca;for(const _0x43c62f of _0x4eb039){const _0x56f42e=_0x2c9e19['getRevision'](_0x43c62f['id']);if(_0x56f42e){if((_0x43c62f['fromVersion']||_0x43c62f['toVersion'])&&(_0x43c62f['diffData']=null),_0x56f42e===this['_revisionTracker']['currentRevision']){const _0x5861d6=Math['max'](_0x56f42e['toVersion'],_0x43c62f['toVersion']),_0x381b2f=Math['max'](_0x56f42e['fromVersion'],_0x43c62f['fromVersion']);let _0x2a4bc3;_0x56f42e['toVersion']===_0x43c62f['toVersion']&&_0x56f42e['fromVersion']===_0x43c62f['fromVersion']?(_0x2a4bc3=!0x0,this['_preventResendingRevisionData'](_0x43c62f)):_0x43c62f['toVersion']===_0x5861d6&&_0x43c62f['fromVersion']===_0x381b2f?_0x2a4bc3=!0x1:(_0x56f42e['toVersion']===_0x5861d6&&_0x56f42e['fromVersion']===_0x381b2f||this['_fixRevision']({'revision':_0x56f42e,'from':_0x381b2f,'to':_0x5861d6}),_0x2a4bc3=!0x0),_0x2a4bc3&&(delete _0x43c62f['fromVersion'],delete _0x43c62f['toVersion'],delete _0x43c62f['diffData'],delete _0x43c62f['createdAt'],delete _0x43c62f['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0x43c62f),this['_preventResendingRevisionData'](_0x43c62f);}else this['_revisionTracker']['addRevisionData'](_0x43c62f);}const _0x1ccb49=_0x2c9e19['getRevisions']();_0x1ccb49['reverse']();for(let _0x246bef=0x0;_0x246bef<_0x1ccb49['length']-0x1;_0x246bef++){const _0x42c929=_0x1ccb49[_0x246bef],_0x189dcf=_0x1ccb49[_0x246bef+0x1];if(_0x42c929['fromVersion']<_0x189dcf['toVersion']){const _0x2ee1ba=_0x189dcf['toVersion'],_0x4d801b=Math['max'](_0x2ee1ba,_0x42c929['toVersion']);this['_fixRevision']({'revision':_0x42c929,'from':_0x2ee1ba,'to':_0x4d801b});}}}['_fixRevision']({revision:_0x592b30,from:_0x529e3c,to:_0x46dbad}={}){const _0x389e2f=this['editor']['plugins']['get'](_0xc75193),_0x5345ec=this['_revisionTracker']['buildRevisionData']({'revision':_0x592b30,'from':_0x529e3c,'to':_0x46dbad});_0x5345ec['authors']=_0x5345ec['authorsIds']['map'](_0x196b59=>_0x389e2f['getUser'](_0x196b59)),_0x592b30['_update'](_0x5345ec);}_preventResendingRevisionData(_0x37defb){const _0x503522={};_0x503522['id']=_0x37defb['id'];for(const _0x240b17 of Object['keys'](_0x37defb))'id'!==_0x240b17&&(_0x503522[_0x240b17]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0x503522['id'],_0x503522,!0x0);}async _fetchMissingUsers(_0x244154){const _0x29bce7=this['editor']['plugins']['get'](_0xc75193),{connection:_0x2cdec7}=this['editor']['plugins']['get'](z),_0x2b2289=new Set();for(const _0xc99503 of _0x244154){for(const _0x580bb6 of _0xc99503['authorsIds'])_0x27bae2(_0x580bb6);_0xc99503['creatorId']&&_0x27bae2(_0xc99503['creatorId']);}if(0x0===_0x2b2289['size'])return;const _0x58f803=await _0x5918aa['getMany'](_0x2cdec7,Array['from'](_0x2b2289));for(const _0x567293 of _0x58f803)_0x29bce7['getUser'](_0x567293['id'])||_0x29bce7['addUser'](_0x567293);function _0x27bae2(_0x3b756e){_0x29bce7['getUser'](_0x3b756e)||_0x2b2289['add'](_0x3b756e);}}};function pt(_0x3004f1){return _0x3004f1['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0x3004f1['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x3004f1['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}var gt=class extends _0x4dea7b{static get requires(){return[_0x423746,mt,nt];}static get['pluginName'](){return'RealTimeCollaborativeRevisionHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},wt=class extends _0x19ada5{_collapseAt;constructor(_0x4d9b4d,_0x340e99=0x6){super(_0x4d9b4d);const _0xd2cbea=this['bindTemplate'];this['set']('isHidden',!0x0),this['set']('usersCount',0x0),this['_collapseAt']=_0x340e99,this['bind']('isHidden')['to'](this,'usersCount',_0x579d81=>_0x579d81<_0x340e99),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item',_0xd2cbea['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':_0xd2cbea['to']('usersCount',_0x2e4ab8=>'+'+(_0x2e4ab8-this['_collapseAt']+0x2)['toString']())}]}]}]});}},vt=class extends _0x19ada5{items;keystrokes;constructor(_0x49d3fc){super(_0x49d3fc);const _0x555c8d=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0x1d53f5(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0x555c8d['if']('hasPopup'),'aria-expanded':_0x555c8d['to']('isExpanded',_0x2f9d25=>this['hasPopup']&&String(_0x2f9d25)),'aria-label':_0x555c8d['to']('hasPopup',_0x1888fc=>X(_0x49d3fc,_0x1888fc?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0x555c8d['to']('hasPopup',_0xac6d10=>!!_0xac6d10&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items'],'on':{'mouseenter':_0x555c8d['to'](()=>this['fire']('presencelist:show')),'mouseleave':_0x555c8d['to'](_0x5700e7=>{const _0x3d866a=_0x5700e7,_0x505c92=document['querySelector']('.ck-presence-list__dropdown-list'),_0x3e5f54=document['querySelector']('.ck-balloon-panel_with-arrow');_0x505c92?.['contains'](_0x3d866a['relatedTarget'])||_0x3e5f54?.['contains'](_0x3d866a['relatedTarget'])||this['fire']('presencelist:hide');})}}),this['on']('change:hasPopup',(_0x4d63e2,_0x496738,_0x377406)=>{this['element']&&(_0x377406?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 _0x19ada5{counterView;inlineListView;constructor(_0x4a6aa8,_0x5b9c0e=0x6){super(_0x4a6aa8);const _0x8f3cb=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new wt(this['locale'],_0x5b9c0e),this['inlineListView']=new vt(_0x4a6aa8),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x4a249d of this['inlineListView']['items'])_0x4a249d['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',_0x8f3cb['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['inlineListView']]});}},yt=class extends _0x19ada5{listWrapperView;constructor(_0x3d9026,_0xb80b5d){super(_0x3d9026);const _0x17c8ad=this['bindTemplate'];this['listWrapperView']=new bt(_0x3d9026,_0xb80b5d),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':X(_0x3d9026,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']],'on':{'mouseleave':_0x17c8ad['to'](_0x354415=>{const _0x2741f1=_0x354415,_0x61b69=document['querySelector']('.ck-presence-list__list'),_0x24ecea=document['querySelector']('.ck-balloon-panel_with-arrow');_0x61b69?.['contains'](_0x2741f1['relatedTarget'])||_0x24ecea?.['contains'](_0x2741f1['relatedTarget'])||this['fire']('presencelist:hide');})}});}},bt=class extends _0x2426d0{constructor(_0x15ccea,_0x392aa4){super(_0x15ccea);const _0x3e901f=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0x392aa4?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0x3e901f['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0x3e901f['to']('role'),'aria-label':_0x3e901f['to']('ariaLabel'),'aria-labelledby':_0x3e901f['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0x4e5766['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0x204f03=this['element'];_0x204f03&&(this['_isScrollable']=Math['max'](_0x204f03['scrollHeight'],_0x204f03['clientHeight'])>0.8*window['innerHeight']);}},kt=class extends _0x3d822f{['userView'];constructor(_0x31cd39,_0x5f35c4,_0x2e6689){super(_0x31cd39);const _0x55b50e=this['bindTemplate'];this['userView']=new _0x398431(_0x31cd39,_0x5f35c4);const _0x191d6b={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0x5f35c4['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0x5f35c4['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x5f35c4['color']['getBackgroundColorClass']()],'style':{'--ck-user-color':_0x5f35c4['color']['getColorVariable'](),'--ck-user-color-alpha':_0x5f35c4['color']['getColorAlphaVariable']()},'aria-hidden':'true'}}]};_0x2e6689&&(_0x191d6b['tag']='button',_0x191d6b['on']={'click':_0x55b50e['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x191d6b);}['focus'](){this['element']['focus']();}},It=class extends _0x19ada5{['userView'];['markerView'];constructor(_0x2c9626,_0x5e722f,_0xcc82b1){super(_0x2c9626);const _0x179e88=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new _0x398431(_0x2c9626,_0x5e722f),this['markerView']=new St(_0x2c9626,_0x5e722f);const _0x499552=new _0x3f0acc(_0x2c9626);_0x499552['template']['tag']='span',_0x499552['text']=_0x5e722f['name'];const _0x190864={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0x179e88['to']('isFocusable',_0x47cb2b=>!!_0x47cb2b&&0x0),'aria-labelledby':_0x499552['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0x179e88['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0x179e88['to']('hasTooltip',_0x4af26e=>!_0x4af26e),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0x499552]};_0xcc82b1&&(_0x190864['tag']='button',_0x190864['on']={'click':_0x179e88['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x190864);}},St=class extends _0x19ada5{constructor(_0x1d9983,_0x10577e){super(_0x1d9983),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x10577e['color']['getBackgroundColorClass']()],'style':{'--ck-user-color':_0x10577e['color']['getColorVariable'](),'--ck-user-color-alpha':_0x10577e['color']['getColorAlphaVariable']()},'aria-hidden':'true'}});}};const Tt={'collapseAt':0x6,'displayMe':!0x0};var Ct=class extends _0x199983{currentDisplayedUsers;['balloonPanelView'];['view'];['presenceDropdownView'];_bodyCollection=null;static get['pluginName'](){return'PresenceListUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x3573c9){super(_0x3573c9),this['context']['config']['define']('presenceList',Tt);const _0x36e58e=_0x3573c9['config']['get']('presenceList.collapseAt');if('number'!=typeof _0x36e58e)throw new _0x4221a8('presencelist-collapseat-invalid-format',this);if(_0x36e58e<0x1)throw new _0x4221a8('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](Y)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0xbc07ad(),this['balloonPanelView']=new _0x23dff2(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get requires(){return[Y];}init(){for(const _0x2fbbe9 of this['_allConnectedUsers'])this['_handleUserAdd'](_0x2fbbe9);this['listenTo'](this['_allConnectedUsers'],'add',(_0x59de80,_0x5e7e10)=>{this['_handleUserAdd'](_0x5e7e10);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0xa82910,_0x3fd20c)=>{this['_handleUserRemove'](_0x3fd20c);});}_createView(){const _0x355d6f=this['context'],_0x2e0f21=new _t(this['context']['locale'],this['context']['config']['get']('presenceList.collapseAt')),_0x40acda=this['balloonPanelView'];if(!_0x139989(_0x355d6f['config']['get']('presenceList.container')))throw new _0x4221a8('presencelist-missing-container',this);return _0x2e0f21['counterView']['bind']('usersCount')['to'](this),_0x2e0f21['bind']('isCollapsed')['to'](this,'usersCount',_0x501c56=>{const {collapseAt:_0x4917cd}=_0x355d6f['config']['get']('presenceList'),_0x2c8333=_0x501c56>=_0x4917cd;if(_0x2c8333&&!_0x2e0f21['inlineListView']['items']['find'](_0x41bee6=>_0x41bee6 instanceof wt)){const _0x110192=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['currentDisplayedUsers']['length']==_0x110192&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](this['currentDisplayedUsers']['length']-0x1),_0x2e0f21['inlineListView']['items']['add'](_0x2e0f21['counterView']);}return _0x2c8333||this['hideDropdown'](),_0x2c8333;}),_0x2e0f21['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0x46618e=>{const _0x590dd5=_0x355d6f['config']['get']('presenceList'),_0xc69366=new It(_0x355d6f['locale'],_0x46618e,!!_0x590dd5['onClick']);return _0xc69366['bind']('hasTooltip')['to'](_0x2e0f21,'isCollapsed',_0x1a2e5b=>!_0x1a2e5b),_0xc69366['bind']('isFocusable')['to'](_0x2e0f21,'isCollapsed',_0x403420=>!_0x403420),_0x590dd5['onClick']&&this['listenTo'](_0xc69366,'execute',()=>{this['view']['isCollapsed']||_0x590dd5['onClick'](_0x46618e,_0xc69366['element']);}),_0xc69366;}),this['listenTo'](_0x2e0f21['inlineListView'],'presencelist:show',()=>{this['view']['isCollapsed']&&this['showDropdown']();}),this['listenTo'](_0x2e0f21['inlineListView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();}),_0x2e0f21['inlineListView']['keystrokes']['set']('Enter',(_0x39764f,_0x121bfb)=>{this['view']['isCollapsed']&&(this['showDropdown'](),_0x121bfb());}),_0x2e0f21['render'](),_0x40acda['render'](),_0x1ce9fc({'emitter':_0x2e0f21,'activator':()=>_0x40acda['isVisible'],'contextElements':[_0x40acda['element'],_0x2e0f21['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0x355d6f['config']['get']('presenceList.container')['appendChild'](_0x2e0f21['element']),this['_bodyCollection']=new _0x52cb49(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_bodyCollection']['add'](this['balloonPanelView']),_0x2e0f21;}['_handleUserAdd'](_0xfdbeca){if(!this['context']['config']['get']('presenceList.displayMe')&&_0xfdbeca['isMe'])return;const _0x248621=this['context']['config']['get']('presenceList.collapseAt')-0x1;for(this['usersCount']++;this['currentDisplayedUsers']['length']>=_0x248621-(this['view']['isCollapsed']?0x1:0x0)&&this['currentDisplayedUsers']['length']>0x1;)this['currentDisplayedUsers']['remove'](0x1);const _0x3d5d8c=_0xfdbeca['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0xfdbeca,_0x3d5d8c);}['_handleUserRemove'](_0x3588aa){this['usersCount']--;const {collapseAt:_0x5a2c92}=this['context']['config']['get']('presenceList'),_0x4d04fe=this['usersCount']>=_0x5a2c92;if(this['currentDisplayedUsers']['get'](_0x3588aa['id']))this['currentDisplayedUsers']['remove'](_0x3588aa['id']);else{if(_0x4d04fe&&this['currentDisplayedUsers']['length']+0x1===_0x5a2c92-0x1)return;}if(this['currentDisplayedUsers']['length']+(_0x4d04fe?0x1:0x0)<this['usersCount']){for(const _0x228eb5 of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0x228eb5['id'])&&(this['currentDisplayedUsers']['add'](_0x228eb5,Math['min'](this['currentDisplayedUsers']['length']-(_0x4d04fe?0x1:0x0),0x1)),this['currentDisplayedUsers']['length']+(_0x4d04fe?0x1:0x0)===_0x5a2c92-0x1))return;}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0x234a13=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new yt(this['context']['locale'],!!_0x234a13['onClick']),this['view']['inlineListView']['isExpanded']=!0x0,this['listenTo'](this['presenceDropdownView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();});const {listWrapperView:_0x119d23}=this['presenceDropdownView'];_0x119d23['items']['bindTo'](this['_allConnectedUsers'])['using'](_0x9afeae=>{if(!_0x234a13['displayMe']&&_0x9afeae['isMe'])return null;const _0x1a5f76=new kt(this['context']['locale'],_0x9afeae,!!_0x234a13['onClick']);return _0x234a13['onClick']&&this['listenTo'](_0x1a5f76,'execute',()=>{_0x234a13['onClick'](_0x9afeae,_0x1a5f76['element']);}),_0x1a5f76;}),this['balloonPanelView']['content']['add'](this['presenceDropdownView']),this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element']}),_0x119d23['focus'](),_0x119d23['checkIfScrollable']();const _0x2b9faf=(_0x2de283,_0x14eaf8)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0x14eaf8();};_0x119d23['keystrokes']['set']('Esc',_0x2b9faf),_0x119d23['keystrokes']['set']('Shift+Tab',_0x2b9faf),_0x119d23['keystrokes']['set']('Tab',(_0x58308b,_0x506182)=>{!function(_0x22d9db){const _0x54edf5=['a','button','input','select','textarea','[tabindex]','[contenteditable]']['map'](_0x2385b3=>_0x2385b3+':not([disabled]):not([tabindex=\x22-1\x22])')['join'](','),_0x19dae8=[...document['body']['querySelectorAll'](_0x54edf5)]['filter'](_0x422a24=>_0x422a24===document['activeElement']||_0x422a24['offsetWidth']+_0x422a24['offsetHeight']>0x0)['sort']((_0x5689a9,_0x3a8b2d)=>(_0x5689a9['tabIndex']||0x0)-(_0x3a8b2d['tabIndex']||0x0)),_0x1f856f=_0x19dae8[(_0x19dae8['indexOf'](_0x22d9db)+0x1)%_0x19dae8['length']];_0x1f856f&&_0x1f856f['focus']();}(this['view']['element']),this['hideDropdown'](),_0x506182();}),_0x119d23['focusTracker']['add'](this['view']['element']),_0x119d23['focusTracker']['on']('change:isFocused',(_0x4bf13a,_0x549a88,_0x13ad07)=>{_0x13ad07||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 _0x199983{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};