@ckeditor/ckeditor5-real-time-collaboration 43.2.0-alpha.0 → 43.2.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/real-time-collaboration.js +1 -1
- package/dist/index.js +6 -6
- package/package.json +9 -9
- package/src/presencelist/presencelistui.js +1 -1
- package/src/presencelist/view/presencecounterview.js +1 -1
- package/src/presencelist/view/presencedropdownlistitemview.js +1 -1
- package/src/presencelist/view/presencedropdownlistview.js +1 -1
- package/src/presencelist/view/presenceinlinelistitemview.js +1 -1
- package/src/presencelist/view/presenceinlinelistview.js +1 -1
- package/src/presencelist/view/presencelistview.js +1 -1
- package/src/realtimecollaborativecomments/cloudservicescommentsadapter.js +1 -1
- package/src/realtimecollaborativeediting/realtimecollaborationclient.js +1 -1
- package/src/realtimecollaborativeediting/sessions.js +1 -1
- package/src/realtimecollaborativeediting/usermarkers.js +1 -1
- package/src/realtimecollaborativeediting/websocketgateway.js +1 -1
- package/src/realtimecollaborativerevisionhistory/cloudservicesrevisionhistoryadapter.js +1 -1
- package/src/realtimecollaborativetrackchanges/cloudservicestrackchangesadapter.js +1 -1
package/dist/index.js
CHANGED
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
import{ContextPlugin as
|
|
24
|
-
((()=>dt)());static ['initialReconnectionInterval']=0x3e8;['connection'];['_reconnectionStack'];['_shouldPluginsReconnect'];['_domEmitter'];static get['requires'](){return['CloudServices',_0x1d8524];}static get['pluginName'](){return'WebSocketGateway';}constructor(_0x28d6c9){super(_0x28d6c9),this['set']('state',_0x128058['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=Object['create'](_0x194205);}['init'](){const _0xf88d71=this['context'],_0x41d832=_0xf88d71['plugins']['get']('CloudServices'),_0x2055fb=_0xf88d71['plugins']['get'](_0x1d8524);if(!_0x41d832['token'])throw new _0x43ccf9('websocketgateway-missing-token',this);if(!_0x41d832['webSocketUrl'])throw new _0x43ccf9('websocketgateway-missing-websocket-url',this);return this['_domEmitter']['listenTo'](window,'offline',()=>this['_isBrowserOffline']=!0x0),this['_domEmitter']['listenTo'](window,'online',()=>this['_isBrowserOffline']=!0x1),this['context']['config']['define']('cloudServices.connectionTimeout',0xa),this['context']['config']['define']('cloudServices.requestTimeout',0x14),c['WebSocketGateway']['connect'](_0x41d832['token'],_0x41d832['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0x277c66=>{if(this['connection']=_0x277c66,this['bind']('state')['to'](_0x277c66,'state',this,'_isBrowserOffline',(_0x5678a9,_0x4c652e)=>('connected'!==_0x5678a9&&(this['_shouldPluginsReconnect']=!0x0),_0x4c652e||_0x5678a9!==_0x128058['CONNECTED']?_0x128058['DISCONNECTED']:this['state']==_0x128058['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),_0x128058['CONNECTING']):_0x128058['CONNECTED'])),this['connection']['on']('error',(_0xdd03ed,_0x5cac66)=>{if('limitExceeded'!==_0x5cac66['code'])throw console['error'](_0x5cac66),new _0x43ccf9('cloudservices-init',null,{'originalError':_0x5cac66});_0x2055fb['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'});}),!_0x277c66['me'])return new Promise(_0xbd745c=>_0x277c66['on']('change:me',_0xbd745c));})['catch'](_0x4e4b2c=>{throw console['error'](_0x4e4b2c),new _0x43ccf9('cloudservices-init',null,{'originalError':_0x4e4b2c});});}['addToReconnectionStack'](_0x349112){if('function'!=typeof _0x349112['reconnect'])throw new _0x43ccf9('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0x349112))throw new _0x43ccf9('websocketgateway-plugin-already-registered',this,{'name':_0x349112['constructor']['pluginName']});this['_reconnectionStack']['add'](_0x349112);}['removeFromReconnectionStack'](_0xe0dbbb){this['_reconnectionStack']['delete'](_0xe0dbbb);}['isInReconnectionStack'](_0x57884a){return this['_reconnectionStack']['has'](_0x57884a);}['_reconnect'](){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0x19d9c0=>_0x19d9c0['reconnect']())))['then'](()=>this['state']=_0x128058['CONNECTED'])['catch'](_0xade1a4=>{throw console['error'](_0xade1a4),new _0x43ccf9('cloudservices-reconnection-error',this['context']);});}['destroy'](){this['connection']&&this['connection']['disconnect'](),this['state']=_0x128058['DISCONNECTED'],this['_domEmitter']['stopListening'](),super['destroy']();}}class r extends _0x59636b{['channelSessions'];['channelConnectedUsers'];['allConnectedUsers'];['_registeredSessions'];['_uniqueUsersCount'];['_users'];static get['pluginName'](){return'Sessions';}static get['requires'](){return[c,_0x28f53f];}constructor(_0x1086b4){super(_0x1086b4),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0x5f4219(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x28f53f);}['init'](){const _0xf7574f=this['context']['plugins']['get'](c);this['listenTo'](_0xf7574f,'change:state',(_0x4533d3,_0x352a52,_0x1d124c)=>{if('connected'!==_0x1d124c)this['channelSessions']['forEach'](_0x53ff79=>_0x53ff79['clear']()),this['channelConnectedUsers']['forEach'](_0x35ff54=>_0x35ff54['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x18ccea,_0x594755]of this['_registeredSessions'])for(const _0x340c27 of _0x594755)this['_handleSessionAdd'](_0x18ccea,_0x340c27);}}),this['_createUser'](_0xf7574f['connection']['me'],!0x0);}['register'](_0x124675,_0x201830){if(this['_registeredSessions']['has'](_0x124675))throw new _0x43ccf9('sessions-register-already-registered',null,{'channelId':_0x124675});this['_registeredSessions']['set'](_0x124675,_0x201830),this['channelSessions']['set'](_0x124675,new _0x5f4219()),this['channelConnectedUsers']['set'](_0x124675,new _0x5f4219()),this['listenTo'](_0x201830,'add',(_0x51990a,_0x3d997e)=>this['_handleSessionAdd'](_0x124675,_0x3d997e)),this['listenTo'](_0x201830,'remove',(_0x54d550,_0x4cbb90)=>this['_handleSessionRemove'](_0x124675,_0x4cbb90));for(const _0x39ee5e of _0x201830)this['_handleSessionAdd'](_0x124675,_0x39ee5e);}['unregister'](_0x92dbf5){if(!this['_registeredSessions']['has'](_0x92dbf5))throw new _0x43ccf9('sessions-unregister-not-exist',null,{'channelId':_0x92dbf5});const _0x416e17=this['_registeredSessions']['get'](_0x92dbf5);this['stopListening'](_0x416e17);for(const _0x301dd6 of _0x416e17)'connected'===this['context']['plugins']['get'](c)['state']&&this['_handleSessionRemove'](_0x92dbf5,_0x301dd6);this['_registeredSessions']['delete'](_0x92dbf5),this['channelSessions']['delete'](_0x92dbf5),this['channelConnectedUsers']['delete'](_0x92dbf5);}get['mySessionId'](){return this['context']['plugins']['get'](c)['connection']['sessionId'];}['getUserBySessionId'](_0x37a5cb){for(const _0x3122e1 of this['channelSessions']['values']())for(const _0x48c7e2 of _0x3122e1)if(_0x48c7e2['id']===_0x37a5cb)return _0x48c7e2['user'];}['getUserSessions'](_0x5045db,_0x379281){const _0x41e5cb=_0x379281?[this['channelSessions']['get'](_0x379281)]:this['channelSessions']['values'](),_0x298d64=new Set();for(const _0x4f6112 of _0x41e5cb)for(const _0x1590da of _0x4f6112)_0x1590da['user']['id']===_0x5045db['id']&&_0x298d64['add'](_0x1590da['id']);return _0x298d64;}['getUserRole'](_0x12fe27){for(const _0x41d628 of this['channelSessions']['values']())for(const _0x594cf0 of _0x41d628)if(_0x594cf0['user']===_0x12fe27)return _0x594cf0['role'];}['_handleSessionAdd'](_0x4b0351,_0x2748a4){if('connected'!==this['context']['plugins']['get'](c)['state'])return;const _0x35da35=_0x2748a4['user'],_0x56ae71=this['_users']['getUser'](_0x35da35['id'])||this['_createUser'](_0x35da35),_0x23b21d=Object['assign']({},_0x2748a4,{'user':_0x56ae71});this['channelSessions']['get'](_0x4b0351)['add'](_0x23b21d);const _0x3b6869=this['channelConnectedUsers']['get'](_0x4b0351);_0x3b6869['has'](_0x56ae71['id'])||_0x3b6869['add'](_0x56ae71),this['allConnectedUsers']['has'](_0x56ae71['id'])||this['allConnectedUsers']['add'](_0x56ae71,_0x56ae71['isMe']?0x0:void 0x0),this['fire']('sessionAdd:'+_0x4b0351,{'channelId':_0x4b0351,'session':_0x23b21d});}['_handleSessionRemove'](_0x2fb28f,_0x1e530c){if('connected'!==this['context']['plugins']['get'](c)['state'])return;const _0x264cc3=this['channelConnectedUsers']['get'](_0x2fb28f),_0xa602f5=_0x1e530c['user'];_0xa602f5['id']&&(this['channelSessions']['get'](_0x2fb28f)['remove'](_0x1e530c['id']),_0x264cc3['has'](_0xa602f5['id'])&&!this['getUserSessions'](_0xa602f5,_0x2fb28f)['size']&&_0x264cc3['remove'](_0xa602f5['id']),this['allConnectedUsers']['get'](_0xa602f5['id'])&&!this['getUserSessions'](_0xa602f5)['size']&&this['allConnectedUsers']['remove'](_0xa602f5['id']));}['_createUser'](_0x379f0b,_0x34f2af){const _0x34dcb6=this['_users']['addUser'](_0x379f0b);return _0x34f2af&&this['_users']['defineMe'](_0x379f0b['id']),_0x34dcb6['orderNumber']=this['_uniqueUsersCount']++,_0x34dcb6;}}class H extends _0x2e94c1{['_domEmitter']=new(_0x194205())();static get['requires'](){return[r];}static get['pluginName'](){return'UserMarkers';}['init'](){const _0x1d9c3f=this['editor'],_0x5592ca=_0x1d9c3f['plugins']['get'](r);_0x1d9c3f['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x5639b4,{writer:_0x27ac1e})=>function(_0xba7b1a,_0x13cdce,_0x175e20,_0x1565c0){const _0x546758=_0xba7b1a['markerName']['split'](':')[0x2],_0x2dc8d9=_0x175e20['getUserBySessionId'](_0x546758);if(!_0x2dc8d9||_0x546758===_0x175e20['mySessionId'])return;if(!_0x1565c0['model']['schema']['checkChild'](_0xba7b1a['markerRange']['start'],'$text'))return;const _0x339a73={'class':'ck-user__marker\x20'+_0x2dc8d9['color']['getMarkerClass'](),'data-name':_0x2dc8d9['name'],'data-session-id':_0x546758},_0xb6fb40=_0x1565c0['model']['markers']['get'](_0xba7b1a['markerName']),_0x35e3bd=_0xb6fb40['getStart'](),_0x273b1c=_0x35e3bd['nodeAfter'],_0x5cf950=_0x1565c0['model']['schema'];if(_0x273b1c&&_0x5cf950['isObject'](_0x273b1c)&&_0x5cf950['isInline'](_0x273b1c)&&!_0x1565c0['model']['markers']['get']('user:range:'+_0x546758)['getRange']()['isCollapsed'])return;const _0x568caa=_0x35e3bd['parent'];return _0x1565c0['model']['schema']['isLimit'](_0x568caa)&&!_0x1565c0['model']['hasContent'](_0x568caa)&&(_0x339a73['contenteditable']=!0x1),function(_0x40ba15,_0x226157,_0x4907a8){const _0x79a84d=_0x40ba15['createUIElement']('span',_0x226157);return _0x40ba15['setCustomProperty']('userPositionMarker',!0x0,_0x79a84d),_0x79a84d['render']=function(_0x5a4c3b){const _0x2aa406=this['toDomElement'](_0x5a4c3b);return _0x2aa406['innerHTML']='<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span><span\x20class=\x22ck-user__marker-tooltip\x22\x20contenteditable=\x22false\x22\x20spellcheck=\x22false\x22>'+_0x4907a8['name']+'</span>',_0x2aa406['addEventListener']('mouseenter',()=>{_0x2aa406['classList']['add']('ck-user__marker_hovered');}),_0x2aa406['addEventListener']('mouseleave',()=>{_0x2aa406['classList']['remove']('ck-user__marker_hovered');}),_0x2aa406;},_0x79a84d['isSimilar']=function(_0x52ce78){return!(!this['getCustomProperty']('userPositionMarker')||!_0x52ce78['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0x52ce78['getAttribute']('data-session-id'));},_0x79a84d;}(_0x13cdce,_0x339a73,_0x2dc8d9);}(_0x5639b4,_0x27ac1e,_0x5592ca,_0x1d9c3f)}),_0x1d9c3f['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0x420b32=>function(_0x314591,_0x327db2){const _0x56930b=_0x314591['markerName']['split'](':')[0x2];if(_0x56930b===_0x327db2['mySessionId'])return null;const _0x2a960f=_0x327db2['getUserBySessionId'](_0x56930b);if(!_0x2a960f)return{'id':_0x56930b,'classes':[]};return{'id':_0x56930b,'classes':['ck-user__selection',_0x2a960f['color']['getSelectionClass']()],'attributes':{'data-session-id':_0x56930b},'priority':0x7d0+_0x2a960f['orderNumber']};}(_0x420b32,_0x5592ca)}),function(_0x17da05){const _0x58632b=_0x17da05['model'],_0x3fec59=new Map(),_0x1d6095=_0x17da05['plugins']['get'](r);_0x58632b['markers']['on']('update:user:range',(_0x124994,_0x55d1d0,_0x22bdff,_0x30c82e)=>{if(!_0x30c82e&&_0x3fec59['get'](_0x55d1d0['name']))return _0x3fec59['get'](_0x55d1d0['name'])['detach'](),void _0x3fec59['delete'](_0x55d1d0['name']);const _0x30a2f1=_0x55d1d0['name']['split'](':')[0x2];if(_0x30a2f1===_0x1d6095['mySessionId'])return;const _0x1457fc='user:position:'+_0x30a2f1;_0x58632b['markers']['has'](_0x1457fc)&&_0x17da05['editing']['reconvertMarker'](_0x1457fc),_0x55d1d0['on']('change:range',(_0x495042,_0xf8de03,_0x45d379)=>{if('$graveyard'!=_0xf8de03['root']['rootName']&&'$graveyard'==_0x55d1d0['getRange']()['root']['rootName']&&!_0x3fec59['has'](_0x55d1d0['name'])){const _0x3cdaa0=_0x58632b['schema']['getNearestSelectionRange'](_0x45d379['deletionPosition']);if(_0x3cdaa0){const _0x5b24f3=ht['fromRange'](_0x3cdaa0);_0x3fec59['set'](_0x55d1d0['name'],_0x5b24f3),_0x5b24f3['on']('change:range',(_0x1153ac,_0xecf781,_0xca6bdc)=>{if('$graveyard'==_0x5b24f3['root']['rootName']){const _0x1e2e9e=_0x58632b['schema']['getNearestSelectionRange'](_0xca6bdc['deletionPosition']);_0x1e2e9e?(_0x5b24f3['start']=_0x1e2e9e['start'],_0x5b24f3['end']=_0x1e2e9e['end']):(_0x3fec59['delete'](_0x55d1d0['name']),_0x5b24f3['detach']());}});}}});}),_0x58632b['document']['on']('change',()=>{_0x3fec59['size']>0x0&&_0x58632b['enqueueChange']({'isUndoable':!0x1},_0x2167e7=>{for(const [_0x5d5353,_0x1cc90e]of _0x3fec59)'$graveyard'==_0x58632b['markers']['get'](_0x5d5353)['getRange']()['root']['rootName']&&(re(_0x5d5353['split'](':')[0x2],_0x1cc90e['toRange'](),_0x58632b,_0x2167e7),_0x1cc90e['detach']());_0x3fec59['clear']();});});}(_0x1d9c3f),this['_domEmitter']['listenTo'](_0x520df5['document'],'keydown',(_0xa59f33,{key:_0x1816bf})=>{'Escape'===_0x1816bf&&function(_0x4081fc){_0x4081fc['editing']['view']['change'](_0x15d141=>{for(const _0x24fb66 of _0x4081fc['model']['markers']){if(!_0x24fb66['name']['startsWith']('user:position'))continue;const _0x239f43=_0x4081fc['editing']['mapper']['markerNameToElements'](_0x24fb66['name']);if(_0x239f43){for(const _0x366811 of _0x239f43)_0x15d141['removeClass']('ck-user__marker_hovered',_0x366811);}}});}(_0x1d9c3f);},{'useCapture':!0x0});}['afterInit'](){const _0x4ea5f3=this['editor'],_0x45e985=_0x4ea5f3['commands']['get']('undo');_0x45e985&&_0x4ea5f3['model']['on']('applyOperation',(_0xa85354,_0x217ce2)=>{const _0x3c72dd=_0x217ce2[0x0];if('marker'!=_0x3c72dd['type']||!_0x3c72dd['name']['startsWith']('user:'))return;const _0x36ec15=_0x3c72dd['batch'];_0x45e985['_createdBatches']['has'](_0x36ec15)&&(_0x3c72dd['newRange']=_0x3c72dd['oldRange']?_0x4ea5f3['model']['createRange'](_0x3c72dd['oldRange']['start'],_0x3c72dd['oldRange']['end']):null);},{'priority':'highest'});}['destroy'](){return this['_domEmitter']['stopListening'](),super['destroy']();}['createUserMarkerOperations'](){const _0x310042=this['editor'],_0x51a895=_0x310042['model']['document'],_0x42e7c3=_0x310042['plugins']['get'](r);_0x310042['model']['enqueueChange']({'isUndoable':!0x1},_0x3ba073=>{const _0x4e4c5e='user:range:'+_0x42e7c3['mySessionId'],_0x29b9fa='user:position:'+_0x42e7c3['mySessionId'],_0x1b7186=_0x310042['model']['markers']['has'](_0x4e4c5e);_0x310042['editing']['view']['hasDomSelection']?re(_0x42e7c3['mySessionId'],_0x51a895['selection']['getFirstRange'](),_0x310042['model'],_0x3ba073):_0x1b7186&&(_0x3ba073['removeMarker'](_0x4e4c5e),_0x3ba073['removeMarker'](_0x29b9fa));});}}function re(_0x4c5dfd,_0x1a4bb8,_0x5f4046,_0x1c7b12){const _0x16056f='user:range:'+_0x4c5dfd,_0x139610='user:position:'+_0x4c5dfd,_0x42b5cf=_0x1a4bb8['getContainedElement']();let _0x463f2e=_0x1a4bb8['start'];_0x42b5cf&&_0x42b5cf['is']('element','tableCell')&&(_0x463f2e=function(_0x5e1eaa,_0x5b6449){for(const _0x520868 of _0x5e1eaa['getPositions']())if(_0x5b6449['schema']['checkChild'](_0x520868,'$text'))return _0x520868;}(_0x1a4bb8,_0x5f4046),_0x1a4bb8=_0x1c7b12['createRange'](_0x463f2e));const _0x1d5ead=_0x1c7b12['createRange'](_0x463f2e);_0x5f4046['markers']['has'](_0x16056f)?(_0x1c7b12['updateMarker'](_0x16056f,{'range':_0x1a4bb8}),_0x1c7b12['updateMarker'](_0x139610,{'range':_0x1d5ead})):(_0x1c7b12['addMarker'](_0x16056f,{'range':_0x1a4bb8,'usingOperation':!0x0}),_0x1c7b12['addMarker'](_0x139610,{'range':_0x1d5ead,'usingOperation':!0x0}));}function q(_0x1235cd,_0x45598b,_0x556fa9){const t=_0x1235cd['t'];switch(_0x45598b){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 t({'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'},_0x556fa9);default:return'';}}let K=0x1;class l extends _0x2e94c1{static ['CollaborativeEditingService']=/* #__PURE__ -- @preserve */
|
|
25
|
-
((()=>_0x596db4)());['_offset'];['sessionId'];['serverHistory'];['_channelId'];['_service'];['_document'];['_compressor'];['_bufferedOperations'];['_knownOperations'];['_knownRootNames'];['_pendingAction'];['_hasSelectionChanged'];['_sendBufferedOperationsDelayId'];['_baseBufferDelay'];['_currentBufferDelay'];['_lastSyncedOperationId'];['_disconnectionOperations'];['_operationIdentifier'];static get['requires'](){return[c,r,H,_0x49f0c8,_0x28f53f,_0x1d8524];}static get['pluginName'](){return'RealTimeCollaborationClient';}get['cloudDocumentVersion'](){return this['_lastServerVersion']+this['_offset'];}get['_lastServerVersion'](){return this['serverHistory']['version']-this['_offset'];}get['lastSyncVersion'](){const _0x22ebdb=this['serverHistory']['getOperations']();for(let _0x24c2c0=_0x22ebdb['length']-0x1;_0x24c2c0>=0x0;_0x24c2c0--){const _0x306f5c=_0x22ebdb[_0x24c2c0];if(!this['_disconnectionOperations']['has'](_0x306f5c))return _0x306f5c['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0x1ee2b4){if(super(_0x1ee2b4),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x410eba(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0x43ccf9('collaboration-missing-channelid',this);const _0x1bd131=_0x1ee2b4['config']['get']('cloudServices.bundleVersion')||nt;this['_service']=new l['CollaborativeEditingService'](_0x1bd131,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0x482cca(),this['_bufferedOperations']=[],this['_knownOperations']=new WeakSet(),this['_knownRootNames']=new Set(),this['set']('_isPendingUpdate',!0x1),this['set']('_hasSynchronizationProblem',!0x1),this['_pendingAction']=null,this['_hasSelectionChanged']=!0x1,this['_sendBufferedOperationsDelayId']=null,this['_baseBufferDelay']=0x12c,this['_currentBufferDelay']=this['_baseBufferDelay'],this['_lastSyncedOperationId']=null,this['_disconnectionOperations']=new WeakSet(),this['_operationIdentifier']=new X(this['_disconnectionOperations']);}['init'](){const _0x54abf9=this['editor'],_0x750152=_0x54abf9['plugins']['get'](_0x28f53f),_0x145d45=_0x54abf9['plugins']['get'](c);this['listenTo'](_0x750152,'getOperationAuthor',(_0x49bd85,_0x4cccbc)=>{const _0x5a240e=_0x4cccbc[0x0];_0x5a240e['_authorId']&&(_0x49bd85['return']=_0x750152['getUser'](_0x5a240e['_authorId']),_0x49bd85['stop']()),null===_0x5a240e['_authorId']&&(_0x49bd85['return']=null,_0x49bd85['stop']());},{'priority':'high'}),this['listenTo'](_0x54abf9['model']['document']['selection'],'change:range',(_0x3c1c99,_0x277085)=>{_0x277085['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x54abf9['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x54abf9['model']['on']('applyOperation',(_0x1d15fb,_0x609750)=>{const _0x180bc1=_0x609750[0x0];_0x180bc1['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0x180bc1),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['bind']('_isEditingAllowed')['to'](_0x145d45,'state',this,'_hasSynchronizationProblem',(_0x188149,_0x16a569)=>'connected'===_0x188149&&!_0x16a569),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x54abf9['disableReadOnlyMode']('rtc-offline'):_0x54abf9['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x54abf9['disableReadOnlyMode']('rtc-offline'):_0x54abf9['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async['reconnect'](){const _0x416975=this['editor']['plugins']['get'](r),_0x5af7a0=this['editor']['plugins']['get'](c);try{this['_isPendingUpdate']=!0x0,_0x416975['unregister'](this['_channelId']);const _0x2dba51=await this['_service']['reconnect'](_0x5af7a0['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0x2dba51)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x2a4a27=await this['_service']['getConnectedSessions']();_0x416975['register'](this['_channelId'],_0x2a4a27),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x123023){if(function(_0x20fb33){return'404'===_0x20fb33['code'];}(_0x123023)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0x37792c){return'409'===_0x37792c['code'];}(_0x123023)){const _0x44bfb4=q(this['editor']['locale'],'The\x20document\x20cannot\x20be\x20connected\x20back\x20to\x20the\x20server.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.');this['_handleReconnectionError'](_0x44bfb4);}else{if(!(_0x123023 instanceof J))throw _0x123023;this['_handleReconnectionError']();}}}}['destroy'](){const _0x1d7f44=this['editor']['plugins']['get'](c),_0x278426=this['editor']['plugins']['get'](r);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x278426['channelSessions']['has'](this['_channelId'])&&_0x278426['unregister'](this['_channelId']),_0x1d7f44['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async['_handleReconnectionResponse'](_0x121fbf){if(this['sessionId']!==_0x121fbf['sessionId']&&this['_lastSyncedOperationId']!==_0x121fbf['lastOperationId'])throw new J();return this['sessionId']=_0x121fbf['sessionId'],this['_handleServerResponse']([],{..._0x121fbf,'wereChangesApplied':!0x1,'data':_0x121fbf['data']},'reconnect');}async['_connectService'](_0x25704e,_0x54f9b0=!0x1){const {connection:_0x3ac9af}=this['editor']['plugins']['get'](c);l['CollaborativeEditingService']['getConnectedSessions'](_0x3ac9af,this['_channelId'])['then'](_0x3a4200=>this['_initSessionsHandling'](_0x3a4200))['catch'](_0x4d9f78=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x4d9f78);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x283f31,_0x314605)=>{this['_crash']('realtimecollaborationclient-initservice-internal-error',_0x314605);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_isConnected']=!0x1;});const _0x2e1d65=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x25704e);this['_isPendingUpdate']=!0x0;const _0x423c2d=await this['_service']['connect'](_0x3ac9af,this['_compressOperations'](_0x25704e),_0x2e1d65);if(this['sessionId']=_0x423c2d['sessionId'],_0x54f9b0){if(!_0x423c2d['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x423c2d['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0x25704e,_0x423c2d,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x423c2d,_0x25704e);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}['_handleSendingSelectionMarkers'](){const _0x500ac6=this['editor']['plugins']['get'](r),_0x308220=this['editor']['plugins']['get'](H),_0x260cca=_0x500ac6['channelSessions']['get'](this['_channelId']);_0x260cca&&_0x260cca['length']>0x1?_0x308220['createUserMarkerOperations']():this['listenTo'](_0x500ac6,'sessionAdd:'+this['_channelId'],()=>{0x2===_0x500ac6['channelSessions']['get'](this['_channelId'])['length']&&_0x308220['createUserMarkerOperations']();});}async['_handleReceivedOperations'](_0x5e3843,_0x4d40cb,_0x19bd36,_0x273452){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x4d40cb){const _0x2b1317=this['_decompressOperations'](_0x19bd36,_0x273452);await this['_fetchMissingUsers'](_0x2b1317),this['_handleExternalOperations'](_0x2b1317,_0x4d40cb,_0x19bd36['lastOperationId'])||this['_crash']('realtimecollaborationclient-initservice-incorrect-server-operation');}}async['_connectAfterSessionHasBeenFlushed'](){this['_disconnectService']();const {locale:_0x4cc4a7}=this['editor'];let _0x19e6c0;try{_0x19e6c0=await this['_service']['getDocumentDetails']();}catch(_0x23e734){const _0x53d47c=q(_0x4cc4a7,'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'](_0x53d47c);}const _0x544834=_0x19e6c0['currentDocumentSession']||_0x19e6c0['lastDocumentSession'];if(this['_lastSyncedOperationId']===_0x544834['lastOperationId'])await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);else{const _0x456ec5=q(_0x4cc4a7,'The\x20last\x20saved\x20version\x20of\x20the\x20document\x20does\x20not\x20match\x20the\x20local\x20version.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.');this['_handleReconnectionError'](_0x456ec5);}}['_disconnectService'](){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['stopListening'](this['_service']);}['_initSessionsHandling'](_0x22cf76){const _0x587513=this['editor']['plugins']['get'](r);this['listenTo'](_0x587513,'sessionAdd:'+this['_channelId'],(_0x29f4c6,{session:_0x38af8a})=>{if(_0x38af8a['id']===_0x587513['mySessionId']){_0x29f4c6['off']();const _0x3cfc84=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0x1c3694=_0x38af8a['permissions'];_0x3cfc84&&_0x3cfc84['isEnabled']&&(_0x1c3694=_0x1c3694['filter'](_0x3ab1eb=>'document:write'!==_0x3ab1eb)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0x1c3694,this['_channelId']);}}),_0x587513['register'](this['_channelId'],_0x22cf76);}['_initThrowingOnDataSet'](){const _0x5292d0=this['editor']['data']['set'];this['editor']['data']['set']=(..._0x2cfcab)=>{if(!_0x2cfcab[_0x2cfcab['length']-0x1]['suppressErrorInCollaboration'])throw new _0x43ccf9('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x5292d0['apply'](this['editor']['data'],_0x2cfcab);};}['_setUpDataInit'](){this['editor']['data']['on']('init',(_0xc419e8,[_0x533cee])=>{if(this['_document']['version'])throw new _0x43ccf9('realtimecollaborationclient-init-document-already-initialized',this);_0xc419e8['stop'](),this['_setPendingAction']();const _0xcce348=this['editor']['config']['get']('rootsAttributes'),_0x54a170=this['_getOperationsFromInitData'](_0x533cee,_0xcce348);0x0==_0x54a170['length']&&_0x54a170['push'](new _0x131b5b(0x0)),_0xc419e8['return']=this['_connectService'](_0x54a170)['then'](()=>{this['editor']['plugins']['get'](c)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x2f770c=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x2f770c))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x557667,[_0x250742,_0x2c10f8])=>{_0x557667['stop']();const _0x57ced9=this['editor']['model']['document']['getRoot'](_0x250742);if(!this['_knownRootNames']['has'](_0x250742)){const _0x5b55c1=_0x2c10f8&&_0x2c10f8['data']?_0x2c10f8['data']:'',_0x1980ba=_0x2c10f8&&_0x2c10f8['attributes']?_0x2c10f8['attributes']:{};await this['_loadRoot'](_0x250742,_0x5b55c1,_0x1980ba);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0x57ced9['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0x57ced9);});},{'priority':'high'});}async['_fetchMissingUsers'](_0x442f09){const _0x5e61d7=this['editor']['plugins']['get'](_0x28f53f),{connection:_0x34b9b3}=this['editor']['plugins']['get'](c),_0x58b687=new Set();for(const _0x44a3dc of _0x442f09){const _0x3cbe30=_0x44a3dc['_authorId'];_0x3cbe30&&!_0x5e61d7['getUser'](_0x3cbe30)&&_0x58b687['add'](_0x3cbe30);}if(0x0===_0x58b687['size'])return;const _0x497272=await lt['getMany'](_0x34b9b3,Array['from'](_0x58b687));for(const _0x56f137 of _0x497272)_0x5e61d7['getUser'](_0x56f137['id'])||_0x5e61d7['addUser'](_0x56f137);}['_getOperationsFromInitData'](_0x33be5a,_0x500833={}){const _0x55c9e1=this['editor']['model'],_0x42f42a=[];let _0x45ef86=0x0;const _0x4712b0='string'==typeof _0x33be5a?{'main':_0x33be5a}:_0x33be5a;for(const _0x522f5a of Object['keys'](_0x4712b0)){if(!this['_document']['roots']['has'](_0x522f5a))throw new _0x43ccf9('realtimecollaborationclient-init-non-existent-root',this);const _0x54dd85=this['editor']['data']['parse'](_0x4712b0[_0x522f5a]),_0x24e4b4=this['_document']['getRoot'](_0x522f5a),_0x5aab15=new _0x13ab53(_0x55c9e1['createPositionAt'](_0x24e4b4,0x0),_0x54dd85,_0x45ef86++);_0x42f42a['push'](_0x5aab15);for(const [_0x37da9b,_0x161e3d]of _0x54dd85['markers']){const _0x45aef9=_0x55c9e1['createRange'](_0x55c9e1['createPositionFromPath'](_0x24e4b4,_0x161e3d['start']['path']['slice']()),_0x55c9e1['createPositionFromPath'](_0x24e4b4,_0x161e3d['end']['path']['slice']())),_0x328e01=new _0x2d34ba(_0x37da9b,null,_0x45aef9,_0x55c9e1['markers'],!0x0,_0x45ef86++);_0x42f42a['push'](_0x328e01);}}if(_0x500833)for(const [_0x1900f6,_0x440d0e]of Object['entries'](_0x500833)){const _0x16ee1a=_0x55c9e1['document']['getRoot'](_0x1900f6);if(!_0x16ee1a)throw new _0x43ccf9('multi-root-editor-root-attributes-no-root',null);for(const [_0x2df211,_0x1a314f]of Object['entries'](_0x440d0e))if(null!==_0x1a314f){const _0x484abf=new _0x444d18(_0x16ee1a,_0x2df211,null,_0x1a314f,_0x45ef86++);_0x42f42a['push'](_0x484abf);}}return _0x42f42a;}async['_loadRoot'](_0x1aa0ee,_0x26c69c,_0x5830cd){this['_getOperationsFromInitData']({[_0x1aa0ee]:_0x26c69c},{[_0x1aa0ee]:_0x5830cd})['forEach']((_0x4c1b20,_0x24e2b3)=>{_0x4c1b20['baseVersion']=this['_document']['version']+_0x24e2b3,_0x4c1b20['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x4c1b20);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async['_handleInitialConnectionData'](_0x198880,_0x455567){let _0x42646f;this['_offset']=_0x198880['offset'];const _0x2a7bae=_0x198880['wereChangesApplied']&&!_0x198880['initData'],_0x43889c=_0x2a7bae?0x0:_0x198880['data']['baseVersion'];if(_0x455567['forEach'](_0x4d5452=>{_0x4d5452['_isInit']=!0x0,_0x4d5452['createdAt']=_0x198880['sessionCreatedAt'],_0x4d5452['_authorId']=null;}),_0x2a7bae)_0x42646f=_0x455567,this['_applyOperationsSet'](_0x42646f,_0x2a7bae);else{if(_0x198880['initData']){const _0x3f0a70=this['_getOperationsFromInitData'](_0x198880['initData']);this['_document']['history']['version']=-_0x3f0a70['length'],_0x3f0a70['forEach'](_0x3c93e0=>{_0x3c93e0['baseVersion']-=_0x3f0a70['length'],_0x3c93e0['createdAt']=_0x198880['sessionCreatedAt'],_0x3c93e0['_isInit']=!0x0,_0x3c93e0['_authorId']=null;}),this['_applyOperationsSet'](_0x3f0a70,!0x0),this['serverHistory']['version']=-_0x3f0a70['length']+this['_offset'],this['_updateServerHistory'](_0x3f0a70);}this['_document']['history']['version']=_0x43889c,_0x42646f=this['_decompressOperations'](_0x198880['data'],_0x198880['metadata']),await this['_fetchMissingUsers'](_0x42646f),this['_applyOperationsSet'](_0x42646f,_0x2a7bae);}_0x198880['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x42646f,_0x198880['lastOperationId']),this['_lastSyncedOperationId']=_0x198880['lastOperationId']),this['serverHistory']['version']=_0x43889c+this['_offset'],this['_updateServerHistory'](_0x42646f),_0x455567['filter'](_0x42c1cf=>{const _0x2b667a=this['_getAffectedRoot'](_0x42c1cf);return _0x2b667a&&!this['_knownRootNames']['has'](_0x2b667a);})['forEach']((_0x57fd2b,_0x3252b4)=>{_0x57fd2b['baseVersion']=this['_document']['version']+_0x3252b4,this['_saveOperationInBuffer'](_0x57fd2b);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x4b673e,_0x3f4b4a){throw this['_isPendingUpdate']=!0x0,_0x3f4b4a&&console['error'](_0x3f4b4a),new _0x43ccf9(_0x4b673e,this['editor']);}['_saveOperationInBuffer'](_0x4713a0){this['_knownOperations']['has'](_0x4713a0)||(this['_knownOperations']['add'](_0x4713a0),this['_bufferedOperations']['push'](_0x4713a0),this['_pendingAction']||'marker'==_0x4713a0['type']&&!_0x4713a0['affectsData']||this['_setPendingAction']());}['_sendBufferedOperationsDelayed'](_0x471e61=!0x1){!_0x471e61&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0x467716=>{_0x467716&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0x4927dc=>{if(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,!function(_0x5c1a61){return _0x5c1a61['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x5c1a61['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0x5c1a61['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0x4927dc))throw _0x4927dc;});},this['_currentBufferDelay']));}['_waitUntilSynced'](){return new Promise(_0x28adcf=>{this['on']('change:_isPendingUpdate',()=>{_0x28adcf();});});}async['_sendBufferedOperations'](){const _0x489774=this['editor']['plugins']['get'](H);if(this['_shouldSendSelectionUpdate']()&&(_0x489774['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x3474fb=[...this['_bufferedOperations']];for(const _0x4d2f35 of _0x3474fb)_0x4d2f35['wasUndone']=this['_document']['history']['isUndoneOperation'](_0x4d2f35);const _0x171a4e=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x3474fb),_0x282b42=K++,_0x579c18=this['_compressOperations'](_0x3474fb),_0xd9f0fe=await this['_service']['sendOperations'](_0x579c18,_0x579c18['baseVersion'],_0x171a4e);try{return await this['_handleServerResponse'](_0x3474fb,_0xd9f0fe,_0x282b42);}catch(_0x2fbf16){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0x2fbf16);}}async['_handleServerResponse'](_0x4177bd,_0x5a6e57,_0x53559d){if('error'in _0x5a6e57)throw _0x5a6e57['error'];let _0x19a973=!0x1;if(_0x5a6e57['wereChangesApplied']){_0x5a6e57['lastOperationId']&&(this['_lastSyncedOperationId']=_0x5a6e57['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x32b91d=>!_0x4177bd['includes'](_0x32b91d));for(const _0x2a8374 of _0x4177bd)_0x2a8374['createdAt']='lastOperationAcceptedAt'in _0x5a6e57&&_0x5a6e57['lastOperationAcceptedAt']||void 0x0;Q(_0x4177bd,_0x5a6e57['version']-_0x4177bd['length']),this['_updateServerHistory'](_0x4177bd);const _0xf94783=_0x4177bd['filter'](_0x47eaad=>{if(!_0x47eaad['_isInit'])return!0x1;const _0x58250a=this['_getAffectedRoot'](_0x47eaad);return _0x58250a&&!this['_knownRootNames']['has'](_0x58250a);});Q(_0xf94783,this['_document']['version']),this['_applyOperationsSet'](_0xf94783),_0x19a973=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0x35d7a8=this['_decompressOperations'](_0x5a6e57['data'],_0x5a6e57['metadata'])['filter'](_0x5b007b=>_0x5b007b['baseVersion']>=this['_lastServerVersion']);_0x35d7a8['forEach'](_0x54299b=>this['_addKnownRoot'](_0x54299b)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0xe2840f=>!_0xe2840f['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0xe2840f))),this['_bufferedOperations']['length']&&Q(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0x35d7a8),_0x19a973=this['_handleExternalOperations'](_0x35d7a8,_0x5a6e57['version'],_0x5a6e57['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x19a973?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}['_handleExternalOperations'](_0x4b3639,_0x1fba21,_0x80d99f){try{const _0x3cfa59={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x4012d1,operationsB:_0x999652,originalOperations:_0x2b8695}=_0x3f2467(_0x4b3639,this['_bufferedOperations'],_0x3cfa59);Q(_0x4012d1,this['_document']['version']),Q(_0x999652,_0x1fba21);for(const _0x38ed73 of _0x4012d1){const _0x2a242f=_0x2b8695['get'](_0x38ed73);_0x38ed73['_authorId']=_0x2a242f?_0x2a242f['_authorId']:null;}_0x80d99f&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x4b3639,_0x80d99f),this['_lastSyncedOperationId']=_0x80d99f),this['_bufferedOperations']=[..._0x999652],this['_applyOperationsSet'](_0x4012d1),this['_updateServerHistory'](_0x4b3639);}catch(_0x4778e2){return console['error'](_0x4778e2),!0x1;}return!0x0;}['_applyOperationsSet'](_0x28696e,_0x5c42a3=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0x20efbe=>{for(const _0x359ab1 of _0x28696e)this['_knownOperations']['add'](_0x359ab1),this['_addKnownRoot'](_0x359ab1),_0x20efbe['batch']['addOperation'](_0x359ab1),this['editor']['model']['applyOperation'](_0x359ab1);});}['_addKnownRoot'](_0x42483b){const _0x197168=this['_getAffectedRoot'](_0x42483b);_0x197168&&this['_knownRootNames']['add'](_0x197168);}['_getAffectedRoot'](_0x10ecb5){let _0x3549de,_0xfdebb5;switch(_0x10ecb5['type']){case'insert':_0x3549de=_0x10ecb5['position']['root'];break;case'marker':if(_0xfdebb5=_0x10ecb5['newRange'],!_0xfdebb5)return null;_0x3549de=_0xfdebb5['root'];break;case'addRootAttribute':_0x3549de=_0x10ecb5['root'];break;case'addRoot':_0x3549de=_0x10ecb5['affectedSelectable'];break;case'move':_0x3549de=_0x10ecb5['targetPosition']['root'];break;default:return null;}return _0x3549de['rootName'];}['_updateServerHistory'](_0x3179b8){_0x3179b8['forEach'](_0x4b2db1=>{const _0x4b575e=_0x4b2db1['clone']();_0x4b575e['_authorId']=_0x4b2db1['_authorId'],_0x4b575e['_isInit']=!!_0x4b2db1['_isInit'],_0x4b575e['createdAt']=_0x4b2db1['createdAt'],_0x4b575e['baseVersion']+=this['_offset'],_0x4b2db1['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x4b575e),this['serverHistory']['addOperation'](_0x4b575e);});}['_handleReconnectionError'](_0x34f360){const _0x534874=this['editor']['plugins']['get']('Notification'),_0x33cc2a=this['editor']['locale'];_0x34f360||(_0x34f360=q(_0x33cc2a,'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.')),_0x534874['showWarning'](_0x34f360,{'title':q(_0x33cc2a,'Synchronization\x20issue'),'namespace':'real-time-collaboration'}),this['_hasSynchronizationProblem']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_bufferedOperations']=[],this['editor']['plugins']['get'](c)['destroy']();}['_setPendingAction'](){this['_pendingAction']||(this['_pendingAction']=this['editor']['plugins']['get'](_0x49f0c8)['add'](q(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}['_clearPendingAction'](){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x49f0c8)['remove'](this['_pendingAction']),this['_pendingAction']=null);}['_compressOperations'](_0x50b103){const _0x9402e7=_0x50b103['map'](_0x57a88f=>_0x57a88f['toJSON']());return this['_compressor']['compress'](_0x9402e7);}['_decompressOperations'](_0x5dc68,_0x2497f4){return this['_compressor']['decompress'](_0x5dc68)['map']((_0x37c5eb,_0x1f91d5)=>{const _0x25c1bf='init'==_0x2497f4[_0x1f91d5]['type'];if('InsertOperation'==_0x37c5eb['__className']){const _0x31f256=_0x37c5eb['position']['root'];!this['_document']['getRoot'](_0x31f256)&&(this['_document']['createRoot']('$root',_0x31f256)['_isAttached']=!0x1);}const _0x3071f5=_0x2c3492['fromJSON'](_0x37c5eb,this['_document']);return _0x3071f5['wasUndone']=_0x37c5eb['wasUndone'],_0x3071f5['_isInit']=_0x25c1bf,_0x3071f5['_authorId']=_0x25c1bf?null:_0x2497f4[_0x1f91d5]['userId'],_0x3071f5['_isDisconnection']='cs:removeUser'===_0x2497f4[_0x1f91d5]['type'],_0x3071f5['createdAt']=_0x2497f4[_0x1f91d5]['createdAt'],_0x3071f5;});}['_refreshUserSelectionMarkers'](){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}['_shouldSendSelectionUpdate'](){const _0x638c8=this['editor']['plugins']['get'](r)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0x638c8&&_0x638c8['length']>0x1&&this['_hasSelectionChanged'];}['_shouldSendUpdate'](){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}}class J extends Error{}function Q(_0x1c9e32,_0x5e7259){for(const _0x2d0c88 of _0x1c9e32)_0x2d0c88['baseVersion']=_0x5e7259++;}class X{['_ignoredOperations'];['_operationToId'];constructor(_0x40cf21){this['_ignoredOperations']=_0x40cf21,this['_operationToId']=new WeakMap();}['getIdOfTheLastOperation'](_0x4e9d66){let _0x10e927=_0x4e9d66['length'];for(;_0x10e927--;){const _0x553b95=_0x4e9d66[_0x10e927];if(!this['_ignoredOperations']['has'](_0x553b95)){if(!this['_operationToId']['has'](_0x553b95)){const _0x347ce3=_0x1cebbe()['slice'](0x1,0x12);this['_operationToId']['set'](_0x553b95,_0x347ce3);}return this['_operationToId']['get'](_0x553b95);}}}['setIdForTheLastOperation'](_0x361f45,_0x1bef96){if(!_0x1bef96)return;let _0x227e41=_0x361f45['length'];for(;_0x227e41--;){const _0x412e30=_0x361f45[_0x227e41];this['_ignoredOperations']['has'](_0x412e30)||this['_operationToId']['set'](_0x412e30,_0x1bef96);}}}class n extends _0x2e94c1{static get['requires'](){return[l];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}}class a extends _0x59636b{static ['CommentsService']=/* #__PURE__ -- @preserve */
|
|
26
|
-
((()=>_0x143257)());['_services'];static get['requires'](){return[c,'CommentsRepository',r,_0x28f53f];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}constructor(_0x2dbe8e){super(_0x2dbe8e),this['_services']=new Map();}async['init'](){const _0x1c91ed=this['context'],_0x155d2d=_0x1c91ed['plugins']['get']('CommentsRepository');if(_0x1c91ed['plugins']['get'](c)['addToReconnectionStack'](this),_0x155d2d['adapter']={'addCommentThread':async({channelId:_0x10033c,threadId:_0x2f6913,comments:_0x5ccc66,resolvedAt:_0x5f325a,resolvedBy:_0x3e2f48,context:_0x510000,attributes:_0x34bcee})=>{const _0x480393=await this['_getService'](_0x10033c)['addCommentThread']({'commentThreadId':_0x2f6913,'comments':_0x5ccc66['map'](_0x2c209d=>function(_0x1fa8ba,_0x56b5f4,_0x2cc76b){return{'commentThreadId':_0x2cc76b,'commentId':_0x1fa8ba['commentId'],'userId':_0x1fa8ba['authorId'],'content':_0x1fa8ba['content'],'documentId':_0x56b5f4,'createdAt':_0x1fa8ba['createdAt'],'attributes':_0x1fa8ba['attributes']||{}};}(_0x2c209d,_0x10033c,_0x2f6913)),'resolvedAt':_0x5f325a,'resolvedBy':_0x3e2f48,'context':_0x510000,'attributes':_0x34bcee})['catch'](ut);return{'threadId':_0x480393['commentThreadId'],'comments':_0x480393['comments']};},'getCommentThread':async({channelId:_0xb7d21c,threadId:_0x8d5845})=>{const _0x1595d7=await this['_getService'](_0xb7d21c)['getCommentThread'](_0x8d5845)['catch'](ut);return _0x1595d7['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0x1595d7]),{'threadId':_0x1595d7['commentThreadId'],'comments':_0x1595d7['comments']['map'](S),'context':_0x1595d7['context'],'resolvedAt':_0x1595d7['resolvedAt'],'resolvedBy':_0x1595d7['resolvedBy'],'attributes':_0x1595d7['attributes']||{}});},'updateCommentThread':async({channelId:_0x7c39b8,threadId:_0x16c138,context:_0x2bacfd,unlinkedAt:_0x540753,attributes:_0x853bb3})=>this['_getService'](_0x7c39b8)['updateCommentThread']({'commentThreadId':_0x16c138,'context':_0x2bacfd,'attributes':_0x853bb3,'unlinkedAt':_0x540753})['catch'](B)['catch'](ut),'resolveCommentThread':async({channelId:_0x8500c,threadId:_0x549c76})=>{const _0xca726a=await this['_getService'](_0x8500c)['resolveCommentThread'](_0x549c76)['catch'](B)['catch'](ut);return{'threadId':_0xca726a['commentThreadId'],'resolvedAt':_0xca726a['resolvedAt'],'resolvedBy':_0xca726a['resolvedBy']};},'reopenCommentThread':async({channelId:_0x27511d,threadId:_0x3361d8})=>this['_getService'](_0x27511d)['reopenCommentThread'](_0x3361d8)['catch'](B)['catch'](ut),'removeCommentThread':({channelId:_0x45afc9,threadId:_0x4c8d0d})=>this['_getService'](_0x45afc9)['removeCommentThread'](_0x4c8d0d)['catch'](B)['catch'](ut),'addComment':({channelId:_0xa834d2,threadId:_0xdc413d,commentId:_0x157dea,content:_0x20c5ea,attributes:_0x8483b9})=>this['_getService'](_0xa834d2)['addComment'](_0xdc413d,_0x157dea,_0x20c5ea,_0x8483b9)['catch'](ut),'updateComment':({channelId:_0x8be33f,threadId:_0x1358b8,commentId:_0x1b62a8,content:_0x1d51bd,attributes:_0xaca485})=>this['_getService'](_0x8be33f)['updateComment'](_0x1358b8,_0x1b62a8,_0x1d51bd,_0xaca485)['catch'](B)['catch'](ut),'removeComment':({channelId:_0x148ab4,threadId:_0x6173fb,commentId:_0x1c58e6})=>this['_getService'](_0x148ab4)['removeComment'](_0x6173fb,_0x1c58e6)['catch'](B)['catch'](ut)},_0x1c91ed instanceof _0x50fc4a){const _0x2c91f6=_0x1c91ed['config']['get']('collaboration.channelId'),_0x3c2745=_0x1c91ed['plugins']['get'](r);await this['_setUpService'](_0x2c91f6);const _0x2d4225=await this['_services']['get'](_0x2c91f6)['getConnectedSessions']();this['listenTo'](_0x3c2745,'sessionAdd:'+_0x2c91f6,(_0x347cda,{session:_0x3e4d88})=>{_0x3e4d88['id']===_0x3c2745['mySessionId']&&(_0x347cda['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x3e4d88['permissions'],_0x2c91f6));}),_0x3c2745['register'](_0x2c91f6,_0x2d4225);}}async['_setUpService'](_0x31fe80){if(this['_services']['has'](_0x31fe80))throw new _0x43ccf9('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0x31fe80});const _0x4f1ad4=this['context']['plugins']['get']('CommentsRepository'),_0x311d73=new a['CommentsService'](_0x31fe80);this['_services']['set'](_0x31fe80,_0x311d73),this['listenTo'](_0x311d73,'commentThreadAdded',(_0x1b9a14,_0x2836c4)=>{const {commentThreadId:_0x4278f,documentId:_0x1f9e6c,context:_0x3dfeb5,attributes:_0x1f58b3,resolvedAt:_0xf41a75,resolvedBy:_0x5d2c8d,comments:_0x34a65e}=_0x2836c4;_0x4f1ad4['getCommentThread'](_0x4278f)||_0x4f1ad4['addCommentThread']({'threadId':_0x4278f,'channelId':_0x1f9e6c,'comments':_0x34a65e?_0x34a65e['map'](S):[],'context':_0x3dfeb5,'attributes':_0x1f58b3,'resolvedAt':_0xf41a75,'resolvedBy':_0x5d2c8d,'isFromAdapter':!0x0});}),this['listenTo'](_0x311d73,'commentThreadUpdated',(_0x50db19,{commentThreadId:_0x5404ad,documentId:_0x4cb52a,context:_0x37fbb1,unlinkedAt:_0x444bea,attributes:_0x564d52})=>{_0x4f1ad4['getCommentThread'](_0x5404ad)&&_0x4f1ad4['updateCommentThread']({'threadId':_0x5404ad,'channelId':_0x4cb52a,'context':_0x37fbb1,'unlinkedAt':_0x444bea,'attributes':_0x564d52,'isFromAdapter':!0x0});}),this['listenTo'](_0x311d73,'commentThreadResolved',(_0x47a716,{commentThreadId:_0x1bfca7,resolvedBy:_0x4ad0df,resolvedAt:_0x478586})=>{const _0x30eff9=_0x4f1ad4['getCommentThread'](_0x1bfca7);_0x30eff9&&_0x30eff9['resolve']({'resolvedBy':_0x4ad0df,'resolvedAt':_0x478586,'isFromAdapter':!0x0});}),this['listenTo'](_0x311d73,'commentThreadReopened',(_0x282f6b,{commentThreadId:_0x327116})=>{const _0x4ec75b=_0x4f1ad4['getCommentThread'](_0x327116);_0x4ec75b&&_0x4ec75b['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0x311d73,'commentThreadRemoved',(_0x51bd36,{commentThreadId:_0x27cab3})=>{const _0xeb5d1b=_0x4f1ad4['getCommentThread'](_0x27cab3);_0xeb5d1b&&_0xeb5d1b['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0x311d73,'commentAdded',(_0x248e8e,_0x2f7cc2)=>{const _0x59210f=_0x2f7cc2['commentThreadId'],_0x407fab=_0x4f1ad4['getCommentThread'](_0x59210f);_0x407fab&&_0x407fab['addComment']({...S(_0x2f7cc2),'isFromAdapter':!0x0});}),this['listenTo'](_0x311d73,'commentUpdated',(_0x38ebea,{commentThreadId:_0x4dc34a,commentId:_0x5d64a8,content:_0x4bcd01,attributes:_0x5a7b33})=>{const _0xd4fac7=_0x4f1ad4['getCommentThread'](_0x4dc34a);if(_0xd4fac7){const _0x94b912=_0xd4fac7['getComment'](_0x5d64a8);_0x94b912&&_0x94b912['update']({'content':_0x4bcd01,'attributes':_0x5a7b33,'isFromAdapter':!0x0});}}),this['listenTo'](_0x311d73,'commentRemoved',(_0x2d013f,{commentThreadId:_0xe3aee8,commentId:_0x2620af})=>{const _0x365f00=_0x4f1ad4['getCommentThread'](_0xe3aee8);if(_0x365f00){const _0x47af21=_0x365f00['getComment'](_0x2620af);_0x47af21&&_0x47af21['remove']({'isFromAdapter':!0x0});}}),await this['_connectService'](_0x31fe80);}['destroy'](){if(this['context']instanceof _0x50fc4a){const _0x58d2b9=this['context']['config']['get']('collaboration.channelId');this['_terminateService'](_0x58d2b9);}}['_terminateService'](_0x2aecee){if(!this['_services']['has'](_0x2aecee))throw new _0x43ccf9('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0x2aecee});this['_getService'](_0x2aecee)['disconnect'](),this['_services']['delete'](_0x2aecee);}async['reconnect'](){for(const _0x4e7507 of this['_services']['keys']())await this['_connectService'](_0x4e7507);if(this['context']instanceof _0x50fc4a){const _0x21e506=this['context']['config']['get']('collaboration.channelId'),_0x3d1b98=this['context']['plugins']['get'](r);_0x3d1b98['unregister'](_0x21e506);const _0x179756=await this['_services']['get'](_0x21e506)['getConnectedSessions']();_0x3d1b98['register'](_0x21e506,_0x179756);}}async['_connectService'](_0x40126d){const {connection:_0x4d817e}=this['context']['plugins']['get'](c),_0x29e19c=this['context']['plugins']['get']('CommentsRepository'),_0x888710=this['_services']['get'](_0x40126d),_0x5a7b52=await _0x888710['connect'](_0x4d817e);await this['_fetchMissingUsersForThreads'](_0x5a7b52);const _0x121c4a=new Set(Array['from'](_0x29e19c['getCommentThreads']({'channelId':_0x40126d}),_0x598fa9=>_0x598fa9['id']));for(const _0x394e46 of _0x5a7b52)_0x394e46['deletedAt']||_0x121c4a['delete'](_0x394e46['commentThreadId']);for(const _0x29b37a of _0x121c4a)_0x29e19c['getCommentThread'](_0x29b37a)['remove']({'isFromAdapter':!0x0});for(const _0x41040e of _0x5a7b52){let _0x369128=_0x29e19c['getCommentThread'](_0x41040e['commentThreadId']);const {commentThreadId:_0x2f4d1e,context:_0x227144,attributes:_0x5771f1,resolvedBy:_0x411a4a,resolvedAt:_0x8f1209,unlinkedAt:_0x93954d,deletedAt:_0xd0e46a}=_0x41040e;if(_0xd0e46a)continue;_0x369128||(_0x369128=_0x29e19c['addCommentThread']({'channelId':_0x40126d,'threadId':_0x2f4d1e,'context':_0x227144,'attributes':_0x5771f1||{},'resolvedBy':_0x411a4a,'resolvedAt':_0x8f1209,'unlinkedAt':_0x93954d,'isFromAdapter':!0x0}));const _0x1c52ef=new Set(Array['from'](_0x369128['comments'],_0xc3c857=>_0xc3c857['id']));for(const _0x1e8ddf of _0x41040e['comments'])_0x1c52ef['delete'](_0x1e8ddf['commentId']);for(const _0x21532e of _0x1c52ef)_0x369128['getComment'](_0x21532e)['remove']({'isFromAdapter':!0x0});for(const _0x344c1d of _0x41040e['comments']){const _0x4e878d=_0x369128['getComment'](_0x344c1d['commentId']);_0x4e878d?_0x4e878d['content']!==_0x344c1d['content']&&_0x4e878d['update']({'content':_0x344c1d['content'],'isFromAdapter':!0x0}):_0x369128['addComment'](Object['assign'](S(_0x344c1d),{'isFromAdapter':!0x0}));}}}['_getService'](_0x5af26b){if(!this['_services']['has'](_0x5af26b))throw new _0x43ccf9('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0x5af26b});return this['_services']['get'](_0x5af26b);}async['_fetchMissingUsersForThreads'](_0x3129b4){const _0x4a8c60=this['context']['plugins']['get'](_0x28f53f),{connection:_0x4b400b}=this['context']['plugins']['get'](c),_0x38f473=new Set();for(const {resolvedBy:_0x2eb523,comments:_0x49e958}of _0x3129b4){_0x2eb523&&!_0x4a8c60['getUser'](_0x2eb523)&&_0x38f473['add'](_0x2eb523);for(const {userId:_0x223481}of _0x49e958)_0x4a8c60['getUser'](_0x223481)||_0x38f473['add'](_0x223481);}if(0x0===_0x38f473['size'])return;const _0x28222a=await lt['getMany'](_0x4b400b,Array['from'](_0x38f473));for(const _0x3b36c1 of _0x28222a)_0x4a8c60['getUser'](_0x3b36c1['id'])||_0x4a8c60['addUser'](_0x3b36c1);}}async function B(_0x3a3439){if('404'!==_0x3a3439['code'])throw _0x3a3439;}function ut(_0x257c2b){if((_0x32c517=_0x257c2b)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0x32c517['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x32c517['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0x32c517;throw _0x257c2b;}function S(_0x3e01c8){return{'threadId':_0x3e01c8['commentThreadId'],'commentId':_0x3e01c8['commentId'],'content':_0x3e01c8['content'],'createdAt':_0x3e01c8['createdAt'],'authorId':_0x3e01c8['userId'],'attributes':_0x3e01c8['attributes']||{}};}class g extends _0x2e94c1{static ['TrackChangesService']=/* #__PURE__ -- @preserve */
|
|
27
|
-
((()=>
|
|
28
|
-
((()=>it)());['_lastRequestId'];['_revisionTracker'];['_revisionHistoryService'];['_oldOffset'];static get['requires'](){return[c,l,'RevisionTracker',r,_0x28f53f];}constructor(_0xcbc274){super(_0xcbc274);const _0x459508=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new v['RevisionHistoryService'](_0x459508);}async['init'](){const _0x410166=this['editor']['plugins']['get'](l),_0x3c9f2c=_0x410166['serverHistory'],_0x39f01b=this['editor']['plugins']['get'](c);this['_revisionTracker']['setSource']({'history':_0x3c9f2c,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0x410166['sessionId']});const _0x40ce03=this['editor']['config']['get']('cloudServices.bundleVersion')||nt,_0x296b38=await tt['isBundleUploaded'](_0x39f01b['connection'],_0x40ce03);this['_revisionTracker']['adapter']={'getRevision':async({revisionId:_0x4cecef})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0x4cecef)),'updateRevisions':async _0x4f0253=>{await this['_waitForServiceReady']();const _0x1027d9=this['_revisionTracker']['currentRevision'];if(_0x296b38&&0x1===_0x4f0253['length']&&_0x4f0253[0x0]['id']===_0x1027d9['id'])return _0x4f0253;for(const _0x2a47c4 of _0x4f0253)_0x2a47c4['id']===_0x1027d9['id']&&(_0x2a47c4['isEmptyCurrent']=_0x2a47c4['fromVersion']===_0x2a47c4['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0x4f0253,this['_lastRequestId'])['then'](_0x2763da=>(this['_lastRequestId']=_0x2763da,_0x4f0253))['catch'](_0x1f624d=>{if(st(_0x1f624d)||'400'===_0x1f624d['code']&&void 0x0!==_0x1f624d['data']['wrongRequestId']){for(const _0x4d52cc of _0x4f0253){!this['_revisionTracker']['repository']['getRevision'](_0x4d52cc['id'])||this['_revisionTracker']['_bufferUpdate'](_0x4d52cc['id'],_0x4d52cc,!0x1);}if(st(_0x1f624d))throw _0x1f624d;return _0x4f0253;}throw _0x1f624d;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0x484e65,{revisionsData:_0x345235,requestId:_0x330749})=>{Math['max'](..._0x345235['map'](_0x2e3bbc=>_0x2e3bbc['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0x345235,_0x330749);}):this['_handleRevisionsUpdate'](_0x345235,_0x330749);});const {revisions:_0x5cbb49,requestId:_0x4c007b}=await this['_revisionHistoryService']['connect'](_0x39f01b['connection']);_0x39f01b['addToReconnectionStack'](this),this['_lastRequestId']=_0x4c007b,await this['_fetchMissingUsers'](_0x5cbb49);for(const _0x569712 of _0x5cbb49)this['_revisionTracker']['addRevisionData'](_0x569712);this['listenTo'](_0x410166,'change:_isConnected',(_0x5c47fe,_0x5decda,_0xda635c)=>{_0xda635c&&(this['_oldOffset']=_0x410166['_offset'],_0x5c47fe['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](_0x39f01b,'state',_0x70bb35=>_0x70bb35===_0x128058['CONNECTED']);}async['reconnect'](){const _0x3650e=this['editor']['plugins']['get'](c),_0x508d77=this['editor']['plugins']['get'](l),_0x590ef8=async()=>{const _0x43e999=this['_revisionTracker']['currentRevision'],_0x5da8f9=_0x43e999['id'],_0x2d6b38=_0x5da8f9!==_0x508d77['sessionId'];if(_0x2d6b38){const _0x12b747=_0x508d77['_offset']-this['_oldOffset'],_0x2b48f7=this['_getLatestVersionFromServerOperations']();this['_revisionTracker']['_revisionDataBuilder']['reInit']();if(_0x43e999['toVersion']+_0x12b747!==_0x2b48f7){const _0x4c6737=_0x43e999['fromVersion']+_0x12b747,_0x697683=this['editor']['plugins']['get'](_0x28f53f),_0x28bf96=this['_revisionTracker']['buildRevisionData']({'revision':_0x43e999,'from':_0x4c6737,'to':_0x2b48f7});_0x28bf96['id']=_0x43e999['id'];const _0x5abb90=_0x28bf96['authorsIds']['map'](_0x5bfb25=>_0x697683['getUser'](_0x5bfb25));_0x43e999['_update']({..._0x28bf96,'authors':_0x5abb90},!0x0),this['_revisionTracker']['_bufferUpdate'](_0x43e999['id'],_0x28bf96,!0x0);}this['_revisionTracker']['_startingVersion']=_0x2b48f7,(_0x43e999['toVersion']===_0x43e999['fromVersion']&&!this['_revisionTracker']['_bufferedUpdates']['has'](_0x5da8f9)&&this['_revisionTracker']['repository']['_revisions']['remove'](_0x5da8f9),this['_revisionTracker']['_createCurrentRevision'](_0x2b48f7));}const {revisions:_0x14f0ea,requestId:_0x529491}=await this['_revisionHistoryService']['reconnect'](_0x3650e['connection'],this['_lastRequestId']);_0x2d6b38&&_0x14f0ea['length']>0x0?_0x508d77['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x14f0ea),this['_handleRevisionsUpdate'](_0x14f0ea,_0x529491),this['_revisionTracker']['sendBufferedUpdates']());};return _0x508d77['_isConnected']?_0x590ef8():new Promise((_0x29d23c,_0x2b666c)=>{_0x508d77['once']('change:_isConnected',()=>{_0x590ef8()['then'](_0x29d23c)['catch'](_0x2b666c);});});}['destroy'](){super['destroy']();}async['_waitForServiceReady'](){this['_revisionHistoryService']['isConnected']||await new Promise(_0x4767bf=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x2384d0=>{_0x2384d0['off'](),_0x4767bf();});});}['_getLatestVersionFromServerOperations'](){const _0x4b40fe=this['editor']['plugins']['get'](l)['serverHistory']['getOperations']()['reverse']();for(const _0x3bced9 of _0x4b40fe)if('marker'!==_0x3bced9['type']||_0x3bced9['affectsData'])return _0x3bced9['baseVersion']+0x1;}['_getLatestVersion'](){const _0x27ea1c=this['editor']['plugins']['get'](l);return new Promise(_0x97d7c6=>{_0x27ea1c['_isPendingUpdate']?_0x27ea1c['once']('change:_isPendingUpdate',()=>{_0x97d7c6(this['_getLatestVersionFromServerOperations']());}):_0x97d7c6(this['_getLatestVersionFromServerOperations']());});}['_handleRevisionsUpdate'](_0x2d564a,_0x1f7bff){const _0x20ab40=this['_revisionTracker']['repository'];this['_lastRequestId']=_0x1f7bff;for(const _0x2a8e45 of _0x2d564a){const _0x2be751=_0x20ab40['getRevision'](_0x2a8e45['id']);if(_0x2be751){if((_0x2a8e45['fromVersion']||_0x2a8e45['toVersion'])&&(_0x2a8e45['diffData']=null),_0x2be751===this['_revisionTracker']['currentRevision']){const _0x5af2e8=Math['max'](_0x2be751['toVersion'],_0x2a8e45['toVersion']),_0x5e40f2=Math['max'](_0x2be751['fromVersion'],_0x2a8e45['fromVersion']);let _0x58f288;_0x2be751['toVersion']===_0x2a8e45['toVersion']&&_0x2be751['fromVersion']===_0x2a8e45['fromVersion']?(_0x58f288=!0x0,this['_preventResendingRevisionData'](_0x2a8e45)):_0x2a8e45['toVersion']===_0x5af2e8&&_0x2a8e45['fromVersion']===_0x5e40f2?_0x58f288=!0x1:(_0x2be751['toVersion']===_0x5af2e8&&_0x2be751['fromVersion']===_0x5e40f2||this['_fixRevision']({'revision':_0x2be751,'from':_0x5e40f2,'to':_0x5af2e8}),_0x58f288=!0x0),_0x58f288&&(delete _0x2a8e45['fromVersion'],delete _0x2a8e45['toVersion'],delete _0x2a8e45['diffData'],delete _0x2a8e45['createdAt'],delete _0x2a8e45['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0x2a8e45),this['_preventResendingRevisionData'](_0x2a8e45);}else this['_revisionTracker']['addRevisionData'](_0x2a8e45);}const _0x18aad8=_0x20ab40['getRevisions']();_0x18aad8['reverse']();for(let _0x2a0ef4=0x0;_0x2a0ef4<_0x18aad8['length']-0x1;_0x2a0ef4++){const _0x45c9d6=_0x18aad8[_0x2a0ef4],_0x28f3fd=_0x18aad8[_0x2a0ef4+0x1];if(_0x45c9d6['fromVersion']<_0x28f3fd['toVersion']){const _0x259e30=_0x28f3fd['toVersion'],_0x5d0946=Math['max'](_0x259e30,_0x45c9d6['toVersion']);this['_fixRevision']({'revision':_0x45c9d6,'from':_0x259e30,'to':_0x5d0946});}}}['_fixRevision']({revision:_0x282c88,from:_0x290fb0,to:_0x551b89}={}){const _0xc1cb1a=this['editor']['plugins']['get'](_0x28f53f),_0x3a618c=this['_revisionTracker']['buildRevisionData']({'revision':_0x282c88,'from':_0x290fb0,'to':_0x551b89});_0x3a618c['authors']=_0x3a618c['authorsIds']['map'](_0x5b3197=>_0xc1cb1a['getUser'](_0x5b3197)),_0x282c88['_update'](_0x3a618c);}['_preventResendingRevisionData'](_0x16de03){const _0x419af9={};_0x419af9['id']=_0x16de03['id'];for(const _0x528d40 of Object['keys'](_0x16de03))'id'!==_0x528d40&&(_0x419af9[_0x528d40]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0x419af9['id'],_0x419af9,!0x0);}async['_fetchMissingUsers'](_0x1b982a){const _0x4cb764=this['editor']['plugins']['get'](_0x28f53f),{connection:_0x42a515}=this['editor']['plugins']['get'](c),_0x5744eb=new Set();for(const _0x14e359 of _0x1b982a){for(const _0x44c939 of _0x14e359['authorsIds'])_0x43bd7d(_0x44c939);_0x14e359['creatorId']&&_0x43bd7d(_0x14e359['creatorId']);}if(0x0===_0x5744eb['size'])return;const _0x247afb=await lt['getMany'](_0x42a515,Array['from'](_0x5744eb));for(const _0x8f7400 of _0x247afb)_0x4cb764['getUser'](_0x8f7400['id'])||_0x4cb764['addUser'](_0x8f7400);function _0x43bd7d(_0x3450bb){_0x4cb764['getUser'](_0x3450bb)||_0x5744eb['add'](_0x3450bb);}}}function st(_0x1320f8){return _0x1320f8['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0x1320f8['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x1320f8['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class d extends _0x2e94c1{static get['requires'](){return['RevisionHistory',v,n];}static get['pluginName'](){return'RealTimeCollaborativeRevisionHistory';}}class ts extends _0x5948f1{constructor(_0x410309){super(_0x410309);const _0x11d2c0=this['bindTemplate'];this['set']('usersCount',0x0),this['set']('isHidden',!0x0),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__counter',_0x11d2c0['if']('isHidden','ck-presence-list__counter--hidden')]},'children':[{'text':_0x11d2c0['to']('usersCount',_0x582e16=>q(_0x410309,'CONNECTED_USERS',_0x582e16))}]});}}class es extends _0x5948f1{['items'];['keystrokes'];constructor(_0x547f42){super(_0x547f42);const _0x5c2657=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0x34083d(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0x5c2657['if']('hasPopup'),'aria-expanded':_0x5c2657['to']('isExpanded',_0x388e64=>this['hasPopup']&&String(_0x388e64)),'aria-label':_0x5c2657['to']('hasPopup',_0x3de654=>q(_0x547f42,_0x3de654?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0x5c2657['to']('hasPopup',_0x565db5=>!!_0x565db5&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items'],'on':{'click':_0x5c2657['to'](()=>this['fire']('execute'))}}),this['on']('change:hasPopup',(_0x1f68ab,_0x566e63,_0x22e3e9)=>{this['element']&&(_0x22e3e9?this['element']['setAttribute']('aria-expanded',String(this['isExpanded'])):this['element']['removeAttribute']('aria-expanded'));});}['focus'](){this['element']['focus']();}['render'](){super['render'](),this['keystrokes']['listenTo'](this['element']);}}class L extends _0x5948f1{['counterView'];['inlineListView'];constructor(_0x377b27){super(_0x377b27);const _0x2c88a1=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new ts(this['locale']),this['inlineListView']=new es(_0x377b27),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x3cc3bb of this['inlineListView']['items'])_0x3cc3bb['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',_0x2c88a1['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['counterView'],this['inlineListView']]});}}class j extends _0x5948f1{['listWrapperView'];constructor(_0x593dd7,_0x11344d){super(_0x593dd7),this['listWrapperView']=new mt(_0x593dd7,_0x11344d),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':q(_0x593dd7,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']]});}}class mt extends _0x3045df{constructor(_0x19d937,_0x1d528f){super(_0x19d937);const _0x102fa7=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0x1d528f?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0x102fa7['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0x102fa7['to']('role'),'aria-label':_0x102fa7['to']('ariaLabel'),'aria-labelledby':_0x102fa7['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0x520df5['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0x59731d=this['element'];_0x59731d&&(this['_isScrollable']=Math['max'](_0x59731d['scrollHeight'],_0x59731d['clientHeight'])>0.8*window['innerHeight']);}}class k extends rt{['userView'];constructor(_0x2686c4,_0x410cbc,_0x3c1bab){super(_0x2686c4);const _0x3708e6=this['bindTemplate'];this['userView']=new ct(_0x2686c4,_0x410cbc);const _0x30aaf2={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0x410cbc['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0x410cbc['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x410cbc['color']['getBackgroundColorClass']()],'aria-hidden':'true'}}]};_0x3c1bab&&(_0x30aaf2['tag']='button',_0x30aaf2['on']={'click':_0x3708e6['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x30aaf2);}['focus'](){this['element']['focus']();}}class y extends _0x5948f1{['userView'];['markerView'];constructor(_0x15aa55,_0x6a0ca9,_0x5758d1){super(_0x15aa55);const _0x32b4e4=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new ct(_0x15aa55,_0x6a0ca9),this['markerView']=new at(_0x15aa55,_0x6a0ca9);const _0x491c1f=new ot(_0x15aa55);_0x491c1f['template']['tag']='span',_0x491c1f['text']=_0x6a0ca9['name'];const _0x1f19a8={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0x32b4e4['to']('isFocusable',_0x29f829=>!!_0x29f829&&0x0),'aria-labelledby':_0x491c1f['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0x32b4e4['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0x32b4e4['to']('hasTooltip',_0xb961c0=>!_0xb961c0),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0x491c1f]};_0x5758d1&&(_0x1f19a8['tag']='button',_0x1f19a8['on']={'click':_0x32b4e4['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x1f19a8);}}class at extends _0x5948f1{constructor(_0x5187be,_0x37e103){super(_0x5187be),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x37e103['color']['getBackgroundColorClass']()],'aria-hidden':'true'}});}}const A={'collapseAt':0x6,'displayMe':!0x0};class s extends _0x59636b{['currentDisplayedUsers'];['balloonPanelView'];['view'];['presenceDropdownView'];['_bodyCollection']=null;constructor(_0x4b0fe7){super(_0x4b0fe7),this['context']['config']['define']('presenceList',A);const _0x1658b6=_0x4b0fe7['config']['get']('presenceList.collapseAt');if('number'!=typeof _0x1658b6)throw new _0x43ccf9('presencelist-collapseat-invalid-format',this);if(_0x1658b6<0x1)throw new _0x43ccf9('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](r)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0x5f4219(),this['balloonPanelView']=new _0x26fbca(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get['requires'](){return[r];}['init'](){for(const _0x38df31 of this['_allConnectedUsers'])this['_handleUserAdd'](_0x38df31);this['listenTo'](this['_allConnectedUsers'],'add',(_0x3430e1,_0x9b9710)=>{this['_handleUserAdd'](_0x9b9710);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0x28b9c8,_0x279d43)=>{this['_handleUserRemove'](_0x279d43);});}['_createView'](){const _0x38f201=this['context'],_0x48b84e=new L(this['context']['locale']),_0x197801=this['balloonPanelView'];if(!_0x427ff9(_0x38f201['config']['get']('presenceList.container')))throw new _0x43ccf9('presencelist-missing-container',this);return _0x48b84e['counterView']['bind']('usersCount')['to'](this),_0x48b84e['bind']('isCollapsed')['to'](this,'usersCount',_0x485e10=>{const {collapseAt:_0x33ed3f,displayMe:_0x338fe5}=_0x38f201['config']['get']('presenceList'),_0xc2e053=_0x485e10>=_0x33ed3f;return _0x48b84e['counterView']['isHidden']=!(0x1==_0x485e10&&_0x338fe5||_0xc2e053),_0xc2e053||this['hideDropdown'](),_0xc2e053;}),_0x48b84e['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0x34e2c7=>{const _0x4aed57=_0x38f201['config']['get']('presenceList'),_0x52b4c3=new y(_0x38f201['locale'],_0x34e2c7,!!_0x4aed57['onClick']);return _0x52b4c3['bind']('hasTooltip')['to'](_0x48b84e,'isCollapsed',_0x373145=>!_0x373145),_0x52b4c3['bind']('isFocusable')['to'](_0x48b84e,'isCollapsed',_0x294676=>!_0x294676),_0x4aed57['onClick']&&this['listenTo'](_0x52b4c3,'execute',()=>{this['view']['isCollapsed']||_0x4aed57['onClick'](_0x34e2c7,_0x52b4c3['element']);}),_0x52b4c3;}),this['listenTo'](_0x48b84e['inlineListView'],'execute',()=>{this['presenceDropdownView']?this['hideDropdown']():this['view']['isCollapsed']&&this['showDropdown']();}),_0x48b84e['inlineListView']['keystrokes']['set']('Enter',(_0x25deb8,_0x2795e8)=>{this['view']['isCollapsed']&&(this['showDropdown'](),_0x2795e8());}),_0x48b84e['render'](),_0x197801['render'](),_0xb440bd({'emitter':_0x48b84e,'activator':()=>_0x197801['isVisible'],'contextElements':[_0x197801['element'],_0x48b84e['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0x38f201['config']['get']('presenceList.container')['appendChild'](_0x48b84e['element']),this['_bodyCollection']=new _0x22a271(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_bodyCollection']['add'](this['balloonPanelView']),_0x48b84e;}['_handleUserAdd'](_0x2a3c31){if(!this['context']['config']['get']('presenceList.displayMe')&&_0x2a3c31['isMe'])return;const _0x42982a=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['usersCount']++,this['currentDisplayedUsers']['length']==_0x42982a&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](0x1);const _0x445c92=_0x2a3c31['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0x2a3c31,_0x445c92);}['_handleUserRemove'](_0x5d8e76){if(this['usersCount']--,this['currentDisplayedUsers']['get'](_0x5d8e76['id'])&&(this['currentDisplayedUsers']['remove'](_0x5d8e76['id']),this['currentDisplayedUsers']['length']<this['usersCount'])){for(const _0x22ec9f of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0x22ec9f['id']))return void this['currentDisplayedUsers']['add'](_0x22ec9f,Math['min'](this['currentDisplayedUsers']['length'],0x1));}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0x47694e=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new j(this['context']['locale'],!!_0x47694e['onClick']),this['view']['inlineListView']['isExpanded']=!0x0;const {listWrapperView:_0x404d8b}=this['presenceDropdownView'];_0x404d8b['items']['bindTo'](this['_allConnectedUsers'])['using'](_0x2e8133=>{if(!_0x47694e['displayMe']&&_0x2e8133['isMe'])return null;const _0x325229=new k(this['context']['locale'],_0x2e8133,!!_0x47694e['onClick']);return _0x47694e['onClick']&&this['listenTo'](_0x325229,'execute',()=>{_0x47694e['onClick'](_0x2e8133,_0x325229['element']);}),_0x325229;}),this['balloonPanelView']['content']['add'](this['presenceDropdownView']),this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element']}),_0x404d8b['focus'](),_0x404d8b['checkIfScrollable']();const _0x2ec0d8=(_0x22e2eb,_0x516013)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0x516013();};_0x404d8b['keystrokes']['set']('Esc',_0x2ec0d8),_0x404d8b['keystrokes']['set']('Shift+Tab',_0x2ec0d8),_0x404d8b['keystrokes']['set']('Tab',(_0x17ec76,_0x3aefdb)=>{!function(_0xf8de19){const _0x21ead3=['a','button','input','select','textarea','[tabindex]','[contenteditable]']['map'](_0x18ac0b=>_0x18ac0b+':not([disabled]):not([tabindex=\x22-1\x22])')['join'](','),_0xb99222=[...document['body']['querySelectorAll'](_0x21ead3)]['filter'](_0x130908=>_0x130908===document['activeElement']||_0x130908['offsetWidth']+_0x130908['offsetHeight']>0x0)['sort']((_0x3ab8c3,_0x37c973)=>(_0x3ab8c3['tabIndex']||0x0)-(_0x37c973['tabIndex']||0x0)),_0x9553ff=_0xb99222['indexOf'](_0xf8de19),_0x1e92f2=_0xb99222[(_0x9553ff+0x1)%_0xb99222['length']];_0x1e92f2&&_0x1e92f2['focus']();}(this['view']['element']),this['hideDropdown'](),_0x3aefdb();}),_0x404d8b['focusTracker']['add'](this['view']['element']),_0x404d8b['focusTracker']['on']('change:isFocused',(_0x484a50,_0x1151e7,_0x437892)=>{_0x437892||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 i extends _0x59636b{static get['requires'](){return[r,s];}static get['pluginName'](){return'PresenceList';}}export{a as CloudServicesCommentsAdapter,v as CloudServicesRevisionHistoryAdapter,g as CloudServicesTrackChangesAdapter,i as PresenceList,l as RealTimeCollaborationClient,m as RealTimeCollaborativeComments,n as RealTimeCollaborativeEditing,d as RealTimeCollaborativeRevisionHistory,p as RealTimeCollaborativeTrackChanges};
|
|
23
|
+
import{ContextPlugin as _0x54552e,Plugin as _0x360d0e,PendingActions as _0x1d975a,Context as _0x178f2b}from'@ckeditor/ckeditor5-core/dist/index.js';import{DomEmitterMixin as _0x3dd186,CKEditorError as _0x331448,Collection as _0x1ef5f7,global as _0x31593e,version as ht,uid as _0x7076,KeystrokeHandler as _0x4eab7e}from'@ckeditor/ckeditor5-utils/dist/index.js';import{Notification as _0x43f411,View as _0x59eae8,ListView as _0x10303f,ListItemView as ct,LabelView as pt,BalloonPanelView as _0x367914,clickOutsideHandler as _0x18cb4,BodyCollection as _0x15a38b}from'@ckeditor/ckeditor5-ui/dist/index.js';import{LiveRange as ut,History as _0x3b1fea,NoOperation as _0x34c6af,InsertOperation as _0x44b2e5,MarkerOperation as _0x32b787,RootAttributeOperation as _0x5c3499,transformSets as _0x27b1de,OperationFactory as _0x6f1576}from'@ckeditor/ckeditor5-engine/dist/index.js';import{WebSocketGateway as ft,WEB_SOCKET_GATEWAY_STATES as _0x49bf8d,CollaborativeEditingService as _0x3f90c9,User as mt,CommentsService as _0x3881e8,TrackChangesService as at,RevisionHistoryService as rt,EditorService as ot}from'@ckeditor/ckeditor-cloud-services-collaboration/dist/index.js';import{Users as _0x11d8ec,UserView as lt}from'ckeditor5-collaboration/dist/index.js';import{Compressor as _0x1a7220}from'@ckeditor/ckeditor5-operations-compressor/dist/index.js';import{isElement as _0x53eb4c}from'lodash-es';class c extends _0x54552e{static ['WebSocketGateway']=/* #__PURE__ -- @preserve */
|
|
24
|
+
((()=>ft)());static ['initialReconnectionInterval']=0x3e8;['connection'];['_reconnectionStack'];['_shouldPluginsReconnect'];['_domEmitter'];static get['requires'](){return['CloudServices',_0x43f411];}static get['pluginName'](){return'WebSocketGateway';}constructor(_0x97f354){super(_0x97f354),this['set']('state',_0x49bf8d['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=Object['create'](_0x3dd186);}['init'](){const _0x197210=this['context'],_0x5f57cd=_0x197210['plugins']['get']('CloudServices'),_0x21d5ea=_0x197210['plugins']['get'](_0x43f411);if(!_0x5f57cd['token'])throw new _0x331448('websocketgateway-missing-token',this);if(!_0x5f57cd['webSocketUrl'])throw new _0x331448('websocketgateway-missing-websocket-url',this);return this['_domEmitter']['listenTo'](window,'offline',()=>this['_isBrowserOffline']=!0x0),this['_domEmitter']['listenTo'](window,'online',()=>this['_isBrowserOffline']=!0x1),this['context']['config']['define']('cloudServices.connectionTimeout',0xa),this['context']['config']['define']('cloudServices.requestTimeout',0x14),c['WebSocketGateway']['connect'](_0x5f57cd['token'],_0x5f57cd['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0xe00207=>{if(this['connection']=_0xe00207,this['bind']('state')['to'](_0xe00207,'state',this,'_isBrowserOffline',(_0x149c82,_0x59a778)=>('connected'!==_0x149c82&&(this['_shouldPluginsReconnect']=!0x0),_0x59a778||_0x149c82!==_0x49bf8d['CONNECTED']?_0x49bf8d['DISCONNECTED']:this['state']==_0x49bf8d['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),_0x49bf8d['CONNECTING']):_0x49bf8d['CONNECTED'])),this['connection']['on']('error',(_0xb9aacc,_0xa7a7e6)=>{if('limitExceeded'!==_0xa7a7e6['code'])throw console['error'](_0xa7a7e6),new _0x331448('cloudservices-init',null,{'originalError':_0xa7a7e6});_0x21d5ea['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'});}),!_0xe00207['me'])return new Promise(_0x5e651e=>_0xe00207['on']('change:me',_0x5e651e));})['catch'](_0x32396e=>{throw console['error'](_0x32396e),new _0x331448('cloudservices-init',null,{'originalError':_0x32396e});});}['addToReconnectionStack'](_0x31d2fb){if('function'!=typeof _0x31d2fb['reconnect'])throw new _0x331448('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0x31d2fb))throw new _0x331448('websocketgateway-plugin-already-registered',this,{'name':_0x31d2fb['constructor']['pluginName']});this['_reconnectionStack']['add'](_0x31d2fb);}['removeFromReconnectionStack'](_0x41b635){this['_reconnectionStack']['delete'](_0x41b635);}['isInReconnectionStack'](_0x316953){return this['_reconnectionStack']['has'](_0x316953);}['_reconnect'](){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0xbb71ce=>_0xbb71ce['reconnect']())))['then'](()=>this['state']=_0x49bf8d['CONNECTED'])['catch'](_0x4801d9=>{throw console['error'](_0x4801d9),new _0x331448('cloudservices-reconnection-error',this['context']);});}['destroy'](){this['connection']&&this['connection']['disconnect'](),this['state']=_0x49bf8d['DISCONNECTED'],this['_domEmitter']['stopListening'](),super['destroy']();}}class r extends _0x54552e{['channelSessions'];['channelConnectedUsers'];['allConnectedUsers'];['_registeredSessions'];['_uniqueUsersCount'];['_users'];static get['pluginName'](){return'Sessions';}static get['requires'](){return[c,_0x11d8ec];}constructor(_0xb2bac){super(_0xb2bac),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0x1ef5f7(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x11d8ec);}['init'](){const _0x83a2ac=this['context']['plugins']['get'](c);this['listenTo'](_0x83a2ac,'change:state',(_0x76369b,_0x1cc4ef,_0x1164c4)=>{if('connected'!==_0x1164c4)this['channelSessions']['forEach'](_0x2d2515=>_0x2d2515['clear']()),this['channelConnectedUsers']['forEach'](_0x4baab2=>_0x4baab2['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x2a7749,_0x2bb3c0]of this['_registeredSessions'])for(const _0x1e645e of _0x2bb3c0)this['_handleSessionAdd'](_0x2a7749,_0x1e645e);}}),this['_createUser'](_0x83a2ac['connection']['me'],!0x0);}['register'](_0x5f3f7b,_0x3d9468){if(this['_registeredSessions']['has'](_0x5f3f7b))throw new _0x331448('sessions-register-already-registered',null,{'channelId':_0x5f3f7b});this['_registeredSessions']['set'](_0x5f3f7b,_0x3d9468),this['channelSessions']['set'](_0x5f3f7b,new _0x1ef5f7()),this['channelConnectedUsers']['set'](_0x5f3f7b,new _0x1ef5f7()),this['listenTo'](_0x3d9468,'add',(_0xbf6799,_0x59afbe)=>this['_handleSessionAdd'](_0x5f3f7b,_0x59afbe)),this['listenTo'](_0x3d9468,'remove',(_0x978a59,_0x5bb598)=>this['_handleSessionRemove'](_0x5f3f7b,_0x5bb598));for(const _0x1a8379 of _0x3d9468)this['_handleSessionAdd'](_0x5f3f7b,_0x1a8379);}['unregister'](_0x2df286){if(!this['_registeredSessions']['has'](_0x2df286))throw new _0x331448('sessions-unregister-not-exist',null,{'channelId':_0x2df286});const _0x225628=this['_registeredSessions']['get'](_0x2df286);this['stopListening'](_0x225628);for(const _0x212964 of _0x225628)'connected'===this['context']['plugins']['get'](c)['state']&&this['_handleSessionRemove'](_0x2df286,_0x212964);this['_registeredSessions']['delete'](_0x2df286),this['channelSessions']['delete'](_0x2df286),this['channelConnectedUsers']['delete'](_0x2df286);}get['mySessionId'](){return this['context']['plugins']['get'](c)['connection']['sessionId'];}['getUserBySessionId'](_0x4dad56){for(const _0x40b034 of this['channelSessions']['values']())for(const _0x22107f of _0x40b034)if(_0x22107f['id']===_0x4dad56)return _0x22107f['user'];}['getUserSessions'](_0x5f3551,_0x1a7991){const _0x50c61e=_0x1a7991?[this['channelSessions']['get'](_0x1a7991)]:this['channelSessions']['values'](),_0x5699b6=new Set();for(const _0x1fce85 of _0x50c61e)for(const _0x3b0d33 of _0x1fce85)_0x3b0d33['user']['id']===_0x5f3551['id']&&_0x5699b6['add'](_0x3b0d33['id']);return _0x5699b6;}['getUserRole'](_0x293a95){for(const _0x1ea6e7 of this['channelSessions']['values']())for(const _0x42220b of _0x1ea6e7)if(_0x42220b['user']===_0x293a95)return _0x42220b['role'];}['_handleSessionAdd'](_0x9879be,_0x1eb0fd){if('connected'!==this['context']['plugins']['get'](c)['state'])return;const _0x5d675c=_0x1eb0fd['user'],_0x4521db=this['_users']['getUser'](_0x5d675c['id'])||this['_createUser'](_0x5d675c),_0x4ffda0=Object['assign']({},_0x1eb0fd,{'user':_0x4521db});this['channelSessions']['get'](_0x9879be)['add'](_0x4ffda0);const _0x5f16ef=this['channelConnectedUsers']['get'](_0x9879be);_0x5f16ef['has'](_0x4521db['id'])||_0x5f16ef['add'](_0x4521db),this['allConnectedUsers']['has'](_0x4521db['id'])||this['allConnectedUsers']['add'](_0x4521db,_0x4521db['isMe']?0x0:void 0x0),this['fire']('sessionAdd:'+_0x9879be,{'channelId':_0x9879be,'session':_0x4ffda0});}['_handleSessionRemove'](_0x48ac61,_0x46f30c){if('connected'!==this['context']['plugins']['get'](c)['state'])return;const _0x374884=this['channelConnectedUsers']['get'](_0x48ac61),_0x405808=_0x46f30c['user'];_0x405808['id']&&(this['channelSessions']['get'](_0x48ac61)['remove'](_0x46f30c['id']),_0x374884['has'](_0x405808['id'])&&!this['getUserSessions'](_0x405808,_0x48ac61)['size']&&_0x374884['remove'](_0x405808['id']),this['allConnectedUsers']['get'](_0x405808['id'])&&!this['getUserSessions'](_0x405808)['size']&&this['allConnectedUsers']['remove'](_0x405808['id']));}['_createUser'](_0x3c7a5d,_0x2a4616){const _0x485ded=this['_users']['addUser'](_0x3c7a5d);return _0x2a4616&&this['_users']['defineMe'](_0x3c7a5d['id']),_0x485ded['orderNumber']=this['_uniqueUsersCount']++,_0x485ded;}}class P extends _0x360d0e{['_domEmitter']=new(_0x3dd186())();static get['requires'](){return[r];}static get['pluginName'](){return'UserMarkers';}['init'](){const _0x2567b5=this['editor'],_0x4e7ba3=_0x2567b5['plugins']['get'](r);_0x2567b5['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x5359cd,{writer:_0x1bb24b})=>function(_0x40d2f0,_0x25c10a,_0x2a79e7,_0x39c738){const _0x52b5da=_0x40d2f0['markerName']['split'](':')[0x2],_0x1f5fe8=_0x2a79e7['getUserBySessionId'](_0x52b5da);if(!_0x1f5fe8||_0x52b5da===_0x2a79e7['mySessionId'])return;if(!_0x39c738['model']['schema']['checkChild'](_0x40d2f0['markerRange']['start'],'$text'))return;const _0x5a5a1e={'class':'ck-user__marker\x20'+_0x1f5fe8['color']['getMarkerClass'](),'data-name':_0x1f5fe8['name'],'data-session-id':_0x52b5da},_0x23cd93=_0x39c738['model']['markers']['get'](_0x40d2f0['markerName']),_0x232e31=_0x23cd93['getStart'](),_0x50dd56=_0x232e31['nodeAfter'],_0x26b028=_0x39c738['model']['schema'];if(_0x50dd56&&_0x26b028['isObject'](_0x50dd56)&&_0x26b028['isInline'](_0x50dd56)&&!_0x39c738['model']['markers']['get']('user:range:'+_0x52b5da)['getRange']()['isCollapsed'])return;const _0x3d5d63=_0x232e31['parent'];return _0x39c738['model']['schema']['isLimit'](_0x3d5d63)&&!_0x39c738['model']['hasContent'](_0x3d5d63)&&(_0x5a5a1e['contenteditable']=!0x1),function(_0x3caf54,_0x268ca4,_0x5ae3f8){const _0x5223ab=_0x3caf54['createUIElement']('span',_0x268ca4);return _0x3caf54['setCustomProperty']('userPositionMarker',!0x0,_0x5223ab),_0x5223ab['render']=function(_0x495c88){const _0x5e3f4e=this['toDomElement'](_0x495c88);return _0x5e3f4e['innerHTML']='<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span><span\x20class=\x22ck-user__marker-tooltip\x22\x20contenteditable=\x22false\x22\x20spellcheck=\x22false\x22>'+_0x5ae3f8['name']+'</span>',_0x5e3f4e['addEventListener']('mouseenter',()=>{_0x5e3f4e['classList']['add']('ck-user__marker_hovered');}),_0x5e3f4e['addEventListener']('mouseleave',()=>{_0x5e3f4e['classList']['remove']('ck-user__marker_hovered');}),_0x5e3f4e;},_0x5223ab['isSimilar']=function(_0x32d503){return!(!this['getCustomProperty']('userPositionMarker')||!_0x32d503['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0x32d503['getAttribute']('data-session-id'));},_0x5223ab;}(_0x25c10a,_0x5a5a1e,_0x1f5fe8);}(_0x5359cd,_0x1bb24b,_0x4e7ba3,_0x2567b5)}),_0x2567b5['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0x3e97a8=>function(_0x4c233b,_0x37a9cc){const _0x1ed703=_0x4c233b['markerName']['split'](':')[0x2];if(_0x1ed703===_0x37a9cc['mySessionId'])return null;const _0x21cc85=_0x37a9cc['getUserBySessionId'](_0x1ed703);if(!_0x21cc85)return{'id':_0x1ed703,'classes':[]};return{'id':_0x1ed703,'classes':['ck-user__selection',_0x21cc85['color']['getSelectionClass']()],'attributes':{'data-session-id':_0x1ed703},'priority':0x7d0+_0x21cc85['orderNumber']};}(_0x3e97a8,_0x4e7ba3)}),function(_0x390297){const _0x165c38=_0x390297['model'],_0x58ea37=new Map(),_0x5a8d26=_0x390297['plugins']['get'](r);_0x165c38['markers']['on']('update:user:range',(_0x41e318,_0xe5e8c6,_0x38384d,_0x2ee144)=>{if(!_0x2ee144&&_0x58ea37['get'](_0xe5e8c6['name']))return _0x58ea37['get'](_0xe5e8c6['name'])['detach'](),void _0x58ea37['delete'](_0xe5e8c6['name']);const _0x40f29b=_0xe5e8c6['name']['split'](':')[0x2];if(_0x40f29b===_0x5a8d26['mySessionId'])return;const _0x2e1280='user:position:'+_0x40f29b;_0x165c38['markers']['has'](_0x2e1280)&&_0x390297['editing']['reconvertMarker'](_0x2e1280),_0xe5e8c6['on']('change:range',(_0x22f4dd,_0x3e2831,_0x354657)=>{if('$graveyard'!=_0x3e2831['root']['rootName']&&'$graveyard'==_0xe5e8c6['getRange']()['root']['rootName']&&!_0x58ea37['has'](_0xe5e8c6['name'])){const _0x11297c=_0x165c38['schema']['getNearestSelectionRange'](_0x354657['deletionPosition']);if(_0x11297c){const _0xbdba82=ut['fromRange'](_0x11297c);_0x58ea37['set'](_0xe5e8c6['name'],_0xbdba82),_0xbdba82['on']('change:range',(_0x2df3ed,_0x2b6033,_0x51f0e0)=>{if('$graveyard'==_0xbdba82['root']['rootName']){const _0x4a2099=_0x165c38['schema']['getNearestSelectionRange'](_0x51f0e0['deletionPosition']);_0x4a2099?(_0xbdba82['start']=_0x4a2099['start'],_0xbdba82['end']=_0x4a2099['end']):(_0x58ea37['delete'](_0xe5e8c6['name']),_0xbdba82['detach']());}});}}});}),_0x165c38['document']['on']('change',()=>{_0x58ea37['size']>0x0&&_0x165c38['enqueueChange']({'isUndoable':!0x1},_0xb872ea=>{for(const [_0x5e2a59,_0x1953f4]of _0x58ea37)'$graveyard'==_0x165c38['markers']['get'](_0x5e2a59)['getRange']()['root']['rootName']&&(G(_0x5e2a59['split'](':')[0x2],_0x1953f4['toRange'](),_0x165c38,_0xb872ea),_0x1953f4['detach']());_0x58ea37['clear']();});});}(_0x2567b5),this['_domEmitter']['listenTo'](_0x31593e['document'],'keydown',(_0x1f5132,{key:_0x389104})=>{'Escape'===_0x389104&&function(_0x2566e0){_0x2566e0['editing']['view']['change'](_0x191d37=>{for(const _0x3979b5 of _0x2566e0['model']['markers']){if(!_0x3979b5['name']['startsWith']('user:position'))continue;const _0x2cb77f=_0x2566e0['editing']['mapper']['markerNameToElements'](_0x3979b5['name']);if(_0x2cb77f){for(const _0x1ccf29 of _0x2cb77f)_0x191d37['removeClass']('ck-user__marker_hovered',_0x1ccf29);}}});}(_0x2567b5);},{'useCapture':!0x0});}['afterInit'](){const _0x5b1da3=this['editor'],_0x1ec1c5=_0x5b1da3['commands']['get']('undo');_0x1ec1c5&&_0x5b1da3['model']['on']('applyOperation',(_0x37ffb4,_0x4ca071)=>{const _0x3c7b20=_0x4ca071[0x0];if('marker'!=_0x3c7b20['type']||!_0x3c7b20['name']['startsWith']('user:'))return;const _0x5b5464=_0x3c7b20['batch'];_0x1ec1c5['_createdBatches']['has'](_0x5b5464)&&(_0x3c7b20['newRange']=_0x3c7b20['oldRange']?_0x5b1da3['model']['createRange'](_0x3c7b20['oldRange']['start'],_0x3c7b20['oldRange']['end']):null);},{'priority':'highest'});}['destroy'](){return this['_domEmitter']['stopListening'](),super['destroy']();}['createUserMarkerOperations'](){const _0x330004=this['editor'],_0x120cec=_0x330004['model']['document'],_0x4c18dc=_0x330004['plugins']['get'](r);_0x330004['model']['enqueueChange']({'isUndoable':!0x1},_0x132da8=>{const _0x30a6b9='user:range:'+_0x4c18dc['mySessionId'],_0x215fec='user:position:'+_0x4c18dc['mySessionId'],_0x181668=_0x330004['model']['markers']['has'](_0x30a6b9);_0x330004['editing']['view']['hasDomSelection']?G(_0x4c18dc['mySessionId'],_0x120cec['selection']['getFirstRange'](),_0x330004['model'],_0x132da8):_0x181668&&(_0x132da8['removeMarker'](_0x30a6b9),_0x132da8['removeMarker'](_0x215fec));});}}function G(_0x13f734,_0x9d4209,_0x571b29,_0x16b211){const _0x471e03='user:range:'+_0x13f734,_0x1deaf4='user:position:'+_0x13f734,_0x2079cc=_0x9d4209['getContainedElement']();let _0x5df9d4=_0x9d4209['start'];_0x2079cc&&_0x2079cc['is']('element','tableCell')&&(_0x5df9d4=function(_0x1bd06c,_0x24df9f){for(const _0x2c8a07 of _0x1bd06c['getPositions']())if(_0x24df9f['schema']['checkChild'](_0x2c8a07,'$text'))return _0x2c8a07;}(_0x9d4209,_0x571b29),_0x9d4209=_0x16b211['createRange'](_0x5df9d4));const _0x1a1e56=_0x16b211['createRange'](_0x5df9d4);_0x571b29['markers']['has'](_0x471e03)?(_0x16b211['updateMarker'](_0x471e03,{'range':_0x9d4209}),_0x16b211['updateMarker'](_0x1deaf4,{'range':_0x1a1e56})):(_0x16b211['addMarker'](_0x471e03,{'range':_0x9d4209,'usingOperation':!0x0}),_0x16b211['addMarker'](_0x1deaf4,{'range':_0x1a1e56,'usingOperation':!0x0}));}function E(_0x3acc9d,_0x56be88,_0x48a98d){const t=_0x3acc9d['t'];switch(_0x56be88){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 t({'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'},_0x48a98d);default:return'';}}let M=0x1;class l extends _0x360d0e{static ['CollaborativeEditingService']=/* #__PURE__ -- @preserve */
|
|
25
|
+
((()=>_0x3f90c9)());['_offset'];['sessionId'];['serverHistory'];['_channelId'];['_service'];['_document'];['_compressor'];['_bufferedOperations'];['_knownOperations'];['_knownRootNames'];['_pendingAction'];['_hasSelectionChanged'];['_sendBufferedOperationsDelayId'];['_baseBufferDelay'];['_currentBufferDelay'];['_lastSyncedOperationId'];['_disconnectionOperations'];['_operationIdentifier'];static get['requires'](){return[c,r,P,_0x1d975a,_0x11d8ec,_0x43f411];}static get['pluginName'](){return'RealTimeCollaborationClient';}get['cloudDocumentVersion'](){return this['_lastServerVersion']+this['_offset'];}get['_lastServerVersion'](){return this['serverHistory']['version']-this['_offset'];}get['lastSyncVersion'](){const _0x8058c7=this['serverHistory']['getOperations']();for(let _0x3ab0f0=_0x8058c7['length']-0x1;_0x3ab0f0>=0x0;_0x3ab0f0--){const _0x2cb186=_0x8058c7[_0x3ab0f0];if(!this['_disconnectionOperations']['has'](_0x2cb186))return _0x2cb186['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0x1189da){if(super(_0x1189da),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x3b1fea(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0x331448('collaboration-missing-channelid',this);const _0x474cd5=_0x1189da['config']['get']('cloudServices.bundleVersion')||ht;this['_service']=new l['CollaborativeEditingService'](_0x474cd5,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0x1a7220(),this['_bufferedOperations']=[],this['_knownOperations']=new WeakSet(),this['_knownRootNames']=new Set(),this['set']('_isPendingUpdate',!0x1),this['set']('_hasSynchronizationProblem',!0x1),this['_pendingAction']=null,this['_hasSelectionChanged']=!0x1,this['_sendBufferedOperationsDelayId']=null,this['_baseBufferDelay']=0x12c,this['_currentBufferDelay']=this['_baseBufferDelay'],this['_lastSyncedOperationId']=null,this['_disconnectionOperations']=new WeakSet(),this['_operationIdentifier']=new W(this['_disconnectionOperations']);}['init'](){const _0x36b4f1=this['editor'],_0x25ddea=_0x36b4f1['plugins']['get'](_0x11d8ec),_0x237839=_0x36b4f1['plugins']['get'](c);this['listenTo'](_0x25ddea,'getOperationAuthor',(_0x1a0bd2,_0x406d99)=>{const _0x36ec73=_0x406d99[0x0];_0x36ec73['_authorId']&&(_0x1a0bd2['return']=_0x25ddea['getUser'](_0x36ec73['_authorId']),_0x1a0bd2['stop']()),null===_0x36ec73['_authorId']&&(_0x1a0bd2['return']=null,_0x1a0bd2['stop']());},{'priority':'high'}),this['listenTo'](_0x36b4f1['model']['document']['selection'],'change:range',(_0x83c4f6,_0x4686c7)=>{_0x4686c7['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x36b4f1['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x36b4f1['model']['on']('applyOperation',(_0x4cc7a7,_0x48a7d9)=>{const _0x4af8ab=_0x48a7d9[0x0];_0x4af8ab['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0x4af8ab),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['bind']('_isEditingAllowed')['to'](_0x237839,'state',this,'_hasSynchronizationProblem',(_0x4c065f,_0x2659c3)=>'connected'===_0x4c065f&&!_0x2659c3),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x36b4f1['disableReadOnlyMode']('rtc-offline'):_0x36b4f1['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x36b4f1['disableReadOnlyMode']('rtc-offline'):_0x36b4f1['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async['reconnect'](){const _0xcf9f8f=this['editor']['plugins']['get'](r),_0x30a73f=this['editor']['plugins']['get'](c);try{this['_isPendingUpdate']=!0x0,_0xcf9f8f['unregister'](this['_channelId']);const _0x27fe76=await this['_service']['reconnect'](_0x30a73f['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0x27fe76)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x10f54f=await this['_service']['getConnectedSessions']();_0xcf9f8f['register'](this['_channelId'],_0x10f54f),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0xc07ac0){if(function(_0x292916){return'404'===_0x292916['code'];}(_0xc07ac0)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0x4714fc){return'409'===_0x4714fc['code'];}(_0xc07ac0)){const _0x3b1b44=E(this['editor']['locale'],'The\x20document\x20cannot\x20be\x20connected\x20back\x20to\x20the\x20server.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.');this['_handleReconnectionError'](_0x3b1b44);}else{if(!(_0xc07ac0 instanceof z))throw _0xc07ac0;this['_handleReconnectionError']();}}}}['destroy'](){const _0x2c74f0=this['editor']['plugins']['get'](c),_0x268166=this['editor']['plugins']['get'](r);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x268166['channelSessions']['has'](this['_channelId'])&&_0x268166['unregister'](this['_channelId']),_0x2c74f0['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async['_handleReconnectionResponse'](_0x223c9b){if(this['sessionId']!==_0x223c9b['sessionId']&&this['_lastSyncedOperationId']!==_0x223c9b['lastOperationId'])throw new z();return this['sessionId']=_0x223c9b['sessionId'],this['_handleServerResponse']([],{..._0x223c9b,'wereChangesApplied':!0x1,'data':_0x223c9b['data']},'reconnect');}async['_connectService'](_0x21569f,_0x553682=!0x1){const {connection:_0xfc986b}=this['editor']['plugins']['get'](c);l['CollaborativeEditingService']['getConnectedSessions'](_0xfc986b,this['_channelId'])['then'](_0x35135c=>this['_initSessionsHandling'](_0x35135c))['catch'](_0x1de686=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x1de686);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x4aac0d,_0x5b1e8e)=>{this['_crash']('realtimecollaborationclient-initservice-internal-error',_0x5b1e8e);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_isConnected']=!0x1;});const _0xef6085=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x21569f);this['_isPendingUpdate']=!0x0;const _0x15606e=await this['_service']['connect'](_0xfc986b,this['_compressOperations'](_0x21569f),_0xef6085);if(this['sessionId']=_0x15606e['sessionId'],_0x553682){if(!_0x15606e['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x15606e['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0x21569f,_0x15606e,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x15606e,_0x21569f);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}['_handleSendingSelectionMarkers'](){const _0xb78d32=this['editor']['plugins']['get'](r),_0x3e9e9f=this['editor']['plugins']['get'](P),_0x59aa53=_0xb78d32['channelSessions']['get'](this['_channelId']);_0x59aa53&&_0x59aa53['length']>0x1?_0x3e9e9f['createUserMarkerOperations']():this['listenTo'](_0xb78d32,'sessionAdd:'+this['_channelId'],()=>{0x2===_0xb78d32['channelSessions']['get'](this['_channelId'])['length']&&_0x3e9e9f['createUserMarkerOperations']();});}async['_handleReceivedOperations'](_0x3d3b79,_0x4a777d,_0x513b7d,_0x91643a){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x4a777d){const _0x1e229a=this['_decompressOperations'](_0x513b7d,_0x91643a);await this['_fetchMissingUsers'](_0x1e229a),this['_handleExternalOperations'](_0x1e229a,_0x4a777d,_0x513b7d['lastOperationId'])||this['_crash']('realtimecollaborationclient-initservice-incorrect-server-operation');}}async['_connectAfterSessionHasBeenFlushed'](){this['_disconnectService']();const {locale:_0x1952fe}=this['editor'];let _0x168aab;try{_0x168aab=await this['_service']['getDocumentDetails']();}catch(_0x3d379f){const _0x3b632a=E(_0x1952fe,'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'](_0x3b632a);}const _0x429756=_0x168aab['currentDocumentSession']||_0x168aab['lastDocumentSession'];if(this['_lastSyncedOperationId']===_0x429756['lastOperationId'])await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);else{const _0x20919d=E(_0x1952fe,'The\x20last\x20saved\x20version\x20of\x20the\x20document\x20does\x20not\x20match\x20the\x20local\x20version.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.');this['_handleReconnectionError'](_0x20919d);}}['_disconnectService'](){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['stopListening'](this['_service']);}['_initSessionsHandling'](_0x4f28e8){const _0x212143=this['editor']['plugins']['get'](r);this['listenTo'](_0x212143,'sessionAdd:'+this['_channelId'],(_0x3f5ec7,{session:_0x55056c})=>{if(_0x55056c['id']===_0x212143['mySessionId']){_0x3f5ec7['off']();const _0xaa18d1=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0x2185e8=_0x55056c['permissions'];_0xaa18d1&&_0xaa18d1['isEnabled']&&(_0x2185e8=_0x2185e8['filter'](_0xaa0ecd=>'document:write'!==_0xaa0ecd)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0x2185e8,this['_channelId']);}}),_0x212143['register'](this['_channelId'],_0x4f28e8);}['_initThrowingOnDataSet'](){const _0x32d9ea=this['editor']['data']['set'];this['editor']['data']['set']=(..._0xf886a0)=>{if(!_0xf886a0[_0xf886a0['length']-0x1]['suppressErrorInCollaboration'])throw new _0x331448('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x32d9ea['apply'](this['editor']['data'],_0xf886a0);};}['_setUpDataInit'](){this['editor']['data']['on']('init',(_0x5da055,[_0x370bb7])=>{if(this['_document']['version'])throw new _0x331448('realtimecollaborationclient-init-document-already-initialized',this);_0x5da055['stop'](),this['_setPendingAction']();const _0x355ec0=this['editor']['config']['get']('rootsAttributes'),_0x316e96=this['_getOperationsFromInitData'](_0x370bb7,_0x355ec0);0x0==_0x316e96['length']&&_0x316e96['push'](new _0x34c6af(0x0)),_0x5da055['return']=this['_connectService'](_0x316e96)['then'](()=>{this['editor']['plugins']['get'](c)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x5a4690=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x5a4690))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x564671,[_0x2a9c2e,_0x6480a0])=>{_0x564671['stop']();const _0x480331=this['editor']['model']['document']['getRoot'](_0x2a9c2e);if(!this['_knownRootNames']['has'](_0x2a9c2e)){const _0xd83ad2=_0x6480a0&&_0x6480a0['data']?_0x6480a0['data']:'',_0x4f1b8c=_0x6480a0&&_0x6480a0['attributes']?_0x6480a0['attributes']:{};await this['_loadRoot'](_0x2a9c2e,_0xd83ad2,_0x4f1b8c);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0x480331['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0x480331);});},{'priority':'high'});}async['_fetchMissingUsers'](_0xa983d2){const _0xbde187=this['editor']['plugins']['get'](_0x11d8ec),{connection:_0x41c2d1}=this['editor']['plugins']['get'](c),_0x17b592=new Set();for(const _0x3076dc of _0xa983d2){const _0x1002af=_0x3076dc['_authorId'];_0x1002af&&!_0xbde187['getUser'](_0x1002af)&&_0x17b592['add'](_0x1002af);}if(0x0===_0x17b592['size'])return;const _0x31493f=await mt['getMany'](_0x41c2d1,Array['from'](_0x17b592));for(const _0x32ba93 of _0x31493f)_0xbde187['getUser'](_0x32ba93['id'])||_0xbde187['addUser'](_0x32ba93);}['_getOperationsFromInitData'](_0x3b6454,_0x2dabf8={}){const _0x38d862=this['editor']['model'],_0x17472e=[];let _0x487ce9=0x0;const _0x156d62='string'==typeof _0x3b6454?{'main':_0x3b6454}:_0x3b6454;for(const _0x2fd359 of Object['keys'](_0x156d62)){if(!this['_document']['roots']['has'](_0x2fd359))throw new _0x331448('realtimecollaborationclient-init-non-existent-root',this);const _0x33524f=this['editor']['data']['parse'](_0x156d62[_0x2fd359]),_0x381b06=this['_document']['getRoot'](_0x2fd359),_0x2e2fca=new _0x44b2e5(_0x38d862['createPositionAt'](_0x381b06,0x0),_0x33524f,_0x487ce9++);_0x17472e['push'](_0x2e2fca);for(const [_0xfa554d,_0x1e13f2]of _0x33524f['markers']){const _0x59380d=_0x38d862['createRange'](_0x38d862['createPositionFromPath'](_0x381b06,_0x1e13f2['start']['path']['slice']()),_0x38d862['createPositionFromPath'](_0x381b06,_0x1e13f2['end']['path']['slice']())),_0x237547=new _0x32b787(_0xfa554d,null,_0x59380d,_0x38d862['markers'],!0x0,_0x487ce9++);_0x17472e['push'](_0x237547);}}if(_0x2dabf8)for(const [_0xb063ad,_0x380e19]of Object['entries'](_0x2dabf8)){const _0x246b04=_0x38d862['document']['getRoot'](_0xb063ad);if(!_0x246b04)throw new _0x331448('multi-root-editor-root-attributes-no-root',null);for(const [_0x2f0bab,_0x51f970]of Object['entries'](_0x380e19))if(null!==_0x51f970){const _0x46996e=new _0x5c3499(_0x246b04,_0x2f0bab,null,_0x51f970,_0x487ce9++);_0x17472e['push'](_0x46996e);}}return _0x17472e;}async['_loadRoot'](_0x398a82,_0x4a328d,_0x48dfc3){this['_getOperationsFromInitData']({[_0x398a82]:_0x4a328d},{[_0x398a82]:_0x48dfc3})['forEach']((_0x53dd38,_0x28e338)=>{_0x53dd38['baseVersion']=this['_document']['version']+_0x28e338,_0x53dd38['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x53dd38);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async['_handleInitialConnectionData'](_0x345306,_0x5d7d42){let _0x2c2802;this['_offset']=_0x345306['offset'];const _0x5cdf93=_0x345306['wereChangesApplied']&&!_0x345306['initData'],_0x5ce4bf=_0x5cdf93?0x0:_0x345306['data']['baseVersion'];if(_0x5d7d42['forEach'](_0x1e369a=>{_0x1e369a['_isInit']=!0x0,_0x1e369a['createdAt']=_0x345306['sessionCreatedAt'],_0x1e369a['_authorId']=null;}),_0x5cdf93)_0x2c2802=_0x5d7d42,this['_applyOperationsSet'](_0x2c2802,_0x5cdf93);else{if(_0x345306['initData']){const _0x2b490a=this['_getOperationsFromInitData'](_0x345306['initData']);this['_document']['history']['version']=-_0x2b490a['length'],_0x2b490a['forEach'](_0x3e276c=>{_0x3e276c['baseVersion']-=_0x2b490a['length'],_0x3e276c['createdAt']=_0x345306['sessionCreatedAt'],_0x3e276c['_isInit']=!0x0,_0x3e276c['_authorId']=null;}),this['_applyOperationsSet'](_0x2b490a,!0x0),this['serverHistory']['version']=-_0x2b490a['length']+this['_offset'],this['_updateServerHistory'](_0x2b490a);}this['_document']['history']['version']=_0x5ce4bf,_0x2c2802=this['_decompressOperations'](_0x345306['data'],_0x345306['metadata']),await this['_fetchMissingUsers'](_0x2c2802),this['_applyOperationsSet'](_0x2c2802,_0x5cdf93);}_0x345306['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x2c2802,_0x345306['lastOperationId']),this['_lastSyncedOperationId']=_0x345306['lastOperationId']),this['serverHistory']['version']=_0x5ce4bf+this['_offset'],this['_updateServerHistory'](_0x2c2802),_0x5d7d42['filter'](_0x3a696d=>{const _0x564e97=this['_getAffectedRoot'](_0x3a696d);return _0x564e97&&!this['_knownRootNames']['has'](_0x564e97);})['forEach']((_0x3f0c99,_0x445101)=>{_0x3f0c99['baseVersion']=this['_document']['version']+_0x445101,this['_saveOperationInBuffer'](_0x3f0c99);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x2ebd6d,_0x3f477e){throw this['_isPendingUpdate']=!0x0,_0x3f477e&&console['error'](_0x3f477e),new _0x331448(_0x2ebd6d,this['editor']);}['_saveOperationInBuffer'](_0x19cc9c){this['_knownOperations']['has'](_0x19cc9c)||(this['_knownOperations']['add'](_0x19cc9c),this['_bufferedOperations']['push'](_0x19cc9c),this['_pendingAction']||'marker'==_0x19cc9c['type']&&!_0x19cc9c['affectsData']||this['_setPendingAction']());}['_sendBufferedOperationsDelayed'](_0x1c7348=!0x1){!_0x1c7348&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0x367064=>{_0x367064&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0xb9ff62=>{if(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,!function(_0x399dfa){return _0x399dfa['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x399dfa['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0x399dfa['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0xb9ff62))throw _0xb9ff62;});},this['_currentBufferDelay']));}['_waitUntilSynced'](){return new Promise(_0x55bfa3=>{this['on']('change:_isPendingUpdate',()=>{_0x55bfa3();});});}async['_sendBufferedOperations'](){const _0x33cdb4=this['editor']['plugins']['get'](P);if(this['_shouldSendSelectionUpdate']()&&(_0x33cdb4['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x215739=[...this['_bufferedOperations']];for(const _0x5f57e5 of _0x215739)_0x5f57e5['wasUndone']=this['_document']['history']['isUndoneOperation'](_0x5f57e5);const _0x51013d=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x215739),_0x2e757a=M++,_0x49afcc=this['_compressOperations'](_0x215739),_0x272da4=await this['_service']['sendOperations'](_0x49afcc,_0x49afcc['baseVersion'],_0x51013d);try{return await this['_handleServerResponse'](_0x215739,_0x272da4,_0x2e757a);}catch(_0x3a450d){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0x3a450d);}}async['_handleServerResponse'](_0x426a5a,_0x5c11da,_0xfe8611){if('error'in _0x5c11da)throw _0x5c11da['error'];let _0x1fdba5=!0x1;if(_0x5c11da['wereChangesApplied']){_0x5c11da['lastOperationId']&&(this['_lastSyncedOperationId']=_0x5c11da['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x30f6fb=>!_0x426a5a['includes'](_0x30f6fb));for(const _0x113308 of _0x426a5a)_0x113308['createdAt']='lastOperationAcceptedAt'in _0x5c11da&&_0x5c11da['lastOperationAcceptedAt']||void 0x0;V(_0x426a5a,_0x5c11da['version']-_0x426a5a['length']),this['_updateServerHistory'](_0x426a5a);const _0x44d7fe=_0x426a5a['filter'](_0x43e83d=>{if(!_0x43e83d['_isInit'])return!0x1;const _0x167864=this['_getAffectedRoot'](_0x43e83d);return _0x167864&&!this['_knownRootNames']['has'](_0x167864);});V(_0x44d7fe,this['_document']['version']),this['_applyOperationsSet'](_0x44d7fe),_0x1fdba5=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0x421a98=this['_decompressOperations'](_0x5c11da['data'],_0x5c11da['metadata'])['filter'](_0x413356=>_0x413356['baseVersion']>=this['_lastServerVersion']);_0x421a98['forEach'](_0x22f775=>this['_addKnownRoot'](_0x22f775)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x8f83ee=>!_0x8f83ee['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x8f83ee))),this['_bufferedOperations']['length']&&V(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0x421a98),_0x1fdba5=this['_handleExternalOperations'](_0x421a98,_0x5c11da['version'],_0x5c11da['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x1fdba5?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}['_handleExternalOperations'](_0x136fca,_0x1a05e1,_0x1e1196){try{const _0x51c97f={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x151043,operationsB:_0x58356d,originalOperations:_0x1ee0e6}=_0x27b1de(_0x136fca,this['_bufferedOperations'],_0x51c97f);V(_0x151043,this['_document']['version']),V(_0x58356d,_0x1a05e1);for(const _0x1debb1 of _0x151043){const _0x1db163=_0x1ee0e6['get'](_0x1debb1);_0x1debb1['_authorId']=_0x1db163?_0x1db163['_authorId']:null;}_0x1e1196&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x136fca,_0x1e1196),this['_lastSyncedOperationId']=_0x1e1196),this['_bufferedOperations']=[..._0x58356d],this['_applyOperationsSet'](_0x151043),this['_updateServerHistory'](_0x136fca);}catch(_0x39f93a){return console['error'](_0x39f93a),!0x1;}return!0x0;}['_applyOperationsSet'](_0x491786,_0x455d6c=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0x43d8a8=>{for(const _0x1a7cdc of _0x491786)this['_knownOperations']['add'](_0x1a7cdc),this['_addKnownRoot'](_0x1a7cdc),_0x43d8a8['batch']['addOperation'](_0x1a7cdc),this['editor']['model']['applyOperation'](_0x1a7cdc);});}['_addKnownRoot'](_0x188a70){const _0x4e956c=this['_getAffectedRoot'](_0x188a70);_0x4e956c&&this['_knownRootNames']['add'](_0x4e956c);}['_getAffectedRoot'](_0x22e1c1){let _0x3b67dd,_0x94e492;switch(_0x22e1c1['type']){case'insert':_0x3b67dd=_0x22e1c1['position']['root'];break;case'marker':if(_0x94e492=_0x22e1c1['newRange'],!_0x94e492)return null;_0x3b67dd=_0x94e492['root'];break;case'addRootAttribute':_0x3b67dd=_0x22e1c1['root'];break;case'addRoot':_0x3b67dd=_0x22e1c1['affectedSelectable'];break;case'move':_0x3b67dd=_0x22e1c1['targetPosition']['root'];break;default:return null;}return _0x3b67dd['rootName'];}['_updateServerHistory'](_0x3c7945){_0x3c7945['forEach'](_0x51583a=>{const _0x41a266=_0x51583a['clone']();_0x41a266['_authorId']=_0x51583a['_authorId'],_0x41a266['_isInit']=!!_0x51583a['_isInit'],_0x41a266['createdAt']=_0x51583a['createdAt'],_0x41a266['baseVersion']+=this['_offset'],_0x51583a['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x41a266),this['serverHistory']['addOperation'](_0x41a266);});}['_handleReconnectionError'](_0x3d047f){const _0x4b2329=this['editor']['plugins']['get']('Notification'),_0x5a4723=this['editor']['locale'];_0x3d047f||(_0x3d047f=E(_0x5a4723,'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.')),_0x4b2329['showWarning'](_0x3d047f,{'title':E(_0x5a4723,'Synchronization\x20issue'),'namespace':'real-time-collaboration'}),this['_hasSynchronizationProblem']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_bufferedOperations']=[],this['editor']['plugins']['get'](c)['destroy']();}['_setPendingAction'](){this['_pendingAction']||(this['_pendingAction']=this['editor']['plugins']['get'](_0x1d975a)['add'](E(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}['_clearPendingAction'](){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x1d975a)['remove'](this['_pendingAction']),this['_pendingAction']=null);}['_compressOperations'](_0x4e7729){const _0x33506c=_0x4e7729['map'](_0x4bc714=>_0x4bc714['toJSON']());return this['_compressor']['compress'](_0x33506c);}['_decompressOperations'](_0x4a7eb5,_0x4ff868){return this['_compressor']['decompress'](_0x4a7eb5)['map']((_0x2203c4,_0x19f311)=>{const _0x144e79='init'==_0x4ff868[_0x19f311]['type'];if('InsertOperation'==_0x2203c4['__className']){const _0x1a4012=_0x2203c4['position']['root'];!this['_document']['getRoot'](_0x1a4012)&&(this['_document']['createRoot']('$root',_0x1a4012)['_isAttached']=!0x1);}const _0x2fb0f6=_0x6f1576['fromJSON'](_0x2203c4,this['_document']);return _0x2fb0f6['wasUndone']=_0x2203c4['wasUndone'],_0x2fb0f6['_isInit']=_0x144e79,_0x2fb0f6['_authorId']=_0x144e79?null:_0x4ff868[_0x19f311]['userId'],_0x2fb0f6['_isDisconnection']='cs:removeUser'===_0x4ff868[_0x19f311]['type'],_0x2fb0f6['createdAt']=_0x4ff868[_0x19f311]['createdAt'],_0x2fb0f6;});}['_refreshUserSelectionMarkers'](){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}['_shouldSendSelectionUpdate'](){const _0x2731da=this['editor']['plugins']['get'](r)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0x2731da&&_0x2731da['length']>0x1&&this['_hasSelectionChanged'];}['_shouldSendUpdate'](){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}}class z extends Error{}function V(_0x21b147,_0x299b5f){for(const _0x45941d of _0x21b147)_0x45941d['baseVersion']=_0x299b5f++;}class W{['_ignoredOperations'];['_operationToId'];constructor(_0x3bcc0a){this['_ignoredOperations']=_0x3bcc0a,this['_operationToId']=new WeakMap();}['getIdOfTheLastOperation'](_0x4b3091){let _0x5ee7a2=_0x4b3091['length'];for(;_0x5ee7a2--;){const _0x2ccbec=_0x4b3091[_0x5ee7a2];if(!this['_ignoredOperations']['has'](_0x2ccbec)){if(!this['_operationToId']['has'](_0x2ccbec)){const _0x45df3d=_0x7076()['slice'](0x1,0x12);this['_operationToId']['set'](_0x2ccbec,_0x45df3d);}return this['_operationToId']['get'](_0x2ccbec);}}}['setIdForTheLastOperation'](_0x3708bc,_0x4095af){if(!_0x4095af)return;let _0x4817fb=_0x3708bc['length'];for(;_0x4817fb--;){const _0x59ff4b=_0x3708bc[_0x4817fb];this['_ignoredOperations']['has'](_0x59ff4b)||this['_operationToId']['set'](_0x59ff4b,_0x4095af);}}}class n extends _0x360d0e{static get['requires'](){return[l];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}}class a extends _0x54552e{static ['CommentsService']=/* #__PURE__ -- @preserve */
|
|
26
|
+
((()=>_0x3881e8)());['_services'];static get['requires'](){return[c,'CommentsRepository',r,_0x11d8ec];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}constructor(_0x8339be){super(_0x8339be),this['_services']=new Map();}async['init'](){const _0x249130=this['context'],_0x5e0cde=_0x249130['plugins']['get']('CommentsRepository');if(_0x249130['plugins']['get'](c)['addToReconnectionStack'](this),_0x5e0cde['adapter']={'addCommentThread':async({channelId:_0x24f6c0,threadId:_0x31dc46,comments:_0x3ac28f,resolvedAt:_0x1b0035,resolvedBy:_0x534f14,context:_0x12add1,attributes:_0x518d8a})=>{const _0x485781=await this['_getService'](_0x24f6c0)['addCommentThread']({'commentThreadId':_0x31dc46,'comments':_0x3ac28f['map'](_0x247f4d=>function(_0x390111,_0x468ff1,_0x5090b8){return{'commentThreadId':_0x5090b8,'commentId':_0x390111['commentId'],'userId':_0x390111['authorId'],'content':_0x390111['content'],'documentId':_0x468ff1,'createdAt':_0x390111['createdAt'],'attributes':_0x390111['attributes']||{}};}(_0x247f4d,_0x24f6c0,_0x31dc46)),'resolvedAt':_0x1b0035,'resolvedBy':_0x534f14,'context':_0x12add1,'attributes':_0x518d8a})['catch'](wt);return{'threadId':_0x485781['commentThreadId'],'comments':_0x485781['comments']};},'getCommentThread':async({channelId:_0x7731c8,threadId:_0x3c11d9})=>{const _0x3cf0ce=await this['_getService'](_0x7731c8)['getCommentThread'](_0x3c11d9)['catch'](wt);return _0x3cf0ce['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0x3cf0ce]),{'threadId':_0x3cf0ce['commentThreadId'],'comments':_0x3cf0ce['comments']['map'](b),'context':_0x3cf0ce['context'],'resolvedAt':_0x3cf0ce['resolvedAt'],'resolvedBy':_0x3cf0ce['resolvedBy'],'attributes':_0x3cf0ce['attributes']||{}});},'updateCommentThread':async({channelId:_0x402390,threadId:_0x2a6086,context:_0x1d9dac,unlinkedAt:_0x40c08f,attributes:_0x3d667c})=>this['_getService'](_0x402390)['updateCommentThread']({'commentThreadId':_0x2a6086,'context':_0x1d9dac,'attributes':_0x3d667c,'unlinkedAt':_0x40c08f})['catch'](y)['catch'](wt),'resolveCommentThread':async({channelId:_0x49be17,threadId:_0x404203})=>{const _0x7404b1=await this['_getService'](_0x49be17)['resolveCommentThread'](_0x404203)['catch'](y)['catch'](wt);return{'threadId':_0x7404b1['commentThreadId'],'resolvedAt':_0x7404b1['resolvedAt'],'resolvedBy':_0x7404b1['resolvedBy']};},'reopenCommentThread':async({channelId:_0x21fe75,threadId:_0x5bfe1})=>this['_getService'](_0x21fe75)['reopenCommentThread'](_0x5bfe1)['catch'](y)['catch'](wt),'removeCommentThread':({channelId:_0xe0fd30,threadId:_0x29bb9c})=>this['_getService'](_0xe0fd30)['removeCommentThread'](_0x29bb9c)['catch'](y)['catch'](wt),'addComment':({channelId:_0x463722,threadId:_0x2a3b4a,commentId:_0x89c302,content:_0x3192ac,attributes:_0x48f33c})=>this['_getService'](_0x463722)['addComment'](_0x2a3b4a,_0x89c302,_0x3192ac,_0x48f33c)['catch'](wt),'updateComment':({channelId:_0x44fe93,threadId:_0x344cad,commentId:_0x539636,content:_0xf8fe0b,attributes:_0x11ee59})=>this['_getService'](_0x44fe93)['updateComment'](_0x344cad,_0x539636,_0xf8fe0b,_0x11ee59)['catch'](y)['catch'](wt),'removeComment':({channelId:_0x24c053,threadId:_0x29f0c8,commentId:_0x434c62})=>this['_getService'](_0x24c053)['removeComment'](_0x29f0c8,_0x434c62)['catch'](y)['catch'](wt)},_0x249130 instanceof _0x178f2b){const _0xcc86c3=_0x249130['config']['get']('collaboration.channelId'),_0x51b4e7=_0x249130['plugins']['get'](r);await this['_setUpService'](_0xcc86c3);const _0x5bcad3=await this['_services']['get'](_0xcc86c3)['getConnectedSessions']();this['listenTo'](_0x51b4e7,'sessionAdd:'+_0xcc86c3,(_0xdf1d34,{session:_0x26d8f4})=>{_0x26d8f4['id']===_0x51b4e7['mySessionId']&&(_0xdf1d34['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x26d8f4['permissions'],_0xcc86c3));}),_0x51b4e7['register'](_0xcc86c3,_0x5bcad3);}}async['_setUpService'](_0x4989c1){if(this['_services']['has'](_0x4989c1))throw new _0x331448('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0x4989c1});const _0x5a2c59=this['context']['plugins']['get']('CommentsRepository'),_0x35c842=new a['CommentsService'](_0x4989c1);this['_services']['set'](_0x4989c1,_0x35c842),this['listenTo'](_0x35c842,'commentThreadAdded',(_0xfbff74,_0x44ed43)=>{const {commentThreadId:_0x504294,documentId:_0x10df8b,context:_0x367c8a,attributes:_0x45978a,resolvedAt:_0x5f159e,resolvedBy:_0x28b27a,comments:_0x581bf9}=_0x44ed43;_0x5a2c59['getCommentThread'](_0x504294)||_0x5a2c59['addCommentThread']({'threadId':_0x504294,'channelId':_0x10df8b,'comments':_0x581bf9?_0x581bf9['map'](b):[],'context':_0x367c8a,'attributes':_0x45978a,'resolvedAt':_0x5f159e,'resolvedBy':_0x28b27a,'isFromAdapter':!0x0});}),this['listenTo'](_0x35c842,'commentThreadUpdated',(_0x1671f0,{commentThreadId:_0x33903d,documentId:_0x17c854,context:_0x5acb4c,unlinkedAt:_0x558535,attributes:_0x462cbf})=>{_0x5a2c59['getCommentThread'](_0x33903d)&&_0x5a2c59['updateCommentThread']({'threadId':_0x33903d,'channelId':_0x17c854,'context':_0x5acb4c,'unlinkedAt':_0x558535,'attributes':_0x462cbf,'isFromAdapter':!0x0});}),this['listenTo'](_0x35c842,'commentThreadResolved',(_0x3fde63,{commentThreadId:_0x59b4de,resolvedBy:_0x4288e3,resolvedAt:_0x77f9f7})=>{const _0x1de6e4=_0x5a2c59['getCommentThread'](_0x59b4de);_0x1de6e4&&_0x1de6e4['resolve']({'resolvedBy':_0x4288e3,'resolvedAt':_0x77f9f7,'isFromAdapter':!0x0});}),this['listenTo'](_0x35c842,'commentThreadReopened',(_0x374773,{commentThreadId:_0x2c720e})=>{const _0x318ed8=_0x5a2c59['getCommentThread'](_0x2c720e);_0x318ed8&&_0x318ed8['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0x35c842,'commentThreadRemoved',(_0x4c9cdf,{commentThreadId:_0x5e9248})=>{const _0x5500bc=_0x5a2c59['getCommentThread'](_0x5e9248);_0x5500bc&&_0x5500bc['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0x35c842,'commentAdded',(_0x33c524,_0x28c969)=>{const _0x4dc778=_0x28c969['commentThreadId'],_0x1529ea=_0x5a2c59['getCommentThread'](_0x4dc778);_0x1529ea&&_0x1529ea['addComment']({...b(_0x28c969),'isFromAdapter':!0x0});}),this['listenTo'](_0x35c842,'commentUpdated',(_0x357979,{commentThreadId:_0x5b22bb,commentId:_0x31d67a,content:_0x49176c,attributes:_0x5e7cea})=>{const _0x1c168e=_0x5a2c59['getCommentThread'](_0x5b22bb);if(_0x1c168e){const _0x3732c4=_0x1c168e['getComment'](_0x31d67a);_0x3732c4&&_0x3732c4['update']({'content':_0x49176c,'attributes':_0x5e7cea,'isFromAdapter':!0x0});}}),this['listenTo'](_0x35c842,'commentRemoved',(_0x1ca771,{commentThreadId:_0x1341e6,commentId:_0x217e26})=>{const _0x204942=_0x5a2c59['getCommentThread'](_0x1341e6);if(_0x204942){const _0x28d8dc=_0x204942['getComment'](_0x217e26);_0x28d8dc&&_0x28d8dc['remove']({'isFromAdapter':!0x0});}}),await this['_connectService'](_0x4989c1);}['destroy'](){if(this['context']instanceof _0x178f2b){const _0x251809=this['context']['config']['get']('collaboration.channelId');this['_terminateService'](_0x251809);}}['_terminateService'](_0x58c40a){if(!this['_services']['has'](_0x58c40a))throw new _0x331448('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0x58c40a});this['_getService'](_0x58c40a)['disconnect'](),this['_services']['delete'](_0x58c40a);}async['reconnect'](){for(const _0x538d73 of this['_services']['keys']())await this['_connectService'](_0x538d73);if(this['context']instanceof _0x178f2b){const _0x39d640=this['context']['config']['get']('collaboration.channelId'),_0x22f32e=this['context']['plugins']['get'](r);_0x22f32e['unregister'](_0x39d640);const _0x21c31c=await this['_services']['get'](_0x39d640)['getConnectedSessions']();_0x22f32e['register'](_0x39d640,_0x21c31c);}}async['_connectService'](_0x4a21f9){const {connection:_0x83e95f}=this['context']['plugins']['get'](c),_0x3a31bd=this['context']['plugins']['get']('CommentsRepository'),_0x5624ad=this['_services']['get'](_0x4a21f9),_0x4cd0a2=await _0x5624ad['connect'](_0x83e95f);await this['_fetchMissingUsersForThreads'](_0x4cd0a2);const _0x2551b1=new Set(Array['from'](_0x3a31bd['getCommentThreads']({'channelId':_0x4a21f9}),_0xc71b82=>_0xc71b82['id']));for(const _0xa0fcdf of _0x4cd0a2)_0xa0fcdf['deletedAt']||_0x2551b1['delete'](_0xa0fcdf['commentThreadId']);for(const _0x4e14b6 of _0x2551b1)_0x3a31bd['getCommentThread'](_0x4e14b6)['remove']({'isFromAdapter':!0x0});for(const _0x244c4b of _0x4cd0a2){let _0x1fd98f=_0x3a31bd['getCommentThread'](_0x244c4b['commentThreadId']);const {commentThreadId:_0x543c62,context:_0x4506c1,attributes:_0x413683,resolvedBy:_0x8bf433,resolvedAt:_0x36cb84,unlinkedAt:_0x5452a0,deletedAt:_0x2898ae}=_0x244c4b;if(_0x2898ae)continue;_0x1fd98f||(_0x1fd98f=_0x3a31bd['addCommentThread']({'channelId':_0x4a21f9,'threadId':_0x543c62,'context':_0x4506c1,'attributes':_0x413683||{},'resolvedBy':_0x8bf433,'resolvedAt':_0x36cb84,'unlinkedAt':_0x5452a0,'isFromAdapter':!0x0}));const _0xcd8442=new Set(Array['from'](_0x1fd98f['comments'],_0xa5df70=>_0xa5df70['id']));for(const _0x17c50e of _0x244c4b['comments'])_0xcd8442['delete'](_0x17c50e['commentId']);for(const _0x2bae26 of _0xcd8442)_0x1fd98f['getComment'](_0x2bae26)['remove']({'isFromAdapter':!0x0});for(const _0x3a33a1 of _0x244c4b['comments']){const _0x412087=_0x1fd98f['getComment'](_0x3a33a1['commentId']);_0x412087?_0x412087['content']!==_0x3a33a1['content']&&_0x412087['update']({'content':_0x3a33a1['content'],'isFromAdapter':!0x0}):_0x1fd98f['addComment'](Object['assign'](b(_0x3a33a1),{'isFromAdapter':!0x0}));}}}['_getService'](_0x4154e8){if(!this['_services']['has'](_0x4154e8))throw new _0x331448('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0x4154e8});return this['_services']['get'](_0x4154e8);}async['_fetchMissingUsersForThreads'](_0x55fb39){const _0x4d58c7=this['context']['plugins']['get'](_0x11d8ec),{connection:_0x20f84f}=this['context']['plugins']['get'](c),_0x17b78d=new Set();for(const {resolvedBy:_0x38bad3,comments:_0x3c29c9}of _0x55fb39){_0x38bad3&&!_0x4d58c7['getUser'](_0x38bad3)&&_0x17b78d['add'](_0x38bad3);for(const {userId:_0xf8e522}of _0x3c29c9)_0x4d58c7['getUser'](_0xf8e522)||_0x17b78d['add'](_0xf8e522);}if(0x0===_0x17b78d['size'])return;const _0x2ffcb3=await mt['getMany'](_0x20f84f,Array['from'](_0x17b78d));for(const _0x57da91 of _0x2ffcb3)_0x4d58c7['getUser'](_0x57da91['id'])||_0x4d58c7['addUser'](_0x57da91);}}async function y(_0x1cfda8){if('404'!==_0x1cfda8['code'])throw _0x1cfda8;}function wt(_0x2f92a0){if((_0x42512c=_0x2f92a0)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0x42512c['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x42512c['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0x42512c;throw _0x2f92a0;}function b(_0x1fca42){return{'threadId':_0x1fca42['commentThreadId'],'commentId':_0x1fca42['commentId'],'content':_0x1fca42['content'],'createdAt':_0x1fca42['createdAt'],'authorId':_0x1fca42['userId'],'attributes':_0x1fca42['attributes']||{}};}class g extends _0x360d0e{static ['TrackChangesService']=/* #__PURE__ -- @preserve */
|
|
27
|
+
((()=>at)());['_bufferedRequests'];['_trackChangesService'];static get['requires'](){return[a,'TrackChangesEditing',c];}constructor(_0x15f333){super(_0x15f333);const _0x23bab4=this['editor']['config']['get']('collaboration.channelId');this['_bufferedRequests']=new Map(),this['_trackChangesService']=new g['TrackChangesService'](_0x23bab4);}['init'](){const _0x1869ce=this['editor']['plugins']['get'](c),_0xbe5b5a=this['editor']['plugins']['get']('TrackChangesEditing');return _0xbe5b5a['adapter']={'getSuggestion':async _0x3820c6=>{await this['_waitForServiceReady']();const _0x1753c9=await this['_trackChangesService']['get'](_0x3820c6)['catch'](w);return await this['_fetchMissingUsersForThreads']([_0x1753c9]),_0x1753c9;},'addSuggestion':async({id:_0x524c04,type:_0x4f750d,data:_0x5efb7b,originalSuggestionId:_0x25481a,attributes:_0x36b318})=>{await this['_waitForServiceReady']();const _0x1cfea9={'id':_0x524c04,'type':_0x4f750d,'data':_0x5efb7b,'originalSuggestionId':_0x25481a,'attributes':_0x36b318},_0x1f0ea4=await this['_trackChangesService']['add'](_0x524c04,_0x4f750d,_0x5efb7b,_0x25481a,_0x36b318)['catch'](_0x14921f=>{if(gt(_0x14921f))return new Promise(_0x26152f=>{this['_bufferedRequests']['set'](_0x524c04,{'resolve':_0x26152f,'suggestionData':_0x1cfea9});});throw _0x14921f;});return this['_bufferedRequests']['delete'](_0x524c04),_0x1f0ea4;},'updateSuggestion':async(_0x8413d3,_0x3d65d1)=>{if(await this['_waitForServiceReady'](),'open'!==_0x3d65d1['state'])return this['_trackChangesService']['update'](_0x8413d3,_0x3d65d1)['catch'](w);}},this['listenTo'](this['_trackChangesService'],'suggestionUpdated',(_0x3e3716,_0x461622)=>{_0xbe5b5a['hasSuggestion'](_0x461622['id'])&&(_0xbe5b5a['getSuggestion'](_0x461622['id'])['attributes']=_0x461622['attributes']);}),this['_trackChangesService']['connect'](_0x1869ce['connection'])['then'](_0x10616e=>(_0x1869ce['addToReconnectionStack'](this),this['_fetchMissingUsersForThreads'](_0x10616e)['then'](()=>{for(const _0x4c6f85 of _0x10616e){_0xbe5b5a['addSuggestionData'](_0x4c6f85)['_saved']=!0x0;}})));}async['reconnect'](){const _0x3379c3=this['editor']['plugins']['get']('TrackChangesEditing'),{connection:_0x499de9}=this['editor']['plugins']['get'](c),_0x75c9ab=await this['_trackChangesService']['connect'](_0x499de9);await this['_fetchMissingUsersForThreads'](_0x75c9ab);for(const {suggestionData:_0x686ed5,resolve:_0x435e72}of this['_bufferedRequests']['values']()){let _0x3661bd=_0x75c9ab['find'](_0x2c9e7f=>_0x2c9e7f['id']===_0x686ed5['id']);_0x3661bd||(_0x3661bd=await this['_trackChangesService']['add'](_0x686ed5['id'],_0x686ed5['type'],_0x686ed5['data'],_0x686ed5['originalSuggestionId'])),_0x435e72(_0x3661bd);}for(const _0x44840a of _0x75c9ab)_0x3379c3['hasSuggestion'](_0x44840a['id'])||_0x3379c3['addSuggestionData'](_0x44840a);}async['_waitForServiceReady'](){this['_trackChangesService']['isConnected']||await new Promise(_0x47cb02=>{this['listenTo'](this['_trackChangesService'],'connected',_0x11e0e5=>{_0x11e0e5['off'](),_0x47cb02();});});}async['_fetchMissingUsersForThreads'](_0xa6be89){const _0x4e608d=this['editor']['plugins']['get'](_0x11d8ec),{connection:_0x43b293}=this['editor']['plugins']['get'](c),_0x3f3e97=new Set();for(const {authorId:_0x3845b2}of _0xa6be89)_0x4e608d['getUser'](_0x3845b2)||_0x3f3e97['add'](_0x3845b2);if(0x0===_0x3f3e97['size'])return;const _0x15a946=await mt['getMany'](_0x43b293,Array['from'](_0x3f3e97));for(const _0x5b8980 of _0x15a946)_0x4e608d['getUser'](_0x5b8980['id'])||_0x4e608d['addUser'](_0x5b8980);}}function w(_0x249c9c){if(gt(_0x249c9c))return new Promise(()=>{});throw _0x249c9c;}function gt(_0x10949b){return _0x10949b['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x10949b['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class m extends _0x360d0e{static get['requires'](){return['Comments',a,n,c];}static get['pluginName'](){return'RealTimeCollaborativeComments';}['init'](){const _0x527bb7=this['editor']['plugins']['get'](c),_0x19b9b3=this['editor']['plugins']['get']('CommentsEditing'),_0x407573=this['editor']['plugins']['get'](a);return this['editor']['data']['once']('ready',()=>{this['listenTo'](_0x527bb7,'change:state',(_0x54a70b,_0x3c5247,_0x27e752)=>{_0x19b9b3['isThreadsLoadingPaused']='connected'!==_0x27e752;});}),this['listenTo'](_0x527bb7,'change:state',(_0x5112ef,_0x1dc667,_0x36ad11)=>{this['editor']['plugins']['get']('CommentsRepository')['switchReadOnly']('connected'!==_0x36ad11);}),_0x407573['_setUpService'](this['editor']['config']['get']('collaboration.channelId'));}['destroy'](){this['editor']['plugins']['get'](a)['_terminateService'](this['editor']['config']['get']('collaboration.channelId')),super['destroy']();}}class p extends _0x360d0e{static get['requires'](){return[m,g,'TrackChanges'];}static get['pluginName'](){return'RealTimeCollaborativeTrackChanges';}}class v extends _0x360d0e{static ['RevisionHistoryService']=/* #__PURE__ -- @preserve */
|
|
28
|
+
((()=>rt)());['_lastRequestId'];['_revisionTracker'];['_revisionHistoryService'];['_oldOffset'];static get['requires'](){return[c,l,'RevisionTracker',r,_0x11d8ec];}constructor(_0x3ee394){super(_0x3ee394);const _0x542a77=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new v['RevisionHistoryService'](_0x542a77);}async['init'](){const _0x505f17=this['editor']['plugins']['get'](l),_0x12ee0f=_0x505f17['serverHistory'],_0x49f432=this['editor']['plugins']['get'](c);this['_revisionTracker']['setSource']({'history':_0x12ee0f,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0x505f17['sessionId']});const _0x318d89=this['editor']['config']['get']('cloudServices.bundleVersion')||ht,_0x22bb24=await ot['isBundleUploaded'](_0x49f432['connection'],_0x318d89);this['_revisionTracker']['adapter']={'getRevision':async({revisionId:_0x4ed348})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0x4ed348)),'updateRevisions':async _0x2bbb5e=>{await this['_waitForServiceReady']();const _0x74eb87=this['_revisionTracker']['currentRevision'];if(_0x22bb24&&0x1===_0x2bbb5e['length']&&_0x2bbb5e[0x0]['id']===_0x74eb87['id'])return _0x2bbb5e;for(const _0x3d21c9 of _0x2bbb5e)_0x3d21c9['id']===_0x74eb87['id']&&(_0x3d21c9['isEmptyCurrent']=_0x3d21c9['fromVersion']===_0x3d21c9['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0x2bbb5e,this['_lastRequestId'])['then'](_0x58bfe7=>(this['_lastRequestId']=_0x58bfe7,_0x2bbb5e))['catch'](_0x48fd4f=>{if(nt(_0x48fd4f)||'400'===_0x48fd4f['code']&&void 0x0!==_0x48fd4f['data']['wrongRequestId']){for(const _0x164704 of _0x2bbb5e){!this['_revisionTracker']['repository']['getRevision'](_0x164704['id'])||this['_revisionTracker']['_bufferUpdate'](_0x164704['id'],_0x164704,!0x1);}if(nt(_0x48fd4f))throw _0x48fd4f;return _0x2bbb5e;}throw _0x48fd4f;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0x3e2a98,{revisionsData:_0x3cf5ac,requestId:_0x13b943})=>{Math['max'](..._0x3cf5ac['map'](_0x4b88cc=>_0x4b88cc['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0x3cf5ac,_0x13b943);}):this['_handleRevisionsUpdate'](_0x3cf5ac,_0x13b943);});const {revisions:_0x4244c8,requestId:_0x4f7486}=await this['_revisionHistoryService']['connect'](_0x49f432['connection']);_0x49f432['addToReconnectionStack'](this),this['_lastRequestId']=_0x4f7486,await this['_fetchMissingUsers'](_0x4244c8);for(const _0x2b4bc5 of _0x4244c8)this['_revisionTracker']['addRevisionData'](_0x2b4bc5);this['listenTo'](_0x505f17,'change:_isConnected',(_0x133578,_0x36c0bd,_0x23324c)=>{_0x23324c&&(this['_oldOffset']=_0x505f17['_offset'],_0x133578['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](_0x49f432,'state',_0x66a3ce=>_0x66a3ce===_0x49bf8d['CONNECTED']);}async['reconnect'](){const _0x2b098d=this['editor']['plugins']['get'](c),_0x14dbab=this['editor']['plugins']['get'](l),_0x1cbdc3=async()=>{const _0x57a127=this['_revisionTracker']['currentRevision'],_0x49047c=_0x57a127['id'],_0x4c63ee=_0x49047c!==_0x14dbab['sessionId'];if(_0x4c63ee){const _0x55021c=_0x14dbab['_offset']-this['_oldOffset'],_0x1fa1ff=this['_getLatestVersionFromServerOperations']();this['_revisionTracker']['_revisionDataBuilder']['reInit']();if(_0x57a127['toVersion']+_0x55021c!==_0x1fa1ff){const _0x1d46ad=_0x57a127['fromVersion']+_0x55021c,_0xe205f=this['editor']['plugins']['get'](_0x11d8ec),_0x3342c3=this['_revisionTracker']['buildRevisionData']({'revision':_0x57a127,'from':_0x1d46ad,'to':_0x1fa1ff});_0x3342c3['id']=_0x57a127['id'];const _0x1908cb=_0x3342c3['authorsIds']['map'](_0x2b1efb=>_0xe205f['getUser'](_0x2b1efb));_0x57a127['_update']({..._0x3342c3,'authors':_0x1908cb},!0x0),this['_revisionTracker']['_bufferUpdate'](_0x57a127['id'],_0x3342c3,!0x0);}this['_revisionTracker']['_startingVersion']=_0x1fa1ff,(_0x57a127['toVersion']===_0x57a127['fromVersion']&&!this['_revisionTracker']['_bufferedUpdates']['has'](_0x49047c)&&this['_revisionTracker']['repository']['_revisions']['remove'](_0x49047c),this['_revisionTracker']['_createCurrentRevision'](_0x1fa1ff));}const {revisions:_0x4e3dee,requestId:_0x303b22}=await this['_revisionHistoryService']['reconnect'](_0x2b098d['connection'],this['_lastRequestId']);_0x4c63ee&&_0x4e3dee['length']>0x0?_0x14dbab['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x4e3dee),this['_handleRevisionsUpdate'](_0x4e3dee,_0x303b22),this['_revisionTracker']['sendBufferedUpdates']());};return _0x14dbab['_isConnected']?_0x1cbdc3():new Promise((_0x397d1e,_0x31936e)=>{_0x14dbab['once']('change:_isConnected',()=>{_0x1cbdc3()['then'](_0x397d1e)['catch'](_0x31936e);});});}['destroy'](){super['destroy']();}async['_waitForServiceReady'](){this['_revisionHistoryService']['isConnected']||await new Promise(_0x12e79d=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x2daafa=>{_0x2daafa['off'](),_0x12e79d();});});}['_getLatestVersionFromServerOperations'](){const _0x32972a=this['editor']['plugins']['get'](l)['serverHistory']['getOperations']()['reverse']();for(const _0x148884 of _0x32972a)if('marker'!==_0x148884['type']||_0x148884['affectsData'])return _0x148884['baseVersion']+0x1;}['_getLatestVersion'](){const _0x27fe96=this['editor']['plugins']['get'](l);return new Promise(_0x18bd47=>{_0x27fe96['_isPendingUpdate']?_0x27fe96['once']('change:_isPendingUpdate',()=>{_0x18bd47(this['_getLatestVersionFromServerOperations']());}):_0x18bd47(this['_getLatestVersionFromServerOperations']());});}['_handleRevisionsUpdate'](_0x5879de,_0x5b62f6){const _0x5d8e7d=this['_revisionTracker']['repository'];this['_lastRequestId']=_0x5b62f6;for(const _0xb30b94 of _0x5879de){const _0x309dbd=_0x5d8e7d['getRevision'](_0xb30b94['id']);if(_0x309dbd){if((_0xb30b94['fromVersion']||_0xb30b94['toVersion'])&&(_0xb30b94['diffData']=null),_0x309dbd===this['_revisionTracker']['currentRevision']){const _0x5b1db1=Math['max'](_0x309dbd['toVersion'],_0xb30b94['toVersion']),_0x2f3ced=Math['max'](_0x309dbd['fromVersion'],_0xb30b94['fromVersion']);let _0x2c375a;_0x309dbd['toVersion']===_0xb30b94['toVersion']&&_0x309dbd['fromVersion']===_0xb30b94['fromVersion']?(_0x2c375a=!0x0,this['_preventResendingRevisionData'](_0xb30b94)):_0xb30b94['toVersion']===_0x5b1db1&&_0xb30b94['fromVersion']===_0x2f3ced?_0x2c375a=!0x1:(_0x309dbd['toVersion']===_0x5b1db1&&_0x309dbd['fromVersion']===_0x2f3ced||this['_fixRevision']({'revision':_0x309dbd,'from':_0x2f3ced,'to':_0x5b1db1}),_0x2c375a=!0x0),_0x2c375a&&(delete _0xb30b94['fromVersion'],delete _0xb30b94['toVersion'],delete _0xb30b94['diffData'],delete _0xb30b94['createdAt'],delete _0xb30b94['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0xb30b94),this['_preventResendingRevisionData'](_0xb30b94);}else this['_revisionTracker']['addRevisionData'](_0xb30b94);}const _0x3da220=_0x5d8e7d['getRevisions']();_0x3da220['reverse']();for(let _0x55c866=0x0;_0x55c866<_0x3da220['length']-0x1;_0x55c866++){const _0x31f234=_0x3da220[_0x55c866],_0x55cdb1=_0x3da220[_0x55c866+0x1];if(_0x31f234['fromVersion']<_0x55cdb1['toVersion']){const _0x3ddbf9=_0x55cdb1['toVersion'],_0x16f6f0=Math['max'](_0x3ddbf9,_0x31f234['toVersion']);this['_fixRevision']({'revision':_0x31f234,'from':_0x3ddbf9,'to':_0x16f6f0});}}}['_fixRevision']({revision:_0x2726e3,from:_0x203841,to:_0xf1d6d0}={}){const _0x53c3d6=this['editor']['plugins']['get'](_0x11d8ec),_0x38e7d6=this['_revisionTracker']['buildRevisionData']({'revision':_0x2726e3,'from':_0x203841,'to':_0xf1d6d0});_0x38e7d6['authors']=_0x38e7d6['authorsIds']['map'](_0x1fe60c=>_0x53c3d6['getUser'](_0x1fe60c)),_0x2726e3['_update'](_0x38e7d6);}['_preventResendingRevisionData'](_0x4d0087){const _0x3489fe={};_0x3489fe['id']=_0x4d0087['id'];for(const _0x1a2dfe of Object['keys'](_0x4d0087))'id'!==_0x1a2dfe&&(_0x3489fe[_0x1a2dfe]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0x3489fe['id'],_0x3489fe,!0x0);}async['_fetchMissingUsers'](_0xc854c){const _0x2f7817=this['editor']['plugins']['get'](_0x11d8ec),{connection:_0x540d9e}=this['editor']['plugins']['get'](c),_0x3e1092=new Set();for(const _0x1301d4 of _0xc854c){for(const _0x122c82 of _0x1301d4['authorsIds'])_0x482d4d(_0x122c82);_0x1301d4['creatorId']&&_0x482d4d(_0x1301d4['creatorId']);}if(0x0===_0x3e1092['size'])return;const _0x12a2b4=await mt['getMany'](_0x540d9e,Array['from'](_0x3e1092));for(const _0x4c2c42 of _0x12a2b4)_0x2f7817['getUser'](_0x4c2c42['id'])||_0x2f7817['addUser'](_0x4c2c42);function _0x482d4d(_0x5d12){_0x2f7817['getUser'](_0x5d12)||_0x3e1092['add'](_0x5d12);}}}function nt(_0x359ee1){return _0x359ee1['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0x359ee1['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x359ee1['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class d extends _0x360d0e{static get['requires'](){return['RevisionHistory',v,n];}static get['pluginName'](){return'RealTimeCollaborativeRevisionHistory';}}class ts extends _0x59eae8{constructor(_0x2b217a){super(_0x2b217a);const _0x56123a=this['bindTemplate'];this['set']('usersCount',0x0),this['set']('isHidden',!0x0),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__counter',_0x56123a['if']('isHidden','ck-presence-list__counter--hidden')]},'children':[{'text':_0x56123a['to']('usersCount',_0x4cc3f8=>E(_0x2b217a,'CONNECTED_USERS',_0x4cc3f8))}]});}}class es extends _0x59eae8{['items'];['keystrokes'];constructor(_0x3920dc){super(_0x3920dc);const _0x241786=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0x4eab7e(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0x241786['if']('hasPopup'),'aria-expanded':_0x241786['to']('isExpanded',_0x4cd94c=>this['hasPopup']&&String(_0x4cd94c)),'aria-label':_0x241786['to']('hasPopup',_0xf70adc=>E(_0x3920dc,_0xf70adc?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0x241786['to']('hasPopup',_0x282880=>!!_0x282880&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items'],'on':{'click':_0x241786['to'](()=>this['fire']('execute'))}}),this['on']('change:hasPopup',(_0x1d7de8,_0x346f34,_0x45aa8e)=>{this['element']&&(_0x45aa8e?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 Z extends _0x59eae8{['counterView'];['inlineListView'];constructor(_0x2e203a){super(_0x2e203a);const _0x470505=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new ts(this['locale']),this['inlineListView']=new es(_0x2e203a),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x196121 of this['inlineListView']['items'])_0x196121['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',_0x470505['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['counterView'],this['inlineListView']]});}}class tt extends _0x59eae8{['listWrapperView'];constructor(_0x4fad3d,_0x1f8382){super(_0x4fad3d),this['listWrapperView']=new vt(_0x4fad3d,_0x1f8382),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':E(_0x4fad3d,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']]});}}class vt extends _0x10303f{constructor(_0x2958d9,_0x4bbbe1){super(_0x2958d9);const _0x833682=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0x4bbbe1?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0x833682['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0x833682['to']('role'),'aria-label':_0x833682['to']('ariaLabel'),'aria-labelledby':_0x833682['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0x31593e['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0x1023b7=this['element'];_0x1023b7&&(this['_isScrollable']=Math['max'](_0x1023b7['scrollHeight'],_0x1023b7['clientHeight'])>0.8*window['innerHeight']);}}class st extends ct{['userView'];constructor(_0x2a6a98,_0x39d153,_0x4f1754){super(_0x2a6a98);const _0xf42c7a=this['bindTemplate'];this['userView']=new lt(_0x2a6a98,_0x39d153);const _0x4bb608={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0x39d153['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0x39d153['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x39d153['color']['getBackgroundColorClass']()],'aria-hidden':'true'}}]};_0x4f1754&&(_0x4bb608['tag']='button',_0x4bb608['on']={'click':_0xf42c7a['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x4bb608);}['focus'](){this['element']['focus']();}}class it extends _0x59eae8{['userView'];['markerView'];constructor(_0x560f2d,_0x4017cb,_0x43b294){super(_0x560f2d);const _0x315c38=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new lt(_0x560f2d,_0x4017cb),this['markerView']=new dt(_0x560f2d,_0x4017cb);const _0x4bb55c=new pt(_0x560f2d);_0x4bb55c['template']['tag']='span',_0x4bb55c['text']=_0x4017cb['name'];const _0x54e738={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0x315c38['to']('isFocusable',_0x5ac654=>!!_0x5ac654&&0x0),'aria-labelledby':_0x4bb55c['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0x315c38['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0x315c38['to']('hasTooltip',_0x1310e0=>!_0x1310e0),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0x4bb55c]};_0x43b294&&(_0x54e738['tag']='button',_0x54e738['on']={'click':_0x315c38['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x54e738);}}class dt extends _0x59eae8{constructor(_0x50e81d,_0x79e989){super(_0x50e81d),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x79e989['color']['getBackgroundColorClass']()],'aria-hidden':'true'}});}}const et={'collapseAt':0x6,'displayMe':!0x0};class s extends _0x54552e{['currentDisplayedUsers'];['balloonPanelView'];['view'];['presenceDropdownView'];['_bodyCollection']=null;constructor(_0x26a442){super(_0x26a442),this['context']['config']['define']('presenceList',et);const _0x5f0a0a=_0x26a442['config']['get']('presenceList.collapseAt');if('number'!=typeof _0x5f0a0a)throw new _0x331448('presencelist-collapseat-invalid-format',this);if(_0x5f0a0a<0x1)throw new _0x331448('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](r)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0x1ef5f7(),this['balloonPanelView']=new _0x367914(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get['requires'](){return[r];}['init'](){for(const _0x28e685 of this['_allConnectedUsers'])this['_handleUserAdd'](_0x28e685);this['listenTo'](this['_allConnectedUsers'],'add',(_0x6d0708,_0x53c3a0)=>{this['_handleUserAdd'](_0x53c3a0);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0x3fd202,_0x395699)=>{this['_handleUserRemove'](_0x395699);});}['_createView'](){const _0x1329c8=this['context'],_0x44cdfd=new Z(this['context']['locale']),_0x21f7bf=this['balloonPanelView'];if(!_0x53eb4c(_0x1329c8['config']['get']('presenceList.container')))throw new _0x331448('presencelist-missing-container',this);return _0x44cdfd['counterView']['bind']('usersCount')['to'](this),_0x44cdfd['bind']('isCollapsed')['to'](this,'usersCount',_0x4690b7=>{const {collapseAt:_0x386162,displayMe:_0x13c3f9}=_0x1329c8['config']['get']('presenceList'),_0x364ae8=_0x4690b7>=_0x386162;return _0x44cdfd['counterView']['isHidden']=!(0x1==_0x4690b7&&_0x13c3f9||_0x364ae8),_0x364ae8||this['hideDropdown'](),_0x364ae8;}),_0x44cdfd['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0x63fadf=>{const _0x10f4c0=_0x1329c8['config']['get']('presenceList'),_0x2d8ebc=new it(_0x1329c8['locale'],_0x63fadf,!!_0x10f4c0['onClick']);return _0x2d8ebc['bind']('hasTooltip')['to'](_0x44cdfd,'isCollapsed',_0x23f83c=>!_0x23f83c),_0x2d8ebc['bind']('isFocusable')['to'](_0x44cdfd,'isCollapsed',_0xbef25c=>!_0xbef25c),_0x10f4c0['onClick']&&this['listenTo'](_0x2d8ebc,'execute',()=>{this['view']['isCollapsed']||_0x10f4c0['onClick'](_0x63fadf,_0x2d8ebc['element']);}),_0x2d8ebc;}),this['listenTo'](_0x44cdfd['inlineListView'],'execute',()=>{this['presenceDropdownView']?this['hideDropdown']():this['view']['isCollapsed']&&this['showDropdown']();}),_0x44cdfd['inlineListView']['keystrokes']['set']('Enter',(_0xaf838a,_0x27bc90)=>{this['view']['isCollapsed']&&(this['showDropdown'](),_0x27bc90());}),_0x44cdfd['render'](),_0x21f7bf['render'](),_0x18cb4({'emitter':_0x44cdfd,'activator':()=>_0x21f7bf['isVisible'],'contextElements':[_0x21f7bf['element'],_0x44cdfd['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0x1329c8['config']['get']('presenceList.container')['appendChild'](_0x44cdfd['element']),this['_bodyCollection']=new _0x15a38b(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_bodyCollection']['add'](this['balloonPanelView']),_0x44cdfd;}['_handleUserAdd'](_0x3df455){if(!this['context']['config']['get']('presenceList.displayMe')&&_0x3df455['isMe'])return;const _0x13f9dc=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['usersCount']++,this['currentDisplayedUsers']['length']==_0x13f9dc&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](0x1);const _0x2fdce9=_0x3df455['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0x3df455,_0x2fdce9);}['_handleUserRemove'](_0x47908b){if(this['usersCount']--,this['currentDisplayedUsers']['get'](_0x47908b['id'])&&(this['currentDisplayedUsers']['remove'](_0x47908b['id']),this['currentDisplayedUsers']['length']<this['usersCount'])){for(const _0x432607 of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0x432607['id']))return void this['currentDisplayedUsers']['add'](_0x432607,Math['min'](this['currentDisplayedUsers']['length'],0x1));}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0x263179=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new tt(this['context']['locale'],!!_0x263179['onClick']),this['view']['inlineListView']['isExpanded']=!0x0;const {listWrapperView:_0xc267d2}=this['presenceDropdownView'];_0xc267d2['items']['bindTo'](this['_allConnectedUsers'])['using'](_0x583c76=>{if(!_0x263179['displayMe']&&_0x583c76['isMe'])return null;const _0x42a2e8=new st(this['context']['locale'],_0x583c76,!!_0x263179['onClick']);return _0x263179['onClick']&&this['listenTo'](_0x42a2e8,'execute',()=>{_0x263179['onClick'](_0x583c76,_0x42a2e8['element']);}),_0x42a2e8;}),this['balloonPanelView']['content']['add'](this['presenceDropdownView']),this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element']}),_0xc267d2['focus'](),_0xc267d2['checkIfScrollable']();const _0x132210=(_0x2f84dc,_0x418ac4)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0x418ac4();};_0xc267d2['keystrokes']['set']('Esc',_0x132210),_0xc267d2['keystrokes']['set']('Shift+Tab',_0x132210),_0xc267d2['keystrokes']['set']('Tab',(_0x44f945,_0x23e318)=>{!function(_0xcc4f76){const _0x3f3c66=['a','button','input','select','textarea','[tabindex]','[contenteditable]']['map'](_0x4f1647=>_0x4f1647+':not([disabled]):not([tabindex=\x22-1\x22])')['join'](','),_0xb13084=[...document['body']['querySelectorAll'](_0x3f3c66)]['filter'](_0xe0393e=>_0xe0393e===document['activeElement']||_0xe0393e['offsetWidth']+_0xe0393e['offsetHeight']>0x0)['sort']((_0x545e43,_0x3171ac)=>(_0x545e43['tabIndex']||0x0)-(_0x3171ac['tabIndex']||0x0)),_0x1933ef=_0xb13084['indexOf'](_0xcc4f76),_0x2c48ec=_0xb13084[(_0x1933ef+0x1)%_0xb13084['length']];_0x2c48ec&&_0x2c48ec['focus']();}(this['view']['element']),this['hideDropdown'](),_0x23e318();}),_0xc267d2['focusTracker']['add'](this['view']['element']),_0xc267d2['focusTracker']['on']('change:isFocused',(_0xfe3a65,_0x498344,_0x51aaad)=>{_0x51aaad||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 i extends _0x54552e{static get['requires'](){return[r,s];}static get['pluginName'](){return'PresenceList';}}export{a as CloudServicesCommentsAdapter,v as CloudServicesRevisionHistoryAdapter,g as CloudServicesTrackChangesAdapter,i as PresenceList,l as RealTimeCollaborationClient,m as RealTimeCollaborativeComments,n as RealTimeCollaborativeEditing,d as RealTimeCollaborativeRevisionHistory,p as RealTimeCollaborativeTrackChanges};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckeditor/ckeditor5-real-time-collaboration",
|
|
3
|
-
"version": "43.2.0-alpha.
|
|
3
|
+
"version": "43.2.0-alpha.1",
|
|
4
4
|
"description": "A set of CKEditor 5 features enabling real-time collaboration within the editor using CKEditor Cloud Services.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"author": "CKSource (http://cksource.com/)",
|
|
@@ -42,14 +42,14 @@
|
|
|
42
42
|
],
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@ckeditor/ckeditor-cloud-services-collaboration": "52.6.10",
|
|
45
|
-
"@ckeditor/ckeditor5-core": "43.2.0-alpha.
|
|
46
|
-
"@ckeditor/ckeditor5-engine": "43.2.0-alpha.
|
|
47
|
-
"@ckeditor/ckeditor5-operations-compressor": "43.2.0-alpha.
|
|
48
|
-
"@ckeditor/ckeditor5-theme-lark": "43.2.0-alpha.
|
|
49
|
-
"@ckeditor/ckeditor5-ui": "43.2.0-alpha.
|
|
50
|
-
"@ckeditor/ckeditor5-utils": "43.2.0-alpha.
|
|
51
|
-
"ckeditor5": "43.2.0-alpha.
|
|
52
|
-
"ckeditor5-collaboration": "43.2.0-alpha.
|
|
45
|
+
"@ckeditor/ckeditor5-core": "43.2.0-alpha.1",
|
|
46
|
+
"@ckeditor/ckeditor5-engine": "43.2.0-alpha.1",
|
|
47
|
+
"@ckeditor/ckeditor5-operations-compressor": "43.2.0-alpha.1",
|
|
48
|
+
"@ckeditor/ckeditor5-theme-lark": "43.2.0-alpha.1",
|
|
49
|
+
"@ckeditor/ckeditor5-ui": "43.2.0-alpha.1",
|
|
50
|
+
"@ckeditor/ckeditor5-utils": "43.2.0-alpha.1",
|
|
51
|
+
"ckeditor5": "43.2.0-alpha.1",
|
|
52
|
+
"ckeditor5-collaboration": "43.2.0-alpha.1",
|
|
53
53
|
"lodash-es": "4.17.21"
|
|
54
54
|
},
|
|
55
55
|
"types": "src/index.d.ts",
|