@ckeditor/ckeditor5-real-time-collaboration 44.0.0-alpha.4 → 44.0.0-alpha.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -20,9 +20,9 @@
20
20
  *
21
21
  *
22
22
  */
23
- import{ContextPlugin as _0x5b046d,Plugin as _0x3b81de,PendingActions as _0x5c30be,Context as _0x285205}from'@ckeditor/ckeditor5-core/dist/index.js';import{DomEmitterMixin as _0x1d1d21,CKEditorError as _0x3d0c02,Collection as _0x3c61b0,global as _0x5a383f,version as nt,uid as _0x4cacba,KeystrokeHandler as _0x57d7ba}from'@ckeditor/ckeditor5-utils/dist/index.js';import{Notification as _0x580b9,View as _0x57c216,ListView as _0x121aff,ListItemView as rt,LabelView as ot,BalloonPanelView as _0x2e4728,clickOutsideHandler as _0x18b487,BodyCollection as _0x2000c1}from'@ckeditor/ckeditor5-ui/dist/index.js';import{LiveRange as ht,History as _0x358a9d,NoOperation as _0x2334c7,InsertOperation as _0x19d019,MarkerOperation as _0x21b767,RootAttributeOperation as _0x3b1d5d,transformSets as _0x11f3c8,OperationFactory as _0x38f585}from'@ckeditor/ckeditor5-engine/dist/index.js';import{WebSocketGateway as lt,WEB_SOCKET_GATEWAY_STATES as _0x597b3f,CollaborativeEditingService as _0x2ef4b7,User as dt,CommentsService as _0x2228f5,TrackChangesService as et,RevisionHistoryService as it,EditorService as tt}from'@ckeditor/ckeditor-cloud-services-collaboration/dist/index.js';import{Users as _0x305f5d,UserView as ct}from'ckeditor5-collaboration/dist/index.js';import{Compressor as _0x263294}from'@ckeditor/ckeditor5-operations-compressor/dist/index.js';import{isElement as _0x4c3572}from'lodash-es';class c extends _0x5b046d{static ['WebSocketGateway']=/* #__PURE__ -- @preserve */
24
- ((()=>lt)());static ['initialReconnectionInterval']=0x3e8;['connection'];['_reconnectionStack'];['_shouldPluginsReconnect'];['_domEmitter'];static get['requires'](){return['CloudServices',_0x580b9];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0xee19bb){super(_0xee19bb),this['set']('state',_0x597b3f['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=Object['create'](_0x1d1d21);}['init'](){const _0x3904a6=this['context'],_0x5051d1=_0x3904a6['plugins']['get']('CloudServices'),_0x23b951=_0x3904a6['plugins']['get'](_0x580b9);if(!_0x5051d1['token'])throw new _0x3d0c02('websocketgateway-missing-token',this);if(!_0x5051d1['webSocketUrl'])throw new _0x3d0c02('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),c['WebSocketGateway']['connect'](_0x5051d1['token'],_0x5051d1['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0x39c10a=>{if(this['connection']=_0x39c10a,this['bind']('state')['to'](_0x39c10a,'state',this,'_isBrowserOffline',(_0x351355,_0x43a799)=>('connected'!==_0x351355&&(this['_shouldPluginsReconnect']=!0x0),_0x43a799||_0x351355!==_0x597b3f['CONNECTED']?_0x597b3f['DISCONNECTED']:this['state']==_0x597b3f['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),_0x597b3f['CONNECTING']):_0x597b3f['CONNECTED'])),this['connection']['on']('error',(_0x1d3eba,_0x18b182)=>{if('limitExceeded'!==_0x18b182['code'])throw console['error'](_0x18b182),new _0x3d0c02('cloudservices-init',null,{'originalError':_0x18b182});_0x23b951['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'});}),!_0x39c10a['me'])return new Promise(_0x4eccb1=>_0x39c10a['on']('change:me',_0x4eccb1));})['catch'](_0x542609=>{throw console['error'](_0x542609),new _0x3d0c02('cloudservices-init',null,{'originalError':_0x542609});});}['addToReconnectionStack'](_0x2e8e72){if('function'!=typeof _0x2e8e72['reconnect'])throw new _0x3d0c02('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0x2e8e72))throw new _0x3d0c02('websocketgateway-plugin-already-registered',this,{'name':_0x2e8e72['constructor']['pluginName']});this['_reconnectionStack']['add'](_0x2e8e72);}['removeFromReconnectionStack'](_0x567200){this['_reconnectionStack']['delete'](_0x567200);}['isInReconnectionStack'](_0x5c746b){return this['_reconnectionStack']['has'](_0x5c746b);}['_reconnect'](){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0x10544d=>_0x10544d['reconnect']())))['then'](()=>this['state']=_0x597b3f['CONNECTED'])['catch'](_0x20ab9c=>{throw console['error'](_0x20ab9c),new _0x3d0c02('cloudservices-reconnection-error',this['context']);});}['destroy'](){this['connection']&&this['connection']['disconnect'](),this['state']=_0x597b3f['DISCONNECTED'],this['_domEmitter']['stopListening'](),super['destroy']();}}class i extends _0x5b046d{['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[c,_0x305f5d];}constructor(_0x89fe37){super(_0x89fe37),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0x3c61b0(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x305f5d);}['init'](){const _0x3ec710=this['context']['plugins']['get'](c);this['listenTo'](_0x3ec710,'change:state',(_0x523103,_0x1ca620,_0x345f99)=>{if('connected'!==_0x345f99)this['channelSessions']['forEach'](_0xeb6ff=>_0xeb6ff['clear']()),this['channelConnectedUsers']['forEach'](_0x4c9f66=>_0x4c9f66['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x4be1f3,_0x5a5f2c]of this['_registeredSessions'])for(const _0x3ae398 of _0x5a5f2c)this['_handleSessionAdd'](_0x4be1f3,_0x3ae398);}}),this['_createUser'](_0x3ec710['connection']['me'],!0x0);}['register'](_0x3e9b39,_0x58b8f7){if(this['_registeredSessions']['has'](_0x3e9b39))throw new _0x3d0c02('sessions-register-already-registered',null,{'channelId':_0x3e9b39});this['_registeredSessions']['set'](_0x3e9b39,_0x58b8f7),this['channelSessions']['set'](_0x3e9b39,new _0x3c61b0()),this['channelConnectedUsers']['set'](_0x3e9b39,new _0x3c61b0()),this['listenTo'](_0x58b8f7,'add',(_0x257718,_0x25ec2f)=>this['_handleSessionAdd'](_0x3e9b39,_0x25ec2f)),this['listenTo'](_0x58b8f7,'remove',(_0x217807,_0x33df66)=>this['_handleSessionRemove'](_0x3e9b39,_0x33df66));for(const _0x58ebe1 of _0x58b8f7)this['_handleSessionAdd'](_0x3e9b39,_0x58ebe1);}['unregister'](_0xc49df8){if(!this['_registeredSessions']['has'](_0xc49df8))throw new _0x3d0c02('sessions-unregister-not-exist',null,{'channelId':_0xc49df8});const _0x32cac3=this['_registeredSessions']['get'](_0xc49df8);this['stopListening'](_0x32cac3);for(const _0x104cea of _0x32cac3)'connected'===this['context']['plugins']['get'](c)['state']&&this['_handleSessionRemove'](_0xc49df8,_0x104cea);this['_registeredSessions']['delete'](_0xc49df8),this['channelSessions']['delete'](_0xc49df8),this['channelConnectedUsers']['delete'](_0xc49df8);}get['mySessionId'](){return this['context']['plugins']['get'](c)['connection']['sessionId'];}['getUserBySessionId'](_0x568517){for(const _0x1c6792 of this['channelSessions']['values']())for(const _0x5719d8 of _0x1c6792)if(_0x5719d8['id']===_0x568517)return _0x5719d8['user'];}['getUserSessions'](_0xbcf33c,_0x23993d){const _0xe1a89a=_0x23993d?[this['channelSessions']['get'](_0x23993d)]:this['channelSessions']['values'](),_0x50cdf5=new Set();for(const _0x8ccfff of _0xe1a89a)for(const _0x1cdb7d of _0x8ccfff)_0x1cdb7d['user']['id']===_0xbcf33c['id']&&_0x50cdf5['add'](_0x1cdb7d['id']);return _0x50cdf5;}['getUserRole'](_0x180d06){for(const _0x3a7755 of this['channelSessions']['values']())for(const _0x96a12c of _0x3a7755)if(_0x96a12c['user']===_0x180d06)return _0x96a12c['role'];}['_handleSessionAdd'](_0x3214b7,_0x30e8e3){if('connected'!==this['context']['plugins']['get'](c)['state'])return;const _0x4058df=_0x30e8e3['user'],_0x327e38=this['_users']['getUser'](_0x4058df['id'])||this['_createUser'](_0x4058df),_0x4b0345=Object['assign']({},_0x30e8e3,{'user':_0x327e38});this['channelSessions']['get'](_0x3214b7)['add'](_0x4b0345);const _0x40be62=this['channelConnectedUsers']['get'](_0x3214b7);_0x40be62['has'](_0x327e38['id'])||_0x40be62['add'](_0x327e38),this['allConnectedUsers']['has'](_0x327e38['id'])||this['allConnectedUsers']['add'](_0x327e38,_0x327e38['isMe']?0x0:void 0x0),this['fire']('sessionAdd:'+_0x3214b7,{'channelId':_0x3214b7,'session':_0x4b0345});}['_handleSessionRemove'](_0xc8c260,_0x1405fd){if('connected'!==this['context']['plugins']['get'](c)['state'])return;const _0x55b08d=this['channelConnectedUsers']['get'](_0xc8c260),_0x398b1a=_0x1405fd['user'];_0x398b1a['id']&&(this['channelSessions']['get'](_0xc8c260)['remove'](_0x1405fd['id']),_0x55b08d['has'](_0x398b1a['id'])&&!this['getUserSessions'](_0x398b1a,_0xc8c260)['size']&&_0x55b08d['remove'](_0x398b1a['id']),this['allConnectedUsers']['get'](_0x398b1a['id'])&&!this['getUserSessions'](_0x398b1a)['size']&&this['allConnectedUsers']['remove'](_0x398b1a['id']));}['_createUser'](_0x294288,_0x265b02){const _0x6002fe=this['_users']['addUser'](_0x294288);return _0x265b02&&this['_users']['defineMe'](_0x294288['id']),_0x6002fe['orderNumber']=this['_uniqueUsersCount']++,_0x6002fe;}}class H extends _0x3b81de{['_domEmitter']=new(_0x1d1d21())();static get['requires'](){return[i];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x81c490=this['editor'],_0x59878c=_0x81c490['plugins']['get'](i);_0x81c490['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x242325,{writer:_0x420b9b})=>function(_0x1285c6,_0x5d1faf,_0x15850e,_0x551812){const _0x211c86=_0x1285c6['markerName']['split'](':')[0x2],_0x4aa106=_0x15850e['getUserBySessionId'](_0x211c86);if(!_0x4aa106||_0x211c86===_0x15850e['mySessionId'])return;if(!_0x551812['model']['schema']['checkChild'](_0x1285c6['markerRange']['start'],'$text'))return;const _0x3c2ca1={'class':'ck-user__marker\x20'+_0x4aa106['color']['getMarkerClass'](),'data-name':_0x4aa106['name'],'data-session-id':_0x211c86},_0x4e7a5d=_0x551812['model']['markers']['get'](_0x1285c6['markerName']),_0x4b2525=_0x4e7a5d['getStart'](),_0xbbbe61=_0x4b2525['nodeAfter'],_0x2ef228=_0x551812['model']['schema'];if(_0xbbbe61&&_0x2ef228['isObject'](_0xbbbe61)&&_0x2ef228['isInline'](_0xbbbe61)&&!_0x551812['model']['markers']['get']('user:range:'+_0x211c86)['getRange']()['isCollapsed'])return;const _0x323393=_0x4b2525['parent'];return _0x551812['model']['schema']['isLimit'](_0x323393)&&!_0x551812['model']['hasContent'](_0x323393)&&(_0x3c2ca1['contenteditable']=!0x1),function(_0x495ed0,_0x5d3b1e,_0x104502){const _0x4cc9be=_0x495ed0['createUIElement']('span',_0x5d3b1e);return _0x495ed0['setCustomProperty']('userPositionMarker',!0x0,_0x4cc9be),_0x4cc9be['render']=function(_0x2006e1){const _0x54bbc5=this['toDomElement'](_0x2006e1);return _0x54bbc5['innerHTML']='⁠<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span><span\x20class=\x22ck-user__marker-tooltip\x22\x20contenteditable=\x22false\x22\x20spellcheck=\x22false\x22>'+_0x104502['name']+'</span>⁠',_0x54bbc5['addEventListener']('mouseenter',()=>{_0x54bbc5['classList']['add']('ck-user__marker_hovered');}),_0x54bbc5['addEventListener']('mouseleave',()=>{_0x54bbc5['classList']['remove']('ck-user__marker_hovered');}),_0x54bbc5;},_0x4cc9be['isSimilar']=function(_0x3a3886){return!(!this['getCustomProperty']('userPositionMarker')||!_0x3a3886['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0x3a3886['getAttribute']('data-session-id'));},_0x4cc9be;}(_0x5d1faf,_0x3c2ca1,_0x4aa106);}(_0x242325,_0x420b9b,_0x59878c,_0x81c490)}),_0x81c490['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0x318a41=>function(_0x583525,_0x398fd9){const _0x21b609=_0x583525['markerName']['split'](':')[0x2];if(_0x21b609===_0x398fd9['mySessionId'])return null;const _0x1b96ce=_0x398fd9['getUserBySessionId'](_0x21b609);if(!_0x1b96ce)return{'id':_0x21b609,'classes':[]};return{'id':_0x21b609,'classes':['ck-user__selection',_0x1b96ce['color']['getSelectionClass']()],'attributes':{'data-session-id':_0x21b609},'priority':0x7d0+_0x1b96ce['orderNumber']};}(_0x318a41,_0x59878c)}),function(_0x160f72){const _0x5a7ba3=_0x160f72['model'],_0x557199=new Map(),_0x15c0f8=_0x160f72['plugins']['get'](i);_0x5a7ba3['markers']['on']('update:user:range',(_0x2b118a,_0x529fe8,_0x4d0e06,_0x1a42de)=>{if(!_0x1a42de&&_0x557199['get'](_0x529fe8['name']))return _0x557199['get'](_0x529fe8['name'])['detach'](),void _0x557199['delete'](_0x529fe8['name']);const _0x56efba=_0x529fe8['name']['split'](':')[0x2];if(_0x56efba===_0x15c0f8['mySessionId'])return;const _0x565750='user:position:'+_0x56efba;_0x5a7ba3['markers']['has'](_0x565750)&&_0x160f72['editing']['reconvertMarker'](_0x565750),_0x529fe8['on']('change:range',(_0x22dec2,_0x48ae58,_0x390c21)=>{if('$graveyard'!=_0x48ae58['root']['rootName']&&'$graveyard'==_0x529fe8['getRange']()['root']['rootName']&&!_0x557199['has'](_0x529fe8['name'])){const _0x55a975=_0x5a7ba3['schema']['getNearestSelectionRange'](_0x390c21['deletionPosition']);if(_0x55a975){const _0x205064=ht['fromRange'](_0x55a975);_0x557199['set'](_0x529fe8['name'],_0x205064),_0x205064['on']('change:range',(_0x3afd05,_0x8cc385,_0x5ef939)=>{if('$graveyard'==_0x205064['root']['rootName']){const _0x1a9d67=_0x5a7ba3['schema']['getNearestSelectionRange'](_0x5ef939['deletionPosition']);_0x1a9d67?(_0x205064['start']=_0x1a9d67['start'],_0x205064['end']=_0x1a9d67['end']):(_0x557199['delete'](_0x529fe8['name']),_0x205064['detach']());}});}}});}),_0x5a7ba3['document']['on']('change',()=>{_0x557199['size']>0x0&&_0x5a7ba3['enqueueChange']({'isUndoable':!0x1},_0x5d6cc6=>{for(const [_0x1fe5a6,_0xad9d8e]of _0x557199)'$graveyard'==_0x5a7ba3['markers']['get'](_0x1fe5a6)['getRange']()['root']['rootName']&&(re(_0x1fe5a6['split'](':')[0x2],_0xad9d8e['toRange'](),_0x5a7ba3,_0x5d6cc6),_0xad9d8e['detach']());_0x557199['clear']();});});}(_0x81c490),this['_domEmitter']['listenTo'](_0x5a383f['document'],'keydown',(_0x5bc031,{key:_0x80ffb7})=>{'Escape'===_0x80ffb7&&function(_0x44a996){_0x44a996['editing']['view']['change'](_0x51d046=>{for(const _0x46b977 of _0x44a996['model']['markers']){if(!_0x46b977['name']['startsWith']('user:position'))continue;const _0x5e1f63=_0x44a996['editing']['mapper']['markerNameToElements'](_0x46b977['name']);if(_0x5e1f63){for(const _0x4eb0b3 of _0x5e1f63)_0x51d046['removeClass']('ck-user__marker_hovered',_0x4eb0b3);}}});}(_0x81c490);},{'useCapture':!0x0});}['afterInit'](){const _0x2ffc2c=this['editor'],_0x585af2=_0x2ffc2c['commands']['get']('undo');_0x585af2&&_0x2ffc2c['model']['on']('applyOperation',(_0x516aed,_0x2a7b8f)=>{const _0x1a9e68=_0x2a7b8f[0x0];if('marker'!=_0x1a9e68['type']||!_0x1a9e68['name']['startsWith']('user:'))return;const _0x141f48=_0x1a9e68['batch'];_0x585af2['_createdBatches']['has'](_0x141f48)&&(_0x1a9e68['newRange']=_0x1a9e68['oldRange']?_0x2ffc2c['model']['createRange'](_0x1a9e68['oldRange']['start'],_0x1a9e68['oldRange']['end']):null);},{'priority':'highest'});}['destroy'](){return this['_domEmitter']['stopListening'](),super['destroy']();}['createUserMarkerOperations'](){const _0x2265cb=this['editor'],_0x4ccdd2=_0x2265cb['model']['document'],_0x205e68=_0x2265cb['plugins']['get'](i);_0x2265cb['model']['enqueueChange']({'isUndoable':!0x1},_0x4e0fc9=>{const _0x4196d2='user:range:'+_0x205e68['mySessionId'],_0x3fe0a3='user:position:'+_0x205e68['mySessionId'],_0x34b55a=_0x2265cb['model']['markers']['has'](_0x4196d2);_0x2265cb['editing']['view']['hasDomSelection']?re(_0x205e68['mySessionId'],_0x4ccdd2['selection']['getFirstRange'](),_0x2265cb['model'],_0x4e0fc9):_0x34b55a&&(_0x4e0fc9['removeMarker'](_0x4196d2),_0x4e0fc9['removeMarker'](_0x3fe0a3));});}}function re(_0x121ca8,_0x484361,_0x30ef8b,_0x184240){const _0x5dd9f8='user:range:'+_0x121ca8,_0x20ec9e='user:position:'+_0x121ca8,_0x11483c=_0x484361['getContainedElement']();let _0x3fe48f=_0x484361['start'];_0x11483c&&_0x11483c['is']('element','tableCell')&&(_0x3fe48f=function(_0x51ba0e,_0x5783a5){for(const _0x3a5836 of _0x51ba0e['getPositions']())if(_0x5783a5['schema']['checkChild'](_0x3a5836,'$text'))return _0x3a5836;}(_0x484361,_0x30ef8b),_0x484361=_0x184240['createRange'](_0x3fe48f));const _0x75cd0f=_0x184240['createRange'](_0x3fe48f);_0x30ef8b['markers']['has'](_0x5dd9f8)?(_0x184240['updateMarker'](_0x5dd9f8,{'range':_0x484361}),_0x184240['updateMarker'](_0x20ec9e,{'range':_0x75cd0f})):(_0x184240['addMarker'](_0x5dd9f8,{'range':_0x484361,'usingOperation':!0x0}),_0x184240['addMarker'](_0x20ec9e,{'range':_0x75cd0f,'usingOperation':!0x0}));}function q(_0x4c5e2c,_0x406f5c,_0x3685e7){const _0x510511=_0x4c5e2c['t'],t=_0x4c5e2c['t'];switch(_0x406f5c){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 _0x510511({'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'},_0x3685e7);default:return'';}}let K=0x1;class l extends _0x3b81de{static ['CollaborativeEditingService']=/* #__PURE__ -- @preserve */
25
- ((()=>_0x2ef4b7)());['_offset'];['sessionId'];['serverHistory'];['_channelId'];['_service'];['_document'];['_compressor'];['_bufferedOperations'];['_knownOperations'];['_knownRootNames'];['_pendingAction'];['_hasSelectionChanged'];['_sendBufferedOperationsDelayId'];['_baseBufferDelay'];['_currentBufferDelay'];['_lastSyncedOperationId'];['_disconnectionOperations'];['_operationIdentifier'];static get['requires'](){return[c,i,H,_0x5c30be,_0x305f5d,_0x580b9];}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 _0x2d0de0=this['serverHistory']['getOperations']();for(let _0x541d51=_0x2d0de0['length']-0x1;_0x541d51>=0x0;_0x541d51--){const _0x2aea69=_0x2d0de0[_0x541d51];if(!this['_disconnectionOperations']['has'](_0x2aea69))return _0x2aea69['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0x38ec6e){if(super(_0x38ec6e),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x358a9d(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0x3d0c02('collaboration-missing-channelid',this);const _0x2131df=_0x38ec6e['config']['get']('cloudServices.bundleVersion')||nt;this['_service']=new l['CollaborativeEditingService'](_0x2131df,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0x263294(),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 X(this['_disconnectionOperations']);}['init'](){const _0x4f589e=this['editor'],_0x25fe36=_0x4f589e['plugins']['get'](_0x305f5d),_0x5bb410=_0x4f589e['plugins']['get'](c);this['listenTo'](_0x25fe36,'getOperationAuthor',(_0x1c9b88,_0x13d9b7)=>{const _0x392727=_0x13d9b7[0x0];_0x392727['_authorId']&&(_0x1c9b88['return']=_0x25fe36['getUser'](_0x392727['_authorId']),_0x1c9b88['stop']()),null===_0x392727['_authorId']&&(_0x1c9b88['return']=null,_0x1c9b88['stop']());},{'priority':'high'}),this['listenTo'](_0x4f589e['model']['document']['selection'],'change:range',(_0x4f8ff1,_0x21b163)=>{_0x21b163['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x4f589e['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x4f589e['model']['on']('applyOperation',(_0xb1feca,_0x1919cc)=>{const _0x51e7e3=_0x1919cc[0x0];_0x51e7e3['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0x51e7e3),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['bind']('_isEditingAllowed')['to'](_0x5bb410,'state',this,'_hasSynchronizationProblem',(_0x1b4a6f,_0x1d063b)=>'connected'===_0x1b4a6f&&!_0x1d063b),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x4f589e['disableReadOnlyMode']('rtc-offline'):_0x4f589e['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x4f589e['disableReadOnlyMode']('rtc-offline'):_0x4f589e['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async['reconnect'](){const _0x338bf2=this['editor']['plugins']['get'](i),_0x55dfa2=this['editor']['plugins']['get'](c);try{this['_isPendingUpdate']=!0x0,_0x338bf2['unregister'](this['_channelId']);const _0x4d317c=await this['_service']['reconnect'](_0x55dfa2['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0x4d317c)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x56105f=await this['_service']['getConnectedSessions']();_0x338bf2['register'](this['_channelId'],_0x56105f),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x20921a){if(function(_0x34862a){return'404'===_0x34862a['code'];}(_0x20921a)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0x2d6b1b){return'409'===_0x2d6b1b['code'];}(_0x20921a)){const _0x25e45=q(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'](_0x25e45);}else{if(!(_0x20921a instanceof J))throw _0x20921a;this['_handleReconnectionError']();}}}}['destroy'](){const _0x134958=this['editor']['plugins']['get'](c),_0x43465f=this['editor']['plugins']['get'](i);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x43465f['channelSessions']['has'](this['_channelId'])&&_0x43465f['unregister'](this['_channelId']),_0x134958['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async['_handleReconnectionResponse'](_0x4c1f3f){if(this['sessionId']!==_0x4c1f3f['sessionId']&&this['_lastSyncedOperationId']!==_0x4c1f3f['lastOperationId'])throw new J();return this['sessionId']=_0x4c1f3f['sessionId'],this['_handleServerResponse']([],{..._0x4c1f3f,'wereChangesApplied':!0x1,'data':_0x4c1f3f['data']},'reconnect');}async['_connectService'](_0xef76f3,_0x56561f=!0x1){const {connection:_0x1e32b3}=this['editor']['plugins']['get'](c);l['CollaborativeEditingService']['getConnectedSessions'](_0x1e32b3,this['_channelId'])['then'](_0x283b60=>this['_initSessionsHandling'](_0x283b60))['catch'](_0x4ca795=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x4ca795);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x52f6e6,_0x2ea5dc)=>{this['_crash']('realtimecollaborationclient-initservice-internal-error',_0x2ea5dc);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_isConnected']=!0x1;});const _0x3a7ae0=this['_operationIdentifier']['getIdOfTheLastOperation'](_0xef76f3);this['_isPendingUpdate']=!0x0;const _0x1005a7=await this['_service']['connect'](_0x1e32b3,this['_compressOperations'](_0xef76f3),_0x3a7ae0);if(this['sessionId']=_0x1005a7['sessionId'],_0x56561f){if(!_0x1005a7['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x1005a7['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0xef76f3,_0x1005a7,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x1005a7,_0xef76f3);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}['_handleSendingSelectionMarkers'](){const _0x30a6f7=this['editor']['plugins']['get'](i),_0xd0cade=this['editor']['plugins']['get'](H),_0x153c41=_0x30a6f7['channelSessions']['get'](this['_channelId']);_0x153c41&&_0x153c41['length']>0x1?_0xd0cade['createUserMarkerOperations']():this['listenTo'](_0x30a6f7,'sessionAdd:'+this['_channelId'],()=>{0x2===_0x30a6f7['channelSessions']['get'](this['_channelId'])['length']&&_0xd0cade['createUserMarkerOperations']();});}async['_handleReceivedOperations'](_0x1e5d8e,_0x5686d8,_0x38450f,_0x269a0a){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x5686d8){const _0x46d6f6=this['_decompressOperations'](_0x38450f,_0x269a0a);await this['_fetchMissingUsers'](_0x46d6f6),this['_handleExternalOperations'](_0x46d6f6,_0x5686d8,_0x38450f['lastOperationId'])||this['_crash']('realtimecollaborationclient-initservice-incorrect-server-operation');}}async['_connectAfterSessionHasBeenFlushed'](){this['_disconnectService']();const {locale:_0x39981e}=this['editor'];let _0x5cdb9a;try{_0x5cdb9a=await this['_service']['getDocumentDetails']();}catch(_0x476a4d){const _0x1f0247=q(_0x39981e,'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'](_0x1f0247);}const _0x1d592b=_0x5cdb9a['currentDocumentSession']||_0x5cdb9a['lastDocumentSession'];if(this['_lastSyncedOperationId']===_0x1d592b['lastOperationId'])await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);else{const _0x218dfc=q(_0x39981e,'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.');this['_handleReconnectionError'](_0x218dfc);}}['_disconnectService'](){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['stopListening'](this['_service']);}['_initSessionsHandling'](_0x3fce74){const _0x221547=this['editor']['plugins']['get'](i);this['listenTo'](_0x221547,'sessionAdd:'+this['_channelId'],(_0x3b946d,{session:_0x23d7ce})=>{if(_0x23d7ce['id']===_0x221547['mySessionId']){_0x3b946d['off']();const _0x34745f=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0x1188b3=_0x23d7ce['permissions'];_0x34745f&&_0x34745f['isEnabled']&&(_0x1188b3=_0x1188b3['filter'](_0x21fe79=>'document:write'!==_0x21fe79)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0x1188b3,this['_channelId']);}}),_0x221547['register'](this['_channelId'],_0x3fce74);}['_initThrowingOnDataSet'](){const _0x482c4c=this['editor']['data']['set'];this['editor']['data']['set']=(..._0x131ef7)=>{if(!_0x131ef7[_0x131ef7['length']-0x1]['suppressErrorInCollaboration'])throw new _0x3d0c02('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x482c4c['apply'](this['editor']['data'],_0x131ef7);};}['_setUpDataInit'](){this['editor']['data']['on']('init',(_0x2afe8c,[_0xd7dbf3])=>{if(this['_document']['version'])throw new _0x3d0c02('realtimecollaborationclient-init-document-already-initialized',this);_0x2afe8c['stop'](),this['_setPendingAction']();const _0x19ab23=this['editor']['config']['get']('rootsAttributes'),_0x4e6044=this['_getOperationsFromInitData'](_0xd7dbf3,_0x19ab23);0x0==_0x4e6044['length']&&_0x4e6044['push'](new _0x2334c7(0x0)),_0x2afe8c['return']=this['_connectService'](_0x4e6044)['then'](()=>{this['editor']['plugins']['get'](c)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x24e809=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x24e809))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x1d4a48,[_0x598ad6,_0x2bb562])=>{_0x1d4a48['stop']();const _0x523012=this['editor']['model']['document']['getRoot'](_0x598ad6);if(!this['_knownRootNames']['has'](_0x598ad6)){const _0x3910b2=_0x2bb562&&_0x2bb562['data']?_0x2bb562['data']:'',_0x365cc6=_0x2bb562&&_0x2bb562['attributes']?_0x2bb562['attributes']:{};await this['_loadRoot'](_0x598ad6,_0x3910b2,_0x365cc6);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0x523012['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0x523012);});},{'priority':'high'});}async['_fetchMissingUsers'](_0x43009e){const _0x365095=this['editor']['plugins']['get'](_0x305f5d),{connection:_0x39f646}=this['editor']['plugins']['get'](c),_0x2bf945=new Set();for(const _0x585065 of _0x43009e){const _0x51ea6e=_0x585065['_authorId'];_0x51ea6e&&!_0x365095['getUser'](_0x51ea6e)&&_0x2bf945['add'](_0x51ea6e);}if(0x0===_0x2bf945['size'])return;const _0x4477c9=await dt['getMany'](_0x39f646,Array['from'](_0x2bf945));for(const _0x408231 of _0x4477c9)_0x365095['getUser'](_0x408231['id'])||_0x365095['addUser'](_0x408231);}['_getOperationsFromInitData'](_0x31d8a9,_0x425966={}){const _0x2e6b60=this['editor']['model'],_0x2f6d28=[];let _0x113378=0x0;const _0x1ed460='string'==typeof _0x31d8a9?{'main':_0x31d8a9}:_0x31d8a9;for(const _0x20575b of Object['keys'](_0x1ed460)){if(!this['_document']['roots']['has'](_0x20575b))throw new _0x3d0c02('realtimecollaborationclient-init-non-existent-root',this);const _0xbd04e9=this['editor']['data']['parse'](_0x1ed460[_0x20575b]),_0x41beed=this['_document']['getRoot'](_0x20575b),_0x107f97=new _0x19d019(_0x2e6b60['createPositionAt'](_0x41beed,0x0),_0xbd04e9,_0x113378++);_0x2f6d28['push'](_0x107f97);for(const [_0x146371,_0x2719b9]of _0xbd04e9['markers']){const _0x48432d=_0x2e6b60['createRange'](_0x2e6b60['createPositionFromPath'](_0x41beed,_0x2719b9['start']['path']['slice']()),_0x2e6b60['createPositionFromPath'](_0x41beed,_0x2719b9['end']['path']['slice']())),_0x31f544=new _0x21b767(_0x146371,null,_0x48432d,_0x2e6b60['markers'],!0x0,_0x113378++);_0x2f6d28['push'](_0x31f544);}}if(_0x425966)for(const [_0x11fa08,_0x1412bb]of Object['entries'](_0x425966)){const _0xfed834=_0x2e6b60['document']['getRoot'](_0x11fa08);if(!_0xfed834)throw new _0x3d0c02('multi-root-editor-root-attributes-no-root',null);for(const [_0x2477cb,_0x326eb3]of Object['entries'](_0x1412bb))if(null!==_0x326eb3){const _0x5230a4=new _0x3b1d5d(_0xfed834,_0x2477cb,null,_0x326eb3,_0x113378++);_0x2f6d28['push'](_0x5230a4);}}return _0x2f6d28;}async['_loadRoot'](_0x3cae51,_0x58dbcc,_0x2c075f){this['_getOperationsFromInitData']({[_0x3cae51]:_0x58dbcc},{[_0x3cae51]:_0x2c075f})['forEach']((_0x52a217,_0x190b11)=>{_0x52a217['baseVersion']=this['_document']['version']+_0x190b11,_0x52a217['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x52a217);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async['_handleInitialConnectionData'](_0x129569,_0x54b044){let _0x1d7680;this['_offset']=_0x129569['offset'];const _0x172d5c=_0x129569['wereChangesApplied']&&!_0x129569['initData'],_0x1ec5ab=_0x172d5c?0x0:_0x129569['data']['baseVersion'];if(_0x54b044['forEach'](_0x5435ac=>{_0x5435ac['_isInit']=!0x0,_0x5435ac['createdAt']=_0x129569['sessionCreatedAt'],_0x5435ac['_authorId']=null;}),_0x172d5c)_0x1d7680=_0x54b044,this['_applyOperationsSet'](_0x1d7680,_0x172d5c);else{if(_0x129569['initData']){const _0x77757e=this['_getOperationsFromInitData'](_0x129569['initData']);this['_document']['history']['version']=-_0x77757e['length'],_0x77757e['forEach'](_0x425499=>{_0x425499['baseVersion']-=_0x77757e['length'],_0x425499['createdAt']=_0x129569['sessionCreatedAt'],_0x425499['_isInit']=!0x0,_0x425499['_authorId']=null;}),this['_applyOperationsSet'](_0x77757e,!0x0),this['serverHistory']['version']=-_0x77757e['length']+this['_offset'],this['_updateServerHistory'](_0x77757e);}this['_document']['history']['version']=_0x1ec5ab,_0x1d7680=this['_decompressOperations'](_0x129569['data'],_0x129569['metadata']),await this['_fetchMissingUsers'](_0x1d7680),this['_applyOperationsSet'](_0x1d7680,_0x172d5c);}_0x129569['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x1d7680,_0x129569['lastOperationId']),this['_lastSyncedOperationId']=_0x129569['lastOperationId']),this['serverHistory']['version']=_0x1ec5ab+this['_offset'],this['_updateServerHistory'](_0x1d7680),_0x54b044['filter'](_0x5e3da9=>{const _0x5a3b4e=this['_getAffectedRoot'](_0x5e3da9);return _0x5a3b4e&&!this['_knownRootNames']['has'](_0x5a3b4e);})['forEach']((_0x5cee4,_0x171249)=>{_0x5cee4['baseVersion']=this['_document']['version']+_0x171249,this['_saveOperationInBuffer'](_0x5cee4);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0xfb0058,_0x3c441a,_0x14de0e){throw this['_isPendingUpdate']=!0x0,_0x3c441a&&console['error'](_0x3c441a),_0x14de0e&&this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0x3d0c02(_0xfb0058,this['editor']);}['_saveOperationInBuffer'](_0x4c6a7f){this['_knownOperations']['has'](_0x4c6a7f)||(this['_knownOperations']['add'](_0x4c6a7f),this['_bufferedOperations']['push'](_0x4c6a7f),this['_pendingAction']||'marker'==_0x4c6a7f['type']&&!_0x4c6a7f['affectsData']||this['_setPendingAction']());}['_sendBufferedOperationsDelayed'](_0x37fcfb=!0x1){!_0x37fcfb&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0xb2dda9=>{_0xb2dda9&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0x8bdc72=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0x544b97){return _0x544b97['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x544b97['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0x544b97['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0x8bdc72)||this['_crash'](_0x8bdc72['message'],_0x8bdc72,!0x0);});},this['_currentBufferDelay']));}['_waitUntilSynced'](){return new Promise(_0x1a2c16=>{this['on']('change:_isPendingUpdate',()=>{_0x1a2c16();});});}async['_sendBufferedOperations'](){const _0x380f21=this['editor']['plugins']['get'](H);if(this['_shouldSendSelectionUpdate']()&&(_0x380f21['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x174d00=[...this['_bufferedOperations']];for(const _0x252faf of _0x174d00)_0x252faf['wasUndone']=this['_document']['history']['isUndoneOperation'](_0x252faf);const _0x2eddd4=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x174d00),_0x34cfb7=K++,_0x49f10a=this['_compressOperations'](_0x174d00),_0x4d94b5=await this['_service']['sendOperations'](_0x49f10a,_0x49f10a['baseVersion'],_0x2eddd4);try{return await this['_handleServerResponse'](_0x174d00,_0x4d94b5,_0x34cfb7);}catch(_0x4b1e24){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0x4b1e24);}}async['_handleServerResponse'](_0x453528,_0x4bb91a,_0x121767){if('error'in _0x4bb91a)throw _0x4bb91a['error'];let _0x2a3117=!0x1;if(_0x4bb91a['wereChangesApplied']){_0x4bb91a['lastOperationId']&&(this['_lastSyncedOperationId']=_0x4bb91a['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x4cde13=>!_0x453528['includes'](_0x4cde13));for(const _0xb7d3d5 of _0x453528)_0xb7d3d5['createdAt']='lastOperationAcceptedAt'in _0x4bb91a&&_0x4bb91a['lastOperationAcceptedAt']||void 0x0;Q(_0x453528,_0x4bb91a['version']-_0x453528['length']),this['_updateServerHistory'](_0x453528);const _0x5f0b17=_0x453528['filter'](_0x267f3d=>{if(!_0x267f3d['_isInit'])return!0x1;const _0x14d5aa=this['_getAffectedRoot'](_0x267f3d);return _0x14d5aa&&!this['_knownRootNames']['has'](_0x14d5aa);});Q(_0x5f0b17,this['_document']['version']),this['_applyOperationsSet'](_0x5f0b17),_0x2a3117=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0x3b493b=this['_decompressOperations'](_0x4bb91a['data'],_0x4bb91a['metadata'])['filter'](_0x3e1e97=>_0x3e1e97['baseVersion']>=this['_lastServerVersion']);_0x3b493b['forEach'](_0x249e9f=>this['_addKnownRoot'](_0x249e9f)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x3cb2dc=>!_0x3cb2dc['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x3cb2dc))),this['_bufferedOperations']['length']&&Q(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0x3b493b),_0x2a3117=this['_handleExternalOperations'](_0x3b493b,_0x4bb91a['version'],_0x4bb91a['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x2a3117?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}['_handleExternalOperations'](_0xee96d9,_0x1558c9,_0x311a0a){try{const _0x529723={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x414d64,operationsB:_0x215152,originalOperations:_0x52714b}=_0x11f3c8(_0xee96d9,this['_bufferedOperations'],_0x529723);Q(_0x414d64,this['_document']['version']),Q(_0x215152,_0x1558c9);for(const _0x1bbf63 of _0x414d64){const _0x423e28=_0x52714b['get'](_0x1bbf63);_0x1bbf63['_authorId']=_0x423e28?_0x423e28['_authorId']:null;}_0x311a0a&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0xee96d9,_0x311a0a),this['_lastSyncedOperationId']=_0x311a0a),this['_bufferedOperations']=[..._0x215152],this['_applyOperationsSet'](_0x414d64),this['_updateServerHistory'](_0xee96d9);}catch(_0x567757){return console['error'](_0x567757),!0x1;}return!0x0;}['_applyOperationsSet'](_0x356624,_0x209138=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0x339812=>{for(const _0x1d120b of _0x356624)this['_knownOperations']['add'](_0x1d120b),this['_addKnownRoot'](_0x1d120b),_0x339812['batch']['addOperation'](_0x1d120b),this['editor']['model']['applyOperation'](_0x1d120b);});}['_addKnownRoot'](_0x2955b0){const _0x5bf870=this['_getAffectedRoot'](_0x2955b0);_0x5bf870&&this['_knownRootNames']['add'](_0x5bf870);}['_getAffectedRoot'](_0x47b4bf){let _0x11803a,_0x27a45e;switch(_0x47b4bf['type']){case'insert':_0x11803a=_0x47b4bf['position']['root'];break;case'marker':if(_0x27a45e=_0x47b4bf['newRange'],!_0x27a45e)return null;_0x11803a=_0x27a45e['root'];break;case'addRootAttribute':_0x11803a=_0x47b4bf['root'];break;case'addRoot':_0x11803a=_0x47b4bf['affectedSelectable'];break;case'move':_0x11803a=_0x47b4bf['targetPosition']['root'];break;default:return null;}return _0x11803a['rootName'];}['_updateServerHistory'](_0x5d0281){_0x5d0281['forEach'](_0x20339c=>{const _0x45b697=_0x20339c['clone']();_0x45b697['_authorId']=_0x20339c['_authorId'],_0x45b697['_isInit']=!!_0x20339c['_isInit'],_0x45b697['createdAt']=_0x20339c['createdAt'],_0x45b697['baseVersion']+=this['_offset'],_0x20339c['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x45b697),this['serverHistory']['addOperation'](_0x45b697);});}['_handleReconnectionError'](_0x56518f){const _0x33014e=this['editor']['plugins']['get']('Notification'),_0x94642d=this['editor']['locale'];_0x56518f||(_0x56518f=q(_0x94642d,'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.')),_0x33014e['showWarning'](_0x56518f,{'title':q(_0x94642d,'Synchronization\x20issue'),'namespace':'real-time-collaboration'}),this['_hasSynchronizationProblem']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_bufferedOperations']=[],this['editor']['plugins']['get'](c)['destroy']();}['_setPendingAction'](){this['_pendingAction']||(this['_pendingAction']=this['editor']['plugins']['get'](_0x5c30be)['add'](q(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}['_clearPendingAction'](){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x5c30be)['remove'](this['_pendingAction']),this['_pendingAction']=null);}['_compressOperations'](_0x399fca){const _0x47b0d3=_0x399fca['map'](_0x490e65=>_0x490e65['toJSON']());return this['_compressor']['compress'](_0x47b0d3);}['_decompressOperations'](_0x1d4ae4,_0x4a8399){return this['_compressor']['decompress'](_0x1d4ae4)['map']((_0x537bde,_0x303e2f)=>{const _0x55b135='init'==_0x4a8399[_0x303e2f]['type'];if('InsertOperation'==_0x537bde['__className']){const _0x351b7f=_0x537bde['position']['root'];!this['_document']['getRoot'](_0x351b7f)&&(this['_document']['createRoot']('$root',_0x351b7f)['_isAttached']=!0x1);}const _0x3a6528=_0x38f585['fromJSON'](_0x537bde,this['_document']);return _0x3a6528['wasUndone']=_0x537bde['wasUndone'],_0x3a6528['_isInit']=_0x55b135,_0x3a6528['_authorId']=_0x55b135?null:_0x4a8399[_0x303e2f]['userId'],_0x3a6528['_isDisconnection']='cs:removeUser'===_0x4a8399[_0x303e2f]['type'],_0x3a6528['createdAt']=_0x4a8399[_0x303e2f]['createdAt'],_0x3a6528;});}['_refreshUserSelectionMarkers'](){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}['_shouldSendSelectionUpdate'](){const _0x1cd7de=this['editor']['plugins']['get'](i)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0x1cd7de&&_0x1cd7de['length']>0x1&&this['_hasSelectionChanged'];}['_shouldSendUpdate'](){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}}class J extends Error{}function Q(_0x412540,_0x215202){for(const _0x15e815 of _0x412540)_0x15e815['baseVersion']=_0x215202++;}class X{['_ignoredOperations'];['_operationToId'];constructor(_0x5e9858){this['_ignoredOperations']=_0x5e9858,this['_operationToId']=new WeakMap();}['getIdOfTheLastOperation'](_0x223277){let _0x39807f=_0x223277['length'];for(;_0x39807f--;){const _0x1b203a=_0x223277[_0x39807f];if(!this['_ignoredOperations']['has'](_0x1b203a)){if(!this['_operationToId']['has'](_0x1b203a)){const _0x10080a=_0x4cacba()['slice'](0x1,0x12);this['_operationToId']['set'](_0x1b203a,_0x10080a);}return this['_operationToId']['get'](_0x1b203a);}}}['setIdForTheLastOperation'](_0x5dbbfc,_0x8755b9){if(!_0x8755b9)return;let _0x99dad1=_0x5dbbfc['length'];for(;_0x99dad1--;){const _0x3c96a0=_0x5dbbfc[_0x99dad1];this['_ignoredOperations']['has'](_0x3c96a0)||this['_operationToId']['set'](_0x3c96a0,_0x8755b9);}}}class n extends _0x3b81de{static get['requires'](){return[l];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class a extends _0x5b046d{static ['CommentsService']=/* #__PURE__ -- @preserve */
26
- ((()=>_0x2228f5)());['_services'];static get['requires'](){return[c,'CommentsRepository',i,_0x305f5d];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x48a339){super(_0x48a339),this['_services']=new Map();}async['init'](){const _0x578ceb=this['context'],_0x2bcdd3=_0x578ceb['plugins']['get']('CommentsRepository');if(_0x578ceb['plugins']['get'](c)['addToReconnectionStack'](this),_0x2bcdd3['adapter']={'addCommentThread':async({channelId:_0xdab520,threadId:_0x24030b,comments:_0x5dd94c,resolvedAt:_0x5b0b9f,resolvedBy:_0x29a23e,context:_0x37a2dc,attributes:_0x13df04})=>{const _0x4d8e4f=await this['_getService'](_0xdab520)['addCommentThread']({'commentThreadId':_0x24030b,'comments':_0x5dd94c['map'](_0x1f5095=>function(_0x300932,_0x44247b,_0x3f9f1d){return{'commentThreadId':_0x3f9f1d,'commentId':_0x300932['commentId'],'userId':_0x300932['authorId'],'content':_0x300932['content'],'documentId':_0x44247b,'createdAt':_0x300932['createdAt'],'attributes':_0x300932['attributes']||{}};}(_0x1f5095,_0xdab520,_0x24030b)),'resolvedAt':_0x5b0b9f,'resolvedBy':_0x29a23e,'context':_0x37a2dc,'attributes':_0x13df04})['catch'](ut);return{'threadId':_0x4d8e4f['commentThreadId'],'comments':_0x4d8e4f['comments']};},'getCommentThread':async({channelId:_0x45d306,threadId:_0x4d1e36})=>{const _0x3a92e7=await this['_getService'](_0x45d306)['getCommentThread'](_0x4d1e36)['catch'](ut);return _0x3a92e7['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0x3a92e7]),{'threadId':_0x3a92e7['commentThreadId'],'comments':_0x3a92e7['comments']['map'](S),'context':_0x3a92e7['context'],'resolvedAt':_0x3a92e7['resolvedAt'],'resolvedBy':_0x3a92e7['resolvedBy'],'attributes':_0x3a92e7['attributes']||{}});},'updateCommentThread':async({channelId:_0x391452,threadId:_0x1367df,context:_0x22dd71,unlinkedAt:_0x1c91df,attributes:_0x340104})=>this['_getService'](_0x391452)['updateCommentThread']({'commentThreadId':_0x1367df,'context':_0x22dd71,'attributes':_0x340104,'unlinkedAt':_0x1c91df})['catch'](B)['catch'](ut),'resolveCommentThread':async({channelId:_0x41510f,threadId:_0x56d866})=>{const _0x2de1ce=await this['_getService'](_0x41510f)['resolveCommentThread'](_0x56d866)['catch'](B)['catch'](ut);return{'threadId':_0x2de1ce['commentThreadId'],'resolvedAt':_0x2de1ce['resolvedAt'],'resolvedBy':_0x2de1ce['resolvedBy']};},'reopenCommentThread':async({channelId:_0x163c7d,threadId:_0x153531})=>this['_getService'](_0x163c7d)['reopenCommentThread'](_0x153531)['catch'](B)['catch'](ut),'removeCommentThread':({channelId:_0x1edd21,threadId:_0x37941f})=>this['_getService'](_0x1edd21)['removeCommentThread'](_0x37941f)['catch'](B)['catch'](ut),'addComment':({channelId:_0x10b2ea,threadId:_0x32d8d0,commentId:_0x39b0e6,content:_0x2699a1,attributes:_0x1a2109})=>this['_getService'](_0x10b2ea)['addComment'](_0x32d8d0,_0x39b0e6,_0x2699a1,_0x1a2109)['catch'](ut),'updateComment':({channelId:_0x22acf7,threadId:_0x5d63e0,commentId:_0x3e07cd,content:_0x129d5d,attributes:_0x447f86})=>this['_getService'](_0x22acf7)['updateComment'](_0x5d63e0,_0x3e07cd,_0x129d5d,_0x447f86)['catch'](B)['catch'](ut),'removeComment':({channelId:_0x370378,threadId:_0x1beaec,commentId:_0x19ee7b})=>this['_getService'](_0x370378)['removeComment'](_0x1beaec,_0x19ee7b)['catch'](B)['catch'](ut)},_0x578ceb instanceof _0x285205){const _0x12192a=_0x578ceb['config']['get']('collaboration.channelId'),_0x16ab8b=_0x578ceb['plugins']['get'](i);await this['_setUpService'](_0x12192a);const _0x1fb59a=await this['_services']['get'](_0x12192a)['getConnectedSessions']();this['listenTo'](_0x16ab8b,'sessionAdd:'+_0x12192a,(_0x225fb4,{session:_0x2aa143})=>{_0x2aa143['id']===_0x16ab8b['mySessionId']&&(_0x225fb4['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x2aa143['permissions'],_0x12192a));}),_0x16ab8b['register'](_0x12192a,_0x1fb59a);}}async['_setUpService'](_0x122c65){if(this['_services']['has'](_0x122c65))throw new _0x3d0c02('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0x122c65});const _0x2fabfe=this['context']['plugins']['get']('CommentsRepository'),_0x3cc508=new a['CommentsService'](_0x122c65);this['_services']['set'](_0x122c65,_0x3cc508),this['listenTo'](_0x3cc508,'commentThreadAdded',(_0x410928,_0x57a172)=>{const {commentThreadId:_0x1ddb0f,documentId:_0x58b81a,context:_0x477c39,attributes:_0x57d070,resolvedAt:_0xbb219f,resolvedBy:_0x20f334,comments:_0x331f2b}=_0x57a172;_0x2fabfe['getCommentThread'](_0x1ddb0f)||_0x2fabfe['addCommentThread']({'threadId':_0x1ddb0f,'channelId':_0x58b81a,'comments':_0x331f2b?_0x331f2b['map'](S):[],'context':_0x477c39,'attributes':_0x57d070,'resolvedAt':_0xbb219f,'resolvedBy':_0x20f334,'isFromAdapter':!0x0});}),this['listenTo'](_0x3cc508,'commentThreadUpdated',(_0x23ef7e,{commentThreadId:_0x5ae0be,documentId:_0x150fd5,context:_0x27c011,unlinkedAt:_0x433fe6,attributes:_0x1718a2})=>{_0x2fabfe['getCommentThread'](_0x5ae0be)&&_0x2fabfe['updateCommentThread']({'threadId':_0x5ae0be,'channelId':_0x150fd5,'context':_0x27c011,'unlinkedAt':_0x433fe6,'attributes':_0x1718a2,'isFromAdapter':!0x0});}),this['listenTo'](_0x3cc508,'commentThreadResolved',(_0x711983,{commentThreadId:_0x3c3bbb,resolvedBy:_0x53c971,resolvedAt:_0x38f516})=>{const _0x973022=_0x2fabfe['getCommentThread'](_0x3c3bbb);_0x973022&&_0x973022['resolve']({'resolvedBy':_0x53c971,'resolvedAt':_0x38f516,'isFromAdapter':!0x0});}),this['listenTo'](_0x3cc508,'commentThreadReopened',(_0xf4e927,{commentThreadId:_0x45ba2d})=>{const _0x1ee8dc=_0x2fabfe['getCommentThread'](_0x45ba2d);_0x1ee8dc&&_0x1ee8dc['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0x3cc508,'commentThreadRemoved',(_0x5af135,{commentThreadId:_0x11e8ab})=>{const _0xcf92d8=_0x2fabfe['getCommentThread'](_0x11e8ab);_0xcf92d8&&_0xcf92d8['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0x3cc508,'commentAdded',(_0x1cdd82,_0x507ea4)=>{const _0x29afbb=_0x507ea4['commentThreadId'],_0x5dd5f0=_0x2fabfe['getCommentThread'](_0x29afbb);_0x5dd5f0&&_0x5dd5f0['addComment']({...S(_0x507ea4),'isFromAdapter':!0x0});}),this['listenTo'](_0x3cc508,'commentUpdated',(_0x315769,{commentThreadId:_0x5ea1c0,commentId:_0x65e556,content:_0x20d29a,attributes:_0x103c4c})=>{const _0x3a3347=_0x2fabfe['getCommentThread'](_0x5ea1c0);if(_0x3a3347){const _0x2d1919=_0x3a3347['getComment'](_0x65e556);_0x2d1919&&_0x2d1919['update']({'content':_0x20d29a,'attributes':_0x103c4c,'isFromAdapter':!0x0});}}),this['listenTo'](_0x3cc508,'commentRemoved',(_0x69c571,{commentThreadId:_0x2d3a66,commentId:_0x1766c8})=>{const _0x239b85=_0x2fabfe['getCommentThread'](_0x2d3a66);if(_0x239b85){const _0x12ea5e=_0x239b85['getComment'](_0x1766c8);_0x12ea5e&&_0x12ea5e['remove']({'isFromAdapter':!0x0});}}),await this['_connectService'](_0x122c65);}['destroy'](){if(this['context']instanceof _0x285205){const _0x28066f=this['context']['config']['get']('collaboration.channelId');this['_terminateService'](_0x28066f);}}['_terminateService'](_0x3ee94b){if(!this['_services']['has'](_0x3ee94b))throw new _0x3d0c02('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0x3ee94b});this['_getService'](_0x3ee94b)['disconnect'](),this['_services']['delete'](_0x3ee94b);}async['reconnect'](){for(const _0x277ab5 of this['_services']['keys']())await this['_connectService'](_0x277ab5);if(this['context']instanceof _0x285205){const _0x4216c2=this['context']['config']['get']('collaboration.channelId'),_0x59bfc6=this['context']['plugins']['get'](i);_0x59bfc6['unregister'](_0x4216c2);const _0xba5fc2=await this['_services']['get'](_0x4216c2)['getConnectedSessions']();_0x59bfc6['register'](_0x4216c2,_0xba5fc2);}}async['_connectService'](_0x1bb92e){const {connection:_0x3ca5c0}=this['context']['plugins']['get'](c),_0x5e5c12=this['context']['plugins']['get']('CommentsRepository'),_0x192ed9=this['_services']['get'](_0x1bb92e),_0x110f77=await _0x192ed9['connect'](_0x3ca5c0);await this['_fetchMissingUsersForThreads'](_0x110f77);const _0x2f74f3=new Set(Array['from'](_0x5e5c12['getCommentThreads']({'channelId':_0x1bb92e}),_0x10f6d4=>_0x10f6d4['id']));for(const _0x4f1551 of _0x110f77)_0x4f1551['deletedAt']||_0x2f74f3['delete'](_0x4f1551['commentThreadId']);for(const _0x4f9ef8 of _0x2f74f3)_0x5e5c12['getCommentThread'](_0x4f9ef8)['remove']({'isFromAdapter':!0x0});for(const _0x5005fb of _0x110f77){let _0x5f17ad=_0x5e5c12['getCommentThread'](_0x5005fb['commentThreadId']);const {commentThreadId:_0x5d2855,context:_0x4f8b79,attributes:_0x51320b,resolvedBy:_0x284286,resolvedAt:_0x508487,unlinkedAt:_0x30ae3b,deletedAt:_0x527849}=_0x5005fb;if(_0x527849)continue;_0x5f17ad||(_0x5f17ad=_0x5e5c12['addCommentThread']({'channelId':_0x1bb92e,'threadId':_0x5d2855,'context':_0x4f8b79,'attributes':_0x51320b||{},'resolvedBy':_0x284286,'resolvedAt':_0x508487,'unlinkedAt':_0x30ae3b,'isFromAdapter':!0x0}));const _0x4c34d9=new Set(Array['from'](_0x5f17ad['comments'],_0x1f2b94=>_0x1f2b94['id']));for(const _0x526842 of _0x5005fb['comments'])_0x4c34d9['delete'](_0x526842['commentId']);for(const _0x52c365 of _0x4c34d9)_0x5f17ad['getComment'](_0x52c365)['remove']({'isFromAdapter':!0x0});for(const _0xb97e4b of _0x5005fb['comments']){const _0x13fe69=_0x5f17ad['getComment'](_0xb97e4b['commentId']);_0x13fe69?_0x13fe69['content']!==_0xb97e4b['content']&&_0x13fe69['update']({'content':_0xb97e4b['content'],'isFromAdapter':!0x0}):_0x5f17ad['addComment'](Object['assign'](S(_0xb97e4b),{'isFromAdapter':!0x0}));}}}['_getService'](_0x202aec){if(!this['_services']['has'](_0x202aec))throw new _0x3d0c02('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0x202aec});return this['_services']['get'](_0x202aec);}async['_fetchMissingUsersForThreads'](_0x357bdf){const _0x1a42ec=this['context']['plugins']['get'](_0x305f5d),{connection:_0x3ee10e}=this['context']['plugins']['get'](c),_0x2995be=new Set();for(const {resolvedBy:_0x1b4013,comments:_0x126bb4}of _0x357bdf){_0x1b4013&&!_0x1a42ec['getUser'](_0x1b4013)&&_0x2995be['add'](_0x1b4013);for(const {userId:_0x4a4c37}of _0x126bb4)_0x1a42ec['getUser'](_0x4a4c37)||_0x2995be['add'](_0x4a4c37);}if(0x0===_0x2995be['size'])return;const _0x427db8=await dt['getMany'](_0x3ee10e,Array['from'](_0x2995be));for(const _0x5b2e86 of _0x427db8)_0x1a42ec['getUser'](_0x5b2e86['id'])||_0x1a42ec['addUser'](_0x5b2e86);}}async function B(_0x5c8811){if('404'!==_0x5c8811['code'])throw _0x5c8811;}function ut(_0x56d36b){if((_0x3501a1=_0x56d36b)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0x3501a1['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x3501a1['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0x3501a1;throw _0x56d36b;}function S(_0x2504c0){return{'threadId':_0x2504c0['commentThreadId'],'commentId':_0x2504c0['commentId'],'content':_0x2504c0['content'],'createdAt':_0x2504c0['createdAt'],'authorId':_0x2504c0['userId'],'attributes':_0x2504c0['attributes']||{}};}class f extends _0x3b81de{static ['TrackChangesService']=/* #__PURE__ -- @preserve */
27
- ((()=>et)());['_bufferedRequests'];['_trackChangesService'];static get['requires'](){return[a,'TrackChangesEditing',c];}static get['pluginName'](){return'CloudServicesTrackChangesAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x56e076){super(_0x56e076);const _0xe3ddc4=this['editor']['config']['get']('collaboration.channelId');this['_bufferedRequests']=new Map(),this['_trackChangesService']=new f['TrackChangesService'](_0xe3ddc4);}['init'](){const _0x831dd1=this['editor']['plugins']['get'](c),_0x1e5ca7=this['editor']['plugins']['get']('TrackChangesEditing');return _0x1e5ca7['adapter']={'getSuggestion':async _0x17dbab=>{await this['_waitForServiceReady']();const _0x548215=await this['_trackChangesService']['get'](_0x17dbab)['catch'](R);return await this['_fetchMissingUsersForThreads']([_0x548215]),_0x548215;},'addSuggestion':async({id:_0x185c40,type:_0x207cbe,data:_0x316a79,originalSuggestionId:_0x579c16,attributes:_0x8ccdbe})=>{await this['_waitForServiceReady']();const _0x31c046={'id':_0x185c40,'type':_0x207cbe,'data':_0x316a79,'originalSuggestionId':_0x579c16,'attributes':_0x8ccdbe},_0x17ece6=await this['_trackChangesService']['add'](_0x185c40,_0x207cbe,_0x316a79,_0x579c16,_0x8ccdbe)['catch'](_0x5a13dd=>{if(ft(_0x5a13dd))return new Promise(_0xf28326=>{this['_bufferedRequests']['set'](_0x185c40,{'resolve':_0xf28326,'suggestionData':_0x31c046});});throw _0x5a13dd;});return this['_bufferedRequests']['delete'](_0x185c40),_0x17ece6;},'updateSuggestion':async(_0x578fa0,_0x6c06a8)=>{if(await this['_waitForServiceReady'](),'open'!==_0x6c06a8['state'])return this['_trackChangesService']['update'](_0x578fa0,_0x6c06a8)['catch'](R);}},this['listenTo'](this['_trackChangesService'],'suggestionUpdated',(_0x2481fa,_0x3ca809)=>{_0x1e5ca7['hasSuggestion'](_0x3ca809['id'])&&(_0x1e5ca7['getSuggestion'](_0x3ca809['id'])['attributes']=_0x3ca809['attributes']);}),this['_trackChangesService']['connect'](_0x831dd1['connection'])['then'](_0x443061=>(_0x831dd1['addToReconnectionStack'](this),this['_fetchMissingUsersForThreads'](_0x443061)['then'](()=>{for(const _0x3cbc12 of _0x443061){_0x1e5ca7['addSuggestionData'](_0x3cbc12)['_saved']=!0x0;}})));}async['reconnect'](){const _0x65b00a=this['editor']['plugins']['get']('TrackChangesEditing'),{connection:_0xe753e4}=this['editor']['plugins']['get'](c),_0x3ee764=await this['_trackChangesService']['connect'](_0xe753e4);await this['_fetchMissingUsersForThreads'](_0x3ee764);for(const {suggestionData:_0x19a384,resolve:_0x3e60c9}of this['_bufferedRequests']['values']()){let _0x2947f3=_0x3ee764['find'](_0x593f59=>_0x593f59['id']===_0x19a384['id']);_0x2947f3||(_0x2947f3=await this['_trackChangesService']['add'](_0x19a384['id'],_0x19a384['type'],_0x19a384['data'],_0x19a384['originalSuggestionId'])),_0x3e60c9(_0x2947f3);}for(const _0x49409d of _0x3ee764)_0x65b00a['hasSuggestion'](_0x49409d['id'])||_0x65b00a['addSuggestionData'](_0x49409d);}async['_waitForServiceReady'](){this['_trackChangesService']['isConnected']||await new Promise(_0x4a356b=>{this['listenTo'](this['_trackChangesService'],'connected',_0x59e3d5=>{_0x59e3d5['off'](),_0x4a356b();});});}async['_fetchMissingUsersForThreads'](_0x945808){const _0x47a164=this['editor']['plugins']['get'](_0x305f5d),{connection:_0x595fb6}=this['editor']['plugins']['get'](c),_0x5028ce=new Set();for(const {authorId:_0x73eb53}of _0x945808)_0x47a164['getUser'](_0x73eb53)||_0x5028ce['add'](_0x73eb53);if(0x0===_0x5028ce['size'])return;const _0x54edd9=await dt['getMany'](_0x595fb6,Array['from'](_0x5028ce));for(const _0x2c675d of _0x54edd9)_0x47a164['getUser'](_0x2c675d['id'])||_0x47a164['addUser'](_0x2c675d);}}function R(_0x2e263c){if(ft(_0x2e263c))return new Promise(()=>{});throw _0x2e263c;}function ft(_0x1ae18){return _0x1ae18['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x1ae18['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class m extends _0x3b81de{static get['requires'](){return['Comments',a,n,c];}static get['pluginName'](){return'RealTimeCollaborativeComments';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x3a858b=this['editor']['plugins']['get'](c),_0x54ae13=this['editor']['plugins']['get']('CommentsEditing'),_0x3e2e12=this['editor']['plugins']['get'](a);return this['editor']['data']['once']('ready',()=>{this['listenTo'](_0x3a858b,'change:state',(_0x198e23,_0x5da1f4,_0x53ed2f)=>{_0x54ae13['isThreadsLoadingPaused']='connected'!==_0x53ed2f;});}),this['listenTo'](_0x3a858b,'change:state',(_0x26cbec,_0x446855,_0x518da1)=>{this['editor']['plugins']['get']('CommentsRepository')['switchReadOnly']('connected'!==_0x518da1);}),_0x3e2e12['_setUpService'](this['editor']['config']['get']('collaboration.channelId'));}['destroy'](){this['editor']['plugins']['get'](a)['_terminateService'](this['editor']['config']['get']('collaboration.channelId')),super['destroy']();}}class p extends _0x3b81de{static get['requires'](){return[m,f,'TrackChanges'];}static get['pluginName'](){return'RealTimeCollaborativeTrackChanges';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class u extends _0x3b81de{static ['RevisionHistoryService']=/* #__PURE__ -- @preserve */
28
- ((()=>it)());['_lastRequestId'];['_revisionTracker'];['_revisionHistoryService'];['_oldOffset'];static get['requires'](){return[c,l,'RevisionTracker',i,_0x305f5d];}static get['pluginName'](){return'CloudServicesRevisionHistoryAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x182690){super(_0x182690);const _0x520cb7=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new u['RevisionHistoryService'](_0x520cb7);}async['init'](){const _0x448922=this['editor']['plugins']['get'](l),_0x550502=_0x448922['serverHistory'],_0x49224c=this['editor']['plugins']['get'](c);this['_revisionTracker']['setSource']({'history':_0x550502,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0x448922['sessionId']});const _0x49f063=this['editor']['config']['get']('cloudServices.bundleVersion')||nt,_0x4fec7a=await tt['isBundleUploaded'](_0x49224c['connection'],_0x49f063);this['_revisionTracker']['adapter']={'getRevision':async({revisionId:_0x531ab})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0x531ab)),'updateRevisions':async _0x77317b=>{await this['_waitForServiceReady']();const _0x593665=this['_revisionTracker']['currentRevision'];if(_0x4fec7a&&0x1===_0x77317b['length']&&_0x77317b[0x0]['id']===_0x593665['id'])return _0x77317b;for(const _0x896c0a of _0x77317b)_0x896c0a['id']===_0x593665['id']&&(_0x896c0a['isEmptyCurrent']=_0x896c0a['fromVersion']===_0x896c0a['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0x77317b,this['_lastRequestId'])['then'](_0xee6018=>(this['_lastRequestId']=_0xee6018,_0x77317b))['catch'](_0x279973=>{if(st(_0x279973)||'400'===_0x279973['code']&&void 0x0!==_0x279973['data']['wrongRequestId']){for(const _0x34f9bd of _0x77317b){!this['_revisionTracker']['repository']['getRevision'](_0x34f9bd['id'])||this['_revisionTracker']['_bufferUpdate'](_0x34f9bd['id'],_0x34f9bd,!0x1);}if(st(_0x279973))throw _0x279973;return _0x77317b;}throw _0x279973;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0x3ebbf5,{revisionsData:_0x30681d,requestId:_0x16da07})=>{Math['max'](..._0x30681d['map'](_0x59c5d8=>_0x59c5d8['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0x30681d,_0x16da07);}):this['_handleRevisionsUpdate'](_0x30681d,_0x16da07);});const {revisions:_0x275a33,requestId:_0x25a5ee}=await this['_revisionHistoryService']['connect'](_0x49224c['connection']);_0x49224c['addToReconnectionStack'](this),this['_lastRequestId']=_0x25a5ee,await this['_fetchMissingUsers'](_0x275a33);for(const _0x4453b6 of _0x275a33)this['_revisionTracker']['addRevisionData'](_0x4453b6);this['listenTo'](_0x448922,'change:_isConnected',(_0x1654e1,_0x5c666b,_0x5a6212)=>{_0x5a6212&&(this['_oldOffset']=_0x448922['_offset'],_0x1654e1['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](_0x49224c,'state',_0x4ad18c=>_0x4ad18c===_0x597b3f['CONNECTED']);}async['reconnect'](){const _0x2b328f=this['editor']['plugins']['get'](c),_0x232bee=this['editor']['plugins']['get'](l),_0x54580f=async()=>{const _0x18e3b4=this['_revisionTracker']['currentRevision'],_0x178fb1=_0x18e3b4['id'],_0x20c85e=_0x178fb1!==_0x232bee['sessionId'];if(_0x20c85e){const _0x510727=_0x232bee['_offset']-this['_oldOffset'],_0x4135fb=this['_getLatestVersionFromServerOperations']();this['_revisionTracker']['_revisionDataBuilder']['reInit']();if(_0x18e3b4['toVersion']+_0x510727!==_0x4135fb){const _0x40a5f8=_0x18e3b4['fromVersion']+_0x510727,_0x514a65=this['editor']['plugins']['get'](_0x305f5d),_0x4bff66=this['_revisionTracker']['buildRevisionData']({'revision':_0x18e3b4,'from':_0x40a5f8,'to':_0x4135fb});_0x4bff66['id']=_0x18e3b4['id'];const _0x4ffbdf=_0x4bff66['authorsIds']['map'](_0x54b5f0=>_0x514a65['getUser'](_0x54b5f0));_0x18e3b4['_update']({..._0x4bff66,'authors':_0x4ffbdf},!0x0),this['_revisionTracker']['_bufferUpdate'](_0x18e3b4['id'],_0x4bff66,!0x0);}this['_revisionTracker']['_startingVersion']=_0x4135fb,(_0x18e3b4['toVersion']===_0x18e3b4['fromVersion']&&!this['_revisionTracker']['_bufferedUpdates']['has'](_0x178fb1)&&this['_revisionTracker']['repository']['_revisions']['remove'](_0x178fb1),this['_revisionTracker']['_createCurrentRevision'](_0x4135fb));}const {revisions:_0x2262a2,requestId:_0x183b3e}=await this['_revisionHistoryService']['reconnect'](_0x2b328f['connection'],this['_lastRequestId']);_0x20c85e&&_0x2262a2['length']>0x0?_0x232bee['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x2262a2),this['_handleRevisionsUpdate'](_0x2262a2,_0x183b3e),this['_revisionTracker']['sendBufferedUpdates']());};return _0x232bee['_isConnected']?_0x54580f():new Promise((_0x4c6dc1,_0x141b9f)=>{_0x232bee['once']('change:_isConnected',()=>{_0x54580f()['then'](_0x4c6dc1)['catch'](_0x141b9f);});});}['destroy'](){super['destroy']();}async['_waitForServiceReady'](){this['_revisionHistoryService']['isConnected']||await new Promise(_0x35edc6=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x5208af=>{_0x5208af['off'](),_0x35edc6();});});}['_getLatestVersionFromServerOperations'](){const _0x3e14ce=this['editor']['plugins']['get'](l)['serverHistory']['getOperations']()['reverse']();for(const _0x273d33 of _0x3e14ce)if('marker'!==_0x273d33['type']||_0x273d33['affectsData'])return _0x273d33['baseVersion']+0x1;}['_getLatestVersion'](){const _0x20e67e=this['editor']['plugins']['get'](l);return new Promise(_0x19372c=>{_0x20e67e['_isPendingUpdate']?_0x20e67e['once']('change:_isPendingUpdate',()=>{_0x19372c(this['_getLatestVersionFromServerOperations']());}):_0x19372c(this['_getLatestVersionFromServerOperations']());});}['_handleRevisionsUpdate'](_0x5cb753,_0x23242b){const _0x44f2b4=this['_revisionTracker']['repository'];this['_lastRequestId']=_0x23242b;for(const _0x37a8dd of _0x5cb753){const _0x40ddb4=_0x44f2b4['getRevision'](_0x37a8dd['id']);if(_0x40ddb4){if((_0x37a8dd['fromVersion']||_0x37a8dd['toVersion'])&&(_0x37a8dd['diffData']=null),_0x40ddb4===this['_revisionTracker']['currentRevision']){const _0x1d9fa6=Math['max'](_0x40ddb4['toVersion'],_0x37a8dd['toVersion']),_0x3ff617=Math['max'](_0x40ddb4['fromVersion'],_0x37a8dd['fromVersion']);let _0x748352;_0x40ddb4['toVersion']===_0x37a8dd['toVersion']&&_0x40ddb4['fromVersion']===_0x37a8dd['fromVersion']?(_0x748352=!0x0,this['_preventResendingRevisionData'](_0x37a8dd)):_0x37a8dd['toVersion']===_0x1d9fa6&&_0x37a8dd['fromVersion']===_0x3ff617?_0x748352=!0x1:(_0x40ddb4['toVersion']===_0x1d9fa6&&_0x40ddb4['fromVersion']===_0x3ff617||this['_fixRevision']({'revision':_0x40ddb4,'from':_0x3ff617,'to':_0x1d9fa6}),_0x748352=!0x0),_0x748352&&(delete _0x37a8dd['fromVersion'],delete _0x37a8dd['toVersion'],delete _0x37a8dd['diffData'],delete _0x37a8dd['createdAt'],delete _0x37a8dd['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0x37a8dd),this['_preventResendingRevisionData'](_0x37a8dd);}else this['_revisionTracker']['addRevisionData'](_0x37a8dd);}const _0xac995a=_0x44f2b4['getRevisions']();_0xac995a['reverse']();for(let _0xa4c290=0x0;_0xa4c290<_0xac995a['length']-0x1;_0xa4c290++){const _0x25ab96=_0xac995a[_0xa4c290],_0x42303d=_0xac995a[_0xa4c290+0x1];if(_0x25ab96['fromVersion']<_0x42303d['toVersion']){const _0x39386f=_0x42303d['toVersion'],_0x3523e6=Math['max'](_0x39386f,_0x25ab96['toVersion']);this['_fixRevision']({'revision':_0x25ab96,'from':_0x39386f,'to':_0x3523e6});}}}['_fixRevision']({revision:_0x11c5e5,from:_0x429d4b,to:_0x5e7867}={}){const _0xa4bc3b=this['editor']['plugins']['get'](_0x305f5d),_0x43cf91=this['_revisionTracker']['buildRevisionData']({'revision':_0x11c5e5,'from':_0x429d4b,'to':_0x5e7867});_0x43cf91['authors']=_0x43cf91['authorsIds']['map'](_0x2ff61b=>_0xa4bc3b['getUser'](_0x2ff61b)),_0x11c5e5['_update'](_0x43cf91);}['_preventResendingRevisionData'](_0x598e46){const _0xcd2dcc={};_0xcd2dcc['id']=_0x598e46['id'];for(const _0x59ddbd of Object['keys'](_0x598e46))'id'!==_0x59ddbd&&(_0xcd2dcc[_0x59ddbd]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0xcd2dcc['id'],_0xcd2dcc,!0x0);}async['_fetchMissingUsers'](_0x374661){const _0x234fa3=this['editor']['plugins']['get'](_0x305f5d),{connection:_0x2de467}=this['editor']['plugins']['get'](c),_0x1a1f52=new Set();for(const _0x5de212 of _0x374661){for(const _0x153774 of _0x5de212['authorsIds'])_0x3f3f9c(_0x153774);_0x5de212['creatorId']&&_0x3f3f9c(_0x5de212['creatorId']);}if(0x0===_0x1a1f52['size'])return;const _0x2699f0=await dt['getMany'](_0x2de467,Array['from'](_0x1a1f52));for(const _0x12d624 of _0x2699f0)_0x234fa3['getUser'](_0x12d624['id'])||_0x234fa3['addUser'](_0x12d624);function _0x3f3f9c(_0x71b7c0){_0x234fa3['getUser'](_0x71b7c0)||_0x1a1f52['add'](_0x71b7c0);}}}function st(_0x483802){return _0x483802['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0x483802['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x483802['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class g extends _0x3b81de{static get['requires'](){return['RevisionHistory',u,n];}static get['pluginName'](){return'RealTimeCollaborativeRevisionHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class ts extends _0x57c216{constructor(_0x539bc6){super(_0x539bc6);const _0x38105d=this['bindTemplate'];this['set']('usersCount',0x0),this['set']('isHidden',!0x0),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__counter',_0x38105d['if']('isHidden','ck-presence-list__counter--hidden')]},'children':[{'text':_0x38105d['to']('usersCount',_0x1f9f69=>q(_0x539bc6,'CONNECTED_USERS',_0x1f9f69))}]});}}class es extends _0x57c216{['items'];['keystrokes'];constructor(_0x2cfeaf){super(_0x2cfeaf);const _0x302678=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0x57d7ba(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0x302678['if']('hasPopup'),'aria-expanded':_0x302678['to']('isExpanded',_0x4643bd=>this['hasPopup']&&String(_0x4643bd)),'aria-label':_0x302678['to']('hasPopup',_0x54f924=>q(_0x2cfeaf,_0x54f924?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0x302678['to']('hasPopup',_0x237930=>!!_0x237930&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items'],'on':{'click':_0x302678['to'](()=>this['fire']('execute'))}}),this['on']('change:hasPopup',(_0xacbac1,_0x145eb1,_0xe54051)=>{this['element']&&(_0xe54051?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']);}}class L extends _0x57c216{['counterView'];['inlineListView'];constructor(_0xa7bce){super(_0xa7bce);const _0x5c9015=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new ts(this['locale']),this['inlineListView']=new es(_0xa7bce),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x5191ae of this['inlineListView']['items'])_0x5191ae['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',_0x5c9015['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['counterView'],this['inlineListView']]});}}class j extends _0x57c216{['listWrapperView'];constructor(_0x27d01a,_0x5434c2){super(_0x27d01a),this['listWrapperView']=new mt(_0x27d01a,_0x5434c2),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':q(_0x27d01a,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']]});}}class mt extends _0x121aff{constructor(_0x44fbd3,_0x494336){super(_0x44fbd3);const _0x1c2d55=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0x494336?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0x1c2d55['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0x1c2d55['to']('role'),'aria-label':_0x1c2d55['to']('ariaLabel'),'aria-labelledby':_0x1c2d55['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0x5a383f['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0x5e15c2=this['element'];_0x5e15c2&&(this['_isScrollable']=Math['max'](_0x5e15c2['scrollHeight'],_0x5e15c2['clientHeight'])>0.8*window['innerHeight']);}}class k extends rt{['userView'];constructor(_0x2cdfa6,_0x4b8918,_0xdc0616){super(_0x2cdfa6);const _0x374632=this['bindTemplate'];this['userView']=new ct(_0x2cdfa6,_0x4b8918);const _0xdcc022={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0x4b8918['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0x4b8918['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x4b8918['color']['getBackgroundColorClass']()],'aria-hidden':'true'}}]};_0xdc0616&&(_0xdcc022['tag']='button',_0xdcc022['on']={'click':_0x374632['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0xdcc022);}['focus'](){this['element']['focus']();}}class y extends _0x57c216{['userView'];['markerView'];constructor(_0x2174e2,_0x594ab2,_0x350e75){super(_0x2174e2);const _0x45e08a=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new ct(_0x2174e2,_0x594ab2),this['markerView']=new at(_0x2174e2,_0x594ab2);const _0x5744cd=new ot(_0x2174e2);_0x5744cd['template']['tag']='span',_0x5744cd['text']=_0x594ab2['name'];const _0x5cd04e={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0x45e08a['to']('isFocusable',_0xfe667=>!!_0xfe667&&0x0),'aria-labelledby':_0x5744cd['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0x45e08a['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0x45e08a['to']('hasTooltip',_0x3b6c9a=>!_0x3b6c9a),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0x5744cd]};_0x350e75&&(_0x5cd04e['tag']='button',_0x5cd04e['on']={'click':_0x45e08a['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x5cd04e);}}class at extends _0x57c216{constructor(_0x289fa3,_0x17af32){super(_0x289fa3),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x17af32['color']['getBackgroundColorClass']()],'aria-hidden':'true'}});}}const A={'collapseAt':0x6,'displayMe':!0x0};class r extends _0x5b046d{['currentDisplayedUsers'];['balloonPanelView'];['view'];['presenceDropdownView'];['_bodyCollection']=null;constructor(_0x2c94ec){super(_0x2c94ec),this['context']['config']['define']('presenceList',A);const _0x578c8d=_0x2c94ec['config']['get']('presenceList.collapseAt');if('number'!=typeof _0x578c8d)throw new _0x3d0c02('presencelist-collapseat-invalid-format',this);if(_0x578c8d<0x1)throw new _0x3d0c02('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](i)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0x3c61b0(),this['balloonPanelView']=new _0x2e4728(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get['requires'](){return[i];}['init'](){for(const _0x35f3ac of this['_allConnectedUsers'])this['_handleUserAdd'](_0x35f3ac);this['listenTo'](this['_allConnectedUsers'],'add',(_0xcfdcd5,_0x372b83)=>{this['_handleUserAdd'](_0x372b83);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0x1c357c,_0x4d23b5)=>{this['_handleUserRemove'](_0x4d23b5);});}['_createView'](){const _0x5d8ea7=this['context'],_0x288bc1=new L(this['context']['locale']),_0x4c0780=this['balloonPanelView'];if(!_0x4c3572(_0x5d8ea7['config']['get']('presenceList.container')))throw new _0x3d0c02('presencelist-missing-container',this);return _0x288bc1['counterView']['bind']('usersCount')['to'](this),_0x288bc1['bind']('isCollapsed')['to'](this,'usersCount',_0x315467=>{const {collapseAt:_0x3b7ff9,displayMe:_0x59e70b}=_0x5d8ea7['config']['get']('presenceList'),_0x30d3e3=_0x315467>=_0x3b7ff9;return _0x288bc1['counterView']['isHidden']=!(0x1==_0x315467&&_0x59e70b||_0x30d3e3),_0x30d3e3||this['hideDropdown'](),_0x30d3e3;}),_0x288bc1['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0x52f658=>{const _0x2d054d=_0x5d8ea7['config']['get']('presenceList'),_0x444b8b=new y(_0x5d8ea7['locale'],_0x52f658,!!_0x2d054d['onClick']);return _0x444b8b['bind']('hasTooltip')['to'](_0x288bc1,'isCollapsed',_0x130753=>!_0x130753),_0x444b8b['bind']('isFocusable')['to'](_0x288bc1,'isCollapsed',_0x284ce8=>!_0x284ce8),_0x2d054d['onClick']&&this['listenTo'](_0x444b8b,'execute',()=>{this['view']['isCollapsed']||_0x2d054d['onClick'](_0x52f658,_0x444b8b['element']);}),_0x444b8b;}),this['listenTo'](_0x288bc1['inlineListView'],'execute',()=>{this['presenceDropdownView']?this['hideDropdown']():this['view']['isCollapsed']&&this['showDropdown']();}),_0x288bc1['inlineListView']['keystrokes']['set']('Enter',(_0x37a008,_0x5988bf)=>{this['view']['isCollapsed']&&(this['showDropdown'](),_0x5988bf());}),_0x288bc1['render'](),_0x4c0780['render'](),_0x18b487({'emitter':_0x288bc1,'activator':()=>_0x4c0780['isVisible'],'contextElements':[_0x4c0780['element'],_0x288bc1['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0x5d8ea7['config']['get']('presenceList.container')['appendChild'](_0x288bc1['element']),this['_bodyCollection']=new _0x2000c1(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_bodyCollection']['add'](this['balloonPanelView']),_0x288bc1;}['_handleUserAdd'](_0x332ddc){if(!this['context']['config']['get']('presenceList.displayMe')&&_0x332ddc['isMe'])return;const _0x83860=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['usersCount']++,this['currentDisplayedUsers']['length']==_0x83860&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](0x1);const _0x21f0a7=_0x332ddc['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0x332ddc,_0x21f0a7);}['_handleUserRemove'](_0x266bb4){if(this['usersCount']--,this['currentDisplayedUsers']['get'](_0x266bb4['id'])&&(this['currentDisplayedUsers']['remove'](_0x266bb4['id']),this['currentDisplayedUsers']['length']<this['usersCount'])){for(const _0x100327 of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0x100327['id']))return void this['currentDisplayedUsers']['add'](_0x100327,Math['min'](this['currentDisplayedUsers']['length'],0x1));}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0x5bbef1=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new j(this['context']['locale'],!!_0x5bbef1['onClick']),this['view']['inlineListView']['isExpanded']=!0x0;const {listWrapperView:_0x515b07}=this['presenceDropdownView'];_0x515b07['items']['bindTo'](this['_allConnectedUsers'])['using'](_0x2603b4=>{if(!_0x5bbef1['displayMe']&&_0x2603b4['isMe'])return null;const _0x3eae13=new k(this['context']['locale'],_0x2603b4,!!_0x5bbef1['onClick']);return _0x5bbef1['onClick']&&this['listenTo'](_0x3eae13,'execute',()=>{_0x5bbef1['onClick'](_0x2603b4,_0x3eae13['element']);}),_0x3eae13;}),this['balloonPanelView']['content']['add'](this['presenceDropdownView']),this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element']}),_0x515b07['focus'](),_0x515b07['checkIfScrollable']();const _0x286aa2=(_0x432347,_0x3429a4)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0x3429a4();};_0x515b07['keystrokes']['set']('Esc',_0x286aa2),_0x515b07['keystrokes']['set']('Shift+Tab',_0x286aa2),_0x515b07['keystrokes']['set']('Tab',(_0x1763fb,_0x1a74ce)=>{!function(_0x15eefa){const _0x541498=['a','button','input','select','textarea','[tabindex]','[contenteditable]']['map'](_0xfd1d22=>_0xfd1d22+':not([disabled]):not([tabindex=\x22-1\x22])')['join'](','),_0x2f9614=[...document['body']['querySelectorAll'](_0x541498)]['filter'](_0x30c900=>_0x30c900===document['activeElement']||_0x30c900['offsetWidth']+_0x30c900['offsetHeight']>0x0)['sort']((_0x4d1e95,_0x5e8810)=>(_0x4d1e95['tabIndex']||0x0)-(_0x5e8810['tabIndex']||0x0)),_0x55737b=_0x2f9614['indexOf'](_0x15eefa),_0x22a269=_0x2f9614[(_0x55737b+0x1)%_0x2f9614['length']];_0x22a269&&_0x22a269['focus']();}(this['view']['element']),this['hideDropdown'](),_0x1a74ce();}),_0x515b07['focusTracker']['add'](this['view']['element']),_0x515b07['focusTracker']['on']('change:isFocused',(_0x46ea8e,_0x3d946d,_0x5a1473)=>{_0x5a1473||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);}}class s extends _0x5b046d{static get['requires'](){return[i,r];}static get['pluginName'](){return'PresenceList';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}export{a as CloudServicesCommentsAdapter,u as CloudServicesRevisionHistoryAdapter,f as CloudServicesTrackChangesAdapter,s as PresenceList,l as RealTimeCollaborationClient,m as RealTimeCollaborativeComments,n as RealTimeCollaborativeEditing,g as RealTimeCollaborativeRevisionHistory,p as RealTimeCollaborativeTrackChanges};
23
+ import{ContextPlugin as _0x42fe86,Plugin as _0x351dbd,PendingActions as _0x13e589,Context as _0x491a95}from'@ckeditor/ckeditor5-core/dist/index.js';import{DomEmitterMixin as _0x5d082f,CKEditorError as _0x1de3e2,Collection as _0x4091d0,global as _0xc36c3b,version as nt,uid as _0x51e690,KeystrokeHandler as _0x2e5d74}from'@ckeditor/ckeditor5-utils/dist/index.js';import{Notification as _0x2465c2,View as _0x37e435,ListView as _0x2a13a2,ListItemView as rt,LabelView as ot,BalloonPanelView as _0x4f3018,clickOutsideHandler as _0xcafd9,BodyCollection as _0x14f09d}from'@ckeditor/ckeditor5-ui/dist/index.js';import{LiveRange as ht,History as _0x4419fd,NoOperation as _0x1f2fc3,InsertOperation as _0x5af536,MarkerOperation as _0x2f8fb3,RootAttributeOperation as _0x23dea2,transformSets as _0x46baf6,OperationFactory as _0x5d5e27}from'@ckeditor/ckeditor5-engine/dist/index.js';import{WebSocketGateway as lt,WEB_SOCKET_GATEWAY_STATES as _0x37aed7,CollaborativeEditingService as _0x162c93,User as dt,CommentsService as _0x5dd5a1,TrackChangesService as et,RevisionHistoryService as it,EditorService as tt}from'@ckeditor/ckeditor-cloud-services-collaboration/dist/index.js';import{Users as _0x326329,UserView as ct}from'ckeditor5-collaboration/dist/index.js';import{Compressor as _0x40c4d4}from'@ckeditor/ckeditor5-operations-compressor/dist/index.js';import{isElement as _0x4a3110}from'lodash-es';class c extends _0x42fe86{static ['WebSocketGateway']=/* #__PURE__ -- @preserve */
24
+ ((()=>lt)());static ['initialReconnectionInterval']=0x3e8;['connection'];['_reconnectionStack'];['_shouldPluginsReconnect'];['_domEmitter'];static get['requires'](){return['CloudServices',_0x2465c2];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x5cd85e){super(_0x5cd85e),this['set']('state',_0x37aed7['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=Object['create'](_0x5d082f);}['init'](){const _0x51d107=this['context'],_0x2224b8=_0x51d107['plugins']['get']('CloudServices'),_0x7ca51f=_0x51d107['plugins']['get'](_0x2465c2);if(!_0x2224b8['token'])throw new _0x1de3e2('websocketgateway-missing-token',this);if(!_0x2224b8['webSocketUrl'])throw new _0x1de3e2('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),c['WebSocketGateway']['connect'](_0x2224b8['token'],_0x2224b8['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0x34c04e=>{if(this['connection']=_0x34c04e,this['bind']('state')['to'](_0x34c04e,'state',this,'_isBrowserOffline',(_0x42b42b,_0x12cd51)=>('connected'!==_0x42b42b&&(this['_shouldPluginsReconnect']=!0x0),_0x12cd51||_0x42b42b!==_0x37aed7['CONNECTED']?_0x37aed7['DISCONNECTED']:this['state']==_0x37aed7['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),_0x37aed7['CONNECTING']):_0x37aed7['CONNECTED'])),this['connection']['on']('error',(_0x47b728,_0x19e28f)=>{if('limitExceeded'!==_0x19e28f['code'])throw console['error'](_0x19e28f),new _0x1de3e2('cloudservices-init',null,{'originalError':_0x19e28f});_0x7ca51f['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'});}),!_0x34c04e['me'])return new Promise(_0x47242e=>_0x34c04e['on']('change:me',_0x47242e));})['catch'](_0x55dada=>{throw console['error'](_0x55dada),new _0x1de3e2('cloudservices-init',null,{'originalError':_0x55dada});});}['addToReconnectionStack'](_0x54f723){if('function'!=typeof _0x54f723['reconnect'])throw new _0x1de3e2('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0x54f723))throw new _0x1de3e2('websocketgateway-plugin-already-registered',this,{'name':_0x54f723['constructor']['pluginName']});this['_reconnectionStack']['add'](_0x54f723);}['removeFromReconnectionStack'](_0x3cce3c){this['_reconnectionStack']['delete'](_0x3cce3c);}['isInReconnectionStack'](_0x1d99ea){return this['_reconnectionStack']['has'](_0x1d99ea);}['_reconnect'](){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0x49a7f5=>_0x49a7f5['reconnect']())))['then'](()=>this['state']=_0x37aed7['CONNECTED'])['catch'](_0xe650bc=>{throw console['error'](_0xe650bc),new _0x1de3e2('cloudservices-reconnection-error',this['context']);});}['destroy'](){this['connection']&&this['connection']['disconnect'](),this['state']=_0x37aed7['DISCONNECTED'],this['_domEmitter']['stopListening'](),super['destroy']();}}class i extends _0x42fe86{['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[c,_0x326329];}constructor(_0x22b8eb){super(_0x22b8eb),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0x4091d0(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x326329);}['init'](){const _0x208a6c=this['context']['plugins']['get'](c);this['listenTo'](_0x208a6c,'change:state',(_0x36a561,_0xd0ae5,_0x2e0d56)=>{if('connected'!==_0x2e0d56)this['channelSessions']['forEach'](_0x58baba=>_0x58baba['clear']()),this['channelConnectedUsers']['forEach'](_0x2f35f1=>_0x2f35f1['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x1e5be4,_0x4c80c3]of this['_registeredSessions'])for(const _0x384675 of _0x4c80c3)this['_handleSessionAdd'](_0x1e5be4,_0x384675);}}),this['_createUser'](_0x208a6c['connection']['me'],!0x0);}['register'](_0x1a6bf0,_0x552ce2){if(this['_registeredSessions']['has'](_0x1a6bf0))throw new _0x1de3e2('sessions-register-already-registered',null,{'channelId':_0x1a6bf0});this['_registeredSessions']['set'](_0x1a6bf0,_0x552ce2),this['channelSessions']['set'](_0x1a6bf0,new _0x4091d0()),this['channelConnectedUsers']['set'](_0x1a6bf0,new _0x4091d0()),this['listenTo'](_0x552ce2,'add',(_0x172489,_0x2ce860)=>this['_handleSessionAdd'](_0x1a6bf0,_0x2ce860)),this['listenTo'](_0x552ce2,'remove',(_0x507112,_0x3d0bcf)=>this['_handleSessionRemove'](_0x1a6bf0,_0x3d0bcf));for(const _0x340a65 of _0x552ce2)this['_handleSessionAdd'](_0x1a6bf0,_0x340a65);}['unregister'](_0x6c1a34){if(!this['_registeredSessions']['has'](_0x6c1a34))throw new _0x1de3e2('sessions-unregister-not-exist',null,{'channelId':_0x6c1a34});const _0x5a4a4c=this['_registeredSessions']['get'](_0x6c1a34);this['stopListening'](_0x5a4a4c);for(const _0x592a5d of _0x5a4a4c)'connected'===this['context']['plugins']['get'](c)['state']&&this['_handleSessionRemove'](_0x6c1a34,_0x592a5d);this['_registeredSessions']['delete'](_0x6c1a34),this['channelSessions']['delete'](_0x6c1a34),this['channelConnectedUsers']['delete'](_0x6c1a34);}get['mySessionId'](){return this['context']['plugins']['get'](c)['connection']['sessionId'];}['getUserBySessionId'](_0x665d9d){for(const _0x2a6320 of this['channelSessions']['values']())for(const _0x51394c of _0x2a6320)if(_0x51394c['id']===_0x665d9d)return _0x51394c['user'];}['getUserSessions'](_0x4dd052,_0x29c4d3){const _0x1e8caf=_0x29c4d3?[this['channelSessions']['get'](_0x29c4d3)]:this['channelSessions']['values'](),_0x3fc8ff=new Set();for(const _0x376fd5 of _0x1e8caf)for(const _0x143250 of _0x376fd5)_0x143250['user']['id']===_0x4dd052['id']&&_0x3fc8ff['add'](_0x143250['id']);return _0x3fc8ff;}['getUserRole'](_0x382199){for(const _0x360c6e of this['channelSessions']['values']())for(const _0x5317d0 of _0x360c6e)if(_0x5317d0['user']===_0x382199)return _0x5317d0['role'];}['_handleSessionAdd'](_0x2272d5,_0xee648b){if('connected'!==this['context']['plugins']['get'](c)['state'])return;const _0x59fb41=_0xee648b['user'],_0x57bf3d=this['_users']['getUser'](_0x59fb41['id'])||this['_createUser'](_0x59fb41),_0x25804d=Object['assign']({},_0xee648b,{'user':_0x57bf3d});this['channelSessions']['get'](_0x2272d5)['add'](_0x25804d);const _0x25dcfb=this['channelConnectedUsers']['get'](_0x2272d5);_0x25dcfb['has'](_0x57bf3d['id'])||_0x25dcfb['add'](_0x57bf3d),this['allConnectedUsers']['has'](_0x57bf3d['id'])||this['allConnectedUsers']['add'](_0x57bf3d,_0x57bf3d['isMe']?0x0:void 0x0),this['fire']('sessionAdd:'+_0x2272d5,{'channelId':_0x2272d5,'session':_0x25804d});}['_handleSessionRemove'](_0x57f574,_0x1fccad){if('connected'!==this['context']['plugins']['get'](c)['state'])return;const _0x10018c=this['channelConnectedUsers']['get'](_0x57f574),_0x1a8f11=_0x1fccad['user'];_0x1a8f11['id']&&(this['channelSessions']['get'](_0x57f574)['remove'](_0x1fccad['id']),_0x10018c['has'](_0x1a8f11['id'])&&!this['getUserSessions'](_0x1a8f11,_0x57f574)['size']&&_0x10018c['remove'](_0x1a8f11['id']),this['allConnectedUsers']['get'](_0x1a8f11['id'])&&!this['getUserSessions'](_0x1a8f11)['size']&&this['allConnectedUsers']['remove'](_0x1a8f11['id']));}['_createUser'](_0x44e46f,_0x21bae4){const _0x27dda4=this['_users']['addUser'](_0x44e46f);return _0x21bae4&&this['_users']['defineMe'](_0x44e46f['id']),_0x27dda4['orderNumber']=this['_uniqueUsersCount']++,_0x27dda4;}}class H extends _0x351dbd{['_domEmitter']=new(_0x5d082f())();static get['requires'](){return[i];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x440170=this['editor'],_0x303e63=_0x440170['plugins']['get'](i);_0x440170['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x572936,{writer:_0x4a03e4})=>function(_0x189385,_0x7f4b67,_0x491bea,_0x428e0a){const _0x17f377=_0x189385['markerName']['split'](':')[0x2],_0x5aca04=_0x491bea['getUserBySessionId'](_0x17f377);if(!_0x5aca04||_0x17f377===_0x491bea['mySessionId'])return;if(!_0x428e0a['model']['schema']['checkChild'](_0x189385['markerRange']['start'],'$text'))return;const _0x5d6cf1={'class':'ck-user__marker\x20'+_0x5aca04['color']['getMarkerClass'](),'data-name':_0x5aca04['name'],'data-session-id':_0x17f377},_0x15621c=_0x428e0a['model']['markers']['get'](_0x189385['markerName']),_0x5ea647=_0x15621c['getStart'](),_0x17056b=_0x5ea647['nodeAfter'],_0x4fed20=_0x428e0a['model']['schema'];if(_0x17056b&&_0x4fed20['isObject'](_0x17056b)&&_0x4fed20['isInline'](_0x17056b)&&!_0x428e0a['model']['markers']['get']('user:range:'+_0x17f377)['getRange']()['isCollapsed'])return;const _0x23ff61=_0x5ea647['parent'];return _0x428e0a['model']['schema']['isLimit'](_0x23ff61)&&!_0x428e0a['model']['hasContent'](_0x23ff61)&&(_0x5d6cf1['contenteditable']=!0x1),function(_0x53016d,_0x348296,_0x2b4922){const _0x33cc26=_0x53016d['createUIElement']('span',_0x348296);return _0x53016d['setCustomProperty']('userPositionMarker',!0x0,_0x33cc26),_0x33cc26['render']=function(_0x457828){const _0xc7b93b=this['toDomElement'](_0x457828);return _0xc7b93b['innerHTML']='⁠<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span><span\x20class=\x22ck-user__marker-tooltip\x22\x20contenteditable=\x22false\x22\x20spellcheck=\x22false\x22>'+_0x2b4922['name']+'</span>⁠',_0xc7b93b['addEventListener']('mouseenter',()=>{_0xc7b93b['classList']['add']('ck-user__marker_hovered');}),_0xc7b93b['addEventListener']('mouseleave',()=>{_0xc7b93b['classList']['remove']('ck-user__marker_hovered');}),_0xc7b93b;},_0x33cc26['isSimilar']=function(_0x1e20fb){return!(!this['getCustomProperty']('userPositionMarker')||!_0x1e20fb['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0x1e20fb['getAttribute']('data-session-id'));},_0x33cc26;}(_0x7f4b67,_0x5d6cf1,_0x5aca04);}(_0x572936,_0x4a03e4,_0x303e63,_0x440170)}),_0x440170['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0x4a50c0=>function(_0x2d7897,_0x369d9a){const _0x487f0d=_0x2d7897['markerName']['split'](':')[0x2];if(_0x487f0d===_0x369d9a['mySessionId'])return null;const _0x353bf8=_0x369d9a['getUserBySessionId'](_0x487f0d);if(!_0x353bf8)return{'id':_0x487f0d,'classes':[]};return{'id':_0x487f0d,'classes':['ck-user__selection',_0x353bf8['color']['getSelectionClass']()],'attributes':{'data-session-id':_0x487f0d},'priority':0x7d0+_0x353bf8['orderNumber']};}(_0x4a50c0,_0x303e63)}),function(_0x1ed6ee){const _0x4d93b6=_0x1ed6ee['model'],_0xede308=new Map(),_0x1301b9=_0x1ed6ee['plugins']['get'](i);_0x4d93b6['markers']['on']('update:user:range',(_0x172a50,_0xce6da5,_0x443a88,_0x5cfe9c)=>{if(!_0x5cfe9c&&_0xede308['get'](_0xce6da5['name']))return _0xede308['get'](_0xce6da5['name'])['detach'](),void _0xede308['delete'](_0xce6da5['name']);const _0x39c6e1=_0xce6da5['name']['split'](':')[0x2];if(_0x39c6e1===_0x1301b9['mySessionId'])return;const _0x1edf58='user:position:'+_0x39c6e1;_0x4d93b6['markers']['has'](_0x1edf58)&&_0x1ed6ee['editing']['reconvertMarker'](_0x1edf58),_0xce6da5['on']('change:range',(_0x5c9a6f,_0x1427b0,_0x1f150d)=>{if('$graveyard'!=_0x1427b0['root']['rootName']&&'$graveyard'==_0xce6da5['getRange']()['root']['rootName']&&!_0xede308['has'](_0xce6da5['name'])){const _0x9b618e=_0x4d93b6['schema']['getNearestSelectionRange'](_0x1f150d['deletionPosition']);if(_0x9b618e){const _0x36c6ba=ht['fromRange'](_0x9b618e);_0xede308['set'](_0xce6da5['name'],_0x36c6ba),_0x36c6ba['on']('change:range',(_0x1d714d,_0x3553d1,_0x165192)=>{if('$graveyard'==_0x36c6ba['root']['rootName']){const _0xe8b115=_0x4d93b6['schema']['getNearestSelectionRange'](_0x165192['deletionPosition']);_0xe8b115?(_0x36c6ba['start']=_0xe8b115['start'],_0x36c6ba['end']=_0xe8b115['end']):(_0xede308['delete'](_0xce6da5['name']),_0x36c6ba['detach']());}});}}});}),_0x4d93b6['document']['on']('change',()=>{_0xede308['size']>0x0&&_0x4d93b6['enqueueChange']({'isUndoable':!0x1},_0x3a6f34=>{for(const [_0x30afaa,_0x2bccbf]of _0xede308)'$graveyard'==_0x4d93b6['markers']['get'](_0x30afaa)['getRange']()['root']['rootName']&&(re(_0x30afaa['split'](':')[0x2],_0x2bccbf['toRange'](),_0x4d93b6,_0x3a6f34),_0x2bccbf['detach']());_0xede308['clear']();});});}(_0x440170),this['_domEmitter']['listenTo'](_0xc36c3b['document'],'keydown',(_0x5f0dfd,{key:_0x586304})=>{'Escape'===_0x586304&&function(_0xac0a6f){_0xac0a6f['editing']['view']['change'](_0x433dd3=>{for(const _0x7ad20d of _0xac0a6f['model']['markers']){if(!_0x7ad20d['name']['startsWith']('user:position'))continue;const _0x483e7e=_0xac0a6f['editing']['mapper']['markerNameToElements'](_0x7ad20d['name']);if(_0x483e7e){for(const _0xe24373 of _0x483e7e)_0x433dd3['removeClass']('ck-user__marker_hovered',_0xe24373);}}});}(_0x440170);},{'useCapture':!0x0});}['afterInit'](){const _0x55c80=this['editor'],_0x25a9a0=_0x55c80['commands']['get']('undo');_0x25a9a0&&_0x55c80['model']['on']('applyOperation',(_0x241ceb,_0x332f22)=>{const _0x38fbad=_0x332f22[0x0];if('marker'!=_0x38fbad['type']||!_0x38fbad['name']['startsWith']('user:'))return;const _0x2f73a5=_0x38fbad['batch'];_0x25a9a0['_createdBatches']['has'](_0x2f73a5)&&(_0x38fbad['newRange']=_0x38fbad['oldRange']?_0x55c80['model']['createRange'](_0x38fbad['oldRange']['start'],_0x38fbad['oldRange']['end']):null);},{'priority':'highest'});}['destroy'](){return this['_domEmitter']['stopListening'](),super['destroy']();}['createUserMarkerOperations'](){const _0x5e095f=this['editor'],_0x3a7f3c=_0x5e095f['model']['document'],_0x18cb2b=_0x5e095f['plugins']['get'](i);_0x5e095f['model']['enqueueChange']({'isUndoable':!0x1},_0x5abf1d=>{const _0x20d1a1='user:range:'+_0x18cb2b['mySessionId'],_0x4f8076='user:position:'+_0x18cb2b['mySessionId'],_0x2430fa=_0x5e095f['model']['markers']['has'](_0x20d1a1);_0x5e095f['editing']['view']['hasDomSelection']?re(_0x18cb2b['mySessionId'],_0x3a7f3c['selection']['getFirstRange'](),_0x5e095f['model'],_0x5abf1d):_0x2430fa&&(_0x5abf1d['removeMarker'](_0x20d1a1),_0x5abf1d['removeMarker'](_0x4f8076));});}}function re(_0x2df9fe,_0x2005e8,_0x1cffa3,_0x2d295a){const _0xe0370b='user:range:'+_0x2df9fe,_0x46b692='user:position:'+_0x2df9fe,_0x2af5d7=_0x2005e8['getContainedElement']();let _0x1dd686=_0x2005e8['start'];_0x2af5d7&&_0x2af5d7['is']('element','tableCell')&&(_0x1dd686=function(_0x522858,_0x3b0d28){for(const _0x1e692e of _0x522858['getPositions']())if(_0x3b0d28['schema']['checkChild'](_0x1e692e,'$text'))return _0x1e692e;}(_0x2005e8,_0x1cffa3),_0x2005e8=_0x2d295a['createRange'](_0x1dd686));const _0x57fcfb=_0x2d295a['createRange'](_0x1dd686);_0x1cffa3['markers']['has'](_0xe0370b)?(_0x2d295a['updateMarker'](_0xe0370b,{'range':_0x2005e8}),_0x2d295a['updateMarker'](_0x46b692,{'range':_0x57fcfb})):(_0x2d295a['addMarker'](_0xe0370b,{'range':_0x2005e8,'usingOperation':!0x0}),_0x2d295a['addMarker'](_0x46b692,{'range':_0x57fcfb,'usingOperation':!0x0}));}function q(_0x5a06fa,_0x435369,_0x226564){const _0x1531ca=_0x5a06fa['t'],t=_0x5a06fa['t'];switch(_0x435369){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 _0x1531ca({'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'},_0x226564);default:return'';}}let K=0x1;class l extends _0x351dbd{static ['CollaborativeEditingService']=/* #__PURE__ -- @preserve */
25
+ ((()=>_0x162c93)());['_offset'];['sessionId'];['serverHistory'];['_channelId'];['_service'];['_document'];['_compressor'];['_bufferedOperations'];['_knownOperations'];['_knownRootNames'];['_pendingAction'];['_hasSelectionChanged'];['_sendBufferedOperationsDelayId'];['_baseBufferDelay'];['_currentBufferDelay'];['_lastSyncedOperationId'];['_disconnectionOperations'];['_operationIdentifier'];static get['requires'](){return[c,i,H,_0x13e589,_0x326329,_0x2465c2];}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 _0x5d46d5=this['serverHistory']['getOperations']();for(let _0x51b162=_0x5d46d5['length']-0x1;_0x51b162>=0x0;_0x51b162--){const _0x4dade2=_0x5d46d5[_0x51b162];if(!this['_disconnectionOperations']['has'](_0x4dade2))return _0x4dade2['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0x3d7b03){if(super(_0x3d7b03),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x4419fd(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0x1de3e2('collaboration-missing-channelid',this);const _0x5c01d6=_0x3d7b03['config']['get']('cloudServices.bundleVersion')||nt;this['_service']=new l['CollaborativeEditingService'](_0x5c01d6,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0x40c4d4(),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 X(this['_disconnectionOperations']);}['init'](){const _0x426436=this['editor'],_0x58798a=_0x426436['plugins']['get'](_0x326329),_0x5beddb=_0x426436['plugins']['get'](c);this['listenTo'](_0x58798a,'getOperationAuthor',(_0xcf1bd9,_0x563a42)=>{const _0x56f95d=_0x563a42[0x0];_0x56f95d['_authorId']&&(_0xcf1bd9['return']=_0x58798a['getUser'](_0x56f95d['_authorId']),_0xcf1bd9['stop']()),null===_0x56f95d['_authorId']&&(_0xcf1bd9['return']=null,_0xcf1bd9['stop']());},{'priority':'high'}),this['listenTo'](_0x426436['model']['document']['selection'],'change:range',(_0x4de7d2,_0x4ef92e)=>{_0x4ef92e['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x426436['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x426436['model']['on']('applyOperation',(_0x3be830,_0x364b86)=>{const _0x109198=_0x364b86[0x0];_0x109198['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0x109198),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['bind']('_isEditingAllowed')['to'](_0x5beddb,'state',this,'_hasSynchronizationProblem',(_0x56efd5,_0x9aaf08)=>'connected'===_0x56efd5&&!_0x9aaf08),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x426436['disableReadOnlyMode']('rtc-offline'):_0x426436['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x426436['disableReadOnlyMode']('rtc-offline'):_0x426436['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async['reconnect'](){const _0xcf761b=this['editor']['plugins']['get'](i),_0x1c28e4=this['editor']['plugins']['get'](c);try{this['_isPendingUpdate']=!0x0,_0xcf761b['unregister'](this['_channelId']);const _0x7d7619=await this['_service']['reconnect'](_0x1c28e4['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0x7d7619)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x524184=await this['_service']['getConnectedSessions']();_0xcf761b['register'](this['_channelId'],_0x524184),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x2d354b){if(function(_0x14500e){return'404'===_0x14500e['code'];}(_0x2d354b)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0x14a97c){return'409'===_0x14a97c['code'];}(_0x2d354b)){const _0xd35950=q(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'](_0xd35950);}else{if(!(_0x2d354b instanceof J))throw _0x2d354b;this['_handleReconnectionError']();}}}}['destroy'](){const _0x446205=this['editor']['plugins']['get'](c),_0x39a7c2=this['editor']['plugins']['get'](i);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x39a7c2['channelSessions']['has'](this['_channelId'])&&_0x39a7c2['unregister'](this['_channelId']),_0x446205['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async['_handleReconnectionResponse'](_0x203e61){if(this['sessionId']!==_0x203e61['sessionId']&&this['_lastSyncedOperationId']!==_0x203e61['lastOperationId'])throw new J();return this['sessionId']=_0x203e61['sessionId'],this['_handleServerResponse']([],{..._0x203e61,'wereChangesApplied':!0x1,'data':_0x203e61['data']},'reconnect');}async['_connectService'](_0x7b1e0b,_0xdabd75=!0x1){const {connection:_0x6e2850}=this['editor']['plugins']['get'](c);l['CollaborativeEditingService']['getConnectedSessions'](_0x6e2850,this['_channelId'])['then'](_0x5d5fb9=>this['_initSessionsHandling'](_0x5d5fb9))['catch'](_0x590998=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x590998);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x23584a,_0x5c1cb5)=>{this['_crash']('realtimecollaborationclient-initservice-internal-error',_0x5c1cb5);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_isConnected']=!0x1;});const _0x6a2c92=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x7b1e0b);this['_isPendingUpdate']=!0x0;const _0x1fc258=await this['_service']['connect'](_0x6e2850,this['_compressOperations'](_0x7b1e0b),_0x6a2c92);if(this['sessionId']=_0x1fc258['sessionId'],_0xdabd75){if(!_0x1fc258['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x1fc258['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0x7b1e0b,_0x1fc258,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x1fc258,_0x7b1e0b);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}['_handleSendingSelectionMarkers'](){const _0x4faeb9=this['editor']['plugins']['get'](i),_0x4680cd=this['editor']['plugins']['get'](H),_0x52e3e7=_0x4faeb9['channelSessions']['get'](this['_channelId']);_0x52e3e7&&_0x52e3e7['length']>0x1?_0x4680cd['createUserMarkerOperations']():this['listenTo'](_0x4faeb9,'sessionAdd:'+this['_channelId'],()=>{0x2===_0x4faeb9['channelSessions']['get'](this['_channelId'])['length']&&_0x4680cd['createUserMarkerOperations']();});}async['_handleReceivedOperations'](_0x23393d,_0xcce2e4,_0x5e9468,_0x3435ab){if(!this['_isPendingUpdate']&&this['_document']['version']==_0xcce2e4){const _0x22fb93=this['_decompressOperations'](_0x5e9468,_0x3435ab);await this['_fetchMissingUsers'](_0x22fb93),this['_handleExternalOperations'](_0x22fb93,_0xcce2e4,_0x5e9468['lastOperationId'])||this['_crash']('realtimecollaborationclient-initservice-incorrect-server-operation');}}async['_connectAfterSessionHasBeenFlushed'](){this['_disconnectService']();const {locale:_0x32e9bb}=this['editor'];let _0x1e4b46;try{_0x1e4b46=await this['_service']['getDocumentDetails']();}catch(_0x20c090){const _0x3f6a35=q(_0x32e9bb,'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'](_0x3f6a35);}const _0x168680=_0x1e4b46['currentDocumentSession']||_0x1e4b46['lastDocumentSession'];if(this['_lastSyncedOperationId']===_0x168680['lastOperationId'])await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);else{const _0x16a45d=q(_0x32e9bb,'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.');this['_handleReconnectionError'](_0x16a45d);}}['_disconnectService'](){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['stopListening'](this['_service']);}['_initSessionsHandling'](_0x51f928){const _0x8520ae=this['editor']['plugins']['get'](i);this['listenTo'](_0x8520ae,'sessionAdd:'+this['_channelId'],(_0x553316,{session:_0x781e8c})=>{if(_0x781e8c['id']===_0x8520ae['mySessionId']){_0x553316['off']();const _0x25ee1a=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0x49b5a6=_0x781e8c['permissions'];_0x25ee1a&&_0x25ee1a['isEnabled']&&(_0x49b5a6=_0x49b5a6['filter'](_0x357d78=>'document:write'!==_0x357d78)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0x49b5a6,this['_channelId']);}}),_0x8520ae['register'](this['_channelId'],_0x51f928);}['_initThrowingOnDataSet'](){const _0x59843b=this['editor']['data']['set'];this['editor']['data']['set']=(..._0x233699)=>{if(!_0x233699[_0x233699['length']-0x1]['suppressErrorInCollaboration'])throw new _0x1de3e2('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x59843b['apply'](this['editor']['data'],_0x233699);};}['_setUpDataInit'](){this['editor']['data']['on']('init',(_0x3ae0fa,[_0x37fd93])=>{if(this['_document']['version'])throw new _0x1de3e2('realtimecollaborationclient-init-document-already-initialized',this);_0x3ae0fa['stop'](),this['_setPendingAction']();const _0x7b4ca=this['editor']['config']['get']('rootsAttributes'),_0x5e3a84=this['_getOperationsFromInitData'](_0x37fd93,_0x7b4ca);0x0==_0x5e3a84['length']&&_0x5e3a84['push'](new _0x1f2fc3(0x0)),_0x3ae0fa['return']=this['_connectService'](_0x5e3a84)['then'](()=>{this['editor']['plugins']['get'](c)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x52b7c6=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x52b7c6))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x56abb2,[_0x1f0c3f,_0x3c8e77])=>{_0x56abb2['stop']();const _0x1b37be=this['editor']['model']['document']['getRoot'](_0x1f0c3f);if(!this['_knownRootNames']['has'](_0x1f0c3f)){const _0x4d76e5=_0x3c8e77&&_0x3c8e77['data']?_0x3c8e77['data']:'',_0x1051a0=_0x3c8e77&&_0x3c8e77['attributes']?_0x3c8e77['attributes']:{};await this['_loadRoot'](_0x1f0c3f,_0x4d76e5,_0x1051a0);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0x1b37be['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0x1b37be);});},{'priority':'high'});}async['_fetchMissingUsers'](_0x47d27e){const _0x292d41=this['editor']['plugins']['get'](_0x326329),{connection:_0x509e81}=this['editor']['plugins']['get'](c),_0x5c765b=new Set();for(const _0x21b267 of _0x47d27e){const _0x31683d=_0x21b267['_authorId'];_0x31683d&&!_0x292d41['getUser'](_0x31683d)&&_0x5c765b['add'](_0x31683d);}if(0x0===_0x5c765b['size'])return;const _0x3735cd=await dt['getMany'](_0x509e81,Array['from'](_0x5c765b));for(const _0x11937e of _0x3735cd)_0x292d41['getUser'](_0x11937e['id'])||_0x292d41['addUser'](_0x11937e);}['_getOperationsFromInitData'](_0x319be2,_0x23dfb4={}){const _0x5732b9=this['editor']['model'],_0x11c86e=[];let _0x240278=0x0;const _0x1295a9='string'==typeof _0x319be2?{'main':_0x319be2}:_0x319be2;for(const _0x571f99 of Object['keys'](_0x1295a9)){if(!this['_document']['roots']['has'](_0x571f99))throw new _0x1de3e2('realtimecollaborationclient-init-non-existent-root',this);const _0x2240fd=this['editor']['data']['parse'](_0x1295a9[_0x571f99]),_0x45dfa6=this['_document']['getRoot'](_0x571f99),_0x1a6c72=new _0x5af536(_0x5732b9['createPositionAt'](_0x45dfa6,0x0),_0x2240fd,_0x240278++);_0x11c86e['push'](_0x1a6c72);for(const [_0xf58962,_0x12ae39]of _0x2240fd['markers']){const _0x4f78f6=_0x5732b9['createRange'](_0x5732b9['createPositionFromPath'](_0x45dfa6,_0x12ae39['start']['path']['slice']()),_0x5732b9['createPositionFromPath'](_0x45dfa6,_0x12ae39['end']['path']['slice']())),_0x56e015=new _0x2f8fb3(_0xf58962,null,_0x4f78f6,_0x5732b9['markers'],!0x0,_0x240278++);_0x11c86e['push'](_0x56e015);}}if(_0x23dfb4)for(const [_0x11443e,_0x3fcb90]of Object['entries'](_0x23dfb4)){const _0x17f12d=_0x5732b9['document']['getRoot'](_0x11443e);if(!_0x17f12d)throw new _0x1de3e2('multi-root-editor-root-attributes-no-root',null);for(const [_0x2e6554,_0x48d6fd]of Object['entries'](_0x3fcb90))if(null!==_0x48d6fd){const _0x2a6ef1=new _0x23dea2(_0x17f12d,_0x2e6554,null,_0x48d6fd,_0x240278++);_0x11c86e['push'](_0x2a6ef1);}}return _0x11c86e;}async['_loadRoot'](_0x59b18b,_0x343127,_0x4d428b){this['_getOperationsFromInitData']({[_0x59b18b]:_0x343127},{[_0x59b18b]:_0x4d428b})['forEach']((_0xa3463e,_0x388807)=>{_0xa3463e['baseVersion']=this['_document']['version']+_0x388807,_0xa3463e['_isInit']=!0x0,this['_saveOperationInBuffer'](_0xa3463e);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async['_handleInitialConnectionData'](_0x2ec984,_0x5f2281){let _0x3906fa;this['_offset']=_0x2ec984['offset'];const _0x5dfc13=_0x2ec984['wereChangesApplied']&&!_0x2ec984['initData'],_0xbac153=_0x5dfc13?0x0:_0x2ec984['data']['baseVersion'];if(_0x5f2281['forEach'](_0x4341f5=>{_0x4341f5['_isInit']=!0x0,_0x4341f5['createdAt']=_0x2ec984['sessionCreatedAt'],_0x4341f5['_authorId']=null;}),_0x5dfc13)_0x3906fa=_0x5f2281,this['_applyOperationsSet'](_0x3906fa,_0x5dfc13);else{if(_0x2ec984['initData']){const _0x2e5892=this['_getOperationsFromInitData'](_0x2ec984['initData']);this['_document']['history']['version']=-_0x2e5892['length'],_0x2e5892['forEach'](_0x35fb5d=>{_0x35fb5d['baseVersion']-=_0x2e5892['length'],_0x35fb5d['createdAt']=_0x2ec984['sessionCreatedAt'],_0x35fb5d['_isInit']=!0x0,_0x35fb5d['_authorId']=null;}),this['_applyOperationsSet'](_0x2e5892,!0x0),this['serverHistory']['version']=-_0x2e5892['length']+this['_offset'],this['_updateServerHistory'](_0x2e5892);}this['_document']['history']['version']=_0xbac153,_0x3906fa=this['_decompressOperations'](_0x2ec984['data'],_0x2ec984['metadata']),await this['_fetchMissingUsers'](_0x3906fa),this['_applyOperationsSet'](_0x3906fa,_0x5dfc13);}_0x2ec984['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x3906fa,_0x2ec984['lastOperationId']),this['_lastSyncedOperationId']=_0x2ec984['lastOperationId']),this['serverHistory']['version']=_0xbac153+this['_offset'],this['_updateServerHistory'](_0x3906fa),_0x5f2281['filter'](_0x463c9a=>{const _0x26fe66=this['_getAffectedRoot'](_0x463c9a);return _0x26fe66&&!this['_knownRootNames']['has'](_0x26fe66);})['forEach']((_0x1b5a14,_0x4ebbfc)=>{_0x1b5a14['baseVersion']=this['_document']['version']+_0x4ebbfc,this['_saveOperationInBuffer'](_0x1b5a14);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x508ea9,_0x2a0241,_0x188721){throw this['_isPendingUpdate']=!0x0,_0x2a0241&&console['error'](_0x2a0241),_0x188721&&this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0x1de3e2(_0x508ea9,this['editor']);}['_saveOperationInBuffer'](_0x1931af){this['_knownOperations']['has'](_0x1931af)||(this['_knownOperations']['add'](_0x1931af),this['_bufferedOperations']['push'](_0x1931af),this['_pendingAction']||'marker'==_0x1931af['type']&&!_0x1931af['affectsData']||this['_setPendingAction']());}['_sendBufferedOperationsDelayed'](_0x25decb=!0x1){!_0x25decb&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0x15dfd1=>{_0x15dfd1&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0x428938=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0xad1753){return _0xad1753['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0xad1753['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0xad1753['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0x428938)||this['_crash'](_0x428938['message'],_0x428938,!0x0);});},this['_currentBufferDelay']));}['_waitUntilSynced'](){return new Promise(_0x4d174c=>{this['on']('change:_isPendingUpdate',()=>{_0x4d174c();});});}async['_sendBufferedOperations'](){const _0x5ea8fe=this['editor']['plugins']['get'](H);if(this['_shouldSendSelectionUpdate']()&&(_0x5ea8fe['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x403935=[...this['_bufferedOperations']];for(const _0x435e29 of _0x403935)_0x435e29['wasUndone']=this['_document']['history']['isUndoneOperation'](_0x435e29);const _0x3bf697=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x403935),_0x5f6521=K++,_0x275c6d=this['_compressOperations'](_0x403935),_0x51bc40=await this['_service']['sendOperations'](_0x275c6d,_0x275c6d['baseVersion'],_0x3bf697);try{return await this['_handleServerResponse'](_0x403935,_0x51bc40,_0x5f6521);}catch(_0x111f92){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0x111f92);}}async['_handleServerResponse'](_0x241b0c,_0x5bf10d,_0x128058){if('error'in _0x5bf10d)throw _0x5bf10d['error'];let _0x3a175f=!0x1;if(_0x5bf10d['wereChangesApplied']){_0x5bf10d['lastOperationId']&&(this['_lastSyncedOperationId']=_0x5bf10d['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x55ad00=>!_0x241b0c['includes'](_0x55ad00));for(const _0xfa0fb0 of _0x241b0c)_0xfa0fb0['createdAt']='lastOperationAcceptedAt'in _0x5bf10d&&_0x5bf10d['lastOperationAcceptedAt']||void 0x0;Q(_0x241b0c,_0x5bf10d['version']-_0x241b0c['length']),this['_updateServerHistory'](_0x241b0c);const _0x1f8719=_0x241b0c['filter'](_0x16410b=>{if(!_0x16410b['_isInit'])return!0x1;const _0x1cddab=this['_getAffectedRoot'](_0x16410b);return _0x1cddab&&!this['_knownRootNames']['has'](_0x1cddab);});Q(_0x1f8719,this['_document']['version']),this['_applyOperationsSet'](_0x1f8719),_0x3a175f=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0x1ec3bd=this['_decompressOperations'](_0x5bf10d['data'],_0x5bf10d['metadata'])['filter'](_0xea7496=>_0xea7496['baseVersion']>=this['_lastServerVersion']);_0x1ec3bd['forEach'](_0x1372dc=>this['_addKnownRoot'](_0x1372dc)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x2d2d12=>!_0x2d2d12['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x2d2d12))),this['_bufferedOperations']['length']&&Q(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0x1ec3bd),_0x3a175f=this['_handleExternalOperations'](_0x1ec3bd,_0x5bf10d['version'],_0x5bf10d['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x3a175f?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}['_handleExternalOperations'](_0x8b9173,_0x33580f,_0x9603f2){try{const _0x10dbd5={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x1f08c8,operationsB:_0x4ff8c8,originalOperations:_0x5065f4}=_0x46baf6(_0x8b9173,this['_bufferedOperations'],_0x10dbd5);Q(_0x1f08c8,this['_document']['version']),Q(_0x4ff8c8,_0x33580f);for(const _0x2abc35 of _0x1f08c8){const _0x3962ce=_0x5065f4['get'](_0x2abc35);_0x2abc35['_authorId']=_0x3962ce?_0x3962ce['_authorId']:null;}_0x9603f2&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x8b9173,_0x9603f2),this['_lastSyncedOperationId']=_0x9603f2),this['_bufferedOperations']=[..._0x4ff8c8],this['_applyOperationsSet'](_0x1f08c8),this['_updateServerHistory'](_0x8b9173);}catch(_0x2f41b3){return console['error'](_0x2f41b3),!0x1;}return!0x0;}['_applyOperationsSet'](_0x502c4f,_0x527360=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0x5eea92=>{for(const _0x280ff0 of _0x502c4f)this['_knownOperations']['add'](_0x280ff0),this['_addKnownRoot'](_0x280ff0),_0x5eea92['batch']['addOperation'](_0x280ff0),this['editor']['model']['applyOperation'](_0x280ff0);});}['_addKnownRoot'](_0x36446a){const _0x94febb=this['_getAffectedRoot'](_0x36446a);_0x94febb&&this['_knownRootNames']['add'](_0x94febb);}['_getAffectedRoot'](_0x351c54){let _0x179032,_0x19675f;switch(_0x351c54['type']){case'insert':_0x179032=_0x351c54['position']['root'];break;case'marker':if(_0x19675f=_0x351c54['newRange'],!_0x19675f)return null;_0x179032=_0x19675f['root'];break;case'addRootAttribute':_0x179032=_0x351c54['root'];break;case'addRoot':_0x179032=_0x351c54['affectedSelectable'];break;case'move':_0x179032=_0x351c54['targetPosition']['root'];break;default:return null;}return _0x179032['rootName'];}['_updateServerHistory'](_0x22e21c){_0x22e21c['forEach'](_0x172e25=>{const _0x3f062f=_0x172e25['clone']();_0x3f062f['_authorId']=_0x172e25['_authorId'],_0x3f062f['_isInit']=!!_0x172e25['_isInit'],_0x3f062f['createdAt']=_0x172e25['createdAt'],_0x3f062f['baseVersion']+=this['_offset'],_0x172e25['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x3f062f),this['serverHistory']['addOperation'](_0x3f062f);});}['_handleReconnectionError'](_0xb46af2){const _0x13f2e4=this['editor']['plugins']['get']('Notification'),_0x54e591=this['editor']['locale'];_0xb46af2||(_0xb46af2=q(_0x54e591,'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.')),_0x13f2e4['showWarning'](_0xb46af2,{'title':q(_0x54e591,'Synchronization\x20issue'),'namespace':'real-time-collaboration'}),this['_hasSynchronizationProblem']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_bufferedOperations']=[],this['editor']['plugins']['get'](c)['destroy']();}['_setPendingAction'](){this['_pendingAction']||(this['_pendingAction']=this['editor']['plugins']['get'](_0x13e589)['add'](q(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}['_clearPendingAction'](){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x13e589)['remove'](this['_pendingAction']),this['_pendingAction']=null);}['_compressOperations'](_0x148f62){const _0x365f12=_0x148f62['map'](_0x52508f=>_0x52508f['toJSON']());return this['_compressor']['compress'](_0x365f12);}['_decompressOperations'](_0x52db90,_0x2a80f6){return this['_compressor']['decompress'](_0x52db90)['map']((_0x202ba5,_0x1fe1a6)=>{const _0x1cedda='init'==_0x2a80f6[_0x1fe1a6]['type'];if('InsertOperation'==_0x202ba5['__className']){const _0x34fd47=_0x202ba5['position']['root'];!this['_document']['getRoot'](_0x34fd47)&&(this['_document']['createRoot']('$root',_0x34fd47)['_isAttached']=!0x1);}const _0x1d3762=_0x5d5e27['fromJSON'](_0x202ba5,this['_document']);return _0x1d3762['wasUndone']=_0x202ba5['wasUndone'],_0x1d3762['_isInit']=_0x1cedda,_0x1d3762['_authorId']=_0x1cedda?null:_0x2a80f6[_0x1fe1a6]['userId'],_0x1d3762['_isDisconnection']='cs:removeUser'===_0x2a80f6[_0x1fe1a6]['type'],_0x1d3762['createdAt']=_0x2a80f6[_0x1fe1a6]['createdAt'],_0x1d3762;});}['_refreshUserSelectionMarkers'](){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}['_shouldSendSelectionUpdate'](){const _0x4fe6c8=this['editor']['plugins']['get'](i)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0x4fe6c8&&_0x4fe6c8['length']>0x1&&this['_hasSelectionChanged'];}['_shouldSendUpdate'](){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}}class J extends Error{}function Q(_0x328922,_0x55b3ac){for(const _0x59dd46 of _0x328922)_0x59dd46['baseVersion']=_0x55b3ac++;}class X{['_ignoredOperations'];['_operationToId'];constructor(_0x4e894a){this['_ignoredOperations']=_0x4e894a,this['_operationToId']=new WeakMap();}['getIdOfTheLastOperation'](_0x39a7d3){let _0x3c5d8d=_0x39a7d3['length'];for(;_0x3c5d8d--;){const _0x1b8e26=_0x39a7d3[_0x3c5d8d];if(!this['_ignoredOperations']['has'](_0x1b8e26)){if(!this['_operationToId']['has'](_0x1b8e26)){const _0x1940e1=_0x51e690()['slice'](0x1,0x12);this['_operationToId']['set'](_0x1b8e26,_0x1940e1);}return this['_operationToId']['get'](_0x1b8e26);}}}['setIdForTheLastOperation'](_0x5208e1,_0x48f329){if(!_0x48f329)return;let _0x46f923=_0x5208e1['length'];for(;_0x46f923--;){const _0x206a2a=_0x5208e1[_0x46f923];this['_ignoredOperations']['has'](_0x206a2a)||this['_operationToId']['set'](_0x206a2a,_0x48f329);}}}class n extends _0x351dbd{static get['requires'](){return[l];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class a extends _0x42fe86{static ['CommentsService']=/* #__PURE__ -- @preserve */
26
+ ((()=>_0x5dd5a1)());['_services'];static get['requires'](){return[c,'CommentsRepository',i,_0x326329];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x464f69){super(_0x464f69),this['_services']=new Map();}async['init'](){const _0x5d1f54=this['context'],_0x4d3ec2=_0x5d1f54['plugins']['get']('CommentsRepository');if(_0x5d1f54['plugins']['get'](c)['addToReconnectionStack'](this),_0x4d3ec2['adapter']={'addCommentThread':async({channelId:_0x1c6269,threadId:_0x11c186,comments:_0x2feb9a,resolvedAt:_0x1c8784,resolvedBy:_0x2a0e0b,context:_0x550266,attributes:_0x4268d7})=>{const _0x1f6f4d=await this['_getService'](_0x1c6269)['addCommentThread']({'commentThreadId':_0x11c186,'comments':_0x2feb9a['map'](_0x3fe388=>function(_0x15f261,_0x10c71a,_0x493fec){return{'commentThreadId':_0x493fec,'commentId':_0x15f261['commentId'],'userId':_0x15f261['authorId'],'content':_0x15f261['content'],'documentId':_0x10c71a,'createdAt':_0x15f261['createdAt'],'attributes':_0x15f261['attributes']||{}};}(_0x3fe388,_0x1c6269,_0x11c186)),'resolvedAt':_0x1c8784,'resolvedBy':_0x2a0e0b,'context':_0x550266,'attributes':_0x4268d7})['catch'](ut);return{'threadId':_0x1f6f4d['commentThreadId'],'comments':_0x1f6f4d['comments']};},'getCommentThread':async({channelId:_0x3fcc29,threadId:_0x1c7d10})=>{const _0x379235=await this['_getService'](_0x3fcc29)['getCommentThread'](_0x1c7d10)['catch'](ut);return _0x379235['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0x379235]),{'threadId':_0x379235['commentThreadId'],'comments':_0x379235['comments']['map'](b),'context':_0x379235['context'],'resolvedAt':_0x379235['resolvedAt'],'resolvedBy':_0x379235['resolvedBy'],'attributes':_0x379235['attributes']||{}});},'updateCommentThread':async({channelId:_0xb5a76e,threadId:_0x461d6e,context:_0x11bee8,unlinkedAt:_0x45693b,attributes:_0x211003})=>this['_getService'](_0xb5a76e)['updateCommentThread']({'commentThreadId':_0x461d6e,'context':_0x11bee8,'attributes':_0x211003,'unlinkedAt':_0x45693b})['catch'](y)['catch'](ut),'resolveCommentThread':async({channelId:_0x4c45d2,threadId:_0x2eb189})=>{const _0x203e71=await this['_getService'](_0x4c45d2)['resolveCommentThread'](_0x2eb189)['catch'](y)['catch'](ut);return{'threadId':_0x203e71['commentThreadId'],'resolvedAt':_0x203e71['resolvedAt'],'resolvedBy':_0x203e71['resolvedBy']};},'reopenCommentThread':async({channelId:_0x9b5cba,threadId:_0x2205b1})=>this['_getService'](_0x9b5cba)['reopenCommentThread'](_0x2205b1)['catch'](y)['catch'](ut),'removeCommentThread':({channelId:_0x2219fe,threadId:_0x4b7f75})=>this['_getService'](_0x2219fe)['removeCommentThread'](_0x4b7f75)['catch'](y)['catch'](ut),'addComment':({channelId:_0x7c5f1c,threadId:_0x1ad647,commentId:_0x536eac,content:_0xfbb1d0,attributes:_0x2d7acc})=>this['_getService'](_0x7c5f1c)['addComment'](_0x1ad647,_0x536eac,_0xfbb1d0,_0x2d7acc)['catch'](ut),'updateComment':({channelId:_0x334104,threadId:_0x52b4c7,commentId:_0x17bea4,content:_0x236aaa,attributes:_0xdce7ef})=>this['_getService'](_0x334104)['updateComment'](_0x52b4c7,_0x17bea4,_0x236aaa,_0xdce7ef)['catch'](y)['catch'](ut),'removeComment':({channelId:_0x43f246,threadId:_0xd38490,commentId:_0x50698c})=>this['_getService'](_0x43f246)['removeComment'](_0xd38490,_0x50698c)['catch'](y)['catch'](ut)},_0x5d1f54 instanceof _0x491a95){const _0xd7ed0=_0x5d1f54['config']['get']('collaboration.channelId'),_0x2a2d7f=_0x5d1f54['plugins']['get'](i);await this['_setUpService'](_0xd7ed0);const _0x5ebf7e=await this['_services']['get'](_0xd7ed0)['getConnectedSessions']();this['listenTo'](_0x2a2d7f,'sessionAdd:'+_0xd7ed0,(_0x13d2a7,{session:_0x25d62d})=>{_0x25d62d['id']===_0x2a2d7f['mySessionId']&&(_0x13d2a7['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x25d62d['permissions'],_0xd7ed0));}),_0x2a2d7f['register'](_0xd7ed0,_0x5ebf7e);}}async['_setUpService'](_0x1c0691){if(this['_services']['has'](_0x1c0691))throw new _0x1de3e2('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0x1c0691});const _0x3619f6=this['context']['plugins']['get']('CommentsRepository'),_0x18605b=new a['CommentsService'](_0x1c0691);this['_services']['set'](_0x1c0691,_0x18605b),this['listenTo'](_0x18605b,'commentThreadAdded',(_0x3e6647,_0x12b2da)=>{const {commentThreadId:_0x3c3195,documentId:_0x2a0357,context:_0x3f83c8,attributes:_0x54ac63,resolvedAt:_0x1e9551,resolvedBy:_0x5766f7,comments:_0x2d1547}=_0x12b2da;_0x3619f6['getCommentThread'](_0x3c3195)||_0x3619f6['addCommentThread']({'threadId':_0x3c3195,'channelId':_0x2a0357,'comments':_0x2d1547?_0x2d1547['map'](b):[],'context':_0x3f83c8,'attributes':_0x54ac63,'resolvedAt':_0x1e9551,'resolvedBy':_0x5766f7,'isFromAdapter':!0x0});}),this['listenTo'](_0x18605b,'commentThreadUpdated',(_0x2a2a90,{commentThreadId:_0x5eed5b,documentId:_0x12a0dc,context:_0x5b4beb,unlinkedAt:_0x522b95,attributes:_0x5031b5})=>{_0x3619f6['getCommentThread'](_0x5eed5b)&&_0x3619f6['updateCommentThread']({'threadId':_0x5eed5b,'channelId':_0x12a0dc,'context':_0x5b4beb,'unlinkedAt':_0x522b95,'attributes':_0x5031b5,'isFromAdapter':!0x0});}),this['listenTo'](_0x18605b,'commentThreadResolved',(_0x1e8e1a,{commentThreadId:_0x344e5f,resolvedBy:_0x154ad2,resolvedAt:_0x1aea90})=>{const _0x212b56=_0x3619f6['getCommentThread'](_0x344e5f);_0x212b56&&_0x212b56['resolve']({'resolvedBy':_0x154ad2,'resolvedAt':_0x1aea90,'isFromAdapter':!0x0});}),this['listenTo'](_0x18605b,'commentThreadReopened',(_0x32675e,{commentThreadId:_0x4f8fd7})=>{const _0x20cdf8=_0x3619f6['getCommentThread'](_0x4f8fd7);_0x20cdf8&&_0x20cdf8['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0x18605b,'commentThreadRemoved',(_0x330e5c,{commentThreadId:_0x444317})=>{const _0x9f6fde=_0x3619f6['getCommentThread'](_0x444317);_0x9f6fde&&_0x9f6fde['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0x18605b,'commentAdded',(_0x1e2d72,_0x5669aa)=>{const _0x451049=_0x5669aa['commentThreadId'],_0x531c4b=_0x3619f6['getCommentThread'](_0x451049);_0x531c4b&&_0x531c4b['addComment']({...b(_0x5669aa),'isFromAdapter':!0x0});}),this['listenTo'](_0x18605b,'commentUpdated',(_0x5821a3,{commentThreadId:_0x2a4094,commentId:_0x24b2f8,content:_0x2e1961,attributes:_0x2a6df7})=>{const _0x4d9483=_0x3619f6['getCommentThread'](_0x2a4094);if(_0x4d9483){const _0x5323f7=_0x4d9483['getComment'](_0x24b2f8);_0x5323f7&&_0x5323f7['update']({'content':_0x2e1961,'attributes':_0x2a6df7,'isFromAdapter':!0x0});}}),this['listenTo'](_0x18605b,'commentRemoved',(_0x4e1f3b,{commentThreadId:_0x2451ab,commentId:_0x49ae35})=>{const _0x11313e=_0x3619f6['getCommentThread'](_0x2451ab);if(_0x11313e){const _0x4e6922=_0x11313e['getComment'](_0x49ae35);_0x4e6922&&_0x4e6922['remove']({'isFromAdapter':!0x0});}}),await this['_connectService'](_0x1c0691);}['destroy'](){if(this['context']instanceof _0x491a95){const _0x45fb89=this['context']['config']['get']('collaboration.channelId');this['_terminateService'](_0x45fb89);}}['_terminateService'](_0x23c91e){if(!this['_services']['has'](_0x23c91e))throw new _0x1de3e2('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0x23c91e});this['_getService'](_0x23c91e)['disconnect'](),this['_services']['delete'](_0x23c91e);}async['reconnect'](){for(const _0x237409 of this['_services']['keys']())await this['_connectService'](_0x237409);if(this['context']instanceof _0x491a95){const _0x510351=this['context']['config']['get']('collaboration.channelId'),_0x16c84c=this['context']['plugins']['get'](i);_0x16c84c['unregister'](_0x510351);const _0xaaf269=await this['_services']['get'](_0x510351)['getConnectedSessions']();_0x16c84c['register'](_0x510351,_0xaaf269);}}async['_connectService'](_0x4f3e50){const {connection:_0xbb4115}=this['context']['plugins']['get'](c),_0x5ab02c=this['context']['plugins']['get']('CommentsRepository'),_0x381368=this['_services']['get'](_0x4f3e50),_0x354c2=await _0x381368['connect'](_0xbb4115);await this['_fetchMissingUsersForThreads'](_0x354c2);const _0x20de14=new Set(Array['from'](_0x5ab02c['getCommentThreads']({'channelId':_0x4f3e50}),_0x359e31=>_0x359e31['id']));for(const _0x401089 of _0x354c2)_0x401089['deletedAt']||_0x20de14['delete'](_0x401089['commentThreadId']);for(const _0x2f2f7f of _0x20de14)_0x5ab02c['getCommentThread'](_0x2f2f7f)['remove']({'isFromAdapter':!0x0});for(const _0x16d304 of _0x354c2){let _0x51b354=_0x5ab02c['getCommentThread'](_0x16d304['commentThreadId']);const {commentThreadId:_0xf82269,context:_0x5e5aa5,attributes:_0x4b1256,resolvedBy:_0x54f80b,resolvedAt:_0x9b2b8a,unlinkedAt:_0x3de81b,deletedAt:_0x364fcb}=_0x16d304;if(_0x364fcb)continue;_0x51b354||(_0x51b354=_0x5ab02c['addCommentThread']({'channelId':_0x4f3e50,'threadId':_0xf82269,'context':_0x5e5aa5,'attributes':_0x4b1256||{},'resolvedBy':_0x54f80b,'resolvedAt':_0x9b2b8a,'unlinkedAt':_0x3de81b,'isFromAdapter':!0x0}));const _0x1fb355=new Set(Array['from'](_0x51b354['comments'],_0x5de84a=>_0x5de84a['id']));for(const _0xf9710b of _0x16d304['comments'])_0x1fb355['delete'](_0xf9710b['commentId']);for(const _0xe8624d of _0x1fb355)_0x51b354['getComment'](_0xe8624d)['remove']({'isFromAdapter':!0x0});for(const _0x1444b5 of _0x16d304['comments']){const _0x1e0d4d=_0x51b354['getComment'](_0x1444b5['commentId']);_0x1e0d4d?_0x1e0d4d['content']!==_0x1444b5['content']&&_0x1e0d4d['update']({'content':_0x1444b5['content'],'isFromAdapter':!0x0}):_0x51b354['addComment'](Object['assign'](b(_0x1444b5),{'isFromAdapter':!0x0}));}}}['_getService'](_0x2e1d25){if(!this['_services']['has'](_0x2e1d25))throw new _0x1de3e2('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0x2e1d25});return this['_services']['get'](_0x2e1d25);}async['_fetchMissingUsersForThreads'](_0x37a7e0){const _0x445dc8=this['context']['plugins']['get'](_0x326329),{connection:_0x4153ac}=this['context']['plugins']['get'](c),_0xb8954d=new Set();for(const {resolvedBy:_0x200c49,comments:_0x3c7412}of _0x37a7e0){_0x200c49&&!_0x445dc8['getUser'](_0x200c49)&&_0xb8954d['add'](_0x200c49);for(const {userId:_0x1ad34a}of _0x3c7412)_0x445dc8['getUser'](_0x1ad34a)||_0xb8954d['add'](_0x1ad34a);}if(0x0===_0xb8954d['size'])return;const _0x529004=await dt['getMany'](_0x4153ac,Array['from'](_0xb8954d));for(const _0x5c055f of _0x529004)_0x445dc8['getUser'](_0x5c055f['id'])||_0x445dc8['addUser'](_0x5c055f);}}async function y(_0x10465c){if('404'!==_0x10465c['code'])throw _0x10465c;}function ut(_0x25e4f8){if((_0x5abfdd=_0x25e4f8)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0x5abfdd['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x5abfdd['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0x5abfdd;throw _0x25e4f8;}function b(_0x1c0f27){return{'threadId':_0x1c0f27['commentThreadId'],'commentId':_0x1c0f27['commentId'],'content':_0x1c0f27['content'],'createdAt':_0x1c0f27['createdAt'],'authorId':_0x1c0f27['userId'],'attributes':_0x1c0f27['attributes']||{}};}class f extends _0x351dbd{static ['TrackChangesService']=/* #__PURE__ -- @preserve */
27
+ ((()=>et)());['_bufferedRequests'];['_trackChangesService'];static get['requires'](){return[a,'TrackChangesEditing',c];}static get['pluginName'](){return'CloudServicesTrackChangesAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x106588){super(_0x106588);const _0x4cfc50=this['editor']['config']['get']('collaboration.channelId');this['_bufferedRequests']=new Map(),this['_trackChangesService']=new f['TrackChangesService'](_0x4cfc50);}['init'](){const _0x491627=this['editor']['plugins']['get'](c),_0x1d6250=this['editor']['plugins']['get']('TrackChangesEditing');return _0x1d6250['adapter']={'getSuggestion':async _0x152083=>{await this['_waitForServiceReady']();const _0xc37f5a=await this['_trackChangesService']['get'](_0x152083)['catch'](w);return await this['_fetchMissingUsersForThreads']([_0xc37f5a]),_0xc37f5a;},'addSuggestion':async({id:_0x331402,type:_0xf3e348,data:_0x368343,originalSuggestionId:_0x204975,attributes:_0x21fa3c})=>{await this['_waitForServiceReady']();const _0x3072e6={'id':_0x331402,'type':_0xf3e348,'data':_0x368343,'originalSuggestionId':_0x204975,'attributes':_0x21fa3c},_0x421b4d=await this['_trackChangesService']['add'](_0x331402,_0xf3e348,_0x368343,_0x204975,_0x21fa3c)['catch'](_0x552804=>{if(ft(_0x552804))return new Promise(_0x10d95e=>{this['_bufferedRequests']['set'](_0x331402,{'resolve':_0x10d95e,'suggestionData':_0x3072e6});});throw _0x552804;});return this['_bufferedRequests']['delete'](_0x331402),_0x421b4d;},'updateSuggestion':async(_0x2fe8e1,_0x577fef)=>{if(await this['_waitForServiceReady'](),'open'!==_0x577fef['state'])return this['_trackChangesService']['update'](_0x2fe8e1,_0x577fef)['catch'](w);}},this['listenTo'](this['_trackChangesService'],'suggestionUpdated',(_0xcade9f,_0x4328d2)=>{_0x1d6250['hasSuggestion'](_0x4328d2['id'])&&(_0x1d6250['getSuggestion'](_0x4328d2['id'])['attributes']=_0x4328d2['attributes']);}),this['_trackChangesService']['connect'](_0x491627['connection'])['then'](_0xf4fb96=>(_0x491627['addToReconnectionStack'](this),this['_fetchMissingUsersForThreads'](_0xf4fb96)['then'](()=>{for(const _0x29b45a of _0xf4fb96){_0x1d6250['addSuggestionData'](_0x29b45a)['_saved']=!0x0;}})));}async['reconnect'](){const _0x3c89bb=this['editor']['plugins']['get']('TrackChangesEditing'),{connection:_0x5f0aac}=this['editor']['plugins']['get'](c),_0x776928=await this['_trackChangesService']['connect'](_0x5f0aac);await this['_fetchMissingUsersForThreads'](_0x776928);for(const {suggestionData:_0x51ace0,resolve:_0xaeb52a}of this['_bufferedRequests']['values']()){let _0x5e6810=_0x776928['find'](_0xd18bf4=>_0xd18bf4['id']===_0x51ace0['id']);_0x5e6810||(_0x5e6810=await this['_trackChangesService']['add'](_0x51ace0['id'],_0x51ace0['type'],_0x51ace0['data'],_0x51ace0['originalSuggestionId'])),_0xaeb52a(_0x5e6810);}for(const _0x1c8de2 of _0x776928)_0x3c89bb['hasSuggestion'](_0x1c8de2['id'])||_0x3c89bb['addSuggestionData'](_0x1c8de2);}async['_waitForServiceReady'](){this['_trackChangesService']['isConnected']||await new Promise(_0x426da0=>{this['listenTo'](this['_trackChangesService'],'connected',_0x183287=>{_0x183287['off'](),_0x426da0();});});}async['_fetchMissingUsersForThreads'](_0x4f085b){const _0x4cbc8c=this['editor']['plugins']['get'](_0x326329),{connection:_0x1b62ae}=this['editor']['plugins']['get'](c),_0x11f5bd=new Set();for(const {authorId:_0x3b734d}of _0x4f085b)_0x4cbc8c['getUser'](_0x3b734d)||_0x11f5bd['add'](_0x3b734d);if(0x0===_0x11f5bd['size'])return;const _0x96055e=await dt['getMany'](_0x1b62ae,Array['from'](_0x11f5bd));for(const _0x1fb30b of _0x96055e)_0x4cbc8c['getUser'](_0x1fb30b['id'])||_0x4cbc8c['addUser'](_0x1fb30b);}}function w(_0x9ca43){if(ft(_0x9ca43))return new Promise(()=>{});throw _0x9ca43;}function ft(_0x2552d1){return _0x2552d1['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x2552d1['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class m extends _0x351dbd{static get['requires'](){return['Comments',a,n,c];}static get['pluginName'](){return'RealTimeCollaborativeComments';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x147d30=this['editor']['plugins']['get'](c),_0x2d343b=this['editor']['plugins']['get']('CommentsEditing'),_0xac6901=this['editor']['plugins']['get'](a);return this['editor']['data']['once']('ready',()=>{this['listenTo'](_0x147d30,'change:state',(_0x1c2501,_0x5e0b3d,_0x452cd9)=>{_0x2d343b['isThreadsLoadingPaused']='connected'!==_0x452cd9;});}),this['listenTo'](_0x147d30,'change:state',(_0x4d6bb8,_0x269f34,_0x1fb98e)=>{this['editor']['plugins']['get']('CommentsRepository')['switchReadOnly']('connected'!==_0x1fb98e);}),_0xac6901['_setUpService'](this['editor']['config']['get']('collaboration.channelId'));}['destroy'](){this['editor']['plugins']['get'](a)['_terminateService'](this['editor']['config']['get']('collaboration.channelId')),super['destroy']();}}class p extends _0x351dbd{static get['requires'](){return[m,f,'TrackChanges'];}static get['pluginName'](){return'RealTimeCollaborativeTrackChanges';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class u extends _0x351dbd{static ['RevisionHistoryService']=/* #__PURE__ -- @preserve */
28
+ ((()=>it)());['_lastRequestId'];['_revisionTracker'];['_revisionHistoryService'];['_oldOffset'];static get['requires'](){return[c,l,'RevisionTracker',i,_0x326329];}static get['pluginName'](){return'CloudServicesRevisionHistoryAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x9b3788){super(_0x9b3788);const _0x140eb9=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new u['RevisionHistoryService'](_0x140eb9);}async['init'](){const _0x36dd3f=this['editor']['plugins']['get'](l),_0x25b489=_0x36dd3f['serverHistory'],_0x58a3d3=this['editor']['plugins']['get'](c);this['_revisionTracker']['setSource']({'history':_0x25b489,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0x36dd3f['sessionId']});const _0x1ad979=this['editor']['config']['get']('cloudServices.bundleVersion')||nt,_0x3c6342=await tt['isBundleUploaded'](_0x58a3d3['connection'],_0x1ad979);this['_revisionTracker']['adapter']={'getRevision':async({revisionId:_0x2c5843})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0x2c5843)),'updateRevisions':async _0x2a2826=>{await this['_waitForServiceReady']();const _0xe12d7e=this['_revisionTracker']['currentRevision'];if(_0x3c6342&&0x1===_0x2a2826['length']&&_0x2a2826[0x0]['id']===_0xe12d7e['id'])return _0x2a2826;for(const _0x303eff of _0x2a2826)_0x303eff['id']===_0xe12d7e['id']&&(_0x303eff['isEmptyCurrent']=_0x303eff['fromVersion']===_0x303eff['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0x2a2826,this['_lastRequestId'])['then'](_0x29fd01=>(this['_lastRequestId']=_0x29fd01,_0x2a2826))['catch'](_0x16b603=>{if(st(_0x16b603)||'400'===_0x16b603['code']&&void 0x0!==_0x16b603['data']['wrongRequestId']){for(const _0x39fccf of _0x2a2826){!this['_revisionTracker']['repository']['getRevision'](_0x39fccf['id'])||this['_revisionTracker']['_bufferUpdate'](_0x39fccf['id'],_0x39fccf,!0x1);}if(st(_0x16b603))throw _0x16b603;return _0x2a2826;}throw _0x16b603;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0x4f4247,{revisionsData:_0x582197,requestId:_0x38db25})=>{Math['max'](..._0x582197['map'](_0xf79f8a=>_0xf79f8a['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0x582197,_0x38db25);}):this['_handleRevisionsUpdate'](_0x582197,_0x38db25);});const {revisions:_0x35d221,requestId:_0xa58efb}=await this['_revisionHistoryService']['connect'](_0x58a3d3['connection']);_0x58a3d3['addToReconnectionStack'](this),this['_lastRequestId']=_0xa58efb,await this['_fetchMissingUsers'](_0x35d221);for(const _0x3fd48e of _0x35d221)this['_revisionTracker']['addRevisionData'](_0x3fd48e);this['listenTo'](_0x36dd3f,'change:_isConnected',(_0xa3d7d5,_0x205c21,_0x5c6af0)=>{_0x5c6af0&&(this['_oldOffset']=_0x36dd3f['_offset'],_0xa3d7d5['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](_0x58a3d3,'state',_0x6700da=>_0x6700da===_0x37aed7['CONNECTED']);}async['reconnect'](){const _0xec817f=this['editor']['plugins']['get'](c),_0x3cd78c=this['editor']['plugins']['get'](l),_0x9971e9=async()=>{const _0x2cec7e=this['_revisionTracker']['currentRevision'],_0x4a52c9=_0x2cec7e['id'],_0x4e2dcf=_0x4a52c9!==_0x3cd78c['sessionId'];if(_0x4e2dcf){const _0x48768c=_0x3cd78c['_offset']-this['_oldOffset'],_0x5f11f6=this['_getLatestVersionFromServerOperations']();this['_revisionTracker']['_revisionDataBuilder']['reInit']();if(_0x2cec7e['toVersion']+_0x48768c!==_0x5f11f6){const _0x2dc85a=_0x2cec7e['fromVersion']+_0x48768c,_0x3957e7=this['editor']['plugins']['get'](_0x326329),_0x3ded82=this['_revisionTracker']['buildRevisionData']({'revision':_0x2cec7e,'from':_0x2dc85a,'to':_0x5f11f6});_0x3ded82['id']=_0x2cec7e['id'];const _0x241876=_0x3ded82['authorsIds']['map'](_0x491dac=>_0x3957e7['getUser'](_0x491dac));_0x2cec7e['_update']({..._0x3ded82,'authors':_0x241876},!0x0),this['_revisionTracker']['_bufferUpdate'](_0x2cec7e['id'],_0x3ded82,!0x0);}this['_revisionTracker']['_startingVersion']=_0x5f11f6,(_0x2cec7e['toVersion']===_0x2cec7e['fromVersion']&&!this['_revisionTracker']['_bufferedUpdates']['has'](_0x4a52c9)&&this['_revisionTracker']['repository']['_revisions']['remove'](_0x4a52c9),this['_revisionTracker']['_createCurrentRevision'](_0x5f11f6));}const {revisions:_0x4a8843,requestId:_0x425484}=await this['_revisionHistoryService']['reconnect'](_0xec817f['connection'],this['_lastRequestId']);_0x4e2dcf&&_0x4a8843['length']>0x0?_0x3cd78c['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x4a8843),this['_handleRevisionsUpdate'](_0x4a8843,_0x425484),this['_revisionTracker']['sendBufferedUpdates']());};return _0x3cd78c['_isConnected']?_0x9971e9():new Promise((_0x555b49,_0xf5fa80)=>{_0x3cd78c['once']('change:_isConnected',()=>{_0x9971e9()['then'](_0x555b49)['catch'](_0xf5fa80);});});}['destroy'](){super['destroy']();}async['_waitForServiceReady'](){this['_revisionHistoryService']['isConnected']||await new Promise(_0x4c61f3=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x10936d=>{_0x10936d['off'](),_0x4c61f3();});});}['_getLatestVersionFromServerOperations'](){const _0x14ba07=this['editor']['plugins']['get'](l)['serverHistory']['getOperations']()['reverse']();for(const _0x5de7f6 of _0x14ba07)if('marker'!==_0x5de7f6['type']||_0x5de7f6['affectsData'])return _0x5de7f6['baseVersion']+0x1;}['_getLatestVersion'](){const _0x38b395=this['editor']['plugins']['get'](l);return new Promise(_0x579e48=>{_0x38b395['_isPendingUpdate']?_0x38b395['once']('change:_isPendingUpdate',()=>{_0x579e48(this['_getLatestVersionFromServerOperations']());}):_0x579e48(this['_getLatestVersionFromServerOperations']());});}['_handleRevisionsUpdate'](_0x1c1e98,_0x2cd402){const _0x48166d=this['_revisionTracker']['repository'];this['_lastRequestId']=_0x2cd402;for(const _0x4f51cd of _0x1c1e98){const _0x377de1=_0x48166d['getRevision'](_0x4f51cd['id']);if(_0x377de1){if((_0x4f51cd['fromVersion']||_0x4f51cd['toVersion'])&&(_0x4f51cd['diffData']=null),_0x377de1===this['_revisionTracker']['currentRevision']){const _0x2d419d=Math['max'](_0x377de1['toVersion'],_0x4f51cd['toVersion']),_0x487273=Math['max'](_0x377de1['fromVersion'],_0x4f51cd['fromVersion']);let _0x4f3d60;_0x377de1['toVersion']===_0x4f51cd['toVersion']&&_0x377de1['fromVersion']===_0x4f51cd['fromVersion']?(_0x4f3d60=!0x0,this['_preventResendingRevisionData'](_0x4f51cd)):_0x4f51cd['toVersion']===_0x2d419d&&_0x4f51cd['fromVersion']===_0x487273?_0x4f3d60=!0x1:(_0x377de1['toVersion']===_0x2d419d&&_0x377de1['fromVersion']===_0x487273||this['_fixRevision']({'revision':_0x377de1,'from':_0x487273,'to':_0x2d419d}),_0x4f3d60=!0x0),_0x4f3d60&&(delete _0x4f51cd['fromVersion'],delete _0x4f51cd['toVersion'],delete _0x4f51cd['diffData'],delete _0x4f51cd['createdAt'],delete _0x4f51cd['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0x4f51cd),this['_preventResendingRevisionData'](_0x4f51cd);}else this['_revisionTracker']['addRevisionData'](_0x4f51cd);}const _0x4902b6=_0x48166d['getRevisions']();_0x4902b6['reverse']();for(let _0x307ece=0x0;_0x307ece<_0x4902b6['length']-0x1;_0x307ece++){const _0x37f270=_0x4902b6[_0x307ece],_0x44dd87=_0x4902b6[_0x307ece+0x1];if(_0x37f270['fromVersion']<_0x44dd87['toVersion']){const _0x1df565=_0x44dd87['toVersion'],_0x349a61=Math['max'](_0x1df565,_0x37f270['toVersion']);this['_fixRevision']({'revision':_0x37f270,'from':_0x1df565,'to':_0x349a61});}}}['_fixRevision']({revision:_0x43af81,from:_0x17c3bd,to:_0x18f0ed}={}){const _0x46b27b=this['editor']['plugins']['get'](_0x326329),_0x1e6fcd=this['_revisionTracker']['buildRevisionData']({'revision':_0x43af81,'from':_0x17c3bd,'to':_0x18f0ed});_0x1e6fcd['authors']=_0x1e6fcd['authorsIds']['map'](_0x16c1a3=>_0x46b27b['getUser'](_0x16c1a3)),_0x43af81['_update'](_0x1e6fcd);}['_preventResendingRevisionData'](_0x301fcd){const _0x376043={};_0x376043['id']=_0x301fcd['id'];for(const _0x55d856 of Object['keys'](_0x301fcd))'id'!==_0x55d856&&(_0x376043[_0x55d856]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0x376043['id'],_0x376043,!0x0);}async['_fetchMissingUsers'](_0x585707){const _0x5189a4=this['editor']['plugins']['get'](_0x326329),{connection:_0x4962dc}=this['editor']['plugins']['get'](c),_0xfa1c1f=new Set();for(const _0x2ff65e of _0x585707){for(const _0x7524a of _0x2ff65e['authorsIds'])_0x56dd86(_0x7524a);_0x2ff65e['creatorId']&&_0x56dd86(_0x2ff65e['creatorId']);}if(0x0===_0xfa1c1f['size'])return;const _0x39748d=await dt['getMany'](_0x4962dc,Array['from'](_0xfa1c1f));for(const _0x4517a0 of _0x39748d)_0x5189a4['getUser'](_0x4517a0['id'])||_0x5189a4['addUser'](_0x4517a0);function _0x56dd86(_0x2765d3){_0x5189a4['getUser'](_0x2765d3)||_0xfa1c1f['add'](_0x2765d3);}}}function st(_0x2c24d2){return _0x2c24d2['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0x2c24d2['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x2c24d2['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class g extends _0x351dbd{static get['requires'](){return['RevisionHistory',u,n];}static get['pluginName'](){return'RealTimeCollaborativeRevisionHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class ts extends _0x37e435{constructor(_0x7c4c3d){super(_0x7c4c3d);const _0x2be6ef=this['bindTemplate'];this['set']('usersCount',0x0),this['set']('isHidden',!0x0),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__counter',_0x2be6ef['if']('isHidden','ck-presence-list__counter--hidden')]},'children':[{'text':_0x2be6ef['to']('usersCount',_0x5e5a4b=>q(_0x7c4c3d,'CONNECTED_USERS',_0x5e5a4b))}]});}}class es extends _0x37e435{['items'];['keystrokes'];constructor(_0x38e311){super(_0x38e311);const _0x30a6fb=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0x2e5d74(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0x30a6fb['if']('hasPopup'),'aria-expanded':_0x30a6fb['to']('isExpanded',_0x4a1240=>this['hasPopup']&&String(_0x4a1240)),'aria-label':_0x30a6fb['to']('hasPopup',_0x54c33a=>q(_0x38e311,_0x54c33a?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0x30a6fb['to']('hasPopup',_0x14523d=>!!_0x14523d&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items'],'on':{'click':_0x30a6fb['to'](()=>this['fire']('execute'))}}),this['on']('change:hasPopup',(_0x6e762f,_0x195faf,_0x196c20)=>{this['element']&&(_0x196c20?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']);}}class _ extends _0x37e435{['counterView'];['inlineListView'];constructor(_0x3a3bbd){super(_0x3a3bbd);const _0x5c7741=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new ts(this['locale']),this['inlineListView']=new es(_0x3a3bbd),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x437c34 of this['inlineListView']['items'])_0x437c34['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',_0x5c7741['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['counterView'],this['inlineListView']]});}}class M extends _0x37e435{['listWrapperView'];constructor(_0x489061,_0x2c1528){super(_0x489061),this['listWrapperView']=new mt(_0x489061,_0x2c1528),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':q(_0x489061,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']]});}}class mt extends _0x2a13a2{constructor(_0x14fc06,_0x5962dc){super(_0x14fc06);const _0x4760d8=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0x5962dc?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0x4760d8['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0x4760d8['to']('role'),'aria-label':_0x4760d8['to']('ariaLabel'),'aria-labelledby':_0x4760d8['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0xc36c3b['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0x13179d=this['element'];_0x13179d&&(this['_isScrollable']=Math['max'](_0x13179d['scrollHeight'],_0x13179d['clientHeight'])>0.8*window['innerHeight']);}}class E extends rt{['userView'];constructor(_0x39add9,_0x34ebc3,_0xb738f){super(_0x39add9);const _0x1363c3=this['bindTemplate'];this['userView']=new ct(_0x39add9,_0x34ebc3);const _0x5b3ba0={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0x34ebc3['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0x34ebc3['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x34ebc3['color']['getBackgroundColorClass']()],'aria-hidden':'true'}}]};_0xb738f&&(_0x5b3ba0['tag']='button',_0x5b3ba0['on']={'click':_0x1363c3['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x5b3ba0);}['focus'](){this['element']['focus']();}}class T extends _0x37e435{['userView'];['markerView'];constructor(_0x3ba193,_0x5ba62b,_0x565401){super(_0x3ba193);const _0x4d7a56=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new ct(_0x3ba193,_0x5ba62b),this['markerView']=new at(_0x3ba193,_0x5ba62b);const _0x728186=new ot(_0x3ba193);_0x728186['template']['tag']='span',_0x728186['text']=_0x5ba62b['name'];const _0x33e785={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0x4d7a56['to']('isFocusable',_0xd98de8=>!!_0xd98de8&&0x0),'aria-labelledby':_0x728186['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0x4d7a56['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0x4d7a56['to']('hasTooltip',_0x24c026=>!_0x24c026),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0x728186]};_0x565401&&(_0x33e785['tag']='button',_0x33e785['on']={'click':_0x4d7a56['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x33e785);}}class at extends _0x37e435{constructor(_0x19d4ec,_0x32fb44){super(_0x19d4ec),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x32fb44['color']['getBackgroundColorClass']()],'aria-hidden':'true'}});}}const D={'collapseAt':0x6,'displayMe':!0x0};class r extends _0x42fe86{['currentDisplayedUsers'];['balloonPanelView'];['view'];['presenceDropdownView'];['_bodyCollection']=null;constructor(_0x3de681){super(_0x3de681),this['context']['config']['define']('presenceList',D);const _0x3d648f=_0x3de681['config']['get']('presenceList.collapseAt');if('number'!=typeof _0x3d648f)throw new _0x1de3e2('presencelist-collapseat-invalid-format',this);if(_0x3d648f<0x1)throw new _0x1de3e2('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](i)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0x4091d0(),this['balloonPanelView']=new _0x4f3018(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get['requires'](){return[i];}['init'](){for(const _0x352600 of this['_allConnectedUsers'])this['_handleUserAdd'](_0x352600);this['listenTo'](this['_allConnectedUsers'],'add',(_0x5f326c,_0x519f31)=>{this['_handleUserAdd'](_0x519f31);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0x4db2dc,_0x579a83)=>{this['_handleUserRemove'](_0x579a83);});}['_createView'](){const _0x484447=this['context'],_0x155e0f=new _(this['context']['locale']),_0x57b81f=this['balloonPanelView'];if(!_0x4a3110(_0x484447['config']['get']('presenceList.container')))throw new _0x1de3e2('presencelist-missing-container',this);return _0x155e0f['counterView']['bind']('usersCount')['to'](this),_0x155e0f['bind']('isCollapsed')['to'](this,'usersCount',_0x7047dd=>{const {collapseAt:_0x1d09a8,displayMe:_0x5bcf86}=_0x484447['config']['get']('presenceList'),_0x26449a=_0x7047dd>=_0x1d09a8;return _0x155e0f['counterView']['isHidden']=!(0x1==_0x7047dd&&_0x5bcf86||_0x26449a),_0x26449a||this['hideDropdown'](),_0x26449a;}),_0x155e0f['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0x2a9a15=>{const _0x1fdd36=_0x484447['config']['get']('presenceList'),_0x285512=new T(_0x484447['locale'],_0x2a9a15,!!_0x1fdd36['onClick']);return _0x285512['bind']('hasTooltip')['to'](_0x155e0f,'isCollapsed',_0xdb07c3=>!_0xdb07c3),_0x285512['bind']('isFocusable')['to'](_0x155e0f,'isCollapsed',_0x355b11=>!_0x355b11),_0x1fdd36['onClick']&&this['listenTo'](_0x285512,'execute',()=>{this['view']['isCollapsed']||_0x1fdd36['onClick'](_0x2a9a15,_0x285512['element']);}),_0x285512;}),this['listenTo'](_0x155e0f['inlineListView'],'execute',()=>{this['presenceDropdownView']?this['hideDropdown']():this['view']['isCollapsed']&&this['showDropdown']();}),_0x155e0f['inlineListView']['keystrokes']['set']('Enter',(_0x1c0744,_0x133ab9)=>{this['view']['isCollapsed']&&(this['showDropdown'](),_0x133ab9());}),_0x155e0f['render'](),_0x57b81f['render'](),_0xcafd9({'emitter':_0x155e0f,'activator':()=>_0x57b81f['isVisible'],'contextElements':[_0x57b81f['element'],_0x155e0f['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0x484447['config']['get']('presenceList.container')['appendChild'](_0x155e0f['element']),this['_bodyCollection']=new _0x14f09d(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_bodyCollection']['add'](this['balloonPanelView']),_0x155e0f;}['_handleUserAdd'](_0x2544fd){if(!this['context']['config']['get']('presenceList.displayMe')&&_0x2544fd['isMe'])return;const _0x44fbd8=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['usersCount']++,this['currentDisplayedUsers']['length']==_0x44fbd8&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](0x1);const _0xe57c70=_0x2544fd['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0x2544fd,_0xe57c70);}['_handleUserRemove'](_0x2d8b44){if(this['usersCount']--,this['currentDisplayedUsers']['get'](_0x2d8b44['id'])&&(this['currentDisplayedUsers']['remove'](_0x2d8b44['id']),this['currentDisplayedUsers']['length']<this['usersCount'])){for(const _0x3d5a1c of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0x3d5a1c['id']))return void this['currentDisplayedUsers']['add'](_0x3d5a1c,Math['min'](this['currentDisplayedUsers']['length'],0x1));}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0x1eca3e=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new M(this['context']['locale'],!!_0x1eca3e['onClick']),this['view']['inlineListView']['isExpanded']=!0x0;const {listWrapperView:_0x528ff4}=this['presenceDropdownView'];_0x528ff4['items']['bindTo'](this['_allConnectedUsers'])['using'](_0x57b5c6=>{if(!_0x1eca3e['displayMe']&&_0x57b5c6['isMe'])return null;const _0xd8307a=new E(this['context']['locale'],_0x57b5c6,!!_0x1eca3e['onClick']);return _0x1eca3e['onClick']&&this['listenTo'](_0xd8307a,'execute',()=>{_0x1eca3e['onClick'](_0x57b5c6,_0xd8307a['element']);}),_0xd8307a;}),this['balloonPanelView']['content']['add'](this['presenceDropdownView']),this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element']}),_0x528ff4['focus'](),_0x528ff4['checkIfScrollable']();const _0x388b35=(_0x389666,_0xfaee93)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0xfaee93();};_0x528ff4['keystrokes']['set']('Esc',_0x388b35),_0x528ff4['keystrokes']['set']('Shift+Tab',_0x388b35),_0x528ff4['keystrokes']['set']('Tab',(_0x36b0d2,_0x4d7be3)=>{!function(_0x12c6d6){const _0x1d6074=['a','button','input','select','textarea','[tabindex]','[contenteditable]']['map'](_0x2799b8=>_0x2799b8+':not([disabled]):not([tabindex=\x22-1\x22])')['join'](','),_0x1adf61=[...document['body']['querySelectorAll'](_0x1d6074)]['filter'](_0x5500fe=>_0x5500fe===document['activeElement']||_0x5500fe['offsetWidth']+_0x5500fe['offsetHeight']>0x0)['sort']((_0x51e7f4,_0x44ce63)=>(_0x51e7f4['tabIndex']||0x0)-(_0x44ce63['tabIndex']||0x0)),_0x1914af=_0x1adf61['indexOf'](_0x12c6d6),_0x27b34c=_0x1adf61[(_0x1914af+0x1)%_0x1adf61['length']];_0x27b34c&&_0x27b34c['focus']();}(this['view']['element']),this['hideDropdown'](),_0x4d7be3();}),_0x528ff4['focusTracker']['add'](this['view']['element']),_0x528ff4['focusTracker']['on']('change:isFocused',(_0x502ddd,_0x3948dc,_0x309d34)=>{_0x309d34||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);}}class s extends _0x42fe86{static get['requires'](){return[i,r];}static get['pluginName'](){return'PresenceList';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}export{a as CloudServicesCommentsAdapter,u as CloudServicesRevisionHistoryAdapter,f as CloudServicesTrackChangesAdapter,s as PresenceList,l as RealTimeCollaborationClient,m as RealTimeCollaborativeComments,n as RealTimeCollaborativeEditing,g as RealTimeCollaborativeRevisionHistory,p as RealTimeCollaborativeTrackChanges};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-real-time-collaboration",
3
- "version": "44.0.0-alpha.4",
3
+ "version": "44.0.0-alpha.5",
4
4
  "description": "A set of CKEditor 5 features enabling real-time collaboration within the editor using CKEditor Cloud Services.",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "author": "CKSource (http://cksource.com/)",
@@ -42,14 +42,14 @@
42
42
  ],
43
43
  "dependencies": {
44
44
  "@ckeditor/ckeditor-cloud-services-collaboration": "52.6.11",
45
- "@ckeditor/ckeditor5-core": "44.0.0-alpha.4",
46
- "@ckeditor/ckeditor5-engine": "44.0.0-alpha.4",
47
- "@ckeditor/ckeditor5-operations-compressor": "44.0.0-alpha.4",
48
- "@ckeditor/ckeditor5-theme-lark": "44.0.0-alpha.4",
49
- "@ckeditor/ckeditor5-ui": "44.0.0-alpha.4",
50
- "@ckeditor/ckeditor5-utils": "44.0.0-alpha.4",
51
- "ckeditor5": "44.0.0-alpha.4",
52
- "ckeditor5-collaboration": "44.0.0-alpha.4",
45
+ "@ckeditor/ckeditor5-core": "44.0.0-alpha.5",
46
+ "@ckeditor/ckeditor5-engine": "44.0.0-alpha.5",
47
+ "@ckeditor/ckeditor5-operations-compressor": "44.0.0-alpha.5",
48
+ "@ckeditor/ckeditor5-theme-lark": "44.0.0-alpha.5",
49
+ "@ckeditor/ckeditor5-ui": "44.0.0-alpha.5",
50
+ "@ckeditor/ckeditor5-utils": "44.0.0-alpha.5",
51
+ "ckeditor5": "44.0.0-alpha.5",
52
+ "ckeditor5-collaboration": "44.0.0-alpha.5",
53
53
  "lodash-es": "4.17.21"
54
54
  },
55
55
  "types": "src/index.d.ts",