@ckeditor/ckeditor5-real-time-collaboration 46.0.1-alpha.11 → 46.0.1-alpha.13
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 +14 -14
- 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/realtimecollaborativeediting/realtimecollaborationclient.js +2 -2
- package/src/realtimecollaborativeediting/usermarkers.js +1 -1
- package/src/realtimecollaborativeediting/websocketgateway.js +2 -2
- package/src/realtimecollaborativerevisionhistory/cloudservicesrevisionhistoryadapter.js +2 -2
- package/src/realtimecollaborativetrackchanges/cloudservicestrackchangesadapter.js +2 -2
package/dist/index.js
CHANGED
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
import{ContextPlugin as
|
|
24
|
-
((()=>rt)());static ['initialReconnectionInterval']=0x3e8;['connection'];['_reconnectionStack'];['_shouldPluginsReconnect'];['_domEmitter'];static get['requires'](){return['CloudServices',_0x5c3c50];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x17a27e){super(_0x17a27e),this['set']('state',_0x4777ba['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=new(_0x5c2fd9())();}['init'](){const _0x9dea27=this['context'],_0x1ebe08=_0x9dea27['plugins']['get']('CloudServices'),_0x1ef39d=_0x9dea27['plugins']['get'](_0x5c3c50);if(!_0x1ebe08['token'])throw new _0x57f413('websocketgateway-missing-token',this);if(!_0x1ebe08['webSocketUrl'])throw new _0x57f413('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),n['WebSocketGateway']['connect'](_0x1ebe08['token'],_0x1ebe08['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0x5293a5=>{if(this['connection']=_0x5293a5,this['bind']('state')['to'](_0x5293a5,'state',this,'_isBrowserOffline',(_0x2da86f,_0x14e652)=>('connected'!==_0x2da86f&&(this['_shouldPluginsReconnect']=!0x0),_0x14e652||_0x2da86f!==_0x4777ba['CONNECTED']?_0x4777ba['DISCONNECTED']:this['state']==_0x4777ba['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),_0x4777ba['CONNECTING']):_0x4777ba['CONNECTED'])),this['connection']['on']('error',(_0x3603e7,_0x407643)=>{if('limitExceeded'!==_0x407643['code'])throw console['error'](_0x407643),new _0x57f413('cloudservices-init',null,{'originalError':_0x407643});_0x1ef39d['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'});}),!_0x5293a5['me'])return new Promise(_0x2dfcb9=>_0x5293a5['on']('change:me',_0x2dfcb9));})['catch'](_0x777926=>{throw console['error'](_0x777926),new _0x57f413('cloudservices-init',null,{'originalError':_0x777926});});}['addToReconnectionStack'](_0x7f6b4b){if('function'!=typeof _0x7f6b4b['reconnect'])throw new _0x57f413('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0x7f6b4b))throw new _0x57f413('websocketgateway-plugin-already-registered',this,{'name':_0x7f6b4b['constructor']['pluginName']});this['_reconnectionStack']['add'](_0x7f6b4b);}['removeFromReconnectionStack'](_0x262361){this['_reconnectionStack']['delete'](_0x262361);}['isInReconnectionStack'](_0x59e5af){return this['_reconnectionStack']['has'](_0x59e5af);}['_reconnect'](){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0x29a56d=>_0x29a56d['reconnect']())))['then'](()=>this['state']=_0x4777ba['CONNECTED'])['catch'](_0x43b4d6=>{throw console['error'](_0x43b4d6),new _0x57f413('cloudservices-reconnection-error',this['context']);});}['disconnect'](){this['connection']&&this['connection']['disconnect'](),this['state']=_0x4777ba['DISCONNECTED'],this['_domEmitter']['stopListening']();}['destroy'](){this['disconnect'](),super['destroy']();}}class i extends _0x2d811c{['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[n,_0x2683a2];}constructor(_0x336cf0){super(_0x336cf0),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0x5538c8(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x2683a2);}['init'](){const _0x243fdf=this['context']['plugins']['get'](n);this['listenTo'](_0x243fdf,'change:state',(_0x277438,_0x4279b1,_0x341f30)=>{if('connected'!==_0x341f30)this['channelSessions']['forEach'](_0x3d4f10=>_0x3d4f10['clear']()),this['channelConnectedUsers']['forEach'](_0x8a9bab=>_0x8a9bab['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x5dd18b,_0x3e2502]of this['_registeredSessions'])for(const _0x4e5b4a of _0x3e2502)this['_handleSessionAdd'](_0x5dd18b,_0x4e5b4a);}}),this['_createUser'](_0x243fdf['connection']['me'],!0x0);}['register'](_0x15cf90,_0x477968){if(this['_registeredSessions']['has'](_0x15cf90))throw new _0x57f413('sessions-register-already-registered',null,{'channelId':_0x15cf90});this['_registeredSessions']['set'](_0x15cf90,_0x477968),this['channelSessions']['set'](_0x15cf90,new _0x5538c8()),this['channelConnectedUsers']['set'](_0x15cf90,new _0x5538c8()),this['listenTo'](_0x477968,'add',(_0x494928,_0x401bef)=>this['_handleSessionAdd'](_0x15cf90,_0x401bef)),this['listenTo'](_0x477968,'remove',(_0x3f238b,_0xd41928)=>this['_handleSessionRemove'](_0x15cf90,_0xd41928));for(const _0x224bb1 of _0x477968)this['_handleSessionAdd'](_0x15cf90,_0x224bb1);}['unregister'](_0x5dccc9){if(!this['_registeredSessions']['has'](_0x5dccc9))throw new _0x57f413('sessions-unregister-not-exist',null,{'channelId':_0x5dccc9});const _0x743411=this['_registeredSessions']['get'](_0x5dccc9);this['stopListening'](_0x743411);for(const _0x1a274a of _0x743411)'connected'===this['context']['plugins']['get'](n)['state']&&this['_handleSessionRemove'](_0x5dccc9,_0x1a274a);this['_registeredSessions']['delete'](_0x5dccc9),this['channelSessions']['delete'](_0x5dccc9),this['channelConnectedUsers']['delete'](_0x5dccc9);}get['mySessionId'](){return this['context']['plugins']['get'](n)['connection']['sessionId'];}['getUserBySessionId'](_0x32c644){for(const _0x1dcdbf of this['channelSessions']['values']())for(const _0x52470a of _0x1dcdbf)if(_0x52470a['id']===_0x32c644)return _0x52470a['user'];}['getUserSessions'](_0x500a83,_0x2de7d8){const _0x50507f=_0x2de7d8?[this['channelSessions']['get'](_0x2de7d8)]:this['channelSessions']['values'](),_0x261556=new Set();for(const _0xc3ea2b of _0x50507f)for(const _0x3c671a of _0xc3ea2b)_0x3c671a['user']['id']===_0x500a83['id']&&_0x261556['add'](_0x3c671a['id']);return _0x261556;}['getUserRole'](_0x37dbb2){for(const _0xadfdfd of this['channelSessions']['values']())for(const _0x31998d of _0xadfdfd)if(_0x31998d['user']===_0x37dbb2)return _0x31998d['role'];}['_handleSessionAdd'](_0x26e278,_0xe370d4){if('connected'!==this['context']['plugins']['get'](n)['state'])return;const _0x5ab0f4=_0xe370d4['user'],_0x17c4c2=this['_users']['getUser'](_0x5ab0f4['id'])||this['_createUser'](_0x5ab0f4),_0x2a7cce=Object['assign']({},_0xe370d4,{'user':_0x17c4c2});this['channelSessions']['get'](_0x26e278)['add'](_0x2a7cce);const _0x3f59f2=this['channelConnectedUsers']['get'](_0x26e278);_0x3f59f2['has'](_0x17c4c2['id'])||_0x3f59f2['add'](_0x17c4c2),this['allConnectedUsers']['has'](_0x17c4c2['id'])||this['allConnectedUsers']['add'](_0x17c4c2,_0x17c4c2['isMe']?0x0:void 0x0),this['fire']('sessionAdd:'+_0x26e278,{'channelId':_0x26e278,'session':_0x2a7cce});}['_handleSessionRemove'](_0x296196,_0x331da2){if('connected'!==this['context']['plugins']['get'](n)['state'])return;const _0x396623=this['channelConnectedUsers']['get'](_0x296196),_0x53e4fc=_0x331da2['user'];_0x53e4fc['id']&&(this['channelSessions']['get'](_0x296196)['remove'](_0x331da2['id']),_0x396623['has'](_0x53e4fc['id'])&&!this['getUserSessions'](_0x53e4fc,_0x296196)['size']&&_0x396623['remove'](_0x53e4fc['id']),this['allConnectedUsers']['get'](_0x53e4fc['id'])&&!this['getUserSessions'](_0x53e4fc)['size']&&this['allConnectedUsers']['remove'](_0x53e4fc['id']));}['_createUser'](_0x4f82e5,_0x44aad2){const _0x38deb4=this['_users']['addUser'](_0x4f82e5);return _0x44aad2&&this['_users']['defineMe'](_0x4f82e5['id']),_0x38deb4['orderNumber']=this['_uniqueUsersCount']++,_0x38deb4;}}class $ extends _0x302365{['_domEmitter']=new(_0x5c2fd9())();static get['requires'](){return[i];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x33c8ab=this['editor'],_0x554c08=_0x33c8ab['plugins']['get'](i);_0x33c8ab['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x14e533,{writer:_0x30bf7d})=>function(_0x4b4ba0,_0x3a236b,_0x34d37,_0x3d9ed0){const _0x4ea5b5=_0x4b4ba0['markerName']['split'](':')[0x2],_0x357a06=_0x34d37['getUserBySessionId'](_0x4ea5b5);if(!_0x357a06||_0x4ea5b5===_0x34d37['mySessionId'])return;if(!_0x3d9ed0['model']['schema']['checkChild'](_0x4b4ba0['markerRange']['start'],'$text'))return;const _0x2ce8bb={'class':'ck-user__marker\x20'+_0x357a06['color']['getMarkerClass'](),'data-name':_0x357a06['name'],'data-session-id':_0x4ea5b5},_0x54e0e2=_0x3d9ed0['model']['markers']['get'](_0x4b4ba0['markerName']),_0x329e04=_0x54e0e2['getStart'](),_0x120b8f=_0x329e04['nodeAfter'],_0x2eea42=_0x3d9ed0['model']['schema'];if(_0x120b8f&&_0x2eea42['isObject'](_0x120b8f)&&_0x2eea42['isInline'](_0x120b8f)&&!_0x3d9ed0['model']['markers']['get']('user:range:'+_0x4ea5b5)['getRange']()['isCollapsed'])return;const _0x3e0a97=_0x329e04['parent'];return _0x3d9ed0['model']['schema']['isLimit'](_0x3e0a97)&&!_0x3d9ed0['model']['hasContent'](_0x3e0a97)&&(_0x2ce8bb['contenteditable']=!0x1),function(_0x229f61,_0x252c47,_0x30ec94){const _0x30fe65=_0x229f61['createUIElement']('span',_0x252c47);return _0x229f61['setCustomProperty']('userPositionMarker',!0x0,_0x30fe65),_0x30fe65['render']=function(_0x7197a){const _0x288050=this['toDomElement'](_0x7197a),_0x220a0a=document['createElement']('span');return _0x220a0a['classList']['add']('ck-user__marker-tooltip'),_0x220a0a['setAttribute']('contenteditable','false'),_0x220a0a['setAttribute']('spellcheck','false'),_0x220a0a['textContent']=_0x30ec94['name'],_0x288050['innerHTML']='<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span>'+_0x220a0a['outerHTML']+'',_0x288050['addEventListener']('mouseenter',()=>{_0x288050['classList']['add']('ck-user__marker_hovered');}),_0x288050['addEventListener']('mouseleave',()=>{_0x288050['classList']['remove']('ck-user__marker_hovered');}),_0x288050;},_0x30fe65['isSimilar']=function(_0x5c8121){return!(!this['getCustomProperty']('userPositionMarker')||!_0x5c8121['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0x5c8121['getAttribute']('data-session-id'));},_0x30fe65;}(_0x3a236b,_0x2ce8bb,_0x357a06);}(_0x14e533,_0x30bf7d,_0x554c08,_0x33c8ab)}),_0x33c8ab['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0x2490bf=>function(_0x1343c5,_0x4b3ebd){const _0x1c2743=_0x1343c5['markerName']['split'](':')[0x2];if(_0x1c2743===_0x4b3ebd['mySessionId'])return null;const _0x2157cf=_0x4b3ebd['getUserBySessionId'](_0x1c2743);if(!_0x2157cf)return{'id':_0x1c2743,'classes':[]};return{'id':_0x1c2743,'classes':['ck-user__selection',_0x2157cf['color']['getSelectionClass']()],'attributes':{'data-session-id':_0x1c2743},'priority':0x7d0+_0x2157cf['orderNumber']};}(_0x2490bf,_0x554c08)}),function(_0x12265e){const _0x368972=_0x12265e['model'],_0x27c817=new Map(),_0x4f0f23=_0x12265e['plugins']['get'](i);_0x368972['markers']['on']('update:user:range',(_0x368bf9,_0x5c19c3,_0x1b4eff,_0x33ab62)=>{if(!_0x33ab62&&_0x27c817['get'](_0x5c19c3['name']))return _0x27c817['get'](_0x5c19c3['name'])['detach'](),void _0x27c817['delete'](_0x5c19c3['name']);const _0x22c1cf=_0x5c19c3['name']['split'](':')[0x2];if(_0x22c1cf===_0x4f0f23['mySessionId'])return;const _0x26ae49='user:position:'+_0x22c1cf;_0x368972['markers']['has'](_0x26ae49)&&_0x12265e['editing']['reconvertMarker'](_0x26ae49),_0x5c19c3['on']('change:range',(_0x49db1d,_0x3d8eee,_0xfbb2fa)=>{if('$graveyard'!=_0x3d8eee['root']['rootName']&&'$graveyard'==_0x5c19c3['getRange']()['root']['rootName']&&!_0x27c817['has'](_0x5c19c3['name'])){const _0x49a9bf=_0x368972['schema']['getNearestSelectionRange'](_0xfbb2fa['deletionPosition']);if(_0x49a9bf){const _0x5ac282=_0x216524['fromRange'](_0x49a9bf);_0x27c817['set'](_0x5c19c3['name'],_0x5ac282),_0x5ac282['on']('change:range',(_0x16f187,_0x2785c8,_0x423af3)=>{if('$graveyard'==_0x5ac282['root']['rootName']){const _0xcbc930=_0x368972['schema']['getNearestSelectionRange'](_0x423af3['deletionPosition']);_0xcbc930?(_0x5ac282['start']=_0xcbc930['start'],_0x5ac282['end']=_0xcbc930['end']):(_0x27c817['delete'](_0x5c19c3['name']),_0x5ac282['detach']());}});}}});}),_0x368972['document']['on']('change',()=>{_0x27c817['size']>0x0&&_0x368972['enqueueChange']({'isUndoable':!0x1},_0x5d0048=>{for(const [_0x1e54c2,_0x361efb]of _0x27c817)'$graveyard'==_0x368972['markers']['get'](_0x1e54c2)['getRange']()['root']['rootName']&&(te(_0x1e54c2['split'](':')[0x2],_0x361efb['toRange'](),_0x368972,_0x5d0048),_0x361efb['detach']());_0x27c817['clear']();});});}(_0x33c8ab),this['_domEmitter']['listenTo'](_0x54f381['document'],'keydown',(_0x3f1c2c,{key:_0x59b3e8})=>{'Escape'===_0x59b3e8&&function(_0x5c79c1){_0x5c79c1['editing']['view']['change'](_0x197262=>{for(const _0x199748 of _0x5c79c1['model']['markers']){if(!_0x199748['name']['startsWith']('user:position'))continue;const _0x41ce03=_0x5c79c1['editing']['mapper']['markerNameToElements'](_0x199748['name']);if(_0x41ce03){for(const _0x5ad4ba of _0x41ce03)_0x197262['removeClass']('ck-user__marker_hovered',_0x5ad4ba);}}});}(_0x33c8ab);},{'useCapture':!0x0});}['afterInit'](){const _0x45f047=this['editor'],_0x58d15f=_0x45f047['commands']['get']('undo');_0x58d15f&&_0x45f047['model']['on']('applyOperation',(_0x369b68,_0x5d75aa)=>{const _0x2fd307=_0x5d75aa[0x0];if(!_0x2fd307['isDocumentOperation'])return;if('marker'!=_0x2fd307['type']||!_0x2fd307['name']['startsWith']('user:'))return;const _0x1d6c9b=_0x2fd307['batch'];_0x58d15f['_createdBatches']['has'](_0x1d6c9b)&&(_0x2fd307['newRange']=_0x2fd307['oldRange']?_0x45f047['model']['createRange'](_0x2fd307['oldRange']['start'],_0x2fd307['oldRange']['end']):null);},{'priority':'highest'});}['destroy'](){return this['_domEmitter']['stopListening'](),super['destroy']();}['createUserMarkerOperations'](){const _0xdb90e8=this['editor'],_0x2a0674=_0xdb90e8['model']['document'],_0x62b01=_0xdb90e8['plugins']['get'](i);_0xdb90e8['model']['enqueueChange']({'isUndoable':!0x1},_0x3c05ad=>{const _0x10b2f1='user:range:'+_0x62b01['mySessionId'],_0x25b273='user:position:'+_0x62b01['mySessionId'],_0x128272=_0xdb90e8['model']['markers']['has'](_0x10b2f1);_0xdb90e8['editing']['view']['hasDomSelection']?te(_0x62b01['mySessionId'],_0x2a0674['selection']['getFirstRange'](),_0xdb90e8['model'],_0x3c05ad):_0x128272&&(_0x3c05ad['removeMarker'](_0x10b2f1),_0x3c05ad['removeMarker'](_0x25b273));});}}function te(_0x334462,_0x357007,_0x2e36d5,_0x21d6b4){const _0x3ea42d='user:range:'+_0x334462,_0x47eeef='user:position:'+_0x334462,_0x2ad427=_0x357007['getContainedElement']();let _0x1269e4=_0x357007['start'];if(_0x2ad427&&_0x2ad427['is']('element','tableCell')){const _0x33de18=function(_0x2f8cd0,_0x4223b0){for(const _0x3ef013 of _0x2f8cd0['getPositions']())if(_0x4223b0['schema']['checkChild'](_0x3ef013,'$text'))return _0x3ef013;}(_0x357007,_0x2e36d5);_0x33de18&&(_0x1269e4=_0x33de18,_0x357007=_0x21d6b4['createRange'](_0x1269e4));}const _0x25163f=_0x21d6b4['createRange'](_0x1269e4);_0x2e36d5['markers']['has'](_0x3ea42d)?(_0x21d6b4['updateMarker'](_0x3ea42d,{'range':_0x357007}),_0x21d6b4['updateMarker'](_0x47eeef,{'range':_0x25163f})):(_0x21d6b4['addMarker'](_0x3ea42d,{'range':_0x357007,'usingOperation':!0x0}),_0x21d6b4['addMarker'](_0x47eeef,{'range':_0x25163f,'usingOperation':!0x0}));}function K(_0x3e1be4,_0x5d853d,_0x15703c){const _0x163929=_0x3e1be4['t'],t=_0x3e1be4['t'];switch(_0x5d853d){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 _0x163929({'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'},_0x15703c);default:return'';}}let X=0x1;class l extends _0x302365{static ['CollaborativeEditingService']=/* #__PURE__ -- @preserve */
|
|
25
|
-
((()=>_0x5e5827)());['_offset'];['sessionId'];['serverHistory'];['_channelId'];['_service'];['_document'];['_compressor'];['_bufferedOperations'];['_knownOperations'];['_knownRootNames'];['_pendingAction'];['_hasSelectionChanged'];['_sendBufferedOperationsDelayId'];['_baseBufferDelay'];['_currentBufferDelay'];['_lastSyncedOperationId'];['_disconnectionOperations'];['_operationIdentifier'];static get['requires'](){return[n,i,$,_0x2629a3,_0x2683a2,_0x5c3c50];}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 _0x34fef4=this['serverHistory']['getOperations']();for(let _0x390251=_0x34fef4['length']-0x1;_0x390251>=0x0;_0x390251--){const _0x2ade4a=_0x34fef4[_0x390251];if(!this['_disconnectionOperations']['has'](_0x2ade4a))return _0x2ade4a['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0x3cef5b){if(super(_0x3cef5b),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x13b0f8(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0x57f413('collaboration-missing-channelid',this);const _0x1402fe=_0x3cef5b['config']['get']('cloudServices.bundleVersion')||nt;this['_service']=new l['CollaborativeEditingService'](_0x1402fe,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0x183cd7(),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 tt(this['_disconnectionOperations']);}['init'](){const _0xa17bca=this['editor'],_0x2b1880=_0xa17bca['plugins']['get'](_0x2683a2),_0x50f1e8=_0xa17bca['plugins']['get'](n);this['listenTo'](_0x2b1880,'getOperationAuthor',(_0x53ac5e,_0x467562)=>{const _0x380907=_0x467562[0x0];_0x380907['_authorId']&&(_0x53ac5e['return']=_0x2b1880['getUser'](_0x380907['_authorId']),_0x53ac5e['stop']()),null===_0x380907['_authorId']&&(_0x53ac5e['return']=null,_0x53ac5e['stop']());},{'priority':'high'}),this['listenTo'](_0xa17bca['model']['document']['selection'],'change:range',(_0x3da5f9,_0x2d3798)=>{_0x2d3798['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0xa17bca['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0xa17bca['model']['on']('applyOperation',(_0x3ca726,_0x563f86)=>{const _0x2a2529=_0x563f86[0x0];_0x2a2529['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0x2a2529),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['bind']('_isEditingAllowed')['to'](_0x50f1e8,'state',this,'_hasSynchronizationProblem',(_0x53d380,_0x5ec2c)=>'connected'===_0x53d380&&!_0x5ec2c),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0xa17bca['disableReadOnlyMode']('rtc-offline'):_0xa17bca['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0xa17bca['disableReadOnlyMode']('rtc-offline'):_0xa17bca['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async['reconnect'](){const _0x4b14ef=this['editor']['plugins']['get'](i),_0x1502af=this['editor']['plugins']['get'](n);try{this['_isPendingUpdate']=!0x0,_0x4b14ef['unregister'](this['_channelId']);const _0x149f44=await this['_service']['reconnect'](_0x1502af['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0x149f44)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x2b07b1=await this['_service']['getConnectedSessions']();_0x4b14ef['register'](this['_channelId'],_0x2b07b1),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x2fac83){if(function(_0x51e739){return'404'===_0x51e739['code'];}(_0x2fac83)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0xcaf021){return'409'===_0xcaf021['code'];}(_0x2fac83)){const _0x28732b=K(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'](_0x28732b);}else{if(!(_0x2fac83 instanceof Y))throw _0x2fac83;this['_handleReconnectionError']();}}}}['destroy'](){const _0x3e54fc=this['editor']['plugins']['get'](n),_0x19c312=this['editor']['plugins']['get'](i);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x19c312['channelSessions']['has'](this['_channelId'])&&_0x19c312['unregister'](this['_channelId']),_0x3e54fc['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async['_handleReconnectionResponse'](_0x3df2a6){if(this['sessionId']!==_0x3df2a6['sessionId']&&this['_lastSyncedOperationId']!==_0x3df2a6['lastOperationId'])throw new Y();return this['sessionId']=_0x3df2a6['sessionId'],this['_handleServerResponse']([],{..._0x3df2a6,'wereChangesApplied':!0x1,'data':_0x3df2a6['data']},'reconnect');}async['_connectService'](_0x2c8f06,_0xcb0453=!0x1){const {connection:_0x138305}=this['editor']['plugins']['get'](n);l['CollaborativeEditingService']['getConnectedSessions'](_0x138305,this['_channelId'])['then'](_0x5c42d3=>this['_initSessionsHandling'](_0x5c42d3))['catch'](_0x4b9f0f=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x4b9f0f);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x1138ed,_0x10b2ed)=>{this['_crash']('realtimecollaborationclient-init-service-internal-error',_0x10b2ed);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_isConnected']=!0x1;});const _0x502a20=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x2c8f06);this['_isPendingUpdate']=!0x0;const _0x3ace86=await this['_service']['connect'](_0x138305,this['_compressOperations'](_0x2c8f06),_0x502a20);if(this['sessionId']=_0x3ace86['sessionId'],_0xcb0453){if(!_0x3ace86['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x3ace86['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0x2c8f06,_0x3ace86,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x3ace86,_0x2c8f06);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}['_handleSendingSelectionMarkers'](){const _0xcbe53c=this['editor']['plugins']['get'](i),_0x1ac419=this['editor']['plugins']['get']($),_0x234cef=_0xcbe53c['channelSessions']['get'](this['_channelId']);_0x234cef&&_0x234cef['length']>0x1?_0x1ac419['createUserMarkerOperations']():this['listenTo'](_0xcbe53c,'sessionAdd:'+this['_channelId'],()=>{0x2===_0xcbe53c['channelSessions']['get'](this['_channelId'])['length']&&_0x1ac419['createUserMarkerOperations']();});}async['_handleReceivedOperations'](_0x517f9a,_0x4c615b,_0x31538a,_0x4ead90){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x4c615b){const _0x32a344=this['_decompressOperations'](_0x31538a,_0x4ead90);await this['_fetchMissingUsers'](_0x32a344),this['_handleExternalOperations'](_0x32a344,_0x4c615b,_0x31538a['lastOperationId'])||this['_crash']('realtimecollaborationclient-init-service-incorrect-server-operation');}}async['_connectAfterSessionHasBeenFlushed'](){this['_disconnectService']();const {locale:_0x3bb695}=this['editor'];let _0x378439;try{_0x378439=await this['_service']['getDocumentDetails']();}catch{const _0x3e839a=K(_0x3bb695,'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'](_0x3e839a);}const _0x3d0412=_0x378439['currentDocumentSession']||_0x378439['lastDocumentSession'];if(this['_lastSyncedOperationId']!==_0x3d0412['lastOperationId']){const _0x591963=K(_0x3bb695,'The\x20last\x20saved\x20version\x20of\x20the\x20document\x20does\x20not\x20match\x20the\x20local\x20version.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.');return void this['_handleReconnectionError'](_0x591963);}await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);}['_disconnectService'](){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['stopListening'](this['_service']);}['_initSessionsHandling'](_0xe33ccf){const _0x586866=this['editor']['plugins']['get'](i);this['listenTo'](_0x586866,'sessionAdd:'+this['_channelId'],(_0x1f14c3,{session:_0x1e4b66})=>{if(_0x1e4b66['id']===_0x586866['mySessionId']){_0x1f14c3['off']();const _0x303dad=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0xfeedc8=_0x1e4b66['permissions'];_0x303dad&&_0x303dad['isEnabled']&&(_0xfeedc8=_0xfeedc8['filter'](_0x1f501e=>'document:write'!==_0x1f501e)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0xfeedc8,this['_channelId']);}}),_0x586866['register'](this['_channelId'],_0xe33ccf);}['_initThrowingOnDataSet'](){const _0x343ee8=this['editor']['data']['set'];this['editor']['data']['set']=(..._0xb0b2aa)=>{if(!_0xb0b2aa[_0xb0b2aa['length']-0x1]['suppressErrorInCollaboration'])throw new _0x57f413('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x343ee8['apply'](this['editor']['data'],_0xb0b2aa);};}['_setUpDataInit'](){this['editor']['data']['on']('init',(_0x460f4d,[_0x5bf2a7])=>{if(this['_document']['version'])throw new _0x57f413('realtimecollaborationclient-init-document-already-initialized',this);_0x460f4d['stop'](),this['_setPendingAction']();const _0x2f8f40=this['editor']['config']['get']('rootsAttributes'),_0x3e97a6=this['_getOperationsFromInitData'](_0x5bf2a7,_0x2f8f40);0x0==_0x3e97a6['length']&&_0x3e97a6['push'](new _0x4d74b2(0x0)),_0x460f4d['return']=this['_connectService'](_0x3e97a6)['then'](()=>{this['editor']['plugins']['get'](n)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x462cab=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x462cab))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x1a959e,[_0xb82e90,_0x1432e3])=>{_0x1a959e['stop']();const _0x5d3b58=this['editor']['model']['document']['getRoot'](_0xb82e90);if(!this['_knownRootNames']['has'](_0xb82e90)){const _0x56189c=_0x1432e3&&_0x1432e3['data']?_0x1432e3['data']:'',_0x41faa9=_0x1432e3&&_0x1432e3['attributes']?_0x1432e3['attributes']:{};await this['_loadRoot'](_0xb82e90,_0x56189c,_0x41faa9);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0x5d3b58['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0x5d3b58);});},{'priority':'high'});}async['_fetchMissingUsers'](_0x4e216c){const _0x1bb37a=this['editor']['plugins']['get'](_0x2683a2),{connection:_0xab0758}=this['editor']['plugins']['get'](n),_0x1fa410=new Set();for(const _0x489cf7 of _0x4e216c){const _0x351714=_0x489cf7['_authorId'];_0x351714&&!_0x1bb37a['getUser'](_0x351714)&&_0x1fa410['add'](_0x351714);}if(0x0===_0x1fa410['size'])return;const _0x3ec5bd=await ct['getMany'](_0xab0758,Array['from'](_0x1fa410));for(const _0x1a3787 of _0x3ec5bd)_0x1bb37a['getUser'](_0x1a3787['id'])||_0x1bb37a['addUser'](_0x1a3787);}['_getOperationsFromInitData'](_0x5c6775,_0x55562d={}){const _0x27f460=this['editor']['model'],_0x486299=[];let _0x4458f7=0x0;const _0x79a57e='string'==typeof _0x5c6775?{'main':_0x5c6775}:_0x5c6775;for(const _0x4fb61a of Object['keys'](_0x79a57e)){if(!this['_document']['roots']['has'](_0x4fb61a))throw new _0x57f413('realtimecollaborationclient-init-non-existent-root',this);const _0x49a5f9=this['editor']['data']['parse'](_0x79a57e[_0x4fb61a]),_0x5af46c=this['_document']['getRoot'](_0x4fb61a),_0x4b9609=new _0x18701a(_0x27f460['createPositionAt'](_0x5af46c,0x0),_0x49a5f9,_0x4458f7++);_0x486299['push'](_0x4b9609);for(const [_0x4ce4ec,_0x1ae4d7]of _0x49a5f9['markers']){const _0x3b4d97=_0x27f460['createRange'](_0x27f460['createPositionFromPath'](_0x5af46c,_0x1ae4d7['start']['path']['slice']()),_0x27f460['createPositionFromPath'](_0x5af46c,_0x1ae4d7['end']['path']['slice']())),_0xb0c1e9=new _0x15d1b4(_0x4ce4ec,null,_0x3b4d97,_0x27f460['markers'],!0x0,_0x4458f7++);_0x486299['push'](_0xb0c1e9);}}if(_0x55562d)for(const [_0x1026ca,_0x323356]of Object['entries'](_0x55562d)){const _0x5e21a1=_0x27f460['document']['getRoot'](_0x1026ca);if(!_0x5e21a1)throw new _0x57f413('multi-root-editor-root-attributes-no-root',null);for(const [_0x187c6a,_0x55aae6]of Object['entries'](_0x323356))if(null!==_0x55aae6){const _0x329710=new _0x179482(_0x5e21a1,_0x187c6a,null,_0x55aae6,_0x4458f7++);_0x486299['push'](_0x329710);}}return _0x486299;}async['_loadRoot'](_0x2c6ea5,_0x17a358,_0x21d763){this['_getOperationsFromInitData']({[_0x2c6ea5]:_0x17a358},{[_0x2c6ea5]:_0x21d763})['forEach']((_0x3ea3fa,_0xb1e01e)=>{_0x3ea3fa['baseVersion']=this['_document']['version']+_0xb1e01e,_0x3ea3fa['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x3ea3fa);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async['_handleInitialConnectionData'](_0x4cd678,_0x6cc218){let _0x16876c;this['_offset']=_0x4cd678['offset'];const _0x49db77=_0x4cd678['wereChangesApplied']&&!_0x4cd678['initData'],_0x218cc5=_0x49db77?0x0:_0x4cd678['data']['baseVersion'];if(_0x6cc218['forEach'](_0x39b39d=>{_0x39b39d['_isInit']=!0x0,_0x39b39d['createdAt']=_0x4cd678['sessionCreatedAt'],_0x39b39d['_authorId']=null;}),_0x49db77)_0x16876c=_0x6cc218,this['_applyOperationsSet'](_0x16876c,_0x49db77);else{if(_0x4cd678['initData']){const _0x3a6219=this['_getOperationsFromInitData'](_0x4cd678['initData']);this['_document']['history']['version']=-_0x3a6219['length'],_0x3a6219['forEach'](_0x98e1f2=>{_0x98e1f2['baseVersion']-=_0x3a6219['length'],_0x98e1f2['createdAt']=_0x4cd678['sessionCreatedAt'],_0x98e1f2['_isInit']=!0x0,_0x98e1f2['_authorId']=null;}),this['_applyOperationsSet'](_0x3a6219,!0x0),this['serverHistory']['version']=-_0x3a6219['length']+this['_offset'],this['_updateServerHistory'](_0x3a6219);}this['_document']['history']['version']=_0x218cc5,_0x16876c=this['_decompressOperations'](_0x4cd678['data'],_0x4cd678['metadata']),await this['_fetchMissingUsers'](_0x16876c),this['_applyOperationsSet'](_0x16876c,_0x49db77);}_0x4cd678['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x16876c,_0x4cd678['lastOperationId']),this['_lastSyncedOperationId']=_0x4cd678['lastOperationId']),this['serverHistory']['version']=_0x218cc5+this['_offset'],this['_updateServerHistory'](_0x16876c),_0x6cc218['filter'](_0x25162c=>{const _0x3b4124=this['_getAffectedRoot'](_0x25162c);return _0x3b4124&&!this['_knownRootNames']['has'](_0x3b4124);})['forEach']((_0x91eb06,_0x46d559)=>{_0x91eb06['baseVersion']=this['_document']['version']+_0x46d559,this['_saveOperationInBuffer'](_0x91eb06);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x1790c9,_0x14862b){const _0x1ae287=_0x14862b&&_0x14862b['message'];if(_0x1ae287&&_0x1ae287['startsWith']('realtimecollaborationclient'))throw _0x14862b;const _0x423b47=this['editor']['plugins']['get'](n);throw this['_isPendingUpdate']=!0x0,_0x423b47['disconnect'](),this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0x57f413(_0x1790c9,this['editor'],_0x1ae287?{'originalError':_0x1ae287}:void 0x0);}['_saveOperationInBuffer'](_0x28de90){this['_knownOperations']['has'](_0x28de90)||(this['_knownOperations']['add'](_0x28de90),this['_bufferedOperations']['push'](_0x28de90),this['_pendingAction']||'marker'==_0x28de90['type']&&!_0x28de90['affectsData']||this['_setPendingAction']());}['_sendBufferedOperationsDelayed'](_0x37715c=!0x1){!_0x37715c&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0x216494=>{_0x216494&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0x5210e1=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0x52e563){return _0x52e563['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x52e563['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0x52e563['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0x5210e1)||this['_crash'](_0x5210e1['message'],_0x5210e1);});},this['_currentBufferDelay']));}['_waitUntilSynced'](){return new Promise(_0xec8961=>{this['on']('change:_isPendingUpdate',()=>{_0xec8961();});});}async['_sendBufferedOperations'](){const _0x1f5938=this['editor']['plugins']['get']($);if(this['_shouldSendSelectionUpdate']()&&(_0x1f5938['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x4e4019=[...this['_bufferedOperations']];for(const _0x4723d5 of _0x4e4019)_0x4723d5['wasUndone']=this['_document']['history']['isUndoneOperation'](_0x4723d5);const _0x5a3e0f=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x4e4019),_0x29b6c3=X++,_0x56e5cf=this['_compressOperations'](_0x4e4019),_0x9b8ac1=await this['_service']['sendOperations'](_0x56e5cf,_0x56e5cf['baseVersion'],_0x5a3e0f);try{return await this['_handleServerResponse'](_0x4e4019,_0x9b8ac1,_0x29b6c3);}catch(_0x5be1d1){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0x5be1d1);}}async['_handleServerResponse'](_0x3f4b03,_0x316bff,_0x44a3f0){if('error'in _0x316bff)throw _0x316bff['error'];let _0x16e9a6=!0x1;if(_0x316bff['wereChangesApplied']){_0x316bff['lastOperationId']&&(this['_lastSyncedOperationId']=_0x316bff['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x41786a=>!_0x3f4b03['includes'](_0x41786a));for(const _0x45b282 of _0x3f4b03)_0x45b282['createdAt']='lastOperationAcceptedAt'in _0x316bff&&_0x316bff['lastOperationAcceptedAt']||void 0x0;Z(_0x3f4b03,_0x316bff['version']-_0x3f4b03['length']),this['_updateServerHistory'](_0x3f4b03);const _0x487a03=_0x3f4b03['filter'](_0x3ec078=>{if(!_0x3ec078['_isInit'])return!0x1;const _0xf9473a=this['_getAffectedRoot'](_0x3ec078);return _0xf9473a&&!this['_knownRootNames']['has'](_0xf9473a);});Z(_0x487a03,this['_document']['version']),this['_applyOperationsSet'](_0x487a03),_0x16e9a6=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0x4eb02e=this['_decompressOperations'](_0x316bff['data'],_0x316bff['metadata'])['filter'](_0x53c42f=>_0x53c42f['baseVersion']>=this['_lastServerVersion']);_0x4eb02e['forEach'](_0x48dfbc=>this['_addKnownRoot'](_0x48dfbc)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x1306e7=>!_0x1306e7['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x1306e7))),this['_bufferedOperations']['length']&&Z(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0x4eb02e),_0x16e9a6=this['_handleExternalOperations'](_0x4eb02e,_0x316bff['version'],_0x316bff['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x16e9a6?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}['_handleExternalOperations'](_0x334fad,_0x1b5ef0,_0x48fd9b){try{const _0x22355d={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x269410,operationsB:_0xee2a90,originalOperations:_0x3402b1}=_0x5dac39(_0x334fad,this['_bufferedOperations'],_0x22355d);Z(_0x269410,this['_document']['version']),Z(_0xee2a90,_0x1b5ef0);for(const _0x5151a5 of _0x269410){const _0x15b73d=_0x3402b1['get'](_0x5151a5);_0x5151a5['_authorId']=_0x15b73d?_0x15b73d['_authorId']:null;}_0x48fd9b&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x334fad,_0x48fd9b),this['_lastSyncedOperationId']=_0x48fd9b),this['_bufferedOperations']=[..._0xee2a90],this['_applyOperationsSet'](_0x269410),this['_updateServerHistory'](_0x334fad);}catch(_0x58ebb7){return console['error'](_0x58ebb7),!0x1;}return!0x0;}['_applyOperationsSet'](_0x1be031,_0x62a23f=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0x225e95=>{for(const _0x3478ad of _0x1be031)this['_knownOperations']['add'](_0x3478ad),this['_addKnownRoot'](_0x3478ad),_0x225e95['batch']['addOperation'](_0x3478ad),this['editor']['model']['applyOperation'](_0x3478ad);});}['_addKnownRoot'](_0x48704d){const _0x3fd5a0=this['_getAffectedRoot'](_0x48704d);_0x3fd5a0&&this['_knownRootNames']['add'](_0x3fd5a0);}['_getAffectedRoot'](_0x5394ef){let _0x278c3d,_0x563900;switch(_0x5394ef['type']){case'insert':_0x278c3d=_0x5394ef['position']['root'];break;case'marker':if(_0x563900=_0x5394ef['newRange'],!_0x563900)return null;_0x278c3d=_0x563900['root'];break;case'addRootAttribute':_0x278c3d=_0x5394ef['root'];break;case'addRoot':_0x278c3d=_0x5394ef['affectedSelectable'];break;case'move':_0x278c3d=_0x5394ef['targetPosition']['root'];break;default:return null;}return _0x278c3d['rootName'];}['_updateServerHistory'](_0x17f4f2){_0x17f4f2['forEach'](_0x13d058=>{const _0x498faa=_0x13d058['clone']();_0x498faa['_authorId']=_0x13d058['_authorId'],_0x498faa['_isInit']=!!_0x13d058['_isInit'],_0x498faa['createdAt']=_0x13d058['createdAt'],_0x498faa['baseVersion']+=this['_offset'],_0x13d058['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x498faa),this['serverHistory']['addOperation'](_0x498faa);});}['_handleReconnectionError'](_0x3d404a){const _0x4c9ab6=this['editor']['plugins']['get']('Notification'),_0x2a56b6=this['editor']['locale'];_0x3d404a||(_0x3d404a=K(_0x2a56b6,'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.')),_0x4c9ab6['showWarning'](_0x3d404a,{'title':K(_0x2a56b6,'Synchronization\x20issue'),'namespace':'real-time-collaboration'}),this['_hasSynchronizationProblem']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_bufferedOperations']=[],this['editor']['plugins']['get'](n)['disconnect']();}['_setPendingAction'](){this['_pendingAction']||(this['_pendingAction']=this['editor']['plugins']['get'](_0x2629a3)['add'](K(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}['_clearPendingAction'](){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x2629a3)['remove'](this['_pendingAction']),this['_pendingAction']=null);}['_compressOperations'](_0x5b8fd6){const _0x2f2ea1=_0x5b8fd6['map'](_0x9428e2=>_0x9428e2['toJSON']());return this['_compressor']['compress'](_0x2f2ea1);}['_decompressOperations'](_0x2c2322,_0x3ae284){return this['_compressor']['decompress'](_0x2c2322)['map']((_0x5272e0,_0x5ca56e)=>{const _0xed3bb4='init'==_0x3ae284[_0x5ca56e]['type'];if('InsertOperation'==_0x5272e0['__className']){const _0x344d86=_0x5272e0['position']['root'];!this['_document']['getRoot'](_0x344d86)&&(this['_document']['createRoot']('$root',_0x344d86)['_isAttached']=!0x1);}const _0x2a40c8=_0x2f2427['fromJSON'](_0x5272e0,this['_document']);return _0x2a40c8['wasUndone']=_0x5272e0['wasUndone'],_0x2a40c8['_isInit']=_0xed3bb4,_0x2a40c8['_authorId']=_0xed3bb4?null:_0x3ae284[_0x5ca56e]['userId'],_0x2a40c8['_isDisconnection']='cs:removeUser'===_0x3ae284[_0x5ca56e]['type'],_0x2a40c8['createdAt']=_0x3ae284[_0x5ca56e]['createdAt'],_0x2a40c8;});}['_refreshUserSelectionMarkers'](){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}['_shouldSendSelectionUpdate'](){const _0x272337=this['editor']['plugins']['get'](i)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0x272337&&_0x272337['length']>0x1&&this['_hasSelectionChanged'];}['_shouldSendUpdate'](){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}}class Y extends Error{}function Z(_0x40100e,_0x5ad243){for(const _0xb84446 of _0x40100e)_0xb84446['baseVersion']=_0x5ad243++;}class tt{['_ignoredOperations'];['_operationToId'];constructor(_0x1efc76){this['_ignoredOperations']=_0x1efc76,this['_operationToId']=new WeakMap();}['getIdOfTheLastOperation'](_0x4ca3c1){let _0x573564=_0x4ca3c1['length'];for(;_0x573564--;){const _0x212bc9=_0x4ca3c1[_0x573564];if(!this['_ignoredOperations']['has'](_0x212bc9)){if(!this['_operationToId']['has'](_0x212bc9)){const _0x272238=_0x5e41d4()['slice'](0x1,0x12);this['_operationToId']['set'](_0x212bc9,_0x272238);}return this['_operationToId']['get'](_0x212bc9);}}}['setIdForTheLastOperation'](_0x460f88,_0x1caaa0){if(!_0x1caaa0)return;let _0x6ec204=_0x460f88['length'];for(;_0x6ec204--;){const _0x5b57a0=_0x460f88[_0x6ec204];this['_ignoredOperations']['has'](_0x5b57a0)||this['_operationToId']['set'](_0x5b57a0,_0x1caaa0);}}}class a extends _0x302365{static get['requires'](){return[l];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class s extends _0x2d811c{static ['CommentsService']=/* #__PURE__ -- @preserve */
|
|
26
|
-
((()=>_0x592e76)());['_services'];static get['requires'](){return[n,'CommentsRepository',i,_0x2683a2];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x44bd19){super(_0x44bd19),this['_services']=new Map();}async['init'](){const _0x5579eb=this['context'],_0x405496=_0x5579eb['plugins']['get']('CommentsRepository');if(_0x5579eb['plugins']['get'](n)['addToReconnectionStack'](this),_0x405496['adapter']={'addCommentThread':async({channelId:_0x31d3ec,threadId:_0x2a6ea4,comments:_0xfdafaf,resolvedAt:_0x476e6d,resolvedBy:_0xdef4f8,context:_0x515876,attributes:_0x571a39})=>{const _0x1835f8=await this['_getService'](_0x31d3ec)['addCommentThread']({'commentThreadId':_0x2a6ea4,'comments':_0xfdafaf['map'](_0x5587c4=>function(_0x546814,_0x2bf216,_0x49f2dc){return{'commentThreadId':_0x49f2dc,'commentId':_0x546814['commentId'],'userId':_0x546814['authorId'],'content':_0x546814['content'],'documentId':_0x2bf216,'createdAt':_0x546814['createdAt'],'attributes':_0x546814['attributes']||{}};}(_0x5587c4,_0x31d3ec,_0x2a6ea4)),'resolvedAt':_0x476e6d,'resolvedBy':_0xdef4f8,'context':_0x515876,'attributes':_0x571a39})['catch'](at);return{'threadId':_0x1835f8['commentThreadId'],'comments':_0x1835f8['comments']};},'getCommentThread':async({channelId:_0x548c6a,threadId:_0xb6f095})=>{const _0x3e9436=await this['_getService'](_0x548c6a)['getCommentThread'](_0xb6f095)['catch'](at);return _0x3e9436['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0x3e9436]),{'threadId':_0x3e9436['commentThreadId'],'comments':_0x3e9436['comments']['map'](B),'context':_0x3e9436['context'],'resolvedAt':_0x3e9436['resolvedAt'],'resolvedBy':_0x3e9436['resolvedBy'],'attributes':_0x3e9436['attributes']||{}});},'updateCommentThread':async({channelId:_0x2e0cb5,threadId:_0x3383c1,context:_0x4e1fa8,unlinkedAt:_0x3fbc58,attributes:_0x3a937e})=>this['_getService'](_0x2e0cb5)['updateCommentThread']({'commentThreadId':_0x3383c1,'context':_0x4e1fa8,'attributes':_0x3a937e,'unlinkedAt':_0x3fbc58})['catch'](F)['catch'](at),'resolveCommentThread':async({channelId:_0xe4c753,threadId:_0x3f43b5})=>{const _0xa6bcee=await this['_getService'](_0xe4c753)['resolveCommentThread'](_0x3f43b5)['catch'](F)['catch'](at);return{'threadId':_0xa6bcee['commentThreadId'],'resolvedAt':_0xa6bcee['resolvedAt'],'resolvedBy':_0xa6bcee['resolvedBy']};},'reopenCommentThread':async({channelId:_0x4b1edc,threadId:_0x34d42f})=>this['_getService'](_0x4b1edc)['reopenCommentThread'](_0x34d42f)['catch'](F)['catch'](at),'removeCommentThread':({channelId:_0x4c1952,threadId:_0x379ce9})=>this['_getService'](_0x4c1952)['removeCommentThread'](_0x379ce9)['catch'](F)['catch'](at),'addComment':({channelId:_0x28f70d,threadId:_0x5dfc75,commentId:_0x486324,content:_0x51af97,attributes:_0x1fb248})=>this['_getService'](_0x28f70d)['addComment'](_0x5dfc75,_0x486324,_0x51af97,_0x1fb248)['catch'](at),'updateComment':({channelId:_0x56e3e3,threadId:_0x3c6371,commentId:_0x208cfb,content:_0xb41cfb,attributes:_0x391593})=>this['_getService'](_0x56e3e3)['updateComment'](_0x3c6371,_0x208cfb,_0xb41cfb,_0x391593)['catch'](F)['catch'](at),'removeComment':({channelId:_0x48e6cc,threadId:_0xadf6df,commentId:_0x42898f})=>this['_getService'](_0x48e6cc)['removeComment'](_0xadf6df,_0x42898f)['catch'](F)['catch'](at)},_0x5579eb instanceof _0x1a39e0){const _0x39c0d0=_0x5579eb['config']['get']('collaboration.channelId'),_0x537830=_0x5579eb['plugins']['get'](i);await this['_setUpService'](_0x39c0d0);const _0x4b60ed=await this['_services']['get'](_0x39c0d0)['getConnectedSessions']();this['listenTo'](_0x537830,'sessionAdd:'+_0x39c0d0,(_0x25f72f,{session:_0x5def48})=>{_0x5def48['id']===_0x537830['mySessionId']&&(_0x25f72f['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x5def48['permissions'],_0x39c0d0));}),_0x537830['register'](_0x39c0d0,_0x4b60ed);}}async['_setUpService'](_0x1dc4df){if(this['_services']['has'](_0x1dc4df))throw new _0x57f413('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0x1dc4df});const _0x217e36=this['context']['plugins']['get']('CommentsRepository'),_0x560135=new s['CommentsService'](_0x1dc4df);this['_services']['set'](_0x1dc4df,_0x560135),this['listenTo'](_0x560135,'commentThreadAdded',(_0x53367e,_0x8a622a)=>{const {commentThreadId:_0x286c2d,documentId:_0xcbfba4,context:_0x561c1d,attributes:_0x1e4cbc,resolvedAt:_0x2f665c,resolvedBy:_0x368102,comments:_0x2c927a}=_0x8a622a;_0x217e36['getCommentThread'](_0x286c2d)||_0x217e36['addCommentThread']({'threadId':_0x286c2d,'channelId':_0xcbfba4,'comments':_0x2c927a?_0x2c927a['map'](B):[],'context':_0x561c1d,'attributes':_0x1e4cbc,'resolvedAt':_0x2f665c,'resolvedBy':_0x368102,'isFromAdapter':!0x0});}),this['listenTo'](_0x560135,'commentThreadUpdated',(_0x2c6140,{commentThreadId:_0x49aae5,documentId:_0x4c17ac,context:_0x275684,unlinkedAt:_0x2ba56a,attributes:_0x4847b5})=>{_0x217e36['getCommentThread'](_0x49aae5)&&_0x217e36['updateCommentThread']({'threadId':_0x49aae5,'channelId':_0x4c17ac,'context':_0x275684,'unlinkedAt':_0x2ba56a,'attributes':_0x4847b5,'isFromAdapter':!0x0});}),this['listenTo'](_0x560135,'commentThreadResolved',(_0x54a327,{commentThreadId:_0x53b73b,resolvedBy:_0x5d29b9,resolvedAt:_0x5e6cf6})=>{const _0x1aef4a=_0x217e36['getCommentThread'](_0x53b73b);_0x1aef4a&&_0x1aef4a['resolve']({'resolvedBy':_0x5d29b9,'resolvedAt':_0x5e6cf6,'isFromAdapter':!0x0});}),this['listenTo'](_0x560135,'commentThreadReopened',(_0x558ea9,{commentThreadId:_0x2f4737})=>{const _0x3ba29c=_0x217e36['getCommentThread'](_0x2f4737);_0x3ba29c&&_0x3ba29c['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0x560135,'commentThreadRemoved',(_0xb34b2b,{commentThreadId:_0x412318})=>{const _0x3d92e2=_0x217e36['getCommentThread'](_0x412318);_0x3d92e2&&_0x3d92e2['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0x560135,'commentAdded',(_0x2e1053,_0x18c18f)=>{const _0x5f502c=_0x18c18f['commentThreadId'],_0x5646a7=_0x217e36['getCommentThread'](_0x5f502c);_0x5646a7&&_0x5646a7['addComment']({...B(_0x18c18f),'isFromAdapter':!0x0});}),this['listenTo'](_0x560135,'commentUpdated',(_0xed0aee,{commentThreadId:_0x4adadf,commentId:_0x38502d,content:_0x59a6b7,attributes:_0x220469})=>{const _0x2d8290=_0x217e36['getCommentThread'](_0x4adadf);if(_0x2d8290){const _0x40d5a3=_0x2d8290['getComment'](_0x38502d);_0x40d5a3&&_0x40d5a3['update']({'content':_0x59a6b7,'attributes':_0x220469,'isFromAdapter':!0x0});}}),this['listenTo'](_0x560135,'commentRemoved',(_0xfb758,{commentThreadId:_0x9ebf72,commentId:_0x11ab8d})=>{const _0x3eedd0=_0x217e36['getCommentThread'](_0x9ebf72);if(_0x3eedd0){const _0x39b11d=_0x3eedd0['getComment'](_0x11ab8d);_0x39b11d&&_0x39b11d['remove']({'isFromAdapter':!0x0});}}),await this['_connectService'](_0x1dc4df);}['destroy'](){if(this['context']instanceof _0x1a39e0){const _0x5926b1=this['context']['config']['get']('collaboration.channelId');this['_terminateService'](_0x5926b1);}}['_terminateService'](_0x2d30e8){if(!this['_services']['has'](_0x2d30e8))throw new _0x57f413('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0x2d30e8});this['_getService'](_0x2d30e8)['disconnect'](),this['_services']['delete'](_0x2d30e8);}async['reconnect'](){for(const _0x33743e of this['_services']['keys']())await this['_connectService'](_0x33743e);if(this['context']instanceof _0x1a39e0){const _0x4c7ee1=this['context']['config']['get']('collaboration.channelId'),_0x3496dc=this['context']['plugins']['get'](i);_0x3496dc['unregister'](_0x4c7ee1);const _0x3c2fe2=await this['_services']['get'](_0x4c7ee1)['getConnectedSessions']();_0x3496dc['register'](_0x4c7ee1,_0x3c2fe2);}}async['_connectService'](_0x259b80){const {connection:_0x591756}=this['context']['plugins']['get'](n),_0x2f3e48=this['context']['plugins']['get']('CommentsRepository'),_0xe77b3=this['_services']['get'](_0x259b80),_0x215e02=await _0xe77b3['connect'](_0x591756);await this['_fetchMissingUsersForThreads'](_0x215e02);const _0x750871=new Set(Array['from'](_0x2f3e48['getCommentThreads']({'channelId':_0x259b80}),_0xce5086=>_0xce5086['id']));for(const _0x14cefe of _0x215e02)_0x14cefe['deletedAt']||_0x750871['delete'](_0x14cefe['commentThreadId']);for(const _0x3c039c of _0x750871)_0x2f3e48['getCommentThread'](_0x3c039c)['remove']({'isFromAdapter':!0x0});for(const _0x2e343c of _0x215e02){let _0xa5f6e=_0x2f3e48['getCommentThread'](_0x2e343c['commentThreadId']);const {commentThreadId:_0x52b5a1,context:_0x3aaa3b,attributes:_0x30a2c7,resolvedBy:_0x1c40e5,resolvedAt:_0x51bb6f,unlinkedAt:_0xc66867,deletedAt:_0x483208}=_0x2e343c;if(_0x483208)continue;_0xa5f6e||(_0xa5f6e=_0x2f3e48['addCommentThread']({'channelId':_0x259b80,'threadId':_0x52b5a1,'context':_0x3aaa3b,'attributes':_0x30a2c7||{},'resolvedBy':_0x1c40e5,'resolvedAt':_0x51bb6f,'unlinkedAt':_0xc66867,'isFromAdapter':!0x0}));const _0x599d93=new Set(Array['from'](_0xa5f6e['comments'],_0x47d6ff=>_0x47d6ff['id']));for(const _0x33ca38 of _0x2e343c['comments'])_0x599d93['delete'](_0x33ca38['commentId']);for(const _0x31f29a of _0x599d93)_0xa5f6e['getComment'](_0x31f29a)['remove']({'isFromAdapter':!0x0});for(const _0x438656 of _0x2e343c['comments']){const _0x4c6add=_0xa5f6e['getComment'](_0x438656['commentId']);_0x4c6add?_0x4c6add['content']!==_0x438656['content']&&_0x4c6add['update']({'content':_0x438656['content'],'isFromAdapter':!0x0}):_0xa5f6e['addComment'](Object['assign'](B(_0x438656),{'isFromAdapter':!0x0}));}}}['_getService'](_0x367120){if(!this['_services']['has'](_0x367120))throw new _0x57f413('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0x367120});return this['_services']['get'](_0x367120);}async['_fetchMissingUsersForThreads'](_0x5941d2){const _0x3fd951=this['context']['plugins']['get'](_0x2683a2),{connection:_0x432a71}=this['context']['plugins']['get'](n),_0x23f351=new Set();for(const {resolvedBy:_0x382d62,comments:_0x21deda}of _0x5941d2){_0x382d62&&!_0x3fd951['getUser'](_0x382d62)&&_0x23f351['add'](_0x382d62);for(const {userId:_0x4c0f2a}of _0x21deda)_0x3fd951['getUser'](_0x4c0f2a)||_0x23f351['add'](_0x4c0f2a);}if(0x0===_0x23f351['size'])return;const _0x1b4270=await ct['getMany'](_0x432a71,Array['from'](_0x23f351));for(const _0x4fe8f8 of _0x1b4270)_0x3fd951['getUser'](_0x4fe8f8['id'])||_0x3fd951['addUser'](_0x4fe8f8);}}async function F(_0x57cbf5){if('404'!==_0x57cbf5['code'])throw _0x57cbf5;}function at(_0x15e857){if((_0xd4520d=_0x15e857)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0xd4520d['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0xd4520d['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0xd4520d;throw _0x15e857;}function B(_0x26aaaa){return{'threadId':_0x26aaaa['commentThreadId'],'commentId':_0x26aaaa['commentId'],'content':_0x26aaaa['content'],'createdAt':_0x26aaaa['createdAt'],'authorId':_0x26aaaa['userId'],'attributes':_0x26aaaa['attributes']||{}};}class m extends _0x302365{static ['TrackChangesService']=/* #__PURE__ -- @preserve */
|
|
27
|
-
((()=>
|
|
28
|
-
((()=>_0x5cace5)());['_lastRequestId'];['_revisionTracker'];['_revisionHistoryService'];['_oldOffset'];static get['requires'](){return[n,l,'RevisionHistory',i,_0x2683a2];}static get['pluginName'](){return'CloudServicesRevisionHistoryAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x32bdde){super(_0x32bdde);const _0x3a5415=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new c['RevisionHistoryService'](_0x3a5415);}async['init'](){const _0x56bdbd=this['editor']['plugins']['get'](l),_0x3eaf37=_0x56bdbd['serverHistory'],_0x464ffc=this['editor']['plugins']['get'](n);this['_revisionTracker']['setSource']({'history':_0x3eaf37,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0x56bdbd['sessionId']});const _0x302478=this['editor']['config']['get']('cloudServices.bundleVersion')||nt,_0xb2f961=await _0x23e084['isBundleUploaded'](_0x464ffc['connection'],_0x302478);this['editor']['plugins']['get']('RevisionHistory')['adapter']={'getRevision':async({revisionId:_0xab8aff})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0xab8aff)),'updateRevisions':async _0x309278=>{await this['_waitForServiceReady']();const _0x32965c=this['_revisionTracker']['currentRevision'];if(_0xb2f961&&0x1===_0x309278['length']&&_0x309278[0x0]['id']===_0x32965c['id'])return _0x309278;for(const _0x448918 of _0x309278)_0x448918['id']===_0x32965c['id']&&(_0x448918['isEmptyCurrent']=_0x448918['fromVersion']===_0x448918['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0x309278,this['_lastRequestId'])['then'](_0x304dc4=>(this['_lastRequestId']=_0x304dc4,_0x309278))['catch'](_0x18e649=>{if(q(_0x18e649)||'400'===_0x18e649['code']&&void 0x0!==_0x18e649['data']['wrongRequestId']){for(const _0x180616 of _0x309278){!this['_revisionTracker']['repository']['getRevision'](_0x180616['id'])||this['_revisionTracker']['_bufferUpdate'](_0x180616['id'],_0x180616,!0x1);}if(q(_0x18e649))throw _0x18e649;return _0x309278;}throw _0x18e649;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0x167a28,{revisionsData:_0x59122e,requestId:_0x1587fa})=>{Math['max'](..._0x59122e['map'](_0x4b2c35=>_0x4b2c35['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0x59122e,_0x1587fa);}):this['_handleRevisionsUpdate'](_0x59122e,_0x1587fa);});const {revisions:_0x37a556,requestId:_0x50ce45}=await this['_revisionHistoryService']['connect'](_0x464ffc['connection']);_0x464ffc['addToReconnectionStack'](this),this['_lastRequestId']=_0x50ce45,await this['_fetchMissingUsers'](_0x37a556);for(const _0x1a8d86 of _0x37a556)this['_revisionTracker']['addRevisionData'](_0x1a8d86);this['listenTo'](_0x56bdbd,'change:_isConnected',(_0x51dd31,_0x267834,_0x5282b3)=>{_0x5282b3&&(this['_oldOffset']=_0x56bdbd['_offset'],_0x51dd31['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](_0x464ffc,'state',_0x4f2d36=>_0x4f2d36===_0x4777ba['CONNECTED']);}async['reconnect'](){const _0x21a943=this['editor']['plugins']['get'](n),_0x1b0f83=this['editor']['plugins']['get'](l),_0x1a89f3=async()=>{const _0x5d1544=this['_revisionTracker']['currentRevision'],_0x4be4ad=_0x5d1544['id'],_0x9b78f6=_0x4be4ad!==_0x1b0f83['sessionId'];if(_0x9b78f6){const _0x2b33bb=_0x1b0f83['_offset']-this['_oldOffset'],_0xe9e941=this['_getLatestVersionFromServerOperations']();this['_revisionTracker']['_revisionDataBuilder']['reInit']();if(_0x5d1544['toVersion']+_0x2b33bb!==_0xe9e941){const _0x59451d=_0x5d1544['fromVersion']+_0x2b33bb,_0x301869=this['editor']['plugins']['get'](_0x2683a2),_0x161eb7=this['_revisionTracker']['buildRevisionData']({'revision':_0x5d1544,'from':_0x59451d,'to':_0xe9e941});_0x161eb7['id']=_0x5d1544['id'];const _0x593949=_0x161eb7['authorsIds']['map'](_0x1f6869=>_0x301869['getUser'](_0x1f6869));_0x5d1544['_update']({..._0x161eb7,'authors':_0x593949},!0x0),this['_revisionTracker']['_bufferUpdate'](_0x5d1544['id'],_0x161eb7,!0x0);}this['_revisionTracker']['_startingVersion']=_0xe9e941,(_0x5d1544['toVersion']===_0x5d1544['fromVersion']&&!this['_revisionTracker']['_bufferedUpdates']['has'](_0x4be4ad)&&this['_revisionTracker']['repository']['_revisions']['remove'](_0x4be4ad),this['_revisionTracker']['_createCurrentRevision'](_0xe9e941));}const {revisions:_0x1ef87a,requestId:_0x439a53}=await this['_revisionHistoryService']['reconnect'](_0x21a943['connection'],this['_lastRequestId']);_0x9b78f6&&_0x1ef87a['length']>0x0?_0x1b0f83['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x1ef87a),this['_handleRevisionsUpdate'](_0x1ef87a,_0x439a53),this['_revisionTracker']['sendBufferedUpdates']());};return _0x1b0f83['_isConnected']?_0x1a89f3():new Promise((_0x331908,_0x99ed30)=>{_0x1b0f83['once']('change:_isConnected',()=>{_0x1a89f3()['then'](_0x331908)['catch'](_0x99ed30);});});}['destroy'](){super['destroy']();}async['_waitForServiceReady'](){this['_revisionHistoryService']['isConnected']||await new Promise(_0x1c2cfa=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x2c533e=>{_0x2c533e['off'](),_0x1c2cfa();});});}['_getLatestVersionFromServerOperations'](){const _0x1b9969=this['editor']['plugins']['get'](l)['serverHistory']['getOperations']()['reverse']();for(const _0x12f7c5 of _0x1b9969)if('marker'!==_0x12f7c5['type']||_0x12f7c5['affectsData'])return _0x12f7c5['baseVersion']+0x1;}['_getLatestVersion'](){const _0x7b26f9=this['editor']['plugins']['get'](l);return new Promise(_0x16e56f=>{_0x7b26f9['_isPendingUpdate']?_0x7b26f9['once']('change:_isPendingUpdate',()=>{_0x16e56f(this['_getLatestVersionFromServerOperations']());}):_0x16e56f(this['_getLatestVersionFromServerOperations']());});}['_handleRevisionsUpdate'](_0x279540,_0x1d67bd){const _0xd7dfb0=this['_revisionTracker']['repository'];this['_lastRequestId']=_0x1d67bd;for(const _0x124d30 of _0x279540){const _0x376711=_0xd7dfb0['getRevision'](_0x124d30['id']);if(_0x376711){if((_0x124d30['fromVersion']||_0x124d30['toVersion'])&&(_0x124d30['diffData']=null),_0x376711===this['_revisionTracker']['currentRevision']){const _0x3449f4=Math['max'](_0x376711['toVersion'],_0x124d30['toVersion']),_0x5dd0aa=Math['max'](_0x376711['fromVersion'],_0x124d30['fromVersion']);let _0x57e107;_0x376711['toVersion']===_0x124d30['toVersion']&&_0x376711['fromVersion']===_0x124d30['fromVersion']?(_0x57e107=!0x0,this['_preventResendingRevisionData'](_0x124d30)):_0x124d30['toVersion']===_0x3449f4&&_0x124d30['fromVersion']===_0x5dd0aa?_0x57e107=!0x1:(_0x376711['toVersion']===_0x3449f4&&_0x376711['fromVersion']===_0x5dd0aa||this['_fixRevision']({'revision':_0x376711,'from':_0x5dd0aa,'to':_0x3449f4}),_0x57e107=!0x0),_0x57e107&&(delete _0x124d30['fromVersion'],delete _0x124d30['toVersion'],delete _0x124d30['diffData'],delete _0x124d30['createdAt'],delete _0x124d30['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0x124d30),this['_preventResendingRevisionData'](_0x124d30);}else this['_revisionTracker']['addRevisionData'](_0x124d30);}const _0xd819cd=_0xd7dfb0['getRevisions']();_0xd819cd['reverse']();for(let _0x1a1b76=0x0;_0x1a1b76<_0xd819cd['length']-0x1;_0x1a1b76++){const _0x526882=_0xd819cd[_0x1a1b76],_0x1ca942=_0xd819cd[_0x1a1b76+0x1];if(_0x526882['fromVersion']<_0x1ca942['toVersion']){const _0x42d77e=_0x1ca942['toVersion'],_0x103c0e=Math['max'](_0x42d77e,_0x526882['toVersion']);this['_fixRevision']({'revision':_0x526882,'from':_0x42d77e,'to':_0x103c0e});}}}['_fixRevision']({revision:_0x5bffb4,from:_0x278a67,to:_0x131710}={}){const _0x1d0037=this['editor']['plugins']['get'](_0x2683a2),_0x41a89b=this['_revisionTracker']['buildRevisionData']({'revision':_0x5bffb4,'from':_0x278a67,'to':_0x131710});_0x41a89b['authors']=_0x41a89b['authorsIds']['map'](_0x26a6a0=>_0x1d0037['getUser'](_0x26a6a0)),_0x5bffb4['_update'](_0x41a89b);}['_preventResendingRevisionData'](_0x3af702){const _0x47d25f={};_0x47d25f['id']=_0x3af702['id'];for(const _0x52cdd4 of Object['keys'](_0x3af702))'id'!==_0x52cdd4&&(_0x47d25f[_0x52cdd4]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0x47d25f['id'],_0x47d25f,!0x0);}async['_fetchMissingUsers'](_0xffbec5){const _0x156003=this['editor']['plugins']['get'](_0x2683a2),{connection:_0x1fe0e7}=this['editor']['plugins']['get'](n),_0xa9a88d=new Set();for(const _0x3719ba of _0xffbec5){for(const _0x47b5c0 of _0x3719ba['authorsIds'])_0x430e71(_0x47b5c0);_0x3719ba['creatorId']&&_0x430e71(_0x3719ba['creatorId']);}if(0x0===_0xa9a88d['size'])return;const _0x1745d2=await ct['getMany'](_0x1fe0e7,Array['from'](_0xa9a88d));for(const _0x56aeca of _0x1745d2)_0x156003['getUser'](_0x56aeca['id'])||_0x156003['addUser'](_0x56aeca);function _0x430e71(_0x5f5c1c){_0x156003['getUser'](_0x5f5c1c)||_0xa9a88d['add'](_0x5f5c1c);}}}function q(_0x200a5f){return _0x200a5f['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0x200a5f['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x200a5f['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class dt extends _0x302365{static get['requires'](){return['RevisionHistory',c,a];}static get['pluginName'](){return'RealTimeCollaborativeRevisionHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class b extends _0x5a7c8c{['_collapseAt'];constructor(_0x331552,_0xded3=0x6){super(_0x331552);const _0x3092dd=this['bindTemplate'];this['set']('isHidden',!0x0),this['set']('usersCount',0x0),this['_collapseAt']=_0xded3,this['bind']('isHidden')['to'](this,'usersCount',_0x4f42d0=>_0x4f42d0<_0xded3),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item',_0x3092dd['if']('isHidden','ck-presence-list__counter--hidden')],'role':'listitem'},'children':[{'tag':'div','attributes':{'class':['ck','ck-presence-list__users-counter']},'children':[{'tag':'div','attributes':{'class':['ck','ck-presence-list__users-counter__text']},'children':[{'text':_0x3092dd['to']('usersCount',_0x1e6c67=>'+'+(_0x1e6c67-this['_collapseAt']+0x2)['toString']())}]}]}]});}}class is extends _0x5a7c8c{['items'];['keystrokes'];constructor(_0x2fa64b){super(_0x2fa64b);const _0x13732=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0x18f030(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0x13732['if']('hasPopup'),'aria-expanded':_0x13732['to']('isExpanded',_0x26e522=>this['hasPopup']&&String(_0x26e522)),'aria-label':_0x13732['to']('hasPopup',_0x39308a=>K(_0x2fa64b,_0x39308a?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0x13732['to']('hasPopup',_0xebe7db=>!!_0xebe7db&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items'],'on':{'mouseenter':_0x13732['to'](()=>this['fire']('presencelist:show')),'mouseleave':_0x13732['to'](_0x52f8c7=>{const _0x234d2f=_0x52f8c7,_0x3b5279=document['querySelector']('.ck-presence-list__dropdown-list'),_0x213c1c=document['querySelector']('.ck-balloon-panel_with-arrow');_0x3b5279?.['contains'](_0x234d2f['relatedTarget'])||_0x213c1c?.['contains'](_0x234d2f['relatedTarget'])||this['fire']('presencelist:hide');})}}),this['on']('change:hasPopup',(_0x54c14e,_0x5d8461,_0x23ad0c)=>{this['element']&&(_0x23ad0c?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 v extends _0x5a7c8c{['counterView'];['inlineListView'];constructor(_0x2a4e81,_0x263481=0x6){super(_0x2a4e81);const _0x531ad2=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new b(this['locale'],_0x263481),this['inlineListView']=new is(_0x2a4e81),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x501523 of this['inlineListView']['items'])_0x501523['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',_0x531ad2['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['inlineListView']]});}}class L extends _0x5a7c8c{['listWrapperView'];constructor(_0x452b1f,_0x3f7327){super(_0x452b1f);const _0x361adb=this['bindTemplate'];this['listWrapperView']=new ut(_0x452b1f,_0x3f7327),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':K(_0x452b1f,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']],'on':{'mouseleave':_0x361adb['to'](_0x2cadca=>{const _0x5e6822=_0x2cadca,_0x4b5751=document['querySelector']('.ck-presence-list__list'),_0x4dab55=document['querySelector']('.ck-balloon-panel_with-arrow');_0x4b5751?.['contains'](_0x5e6822['relatedTarget'])||_0x4dab55?.['contains'](_0x5e6822['relatedTarget'])||this['fire']('presencelist:hide');})}});}}class ut extends _0x1fbfd9{constructor(_0x91cd1c,_0xd6eaa6){super(_0x91cd1c);const _0x5b629d=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0xd6eaa6?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0x5b629d['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0x5b629d['to']('role'),'aria-label':_0x5b629d['to']('ariaLabel'),'aria-labelledby':_0x5b629d['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0x54f381['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0x53287b=this['element'];_0x53287b&&(this['_isScrollable']=Math['max'](_0x53287b['scrollHeight'],_0x53287b['clientHeight'])>0.8*window['innerHeight']);}}class j extends et{['userView'];constructor(_0x5b3ad4,_0x2c6196,_0x2bd954){super(_0x5b3ad4);const _0x45dfbe=this['bindTemplate'];this['userView']=new st(_0x5b3ad4,_0x2c6196);const _0x1cc54b={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0x2c6196['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0x2c6196['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x2c6196['color']['getBackgroundColorClass']()],'aria-hidden':'true'}}]};_0x2bd954&&(_0x1cc54b['tag']='button',_0x1cc54b['on']={'click':_0x45dfbe['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x1cc54b);}['focus'](){this['element']['focus']();}}class A extends _0x5a7c8c{['userView'];['markerView'];constructor(_0x1d01fb,_0x48b888,_0x70d4b0){super(_0x1d01fb);const _0x41c644=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new st(_0x1d01fb,_0x48b888),this['markerView']=new ot(_0x1d01fb,_0x48b888);const _0x17f78b=new it(_0x1d01fb);_0x17f78b['template']['tag']='span',_0x17f78b['text']=_0x48b888['name'];const _0x366ddb={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0x41c644['to']('isFocusable',_0x3d524=>!!_0x3d524&&0x0),'aria-labelledby':_0x17f78b['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0x41c644['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0x41c644['to']('hasTooltip',_0x1e3488=>!_0x1e3488),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0x17f78b]};_0x70d4b0&&(_0x366ddb['tag']='button',_0x366ddb['on']={'click':_0x41c644['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x366ddb);}}class ot extends _0x5a7c8c{constructor(_0x543475,_0x2eea32){super(_0x543475),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x2eea32['color']['getBackgroundColorClass']()],'aria-hidden':'true'}});}}const x={'collapseAt':0x6,'displayMe':!0x0};class r extends _0x2d811c{['currentDisplayedUsers'];['balloonPanelView'];['view'];['presenceDropdownView'];['_bodyCollection']=null;static get['pluginName'](){return'PresenceListUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x3f2369){super(_0x3f2369),this['context']['config']['define']('presenceList',x);const _0x261cfb=_0x3f2369['config']['get']('presenceList.collapseAt');if('number'!=typeof _0x261cfb)throw new _0x57f413('presencelist-collapseat-invalid-format',this);if(_0x261cfb<0x1)throw new _0x57f413('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](i)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0x5538c8(),this['balloonPanelView']=new _0x3b85f5(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get['requires'](){return[i];}['init'](){for(const _0x2314a5 of this['_allConnectedUsers'])this['_handleUserAdd'](_0x2314a5);this['listenTo'](this['_allConnectedUsers'],'add',(_0x43eb26,_0x4ea937)=>{this['_handleUserAdd'](_0x4ea937);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0x125e2a,_0x23b398)=>{this['_handleUserRemove'](_0x23b398);});}['_createView'](){const _0x14bb94=this['context'],_0x412a5a=new v(this['context']['locale'],this['context']['config']['get']('presenceList.collapseAt')),_0x1c7589=this['balloonPanelView'];if(!_0x2c0363(_0x14bb94['config']['get']('presenceList.container')))throw new _0x57f413('presencelist-missing-container',this);return _0x412a5a['counterView']['bind']('usersCount')['to'](this),_0x412a5a['bind']('isCollapsed')['to'](this,'usersCount',_0x2c09dd=>{const {collapseAt:_0x14f142}=_0x14bb94['config']['get']('presenceList'),_0x7dd8a9=_0x2c09dd>=_0x14f142;if(_0x7dd8a9&&!_0x412a5a['inlineListView']['items']['find'](_0x5a4f0c=>_0x5a4f0c instanceof b)){const _0x380d03=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['currentDisplayedUsers']['length']==_0x380d03&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](this['currentDisplayedUsers']['length']-0x1),_0x412a5a['inlineListView']['items']['add'](_0x412a5a['counterView']);}return _0x7dd8a9||this['hideDropdown'](),_0x7dd8a9;}),_0x412a5a['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0x2e327b=>{const _0x9d72cf=_0x14bb94['config']['get']('presenceList'),_0x5011d5=new A(_0x14bb94['locale'],_0x2e327b,!!_0x9d72cf['onClick']);return _0x5011d5['bind']('hasTooltip')['to'](_0x412a5a,'isCollapsed',_0x24c877=>!_0x24c877),_0x5011d5['bind']('isFocusable')['to'](_0x412a5a,'isCollapsed',_0x5400ff=>!_0x5400ff),_0x9d72cf['onClick']&&this['listenTo'](_0x5011d5,'execute',()=>{this['view']['isCollapsed']||_0x9d72cf['onClick'](_0x2e327b,_0x5011d5['element']);}),_0x5011d5;}),this['listenTo'](_0x412a5a['inlineListView'],'presencelist:show',()=>{this['view']['isCollapsed']&&this['showDropdown']();}),this['listenTo'](_0x412a5a['inlineListView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();}),_0x412a5a['inlineListView']['keystrokes']['set']('Enter',(_0x473b30,_0x5c7e63)=>{this['view']['isCollapsed']&&(this['showDropdown'](),_0x5c7e63());}),_0x412a5a['render'](),_0x1c7589['render'](),_0x58304e({'emitter':_0x412a5a,'activator':()=>_0x1c7589['isVisible'],'contextElements':[_0x1c7589['element'],_0x412a5a['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0x14bb94['config']['get']('presenceList.container')['appendChild'](_0x412a5a['element']),this['_bodyCollection']=new _0x565468(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_bodyCollection']['add'](this['balloonPanelView']),_0x412a5a;}['_handleUserAdd'](_0x4ae91a){if(!this['context']['config']['get']('presenceList.displayMe')&&_0x4ae91a['isMe'])return;const _0x59da95=this['context']['config']['get']('presenceList.collapseAt')-0x1;for(this['usersCount']++;this['currentDisplayedUsers']['length']>=_0x59da95-(this['view']['isCollapsed']?0x1:0x0)&&this['currentDisplayedUsers']['length']>0x1;)this['currentDisplayedUsers']['remove'](0x1);const _0x332a2d=_0x4ae91a['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0x4ae91a,_0x332a2d);}['_handleUserRemove'](_0x16539c){this['usersCount']--;const {collapseAt:_0xc2e38d}=this['context']['config']['get']('presenceList'),_0x4e2e6b=this['usersCount']>=_0xc2e38d;if(this['currentDisplayedUsers']['get'](_0x16539c['id']))this['currentDisplayedUsers']['remove'](_0x16539c['id']);else{if(_0x4e2e6b&&this['currentDisplayedUsers']['length']+0x1===_0xc2e38d-0x1)return;}if(this['currentDisplayedUsers']['length']+(_0x4e2e6b?0x1:0x0)<this['usersCount']){for(const _0x3a141e of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0x3a141e['id'])&&(this['currentDisplayedUsers']['add'](_0x3a141e,Math['min'](this['currentDisplayedUsers']['length']-(_0x4e2e6b?0x1:0x0),0x1)),this['currentDisplayedUsers']['length']+(_0x4e2e6b?0x1:0x0)===_0xc2e38d-0x1))return;}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0x490c84=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new L(this['context']['locale'],!!_0x490c84['onClick']),this['view']['inlineListView']['isExpanded']=!0x0,this['listenTo'](this['presenceDropdownView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();});const {listWrapperView:_0x17fde9}=this['presenceDropdownView'];_0x17fde9['items']['bindTo'](this['_allConnectedUsers'])['using'](_0x595bb9=>{if(!_0x490c84['displayMe']&&_0x595bb9['isMe'])return null;const _0x13889a=new j(this['context']['locale'],_0x595bb9,!!_0x490c84['onClick']);return _0x490c84['onClick']&&this['listenTo'](_0x13889a,'execute',()=>{_0x490c84['onClick'](_0x595bb9,_0x13889a['element']);}),_0x13889a;}),this['balloonPanelView']['content']['add'](this['presenceDropdownView']),this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element']}),_0x17fde9['focus'](),_0x17fde9['checkIfScrollable']();const _0x1f62d1=(_0x51f8a7,_0x3edff7)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0x3edff7();};_0x17fde9['keystrokes']['set']('Esc',_0x1f62d1),_0x17fde9['keystrokes']['set']('Shift+Tab',_0x1f62d1),_0x17fde9['keystrokes']['set']('Tab',(_0x5d24d4,_0x47db34)=>{!function(_0x1e47e9){const _0x1ebb66=['a','button','input','select','textarea','[tabindex]','[contenteditable]']['map'](_0x1334a9=>_0x1334a9+':not([disabled]):not([tabindex=\x22-1\x22])')['join'](','),_0x5e0241=[...document['body']['querySelectorAll'](_0x1ebb66)]['filter'](_0x454950=>_0x454950===document['activeElement']||_0x454950['offsetWidth']+_0x454950['offsetHeight']>0x0)['sort']((_0x1a3b83,_0x239fc8)=>(_0x1a3b83['tabIndex']||0x0)-(_0x239fc8['tabIndex']||0x0)),_0xc1369b=_0x5e0241['indexOf'](_0x1e47e9),_0x350c5b=_0x5e0241[(_0xc1369b+0x1)%_0x5e0241['length']];_0x350c5b&&_0x350c5b['focus']();}(this['view']['element']),this['hideDropdown'](),_0x47db34();}),_0x17fde9['focusTracker']['add'](this['view']['element']),_0x17fde9['focusTracker']['on']('change:isFocused',(_0x36af27,_0x2d556b,_0x2e8c3b)=>{_0x2e8c3b||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 ft extends _0x2d811c{static get['requires'](){return[i,r];}static get['pluginName'](){return'PresenceList';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}export{s as CloudServicesCommentsAdapter,c as CloudServicesRevisionHistoryAdapter,m as CloudServicesTrackChangesAdapter,ft as PresenceList,r as PresenceListUI,l as RealTimeCollaborationClient,g as RealTimeCollaborativeComments,a as RealTimeCollaborativeEditing,dt as RealTimeCollaborativeRevisionHistory,lt as RealTimeCollaborativeTrackChanges,i as Sessions,n as WebSocketGateway};
|
|
23
|
+
import{ContextPlugin as _0x34f6b7,Plugin as _0x4f70c8,PendingActions as _0x1c56c5,Context as _0x64503e}from'@ckeditor/ckeditor5-core/dist/index.js';import{DomEmitterMixin as _0x4f9f74,CKEditorError as _0x1b863e,Collection as _0x500cda,global as _0x5b5001,version as nt,uid as _0x58108b,KeystrokeHandler as _0x490620}from'@ckeditor/ckeditor5-utils/dist/index.js';import{Notification as _0x5325f5,View as _0x4c7c82,ListView as _0x4e50d2,ListItemView as rt,LabelView as ot,BalloonPanelView as _0x501a5c,clickOutsideHandler as _0xb632d8,BodyCollection as _0x262a4c}from'@ckeditor/ckeditor5-ui/dist/index.js';import{ModelLiveRange as _0x45431c,History as _0x2a2a2f,NoOperation as _0x524ede,InsertOperation as _0x5133d3,MarkerOperation as _0x5e6631,RootAttributeOperation as _0x742914,transformOperationSets as _0x1eddcf,OperationFactory as _0x4a12de}from'@ckeditor/ckeditor5-engine/dist/index.js';import{WebSocketGateway as ht,WEB_SOCKET_GATEWAY_STATES as te,CollaborativeEditingService as _0x539b55,User as lt,CommentsService as _0x1be594,TrackChangesService as et,RevisionHistoryService as it,EditorService as tt}from'@ckeditor/ckeditor-cloud-services-collaboration/dist/index.js';import{Users as _0x12033b,UserView as ct}from'ckeditor5-collaboration/dist/index.js';import{Compressor as _0xeae0b}from'@ckeditor/ckeditor5-operations-compressor/dist/index.js';import{isElement as _0x189cec}from'es-toolkit/compat';class n extends _0x34f6b7{static ['WebSocketGateway']=/* #__PURE__ -- @preserve */
|
|
24
|
+
((()=>ht)());static ['initialReconnectionInterval']=0x3e8;['connection'];['_reconnectionStack'];['_shouldPluginsReconnect'];['_domEmitter'];static get['requires'](){return['CloudServices',_0x5325f5];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x251b56){super(_0x251b56),this['set']('state',te['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=new(_0x4f9f74())();}['init'](){const _0x2cd1cc=this['context'],_0x5c4914=_0x2cd1cc['plugins']['get']('CloudServices'),_0x594054=_0x2cd1cc['plugins']['get'](_0x5325f5);if(!_0x5c4914['token'])throw new _0x1b863e('websocketgateway-missing-token',this);if(!_0x5c4914['webSocketUrl'])throw new _0x1b863e('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),n['WebSocketGateway']['connect'](_0x5c4914['token'],_0x5c4914['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0x267462=>{if(this['connection']=_0x267462,this['bind']('state')['to'](_0x267462,'state',this,'_isBrowserOffline',(_0x55e67d,_0x44ece1)=>('connected'!==_0x55e67d&&(this['_shouldPluginsReconnect']=!0x0),_0x44ece1||_0x55e67d!==te['CONNECTED']?te['DISCONNECTED']:this['state']==te['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),te['CONNECTING']):te['CONNECTED'])),this['connection']['on']('error',(_0x38cd71,_0x6fca02)=>{if('limitExceeded'!==_0x6fca02['code'])throw console['error'](_0x6fca02),new _0x1b863e('cloudservices-init',null,{'originalError':_0x6fca02});_0x594054['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'});}),!_0x267462['me'])return new Promise(_0x580a9a=>_0x267462['on']('change:me',_0x580a9a));})['catch'](_0x350be0=>{throw console['error'](_0x350be0),new _0x1b863e('cloudservices-init',null,{'originalError':_0x350be0});});}['addToReconnectionStack'](_0x23b311){if('function'!=typeof _0x23b311['reconnect'])throw new _0x1b863e('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0x23b311))throw new _0x1b863e('websocketgateway-plugin-already-registered',this,{'name':_0x23b311['constructor']['pluginName']});this['_reconnectionStack']['add'](_0x23b311);}['removeFromReconnectionStack'](_0x22fcdd){this['_reconnectionStack']['delete'](_0x22fcdd);}['isInReconnectionStack'](_0x332dc8){return this['_reconnectionStack']['has'](_0x332dc8);}['_reconnect'](){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0xf5b332=>_0xf5b332['reconnect']())))['then'](()=>this['state']=te['CONNECTED'])['catch'](_0xd67e5=>{throw console['error'](_0xd67e5),new _0x1b863e('cloudservices-reconnection-error',this['context']);});}['disconnect'](){this['connection']&&this['connection']['disconnect'](),this['state']=te['DISCONNECTED'],this['_domEmitter']['stopListening']();}['destroy'](){this['disconnect'](),super['destroy']();}}class i extends _0x34f6b7{['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[n,_0x12033b];}constructor(_0x2e1862){super(_0x2e1862),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0x500cda(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x12033b);}['init'](){const _0x1a7628=this['context']['plugins']['get'](n);this['listenTo'](_0x1a7628,'change:state',(_0x593244,_0x520800,_0x791451)=>{if('connected'!==_0x791451)this['channelSessions']['forEach'](_0x25765f=>_0x25765f['clear']()),this['channelConnectedUsers']['forEach'](_0x4ef859=>_0x4ef859['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x16dc1f,_0x45b651]of this['_registeredSessions'])for(const _0x196ed5 of _0x45b651)this['_handleSessionAdd'](_0x16dc1f,_0x196ed5);}}),this['_createUser'](_0x1a7628['connection']['me'],!0x0);}['register'](_0x265b69,_0x3a3e8e){if(this['_registeredSessions']['has'](_0x265b69))throw new _0x1b863e('sessions-register-already-registered',null,{'channelId':_0x265b69});this['_registeredSessions']['set'](_0x265b69,_0x3a3e8e),this['channelSessions']['set'](_0x265b69,new _0x500cda()),this['channelConnectedUsers']['set'](_0x265b69,new _0x500cda()),this['listenTo'](_0x3a3e8e,'add',(_0x1f2300,_0x19c4d8)=>this['_handleSessionAdd'](_0x265b69,_0x19c4d8)),this['listenTo'](_0x3a3e8e,'remove',(_0x3df99c,_0x325cc8)=>this['_handleSessionRemove'](_0x265b69,_0x325cc8));for(const _0x54c929 of _0x3a3e8e)this['_handleSessionAdd'](_0x265b69,_0x54c929);}['unregister'](_0x270a57){if(!this['_registeredSessions']['has'](_0x270a57))throw new _0x1b863e('sessions-unregister-not-exist',null,{'channelId':_0x270a57});const _0x2d3cf6=this['_registeredSessions']['get'](_0x270a57);this['stopListening'](_0x2d3cf6);for(const _0x1fc81b of _0x2d3cf6)'connected'===this['context']['plugins']['get'](n)['state']&&this['_handleSessionRemove'](_0x270a57,_0x1fc81b);this['_registeredSessions']['delete'](_0x270a57),this['channelSessions']['delete'](_0x270a57),this['channelConnectedUsers']['delete'](_0x270a57);}get['mySessionId'](){return this['context']['plugins']['get'](n)['connection']['sessionId'];}['getUserBySessionId'](_0x36289c){for(const _0x333e9f of this['channelSessions']['values']())for(const _0x453e04 of _0x333e9f)if(_0x453e04['id']===_0x36289c)return _0x453e04['user'];}['getUserSessions'](_0x179e6b,_0x4dc16d){const _0x277012=_0x4dc16d?[this['channelSessions']['get'](_0x4dc16d)]:this['channelSessions']['values'](),_0x5e5a1d=new Set();for(const _0x451fed of _0x277012)for(const _0x2cfc3f of _0x451fed)_0x2cfc3f['user']['id']===_0x179e6b['id']&&_0x5e5a1d['add'](_0x2cfc3f['id']);return _0x5e5a1d;}['getUserRole'](_0x228fad){for(const _0x5629dd of this['channelSessions']['values']())for(const _0x57616d of _0x5629dd)if(_0x57616d['user']===_0x228fad)return _0x57616d['role'];}['_handleSessionAdd'](_0x21fd22,_0x14ee31){if('connected'!==this['context']['plugins']['get'](n)['state'])return;const _0x34a8b2=_0x14ee31['user'],_0x367a46=this['_users']['getUser'](_0x34a8b2['id'])||this['_createUser'](_0x34a8b2),_0xaa36a6=Object['assign']({},_0x14ee31,{'user':_0x367a46});this['channelSessions']['get'](_0x21fd22)['add'](_0xaa36a6);const _0x457c29=this['channelConnectedUsers']['get'](_0x21fd22);_0x457c29['has'](_0x367a46['id'])||_0x457c29['add'](_0x367a46),this['allConnectedUsers']['has'](_0x367a46['id'])||this['allConnectedUsers']['add'](_0x367a46,_0x367a46['isMe']?0x0:void 0x0),this['fire']('sessionAdd:'+_0x21fd22,{'channelId':_0x21fd22,'session':_0xaa36a6});}['_handleSessionRemove'](_0x1b37d4,_0x44e4b7){if('connected'!==this['context']['plugins']['get'](n)['state'])return;const _0x28f5bd=this['channelConnectedUsers']['get'](_0x1b37d4),_0x513cb0=_0x44e4b7['user'];_0x513cb0['id']&&(this['channelSessions']['get'](_0x1b37d4)['remove'](_0x44e4b7['id']),_0x28f5bd['has'](_0x513cb0['id'])&&!this['getUserSessions'](_0x513cb0,_0x1b37d4)['size']&&_0x28f5bd['remove'](_0x513cb0['id']),this['allConnectedUsers']['get'](_0x513cb0['id'])&&!this['getUserSessions'](_0x513cb0)['size']&&this['allConnectedUsers']['remove'](_0x513cb0['id']));}['_createUser'](_0xede6,_0x3ebb1f){const _0x4a3c14=this['_users']['addUser'](_0xede6);return _0x3ebb1f&&this['_users']['defineMe'](_0xede6['id']),_0x4a3c14['orderNumber']=this['_uniqueUsersCount']++,_0x4a3c14;}}class H extends _0x4f70c8{['_domEmitter']=new(_0x4f9f74())();static get['requires'](){return[i];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x5e2b0e=this['editor'],_0x55b1f0=_0x5e2b0e['plugins']['get'](i);_0x5e2b0e['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x287b91,{writer:_0x1c94e9})=>function(_0x2105c8,_0x1106eb,_0x4c13bb,_0x2d25e9){const _0x4b3069=_0x2105c8['markerName']['split'](':')[0x2],_0x12c991=_0x4c13bb['getUserBySessionId'](_0x4b3069);if(!_0x12c991||_0x4b3069===_0x4c13bb['mySessionId'])return;if(!_0x2d25e9['model']['schema']['checkChild'](_0x2105c8['markerRange']['start'],'$text'))return;const _0x5c0f49={'class':'ck-user__marker\x20'+_0x12c991['color']['getMarkerClass'](),'data-name':_0x12c991['name'],'data-session-id':_0x4b3069},_0x223ee3=_0x2d25e9['model']['markers']['get'](_0x2105c8['markerName']),_0x9e83a5=_0x223ee3['getStart'](),_0x18cc87=_0x9e83a5['nodeAfter'],_0xc9c9c2=_0x2d25e9['model']['schema'];if(_0x18cc87&&_0xc9c9c2['isObject'](_0x18cc87)&&_0xc9c9c2['isInline'](_0x18cc87)&&!_0x2d25e9['model']['markers']['get']('user:range:'+_0x4b3069)['getRange']()['isCollapsed'])return;const _0x4bff40=_0x9e83a5['parent'];return _0x2d25e9['model']['schema']['isLimit'](_0x4bff40)&&!_0x2d25e9['model']['hasContent'](_0x4bff40)&&(_0x5c0f49['contenteditable']=!0x1),function(_0x2f4588,_0x4bd5d5,_0x3be432){const _0x1f3c1b=_0x2f4588['createUIElement']('span',_0x4bd5d5);return _0x2f4588['setCustomProperty']('userPositionMarker',!0x0,_0x1f3c1b),_0x1f3c1b['render']=function(_0x320c9d){const _0x6f4086=this['toDomElement'](_0x320c9d),_0x49996b=document['createElement']('span');return _0x49996b['classList']['add']('ck-user__marker-tooltip'),_0x49996b['setAttribute']('contenteditable','false'),_0x49996b['setAttribute']('spellcheck','false'),_0x49996b['textContent']=_0x3be432['name'],_0x6f4086['innerHTML']='<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span>'+_0x49996b['outerHTML']+'',_0x6f4086['addEventListener']('mouseenter',()=>{_0x6f4086['classList']['add']('ck-user__marker_hovered');}),_0x6f4086['addEventListener']('mouseleave',()=>{_0x6f4086['classList']['remove']('ck-user__marker_hovered');}),_0x6f4086;},_0x1f3c1b['isSimilar']=function(_0x32b524){return!(!this['getCustomProperty']('userPositionMarker')||!_0x32b524['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0x32b524['getAttribute']('data-session-id'));},_0x1f3c1b;}(_0x1106eb,_0x5c0f49,_0x12c991);}(_0x287b91,_0x1c94e9,_0x55b1f0,_0x5e2b0e)}),_0x5e2b0e['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0x270ccc=>function(_0x5eadaf,_0x522f40){const _0x553cb0=_0x5eadaf['markerName']['split'](':')[0x2];if(_0x553cb0===_0x522f40['mySessionId'])return null;const _0x4756db=_0x522f40['getUserBySessionId'](_0x553cb0);if(!_0x4756db)return{'id':_0x553cb0,'classes':[]};return{'id':_0x553cb0,'classes':['ck-user__selection',_0x4756db['color']['getSelectionClass']()],'attributes':{'data-session-id':_0x553cb0},'priority':0x7d0+_0x4756db['orderNumber']};}(_0x270ccc,_0x55b1f0)}),function(_0x4c3137){const _0x226d45=_0x4c3137['model'],_0xab0419=new Map(),_0x4ae566=_0x4c3137['plugins']['get'](i);_0x226d45['markers']['on']('update:user:range',(_0x334091,_0x5e376e,_0x475a2e,_0x2aacd9)=>{if(!_0x2aacd9&&_0xab0419['get'](_0x5e376e['name']))return _0xab0419['get'](_0x5e376e['name'])['detach'](),void _0xab0419['delete'](_0x5e376e['name']);const _0x17667b=_0x5e376e['name']['split'](':')[0x2];if(_0x17667b===_0x4ae566['mySessionId'])return;const _0x495c0e='user:position:'+_0x17667b;_0x226d45['markers']['has'](_0x495c0e)&&_0x4c3137['editing']['reconvertMarker'](_0x495c0e),_0x5e376e['on']('change:range',(_0x562858,_0x5c2ddd,_0x5445cb)=>{if('$graveyard'!=_0x5c2ddd['root']['rootName']&&'$graveyard'==_0x5e376e['getRange']()['root']['rootName']&&!_0xab0419['has'](_0x5e376e['name'])){const _0x5bf7cb=_0x226d45['schema']['getNearestSelectionRange'](_0x5445cb['deletionPosition']);if(_0x5bf7cb){const _0x5f1eb5=_0x45431c['fromRange'](_0x5bf7cb);_0xab0419['set'](_0x5e376e['name'],_0x5f1eb5),_0x5f1eb5['on']('change:range',(_0x22f635,_0x164e74,_0x575a9f)=>{if('$graveyard'==_0x5f1eb5['root']['rootName']){const _0x13d839=_0x226d45['schema']['getNearestSelectionRange'](_0x575a9f['deletionPosition']);_0x13d839?(_0x5f1eb5['start']=_0x13d839['start'],_0x5f1eb5['end']=_0x13d839['end']):(_0xab0419['delete'](_0x5e376e['name']),_0x5f1eb5['detach']());}});}}});}),_0x226d45['document']['on']('change',()=>{_0xab0419['size']>0x0&&_0x226d45['enqueueChange']({'isUndoable':!0x1},_0xe161f4=>{for(const [_0x55bc4b,_0x1ceed7]of _0xab0419)'$graveyard'==_0x226d45['markers']['get'](_0x55bc4b)['getRange']()['root']['rootName']&&(Z(_0x55bc4b['split'](':')[0x2],_0x1ceed7['toRange'](),_0x226d45,_0xe161f4),_0x1ceed7['detach']());_0xab0419['clear']();});});}(_0x5e2b0e),this['_domEmitter']['listenTo'](_0x5b5001['document'],'keydown',(_0x40ae2f,{key:_0x4323a2})=>{'Escape'===_0x4323a2&&function(_0x4c9948){_0x4c9948['editing']['view']['change'](_0x384bf0=>{for(const _0x4ea4bb of _0x4c9948['model']['markers']){if(!_0x4ea4bb['name']['startsWith']('user:position'))continue;const _0x175e46=_0x4c9948['editing']['mapper']['markerNameToElements'](_0x4ea4bb['name']);if(_0x175e46){for(const _0x27aa8a of _0x175e46)_0x384bf0['removeClass']('ck-user__marker_hovered',_0x27aa8a);}}});}(_0x5e2b0e);},{'useCapture':!0x0});}['afterInit'](){const _0x1e3955=this['editor'],_0x549ab9=_0x1e3955['commands']['get']('undo');_0x549ab9&&_0x1e3955['model']['on']('applyOperation',(_0x525341,_0x1daab6)=>{const _0x38d55c=_0x1daab6[0x0];if(!_0x38d55c['isDocumentOperation'])return;if('marker'!=_0x38d55c['type']||!_0x38d55c['name']['startsWith']('user:'))return;const _0x5bd792=_0x38d55c['batch'];_0x549ab9['_createdBatches']['has'](_0x5bd792)&&(_0x38d55c['newRange']=_0x38d55c['oldRange']?_0x1e3955['model']['createRange'](_0x38d55c['oldRange']['start'],_0x38d55c['oldRange']['end']):null);},{'priority':'highest'});}['destroy'](){return this['_domEmitter']['stopListening'](),super['destroy']();}['createUserMarkerOperations'](){const _0x1cd4ae=this['editor'],_0x50ccb4=_0x1cd4ae['model']['document'],_0x171580=_0x1cd4ae['plugins']['get'](i);_0x1cd4ae['model']['enqueueChange']({'isUndoable':!0x1},_0x4b73e0=>{const _0xb29e8e='user:range:'+_0x171580['mySessionId'],_0x365436='user:position:'+_0x171580['mySessionId'],_0x307c5a=_0x1cd4ae['model']['markers']['has'](_0xb29e8e);_0x1cd4ae['editing']['view']['hasDomSelection']?Z(_0x171580['mySessionId'],_0x50ccb4['selection']['getFirstRange'](),_0x1cd4ae['model'],_0x4b73e0):_0x307c5a&&(_0x4b73e0['removeMarker'](_0xb29e8e),_0x4b73e0['removeMarker'](_0x365436));});}}function Z(_0x5495a9,_0x3cc9a7,_0x381da6,_0x40ff9a){const _0x1deff2='user:range:'+_0x5495a9,_0x4331bd='user:position:'+_0x5495a9,_0x3c7c85=_0x3cc9a7['getContainedElement']();let _0x5766f1=_0x3cc9a7['start'];if(_0x3c7c85&&_0x3c7c85['is']('element','tableCell')){const _0x5169b0=function(_0x3321f7,_0x544f41){for(const _0x2b3cf4 of _0x3321f7['getPositions']())if(_0x544f41['schema']['checkChild'](_0x2b3cf4,'$text'))return _0x2b3cf4;}(_0x3cc9a7,_0x381da6);_0x5169b0&&(_0x5766f1=_0x5169b0,_0x3cc9a7=_0x40ff9a['createRange'](_0x5766f1));}const _0xcaf135=_0x40ff9a['createRange'](_0x5766f1);_0x381da6['markers']['has'](_0x1deff2)?(_0x40ff9a['updateMarker'](_0x1deff2,{'range':_0x3cc9a7}),_0x40ff9a['updateMarker'](_0x4331bd,{'range':_0xcaf135})):(_0x40ff9a['addMarker'](_0x1deff2,{'range':_0x3cc9a7,'usingOperation':!0x0}),_0x40ff9a['addMarker'](_0x4331bd,{'range':_0xcaf135,'usingOperation':!0x0}));}function V(_0xdda00b,_0x3456e1,_0x2e06f2){const _0x46c17c=_0xdda00b['t'],t=_0xdda00b['t'];switch(_0x3456e1){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 _0x46c17c({'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'},_0x2e06f2);default:return'';}}let G=0x1;class l extends _0x4f70c8{static ['CollaborativeEditingService']=/* #__PURE__ -- @preserve */
|
|
25
|
+
((()=>_0x539b55)());['_offset'];['sessionId'];['serverHistory'];['_channelId'];['_service'];['_document'];['_compressor'];['_bufferedOperations'];['_knownOperations'];['_knownRootNames'];['_pendingAction'];['_hasSelectionChanged'];['_sendBufferedOperationsDelayId'];['_baseBufferDelay'];['_currentBufferDelay'];['_lastSyncedOperationId'];['_disconnectionOperations'];['_operationIdentifier'];static get['requires'](){return[n,i,H,_0x1c56c5,_0x12033b,_0x5325f5];}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 _0x4a3aa1=this['serverHistory']['getOperations']();for(let _0x5950b6=_0x4a3aa1['length']-0x1;_0x5950b6>=0x0;_0x5950b6--){const _0xc60892=_0x4a3aa1[_0x5950b6];if(!this['_disconnectionOperations']['has'](_0xc60892))return _0xc60892['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0xd8641a){if(super(_0xd8641a),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x2a2a2f(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0x1b863e('collaboration-missing-channelid',this);const _0x21da09=_0xd8641a['config']['get']('cloudServices.bundleVersion')||nt;this['_service']=new l['CollaborativeEditingService'](_0x21da09,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0xeae0b(),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 J(this['_disconnectionOperations']);}['init'](){const _0x2d59e4=this['editor'],_0x1aa3e1=_0x2d59e4['plugins']['get'](_0x12033b),_0x44aff0=_0x2d59e4['plugins']['get'](n);this['listenTo'](_0x1aa3e1,'getOperationAuthor',(_0xad1ee7,_0x2e0a36)=>{const _0x28dd8b=_0x2e0a36[0x0];_0x28dd8b['_authorId']&&(_0xad1ee7['return']=_0x1aa3e1['getUser'](_0x28dd8b['_authorId']),_0xad1ee7['stop']()),null===_0x28dd8b['_authorId']&&(_0xad1ee7['return']=null,_0xad1ee7['stop']());},{'priority':'high'}),this['listenTo'](_0x2d59e4['model']['document']['selection'],'change:range',(_0x3641b1,_0x1590a6)=>{_0x1590a6['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x2d59e4['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x2d59e4['model']['on']('applyOperation',(_0xcf763e,_0x50963a)=>{const _0x566ff9=_0x50963a[0x0];_0x566ff9['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0x566ff9),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['bind']('_isEditingAllowed')['to'](_0x44aff0,'state',this,'_hasSynchronizationProblem',(_0x12d39a,_0x4bbe56)=>'connected'===_0x12d39a&&!_0x4bbe56),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x2d59e4['disableReadOnlyMode']('rtc-offline'):_0x2d59e4['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x2d59e4['disableReadOnlyMode']('rtc-offline'):_0x2d59e4['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async['reconnect'](){const _0x42bb64=this['editor']['plugins']['get'](i),_0x531e16=this['editor']['plugins']['get'](n);try{this['_isPendingUpdate']=!0x0,_0x42bb64['unregister'](this['_channelId']);const _0x59f538=await this['_service']['reconnect'](_0x531e16['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0x59f538)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x40dc36=await this['_service']['getConnectedSessions']();_0x42bb64['register'](this['_channelId'],_0x40dc36),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x1dba84){if(function(_0x32f22e){return'404'===_0x32f22e['code'];}(_0x1dba84)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0x520cf3){return'409'===_0x520cf3['code'];}(_0x1dba84)){const _0x429af4=V(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'](_0x429af4);}else{if(!(_0x1dba84 instanceof $))throw _0x1dba84;this['_handleReconnectionError']();}}}}['destroy'](){const _0x202e09=this['editor']['plugins']['get'](n),_0x43e7b3=this['editor']['plugins']['get'](i);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x43e7b3['channelSessions']['has'](this['_channelId'])&&_0x43e7b3['unregister'](this['_channelId']),_0x202e09['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async['_handleReconnectionResponse'](_0xb072e1){if(this['sessionId']!==_0xb072e1['sessionId']&&this['_lastSyncedOperationId']!==_0xb072e1['lastOperationId'])throw new $();return this['sessionId']=_0xb072e1['sessionId'],this['_handleServerResponse']([],{..._0xb072e1,'wereChangesApplied':!0x1,'data':_0xb072e1['data']},'reconnect');}async['_connectService'](_0x2806a3,_0x7b4239=!0x1){const {connection:_0x5eb67f}=this['editor']['plugins']['get'](n);l['CollaborativeEditingService']['getConnectedSessions'](_0x5eb67f,this['_channelId'])['then'](_0x524a5b=>this['_initSessionsHandling'](_0x524a5b))['catch'](_0x3ec87c=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x3ec87c);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x5e43ce,_0x5b70da)=>{this['_crash']('realtimecollaborationclient-init-service-internal-error',_0x5b70da);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_isConnected']=!0x1;});const _0x35d078=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x2806a3);this['_isPendingUpdate']=!0x0;const _0x2a5928=await this['_service']['connect'](_0x5eb67f,this['_compressOperations'](_0x2806a3),_0x35d078);if(this['sessionId']=_0x2a5928['sessionId'],_0x7b4239){if(!_0x2a5928['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x2a5928['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0x2806a3,_0x2a5928,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x2a5928,_0x2806a3);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}['_handleSendingSelectionMarkers'](){const _0x93c3a7=this['editor']['plugins']['get'](i),_0xbce21a=this['editor']['plugins']['get'](H),_0x101378=_0x93c3a7['channelSessions']['get'](this['_channelId']);_0x101378&&_0x101378['length']>0x1?_0xbce21a['createUserMarkerOperations']():this['listenTo'](_0x93c3a7,'sessionAdd:'+this['_channelId'],()=>{0x2===_0x93c3a7['channelSessions']['get'](this['_channelId'])['length']&&_0xbce21a['createUserMarkerOperations']();});}async['_handleReceivedOperations'](_0x1fe283,_0x35363a,_0x343720,_0x2c876e){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x35363a){const _0x441c4a=this['_decompressOperations'](_0x343720,_0x2c876e);await this['_fetchMissingUsers'](_0x441c4a),this['_handleExternalOperations'](_0x441c4a,_0x35363a,_0x343720['lastOperationId'])||this['_crash']('realtimecollaborationclient-init-service-incorrect-server-operation');}}async['_connectAfterSessionHasBeenFlushed'](){this['_disconnectService']();const {locale:_0x35e80a}=this['editor'];let _0x161ed5;try{_0x161ed5=await this['_service']['getDocumentDetails']();}catch{const _0x25fe82=V(_0x35e80a,'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'](_0x25fe82);}const _0x330345=_0x161ed5['currentDocumentSession']||_0x161ed5['lastDocumentSession'];if(this['_lastSyncedOperationId']!==_0x330345['lastOperationId']){const _0x373d24=V(_0x35e80a,'The\x20last\x20saved\x20version\x20of\x20the\x20document\x20does\x20not\x20match\x20the\x20local\x20version.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.');return void this['_handleReconnectionError'](_0x373d24);}await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);}['_disconnectService'](){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['stopListening'](this['_service']);}['_initSessionsHandling'](_0x24df5e){const _0x4b5394=this['editor']['plugins']['get'](i);this['listenTo'](_0x4b5394,'sessionAdd:'+this['_channelId'],(_0x494e8b,{session:_0x25c386})=>{if(_0x25c386['id']===_0x4b5394['mySessionId']){_0x494e8b['off']();const _0x2a66ea=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0x181b54=_0x25c386['permissions'];_0x2a66ea&&_0x2a66ea['isEnabled']&&(_0x181b54=_0x181b54['filter'](_0xd050a4=>'document:write'!==_0xd050a4)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0x181b54,this['_channelId']);}}),_0x4b5394['register'](this['_channelId'],_0x24df5e);}['_initThrowingOnDataSet'](){const _0x4cc445=this['editor']['data']['set'];this['editor']['data']['set']=(..._0x56e778)=>{if(!_0x56e778[_0x56e778['length']-0x1]['suppressErrorInCollaboration'])throw new _0x1b863e('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x4cc445['apply'](this['editor']['data'],_0x56e778);};}['_setUpDataInit'](){this['editor']['data']['on']('init',(_0x4bac33,[_0x1c07fb])=>{if(this['_document']['version'])throw new _0x1b863e('realtimecollaborationclient-init-document-already-initialized',this);_0x4bac33['stop'](),this['_setPendingAction']();const _0x209386=this['editor']['config']['get']('rootsAttributes'),_0x507006=this['_getOperationsFromInitData'](_0x1c07fb,_0x209386);0x0==_0x507006['length']&&_0x507006['push'](new _0x524ede(0x0)),_0x4bac33['return']=this['_connectService'](_0x507006)['then'](()=>{this['editor']['plugins']['get'](n)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x5a8054=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x5a8054))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x497f1c,[_0x352163,_0x208f25])=>{_0x497f1c['stop']();const _0x20b87f=this['editor']['model']['document']['getRoot'](_0x352163);if(!this['_knownRootNames']['has'](_0x352163)){const _0x3ec045=_0x208f25&&_0x208f25['data']?_0x208f25['data']:'',_0x403006=_0x208f25&&_0x208f25['attributes']?_0x208f25['attributes']:{};await this['_loadRoot'](_0x352163,_0x3ec045,_0x403006);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0x20b87f['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0x20b87f);});},{'priority':'high'});}async['_fetchMissingUsers'](_0x5bc48c){const _0x52b18b=this['editor']['plugins']['get'](_0x12033b),{connection:_0x714c16}=this['editor']['plugins']['get'](n),_0x62ae5e=new Set();for(const _0x3e2415 of _0x5bc48c){const _0x3a9475=_0x3e2415['_authorId'];_0x3a9475&&!_0x52b18b['getUser'](_0x3a9475)&&_0x62ae5e['add'](_0x3a9475);}if(0x0===_0x62ae5e['size'])return;const _0x40cb84=await lt['getMany'](_0x714c16,Array['from'](_0x62ae5e));for(const _0x28dffc of _0x40cb84)_0x52b18b['getUser'](_0x28dffc['id'])||_0x52b18b['addUser'](_0x28dffc);}['_getOperationsFromInitData'](_0x5982e2,_0x4801dc={}){const _0x2f28b4=this['editor']['model'],_0x538cb7=[];let _0x1b3c71=0x0;const _0x4f0f5a='string'==typeof _0x5982e2?{'main':_0x5982e2}:_0x5982e2;for(const _0x571550 of Object['keys'](_0x4f0f5a)){if(!this['_document']['roots']['has'](_0x571550))throw new _0x1b863e('realtimecollaborationclient-init-non-existent-root',this);const _0x4d63a1=this['editor']['data']['parse'](_0x4f0f5a[_0x571550]),_0x490279=this['_document']['getRoot'](_0x571550),_0x1398e6=new _0x5133d3(_0x2f28b4['createPositionAt'](_0x490279,0x0),_0x4d63a1,_0x1b3c71++);_0x538cb7['push'](_0x1398e6);for(const [_0x2789c0,_0x570a54]of _0x4d63a1['markers']){const _0x241243=_0x2f28b4['createRange'](_0x2f28b4['createPositionFromPath'](_0x490279,_0x570a54['start']['path']['slice']()),_0x2f28b4['createPositionFromPath'](_0x490279,_0x570a54['end']['path']['slice']())),_0x30fc9b=new _0x5e6631(_0x2789c0,null,_0x241243,_0x2f28b4['markers'],!0x0,_0x1b3c71++);_0x538cb7['push'](_0x30fc9b);}}if(_0x4801dc)for(const [_0x1172e7,_0x4d67c4]of Object['entries'](_0x4801dc)){const _0x4ef2ea=_0x2f28b4['document']['getRoot'](_0x1172e7);if(!_0x4ef2ea)throw new _0x1b863e('multi-root-editor-root-attributes-no-root',null);for(const [_0x2eed80,_0x23bbad]of Object['entries'](_0x4d67c4))if(null!==_0x23bbad){const _0x4536e9=new _0x742914(_0x4ef2ea,_0x2eed80,null,_0x23bbad,_0x1b3c71++);_0x538cb7['push'](_0x4536e9);}}return _0x538cb7;}async['_loadRoot'](_0x2db01a,_0x462e06,_0x12b71f){this['_getOperationsFromInitData']({[_0x2db01a]:_0x462e06},{[_0x2db01a]:_0x12b71f})['forEach']((_0x2dd573,_0x42c18a)=>{_0x2dd573['baseVersion']=this['_document']['version']+_0x42c18a,_0x2dd573['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x2dd573);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async['_handleInitialConnectionData'](_0x2467b2,_0x396d17){let _0x1b91da;this['_offset']=_0x2467b2['offset'];const _0x5d98fe=_0x2467b2['wereChangesApplied']&&!_0x2467b2['initData'],_0x3313ca=_0x5d98fe?0x0:_0x2467b2['data']['baseVersion'];if(_0x396d17['forEach'](_0x50543c=>{_0x50543c['_isInit']=!0x0,_0x50543c['createdAt']=_0x2467b2['sessionCreatedAt'],_0x50543c['_authorId']=null;}),_0x5d98fe)_0x1b91da=_0x396d17,this['_applyOperationsSet'](_0x1b91da,_0x5d98fe);else{if(_0x2467b2['initData']){const _0x2fd6d5=this['_getOperationsFromInitData'](_0x2467b2['initData']);this['_document']['history']['version']=-_0x2fd6d5['length'],_0x2fd6d5['forEach'](_0x5d7344=>{_0x5d7344['baseVersion']-=_0x2fd6d5['length'],_0x5d7344['createdAt']=_0x2467b2['sessionCreatedAt'],_0x5d7344['_isInit']=!0x0,_0x5d7344['_authorId']=null;}),this['_applyOperationsSet'](_0x2fd6d5,!0x0),this['serverHistory']['version']=-_0x2fd6d5['length']+this['_offset'],this['_updateServerHistory'](_0x2fd6d5);}this['_document']['history']['version']=_0x3313ca,_0x1b91da=this['_decompressOperations'](_0x2467b2['data'],_0x2467b2['metadata']),await this['_fetchMissingUsers'](_0x1b91da),this['_applyOperationsSet'](_0x1b91da,_0x5d98fe);}_0x2467b2['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x1b91da,_0x2467b2['lastOperationId']),this['_lastSyncedOperationId']=_0x2467b2['lastOperationId']),this['serverHistory']['version']=_0x3313ca+this['_offset'],this['_updateServerHistory'](_0x1b91da),_0x396d17['filter'](_0x4130bc=>{const _0x1290ba=this['_getAffectedRoot'](_0x4130bc);return _0x1290ba&&!this['_knownRootNames']['has'](_0x1290ba);})['forEach']((_0x2e47db,_0x72ff4c)=>{_0x2e47db['baseVersion']=this['_document']['version']+_0x72ff4c,this['_saveOperationInBuffer'](_0x2e47db);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x2c00d7,_0x59e223){const _0x27f443=_0x59e223&&_0x59e223['message'];if(_0x27f443&&_0x27f443['startsWith']('realtimecollaborationclient'))throw _0x59e223;const _0x2f740c=this['editor']['plugins']['get'](n);throw this['_isPendingUpdate']=!0x0,_0x2f740c['disconnect'](),this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0x1b863e(_0x2c00d7,this['editor'],_0x27f443?{'originalError':_0x27f443}:void 0x0);}['_saveOperationInBuffer'](_0x451d62){this['_knownOperations']['has'](_0x451d62)||(this['_knownOperations']['add'](_0x451d62),this['_bufferedOperations']['push'](_0x451d62),this['_pendingAction']||'marker'==_0x451d62['type']&&!_0x451d62['affectsData']||this['_setPendingAction']());}['_sendBufferedOperationsDelayed'](_0xcfab30=!0x1){!_0xcfab30&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0x3d27d8=>{_0x3d27d8&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0xcf19d6=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0x33138e){return _0x33138e['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x33138e['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0x33138e['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0xcf19d6)||this['_crash'](_0xcf19d6['message'],_0xcf19d6);});},this['_currentBufferDelay']));}['_waitUntilSynced'](){return new Promise(_0x5b3033=>{this['on']('change:_isPendingUpdate',()=>{_0x5b3033();});});}async['_sendBufferedOperations'](){const _0xd2c265=this['editor']['plugins']['get'](H);if(this['_shouldSendSelectionUpdate']()&&(_0xd2c265['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x5fbae8=[...this['_bufferedOperations']];for(const _0x2905ba of _0x5fbae8)_0x2905ba['wasUndone']=this['_document']['history']['isUndoneOperation'](_0x2905ba);const _0x167ece=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x5fbae8),_0x20aee8=G++,_0x2d5d34=this['_compressOperations'](_0x5fbae8),_0x4b6951=await this['_service']['sendOperations'](_0x2d5d34,_0x2d5d34['baseVersion'],_0x167ece);try{return await this['_handleServerResponse'](_0x5fbae8,_0x4b6951,_0x20aee8);}catch(_0x21a135){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0x21a135);}}async['_handleServerResponse'](_0x23e094,_0x5dd43f,_0x32e3af){if('error'in _0x5dd43f)throw _0x5dd43f['error'];let _0x5a5dec=!0x1;if(_0x5dd43f['wereChangesApplied']){_0x5dd43f['lastOperationId']&&(this['_lastSyncedOperationId']=_0x5dd43f['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x330387=>!_0x23e094['includes'](_0x330387));for(const _0x36dea9 of _0x23e094)_0x36dea9['createdAt']='lastOperationAcceptedAt'in _0x5dd43f&&_0x5dd43f['lastOperationAcceptedAt']||void 0x0;K(_0x23e094,_0x5dd43f['version']-_0x23e094['length']),this['_updateServerHistory'](_0x23e094);const _0x164ed1=_0x23e094['filter'](_0x1466d6=>{if(!_0x1466d6['_isInit'])return!0x1;const _0x26fa6b=this['_getAffectedRoot'](_0x1466d6);return _0x26fa6b&&!this['_knownRootNames']['has'](_0x26fa6b);});K(_0x164ed1,this['_document']['version']),this['_applyOperationsSet'](_0x164ed1),_0x5a5dec=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0x59c500=this['_decompressOperations'](_0x5dd43f['data'],_0x5dd43f['metadata'])['filter'](_0x5e1e89=>_0x5e1e89['baseVersion']>=this['_lastServerVersion']);_0x59c500['forEach'](_0x1a4d95=>this['_addKnownRoot'](_0x1a4d95)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x36da97=>!_0x36da97['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x36da97))),this['_bufferedOperations']['length']&&K(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0x59c500),_0x5a5dec=this['_handleExternalOperations'](_0x59c500,_0x5dd43f['version'],_0x5dd43f['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x5a5dec?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}['_handleExternalOperations'](_0xe4cabf,_0x519eae,_0x361556){try{const _0x3b6aaa={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x2e1308,operationsB:_0xbc4622,originalOperations:_0x45ce1d}=_0x1eddcf(_0xe4cabf,this['_bufferedOperations'],_0x3b6aaa);K(_0x2e1308,this['_document']['version']),K(_0xbc4622,_0x519eae);for(const _0x122d24 of _0x2e1308){const _0x4ae42f=_0x45ce1d['get'](_0x122d24);_0x122d24['_authorId']=_0x4ae42f?_0x4ae42f['_authorId']:null;}_0x361556&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0xe4cabf,_0x361556),this['_lastSyncedOperationId']=_0x361556),this['_bufferedOperations']=[..._0xbc4622],this['_applyOperationsSet'](_0x2e1308),this['_updateServerHistory'](_0xe4cabf);}catch(_0x45e126){return console['error'](_0x45e126),!0x1;}return!0x0;}['_applyOperationsSet'](_0x168dd1,_0x470667=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0x27c141=>{for(const _0x2d7a5e of _0x168dd1)this['_knownOperations']['add'](_0x2d7a5e),this['_addKnownRoot'](_0x2d7a5e),_0x27c141['batch']['addOperation'](_0x2d7a5e),this['editor']['model']['applyOperation'](_0x2d7a5e);});}['_addKnownRoot'](_0x3784d1){const _0x5d23ad=this['_getAffectedRoot'](_0x3784d1);_0x5d23ad&&this['_knownRootNames']['add'](_0x5d23ad);}['_getAffectedRoot'](_0xd45886){let _0x37a050,_0x27ad86;switch(_0xd45886['type']){case'insert':_0x37a050=_0xd45886['position']['root'];break;case'marker':if(_0x27ad86=_0xd45886['newRange'],!_0x27ad86)return null;_0x37a050=_0x27ad86['root'];break;case'addRootAttribute':_0x37a050=_0xd45886['root'];break;case'addRoot':_0x37a050=_0xd45886['affectedSelectable'];break;case'move':_0x37a050=_0xd45886['targetPosition']['root'];break;default:return null;}return _0x37a050['rootName'];}['_updateServerHistory'](_0x1ba9d3){_0x1ba9d3['forEach'](_0x335307=>{const _0xc30ccd=_0x335307['clone']();_0xc30ccd['_authorId']=_0x335307['_authorId'],_0xc30ccd['_isInit']=!!_0x335307['_isInit'],_0xc30ccd['createdAt']=_0x335307['createdAt'],_0xc30ccd['baseVersion']+=this['_offset'],_0x335307['_isDisconnection']&&this['_disconnectionOperations']['add'](_0xc30ccd),this['serverHistory']['addOperation'](_0xc30ccd);});}['_handleReconnectionError'](_0x2c0c13){const _0x34f8e9=this['editor']['plugins']['get']('Notification'),_0x2480e8=this['editor']['locale'];_0x2c0c13||(_0x2c0c13=V(_0x2480e8,'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.')),_0x34f8e9['showWarning'](_0x2c0c13,{'title':V(_0x2480e8,'Synchronization\x20issue'),'namespace':'real-time-collaboration'}),this['_hasSynchronizationProblem']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_bufferedOperations']=[],this['editor']['plugins']['get'](n)['disconnect']();}['_setPendingAction'](){this['_pendingAction']||(this['_pendingAction']=this['editor']['plugins']['get'](_0x1c56c5)['add'](V(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}['_clearPendingAction'](){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x1c56c5)['remove'](this['_pendingAction']),this['_pendingAction']=null);}['_compressOperations'](_0x3356b2){const _0x3f8dec=_0x3356b2['map'](_0x1dfc06=>_0x1dfc06['toJSON']());return this['_compressor']['compress'](_0x3f8dec);}['_decompressOperations'](_0x5d1be8,_0x545005){return this['_compressor']['decompress'](_0x5d1be8)['map']((_0x5ed967,_0x43cd01)=>{const _0x5e9d7b='init'==_0x545005[_0x43cd01]['type'];if('InsertOperation'==_0x5ed967['__className']){const _0x178f57=_0x5ed967['position']['root'];!this['_document']['getRoot'](_0x178f57)&&(this['_document']['createRoot']('$root',_0x178f57)['_isAttached']=!0x1);}const _0x628606=_0x4a12de['fromJSON'](_0x5ed967,this['_document']);return _0x628606['wasUndone']=_0x5ed967['wasUndone'],_0x628606['_isInit']=_0x5e9d7b,_0x628606['_authorId']=_0x5e9d7b?null:_0x545005[_0x43cd01]['userId'],_0x628606['_isDisconnection']='cs:removeUser'===_0x545005[_0x43cd01]['type'],_0x628606['createdAt']=_0x545005[_0x43cd01]['createdAt'],_0x628606;});}['_refreshUserSelectionMarkers'](){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}['_shouldSendSelectionUpdate'](){const _0x3e54f4=this['editor']['plugins']['get'](i)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0x3e54f4&&_0x3e54f4['length']>0x1&&this['_hasSelectionChanged'];}['_shouldSendUpdate'](){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}}class $ extends Error{}function K(_0x5ac0b0,_0x443d86){for(const _0x3e2d55 of _0x5ac0b0)_0x3e2d55['baseVersion']=_0x443d86++;}class J{['_ignoredOperations'];['_operationToId'];constructor(_0x3a9537){this['_ignoredOperations']=_0x3a9537,this['_operationToId']=new WeakMap();}['getIdOfTheLastOperation'](_0x1bc0d6){let _0x3e9788=_0x1bc0d6['length'];for(;_0x3e9788--;){const _0x3ae370=_0x1bc0d6[_0x3e9788];if(!this['_ignoredOperations']['has'](_0x3ae370)){if(!this['_operationToId']['has'](_0x3ae370)){const _0x267259=_0x58108b()['slice'](0x1,0x12);this['_operationToId']['set'](_0x3ae370,_0x267259);}return this['_operationToId']['get'](_0x3ae370);}}}['setIdForTheLastOperation'](_0x1f605e,_0x563cef){if(!_0x563cef)return;let _0x5c50cd=_0x1f605e['length'];for(;_0x5c50cd--;){const _0x5ed7b6=_0x1f605e[_0x5c50cd];this['_ignoredOperations']['has'](_0x5ed7b6)||this['_operationToId']['set'](_0x5ed7b6,_0x563cef);}}}class a extends _0x4f70c8{static get['requires'](){return[l];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class s extends _0x34f6b7{static ['CommentsService']=/* #__PURE__ -- @preserve */
|
|
26
|
+
((()=>_0x1be594)());['_services'];static get['requires'](){return[n,'CommentsRepository',i,_0x12033b];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x2673ad){super(_0x2673ad),this['_services']=new Map();}async['init'](){const _0x452e5f=this['context'],_0x5e068f=_0x452e5f['plugins']['get']('CommentsRepository');if(_0x452e5f['plugins']['get'](n)['addToReconnectionStack'](this),_0x5e068f['adapter']={'addCommentThread':async({channelId:_0x4ec735,threadId:_0x439ee0,comments:_0x2b745c,resolvedAt:_0x3e8abf,resolvedBy:_0x3628e5,context:_0x5a2ae4,attributes:_0x513ff8})=>{const _0x2c7ad3=await this['_getService'](_0x4ec735)['addCommentThread']({'commentThreadId':_0x439ee0,'comments':_0x2b745c['map'](_0x26de45=>function(_0x49d910,_0x3fde0d,_0x363607){return{'commentThreadId':_0x363607,'commentId':_0x49d910['commentId'],'userId':_0x49d910['authorId'],'content':_0x49d910['content'],'documentId':_0x3fde0d,'createdAt':_0x49d910['createdAt'],'attributes':_0x49d910['attributes']||{}};}(_0x26de45,_0x4ec735,_0x439ee0)),'resolvedAt':_0x3e8abf,'resolvedBy':_0x3628e5,'context':_0x5a2ae4,'attributes':_0x513ff8})['catch'](dt);return{'threadId':_0x2c7ad3['commentThreadId'],'comments':_0x2c7ad3['comments']};},'getCommentThread':async({channelId:_0x15c4d4,threadId:_0x3a495d})=>{const _0x2f0a3d=await this['_getService'](_0x15c4d4)['getCommentThread'](_0x3a495d)['catch'](dt);return _0x2f0a3d['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0x2f0a3d]),{'threadId':_0x2f0a3d['commentThreadId'],'comments':_0x2f0a3d['comments']['map'](B),'context':_0x2f0a3d['context'],'resolvedAt':_0x2f0a3d['resolvedAt'],'resolvedBy':_0x2f0a3d['resolvedBy'],'attributes':_0x2f0a3d['attributes']||{}});},'updateCommentThread':async({channelId:_0x287824,threadId:_0x1521ed,context:_0x29e3b0,unlinkedAt:_0x322b0b,attributes:_0x2b0123})=>this['_getService'](_0x287824)['updateCommentThread']({'commentThreadId':_0x1521ed,'context':_0x29e3b0,'attributes':_0x2b0123,'unlinkedAt':_0x322b0b})['catch'](F)['catch'](dt),'resolveCommentThread':async({channelId:_0x541d54,threadId:_0x4227fe})=>{const _0x5ea811=await this['_getService'](_0x541d54)['resolveCommentThread'](_0x4227fe)['catch'](F)['catch'](dt);return{'threadId':_0x5ea811['commentThreadId'],'resolvedAt':_0x5ea811['resolvedAt'],'resolvedBy':_0x5ea811['resolvedBy']};},'reopenCommentThread':async({channelId:_0x32192a,threadId:_0x3f1167})=>this['_getService'](_0x32192a)['reopenCommentThread'](_0x3f1167)['catch'](F)['catch'](dt),'removeCommentThread':({channelId:_0x3cac72,threadId:_0x5b485d})=>this['_getService'](_0x3cac72)['removeCommentThread'](_0x5b485d)['catch'](F)['catch'](dt),'addComment':({channelId:_0x427010,threadId:_0x5a3ffb,commentId:_0x169a93,content:_0x3f18b0,attributes:_0x56811a})=>this['_getService'](_0x427010)['addComment'](_0x5a3ffb,_0x169a93,_0x3f18b0,_0x56811a)['catch'](dt),'updateComment':({channelId:_0x4b0f60,threadId:_0x32f194,commentId:_0x5b2048,content:_0x4a3255,attributes:_0x36eb3f})=>this['_getService'](_0x4b0f60)['updateComment'](_0x32f194,_0x5b2048,_0x4a3255,_0x36eb3f)['catch'](F)['catch'](dt),'removeComment':({channelId:_0x4f720b,threadId:_0xb0224e,commentId:_0x26c6a9})=>this['_getService'](_0x4f720b)['removeComment'](_0xb0224e,_0x26c6a9)['catch'](F)['catch'](dt)},_0x452e5f instanceof _0x64503e){const _0xb2e3e=_0x452e5f['config']['get']('collaboration.channelId'),_0x48fb05=_0x452e5f['plugins']['get'](i);await this['_setUpService'](_0xb2e3e);const _0x4811de=await this['_services']['get'](_0xb2e3e)['getConnectedSessions']();this['listenTo'](_0x48fb05,'sessionAdd:'+_0xb2e3e,(_0x5efe5d,{session:_0x59de2a})=>{_0x59de2a['id']===_0x48fb05['mySessionId']&&(_0x5efe5d['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x59de2a['permissions'],_0xb2e3e));}),_0x48fb05['register'](_0xb2e3e,_0x4811de);}}async['_setUpService'](_0x3366d9){if(this['_services']['has'](_0x3366d9))throw new _0x1b863e('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0x3366d9});const _0x4edc21=this['context']['plugins']['get']('CommentsRepository'),_0x4d3c8f=new s['CommentsService'](_0x3366d9);this['_services']['set'](_0x3366d9,_0x4d3c8f),this['listenTo'](_0x4d3c8f,'commentThreadAdded',(_0x598060,_0x9f332f)=>{const {commentThreadId:_0x19e2a2,documentId:_0xef3b8a,context:_0x51f1a5,attributes:_0xc2cb55,resolvedAt:_0x145a8f,resolvedBy:_0x40f86f,comments:_0xef9c99}=_0x9f332f;_0x4edc21['getCommentThread'](_0x19e2a2)||_0x4edc21['addCommentThread']({'threadId':_0x19e2a2,'channelId':_0xef3b8a,'comments':_0xef9c99?_0xef9c99['map'](B):[],'context':_0x51f1a5,'attributes':_0xc2cb55,'resolvedAt':_0x145a8f,'resolvedBy':_0x40f86f,'isFromAdapter':!0x0});}),this['listenTo'](_0x4d3c8f,'commentThreadUpdated',(_0x4b58c6,{commentThreadId:_0xd05ea8,documentId:_0xb3d20e,context:_0x43c518,unlinkedAt:_0x86dc6f,attributes:_0x4c2581})=>{_0x4edc21['getCommentThread'](_0xd05ea8)&&_0x4edc21['updateCommentThread']({'threadId':_0xd05ea8,'channelId':_0xb3d20e,'context':_0x43c518,'unlinkedAt':_0x86dc6f,'attributes':_0x4c2581,'isFromAdapter':!0x0});}),this['listenTo'](_0x4d3c8f,'commentThreadResolved',(_0x302aaf,{commentThreadId:_0x33f194,resolvedBy:_0x195e0d,resolvedAt:_0x3297c0})=>{const _0x3b9f65=_0x4edc21['getCommentThread'](_0x33f194);_0x3b9f65&&_0x3b9f65['resolve']({'resolvedBy':_0x195e0d,'resolvedAt':_0x3297c0,'isFromAdapter':!0x0});}),this['listenTo'](_0x4d3c8f,'commentThreadReopened',(_0x502f8f,{commentThreadId:_0x13cd24})=>{const _0x5c0f31=_0x4edc21['getCommentThread'](_0x13cd24);_0x5c0f31&&_0x5c0f31['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0x4d3c8f,'commentThreadRemoved',(_0x414c73,{commentThreadId:_0x3ab248})=>{const _0x2b7712=_0x4edc21['getCommentThread'](_0x3ab248);_0x2b7712&&_0x2b7712['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0x4d3c8f,'commentAdded',(_0x5e0855,_0x294952)=>{const _0x30b5a2=_0x294952['commentThreadId'],_0x551b9a=_0x4edc21['getCommentThread'](_0x30b5a2);_0x551b9a&&_0x551b9a['addComment']({...B(_0x294952),'isFromAdapter':!0x0});}),this['listenTo'](_0x4d3c8f,'commentUpdated',(_0x535cde,{commentThreadId:_0x5a5be1,commentId:_0x45ad72,content:_0x40c979,attributes:_0x3658a0})=>{const _0x4554a9=_0x4edc21['getCommentThread'](_0x5a5be1);if(_0x4554a9){const _0x1c58af=_0x4554a9['getComment'](_0x45ad72);_0x1c58af&&_0x1c58af['update']({'content':_0x40c979,'attributes':_0x3658a0,'isFromAdapter':!0x0});}}),this['listenTo'](_0x4d3c8f,'commentRemoved',(_0x34e575,{commentThreadId:_0x553fc1,commentId:_0x10d3d1})=>{const _0x1f2d62=_0x4edc21['getCommentThread'](_0x553fc1);if(_0x1f2d62){const _0x4a176b=_0x1f2d62['getComment'](_0x10d3d1);_0x4a176b&&_0x4a176b['remove']({'isFromAdapter':!0x0});}}),await this['_connectService'](_0x3366d9);}['destroy'](){if(this['context']instanceof _0x64503e){const _0x265546=this['context']['config']['get']('collaboration.channelId');this['_terminateService'](_0x265546);}}['_terminateService'](_0x38f148){if(!this['_services']['has'](_0x38f148))throw new _0x1b863e('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0x38f148});this['_getService'](_0x38f148)['disconnect'](),this['_services']['delete'](_0x38f148);}async['reconnect'](){for(const _0x21f468 of this['_services']['keys']())await this['_connectService'](_0x21f468);if(this['context']instanceof _0x64503e){const _0x24079c=this['context']['config']['get']('collaboration.channelId'),_0x19689f=this['context']['plugins']['get'](i);_0x19689f['unregister'](_0x24079c);const _0xe4cdf7=await this['_services']['get'](_0x24079c)['getConnectedSessions']();_0x19689f['register'](_0x24079c,_0xe4cdf7);}}async['_connectService'](_0xc0af9e){const {connection:_0xd8ce8b}=this['context']['plugins']['get'](n),_0x18138e=this['context']['plugins']['get']('CommentsRepository'),_0x271c2c=this['_services']['get'](_0xc0af9e),_0x5a435a=await _0x271c2c['connect'](_0xd8ce8b);await this['_fetchMissingUsersForThreads'](_0x5a435a);const _0xdb7a10=new Set(Array['from'](_0x18138e['getCommentThreads']({'channelId':_0xc0af9e}),_0x4c4b4c=>_0x4c4b4c['id']));for(const _0x32433f of _0x5a435a)_0x32433f['deletedAt']||_0xdb7a10['delete'](_0x32433f['commentThreadId']);for(const _0x18de07 of _0xdb7a10)_0x18138e['getCommentThread'](_0x18de07)['remove']({'isFromAdapter':!0x0});for(const _0x18d495 of _0x5a435a){let _0x1f7a1b=_0x18138e['getCommentThread'](_0x18d495['commentThreadId']);const {commentThreadId:_0x300c11,context:_0x116a7f,attributes:_0x41d6e8,resolvedBy:_0x17aebf,resolvedAt:_0x41fe93,unlinkedAt:_0x359da4,deletedAt:_0x5508cf}=_0x18d495;if(_0x5508cf)continue;_0x1f7a1b||(_0x1f7a1b=_0x18138e['addCommentThread']({'channelId':_0xc0af9e,'threadId':_0x300c11,'context':_0x116a7f,'attributes':_0x41d6e8||{},'resolvedBy':_0x17aebf,'resolvedAt':_0x41fe93,'unlinkedAt':_0x359da4,'isFromAdapter':!0x0}));const _0x2976df=new Set(Array['from'](_0x1f7a1b['comments'],_0x54c8dd=>_0x54c8dd['id']));for(const _0x2230e3 of _0x18d495['comments'])_0x2976df['delete'](_0x2230e3['commentId']);for(const _0x57357f of _0x2976df)_0x1f7a1b['getComment'](_0x57357f)['remove']({'isFromAdapter':!0x0});for(const _0x46a336 of _0x18d495['comments']){const _0x49f35d=_0x1f7a1b['getComment'](_0x46a336['commentId']);_0x49f35d?_0x49f35d['content']!==_0x46a336['content']&&_0x49f35d['update']({'content':_0x46a336['content'],'isFromAdapter':!0x0}):_0x1f7a1b['addComment'](Object['assign'](B(_0x46a336),{'isFromAdapter':!0x0}));}}}['_getService'](_0x329857){if(!this['_services']['has'](_0x329857))throw new _0x1b863e('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0x329857});return this['_services']['get'](_0x329857);}async['_fetchMissingUsersForThreads'](_0x1de276){const _0x19796c=this['context']['plugins']['get'](_0x12033b),{connection:_0x1e946e}=this['context']['plugins']['get'](n),_0x35ee68=new Set();for(const {resolvedBy:_0x55460c,comments:_0x4f5b92}of _0x1de276){_0x55460c&&!_0x19796c['getUser'](_0x55460c)&&_0x35ee68['add'](_0x55460c);for(const {userId:_0x5bb5c6}of _0x4f5b92)_0x19796c['getUser'](_0x5bb5c6)||_0x35ee68['add'](_0x5bb5c6);}if(0x0===_0x35ee68['size'])return;const _0x53dbae=await lt['getMany'](_0x1e946e,Array['from'](_0x35ee68));for(const _0x470833 of _0x53dbae)_0x19796c['getUser'](_0x470833['id'])||_0x19796c['addUser'](_0x470833);}}async function F(_0x28334b){if('404'!==_0x28334b['code'])throw _0x28334b;}function dt(_0x350c04){if((_0x368908=_0x350c04)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0x368908['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x368908['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0x368908;throw _0x350c04;}function B(_0x205d91){return{'threadId':_0x205d91['commentThreadId'],'commentId':_0x205d91['commentId'],'content':_0x205d91['content'],'createdAt':_0x205d91['createdAt'],'authorId':_0x205d91['userId'],'attributes':_0x205d91['attributes']||{}};}class m extends _0x4f70c8{static ['TrackChangesService']=/* #__PURE__ -- @preserve */
|
|
27
|
+
((()=>et)());['_bufferedRequests'];['_trackChangesService'];static get['requires'](){return[s,'TrackChangesEditing',n];}static get['pluginName'](){return'CloudServicesTrackChangesAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x1bf072){super(_0x1bf072);const _0x11b5bc=this['editor']['config']['get']('collaboration.channelId');this['_bufferedRequests']=new Map(),this['_trackChangesService']=new m['TrackChangesService'](_0x11b5bc);}['init'](){const _0x243b71=this['editor']['plugins']['get'](n),_0xe10001=this['editor']['plugins']['get']('TrackChangesEditing');return _0xe10001['adapter']={'getSuggestion':async _0xd1e274=>{await this['_waitForServiceReady']();const _0x9affb7=await this['_trackChangesService']['get'](_0xd1e274)['catch'](k);return await this['_fetchMissingUsersForThreads']([_0x9affb7]),_0x9affb7;},'addSuggestion':async({id:_0xcd1f66,type:_0x17efd1,data:_0x122980,originalSuggestionId:_0x3719e2,attributes:_0x23b6c1})=>{await this['_waitForServiceReady']();const _0x24c8c8={'id':_0xcd1f66,'type':_0x17efd1,'data':_0x122980,'originalSuggestionId':_0x3719e2,'attributes':_0x23b6c1},_0x56210a=await this['_trackChangesService']['add'](_0xcd1f66,_0x17efd1,_0x122980,_0x3719e2,_0x23b6c1)['catch'](_0x2d8147=>{if(ut(_0x2d8147))return new Promise(_0x4bfad0=>{this['_bufferedRequests']['set'](_0xcd1f66,{'resolve':_0x4bfad0,'suggestionData':_0x24c8c8});});throw _0x2d8147;});return this['_bufferedRequests']['delete'](_0xcd1f66),_0x56210a;},'updateSuggestion':async(_0x4b2a6b,_0x268310)=>{if(await this['_waitForServiceReady'](),'open'!==_0x268310['state'])return this['_trackChangesService']['update'](_0x4b2a6b,_0x268310)['catch'](k);}},this['listenTo'](this['_trackChangesService'],'suggestionUpdated',(_0x8b69a6,_0x1747ad)=>{_0xe10001['hasSuggestion'](_0x1747ad['id'])&&(_0xe10001['getSuggestion'](_0x1747ad['id'])['attributes']=_0x1747ad['attributes']);}),this['_trackChangesService']['connect'](_0x243b71['connection'])['then'](_0x29a553=>(_0x243b71['addToReconnectionStack'](this),this['_fetchMissingUsersForThreads'](_0x29a553)['then'](()=>{for(const _0x3afee5 of _0x29a553){_0xe10001['addSuggestionData'](_0x3afee5)['_saved']=!0x0;}})));}async['reconnect'](){const _0x37462d=this['editor']['plugins']['get']('TrackChangesEditing'),{connection:_0x26a2d0}=this['editor']['plugins']['get'](n),_0x1b8d35=await this['_trackChangesService']['connect'](_0x26a2d0);await this['_fetchMissingUsersForThreads'](_0x1b8d35);for(const {suggestionData:_0xf9d776,resolve:_0x1d6a0b}of this['_bufferedRequests']['values']()){let _0x221018=_0x1b8d35['find'](_0x10215a=>_0x10215a['id']===_0xf9d776['id']);_0x221018||(_0x221018=await this['_trackChangesService']['add'](_0xf9d776['id'],_0xf9d776['type'],_0xf9d776['data'],_0xf9d776['originalSuggestionId'])),_0x1d6a0b(_0x221018);}for(const _0x4776a6 of _0x1b8d35)_0x37462d['hasSuggestion'](_0x4776a6['id'])||_0x37462d['addSuggestionData'](_0x4776a6);}async['_waitForServiceReady'](){this['_trackChangesService']['isConnected']||await new Promise(_0x548d76=>{this['listenTo'](this['_trackChangesService'],'connected',_0x2f88b2=>{_0x2f88b2['off'](),_0x548d76();});});}async['_fetchMissingUsersForThreads'](_0x289bf6){const _0x3a5520=this['editor']['plugins']['get'](_0x12033b),{connection:_0x4bb214}=this['editor']['plugins']['get'](n),_0x3b6809=new Set();for(const {authorId:_0x252051}of _0x289bf6)_0x3a5520['getUser'](_0x252051)||_0x3b6809['add'](_0x252051);if(0x0===_0x3b6809['size'])return;const _0x257623=await lt['getMany'](_0x4bb214,Array['from'](_0x3b6809));for(const _0xe224a6 of _0x257623)_0x3a5520['getUser'](_0xe224a6['id'])||_0x3a5520['addUser'](_0xe224a6);}}function k(_0x215458){if(ut(_0x215458))return new Promise(()=>{});throw _0x215458;}function ut(_0x2dc902){return _0x2dc902['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x2dc902['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class g extends _0x4f70c8{static get['requires'](){return['Comments',s,a,n];}static get['pluginName'](){return'RealTimeCollaborativeComments';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x216e7a=this['editor']['plugins']['get'](n),_0x156134=this['editor']['plugins']['get']('CommentsEditing'),_0x80d05d=this['editor']['plugins']['get'](s);return this['editor']['data']['once']('ready',()=>{this['listenTo'](_0x216e7a,'change:state',(_0x29af80,_0x4d5915,_0xd65b27)=>{_0x156134['isThreadsLoadingPaused']='connected'!==_0xd65b27;});}),this['listenTo'](_0x216e7a,'change:state',(_0x1d9743,_0x7c1d03,_0x328003)=>{this['editor']['plugins']['get']('CommentsRepository')['switchReadOnly']('connected'!==_0x328003);}),_0x80d05d['_setUpService'](this['editor']['config']['get']('collaboration.channelId'));}['destroy'](){this['editor']['plugins']['get'](s)['_terminateService'](this['editor']['config']['get']('collaboration.channelId')),super['destroy']();}}class ft extends _0x4f70c8{static get['requires'](){return[g,m,'TrackChanges'];}static get['pluginName'](){return'RealTimeCollaborativeTrackChanges';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class c extends _0x4f70c8{static ['RevisionHistoryService']=/* #__PURE__ -- @preserve */
|
|
28
|
+
((()=>it)());['_lastRequestId'];['_revisionTracker'];['_revisionHistoryService'];['_oldOffset'];static get['requires'](){return[n,l,'RevisionHistory',i,_0x12033b];}static get['pluginName'](){return'CloudServicesRevisionHistoryAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x596a2c){super(_0x596a2c);const _0x5a250f=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new c['RevisionHistoryService'](_0x5a250f);}async['init'](){const _0x497540=this['editor']['plugins']['get'](l),_0x5ed7fa=_0x497540['serverHistory'],_0x4adbcb=this['editor']['plugins']['get'](n);this['_revisionTracker']['setSource']({'history':_0x5ed7fa,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0x497540['sessionId']});const _0x47eb6d=this['editor']['config']['get']('cloudServices.bundleVersion')||nt,_0x11363f=await tt['isBundleUploaded'](_0x4adbcb['connection'],_0x47eb6d);this['editor']['plugins']['get']('RevisionHistory')['adapter']={'getRevision':async({revisionId:_0x411b8f})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0x411b8f)),'updateRevisions':async _0x25930c=>{await this['_waitForServiceReady']();const _0x16882a=this['_revisionTracker']['currentRevision'];if(_0x11363f&&0x1===_0x25930c['length']&&_0x25930c[0x0]['id']===_0x16882a['id'])return _0x25930c;for(const _0x2f3b71 of _0x25930c)_0x2f3b71['id']===_0x16882a['id']&&(_0x2f3b71['isEmptyCurrent']=_0x2f3b71['fromVersion']===_0x2f3b71['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0x25930c,this['_lastRequestId'])['then'](_0x2242ca=>(this['_lastRequestId']=_0x2242ca,_0x25930c))['catch'](_0x4a700b=>{if(st(_0x4a700b)||'400'===_0x4a700b['code']&&void 0x0!==_0x4a700b['data']['wrongRequestId']){for(const _0x5563f7 of _0x25930c){!this['_revisionTracker']['repository']['getRevision'](_0x5563f7['id'])||this['_revisionTracker']['_bufferUpdate'](_0x5563f7['id'],_0x5563f7,!0x1);}if(st(_0x4a700b))throw _0x4a700b;return _0x25930c;}throw _0x4a700b;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0x4eb4c4,{revisionsData:_0x1a17a3,requestId:_0x3f483a})=>{Math['max'](..._0x1a17a3['map'](_0xaa7e64=>_0xaa7e64['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0x1a17a3,_0x3f483a);}):this['_handleRevisionsUpdate'](_0x1a17a3,_0x3f483a);});const {revisions:_0x2b9dcd,requestId:_0x1404bc}=await this['_revisionHistoryService']['connect'](_0x4adbcb['connection']);_0x4adbcb['addToReconnectionStack'](this),this['_lastRequestId']=_0x1404bc,await this['_fetchMissingUsers'](_0x2b9dcd);for(const _0x3192b0 of _0x2b9dcd)this['_revisionTracker']['addRevisionData'](_0x3192b0);this['listenTo'](_0x497540,'change:_isConnected',(_0x2543c8,_0x58c2cb,_0x2dc3c1)=>{_0x2dc3c1&&(this['_oldOffset']=_0x497540['_offset'],_0x2543c8['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](_0x4adbcb,'state',_0x261211=>_0x261211===te['CONNECTED']);}async['reconnect'](){const _0x48484c=this['editor']['plugins']['get'](n),_0x4820a9=this['editor']['plugins']['get'](l),_0x1e31a9=async()=>{const _0x413511=this['_revisionTracker']['currentRevision'],_0x2d9aa8=_0x413511['id'],_0x40fcf2=_0x2d9aa8!==_0x4820a9['sessionId'];if(_0x40fcf2){const _0x42b741=_0x4820a9['_offset']-this['_oldOffset'],_0x3b415d=this['_getLatestVersionFromServerOperations']();this['_revisionTracker']['_revisionDataBuilder']['reInit']();if(_0x413511['toVersion']+_0x42b741!==_0x3b415d){const _0x25dd6b=_0x413511['fromVersion']+_0x42b741,_0x30f3be=this['editor']['plugins']['get'](_0x12033b),_0x37cb3c=this['_revisionTracker']['buildRevisionData']({'revision':_0x413511,'from':_0x25dd6b,'to':_0x3b415d});_0x37cb3c['id']=_0x413511['id'];const _0xe3e943=_0x37cb3c['authorsIds']['map'](_0x1365f0=>_0x30f3be['getUser'](_0x1365f0));_0x413511['_update']({..._0x37cb3c,'authors':_0xe3e943},!0x0),this['_revisionTracker']['_bufferUpdate'](_0x413511['id'],_0x37cb3c,!0x0);}this['_revisionTracker']['_startingVersion']=_0x3b415d,(_0x413511['toVersion']===_0x413511['fromVersion']&&!this['_revisionTracker']['_bufferedUpdates']['has'](_0x2d9aa8)&&this['_revisionTracker']['repository']['_revisions']['remove'](_0x2d9aa8),this['_revisionTracker']['_createCurrentRevision'](_0x3b415d));}const {revisions:_0x45b579,requestId:_0x3a1c8d}=await this['_revisionHistoryService']['reconnect'](_0x48484c['connection'],this['_lastRequestId']);_0x40fcf2&&_0x45b579['length']>0x0?_0x4820a9['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x45b579),this['_handleRevisionsUpdate'](_0x45b579,_0x3a1c8d),this['_revisionTracker']['sendBufferedUpdates']());};return _0x4820a9['_isConnected']?_0x1e31a9():new Promise((_0x2962e2,_0x5869f4)=>{_0x4820a9['once']('change:_isConnected',()=>{_0x1e31a9()['then'](_0x2962e2)['catch'](_0x5869f4);});});}['destroy'](){super['destroy']();}async['_waitForServiceReady'](){this['_revisionHistoryService']['isConnected']||await new Promise(_0x3e8666=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x15ed4e=>{_0x15ed4e['off'](),_0x3e8666();});});}['_getLatestVersionFromServerOperations'](){const _0x4565ed=this['editor']['plugins']['get'](l)['serverHistory']['getOperations']()['reverse']();for(const _0xacaec2 of _0x4565ed)if('marker'!==_0xacaec2['type']||_0xacaec2['affectsData'])return _0xacaec2['baseVersion']+0x1;}['_getLatestVersion'](){const _0x19d518=this['editor']['plugins']['get'](l);return new Promise(_0x19361e=>{_0x19d518['_isPendingUpdate']?_0x19d518['once']('change:_isPendingUpdate',()=>{_0x19361e(this['_getLatestVersionFromServerOperations']());}):_0x19361e(this['_getLatestVersionFromServerOperations']());});}['_handleRevisionsUpdate'](_0x35b6eb,_0x47a466){const _0x76aff2=this['_revisionTracker']['repository'];this['_lastRequestId']=_0x47a466;for(const _0x399165 of _0x35b6eb){const _0x3829b0=_0x76aff2['getRevision'](_0x399165['id']);if(_0x3829b0){if((_0x399165['fromVersion']||_0x399165['toVersion'])&&(_0x399165['diffData']=null),_0x3829b0===this['_revisionTracker']['currentRevision']){const _0x43e72e=Math['max'](_0x3829b0['toVersion'],_0x399165['toVersion']),_0xd7c01f=Math['max'](_0x3829b0['fromVersion'],_0x399165['fromVersion']);let _0x16d814;_0x3829b0['toVersion']===_0x399165['toVersion']&&_0x3829b0['fromVersion']===_0x399165['fromVersion']?(_0x16d814=!0x0,this['_preventResendingRevisionData'](_0x399165)):_0x399165['toVersion']===_0x43e72e&&_0x399165['fromVersion']===_0xd7c01f?_0x16d814=!0x1:(_0x3829b0['toVersion']===_0x43e72e&&_0x3829b0['fromVersion']===_0xd7c01f||this['_fixRevision']({'revision':_0x3829b0,'from':_0xd7c01f,'to':_0x43e72e}),_0x16d814=!0x0),_0x16d814&&(delete _0x399165['fromVersion'],delete _0x399165['toVersion'],delete _0x399165['diffData'],delete _0x399165['createdAt'],delete _0x399165['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0x399165),this['_preventResendingRevisionData'](_0x399165);}else this['_revisionTracker']['addRevisionData'](_0x399165);}const _0x9563f2=_0x76aff2['getRevisions']();_0x9563f2['reverse']();for(let _0x53dfe7=0x0;_0x53dfe7<_0x9563f2['length']-0x1;_0x53dfe7++){const _0x5537a4=_0x9563f2[_0x53dfe7],_0x5fe438=_0x9563f2[_0x53dfe7+0x1];if(_0x5537a4['fromVersion']<_0x5fe438['toVersion']){const _0x5b7919=_0x5fe438['toVersion'],_0x562443=Math['max'](_0x5b7919,_0x5537a4['toVersion']);this['_fixRevision']({'revision':_0x5537a4,'from':_0x5b7919,'to':_0x562443});}}}['_fixRevision']({revision:_0x2c7143,from:_0x595468,to:_0x5eb39d}={}){const _0x34a894=this['editor']['plugins']['get'](_0x12033b),_0x1f0899=this['_revisionTracker']['buildRevisionData']({'revision':_0x2c7143,'from':_0x595468,'to':_0x5eb39d});_0x1f0899['authors']=_0x1f0899['authorsIds']['map'](_0x22bac8=>_0x34a894['getUser'](_0x22bac8)),_0x2c7143['_update'](_0x1f0899);}['_preventResendingRevisionData'](_0x1c17a2){const _0x34abdc={};_0x34abdc['id']=_0x1c17a2['id'];for(const _0x355467 of Object['keys'](_0x1c17a2))'id'!==_0x355467&&(_0x34abdc[_0x355467]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0x34abdc['id'],_0x34abdc,!0x0);}async['_fetchMissingUsers'](_0xdd7a3f){const _0x2ea2a4=this['editor']['plugins']['get'](_0x12033b),{connection:_0x385ce9}=this['editor']['plugins']['get'](n),_0x5d3500=new Set();for(const _0x1bfd02 of _0xdd7a3f){for(const _0x560f90 of _0x1bfd02['authorsIds'])_0x2f68c0(_0x560f90);_0x1bfd02['creatorId']&&_0x2f68c0(_0x1bfd02['creatorId']);}if(0x0===_0x5d3500['size'])return;const _0x25ac08=await lt['getMany'](_0x385ce9,Array['from'](_0x5d3500));for(const _0x5ccd09 of _0x25ac08)_0x2ea2a4['getUser'](_0x5ccd09['id'])||_0x2ea2a4['addUser'](_0x5ccd09);function _0x2f68c0(_0x4040c8){_0x2ea2a4['getUser'](_0x4040c8)||_0x5d3500['add'](_0x4040c8);}}}function st(_0x26c6ee){return _0x26c6ee['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0x26c6ee['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x26c6ee['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class mt extends _0x4f70c8{static get['requires'](){return['RevisionHistory',c,a];}static get['pluginName'](){return'RealTimeCollaborativeRevisionHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class b extends _0x4c7c82{['_collapseAt'];constructor(_0x506342,_0x542318=0x6){super(_0x506342);const _0xcde1b6=this['bindTemplate'];this['set']('isHidden',!0x0),this['set']('usersCount',0x0),this['_collapseAt']=_0x542318,this['bind']('isHidden')['to'](this,'usersCount',_0x35ca53=>_0x35ca53<_0x542318),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item',_0xcde1b6['if']('isHidden','ck-presence-list__counter--hidden')],'role':'listitem'},'children':[{'tag':'div','attributes':{'class':['ck','ck-presence-list__users-counter']},'children':[{'tag':'div','attributes':{'class':['ck','ck-presence-list__users-counter__text']},'children':[{'text':_0xcde1b6['to']('usersCount',_0x45796b=>'+'+(_0x45796b-this['_collapseAt']+0x2)['toString']())}]}]}]});}}class is extends _0x4c7c82{['items'];['keystrokes'];constructor(_0x2b4bb4){super(_0x2b4bb4);const _0x4703b5=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0x490620(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0x4703b5['if']('hasPopup'),'aria-expanded':_0x4703b5['to']('isExpanded',_0x5ad456=>this['hasPopup']&&String(_0x5ad456)),'aria-label':_0x4703b5['to']('hasPopup',_0x27d27f=>V(_0x2b4bb4,_0x27d27f?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0x4703b5['to']('hasPopup',_0x28b49c=>!!_0x28b49c&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items'],'on':{'mouseenter':_0x4703b5['to'](()=>this['fire']('presencelist:show')),'mouseleave':_0x4703b5['to'](_0x46188a=>{const _0x3d0b1f=_0x46188a,_0x5223b3=document['querySelector']('.ck-presence-list__dropdown-list'),_0x5b585c=document['querySelector']('.ck-balloon-panel_with-arrow');_0x5223b3?.['contains'](_0x3d0b1f['relatedTarget'])||_0x5b585c?.['contains'](_0x3d0b1f['relatedTarget'])||this['fire']('presencelist:hide');})}}),this['on']('change:hasPopup',(_0xc8db4,_0x48c89a,_0x19a2d4)=>{this['element']&&(_0x19a2d4?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 v extends _0x4c7c82{['counterView'];['inlineListView'];constructor(_0x1ef353,_0xe798e5=0x6){super(_0x1ef353);const _0x5ee057=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new b(this['locale'],_0xe798e5),this['inlineListView']=new is(_0x1ef353),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x51946f of this['inlineListView']['items'])_0x51946f['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',_0x5ee057['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['inlineListView']]});}}class L extends _0x4c7c82{['listWrapperView'];constructor(_0x2a9d44,_0x2247c1){super(_0x2a9d44);const _0x4dd08e=this['bindTemplate'];this['listWrapperView']=new pt(_0x2a9d44,_0x2247c1),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':V(_0x2a9d44,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']],'on':{'mouseleave':_0x4dd08e['to'](_0x43ef1b=>{const _0x1fc9b2=_0x43ef1b,_0x17272b=document['querySelector']('.ck-presence-list__list'),_0x45baf9=document['querySelector']('.ck-balloon-panel_with-arrow');_0x17272b?.['contains'](_0x1fc9b2['relatedTarget'])||_0x45baf9?.['contains'](_0x1fc9b2['relatedTarget'])||this['fire']('presencelist:hide');})}});}}class pt extends _0x4e50d2{constructor(_0x38125e,_0x4376c3){super(_0x38125e);const _0x4d78d3=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0x4376c3?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0x4d78d3['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0x4d78d3['to']('role'),'aria-label':_0x4d78d3['to']('ariaLabel'),'aria-labelledby':_0x4d78d3['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0x5b5001['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0x14f4b3=this['element'];_0x14f4b3&&(this['_isScrollable']=Math['max'](_0x14f4b3['scrollHeight'],_0x14f4b3['clientHeight'])>0.8*window['innerHeight']);}}class j extends rt{['userView'];constructor(_0x857440,_0x5a29fd,_0x2a3b6f){super(_0x857440);const _0xc999ba=this['bindTemplate'];this['userView']=new ct(_0x857440,_0x5a29fd);const _0x7f42ed={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0x5a29fd['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0x5a29fd['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x5a29fd['color']['getBackgroundColorClass']()],'aria-hidden':'true'}}]};_0x2a3b6f&&(_0x7f42ed['tag']='button',_0x7f42ed['on']={'click':_0xc999ba['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x7f42ed);}['focus'](){this['element']['focus']();}}class A extends _0x4c7c82{['userView'];['markerView'];constructor(_0x29671d,_0x1bb2e1,_0x1d2312){super(_0x29671d);const _0x2d7ce9=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new ct(_0x29671d,_0x1bb2e1),this['markerView']=new at(_0x29671d,_0x1bb2e1);const _0x558225=new ot(_0x29671d);_0x558225['template']['tag']='span',_0x558225['text']=_0x1bb2e1['name'];const _0x4b1816={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0x2d7ce9['to']('isFocusable',_0x2427f8=>!!_0x2427f8&&0x0),'aria-labelledby':_0x558225['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0x2d7ce9['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0x2d7ce9['to']('hasTooltip',_0x29ce46=>!_0x29ce46),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0x558225]};_0x1d2312&&(_0x4b1816['tag']='button',_0x4b1816['on']={'click':_0x2d7ce9['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x4b1816);}}class at extends _0x4c7c82{constructor(_0x480579,_0x2dae71){super(_0x480579),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x2dae71['color']['getBackgroundColorClass']()],'aria-hidden':'true'}});}}const x={'collapseAt':0x6,'displayMe':!0x0};class r extends _0x34f6b7{['currentDisplayedUsers'];['balloonPanelView'];['view'];['presenceDropdownView'];['_bodyCollection']=null;static get['pluginName'](){return'PresenceListUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0xdf3da3){super(_0xdf3da3),this['context']['config']['define']('presenceList',x);const _0x5effcc=_0xdf3da3['config']['get']('presenceList.collapseAt');if('number'!=typeof _0x5effcc)throw new _0x1b863e('presencelist-collapseat-invalid-format',this);if(_0x5effcc<0x1)throw new _0x1b863e('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](i)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0x500cda(),this['balloonPanelView']=new _0x501a5c(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get['requires'](){return[i];}['init'](){for(const _0x141ba6 of this['_allConnectedUsers'])this['_handleUserAdd'](_0x141ba6);this['listenTo'](this['_allConnectedUsers'],'add',(_0x1040ae,_0x2313a3)=>{this['_handleUserAdd'](_0x2313a3);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0x18087c,_0x548162)=>{this['_handleUserRemove'](_0x548162);});}['_createView'](){const _0x88841c=this['context'],_0x2091cd=new v(this['context']['locale'],this['context']['config']['get']('presenceList.collapseAt')),_0x150b84=this['balloonPanelView'];if(!_0x189cec(_0x88841c['config']['get']('presenceList.container')))throw new _0x1b863e('presencelist-missing-container',this);return _0x2091cd['counterView']['bind']('usersCount')['to'](this),_0x2091cd['bind']('isCollapsed')['to'](this,'usersCount',_0x3ab795=>{const {collapseAt:_0x4fcf5a}=_0x88841c['config']['get']('presenceList'),_0x52a555=_0x3ab795>=_0x4fcf5a;if(_0x52a555&&!_0x2091cd['inlineListView']['items']['find'](_0x3de8aa=>_0x3de8aa instanceof b)){const _0x4b6ba6=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['currentDisplayedUsers']['length']==_0x4b6ba6&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](this['currentDisplayedUsers']['length']-0x1),_0x2091cd['inlineListView']['items']['add'](_0x2091cd['counterView']);}return _0x52a555||this['hideDropdown'](),_0x52a555;}),_0x2091cd['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0xf5a11=>{const _0x37c3ed=_0x88841c['config']['get']('presenceList'),_0x331afc=new A(_0x88841c['locale'],_0xf5a11,!!_0x37c3ed['onClick']);return _0x331afc['bind']('hasTooltip')['to'](_0x2091cd,'isCollapsed',_0x3f69db=>!_0x3f69db),_0x331afc['bind']('isFocusable')['to'](_0x2091cd,'isCollapsed',_0x3c3f44=>!_0x3c3f44),_0x37c3ed['onClick']&&this['listenTo'](_0x331afc,'execute',()=>{this['view']['isCollapsed']||_0x37c3ed['onClick'](_0xf5a11,_0x331afc['element']);}),_0x331afc;}),this['listenTo'](_0x2091cd['inlineListView'],'presencelist:show',()=>{this['view']['isCollapsed']&&this['showDropdown']();}),this['listenTo'](_0x2091cd['inlineListView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();}),_0x2091cd['inlineListView']['keystrokes']['set']('Enter',(_0x342eaf,_0x5446f7)=>{this['view']['isCollapsed']&&(this['showDropdown'](),_0x5446f7());}),_0x2091cd['render'](),_0x150b84['render'](),_0xb632d8({'emitter':_0x2091cd,'activator':()=>_0x150b84['isVisible'],'contextElements':[_0x150b84['element'],_0x2091cd['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0x88841c['config']['get']('presenceList.container')['appendChild'](_0x2091cd['element']),this['_bodyCollection']=new _0x262a4c(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_bodyCollection']['add'](this['balloonPanelView']),_0x2091cd;}['_handleUserAdd'](_0x596af3){if(!this['context']['config']['get']('presenceList.displayMe')&&_0x596af3['isMe'])return;const _0x52d847=this['context']['config']['get']('presenceList.collapseAt')-0x1;for(this['usersCount']++;this['currentDisplayedUsers']['length']>=_0x52d847-(this['view']['isCollapsed']?0x1:0x0)&&this['currentDisplayedUsers']['length']>0x1;)this['currentDisplayedUsers']['remove'](0x1);const _0x6e3741=_0x596af3['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0x596af3,_0x6e3741);}['_handleUserRemove'](_0x2fd8a8){this['usersCount']--;const {collapseAt:_0x555267}=this['context']['config']['get']('presenceList'),_0x55e69b=this['usersCount']>=_0x555267;if(this['currentDisplayedUsers']['get'](_0x2fd8a8['id']))this['currentDisplayedUsers']['remove'](_0x2fd8a8['id']);else{if(_0x55e69b&&this['currentDisplayedUsers']['length']+0x1===_0x555267-0x1)return;}if(this['currentDisplayedUsers']['length']+(_0x55e69b?0x1:0x0)<this['usersCount']){for(const _0x3685e5 of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0x3685e5['id'])&&(this['currentDisplayedUsers']['add'](_0x3685e5,Math['min'](this['currentDisplayedUsers']['length']-(_0x55e69b?0x1:0x0),0x1)),this['currentDisplayedUsers']['length']+(_0x55e69b?0x1:0x0)===_0x555267-0x1))return;}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0x53a4cd=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new L(this['context']['locale'],!!_0x53a4cd['onClick']),this['view']['inlineListView']['isExpanded']=!0x0,this['listenTo'](this['presenceDropdownView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();});const {listWrapperView:_0x282cd1}=this['presenceDropdownView'];_0x282cd1['items']['bindTo'](this['_allConnectedUsers'])['using'](_0x1e713c=>{if(!_0x53a4cd['displayMe']&&_0x1e713c['isMe'])return null;const _0x45528e=new j(this['context']['locale'],_0x1e713c,!!_0x53a4cd['onClick']);return _0x53a4cd['onClick']&&this['listenTo'](_0x45528e,'execute',()=>{_0x53a4cd['onClick'](_0x1e713c,_0x45528e['element']);}),_0x45528e;}),this['balloonPanelView']['content']['add'](this['presenceDropdownView']),this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element']}),_0x282cd1['focus'](),_0x282cd1['checkIfScrollable']();const _0xbd8d49=(_0x47f2d9,_0x1440e5)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0x1440e5();};_0x282cd1['keystrokes']['set']('Esc',_0xbd8d49),_0x282cd1['keystrokes']['set']('Shift+Tab',_0xbd8d49),_0x282cd1['keystrokes']['set']('Tab',(_0x405c8a,_0x4f2211)=>{!function(_0x1bd4fa){const _0x3cc46e=['a','button','input','select','textarea','[tabindex]','[contenteditable]']['map'](_0x10b5f5=>_0x10b5f5+':not([disabled]):not([tabindex=\x22-1\x22])')['join'](','),_0x10f7f8=[...document['body']['querySelectorAll'](_0x3cc46e)]['filter'](_0x5ebdf3=>_0x5ebdf3===document['activeElement']||_0x5ebdf3['offsetWidth']+_0x5ebdf3['offsetHeight']>0x0)['sort']((_0x178717,_0x296b83)=>(_0x178717['tabIndex']||0x0)-(_0x296b83['tabIndex']||0x0)),_0x49bea3=_0x10f7f8['indexOf'](_0x1bd4fa),_0x2a0095=_0x10f7f8[(_0x49bea3+0x1)%_0x10f7f8['length']];_0x2a0095&&_0x2a0095['focus']();}(this['view']['element']),this['hideDropdown'](),_0x4f2211();}),_0x282cd1['focusTracker']['add'](this['view']['element']),_0x282cd1['focusTracker']['on']('change:isFocused',(_0x2a5fe5,_0x26f8e6,_0x18f495)=>{_0x18f495||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 gt extends _0x34f6b7{static get['requires'](){return[i,r];}static get['pluginName'](){return'PresenceList';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}export{s as CloudServicesCommentsAdapter,c as CloudServicesRevisionHistoryAdapter,m as CloudServicesTrackChangesAdapter,gt as PresenceList,r as PresenceListUI,l as RealTimeCollaborationClient,g as RealTimeCollaborativeComments,a as RealTimeCollaborativeEditing,mt as RealTimeCollaborativeRevisionHistory,ft as RealTimeCollaborativeTrackChanges,i as Sessions,n as WebSocketGateway};
|