@ckeditor/ckeditor5-real-time-collaboration 45.2.1-alpha.1 → 45.2.1-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/real-time-collaboration.js +1 -1
- package/dist/index.js +6 -6
- package/package.json +14 -14
- package/src/presencelist/view/presencedropdownlistitemview.js +1 -1
- package/src/presencelist/view/presencedropdownlistview.js +1 -1
- package/src/presencelist/view/presenceinlinelistitemview.js +1 -1
- package/src/presencelist/view/presenceinlinelistview.js +1 -1
- package/src/realtimecollaborativecomments/cloudservicescommentsadapter.js +2 -2
- package/src/realtimecollaborativeediting/realtimecollaborationclient.js +2 -2
- package/src/realtimecollaborativeediting/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
|
-
((()=>lt)());static ['initialReconnectionInterval']=0x3e8;['connection'];['_reconnectionStack'];['_shouldPluginsReconnect'];['_domEmitter'];static get['requires'](){return['CloudServices',_0x596579];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x210894){super(_0x210894),this['set']('state',_0x3ee2f1['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=Object['create'](_0x10dc1e);}['init'](){const _0x11e8a7=this['context'],_0x2daceb=_0x11e8a7['plugins']['get']('CloudServices'),_0x22a49d=_0x11e8a7['plugins']['get'](_0x596579);if(!_0x2daceb['token'])throw new _0x34a1d8('websocketgateway-missing-token',this);if(!_0x2daceb['webSocketUrl'])throw new _0x34a1d8('websocketgateway-missing-websocket-url',this);return this['_domEmitter']['listenTo'](window,'offline',()=>this['_isBrowserOffline']=!0x0),this['_domEmitter']['listenTo'](window,'online',()=>this['_isBrowserOffline']=!0x1),this['context']['config']['define']('cloudServices.connectionTimeout',0xa),this['context']['config']['define']('cloudServices.requestTimeout',0x14),c['WebSocketGateway']['connect'](_0x2daceb['token'],_0x2daceb['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0x2265b3=>{if(this['connection']=_0x2265b3,this['bind']('state')['to'](_0x2265b3,'state',this,'_isBrowserOffline',(_0x18cf51,_0x419476)=>('connected'!==_0x18cf51&&(this['_shouldPluginsReconnect']=!0x0),_0x419476||_0x18cf51!==_0x3ee2f1['CONNECTED']?_0x3ee2f1['DISCONNECTED']:this['state']==_0x3ee2f1['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),_0x3ee2f1['CONNECTING']):_0x3ee2f1['CONNECTED'])),this['connection']['on']('error',(_0x3b6854,_0x20acea)=>{if('limitExceeded'!==_0x20acea['code'])throw console['error'](_0x20acea),new _0x34a1d8('cloudservices-init',null,{'originalError':_0x20acea});_0x22a49d['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'});}),!_0x2265b3['me'])return new Promise(_0x37b7ae=>_0x2265b3['on']('change:me',_0x37b7ae));})['catch'](_0x1fd204=>{throw console['error'](_0x1fd204),new _0x34a1d8('cloudservices-init',null,{'originalError':_0x1fd204});});}['addToReconnectionStack'](_0x4c6f9d){if('function'!=typeof _0x4c6f9d['reconnect'])throw new _0x34a1d8('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0x4c6f9d))throw new _0x34a1d8('websocketgateway-plugin-already-registered',this,{'name':_0x4c6f9d['constructor']['pluginName']});this['_reconnectionStack']['add'](_0x4c6f9d);}['removeFromReconnectionStack'](_0x5e98b7){this['_reconnectionStack']['delete'](_0x5e98b7);}['isInReconnectionStack'](_0x4465b0){return this['_reconnectionStack']['has'](_0x4465b0);}['_reconnect'](){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0x5e4b30=>_0x5e4b30['reconnect']())))['then'](()=>this['state']=_0x3ee2f1['CONNECTED'])['catch'](_0xb03469=>{throw console['error'](_0xb03469),new _0x34a1d8('cloudservices-reconnection-error',this['context']);});}['disconnect'](){this['connection']&&this['connection']['disconnect'](),this['state']=_0x3ee2f1['DISCONNECTED'],this['_domEmitter']['stopListening']();}['destroy'](){this['disconnect'](),super['destroy']();}}class i extends _0x4692aa{['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[c,_0x7c90bc];}constructor(_0x557846){super(_0x557846),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0x69de36(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x7c90bc);}['init'](){const _0x5c5ff2=this['context']['plugins']['get'](c);this['listenTo'](_0x5c5ff2,'change:state',(_0x1b69fe,_0x562994,_0x2eb748)=>{if('connected'!==_0x2eb748)this['channelSessions']['forEach'](_0x5252e7=>_0x5252e7['clear']()),this['channelConnectedUsers']['forEach'](_0x467b79=>_0x467b79['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x5e13c0,_0x59749e]of this['_registeredSessions'])for(const _0x20d6f5 of _0x59749e)this['_handleSessionAdd'](_0x5e13c0,_0x20d6f5);}}),this['_createUser'](_0x5c5ff2['connection']['me'],!0x0);}['register'](_0x3ff7fb,_0x4fbe72){if(this['_registeredSessions']['has'](_0x3ff7fb))throw new _0x34a1d8('sessions-register-already-registered',null,{'channelId':_0x3ff7fb});this['_registeredSessions']['set'](_0x3ff7fb,_0x4fbe72),this['channelSessions']['set'](_0x3ff7fb,new _0x69de36()),this['channelConnectedUsers']['set'](_0x3ff7fb,new _0x69de36()),this['listenTo'](_0x4fbe72,'add',(_0x10ec17,_0x4c5298)=>this['_handleSessionAdd'](_0x3ff7fb,_0x4c5298)),this['listenTo'](_0x4fbe72,'remove',(_0x52cee2,_0x4b64aa)=>this['_handleSessionRemove'](_0x3ff7fb,_0x4b64aa));for(const _0x599128 of _0x4fbe72)this['_handleSessionAdd'](_0x3ff7fb,_0x599128);}['unregister'](_0x426e00){if(!this['_registeredSessions']['has'](_0x426e00))throw new _0x34a1d8('sessions-unregister-not-exist',null,{'channelId':_0x426e00});const _0x5a070f=this['_registeredSessions']['get'](_0x426e00);this['stopListening'](_0x5a070f);for(const _0x82da4a of _0x5a070f)'connected'===this['context']['plugins']['get'](c)['state']&&this['_handleSessionRemove'](_0x426e00,_0x82da4a);this['_registeredSessions']['delete'](_0x426e00),this['channelSessions']['delete'](_0x426e00),this['channelConnectedUsers']['delete'](_0x426e00);}get['mySessionId'](){return this['context']['plugins']['get'](c)['connection']['sessionId'];}['getUserBySessionId'](_0x102ec2){for(const _0x18f0b6 of this['channelSessions']['values']())for(const _0x4f094b of _0x18f0b6)if(_0x4f094b['id']===_0x102ec2)return _0x4f094b['user'];}['getUserSessions'](_0x22c1b3,_0x3c80a7){const _0x417975=_0x3c80a7?[this['channelSessions']['get'](_0x3c80a7)]:this['channelSessions']['values'](),_0x5879fd=new Set();for(const _0x3d34be of _0x417975)for(const _0x421aa3 of _0x3d34be)_0x421aa3['user']['id']===_0x22c1b3['id']&&_0x5879fd['add'](_0x421aa3['id']);return _0x5879fd;}['getUserRole'](_0x258c42){for(const _0x3efcd2 of this['channelSessions']['values']())for(const _0x3b3a30 of _0x3efcd2)if(_0x3b3a30['user']===_0x258c42)return _0x3b3a30['role'];}['_handleSessionAdd'](_0x4a69a3,_0x1f29b3){if('connected'!==this['context']['plugins']['get'](c)['state'])return;const _0x5a6592=_0x1f29b3['user'],_0x28845e=this['_users']['getUser'](_0x5a6592['id'])||this['_createUser'](_0x5a6592),_0x3274cc=Object['assign']({},_0x1f29b3,{'user':_0x28845e});this['channelSessions']['get'](_0x4a69a3)['add'](_0x3274cc);const _0x4c076b=this['channelConnectedUsers']['get'](_0x4a69a3);_0x4c076b['has'](_0x28845e['id'])||_0x4c076b['add'](_0x28845e),this['allConnectedUsers']['has'](_0x28845e['id'])||this['allConnectedUsers']['add'](_0x28845e,_0x28845e['isMe']?0x0:void 0x0),this['fire']('sessionAdd:'+_0x4a69a3,{'channelId':_0x4a69a3,'session':_0x3274cc});}['_handleSessionRemove'](_0x3b2a23,_0x46d9ae){if('connected'!==this['context']['plugins']['get'](c)['state'])return;const _0x30d0fc=this['channelConnectedUsers']['get'](_0x3b2a23),_0x4a08e7=_0x46d9ae['user'];_0x4a08e7['id']&&(this['channelSessions']['get'](_0x3b2a23)['remove'](_0x46d9ae['id']),_0x30d0fc['has'](_0x4a08e7['id'])&&!this['getUserSessions'](_0x4a08e7,_0x3b2a23)['size']&&_0x30d0fc['remove'](_0x4a08e7['id']),this['allConnectedUsers']['get'](_0x4a08e7['id'])&&!this['getUserSessions'](_0x4a08e7)['size']&&this['allConnectedUsers']['remove'](_0x4a08e7['id']));}['_createUser'](_0x4f1510,_0x263e7b){const _0x266b12=this['_users']['addUser'](_0x4f1510);return _0x263e7b&&this['_users']['defineMe'](_0x4f1510['id']),_0x266b12['orderNumber']=this['_uniqueUsersCount']++,_0x266b12;}}class q extends _0x8177c2{['_domEmitter']=new(_0x10dc1e())();static get['requires'](){return[i];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x91abc0=this['editor'],_0x2296a0=_0x91abc0['plugins']['get'](i);_0x91abc0['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x1868d9,{writer:_0x3aceb5})=>function(_0x52ea7a,_0x4dc25d,_0x4585e2,_0x3df8d8){const _0xfe68ed=_0x52ea7a['markerName']['split'](':')[0x2],_0xcab62=_0x4585e2['getUserBySessionId'](_0xfe68ed);if(!_0xcab62||_0xfe68ed===_0x4585e2['mySessionId'])return;if(!_0x3df8d8['model']['schema']['checkChild'](_0x52ea7a['markerRange']['start'],'$text'))return;const _0x253388={'class':'ck-user__marker\x20'+_0xcab62['color']['getMarkerClass'](),'data-name':_0xcab62['name'],'data-session-id':_0xfe68ed},_0xd5f377=_0x3df8d8['model']['markers']['get'](_0x52ea7a['markerName']),_0x16d346=_0xd5f377['getStart'](),_0x1365a5=_0x16d346['nodeAfter'],_0x29ee9e=_0x3df8d8['model']['schema'];if(_0x1365a5&&_0x29ee9e['isObject'](_0x1365a5)&&_0x29ee9e['isInline'](_0x1365a5)&&!_0x3df8d8['model']['markers']['get']('user:range:'+_0xfe68ed)['getRange']()['isCollapsed'])return;const _0xf1fab4=_0x16d346['parent'];return _0x3df8d8['model']['schema']['isLimit'](_0xf1fab4)&&!_0x3df8d8['model']['hasContent'](_0xf1fab4)&&(_0x253388['contenteditable']=!0x1),function(_0x983538,_0x486e31,_0x28b575){const _0x23bb46=_0x983538['createUIElement']('span',_0x486e31);return _0x983538['setCustomProperty']('userPositionMarker',!0x0,_0x23bb46),_0x23bb46['render']=function(_0x72de06){const _0x3197ff=this['toDomElement'](_0x72de06),_0x5a1370=document['createElement']('span');return _0x5a1370['classList']['add']('ck-user__marker-tooltip'),_0x5a1370['setAttribute']('contenteditable','false'),_0x5a1370['setAttribute']('spellcheck','false'),_0x5a1370['textContent']=_0x28b575['name'],_0x3197ff['innerHTML']='<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span>'+_0x5a1370['outerHTML']+'',_0x3197ff['addEventListener']('mouseenter',()=>{_0x3197ff['classList']['add']('ck-user__marker_hovered');}),_0x3197ff['addEventListener']('mouseleave',()=>{_0x3197ff['classList']['remove']('ck-user__marker_hovered');}),_0x3197ff;},_0x23bb46['isSimilar']=function(_0xd049b){return!(!this['getCustomProperty']('userPositionMarker')||!_0xd049b['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0xd049b['getAttribute']('data-session-id'));},_0x23bb46;}(_0x4dc25d,_0x253388,_0xcab62);}(_0x1868d9,_0x3aceb5,_0x2296a0,_0x91abc0)}),_0x91abc0['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0x2be07f=>function(_0x560ed6,_0x357f8a){const _0x3aec62=_0x560ed6['markerName']['split'](':')[0x2];if(_0x3aec62===_0x357f8a['mySessionId'])return null;const _0x53bb12=_0x357f8a['getUserBySessionId'](_0x3aec62);if(!_0x53bb12)return{'id':_0x3aec62,'classes':[]};return{'id':_0x3aec62,'classes':['ck-user__selection',_0x53bb12['color']['getSelectionClass']()],'attributes':{'data-session-id':_0x3aec62},'priority':0x7d0+_0x53bb12['orderNumber']};}(_0x2be07f,_0x2296a0)}),function(_0x8850cc){const _0x3d72f7=_0x8850cc['model'],_0x227270=new Map(),_0x7f5f8a=_0x8850cc['plugins']['get'](i);_0x3d72f7['markers']['on']('update:user:range',(_0x2f8258,_0x31c0ae,_0x24f239,_0x77a208)=>{if(!_0x77a208&&_0x227270['get'](_0x31c0ae['name']))return _0x227270['get'](_0x31c0ae['name'])['detach'](),void _0x227270['delete'](_0x31c0ae['name']);const _0x3105d6=_0x31c0ae['name']['split'](':')[0x2];if(_0x3105d6===_0x7f5f8a['mySessionId'])return;const _0x5723da='user:position:'+_0x3105d6;_0x3d72f7['markers']['has'](_0x5723da)&&_0x8850cc['editing']['reconvertMarker'](_0x5723da),_0x31c0ae['on']('change:range',(_0x32bc0b,_0x1763e8,_0x216333)=>{if('$graveyard'!=_0x1763e8['root']['rootName']&&'$graveyard'==_0x31c0ae['getRange']()['root']['rootName']&&!_0x227270['has'](_0x31c0ae['name'])){const _0x2a5298=_0x3d72f7['schema']['getNearestSelectionRange'](_0x216333['deletionPosition']);if(_0x2a5298){const _0x59cf5e=ht['fromRange'](_0x2a5298);_0x227270['set'](_0x31c0ae['name'],_0x59cf5e),_0x59cf5e['on']('change:range',(_0x4870aa,_0x5b4bb7,_0x26e3a4)=>{if('$graveyard'==_0x59cf5e['root']['rootName']){const _0x4eff03=_0x3d72f7['schema']['getNearestSelectionRange'](_0x26e3a4['deletionPosition']);_0x4eff03?(_0x59cf5e['start']=_0x4eff03['start'],_0x59cf5e['end']=_0x4eff03['end']):(_0x227270['delete'](_0x31c0ae['name']),_0x59cf5e['detach']());}});}}});}),_0x3d72f7['document']['on']('change',()=>{_0x227270['size']>0x0&&_0x3d72f7['enqueueChange']({'isUndoable':!0x1},_0xdedac7=>{for(const [_0x4670b1,_0x214d28]of _0x227270)'$graveyard'==_0x3d72f7['markers']['get'](_0x4670b1)['getRange']()['root']['rootName']&&(te(_0x4670b1['split'](':')[0x2],_0x214d28['toRange'](),_0x3d72f7,_0xdedac7),_0x214d28['detach']());_0x227270['clear']();});});}(_0x91abc0),this['_domEmitter']['listenTo'](_0x57a247['document'],'keydown',(_0x3c1e3f,{key:_0x5839e7})=>{'Escape'===_0x5839e7&&function(_0x2cf716){_0x2cf716['editing']['view']['change'](_0x3730c2=>{for(const _0x264683 of _0x2cf716['model']['markers']){if(!_0x264683['name']['startsWith']('user:position'))continue;const _0x3e4f15=_0x2cf716['editing']['mapper']['markerNameToElements'](_0x264683['name']);if(_0x3e4f15){for(const _0x4e7e63 of _0x3e4f15)_0x3730c2['removeClass']('ck-user__marker_hovered',_0x4e7e63);}}});}(_0x91abc0);},{'useCapture':!0x0});}['afterInit'](){const _0x322c4a=this['editor'],_0x3801da=_0x322c4a['commands']['get']('undo');_0x3801da&&_0x322c4a['model']['on']('applyOperation',(_0x5f2665,_0x4e1925)=>{const _0x5be710=_0x4e1925[0x0];if(!_0x5be710['isDocumentOperation'])return;if('marker'!=_0x5be710['type']||!_0x5be710['name']['startsWith']('user:'))return;const _0x6c83c2=_0x5be710['batch'];_0x3801da['_createdBatches']['has'](_0x6c83c2)&&(_0x5be710['newRange']=_0x5be710['oldRange']?_0x322c4a['model']['createRange'](_0x5be710['oldRange']['start'],_0x5be710['oldRange']['end']):null);},{'priority':'highest'});}['destroy'](){return this['_domEmitter']['stopListening'](),super['destroy']();}['createUserMarkerOperations'](){const _0x37baec=this['editor'],_0x35ea25=_0x37baec['model']['document'],_0x3ec3fe=_0x37baec['plugins']['get'](i);_0x37baec['model']['enqueueChange']({'isUndoable':!0x1},_0x388aa8=>{const _0x2ab024='user:range:'+_0x3ec3fe['mySessionId'],_0x58304a='user:position:'+_0x3ec3fe['mySessionId'],_0x5cbd01=_0x37baec['model']['markers']['has'](_0x2ab024);_0x37baec['editing']['view']['hasDomSelection']?te(_0x3ec3fe['mySessionId'],_0x35ea25['selection']['getFirstRange'](),_0x37baec['model'],_0x388aa8):_0x5cbd01&&(_0x388aa8['removeMarker'](_0x2ab024),_0x388aa8['removeMarker'](_0x58304a));});}}function te(_0x470f59,_0x3bc30f,_0x1f207b,_0x58132a){const _0x22fab9='user:range:'+_0x470f59,_0x2376ec='user:position:'+_0x470f59,_0x413174=_0x3bc30f['getContainedElement']();let _0xf13a01=_0x3bc30f['start'];if(_0x413174&&_0x413174['is']('element','tableCell')){const _0x176c29=function(_0x57bd84,_0x1ab082){for(const _0x498392 of _0x57bd84['getPositions']())if(_0x1ab082['schema']['checkChild'](_0x498392,'$text'))return _0x498392;}(_0x3bc30f,_0x1f207b);_0x176c29&&(_0xf13a01=_0x176c29,_0x3bc30f=_0x58132a['createRange'](_0xf13a01));}const _0xa74079=_0x58132a['createRange'](_0xf13a01);_0x1f207b['markers']['has'](_0x22fab9)?(_0x58132a['updateMarker'](_0x22fab9,{'range':_0x3bc30f}),_0x58132a['updateMarker'](_0x2376ec,{'range':_0xa74079})):(_0x58132a['addMarker'](_0x22fab9,{'range':_0x3bc30f,'usingOperation':!0x0}),_0x58132a['addMarker'](_0x2376ec,{'range':_0xa74079,'usingOperation':!0x0}));}function G(_0xe522c9,_0xa51f7d,_0x1a21cb){const _0x22b4b8=_0xe522c9['t'],t=_0xe522c9['t'];switch(_0xa51f7d){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 _0x22b4b8({'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'},_0x1a21cb);default:return'';}}let J=0x1;class l extends _0x8177c2{static ['CollaborativeEditingService']=/* #__PURE__ -- @preserve */
|
|
25
|
-
((()=>_0x4922e9)());['_offset'];['sessionId'];['serverHistory'];['_channelId'];['_service'];['_document'];['_compressor'];['_bufferedOperations'];['_knownOperations'];['_knownRootNames'];['_pendingAction'];['_hasSelectionChanged'];['_sendBufferedOperationsDelayId'];['_baseBufferDelay'];['_currentBufferDelay'];['_lastSyncedOperationId'];['_disconnectionOperations'];['_operationIdentifier'];static get['requires'](){return[c,i,q,_0xf7fbb9,_0x7c90bc,_0x596579];}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 _0x2b82bb=this['serverHistory']['getOperations']();for(let _0x24a4c9=_0x2b82bb['length']-0x1;_0x24a4c9>=0x0;_0x24a4c9--){const _0x3944b2=_0x2b82bb[_0x24a4c9];if(!this['_disconnectionOperations']['has'](_0x3944b2))return _0x3944b2['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0x2a1e94){if(super(_0x2a1e94),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x1c8f10(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0x34a1d8('collaboration-missing-channelid',this);const _0x2db9c3=_0x2a1e94['config']['get']('cloudServices.bundleVersion')||nt;this['_service']=new l['CollaborativeEditingService'](_0x2db9c3,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0x1d88de(),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 Y(this['_disconnectionOperations']);}['init'](){const _0x354c97=this['editor'],_0x38bb71=_0x354c97['plugins']['get'](_0x7c90bc),_0x593dc9=_0x354c97['plugins']['get'](c);this['listenTo'](_0x38bb71,'getOperationAuthor',(_0x164790,_0x3ed2ad)=>{const _0x299294=_0x3ed2ad[0x0];_0x299294['_authorId']&&(_0x164790['return']=_0x38bb71['getUser'](_0x299294['_authorId']),_0x164790['stop']()),null===_0x299294['_authorId']&&(_0x164790['return']=null,_0x164790['stop']());},{'priority':'high'}),this['listenTo'](_0x354c97['model']['document']['selection'],'change:range',(_0x246fe2,_0xbed726)=>{_0xbed726['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x354c97['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x354c97['model']['on']('applyOperation',(_0x2f2d19,_0x74301d)=>{const _0x378cec=_0x74301d[0x0];_0x378cec['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0x378cec),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['bind']('_isEditingAllowed')['to'](_0x593dc9,'state',this,'_hasSynchronizationProblem',(_0x451391,_0x24e9f9)=>'connected'===_0x451391&&!_0x24e9f9),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x354c97['disableReadOnlyMode']('rtc-offline'):_0x354c97['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x354c97['disableReadOnlyMode']('rtc-offline'):_0x354c97['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async['reconnect'](){const _0x1ceada=this['editor']['plugins']['get'](i),_0x362c3f=this['editor']['plugins']['get'](c);try{this['_isPendingUpdate']=!0x0,_0x1ceada['unregister'](this['_channelId']);const _0x59238e=await this['_service']['reconnect'](_0x362c3f['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0x59238e)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x27fc25=await this['_service']['getConnectedSessions']();_0x1ceada['register'](this['_channelId'],_0x27fc25),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x3da99e){if(function(_0x234dec){return'404'===_0x234dec['code'];}(_0x3da99e)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0x2eb415){return'409'===_0x2eb415['code'];}(_0x3da99e)){const _0x1a09fe=G(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'](_0x1a09fe);}else{if(!(_0x3da99e instanceof Q))throw _0x3da99e;this['_handleReconnectionError']();}}}}['destroy'](){const _0x1c0899=this['editor']['plugins']['get'](c),_0x51c18a=this['editor']['plugins']['get'](i);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x51c18a['channelSessions']['has'](this['_channelId'])&&_0x51c18a['unregister'](this['_channelId']),_0x1c0899['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async['_handleReconnectionResponse'](_0x18dddc){if(this['sessionId']!==_0x18dddc['sessionId']&&this['_lastSyncedOperationId']!==_0x18dddc['lastOperationId'])throw new Q();return this['sessionId']=_0x18dddc['sessionId'],this['_handleServerResponse']([],{..._0x18dddc,'wereChangesApplied':!0x1,'data':_0x18dddc['data']},'reconnect');}async['_connectService'](_0x3dc6ea,_0xc4f82a=!0x1){const {connection:_0x2791c3}=this['editor']['plugins']['get'](c);l['CollaborativeEditingService']['getConnectedSessions'](_0x2791c3,this['_channelId'])['then'](_0x4a0bda=>this['_initSessionsHandling'](_0x4a0bda))['catch'](_0x369426=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x369426);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x3d2665,_0xd345d7)=>{this['_crash']('realtimecollaborationclient-init-service-internal-error',_0xd345d7);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_isConnected']=!0x1;});const _0xf10d8d=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x3dc6ea);this['_isPendingUpdate']=!0x0;const _0x33e65f=await this['_service']['connect'](_0x2791c3,this['_compressOperations'](_0x3dc6ea),_0xf10d8d);if(this['sessionId']=_0x33e65f['sessionId'],_0xc4f82a){if(!_0x33e65f['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x33e65f['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0x3dc6ea,_0x33e65f,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x33e65f,_0x3dc6ea);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}['_handleSendingSelectionMarkers'](){const _0x541c58=this['editor']['plugins']['get'](i),_0x28bf19=this['editor']['plugins']['get'](q),_0x558ccd=_0x541c58['channelSessions']['get'](this['_channelId']);_0x558ccd&&_0x558ccd['length']>0x1?_0x28bf19['createUserMarkerOperations']():this['listenTo'](_0x541c58,'sessionAdd:'+this['_channelId'],()=>{0x2===_0x541c58['channelSessions']['get'](this['_channelId'])['length']&&_0x28bf19['createUserMarkerOperations']();});}async['_handleReceivedOperations'](_0x557b76,_0x57d113,_0x353e1c,_0x355ed6){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x57d113){const _0x338f08=this['_decompressOperations'](_0x353e1c,_0x355ed6);await this['_fetchMissingUsers'](_0x338f08),this['_handleExternalOperations'](_0x338f08,_0x57d113,_0x353e1c['lastOperationId'])||this['_crash']('realtimecollaborationclient-init-service-incorrect-server-operation');}}async['_connectAfterSessionHasBeenFlushed'](){this['_disconnectService']();const {locale:_0x48c9f9}=this['editor'];let _0x15526d;try{_0x15526d=await this['_service']['getDocumentDetails']();}catch{const _0x231000=G(_0x48c9f9,'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'](_0x231000);}const _0x21685b=_0x15526d['currentDocumentSession']||_0x15526d['lastDocumentSession'];if(this['_lastSyncedOperationId']===_0x21685b['lastOperationId'])await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);else{const _0xd7ae88=G(_0x48c9f9,'The\x20last\x20saved\x20version\x20of\x20the\x20document\x20does\x20not\x20match\x20the\x20local\x20version.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.');this['_handleReconnectionError'](_0xd7ae88);}}['_disconnectService'](){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['stopListening'](this['_service']);}['_initSessionsHandling'](_0x15f21a){const _0x227346=this['editor']['plugins']['get'](i);this['listenTo'](_0x227346,'sessionAdd:'+this['_channelId'],(_0x489d65,{session:_0x597f15})=>{if(_0x597f15['id']===_0x227346['mySessionId']){_0x489d65['off']();const _0x3aa577=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0x4e635c=_0x597f15['permissions'];_0x3aa577&&_0x3aa577['isEnabled']&&(_0x4e635c=_0x4e635c['filter'](_0x4d7fe3=>'document:write'!==_0x4d7fe3)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0x4e635c,this['_channelId']);}}),_0x227346['register'](this['_channelId'],_0x15f21a);}['_initThrowingOnDataSet'](){const _0x1aa64d=this['editor']['data']['set'];this['editor']['data']['set']=(..._0x9554a4)=>{if(!_0x9554a4[_0x9554a4['length']-0x1]['suppressErrorInCollaboration'])throw new _0x34a1d8('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x1aa64d['apply'](this['editor']['data'],_0x9554a4);};}['_setUpDataInit'](){this['editor']['data']['on']('init',(_0x120ab8,[_0x4e2612])=>{if(this['_document']['version'])throw new _0x34a1d8('realtimecollaborationclient-init-document-already-initialized',this);_0x120ab8['stop'](),this['_setPendingAction']();const _0x21b2b9=this['editor']['config']['get']('rootsAttributes'),_0x3e1755=this['_getOperationsFromInitData'](_0x4e2612,_0x21b2b9);0x0==_0x3e1755['length']&&_0x3e1755['push'](new _0x3f6bbc(0x0)),_0x120ab8['return']=this['_connectService'](_0x3e1755)['then'](()=>{this['editor']['plugins']['get'](c)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x410270=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x410270))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x1c8ae9,[_0xddcfd7,_0x2270c2])=>{_0x1c8ae9['stop']();const _0x48840f=this['editor']['model']['document']['getRoot'](_0xddcfd7);if(!this['_knownRootNames']['has'](_0xddcfd7)){const _0x53528a=_0x2270c2&&_0x2270c2['data']?_0x2270c2['data']:'',_0x1c5dad=_0x2270c2&&_0x2270c2['attributes']?_0x2270c2['attributes']:{};await this['_loadRoot'](_0xddcfd7,_0x53528a,_0x1c5dad);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0x48840f['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0x48840f);});},{'priority':'high'});}async['_fetchMissingUsers'](_0x51c18c){const _0x1891ff=this['editor']['plugins']['get'](_0x7c90bc),{connection:_0x189839}=this['editor']['plugins']['get'](c),_0x446704=new Set();for(const _0x4b78a8 of _0x51c18c){const _0x15baa1=_0x4b78a8['_authorId'];_0x15baa1&&!_0x1891ff['getUser'](_0x15baa1)&&_0x446704['add'](_0x15baa1);}if(0x0===_0x446704['size'])return;const _0x339f68=await dt['getMany'](_0x189839,Array['from'](_0x446704));for(const _0x127bd7 of _0x339f68)_0x1891ff['getUser'](_0x127bd7['id'])||_0x1891ff['addUser'](_0x127bd7);}['_getOperationsFromInitData'](_0xc907f9,_0x459442={}){const _0x501dbe=this['editor']['model'],_0x51a3dc=[];let _0x5cc1aa=0x0;const _0x1e5ac8='string'==typeof _0xc907f9?{'main':_0xc907f9}:_0xc907f9;for(const _0x58016b of Object['keys'](_0x1e5ac8)){if(!this['_document']['roots']['has'](_0x58016b))throw new _0x34a1d8('realtimecollaborationclient-init-non-existent-root',this);const _0x4cf4f0=this['editor']['data']['parse'](_0x1e5ac8[_0x58016b]),_0x32d0c2=this['_document']['getRoot'](_0x58016b),_0x4f8af0=new _0x2e0ba1(_0x501dbe['createPositionAt'](_0x32d0c2,0x0),_0x4cf4f0,_0x5cc1aa++);_0x51a3dc['push'](_0x4f8af0);for(const [_0x213c2f,_0x38bfff]of _0x4cf4f0['markers']){const _0x1a2c56=_0x501dbe['createRange'](_0x501dbe['createPositionFromPath'](_0x32d0c2,_0x38bfff['start']['path']['slice']()),_0x501dbe['createPositionFromPath'](_0x32d0c2,_0x38bfff['end']['path']['slice']())),_0x598683=new _0x1d96df(_0x213c2f,null,_0x1a2c56,_0x501dbe['markers'],!0x0,_0x5cc1aa++);_0x51a3dc['push'](_0x598683);}}if(_0x459442)for(const [_0x49be2f,_0x1b73b5]of Object['entries'](_0x459442)){const _0x42091d=_0x501dbe['document']['getRoot'](_0x49be2f);if(!_0x42091d)throw new _0x34a1d8('multi-root-editor-root-attributes-no-root',null);for(const [_0x28d2fc,_0x1b6cfe]of Object['entries'](_0x1b73b5))if(null!==_0x1b6cfe){const _0x180d86=new _0x58bc1e(_0x42091d,_0x28d2fc,null,_0x1b6cfe,_0x5cc1aa++);_0x51a3dc['push'](_0x180d86);}}return _0x51a3dc;}async['_loadRoot'](_0x5bb772,_0x421209,_0x492283){this['_getOperationsFromInitData']({[_0x5bb772]:_0x421209},{[_0x5bb772]:_0x492283})['forEach']((_0x533cc,_0x251230)=>{_0x533cc['baseVersion']=this['_document']['version']+_0x251230,_0x533cc['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x533cc);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async['_handleInitialConnectionData'](_0x333eed,_0x3f2d5b){let _0x584cd8;this['_offset']=_0x333eed['offset'];const _0xd18886=_0x333eed['wereChangesApplied']&&!_0x333eed['initData'],_0x308b36=_0xd18886?0x0:_0x333eed['data']['baseVersion'];if(_0x3f2d5b['forEach'](_0x81c273=>{_0x81c273['_isInit']=!0x0,_0x81c273['createdAt']=_0x333eed['sessionCreatedAt'],_0x81c273['_authorId']=null;}),_0xd18886)_0x584cd8=_0x3f2d5b,this['_applyOperationsSet'](_0x584cd8,_0xd18886);else{if(_0x333eed['initData']){const _0x41f733=this['_getOperationsFromInitData'](_0x333eed['initData']);this['_document']['history']['version']=-_0x41f733['length'],_0x41f733['forEach'](_0x282145=>{_0x282145['baseVersion']-=_0x41f733['length'],_0x282145['createdAt']=_0x333eed['sessionCreatedAt'],_0x282145['_isInit']=!0x0,_0x282145['_authorId']=null;}),this['_applyOperationsSet'](_0x41f733,!0x0),this['serverHistory']['version']=-_0x41f733['length']+this['_offset'],this['_updateServerHistory'](_0x41f733);}this['_document']['history']['version']=_0x308b36,_0x584cd8=this['_decompressOperations'](_0x333eed['data'],_0x333eed['metadata']),await this['_fetchMissingUsers'](_0x584cd8),this['_applyOperationsSet'](_0x584cd8,_0xd18886);}_0x333eed['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x584cd8,_0x333eed['lastOperationId']),this['_lastSyncedOperationId']=_0x333eed['lastOperationId']),this['serverHistory']['version']=_0x308b36+this['_offset'],this['_updateServerHistory'](_0x584cd8),_0x3f2d5b['filter'](_0x1ee50c=>{const _0x2899e6=this['_getAffectedRoot'](_0x1ee50c);return _0x2899e6&&!this['_knownRootNames']['has'](_0x2899e6);})['forEach']((_0x31c5f9,_0x1c23bb)=>{_0x31c5f9['baseVersion']=this['_document']['version']+_0x1c23bb,this['_saveOperationInBuffer'](_0x31c5f9);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x17626a,_0x237c87){const _0x436814=_0x237c87&&_0x237c87['message'];if(_0x436814&&_0x436814['startsWith']('realtimecollaborationclient'))throw _0x237c87;const _0x53f0ae=this['editor']['plugins']['get'](c);throw this['_isPendingUpdate']=!0x0,_0x53f0ae['disconnect'](),this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0x34a1d8(_0x17626a,this['editor'],_0x436814?{'originalError':_0x436814}:void 0x0);}['_saveOperationInBuffer'](_0x7473c9){this['_knownOperations']['has'](_0x7473c9)||(this['_knownOperations']['add'](_0x7473c9),this['_bufferedOperations']['push'](_0x7473c9),this['_pendingAction']||'marker'==_0x7473c9['type']&&!_0x7473c9['affectsData']||this['_setPendingAction']());}['_sendBufferedOperationsDelayed'](_0x21b3e2=!0x1){!_0x21b3e2&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0xa03bff=>{_0xa03bff&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0x419f77=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0xd47bb){return _0xd47bb['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0xd47bb['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0xd47bb['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0x419f77)||this['_crash'](_0x419f77['message'],_0x419f77);});},this['_currentBufferDelay']));}['_waitUntilSynced'](){return new Promise(_0x40b818=>{this['on']('change:_isPendingUpdate',()=>{_0x40b818();});});}async['_sendBufferedOperations'](){const _0x5c8473=this['editor']['plugins']['get'](q);if(this['_shouldSendSelectionUpdate']()&&(_0x5c8473['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x26aa0d=[...this['_bufferedOperations']];for(const _0x4e92b9 of _0x26aa0d)_0x4e92b9['wasUndone']=this['_document']['history']['isUndoneOperation'](_0x4e92b9);const _0x3f2522=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x26aa0d),_0x58c79f=J++,_0x265b04=this['_compressOperations'](_0x26aa0d),_0x5af808=await this['_service']['sendOperations'](_0x265b04,_0x265b04['baseVersion'],_0x3f2522);try{return await this['_handleServerResponse'](_0x26aa0d,_0x5af808,_0x58c79f);}catch(_0x1caa61){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0x1caa61);}}async['_handleServerResponse'](_0x2dd956,_0x119647,_0x6d3685){if('error'in _0x119647)throw _0x119647['error'];let _0x2227b4=!0x1;if(_0x119647['wereChangesApplied']){_0x119647['lastOperationId']&&(this['_lastSyncedOperationId']=_0x119647['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x2155a4=>!_0x2dd956['includes'](_0x2155a4));for(const _0xa09d12 of _0x2dd956)_0xa09d12['createdAt']='lastOperationAcceptedAt'in _0x119647&&_0x119647['lastOperationAcceptedAt']||void 0x0;X(_0x2dd956,_0x119647['version']-_0x2dd956['length']),this['_updateServerHistory'](_0x2dd956);const _0x3d8dcc=_0x2dd956['filter'](_0x4b37d0=>{if(!_0x4b37d0['_isInit'])return!0x1;const _0x36af47=this['_getAffectedRoot'](_0x4b37d0);return _0x36af47&&!this['_knownRootNames']['has'](_0x36af47);});X(_0x3d8dcc,this['_document']['version']),this['_applyOperationsSet'](_0x3d8dcc),_0x2227b4=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0xd3a238=this['_decompressOperations'](_0x119647['data'],_0x119647['metadata'])['filter'](_0x474797=>_0x474797['baseVersion']>=this['_lastServerVersion']);_0xd3a238['forEach'](_0x547f73=>this['_addKnownRoot'](_0x547f73)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x222771=>!_0x222771['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x222771))),this['_bufferedOperations']['length']&&X(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0xd3a238),_0x2227b4=this['_handleExternalOperations'](_0xd3a238,_0x119647['version'],_0x119647['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x2227b4?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}['_handleExternalOperations'](_0x3270a4,_0x318473,_0x4f1843){try{const _0x5e1019={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0xb87956,operationsB:_0x3d2c1e,originalOperations:_0x33c109}=_0x44df8f(_0x3270a4,this['_bufferedOperations'],_0x5e1019);X(_0xb87956,this['_document']['version']),X(_0x3d2c1e,_0x318473);for(const _0x734299 of _0xb87956){const _0x1a2d93=_0x33c109['get'](_0x734299);_0x734299['_authorId']=_0x1a2d93?_0x1a2d93['_authorId']:null;}_0x4f1843&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x3270a4,_0x4f1843),this['_lastSyncedOperationId']=_0x4f1843),this['_bufferedOperations']=[..._0x3d2c1e],this['_applyOperationsSet'](_0xb87956),this['_updateServerHistory'](_0x3270a4);}catch(_0x474d31){return console['error'](_0x474d31),!0x1;}return!0x0;}['_applyOperationsSet'](_0xc3042b,_0x323426=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0x60f486=>{for(const _0x3f071a of _0xc3042b)this['_knownOperations']['add'](_0x3f071a),this['_addKnownRoot'](_0x3f071a),_0x60f486['batch']['addOperation'](_0x3f071a),this['editor']['model']['applyOperation'](_0x3f071a);});}['_addKnownRoot'](_0x295262){const _0x43e7ec=this['_getAffectedRoot'](_0x295262);_0x43e7ec&&this['_knownRootNames']['add'](_0x43e7ec);}['_getAffectedRoot'](_0x5d461e){let _0x389e8b,_0x333d16;switch(_0x5d461e['type']){case'insert':_0x389e8b=_0x5d461e['position']['root'];break;case'marker':if(_0x333d16=_0x5d461e['newRange'],!_0x333d16)return null;_0x389e8b=_0x333d16['root'];break;case'addRootAttribute':_0x389e8b=_0x5d461e['root'];break;case'addRoot':_0x389e8b=_0x5d461e['affectedSelectable'];break;case'move':_0x389e8b=_0x5d461e['targetPosition']['root'];break;default:return null;}return _0x389e8b['rootName'];}['_updateServerHistory'](_0x4bd42a){_0x4bd42a['forEach'](_0x54dd85=>{const _0x34adea=_0x54dd85['clone']();_0x34adea['_authorId']=_0x54dd85['_authorId'],_0x34adea['_isInit']=!!_0x54dd85['_isInit'],_0x34adea['createdAt']=_0x54dd85['createdAt'],_0x34adea['baseVersion']+=this['_offset'],_0x54dd85['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x34adea),this['serverHistory']['addOperation'](_0x34adea);});}['_handleReconnectionError'](_0x4b57ab){const _0x9cad2a=this['editor']['plugins']['get']('Notification'),_0x474fb8=this['editor']['locale'];_0x4b57ab||(_0x4b57ab=G(_0x474fb8,'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.')),_0x9cad2a['showWarning'](_0x4b57ab,{'title':G(_0x474fb8,'Synchronization\x20issue'),'namespace':'real-time-collaboration'}),this['_hasSynchronizationProblem']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_bufferedOperations']=[],this['editor']['plugins']['get'](c)['disconnect']();}['_setPendingAction'](){this['_pendingAction']||(this['_pendingAction']=this['editor']['plugins']['get'](_0xf7fbb9)['add'](G(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}['_clearPendingAction'](){this['_pendingAction']&&(this['editor']['plugins']['get'](_0xf7fbb9)['remove'](this['_pendingAction']),this['_pendingAction']=null);}['_compressOperations'](_0x17017c){const _0x2ab38e=_0x17017c['map'](_0x96a408=>_0x96a408['toJSON']());return this['_compressor']['compress'](_0x2ab38e);}['_decompressOperations'](_0x36ad2d,_0x380731){return this['_compressor']['decompress'](_0x36ad2d)['map']((_0x46743f,_0x4518ed)=>{const _0x17133e='init'==_0x380731[_0x4518ed]['type'];if('InsertOperation'==_0x46743f['__className']){const _0xac39a1=_0x46743f['position']['root'];!this['_document']['getRoot'](_0xac39a1)&&(this['_document']['createRoot']('$root',_0xac39a1)['_isAttached']=!0x1);}const _0x253ee4=_0x1dac30['fromJSON'](_0x46743f,this['_document']);return _0x253ee4['wasUndone']=_0x46743f['wasUndone'],_0x253ee4['_isInit']=_0x17133e,_0x253ee4['_authorId']=_0x17133e?null:_0x380731[_0x4518ed]['userId'],_0x253ee4['_isDisconnection']='cs:removeUser'===_0x380731[_0x4518ed]['type'],_0x253ee4['createdAt']=_0x380731[_0x4518ed]['createdAt'],_0x253ee4;});}['_refreshUserSelectionMarkers'](){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}['_shouldSendSelectionUpdate'](){const _0x274af7=this['editor']['plugins']['get'](i)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0x274af7&&_0x274af7['length']>0x1&&this['_hasSelectionChanged'];}['_shouldSendUpdate'](){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}}class Q extends Error{}function X(_0x2c3e3e,_0xf6c14e){for(const _0x3df77b of _0x2c3e3e)_0x3df77b['baseVersion']=_0xf6c14e++;}class Y{['_ignoredOperations'];['_operationToId'];constructor(_0x4641e4){this['_ignoredOperations']=_0x4641e4,this['_operationToId']=new WeakMap();}['getIdOfTheLastOperation'](_0xdd55e3){let _0x106a52=_0xdd55e3['length'];for(;_0x106a52--;){const _0x33008a=_0xdd55e3[_0x106a52];if(!this['_ignoredOperations']['has'](_0x33008a)){if(!this['_operationToId']['has'](_0x33008a)){const _0x22a711=_0x4bfdd9()['slice'](0x1,0x12);this['_operationToId']['set'](_0x33008a,_0x22a711);}return this['_operationToId']['get'](_0x33008a);}}}['setIdForTheLastOperation'](_0xe5ff90,_0x18d7e3){if(!_0x18d7e3)return;let _0x363b5f=_0xe5ff90['length'];for(;_0x363b5f--;){const _0x58e689=_0xe5ff90[_0x363b5f];this['_ignoredOperations']['has'](_0x58e689)||this['_operationToId']['set'](_0x58e689,_0x18d7e3);}}}class n extends _0x8177c2{static get['requires'](){return[l];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class a extends _0x4692aa{static ['CommentsService']=/* #__PURE__ -- @preserve */
|
|
26
|
-
((()=>_0x383945)());['_services'];static get['requires'](){return[c,'CommentsRepository',i,_0x7c90bc];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x25e8de){super(_0x25e8de),this['_services']=new Map();}async['init'](){const _0x1808f4=this['context'],_0x2d2f68=_0x1808f4['plugins']['get']('CommentsRepository');if(_0x1808f4['plugins']['get'](c)['addToReconnectionStack'](this),_0x2d2f68['adapter']={'addCommentThread':async({channelId:_0x558a2e,threadId:_0x5ce962,comments:_0x188240,resolvedAt:_0x50fc71,resolvedBy:_0x18090f,context:_0x4571fc,attributes:_0x3bc3b0})=>{const _0xea7d30=await this['_getService'](_0x558a2e)['addCommentThread']({'commentThreadId':_0x5ce962,'comments':_0x188240['map'](_0x17cfcb=>function(_0xdf8615,_0xc3b538,_0x1bfd57){return{'commentThreadId':_0x1bfd57,'commentId':_0xdf8615['commentId'],'userId':_0xdf8615['authorId'],'content':_0xdf8615['content'],'documentId':_0xc3b538,'createdAt':_0xdf8615['createdAt'],'attributes':_0xdf8615['attributes']||{}};}(_0x17cfcb,_0x558a2e,_0x5ce962)),'resolvedAt':_0x50fc71,'resolvedBy':_0x18090f,'context':_0x4571fc,'attributes':_0x3bc3b0})['catch'](ut);return{'threadId':_0xea7d30['commentThreadId'],'comments':_0xea7d30['comments']};},'getCommentThread':async({channelId:_0x1a0fa1,threadId:_0x9b8e06})=>{const _0x3ee435=await this['_getService'](_0x1a0fa1)['getCommentThread'](_0x9b8e06)['catch'](ut);return _0x3ee435['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0x3ee435]),{'threadId':_0x3ee435['commentThreadId'],'comments':_0x3ee435['comments']['map'](_),'context':_0x3ee435['context'],'resolvedAt':_0x3ee435['resolvedAt'],'resolvedBy':_0x3ee435['resolvedBy'],'attributes':_0x3ee435['attributes']||{}});},'updateCommentThread':async({channelId:_0x5e4af4,threadId:_0xe91bf8,context:_0x35e46c,unlinkedAt:_0x229431,attributes:_0x3bbe01})=>this['_getService'](_0x5e4af4)['updateCommentThread']({'commentThreadId':_0xe91bf8,'context':_0x35e46c,'attributes':_0x3bbe01,'unlinkedAt':_0x229431})['catch'](S)['catch'](ut),'resolveCommentThread':async({channelId:_0xc0d427,threadId:_0x4b9976})=>{const _0x56d8c0=await this['_getService'](_0xc0d427)['resolveCommentThread'](_0x4b9976)['catch'](S)['catch'](ut);return{'threadId':_0x56d8c0['commentThreadId'],'resolvedAt':_0x56d8c0['resolvedAt'],'resolvedBy':_0x56d8c0['resolvedBy']};},'reopenCommentThread':async({channelId:_0x398e0a,threadId:_0x3d66d3})=>this['_getService'](_0x398e0a)['reopenCommentThread'](_0x3d66d3)['catch'](S)['catch'](ut),'removeCommentThread':({channelId:_0x3a496c,threadId:_0x4b2ad2})=>this['_getService'](_0x3a496c)['removeCommentThread'](_0x4b2ad2)['catch'](S)['catch'](ut),'addComment':({channelId:_0x455c97,threadId:_0x49f947,commentId:_0x3d5621,content:_0x29c6a7,attributes:_0x4f6a62})=>this['_getService'](_0x455c97)['addComment'](_0x49f947,_0x3d5621,_0x29c6a7,_0x4f6a62)['catch'](ut),'updateComment':({channelId:_0x24a9c0,threadId:_0x5cbf57,commentId:_0x11d58a,content:_0x21e0f5,attributes:_0x5e1365})=>this['_getService'](_0x24a9c0)['updateComment'](_0x5cbf57,_0x11d58a,_0x21e0f5,_0x5e1365)['catch'](S)['catch'](ut),'removeComment':({channelId:_0xedc641,threadId:_0x39c6a0,commentId:_0x31a8b1})=>this['_getService'](_0xedc641)['removeComment'](_0x39c6a0,_0x31a8b1)['catch'](S)['catch'](ut)},_0x1808f4 instanceof _0x371a1a){const _0x5a145c=_0x1808f4['config']['get']('collaboration.channelId'),_0x833424=_0x1808f4['plugins']['get'](i);await this['_setUpService'](_0x5a145c);const _0x45a477=await this['_services']['get'](_0x5a145c)['getConnectedSessions']();this['listenTo'](_0x833424,'sessionAdd:'+_0x5a145c,(_0x32380f,{session:_0x31e4b7})=>{_0x31e4b7['id']===_0x833424['mySessionId']&&(_0x32380f['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x31e4b7['permissions'],_0x5a145c));}),_0x833424['register'](_0x5a145c,_0x45a477);}}async['_setUpService'](_0x2f8950){if(this['_services']['has'](_0x2f8950))throw new _0x34a1d8('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0x2f8950});const _0x25ccbc=this['context']['plugins']['get']('CommentsRepository'),_0xd573f0=new a['CommentsService'](_0x2f8950);this['_services']['set'](_0x2f8950,_0xd573f0),this['listenTo'](_0xd573f0,'commentThreadAdded',(_0x1682a3,_0x52ea02)=>{const {commentThreadId:_0x2e56b9,documentId:_0x318d54,context:_0x2c4fac,attributes:_0x2fe15b,resolvedAt:_0x28a4ab,resolvedBy:_0xc7f022,comments:_0x148442}=_0x52ea02;_0x25ccbc['getCommentThread'](_0x2e56b9)||_0x25ccbc['addCommentThread']({'threadId':_0x2e56b9,'channelId':_0x318d54,'comments':_0x148442?_0x148442['map'](_):[],'context':_0x2c4fac,'attributes':_0x2fe15b,'resolvedAt':_0x28a4ab,'resolvedBy':_0xc7f022,'isFromAdapter':!0x0});}),this['listenTo'](_0xd573f0,'commentThreadUpdated',(_0x1502b5,{commentThreadId:_0x31b422,documentId:_0x42766a,context:_0x1daac7,unlinkedAt:_0x19b0b9,attributes:_0x2cfe38})=>{_0x25ccbc['getCommentThread'](_0x31b422)&&_0x25ccbc['updateCommentThread']({'threadId':_0x31b422,'channelId':_0x42766a,'context':_0x1daac7,'unlinkedAt':_0x19b0b9,'attributes':_0x2cfe38,'isFromAdapter':!0x0});}),this['listenTo'](_0xd573f0,'commentThreadResolved',(_0x408ddc,{commentThreadId:_0x3c4966,resolvedBy:_0x30776c,resolvedAt:_0x3e166f})=>{const _0x23eebf=_0x25ccbc['getCommentThread'](_0x3c4966);_0x23eebf&&_0x23eebf['resolve']({'resolvedBy':_0x30776c,'resolvedAt':_0x3e166f,'isFromAdapter':!0x0});}),this['listenTo'](_0xd573f0,'commentThreadReopened',(_0x9dcc1e,{commentThreadId:_0x1fb4d8})=>{const _0x97c45=_0x25ccbc['getCommentThread'](_0x1fb4d8);_0x97c45&&_0x97c45['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0xd573f0,'commentThreadRemoved',(_0x720597,{commentThreadId:_0x41ab57})=>{const _0x3972f6=_0x25ccbc['getCommentThread'](_0x41ab57);_0x3972f6&&_0x3972f6['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0xd573f0,'commentAdded',(_0x5437cc,_0x457b84)=>{const _0x5132cf=_0x457b84['commentThreadId'],_0x2a9fb9=_0x25ccbc['getCommentThread'](_0x5132cf);_0x2a9fb9&&_0x2a9fb9['addComment']({..._(_0x457b84),'isFromAdapter':!0x0});}),this['listenTo'](_0xd573f0,'commentUpdated',(_0x1ca400,{commentThreadId:_0x2a0c35,commentId:_0x1514da,content:_0x143dbc,attributes:_0x9aceee})=>{const _0x2c35ea=_0x25ccbc['getCommentThread'](_0x2a0c35);if(_0x2c35ea){const _0x4ac657=_0x2c35ea['getComment'](_0x1514da);_0x4ac657&&_0x4ac657['update']({'content':_0x143dbc,'attributes':_0x9aceee,'isFromAdapter':!0x0});}}),this['listenTo'](_0xd573f0,'commentRemoved',(_0x556eb8,{commentThreadId:_0x31eb1e,commentId:_0x3a2995})=>{const _0x4efa96=_0x25ccbc['getCommentThread'](_0x31eb1e);if(_0x4efa96){const _0x16ba72=_0x4efa96['getComment'](_0x3a2995);_0x16ba72&&_0x16ba72['remove']({'isFromAdapter':!0x0});}}),await this['_connectService'](_0x2f8950);}['destroy'](){if(this['context']instanceof _0x371a1a){const _0x34bdce=this['context']['config']['get']('collaboration.channelId');this['_terminateService'](_0x34bdce);}}['_terminateService'](_0x3bcd5b){if(!this['_services']['has'](_0x3bcd5b))throw new _0x34a1d8('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0x3bcd5b});this['_getService'](_0x3bcd5b)['disconnect'](),this['_services']['delete'](_0x3bcd5b);}async['reconnect'](){for(const _0x4d037a of this['_services']['keys']())await this['_connectService'](_0x4d037a);if(this['context']instanceof _0x371a1a){const _0x3d0240=this['context']['config']['get']('collaboration.channelId'),_0x491657=this['context']['plugins']['get'](i);_0x491657['unregister'](_0x3d0240);const _0x9c3ce5=await this['_services']['get'](_0x3d0240)['getConnectedSessions']();_0x491657['register'](_0x3d0240,_0x9c3ce5);}}async['_connectService'](_0x3f1556){const {connection:_0x216391}=this['context']['plugins']['get'](c),_0x2b2019=this['context']['plugins']['get']('CommentsRepository'),_0x535b56=this['_services']['get'](_0x3f1556),_0x4cbf40=await _0x535b56['connect'](_0x216391);await this['_fetchMissingUsersForThreads'](_0x4cbf40);const _0xf37bd7=new Set(Array['from'](_0x2b2019['getCommentThreads']({'channelId':_0x3f1556}),_0x23ec11=>_0x23ec11['id']));for(const _0x370066 of _0x4cbf40)_0x370066['deletedAt']||_0xf37bd7['delete'](_0x370066['commentThreadId']);for(const _0x28fa94 of _0xf37bd7)_0x2b2019['getCommentThread'](_0x28fa94)['remove']({'isFromAdapter':!0x0});for(const _0x359f89 of _0x4cbf40){let _0x419f99=_0x2b2019['getCommentThread'](_0x359f89['commentThreadId']);const {commentThreadId:_0x55f66f,context:_0x418cbb,attributes:_0x175bac,resolvedBy:_0x42a8e5,resolvedAt:_0x49dee5,unlinkedAt:_0x54fd57,deletedAt:_0x47a46c}=_0x359f89;if(_0x47a46c)continue;_0x419f99||(_0x419f99=_0x2b2019['addCommentThread']({'channelId':_0x3f1556,'threadId':_0x55f66f,'context':_0x418cbb,'attributes':_0x175bac||{},'resolvedBy':_0x42a8e5,'resolvedAt':_0x49dee5,'unlinkedAt':_0x54fd57,'isFromAdapter':!0x0}));const _0x2644e6=new Set(Array['from'](_0x419f99['comments'],_0x43023f=>_0x43023f['id']));for(const _0x3649b3 of _0x359f89['comments'])_0x2644e6['delete'](_0x3649b3['commentId']);for(const _0x169712 of _0x2644e6)_0x419f99['getComment'](_0x169712)['remove']({'isFromAdapter':!0x0});for(const _0xc7e1a of _0x359f89['comments']){const _0x39bc6f=_0x419f99['getComment'](_0xc7e1a['commentId']);_0x39bc6f?_0x39bc6f['content']!==_0xc7e1a['content']&&_0x39bc6f['update']({'content':_0xc7e1a['content'],'isFromAdapter':!0x0}):_0x419f99['addComment'](Object['assign'](_(_0xc7e1a),{'isFromAdapter':!0x0}));}}}['_getService'](_0x3e3909){if(!this['_services']['has'](_0x3e3909))throw new _0x34a1d8('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0x3e3909});return this['_services']['get'](_0x3e3909);}async['_fetchMissingUsersForThreads'](_0x1ebef2){const _0x36baaa=this['context']['plugins']['get'](_0x7c90bc),{connection:_0x2af26c}=this['context']['plugins']['get'](c),_0x239cbf=new Set();for(const {resolvedBy:_0x4000cf,comments:_0x307734}of _0x1ebef2){_0x4000cf&&!_0x36baaa['getUser'](_0x4000cf)&&_0x239cbf['add'](_0x4000cf);for(const {userId:_0x1e7d46}of _0x307734)_0x36baaa['getUser'](_0x1e7d46)||_0x239cbf['add'](_0x1e7d46);}if(0x0===_0x239cbf['size'])return;const _0x423257=await dt['getMany'](_0x2af26c,Array['from'](_0x239cbf));for(const _0x567a84 of _0x423257)_0x36baaa['getUser'](_0x567a84['id'])||_0x36baaa['addUser'](_0x567a84);}}async function S(_0x6190d2){if('404'!==_0x6190d2['code'])throw _0x6190d2;}function ut(_0x41a29b){if((_0x345a5c=_0x41a29b)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0x345a5c['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x345a5c['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0x345a5c;throw _0x41a29b;}function _(_0x22bbbb){return{'threadId':_0x22bbbb['commentThreadId'],'commentId':_0x22bbbb['commentId'],'content':_0x22bbbb['content'],'createdAt':_0x22bbbb['createdAt'],'authorId':_0x22bbbb['userId'],'attributes':_0x22bbbb['attributes']||{}};}class f extends _0x8177c2{static ['TrackChangesService']=/* #__PURE__ -- @preserve */
|
|
27
|
-
((()=>
|
|
28
|
-
((()=>it)());['_lastRequestId'];['_revisionTracker'];['_revisionHistoryService'];['_oldOffset'];static get['requires'](){return[c,l,'RevisionHistory',i,_0x7c90bc];}static get['pluginName'](){return'CloudServicesRevisionHistoryAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x36efb8){super(_0x36efb8);const _0x4efca5=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new u['RevisionHistoryService'](_0x4efca5);}async['init'](){const _0x2b72cc=this['editor']['plugins']['get'](l),_0x147182=_0x2b72cc['serverHistory'],_0x2ac0dc=this['editor']['plugins']['get'](c);this['_revisionTracker']['setSource']({'history':_0x147182,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0x2b72cc['sessionId']});const _0x3c9730=this['editor']['config']['get']('cloudServices.bundleVersion')||nt,_0x1f8422=await tt['isBundleUploaded'](_0x2ac0dc['connection'],_0x3c9730);this['editor']['plugins']['get']('RevisionHistory')['adapter']={'getRevision':async({revisionId:_0x5f4c6d})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0x5f4c6d)),'updateRevisions':async _0x1ed8d5=>{await this['_waitForServiceReady']();const _0x10a8ab=this['_revisionTracker']['currentRevision'];if(_0x1f8422&&0x1===_0x1ed8d5['length']&&_0x1ed8d5[0x0]['id']===_0x10a8ab['id'])return _0x1ed8d5;for(const _0x1d29c8 of _0x1ed8d5)_0x1d29c8['id']===_0x10a8ab['id']&&(_0x1d29c8['isEmptyCurrent']=_0x1d29c8['fromVersion']===_0x1d29c8['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0x1ed8d5,this['_lastRequestId'])['then'](_0x43cf26=>(this['_lastRequestId']=_0x43cf26,_0x1ed8d5))['catch'](_0x256721=>{if(st(_0x256721)||'400'===_0x256721['code']&&void 0x0!==_0x256721['data']['wrongRequestId']){for(const _0x23ae49 of _0x1ed8d5){!this['_revisionTracker']['repository']['getRevision'](_0x23ae49['id'])||this['_revisionTracker']['_bufferUpdate'](_0x23ae49['id'],_0x23ae49,!0x1);}if(st(_0x256721))throw _0x256721;return _0x1ed8d5;}throw _0x256721;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0x1bf47f,{revisionsData:_0x2c46d5,requestId:_0x3488f4})=>{Math['max'](..._0x2c46d5['map'](_0x30f616=>_0x30f616['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0x2c46d5,_0x3488f4);}):this['_handleRevisionsUpdate'](_0x2c46d5,_0x3488f4);});const {revisions:_0x18ebb9,requestId:_0x5742c2}=await this['_revisionHistoryService']['connect'](_0x2ac0dc['connection']);_0x2ac0dc['addToReconnectionStack'](this),this['_lastRequestId']=_0x5742c2,await this['_fetchMissingUsers'](_0x18ebb9);for(const _0x5ef232 of _0x18ebb9)this['_revisionTracker']['addRevisionData'](_0x5ef232);this['listenTo'](_0x2b72cc,'change:_isConnected',(_0x259536,_0x11f0ba,_0x1c54e0)=>{_0x1c54e0&&(this['_oldOffset']=_0x2b72cc['_offset'],_0x259536['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](_0x2ac0dc,'state',_0x554b1c=>_0x554b1c===_0x3ee2f1['CONNECTED']);}async['reconnect'](){const _0xcab725=this['editor']['plugins']['get'](c),_0x37b482=this['editor']['plugins']['get'](l),_0x2f9c38=async()=>{const _0x4b81f4=this['_revisionTracker']['currentRevision'],_0x151f8d=_0x4b81f4['id'],_0x142816=_0x151f8d!==_0x37b482['sessionId'];if(_0x142816){const _0x47311c=_0x37b482['_offset']-this['_oldOffset'],_0x1653fb=this['_getLatestVersionFromServerOperations']();this['_revisionTracker']['_revisionDataBuilder']['reInit']();if(_0x4b81f4['toVersion']+_0x47311c!==_0x1653fb){const _0x167aa0=_0x4b81f4['fromVersion']+_0x47311c,_0x24c5d2=this['editor']['plugins']['get'](_0x7c90bc),_0x690a23=this['_revisionTracker']['buildRevisionData']({'revision':_0x4b81f4,'from':_0x167aa0,'to':_0x1653fb});_0x690a23['id']=_0x4b81f4['id'];const _0x1cf37e=_0x690a23['authorsIds']['map'](_0x5172e9=>_0x24c5d2['getUser'](_0x5172e9));_0x4b81f4['_update']({..._0x690a23,'authors':_0x1cf37e},!0x0),this['_revisionTracker']['_bufferUpdate'](_0x4b81f4['id'],_0x690a23,!0x0);}this['_revisionTracker']['_startingVersion']=_0x1653fb,(_0x4b81f4['toVersion']===_0x4b81f4['fromVersion']&&!this['_revisionTracker']['_bufferedUpdates']['has'](_0x151f8d)&&this['_revisionTracker']['repository']['_revisions']['remove'](_0x151f8d),this['_revisionTracker']['_createCurrentRevision'](_0x1653fb));}const {revisions:_0x419a9b,requestId:_0x6e7872}=await this['_revisionHistoryService']['reconnect'](_0xcab725['connection'],this['_lastRequestId']);_0x142816&&_0x419a9b['length']>0x0?_0x37b482['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x419a9b),this['_handleRevisionsUpdate'](_0x419a9b,_0x6e7872),this['_revisionTracker']['sendBufferedUpdates']());};return _0x37b482['_isConnected']?_0x2f9c38():new Promise((_0x4f6fd7,_0x57b2df)=>{_0x37b482['once']('change:_isConnected',()=>{_0x2f9c38()['then'](_0x4f6fd7)['catch'](_0x57b2df);});});}['destroy'](){super['destroy']();}async['_waitForServiceReady'](){this['_revisionHistoryService']['isConnected']||await new Promise(_0x316d55=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x272d46=>{_0x272d46['off'](),_0x316d55();});});}['_getLatestVersionFromServerOperations'](){const _0x24d879=this['editor']['plugins']['get'](l)['serverHistory']['getOperations']()['reverse']();for(const _0x28f69d of _0x24d879)if('marker'!==_0x28f69d['type']||_0x28f69d['affectsData'])return _0x28f69d['baseVersion']+0x1;}['_getLatestVersion'](){const _0x3ac491=this['editor']['plugins']['get'](l);return new Promise(_0x2bbf73=>{_0x3ac491['_isPendingUpdate']?_0x3ac491['once']('change:_isPendingUpdate',()=>{_0x2bbf73(this['_getLatestVersionFromServerOperations']());}):_0x2bbf73(this['_getLatestVersionFromServerOperations']());});}['_handleRevisionsUpdate'](_0x1910bf,_0x4867a1){const _0x4f4758=this['_revisionTracker']['repository'];this['_lastRequestId']=_0x4867a1;for(const _0x13f81c of _0x1910bf){const _0x5df4f7=_0x4f4758['getRevision'](_0x13f81c['id']);if(_0x5df4f7){if((_0x13f81c['fromVersion']||_0x13f81c['toVersion'])&&(_0x13f81c['diffData']=null),_0x5df4f7===this['_revisionTracker']['currentRevision']){const _0x459711=Math['max'](_0x5df4f7['toVersion'],_0x13f81c['toVersion']),_0x28b1a6=Math['max'](_0x5df4f7['fromVersion'],_0x13f81c['fromVersion']);let _0x4f1baa;_0x5df4f7['toVersion']===_0x13f81c['toVersion']&&_0x5df4f7['fromVersion']===_0x13f81c['fromVersion']?(_0x4f1baa=!0x0,this['_preventResendingRevisionData'](_0x13f81c)):_0x13f81c['toVersion']===_0x459711&&_0x13f81c['fromVersion']===_0x28b1a6?_0x4f1baa=!0x1:(_0x5df4f7['toVersion']===_0x459711&&_0x5df4f7['fromVersion']===_0x28b1a6||this['_fixRevision']({'revision':_0x5df4f7,'from':_0x28b1a6,'to':_0x459711}),_0x4f1baa=!0x0),_0x4f1baa&&(delete _0x13f81c['fromVersion'],delete _0x13f81c['toVersion'],delete _0x13f81c['diffData'],delete _0x13f81c['createdAt'],delete _0x13f81c['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0x13f81c),this['_preventResendingRevisionData'](_0x13f81c);}else this['_revisionTracker']['addRevisionData'](_0x13f81c);}const _0x4c42b6=_0x4f4758['getRevisions']();_0x4c42b6['reverse']();for(let _0x5f17dd=0x0;_0x5f17dd<_0x4c42b6['length']-0x1;_0x5f17dd++){const _0x25cf50=_0x4c42b6[_0x5f17dd],_0x5c5a0c=_0x4c42b6[_0x5f17dd+0x1];if(_0x25cf50['fromVersion']<_0x5c5a0c['toVersion']){const _0x5047ad=_0x5c5a0c['toVersion'],_0x1935be=Math['max'](_0x5047ad,_0x25cf50['toVersion']);this['_fixRevision']({'revision':_0x25cf50,'from':_0x5047ad,'to':_0x1935be});}}}['_fixRevision']({revision:_0x412ef9,from:_0x3087b8,to:_0x1df4f4}={}){const _0x27c770=this['editor']['plugins']['get'](_0x7c90bc),_0xd647be=this['_revisionTracker']['buildRevisionData']({'revision':_0x412ef9,'from':_0x3087b8,'to':_0x1df4f4});_0xd647be['authors']=_0xd647be['authorsIds']['map'](_0x34ce9e=>_0x27c770['getUser'](_0x34ce9e)),_0x412ef9['_update'](_0xd647be);}['_preventResendingRevisionData'](_0xf3cae5){const _0x31ed59={};_0x31ed59['id']=_0xf3cae5['id'];for(const _0x8dff72 of Object['keys'](_0xf3cae5))'id'!==_0x8dff72&&(_0x31ed59[_0x8dff72]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0x31ed59['id'],_0x31ed59,!0x0);}async['_fetchMissingUsers'](_0x387575){const _0x594af2=this['editor']['plugins']['get'](_0x7c90bc),{connection:_0x36a3b1}=this['editor']['plugins']['get'](c),_0x555ff3=new Set();for(const _0x54a462 of _0x387575){for(const _0x1efb91 of _0x54a462['authorsIds'])_0x57bfe8(_0x1efb91);_0x54a462['creatorId']&&_0x57bfe8(_0x54a462['creatorId']);}if(0x0===_0x555ff3['size'])return;const _0x5ad6a8=await dt['getMany'](_0x36a3b1,Array['from'](_0x555ff3));for(const _0x511eaf of _0x5ad6a8)_0x594af2['getUser'](_0x511eaf['id'])||_0x594af2['addUser'](_0x511eaf);function _0x57bfe8(_0x582ac0){_0x594af2['getUser'](_0x582ac0)||_0x555ff3['add'](_0x582ac0);}}}function st(_0x3b10e6){return _0x3b10e6['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0x3b10e6['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x3b10e6['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class g extends _0x8177c2{static get['requires'](){return['RevisionHistory',u,n];}static get['pluginName'](){return'RealTimeCollaborativeRevisionHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class A extends _0x57adcd{['_collapseAt'];constructor(_0x15d446,_0x5f00a6=0x6){super(_0x15d446);const _0x5845e8=this['bindTemplate'];this['set']('isHidden',!0x0),this['set']('usersCount',0x0),this['_collapseAt']=_0x5f00a6,this['bind']('isHidden')['to'](this,'usersCount',_0x37a981=>_0x37a981<_0x5f00a6),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item',_0x5845e8['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':_0x5845e8['to']('usersCount',_0x21357c=>'+'+(_0x21357c-this['_collapseAt']+0x2)['toString']())}]}]}]});}}class ts extends _0x57adcd{['items'];['keystrokes'];constructor(_0x5b386b){super(_0x5b386b);const _0x59e6c6=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0x404bf7(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0x59e6c6['if']('hasPopup'),'aria-expanded':_0x59e6c6['to']('isExpanded',_0x4e282a=>this['hasPopup']&&String(_0x4e282a)),'aria-label':_0x59e6c6['to']('hasPopup',_0x55654e=>G(_0x5b386b,_0x55654e?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0x59e6c6['to']('hasPopup',_0x233463=>!!_0x233463&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items'],'on':{'mouseenter':_0x59e6c6['to'](()=>this['fire']('presencelist:show')),'mouseleave':_0x59e6c6['to'](_0x29fa2a=>{const _0x1e5cdf=_0x29fa2a,_0x56d666=document['querySelector']('.ck-presence-list__dropdown-list'),_0x1f8249=document['querySelector']('.ck-balloon-panel_with-arrow');_0x56d666?.['contains'](_0x1e5cdf['relatedTarget'])||_0x1f8249?.['contains'](_0x1e5cdf['relatedTarget'])||this['fire']('presencelist:hide');})}}),this['on']('change:hasPopup',(_0x419baf,_0x49a350,_0x258c4e)=>{this['element']&&(_0x258c4e?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 j extends _0x57adcd{['counterView'];['inlineListView'];constructor(_0x238fa3,_0x1868c5=0x6){super(_0x238fa3);const _0x3414b2=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new A(this['locale'],_0x1868c5),this['inlineListView']=new ts(_0x238fa3),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x2a63e5 of this['inlineListView']['items'])_0x2a63e5['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',_0x3414b2['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['inlineListView']]});}}class x extends _0x57adcd{['listWrapperView'];constructor(_0x5514da,_0x433959){super(_0x5514da);const _0x2fa77e=this['bindTemplate'];this['listWrapperView']=new mt(_0x5514da,_0x433959),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':G(_0x5514da,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']],'on':{'mouseleave':_0x2fa77e['to'](_0x2fdf19=>{const _0x4c4d2c=_0x2fdf19,_0xdb9b6e=document['querySelector']('.ck-presence-list__list'),_0x117405=document['querySelector']('.ck-balloon-panel_with-arrow');_0xdb9b6e?.['contains'](_0x4c4d2c['relatedTarget'])||_0x117405?.['contains'](_0x4c4d2c['relatedTarget'])||this['fire']('presencelist:hide');})}});}}class mt extends _0x18a7a4{constructor(_0x266195,_0x18c02f){super(_0x266195);const _0x4083c5=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0x18c02f?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0x4083c5['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0x4083c5['to']('role'),'aria-label':_0x4083c5['to']('ariaLabel'),'aria-labelledby':_0x4083c5['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0x57a247['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0x2eb353=this['element'];_0x2eb353&&(this['_isScrollable']=Math['max'](_0x2eb353['scrollHeight'],_0x2eb353['clientHeight'])>0.8*window['innerHeight']);}}class k extends rt{['userView'];constructor(_0x1943b5,_0x3dd3cb,_0x556c2f){super(_0x1943b5);const _0x4c8904=this['bindTemplate'];this['userView']=new ct(_0x1943b5,_0x3dd3cb);const _0x9f7d9a={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0x3dd3cb['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0x3dd3cb['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x3dd3cb['color']['getBackgroundColorClass']()],'aria-hidden':'true'}}]};_0x556c2f&&(_0x9f7d9a['tag']='button',_0x9f7d9a['on']={'click':_0x4c8904['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x9f7d9a);}['focus'](){this['element']['focus']();}}class y extends _0x57adcd{['userView'];['markerView'];constructor(_0x18f8ff,_0x325870,_0x1d0b9a){super(_0x18f8ff);const _0x550cee=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new ct(_0x18f8ff,_0x325870),this['markerView']=new at(_0x18f8ff,_0x325870);const _0x4668cb=new ot(_0x18f8ff);_0x4668cb['template']['tag']='span',_0x4668cb['text']=_0x325870['name'];const _0x4023b7={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0x550cee['to']('isFocusable',_0xa08f24=>!!_0xa08f24&&0x0),'aria-labelledby':_0x4668cb['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0x550cee['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0x550cee['to']('hasTooltip',_0xb7e264=>!_0xb7e264),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0x4668cb]};_0x1d0b9a&&(_0x4023b7['tag']='button',_0x4023b7['on']={'click':_0x550cee['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x4023b7);}}class at extends _0x57adcd{constructor(_0x1c3944,_0x385cac){super(_0x1c3944),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x385cac['color']['getBackgroundColorClass']()],'aria-hidden':'true'}});}}const C={'collapseAt':0x6,'displayMe':!0x0};class r extends _0x4692aa{['currentDisplayedUsers'];['balloonPanelView'];['view'];['presenceDropdownView'];['_bodyCollection']=null;static get['pluginName'](){return'PresenceListUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x143b92){super(_0x143b92),this['context']['config']['define']('presenceList',C);const _0x2d4f5c=_0x143b92['config']['get']('presenceList.collapseAt');if('number'!=typeof _0x2d4f5c)throw new _0x34a1d8('presencelist-collapseat-invalid-format',this);if(_0x2d4f5c<0x1)throw new _0x34a1d8('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](i)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0x69de36(),this['balloonPanelView']=new _0x53cd7c(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get['requires'](){return[i];}['init'](){for(const _0x48cb3e of this['_allConnectedUsers'])this['_handleUserAdd'](_0x48cb3e);this['listenTo'](this['_allConnectedUsers'],'add',(_0x1aad0f,_0x49c582)=>{this['_handleUserAdd'](_0x49c582);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0x1368df,_0x172efb)=>{this['_handleUserRemove'](_0x172efb);});}['_createView'](){const _0x13294c=this['context'],_0x40349f=new j(this['context']['locale'],this['context']['config']['get']('presenceList.collapseAt')),_0x1dccbb=this['balloonPanelView'];if(!_0x3ccbcf(_0x13294c['config']['get']('presenceList.container')))throw new _0x34a1d8('presencelist-missing-container',this);return _0x40349f['counterView']['bind']('usersCount')['to'](this),_0x40349f['bind']('isCollapsed')['to'](this,'usersCount',_0x4f6848=>{const {collapseAt:_0x1f8e14}=_0x13294c['config']['get']('presenceList'),_0x3c8995=_0x4f6848>=_0x1f8e14;if(_0x3c8995&&!_0x40349f['inlineListView']['items']['find'](_0x1f9563=>_0x1f9563 instanceof A)){const _0x1fe531=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['currentDisplayedUsers']['length']==_0x1fe531&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](this['currentDisplayedUsers']['length']-0x1),_0x40349f['inlineListView']['items']['add'](_0x40349f['counterView']);}return _0x3c8995||this['hideDropdown'](),_0x3c8995;}),_0x40349f['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0x1c9590=>{const _0x3a7f07=_0x13294c['config']['get']('presenceList'),_0x1ca40d=new y(_0x13294c['locale'],_0x1c9590,!!_0x3a7f07['onClick']);return _0x1ca40d['bind']('hasTooltip')['to'](_0x40349f,'isCollapsed',_0x5bf101=>!_0x5bf101),_0x1ca40d['bind']('isFocusable')['to'](_0x40349f,'isCollapsed',_0x11eeff=>!_0x11eeff),_0x3a7f07['onClick']&&this['listenTo'](_0x1ca40d,'execute',()=>{this['view']['isCollapsed']||_0x3a7f07['onClick'](_0x1c9590,_0x1ca40d['element']);}),_0x1ca40d;}),this['listenTo'](_0x40349f['inlineListView'],'presencelist:show',()=>{this['view']['isCollapsed']&&this['showDropdown']();}),this['listenTo'](_0x40349f['inlineListView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();}),_0x40349f['inlineListView']['keystrokes']['set']('Enter',(_0x1d240,_0x16db4)=>{this['view']['isCollapsed']&&(this['showDropdown'](),_0x16db4());}),_0x40349f['render'](),_0x1dccbb['render'](),_0x4056ec({'emitter':_0x40349f,'activator':()=>_0x1dccbb['isVisible'],'contextElements':[_0x1dccbb['element'],_0x40349f['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0x13294c['config']['get']('presenceList.container')['appendChild'](_0x40349f['element']),this['_bodyCollection']=new _0x5051fd(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_bodyCollection']['add'](this['balloonPanelView']),_0x40349f;}['_handleUserAdd'](_0x11cab1){if(!this['context']['config']['get']('presenceList.displayMe')&&_0x11cab1['isMe'])return;const _0x10fdab=this['context']['config']['get']('presenceList.collapseAt')-0x1;for(this['usersCount']++;this['currentDisplayedUsers']['length']>=_0x10fdab-(this['view']['isCollapsed']?0x1:0x0)&&this['currentDisplayedUsers']['length']>0x1;)this['currentDisplayedUsers']['remove'](0x1);const _0x7799da=_0x11cab1['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0x11cab1,_0x7799da);}['_handleUserRemove'](_0x1bde27){this['usersCount']--;const {collapseAt:_0x924052}=this['context']['config']['get']('presenceList'),_0x446724=this['usersCount']>=_0x924052;if(this['currentDisplayedUsers']['get'](_0x1bde27['id']))this['currentDisplayedUsers']['remove'](_0x1bde27['id']);else{if(_0x446724&&this['currentDisplayedUsers']['length']+0x1===_0x924052-0x1)return;}if(this['currentDisplayedUsers']['length']+(_0x446724?0x1:0x0)<this['usersCount']){for(const _0xe22a97 of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0xe22a97['id'])&&(this['currentDisplayedUsers']['add'](_0xe22a97,Math['min'](this['currentDisplayedUsers']['length']-(_0x446724?0x1:0x0),0x1)),this['currentDisplayedUsers']['length']+(_0x446724?0x1:0x0)===_0x924052-0x1))return;}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0x97aa6d=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new x(this['context']['locale'],!!_0x97aa6d['onClick']),this['view']['inlineListView']['isExpanded']=!0x0,this['listenTo'](this['presenceDropdownView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();});const {listWrapperView:_0x10e001}=this['presenceDropdownView'];_0x10e001['items']['bindTo'](this['_allConnectedUsers'])['using'](_0x85f4d7=>{if(!_0x97aa6d['displayMe']&&_0x85f4d7['isMe'])return null;const _0x36fb3a=new k(this['context']['locale'],_0x85f4d7,!!_0x97aa6d['onClick']);return _0x97aa6d['onClick']&&this['listenTo'](_0x36fb3a,'execute',()=>{_0x97aa6d['onClick'](_0x85f4d7,_0x36fb3a['element']);}),_0x36fb3a;}),this['balloonPanelView']['content']['add'](this['presenceDropdownView']),this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element']}),_0x10e001['focus'](),_0x10e001['checkIfScrollable']();const _0xb8b315=(_0x1d69fe,_0x2cb2c6)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0x2cb2c6();};_0x10e001['keystrokes']['set']('Esc',_0xb8b315),_0x10e001['keystrokes']['set']('Shift+Tab',_0xb8b315),_0x10e001['keystrokes']['set']('Tab',(_0x36ed5b,_0x5bb5da)=>{!function(_0x10b3a0){const _0x2ba3d2=['a','button','input','select','textarea','[tabindex]','[contenteditable]']['map'](_0xc87d07=>_0xc87d07+':not([disabled]):not([tabindex=\x22-1\x22])')['join'](','),_0x3bbdb8=[...document['body']['querySelectorAll'](_0x2ba3d2)]['filter'](_0x35248b=>_0x35248b===document['activeElement']||_0x35248b['offsetWidth']+_0x35248b['offsetHeight']>0x0)['sort']((_0x4fac27,_0x50fc89)=>(_0x4fac27['tabIndex']||0x0)-(_0x50fc89['tabIndex']||0x0)),_0x5bbe23=_0x3bbdb8['indexOf'](_0x10b3a0),_0x5ace2d=_0x3bbdb8[(_0x5bbe23+0x1)%_0x3bbdb8['length']];_0x5ace2d&&_0x5ace2d['focus']();}(this['view']['element']),this['hideDropdown'](),_0x5bb5da();}),_0x10e001['focusTracker']['add'](this['view']['element']),_0x10e001['focusTracker']['on']('change:isFocused',(_0x3342d5,_0x4fdb04,_0x2fae73)=>{_0x2fae73||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 s extends _0x4692aa{static get['requires'](){return[i,r];}static get['pluginName'](){return'PresenceList';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}export{a as CloudServicesCommentsAdapter,u as CloudServicesRevisionHistoryAdapter,f as CloudServicesTrackChangesAdapter,s as PresenceList,r as PresenceListUI,l as RealTimeCollaborationClient,m as RealTimeCollaborativeComments,n as RealTimeCollaborativeEditing,g as RealTimeCollaborativeRevisionHistory,p as RealTimeCollaborativeTrackChanges,i as Sessions};
|
|
23
|
+
import{ContextPlugin as _0x13ca15,Plugin as _0x5d314d,PendingActions as _0x3b4f40,Context as tt}from'@ckeditor/ckeditor5-core/dist/index.js';import{DomEmitterMixin as _0x2c2c4e,CKEditorError as _0xde887b,Collection as _0x3e5bed,global as _0x54a206,version as ht,uid as _0x2914c6,KeystrokeHandler as _0x280424}from'@ckeditor/ckeditor5-utils/dist/index.js';import{Notification as _0x475e99,View as _0x313ca1,ListView as _0x143568,ListItemView as lt,LabelView as pt,BalloonPanelView as _0x4e0a31,clickOutsideHandler as _0xd64d71,BodyCollection as _0x174323}from'@ckeditor/ckeditor5-ui/dist/index.js';import{LiveRange as ft,History as _0x4d758f,NoOperation as _0x509d18,InsertOperation as _0x504b7b,MarkerOperation as _0x4d2e86,RootAttributeOperation as _0x168a31,transformSets as _0x5935bf,OperationFactory as _0xad7321}from'@ckeditor/ckeditor5-engine/dist/index.js';import{WebSocketGateway as mt,WEB_SOCKET_GATEWAY_STATES as _0x56397d,CollaborativeEditingService as _0x4fd6f3,User as gt,CommentsService as et,TrackChangesService as at,RevisionHistoryService as rt,EditorService as it}from'@ckeditor/ckeditor-cloud-services-collaboration/dist/index.js';import{Users as _0x230f7f,UserView as ut}from'ckeditor5-collaboration/dist/index.js';import{Compressor as _0xc49be6}from'@ckeditor/ckeditor5-operations-compressor/dist/index.js';import{isElement as _0x36837c}from'es-toolkit/compat';class c extends _0x13ca15{static ['WebSocketGateway']=/* #__PURE__ -- @preserve */
|
|
24
|
+
((()=>mt)());static ['initialReconnectionInterval']=0x3e8;['connection'];['_reconnectionStack'];['_shouldPluginsReconnect'];['_domEmitter'];static get['requires'](){return['CloudServices',_0x475e99];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x1fc7ae){super(_0x1fc7ae),this['set']('state',_0x56397d['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=Object['create'](_0x2c2c4e);}['init'](){const _0x64120b=this['context'],_0x930d2d=_0x64120b['plugins']['get']('CloudServices'),_0x46a0f8=_0x64120b['plugins']['get'](_0x475e99);if(!_0x930d2d['token'])throw new _0xde887b('websocketgateway-missing-token',this);if(!_0x930d2d['webSocketUrl'])throw new _0xde887b('websocketgateway-missing-websocket-url',this);return this['_domEmitter']['listenTo'](window,'offline',()=>this['_isBrowserOffline']=!0x0),this['_domEmitter']['listenTo'](window,'online',()=>this['_isBrowserOffline']=!0x1),this['context']['config']['define']('cloudServices.connectionTimeout',0xa),this['context']['config']['define']('cloudServices.requestTimeout',0x14),c['WebSocketGateway']['connect'](_0x930d2d['token'],_0x930d2d['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0x2173ac=>{if(this['connection']=_0x2173ac,this['bind']('state')['to'](_0x2173ac,'state',this,'_isBrowserOffline',(_0x14e4bf,_0x1b26f5)=>('connected'!==_0x14e4bf&&(this['_shouldPluginsReconnect']=!0x0),_0x1b26f5||_0x14e4bf!==_0x56397d['CONNECTED']?_0x56397d['DISCONNECTED']:this['state']==_0x56397d['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),_0x56397d['CONNECTING']):_0x56397d['CONNECTED'])),this['connection']['on']('error',(_0xd4a689,_0x57e34e)=>{if('limitExceeded'!==_0x57e34e['code'])throw console['error'](_0x57e34e),new _0xde887b('cloudservices-init',null,{'originalError':_0x57e34e});_0x46a0f8['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'});}),!_0x2173ac['me'])return new Promise(_0x471984=>_0x2173ac['on']('change:me',_0x471984));})['catch'](_0x1fa069=>{throw console['error'](_0x1fa069),new _0xde887b('cloudservices-init',null,{'originalError':_0x1fa069});});}['addToReconnectionStack'](_0x1b4e95){if('function'!=typeof _0x1b4e95['reconnect'])throw new _0xde887b('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0x1b4e95))throw new _0xde887b('websocketgateway-plugin-already-registered',this,{'name':_0x1b4e95['constructor']['pluginName']});this['_reconnectionStack']['add'](_0x1b4e95);}['removeFromReconnectionStack'](_0x2e0c8f){this['_reconnectionStack']['delete'](_0x2e0c8f);}['isInReconnectionStack'](_0x5605fa){return this['_reconnectionStack']['has'](_0x5605fa);}['_reconnect'](){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0x425eb3=>_0x425eb3['reconnect']())))['then'](()=>this['state']=_0x56397d['CONNECTED'])['catch'](_0x316d54=>{throw console['error'](_0x316d54),new _0xde887b('cloudservices-reconnection-error',this['context']);});}['disconnect'](){this['connection']&&this['connection']['disconnect'](),this['state']=_0x56397d['DISCONNECTED'],this['_domEmitter']['stopListening']();}['destroy'](){this['disconnect'](),super['destroy']();}}class i extends _0x13ca15{['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[c,_0x230f7f];}constructor(_0x4d2929){super(_0x4d2929),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0x3e5bed(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x230f7f);}['init'](){const _0x506deb=this['context']['plugins']['get'](c);this['listenTo'](_0x506deb,'change:state',(_0x9cc682,_0x4e5aa9,_0x41f514)=>{if('connected'!==_0x41f514)this['channelSessions']['forEach'](_0x284d52=>_0x284d52['clear']()),this['channelConnectedUsers']['forEach'](_0x55d60c=>_0x55d60c['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x3faf4d,_0x1a1051]of this['_registeredSessions'])for(const _0x13eef6 of _0x1a1051)this['_handleSessionAdd'](_0x3faf4d,_0x13eef6);}}),this['_createUser'](_0x506deb['connection']['me'],!0x0);}['register'](_0x374387,_0x539698){if(this['_registeredSessions']['has'](_0x374387))throw new _0xde887b('sessions-register-already-registered',null,{'channelId':_0x374387});this['_registeredSessions']['set'](_0x374387,_0x539698),this['channelSessions']['set'](_0x374387,new _0x3e5bed()),this['channelConnectedUsers']['set'](_0x374387,new _0x3e5bed()),this['listenTo'](_0x539698,'add',(_0x186f68,_0x19fe69)=>this['_handleSessionAdd'](_0x374387,_0x19fe69)),this['listenTo'](_0x539698,'remove',(_0x1c3178,_0x194956)=>this['_handleSessionRemove'](_0x374387,_0x194956));for(const _0x39fcba of _0x539698)this['_handleSessionAdd'](_0x374387,_0x39fcba);}['unregister'](_0xf5460){if(!this['_registeredSessions']['has'](_0xf5460))throw new _0xde887b('sessions-unregister-not-exist',null,{'channelId':_0xf5460});const _0x2efc20=this['_registeredSessions']['get'](_0xf5460);this['stopListening'](_0x2efc20);for(const _0x14507d of _0x2efc20)'connected'===this['context']['plugins']['get'](c)['state']&&this['_handleSessionRemove'](_0xf5460,_0x14507d);this['_registeredSessions']['delete'](_0xf5460),this['channelSessions']['delete'](_0xf5460),this['channelConnectedUsers']['delete'](_0xf5460);}get['mySessionId'](){return this['context']['plugins']['get'](c)['connection']['sessionId'];}['getUserBySessionId'](_0x2924fc){for(const _0x3ad65c of this['channelSessions']['values']())for(const _0xcc1fbf of _0x3ad65c)if(_0xcc1fbf['id']===_0x2924fc)return _0xcc1fbf['user'];}['getUserSessions'](_0x5123eb,_0x227547){const _0x5ebd33=_0x227547?[this['channelSessions']['get'](_0x227547)]:this['channelSessions']['values'](),_0x2be5ec=new Set();for(const _0x5d1ade of _0x5ebd33)for(const _0x80ccea of _0x5d1ade)_0x80ccea['user']['id']===_0x5123eb['id']&&_0x2be5ec['add'](_0x80ccea['id']);return _0x2be5ec;}['getUserRole'](_0x16a256){for(const _0x1cc6e1 of this['channelSessions']['values']())for(const _0x2a378a of _0x1cc6e1)if(_0x2a378a['user']===_0x16a256)return _0x2a378a['role'];}['_handleSessionAdd'](_0x2b0512,_0x33b7b1){if('connected'!==this['context']['plugins']['get'](c)['state'])return;const _0x7af09b=_0x33b7b1['user'],_0x2c6dfc=this['_users']['getUser'](_0x7af09b['id'])||this['_createUser'](_0x7af09b),_0x4251ec=Object['assign']({},_0x33b7b1,{'user':_0x2c6dfc});this['channelSessions']['get'](_0x2b0512)['add'](_0x4251ec);const _0x2d5145=this['channelConnectedUsers']['get'](_0x2b0512);_0x2d5145['has'](_0x2c6dfc['id'])||_0x2d5145['add'](_0x2c6dfc),this['allConnectedUsers']['has'](_0x2c6dfc['id'])||this['allConnectedUsers']['add'](_0x2c6dfc,_0x2c6dfc['isMe']?0x0:void 0x0),this['fire']('sessionAdd:'+_0x2b0512,{'channelId':_0x2b0512,'session':_0x4251ec});}['_handleSessionRemove'](_0x4c2b7a,_0x33efba){if('connected'!==this['context']['plugins']['get'](c)['state'])return;const _0x38d726=this['channelConnectedUsers']['get'](_0x4c2b7a),_0x3dae61=_0x33efba['user'];_0x3dae61['id']&&(this['channelSessions']['get'](_0x4c2b7a)['remove'](_0x33efba['id']),_0x38d726['has'](_0x3dae61['id'])&&!this['getUserSessions'](_0x3dae61,_0x4c2b7a)['size']&&_0x38d726['remove'](_0x3dae61['id']),this['allConnectedUsers']['get'](_0x3dae61['id'])&&!this['getUserSessions'](_0x3dae61)['size']&&this['allConnectedUsers']['remove'](_0x3dae61['id']));}['_createUser'](_0x38c2a1,_0x4e262e){const _0x27dda4=this['_users']['addUser'](_0x38c2a1);return _0x4e262e&&this['_users']['defineMe'](_0x38c2a1['id']),_0x27dda4['orderNumber']=this['_uniqueUsersCount']++,_0x27dda4;}}class B extends _0x5d314d{['_domEmitter']=new(_0x2c2c4e())();static get['requires'](){return[i];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x132e35=this['editor'],_0x46f257=_0x132e35['plugins']['get'](i);_0x132e35['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x219e98,{writer:_0x11888c})=>function(_0x306382,_0x5e523d,_0x1e1c67,_0x3cfba4){const _0x1928b4=_0x306382['markerName']['split'](':')[0x2],_0x2aebbe=_0x1e1c67['getUserBySessionId'](_0x1928b4);if(!_0x2aebbe||_0x1928b4===_0x1e1c67['mySessionId'])return;if(!_0x3cfba4['model']['schema']['checkChild'](_0x306382['markerRange']['start'],'$text'))return;const _0x236cd1={'class':'ck-user__marker\x20'+_0x2aebbe['color']['getMarkerClass'](),'data-name':_0x2aebbe['name'],'data-session-id':_0x1928b4},_0x59cb63=_0x3cfba4['model']['markers']['get'](_0x306382['markerName']),_0x2ae01b=_0x59cb63['getStart'](),_0x3ac259=_0x2ae01b['nodeAfter'],_0x2c69e6=_0x3cfba4['model']['schema'];if(_0x3ac259&&_0x2c69e6['isObject'](_0x3ac259)&&_0x2c69e6['isInline'](_0x3ac259)&&!_0x3cfba4['model']['markers']['get']('user:range:'+_0x1928b4)['getRange']()['isCollapsed'])return;const _0x206afb=_0x2ae01b['parent'];return _0x3cfba4['model']['schema']['isLimit'](_0x206afb)&&!_0x3cfba4['model']['hasContent'](_0x206afb)&&(_0x236cd1['contenteditable']=!0x1),function(_0x4c2a63,_0x2406bf,_0x9ba74c){const _0x5e347a=_0x4c2a63['createUIElement']('span',_0x2406bf);return _0x4c2a63['setCustomProperty']('userPositionMarker',!0x0,_0x5e347a),_0x5e347a['render']=function(_0x32ba4e){const _0x44cf4c=this['toDomElement'](_0x32ba4e),_0xc61352=document['createElement']('span');return _0xc61352['classList']['add']('ck-user__marker-tooltip'),_0xc61352['setAttribute']('contenteditable','false'),_0xc61352['setAttribute']('spellcheck','false'),_0xc61352['textContent']=_0x9ba74c['name'],_0x44cf4c['innerHTML']='<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span>'+_0xc61352['outerHTML']+'',_0x44cf4c['addEventListener']('mouseenter',()=>{_0x44cf4c['classList']['add']('ck-user__marker_hovered');}),_0x44cf4c['addEventListener']('mouseleave',()=>{_0x44cf4c['classList']['remove']('ck-user__marker_hovered');}),_0x44cf4c;},_0x5e347a['isSimilar']=function(_0x23f88a){return!(!this['getCustomProperty']('userPositionMarker')||!_0x23f88a['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0x23f88a['getAttribute']('data-session-id'));},_0x5e347a;}(_0x5e523d,_0x236cd1,_0x2aebbe);}(_0x219e98,_0x11888c,_0x46f257,_0x132e35)}),_0x132e35['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0x2fcd47=>function(_0x3fcbf9,_0xc3fcce){const _0x3d3333=_0x3fcbf9['markerName']['split'](':')[0x2];if(_0x3d3333===_0xc3fcce['mySessionId'])return null;const _0x5eba4d=_0xc3fcce['getUserBySessionId'](_0x3d3333);if(!_0x5eba4d)return{'id':_0x3d3333,'classes':[]};return{'id':_0x3d3333,'classes':['ck-user__selection',_0x5eba4d['color']['getSelectionClass']()],'attributes':{'data-session-id':_0x3d3333},'priority':0x7d0+_0x5eba4d['orderNumber']};}(_0x2fcd47,_0x46f257)}),function(_0x5af12f){const _0x2a5dea=_0x5af12f['model'],_0x574d72=new Map(),_0x1d5ae9=_0x5af12f['plugins']['get'](i);_0x2a5dea['markers']['on']('update:user:range',(_0x252aec,_0x475ae6,_0x2f6268,_0x16338b)=>{if(!_0x16338b&&_0x574d72['get'](_0x475ae6['name']))return _0x574d72['get'](_0x475ae6['name'])['detach'](),void _0x574d72['delete'](_0x475ae6['name']);const _0x69bf71=_0x475ae6['name']['split'](':')[0x2];if(_0x69bf71===_0x1d5ae9['mySessionId'])return;const _0x1c7694='user:position:'+_0x69bf71;_0x2a5dea['markers']['has'](_0x1c7694)&&_0x5af12f['editing']['reconvertMarker'](_0x1c7694),_0x475ae6['on']('change:range',(_0xca3dce,_0x49ff09,_0x509116)=>{if('$graveyard'!=_0x49ff09['root']['rootName']&&'$graveyard'==_0x475ae6['getRange']()['root']['rootName']&&!_0x574d72['has'](_0x475ae6['name'])){const _0x5bdfe8=_0x2a5dea['schema']['getNearestSelectionRange'](_0x509116['deletionPosition']);if(_0x5bdfe8){const _0x5effef=ft['fromRange'](_0x5bdfe8);_0x574d72['set'](_0x475ae6['name'],_0x5effef),_0x5effef['on']('change:range',(_0x562194,_0x411e08,_0x598937)=>{if('$graveyard'==_0x5effef['root']['rootName']){const _0x11511d=_0x2a5dea['schema']['getNearestSelectionRange'](_0x598937['deletionPosition']);_0x11511d?(_0x5effef['start']=_0x11511d['start'],_0x5effef['end']=_0x11511d['end']):(_0x574d72['delete'](_0x475ae6['name']),_0x5effef['detach']());}});}}});}),_0x2a5dea['document']['on']('change',()=>{_0x574d72['size']>0x0&&_0x2a5dea['enqueueChange']({'isUndoable':!0x1},_0x4e5091=>{for(const [_0xe0c516,_0x4ebd5a]of _0x574d72)'$graveyard'==_0x2a5dea['markers']['get'](_0xe0c516)['getRange']()['root']['rootName']&&(X(_0xe0c516['split'](':')[0x2],_0x4ebd5a['toRange'](),_0x2a5dea,_0x4e5091),_0x4ebd5a['detach']());_0x574d72['clear']();});});}(_0x132e35),this['_domEmitter']['listenTo'](_0x54a206['document'],'keydown',(_0x58a2e6,{key:_0x551c8a})=>{'Escape'===_0x551c8a&&function(_0x44d142){_0x44d142['editing']['view']['change'](_0x57eacf=>{for(const _0x5afbb7 of _0x44d142['model']['markers']){if(!_0x5afbb7['name']['startsWith']('user:position'))continue;const _0x15e1c9=_0x44d142['editing']['mapper']['markerNameToElements'](_0x5afbb7['name']);if(_0x15e1c9){for(const _0x4abc56 of _0x15e1c9)_0x57eacf['removeClass']('ck-user__marker_hovered',_0x4abc56);}}});}(_0x132e35);},{'useCapture':!0x0});}['afterInit'](){const _0x2ba8db=this['editor'],_0x37646f=_0x2ba8db['commands']['get']('undo');_0x37646f&&_0x2ba8db['model']['on']('applyOperation',(_0x31f1fb,_0x146a5d)=>{const _0x2d8647=_0x146a5d[0x0];if(!_0x2d8647['isDocumentOperation'])return;if('marker'!=_0x2d8647['type']||!_0x2d8647['name']['startsWith']('user:'))return;const _0x4b1ece=_0x2d8647['batch'];_0x37646f['_createdBatches']['has'](_0x4b1ece)&&(_0x2d8647['newRange']=_0x2d8647['oldRange']?_0x2ba8db['model']['createRange'](_0x2d8647['oldRange']['start'],_0x2d8647['oldRange']['end']):null);},{'priority':'highest'});}['destroy'](){return this['_domEmitter']['stopListening'](),super['destroy']();}['createUserMarkerOperations'](){const _0x5b0d87=this['editor'],_0x283a3d=_0x5b0d87['model']['document'],_0x522809=_0x5b0d87['plugins']['get'](i);_0x5b0d87['model']['enqueueChange']({'isUndoable':!0x1},_0xba38db=>{const _0xd60fe0='user:range:'+_0x522809['mySessionId'],_0x51890f='user:position:'+_0x522809['mySessionId'],_0x3a9eca=_0x5b0d87['model']['markers']['has'](_0xd60fe0);_0x5b0d87['editing']['view']['hasDomSelection']?X(_0x522809['mySessionId'],_0x283a3d['selection']['getFirstRange'](),_0x5b0d87['model'],_0xba38db):_0x3a9eca&&(_0xba38db['removeMarker'](_0xd60fe0),_0xba38db['removeMarker'](_0x51890f));});}}function X(_0x44ae31,_0x13e884,_0x4ff24f,_0x4c246d){const _0x2e8933='user:range:'+_0x44ae31,_0x507507='user:position:'+_0x44ae31,_0x3d9fe0=_0x13e884['getContainedElement']();let _0x480bf3=_0x13e884['start'];if(_0x3d9fe0&&_0x3d9fe0['is']('element','tableCell')){const _0x25d62a=function(_0xe7a8d1,_0x5c379a){for(const _0x14a521 of _0xe7a8d1['getPositions']())if(_0x5c379a['schema']['checkChild'](_0x14a521,'$text'))return _0x14a521;}(_0x13e884,_0x4ff24f);_0x25d62a&&(_0x480bf3=_0x25d62a,_0x13e884=_0x4c246d['createRange'](_0x480bf3));}const _0x308705=_0x4c246d['createRange'](_0x480bf3);_0x4ff24f['markers']['has'](_0x2e8933)?(_0x4c246d['updateMarker'](_0x2e8933,{'range':_0x13e884}),_0x4c246d['updateMarker'](_0x507507,{'range':_0x308705})):(_0x4c246d['addMarker'](_0x2e8933,{'range':_0x13e884,'usingOperation':!0x0}),_0x4c246d['addMarker'](_0x507507,{'range':_0x308705,'usingOperation':!0x0}));}function M(_0x960aa1,_0x199360,_0xec4f9f){const _0x330ee4=_0x960aa1['t'],t=_0x960aa1['t'];switch(_0x199360){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 _0x330ee4({'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'},_0xec4f9f);default:return'';}}let F=0x1;class l extends _0x5d314d{static ['CollaborativeEditingService']=/* #__PURE__ -- @preserve */
|
|
25
|
+
((()=>_0x4fd6f3)());['_offset'];['sessionId'];['serverHistory'];['_channelId'];['_service'];['_document'];['_compressor'];['_bufferedOperations'];['_knownOperations'];['_knownRootNames'];['_pendingAction'];['_hasSelectionChanged'];['_sendBufferedOperationsDelayId'];['_baseBufferDelay'];['_currentBufferDelay'];['_lastSyncedOperationId'];['_disconnectionOperations'];['_operationIdentifier'];static get['requires'](){return[c,i,B,_0x3b4f40,_0x230f7f,_0x475e99];}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 _0x2981fa=this['serverHistory']['getOperations']();for(let _0x1de7f7=_0x2981fa['length']-0x1;_0x1de7f7>=0x0;_0x1de7f7--){const _0x5dae68=_0x2981fa[_0x1de7f7];if(!this['_disconnectionOperations']['has'](_0x5dae68))return _0x5dae68['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0x33d3ae){if(super(_0x33d3ae),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x4d758f(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0xde887b('collaboration-missing-channelid',this);const _0x2dbd9a=_0x33d3ae['config']['get']('cloudServices.bundleVersion')||ht;this['_service']=new l['CollaborativeEditingService'](_0x2dbd9a,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0xc49be6(),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 $(this['_disconnectionOperations']);}['init'](){const _0x43ed93=this['editor'],_0x455337=_0x43ed93['plugins']['get'](_0x230f7f),_0x42a0ea=_0x43ed93['plugins']['get'](c);this['listenTo'](_0x455337,'getOperationAuthor',(_0x8ee1da,_0x5c2ab5)=>{const _0x36e471=_0x5c2ab5[0x0];_0x36e471['_authorId']&&(_0x8ee1da['return']=_0x455337['getUser'](_0x36e471['_authorId']),_0x8ee1da['stop']()),null===_0x36e471['_authorId']&&(_0x8ee1da['return']=null,_0x8ee1da['stop']());},{'priority':'high'}),this['listenTo'](_0x43ed93['model']['document']['selection'],'change:range',(_0x4f2665,_0x2ecaeb)=>{_0x2ecaeb['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x43ed93['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x43ed93['model']['on']('applyOperation',(_0x2340c1,_0x472b50)=>{const _0x38c24f=_0x472b50[0x0];_0x38c24f['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0x38c24f),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['bind']('_isEditingAllowed')['to'](_0x42a0ea,'state',this,'_hasSynchronizationProblem',(_0x33bd68,_0x9b14fd)=>'connected'===_0x33bd68&&!_0x9b14fd),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x43ed93['disableReadOnlyMode']('rtc-offline'):_0x43ed93['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x43ed93['disableReadOnlyMode']('rtc-offline'):_0x43ed93['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async['reconnect'](){const _0xc39f73=this['editor']['plugins']['get'](i),_0x21c01a=this['editor']['plugins']['get'](c);try{this['_isPendingUpdate']=!0x0,_0xc39f73['unregister'](this['_channelId']);const _0x10cd05=await this['_service']['reconnect'](_0x21c01a['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0x10cd05)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x83dbd4=await this['_service']['getConnectedSessions']();_0xc39f73['register'](this['_channelId'],_0x83dbd4),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x1415ba){if(function(_0x29852b){return'404'===_0x29852b['code'];}(_0x1415ba)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0x105af2){return'409'===_0x105af2['code'];}(_0x1415ba)){const _0x26204a=M(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'](_0x26204a);}else{if(!(_0x1415ba instanceof q))throw _0x1415ba;this['_handleReconnectionError']();}}}}['destroy'](){const _0x29b993=this['editor']['plugins']['get'](c),_0x278b60=this['editor']['plugins']['get'](i);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x278b60['channelSessions']['has'](this['_channelId'])&&_0x278b60['unregister'](this['_channelId']),_0x29b993['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async['_handleReconnectionResponse'](_0x4ace30){if(this['sessionId']!==_0x4ace30['sessionId']&&this['_lastSyncedOperationId']!==_0x4ace30['lastOperationId'])throw new q();return this['sessionId']=_0x4ace30['sessionId'],this['_handleServerResponse']([],{..._0x4ace30,'wereChangesApplied':!0x1,'data':_0x4ace30['data']},'reconnect');}async['_connectService'](_0x253fad,_0x1ce65d=!0x1){const {connection:_0x508096}=this['editor']['plugins']['get'](c);l['CollaborativeEditingService']['getConnectedSessions'](_0x508096,this['_channelId'])['then'](_0xb7b6bb=>this['_initSessionsHandling'](_0xb7b6bb))['catch'](_0x2fcee8=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x2fcee8);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x8921e4,_0x415ce3)=>{this['_crash']('realtimecollaborationclient-init-service-internal-error',_0x415ce3);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_isConnected']=!0x1;});const _0x3b3a39=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x253fad);this['_isPendingUpdate']=!0x0;const _0x3b98aa=await this['_service']['connect'](_0x508096,this['_compressOperations'](_0x253fad),_0x3b3a39);if(this['sessionId']=_0x3b98aa['sessionId'],_0x1ce65d){if(!_0x3b98aa['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x3b98aa['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0x253fad,_0x3b98aa,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x3b98aa,_0x253fad);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}['_handleSendingSelectionMarkers'](){const _0x4483f4=this['editor']['plugins']['get'](i),_0xecf6fc=this['editor']['plugins']['get'](B),_0x3e8485=_0x4483f4['channelSessions']['get'](this['_channelId']);_0x3e8485&&_0x3e8485['length']>0x1?_0xecf6fc['createUserMarkerOperations']():this['listenTo'](_0x4483f4,'sessionAdd:'+this['_channelId'],()=>{0x2===_0x4483f4['channelSessions']['get'](this['_channelId'])['length']&&_0xecf6fc['createUserMarkerOperations']();});}async['_handleReceivedOperations'](_0x393d43,_0x130b77,_0x3fe445,_0x49051c){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x130b77){const _0x85a52f=this['_decompressOperations'](_0x3fe445,_0x49051c);await this['_fetchMissingUsers'](_0x85a52f),this['_handleExternalOperations'](_0x85a52f,_0x130b77,_0x3fe445['lastOperationId'])||this['_crash']('realtimecollaborationclient-init-service-incorrect-server-operation');}}async['_connectAfterSessionHasBeenFlushed'](){this['_disconnectService']();const {locale:_0x217f84}=this['editor'];let _0x4897e9;try{_0x4897e9=await this['_service']['getDocumentDetails']();}catch{const _0x4fc1f9=M(_0x217f84,'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'](_0x4fc1f9);}const _0x29cdd3=_0x4897e9['currentDocumentSession']||_0x4897e9['lastDocumentSession'];if(this['_lastSyncedOperationId']===_0x29cdd3['lastOperationId'])await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);else{const _0x2de306=M(_0x217f84,'The\x20last\x20saved\x20version\x20of\x20the\x20document\x20does\x20not\x20match\x20the\x20local\x20version.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.');this['_handleReconnectionError'](_0x2de306);}}['_disconnectService'](){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['stopListening'](this['_service']);}['_initSessionsHandling'](_0x263374){const _0x1e82bd=this['editor']['plugins']['get'](i);this['listenTo'](_0x1e82bd,'sessionAdd:'+this['_channelId'],(_0x31baac,{session:_0x1465e2})=>{if(_0x1465e2['id']===_0x1e82bd['mySessionId']){_0x31baac['off']();const _0x12a364=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0x122c6f=_0x1465e2['permissions'];_0x12a364&&_0x12a364['isEnabled']&&(_0x122c6f=_0x122c6f['filter'](_0x54e378=>'document:write'!==_0x54e378)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0x122c6f,this['_channelId']);}}),_0x1e82bd['register'](this['_channelId'],_0x263374);}['_initThrowingOnDataSet'](){const _0x32b5f3=this['editor']['data']['set'];this['editor']['data']['set']=(..._0x4f01dd)=>{if(!_0x4f01dd[_0x4f01dd['length']-0x1]['suppressErrorInCollaboration'])throw new _0xde887b('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x32b5f3['apply'](this['editor']['data'],_0x4f01dd);};}['_setUpDataInit'](){this['editor']['data']['on']('init',(_0x202c7c,[_0x59f316])=>{if(this['_document']['version'])throw new _0xde887b('realtimecollaborationclient-init-document-already-initialized',this);_0x202c7c['stop'](),this['_setPendingAction']();const _0x182192=this['editor']['config']['get']('rootsAttributes'),_0x313aa5=this['_getOperationsFromInitData'](_0x59f316,_0x182192);0x0==_0x313aa5['length']&&_0x313aa5['push'](new _0x509d18(0x0)),_0x202c7c['return']=this['_connectService'](_0x313aa5)['then'](()=>{this['editor']['plugins']['get'](c)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x6c73ce=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x6c73ce))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x16c7ca,[_0x3b7608,_0x541dee])=>{_0x16c7ca['stop']();const _0xb31a28=this['editor']['model']['document']['getRoot'](_0x3b7608);if(!this['_knownRootNames']['has'](_0x3b7608)){const _0xd9272f=_0x541dee&&_0x541dee['data']?_0x541dee['data']:'',_0x1a6044=_0x541dee&&_0x541dee['attributes']?_0x541dee['attributes']:{};await this['_loadRoot'](_0x3b7608,_0xd9272f,_0x1a6044);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0xb31a28['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0xb31a28);});},{'priority':'high'});}async['_fetchMissingUsers'](_0x5d886b){const _0x407311=this['editor']['plugins']['get'](_0x230f7f),{connection:_0x40e19b}=this['editor']['plugins']['get'](c),_0x2e6c61=new Set();for(const _0x4fdcfc of _0x5d886b){const _0x494d31=_0x4fdcfc['_authorId'];_0x494d31&&!_0x407311['getUser'](_0x494d31)&&_0x2e6c61['add'](_0x494d31);}if(0x0===_0x2e6c61['size'])return;const _0x16f77e=await gt['getMany'](_0x40e19b,Array['from'](_0x2e6c61));for(const _0x21b6e7 of _0x16f77e)_0x407311['getUser'](_0x21b6e7['id'])||_0x407311['addUser'](_0x21b6e7);}['_getOperationsFromInitData'](_0x50c5b7,_0x508e5f={}){const _0x5ef4e5=this['editor']['model'],_0x322739=[];let _0xcbe730=0x0;const _0x21b1c3='string'==typeof _0x50c5b7?{'main':_0x50c5b7}:_0x50c5b7;for(const _0x224c68 of Object['keys'](_0x21b1c3)){if(!this['_document']['roots']['has'](_0x224c68))throw new _0xde887b('realtimecollaborationclient-init-non-existent-root',this);const _0x584abb=this['editor']['data']['parse'](_0x21b1c3[_0x224c68]),_0x2c3568=this['_document']['getRoot'](_0x224c68),_0xd91b36=new _0x504b7b(_0x5ef4e5['createPositionAt'](_0x2c3568,0x0),_0x584abb,_0xcbe730++);_0x322739['push'](_0xd91b36);for(const [_0x43d51f,_0x2f04af]of _0x584abb['markers']){const _0x11153f=_0x5ef4e5['createRange'](_0x5ef4e5['createPositionFromPath'](_0x2c3568,_0x2f04af['start']['path']['slice']()),_0x5ef4e5['createPositionFromPath'](_0x2c3568,_0x2f04af['end']['path']['slice']())),_0x32f68a=new _0x4d2e86(_0x43d51f,null,_0x11153f,_0x5ef4e5['markers'],!0x0,_0xcbe730++);_0x322739['push'](_0x32f68a);}}if(_0x508e5f)for(const [_0x33b7ac,_0x4a6691]of Object['entries'](_0x508e5f)){const _0x4c25a6=_0x5ef4e5['document']['getRoot'](_0x33b7ac);if(!_0x4c25a6)throw new _0xde887b('multi-root-editor-root-attributes-no-root',null);for(const [_0x2f0d94,_0x5c01c5]of Object['entries'](_0x4a6691))if(null!==_0x5c01c5){const _0x49c4f2=new _0x168a31(_0x4c25a6,_0x2f0d94,null,_0x5c01c5,_0xcbe730++);_0x322739['push'](_0x49c4f2);}}return _0x322739;}async['_loadRoot'](_0x29e573,_0x454447,_0x174ffc){this['_getOperationsFromInitData']({[_0x29e573]:_0x454447},{[_0x29e573]:_0x174ffc})['forEach']((_0x537e70,_0x588d11)=>{_0x537e70['baseVersion']=this['_document']['version']+_0x588d11,_0x537e70['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x537e70);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async['_handleInitialConnectionData'](_0x18fd26,_0x413057){let _0x7cc878;this['_offset']=_0x18fd26['offset'];const _0x1332eb=_0x18fd26['wereChangesApplied']&&!_0x18fd26['initData'],_0x1e30ab=_0x1332eb?0x0:_0x18fd26['data']['baseVersion'];if(_0x413057['forEach'](_0x37b116=>{_0x37b116['_isInit']=!0x0,_0x37b116['createdAt']=_0x18fd26['sessionCreatedAt'],_0x37b116['_authorId']=null;}),_0x1332eb)_0x7cc878=_0x413057,this['_applyOperationsSet'](_0x7cc878,_0x1332eb);else{if(_0x18fd26['initData']){const _0x5d30c0=this['_getOperationsFromInitData'](_0x18fd26['initData']);this['_document']['history']['version']=-_0x5d30c0['length'],_0x5d30c0['forEach'](_0x223fc4=>{_0x223fc4['baseVersion']-=_0x5d30c0['length'],_0x223fc4['createdAt']=_0x18fd26['sessionCreatedAt'],_0x223fc4['_isInit']=!0x0,_0x223fc4['_authorId']=null;}),this['_applyOperationsSet'](_0x5d30c0,!0x0),this['serverHistory']['version']=-_0x5d30c0['length']+this['_offset'],this['_updateServerHistory'](_0x5d30c0);}this['_document']['history']['version']=_0x1e30ab,_0x7cc878=this['_decompressOperations'](_0x18fd26['data'],_0x18fd26['metadata']),await this['_fetchMissingUsers'](_0x7cc878),this['_applyOperationsSet'](_0x7cc878,_0x1332eb);}_0x18fd26['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x7cc878,_0x18fd26['lastOperationId']),this['_lastSyncedOperationId']=_0x18fd26['lastOperationId']),this['serverHistory']['version']=_0x1e30ab+this['_offset'],this['_updateServerHistory'](_0x7cc878),_0x413057['filter'](_0x14e703=>{const _0x391ec0=this['_getAffectedRoot'](_0x14e703);return _0x391ec0&&!this['_knownRootNames']['has'](_0x391ec0);})['forEach']((_0xc4fe9b,_0x45c75e)=>{_0xc4fe9b['baseVersion']=this['_document']['version']+_0x45c75e,this['_saveOperationInBuffer'](_0xc4fe9b);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x5dcf86,_0x29cdac){const _0x53aa85=_0x29cdac&&_0x29cdac['message'];if(_0x53aa85&&_0x53aa85['startsWith']('realtimecollaborationclient'))throw _0x29cdac;const _0x52b28a=this['editor']['plugins']['get'](c);throw this['_isPendingUpdate']=!0x0,_0x52b28a['disconnect'](),this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0xde887b(_0x5dcf86,this['editor'],_0x53aa85?{'originalError':_0x53aa85}:void 0x0);}['_saveOperationInBuffer'](_0x512588){this['_knownOperations']['has'](_0x512588)||(this['_knownOperations']['add'](_0x512588),this['_bufferedOperations']['push'](_0x512588),this['_pendingAction']||'marker'==_0x512588['type']&&!_0x512588['affectsData']||this['_setPendingAction']());}['_sendBufferedOperationsDelayed'](_0x1f824d=!0x1){!_0x1f824d&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0x291ca9=>{_0x291ca9&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0x2354d8=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0x5a3088){return _0x5a3088['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x5a3088['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0x5a3088['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0x2354d8)||this['_crash'](_0x2354d8['message'],_0x2354d8);});},this['_currentBufferDelay']));}['_waitUntilSynced'](){return new Promise(_0x565e48=>{this['on']('change:_isPendingUpdate',()=>{_0x565e48();});});}async['_sendBufferedOperations'](){const _0x39291c=this['editor']['plugins']['get'](B);if(this['_shouldSendSelectionUpdate']()&&(_0x39291c['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x257530=[...this['_bufferedOperations']];for(const _0x3efaa6 of _0x257530)_0x3efaa6['wasUndone']=this['_document']['history']['isUndoneOperation'](_0x3efaa6);const _0x4d464f=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x257530),_0x278c99=F++,_0x3277df=this['_compressOperations'](_0x257530),_0x336e6d=await this['_service']['sendOperations'](_0x3277df,_0x3277df['baseVersion'],_0x4d464f);try{return await this['_handleServerResponse'](_0x257530,_0x336e6d,_0x278c99);}catch(_0x3069d5){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0x3069d5);}}async['_handleServerResponse'](_0x4a4d70,_0x377876,_0x27b8ab){if('error'in _0x377876)throw _0x377876['error'];let _0x5ae3a3=!0x1;if(_0x377876['wereChangesApplied']){_0x377876['lastOperationId']&&(this['_lastSyncedOperationId']=_0x377876['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0xe6f29f=>!_0x4a4d70['includes'](_0xe6f29f));for(const _0xe9d1d of _0x4a4d70)_0xe9d1d['createdAt']='lastOperationAcceptedAt'in _0x377876&&_0x377876['lastOperationAcceptedAt']||void 0x0;G(_0x4a4d70,_0x377876['version']-_0x4a4d70['length']),this['_updateServerHistory'](_0x4a4d70);const _0x2707b5=_0x4a4d70['filter'](_0x23d116=>{if(!_0x23d116['_isInit'])return!0x1;const _0x1e5578=this['_getAffectedRoot'](_0x23d116);return _0x1e5578&&!this['_knownRootNames']['has'](_0x1e5578);});G(_0x2707b5,this['_document']['version']),this['_applyOperationsSet'](_0x2707b5),_0x5ae3a3=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0x2ce888=this['_decompressOperations'](_0x377876['data'],_0x377876['metadata'])['filter'](_0x16a447=>_0x16a447['baseVersion']>=this['_lastServerVersion']);_0x2ce888['forEach'](_0x12fc8d=>this['_addKnownRoot'](_0x12fc8d)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x454148=>!_0x454148['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x454148))),this['_bufferedOperations']['length']&&G(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0x2ce888),_0x5ae3a3=this['_handleExternalOperations'](_0x2ce888,_0x377876['version'],_0x377876['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x5ae3a3?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}['_handleExternalOperations'](_0x12ba33,_0x1a159b,_0x34c5b9){try{const _0x54acdd={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x247f20,operationsB:_0x63577a,originalOperations:_0x116378}=_0x5935bf(_0x12ba33,this['_bufferedOperations'],_0x54acdd);G(_0x247f20,this['_document']['version']),G(_0x63577a,_0x1a159b);for(const _0x3f5f9b of _0x247f20){const _0x1b3a25=_0x116378['get'](_0x3f5f9b);_0x3f5f9b['_authorId']=_0x1b3a25?_0x1b3a25['_authorId']:null;}_0x34c5b9&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x12ba33,_0x34c5b9),this['_lastSyncedOperationId']=_0x34c5b9),this['_bufferedOperations']=[..._0x63577a],this['_applyOperationsSet'](_0x247f20),this['_updateServerHistory'](_0x12ba33);}catch(_0x550b3b){return console['error'](_0x550b3b),!0x1;}return!0x0;}['_applyOperationsSet'](_0x4c51f6,_0x19a659=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0x165edd=>{for(const _0x2c1d59 of _0x4c51f6)this['_knownOperations']['add'](_0x2c1d59),this['_addKnownRoot'](_0x2c1d59),_0x165edd['batch']['addOperation'](_0x2c1d59),this['editor']['model']['applyOperation'](_0x2c1d59);});}['_addKnownRoot'](_0x1334a6){const _0x518aa9=this['_getAffectedRoot'](_0x1334a6);_0x518aa9&&this['_knownRootNames']['add'](_0x518aa9);}['_getAffectedRoot'](_0x1ab343){let _0x1030c4,_0x344ff8;switch(_0x1ab343['type']){case'insert':_0x1030c4=_0x1ab343['position']['root'];break;case'marker':if(_0x344ff8=_0x1ab343['newRange'],!_0x344ff8)return null;_0x1030c4=_0x344ff8['root'];break;case'addRootAttribute':_0x1030c4=_0x1ab343['root'];break;case'addRoot':_0x1030c4=_0x1ab343['affectedSelectable'];break;case'move':_0x1030c4=_0x1ab343['targetPosition']['root'];break;default:return null;}return _0x1030c4['rootName'];}['_updateServerHistory'](_0xc4baa8){_0xc4baa8['forEach'](_0xccc9cc=>{const _0x46ef77=_0xccc9cc['clone']();_0x46ef77['_authorId']=_0xccc9cc['_authorId'],_0x46ef77['_isInit']=!!_0xccc9cc['_isInit'],_0x46ef77['createdAt']=_0xccc9cc['createdAt'],_0x46ef77['baseVersion']+=this['_offset'],_0xccc9cc['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x46ef77),this['serverHistory']['addOperation'](_0x46ef77);});}['_handleReconnectionError'](_0x18dfe9){const _0x3d2abb=this['editor']['plugins']['get']('Notification'),_0x53c5b0=this['editor']['locale'];_0x18dfe9||(_0x18dfe9=M(_0x53c5b0,'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.')),_0x3d2abb['showWarning'](_0x18dfe9,{'title':M(_0x53c5b0,'Synchronization\x20issue'),'namespace':'real-time-collaboration'}),this['_hasSynchronizationProblem']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_bufferedOperations']=[],this['editor']['plugins']['get'](c)['disconnect']();}['_setPendingAction'](){this['_pendingAction']||(this['_pendingAction']=this['editor']['plugins']['get'](_0x3b4f40)['add'](M(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}['_clearPendingAction'](){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x3b4f40)['remove'](this['_pendingAction']),this['_pendingAction']=null);}['_compressOperations'](_0x214d90){const _0x22a66b=_0x214d90['map'](_0x17528d=>_0x17528d['toJSON']());return this['_compressor']['compress'](_0x22a66b);}['_decompressOperations'](_0x3fa29a,_0x57e9da){return this['_compressor']['decompress'](_0x3fa29a)['map']((_0x4b262f,_0x4a7f02)=>{const _0x482c15='init'==_0x57e9da[_0x4a7f02]['type'];if('InsertOperation'==_0x4b262f['__className']){const _0x35ff1c=_0x4b262f['position']['root'];!this['_document']['getRoot'](_0x35ff1c)&&(this['_document']['createRoot']('$root',_0x35ff1c)['_isAttached']=!0x1);}const _0x44a551=_0xad7321['fromJSON'](_0x4b262f,this['_document']);return _0x44a551['wasUndone']=_0x4b262f['wasUndone'],_0x44a551['_isInit']=_0x482c15,_0x44a551['_authorId']=_0x482c15?null:_0x57e9da[_0x4a7f02]['userId'],_0x44a551['_isDisconnection']='cs:removeUser'===_0x57e9da[_0x4a7f02]['type'],_0x44a551['createdAt']=_0x57e9da[_0x4a7f02]['createdAt'],_0x44a551;});}['_refreshUserSelectionMarkers'](){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}['_shouldSendSelectionUpdate'](){const _0x3462a3=this['editor']['plugins']['get'](i)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0x3462a3&&_0x3462a3['length']>0x1&&this['_hasSelectionChanged'];}['_shouldSendUpdate'](){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}}class q extends Error{}function G(_0x4cde94,_0x4a4c9c){for(const _0xd051d0 of _0x4cde94)_0xd051d0['baseVersion']=_0x4a4c9c++;}class ${['_ignoredOperations'];['_operationToId'];constructor(_0x382e67){this['_ignoredOperations']=_0x382e67,this['_operationToId']=new WeakMap();}['getIdOfTheLastOperation'](_0x3a17e8){let _0x2f45cf=_0x3a17e8['length'];for(;_0x2f45cf--;){const _0x24da39=_0x3a17e8[_0x2f45cf];if(!this['_ignoredOperations']['has'](_0x24da39)){if(!this['_operationToId']['has'](_0x24da39)){const _0x35f31c=_0x2914c6()['slice'](0x1,0x12);this['_operationToId']['set'](_0x24da39,_0x35f31c);}return this['_operationToId']['get'](_0x24da39);}}}['setIdForTheLastOperation'](_0x19b709,_0x3ebf92){if(!_0x3ebf92)return;let _0x322098=_0x19b709['length'];for(;_0x322098--;){const _0x10761f=_0x19b709[_0x322098];this['_ignoredOperations']['has'](_0x10761f)||this['_operationToId']['set'](_0x10761f,_0x3ebf92);}}}class n extends _0x5d314d{static get['requires'](){return[l];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class a extends _0x13ca15{static ['CommentsService']=/* #__PURE__ -- @preserve */
|
|
26
|
+
((()=>et)());['_services'];static get['requires'](){return[c,'CommentsRepository',i,_0x230f7f];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x2c3b72){super(_0x2c3b72),this['_services']=new Map();}async['init'](){const _0x2fa049=this['context'],_0x3bda65=_0x2fa049['plugins']['get']('CommentsRepository');if(_0x2fa049['plugins']['get'](c)['addToReconnectionStack'](this),_0x3bda65['adapter']={'addCommentThread':async({channelId:_0x36ce0d,threadId:_0x2830aa,comments:_0x980eaf,resolvedAt:_0x390171,resolvedBy:_0x1fd674,context:_0x1a8e3d,attributes:_0x1a5ae9})=>{const _0x32e407=await this['_getService'](_0x36ce0d)['addCommentThread']({'commentThreadId':_0x2830aa,'comments':_0x980eaf['map'](_0x2f62b0=>function(_0x140c07,_0x79d117,_0xf83c58){return{'commentThreadId':_0xf83c58,'commentId':_0x140c07['commentId'],'userId':_0x140c07['authorId'],'content':_0x140c07['content'],'documentId':_0x79d117,'createdAt':_0x140c07['createdAt'],'attributes':_0x140c07['attributes']||{}};}(_0x2f62b0,_0x36ce0d,_0x2830aa)),'resolvedAt':_0x390171,'resolvedBy':_0x1fd674,'context':_0x1a8e3d,'attributes':_0x1a5ae9})['catch'](wt);return{'threadId':_0x32e407['commentThreadId'],'comments':_0x32e407['comments']};},'getCommentThread':async({channelId:_0x501087,threadId:_0x1a27f2})=>{const _0x3f9300=await this['_getService'](_0x501087)['getCommentThread'](_0x1a27f2)['catch'](wt);return _0x3f9300['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0x3f9300]),{'threadId':_0x3f9300['commentThreadId'],'comments':_0x3f9300['comments']['map'](st),'context':_0x3f9300['context'],'resolvedAt':_0x3f9300['resolvedAt'],'resolvedBy':_0x3f9300['resolvedBy'],'attributes':_0x3f9300['attributes']||{}});},'updateCommentThread':async({channelId:_0x11364e,threadId:_0x33f2fe,context:_0x4255a7,unlinkedAt:_0x5786e6,attributes:_0x4a1eff})=>this['_getService'](_0x11364e)['updateCommentThread']({'commentThreadId':_0x33f2fe,'context':_0x4255a7,'attributes':_0x4a1eff,'unlinkedAt':_0x5786e6})['catch'](ot)['catch'](wt),'resolveCommentThread':async({channelId:_0x4f48c7,threadId:_0x393ff9})=>{const _0x155a8c=await this['_getService'](_0x4f48c7)['resolveCommentThread'](_0x393ff9)['catch'](ot)['catch'](wt);return{'threadId':_0x155a8c['commentThreadId'],'resolvedAt':_0x155a8c['resolvedAt'],'resolvedBy':_0x155a8c['resolvedBy']};},'reopenCommentThread':async({channelId:_0x53b654,threadId:_0xae2257})=>this['_getService'](_0x53b654)['reopenCommentThread'](_0xae2257)['catch'](ot)['catch'](wt),'removeCommentThread':({channelId:_0x5cc6cc,threadId:_0x2fd602})=>this['_getService'](_0x5cc6cc)['removeCommentThread'](_0x2fd602)['catch'](ot)['catch'](wt),'addComment':({channelId:_0x2515da,threadId:_0x57c96f,commentId:_0x1ff83f,content:_0x27b021,attributes:_0x30ccc2})=>this['_getService'](_0x2515da)['addComment'](_0x57c96f,_0x1ff83f,_0x27b021,_0x30ccc2)['catch'](wt),'updateComment':({channelId:_0x498cfc,threadId:_0x2745de,commentId:_0x1bcfd3,content:_0x5e37da,attributes:_0x26a803})=>this['_getService'](_0x498cfc)['updateComment'](_0x2745de,_0x1bcfd3,_0x5e37da,_0x26a803)['catch'](ot)['catch'](wt),'removeComment':({channelId:_0x1a202d,threadId:_0x565e2b,commentId:_0x227132})=>this['_getService'](_0x1a202d)['removeComment'](_0x565e2b,_0x227132)['catch'](ot)['catch'](wt)},_0x2fa049 instanceof tt){const _0x29dbeb=_0x2fa049['config']['get']('collaboration.channelId'),_0x4eea73=_0x2fa049['plugins']['get'](i);await this['_setUpService'](_0x29dbeb);const _0x1e8fbd=await this['_services']['get'](_0x29dbeb)['getConnectedSessions']();this['listenTo'](_0x4eea73,'sessionAdd:'+_0x29dbeb,(_0x3b3184,{session:_0x443d53})=>{_0x443d53['id']===_0x4eea73['mySessionId']&&(_0x3b3184['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x443d53['permissions'],_0x29dbeb));}),_0x4eea73['register'](_0x29dbeb,_0x1e8fbd);}}async['_setUpService'](_0x43fc75){if(this['_services']['has'](_0x43fc75))throw new _0xde887b('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0x43fc75});const _0x2799e5=this['context']['plugins']['get']('CommentsRepository'),_0x417eac=new a['CommentsService'](_0x43fc75);this['_services']['set'](_0x43fc75,_0x417eac),this['listenTo'](_0x417eac,'commentThreadAdded',(_0x593673,_0x16d710)=>{const {commentThreadId:_0x1a8ea8,documentId:_0xa0b498,context:_0x50a57a,attributes:_0x455aba,resolvedAt:_0x3184b2,resolvedBy:_0x5cdbe0,comments:_0x51651e}=_0x16d710;_0x2799e5['getCommentThread'](_0x1a8ea8)||_0x2799e5['addCommentThread']({'threadId':_0x1a8ea8,'channelId':_0xa0b498,'comments':_0x51651e?_0x51651e['map'](st):[],'context':_0x50a57a,'attributes':_0x455aba,'resolvedAt':_0x3184b2,'resolvedBy':_0x5cdbe0,'isFromAdapter':!0x0});}),this['listenTo'](_0x417eac,'commentThreadUpdated',(_0xfa470f,{commentThreadId:_0xd7c63e,documentId:_0x32a07d,context:_0x1affe3,unlinkedAt:_0x28cdcb,attributes:_0x3b0dc7})=>{_0x2799e5['getCommentThread'](_0xd7c63e)&&_0x2799e5['updateCommentThread']({'threadId':_0xd7c63e,'channelId':_0x32a07d,'context':_0x1affe3,'unlinkedAt':_0x28cdcb,'attributes':_0x3b0dc7,'isFromAdapter':!0x0});}),this['listenTo'](_0x417eac,'commentThreadResolved',(_0x548343,{commentThreadId:_0x5ad61a,resolvedBy:_0x183d86,resolvedAt:_0x332864})=>{const _0x3c52a2=_0x2799e5['getCommentThread'](_0x5ad61a);_0x3c52a2&&_0x3c52a2['resolve']({'resolvedBy':_0x183d86,'resolvedAt':_0x332864,'isFromAdapter':!0x0});}),this['listenTo'](_0x417eac,'commentThreadReopened',(_0x2427b7,{commentThreadId:_0x41cd75})=>{const _0x9674fd=_0x2799e5['getCommentThread'](_0x41cd75);_0x9674fd&&_0x9674fd['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0x417eac,'commentThreadRemoved',(_0x36e50b,{commentThreadId:_0x3c406c})=>{const _0x2879b1=_0x2799e5['getCommentThread'](_0x3c406c);_0x2879b1&&_0x2879b1['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0x417eac,'commentAdded',(_0x341463,_0x5580a0)=>{const _0x4e8cb0=_0x5580a0['commentThreadId'],_0x141672=_0x2799e5['getCommentThread'](_0x4e8cb0);_0x141672&&_0x141672['addComment']({...st(_0x5580a0),'isFromAdapter':!0x0});}),this['listenTo'](_0x417eac,'commentUpdated',(_0x35f175,{commentThreadId:_0x297433,commentId:_0x4f4313,content:_0x302439,attributes:_0x418caa})=>{const _0x149f75=_0x2799e5['getCommentThread'](_0x297433);if(_0x149f75){const _0x17f43e=_0x149f75['getComment'](_0x4f4313);_0x17f43e&&_0x17f43e['update']({'content':_0x302439,'attributes':_0x418caa,'isFromAdapter':!0x0});}}),this['listenTo'](_0x417eac,'commentRemoved',(_0x41eb95,{commentThreadId:_0x2a734f,commentId:_0x21e067})=>{const _0x5b30e2=_0x2799e5['getCommentThread'](_0x2a734f);if(_0x5b30e2){const _0x47018c=_0x5b30e2['getComment'](_0x21e067);_0x47018c&&_0x47018c['remove']({'isFromAdapter':!0x0});}}),await this['_connectService'](_0x43fc75);}['destroy'](){if(this['context']instanceof tt){const _0x4a52a7=this['context']['config']['get']('collaboration.channelId');this['_terminateService'](_0x4a52a7);}}['_terminateService'](_0x24733b){if(!this['_services']['has'](_0x24733b))throw new _0xde887b('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0x24733b});this['_getService'](_0x24733b)['disconnect'](),this['_services']['delete'](_0x24733b);}async['reconnect'](){for(const _0xebd61a of this['_services']['keys']())await this['_connectService'](_0xebd61a);if(this['context']instanceof tt){const _0x2f3298=this['context']['config']['get']('collaboration.channelId'),_0xc4f4eb=this['context']['plugins']['get'](i);_0xc4f4eb['unregister'](_0x2f3298);const _0x46c55a=await this['_services']['get'](_0x2f3298)['getConnectedSessions']();_0xc4f4eb['register'](_0x2f3298,_0x46c55a);}}async['_connectService'](_0x2d8dee){const {connection:_0x6fac85}=this['context']['plugins']['get'](c),_0x10ed40=this['context']['plugins']['get']('CommentsRepository'),_0x442e6a=this['_services']['get'](_0x2d8dee),_0x1465bb=await _0x442e6a['connect'](_0x6fac85);await this['_fetchMissingUsersForThreads'](_0x1465bb);const _0x4f088e=new Set(Array['from'](_0x10ed40['getCommentThreads']({'channelId':_0x2d8dee}),_0x1c17b9=>_0x1c17b9['id']));for(const _0x8b0834 of _0x1465bb)_0x8b0834['deletedAt']||_0x4f088e['delete'](_0x8b0834['commentThreadId']);for(const _0x184a1a of _0x4f088e)_0x10ed40['getCommentThread'](_0x184a1a)['remove']({'isFromAdapter':!0x0});for(const _0x3660c7 of _0x1465bb){let _0x2e3ab9=_0x10ed40['getCommentThread'](_0x3660c7['commentThreadId']);const {commentThreadId:_0x2647ac,context:_0x45d57e,attributes:_0x50f8fa,resolvedBy:_0x5f2335,resolvedAt:_0x3de739,unlinkedAt:_0x5600a3,deletedAt:_0x284136}=_0x3660c7;if(_0x284136)continue;_0x2e3ab9||(_0x2e3ab9=_0x10ed40['addCommentThread']({'channelId':_0x2d8dee,'threadId':_0x2647ac,'context':_0x45d57e,'attributes':_0x50f8fa||{},'resolvedBy':_0x5f2335,'resolvedAt':_0x3de739,'unlinkedAt':_0x5600a3,'isFromAdapter':!0x0}));const _0x39a824=new Set(Array['from'](_0x2e3ab9['comments'],_0x5c9cee=>_0x5c9cee['id']));for(const _0x14ed68 of _0x3660c7['comments'])_0x39a824['delete'](_0x14ed68['commentId']);for(const _0x282b0e of _0x39a824)_0x2e3ab9['getComment'](_0x282b0e)['remove']({'isFromAdapter':!0x0});for(const _0x4fabcd of _0x3660c7['comments']){const _0x243d73=_0x2e3ab9['getComment'](_0x4fabcd['commentId']);_0x243d73?_0x243d73['content']!==_0x4fabcd['content']&&_0x243d73['update']({'content':_0x4fabcd['content'],'isFromAdapter':!0x0}):_0x2e3ab9['addComment'](Object['assign'](st(_0x4fabcd),{'isFromAdapter':!0x0}));}}}['_getService'](_0x2bf4fd){if(!this['_services']['has'](_0x2bf4fd))throw new _0xde887b('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0x2bf4fd});return this['_services']['get'](_0x2bf4fd);}async['_fetchMissingUsersForThreads'](_0x359661){const _0x234811=this['context']['plugins']['get'](_0x230f7f),{connection:_0x4a0fc5}=this['context']['plugins']['get'](c),_0x567b2c=new Set();for(const {resolvedBy:_0x145f06,comments:_0x454e5a}of _0x359661){_0x145f06&&!_0x234811['getUser'](_0x145f06)&&_0x567b2c['add'](_0x145f06);for(const {userId:_0x35c5e0}of _0x454e5a)_0x234811['getUser'](_0x35c5e0)||_0x567b2c['add'](_0x35c5e0);}if(0x0===_0x567b2c['size'])return;const _0x296604=await gt['getMany'](_0x4a0fc5,Array['from'](_0x567b2c));for(const _0xa26b6d of _0x296604)_0x234811['getUser'](_0xa26b6d['id'])||_0x234811['addUser'](_0xa26b6d);}}async function ot(_0x5d51e9){if('404'!==_0x5d51e9['code'])throw _0x5d51e9;}function wt(_0x46d21f){if((_0x2cb8a1=_0x46d21f)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0x2cb8a1['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x2cb8a1['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0x2cb8a1;throw _0x46d21f;}function st(_0xd68ca3){return{'threadId':_0xd68ca3['commentThreadId'],'commentId':_0xd68ca3['commentId'],'content':_0xd68ca3['content'],'createdAt':_0xd68ca3['createdAt'],'authorId':_0xd68ca3['userId'],'attributes':_0xd68ca3['attributes']||{}};}class f extends _0x5d314d{static ['TrackChangesService']=/* #__PURE__ -- @preserve */
|
|
27
|
+
((()=>at)());['_bufferedRequests'];['_trackChangesService'];static get['requires'](){return[a,'TrackChangesEditing',c];}static get['pluginName'](){return'CloudServicesTrackChangesAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x28976a){super(_0x28976a);const _0x4fb924=this['editor']['config']['get']('collaboration.channelId');this['_bufferedRequests']=new Map(),this['_trackChangesService']=new f['TrackChangesService'](_0x4fb924);}['init'](){const _0x4b7ebe=this['editor']['plugins']['get'](c),_0xfac605=this['editor']['plugins']['get']('TrackChangesEditing');return _0xfac605['adapter']={'getSuggestion':async _0x4c4a6c=>{await this['_waitForServiceReady']();const _0x4e4fed=await this['_trackChangesService']['get'](_0x4c4a6c)['catch'](nt);return await this['_fetchMissingUsersForThreads']([_0x4e4fed]),_0x4e4fed;},'addSuggestion':async({id:_0x1b770d,type:_0x15102a,data:_0x1401fc,originalSuggestionId:_0x4bdd20,attributes:_0x40819c})=>{await this['_waitForServiceReady']();const _0x296cb1={'id':_0x1b770d,'type':_0x15102a,'data':_0x1401fc,'originalSuggestionId':_0x4bdd20,'attributes':_0x40819c},_0x547a35=await this['_trackChangesService']['add'](_0x1b770d,_0x15102a,_0x1401fc,_0x4bdd20,_0x40819c)['catch'](_0x44f997=>{if(vt(_0x44f997))return new Promise(_0x236f16=>{this['_bufferedRequests']['set'](_0x1b770d,{'resolve':_0x236f16,'suggestionData':_0x296cb1});});throw _0x44f997;});return this['_bufferedRequests']['delete'](_0x1b770d),_0x547a35;},'updateSuggestion':async(_0x3fb51a,_0x450d18)=>{if(await this['_waitForServiceReady'](),'open'!==_0x450d18['state'])return this['_trackChangesService']['update'](_0x3fb51a,_0x450d18)['catch'](nt);}},this['listenTo'](this['_trackChangesService'],'suggestionUpdated',(_0x434720,_0xb94a51)=>{_0xfac605['hasSuggestion'](_0xb94a51['id'])&&(_0xfac605['getSuggestion'](_0xb94a51['id'])['attributes']=_0xb94a51['attributes']);}),this['_trackChangesService']['connect'](_0x4b7ebe['connection'])['then'](_0x18fcb=>(_0x4b7ebe['addToReconnectionStack'](this),this['_fetchMissingUsersForThreads'](_0x18fcb)['then'](()=>{for(const _0x13ca05 of _0x18fcb){_0xfac605['addSuggestionData'](_0x13ca05)['_saved']=!0x0;}})));}async['reconnect'](){const _0x3a29f2=this['editor']['plugins']['get']('TrackChangesEditing'),{connection:_0x192054}=this['editor']['plugins']['get'](c),_0x554d47=await this['_trackChangesService']['connect'](_0x192054);await this['_fetchMissingUsersForThreads'](_0x554d47);for(const {suggestionData:_0x277f1a,resolve:_0x378aa2}of this['_bufferedRequests']['values']()){let _0x1d1171=_0x554d47['find'](_0x411b0b=>_0x411b0b['id']===_0x277f1a['id']);_0x1d1171||(_0x1d1171=await this['_trackChangesService']['add'](_0x277f1a['id'],_0x277f1a['type'],_0x277f1a['data'],_0x277f1a['originalSuggestionId'])),_0x378aa2(_0x1d1171);}for(const _0x6c0867 of _0x554d47)_0x3a29f2['hasSuggestion'](_0x6c0867['id'])||_0x3a29f2['addSuggestionData'](_0x6c0867);}async['_waitForServiceReady'](){this['_trackChangesService']['isConnected']||await new Promise(_0x385039=>{this['listenTo'](this['_trackChangesService'],'connected',_0x33fc69=>{_0x33fc69['off'](),_0x385039();});});}async['_fetchMissingUsersForThreads'](_0x142d4a){const _0x4551af=this['editor']['plugins']['get'](_0x230f7f),{connection:_0x47128e}=this['editor']['plugins']['get'](c),_0x575a6b=new Set();for(const {authorId:_0x38e6fd}of _0x142d4a)_0x4551af['getUser'](_0x38e6fd)||_0x575a6b['add'](_0x38e6fd);if(0x0===_0x575a6b['size'])return;const _0x3a190c=await gt['getMany'](_0x47128e,Array['from'](_0x575a6b));for(const _0x47fda2 of _0x3a190c)_0x4551af['getUser'](_0x47fda2['id'])||_0x4551af['addUser'](_0x47fda2);}}function nt(_0x22271c){if(vt(_0x22271c))return new Promise(()=>{});throw _0x22271c;}function vt(_0x2065ab){return _0x2065ab['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x2065ab['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class m extends _0x5d314d{static get['requires'](){return['Comments',a,n,c];}static get['pluginName'](){return'RealTimeCollaborativeComments';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x3fef9b=this['editor']['plugins']['get'](c),_0x59775c=this['editor']['plugins']['get']('CommentsEditing'),_0x3bdee3=this['editor']['plugins']['get'](a);return this['editor']['data']['once']('ready',()=>{this['listenTo'](_0x3fef9b,'change:state',(_0x3602fa,_0xeea474,_0x2502f3)=>{_0x59775c['isThreadsLoadingPaused']='connected'!==_0x2502f3;});}),this['listenTo'](_0x3fef9b,'change:state',(_0x1ea7e1,_0x2df88c,_0x1f5914)=>{this['editor']['plugins']['get']('CommentsRepository')['switchReadOnly']('connected'!==_0x1f5914);}),_0x3bdee3['_setUpService'](this['editor']['config']['get']('collaboration.channelId'));}['destroy'](){this['editor']['plugins']['get'](a)['_terminateService'](this['editor']['config']['get']('collaboration.channelId')),super['destroy']();}}class p extends _0x5d314d{static get['requires'](){return[m,f,'TrackChanges'];}static get['pluginName'](){return'RealTimeCollaborativeTrackChanges';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class u extends _0x5d314d{static ['RevisionHistoryService']=/* #__PURE__ -- @preserve */
|
|
28
|
+
((()=>rt)());['_lastRequestId'];['_revisionTracker'];['_revisionHistoryService'];['_oldOffset'];static get['requires'](){return[c,l,'RevisionHistory',i,_0x230f7f];}static get['pluginName'](){return'CloudServicesRevisionHistoryAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x4c90b4){super(_0x4c90b4);const _0x5a55bf=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new u['RevisionHistoryService'](_0x5a55bf);}async['init'](){const _0x56b65e=this['editor']['plugins']['get'](l),_0x1cff9a=_0x56b65e['serverHistory'],_0x271021=this['editor']['plugins']['get'](c);this['_revisionTracker']['setSource']({'history':_0x1cff9a,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0x56b65e['sessionId']});const _0x13161e=this['editor']['config']['get']('cloudServices.bundleVersion')||ht,_0x4f950c=await it['isBundleUploaded'](_0x271021['connection'],_0x13161e);this['editor']['plugins']['get']('RevisionHistory')['adapter']={'getRevision':async({revisionId:_0xbe2bad})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0xbe2bad)),'updateRevisions':async _0x53e87e=>{await this['_waitForServiceReady']();const _0x48dfa2=this['_revisionTracker']['currentRevision'];if(_0x4f950c&&0x1===_0x53e87e['length']&&_0x53e87e[0x0]['id']===_0x48dfa2['id'])return _0x53e87e;for(const _0x388fa0 of _0x53e87e)_0x388fa0['id']===_0x48dfa2['id']&&(_0x388fa0['isEmptyCurrent']=_0x388fa0['fromVersion']===_0x388fa0['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0x53e87e,this['_lastRequestId'])['then'](_0x54a45d=>(this['_lastRequestId']=_0x54a45d,_0x53e87e))['catch'](_0xa213f1=>{if(ct(_0xa213f1)||'400'===_0xa213f1['code']&&void 0x0!==_0xa213f1['data']['wrongRequestId']){for(const _0x581bdc of _0x53e87e){!this['_revisionTracker']['repository']['getRevision'](_0x581bdc['id'])||this['_revisionTracker']['_bufferUpdate'](_0x581bdc['id'],_0x581bdc,!0x1);}if(ct(_0xa213f1))throw _0xa213f1;return _0x53e87e;}throw _0xa213f1;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0x2eaf4d,{revisionsData:_0xf03300,requestId:_0x53f6a1})=>{Math['max'](..._0xf03300['map'](_0x2dc430=>_0x2dc430['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0xf03300,_0x53f6a1);}):this['_handleRevisionsUpdate'](_0xf03300,_0x53f6a1);});const {revisions:_0x4e5cd2,requestId:_0x1d2949}=await this['_revisionHistoryService']['connect'](_0x271021['connection']);_0x271021['addToReconnectionStack'](this),this['_lastRequestId']=_0x1d2949,await this['_fetchMissingUsers'](_0x4e5cd2);for(const _0x26cdb4 of _0x4e5cd2)this['_revisionTracker']['addRevisionData'](_0x26cdb4);this['listenTo'](_0x56b65e,'change:_isConnected',(_0x35711c,_0x18f76a,_0x52c62a)=>{_0x52c62a&&(this['_oldOffset']=_0x56b65e['_offset'],_0x35711c['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](_0x271021,'state',_0x4756af=>_0x4756af===_0x56397d['CONNECTED']);}async['reconnect'](){const _0x53e052=this['editor']['plugins']['get'](c),_0xe3514f=this['editor']['plugins']['get'](l),_0x26d851=async()=>{const _0x46668e=this['_revisionTracker']['currentRevision'],_0x382725=_0x46668e['id'],_0x1fbceb=_0x382725!==_0xe3514f['sessionId'];if(_0x1fbceb){const _0x280c43=_0xe3514f['_offset']-this['_oldOffset'],_0x3daddd=this['_getLatestVersionFromServerOperations']();this['_revisionTracker']['_revisionDataBuilder']['reInit']();if(_0x46668e['toVersion']+_0x280c43!==_0x3daddd){const _0x26cfd6=_0x46668e['fromVersion']+_0x280c43,_0x28742a=this['editor']['plugins']['get'](_0x230f7f),_0x3bb751=this['_revisionTracker']['buildRevisionData']({'revision':_0x46668e,'from':_0x26cfd6,'to':_0x3daddd});_0x3bb751['id']=_0x46668e['id'];const _0x2b776f=_0x3bb751['authorsIds']['map'](_0x5c5999=>_0x28742a['getUser'](_0x5c5999));_0x46668e['_update']({..._0x3bb751,'authors':_0x2b776f},!0x0),this['_revisionTracker']['_bufferUpdate'](_0x46668e['id'],_0x3bb751,!0x0);}this['_revisionTracker']['_startingVersion']=_0x3daddd,(_0x46668e['toVersion']===_0x46668e['fromVersion']&&!this['_revisionTracker']['_bufferedUpdates']['has'](_0x382725)&&this['_revisionTracker']['repository']['_revisions']['remove'](_0x382725),this['_revisionTracker']['_createCurrentRevision'](_0x3daddd));}const {revisions:_0x1fa1a8,requestId:_0x58698c}=await this['_revisionHistoryService']['reconnect'](_0x53e052['connection'],this['_lastRequestId']);_0x1fbceb&&_0x1fa1a8['length']>0x0?_0xe3514f['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x1fa1a8),this['_handleRevisionsUpdate'](_0x1fa1a8,_0x58698c),this['_revisionTracker']['sendBufferedUpdates']());};return _0xe3514f['_isConnected']?_0x26d851():new Promise((_0x5ff9b5,_0x5f4442)=>{_0xe3514f['once']('change:_isConnected',()=>{_0x26d851()['then'](_0x5ff9b5)['catch'](_0x5f4442);});});}['destroy'](){super['destroy']();}async['_waitForServiceReady'](){this['_revisionHistoryService']['isConnected']||await new Promise(_0x7fcb5d=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x5896ee=>{_0x5896ee['off'](),_0x7fcb5d();});});}['_getLatestVersionFromServerOperations'](){const _0x24c95e=this['editor']['plugins']['get'](l)['serverHistory']['getOperations']()['reverse']();for(const _0x2b70d1 of _0x24c95e)if('marker'!==_0x2b70d1['type']||_0x2b70d1['affectsData'])return _0x2b70d1['baseVersion']+0x1;}['_getLatestVersion'](){const _0x38e566=this['editor']['plugins']['get'](l);return new Promise(_0x512a90=>{_0x38e566['_isPendingUpdate']?_0x38e566['once']('change:_isPendingUpdate',()=>{_0x512a90(this['_getLatestVersionFromServerOperations']());}):_0x512a90(this['_getLatestVersionFromServerOperations']());});}['_handleRevisionsUpdate'](_0x39d00d,_0x17a680){const _0x38c2f2=this['_revisionTracker']['repository'];this['_lastRequestId']=_0x17a680;for(const _0x3bd957 of _0x39d00d){const _0x173f5c=_0x38c2f2['getRevision'](_0x3bd957['id']);if(_0x173f5c){if((_0x3bd957['fromVersion']||_0x3bd957['toVersion'])&&(_0x3bd957['diffData']=null),_0x173f5c===this['_revisionTracker']['currentRevision']){const _0x5b8e2a=Math['max'](_0x173f5c['toVersion'],_0x3bd957['toVersion']),_0x429705=Math['max'](_0x173f5c['fromVersion'],_0x3bd957['fromVersion']);let _0x1ed403;_0x173f5c['toVersion']===_0x3bd957['toVersion']&&_0x173f5c['fromVersion']===_0x3bd957['fromVersion']?(_0x1ed403=!0x0,this['_preventResendingRevisionData'](_0x3bd957)):_0x3bd957['toVersion']===_0x5b8e2a&&_0x3bd957['fromVersion']===_0x429705?_0x1ed403=!0x1:(_0x173f5c['toVersion']===_0x5b8e2a&&_0x173f5c['fromVersion']===_0x429705||this['_fixRevision']({'revision':_0x173f5c,'from':_0x429705,'to':_0x5b8e2a}),_0x1ed403=!0x0),_0x1ed403&&(delete _0x3bd957['fromVersion'],delete _0x3bd957['toVersion'],delete _0x3bd957['diffData'],delete _0x3bd957['createdAt'],delete _0x3bd957['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0x3bd957),this['_preventResendingRevisionData'](_0x3bd957);}else this['_revisionTracker']['addRevisionData'](_0x3bd957);}const _0x136f6a=_0x38c2f2['getRevisions']();_0x136f6a['reverse']();for(let _0x5c2f18=0x0;_0x5c2f18<_0x136f6a['length']-0x1;_0x5c2f18++){const _0x47ba89=_0x136f6a[_0x5c2f18],_0x563bae=_0x136f6a[_0x5c2f18+0x1];if(_0x47ba89['fromVersion']<_0x563bae['toVersion']){const _0xef40a9=_0x563bae['toVersion'],_0x590a4b=Math['max'](_0xef40a9,_0x47ba89['toVersion']);this['_fixRevision']({'revision':_0x47ba89,'from':_0xef40a9,'to':_0x590a4b});}}}['_fixRevision']({revision:_0x5d0f54,from:_0xf3fb29,to:_0x4a9299}={}){const _0x1aff76=this['editor']['plugins']['get'](_0x230f7f),_0x5a8419=this['_revisionTracker']['buildRevisionData']({'revision':_0x5d0f54,'from':_0xf3fb29,'to':_0x4a9299});_0x5a8419['authors']=_0x5a8419['authorsIds']['map'](_0x3a6d69=>_0x1aff76['getUser'](_0x3a6d69)),_0x5d0f54['_update'](_0x5a8419);}['_preventResendingRevisionData'](_0x227196){const _0x264e47={};_0x264e47['id']=_0x227196['id'];for(const _0x337aef of Object['keys'](_0x227196))'id'!==_0x337aef&&(_0x264e47[_0x337aef]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0x264e47['id'],_0x264e47,!0x0);}async['_fetchMissingUsers'](_0x2bedae){const _0x492375=this['editor']['plugins']['get'](_0x230f7f),{connection:_0x5d0b92}=this['editor']['plugins']['get'](c),_0x2da4b4=new Set();for(const _0x540012 of _0x2bedae){for(const _0xd5424e of _0x540012['authorsIds'])_0x47b1b0(_0xd5424e);_0x540012['creatorId']&&_0x47b1b0(_0x540012['creatorId']);}if(0x0===_0x2da4b4['size'])return;const _0x1a9f3a=await gt['getMany'](_0x5d0b92,Array['from'](_0x2da4b4));for(const _0x5d07ff of _0x1a9f3a)_0x492375['getUser'](_0x5d07ff['id'])||_0x492375['addUser'](_0x5d07ff);function _0x47b1b0(_0x315183){_0x492375['getUser'](_0x315183)||_0x2da4b4['add'](_0x315183);}}}function ct(_0xa63b4c){return _0xa63b4c['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0xa63b4c['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0xa63b4c['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class g extends _0x5d314d{static get['requires'](){return['RevisionHistory',u,n];}static get['pluginName'](){return'RealTimeCollaborativeRevisionHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class A extends _0x313ca1{['_collapseAt'];constructor(_0x27bc0a,_0x48de5f=0x6){super(_0x27bc0a);const _0x4e7b67=this['bindTemplate'];this['set']('isHidden',!0x0),this['set']('usersCount',0x0),this['_collapseAt']=_0x48de5f,this['bind']('isHidden')['to'](this,'usersCount',_0x300a9b=>_0x300a9b<_0x48de5f),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item',_0x4e7b67['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':_0x4e7b67['to']('usersCount',_0x372323=>'+'+(_0x372323-this['_collapseAt']+0x2)['toString']())}]}]}]});}}class ts extends _0x313ca1{['items'];['keystrokes'];constructor(_0x4b66ee){super(_0x4b66ee);const _0x23124e=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0x280424(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0x23124e['if']('hasPopup'),'aria-expanded':_0x23124e['to']('isExpanded',_0x353a83=>this['hasPopup']&&String(_0x353a83)),'aria-label':_0x23124e['to']('hasPopup',_0x5335fe=>M(_0x4b66ee,_0x5335fe?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0x23124e['to']('hasPopup',_0x349119=>!!_0x349119&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items'],'on':{'mouseenter':_0x23124e['to'](()=>this['fire']('presencelist:show')),'mouseleave':_0x23124e['to'](_0x5aa9c9=>{const _0x263d5a=_0x5aa9c9,_0x388875=document['querySelector']('.ck-presence-list__dropdown-list'),_0x4a93ec=document['querySelector']('.ck-balloon-panel_with-arrow');_0x388875?.['contains'](_0x263d5a['relatedTarget'])||_0x4a93ec?.['contains'](_0x263d5a['relatedTarget'])||this['fire']('presencelist:hide');})}}),this['on']('change:hasPopup',(_0x20ccda,_0x40981c,_0x44494c)=>{this['element']&&(_0x44494c?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 j extends _0x313ca1{['counterView'];['inlineListView'];constructor(_0x5c55fd,_0x5b70b1=0x6){super(_0x5c55fd);const _0x2ce3e0=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new A(this['locale'],_0x5b70b1),this['inlineListView']=new ts(_0x5c55fd),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x37ecad of this['inlineListView']['items'])_0x37ecad['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',_0x2ce3e0['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['inlineListView']]});}}class x extends _0x313ca1{['listWrapperView'];constructor(_0x535a45,_0x45e661){super(_0x535a45);const _0xd084bd=this['bindTemplate'];this['listWrapperView']=new _t(_0x535a45,_0x45e661),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':M(_0x535a45,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']],'on':{'mouseleave':_0xd084bd['to'](_0x7fcb0d=>{const _0x389e7d=_0x7fcb0d,_0x2381ad=document['querySelector']('.ck-presence-list__list'),_0x624deb=document['querySelector']('.ck-balloon-panel_with-arrow');_0x2381ad?.['contains'](_0x389e7d['relatedTarget'])||_0x624deb?.['contains'](_0x389e7d['relatedTarget'])||this['fire']('presencelist:hide');})}});}}class _t extends _0x143568{constructor(_0x10bcd9,_0x48410e){super(_0x10bcd9);const _0x1c0c97=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0x48410e?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0x1c0c97['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0x1c0c97['to']('role'),'aria-label':_0x1c0c97['to']('ariaLabel'),'aria-labelledby':_0x1c0c97['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0x54a206['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0x5a5057=this['element'];_0x5a5057&&(this['_isScrollable']=Math['max'](_0x5a5057['scrollHeight'],_0x5a5057['clientHeight'])>0.8*window['innerHeight']);}}class k extends lt{['userView'];constructor(_0x30a5ff,_0x45e8d2,_0x476055){super(_0x30a5ff);const _0x2e488d=this['bindTemplate'];this['userView']=new ut(_0x30a5ff,_0x45e8d2);const _0x416ad0={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0x45e8d2['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0x45e8d2['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x45e8d2['color']['getBackgroundColorClass']()],'aria-hidden':'true'}}]};_0x476055&&(_0x416ad0['tag']='button',_0x416ad0['on']={'click':_0x2e488d['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x416ad0);}['focus'](){this['element']['focus']();}}class y extends _0x313ca1{['userView'];['markerView'];constructor(_0x15c0fc,_0x36f1eb,_0x280dc8){super(_0x15c0fc);const _0x1b9a7c=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new ut(_0x15c0fc,_0x36f1eb),this['markerView']=new dt(_0x15c0fc,_0x36f1eb);const _0x265cd5=new pt(_0x15c0fc);_0x265cd5['template']['tag']='span',_0x265cd5['text']=_0x36f1eb['name'];const _0x556dfb={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0x1b9a7c['to']('isFocusable',_0x2e47f0=>!!_0x2e47f0&&0x0),'aria-labelledby':_0x265cd5['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0x1b9a7c['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0x1b9a7c['to']('hasTooltip',_0x57c502=>!_0x57c502),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0x265cd5]};_0x280dc8&&(_0x556dfb['tag']='button',_0x556dfb['on']={'click':_0x1b9a7c['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x556dfb);}}class dt extends _0x313ca1{constructor(_0x25681a,_0x363b26){super(_0x25681a),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x363b26['color']['getBackgroundColorClass']()],'aria-hidden':'true'}});}}const C={'collapseAt':0x6,'displayMe':!0x0};class r extends _0x13ca15{['currentDisplayedUsers'];['balloonPanelView'];['view'];['presenceDropdownView'];['_bodyCollection']=null;static get['pluginName'](){return'PresenceListUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x2f0e46){super(_0x2f0e46),this['context']['config']['define']('presenceList',C);const _0x4a63e3=_0x2f0e46['config']['get']('presenceList.collapseAt');if('number'!=typeof _0x4a63e3)throw new _0xde887b('presencelist-collapseat-invalid-format',this);if(_0x4a63e3<0x1)throw new _0xde887b('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](i)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0x3e5bed(),this['balloonPanelView']=new _0x4e0a31(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get['requires'](){return[i];}['init'](){for(const _0x458e92 of this['_allConnectedUsers'])this['_handleUserAdd'](_0x458e92);this['listenTo'](this['_allConnectedUsers'],'add',(_0x16aa7a,_0x23b2ae)=>{this['_handleUserAdd'](_0x23b2ae);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0x58a09e,_0x5167ea)=>{this['_handleUserRemove'](_0x5167ea);});}['_createView'](){const _0x481284=this['context'],_0x12af2d=new j(this['context']['locale'],this['context']['config']['get']('presenceList.collapseAt')),_0x26a8c5=this['balloonPanelView'];if(!_0x36837c(_0x481284['config']['get']('presenceList.container')))throw new _0xde887b('presencelist-missing-container',this);return _0x12af2d['counterView']['bind']('usersCount')['to'](this),_0x12af2d['bind']('isCollapsed')['to'](this,'usersCount',_0x55727f=>{const {collapseAt:_0x49daa0}=_0x481284['config']['get']('presenceList'),_0x52d5b8=_0x55727f>=_0x49daa0;if(_0x52d5b8&&!_0x12af2d['inlineListView']['items']['find'](_0xebf3f4=>_0xebf3f4 instanceof A)){const _0x5db502=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['currentDisplayedUsers']['length']==_0x5db502&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](this['currentDisplayedUsers']['length']-0x1),_0x12af2d['inlineListView']['items']['add'](_0x12af2d['counterView']);}return _0x52d5b8||this['hideDropdown'](),_0x52d5b8;}),_0x12af2d['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0x2c230d=>{const _0x3cc6e2=_0x481284['config']['get']('presenceList'),_0x435020=new y(_0x481284['locale'],_0x2c230d,!!_0x3cc6e2['onClick']);return _0x435020['bind']('hasTooltip')['to'](_0x12af2d,'isCollapsed',_0x5eb009=>!_0x5eb009),_0x435020['bind']('isFocusable')['to'](_0x12af2d,'isCollapsed',_0x38dada=>!_0x38dada),_0x3cc6e2['onClick']&&this['listenTo'](_0x435020,'execute',()=>{this['view']['isCollapsed']||_0x3cc6e2['onClick'](_0x2c230d,_0x435020['element']);}),_0x435020;}),this['listenTo'](_0x12af2d['inlineListView'],'presencelist:show',()=>{this['view']['isCollapsed']&&this['showDropdown']();}),this['listenTo'](_0x12af2d['inlineListView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();}),_0x12af2d['inlineListView']['keystrokes']['set']('Enter',(_0xdbcd30,_0x2ca881)=>{this['view']['isCollapsed']&&(this['showDropdown'](),_0x2ca881());}),_0x12af2d['render'](),_0x26a8c5['render'](),_0xd64d71({'emitter':_0x12af2d,'activator':()=>_0x26a8c5['isVisible'],'contextElements':[_0x26a8c5['element'],_0x12af2d['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0x481284['config']['get']('presenceList.container')['appendChild'](_0x12af2d['element']),this['_bodyCollection']=new _0x174323(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_bodyCollection']['add'](this['balloonPanelView']),_0x12af2d;}['_handleUserAdd'](_0x3e73a2){if(!this['context']['config']['get']('presenceList.displayMe')&&_0x3e73a2['isMe'])return;const _0x419340=this['context']['config']['get']('presenceList.collapseAt')-0x1;for(this['usersCount']++;this['currentDisplayedUsers']['length']>=_0x419340-(this['view']['isCollapsed']?0x1:0x0)&&this['currentDisplayedUsers']['length']>0x1;)this['currentDisplayedUsers']['remove'](0x1);const _0x67723e=_0x3e73a2['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0x3e73a2,_0x67723e);}['_handleUserRemove'](_0x5c7921){this['usersCount']--;const {collapseAt:_0x13a58a}=this['context']['config']['get']('presenceList'),_0x2d8cb5=this['usersCount']>=_0x13a58a;if(this['currentDisplayedUsers']['get'](_0x5c7921['id']))this['currentDisplayedUsers']['remove'](_0x5c7921['id']);else{if(_0x2d8cb5&&this['currentDisplayedUsers']['length']+0x1===_0x13a58a-0x1)return;}if(this['currentDisplayedUsers']['length']+(_0x2d8cb5?0x1:0x0)<this['usersCount']){for(const _0x4f261c of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0x4f261c['id'])&&(this['currentDisplayedUsers']['add'](_0x4f261c,Math['min'](this['currentDisplayedUsers']['length']-(_0x2d8cb5?0x1:0x0),0x1)),this['currentDisplayedUsers']['length']+(_0x2d8cb5?0x1:0x0)===_0x13a58a-0x1))return;}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0x3285d6=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new x(this['context']['locale'],!!_0x3285d6['onClick']),this['view']['inlineListView']['isExpanded']=!0x0,this['listenTo'](this['presenceDropdownView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();});const {listWrapperView:_0x569f1a}=this['presenceDropdownView'];_0x569f1a['items']['bindTo'](this['_allConnectedUsers'])['using'](_0x4783e7=>{if(!_0x3285d6['displayMe']&&_0x4783e7['isMe'])return null;const _0xf0b859=new k(this['context']['locale'],_0x4783e7,!!_0x3285d6['onClick']);return _0x3285d6['onClick']&&this['listenTo'](_0xf0b859,'execute',()=>{_0x3285d6['onClick'](_0x4783e7,_0xf0b859['element']);}),_0xf0b859;}),this['balloonPanelView']['content']['add'](this['presenceDropdownView']),this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element']}),_0x569f1a['focus'](),_0x569f1a['checkIfScrollable']();const _0x3c5042=(_0x41c86e,_0x89d61e)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0x89d61e();};_0x569f1a['keystrokes']['set']('Esc',_0x3c5042),_0x569f1a['keystrokes']['set']('Shift+Tab',_0x3c5042),_0x569f1a['keystrokes']['set']('Tab',(_0x2d15cc,_0x3720c8)=>{!function(_0x39df14){const _0x34924f=['a','button','input','select','textarea','[tabindex]','[contenteditable]']['map'](_0x2575c6=>_0x2575c6+':not([disabled]):not([tabindex=\x22-1\x22])')['join'](','),_0x349c73=[...document['body']['querySelectorAll'](_0x34924f)]['filter'](_0x5251b2=>_0x5251b2===document['activeElement']||_0x5251b2['offsetWidth']+_0x5251b2['offsetHeight']>0x0)['sort']((_0x1ebdc1,_0x4e9cbf)=>(_0x1ebdc1['tabIndex']||0x0)-(_0x4e9cbf['tabIndex']||0x0)),_0x28d17c=_0x349c73['indexOf'](_0x39df14),_0x5f52d8=_0x349c73[(_0x28d17c+0x1)%_0x349c73['length']];_0x5f52d8&&_0x5f52d8['focus']();}(this['view']['element']),this['hideDropdown'](),_0x3720c8();}),_0x569f1a['focusTracker']['add'](this['view']['element']),_0x569f1a['focusTracker']['on']('change:isFocused',(_0x31a7b4,_0x45df78,_0x5f0f21)=>{_0x5f0f21||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 s extends _0x13ca15{static get['requires'](){return[i,r];}static get['pluginName'](){return'PresenceList';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}export{a as CloudServicesCommentsAdapter,u as CloudServicesRevisionHistoryAdapter,f as CloudServicesTrackChangesAdapter,s as PresenceList,r as PresenceListUI,l as RealTimeCollaborationClient,m as RealTimeCollaborativeComments,n as RealTimeCollaborativeEditing,g as RealTimeCollaborativeRevisionHistory,p as RealTimeCollaborativeTrackChanges,i as Sessions};
|