@ckeditor/ckeditor5-real-time-collaboration 44.1.0-alpha.4 → 44.1.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/build/real-time-collaboration.js +1 -1
- package/dist/index.js +6 -6
- package/package.json +9 -9
- package/src/presencelist/presencelistui.js +1 -1
- package/src/presencelist/view/presencecounterview.js +1 -1
- package/src/presencelist/view/presencedropdownlistitemview.js +1 -1
- package/src/presencelist/view/presencedropdownlistview.js +1 -1
- package/src/presencelist/view/presenceinlinelistitemview.js +1 -1
- package/src/presencelist/view/presenceinlinelistview.js +1 -1
- package/src/presencelist/view/presencelistview.js +1 -1
- package/src/realtimecollaborativeediting/realtimecollaborationclient.js +1 -1
- package/src/realtimecollaborativeediting/sessions.js +1 -1
- package/src/realtimecollaborativeediting/usermarkers.js +1 -1
- package/src/realtimecollaborativeediting/websocketgateway.js +1 -1
- package/src/realtimecollaborativerevisionhistory/cloudservicesrevisionhistoryadapter.js +1 -1
- package/src/realtimecollaborativetrackchanges/cloudservicestrackchangesadapter.js +1 -1
package/dist/index.js
CHANGED
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
import{ContextPlugin as
|
|
24
|
-
((()=>ft)());static ['initialReconnectionInterval']=0x3e8;['connection'];['_reconnectionStack'];['_shouldPluginsReconnect'];['_domEmitter'];static get['requires'](){return['CloudServices',_0x376bc7];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x30cdb5){super(_0x30cdb5),this['set']('state',_0x5e13e5['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=Object['create'](_0x273233);}['init'](){const _0x25787d=this['context'],_0x2aba10=_0x25787d['plugins']['get']('CloudServices'),_0x58a1d4=_0x25787d['plugins']['get'](_0x376bc7);if(!_0x2aba10['token'])throw new _0x9a6666('websocketgateway-missing-token',this);if(!_0x2aba10['webSocketUrl'])throw new _0x9a6666('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'](_0x2aba10['token'],_0x2aba10['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0x989614=>{if(this['connection']=_0x989614,this['bind']('state')['to'](_0x989614,'state',this,'_isBrowserOffline',(_0xc66750,_0x1d3662)=>('connected'!==_0xc66750&&(this['_shouldPluginsReconnect']=!0x0),_0x1d3662||_0xc66750!==_0x5e13e5['CONNECTED']?_0x5e13e5['DISCONNECTED']:this['state']==_0x5e13e5['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),_0x5e13e5['CONNECTING']):_0x5e13e5['CONNECTED'])),this['connection']['on']('error',(_0x272380,_0x263c31)=>{if('limitExceeded'!==_0x263c31['code'])throw console['error'](_0x263c31),new _0x9a6666('cloudservices-init',null,{'originalError':_0x263c31});_0x58a1d4['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'});}),!_0x989614['me'])return new Promise(_0x57de34=>_0x989614['on']('change:me',_0x57de34));})['catch'](_0x403813=>{throw console['error'](_0x403813),new _0x9a6666('cloudservices-init',null,{'originalError':_0x403813});});}['addToReconnectionStack'](_0x4f5f01){if('function'!=typeof _0x4f5f01['reconnect'])throw new _0x9a6666('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0x4f5f01))throw new _0x9a6666('websocketgateway-plugin-already-registered',this,{'name':_0x4f5f01['constructor']['pluginName']});this['_reconnectionStack']['add'](_0x4f5f01);}['removeFromReconnectionStack'](_0x40f842){this['_reconnectionStack']['delete'](_0x40f842);}['isInReconnectionStack'](_0x46ef9a){return this['_reconnectionStack']['has'](_0x46ef9a);}['_reconnect'](){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0x303c6f=>_0x303c6f['reconnect']())))['then'](()=>this['state']=_0x5e13e5['CONNECTED'])['catch'](_0x37ba2d=>{throw console['error'](_0x37ba2d),new _0x9a6666('cloudservices-reconnection-error',this['context']);});}['destroy'](){this['connection']&&this['connection']['disconnect'](),this['state']=_0x5e13e5['DISCONNECTED'],this['_domEmitter']['stopListening'](),super['destroy']();}}class i extends _0x372b71{['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,_0x46f64e];}constructor(_0x3ad1ed){super(_0x3ad1ed),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0x45dde9(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x46f64e);}['init'](){const _0xf20b2d=this['context']['plugins']['get'](c);this['listenTo'](_0xf20b2d,'change:state',(_0x4fe583,_0x21a7b8,_0x305a2c)=>{if('connected'!==_0x305a2c)this['channelSessions']['forEach'](_0x3351d7=>_0x3351d7['clear']()),this['channelConnectedUsers']['forEach'](_0x1faa98=>_0x1faa98['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x415983,_0x127430]of this['_registeredSessions'])for(const _0x83b76e of _0x127430)this['_handleSessionAdd'](_0x415983,_0x83b76e);}}),this['_createUser'](_0xf20b2d['connection']['me'],!0x0);}['register'](_0x5a3b31,_0x1affdd){if(this['_registeredSessions']['has'](_0x5a3b31))throw new _0x9a6666('sessions-register-already-registered',null,{'channelId':_0x5a3b31});this['_registeredSessions']['set'](_0x5a3b31,_0x1affdd),this['channelSessions']['set'](_0x5a3b31,new _0x45dde9()),this['channelConnectedUsers']['set'](_0x5a3b31,new _0x45dde9()),this['listenTo'](_0x1affdd,'add',(_0x49545e,_0x22bb55)=>this['_handleSessionAdd'](_0x5a3b31,_0x22bb55)),this['listenTo'](_0x1affdd,'remove',(_0x5d1a23,_0x362a22)=>this['_handleSessionRemove'](_0x5a3b31,_0x362a22));for(const _0x26d6d9 of _0x1affdd)this['_handleSessionAdd'](_0x5a3b31,_0x26d6d9);}['unregister'](_0x2e5c26){if(!this['_registeredSessions']['has'](_0x2e5c26))throw new _0x9a6666('sessions-unregister-not-exist',null,{'channelId':_0x2e5c26});const _0xb59325=this['_registeredSessions']['get'](_0x2e5c26);this['stopListening'](_0xb59325);for(const _0xc30f40 of _0xb59325)'connected'===this['context']['plugins']['get'](c)['state']&&this['_handleSessionRemove'](_0x2e5c26,_0xc30f40);this['_registeredSessions']['delete'](_0x2e5c26),this['channelSessions']['delete'](_0x2e5c26),this['channelConnectedUsers']['delete'](_0x2e5c26);}get['mySessionId'](){return this['context']['plugins']['get'](c)['connection']['sessionId'];}['getUserBySessionId'](_0x1091c5){for(const _0x36ac35 of this['channelSessions']['values']())for(const _0x3541c8 of _0x36ac35)if(_0x3541c8['id']===_0x1091c5)return _0x3541c8['user'];}['getUserSessions'](_0x1e8886,_0x5d6b3b){const _0x21b843=_0x5d6b3b?[this['channelSessions']['get'](_0x5d6b3b)]:this['channelSessions']['values'](),_0x400923=new Set();for(const _0xa06b33 of _0x21b843)for(const _0x2a5cfe of _0xa06b33)_0x2a5cfe['user']['id']===_0x1e8886['id']&&_0x400923['add'](_0x2a5cfe['id']);return _0x400923;}['getUserRole'](_0x518452){for(const _0x4d91b7 of this['channelSessions']['values']())for(const _0xb7a00a of _0x4d91b7)if(_0xb7a00a['user']===_0x518452)return _0xb7a00a['role'];}['_handleSessionAdd'](_0x13e0ea,_0x455a1c){if('connected'!==this['context']['plugins']['get'](c)['state'])return;const _0x4dc2dd=_0x455a1c['user'],_0x4f42cb=this['_users']['getUser'](_0x4dc2dd['id'])||this['_createUser'](_0x4dc2dd),_0x677d16=Object['assign']({},_0x455a1c,{'user':_0x4f42cb});this['channelSessions']['get'](_0x13e0ea)['add'](_0x677d16);const _0x192952=this['channelConnectedUsers']['get'](_0x13e0ea);_0x192952['has'](_0x4f42cb['id'])||_0x192952['add'](_0x4f42cb),this['allConnectedUsers']['has'](_0x4f42cb['id'])||this['allConnectedUsers']['add'](_0x4f42cb,_0x4f42cb['isMe']?0x0:void 0x0),this['fire']('sessionAdd:'+_0x13e0ea,{'channelId':_0x13e0ea,'session':_0x677d16});}['_handleSessionRemove'](_0x18ad4c,_0xf0f72a){if('connected'!==this['context']['plugins']['get'](c)['state'])return;const _0x509cbd=this['channelConnectedUsers']['get'](_0x18ad4c),_0x120ac4=_0xf0f72a['user'];_0x120ac4['id']&&(this['channelSessions']['get'](_0x18ad4c)['remove'](_0xf0f72a['id']),_0x509cbd['has'](_0x120ac4['id'])&&!this['getUserSessions'](_0x120ac4,_0x18ad4c)['size']&&_0x509cbd['remove'](_0x120ac4['id']),this['allConnectedUsers']['get'](_0x120ac4['id'])&&!this['getUserSessions'](_0x120ac4)['size']&&this['allConnectedUsers']['remove'](_0x120ac4['id']));}['_createUser'](_0x27eed1,_0x585f62){const _0x517ced=this['_users']['addUser'](_0x27eed1);return _0x585f62&&this['_users']['defineMe'](_0x27eed1['id']),_0x517ced['orderNumber']=this['_uniqueUsersCount']++,_0x517ced;}}class N extends _0x8d0283{['_domEmitter']=new(_0x273233())();static get['requires'](){return[i];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x5234f6=this['editor'],_0x5800ea=_0x5234f6['plugins']['get'](i);_0x5234f6['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x1e051e,{writer:_0x4e8115})=>function(_0x3e04fe,_0x58af76,_0x196158,_0x145677){const _0x4d71cb=_0x3e04fe['markerName']['split'](':')[0x2],_0x50d434=_0x196158['getUserBySessionId'](_0x4d71cb);if(!_0x50d434||_0x4d71cb===_0x196158['mySessionId'])return;if(!_0x145677['model']['schema']['checkChild'](_0x3e04fe['markerRange']['start'],'$text'))return;const _0x40d53d={'class':'ck-user__marker\x20'+_0x50d434['color']['getMarkerClass'](),'data-name':_0x50d434['name'],'data-session-id':_0x4d71cb},_0x44a09d=_0x145677['model']['markers']['get'](_0x3e04fe['markerName']),_0x29c8e5=_0x44a09d['getStart'](),_0x469f28=_0x29c8e5['nodeAfter'],_0x537cfc=_0x145677['model']['schema'];if(_0x469f28&&_0x537cfc['isObject'](_0x469f28)&&_0x537cfc['isInline'](_0x469f28)&&!_0x145677['model']['markers']['get']('user:range:'+_0x4d71cb)['getRange']()['isCollapsed'])return;const _0x5d336c=_0x29c8e5['parent'];return _0x145677['model']['schema']['isLimit'](_0x5d336c)&&!_0x145677['model']['hasContent'](_0x5d336c)&&(_0x40d53d['contenteditable']=!0x1),function(_0x1b90ed,_0x2dc49c,_0x5eb933){const _0x57d431=_0x1b90ed['createUIElement']('span',_0x2dc49c);return _0x1b90ed['setCustomProperty']('userPositionMarker',!0x0,_0x57d431),_0x57d431['render']=function(_0x3cc442){const _0x101dfc=this['toDomElement'](_0x3cc442);return _0x101dfc['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>'+_0x5eb933['name']+'</span>',_0x101dfc['addEventListener']('mouseenter',()=>{_0x101dfc['classList']['add']('ck-user__marker_hovered');}),_0x101dfc['addEventListener']('mouseleave',()=>{_0x101dfc['classList']['remove']('ck-user__marker_hovered');}),_0x101dfc;},_0x57d431['isSimilar']=function(_0x35f6c9){return!(!this['getCustomProperty']('userPositionMarker')||!_0x35f6c9['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0x35f6c9['getAttribute']('data-session-id'));},_0x57d431;}(_0x58af76,_0x40d53d,_0x50d434);}(_0x1e051e,_0x4e8115,_0x5800ea,_0x5234f6)}),_0x5234f6['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0x4a0f99=>function(_0x29cdff,_0x4e6208){const _0x379ad2=_0x29cdff['markerName']['split'](':')[0x2];if(_0x379ad2===_0x4e6208['mySessionId'])return null;const _0x5cba5a=_0x4e6208['getUserBySessionId'](_0x379ad2);if(!_0x5cba5a)return{'id':_0x379ad2,'classes':[]};return{'id':_0x379ad2,'classes':['ck-user__selection',_0x5cba5a['color']['getSelectionClass']()],'attributes':{'data-session-id':_0x379ad2},'priority':0x7d0+_0x5cba5a['orderNumber']};}(_0x4a0f99,_0x5800ea)}),function(_0x3b6185){const _0x2d651e=_0x3b6185['model'],_0x132e82=new Map(),_0x59e8fb=_0x3b6185['plugins']['get'](i);_0x2d651e['markers']['on']('update:user:range',(_0x373af0,_0x3f541e,_0xbdb95f,_0x554bf3)=>{if(!_0x554bf3&&_0x132e82['get'](_0x3f541e['name']))return _0x132e82['get'](_0x3f541e['name'])['detach'](),void _0x132e82['delete'](_0x3f541e['name']);const _0x3eb069=_0x3f541e['name']['split'](':')[0x2];if(_0x3eb069===_0x59e8fb['mySessionId'])return;const _0x15b01c='user:position:'+_0x3eb069;_0x2d651e['markers']['has'](_0x15b01c)&&_0x3b6185['editing']['reconvertMarker'](_0x15b01c),_0x3f541e['on']('change:range',(_0x5eff35,_0x3e77c1,_0x1fe53f)=>{if('$graveyard'!=_0x3e77c1['root']['rootName']&&'$graveyard'==_0x3f541e['getRange']()['root']['rootName']&&!_0x132e82['has'](_0x3f541e['name'])){const _0x3c70d9=_0x2d651e['schema']['getNearestSelectionRange'](_0x1fe53f['deletionPosition']);if(_0x3c70d9){const _0x4d32ab=ut['fromRange'](_0x3c70d9);_0x132e82['set'](_0x3f541e['name'],_0x4d32ab),_0x4d32ab['on']('change:range',(_0x377708,_0x55c2c2,_0x552630)=>{if('$graveyard'==_0x4d32ab['root']['rootName']){const _0x46ee2c=_0x2d651e['schema']['getNearestSelectionRange'](_0x552630['deletionPosition']);_0x46ee2c?(_0x4d32ab['start']=_0x46ee2c['start'],_0x4d32ab['end']=_0x46ee2c['end']):(_0x132e82['delete'](_0x3f541e['name']),_0x4d32ab['detach']());}});}}});}),_0x2d651e['document']['on']('change',()=>{_0x132e82['size']>0x0&&_0x2d651e['enqueueChange']({'isUndoable':!0x1},_0x1aed4b=>{for(const [_0x42503e,_0x16bb19]of _0x132e82)'$graveyard'==_0x2d651e['markers']['get'](_0x42503e)['getRange']()['root']['rootName']&&(G(_0x42503e['split'](':')[0x2],_0x16bb19['toRange'](),_0x2d651e,_0x1aed4b),_0x16bb19['detach']());_0x132e82['clear']();});});}(_0x5234f6),this['_domEmitter']['listenTo'](_0x4140b4['document'],'keydown',(_0x4d6399,{key:_0x16764b})=>{'Escape'===_0x16764b&&function(_0x2e9ece){_0x2e9ece['editing']['view']['change'](_0x5c7488=>{for(const _0x50abe5 of _0x2e9ece['model']['markers']){if(!_0x50abe5['name']['startsWith']('user:position'))continue;const _0x23cdd0=_0x2e9ece['editing']['mapper']['markerNameToElements'](_0x50abe5['name']);if(_0x23cdd0){for(const _0x72107b of _0x23cdd0)_0x5c7488['removeClass']('ck-user__marker_hovered',_0x72107b);}}});}(_0x5234f6);},{'useCapture':!0x0});}['afterInit'](){const _0x57850b=this['editor'],_0x1ff496=_0x57850b['commands']['get']('undo');_0x1ff496&&_0x57850b['model']['on']('applyOperation',(_0x473fbe,_0x593c62)=>{const _0x617d8b=_0x593c62[0x0];if('marker'!=_0x617d8b['type']||!_0x617d8b['name']['startsWith']('user:'))return;const _0x3f2ae3=_0x617d8b['batch'];_0x1ff496['_createdBatches']['has'](_0x3f2ae3)&&(_0x617d8b['newRange']=_0x617d8b['oldRange']?_0x57850b['model']['createRange'](_0x617d8b['oldRange']['start'],_0x617d8b['oldRange']['end']):null);},{'priority':'highest'});}['destroy'](){return this['_domEmitter']['stopListening'](),super['destroy']();}['createUserMarkerOperations'](){const _0x211386=this['editor'],_0x501346=_0x211386['model']['document'],_0x222625=_0x211386['plugins']['get'](i);_0x211386['model']['enqueueChange']({'isUndoable':!0x1},_0x300345=>{const _0x4abf8c='user:range:'+_0x222625['mySessionId'],_0x1f849b='user:position:'+_0x222625['mySessionId'],_0x310e7c=_0x211386['model']['markers']['has'](_0x4abf8c);_0x211386['editing']['view']['hasDomSelection']?G(_0x222625['mySessionId'],_0x501346['selection']['getFirstRange'](),_0x211386['model'],_0x300345):_0x310e7c&&(_0x300345['removeMarker'](_0x4abf8c),_0x300345['removeMarker'](_0x1f849b));});}}function G(_0x3d6b88,_0x3d6a88,_0x2b5719,_0x935929){const _0x2f619c='user:range:'+_0x3d6b88,_0x4b358d='user:position:'+_0x3d6b88,_0x572446=_0x3d6a88['getContainedElement']();let _0x556dbf=_0x3d6a88['start'];_0x572446&&_0x572446['is']('element','tableCell')&&(_0x556dbf=function(_0x639f57,_0x6f973b){for(const _0x1a35d4 of _0x639f57['getPositions']())if(_0x6f973b['schema']['checkChild'](_0x1a35d4,'$text'))return _0x1a35d4;}(_0x3d6a88,_0x2b5719),_0x3d6a88=_0x935929['createRange'](_0x556dbf));const _0x2a17b1=_0x935929['createRange'](_0x556dbf);_0x2b5719['markers']['has'](_0x2f619c)?(_0x935929['updateMarker'](_0x2f619c,{'range':_0x3d6a88}),_0x935929['updateMarker'](_0x4b358d,{'range':_0x2a17b1})):(_0x935929['addMarker'](_0x2f619c,{'range':_0x3d6a88,'usingOperation':!0x0}),_0x935929['addMarker'](_0x4b358d,{'range':_0x2a17b1,'usingOperation':!0x0}));}function E(_0x1cd6f1,_0x17594b,_0x3e2d7d){const _0x5ea767=_0x1cd6f1['t'],t=_0x1cd6f1['t'];switch(_0x17594b){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 _0x5ea767({'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'},_0x3e2d7d);default:return'';}}let M=0x1;class l extends _0x8d0283{static ['CollaborativeEditingService']=/* #__PURE__ -- @preserve */
|
|
25
|
-
((()=>_0x539774)());['_offset'];['sessionId'];['serverHistory'];['_channelId'];['_service'];['_document'];['_compressor'];['_bufferedOperations'];['_knownOperations'];['_knownRootNames'];['_pendingAction'];['_hasSelectionChanged'];['_sendBufferedOperationsDelayId'];['_baseBufferDelay'];['_currentBufferDelay'];['_lastSyncedOperationId'];['_disconnectionOperations'];['_operationIdentifier'];static get['requires'](){return[c,i,N,_0x6add7a,_0x46f64e,_0x376bc7];}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 _0x5ac7f0=this['serverHistory']['getOperations']();for(let _0x268777=_0x5ac7f0['length']-0x1;_0x268777>=0x0;_0x268777--){const _0xf8d1d8=_0x5ac7f0[_0x268777];if(!this['_disconnectionOperations']['has'](_0xf8d1d8))return _0xf8d1d8['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0x4a5b74){if(super(_0x4a5b74),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x5124fa(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0x9a6666('collaboration-missing-channelid',this);const _0x461062=_0x4a5b74['config']['get']('cloudServices.bundleVersion')||dt;this['_service']=new l['CollaborativeEditingService'](_0x461062,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0x53b0ac(),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 W(this['_disconnectionOperations']);}['init'](){const _0x69c305=this['editor'],_0x5f0b64=_0x69c305['plugins']['get'](_0x46f64e),_0x3c5555=_0x69c305['plugins']['get'](c);this['listenTo'](_0x5f0b64,'getOperationAuthor',(_0x5818c8,_0x4958e8)=>{const _0x1fc951=_0x4958e8[0x0];_0x1fc951['_authorId']&&(_0x5818c8['return']=_0x5f0b64['getUser'](_0x1fc951['_authorId']),_0x5818c8['stop']()),null===_0x1fc951['_authorId']&&(_0x5818c8['return']=null,_0x5818c8['stop']());},{'priority':'high'}),this['listenTo'](_0x69c305['model']['document']['selection'],'change:range',(_0x5dd46a,_0x4be76c)=>{_0x4be76c['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x69c305['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x69c305['model']['on']('applyOperation',(_0x475c1b,_0x3805d2)=>{const _0x3b4153=_0x3805d2[0x0];_0x3b4153['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0x3b4153),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['bind']('_isEditingAllowed')['to'](_0x3c5555,'state',this,'_hasSynchronizationProblem',(_0x16957e,_0x327563)=>'connected'===_0x16957e&&!_0x327563),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x69c305['disableReadOnlyMode']('rtc-offline'):_0x69c305['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x69c305['disableReadOnlyMode']('rtc-offline'):_0x69c305['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async['reconnect'](){const _0x506fc=this['editor']['plugins']['get'](i),_0x3f6187=this['editor']['plugins']['get'](c);try{this['_isPendingUpdate']=!0x0,_0x506fc['unregister'](this['_channelId']);const _0xb7694c=await this['_service']['reconnect'](_0x3f6187['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0xb7694c)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x6faece=await this['_service']['getConnectedSessions']();_0x506fc['register'](this['_channelId'],_0x6faece),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x1feac4){if(function(_0x49145b){return'404'===_0x49145b['code'];}(_0x1feac4)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0x1acc2c){return'409'===_0x1acc2c['code'];}(_0x1feac4)){const _0x547d15=E(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'](_0x547d15);}else{if(!(_0x1feac4 instanceof z))throw _0x1feac4;this['_handleReconnectionError']();}}}}['destroy'](){const _0x370db6=this['editor']['plugins']['get'](c),_0x4316e1=this['editor']['plugins']['get'](i);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x4316e1['channelSessions']['has'](this['_channelId'])&&_0x4316e1['unregister'](this['_channelId']),_0x370db6['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async['_handleReconnectionResponse'](_0x31bb11){if(this['sessionId']!==_0x31bb11['sessionId']&&this['_lastSyncedOperationId']!==_0x31bb11['lastOperationId'])throw new z();return this['sessionId']=_0x31bb11['sessionId'],this['_handleServerResponse']([],{..._0x31bb11,'wereChangesApplied':!0x1,'data':_0x31bb11['data']},'reconnect');}async['_connectService'](_0x1bf2ca,_0x1adc2e=!0x1){const {connection:_0x599781}=this['editor']['plugins']['get'](c);l['CollaborativeEditingService']['getConnectedSessions'](_0x599781,this['_channelId'])['then'](_0x29e084=>this['_initSessionsHandling'](_0x29e084))['catch'](_0x48ff74=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x48ff74);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x4ddfbf,_0x46a08e)=>{this['_crash']('realtimecollaborationclient-initservice-internal-error',_0x46a08e);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_isConnected']=!0x1;});const _0x653fea=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x1bf2ca);this['_isPendingUpdate']=!0x0;const _0x18066a=await this['_service']['connect'](_0x599781,this['_compressOperations'](_0x1bf2ca),_0x653fea);if(this['sessionId']=_0x18066a['sessionId'],_0x1adc2e){if(!_0x18066a['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x18066a['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0x1bf2ca,_0x18066a,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x18066a,_0x1bf2ca);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}['_handleSendingSelectionMarkers'](){const _0x481d58=this['editor']['plugins']['get'](i),_0x4234cf=this['editor']['plugins']['get'](N),_0x5c1d68=_0x481d58['channelSessions']['get'](this['_channelId']);_0x5c1d68&&_0x5c1d68['length']>0x1?_0x4234cf['createUserMarkerOperations']():this['listenTo'](_0x481d58,'sessionAdd:'+this['_channelId'],()=>{0x2===_0x481d58['channelSessions']['get'](this['_channelId'])['length']&&_0x4234cf['createUserMarkerOperations']();});}async['_handleReceivedOperations'](_0x291642,_0x14dc21,_0x3b900e,_0x41b947){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x14dc21){const _0x36f94b=this['_decompressOperations'](_0x3b900e,_0x41b947);await this['_fetchMissingUsers'](_0x36f94b),this['_handleExternalOperations'](_0x36f94b,_0x14dc21,_0x3b900e['lastOperationId'])||this['_crash']('realtimecollaborationclient-initservice-incorrect-server-operation');}}async['_connectAfterSessionHasBeenFlushed'](){this['_disconnectService']();const {locale:_0x5d511c}=this['editor'];let _0xd27040;try{_0xd27040=await this['_service']['getDocumentDetails']();}catch(_0x2e7f96){const _0x26ba64=E(_0x5d511c,'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'](_0x26ba64);}const _0x3f7f59=_0xd27040['currentDocumentSession']||_0xd27040['lastDocumentSession'];if(this['_lastSyncedOperationId']===_0x3f7f59['lastOperationId'])await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);else{const _0x576480=E(_0x5d511c,'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'](_0x576480);}}['_disconnectService'](){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['stopListening'](this['_service']);}['_initSessionsHandling'](_0x3e463c){const _0x874930=this['editor']['plugins']['get'](i);this['listenTo'](_0x874930,'sessionAdd:'+this['_channelId'],(_0xc56485,{session:_0x5526e4})=>{if(_0x5526e4['id']===_0x874930['mySessionId']){_0xc56485['off']();const _0x4f53a2=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0x342a5f=_0x5526e4['permissions'];_0x4f53a2&&_0x4f53a2['isEnabled']&&(_0x342a5f=_0x342a5f['filter'](_0x26bd3d=>'document:write'!==_0x26bd3d)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0x342a5f,this['_channelId']);}}),_0x874930['register'](this['_channelId'],_0x3e463c);}['_initThrowingOnDataSet'](){const _0xac2677=this['editor']['data']['set'];this['editor']['data']['set']=(..._0x255e19)=>{if(!_0x255e19[_0x255e19['length']-0x1]['suppressErrorInCollaboration'])throw new _0x9a6666('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0xac2677['apply'](this['editor']['data'],_0x255e19);};}['_setUpDataInit'](){this['editor']['data']['on']('init',(_0x36c3b4,[_0x1160b4])=>{if(this['_document']['version'])throw new _0x9a6666('realtimecollaborationclient-init-document-already-initialized',this);_0x36c3b4['stop'](),this['_setPendingAction']();const _0x28c8e6=this['editor']['config']['get']('rootsAttributes'),_0xe05670=this['_getOperationsFromInitData'](_0x1160b4,_0x28c8e6);0x0==_0xe05670['length']&&_0xe05670['push'](new _0x426153(0x0)),_0x36c3b4['return']=this['_connectService'](_0xe05670)['then'](()=>{this['editor']['plugins']['get'](c)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x390383=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x390383))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x344363,[_0x5976ed,_0x57f2dd])=>{_0x344363['stop']();const _0xe24916=this['editor']['model']['document']['getRoot'](_0x5976ed);if(!this['_knownRootNames']['has'](_0x5976ed)){const _0x25d73b=_0x57f2dd&&_0x57f2dd['data']?_0x57f2dd['data']:'',_0x5a01a0=_0x57f2dd&&_0x57f2dd['attributes']?_0x57f2dd['attributes']:{};await this['_loadRoot'](_0x5976ed,_0x25d73b,_0x5a01a0);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0xe24916['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0xe24916);});},{'priority':'high'});}async['_fetchMissingUsers'](_0x3b3889){const _0x16de23=this['editor']['plugins']['get'](_0x46f64e),{connection:_0x2a1814}=this['editor']['plugins']['get'](c),_0x1a1ac4=new Set();for(const _0x316b7e of _0x3b3889){const _0x56d9fb=_0x316b7e['_authorId'];_0x56d9fb&&!_0x16de23['getUser'](_0x56d9fb)&&_0x1a1ac4['add'](_0x56d9fb);}if(0x0===_0x1a1ac4['size'])return;const _0x344c00=await mt['getMany'](_0x2a1814,Array['from'](_0x1a1ac4));for(const _0x5501b8 of _0x344c00)_0x16de23['getUser'](_0x5501b8['id'])||_0x16de23['addUser'](_0x5501b8);}['_getOperationsFromInitData'](_0x1f7de0,_0x1ac5ad={}){const _0x1f4fd7=this['editor']['model'],_0x21371b=[];let _0x48e4f4=0x0;const _0x2c954b='string'==typeof _0x1f7de0?{'main':_0x1f7de0}:_0x1f7de0;for(const _0x25ac9f of Object['keys'](_0x2c954b)){if(!this['_document']['roots']['has'](_0x25ac9f))throw new _0x9a6666('realtimecollaborationclient-init-non-existent-root',this);const _0x59f6b4=this['editor']['data']['parse'](_0x2c954b[_0x25ac9f]),_0x53e012=this['_document']['getRoot'](_0x25ac9f),_0x3fd27b=new _0x4c3572(_0x1f4fd7['createPositionAt'](_0x53e012,0x0),_0x59f6b4,_0x48e4f4++);_0x21371b['push'](_0x3fd27b);for(const [_0x3f50f9,_0xf10532]of _0x59f6b4['markers']){const _0x5d129d=_0x1f4fd7['createRange'](_0x1f4fd7['createPositionFromPath'](_0x53e012,_0xf10532['start']['path']['slice']()),_0x1f4fd7['createPositionFromPath'](_0x53e012,_0xf10532['end']['path']['slice']())),_0x29bd1f=new _0x5ef85a(_0x3f50f9,null,_0x5d129d,_0x1f4fd7['markers'],!0x0,_0x48e4f4++);_0x21371b['push'](_0x29bd1f);}}if(_0x1ac5ad)for(const [_0x3d8b37,_0x4cfeb7]of Object['entries'](_0x1ac5ad)){const _0x1618bb=_0x1f4fd7['document']['getRoot'](_0x3d8b37);if(!_0x1618bb)throw new _0x9a6666('multi-root-editor-root-attributes-no-root',null);for(const [_0x96bff,_0xd99312]of Object['entries'](_0x4cfeb7))if(null!==_0xd99312){const _0x37df6e=new _0x324a54(_0x1618bb,_0x96bff,null,_0xd99312,_0x48e4f4++);_0x21371b['push'](_0x37df6e);}}return _0x21371b;}async['_loadRoot'](_0x4e451d,_0x422451,_0x5e3377){this['_getOperationsFromInitData']({[_0x4e451d]:_0x422451},{[_0x4e451d]:_0x5e3377})['forEach']((_0x71e240,_0x464a30)=>{_0x71e240['baseVersion']=this['_document']['version']+_0x464a30,_0x71e240['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x71e240);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async['_handleInitialConnectionData'](_0x1c0c57,_0x23f108){let _0x461457;this['_offset']=_0x1c0c57['offset'];const _0xcb6663=_0x1c0c57['wereChangesApplied']&&!_0x1c0c57['initData'],_0x1d996e=_0xcb6663?0x0:_0x1c0c57['data']['baseVersion'];if(_0x23f108['forEach'](_0x29ef68=>{_0x29ef68['_isInit']=!0x0,_0x29ef68['createdAt']=_0x1c0c57['sessionCreatedAt'],_0x29ef68['_authorId']=null;}),_0xcb6663)_0x461457=_0x23f108,this['_applyOperationsSet'](_0x461457,_0xcb6663);else{if(_0x1c0c57['initData']){const _0x2f432d=this['_getOperationsFromInitData'](_0x1c0c57['initData']);this['_document']['history']['version']=-_0x2f432d['length'],_0x2f432d['forEach'](_0x175e73=>{_0x175e73['baseVersion']-=_0x2f432d['length'],_0x175e73['createdAt']=_0x1c0c57['sessionCreatedAt'],_0x175e73['_isInit']=!0x0,_0x175e73['_authorId']=null;}),this['_applyOperationsSet'](_0x2f432d,!0x0),this['serverHistory']['version']=-_0x2f432d['length']+this['_offset'],this['_updateServerHistory'](_0x2f432d);}this['_document']['history']['version']=_0x1d996e,_0x461457=this['_decompressOperations'](_0x1c0c57['data'],_0x1c0c57['metadata']),await this['_fetchMissingUsers'](_0x461457),this['_applyOperationsSet'](_0x461457,_0xcb6663);}_0x1c0c57['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x461457,_0x1c0c57['lastOperationId']),this['_lastSyncedOperationId']=_0x1c0c57['lastOperationId']),this['serverHistory']['version']=_0x1d996e+this['_offset'],this['_updateServerHistory'](_0x461457),_0x23f108['filter'](_0x3d6419=>{const _0x4e52e5=this['_getAffectedRoot'](_0x3d6419);return _0x4e52e5&&!this['_knownRootNames']['has'](_0x4e52e5);})['forEach']((_0x4926a9,_0x44e0b0)=>{_0x4926a9['baseVersion']=this['_document']['version']+_0x44e0b0,this['_saveOperationInBuffer'](_0x4926a9);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x3ce968,_0x2fa764,_0x1b0604){throw this['_isPendingUpdate']=!0x0,_0x2fa764&&console['error'](_0x2fa764),_0x1b0604&&this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0x9a6666(_0x3ce968,this['editor']);}['_saveOperationInBuffer'](_0x2adefe){this['_knownOperations']['has'](_0x2adefe)||(this['_knownOperations']['add'](_0x2adefe),this['_bufferedOperations']['push'](_0x2adefe),this['_pendingAction']||'marker'==_0x2adefe['type']&&!_0x2adefe['affectsData']||this['_setPendingAction']());}['_sendBufferedOperationsDelayed'](_0x1cb9a9=!0x1){!_0x1cb9a9&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0x3af723=>{_0x3af723&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0x3fd959=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0x284a37){return _0x284a37['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x284a37['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0x284a37['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0x3fd959)||this['_crash'](_0x3fd959['message'],_0x3fd959,!0x0);});},this['_currentBufferDelay']));}['_waitUntilSynced'](){return new Promise(_0x49364e=>{this['on']('change:_isPendingUpdate',()=>{_0x49364e();});});}async['_sendBufferedOperations'](){const _0x45c891=this['editor']['plugins']['get'](N);if(this['_shouldSendSelectionUpdate']()&&(_0x45c891['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x1d0c7e=[...this['_bufferedOperations']];for(const _0x10ae47 of _0x1d0c7e)_0x10ae47['wasUndone']=this['_document']['history']['isUndoneOperation'](_0x10ae47);const _0x2be6aa=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x1d0c7e),_0x285795=M++,_0x476c79=this['_compressOperations'](_0x1d0c7e),_0x54b43e=await this['_service']['sendOperations'](_0x476c79,_0x476c79['baseVersion'],_0x2be6aa);try{return await this['_handleServerResponse'](_0x1d0c7e,_0x54b43e,_0x285795);}catch(_0xa5ff){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0xa5ff);}}async['_handleServerResponse'](_0x2431e0,_0xf89541,_0x517a65){if('error'in _0xf89541)throw _0xf89541['error'];let _0x33326e=!0x1;if(_0xf89541['wereChangesApplied']){_0xf89541['lastOperationId']&&(this['_lastSyncedOperationId']=_0xf89541['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0xa22c93=>!_0x2431e0['includes'](_0xa22c93));for(const _0x522c25 of _0x2431e0)_0x522c25['createdAt']='lastOperationAcceptedAt'in _0xf89541&&_0xf89541['lastOperationAcceptedAt']||void 0x0;V(_0x2431e0,_0xf89541['version']-_0x2431e0['length']),this['_updateServerHistory'](_0x2431e0);const _0x45af5b=_0x2431e0['filter'](_0x57d5f0=>{if(!_0x57d5f0['_isInit'])return!0x1;const _0x43af01=this['_getAffectedRoot'](_0x57d5f0);return _0x43af01&&!this['_knownRootNames']['has'](_0x43af01);});V(_0x45af5b,this['_document']['version']),this['_applyOperationsSet'](_0x45af5b),_0x33326e=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0xa42c97=this['_decompressOperations'](_0xf89541['data'],_0xf89541['metadata'])['filter'](_0x40293a=>_0x40293a['baseVersion']>=this['_lastServerVersion']);_0xa42c97['forEach'](_0x286da5=>this['_addKnownRoot'](_0x286da5)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x30839c=>!_0x30839c['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x30839c))),this['_bufferedOperations']['length']&&V(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0xa42c97),_0x33326e=this['_handleExternalOperations'](_0xa42c97,_0xf89541['version'],_0xf89541['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x33326e?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}['_handleExternalOperations'](_0x1fabd3,_0x97e35e,_0x3a8457){try{const _0x32f6d0={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x2b1030,operationsB:_0x4b7d71,originalOperations:_0x5cc9b6}=_0x400070(_0x1fabd3,this['_bufferedOperations'],_0x32f6d0);V(_0x2b1030,this['_document']['version']),V(_0x4b7d71,_0x97e35e);for(const _0xe9fbf0 of _0x2b1030){const _0x5b2795=_0x5cc9b6['get'](_0xe9fbf0);_0xe9fbf0['_authorId']=_0x5b2795?_0x5b2795['_authorId']:null;}_0x3a8457&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x1fabd3,_0x3a8457),this['_lastSyncedOperationId']=_0x3a8457),this['_bufferedOperations']=[..._0x4b7d71],this['_applyOperationsSet'](_0x2b1030),this['_updateServerHistory'](_0x1fabd3);}catch(_0x49cc5f){return console['error'](_0x49cc5f),!0x1;}return!0x0;}['_applyOperationsSet'](_0x4a996e,_0x58458e=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0x165510=>{for(const _0x3b5592 of _0x4a996e)this['_knownOperations']['add'](_0x3b5592),this['_addKnownRoot'](_0x3b5592),_0x165510['batch']['addOperation'](_0x3b5592),this['editor']['model']['applyOperation'](_0x3b5592);});}['_addKnownRoot'](_0x2bfa43){const _0x1276e2=this['_getAffectedRoot'](_0x2bfa43);_0x1276e2&&this['_knownRootNames']['add'](_0x1276e2);}['_getAffectedRoot'](_0x278cd8){let _0x10728f,_0x92bbf0;switch(_0x278cd8['type']){case'insert':_0x10728f=_0x278cd8['position']['root'];break;case'marker':if(_0x92bbf0=_0x278cd8['newRange'],!_0x92bbf0)return null;_0x10728f=_0x92bbf0['root'];break;case'addRootAttribute':_0x10728f=_0x278cd8['root'];break;case'addRoot':_0x10728f=_0x278cd8['affectedSelectable'];break;case'move':_0x10728f=_0x278cd8['targetPosition']['root'];break;default:return null;}return _0x10728f['rootName'];}['_updateServerHistory'](_0x1e8fe6){_0x1e8fe6['forEach'](_0x3ecec2=>{const _0x4ac941=_0x3ecec2['clone']();_0x4ac941['_authorId']=_0x3ecec2['_authorId'],_0x4ac941['_isInit']=!!_0x3ecec2['_isInit'],_0x4ac941['createdAt']=_0x3ecec2['createdAt'],_0x4ac941['baseVersion']+=this['_offset'],_0x3ecec2['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x4ac941),this['serverHistory']['addOperation'](_0x4ac941);});}['_handleReconnectionError'](_0x49be6b){const _0x1403b9=this['editor']['plugins']['get']('Notification'),_0x106826=this['editor']['locale'];_0x49be6b||(_0x49be6b=E(_0x106826,'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.')),_0x1403b9['showWarning'](_0x49be6b,{'title':E(_0x106826,'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'](_0x6add7a)['add'](E(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}['_clearPendingAction'](){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x6add7a)['remove'](this['_pendingAction']),this['_pendingAction']=null);}['_compressOperations'](_0x14d4d8){const _0x59153c=_0x14d4d8['map'](_0x12de19=>_0x12de19['toJSON']());return this['_compressor']['compress'](_0x59153c);}['_decompressOperations'](_0x37009a,_0x11fddc){return this['_compressor']['decompress'](_0x37009a)['map']((_0x4689ae,_0xf397f1)=>{const _0x56245c='init'==_0x11fddc[_0xf397f1]['type'];if('InsertOperation'==_0x4689ae['__className']){const _0x47db66=_0x4689ae['position']['root'];!this['_document']['getRoot'](_0x47db66)&&(this['_document']['createRoot']('$root',_0x47db66)['_isAttached']=!0x1);}const _0x349c3c=_0x471024['fromJSON'](_0x4689ae,this['_document']);return _0x349c3c['wasUndone']=_0x4689ae['wasUndone'],_0x349c3c['_isInit']=_0x56245c,_0x349c3c['_authorId']=_0x56245c?null:_0x11fddc[_0xf397f1]['userId'],_0x349c3c['_isDisconnection']='cs:removeUser'===_0x11fddc[_0xf397f1]['type'],_0x349c3c['createdAt']=_0x11fddc[_0xf397f1]['createdAt'],_0x349c3c;});}['_refreshUserSelectionMarkers'](){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}['_shouldSendSelectionUpdate'](){const _0x152678=this['editor']['plugins']['get'](i)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0x152678&&_0x152678['length']>0x1&&this['_hasSelectionChanged'];}['_shouldSendUpdate'](){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}}class z extends Error{}function V(_0x3cf3d5,_0x7ea56b){for(const _0x2be9dd of _0x3cf3d5)_0x2be9dd['baseVersion']=_0x7ea56b++;}class W{['_ignoredOperations'];['_operationToId'];constructor(_0x13b065){this['_ignoredOperations']=_0x13b065,this['_operationToId']=new WeakMap();}['getIdOfTheLastOperation'](_0x170143){let _0x38b4a9=_0x170143['length'];for(;_0x38b4a9--;){const _0x142b00=_0x170143[_0x38b4a9];if(!this['_ignoredOperations']['has'](_0x142b00)){if(!this['_operationToId']['has'](_0x142b00)){const _0x39e69c=_0x1ab0aa()['slice'](0x1,0x12);this['_operationToId']['set'](_0x142b00,_0x39e69c);}return this['_operationToId']['get'](_0x142b00);}}}['setIdForTheLastOperation'](_0x4c2054,_0x3322e1){if(!_0x3322e1)return;let _0x4e38f9=_0x4c2054['length'];for(;_0x4e38f9--;){const _0x537694=_0x4c2054[_0x4e38f9];this['_ignoredOperations']['has'](_0x537694)||this['_operationToId']['set'](_0x537694,_0x3322e1);}}}class n extends _0x8d0283{static get['requires'](){return[l];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class a extends _0x372b71{static ['CommentsService']=/* #__PURE__ -- @preserve */
|
|
26
|
-
((()=>_0x2496c3)());['_services'];static get['requires'](){return[c,'CommentsRepository',i,_0x46f64e];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x3f36ce){super(_0x3f36ce),this['_services']=new Map();}async['init'](){const _0xfb27f1=this['context'],_0x434c18=_0xfb27f1['plugins']['get']('CommentsRepository');if(_0xfb27f1['plugins']['get'](c)['addToReconnectionStack'](this),_0x434c18['adapter']={'addCommentThread':async({channelId:_0x20ea53,threadId:_0x476940,comments:_0x243936,resolvedAt:_0xa0f729,resolvedBy:_0x42c3bc,context:_0x57218a,attributes:_0x1c5c6d})=>{const _0x2353fb=await this['_getService'](_0x20ea53)['addCommentThread']({'commentThreadId':_0x476940,'comments':_0x243936['map'](_0x3ad617=>function(_0x1ea45e,_0x374fff,_0x2fb167){return{'commentThreadId':_0x2fb167,'commentId':_0x1ea45e['commentId'],'userId':_0x1ea45e['authorId'],'content':_0x1ea45e['content'],'documentId':_0x374fff,'createdAt':_0x1ea45e['createdAt'],'attributes':_0x1ea45e['attributes']||{}};}(_0x3ad617,_0x20ea53,_0x476940)),'resolvedAt':_0xa0f729,'resolvedBy':_0x42c3bc,'context':_0x57218a,'attributes':_0x1c5c6d})['catch'](gt);return{'threadId':_0x2353fb['commentThreadId'],'comments':_0x2353fb['comments']};},'getCommentThread':async({channelId:_0x11c004,threadId:_0x31ed22})=>{const _0x56414d=await this['_getService'](_0x11c004)['getCommentThread'](_0x31ed22)['catch'](gt);return _0x56414d['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0x56414d]),{'threadId':_0x56414d['commentThreadId'],'comments':_0x56414d['comments']['map'](b),'context':_0x56414d['context'],'resolvedAt':_0x56414d['resolvedAt'],'resolvedBy':_0x56414d['resolvedBy'],'attributes':_0x56414d['attributes']||{}});},'updateCommentThread':async({channelId:_0x33c645,threadId:_0x25bbc4,context:_0x5333a2,unlinkedAt:_0x88d1,attributes:_0x4ed7c6})=>this['_getService'](_0x33c645)['updateCommentThread']({'commentThreadId':_0x25bbc4,'context':_0x5333a2,'attributes':_0x4ed7c6,'unlinkedAt':_0x88d1})['catch'](y)['catch'](gt),'resolveCommentThread':async({channelId:_0x4ad8b1,threadId:_0x3c2e16})=>{const _0xcfc5d6=await this['_getService'](_0x4ad8b1)['resolveCommentThread'](_0x3c2e16)['catch'](y)['catch'](gt);return{'threadId':_0xcfc5d6['commentThreadId'],'resolvedAt':_0xcfc5d6['resolvedAt'],'resolvedBy':_0xcfc5d6['resolvedBy']};},'reopenCommentThread':async({channelId:_0x542698,threadId:_0x1571f6})=>this['_getService'](_0x542698)['reopenCommentThread'](_0x1571f6)['catch'](y)['catch'](gt),'removeCommentThread':({channelId:_0x45380a,threadId:_0x47ffd9})=>this['_getService'](_0x45380a)['removeCommentThread'](_0x47ffd9)['catch'](y)['catch'](gt),'addComment':({channelId:_0x41b98f,threadId:_0x322523,commentId:_0x5db6f2,content:_0x2daef1,attributes:_0x59eced})=>this['_getService'](_0x41b98f)['addComment'](_0x322523,_0x5db6f2,_0x2daef1,_0x59eced)['catch'](gt),'updateComment':({channelId:_0x53a323,threadId:_0x5779af,commentId:_0x266015,content:_0xa350fb,attributes:_0x5160b5})=>this['_getService'](_0x53a323)['updateComment'](_0x5779af,_0x266015,_0xa350fb,_0x5160b5)['catch'](y)['catch'](gt),'removeComment':({channelId:_0x4b1887,threadId:_0x4365dc,commentId:_0x3aa10a})=>this['_getService'](_0x4b1887)['removeComment'](_0x4365dc,_0x3aa10a)['catch'](y)['catch'](gt)},_0xfb27f1 instanceof _0x156be8){const _0x4d48c5=_0xfb27f1['config']['get']('collaboration.channelId'),_0x5dfece=_0xfb27f1['plugins']['get'](i);await this['_setUpService'](_0x4d48c5);const _0x377e46=await this['_services']['get'](_0x4d48c5)['getConnectedSessions']();this['listenTo'](_0x5dfece,'sessionAdd:'+_0x4d48c5,(_0x2337ce,{session:_0x1a0098})=>{_0x1a0098['id']===_0x5dfece['mySessionId']&&(_0x2337ce['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x1a0098['permissions'],_0x4d48c5));}),_0x5dfece['register'](_0x4d48c5,_0x377e46);}}async['_setUpService'](_0x14104a){if(this['_services']['has'](_0x14104a))throw new _0x9a6666('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0x14104a});const _0x5b8cbd=this['context']['plugins']['get']('CommentsRepository'),_0x117005=new a['CommentsService'](_0x14104a);this['_services']['set'](_0x14104a,_0x117005),this['listenTo'](_0x117005,'commentThreadAdded',(_0x38c347,_0x550d05)=>{const {commentThreadId:_0x244a16,documentId:_0x43ea97,context:_0x54cf48,attributes:_0x2dbd52,resolvedAt:_0x4423cf,resolvedBy:_0x29979f,comments:_0x30a666}=_0x550d05;_0x5b8cbd['getCommentThread'](_0x244a16)||_0x5b8cbd['addCommentThread']({'threadId':_0x244a16,'channelId':_0x43ea97,'comments':_0x30a666?_0x30a666['map'](b):[],'context':_0x54cf48,'attributes':_0x2dbd52,'resolvedAt':_0x4423cf,'resolvedBy':_0x29979f,'isFromAdapter':!0x0});}),this['listenTo'](_0x117005,'commentThreadUpdated',(_0x5a5796,{commentThreadId:_0x515bb4,documentId:_0x2bffd0,context:_0x43025c,unlinkedAt:_0x5ac897,attributes:_0x2f4a0e})=>{_0x5b8cbd['getCommentThread'](_0x515bb4)&&_0x5b8cbd['updateCommentThread']({'threadId':_0x515bb4,'channelId':_0x2bffd0,'context':_0x43025c,'unlinkedAt':_0x5ac897,'attributes':_0x2f4a0e,'isFromAdapter':!0x0});}),this['listenTo'](_0x117005,'commentThreadResolved',(_0x311348,{commentThreadId:_0x4acfb6,resolvedBy:_0x1b0c4b,resolvedAt:_0x1b0e7a})=>{const _0x290ae6=_0x5b8cbd['getCommentThread'](_0x4acfb6);_0x290ae6&&_0x290ae6['resolve']({'resolvedBy':_0x1b0c4b,'resolvedAt':_0x1b0e7a,'isFromAdapter':!0x0});}),this['listenTo'](_0x117005,'commentThreadReopened',(_0x197752,{commentThreadId:_0x5d8d21})=>{const _0x43614a=_0x5b8cbd['getCommentThread'](_0x5d8d21);_0x43614a&&_0x43614a['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0x117005,'commentThreadRemoved',(_0x5b6f14,{commentThreadId:_0x27ab40})=>{const _0x4dcd97=_0x5b8cbd['getCommentThread'](_0x27ab40);_0x4dcd97&&_0x4dcd97['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0x117005,'commentAdded',(_0x13b093,_0x296abc)=>{const _0xd5f4a2=_0x296abc['commentThreadId'],_0x18ecb0=_0x5b8cbd['getCommentThread'](_0xd5f4a2);_0x18ecb0&&_0x18ecb0['addComment']({...b(_0x296abc),'isFromAdapter':!0x0});}),this['listenTo'](_0x117005,'commentUpdated',(_0x339123,{commentThreadId:_0x17b071,commentId:_0x538cd6,content:_0x19cf86,attributes:_0x1eb3dd})=>{const _0x410ca0=_0x5b8cbd['getCommentThread'](_0x17b071);if(_0x410ca0){const _0x2b942a=_0x410ca0['getComment'](_0x538cd6);_0x2b942a&&_0x2b942a['update']({'content':_0x19cf86,'attributes':_0x1eb3dd,'isFromAdapter':!0x0});}}),this['listenTo'](_0x117005,'commentRemoved',(_0x296599,{commentThreadId:_0x5dd47f,commentId:_0x2acbee})=>{const _0x22d282=_0x5b8cbd['getCommentThread'](_0x5dd47f);if(_0x22d282){const _0x46687c=_0x22d282['getComment'](_0x2acbee);_0x46687c&&_0x46687c['remove']({'isFromAdapter':!0x0});}}),await this['_connectService'](_0x14104a);}['destroy'](){if(this['context']instanceof _0x156be8){const _0x23c6f6=this['context']['config']['get']('collaboration.channelId');this['_terminateService'](_0x23c6f6);}}['_terminateService'](_0x347e49){if(!this['_services']['has'](_0x347e49))throw new _0x9a6666('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0x347e49});this['_getService'](_0x347e49)['disconnect'](),this['_services']['delete'](_0x347e49);}async['reconnect'](){for(const _0x5e4a7f of this['_services']['keys']())await this['_connectService'](_0x5e4a7f);if(this['context']instanceof _0x156be8){const _0x579ffc=this['context']['config']['get']('collaboration.channelId'),_0x387f8c=this['context']['plugins']['get'](i);_0x387f8c['unregister'](_0x579ffc);const _0x19c5e3=await this['_services']['get'](_0x579ffc)['getConnectedSessions']();_0x387f8c['register'](_0x579ffc,_0x19c5e3);}}async['_connectService'](_0x1030b8){const {connection:_0x7fe5c1}=this['context']['plugins']['get'](c),_0x46ad89=this['context']['plugins']['get']('CommentsRepository'),_0x11b6d9=this['_services']['get'](_0x1030b8),_0xc2d9a=await _0x11b6d9['connect'](_0x7fe5c1);await this['_fetchMissingUsersForThreads'](_0xc2d9a);const _0x57fb78=new Set(Array['from'](_0x46ad89['getCommentThreads']({'channelId':_0x1030b8}),_0x5eae6a=>_0x5eae6a['id']));for(const _0x52c7b7 of _0xc2d9a)_0x52c7b7['deletedAt']||_0x57fb78['delete'](_0x52c7b7['commentThreadId']);for(const _0x2f9033 of _0x57fb78)_0x46ad89['getCommentThread'](_0x2f9033)['remove']({'isFromAdapter':!0x0});for(const _0x500f6f of _0xc2d9a){let _0x2a6b4b=_0x46ad89['getCommentThread'](_0x500f6f['commentThreadId']);const {commentThreadId:_0x5acbe7,context:_0x25e1c6,attributes:_0x3014a2,resolvedBy:_0x433775,resolvedAt:_0x506815,unlinkedAt:_0xc3f342,deletedAt:_0x2b5b5d}=_0x500f6f;if(_0x2b5b5d)continue;_0x2a6b4b||(_0x2a6b4b=_0x46ad89['addCommentThread']({'channelId':_0x1030b8,'threadId':_0x5acbe7,'context':_0x25e1c6,'attributes':_0x3014a2||{},'resolvedBy':_0x433775,'resolvedAt':_0x506815,'unlinkedAt':_0xc3f342,'isFromAdapter':!0x0}));const _0xf6f62b=new Set(Array['from'](_0x2a6b4b['comments'],_0x1ed0ef=>_0x1ed0ef['id']));for(const _0x563e6d of _0x500f6f['comments'])_0xf6f62b['delete'](_0x563e6d['commentId']);for(const _0x399d6e of _0xf6f62b)_0x2a6b4b['getComment'](_0x399d6e)['remove']({'isFromAdapter':!0x0});for(const _0x289a6a of _0x500f6f['comments']){const _0x25afb6=_0x2a6b4b['getComment'](_0x289a6a['commentId']);_0x25afb6?_0x25afb6['content']!==_0x289a6a['content']&&_0x25afb6['update']({'content':_0x289a6a['content'],'isFromAdapter':!0x0}):_0x2a6b4b['addComment'](Object['assign'](b(_0x289a6a),{'isFromAdapter':!0x0}));}}}['_getService'](_0x39a59c){if(!this['_services']['has'](_0x39a59c))throw new _0x9a6666('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0x39a59c});return this['_services']['get'](_0x39a59c);}async['_fetchMissingUsersForThreads'](_0x2b0812){const _0x32ce6f=this['context']['plugins']['get'](_0x46f64e),{connection:_0x45187e}=this['context']['plugins']['get'](c),_0x1c2fd4=new Set();for(const {resolvedBy:_0x5efd75,comments:_0x169f0e}of _0x2b0812){_0x5efd75&&!_0x32ce6f['getUser'](_0x5efd75)&&_0x1c2fd4['add'](_0x5efd75);for(const {userId:_0x47614c}of _0x169f0e)_0x32ce6f['getUser'](_0x47614c)||_0x1c2fd4['add'](_0x47614c);}if(0x0===_0x1c2fd4['size'])return;const _0x40e3d9=await mt['getMany'](_0x45187e,Array['from'](_0x1c2fd4));for(const _0x2b2706 of _0x40e3d9)_0x32ce6f['getUser'](_0x2b2706['id'])||_0x32ce6f['addUser'](_0x2b2706);}}async function y(_0x2fbd17){if('404'!==_0x2fbd17['code'])throw _0x2fbd17;}function gt(_0x3d5bad){if((_0x528719=_0x3d5bad)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0x528719['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x528719['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0x528719;throw _0x3d5bad;}function b(_0x30eed8){return{'threadId':_0x30eed8['commentThreadId'],'commentId':_0x30eed8['commentId'],'content':_0x30eed8['content'],'createdAt':_0x30eed8['createdAt'],'authorId':_0x30eed8['userId'],'attributes':_0x30eed8['attributes']||{}};}class f extends _0x8d0283{static ['TrackChangesService']=/* #__PURE__ -- @preserve */
|
|
27
|
-
((()=>
|
|
28
|
-
((()=>_0x40fdbf)());['_lastRequestId'];['_revisionTracker'];['_revisionHistoryService'];['_oldOffset'];static get['requires'](){return[c,l,'RevisionTracker',i,_0x46f64e];}static get['pluginName'](){return'CloudServicesRevisionHistoryAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x2c62d5){super(_0x2c62d5);const _0x2b9f1d=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new u['RevisionHistoryService'](_0x2b9f1d);}async['init'](){const _0x3a5658=this['editor']['plugins']['get'](l),_0x241f6a=_0x3a5658['serverHistory'],_0x5c22f0=this['editor']['plugins']['get'](c);this['_revisionTracker']['setSource']({'history':_0x241f6a,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0x3a5658['sessionId']});const _0x4f5c82=this['editor']['config']['get']('cloudServices.bundleVersion')||dt,_0x92a99e=await _0x1373f8['isBundleUploaded'](_0x5c22f0['connection'],_0x4f5c82);this['_revisionTracker']['adapter']={'getRevision':async({revisionId:_0x59cd18})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0x59cd18)),'updateRevisions':async _0x54c0ce=>{await this['_waitForServiceReady']();const _0x26be5c=this['_revisionTracker']['currentRevision'];if(_0x92a99e&&0x1===_0x54c0ce['length']&&_0x54c0ce[0x0]['id']===_0x26be5c['id'])return _0x54c0ce;for(const _0x3ba2e3 of _0x54c0ce)_0x3ba2e3['id']===_0x26be5c['id']&&(_0x3ba2e3['isEmptyCurrent']=_0x3ba2e3['fromVersion']===_0x3ba2e3['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0x54c0ce,this['_lastRequestId'])['then'](_0x24f873=>(this['_lastRequestId']=_0x24f873,_0x54c0ce))['catch'](_0xe7951b=>{if(X(_0xe7951b)||'400'===_0xe7951b['code']&&void 0x0!==_0xe7951b['data']['wrongRequestId']){for(const _0x57ea2d of _0x54c0ce){!this['_revisionTracker']['repository']['getRevision'](_0x57ea2d['id'])||this['_revisionTracker']['_bufferUpdate'](_0x57ea2d['id'],_0x57ea2d,!0x1);}if(X(_0xe7951b))throw _0xe7951b;return _0x54c0ce;}throw _0xe7951b;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0x1c7f8c,{revisionsData:_0x4e3614,requestId:_0x5ac667})=>{Math['max'](..._0x4e3614['map'](_0x19f23a=>_0x19f23a['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0x4e3614,_0x5ac667);}):this['_handleRevisionsUpdate'](_0x4e3614,_0x5ac667);});const {revisions:_0x5a3a51,requestId:_0x18d354}=await this['_revisionHistoryService']['connect'](_0x5c22f0['connection']);_0x5c22f0['addToReconnectionStack'](this),this['_lastRequestId']=_0x18d354,await this['_fetchMissingUsers'](_0x5a3a51);for(const _0x17ee65 of _0x5a3a51)this['_revisionTracker']['addRevisionData'](_0x17ee65);this['listenTo'](_0x3a5658,'change:_isConnected',(_0x337fe6,_0x496b65,_0x3db1e2)=>{_0x3db1e2&&(this['_oldOffset']=_0x3a5658['_offset'],_0x337fe6['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](_0x5c22f0,'state',_0x1ca7bd=>_0x1ca7bd===_0x5e13e5['CONNECTED']);}async['reconnect'](){const _0x15dcfe=this['editor']['plugins']['get'](c),_0x560cde=this['editor']['plugins']['get'](l),_0x42a65a=async()=>{const _0x4ec3ca=this['_revisionTracker']['currentRevision'],_0x2720c9=_0x4ec3ca['id'],_0x1570bb=_0x2720c9!==_0x560cde['sessionId'];if(_0x1570bb){const _0x2c2d92=_0x560cde['_offset']-this['_oldOffset'],_0x32ba35=this['_getLatestVersionFromServerOperations']();this['_revisionTracker']['_revisionDataBuilder']['reInit']();if(_0x4ec3ca['toVersion']+_0x2c2d92!==_0x32ba35){const _0x21263f=_0x4ec3ca['fromVersion']+_0x2c2d92,_0xabe39e=this['editor']['plugins']['get'](_0x46f64e),_0x483a51=this['_revisionTracker']['buildRevisionData']({'revision':_0x4ec3ca,'from':_0x21263f,'to':_0x32ba35});_0x483a51['id']=_0x4ec3ca['id'];const _0x54c745=_0x483a51['authorsIds']['map'](_0x55ce5b=>_0xabe39e['getUser'](_0x55ce5b));_0x4ec3ca['_update']({..._0x483a51,'authors':_0x54c745},!0x0),this['_revisionTracker']['_bufferUpdate'](_0x4ec3ca['id'],_0x483a51,!0x0);}this['_revisionTracker']['_startingVersion']=_0x32ba35,(_0x4ec3ca['toVersion']===_0x4ec3ca['fromVersion']&&!this['_revisionTracker']['_bufferedUpdates']['has'](_0x2720c9)&&this['_revisionTracker']['repository']['_revisions']['remove'](_0x2720c9),this['_revisionTracker']['_createCurrentRevision'](_0x32ba35));}const {revisions:_0x282fe2,requestId:_0x28cf71}=await this['_revisionHistoryService']['reconnect'](_0x15dcfe['connection'],this['_lastRequestId']);_0x1570bb&&_0x282fe2['length']>0x0?_0x560cde['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x282fe2),this['_handleRevisionsUpdate'](_0x282fe2,_0x28cf71),this['_revisionTracker']['sendBufferedUpdates']());};return _0x560cde['_isConnected']?_0x42a65a():new Promise((_0x2d1b6b,_0x3761dd)=>{_0x560cde['once']('change:_isConnected',()=>{_0x42a65a()['then'](_0x2d1b6b)['catch'](_0x3761dd);});});}['destroy'](){super['destroy']();}async['_waitForServiceReady'](){this['_revisionHistoryService']['isConnected']||await new Promise(_0x1215b1=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x3a28f1=>{_0x3a28f1['off'](),_0x1215b1();});});}['_getLatestVersionFromServerOperations'](){const _0x2e98d1=this['editor']['plugins']['get'](l)['serverHistory']['getOperations']()['reverse']();for(const _0x3e2ffc of _0x2e98d1)if('marker'!==_0x3e2ffc['type']||_0x3e2ffc['affectsData'])return _0x3e2ffc['baseVersion']+0x1;}['_getLatestVersion'](){const _0x23afc4=this['editor']['plugins']['get'](l);return new Promise(_0x17d474=>{_0x23afc4['_isPendingUpdate']?_0x23afc4['once']('change:_isPendingUpdate',()=>{_0x17d474(this['_getLatestVersionFromServerOperations']());}):_0x17d474(this['_getLatestVersionFromServerOperations']());});}['_handleRevisionsUpdate'](_0x40b4a3,_0x8d6817){const _0x325bed=this['_revisionTracker']['repository'];this['_lastRequestId']=_0x8d6817;for(const _0x1c55bb of _0x40b4a3){const _0x4167f3=_0x325bed['getRevision'](_0x1c55bb['id']);if(_0x4167f3){if((_0x1c55bb['fromVersion']||_0x1c55bb['toVersion'])&&(_0x1c55bb['diffData']=null),_0x4167f3===this['_revisionTracker']['currentRevision']){const _0x2d38fc=Math['max'](_0x4167f3['toVersion'],_0x1c55bb['toVersion']),_0xe6f6a0=Math['max'](_0x4167f3['fromVersion'],_0x1c55bb['fromVersion']);let _0x1b4133;_0x4167f3['toVersion']===_0x1c55bb['toVersion']&&_0x4167f3['fromVersion']===_0x1c55bb['fromVersion']?(_0x1b4133=!0x0,this['_preventResendingRevisionData'](_0x1c55bb)):_0x1c55bb['toVersion']===_0x2d38fc&&_0x1c55bb['fromVersion']===_0xe6f6a0?_0x1b4133=!0x1:(_0x4167f3['toVersion']===_0x2d38fc&&_0x4167f3['fromVersion']===_0xe6f6a0||this['_fixRevision']({'revision':_0x4167f3,'from':_0xe6f6a0,'to':_0x2d38fc}),_0x1b4133=!0x0),_0x1b4133&&(delete _0x1c55bb['fromVersion'],delete _0x1c55bb['toVersion'],delete _0x1c55bb['diffData'],delete _0x1c55bb['createdAt'],delete _0x1c55bb['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0x1c55bb),this['_preventResendingRevisionData'](_0x1c55bb);}else this['_revisionTracker']['addRevisionData'](_0x1c55bb);}const _0x19a5bc=_0x325bed['getRevisions']();_0x19a5bc['reverse']();for(let _0x21ac3b=0x0;_0x21ac3b<_0x19a5bc['length']-0x1;_0x21ac3b++){const _0x28830e=_0x19a5bc[_0x21ac3b],_0x44ccb1=_0x19a5bc[_0x21ac3b+0x1];if(_0x28830e['fromVersion']<_0x44ccb1['toVersion']){const _0x2690f7=_0x44ccb1['toVersion'],_0x4a52c9=Math['max'](_0x2690f7,_0x28830e['toVersion']);this['_fixRevision']({'revision':_0x28830e,'from':_0x2690f7,'to':_0x4a52c9});}}}['_fixRevision']({revision:_0x1f8ab2,from:_0x3909fa,to:_0x3c7481}={}){const _0x14d81a=this['editor']['plugins']['get'](_0x46f64e),_0x307a29=this['_revisionTracker']['buildRevisionData']({'revision':_0x1f8ab2,'from':_0x3909fa,'to':_0x3c7481});_0x307a29['authors']=_0x307a29['authorsIds']['map'](_0x250b4e=>_0x14d81a['getUser'](_0x250b4e)),_0x1f8ab2['_update'](_0x307a29);}['_preventResendingRevisionData'](_0x4fc431){const _0x4ec0ca={};_0x4ec0ca['id']=_0x4fc431['id'];for(const _0x2234ed of Object['keys'](_0x4fc431))'id'!==_0x2234ed&&(_0x4ec0ca[_0x2234ed]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0x4ec0ca['id'],_0x4ec0ca,!0x0);}async['_fetchMissingUsers'](_0x51c453){const _0x35e864=this['editor']['plugins']['get'](_0x46f64e),{connection:_0x51e7c1}=this['editor']['plugins']['get'](c),_0x28f0c5=new Set();for(const _0x3b935d of _0x51c453){for(const _0x1b2b1c of _0x3b935d['authorsIds'])_0x562f48(_0x1b2b1c);_0x3b935d['creatorId']&&_0x562f48(_0x3b935d['creatorId']);}if(0x0===_0x28f0c5['size'])return;const _0x2e22b2=await mt['getMany'](_0x51e7c1,Array['from'](_0x28f0c5));for(const _0x45101a of _0x2e22b2)_0x35e864['getUser'](_0x45101a['id'])||_0x35e864['addUser'](_0x45101a);function _0x562f48(_0x3a9361){_0x35e864['getUser'](_0x3a9361)||_0x28f0c5['add'](_0x3a9361);}}}function X(_0x2234e7){return _0x2234e7['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0x2234e7['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x2234e7['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class g extends _0x8d0283{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 _0x3219cc{constructor(_0x3cf3f9){super(_0x3cf3f9);const _0xa7313c=this['bindTemplate'];this['set']('usersCount',0x0),this['set']('isHidden',!0x0),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__counter',_0xa7313c['if']('isHidden','ck-presence-list__counter--hidden')]},'children':[{'text':_0xa7313c['to']('usersCount',_0x571d73=>E(_0x3cf3f9,'CONNECTED_USERS',_0x571d73))}]});}}class es extends _0x3219cc{['items'];['keystrokes'];constructor(_0x49f418){super(_0x49f418);const _0x6d6849=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0x365191(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0x6d6849['if']('hasPopup'),'aria-expanded':_0x6d6849['to']('isExpanded',_0x6bdd8f=>this['hasPopup']&&String(_0x6bdd8f)),'aria-label':_0x6d6849['to']('hasPopup',_0x3b600a=>E(_0x49f418,_0x3b600a?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0x6d6849['to']('hasPopup',_0x2335fe=>!!_0x2335fe&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items'],'on':{'click':_0x6d6849['to'](()=>this['fire']('execute'))}}),this['on']('change:hasPopup',(_0xd37e6a,_0x44f170,_0x5b9220)=>{this['element']&&(_0x5b9220?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 it extends _0x3219cc{['counterView'];['inlineListView'];constructor(_0x1e21d9){super(_0x1e21d9);const _0x521fd8=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new ts(this['locale']),this['inlineListView']=new es(_0x1e21d9),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x5ca9ff of this['inlineListView']['items'])_0x5ca9ff['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',_0x521fd8['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['counterView'],this['inlineListView']]});}}class et extends _0x3219cc{['listWrapperView'];constructor(_0x168544,_0x15281b){super(_0x168544),this['listWrapperView']=new vt(_0x168544,_0x15281b),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':E(_0x168544,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']]});}}class vt extends _0xbe019e{constructor(_0x543c80,_0x1cfe69){super(_0x543c80);const _0x1015b3=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0x1cfe69?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0x1015b3['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0x1015b3['to']('role'),'aria-label':_0x1015b3['to']('ariaLabel'),'aria-labelledby':_0x1015b3['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0x4140b4['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0x30560c=this['element'];_0x30560c&&(this['_isScrollable']=Math['max'](_0x30560c['scrollHeight'],_0x30560c['clientHeight'])>0.8*window['innerHeight']);}}class ht extends ct{['userView'];constructor(_0x225717,_0x3478b3,_0x53f117){super(_0x225717);const _0x2c1fcf=this['bindTemplate'];this['userView']=new at(_0x225717,_0x3478b3);const _0x5a6e19={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0x3478b3['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0x3478b3['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x3478b3['color']['getBackgroundColorClass']()],'aria-hidden':'true'}}]};_0x53f117&&(_0x5a6e19['tag']='button',_0x5a6e19['on']={'click':_0x2c1fcf['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x5a6e19);}['focus'](){this['element']['focus']();}}class rt extends _0x3219cc{['userView'];['markerView'];constructor(_0x50f3c5,_0x4d7632,_0x573c32){super(_0x50f3c5);const _0x4884a3=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new at(_0x50f3c5,_0x4d7632),this['markerView']=new pt(_0x50f3c5,_0x4d7632);const _0x1cb060=new lt(_0x50f3c5);_0x1cb060['template']['tag']='span',_0x1cb060['text']=_0x4d7632['name'];const _0x1c5040={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0x4884a3['to']('isFocusable',_0x6d5075=>!!_0x6d5075&&0x0),'aria-labelledby':_0x1cb060['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0x4884a3['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0x4884a3['to']('hasTooltip',_0x1b6f59=>!_0x1b6f59),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0x1cb060]};_0x573c32&&(_0x1c5040['tag']='button',_0x1c5040['on']={'click':_0x4884a3['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x1c5040);}}class pt extends _0x3219cc{constructor(_0x51dd55,_0x2f7ad7){super(_0x51dd55),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x2f7ad7['color']['getBackgroundColorClass']()],'aria-hidden':'true'}});}}const ot={'collapseAt':0x6,'displayMe':!0x0};class r extends _0x372b71{['currentDisplayedUsers'];['balloonPanelView'];['view'];['presenceDropdownView'];['_bodyCollection']=null;constructor(_0x2b794){super(_0x2b794),this['context']['config']['define']('presenceList',ot);const _0xe90528=_0x2b794['config']['get']('presenceList.collapseAt');if('number'!=typeof _0xe90528)throw new _0x9a6666('presencelist-collapseat-invalid-format',this);if(_0xe90528<0x1)throw new _0x9a6666('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](i)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0x45dde9(),this['balloonPanelView']=new _0x3a4504(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get['requires'](){return[i];}['init'](){for(const _0x59e2fa of this['_allConnectedUsers'])this['_handleUserAdd'](_0x59e2fa);this['listenTo'](this['_allConnectedUsers'],'add',(_0x44ffcb,_0x47e8e5)=>{this['_handleUserAdd'](_0x47e8e5);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0x22bf71,_0x1ba5f8)=>{this['_handleUserRemove'](_0x1ba5f8);});}['_createView'](){const _0x10d4b9=this['context'],_0x1824c1=new it(this['context']['locale']),_0x58622e=this['balloonPanelView'];if(!st(_0x10d4b9['config']['get']('presenceList.container')))throw new _0x9a6666('presencelist-missing-container',this);return _0x1824c1['counterView']['bind']('usersCount')['to'](this),_0x1824c1['bind']('isCollapsed')['to'](this,'usersCount',_0x465e1f=>{const {collapseAt:_0x4d33cc,displayMe:_0x5912c7}=_0x10d4b9['config']['get']('presenceList'),_0x311f8a=_0x465e1f>=_0x4d33cc;return _0x1824c1['counterView']['isHidden']=!(0x1==_0x465e1f&&_0x5912c7||_0x311f8a),_0x311f8a||this['hideDropdown'](),_0x311f8a;}),_0x1824c1['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0x466045=>{const _0x32d341=_0x10d4b9['config']['get']('presenceList'),_0x19f10d=new rt(_0x10d4b9['locale'],_0x466045,!!_0x32d341['onClick']);return _0x19f10d['bind']('hasTooltip')['to'](_0x1824c1,'isCollapsed',_0x39410a=>!_0x39410a),_0x19f10d['bind']('isFocusable')['to'](_0x1824c1,'isCollapsed',_0x43b27c=>!_0x43b27c),_0x32d341['onClick']&&this['listenTo'](_0x19f10d,'execute',()=>{this['view']['isCollapsed']||_0x32d341['onClick'](_0x466045,_0x19f10d['element']);}),_0x19f10d;}),this['listenTo'](_0x1824c1['inlineListView'],'execute',()=>{this['presenceDropdownView']?this['hideDropdown']():this['view']['isCollapsed']&&this['showDropdown']();}),_0x1824c1['inlineListView']['keystrokes']['set']('Enter',(_0x1bec3d,_0x57a934)=>{this['view']['isCollapsed']&&(this['showDropdown'](),_0x57a934());}),_0x1824c1['render'](),_0x58622e['render'](),_0x2ac3f0({'emitter':_0x1824c1,'activator':()=>_0x58622e['isVisible'],'contextElements':[_0x58622e['element'],_0x1824c1['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0x10d4b9['config']['get']('presenceList.container')['appendChild'](_0x1824c1['element']),this['_bodyCollection']=new tt(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_bodyCollection']['add'](this['balloonPanelView']),_0x1824c1;}['_handleUserAdd'](_0x145d97){if(!this['context']['config']['get']('presenceList.displayMe')&&_0x145d97['isMe'])return;const _0xa7acba=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['usersCount']++,this['currentDisplayedUsers']['length']==_0xa7acba&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](0x1);const _0x495c8d=_0x145d97['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0x145d97,_0x495c8d);}['_handleUserRemove'](_0x1b5db2){if(this['usersCount']--,this['currentDisplayedUsers']['get'](_0x1b5db2['id'])&&(this['currentDisplayedUsers']['remove'](_0x1b5db2['id']),this['currentDisplayedUsers']['length']<this['usersCount'])){for(const _0x1a6615 of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0x1a6615['id']))return void this['currentDisplayedUsers']['add'](_0x1a6615,Math['min'](this['currentDisplayedUsers']['length'],0x1));}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0x4472b3=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new et(this['context']['locale'],!!_0x4472b3['onClick']),this['view']['inlineListView']['isExpanded']=!0x0;const {listWrapperView:_0x1f61a9}=this['presenceDropdownView'];_0x1f61a9['items']['bindTo'](this['_allConnectedUsers'])['using'](_0x2524fb=>{if(!_0x4472b3['displayMe']&&_0x2524fb['isMe'])return null;const _0x377ba5=new ht(this['context']['locale'],_0x2524fb,!!_0x4472b3['onClick']);return _0x4472b3['onClick']&&this['listenTo'](_0x377ba5,'execute',()=>{_0x4472b3['onClick'](_0x2524fb,_0x377ba5['element']);}),_0x377ba5;}),this['balloonPanelView']['content']['add'](this['presenceDropdownView']),this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element']}),_0x1f61a9['focus'](),_0x1f61a9['checkIfScrollable']();const _0x2a0aef=(_0x439f62,_0x51dca4)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0x51dca4();};_0x1f61a9['keystrokes']['set']('Esc',_0x2a0aef),_0x1f61a9['keystrokes']['set']('Shift+Tab',_0x2a0aef),_0x1f61a9['keystrokes']['set']('Tab',(_0x597764,_0x10531c)=>{!function(_0x3d084f){const _0xe9b194=['a','button','input','select','textarea','[tabindex]','[contenteditable]']['map'](_0x1485f3=>_0x1485f3+':not([disabled]):not([tabindex=\x22-1\x22])')['join'](','),_0x4ea7f3=[...document['body']['querySelectorAll'](_0xe9b194)]['filter'](_0x3cea42=>_0x3cea42===document['activeElement']||_0x3cea42['offsetWidth']+_0x3cea42['offsetHeight']>0x0)['sort']((_0x5d28fe,_0x424090)=>(_0x5d28fe['tabIndex']||0x0)-(_0x424090['tabIndex']||0x0)),_0x4ba713=_0x4ea7f3['indexOf'](_0x3d084f),_0x47fc4e=_0x4ea7f3[(_0x4ba713+0x1)%_0x4ea7f3['length']];_0x47fc4e&&_0x47fc4e['focus']();}(this['view']['element']),this['hideDropdown'](),_0x10531c();}),_0x1f61a9['focusTracker']['add'](this['view']['element']),_0x1f61a9['focusTracker']['on']('change:isFocused',(_0x431f88,_0x179b4e,_0x59ce6f)=>{_0x59ce6f||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 _0x372b71{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 _0x44d9cd,Plugin as _0x5ab26d,PendingActions as _0x849d5e,Context as _0x3362af}from'@ckeditor/ckeditor5-core/dist/index.js';import{DomEmitterMixin as _0x54bac1,CKEditorError as _0x1c3b27,Collection as _0x27f226,global as _0xc3811,version as nt,uid as _0x41ae09,KeystrokeHandler as _0x1bc3ac}from'@ckeditor/ckeditor5-utils/dist/index.js';import{Notification as _0x1c4726,View as _0x35ade4,ListView as _0x3ff8be,ListItemView as rt,LabelView as ot,BalloonPanelView as _0x7e4ba1,clickOutsideHandler as _0x52aff7,BodyCollection as _0x1b2e2a}from'@ckeditor/ckeditor5-ui/dist/index.js';import{LiveRange as ht,History as _0x109ee1,NoOperation as _0x2fd97d,InsertOperation as _0x3f9bda,MarkerOperation as _0x3bb101,RootAttributeOperation as _0x16516e,transformSets as _0x558107,OperationFactory as _0x2cf636}from'@ckeditor/ckeditor5-engine/dist/index.js';import{WebSocketGateway as lt,WEB_SOCKET_GATEWAY_STATES as _0xf6d7c,CollaborativeEditingService as _0x2c7c64,User as dt,CommentsService as _0x2e95a3,TrackChangesService as et,RevisionHistoryService as it,EditorService as tt}from'@ckeditor/ckeditor-cloud-services-collaboration/dist/index.js';import{Users as _0x2197dd,UserView as ct}from'ckeditor5-collaboration/dist/index.js';import{Compressor as _0x558b7e}from'@ckeditor/ckeditor5-operations-compressor/dist/index.js';import{isElement as _0x5cdde0}from'lodash-es';class c extends _0x44d9cd{static ['WebSocketGateway']=/* #__PURE__ -- @preserve */
|
|
24
|
+
((()=>lt)());static ['initialReconnectionInterval']=0x3e8;['connection'];['_reconnectionStack'];['_shouldPluginsReconnect'];['_domEmitter'];static get['requires'](){return['CloudServices',_0x1c4726];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x4f2dae){super(_0x4f2dae),this['set']('state',_0xf6d7c['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=Object['create'](_0x54bac1);}['init'](){const _0x240c3a=this['context'],_0xf7f257=_0x240c3a['plugins']['get']('CloudServices'),_0x56972d=_0x240c3a['plugins']['get'](_0x1c4726);if(!_0xf7f257['token'])throw new _0x1c3b27('websocketgateway-missing-token',this);if(!_0xf7f257['webSocketUrl'])throw new _0x1c3b27('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'](_0xf7f257['token'],_0xf7f257['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0x31fc02=>{if(this['connection']=_0x31fc02,this['bind']('state')['to'](_0x31fc02,'state',this,'_isBrowserOffline',(_0x1fe153,_0xbb54a6)=>('connected'!==_0x1fe153&&(this['_shouldPluginsReconnect']=!0x0),_0xbb54a6||_0x1fe153!==_0xf6d7c['CONNECTED']?_0xf6d7c['DISCONNECTED']:this['state']==_0xf6d7c['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),_0xf6d7c['CONNECTING']):_0xf6d7c['CONNECTED'])),this['connection']['on']('error',(_0x41b878,_0x55c060)=>{if('limitExceeded'!==_0x55c060['code'])throw console['error'](_0x55c060),new _0x1c3b27('cloudservices-init',null,{'originalError':_0x55c060});_0x56972d['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'});}),!_0x31fc02['me'])return new Promise(_0x545aa9=>_0x31fc02['on']('change:me',_0x545aa9));})['catch'](_0x1a90d6=>{throw console['error'](_0x1a90d6),new _0x1c3b27('cloudservices-init',null,{'originalError':_0x1a90d6});});}['addToReconnectionStack'](_0x5df69c){if('function'!=typeof _0x5df69c['reconnect'])throw new _0x1c3b27('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0x5df69c))throw new _0x1c3b27('websocketgateway-plugin-already-registered',this,{'name':_0x5df69c['constructor']['pluginName']});this['_reconnectionStack']['add'](_0x5df69c);}['removeFromReconnectionStack'](_0x5df3ef){this['_reconnectionStack']['delete'](_0x5df3ef);}['isInReconnectionStack'](_0x4643ce){return this['_reconnectionStack']['has'](_0x4643ce);}['_reconnect'](){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0x58e682=>_0x58e682['reconnect']())))['then'](()=>this['state']=_0xf6d7c['CONNECTED'])['catch'](_0x36c752=>{throw console['error'](_0x36c752),new _0x1c3b27('cloudservices-reconnection-error',this['context']);});}['destroy'](){this['connection']&&this['connection']['disconnect'](),this['state']=_0xf6d7c['DISCONNECTED'],this['_domEmitter']['stopListening'](),super['destroy']();}}class i extends _0x44d9cd{['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,_0x2197dd];}constructor(_0x4f3c3a){super(_0x4f3c3a),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0x27f226(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x2197dd);}['init'](){const _0x530d06=this['context']['plugins']['get'](c);this['listenTo'](_0x530d06,'change:state',(_0x58b619,_0x59ab9a,_0x1fc1bb)=>{if('connected'!==_0x1fc1bb)this['channelSessions']['forEach'](_0x31074f=>_0x31074f['clear']()),this['channelConnectedUsers']['forEach'](_0x5da036=>_0x5da036['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x3d9e74,_0x38473e]of this['_registeredSessions'])for(const _0x5f1be3 of _0x38473e)this['_handleSessionAdd'](_0x3d9e74,_0x5f1be3);}}),this['_createUser'](_0x530d06['connection']['me'],!0x0);}['register'](_0x32c95c,_0x17286a){if(this['_registeredSessions']['has'](_0x32c95c))throw new _0x1c3b27('sessions-register-already-registered',null,{'channelId':_0x32c95c});this['_registeredSessions']['set'](_0x32c95c,_0x17286a),this['channelSessions']['set'](_0x32c95c,new _0x27f226()),this['channelConnectedUsers']['set'](_0x32c95c,new _0x27f226()),this['listenTo'](_0x17286a,'add',(_0x5b6fea,_0x56c5a3)=>this['_handleSessionAdd'](_0x32c95c,_0x56c5a3)),this['listenTo'](_0x17286a,'remove',(_0x14d7b3,_0x5cc5f0)=>this['_handleSessionRemove'](_0x32c95c,_0x5cc5f0));for(const _0x27a546 of _0x17286a)this['_handleSessionAdd'](_0x32c95c,_0x27a546);}['unregister'](_0x1aafe6){if(!this['_registeredSessions']['has'](_0x1aafe6))throw new _0x1c3b27('sessions-unregister-not-exist',null,{'channelId':_0x1aafe6});const _0x47e6b7=this['_registeredSessions']['get'](_0x1aafe6);this['stopListening'](_0x47e6b7);for(const _0x31187b of _0x47e6b7)'connected'===this['context']['plugins']['get'](c)['state']&&this['_handleSessionRemove'](_0x1aafe6,_0x31187b);this['_registeredSessions']['delete'](_0x1aafe6),this['channelSessions']['delete'](_0x1aafe6),this['channelConnectedUsers']['delete'](_0x1aafe6);}get['mySessionId'](){return this['context']['plugins']['get'](c)['connection']['sessionId'];}['getUserBySessionId'](_0x3f1616){for(const _0x388b74 of this['channelSessions']['values']())for(const _0x28c078 of _0x388b74)if(_0x28c078['id']===_0x3f1616)return _0x28c078['user'];}['getUserSessions'](_0x11a4d6,_0x4c36b9){const _0x4d40d9=_0x4c36b9?[this['channelSessions']['get'](_0x4c36b9)]:this['channelSessions']['values'](),_0x4e1e64=new Set();for(const _0x378196 of _0x4d40d9)for(const _0x168e46 of _0x378196)_0x168e46['user']['id']===_0x11a4d6['id']&&_0x4e1e64['add'](_0x168e46['id']);return _0x4e1e64;}['getUserRole'](_0x4b8f95){for(const _0x293deb of this['channelSessions']['values']())for(const _0x266959 of _0x293deb)if(_0x266959['user']===_0x4b8f95)return _0x266959['role'];}['_handleSessionAdd'](_0x2de550,_0x206a4a){if('connected'!==this['context']['plugins']['get'](c)['state'])return;const _0x4e6808=_0x206a4a['user'],_0x56a1dd=this['_users']['getUser'](_0x4e6808['id'])||this['_createUser'](_0x4e6808),_0x2f80c8=Object['assign']({},_0x206a4a,{'user':_0x56a1dd});this['channelSessions']['get'](_0x2de550)['add'](_0x2f80c8);const _0x13ef0b=this['channelConnectedUsers']['get'](_0x2de550);_0x13ef0b['has'](_0x56a1dd['id'])||_0x13ef0b['add'](_0x56a1dd),this['allConnectedUsers']['has'](_0x56a1dd['id'])||this['allConnectedUsers']['add'](_0x56a1dd,_0x56a1dd['isMe']?0x0:void 0x0),this['fire']('sessionAdd:'+_0x2de550,{'channelId':_0x2de550,'session':_0x2f80c8});}['_handleSessionRemove'](_0x35b101,_0x2547f6){if('connected'!==this['context']['plugins']['get'](c)['state'])return;const _0x4923c0=this['channelConnectedUsers']['get'](_0x35b101),_0x46dfdb=_0x2547f6['user'];_0x46dfdb['id']&&(this['channelSessions']['get'](_0x35b101)['remove'](_0x2547f6['id']),_0x4923c0['has'](_0x46dfdb['id'])&&!this['getUserSessions'](_0x46dfdb,_0x35b101)['size']&&_0x4923c0['remove'](_0x46dfdb['id']),this['allConnectedUsers']['get'](_0x46dfdb['id'])&&!this['getUserSessions'](_0x46dfdb)['size']&&this['allConnectedUsers']['remove'](_0x46dfdb['id']));}['_createUser'](_0x4cae1c,_0x4bb202){const _0x3b6566=this['_users']['addUser'](_0x4cae1c);return _0x4bb202&&this['_users']['defineMe'](_0x4cae1c['id']),_0x3b6566['orderNumber']=this['_uniqueUsersCount']++,_0x3b6566;}}class H extends _0x5ab26d{['_domEmitter']=new(_0x54bac1())();static get['requires'](){return[i];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x56b2b9=this['editor'],_0x4bee5a=_0x56b2b9['plugins']['get'](i);_0x56b2b9['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x140988,{writer:_0x5a6e04})=>function(_0x383c6f,_0x79e207,_0x43e3e0,_0x5d80a8){const _0x44f110=_0x383c6f['markerName']['split'](':')[0x2],_0x55176e=_0x43e3e0['getUserBySessionId'](_0x44f110);if(!_0x55176e||_0x44f110===_0x43e3e0['mySessionId'])return;if(!_0x5d80a8['model']['schema']['checkChild'](_0x383c6f['markerRange']['start'],'$text'))return;const _0x37ca34={'class':'ck-user__marker\x20'+_0x55176e['color']['getMarkerClass'](),'data-name':_0x55176e['name'],'data-session-id':_0x44f110},_0x2128c6=_0x5d80a8['model']['markers']['get'](_0x383c6f['markerName']),_0x47e892=_0x2128c6['getStart'](),_0x3c4866=_0x47e892['nodeAfter'],_0x352597=_0x5d80a8['model']['schema'];if(_0x3c4866&&_0x352597['isObject'](_0x3c4866)&&_0x352597['isInline'](_0x3c4866)&&!_0x5d80a8['model']['markers']['get']('user:range:'+_0x44f110)['getRange']()['isCollapsed'])return;const _0x152a4d=_0x47e892['parent'];return _0x5d80a8['model']['schema']['isLimit'](_0x152a4d)&&!_0x5d80a8['model']['hasContent'](_0x152a4d)&&(_0x37ca34['contenteditable']=!0x1),function(_0x546f3d,_0x55f576,_0x154c74){const _0x1abbd3=_0x546f3d['createUIElement']('span',_0x55f576);return _0x546f3d['setCustomProperty']('userPositionMarker',!0x0,_0x1abbd3),_0x1abbd3['render']=function(_0x1cb842){const _0x41bfef=this['toDomElement'](_0x1cb842);return _0x41bfef['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>'+_0x154c74['name']+'</span>',_0x41bfef['addEventListener']('mouseenter',()=>{_0x41bfef['classList']['add']('ck-user__marker_hovered');}),_0x41bfef['addEventListener']('mouseleave',()=>{_0x41bfef['classList']['remove']('ck-user__marker_hovered');}),_0x41bfef;},_0x1abbd3['isSimilar']=function(_0x3209ef){return!(!this['getCustomProperty']('userPositionMarker')||!_0x3209ef['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0x3209ef['getAttribute']('data-session-id'));},_0x1abbd3;}(_0x79e207,_0x37ca34,_0x55176e);}(_0x140988,_0x5a6e04,_0x4bee5a,_0x56b2b9)}),_0x56b2b9['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0x2467d4=>function(_0x3a3ab1,_0x5e45a6){const _0x3f4c22=_0x3a3ab1['markerName']['split'](':')[0x2];if(_0x3f4c22===_0x5e45a6['mySessionId'])return null;const _0x1d2fa2=_0x5e45a6['getUserBySessionId'](_0x3f4c22);if(!_0x1d2fa2)return{'id':_0x3f4c22,'classes':[]};return{'id':_0x3f4c22,'classes':['ck-user__selection',_0x1d2fa2['color']['getSelectionClass']()],'attributes':{'data-session-id':_0x3f4c22},'priority':0x7d0+_0x1d2fa2['orderNumber']};}(_0x2467d4,_0x4bee5a)}),function(_0xbd4978){const _0x46b96b=_0xbd4978['model'],_0x48fb04=new Map(),_0x3d0e50=_0xbd4978['plugins']['get'](i);_0x46b96b['markers']['on']('update:user:range',(_0x430cd4,_0x44d50,_0x2fa42d,_0x3b1844)=>{if(!_0x3b1844&&_0x48fb04['get'](_0x44d50['name']))return _0x48fb04['get'](_0x44d50['name'])['detach'](),void _0x48fb04['delete'](_0x44d50['name']);const _0x12e279=_0x44d50['name']['split'](':')[0x2];if(_0x12e279===_0x3d0e50['mySessionId'])return;const _0x1dd6a5='user:position:'+_0x12e279;_0x46b96b['markers']['has'](_0x1dd6a5)&&_0xbd4978['editing']['reconvertMarker'](_0x1dd6a5),_0x44d50['on']('change:range',(_0x2cb4f8,_0x4c5f52,_0x5727ed)=>{if('$graveyard'!=_0x4c5f52['root']['rootName']&&'$graveyard'==_0x44d50['getRange']()['root']['rootName']&&!_0x48fb04['has'](_0x44d50['name'])){const _0x32346a=_0x46b96b['schema']['getNearestSelectionRange'](_0x5727ed['deletionPosition']);if(_0x32346a){const _0x2740f8=ht['fromRange'](_0x32346a);_0x48fb04['set'](_0x44d50['name'],_0x2740f8),_0x2740f8['on']('change:range',(_0xcac0d6,_0x2dae34,_0x5d9b7e)=>{if('$graveyard'==_0x2740f8['root']['rootName']){const _0x2d6b61=_0x46b96b['schema']['getNearestSelectionRange'](_0x5d9b7e['deletionPosition']);_0x2d6b61?(_0x2740f8['start']=_0x2d6b61['start'],_0x2740f8['end']=_0x2d6b61['end']):(_0x48fb04['delete'](_0x44d50['name']),_0x2740f8['detach']());}});}}});}),_0x46b96b['document']['on']('change',()=>{_0x48fb04['size']>0x0&&_0x46b96b['enqueueChange']({'isUndoable':!0x1},_0x3e55eb=>{for(const [_0xfa5d50,_0x43f3b1]of _0x48fb04)'$graveyard'==_0x46b96b['markers']['get'](_0xfa5d50)['getRange']()['root']['rootName']&&(re(_0xfa5d50['split'](':')[0x2],_0x43f3b1['toRange'](),_0x46b96b,_0x3e55eb),_0x43f3b1['detach']());_0x48fb04['clear']();});});}(_0x56b2b9),this['_domEmitter']['listenTo'](_0xc3811['document'],'keydown',(_0x4b6ead,{key:_0x4c26d2})=>{'Escape'===_0x4c26d2&&function(_0x52a530){_0x52a530['editing']['view']['change'](_0x1d073f=>{for(const _0x375fc0 of _0x52a530['model']['markers']){if(!_0x375fc0['name']['startsWith']('user:position'))continue;const _0x19a916=_0x52a530['editing']['mapper']['markerNameToElements'](_0x375fc0['name']);if(_0x19a916){for(const _0xbf807d of _0x19a916)_0x1d073f['removeClass']('ck-user__marker_hovered',_0xbf807d);}}});}(_0x56b2b9);},{'useCapture':!0x0});}['afterInit'](){const _0x16d39b=this['editor'],_0x5af41a=_0x16d39b['commands']['get']('undo');_0x5af41a&&_0x16d39b['model']['on']('applyOperation',(_0xc1cd10,_0x52c5fb)=>{const _0x37afbc=_0x52c5fb[0x0];if('marker'!=_0x37afbc['type']||!_0x37afbc['name']['startsWith']('user:'))return;const _0x43ee0c=_0x37afbc['batch'];_0x5af41a['_createdBatches']['has'](_0x43ee0c)&&(_0x37afbc['newRange']=_0x37afbc['oldRange']?_0x16d39b['model']['createRange'](_0x37afbc['oldRange']['start'],_0x37afbc['oldRange']['end']):null);},{'priority':'highest'});}['destroy'](){return this['_domEmitter']['stopListening'](),super['destroy']();}['createUserMarkerOperations'](){const _0x33c0a6=this['editor'],_0xe88978=_0x33c0a6['model']['document'],_0x189c0b=_0x33c0a6['plugins']['get'](i);_0x33c0a6['model']['enqueueChange']({'isUndoable':!0x1},_0x400412=>{const _0x48271a='user:range:'+_0x189c0b['mySessionId'],_0x59b188='user:position:'+_0x189c0b['mySessionId'],_0xbe60ee=_0x33c0a6['model']['markers']['has'](_0x48271a);_0x33c0a6['editing']['view']['hasDomSelection']?re(_0x189c0b['mySessionId'],_0xe88978['selection']['getFirstRange'](),_0x33c0a6['model'],_0x400412):_0xbe60ee&&(_0x400412['removeMarker'](_0x48271a),_0x400412['removeMarker'](_0x59b188));});}}function re(_0x13fe6b,_0x48a2e5,_0x49cdf6,_0x587be9){const _0x3856eb='user:range:'+_0x13fe6b,_0x2111b3='user:position:'+_0x13fe6b,_0x3905d1=_0x48a2e5['getContainedElement']();let _0x25e320=_0x48a2e5['start'];_0x3905d1&&_0x3905d1['is']('element','tableCell')&&(_0x25e320=function(_0x41acde,_0x23735f){for(const _0x570fe5 of _0x41acde['getPositions']())if(_0x23735f['schema']['checkChild'](_0x570fe5,'$text'))return _0x570fe5;}(_0x48a2e5,_0x49cdf6),_0x48a2e5=_0x587be9['createRange'](_0x25e320));const _0x238be4=_0x587be9['createRange'](_0x25e320);_0x49cdf6['markers']['has'](_0x3856eb)?(_0x587be9['updateMarker'](_0x3856eb,{'range':_0x48a2e5}),_0x587be9['updateMarker'](_0x2111b3,{'range':_0x238be4})):(_0x587be9['addMarker'](_0x3856eb,{'range':_0x48a2e5,'usingOperation':!0x0}),_0x587be9['addMarker'](_0x2111b3,{'range':_0x238be4,'usingOperation':!0x0}));}function q(_0x614e26,_0x1ae3ea,_0x5e8b6b){const _0x321425=_0x614e26['t'],t=_0x614e26['t'];switch(_0x1ae3ea){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 _0x321425({'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'},_0x5e8b6b);default:return'';}}let K=0x1;class l extends _0x5ab26d{static ['CollaborativeEditingService']=/* #__PURE__ -- @preserve */
|
|
25
|
+
((()=>_0x2c7c64)());['_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,_0x849d5e,_0x2197dd,_0x1c4726];}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 _0x384462=this['serverHistory']['getOperations']();for(let _0x59a45e=_0x384462['length']-0x1;_0x59a45e>=0x0;_0x59a45e--){const _0xc9ef90=_0x384462[_0x59a45e];if(!this['_disconnectionOperations']['has'](_0xc9ef90))return _0xc9ef90['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0x3f9d44){if(super(_0x3f9d44),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x109ee1(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0x1c3b27('collaboration-missing-channelid',this);const _0x1b222c=_0x3f9d44['config']['get']('cloudServices.bundleVersion')||nt;this['_service']=new l['CollaborativeEditingService'](_0x1b222c,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0x558b7e(),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 _0x20e409=this['editor'],_0x26fd86=_0x20e409['plugins']['get'](_0x2197dd),_0x2c8d21=_0x20e409['plugins']['get'](c);this['listenTo'](_0x26fd86,'getOperationAuthor',(_0x2cb11f,_0x1dbe12)=>{const _0x350401=_0x1dbe12[0x0];_0x350401['_authorId']&&(_0x2cb11f['return']=_0x26fd86['getUser'](_0x350401['_authorId']),_0x2cb11f['stop']()),null===_0x350401['_authorId']&&(_0x2cb11f['return']=null,_0x2cb11f['stop']());},{'priority':'high'}),this['listenTo'](_0x20e409['model']['document']['selection'],'change:range',(_0x10323c,_0x57b95a)=>{_0x57b95a['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x20e409['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x20e409['model']['on']('applyOperation',(_0x445c15,_0x4a9fc8)=>{const _0x7e6a0e=_0x4a9fc8[0x0];_0x7e6a0e['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0x7e6a0e),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['bind']('_isEditingAllowed')['to'](_0x2c8d21,'state',this,'_hasSynchronizationProblem',(_0x40fcc0,_0x1ce4b2)=>'connected'===_0x40fcc0&&!_0x1ce4b2),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x20e409['disableReadOnlyMode']('rtc-offline'):_0x20e409['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x20e409['disableReadOnlyMode']('rtc-offline'):_0x20e409['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async['reconnect'](){const _0x1ea0ce=this['editor']['plugins']['get'](i),_0x373729=this['editor']['plugins']['get'](c);try{this['_isPendingUpdate']=!0x0,_0x1ea0ce['unregister'](this['_channelId']);const _0x1073e4=await this['_service']['reconnect'](_0x373729['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0x1073e4)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x2ed833=await this['_service']['getConnectedSessions']();_0x1ea0ce['register'](this['_channelId'],_0x2ed833),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x277142){if(function(_0x25db58){return'404'===_0x25db58['code'];}(_0x277142)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0x20f5bf){return'409'===_0x20f5bf['code'];}(_0x277142)){const _0x4f6681=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'](_0x4f6681);}else{if(!(_0x277142 instanceof J))throw _0x277142;this['_handleReconnectionError']();}}}}['destroy'](){const _0xa21676=this['editor']['plugins']['get'](c),_0x5e88be=this['editor']['plugins']['get'](i);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x5e88be['channelSessions']['has'](this['_channelId'])&&_0x5e88be['unregister'](this['_channelId']),_0xa21676['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async['_handleReconnectionResponse'](_0x582fdf){if(this['sessionId']!==_0x582fdf['sessionId']&&this['_lastSyncedOperationId']!==_0x582fdf['lastOperationId'])throw new J();return this['sessionId']=_0x582fdf['sessionId'],this['_handleServerResponse']([],{..._0x582fdf,'wereChangesApplied':!0x1,'data':_0x582fdf['data']},'reconnect');}async['_connectService'](_0x4ee076,_0x4f90dc=!0x1){const {connection:_0x15f0aa}=this['editor']['plugins']['get'](c);l['CollaborativeEditingService']['getConnectedSessions'](_0x15f0aa,this['_channelId'])['then'](_0x1a0c2a=>this['_initSessionsHandling'](_0x1a0c2a))['catch'](_0x1edc98=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x1edc98);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x30d77f,_0x53a37)=>{this['_crash']('realtimecollaborationclient-initservice-internal-error',_0x53a37);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_isConnected']=!0x1;});const _0x196a4e=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x4ee076);this['_isPendingUpdate']=!0x0;const _0x5118f4=await this['_service']['connect'](_0x15f0aa,this['_compressOperations'](_0x4ee076),_0x196a4e);if(this['sessionId']=_0x5118f4['sessionId'],_0x4f90dc){if(!_0x5118f4['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x5118f4['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0x4ee076,_0x5118f4,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x5118f4,_0x4ee076);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}['_handleSendingSelectionMarkers'](){const _0x7faf3d=this['editor']['plugins']['get'](i),_0x178b88=this['editor']['plugins']['get'](H),_0x1e92f5=_0x7faf3d['channelSessions']['get'](this['_channelId']);_0x1e92f5&&_0x1e92f5['length']>0x1?_0x178b88['createUserMarkerOperations']():this['listenTo'](_0x7faf3d,'sessionAdd:'+this['_channelId'],()=>{0x2===_0x7faf3d['channelSessions']['get'](this['_channelId'])['length']&&_0x178b88['createUserMarkerOperations']();});}async['_handleReceivedOperations'](_0x4dec4d,_0x1cf0ef,_0x35a219,_0x381e0a){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x1cf0ef){const _0x2154b1=this['_decompressOperations'](_0x35a219,_0x381e0a);await this['_fetchMissingUsers'](_0x2154b1),this['_handleExternalOperations'](_0x2154b1,_0x1cf0ef,_0x35a219['lastOperationId'])||this['_crash']('realtimecollaborationclient-initservice-incorrect-server-operation');}}async['_connectAfterSessionHasBeenFlushed'](){this['_disconnectService']();const {locale:_0x24e867}=this['editor'];let _0x1f078d;try{_0x1f078d=await this['_service']['getDocumentDetails']();}catch(_0x386e6a){const _0x1a3ace=q(_0x24e867,'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'](_0x1a3ace);}const _0x10bda2=_0x1f078d['currentDocumentSession']||_0x1f078d['lastDocumentSession'];if(this['_lastSyncedOperationId']===_0x10bda2['lastOperationId'])await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);else{const _0x181469=q(_0x24e867,'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'](_0x181469);}}['_disconnectService'](){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['stopListening'](this['_service']);}['_initSessionsHandling'](_0x8ea74a){const _0x3d80cf=this['editor']['plugins']['get'](i);this['listenTo'](_0x3d80cf,'sessionAdd:'+this['_channelId'],(_0x1c261b,{session:_0x4ac47a})=>{if(_0x4ac47a['id']===_0x3d80cf['mySessionId']){_0x1c261b['off']();const _0x48e602=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0x1c7c4b=_0x4ac47a['permissions'];_0x48e602&&_0x48e602['isEnabled']&&(_0x1c7c4b=_0x1c7c4b['filter'](_0x36b29a=>'document:write'!==_0x36b29a)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0x1c7c4b,this['_channelId']);}}),_0x3d80cf['register'](this['_channelId'],_0x8ea74a);}['_initThrowingOnDataSet'](){const _0x21c3d6=this['editor']['data']['set'];this['editor']['data']['set']=(..._0xd300b8)=>{if(!_0xd300b8[_0xd300b8['length']-0x1]['suppressErrorInCollaboration'])throw new _0x1c3b27('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x21c3d6['apply'](this['editor']['data'],_0xd300b8);};}['_setUpDataInit'](){this['editor']['data']['on']('init',(_0xfec7cd,[_0x4330df])=>{if(this['_document']['version'])throw new _0x1c3b27('realtimecollaborationclient-init-document-already-initialized',this);_0xfec7cd['stop'](),this['_setPendingAction']();const _0x3d8126=this['editor']['config']['get']('rootsAttributes'),_0x3bbc0b=this['_getOperationsFromInitData'](_0x4330df,_0x3d8126);0x0==_0x3bbc0b['length']&&_0x3bbc0b['push'](new _0x2fd97d(0x0)),_0xfec7cd['return']=this['_connectService'](_0x3bbc0b)['then'](()=>{this['editor']['plugins']['get'](c)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x18ad51=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x18ad51))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x2265ad,[_0xea6e1d,_0x56a091])=>{_0x2265ad['stop']();const _0x416fba=this['editor']['model']['document']['getRoot'](_0xea6e1d);if(!this['_knownRootNames']['has'](_0xea6e1d)){const _0x172382=_0x56a091&&_0x56a091['data']?_0x56a091['data']:'',_0x20605b=_0x56a091&&_0x56a091['attributes']?_0x56a091['attributes']:{};await this['_loadRoot'](_0xea6e1d,_0x172382,_0x20605b);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0x416fba['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0x416fba);});},{'priority':'high'});}async['_fetchMissingUsers'](_0x3d1e57){const _0x156a27=this['editor']['plugins']['get'](_0x2197dd),{connection:_0x48ad57}=this['editor']['plugins']['get'](c),_0x48fbe7=new Set();for(const _0x3c5489 of _0x3d1e57){const _0x4d9b81=_0x3c5489['_authorId'];_0x4d9b81&&!_0x156a27['getUser'](_0x4d9b81)&&_0x48fbe7['add'](_0x4d9b81);}if(0x0===_0x48fbe7['size'])return;const _0x1cd723=await dt['getMany'](_0x48ad57,Array['from'](_0x48fbe7));for(const _0x30ff34 of _0x1cd723)_0x156a27['getUser'](_0x30ff34['id'])||_0x156a27['addUser'](_0x30ff34);}['_getOperationsFromInitData'](_0x1bfa90,_0xb6124a={}){const _0x1cdb8b=this['editor']['model'],_0xe60468=[];let _0x56361c=0x0;const _0x49afde='string'==typeof _0x1bfa90?{'main':_0x1bfa90}:_0x1bfa90;for(const _0x368eae of Object['keys'](_0x49afde)){if(!this['_document']['roots']['has'](_0x368eae))throw new _0x1c3b27('realtimecollaborationclient-init-non-existent-root',this);const _0x3dec2b=this['editor']['data']['parse'](_0x49afde[_0x368eae]),_0x508a0b=this['_document']['getRoot'](_0x368eae),_0x39c0ec=new _0x3f9bda(_0x1cdb8b['createPositionAt'](_0x508a0b,0x0),_0x3dec2b,_0x56361c++);_0xe60468['push'](_0x39c0ec);for(const [_0x587442,_0x3f9f63]of _0x3dec2b['markers']){const _0x275fc5=_0x1cdb8b['createRange'](_0x1cdb8b['createPositionFromPath'](_0x508a0b,_0x3f9f63['start']['path']['slice']()),_0x1cdb8b['createPositionFromPath'](_0x508a0b,_0x3f9f63['end']['path']['slice']())),_0x513bb6=new _0x3bb101(_0x587442,null,_0x275fc5,_0x1cdb8b['markers'],!0x0,_0x56361c++);_0xe60468['push'](_0x513bb6);}}if(_0xb6124a)for(const [_0x43b010,_0x50e14a]of Object['entries'](_0xb6124a)){const _0x95c105=_0x1cdb8b['document']['getRoot'](_0x43b010);if(!_0x95c105)throw new _0x1c3b27('multi-root-editor-root-attributes-no-root',null);for(const [_0x44d528,_0xfc3ca]of Object['entries'](_0x50e14a))if(null!==_0xfc3ca){const _0x1a0c8a=new _0x16516e(_0x95c105,_0x44d528,null,_0xfc3ca,_0x56361c++);_0xe60468['push'](_0x1a0c8a);}}return _0xe60468;}async['_loadRoot'](_0x3fcf8a,_0x5b2863,_0x32670b){this['_getOperationsFromInitData']({[_0x3fcf8a]:_0x5b2863},{[_0x3fcf8a]:_0x32670b})['forEach']((_0x5188ab,_0x42b333)=>{_0x5188ab['baseVersion']=this['_document']['version']+_0x42b333,_0x5188ab['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x5188ab);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async['_handleInitialConnectionData'](_0x3e661f,_0x1a4150){let _0x4a1d26;this['_offset']=_0x3e661f['offset'];const _0x456240=_0x3e661f['wereChangesApplied']&&!_0x3e661f['initData'],_0x12db3f=_0x456240?0x0:_0x3e661f['data']['baseVersion'];if(_0x1a4150['forEach'](_0x1a5c8b=>{_0x1a5c8b['_isInit']=!0x0,_0x1a5c8b['createdAt']=_0x3e661f['sessionCreatedAt'],_0x1a5c8b['_authorId']=null;}),_0x456240)_0x4a1d26=_0x1a4150,this['_applyOperationsSet'](_0x4a1d26,_0x456240);else{if(_0x3e661f['initData']){const _0xa68f9b=this['_getOperationsFromInitData'](_0x3e661f['initData']);this['_document']['history']['version']=-_0xa68f9b['length'],_0xa68f9b['forEach'](_0x371638=>{_0x371638['baseVersion']-=_0xa68f9b['length'],_0x371638['createdAt']=_0x3e661f['sessionCreatedAt'],_0x371638['_isInit']=!0x0,_0x371638['_authorId']=null;}),this['_applyOperationsSet'](_0xa68f9b,!0x0),this['serverHistory']['version']=-_0xa68f9b['length']+this['_offset'],this['_updateServerHistory'](_0xa68f9b);}this['_document']['history']['version']=_0x12db3f,_0x4a1d26=this['_decompressOperations'](_0x3e661f['data'],_0x3e661f['metadata']),await this['_fetchMissingUsers'](_0x4a1d26),this['_applyOperationsSet'](_0x4a1d26,_0x456240);}_0x3e661f['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x4a1d26,_0x3e661f['lastOperationId']),this['_lastSyncedOperationId']=_0x3e661f['lastOperationId']),this['serverHistory']['version']=_0x12db3f+this['_offset'],this['_updateServerHistory'](_0x4a1d26),_0x1a4150['filter'](_0x375a51=>{const _0x510fbe=this['_getAffectedRoot'](_0x375a51);return _0x510fbe&&!this['_knownRootNames']['has'](_0x510fbe);})['forEach']((_0x390e11,_0x32b473)=>{_0x390e11['baseVersion']=this['_document']['version']+_0x32b473,this['_saveOperationInBuffer'](_0x390e11);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x3f1507,_0x4e9211,_0xb4b747){throw this['_isPendingUpdate']=!0x0,_0x4e9211&&console['error'](_0x4e9211),_0xb4b747&&this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0x1c3b27(_0x3f1507,this['editor']);}['_saveOperationInBuffer'](_0x1de458){this['_knownOperations']['has'](_0x1de458)||(this['_knownOperations']['add'](_0x1de458),this['_bufferedOperations']['push'](_0x1de458),this['_pendingAction']||'marker'==_0x1de458['type']&&!_0x1de458['affectsData']||this['_setPendingAction']());}['_sendBufferedOperationsDelayed'](_0x42876c=!0x1){!_0x42876c&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0x16366e=>{_0x16366e&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0x37fb55=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0x8755fd){return _0x8755fd['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x8755fd['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0x8755fd['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0x37fb55)||this['_crash'](_0x37fb55['message'],_0x37fb55,!0x0);});},this['_currentBufferDelay']));}['_waitUntilSynced'](){return new Promise(_0x338b78=>{this['on']('change:_isPendingUpdate',()=>{_0x338b78();});});}async['_sendBufferedOperations'](){const _0x309ccd=this['editor']['plugins']['get'](H);if(this['_shouldSendSelectionUpdate']()&&(_0x309ccd['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x55f75b=[...this['_bufferedOperations']];for(const _0x1c6d91 of _0x55f75b)_0x1c6d91['wasUndone']=this['_document']['history']['isUndoneOperation'](_0x1c6d91);const _0x536643=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x55f75b),_0x5e70c3=K++,_0x32eb4a=this['_compressOperations'](_0x55f75b),_0x1d366e=await this['_service']['sendOperations'](_0x32eb4a,_0x32eb4a['baseVersion'],_0x536643);try{return await this['_handleServerResponse'](_0x55f75b,_0x1d366e,_0x5e70c3);}catch(_0x565125){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0x565125);}}async['_handleServerResponse'](_0x2162f2,_0x4be509,_0x30f833){if('error'in _0x4be509)throw _0x4be509['error'];let _0x12290d=!0x1;if(_0x4be509['wereChangesApplied']){_0x4be509['lastOperationId']&&(this['_lastSyncedOperationId']=_0x4be509['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x424cae=>!_0x2162f2['includes'](_0x424cae));for(const _0x12afa5 of _0x2162f2)_0x12afa5['createdAt']='lastOperationAcceptedAt'in _0x4be509&&_0x4be509['lastOperationAcceptedAt']||void 0x0;Q(_0x2162f2,_0x4be509['version']-_0x2162f2['length']),this['_updateServerHistory'](_0x2162f2);const _0x565910=_0x2162f2['filter'](_0x2ea485=>{if(!_0x2ea485['_isInit'])return!0x1;const _0x260b53=this['_getAffectedRoot'](_0x2ea485);return _0x260b53&&!this['_knownRootNames']['has'](_0x260b53);});Q(_0x565910,this['_document']['version']),this['_applyOperationsSet'](_0x565910),_0x12290d=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0x43f600=this['_decompressOperations'](_0x4be509['data'],_0x4be509['metadata'])['filter'](_0x46f98c=>_0x46f98c['baseVersion']>=this['_lastServerVersion']);_0x43f600['forEach'](_0x3a4fa4=>this['_addKnownRoot'](_0x3a4fa4)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x38f734=>!_0x38f734['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x38f734))),this['_bufferedOperations']['length']&&Q(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0x43f600),_0x12290d=this['_handleExternalOperations'](_0x43f600,_0x4be509['version'],_0x4be509['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x12290d?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}['_handleExternalOperations'](_0x55a96b,_0x3e980e,_0x7854d5){try{const _0xdb97d9={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x541233,operationsB:_0x57eb8f,originalOperations:_0x5813e7}=_0x558107(_0x55a96b,this['_bufferedOperations'],_0xdb97d9);Q(_0x541233,this['_document']['version']),Q(_0x57eb8f,_0x3e980e);for(const _0x3dcf3 of _0x541233){const _0x5afd0c=_0x5813e7['get'](_0x3dcf3);_0x3dcf3['_authorId']=_0x5afd0c?_0x5afd0c['_authorId']:null;}_0x7854d5&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x55a96b,_0x7854d5),this['_lastSyncedOperationId']=_0x7854d5),this['_bufferedOperations']=[..._0x57eb8f],this['_applyOperationsSet'](_0x541233),this['_updateServerHistory'](_0x55a96b);}catch(_0x44f02c){return console['error'](_0x44f02c),!0x1;}return!0x0;}['_applyOperationsSet'](_0x1ba7b2,_0x27bebc=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0x2ee302=>{for(const _0x18a5ee of _0x1ba7b2)this['_knownOperations']['add'](_0x18a5ee),this['_addKnownRoot'](_0x18a5ee),_0x2ee302['batch']['addOperation'](_0x18a5ee),this['editor']['model']['applyOperation'](_0x18a5ee);});}['_addKnownRoot'](_0x185281){const _0x3198dd=this['_getAffectedRoot'](_0x185281);_0x3198dd&&this['_knownRootNames']['add'](_0x3198dd);}['_getAffectedRoot'](_0x51cd22){let _0x1aa55d,_0x17aa78;switch(_0x51cd22['type']){case'insert':_0x1aa55d=_0x51cd22['position']['root'];break;case'marker':if(_0x17aa78=_0x51cd22['newRange'],!_0x17aa78)return null;_0x1aa55d=_0x17aa78['root'];break;case'addRootAttribute':_0x1aa55d=_0x51cd22['root'];break;case'addRoot':_0x1aa55d=_0x51cd22['affectedSelectable'];break;case'move':_0x1aa55d=_0x51cd22['targetPosition']['root'];break;default:return null;}return _0x1aa55d['rootName'];}['_updateServerHistory'](_0x31e2c6){_0x31e2c6['forEach'](_0x4c4d94=>{const _0x29b445=_0x4c4d94['clone']();_0x29b445['_authorId']=_0x4c4d94['_authorId'],_0x29b445['_isInit']=!!_0x4c4d94['_isInit'],_0x29b445['createdAt']=_0x4c4d94['createdAt'],_0x29b445['baseVersion']+=this['_offset'],_0x4c4d94['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x29b445),this['serverHistory']['addOperation'](_0x29b445);});}['_handleReconnectionError'](_0x219ffc){const _0x1d1722=this['editor']['plugins']['get']('Notification'),_0x45a792=this['editor']['locale'];_0x219ffc||(_0x219ffc=q(_0x45a792,'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.')),_0x1d1722['showWarning'](_0x219ffc,{'title':q(_0x45a792,'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'](_0x849d5e)['add'](q(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}['_clearPendingAction'](){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x849d5e)['remove'](this['_pendingAction']),this['_pendingAction']=null);}['_compressOperations'](_0x11d6a4){const _0x34da02=_0x11d6a4['map'](_0x489c61=>_0x489c61['toJSON']());return this['_compressor']['compress'](_0x34da02);}['_decompressOperations'](_0x3fb9aa,_0x52c44b){return this['_compressor']['decompress'](_0x3fb9aa)['map']((_0x157d8a,_0x28a815)=>{const _0x32ac57='init'==_0x52c44b[_0x28a815]['type'];if('InsertOperation'==_0x157d8a['__className']){const _0x5336b9=_0x157d8a['position']['root'];!this['_document']['getRoot'](_0x5336b9)&&(this['_document']['createRoot']('$root',_0x5336b9)['_isAttached']=!0x1);}const _0x4065e2=_0x2cf636['fromJSON'](_0x157d8a,this['_document']);return _0x4065e2['wasUndone']=_0x157d8a['wasUndone'],_0x4065e2['_isInit']=_0x32ac57,_0x4065e2['_authorId']=_0x32ac57?null:_0x52c44b[_0x28a815]['userId'],_0x4065e2['_isDisconnection']='cs:removeUser'===_0x52c44b[_0x28a815]['type'],_0x4065e2['createdAt']=_0x52c44b[_0x28a815]['createdAt'],_0x4065e2;});}['_refreshUserSelectionMarkers'](){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}['_shouldSendSelectionUpdate'](){const _0x20eafe=this['editor']['plugins']['get'](i)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0x20eafe&&_0x20eafe['length']>0x1&&this['_hasSelectionChanged'];}['_shouldSendUpdate'](){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}}class J extends Error{}function Q(_0x37946f,_0x651437){for(const _0x225a78 of _0x37946f)_0x225a78['baseVersion']=_0x651437++;}class X{['_ignoredOperations'];['_operationToId'];constructor(_0x2d1cdf){this['_ignoredOperations']=_0x2d1cdf,this['_operationToId']=new WeakMap();}['getIdOfTheLastOperation'](_0x1d47b9){let _0x4ad5ab=_0x1d47b9['length'];for(;_0x4ad5ab--;){const _0x4d036d=_0x1d47b9[_0x4ad5ab];if(!this['_ignoredOperations']['has'](_0x4d036d)){if(!this['_operationToId']['has'](_0x4d036d)){const _0x3a3ed6=_0x41ae09()['slice'](0x1,0x12);this['_operationToId']['set'](_0x4d036d,_0x3a3ed6);}return this['_operationToId']['get'](_0x4d036d);}}}['setIdForTheLastOperation'](_0xf3929e,_0x2b087d){if(!_0x2b087d)return;let _0xbd98c5=_0xf3929e['length'];for(;_0xbd98c5--;){const _0x26f70c=_0xf3929e[_0xbd98c5];this['_ignoredOperations']['has'](_0x26f70c)||this['_operationToId']['set'](_0x26f70c,_0x2b087d);}}}class n extends _0x5ab26d{static get['requires'](){return[l];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class a extends _0x44d9cd{static ['CommentsService']=/* #__PURE__ -- @preserve */
|
|
26
|
+
((()=>_0x2e95a3)());['_services'];static get['requires'](){return[c,'CommentsRepository',i,_0x2197dd];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x4c30ad){super(_0x4c30ad),this['_services']=new Map();}async['init'](){const _0x518b6c=this['context'],_0x53fd06=_0x518b6c['plugins']['get']('CommentsRepository');if(_0x518b6c['plugins']['get'](c)['addToReconnectionStack'](this),_0x53fd06['adapter']={'addCommentThread':async({channelId:_0x94357c,threadId:_0x547478,comments:_0x497735,resolvedAt:_0x272a93,resolvedBy:_0x4b5c33,context:_0x115447,attributes:_0x2661ae})=>{const _0x26e167=await this['_getService'](_0x94357c)['addCommentThread']({'commentThreadId':_0x547478,'comments':_0x497735['map'](_0x1929bf=>function(_0x1574e4,_0xc516f3,_0xd04879){return{'commentThreadId':_0xd04879,'commentId':_0x1574e4['commentId'],'userId':_0x1574e4['authorId'],'content':_0x1574e4['content'],'documentId':_0xc516f3,'createdAt':_0x1574e4['createdAt'],'attributes':_0x1574e4['attributes']||{}};}(_0x1929bf,_0x94357c,_0x547478)),'resolvedAt':_0x272a93,'resolvedBy':_0x4b5c33,'context':_0x115447,'attributes':_0x2661ae})['catch'](ut);return{'threadId':_0x26e167['commentThreadId'],'comments':_0x26e167['comments']};},'getCommentThread':async({channelId:_0x46aeae,threadId:_0x1041fa})=>{const _0x199531=await this['_getService'](_0x46aeae)['getCommentThread'](_0x1041fa)['catch'](ut);return _0x199531['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0x199531]),{'threadId':_0x199531['commentThreadId'],'comments':_0x199531['comments']['map'](b),'context':_0x199531['context'],'resolvedAt':_0x199531['resolvedAt'],'resolvedBy':_0x199531['resolvedBy'],'attributes':_0x199531['attributes']||{}});},'updateCommentThread':async({channelId:_0x1eb6f7,threadId:_0x3582cb,context:_0x50c94d,unlinkedAt:_0x526705,attributes:_0x129a2f})=>this['_getService'](_0x1eb6f7)['updateCommentThread']({'commentThreadId':_0x3582cb,'context':_0x50c94d,'attributes':_0x129a2f,'unlinkedAt':_0x526705})['catch'](y)['catch'](ut),'resolveCommentThread':async({channelId:_0x22c9f4,threadId:_0xac2991})=>{const _0x426947=await this['_getService'](_0x22c9f4)['resolveCommentThread'](_0xac2991)['catch'](y)['catch'](ut);return{'threadId':_0x426947['commentThreadId'],'resolvedAt':_0x426947['resolvedAt'],'resolvedBy':_0x426947['resolvedBy']};},'reopenCommentThread':async({channelId:_0x40a076,threadId:_0xaa7cc0})=>this['_getService'](_0x40a076)['reopenCommentThread'](_0xaa7cc0)['catch'](y)['catch'](ut),'removeCommentThread':({channelId:_0x5d2365,threadId:_0x1fadd7})=>this['_getService'](_0x5d2365)['removeCommentThread'](_0x1fadd7)['catch'](y)['catch'](ut),'addComment':({channelId:_0xbffcd,threadId:_0x17d4f9,commentId:_0x3d2489,content:_0x2c08d9,attributes:_0x1bea0d})=>this['_getService'](_0xbffcd)['addComment'](_0x17d4f9,_0x3d2489,_0x2c08d9,_0x1bea0d)['catch'](ut),'updateComment':({channelId:_0x30666b,threadId:_0x24c01e,commentId:_0x15719b,content:_0x59ce3a,attributes:_0x23043b})=>this['_getService'](_0x30666b)['updateComment'](_0x24c01e,_0x15719b,_0x59ce3a,_0x23043b)['catch'](y)['catch'](ut),'removeComment':({channelId:_0x5e045e,threadId:_0x28194c,commentId:_0x164ce4})=>this['_getService'](_0x5e045e)['removeComment'](_0x28194c,_0x164ce4)['catch'](y)['catch'](ut)},_0x518b6c instanceof _0x3362af){const _0x2fa602=_0x518b6c['config']['get']('collaboration.channelId'),_0x56f7fb=_0x518b6c['plugins']['get'](i);await this['_setUpService'](_0x2fa602);const _0x44b1ca=await this['_services']['get'](_0x2fa602)['getConnectedSessions']();this['listenTo'](_0x56f7fb,'sessionAdd:'+_0x2fa602,(_0x396745,{session:_0x3c4023})=>{_0x3c4023['id']===_0x56f7fb['mySessionId']&&(_0x396745['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x3c4023['permissions'],_0x2fa602));}),_0x56f7fb['register'](_0x2fa602,_0x44b1ca);}}async['_setUpService'](_0x227bb1){if(this['_services']['has'](_0x227bb1))throw new _0x1c3b27('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0x227bb1});const _0x26da89=this['context']['plugins']['get']('CommentsRepository'),_0x5747c5=new a['CommentsService'](_0x227bb1);this['_services']['set'](_0x227bb1,_0x5747c5),this['listenTo'](_0x5747c5,'commentThreadAdded',(_0x5e8c53,_0x226db9)=>{const {commentThreadId:_0x3cfb04,documentId:_0xd38569,context:_0x11ebcc,attributes:_0x53c9f5,resolvedAt:_0x524655,resolvedBy:_0x4b13bb,comments:_0x466c75}=_0x226db9;_0x26da89['getCommentThread'](_0x3cfb04)||_0x26da89['addCommentThread']({'threadId':_0x3cfb04,'channelId':_0xd38569,'comments':_0x466c75?_0x466c75['map'](b):[],'context':_0x11ebcc,'attributes':_0x53c9f5,'resolvedAt':_0x524655,'resolvedBy':_0x4b13bb,'isFromAdapter':!0x0});}),this['listenTo'](_0x5747c5,'commentThreadUpdated',(_0x38012a,{commentThreadId:_0x157a31,documentId:_0x1419c6,context:_0x22a5a5,unlinkedAt:_0x59aeb2,attributes:_0x4ae0f5})=>{_0x26da89['getCommentThread'](_0x157a31)&&_0x26da89['updateCommentThread']({'threadId':_0x157a31,'channelId':_0x1419c6,'context':_0x22a5a5,'unlinkedAt':_0x59aeb2,'attributes':_0x4ae0f5,'isFromAdapter':!0x0});}),this['listenTo'](_0x5747c5,'commentThreadResolved',(_0x206ca9,{commentThreadId:_0x3c8c06,resolvedBy:_0x55066f,resolvedAt:_0x3b9728})=>{const _0x6962bc=_0x26da89['getCommentThread'](_0x3c8c06);_0x6962bc&&_0x6962bc['resolve']({'resolvedBy':_0x55066f,'resolvedAt':_0x3b9728,'isFromAdapter':!0x0});}),this['listenTo'](_0x5747c5,'commentThreadReopened',(_0x326d2e,{commentThreadId:_0xab9549})=>{const _0x357e5e=_0x26da89['getCommentThread'](_0xab9549);_0x357e5e&&_0x357e5e['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0x5747c5,'commentThreadRemoved',(_0x5ae694,{commentThreadId:_0x4260ba})=>{const _0xbf523b=_0x26da89['getCommentThread'](_0x4260ba);_0xbf523b&&_0xbf523b['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0x5747c5,'commentAdded',(_0x337693,_0x4f5aee)=>{const _0x467591=_0x4f5aee['commentThreadId'],_0x14dddd=_0x26da89['getCommentThread'](_0x467591);_0x14dddd&&_0x14dddd['addComment']({...b(_0x4f5aee),'isFromAdapter':!0x0});}),this['listenTo'](_0x5747c5,'commentUpdated',(_0x80761b,{commentThreadId:_0x144709,commentId:_0x9d13b6,content:_0x22e0f5,attributes:_0x4fa542})=>{const _0x16c032=_0x26da89['getCommentThread'](_0x144709);if(_0x16c032){const _0x3af0f2=_0x16c032['getComment'](_0x9d13b6);_0x3af0f2&&_0x3af0f2['update']({'content':_0x22e0f5,'attributes':_0x4fa542,'isFromAdapter':!0x0});}}),this['listenTo'](_0x5747c5,'commentRemoved',(_0x3ecc76,{commentThreadId:_0x20db46,commentId:_0x147b75})=>{const _0x37699b=_0x26da89['getCommentThread'](_0x20db46);if(_0x37699b){const _0x1bf0b7=_0x37699b['getComment'](_0x147b75);_0x1bf0b7&&_0x1bf0b7['remove']({'isFromAdapter':!0x0});}}),await this['_connectService'](_0x227bb1);}['destroy'](){if(this['context']instanceof _0x3362af){const _0xd404d3=this['context']['config']['get']('collaboration.channelId');this['_terminateService'](_0xd404d3);}}['_terminateService'](_0x524cc0){if(!this['_services']['has'](_0x524cc0))throw new _0x1c3b27('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0x524cc0});this['_getService'](_0x524cc0)['disconnect'](),this['_services']['delete'](_0x524cc0);}async['reconnect'](){for(const _0x18cede of this['_services']['keys']())await this['_connectService'](_0x18cede);if(this['context']instanceof _0x3362af){const _0xfea44c=this['context']['config']['get']('collaboration.channelId'),_0x3baa41=this['context']['plugins']['get'](i);_0x3baa41['unregister'](_0xfea44c);const _0x312f1f=await this['_services']['get'](_0xfea44c)['getConnectedSessions']();_0x3baa41['register'](_0xfea44c,_0x312f1f);}}async['_connectService'](_0x3a83a8){const {connection:_0x2fe508}=this['context']['plugins']['get'](c),_0x3f42ed=this['context']['plugins']['get']('CommentsRepository'),_0x26b0d1=this['_services']['get'](_0x3a83a8),_0x4b77ce=await _0x26b0d1['connect'](_0x2fe508);await this['_fetchMissingUsersForThreads'](_0x4b77ce);const _0x5a302c=new Set(Array['from'](_0x3f42ed['getCommentThreads']({'channelId':_0x3a83a8}),_0x4c99d0=>_0x4c99d0['id']));for(const _0x1635c6 of _0x4b77ce)_0x1635c6['deletedAt']||_0x5a302c['delete'](_0x1635c6['commentThreadId']);for(const _0x1a8230 of _0x5a302c)_0x3f42ed['getCommentThread'](_0x1a8230)['remove']({'isFromAdapter':!0x0});for(const _0x573d23 of _0x4b77ce){let _0x5ad70f=_0x3f42ed['getCommentThread'](_0x573d23['commentThreadId']);const {commentThreadId:_0x1b1765,context:_0xe4df5f,attributes:_0x9dd1c1,resolvedBy:_0x51b6f,resolvedAt:_0x5f156e,unlinkedAt:_0x276690,deletedAt:_0x1e6ee2}=_0x573d23;if(_0x1e6ee2)continue;_0x5ad70f||(_0x5ad70f=_0x3f42ed['addCommentThread']({'channelId':_0x3a83a8,'threadId':_0x1b1765,'context':_0xe4df5f,'attributes':_0x9dd1c1||{},'resolvedBy':_0x51b6f,'resolvedAt':_0x5f156e,'unlinkedAt':_0x276690,'isFromAdapter':!0x0}));const _0x1f9c94=new Set(Array['from'](_0x5ad70f['comments'],_0xc670ea=>_0xc670ea['id']));for(const _0x31d1f4 of _0x573d23['comments'])_0x1f9c94['delete'](_0x31d1f4['commentId']);for(const _0x45a4bc of _0x1f9c94)_0x5ad70f['getComment'](_0x45a4bc)['remove']({'isFromAdapter':!0x0});for(const _0xc3b3b of _0x573d23['comments']){const _0x33cd78=_0x5ad70f['getComment'](_0xc3b3b['commentId']);_0x33cd78?_0x33cd78['content']!==_0xc3b3b['content']&&_0x33cd78['update']({'content':_0xc3b3b['content'],'isFromAdapter':!0x0}):_0x5ad70f['addComment'](Object['assign'](b(_0xc3b3b),{'isFromAdapter':!0x0}));}}}['_getService'](_0x77efa5){if(!this['_services']['has'](_0x77efa5))throw new _0x1c3b27('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0x77efa5});return this['_services']['get'](_0x77efa5);}async['_fetchMissingUsersForThreads'](_0x512be8){const _0x1e7651=this['context']['plugins']['get'](_0x2197dd),{connection:_0x2a5b36}=this['context']['plugins']['get'](c),_0x29b73c=new Set();for(const {resolvedBy:_0x4364e4,comments:_0x52e601}of _0x512be8){_0x4364e4&&!_0x1e7651['getUser'](_0x4364e4)&&_0x29b73c['add'](_0x4364e4);for(const {userId:_0x43368d}of _0x52e601)_0x1e7651['getUser'](_0x43368d)||_0x29b73c['add'](_0x43368d);}if(0x0===_0x29b73c['size'])return;const _0x4304c2=await dt['getMany'](_0x2a5b36,Array['from'](_0x29b73c));for(const _0xaa38e5 of _0x4304c2)_0x1e7651['getUser'](_0xaa38e5['id'])||_0x1e7651['addUser'](_0xaa38e5);}}async function y(_0x808ee){if('404'!==_0x808ee['code'])throw _0x808ee;}function ut(_0x4163ff){if((_0xb0b36c=_0x4163ff)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0xb0b36c['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0xb0b36c['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0xb0b36c;throw _0x4163ff;}function b(_0x390ae2){return{'threadId':_0x390ae2['commentThreadId'],'commentId':_0x390ae2['commentId'],'content':_0x390ae2['content'],'createdAt':_0x390ae2['createdAt'],'authorId':_0x390ae2['userId'],'attributes':_0x390ae2['attributes']||{}};}class f extends _0x5ab26d{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(_0x3ee329){super(_0x3ee329);const _0x20f264=this['editor']['config']['get']('collaboration.channelId');this['_bufferedRequests']=new Map(),this['_trackChangesService']=new f['TrackChangesService'](_0x20f264);}['init'](){const _0x2bf5fc=this['editor']['plugins']['get'](c),_0x4532ca=this['editor']['plugins']['get']('TrackChangesEditing');return _0x4532ca['adapter']={'getSuggestion':async _0x27fa05=>{await this['_waitForServiceReady']();const _0x4e7f37=await this['_trackChangesService']['get'](_0x27fa05)['catch'](w);return await this['_fetchMissingUsersForThreads']([_0x4e7f37]),_0x4e7f37;},'addSuggestion':async({id:_0x3b94ab,type:_0x479ea6,data:_0x3c2bd7,originalSuggestionId:_0x22ed29,attributes:_0x1b7d21})=>{await this['_waitForServiceReady']();const _0x57d39c={'id':_0x3b94ab,'type':_0x479ea6,'data':_0x3c2bd7,'originalSuggestionId':_0x22ed29,'attributes':_0x1b7d21},_0x24138c=await this['_trackChangesService']['add'](_0x3b94ab,_0x479ea6,_0x3c2bd7,_0x22ed29,_0x1b7d21)['catch'](_0xe79c02=>{if(ft(_0xe79c02))return new Promise(_0x6568f1=>{this['_bufferedRequests']['set'](_0x3b94ab,{'resolve':_0x6568f1,'suggestionData':_0x57d39c});});throw _0xe79c02;});return this['_bufferedRequests']['delete'](_0x3b94ab),_0x24138c;},'updateSuggestion':async(_0x49ad7d,_0x4f6ee7)=>{if(await this['_waitForServiceReady'](),'open'!==_0x4f6ee7['state'])return this['_trackChangesService']['update'](_0x49ad7d,_0x4f6ee7)['catch'](w);}},this['listenTo'](this['_trackChangesService'],'suggestionUpdated',(_0x3ff625,_0x18cc71)=>{_0x4532ca['hasSuggestion'](_0x18cc71['id'])&&(_0x4532ca['getSuggestion'](_0x18cc71['id'])['attributes']=_0x18cc71['attributes']);}),this['_trackChangesService']['connect'](_0x2bf5fc['connection'])['then'](_0x27445c=>(_0x2bf5fc['addToReconnectionStack'](this),this['_fetchMissingUsersForThreads'](_0x27445c)['then'](()=>{for(const _0x284ae3 of _0x27445c){_0x4532ca['addSuggestionData'](_0x284ae3)['_saved']=!0x0;}})));}async['reconnect'](){const _0x1bf000=this['editor']['plugins']['get']('TrackChangesEditing'),{connection:_0x2556ac}=this['editor']['plugins']['get'](c),_0x5b4344=await this['_trackChangesService']['connect'](_0x2556ac);await this['_fetchMissingUsersForThreads'](_0x5b4344);for(const {suggestionData:_0x17ba51,resolve:_0x4d477b}of this['_bufferedRequests']['values']()){let _0x4bf2d9=_0x5b4344['find'](_0x1f91a1=>_0x1f91a1['id']===_0x17ba51['id']);_0x4bf2d9||(_0x4bf2d9=await this['_trackChangesService']['add'](_0x17ba51['id'],_0x17ba51['type'],_0x17ba51['data'],_0x17ba51['originalSuggestionId'])),_0x4d477b(_0x4bf2d9);}for(const _0x12cb7f of _0x5b4344)_0x1bf000['hasSuggestion'](_0x12cb7f['id'])||_0x1bf000['addSuggestionData'](_0x12cb7f);}async['_waitForServiceReady'](){this['_trackChangesService']['isConnected']||await new Promise(_0x1c4e94=>{this['listenTo'](this['_trackChangesService'],'connected',_0x37003f=>{_0x37003f['off'](),_0x1c4e94();});});}async['_fetchMissingUsersForThreads'](_0x269036){const _0x5da90c=this['editor']['plugins']['get'](_0x2197dd),{connection:_0x23d54c}=this['editor']['plugins']['get'](c),_0x3bca4a=new Set();for(const {authorId:_0x59b796}of _0x269036)_0x5da90c['getUser'](_0x59b796)||_0x3bca4a['add'](_0x59b796);if(0x0===_0x3bca4a['size'])return;const _0x19a1ed=await dt['getMany'](_0x23d54c,Array['from'](_0x3bca4a));for(const _0x59807e of _0x19a1ed)_0x5da90c['getUser'](_0x59807e['id'])||_0x5da90c['addUser'](_0x59807e);}}function w(_0x416385){if(ft(_0x416385))return new Promise(()=>{});throw _0x416385;}function ft(_0x2149f8){return _0x2149f8['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x2149f8['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class m extends _0x5ab26d{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 _0x369dfa=this['editor']['plugins']['get'](c),_0x12b456=this['editor']['plugins']['get']('CommentsEditing'),_0x202d4c=this['editor']['plugins']['get'](a);return this['editor']['data']['once']('ready',()=>{this['listenTo'](_0x369dfa,'change:state',(_0x413a98,_0x23c46d,_0x133a0e)=>{_0x12b456['isThreadsLoadingPaused']='connected'!==_0x133a0e;});}),this['listenTo'](_0x369dfa,'change:state',(_0x3d10bc,_0x3ed553,_0x2f2c19)=>{this['editor']['plugins']['get']('CommentsRepository')['switchReadOnly']('connected'!==_0x2f2c19);}),_0x202d4c['_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 _0x5ab26d{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 _0x5ab26d{static ['RevisionHistoryService']=/* #__PURE__ -- @preserve */
|
|
28
|
+
((()=>it)());['_lastRequestId'];['_revisionTracker'];['_revisionHistoryService'];['_oldOffset'];static get['requires'](){return[c,l,'RevisionTracker',i,_0x2197dd];}static get['pluginName'](){return'CloudServicesRevisionHistoryAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x4ed332){super(_0x4ed332);const _0x3db451=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new u['RevisionHistoryService'](_0x3db451);}async['init'](){const _0x4fd2dd=this['editor']['plugins']['get'](l),_0x2d1252=_0x4fd2dd['serverHistory'],_0x3333df=this['editor']['plugins']['get'](c);this['_revisionTracker']['setSource']({'history':_0x2d1252,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0x4fd2dd['sessionId']});const _0x4ca199=this['editor']['config']['get']('cloudServices.bundleVersion')||nt,_0x3b2c72=await tt['isBundleUploaded'](_0x3333df['connection'],_0x4ca199);this['_revisionTracker']['adapter']={'getRevision':async({revisionId:_0x4de007})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0x4de007)),'updateRevisions':async _0x5362e7=>{await this['_waitForServiceReady']();const _0x1c12b8=this['_revisionTracker']['currentRevision'];if(_0x3b2c72&&0x1===_0x5362e7['length']&&_0x5362e7[0x0]['id']===_0x1c12b8['id'])return _0x5362e7;for(const _0x460732 of _0x5362e7)_0x460732['id']===_0x1c12b8['id']&&(_0x460732['isEmptyCurrent']=_0x460732['fromVersion']===_0x460732['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0x5362e7,this['_lastRequestId'])['then'](_0x41949d=>(this['_lastRequestId']=_0x41949d,_0x5362e7))['catch'](_0x27afd1=>{if(st(_0x27afd1)||'400'===_0x27afd1['code']&&void 0x0!==_0x27afd1['data']['wrongRequestId']){for(const _0x2c94ed of _0x5362e7){!this['_revisionTracker']['repository']['getRevision'](_0x2c94ed['id'])||this['_revisionTracker']['_bufferUpdate'](_0x2c94ed['id'],_0x2c94ed,!0x1);}if(st(_0x27afd1))throw _0x27afd1;return _0x5362e7;}throw _0x27afd1;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0x57dfb2,{revisionsData:_0x37fb3c,requestId:_0x11f1db})=>{Math['max'](..._0x37fb3c['map'](_0x20d3f0=>_0x20d3f0['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0x37fb3c,_0x11f1db);}):this['_handleRevisionsUpdate'](_0x37fb3c,_0x11f1db);});const {revisions:_0x14b1f1,requestId:_0x1fe2da}=await this['_revisionHistoryService']['connect'](_0x3333df['connection']);_0x3333df['addToReconnectionStack'](this),this['_lastRequestId']=_0x1fe2da,await this['_fetchMissingUsers'](_0x14b1f1);for(const _0x21e942 of _0x14b1f1)this['_revisionTracker']['addRevisionData'](_0x21e942);this['listenTo'](_0x4fd2dd,'change:_isConnected',(_0x2b0fed,_0x3891d0,_0x551e3c)=>{_0x551e3c&&(this['_oldOffset']=_0x4fd2dd['_offset'],_0x2b0fed['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](_0x3333df,'state',_0x1595d1=>_0x1595d1===_0xf6d7c['CONNECTED']);}async['reconnect'](){const _0x1afc1c=this['editor']['plugins']['get'](c),_0x4b25cf=this['editor']['plugins']['get'](l),_0x328ba6=async()=>{const _0x59b615=this['_revisionTracker']['currentRevision'],_0x3f7dd7=_0x59b615['id'],_0x1157ed=_0x3f7dd7!==_0x4b25cf['sessionId'];if(_0x1157ed){const _0x53c745=_0x4b25cf['_offset']-this['_oldOffset'],_0x40413d=this['_getLatestVersionFromServerOperations']();this['_revisionTracker']['_revisionDataBuilder']['reInit']();if(_0x59b615['toVersion']+_0x53c745!==_0x40413d){const _0x40563e=_0x59b615['fromVersion']+_0x53c745,_0xdcbaef=this['editor']['plugins']['get'](_0x2197dd),_0x4fe8bd=this['_revisionTracker']['buildRevisionData']({'revision':_0x59b615,'from':_0x40563e,'to':_0x40413d});_0x4fe8bd['id']=_0x59b615['id'];const _0x596c3f=_0x4fe8bd['authorsIds']['map'](_0x31f84f=>_0xdcbaef['getUser'](_0x31f84f));_0x59b615['_update']({..._0x4fe8bd,'authors':_0x596c3f},!0x0),this['_revisionTracker']['_bufferUpdate'](_0x59b615['id'],_0x4fe8bd,!0x0);}this['_revisionTracker']['_startingVersion']=_0x40413d,(_0x59b615['toVersion']===_0x59b615['fromVersion']&&!this['_revisionTracker']['_bufferedUpdates']['has'](_0x3f7dd7)&&this['_revisionTracker']['repository']['_revisions']['remove'](_0x3f7dd7),this['_revisionTracker']['_createCurrentRevision'](_0x40413d));}const {revisions:_0x5df542,requestId:_0x42bf59}=await this['_revisionHistoryService']['reconnect'](_0x1afc1c['connection'],this['_lastRequestId']);_0x1157ed&&_0x5df542['length']>0x0?_0x4b25cf['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x5df542),this['_handleRevisionsUpdate'](_0x5df542,_0x42bf59),this['_revisionTracker']['sendBufferedUpdates']());};return _0x4b25cf['_isConnected']?_0x328ba6():new Promise((_0x5b2e81,_0x395b9c)=>{_0x4b25cf['once']('change:_isConnected',()=>{_0x328ba6()['then'](_0x5b2e81)['catch'](_0x395b9c);});});}['destroy'](){super['destroy']();}async['_waitForServiceReady'](){this['_revisionHistoryService']['isConnected']||await new Promise(_0x5b6c9c=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x43bb09=>{_0x43bb09['off'](),_0x5b6c9c();});});}['_getLatestVersionFromServerOperations'](){const _0x3a1d90=this['editor']['plugins']['get'](l)['serverHistory']['getOperations']()['reverse']();for(const _0x327e30 of _0x3a1d90)if('marker'!==_0x327e30['type']||_0x327e30['affectsData'])return _0x327e30['baseVersion']+0x1;}['_getLatestVersion'](){const _0x19c9ff=this['editor']['plugins']['get'](l);return new Promise(_0x4ebf17=>{_0x19c9ff['_isPendingUpdate']?_0x19c9ff['once']('change:_isPendingUpdate',()=>{_0x4ebf17(this['_getLatestVersionFromServerOperations']());}):_0x4ebf17(this['_getLatestVersionFromServerOperations']());});}['_handleRevisionsUpdate'](_0x4e5764,_0x35eb05){const _0x744326=this['_revisionTracker']['repository'];this['_lastRequestId']=_0x35eb05;for(const _0x4ddda7 of _0x4e5764){const _0x393529=_0x744326['getRevision'](_0x4ddda7['id']);if(_0x393529){if((_0x4ddda7['fromVersion']||_0x4ddda7['toVersion'])&&(_0x4ddda7['diffData']=null),_0x393529===this['_revisionTracker']['currentRevision']){const _0x377525=Math['max'](_0x393529['toVersion'],_0x4ddda7['toVersion']),_0x5bdc91=Math['max'](_0x393529['fromVersion'],_0x4ddda7['fromVersion']);let _0x2cc720;_0x393529['toVersion']===_0x4ddda7['toVersion']&&_0x393529['fromVersion']===_0x4ddda7['fromVersion']?(_0x2cc720=!0x0,this['_preventResendingRevisionData'](_0x4ddda7)):_0x4ddda7['toVersion']===_0x377525&&_0x4ddda7['fromVersion']===_0x5bdc91?_0x2cc720=!0x1:(_0x393529['toVersion']===_0x377525&&_0x393529['fromVersion']===_0x5bdc91||this['_fixRevision']({'revision':_0x393529,'from':_0x5bdc91,'to':_0x377525}),_0x2cc720=!0x0),_0x2cc720&&(delete _0x4ddda7['fromVersion'],delete _0x4ddda7['toVersion'],delete _0x4ddda7['diffData'],delete _0x4ddda7['createdAt'],delete _0x4ddda7['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0x4ddda7),this['_preventResendingRevisionData'](_0x4ddda7);}else this['_revisionTracker']['addRevisionData'](_0x4ddda7);}const _0x1f7549=_0x744326['getRevisions']();_0x1f7549['reverse']();for(let _0x5615d0=0x0;_0x5615d0<_0x1f7549['length']-0x1;_0x5615d0++){const _0x31e0a2=_0x1f7549[_0x5615d0],_0x5aac35=_0x1f7549[_0x5615d0+0x1];if(_0x31e0a2['fromVersion']<_0x5aac35['toVersion']){const _0x454b6f=_0x5aac35['toVersion'],_0x2b63b0=Math['max'](_0x454b6f,_0x31e0a2['toVersion']);this['_fixRevision']({'revision':_0x31e0a2,'from':_0x454b6f,'to':_0x2b63b0});}}}['_fixRevision']({revision:_0x526d60,from:_0x3afac0,to:_0x272d93}={}){const _0x2c863b=this['editor']['plugins']['get'](_0x2197dd),_0x420b52=this['_revisionTracker']['buildRevisionData']({'revision':_0x526d60,'from':_0x3afac0,'to':_0x272d93});_0x420b52['authors']=_0x420b52['authorsIds']['map'](_0x441f4c=>_0x2c863b['getUser'](_0x441f4c)),_0x526d60['_update'](_0x420b52);}['_preventResendingRevisionData'](_0x314c91){const _0x514996={};_0x514996['id']=_0x314c91['id'];for(const _0x5e608b of Object['keys'](_0x314c91))'id'!==_0x5e608b&&(_0x514996[_0x5e608b]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0x514996['id'],_0x514996,!0x0);}async['_fetchMissingUsers'](_0x43ce96){const _0x5796b4=this['editor']['plugins']['get'](_0x2197dd),{connection:_0x5cd484}=this['editor']['plugins']['get'](c),_0x49fdea=new Set();for(const _0x5f4352 of _0x43ce96){for(const _0xb8b2a5 of _0x5f4352['authorsIds'])_0x175518(_0xb8b2a5);_0x5f4352['creatorId']&&_0x175518(_0x5f4352['creatorId']);}if(0x0===_0x49fdea['size'])return;const _0x303761=await dt['getMany'](_0x5cd484,Array['from'](_0x49fdea));for(const _0x473a53 of _0x303761)_0x5796b4['getUser'](_0x473a53['id'])||_0x5796b4['addUser'](_0x473a53);function _0x175518(_0x41079e){_0x5796b4['getUser'](_0x41079e)||_0x49fdea['add'](_0x41079e);}}}function st(_0x2bdd85){return _0x2bdd85['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0x2bdd85['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x2bdd85['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class g extends _0x5ab26d{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 _0x35ade4{constructor(_0x2f9913){super(_0x2f9913);const _0x3acf34=this['bindTemplate'];this['set']('usersCount',0x0),this['set']('isHidden',!0x0),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__counter',_0x3acf34['if']('isHidden','ck-presence-list__counter--hidden')]},'children':[{'text':_0x3acf34['to']('usersCount',_0x243a65=>q(_0x2f9913,'CONNECTED_USERS',_0x243a65))}]});}}class es extends _0x35ade4{['items'];['keystrokes'];constructor(_0x40ddad){super(_0x40ddad);const _0x202c68=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0x1bc3ac(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0x202c68['if']('hasPopup'),'aria-expanded':_0x202c68['to']('isExpanded',_0x44d206=>this['hasPopup']&&String(_0x44d206)),'aria-label':_0x202c68['to']('hasPopup',_0x4a0178=>q(_0x40ddad,_0x4a0178?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0x202c68['to']('hasPopup',_0x13d0a8=>!!_0x13d0a8&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items'],'on':{'click':_0x202c68['to'](()=>this['fire']('execute'))}}),this['on']('change:hasPopup',(_0x36473e,_0x424d27,_0x1c440c)=>{this['element']&&(_0x1c440c?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 _0x35ade4{['counterView'];['inlineListView'];constructor(_0x3b6832){super(_0x3b6832);const _0x5e2675=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new ts(this['locale']),this['inlineListView']=new es(_0x3b6832),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x3e81c7 of this['inlineListView']['items'])_0x3e81c7['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',_0x5e2675['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['counterView'],this['inlineListView']]});}}class M extends _0x35ade4{['listWrapperView'];constructor(_0x2730d5,_0x1dfbca){super(_0x2730d5),this['listWrapperView']=new mt(_0x2730d5,_0x1dfbca),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':q(_0x2730d5,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']]});}}class mt extends _0x3ff8be{constructor(_0x28fa34,_0x5916cf){super(_0x28fa34);const _0x2ebf79=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0x5916cf?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0x2ebf79['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0x2ebf79['to']('role'),'aria-label':_0x2ebf79['to']('ariaLabel'),'aria-labelledby':_0x2ebf79['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0xc3811['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0x3d581a=this['element'];_0x3d581a&&(this['_isScrollable']=Math['max'](_0x3d581a['scrollHeight'],_0x3d581a['clientHeight'])>0.8*window['innerHeight']);}}class E extends rt{['userView'];constructor(_0xd2d187,_0x57cc8f,_0x4786c0){super(_0xd2d187);const _0x50d897=this['bindTemplate'];this['userView']=new ct(_0xd2d187,_0x57cc8f);const _0x385549={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0x57cc8f['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0x57cc8f['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x57cc8f['color']['getBackgroundColorClass']()],'aria-hidden':'true'}}]};_0x4786c0&&(_0x385549['tag']='button',_0x385549['on']={'click':_0x50d897['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x385549);}['focus'](){this['element']['focus']();}}class T extends _0x35ade4{['userView'];['markerView'];constructor(_0x107b64,_0x4dfc18,_0x4c9b59){super(_0x107b64);const _0x38b64b=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new ct(_0x107b64,_0x4dfc18),this['markerView']=new at(_0x107b64,_0x4dfc18);const _0x33f94d=new ot(_0x107b64);_0x33f94d['template']['tag']='span',_0x33f94d['text']=_0x4dfc18['name'];const _0x550379={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0x38b64b['to']('isFocusable',_0x34217f=>!!_0x34217f&&0x0),'aria-labelledby':_0x33f94d['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0x38b64b['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0x38b64b['to']('hasTooltip',_0x4b30e9=>!_0x4b30e9),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0x33f94d]};_0x4c9b59&&(_0x550379['tag']='button',_0x550379['on']={'click':_0x38b64b['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x550379);}}class at extends _0x35ade4{constructor(_0x13758f,_0x5010c8){super(_0x13758f),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x5010c8['color']['getBackgroundColorClass']()],'aria-hidden':'true'}});}}const D={'collapseAt':0x6,'displayMe':!0x0};class r extends _0x44d9cd{['currentDisplayedUsers'];['balloonPanelView'];['view'];['presenceDropdownView'];['_bodyCollection']=null;constructor(_0x56c467){super(_0x56c467),this['context']['config']['define']('presenceList',D);const _0x2ad8a2=_0x56c467['config']['get']('presenceList.collapseAt');if('number'!=typeof _0x2ad8a2)throw new _0x1c3b27('presencelist-collapseat-invalid-format',this);if(_0x2ad8a2<0x1)throw new _0x1c3b27('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](i)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0x27f226(),this['balloonPanelView']=new _0x7e4ba1(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get['requires'](){return[i];}['init'](){for(const _0x242db9 of this['_allConnectedUsers'])this['_handleUserAdd'](_0x242db9);this['listenTo'](this['_allConnectedUsers'],'add',(_0x2c8754,_0x5c5cc0)=>{this['_handleUserAdd'](_0x5c5cc0);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0x425036,_0x5b3e56)=>{this['_handleUserRemove'](_0x5b3e56);});}['_createView'](){const _0x30ba9f=this['context'],_0x24db9b=new _(this['context']['locale']),_0x2a0a8f=this['balloonPanelView'];if(!_0x5cdde0(_0x30ba9f['config']['get']('presenceList.container')))throw new _0x1c3b27('presencelist-missing-container',this);return _0x24db9b['counterView']['bind']('usersCount')['to'](this),_0x24db9b['bind']('isCollapsed')['to'](this,'usersCount',_0x450992=>{const {collapseAt:_0x2d26c,displayMe:_0x543faf}=_0x30ba9f['config']['get']('presenceList'),_0x2d0561=_0x450992>=_0x2d26c;return _0x24db9b['counterView']['isHidden']=!(0x1==_0x450992&&_0x543faf||_0x2d0561),_0x2d0561||this['hideDropdown'](),_0x2d0561;}),_0x24db9b['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0x55d736=>{const _0x58a067=_0x30ba9f['config']['get']('presenceList'),_0x5cb763=new T(_0x30ba9f['locale'],_0x55d736,!!_0x58a067['onClick']);return _0x5cb763['bind']('hasTooltip')['to'](_0x24db9b,'isCollapsed',_0x1cdbec=>!_0x1cdbec),_0x5cb763['bind']('isFocusable')['to'](_0x24db9b,'isCollapsed',_0x46dd22=>!_0x46dd22),_0x58a067['onClick']&&this['listenTo'](_0x5cb763,'execute',()=>{this['view']['isCollapsed']||_0x58a067['onClick'](_0x55d736,_0x5cb763['element']);}),_0x5cb763;}),this['listenTo'](_0x24db9b['inlineListView'],'execute',()=>{this['presenceDropdownView']?this['hideDropdown']():this['view']['isCollapsed']&&this['showDropdown']();}),_0x24db9b['inlineListView']['keystrokes']['set']('Enter',(_0x4dd943,_0x3446e9)=>{this['view']['isCollapsed']&&(this['showDropdown'](),_0x3446e9());}),_0x24db9b['render'](),_0x2a0a8f['render'](),_0x52aff7({'emitter':_0x24db9b,'activator':()=>_0x2a0a8f['isVisible'],'contextElements':[_0x2a0a8f['element'],_0x24db9b['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0x30ba9f['config']['get']('presenceList.container')['appendChild'](_0x24db9b['element']),this['_bodyCollection']=new _0x1b2e2a(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_bodyCollection']['add'](this['balloonPanelView']),_0x24db9b;}['_handleUserAdd'](_0x519c30){if(!this['context']['config']['get']('presenceList.displayMe')&&_0x519c30['isMe'])return;const _0x50a63a=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['usersCount']++,this['currentDisplayedUsers']['length']==_0x50a63a&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](0x1);const _0x3f4778=_0x519c30['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0x519c30,_0x3f4778);}['_handleUserRemove'](_0x43e7ee){if(this['usersCount']--,this['currentDisplayedUsers']['get'](_0x43e7ee['id'])&&(this['currentDisplayedUsers']['remove'](_0x43e7ee['id']),this['currentDisplayedUsers']['length']<this['usersCount'])){for(const _0xe7029e of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0xe7029e['id']))return void this['currentDisplayedUsers']['add'](_0xe7029e,Math['min'](this['currentDisplayedUsers']['length'],0x1));}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0x1ea4ad=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new M(this['context']['locale'],!!_0x1ea4ad['onClick']),this['view']['inlineListView']['isExpanded']=!0x0;const {listWrapperView:_0xf9edb0}=this['presenceDropdownView'];_0xf9edb0['items']['bindTo'](this['_allConnectedUsers'])['using'](_0x1247a4=>{if(!_0x1ea4ad['displayMe']&&_0x1247a4['isMe'])return null;const _0x2691db=new E(this['context']['locale'],_0x1247a4,!!_0x1ea4ad['onClick']);return _0x1ea4ad['onClick']&&this['listenTo'](_0x2691db,'execute',()=>{_0x1ea4ad['onClick'](_0x1247a4,_0x2691db['element']);}),_0x2691db;}),this['balloonPanelView']['content']['add'](this['presenceDropdownView']),this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element']}),_0xf9edb0['focus'](),_0xf9edb0['checkIfScrollable']();const _0x20763d=(_0x55fd71,_0x3cfc68)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0x3cfc68();};_0xf9edb0['keystrokes']['set']('Esc',_0x20763d),_0xf9edb0['keystrokes']['set']('Shift+Tab',_0x20763d),_0xf9edb0['keystrokes']['set']('Tab',(_0x4e23a0,_0x152efd)=>{!function(_0x587f3b){const _0x4aaf12=['a','button','input','select','textarea','[tabindex]','[contenteditable]']['map'](_0x20cec6=>_0x20cec6+':not([disabled]):not([tabindex=\x22-1\x22])')['join'](','),_0x1955ae=[...document['body']['querySelectorAll'](_0x4aaf12)]['filter'](_0x3c80ac=>_0x3c80ac===document['activeElement']||_0x3c80ac['offsetWidth']+_0x3c80ac['offsetHeight']>0x0)['sort']((_0x3833cd,_0x400b04)=>(_0x3833cd['tabIndex']||0x0)-(_0x400b04['tabIndex']||0x0)),_0xd8ebc8=_0x1955ae['indexOf'](_0x587f3b),_0x56c47b=_0x1955ae[(_0xd8ebc8+0x1)%_0x1955ae['length']];_0x56c47b&&_0x56c47b['focus']();}(this['view']['element']),this['hideDropdown'](),_0x152efd();}),_0xf9edb0['focusTracker']['add'](this['view']['element']),_0xf9edb0['focusTracker']['on']('change:isFocused',(_0x2a73ea,_0x14cc60,_0x56393c)=>{_0x56393c||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 _0x44d9cd{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.1.0-alpha.
|
|
3
|
+
"version": "44.1.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.1.0-alpha.
|
|
46
|
-
"@ckeditor/ckeditor5-engine": "44.1.0-alpha.
|
|
47
|
-
"@ckeditor/ckeditor5-operations-compressor": "44.1.0-alpha.
|
|
48
|
-
"@ckeditor/ckeditor5-theme-lark": "44.1.0-alpha.
|
|
49
|
-
"@ckeditor/ckeditor5-ui": "44.1.0-alpha.
|
|
50
|
-
"@ckeditor/ckeditor5-utils": "44.1.0-alpha.
|
|
51
|
-
"ckeditor5": "44.1.0-alpha.
|
|
52
|
-
"ckeditor5-collaboration": "44.1.0-alpha.
|
|
45
|
+
"@ckeditor/ckeditor5-core": "44.1.0-alpha.5",
|
|
46
|
+
"@ckeditor/ckeditor5-engine": "44.1.0-alpha.5",
|
|
47
|
+
"@ckeditor/ckeditor5-operations-compressor": "44.1.0-alpha.5",
|
|
48
|
+
"@ckeditor/ckeditor5-theme-lark": "44.1.0-alpha.5",
|
|
49
|
+
"@ckeditor/ckeditor5-ui": "44.1.0-alpha.5",
|
|
50
|
+
"@ckeditor/ckeditor5-utils": "44.1.0-alpha.5",
|
|
51
|
+
"ckeditor5": "44.1.0-alpha.5",
|
|
52
|
+
"ckeditor5-collaboration": "44.1.0-alpha.5",
|
|
53
53
|
"lodash-es": "4.17.21"
|
|
54
54
|
},
|
|
55
55
|
"types": "src/index.d.ts",
|