@ckeditor/ckeditor5-real-time-collaboration 46.1.1-alpha.2 → 46.1.1-alpha.3
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/presencedropdownlistview.js +1 -1
- package/src/presencelist/view/presenceinlinelistitemview.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',_0x153278];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0xf2ceed){super(_0xf2ceed),this['set']('state',te['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=new(_0x1ea204())();}['init'](){const _0x403b4e=this['context'],_0x3ee6b4=_0x403b4e['plugins']['get']('CloudServices'),_0x4204d0=_0x403b4e['plugins']['get'](_0x153278);if(!_0x3ee6b4['token'])throw new _0x244de7('websocketgateway-missing-token',this);if(!_0x3ee6b4['webSocketUrl'])throw new _0x244de7('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'](_0x3ee6b4['token'],_0x3ee6b4['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0x183f8b=>{if(this['connection']=_0x183f8b,this['bind']('state')['to'](_0x183f8b,'state',this,'_isBrowserOffline',(_0x20518e,_0x41aa4)=>('connected'!==_0x20518e&&(this['_shouldPluginsReconnect']=!0x0),_0x41aa4||_0x20518e!==te['CONNECTED']?te['DISCONNECTED']:this['state']==te['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),te['CONNECTING']):te['CONNECTED'])),this['connection']['on']('error',(_0x19402e,_0x423db2)=>{if('limitExceeded'!==_0x423db2['code'])throw console['error'](_0x423db2),new _0x244de7('cloudservices-init',null,{'originalError':_0x423db2});_0x4204d0['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'});}),!_0x183f8b['me'])return new Promise(_0x1740b7=>_0x183f8b['on']('change:me',_0x1740b7));})['catch'](_0x4d24bb=>{throw console['error'](_0x4d24bb),new _0x244de7('cloudservices-init',null,{'originalError':_0x4d24bb});});}['addToReconnectionStack'](_0xca132a){if('function'!=typeof _0xca132a['reconnect'])throw new _0x244de7('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0xca132a))throw new _0x244de7('websocketgateway-plugin-already-registered',this,{'name':_0xca132a['constructor']['pluginName']});this['_reconnectionStack']['add'](_0xca132a);}['removeFromReconnectionStack'](_0x269fac){this['_reconnectionStack']['delete'](_0x269fac);}['isInReconnectionStack'](_0x32f7ab){return this['_reconnectionStack']['has'](_0x32f7ab);}['_reconnect'](){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0x42d162=>_0x42d162['reconnect']())))['then'](()=>this['state']=te['CONNECTED'])['catch'](_0x19acbe=>{throw console['error'](_0x19acbe),new _0x244de7('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 _0x257d3e{['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,_0x252144];}constructor(_0x31f188){super(_0x31f188),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0xe0a42b(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x252144);}['init'](){const _0x4dfc82=this['context']['plugins']['get'](n);this['listenTo'](_0x4dfc82,'change:state',(_0x3923bc,_0x233f17,_0x404848)=>{if('connected'!==_0x404848)this['channelSessions']['forEach'](_0x59a1da=>_0x59a1da['clear']()),this['channelConnectedUsers']['forEach'](_0x39a3f7=>_0x39a3f7['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x396928,_0x47e2c5]of this['_registeredSessions'])for(const _0xc9517c of _0x47e2c5)this['_handleSessionAdd'](_0x396928,_0xc9517c);}}),this['_createUser'](_0x4dfc82['connection']['me'],!0x0);}['register'](_0x2a55fe,_0x3d7f8a){if(this['_registeredSessions']['has'](_0x2a55fe))throw new _0x244de7('sessions-register-already-registered',null,{'channelId':_0x2a55fe});this['_registeredSessions']['set'](_0x2a55fe,_0x3d7f8a),this['channelSessions']['set'](_0x2a55fe,new _0xe0a42b()),this['channelConnectedUsers']['set'](_0x2a55fe,new _0xe0a42b()),this['listenTo'](_0x3d7f8a,'add',(_0x3f4eaa,_0x47e7c7)=>this['_handleSessionAdd'](_0x2a55fe,_0x47e7c7)),this['listenTo'](_0x3d7f8a,'remove',(_0x28c09c,_0x16a483)=>this['_handleSessionRemove'](_0x2a55fe,_0x16a483));for(const _0x18e5ba of _0x3d7f8a)this['_handleSessionAdd'](_0x2a55fe,_0x18e5ba);}['unregister'](_0x53c222){if(!this['_registeredSessions']['has'](_0x53c222))throw new _0x244de7('sessions-unregister-not-exist',null,{'channelId':_0x53c222});const _0x53bf39=this['_registeredSessions']['get'](_0x53c222);this['stopListening'](_0x53bf39);for(const _0x2eb35c of _0x53bf39)'connected'===this['context']['plugins']['get'](n)['state']&&this['_handleSessionRemove'](_0x53c222,_0x2eb35c);this['_registeredSessions']['delete'](_0x53c222),this['channelSessions']['delete'](_0x53c222),this['channelConnectedUsers']['delete'](_0x53c222);}get['mySessionId'](){return this['context']['plugins']['get'](n)['connection']['sessionId'];}['getUserBySessionId'](_0x9969f9){for(const _0x4534ef of this['channelSessions']['values']())for(const _0xff083c of _0x4534ef)if(_0xff083c['id']===_0x9969f9)return _0xff083c['user'];}['getUserSessions'](_0x1ffa16,_0x3ef1c9){const _0x3a928e=_0x3ef1c9?[this['channelSessions']['get'](_0x3ef1c9)]:this['channelSessions']['values'](),_0x34ef06=new Set();for(const _0xfb77ca of _0x3a928e)for(const _0x2049a3 of _0xfb77ca)_0x2049a3['user']['id']===_0x1ffa16['id']&&_0x34ef06['add'](_0x2049a3['id']);return _0x34ef06;}['getUserRole'](_0x3fb4b8){for(const _0xe3ac65 of this['channelSessions']['values']())for(const _0x3ce263 of _0xe3ac65)if(_0x3ce263['user']===_0x3fb4b8)return _0x3ce263['role'];}['_handleSessionAdd'](_0xce6779,_0x1ab29a){if('connected'!==this['context']['plugins']['get'](n)['state'])return;const _0x4f61f8=_0x1ab29a['user'],_0x19676d=this['_users']['getUser'](_0x4f61f8['id'])||this['_createUser'](_0x4f61f8),_0x573aeb=Object['assign']({},_0x1ab29a,{'user':_0x19676d});if(this['channelSessions']['get'](_0xce6779)['add'](_0x573aeb),!_0x4f61f8['hiddenInPresenceList']){const _0x5d68e0=this['channelConnectedUsers']['get'](_0xce6779);_0x5d68e0['has'](_0x19676d['id'])||_0x5d68e0['add'](_0x19676d),this['allConnectedUsers']['has'](_0x19676d['id'])||_0x4f61f8['hiddenInPresenceList']||this['allConnectedUsers']['add'](_0x19676d,_0x19676d['isMe']?0x0:void 0x0);}this['fire']('sessionAdd:'+_0xce6779,{'channelId':_0xce6779,'session':_0x573aeb});}['_handleSessionRemove'](_0x284a84,_0x4b7900){if('connected'!==this['context']['plugins']['get'](n)['state'])return;const _0x134c60=this['channelConnectedUsers']['get'](_0x284a84),_0x35da13=_0x4b7900['user'];_0x35da13['id']&&(this['channelSessions']['get'](_0x284a84)['remove'](_0x4b7900['id']),_0x134c60['has'](_0x35da13['id'])&&!this['getUserSessions'](_0x35da13,_0x284a84)['size']&&_0x134c60['remove'](_0x35da13['id']),this['allConnectedUsers']['get'](_0x35da13['id'])&&!this['getUserSessions'](_0x35da13)['size']&&this['allConnectedUsers']['remove'](_0x35da13['id']));}['_createUser'](_0x3577cb,_0x2ca3e2){const _0x6c47c8=this['_users']['addUser'](_0x3577cb);return _0x2ca3e2&&this['_users']['defineMe'](_0x3577cb['id']),_0x6c47c8['orderNumber']=this['_uniqueUsersCount']++,_0x6c47c8;}}class H extends _0x43cb95{['_domEmitter']=new(_0x1ea204())();static get['requires'](){return[i];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x183948=this['editor'],_0x1e38eb=_0x183948['plugins']['get'](i);_0x183948['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x3d147e,{writer:_0x25a816})=>function(_0x1a14dd,_0x4b6f53,_0x2b6bad,_0x16004e){const _0x2442fe=_0x1a14dd['markerName']['split'](':')[0x2],_0x441c0f=_0x2b6bad['getUserBySessionId'](_0x2442fe);if(!_0x441c0f||_0x2442fe===_0x2b6bad['mySessionId'])return;if(!_0x16004e['model']['schema']['checkChild'](_0x1a14dd['markerRange']['start'],'$text'))return;const _0x5c9e8d={'class':'ck-user__marker\x20'+_0x441c0f['color']['getMarkerClass'](),'data-name':_0x441c0f['name'],'data-session-id':_0x2442fe},_0x34377a=_0x16004e['model']['markers']['get'](_0x1a14dd['markerName']),_0x4b9243=_0x34377a['getStart'](),_0x43c42c=_0x4b9243['nodeAfter'],_0x1e5898=_0x16004e['model']['schema'];if(_0x43c42c&&_0x1e5898['isObject'](_0x43c42c)&&_0x1e5898['isInline'](_0x43c42c)&&!_0x16004e['model']['markers']['get']('user:range:'+_0x2442fe)['getRange']()['isCollapsed'])return;const _0x4c9a59=_0x4b9243['parent'];return _0x16004e['model']['schema']['isLimit'](_0x4c9a59)&&!_0x16004e['model']['hasContent'](_0x4c9a59)&&(_0x5c9e8d['contenteditable']=!0x1),function(_0x4b31e4,_0x13ff98,_0x3cb8a2){const _0x58ec69=_0x4b31e4['createUIElement']('span',_0x13ff98);return _0x4b31e4['setCustomProperty']('userPositionMarker',!0x0,_0x58ec69),_0x58ec69['render']=function(_0x5c3bf3){const _0x37d6d0=this['toDomElement'](_0x5c3bf3),_0x5395e3=document['createElement']('span');return _0x5395e3['classList']['add']('ck-user__marker-tooltip'),_0x5395e3['setAttribute']('contenteditable','false'),_0x5395e3['setAttribute']('spellcheck','false'),_0x5395e3['textContent']=_0x3cb8a2['name'],_0x37d6d0['innerHTML']='<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span>'+_0x5395e3['outerHTML']+'',_0x37d6d0['addEventListener']('mouseenter',()=>{_0x37d6d0['classList']['add']('ck-user__marker_hovered');}),_0x37d6d0['addEventListener']('mouseleave',()=>{_0x37d6d0['classList']['remove']('ck-user__marker_hovered');}),_0x37d6d0;},_0x58ec69['isSimilar']=function(_0x4d0c45){return!(!this['getCustomProperty']('userPositionMarker')||!_0x4d0c45['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0x4d0c45['getAttribute']('data-session-id'));},_0x58ec69;}(_0x4b6f53,_0x5c9e8d,_0x441c0f);}(_0x3d147e,_0x25a816,_0x1e38eb,_0x183948)}),_0x183948['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0xdced96=>function(_0x21b0fe,_0x2ec89b){const _0x290db5=_0x21b0fe['markerName']['split'](':')[0x2];if(_0x290db5===_0x2ec89b['mySessionId'])return null;const _0x264e74=_0x2ec89b['getUserBySessionId'](_0x290db5);if(!_0x264e74)return{'id':_0x290db5,'classes':[]};return{'id':_0x290db5,'classes':['ck-user__selection',_0x264e74['color']['getSelectionClass']()],'attributes':{'data-session-id':_0x290db5},'priority':0x7d0+_0x264e74['orderNumber']};}(_0xdced96,_0x1e38eb)}),function(_0x18717c){const _0xd155c9=_0x18717c['model'],_0x261bed=new Map(),_0x41a616=_0x18717c['plugins']['get'](i);_0xd155c9['markers']['on']('update:user:range',(_0x10bf72,_0x1e911f,_0x258d25,_0x5df3cb)=>{if(!_0x5df3cb&&_0x261bed['get'](_0x1e911f['name']))return _0x261bed['get'](_0x1e911f['name'])['detach'](),void _0x261bed['delete'](_0x1e911f['name']);const _0xc5e666=_0x1e911f['name']['split'](':')[0x2];if(_0xc5e666===_0x41a616['mySessionId'])return;const _0x5a668c='user:position:'+_0xc5e666;_0xd155c9['markers']['has'](_0x5a668c)&&_0x18717c['editing']['reconvertMarker'](_0x5a668c),_0x1e911f['on']('change:range',(_0x5ccaf0,_0x235385,_0x276b26)=>{if('$graveyard'!=_0x235385['root']['rootName']&&'$graveyard'==_0x1e911f['getRange']()['root']['rootName']&&!_0x261bed['has'](_0x1e911f['name'])){const _0x3a370f=_0xd155c9['schema']['getNearestSelectionRange'](_0x276b26['deletionPosition']);if(_0x3a370f){const _0x36ff84=_0x329566['fromRange'](_0x3a370f);_0x261bed['set'](_0x1e911f['name'],_0x36ff84),_0x36ff84['on']('change:range',(_0x30af42,_0x393fe5,_0x527d48)=>{if('$graveyard'==_0x36ff84['root']['rootName']){const _0xb59640=_0xd155c9['schema']['getNearestSelectionRange'](_0x527d48['deletionPosition']);_0xb59640?(_0x36ff84['start']=_0xb59640['start'],_0x36ff84['end']=_0xb59640['end']):(_0x261bed['delete'](_0x1e911f['name']),_0x36ff84['detach']());}});}}});}),_0xd155c9['document']['on']('change',()=>{_0x261bed['size']>0x0&&_0xd155c9['enqueueChange']({'isUndoable':!0x1},_0x3f5c2e=>{for(const [_0x46292f,_0x3ec387]of _0x261bed)'$graveyard'==_0xd155c9['markers']['get'](_0x46292f)['getRange']()['root']['rootName']&&(Z(_0x46292f['split'](':')[0x2],_0x3ec387['toRange'](),_0xd155c9,_0x3f5c2e),_0x3ec387['detach']());_0x261bed['clear']();});});}(_0x183948),this['_domEmitter']['listenTo'](_0x391e42['document'],'keydown',(_0x933053,{key:_0x13d9a6})=>{'Escape'===_0x13d9a6&&function(_0x436ae0){_0x436ae0['editing']['view']['change'](_0x5c89ab=>{for(const _0xde993d of _0x436ae0['model']['markers']){if(!_0xde993d['name']['startsWith']('user:position'))continue;const _0x1f61e7=_0x436ae0['editing']['mapper']['markerNameToElements'](_0xde993d['name']);if(_0x1f61e7){for(const _0x296891 of _0x1f61e7)_0x5c89ab['removeClass']('ck-user__marker_hovered',_0x296891);}}});}(_0x183948);},{'useCapture':!0x0});}['afterInit'](){const _0x127823=this['editor'],_0x551b76=_0x127823['commands']['get']('undo');_0x551b76&&_0x127823['model']['on']('applyOperation',(_0x3e17ef,_0xbd08f6)=>{const _0x179ef5=_0xbd08f6[0x0];if(!_0x179ef5['isDocumentOperation'])return;if('marker'!=_0x179ef5['type']||!_0x179ef5['name']['startsWith']('user:'))return;const _0x36eb90=_0x179ef5['batch'];_0x551b76['_createdBatches']['has'](_0x36eb90)&&(_0x179ef5['newRange']=_0x179ef5['oldRange']?_0x127823['model']['createRange'](_0x179ef5['oldRange']['start'],_0x179ef5['oldRange']['end']):null);},{'priority':'highest'});}['destroy'](){return this['_domEmitter']['stopListening'](),super['destroy']();}['createUserMarkerOperations'](){const _0x227821=this['editor'],_0x1e8e16=_0x227821['model']['document'],_0x3a37be=_0x227821['plugins']['get'](i);_0x227821['model']['enqueueChange']({'isUndoable':!0x1},_0x93ff68=>{const _0x39c6ac='user:range:'+_0x3a37be['mySessionId'],_0x3d965a='user:position:'+_0x3a37be['mySessionId'],_0x302b53=_0x227821['model']['markers']['has'](_0x39c6ac);_0x227821['editing']['view']['hasDomSelection']?Z(_0x3a37be['mySessionId'],_0x1e8e16['selection']['getFirstRange'](),_0x227821['model'],_0x93ff68):_0x302b53&&(_0x93ff68['removeMarker'](_0x39c6ac),_0x93ff68['removeMarker'](_0x3d965a));});}}function Z(_0x3463d7,_0x254cc9,_0x35f79e,_0x13841d){const _0x27be0b='user:range:'+_0x3463d7,_0xf7698d='user:position:'+_0x3463d7,_0x2755ec=_0x254cc9['getContainedElement']();let _0x971701=_0x254cc9['start'];if(_0x2755ec&&_0x2755ec['is']('element','tableCell')){const _0x10c1ea=function(_0x30fc8d,_0x3fb86b){for(const _0x2ae524 of _0x30fc8d['getPositions']())if(_0x3fb86b['schema']['checkChild'](_0x2ae524,'$text'))return _0x2ae524;}(_0x254cc9,_0x35f79e);_0x10c1ea&&(_0x971701=_0x10c1ea,_0x254cc9=_0x13841d['createRange'](_0x971701));}const _0x44cfe5=_0x13841d['createRange'](_0x971701);_0x35f79e['markers']['has'](_0x27be0b)?(_0x13841d['updateMarker'](_0x27be0b,{'range':_0x254cc9}),_0x13841d['updateMarker'](_0xf7698d,{'range':_0x44cfe5})):(_0x13841d['addMarker'](_0x27be0b,{'range':_0x254cc9,'usingOperation':!0x0}),_0x13841d['addMarker'](_0xf7698d,{'range':_0x44cfe5,'usingOperation':!0x0}));}function V(_0x3877c0,_0x82a606,_0x345ca3){const _0x337151=_0x3877c0['t'],t=_0x3877c0['t'];switch(_0x82a606){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 _0x337151({'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'},_0x345ca3);default:return'';}}let G=0x1;class l extends _0x43cb95{static ['CollaborativeEditingService']=/* #__PURE__ -- @preserve */
|
|
25
|
-
((()=>_0x18694e)());['_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,_0x196d77,_0x252144,_0x153278];}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 _0x573d4f=this['serverHistory']['getOperations']();for(let _0x27ef7a=_0x573d4f['length']-0x1;_0x27ef7a>=0x0;_0x27ef7a--){const _0x2db0a1=_0x573d4f[_0x27ef7a];if(!this['_disconnectionOperations']['has'](_0x2db0a1))return _0x2db0a1['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0x45ebbf){if(super(_0x45ebbf),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x3123ea(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0x244de7('collaboration-missing-channelid',this);const _0x160ffd=_0x45ebbf['config']['get']('cloudServices.bundleVersion')||nt;this['_service']=new l['CollaborativeEditingService'](_0x160ffd,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0xb1a4c7(),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 _0x128f48=this['editor'],_0x242659=_0x128f48['plugins']['get'](_0x252144),_0x419db3=_0x128f48['plugins']['get'](n);this['listenTo'](_0x242659,'getOperationAuthor',(_0x10ace3,_0x1b0d98)=>{const _0x3af29c=_0x1b0d98[0x0];_0x3af29c['_authorId']&&(_0x10ace3['return']=_0x242659['getUser'](_0x3af29c['_authorId']),_0x10ace3['stop']()),null===_0x3af29c['_authorId']&&(_0x10ace3['return']=null,_0x10ace3['stop']());},{'priority':'high'}),this['listenTo'](_0x128f48['model']['document']['selection'],'change:range',(_0x2cb1ce,_0x3713b1)=>{_0x3713b1['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x128f48['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x128f48['model']['on']('applyOperation',(_0x186268,_0x5333c2)=>{const _0x4f412b=_0x5333c2[0x0];_0x4f412b['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0x4f412b),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['bind']('_isEditingAllowed')['to'](_0x419db3,'state',this,'_hasSynchronizationProblem',(_0x45594e,_0x19243d)=>'connected'===_0x45594e&&!_0x19243d),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x128f48['disableReadOnlyMode']('rtc-offline'):_0x128f48['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x128f48['disableReadOnlyMode']('rtc-offline'):_0x128f48['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async['reconnect'](){const _0x57aad8=this['editor']['plugins']['get'](i),_0x2913a1=this['editor']['plugins']['get'](n);try{this['_isPendingUpdate']=!0x0,_0x57aad8['unregister'](this['_channelId']);const _0x32565d=await this['_service']['reconnect'](_0x2913a1['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0x32565d)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x5682ba=await this['_service']['getConnectedSessions']();_0x57aad8['register'](this['_channelId'],_0x5682ba),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x4a4b6e){if(function(_0x485b13){return'404'===_0x485b13['code'];}(_0x4a4b6e)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0x4d2916){return'409'===_0x4d2916['code'];}(_0x4a4b6e)){const _0x5ed5ab=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'](_0x5ed5ab);}else{if(!(_0x4a4b6e instanceof $))throw _0x4a4b6e;this['_handleReconnectionError']();}}}}['destroy'](){const _0x425e20=this['editor']['plugins']['get'](n),_0x37b445=this['editor']['plugins']['get'](i);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x37b445['channelSessions']['has'](this['_channelId'])&&_0x37b445['unregister'](this['_channelId']),_0x425e20['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async['_handleReconnectionResponse'](_0x404eb8){if(this['sessionId']!==_0x404eb8['sessionId']&&this['_lastSyncedOperationId']!==_0x404eb8['lastOperationId'])throw new $();return this['sessionId']=_0x404eb8['sessionId'],this['_handleServerResponse']([],{..._0x404eb8,'wereChangesApplied':!0x1,'data':_0x404eb8['data']},'reconnect');}async['_connectService'](_0xd6957,_0x1e33c8=!0x1){const {connection:_0x54d5a5}=this['editor']['plugins']['get'](n);l['CollaborativeEditingService']['getConnectedSessions'](_0x54d5a5,this['_channelId'])['then'](_0x20a310=>this['_initSessionsHandling'](_0x20a310))['catch'](_0x4421a5=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x4421a5);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x5b21d9,_0x594f5f)=>{this['_crash']('realtimecollaborationclient-init-service-internal-error',_0x594f5f);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_isConnected']=!0x1;});const _0x55ba91=this['_operationIdentifier']['getIdOfTheLastOperation'](_0xd6957);this['_isPendingUpdate']=!0x0;const _0x5e2256=await this['_service']['connect'](_0x54d5a5,this['_compressOperations'](_0xd6957),_0x55ba91);if(this['sessionId']=_0x5e2256['sessionId'],_0x1e33c8){if(!_0x5e2256['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x5e2256['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0xd6957,_0x5e2256,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x5e2256,_0xd6957);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}['_handleSendingSelectionMarkers'](){const _0x531ece=this['editor']['plugins']['get'](i),_0x167b9a=this['editor']['plugins']['get'](H),_0x3ceaa3=_0x531ece['channelSessions']['get'](this['_channelId']);_0x3ceaa3&&_0x3ceaa3['length']>0x1?_0x167b9a['createUserMarkerOperations']():this['listenTo'](_0x531ece,'sessionAdd:'+this['_channelId'],()=>{0x2===_0x531ece['channelSessions']['get'](this['_channelId'])['length']&&_0x167b9a['createUserMarkerOperations']();});}async['_handleReceivedOperations'](_0x1db553,_0x3da764,_0x131320,_0x3ab4ee){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x3da764){const _0x2baeb7=this['_decompressOperations'](_0x131320,_0x3ab4ee);await this['_fetchMissingUsers'](_0x2baeb7),this['_handleExternalOperations'](_0x2baeb7,_0x3da764,_0x131320['lastOperationId'])||this['_crash']('realtimecollaborationclient-init-service-incorrect-server-operation');}}async['_connectAfterSessionHasBeenFlushed'](){this['_disconnectService']();const {locale:_0xeede45}=this['editor'];let _0x474aa5;try{_0x474aa5=await this['_service']['getDocumentDetails']();}catch{const _0x293a73=V(_0xeede45,'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'](_0x293a73);}const _0x39b0e6=_0x474aa5['currentDocumentSession']||_0x474aa5['lastDocumentSession'];if(this['_lastSyncedOperationId']!==_0x39b0e6['lastOperationId']){const _0x2dcfd0=V(_0xeede45,'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'](_0x2dcfd0);}await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);}['_disconnectService'](){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['stopListening'](this['_service']);}['_initSessionsHandling'](_0x26c04e){const _0x4b3280=this['editor']['plugins']['get'](i);this['listenTo'](_0x4b3280,'sessionAdd:'+this['_channelId'],(_0x5527c1,{session:_0x140074})=>{if(_0x140074['id']===_0x4b3280['mySessionId']){_0x5527c1['off']();const _0x1df2bb=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0xf8fb8c=_0x140074['permissions'];_0x1df2bb&&_0x1df2bb['isEnabled']&&(_0xf8fb8c=_0xf8fb8c['filter'](_0xe39846=>'document:write'!==_0xe39846)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0xf8fb8c,this['_channelId']);}}),_0x4b3280['register'](this['_channelId'],_0x26c04e);}['_initThrowingOnDataSet'](){const _0x1c9a9d=this['editor']['data']['set'];this['editor']['data']['set']=(..._0x347b5d)=>{if(!_0x347b5d[_0x347b5d['length']-0x1]['suppressErrorInCollaboration'])throw new _0x244de7('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x1c9a9d['apply'](this['editor']['data'],_0x347b5d);};}['_setUpDataInit'](){this['editor']['data']['on']('init',(_0xfef3d2,[_0x2e0880])=>{if(this['_document']['version'])throw new _0x244de7('realtimecollaborationclient-init-document-already-initialized',this);_0xfef3d2['stop'](),this['_setPendingAction']();const _0x3a9051=this['editor']['config']['get']('rootsAttributes'),_0x290dff=this['_getOperationsFromInitData'](_0x2e0880,_0x3a9051);0x0==_0x290dff['length']&&_0x290dff['push'](new _0xd5d778(0x0)),_0xfef3d2['return']=this['_connectService'](_0x290dff)['then'](()=>{this['editor']['plugins']['get'](n)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x5c9123=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x5c9123))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x48f44a,[_0x5b9f20,_0x3b8814])=>{_0x48f44a['stop']();const _0x511233=this['editor']['model']['document']['getRoot'](_0x5b9f20);if(!this['_knownRootNames']['has'](_0x5b9f20)){const _0x234428=_0x3b8814&&_0x3b8814['data']?_0x3b8814['data']:'',_0x4410b9=_0x3b8814&&_0x3b8814['attributes']?_0x3b8814['attributes']:{};await this['_loadRoot'](_0x5b9f20,_0x234428,_0x4410b9);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0x511233['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0x511233);});},{'priority':'high'});}async['_fetchMissingUsers'](_0x4b30f9){const _0x4454fa=this['editor']['plugins']['get'](_0x252144),{connection:_0x32c7d8}=this['editor']['plugins']['get'](n),_0xaf68bf=new Set();for(const _0x206154 of _0x4b30f9){const _0x59f8e0=_0x206154['_authorId'];_0x59f8e0&&!_0x4454fa['getUser'](_0x59f8e0)&&_0xaf68bf['add'](_0x59f8e0);}if(0x0===_0xaf68bf['size'])return;const _0x482e9c=await lt['getMany'](_0x32c7d8,Array['from'](_0xaf68bf));for(const _0x43e999 of _0x482e9c)_0x4454fa['getUser'](_0x43e999['id'])||_0x4454fa['addUser'](_0x43e999);}['_getOperationsFromInitData'](_0x379902,_0x24e17d={}){const _0x14bbdf=this['editor']['model'],_0xe1fe8d=[];let _0xbbd9be=0x0;const _0x6be06='string'==typeof _0x379902?{'main':_0x379902}:_0x379902;for(const _0x49ae3b of Object['keys'](_0x6be06)){if(!this['_document']['roots']['has'](_0x49ae3b))throw new _0x244de7('realtimecollaborationclient-init-non-existent-root',this);const _0x4b8818=this['editor']['data']['parse'](_0x6be06[_0x49ae3b]),_0x566eef=this['_document']['getRoot'](_0x49ae3b),_0x40ab58=new _0xf3c1f9(_0x14bbdf['createPositionAt'](_0x566eef,0x0),_0x4b8818,_0xbbd9be++);_0xe1fe8d['push'](_0x40ab58);for(const [_0x4af4f9,_0xa32433]of _0x4b8818['markers']){const _0x5d9216=_0x14bbdf['createRange'](_0x14bbdf['createPositionFromPath'](_0x566eef,_0xa32433['start']['path']['slice']()),_0x14bbdf['createPositionFromPath'](_0x566eef,_0xa32433['end']['path']['slice']())),_0x5e477a=new _0x3f5f19(_0x4af4f9,null,_0x5d9216,_0x14bbdf['markers'],!0x0,_0xbbd9be++);_0xe1fe8d['push'](_0x5e477a);}}if(_0x24e17d)for(const [_0x28175f,_0x2f4779]of Object['entries'](_0x24e17d)){const _0x524128=_0x14bbdf['document']['getRoot'](_0x28175f);if(!_0x524128)throw new _0x244de7('multi-root-editor-root-attributes-no-root',null);for(const [_0x21380f,_0x5bb5fb]of Object['entries'](_0x2f4779))if(null!==_0x5bb5fb){const _0x1814ad=new _0x4dba5a(_0x524128,_0x21380f,null,_0x5bb5fb,_0xbbd9be++);_0xe1fe8d['push'](_0x1814ad);}}return _0xe1fe8d;}async['_loadRoot'](_0x31e1ab,_0x46be90,_0x385c38){this['_getOperationsFromInitData']({[_0x31e1ab]:_0x46be90},{[_0x31e1ab]:_0x385c38})['forEach']((_0x355ad2,_0x272d6e)=>{_0x355ad2['baseVersion']=this['_document']['version']+_0x272d6e,_0x355ad2['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x355ad2);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async['_handleInitialConnectionData'](_0x474a61,_0x4c92a0){let _0x4be9f9;this['_offset']=_0x474a61['offset'];const _0x3b5203=_0x474a61['wereChangesApplied']&&!_0x474a61['initData'],_0x25d175=_0x3b5203?0x0:_0x474a61['data']['baseVersion'];if(_0x4c92a0['forEach'](_0x187715=>{_0x187715['_isInit']=!0x0,_0x187715['createdAt']=_0x474a61['sessionCreatedAt'],_0x187715['_authorId']=null;}),_0x3b5203)_0x4be9f9=_0x4c92a0,this['_applyOperationsSet'](_0x4be9f9,_0x3b5203);else{if(_0x474a61['initData']){const _0x5a25d3=this['_getOperationsFromInitData'](_0x474a61['initData']);this['_document']['history']['version']=-_0x5a25d3['length'],_0x5a25d3['forEach'](_0xcab0f5=>{_0xcab0f5['baseVersion']-=_0x5a25d3['length'],_0xcab0f5['createdAt']=_0x474a61['sessionCreatedAt'],_0xcab0f5['_isInit']=!0x0,_0xcab0f5['_authorId']=null;}),this['_applyOperationsSet'](_0x5a25d3,!0x0),this['serverHistory']['version']=-_0x5a25d3['length']+this['_offset'],this['_updateServerHistory'](_0x5a25d3);}this['_document']['history']['version']=_0x25d175,_0x4be9f9=this['_decompressOperations'](_0x474a61['data'],_0x474a61['metadata']),await this['_fetchMissingUsers'](_0x4be9f9),this['_applyOperationsSet'](_0x4be9f9,_0x3b5203);}_0x474a61['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x4be9f9,_0x474a61['lastOperationId']),this['_lastSyncedOperationId']=_0x474a61['lastOperationId']),this['serverHistory']['version']=_0x25d175+this['_offset'],this['_updateServerHistory'](_0x4be9f9),_0x4c92a0['filter'](_0x181a1c=>{const _0x16810a=this['_getAffectedRoot'](_0x181a1c);return _0x16810a&&!this['_knownRootNames']['has'](_0x16810a);})['forEach']((_0x6e0af5,_0x5336ce)=>{_0x6e0af5['baseVersion']=this['_document']['version']+_0x5336ce,this['_saveOperationInBuffer'](_0x6e0af5);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0xa01f6b,_0x2d262f){const _0x2d7a56=_0x2d262f&&_0x2d262f['message'];if(_0x2d7a56&&_0x2d7a56['startsWith']('realtimecollaborationclient'))throw _0x2d262f;const _0x2d50ce=this['editor']['plugins']['get'](n);throw this['_isPendingUpdate']=!0x0,_0x2d50ce['disconnect'](),this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0x244de7(_0xa01f6b,this['editor'],_0x2d7a56?{'originalError':_0x2d7a56}:void 0x0);}['_saveOperationInBuffer'](_0xf3c2b9){this['_knownOperations']['has'](_0xf3c2b9)||(this['_knownOperations']['add'](_0xf3c2b9),this['_bufferedOperations']['push'](_0xf3c2b9),this['_pendingAction']||'marker'==_0xf3c2b9['type']&&!_0xf3c2b9['affectsData']||this['_setPendingAction']());}['_sendBufferedOperationsDelayed'](_0x45089b=!0x1){!_0x45089b&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0x6f5b40=>{_0x6f5b40&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0x5d55c7=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0x1868a0){return _0x1868a0['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x1868a0['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0x1868a0['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0x5d55c7)||this['_crash'](_0x5d55c7['message'],_0x5d55c7);});},this['_currentBufferDelay']));}['_waitUntilSynced'](){return new Promise(_0x1ebe7c=>{this['on']('change:_isPendingUpdate',()=>{_0x1ebe7c();});});}async['_sendBufferedOperations'](){const _0x754589=this['editor']['plugins']['get'](H);if(this['_shouldSendSelectionUpdate']()&&(_0x754589['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x11687a=[...this['_bufferedOperations']];for(const _0xf87ade of _0x11687a)_0xf87ade['wasUndone']=this['_document']['history']['isUndoneOperation'](_0xf87ade);const _0x11cb80=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x11687a),_0x4669d7=G++,_0x2c6bb3=this['_compressOperations'](_0x11687a),_0x51badb=await this['_service']['sendOperations'](_0x2c6bb3,_0x2c6bb3['baseVersion'],_0x11cb80);try{return await this['_handleServerResponse'](_0x11687a,_0x51badb,_0x4669d7);}catch(_0x1a6be1){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0x1a6be1);}}async['_handleServerResponse'](_0x1a17f1,_0x19fc0c,_0x2797c0){if('error'in _0x19fc0c)throw _0x19fc0c['error'];let _0x357892=!0x1;if(_0x19fc0c['wereChangesApplied']){_0x19fc0c['lastOperationId']&&(this['_lastSyncedOperationId']=_0x19fc0c['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x5dd40c=>!_0x1a17f1['includes'](_0x5dd40c));for(const _0x5b3988 of _0x1a17f1)_0x5b3988['createdAt']='lastOperationAcceptedAt'in _0x19fc0c&&_0x19fc0c['lastOperationAcceptedAt']||void 0x0;K(_0x1a17f1,_0x19fc0c['version']-_0x1a17f1['length']),this['_updateServerHistory'](_0x1a17f1);const _0x221851=_0x1a17f1['filter'](_0x2d4e6b=>{if(!_0x2d4e6b['_isInit'])return!0x1;const _0x45040c=this['_getAffectedRoot'](_0x2d4e6b);return _0x45040c&&!this['_knownRootNames']['has'](_0x45040c);});K(_0x221851,this['_document']['version']),this['_applyOperationsSet'](_0x221851),_0x357892=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0x3a28bb=this['_decompressOperations'](_0x19fc0c['data'],_0x19fc0c['metadata'])['filter'](_0x5f0ad0=>_0x5f0ad0['baseVersion']>=this['_lastServerVersion']);_0x3a28bb['forEach'](_0x44ccce=>this['_addKnownRoot'](_0x44ccce)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x595121=>!_0x595121['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x595121))),this['_bufferedOperations']['length']&&K(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0x3a28bb),_0x357892=this['_handleExternalOperations'](_0x3a28bb,_0x19fc0c['version'],_0x19fc0c['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x357892?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}['_handleExternalOperations'](_0x45e11e,_0x59cc4f,_0x8c7464){try{const _0x317a8a={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x47436b,operationsB:_0x2f6d24,originalOperations:_0x3d81db}=_0x538a47(_0x45e11e,this['_bufferedOperations'],_0x317a8a);K(_0x47436b,this['_document']['version']),K(_0x2f6d24,_0x59cc4f);for(const _0x2e8497 of _0x47436b){const _0x167ab7=_0x3d81db['get'](_0x2e8497);_0x2e8497['_authorId']=_0x167ab7?_0x167ab7['_authorId']:null;}_0x8c7464&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x45e11e,_0x8c7464),this['_lastSyncedOperationId']=_0x8c7464),this['_bufferedOperations']=[..._0x2f6d24],this['_applyOperationsSet'](_0x47436b),this['_updateServerHistory'](_0x45e11e);}catch(_0x2d7e74){return console['error'](_0x2d7e74),!0x1;}return!0x0;}['_applyOperationsSet'](_0x583f12,_0x5f0282=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0x1fc17e=>{for(const _0x4bf4b8 of _0x583f12)this['_knownOperations']['add'](_0x4bf4b8),this['_addKnownRoot'](_0x4bf4b8),_0x1fc17e['batch']['addOperation'](_0x4bf4b8),this['editor']['model']['applyOperation'](_0x4bf4b8);});}['_addKnownRoot'](_0x5def0d){const _0x2fa61a=this['_getAffectedRoot'](_0x5def0d);_0x2fa61a&&this['_knownRootNames']['add'](_0x2fa61a);}['_getAffectedRoot'](_0x215216){let _0x53ab46,_0x73ea97;switch(_0x215216['type']){case'insert':_0x53ab46=_0x215216['position']['root'];break;case'marker':if(_0x73ea97=_0x215216['newRange'],!_0x73ea97)return null;_0x53ab46=_0x73ea97['root'];break;case'addRootAttribute':_0x53ab46=_0x215216['root'];break;case'addRoot':_0x53ab46=_0x215216['affectedSelectable'];break;case'move':_0x53ab46=_0x215216['targetPosition']['root'];break;default:return null;}return _0x53ab46['rootName'];}['_updateServerHistory'](_0x268da2){_0x268da2['forEach'](_0x42daad=>{const _0x401295=_0x42daad['clone']();_0x401295['_authorId']=_0x42daad['_authorId'],_0x401295['_isInit']=!!_0x42daad['_isInit'],_0x401295['createdAt']=_0x42daad['createdAt'],_0x401295['baseVersion']+=this['_offset'],_0x42daad['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x401295),this['serverHistory']['addOperation'](_0x401295);});}['_handleReconnectionError'](_0x3a8955){const _0x5d7b4a=this['editor']['plugins']['get']('Notification'),_0x5b6b4a=this['editor']['locale'];_0x3a8955||(_0x3a8955=V(_0x5b6b4a,'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.')),_0x5d7b4a['showWarning'](_0x3a8955,{'title':V(_0x5b6b4a,'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'](_0x196d77)['add'](V(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}['_clearPendingAction'](){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x196d77)['remove'](this['_pendingAction']),this['_pendingAction']=null);}['_compressOperations'](_0x50530f){const _0x5b7c58=_0x50530f['map'](_0xcafc6d=>_0xcafc6d['toJSON']());return this['_compressor']['compress'](_0x5b7c58);}['_decompressOperations'](_0x21170d,_0x5b9f89){return this['_compressor']['decompress'](_0x21170d)['map']((_0xf1c9e2,_0x27ce27)=>{const _0x3180a7='init'==_0x5b9f89[_0x27ce27]['type'];if('InsertOperation'==_0xf1c9e2['__className']){const _0x237236=_0xf1c9e2['position']['root'];!this['_document']['getRoot'](_0x237236)&&(this['_document']['createRoot']('$root',_0x237236)['_isAttached']=!0x1);}const _0x5f12aa=_0x565f60['fromJSON'](_0xf1c9e2,this['_document']);return _0x5f12aa['wasUndone']=_0xf1c9e2['wasUndone'],_0x5f12aa['_isInit']=_0x3180a7,_0x5f12aa['_authorId']=_0x3180a7?null:_0x5b9f89[_0x27ce27]['userId'],_0x5f12aa['_isDisconnection']='cs:removeUser'===_0x5b9f89[_0x27ce27]['type'],_0x5f12aa['createdAt']=_0x5b9f89[_0x27ce27]['createdAt'],_0x5f12aa;});}['_refreshUserSelectionMarkers'](){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}['_shouldSendSelectionUpdate'](){const _0x5bbbe2=this['editor']['plugins']['get'](i)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0x5bbbe2&&_0x5bbbe2['length']>0x1&&this['_hasSelectionChanged'];}['_shouldSendUpdate'](){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}}class $ extends Error{}function K(_0x9432d5,_0x108c47){for(const _0x37755d of _0x9432d5)_0x37755d['baseVersion']=_0x108c47++;}class J{['_ignoredOperations'];['_operationToId'];constructor(_0x3a5067){this['_ignoredOperations']=_0x3a5067,this['_operationToId']=new WeakMap();}['getIdOfTheLastOperation'](_0x398e0f){let _0x5a28c4=_0x398e0f['length'];for(;_0x5a28c4--;){const _0x4245ca=_0x398e0f[_0x5a28c4];if(!this['_ignoredOperations']['has'](_0x4245ca)){if(!this['_operationToId']['has'](_0x4245ca)){const _0x2611e5=_0x2b2daf()['slice'](0x1,0x12);this['_operationToId']['set'](_0x4245ca,_0x2611e5);}return this['_operationToId']['get'](_0x4245ca);}}}['setIdForTheLastOperation'](_0x395976,_0x2055a9){if(!_0x2055a9)return;let _0x227c96=_0x395976['length'];for(;_0x227c96--;){const _0x28cade=_0x395976[_0x227c96];this['_ignoredOperations']['has'](_0x28cade)||this['_operationToId']['set'](_0x28cade,_0x2055a9);}}}class a extends _0x43cb95{static get['requires'](){return[l];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class s extends _0x257d3e{static ['CommentsService']=/* #__PURE__ -- @preserve */
|
|
26
|
-
((()=>_0x1f5c88)());['_services'];static get['requires'](){return[n,'CommentsRepository',i,_0x252144];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x57b873){super(_0x57b873),this['_services']=new Map();}async['init'](){const _0x4cf185=this['context'],_0x2dc388=_0x4cf185['plugins']['get']('CommentsRepository');if(_0x4cf185['plugins']['get'](n)['addToReconnectionStack'](this),_0x2dc388['adapter']={'addCommentThread':async({channelId:_0x498123,threadId:_0x55122e,comments:_0xac828c,resolvedAt:_0xf147e9,resolvedBy:_0x41c7a6,context:_0x230816,attributes:_0x1e24d5})=>{const _0x78b9c0=await this['_getService'](_0x498123)['addCommentThread']({'commentThreadId':_0x55122e,'comments':_0xac828c['map'](_0x19bcab=>function(_0x30faf8,_0x119e95,_0x538ebf){return{'commentThreadId':_0x538ebf,'commentId':_0x30faf8['commentId'],'userId':_0x30faf8['authorId'],'content':_0x30faf8['content'],'documentId':_0x119e95,'createdAt':_0x30faf8['createdAt'],'attributes':_0x30faf8['attributes']||{}};}(_0x19bcab,_0x498123,_0x55122e)),'resolvedAt':_0xf147e9,'resolvedBy':_0x41c7a6,'context':_0x230816,'attributes':_0x1e24d5})['catch'](dt);return{'threadId':_0x78b9c0['commentThreadId'],'comments':_0x78b9c0['comments']};},'getCommentThread':async({channelId:_0x5e9ec6,threadId:_0x1ac0ce})=>{const _0x3d1d70=await this['_getService'](_0x5e9ec6)['getCommentThread'](_0x1ac0ce)['catch'](F)['catch'](dt);return _0x3d1d70?_0x3d1d70['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0x3d1d70]),{'threadId':_0x3d1d70['commentThreadId'],'comments':_0x3d1d70['comments']['map'](B),'context':_0x3d1d70['context'],'resolvedAt':_0x3d1d70['resolvedAt'],'resolvedBy':_0x3d1d70['resolvedBy'],'attributes':_0x3d1d70['attributes']||{}}):null;},'updateCommentThread':async({channelId:_0x1cf67a,threadId:_0x403b6d,context:_0x3d1458,unlinkedAt:_0x56e433,attributes:_0x543e84})=>this['_getService'](_0x1cf67a)['updateCommentThread']({'commentThreadId':_0x403b6d,'context':_0x3d1458,'attributes':_0x543e84,'unlinkedAt':_0x56e433})['catch'](F)['catch'](dt),'resolveCommentThread':async({channelId:_0x3ac471,threadId:_0x13d68b})=>{const _0x4eda22=await this['_getService'](_0x3ac471)['resolveCommentThread'](_0x13d68b)['catch'](F)['catch'](dt);return{'threadId':_0x4eda22['commentThreadId'],'resolvedAt':_0x4eda22['resolvedAt'],'resolvedBy':_0x4eda22['resolvedBy']};},'reopenCommentThread':async({channelId:_0x5cd4ad,threadId:_0x2afef9})=>this['_getService'](_0x5cd4ad)['reopenCommentThread'](_0x2afef9)['catch'](F)['catch'](dt),'removeCommentThread':({channelId:_0x4383a8,threadId:_0x1122c9})=>this['_getService'](_0x4383a8)['removeCommentThread'](_0x1122c9)['catch'](F)['catch'](dt),'addComment':({channelId:_0x173d5d,threadId:_0xa53d21,commentId:_0x2b6912,content:_0x153c73,attributes:_0x832f49})=>this['_getService'](_0x173d5d)['addComment'](_0xa53d21,_0x2b6912,_0x153c73,_0x832f49)['catch'](dt),'updateComment':({channelId:_0xcd1a96,threadId:_0x117e91,commentId:_0x3bcb54,content:_0x5c29cd,attributes:_0x53cde8})=>this['_getService'](_0xcd1a96)['updateComment'](_0x117e91,_0x3bcb54,_0x5c29cd,_0x53cde8)['catch'](F)['catch'](dt),'removeComment':({channelId:_0x2df491,threadId:_0xdc9cf5,commentId:_0x5d4160})=>this['_getService'](_0x2df491)['removeComment'](_0xdc9cf5,_0x5d4160)['catch'](F)['catch'](dt)},_0x4cf185 instanceof _0xfb0d13){const _0x302991=_0x4cf185['config']['get']('collaboration.channelId'),_0x259123=_0x4cf185['plugins']['get'](i);await this['_setUpService'](_0x302991);const _0x5a21a6=await this['_services']['get'](_0x302991)['getConnectedSessions']();this['listenTo'](_0x259123,'sessionAdd:'+_0x302991,(_0x8e5600,{session:_0x4afeb7})=>{_0x4afeb7['id']===_0x259123['mySessionId']&&(_0x8e5600['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x4afeb7['permissions'],_0x302991));}),_0x259123['register'](_0x302991,_0x5a21a6);}}async['_setUpService'](_0x15c9df){if(this['_services']['has'](_0x15c9df))throw new _0x244de7('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0x15c9df});const _0x2053e9=this['context']['plugins']['get']('CommentsRepository'),_0x1825e3=new s['CommentsService'](_0x15c9df);this['_services']['set'](_0x15c9df,_0x1825e3),this['listenTo'](_0x1825e3,'commentThreadAdded',(_0x3452e3,_0x42a6fd)=>{const {commentThreadId:_0x322504,documentId:_0x53898b,context:_0x246db9,attributes:_0x8ad608,resolvedAt:_0x3b814f,resolvedBy:_0x2da162,comments:_0x240508}=_0x42a6fd;_0x2053e9['getCommentThread'](_0x322504)||_0x2053e9['addCommentThread']({'threadId':_0x322504,'channelId':_0x53898b,'comments':_0x240508?_0x240508['map'](B):[],'context':_0x246db9,'attributes':_0x8ad608,'resolvedAt':_0x3b814f,'resolvedBy':_0x2da162,'isFromAdapter':!0x0});}),this['listenTo'](_0x1825e3,'commentThreadUpdated',(_0x40d923,{commentThreadId:_0x3b4bdd,documentId:_0x1627d9,context:_0x5641fa,unlinkedAt:_0x44b38c,attributes:_0x4a7bab})=>{_0x2053e9['getCommentThread'](_0x3b4bdd)&&_0x2053e9['updateCommentThread']({'threadId':_0x3b4bdd,'channelId':_0x1627d9,'context':_0x5641fa,'unlinkedAt':_0x44b38c,'attributes':_0x4a7bab,'isFromAdapter':!0x0});}),this['listenTo'](_0x1825e3,'commentThreadResolved',(_0x407ecd,{commentThreadId:_0x1f2cba,resolvedBy:_0x11fe7b,resolvedAt:_0x313c61})=>{const _0x443f2c=_0x2053e9['getCommentThread'](_0x1f2cba);_0x443f2c&&_0x443f2c['resolve']({'resolvedBy':_0x11fe7b,'resolvedAt':_0x313c61,'isFromAdapter':!0x0});}),this['listenTo'](_0x1825e3,'commentThreadReopened',(_0x226912,{commentThreadId:_0x20333a})=>{const _0x3452e6=_0x2053e9['getCommentThread'](_0x20333a);_0x3452e6&&_0x3452e6['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0x1825e3,'commentThreadRemoved',(_0x3b965a,{commentThreadId:_0x4f1424})=>{const _0x3cae78=_0x2053e9['getCommentThread'](_0x4f1424);_0x3cae78&&_0x3cae78['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0x1825e3,'commentAdded',(_0x82fdd,_0x4278ac)=>{const _0x53745c=_0x4278ac['commentThreadId'],_0x12e045=_0x2053e9['getCommentThread'](_0x53745c);_0x12e045&&_0x12e045['addComment']({...B(_0x4278ac),'isFromAdapter':!0x0});}),this['listenTo'](_0x1825e3,'commentUpdated',(_0x5b1de4,{commentThreadId:_0x111179,commentId:_0x1ccf38,content:_0x12a9ef,attributes:_0x17ef90})=>{const _0xbdc69a=_0x2053e9['getCommentThread'](_0x111179);if(_0xbdc69a){const _0x61105=_0xbdc69a['getComment'](_0x1ccf38);_0x61105&&_0x61105['update']({'content':_0x12a9ef,'attributes':_0x17ef90,'isFromAdapter':!0x0});}}),this['listenTo'](_0x1825e3,'commentRemoved',(_0xcb492f,{commentThreadId:_0x3b2e33,commentId:_0x3030db})=>{const _0x14d67b=_0x2053e9['getCommentThread'](_0x3b2e33);if(_0x14d67b){const _0x1ad89e=_0x14d67b['getComment'](_0x3030db);_0x1ad89e&&_0x1ad89e['remove']({'isFromAdapter':!0x0});}}),await this['_connectService'](_0x15c9df);}['destroy'](){if(this['context']instanceof _0xfb0d13){const _0x15cbfd=this['context']['config']['get']('collaboration.channelId');this['_terminateService'](_0x15cbfd);}}['_terminateService'](_0x3d52d4){if(!this['_services']['has'](_0x3d52d4))throw new _0x244de7('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0x3d52d4});this['_getService'](_0x3d52d4)['disconnect'](),this['_services']['delete'](_0x3d52d4);}async['reconnect'](){for(const _0x5aae4d of this['_services']['keys']())await this['_connectService'](_0x5aae4d);if(this['context']instanceof _0xfb0d13){const _0x3e4d45=this['context']['config']['get']('collaboration.channelId'),_0x24a190=this['context']['plugins']['get'](i);_0x24a190['unregister'](_0x3e4d45);const _0x36ca94=await this['_services']['get'](_0x3e4d45)['getConnectedSessions']();_0x24a190['register'](_0x3e4d45,_0x36ca94);}}async['_connectService'](_0x49b08c){const {connection:_0x55543a}=this['context']['plugins']['get'](n),_0x32b323=this['context']['plugins']['get']('CommentsRepository'),_0x2b7d5b=this['_services']['get'](_0x49b08c),_0xf52a4c=await _0x2b7d5b['connect'](_0x55543a);await this['_fetchMissingUsersForThreads'](_0xf52a4c);const _0x55f821=new Set(Array['from'](_0x32b323['getCommentThreads']({'channelId':_0x49b08c}),_0x577200=>_0x577200['id']));for(const _0x7f30af of _0xf52a4c)_0x7f30af['deletedAt']||_0x55f821['delete'](_0x7f30af['commentThreadId']);for(const _0x38f4c2 of _0x55f821)_0x32b323['getCommentThread'](_0x38f4c2)['remove']({'isFromAdapter':!0x0});for(const _0x52ea8d of _0xf52a4c){let _0x3eb69b=_0x32b323['getCommentThread'](_0x52ea8d['commentThreadId']);const {commentThreadId:_0x346416,context:_0x1e553d,attributes:_0x43cac1,resolvedBy:_0x53eb54,resolvedAt:_0x2d8ab8,unlinkedAt:_0xcc6dc8,deletedAt:_0xd75f7}=_0x52ea8d;if(_0xd75f7)continue;_0x3eb69b||(_0x3eb69b=_0x32b323['addCommentThread']({'channelId':_0x49b08c,'threadId':_0x346416,'context':_0x1e553d,'attributes':_0x43cac1||{},'resolvedBy':_0x53eb54,'resolvedAt':_0x2d8ab8,'unlinkedAt':_0xcc6dc8,'isFromAdapter':!0x0}));const _0xe43b0a=new Set(Array['from'](_0x3eb69b['comments'],_0x2e3aea=>_0x2e3aea['id']));for(const _0x3f14a6 of _0x52ea8d['comments'])_0xe43b0a['delete'](_0x3f14a6['commentId']);for(const _0x20e08b of _0xe43b0a)_0x3eb69b['getComment'](_0x20e08b)['remove']({'isFromAdapter':!0x0});for(const _0x18351f of _0x52ea8d['comments']){const _0x52b538=_0x3eb69b['getComment'](_0x18351f['commentId']);_0x52b538?_0x52b538['content']!==_0x18351f['content']&&_0x52b538['update']({'content':_0x18351f['content'],'isFromAdapter':!0x0}):_0x3eb69b['addComment'](Object['assign'](B(_0x18351f),{'isFromAdapter':!0x0}));}}}['_getService'](_0x19bb3b){if(!this['_services']['has'](_0x19bb3b))throw new _0x244de7('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0x19bb3b});return this['_services']['get'](_0x19bb3b);}async['_fetchMissingUsersForThreads'](_0x5e879a){const _0x368e20=this['context']['plugins']['get'](_0x252144),{connection:_0x157a2a}=this['context']['plugins']['get'](n),_0x3aa6cf=new Set();for(const {resolvedBy:_0x115ebf,comments:_0x1f3bc3}of _0x5e879a){_0x115ebf&&!_0x368e20['getUser'](_0x115ebf)&&_0x3aa6cf['add'](_0x115ebf);for(const {userId:_0x6c349d}of _0x1f3bc3)_0x368e20['getUser'](_0x6c349d)||_0x3aa6cf['add'](_0x6c349d);}if(0x0===_0x3aa6cf['size'])return;const _0x1ac126=await lt['getMany'](_0x157a2a,Array['from'](_0x3aa6cf));for(const _0x3ccdd5 of _0x1ac126)_0x368e20['getUser'](_0x3ccdd5['id'])||_0x368e20['addUser'](_0x3ccdd5);}}async function F(_0x9cf079){if('404'!==_0x9cf079['code'])throw _0x9cf079;}function dt(_0x2b3324){if((_0x16731d=_0x2b3324)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0x16731d['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x16731d['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0x16731d;throw _0x2b3324;}function B(_0x39357e){return{'threadId':_0x39357e['commentThreadId'],'commentId':_0x39357e['commentId'],'content':_0x39357e['content'],'createdAt':_0x39357e['createdAt'],'authorId':_0x39357e['userId'],'attributes':_0x39357e['attributes']||{}};}class m extends _0x43cb95{static ['TrackChangesService']=/* #__PURE__ -- @preserve */
|
|
27
|
-
((()=>
|
|
28
|
-
((()=>it)());['_lastRequestId'];['_revisionTracker'];['_revisionHistoryService'];['_oldOffset'];static get['requires'](){return[n,l,'RevisionHistory',i,_0x252144];}static get['pluginName'](){return'CloudServicesRevisionHistoryAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x25e284){super(_0x25e284);const _0x5c7049=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new c['RevisionHistoryService'](_0x5c7049);}async['init'](){const _0x15aef9=this['editor']['plugins']['get'](l),_0x13aa72=_0x15aef9['serverHistory'],_0x4efc53=this['editor']['plugins']['get'](n);this['_revisionTracker']['setSource']({'history':_0x13aa72,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0x15aef9['sessionId']});const _0x199515=this['editor']['config']['get']('cloudServices.bundleVersion')||nt,_0x20fe1f=await tt['isBundleUploaded'](_0x4efc53['connection'],_0x199515);this['editor']['plugins']['get']('RevisionHistory')['adapter']={'getRevision':async({revisionId:_0x59e76d})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0x59e76d)),'updateRevisions':async _0x39203f=>{await this['_waitForServiceReady']();const _0x38bbfb=this['_revisionTracker']['currentRevision'];if(_0x20fe1f&&0x1===_0x39203f['length']&&_0x39203f[0x0]['id']===_0x38bbfb['id'])return _0x39203f;for(const _0x1af34a of _0x39203f)_0x1af34a['id']===_0x38bbfb['id']&&(_0x1af34a['isEmptyCurrent']=_0x1af34a['fromVersion']===_0x1af34a['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0x39203f,this['_lastRequestId'])['then'](_0x52574b=>(this['_lastRequestId']=_0x52574b,_0x39203f))['catch'](_0x4b4c54=>{if(st(_0x4b4c54)||'400'===_0x4b4c54['code']&&void 0x0!==_0x4b4c54['data']['wrongRequestId']){for(const _0xd7fda7 of _0x39203f){!this['_revisionTracker']['repository']['getRevision'](_0xd7fda7['id'])||this['_revisionTracker']['_bufferUpdate'](_0xd7fda7['id'],_0xd7fda7,!0x1);}if(st(_0x4b4c54))throw _0x4b4c54;return _0x39203f;}throw _0x4b4c54;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0x180082,{revisionsData:_0x43315a,requestId:_0x4137e3})=>{Math['max'](..._0x43315a['map'](_0x1e27a9=>_0x1e27a9['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0x43315a,_0x4137e3);}):this['_handleRevisionsUpdate'](_0x43315a,_0x4137e3);});const {revisions:_0x183ce9,requestId:_0x2c9049}=await this['_revisionHistoryService']['connect'](_0x4efc53['connection']);_0x4efc53['addToReconnectionStack'](this),this['_lastRequestId']=_0x2c9049,await this['_fetchMissingUsers'](_0x183ce9);for(const _0x2ecf3a of _0x183ce9)this['_revisionTracker']['addRevisionData'](_0x2ecf3a);this['listenTo'](_0x15aef9,'change:_isConnected',(_0x3bdf98,_0x49926e,_0x39359e)=>{_0x39359e&&(this['_oldOffset']=_0x15aef9['_offset'],_0x3bdf98['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](_0x4efc53,'state',_0x47df91=>_0x47df91===te['CONNECTED']);}async['reconnect'](){const _0x25cdb9=this['editor']['plugins']['get'](n),_0x38023f=this['editor']['plugins']['get'](l),_0x2c9d70=async()=>{const _0x1310af=this['_revisionTracker']['currentRevision'],_0x4030e1=_0x1310af['id'],_0x46c5ad=_0x4030e1!==_0x38023f['sessionId'];if(_0x46c5ad){const _0x126c04=_0x38023f['_offset']-this['_oldOffset'],_0x116658=this['_getLatestVersionFromServerOperations']();this['_revisionTracker']['_revisionDataBuilder']['reInit']();if(_0x1310af['toVersion']+_0x126c04!==_0x116658){const _0xa17db8=_0x1310af['fromVersion']+_0x126c04,_0x2bc7cc=this['editor']['plugins']['get'](_0x252144),_0x1d41d7=this['_revisionTracker']['buildRevisionData']({'revision':_0x1310af,'from':_0xa17db8,'to':_0x116658});_0x1d41d7['id']=_0x1310af['id'];const _0xeed2d8=_0x1d41d7['authorsIds']['map'](_0x42193d=>_0x2bc7cc['getUser'](_0x42193d));_0x1310af['_update']({..._0x1d41d7,'authors':_0xeed2d8},!0x0),this['_revisionTracker']['_bufferUpdate'](_0x1310af['id'],_0x1d41d7,!0x0);}this['_revisionTracker']['_startingVersion']=_0x116658,(_0x1310af['toVersion']===_0x1310af['fromVersion']&&!this['_revisionTracker']['_bufferedUpdates']['has'](_0x4030e1)&&this['_revisionTracker']['repository']['_revisions']['remove'](_0x4030e1),this['_revisionTracker']['_createCurrentRevision'](_0x116658));}const {revisions:_0x140ecf,requestId:_0x58a48e}=await this['_revisionHistoryService']['reconnect'](_0x25cdb9['connection'],this['_lastRequestId']);_0x46c5ad&&_0x140ecf['length']>0x0?_0x38023f['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x140ecf),this['_handleRevisionsUpdate'](_0x140ecf,_0x58a48e),this['_revisionTracker']['sendBufferedUpdates']());};return _0x38023f['_isConnected']?_0x2c9d70():new Promise((_0x140638,_0x5317e5)=>{_0x38023f['once']('change:_isConnected',()=>{_0x2c9d70()['then'](_0x140638)['catch'](_0x5317e5);});});}['destroy'](){super['destroy']();}async['_waitForServiceReady'](){this['_revisionHistoryService']['isConnected']||await new Promise(_0x32b0ea=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x3fb864=>{_0x3fb864['off'](),_0x32b0ea();});});}['_getLatestVersionFromServerOperations'](){const _0x2bb9d1=this['editor']['plugins']['get'](l)['serverHistory']['getOperations']()['reverse']();for(const _0x1cb45e of _0x2bb9d1)if('marker'!==_0x1cb45e['type']||_0x1cb45e['affectsData'])return _0x1cb45e['baseVersion']+0x1;}['_getLatestVersion'](){const _0x34e54a=this['editor']['plugins']['get'](l);return new Promise(_0x5473ad=>{_0x34e54a['_isPendingUpdate']?_0x34e54a['once']('change:_isPendingUpdate',()=>{_0x5473ad(this['_getLatestVersionFromServerOperations']());}):_0x5473ad(this['_getLatestVersionFromServerOperations']());});}['_handleRevisionsUpdate'](_0x4e23ea,_0xac9e3e){const _0x3636c6=this['_revisionTracker']['repository'];this['_lastRequestId']=_0xac9e3e;for(const _0x49326f of _0x4e23ea){const _0x4e2ffb=_0x3636c6['getRevision'](_0x49326f['id']);if(_0x4e2ffb){if((_0x49326f['fromVersion']||_0x49326f['toVersion'])&&(_0x49326f['diffData']=null),_0x4e2ffb===this['_revisionTracker']['currentRevision']){const _0x2b3afb=Math['max'](_0x4e2ffb['toVersion'],_0x49326f['toVersion']),_0x5ce69e=Math['max'](_0x4e2ffb['fromVersion'],_0x49326f['fromVersion']);let _0x4c6663;_0x4e2ffb['toVersion']===_0x49326f['toVersion']&&_0x4e2ffb['fromVersion']===_0x49326f['fromVersion']?(_0x4c6663=!0x0,this['_preventResendingRevisionData'](_0x49326f)):_0x49326f['toVersion']===_0x2b3afb&&_0x49326f['fromVersion']===_0x5ce69e?_0x4c6663=!0x1:(_0x4e2ffb['toVersion']===_0x2b3afb&&_0x4e2ffb['fromVersion']===_0x5ce69e||this['_fixRevision']({'revision':_0x4e2ffb,'from':_0x5ce69e,'to':_0x2b3afb}),_0x4c6663=!0x0),_0x4c6663&&(delete _0x49326f['fromVersion'],delete _0x49326f['toVersion'],delete _0x49326f['diffData'],delete _0x49326f['createdAt'],delete _0x49326f['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0x49326f),this['_preventResendingRevisionData'](_0x49326f);}else this['_revisionTracker']['addRevisionData'](_0x49326f);}const _0x19591e=_0x3636c6['getRevisions']();_0x19591e['reverse']();for(let _0x4533f4=0x0;_0x4533f4<_0x19591e['length']-0x1;_0x4533f4++){const _0x26240d=_0x19591e[_0x4533f4],_0x4be9ef=_0x19591e[_0x4533f4+0x1];if(_0x26240d['fromVersion']<_0x4be9ef['toVersion']){const _0x1b4fe2=_0x4be9ef['toVersion'],_0x418094=Math['max'](_0x1b4fe2,_0x26240d['toVersion']);this['_fixRevision']({'revision':_0x26240d,'from':_0x1b4fe2,'to':_0x418094});}}}['_fixRevision']({revision:_0x444f7f,from:_0x275839,to:_0x3854c5}={}){const _0x38655d=this['editor']['plugins']['get'](_0x252144),_0x188aea=this['_revisionTracker']['buildRevisionData']({'revision':_0x444f7f,'from':_0x275839,'to':_0x3854c5});_0x188aea['authors']=_0x188aea['authorsIds']['map'](_0x16c0f1=>_0x38655d['getUser'](_0x16c0f1)),_0x444f7f['_update'](_0x188aea);}['_preventResendingRevisionData'](_0x23a04f){const _0x310b3f={};_0x310b3f['id']=_0x23a04f['id'];for(const _0xa45032 of Object['keys'](_0x23a04f))'id'!==_0xa45032&&(_0x310b3f[_0xa45032]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0x310b3f['id'],_0x310b3f,!0x0);}async['_fetchMissingUsers'](_0x48d9cd){const _0x2b22fa=this['editor']['plugins']['get'](_0x252144),{connection:_0x487a85}=this['editor']['plugins']['get'](n),_0xdd95a6=new Set();for(const _0x144449 of _0x48d9cd){for(const _0x48f9d2 of _0x144449['authorsIds'])_0x428b33(_0x48f9d2);_0x144449['creatorId']&&_0x428b33(_0x144449['creatorId']);}if(0x0===_0xdd95a6['size'])return;const _0x48edb6=await lt['getMany'](_0x487a85,Array['from'](_0xdd95a6));for(const _0x52ae35 of _0x48edb6)_0x2b22fa['getUser'](_0x52ae35['id'])||_0x2b22fa['addUser'](_0x52ae35);function _0x428b33(_0x4a9cb7){_0x2b22fa['getUser'](_0x4a9cb7)||_0xdd95a6['add'](_0x4a9cb7);}}}function st(_0x9b5494){return _0x9b5494['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0x9b5494['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x9b5494['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class mt extends _0x43cb95{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 _0x3b55a6{['_collapseAt'];constructor(_0x179ba1,_0x44eb86=0x6){super(_0x179ba1);const _0x47b625=this['bindTemplate'];this['set']('isHidden',!0x0),this['set']('usersCount',0x0),this['_collapseAt']=_0x44eb86,this['bind']('isHidden')['to'](this,'usersCount',_0x48d50f=>_0x48d50f<_0x44eb86),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item',_0x47b625['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':_0x47b625['to']('usersCount',_0x130ea4=>'+'+(_0x130ea4-this['_collapseAt']+0x2)['toString']())}]}]}]});}}class is extends _0x3b55a6{['items'];['keystrokes'];constructor(_0xd06696){super(_0xd06696);const _0x481705=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0x54ba1d(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0x481705['if']('hasPopup'),'aria-expanded':_0x481705['to']('isExpanded',_0x22c59b=>this['hasPopup']&&String(_0x22c59b)),'aria-label':_0x481705['to']('hasPopup',_0x356350=>V(_0xd06696,_0x356350?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0x481705['to']('hasPopup',_0x1ea5a3=>!!_0x1ea5a3&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items'],'on':{'mouseenter':_0x481705['to'](()=>this['fire']('presencelist:show')),'mouseleave':_0x481705['to'](_0x380d4a=>{const _0x5aff51=_0x380d4a,_0x1c8009=document['querySelector']('.ck-presence-list__dropdown-list'),_0x255514=document['querySelector']('.ck-balloon-panel_with-arrow');_0x1c8009?.['contains'](_0x5aff51['relatedTarget'])||_0x255514?.['contains'](_0x5aff51['relatedTarget'])||this['fire']('presencelist:hide');})}}),this['on']('change:hasPopup',(_0x398245,_0xceced2,_0x48ffeb)=>{this['element']&&(_0x48ffeb?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 _0x3b55a6{['counterView'];['inlineListView'];constructor(_0x540976,_0x5c7f32=0x6){super(_0x540976);const _0x54879b=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new b(this['locale'],_0x5c7f32),this['inlineListView']=new is(_0x540976),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x128d72 of this['inlineListView']['items'])_0x128d72['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',_0x54879b['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['inlineListView']]});}}class L extends _0x3b55a6{['listWrapperView'];constructor(_0x19a54c,_0x12c853){super(_0x19a54c);const _0x56a5f0=this['bindTemplate'];this['listWrapperView']=new pt(_0x19a54c,_0x12c853),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':V(_0x19a54c,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']],'on':{'mouseleave':_0x56a5f0['to'](_0x1d625c=>{const _0x13793e=_0x1d625c,_0x324333=document['querySelector']('.ck-presence-list__list'),_0x1f695f=document['querySelector']('.ck-balloon-panel_with-arrow');_0x324333?.['contains'](_0x13793e['relatedTarget'])||_0x1f695f?.['contains'](_0x13793e['relatedTarget'])||this['fire']('presencelist:hide');})}});}}class pt extends _0x2e5dc4{constructor(_0x375a22,_0x38fd6f){super(_0x375a22);const _0x5c1401=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0x38fd6f?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0x5c1401['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0x5c1401['to']('role'),'aria-label':_0x5c1401['to']('ariaLabel'),'aria-labelledby':_0x5c1401['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0x391e42['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0x186552=this['element'];_0x186552&&(this['_isScrollable']=Math['max'](_0x186552['scrollHeight'],_0x186552['clientHeight'])>0.8*window['innerHeight']);}}class j extends rt{['userView'];constructor(_0x10c827,_0x150e74,_0x53fd85){super(_0x10c827);const _0x5102fc=this['bindTemplate'];this['userView']=new ct(_0x10c827,_0x150e74);const _0x40ceaf={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0x150e74['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0x150e74['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x150e74['color']['getBackgroundColorClass']()],'aria-hidden':'true'}}]};_0x53fd85&&(_0x40ceaf['tag']='button',_0x40ceaf['on']={'click':_0x5102fc['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x40ceaf);}['focus'](){this['element']['focus']();}}class A extends _0x3b55a6{['userView'];['markerView'];constructor(_0x2ef540,_0x11bb27,_0xb55c4b){super(_0x2ef540);const _0x2768f5=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new ct(_0x2ef540,_0x11bb27),this['markerView']=new at(_0x2ef540,_0x11bb27);const _0x2698d3=new ot(_0x2ef540);_0x2698d3['template']['tag']='span',_0x2698d3['text']=_0x11bb27['name'];const _0x3e50c0={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0x2768f5['to']('isFocusable',_0x10a7bd=>!!_0x10a7bd&&0x0),'aria-labelledby':_0x2698d3['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0x2768f5['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0x2768f5['to']('hasTooltip',_0x10553f=>!_0x10553f),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0x2698d3]};_0xb55c4b&&(_0x3e50c0['tag']='button',_0x3e50c0['on']={'click':_0x2768f5['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x3e50c0);}}class at extends _0x3b55a6{constructor(_0x562af7,_0x28a719){super(_0x562af7),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x28a719['color']['getBackgroundColorClass']()],'aria-hidden':'true'}});}}const x={'collapseAt':0x6,'displayMe':!0x0};class r extends _0x257d3e{['currentDisplayedUsers'];['balloonPanelView'];['view'];['presenceDropdownView'];['_bodyCollection']=null;static get['pluginName'](){return'PresenceListUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x5b3712){super(_0x5b3712),this['context']['config']['define']('presenceList',x);const _0x2f2e81=_0x5b3712['config']['get']('presenceList.collapseAt');if('number'!=typeof _0x2f2e81)throw new _0x244de7('presencelist-collapseat-invalid-format',this);if(_0x2f2e81<0x1)throw new _0x244de7('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](i)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0xe0a42b(),this['balloonPanelView']=new _0x353906(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get['requires'](){return[i];}['init'](){for(const _0x13bce0 of this['_allConnectedUsers'])this['_handleUserAdd'](_0x13bce0);this['listenTo'](this['_allConnectedUsers'],'add',(_0x13bee8,_0x36b129)=>{this['_handleUserAdd'](_0x36b129);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0x4e234c,_0x5ccd5d)=>{this['_handleUserRemove'](_0x5ccd5d);});}['_createView'](){const _0x106984=this['context'],_0x19639b=new v(this['context']['locale'],this['context']['config']['get']('presenceList.collapseAt')),_0x44b4ea=this['balloonPanelView'];if(!_0x5d7266(_0x106984['config']['get']('presenceList.container')))throw new _0x244de7('presencelist-missing-container',this);return _0x19639b['counterView']['bind']('usersCount')['to'](this),_0x19639b['bind']('isCollapsed')['to'](this,'usersCount',_0x5616f3=>{const {collapseAt:_0x32ae40}=_0x106984['config']['get']('presenceList'),_0x292463=_0x5616f3>=_0x32ae40;if(_0x292463&&!_0x19639b['inlineListView']['items']['find'](_0x18b72d=>_0x18b72d instanceof b)){const _0x183b3b=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['currentDisplayedUsers']['length']==_0x183b3b&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](this['currentDisplayedUsers']['length']-0x1),_0x19639b['inlineListView']['items']['add'](_0x19639b['counterView']);}return _0x292463||this['hideDropdown'](),_0x292463;}),_0x19639b['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0x101695=>{const _0x4598ca=_0x106984['config']['get']('presenceList'),_0x8f0458=new A(_0x106984['locale'],_0x101695,!!_0x4598ca['onClick']);return _0x8f0458['bind']('hasTooltip')['to'](_0x19639b,'isCollapsed',_0x3c7533=>!_0x3c7533),_0x8f0458['bind']('isFocusable')['to'](_0x19639b,'isCollapsed',_0x57ad0f=>!_0x57ad0f),_0x4598ca['onClick']&&this['listenTo'](_0x8f0458,'execute',()=>{this['view']['isCollapsed']||_0x4598ca['onClick'](_0x101695,_0x8f0458['element']);}),_0x8f0458;}),this['listenTo'](_0x19639b['inlineListView'],'presencelist:show',()=>{this['view']['isCollapsed']&&this['showDropdown']();}),this['listenTo'](_0x19639b['inlineListView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();}),_0x19639b['inlineListView']['keystrokes']['set']('Enter',(_0x40e611,_0x136ad8)=>{this['view']['isCollapsed']&&(this['showDropdown'](),_0x136ad8());}),_0x19639b['render'](),_0x44b4ea['render'](),_0x2ca48e({'emitter':_0x19639b,'activator':()=>_0x44b4ea['isVisible'],'contextElements':[_0x44b4ea['element'],_0x19639b['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0x106984['config']['get']('presenceList.container')['appendChild'](_0x19639b['element']),this['_bodyCollection']=new _0x107ff5(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_bodyCollection']['add'](this['balloonPanelView']),_0x19639b;}['_handleUserAdd'](_0x3de27c){if(!this['context']['config']['get']('presenceList.displayMe')&&_0x3de27c['isMe'])return;const _0x2ec5d8=this['context']['config']['get']('presenceList.collapseAt')-0x1;for(this['usersCount']++;this['currentDisplayedUsers']['length']>=_0x2ec5d8-(this['view']['isCollapsed']?0x1:0x0)&&this['currentDisplayedUsers']['length']>0x1;)this['currentDisplayedUsers']['remove'](0x1);const _0x4ae509=_0x3de27c['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0x3de27c,_0x4ae509);}['_handleUserRemove'](_0x1fc264){this['usersCount']--;const {collapseAt:_0x43659c}=this['context']['config']['get']('presenceList'),_0x54e89a=this['usersCount']>=_0x43659c;if(this['currentDisplayedUsers']['get'](_0x1fc264['id']))this['currentDisplayedUsers']['remove'](_0x1fc264['id']);else{if(_0x54e89a&&this['currentDisplayedUsers']['length']+0x1===_0x43659c-0x1)return;}if(this['currentDisplayedUsers']['length']+(_0x54e89a?0x1:0x0)<this['usersCount']){for(const _0x19f83d of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0x19f83d['id'])&&(this['currentDisplayedUsers']['add'](_0x19f83d,Math['min'](this['currentDisplayedUsers']['length']-(_0x54e89a?0x1:0x0),0x1)),this['currentDisplayedUsers']['length']+(_0x54e89a?0x1:0x0)===_0x43659c-0x1))return;}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0x1e4b72=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new L(this['context']['locale'],!!_0x1e4b72['onClick']),this['view']['inlineListView']['isExpanded']=!0x0,this['listenTo'](this['presenceDropdownView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();});const {listWrapperView:_0x446ed0}=this['presenceDropdownView'];_0x446ed0['items']['bindTo'](this['_allConnectedUsers'])['using'](_0x1b5cbd=>{if(!_0x1e4b72['displayMe']&&_0x1b5cbd['isMe'])return null;const _0x206703=new j(this['context']['locale'],_0x1b5cbd,!!_0x1e4b72['onClick']);return _0x1e4b72['onClick']&&this['listenTo'](_0x206703,'execute',()=>{_0x1e4b72['onClick'](_0x1b5cbd,_0x206703['element']);}),_0x206703;}),this['balloonPanelView']['content']['add'](this['presenceDropdownView']),this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element']}),_0x446ed0['focus'](),_0x446ed0['checkIfScrollable']();const _0x21d578=(_0x5ccfa9,_0x430b93)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0x430b93();};_0x446ed0['keystrokes']['set']('Esc',_0x21d578),_0x446ed0['keystrokes']['set']('Shift+Tab',_0x21d578),_0x446ed0['keystrokes']['set']('Tab',(_0x4f0f12,_0x3f4b13)=>{!function(_0xf1e376){const _0x224934=['a','button','input','select','textarea','[tabindex]','[contenteditable]']['map'](_0x49faa6=>_0x49faa6+':not([disabled]):not([tabindex=\x22-1\x22])')['join'](','),_0x3f2c56=[...document['body']['querySelectorAll'](_0x224934)]['filter'](_0x3081ad=>_0x3081ad===document['activeElement']||_0x3081ad['offsetWidth']+_0x3081ad['offsetHeight']>0x0)['sort']((_0x4a99b7,_0x54e327)=>(_0x4a99b7['tabIndex']||0x0)-(_0x54e327['tabIndex']||0x0)),_0xb88a4=_0x3f2c56['indexOf'](_0xf1e376),_0x1151e0=_0x3f2c56[(_0xb88a4+0x1)%_0x3f2c56['length']];_0x1151e0&&_0x1151e0['focus']();}(this['view']['element']),this['hideDropdown'](),_0x3f4b13();}),_0x446ed0['focusTracker']['add'](this['view']['element']),_0x446ed0['focusTracker']['on']('change:isFocused',(_0x47d9e7,_0x505495,_0x10e737)=>{_0x10e737||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 _0x257d3e{static get['requires'](){return[i,r];}static get['pluginName'](){return'PresenceList';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}export{s as CloudServicesCommentsAdapter,c as CloudServicesRevisionHistoryAdapter,m as CloudServicesTrackChangesAdapter,gt as PresenceList,r as PresenceListUI,l as RealTimeCollaborationClient,g as RealTimeCollaborativeComments,a as RealTimeCollaborativeEditing,mt as RealTimeCollaborativeRevisionHistory,ft as RealTimeCollaborativeTrackChanges,i as Sessions,n as WebSocketGateway};
|
|
23
|
+
import{ContextPlugin as _0x1861c7,Plugin as _0x5b8bc3,PendingActions as _0x5790b1,Context as tt}from'@ckeditor/ckeditor5-core/dist/index.js';import{DomEmitterMixin as _0x518146,CKEditorError as _0x3a0d6c,Collection as _0x4fdafc,global as _0x21a1a4,version as ht,uid as _0xc6304d,KeystrokeHandler as _0x5e36a4}from'@ckeditor/ckeditor5-utils/dist/index.js';import{Notification as _0x279f17,View as _0x4e32f2,ListView as _0x478f63,ListItemView as rt,LabelView as at,BalloonPanelView as _0x55c17c,clickOutsideHandler as _0x33581a,BodyCollection as _0x20fbe5}from'@ckeditor/ckeditor5-ui/dist/index.js';import{ModelLiveRange as _0x4e36b4,History as _0x25b8ea,NoOperation as _0x29156a,InsertOperation as _0xdb4287,MarkerOperation as _0x3f9087,RootAttributeOperation as _0x447550,transformOperationSets as _0x4b0c2e,OperationFactory as _0xc90b3d}from'@ckeditor/ckeditor5-engine/dist/index.js';import{WebSocketGateway as dt,WEB_SOCKET_GATEWAY_STATES as _0x4efd76,CollaborativeEditingService as _0x3aabc8,User as ut,CommentsService as et,TrackChangesService as it,RevisionHistoryService as _0x53bdb2,EditorService as _0x242d38}from'@ckeditor/ckeditor-cloud-services-collaboration/dist/index.js';import{Users as _0x393929,UserView as ct}from'ckeditor5-collaboration/dist/index.js';import{Compressor as _0x136efe}from'@ckeditor/ckeditor5-operations-compressor/dist/index.js';import{isElement as _0x4d7729}from'es-toolkit/compat';class n extends _0x1861c7{static ['WebSocketGateway']=/* #__PURE__ -- @preserve */
|
|
24
|
+
((()=>dt)());static ['initialReconnectionInterval']=0x3e8;['connection'];['_reconnectionStack'];['_shouldPluginsReconnect'];['_domEmitter'];static get['requires'](){return['CloudServices',_0x279f17];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x26a374){super(_0x26a374),this['set']('state',_0x4efd76['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=new(_0x518146())();}['init'](){const _0xfa2863=this['context'],_0x4d80aa=_0xfa2863['plugins']['get']('CloudServices'),_0x5654b3=_0xfa2863['plugins']['get'](_0x279f17);if(!_0x4d80aa['token'])throw new _0x3a0d6c('websocketgateway-missing-token',this);if(!_0x4d80aa['webSocketUrl'])throw new _0x3a0d6c('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'](_0x4d80aa['token'],_0x4d80aa['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0xd38b95=>{if(this['connection']=_0xd38b95,this['bind']('state')['to'](_0xd38b95,'state',this,'_isBrowserOffline',(_0x522c19,_0x3225d1)=>('connected'!==_0x522c19&&(this['_shouldPluginsReconnect']=!0x0),_0x3225d1||_0x522c19!==_0x4efd76['CONNECTED']?_0x4efd76['DISCONNECTED']:this['state']==_0x4efd76['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),_0x4efd76['CONNECTING']):_0x4efd76['CONNECTED'])),this['connection']['on']('error',(_0x2b9245,_0x19829d)=>{if('limitExceeded'!==_0x19829d['code'])throw console['error'](_0x19829d),new _0x3a0d6c('cloudservices-init',null,{'originalError':_0x19829d});_0x5654b3['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'});}),!_0xd38b95['me'])return new Promise(_0x15da56=>_0xd38b95['on']('change:me',_0x15da56));})['catch'](_0xc2d8b8=>{throw console['error'](_0xc2d8b8),new _0x3a0d6c('cloudservices-init',null,{'originalError':_0xc2d8b8});});}['addToReconnectionStack'](_0x3c8e37){if('function'!=typeof _0x3c8e37['reconnect'])throw new _0x3a0d6c('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0x3c8e37))throw new _0x3a0d6c('websocketgateway-plugin-already-registered',this,{'name':_0x3c8e37['constructor']['pluginName']});this['_reconnectionStack']['add'](_0x3c8e37);}['removeFromReconnectionStack'](_0x1be096){this['_reconnectionStack']['delete'](_0x1be096);}['isInReconnectionStack'](_0x173b28){return this['_reconnectionStack']['has'](_0x173b28);}['_reconnect'](){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0x3536b1=>_0x3536b1['reconnect']())))['then'](()=>this['state']=_0x4efd76['CONNECTED'])['catch'](_0x449b30=>{throw console['error'](_0x449b30),new _0x3a0d6c('cloudservices-reconnection-error',this['context']);});}['disconnect'](){this['connection']&&this['connection']['disconnect'](),this['state']=_0x4efd76['DISCONNECTED'],this['_domEmitter']['stopListening']();}['destroy'](){this['disconnect'](),super['destroy']();}}class i extends _0x1861c7{['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,_0x393929];}constructor(_0x41c9cc){super(_0x41c9cc),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0x4fdafc(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x393929);}['init'](){const _0x26b0f6=this['context']['plugins']['get'](n);this['listenTo'](_0x26b0f6,'change:state',(_0x2ab328,_0x385d2d,_0x199caa)=>{if('connected'!==_0x199caa)this['channelSessions']['forEach'](_0x333c9b=>_0x333c9b['clear']()),this['channelConnectedUsers']['forEach'](_0x547486=>_0x547486['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x56bf85,_0x2b1046]of this['_registeredSessions'])for(const _0x2f2d79 of _0x2b1046)this['_handleSessionAdd'](_0x56bf85,_0x2f2d79);}}),this['_createUser'](_0x26b0f6['connection']['me'],!0x0);}['register'](_0x1b4e32,_0x560240){if(this['_registeredSessions']['has'](_0x1b4e32))throw new _0x3a0d6c('sessions-register-already-registered',null,{'channelId':_0x1b4e32});this['_registeredSessions']['set'](_0x1b4e32,_0x560240),this['channelSessions']['set'](_0x1b4e32,new _0x4fdafc()),this['channelConnectedUsers']['set'](_0x1b4e32,new _0x4fdafc()),this['listenTo'](_0x560240,'add',(_0xdad422,_0x33df42)=>this['_handleSessionAdd'](_0x1b4e32,_0x33df42)),this['listenTo'](_0x560240,'remove',(_0x1c63c0,_0x1d2203)=>this['_handleSessionRemove'](_0x1b4e32,_0x1d2203));for(const _0x30c03f of _0x560240)this['_handleSessionAdd'](_0x1b4e32,_0x30c03f);}['unregister'](_0x37b602){if(!this['_registeredSessions']['has'](_0x37b602))throw new _0x3a0d6c('sessions-unregister-not-exist',null,{'channelId':_0x37b602});const _0x4eaae1=this['_registeredSessions']['get'](_0x37b602);this['stopListening'](_0x4eaae1);for(const _0x4d3d9a of _0x4eaae1)'connected'===this['context']['plugins']['get'](n)['state']&&this['_handleSessionRemove'](_0x37b602,_0x4d3d9a);this['_registeredSessions']['delete'](_0x37b602),this['channelSessions']['delete'](_0x37b602),this['channelConnectedUsers']['delete'](_0x37b602);}get['mySessionId'](){return this['context']['plugins']['get'](n)['connection']['sessionId'];}['getUserBySessionId'](_0x14db0f){for(const _0x5129db of this['channelSessions']['values']())for(const _0x26481f of _0x5129db)if(_0x26481f['id']===_0x14db0f)return _0x26481f['user'];}['getUserSessions'](_0xf7f19d,_0x2b2a26){const _0x4801e7=_0x2b2a26?[this['channelSessions']['get'](_0x2b2a26)]:this['channelSessions']['values'](),_0x55cf5b=new Set();for(const _0x2d8d26 of _0x4801e7)for(const _0x1b785e of _0x2d8d26)_0x1b785e['user']['id']===_0xf7f19d['id']&&_0x55cf5b['add'](_0x1b785e['id']);return _0x55cf5b;}['getUserRole'](_0x5483fc){for(const _0x9358d9 of this['channelSessions']['values']())for(const _0x1d0a07 of _0x9358d9)if(_0x1d0a07['user']===_0x5483fc)return _0x1d0a07['role'];}['_handleSessionAdd'](_0x3de906,_0x2d307f){if('connected'!==this['context']['plugins']['get'](n)['state'])return;const _0x3ec79b=_0x2d307f['user'],_0x22dea5=this['_users']['getUser'](_0x3ec79b['id'])||this['_createUser'](_0x3ec79b),_0xdeeb47=Object['assign']({},_0x2d307f,{'user':_0x22dea5});if(this['channelSessions']['get'](_0x3de906)['add'](_0xdeeb47),!_0x3ec79b['hiddenInPresenceList']){const _0x9fa6fd=this['channelConnectedUsers']['get'](_0x3de906);_0x9fa6fd['has'](_0x22dea5['id'])||_0x9fa6fd['add'](_0x22dea5),this['allConnectedUsers']['has'](_0x22dea5['id'])||_0x3ec79b['hiddenInPresenceList']||this['allConnectedUsers']['add'](_0x22dea5,_0x22dea5['isMe']?0x0:void 0x0);}this['fire']('sessionAdd:'+_0x3de906,{'channelId':_0x3de906,'session':_0xdeeb47});}['_handleSessionRemove'](_0x37c710,_0x2079fa){if('connected'!==this['context']['plugins']['get'](n)['state'])return;const _0x2c5656=this['channelConnectedUsers']['get'](_0x37c710),_0x3a51f7=_0x2079fa['user'];_0x3a51f7['id']&&(this['channelSessions']['get'](_0x37c710)['remove'](_0x2079fa['id']),_0x2c5656['has'](_0x3a51f7['id'])&&!this['getUserSessions'](_0x3a51f7,_0x37c710)['size']&&_0x2c5656['remove'](_0x3a51f7['id']),this['allConnectedUsers']['get'](_0x3a51f7['id'])&&!this['getUserSessions'](_0x3a51f7)['size']&&this['allConnectedUsers']['remove'](_0x3a51f7['id']));}['_createUser'](_0x10f68a,_0xcaa9a7){const _0x4f3c38=this['_users']['addUser'](_0x10f68a);return _0xcaa9a7&&this['_users']['defineMe'](_0x10f68a['id']),_0x4f3c38['orderNumber']=this['_uniqueUsersCount']++,_0x4f3c38;}}class H extends _0x5b8bc3{['_domEmitter']=new(_0x518146())();static get['requires'](){return[i];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x1dd6be=this['editor'],_0x1d2755=_0x1dd6be['plugins']['get'](i);_0x1dd6be['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x54227d,{writer:_0x209df8})=>function(_0x5dc29d,_0x352169,_0x253e96,_0x5ee8b5){const _0x12f585=_0x5dc29d['markerName']['split'](':')[0x2],_0x1ec34b=_0x253e96['getUserBySessionId'](_0x12f585);if(!_0x1ec34b||_0x12f585===_0x253e96['mySessionId'])return;if(!_0x5ee8b5['model']['schema']['checkChild'](_0x5dc29d['markerRange']['start'],'$text'))return;const _0x3bbd42={'class':'ck-user__marker\x20'+_0x1ec34b['color']['getMarkerClass'](),'data-name':_0x1ec34b['name'],'data-session-id':_0x12f585},_0x579f6f=_0x5ee8b5['model']['markers']['get'](_0x5dc29d['markerName']),_0x46ef04=_0x579f6f['getStart'](),_0x32833a=_0x46ef04['nodeAfter'],_0x45988e=_0x5ee8b5['model']['schema'];if(_0x32833a&&_0x45988e['isObject'](_0x32833a)&&_0x45988e['isInline'](_0x32833a)&&!_0x5ee8b5['model']['markers']['get']('user:range:'+_0x12f585)['getRange']()['isCollapsed'])return;const _0x3f744d=_0x46ef04['parent'];return _0x5ee8b5['model']['schema']['isLimit'](_0x3f744d)&&!_0x5ee8b5['model']['hasContent'](_0x3f744d)&&(_0x3bbd42['contenteditable']=!0x1),function(_0x538543,_0x1f24dc,_0x238da4){const _0x592dcd=_0x538543['createUIElement']('span',_0x1f24dc);return _0x538543['setCustomProperty']('userPositionMarker',!0x0,_0x592dcd),_0x592dcd['render']=function(_0x1de785){const _0x12a749=this['toDomElement'](_0x1de785),_0x28abce=document['createElement']('span');return _0x28abce['classList']['add']('ck-user__marker-tooltip'),_0x28abce['setAttribute']('contenteditable','false'),_0x28abce['setAttribute']('spellcheck','false'),_0x28abce['textContent']=_0x238da4['name'],_0x12a749['innerHTML']='<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span>'+_0x28abce['outerHTML']+'',_0x12a749['addEventListener']('mouseenter',()=>{_0x12a749['classList']['add']('ck-user__marker_hovered');}),_0x12a749['addEventListener']('mouseleave',()=>{_0x12a749['classList']['remove']('ck-user__marker_hovered');}),_0x12a749;},_0x592dcd['isSimilar']=function(_0x38f091){return!(!this['getCustomProperty']('userPositionMarker')||!_0x38f091['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0x38f091['getAttribute']('data-session-id'));},_0x592dcd;}(_0x352169,_0x3bbd42,_0x1ec34b);}(_0x54227d,_0x209df8,_0x1d2755,_0x1dd6be)}),_0x1dd6be['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0x2f3a3f=>function(_0x27f3dd,_0xb90ba4){const _0xd0368f=_0x27f3dd['markerName']['split'](':')[0x2];if(_0xd0368f===_0xb90ba4['mySessionId'])return null;const _0x45e03e=_0xb90ba4['getUserBySessionId'](_0xd0368f);if(!_0x45e03e)return{'id':_0xd0368f,'classes':[]};return{'id':_0xd0368f,'classes':['ck-user__selection',_0x45e03e['color']['getSelectionClass']()],'attributes':{'data-session-id':_0xd0368f},'priority':0x7d0+_0x45e03e['orderNumber']};}(_0x2f3a3f,_0x1d2755)}),function(_0x38836c){const _0x3f5983=_0x38836c['model'],_0x40f13a=new Map(),_0x222ed0=_0x38836c['plugins']['get'](i);_0x3f5983['markers']['on']('update:user:range',(_0x21317d,_0x26d263,_0x5e9a33,_0x398f13)=>{if(!_0x398f13&&_0x40f13a['get'](_0x26d263['name']))return _0x40f13a['get'](_0x26d263['name'])['detach'](),void _0x40f13a['delete'](_0x26d263['name']);const _0x254218=_0x26d263['name']['split'](':')[0x2];if(_0x254218===_0x222ed0['mySessionId'])return;const _0x5e165c='user:position:'+_0x254218;_0x3f5983['markers']['has'](_0x5e165c)&&_0x38836c['editing']['reconvertMarker'](_0x5e165c),_0x26d263['on']('change:range',(_0x181312,_0x4b53f4,_0x1027e4)=>{if('$graveyard'!=_0x4b53f4['root']['rootName']&&'$graveyard'==_0x26d263['getRange']()['root']['rootName']&&!_0x40f13a['has'](_0x26d263['name'])){const _0x43113a=_0x3f5983['schema']['getNearestSelectionRange'](_0x1027e4['deletionPosition']);if(_0x43113a){const _0xaa2c6d=_0x4e36b4['fromRange'](_0x43113a);_0x40f13a['set'](_0x26d263['name'],_0xaa2c6d),_0xaa2c6d['on']('change:range',(_0x5059be,_0x4ee07b,_0x15033e)=>{if('$graveyard'==_0xaa2c6d['root']['rootName']){const _0x280b38=_0x3f5983['schema']['getNearestSelectionRange'](_0x15033e['deletionPosition']);_0x280b38?(_0xaa2c6d['start']=_0x280b38['start'],_0xaa2c6d['end']=_0x280b38['end']):(_0x40f13a['delete'](_0x26d263['name']),_0xaa2c6d['detach']());}});}}});}),_0x3f5983['document']['on']('change',()=>{_0x40f13a['size']>0x0&&_0x3f5983['enqueueChange']({'isUndoable':!0x1},_0x441432=>{for(const [_0x908984,_0x44c373]of _0x40f13a)'$graveyard'==_0x3f5983['markers']['get'](_0x908984)['getRange']()['root']['rootName']&&(Y(_0x908984['split'](':')[0x2],_0x44c373['toRange'](),_0x3f5983,_0x441432),_0x44c373['detach']());_0x40f13a['clear']();});});}(_0x1dd6be),this['_domEmitter']['listenTo'](_0x21a1a4['document'],'keydown',(_0x18c0e2,{key:_0x595c14})=>{'Escape'===_0x595c14&&function(_0x4b771d){_0x4b771d['editing']['view']['change'](_0x1b4520=>{for(const _0x1df797 of _0x4b771d['model']['markers']){if(!_0x1df797['name']['startsWith']('user:position'))continue;const _0xf6a703=_0x4b771d['editing']['mapper']['markerNameToElements'](_0x1df797['name']);if(_0xf6a703){for(const _0x5875b3 of _0xf6a703)_0x1b4520['removeClass']('ck-user__marker_hovered',_0x5875b3);}}});}(_0x1dd6be);},{'useCapture':!0x0});}['afterInit'](){const _0x23fd6b=this['editor'],_0x156686=_0x23fd6b['commands']['get']('undo');_0x156686&&_0x23fd6b['model']['on']('applyOperation',(_0x5dbea0,_0x54ccae)=>{const _0x39f63f=_0x54ccae[0x0];if(!_0x39f63f['isDocumentOperation'])return;if('marker'!=_0x39f63f['type']||!_0x39f63f['name']['startsWith']('user:'))return;const _0xaf84d9=_0x39f63f['batch'];_0x156686['_createdBatches']['has'](_0xaf84d9)&&(_0x39f63f['newRange']=_0x39f63f['oldRange']?_0x23fd6b['model']['createRange'](_0x39f63f['oldRange']['start'],_0x39f63f['oldRange']['end']):null);},{'priority':'highest'});}['destroy'](){return this['_domEmitter']['stopListening'](),super['destroy']();}['createUserMarkerOperations'](){const _0xd00784=this['editor'],_0x5bb8c9=_0xd00784['model']['document'],_0x2a74a7=_0xd00784['plugins']['get'](i);_0xd00784['model']['enqueueChange']({'isUndoable':!0x1},_0x416a6d=>{const _0x510b74='user:range:'+_0x2a74a7['mySessionId'],_0x32f1eb='user:position:'+_0x2a74a7['mySessionId'],_0x4ff0ab=_0xd00784['model']['markers']['has'](_0x510b74);_0xd00784['editing']['view']['hasDomSelection']?Y(_0x2a74a7['mySessionId'],_0x5bb8c9['selection']['getFirstRange'](),_0xd00784['model'],_0x416a6d):_0x4ff0ab&&(_0x416a6d['removeMarker'](_0x510b74),_0x416a6d['removeMarker'](_0x32f1eb));});}}function Y(_0x3c2e14,_0x499c51,_0x2a3f87,_0xe8a2e9){const _0x404fb7='user:range:'+_0x3c2e14,_0x707498='user:position:'+_0x3c2e14,_0x429be5=_0x499c51['getContainedElement']();let _0x29cb48=_0x499c51['start'];if(_0x429be5&&_0x429be5['is']('element','tableCell')){const _0x57b77c=function(_0x3eecc5,_0x556e48){for(const _0x19a6fb of _0x3eecc5['getPositions']())if(_0x556e48['schema']['checkChild'](_0x19a6fb,'$text'))return _0x19a6fb;}(_0x499c51,_0x2a3f87);_0x57b77c&&(_0x29cb48=_0x57b77c,_0x499c51=_0xe8a2e9['createRange'](_0x29cb48));}const _0x3782c6=_0xe8a2e9['createRange'](_0x29cb48);_0x2a3f87['markers']['has'](_0x404fb7)?(_0xe8a2e9['updateMarker'](_0x404fb7,{'range':_0x499c51}),_0xe8a2e9['updateMarker'](_0x707498,{'range':_0x3782c6})):(_0xe8a2e9['addMarker'](_0x404fb7,{'range':_0x499c51,'usingOperation':!0x0}),_0xe8a2e9['addMarker'](_0x707498,{'range':_0x3782c6,'usingOperation':!0x0}));}function V(_0x5a6b0f,_0x5ac88c,_0x25000f){const _0x4f27cc=_0x5a6b0f['t'],t=_0x5a6b0f['t'];switch(_0x5ac88c){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 _0x4f27cc({'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'},_0x25000f);default:return'';}}let q=0x1;class l extends _0x5b8bc3{static ['CollaborativeEditingService']=/* #__PURE__ -- @preserve */
|
|
25
|
+
((()=>_0x3aabc8)());['_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,_0x5790b1,_0x393929,_0x279f17];}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 _0x3429f5=this['serverHistory']['getOperations']();for(let _0x21dd6b=_0x3429f5['length']-0x1;_0x21dd6b>=0x0;_0x21dd6b--){const _0x398558=_0x3429f5[_0x21dd6b];if(!this['_disconnectionOperations']['has'](_0x398558))return _0x398558['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0x2c1792){if(super(_0x2c1792),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x25b8ea(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0x3a0d6c('collaboration-missing-channelid',this);const _0x178613=_0x2c1792['config']['get']('cloudServices.bundleVersion')||ht;this['_service']=new l['CollaborativeEditingService'](_0x178613,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0x136efe(),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 K(this['_disconnectionOperations']);}['init'](){const _0xbae3a=this['editor'],_0x48bbe8=_0xbae3a['plugins']['get'](_0x393929),_0x5f1ce4=_0xbae3a['plugins']['get'](n);this['listenTo'](_0x48bbe8,'getOperationAuthor',(_0x4fd98a,_0x5f2b74)=>{const _0x4bf7d8=_0x5f2b74[0x0];_0x4bf7d8['_authorId']&&(_0x4fd98a['return']=_0x48bbe8['getUser'](_0x4bf7d8['_authorId']),_0x4fd98a['stop']()),null===_0x4bf7d8['_authorId']&&(_0x4fd98a['return']=null,_0x4fd98a['stop']());},{'priority':'high'}),this['listenTo'](_0xbae3a['model']['document']['selection'],'change:range',(_0x5cadd6,_0x1e9f24)=>{_0x1e9f24['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0xbae3a['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0xbae3a['model']['on']('applyOperation',(_0x5b5eda,_0x20c6b3)=>{const _0x5a3ba0=_0x20c6b3[0x0];_0x5a3ba0['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0x5a3ba0),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['bind']('_isEditingAllowed')['to'](_0x5f1ce4,'state',this,'_hasSynchronizationProblem',(_0x44d137,_0x26ac06)=>'connected'===_0x44d137&&!_0x26ac06),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0xbae3a['disableReadOnlyMode']('rtc-offline'):_0xbae3a['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0xbae3a['disableReadOnlyMode']('rtc-offline'):_0xbae3a['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async['reconnect'](){const _0x17484d=this['editor']['plugins']['get'](i),_0x56e7fd=this['editor']['plugins']['get'](n);try{this['_isPendingUpdate']=!0x0,_0x17484d['unregister'](this['_channelId']);const _0x54b0b1=await this['_service']['reconnect'](_0x56e7fd['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0x54b0b1)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x4b3b06=await this['_service']['getConnectedSessions']();_0x17484d['register'](this['_channelId'],_0x4b3b06),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x5c40ed){if(function(_0x10abb3){return'404'===_0x10abb3['code'];}(_0x5c40ed)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0x5669d7){return'409'===_0x5669d7['code'];}(_0x5c40ed)){const _0x30828a=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'](_0x30828a);}else{if(!(_0x5c40ed instanceof G))throw _0x5c40ed;this['_handleReconnectionError']();}}}}['destroy'](){const _0x1bd1f5=this['editor']['plugins']['get'](n),_0x533a0a=this['editor']['plugins']['get'](i);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x533a0a['channelSessions']['has'](this['_channelId'])&&_0x533a0a['unregister'](this['_channelId']),_0x1bd1f5['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async['_handleReconnectionResponse'](_0x2d8825){if(this['sessionId']!==_0x2d8825['sessionId']&&this['_lastSyncedOperationId']!==_0x2d8825['lastOperationId'])throw new G();return this['sessionId']=_0x2d8825['sessionId'],this['_handleServerResponse']([],{..._0x2d8825,'wereChangesApplied':!0x1,'data':_0x2d8825['data']},'reconnect');}async['_connectService'](_0x3e8cf8,_0x20b5e0=!0x1){const {connection:_0x2ef280}=this['editor']['plugins']['get'](n);l['CollaborativeEditingService']['getConnectedSessions'](_0x2ef280,this['_channelId'])['then'](_0x286b98=>this['_initSessionsHandling'](_0x286b98))['catch'](_0xa60b67=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0xa60b67);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x21f28f,_0x351415)=>{this['_crash']('realtimecollaborationclient-init-service-internal-error',_0x351415);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_isConnected']=!0x1;});const _0x42347b=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x3e8cf8);this['_isPendingUpdate']=!0x0;const _0x124419=await this['_service']['connect'](_0x2ef280,this['_compressOperations'](_0x3e8cf8),_0x42347b);if(this['sessionId']=_0x124419['sessionId'],_0x20b5e0){if(!_0x124419['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x124419['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0x3e8cf8,_0x124419,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x124419,_0x3e8cf8);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}['_handleSendingSelectionMarkers'](){const _0xb00a37=this['editor']['plugins']['get'](i),_0x169043=this['editor']['plugins']['get'](H),_0x48740a=_0xb00a37['channelSessions']['get'](this['_channelId']);_0x48740a&&_0x48740a['length']>0x1?_0x169043['createUserMarkerOperations']():this['listenTo'](_0xb00a37,'sessionAdd:'+this['_channelId'],()=>{0x2===_0xb00a37['channelSessions']['get'](this['_channelId'])['length']&&_0x169043['createUserMarkerOperations']();});}async['_handleReceivedOperations'](_0x16ea04,_0x3f5285,_0x39415f,_0x44aff3){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x3f5285){const _0x1de6d9=this['_decompressOperations'](_0x39415f,_0x44aff3);await this['_fetchMissingUsers'](_0x1de6d9),this['_handleExternalOperations'](_0x1de6d9,_0x3f5285,_0x39415f['lastOperationId'])||this['_crash']('realtimecollaborationclient-init-service-incorrect-server-operation');}}async['_connectAfterSessionHasBeenFlushed'](){this['_disconnectService']();const {locale:_0x18a38a}=this['editor'];let _0x2d29c0;try{_0x2d29c0=await this['_service']['getDocumentDetails']();}catch{const _0x46f112=V(_0x18a38a,'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'](_0x46f112);}const _0x1d9e1c=_0x2d29c0['currentDocumentSession']||_0x2d29c0['lastDocumentSession'];if(this['_lastSyncedOperationId']!==_0x1d9e1c['lastOperationId']){const _0x5afa94=V(_0x18a38a,'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'](_0x5afa94);}await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);}['_disconnectService'](){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['stopListening'](this['_service']);}['_initSessionsHandling'](_0x124490){const _0x2ff047=this['editor']['plugins']['get'](i);this['listenTo'](_0x2ff047,'sessionAdd:'+this['_channelId'],(_0x483004,{session:_0x1d8166})=>{if(_0x1d8166['id']===_0x2ff047['mySessionId']){_0x483004['off']();const _0x4f366e=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0x4cbadf=_0x1d8166['permissions'];_0x4f366e&&_0x4f366e['isEnabled']&&(_0x4cbadf=_0x4cbadf['filter'](_0x19df04=>'document:write'!==_0x19df04)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0x4cbadf,this['_channelId']);}}),_0x2ff047['register'](this['_channelId'],_0x124490);}['_initThrowingOnDataSet'](){const _0x168b12=this['editor']['data']['set'];this['editor']['data']['set']=(..._0x27568f)=>{if(!_0x27568f[_0x27568f['length']-0x1]['suppressErrorInCollaboration'])throw new _0x3a0d6c('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x168b12['apply'](this['editor']['data'],_0x27568f);};}['_setUpDataInit'](){this['editor']['data']['on']('init',(_0x974b00,[_0x8dd10c])=>{if(this['_document']['version'])throw new _0x3a0d6c('realtimecollaborationclient-init-document-already-initialized',this);_0x974b00['stop'](),this['_setPendingAction']();const _0x9e600f=this['editor']['config']['get']('rootsAttributes'),_0x1cd819=this['_getOperationsFromInitData'](_0x8dd10c,_0x9e600f);0x0==_0x1cd819['length']&&_0x1cd819['push'](new _0x29156a(0x0)),_0x974b00['return']=this['_connectService'](_0x1cd819)['then'](()=>{this['editor']['plugins']['get'](n)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x28bf9e=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x28bf9e))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x1a3394,[_0x3525d7,_0x46a06c])=>{_0x1a3394['stop']();const _0x207efa=this['editor']['model']['document']['getRoot'](_0x3525d7);if(!this['_knownRootNames']['has'](_0x3525d7)){const _0x4b2b1e=_0x46a06c&&_0x46a06c['data']?_0x46a06c['data']:'',_0x14dbd8=_0x46a06c&&_0x46a06c['attributes']?_0x46a06c['attributes']:{};await this['_loadRoot'](_0x3525d7,_0x4b2b1e,_0x14dbd8);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0x207efa['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0x207efa);});},{'priority':'high'});}async['_fetchMissingUsers'](_0x1f9132){const _0x2d2d77=this['editor']['plugins']['get'](_0x393929),{connection:_0x106ff6}=this['editor']['plugins']['get'](n),_0x13d24c=new Set();for(const _0x19ea4a of _0x1f9132){const _0x3b9ea9=_0x19ea4a['_authorId'];_0x3b9ea9&&!_0x2d2d77['getUser'](_0x3b9ea9)&&_0x13d24c['add'](_0x3b9ea9);}if(0x0===_0x13d24c['size'])return;const _0x3bdb35=await ut['getMany'](_0x106ff6,Array['from'](_0x13d24c));for(const _0x3885d0 of _0x3bdb35)_0x2d2d77['getUser'](_0x3885d0['id'])||_0x2d2d77['addUser'](_0x3885d0);}['_getOperationsFromInitData'](_0xa76647,_0x13057={}){const _0x252bd3=this['editor']['model'],_0x67a7b6=[];let _0x37e34b=0x0;const _0x4a26b3='string'==typeof _0xa76647?{'main':_0xa76647}:_0xa76647;for(const _0x2c6618 of Object['keys'](_0x4a26b3)){if(!this['_document']['roots']['has'](_0x2c6618))throw new _0x3a0d6c('realtimecollaborationclient-init-non-existent-root',this);const _0x3e1836=this['editor']['data']['parse'](_0x4a26b3[_0x2c6618]),_0x59deb5=this['_document']['getRoot'](_0x2c6618),_0x225b53=new _0xdb4287(_0x252bd3['createPositionAt'](_0x59deb5,0x0),_0x3e1836,_0x37e34b++);_0x67a7b6['push'](_0x225b53);for(const [_0x6a19dd,_0x4f249c]of _0x3e1836['markers']){const _0x41150a=_0x252bd3['createRange'](_0x252bd3['createPositionFromPath'](_0x59deb5,_0x4f249c['start']['path']['slice']()),_0x252bd3['createPositionFromPath'](_0x59deb5,_0x4f249c['end']['path']['slice']())),_0x5845cc=new _0x3f9087(_0x6a19dd,null,_0x41150a,_0x252bd3['markers'],!0x0,_0x37e34b++);_0x67a7b6['push'](_0x5845cc);}}if(_0x13057)for(const [_0x5f3ba8,_0x4a2974]of Object['entries'](_0x13057)){const _0x294433=_0x252bd3['document']['getRoot'](_0x5f3ba8);if(!_0x294433)throw new _0x3a0d6c('multi-root-editor-root-attributes-no-root',null);for(const [_0x30de48,_0x3c7054]of Object['entries'](_0x4a2974))if(null!==_0x3c7054){const _0x176580=new _0x447550(_0x294433,_0x30de48,null,_0x3c7054,_0x37e34b++);_0x67a7b6['push'](_0x176580);}}return _0x67a7b6;}async['_loadRoot'](_0x2435c7,_0x275fc9,_0x258a30){this['_getOperationsFromInitData']({[_0x2435c7]:_0x275fc9},{[_0x2435c7]:_0x258a30})['forEach']((_0x260e24,_0x5b1247)=>{_0x260e24['baseVersion']=this['_document']['version']+_0x5b1247,_0x260e24['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x260e24);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async['_handleInitialConnectionData'](_0x339407,_0x2e81e8){let _0x322a04;this['_offset']=_0x339407['offset'];const _0x2b4f58=_0x339407['wereChangesApplied']&&!_0x339407['initData'],_0x377200=_0x2b4f58?0x0:_0x339407['data']['baseVersion'];if(_0x2e81e8['forEach'](_0xce4423=>{_0xce4423['_isInit']=!0x0,_0xce4423['createdAt']=_0x339407['sessionCreatedAt'],_0xce4423['_authorId']=null;}),_0x2b4f58)_0x322a04=_0x2e81e8,this['_applyOperationsSet'](_0x322a04,_0x2b4f58);else{if(_0x339407['initData']){const _0x421cc0=this['_getOperationsFromInitData'](_0x339407['initData']);this['_document']['history']['version']=-_0x421cc0['length'],_0x421cc0['forEach'](_0x2bb657=>{_0x2bb657['baseVersion']-=_0x421cc0['length'],_0x2bb657['createdAt']=_0x339407['sessionCreatedAt'],_0x2bb657['_isInit']=!0x0,_0x2bb657['_authorId']=null;}),this['_applyOperationsSet'](_0x421cc0,!0x0),this['serverHistory']['version']=-_0x421cc0['length']+this['_offset'],this['_updateServerHistory'](_0x421cc0);}this['_document']['history']['version']=_0x377200,_0x322a04=this['_decompressOperations'](_0x339407['data'],_0x339407['metadata']),await this['_fetchMissingUsers'](_0x322a04),this['_applyOperationsSet'](_0x322a04,_0x2b4f58);}_0x339407['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x322a04,_0x339407['lastOperationId']),this['_lastSyncedOperationId']=_0x339407['lastOperationId']),this['serverHistory']['version']=_0x377200+this['_offset'],this['_updateServerHistory'](_0x322a04),_0x2e81e8['filter'](_0x24bde3=>{const _0x7a1a55=this['_getAffectedRoot'](_0x24bde3);return _0x7a1a55&&!this['_knownRootNames']['has'](_0x7a1a55);})['forEach']((_0x47a8b6,_0x427ea6)=>{_0x47a8b6['baseVersion']=this['_document']['version']+_0x427ea6,this['_saveOperationInBuffer'](_0x47a8b6);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x5d55ff,_0x3c72ab){const _0x53c681=_0x3c72ab&&_0x3c72ab['message'];if(_0x53c681&&_0x53c681['startsWith']('realtimecollaborationclient'))throw _0x3c72ab;const _0x2fdb49=this['editor']['plugins']['get'](n);throw this['_isPendingUpdate']=!0x0,_0x2fdb49['disconnect'](),this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0x3a0d6c(_0x5d55ff,this['editor'],_0x53c681?{'originalError':_0x53c681}:void 0x0);}['_saveOperationInBuffer'](_0x15750e){this['_knownOperations']['has'](_0x15750e)||(this['_knownOperations']['add'](_0x15750e),this['_bufferedOperations']['push'](_0x15750e),this['_pendingAction']||'marker'==_0x15750e['type']&&!_0x15750e['affectsData']||this['_setPendingAction']());}['_sendBufferedOperationsDelayed'](_0x27871e=!0x1){!_0x27871e&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0x3e304b=>{_0x3e304b&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0x2a8b8c=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0x11c406){return _0x11c406['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x11c406['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0x11c406['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0x2a8b8c)||this['_crash'](_0x2a8b8c['message'],_0x2a8b8c);});},this['_currentBufferDelay']));}['_waitUntilSynced'](){return new Promise(_0x89f755=>{this['on']('change:_isPendingUpdate',()=>{_0x89f755();});});}async['_sendBufferedOperations'](){const _0x33071b=this['editor']['plugins']['get'](H);if(this['_shouldSendSelectionUpdate']()&&(_0x33071b['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x4ca573=[...this['_bufferedOperations']];for(const _0x3d5c57 of _0x4ca573)_0x3d5c57['wasUndone']=this['_document']['history']['isUndoneOperation'](_0x3d5c57);const _0x40a453=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x4ca573),_0x2ad9b5=q++,_0x1db153=this['_compressOperations'](_0x4ca573),_0xa92398=await this['_service']['sendOperations'](_0x1db153,_0x1db153['baseVersion'],_0x40a453);try{return await this['_handleServerResponse'](_0x4ca573,_0xa92398,_0x2ad9b5);}catch(_0x4700c9){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0x4700c9);}}async['_handleServerResponse'](_0x135b01,_0x6d5942,_0x10182b){if('error'in _0x6d5942)throw _0x6d5942['error'];let _0x46866c=!0x1;if(_0x6d5942['wereChangesApplied']){_0x6d5942['lastOperationId']&&(this['_lastSyncedOperationId']=_0x6d5942['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x1aa4a2=>!_0x135b01['includes'](_0x1aa4a2));for(const _0x10de64 of _0x135b01)_0x10de64['createdAt']='lastOperationAcceptedAt'in _0x6d5942&&_0x6d5942['lastOperationAcceptedAt']||void 0x0;$(_0x135b01,_0x6d5942['version']-_0x135b01['length']),this['_updateServerHistory'](_0x135b01);const _0x160049=_0x135b01['filter'](_0x19e9ae=>{if(!_0x19e9ae['_isInit'])return!0x1;const _0x579152=this['_getAffectedRoot'](_0x19e9ae);return _0x579152&&!this['_knownRootNames']['has'](_0x579152);});$(_0x160049,this['_document']['version']),this['_applyOperationsSet'](_0x160049),_0x46866c=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0x566f19=this['_decompressOperations'](_0x6d5942['data'],_0x6d5942['metadata'])['filter'](_0x1a4e02=>_0x1a4e02['baseVersion']>=this['_lastServerVersion']);_0x566f19['forEach'](_0x11ff57=>this['_addKnownRoot'](_0x11ff57)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x52b65d=>!_0x52b65d['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x52b65d))),this['_bufferedOperations']['length']&&$(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0x566f19),_0x46866c=this['_handleExternalOperations'](_0x566f19,_0x6d5942['version'],_0x6d5942['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x46866c?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}['_handleExternalOperations'](_0x479dc9,_0x137bf7,_0x59ef3b){try{const _0x19c834={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x552164,operationsB:_0x351fe2,originalOperations:_0x23cc8b}=_0x4b0c2e(_0x479dc9,this['_bufferedOperations'],_0x19c834);$(_0x552164,this['_document']['version']),$(_0x351fe2,_0x137bf7);for(const _0x2caa92 of _0x552164){const _0x3b5701=_0x23cc8b['get'](_0x2caa92);_0x2caa92['_authorId']=_0x3b5701?_0x3b5701['_authorId']:null;}_0x59ef3b&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x479dc9,_0x59ef3b),this['_lastSyncedOperationId']=_0x59ef3b),this['_bufferedOperations']=[..._0x351fe2],this['_applyOperationsSet'](_0x552164),this['_updateServerHistory'](_0x479dc9);}catch(_0x2cc9ec){return console['error'](_0x2cc9ec),!0x1;}return!0x0;}['_applyOperationsSet'](_0x49f51f,_0x4300d3=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0x405cc5=>{for(const _0x5a6efb of _0x49f51f)this['_knownOperations']['add'](_0x5a6efb),this['_addKnownRoot'](_0x5a6efb),_0x405cc5['batch']['addOperation'](_0x5a6efb),this['editor']['model']['applyOperation'](_0x5a6efb);});}['_addKnownRoot'](_0x4f6c3b){const _0x310171=this['_getAffectedRoot'](_0x4f6c3b);_0x310171&&this['_knownRootNames']['add'](_0x310171);}['_getAffectedRoot'](_0x3d396f){let _0x38e6f8,_0x579114;switch(_0x3d396f['type']){case'insert':_0x38e6f8=_0x3d396f['position']['root'];break;case'marker':if(_0x579114=_0x3d396f['newRange'],!_0x579114)return null;_0x38e6f8=_0x579114['root'];break;case'addRootAttribute':_0x38e6f8=_0x3d396f['root'];break;case'addRoot':_0x38e6f8=_0x3d396f['affectedSelectable'];break;case'move':_0x38e6f8=_0x3d396f['targetPosition']['root'];break;default:return null;}return _0x38e6f8['rootName'];}['_updateServerHistory'](_0x58f7d4){_0x58f7d4['forEach'](_0x2df677=>{const _0x200d48=_0x2df677['clone']();_0x200d48['_authorId']=_0x2df677['_authorId'],_0x200d48['_isInit']=!!_0x2df677['_isInit'],_0x200d48['createdAt']=_0x2df677['createdAt'],_0x200d48['baseVersion']+=this['_offset'],_0x2df677['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x200d48),this['serverHistory']['addOperation'](_0x200d48);});}['_handleReconnectionError'](_0x5ad368){const _0x5120e5=this['editor']['plugins']['get']('Notification'),_0x35b5c8=this['editor']['locale'];_0x5ad368||(_0x5ad368=V(_0x35b5c8,'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.')),_0x5120e5['showWarning'](_0x5ad368,{'title':V(_0x35b5c8,'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'](_0x5790b1)['add'](V(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}['_clearPendingAction'](){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x5790b1)['remove'](this['_pendingAction']),this['_pendingAction']=null);}['_compressOperations'](_0x8677e4){const _0x1bbe3f=_0x8677e4['map'](_0x40ff21=>_0x40ff21['toJSON']());return this['_compressor']['compress'](_0x1bbe3f);}['_decompressOperations'](_0x3b9edf,_0x43f636){return this['_compressor']['decompress'](_0x3b9edf)['map']((_0x10aa81,_0xf21710)=>{const _0x5e0734='init'==_0x43f636[_0xf21710]['type'];if('InsertOperation'==_0x10aa81['__className']){const _0x40af95=_0x10aa81['position']['root'];!this['_document']['getRoot'](_0x40af95)&&(this['_document']['createRoot']('$root',_0x40af95)['_isAttached']=!0x1);}const _0xcc715=_0xc90b3d['fromJSON'](_0x10aa81,this['_document']);return _0xcc715['wasUndone']=_0x10aa81['wasUndone'],_0xcc715['_isInit']=_0x5e0734,_0xcc715['_authorId']=_0x5e0734?null:_0x43f636[_0xf21710]['userId'],_0xcc715['_isDisconnection']='cs:removeUser'===_0x43f636[_0xf21710]['type'],_0xcc715['createdAt']=_0x43f636[_0xf21710]['createdAt'],_0xcc715;});}['_refreshUserSelectionMarkers'](){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}['_shouldSendSelectionUpdate'](){const _0x242d1d=this['editor']['plugins']['get'](i)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0x242d1d&&_0x242d1d['length']>0x1&&this['_hasSelectionChanged'];}['_shouldSendUpdate'](){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}}class G extends Error{}function $(_0x111fb4,_0x2bfee8){for(const _0x20488a of _0x111fb4)_0x20488a['baseVersion']=_0x2bfee8++;}class K{['_ignoredOperations'];['_operationToId'];constructor(_0x3a321e){this['_ignoredOperations']=_0x3a321e,this['_operationToId']=new WeakMap();}['getIdOfTheLastOperation'](_0x4b6e65){let _0x6f8f25=_0x4b6e65['length'];for(;_0x6f8f25--;){const _0x59a286=_0x4b6e65[_0x6f8f25];if(!this['_ignoredOperations']['has'](_0x59a286)){if(!this['_operationToId']['has'](_0x59a286)){const _0x516d8c=_0xc6304d()['slice'](0x1,0x12);this['_operationToId']['set'](_0x59a286,_0x516d8c);}return this['_operationToId']['get'](_0x59a286);}}}['setIdForTheLastOperation'](_0xcd5476,_0x5e2bfb){if(!_0x5e2bfb)return;let _0x22bc29=_0xcd5476['length'];for(;_0x22bc29--;){const _0x318317=_0xcd5476[_0x22bc29];this['_ignoredOperations']['has'](_0x318317)||this['_operationToId']['set'](_0x318317,_0x5e2bfb);}}}class a extends _0x5b8bc3{static get['requires'](){return[l];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class s extends _0x1861c7{static ['CommentsService']=/* #__PURE__ -- @preserve */
|
|
26
|
+
((()=>et)());['_services'];static get['requires'](){return[n,'CommentsRepository',i,_0x393929];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x2aaaab){super(_0x2aaaab),this['_services']=new Map();}async['init'](){const _0x1b17c8=this['context'],_0x485900=_0x1b17c8['plugins']['get']('CommentsRepository');if(_0x1b17c8['plugins']['get'](n)['addToReconnectionStack'](this),_0x485900['adapter']={'addCommentThread':async({channelId:_0x456cf3,threadId:_0x599765,comments:_0x379e3b,resolvedAt:_0x5d8da7,resolvedBy:_0x22c909,context:_0x4ce753,attributes:_0x1754bc})=>{const _0x448cb8=await this['_getService'](_0x456cf3)['addCommentThread']({'commentThreadId':_0x599765,'comments':_0x379e3b['map'](_0x53ef1d=>function(_0x41257d,_0x9530b2,_0x31400c){return{'commentThreadId':_0x31400c,'commentId':_0x41257d['commentId'],'userId':_0x41257d['authorId'],'content':_0x41257d['content'],'documentId':_0x9530b2,'createdAt':_0x41257d['createdAt'],'attributes':_0x41257d['attributes']||{}};}(_0x53ef1d,_0x456cf3,_0x599765)),'resolvedAt':_0x5d8da7,'resolvedBy':_0x22c909,'context':_0x4ce753,'attributes':_0x1754bc})['catch'](ft);return{'threadId':_0x448cb8['commentThreadId'],'comments':_0x448cb8['comments']};},'getCommentThread':async({channelId:_0x1b806d,threadId:_0x563313})=>{const _0x12fb5f=await this['_getService'](_0x1b806d)['getCommentThread'](_0x563313)['catch'](ot)['catch'](ft);return _0x12fb5f?_0x12fb5f['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0x12fb5f]),{'threadId':_0x12fb5f['commentThreadId'],'comments':_0x12fb5f['comments']['map'](st),'context':_0x12fb5f['context'],'resolvedAt':_0x12fb5f['resolvedAt'],'resolvedBy':_0x12fb5f['resolvedBy'],'attributes':_0x12fb5f['attributes']||{}}):null;},'updateCommentThread':async({channelId:_0x5cb583,threadId:_0x498458,context:_0x12cc5c,unlinkedAt:_0x3e9662,attributes:_0x522bf6})=>this['_getService'](_0x5cb583)['updateCommentThread']({'commentThreadId':_0x498458,'context':_0x12cc5c,'attributes':_0x522bf6,'unlinkedAt':_0x3e9662})['catch'](ot)['catch'](ft),'resolveCommentThread':async({channelId:_0x276d78,threadId:_0x539b81})=>{const _0x10e3fd=await this['_getService'](_0x276d78)['resolveCommentThread'](_0x539b81)['catch'](ot)['catch'](ft);return{'threadId':_0x10e3fd['commentThreadId'],'resolvedAt':_0x10e3fd['resolvedAt'],'resolvedBy':_0x10e3fd['resolvedBy']};},'reopenCommentThread':async({channelId:_0x53bbb6,threadId:_0x152a3c})=>this['_getService'](_0x53bbb6)['reopenCommentThread'](_0x152a3c)['catch'](ot)['catch'](ft),'removeCommentThread':({channelId:_0x4ecfe3,threadId:_0x294c6a})=>this['_getService'](_0x4ecfe3)['removeCommentThread'](_0x294c6a)['catch'](ot)['catch'](ft),'addComment':({channelId:_0x47e103,threadId:_0x2f142e,commentId:_0x404b41,content:_0x5452a6,attributes:_0x5e2936})=>this['_getService'](_0x47e103)['addComment'](_0x2f142e,_0x404b41,_0x5452a6,_0x5e2936)['catch'](ft),'updateComment':({channelId:_0x5ecbb6,threadId:_0x28191b,commentId:_0x1cfa10,content:_0x5e4fea,attributes:_0x2b4f28})=>this['_getService'](_0x5ecbb6)['updateComment'](_0x28191b,_0x1cfa10,_0x5e4fea,_0x2b4f28)['catch'](ot)['catch'](ft),'removeComment':({channelId:_0x47bcda,threadId:_0x3fee26,commentId:_0x1a7137})=>this['_getService'](_0x47bcda)['removeComment'](_0x3fee26,_0x1a7137)['catch'](ot)['catch'](ft)},_0x1b17c8 instanceof tt){const _0x4eaf01=_0x1b17c8['config']['get']('collaboration.channelId'),_0x2de68b=_0x1b17c8['plugins']['get'](i);await this['_setUpService'](_0x4eaf01);const _0x7c6de9=await this['_services']['get'](_0x4eaf01)['getConnectedSessions']();this['listenTo'](_0x2de68b,'sessionAdd:'+_0x4eaf01,(_0x1f9f75,{session:_0x20bb7e})=>{_0x20bb7e['id']===_0x2de68b['mySessionId']&&(_0x1f9f75['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x20bb7e['permissions'],_0x4eaf01));}),_0x2de68b['register'](_0x4eaf01,_0x7c6de9);}}async['_setUpService'](_0x514692){if(this['_services']['has'](_0x514692))throw new _0x3a0d6c('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0x514692});const _0x2ab89b=this['context']['plugins']['get']('CommentsRepository'),_0x54d6c2=new s['CommentsService'](_0x514692);this['_services']['set'](_0x514692,_0x54d6c2),this['listenTo'](_0x54d6c2,'commentThreadAdded',(_0x10ea44,_0x30fff8)=>{const {commentThreadId:_0x19cf29,documentId:_0x3fb70a,context:_0x486bdb,attributes:_0x17821b,resolvedAt:_0x198ff6,resolvedBy:_0x3b1b26,comments:_0x284f5a}=_0x30fff8;_0x2ab89b['getCommentThread'](_0x19cf29)||_0x2ab89b['addCommentThread']({'threadId':_0x19cf29,'channelId':_0x3fb70a,'comments':_0x284f5a?_0x284f5a['map'](st):[],'context':_0x486bdb,'attributes':_0x17821b,'resolvedAt':_0x198ff6,'resolvedBy':_0x3b1b26,'isFromAdapter':!0x0});}),this['listenTo'](_0x54d6c2,'commentThreadUpdated',(_0x39d4eb,{commentThreadId:_0x5910da,documentId:_0x5144a1,context:_0x5650f5,unlinkedAt:_0x1a4799,attributes:_0x59e1c7})=>{_0x2ab89b['getCommentThread'](_0x5910da)&&_0x2ab89b['updateCommentThread']({'threadId':_0x5910da,'channelId':_0x5144a1,'context':_0x5650f5,'unlinkedAt':_0x1a4799,'attributes':_0x59e1c7,'isFromAdapter':!0x0});}),this['listenTo'](_0x54d6c2,'commentThreadResolved',(_0x1f7c3d,{commentThreadId:_0xcc7c15,resolvedBy:_0x39b964,resolvedAt:_0x1d13de})=>{const _0x4369fb=_0x2ab89b['getCommentThread'](_0xcc7c15);_0x4369fb&&_0x4369fb['resolve']({'resolvedBy':_0x39b964,'resolvedAt':_0x1d13de,'isFromAdapter':!0x0});}),this['listenTo'](_0x54d6c2,'commentThreadReopened',(_0x5a3452,{commentThreadId:_0x5d9ef5})=>{const _0x4c504f=_0x2ab89b['getCommentThread'](_0x5d9ef5);_0x4c504f&&_0x4c504f['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0x54d6c2,'commentThreadRemoved',(_0x289e13,{commentThreadId:_0x2c538c})=>{const _0x53aa24=_0x2ab89b['getCommentThread'](_0x2c538c);_0x53aa24&&_0x53aa24['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0x54d6c2,'commentAdded',(_0x26df75,_0x359840)=>{const _0x46ecaa=_0x359840['commentThreadId'],_0x4d4943=_0x2ab89b['getCommentThread'](_0x46ecaa);_0x4d4943&&_0x4d4943['addComment']({...st(_0x359840),'isFromAdapter':!0x0});}),this['listenTo'](_0x54d6c2,'commentUpdated',(_0x541139,{commentThreadId:_0xb5e099,commentId:_0x1016c4,content:_0x329305,attributes:_0x54a599})=>{const _0x3d7673=_0x2ab89b['getCommentThread'](_0xb5e099);if(_0x3d7673){const _0x51c586=_0x3d7673['getComment'](_0x1016c4);_0x51c586&&_0x51c586['update']({'content':_0x329305,'attributes':_0x54a599,'isFromAdapter':!0x0});}}),this['listenTo'](_0x54d6c2,'commentRemoved',(_0x2b2f9c,{commentThreadId:_0x15cdc4,commentId:_0x3a26db})=>{const _0x1c0819=_0x2ab89b['getCommentThread'](_0x15cdc4);if(_0x1c0819){const _0x56f5f0=_0x1c0819['getComment'](_0x3a26db);_0x56f5f0&&_0x56f5f0['remove']({'isFromAdapter':!0x0});}}),await this['_connectService'](_0x514692);}['destroy'](){if(this['context']instanceof tt){const _0x74d579=this['context']['config']['get']('collaboration.channelId');this['_terminateService'](_0x74d579);}}['_terminateService'](_0x2bfedb){if(!this['_services']['has'](_0x2bfedb))throw new _0x3a0d6c('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0x2bfedb});this['_getService'](_0x2bfedb)['disconnect'](),this['_services']['delete'](_0x2bfedb);}async['reconnect'](){for(const _0x1e3fae of this['_services']['keys']())await this['_connectService'](_0x1e3fae);if(this['context']instanceof tt){const _0x7cbc19=this['context']['config']['get']('collaboration.channelId'),_0x555fc4=this['context']['plugins']['get'](i);_0x555fc4['unregister'](_0x7cbc19);const _0x3da097=await this['_services']['get'](_0x7cbc19)['getConnectedSessions']();_0x555fc4['register'](_0x7cbc19,_0x3da097);}}async['_connectService'](_0x469344){const {connection:_0x36ef8c}=this['context']['plugins']['get'](n),_0x2746a6=this['context']['plugins']['get']('CommentsRepository'),_0x5f1798=this['_services']['get'](_0x469344),_0x12a337=await _0x5f1798['connect'](_0x36ef8c);await this['_fetchMissingUsersForThreads'](_0x12a337);const _0x426232=new Set(Array['from'](_0x2746a6['getCommentThreads']({'channelId':_0x469344}),_0x5eabe2=>_0x5eabe2['id']));for(const _0x2683eb of _0x12a337)_0x2683eb['deletedAt']||_0x426232['delete'](_0x2683eb['commentThreadId']);for(const _0x586cc1 of _0x426232)_0x2746a6['getCommentThread'](_0x586cc1)['remove']({'isFromAdapter':!0x0});for(const _0x19bcae of _0x12a337){let _0x1db55c=_0x2746a6['getCommentThread'](_0x19bcae['commentThreadId']);const {commentThreadId:_0x36dc82,context:_0x246d57,attributes:_0x134fa7,resolvedBy:_0x4edc6c,resolvedAt:_0x54918e,unlinkedAt:_0x33b9f6,deletedAt:_0x53a724}=_0x19bcae;if(_0x53a724)continue;_0x1db55c||(_0x1db55c=_0x2746a6['addCommentThread']({'channelId':_0x469344,'threadId':_0x36dc82,'context':_0x246d57,'attributes':_0x134fa7||{},'resolvedBy':_0x4edc6c,'resolvedAt':_0x54918e,'unlinkedAt':_0x33b9f6,'isFromAdapter':!0x0}));const _0x5c8476=new Set(Array['from'](_0x1db55c['comments'],_0x3557a2=>_0x3557a2['id']));for(const _0x16f88d of _0x19bcae['comments'])_0x5c8476['delete'](_0x16f88d['commentId']);for(const _0x2f8ee0 of _0x5c8476)_0x1db55c['getComment'](_0x2f8ee0)['remove']({'isFromAdapter':!0x0});for(const _0x583b8e of _0x19bcae['comments']){const _0x633d0f=_0x1db55c['getComment'](_0x583b8e['commentId']);_0x633d0f?_0x633d0f['content']!==_0x583b8e['content']&&_0x633d0f['update']({'content':_0x583b8e['content'],'isFromAdapter':!0x0}):_0x1db55c['addComment'](Object['assign'](st(_0x583b8e),{'isFromAdapter':!0x0}));}}}['_getService'](_0x5ae5e4){if(!this['_services']['has'](_0x5ae5e4))throw new _0x3a0d6c('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0x5ae5e4});return this['_services']['get'](_0x5ae5e4);}async['_fetchMissingUsersForThreads'](_0x58d69c){const _0x3dbab4=this['context']['plugins']['get'](_0x393929),{connection:_0x2b6354}=this['context']['plugins']['get'](n),_0x54ebd0=new Set();for(const {resolvedBy:_0x5682a6,comments:_0x1c496c}of _0x58d69c){_0x5682a6&&!_0x3dbab4['getUser'](_0x5682a6)&&_0x54ebd0['add'](_0x5682a6);for(const {userId:_0xd6c8fe}of _0x1c496c)_0x3dbab4['getUser'](_0xd6c8fe)||_0x54ebd0['add'](_0xd6c8fe);}if(0x0===_0x54ebd0['size'])return;const _0x11439a=await ut['getMany'](_0x2b6354,Array['from'](_0x54ebd0));for(const _0x170c33 of _0x11439a)_0x3dbab4['getUser'](_0x170c33['id'])||_0x3dbab4['addUser'](_0x170c33);}}async function ot(_0x16690b){if('404'!==_0x16690b['code'])throw _0x16690b;}function ft(_0x32f646){if((_0x412774=_0x32f646)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0x412774['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x412774['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0x412774;throw _0x32f646;}function st(_0xbb018b){return{'threadId':_0xbb018b['commentThreadId'],'commentId':_0xbb018b['commentId'],'content':_0xbb018b['content'],'createdAt':_0xbb018b['createdAt'],'authorId':_0xbb018b['userId'],'attributes':_0xbb018b['attributes']||{}};}class m extends _0x5b8bc3{static ['TrackChangesService']=/* #__PURE__ -- @preserve */
|
|
27
|
+
((()=>it)());['_bufferedRequests'];['_trackChangesService'];static get['requires'](){return[s,'TrackChangesEditing',n];}static get['pluginName'](){return'CloudServicesTrackChangesAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x205c56){super(_0x205c56);const _0x1492ea=this['editor']['config']['get']('collaboration.channelId');this['_bufferedRequests']=new Map(),this['_trackChangesService']=new m['TrackChangesService'](_0x1492ea);}['init'](){const _0x5e518f=this['editor']['plugins']['get'](n),_0x20bd68=this['editor']['plugins']['get']('TrackChangesEditing');return _0x20bd68['adapter']={'getSuggestion':async _0x4de951=>{await this['_waitForServiceReady']();const _0x3687fe=await this['_trackChangesService']['get'](_0x4de951)['catch'](nt);return await this['_fetchMissingUsersForThreads']([_0x3687fe]),_0x3687fe;},'addSuggestion':async({id:_0x2b2b45,type:_0x967c29,data:_0x3732cb,originalSuggestionId:_0x5a6e97,attributes:_0x172b95})=>{await this['_waitForServiceReady']();const _0x3232d0={'id':_0x2b2b45,'type':_0x967c29,'data':_0x3732cb,'originalSuggestionId':_0x5a6e97,'attributes':_0x172b95},_0x1ac8cd=await this['_trackChangesService']['add'](_0x2b2b45,_0x967c29,_0x3732cb,_0x5a6e97,_0x172b95)['catch'](_0x7b3a9c=>{if(mt(_0x7b3a9c))return new Promise(_0x40d30b=>{this['_bufferedRequests']['set'](_0x2b2b45,{'resolve':_0x40d30b,'suggestionData':_0x3232d0});});throw _0x7b3a9c;});return this['_bufferedRequests']['delete'](_0x2b2b45),_0x1ac8cd;},'updateSuggestion':async(_0x26fa9d,_0x4fbd33)=>{if(await this['_waitForServiceReady'](),'open'!==_0x4fbd33['state'])return this['_trackChangesService']['update'](_0x26fa9d,_0x4fbd33)['catch'](nt);}},this['listenTo'](this['_trackChangesService'],'suggestionUpdated',(_0x54bb7a,_0x539657)=>{_0x20bd68['hasSuggestion'](_0x539657['id'])&&(_0x20bd68['getSuggestion'](_0x539657['id'])['attributes']=_0x539657['attributes']);}),this['_trackChangesService']['connect'](_0x5e518f['connection'])['then'](_0x4757af=>(_0x5e518f['addToReconnectionStack'](this),this['_fetchMissingUsersForThreads'](_0x4757af)['then'](()=>{for(const _0x29d600 of _0x4757af){_0x20bd68['addSuggestionData'](_0x29d600)['_saved']=!0x0;}})));}async['reconnect'](){const _0x260316=this['editor']['plugins']['get']('TrackChangesEditing'),{connection:_0x20c67c}=this['editor']['plugins']['get'](n),_0x4f5bed=await this['_trackChangesService']['connect'](_0x20c67c);await this['_fetchMissingUsersForThreads'](_0x4f5bed);for(const {suggestionData:_0x120d44,resolve:_0x4a1477}of this['_bufferedRequests']['values']()){let _0xc8c64a=_0x4f5bed['find'](_0x666da2=>_0x666da2['id']===_0x120d44['id']);_0xc8c64a||(_0xc8c64a=await this['_trackChangesService']['add'](_0x120d44['id'],_0x120d44['type'],_0x120d44['data'],_0x120d44['originalSuggestionId'])),_0x4a1477(_0xc8c64a);}for(const _0x531436 of _0x4f5bed)_0x260316['hasSuggestion'](_0x531436['id'])||_0x260316['addSuggestionData'](_0x531436);}async['_waitForServiceReady'](){this['_trackChangesService']['isConnected']||await new Promise(_0x2a7a81=>{this['listenTo'](this['_trackChangesService'],'connected',_0x3c2e63=>{_0x3c2e63['off'](),_0x2a7a81();});});}async['_fetchMissingUsersForThreads'](_0x18d708){const _0xf537bf=this['editor']['plugins']['get'](_0x393929),{connection:_0x1b4fc}=this['editor']['plugins']['get'](n),_0x5bfb88=new Set();for(const {authorId:_0x1c34a3}of _0x18d708)_0xf537bf['getUser'](_0x1c34a3)||_0x5bfb88['add'](_0x1c34a3);if(0x0===_0x5bfb88['size'])return;const _0x38175d=await ut['getMany'](_0x1b4fc,Array['from'](_0x5bfb88));for(const _0x53589c of _0x38175d)_0xf537bf['getUser'](_0x53589c['id'])||_0xf537bf['addUser'](_0x53589c);}}function nt(_0x303a63){if(mt(_0x303a63))return new Promise(()=>{});throw _0x303a63;}function mt(_0x5888f6){return _0x5888f6['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x5888f6['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class g extends _0x5b8bc3{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 _0x174e77=this['editor']['plugins']['get'](n),_0x4e8031=this['editor']['plugins']['get']('CommentsEditing'),_0x1502e5=this['editor']['plugins']['get'](s);return this['editor']['data']['once']('ready',()=>{this['listenTo'](_0x174e77,'change:state',(_0xb0ec4a,_0x1ab70f,_0x3be923)=>{_0x4e8031['isThreadsLoadingPaused']='connected'!==_0x3be923;});}),this['listenTo'](_0x174e77,'change:state',(_0x127961,_0x5d5149,_0x3802b8)=>{this['editor']['plugins']['get']('CommentsRepository')['switchReadOnly']('connected'!==_0x3802b8);}),_0x1502e5['_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 _0x5b8bc3{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 _0x5b8bc3{static ['RevisionHistoryService']=/* #__PURE__ -- @preserve */
|
|
28
|
+
((()=>_0x53bdb2)());['_lastRequestId'];['_revisionTracker'];['_revisionHistoryService'];['_oldOffset'];static get['requires'](){return[n,l,'RevisionHistory',i,_0x393929];}static get['pluginName'](){return'CloudServicesRevisionHistoryAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x35809d){super(_0x35809d);const _0x463e0a=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new c['RevisionHistoryService'](_0x463e0a);}async['init'](){const _0x5617f6=this['editor']['plugins']['get'](l),_0x5146ea=_0x5617f6['serverHistory'],_0x44bf0b=this['editor']['plugins']['get'](n);this['_revisionTracker']['setSource']({'history':_0x5146ea,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0x5617f6['sessionId']});const _0x5557ee=this['editor']['config']['get']('cloudServices.bundleVersion')||ht,_0x2279cc=await _0x242d38['isBundleUploaded'](_0x44bf0b['connection'],_0x5557ee);this['editor']['plugins']['get']('RevisionHistory')['adapter']={'getRevision':async({revisionId:_0x9b5cc0})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0x9b5cc0)),'updateRevisions':async _0x23d638=>{await this['_waitForServiceReady']();const _0x38fa69=this['_revisionTracker']['currentRevision'];if(_0x2279cc&&0x1===_0x23d638['length']&&_0x23d638[0x0]['id']===_0x38fa69['id'])return _0x23d638;for(const _0x42c1fe of _0x23d638)_0x42c1fe['id']===_0x38fa69['id']&&(_0x42c1fe['isEmptyCurrent']=_0x42c1fe['fromVersion']===_0x42c1fe['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0x23d638,this['_lastRequestId'])['then'](_0x284702=>(this['_lastRequestId']=_0x284702,_0x23d638))['catch'](_0x304a11=>{if(P(_0x304a11)||'400'===_0x304a11['code']&&void 0x0!==_0x304a11['data']['wrongRequestId']){for(const _0x180bf5 of _0x23d638){!this['_revisionTracker']['repository']['getRevision'](_0x180bf5['id'])||this['_revisionTracker']['_bufferUpdate'](_0x180bf5['id'],_0x180bf5,!0x1);}if(P(_0x304a11))throw _0x304a11;return _0x23d638;}throw _0x304a11;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0x212156,{revisionsData:_0x5268fa,requestId:_0x5a72cd})=>{Math['max'](..._0x5268fa['map'](_0x44eee6=>_0x44eee6['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0x5268fa,_0x5a72cd);}):this['_handleRevisionsUpdate'](_0x5268fa,_0x5a72cd);});const {revisions:_0x36a978,requestId:_0x44eeb2}=await this['_revisionHistoryService']['connect'](_0x44bf0b['connection']);_0x44bf0b['addToReconnectionStack'](this),this['_lastRequestId']=_0x44eeb2,await this['_fetchMissingUsers'](_0x36a978);for(const _0x43b6e1 of _0x36a978)this['_revisionTracker']['addRevisionData'](_0x43b6e1);this['listenTo'](_0x5617f6,'change:_isConnected',(_0x435256,_0x19ffcf,_0x515cc4)=>{_0x515cc4&&(this['_oldOffset']=_0x5617f6['_offset'],_0x435256['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](_0x44bf0b,'state',_0x849c2=>_0x849c2===_0x4efd76['CONNECTED']);}async['reconnect'](){const _0x29586f=this['editor']['plugins']['get'](n),_0xe04232=this['editor']['plugins']['get'](l),_0x48c150=async()=>{const _0x15c689=this['_revisionTracker']['currentRevision'],_0x21a07e=_0x15c689['id'],_0x37ebe7=_0x21a07e!==_0xe04232['sessionId'];if(_0x37ebe7){const _0x409451=_0xe04232['_offset']-this['_oldOffset'],_0x42cb8c=this['_getLatestVersionFromServerOperations']();this['_revisionTracker']['_revisionDataBuilder']['reInit']();if(_0x15c689['toVersion']+_0x409451!==_0x42cb8c){const _0x7d2dd2=_0x15c689['fromVersion']+_0x409451,_0xd8a07e=this['editor']['plugins']['get'](_0x393929),_0x29359e=this['_revisionTracker']['buildRevisionData']({'revision':_0x15c689,'from':_0x7d2dd2,'to':_0x42cb8c});_0x29359e['id']=_0x15c689['id'];const _0x63aad9=_0x29359e['authorsIds']['map'](_0x49e190=>_0xd8a07e['getUser'](_0x49e190));_0x15c689['_update']({..._0x29359e,'authors':_0x63aad9},!0x0),this['_revisionTracker']['_bufferUpdate'](_0x15c689['id'],_0x29359e,!0x0);}this['_revisionTracker']['_startingVersion']=_0x42cb8c,(_0x15c689['toVersion']===_0x15c689['fromVersion']&&!this['_revisionTracker']['_bufferedUpdates']['has'](_0x21a07e)&&this['_revisionTracker']['repository']['_revisions']['remove'](_0x21a07e),this['_revisionTracker']['_createCurrentRevision'](_0x42cb8c));}const {revisions:_0x29a2ef,requestId:_0x54f1c8}=await this['_revisionHistoryService']['reconnect'](_0x29586f['connection'],this['_lastRequestId']);_0x37ebe7&&_0x29a2ef['length']>0x0?_0xe04232['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x29a2ef),this['_handleRevisionsUpdate'](_0x29a2ef,_0x54f1c8),this['_revisionTracker']['sendBufferedUpdates']());};return _0xe04232['_isConnected']?_0x48c150():new Promise((_0x57ee61,_0x85f62)=>{_0xe04232['once']('change:_isConnected',()=>{_0x48c150()['then'](_0x57ee61)['catch'](_0x85f62);});});}['destroy'](){super['destroy']();}async['_waitForServiceReady'](){this['_revisionHistoryService']['isConnected']||await new Promise(_0x1f07a7=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x2ac3b7=>{_0x2ac3b7['off'](),_0x1f07a7();});});}['_getLatestVersionFromServerOperations'](){const _0x1bef67=this['editor']['plugins']['get'](l)['serverHistory']['getOperations']()['reverse']();for(const _0x1edf6a of _0x1bef67)if('marker'!==_0x1edf6a['type']||_0x1edf6a['affectsData'])return _0x1edf6a['baseVersion']+0x1;}['_getLatestVersion'](){const _0x568809=this['editor']['plugins']['get'](l);return new Promise(_0x44702f=>{_0x568809['_isPendingUpdate']?_0x568809['once']('change:_isPendingUpdate',()=>{_0x44702f(this['_getLatestVersionFromServerOperations']());}):_0x44702f(this['_getLatestVersionFromServerOperations']());});}['_handleRevisionsUpdate'](_0x946ac0,_0x186f0b){const _0x45d485=this['_revisionTracker']['repository'];this['_lastRequestId']=_0x186f0b;for(const _0x3fd053 of _0x946ac0){const _0x1a2967=_0x45d485['getRevision'](_0x3fd053['id']);if(_0x1a2967){if((_0x3fd053['fromVersion']||_0x3fd053['toVersion'])&&(_0x3fd053['diffData']=null),_0x1a2967===this['_revisionTracker']['currentRevision']){const _0x4fe669=Math['max'](_0x1a2967['toVersion'],_0x3fd053['toVersion']),_0x181813=Math['max'](_0x1a2967['fromVersion'],_0x3fd053['fromVersion']);let _0x125c48;_0x1a2967['toVersion']===_0x3fd053['toVersion']&&_0x1a2967['fromVersion']===_0x3fd053['fromVersion']?(_0x125c48=!0x0,this['_preventResendingRevisionData'](_0x3fd053)):_0x3fd053['toVersion']===_0x4fe669&&_0x3fd053['fromVersion']===_0x181813?_0x125c48=!0x1:(_0x1a2967['toVersion']===_0x4fe669&&_0x1a2967['fromVersion']===_0x181813||this['_fixRevision']({'revision':_0x1a2967,'from':_0x181813,'to':_0x4fe669}),_0x125c48=!0x0),_0x125c48&&(delete _0x3fd053['fromVersion'],delete _0x3fd053['toVersion'],delete _0x3fd053['diffData'],delete _0x3fd053['createdAt'],delete _0x3fd053['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0x3fd053),this['_preventResendingRevisionData'](_0x3fd053);}else this['_revisionTracker']['addRevisionData'](_0x3fd053);}const _0x1bf4dc=_0x45d485['getRevisions']();_0x1bf4dc['reverse']();for(let _0x17cd81=0x0;_0x17cd81<_0x1bf4dc['length']-0x1;_0x17cd81++){const _0x17e397=_0x1bf4dc[_0x17cd81],_0x542932=_0x1bf4dc[_0x17cd81+0x1];if(_0x17e397['fromVersion']<_0x542932['toVersion']){const _0x7536fe=_0x542932['toVersion'],_0x16ca53=Math['max'](_0x7536fe,_0x17e397['toVersion']);this['_fixRevision']({'revision':_0x17e397,'from':_0x7536fe,'to':_0x16ca53});}}}['_fixRevision']({revision:_0x4fe291,from:_0xe38ccd,to:_0x82589}={}){const _0x2d0dda=this['editor']['plugins']['get'](_0x393929),_0x552ea2=this['_revisionTracker']['buildRevisionData']({'revision':_0x4fe291,'from':_0xe38ccd,'to':_0x82589});_0x552ea2['authors']=_0x552ea2['authorsIds']['map'](_0x3c7671=>_0x2d0dda['getUser'](_0x3c7671)),_0x4fe291['_update'](_0x552ea2);}['_preventResendingRevisionData'](_0x4d510c){const _0x468b38={};_0x468b38['id']=_0x4d510c['id'];for(const _0xdf8d72 of Object['keys'](_0x4d510c))'id'!==_0xdf8d72&&(_0x468b38[_0xdf8d72]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0x468b38['id'],_0x468b38,!0x0);}async['_fetchMissingUsers'](_0x340d96){const _0x20cc45=this['editor']['plugins']['get'](_0x393929),{connection:_0x3fcf91}=this['editor']['plugins']['get'](n),_0x18688d=new Set();for(const _0x139c20 of _0x340d96){for(const _0x37c0ae of _0x139c20['authorsIds'])_0x17ab2d(_0x37c0ae);_0x139c20['creatorId']&&_0x17ab2d(_0x139c20['creatorId']);}if(0x0===_0x18688d['size'])return;const _0x4d3d5c=await ut['getMany'](_0x3fcf91,Array['from'](_0x18688d));for(const _0x1877bb of _0x4d3d5c)_0x20cc45['getUser'](_0x1877bb['id'])||_0x20cc45['addUser'](_0x1877bb);function _0x17ab2d(_0x3293b1){_0x20cc45['getUser'](_0x3293b1)||_0x18688d['add'](_0x3293b1);}}}function P(_0x1e640b){return _0x1e640b['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0x1e640b['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x1e640b['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class gt extends _0x5b8bc3{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 _0x4e32f2{['_collapseAt'];constructor(_0x3a0436,_0x5bfae6=0x6){super(_0x3a0436);const _0x60773=this['bindTemplate'];this['set']('isHidden',!0x0),this['set']('usersCount',0x0),this['_collapseAt']=_0x5bfae6,this['bind']('isHidden')['to'](this,'usersCount',_0x10ba7f=>_0x10ba7f<_0x5bfae6),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item',_0x60773['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':_0x60773['to']('usersCount',_0x636827=>'+'+(_0x636827-this['_collapseAt']+0x2)['toString']())}]}]}]});}}class is extends _0x4e32f2{['items'];['keystrokes'];constructor(_0x3a0ddc){super(_0x3a0ddc);const _0x5e91db=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0x5e36a4(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0x5e91db['if']('hasPopup'),'aria-expanded':_0x5e91db['to']('isExpanded',_0x4be7c9=>this['hasPopup']&&String(_0x4be7c9)),'aria-label':_0x5e91db['to']('hasPopup',_0x26dcc6=>V(_0x3a0ddc,_0x26dcc6?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0x5e91db['to']('hasPopup',_0x5438db=>!!_0x5438db&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items'],'on':{'mouseenter':_0x5e91db['to'](()=>this['fire']('presencelist:show')),'mouseleave':_0x5e91db['to'](_0x226248=>{const _0x2bec9a=_0x226248,_0xb097c4=document['querySelector']('.ck-presence-list__dropdown-list'),_0x621590=document['querySelector']('.ck-balloon-panel_with-arrow');_0xb097c4?.['contains'](_0x2bec9a['relatedTarget'])||_0x621590?.['contains'](_0x2bec9a['relatedTarget'])||this['fire']('presencelist:hide');})}}),this['on']('change:hasPopup',(_0x23748b,_0x5cda88,_0x349454)=>{this['element']&&(_0x349454?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 _0x4e32f2{['counterView'];['inlineListView'];constructor(_0x54120c,_0x5a1608=0x6){super(_0x54120c);const _0x418545=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new b(this['locale'],_0x5a1608),this['inlineListView']=new is(_0x54120c),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x5d3f5c of this['inlineListView']['items'])_0x5d3f5c['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',_0x418545['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['inlineListView']]});}}class L extends _0x4e32f2{['listWrapperView'];constructor(_0x4b86e1,_0x29f059){super(_0x4b86e1);const _0x52a054=this['bindTemplate'];this['listWrapperView']=new wt(_0x4b86e1,_0x29f059),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':V(_0x4b86e1,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']],'on':{'mouseleave':_0x52a054['to'](_0x5e7b17=>{const _0x37f3b8=_0x5e7b17,_0x4f8291=document['querySelector']('.ck-presence-list__list'),_0x2f4341=document['querySelector']('.ck-balloon-panel_with-arrow');_0x4f8291?.['contains'](_0x37f3b8['relatedTarget'])||_0x2f4341?.['contains'](_0x37f3b8['relatedTarget'])||this['fire']('presencelist:hide');})}});}}class wt extends _0x478f63{constructor(_0xf14fd8,_0x984efb){super(_0xf14fd8);const _0x3962ba=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0x984efb?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0x3962ba['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0x3962ba['to']('role'),'aria-label':_0x3962ba['to']('ariaLabel'),'aria-labelledby':_0x3962ba['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0x21a1a4['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0x4bc672=this['element'];_0x4bc672&&(this['_isScrollable']=Math['max'](_0x4bc672['scrollHeight'],_0x4bc672['clientHeight'])>0.8*window['innerHeight']);}}class j extends rt{['userView'];constructor(_0xd74dcb,_0x5ceedc,_0x487a85){super(_0xd74dcb);const _0xcc373=this['bindTemplate'];this['userView']=new ct(_0xd74dcb,_0x5ceedc);const _0x487e01={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0x5ceedc['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0x5ceedc['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x5ceedc['color']['getBackgroundColorClass']()],'aria-hidden':'true'}}]};_0x487a85&&(_0x487e01['tag']='button',_0x487e01['on']={'click':_0xcc373['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x487e01);}['focus'](){this['element']['focus']();}}class A extends _0x4e32f2{['userView'];['markerView'];constructor(_0xb3b926,_0x343d23,_0x543049){super(_0xb3b926);const _0x3ca392=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new ct(_0xb3b926,_0x343d23),this['markerView']=new lt(_0xb3b926,_0x343d23);const _0x56f960=new at(_0xb3b926);_0x56f960['template']['tag']='span',_0x56f960['text']=_0x343d23['name'];const _0x3e6bc4={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0x3ca392['to']('isFocusable',_0xd61501=>!!_0xd61501&&0x0),'aria-labelledby':_0x56f960['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0x3ca392['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0x3ca392['to']('hasTooltip',_0x32e45e=>!_0x32e45e),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0x56f960]};_0x543049&&(_0x3e6bc4['tag']='button',_0x3e6bc4['on']={'click':_0x3ca392['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x3e6bc4);}}class lt extends _0x4e32f2{constructor(_0x58a9eb,_0xc6c51f){super(_0x58a9eb),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0xc6c51f['color']['getBackgroundColorClass']()],'aria-hidden':'true'}});}}const x={'collapseAt':0x6,'displayMe':!0x0};class r extends _0x1861c7{['currentDisplayedUsers'];['balloonPanelView'];['view'];['presenceDropdownView'];['_bodyCollection']=null;static get['pluginName'](){return'PresenceListUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x597c2d){super(_0x597c2d),this['context']['config']['define']('presenceList',x);const _0x19cd93=_0x597c2d['config']['get']('presenceList.collapseAt');if('number'!=typeof _0x19cd93)throw new _0x3a0d6c('presencelist-collapseat-invalid-format',this);if(_0x19cd93<0x1)throw new _0x3a0d6c('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](i)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0x4fdafc(),this['balloonPanelView']=new _0x55c17c(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get['requires'](){return[i];}['init'](){for(const _0x4edff8 of this['_allConnectedUsers'])this['_handleUserAdd'](_0x4edff8);this['listenTo'](this['_allConnectedUsers'],'add',(_0xe9dea7,_0x3eef36)=>{this['_handleUserAdd'](_0x3eef36);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0x376d17,_0x495e08)=>{this['_handleUserRemove'](_0x495e08);});}['_createView'](){const _0x4d1b41=this['context'],_0x5a0dee=new v(this['context']['locale'],this['context']['config']['get']('presenceList.collapseAt')),_0x30079e=this['balloonPanelView'];if(!_0x4d7729(_0x4d1b41['config']['get']('presenceList.container')))throw new _0x3a0d6c('presencelist-missing-container',this);return _0x5a0dee['counterView']['bind']('usersCount')['to'](this),_0x5a0dee['bind']('isCollapsed')['to'](this,'usersCount',_0x2a9dce=>{const {collapseAt:_0xafd8d3}=_0x4d1b41['config']['get']('presenceList'),_0x39c59f=_0x2a9dce>=_0xafd8d3;if(_0x39c59f&&!_0x5a0dee['inlineListView']['items']['find'](_0x272ebe=>_0x272ebe instanceof b)){const _0x140e85=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['currentDisplayedUsers']['length']==_0x140e85&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](this['currentDisplayedUsers']['length']-0x1),_0x5a0dee['inlineListView']['items']['add'](_0x5a0dee['counterView']);}return _0x39c59f||this['hideDropdown'](),_0x39c59f;}),_0x5a0dee['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0x1b3ff5=>{const _0x4db9c1=_0x4d1b41['config']['get']('presenceList'),_0x28afac=new A(_0x4d1b41['locale'],_0x1b3ff5,!!_0x4db9c1['onClick']);return _0x28afac['bind']('hasTooltip')['to'](_0x5a0dee,'isCollapsed',_0x2d8e36=>!_0x2d8e36),_0x28afac['bind']('isFocusable')['to'](_0x5a0dee,'isCollapsed',_0x352dbe=>!_0x352dbe),_0x4db9c1['onClick']&&this['listenTo'](_0x28afac,'execute',()=>{this['view']['isCollapsed']||_0x4db9c1['onClick'](_0x1b3ff5,_0x28afac['element']);}),_0x28afac;}),this['listenTo'](_0x5a0dee['inlineListView'],'presencelist:show',()=>{this['view']['isCollapsed']&&this['showDropdown']();}),this['listenTo'](_0x5a0dee['inlineListView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();}),_0x5a0dee['inlineListView']['keystrokes']['set']('Enter',(_0x2a50eb,_0x276da6)=>{this['view']['isCollapsed']&&(this['showDropdown'](),_0x276da6());}),_0x5a0dee['render'](),_0x30079e['render'](),_0x33581a({'emitter':_0x5a0dee,'activator':()=>_0x30079e['isVisible'],'contextElements':[_0x30079e['element'],_0x5a0dee['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0x4d1b41['config']['get']('presenceList.container')['appendChild'](_0x5a0dee['element']),this['_bodyCollection']=new _0x20fbe5(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_bodyCollection']['add'](this['balloonPanelView']),_0x5a0dee;}['_handleUserAdd'](_0x365a2f){if(!this['context']['config']['get']('presenceList.displayMe')&&_0x365a2f['isMe'])return;const _0x14211e=this['context']['config']['get']('presenceList.collapseAt')-0x1;for(this['usersCount']++;this['currentDisplayedUsers']['length']>=_0x14211e-(this['view']['isCollapsed']?0x1:0x0)&&this['currentDisplayedUsers']['length']>0x1;)this['currentDisplayedUsers']['remove'](0x1);const _0x3fb968=_0x365a2f['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0x365a2f,_0x3fb968);}['_handleUserRemove'](_0xc2e33d){this['usersCount']--;const {collapseAt:_0x3bc504}=this['context']['config']['get']('presenceList'),_0x53fb06=this['usersCount']>=_0x3bc504;if(this['currentDisplayedUsers']['get'](_0xc2e33d['id']))this['currentDisplayedUsers']['remove'](_0xc2e33d['id']);else{if(_0x53fb06&&this['currentDisplayedUsers']['length']+0x1===_0x3bc504-0x1)return;}if(this['currentDisplayedUsers']['length']+(_0x53fb06?0x1:0x0)<this['usersCount']){for(const _0x1a1c24 of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0x1a1c24['id'])&&(this['currentDisplayedUsers']['add'](_0x1a1c24,Math['min'](this['currentDisplayedUsers']['length']-(_0x53fb06?0x1:0x0),0x1)),this['currentDisplayedUsers']['length']+(_0x53fb06?0x1:0x0)===_0x3bc504-0x1))return;}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0x4fb8b0=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new L(this['context']['locale'],!!_0x4fb8b0['onClick']),this['view']['inlineListView']['isExpanded']=!0x0,this['listenTo'](this['presenceDropdownView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();});const {listWrapperView:_0xab445f}=this['presenceDropdownView'];_0xab445f['items']['bindTo'](this['_allConnectedUsers'])['using'](_0x5bf459=>{if(!_0x4fb8b0['displayMe']&&_0x5bf459['isMe'])return null;const _0x5f48ad=new j(this['context']['locale'],_0x5bf459,!!_0x4fb8b0['onClick']);return _0x4fb8b0['onClick']&&this['listenTo'](_0x5f48ad,'execute',()=>{_0x4fb8b0['onClick'](_0x5bf459,_0x5f48ad['element']);}),_0x5f48ad;}),this['balloonPanelView']['content']['add'](this['presenceDropdownView']),this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element']}),_0xab445f['focus'](),_0xab445f['checkIfScrollable']();const _0xffa0c=(_0x513948,_0x31794f)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0x31794f();};_0xab445f['keystrokes']['set']('Esc',_0xffa0c),_0xab445f['keystrokes']['set']('Shift+Tab',_0xffa0c),_0xab445f['keystrokes']['set']('Tab',(_0x439f68,_0xcf6966)=>{!function(_0x52a948){const _0x45ffe1=['a','button','input','select','textarea','[tabindex]','[contenteditable]']['map'](_0x5ead6c=>_0x5ead6c+':not([disabled]):not([tabindex=\x22-1\x22])')['join'](','),_0x21e0c9=[...document['body']['querySelectorAll'](_0x45ffe1)]['filter'](_0x50ce3c=>_0x50ce3c===document['activeElement']||_0x50ce3c['offsetWidth']+_0x50ce3c['offsetHeight']>0x0)['sort']((_0x1e36eb,_0x34ea06)=>(_0x1e36eb['tabIndex']||0x0)-(_0x34ea06['tabIndex']||0x0)),_0x424caf=_0x21e0c9['indexOf'](_0x52a948),_0x1a699b=_0x21e0c9[(_0x424caf+0x1)%_0x21e0c9['length']];_0x1a699b&&_0x1a699b['focus']();}(this['view']['element']),this['hideDropdown'](),_0xcf6966();}),_0xab445f['focusTracker']['add'](this['view']['element']),_0xab445f['focusTracker']['on']('change:isFocused',(_0x32cd5d,_0x3af20e,_0x35f527)=>{_0x35f527||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 _0x1861c7{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};
|