@ckeditor/ckeditor5-real-time-collaboration 47.7.2-alpha.0 → 47.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/real-time-collaboration.js +1 -1
- package/dist/index.js +6 -6
- package/package.json +14 -14
- package/src/presencelist/view/presencedropdownlistitemview.js +1 -1
- package/src/presencelist/view/presencedropdownlistview.js +1 -1
- package/src/presencelist/view/presenceinlinelistitemview.js +1 -1
- package/src/presencelist/view/presenceinlinelistview.js +1 -1
- package/src/realtimecollaborativecomments/cloudservicescommentsadapter.js +2 -2
- package/src/realtimecollaborativeediting/realtimecollaborationclient.js +2 -2
- package/src/realtimecollaborativeediting/usermarkers.js +1 -1
- package/src/realtimecollaborativeediting/websocketgateway.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
|
-
((()=>ot)());static ['initialReconnectionInterval']=0x3e8;['connection'];['_reconnectionStack'];['_shouldPluginsReconnect'];['_domEmitter'];static get['requires'](){return['CloudServices',_0x2d9d9d];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x6567d0){super(_0x6567d0),this['set']('state',_0x3e236f['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=new(_0x5278b2())();}['init'](){const _0x20d725=this['context'],_0x1aea49=_0x20d725['plugins']['get']('CloudServices'),_0x18df6a=_0x20d725['plugins']['get'](_0x2d9d9d);if(!_0x1aea49['token'])throw new _0x1b0251('websocketgateway-missing-token',this);if(!_0x1aea49['webSocketUrl'])throw new _0x1b0251('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'](_0x1aea49['token'],_0x1aea49['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0x3b332c=>{if(this['connection']=_0x3b332c,this['bind']('state')['to'](_0x3b332c,'state',this,'_isBrowserOffline',(_0x43e0cd,_0x1fb412)=>('connected'!==_0x43e0cd&&(this['_shouldPluginsReconnect']=!0x0),_0x1fb412||_0x43e0cd!==_0x3e236f['CONNECTED']?_0x3e236f['DISCONNECTED']:this['state']==_0x3e236f['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),_0x3e236f['CONNECTING']):_0x3e236f['CONNECTED'])),this['connection']['on']('error',(_0xca1825,_0x523874)=>{if('limitExceeded'!==_0x523874['code'])throw console['error'](_0x523874),new _0x1b0251('cloudservices-init',null,{'originalError':_0x523874});_0x18df6a['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'});}),!_0x3b332c['me'])return new Promise(_0x6d6801=>_0x3b332c['on']('change:me',_0x6d6801));})['catch'](_0x4b23e5=>{throw console['error'](_0x4b23e5),new _0x1b0251('cloudservices-init',null,{'originalError':_0x4b23e5});});}['addToReconnectionStack'](_0x100763){if('function'!=typeof _0x100763['reconnect'])throw new _0x1b0251('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0x100763))throw new _0x1b0251('websocketgateway-plugin-already-registered',this,{'name':_0x100763['constructor']['pluginName']});this['_reconnectionStack']['add'](_0x100763);}['removeFromReconnectionStack'](_0x990d6){this['_reconnectionStack']['delete'](_0x990d6);}['isInReconnectionStack'](_0x55036c){return this['_reconnectionStack']['has'](_0x55036c);}['_reconnect'](){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0x17f7cc=>_0x17f7cc['reconnect']())))['then'](()=>this['state']=_0x3e236f['CONNECTED'])['catch'](_0x5f46ce=>{throw console['error'](_0x5f46ce),new _0x1b0251('cloudservices-reconnection-error',this['context']);});}['disconnect'](){this['connection']&&this['connection']['disconnect'](),this['state']=_0x3e236f['DISCONNECTED'],this['_domEmitter']['stopListening']();}['destroy'](){this['disconnect'](),super['destroy']();}}class i extends _0xfd8900{['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,_0x1d3547];}constructor(_0x312b81){super(_0x312b81),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0x51237b(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x1d3547);}['init'](){const _0x28b9eb=this['context']['plugins']['get'](n);this['listenTo'](_0x28b9eb,'change:state',(_0x371feb,_0x4c8078,_0x2f7e77)=>{if('connected'!==_0x2f7e77)this['channelSessions']['forEach'](_0x5a7ed1=>_0x5a7ed1['clear']()),this['channelConnectedUsers']['forEach'](_0x5eb883=>_0x5eb883['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x110c19,_0x460b88]of this['_registeredSessions'])for(const _0x222ff8 of _0x460b88)this['_handleSessionAdd'](_0x110c19,_0x222ff8);}}),this['_createUser'](_0x28b9eb['connection']['me'],!0x0);}['register'](_0x27cd96,_0x50ce92){if(this['_registeredSessions']['has'](_0x27cd96))throw new _0x1b0251('sessions-register-already-registered',null,{'channelId':_0x27cd96});this['_registeredSessions']['set'](_0x27cd96,_0x50ce92),this['channelSessions']['set'](_0x27cd96,new _0x51237b()),this['channelConnectedUsers']['set'](_0x27cd96,new _0x51237b()),this['listenTo'](_0x50ce92,'add',(_0x544903,_0x4e60c0)=>this['_handleSessionAdd'](_0x27cd96,_0x4e60c0)),this['listenTo'](_0x50ce92,'remove',(_0x4bc755,_0x4be552)=>this['_handleSessionRemove'](_0x27cd96,_0x4be552));for(const _0x533c64 of _0x50ce92)this['_handleSessionAdd'](_0x27cd96,_0x533c64);}['unregister'](_0x182601){if(!this['_registeredSessions']['has'](_0x182601))throw new _0x1b0251('sessions-unregister-not-exist',null,{'channelId':_0x182601});const _0x39e9e9=this['_registeredSessions']['get'](_0x182601);this['stopListening'](_0x39e9e9);for(const _0x7ea4dd of _0x39e9e9)'connected'===this['context']['plugins']['get'](n)['state']&&this['_handleSessionRemove'](_0x182601,_0x7ea4dd);this['_registeredSessions']['delete'](_0x182601),this['channelSessions']['delete'](_0x182601),this['channelConnectedUsers']['delete'](_0x182601);}get['mySessionId'](){return this['context']['plugins']['get'](n)['connection']['sessionId'];}['getUserBySessionId'](_0x436209){for(const _0x33bfdf of this['channelSessions']['values']())for(const _0x3263ad of _0x33bfdf)if(_0x3263ad['id']===_0x436209)return _0x3263ad['user'];}['getUserSessions'](_0x1ad67e,_0x4ad84a){const _0x4add06=_0x4ad84a?[this['channelSessions']['get'](_0x4ad84a)]:this['channelSessions']['values'](),_0x306f02=new Set();for(const _0x7ddbed of _0x4add06)for(const _0x588b28 of _0x7ddbed)_0x588b28['user']['id']===_0x1ad67e['id']&&_0x306f02['add'](_0x588b28['id']);return _0x306f02;}['getUserRole'](_0x3bedc1){for(const _0x2cd92e of this['channelSessions']['values']())for(const _0x4376 of _0x2cd92e)if(_0x4376['user']===_0x3bedc1)return _0x4376['role'];}['_handleSessionAdd'](_0x52beea,_0x3c1bcd){if('connected'!==this['context']['plugins']['get'](n)['state'])return;const _0x552a1c=_0x3c1bcd['user'],_0x5c7368=this['_users']['getUser'](_0x552a1c['id'])||this['_createUser'](_0x552a1c),_0x102cc1=Object['assign']({},_0x3c1bcd,{'user':_0x5c7368});if(this['channelSessions']['get'](_0x52beea)['add'](_0x102cc1),!_0x552a1c['hiddenInPresenceList']){const _0x308bae=this['channelConnectedUsers']['get'](_0x52beea);_0x308bae['has'](_0x5c7368['id'])||_0x308bae['add'](_0x5c7368),this['allConnectedUsers']['has'](_0x5c7368['id'])||_0x552a1c['hiddenInPresenceList']||this['allConnectedUsers']['add'](_0x5c7368,_0x5c7368['isMe']?0x0:void 0x0);}this['fire']('sessionAdd:'+_0x52beea,{'channelId':_0x52beea,'session':_0x102cc1});}['_handleSessionRemove'](_0x47614e,_0x32bf1a){if('connected'!==this['context']['plugins']['get'](n)['state'])return;const _0x4d3f45=this['channelConnectedUsers']['get'](_0x47614e),_0x2634fd=_0x32bf1a['user'];_0x2634fd['id']&&(this['channelSessions']['get'](_0x47614e)['remove'](_0x32bf1a['id']),_0x4d3f45['has'](_0x2634fd['id'])&&!this['getUserSessions'](_0x2634fd,_0x47614e)['size']&&_0x4d3f45['remove'](_0x2634fd['id']),this['allConnectedUsers']['get'](_0x2634fd['id'])&&!this['getUserSessions'](_0x2634fd)['size']&&this['allConnectedUsers']['remove'](_0x2634fd['id']));}['_createUser'](_0x32bd9f,_0x5632e9){const _0x3754e4=this['_users']['addUser'](_0x32bd9f);return _0x5632e9&&this['_users']['defineMe'](_0x32bd9f['id']),_0x3754e4['orderNumber']=this['_uniqueUsersCount']++,_0x3754e4;}}class G extends _0x30d29d{['_domEmitter']=new(_0x5278b2())();static get['requires'](){return[i];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x1f5088=this['editor'],_0x5de332=_0x1f5088['plugins']['get'](i);_0x1f5088['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x54bc48,{writer:_0x241052})=>function(_0x148d5f,_0x5c06bc,_0x5ed2f5,_0x295f68){const _0x4ac57d=_0x148d5f['markerName']['split'](':')[0x2],_0x337ea6=_0x5ed2f5['getUserBySessionId'](_0x4ac57d);if(!_0x337ea6||_0x4ac57d===_0x5ed2f5['mySessionId'])return;if(!_0x295f68['model']['schema']['checkChild'](_0x148d5f['markerRange']['start'],'$text'))return;const _0x26b996={'class':'ck-user__marker\x20'+_0x337ea6['color']['getMarkerClass'](),'data-name':_0x337ea6['name'],'data-session-id':_0x4ac57d},_0x1c7bde=_0x295f68['model']['markers']['get'](_0x148d5f['markerName']),_0x3a6f5e=_0x1c7bde['getStart'](),_0x394848=_0x3a6f5e['nodeAfter'],_0x410b91=_0x295f68['model']['schema'];if(_0x394848&&_0x410b91['isObject'](_0x394848)&&_0x410b91['isInline'](_0x394848)&&!_0x295f68['model']['markers']['get']('user:range:'+_0x4ac57d)['getRange']()['isCollapsed'])return;const _0x1333a3=_0x3a6f5e['parent'];return _0x295f68['model']['schema']['isLimit'](_0x1333a3)&&!_0x295f68['model']['hasContent'](_0x1333a3)&&(_0x26b996['contenteditable']=!0x1),function(_0x34e858,_0x5e3217,_0x5aa3c6){const _0xac9e54=_0x34e858['createUIElement']('span',_0x5e3217);return _0x34e858['setCustomProperty']('userPositionMarker',!0x0,_0xac9e54),_0xac9e54['render']=function(_0xcf000d){const _0x2c7c9b=this['toDomElement'](_0xcf000d),_0x279fbb=document['createElement']('span');return _0x279fbb['classList']['add']('ck-user__marker-tooltip'),_0x279fbb['setAttribute']('contenteditable','false'),_0x279fbb['setAttribute']('spellcheck','false'),_0x279fbb['textContent']=_0x5aa3c6['name'],_0x2c7c9b['innerHTML']='<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span>'+_0x279fbb['outerHTML']+'',_0x2c7c9b['addEventListener']('mouseenter',()=>{_0x2c7c9b['classList']['add']('ck-user__marker_hovered');}),_0x2c7c9b['addEventListener']('mouseleave',()=>{_0x2c7c9b['classList']['remove']('ck-user__marker_hovered');}),_0x2c7c9b;},_0xac9e54['isSimilar']=function(_0x40ef56){return!(!this['getCustomProperty']('userPositionMarker')||!_0x40ef56['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0x40ef56['getAttribute']('data-session-id'));},_0xac9e54;}(_0x5c06bc,_0x26b996,_0x337ea6);}(_0x54bc48,_0x241052,_0x5de332,_0x1f5088)}),_0x1f5088['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0x8bc35=>function(_0x40edef,_0x2730e3){const _0x5206b7=_0x40edef['markerName']['split'](':')[0x2];if(_0x5206b7===_0x2730e3['mySessionId'])return null;const _0x13e8c9=_0x2730e3['getUserBySessionId'](_0x5206b7);if(!_0x13e8c9)return{'id':_0x5206b7,'classes':[]};return{'id':_0x5206b7,'classes':['ck-user__selection',_0x13e8c9['color']['getSelectionClass']()],'attributes':{'data-session-id':_0x5206b7},'priority':0x7d0+_0x13e8c9['orderNumber']};}(_0x8bc35,_0x5de332)}),function(_0x597067){const _0x5f5677=_0x597067['model'],_0x8f9bc5=new Map(),_0x170d96=_0x597067['plugins']['get'](i);_0x5f5677['markers']['on']('update:user:range',(_0x5b0302,_0x345821,_0x190c00,_0xef95c5)=>{if(!_0xef95c5&&_0x8f9bc5['get'](_0x345821['name']))return _0x8f9bc5['get'](_0x345821['name'])['detach'](),void _0x8f9bc5['delete'](_0x345821['name']);const _0x4f88b8=_0x345821['name']['split'](':')[0x2];if(_0x4f88b8===_0x170d96['mySessionId'])return;const _0x219095='user:position:'+_0x4f88b8;_0x5f5677['markers']['has'](_0x219095)&&_0x597067['editing']['reconvertMarker'](_0x219095),_0x345821['on']('change:range',(_0x25d341,_0x2d973b,_0x32ccce)=>{if('$graveyard'!=_0x2d973b['root']['rootName']&&'$graveyard'==_0x345821['getRange']()['root']['rootName']&&!_0x8f9bc5['has'](_0x345821['name'])){const _0x448ef0=_0x5f5677['schema']['getNearestSelectionRange'](_0x32ccce['deletionPosition']);if(_0x448ef0){const _0x484a84=_0x221838['fromRange'](_0x448ef0);_0x8f9bc5['set'](_0x345821['name'],_0x484a84),_0x484a84['on']('change:range',(_0x560d03,_0x479116,_0x32be4a)=>{if('$graveyard'==_0x484a84['root']['rootName']){const _0x97f43=_0x5f5677['schema']['getNearestSelectionRange'](_0x32be4a['deletionPosition']);_0x97f43?(_0x484a84['start']=_0x97f43['start'],_0x484a84['end']=_0x97f43['end']):(_0x8f9bc5['delete'](_0x345821['name']),_0x484a84['detach']());}});}}});}),_0x5f5677['document']['on']('change',()=>{_0x8f9bc5['size']>0x0&&_0x5f5677['enqueueChange']({'isUndoable':!0x1},_0xa73fad=>{for(const [_0x3efe0a,_0x1da1c7]of _0x8f9bc5)'$graveyard'==_0x5f5677['markers']['get'](_0x3efe0a)['getRange']()['root']['rootName']&&(re(_0x3efe0a['split'](':')[0x2],_0x1da1c7['toRange'](),_0x5f5677,_0xa73fad),_0x1da1c7['detach']());_0x8f9bc5['clear']();});});}(_0x1f5088),this['_domEmitter']['listenTo'](_0x2b0da0['document'],'keydown',(_0x461006,{key:_0x1f4240})=>{'Escape'===_0x1f4240&&function(_0x5cfbbd){_0x5cfbbd['editing']['view']['change'](_0x304847=>{for(const _0x19a42d of _0x5cfbbd['model']['markers']){if(!_0x19a42d['name']['startsWith']('user:position'))continue;const _0x45ca17=_0x5cfbbd['editing']['mapper']['markerNameToElements'](_0x19a42d['name']);if(_0x45ca17){for(const _0x5ccc78 of _0x45ca17)_0x304847['removeClass']('ck-user__marker_hovered',_0x5ccc78);}}});}(_0x1f5088);},{'useCapture':!0x0});}['afterInit'](){const _0x4e1bb6=this['editor'],_0xf701f0=_0x4e1bb6['commands']['get']('undo');_0xf701f0&&_0x4e1bb6['model']['on']('applyOperation',(_0x5bdcca,_0x105ace)=>{const _0x1fe453=_0x105ace[0x0];if(!_0x1fe453['isDocumentOperation'])return;if('marker'!=_0x1fe453['type']||!_0x1fe453['name']['startsWith']('user:'))return;const _0x441e73=_0x1fe453['batch'];_0xf701f0['_createdBatches']['has'](_0x441e73)&&(_0x1fe453['newRange']=_0x1fe453['oldRange']?_0x4e1bb6['model']['createRange'](_0x1fe453['oldRange']['start'],_0x1fe453['oldRange']['end']):null);},{'priority':'highest'});}['destroy'](){return this['_domEmitter']['stopListening'](),super['destroy']();}['createUserMarkerOperations'](){const _0x1073aa=this['editor'],_0x13b98b=_0x1073aa['model']['document'],_0x3a7ec5=_0x1073aa['plugins']['get'](i);_0x1073aa['model']['enqueueChange']({'isUndoable':!0x1},_0x4c15d3=>{const _0x1cc539='user:range:'+_0x3a7ec5['mySessionId'],_0x4e0941='user:position:'+_0x3a7ec5['mySessionId'],_0x145f1e=_0x1073aa['model']['markers']['has'](_0x1cc539);_0x1073aa['editing']['view']['hasDomSelection']?re(_0x3a7ec5['mySessionId'],_0x13b98b['selection']['getFirstRange'](),_0x1073aa['model'],_0x4c15d3):_0x145f1e&&(_0x4c15d3['removeMarker'](_0x1cc539),_0x4c15d3['removeMarker'](_0x4e0941));});}}function re(_0xcefcad,_0x5dd2f1,_0x58af40,_0x17036a){const _0x48a737='user:range:'+_0xcefcad,_0x5e18c5='user:position:'+_0xcefcad,_0x4f01de=_0x5dd2f1['getContainedElement']();let _0x2bb926=_0x5dd2f1['start'];if(_0x4f01de&&_0x4f01de['is']('element','tableCell')){const _0xc93ea0=function(_0x58ebef,_0x4c6b5d){for(const _0x179854 of _0x58ebef['getPositions']())if(_0x4c6b5d['schema']['checkChild'](_0x179854,'$text'))return _0x179854;}(_0x5dd2f1,_0x58af40);_0xc93ea0&&(_0x2bb926=_0xc93ea0,_0x5dd2f1=_0x17036a['createRange'](_0x2bb926));}const _0x46706f=_0x17036a['createRange'](_0x2bb926);_0x58af40['markers']['has'](_0x48a737)?(_0x17036a['updateMarker'](_0x48a737,{'range':_0x5dd2f1}),_0x17036a['updateMarker'](_0x5e18c5,{'range':_0x46706f})):(_0x17036a['addMarker'](_0x48a737,{'range':_0x5dd2f1,'usingOperation':!0x0}),_0x17036a['addMarker'](_0x5e18c5,{'range':_0x46706f,'usingOperation':!0x0}));}function $(_0xf1973d,_0x4a9c0c,_0x2d439e){const _0x2dac56=_0xf1973d['t'],t=_0xf1973d['t'];switch(_0x4a9c0c){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 _0x2dac56({'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'},_0x2d439e);default:return'';}}let Q=0x1;class l extends _0x30d29d{static ['CollaborativeEditingService']=/* #__PURE__ -- @preserve */
|
|
25
|
-
((()=>_0x1992e4)());['_offset'];['sessionId'];['serverHistory'];['_channelId'];['_service'];['_document'];['_compressor'];['_bufferedOperations'];['_knownOperations'];['_knownRootNames'];['_pendingAction'];['_hasSelectionChanged'];['_sendBufferedOperationsDelayId'];['_baseBufferDelay'];['_currentBufferDelay'];['_lastSyncedOperationId'];['_disconnectionOperations'];['_operationIdentifier'];static get['requires'](){return[n,i,G,_0x2cbdaa,_0x1d3547,_0x2d9d9d];}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 _0x20e596=this['serverHistory']['getOperations']();for(let _0x4a1873=_0x20e596['length']-0x1;_0x4a1873>=0x0;_0x4a1873--){const _0x4de24b=_0x20e596[_0x4a1873];if(!this['_disconnectionOperations']['has'](_0x4de24b))return _0x4de24b['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0x59ebb1){if(super(_0x59ebb1),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x376331(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0x1b0251('collaboration-missing-channelid',this);const _0x357b89=_0x59ebb1['config']['get']('cloudServices.bundleVersion')||nt;this['_service']=new l['CollaborativeEditingService'](_0x357b89,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0x354552(),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 OperationIdentifier(this['_disconnectionOperations']);}['init'](){const _0x465458=this['editor'],_0x1fe482=_0x465458['plugins']['get'](_0x1d3547),_0x358309=_0x465458['plugins']['get'](n);this['listenTo'](_0x1fe482,'getOperationAuthor',(_0x45d88d,_0x8f7327)=>{const _0x5b1725=_0x8f7327[0x0];_0x5b1725['_authorId']&&(_0x45d88d['return']=_0x1fe482['getUser'](_0x5b1725['_authorId']),_0x45d88d['stop']()),null===_0x5b1725['_authorId']&&(_0x45d88d['return']=null,_0x45d88d['stop']());},{'priority':'high'}),this['listenTo'](_0x465458['model']['document']['selection'],'change:range',(_0x1d0483,_0x610e20)=>{_0x610e20['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x465458['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x465458['model']['on']('applyOperation',(_0xdb3b44,_0x42fd94)=>{const _0x2e3f82=_0x42fd94[0x0];_0x2e3f82['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0x2e3f82),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['bind']('_isEditingAllowed')['to'](_0x358309,'state',this,'_hasSynchronizationProblem',(_0x252692,_0x1cc776)=>'connected'===_0x252692&&!_0x1cc776),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x465458['disableReadOnlyMode']('rtc-offline'):_0x465458['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x465458['disableReadOnlyMode']('rtc-offline'):_0x465458['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async['reconnect'](){const _0x172db8=this['editor']['plugins']['get'](i),_0x2b278a=this['editor']['plugins']['get'](n);try{this['_isPendingUpdate']=!0x0,_0x172db8['unregister'](this['_channelId']);const _0xe17376=await this['_service']['reconnect'](_0x2b278a['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0xe17376)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x13b0e5=await this['_service']['getConnectedSessions']();_0x172db8['register'](this['_channelId'],_0x13b0e5),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x3d020b){if(function(_0x450865){return'404'===_0x450865['code'];}(_0x3d020b)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0x456086){return'409'===_0x456086['code'];}(_0x3d020b)){const _0x18b071=$(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'](_0x18b071);}else{if(!(_0x3d020b instanceof ReconnectionError))throw _0x3d020b;this['_handleReconnectionError']();}}}}['destroy'](){const _0x305c67=this['editor']['plugins']['get'](n),_0x51f172=this['editor']['plugins']['get'](i);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x51f172['channelSessions']['has'](this['_channelId'])&&_0x51f172['unregister'](this['_channelId']),_0x305c67['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async['_handleReconnectionResponse'](_0xbadc3a){if(this['sessionId']!==_0xbadc3a['sessionId']&&this['_lastSyncedOperationId']!==_0xbadc3a['lastOperationId'])throw new ReconnectionError();return this['sessionId']=_0xbadc3a['sessionId'],this['_handleServerResponse']([],{..._0xbadc3a,'wereChangesApplied':!0x1,'data':_0xbadc3a['data']},'reconnect');}async['_connectService'](_0x524dfe,_0x50f86f=!0x1){const {connection:_0x1ea880}=this['editor']['plugins']['get'](n);l['CollaborativeEditingService']['getConnectedSessions'](_0x1ea880,this['_channelId'])['then'](_0x30e4e4=>this['_initSessionsHandling'](_0x30e4e4))['catch'](_0x3cc173=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x3cc173);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x59191d,_0x22c3e2)=>{this['_crash']('realtimecollaborationclient-init-service-internal-error',_0x22c3e2);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_isConnected']=!0x1;});const _0x4ad5a3=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x524dfe);this['_isPendingUpdate']=!0x0;const _0x79958c=await this['_service']['connect'](_0x1ea880,this['_compressOperations'](_0x524dfe),_0x4ad5a3);if(this['sessionId']=_0x79958c['sessionId'],_0x50f86f){if(!_0x79958c['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x79958c['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0x524dfe,_0x79958c,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x79958c,_0x524dfe);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}['_handleSendingSelectionMarkers'](){const _0x353b22=this['editor']['plugins']['get'](i),_0x2ebaa4=this['editor']['plugins']['get'](G),_0x2fd55b=_0x353b22['channelSessions']['get'](this['_channelId']);_0x2fd55b&&_0x2fd55b['length']>0x1?_0x2ebaa4['createUserMarkerOperations']():this['listenTo'](_0x353b22,'sessionAdd:'+this['_channelId'],()=>{0x2===_0x353b22['channelSessions']['get'](this['_channelId'])['length']&&_0x2ebaa4['createUserMarkerOperations']();});}async['_handleReceivedOperations'](_0xa488bb,_0x1a28b6,_0x535040,_0x420e60){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x1a28b6){const _0x4d2e24=this['_decompressOperations'](_0x535040,_0x420e60);await this['_fetchMissingUsers'](_0x4d2e24),this['_handleExternalOperations'](_0x4d2e24,_0x1a28b6,_0x535040['lastOperationId'])||this['_crash']('realtimecollaborationclient-init-service-incorrect-server-operation');}}async['_connectAfterSessionHasBeenFlushed'](){this['_disconnectService']();const {locale:_0x446cd3}=this['editor'];let _0x48213e;try{_0x48213e=await this['_service']['getDocumentDetails']();}catch{const _0x38ac85=$(_0x446cd3,'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'](_0x38ac85);}const _0x1faeb4=_0x48213e['currentDocumentSession']||_0x48213e['lastDocumentSession'];if(this['_lastSyncedOperationId']!==_0x1faeb4['lastOperationId']){const _0xf0609f=$(_0x446cd3,'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'](_0xf0609f);}await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);}['_disconnectService'](){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['stopListening'](this['_service']);}['_initSessionsHandling'](_0x2a2b04){const _0x2569e1=this['editor']['plugins']['get'](i);this['listenTo'](_0x2569e1,'sessionAdd:'+this['_channelId'],(_0x4e09ee,{session:_0x4bb762})=>{if(_0x4bb762['id']===_0x2569e1['mySessionId']){_0x4e09ee['off']();const _0x379225=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0x9e13fd=_0x4bb762['permissions'];_0x379225&&_0x379225['isEnabled']&&(_0x9e13fd=_0x9e13fd['filter'](_0x41a969=>'document:write'!==_0x41a969)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0x9e13fd,this['_channelId']);}}),_0x2569e1['register'](this['_channelId'],_0x2a2b04);}['_initThrowingOnDataSet'](){const _0x15c768=this['editor']['data']['set'];this['editor']['data']['set']=(..._0x2bc3a4)=>{if(!_0x2bc3a4[_0x2bc3a4['length']-0x1]['suppressErrorInCollaboration'])throw new _0x1b0251('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x15c768['apply'](this['editor']['data'],_0x2bc3a4);};}['_setUpDataInit'](){this['editor']['data']['on']('init',(_0x4645cc,[_0x1c1c7f])=>{if(this['_document']['version'])throw new _0x1b0251('realtimecollaborationclient-init-document-already-initialized',this);_0x4645cc['stop'](),this['_setPendingAction']();const _0xa59049=this['editor']['config']['get']('rootsAttributes'),_0x4776e1=this['_getOperationsFromInitData'](_0x1c1c7f,_0xa59049);0x0==_0x4776e1['length']&&_0x4776e1['push'](new _0x290d45(0x0)),_0x4645cc['return']=this['_connectService'](_0x4776e1)['then'](()=>{this['editor']['plugins']['get'](n)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x47a702=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x47a702))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x2745df,[_0x426b94,_0x25c3e0])=>{_0x2745df['stop']();const _0x913dfc=this['editor']['model']['document']['getRoot'](_0x426b94);if(!this['_knownRootNames']['has'](_0x426b94)){const _0x29fefb=_0x25c3e0&&_0x25c3e0['data']?_0x25c3e0['data']:'',_0x4af848=_0x25c3e0&&_0x25c3e0['attributes']?_0x25c3e0['attributes']:{};await this['_loadRoot'](_0x426b94,_0x29fefb,_0x4af848);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0x913dfc['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0x913dfc);});},{'priority':'high'});}async['_fetchMissingUsers'](_0x33d76a){const _0x4a97a1=this['editor']['plugins']['get'](_0x1d3547),{connection:_0x1cc005}=this['editor']['plugins']['get'](n),_0x5cc73c=new Set();for(const _0x5eb288 of _0x33d76a){const _0x19e06f=_0x5eb288['_authorId'];_0x19e06f&&!_0x4a97a1['getUser'](_0x19e06f)&&_0x5cc73c['add'](_0x19e06f);}if(0x0===_0x5cc73c['size'])return;const _0x13b249=await rt['getMany'](_0x1cc005,Array['from'](_0x5cc73c));for(const _0x53f54f of _0x13b249)_0x4a97a1['getUser'](_0x53f54f['id'])||_0x4a97a1['addUser'](_0x53f54f);}['_getOperationsFromInitData'](_0x4543c6,_0x416eeb={}){const _0x2faa1c=this['editor']['model'],_0x3f8861=[];let _0x42db8f=0x0;const _0x491161='string'==typeof _0x4543c6?{'main':_0x4543c6}:_0x4543c6;for(const _0x459811 of Object['keys'](_0x491161)){if(!this['_document']['roots']['has'](_0x459811))throw new _0x1b0251('realtimecollaborationclient-init-non-existent-root',this);const _0x519e4c=this['editor']['data']['parse'](_0x491161[_0x459811]),_0x1bee1d=this['_document']['getRoot'](_0x459811),_0x2597e9=new _0xd00a9d(_0x2faa1c['createPositionAt'](_0x1bee1d,0x0),_0x519e4c,_0x42db8f++);_0x3f8861['push'](_0x2597e9);for(const [_0x3ffcca,_0x37365b]of _0x519e4c['markers']){const _0x7898ff=_0x2faa1c['createRange'](_0x2faa1c['createPositionFromPath'](_0x1bee1d,_0x37365b['start']['path']['slice']()),_0x2faa1c['createPositionFromPath'](_0x1bee1d,_0x37365b['end']['path']['slice']())),_0x2deb06=new _0x151573(_0x3ffcca,null,_0x7898ff,_0x2faa1c['markers'],!0x0,_0x42db8f++);_0x3f8861['push'](_0x2deb06);}}if(_0x416eeb)for(const [_0x3ec3dc,_0x1ced86]of Object['entries'](_0x416eeb)){const _0x6a1fa=_0x2faa1c['document']['getRoot'](_0x3ec3dc);if(!_0x6a1fa)throw new _0x1b0251('multi-root-editor-root-attributes-no-root',null);for(const [_0x4d0c22,_0x5dc09a]of Object['entries'](_0x1ced86))if(null!==_0x5dc09a){const _0x269ba9=new _0x12fae1(_0x6a1fa,_0x4d0c22,null,_0x5dc09a,_0x42db8f++);_0x3f8861['push'](_0x269ba9);}}return _0x3f8861;}async['_loadRoot'](_0x25f2e0,_0x192b4e,_0x139ad8){this['_getOperationsFromInitData']({[_0x25f2e0]:_0x192b4e},{[_0x25f2e0]:_0x139ad8})['forEach']((_0x1a7303,_0x5df6be)=>{_0x1a7303['baseVersion']=this['_document']['version']+_0x5df6be,_0x1a7303['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x1a7303);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async['_handleInitialConnectionData'](_0x53202f,_0x46ed08){let _0x3738b3;this['_offset']=_0x53202f['offset'];const _0x45466b=_0x53202f['wereChangesApplied']&&!_0x53202f['initData'],_0x293615=_0x45466b?0x0:_0x53202f['data']['baseVersion'];if(_0x46ed08['forEach'](_0x38b82c=>{_0x38b82c['_isInit']=!0x0,_0x38b82c['createdAt']=_0x53202f['sessionCreatedAt'],_0x38b82c['_authorId']=null;}),_0x45466b)_0x3738b3=_0x46ed08,this['_applyOperationsSet'](_0x3738b3,_0x45466b);else{if(_0x53202f['initData']){const _0x1ae11b=this['_getOperationsFromInitData'](_0x53202f['initData']);this['_document']['history']['version']=-_0x1ae11b['length'],_0x1ae11b['forEach'](_0x1d546b=>{_0x1d546b['baseVersion']-=_0x1ae11b['length'],_0x1d546b['createdAt']=_0x53202f['sessionCreatedAt'],_0x1d546b['_isInit']=!0x0,_0x1d546b['_authorId']=null;}),this['_applyOperationsSet'](_0x1ae11b,!0x0),this['serverHistory']['version']=-_0x1ae11b['length']+this['_offset'],this['_updateServerHistory'](_0x1ae11b);}this['_document']['history']['version']=_0x293615,_0x3738b3=this['_decompressOperations'](_0x53202f['data'],_0x53202f['metadata']),await this['_fetchMissingUsers'](_0x3738b3),this['_applyOperationsSet'](_0x3738b3,_0x45466b);}_0x53202f['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x3738b3,_0x53202f['lastOperationId']),this['_lastSyncedOperationId']=_0x53202f['lastOperationId']),this['serverHistory']['version']=_0x293615+this['_offset'],this['_updateServerHistory'](_0x3738b3),_0x46ed08['filter'](_0x4540ab=>{const _0x3e5182=this['_getAffectedRoot'](_0x4540ab);return _0x3e5182&&!this['_knownRootNames']['has'](_0x3e5182);})['forEach']((_0x5ade00,_0x178a76)=>{_0x5ade00['baseVersion']=this['_document']['version']+_0x178a76,this['_saveOperationInBuffer'](_0x5ade00);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x1b0d62,_0x59e3dd){const _0x157ef9=_0x59e3dd&&_0x59e3dd['message'];if(_0x157ef9&&_0x157ef9['startsWith']('realtimecollaborationclient'))throw _0x59e3dd;const _0x4e2516=this['editor']['plugins']['get'](n);throw this['_isPendingUpdate']=!0x0,_0x4e2516['disconnect'](),this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0x1b0251(_0x1b0d62,this['editor'],_0x157ef9?{'originalError':_0x157ef9}:void 0x0);}['_saveOperationInBuffer'](_0x1dab77){this['_knownOperations']['has'](_0x1dab77)||(this['_knownOperations']['add'](_0x1dab77),this['_bufferedOperations']['push'](_0x1dab77),this['_pendingAction']||'marker'==_0x1dab77['type']&&!_0x1dab77['affectsData']||this['_setPendingAction']());}['_sendBufferedOperationsDelayed'](_0xb970f=!0x1){!_0xb970f&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0x5338a0=>{_0x5338a0&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0x3cfd80=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0x1e695e){return _0x1e695e['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x1e695e['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0x1e695e['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0x3cfd80)||this['_crash'](_0x3cfd80['message'],_0x3cfd80);});},this['_currentBufferDelay']));}['_waitUntilSynced'](){return new Promise(_0x5c5c77=>{this['on']('change:_isPendingUpdate',()=>{_0x5c5c77();});});}async['_sendBufferedOperations'](){const _0xd70d8a=this['editor']['plugins']['get'](G);if(this['_shouldSendSelectionUpdate']()&&(_0xd70d8a['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x40219d=[...this['_bufferedOperations']];for(const _0x4bb90d of _0x40219d)_0x4bb90d['wasUndone']=this['_document']['history']['isUndoneOperation'](_0x4bb90d);const _0x1d92f1=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x40219d),_0x2067ca=Q++,_0x567aed=this['_compressOperations'](_0x40219d),_0x5a5f7e=await this['_service']['sendOperations'](_0x567aed,_0x567aed['baseVersion'],_0x1d92f1);try{return await this['_handleServerResponse'](_0x40219d,_0x5a5f7e,_0x2067ca);}catch(_0x1e9e0e){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0x1e9e0e);}}async['_handleServerResponse'](_0x5a46f8,_0x4ca316,_0x5da878){if('error'in _0x4ca316)throw _0x4ca316['error'];let _0x4e9f2e=!0x1;if(_0x4ca316['wereChangesApplied']){_0x4ca316['lastOperationId']&&(this['_lastSyncedOperationId']=_0x4ca316['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x509f19=>!_0x5a46f8['includes'](_0x509f19));for(const _0x433d67 of _0x5a46f8)_0x433d67['createdAt']='lastOperationAcceptedAt'in _0x4ca316&&_0x4ca316['lastOperationAcceptedAt']||void 0x0;X(_0x5a46f8,_0x4ca316['version']-_0x5a46f8['length']),this['_updateServerHistory'](_0x5a46f8);const _0x285089=_0x5a46f8['filter'](_0x4acf34=>{if(!_0x4acf34['_isInit'])return!0x1;const _0x14e789=this['_getAffectedRoot'](_0x4acf34);return _0x14e789&&!this['_knownRootNames']['has'](_0x14e789);});X(_0x285089,this['_document']['version']),this['_applyOperationsSet'](_0x285089),_0x4e9f2e=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0x44af0c=this['_decompressOperations'](_0x4ca316['data'],_0x4ca316['metadata'])['filter'](_0x584b3b=>_0x584b3b['baseVersion']>=this['_lastServerVersion']);_0x44af0c['forEach'](_0x5ea924=>this['_addKnownRoot'](_0x5ea924)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x156fa7=>!_0x156fa7['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x156fa7))),this['_bufferedOperations']['length']&&X(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0x44af0c),_0x4e9f2e=this['_handleExternalOperations'](_0x44af0c,_0x4ca316['version'],_0x4ca316['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x4e9f2e?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}['_handleExternalOperations'](_0x501220,_0x3a0f7e,_0xd2964e){try{const _0x30c56e={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x43e1f6,operationsB:_0x377766,originalOperations:_0x2397f9}=_0x1f0beb(_0x501220,this['_bufferedOperations'],_0x30c56e);X(_0x43e1f6,this['_document']['version']),X(_0x377766,_0x3a0f7e);for(const _0x3e32bf of _0x43e1f6){const _0x4e131a=_0x2397f9['get'](_0x3e32bf);_0x3e32bf['_authorId']=_0x4e131a?_0x4e131a['_authorId']:null;}_0xd2964e&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x501220,_0xd2964e),this['_lastSyncedOperationId']=_0xd2964e),this['_bufferedOperations']=[..._0x377766],this['_applyOperationsSet'](_0x43e1f6),this['_updateServerHistory'](_0x501220);}catch(_0x164af9){return console['error'](_0x164af9),!0x1;}return!0x0;}['_applyOperationsSet'](_0x2196b7,_0x4a0124=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0x3ac51e=>{for(const _0xd865d6 of _0x2196b7)this['_knownOperations']['add'](_0xd865d6),this['_addKnownRoot'](_0xd865d6),_0x3ac51e['batch']['addOperation'](_0xd865d6),this['editor']['model']['applyOperation'](_0xd865d6);});}['_addKnownRoot'](_0x11e083){const _0x25f295=this['_getAffectedRoot'](_0x11e083);_0x25f295&&this['_knownRootNames']['add'](_0x25f295);}['_getAffectedRoot'](_0x1edec0){let _0x40ed7d,_0x286222;switch(_0x1edec0['type']){case'insert':_0x40ed7d=_0x1edec0['position']['root'];break;case'marker':if(_0x286222=_0x1edec0['newRange'],!_0x286222)return null;_0x40ed7d=_0x286222['root'];break;case'addRootAttribute':_0x40ed7d=_0x1edec0['root'];break;case'addRoot':_0x40ed7d=_0x1edec0['affectedSelectable'];break;case'move':_0x40ed7d=_0x1edec0['targetPosition']['root'];break;default:return null;}return _0x40ed7d['rootName'];}['_updateServerHistory'](_0x318d39){_0x318d39['forEach'](_0x89a457=>{const _0x5c5670=_0x89a457['clone']();_0x5c5670['_authorId']=_0x89a457['_authorId'],_0x5c5670['_isInit']=!!_0x89a457['_isInit'],_0x5c5670['createdAt']=_0x89a457['createdAt'],_0x5c5670['baseVersion']+=this['_offset'],_0x89a457['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x5c5670),this['serverHistory']['addOperation'](_0x5c5670);});}['_handleReconnectionError'](_0x9a2ca5){const _0x3ff19f=this['editor']['plugins']['get']('Notification'),_0x3aeee4=this['editor']['locale'];_0x9a2ca5||(_0x9a2ca5=$(_0x3aeee4,'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.')),_0x3ff19f['showWarning'](_0x9a2ca5,{'title':$(_0x3aeee4,'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'](_0x2cbdaa)['add']($(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}['_clearPendingAction'](){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x2cbdaa)['remove'](this['_pendingAction']),this['_pendingAction']=null);}['_compressOperations'](_0xd3aefa){const _0x2ba213=_0xd3aefa['map'](_0xb1a0ed=>_0xb1a0ed['toJSON']());return this['_compressor']['compress'](_0x2ba213);}['_decompressOperations'](_0x3d4d84,_0x21a018){return this['_compressor']['decompress'](_0x3d4d84)['map']((_0x56d86d,_0x41166e)=>{const _0x15bfec='init'==_0x21a018[_0x41166e]['type'];if('InsertOperation'==_0x56d86d['__className']){const _0x4328e9=_0x56d86d['position']['root'];!this['_document']['getRoot'](_0x4328e9)&&(this['_document']['createRoot']('$root',_0x4328e9)['_isAttached']=!0x1);}const _0x5b2e62=_0x2d25b5['fromJSON'](_0x56d86d,this['_document']);return _0x5b2e62['wasUndone']=_0x56d86d['wasUndone'],_0x5b2e62['_isInit']=_0x15bfec,_0x5b2e62['_authorId']=_0x15bfec?null:_0x21a018[_0x41166e]['userId'],_0x5b2e62['_isDisconnection']='cs:removeUser'===_0x21a018[_0x41166e]['type'],_0x5b2e62['createdAt']=_0x21a018[_0x41166e]['createdAt'],_0x5b2e62;});}['_refreshUserSelectionMarkers'](){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}['_shouldSendSelectionUpdate'](){const _0x4fa32b=this['editor']['plugins']['get'](i)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0x4fa32b&&_0x4fa32b['length']>0x1&&this['_hasSelectionChanged'];}['_shouldSendUpdate'](){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}}class ReconnectionError extends Error{}function X(_0x4bc525,_0x52b279){for(const _0x48a2a3 of _0x4bc525)_0x48a2a3['baseVersion']=_0x52b279++;}class OperationIdentifier{['_ignoredOperations'];['_operationToId'];constructor(_0x252daa){this['_ignoredOperations']=_0x252daa,this['_operationToId']=new WeakMap();}['getIdOfTheLastOperation'](_0x13ac7e){let _0x1bce46=_0x13ac7e['length'];for(;_0x1bce46--;){const _0x3e13cf=_0x13ac7e[_0x1bce46];if(!this['_ignoredOperations']['has'](_0x3e13cf)){if(!this['_operationToId']['has'](_0x3e13cf)){const _0x247d64=_0x2e65e8()['slice'](0x1,0x12);this['_operationToId']['set'](_0x3e13cf,_0x247d64);}return this['_operationToId']['get'](_0x3e13cf);}}}['setIdForTheLastOperation'](_0x1526b8,_0xcb47b5){if(!_0xcb47b5)return;let _0x3545b5=_0x1526b8['length'];for(;_0x3545b5--;){const _0x118c81=_0x1526b8[_0x3545b5];this['_ignoredOperations']['has'](_0x118c81)||this['_operationToId']['set'](_0x118c81,_0xcb47b5);}}}class a extends _0x30d29d{static get['requires'](){return[l];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class s extends _0xfd8900{static ['CommentsService']=/* #__PURE__ -- @preserve */
|
|
26
|
-
((()=>_0x3bed14)());['_services'];static get['requires'](){return[n,'CommentsRepository',i,_0x1d3547];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x5285eb){super(_0x5285eb),this['_services']=new Map();}async['init'](){const _0x5ed162=this['context'],_0x201f06=_0x5ed162['plugins']['get']('CommentsRepository');if(_0x5ed162['plugins']['get'](n)['addToReconnectionStack'](this),_0x201f06['adapter']={'addCommentThread':async({channelId:_0x2d5b29,threadId:_0x248701,comments:_0xcc9a68,resolvedAt:_0x25f88b,resolvedBy:_0x780099,context:_0x1f4e2c,attributes:_0x174267})=>{const _0x1e581b=await this['_getService'](_0x2d5b29)['addCommentThread']({'commentThreadId':_0x248701,'comments':_0xcc9a68['map'](_0x595490=>function(_0x3773c6,_0x457f08,_0xf42100){return{'commentThreadId':_0xf42100,'commentId':_0x3773c6['commentId'],'userId':_0x3773c6['authorId'],'content':_0x3773c6['content'],'documentId':_0x457f08,'createdAt':_0x3773c6['createdAt'],'attributes':_0x3773c6['attributes']||{}};}(_0x595490,_0x2d5b29,_0x248701)),'resolvedAt':_0x25f88b,'resolvedBy':_0x780099,'context':_0x1f4e2c,'attributes':_0x174267})['catch'](at);return{'threadId':_0x1e581b['commentThreadId'],'comments':_0x1e581b['comments']};},'getCommentThread':async({channelId:_0x5e8131,threadId:_0x1f6b4a})=>{const _0x4ffda9=await this['_getService'](_0x5e8131)['getCommentThread'](_0x1f6b4a)['catch'](F)['catch'](at);return _0x4ffda9?_0x4ffda9['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0x4ffda9]),{'threadId':_0x4ffda9['commentThreadId'],'comments':_0x4ffda9['comments']['map'](P),'context':_0x4ffda9['context'],'resolvedAt':_0x4ffda9['resolvedAt'],'resolvedBy':_0x4ffda9['resolvedBy'],'attributes':_0x4ffda9['attributes']||{}}):null;},'updateCommentThread':async({channelId:_0x2944d8,threadId:_0x50ba78,context:_0x5a3a80,unlinkedAt:_0x14ee5e,attributes:_0x3882e8})=>this['_getService'](_0x2944d8)['updateCommentThread']({'commentThreadId':_0x50ba78,'context':_0x5a3a80,'attributes':_0x3882e8,'unlinkedAt':_0x14ee5e})['catch'](F)['catch'](at),'resolveCommentThread':async({channelId:_0x5993db,threadId:_0x2c654d})=>{const _0x5a7a8d=await this['_getService'](_0x5993db)['resolveCommentThread'](_0x2c654d)['catch'](F)['catch'](at);return{'threadId':_0x5a7a8d['commentThreadId'],'resolvedAt':_0x5a7a8d['resolvedAt'],'resolvedBy':_0x5a7a8d['resolvedBy']};},'reopenCommentThread':async({channelId:_0x207378,threadId:_0x12d7ab})=>this['_getService'](_0x207378)['reopenCommentThread'](_0x12d7ab)['catch'](F)['catch'](at),'removeCommentThread':({channelId:_0x1d3a75,threadId:_0x40cff1})=>this['_getService'](_0x1d3a75)['removeCommentThread'](_0x40cff1)['catch'](F)['catch'](at),'addComment':({channelId:_0x110377,threadId:_0x1b6417,commentId:_0x4fa3a1,content:_0x2608b2,attributes:_0x1a0525})=>this['_getService'](_0x110377)['addComment'](_0x1b6417,_0x4fa3a1,_0x2608b2,_0x1a0525)['catch'](at),'updateComment':({channelId:_0x2665a7,threadId:_0x49fbf8,commentId:_0x420d81,content:_0x4975ef,attributes:_0x33c64b})=>this['_getService'](_0x2665a7)['updateComment'](_0x49fbf8,_0x420d81,_0x4975ef,_0x33c64b)['catch'](F)['catch'](at),'removeComment':({channelId:_0x340445,threadId:_0x4569b0,commentId:_0x5e82c8})=>this['_getService'](_0x340445)['removeComment'](_0x4569b0,_0x5e82c8)['catch'](F)['catch'](at)},_0x5ed162 instanceof _0x47a3c5){const _0x223051=_0x5ed162['config']['get']('collaboration.channelId'),_0x5dd904=_0x5ed162['plugins']['get'](i);await this['_setUpService'](_0x223051);const _0x358d2d=await this['_services']['get'](_0x223051)['getConnectedSessions']();this['listenTo'](_0x5dd904,'sessionAdd:'+_0x223051,(_0x443de2,{session:_0x351655})=>{_0x351655['id']===_0x5dd904['mySessionId']&&(_0x443de2['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x351655['permissions'],_0x223051));}),_0x5dd904['register'](_0x223051,_0x358d2d);}}async['_setUpService'](_0x9beea9){if(this['_services']['has'](_0x9beea9))throw new _0x1b0251('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0x9beea9});const _0xaec489=this['context']['plugins']['get']('CommentsRepository'),_0x1e983e=new s['CommentsService'](_0x9beea9);this['_services']['set'](_0x9beea9,_0x1e983e),this['listenTo'](_0x1e983e,'commentThreadAdded',(_0x58d8b3,_0x584923)=>{const {commentThreadId:_0x1f96dd,documentId:_0xa0bdef,context:_0x4e0e5f,attributes:_0x510c08,resolvedAt:_0x251b46,resolvedBy:_0x3a4609,comments:_0x1a985c}=_0x584923;_0xaec489['getCommentThread'](_0x1f96dd)||_0xaec489['addCommentThread']({'threadId':_0x1f96dd,'channelId':_0xa0bdef,'comments':_0x1a985c?_0x1a985c['map'](P):[],'context':_0x4e0e5f,'attributes':_0x510c08,'resolvedAt':_0x251b46,'resolvedBy':_0x3a4609,'isFromAdapter':!0x0});}),this['listenTo'](_0x1e983e,'commentThreadUpdated',(_0x3667db,{commentThreadId:_0x4548a9,documentId:_0x1bf12,context:_0x238f82,unlinkedAt:_0x5d2d44,attributes:_0x5e5056})=>{_0xaec489['getCommentThread'](_0x4548a9)&&_0xaec489['updateCommentThread']({'threadId':_0x4548a9,'channelId':_0x1bf12,'context':_0x238f82,'unlinkedAt':_0x5d2d44,'attributes':_0x5e5056,'isFromAdapter':!0x0});}),this['listenTo'](_0x1e983e,'commentThreadResolved',(_0x4b309d,{commentThreadId:_0x45ee18,resolvedBy:_0x205986,resolvedAt:_0x43de39})=>{const _0x11cf3e=_0xaec489['getCommentThread'](_0x45ee18);_0x11cf3e&&_0x11cf3e['resolve']({'resolvedBy':_0x205986,'resolvedAt':_0x43de39,'isFromAdapter':!0x0});}),this['listenTo'](_0x1e983e,'commentThreadReopened',(_0x3b726f,{commentThreadId:_0x3e6e43})=>{const _0x48afd8=_0xaec489['getCommentThread'](_0x3e6e43);_0x48afd8&&_0x48afd8['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0x1e983e,'commentThreadRemoved',(_0x55eff5,{commentThreadId:_0x4b04be})=>{const _0x59dae8=_0xaec489['getCommentThread'](_0x4b04be);_0x59dae8&&_0x59dae8['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0x1e983e,'commentAdded',(_0xa81a7,_0x477fb2)=>{const _0x50f429=_0x477fb2['commentThreadId'],_0xbc6211=_0xaec489['getCommentThread'](_0x50f429);_0xbc6211&&_0xbc6211['addComment']({...P(_0x477fb2),'isFromAdapter':!0x0});}),this['listenTo'](_0x1e983e,'commentUpdated',(_0x543e8c,{commentThreadId:_0x57ad47,commentId:_0x433fbc,content:_0x3a0cc2,attributes:_0x2c4819})=>{const _0x59f554=_0xaec489['getCommentThread'](_0x57ad47);if(_0x59f554){const _0x38ed95=_0x59f554['getComment'](_0x433fbc);_0x38ed95&&_0x38ed95['update']({'content':_0x3a0cc2,'attributes':_0x2c4819,'isFromAdapter':!0x0});}}),this['listenTo'](_0x1e983e,'commentRemoved',(_0x53a2c5,{commentThreadId:_0x5f10f5,commentId:_0x2c8ef5})=>{const _0x23dd03=_0xaec489['getCommentThread'](_0x5f10f5);if(_0x23dd03){const _0x269397=_0x23dd03['getComment'](_0x2c8ef5);_0x269397&&_0x269397['remove']({'isFromAdapter':!0x0});}}),await this['_connectService'](_0x9beea9);}['destroy'](){if(this['context']instanceof _0x47a3c5){const _0x55992a=this['context']['config']['get']('collaboration.channelId');this['_terminateService'](_0x55992a);}}['_terminateService'](_0x53acc4){if(!this['_services']['has'](_0x53acc4))throw new _0x1b0251('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0x53acc4});this['_getService'](_0x53acc4)['disconnect'](),this['_services']['delete'](_0x53acc4);}async['reconnect'](){for(const _0x2b54fb of this['_services']['keys']())await this['_connectService'](_0x2b54fb);if(this['context']instanceof _0x47a3c5){const _0x3751b1=this['context']['config']['get']('collaboration.channelId'),_0x1aad8=this['context']['plugins']['get'](i);_0x1aad8['unregister'](_0x3751b1);const _0x14d6f2=await this['_services']['get'](_0x3751b1)['getConnectedSessions']();_0x1aad8['register'](_0x3751b1,_0x14d6f2);}}async['_connectService'](_0x5efdbf){const {connection:_0x4d7f1f}=this['context']['plugins']['get'](n),_0x28451d=this['context']['plugins']['get']('CommentsRepository'),_0x3353e2=this['_services']['get'](_0x5efdbf),_0xca42cc=await _0x3353e2['connect'](_0x4d7f1f);await this['_fetchMissingUsersForThreads'](_0xca42cc);const _0x33ab17=new Set(Array['from'](_0x28451d['getCommentThreads']({'channelId':_0x5efdbf}),_0x3d05b7=>_0x3d05b7['id']));for(const _0x36c6fd of _0xca42cc)_0x36c6fd['deletedAt']||_0x33ab17['delete'](_0x36c6fd['commentThreadId']);for(const _0x1ec53d of _0x33ab17)_0x28451d['getCommentThread'](_0x1ec53d)['remove']({'isFromAdapter':!0x0});for(const _0x5a4d6f of _0xca42cc){let _0x37c348=_0x28451d['getCommentThread'](_0x5a4d6f['commentThreadId']);const {commentThreadId:_0x582891,context:_0x2b20d0,attributes:_0x41d6da,resolvedBy:_0x199709,resolvedAt:_0x2643ea,unlinkedAt:_0x5dc372,deletedAt:_0x2937ec}=_0x5a4d6f;if(_0x2937ec)continue;_0x37c348||(_0x37c348=_0x28451d['addCommentThread']({'channelId':_0x5efdbf,'threadId':_0x582891,'context':_0x2b20d0,'attributes':_0x41d6da||{},'resolvedBy':_0x199709,'resolvedAt':_0x2643ea,'unlinkedAt':_0x5dc372,'isFromAdapter':!0x0}));const _0x39c709=new Set(Array['from'](_0x37c348['comments'],_0xb2ee4e=>_0xb2ee4e['id']));for(const _0x15a839 of _0x5a4d6f['comments'])_0x39c709['delete'](_0x15a839['commentId']);for(const _0x33dff9 of _0x39c709)_0x37c348['getComment'](_0x33dff9)['remove']({'isFromAdapter':!0x0});for(const _0x1a64a1 of _0x5a4d6f['comments']){const _0xaf7da1=_0x37c348['getComment'](_0x1a64a1['commentId']);_0xaf7da1?_0xaf7da1['content']!==_0x1a64a1['content']&&_0xaf7da1['update']({'content':_0x1a64a1['content'],'isFromAdapter':!0x0}):_0x37c348['addComment'](Object['assign'](P(_0x1a64a1),{'isFromAdapter':!0x0}));}}}['_getService'](_0x422d60){if(!this['_services']['has'](_0x422d60))throw new _0x1b0251('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0x422d60});return this['_services']['get'](_0x422d60);}async['_fetchMissingUsersForThreads'](_0x594501){const _0x71129d=this['context']['plugins']['get'](_0x1d3547),{connection:_0xa57c7c}=this['context']['plugins']['get'](n),_0x44ddcd=new Set();for(const {resolvedBy:_0x5e8119,comments:_0x122955}of _0x594501){_0x5e8119&&!_0x71129d['getUser'](_0x5e8119)&&_0x44ddcd['add'](_0x5e8119);for(const {userId:_0x3183a5}of _0x122955)_0x71129d['getUser'](_0x3183a5)||_0x44ddcd['add'](_0x3183a5);}if(0x0===_0x44ddcd['size'])return;const _0x2ead28=await rt['getMany'](_0xa57c7c,Array['from'](_0x44ddcd));for(const _0x31fcd6 of _0x2ead28)_0x71129d['getUser'](_0x31fcd6['id'])||_0x71129d['addUser'](_0x31fcd6);}}async function F(_0x1a9263){if('404'!==_0x1a9263['code'])throw _0x1a9263;}function at(_0x287791){if((_0x4d6796=_0x287791)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0x4d6796['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x4d6796['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0x4d6796;throw _0x287791;}function P(_0x39d7d3){return{'threadId':_0x39d7d3['commentThreadId'],'commentId':_0x39d7d3['commentId'],'content':_0x39d7d3['content'],'createdAt':_0x39d7d3['createdAt'],'authorId':_0x39d7d3['userId'],'attributes':_0x39d7d3['attributes']||{}};}class m extends _0x30d29d{static ['TrackChangesService']=/* #__PURE__ -- @preserve */
|
|
27
|
-
((()=>
|
|
28
|
-
((()=>_0x1946f6)());['_lastRequestId'];['_revisionTracker'];['_revisionHistoryService'];['_oldOffset'];static get['requires'](){return[n,l,'RevisionHistory',i,_0x1d3547];}static get['pluginName'](){return'CloudServicesRevisionHistoryAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x2d150f){super(_0x2d150f);const _0x7e3f07=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new c['RevisionHistoryService'](_0x7e3f07);}async['init'](){const _0x4f547c=this['editor']['plugins']['get'](l),_0xbf68ed=_0x4f547c['serverHistory'],_0x4e8606=this['editor']['plugins']['get'](n);this['_revisionTracker']['setSource']({'history':_0xbf68ed,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0x4f547c['sessionId']});const _0x3739f9=this['editor']['config']['get']('cloudServices.bundleVersion')||nt,_0x1f4047=await _0x107a0a['isBundleUploaded'](_0x4e8606['connection'],_0x3739f9);this['editor']['plugins']['get']('RevisionHistory')['adapter']={'getRevision':async({revisionId:_0x1c9eb4})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0x1c9eb4)),'updateRevisions':async _0x3d0b0e=>{await this['_waitForServiceReady']();const _0x57a95d=this['_revisionTracker']['currentRevision'];if(_0x1f4047&&0x1===_0x3d0b0e['length']&&_0x3d0b0e[0x0]['id']===_0x57a95d['id'])return _0x3d0b0e;for(const _0xfaf2c1 of _0x3d0b0e)_0xfaf2c1['id']===_0x57a95d['id']&&(_0xfaf2c1['isEmptyCurrent']=_0xfaf2c1['fromVersion']===_0xfaf2c1['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0x3d0b0e,this['_lastRequestId'])['then'](_0x4a9cd3=>(this['_lastRequestId']=_0x4a9cd3,_0x3d0b0e))['catch'](_0x401fc8=>{if(I(_0x401fc8)||'400'===_0x401fc8['code']&&void 0x0!==_0x401fc8['data']['wrongRequestId']){for(const _0xa2f431 of _0x3d0b0e){!this['_revisionTracker']['repository']['getRevision'](_0xa2f431['id'])||this['_revisionTracker']['_bufferUpdate'](_0xa2f431['id'],_0xa2f431,!0x1);}if(I(_0x401fc8))throw _0x401fc8;return _0x3d0b0e;}throw _0x401fc8;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0x1703a1,{revisionsData:_0x45ccd0,requestId:_0x6c3f93})=>{Math['max'](..._0x45ccd0['map'](_0x502af2=>_0x502af2['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0x45ccd0,_0x6c3f93);}):this['_handleRevisionsUpdate'](_0x45ccd0,_0x6c3f93);});const {revisions:_0x26a48b,requestId:_0x1bc6d9}=await this['_revisionHistoryService']['connect'](_0x4e8606['connection']);_0x4e8606['addToReconnectionStack'](this),this['_lastRequestId']=_0x1bc6d9,await this['_fetchMissingUsers'](_0x26a48b);for(const _0x3822c3 of _0x26a48b)this['_revisionTracker']['addRevisionData'](_0x3822c3);this['listenTo'](_0x4f547c,'change:_isConnected',(_0x1e7732,_0x46f640,_0x20d9e7)=>{_0x20d9e7&&(this['_oldOffset']=_0x4f547c['_offset'],_0x1e7732['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](_0x4e8606,'state',_0xa0436a=>_0xa0436a===_0x3e236f['CONNECTED']);}async['reconnect'](){const _0x58caf9=this['editor']['plugins']['get'](n),_0x43526c=this['editor']['plugins']['get'](l),_0x5ec5e4=async()=>{const _0x2f52ce=this['_revisionTracker']['currentRevision'],_0xa9c44b=_0x2f52ce['id'],_0x396fed=_0xa9c44b!==_0x43526c['sessionId'];if(_0x396fed){const _0x93e7c0=_0x43526c['_offset']-this['_oldOffset'],_0x4c2e4a=this['_getLatestVersionFromServerOperations']();this['_revisionTracker']['_revisionDataBuilder']['reInit']();if(_0x2f52ce['toVersion']+_0x93e7c0!==_0x4c2e4a){const _0x1aff58=_0x2f52ce['fromVersion']+_0x93e7c0,_0x3e2b08=this['editor']['plugins']['get'](_0x1d3547),_0x268cef=this['_revisionTracker']['buildRevisionData']({'revision':_0x2f52ce,'from':_0x1aff58,'to':_0x4c2e4a});_0x268cef['id']=_0x2f52ce['id'];const _0x68782f=_0x268cef['authorsIds']['map'](_0x57db9a=>_0x3e2b08['getUser'](_0x57db9a));_0x2f52ce['_update']({..._0x268cef,'authors':_0x68782f},!0x0),this['_revisionTracker']['_bufferUpdate'](_0x2f52ce['id'],_0x268cef,!0x0);}this['_revisionTracker']['_startingVersion']=_0x4c2e4a,(_0x2f52ce['toVersion']===_0x2f52ce['fromVersion']&&!this['_revisionTracker']['_bufferedUpdates']['has'](_0xa9c44b)&&this['_revisionTracker']['repository']['_revisions']['remove'](_0xa9c44b),this['_revisionTracker']['_createCurrentRevision'](_0x4c2e4a));}const {revisions:_0x412cd9,requestId:_0x15466b}=await this['_revisionHistoryService']['reconnect'](_0x58caf9['connection'],this['_lastRequestId']);_0x396fed&&_0x412cd9['length']>0x0?_0x43526c['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x412cd9),this['_handleRevisionsUpdate'](_0x412cd9,_0x15466b),this['_revisionTracker']['sendBufferedUpdates']());};return _0x43526c['_isConnected']?_0x5ec5e4():new Promise((_0x2acb4d,_0xcd2f84)=>{_0x43526c['once']('change:_isConnected',()=>{_0x5ec5e4()['then'](_0x2acb4d)['catch'](_0xcd2f84);});});}['destroy'](){super['destroy']();}async['_waitForServiceReady'](){this['_revisionHistoryService']['isConnected']||await new Promise(_0x183f8f=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x24d859=>{_0x24d859['off'](),_0x183f8f();});});}['_getLatestVersionFromServerOperations'](){const _0x2e30ca=this['editor']['plugins']['get'](l)['serverHistory']['getOperations']()['reverse']();for(const _0x12bc4 of _0x2e30ca)if('marker'!==_0x12bc4['type']||_0x12bc4['affectsData'])return _0x12bc4['baseVersion']+0x1;}['_getLatestVersion'](){const _0x15ec9d=this['editor']['plugins']['get'](l);return new Promise(_0x40622a=>{_0x15ec9d['_isPendingUpdate']?_0x15ec9d['once']('change:_isPendingUpdate',()=>{_0x40622a(this['_getLatestVersionFromServerOperations']());}):_0x40622a(this['_getLatestVersionFromServerOperations']());});}['_handleRevisionsUpdate'](_0x488f2c,_0x162242){const _0x12de40=this['_revisionTracker']['repository'];this['_lastRequestId']=_0x162242;for(const _0x8acab4 of _0x488f2c){const _0x1e848d=_0x12de40['getRevision'](_0x8acab4['id']);if(_0x1e848d){if((_0x8acab4['fromVersion']||_0x8acab4['toVersion'])&&(_0x8acab4['diffData']=null),_0x1e848d===this['_revisionTracker']['currentRevision']){const _0x158950=Math['max'](_0x1e848d['toVersion'],_0x8acab4['toVersion']),_0x247992=Math['max'](_0x1e848d['fromVersion'],_0x8acab4['fromVersion']);let _0x874aa6;_0x1e848d['toVersion']===_0x8acab4['toVersion']&&_0x1e848d['fromVersion']===_0x8acab4['fromVersion']?(_0x874aa6=!0x0,this['_preventResendingRevisionData'](_0x8acab4)):_0x8acab4['toVersion']===_0x158950&&_0x8acab4['fromVersion']===_0x247992?_0x874aa6=!0x1:(_0x1e848d['toVersion']===_0x158950&&_0x1e848d['fromVersion']===_0x247992||this['_fixRevision']({'revision':_0x1e848d,'from':_0x247992,'to':_0x158950}),_0x874aa6=!0x0),_0x874aa6&&(delete _0x8acab4['fromVersion'],delete _0x8acab4['toVersion'],delete _0x8acab4['diffData'],delete _0x8acab4['createdAt'],delete _0x8acab4['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0x8acab4),this['_preventResendingRevisionData'](_0x8acab4);}else this['_revisionTracker']['addRevisionData'](_0x8acab4);}const _0x4141c2=_0x12de40['getRevisions']();_0x4141c2['reverse']();for(let _0xa9883e=0x0;_0xa9883e<_0x4141c2['length']-0x1;_0xa9883e++){const _0x15fc7e=_0x4141c2[_0xa9883e],_0x4f4ad3=_0x4141c2[_0xa9883e+0x1];if(_0x15fc7e['fromVersion']<_0x4f4ad3['toVersion']){const _0x578f9e=_0x4f4ad3['toVersion'],_0x629941=Math['max'](_0x578f9e,_0x15fc7e['toVersion']);this['_fixRevision']({'revision':_0x15fc7e,'from':_0x578f9e,'to':_0x629941});}}}['_fixRevision']({revision:_0x5bbd8b,from:_0xf0e913,to:_0x3690d5}={}){const _0x250c78=this['editor']['plugins']['get'](_0x1d3547),_0x764a31=this['_revisionTracker']['buildRevisionData']({'revision':_0x5bbd8b,'from':_0xf0e913,'to':_0x3690d5});_0x764a31['authors']=_0x764a31['authorsIds']['map'](_0x2a0499=>_0x250c78['getUser'](_0x2a0499)),_0x5bbd8b['_update'](_0x764a31);}['_preventResendingRevisionData'](_0x1fd86f){const _0x291982={};_0x291982['id']=_0x1fd86f['id'];for(const _0x3f81b7 of Object['keys'](_0x1fd86f))'id'!==_0x3f81b7&&(_0x291982[_0x3f81b7]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0x291982['id'],_0x291982,!0x0);}async['_fetchMissingUsers'](_0x153391){const _0x237f74=this['editor']['plugins']['get'](_0x1d3547),{connection:_0x621c9d}=this['editor']['plugins']['get'](n),_0x570eeb=new Set();for(const _0x12e86a of _0x153391){for(const _0x91a529 of _0x12e86a['authorsIds'])_0x471e29(_0x91a529);_0x12e86a['creatorId']&&_0x471e29(_0x12e86a['creatorId']);}if(0x0===_0x570eeb['size'])return;const _0x46192c=await rt['getMany'](_0x621c9d,Array['from'](_0x570eeb));for(const _0x4ef356 of _0x46192c)_0x237f74['getUser'](_0x4ef356['id'])||_0x237f74['addUser'](_0x4ef356);function _0x471e29(_0x2b0e19){_0x237f74['getUser'](_0x2b0e19)||_0x570eeb['add'](_0x2b0e19);}}}function I(_0x5682a9){return _0x5682a9['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0x5682a9['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x5682a9['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class RealTimeCollaborativeRevisionHistory extends _0x30d29d{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 _0x15eed3{['_collapseAt'];constructor(_0x44a6f1,_0x22f79f=0x6){super(_0x44a6f1);const _0x2b958d=this['bindTemplate'];this['set']('isHidden',!0x0),this['set']('usersCount',0x0),this['_collapseAt']=_0x22f79f,this['bind']('isHidden')['to'](this,'usersCount',_0x307bd8=>_0x307bd8<_0x22f79f),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item',_0x2b958d['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':_0x2b958d['to']('usersCount',_0x2a173e=>'+'+(_0x2a173e-this['_collapseAt']+0x2)['toString']())}]}]}]});}}class is extends _0x15eed3{['items'];['keystrokes'];constructor(_0x107cff){super(_0x107cff);const _0x143f10=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0xc8fed7(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0x143f10['if']('hasPopup'),'aria-expanded':_0x143f10['to']('isExpanded',_0x480320=>this['hasPopup']&&String(_0x480320)),'aria-label':_0x143f10['to']('hasPopup',_0x42db41=>$(_0x107cff,_0x42db41?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0x143f10['to']('hasPopup',_0x23a039=>!!_0x23a039&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items'],'on':{'mouseenter':_0x143f10['to'](()=>this['fire']('presencelist:show')),'mouseleave':_0x143f10['to'](_0x45d308=>{const _0xe32267=_0x45d308,_0x510fb0=document['querySelector']('.ck-presence-list__dropdown-list'),_0x3f202e=document['querySelector']('.ck-balloon-panel_with-arrow');_0x510fb0?.['contains'](_0xe32267['relatedTarget'])||_0x3f202e?.['contains'](_0xe32267['relatedTarget'])||this['fire']('presencelist:hide');})}}),this['on']('change:hasPopup',(_0x2aab24,_0x2b1c5c,_0x11a193)=>{this['element']&&(_0x11a193?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 _0x15eed3{['counterView'];['inlineListView'];constructor(_0x691aef,_0xebd6a3=0x6){super(_0x691aef);const _0x538a7a=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new b(this['locale'],_0xebd6a3),this['inlineListView']=new is(_0x691aef),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x5bc2c2 of this['inlineListView']['items'])_0x5bc2c2['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',_0x538a7a['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['inlineListView']]});}}class L extends _0x15eed3{['listWrapperView'];constructor(_0x55c0a6,_0x3fc365){super(_0x55c0a6);const _0x12bcba=this['bindTemplate'];this['listWrapperView']=new PresenceDropdownListWrapperView(_0x55c0a6,_0x3fc365),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':$(_0x55c0a6,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']],'on':{'mouseleave':_0x12bcba['to'](_0xebaf48=>{const _0x343cdb=_0xebaf48,_0x164d4b=document['querySelector']('.ck-presence-list__list'),_0x181d2a=document['querySelector']('.ck-balloon-panel_with-arrow');_0x164d4b?.['contains'](_0x343cdb['relatedTarget'])||_0x181d2a?.['contains'](_0x343cdb['relatedTarget'])||this['fire']('presencelist:hide');})}});}}class PresenceDropdownListWrapperView extends _0x3f1de7{constructor(_0xa1b391,_0x233b80){super(_0xa1b391);const _0x32f7fc=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0x233b80?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0x32f7fc['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0x32f7fc['to']('role'),'aria-label':_0x32f7fc['to']('ariaLabel'),'aria-labelledby':_0x32f7fc['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0x2b0da0['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0x5d5ed8=this['element'];_0x5d5ed8&&(this['_isScrollable']=Math['max'](_0x5d5ed8['scrollHeight'],_0x5d5ed8['clientHeight'])>0.8*window['innerHeight']);}}class j extends et{['userView'];constructor(_0x23859c,_0x2594a2,_0x4edace){super(_0x23859c);const _0x3552c9=this['bindTemplate'];this['userView']=new st(_0x23859c,_0x2594a2);const _0x2b9c39={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0x2594a2['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0x2594a2['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x2594a2['color']['getBackgroundColorClass']()],'aria-hidden':'true'}}]};_0x4edace&&(_0x2b9c39['tag']='button',_0x2b9c39['on']={'click':_0x3552c9['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x2b9c39);}['focus'](){this['element']['focus']();}}class A extends _0x15eed3{['userView'];['markerView'];constructor(_0x4d81bf,_0x35a716,_0xf3785c){super(_0x4d81bf);const _0x279308=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new st(_0x4d81bf,_0x35a716),this['markerView']=new MarkerView(_0x4d81bf,_0x35a716);const _0x2210cf=new it(_0x4d81bf);_0x2210cf['template']['tag']='span',_0x2210cf['text']=_0x35a716['name'];const _0x4c4dce={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0x279308['to']('isFocusable',_0x143c9e=>!!_0x143c9e&&0x0),'aria-labelledby':_0x2210cf['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0x279308['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0x279308['to']('hasTooltip',_0x1ddd2a=>!_0x1ddd2a),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0x2210cf]};_0xf3785c&&(_0x4c4dce['tag']='button',_0x4c4dce['on']={'click':_0x279308['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x4c4dce);}}class MarkerView extends _0x15eed3{constructor(_0x383cee,_0x432284){super(_0x383cee),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x432284['color']['getBackgroundColorClass']()],'aria-hidden':'true'}});}}const x={'collapseAt':0x6,'displayMe':!0x0};class r extends _0xfd8900{['currentDisplayedUsers'];['balloonPanelView'];['view'];['presenceDropdownView'];['_bodyCollection']=null;static get['pluginName'](){return'PresenceListUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x4d1902){super(_0x4d1902),this['context']['config']['define']('presenceList',x);const _0x3ae5c5=_0x4d1902['config']['get']('presenceList.collapseAt');if('number'!=typeof _0x3ae5c5)throw new _0x1b0251('presencelist-collapseat-invalid-format',this);if(_0x3ae5c5<0x1)throw new _0x1b0251('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](i)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0x51237b(),this['balloonPanelView']=new _0x212cdd(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get['requires'](){return[i];}['init'](){for(const _0xf9a9d0 of this['_allConnectedUsers'])this['_handleUserAdd'](_0xf9a9d0);this['listenTo'](this['_allConnectedUsers'],'add',(_0x3eba9c,_0x59e703)=>{this['_handleUserAdd'](_0x59e703);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0x1e3d95,_0x5175ec)=>{this['_handleUserRemove'](_0x5175ec);});}['_createView'](){const _0x7c2423=this['context'],_0x1a0620=new v(this['context']['locale'],this['context']['config']['get']('presenceList.collapseAt')),_0xdac1e4=this['balloonPanelView'];if(!_0x3a41f3(_0x7c2423['config']['get']('presenceList.container')))throw new _0x1b0251('presencelist-missing-container',this);return _0x1a0620['counterView']['bind']('usersCount')['to'](this),_0x1a0620['bind']('isCollapsed')['to'](this,'usersCount',_0x456320=>{const {collapseAt:_0xfcb73f}=_0x7c2423['config']['get']('presenceList'),_0x5af6d7=_0x456320>=_0xfcb73f;if(_0x5af6d7&&!_0x1a0620['inlineListView']['items']['find'](_0x155757=>_0x155757 instanceof b)){const _0x34f89e=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['currentDisplayedUsers']['length']==_0x34f89e&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](this['currentDisplayedUsers']['length']-0x1),_0x1a0620['inlineListView']['items']['add'](_0x1a0620['counterView']);}return _0x5af6d7||this['hideDropdown'](),_0x5af6d7;}),_0x1a0620['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0x1b663b=>{const _0x64984b=_0x7c2423['config']['get']('presenceList'),_0x110e1e=new A(_0x7c2423['locale'],_0x1b663b,!!_0x64984b['onClick']);return _0x110e1e['bind']('hasTooltip')['to'](_0x1a0620,'isCollapsed',_0x3d4b77=>!_0x3d4b77),_0x110e1e['bind']('isFocusable')['to'](_0x1a0620,'isCollapsed',_0x4353e0=>!_0x4353e0),_0x64984b['onClick']&&this['listenTo'](_0x110e1e,'execute',()=>{this['view']['isCollapsed']||_0x64984b['onClick'](_0x1b663b,_0x110e1e['element']);}),_0x110e1e;}),this['listenTo'](_0x1a0620['inlineListView'],'presencelist:show',()=>{this['view']['isCollapsed']&&this['showDropdown']();}),this['listenTo'](_0x1a0620['inlineListView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();}),_0x1a0620['inlineListView']['keystrokes']['set']('Enter',(_0x404eae,_0x4230a8)=>{this['view']['isCollapsed']&&(this['showDropdown'](),_0x4230a8());}),_0x1a0620['render'](),_0xdac1e4['render'](),_0x545d85({'emitter':_0x1a0620,'activator':()=>_0xdac1e4['isVisible'],'contextElements':[_0xdac1e4['element'],_0x1a0620['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0x7c2423['config']['get']('presenceList.container')['appendChild'](_0x1a0620['element']),this['_bodyCollection']=new _0x4f1761(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_bodyCollection']['add'](this['balloonPanelView']),_0x1a0620;}['_handleUserAdd'](_0x4c4ac1){if(!this['context']['config']['get']('presenceList.displayMe')&&_0x4c4ac1['isMe'])return;const _0x17c055=this['context']['config']['get']('presenceList.collapseAt')-0x1;for(this['usersCount']++;this['currentDisplayedUsers']['length']>=_0x17c055-(this['view']['isCollapsed']?0x1:0x0)&&this['currentDisplayedUsers']['length']>0x1;)this['currentDisplayedUsers']['remove'](0x1);const _0xfd1151=_0x4c4ac1['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0x4c4ac1,_0xfd1151);}['_handleUserRemove'](_0x41d4d4){this['usersCount']--;const {collapseAt:_0x24559d}=this['context']['config']['get']('presenceList'),_0x156594=this['usersCount']>=_0x24559d;if(this['currentDisplayedUsers']['get'](_0x41d4d4['id']))this['currentDisplayedUsers']['remove'](_0x41d4d4['id']);else{if(_0x156594&&this['currentDisplayedUsers']['length']+0x1===_0x24559d-0x1)return;}if(this['currentDisplayedUsers']['length']+(_0x156594?0x1:0x0)<this['usersCount']){for(const _0x5119f8 of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0x5119f8['id'])&&(this['currentDisplayedUsers']['add'](_0x5119f8,Math['min'](this['currentDisplayedUsers']['length']-(_0x156594?0x1:0x0),0x1)),this['currentDisplayedUsers']['length']+(_0x156594?0x1:0x0)===_0x24559d-0x1))return;}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0xc69707=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new L(this['context']['locale'],!!_0xc69707['onClick']),this['view']['inlineListView']['isExpanded']=!0x0,this['listenTo'](this['presenceDropdownView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();});const {listWrapperView:_0x247ea1}=this['presenceDropdownView'];_0x247ea1['items']['bindTo'](this['_allConnectedUsers'])['using'](_0x489670=>{if(!_0xc69707['displayMe']&&_0x489670['isMe'])return null;const _0x3b9596=new j(this['context']['locale'],_0x489670,!!_0xc69707['onClick']);return _0xc69707['onClick']&&this['listenTo'](_0x3b9596,'execute',()=>{_0xc69707['onClick'](_0x489670,_0x3b9596['element']);}),_0x3b9596;}),this['balloonPanelView']['content']['add'](this['presenceDropdownView']),this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element']}),_0x247ea1['focus'](),_0x247ea1['checkIfScrollable']();const _0x3fd6d8=(_0x4877d0,_0x126285)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0x126285();};_0x247ea1['keystrokes']['set']('Esc',_0x3fd6d8),_0x247ea1['keystrokes']['set']('Shift+Tab',_0x3fd6d8),_0x247ea1['keystrokes']['set']('Tab',(_0x2fa745,_0x32c7de)=>{!function(_0x54599a){const _0xbb4b37=['a','button','input','select','textarea','[tabindex]','[contenteditable]']['map'](_0x1402ef=>_0x1402ef+':not([disabled]):not([tabindex=\x22-1\x22])')['join'](','),_0x320da3=[...document['body']['querySelectorAll'](_0xbb4b37)]['filter'](_0x2eeaa3=>_0x2eeaa3===document['activeElement']||_0x2eeaa3['offsetWidth']+_0x2eeaa3['offsetHeight']>0x0)['sort']((_0x4cc9a,_0x192e37)=>(_0x4cc9a['tabIndex']||0x0)-(_0x192e37['tabIndex']||0x0)),_0x1c1c0=_0x320da3['indexOf'](_0x54599a),_0x4ac689=_0x320da3[(_0x1c1c0+0x1)%_0x320da3['length']];_0x4ac689&&_0x4ac689['focus']();}(this['view']['element']),this['hideDropdown'](),_0x32c7de();}),_0x247ea1['focusTracker']['add'](this['view']['element']),_0x247ea1['focusTracker']['on']('change:isFocused',(_0x5639e6,_0x30c9e1,_0x53df2e)=>{_0x53df2e||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 PresenceList extends _0xfd8900{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,PresenceList,r as PresenceListUI,l as RealTimeCollaborationClient,g as RealTimeCollaborativeComments,a as RealTimeCollaborativeEditing,RealTimeCollaborativeRevisionHistory,RealTimeCollaborativeTrackChanges,i as Sessions,n as WebSocketGateway};
|
|
23
|
+
import{ContextPlugin as _0x4067ea,Plugin as _0x1e5d58,PendingActions as _0x5a7c8a,Context as _0x2e2ce6}from'@ckeditor/ckeditor5-core/dist/index.js';import{DomEmitterMixin as _0x9de3d6,CKEditorError as _0x3a9443,Collection as _0x36276b,global as _0x19a405,version as nt,uid as _0x36f6e1,KeystrokeHandler as _0x745df6}from'@ckeditor/ckeditor5-utils/dist/index.js';import{Notification as _0x529457,View as _0x4bb216,ListView as _0x3e031c,ListItemView as st,LabelView as at,BalloonPanelView as _0x2a3eb9,clickOutsideHandler as _0x56d96c,BodyCollection as _0x20e53c}from'@ckeditor/ckeditor5-ui/dist/index.js';import{ModelLiveRange as _0x1d7bba,History as _0x5e4bad,NoOperation as _0x2546a3,InsertOperation as _0x543630,MarkerOperation as _0x49f499,RootAttributeOperation as _0x15a55f,transformOperationSets as _0x5cbfc9,OperationFactory as _0x1c848c}from'@ckeditor/ckeditor5-engine/dist/index.js';import{WebSocketGateway as ct,WEB_SOCKET_GATEWAY_STATES as _0x3d1e25,CollaborativeEditingService as _0x4e90ee,User as ht,CommentsService as _0x5409e7,TrackChangesService as it,RevisionHistoryService as _0x5df08f,EditorService as _0xd9b4ec}from'@ckeditor/ckeditor-cloud-services-collaboration/dist/index.js';import{Users as _0x52815c,UserView as rt}from'ckeditor5-collaboration/dist/index.js';import{Compressor as _0x20e1aa}from'@ckeditor/ckeditor5-operations-compressor/dist/index.js';import{isElement as _0x15409c}from'es-toolkit/compat';class n extends _0x4067ea{static ['WebSocketGateway']=/* #__PURE__ -- @preserve */
|
|
24
|
+
((()=>ct)());static ['initialReconnectionInterval']=0x3e8;['connection'];['_reconnectionStack'];['_shouldPluginsReconnect'];['_domEmitter'];static get['requires'](){return['CloudServices',_0x529457];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x542bf0){super(_0x542bf0),this['set']('state',_0x3d1e25['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=new(_0x9de3d6())();}['init'](){const _0x1c1466=this['context'],_0x267924=_0x1c1466['plugins']['get']('CloudServices'),_0x515dc8=_0x1c1466['plugins']['get'](_0x529457);if(!_0x267924['token'])throw new _0x3a9443('websocketgateway-missing-token',this);if(!_0x267924['webSocketUrl'])throw new _0x3a9443('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'](_0x267924['token'],_0x267924['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0x16f026=>{if(this['connection']=_0x16f026,this['bind']('state')['to'](_0x16f026,'state',this,'_isBrowserOffline',(_0x56900a,_0x3177af)=>('connected'!==_0x56900a&&(this['_shouldPluginsReconnect']=!0x0),_0x3177af||_0x56900a!==_0x3d1e25['CONNECTED']?_0x3d1e25['DISCONNECTED']:this['state']==_0x3d1e25['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),_0x3d1e25['CONNECTING']):_0x3d1e25['CONNECTED'])),this['connection']['on']('error',(_0x580c1b,_0x5a466c)=>{if('limitExceeded'!==_0x5a466c['code'])throw console['error'](_0x5a466c),new _0x3a9443('cloudservices-init',null,{'originalError':_0x5a466c});_0x515dc8['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'});}),!_0x16f026['me'])return new Promise(_0x318735=>_0x16f026['on']('change:me',_0x318735));})['catch'](_0x535197=>{throw console['error'](_0x535197),new _0x3a9443('cloudservices-init',null,{'originalError':_0x535197});});}['addToReconnectionStack'](_0x2ece9d){if('function'!=typeof _0x2ece9d['reconnect'])throw new _0x3a9443('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0x2ece9d))throw new _0x3a9443('websocketgateway-plugin-already-registered',this,{'name':_0x2ece9d['constructor']['pluginName']});this['_reconnectionStack']['add'](_0x2ece9d);}['removeFromReconnectionStack'](_0x272840){this['_reconnectionStack']['delete'](_0x272840);}['isInReconnectionStack'](_0x58ef87){return this['_reconnectionStack']['has'](_0x58ef87);}['_reconnect'](){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0x226439=>_0x226439['reconnect']())))['then'](()=>this['state']=_0x3d1e25['CONNECTED'])['catch'](_0x250ae0=>{throw console['error'](_0x250ae0),new _0x3a9443('cloudservices-reconnection-error',this['context']);});}['disconnect'](){this['connection']&&this['connection']['disconnect'](),this['state']=_0x3d1e25['DISCONNECTED'],this['_domEmitter']['stopListening']();}['destroy'](){this['disconnect'](),super['destroy']();}}class i extends _0x4067ea{['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,_0x52815c];}constructor(_0x1b192f){super(_0x1b192f),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0x36276b(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x52815c);}['init'](){const _0x1e0424=this['context']['plugins']['get'](n);this['listenTo'](_0x1e0424,'change:state',(_0xbb87e3,_0x5808bf,_0x29a966)=>{if('connected'!==_0x29a966)this['channelSessions']['forEach'](_0x21fcad=>_0x21fcad['clear']()),this['channelConnectedUsers']['forEach'](_0x4fcf90=>_0x4fcf90['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x358ca8,_0x3d1d4b]of this['_registeredSessions'])for(const _0x24c3a5 of _0x3d1d4b)this['_handleSessionAdd'](_0x358ca8,_0x24c3a5);}}),this['_createUser'](_0x1e0424['connection']['me'],!0x0);}['register'](_0x292ecd,_0x126cda){if(this['_registeredSessions']['has'](_0x292ecd))throw new _0x3a9443('sessions-register-already-registered',null,{'channelId':_0x292ecd});this['_registeredSessions']['set'](_0x292ecd,_0x126cda),this['channelSessions']['set'](_0x292ecd,new _0x36276b()),this['channelConnectedUsers']['set'](_0x292ecd,new _0x36276b()),this['listenTo'](_0x126cda,'add',(_0x417762,_0x4fd045)=>this['_handleSessionAdd'](_0x292ecd,_0x4fd045)),this['listenTo'](_0x126cda,'remove',(_0x1f12d1,_0x3407fc)=>this['_handleSessionRemove'](_0x292ecd,_0x3407fc));for(const _0x5bab84 of _0x126cda)this['_handleSessionAdd'](_0x292ecd,_0x5bab84);}['unregister'](_0x271124){if(!this['_registeredSessions']['has'](_0x271124))throw new _0x3a9443('sessions-unregister-not-exist',null,{'channelId':_0x271124});const _0x37aff5=this['_registeredSessions']['get'](_0x271124);this['stopListening'](_0x37aff5);for(const _0x32f724 of _0x37aff5)'connected'===this['context']['plugins']['get'](n)['state']&&this['_handleSessionRemove'](_0x271124,_0x32f724);this['_registeredSessions']['delete'](_0x271124),this['channelSessions']['delete'](_0x271124),this['channelConnectedUsers']['delete'](_0x271124);}get['mySessionId'](){return this['context']['plugins']['get'](n)['connection']['sessionId'];}['getUserBySessionId'](_0x64267b){for(const _0x20b31f of this['channelSessions']['values']())for(const _0x9fa30c of _0x20b31f)if(_0x9fa30c['id']===_0x64267b)return _0x9fa30c['user'];}['getUserSessions'](_0x3e1c26,_0x52d250){const _0x5b46d5=_0x52d250?[this['channelSessions']['get'](_0x52d250)]:this['channelSessions']['values'](),_0x1655ba=new Set();for(const _0x1b8fb5 of _0x5b46d5)for(const _0x39ebb0 of _0x1b8fb5)_0x39ebb0['user']['id']===_0x3e1c26['id']&&_0x1655ba['add'](_0x39ebb0['id']);return _0x1655ba;}['getUserRole'](_0x41c342){for(const _0x6268da of this['channelSessions']['values']())for(const _0x4ebae3 of _0x6268da)if(_0x4ebae3['user']===_0x41c342)return _0x4ebae3['role'];}['_handleSessionAdd'](_0x492aa1,_0x2d0812){if('connected'!==this['context']['plugins']['get'](n)['state'])return;const _0x3de37a=_0x2d0812['user'],_0x18b28f=this['_users']['getUser'](_0x3de37a['id'])||this['_createUser'](_0x3de37a),_0x58041e=Object['assign']({},_0x2d0812,{'user':_0x18b28f});if(this['channelSessions']['get'](_0x492aa1)['add'](_0x58041e),!_0x3de37a['hiddenInPresenceList']){const _0x1ce21e=this['channelConnectedUsers']['get'](_0x492aa1);_0x1ce21e['has'](_0x18b28f['id'])||_0x1ce21e['add'](_0x18b28f),this['allConnectedUsers']['has'](_0x18b28f['id'])||_0x3de37a['hiddenInPresenceList']||this['allConnectedUsers']['add'](_0x18b28f,_0x18b28f['isMe']?0x0:void 0x0);}this['fire']('sessionAdd:'+_0x492aa1,{'channelId':_0x492aa1,'session':_0x58041e});}['_handleSessionRemove'](_0x4c959d,_0x537b49){if('connected'!==this['context']['plugins']['get'](n)['state'])return;const _0x22e527=this['channelConnectedUsers']['get'](_0x4c959d),_0x293332=_0x537b49['user'];_0x293332['id']&&(this['channelSessions']['get'](_0x4c959d)['remove'](_0x537b49['id']),_0x22e527['has'](_0x293332['id'])&&!this['getUserSessions'](_0x293332,_0x4c959d)['size']&&_0x22e527['remove'](_0x293332['id']),this['allConnectedUsers']['get'](_0x293332['id'])&&!this['getUserSessions'](_0x293332)['size']&&this['allConnectedUsers']['remove'](_0x293332['id']));}['_createUser'](_0x5adabb,_0x311438){const _0x503701=this['_users']['addUser'](_0x5adabb);return _0x311438&&this['_users']['defineMe'](_0x5adabb['id']),_0x503701['orderNumber']=this['_uniqueUsersCount']++,_0x503701;}}class z extends _0x1e5d58{['_domEmitter']=new(_0x9de3d6())();static get['requires'](){return[i];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x317318=this['editor'],_0xd8dbef=_0x317318['plugins']['get'](i);_0x317318['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x9ef1c5,{writer:_0x24f68d})=>function(_0x41a19c,_0x2dfcea,_0x29ee1a,_0x6eaad){const _0x2b07c4=_0x41a19c['markerName']['split'](':')[0x2],_0x4b4b20=_0x29ee1a['getUserBySessionId'](_0x2b07c4);if(!_0x4b4b20||_0x2b07c4===_0x29ee1a['mySessionId'])return;if(!_0x6eaad['model']['schema']['checkChild'](_0x41a19c['markerRange']['start'],'$text'))return;const _0x139636={'class':'ck-user__marker\x20'+_0x4b4b20['color']['getMarkerClass'](),'data-name':_0x4b4b20['name'],'data-session-id':_0x2b07c4},_0x1f8f6d=_0x6eaad['model']['markers']['get'](_0x41a19c['markerName']),_0x51715b=_0x1f8f6d['getStart'](),_0x25831e=_0x51715b['nodeAfter'],_0x414ee7=_0x6eaad['model']['schema'];if(_0x25831e&&_0x414ee7['isObject'](_0x25831e)&&_0x414ee7['isInline'](_0x25831e)&&!_0x6eaad['model']['markers']['get']('user:range:'+_0x2b07c4)['getRange']()['isCollapsed'])return;const _0x358f8b=_0x51715b['parent'];return _0x6eaad['model']['schema']['isLimit'](_0x358f8b)&&!_0x6eaad['model']['hasContent'](_0x358f8b)&&(_0x139636['contenteditable']=!0x1),function(_0x4de50c,_0x464e62,_0x430ab){const _0x3a4321=_0x4de50c['createUIElement']('span',_0x464e62);return _0x4de50c['setCustomProperty']('userPositionMarker',!0x0,_0x3a4321),_0x3a4321['render']=function(_0x1ebc29){const _0x25c328=this['toDomElement'](_0x1ebc29),_0x4d2420=document['createElement']('span');return _0x4d2420['classList']['add']('ck-user__marker-tooltip'),_0x4d2420['setAttribute']('contenteditable','false'),_0x4d2420['setAttribute']('spellcheck','false'),_0x4d2420['textContent']=_0x430ab['name'],_0x25c328['innerHTML']='<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span>'+_0x4d2420['outerHTML']+'',_0x25c328['addEventListener']('mouseenter',()=>{_0x25c328['classList']['add']('ck-user__marker_hovered');}),_0x25c328['addEventListener']('mouseleave',()=>{_0x25c328['classList']['remove']('ck-user__marker_hovered');}),_0x25c328;},_0x3a4321['isSimilar']=function(_0x62d181){return!(!this['getCustomProperty']('userPositionMarker')||!_0x62d181['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0x62d181['getAttribute']('data-session-id'));},_0x3a4321;}(_0x2dfcea,_0x139636,_0x4b4b20);}(_0x9ef1c5,_0x24f68d,_0xd8dbef,_0x317318)}),_0x317318['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0x560850=>function(_0xf16640,_0x251ab4){const _0xda280b=_0xf16640['markerName']['split'](':')[0x2];if(_0xda280b===_0x251ab4['mySessionId'])return null;const _0x2789fa=_0x251ab4['getUserBySessionId'](_0xda280b);if(!_0x2789fa)return{'id':_0xda280b,'classes':[]};return{'id':_0xda280b,'classes':['ck-user__selection',_0x2789fa['color']['getSelectionClass']()],'attributes':{'data-session-id':_0xda280b},'priority':0x7d0+_0x2789fa['orderNumber']};}(_0x560850,_0xd8dbef)}),function(_0x5ac737){const _0x47eb82=_0x5ac737['model'],_0x3429c7=new Map(),_0x588c80=_0x5ac737['plugins']['get'](i);_0x47eb82['markers']['on']('update:user:range',(_0x27e51a,_0x4d6c15,_0x14ae60,_0x3d402e)=>{if(!_0x3d402e&&_0x3429c7['get'](_0x4d6c15['name']))return _0x3429c7['get'](_0x4d6c15['name'])['detach'](),void _0x3429c7['delete'](_0x4d6c15['name']);const _0x47c46f=_0x4d6c15['name']['split'](':')[0x2];if(_0x47c46f===_0x588c80['mySessionId'])return;const _0x3feca6='user:position:'+_0x47c46f;_0x47eb82['markers']['has'](_0x3feca6)&&_0x5ac737['editing']['reconvertMarker'](_0x3feca6),_0x4d6c15['on']('change:range',(_0x1c9a7e,_0x51d58b,_0x4581ac)=>{if('$graveyard'!=_0x51d58b['root']['rootName']&&'$graveyard'==_0x4d6c15['getRange']()['root']['rootName']&&!_0x3429c7['has'](_0x4d6c15['name'])){const _0x22dc71=_0x47eb82['schema']['getNearestSelectionRange'](_0x4581ac['deletionPosition']);if(_0x22dc71){const _0x4bf1ef=_0x1d7bba['fromRange'](_0x22dc71);_0x3429c7['set'](_0x4d6c15['name'],_0x4bf1ef),_0x4bf1ef['on']('change:range',(_0x4d640d,_0x172339,_0x34e5fd)=>{if('$graveyard'==_0x4bf1ef['root']['rootName']){const _0x207cd5=_0x47eb82['schema']['getNearestSelectionRange'](_0x34e5fd['deletionPosition']);_0x207cd5?(_0x4bf1ef['start']=_0x207cd5['start'],_0x4bf1ef['end']=_0x207cd5['end']):(_0x3429c7['delete'](_0x4d6c15['name']),_0x4bf1ef['detach']());}});}}});}),_0x47eb82['document']['on']('change',()=>{_0x3429c7['size']>0x0&&_0x47eb82['enqueueChange']({'isUndoable':!0x1},_0x520bbd=>{for(const [_0x501bf0,_0x3a538c]of _0x3429c7)'$graveyard'==_0x47eb82['markers']['get'](_0x501bf0)['getRange']()['root']['rootName']&&(Q(_0x501bf0['split'](':')[0x2],_0x3a538c['toRange'](),_0x47eb82,_0x520bbd),_0x3a538c['detach']());_0x3429c7['clear']();});});}(_0x317318),this['_domEmitter']['listenTo'](_0x19a405['document'],'keydown',(_0x5844d4,{key:_0x2056ac})=>{'Escape'===_0x2056ac&&function(_0x1d486e){_0x1d486e['editing']['view']['change'](_0x5ef634=>{for(const _0x2ecf80 of _0x1d486e['model']['markers']){if(!_0x2ecf80['name']['startsWith']('user:position'))continue;const _0x44269a=_0x1d486e['editing']['mapper']['markerNameToElements'](_0x2ecf80['name']);if(_0x44269a){for(const _0x467e61 of _0x44269a)_0x5ef634['removeClass']('ck-user__marker_hovered',_0x467e61);}}});}(_0x317318);},{'useCapture':!0x0});}['afterInit'](){const _0x492ef9=this['editor'],_0x15183e=_0x492ef9['commands']['get']('undo');_0x15183e&&_0x492ef9['model']['on']('applyOperation',(_0x5850ce,_0x4e55ca)=>{const _0x912c42=_0x4e55ca[0x0];if(!_0x912c42['isDocumentOperation'])return;if('marker'!=_0x912c42['type']||!_0x912c42['name']['startsWith']('user:'))return;const _0x3a81dc=_0x912c42['batch'];_0x15183e['_createdBatches']['has'](_0x3a81dc)&&(_0x912c42['newRange']=_0x912c42['oldRange']?_0x492ef9['model']['createRange'](_0x912c42['oldRange']['start'],_0x912c42['oldRange']['end']):null);},{'priority':'highest'});}['destroy'](){return this['_domEmitter']['stopListening'](),super['destroy']();}['createUserMarkerOperations'](){const _0x5da213=this['editor'],_0x3ed0a5=_0x5da213['model']['document'],_0x5736eb=_0x5da213['plugins']['get'](i);_0x5da213['model']['enqueueChange']({'isUndoable':!0x1},_0x25cd73=>{const _0x3830bb='user:range:'+_0x5736eb['mySessionId'],_0x37a038='user:position:'+_0x5736eb['mySessionId'],_0x354d2e=_0x5da213['model']['markers']['has'](_0x3830bb);_0x5da213['editing']['view']['hasDomSelection']?Q(_0x5736eb['mySessionId'],_0x3ed0a5['selection']['getFirstRange'](),_0x5da213['model'],_0x25cd73):_0x354d2e&&(_0x25cd73['removeMarker'](_0x3830bb),_0x25cd73['removeMarker'](_0x37a038));});}}function Q(_0x5715ee,_0x10a03c,_0x5d2fcb,_0xa9dadf){const _0x516d1f='user:range:'+_0x5715ee,_0x3f4737='user:position:'+_0x5715ee,_0x480e19=_0x10a03c['getContainedElement']();let _0x5db0d1=_0x10a03c['start'];if(_0x480e19&&_0x480e19['is']('element','tableCell')){const _0x24b213=function(_0x2f794a,_0x800835){for(const _0x3c7db6 of _0x2f794a['getPositions']())if(_0x800835['schema']['checkChild'](_0x3c7db6,'$text'))return _0x3c7db6;}(_0x10a03c,_0x5d2fcb);_0x24b213&&(_0x5db0d1=_0x24b213,_0x10a03c=_0xa9dadf['createRange'](_0x5db0d1));}const _0x575409=_0xa9dadf['createRange'](_0x5db0d1);_0x5d2fcb['markers']['has'](_0x516d1f)?(_0xa9dadf['updateMarker'](_0x516d1f,{'range':_0x10a03c}),_0xa9dadf['updateMarker'](_0x3f4737,{'range':_0x575409})):(_0xa9dadf['addMarker'](_0x516d1f,{'range':_0x10a03c,'usingOperation':!0x0}),_0xa9dadf['addMarker'](_0x3f4737,{'range':_0x575409,'usingOperation':!0x0}));}function V(_0x4ede6b,_0x56be7e,_0x386937){const _0x547919=_0x4ede6b['t'],t=_0x4ede6b['t'];switch(_0x56be7e){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 _0x547919({'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'},_0x386937);default:return'';}}let q=0x1;class l extends _0x1e5d58{static ['CollaborativeEditingService']=/* #__PURE__ -- @preserve */
|
|
25
|
+
((()=>_0x4e90ee)());['_offset'];['sessionId'];['serverHistory'];['_channelId'];['_service'];['_document'];['_compressor'];['_bufferedOperations'];['_knownOperations'];['_knownRootNames'];['_pendingAction'];['_hasSelectionChanged'];['_sendBufferedOperationsDelayId'];['_baseBufferDelay'];['_currentBufferDelay'];['_lastSyncedOperationId'];['_disconnectionOperations'];['_operationIdentifier'];static get['requires'](){return[n,i,z,_0x5a7c8a,_0x52815c,_0x529457];}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 _0x3b8993=this['serverHistory']['getOperations']();for(let _0x177d6e=_0x3b8993['length']-0x1;_0x177d6e>=0x0;_0x177d6e--){const _0x59f814=_0x3b8993[_0x177d6e];if(!this['_disconnectionOperations']['has'](_0x59f814))return _0x59f814['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0x2576e5){if(super(_0x2576e5),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x5e4bad(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0x3a9443('collaboration-missing-channelid',this);const _0x50fc68=_0x2576e5['config']['get']('cloudServices.bundleVersion')||nt;this['_service']=new l['CollaborativeEditingService'](_0x50fc68,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0x20e1aa(),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 OperationIdentifier(this['_disconnectionOperations']);}['init'](){const _0x1ebe20=this['editor'],_0x4ba413=_0x1ebe20['plugins']['get'](_0x52815c),_0x5ae507=_0x1ebe20['plugins']['get'](n);this['listenTo'](_0x4ba413,'getOperationAuthor',(_0x579b2e,_0x5b5a63)=>{const _0x27e52a=_0x5b5a63[0x0];_0x27e52a['_authorId']&&(_0x579b2e['return']=_0x4ba413['getUser'](_0x27e52a['_authorId']),_0x579b2e['stop']()),null===_0x27e52a['_authorId']&&(_0x579b2e['return']=null,_0x579b2e['stop']());},{'priority':'high'}),this['listenTo'](_0x1ebe20['model']['document']['selection'],'change:range',(_0x46ccd2,_0x4a2de1)=>{_0x4a2de1['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x1ebe20['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x1ebe20['model']['on']('applyOperation',(_0x4cc979,_0x571a82)=>{const _0x507c5d=_0x571a82[0x0];_0x507c5d['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0x507c5d),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['bind']('_isEditingAllowed')['to'](_0x5ae507,'state',this,'_hasSynchronizationProblem',(_0x583d3f,_0x5bb0f1)=>'connected'===_0x583d3f&&!_0x5bb0f1),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x1ebe20['disableReadOnlyMode']('rtc-offline'):_0x1ebe20['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x1ebe20['disableReadOnlyMode']('rtc-offline'):_0x1ebe20['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async['reconnect'](){const _0x4eedaa=this['editor']['plugins']['get'](i),_0x5b2cd4=this['editor']['plugins']['get'](n);try{this['_isPendingUpdate']=!0x0,_0x4eedaa['unregister'](this['_channelId']);const _0xadb81c=await this['_service']['reconnect'](_0x5b2cd4['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0xadb81c)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x3170d0=await this['_service']['getConnectedSessions']();_0x4eedaa['register'](this['_channelId'],_0x3170d0),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x531250){if(function(_0x3537e1){return'404'===_0x3537e1['code'];}(_0x531250)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0x5477f0){return'409'===_0x5477f0['code'];}(_0x531250)){const _0x50772a=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'](_0x50772a);}else{if(!(_0x531250 instanceof ReconnectionError))throw _0x531250;this['_handleReconnectionError']();}}}}['destroy'](){const _0x14c35a=this['editor']['plugins']['get'](n),_0x48b3c6=this['editor']['plugins']['get'](i);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x48b3c6['channelSessions']['has'](this['_channelId'])&&_0x48b3c6['unregister'](this['_channelId']),_0x14c35a['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async['_handleReconnectionResponse'](_0x25b259){if(this['sessionId']!==_0x25b259['sessionId']&&this['_lastSyncedOperationId']!==_0x25b259['lastOperationId'])throw new ReconnectionError();return this['sessionId']=_0x25b259['sessionId'],this['_handleServerResponse']([],{..._0x25b259,'wereChangesApplied':!0x1,'data':_0x25b259['data']},'reconnect');}async['_connectService'](_0x2bd98c,_0x18ad12=!0x1){const {connection:_0x255099}=this['editor']['plugins']['get'](n);l['CollaborativeEditingService']['getConnectedSessions'](_0x255099,this['_channelId'])['then'](_0x5a42bc=>this['_initSessionsHandling'](_0x5a42bc))['catch'](_0x5de325=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x5de325);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x4d14c0,_0x19ea48)=>{this['_crash']('realtimecollaborationclient-init-service-internal-error',_0x19ea48);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_isConnected']=!0x1;});const _0x21a10c=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x2bd98c);this['_isPendingUpdate']=!0x0;const _0x549ed0=await this['_service']['connect'](_0x255099,this['_compressOperations'](_0x2bd98c),_0x21a10c);if(this['sessionId']=_0x549ed0['sessionId'],_0x18ad12){if(!_0x549ed0['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x549ed0['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0x2bd98c,_0x549ed0,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x549ed0,_0x2bd98c);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}['_handleSendingSelectionMarkers'](){const _0x583e1a=this['editor']['plugins']['get'](i),_0x1d6a86=this['editor']['plugins']['get'](z),_0x595a3c=_0x583e1a['channelSessions']['get'](this['_channelId']);_0x595a3c&&_0x595a3c['length']>0x1?_0x1d6a86['createUserMarkerOperations']():this['listenTo'](_0x583e1a,'sessionAdd:'+this['_channelId'],()=>{0x2===_0x583e1a['channelSessions']['get'](this['_channelId'])['length']&&_0x1d6a86['createUserMarkerOperations']();});}async['_handleReceivedOperations'](_0x19242b,_0x337542,_0x6bebc1,_0x1704dd){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x337542){const _0x3310fe=this['_decompressOperations'](_0x6bebc1,_0x1704dd);await this['_fetchMissingUsers'](_0x3310fe),this['_handleExternalOperations'](_0x3310fe,_0x337542,_0x6bebc1['lastOperationId'])||this['_crash']('realtimecollaborationclient-init-service-incorrect-server-operation');}}async['_connectAfterSessionHasBeenFlushed'](){this['_disconnectService']();const {locale:_0x519571}=this['editor'];let _0x402036;try{_0x402036=await this['_service']['getDocumentDetails']();}catch{const _0x4f6712=V(_0x519571,'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'](_0x4f6712);}const _0x5367fe=_0x402036['currentDocumentSession']||_0x402036['lastDocumentSession'];if(this['_lastSyncedOperationId']!==_0x5367fe['lastOperationId']){const _0x56c553=V(_0x519571,'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'](_0x56c553);}await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);}['_disconnectService'](){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['stopListening'](this['_service']);}['_initSessionsHandling'](_0xde3909){const _0xabb3e3=this['editor']['plugins']['get'](i);this['listenTo'](_0xabb3e3,'sessionAdd:'+this['_channelId'],(_0x3717e0,{session:_0x8f56ad})=>{if(_0x8f56ad['id']===_0xabb3e3['mySessionId']){_0x3717e0['off']();const _0x1b9be3=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0x4fd702=_0x8f56ad['permissions'];_0x1b9be3&&_0x1b9be3['isEnabled']&&(_0x4fd702=_0x4fd702['filter'](_0x148a3c=>'document:write'!==_0x148a3c)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0x4fd702,this['_channelId']);}}),_0xabb3e3['register'](this['_channelId'],_0xde3909);}['_initThrowingOnDataSet'](){const _0x36725e=this['editor']['data']['set'];this['editor']['data']['set']=(..._0x352993)=>{if(!_0x352993[_0x352993['length']-0x1]['suppressErrorInCollaboration'])throw new _0x3a9443('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x36725e['apply'](this['editor']['data'],_0x352993);};}['_setUpDataInit'](){this['editor']['data']['on']('init',(_0x4ec234,[_0x214f36])=>{if(this['_document']['version'])throw new _0x3a9443('realtimecollaborationclient-init-document-already-initialized',this);_0x4ec234['stop'](),this['_setPendingAction']();const _0x2e38ad=this['editor']['config']['get']('rootsAttributes'),_0x15b9f0=this['_getOperationsFromInitData'](_0x214f36,_0x2e38ad);0x0==_0x15b9f0['length']&&_0x15b9f0['push'](new _0x2546a3(0x0)),_0x4ec234['return']=this['_connectService'](_0x15b9f0)['then'](()=>{this['editor']['plugins']['get'](n)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x546ad8=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x546ad8))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x57587a,[_0x5e395c,_0x220428])=>{_0x57587a['stop']();const _0x5af114=this['editor']['model']['document']['getRoot'](_0x5e395c);if(!this['_knownRootNames']['has'](_0x5e395c)){const _0x122d3d=_0x220428&&_0x220428['data']?_0x220428['data']:'',_0x327d8a=_0x220428&&_0x220428['attributes']?_0x220428['attributes']:{};await this['_loadRoot'](_0x5e395c,_0x122d3d,_0x327d8a);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0x5af114['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0x5af114);});},{'priority':'high'});}async['_fetchMissingUsers'](_0x103cb1){const _0x28162d=this['editor']['plugins']['get'](_0x52815c),{connection:_0x12892e}=this['editor']['plugins']['get'](n),_0x1c6b5c=new Set();for(const _0x4a037a of _0x103cb1){const _0xec7c92=_0x4a037a['_authorId'];_0xec7c92&&!_0x28162d['getUser'](_0xec7c92)&&_0x1c6b5c['add'](_0xec7c92);}if(0x0===_0x1c6b5c['size'])return;const _0x449f6a=await ht['getMany'](_0x12892e,Array['from'](_0x1c6b5c));for(const _0x3f9889 of _0x449f6a)_0x28162d['getUser'](_0x3f9889['id'])||_0x28162d['addUser'](_0x3f9889);}['_getOperationsFromInitData'](_0x46003b,_0x420977={}){const _0x45dd63=this['editor']['model'],_0x210ab8=[];let _0x1fffce=0x0;const _0xb92397='string'==typeof _0x46003b?{'main':_0x46003b}:_0x46003b;for(const _0x1869b2 of Object['keys'](_0xb92397)){if(!this['_document']['roots']['has'](_0x1869b2))throw new _0x3a9443('realtimecollaborationclient-init-non-existent-root',this);const _0x3ee0cc=this['editor']['data']['parse'](_0xb92397[_0x1869b2]),_0xc501a9=this['_document']['getRoot'](_0x1869b2),_0x4267f0=new _0x543630(_0x45dd63['createPositionAt'](_0xc501a9,0x0),_0x3ee0cc,_0x1fffce++);_0x210ab8['push'](_0x4267f0);for(const [_0x180c14,_0x99b986]of _0x3ee0cc['markers']){const _0x31d8a8=_0x45dd63['createRange'](_0x45dd63['createPositionFromPath'](_0xc501a9,_0x99b986['start']['path']['slice']()),_0x45dd63['createPositionFromPath'](_0xc501a9,_0x99b986['end']['path']['slice']())),_0x251d33=new _0x49f499(_0x180c14,null,_0x31d8a8,_0x45dd63['markers'],!0x0,_0x1fffce++);_0x210ab8['push'](_0x251d33);}}if(_0x420977)for(const [_0x512e2f,_0x543d3c]of Object['entries'](_0x420977)){const _0x425148=_0x45dd63['document']['getRoot'](_0x512e2f);if(!_0x425148)throw new _0x3a9443('multi-root-editor-root-attributes-no-root',null);for(const [_0x5a3847,_0x138149]of Object['entries'](_0x543d3c))if(null!==_0x138149){const _0x26ba39=new _0x15a55f(_0x425148,_0x5a3847,null,_0x138149,_0x1fffce++);_0x210ab8['push'](_0x26ba39);}}return _0x210ab8;}async['_loadRoot'](_0x5bc957,_0x1ffb1b,_0x12528c){this['_getOperationsFromInitData']({[_0x5bc957]:_0x1ffb1b},{[_0x5bc957]:_0x12528c})['forEach']((_0x243694,_0xb2f129)=>{_0x243694['baseVersion']=this['_document']['version']+_0xb2f129,_0x243694['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x243694);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async['_handleInitialConnectionData'](_0x246082,_0x18115d){let _0x3243b1;this['_offset']=_0x246082['offset'];const _0x209d6f=_0x246082['wereChangesApplied']&&!_0x246082['initData'],_0x511b98=_0x209d6f?0x0:_0x246082['data']['baseVersion'];if(_0x18115d['forEach'](_0x1279eb=>{_0x1279eb['_isInit']=!0x0,_0x1279eb['createdAt']=_0x246082['sessionCreatedAt'],_0x1279eb['_authorId']=null;}),_0x209d6f)_0x3243b1=_0x18115d,this['_applyOperationsSet'](_0x3243b1,_0x209d6f);else{if(_0x246082['initData']){const _0x481aff=this['_getOperationsFromInitData'](_0x246082['initData']);this['_document']['history']['version']=-_0x481aff['length'],_0x481aff['forEach'](_0x50eee2=>{_0x50eee2['baseVersion']-=_0x481aff['length'],_0x50eee2['createdAt']=_0x246082['sessionCreatedAt'],_0x50eee2['_isInit']=!0x0,_0x50eee2['_authorId']=null;}),this['_applyOperationsSet'](_0x481aff,!0x0),this['serverHistory']['version']=-_0x481aff['length']+this['_offset'],this['_updateServerHistory'](_0x481aff);}this['_document']['history']['version']=_0x511b98,_0x3243b1=this['_decompressOperations'](_0x246082['data'],_0x246082['metadata']),await this['_fetchMissingUsers'](_0x3243b1),this['_applyOperationsSet'](_0x3243b1,_0x209d6f);}_0x246082['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x3243b1,_0x246082['lastOperationId']),this['_lastSyncedOperationId']=_0x246082['lastOperationId']),this['serverHistory']['version']=_0x511b98+this['_offset'],this['_updateServerHistory'](_0x3243b1),_0x18115d['filter'](_0x5c532c=>{const _0x444941=this['_getAffectedRoot'](_0x5c532c);return _0x444941&&!this['_knownRootNames']['has'](_0x444941);})['forEach']((_0x22ea32,_0x163145)=>{_0x22ea32['baseVersion']=this['_document']['version']+_0x163145,this['_saveOperationInBuffer'](_0x22ea32);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x4e2971,_0x3d7d0a){const _0x31e6f4=_0x3d7d0a&&_0x3d7d0a['message'];if(_0x31e6f4&&_0x31e6f4['startsWith']('realtimecollaborationclient'))throw _0x3d7d0a;const _0x545fd2=this['editor']['plugins']['get'](n);throw this['_isPendingUpdate']=!0x0,_0x545fd2['disconnect'](),this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0x3a9443(_0x4e2971,this['editor'],_0x31e6f4?{'originalError':_0x31e6f4}:void 0x0);}['_saveOperationInBuffer'](_0x429fc8){this['_knownOperations']['has'](_0x429fc8)||(this['_knownOperations']['add'](_0x429fc8),this['_bufferedOperations']['push'](_0x429fc8),this['_pendingAction']||'marker'==_0x429fc8['type']&&!_0x429fc8['affectsData']||this['_setPendingAction']());}['_sendBufferedOperationsDelayed'](_0x15cb21=!0x1){!_0x15cb21&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0xc30689=>{_0xc30689&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0x35a9d2=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0x3becfe){return _0x3becfe['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x3becfe['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0x3becfe['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0x35a9d2)||this['_crash'](_0x35a9d2['message'],_0x35a9d2);});},this['_currentBufferDelay']));}['_waitUntilSynced'](){return new Promise(_0x3cdf8b=>{this['on']('change:_isPendingUpdate',()=>{_0x3cdf8b();});});}async['_sendBufferedOperations'](){const _0x5ef11f=this['editor']['plugins']['get'](z);if(this['_shouldSendSelectionUpdate']()&&(_0x5ef11f['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x3a265b=[...this['_bufferedOperations']];for(const _0x57e03c of _0x3a265b)_0x57e03c['wasUndone']=this['_document']['history']['isUndoneOperation'](_0x57e03c);const _0x38d765=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x3a265b),_0x2f52fd=q++,_0x4754c6=this['_compressOperations'](_0x3a265b),_0x3e72e4=await this['_service']['sendOperations'](_0x4754c6,_0x4754c6['baseVersion'],_0x38d765);try{return await this['_handleServerResponse'](_0x3a265b,_0x3e72e4,_0x2f52fd);}catch(_0x4305f2){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0x4305f2);}}async['_handleServerResponse'](_0x130e41,_0x351cf6,_0x20df22){if('error'in _0x351cf6)throw _0x351cf6['error'];let _0x567cba=!0x1;if(_0x351cf6['wereChangesApplied']){_0x351cf6['lastOperationId']&&(this['_lastSyncedOperationId']=_0x351cf6['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x58e5ce=>!_0x130e41['includes'](_0x58e5ce));for(const _0x11c840 of _0x130e41)_0x11c840['createdAt']='lastOperationAcceptedAt'in _0x351cf6&&_0x351cf6['lastOperationAcceptedAt']||void 0x0;G(_0x130e41,_0x351cf6['version']-_0x130e41['length']),this['_updateServerHistory'](_0x130e41);const _0x381d4b=_0x130e41['filter'](_0x263d61=>{if(!_0x263d61['_isInit'])return!0x1;const _0x389b44=this['_getAffectedRoot'](_0x263d61);return _0x389b44&&!this['_knownRootNames']['has'](_0x389b44);});G(_0x381d4b,this['_document']['version']),this['_applyOperationsSet'](_0x381d4b),_0x567cba=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0x518bbe=this['_decompressOperations'](_0x351cf6['data'],_0x351cf6['metadata'])['filter'](_0x25f3ff=>_0x25f3ff['baseVersion']>=this['_lastServerVersion']);_0x518bbe['forEach'](_0x351207=>this['_addKnownRoot'](_0x351207)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x3eb65c=>!_0x3eb65c['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x3eb65c))),this['_bufferedOperations']['length']&&G(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0x518bbe),_0x567cba=this['_handleExternalOperations'](_0x518bbe,_0x351cf6['version'],_0x351cf6['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x567cba?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}['_handleExternalOperations'](_0x3d9805,_0xb82fd4,_0x186975){try{const _0x20f3a1={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x1f7659,operationsB:_0x49e60d,originalOperations:_0x31dcfb}=_0x5cbfc9(_0x3d9805,this['_bufferedOperations'],_0x20f3a1);G(_0x1f7659,this['_document']['version']),G(_0x49e60d,_0xb82fd4);for(const _0x2ea8f3 of _0x1f7659){const _0x4198ad=_0x31dcfb['get'](_0x2ea8f3);_0x2ea8f3['_authorId']=_0x4198ad?_0x4198ad['_authorId']:null;}_0x186975&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x3d9805,_0x186975),this['_lastSyncedOperationId']=_0x186975),this['_bufferedOperations']=[..._0x49e60d],this['_applyOperationsSet'](_0x1f7659),this['_updateServerHistory'](_0x3d9805);}catch(_0x46c8b4){return console['error'](_0x46c8b4),!0x1;}return!0x0;}['_applyOperationsSet'](_0x242978,_0x11085c=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0x141c66=>{for(const _0x516b82 of _0x242978)this['_knownOperations']['add'](_0x516b82),this['_addKnownRoot'](_0x516b82),_0x141c66['batch']['addOperation'](_0x516b82),this['editor']['model']['applyOperation'](_0x516b82);});}['_addKnownRoot'](_0x3f9390){const _0x590bd6=this['_getAffectedRoot'](_0x3f9390);_0x590bd6&&this['_knownRootNames']['add'](_0x590bd6);}['_getAffectedRoot'](_0x28a63f){let _0x2a37c3,_0x120461;switch(_0x28a63f['type']){case'insert':_0x2a37c3=_0x28a63f['position']['root'];break;case'marker':if(_0x120461=_0x28a63f['newRange'],!_0x120461)return null;_0x2a37c3=_0x120461['root'];break;case'addRootAttribute':_0x2a37c3=_0x28a63f['root'];break;case'addRoot':_0x2a37c3=_0x28a63f['affectedSelectable'];break;case'move':_0x2a37c3=_0x28a63f['targetPosition']['root'];break;default:return null;}return _0x2a37c3['rootName'];}['_updateServerHistory'](_0x4ee202){_0x4ee202['forEach'](_0x309614=>{const _0x4eeda7=_0x309614['clone']();_0x4eeda7['_authorId']=_0x309614['_authorId'],_0x4eeda7['_isInit']=!!_0x309614['_isInit'],_0x4eeda7['createdAt']=_0x309614['createdAt'],_0x4eeda7['baseVersion']+=this['_offset'],_0x309614['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x4eeda7),this['serverHistory']['addOperation'](_0x4eeda7);});}['_handleReconnectionError'](_0x39f6cf){const _0x2f8018=this['editor']['plugins']['get']('Notification'),_0x4fb6b4=this['editor']['locale'];_0x39f6cf||(_0x39f6cf=V(_0x4fb6b4,'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.')),_0x2f8018['showWarning'](_0x39f6cf,{'title':V(_0x4fb6b4,'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'](_0x5a7c8a)['add'](V(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}['_clearPendingAction'](){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x5a7c8a)['remove'](this['_pendingAction']),this['_pendingAction']=null);}['_compressOperations'](_0x5e9537){const _0x3004dc=_0x5e9537['map'](_0x429f44=>_0x429f44['toJSON']());return this['_compressor']['compress'](_0x3004dc);}['_decompressOperations'](_0x5e5cc8,_0xc41365){return this['_compressor']['decompress'](_0x5e5cc8)['map']((_0x3adc95,_0x19a7e1)=>{const _0x1be1b5='init'==_0xc41365[_0x19a7e1]['type'];if('InsertOperation'==_0x3adc95['__className']){const _0x26b29e=_0x3adc95['position']['root'];!this['_document']['getRoot'](_0x26b29e)&&(this['_document']['createRoot']('$root',_0x26b29e)['_isAttached']=!0x1);}const _0x4cc327=_0x1c848c['fromJSON'](_0x3adc95,this['_document']);return _0x4cc327['wasUndone']=_0x3adc95['wasUndone'],_0x4cc327['_isInit']=_0x1be1b5,_0x4cc327['_authorId']=_0x1be1b5?null:_0xc41365[_0x19a7e1]['userId'],_0x4cc327['_isDisconnection']='cs:removeUser'===_0xc41365[_0x19a7e1]['type'],_0x4cc327['createdAt']=_0xc41365[_0x19a7e1]['createdAt'],_0x4cc327;});}['_refreshUserSelectionMarkers'](){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}['_shouldSendSelectionUpdate'](){const _0x3b25f8=this['editor']['plugins']['get'](i)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0x3b25f8&&_0x3b25f8['length']>0x1&&this['_hasSelectionChanged'];}['_shouldSendUpdate'](){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}}class ReconnectionError extends Error{}function G(_0x5bdf7c,_0x2dbce7){for(const _0x1dd89f of _0x5bdf7c)_0x1dd89f['baseVersion']=_0x2dbce7++;}class OperationIdentifier{['_ignoredOperations'];['_operationToId'];constructor(_0x1a19f7){this['_ignoredOperations']=_0x1a19f7,this['_operationToId']=new WeakMap();}['getIdOfTheLastOperation'](_0x2af1d2){let _0x1843f5=_0x2af1d2['length'];for(;_0x1843f5--;){const _0x50bc8c=_0x2af1d2[_0x1843f5];if(!this['_ignoredOperations']['has'](_0x50bc8c)){if(!this['_operationToId']['has'](_0x50bc8c)){const _0x26fd09=_0x36f6e1()['slice'](0x1,0x12);this['_operationToId']['set'](_0x50bc8c,_0x26fd09);}return this['_operationToId']['get'](_0x50bc8c);}}}['setIdForTheLastOperation'](_0x10fa16,_0x64b05f){if(!_0x64b05f)return;let _0x3670cb=_0x10fa16['length'];for(;_0x3670cb--;){const _0x2c1497=_0x10fa16[_0x3670cb];this['_ignoredOperations']['has'](_0x2c1497)||this['_operationToId']['set'](_0x2c1497,_0x64b05f);}}}class a extends _0x1e5d58{static get['requires'](){return[l];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class s extends _0x4067ea{static ['CommentsService']=/* #__PURE__ -- @preserve */
|
|
26
|
+
((()=>_0x5409e7)());['_services'];static get['requires'](){return[n,'CommentsRepository',i,_0x52815c];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x5efc17){super(_0x5efc17),this['_services']=new Map();}async['init'](){const _0x196f17=this['context'],_0x6988ab=_0x196f17['plugins']['get']('CommentsRepository');if(_0x196f17['plugins']['get'](n)['addToReconnectionStack'](this),_0x6988ab['adapter']={'addCommentThread':async({channelId:_0x4a3f28,threadId:_0x30f9f3,comments:_0x12d9a9,resolvedAt:_0x63e635,resolvedBy:_0x295988,context:_0x1d4ea0,attributes:_0x5e8fd7})=>{const _0x248a98=await this['_getService'](_0x4a3f28)['addCommentThread']({'commentThreadId':_0x30f9f3,'comments':_0x12d9a9['map'](_0x5de561=>function(_0x356425,_0x3e31a3,_0x144e7a){return{'commentThreadId':_0x144e7a,'commentId':_0x356425['commentId'],'userId':_0x356425['authorId'],'content':_0x356425['content'],'documentId':_0x3e31a3,'createdAt':_0x356425['createdAt'],'attributes':_0x356425['attributes']||{}};}(_0x5de561,_0x4a3f28,_0x30f9f3)),'resolvedAt':_0x63e635,'resolvedBy':_0x295988,'context':_0x1d4ea0,'attributes':_0x5e8fd7})['catch'](lt);return{'threadId':_0x248a98['commentThreadId'],'comments':_0x248a98['comments']};},'getCommentThread':async({channelId:_0x581aa9,threadId:_0x1820d0})=>{const _0xa8b227=await this['_getService'](_0x581aa9)['getCommentThread'](_0x1820d0)['catch'](tt)['catch'](lt);return _0xa8b227?_0xa8b227['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0xa8b227]),{'threadId':_0xa8b227['commentThreadId'],'comments':_0xa8b227['comments']['map'](ot),'context':_0xa8b227['context'],'resolvedAt':_0xa8b227['resolvedAt'],'resolvedBy':_0xa8b227['resolvedBy'],'attributes':_0xa8b227['attributes']||{}}):null;},'updateCommentThread':async({channelId:_0x3febb9,threadId:_0x16aff4,context:_0xc85c56,unlinkedAt:_0x40ed56,attributes:_0x5ac4b7})=>this['_getService'](_0x3febb9)['updateCommentThread']({'commentThreadId':_0x16aff4,'context':_0xc85c56,'attributes':_0x5ac4b7,'unlinkedAt':_0x40ed56})['catch'](tt)['catch'](lt),'resolveCommentThread':async({channelId:_0x5caa6a,threadId:_0xc08e45})=>{const _0x1a45df=await this['_getService'](_0x5caa6a)['resolveCommentThread'](_0xc08e45)['catch'](tt)['catch'](lt);return{'threadId':_0x1a45df['commentThreadId'],'resolvedAt':_0x1a45df['resolvedAt'],'resolvedBy':_0x1a45df['resolvedBy']};},'reopenCommentThread':async({channelId:_0x58c831,threadId:_0x2d762a})=>this['_getService'](_0x58c831)['reopenCommentThread'](_0x2d762a)['catch'](tt)['catch'](lt),'removeCommentThread':({channelId:_0x1a8e10,threadId:_0x396bcf})=>this['_getService'](_0x1a8e10)['removeCommentThread'](_0x396bcf)['catch'](tt)['catch'](lt),'addComment':({channelId:_0x5a5717,threadId:_0x4e8e55,commentId:_0x2e6817,content:_0x2739d1,attributes:_0x366541})=>this['_getService'](_0x5a5717)['addComment'](_0x4e8e55,_0x2e6817,_0x2739d1,_0x366541)['catch'](lt),'updateComment':({channelId:_0x20147a,threadId:_0x4d0917,commentId:_0x3ab782,content:_0x1cacd6,attributes:_0x33c74b})=>this['_getService'](_0x20147a)['updateComment'](_0x4d0917,_0x3ab782,_0x1cacd6,_0x33c74b)['catch'](tt)['catch'](lt),'removeComment':({channelId:_0x11d95f,threadId:_0x533ee5,commentId:_0x31a60e})=>this['_getService'](_0x11d95f)['removeComment'](_0x533ee5,_0x31a60e)['catch'](tt)['catch'](lt)},_0x196f17 instanceof _0x2e2ce6){const _0x1f8ec9=_0x196f17['config']['get']('collaboration.channelId'),_0x24d243=_0x196f17['plugins']['get'](i);await this['_setUpService'](_0x1f8ec9);const _0x139f19=await this['_services']['get'](_0x1f8ec9)['getConnectedSessions']();this['listenTo'](_0x24d243,'sessionAdd:'+_0x1f8ec9,(_0x3e09ab,{session:_0x951c83})=>{_0x951c83['id']===_0x24d243['mySessionId']&&(_0x3e09ab['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x951c83['permissions'],_0x1f8ec9));}),_0x24d243['register'](_0x1f8ec9,_0x139f19);}}async['_setUpService'](_0x28d1dd){if(this['_services']['has'](_0x28d1dd))throw new _0x3a9443('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0x28d1dd});const _0x59eb88=this['context']['plugins']['get']('CommentsRepository'),_0x35856a=new s['CommentsService'](_0x28d1dd);this['_services']['set'](_0x28d1dd,_0x35856a),this['listenTo'](_0x35856a,'commentThreadAdded',(_0x1a0ca0,_0x1a4e27)=>{const {commentThreadId:_0x5b252e,documentId:_0x254a88,context:_0x3e49cc,attributes:_0x5bf64c,resolvedAt:_0x4f03c7,resolvedBy:_0x4cedb1,comments:_0x38d408}=_0x1a4e27;_0x59eb88['getCommentThread'](_0x5b252e)||_0x59eb88['addCommentThread']({'threadId':_0x5b252e,'channelId':_0x254a88,'comments':_0x38d408?_0x38d408['map'](ot):[],'context':_0x3e49cc,'attributes':_0x5bf64c,'resolvedAt':_0x4f03c7,'resolvedBy':_0x4cedb1,'isFromAdapter':!0x0});}),this['listenTo'](_0x35856a,'commentThreadUpdated',(_0x3b758e,{commentThreadId:_0x23b51b,documentId:_0x33ef7a,context:_0x480422,unlinkedAt:_0x49dbab,attributes:_0xa8f5aa})=>{_0x59eb88['getCommentThread'](_0x23b51b)&&_0x59eb88['updateCommentThread']({'threadId':_0x23b51b,'channelId':_0x33ef7a,'context':_0x480422,'unlinkedAt':_0x49dbab,'attributes':_0xa8f5aa,'isFromAdapter':!0x0});}),this['listenTo'](_0x35856a,'commentThreadResolved',(_0x23880d,{commentThreadId:_0x4d2d15,resolvedBy:_0x436991,resolvedAt:_0x2e5178})=>{const _0x1eaede=_0x59eb88['getCommentThread'](_0x4d2d15);_0x1eaede&&_0x1eaede['resolve']({'resolvedBy':_0x436991,'resolvedAt':_0x2e5178,'isFromAdapter':!0x0});}),this['listenTo'](_0x35856a,'commentThreadReopened',(_0x10ffe3,{commentThreadId:_0x124679})=>{const _0x2680c9=_0x59eb88['getCommentThread'](_0x124679);_0x2680c9&&_0x2680c9['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0x35856a,'commentThreadRemoved',(_0x214211,{commentThreadId:_0x171dff})=>{const _0x140cf7=_0x59eb88['getCommentThread'](_0x171dff);_0x140cf7&&_0x140cf7['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0x35856a,'commentAdded',(_0x5c3f34,_0x1c6573)=>{const _0x3cda74=_0x1c6573['commentThreadId'],_0x23c4bb=_0x59eb88['getCommentThread'](_0x3cda74);_0x23c4bb&&_0x23c4bb['addComment']({...ot(_0x1c6573),'isFromAdapter':!0x0});}),this['listenTo'](_0x35856a,'commentUpdated',(_0x14c774,{commentThreadId:_0x42105a,commentId:_0x172cbf,content:_0x32931d,attributes:_0x21b050})=>{const _0x3fdac8=_0x59eb88['getCommentThread'](_0x42105a);if(_0x3fdac8){const _0x1e267f=_0x3fdac8['getComment'](_0x172cbf);_0x1e267f&&_0x1e267f['update']({'content':_0x32931d,'attributes':_0x21b050,'isFromAdapter':!0x0});}}),this['listenTo'](_0x35856a,'commentRemoved',(_0x2c10c6,{commentThreadId:_0x120e84,commentId:_0x419694})=>{const _0x514295=_0x59eb88['getCommentThread'](_0x120e84);if(_0x514295){const _0x73250a=_0x514295['getComment'](_0x419694);_0x73250a&&_0x73250a['remove']({'isFromAdapter':!0x0});}}),await this['_connectService'](_0x28d1dd);}['destroy'](){if(this['context']instanceof _0x2e2ce6){const _0x492096=this['context']['config']['get']('collaboration.channelId');this['_terminateService'](_0x492096);}}['_terminateService'](_0x35faac){if(!this['_services']['has'](_0x35faac))throw new _0x3a9443('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0x35faac});this['_getService'](_0x35faac)['disconnect'](),this['_services']['delete'](_0x35faac);}async['reconnect'](){for(const _0x381093 of this['_services']['keys']())await this['_connectService'](_0x381093);if(this['context']instanceof _0x2e2ce6){const _0x4a25d0=this['context']['config']['get']('collaboration.channelId'),_0x5823c5=this['context']['plugins']['get'](i);_0x5823c5['unregister'](_0x4a25d0);const _0x403a05=await this['_services']['get'](_0x4a25d0)['getConnectedSessions']();_0x5823c5['register'](_0x4a25d0,_0x403a05);}}async['_connectService'](_0x2337c1){const {connection:_0x2eeec3}=this['context']['plugins']['get'](n),_0x289301=this['context']['plugins']['get']('CommentsRepository'),_0x467be9=this['_services']['get'](_0x2337c1),_0x2d5d7c=await _0x467be9['connect'](_0x2eeec3);await this['_fetchMissingUsersForThreads'](_0x2d5d7c);const _0x422d83=new Set(Array['from'](_0x289301['getCommentThreads']({'channelId':_0x2337c1}),_0x141600=>_0x141600['id']));for(const _0x453ca5 of _0x2d5d7c)_0x453ca5['deletedAt']||_0x422d83['delete'](_0x453ca5['commentThreadId']);for(const _0x38ebb6 of _0x422d83)_0x289301['getCommentThread'](_0x38ebb6)['remove']({'isFromAdapter':!0x0});for(const _0x1b47f9 of _0x2d5d7c){let _0x4dddd1=_0x289301['getCommentThread'](_0x1b47f9['commentThreadId']);const {commentThreadId:_0x59d9d8,context:_0x125493,attributes:_0x278300,resolvedBy:_0x4f5dce,resolvedAt:_0x16df85,unlinkedAt:_0x19d5d2,deletedAt:_0x2e5e39}=_0x1b47f9;if(_0x2e5e39)continue;_0x4dddd1||(_0x4dddd1=_0x289301['addCommentThread']({'channelId':_0x2337c1,'threadId':_0x59d9d8,'context':_0x125493,'attributes':_0x278300||{},'resolvedBy':_0x4f5dce,'resolvedAt':_0x16df85,'unlinkedAt':_0x19d5d2,'isFromAdapter':!0x0}));const _0x1c498a=new Set(Array['from'](_0x4dddd1['comments'],_0x21370b=>_0x21370b['id']));for(const _0x220e92 of _0x1b47f9['comments'])_0x1c498a['delete'](_0x220e92['commentId']);for(const _0x3263e2 of _0x1c498a)_0x4dddd1['getComment'](_0x3263e2)['remove']({'isFromAdapter':!0x0});for(const _0xb97983 of _0x1b47f9['comments']){const _0x394726=_0x4dddd1['getComment'](_0xb97983['commentId']);_0x394726?_0x394726['content']!==_0xb97983['content']&&_0x394726['update']({'content':_0xb97983['content'],'isFromAdapter':!0x0}):_0x4dddd1['addComment'](Object['assign'](ot(_0xb97983),{'isFromAdapter':!0x0}));}}}['_getService'](_0xafcb2c){if(!this['_services']['has'](_0xafcb2c))throw new _0x3a9443('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0xafcb2c});return this['_services']['get'](_0xafcb2c);}async['_fetchMissingUsersForThreads'](_0x4439da){const _0x4d8a3f=this['context']['plugins']['get'](_0x52815c),{connection:_0x29a421}=this['context']['plugins']['get'](n),_0x5dcb3e=new Set();for(const {resolvedBy:_0x1bb9b1,comments:_0x121a56}of _0x4439da){_0x1bb9b1&&!_0x4d8a3f['getUser'](_0x1bb9b1)&&_0x5dcb3e['add'](_0x1bb9b1);for(const {userId:_0x436b9a}of _0x121a56)_0x4d8a3f['getUser'](_0x436b9a)||_0x5dcb3e['add'](_0x436b9a);}if(0x0===_0x5dcb3e['size'])return;const _0x563325=await ht['getMany'](_0x29a421,Array['from'](_0x5dcb3e));for(const _0x51d19f of _0x563325)_0x4d8a3f['getUser'](_0x51d19f['id'])||_0x4d8a3f['addUser'](_0x51d19f);}}async function tt(_0x27aabb){if('404'!==_0x27aabb['code'])throw _0x27aabb;}function lt(_0x46aad4){if((_0x5eba66=_0x46aad4)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0x5eba66['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x5eba66['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0x5eba66;throw _0x46aad4;}function ot(_0x1fcb29){return{'threadId':_0x1fcb29['commentThreadId'],'commentId':_0x1fcb29['commentId'],'content':_0x1fcb29['content'],'createdAt':_0x1fcb29['createdAt'],'authorId':_0x1fcb29['userId'],'attributes':_0x1fcb29['attributes']||{}};}class m extends _0x1e5d58{static ['TrackChangesService']=/* #__PURE__ -- @preserve */
|
|
27
|
+
((()=>it)());['_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(_0x3c0af8){super(_0x3c0af8);const _0x28119e=this['editor']['config']['get']('collaboration.channelId');this['_bufferedRequests']=new Map(),this['_trackChangesService']=new m['TrackChangesService'](_0x28119e);}['init'](){const _0xa6a855=this['editor']['plugins']['get'](n),_0x13d327=this['editor']['plugins']['get']('TrackChangesEditing');return _0x13d327['adapter']={'getSuggestion':async _0x10ecd5=>{await this['_waitForServiceReady']();const _0x391c5f=await this['_trackChangesService']['get'](_0x10ecd5)['catch'](et);return await this['_fetchMissingUsersForThreads']([_0x391c5f]),_0x391c5f;},'addSuggestion':async({id:_0x4724a8,type:_0x213340,data:_0xae4b2d,originalSuggestionId:_0x48501d,attributes:_0x30ef1d})=>{await this['_waitForServiceReady']();const _0x308a68={'id':_0x4724a8,'type':_0x213340,'data':_0xae4b2d,'originalSuggestionId':_0x48501d,'attributes':_0x30ef1d},_0x5ed5ca=await this['_trackChangesService']['add'](_0x4724a8,_0x213340,_0xae4b2d,_0x48501d,_0x30ef1d)['catch'](_0x3f1e6b=>{if(dt(_0x3f1e6b))return new Promise(_0x2875ba=>{this['_bufferedRequests']['set'](_0x4724a8,{'resolve':_0x2875ba,'suggestionData':_0x308a68});});throw _0x3f1e6b;});return this['_bufferedRequests']['delete'](_0x4724a8),_0x5ed5ca;},'updateSuggestion':async(_0xe70309,_0x136fe1)=>{if(await this['_waitForServiceReady'](),'open'!==_0x136fe1['state'])return this['_trackChangesService']['update'](_0xe70309,_0x136fe1)['catch'](et);}},this['listenTo'](this['_trackChangesService'],'suggestionUpdated',(_0x1b63f,_0x574186)=>{_0x13d327['hasSuggestion'](_0x574186['id'])&&(_0x13d327['getSuggestion'](_0x574186['id'])['attributes']=_0x574186['attributes']);}),this['_trackChangesService']['connect'](_0xa6a855['connection'])['then'](_0x5a6047=>(_0xa6a855['addToReconnectionStack'](this),this['_fetchMissingUsersForThreads'](_0x5a6047)['then'](()=>{for(const _0x3704cc of _0x5a6047){_0x13d327['addSuggestionData'](_0x3704cc)['_saved']=!0x0;}})));}async['reconnect'](){const _0x1fe348=this['editor']['plugins']['get']('TrackChangesEditing'),{connection:_0x1f49a8}=this['editor']['plugins']['get'](n),_0x5b7411=await this['_trackChangesService']['connect'](_0x1f49a8);await this['_fetchMissingUsersForThreads'](_0x5b7411);for(const {suggestionData:_0x222ad1,resolve:_0x4dcba7}of this['_bufferedRequests']['values']()){let _0x4063ac=_0x5b7411['find'](_0x219428=>_0x219428['id']===_0x222ad1['id']);_0x4063ac||(_0x4063ac=await this['_trackChangesService']['add'](_0x222ad1['id'],_0x222ad1['type'],_0x222ad1['data'],_0x222ad1['originalSuggestionId'])),_0x4dcba7(_0x4063ac);}for(const _0x3df0d7 of _0x5b7411)_0x1fe348['hasSuggestion'](_0x3df0d7['id'])||_0x1fe348['addSuggestionData'](_0x3df0d7);}async['_waitForServiceReady'](){this['_trackChangesService']['isConnected']||await new Promise(_0x20cd26=>{this['listenTo'](this['_trackChangesService'],'connected',_0x1b8f33=>{_0x1b8f33['off'](),_0x20cd26();});});}async['_fetchMissingUsersForThreads'](_0x2f2bdf){const _0x1337d6=this['editor']['plugins']['get'](_0x52815c),{connection:_0x158cc2}=this['editor']['plugins']['get'](n),_0x4e2d1f=new Set();for(const {authorId:_0x4197f8}of _0x2f2bdf)_0x1337d6['getUser'](_0x4197f8)||_0x4e2d1f['add'](_0x4197f8);if(0x0===_0x4e2d1f['size'])return;const _0xc1ef21=await ht['getMany'](_0x158cc2,Array['from'](_0x4e2d1f));for(const _0x16b050 of _0xc1ef21)_0x1337d6['getUser'](_0x16b050['id'])||_0x1337d6['addUser'](_0x16b050);}}function et(_0x414d20){if(dt(_0x414d20))return new Promise(()=>{});throw _0x414d20;}function dt(_0x2c683e){return _0x2c683e['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x2c683e['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class g extends _0x1e5d58{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 _0x5af2de=this['editor']['plugins']['get'](n),_0x25cfc8=this['editor']['plugins']['get']('CommentsEditing'),_0x11412c=this['editor']['plugins']['get'](s);return this['editor']['data']['once']('ready',()=>{this['listenTo'](_0x5af2de,'change:state',(_0x56183d,_0x649f6,_0x5ccd39)=>{_0x25cfc8['isThreadsLoadingPaused']='connected'!==_0x5ccd39;});}),this['listenTo'](_0x5af2de,'change:state',(_0x345ce9,_0x66ed41,_0x1a6939)=>{this['editor']['plugins']['get']('CommentsRepository')['switchReadOnly']('connected'!==_0x1a6939);}),_0x11412c['_setUpService'](this['editor']['config']['get']('collaboration.channelId'));}['destroy'](){this['editor']['plugins']['get'](s)['_terminateService'](this['editor']['config']['get']('collaboration.channelId')),super['destroy']();}}class RealTimeCollaborativeTrackChanges extends _0x1e5d58{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 _0x1e5d58{static ['RevisionHistoryService']=/* #__PURE__ -- @preserve */
|
|
28
|
+
((()=>_0x5df08f)());['_lastRequestId'];['_revisionTracker'];['_revisionHistoryService'];['_oldOffset'];static get['requires'](){return[n,l,'RevisionHistory',i,_0x52815c];}static get['pluginName'](){return'CloudServicesRevisionHistoryAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x41a37b){super(_0x41a37b);const _0x2af571=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new c['RevisionHistoryService'](_0x2af571);}async['init'](){const _0x5b2d41=this['editor']['plugins']['get'](l),_0xfb03e5=_0x5b2d41['serverHistory'],_0x5ef1e6=this['editor']['plugins']['get'](n);this['_revisionTracker']['setSource']({'history':_0xfb03e5,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0x5b2d41['sessionId']});const _0x1c47f7=this['editor']['config']['get']('cloudServices.bundleVersion')||nt,_0x1c5433=await _0xd9b4ec['isBundleUploaded'](_0x5ef1e6['connection'],_0x1c47f7);this['editor']['plugins']['get']('RevisionHistory')['adapter']={'getRevision':async({revisionId:_0x13833a})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0x13833a)),'updateRevisions':async _0x339036=>{await this['_waitForServiceReady']();const _0x700033=this['_revisionTracker']['currentRevision'];if(_0x1c5433&&0x1===_0x339036['length']&&_0x339036[0x0]['id']===_0x700033['id'])return _0x339036;for(const _0x2ad05f of _0x339036)_0x2ad05f['id']===_0x700033['id']&&(_0x2ad05f['isEmptyCurrent']=_0x2ad05f['fromVersion']===_0x2ad05f['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0x339036,this['_lastRequestId'])['then'](_0x512da3=>(this['_lastRequestId']=_0x512da3,_0x339036))['catch'](_0x14aab8=>{if(I(_0x14aab8)||'400'===_0x14aab8['code']&&void 0x0!==_0x14aab8['data']['wrongRequestId']){for(const _0x1bf2fd of _0x339036){!this['_revisionTracker']['repository']['getRevision'](_0x1bf2fd['id'])||this['_revisionTracker']['_bufferUpdate'](_0x1bf2fd['id'],_0x1bf2fd,!0x1);}if(I(_0x14aab8))throw _0x14aab8;return _0x339036;}throw _0x14aab8;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0x1b13d7,{revisionsData:_0x1b277f,requestId:_0x9b6fff})=>{Math['max'](..._0x1b277f['map'](_0x2290d4=>_0x2290d4['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0x1b277f,_0x9b6fff);}):this['_handleRevisionsUpdate'](_0x1b277f,_0x9b6fff);});const {revisions:_0x28a499,requestId:_0x1c16b0}=await this['_revisionHistoryService']['connect'](_0x5ef1e6['connection']);_0x5ef1e6['addToReconnectionStack'](this),this['_lastRequestId']=_0x1c16b0,await this['_fetchMissingUsers'](_0x28a499);for(const _0x539852 of _0x28a499)this['_revisionTracker']['addRevisionData'](_0x539852);this['listenTo'](_0x5b2d41,'change:_isConnected',(_0x2b4aae,_0x53384e,_0x555b07)=>{_0x555b07&&(this['_oldOffset']=_0x5b2d41['_offset'],_0x2b4aae['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](_0x5ef1e6,'state',_0x4d104f=>_0x4d104f===_0x3d1e25['CONNECTED']);}async['reconnect'](){const _0x34d9d9=this['editor']['plugins']['get'](n),_0x43d42e=this['editor']['plugins']['get'](l),_0x1052a=async()=>{const _0x534bc8=this['_revisionTracker']['currentRevision'],_0x50ba16=_0x534bc8['id'],_0x10a14a=_0x50ba16!==_0x43d42e['sessionId'];if(_0x10a14a){const _0xebc072=_0x43d42e['_offset']-this['_oldOffset'],_0x5e2b98=this['_getLatestVersionFromServerOperations']();this['_revisionTracker']['_revisionDataBuilder']['reInit']();if(_0x534bc8['toVersion']+_0xebc072!==_0x5e2b98){const _0x592926=_0x534bc8['fromVersion']+_0xebc072,_0x1305a3=this['editor']['plugins']['get'](_0x52815c),_0x4fe56a=this['_revisionTracker']['buildRevisionData']({'revision':_0x534bc8,'from':_0x592926,'to':_0x5e2b98});_0x4fe56a['id']=_0x534bc8['id'];const _0x45f1b4=_0x4fe56a['authorsIds']['map'](_0x2c289e=>_0x1305a3['getUser'](_0x2c289e));_0x534bc8['_update']({..._0x4fe56a,'authors':_0x45f1b4},!0x0),this['_revisionTracker']['_bufferUpdate'](_0x534bc8['id'],_0x4fe56a,!0x0);}this['_revisionTracker']['_startingVersion']=_0x5e2b98,(_0x534bc8['toVersion']===_0x534bc8['fromVersion']&&!this['_revisionTracker']['_bufferedUpdates']['has'](_0x50ba16)&&this['_revisionTracker']['repository']['_revisions']['remove'](_0x50ba16),this['_revisionTracker']['_createCurrentRevision'](_0x5e2b98));}const {revisions:_0x38185b,requestId:_0x35d818}=await this['_revisionHistoryService']['reconnect'](_0x34d9d9['connection'],this['_lastRequestId']);_0x10a14a&&_0x38185b['length']>0x0?_0x43d42e['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x38185b),this['_handleRevisionsUpdate'](_0x38185b,_0x35d818),this['_revisionTracker']['sendBufferedUpdates']());};return _0x43d42e['_isConnected']?_0x1052a():new Promise((_0x3bd418,_0x2465e4)=>{_0x43d42e['once']('change:_isConnected',()=>{_0x1052a()['then'](_0x3bd418)['catch'](_0x2465e4);});});}['destroy'](){super['destroy']();}async['_waitForServiceReady'](){this['_revisionHistoryService']['isConnected']||await new Promise(_0x244278=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x46ec70=>{_0x46ec70['off'](),_0x244278();});});}['_getLatestVersionFromServerOperations'](){const _0x458a82=this['editor']['plugins']['get'](l)['serverHistory']['getOperations']()['reverse']();for(const _0x295d5b of _0x458a82)if('marker'!==_0x295d5b['type']||_0x295d5b['affectsData'])return _0x295d5b['baseVersion']+0x1;}['_getLatestVersion'](){const _0x3cf938=this['editor']['plugins']['get'](l);return new Promise(_0x172d3f=>{_0x3cf938['_isPendingUpdate']?_0x3cf938['once']('change:_isPendingUpdate',()=>{_0x172d3f(this['_getLatestVersionFromServerOperations']());}):_0x172d3f(this['_getLatestVersionFromServerOperations']());});}['_handleRevisionsUpdate'](_0x15df7f,_0x407c98){const _0x57ceee=this['_revisionTracker']['repository'];this['_lastRequestId']=_0x407c98;for(const _0xeca1a5 of _0x15df7f){const _0x45cd96=_0x57ceee['getRevision'](_0xeca1a5['id']);if(_0x45cd96){if((_0xeca1a5['fromVersion']||_0xeca1a5['toVersion'])&&(_0xeca1a5['diffData']=null),_0x45cd96===this['_revisionTracker']['currentRevision']){const _0x176970=Math['max'](_0x45cd96['toVersion'],_0xeca1a5['toVersion']),_0x26d7f7=Math['max'](_0x45cd96['fromVersion'],_0xeca1a5['fromVersion']);let _0x2aa3d8;_0x45cd96['toVersion']===_0xeca1a5['toVersion']&&_0x45cd96['fromVersion']===_0xeca1a5['fromVersion']?(_0x2aa3d8=!0x0,this['_preventResendingRevisionData'](_0xeca1a5)):_0xeca1a5['toVersion']===_0x176970&&_0xeca1a5['fromVersion']===_0x26d7f7?_0x2aa3d8=!0x1:(_0x45cd96['toVersion']===_0x176970&&_0x45cd96['fromVersion']===_0x26d7f7||this['_fixRevision']({'revision':_0x45cd96,'from':_0x26d7f7,'to':_0x176970}),_0x2aa3d8=!0x0),_0x2aa3d8&&(delete _0xeca1a5['fromVersion'],delete _0xeca1a5['toVersion'],delete _0xeca1a5['diffData'],delete _0xeca1a5['createdAt'],delete _0xeca1a5['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0xeca1a5),this['_preventResendingRevisionData'](_0xeca1a5);}else this['_revisionTracker']['addRevisionData'](_0xeca1a5);}const _0xfd943f=_0x57ceee['getRevisions']();_0xfd943f['reverse']();for(let _0x21e45a=0x0;_0x21e45a<_0xfd943f['length']-0x1;_0x21e45a++){const _0x1213ca=_0xfd943f[_0x21e45a],_0xabef84=_0xfd943f[_0x21e45a+0x1];if(_0x1213ca['fromVersion']<_0xabef84['toVersion']){const _0x27fca9=_0xabef84['toVersion'],_0x29af58=Math['max'](_0x27fca9,_0x1213ca['toVersion']);this['_fixRevision']({'revision':_0x1213ca,'from':_0x27fca9,'to':_0x29af58});}}}['_fixRevision']({revision:_0x55e63b,from:_0x30bf42,to:_0x3ae3b2}={}){const _0x3be028=this['editor']['plugins']['get'](_0x52815c),_0x37cf26=this['_revisionTracker']['buildRevisionData']({'revision':_0x55e63b,'from':_0x30bf42,'to':_0x3ae3b2});_0x37cf26['authors']=_0x37cf26['authorsIds']['map'](_0x5c21a3=>_0x3be028['getUser'](_0x5c21a3)),_0x55e63b['_update'](_0x37cf26);}['_preventResendingRevisionData'](_0x499208){const _0xe251ef={};_0xe251ef['id']=_0x499208['id'];for(const _0x21d29a of Object['keys'](_0x499208))'id'!==_0x21d29a&&(_0xe251ef[_0x21d29a]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0xe251ef['id'],_0xe251ef,!0x0);}async['_fetchMissingUsers'](_0x192472){const _0x4479e7=this['editor']['plugins']['get'](_0x52815c),{connection:_0x3a9f1a}=this['editor']['plugins']['get'](n),_0x50b418=new Set();for(const _0x24b901 of _0x192472){for(const _0x3171b5 of _0x24b901['authorsIds'])_0x1ca72a(_0x3171b5);_0x24b901['creatorId']&&_0x1ca72a(_0x24b901['creatorId']);}if(0x0===_0x50b418['size'])return;const _0x21df72=await ht['getMany'](_0x3a9f1a,Array['from'](_0x50b418));for(const _0x20e008 of _0x21df72)_0x4479e7['getUser'](_0x20e008['id'])||_0x4479e7['addUser'](_0x20e008);function _0x1ca72a(_0x39c5d2){_0x4479e7['getUser'](_0x39c5d2)||_0x50b418['add'](_0x39c5d2);}}}function I(_0x655675){return _0x655675['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0x655675['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x655675['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class RealTimeCollaborativeRevisionHistory extends _0x1e5d58{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 _0x4bb216{['_collapseAt'];constructor(_0x3921b0,_0x2150dd=0x6){super(_0x3921b0);const _0x5ee958=this['bindTemplate'];this['set']('isHidden',!0x0),this['set']('usersCount',0x0),this['_collapseAt']=_0x2150dd,this['bind']('isHidden')['to'](this,'usersCount',_0xb39fc3=>_0xb39fc3<_0x2150dd),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item',_0x5ee958['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':_0x5ee958['to']('usersCount',_0x5dc172=>'+'+(_0x5dc172-this['_collapseAt']+0x2)['toString']())}]}]}]});}}class is extends _0x4bb216{['items'];['keystrokes'];constructor(_0x10006c){super(_0x10006c);const _0x5be2e1=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0x745df6(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0x5be2e1['if']('hasPopup'),'aria-expanded':_0x5be2e1['to']('isExpanded',_0x4a77b8=>this['hasPopup']&&String(_0x4a77b8)),'aria-label':_0x5be2e1['to']('hasPopup',_0x324a5b=>V(_0x10006c,_0x324a5b?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0x5be2e1['to']('hasPopup',_0x585ec2=>!!_0x585ec2&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items'],'on':{'mouseenter':_0x5be2e1['to'](()=>this['fire']('presencelist:show')),'mouseleave':_0x5be2e1['to'](_0x3dd659=>{const _0x244ac0=_0x3dd659,_0x11d293=document['querySelector']('.ck-presence-list__dropdown-list'),_0x344182=document['querySelector']('.ck-balloon-panel_with-arrow');_0x11d293?.['contains'](_0x244ac0['relatedTarget'])||_0x344182?.['contains'](_0x244ac0['relatedTarget'])||this['fire']('presencelist:hide');})}}),this['on']('change:hasPopup',(_0x291064,_0xaa83b0,_0x3a4bdc)=>{this['element']&&(_0x3a4bdc?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 _0x4bb216{['counterView'];['inlineListView'];constructor(_0x14dc85,_0x1b440c=0x6){super(_0x14dc85);const _0x3357e9=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new b(this['locale'],_0x1b440c),this['inlineListView']=new is(_0x14dc85),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x4fd228 of this['inlineListView']['items'])_0x4fd228['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',_0x3357e9['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['inlineListView']]});}}class L extends _0x4bb216{['listWrapperView'];constructor(_0x3799e1,_0x3af22c){super(_0x3799e1);const _0x34e1c7=this['bindTemplate'];this['listWrapperView']=new PresenceDropdownListWrapperView(_0x3799e1,_0x3af22c),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':V(_0x3799e1,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']],'on':{'mouseleave':_0x34e1c7['to'](_0x1fe0eb=>{const _0x4ac30f=_0x1fe0eb,_0x549de7=document['querySelector']('.ck-presence-list__list'),_0x4e457f=document['querySelector']('.ck-balloon-panel_with-arrow');_0x549de7?.['contains'](_0x4ac30f['relatedTarget'])||_0x4e457f?.['contains'](_0x4ac30f['relatedTarget'])||this['fire']('presencelist:hide');})}});}}class PresenceDropdownListWrapperView extends _0x3e031c{constructor(_0x2f343d,_0x713886){super(_0x2f343d);const _0x1a54b7=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0x713886?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0x1a54b7['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0x1a54b7['to']('role'),'aria-label':_0x1a54b7['to']('ariaLabel'),'aria-labelledby':_0x1a54b7['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0x19a405['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0xe202d8=this['element'];_0xe202d8&&(this['_isScrollable']=Math['max'](_0xe202d8['scrollHeight'],_0xe202d8['clientHeight'])>0.8*window['innerHeight']);}}class j extends st{['userView'];constructor(_0xfef18e,_0x25e8bd,_0x5220b3){super(_0xfef18e);const _0x3e4f1a=this['bindTemplate'];this['userView']=new rt(_0xfef18e,_0x25e8bd);const _0x29fcdc={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0x25e8bd['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0x25e8bd['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x25e8bd['color']['getBackgroundColorClass']()],'aria-hidden':'true'}}]};_0x5220b3&&(_0x29fcdc['tag']='button',_0x29fcdc['on']={'click':_0x3e4f1a['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x29fcdc);}['focus'](){this['element']['focus']();}}class A extends _0x4bb216{['userView'];['markerView'];constructor(_0x5e8dcc,_0x298255,_0x5a54ef){super(_0x5e8dcc);const _0x509eed=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new rt(_0x5e8dcc,_0x298255),this['markerView']=new MarkerView(_0x5e8dcc,_0x298255);const _0x2094e2=new at(_0x5e8dcc);_0x2094e2['template']['tag']='span',_0x2094e2['text']=_0x298255['name'];const _0x2ba590={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0x509eed['to']('isFocusable',_0x5ecb35=>!!_0x5ecb35&&0x0),'aria-labelledby':_0x2094e2['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0x509eed['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0x509eed['to']('hasTooltip',_0x54bd92=>!_0x54bd92),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0x2094e2]};_0x5a54ef&&(_0x2ba590['tag']='button',_0x2ba590['on']={'click':_0x509eed['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x2ba590);}}class MarkerView extends _0x4bb216{constructor(_0x107ea1,_0x1460ee){super(_0x107ea1),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x1460ee['color']['getBackgroundColorClass']()],'aria-hidden':'true'}});}}const x={'collapseAt':0x6,'displayMe':!0x0};class r extends _0x4067ea{['currentDisplayedUsers'];['balloonPanelView'];['view'];['presenceDropdownView'];['_bodyCollection']=null;static get['pluginName'](){return'PresenceListUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x4f7afa){super(_0x4f7afa),this['context']['config']['define']('presenceList',x);const _0x57ab9c=_0x4f7afa['config']['get']('presenceList.collapseAt');if('number'!=typeof _0x57ab9c)throw new _0x3a9443('presencelist-collapseat-invalid-format',this);if(_0x57ab9c<0x1)throw new _0x3a9443('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](i)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0x36276b(),this['balloonPanelView']=new _0x2a3eb9(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get['requires'](){return[i];}['init'](){for(const _0x51f50c of this['_allConnectedUsers'])this['_handleUserAdd'](_0x51f50c);this['listenTo'](this['_allConnectedUsers'],'add',(_0x12230a,_0x3ba06c)=>{this['_handleUserAdd'](_0x3ba06c);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0x573364,_0x15591c)=>{this['_handleUserRemove'](_0x15591c);});}['_createView'](){const _0x55d8da=this['context'],_0x3c9571=new v(this['context']['locale'],this['context']['config']['get']('presenceList.collapseAt')),_0x4cc98e=this['balloonPanelView'];if(!_0x15409c(_0x55d8da['config']['get']('presenceList.container')))throw new _0x3a9443('presencelist-missing-container',this);return _0x3c9571['counterView']['bind']('usersCount')['to'](this),_0x3c9571['bind']('isCollapsed')['to'](this,'usersCount',_0x40521f=>{const {collapseAt:_0x10df78}=_0x55d8da['config']['get']('presenceList'),_0x108697=_0x40521f>=_0x10df78;if(_0x108697&&!_0x3c9571['inlineListView']['items']['find'](_0x19dccb=>_0x19dccb instanceof b)){const _0x36d047=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['currentDisplayedUsers']['length']==_0x36d047&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](this['currentDisplayedUsers']['length']-0x1),_0x3c9571['inlineListView']['items']['add'](_0x3c9571['counterView']);}return _0x108697||this['hideDropdown'](),_0x108697;}),_0x3c9571['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0x31e043=>{const _0x59a278=_0x55d8da['config']['get']('presenceList'),_0x56fdc5=new A(_0x55d8da['locale'],_0x31e043,!!_0x59a278['onClick']);return _0x56fdc5['bind']('hasTooltip')['to'](_0x3c9571,'isCollapsed',_0x5965f8=>!_0x5965f8),_0x56fdc5['bind']('isFocusable')['to'](_0x3c9571,'isCollapsed',_0x2ccf46=>!_0x2ccf46),_0x59a278['onClick']&&this['listenTo'](_0x56fdc5,'execute',()=>{this['view']['isCollapsed']||_0x59a278['onClick'](_0x31e043,_0x56fdc5['element']);}),_0x56fdc5;}),this['listenTo'](_0x3c9571['inlineListView'],'presencelist:show',()=>{this['view']['isCollapsed']&&this['showDropdown']();}),this['listenTo'](_0x3c9571['inlineListView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();}),_0x3c9571['inlineListView']['keystrokes']['set']('Enter',(_0x1a3788,_0x994ec9)=>{this['view']['isCollapsed']&&(this['showDropdown'](),_0x994ec9());}),_0x3c9571['render'](),_0x4cc98e['render'](),_0x56d96c({'emitter':_0x3c9571,'activator':()=>_0x4cc98e['isVisible'],'contextElements':[_0x4cc98e['element'],_0x3c9571['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0x55d8da['config']['get']('presenceList.container')['appendChild'](_0x3c9571['element']),this['_bodyCollection']=new _0x20e53c(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_bodyCollection']['add'](this['balloonPanelView']),_0x3c9571;}['_handleUserAdd'](_0x2df788){if(!this['context']['config']['get']('presenceList.displayMe')&&_0x2df788['isMe'])return;const _0x22ebae=this['context']['config']['get']('presenceList.collapseAt')-0x1;for(this['usersCount']++;this['currentDisplayedUsers']['length']>=_0x22ebae-(this['view']['isCollapsed']?0x1:0x0)&&this['currentDisplayedUsers']['length']>0x1;)this['currentDisplayedUsers']['remove'](0x1);const _0x941984=_0x2df788['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0x2df788,_0x941984);}['_handleUserRemove'](_0x51a8da){this['usersCount']--;const {collapseAt:_0x2d431c}=this['context']['config']['get']('presenceList'),_0x306308=this['usersCount']>=_0x2d431c;if(this['currentDisplayedUsers']['get'](_0x51a8da['id']))this['currentDisplayedUsers']['remove'](_0x51a8da['id']);else{if(_0x306308&&this['currentDisplayedUsers']['length']+0x1===_0x2d431c-0x1)return;}if(this['currentDisplayedUsers']['length']+(_0x306308?0x1:0x0)<this['usersCount']){for(const _0x4cb044 of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0x4cb044['id'])&&(this['currentDisplayedUsers']['add'](_0x4cb044,Math['min'](this['currentDisplayedUsers']['length']-(_0x306308?0x1:0x0),0x1)),this['currentDisplayedUsers']['length']+(_0x306308?0x1:0x0)===_0x2d431c-0x1))return;}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0x3afe1a=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new L(this['context']['locale'],!!_0x3afe1a['onClick']),this['view']['inlineListView']['isExpanded']=!0x0,this['listenTo'](this['presenceDropdownView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();});const {listWrapperView:_0x36d716}=this['presenceDropdownView'];_0x36d716['items']['bindTo'](this['_allConnectedUsers'])['using'](_0x5a8a81=>{if(!_0x3afe1a['displayMe']&&_0x5a8a81['isMe'])return null;const _0x523236=new j(this['context']['locale'],_0x5a8a81,!!_0x3afe1a['onClick']);return _0x3afe1a['onClick']&&this['listenTo'](_0x523236,'execute',()=>{_0x3afe1a['onClick'](_0x5a8a81,_0x523236['element']);}),_0x523236;}),this['balloonPanelView']['content']['add'](this['presenceDropdownView']),this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element']}),_0x36d716['focus'](),_0x36d716['checkIfScrollable']();const _0x258a54=(_0x20b710,_0x2383d7)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0x2383d7();};_0x36d716['keystrokes']['set']('Esc',_0x258a54),_0x36d716['keystrokes']['set']('Shift+Tab',_0x258a54),_0x36d716['keystrokes']['set']('Tab',(_0x39893c,_0x198265)=>{!function(_0x1902f2){const _0xce2e23=['a','button','input','select','textarea','[tabindex]','[contenteditable]']['map'](_0xc1add8=>_0xc1add8+':not([disabled]):not([tabindex=\x22-1\x22])')['join'](','),_0xf1cf59=[...document['body']['querySelectorAll'](_0xce2e23)]['filter'](_0x3b2eb6=>_0x3b2eb6===document['activeElement']||_0x3b2eb6['offsetWidth']+_0x3b2eb6['offsetHeight']>0x0)['sort']((_0x32b23c,_0x178b47)=>(_0x32b23c['tabIndex']||0x0)-(_0x178b47['tabIndex']||0x0)),_0x3b85c4=_0xf1cf59['indexOf'](_0x1902f2),_0x57c773=_0xf1cf59[(_0x3b85c4+0x1)%_0xf1cf59['length']];_0x57c773&&_0x57c773['focus']();}(this['view']['element']),this['hideDropdown'](),_0x198265();}),_0x36d716['focusTracker']['add'](this['view']['element']),_0x36d716['focusTracker']['on']('change:isFocused',(_0x42122e,_0x1e087b,_0x4b0cd7)=>{_0x4b0cd7||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 PresenceList extends _0x4067ea{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,PresenceList,r as PresenceListUI,l as RealTimeCollaborationClient,g as RealTimeCollaborativeComments,a as RealTimeCollaborativeEditing,RealTimeCollaborativeRevisionHistory,RealTimeCollaborativeTrackChanges,i as Sessions,n as WebSocketGateway};
|