@ckeditor/ckeditor5-real-time-collaboration 47.7.0-alpha.4 → 47.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/real-time-collaboration.js +1 -1
- package/dist/index.js +6 -6
- package/package.json +14 -14
- package/src/presencelist/presencelistui.js +1 -1
- package/src/presencelist/view/presencedropdownlistview.js +1 -1
- package/src/presencelist/view/presenceinlinelistview.js +1 -1
- package/src/presencelist/view/presencelistview.js +1 -1
- package/src/realtimecollaborativecomments/cloudservicescommentsadapter.js +2 -2
- package/src/realtimecollaborativeediting/realtimecollaborationclient.js +2 -2
- package/src/realtimecollaborativeediting/sessions.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
|
-
((()=>ht)());static ['initialReconnectionInterval']=0x3e8;['connection'];['_reconnectionStack'];['_shouldPluginsReconnect'];['_domEmitter'];static get['requires'](){return['CloudServices',_0x3d92e2];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0xa53ddd){super(_0xa53ddd),this['set']('state',te['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=new(_0x72feab())();}['init'](){const _0x2470f2=this['context'],_0x2bf840=_0x2470f2['plugins']['get']('CloudServices'),_0x12350d=_0x2470f2['plugins']['get'](_0x3d92e2);if(!_0x2bf840['token'])throw new _0x1918b5('websocketgateway-missing-token',this);if(!_0x2bf840['webSocketUrl'])throw new _0x1918b5('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'](_0x2bf840['token'],_0x2bf840['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0x48cd7=>{if(this['connection']=_0x48cd7,this['bind']('state')['to'](_0x48cd7,'state',this,'_isBrowserOffline',(_0x245579,_0x135913)=>('connected'!==_0x245579&&(this['_shouldPluginsReconnect']=!0x0),_0x135913||_0x245579!==te['CONNECTED']?te['DISCONNECTED']:this['state']==te['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),te['CONNECTING']):te['CONNECTED'])),this['connection']['on']('error',(_0x1cc6df,_0x5b166e)=>{if('limitExceeded'!==_0x5b166e['code'])throw console['error'](_0x5b166e),new _0x1918b5('cloudservices-init',null,{'originalError':_0x5b166e});_0x12350d['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'});}),!_0x48cd7['me'])return new Promise(_0x29dbd7=>_0x48cd7['on']('change:me',_0x29dbd7));})['catch'](_0x2ff1e2=>{throw console['error'](_0x2ff1e2),new _0x1918b5('cloudservices-init',null,{'originalError':_0x2ff1e2});});}['addToReconnectionStack'](_0x306726){if('function'!=typeof _0x306726['reconnect'])throw new _0x1918b5('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0x306726))throw new _0x1918b5('websocketgateway-plugin-already-registered',this,{'name':_0x306726['constructor']['pluginName']});this['_reconnectionStack']['add'](_0x306726);}['removeFromReconnectionStack'](_0x540acf){this['_reconnectionStack']['delete'](_0x540acf);}['isInReconnectionStack'](_0x564590){return this['_reconnectionStack']['has'](_0x564590);}['_reconnect'](){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0x4fd31f=>_0x4fd31f['reconnect']())))['then'](()=>this['state']=te['CONNECTED'])['catch'](_0x32d5b4=>{throw console['error'](_0x32d5b4),new _0x1918b5('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 _0x33ae3c{['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,_0x432691];}constructor(_0x65e4ae){super(_0x65e4ae),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0xa88889(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x432691);}['init'](){const _0x536505=this['context']['plugins']['get'](n);this['listenTo'](_0x536505,'change:state',(_0x188079,_0x243b9d,_0x187d3b)=>{if('connected'!==_0x187d3b)this['channelSessions']['forEach'](_0x3a3b89=>_0x3a3b89['clear']()),this['channelConnectedUsers']['forEach'](_0x325223=>_0x325223['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x3d4108,_0x2cf005]of this['_registeredSessions'])for(const _0x8932a6 of _0x2cf005)this['_handleSessionAdd'](_0x3d4108,_0x8932a6);}}),this['_createUser'](_0x536505['connection']['me'],!0x0);}['register'](_0x15376c,_0x584ca5){if(this['_registeredSessions']['has'](_0x15376c))throw new _0x1918b5('sessions-register-already-registered',null,{'channelId':_0x15376c});this['_registeredSessions']['set'](_0x15376c,_0x584ca5),this['channelSessions']['set'](_0x15376c,new _0xa88889()),this['channelConnectedUsers']['set'](_0x15376c,new _0xa88889()),this['listenTo'](_0x584ca5,'add',(_0x20ea18,_0x3bfabd)=>this['_handleSessionAdd'](_0x15376c,_0x3bfabd)),this['listenTo'](_0x584ca5,'remove',(_0x2a48a3,_0x124eaa)=>this['_handleSessionRemove'](_0x15376c,_0x124eaa));for(const _0x5aefb8 of _0x584ca5)this['_handleSessionAdd'](_0x15376c,_0x5aefb8);}['unregister'](_0x314ca5){if(!this['_registeredSessions']['has'](_0x314ca5))throw new _0x1918b5('sessions-unregister-not-exist',null,{'channelId':_0x314ca5});const _0xb2b663=this['_registeredSessions']['get'](_0x314ca5);this['stopListening'](_0xb2b663);for(const _0x453a88 of _0xb2b663)'connected'===this['context']['plugins']['get'](n)['state']&&this['_handleSessionRemove'](_0x314ca5,_0x453a88);this['_registeredSessions']['delete'](_0x314ca5),this['channelSessions']['delete'](_0x314ca5),this['channelConnectedUsers']['delete'](_0x314ca5);}get['mySessionId'](){return this['context']['plugins']['get'](n)['connection']['sessionId'];}['getUserBySessionId'](_0x110a63){for(const _0x126d26 of this['channelSessions']['values']())for(const _0x396ada of _0x126d26)if(_0x396ada['id']===_0x110a63)return _0x396ada['user'];}['getUserSessions'](_0x52a567,_0x504d14){const _0x420fdb=_0x504d14?[this['channelSessions']['get'](_0x504d14)]:this['channelSessions']['values'](),_0x32a376=new Set();for(const _0x3bbdcf of _0x420fdb)for(const _0x434cc3 of _0x3bbdcf)_0x434cc3['user']['id']===_0x52a567['id']&&_0x32a376['add'](_0x434cc3['id']);return _0x32a376;}['getUserRole'](_0x28a7f6){for(const _0xe1c69c of this['channelSessions']['values']())for(const _0x582a4c of _0xe1c69c)if(_0x582a4c['user']===_0x28a7f6)return _0x582a4c['role'];}['_handleSessionAdd'](_0x32eeae,_0x4a73eb){if('connected'!==this['context']['plugins']['get'](n)['state'])return;const _0x3982df=_0x4a73eb['user'],_0x44bd0a=this['_users']['getUser'](_0x3982df['id'])||this['_createUser'](_0x3982df),_0x3a2b07=Object['assign']({},_0x4a73eb,{'user':_0x44bd0a});if(this['channelSessions']['get'](_0x32eeae)['add'](_0x3a2b07),!_0x3982df['hiddenInPresenceList']){const _0x4f58cf=this['channelConnectedUsers']['get'](_0x32eeae);_0x4f58cf['has'](_0x44bd0a['id'])||_0x4f58cf['add'](_0x44bd0a),this['allConnectedUsers']['has'](_0x44bd0a['id'])||_0x3982df['hiddenInPresenceList']||this['allConnectedUsers']['add'](_0x44bd0a,_0x44bd0a['isMe']?0x0:void 0x0);}this['fire']('sessionAdd:'+_0x32eeae,{'channelId':_0x32eeae,'session':_0x3a2b07});}['_handleSessionRemove'](_0x2392c9,_0x154432){if('connected'!==this['context']['plugins']['get'](n)['state'])return;const _0x3b908a=this['channelConnectedUsers']['get'](_0x2392c9),_0x2bb9f2=_0x154432['user'];_0x2bb9f2['id']&&(this['channelSessions']['get'](_0x2392c9)['remove'](_0x154432['id']),_0x3b908a['has'](_0x2bb9f2['id'])&&!this['getUserSessions'](_0x2bb9f2,_0x2392c9)['size']&&_0x3b908a['remove'](_0x2bb9f2['id']),this['allConnectedUsers']['get'](_0x2bb9f2['id'])&&!this['getUserSessions'](_0x2bb9f2)['size']&&this['allConnectedUsers']['remove'](_0x2bb9f2['id']));}['_createUser'](_0x5dc2d4,_0x44f08f){const _0xa7c531=this['_users']['addUser'](_0x5dc2d4);return _0x44f08f&&this['_users']['defineMe'](_0x5dc2d4['id']),_0xa7c531['orderNumber']=this['_uniqueUsersCount']++,_0xa7c531;}}class H extends _0xdfadc0{['_domEmitter']=new(_0x72feab())();static get['requires'](){return[i];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x367f85=this['editor'],_0x4f6440=_0x367f85['plugins']['get'](i);_0x367f85['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x49d776,{writer:_0x34675b})=>function(_0x3db8cc,_0x2c894c,_0x4d0dd6,_0x206b79){const _0x2f7c86=_0x3db8cc['markerName']['split'](':')[0x2],_0x26d9a3=_0x4d0dd6['getUserBySessionId'](_0x2f7c86);if(!_0x26d9a3||_0x2f7c86===_0x4d0dd6['mySessionId'])return;if(!_0x206b79['model']['schema']['checkChild'](_0x3db8cc['markerRange']['start'],'$text'))return;const _0x350236={'class':'ck-user__marker\x20'+_0x26d9a3['color']['getMarkerClass'](),'data-name':_0x26d9a3['name'],'data-session-id':_0x2f7c86},_0x77211e=_0x206b79['model']['markers']['get'](_0x3db8cc['markerName']),_0x201d0b=_0x77211e['getStart'](),_0x2993fd=_0x201d0b['nodeAfter'],_0x314b52=_0x206b79['model']['schema'];if(_0x2993fd&&_0x314b52['isObject'](_0x2993fd)&&_0x314b52['isInline'](_0x2993fd)&&!_0x206b79['model']['markers']['get']('user:range:'+_0x2f7c86)['getRange']()['isCollapsed'])return;const _0x261da7=_0x201d0b['parent'];return _0x206b79['model']['schema']['isLimit'](_0x261da7)&&!_0x206b79['model']['hasContent'](_0x261da7)&&(_0x350236['contenteditable']=!0x1),function(_0x49f194,_0x59fd20,_0x4b8e0a){const _0x55d772=_0x49f194['createUIElement']('span',_0x59fd20);return _0x49f194['setCustomProperty']('userPositionMarker',!0x0,_0x55d772),_0x55d772['render']=function(_0x23f3ab){const _0x25db9c=this['toDomElement'](_0x23f3ab),_0x249703=document['createElement']('span');return _0x249703['classList']['add']('ck-user__marker-tooltip'),_0x249703['setAttribute']('contenteditable','false'),_0x249703['setAttribute']('spellcheck','false'),_0x249703['textContent']=_0x4b8e0a['name'],_0x25db9c['innerHTML']='<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span>'+_0x249703['outerHTML']+'',_0x25db9c['addEventListener']('mouseenter',()=>{_0x25db9c['classList']['add']('ck-user__marker_hovered');}),_0x25db9c['addEventListener']('mouseleave',()=>{_0x25db9c['classList']['remove']('ck-user__marker_hovered');}),_0x25db9c;},_0x55d772['isSimilar']=function(_0x2e262c){return!(!this['getCustomProperty']('userPositionMarker')||!_0x2e262c['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0x2e262c['getAttribute']('data-session-id'));},_0x55d772;}(_0x2c894c,_0x350236,_0x26d9a3);}(_0x49d776,_0x34675b,_0x4f6440,_0x367f85)}),_0x367f85['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0x44a8e5=>function(_0x390bed,_0x351994){const _0x410e6e=_0x390bed['markerName']['split'](':')[0x2];if(_0x410e6e===_0x351994['mySessionId'])return null;const _0x1efc43=_0x351994['getUserBySessionId'](_0x410e6e);if(!_0x1efc43)return{'id':_0x410e6e,'classes':[]};return{'id':_0x410e6e,'classes':['ck-user__selection',_0x1efc43['color']['getSelectionClass']()],'attributes':{'data-session-id':_0x410e6e},'priority':0x7d0+_0x1efc43['orderNumber']};}(_0x44a8e5,_0x4f6440)}),function(_0x189c9c){const _0x37e0a9=_0x189c9c['model'],_0x5421a8=new Map(),_0x805411=_0x189c9c['plugins']['get'](i);_0x37e0a9['markers']['on']('update:user:range',(_0x1ac159,_0x4ba75e,_0x3b36bf,_0x29ff67)=>{if(!_0x29ff67&&_0x5421a8['get'](_0x4ba75e['name']))return _0x5421a8['get'](_0x4ba75e['name'])['detach'](),void _0x5421a8['delete'](_0x4ba75e['name']);const _0x2af9df=_0x4ba75e['name']['split'](':')[0x2];if(_0x2af9df===_0x805411['mySessionId'])return;const _0x5389db='user:position:'+_0x2af9df;_0x37e0a9['markers']['has'](_0x5389db)&&_0x189c9c['editing']['reconvertMarker'](_0x5389db),_0x4ba75e['on']('change:range',(_0x8a089d,_0x243239,_0x681b32)=>{if('$graveyard'!=_0x243239['root']['rootName']&&'$graveyard'==_0x4ba75e['getRange']()['root']['rootName']&&!_0x5421a8['has'](_0x4ba75e['name'])){const _0x2419bc=_0x37e0a9['schema']['getNearestSelectionRange'](_0x681b32['deletionPosition']);if(_0x2419bc){const _0x5bf038=_0x528005['fromRange'](_0x2419bc);_0x5421a8['set'](_0x4ba75e['name'],_0x5bf038),_0x5bf038['on']('change:range',(_0x422df4,_0x1d7b87,_0x470e8c)=>{if('$graveyard'==_0x5bf038['root']['rootName']){const _0x14fe6a=_0x37e0a9['schema']['getNearestSelectionRange'](_0x470e8c['deletionPosition']);_0x14fe6a?(_0x5bf038['start']=_0x14fe6a['start'],_0x5bf038['end']=_0x14fe6a['end']):(_0x5421a8['delete'](_0x4ba75e['name']),_0x5bf038['detach']());}});}}});}),_0x37e0a9['document']['on']('change',()=>{_0x5421a8['size']>0x0&&_0x37e0a9['enqueueChange']({'isUndoable':!0x1},_0x28713f=>{for(const [_0x846562,_0x28046b]of _0x5421a8)'$graveyard'==_0x37e0a9['markers']['get'](_0x846562)['getRange']()['root']['rootName']&&(Z(_0x846562['split'](':')[0x2],_0x28046b['toRange'](),_0x37e0a9,_0x28713f),_0x28046b['detach']());_0x5421a8['clear']();});});}(_0x367f85),this['_domEmitter']['listenTo'](_0x5586e3['document'],'keydown',(_0x13586e,{key:_0x3f0d98})=>{'Escape'===_0x3f0d98&&function(_0x4d9a9e){_0x4d9a9e['editing']['view']['change'](_0x3c8f62=>{for(const _0x5132d2 of _0x4d9a9e['model']['markers']){if(!_0x5132d2['name']['startsWith']('user:position'))continue;const _0x37d99d=_0x4d9a9e['editing']['mapper']['markerNameToElements'](_0x5132d2['name']);if(_0x37d99d){for(const _0x55c196 of _0x37d99d)_0x3c8f62['removeClass']('ck-user__marker_hovered',_0x55c196);}}});}(_0x367f85);},{'useCapture':!0x0});}['afterInit'](){const _0x35e705=this['editor'],_0x2c7dd7=_0x35e705['commands']['get']('undo');_0x2c7dd7&&_0x35e705['model']['on']('applyOperation',(_0x25c18b,_0x5e490f)=>{const _0x51f830=_0x5e490f[0x0];if(!_0x51f830['isDocumentOperation'])return;if('marker'!=_0x51f830['type']||!_0x51f830['name']['startsWith']('user:'))return;const _0x59839a=_0x51f830['batch'];_0x2c7dd7['_createdBatches']['has'](_0x59839a)&&(_0x51f830['newRange']=_0x51f830['oldRange']?_0x35e705['model']['createRange'](_0x51f830['oldRange']['start'],_0x51f830['oldRange']['end']):null);},{'priority':'highest'});}['destroy'](){return this['_domEmitter']['stopListening'](),super['destroy']();}['createUserMarkerOperations'](){const _0x2cbdcd=this['editor'],_0x5f10f4=_0x2cbdcd['model']['document'],_0x1e1836=_0x2cbdcd['plugins']['get'](i);_0x2cbdcd['model']['enqueueChange']({'isUndoable':!0x1},_0x38df74=>{const _0x479ebe='user:range:'+_0x1e1836['mySessionId'],_0x38ba89='user:position:'+_0x1e1836['mySessionId'],_0xa7364c=_0x2cbdcd['model']['markers']['has'](_0x479ebe);_0x2cbdcd['editing']['view']['hasDomSelection']?Z(_0x1e1836['mySessionId'],_0x5f10f4['selection']['getFirstRange'](),_0x2cbdcd['model'],_0x38df74):_0xa7364c&&(_0x38df74['removeMarker'](_0x479ebe),_0x38df74['removeMarker'](_0x38ba89));});}}function Z(_0x3e300f,_0x4a299d,_0x408a59,_0x5b330b){const _0x10a683='user:range:'+_0x3e300f,_0x3ecac5='user:position:'+_0x3e300f,_0x340d48=_0x4a299d['getContainedElement']();let _0x3154b8=_0x4a299d['start'];if(_0x340d48&&_0x340d48['is']('element','tableCell')){const _0x5909d5=function(_0x18f247,_0x53dd3d){for(const _0x884827 of _0x18f247['getPositions']())if(_0x53dd3d['schema']['checkChild'](_0x884827,'$text'))return _0x884827;}(_0x4a299d,_0x408a59);_0x5909d5&&(_0x3154b8=_0x5909d5,_0x4a299d=_0x5b330b['createRange'](_0x3154b8));}const _0x9c921c=_0x5b330b['createRange'](_0x3154b8);_0x408a59['markers']['has'](_0x10a683)?(_0x5b330b['updateMarker'](_0x10a683,{'range':_0x4a299d}),_0x5b330b['updateMarker'](_0x3ecac5,{'range':_0x9c921c})):(_0x5b330b['addMarker'](_0x10a683,{'range':_0x4a299d,'usingOperation':!0x0}),_0x5b330b['addMarker'](_0x3ecac5,{'range':_0x9c921c,'usingOperation':!0x0}));}function V(_0x37bca9,_0x25bbf5,_0x4446a4){const _0x2f4782=_0x37bca9['t'],t=_0x37bca9['t'];switch(_0x25bbf5){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 _0x2f4782({'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'},_0x4446a4);default:return'';}}let G=0x1;class l extends _0xdfadc0{static ['CollaborativeEditingService']=/* #__PURE__ -- @preserve */
|
|
25
|
-
((()=>_0xb7a2de)());['_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,_0x2ac7cc,_0x432691,_0x3d92e2];}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 _0x11fff7=this['serverHistory']['getOperations']();for(let _0x35da7b=_0x11fff7['length']-0x1;_0x35da7b>=0x0;_0x35da7b--){const _0x82a9bf=_0x11fff7[_0x35da7b];if(!this['_disconnectionOperations']['has'](_0x82a9bf))return _0x82a9bf['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0x5d23c3){if(super(_0x5d23c3),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x376849(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0x1918b5('collaboration-missing-channelid',this);const _0x1a04f8=_0x5d23c3['config']['get']('cloudServices.bundleVersion')||nt;this['_service']=new l['CollaborativeEditingService'](_0x1a04f8,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0x1131fd(),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 _0x327f47=this['editor'],_0x4fe6c5=_0x327f47['plugins']['get'](_0x432691),_0x11af99=_0x327f47['plugins']['get'](n);this['listenTo'](_0x4fe6c5,'getOperationAuthor',(_0x3c0e69,_0x4b2f09)=>{const _0x51be91=_0x4b2f09[0x0];_0x51be91['_authorId']&&(_0x3c0e69['return']=_0x4fe6c5['getUser'](_0x51be91['_authorId']),_0x3c0e69['stop']()),null===_0x51be91['_authorId']&&(_0x3c0e69['return']=null,_0x3c0e69['stop']());},{'priority':'high'}),this['listenTo'](_0x327f47['model']['document']['selection'],'change:range',(_0x4e6bff,_0x1ff8e6)=>{_0x1ff8e6['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x327f47['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x327f47['model']['on']('applyOperation',(_0x39a043,_0x434502)=>{const _0x26ff8c=_0x434502[0x0];_0x26ff8c['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0x26ff8c),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['bind']('_isEditingAllowed')['to'](_0x11af99,'state',this,'_hasSynchronizationProblem',(_0x20756e,_0x287354)=>'connected'===_0x20756e&&!_0x287354),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x327f47['disableReadOnlyMode']('rtc-offline'):_0x327f47['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x327f47['disableReadOnlyMode']('rtc-offline'):_0x327f47['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async['reconnect'](){const _0x344da8=this['editor']['plugins']['get'](i),_0x1858f2=this['editor']['plugins']['get'](n);try{this['_isPendingUpdate']=!0x0,_0x344da8['unregister'](this['_channelId']);const _0x17df29=await this['_service']['reconnect'](_0x1858f2['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0x17df29)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x22486d=await this['_service']['getConnectedSessions']();_0x344da8['register'](this['_channelId'],_0x22486d),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x421506){if(function(_0x4291e3){return'404'===_0x4291e3['code'];}(_0x421506)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0x4ec070){return'409'===_0x4ec070['code'];}(_0x421506)){const _0x4f1777=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'](_0x4f1777);}else{if(!(_0x421506 instanceof $))throw _0x421506;this['_handleReconnectionError']();}}}}['destroy'](){const _0x13037e=this['editor']['plugins']['get'](n),_0x1109cd=this['editor']['plugins']['get'](i);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x1109cd['channelSessions']['has'](this['_channelId'])&&_0x1109cd['unregister'](this['_channelId']),_0x13037e['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async['_handleReconnectionResponse'](_0x2c3b07){if(this['sessionId']!==_0x2c3b07['sessionId']&&this['_lastSyncedOperationId']!==_0x2c3b07['lastOperationId'])throw new $();return this['sessionId']=_0x2c3b07['sessionId'],this['_handleServerResponse']([],{..._0x2c3b07,'wereChangesApplied':!0x1,'data':_0x2c3b07['data']},'reconnect');}async['_connectService'](_0x1c273f,_0x1897ef=!0x1){const {connection:_0x1e8c49}=this['editor']['plugins']['get'](n);l['CollaborativeEditingService']['getConnectedSessions'](_0x1e8c49,this['_channelId'])['then'](_0x4890b8=>this['_initSessionsHandling'](_0x4890b8))['catch'](_0x444936=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x444936);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x4d3d38,_0xb54999)=>{this['_crash']('realtimecollaborationclient-init-service-internal-error',_0xb54999);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_isConnected']=!0x1;});const _0x1b0bf6=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x1c273f);this['_isPendingUpdate']=!0x0;const _0x552dac=await this['_service']['connect'](_0x1e8c49,this['_compressOperations'](_0x1c273f),_0x1b0bf6);if(this['sessionId']=_0x552dac['sessionId'],_0x1897ef){if(!_0x552dac['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x552dac['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0x1c273f,_0x552dac,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x552dac,_0x1c273f);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}['_handleSendingSelectionMarkers'](){const _0x5309dd=this['editor']['plugins']['get'](i),_0x25f029=this['editor']['plugins']['get'](H),_0x371bf7=_0x5309dd['channelSessions']['get'](this['_channelId']);_0x371bf7&&_0x371bf7['length']>0x1?_0x25f029['createUserMarkerOperations']():this['listenTo'](_0x5309dd,'sessionAdd:'+this['_channelId'],()=>{0x2===_0x5309dd['channelSessions']['get'](this['_channelId'])['length']&&_0x25f029['createUserMarkerOperations']();});}async['_handleReceivedOperations'](_0x3ac881,_0x102be0,_0x319406,_0x5c4877){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x102be0){const _0xab7a78=this['_decompressOperations'](_0x319406,_0x5c4877);await this['_fetchMissingUsers'](_0xab7a78),this['_handleExternalOperations'](_0xab7a78,_0x102be0,_0x319406['lastOperationId'])||this['_crash']('realtimecollaborationclient-init-service-incorrect-server-operation');}}async['_connectAfterSessionHasBeenFlushed'](){this['_disconnectService']();const {locale:_0x31696c}=this['editor'];let _0x5bbac8;try{_0x5bbac8=await this['_service']['getDocumentDetails']();}catch{const _0x4c114c=V(_0x31696c,'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'](_0x4c114c);}const _0x45a218=_0x5bbac8['currentDocumentSession']||_0x5bbac8['lastDocumentSession'];if(this['_lastSyncedOperationId']!==_0x45a218['lastOperationId']){const _0x4c5f07=V(_0x31696c,'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'](_0x4c5f07);}await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);}['_disconnectService'](){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['stopListening'](this['_service']);}['_initSessionsHandling'](_0x2c9e04){const _0x1e1863=this['editor']['plugins']['get'](i);this['listenTo'](_0x1e1863,'sessionAdd:'+this['_channelId'],(_0x573cd4,{session:_0x146e5e})=>{if(_0x146e5e['id']===_0x1e1863['mySessionId']){_0x573cd4['off']();const _0x2a619e=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0x57ce0d=_0x146e5e['permissions'];_0x2a619e&&_0x2a619e['isEnabled']&&(_0x57ce0d=_0x57ce0d['filter'](_0x4ca34f=>'document:write'!==_0x4ca34f)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0x57ce0d,this['_channelId']);}}),_0x1e1863['register'](this['_channelId'],_0x2c9e04);}['_initThrowingOnDataSet'](){const _0x4a6709=this['editor']['data']['set'];this['editor']['data']['set']=(..._0x1657d6)=>{if(!_0x1657d6[_0x1657d6['length']-0x1]['suppressErrorInCollaboration'])throw new _0x1918b5('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x4a6709['apply'](this['editor']['data'],_0x1657d6);};}['_setUpDataInit'](){this['editor']['data']['on']('init',(_0x510eca,[_0x24a674])=>{if(this['_document']['version'])throw new _0x1918b5('realtimecollaborationclient-init-document-already-initialized',this);_0x510eca['stop'](),this['_setPendingAction']();const _0x57bfc9=this['editor']['config']['get']('rootsAttributes'),_0x5a9634=this['_getOperationsFromInitData'](_0x24a674,_0x57bfc9);0x0==_0x5a9634['length']&&_0x5a9634['push'](new _0x2948a2(0x0)),_0x510eca['return']=this['_connectService'](_0x5a9634)['then'](()=>{this['editor']['plugins']['get'](n)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x41885a=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x41885a))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x3b198f,[_0x208297,_0xca0a7d])=>{_0x3b198f['stop']();const _0x8ab8e9=this['editor']['model']['document']['getRoot'](_0x208297);if(!this['_knownRootNames']['has'](_0x208297)){const _0x8e10f4=_0xca0a7d&&_0xca0a7d['data']?_0xca0a7d['data']:'',_0x21449c=_0xca0a7d&&_0xca0a7d['attributes']?_0xca0a7d['attributes']:{};await this['_loadRoot'](_0x208297,_0x8e10f4,_0x21449c);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0x8ab8e9['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0x8ab8e9);});},{'priority':'high'});}async['_fetchMissingUsers'](_0x1382e9){const _0x3d675f=this['editor']['plugins']['get'](_0x432691),{connection:_0x2f5bce}=this['editor']['plugins']['get'](n),_0x52c200=new Set();for(const _0x4b7dbf of _0x1382e9){const _0x342d7f=_0x4b7dbf['_authorId'];_0x342d7f&&!_0x3d675f['getUser'](_0x342d7f)&&_0x52c200['add'](_0x342d7f);}if(0x0===_0x52c200['size'])return;const _0x5f2c0b=await lt['getMany'](_0x2f5bce,Array['from'](_0x52c200));for(const _0x381d02 of _0x5f2c0b)_0x3d675f['getUser'](_0x381d02['id'])||_0x3d675f['addUser'](_0x381d02);}['_getOperationsFromInitData'](_0x51cecc,_0x5673da={}){const _0x538f76=this['editor']['model'],_0x4ed27d=[];let _0x49875b=0x0;const _0x2a9bfd='string'==typeof _0x51cecc?{'main':_0x51cecc}:_0x51cecc;for(const _0x2baf81 of Object['keys'](_0x2a9bfd)){if(!this['_document']['roots']['has'](_0x2baf81))throw new _0x1918b5('realtimecollaborationclient-init-non-existent-root',this);const _0x37a325=this['editor']['data']['parse'](_0x2a9bfd[_0x2baf81]),_0x18c6c1=this['_document']['getRoot'](_0x2baf81),_0x32a649=new _0x25df19(_0x538f76['createPositionAt'](_0x18c6c1,0x0),_0x37a325,_0x49875b++);_0x4ed27d['push'](_0x32a649);for(const [_0x12142b,_0x20a3ef]of _0x37a325['markers']){const _0x4e77b8=_0x538f76['createRange'](_0x538f76['createPositionFromPath'](_0x18c6c1,_0x20a3ef['start']['path']['slice']()),_0x538f76['createPositionFromPath'](_0x18c6c1,_0x20a3ef['end']['path']['slice']())),_0x26be6c=new _0x4e5372(_0x12142b,null,_0x4e77b8,_0x538f76['markers'],!0x0,_0x49875b++);_0x4ed27d['push'](_0x26be6c);}}if(_0x5673da)for(const [_0x2d1598,_0x362d46]of Object['entries'](_0x5673da)){const _0x2bbfb6=_0x538f76['document']['getRoot'](_0x2d1598);if(!_0x2bbfb6)throw new _0x1918b5('multi-root-editor-root-attributes-no-root',null);for(const [_0xa560ab,_0x1f9892]of Object['entries'](_0x362d46))if(null!==_0x1f9892){const _0x1181c1=new _0x8ef2bf(_0x2bbfb6,_0xa560ab,null,_0x1f9892,_0x49875b++);_0x4ed27d['push'](_0x1181c1);}}return _0x4ed27d;}async['_loadRoot'](_0x108a0c,_0x4927b1,_0x2aeec3){this['_getOperationsFromInitData']({[_0x108a0c]:_0x4927b1},{[_0x108a0c]:_0x2aeec3})['forEach']((_0x3ae645,_0x3f7628)=>{_0x3ae645['baseVersion']=this['_document']['version']+_0x3f7628,_0x3ae645['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x3ae645);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async['_handleInitialConnectionData'](_0x379194,_0x2b7373){let _0x2edf29;this['_offset']=_0x379194['offset'];const _0x3c6310=_0x379194['wereChangesApplied']&&!_0x379194['initData'],_0x15f9cd=_0x3c6310?0x0:_0x379194['data']['baseVersion'];if(_0x2b7373['forEach'](_0x16daf4=>{_0x16daf4['_isInit']=!0x0,_0x16daf4['createdAt']=_0x379194['sessionCreatedAt'],_0x16daf4['_authorId']=null;}),_0x3c6310)_0x2edf29=_0x2b7373,this['_applyOperationsSet'](_0x2edf29,_0x3c6310);else{if(_0x379194['initData']){const _0x30fb8e=this['_getOperationsFromInitData'](_0x379194['initData']);this['_document']['history']['version']=-_0x30fb8e['length'],_0x30fb8e['forEach'](_0x4bf8f9=>{_0x4bf8f9['baseVersion']-=_0x30fb8e['length'],_0x4bf8f9['createdAt']=_0x379194['sessionCreatedAt'],_0x4bf8f9['_isInit']=!0x0,_0x4bf8f9['_authorId']=null;}),this['_applyOperationsSet'](_0x30fb8e,!0x0),this['serverHistory']['version']=-_0x30fb8e['length']+this['_offset'],this['_updateServerHistory'](_0x30fb8e);}this['_document']['history']['version']=_0x15f9cd,_0x2edf29=this['_decompressOperations'](_0x379194['data'],_0x379194['metadata']),await this['_fetchMissingUsers'](_0x2edf29),this['_applyOperationsSet'](_0x2edf29,_0x3c6310);}_0x379194['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x2edf29,_0x379194['lastOperationId']),this['_lastSyncedOperationId']=_0x379194['lastOperationId']),this['serverHistory']['version']=_0x15f9cd+this['_offset'],this['_updateServerHistory'](_0x2edf29),_0x2b7373['filter'](_0x1f65d6=>{const _0xdda5ff=this['_getAffectedRoot'](_0x1f65d6);return _0xdda5ff&&!this['_knownRootNames']['has'](_0xdda5ff);})['forEach']((_0x44c4cc,_0x5354ae)=>{_0x44c4cc['baseVersion']=this['_document']['version']+_0x5354ae,this['_saveOperationInBuffer'](_0x44c4cc);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x7fc547,_0x268440){const _0x5868d3=_0x268440&&_0x268440['message'];if(_0x5868d3&&_0x5868d3['startsWith']('realtimecollaborationclient'))throw _0x268440;const _0x28029a=this['editor']['plugins']['get'](n);throw this['_isPendingUpdate']=!0x0,_0x28029a['disconnect'](),this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0x1918b5(_0x7fc547,this['editor'],_0x5868d3?{'originalError':_0x5868d3}:void 0x0);}['_saveOperationInBuffer'](_0x469831){this['_knownOperations']['has'](_0x469831)||(this['_knownOperations']['add'](_0x469831),this['_bufferedOperations']['push'](_0x469831),this['_pendingAction']||'marker'==_0x469831['type']&&!_0x469831['affectsData']||this['_setPendingAction']());}['_sendBufferedOperationsDelayed'](_0x38ed61=!0x1){!_0x38ed61&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0x45eac9=>{_0x45eac9&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0x17dafb=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0x5614c3){return _0x5614c3['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x5614c3['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0x5614c3['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0x17dafb)||this['_crash'](_0x17dafb['message'],_0x17dafb);});},this['_currentBufferDelay']));}['_waitUntilSynced'](){return new Promise(_0x10145d=>{this['on']('change:_isPendingUpdate',()=>{_0x10145d();});});}async['_sendBufferedOperations'](){const _0x135f68=this['editor']['plugins']['get'](H);if(this['_shouldSendSelectionUpdate']()&&(_0x135f68['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x33613d=[...this['_bufferedOperations']];for(const _0x5ef4ef of _0x33613d)_0x5ef4ef['wasUndone']=this['_document']['history']['isUndoneOperation'](_0x5ef4ef);const _0x2a4bd8=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x33613d),_0x2bce3c=G++,_0x133927=this['_compressOperations'](_0x33613d),_0x10d379=await this['_service']['sendOperations'](_0x133927,_0x133927['baseVersion'],_0x2a4bd8);try{return await this['_handleServerResponse'](_0x33613d,_0x10d379,_0x2bce3c);}catch(_0x51409f){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0x51409f);}}async['_handleServerResponse'](_0x132725,_0x28fab6,_0x552d5f){if('error'in _0x28fab6)throw _0x28fab6['error'];let _0x46fa53=!0x1;if(_0x28fab6['wereChangesApplied']){_0x28fab6['lastOperationId']&&(this['_lastSyncedOperationId']=_0x28fab6['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x48b484=>!_0x132725['includes'](_0x48b484));for(const _0x48afd0 of _0x132725)_0x48afd0['createdAt']='lastOperationAcceptedAt'in _0x28fab6&&_0x28fab6['lastOperationAcceptedAt']||void 0x0;K(_0x132725,_0x28fab6['version']-_0x132725['length']),this['_updateServerHistory'](_0x132725);const _0x3e624b=_0x132725['filter'](_0x2bd799=>{if(!_0x2bd799['_isInit'])return!0x1;const _0x38ca0c=this['_getAffectedRoot'](_0x2bd799);return _0x38ca0c&&!this['_knownRootNames']['has'](_0x38ca0c);});K(_0x3e624b,this['_document']['version']),this['_applyOperationsSet'](_0x3e624b),_0x46fa53=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0xea4c62=this['_decompressOperations'](_0x28fab6['data'],_0x28fab6['metadata'])['filter'](_0x89397d=>_0x89397d['baseVersion']>=this['_lastServerVersion']);_0xea4c62['forEach'](_0x20e456=>this['_addKnownRoot'](_0x20e456)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x23b64e=>!_0x23b64e['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x23b64e))),this['_bufferedOperations']['length']&&K(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0xea4c62),_0x46fa53=this['_handleExternalOperations'](_0xea4c62,_0x28fab6['version'],_0x28fab6['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x46fa53?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}['_handleExternalOperations'](_0x548888,_0x2dcbca,_0x452677){try{const _0x5af550={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x40bacc,operationsB:_0x52293e,originalOperations:_0x3841d3}=_0x1a9e4a(_0x548888,this['_bufferedOperations'],_0x5af550);K(_0x40bacc,this['_document']['version']),K(_0x52293e,_0x2dcbca);for(const _0x11aa41 of _0x40bacc){const _0x545079=_0x3841d3['get'](_0x11aa41);_0x11aa41['_authorId']=_0x545079?_0x545079['_authorId']:null;}_0x452677&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x548888,_0x452677),this['_lastSyncedOperationId']=_0x452677),this['_bufferedOperations']=[..._0x52293e],this['_applyOperationsSet'](_0x40bacc),this['_updateServerHistory'](_0x548888);}catch(_0x5e28f4){return console['error'](_0x5e28f4),!0x1;}return!0x0;}['_applyOperationsSet'](_0x56692a,_0x6e0932=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0xc85fba=>{for(const _0x5d8e5a of _0x56692a)this['_knownOperations']['add'](_0x5d8e5a),this['_addKnownRoot'](_0x5d8e5a),_0xc85fba['batch']['addOperation'](_0x5d8e5a),this['editor']['model']['applyOperation'](_0x5d8e5a);});}['_addKnownRoot'](_0x2869da){const _0x29ed26=this['_getAffectedRoot'](_0x2869da);_0x29ed26&&this['_knownRootNames']['add'](_0x29ed26);}['_getAffectedRoot'](_0x5f5dd7){let _0x4c4261,_0x1bb95a;switch(_0x5f5dd7['type']){case'insert':_0x4c4261=_0x5f5dd7['position']['root'];break;case'marker':if(_0x1bb95a=_0x5f5dd7['newRange'],!_0x1bb95a)return null;_0x4c4261=_0x1bb95a['root'];break;case'addRootAttribute':_0x4c4261=_0x5f5dd7['root'];break;case'addRoot':_0x4c4261=_0x5f5dd7['affectedSelectable'];break;case'move':_0x4c4261=_0x5f5dd7['targetPosition']['root'];break;default:return null;}return _0x4c4261['rootName'];}['_updateServerHistory'](_0x139c78){_0x139c78['forEach'](_0x52ed91=>{const _0x719c97=_0x52ed91['clone']();_0x719c97['_authorId']=_0x52ed91['_authorId'],_0x719c97['_isInit']=!!_0x52ed91['_isInit'],_0x719c97['createdAt']=_0x52ed91['createdAt'],_0x719c97['baseVersion']+=this['_offset'],_0x52ed91['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x719c97),this['serverHistory']['addOperation'](_0x719c97);});}['_handleReconnectionError'](_0x37b986){const _0x1fcc3d=this['editor']['plugins']['get']('Notification'),_0x1237f7=this['editor']['locale'];_0x37b986||(_0x37b986=V(_0x1237f7,'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.')),_0x1fcc3d['showWarning'](_0x37b986,{'title':V(_0x1237f7,'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'](_0x2ac7cc)['add'](V(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}['_clearPendingAction'](){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x2ac7cc)['remove'](this['_pendingAction']),this['_pendingAction']=null);}['_compressOperations'](_0x50c605){const _0xb2532d=_0x50c605['map'](_0x3cceab=>_0x3cceab['toJSON']());return this['_compressor']['compress'](_0xb2532d);}['_decompressOperations'](_0x19d839,_0x173569){return this['_compressor']['decompress'](_0x19d839)['map']((_0xc2324c,_0x49828c)=>{const _0x5e2ea4='init'==_0x173569[_0x49828c]['type'];if('InsertOperation'==_0xc2324c['__className']){const _0x3bc78b=_0xc2324c['position']['root'];!this['_document']['getRoot'](_0x3bc78b)&&(this['_document']['createRoot']('$root',_0x3bc78b)['_isAttached']=!0x1);}const _0x3d0911=_0x110153['fromJSON'](_0xc2324c,this['_document']);return _0x3d0911['wasUndone']=_0xc2324c['wasUndone'],_0x3d0911['_isInit']=_0x5e2ea4,_0x3d0911['_authorId']=_0x5e2ea4?null:_0x173569[_0x49828c]['userId'],_0x3d0911['_isDisconnection']='cs:removeUser'===_0x173569[_0x49828c]['type'],_0x3d0911['createdAt']=_0x173569[_0x49828c]['createdAt'],_0x3d0911;});}['_refreshUserSelectionMarkers'](){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}['_shouldSendSelectionUpdate'](){const _0x480c48=this['editor']['plugins']['get'](i)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0x480c48&&_0x480c48['length']>0x1&&this['_hasSelectionChanged'];}['_shouldSendUpdate'](){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}}class $ extends Error{}function K(_0x543a74,_0x31540a){for(const _0x26d7cd of _0x543a74)_0x26d7cd['baseVersion']=_0x31540a++;}class J{['_ignoredOperations'];['_operationToId'];constructor(_0x4acf6b){this['_ignoredOperations']=_0x4acf6b,this['_operationToId']=new WeakMap();}['getIdOfTheLastOperation'](_0x22855b){let _0x3ba6ed=_0x22855b['length'];for(;_0x3ba6ed--;){const _0x506a02=_0x22855b[_0x3ba6ed];if(!this['_ignoredOperations']['has'](_0x506a02)){if(!this['_operationToId']['has'](_0x506a02)){const _0x11a943=_0x27b270()['slice'](0x1,0x12);this['_operationToId']['set'](_0x506a02,_0x11a943);}return this['_operationToId']['get'](_0x506a02);}}}['setIdForTheLastOperation'](_0x6f4627,_0x4e7cca){if(!_0x4e7cca)return;let _0x54447f=_0x6f4627['length'];for(;_0x54447f--;){const _0x2afe6d=_0x6f4627[_0x54447f];this['_ignoredOperations']['has'](_0x2afe6d)||this['_operationToId']['set'](_0x2afe6d,_0x4e7cca);}}}class a extends _0xdfadc0{static get['requires'](){return[l];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class s extends _0x33ae3c{static ['CommentsService']=/* #__PURE__ -- @preserve */
|
|
26
|
-
((()=>_0x5c856c)());['_services'];static get['requires'](){return[n,'CommentsRepository',i,_0x432691];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x5367fd){super(_0x5367fd),this['_services']=new Map();}async['init'](){const _0x11fee6=this['context'],_0x17a02e=_0x11fee6['plugins']['get']('CommentsRepository');if(_0x11fee6['plugins']['get'](n)['addToReconnectionStack'](this),_0x17a02e['adapter']={'addCommentThread':async({channelId:_0x3dab3d,threadId:_0x5d414d,comments:_0x5ae9d3,resolvedAt:_0x3d93e5,resolvedBy:_0x43bfba,context:_0x4308f5,attributes:_0x460ec1})=>{const _0x3d50fb=await this['_getService'](_0x3dab3d)['addCommentThread']({'commentThreadId':_0x5d414d,'comments':_0x5ae9d3['map'](_0x4e3298=>function(_0x10d18a,_0x1f958f,_0xe34020){return{'commentThreadId':_0xe34020,'commentId':_0x10d18a['commentId'],'userId':_0x10d18a['authorId'],'content':_0x10d18a['content'],'documentId':_0x1f958f,'createdAt':_0x10d18a['createdAt'],'attributes':_0x10d18a['attributes']||{}};}(_0x4e3298,_0x3dab3d,_0x5d414d)),'resolvedAt':_0x3d93e5,'resolvedBy':_0x43bfba,'context':_0x4308f5,'attributes':_0x460ec1})['catch'](dt);return{'threadId':_0x3d50fb['commentThreadId'],'comments':_0x3d50fb['comments']};},'getCommentThread':async({channelId:_0x15fedd,threadId:_0x459592})=>{const _0x7e3ca8=await this['_getService'](_0x15fedd)['getCommentThread'](_0x459592)['catch'](F)['catch'](dt);return _0x7e3ca8?_0x7e3ca8['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0x7e3ca8]),{'threadId':_0x7e3ca8['commentThreadId'],'comments':_0x7e3ca8['comments']['map'](S),'context':_0x7e3ca8['context'],'resolvedAt':_0x7e3ca8['resolvedAt'],'resolvedBy':_0x7e3ca8['resolvedBy'],'attributes':_0x7e3ca8['attributes']||{}}):null;},'updateCommentThread':async({channelId:_0x35984a,threadId:_0x250a76,context:_0x3bb6a6,unlinkedAt:_0x3abc0b,attributes:_0x2c6d17})=>this['_getService'](_0x35984a)['updateCommentThread']({'commentThreadId':_0x250a76,'context':_0x3bb6a6,'attributes':_0x2c6d17,'unlinkedAt':_0x3abc0b})['catch'](F)['catch'](dt),'resolveCommentThread':async({channelId:_0x146cab,threadId:_0x14573b})=>{const _0x9032a1=await this['_getService'](_0x146cab)['resolveCommentThread'](_0x14573b)['catch'](F)['catch'](dt);return{'threadId':_0x9032a1['commentThreadId'],'resolvedAt':_0x9032a1['resolvedAt'],'resolvedBy':_0x9032a1['resolvedBy']};},'reopenCommentThread':async({channelId:_0x238a44,threadId:_0x45be92})=>this['_getService'](_0x238a44)['reopenCommentThread'](_0x45be92)['catch'](F)['catch'](dt),'removeCommentThread':({channelId:_0x37fe25,threadId:_0x13ab82})=>this['_getService'](_0x37fe25)['removeCommentThread'](_0x13ab82)['catch'](F)['catch'](dt),'addComment':({channelId:_0x3200e7,threadId:_0x140f04,commentId:_0x1e1c0b,content:_0x1cfdfe,attributes:_0x55fe42})=>this['_getService'](_0x3200e7)['addComment'](_0x140f04,_0x1e1c0b,_0x1cfdfe,_0x55fe42)['catch'](dt),'updateComment':({channelId:_0x528e09,threadId:_0xc8544d,commentId:_0xc1ceb5,content:_0x2b617c,attributes:_0x4b4644})=>this['_getService'](_0x528e09)['updateComment'](_0xc8544d,_0xc1ceb5,_0x2b617c,_0x4b4644)['catch'](F)['catch'](dt),'removeComment':({channelId:_0x53a433,threadId:_0x40d310,commentId:_0x3cce7c})=>this['_getService'](_0x53a433)['removeComment'](_0x40d310,_0x3cce7c)['catch'](F)['catch'](dt)},_0x11fee6 instanceof _0x39aa3f){const _0x1cd14f=_0x11fee6['config']['get']('collaboration.channelId'),_0x460b99=_0x11fee6['plugins']['get'](i);await this['_setUpService'](_0x1cd14f);const _0x1a7737=await this['_services']['get'](_0x1cd14f)['getConnectedSessions']();this['listenTo'](_0x460b99,'sessionAdd:'+_0x1cd14f,(_0x53113c,{session:_0x72cba5})=>{_0x72cba5['id']===_0x460b99['mySessionId']&&(_0x53113c['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x72cba5['permissions'],_0x1cd14f));}),_0x460b99['register'](_0x1cd14f,_0x1a7737);}}async['_setUpService'](_0x4672e7){if(this['_services']['has'](_0x4672e7))throw new _0x1918b5('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0x4672e7});const _0x555090=this['context']['plugins']['get']('CommentsRepository'),_0x515823=new s['CommentsService'](_0x4672e7);this['_services']['set'](_0x4672e7,_0x515823),this['listenTo'](_0x515823,'commentThreadAdded',(_0x30ff56,_0x1394eb)=>{const {commentThreadId:_0x3af2f2,documentId:_0x1619f1,context:_0x4584ae,attributes:_0x215546,resolvedAt:_0xbfe578,resolvedBy:_0xa0c6d2,comments:_0xbe09f3}=_0x1394eb;_0x555090['getCommentThread'](_0x3af2f2)||_0x555090['addCommentThread']({'threadId':_0x3af2f2,'channelId':_0x1619f1,'comments':_0xbe09f3?_0xbe09f3['map'](S):[],'context':_0x4584ae,'attributes':_0x215546,'resolvedAt':_0xbfe578,'resolvedBy':_0xa0c6d2,'isFromAdapter':!0x0});}),this['listenTo'](_0x515823,'commentThreadUpdated',(_0x47f8b5,{commentThreadId:_0x398825,documentId:_0x347452,context:_0x54b33a,unlinkedAt:_0x54e8f5,attributes:_0x39302d})=>{_0x555090['getCommentThread'](_0x398825)&&_0x555090['updateCommentThread']({'threadId':_0x398825,'channelId':_0x347452,'context':_0x54b33a,'unlinkedAt':_0x54e8f5,'attributes':_0x39302d,'isFromAdapter':!0x0});}),this['listenTo'](_0x515823,'commentThreadResolved',(_0x52a4bc,{commentThreadId:_0x1aa99b,resolvedBy:_0x2a4b92,resolvedAt:_0x3b9128})=>{const _0x3d4042=_0x555090['getCommentThread'](_0x1aa99b);_0x3d4042&&_0x3d4042['resolve']({'resolvedBy':_0x2a4b92,'resolvedAt':_0x3b9128,'isFromAdapter':!0x0});}),this['listenTo'](_0x515823,'commentThreadReopened',(_0x2854d3,{commentThreadId:_0x270ce0})=>{const _0xa7a1c6=_0x555090['getCommentThread'](_0x270ce0);_0xa7a1c6&&_0xa7a1c6['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0x515823,'commentThreadRemoved',(_0x292b59,{commentThreadId:_0x5929dc})=>{const _0x17e4b5=_0x555090['getCommentThread'](_0x5929dc);_0x17e4b5&&_0x17e4b5['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0x515823,'commentAdded',(_0x49661d,_0x5664bd)=>{const _0x41db2=_0x5664bd['commentThreadId'],_0x5e2c47=_0x555090['getCommentThread'](_0x41db2);_0x5e2c47&&_0x5e2c47['addComment']({...S(_0x5664bd),'isFromAdapter':!0x0});}),this['listenTo'](_0x515823,'commentUpdated',(_0x578891,{commentThreadId:_0x50b356,commentId:_0x3bc676,content:_0x248325,attributes:_0x5d36e3})=>{const _0x466e01=_0x555090['getCommentThread'](_0x50b356);if(_0x466e01){const _0x137e2a=_0x466e01['getComment'](_0x3bc676);_0x137e2a&&_0x137e2a['update']({'content':_0x248325,'attributes':_0x5d36e3,'isFromAdapter':!0x0});}}),this['listenTo'](_0x515823,'commentRemoved',(_0x458c88,{commentThreadId:_0x2a21d6,commentId:_0x14f2dc})=>{const _0x2adb31=_0x555090['getCommentThread'](_0x2a21d6);if(_0x2adb31){const _0x475341=_0x2adb31['getComment'](_0x14f2dc);_0x475341&&_0x475341['remove']({'isFromAdapter':!0x0});}}),await this['_connectService'](_0x4672e7);}['destroy'](){if(this['context']instanceof _0x39aa3f){const _0x217193=this['context']['config']['get']('collaboration.channelId');this['_terminateService'](_0x217193);}}['_terminateService'](_0x31bbc5){if(!this['_services']['has'](_0x31bbc5))throw new _0x1918b5('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0x31bbc5});this['_getService'](_0x31bbc5)['disconnect'](),this['_services']['delete'](_0x31bbc5);}async['reconnect'](){for(const _0x13d01e of this['_services']['keys']())await this['_connectService'](_0x13d01e);if(this['context']instanceof _0x39aa3f){const _0x2d1d94=this['context']['config']['get']('collaboration.channelId'),_0x1cb44a=this['context']['plugins']['get'](i);_0x1cb44a['unregister'](_0x2d1d94);const _0x123115=await this['_services']['get'](_0x2d1d94)['getConnectedSessions']();_0x1cb44a['register'](_0x2d1d94,_0x123115);}}async['_connectService'](_0x148e25){const {connection:_0x48d9f1}=this['context']['plugins']['get'](n),_0xa92d8b=this['context']['plugins']['get']('CommentsRepository'),_0x1535fa=this['_services']['get'](_0x148e25),_0x5d2dbb=await _0x1535fa['connect'](_0x48d9f1);await this['_fetchMissingUsersForThreads'](_0x5d2dbb);const _0x43aa1a=new Set(Array['from'](_0xa92d8b['getCommentThreads']({'channelId':_0x148e25}),_0x3f7290=>_0x3f7290['id']));for(const _0x26d09c of _0x5d2dbb)_0x26d09c['deletedAt']||_0x43aa1a['delete'](_0x26d09c['commentThreadId']);for(const _0x2feb16 of _0x43aa1a)_0xa92d8b['getCommentThread'](_0x2feb16)['remove']({'isFromAdapter':!0x0});for(const _0x5c398e of _0x5d2dbb){let _0x35555d=_0xa92d8b['getCommentThread'](_0x5c398e['commentThreadId']);const {commentThreadId:_0x5b081a,context:_0x453390,attributes:_0x68a92f,resolvedBy:_0x1688f7,resolvedAt:_0x4221fb,unlinkedAt:_0x42cbf6,deletedAt:_0x5d813a}=_0x5c398e;if(_0x5d813a)continue;_0x35555d||(_0x35555d=_0xa92d8b['addCommentThread']({'channelId':_0x148e25,'threadId':_0x5b081a,'context':_0x453390,'attributes':_0x68a92f||{},'resolvedBy':_0x1688f7,'resolvedAt':_0x4221fb,'unlinkedAt':_0x42cbf6,'isFromAdapter':!0x0}));const _0x421799=new Set(Array['from'](_0x35555d['comments'],_0x3ce864=>_0x3ce864['id']));for(const _0x3f674c of _0x5c398e['comments'])_0x421799['delete'](_0x3f674c['commentId']);for(const _0x117fff of _0x421799)_0x35555d['getComment'](_0x117fff)['remove']({'isFromAdapter':!0x0});for(const _0x52a30d of _0x5c398e['comments']){const _0x255d7c=_0x35555d['getComment'](_0x52a30d['commentId']);_0x255d7c?_0x255d7c['content']!==_0x52a30d['content']&&_0x255d7c['update']({'content':_0x52a30d['content'],'isFromAdapter':!0x0}):_0x35555d['addComment'](Object['assign'](S(_0x52a30d),{'isFromAdapter':!0x0}));}}}['_getService'](_0x5878e0){if(!this['_services']['has'](_0x5878e0))throw new _0x1918b5('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0x5878e0});return this['_services']['get'](_0x5878e0);}async['_fetchMissingUsersForThreads'](_0x546a81){const _0x1ba662=this['context']['plugins']['get'](_0x432691),{connection:_0x59cc4e}=this['context']['plugins']['get'](n),_0x15db22=new Set();for(const {resolvedBy:_0x4deb70,comments:_0x26127e}of _0x546a81){_0x4deb70&&!_0x1ba662['getUser'](_0x4deb70)&&_0x15db22['add'](_0x4deb70);for(const {userId:_0x5e15bf}of _0x26127e)_0x1ba662['getUser'](_0x5e15bf)||_0x15db22['add'](_0x5e15bf);}if(0x0===_0x15db22['size'])return;const _0x20965f=await lt['getMany'](_0x59cc4e,Array['from'](_0x15db22));for(const _0x283291 of _0x20965f)_0x1ba662['getUser'](_0x283291['id'])||_0x1ba662['addUser'](_0x283291);}}async function F(_0x4fab62){if('404'!==_0x4fab62['code'])throw _0x4fab62;}function dt(_0x1bef79){if((_0xde0f72=_0x1bef79)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0xde0f72['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0xde0f72['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0xde0f72;throw _0x1bef79;}function S(_0xfa9b34){return{'threadId':_0xfa9b34['commentThreadId'],'commentId':_0xfa9b34['commentId'],'content':_0xfa9b34['content'],'createdAt':_0xfa9b34['createdAt'],'authorId':_0xfa9b34['userId'],'attributes':_0xfa9b34['attributes']||{}};}class m extends _0xdfadc0{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(
|
|
28
|
-
((()=>it)());['_lastRequestId'];['_revisionTracker'];['_revisionHistoryService'];['_oldOffset'];static get['requires'](){return[n,l,'RevisionHistory',i,_0x432691];}static get['pluginName'](){return'CloudServicesRevisionHistoryAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x3b1661){super(_0x3b1661);const _0x4cf91c=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new c['RevisionHistoryService'](_0x4cf91c);}async['init'](){const _0x4f4dd7=this['editor']['plugins']['get'](l),_0x2139cd=_0x4f4dd7['serverHistory'],_0xe3bcb1=this['editor']['plugins']['get'](n);this['_revisionTracker']['setSource']({'history':_0x2139cd,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0x4f4dd7['sessionId']});const _0x550d71=this['editor']['config']['get']('cloudServices.bundleVersion')||nt,_0x5ace34=await tt['isBundleUploaded'](_0xe3bcb1['connection'],_0x550d71);this['editor']['plugins']['get']('RevisionHistory')['adapter']={'getRevision':async({revisionId:_0x276265})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0x276265)),'updateRevisions':async _0x13cd8a=>{await this['_waitForServiceReady']();const _0x35743d=this['_revisionTracker']['currentRevision'];if(_0x5ace34&&0x1===_0x13cd8a['length']&&_0x13cd8a[0x0]['id']===_0x35743d['id'])return _0x13cd8a;for(const _0x29db37 of _0x13cd8a)_0x29db37['id']===_0x35743d['id']&&(_0x29db37['isEmptyCurrent']=_0x29db37['fromVersion']===_0x29db37['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0x13cd8a,this['_lastRequestId'])['then'](_0x2f04b0=>(this['_lastRequestId']=_0x2f04b0,_0x13cd8a))['catch'](_0x44dc79=>{if(st(_0x44dc79)||'400'===_0x44dc79['code']&&void 0x0!==_0x44dc79['data']['wrongRequestId']){for(const _0x39e340 of _0x13cd8a){!this['_revisionTracker']['repository']['getRevision'](_0x39e340['id'])||this['_revisionTracker']['_bufferUpdate'](_0x39e340['id'],_0x39e340,!0x1);}if(st(_0x44dc79))throw _0x44dc79;return _0x13cd8a;}throw _0x44dc79;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0x224a24,{revisionsData:_0x61be6b,requestId:_0x5ebcbf})=>{Math['max'](..._0x61be6b['map'](_0x473283=>_0x473283['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0x61be6b,_0x5ebcbf);}):this['_handleRevisionsUpdate'](_0x61be6b,_0x5ebcbf);});const {revisions:_0x50ecda,requestId:_0x1d2dd8}=await this['_revisionHistoryService']['connect'](_0xe3bcb1['connection']);_0xe3bcb1['addToReconnectionStack'](this),this['_lastRequestId']=_0x1d2dd8,await this['_fetchMissingUsers'](_0x50ecda);for(const _0x55f2c5 of _0x50ecda)this['_revisionTracker']['addRevisionData'](_0x55f2c5);this['listenTo'](_0x4f4dd7,'change:_isConnected',(_0x2592db,_0x17c6d8,_0x325033)=>{_0x325033&&(this['_oldOffset']=_0x4f4dd7['_offset'],_0x2592db['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](_0xe3bcb1,'state',_0x41e91d=>_0x41e91d===te['CONNECTED']);}async['reconnect'](){const _0x453533=this['editor']['plugins']['get'](n),_0x42e19f=this['editor']['plugins']['get'](l),_0x477d9c=async()=>{const _0x38b9f5=this['_revisionTracker']['currentRevision'],_0x416c9a=_0x38b9f5['id'],_0x51e1e6=_0x416c9a!==_0x42e19f['sessionId'];if(_0x51e1e6){const _0x422a6b=_0x42e19f['_offset']-this['_oldOffset'],_0x2d0527=this['_getLatestVersionFromServerOperations']();this['_revisionTracker']['_revisionDataBuilder']['reInit']();if(_0x38b9f5['toVersion']+_0x422a6b!==_0x2d0527){const _0x1722a9=_0x38b9f5['fromVersion']+_0x422a6b,_0x538983=this['editor']['plugins']['get'](_0x432691),_0x300bde=this['_revisionTracker']['buildRevisionData']({'revision':_0x38b9f5,'from':_0x1722a9,'to':_0x2d0527});_0x300bde['id']=_0x38b9f5['id'];const _0x2a8f07=_0x300bde['authorsIds']['map'](_0x3b852d=>_0x538983['getUser'](_0x3b852d));_0x38b9f5['_update']({..._0x300bde,'authors':_0x2a8f07},!0x0),this['_revisionTracker']['_bufferUpdate'](_0x38b9f5['id'],_0x300bde,!0x0);}this['_revisionTracker']['_startingVersion']=_0x2d0527,(_0x38b9f5['toVersion']===_0x38b9f5['fromVersion']&&!this['_revisionTracker']['_bufferedUpdates']['has'](_0x416c9a)&&this['_revisionTracker']['repository']['_revisions']['remove'](_0x416c9a),this['_revisionTracker']['_createCurrentRevision'](_0x2d0527));}const {revisions:_0x33d74a,requestId:_0x4bd23d}=await this['_revisionHistoryService']['reconnect'](_0x453533['connection'],this['_lastRequestId']);_0x51e1e6&&_0x33d74a['length']>0x0?_0x42e19f['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x33d74a),this['_handleRevisionsUpdate'](_0x33d74a,_0x4bd23d),this['_revisionTracker']['sendBufferedUpdates']());};return _0x42e19f['_isConnected']?_0x477d9c():new Promise((_0x540341,_0xed5b)=>{_0x42e19f['once']('change:_isConnected',()=>{_0x477d9c()['then'](_0x540341)['catch'](_0xed5b);});});}['destroy'](){super['destroy']();}async['_waitForServiceReady'](){this['_revisionHistoryService']['isConnected']||await new Promise(_0x5770ae=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x46e79b=>{_0x46e79b['off'](),_0x5770ae();});});}['_getLatestVersionFromServerOperations'](){const _0xb91567=this['editor']['plugins']['get'](l)['serverHistory']['getOperations']()['reverse']();for(const _0x59a35 of _0xb91567)if('marker'!==_0x59a35['type']||_0x59a35['affectsData'])return _0x59a35['baseVersion']+0x1;}['_getLatestVersion'](){const _0x74aef2=this['editor']['plugins']['get'](l);return new Promise(_0x2e168c=>{_0x74aef2['_isPendingUpdate']?_0x74aef2['once']('change:_isPendingUpdate',()=>{_0x2e168c(this['_getLatestVersionFromServerOperations']());}):_0x2e168c(this['_getLatestVersionFromServerOperations']());});}['_handleRevisionsUpdate'](_0x5ae15a,_0x39c4d8){const _0x4f7500=this['_revisionTracker']['repository'];this['_lastRequestId']=_0x39c4d8;for(const _0x15f45f of _0x5ae15a){const _0x249843=_0x4f7500['getRevision'](_0x15f45f['id']);if(_0x249843){if((_0x15f45f['fromVersion']||_0x15f45f['toVersion'])&&(_0x15f45f['diffData']=null),_0x249843===this['_revisionTracker']['currentRevision']){const _0x1ac293=Math['max'](_0x249843['toVersion'],_0x15f45f['toVersion']),_0x39a1f3=Math['max'](_0x249843['fromVersion'],_0x15f45f['fromVersion']);let _0x441f84;_0x249843['toVersion']===_0x15f45f['toVersion']&&_0x249843['fromVersion']===_0x15f45f['fromVersion']?(_0x441f84=!0x0,this['_preventResendingRevisionData'](_0x15f45f)):_0x15f45f['toVersion']===_0x1ac293&&_0x15f45f['fromVersion']===_0x39a1f3?_0x441f84=!0x1:(_0x249843['toVersion']===_0x1ac293&&_0x249843['fromVersion']===_0x39a1f3||this['_fixRevision']({'revision':_0x249843,'from':_0x39a1f3,'to':_0x1ac293}),_0x441f84=!0x0),_0x441f84&&(delete _0x15f45f['fromVersion'],delete _0x15f45f['toVersion'],delete _0x15f45f['diffData'],delete _0x15f45f['createdAt'],delete _0x15f45f['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0x15f45f),this['_preventResendingRevisionData'](_0x15f45f);}else this['_revisionTracker']['addRevisionData'](_0x15f45f);}const _0x461122=_0x4f7500['getRevisions']();_0x461122['reverse']();for(let _0x5f394e=0x0;_0x5f394e<_0x461122['length']-0x1;_0x5f394e++){const _0x1e220e=_0x461122[_0x5f394e],_0x10bce9=_0x461122[_0x5f394e+0x1];if(_0x1e220e['fromVersion']<_0x10bce9['toVersion']){const _0x3c62e3=_0x10bce9['toVersion'],_0x275894=Math['max'](_0x3c62e3,_0x1e220e['toVersion']);this['_fixRevision']({'revision':_0x1e220e,'from':_0x3c62e3,'to':_0x275894});}}}['_fixRevision']({revision:_0x25f33a,from:_0x2eb75d,to:_0x4f9ea7}={}){const _0x88e46d=this['editor']['plugins']['get'](_0x432691),_0xd090d6=this['_revisionTracker']['buildRevisionData']({'revision':_0x25f33a,'from':_0x2eb75d,'to':_0x4f9ea7});_0xd090d6['authors']=_0xd090d6['authorsIds']['map'](_0x3bead1=>_0x88e46d['getUser'](_0x3bead1)),_0x25f33a['_update'](_0xd090d6);}['_preventResendingRevisionData'](_0xd19b3c){const _0x2b7b3f={};_0x2b7b3f['id']=_0xd19b3c['id'];for(const _0x207048 of Object['keys'](_0xd19b3c))'id'!==_0x207048&&(_0x2b7b3f[_0x207048]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0x2b7b3f['id'],_0x2b7b3f,!0x0);}async['_fetchMissingUsers'](_0x32d992){const _0x2e239d=this['editor']['plugins']['get'](_0x432691),{connection:_0x5d4252}=this['editor']['plugins']['get'](n),_0x336f90=new Set();for(const _0x5e42d4 of _0x32d992){for(const _0x4498bf of _0x5e42d4['authorsIds'])_0x327b46(_0x4498bf);_0x5e42d4['creatorId']&&_0x327b46(_0x5e42d4['creatorId']);}if(0x0===_0x336f90['size'])return;const _0x8918cd=await lt['getMany'](_0x5d4252,Array['from'](_0x336f90));for(const _0x290248 of _0x8918cd)_0x2e239d['getUser'](_0x290248['id'])||_0x2e239d['addUser'](_0x290248);function _0x327b46(_0x4c813c){_0x2e239d['getUser'](_0x4c813c)||_0x336f90['add'](_0x4c813c);}}}function st(_0x31fe79){return _0x31fe79['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0x31fe79['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x31fe79['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class mt extends _0xdfadc0{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 _0x3dc104{['_collapseAt'];constructor(_0x29aa68,_0x4fd768=0x6){super(_0x29aa68);const _0x226f82=this['bindTemplate'];this['set']('isHidden',!0x0),this['set']('usersCount',0x0),this['_collapseAt']=_0x4fd768,this['bind']('isHidden')['to'](this,'usersCount',_0x39009b=>_0x39009b<_0x4fd768),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item',_0x226f82['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':_0x226f82['to']('usersCount',_0x2b2939=>'+'+(_0x2b2939-this['_collapseAt']+0x2)['toString']())}]}]}]});}}class is extends _0x3dc104{['items'];['keystrokes'];constructor(_0x15904d){super(_0x15904d);const _0x54c0cf=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0x45f8df(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0x54c0cf['if']('hasPopup'),'aria-expanded':_0x54c0cf['to']('isExpanded',_0x330214=>this['hasPopup']&&String(_0x330214)),'aria-label':_0x54c0cf['to']('hasPopup',_0x5e1d45=>V(_0x15904d,_0x5e1d45?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0x54c0cf['to']('hasPopup',_0x2b5983=>!!_0x2b5983&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items'],'on':{'mouseenter':_0x54c0cf['to'](()=>this['fire']('presencelist:show')),'mouseleave':_0x54c0cf['to'](_0x511d1b=>{const _0x19f42c=_0x511d1b,_0x48149c=document['querySelector']('.ck-presence-list__dropdown-list'),_0x265588=document['querySelector']('.ck-balloon-panel_with-arrow');_0x48149c?.['contains'](_0x19f42c['relatedTarget'])||_0x265588?.['contains'](_0x19f42c['relatedTarget'])||this['fire']('presencelist:hide');})}}),this['on']('change:hasPopup',(_0x2c3433,_0x4e4d92,_0x28feb4)=>{this['element']&&(_0x28feb4?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 _0x3dc104{['counterView'];['inlineListView'];constructor(_0xb264c3,_0xe55733=0x6){super(_0xb264c3);const _0x843c39=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new b(this['locale'],_0xe55733),this['inlineListView']=new is(_0xb264c3),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x3c6617 of this['inlineListView']['items'])_0x3c6617['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',_0x843c39['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['inlineListView']]});}}class L extends _0x3dc104{['listWrapperView'];constructor(_0xd81f2d,_0x8c2618){super(_0xd81f2d);const _0x4eb152=this['bindTemplate'];this['listWrapperView']=new pt(_0xd81f2d,_0x8c2618),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':V(_0xd81f2d,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']],'on':{'mouseleave':_0x4eb152['to'](_0x305149=>{const _0x293222=_0x305149,_0x4d9b3f=document['querySelector']('.ck-presence-list__list'),_0x3d7845=document['querySelector']('.ck-balloon-panel_with-arrow');_0x4d9b3f?.['contains'](_0x293222['relatedTarget'])||_0x3d7845?.['contains'](_0x293222['relatedTarget'])||this['fire']('presencelist:hide');})}});}}class pt extends _0x116b4c{constructor(_0x50b124,_0x50712b){super(_0x50b124);const _0x484c2d=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0x50712b?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0x484c2d['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0x484c2d['to']('role'),'aria-label':_0x484c2d['to']('ariaLabel'),'aria-labelledby':_0x484c2d['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0x5586e3['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0x39658c=this['element'];_0x39658c&&(this['_isScrollable']=Math['max'](_0x39658c['scrollHeight'],_0x39658c['clientHeight'])>0.8*window['innerHeight']);}}class j extends rt{['userView'];constructor(_0x5d26db,_0x112e18,_0x4ae995){super(_0x5d26db);const _0x53ce18=this['bindTemplate'];this['userView']=new ct(_0x5d26db,_0x112e18);const _0x49588c={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0x112e18['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0x112e18['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x112e18['color']['getBackgroundColorClass']()],'aria-hidden':'true'}}]};_0x4ae995&&(_0x49588c['tag']='button',_0x49588c['on']={'click':_0x53ce18['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x49588c);}['focus'](){this['element']['focus']();}}class A extends _0x3dc104{['userView'];['markerView'];constructor(_0x410a75,_0x7bd24,_0x38eb39){super(_0x410a75);const _0x1db100=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new ct(_0x410a75,_0x7bd24),this['markerView']=new at(_0x410a75,_0x7bd24);const _0x3c1ca8=new ot(_0x410a75);_0x3c1ca8['template']['tag']='span',_0x3c1ca8['text']=_0x7bd24['name'];const _0x331d79={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0x1db100['to']('isFocusable',_0x3b3c76=>!!_0x3b3c76&&0x0),'aria-labelledby':_0x3c1ca8['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0x1db100['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0x1db100['to']('hasTooltip',_0x3ef626=>!_0x3ef626),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0x3c1ca8]};_0x38eb39&&(_0x331d79['tag']='button',_0x331d79['on']={'click':_0x1db100['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x331d79);}}class at extends _0x3dc104{constructor(_0x5df072,_0x3fec04){super(_0x5df072),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x3fec04['color']['getBackgroundColorClass']()],'aria-hidden':'true'}});}}const x={'collapseAt':0x6,'displayMe':!0x0};class r extends _0x33ae3c{['currentDisplayedUsers'];['balloonPanelView'];['view'];['presenceDropdownView'];['_bodyCollection']=null;static get['pluginName'](){return'PresenceListUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x435311){super(_0x435311),this['context']['config']['define']('presenceList',x);const _0x4c927d=_0x435311['config']['get']('presenceList.collapseAt');if('number'!=typeof _0x4c927d)throw new _0x1918b5('presencelist-collapseat-invalid-format',this);if(_0x4c927d<0x1)throw new _0x1918b5('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](i)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0xa88889(),this['balloonPanelView']=new _0x1aeeca(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get['requires'](){return[i];}['init'](){for(const _0x5c2d33 of this['_allConnectedUsers'])this['_handleUserAdd'](_0x5c2d33);this['listenTo'](this['_allConnectedUsers'],'add',(_0x79ac79,_0x2b60e1)=>{this['_handleUserAdd'](_0x2b60e1);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0x3f257e,_0xb01e37)=>{this['_handleUserRemove'](_0xb01e37);});}['_createView'](){const _0x1c614a=this['context'],_0xff11c4=new v(this['context']['locale'],this['context']['config']['get']('presenceList.collapseAt')),_0x2cf6aa=this['balloonPanelView'];if(!_0x18f043(_0x1c614a['config']['get']('presenceList.container')))throw new _0x1918b5('presencelist-missing-container',this);return _0xff11c4['counterView']['bind']('usersCount')['to'](this),_0xff11c4['bind']('isCollapsed')['to'](this,'usersCount',_0x49db61=>{const {collapseAt:_0x1d7006}=_0x1c614a['config']['get']('presenceList'),_0x275cf8=_0x49db61>=_0x1d7006;if(_0x275cf8&&!_0xff11c4['inlineListView']['items']['find'](_0x4c0d43=>_0x4c0d43 instanceof b)){const _0x8e0840=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['currentDisplayedUsers']['length']==_0x8e0840&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](this['currentDisplayedUsers']['length']-0x1),_0xff11c4['inlineListView']['items']['add'](_0xff11c4['counterView']);}return _0x275cf8||this['hideDropdown'](),_0x275cf8;}),_0xff11c4['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0x1e47cc=>{const _0x1a9277=_0x1c614a['config']['get']('presenceList'),_0x54eb60=new A(_0x1c614a['locale'],_0x1e47cc,!!_0x1a9277['onClick']);return _0x54eb60['bind']('hasTooltip')['to'](_0xff11c4,'isCollapsed',_0x1b46f5=>!_0x1b46f5),_0x54eb60['bind']('isFocusable')['to'](_0xff11c4,'isCollapsed',_0x1d0404=>!_0x1d0404),_0x1a9277['onClick']&&this['listenTo'](_0x54eb60,'execute',()=>{this['view']['isCollapsed']||_0x1a9277['onClick'](_0x1e47cc,_0x54eb60['element']);}),_0x54eb60;}),this['listenTo'](_0xff11c4['inlineListView'],'presencelist:show',()=>{this['view']['isCollapsed']&&this['showDropdown']();}),this['listenTo'](_0xff11c4['inlineListView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();}),_0xff11c4['inlineListView']['keystrokes']['set']('Enter',(_0x5292dc,_0x14835a)=>{this['view']['isCollapsed']&&(this['showDropdown'](),_0x14835a());}),_0xff11c4['render'](),_0x2cf6aa['render'](),_0x1126c3({'emitter':_0xff11c4,'activator':()=>_0x2cf6aa['isVisible'],'contextElements':[_0x2cf6aa['element'],_0xff11c4['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0x1c614a['config']['get']('presenceList.container')['appendChild'](_0xff11c4['element']),this['_bodyCollection']=new _0x3e2feb(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_bodyCollection']['add'](this['balloonPanelView']),_0xff11c4;}['_handleUserAdd'](_0x187d60){if(!this['context']['config']['get']('presenceList.displayMe')&&_0x187d60['isMe'])return;const _0x31cc23=this['context']['config']['get']('presenceList.collapseAt')-0x1;for(this['usersCount']++;this['currentDisplayedUsers']['length']>=_0x31cc23-(this['view']['isCollapsed']?0x1:0x0)&&this['currentDisplayedUsers']['length']>0x1;)this['currentDisplayedUsers']['remove'](0x1);const _0xd181a8=_0x187d60['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0x187d60,_0xd181a8);}['_handleUserRemove'](_0x472f6d){this['usersCount']--;const {collapseAt:_0x50c868}=this['context']['config']['get']('presenceList'),_0x277faf=this['usersCount']>=_0x50c868;if(this['currentDisplayedUsers']['get'](_0x472f6d['id']))this['currentDisplayedUsers']['remove'](_0x472f6d['id']);else{if(_0x277faf&&this['currentDisplayedUsers']['length']+0x1===_0x50c868-0x1)return;}if(this['currentDisplayedUsers']['length']+(_0x277faf?0x1:0x0)<this['usersCount']){for(const _0x738309 of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0x738309['id'])&&(this['currentDisplayedUsers']['add'](_0x738309,Math['min'](this['currentDisplayedUsers']['length']-(_0x277faf?0x1:0x0),0x1)),this['currentDisplayedUsers']['length']+(_0x277faf?0x1:0x0)===_0x50c868-0x1))return;}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0x4e1c55=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new L(this['context']['locale'],!!_0x4e1c55['onClick']),this['view']['inlineListView']['isExpanded']=!0x0,this['listenTo'](this['presenceDropdownView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();});const {listWrapperView:_0x51be98}=this['presenceDropdownView'];_0x51be98['items']['bindTo'](this['_allConnectedUsers'])['using'](_0x57c41e=>{if(!_0x4e1c55['displayMe']&&_0x57c41e['isMe'])return null;const _0x31d628=new j(this['context']['locale'],_0x57c41e,!!_0x4e1c55['onClick']);return _0x4e1c55['onClick']&&this['listenTo'](_0x31d628,'execute',()=>{_0x4e1c55['onClick'](_0x57c41e,_0x31d628['element']);}),_0x31d628;}),this['balloonPanelView']['content']['add'](this['presenceDropdownView']),this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element']}),_0x51be98['focus'](),_0x51be98['checkIfScrollable']();const _0xa0caa7=(_0x18bf1a,_0x3c1c9b)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0x3c1c9b();};_0x51be98['keystrokes']['set']('Esc',_0xa0caa7),_0x51be98['keystrokes']['set']('Shift+Tab',_0xa0caa7),_0x51be98['keystrokes']['set']('Tab',(_0x2820b2,_0x388c8f)=>{!function(_0x17ddb1){const _0x4295e1=['a','button','input','select','textarea','[tabindex]','[contenteditable]']['map'](_0x562b8d=>_0x562b8d+':not([disabled]):not([tabindex=\x22-1\x22])')['join'](','),_0x5a23ec=[...document['body']['querySelectorAll'](_0x4295e1)]['filter'](_0x4b079a=>_0x4b079a===document['activeElement']||_0x4b079a['offsetWidth']+_0x4b079a['offsetHeight']>0x0)['sort']((_0x2e522b,_0x2c14d8)=>(_0x2e522b['tabIndex']||0x0)-(_0x2c14d8['tabIndex']||0x0)),_0x33cf89=_0x5a23ec['indexOf'](_0x17ddb1),_0x1c8166=_0x5a23ec[(_0x33cf89+0x1)%_0x5a23ec['length']];_0x1c8166&&_0x1c8166['focus']();}(this['view']['element']),this['hideDropdown'](),_0x388c8f();}),_0x51be98['focusTracker']['add'](this['view']['element']),_0x51be98['focusTracker']['on']('change:isFocused',(_0x3baa21,_0x5d0488,_0x5e33c4)=>{_0x5e33c4||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 _0x33ae3c{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};
|
|
23
|
+
import{ContextPlugin as _0x5daa10,Plugin as _0x229706,PendingActions as _0x1118c4,Context as _0x4c42fe}from'@ckeditor/ckeditor5-core/dist/index.js';import{DomEmitterMixin as _0x2e21b2,CKEditorError as _0xe0301,Collection as _0x493251,global as _0x37251f,version as nt,uid as _0x1247ec,KeystrokeHandler as _0x5c1d35}from'@ckeditor/ckeditor5-utils/dist/index.js';import{Notification as _0x42b88a,View as _0x1d2ee9,ListView as _0x45e0e5,ListItemView as rt,LabelView as ot,BalloonPanelView as _0x5144ca,clickOutsideHandler as _0x1e7e5d,BodyCollection as _0xf7f15a}from'@ckeditor/ckeditor5-ui/dist/index.js';import{ModelLiveRange as _0x27b4bc,History as _0x4981f2,NoOperation as _0x33770a,InsertOperation as _0x20b913,MarkerOperation as _0x2213ed,RootAttributeOperation as _0x12d125,transformOperationSets as _0x2aef59,OperationFactory as _0x568365}from'@ckeditor/ckeditor5-engine/dist/index.js';import{WebSocketGateway as ht,WEB_SOCKET_GATEWAY_STATES as te,CollaborativeEditingService as _0x2e808a,User as lt,CommentsService as _0x52fe01,TrackChangesService as et,RevisionHistoryService as it,EditorService as tt}from'@ckeditor/ckeditor-cloud-services-collaboration/dist/index.js';import{Users as _0x488264,UserView as ct}from'ckeditor5-collaboration/dist/index.js';import{Compressor as _0x35ad83}from'@ckeditor/ckeditor5-operations-compressor/dist/index.js';import{isElement as _0x4224bb}from'es-toolkit/compat';class n extends _0x5daa10{static ['WebSocketGateway']=/* #__PURE__ -- @preserve */
|
|
24
|
+
((()=>ht)());static ['initialReconnectionInterval']=0x3e8;['connection'];['_reconnectionStack'];['_shouldPluginsReconnect'];['_domEmitter'];static get['requires'](){return['CloudServices',_0x42b88a];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x559a05){super(_0x559a05),this['set']('state',te['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=new(_0x2e21b2())();}['init'](){const _0x207e49=this['context'],_0x3b5653=_0x207e49['plugins']['get']('CloudServices'),_0x37b0fa=_0x207e49['plugins']['get'](_0x42b88a);if(!_0x3b5653['token'])throw new _0xe0301('websocketgateway-missing-token',this);if(!_0x3b5653['webSocketUrl'])throw new _0xe0301('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'](_0x3b5653['token'],_0x3b5653['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0x548433=>{if(this['connection']=_0x548433,this['bind']('state')['to'](_0x548433,'state',this,'_isBrowserOffline',(_0x4d52ad,_0x476bdd)=>('connected'!==_0x4d52ad&&(this['_shouldPluginsReconnect']=!0x0),_0x476bdd||_0x4d52ad!==te['CONNECTED']?te['DISCONNECTED']:this['state']==te['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),te['CONNECTING']):te['CONNECTED'])),this['connection']['on']('error',(_0x1d0094,_0x3269c1)=>{if('limitExceeded'!==_0x3269c1['code'])throw console['error'](_0x3269c1),new _0xe0301('cloudservices-init',null,{'originalError':_0x3269c1});_0x37b0fa['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'});}),!_0x548433['me'])return new Promise(_0x1eb4f5=>_0x548433['on']('change:me',_0x1eb4f5));})['catch'](_0x94ccb=>{throw console['error'](_0x94ccb),new _0xe0301('cloudservices-init',null,{'originalError':_0x94ccb});});}['addToReconnectionStack'](_0xd8aee9){if('function'!=typeof _0xd8aee9['reconnect'])throw new _0xe0301('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0xd8aee9))throw new _0xe0301('websocketgateway-plugin-already-registered',this,{'name':_0xd8aee9['constructor']['pluginName']});this['_reconnectionStack']['add'](_0xd8aee9);}['removeFromReconnectionStack'](_0x48cce4){this['_reconnectionStack']['delete'](_0x48cce4);}['isInReconnectionStack'](_0x66db2c){return this['_reconnectionStack']['has'](_0x66db2c);}['_reconnect'](){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0x523d58=>_0x523d58['reconnect']())))['then'](()=>this['state']=te['CONNECTED'])['catch'](_0x2e6d8c=>{throw console['error'](_0x2e6d8c),new _0xe0301('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 _0x5daa10{['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,_0x488264];}constructor(_0x413f23){super(_0x413f23),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0x493251(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x488264);}['init'](){const _0x42001c=this['context']['plugins']['get'](n);this['listenTo'](_0x42001c,'change:state',(_0x373546,_0x13480b,_0x3df6b7)=>{if('connected'!==_0x3df6b7)this['channelSessions']['forEach'](_0x4dc52b=>_0x4dc52b['clear']()),this['channelConnectedUsers']['forEach'](_0x4f1952=>_0x4f1952['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x441d27,_0x4d3a9c]of this['_registeredSessions'])for(const _0x4b2af3 of _0x4d3a9c)this['_handleSessionAdd'](_0x441d27,_0x4b2af3);}}),this['_createUser'](_0x42001c['connection']['me'],!0x0);}['register'](_0x5030ce,_0xad817b){if(this['_registeredSessions']['has'](_0x5030ce))throw new _0xe0301('sessions-register-already-registered',null,{'channelId':_0x5030ce});this['_registeredSessions']['set'](_0x5030ce,_0xad817b),this['channelSessions']['set'](_0x5030ce,new _0x493251()),this['channelConnectedUsers']['set'](_0x5030ce,new _0x493251()),this['listenTo'](_0xad817b,'add',(_0x355554,_0x3b16e3)=>this['_handleSessionAdd'](_0x5030ce,_0x3b16e3)),this['listenTo'](_0xad817b,'remove',(_0x47f3b9,_0x14fed1)=>this['_handleSessionRemove'](_0x5030ce,_0x14fed1));for(const _0x567c7d of _0xad817b)this['_handleSessionAdd'](_0x5030ce,_0x567c7d);}['unregister'](_0x5daf81){if(!this['_registeredSessions']['has'](_0x5daf81))throw new _0xe0301('sessions-unregister-not-exist',null,{'channelId':_0x5daf81});const _0x560403=this['_registeredSessions']['get'](_0x5daf81);this['stopListening'](_0x560403);for(const _0xbc452a of _0x560403)'connected'===this['context']['plugins']['get'](n)['state']&&this['_handleSessionRemove'](_0x5daf81,_0xbc452a);this['_registeredSessions']['delete'](_0x5daf81),this['channelSessions']['delete'](_0x5daf81),this['channelConnectedUsers']['delete'](_0x5daf81);}get['mySessionId'](){return this['context']['plugins']['get'](n)['connection']['sessionId'];}['getUserBySessionId'](_0x4c1d02){for(const _0x2b0333 of this['channelSessions']['values']())for(const _0x126678 of _0x2b0333)if(_0x126678['id']===_0x4c1d02)return _0x126678['user'];}['getUserSessions'](_0x286bc9,_0x1d505c){const _0x208510=_0x1d505c?[this['channelSessions']['get'](_0x1d505c)]:this['channelSessions']['values'](),_0x17c57e=new Set();for(const _0x1e4245 of _0x208510)for(const _0x2ba374 of _0x1e4245)_0x2ba374['user']['id']===_0x286bc9['id']&&_0x17c57e['add'](_0x2ba374['id']);return _0x17c57e;}['getUserRole'](_0x356048){for(const _0x10898c of this['channelSessions']['values']())for(const _0x2817a7 of _0x10898c)if(_0x2817a7['user']===_0x356048)return _0x2817a7['role'];}['_handleSessionAdd'](_0x23b703,_0x5c294f){if('connected'!==this['context']['plugins']['get'](n)['state'])return;const _0x33c48e=_0x5c294f['user'],_0x3b9b31=this['_users']['getUser'](_0x33c48e['id'])||this['_createUser'](_0x33c48e),_0x21a991=Object['assign']({},_0x5c294f,{'user':_0x3b9b31});if(this['channelSessions']['get'](_0x23b703)['add'](_0x21a991),!_0x33c48e['hiddenInPresenceList']){const _0x43b404=this['channelConnectedUsers']['get'](_0x23b703);_0x43b404['has'](_0x3b9b31['id'])||_0x43b404['add'](_0x3b9b31),this['allConnectedUsers']['has'](_0x3b9b31['id'])||_0x33c48e['hiddenInPresenceList']||this['allConnectedUsers']['add'](_0x3b9b31,_0x3b9b31['isMe']?0x0:void 0x0);}this['fire']('sessionAdd:'+_0x23b703,{'channelId':_0x23b703,'session':_0x21a991});}['_handleSessionRemove'](_0x339311,_0x24fde7){if('connected'!==this['context']['plugins']['get'](n)['state'])return;const _0x4ed41d=this['channelConnectedUsers']['get'](_0x339311),_0x250b33=_0x24fde7['user'];_0x250b33['id']&&(this['channelSessions']['get'](_0x339311)['remove'](_0x24fde7['id']),_0x4ed41d['has'](_0x250b33['id'])&&!this['getUserSessions'](_0x250b33,_0x339311)['size']&&_0x4ed41d['remove'](_0x250b33['id']),this['allConnectedUsers']['get'](_0x250b33['id'])&&!this['getUserSessions'](_0x250b33)['size']&&this['allConnectedUsers']['remove'](_0x250b33['id']));}['_createUser'](_0x4223c1,_0x3e05f7){const _0x2f8dde=this['_users']['addUser'](_0x4223c1);return _0x3e05f7&&this['_users']['defineMe'](_0x4223c1['id']),_0x2f8dde['orderNumber']=this['_uniqueUsersCount']++,_0x2f8dde;}}class V extends _0x229706{['_domEmitter']=new(_0x2e21b2())();static get['requires'](){return[i];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x459b81=this['editor'],_0x3c7dee=_0x459b81['plugins']['get'](i);_0x459b81['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x441253,{writer:_0x5c8a13})=>function(_0x582eef,_0x4ceae8,_0x1471ac,_0x2c0ef9){const _0x391e30=_0x582eef['markerName']['split'](':')[0x2],_0x2c2ab9=_0x1471ac['getUserBySessionId'](_0x391e30);if(!_0x2c2ab9||_0x391e30===_0x1471ac['mySessionId'])return;if(!_0x2c0ef9['model']['schema']['checkChild'](_0x582eef['markerRange']['start'],'$text'))return;const _0x5f04de={'class':'ck-user__marker\x20'+_0x2c2ab9['color']['getMarkerClass'](),'data-name':_0x2c2ab9['name'],'data-session-id':_0x391e30},_0x54d721=_0x2c0ef9['model']['markers']['get'](_0x582eef['markerName']),_0x3ce257=_0x54d721['getStart'](),_0x4cd2aa=_0x3ce257['nodeAfter'],_0x4de36c=_0x2c0ef9['model']['schema'];if(_0x4cd2aa&&_0x4de36c['isObject'](_0x4cd2aa)&&_0x4de36c['isInline'](_0x4cd2aa)&&!_0x2c0ef9['model']['markers']['get']('user:range:'+_0x391e30)['getRange']()['isCollapsed'])return;const _0x43fb09=_0x3ce257['parent'];return _0x2c0ef9['model']['schema']['isLimit'](_0x43fb09)&&!_0x2c0ef9['model']['hasContent'](_0x43fb09)&&(_0x5f04de['contenteditable']=!0x1),function(_0x2b0084,_0x4f9a53,_0x23fe76){const _0x3d8928=_0x2b0084['createUIElement']('span',_0x4f9a53);return _0x2b0084['setCustomProperty']('userPositionMarker',!0x0,_0x3d8928),_0x3d8928['render']=function(_0x58411b){const _0x2b743b=this['toDomElement'](_0x58411b),_0x53f7ad=document['createElement']('span');return _0x53f7ad['classList']['add']('ck-user__marker-tooltip'),_0x53f7ad['setAttribute']('contenteditable','false'),_0x53f7ad['setAttribute']('spellcheck','false'),_0x53f7ad['textContent']=_0x23fe76['name'],_0x2b743b['innerHTML']='<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span>'+_0x53f7ad['outerHTML']+'',_0x2b743b['addEventListener']('mouseenter',()=>{_0x2b743b['classList']['add']('ck-user__marker_hovered');}),_0x2b743b['addEventListener']('mouseleave',()=>{_0x2b743b['classList']['remove']('ck-user__marker_hovered');}),_0x2b743b;},_0x3d8928['isSimilar']=function(_0x2317c5){return!(!this['getCustomProperty']('userPositionMarker')||!_0x2317c5['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0x2317c5['getAttribute']('data-session-id'));},_0x3d8928;}(_0x4ceae8,_0x5f04de,_0x2c2ab9);}(_0x441253,_0x5c8a13,_0x3c7dee,_0x459b81)}),_0x459b81['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0x4e727a=>function(_0x4f5fab,_0x4722ff){const _0x1b8033=_0x4f5fab['markerName']['split'](':')[0x2];if(_0x1b8033===_0x4722ff['mySessionId'])return null;const _0x1e1908=_0x4722ff['getUserBySessionId'](_0x1b8033);if(!_0x1e1908)return{'id':_0x1b8033,'classes':[]};return{'id':_0x1b8033,'classes':['ck-user__selection',_0x1e1908['color']['getSelectionClass']()],'attributes':{'data-session-id':_0x1b8033},'priority':0x7d0+_0x1e1908['orderNumber']};}(_0x4e727a,_0x3c7dee)}),function(_0x4e97e9){const _0x137208=_0x4e97e9['model'],_0x3ca1b1=new Map(),_0x344ee2=_0x4e97e9['plugins']['get'](i);_0x137208['markers']['on']('update:user:range',(_0x12a4c6,_0x6a8416,_0x1bd809,_0xc78e9f)=>{if(!_0xc78e9f&&_0x3ca1b1['get'](_0x6a8416['name']))return _0x3ca1b1['get'](_0x6a8416['name'])['detach'](),void _0x3ca1b1['delete'](_0x6a8416['name']);const _0xd211a0=_0x6a8416['name']['split'](':')[0x2];if(_0xd211a0===_0x344ee2['mySessionId'])return;const _0x4895ec='user:position:'+_0xd211a0;_0x137208['markers']['has'](_0x4895ec)&&_0x4e97e9['editing']['reconvertMarker'](_0x4895ec),_0x6a8416['on']('change:range',(_0x304831,_0x1f2b8e,_0x24d0b2)=>{if('$graveyard'!=_0x1f2b8e['root']['rootName']&&'$graveyard'==_0x6a8416['getRange']()['root']['rootName']&&!_0x3ca1b1['has'](_0x6a8416['name'])){const _0x2de5a3=_0x137208['schema']['getNearestSelectionRange'](_0x24d0b2['deletionPosition']);if(_0x2de5a3){const _0x5c42b5=_0x27b4bc['fromRange'](_0x2de5a3);_0x3ca1b1['set'](_0x6a8416['name'],_0x5c42b5),_0x5c42b5['on']('change:range',(_0x5b1615,_0x12740c,_0x555069)=>{if('$graveyard'==_0x5c42b5['root']['rootName']){const _0x2b1dfc=_0x137208['schema']['getNearestSelectionRange'](_0x555069['deletionPosition']);_0x2b1dfc?(_0x5c42b5['start']=_0x2b1dfc['start'],_0x5c42b5['end']=_0x2b1dfc['end']):(_0x3ca1b1['delete'](_0x6a8416['name']),_0x5c42b5['detach']());}});}}});}),_0x137208['document']['on']('change',()=>{_0x3ca1b1['size']>0x0&&_0x137208['enqueueChange']({'isUndoable':!0x1},_0x11b9b7=>{for(const [_0x56da07,_0x3d7210]of _0x3ca1b1)'$graveyard'==_0x137208['markers']['get'](_0x56da07)['getRange']()['root']['rootName']&&(Z(_0x56da07['split'](':')[0x2],_0x3d7210['toRange'](),_0x137208,_0x11b9b7),_0x3d7210['detach']());_0x3ca1b1['clear']();});});}(_0x459b81),this['_domEmitter']['listenTo'](_0x37251f['document'],'keydown',(_0xc5ae83,{key:_0xf5e2c4})=>{'Escape'===_0xf5e2c4&&function(_0x5c0a47){_0x5c0a47['editing']['view']['change'](_0x2ca3a6=>{for(const _0x571255 of _0x5c0a47['model']['markers']){if(!_0x571255['name']['startsWith']('user:position'))continue;const _0x4458b4=_0x5c0a47['editing']['mapper']['markerNameToElements'](_0x571255['name']);if(_0x4458b4){for(const _0x193ef7 of _0x4458b4)_0x2ca3a6['removeClass']('ck-user__marker_hovered',_0x193ef7);}}});}(_0x459b81);},{'useCapture':!0x0});}['afterInit'](){const _0x476b51=this['editor'],_0x31f3b2=_0x476b51['commands']['get']('undo');_0x31f3b2&&_0x476b51['model']['on']('applyOperation',(_0x2ad788,_0x369914)=>{const _0x4312bc=_0x369914[0x0];if(!_0x4312bc['isDocumentOperation'])return;if('marker'!=_0x4312bc['type']||!_0x4312bc['name']['startsWith']('user:'))return;const _0x21ef6b=_0x4312bc['batch'];_0x31f3b2['_createdBatches']['has'](_0x21ef6b)&&(_0x4312bc['newRange']=_0x4312bc['oldRange']?_0x476b51['model']['createRange'](_0x4312bc['oldRange']['start'],_0x4312bc['oldRange']['end']):null);},{'priority':'highest'});}['destroy'](){return this['_domEmitter']['stopListening'](),super['destroy']();}['createUserMarkerOperations'](){const _0x34537b=this['editor'],_0x5187f4=_0x34537b['model']['document'],_0x212fa6=_0x34537b['plugins']['get'](i);_0x34537b['model']['enqueueChange']({'isUndoable':!0x1},_0x5bebbc=>{const _0x3c1dac='user:range:'+_0x212fa6['mySessionId'],_0x1e198d='user:position:'+_0x212fa6['mySessionId'],_0x4574c7=_0x34537b['model']['markers']['has'](_0x3c1dac);_0x34537b['editing']['view']['hasDomSelection']?Z(_0x212fa6['mySessionId'],_0x5187f4['selection']['getFirstRange'](),_0x34537b['model'],_0x5bebbc):_0x4574c7&&(_0x5bebbc['removeMarker'](_0x3c1dac),_0x5bebbc['removeMarker'](_0x1e198d));});}}function Z(_0x4318d7,_0xaa73b8,_0xe4a6ed,_0x3d6fdd){const _0x3203d5='user:range:'+_0x4318d7,_0x215afb='user:position:'+_0x4318d7,_0x2acdb4=_0xaa73b8['getContainedElement']();let _0xb4ca52=_0xaa73b8['start'];if(_0x2acdb4&&_0x2acdb4['is']('element','tableCell')){const _0x2909c0=function(_0x5d34cc,_0x4cbacc){for(const _0x5a48f9 of _0x5d34cc['getPositions']())if(_0x4cbacc['schema']['checkChild'](_0x5a48f9,'$text'))return _0x5a48f9;}(_0xaa73b8,_0xe4a6ed);_0x2909c0&&(_0xb4ca52=_0x2909c0,_0xaa73b8=_0x3d6fdd['createRange'](_0xb4ca52));}const _0x4440b3=_0x3d6fdd['createRange'](_0xb4ca52);_0xe4a6ed['markers']['has'](_0x3203d5)?(_0x3d6fdd['updateMarker'](_0x3203d5,{'range':_0xaa73b8}),_0x3d6fdd['updateMarker'](_0x215afb,{'range':_0x4440b3})):(_0x3d6fdd['addMarker'](_0x3203d5,{'range':_0xaa73b8,'usingOperation':!0x0}),_0x3d6fdd['addMarker'](_0x215afb,{'range':_0x4440b3,'usingOperation':!0x0}));}function W(_0x9b280b,_0x18a57e,_0x1a4433){const _0x2f9e04=_0x9b280b['t'],t=_0x9b280b['t'];switch(_0x18a57e){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 _0x2f9e04({'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'},_0x1a4433);default:return'';}}let G=0x1;class l extends _0x229706{static ['CollaborativeEditingService']=/* #__PURE__ -- @preserve */
|
|
25
|
+
((()=>_0x2e808a)());['_offset'];['sessionId'];['serverHistory'];['_channelId'];['_service'];['_document'];['_compressor'];['_bufferedOperations'];['_knownOperations'];['_knownRootNames'];['_pendingAction'];['_hasSelectionChanged'];['_sendBufferedOperationsDelayId'];['_baseBufferDelay'];['_currentBufferDelay'];['_lastSyncedOperationId'];['_disconnectionOperations'];['_operationIdentifier'];static get['requires'](){return[n,i,V,_0x1118c4,_0x488264,_0x42b88a];}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 _0x1723ac=this['serverHistory']['getOperations']();for(let _0x1146b6=_0x1723ac['length']-0x1;_0x1146b6>=0x0;_0x1146b6--){const _0x5d76b0=_0x1723ac[_0x1146b6];if(!this['_disconnectionOperations']['has'](_0x5d76b0))return _0x5d76b0['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0x2ebb40){if(super(_0x2ebb40),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x4981f2(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0xe0301('collaboration-missing-channelid',this);const _0x46410a=_0x2ebb40['config']['get']('cloudServices.bundleVersion')||nt;this['_service']=new l['CollaborativeEditingService'](_0x46410a,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0x35ad83(),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 _0x349c0e=this['editor'],_0x2a9038=_0x349c0e['plugins']['get'](_0x488264),_0x267c84=_0x349c0e['plugins']['get'](n);this['listenTo'](_0x2a9038,'getOperationAuthor',(_0x78f85b,_0x17649a)=>{const _0x594938=_0x17649a[0x0];_0x594938['_authorId']&&(_0x78f85b['return']=_0x2a9038['getUser'](_0x594938['_authorId']),_0x78f85b['stop']()),null===_0x594938['_authorId']&&(_0x78f85b['return']=null,_0x78f85b['stop']());},{'priority':'high'}),this['listenTo'](_0x349c0e['model']['document']['selection'],'change:range',(_0x501fc7,_0xc40878)=>{_0xc40878['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x349c0e['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x349c0e['model']['on']('applyOperation',(_0x23c33f,_0x19ddce)=>{const _0x109cf5=_0x19ddce[0x0];_0x109cf5['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0x109cf5),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['bind']('_isEditingAllowed')['to'](_0x267c84,'state',this,'_hasSynchronizationProblem',(_0x1a3cc2,_0x85a735)=>'connected'===_0x1a3cc2&&!_0x85a735),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x349c0e['disableReadOnlyMode']('rtc-offline'):_0x349c0e['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x349c0e['disableReadOnlyMode']('rtc-offline'):_0x349c0e['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async['reconnect'](){const _0x3f3896=this['editor']['plugins']['get'](i),_0x16f9cd=this['editor']['plugins']['get'](n);try{this['_isPendingUpdate']=!0x0,_0x3f3896['unregister'](this['_channelId']);const _0x44d2e6=await this['_service']['reconnect'](_0x16f9cd['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0x44d2e6)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x18a488=await this['_service']['getConnectedSessions']();_0x3f3896['register'](this['_channelId'],_0x18a488),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x57916e){if(function(_0x1403fe){return'404'===_0x1403fe['code'];}(_0x57916e)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0x491ce4){return'409'===_0x491ce4['code'];}(_0x57916e)){const _0x40d95a=W(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'](_0x40d95a);}else{if(!(_0x57916e instanceof $))throw _0x57916e;this['_handleReconnectionError']();}}}}['destroy'](){const _0x23b9b6=this['editor']['plugins']['get'](n),_0x29b20d=this['editor']['plugins']['get'](i);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x29b20d['channelSessions']['has'](this['_channelId'])&&_0x29b20d['unregister'](this['_channelId']),_0x23b9b6['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async['_handleReconnectionResponse'](_0x47d41f){if(this['sessionId']!==_0x47d41f['sessionId']&&this['_lastSyncedOperationId']!==_0x47d41f['lastOperationId'])throw new $();return this['sessionId']=_0x47d41f['sessionId'],this['_handleServerResponse']([],{..._0x47d41f,'wereChangesApplied':!0x1,'data':_0x47d41f['data']},'reconnect');}async['_connectService'](_0x22acb,_0x1a674c=!0x1){const {connection:_0x587ed1}=this['editor']['plugins']['get'](n);l['CollaborativeEditingService']['getConnectedSessions'](_0x587ed1,this['_channelId'])['then'](_0x1cacaf=>this['_initSessionsHandling'](_0x1cacaf))['catch'](_0x4670d3=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x4670d3);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x317ef2,_0x541874)=>{this['_crash']('realtimecollaborationclient-init-service-internal-error',_0x541874);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_isConnected']=!0x1;});const _0x2bb5e3=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x22acb);this['_isPendingUpdate']=!0x0;const _0x31f951=await this['_service']['connect'](_0x587ed1,this['_compressOperations'](_0x22acb),_0x2bb5e3);if(this['sessionId']=_0x31f951['sessionId'],_0x1a674c){if(!_0x31f951['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x31f951['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0x22acb,_0x31f951,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x31f951,_0x22acb);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}['_handleSendingSelectionMarkers'](){const _0x38333d=this['editor']['plugins']['get'](i),_0x55bfa1=this['editor']['plugins']['get'](V),_0x57c3e7=_0x38333d['channelSessions']['get'](this['_channelId']);_0x57c3e7&&_0x57c3e7['length']>0x1?_0x55bfa1['createUserMarkerOperations']():this['listenTo'](_0x38333d,'sessionAdd:'+this['_channelId'],()=>{0x2===_0x38333d['channelSessions']['get'](this['_channelId'])['length']&&_0x55bfa1['createUserMarkerOperations']();});}async['_handleReceivedOperations'](_0x5af5e5,_0x429e71,_0x4ad651,_0x1594c9){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x429e71){const _0x52e4db=this['_decompressOperations'](_0x4ad651,_0x1594c9);await this['_fetchMissingUsers'](_0x52e4db),this['_handleExternalOperations'](_0x52e4db,_0x429e71,_0x4ad651['lastOperationId'])||this['_crash']('realtimecollaborationclient-init-service-incorrect-server-operation');}}async['_connectAfterSessionHasBeenFlushed'](){this['_disconnectService']();const {locale:_0x35c55b}=this['editor'];let _0x3e561e;try{_0x3e561e=await this['_service']['getDocumentDetails']();}catch{const _0xc5cecf=W(_0x35c55b,'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'](_0xc5cecf);}const _0x8c61cc=_0x3e561e['currentDocumentSession']||_0x3e561e['lastDocumentSession'];if(this['_lastSyncedOperationId']!==_0x8c61cc['lastOperationId']){const _0x41f333=W(_0x35c55b,'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'](_0x41f333);}await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);}['_disconnectService'](){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['stopListening'](this['_service']);}['_initSessionsHandling'](_0x3875f2){const _0xbadf57=this['editor']['plugins']['get'](i);this['listenTo'](_0xbadf57,'sessionAdd:'+this['_channelId'],(_0x162e47,{session:_0x35ad91})=>{if(_0x35ad91['id']===_0xbadf57['mySessionId']){_0x162e47['off']();const _0x405dd7=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0x51536e=_0x35ad91['permissions'];_0x405dd7&&_0x405dd7['isEnabled']&&(_0x51536e=_0x51536e['filter'](_0x4548b7=>'document:write'!==_0x4548b7)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0x51536e,this['_channelId']);}}),_0xbadf57['register'](this['_channelId'],_0x3875f2);}['_initThrowingOnDataSet'](){const _0x220334=this['editor']['data']['set'];this['editor']['data']['set']=(..._0xaaba5a)=>{if(!_0xaaba5a[_0xaaba5a['length']-0x1]['suppressErrorInCollaboration'])throw new _0xe0301('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x220334['apply'](this['editor']['data'],_0xaaba5a);};}['_setUpDataInit'](){this['editor']['data']['on']('init',(_0x5287fe,[_0x51db6a])=>{if(this['_document']['version'])throw new _0xe0301('realtimecollaborationclient-init-document-already-initialized',this);_0x5287fe['stop'](),this['_setPendingAction']();const _0x1e00e2=this['editor']['config']['get']('rootsAttributes'),_0x2bfc8f=this['_getOperationsFromInitData'](_0x51db6a,_0x1e00e2);0x0==_0x2bfc8f['length']&&_0x2bfc8f['push'](new _0x33770a(0x0)),_0x5287fe['return']=this['_connectService'](_0x2bfc8f)['then'](()=>{this['editor']['plugins']['get'](n)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0xa7777=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0xa7777))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x35b9bd,[_0x5858fe,_0x297461])=>{_0x35b9bd['stop']();const _0x17319d=this['editor']['model']['document']['getRoot'](_0x5858fe);if(!this['_knownRootNames']['has'](_0x5858fe)){const _0x5e09af=_0x297461&&_0x297461['data']?_0x297461['data']:'',_0x1f0eda=_0x297461&&_0x297461['attributes']?_0x297461['attributes']:{};await this['_loadRoot'](_0x5858fe,_0x5e09af,_0x1f0eda);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0x17319d['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0x17319d);});},{'priority':'high'});}async['_fetchMissingUsers'](_0x4443f2){const _0x3eb119=this['editor']['plugins']['get'](_0x488264),{connection:_0x22b3e8}=this['editor']['plugins']['get'](n),_0x4ae327=new Set();for(const _0x283bc3 of _0x4443f2){const _0x3198b8=_0x283bc3['_authorId'];_0x3198b8&&!_0x3eb119['getUser'](_0x3198b8)&&_0x4ae327['add'](_0x3198b8);}if(0x0===_0x4ae327['size'])return;const _0x258ab2=await lt['getMany'](_0x22b3e8,Array['from'](_0x4ae327));for(const _0x17ed85 of _0x258ab2)_0x3eb119['getUser'](_0x17ed85['id'])||_0x3eb119['addUser'](_0x17ed85);}['_getOperationsFromInitData'](_0x7fa0cd,_0x3a7170={}){const _0x720f5c=this['editor']['model'],_0x443f0c=[];let _0x84fba2=0x0;const _0x412cf0='string'==typeof _0x7fa0cd?{'main':_0x7fa0cd}:_0x7fa0cd;for(const _0x96a759 of Object['keys'](_0x412cf0)){if(!this['_document']['roots']['has'](_0x96a759))throw new _0xe0301('realtimecollaborationclient-init-non-existent-root',this);const _0x880107=this['editor']['data']['parse'](_0x412cf0[_0x96a759]),_0x4e4a37=this['_document']['getRoot'](_0x96a759),_0x42fb36=new _0x20b913(_0x720f5c['createPositionAt'](_0x4e4a37,0x0),_0x880107,_0x84fba2++);_0x443f0c['push'](_0x42fb36);for(const [_0x22e260,_0x5a391d]of _0x880107['markers']){const _0x43deda=_0x720f5c['createRange'](_0x720f5c['createPositionFromPath'](_0x4e4a37,_0x5a391d['start']['path']['slice']()),_0x720f5c['createPositionFromPath'](_0x4e4a37,_0x5a391d['end']['path']['slice']())),_0x540a90=new _0x2213ed(_0x22e260,null,_0x43deda,_0x720f5c['markers'],!0x0,_0x84fba2++);_0x443f0c['push'](_0x540a90);}}if(_0x3a7170)for(const [_0x1f07c9,_0x585553]of Object['entries'](_0x3a7170)){const _0x286aff=_0x720f5c['document']['getRoot'](_0x1f07c9);if(!_0x286aff)throw new _0xe0301('multi-root-editor-root-attributes-no-root',null);for(const [_0x1de74b,_0x161145]of Object['entries'](_0x585553))if(null!==_0x161145){const _0x22b5e9=new _0x12d125(_0x286aff,_0x1de74b,null,_0x161145,_0x84fba2++);_0x443f0c['push'](_0x22b5e9);}}return _0x443f0c;}async['_loadRoot'](_0x1ca63f,_0x2d6711,_0x4d47b3){this['_getOperationsFromInitData']({[_0x1ca63f]:_0x2d6711},{[_0x1ca63f]:_0x4d47b3})['forEach']((_0x2dc3f4,_0x17dfb5)=>{_0x2dc3f4['baseVersion']=this['_document']['version']+_0x17dfb5,_0x2dc3f4['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x2dc3f4);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async['_handleInitialConnectionData'](_0x4cb1ca,_0x3f2eac){let _0x56de49;this['_offset']=_0x4cb1ca['offset'];const _0x345e6d=_0x4cb1ca['wereChangesApplied']&&!_0x4cb1ca['initData'],_0x154490=_0x345e6d?0x0:_0x4cb1ca['data']['baseVersion'];if(_0x3f2eac['forEach'](_0x75dc5=>{_0x75dc5['_isInit']=!0x0,_0x75dc5['createdAt']=_0x4cb1ca['sessionCreatedAt'],_0x75dc5['_authorId']=null;}),_0x345e6d)_0x56de49=_0x3f2eac,this['_applyOperationsSet'](_0x56de49,_0x345e6d);else{if(_0x4cb1ca['initData']){const _0x30c8c5=this['_getOperationsFromInitData'](_0x4cb1ca['initData']);this['_document']['history']['version']=-_0x30c8c5['length'],_0x30c8c5['forEach'](_0x60ddbe=>{_0x60ddbe['baseVersion']-=_0x30c8c5['length'],_0x60ddbe['createdAt']=_0x4cb1ca['sessionCreatedAt'],_0x60ddbe['_isInit']=!0x0,_0x60ddbe['_authorId']=null;}),this['_applyOperationsSet'](_0x30c8c5,!0x0),this['serverHistory']['version']=-_0x30c8c5['length']+this['_offset'],this['_updateServerHistory'](_0x30c8c5);}this['_document']['history']['version']=_0x154490,_0x56de49=this['_decompressOperations'](_0x4cb1ca['data'],_0x4cb1ca['metadata']),await this['_fetchMissingUsers'](_0x56de49),this['_applyOperationsSet'](_0x56de49,_0x345e6d);}_0x4cb1ca['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x56de49,_0x4cb1ca['lastOperationId']),this['_lastSyncedOperationId']=_0x4cb1ca['lastOperationId']),this['serverHistory']['version']=_0x154490+this['_offset'],this['_updateServerHistory'](_0x56de49),_0x3f2eac['filter'](_0x390987=>{const _0x5e2dfc=this['_getAffectedRoot'](_0x390987);return _0x5e2dfc&&!this['_knownRootNames']['has'](_0x5e2dfc);})['forEach']((_0x4e4147,_0x4ee5ed)=>{_0x4e4147['baseVersion']=this['_document']['version']+_0x4ee5ed,this['_saveOperationInBuffer'](_0x4e4147);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x159e63,_0x336f53){const _0x5ac8e2=_0x336f53&&_0x336f53['message'];if(_0x5ac8e2&&_0x5ac8e2['startsWith']('realtimecollaborationclient'))throw _0x336f53;const _0x42fc68=this['editor']['plugins']['get'](n);throw this['_isPendingUpdate']=!0x0,_0x42fc68['disconnect'](),this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0xe0301(_0x159e63,this['editor'],_0x5ac8e2?{'originalError':_0x5ac8e2}:void 0x0);}['_saveOperationInBuffer'](_0xb55451){this['_knownOperations']['has'](_0xb55451)||(this['_knownOperations']['add'](_0xb55451),this['_bufferedOperations']['push'](_0xb55451),this['_pendingAction']||'marker'==_0xb55451['type']&&!_0xb55451['affectsData']||this['_setPendingAction']());}['_sendBufferedOperationsDelayed'](_0xf0fb4e=!0x1){!_0xf0fb4e&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0x506263=>{_0x506263&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0x3c2de7=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0x3f43eb){return _0x3f43eb['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x3f43eb['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0x3f43eb['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0x3c2de7)||this['_crash'](_0x3c2de7['message'],_0x3c2de7);});},this['_currentBufferDelay']));}['_waitUntilSynced'](){return new Promise(_0x3d8ce1=>{this['on']('change:_isPendingUpdate',()=>{_0x3d8ce1();});});}async['_sendBufferedOperations'](){const _0x53d74d=this['editor']['plugins']['get'](V);if(this['_shouldSendSelectionUpdate']()&&(_0x53d74d['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x1b9caf=[...this['_bufferedOperations']];for(const _0x77a516 of _0x1b9caf)_0x77a516['wasUndone']=this['_document']['history']['isUndoneOperation'](_0x77a516);const _0x11594c=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x1b9caf),_0x5c8b18=G++,_0x224502=this['_compressOperations'](_0x1b9caf),_0x181fe3=await this['_service']['sendOperations'](_0x224502,_0x224502['baseVersion'],_0x11594c);try{return await this['_handleServerResponse'](_0x1b9caf,_0x181fe3,_0x5c8b18);}catch(_0x247bd5){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0x247bd5);}}async['_handleServerResponse'](_0x54b60e,_0x4cd2c0,_0x1e15db){if('error'in _0x4cd2c0)throw _0x4cd2c0['error'];let _0x4e99c8=!0x1;if(_0x4cd2c0['wereChangesApplied']){_0x4cd2c0['lastOperationId']&&(this['_lastSyncedOperationId']=_0x4cd2c0['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x3e7b14=>!_0x54b60e['includes'](_0x3e7b14));for(const _0x483ecb of _0x54b60e)_0x483ecb['createdAt']='lastOperationAcceptedAt'in _0x4cd2c0&&_0x4cd2c0['lastOperationAcceptedAt']||void 0x0;K(_0x54b60e,_0x4cd2c0['version']-_0x54b60e['length']),this['_updateServerHistory'](_0x54b60e);const _0x423c6c=_0x54b60e['filter'](_0x416a41=>{if(!_0x416a41['_isInit'])return!0x1;const _0xa527cf=this['_getAffectedRoot'](_0x416a41);return _0xa527cf&&!this['_knownRootNames']['has'](_0xa527cf);});K(_0x423c6c,this['_document']['version']),this['_applyOperationsSet'](_0x423c6c),_0x4e99c8=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0x62331b=this['_decompressOperations'](_0x4cd2c0['data'],_0x4cd2c0['metadata'])['filter'](_0x3d3006=>_0x3d3006['baseVersion']>=this['_lastServerVersion']);_0x62331b['forEach'](_0x44c1ce=>this['_addKnownRoot'](_0x44c1ce)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x49ad33=>!_0x49ad33['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x49ad33))),this['_bufferedOperations']['length']&&K(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0x62331b),_0x4e99c8=this['_handleExternalOperations'](_0x62331b,_0x4cd2c0['version'],_0x4cd2c0['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x4e99c8?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}['_handleExternalOperations'](_0x389504,_0x529c80,_0xafbbdc){try{const _0x212c0a={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x5d510b,operationsB:_0x3b00ab,originalOperations:_0x11dca8}=_0x2aef59(_0x389504,this['_bufferedOperations'],_0x212c0a);K(_0x5d510b,this['_document']['version']),K(_0x3b00ab,_0x529c80);for(const _0x355511 of _0x5d510b){const _0x1ef957=_0x11dca8['get'](_0x355511);_0x355511['_authorId']=_0x1ef957?_0x1ef957['_authorId']:null;}_0xafbbdc&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x389504,_0xafbbdc),this['_lastSyncedOperationId']=_0xafbbdc),this['_bufferedOperations']=[..._0x3b00ab],this['_applyOperationsSet'](_0x5d510b),this['_updateServerHistory'](_0x389504);}catch(_0x12f61c){return console['error'](_0x12f61c),!0x1;}return!0x0;}['_applyOperationsSet'](_0x463f8e,_0x551472=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0x5bf732=>{for(const _0x272e42 of _0x463f8e)this['_knownOperations']['add'](_0x272e42),this['_addKnownRoot'](_0x272e42),_0x5bf732['batch']['addOperation'](_0x272e42),this['editor']['model']['applyOperation'](_0x272e42);});}['_addKnownRoot'](_0x371dfe){const _0x335820=this['_getAffectedRoot'](_0x371dfe);_0x335820&&this['_knownRootNames']['add'](_0x335820);}['_getAffectedRoot'](_0x2222ef){let _0x57e46c,_0x511dc1;switch(_0x2222ef['type']){case'insert':_0x57e46c=_0x2222ef['position']['root'];break;case'marker':if(_0x511dc1=_0x2222ef['newRange'],!_0x511dc1)return null;_0x57e46c=_0x511dc1['root'];break;case'addRootAttribute':_0x57e46c=_0x2222ef['root'];break;case'addRoot':_0x57e46c=_0x2222ef['affectedSelectable'];break;case'move':_0x57e46c=_0x2222ef['targetPosition']['root'];break;default:return null;}return _0x57e46c['rootName'];}['_updateServerHistory'](_0x158c77){_0x158c77['forEach'](_0x2fd0ac=>{const _0x11626b=_0x2fd0ac['clone']();_0x11626b['_authorId']=_0x2fd0ac['_authorId'],_0x11626b['_isInit']=!!_0x2fd0ac['_isInit'],_0x11626b['createdAt']=_0x2fd0ac['createdAt'],_0x11626b['baseVersion']+=this['_offset'],_0x2fd0ac['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x11626b),this['serverHistory']['addOperation'](_0x11626b);});}['_handleReconnectionError'](_0x2c86a9){const _0x950e0b=this['editor']['plugins']['get']('Notification'),_0x16f7fc=this['editor']['locale'];_0x2c86a9||(_0x2c86a9=W(_0x16f7fc,'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.')),_0x950e0b['showWarning'](_0x2c86a9,{'title':W(_0x16f7fc,'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'](_0x1118c4)['add'](W(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}['_clearPendingAction'](){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x1118c4)['remove'](this['_pendingAction']),this['_pendingAction']=null);}['_compressOperations'](_0x5a3aba){const _0x1f0107=_0x5a3aba['map'](_0x58f8a1=>_0x58f8a1['toJSON']());return this['_compressor']['compress'](_0x1f0107);}['_decompressOperations'](_0x5a1ba0,_0x5da849){return this['_compressor']['decompress'](_0x5a1ba0)['map']((_0x57d02a,_0x3c9a6b)=>{const _0x1a2bd4='init'==_0x5da849[_0x3c9a6b]['type'];if('InsertOperation'==_0x57d02a['__className']){const _0xfdd6f0=_0x57d02a['position']['root'];!this['_document']['getRoot'](_0xfdd6f0)&&(this['_document']['createRoot']('$root',_0xfdd6f0)['_isAttached']=!0x1);}const _0x434b9a=_0x568365['fromJSON'](_0x57d02a,this['_document']);return _0x434b9a['wasUndone']=_0x57d02a['wasUndone'],_0x434b9a['_isInit']=_0x1a2bd4,_0x434b9a['_authorId']=_0x1a2bd4?null:_0x5da849[_0x3c9a6b]['userId'],_0x434b9a['_isDisconnection']='cs:removeUser'===_0x5da849[_0x3c9a6b]['type'],_0x434b9a['createdAt']=_0x5da849[_0x3c9a6b]['createdAt'],_0x434b9a;});}['_refreshUserSelectionMarkers'](){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}['_shouldSendSelectionUpdate'](){const _0x271072=this['editor']['plugins']['get'](i)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0x271072&&_0x271072['length']>0x1&&this['_hasSelectionChanged'];}['_shouldSendUpdate'](){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}}class $ extends Error{}function K(_0x39a139,_0x14255e){for(const _0x35b052 of _0x39a139)_0x35b052['baseVersion']=_0x14255e++;}class J{['_ignoredOperations'];['_operationToId'];constructor(_0x476081){this['_ignoredOperations']=_0x476081,this['_operationToId']=new WeakMap();}['getIdOfTheLastOperation'](_0x5c3bd3){let _0x3a7a2a=_0x5c3bd3['length'];for(;_0x3a7a2a--;){const _0x205db6=_0x5c3bd3[_0x3a7a2a];if(!this['_ignoredOperations']['has'](_0x205db6)){if(!this['_operationToId']['has'](_0x205db6)){const _0x586bc4=_0x1247ec()['slice'](0x1,0x12);this['_operationToId']['set'](_0x205db6,_0x586bc4);}return this['_operationToId']['get'](_0x205db6);}}}['setIdForTheLastOperation'](_0x790c31,_0x251caf){if(!_0x251caf)return;let _0x57974c=_0x790c31['length'];for(;_0x57974c--;){const _0x4e20ae=_0x790c31[_0x57974c];this['_ignoredOperations']['has'](_0x4e20ae)||this['_operationToId']['set'](_0x4e20ae,_0x251caf);}}}class a extends _0x229706{static get['requires'](){return[l];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class s extends _0x5daa10{static ['CommentsService']=/* #__PURE__ -- @preserve */
|
|
26
|
+
((()=>_0x52fe01)());['_services'];static get['requires'](){return[n,'CommentsRepository',i,_0x488264];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x55ee80){super(_0x55ee80),this['_services']=new Map();}async['init'](){const _0x1bdc6c=this['context'],_0xc773bc=_0x1bdc6c['plugins']['get']('CommentsRepository');if(_0x1bdc6c['plugins']['get'](n)['addToReconnectionStack'](this),_0xc773bc['adapter']={'addCommentThread':async({channelId:_0x4f049b,threadId:_0x31b071,comments:_0x19ed18,resolvedAt:_0x961638,resolvedBy:_0xa38db5,context:_0x15b8ab,attributes:_0x3750cf})=>{const _0x205fbc=await this['_getService'](_0x4f049b)['addCommentThread']({'commentThreadId':_0x31b071,'comments':_0x19ed18['map'](_0x2edb26=>function(_0x718db8,_0x388bbd,_0x463a88){return{'commentThreadId':_0x463a88,'commentId':_0x718db8['commentId'],'userId':_0x718db8['authorId'],'content':_0x718db8['content'],'documentId':_0x388bbd,'createdAt':_0x718db8['createdAt'],'attributes':_0x718db8['attributes']||{}};}(_0x2edb26,_0x4f049b,_0x31b071)),'resolvedAt':_0x961638,'resolvedBy':_0xa38db5,'context':_0x15b8ab,'attributes':_0x3750cf})['catch'](dt);return{'threadId':_0x205fbc['commentThreadId'],'comments':_0x205fbc['comments']};},'getCommentThread':async({channelId:_0x5085aa,threadId:_0x3aceb8})=>{const _0x4ec10e=await this['_getService'](_0x5085aa)['getCommentThread'](_0x3aceb8)['catch'](f)['catch'](dt);return _0x4ec10e?_0x4ec10e['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0x4ec10e]),{'threadId':_0x4ec10e['commentThreadId'],'comments':_0x4ec10e['comments']['map'](p),'context':_0x4ec10e['context'],'resolvedAt':_0x4ec10e['resolvedAt'],'resolvedBy':_0x4ec10e['resolvedBy'],'attributes':_0x4ec10e['attributes']||{}}):null;},'updateCommentThread':async({channelId:_0x2e47f2,threadId:_0x127ae6,context:_0x13c8c3,unlinkedAt:_0x55c7cd,attributes:_0x5caca3})=>this['_getService'](_0x2e47f2)['updateCommentThread']({'commentThreadId':_0x127ae6,'context':_0x13c8c3,'attributes':_0x5caca3,'unlinkedAt':_0x55c7cd})['catch'](f)['catch'](dt),'resolveCommentThread':async({channelId:_0x1a1784,threadId:_0x5bc6b4})=>{const _0x217071=await this['_getService'](_0x1a1784)['resolveCommentThread'](_0x5bc6b4)['catch'](f)['catch'](dt);return{'threadId':_0x217071['commentThreadId'],'resolvedAt':_0x217071['resolvedAt'],'resolvedBy':_0x217071['resolvedBy']};},'reopenCommentThread':async({channelId:_0xaec2ea,threadId:_0x2e6436})=>this['_getService'](_0xaec2ea)['reopenCommentThread'](_0x2e6436)['catch'](f)['catch'](dt),'removeCommentThread':({channelId:_0x582fd7,threadId:_0x2569bb})=>this['_getService'](_0x582fd7)['removeCommentThread'](_0x2569bb)['catch'](f)['catch'](dt),'addComment':({channelId:_0x41aa8b,threadId:_0x5811dd,commentId:_0x39a6d9,content:_0x4c045b,attributes:_0x1e1ee9})=>this['_getService'](_0x41aa8b)['addComment'](_0x5811dd,_0x39a6d9,_0x4c045b,_0x1e1ee9)['catch'](dt),'updateComment':({channelId:_0x582b75,threadId:_0x4cc8f7,commentId:_0x2de6f6,content:_0x1fb0d1,attributes:_0x12591b})=>this['_getService'](_0x582b75)['updateComment'](_0x4cc8f7,_0x2de6f6,_0x1fb0d1,_0x12591b)['catch'](f)['catch'](dt),'removeComment':({channelId:_0x3e09b0,threadId:_0x4c2b4a,commentId:_0x4371f4})=>this['_getService'](_0x3e09b0)['removeComment'](_0x4c2b4a,_0x4371f4)['catch'](f)['catch'](dt)},_0x1bdc6c instanceof _0x4c42fe){const _0x31a402=_0x1bdc6c['config']['get']('collaboration.channelId'),_0x582be3=_0x1bdc6c['plugins']['get'](i);await this['_setUpService'](_0x31a402);const _0x57637a=await this['_services']['get'](_0x31a402)['getConnectedSessions']();this['listenTo'](_0x582be3,'sessionAdd:'+_0x31a402,(_0x1b507c,{session:_0x24aa59})=>{_0x24aa59['id']===_0x582be3['mySessionId']&&(_0x1b507c['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x24aa59['permissions'],_0x31a402));}),_0x582be3['register'](_0x31a402,_0x57637a);}}async['_setUpService'](_0x1cd34d){if(this['_services']['has'](_0x1cd34d))throw new _0xe0301('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0x1cd34d});const _0x278f37=this['context']['plugins']['get']('CommentsRepository'),_0x7a55da=new s['CommentsService'](_0x1cd34d);this['_services']['set'](_0x1cd34d,_0x7a55da),this['listenTo'](_0x7a55da,'commentThreadAdded',(_0x156182,_0x3d1906)=>{const {commentThreadId:_0x5af70a,documentId:_0x3d6588,context:_0x5db266,attributes:_0x119a05,resolvedAt:_0x1096b4,resolvedBy:_0x53635c,comments:_0x3ff41a}=_0x3d1906;_0x278f37['getCommentThread'](_0x5af70a)||_0x278f37['addCommentThread']({'threadId':_0x5af70a,'channelId':_0x3d6588,'comments':_0x3ff41a?_0x3ff41a['map'](p):[],'context':_0x5db266,'attributes':_0x119a05,'resolvedAt':_0x1096b4,'resolvedBy':_0x53635c,'isFromAdapter':!0x0});}),this['listenTo'](_0x7a55da,'commentThreadUpdated',(_0x23b4e6,{commentThreadId:_0x40d09c,documentId:_0x1e8d37,context:_0x5812d3,unlinkedAt:_0x5703c4,attributes:_0x31bd3c})=>{_0x278f37['getCommentThread'](_0x40d09c)&&_0x278f37['updateCommentThread']({'threadId':_0x40d09c,'channelId':_0x1e8d37,'context':_0x5812d3,'unlinkedAt':_0x5703c4,'attributes':_0x31bd3c,'isFromAdapter':!0x0});}),this['listenTo'](_0x7a55da,'commentThreadResolved',(_0x2dc399,{commentThreadId:_0x274b2e,resolvedBy:_0x22fe69,resolvedAt:_0x477569})=>{const _0x108b93=_0x278f37['getCommentThread'](_0x274b2e);_0x108b93&&_0x108b93['resolve']({'resolvedBy':_0x22fe69,'resolvedAt':_0x477569,'isFromAdapter':!0x0});}),this['listenTo'](_0x7a55da,'commentThreadReopened',(_0x5d1a75,{commentThreadId:_0x76dfef})=>{const _0x31a3c6=_0x278f37['getCommentThread'](_0x76dfef);_0x31a3c6&&_0x31a3c6['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0x7a55da,'commentThreadRemoved',(_0x1acdbd,{commentThreadId:_0x22fc57})=>{const _0x45693d=_0x278f37['getCommentThread'](_0x22fc57);_0x45693d&&_0x45693d['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0x7a55da,'commentAdded',(_0x1a2117,_0x442c1b)=>{const _0x4d46c0=_0x442c1b['commentThreadId'],_0x267d1b=_0x278f37['getCommentThread'](_0x4d46c0);_0x267d1b&&_0x267d1b['addComment']({...p(_0x442c1b),'isFromAdapter':!0x0});}),this['listenTo'](_0x7a55da,'commentUpdated',(_0x1395fd,{commentThreadId:_0x364620,commentId:_0x373a20,content:_0xdba3b9,attributes:_0x84d873})=>{const _0x402e7c=_0x278f37['getCommentThread'](_0x364620);if(_0x402e7c){const _0x293dc2=_0x402e7c['getComment'](_0x373a20);_0x293dc2&&_0x293dc2['update']({'content':_0xdba3b9,'attributes':_0x84d873,'isFromAdapter':!0x0});}}),this['listenTo'](_0x7a55da,'commentRemoved',(_0x37a4fa,{commentThreadId:_0x2fc5b3,commentId:_0x38460c})=>{const _0x15c7d9=_0x278f37['getCommentThread'](_0x2fc5b3);if(_0x15c7d9){const _0x431159=_0x15c7d9['getComment'](_0x38460c);_0x431159&&_0x431159['remove']({'isFromAdapter':!0x0});}}),await this['_connectService'](_0x1cd34d);}['destroy'](){if(this['context']instanceof _0x4c42fe){const _0x47c9a5=this['context']['config']['get']('collaboration.channelId');this['_terminateService'](_0x47c9a5);}}['_terminateService'](_0x4de2a5){if(!this['_services']['has'](_0x4de2a5))throw new _0xe0301('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0x4de2a5});this['_getService'](_0x4de2a5)['disconnect'](),this['_services']['delete'](_0x4de2a5);}async['reconnect'](){for(const _0x2d6333 of this['_services']['keys']())await this['_connectService'](_0x2d6333);if(this['context']instanceof _0x4c42fe){const _0x430961=this['context']['config']['get']('collaboration.channelId'),_0x17de95=this['context']['plugins']['get'](i);_0x17de95['unregister'](_0x430961);const _0x245a23=await this['_services']['get'](_0x430961)['getConnectedSessions']();_0x17de95['register'](_0x430961,_0x245a23);}}async['_connectService'](_0x3bbca1){const {connection:_0xf029c3}=this['context']['plugins']['get'](n),_0x1825b0=this['context']['plugins']['get']('CommentsRepository'),_0x5d1c0b=this['_services']['get'](_0x3bbca1),_0x3fb228=await _0x5d1c0b['connect'](_0xf029c3);await this['_fetchMissingUsersForThreads'](_0x3fb228);const _0x7fc113=new Set(Array['from'](_0x1825b0['getCommentThreads']({'channelId':_0x3bbca1}),_0x20c120=>_0x20c120['id']));for(const _0x5bd98e of _0x3fb228)_0x5bd98e['deletedAt']||_0x7fc113['delete'](_0x5bd98e['commentThreadId']);for(const _0xeb107e of _0x7fc113)_0x1825b0['getCommentThread'](_0xeb107e)['remove']({'isFromAdapter':!0x0});for(const _0x2dc71c of _0x3fb228){let _0xec3491=_0x1825b0['getCommentThread'](_0x2dc71c['commentThreadId']);const {commentThreadId:_0x341f1c,context:_0x27bdf9,attributes:_0x51c75c,resolvedBy:_0x12674a,resolvedAt:_0x50c615,unlinkedAt:_0x3ee6e7,deletedAt:_0x5cf064}=_0x2dc71c;if(_0x5cf064)continue;_0xec3491||(_0xec3491=_0x1825b0['addCommentThread']({'channelId':_0x3bbca1,'threadId':_0x341f1c,'context':_0x27bdf9,'attributes':_0x51c75c||{},'resolvedBy':_0x12674a,'resolvedAt':_0x50c615,'unlinkedAt':_0x3ee6e7,'isFromAdapter':!0x0}));const _0x4b6671=new Set(Array['from'](_0xec3491['comments'],_0x3c342d=>_0x3c342d['id']));for(const _0x3fd173 of _0x2dc71c['comments'])_0x4b6671['delete'](_0x3fd173['commentId']);for(const _0x1fb893 of _0x4b6671)_0xec3491['getComment'](_0x1fb893)['remove']({'isFromAdapter':!0x0});for(const _0x444bc4 of _0x2dc71c['comments']){const _0x8c1ce3=_0xec3491['getComment'](_0x444bc4['commentId']);_0x8c1ce3?_0x8c1ce3['content']!==_0x444bc4['content']&&_0x8c1ce3['update']({'content':_0x444bc4['content'],'isFromAdapter':!0x0}):_0xec3491['addComment'](Object['assign'](p(_0x444bc4),{'isFromAdapter':!0x0}));}}}['_getService'](_0x477648){if(!this['_services']['has'](_0x477648))throw new _0xe0301('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0x477648});return this['_services']['get'](_0x477648);}async['_fetchMissingUsersForThreads'](_0x2a5696){const _0x4aa91a=this['context']['plugins']['get'](_0x488264),{connection:_0x5e751e}=this['context']['plugins']['get'](n),_0x22bf73=new Set();for(const {resolvedBy:_0x5eb470,comments:_0x1e0e64}of _0x2a5696){_0x5eb470&&!_0x4aa91a['getUser'](_0x5eb470)&&_0x22bf73['add'](_0x5eb470);for(const {userId:_0x32948e}of _0x1e0e64)_0x4aa91a['getUser'](_0x32948e)||_0x22bf73['add'](_0x32948e);}if(0x0===_0x22bf73['size'])return;const _0x5828ef=await lt['getMany'](_0x5e751e,Array['from'](_0x22bf73));for(const _0x2d0374 of _0x5828ef)_0x4aa91a['getUser'](_0x2d0374['id'])||_0x4aa91a['addUser'](_0x2d0374);}}async function f(_0x4f07d9){if('404'!==_0x4f07d9['code'])throw _0x4f07d9;}function dt(_0x3c6fd0){if((_0x2a0f34=_0x3c6fd0)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0x2a0f34['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x2a0f34['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0x2a0f34;throw _0x3c6fd0;}function p(_0x37cd7c){return{'threadId':_0x37cd7c['commentThreadId'],'commentId':_0x37cd7c['commentId'],'content':_0x37cd7c['content'],'createdAt':_0x37cd7c['createdAt'],'authorId':_0x37cd7c['userId'],'attributes':_0x37cd7c['attributes']||{}};}class m extends _0x229706{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(_0x3faa65){super(_0x3faa65);const _0x2bec55=this['editor']['config']['get']('collaboration.channelId');this['_bufferedRequests']=new Map(),this['_trackChangesService']=new m['TrackChangesService'](_0x2bec55);}['init'](){const _0x247bb7=this['editor']['plugins']['get'](n),_0x552c0c=this['editor']['plugins']['get']('TrackChangesEditing');return _0x552c0c['adapter']={'getSuggestion':async _0x57602e=>{await this['_waitForServiceReady']();const _0x196003=await this['_trackChangesService']['get'](_0x57602e)['catch'](A);return await this['_fetchMissingUsersForThreads']([_0x196003]),_0x196003;},'addSuggestion':async({id:_0x37a786,type:_0x25eaf6,data:_0xe54f22,originalSuggestionId:_0x4b62ee,attributes:_0x2fc45a})=>{await this['_waitForServiceReady']();const _0x4ac47b={'id':_0x37a786,'type':_0x25eaf6,'data':_0xe54f22,'originalSuggestionId':_0x4b62ee,'attributes':_0x2fc45a},_0xcd298c=await this['_trackChangesService']['add'](_0x37a786,_0x25eaf6,_0xe54f22,_0x4b62ee,_0x2fc45a)['catch'](_0x4fec86=>{if(ut(_0x4fec86))return new Promise(_0x249a30=>{this['_bufferedRequests']['set'](_0x37a786,{'resolve':_0x249a30,'suggestionData':_0x4ac47b});});throw _0x4fec86;});return this['_bufferedRequests']['delete'](_0x37a786),_0xcd298c;},'updateSuggestion':async(_0x5bd329,_0x5cfde6)=>{if(await this['_waitForServiceReady'](),'open'!==_0x5cfde6['state'])return this['_trackChangesService']['update'](_0x5bd329,_0x5cfde6)['catch'](A);}},this['listenTo'](this['_trackChangesService'],'suggestionUpdated',(_0x5121d0,_0x41b6c6)=>{_0x552c0c['hasSuggestion'](_0x41b6c6['id'])&&(_0x552c0c['getSuggestion'](_0x41b6c6['id'])['attributes']=_0x41b6c6['attributes']);}),this['_trackChangesService']['connect'](_0x247bb7['connection'])['then'](_0x3c67e3=>(_0x247bb7['addToReconnectionStack'](this),this['_fetchMissingUsersForThreads'](_0x3c67e3)['then'](()=>{for(const _0x34c5b0 of _0x3c67e3){_0x552c0c['addSuggestionData'](_0x34c5b0)['_saved']=!0x0;}})));}async['reconnect'](){const _0x2949de=this['editor']['plugins']['get']('TrackChangesEditing'),{connection:_0x5d9e4d}=this['editor']['plugins']['get'](n),_0x45af3d=await this['_trackChangesService']['connect'](_0x5d9e4d);await this['_fetchMissingUsersForThreads'](_0x45af3d);for(const {suggestionData:_0xe51569,resolve:_0x4fe489}of this['_bufferedRequests']['values']()){let _0x9f00c2=_0x45af3d['find'](_0x4e0189=>_0x4e0189['id']===_0xe51569['id']);_0x9f00c2||(_0x9f00c2=await this['_trackChangesService']['add'](_0xe51569['id'],_0xe51569['type'],_0xe51569['data'],_0xe51569['originalSuggestionId'])),_0x4fe489(_0x9f00c2);}for(const _0xca8b1f of _0x45af3d)_0x2949de['hasSuggestion'](_0xca8b1f['id'])||_0x2949de['addSuggestionData'](_0xca8b1f);}async['_waitForServiceReady'](){this['_trackChangesService']['isConnected']||await new Promise(_0x494371=>{this['listenTo'](this['_trackChangesService'],'connected',_0x640a25=>{_0x640a25['off'](),_0x494371();});});}async['_fetchMissingUsersForThreads'](_0x5d42f4){const _0x3a742e=this['editor']['plugins']['get'](_0x488264),{connection:_0x270d8b}=this['editor']['plugins']['get'](n),_0x302d31=new Set();for(const {authorId:_0xaf3286}of _0x5d42f4)_0x3a742e['getUser'](_0xaf3286)||_0x302d31['add'](_0xaf3286);if(0x0===_0x302d31['size'])return;const _0x455dba=await lt['getMany'](_0x270d8b,Array['from'](_0x302d31));for(const _0x304ddc of _0x455dba)_0x3a742e['getUser'](_0x304ddc['id'])||_0x3a742e['addUser'](_0x304ddc);}}function A(_0x3796b8){if(ut(_0x3796b8))return new Promise(()=>{});throw _0x3796b8;}function ut(_0x13e0f2){return _0x13e0f2['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x13e0f2['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class g extends _0x229706{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 _0x3414cd=this['editor']['plugins']['get'](n),_0x4ea3ab=this['editor']['plugins']['get']('CommentsEditing'),_0x4bec1e=this['editor']['plugins']['get'](s);return this['editor']['data']['once']('ready',()=>{this['listenTo'](_0x3414cd,'change:state',(_0x200e1f,_0x40743d,_0x3924eb)=>{_0x4ea3ab['isThreadsLoadingPaused']='connected'!==_0x3924eb;});}),this['listenTo'](_0x3414cd,'change:state',(_0x20749b,_0x5afab0,_0x1efece)=>{this['editor']['plugins']['get']('CommentsRepository')['switchReadOnly']('connected'!==_0x1efece);}),_0x4bec1e['_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 _0x229706{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 _0x229706{static ['RevisionHistoryService']=/* #__PURE__ -- @preserve */
|
|
28
|
+
((()=>it)());['_lastRequestId'];['_revisionTracker'];['_revisionHistoryService'];['_oldOffset'];static get['requires'](){return[n,l,'RevisionHistory',i,_0x488264];}static get['pluginName'](){return'CloudServicesRevisionHistoryAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x121120){super(_0x121120);const _0x11d9b1=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new c['RevisionHistoryService'](_0x11d9b1);}async['init'](){const _0x315178=this['editor']['plugins']['get'](l),_0x3bbc52=_0x315178['serverHistory'],_0x70cc3a=this['editor']['plugins']['get'](n);this['_revisionTracker']['setSource']({'history':_0x3bbc52,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0x315178['sessionId']});const _0x457812=this['editor']['config']['get']('cloudServices.bundleVersion')||nt,_0x3cad8a=await tt['isBundleUploaded'](_0x70cc3a['connection'],_0x457812);this['editor']['plugins']['get']('RevisionHistory')['adapter']={'getRevision':async({revisionId:_0x5d7037})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0x5d7037)),'updateRevisions':async _0x4dc072=>{await this['_waitForServiceReady']();const _0x593248=this['_revisionTracker']['currentRevision'];if(_0x3cad8a&&0x1===_0x4dc072['length']&&_0x4dc072[0x0]['id']===_0x593248['id'])return _0x4dc072;for(const _0x2c7128 of _0x4dc072)_0x2c7128['id']===_0x593248['id']&&(_0x2c7128['isEmptyCurrent']=_0x2c7128['fromVersion']===_0x2c7128['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0x4dc072,this['_lastRequestId'])['then'](_0x537e54=>(this['_lastRequestId']=_0x537e54,_0x4dc072))['catch'](_0x431264=>{if(st(_0x431264)||'400'===_0x431264['code']&&void 0x0!==_0x431264['data']['wrongRequestId']){for(const _0x3aee13 of _0x4dc072){!this['_revisionTracker']['repository']['getRevision'](_0x3aee13['id'])||this['_revisionTracker']['_bufferUpdate'](_0x3aee13['id'],_0x3aee13,!0x1);}if(st(_0x431264))throw _0x431264;return _0x4dc072;}throw _0x431264;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0x5e9fdd,{revisionsData:_0x7a08e5,requestId:_0xbcc71d})=>{Math['max'](..._0x7a08e5['map'](_0x10fc8c=>_0x10fc8c['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0x7a08e5,_0xbcc71d);}):this['_handleRevisionsUpdate'](_0x7a08e5,_0xbcc71d);});const {revisions:_0x31db09,requestId:_0x2b9786}=await this['_revisionHistoryService']['connect'](_0x70cc3a['connection']);_0x70cc3a['addToReconnectionStack'](this),this['_lastRequestId']=_0x2b9786,await this['_fetchMissingUsers'](_0x31db09);for(const _0x3e2b66 of _0x31db09)this['_revisionTracker']['addRevisionData'](_0x3e2b66);this['listenTo'](_0x315178,'change:_isConnected',(_0x1d058d,_0x133d1e,_0xd29f93)=>{_0xd29f93&&(this['_oldOffset']=_0x315178['_offset'],_0x1d058d['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](_0x70cc3a,'state',_0x3e2d67=>_0x3e2d67===te['CONNECTED']);}async['reconnect'](){const _0x1a666c=this['editor']['plugins']['get'](n),_0x4d36d0=this['editor']['plugins']['get'](l),_0x1de0ab=async()=>{const _0x590b7d=this['_revisionTracker']['currentRevision'],_0x4805a5=_0x590b7d['id'],_0x46631b=_0x4805a5!==_0x4d36d0['sessionId'];if(_0x46631b){const _0xab7f19=_0x4d36d0['_offset']-this['_oldOffset'],_0x378dfb=this['_getLatestVersionFromServerOperations']();this['_revisionTracker']['_revisionDataBuilder']['reInit']();if(_0x590b7d['toVersion']+_0xab7f19!==_0x378dfb){const _0x14b446=_0x590b7d['fromVersion']+_0xab7f19,_0x11997b=this['editor']['plugins']['get'](_0x488264),_0x5a32fa=this['_revisionTracker']['buildRevisionData']({'revision':_0x590b7d,'from':_0x14b446,'to':_0x378dfb});_0x5a32fa['id']=_0x590b7d['id'];const _0xefb0fd=_0x5a32fa['authorsIds']['map'](_0x568ea7=>_0x11997b['getUser'](_0x568ea7));_0x590b7d['_update']({..._0x5a32fa,'authors':_0xefb0fd},!0x0),this['_revisionTracker']['_bufferUpdate'](_0x590b7d['id'],_0x5a32fa,!0x0);}this['_revisionTracker']['_startingVersion']=_0x378dfb,(_0x590b7d['toVersion']===_0x590b7d['fromVersion']&&!this['_revisionTracker']['_bufferedUpdates']['has'](_0x4805a5)&&this['_revisionTracker']['repository']['_revisions']['remove'](_0x4805a5),this['_revisionTracker']['_createCurrentRevision'](_0x378dfb));}const {revisions:_0x5bc005,requestId:_0x2590ab}=await this['_revisionHistoryService']['reconnect'](_0x1a666c['connection'],this['_lastRequestId']);_0x46631b&&_0x5bc005['length']>0x0?_0x4d36d0['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x5bc005),this['_handleRevisionsUpdate'](_0x5bc005,_0x2590ab),this['_revisionTracker']['sendBufferedUpdates']());};return _0x4d36d0['_isConnected']?_0x1de0ab():new Promise((_0x546f48,_0xf5237b)=>{_0x4d36d0['once']('change:_isConnected',()=>{_0x1de0ab()['then'](_0x546f48)['catch'](_0xf5237b);});});}['destroy'](){super['destroy']();}async['_waitForServiceReady'](){this['_revisionHistoryService']['isConnected']||await new Promise(_0x443a20=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x158d8d=>{_0x158d8d['off'](),_0x443a20();});});}['_getLatestVersionFromServerOperations'](){const _0x3289ae=this['editor']['plugins']['get'](l)['serverHistory']['getOperations']()['reverse']();for(const _0x1e9b54 of _0x3289ae)if('marker'!==_0x1e9b54['type']||_0x1e9b54['affectsData'])return _0x1e9b54['baseVersion']+0x1;}['_getLatestVersion'](){const _0x1cd6ae=this['editor']['plugins']['get'](l);return new Promise(_0x536ce9=>{_0x1cd6ae['_isPendingUpdate']?_0x1cd6ae['once']('change:_isPendingUpdate',()=>{_0x536ce9(this['_getLatestVersionFromServerOperations']());}):_0x536ce9(this['_getLatestVersionFromServerOperations']());});}['_handleRevisionsUpdate'](_0x440296,_0x4c9f2f){const _0x1dec30=this['_revisionTracker']['repository'];this['_lastRequestId']=_0x4c9f2f;for(const _0x4db533 of _0x440296){const _0xf1830c=_0x1dec30['getRevision'](_0x4db533['id']);if(_0xf1830c){if((_0x4db533['fromVersion']||_0x4db533['toVersion'])&&(_0x4db533['diffData']=null),_0xf1830c===this['_revisionTracker']['currentRevision']){const _0x1f2f56=Math['max'](_0xf1830c['toVersion'],_0x4db533['toVersion']),_0x58a7b6=Math['max'](_0xf1830c['fromVersion'],_0x4db533['fromVersion']);let _0x9d34bf;_0xf1830c['toVersion']===_0x4db533['toVersion']&&_0xf1830c['fromVersion']===_0x4db533['fromVersion']?(_0x9d34bf=!0x0,this['_preventResendingRevisionData'](_0x4db533)):_0x4db533['toVersion']===_0x1f2f56&&_0x4db533['fromVersion']===_0x58a7b6?_0x9d34bf=!0x1:(_0xf1830c['toVersion']===_0x1f2f56&&_0xf1830c['fromVersion']===_0x58a7b6||this['_fixRevision']({'revision':_0xf1830c,'from':_0x58a7b6,'to':_0x1f2f56}),_0x9d34bf=!0x0),_0x9d34bf&&(delete _0x4db533['fromVersion'],delete _0x4db533['toVersion'],delete _0x4db533['diffData'],delete _0x4db533['createdAt'],delete _0x4db533['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0x4db533),this['_preventResendingRevisionData'](_0x4db533);}else this['_revisionTracker']['addRevisionData'](_0x4db533);}const _0x36f1ec=_0x1dec30['getRevisions']();_0x36f1ec['reverse']();for(let _0x304253=0x0;_0x304253<_0x36f1ec['length']-0x1;_0x304253++){const _0x36c038=_0x36f1ec[_0x304253],_0x661e9d=_0x36f1ec[_0x304253+0x1];if(_0x36c038['fromVersion']<_0x661e9d['toVersion']){const _0x4daf20=_0x661e9d['toVersion'],_0x386898=Math['max'](_0x4daf20,_0x36c038['toVersion']);this['_fixRevision']({'revision':_0x36c038,'from':_0x4daf20,'to':_0x386898});}}}['_fixRevision']({revision:_0x204229,from:_0x119f51,to:_0x47b349}={}){const _0xdb8093=this['editor']['plugins']['get'](_0x488264),_0x154ff0=this['_revisionTracker']['buildRevisionData']({'revision':_0x204229,'from':_0x119f51,'to':_0x47b349});_0x154ff0['authors']=_0x154ff0['authorsIds']['map'](_0x19d37c=>_0xdb8093['getUser'](_0x19d37c)),_0x204229['_update'](_0x154ff0);}['_preventResendingRevisionData'](_0xf0d101){const _0x31831a={};_0x31831a['id']=_0xf0d101['id'];for(const _0x24a666 of Object['keys'](_0xf0d101))'id'!==_0x24a666&&(_0x31831a[_0x24a666]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0x31831a['id'],_0x31831a,!0x0);}async['_fetchMissingUsers'](_0x329226){const _0xfa8cce=this['editor']['plugins']['get'](_0x488264),{connection:_0x188132}=this['editor']['plugins']['get'](n),_0x2cabd1=new Set();for(const _0x5b917b of _0x329226){for(const _0x3f48ec of _0x5b917b['authorsIds'])_0x1a91bb(_0x3f48ec);_0x5b917b['creatorId']&&_0x1a91bb(_0x5b917b['creatorId']);}if(0x0===_0x2cabd1['size'])return;const _0x2ee8e4=await lt['getMany'](_0x188132,Array['from'](_0x2cabd1));for(const _0x15b24 of _0x2ee8e4)_0xfa8cce['getUser'](_0x15b24['id'])||_0xfa8cce['addUser'](_0x15b24);function _0x1a91bb(_0x497558){_0xfa8cce['getUser'](_0x497558)||_0x2cabd1['add'](_0x497558);}}}function st(_0xfcc595){return _0xfcc595['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0xfcc595['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0xfcc595['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class mt extends _0x229706{static get['requires'](){return['RevisionHistory',c,a];}static get['pluginName'](){return'RealTimeCollaborativeRevisionHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class y extends _0x1d2ee9{['_collapseAt'];constructor(_0x430ae3,_0x482391=0x6){super(_0x430ae3);const _0x4f1d31=this['bindTemplate'];this['set']('isHidden',!0x0),this['set']('usersCount',0x0),this['_collapseAt']=_0x482391,this['bind']('isHidden')['to'](this,'usersCount',_0x2ec691=>_0x2ec691<_0x482391),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item',_0x4f1d31['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':_0x4f1d31['to']('usersCount',_0x3d68ed=>'+'+(_0x3d68ed-this['_collapseAt']+0x2)['toString']())}]}]}]});}}class is extends _0x1d2ee9{['items'];['keystrokes'];constructor(_0x203cfb){super(_0x203cfb);const _0x18242f=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0x5c1d35(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0x18242f['if']('hasPopup'),'aria-expanded':_0x18242f['to']('isExpanded',_0x4fb3e4=>this['hasPopup']&&String(_0x4fb3e4)),'aria-label':_0x18242f['to']('hasPopup',_0x323e02=>W(_0x203cfb,_0x323e02?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0x18242f['to']('hasPopup',_0x22e0d7=>!!_0x22e0d7&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items'],'on':{'mouseenter':_0x18242f['to'](()=>this['fire']('presencelist:show')),'mouseleave':_0x18242f['to'](_0x3b5c14=>{const _0x3e5e42=_0x3b5c14,_0x5de86e=document['querySelector']('.ck-presence-list__dropdown-list'),_0x2a36ea=document['querySelector']('.ck-balloon-panel_with-arrow');_0x5de86e?.['contains'](_0x3e5e42['relatedTarget'])||_0x2a36ea?.['contains'](_0x3e5e42['relatedTarget'])||this['fire']('presencelist:hide');})}}),this['on']('change:hasPopup',(_0x32834d,_0x306df8,_0x4a612b)=>{this['element']&&(_0x4a612b?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 k extends _0x1d2ee9{['counterView'];['inlineListView'];constructor(_0x433e8d,_0x98d3f6=0x6){super(_0x433e8d);const _0x1843ec=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new y(this['locale'],_0x98d3f6),this['inlineListView']=new is(_0x433e8d),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x48b020 of this['inlineListView']['items'])_0x48b020['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',_0x1843ec['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['inlineListView']]});}}class C extends _0x1d2ee9{['listWrapperView'];constructor(_0x3c9eea,_0x3a0abe){super(_0x3c9eea);const _0x70665b=this['bindTemplate'];this['listWrapperView']=new pt(_0x3c9eea,_0x3a0abe),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':W(_0x3c9eea,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']],'on':{'mouseleave':_0x70665b['to'](_0x57f21e=>{const _0x5e5df3=_0x57f21e,_0x2b4c95=document['querySelector']('.ck-presence-list__list'),_0x57090b=document['querySelector']('.ck-balloon-panel_with-arrow');_0x2b4c95?.['contains'](_0x5e5df3['relatedTarget'])||_0x57090b?.['contains'](_0x5e5df3['relatedTarget'])||this['fire']('presencelist:hide');})}});}}class pt extends _0x45e0e5{constructor(_0x1f9a0b,_0x25f690){super(_0x1f9a0b);const _0x1091d=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0x25f690?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0x1091d['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0x1091d['to']('role'),'aria-label':_0x1091d['to']('ariaLabel'),'aria-labelledby':_0x1091d['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0x37251f['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0x14d423=this['element'];_0x14d423&&(this['_isScrollable']=Math['max'](_0x14d423['scrollHeight'],_0x14d423['clientHeight'])>0.8*window['innerHeight']);}}class P extends rt{['userView'];constructor(_0x57a8d1,_0x5cdac6,_0x5b9a3c){super(_0x57a8d1);const _0x280db8=this['bindTemplate'];this['userView']=new ct(_0x57a8d1,_0x5cdac6);const _0x30294d={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0x5cdac6['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0x5cdac6['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x5cdac6['color']['getBackgroundColorClass']()],'aria-hidden':'true'}}]};_0x5b9a3c&&(_0x30294d['tag']='button',_0x30294d['on']={'click':_0x280db8['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x30294d);}['focus'](){this['element']['focus']();}}class _ extends _0x1d2ee9{['userView'];['markerView'];constructor(_0x4d9cef,_0x151fcf,_0x546ace){super(_0x4d9cef);const _0x57b240=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new ct(_0x4d9cef,_0x151fcf),this['markerView']=new at(_0x4d9cef,_0x151fcf);const _0x1ab0e9=new ot(_0x4d9cef);_0x1ab0e9['template']['tag']='span',_0x1ab0e9['text']=_0x151fcf['name'];const _0x5bb868={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0x57b240['to']('isFocusable',_0x15e2bc=>!!_0x15e2bc&&0x0),'aria-labelledby':_0x1ab0e9['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0x57b240['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0x57b240['to']('hasTooltip',_0x5d2609=>!_0x5d2609),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0x1ab0e9]};_0x546ace&&(_0x5bb868['tag']='button',_0x5bb868['on']={'click':_0x57b240['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x5bb868);}}class at extends _0x1d2ee9{constructor(_0x38de3f,_0x42196c){super(_0x38de3f),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x42196c['color']['getBackgroundColorClass']()],'aria-hidden':'true'}});}}const U={'collapseAt':0x6,'displayMe':!0x0};class r extends _0x5daa10{['currentDisplayedUsers'];['balloonPanelView'];['view'];['presenceDropdownView'];['_bodyCollection']=null;static get['pluginName'](){return'PresenceListUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x361dc7){super(_0x361dc7),this['context']['config']['define']('presenceList',U);const _0x29fa42=_0x361dc7['config']['get']('presenceList.collapseAt');if('number'!=typeof _0x29fa42)throw new _0xe0301('presencelist-collapseat-invalid-format',this);if(_0x29fa42<0x1)throw new _0xe0301('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](i)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0x493251(),this['balloonPanelView']=new _0x5144ca(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get['requires'](){return[i];}['init'](){for(const _0x5d78c6 of this['_allConnectedUsers'])this['_handleUserAdd'](_0x5d78c6);this['listenTo'](this['_allConnectedUsers'],'add',(_0x49e00d,_0x5998ce)=>{this['_handleUserAdd'](_0x5998ce);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0x416bcd,_0x1b4b28)=>{this['_handleUserRemove'](_0x1b4b28);});}['_createView'](){const _0x5d147a=this['context'],_0x4adefc=new k(this['context']['locale'],this['context']['config']['get']('presenceList.collapseAt')),_0x347213=this['balloonPanelView'];if(!_0x4224bb(_0x5d147a['config']['get']('presenceList.container')))throw new _0xe0301('presencelist-missing-container',this);return _0x4adefc['counterView']['bind']('usersCount')['to'](this),_0x4adefc['bind']('isCollapsed')['to'](this,'usersCount',_0x5ebe1e=>{const {collapseAt:_0x5aabdf}=_0x5d147a['config']['get']('presenceList'),_0x54b43d=_0x5ebe1e>=_0x5aabdf;if(_0x54b43d&&!_0x4adefc['inlineListView']['items']['find'](_0x58b446=>_0x58b446 instanceof y)){const _0x2868a9=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['currentDisplayedUsers']['length']==_0x2868a9&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](this['currentDisplayedUsers']['length']-0x1),_0x4adefc['inlineListView']['items']['add'](_0x4adefc['counterView']);}return _0x54b43d||this['hideDropdown'](),_0x54b43d;}),_0x4adefc['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0x58f9c9=>{const _0x3600df=_0x5d147a['config']['get']('presenceList'),_0x5f5a99=new _(_0x5d147a['locale'],_0x58f9c9,!!_0x3600df['onClick']);return _0x5f5a99['bind']('hasTooltip')['to'](_0x4adefc,'isCollapsed',_0x148b76=>!_0x148b76),_0x5f5a99['bind']('isFocusable')['to'](_0x4adefc,'isCollapsed',_0x57ed77=>!_0x57ed77),_0x3600df['onClick']&&this['listenTo'](_0x5f5a99,'execute',()=>{this['view']['isCollapsed']||_0x3600df['onClick'](_0x58f9c9,_0x5f5a99['element']);}),_0x5f5a99;}),this['listenTo'](_0x4adefc['inlineListView'],'presencelist:show',()=>{this['view']['isCollapsed']&&this['showDropdown']();}),this['listenTo'](_0x4adefc['inlineListView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();}),_0x4adefc['inlineListView']['keystrokes']['set']('Enter',(_0x358472,_0x5280a6)=>{this['view']['isCollapsed']&&(this['showDropdown'](),_0x5280a6());}),_0x4adefc['render'](),_0x347213['render'](),_0x1e7e5d({'emitter':_0x4adefc,'activator':()=>_0x347213['isVisible'],'contextElements':[_0x347213['element'],_0x4adefc['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0x5d147a['config']['get']('presenceList.container')['appendChild'](_0x4adefc['element']),this['_bodyCollection']=new _0xf7f15a(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_bodyCollection']['add'](this['balloonPanelView']),_0x4adefc;}['_handleUserAdd'](_0x1fe0ed){if(!this['context']['config']['get']('presenceList.displayMe')&&_0x1fe0ed['isMe'])return;const _0x5b7e75=this['context']['config']['get']('presenceList.collapseAt')-0x1;for(this['usersCount']++;this['currentDisplayedUsers']['length']>=_0x5b7e75-(this['view']['isCollapsed']?0x1:0x0)&&this['currentDisplayedUsers']['length']>0x1;)this['currentDisplayedUsers']['remove'](0x1);const _0x3c96c4=_0x1fe0ed['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0x1fe0ed,_0x3c96c4);}['_handleUserRemove'](_0x5f2121){this['usersCount']--;const {collapseAt:_0xa4a17b}=this['context']['config']['get']('presenceList'),_0x36e603=this['usersCount']>=_0xa4a17b;if(this['currentDisplayedUsers']['get'](_0x5f2121['id']))this['currentDisplayedUsers']['remove'](_0x5f2121['id']);else{if(_0x36e603&&this['currentDisplayedUsers']['length']+0x1===_0xa4a17b-0x1)return;}if(this['currentDisplayedUsers']['length']+(_0x36e603?0x1:0x0)<this['usersCount']){for(const _0x580872 of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0x580872['id'])&&(this['currentDisplayedUsers']['add'](_0x580872,Math['min'](this['currentDisplayedUsers']['length']-(_0x36e603?0x1:0x0),0x1)),this['currentDisplayedUsers']['length']+(_0x36e603?0x1:0x0)===_0xa4a17b-0x1))return;}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0x209244=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new C(this['context']['locale'],!!_0x209244['onClick']),this['view']['inlineListView']['isExpanded']=!0x0,this['listenTo'](this['presenceDropdownView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();});const {listWrapperView:_0xaa2994}=this['presenceDropdownView'];_0xaa2994['items']['bindTo'](this['_allConnectedUsers'])['using'](_0x234828=>{if(!_0x209244['displayMe']&&_0x234828['isMe'])return null;const _0x18d777=new P(this['context']['locale'],_0x234828,!!_0x209244['onClick']);return _0x209244['onClick']&&this['listenTo'](_0x18d777,'execute',()=>{_0x209244['onClick'](_0x234828,_0x18d777['element']);}),_0x18d777;}),this['balloonPanelView']['content']['add'](this['presenceDropdownView']),this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element']}),_0xaa2994['focus'](),_0xaa2994['checkIfScrollable']();const _0x3529e8=(_0x376ab2,_0xa7c4c3)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0xa7c4c3();};_0xaa2994['keystrokes']['set']('Esc',_0x3529e8),_0xaa2994['keystrokes']['set']('Shift+Tab',_0x3529e8),_0xaa2994['keystrokes']['set']('Tab',(_0x29dce1,_0x2d0b07)=>{!function(_0x4d2f74){const _0x35f6ab=['a','button','input','select','textarea','[tabindex]','[contenteditable]']['map'](_0x308336=>_0x308336+':not([disabled]):not([tabindex=\x22-1\x22])')['join'](','),_0x128ff3=[...document['body']['querySelectorAll'](_0x35f6ab)]['filter'](_0x2c2ad3=>_0x2c2ad3===document['activeElement']||_0x2c2ad3['offsetWidth']+_0x2c2ad3['offsetHeight']>0x0)['sort']((_0x308262,_0x1f95f1)=>(_0x308262['tabIndex']||0x0)-(_0x1f95f1['tabIndex']||0x0)),_0x57b9df=_0x128ff3['indexOf'](_0x4d2f74),_0xcd727b=_0x128ff3[(_0x57b9df+0x1)%_0x128ff3['length']];_0xcd727b&&_0xcd727b['focus']();}(this['view']['element']),this['hideDropdown'](),_0x2d0b07();}),_0xaa2994['focusTracker']['add'](this['view']['element']),_0xaa2994['focusTracker']['on']('change:isFocused',(_0x511514,_0x7cfee,_0x579512)=>{_0x579512||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 _0x5daa10{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};
|