@ckeditor/ckeditor5-real-time-collaboration 46.0.0-alpha.4 → 46.0.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/real-time-collaboration.js +1 -1
- package/dist/index.js +6 -6
- package/package.json +14 -14
- package/src/presencelist/view/presencedropdownlistitemview.js +1 -1
- package/src/presencelist/view/presencedropdownlistview.js +1 -1
- package/src/presencelist/view/presenceinlinelistitemview.js +1 -1
- package/src/presencelist/view/presenceinlinelistview.js +1 -1
- package/src/realtimecollaborativecomments/cloudservicescommentsadapter.js +2 -2
- package/src/realtimecollaborativeediting/realtimecollaborationclient.js +2 -2
- package/src/realtimecollaborativeediting/sessions.js +1 -1
- package/src/realtimecollaborativeediting/usermarkers.js +1 -1
- package/src/realtimecollaborativeediting/websocketgateway.js +2 -2
- package/src/realtimecollaborativerevisionhistory/cloudservicesrevisionhistoryadapter.js +2 -2
- package/src/realtimecollaborativetrackchanges/cloudservicestrackchangesadapter.js +2 -2
package/dist/index.js
CHANGED
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
import{ContextPlugin as
|
|
24
|
-
((()=>ht)());static ['initialReconnectionInterval']=0x3e8;['connection'];['_reconnectionStack'];['_shouldPluginsReconnect'];['_domEmitter'];static get['requires'](){return['CloudServices',_0x42b900];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x3fc8c3){super(_0x3fc8c3),this['set']('state',te['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=new(_0xef0d83())();}['init'](){const _0x4a0cb9=this['context'],_0x5345c1=_0x4a0cb9['plugins']['get']('CloudServices'),_0x711e45=_0x4a0cb9['plugins']['get'](_0x42b900);if(!_0x5345c1['token'])throw new _0x485f38('websocketgateway-missing-token',this);if(!_0x5345c1['webSocketUrl'])throw new _0x485f38('websocketgateway-missing-websocket-url',this);return this['_domEmitter']['listenTo'](window,'offline',()=>this['_isBrowserOffline']=!0x0),this['_domEmitter']['listenTo'](window,'online',()=>this['_isBrowserOffline']=!0x1),this['context']['config']['define']('cloudServices.connectionTimeout',0xa),this['context']['config']['define']('cloudServices.requestTimeout',0x14),n['WebSocketGateway']['connect'](_0x5345c1['token'],_0x5345c1['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0x111143=>{if(this['connection']=_0x111143,this['bind']('state')['to'](_0x111143,'state',this,'_isBrowserOffline',(_0x2af6ce,_0x469084)=>('connected'!==_0x2af6ce&&(this['_shouldPluginsReconnect']=!0x0),_0x469084||_0x2af6ce!==te['CONNECTED']?te['DISCONNECTED']:this['state']==te['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),te['CONNECTING']):te['CONNECTED'])),this['connection']['on']('error',(_0x102584,_0x537384)=>{if('limitExceeded'!==_0x537384['code'])throw console['error'](_0x537384),new _0x485f38('cloudservices-init',null,{'originalError':_0x537384});_0x711e45['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'});}),!_0x111143['me'])return new Promise(_0x3d2af9=>_0x111143['on']('change:me',_0x3d2af9));})['catch'](_0x2ec718=>{throw console['error'](_0x2ec718),new _0x485f38('cloudservices-init',null,{'originalError':_0x2ec718});});}['addToReconnectionStack'](_0x3927e1){if('function'!=typeof _0x3927e1['reconnect'])throw new _0x485f38('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0x3927e1))throw new _0x485f38('websocketgateway-plugin-already-registered',this,{'name':_0x3927e1['constructor']['pluginName']});this['_reconnectionStack']['add'](_0x3927e1);}['removeFromReconnectionStack'](_0x4b723c){this['_reconnectionStack']['delete'](_0x4b723c);}['isInReconnectionStack'](_0x4c47ab){return this['_reconnectionStack']['has'](_0x4c47ab);}['_reconnect'](){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0x5db934=>_0x5db934['reconnect']())))['then'](()=>this['state']=te['CONNECTED'])['catch'](_0x28278b=>{throw console['error'](_0x28278b),new _0x485f38('cloudservices-reconnection-error',this['context']);});}['disconnect'](){this['connection']&&this['connection']['disconnect'](),this['state']=te['DISCONNECTED'],this['_domEmitter']['stopListening']();}['destroy'](){this['disconnect'](),super['destroy']();}}class i extends _0x286715{['channelSessions'];['channelConnectedUsers'];['allConnectedUsers'];['_registeredSessions'];['_uniqueUsersCount'];['_users'];static get['pluginName'](){return'Sessions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}static get['requires'](){return[n,_0x13ed0e];}constructor(_0x47993b){super(_0x47993b),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0x311848(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x13ed0e);}['init'](){const _0x3b5e76=this['context']['plugins']['get'](n);this['listenTo'](_0x3b5e76,'change:state',(_0x44dfaf,_0x15f814,_0x4448eb)=>{if('connected'!==_0x4448eb)this['channelSessions']['forEach'](_0x4dffc2=>_0x4dffc2['clear']()),this['channelConnectedUsers']['forEach'](_0x3e4afb=>_0x3e4afb['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x1b650e,_0x264bef]of this['_registeredSessions'])for(const _0x1feae6 of _0x264bef)this['_handleSessionAdd'](_0x1b650e,_0x1feae6);}}),this['_createUser'](_0x3b5e76['connection']['me'],!0x0);}['register'](_0x2b4c83,_0x2fcd51){if(this['_registeredSessions']['has'](_0x2b4c83))throw new _0x485f38('sessions-register-already-registered',null,{'channelId':_0x2b4c83});this['_registeredSessions']['set'](_0x2b4c83,_0x2fcd51),this['channelSessions']['set'](_0x2b4c83,new _0x311848()),this['channelConnectedUsers']['set'](_0x2b4c83,new _0x311848()),this['listenTo'](_0x2fcd51,'add',(_0x2e0938,_0x4f60d1)=>this['_handleSessionAdd'](_0x2b4c83,_0x4f60d1)),this['listenTo'](_0x2fcd51,'remove',(_0x40ed2b,_0x46c962)=>this['_handleSessionRemove'](_0x2b4c83,_0x46c962));for(const _0x381306 of _0x2fcd51)this['_handleSessionAdd'](_0x2b4c83,_0x381306);}['unregister'](_0x12cd84){if(!this['_registeredSessions']['has'](_0x12cd84))throw new _0x485f38('sessions-unregister-not-exist',null,{'channelId':_0x12cd84});const _0x18e9d5=this['_registeredSessions']['get'](_0x12cd84);this['stopListening'](_0x18e9d5);for(const _0xdda398 of _0x18e9d5)'connected'===this['context']['plugins']['get'](n)['state']&&this['_handleSessionRemove'](_0x12cd84,_0xdda398);this['_registeredSessions']['delete'](_0x12cd84),this['channelSessions']['delete'](_0x12cd84),this['channelConnectedUsers']['delete'](_0x12cd84);}get['mySessionId'](){return this['context']['plugins']['get'](n)['connection']['sessionId'];}['getUserBySessionId'](_0x135a63){for(const _0x1c9844 of this['channelSessions']['values']())for(const _0xf42c15 of _0x1c9844)if(_0xf42c15['id']===_0x135a63)return _0xf42c15['user'];}['getUserSessions'](_0x2d89dd,_0x49b570){const _0xff48a2=_0x49b570?[this['channelSessions']['get'](_0x49b570)]:this['channelSessions']['values'](),_0x54c014=new Set();for(const _0x552f82 of _0xff48a2)for(const _0x4b89ec of _0x552f82)_0x4b89ec['user']['id']===_0x2d89dd['id']&&_0x54c014['add'](_0x4b89ec['id']);return _0x54c014;}['getUserRole'](_0x36d54f){for(const _0x1b0629 of this['channelSessions']['values']())for(const _0x1790fa of _0x1b0629)if(_0x1790fa['user']===_0x36d54f)return _0x1790fa['role'];}['_handleSessionAdd'](_0x251935,_0x1b5552){if('connected'!==this['context']['plugins']['get'](n)['state'])return;const _0x5ef12b=_0x1b5552['user'],_0x5a1caf=this['_users']['getUser'](_0x5ef12b['id'])||this['_createUser'](_0x5ef12b),_0xabb91a=Object['assign']({},_0x1b5552,{'user':_0x5a1caf});this['channelSessions']['get'](_0x251935)['add'](_0xabb91a);const _0x37c471=this['channelConnectedUsers']['get'](_0x251935);_0x37c471['has'](_0x5a1caf['id'])||_0x37c471['add'](_0x5a1caf),this['allConnectedUsers']['has'](_0x5a1caf['id'])||this['allConnectedUsers']['add'](_0x5a1caf,_0x5a1caf['isMe']?0x0:void 0x0),this['fire']('sessionAdd:'+_0x251935,{'channelId':_0x251935,'session':_0xabb91a});}['_handleSessionRemove'](_0x5de3dd,_0x62f476){if('connected'!==this['context']['plugins']['get'](n)['state'])return;const _0x3e8fd2=this['channelConnectedUsers']['get'](_0x5de3dd),_0x3d2486=_0x62f476['user'];_0x3d2486['id']&&(this['channelSessions']['get'](_0x5de3dd)['remove'](_0x62f476['id']),_0x3e8fd2['has'](_0x3d2486['id'])&&!this['getUserSessions'](_0x3d2486,_0x5de3dd)['size']&&_0x3e8fd2['remove'](_0x3d2486['id']),this['allConnectedUsers']['get'](_0x3d2486['id'])&&!this['getUserSessions'](_0x3d2486)['size']&&this['allConnectedUsers']['remove'](_0x3d2486['id']));}['_createUser'](_0x5a1750,_0x503e82){const _0x39a250=this['_users']['addUser'](_0x5a1750);return _0x503e82&&this['_users']['defineMe'](_0x5a1750['id']),_0x39a250['orderNumber']=this['_uniqueUsersCount']++,_0x39a250;}}class H extends _0x3f8eef{['_domEmitter']=new(_0xef0d83())();static get['requires'](){return[i];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x53072c=this['editor'],_0x28841d=_0x53072c['plugins']['get'](i);_0x53072c['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x8bebad,{writer:_0x4305cc})=>function(_0x2938a5,_0x2dd956,_0x2316cc,_0x509ec8){const _0x5bdf00=_0x2938a5['markerName']['split'](':')[0x2],_0x4ea494=_0x2316cc['getUserBySessionId'](_0x5bdf00);if(!_0x4ea494||_0x5bdf00===_0x2316cc['mySessionId'])return;if(!_0x509ec8['model']['schema']['checkChild'](_0x2938a5['markerRange']['start'],'$text'))return;const _0x4acb34={'class':'ck-user__marker\x20'+_0x4ea494['color']['getMarkerClass'](),'data-name':_0x4ea494['name'],'data-session-id':_0x5bdf00},_0x51b3a6=_0x509ec8['model']['markers']['get'](_0x2938a5['markerName']),_0x70df7b=_0x51b3a6['getStart'](),_0x476571=_0x70df7b['nodeAfter'],_0x5918d8=_0x509ec8['model']['schema'];if(_0x476571&&_0x5918d8['isObject'](_0x476571)&&_0x5918d8['isInline'](_0x476571)&&!_0x509ec8['model']['markers']['get']('user:range:'+_0x5bdf00)['getRange']()['isCollapsed'])return;const _0x582357=_0x70df7b['parent'];return _0x509ec8['model']['schema']['isLimit'](_0x582357)&&!_0x509ec8['model']['hasContent'](_0x582357)&&(_0x4acb34['contenteditable']=!0x1),function(_0x13b62c,_0x461fc9,_0x127b92){const _0x1baad7=_0x13b62c['createUIElement']('span',_0x461fc9);return _0x13b62c['setCustomProperty']('userPositionMarker',!0x0,_0x1baad7),_0x1baad7['render']=function(_0x295b3d){const _0x4c224f=this['toDomElement'](_0x295b3d),_0x3f07d4=document['createElement']('span');return _0x3f07d4['classList']['add']('ck-user__marker-tooltip'),_0x3f07d4['setAttribute']('contenteditable','false'),_0x3f07d4['setAttribute']('spellcheck','false'),_0x3f07d4['textContent']=_0x127b92['name'],_0x4c224f['innerHTML']='<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span>'+_0x3f07d4['outerHTML']+'',_0x4c224f['addEventListener']('mouseenter',()=>{_0x4c224f['classList']['add']('ck-user__marker_hovered');}),_0x4c224f['addEventListener']('mouseleave',()=>{_0x4c224f['classList']['remove']('ck-user__marker_hovered');}),_0x4c224f;},_0x1baad7['isSimilar']=function(_0x585a2e){return!(!this['getCustomProperty']('userPositionMarker')||!_0x585a2e['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0x585a2e['getAttribute']('data-session-id'));},_0x1baad7;}(_0x2dd956,_0x4acb34,_0x4ea494);}(_0x8bebad,_0x4305cc,_0x28841d,_0x53072c)}),_0x53072c['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0x37929a=>function(_0x28da20,_0x1bd5cc){const _0x4b55f8=_0x28da20['markerName']['split'](':')[0x2];if(_0x4b55f8===_0x1bd5cc['mySessionId'])return null;const _0x3944ab=_0x1bd5cc['getUserBySessionId'](_0x4b55f8);if(!_0x3944ab)return{'id':_0x4b55f8,'classes':[]};return{'id':_0x4b55f8,'classes':['ck-user__selection',_0x3944ab['color']['getSelectionClass']()],'attributes':{'data-session-id':_0x4b55f8},'priority':0x7d0+_0x3944ab['orderNumber']};}(_0x37929a,_0x28841d)}),function(_0x4d4818){const _0x106ea0=_0x4d4818['model'],_0x3001a9=new Map(),_0x540739=_0x4d4818['plugins']['get'](i);_0x106ea0['markers']['on']('update:user:range',(_0x5afb5d,_0x13ee44,_0x724e5e,_0x36effb)=>{if(!_0x36effb&&_0x3001a9['get'](_0x13ee44['name']))return _0x3001a9['get'](_0x13ee44['name'])['detach'](),void _0x3001a9['delete'](_0x13ee44['name']);const _0xca6c1=_0x13ee44['name']['split'](':')[0x2];if(_0xca6c1===_0x540739['mySessionId'])return;const _0x1d3d6b='user:position:'+_0xca6c1;_0x106ea0['markers']['has'](_0x1d3d6b)&&_0x4d4818['editing']['reconvertMarker'](_0x1d3d6b),_0x13ee44['on']('change:range',(_0x1e13c7,_0x2a9d03,_0x22271a)=>{if('$graveyard'!=_0x2a9d03['root']['rootName']&&'$graveyard'==_0x13ee44['getRange']()['root']['rootName']&&!_0x3001a9['has'](_0x13ee44['name'])){const _0x3e5c72=_0x106ea0['schema']['getNearestSelectionRange'](_0x22271a['deletionPosition']);if(_0x3e5c72){const _0x4105eb=_0x5ce2e3['fromRange'](_0x3e5c72);_0x3001a9['set'](_0x13ee44['name'],_0x4105eb),_0x4105eb['on']('change:range',(_0x2c18d0,_0x26d905,_0x265987)=>{if('$graveyard'==_0x4105eb['root']['rootName']){const _0x4a47de=_0x106ea0['schema']['getNearestSelectionRange'](_0x265987['deletionPosition']);_0x4a47de?(_0x4105eb['start']=_0x4a47de['start'],_0x4105eb['end']=_0x4a47de['end']):(_0x3001a9['delete'](_0x13ee44['name']),_0x4105eb['detach']());}});}}});}),_0x106ea0['document']['on']('change',()=>{_0x3001a9['size']>0x0&&_0x106ea0['enqueueChange']({'isUndoable':!0x1},_0x37faf7=>{for(const [_0x1c53dc,_0x1f0d8c]of _0x3001a9)'$graveyard'==_0x106ea0['markers']['get'](_0x1c53dc)['getRange']()['root']['rootName']&&(Z(_0x1c53dc['split'](':')[0x2],_0x1f0d8c['toRange'](),_0x106ea0,_0x37faf7),_0x1f0d8c['detach']());_0x3001a9['clear']();});});}(_0x53072c),this['_domEmitter']['listenTo'](_0x2f31ee['document'],'keydown',(_0x431daf,{key:_0x10cbbe})=>{'Escape'===_0x10cbbe&&function(_0x2519a6){_0x2519a6['editing']['view']['change'](_0x3fd720=>{for(const _0x28316d of _0x2519a6['model']['markers']){if(!_0x28316d['name']['startsWith']('user:position'))continue;const _0xdd7017=_0x2519a6['editing']['mapper']['markerNameToElements'](_0x28316d['name']);if(_0xdd7017){for(const _0x25a540 of _0xdd7017)_0x3fd720['removeClass']('ck-user__marker_hovered',_0x25a540);}}});}(_0x53072c);},{'useCapture':!0x0});}['afterInit'](){const _0xdecb74=this['editor'],_0x4a2f80=_0xdecb74['commands']['get']('undo');_0x4a2f80&&_0xdecb74['model']['on']('applyOperation',(_0x2383bd,_0x3409d6)=>{const _0x562dc5=_0x3409d6[0x0];if(!_0x562dc5['isDocumentOperation'])return;if('marker'!=_0x562dc5['type']||!_0x562dc5['name']['startsWith']('user:'))return;const _0x14f715=_0x562dc5['batch'];_0x4a2f80['_createdBatches']['has'](_0x14f715)&&(_0x562dc5['newRange']=_0x562dc5['oldRange']?_0xdecb74['model']['createRange'](_0x562dc5['oldRange']['start'],_0x562dc5['oldRange']['end']):null);},{'priority':'highest'});}['destroy'](){return this['_domEmitter']['stopListening'](),super['destroy']();}['createUserMarkerOperations'](){const _0x2621f8=this['editor'],_0x7e262=_0x2621f8['model']['document'],_0x2681e4=_0x2621f8['plugins']['get'](i);_0x2621f8['model']['enqueueChange']({'isUndoable':!0x1},_0x15a49d=>{const _0x176c25='user:range:'+_0x2681e4['mySessionId'],_0x2bf1eb='user:position:'+_0x2681e4['mySessionId'],_0x3d12a5=_0x2621f8['model']['markers']['has'](_0x176c25);_0x2621f8['editing']['view']['hasDomSelection']?Z(_0x2681e4['mySessionId'],_0x7e262['selection']['getFirstRange'](),_0x2621f8['model'],_0x15a49d):_0x3d12a5&&(_0x15a49d['removeMarker'](_0x176c25),_0x15a49d['removeMarker'](_0x2bf1eb));});}}function Z(_0x1f66fd,_0x2273a0,_0x3fc97a,_0x52d52d){const _0x1e8d49='user:range:'+_0x1f66fd,_0x2f94c9='user:position:'+_0x1f66fd,_0x2145b3=_0x2273a0['getContainedElement']();let _0x599258=_0x2273a0['start'];if(_0x2145b3&&_0x2145b3['is']('element','tableCell')){const _0x799a52=function(_0x5dac5d,_0x4860a2){for(const _0x1476ed of _0x5dac5d['getPositions']())if(_0x4860a2['schema']['checkChild'](_0x1476ed,'$text'))return _0x1476ed;}(_0x2273a0,_0x3fc97a);_0x799a52&&(_0x599258=_0x799a52,_0x2273a0=_0x52d52d['createRange'](_0x599258));}const _0x30dfe0=_0x52d52d['createRange'](_0x599258);_0x3fc97a['markers']['has'](_0x1e8d49)?(_0x52d52d['updateMarker'](_0x1e8d49,{'range':_0x2273a0}),_0x52d52d['updateMarker'](_0x2f94c9,{'range':_0x30dfe0})):(_0x52d52d['addMarker'](_0x1e8d49,{'range':_0x2273a0,'usingOperation':!0x0}),_0x52d52d['addMarker'](_0x2f94c9,{'range':_0x30dfe0,'usingOperation':!0x0}));}function V(_0x9ba59d,_0xa2c703,_0x6e84b){const _0x31e8af=_0x9ba59d['t'],t=_0x9ba59d['t'];switch(_0xa2c703){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 _0x31e8af({'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'},_0x6e84b);default:return'';}}let G=0x1;class l extends _0x3f8eef{static ['CollaborativeEditingService']=/* #__PURE__ -- @preserve */
|
|
25
|
-
((()=>_0xbedef)());['_offset'];['sessionId'];['serverHistory'];['_channelId'];['_service'];['_document'];['_compressor'];['_bufferedOperations'];['_knownOperations'];['_knownRootNames'];['_pendingAction'];['_hasSelectionChanged'];['_sendBufferedOperationsDelayId'];['_baseBufferDelay'];['_currentBufferDelay'];['_lastSyncedOperationId'];['_disconnectionOperations'];['_operationIdentifier'];static get['requires'](){return[n,i,H,_0x4f8c9c,_0x13ed0e,_0x42b900];}static get['pluginName'](){return'RealTimeCollaborationClient';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}get['cloudDocumentVersion'](){return this['_lastServerVersion']+this['_offset'];}get['_lastServerVersion'](){return this['serverHistory']['version']-this['_offset'];}get['lastSyncVersion'](){const _0x1d6bc6=this['serverHistory']['getOperations']();for(let _0x4804fa=_0x1d6bc6['length']-0x1;_0x4804fa>=0x0;_0x4804fa--){const _0x3190c6=_0x1d6bc6[_0x4804fa];if(!this['_disconnectionOperations']['has'](_0x3190c6))return _0x3190c6['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0xcde744){if(super(_0xcde744),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x31c901(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0x485f38('collaboration-missing-channelid',this);const _0x421bae=_0xcde744['config']['get']('cloudServices.bundleVersion')||nt;this['_service']=new l['CollaborativeEditingService'](_0x421bae,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0x357f8b(),this['_bufferedOperations']=[],this['_knownOperations']=new WeakSet(),this['_knownRootNames']=new Set(),this['set']('_isPendingUpdate',!0x1),this['set']('_hasSynchronizationProblem',!0x1),this['_pendingAction']=null,this['_hasSelectionChanged']=!0x1,this['_sendBufferedOperationsDelayId']=null,this['_baseBufferDelay']=0x12c,this['_currentBufferDelay']=this['_baseBufferDelay'],this['_lastSyncedOperationId']=null,this['_disconnectionOperations']=new WeakSet(),this['_operationIdentifier']=new J(this['_disconnectionOperations']);}['init'](){const _0xf98aed=this['editor'],_0x3d2db7=_0xf98aed['plugins']['get'](_0x13ed0e),_0x5aa010=_0xf98aed['plugins']['get'](n);this['listenTo'](_0x3d2db7,'getOperationAuthor',(_0x5d8e5f,_0x125065)=>{const _0x43da62=_0x125065[0x0];_0x43da62['_authorId']&&(_0x5d8e5f['return']=_0x3d2db7['getUser'](_0x43da62['_authorId']),_0x5d8e5f['stop']()),null===_0x43da62['_authorId']&&(_0x5d8e5f['return']=null,_0x5d8e5f['stop']());},{'priority':'high'}),this['listenTo'](_0xf98aed['model']['document']['selection'],'change:range',(_0x4a9d28,_0x3811c6)=>{_0x3811c6['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0xf98aed['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0xf98aed['model']['on']('applyOperation',(_0x39371e,_0xdf07ff)=>{const _0xcdfc61=_0xdf07ff[0x0];_0xcdfc61['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0xcdfc61),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['bind']('_isEditingAllowed')['to'](_0x5aa010,'state',this,'_hasSynchronizationProblem',(_0x20c495,_0x5c77be)=>'connected'===_0x20c495&&!_0x5c77be),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0xf98aed['disableReadOnlyMode']('rtc-offline'):_0xf98aed['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0xf98aed['disableReadOnlyMode']('rtc-offline'):_0xf98aed['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async['reconnect'](){const _0x54a127=this['editor']['plugins']['get'](i),_0x6cd2=this['editor']['plugins']['get'](n);try{this['_isPendingUpdate']=!0x0,_0x54a127['unregister'](this['_channelId']);const _0x4e1c61=await this['_service']['reconnect'](_0x6cd2['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0x4e1c61)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x1598fd=await this['_service']['getConnectedSessions']();_0x54a127['register'](this['_channelId'],_0x1598fd),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x46b7af){if(function(_0x357af8){return'404'===_0x357af8['code'];}(_0x46b7af)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0x464775){return'409'===_0x464775['code'];}(_0x46b7af)){const _0x35b595=V(this['editor']['locale'],'The\x20document\x20cannot\x20be\x20connected\x20back\x20to\x20the\x20server.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.');this['_handleReconnectionError'](_0x35b595);}else{if(!(_0x46b7af instanceof $))throw _0x46b7af;this['_handleReconnectionError']();}}}}['destroy'](){const _0x346de1=this['editor']['plugins']['get'](n),_0x169e69=this['editor']['plugins']['get'](i);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x169e69['channelSessions']['has'](this['_channelId'])&&_0x169e69['unregister'](this['_channelId']),_0x346de1['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async['_handleReconnectionResponse'](_0x2d6c4b){if(this['sessionId']!==_0x2d6c4b['sessionId']&&this['_lastSyncedOperationId']!==_0x2d6c4b['lastOperationId'])throw new $();return this['sessionId']=_0x2d6c4b['sessionId'],this['_handleServerResponse']([],{..._0x2d6c4b,'wereChangesApplied':!0x1,'data':_0x2d6c4b['data']},'reconnect');}async['_connectService'](_0x574826,_0x3e6f97=!0x1){const {connection:_0x2c17a}=this['editor']['plugins']['get'](n);l['CollaborativeEditingService']['getConnectedSessions'](_0x2c17a,this['_channelId'])['then'](_0x2ed1bf=>this['_initSessionsHandling'](_0x2ed1bf))['catch'](_0x4a675d=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x4a675d);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x47aafc,_0x3ed209)=>{this['_crash']('realtimecollaborationclient-init-service-internal-error',_0x3ed209);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_isConnected']=!0x1;});const _0x406277=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x574826);this['_isPendingUpdate']=!0x0;const _0x3640f8=await this['_service']['connect'](_0x2c17a,this['_compressOperations'](_0x574826),_0x406277);if(this['sessionId']=_0x3640f8['sessionId'],_0x3e6f97){if(!_0x3640f8['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x3640f8['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0x574826,_0x3640f8,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x3640f8,_0x574826);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}['_handleSendingSelectionMarkers'](){const _0x1d3398=this['editor']['plugins']['get'](i),_0x30dc1f=this['editor']['plugins']['get'](H),_0x5736ea=_0x1d3398['channelSessions']['get'](this['_channelId']);_0x5736ea&&_0x5736ea['length']>0x1?_0x30dc1f['createUserMarkerOperations']():this['listenTo'](_0x1d3398,'sessionAdd:'+this['_channelId'],()=>{0x2===_0x1d3398['channelSessions']['get'](this['_channelId'])['length']&&_0x30dc1f['createUserMarkerOperations']();});}async['_handleReceivedOperations'](_0x59102a,_0x39c70b,_0x3df153,_0x4aadad){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x39c70b){const _0x5c4f51=this['_decompressOperations'](_0x3df153,_0x4aadad);await this['_fetchMissingUsers'](_0x5c4f51),this['_handleExternalOperations'](_0x5c4f51,_0x39c70b,_0x3df153['lastOperationId'])||this['_crash']('realtimecollaborationclient-init-service-incorrect-server-operation');}}async['_connectAfterSessionHasBeenFlushed'](){this['_disconnectService']();const {locale:_0xb729eb}=this['editor'];let _0x454519;try{_0x454519=await this['_service']['getDocumentDetails']();}catch{const _0x29c485=V(_0xb729eb,'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'](_0x29c485);}const _0x143335=_0x454519['currentDocumentSession']||_0x454519['lastDocumentSession'];if(this['_lastSyncedOperationId']!==_0x143335['lastOperationId']){const _0x599d33=V(_0xb729eb,'The\x20last\x20saved\x20version\x20of\x20the\x20document\x20does\x20not\x20match\x20the\x20local\x20version.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.');return void this['_handleReconnectionError'](_0x599d33);}await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);}['_disconnectService'](){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['stopListening'](this['_service']);}['_initSessionsHandling'](_0x44ca30){const _0x251313=this['editor']['plugins']['get'](i);this['listenTo'](_0x251313,'sessionAdd:'+this['_channelId'],(_0x18f4fd,{session:_0x330c7a})=>{if(_0x330c7a['id']===_0x251313['mySessionId']){_0x18f4fd['off']();const _0x307a10=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0x4819fc=_0x330c7a['permissions'];_0x307a10&&_0x307a10['isEnabled']&&(_0x4819fc=_0x4819fc['filter'](_0xde6dfb=>'document:write'!==_0xde6dfb)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0x4819fc,this['_channelId']);}}),_0x251313['register'](this['_channelId'],_0x44ca30);}['_initThrowingOnDataSet'](){const _0x5d187c=this['editor']['data']['set'];this['editor']['data']['set']=(..._0x365a31)=>{if(!_0x365a31[_0x365a31['length']-0x1]['suppressErrorInCollaboration'])throw new _0x485f38('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x5d187c['apply'](this['editor']['data'],_0x365a31);};}['_setUpDataInit'](){this['editor']['data']['on']('init',(_0x5b6c47,[_0x2176ad])=>{if(this['_document']['version'])throw new _0x485f38('realtimecollaborationclient-init-document-already-initialized',this);_0x5b6c47['stop'](),this['_setPendingAction']();const _0x39424e=this['editor']['config']['get']('rootsAttributes'),_0x1befd5=this['_getOperationsFromInitData'](_0x2176ad,_0x39424e);0x0==_0x1befd5['length']&&_0x1befd5['push'](new _0x570f11(0x0)),_0x5b6c47['return']=this['_connectService'](_0x1befd5)['then'](()=>{this['editor']['plugins']['get'](n)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x451d59=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x451d59))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x26e71a,[_0x41be4e,_0x59044d])=>{_0x26e71a['stop']();const _0x126d6b=this['editor']['model']['document']['getRoot'](_0x41be4e);if(!this['_knownRootNames']['has'](_0x41be4e)){const _0x2f9922=_0x59044d&&_0x59044d['data']?_0x59044d['data']:'',_0x23f7c3=_0x59044d&&_0x59044d['attributes']?_0x59044d['attributes']:{};await this['_loadRoot'](_0x41be4e,_0x2f9922,_0x23f7c3);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0x126d6b['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0x126d6b);});},{'priority':'high'});}async['_fetchMissingUsers'](_0x193ed2){const _0x23d595=this['editor']['plugins']['get'](_0x13ed0e),{connection:_0x1d499c}=this['editor']['plugins']['get'](n),_0x4400fa=new Set();for(const _0x41f1bf of _0x193ed2){const _0x30e324=_0x41f1bf['_authorId'];_0x30e324&&!_0x23d595['getUser'](_0x30e324)&&_0x4400fa['add'](_0x30e324);}if(0x0===_0x4400fa['size'])return;const _0x42e915=await lt['getMany'](_0x1d499c,Array['from'](_0x4400fa));for(const _0x2e8402 of _0x42e915)_0x23d595['getUser'](_0x2e8402['id'])||_0x23d595['addUser'](_0x2e8402);}['_getOperationsFromInitData'](_0x5bef58,_0x3565dd={}){const _0x24e4c2=this['editor']['model'],_0x46750c=[];let _0x3e4664=0x0;const _0x183ad6='string'==typeof _0x5bef58?{'main':_0x5bef58}:_0x5bef58;for(const _0x437db2 of Object['keys'](_0x183ad6)){if(!this['_document']['roots']['has'](_0x437db2))throw new _0x485f38('realtimecollaborationclient-init-non-existent-root',this);const _0x27902e=this['editor']['data']['parse'](_0x183ad6[_0x437db2]),_0x2273d5=this['_document']['getRoot'](_0x437db2),_0x3597a3=new _0x2f1f70(_0x24e4c2['createPositionAt'](_0x2273d5,0x0),_0x27902e,_0x3e4664++);_0x46750c['push'](_0x3597a3);for(const [_0x4c901e,_0x3ad7f4]of _0x27902e['markers']){const _0x383421=_0x24e4c2['createRange'](_0x24e4c2['createPositionFromPath'](_0x2273d5,_0x3ad7f4['start']['path']['slice']()),_0x24e4c2['createPositionFromPath'](_0x2273d5,_0x3ad7f4['end']['path']['slice']())),_0x54fd65=new _0x4ce44a(_0x4c901e,null,_0x383421,_0x24e4c2['markers'],!0x0,_0x3e4664++);_0x46750c['push'](_0x54fd65);}}if(_0x3565dd)for(const [_0x44a2d6,_0x4dcf79]of Object['entries'](_0x3565dd)){const _0x53da42=_0x24e4c2['document']['getRoot'](_0x44a2d6);if(!_0x53da42)throw new _0x485f38('multi-root-editor-root-attributes-no-root',null);for(const [_0x2a0f30,_0x484442]of Object['entries'](_0x4dcf79))if(null!==_0x484442){const _0x109cd6=new _0x721d15(_0x53da42,_0x2a0f30,null,_0x484442,_0x3e4664++);_0x46750c['push'](_0x109cd6);}}return _0x46750c;}async['_loadRoot'](_0x325b18,_0x1b9a1f,_0x47fb8d){this['_getOperationsFromInitData']({[_0x325b18]:_0x1b9a1f},{[_0x325b18]:_0x47fb8d})['forEach']((_0x296452,_0x35ca72)=>{_0x296452['baseVersion']=this['_document']['version']+_0x35ca72,_0x296452['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x296452);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async['_handleInitialConnectionData'](_0x19bbdf,_0xb7d6b1){let _0x217cdf;this['_offset']=_0x19bbdf['offset'];const _0x23034a=_0x19bbdf['wereChangesApplied']&&!_0x19bbdf['initData'],_0x46b87c=_0x23034a?0x0:_0x19bbdf['data']['baseVersion'];if(_0xb7d6b1['forEach'](_0x416eea=>{_0x416eea['_isInit']=!0x0,_0x416eea['createdAt']=_0x19bbdf['sessionCreatedAt'],_0x416eea['_authorId']=null;}),_0x23034a)_0x217cdf=_0xb7d6b1,this['_applyOperationsSet'](_0x217cdf,_0x23034a);else{if(_0x19bbdf['initData']){const _0x247cc8=this['_getOperationsFromInitData'](_0x19bbdf['initData']);this['_document']['history']['version']=-_0x247cc8['length'],_0x247cc8['forEach'](_0x30ba0f=>{_0x30ba0f['baseVersion']-=_0x247cc8['length'],_0x30ba0f['createdAt']=_0x19bbdf['sessionCreatedAt'],_0x30ba0f['_isInit']=!0x0,_0x30ba0f['_authorId']=null;}),this['_applyOperationsSet'](_0x247cc8,!0x0),this['serverHistory']['version']=-_0x247cc8['length']+this['_offset'],this['_updateServerHistory'](_0x247cc8);}this['_document']['history']['version']=_0x46b87c,_0x217cdf=this['_decompressOperations'](_0x19bbdf['data'],_0x19bbdf['metadata']),await this['_fetchMissingUsers'](_0x217cdf),this['_applyOperationsSet'](_0x217cdf,_0x23034a);}_0x19bbdf['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x217cdf,_0x19bbdf['lastOperationId']),this['_lastSyncedOperationId']=_0x19bbdf['lastOperationId']),this['serverHistory']['version']=_0x46b87c+this['_offset'],this['_updateServerHistory'](_0x217cdf),_0xb7d6b1['filter'](_0x2762d6=>{const _0x355718=this['_getAffectedRoot'](_0x2762d6);return _0x355718&&!this['_knownRootNames']['has'](_0x355718);})['forEach']((_0x1664f6,_0xc4e726)=>{_0x1664f6['baseVersion']=this['_document']['version']+_0xc4e726,this['_saveOperationInBuffer'](_0x1664f6);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x54f677,_0x2856ba){const _0x5a4f57=_0x2856ba&&_0x2856ba['message'];if(_0x5a4f57&&_0x5a4f57['startsWith']('realtimecollaborationclient'))throw _0x2856ba;const _0xf77c10=this['editor']['plugins']['get'](n);throw this['_isPendingUpdate']=!0x0,_0xf77c10['disconnect'](),this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0x485f38(_0x54f677,this['editor'],_0x5a4f57?{'originalError':_0x5a4f57}:void 0x0);}['_saveOperationInBuffer'](_0x419457){this['_knownOperations']['has'](_0x419457)||(this['_knownOperations']['add'](_0x419457),this['_bufferedOperations']['push'](_0x419457),this['_pendingAction']||'marker'==_0x419457['type']&&!_0x419457['affectsData']||this['_setPendingAction']());}['_sendBufferedOperationsDelayed'](_0x1d3155=!0x1){!_0x1d3155&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0x1209a3=>{_0x1209a3&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0x221151=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0x6269b1){return _0x6269b1['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x6269b1['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0x6269b1['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0x221151)||this['_crash'](_0x221151['message'],_0x221151);});},this['_currentBufferDelay']));}['_waitUntilSynced'](){return new Promise(_0x13a6da=>{this['on']('change:_isPendingUpdate',()=>{_0x13a6da();});});}async['_sendBufferedOperations'](){const _0x38b166=this['editor']['plugins']['get'](H);if(this['_shouldSendSelectionUpdate']()&&(_0x38b166['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x2ed1f0=[...this['_bufferedOperations']];for(const _0x1bab68 of _0x2ed1f0)_0x1bab68['wasUndone']=this['_document']['history']['isUndoneOperation'](_0x1bab68);const _0x24c22d=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x2ed1f0),_0x3fa8eb=G++,_0x182ed0=this['_compressOperations'](_0x2ed1f0),_0x44ff38=await this['_service']['sendOperations'](_0x182ed0,_0x182ed0['baseVersion'],_0x24c22d);try{return await this['_handleServerResponse'](_0x2ed1f0,_0x44ff38,_0x3fa8eb);}catch(_0x496df7){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0x496df7);}}async['_handleServerResponse'](_0x5926a3,_0xc55628,_0x2f6725){if('error'in _0xc55628)throw _0xc55628['error'];let _0x564ecd=!0x1;if(_0xc55628['wereChangesApplied']){_0xc55628['lastOperationId']&&(this['_lastSyncedOperationId']=_0xc55628['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x68f1da=>!_0x5926a3['includes'](_0x68f1da));for(const _0x2a795d of _0x5926a3)_0x2a795d['createdAt']='lastOperationAcceptedAt'in _0xc55628&&_0xc55628['lastOperationAcceptedAt']||void 0x0;K(_0x5926a3,_0xc55628['version']-_0x5926a3['length']),this['_updateServerHistory'](_0x5926a3);const _0x5dc9f0=_0x5926a3['filter'](_0xae423f=>{if(!_0xae423f['_isInit'])return!0x1;const _0x32f6f1=this['_getAffectedRoot'](_0xae423f);return _0x32f6f1&&!this['_knownRootNames']['has'](_0x32f6f1);});K(_0x5dc9f0,this['_document']['version']),this['_applyOperationsSet'](_0x5dc9f0),_0x564ecd=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0x1c6912=this['_decompressOperations'](_0xc55628['data'],_0xc55628['metadata'])['filter'](_0x43462a=>_0x43462a['baseVersion']>=this['_lastServerVersion']);_0x1c6912['forEach'](_0x1cf5d1=>this['_addKnownRoot'](_0x1cf5d1)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x42ca85=>!_0x42ca85['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x42ca85))),this['_bufferedOperations']['length']&&K(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0x1c6912),_0x564ecd=this['_handleExternalOperations'](_0x1c6912,_0xc55628['version'],_0xc55628['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x564ecd?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}['_handleExternalOperations'](_0xe96adc,_0x1ee32e,_0x136cb1){try{const _0x3c011a={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x30938a,operationsB:_0x41fbae,originalOperations:_0x31e47d}=_0x17dfb6(_0xe96adc,this['_bufferedOperations'],_0x3c011a);K(_0x30938a,this['_document']['version']),K(_0x41fbae,_0x1ee32e);for(const _0x2f3912 of _0x30938a){const _0x2a293e=_0x31e47d['get'](_0x2f3912);_0x2f3912['_authorId']=_0x2a293e?_0x2a293e['_authorId']:null;}_0x136cb1&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0xe96adc,_0x136cb1),this['_lastSyncedOperationId']=_0x136cb1),this['_bufferedOperations']=[..._0x41fbae],this['_applyOperationsSet'](_0x30938a),this['_updateServerHistory'](_0xe96adc);}catch(_0x316fd5){return console['error'](_0x316fd5),!0x1;}return!0x0;}['_applyOperationsSet'](_0x54a156,_0x2f7d22=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0x1a2468=>{for(const _0x525b70 of _0x54a156)this['_knownOperations']['add'](_0x525b70),this['_addKnownRoot'](_0x525b70),_0x1a2468['batch']['addOperation'](_0x525b70),this['editor']['model']['applyOperation'](_0x525b70);});}['_addKnownRoot'](_0x5c9791){const _0x1db11d=this['_getAffectedRoot'](_0x5c9791);_0x1db11d&&this['_knownRootNames']['add'](_0x1db11d);}['_getAffectedRoot'](_0x5a516f){let _0x2b31ce,_0x52c7ef;switch(_0x5a516f['type']){case'insert':_0x2b31ce=_0x5a516f['position']['root'];break;case'marker':if(_0x52c7ef=_0x5a516f['newRange'],!_0x52c7ef)return null;_0x2b31ce=_0x52c7ef['root'];break;case'addRootAttribute':_0x2b31ce=_0x5a516f['root'];break;case'addRoot':_0x2b31ce=_0x5a516f['affectedSelectable'];break;case'move':_0x2b31ce=_0x5a516f['targetPosition']['root'];break;default:return null;}return _0x2b31ce['rootName'];}['_updateServerHistory'](_0x314c11){_0x314c11['forEach'](_0x34ede9=>{const _0x4ecc8e=_0x34ede9['clone']();_0x4ecc8e['_authorId']=_0x34ede9['_authorId'],_0x4ecc8e['_isInit']=!!_0x34ede9['_isInit'],_0x4ecc8e['createdAt']=_0x34ede9['createdAt'],_0x4ecc8e['baseVersion']+=this['_offset'],_0x34ede9['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x4ecc8e),this['serverHistory']['addOperation'](_0x4ecc8e);});}['_handleReconnectionError'](_0x557bf7){const _0x30245c=this['editor']['plugins']['get']('Notification'),_0x3b44a5=this['editor']['locale'];_0x557bf7||(_0x557bf7=V(_0x3b44a5,'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.')),_0x30245c['showWarning'](_0x557bf7,{'title':V(_0x3b44a5,'Synchronization\x20issue'),'namespace':'real-time-collaboration'}),this['_hasSynchronizationProblem']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_bufferedOperations']=[],this['editor']['plugins']['get'](n)['disconnect']();}['_setPendingAction'](){this['_pendingAction']||(this['_pendingAction']=this['editor']['plugins']['get'](_0x4f8c9c)['add'](V(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}['_clearPendingAction'](){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x4f8c9c)['remove'](this['_pendingAction']),this['_pendingAction']=null);}['_compressOperations'](_0x4f498){const _0x33430a=_0x4f498['map'](_0x43e571=>_0x43e571['toJSON']());return this['_compressor']['compress'](_0x33430a);}['_decompressOperations'](_0x5df01d,_0x2267e7){return this['_compressor']['decompress'](_0x5df01d)['map']((_0x31c38c,_0x4dc919)=>{const _0x161805='init'==_0x2267e7[_0x4dc919]['type'];if('InsertOperation'==_0x31c38c['__className']){const _0xf2e5b2=_0x31c38c['position']['root'];!this['_document']['getRoot'](_0xf2e5b2)&&(this['_document']['createRoot']('$root',_0xf2e5b2)['_isAttached']=!0x1);}const _0x1800a4=_0x4b0210['fromJSON'](_0x31c38c,this['_document']);return _0x1800a4['wasUndone']=_0x31c38c['wasUndone'],_0x1800a4['_isInit']=_0x161805,_0x1800a4['_authorId']=_0x161805?null:_0x2267e7[_0x4dc919]['userId'],_0x1800a4['_isDisconnection']='cs:removeUser'===_0x2267e7[_0x4dc919]['type'],_0x1800a4['createdAt']=_0x2267e7[_0x4dc919]['createdAt'],_0x1800a4;});}['_refreshUserSelectionMarkers'](){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}['_shouldSendSelectionUpdate'](){const _0x40685c=this['editor']['plugins']['get'](i)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0x40685c&&_0x40685c['length']>0x1&&this['_hasSelectionChanged'];}['_shouldSendUpdate'](){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}}class $ extends Error{}function K(_0x444ba9,_0x4f8d6c){for(const _0x22da87 of _0x444ba9)_0x22da87['baseVersion']=_0x4f8d6c++;}class J{['_ignoredOperations'];['_operationToId'];constructor(_0x18b614){this['_ignoredOperations']=_0x18b614,this['_operationToId']=new WeakMap();}['getIdOfTheLastOperation'](_0x5d70ea){let _0x9af3a8=_0x5d70ea['length'];for(;_0x9af3a8--;){const _0x11e0e3=_0x5d70ea[_0x9af3a8];if(!this['_ignoredOperations']['has'](_0x11e0e3)){if(!this['_operationToId']['has'](_0x11e0e3)){const _0x282115=_0x55751d()['slice'](0x1,0x12);this['_operationToId']['set'](_0x11e0e3,_0x282115);}return this['_operationToId']['get'](_0x11e0e3);}}}['setIdForTheLastOperation'](_0x34a6af,_0x1d2be7){if(!_0x1d2be7)return;let _0x272a21=_0x34a6af['length'];for(;_0x272a21--;){const _0x165be2=_0x34a6af[_0x272a21];this['_ignoredOperations']['has'](_0x165be2)||this['_operationToId']['set'](_0x165be2,_0x1d2be7);}}}class a extends _0x3f8eef{static get['requires'](){return[l];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class s extends _0x286715{static ['CommentsService']=/* #__PURE__ -- @preserve */
|
|
26
|
-
((()=>_0x23913b)());['_services'];static get['requires'](){return[n,'CommentsRepository',i,_0x13ed0e];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x190657){super(_0x190657),this['_services']=new Map();}async['init'](){const _0x22f562=this['context'],_0x4e2be2=_0x22f562['plugins']['get']('CommentsRepository');if(_0x22f562['plugins']['get'](n)['addToReconnectionStack'](this),_0x4e2be2['adapter']={'addCommentThread':async({channelId:_0x24b432,threadId:_0x48b80e,comments:_0xbecb59,resolvedAt:_0x2e625d,resolvedBy:_0x16655f,context:_0x21b563,attributes:_0x5038dd})=>{const _0x2417c7=await this['_getService'](_0x24b432)['addCommentThread']({'commentThreadId':_0x48b80e,'comments':_0xbecb59['map'](_0x133d8e=>function(_0xd1ac73,_0x5ba433,_0x2f3364){return{'commentThreadId':_0x2f3364,'commentId':_0xd1ac73['commentId'],'userId':_0xd1ac73['authorId'],'content':_0xd1ac73['content'],'documentId':_0x5ba433,'createdAt':_0xd1ac73['createdAt'],'attributes':_0xd1ac73['attributes']||{}};}(_0x133d8e,_0x24b432,_0x48b80e)),'resolvedAt':_0x2e625d,'resolvedBy':_0x16655f,'context':_0x21b563,'attributes':_0x5038dd})['catch'](dt);return{'threadId':_0x2417c7['commentThreadId'],'comments':_0x2417c7['comments']};},'getCommentThread':async({channelId:_0x5987ac,threadId:_0x426e03})=>{const _0xe50bcd=await this['_getService'](_0x5987ac)['getCommentThread'](_0x426e03)['catch'](dt);return _0xe50bcd['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0xe50bcd]),{'threadId':_0xe50bcd['commentThreadId'],'comments':_0xe50bcd['comments']['map'](B),'context':_0xe50bcd['context'],'resolvedAt':_0xe50bcd['resolvedAt'],'resolvedBy':_0xe50bcd['resolvedBy'],'attributes':_0xe50bcd['attributes']||{}});},'updateCommentThread':async({channelId:_0x337823,threadId:_0x402044,context:_0x145b5a,unlinkedAt:_0x13e459,attributes:_0x4f8f0f})=>this['_getService'](_0x337823)['updateCommentThread']({'commentThreadId':_0x402044,'context':_0x145b5a,'attributes':_0x4f8f0f,'unlinkedAt':_0x13e459})['catch'](F)['catch'](dt),'resolveCommentThread':async({channelId:_0x38fe3c,threadId:_0x121a5b})=>{const _0x6a0b70=await this['_getService'](_0x38fe3c)['resolveCommentThread'](_0x121a5b)['catch'](F)['catch'](dt);return{'threadId':_0x6a0b70['commentThreadId'],'resolvedAt':_0x6a0b70['resolvedAt'],'resolvedBy':_0x6a0b70['resolvedBy']};},'reopenCommentThread':async({channelId:_0x3c7739,threadId:_0x3d71a8})=>this['_getService'](_0x3c7739)['reopenCommentThread'](_0x3d71a8)['catch'](F)['catch'](dt),'removeCommentThread':({channelId:_0x1d4614,threadId:_0x1bc106})=>this['_getService'](_0x1d4614)['removeCommentThread'](_0x1bc106)['catch'](F)['catch'](dt),'addComment':({channelId:_0x441886,threadId:_0x8fb66a,commentId:_0x2ff6ee,content:_0x11d209,attributes:_0x197fab})=>this['_getService'](_0x441886)['addComment'](_0x8fb66a,_0x2ff6ee,_0x11d209,_0x197fab)['catch'](dt),'updateComment':({channelId:_0x285cfc,threadId:_0x50a66d,commentId:_0x4a3da6,content:_0x40289c,attributes:_0x37db14})=>this['_getService'](_0x285cfc)['updateComment'](_0x50a66d,_0x4a3da6,_0x40289c,_0x37db14)['catch'](F)['catch'](dt),'removeComment':({channelId:_0x530a1a,threadId:_0x35dbad,commentId:_0x4b2b7c})=>this['_getService'](_0x530a1a)['removeComment'](_0x35dbad,_0x4b2b7c)['catch'](F)['catch'](dt)},_0x22f562 instanceof _0x398c6e){const _0x3d890a=_0x22f562['config']['get']('collaboration.channelId'),_0x54a9f4=_0x22f562['plugins']['get'](i);await this['_setUpService'](_0x3d890a);const _0x240446=await this['_services']['get'](_0x3d890a)['getConnectedSessions']();this['listenTo'](_0x54a9f4,'sessionAdd:'+_0x3d890a,(_0x38c857,{session:_0x3a7297})=>{_0x3a7297['id']===_0x54a9f4['mySessionId']&&(_0x38c857['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x3a7297['permissions'],_0x3d890a));}),_0x54a9f4['register'](_0x3d890a,_0x240446);}}async['_setUpService'](_0x109cfa){if(this['_services']['has'](_0x109cfa))throw new _0x485f38('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0x109cfa});const _0x96b86c=this['context']['plugins']['get']('CommentsRepository'),_0x12ea6b=new s['CommentsService'](_0x109cfa);this['_services']['set'](_0x109cfa,_0x12ea6b),this['listenTo'](_0x12ea6b,'commentThreadAdded',(_0x4e5561,_0x4e5353)=>{const {commentThreadId:_0x5b1b41,documentId:_0x1c0d82,context:_0x41ba42,attributes:_0x3f7764,resolvedAt:_0x1d948f,resolvedBy:_0x1bb879,comments:_0x337dab}=_0x4e5353;_0x96b86c['getCommentThread'](_0x5b1b41)||_0x96b86c['addCommentThread']({'threadId':_0x5b1b41,'channelId':_0x1c0d82,'comments':_0x337dab?_0x337dab['map'](B):[],'context':_0x41ba42,'attributes':_0x3f7764,'resolvedAt':_0x1d948f,'resolvedBy':_0x1bb879,'isFromAdapter':!0x0});}),this['listenTo'](_0x12ea6b,'commentThreadUpdated',(_0x1e2993,{commentThreadId:_0x2124b8,documentId:_0xf5934,context:_0x3dfae7,unlinkedAt:_0x484dee,attributes:_0x833517})=>{_0x96b86c['getCommentThread'](_0x2124b8)&&_0x96b86c['updateCommentThread']({'threadId':_0x2124b8,'channelId':_0xf5934,'context':_0x3dfae7,'unlinkedAt':_0x484dee,'attributes':_0x833517,'isFromAdapter':!0x0});}),this['listenTo'](_0x12ea6b,'commentThreadResolved',(_0x17b62d,{commentThreadId:_0x51f1f6,resolvedBy:_0x40bbd1,resolvedAt:_0x311f40})=>{const _0x47373e=_0x96b86c['getCommentThread'](_0x51f1f6);_0x47373e&&_0x47373e['resolve']({'resolvedBy':_0x40bbd1,'resolvedAt':_0x311f40,'isFromAdapter':!0x0});}),this['listenTo'](_0x12ea6b,'commentThreadReopened',(_0x47070b,{commentThreadId:_0x108dec})=>{const _0x1af5e2=_0x96b86c['getCommentThread'](_0x108dec);_0x1af5e2&&_0x1af5e2['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0x12ea6b,'commentThreadRemoved',(_0x7b8eeb,{commentThreadId:_0x966ac7})=>{const _0x2e852a=_0x96b86c['getCommentThread'](_0x966ac7);_0x2e852a&&_0x2e852a['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0x12ea6b,'commentAdded',(_0x4f9594,_0x22bb65)=>{const _0x240eda=_0x22bb65['commentThreadId'],_0x1c320e=_0x96b86c['getCommentThread'](_0x240eda);_0x1c320e&&_0x1c320e['addComment']({...B(_0x22bb65),'isFromAdapter':!0x0});}),this['listenTo'](_0x12ea6b,'commentUpdated',(_0x5e1034,{commentThreadId:_0x477119,commentId:_0x32d504,content:_0x4acc05,attributes:_0x3ee311})=>{const _0x2234c0=_0x96b86c['getCommentThread'](_0x477119);if(_0x2234c0){const _0x47a618=_0x2234c0['getComment'](_0x32d504);_0x47a618&&_0x47a618['update']({'content':_0x4acc05,'attributes':_0x3ee311,'isFromAdapter':!0x0});}}),this['listenTo'](_0x12ea6b,'commentRemoved',(_0x453dac,{commentThreadId:_0x214f2f,commentId:_0x83d075})=>{const _0x49b40d=_0x96b86c['getCommentThread'](_0x214f2f);if(_0x49b40d){const _0x5488c7=_0x49b40d['getComment'](_0x83d075);_0x5488c7&&_0x5488c7['remove']({'isFromAdapter':!0x0});}}),await this['_connectService'](_0x109cfa);}['destroy'](){if(this['context']instanceof _0x398c6e){const _0x25fbf6=this['context']['config']['get']('collaboration.channelId');this['_terminateService'](_0x25fbf6);}}['_terminateService'](_0x250915){if(!this['_services']['has'](_0x250915))throw new _0x485f38('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0x250915});this['_getService'](_0x250915)['disconnect'](),this['_services']['delete'](_0x250915);}async['reconnect'](){for(const _0x18bafe of this['_services']['keys']())await this['_connectService'](_0x18bafe);if(this['context']instanceof _0x398c6e){const _0x3246ce=this['context']['config']['get']('collaboration.channelId'),_0x353d7f=this['context']['plugins']['get'](i);_0x353d7f['unregister'](_0x3246ce);const _0x42d6ea=await this['_services']['get'](_0x3246ce)['getConnectedSessions']();_0x353d7f['register'](_0x3246ce,_0x42d6ea);}}async['_connectService'](_0x4826f3){const {connection:_0x306d25}=this['context']['plugins']['get'](n),_0x2e67b1=this['context']['plugins']['get']('CommentsRepository'),_0x5883c0=this['_services']['get'](_0x4826f3),_0xe4a69e=await _0x5883c0['connect'](_0x306d25);await this['_fetchMissingUsersForThreads'](_0xe4a69e);const _0x51cfe9=new Set(Array['from'](_0x2e67b1['getCommentThreads']({'channelId':_0x4826f3}),_0x53afc2=>_0x53afc2['id']));for(const _0x1c8644 of _0xe4a69e)_0x1c8644['deletedAt']||_0x51cfe9['delete'](_0x1c8644['commentThreadId']);for(const _0x31521b of _0x51cfe9)_0x2e67b1['getCommentThread'](_0x31521b)['remove']({'isFromAdapter':!0x0});for(const _0x58edc9 of _0xe4a69e){let _0x32efa9=_0x2e67b1['getCommentThread'](_0x58edc9['commentThreadId']);const {commentThreadId:_0xaa75a3,context:_0x390e89,attributes:_0x2611de,resolvedBy:_0x4dec34,resolvedAt:_0x3e9cef,unlinkedAt:_0x2c38b7,deletedAt:_0xf1efdd}=_0x58edc9;if(_0xf1efdd)continue;_0x32efa9||(_0x32efa9=_0x2e67b1['addCommentThread']({'channelId':_0x4826f3,'threadId':_0xaa75a3,'context':_0x390e89,'attributes':_0x2611de||{},'resolvedBy':_0x4dec34,'resolvedAt':_0x3e9cef,'unlinkedAt':_0x2c38b7,'isFromAdapter':!0x0}));const _0x2bd7b4=new Set(Array['from'](_0x32efa9['comments'],_0x253e44=>_0x253e44['id']));for(const _0x36b8e3 of _0x58edc9['comments'])_0x2bd7b4['delete'](_0x36b8e3['commentId']);for(const _0xe9c5c4 of _0x2bd7b4)_0x32efa9['getComment'](_0xe9c5c4)['remove']({'isFromAdapter':!0x0});for(const _0xd99cab of _0x58edc9['comments']){const _0x51373f=_0x32efa9['getComment'](_0xd99cab['commentId']);_0x51373f?_0x51373f['content']!==_0xd99cab['content']&&_0x51373f['update']({'content':_0xd99cab['content'],'isFromAdapter':!0x0}):_0x32efa9['addComment'](Object['assign'](B(_0xd99cab),{'isFromAdapter':!0x0}));}}}['_getService'](_0x343915){if(!this['_services']['has'](_0x343915))throw new _0x485f38('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0x343915});return this['_services']['get'](_0x343915);}async['_fetchMissingUsersForThreads'](_0xf62130){const _0x25b84a=this['context']['plugins']['get'](_0x13ed0e),{connection:_0x5f01c5}=this['context']['plugins']['get'](n),_0x2f9e16=new Set();for(const {resolvedBy:_0x1d4c70,comments:_0x1c4c53}of _0xf62130){_0x1d4c70&&!_0x25b84a['getUser'](_0x1d4c70)&&_0x2f9e16['add'](_0x1d4c70);for(const {userId:_0x3cf86b}of _0x1c4c53)_0x25b84a['getUser'](_0x3cf86b)||_0x2f9e16['add'](_0x3cf86b);}if(0x0===_0x2f9e16['size'])return;const _0x3a30f7=await lt['getMany'](_0x5f01c5,Array['from'](_0x2f9e16));for(const _0x2a6c2f of _0x3a30f7)_0x25b84a['getUser'](_0x2a6c2f['id'])||_0x25b84a['addUser'](_0x2a6c2f);}}async function F(_0x28531c){if('404'!==_0x28531c['code'])throw _0x28531c;}function dt(_0x194482){if((_0x1f41cc=_0x194482)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0x1f41cc['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x1f41cc['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0x1f41cc;throw _0x194482;}function B(_0x196ce5){return{'threadId':_0x196ce5['commentThreadId'],'commentId':_0x196ce5['commentId'],'content':_0x196ce5['content'],'createdAt':_0x196ce5['createdAt'],'authorId':_0x196ce5['userId'],'attributes':_0x196ce5['attributes']||{}};}class m extends _0x3f8eef{static ['TrackChangesService']=/* #__PURE__ -- @preserve */
|
|
27
|
-
((()=>
|
|
28
|
-
((()=>it)());['_lastRequestId'];['_revisionTracker'];['_revisionHistoryService'];['_oldOffset'];static get['requires'](){return[n,l,'RevisionHistory',i,_0x13ed0e];}static get['pluginName'](){return'CloudServicesRevisionHistoryAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0xd571df){super(_0xd571df);const _0x3e1b0f=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new c['RevisionHistoryService'](_0x3e1b0f);}async['init'](){const _0x1ec51c=this['editor']['plugins']['get'](l),_0x57660d=_0x1ec51c['serverHistory'],_0x54414b=this['editor']['plugins']['get'](n);this['_revisionTracker']['setSource']({'history':_0x57660d,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0x1ec51c['sessionId']});const _0x2226dd=this['editor']['config']['get']('cloudServices.bundleVersion')||nt,_0x42199b=await tt['isBundleUploaded'](_0x54414b['connection'],_0x2226dd);this['editor']['plugins']['get']('RevisionHistory')['adapter']={'getRevision':async({revisionId:_0x5be47f})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0x5be47f)),'updateRevisions':async _0x526c9a=>{await this['_waitForServiceReady']();const _0x3652a4=this['_revisionTracker']['currentRevision'];if(_0x42199b&&0x1===_0x526c9a['length']&&_0x526c9a[0x0]['id']===_0x3652a4['id'])return _0x526c9a;for(const _0x164ce3 of _0x526c9a)_0x164ce3['id']===_0x3652a4['id']&&(_0x164ce3['isEmptyCurrent']=_0x164ce3['fromVersion']===_0x164ce3['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0x526c9a,this['_lastRequestId'])['then'](_0x27b103=>(this['_lastRequestId']=_0x27b103,_0x526c9a))['catch'](_0x172cda=>{if(st(_0x172cda)||'400'===_0x172cda['code']&&void 0x0!==_0x172cda['data']['wrongRequestId']){for(const _0x5cd5c1 of _0x526c9a){!this['_revisionTracker']['repository']['getRevision'](_0x5cd5c1['id'])||this['_revisionTracker']['_bufferUpdate'](_0x5cd5c1['id'],_0x5cd5c1,!0x1);}if(st(_0x172cda))throw _0x172cda;return _0x526c9a;}throw _0x172cda;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0x515c7e,{revisionsData:_0x3870c6,requestId:_0x4c1ba5})=>{Math['max'](..._0x3870c6['map'](_0x42e1ba=>_0x42e1ba['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0x3870c6,_0x4c1ba5);}):this['_handleRevisionsUpdate'](_0x3870c6,_0x4c1ba5);});const {revisions:_0x1be94c,requestId:_0xd3f435}=await this['_revisionHistoryService']['connect'](_0x54414b['connection']);_0x54414b['addToReconnectionStack'](this),this['_lastRequestId']=_0xd3f435,await this['_fetchMissingUsers'](_0x1be94c);for(const _0x39f13e of _0x1be94c)this['_revisionTracker']['addRevisionData'](_0x39f13e);this['listenTo'](_0x1ec51c,'change:_isConnected',(_0x2d8e9b,_0x2b27b5,_0x6cbfbc)=>{_0x6cbfbc&&(this['_oldOffset']=_0x1ec51c['_offset'],_0x2d8e9b['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](_0x54414b,'state',_0x5cea8d=>_0x5cea8d===te['CONNECTED']);}async['reconnect'](){const _0x4cab00=this['editor']['plugins']['get'](n),_0x5b81bc=this['editor']['plugins']['get'](l),_0xad9b4=async()=>{const _0x52688d=this['_revisionTracker']['currentRevision'],_0x53d173=_0x52688d['id'],_0x482ad5=_0x53d173!==_0x5b81bc['sessionId'];if(_0x482ad5){const _0x298cd5=_0x5b81bc['_offset']-this['_oldOffset'],_0x45f7c2=this['_getLatestVersionFromServerOperations']();this['_revisionTracker']['_revisionDataBuilder']['reInit']();if(_0x52688d['toVersion']+_0x298cd5!==_0x45f7c2){const _0xad4576=_0x52688d['fromVersion']+_0x298cd5,_0xe3df67=this['editor']['plugins']['get'](_0x13ed0e),_0x182133=this['_revisionTracker']['buildRevisionData']({'revision':_0x52688d,'from':_0xad4576,'to':_0x45f7c2});_0x182133['id']=_0x52688d['id'];const _0x15cc4f=_0x182133['authorsIds']['map'](_0x4d9d90=>_0xe3df67['getUser'](_0x4d9d90));_0x52688d['_update']({..._0x182133,'authors':_0x15cc4f},!0x0),this['_revisionTracker']['_bufferUpdate'](_0x52688d['id'],_0x182133,!0x0);}this['_revisionTracker']['_startingVersion']=_0x45f7c2,(_0x52688d['toVersion']===_0x52688d['fromVersion']&&!this['_revisionTracker']['_bufferedUpdates']['has'](_0x53d173)&&this['_revisionTracker']['repository']['_revisions']['remove'](_0x53d173),this['_revisionTracker']['_createCurrentRevision'](_0x45f7c2));}const {revisions:_0x4547b6,requestId:_0x31b997}=await this['_revisionHistoryService']['reconnect'](_0x4cab00['connection'],this['_lastRequestId']);_0x482ad5&&_0x4547b6['length']>0x0?_0x5b81bc['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x4547b6),this['_handleRevisionsUpdate'](_0x4547b6,_0x31b997),this['_revisionTracker']['sendBufferedUpdates']());};return _0x5b81bc['_isConnected']?_0xad9b4():new Promise((_0x91d1c3,_0x3f1528)=>{_0x5b81bc['once']('change:_isConnected',()=>{_0xad9b4()['then'](_0x91d1c3)['catch'](_0x3f1528);});});}['destroy'](){super['destroy']();}async['_waitForServiceReady'](){this['_revisionHistoryService']['isConnected']||await new Promise(_0x2fd7b2=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x429705=>{_0x429705['off'](),_0x2fd7b2();});});}['_getLatestVersionFromServerOperations'](){const _0x454281=this['editor']['plugins']['get'](l)['serverHistory']['getOperations']()['reverse']();for(const _0x422a36 of _0x454281)if('marker'!==_0x422a36['type']||_0x422a36['affectsData'])return _0x422a36['baseVersion']+0x1;}['_getLatestVersion'](){const _0x77ccfb=this['editor']['plugins']['get'](l);return new Promise(_0x2e648a=>{_0x77ccfb['_isPendingUpdate']?_0x77ccfb['once']('change:_isPendingUpdate',()=>{_0x2e648a(this['_getLatestVersionFromServerOperations']());}):_0x2e648a(this['_getLatestVersionFromServerOperations']());});}['_handleRevisionsUpdate'](_0x242905,_0x46fd99){const _0x2eb979=this['_revisionTracker']['repository'];this['_lastRequestId']=_0x46fd99;for(const _0x586bd1 of _0x242905){const _0x211e37=_0x2eb979['getRevision'](_0x586bd1['id']);if(_0x211e37){if((_0x586bd1['fromVersion']||_0x586bd1['toVersion'])&&(_0x586bd1['diffData']=null),_0x211e37===this['_revisionTracker']['currentRevision']){const _0x43e9bb=Math['max'](_0x211e37['toVersion'],_0x586bd1['toVersion']),_0x3fe534=Math['max'](_0x211e37['fromVersion'],_0x586bd1['fromVersion']);let _0x23922d;_0x211e37['toVersion']===_0x586bd1['toVersion']&&_0x211e37['fromVersion']===_0x586bd1['fromVersion']?(_0x23922d=!0x0,this['_preventResendingRevisionData'](_0x586bd1)):_0x586bd1['toVersion']===_0x43e9bb&&_0x586bd1['fromVersion']===_0x3fe534?_0x23922d=!0x1:(_0x211e37['toVersion']===_0x43e9bb&&_0x211e37['fromVersion']===_0x3fe534||this['_fixRevision']({'revision':_0x211e37,'from':_0x3fe534,'to':_0x43e9bb}),_0x23922d=!0x0),_0x23922d&&(delete _0x586bd1['fromVersion'],delete _0x586bd1['toVersion'],delete _0x586bd1['diffData'],delete _0x586bd1['createdAt'],delete _0x586bd1['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0x586bd1),this['_preventResendingRevisionData'](_0x586bd1);}else this['_revisionTracker']['addRevisionData'](_0x586bd1);}const _0x4b0ea6=_0x2eb979['getRevisions']();_0x4b0ea6['reverse']();for(let _0x1a9910=0x0;_0x1a9910<_0x4b0ea6['length']-0x1;_0x1a9910++){const _0x260d4d=_0x4b0ea6[_0x1a9910],_0x11d858=_0x4b0ea6[_0x1a9910+0x1];if(_0x260d4d['fromVersion']<_0x11d858['toVersion']){const _0x11a8c2=_0x11d858['toVersion'],_0x22cbad=Math['max'](_0x11a8c2,_0x260d4d['toVersion']);this['_fixRevision']({'revision':_0x260d4d,'from':_0x11a8c2,'to':_0x22cbad});}}}['_fixRevision']({revision:_0x2201e5,from:_0xd280b0,to:_0x6d80c8}={}){const _0x37bb2f=this['editor']['plugins']['get'](_0x13ed0e),_0x53dd98=this['_revisionTracker']['buildRevisionData']({'revision':_0x2201e5,'from':_0xd280b0,'to':_0x6d80c8});_0x53dd98['authors']=_0x53dd98['authorsIds']['map'](_0x3ba8e3=>_0x37bb2f['getUser'](_0x3ba8e3)),_0x2201e5['_update'](_0x53dd98);}['_preventResendingRevisionData'](_0x30ee99){const _0x296fe1={};_0x296fe1['id']=_0x30ee99['id'];for(const _0x15d65e of Object['keys'](_0x30ee99))'id'!==_0x15d65e&&(_0x296fe1[_0x15d65e]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0x296fe1['id'],_0x296fe1,!0x0);}async['_fetchMissingUsers'](_0x45b4a7){const _0x3aa7c2=this['editor']['plugins']['get'](_0x13ed0e),{connection:_0x4ca692}=this['editor']['plugins']['get'](n),_0x2135a6=new Set();for(const _0x411e7e of _0x45b4a7){for(const _0x155a97 of _0x411e7e['authorsIds'])_0x1becf6(_0x155a97);_0x411e7e['creatorId']&&_0x1becf6(_0x411e7e['creatorId']);}if(0x0===_0x2135a6['size'])return;const _0x7b6c8d=await lt['getMany'](_0x4ca692,Array['from'](_0x2135a6));for(const _0x2d62a8 of _0x7b6c8d)_0x3aa7c2['getUser'](_0x2d62a8['id'])||_0x3aa7c2['addUser'](_0x2d62a8);function _0x1becf6(_0x55cbca){_0x3aa7c2['getUser'](_0x55cbca)||_0x2135a6['add'](_0x55cbca);}}}function st(_0x16959b){return _0x16959b['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0x16959b['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x16959b['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class mt extends _0x3f8eef{static get['requires'](){return['RevisionHistory',c,a];}static get['pluginName'](){return'RealTimeCollaborativeRevisionHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class b extends _0x53bf2f{['_collapseAt'];constructor(_0x5960fd,_0x4c903a=0x6){super(_0x5960fd);const _0x4720c2=this['bindTemplate'];this['set']('isHidden',!0x0),this['set']('usersCount',0x0),this['_collapseAt']=_0x4c903a,this['bind']('isHidden')['to'](this,'usersCount',_0x43febd=>_0x43febd<_0x4c903a),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item',_0x4720c2['if']('isHidden','ck-presence-list__counter--hidden')],'role':'listitem'},'children':[{'tag':'div','attributes':{'class':['ck','ck-presence-list__users-counter']},'children':[{'tag':'div','attributes':{'class':['ck','ck-presence-list__users-counter__text']},'children':[{'text':_0x4720c2['to']('usersCount',_0x7a9bb7=>'+'+(_0x7a9bb7-this['_collapseAt']+0x2)['toString']())}]}]}]});}}class is extends _0x53bf2f{['items'];['keystrokes'];constructor(_0x55f6ce){super(_0x55f6ce);const _0x47af52=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0x3beafb(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0x47af52['if']('hasPopup'),'aria-expanded':_0x47af52['to']('isExpanded',_0x2bfd3e=>this['hasPopup']&&String(_0x2bfd3e)),'aria-label':_0x47af52['to']('hasPopup',_0x331399=>V(_0x55f6ce,_0x331399?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0x47af52['to']('hasPopup',_0x256f49=>!!_0x256f49&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items'],'on':{'mouseenter':_0x47af52['to'](()=>this['fire']('presencelist:show')),'mouseleave':_0x47af52['to'](_0x1ffd9c=>{const _0xfe1b6e=_0x1ffd9c,_0x4712b4=document['querySelector']('.ck-presence-list__dropdown-list'),_0x245401=document['querySelector']('.ck-balloon-panel_with-arrow');_0x4712b4?.['contains'](_0xfe1b6e['relatedTarget'])||_0x245401?.['contains'](_0xfe1b6e['relatedTarget'])||this['fire']('presencelist:hide');})}}),this['on']('change:hasPopup',(_0x4b30dc,_0x15ea90,_0x3302cd)=>{this['element']&&(_0x3302cd?this['element']['setAttribute']('aria-expanded',String(this['isExpanded'])):this['element']['removeAttribute']('aria-expanded'));});}['focus'](){this['element']['focus']();}['render'](){super['render'](),this['keystrokes']['listenTo'](this['element']);}}class v extends _0x53bf2f{['counterView'];['inlineListView'];constructor(_0x365f2d,_0x384214=0x6){super(_0x365f2d);const _0x2c6cba=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new b(this['locale'],_0x384214),this['inlineListView']=new is(_0x365f2d),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x5c07f0 of this['inlineListView']['items'])_0x5c07f0['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',_0x2c6cba['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['inlineListView']]});}}class L extends _0x53bf2f{['listWrapperView'];constructor(_0x19d835,_0x4310d3){super(_0x19d835);const _0x58c283=this['bindTemplate'];this['listWrapperView']=new pt(_0x19d835,_0x4310d3),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':V(_0x19d835,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']],'on':{'mouseleave':_0x58c283['to'](_0x53acf6=>{const _0x4d24b1=_0x53acf6,_0x32f0c8=document['querySelector']('.ck-presence-list__list'),_0x1c974b=document['querySelector']('.ck-balloon-panel_with-arrow');_0x32f0c8?.['contains'](_0x4d24b1['relatedTarget'])||_0x1c974b?.['contains'](_0x4d24b1['relatedTarget'])||this['fire']('presencelist:hide');})}});}}class pt extends _0x2a29f{constructor(_0x845e6c,_0x10e06e){super(_0x845e6c);const _0x47373c=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0x10e06e?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0x47373c['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0x47373c['to']('role'),'aria-label':_0x47373c['to']('ariaLabel'),'aria-labelledby':_0x47373c['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0x2f31ee['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0xfa0ff5=this['element'];_0xfa0ff5&&(this['_isScrollable']=Math['max'](_0xfa0ff5['scrollHeight'],_0xfa0ff5['clientHeight'])>0.8*window['innerHeight']);}}class j extends rt{['userView'];constructor(_0x2f49ff,_0x2387dc,_0x1d00db){super(_0x2f49ff);const _0x5f484b=this['bindTemplate'];this['userView']=new ct(_0x2f49ff,_0x2387dc);const _0x310d7e={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0x2387dc['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0x2387dc['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x2387dc['color']['getBackgroundColorClass']()],'aria-hidden':'true'}}]};_0x1d00db&&(_0x310d7e['tag']='button',_0x310d7e['on']={'click':_0x5f484b['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x310d7e);}['focus'](){this['element']['focus']();}}class A extends _0x53bf2f{['userView'];['markerView'];constructor(_0x1f400f,_0x370bf9,_0x37fa10){super(_0x1f400f);const _0x26011f=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new ct(_0x1f400f,_0x370bf9),this['markerView']=new at(_0x1f400f,_0x370bf9);const _0x3e53a3=new ot(_0x1f400f);_0x3e53a3['template']['tag']='span',_0x3e53a3['text']=_0x370bf9['name'];const _0x42dd41={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0x26011f['to']('isFocusable',_0x36a43d=>!!_0x36a43d&&0x0),'aria-labelledby':_0x3e53a3['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0x26011f['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0x26011f['to']('hasTooltip',_0x339563=>!_0x339563),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0x3e53a3]};_0x37fa10&&(_0x42dd41['tag']='button',_0x42dd41['on']={'click':_0x26011f['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x42dd41);}}class at extends _0x53bf2f{constructor(_0x78876c,_0x1dd3a6){super(_0x78876c),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x1dd3a6['color']['getBackgroundColorClass']()],'aria-hidden':'true'}});}}const x={'collapseAt':0x6,'displayMe':!0x0};class r extends _0x286715{['currentDisplayedUsers'];['balloonPanelView'];['view'];['presenceDropdownView'];['_bodyCollection']=null;static get['pluginName'](){return'PresenceListUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x3fa85d){super(_0x3fa85d),this['context']['config']['define']('presenceList',x);const _0x12437a=_0x3fa85d['config']['get']('presenceList.collapseAt');if('number'!=typeof _0x12437a)throw new _0x485f38('presencelist-collapseat-invalid-format',this);if(_0x12437a<0x1)throw new _0x485f38('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](i)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0x311848(),this['balloonPanelView']=new _0x24508e(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get['requires'](){return[i];}['init'](){for(const _0xb3a91a of this['_allConnectedUsers'])this['_handleUserAdd'](_0xb3a91a);this['listenTo'](this['_allConnectedUsers'],'add',(_0x26a51c,_0x194d58)=>{this['_handleUserAdd'](_0x194d58);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0x498100,_0x531b21)=>{this['_handleUserRemove'](_0x531b21);});}['_createView'](){const _0x5056d6=this['context'],_0x2bd445=new v(this['context']['locale'],this['context']['config']['get']('presenceList.collapseAt')),_0x19fe3d=this['balloonPanelView'];if(!_0x3c0fe2(_0x5056d6['config']['get']('presenceList.container')))throw new _0x485f38('presencelist-missing-container',this);return _0x2bd445['counterView']['bind']('usersCount')['to'](this),_0x2bd445['bind']('isCollapsed')['to'](this,'usersCount',_0x46c79a=>{const {collapseAt:_0xc7b319}=_0x5056d6['config']['get']('presenceList'),_0x34dbbb=_0x46c79a>=_0xc7b319;if(_0x34dbbb&&!_0x2bd445['inlineListView']['items']['find'](_0x30939c=>_0x30939c instanceof b)){const _0x5e879e=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['currentDisplayedUsers']['length']==_0x5e879e&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](this['currentDisplayedUsers']['length']-0x1),_0x2bd445['inlineListView']['items']['add'](_0x2bd445['counterView']);}return _0x34dbbb||this['hideDropdown'](),_0x34dbbb;}),_0x2bd445['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0x2aa89d=>{const _0x372526=_0x5056d6['config']['get']('presenceList'),_0x3807d9=new A(_0x5056d6['locale'],_0x2aa89d,!!_0x372526['onClick']);return _0x3807d9['bind']('hasTooltip')['to'](_0x2bd445,'isCollapsed',_0x1d7e9c=>!_0x1d7e9c),_0x3807d9['bind']('isFocusable')['to'](_0x2bd445,'isCollapsed',_0x293dde=>!_0x293dde),_0x372526['onClick']&&this['listenTo'](_0x3807d9,'execute',()=>{this['view']['isCollapsed']||_0x372526['onClick'](_0x2aa89d,_0x3807d9['element']);}),_0x3807d9;}),this['listenTo'](_0x2bd445['inlineListView'],'presencelist:show',()=>{this['view']['isCollapsed']&&this['showDropdown']();}),this['listenTo'](_0x2bd445['inlineListView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();}),_0x2bd445['inlineListView']['keystrokes']['set']('Enter',(_0x45c05d,_0x2ffd4b)=>{this['view']['isCollapsed']&&(this['showDropdown'](),_0x2ffd4b());}),_0x2bd445['render'](),_0x19fe3d['render'](),_0x2addaa({'emitter':_0x2bd445,'activator':()=>_0x19fe3d['isVisible'],'contextElements':[_0x19fe3d['element'],_0x2bd445['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0x5056d6['config']['get']('presenceList.container')['appendChild'](_0x2bd445['element']),this['_bodyCollection']=new _0x490169(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_bodyCollection']['add'](this['balloonPanelView']),_0x2bd445;}['_handleUserAdd'](_0x1ed5d1){if(!this['context']['config']['get']('presenceList.displayMe')&&_0x1ed5d1['isMe'])return;const _0x450b79=this['context']['config']['get']('presenceList.collapseAt')-0x1;for(this['usersCount']++;this['currentDisplayedUsers']['length']>=_0x450b79-(this['view']['isCollapsed']?0x1:0x0)&&this['currentDisplayedUsers']['length']>0x1;)this['currentDisplayedUsers']['remove'](0x1);const _0x565355=_0x1ed5d1['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0x1ed5d1,_0x565355);}['_handleUserRemove'](_0x3e1c78){this['usersCount']--;const {collapseAt:_0x579b12}=this['context']['config']['get']('presenceList'),_0x1a17df=this['usersCount']>=_0x579b12;if(this['currentDisplayedUsers']['get'](_0x3e1c78['id']))this['currentDisplayedUsers']['remove'](_0x3e1c78['id']);else{if(_0x1a17df&&this['currentDisplayedUsers']['length']+0x1===_0x579b12-0x1)return;}if(this['currentDisplayedUsers']['length']+(_0x1a17df?0x1:0x0)<this['usersCount']){for(const _0x69ec14 of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0x69ec14['id'])&&(this['currentDisplayedUsers']['add'](_0x69ec14,Math['min'](this['currentDisplayedUsers']['length']-(_0x1a17df?0x1:0x0),0x1)),this['currentDisplayedUsers']['length']+(_0x1a17df?0x1:0x0)===_0x579b12-0x1))return;}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0x2bcf13=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new L(this['context']['locale'],!!_0x2bcf13['onClick']),this['view']['inlineListView']['isExpanded']=!0x0,this['listenTo'](this['presenceDropdownView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();});const {listWrapperView:_0x13e396}=this['presenceDropdownView'];_0x13e396['items']['bindTo'](this['_allConnectedUsers'])['using'](_0x569ae9=>{if(!_0x2bcf13['displayMe']&&_0x569ae9['isMe'])return null;const _0x2160a1=new j(this['context']['locale'],_0x569ae9,!!_0x2bcf13['onClick']);return _0x2bcf13['onClick']&&this['listenTo'](_0x2160a1,'execute',()=>{_0x2bcf13['onClick'](_0x569ae9,_0x2160a1['element']);}),_0x2160a1;}),this['balloonPanelView']['content']['add'](this['presenceDropdownView']),this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element']}),_0x13e396['focus'](),_0x13e396['checkIfScrollable']();const _0x3a59eb=(_0x363dd6,_0x43fbe4)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0x43fbe4();};_0x13e396['keystrokes']['set']('Esc',_0x3a59eb),_0x13e396['keystrokes']['set']('Shift+Tab',_0x3a59eb),_0x13e396['keystrokes']['set']('Tab',(_0x5f1f3e,_0x34fd66)=>{!function(_0x549121){const _0x48aedf=['a','button','input','select','textarea','[tabindex]','[contenteditable]']['map'](_0x2fc532=>_0x2fc532+':not([disabled]):not([tabindex=\x22-1\x22])')['join'](','),_0x494eea=[...document['body']['querySelectorAll'](_0x48aedf)]['filter'](_0x4dad4b=>_0x4dad4b===document['activeElement']||_0x4dad4b['offsetWidth']+_0x4dad4b['offsetHeight']>0x0)['sort']((_0x280d99,_0x39f934)=>(_0x280d99['tabIndex']||0x0)-(_0x39f934['tabIndex']||0x0)),_0x332937=_0x494eea['indexOf'](_0x549121),_0x1fb978=_0x494eea[(_0x332937+0x1)%_0x494eea['length']];_0x1fb978&&_0x1fb978['focus']();}(this['view']['element']),this['hideDropdown'](),_0x34fd66();}),_0x13e396['focusTracker']['add'](this['view']['element']),_0x13e396['focusTracker']['on']('change:isFocused',(_0x323d8a,_0x1b7e63,_0x4d22ad)=>{_0x4d22ad||this['hideDropdown']();});}['hideDropdown'](){this['presenceDropdownView']&&(this['view']['inlineListView']['isExpanded']=!0x1,this['balloonPanelView']['unpin'](),this['balloonPanelView']['content']['remove'](this['presenceDropdownView']),this['presenceDropdownView']['destroy'](),this['presenceDropdownView']=void 0x0);}['destroy'](){super['destroy'](),this['view']&&this['view']['isRendered']&&this['view']['destroy'](),this['_bodyCollection']&&(this['_bodyCollection']['detachFromDom'](),this['_bodyCollection']['destroy'](),this['_bodyCollection']=null);}}class gt extends _0x286715{static get['requires'](){return[i,r];}static get['pluginName'](){return'PresenceList';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}export{s as CloudServicesCommentsAdapter,c as CloudServicesRevisionHistoryAdapter,m as CloudServicesTrackChangesAdapter,gt as PresenceList,r as PresenceListUI,l as RealTimeCollaborationClient,g as RealTimeCollaborativeComments,a as RealTimeCollaborativeEditing,mt as RealTimeCollaborativeRevisionHistory,ft as RealTimeCollaborativeTrackChanges,i as Sessions,n as WebSocketGateway,L as _RtcPresenceDropdownListView,pt as _RtcPresenceDropdownListWrapperView,v as _RtcPresenceListView};
|
|
23
|
+
import{ContextPlugin as _0x3a534a,Plugin as _0x487b62,PendingActions as _0x4ddb27,Context as _0x50a571}from'@ckeditor/ckeditor5-core/dist/index.js';import{DomEmitterMixin as _0x4aa31b,CKEditorError as _0x33aeca,Collection as _0x23e834,global as _0x40d962,version as ht,uid as _0x1582cb,KeystrokeHandler as _0x80aa60}from'@ckeditor/ckeditor5-utils/dist/index.js';import{Notification as _0x361ee9,View as _0x3cbb81,ListView as _0x5441af,ListItemView as ct,LabelView as lt,BalloonPanelView as _0x36c4ea,clickOutsideHandler as _0x17d6ef,BodyCollection as _0x1695f7}from'@ckeditor/ckeditor5-ui/dist/index.js';import{ModelLiveRange as _0x1749f5,History as _0x54cc8a,NoOperation as _0x9cc8ba,InsertOperation as _0x2bb0f6,MarkerOperation as _0x3ff05b,RootAttributeOperation as _0x167b76,transformOperationSets as _0x3cdb5c,OperationFactory as _0x3e4f84}from'@ckeditor/ckeditor5-engine/dist/index.js';import{WebSocketGateway as dt,WEB_SOCKET_GATEWAY_STATES as _0x3c448a,CollaborativeEditingService as _0x2073ae,User as ut,CommentsService as _0x3745f4,TrackChangesService as rt,RevisionHistoryService as st,EditorService as it}from'@ckeditor/ckeditor-cloud-services-collaboration/dist/index.js';import{Users as _0x3c0cad,UserView as at}from'ckeditor5-collaboration/dist/index.js';import{Compressor as _0x4ffe40}from'@ckeditor/ckeditor5-operations-compressor/dist/index.js';import{isElement as _0x38ad78}from'es-toolkit/compat';class n extends _0x3a534a{static ['WebSocketGateway']=/* #__PURE__ -- @preserve */
|
|
24
|
+
((()=>dt)());static ['initialReconnectionInterval']=0x3e8;['connection'];['_reconnectionStack'];['_shouldPluginsReconnect'];['_domEmitter'];static get['requires'](){return['CloudServices',_0x361ee9];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x56da51){super(_0x56da51),this['set']('state',_0x3c448a['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=new(_0x4aa31b())();}['init'](){const _0x10763d=this['context'],_0x3bba00=_0x10763d['plugins']['get']('CloudServices'),_0x440b9e=_0x10763d['plugins']['get'](_0x361ee9);if(!_0x3bba00['token'])throw new _0x33aeca('websocketgateway-missing-token',this);if(!_0x3bba00['webSocketUrl'])throw new _0x33aeca('websocketgateway-missing-websocket-url',this);return this['_domEmitter']['listenTo'](window,'offline',()=>this['_isBrowserOffline']=!0x0),this['_domEmitter']['listenTo'](window,'online',()=>this['_isBrowserOffline']=!0x1),this['context']['config']['define']('cloudServices.connectionTimeout',0xa),this['context']['config']['define']('cloudServices.requestTimeout',0x14),n['WebSocketGateway']['connect'](_0x3bba00['token'],_0x3bba00['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0x310923=>{if(this['connection']=_0x310923,this['bind']('state')['to'](_0x310923,'state',this,'_isBrowserOffline',(_0x1c0d28,_0xb12bf1)=>('connected'!==_0x1c0d28&&(this['_shouldPluginsReconnect']=!0x0),_0xb12bf1||_0x1c0d28!==_0x3c448a['CONNECTED']?_0x3c448a['DISCONNECTED']:this['state']==_0x3c448a['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),_0x3c448a['CONNECTING']):_0x3c448a['CONNECTED'])),this['connection']['on']('error',(_0x1e12fb,_0x5ad998)=>{if('limitExceeded'!==_0x5ad998['code'])throw console['error'](_0x5ad998),new _0x33aeca('cloudservices-init',null,{'originalError':_0x5ad998});_0x440b9e['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'});}),!_0x310923['me'])return new Promise(_0x31b99c=>_0x310923['on']('change:me',_0x31b99c));})['catch'](_0x444293=>{throw console['error'](_0x444293),new _0x33aeca('cloudservices-init',null,{'originalError':_0x444293});});}['addToReconnectionStack'](_0x417e55){if('function'!=typeof _0x417e55['reconnect'])throw new _0x33aeca('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0x417e55))throw new _0x33aeca('websocketgateway-plugin-already-registered',this,{'name':_0x417e55['constructor']['pluginName']});this['_reconnectionStack']['add'](_0x417e55);}['removeFromReconnectionStack'](_0x552607){this['_reconnectionStack']['delete'](_0x552607);}['isInReconnectionStack'](_0x5742ab){return this['_reconnectionStack']['has'](_0x5742ab);}['_reconnect'](){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0x108d8f=>_0x108d8f['reconnect']())))['then'](()=>this['state']=_0x3c448a['CONNECTED'])['catch'](_0x20d7d4=>{throw console['error'](_0x20d7d4),new _0x33aeca('cloudservices-reconnection-error',this['context']);});}['disconnect'](){this['connection']&&this['connection']['disconnect'](),this['state']=_0x3c448a['DISCONNECTED'],this['_domEmitter']['stopListening']();}['destroy'](){this['disconnect'](),super['destroy']();}}class i extends _0x3a534a{['channelSessions'];['channelConnectedUsers'];['allConnectedUsers'];['_registeredSessions'];['_uniqueUsersCount'];['_users'];static get['pluginName'](){return'Sessions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}static get['requires'](){return[n,_0x3c0cad];}constructor(_0x4a5422){super(_0x4a5422),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0x23e834(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x3c0cad);}['init'](){const _0x2ed52c=this['context']['plugins']['get'](n);this['listenTo'](_0x2ed52c,'change:state',(_0x5aa4ba,_0x308b94,_0x1d6cf0)=>{if('connected'!==_0x1d6cf0)this['channelSessions']['forEach'](_0x33261d=>_0x33261d['clear']()),this['channelConnectedUsers']['forEach'](_0x26eedc=>_0x26eedc['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x426dc3,_0x2c5de6]of this['_registeredSessions'])for(const _0x3c2138 of _0x2c5de6)this['_handleSessionAdd'](_0x426dc3,_0x3c2138);}}),this['_createUser'](_0x2ed52c['connection']['me'],!0x0);}['register'](_0x6cbca6,_0x5bbc19){if(this['_registeredSessions']['has'](_0x6cbca6))throw new _0x33aeca('sessions-register-already-registered',null,{'channelId':_0x6cbca6});this['_registeredSessions']['set'](_0x6cbca6,_0x5bbc19),this['channelSessions']['set'](_0x6cbca6,new _0x23e834()),this['channelConnectedUsers']['set'](_0x6cbca6,new _0x23e834()),this['listenTo'](_0x5bbc19,'add',(_0x57d7ee,_0x16c5e2)=>this['_handleSessionAdd'](_0x6cbca6,_0x16c5e2)),this['listenTo'](_0x5bbc19,'remove',(_0x41b0d,_0x591cdd)=>this['_handleSessionRemove'](_0x6cbca6,_0x591cdd));for(const _0x1b2094 of _0x5bbc19)this['_handleSessionAdd'](_0x6cbca6,_0x1b2094);}['unregister'](_0x114a40){if(!this['_registeredSessions']['has'](_0x114a40))throw new _0x33aeca('sessions-unregister-not-exist',null,{'channelId':_0x114a40});const _0x39747a=this['_registeredSessions']['get'](_0x114a40);this['stopListening'](_0x39747a);for(const _0x22a5be of _0x39747a)'connected'===this['context']['plugins']['get'](n)['state']&&this['_handleSessionRemove'](_0x114a40,_0x22a5be);this['_registeredSessions']['delete'](_0x114a40),this['channelSessions']['delete'](_0x114a40),this['channelConnectedUsers']['delete'](_0x114a40);}get['mySessionId'](){return this['context']['plugins']['get'](n)['connection']['sessionId'];}['getUserBySessionId'](_0xa0339e){for(const _0x2ff8c4 of this['channelSessions']['values']())for(const _0x494c99 of _0x2ff8c4)if(_0x494c99['id']===_0xa0339e)return _0x494c99['user'];}['getUserSessions'](_0x4a2c99,_0x50dcff){const _0x118432=_0x50dcff?[this['channelSessions']['get'](_0x50dcff)]:this['channelSessions']['values'](),_0x5cd685=new Set();for(const _0x46f52a of _0x118432)for(const _0x4658c4 of _0x46f52a)_0x4658c4['user']['id']===_0x4a2c99['id']&&_0x5cd685['add'](_0x4658c4['id']);return _0x5cd685;}['getUserRole'](_0xb7fdc){for(const _0x3e853b of this['channelSessions']['values']())for(const _0x1de564 of _0x3e853b)if(_0x1de564['user']===_0xb7fdc)return _0x1de564['role'];}['_handleSessionAdd'](_0x3ccd10,_0xd894f6){if('connected'!==this['context']['plugins']['get'](n)['state'])return;const _0x3f6ba0=_0xd894f6['user'],_0xd0ef40=this['_users']['getUser'](_0x3f6ba0['id'])||this['_createUser'](_0x3f6ba0),_0x31fbcb=Object['assign']({},_0xd894f6,{'user':_0xd0ef40});this['channelSessions']['get'](_0x3ccd10)['add'](_0x31fbcb);const _0x5cd4b8=this['channelConnectedUsers']['get'](_0x3ccd10);_0x5cd4b8['has'](_0xd0ef40['id'])||_0x5cd4b8['add'](_0xd0ef40),this['allConnectedUsers']['has'](_0xd0ef40['id'])||this['allConnectedUsers']['add'](_0xd0ef40,_0xd0ef40['isMe']?0x0:void 0x0),this['fire']('sessionAdd:'+_0x3ccd10,{'channelId':_0x3ccd10,'session':_0x31fbcb});}['_handleSessionRemove'](_0x58fc53,_0x305754){if('connected'!==this['context']['plugins']['get'](n)['state'])return;const _0x57f9e9=this['channelConnectedUsers']['get'](_0x58fc53),_0x174f92=_0x305754['user'];_0x174f92['id']&&(this['channelSessions']['get'](_0x58fc53)['remove'](_0x305754['id']),_0x57f9e9['has'](_0x174f92['id'])&&!this['getUserSessions'](_0x174f92,_0x58fc53)['size']&&_0x57f9e9['remove'](_0x174f92['id']),this['allConnectedUsers']['get'](_0x174f92['id'])&&!this['getUserSessions'](_0x174f92)['size']&&this['allConnectedUsers']['remove'](_0x174f92['id']));}['_createUser'](_0x2847ec,_0x3a6596){const _0x41c4f5=this['_users']['addUser'](_0x2847ec);return _0x3a6596&&this['_users']['defineMe'](_0x2847ec['id']),_0x41c4f5['orderNumber']=this['_uniqueUsersCount']++,_0x41c4f5;}}class C extends _0x487b62{['_domEmitter']=new(_0x4aa31b())();static get['requires'](){return[i];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x514600=this['editor'],_0x4c7654=_0x514600['plugins']['get'](i);_0x514600['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x5568af,{writer:_0x45c1e7})=>function(_0x2f28d4,_0xcab724,_0x5a089e,_0x42afec){const _0x542e3e=_0x2f28d4['markerName']['split'](':')[0x2],_0x49d317=_0x5a089e['getUserBySessionId'](_0x542e3e);if(!_0x49d317||_0x542e3e===_0x5a089e['mySessionId'])return;if(!_0x42afec['model']['schema']['checkChild'](_0x2f28d4['markerRange']['start'],'$text'))return;const _0x29a625={'class':'ck-user__marker\x20'+_0x49d317['color']['getMarkerClass'](),'data-name':_0x49d317['name'],'data-session-id':_0x542e3e},_0x1253d3=_0x42afec['model']['markers']['get'](_0x2f28d4['markerName']),_0x266adf=_0x1253d3['getStart'](),_0x2ccd45=_0x266adf['nodeAfter'],_0x290ee7=_0x42afec['model']['schema'];if(_0x2ccd45&&_0x290ee7['isObject'](_0x2ccd45)&&_0x290ee7['isInline'](_0x2ccd45)&&!_0x42afec['model']['markers']['get']('user:range:'+_0x542e3e)['getRange']()['isCollapsed'])return;const _0x1a3d5e=_0x266adf['parent'];return _0x42afec['model']['schema']['isLimit'](_0x1a3d5e)&&!_0x42afec['model']['hasContent'](_0x1a3d5e)&&(_0x29a625['contenteditable']=!0x1),function(_0x9a5eaf,_0x447272,_0x38f043){const _0x3c3fa2=_0x9a5eaf['createUIElement']('span',_0x447272);return _0x9a5eaf['setCustomProperty']('userPositionMarker',!0x0,_0x3c3fa2),_0x3c3fa2['render']=function(_0x5ba89d){const _0x53eb49=this['toDomElement'](_0x5ba89d),_0x381d1a=document['createElement']('span');return _0x381d1a['classList']['add']('ck-user__marker-tooltip'),_0x381d1a['setAttribute']('contenteditable','false'),_0x381d1a['setAttribute']('spellcheck','false'),_0x381d1a['textContent']=_0x38f043['name'],_0x53eb49['innerHTML']='<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span>'+_0x381d1a['outerHTML']+'',_0x53eb49['addEventListener']('mouseenter',()=>{_0x53eb49['classList']['add']('ck-user__marker_hovered');}),_0x53eb49['addEventListener']('mouseleave',()=>{_0x53eb49['classList']['remove']('ck-user__marker_hovered');}),_0x53eb49;},_0x3c3fa2['isSimilar']=function(_0x3eaf11){return!(!this['getCustomProperty']('userPositionMarker')||!_0x3eaf11['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0x3eaf11['getAttribute']('data-session-id'));},_0x3c3fa2;}(_0xcab724,_0x29a625,_0x49d317);}(_0x5568af,_0x45c1e7,_0x4c7654,_0x514600)}),_0x514600['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0x213f23=>function(_0x50ef34,_0x454402){const _0x5a44a1=_0x50ef34['markerName']['split'](':')[0x2];if(_0x5a44a1===_0x454402['mySessionId'])return null;const _0x1d930a=_0x454402['getUserBySessionId'](_0x5a44a1);if(!_0x1d930a)return{'id':_0x5a44a1,'classes':[]};return{'id':_0x5a44a1,'classes':['ck-user__selection',_0x1d930a['color']['getSelectionClass']()],'attributes':{'data-session-id':_0x5a44a1},'priority':0x7d0+_0x1d930a['orderNumber']};}(_0x213f23,_0x4c7654)}),function(_0x56d93c){const _0xeedda1=_0x56d93c['model'],_0x53d591=new Map(),_0x47059a=_0x56d93c['plugins']['get'](i);_0xeedda1['markers']['on']('update:user:range',(_0x3c5b76,_0x4fc818,_0x525bf3,_0x17f2d6)=>{if(!_0x17f2d6&&_0x53d591['get'](_0x4fc818['name']))return _0x53d591['get'](_0x4fc818['name'])['detach'](),void _0x53d591['delete'](_0x4fc818['name']);const _0x252be9=_0x4fc818['name']['split'](':')[0x2];if(_0x252be9===_0x47059a['mySessionId'])return;const _0x57f337='user:position:'+_0x252be9;_0xeedda1['markers']['has'](_0x57f337)&&_0x56d93c['editing']['reconvertMarker'](_0x57f337),_0x4fc818['on']('change:range',(_0x312848,_0x33935b,_0x403609)=>{if('$graveyard'!=_0x33935b['root']['rootName']&&'$graveyard'==_0x4fc818['getRange']()['root']['rootName']&&!_0x53d591['has'](_0x4fc818['name'])){const _0x3d9456=_0xeedda1['schema']['getNearestSelectionRange'](_0x403609['deletionPosition']);if(_0x3d9456){const _0x3de371=_0x1749f5['fromRange'](_0x3d9456);_0x53d591['set'](_0x4fc818['name'],_0x3de371),_0x3de371['on']('change:range',(_0x4de12d,_0x2e8f59,_0x4e56bc)=>{if('$graveyard'==_0x3de371['root']['rootName']){const _0xd4777d=_0xeedda1['schema']['getNearestSelectionRange'](_0x4e56bc['deletionPosition']);_0xd4777d?(_0x3de371['start']=_0xd4777d['start'],_0x3de371['end']=_0xd4777d['end']):(_0x53d591['delete'](_0x4fc818['name']),_0x3de371['detach']());}});}}});}),_0xeedda1['document']['on']('change',()=>{_0x53d591['size']>0x0&&_0xeedda1['enqueueChange']({'isUndoable':!0x1},_0xac609a=>{for(const [_0x1d2954,_0x410324]of _0x53d591)'$graveyard'==_0xeedda1['markers']['get'](_0x1d2954)['getRange']()['root']['rootName']&&(J(_0x1d2954['split'](':')[0x2],_0x410324['toRange'](),_0xeedda1,_0xac609a),_0x410324['detach']());_0x53d591['clear']();});});}(_0x514600),this['_domEmitter']['listenTo'](_0x40d962['document'],'keydown',(_0x7f519,{key:_0x490ea6})=>{'Escape'===_0x490ea6&&function(_0x372fc7){_0x372fc7['editing']['view']['change'](_0x3aa458=>{for(const _0x18758f of _0x372fc7['model']['markers']){if(!_0x18758f['name']['startsWith']('user:position'))continue;const _0x55d2d0=_0x372fc7['editing']['mapper']['markerNameToElements'](_0x18758f['name']);if(_0x55d2d0){for(const _0x26b189 of _0x55d2d0)_0x3aa458['removeClass']('ck-user__marker_hovered',_0x26b189);}}});}(_0x514600);},{'useCapture':!0x0});}['afterInit'](){const _0x1a8a07=this['editor'],_0xf61a68=_0x1a8a07['commands']['get']('undo');_0xf61a68&&_0x1a8a07['model']['on']('applyOperation',(_0xe8a833,_0x1f6efb)=>{const _0x4a0b09=_0x1f6efb[0x0];if(!_0x4a0b09['isDocumentOperation'])return;if('marker'!=_0x4a0b09['type']||!_0x4a0b09['name']['startsWith']('user:'))return;const _0x51de3f=_0x4a0b09['batch'];_0xf61a68['_createdBatches']['has'](_0x51de3f)&&(_0x4a0b09['newRange']=_0x4a0b09['oldRange']?_0x1a8a07['model']['createRange'](_0x4a0b09['oldRange']['start'],_0x4a0b09['oldRange']['end']):null);},{'priority':'highest'});}['destroy'](){return this['_domEmitter']['stopListening'](),super['destroy']();}['createUserMarkerOperations'](){const _0x38f473=this['editor'],_0x5a887d=_0x38f473['model']['document'],_0x46463e=_0x38f473['plugins']['get'](i);_0x38f473['model']['enqueueChange']({'isUndoable':!0x1},_0x449541=>{const _0x5ed646='user:range:'+_0x46463e['mySessionId'],_0xfda978='user:position:'+_0x46463e['mySessionId'],_0x56aa91=_0x38f473['model']['markers']['has'](_0x5ed646);_0x38f473['editing']['view']['hasDomSelection']?J(_0x46463e['mySessionId'],_0x5a887d['selection']['getFirstRange'](),_0x38f473['model'],_0x449541):_0x56aa91&&(_0x449541['removeMarker'](_0x5ed646),_0x449541['removeMarker'](_0xfda978));});}}function J(_0x30b290,_0x4e1858,_0x4157d9,_0xbf64c1){const _0x4740cc='user:range:'+_0x30b290,_0x3f83d3='user:position:'+_0x30b290,_0x556ab5=_0x4e1858['getContainedElement']();let _0x4f5a04=_0x4e1858['start'];if(_0x556ab5&&_0x556ab5['is']('element','tableCell')){const _0x3ff55d=function(_0x3f65bf,_0x5a1c31){for(const _0x37e709 of _0x3f65bf['getPositions']())if(_0x5a1c31['schema']['checkChild'](_0x37e709,'$text'))return _0x37e709;}(_0x4e1858,_0x4157d9);_0x3ff55d&&(_0x4f5a04=_0x3ff55d,_0x4e1858=_0xbf64c1['createRange'](_0x4f5a04));}const _0x57cfc8=_0xbf64c1['createRange'](_0x4f5a04);_0x4157d9['markers']['has'](_0x4740cc)?(_0xbf64c1['updateMarker'](_0x4740cc,{'range':_0x4e1858}),_0xbf64c1['updateMarker'](_0x3f83d3,{'range':_0x57cfc8})):(_0xbf64c1['addMarker'](_0x4740cc,{'range':_0x4e1858,'usingOperation':!0x0}),_0xbf64c1['addMarker'](_0x3f83d3,{'range':_0x57cfc8,'usingOperation':!0x0}));}function E(_0x4a6d6b,_0x59516c,_0x154e66){const _0x40ed59=_0x4a6d6b['t'],t=_0x4a6d6b['t'];switch(_0x59516c){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 _0x40ed59({'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'},_0x154e66);default:return'';}}let H=0x1;class l extends _0x487b62{static ['CollaborativeEditingService']=/* #__PURE__ -- @preserve */
|
|
25
|
+
((()=>_0x2073ae)());['_offset'];['sessionId'];['serverHistory'];['_channelId'];['_service'];['_document'];['_compressor'];['_bufferedOperations'];['_knownOperations'];['_knownRootNames'];['_pendingAction'];['_hasSelectionChanged'];['_sendBufferedOperationsDelayId'];['_baseBufferDelay'];['_currentBufferDelay'];['_lastSyncedOperationId'];['_disconnectionOperations'];['_operationIdentifier'];static get['requires'](){return[n,i,C,_0x4ddb27,_0x3c0cad,_0x361ee9];}static get['pluginName'](){return'RealTimeCollaborationClient';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}get['cloudDocumentVersion'](){return this['_lastServerVersion']+this['_offset'];}get['_lastServerVersion'](){return this['serverHistory']['version']-this['_offset'];}get['lastSyncVersion'](){const _0x268adb=this['serverHistory']['getOperations']();for(let _0x156869=_0x268adb['length']-0x1;_0x156869>=0x0;_0x156869--){const _0x1bd128=_0x268adb[_0x156869];if(!this['_disconnectionOperations']['has'](_0x1bd128))return _0x1bd128['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0x3f166f){if(super(_0x3f166f),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x54cc8a(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0x33aeca('collaboration-missing-channelid',this);const _0x2b47ca=_0x3f166f['config']['get']('cloudServices.bundleVersion')||ht;this['_service']=new l['CollaborativeEditingService'](_0x2b47ca,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0x4ffe40(),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 F(this['_disconnectionOperations']);}['init'](){const _0x255fe3=this['editor'],_0x5bd020=_0x255fe3['plugins']['get'](_0x3c0cad),_0x4f5fae=_0x255fe3['plugins']['get'](n);this['listenTo'](_0x5bd020,'getOperationAuthor',(_0x5caae9,_0x5272d8)=>{const _0x40e6b0=_0x5272d8[0x0];_0x40e6b0['_authorId']&&(_0x5caae9['return']=_0x5bd020['getUser'](_0x40e6b0['_authorId']),_0x5caae9['stop']()),null===_0x40e6b0['_authorId']&&(_0x5caae9['return']=null,_0x5caae9['stop']());},{'priority':'high'}),this['listenTo'](_0x255fe3['model']['document']['selection'],'change:range',(_0x342747,_0x58fc9e)=>{_0x58fc9e['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x255fe3['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x255fe3['model']['on']('applyOperation',(_0x5115b7,_0x3d9a19)=>{const _0x36b476=_0x3d9a19[0x0];_0x36b476['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0x36b476),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['bind']('_isEditingAllowed')['to'](_0x4f5fae,'state',this,'_hasSynchronizationProblem',(_0xb6b05e,_0x4f448e)=>'connected'===_0xb6b05e&&!_0x4f448e),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x255fe3['disableReadOnlyMode']('rtc-offline'):_0x255fe3['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x255fe3['disableReadOnlyMode']('rtc-offline'):_0x255fe3['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async['reconnect'](){const _0x5d28b6=this['editor']['plugins']['get'](i),_0x17a4f5=this['editor']['plugins']['get'](n);try{this['_isPendingUpdate']=!0x0,_0x5d28b6['unregister'](this['_channelId']);const _0x1c72dc=await this['_service']['reconnect'](_0x17a4f5['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0x1c72dc)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x335949=await this['_service']['getConnectedSessions']();_0x5d28b6['register'](this['_channelId'],_0x335949),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x51e201){if(function(_0x311642){return'404'===_0x311642['code'];}(_0x51e201)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0x3efcca){return'409'===_0x3efcca['code'];}(_0x51e201)){const _0x2030ce=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'](_0x2030ce);}else{if(!(_0x51e201 instanceof V))throw _0x51e201;this['_handleReconnectionError']();}}}}['destroy'](){const _0x5c4579=this['editor']['plugins']['get'](n),_0x44b3f2=this['editor']['plugins']['get'](i);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x44b3f2['channelSessions']['has'](this['_channelId'])&&_0x44b3f2['unregister'](this['_channelId']),_0x5c4579['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async['_handleReconnectionResponse'](_0x13bc80){if(this['sessionId']!==_0x13bc80['sessionId']&&this['_lastSyncedOperationId']!==_0x13bc80['lastOperationId'])throw new V();return this['sessionId']=_0x13bc80['sessionId'],this['_handleServerResponse']([],{..._0x13bc80,'wereChangesApplied':!0x1,'data':_0x13bc80['data']},'reconnect');}async['_connectService'](_0x1b60db,_0x326911=!0x1){const {connection:_0x240e93}=this['editor']['plugins']['get'](n);l['CollaborativeEditingService']['getConnectedSessions'](_0x240e93,this['_channelId'])['then'](_0xb959ca=>this['_initSessionsHandling'](_0xb959ca))['catch'](_0x37d403=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x37d403);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0xa7a7b6,_0x1061bd)=>{this['_crash']('realtimecollaborationclient-init-service-internal-error',_0x1061bd);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_isConnected']=!0x1;});const _0x2b6a66=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x1b60db);this['_isPendingUpdate']=!0x0;const _0x15914c=await this['_service']['connect'](_0x240e93,this['_compressOperations'](_0x1b60db),_0x2b6a66);if(this['sessionId']=_0x15914c['sessionId'],_0x326911){if(!_0x15914c['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x15914c['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0x1b60db,_0x15914c,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x15914c,_0x1b60db);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}['_handleSendingSelectionMarkers'](){const _0x14407c=this['editor']['plugins']['get'](i),_0x432860=this['editor']['plugins']['get'](C),_0x148627=_0x14407c['channelSessions']['get'](this['_channelId']);_0x148627&&_0x148627['length']>0x1?_0x432860['createUserMarkerOperations']():this['listenTo'](_0x14407c,'sessionAdd:'+this['_channelId'],()=>{0x2===_0x14407c['channelSessions']['get'](this['_channelId'])['length']&&_0x432860['createUserMarkerOperations']();});}async['_handleReceivedOperations'](_0x269d84,_0x215d61,_0x329e54,_0x481b6c){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x215d61){const _0x5a5655=this['_decompressOperations'](_0x329e54,_0x481b6c);await this['_fetchMissingUsers'](_0x5a5655),this['_handleExternalOperations'](_0x5a5655,_0x215d61,_0x329e54['lastOperationId'])||this['_crash']('realtimecollaborationclient-init-service-incorrect-server-operation');}}async['_connectAfterSessionHasBeenFlushed'](){this['_disconnectService']();const {locale:_0x4c5d9a}=this['editor'];let _0x46ec04;try{_0x46ec04=await this['_service']['getDocumentDetails']();}catch{const _0x41a67a=E(_0x4c5d9a,'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'](_0x41a67a);}const _0x43b060=_0x46ec04['currentDocumentSession']||_0x46ec04['lastDocumentSession'];if(this['_lastSyncedOperationId']!==_0x43b060['lastOperationId']){const _0x119116=E(_0x4c5d9a,'The\x20last\x20saved\x20version\x20of\x20the\x20document\x20does\x20not\x20match\x20the\x20local\x20version.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.');return void this['_handleReconnectionError'](_0x119116);}await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);}['_disconnectService'](){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['stopListening'](this['_service']);}['_initSessionsHandling'](_0x1222ab){const _0x3ceca7=this['editor']['plugins']['get'](i);this['listenTo'](_0x3ceca7,'sessionAdd:'+this['_channelId'],(_0x35ecd6,{session:_0x6b5b62})=>{if(_0x6b5b62['id']===_0x3ceca7['mySessionId']){_0x35ecd6['off']();const _0x13f119=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0x12258c=_0x6b5b62['permissions'];_0x13f119&&_0x13f119['isEnabled']&&(_0x12258c=_0x12258c['filter'](_0x588b19=>'document:write'!==_0x588b19)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0x12258c,this['_channelId']);}}),_0x3ceca7['register'](this['_channelId'],_0x1222ab);}['_initThrowingOnDataSet'](){const _0xad65b7=this['editor']['data']['set'];this['editor']['data']['set']=(..._0x348f7c)=>{if(!_0x348f7c[_0x348f7c['length']-0x1]['suppressErrorInCollaboration'])throw new _0x33aeca('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0xad65b7['apply'](this['editor']['data'],_0x348f7c);};}['_setUpDataInit'](){this['editor']['data']['on']('init',(_0x5ab93a,[_0x2a4942])=>{if(this['_document']['version'])throw new _0x33aeca('realtimecollaborationclient-init-document-already-initialized',this);_0x5ab93a['stop'](),this['_setPendingAction']();const _0x49257f=this['editor']['config']['get']('rootsAttributes'),_0x179881=this['_getOperationsFromInitData'](_0x2a4942,_0x49257f);0x0==_0x179881['length']&&_0x179881['push'](new _0x9cc8ba(0x0)),_0x5ab93a['return']=this['_connectService'](_0x179881)['then'](()=>{this['editor']['plugins']['get'](n)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x1e2fd6=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x1e2fd6))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x40e81b,[_0x406c71,_0x1b7d0b])=>{_0x40e81b['stop']();const _0x2dd203=this['editor']['model']['document']['getRoot'](_0x406c71);if(!this['_knownRootNames']['has'](_0x406c71)){const _0x27886b=_0x1b7d0b&&_0x1b7d0b['data']?_0x1b7d0b['data']:'',_0xc0a72f=_0x1b7d0b&&_0x1b7d0b['attributes']?_0x1b7d0b['attributes']:{};await this['_loadRoot'](_0x406c71,_0x27886b,_0xc0a72f);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0x2dd203['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0x2dd203);});},{'priority':'high'});}async['_fetchMissingUsers'](_0x501003){const _0x3ba199=this['editor']['plugins']['get'](_0x3c0cad),{connection:_0x4c532f}=this['editor']['plugins']['get'](n),_0x5a701e=new Set();for(const _0x39aaa8 of _0x501003){const _0x5d0d9f=_0x39aaa8['_authorId'];_0x5d0d9f&&!_0x3ba199['getUser'](_0x5d0d9f)&&_0x5a701e['add'](_0x5d0d9f);}if(0x0===_0x5a701e['size'])return;const _0x677ebd=await ut['getMany'](_0x4c532f,Array['from'](_0x5a701e));for(const _0x152e08 of _0x677ebd)_0x3ba199['getUser'](_0x152e08['id'])||_0x3ba199['addUser'](_0x152e08);}['_getOperationsFromInitData'](_0x3870d7,_0x1d203d={}){const _0x4106bf=this['editor']['model'],_0x4694ee=[];let _0x2c4006=0x0;const _0x18565d='string'==typeof _0x3870d7?{'main':_0x3870d7}:_0x3870d7;for(const _0x34ece7 of Object['keys'](_0x18565d)){if(!this['_document']['roots']['has'](_0x34ece7))throw new _0x33aeca('realtimecollaborationclient-init-non-existent-root',this);const _0x193289=this['editor']['data']['parse'](_0x18565d[_0x34ece7]),_0xf8c0e3=this['_document']['getRoot'](_0x34ece7),_0x3da1a3=new _0x2bb0f6(_0x4106bf['createPositionAt'](_0xf8c0e3,0x0),_0x193289,_0x2c4006++);_0x4694ee['push'](_0x3da1a3);for(const [_0x553697,_0x593ef9]of _0x193289['markers']){const _0xdae0a3=_0x4106bf['createRange'](_0x4106bf['createPositionFromPath'](_0xf8c0e3,_0x593ef9['start']['path']['slice']()),_0x4106bf['createPositionFromPath'](_0xf8c0e3,_0x593ef9['end']['path']['slice']())),_0x216097=new _0x3ff05b(_0x553697,null,_0xdae0a3,_0x4106bf['markers'],!0x0,_0x2c4006++);_0x4694ee['push'](_0x216097);}}if(_0x1d203d)for(const [_0x377aa3,_0x4ce4c2]of Object['entries'](_0x1d203d)){const _0x5ce57b=_0x4106bf['document']['getRoot'](_0x377aa3);if(!_0x5ce57b)throw new _0x33aeca('multi-root-editor-root-attributes-no-root',null);for(const [_0xc2dcaa,_0x2acfab]of Object['entries'](_0x4ce4c2))if(null!==_0x2acfab){const _0x22e035=new _0x167b76(_0x5ce57b,_0xc2dcaa,null,_0x2acfab,_0x2c4006++);_0x4694ee['push'](_0x22e035);}}return _0x4694ee;}async['_loadRoot'](_0x442554,_0x561a6c,_0xa1d9a3){this['_getOperationsFromInitData']({[_0x442554]:_0x561a6c},{[_0x442554]:_0xa1d9a3})['forEach']((_0x132b61,_0x1d5c96)=>{_0x132b61['baseVersion']=this['_document']['version']+_0x1d5c96,_0x132b61['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x132b61);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async['_handleInitialConnectionData'](_0xb59076,_0x2190b7){let _0x356c1c;this['_offset']=_0xb59076['offset'];const _0xc3c85c=_0xb59076['wereChangesApplied']&&!_0xb59076['initData'],_0x38c0d1=_0xc3c85c?0x0:_0xb59076['data']['baseVersion'];if(_0x2190b7['forEach'](_0x518b13=>{_0x518b13['_isInit']=!0x0,_0x518b13['createdAt']=_0xb59076['sessionCreatedAt'],_0x518b13['_authorId']=null;}),_0xc3c85c)_0x356c1c=_0x2190b7,this['_applyOperationsSet'](_0x356c1c,_0xc3c85c);else{if(_0xb59076['initData']){const _0x5b9600=this['_getOperationsFromInitData'](_0xb59076['initData']);this['_document']['history']['version']=-_0x5b9600['length'],_0x5b9600['forEach'](_0x365a7d=>{_0x365a7d['baseVersion']-=_0x5b9600['length'],_0x365a7d['createdAt']=_0xb59076['sessionCreatedAt'],_0x365a7d['_isInit']=!0x0,_0x365a7d['_authorId']=null;}),this['_applyOperationsSet'](_0x5b9600,!0x0),this['serverHistory']['version']=-_0x5b9600['length']+this['_offset'],this['_updateServerHistory'](_0x5b9600);}this['_document']['history']['version']=_0x38c0d1,_0x356c1c=this['_decompressOperations'](_0xb59076['data'],_0xb59076['metadata']),await this['_fetchMissingUsers'](_0x356c1c),this['_applyOperationsSet'](_0x356c1c,_0xc3c85c);}_0xb59076['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x356c1c,_0xb59076['lastOperationId']),this['_lastSyncedOperationId']=_0xb59076['lastOperationId']),this['serverHistory']['version']=_0x38c0d1+this['_offset'],this['_updateServerHistory'](_0x356c1c),_0x2190b7['filter'](_0x47d778=>{const _0x747acd=this['_getAffectedRoot'](_0x47d778);return _0x747acd&&!this['_knownRootNames']['has'](_0x747acd);})['forEach']((_0x1a15e3,_0x330c4c)=>{_0x1a15e3['baseVersion']=this['_document']['version']+_0x330c4c,this['_saveOperationInBuffer'](_0x1a15e3);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x3241cb,_0x4f63e3){const _0x2bc852=_0x4f63e3&&_0x4f63e3['message'];if(_0x2bc852&&_0x2bc852['startsWith']('realtimecollaborationclient'))throw _0x4f63e3;const _0x3abfac=this['editor']['plugins']['get'](n);throw this['_isPendingUpdate']=!0x0,_0x3abfac['disconnect'](),this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0x33aeca(_0x3241cb,this['editor'],_0x2bc852?{'originalError':_0x2bc852}:void 0x0);}['_saveOperationInBuffer'](_0x493972){this['_knownOperations']['has'](_0x493972)||(this['_knownOperations']['add'](_0x493972),this['_bufferedOperations']['push'](_0x493972),this['_pendingAction']||'marker'==_0x493972['type']&&!_0x493972['affectsData']||this['_setPendingAction']());}['_sendBufferedOperationsDelayed'](_0x56cb52=!0x1){!_0x56cb52&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0x50045d=>{_0x50045d&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0xc941f0=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0x1361a0){return _0x1361a0['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x1361a0['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0x1361a0['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0xc941f0)||this['_crash'](_0xc941f0['message'],_0xc941f0);});},this['_currentBufferDelay']));}['_waitUntilSynced'](){return new Promise(_0x34c019=>{this['on']('change:_isPendingUpdate',()=>{_0x34c019();});});}async['_sendBufferedOperations'](){const _0xcfc18b=this['editor']['plugins']['get'](C);if(this['_shouldSendSelectionUpdate']()&&(_0xcfc18b['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x402f05=[...this['_bufferedOperations']];for(const _0x4db158 of _0x402f05)_0x4db158['wasUndone']=this['_document']['history']['isUndoneOperation'](_0x4db158);const _0xb535b0=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x402f05),_0x527aee=H++,_0x1463dc=this['_compressOperations'](_0x402f05),_0x5e384d=await this['_service']['sendOperations'](_0x1463dc,_0x1463dc['baseVersion'],_0xb535b0);try{return await this['_handleServerResponse'](_0x402f05,_0x5e384d,_0x527aee);}catch(_0x5ede28){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0x5ede28);}}async['_handleServerResponse'](_0x1aa838,_0x583467,_0x4feaf8){if('error'in _0x583467)throw _0x583467['error'];let _0x415c26=!0x1;if(_0x583467['wereChangesApplied']){_0x583467['lastOperationId']&&(this['_lastSyncedOperationId']=_0x583467['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x41f6b4=>!_0x1aa838['includes'](_0x41f6b4));for(const _0x3dd137 of _0x1aa838)_0x3dd137['createdAt']='lastOperationAcceptedAt'in _0x583467&&_0x583467['lastOperationAcceptedAt']||void 0x0;W(_0x1aa838,_0x583467['version']-_0x1aa838['length']),this['_updateServerHistory'](_0x1aa838);const _0x16e453=_0x1aa838['filter'](_0x150a40=>{if(!_0x150a40['_isInit'])return!0x1;const _0x2dc6f4=this['_getAffectedRoot'](_0x150a40);return _0x2dc6f4&&!this['_knownRootNames']['has'](_0x2dc6f4);});W(_0x16e453,this['_document']['version']),this['_applyOperationsSet'](_0x16e453),_0x415c26=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0x3d88e9=this['_decompressOperations'](_0x583467['data'],_0x583467['metadata'])['filter'](_0x1a879d=>_0x1a879d['baseVersion']>=this['_lastServerVersion']);_0x3d88e9['forEach'](_0x1e247c=>this['_addKnownRoot'](_0x1e247c)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x3226fe=>!_0x3226fe['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x3226fe))),this['_bufferedOperations']['length']&&W(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0x3d88e9),_0x415c26=this['_handleExternalOperations'](_0x3d88e9,_0x583467['version'],_0x583467['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x415c26?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}['_handleExternalOperations'](_0x216c85,_0x38dc53,_0x1431e7){try{const _0x4bccc9={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x2d8aec,operationsB:_0x31f57d,originalOperations:_0x4f1eda}=_0x3cdb5c(_0x216c85,this['_bufferedOperations'],_0x4bccc9);W(_0x2d8aec,this['_document']['version']),W(_0x31f57d,_0x38dc53);for(const _0x3446e8 of _0x2d8aec){const _0x5811e1=_0x4f1eda['get'](_0x3446e8);_0x3446e8['_authorId']=_0x5811e1?_0x5811e1['_authorId']:null;}_0x1431e7&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x216c85,_0x1431e7),this['_lastSyncedOperationId']=_0x1431e7),this['_bufferedOperations']=[..._0x31f57d],this['_applyOperationsSet'](_0x2d8aec),this['_updateServerHistory'](_0x216c85);}catch(_0x16cb18){return console['error'](_0x16cb18),!0x1;}return!0x0;}['_applyOperationsSet'](_0x2aeead,_0x10c86e=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0x1e73af=>{for(const _0x18225e of _0x2aeead)this['_knownOperations']['add'](_0x18225e),this['_addKnownRoot'](_0x18225e),_0x1e73af['batch']['addOperation'](_0x18225e),this['editor']['model']['applyOperation'](_0x18225e);});}['_addKnownRoot'](_0x201ce5){const _0x4e663a=this['_getAffectedRoot'](_0x201ce5);_0x4e663a&&this['_knownRootNames']['add'](_0x4e663a);}['_getAffectedRoot'](_0x274e4a){let _0x2281dd,_0x2a564f;switch(_0x274e4a['type']){case'insert':_0x2281dd=_0x274e4a['position']['root'];break;case'marker':if(_0x2a564f=_0x274e4a['newRange'],!_0x2a564f)return null;_0x2281dd=_0x2a564f['root'];break;case'addRootAttribute':_0x2281dd=_0x274e4a['root'];break;case'addRoot':_0x2281dd=_0x274e4a['affectedSelectable'];break;case'move':_0x2281dd=_0x274e4a['targetPosition']['root'];break;default:return null;}return _0x2281dd['rootName'];}['_updateServerHistory'](_0x573794){_0x573794['forEach'](_0xcb5cae=>{const _0x5341fe=_0xcb5cae['clone']();_0x5341fe['_authorId']=_0xcb5cae['_authorId'],_0x5341fe['_isInit']=!!_0xcb5cae['_isInit'],_0x5341fe['createdAt']=_0xcb5cae['createdAt'],_0x5341fe['baseVersion']+=this['_offset'],_0xcb5cae['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x5341fe),this['serverHistory']['addOperation'](_0x5341fe);});}['_handleReconnectionError'](_0x5eda66){const _0x2d650b=this['editor']['plugins']['get']('Notification'),_0x3ca98e=this['editor']['locale'];_0x5eda66||(_0x5eda66=E(_0x3ca98e,'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.')),_0x2d650b['showWarning'](_0x5eda66,{'title':E(_0x3ca98e,'Synchronization\x20issue'),'namespace':'real-time-collaboration'}),this['_hasSynchronizationProblem']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_bufferedOperations']=[],this['editor']['plugins']['get'](n)['disconnect']();}['_setPendingAction'](){this['_pendingAction']||(this['_pendingAction']=this['editor']['plugins']['get'](_0x4ddb27)['add'](E(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}['_clearPendingAction'](){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x4ddb27)['remove'](this['_pendingAction']),this['_pendingAction']=null);}['_compressOperations'](_0x313033){const _0x2943ec=_0x313033['map'](_0x22c4b7=>_0x22c4b7['toJSON']());return this['_compressor']['compress'](_0x2943ec);}['_decompressOperations'](_0x2a4fc6,_0xd46a7e){return this['_compressor']['decompress'](_0x2a4fc6)['map']((_0x46c4b0,_0x5c64d2)=>{const _0x23c548='init'==_0xd46a7e[_0x5c64d2]['type'];if('InsertOperation'==_0x46c4b0['__className']){const _0x368794=_0x46c4b0['position']['root'];!this['_document']['getRoot'](_0x368794)&&(this['_document']['createRoot']('$root',_0x368794)['_isAttached']=!0x1);}const _0x2f8dca=_0x3e4f84['fromJSON'](_0x46c4b0,this['_document']);return _0x2f8dca['wasUndone']=_0x46c4b0['wasUndone'],_0x2f8dca['_isInit']=_0x23c548,_0x2f8dca['_authorId']=_0x23c548?null:_0xd46a7e[_0x5c64d2]['userId'],_0x2f8dca['_isDisconnection']='cs:removeUser'===_0xd46a7e[_0x5c64d2]['type'],_0x2f8dca['createdAt']=_0xd46a7e[_0x5c64d2]['createdAt'],_0x2f8dca;});}['_refreshUserSelectionMarkers'](){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}['_shouldSendSelectionUpdate'](){const _0x463f64=this['editor']['plugins']['get'](i)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0x463f64&&_0x463f64['length']>0x1&&this['_hasSelectionChanged'];}['_shouldSendUpdate'](){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}}class V extends Error{}function W(_0x33b425,_0x573090){for(const _0x22a5fe of _0x33b425)_0x22a5fe['baseVersion']=_0x573090++;}class F{['_ignoredOperations'];['_operationToId'];constructor(_0x49cbc3){this['_ignoredOperations']=_0x49cbc3,this['_operationToId']=new WeakMap();}['getIdOfTheLastOperation'](_0x5e8437){let _0x518cc6=_0x5e8437['length'];for(;_0x518cc6--;){const _0x3aaf60=_0x5e8437[_0x518cc6];if(!this['_ignoredOperations']['has'](_0x3aaf60)){if(!this['_operationToId']['has'](_0x3aaf60)){const _0x4667df=_0x1582cb()['slice'](0x1,0x12);this['_operationToId']['set'](_0x3aaf60,_0x4667df);}return this['_operationToId']['get'](_0x3aaf60);}}}['setIdForTheLastOperation'](_0x27b607,_0x23468a){if(!_0x23468a)return;let _0x695671=_0x27b607['length'];for(;_0x695671--;){const _0x2341d8=_0x27b607[_0x695671];this['_ignoredOperations']['has'](_0x2341d8)||this['_operationToId']['set'](_0x2341d8,_0x23468a);}}}class a extends _0x487b62{static get['requires'](){return[l];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class s extends _0x3a534a{static ['CommentsService']=/* #__PURE__ -- @preserve */
|
|
26
|
+
((()=>_0x3745f4)());['_services'];static get['requires'](){return[n,'CommentsRepository',i,_0x3c0cad];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x167a76){super(_0x167a76),this['_services']=new Map();}async['init'](){const _0x3ad0d6=this['context'],_0x6d4f11=_0x3ad0d6['plugins']['get']('CommentsRepository');if(_0x3ad0d6['plugins']['get'](n)['addToReconnectionStack'](this),_0x6d4f11['adapter']={'addCommentThread':async({channelId:_0x7bf273,threadId:_0x5d8b6e,comments:_0x219482,resolvedAt:_0x325d69,resolvedBy:_0xae03e7,context:_0x4b916f,attributes:_0x3b2e35})=>{const _0x41bd88=await this['_getService'](_0x7bf273)['addCommentThread']({'commentThreadId':_0x5d8b6e,'comments':_0x219482['map'](_0x293fb4=>function(_0x38ba1e,_0x23c92f,_0x531ea8){return{'commentThreadId':_0x531ea8,'commentId':_0x38ba1e['commentId'],'userId':_0x38ba1e['authorId'],'content':_0x38ba1e['content'],'documentId':_0x23c92f,'createdAt':_0x38ba1e['createdAt'],'attributes':_0x38ba1e['attributes']||{}};}(_0x293fb4,_0x7bf273,_0x5d8b6e)),'resolvedAt':_0x325d69,'resolvedBy':_0xae03e7,'context':_0x4b916f,'attributes':_0x3b2e35})['catch'](ft);return{'threadId':_0x41bd88['commentThreadId'],'comments':_0x41bd88['comments']};},'getCommentThread':async({channelId:_0x3bb873,threadId:_0xebaff1})=>{const _0xfc7f79=await this['_getService'](_0x3bb873)['getCommentThread'](_0xebaff1)['catch'](ft);return _0xfc7f79['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0xfc7f79]),{'threadId':_0xfc7f79['commentThreadId'],'comments':_0xfc7f79['comments']['map'](et),'context':_0xfc7f79['context'],'resolvedAt':_0xfc7f79['resolvedAt'],'resolvedBy':_0xfc7f79['resolvedBy'],'attributes':_0xfc7f79['attributes']||{}});},'updateCommentThread':async({channelId:_0x471a17,threadId:_0x588f99,context:_0x135779,unlinkedAt:_0x1e2b83,attributes:_0x27f66b})=>this['_getService'](_0x471a17)['updateCommentThread']({'commentThreadId':_0x588f99,'context':_0x135779,'attributes':_0x27f66b,'unlinkedAt':_0x1e2b83})['catch'](Z)['catch'](ft),'resolveCommentThread':async({channelId:_0x571911,threadId:_0x304721})=>{const _0x3437c1=await this['_getService'](_0x571911)['resolveCommentThread'](_0x304721)['catch'](Z)['catch'](ft);return{'threadId':_0x3437c1['commentThreadId'],'resolvedAt':_0x3437c1['resolvedAt'],'resolvedBy':_0x3437c1['resolvedBy']};},'reopenCommentThread':async({channelId:_0x1bda2d,threadId:_0x1b66de})=>this['_getService'](_0x1bda2d)['reopenCommentThread'](_0x1b66de)['catch'](Z)['catch'](ft),'removeCommentThread':({channelId:_0xfb7abb,threadId:_0x3c3088})=>this['_getService'](_0xfb7abb)['removeCommentThread'](_0x3c3088)['catch'](Z)['catch'](ft),'addComment':({channelId:_0x39e614,threadId:_0x591ffb,commentId:_0x4d0484,content:_0x2ac038,attributes:_0x55b565})=>this['_getService'](_0x39e614)['addComment'](_0x591ffb,_0x4d0484,_0x2ac038,_0x55b565)['catch'](ft),'updateComment':({channelId:_0x2c73ff,threadId:_0x563c86,commentId:_0x14e176,content:_0x76924a,attributes:_0xeaad0a})=>this['_getService'](_0x2c73ff)['updateComment'](_0x563c86,_0x14e176,_0x76924a,_0xeaad0a)['catch'](Z)['catch'](ft),'removeComment':({channelId:_0x4ef921,threadId:_0x114fd7,commentId:_0x2b1caa})=>this['_getService'](_0x4ef921)['removeComment'](_0x114fd7,_0x2b1caa)['catch'](Z)['catch'](ft)},_0x3ad0d6 instanceof _0x50a571){const _0x20bd08=_0x3ad0d6['config']['get']('collaboration.channelId'),_0x2f8867=_0x3ad0d6['plugins']['get'](i);await this['_setUpService'](_0x20bd08);const _0x4ca4bf=await this['_services']['get'](_0x20bd08)['getConnectedSessions']();this['listenTo'](_0x2f8867,'sessionAdd:'+_0x20bd08,(_0x2d0004,{session:_0x2eb6e0})=>{_0x2eb6e0['id']===_0x2f8867['mySessionId']&&(_0x2d0004['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x2eb6e0['permissions'],_0x20bd08));}),_0x2f8867['register'](_0x20bd08,_0x4ca4bf);}}async['_setUpService'](_0x222bb3){if(this['_services']['has'](_0x222bb3))throw new _0x33aeca('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0x222bb3});const _0x2e99b7=this['context']['plugins']['get']('CommentsRepository'),_0x596450=new s['CommentsService'](_0x222bb3);this['_services']['set'](_0x222bb3,_0x596450),this['listenTo'](_0x596450,'commentThreadAdded',(_0x160f72,_0x512ede)=>{const {commentThreadId:_0x120a51,documentId:_0x24dce3,context:_0x367d6f,attributes:_0x152fcc,resolvedAt:_0x2b0b4c,resolvedBy:_0x4fb1dd,comments:_0x276b28}=_0x512ede;_0x2e99b7['getCommentThread'](_0x120a51)||_0x2e99b7['addCommentThread']({'threadId':_0x120a51,'channelId':_0x24dce3,'comments':_0x276b28?_0x276b28['map'](et):[],'context':_0x367d6f,'attributes':_0x152fcc,'resolvedAt':_0x2b0b4c,'resolvedBy':_0x4fb1dd,'isFromAdapter':!0x0});}),this['listenTo'](_0x596450,'commentThreadUpdated',(_0x3fe43c,{commentThreadId:_0x43f076,documentId:_0x47b6b6,context:_0x40e646,unlinkedAt:_0x160215,attributes:_0x3776e0})=>{_0x2e99b7['getCommentThread'](_0x43f076)&&_0x2e99b7['updateCommentThread']({'threadId':_0x43f076,'channelId':_0x47b6b6,'context':_0x40e646,'unlinkedAt':_0x160215,'attributes':_0x3776e0,'isFromAdapter':!0x0});}),this['listenTo'](_0x596450,'commentThreadResolved',(_0x5d8d4,{commentThreadId:_0x16a9c1,resolvedBy:_0x1894de,resolvedAt:_0x500609})=>{const _0x2abaf1=_0x2e99b7['getCommentThread'](_0x16a9c1);_0x2abaf1&&_0x2abaf1['resolve']({'resolvedBy':_0x1894de,'resolvedAt':_0x500609,'isFromAdapter':!0x0});}),this['listenTo'](_0x596450,'commentThreadReopened',(_0x41ab61,{commentThreadId:_0x34b76b})=>{const _0x2e4ef3=_0x2e99b7['getCommentThread'](_0x34b76b);_0x2e4ef3&&_0x2e4ef3['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0x596450,'commentThreadRemoved',(_0x572594,{commentThreadId:_0xcddddb})=>{const _0x76f999=_0x2e99b7['getCommentThread'](_0xcddddb);_0x76f999&&_0x76f999['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0x596450,'commentAdded',(_0x56b03f,_0x1155f3)=>{const _0x378bab=_0x1155f3['commentThreadId'],_0x5bcf4d=_0x2e99b7['getCommentThread'](_0x378bab);_0x5bcf4d&&_0x5bcf4d['addComment']({...et(_0x1155f3),'isFromAdapter':!0x0});}),this['listenTo'](_0x596450,'commentUpdated',(_0x125379,{commentThreadId:_0x1ed941,commentId:_0xc4facb,content:_0x3ef105,attributes:_0x2515da})=>{const _0x120485=_0x2e99b7['getCommentThread'](_0x1ed941);if(_0x120485){const _0x498eb=_0x120485['getComment'](_0xc4facb);_0x498eb&&_0x498eb['update']({'content':_0x3ef105,'attributes':_0x2515da,'isFromAdapter':!0x0});}}),this['listenTo'](_0x596450,'commentRemoved',(_0x2c531e,{commentThreadId:_0x2a9d78,commentId:_0x592e66})=>{const _0x1ca654=_0x2e99b7['getCommentThread'](_0x2a9d78);if(_0x1ca654){const _0x1fa6c7=_0x1ca654['getComment'](_0x592e66);_0x1fa6c7&&_0x1fa6c7['remove']({'isFromAdapter':!0x0});}}),await this['_connectService'](_0x222bb3);}['destroy'](){if(this['context']instanceof _0x50a571){const _0x1199c8=this['context']['config']['get']('collaboration.channelId');this['_terminateService'](_0x1199c8);}}['_terminateService'](_0x2e2e53){if(!this['_services']['has'](_0x2e2e53))throw new _0x33aeca('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0x2e2e53});this['_getService'](_0x2e2e53)['disconnect'](),this['_services']['delete'](_0x2e2e53);}async['reconnect'](){for(const _0x5f46c0 of this['_services']['keys']())await this['_connectService'](_0x5f46c0);if(this['context']instanceof _0x50a571){const _0x47e49e=this['context']['config']['get']('collaboration.channelId'),_0x4397b1=this['context']['plugins']['get'](i);_0x4397b1['unregister'](_0x47e49e);const _0x52b0dd=await this['_services']['get'](_0x47e49e)['getConnectedSessions']();_0x4397b1['register'](_0x47e49e,_0x52b0dd);}}async['_connectService'](_0x5b69d2){const {connection:_0x4f69b1}=this['context']['plugins']['get'](n),_0x12e187=this['context']['plugins']['get']('CommentsRepository'),_0x50c86f=this['_services']['get'](_0x5b69d2),_0x417301=await _0x50c86f['connect'](_0x4f69b1);await this['_fetchMissingUsersForThreads'](_0x417301);const _0x4a05e8=new Set(Array['from'](_0x12e187['getCommentThreads']({'channelId':_0x5b69d2}),_0x113f34=>_0x113f34['id']));for(const _0x58a779 of _0x417301)_0x58a779['deletedAt']||_0x4a05e8['delete'](_0x58a779['commentThreadId']);for(const _0xe96c6d of _0x4a05e8)_0x12e187['getCommentThread'](_0xe96c6d)['remove']({'isFromAdapter':!0x0});for(const _0x81fa88 of _0x417301){let _0x512d37=_0x12e187['getCommentThread'](_0x81fa88['commentThreadId']);const {commentThreadId:_0x832dde,context:_0xfe2331,attributes:_0x1e2b52,resolvedBy:_0x43de68,resolvedAt:_0x419b8e,unlinkedAt:_0x2749de,deletedAt:_0x1636a2}=_0x81fa88;if(_0x1636a2)continue;_0x512d37||(_0x512d37=_0x12e187['addCommentThread']({'channelId':_0x5b69d2,'threadId':_0x832dde,'context':_0xfe2331,'attributes':_0x1e2b52||{},'resolvedBy':_0x43de68,'resolvedAt':_0x419b8e,'unlinkedAt':_0x2749de,'isFromAdapter':!0x0}));const _0x27f94b=new Set(Array['from'](_0x512d37['comments'],_0x56c80a=>_0x56c80a['id']));for(const _0x5b5847 of _0x81fa88['comments'])_0x27f94b['delete'](_0x5b5847['commentId']);for(const _0xfada1b of _0x27f94b)_0x512d37['getComment'](_0xfada1b)['remove']({'isFromAdapter':!0x0});for(const _0x5cfcad of _0x81fa88['comments']){const _0x352c9a=_0x512d37['getComment'](_0x5cfcad['commentId']);_0x352c9a?_0x352c9a['content']!==_0x5cfcad['content']&&_0x352c9a['update']({'content':_0x5cfcad['content'],'isFromAdapter':!0x0}):_0x512d37['addComment'](Object['assign'](et(_0x5cfcad),{'isFromAdapter':!0x0}));}}}['_getService'](_0x4c9209){if(!this['_services']['has'](_0x4c9209))throw new _0x33aeca('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0x4c9209});return this['_services']['get'](_0x4c9209);}async['_fetchMissingUsersForThreads'](_0x341ce7){const _0x4cf798=this['context']['plugins']['get'](_0x3c0cad),{connection:_0x49a644}=this['context']['plugins']['get'](n),_0x33619d=new Set();for(const {resolvedBy:_0x492bb1,comments:_0x5c127c}of _0x341ce7){_0x492bb1&&!_0x4cf798['getUser'](_0x492bb1)&&_0x33619d['add'](_0x492bb1);for(const {userId:_0x2120d1}of _0x5c127c)_0x4cf798['getUser'](_0x2120d1)||_0x33619d['add'](_0x2120d1);}if(0x0===_0x33619d['size'])return;const _0xb5cb6a=await ut['getMany'](_0x49a644,Array['from'](_0x33619d));for(const _0x369d31 of _0xb5cb6a)_0x4cf798['getUser'](_0x369d31['id'])||_0x4cf798['addUser'](_0x369d31);}}async function Z(_0x7f7ba0){if('404'!==_0x7f7ba0['code'])throw _0x7f7ba0;}function ft(_0x276f55){if((_0x329f5e=_0x276f55)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0x329f5e['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x329f5e['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0x329f5e;throw _0x276f55;}function et(_0x3194de){return{'threadId':_0x3194de['commentThreadId'],'commentId':_0x3194de['commentId'],'content':_0x3194de['content'],'createdAt':_0x3194de['createdAt'],'authorId':_0x3194de['userId'],'attributes':_0x3194de['attributes']||{}};}class m extends _0x487b62{static ['TrackChangesService']=/* #__PURE__ -- @preserve */
|
|
27
|
+
((()=>rt)());['_bufferedRequests'];['_trackChangesService'];static get['requires'](){return[s,'TrackChangesEditing',n];}static get['pluginName'](){return'CloudServicesTrackChangesAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x21af19){super(_0x21af19);const _0xf182c4=this['editor']['config']['get']('collaboration.channelId');this['_bufferedRequests']=new Map(),this['_trackChangesService']=new m['TrackChangesService'](_0xf182c4);}['init'](){const _0x37a4d8=this['editor']['plugins']['get'](n),_0x2e3e62=this['editor']['plugins']['get']('TrackChangesEditing');return _0x2e3e62['adapter']={'getSuggestion':async _0x1c0fbf=>{await this['_waitForServiceReady']();const _0x303eea=await this['_trackChangesService']['get'](_0x1c0fbf)['catch'](tt);return await this['_fetchMissingUsersForThreads']([_0x303eea]),_0x303eea;},'addSuggestion':async({id:_0x28e26d,type:_0x321857,data:_0xdaf437,originalSuggestionId:_0xbc0117,attributes:_0x6c85e})=>{await this['_waitForServiceReady']();const _0x3e4b49={'id':_0x28e26d,'type':_0x321857,'data':_0xdaf437,'originalSuggestionId':_0xbc0117,'attributes':_0x6c85e},_0x26475b=await this['_trackChangesService']['add'](_0x28e26d,_0x321857,_0xdaf437,_0xbc0117,_0x6c85e)['catch'](_0x3b5f3c=>{if(mt(_0x3b5f3c))return new Promise(_0x3d95b4=>{this['_bufferedRequests']['set'](_0x28e26d,{'resolve':_0x3d95b4,'suggestionData':_0x3e4b49});});throw _0x3b5f3c;});return this['_bufferedRequests']['delete'](_0x28e26d),_0x26475b;},'updateSuggestion':async(_0x54c49a,_0x4e51a7)=>{if(await this['_waitForServiceReady'](),'open'!==_0x4e51a7['state'])return this['_trackChangesService']['update'](_0x54c49a,_0x4e51a7)['catch'](tt);}},this['listenTo'](this['_trackChangesService'],'suggestionUpdated',(_0x1d891e,_0x41e3c3)=>{_0x2e3e62['hasSuggestion'](_0x41e3c3['id'])&&(_0x2e3e62['getSuggestion'](_0x41e3c3['id'])['attributes']=_0x41e3c3['attributes']);}),this['_trackChangesService']['connect'](_0x37a4d8['connection'])['then'](_0x21c3c0=>(_0x37a4d8['addToReconnectionStack'](this),this['_fetchMissingUsersForThreads'](_0x21c3c0)['then'](()=>{for(const _0x41dd6f of _0x21c3c0){_0x2e3e62['addSuggestionData'](_0x41dd6f)['_saved']=!0x0;}})));}async['reconnect'](){const _0x1872b8=this['editor']['plugins']['get']('TrackChangesEditing'),{connection:_0x2f9dd7}=this['editor']['plugins']['get'](n),_0x455e87=await this['_trackChangesService']['connect'](_0x2f9dd7);await this['_fetchMissingUsersForThreads'](_0x455e87);for(const {suggestionData:_0x159b34,resolve:_0x57a18e}of this['_bufferedRequests']['values']()){let _0x38bad5=_0x455e87['find'](_0x4fd940=>_0x4fd940['id']===_0x159b34['id']);_0x38bad5||(_0x38bad5=await this['_trackChangesService']['add'](_0x159b34['id'],_0x159b34['type'],_0x159b34['data'],_0x159b34['originalSuggestionId'])),_0x57a18e(_0x38bad5);}for(const _0x24efc1 of _0x455e87)_0x1872b8['hasSuggestion'](_0x24efc1['id'])||_0x1872b8['addSuggestionData'](_0x24efc1);}async['_waitForServiceReady'](){this['_trackChangesService']['isConnected']||await new Promise(_0x102879=>{this['listenTo'](this['_trackChangesService'],'connected',_0x5d1bf9=>{_0x5d1bf9['off'](),_0x102879();});});}async['_fetchMissingUsersForThreads'](_0x19b57e){const _0x2b8a77=this['editor']['plugins']['get'](_0x3c0cad),{connection:_0x136391}=this['editor']['plugins']['get'](n),_0x3800ef=new Set();for(const {authorId:_0x214d37}of _0x19b57e)_0x2b8a77['getUser'](_0x214d37)||_0x3800ef['add'](_0x214d37);if(0x0===_0x3800ef['size'])return;const _0x316928=await ut['getMany'](_0x136391,Array['from'](_0x3800ef));for(const _0x515802 of _0x316928)_0x2b8a77['getUser'](_0x515802['id'])||_0x2b8a77['addUser'](_0x515802);}}function tt(_0x279541){if(mt(_0x279541))return new Promise(()=>{});throw _0x279541;}function mt(_0x2ec32f){return _0x2ec32f['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x2ec32f['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class g extends _0x487b62{static get['requires'](){return['Comments',s,a,n];}static get['pluginName'](){return'RealTimeCollaborativeComments';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x4fd652=this['editor']['plugins']['get'](n),_0x30128d=this['editor']['plugins']['get']('CommentsEditing'),_0x315507=this['editor']['plugins']['get'](s);return this['editor']['data']['once']('ready',()=>{this['listenTo'](_0x4fd652,'change:state',(_0x234c08,_0x4c2552,_0x191216)=>{_0x30128d['isThreadsLoadingPaused']='connected'!==_0x191216;});}),this['listenTo'](_0x4fd652,'change:state',(_0x42d008,_0x48d559,_0x1f33d1)=>{this['editor']['plugins']['get']('CommentsRepository')['switchReadOnly']('connected'!==_0x1f33d1);}),_0x315507['_setUpService'](this['editor']['config']['get']('collaboration.channelId'));}['destroy'](){this['editor']['plugins']['get'](s)['_terminateService'](this['editor']['config']['get']('collaboration.channelId')),super['destroy']();}}class pt extends _0x487b62{static get['requires'](){return[g,m,'TrackChanges'];}static get['pluginName'](){return'RealTimeCollaborativeTrackChanges';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class c extends _0x487b62{static ['RevisionHistoryService']=/* #__PURE__ -- @preserve */
|
|
28
|
+
((()=>st)());['_lastRequestId'];['_revisionTracker'];['_revisionHistoryService'];['_oldOffset'];static get['requires'](){return[n,l,'RevisionHistory',i,_0x3c0cad];}static get['pluginName'](){return'CloudServicesRevisionHistoryAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x480f63){super(_0x480f63);const _0x4353e3=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new c['RevisionHistoryService'](_0x4353e3);}async['init'](){const _0x34f5fc=this['editor']['plugins']['get'](l),_0x196422=_0x34f5fc['serverHistory'],_0x5bda1d=this['editor']['plugins']['get'](n);this['_revisionTracker']['setSource']({'history':_0x196422,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0x34f5fc['sessionId']});const _0x3287ca=this['editor']['config']['get']('cloudServices.bundleVersion')||ht,_0x4b5331=await it['isBundleUploaded'](_0x5bda1d['connection'],_0x3287ca);this['editor']['plugins']['get']('RevisionHistory')['adapter']={'getRevision':async({revisionId:_0x10289c})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0x10289c)),'updateRevisions':async _0x18accd=>{await this['_waitForServiceReady']();const _0x51a5ac=this['_revisionTracker']['currentRevision'];if(_0x4b5331&&0x1===_0x18accd['length']&&_0x18accd[0x0]['id']===_0x51a5ac['id'])return _0x18accd;for(const _0x50872b of _0x18accd)_0x50872b['id']===_0x51a5ac['id']&&(_0x50872b['isEmptyCurrent']=_0x50872b['fromVersion']===_0x50872b['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0x18accd,this['_lastRequestId'])['then'](_0x4a0884=>(this['_lastRequestId']=_0x4a0884,_0x18accd))['catch'](_0x5c0c5d=>{if(ot(_0x5c0c5d)||'400'===_0x5c0c5d['code']&&void 0x0!==_0x5c0c5d['data']['wrongRequestId']){for(const _0x57f604 of _0x18accd){!this['_revisionTracker']['repository']['getRevision'](_0x57f604['id'])||this['_revisionTracker']['_bufferUpdate'](_0x57f604['id'],_0x57f604,!0x1);}if(ot(_0x5c0c5d))throw _0x5c0c5d;return _0x18accd;}throw _0x5c0c5d;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0x55fcb0,{revisionsData:_0x2d3a5e,requestId:_0x5d136d})=>{Math['max'](..._0x2d3a5e['map'](_0x23ab52=>_0x23ab52['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0x2d3a5e,_0x5d136d);}):this['_handleRevisionsUpdate'](_0x2d3a5e,_0x5d136d);});const {revisions:_0x1ec3f7,requestId:_0x5208aa}=await this['_revisionHistoryService']['connect'](_0x5bda1d['connection']);_0x5bda1d['addToReconnectionStack'](this),this['_lastRequestId']=_0x5208aa,await this['_fetchMissingUsers'](_0x1ec3f7);for(const _0x3f4f48 of _0x1ec3f7)this['_revisionTracker']['addRevisionData'](_0x3f4f48);this['listenTo'](_0x34f5fc,'change:_isConnected',(_0x406a30,_0x4f9bf2,_0x57681d)=>{_0x57681d&&(this['_oldOffset']=_0x34f5fc['_offset'],_0x406a30['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](_0x5bda1d,'state',_0x1d68fd=>_0x1d68fd===_0x3c448a['CONNECTED']);}async['reconnect'](){const _0x4b4105=this['editor']['plugins']['get'](n),_0x4679de=this['editor']['plugins']['get'](l),_0x3b41ec=async()=>{const _0x21c15e=this['_revisionTracker']['currentRevision'],_0x569e6b=_0x21c15e['id'],_0x515f23=_0x569e6b!==_0x4679de['sessionId'];if(_0x515f23){const _0x62285e=_0x4679de['_offset']-this['_oldOffset'],_0xa9a6c4=this['_getLatestVersionFromServerOperations']();this['_revisionTracker']['_revisionDataBuilder']['reInit']();if(_0x21c15e['toVersion']+_0x62285e!==_0xa9a6c4){const _0x35b69c=_0x21c15e['fromVersion']+_0x62285e,_0x85b9d9=this['editor']['plugins']['get'](_0x3c0cad),_0x4382cc=this['_revisionTracker']['buildRevisionData']({'revision':_0x21c15e,'from':_0x35b69c,'to':_0xa9a6c4});_0x4382cc['id']=_0x21c15e['id'];const _0x252a5a=_0x4382cc['authorsIds']['map'](_0x406d17=>_0x85b9d9['getUser'](_0x406d17));_0x21c15e['_update']({..._0x4382cc,'authors':_0x252a5a},!0x0),this['_revisionTracker']['_bufferUpdate'](_0x21c15e['id'],_0x4382cc,!0x0);}this['_revisionTracker']['_startingVersion']=_0xa9a6c4,(_0x21c15e['toVersion']===_0x21c15e['fromVersion']&&!this['_revisionTracker']['_bufferedUpdates']['has'](_0x569e6b)&&this['_revisionTracker']['repository']['_revisions']['remove'](_0x569e6b),this['_revisionTracker']['_createCurrentRevision'](_0xa9a6c4));}const {revisions:_0x39ccf8,requestId:_0x555ec1}=await this['_revisionHistoryService']['reconnect'](_0x4b4105['connection'],this['_lastRequestId']);_0x515f23&&_0x39ccf8['length']>0x0?_0x4679de['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x39ccf8),this['_handleRevisionsUpdate'](_0x39ccf8,_0x555ec1),this['_revisionTracker']['sendBufferedUpdates']());};return _0x4679de['_isConnected']?_0x3b41ec():new Promise((_0x588eb1,_0x57ffbe)=>{_0x4679de['once']('change:_isConnected',()=>{_0x3b41ec()['then'](_0x588eb1)['catch'](_0x57ffbe);});});}['destroy'](){super['destroy']();}async['_waitForServiceReady'](){this['_revisionHistoryService']['isConnected']||await new Promise(_0x4055e4=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x5afe60=>{_0x5afe60['off'](),_0x4055e4();});});}['_getLatestVersionFromServerOperations'](){const _0x3390da=this['editor']['plugins']['get'](l)['serverHistory']['getOperations']()['reverse']();for(const _0x5c3ccf of _0x3390da)if('marker'!==_0x5c3ccf['type']||_0x5c3ccf['affectsData'])return _0x5c3ccf['baseVersion']+0x1;}['_getLatestVersion'](){const _0x5ccd08=this['editor']['plugins']['get'](l);return new Promise(_0x4bc327=>{_0x5ccd08['_isPendingUpdate']?_0x5ccd08['once']('change:_isPendingUpdate',()=>{_0x4bc327(this['_getLatestVersionFromServerOperations']());}):_0x4bc327(this['_getLatestVersionFromServerOperations']());});}['_handleRevisionsUpdate'](_0x31e3d5,_0x5aa0eb){const _0x5e6cf9=this['_revisionTracker']['repository'];this['_lastRequestId']=_0x5aa0eb;for(const _0x29eb19 of _0x31e3d5){const _0x4d93db=_0x5e6cf9['getRevision'](_0x29eb19['id']);if(_0x4d93db){if((_0x29eb19['fromVersion']||_0x29eb19['toVersion'])&&(_0x29eb19['diffData']=null),_0x4d93db===this['_revisionTracker']['currentRevision']){const _0x397f12=Math['max'](_0x4d93db['toVersion'],_0x29eb19['toVersion']),_0x50e75a=Math['max'](_0x4d93db['fromVersion'],_0x29eb19['fromVersion']);let _0x255dec;_0x4d93db['toVersion']===_0x29eb19['toVersion']&&_0x4d93db['fromVersion']===_0x29eb19['fromVersion']?(_0x255dec=!0x0,this['_preventResendingRevisionData'](_0x29eb19)):_0x29eb19['toVersion']===_0x397f12&&_0x29eb19['fromVersion']===_0x50e75a?_0x255dec=!0x1:(_0x4d93db['toVersion']===_0x397f12&&_0x4d93db['fromVersion']===_0x50e75a||this['_fixRevision']({'revision':_0x4d93db,'from':_0x50e75a,'to':_0x397f12}),_0x255dec=!0x0),_0x255dec&&(delete _0x29eb19['fromVersion'],delete _0x29eb19['toVersion'],delete _0x29eb19['diffData'],delete _0x29eb19['createdAt'],delete _0x29eb19['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0x29eb19),this['_preventResendingRevisionData'](_0x29eb19);}else this['_revisionTracker']['addRevisionData'](_0x29eb19);}const _0x5b6b66=_0x5e6cf9['getRevisions']();_0x5b6b66['reverse']();for(let _0x50c73b=0x0;_0x50c73b<_0x5b6b66['length']-0x1;_0x50c73b++){const _0x2ba818=_0x5b6b66[_0x50c73b],_0x238a49=_0x5b6b66[_0x50c73b+0x1];if(_0x2ba818['fromVersion']<_0x238a49['toVersion']){const _0x468df6=_0x238a49['toVersion'],_0x2db814=Math['max'](_0x468df6,_0x2ba818['toVersion']);this['_fixRevision']({'revision':_0x2ba818,'from':_0x468df6,'to':_0x2db814});}}}['_fixRevision']({revision:_0x5909bf,from:_0x72a95b,to:_0x33524e}={}){const _0x5a81cd=this['editor']['plugins']['get'](_0x3c0cad),_0x4f19c4=this['_revisionTracker']['buildRevisionData']({'revision':_0x5909bf,'from':_0x72a95b,'to':_0x33524e});_0x4f19c4['authors']=_0x4f19c4['authorsIds']['map'](_0x5306bd=>_0x5a81cd['getUser'](_0x5306bd)),_0x5909bf['_update'](_0x4f19c4);}['_preventResendingRevisionData'](_0x2ecffb){const _0x1b85ce={};_0x1b85ce['id']=_0x2ecffb['id'];for(const _0x48bff1 of Object['keys'](_0x2ecffb))'id'!==_0x48bff1&&(_0x1b85ce[_0x48bff1]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0x1b85ce['id'],_0x1b85ce,!0x0);}async['_fetchMissingUsers'](_0x5daf32){const _0x4841fa=this['editor']['plugins']['get'](_0x3c0cad),{connection:_0x1744b6}=this['editor']['plugins']['get'](n),_0x3054b6=new Set();for(const _0x47c6a7 of _0x5daf32){for(const _0x55057a of _0x47c6a7['authorsIds'])_0x164526(_0x55057a);_0x47c6a7['creatorId']&&_0x164526(_0x47c6a7['creatorId']);}if(0x0===_0x3054b6['size'])return;const _0xc113cf=await ut['getMany'](_0x1744b6,Array['from'](_0x3054b6));for(const _0x4bfef8 of _0xc113cf)_0x4841fa['getUser'](_0x4bfef8['id'])||_0x4841fa['addUser'](_0x4bfef8);function _0x164526(_0x2e522f){_0x4841fa['getUser'](_0x2e522f)||_0x3054b6['add'](_0x2e522f);}}}function ot(_0xe87989){return _0xe87989['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0xe87989['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0xe87989['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class gt extends _0x487b62{static get['requires'](){return['RevisionHistory',c,a];}static get['pluginName'](){return'RealTimeCollaborativeRevisionHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class b extends _0x3cbb81{['_collapseAt'];constructor(_0x15e3ba,_0x324de7=0x6){super(_0x15e3ba);const _0x5a4393=this['bindTemplate'];this['set']('isHidden',!0x0),this['set']('usersCount',0x0),this['_collapseAt']=_0x324de7,this['bind']('isHidden')['to'](this,'usersCount',_0x3fa75e=>_0x3fa75e<_0x324de7),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item',_0x5a4393['if']('isHidden','ck-presence-list__counter--hidden')],'role':'listitem'},'children':[{'tag':'div','attributes':{'class':['ck','ck-presence-list__users-counter']},'children':[{'tag':'div','attributes':{'class':['ck','ck-presence-list__users-counter__text']},'children':[{'text':_0x5a4393['to']('usersCount',_0x331ef1=>'+'+(_0x331ef1-this['_collapseAt']+0x2)['toString']())}]}]}]});}}class is extends _0x3cbb81{['items'];['keystrokes'];constructor(_0x109cad){super(_0x109cad);const _0x6a1217=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0x80aa60(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0x6a1217['if']('hasPopup'),'aria-expanded':_0x6a1217['to']('isExpanded',_0x502b32=>this['hasPopup']&&String(_0x502b32)),'aria-label':_0x6a1217['to']('hasPopup',_0x5ef928=>E(_0x109cad,_0x5ef928?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0x6a1217['to']('hasPopup',_0x1c96e2=>!!_0x1c96e2&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items'],'on':{'mouseenter':_0x6a1217['to'](()=>this['fire']('presencelist:show')),'mouseleave':_0x6a1217['to'](_0x80f568=>{const _0x23bc65=_0x80f568,_0x1babbf=document['querySelector']('.ck-presence-list__dropdown-list'),_0x16ce3d=document['querySelector']('.ck-balloon-panel_with-arrow');_0x1babbf?.['contains'](_0x23bc65['relatedTarget'])||_0x16ce3d?.['contains'](_0x23bc65['relatedTarget'])||this['fire']('presencelist:hide');})}}),this['on']('change:hasPopup',(_0x48af7b,_0xf7a66c,_0x5b636b)=>{this['element']&&(_0x5b636b?this['element']['setAttribute']('aria-expanded',String(this['isExpanded'])):this['element']['removeAttribute']('aria-expanded'));});}['focus'](){this['element']['focus']();}['render'](){super['render'](),this['keystrokes']['listenTo'](this['element']);}}class v extends _0x3cbb81{['counterView'];['inlineListView'];constructor(_0x5ceb72,_0x4ccc7d=0x6){super(_0x5ceb72);const _0x224839=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new b(this['locale'],_0x4ccc7d),this['inlineListView']=new is(_0x5ceb72),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x6278a2 of this['inlineListView']['items'])_0x6278a2['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',_0x224839['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['inlineListView']]});}}class L extends _0x3cbb81{['listWrapperView'];constructor(_0x27d377,_0x5735f){super(_0x27d377);const _0x3f14cb=this['bindTemplate'];this['listWrapperView']=new wt(_0x27d377,_0x5735f),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':E(_0x27d377,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']],'on':{'mouseleave':_0x3f14cb['to'](_0x5916fc=>{const _0x2ba9e8=_0x5916fc,_0x4d0977=document['querySelector']('.ck-presence-list__list'),_0x571a2a=document['querySelector']('.ck-balloon-panel_with-arrow');_0x4d0977?.['contains'](_0x2ba9e8['relatedTarget'])||_0x571a2a?.['contains'](_0x2ba9e8['relatedTarget'])||this['fire']('presencelist:hide');})}});}}class wt extends _0x5441af{constructor(_0x52318c,_0x3a5930){super(_0x52318c);const _0x17e998=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0x3a5930?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0x17e998['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0x17e998['to']('role'),'aria-label':_0x17e998['to']('ariaLabel'),'aria-labelledby':_0x17e998['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0x40d962['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0x347fc5=this['element'];_0x347fc5&&(this['_isScrollable']=Math['max'](_0x347fc5['scrollHeight'],_0x347fc5['clientHeight'])>0.8*window['innerHeight']);}}class j extends ct{['userView'];constructor(_0x545f5e,_0x284fe0,_0x148a4a){super(_0x545f5e);const _0x329a36=this['bindTemplate'];this['userView']=new at(_0x545f5e,_0x284fe0);const _0x11348a={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0x284fe0['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0x284fe0['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x284fe0['color']['getBackgroundColorClass']()],'aria-hidden':'true'}}]};_0x148a4a&&(_0x11348a['tag']='button',_0x11348a['on']={'click':_0x329a36['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x11348a);}['focus'](){this['element']['focus']();}}class A extends _0x3cbb81{['userView'];['markerView'];constructor(_0xff7d0b,_0xb3bb76,_0x565559){super(_0xff7d0b);const _0x313ffd=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new at(_0xff7d0b,_0xb3bb76),this['markerView']=new nt(_0xff7d0b,_0xb3bb76);const _0x22d1e4=new lt(_0xff7d0b);_0x22d1e4['template']['tag']='span',_0x22d1e4['text']=_0xb3bb76['name'];const _0x4d2f98={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0x313ffd['to']('isFocusable',_0x36e937=>!!_0x36e937&&0x0),'aria-labelledby':_0x22d1e4['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0x313ffd['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0x313ffd['to']('hasTooltip',_0x4e7a68=>!_0x4e7a68),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0x22d1e4]};_0x565559&&(_0x4d2f98['tag']='button',_0x4d2f98['on']={'click':_0x313ffd['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x4d2f98);}}class nt extends _0x3cbb81{constructor(_0x3a6be4,_0x71f70b){super(_0x3a6be4),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x71f70b['color']['getBackgroundColorClass']()],'aria-hidden':'true'}});}}const x={'collapseAt':0x6,'displayMe':!0x0};class r extends _0x3a534a{['currentDisplayedUsers'];['balloonPanelView'];['view'];['presenceDropdownView'];['_bodyCollection']=null;static get['pluginName'](){return'PresenceListUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x2cb493){super(_0x2cb493),this['context']['config']['define']('presenceList',x);const _0x3eee2a=_0x2cb493['config']['get']('presenceList.collapseAt');if('number'!=typeof _0x3eee2a)throw new _0x33aeca('presencelist-collapseat-invalid-format',this);if(_0x3eee2a<0x1)throw new _0x33aeca('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](i)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0x23e834(),this['balloonPanelView']=new _0x36c4ea(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get['requires'](){return[i];}['init'](){for(const _0x36131c of this['_allConnectedUsers'])this['_handleUserAdd'](_0x36131c);this['listenTo'](this['_allConnectedUsers'],'add',(_0x3a616d,_0x3f274d)=>{this['_handleUserAdd'](_0x3f274d);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0x1ac59b,_0x52c4b1)=>{this['_handleUserRemove'](_0x52c4b1);});}['_createView'](){const _0x130afd=this['context'],_0x75d4dc=new v(this['context']['locale'],this['context']['config']['get']('presenceList.collapseAt')),_0x545e50=this['balloonPanelView'];if(!_0x38ad78(_0x130afd['config']['get']('presenceList.container')))throw new _0x33aeca('presencelist-missing-container',this);return _0x75d4dc['counterView']['bind']('usersCount')['to'](this),_0x75d4dc['bind']('isCollapsed')['to'](this,'usersCount',_0x28fd54=>{const {collapseAt:_0x557a7f}=_0x130afd['config']['get']('presenceList'),_0x2dd2c1=_0x28fd54>=_0x557a7f;if(_0x2dd2c1&&!_0x75d4dc['inlineListView']['items']['find'](_0x4ea0b8=>_0x4ea0b8 instanceof b)){const _0x5cd04b=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['currentDisplayedUsers']['length']==_0x5cd04b&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](this['currentDisplayedUsers']['length']-0x1),_0x75d4dc['inlineListView']['items']['add'](_0x75d4dc['counterView']);}return _0x2dd2c1||this['hideDropdown'](),_0x2dd2c1;}),_0x75d4dc['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0x248027=>{const _0x2475bb=_0x130afd['config']['get']('presenceList'),_0x53b765=new A(_0x130afd['locale'],_0x248027,!!_0x2475bb['onClick']);return _0x53b765['bind']('hasTooltip')['to'](_0x75d4dc,'isCollapsed',_0x16f31f=>!_0x16f31f),_0x53b765['bind']('isFocusable')['to'](_0x75d4dc,'isCollapsed',_0x3ae263=>!_0x3ae263),_0x2475bb['onClick']&&this['listenTo'](_0x53b765,'execute',()=>{this['view']['isCollapsed']||_0x2475bb['onClick'](_0x248027,_0x53b765['element']);}),_0x53b765;}),this['listenTo'](_0x75d4dc['inlineListView'],'presencelist:show',()=>{this['view']['isCollapsed']&&this['showDropdown']();}),this['listenTo'](_0x75d4dc['inlineListView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();}),_0x75d4dc['inlineListView']['keystrokes']['set']('Enter',(_0x5f336c,_0x193d93)=>{this['view']['isCollapsed']&&(this['showDropdown'](),_0x193d93());}),_0x75d4dc['render'](),_0x545e50['render'](),_0x17d6ef({'emitter':_0x75d4dc,'activator':()=>_0x545e50['isVisible'],'contextElements':[_0x545e50['element'],_0x75d4dc['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0x130afd['config']['get']('presenceList.container')['appendChild'](_0x75d4dc['element']),this['_bodyCollection']=new _0x1695f7(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_bodyCollection']['add'](this['balloonPanelView']),_0x75d4dc;}['_handleUserAdd'](_0x5e2bb7){if(!this['context']['config']['get']('presenceList.displayMe')&&_0x5e2bb7['isMe'])return;const _0x25f2ae=this['context']['config']['get']('presenceList.collapseAt')-0x1;for(this['usersCount']++;this['currentDisplayedUsers']['length']>=_0x25f2ae-(this['view']['isCollapsed']?0x1:0x0)&&this['currentDisplayedUsers']['length']>0x1;)this['currentDisplayedUsers']['remove'](0x1);const _0x268052=_0x5e2bb7['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0x5e2bb7,_0x268052);}['_handleUserRemove'](_0x194926){this['usersCount']--;const {collapseAt:_0x3271a0}=this['context']['config']['get']('presenceList'),_0x5bcb66=this['usersCount']>=_0x3271a0;if(this['currentDisplayedUsers']['get'](_0x194926['id']))this['currentDisplayedUsers']['remove'](_0x194926['id']);else{if(_0x5bcb66&&this['currentDisplayedUsers']['length']+0x1===_0x3271a0-0x1)return;}if(this['currentDisplayedUsers']['length']+(_0x5bcb66?0x1:0x0)<this['usersCount']){for(const _0x125ed5 of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0x125ed5['id'])&&(this['currentDisplayedUsers']['add'](_0x125ed5,Math['min'](this['currentDisplayedUsers']['length']-(_0x5bcb66?0x1:0x0),0x1)),this['currentDisplayedUsers']['length']+(_0x5bcb66?0x1:0x0)===_0x3271a0-0x1))return;}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0x45b800=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new L(this['context']['locale'],!!_0x45b800['onClick']),this['view']['inlineListView']['isExpanded']=!0x0,this['listenTo'](this['presenceDropdownView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();});const {listWrapperView:_0x4797a1}=this['presenceDropdownView'];_0x4797a1['items']['bindTo'](this['_allConnectedUsers'])['using'](_0x2facbc=>{if(!_0x45b800['displayMe']&&_0x2facbc['isMe'])return null;const _0x102811=new j(this['context']['locale'],_0x2facbc,!!_0x45b800['onClick']);return _0x45b800['onClick']&&this['listenTo'](_0x102811,'execute',()=>{_0x45b800['onClick'](_0x2facbc,_0x102811['element']);}),_0x102811;}),this['balloonPanelView']['content']['add'](this['presenceDropdownView']),this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element']}),_0x4797a1['focus'](),_0x4797a1['checkIfScrollable']();const _0xf09ff9=(_0x5ba7d1,_0xb54faa)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0xb54faa();};_0x4797a1['keystrokes']['set']('Esc',_0xf09ff9),_0x4797a1['keystrokes']['set']('Shift+Tab',_0xf09ff9),_0x4797a1['keystrokes']['set']('Tab',(_0x37f6b0,_0x25da31)=>{!function(_0x47f43a){const _0x3e634e=['a','button','input','select','textarea','[tabindex]','[contenteditable]']['map'](_0x6f4397=>_0x6f4397+':not([disabled]):not([tabindex=\x22-1\x22])')['join'](','),_0x37d6e1=[...document['body']['querySelectorAll'](_0x3e634e)]['filter'](_0x2f80bc=>_0x2f80bc===document['activeElement']||_0x2f80bc['offsetWidth']+_0x2f80bc['offsetHeight']>0x0)['sort']((_0x18ec83,_0x55963d)=>(_0x18ec83['tabIndex']||0x0)-(_0x55963d['tabIndex']||0x0)),_0x4facb3=_0x37d6e1['indexOf'](_0x47f43a),_0x4d1c63=_0x37d6e1[(_0x4facb3+0x1)%_0x37d6e1['length']];_0x4d1c63&&_0x4d1c63['focus']();}(this['view']['element']),this['hideDropdown'](),_0x25da31();}),_0x4797a1['focusTracker']['add'](this['view']['element']),_0x4797a1['focusTracker']['on']('change:isFocused',(_0x118b09,_0x4649d5,_0x152357)=>{_0x152357||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 vt extends _0x3a534a{static get['requires'](){return[i,r];}static get['pluginName'](){return'PresenceList';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}export{s as CloudServicesCommentsAdapter,c as CloudServicesRevisionHistoryAdapter,m as CloudServicesTrackChangesAdapter,vt as PresenceList,r as PresenceListUI,l as RealTimeCollaborationClient,g as RealTimeCollaborativeComments,a as RealTimeCollaborativeEditing,gt as RealTimeCollaborativeRevisionHistory,pt as RealTimeCollaborativeTrackChanges,i as Sessions,n as WebSocketGateway,L as _RtcPresenceDropdownListView,wt as _RtcPresenceDropdownListWrapperView,v as _RtcPresenceListView};
|