@ckeditor/ckeditor5-real-time-collaboration 45.1.0-alpha.0 → 45.1.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/real-time-collaboration.js +1 -1
- package/dist/index.js +6 -6
- package/package.json +14 -14
- package/src/presencelist/view/presencedropdownlistview.js +1 -1
- package/src/presencelist/view/presenceinlinelistview.js +1 -1
- package/src/realtimecollaborativeediting/realtimecollaborationclient.js +2 -2
- 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',_0x289780];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x37396d){super(_0x37396d),this['set']('state',_0x3dd82f['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=Object['create'](_0x645233);}['init'](){const _0x39c48c=this['context'],_0x3fa0cd=_0x39c48c['plugins']['get']('CloudServices'),_0x30032c=_0x39c48c['plugins']['get'](_0x289780);if(!_0x3fa0cd['token'])throw new _0x45c929('websocketgateway-missing-token',this);if(!_0x3fa0cd['webSocketUrl'])throw new _0x45c929('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'](_0x3fa0cd['token'],_0x3fa0cd['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0x4a9061=>{if(this['connection']=_0x4a9061,this['bind']('state')['to'](_0x4a9061,'state',this,'_isBrowserOffline',(_0x6637a8,_0x5bc975)=>('connected'!==_0x6637a8&&(this['_shouldPluginsReconnect']=!0x0),_0x5bc975||_0x6637a8!==_0x3dd82f['CONNECTED']?_0x3dd82f['DISCONNECTED']:this['state']==_0x3dd82f['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),_0x3dd82f['CONNECTING']):_0x3dd82f['CONNECTED'])),this['connection']['on']('error',(_0x40a092,_0x5f218e)=>{if('limitExceeded'!==_0x5f218e['code'])throw console['error'](_0x5f218e),new _0x45c929('cloudservices-init',null,{'originalError':_0x5f218e});_0x30032c['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'});}),!_0x4a9061['me'])return new Promise(_0x143333=>_0x4a9061['on']('change:me',_0x143333));})['catch'](_0x58fb56=>{throw console['error'](_0x58fb56),new _0x45c929('cloudservices-init',null,{'originalError':_0x58fb56});});}['addToReconnectionStack'](_0x1b5f98){if('function'!=typeof _0x1b5f98['reconnect'])throw new _0x45c929('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0x1b5f98))throw new _0x45c929('websocketgateway-plugin-already-registered',this,{'name':_0x1b5f98['constructor']['pluginName']});this['_reconnectionStack']['add'](_0x1b5f98);}['removeFromReconnectionStack'](_0x3fad1b){this['_reconnectionStack']['delete'](_0x3fad1b);}['isInReconnectionStack'](_0xbc0d2a){return this['_reconnectionStack']['has'](_0xbc0d2a);}['_reconnect'](){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0x51987f=>_0x51987f['reconnect']())))['then'](()=>this['state']=_0x3dd82f['CONNECTED'])['catch'](_0x193a0a=>{throw console['error'](_0x193a0a),new _0x45c929('cloudservices-reconnection-error',this['context']);});}['disconnect'](){this['connection']&&this['connection']['disconnect'](),this['state']=_0x3dd82f['DISCONNECTED'],this['_domEmitter']['stopListening']();}['destroy'](){this['disconnect'](),super['destroy']();}}class i extends _0x202947{['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,_0x4b074a];}constructor(_0x368b60){super(_0x368b60),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0xf9bc7a(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x4b074a);}['init'](){const _0x19e2cf=this['context']['plugins']['get'](c);this['listenTo'](_0x19e2cf,'change:state',(_0x5cb890,_0x4334b8,_0x36b761)=>{if('connected'!==_0x36b761)this['channelSessions']['forEach'](_0x1f56fd=>_0x1f56fd['clear']()),this['channelConnectedUsers']['forEach'](_0x53eb0e=>_0x53eb0e['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x4b6e5a,_0x297154]of this['_registeredSessions'])for(const _0x51f318 of _0x297154)this['_handleSessionAdd'](_0x4b6e5a,_0x51f318);}}),this['_createUser'](_0x19e2cf['connection']['me'],!0x0);}['register'](_0x121494,_0x1bd208){if(this['_registeredSessions']['has'](_0x121494))throw new _0x45c929('sessions-register-already-registered',null,{'channelId':_0x121494});this['_registeredSessions']['set'](_0x121494,_0x1bd208),this['channelSessions']['set'](_0x121494,new _0xf9bc7a()),this['channelConnectedUsers']['set'](_0x121494,new _0xf9bc7a()),this['listenTo'](_0x1bd208,'add',(_0x12dc2e,_0x3ffa34)=>this['_handleSessionAdd'](_0x121494,_0x3ffa34)),this['listenTo'](_0x1bd208,'remove',(_0x20685f,_0x1fae7c)=>this['_handleSessionRemove'](_0x121494,_0x1fae7c));for(const _0x3299c2 of _0x1bd208)this['_handleSessionAdd'](_0x121494,_0x3299c2);}['unregister'](_0x4d4937){if(!this['_registeredSessions']['has'](_0x4d4937))throw new _0x45c929('sessions-unregister-not-exist',null,{'channelId':_0x4d4937});const _0x1d3865=this['_registeredSessions']['get'](_0x4d4937);this['stopListening'](_0x1d3865);for(const _0x56d204 of _0x1d3865)'connected'===this['context']['plugins']['get'](c)['state']&&this['_handleSessionRemove'](_0x4d4937,_0x56d204);this['_registeredSessions']['delete'](_0x4d4937),this['channelSessions']['delete'](_0x4d4937),this['channelConnectedUsers']['delete'](_0x4d4937);}get['mySessionId'](){return this['context']['plugins']['get'](c)['connection']['sessionId'];}['getUserBySessionId'](_0x105190){for(const _0x5dd231 of this['channelSessions']['values']())for(const _0x3b1c49 of _0x5dd231)if(_0x3b1c49['id']===_0x105190)return _0x3b1c49['user'];}['getUserSessions'](_0x3da6df,_0x1e6187){const _0x1940af=_0x1e6187?[this['channelSessions']['get'](_0x1e6187)]:this['channelSessions']['values'](),_0x1333c5=new Set();for(const _0x3b199c of _0x1940af)for(const _0x5e0032 of _0x3b199c)_0x5e0032['user']['id']===_0x3da6df['id']&&_0x1333c5['add'](_0x5e0032['id']);return _0x1333c5;}['getUserRole'](_0x1ba628){for(const _0x3159d3 of this['channelSessions']['values']())for(const _0x2ed29f of _0x3159d3)if(_0x2ed29f['user']===_0x1ba628)return _0x2ed29f['role'];}['_handleSessionAdd'](_0x68e9ac,_0x272dca){if('connected'!==this['context']['plugins']['get'](c)['state'])return;const _0x1ee04a=_0x272dca['user'],_0x4d494b=this['_users']['getUser'](_0x1ee04a['id'])||this['_createUser'](_0x1ee04a),_0x16a035=Object['assign']({},_0x272dca,{'user':_0x4d494b});this['channelSessions']['get'](_0x68e9ac)['add'](_0x16a035);const _0x2d3b94=this['channelConnectedUsers']['get'](_0x68e9ac);_0x2d3b94['has'](_0x4d494b['id'])||_0x2d3b94['add'](_0x4d494b),this['allConnectedUsers']['has'](_0x4d494b['id'])||this['allConnectedUsers']['add'](_0x4d494b,_0x4d494b['isMe']?0x0:void 0x0),this['fire']('sessionAdd:'+_0x68e9ac,{'channelId':_0x68e9ac,'session':_0x16a035});}['_handleSessionRemove'](_0x2d7820,_0x2250e8){if('connected'!==this['context']['plugins']['get'](c)['state'])return;const _0x5dd81e=this['channelConnectedUsers']['get'](_0x2d7820),_0x309164=_0x2250e8['user'];_0x309164['id']&&(this['channelSessions']['get'](_0x2d7820)['remove'](_0x2250e8['id']),_0x5dd81e['has'](_0x309164['id'])&&!this['getUserSessions'](_0x309164,_0x2d7820)['size']&&_0x5dd81e['remove'](_0x309164['id']),this['allConnectedUsers']['get'](_0x309164['id'])&&!this['getUserSessions'](_0x309164)['size']&&this['allConnectedUsers']['remove'](_0x309164['id']));}['_createUser'](_0x1440e7,_0x311beb){const _0x50871a=this['_users']['addUser'](_0x1440e7);return _0x311beb&&this['_users']['defineMe'](_0x1440e7['id']),_0x50871a['orderNumber']=this['_uniqueUsersCount']++,_0x50871a;}}class J extends _0x1fc117{['_domEmitter']=new(_0x645233())();static get['requires'](){return[i];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x4f3cb9=this['editor'],_0x1782ea=_0x4f3cb9['plugins']['get'](i);_0x4f3cb9['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x19fec0,{writer:_0x446cc0})=>function(_0x2be255,_0x5db6a7,_0x572a67,_0x5207c9){const _0x52e86d=_0x2be255['markerName']['split'](':')[0x2],_0x442773=_0x572a67['getUserBySessionId'](_0x52e86d);if(!_0x442773||_0x52e86d===_0x572a67['mySessionId'])return;if(!_0x5207c9['model']['schema']['checkChild'](_0x2be255['markerRange']['start'],'$text'))return;const _0x472dfb={'class':'ck-user__marker\x20'+_0x442773['color']['getMarkerClass'](),'data-name':_0x442773['name'],'data-session-id':_0x52e86d},_0x316005=_0x5207c9['model']['markers']['get'](_0x2be255['markerName']),_0x277f01=_0x316005['getStart'](),_0x5ae34c=_0x277f01['nodeAfter'],_0x1d670a=_0x5207c9['model']['schema'];if(_0x5ae34c&&_0x1d670a['isObject'](_0x5ae34c)&&_0x1d670a['isInline'](_0x5ae34c)&&!_0x5207c9['model']['markers']['get']('user:range:'+_0x52e86d)['getRange']()['isCollapsed'])return;const _0x13c90d=_0x277f01['parent'];return _0x5207c9['model']['schema']['isLimit'](_0x13c90d)&&!_0x5207c9['model']['hasContent'](_0x13c90d)&&(_0x472dfb['contenteditable']=!0x1),function(_0x5d1939,_0x5eac6,_0x201249){const _0x2e1f1e=_0x5d1939['createUIElement']('span',_0x5eac6);return _0x5d1939['setCustomProperty']('userPositionMarker',!0x0,_0x2e1f1e),_0x2e1f1e['render']=function(_0x279cd7){const _0x447efd=this['toDomElement'](_0x279cd7),_0x434c0d=document['createElement']('span');return _0x434c0d['classList']['add']('ck-user__marker-tooltip'),_0x434c0d['setAttribute']('contenteditable','false'),_0x434c0d['setAttribute']('spellcheck','false'),_0x434c0d['textContent']=_0x201249['name'],_0x447efd['innerHTML']='<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span>'+_0x434c0d['outerHTML']+'',_0x447efd['addEventListener']('mouseenter',()=>{_0x447efd['classList']['add']('ck-user__marker_hovered');}),_0x447efd['addEventListener']('mouseleave',()=>{_0x447efd['classList']['remove']('ck-user__marker_hovered');}),_0x447efd;},_0x2e1f1e['isSimilar']=function(_0x125795){return!(!this['getCustomProperty']('userPositionMarker')||!_0x125795['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0x125795['getAttribute']('data-session-id'));},_0x2e1f1e;}(_0x5db6a7,_0x472dfb,_0x442773);}(_0x19fec0,_0x446cc0,_0x1782ea,_0x4f3cb9)}),_0x4f3cb9['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0x7e85b1=>function(_0x18e035,_0xee8208){const _0x2e5f3c=_0x18e035['markerName']['split'](':')[0x2];if(_0x2e5f3c===_0xee8208['mySessionId'])return null;const _0x164a09=_0xee8208['getUserBySessionId'](_0x2e5f3c);if(!_0x164a09)return{'id':_0x2e5f3c,'classes':[]};return{'id':_0x2e5f3c,'classes':['ck-user__selection',_0x164a09['color']['getSelectionClass']()],'attributes':{'data-session-id':_0x2e5f3c},'priority':0x7d0+_0x164a09['orderNumber']};}(_0x7e85b1,_0x1782ea)}),function(_0x2cf3dc){const _0x3f4acf=_0x2cf3dc['model'],_0x2cf1ad=new Map(),_0x577897=_0x2cf3dc['plugins']['get'](i);_0x3f4acf['markers']['on']('update:user:range',(_0x26f110,_0x44d823,_0x5345b7,_0x1412b9)=>{if(!_0x1412b9&&_0x2cf1ad['get'](_0x44d823['name']))return _0x2cf1ad['get'](_0x44d823['name'])['detach'](),void _0x2cf1ad['delete'](_0x44d823['name']);const _0x67ea9a=_0x44d823['name']['split'](':')[0x2];if(_0x67ea9a===_0x577897['mySessionId'])return;const _0x508ee4='user:position:'+_0x67ea9a;_0x3f4acf['markers']['has'](_0x508ee4)&&_0x2cf3dc['editing']['reconvertMarker'](_0x508ee4),_0x44d823['on']('change:range',(_0x29b023,_0x355fcb,_0x156172)=>{if('$graveyard'!=_0x355fcb['root']['rootName']&&'$graveyard'==_0x44d823['getRange']()['root']['rootName']&&!_0x2cf1ad['has'](_0x44d823['name'])){const _0x414fc7=_0x3f4acf['schema']['getNearestSelectionRange'](_0x156172['deletionPosition']);if(_0x414fc7){const _0x29c6be=ht['fromRange'](_0x414fc7);_0x2cf1ad['set'](_0x44d823['name'],_0x29c6be),_0x29c6be['on']('change:range',(_0x3ac33c,_0x140f98,_0x48ce79)=>{if('$graveyard'==_0x29c6be['root']['rootName']){const _0x19a0d3=_0x3f4acf['schema']['getNearestSelectionRange'](_0x48ce79['deletionPosition']);_0x19a0d3?(_0x29c6be['start']=_0x19a0d3['start'],_0x29c6be['end']=_0x19a0d3['end']):(_0x2cf1ad['delete'](_0x44d823['name']),_0x29c6be['detach']());}});}}});}),_0x3f4acf['document']['on']('change',()=>{_0x2cf1ad['size']>0x0&&_0x3f4acf['enqueueChange']({'isUndoable':!0x1},_0x3ed213=>{for(const [_0x230489,_0x1e8443]of _0x2cf1ad)'$graveyard'==_0x3f4acf['markers']['get'](_0x230489)['getRange']()['root']['rootName']&&(se(_0x230489['split'](':')[0x2],_0x1e8443['toRange'](),_0x3f4acf,_0x3ed213),_0x1e8443['detach']());_0x2cf1ad['clear']();});});}(_0x4f3cb9),this['_domEmitter']['listenTo'](_0x3719d6['document'],'keydown',(_0x56448f,{key:_0x2b173b})=>{'Escape'===_0x2b173b&&function(_0x247436){_0x247436['editing']['view']['change'](_0x4f98d3=>{for(const _0x18e142 of _0x247436['model']['markers']){if(!_0x18e142['name']['startsWith']('user:position'))continue;const _0x56737d=_0x247436['editing']['mapper']['markerNameToElements'](_0x18e142['name']);if(_0x56737d){for(const _0x5bc365 of _0x56737d)_0x4f98d3['removeClass']('ck-user__marker_hovered',_0x5bc365);}}});}(_0x4f3cb9);},{'useCapture':!0x0});}['afterInit'](){const _0x15d965=this['editor'],_0x4ebc89=_0x15d965['commands']['get']('undo');_0x4ebc89&&_0x15d965['model']['on']('applyOperation',(_0x3f7b4c,_0x3dab7e)=>{const _0x368ab3=_0x3dab7e[0x0];if(!_0x368ab3['isDocumentOperation'])return;if('marker'!=_0x368ab3['type']||!_0x368ab3['name']['startsWith']('user:'))return;const _0x5a0ca4=_0x368ab3['batch'];_0x4ebc89['_createdBatches']['has'](_0x5a0ca4)&&(_0x368ab3['newRange']=_0x368ab3['oldRange']?_0x15d965['model']['createRange'](_0x368ab3['oldRange']['start'],_0x368ab3['oldRange']['end']):null);},{'priority':'highest'});}['destroy'](){return this['_domEmitter']['stopListening'](),super['destroy']();}['createUserMarkerOperations'](){const _0x3bd886=this['editor'],_0x3db44d=_0x3bd886['model']['document'],_0xf02641=_0x3bd886['plugins']['get'](i);_0x3bd886['model']['enqueueChange']({'isUndoable':!0x1},_0x57d144=>{const _0x16e4c9='user:range:'+_0xf02641['mySessionId'],_0x13926e='user:position:'+_0xf02641['mySessionId'],_0xc12be6=_0x3bd886['model']['markers']['has'](_0x16e4c9);_0x3bd886['editing']['view']['hasDomSelection']?se(_0xf02641['mySessionId'],_0x3db44d['selection']['getFirstRange'](),_0x3bd886['model'],_0x57d144):_0xc12be6&&(_0x57d144['removeMarker'](_0x16e4c9),_0x57d144['removeMarker'](_0x13926e));});}}function se(_0x36c91c,_0x36fc1e,_0xff1e8c,_0x57e2d4){const _0x3dd8ff='user:range:'+_0x36c91c,_0x45ff65='user:position:'+_0x36c91c,_0x4559ba=_0x36fc1e['getContainedElement']();let _0x179ab6=_0x36fc1e['start'];_0x4559ba&&_0x4559ba['is']('element','tableCell')&&(_0x179ab6=function(_0x220855,_0x52ec56){for(const _0x57627a of _0x220855['getPositions']())if(_0x52ec56['schema']['checkChild'](_0x57627a,'$text'))return _0x57627a;}(_0x36fc1e,_0xff1e8c),_0x36fc1e=_0x57e2d4['createRange'](_0x179ab6));const _0x3d1789=_0x57e2d4['createRange'](_0x179ab6);_0xff1e8c['markers']['has'](_0x3dd8ff)?(_0x57e2d4['updateMarker'](_0x3dd8ff,{'range':_0x36fc1e}),_0x57e2d4['updateMarker'](_0x45ff65,{'range':_0x3d1789})):(_0x57e2d4['addMarker'](_0x3dd8ff,{'range':_0x36fc1e,'usingOperation':!0x0}),_0x57e2d4['addMarker'](_0x45ff65,{'range':_0x3d1789,'usingOperation':!0x0}));}function Q(_0x35bd28,_0x45d616,_0x6afbb4){const _0x1a3a16=_0x35bd28['t'],t=_0x35bd28['t'];switch(_0x45d616){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 _0x1a3a16({'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'},_0x6afbb4);default:return'';}}let Z=0x1;class l extends _0x1fc117{static ['CollaborativeEditingService']=/* #__PURE__ -- @preserve */
|
|
25
|
-
((()=>_0x172c5a)());['_offset'];['sessionId'];['serverHistory'];['_channelId'];['_service'];['_document'];['_compressor'];['_bufferedOperations'];['_knownOperations'];['_knownRootNames'];['_pendingAction'];['_hasSelectionChanged'];['_sendBufferedOperationsDelayId'];['_baseBufferDelay'];['_currentBufferDelay'];['_lastSyncedOperationId'];['_disconnectionOperations'];['_operationIdentifier'];static get['requires'](){return[c,i,J,_0x57fbff,_0x4b074a,_0x289780];}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 _0x3ebce2=this['serverHistory']['getOperations']();for(let _0x54d9f2=_0x3ebce2['length']-0x1;_0x54d9f2>=0x0;_0x54d9f2--){const _0x1b80aa=_0x3ebce2[_0x54d9f2];if(!this['_disconnectionOperations']['has'](_0x1b80aa))return _0x1b80aa['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0x58a7ed){if(super(_0x58a7ed),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x325ec2(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0x45c929('collaboration-missing-channelid',this);const _0x2425e6=_0x58a7ed['config']['get']('cloudServices.bundleVersion')||nt;this['_service']=new l['CollaborativeEditingService'](_0x2425e6,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0x41994e(),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 st(this['_disconnectionOperations']);}['init'](){const _0x2bdd02=this['editor'],_0x56911a=_0x2bdd02['plugins']['get'](_0x4b074a),_0x556e38=_0x2bdd02['plugins']['get'](c);this['listenTo'](_0x56911a,'getOperationAuthor',(_0x196cc1,_0x4ed388)=>{const _0x2af906=_0x4ed388[0x0];_0x2af906['_authorId']&&(_0x196cc1['return']=_0x56911a['getUser'](_0x2af906['_authorId']),_0x196cc1['stop']()),null===_0x2af906['_authorId']&&(_0x196cc1['return']=null,_0x196cc1['stop']());},{'priority':'high'}),this['listenTo'](_0x2bdd02['model']['document']['selection'],'change:range',(_0x470b1c,_0x34efa4)=>{_0x34efa4['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x2bdd02['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x2bdd02['model']['on']('applyOperation',(_0x5ab06b,_0x107cf5)=>{const _0x256c09=_0x107cf5[0x0];_0x256c09['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0x256c09),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['bind']('_isEditingAllowed')['to'](_0x556e38,'state',this,'_hasSynchronizationProblem',(_0x1052e8,_0x5f17ee)=>'connected'===_0x1052e8&&!_0x5f17ee),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x2bdd02['disableReadOnlyMode']('rtc-offline'):_0x2bdd02['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x2bdd02['disableReadOnlyMode']('rtc-offline'):_0x2bdd02['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async['reconnect'](){const _0x3ada57=this['editor']['plugins']['get'](i),_0x40428c=this['editor']['plugins']['get'](c);try{this['_isPendingUpdate']=!0x0,_0x3ada57['unregister'](this['_channelId']);const _0x5dc2a0=await this['_service']['reconnect'](_0x40428c['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0x5dc2a0)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x59d8c3=await this['_service']['getConnectedSessions']();_0x3ada57['register'](this['_channelId'],_0x59d8c3),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x3b29cd){if(function(_0x146ea9){return'404'===_0x146ea9['code'];}(_0x3b29cd)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0x1bc5cd){return'409'===_0x1bc5cd['code'];}(_0x3b29cd)){const _0x2bf4b8=Q(this['editor']['locale'],'The\x20document\x20cannot\x20be\x20connected\x20back\x20to\x20the\x20server.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.');this['_handleReconnectionError'](_0x2bf4b8);}else{if(!(_0x3b29cd instanceof tt))throw _0x3b29cd;this['_handleReconnectionError']();}}}}['destroy'](){const _0x9287a4=this['editor']['plugins']['get'](c),_0x2777bb=this['editor']['plugins']['get'](i);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x2777bb['channelSessions']['has'](this['_channelId'])&&_0x2777bb['unregister'](this['_channelId']),_0x9287a4['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async['_handleReconnectionResponse'](_0x39baa6){if(this['sessionId']!==_0x39baa6['sessionId']&&this['_lastSyncedOperationId']!==_0x39baa6['lastOperationId'])throw new tt();return this['sessionId']=_0x39baa6['sessionId'],this['_handleServerResponse']([],{..._0x39baa6,'wereChangesApplied':!0x1,'data':_0x39baa6['data']},'reconnect');}async['_connectService'](_0xa82601,_0x221d4f=!0x1){const {connection:_0x914dde}=this['editor']['plugins']['get'](c);l['CollaborativeEditingService']['getConnectedSessions'](_0x914dde,this['_channelId'])['then'](_0x3aeddf=>this['_initSessionsHandling'](_0x3aeddf))['catch'](_0x40ff3a=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x40ff3a);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x2353cd,_0x4d6047)=>{this['_crash']('realtimecollaborationclient-init-service-internal-error',_0x4d6047);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_isConnected']=!0x1;});const _0x286c2c=this['_operationIdentifier']['getIdOfTheLastOperation'](_0xa82601);this['_isPendingUpdate']=!0x0;const _0x3b4bc5=await this['_service']['connect'](_0x914dde,this['_compressOperations'](_0xa82601),_0x286c2c);if(this['sessionId']=_0x3b4bc5['sessionId'],_0x221d4f){if(!_0x3b4bc5['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x3b4bc5['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0xa82601,_0x3b4bc5,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x3b4bc5,_0xa82601);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}['_handleSendingSelectionMarkers'](){const _0x167655=this['editor']['plugins']['get'](i),_0x4e07d1=this['editor']['plugins']['get'](J),_0x3f3d80=_0x167655['channelSessions']['get'](this['_channelId']);_0x3f3d80&&_0x3f3d80['length']>0x1?_0x4e07d1['createUserMarkerOperations']():this['listenTo'](_0x167655,'sessionAdd:'+this['_channelId'],()=>{0x2===_0x167655['channelSessions']['get'](this['_channelId'])['length']&&_0x4e07d1['createUserMarkerOperations']();});}async['_handleReceivedOperations'](_0x4781e3,_0x573326,_0x5641c4,_0x5178bf){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x573326){const _0x2cb5eb=this['_decompressOperations'](_0x5641c4,_0x5178bf);await this['_fetchMissingUsers'](_0x2cb5eb),this['_handleExternalOperations'](_0x2cb5eb,_0x573326,_0x5641c4['lastOperationId'])||this['_crash']('realtimecollaborationclient-init-service-incorrect-server-operation');}}async['_connectAfterSessionHasBeenFlushed'](){this['_disconnectService']();const {locale:_0x4ae10e}=this['editor'];let _0x3fc896;try{_0x3fc896=await this['_service']['getDocumentDetails']();}catch(_0x11540c){const _0x4458cf=Q(_0x4ae10e,'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'](_0x4458cf);}const _0x1e6039=_0x3fc896['currentDocumentSession']||_0x3fc896['lastDocumentSession'];if(this['_lastSyncedOperationId']===_0x1e6039['lastOperationId'])await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);else{const _0x2cffb4=Q(_0x4ae10e,'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'](_0x2cffb4);}}['_disconnectService'](){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['stopListening'](this['_service']);}['_initSessionsHandling'](_0x3a6110){const _0x19bcef=this['editor']['plugins']['get'](i);this['listenTo'](_0x19bcef,'sessionAdd:'+this['_channelId'],(_0x2f1f31,{session:_0x2bf53c})=>{if(_0x2bf53c['id']===_0x19bcef['mySessionId']){_0x2f1f31['off']();const _0x5195e0=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0x58f464=_0x2bf53c['permissions'];_0x5195e0&&_0x5195e0['isEnabled']&&(_0x58f464=_0x58f464['filter'](_0x263d2c=>'document:write'!==_0x263d2c)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0x58f464,this['_channelId']);}}),_0x19bcef['register'](this['_channelId'],_0x3a6110);}['_initThrowingOnDataSet'](){const _0x439660=this['editor']['data']['set'];this['editor']['data']['set']=(..._0x18c6e0)=>{if(!_0x18c6e0[_0x18c6e0['length']-0x1]['suppressErrorInCollaboration'])throw new _0x45c929('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x439660['apply'](this['editor']['data'],_0x18c6e0);};}['_setUpDataInit'](){this['editor']['data']['on']('init',(_0x512293,[_0x457267])=>{if(this['_document']['version'])throw new _0x45c929('realtimecollaborationclient-init-document-already-initialized',this);_0x512293['stop'](),this['_setPendingAction']();const _0x22ea8b=this['editor']['config']['get']('rootsAttributes'),_0x4ebe2e=this['_getOperationsFromInitData'](_0x457267,_0x22ea8b);0x0==_0x4ebe2e['length']&&_0x4ebe2e['push'](new _0x289434(0x0)),_0x512293['return']=this['_connectService'](_0x4ebe2e)['then'](()=>{this['editor']['plugins']['get'](c)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x109d10=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x109d10))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x4f99cd,[_0x22822a,_0x1e210c])=>{_0x4f99cd['stop']();const _0xe43e70=this['editor']['model']['document']['getRoot'](_0x22822a);if(!this['_knownRootNames']['has'](_0x22822a)){const _0x3793e8=_0x1e210c&&_0x1e210c['data']?_0x1e210c['data']:'',_0x4eb976=_0x1e210c&&_0x1e210c['attributes']?_0x1e210c['attributes']:{};await this['_loadRoot'](_0x22822a,_0x3793e8,_0x4eb976);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0xe43e70['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0xe43e70);});},{'priority':'high'});}async['_fetchMissingUsers'](_0x4579db){const _0x525253=this['editor']['plugins']['get'](_0x4b074a),{connection:_0xbd8c76}=this['editor']['plugins']['get'](c),_0x3ec76=new Set();for(const _0x62c629 of _0x4579db){const _0x34a0c9=_0x62c629['_authorId'];_0x34a0c9&&!_0x525253['getUser'](_0x34a0c9)&&_0x3ec76['add'](_0x34a0c9);}if(0x0===_0x3ec76['size'])return;const _0x195527=await dt['getMany'](_0xbd8c76,Array['from'](_0x3ec76));for(const _0x11c76f of _0x195527)_0x525253['getUser'](_0x11c76f['id'])||_0x525253['addUser'](_0x11c76f);}['_getOperationsFromInitData'](_0x5d1094,_0x585b9c={}){const _0x3e4ccd=this['editor']['model'],_0x29f949=[];let _0x322bc6=0x0;const _0x10cf08='string'==typeof _0x5d1094?{'main':_0x5d1094}:_0x5d1094;for(const _0x174c02 of Object['keys'](_0x10cf08)){if(!this['_document']['roots']['has'](_0x174c02))throw new _0x45c929('realtimecollaborationclient-init-non-existent-root',this);const _0x9aac06=this['editor']['data']['parse'](_0x10cf08[_0x174c02]),_0x525b45=this['_document']['getRoot'](_0x174c02),_0x23df1e=new _0x4d3319(_0x3e4ccd['createPositionAt'](_0x525b45,0x0),_0x9aac06,_0x322bc6++);_0x29f949['push'](_0x23df1e);for(const [_0x42ee1f,_0x1f5ed5]of _0x9aac06['markers']){const _0x2a7b02=_0x3e4ccd['createRange'](_0x3e4ccd['createPositionFromPath'](_0x525b45,_0x1f5ed5['start']['path']['slice']()),_0x3e4ccd['createPositionFromPath'](_0x525b45,_0x1f5ed5['end']['path']['slice']())),_0x5d61c9=new _0x3d79f9(_0x42ee1f,null,_0x2a7b02,_0x3e4ccd['markers'],!0x0,_0x322bc6++);_0x29f949['push'](_0x5d61c9);}}if(_0x585b9c)for(const [_0x5a7e63,_0x4a3547]of Object['entries'](_0x585b9c)){const _0x473626=_0x3e4ccd['document']['getRoot'](_0x5a7e63);if(!_0x473626)throw new _0x45c929('multi-root-editor-root-attributes-no-root',null);for(const [_0x24f251,_0x1bdaf3]of Object['entries'](_0x4a3547))if(null!==_0x1bdaf3){const _0x3b8786=new _0xe8bf34(_0x473626,_0x24f251,null,_0x1bdaf3,_0x322bc6++);_0x29f949['push'](_0x3b8786);}}return _0x29f949;}async['_loadRoot'](_0x37c208,_0x496776,_0x3b7645){this['_getOperationsFromInitData']({[_0x37c208]:_0x496776},{[_0x37c208]:_0x3b7645})['forEach']((_0x2d9bc0,_0x4bb100)=>{_0x2d9bc0['baseVersion']=this['_document']['version']+_0x4bb100,_0x2d9bc0['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x2d9bc0);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async['_handleInitialConnectionData'](_0x511ba4,_0x3af16e){let _0x332a33;this['_offset']=_0x511ba4['offset'];const _0x2e3e67=_0x511ba4['wereChangesApplied']&&!_0x511ba4['initData'],_0x274db6=_0x2e3e67?0x0:_0x511ba4['data']['baseVersion'];if(_0x3af16e['forEach'](_0x2ecc06=>{_0x2ecc06['_isInit']=!0x0,_0x2ecc06['createdAt']=_0x511ba4['sessionCreatedAt'],_0x2ecc06['_authorId']=null;}),_0x2e3e67)_0x332a33=_0x3af16e,this['_applyOperationsSet'](_0x332a33,_0x2e3e67);else{if(_0x511ba4['initData']){const _0x347afe=this['_getOperationsFromInitData'](_0x511ba4['initData']);this['_document']['history']['version']=-_0x347afe['length'],_0x347afe['forEach'](_0x332ce2=>{_0x332ce2['baseVersion']-=_0x347afe['length'],_0x332ce2['createdAt']=_0x511ba4['sessionCreatedAt'],_0x332ce2['_isInit']=!0x0,_0x332ce2['_authorId']=null;}),this['_applyOperationsSet'](_0x347afe,!0x0),this['serverHistory']['version']=-_0x347afe['length']+this['_offset'],this['_updateServerHistory'](_0x347afe);}this['_document']['history']['version']=_0x274db6,_0x332a33=this['_decompressOperations'](_0x511ba4['data'],_0x511ba4['metadata']),await this['_fetchMissingUsers'](_0x332a33),this['_applyOperationsSet'](_0x332a33,_0x2e3e67);}_0x511ba4['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x332a33,_0x511ba4['lastOperationId']),this['_lastSyncedOperationId']=_0x511ba4['lastOperationId']),this['serverHistory']['version']=_0x274db6+this['_offset'],this['_updateServerHistory'](_0x332a33),_0x3af16e['filter'](_0x20f519=>{const _0x52663c=this['_getAffectedRoot'](_0x20f519);return _0x52663c&&!this['_knownRootNames']['has'](_0x52663c);})['forEach']((_0x56e40f,_0x212c25)=>{_0x56e40f['baseVersion']=this['_document']['version']+_0x212c25,this['_saveOperationInBuffer'](_0x56e40f);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x2f42d1,_0x488a55){const _0x5488ab=_0x488a55&&_0x488a55['message'];if(_0x5488ab&&_0x5488ab['startsWith']('realtimecollaborationclient'))throw _0x488a55;const _0x569cc4=this['editor']['plugins']['get'](c);throw this['_isPendingUpdate']=!0x0,_0x569cc4['disconnect'](),this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0x45c929(_0x2f42d1,this['editor'],_0x5488ab?{'originalError':_0x5488ab}:void 0x0);}['_saveOperationInBuffer'](_0x4abdef){this['_knownOperations']['has'](_0x4abdef)||(this['_knownOperations']['add'](_0x4abdef),this['_bufferedOperations']['push'](_0x4abdef),this['_pendingAction']||'marker'==_0x4abdef['type']&&!_0x4abdef['affectsData']||this['_setPendingAction']());}['_sendBufferedOperationsDelayed'](_0x779e8c=!0x1){!_0x779e8c&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0x19cd0e=>{_0x19cd0e&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0x9afbd0=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0x11530a){return _0x11530a['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x11530a['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0x11530a['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0x9afbd0)||this['_crash'](_0x9afbd0['message'],_0x9afbd0);});},this['_currentBufferDelay']));}['_waitUntilSynced'](){return new Promise(_0x544f92=>{this['on']('change:_isPendingUpdate',()=>{_0x544f92();});});}async['_sendBufferedOperations'](){const _0x4f9624=this['editor']['plugins']['get'](J);if(this['_shouldSendSelectionUpdate']()&&(_0x4f9624['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x45eeb0=[...this['_bufferedOperations']];for(const _0x2e23ef of _0x45eeb0)_0x2e23ef['wasUndone']=this['_document']['history']['isUndoneOperation'](_0x2e23ef);const _0x1e0ffd=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x45eeb0),_0x45fab5=Z++,_0x2bbab6=this['_compressOperations'](_0x45eeb0),_0x1463e4=await this['_service']['sendOperations'](_0x2bbab6,_0x2bbab6['baseVersion'],_0x1e0ffd);try{return await this['_handleServerResponse'](_0x45eeb0,_0x1463e4,_0x45fab5);}catch(_0x3f23e0){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0x3f23e0);}}async['_handleServerResponse'](_0x3564ed,_0x4c23c2,_0x3980a1){if('error'in _0x4c23c2)throw _0x4c23c2['error'];let _0x270798=!0x1;if(_0x4c23c2['wereChangesApplied']){_0x4c23c2['lastOperationId']&&(this['_lastSyncedOperationId']=_0x4c23c2['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x2e74a6=>!_0x3564ed['includes'](_0x2e74a6));for(const _0x122a6d of _0x3564ed)_0x122a6d['createdAt']='lastOperationAcceptedAt'in _0x4c23c2&&_0x4c23c2['lastOperationAcceptedAt']||void 0x0;it(_0x3564ed,_0x4c23c2['version']-_0x3564ed['length']),this['_updateServerHistory'](_0x3564ed);const _0xc7dbc2=_0x3564ed['filter'](_0x250cdf=>{if(!_0x250cdf['_isInit'])return!0x1;const _0x2ddd9f=this['_getAffectedRoot'](_0x250cdf);return _0x2ddd9f&&!this['_knownRootNames']['has'](_0x2ddd9f);});it(_0xc7dbc2,this['_document']['version']),this['_applyOperationsSet'](_0xc7dbc2),_0x270798=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0x2e3481=this['_decompressOperations'](_0x4c23c2['data'],_0x4c23c2['metadata'])['filter'](_0x26f3f6=>_0x26f3f6['baseVersion']>=this['_lastServerVersion']);_0x2e3481['forEach'](_0x58f3c2=>this['_addKnownRoot'](_0x58f3c2)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x59257c=>!_0x59257c['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x59257c))),this['_bufferedOperations']['length']&&it(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0x2e3481),_0x270798=this['_handleExternalOperations'](_0x2e3481,_0x4c23c2['version'],_0x4c23c2['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x270798?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}['_handleExternalOperations'](_0x180d9d,_0x2f1937,_0x4b65b7){try{const _0x299844={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x302891,operationsB:_0x6da0d2,originalOperations:_0x369b36}=_0x2b26c9(_0x180d9d,this['_bufferedOperations'],_0x299844);it(_0x302891,this['_document']['version']),it(_0x6da0d2,_0x2f1937);for(const _0x39c5c7 of _0x302891){const _0x55665d=_0x369b36['get'](_0x39c5c7);_0x39c5c7['_authorId']=_0x55665d?_0x55665d['_authorId']:null;}_0x4b65b7&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x180d9d,_0x4b65b7),this['_lastSyncedOperationId']=_0x4b65b7),this['_bufferedOperations']=[..._0x6da0d2],this['_applyOperationsSet'](_0x302891),this['_updateServerHistory'](_0x180d9d);}catch(_0x3a0b97){return console['error'](_0x3a0b97),!0x1;}return!0x0;}['_applyOperationsSet'](_0x348d32,_0x5706db=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0x4ce459=>{for(const _0x6d47ba of _0x348d32)this['_knownOperations']['add'](_0x6d47ba),this['_addKnownRoot'](_0x6d47ba),_0x4ce459['batch']['addOperation'](_0x6d47ba),this['editor']['model']['applyOperation'](_0x6d47ba);});}['_addKnownRoot'](_0x2fd768){const _0x2081d1=this['_getAffectedRoot'](_0x2fd768);_0x2081d1&&this['_knownRootNames']['add'](_0x2081d1);}['_getAffectedRoot'](_0x59b9e1){let _0xe7cabf,_0x2f9489;switch(_0x59b9e1['type']){case'insert':_0xe7cabf=_0x59b9e1['position']['root'];break;case'marker':if(_0x2f9489=_0x59b9e1['newRange'],!_0x2f9489)return null;_0xe7cabf=_0x2f9489['root'];break;case'addRootAttribute':_0xe7cabf=_0x59b9e1['root'];break;case'addRoot':_0xe7cabf=_0x59b9e1['affectedSelectable'];break;case'move':_0xe7cabf=_0x59b9e1['targetPosition']['root'];break;default:return null;}return _0xe7cabf['rootName'];}['_updateServerHistory'](_0x2e3b46){_0x2e3b46['forEach'](_0x41c8ee=>{const _0x42aed5=_0x41c8ee['clone']();_0x42aed5['_authorId']=_0x41c8ee['_authorId'],_0x42aed5['_isInit']=!!_0x41c8ee['_isInit'],_0x42aed5['createdAt']=_0x41c8ee['createdAt'],_0x42aed5['baseVersion']+=this['_offset'],_0x41c8ee['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x42aed5),this['serverHistory']['addOperation'](_0x42aed5);});}['_handleReconnectionError'](_0x2b799c){const _0x47781c=this['editor']['plugins']['get']('Notification'),_0x3dddd9=this['editor']['locale'];_0x2b799c||(_0x2b799c=Q(_0x3dddd9,'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.')),_0x47781c['showWarning'](_0x2b799c,{'title':Q(_0x3dddd9,'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'](_0x57fbff)['add'](Q(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}['_clearPendingAction'](){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x57fbff)['remove'](this['_pendingAction']),this['_pendingAction']=null);}['_compressOperations'](_0x367268){const _0x2701af=_0x367268['map'](_0x2ea4da=>_0x2ea4da['toJSON']());return this['_compressor']['compress'](_0x2701af);}['_decompressOperations'](_0x5b7513,_0x6b75a4){return this['_compressor']['decompress'](_0x5b7513)['map']((_0xd10731,_0x2a3ed3)=>{const _0x44a989='init'==_0x6b75a4[_0x2a3ed3]['type'];if('InsertOperation'==_0xd10731['__className']){const _0x427a6c=_0xd10731['position']['root'];!this['_document']['getRoot'](_0x427a6c)&&(this['_document']['createRoot']('$root',_0x427a6c)['_isAttached']=!0x1);}const _0x4681ac=_0x58db61['fromJSON'](_0xd10731,this['_document']);return _0x4681ac['wasUndone']=_0xd10731['wasUndone'],_0x4681ac['_isInit']=_0x44a989,_0x4681ac['_authorId']=_0x44a989?null:_0x6b75a4[_0x2a3ed3]['userId'],_0x4681ac['_isDisconnection']='cs:removeUser'===_0x6b75a4[_0x2a3ed3]['type'],_0x4681ac['createdAt']=_0x6b75a4[_0x2a3ed3]['createdAt'],_0x4681ac;});}['_refreshUserSelectionMarkers'](){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}['_shouldSendSelectionUpdate'](){const _0xd7763=this['editor']['plugins']['get'](i)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0xd7763&&_0xd7763['length']>0x1&&this['_hasSelectionChanged'];}['_shouldSendUpdate'](){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}}class tt extends Error{}function it(_0x2268a7,_0x2b8084){for(const _0x20cf92 of _0x2268a7)_0x20cf92['baseVersion']=_0x2b8084++;}class st{['_ignoredOperations'];['_operationToId'];constructor(_0x14a518){this['_ignoredOperations']=_0x14a518,this['_operationToId']=new WeakMap();}['getIdOfTheLastOperation'](_0x3326b8){let _0x201139=_0x3326b8['length'];for(;_0x201139--;){const _0x59876a=_0x3326b8[_0x201139];if(!this['_ignoredOperations']['has'](_0x59876a)){if(!this['_operationToId']['has'](_0x59876a)){const _0x41216e=_0x2c2334()['slice'](0x1,0x12);this['_operationToId']['set'](_0x59876a,_0x41216e);}return this['_operationToId']['get'](_0x59876a);}}}['setIdForTheLastOperation'](_0x2d5859,_0x3277a1){if(!_0x3277a1)return;let _0x3ce742=_0x2d5859['length'];for(;_0x3ce742--;){const _0x48a272=_0x2d5859[_0x3ce742];this['_ignoredOperations']['has'](_0x48a272)||this['_operationToId']['set'](_0x48a272,_0x3277a1);}}}class n extends _0x1fc117{static get['requires'](){return[l];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class a extends _0x202947{static ['CommentsService']=/* #__PURE__ -- @preserve */
|
|
26
|
-
((()=>_0x262c38)());['_services'];static get['requires'](){return[c,'CommentsRepository',i,_0x4b074a];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x304f95){super(_0x304f95),this['_services']=new Map();}async['init'](){const _0x511d96=this['context'],_0x52a0b9=_0x511d96['plugins']['get']('CommentsRepository');if(_0x511d96['plugins']['get'](c)['addToReconnectionStack'](this),_0x52a0b9['adapter']={'addCommentThread':async({channelId:_0x32ed2f,threadId:_0x1ea87b,comments:_0x50491a,resolvedAt:_0x5ba930,resolvedBy:_0x6a6cb3,context:_0x591ed9,attributes:_0x188e8b})=>{const _0x252cd3=await this['_getService'](_0x32ed2f)['addCommentThread']({'commentThreadId':_0x1ea87b,'comments':_0x50491a['map'](_0x157f8e=>function(_0x292dc7,_0xa3f623,_0x50d4d4){return{'commentThreadId':_0x50d4d4,'commentId':_0x292dc7['commentId'],'userId':_0x292dc7['authorId'],'content':_0x292dc7['content'],'documentId':_0xa3f623,'createdAt':_0x292dc7['createdAt'],'attributes':_0x292dc7['attributes']||{}};}(_0x157f8e,_0x32ed2f,_0x1ea87b)),'resolvedAt':_0x5ba930,'resolvedBy':_0x6a6cb3,'context':_0x591ed9,'attributes':_0x188e8b})['catch'](ut);return{'threadId':_0x252cd3['commentThreadId'],'comments':_0x252cd3['comments']};},'getCommentThread':async({channelId:_0x3af149,threadId:_0x291007})=>{const _0x232119=await this['_getService'](_0x3af149)['getCommentThread'](_0x291007)['catch'](ut);return _0x232119['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0x232119]),{'threadId':_0x232119['commentThreadId'],'comments':_0x232119['comments']['map'](_),'context':_0x232119['context'],'resolvedAt':_0x232119['resolvedAt'],'resolvedBy':_0x232119['resolvedBy'],'attributes':_0x232119['attributes']||{}});},'updateCommentThread':async({channelId:_0x4eaf30,threadId:_0x1a9bce,context:_0x503508,unlinkedAt:_0x50b274,attributes:_0x3830e1})=>this['_getService'](_0x4eaf30)['updateCommentThread']({'commentThreadId':_0x1a9bce,'context':_0x503508,'attributes':_0x3830e1,'unlinkedAt':_0x50b274})['catch'](S)['catch'](ut),'resolveCommentThread':async({channelId:_0xf6ee9a,threadId:_0x1061bc})=>{const _0x1bd43b=await this['_getService'](_0xf6ee9a)['resolveCommentThread'](_0x1061bc)['catch'](S)['catch'](ut);return{'threadId':_0x1bd43b['commentThreadId'],'resolvedAt':_0x1bd43b['resolvedAt'],'resolvedBy':_0x1bd43b['resolvedBy']};},'reopenCommentThread':async({channelId:_0x177bea,threadId:_0x41367e})=>this['_getService'](_0x177bea)['reopenCommentThread'](_0x41367e)['catch'](S)['catch'](ut),'removeCommentThread':({channelId:_0x5e14a4,threadId:_0x3d9bfb})=>this['_getService'](_0x5e14a4)['removeCommentThread'](_0x3d9bfb)['catch'](S)['catch'](ut),'addComment':({channelId:_0x28af6c,threadId:_0x1acb3c,commentId:_0xf4e561,content:_0x46e162,attributes:_0x262ad6})=>this['_getService'](_0x28af6c)['addComment'](_0x1acb3c,_0xf4e561,_0x46e162,_0x262ad6)['catch'](ut),'updateComment':({channelId:_0x4ec9ed,threadId:_0x12b016,commentId:_0x4ac176,content:_0x1c1fb7,attributes:_0x42a5df})=>this['_getService'](_0x4ec9ed)['updateComment'](_0x12b016,_0x4ac176,_0x1c1fb7,_0x42a5df)['catch'](S)['catch'](ut),'removeComment':({channelId:_0x23aa63,threadId:_0x43ee88,commentId:_0x574422})=>this['_getService'](_0x23aa63)['removeComment'](_0x43ee88,_0x574422)['catch'](S)['catch'](ut)},_0x511d96 instanceof _0x2b28d5){const _0x294195=_0x511d96['config']['get']('collaboration.channelId'),_0x174009=_0x511d96['plugins']['get'](i);await this['_setUpService'](_0x294195);const _0x606179=await this['_services']['get'](_0x294195)['getConnectedSessions']();this['listenTo'](_0x174009,'sessionAdd:'+_0x294195,(_0x39b6d2,{session:_0x302713})=>{_0x302713['id']===_0x174009['mySessionId']&&(_0x39b6d2['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x302713['permissions'],_0x294195));}),_0x174009['register'](_0x294195,_0x606179);}}async['_setUpService'](_0x2057cc){if(this['_services']['has'](_0x2057cc))throw new _0x45c929('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0x2057cc});const _0x4b441a=this['context']['plugins']['get']('CommentsRepository'),_0x5d7022=new a['CommentsService'](_0x2057cc);this['_services']['set'](_0x2057cc,_0x5d7022),this['listenTo'](_0x5d7022,'commentThreadAdded',(_0x5c338e,_0x548b45)=>{const {commentThreadId:_0x1a8d68,documentId:_0x9d1408,context:_0x3094ee,attributes:_0x4dea9e,resolvedAt:_0x23f0ce,resolvedBy:_0x3d16db,comments:_0x137cfc}=_0x548b45;_0x4b441a['getCommentThread'](_0x1a8d68)||_0x4b441a['addCommentThread']({'threadId':_0x1a8d68,'channelId':_0x9d1408,'comments':_0x137cfc?_0x137cfc['map'](_):[],'context':_0x3094ee,'attributes':_0x4dea9e,'resolvedAt':_0x23f0ce,'resolvedBy':_0x3d16db,'isFromAdapter':!0x0});}),this['listenTo'](_0x5d7022,'commentThreadUpdated',(_0x5c6875,{commentThreadId:_0x5c135a,documentId:_0x588170,context:_0x262e2b,unlinkedAt:_0x495bbc,attributes:_0x54279f})=>{_0x4b441a['getCommentThread'](_0x5c135a)&&_0x4b441a['updateCommentThread']({'threadId':_0x5c135a,'channelId':_0x588170,'context':_0x262e2b,'unlinkedAt':_0x495bbc,'attributes':_0x54279f,'isFromAdapter':!0x0});}),this['listenTo'](_0x5d7022,'commentThreadResolved',(_0x47dfb0,{commentThreadId:_0x2323d7,resolvedBy:_0x48d682,resolvedAt:_0xa32f1e})=>{const _0xe38245=_0x4b441a['getCommentThread'](_0x2323d7);_0xe38245&&_0xe38245['resolve']({'resolvedBy':_0x48d682,'resolvedAt':_0xa32f1e,'isFromAdapter':!0x0});}),this['listenTo'](_0x5d7022,'commentThreadReopened',(_0x2356d,{commentThreadId:_0xae7953})=>{const _0x128106=_0x4b441a['getCommentThread'](_0xae7953);_0x128106&&_0x128106['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0x5d7022,'commentThreadRemoved',(_0x395553,{commentThreadId:_0x53eb5e})=>{const _0x1831ed=_0x4b441a['getCommentThread'](_0x53eb5e);_0x1831ed&&_0x1831ed['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0x5d7022,'commentAdded',(_0x479e49,_0x5eb655)=>{const _0x118c9d=_0x5eb655['commentThreadId'],_0x18967f=_0x4b441a['getCommentThread'](_0x118c9d);_0x18967f&&_0x18967f['addComment']({..._(_0x5eb655),'isFromAdapter':!0x0});}),this['listenTo'](_0x5d7022,'commentUpdated',(_0x2b0d7f,{commentThreadId:_0x5c3fe8,commentId:_0x2490ec,content:_0x22fd95,attributes:_0x407560})=>{const _0x197250=_0x4b441a['getCommentThread'](_0x5c3fe8);if(_0x197250){const _0x398305=_0x197250['getComment'](_0x2490ec);_0x398305&&_0x398305['update']({'content':_0x22fd95,'attributes':_0x407560,'isFromAdapter':!0x0});}}),this['listenTo'](_0x5d7022,'commentRemoved',(_0x4e1a8f,{commentThreadId:_0x46660d,commentId:_0x5a89a3})=>{const _0x91f91a=_0x4b441a['getCommentThread'](_0x46660d);if(_0x91f91a){const _0x1e1d12=_0x91f91a['getComment'](_0x5a89a3);_0x1e1d12&&_0x1e1d12['remove']({'isFromAdapter':!0x0});}}),await this['_connectService'](_0x2057cc);}['destroy'](){if(this['context']instanceof _0x2b28d5){const _0xf43072=this['context']['config']['get']('collaboration.channelId');this['_terminateService'](_0xf43072);}}['_terminateService'](_0x1f7a6e){if(!this['_services']['has'](_0x1f7a6e))throw new _0x45c929('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0x1f7a6e});this['_getService'](_0x1f7a6e)['disconnect'](),this['_services']['delete'](_0x1f7a6e);}async['reconnect'](){for(const _0x2b5bae of this['_services']['keys']())await this['_connectService'](_0x2b5bae);if(this['context']instanceof _0x2b28d5){const _0x224e38=this['context']['config']['get']('collaboration.channelId'),_0x2b57e8=this['context']['plugins']['get'](i);_0x2b57e8['unregister'](_0x224e38);const _0x388cb6=await this['_services']['get'](_0x224e38)['getConnectedSessions']();_0x2b57e8['register'](_0x224e38,_0x388cb6);}}async['_connectService'](_0x1e694d){const {connection:_0x9c8b75}=this['context']['plugins']['get'](c),_0x2412a6=this['context']['plugins']['get']('CommentsRepository'),_0x1c9c68=this['_services']['get'](_0x1e694d),_0x3a9339=await _0x1c9c68['connect'](_0x9c8b75);await this['_fetchMissingUsersForThreads'](_0x3a9339);const _0x3edd0f=new Set(Array['from'](_0x2412a6['getCommentThreads']({'channelId':_0x1e694d}),_0xbdde55=>_0xbdde55['id']));for(const _0x1cfa3b of _0x3a9339)_0x1cfa3b['deletedAt']||_0x3edd0f['delete'](_0x1cfa3b['commentThreadId']);for(const _0xd01d4c of _0x3edd0f)_0x2412a6['getCommentThread'](_0xd01d4c)['remove']({'isFromAdapter':!0x0});for(const _0x284bb9 of _0x3a9339){let _0x374902=_0x2412a6['getCommentThread'](_0x284bb9['commentThreadId']);const {commentThreadId:_0x360999,context:_0x4c2c13,attributes:_0xbd7e64,resolvedBy:_0xc3fdeb,resolvedAt:_0xa8516a,unlinkedAt:_0x457b9c,deletedAt:_0x200b71}=_0x284bb9;if(_0x200b71)continue;_0x374902||(_0x374902=_0x2412a6['addCommentThread']({'channelId':_0x1e694d,'threadId':_0x360999,'context':_0x4c2c13,'attributes':_0xbd7e64||{},'resolvedBy':_0xc3fdeb,'resolvedAt':_0xa8516a,'unlinkedAt':_0x457b9c,'isFromAdapter':!0x0}));const _0x516dea=new Set(Array['from'](_0x374902['comments'],_0x24b8e2=>_0x24b8e2['id']));for(const _0x58c1a9 of _0x284bb9['comments'])_0x516dea['delete'](_0x58c1a9['commentId']);for(const _0x4076a6 of _0x516dea)_0x374902['getComment'](_0x4076a6)['remove']({'isFromAdapter':!0x0});for(const _0x46534d of _0x284bb9['comments']){const _0x9c6dd8=_0x374902['getComment'](_0x46534d['commentId']);_0x9c6dd8?_0x9c6dd8['content']!==_0x46534d['content']&&_0x9c6dd8['update']({'content':_0x46534d['content'],'isFromAdapter':!0x0}):_0x374902['addComment'](Object['assign'](_(_0x46534d),{'isFromAdapter':!0x0}));}}}['_getService'](_0x46b195){if(!this['_services']['has'](_0x46b195))throw new _0x45c929('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0x46b195});return this['_services']['get'](_0x46b195);}async['_fetchMissingUsersForThreads'](_0x59750c){const _0x130df8=this['context']['plugins']['get'](_0x4b074a),{connection:_0x47552f}=this['context']['plugins']['get'](c),_0x5acaba=new Set();for(const {resolvedBy:_0x89e406,comments:_0x51f5e3}of _0x59750c){_0x89e406&&!_0x130df8['getUser'](_0x89e406)&&_0x5acaba['add'](_0x89e406);for(const {userId:_0x403dc8}of _0x51f5e3)_0x130df8['getUser'](_0x403dc8)||_0x5acaba['add'](_0x403dc8);}if(0x0===_0x5acaba['size'])return;const _0x19b01f=await dt['getMany'](_0x47552f,Array['from'](_0x5acaba));for(const _0x349422 of _0x19b01f)_0x130df8['getUser'](_0x349422['id'])||_0x130df8['addUser'](_0x349422);}}async function S(_0x176e3f){if('404'!==_0x176e3f['code'])throw _0x176e3f;}function ut(_0x46182a){if((_0x38882a=_0x46182a)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0x38882a['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x38882a['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0x38882a;throw _0x46182a;}function _(_0x51ad79){return{'threadId':_0x51ad79['commentThreadId'],'commentId':_0x51ad79['commentId'],'content':_0x51ad79['content'],'createdAt':_0x51ad79['createdAt'],'authorId':_0x51ad79['userId'],'attributes':_0x51ad79['attributes']||{}};}class f extends _0x1fc117{static ['TrackChangesService']=/* #__PURE__ -- @preserve */
|
|
27
|
-
((()=>et)());['_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(
|
|
28
|
-
((()=>_0x2d9169)());['_lastRequestId'];['_revisionTracker'];['_revisionHistoryService'];['_oldOffset'];static get['requires'](){return[c,l,'RevisionHistory',i,_0x4b074a];}static get['pluginName'](){return'CloudServicesRevisionHistoryAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x186e02){super(_0x186e02);const _0x3adce7=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new u['RevisionHistoryService'](_0x3adce7);}async['init'](){const _0x29f50b=this['editor']['plugins']['get'](l),_0x38e729=_0x29f50b['serverHistory'],_0x6dcac7=this['editor']['plugins']['get'](c);this['_revisionTracker']['setSource']({'history':_0x38e729,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0x29f50b['sessionId']});const _0x1ee525=this['editor']['config']['get']('cloudServices.bundleVersion')||nt,_0x5552ce=await _0x1e5930['isBundleUploaded'](_0x6dcac7['connection'],_0x1ee525);this['editor']['plugins']['get']('RevisionHistory')['adapter']={'getRevision':async({revisionId:_0x13efff})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0x13efff)),'updateRevisions':async _0x47a0c0=>{await this['_waitForServiceReady']();const _0x21d35d=this['_revisionTracker']['currentRevision'];if(_0x5552ce&&0x1===_0x47a0c0['length']&&_0x47a0c0[0x0]['id']===_0x21d35d['id'])return _0x47a0c0;for(const _0xd1ab6f of _0x47a0c0)_0xd1ab6f['id']===_0x21d35d['id']&&(_0xd1ab6f['isEmptyCurrent']=_0xd1ab6f['fromVersion']===_0xd1ab6f['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0x47a0c0,this['_lastRequestId'])['then'](_0x1113ad=>(this['_lastRequestId']=_0x1113ad,_0x47a0c0))['catch'](_0x5cfec6=>{if(U(_0x5cfec6)||'400'===_0x5cfec6['code']&&void 0x0!==_0x5cfec6['data']['wrongRequestId']){for(const _0x51c078 of _0x47a0c0){!this['_revisionTracker']['repository']['getRevision'](_0x51c078['id'])||this['_revisionTracker']['_bufferUpdate'](_0x51c078['id'],_0x51c078,!0x1);}if(U(_0x5cfec6))throw _0x5cfec6;return _0x47a0c0;}throw _0x5cfec6;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0x1f2db4,{revisionsData:_0x788e71,requestId:_0x1a4240})=>{Math['max'](..._0x788e71['map'](_0x44f6cc=>_0x44f6cc['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0x788e71,_0x1a4240);}):this['_handleRevisionsUpdate'](_0x788e71,_0x1a4240);});const {revisions:_0x56367b,requestId:_0xcc5fd9}=await this['_revisionHistoryService']['connect'](_0x6dcac7['connection']);_0x6dcac7['addToReconnectionStack'](this),this['_lastRequestId']=_0xcc5fd9,await this['_fetchMissingUsers'](_0x56367b);for(const _0x1627cc of _0x56367b)this['_revisionTracker']['addRevisionData'](_0x1627cc);this['listenTo'](_0x29f50b,'change:_isConnected',(_0x213563,_0x4ac6b4,_0x3081fd)=>{_0x3081fd&&(this['_oldOffset']=_0x29f50b['_offset'],_0x213563['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](_0x6dcac7,'state',_0x4053f4=>_0x4053f4===_0x3dd82f['CONNECTED']);}async['reconnect'](){const _0x4b8c15=this['editor']['plugins']['get'](c),_0x426aa9=this['editor']['plugins']['get'](l),_0x12fda2=async()=>{const _0x979f35=this['_revisionTracker']['currentRevision'],_0x5600e2=_0x979f35['id'],_0x10b28e=_0x5600e2!==_0x426aa9['sessionId'];if(_0x10b28e){const _0xbf4d70=_0x426aa9['_offset']-this['_oldOffset'],_0x553346=this['_getLatestVersionFromServerOperations']();this['_revisionTracker']['_revisionDataBuilder']['reInit']();if(_0x979f35['toVersion']+_0xbf4d70!==_0x553346){const _0x15e488=_0x979f35['fromVersion']+_0xbf4d70,_0x520f4e=this['editor']['plugins']['get'](_0x4b074a),_0x23d3bd=this['_revisionTracker']['buildRevisionData']({'revision':_0x979f35,'from':_0x15e488,'to':_0x553346});_0x23d3bd['id']=_0x979f35['id'];const _0x2ad67c=_0x23d3bd['authorsIds']['map'](_0x24b03b=>_0x520f4e['getUser'](_0x24b03b));_0x979f35['_update']({..._0x23d3bd,'authors':_0x2ad67c},!0x0),this['_revisionTracker']['_bufferUpdate'](_0x979f35['id'],_0x23d3bd,!0x0);}this['_revisionTracker']['_startingVersion']=_0x553346,(_0x979f35['toVersion']===_0x979f35['fromVersion']&&!this['_revisionTracker']['_bufferedUpdates']['has'](_0x5600e2)&&this['_revisionTracker']['repository']['_revisions']['remove'](_0x5600e2),this['_revisionTracker']['_createCurrentRevision'](_0x553346));}const {revisions:_0x2efe88,requestId:_0x399257}=await this['_revisionHistoryService']['reconnect'](_0x4b8c15['connection'],this['_lastRequestId']);_0x10b28e&&_0x2efe88['length']>0x0?_0x426aa9['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x2efe88),this['_handleRevisionsUpdate'](_0x2efe88,_0x399257),this['_revisionTracker']['sendBufferedUpdates']());};return _0x426aa9['_isConnected']?_0x12fda2():new Promise((_0x53ce1d,_0x1a5382)=>{_0x426aa9['once']('change:_isConnected',()=>{_0x12fda2()['then'](_0x53ce1d)['catch'](_0x1a5382);});});}['destroy'](){super['destroy']();}async['_waitForServiceReady'](){this['_revisionHistoryService']['isConnected']||await new Promise(_0x173e0a=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x4316d5=>{_0x4316d5['off'](),_0x173e0a();});});}['_getLatestVersionFromServerOperations'](){const _0x209228=this['editor']['plugins']['get'](l)['serverHistory']['getOperations']()['reverse']();for(const _0x5d7e80 of _0x209228)if('marker'!==_0x5d7e80['type']||_0x5d7e80['affectsData'])return _0x5d7e80['baseVersion']+0x1;}['_getLatestVersion'](){const _0x2942f4=this['editor']['plugins']['get'](l);return new Promise(_0x313129=>{_0x2942f4['_isPendingUpdate']?_0x2942f4['once']('change:_isPendingUpdate',()=>{_0x313129(this['_getLatestVersionFromServerOperations']());}):_0x313129(this['_getLatestVersionFromServerOperations']());});}['_handleRevisionsUpdate'](_0x1b7b82,_0x4e4f91){const _0xb554d2=this['_revisionTracker']['repository'];this['_lastRequestId']=_0x4e4f91;for(const _0x40f69e of _0x1b7b82){const _0x12b537=_0xb554d2['getRevision'](_0x40f69e['id']);if(_0x12b537){if((_0x40f69e['fromVersion']||_0x40f69e['toVersion'])&&(_0x40f69e['diffData']=null),_0x12b537===this['_revisionTracker']['currentRevision']){const _0x36bb87=Math['max'](_0x12b537['toVersion'],_0x40f69e['toVersion']),_0x220179=Math['max'](_0x12b537['fromVersion'],_0x40f69e['fromVersion']);let _0x72a879;_0x12b537['toVersion']===_0x40f69e['toVersion']&&_0x12b537['fromVersion']===_0x40f69e['fromVersion']?(_0x72a879=!0x0,this['_preventResendingRevisionData'](_0x40f69e)):_0x40f69e['toVersion']===_0x36bb87&&_0x40f69e['fromVersion']===_0x220179?_0x72a879=!0x1:(_0x12b537['toVersion']===_0x36bb87&&_0x12b537['fromVersion']===_0x220179||this['_fixRevision']({'revision':_0x12b537,'from':_0x220179,'to':_0x36bb87}),_0x72a879=!0x0),_0x72a879&&(delete _0x40f69e['fromVersion'],delete _0x40f69e['toVersion'],delete _0x40f69e['diffData'],delete _0x40f69e['createdAt'],delete _0x40f69e['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0x40f69e),this['_preventResendingRevisionData'](_0x40f69e);}else this['_revisionTracker']['addRevisionData'](_0x40f69e);}const _0x34e1b7=_0xb554d2['getRevisions']();_0x34e1b7['reverse']();for(let _0x3244fb=0x0;_0x3244fb<_0x34e1b7['length']-0x1;_0x3244fb++){const _0x4d47e8=_0x34e1b7[_0x3244fb],_0x263902=_0x34e1b7[_0x3244fb+0x1];if(_0x4d47e8['fromVersion']<_0x263902['toVersion']){const _0x16f7fc=_0x263902['toVersion'],_0x244de5=Math['max'](_0x16f7fc,_0x4d47e8['toVersion']);this['_fixRevision']({'revision':_0x4d47e8,'from':_0x16f7fc,'to':_0x244de5});}}}['_fixRevision']({revision:_0x19fa7d,from:_0x21fff9,to:_0x3dc078}={}){const _0x83f40b=this['editor']['plugins']['get'](_0x4b074a),_0x100667=this['_revisionTracker']['buildRevisionData']({'revision':_0x19fa7d,'from':_0x21fff9,'to':_0x3dc078});_0x100667['authors']=_0x100667['authorsIds']['map'](_0x317d9a=>_0x83f40b['getUser'](_0x317d9a)),_0x19fa7d['_update'](_0x100667);}['_preventResendingRevisionData'](_0x37bfd2){const _0x1afcef={};_0x1afcef['id']=_0x37bfd2['id'];for(const _0x36e2a0 of Object['keys'](_0x37bfd2))'id'!==_0x36e2a0&&(_0x1afcef[_0x36e2a0]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0x1afcef['id'],_0x1afcef,!0x0);}async['_fetchMissingUsers'](_0x26a2cd){const _0x44f3a9=this['editor']['plugins']['get'](_0x4b074a),{connection:_0x21efb7}=this['editor']['plugins']['get'](c),_0x164c27=new Set();for(const _0x2f9638 of _0x26a2cd){for(const _0xd762b4 of _0x2f9638['authorsIds'])_0xcfd3ba(_0xd762b4);_0x2f9638['creatorId']&&_0xcfd3ba(_0x2f9638['creatorId']);}if(0x0===_0x164c27['size'])return;const _0x19cad0=await dt['getMany'](_0x21efb7,Array['from'](_0x164c27));for(const _0x1280b4 of _0x19cad0)_0x44f3a9['getUser'](_0x1280b4['id'])||_0x44f3a9['addUser'](_0x1280b4);function _0xcfd3ba(_0x5bf615){_0x44f3a9['getUser'](_0x5bf615)||_0x164c27['add'](_0x5bf615);}}}function U(_0x5826b8){return _0x5826b8['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0x5826b8['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x5826b8['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class g extends _0x1fc117{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 _0x4af3b1{['_collapseAt'];constructor(_0x522716,_0x1f7e47=0x6){super(_0x522716);const _0x14a4df=this['bindTemplate'];this['set']('isHidden',!0x0),this['set']('usersCount',0x0),this['_collapseAt']=_0x1f7e47,this['bind']('isHidden')['to'](this,'usersCount',_0x59e524=>_0x59e524<_0x1f7e47),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item',_0x14a4df['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':_0x14a4df['to']('usersCount',_0x5f52df=>'+'+(_0x5f52df-this['_collapseAt']+0x2)['toString']())}]}]}]});}}class ts extends _0x4af3b1{['items'];['keystrokes'];constructor(_0x473188){super(_0x473188);const _0xec8385=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0x9b9c1e(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0xec8385['if']('hasPopup'),'aria-expanded':_0xec8385['to']('isExpanded',_0x1c5628=>this['hasPopup']&&String(_0x1c5628)),'aria-label':_0xec8385['to']('hasPopup',_0x513a92=>Q(_0x473188,_0x513a92?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0xec8385['to']('hasPopup',_0x1ee4a7=>!!_0x1ee4a7&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items'],'on':{'mouseenter':_0xec8385['to'](()=>this['fire']('presencelist:show')),'mouseleave':_0xec8385['to'](_0x5de50c=>{const _0x41467c=_0x5de50c,_0x4633e6=document['querySelector']('.ck-presence-list__dropdown-list'),_0x39283a=document['querySelector']('.ck-balloon-panel_with-arrow');_0x4633e6?.['contains'](_0x41467c['relatedTarget'])||_0x39283a?.['contains'](_0x41467c['relatedTarget'])||this['fire']('presencelist:hide');})}}),this['on']('change:hasPopup',(_0x2249a7,_0x8ba786,_0x5ed4a1)=>{this['element']&&(_0x5ed4a1?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 _0x4af3b1{['counterView'];['inlineListView'];constructor(_0x4abc7b,_0x414fca=0x6){super(_0x4abc7b);const _0x121008=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new A(this['locale'],_0x414fca),this['inlineListView']=new ts(_0x4abc7b),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x111378 of this['inlineListView']['items'])_0x111378['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',_0x121008['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['inlineListView']]});}}class x extends _0x4af3b1{['listWrapperView'];constructor(_0x25a430,_0x9adfb0){super(_0x25a430);const _0x220e0f=this['bindTemplate'];this['listWrapperView']=new mt(_0x25a430,_0x9adfb0),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':Q(_0x25a430,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']],'on':{'mouseleave':_0x220e0f['to'](_0xf604a3=>{const _0x203ec3=_0xf604a3,_0x293231=document['querySelector']('.ck-presence-list__list'),_0x3d5a0f=document['querySelector']('.ck-balloon-panel_with-arrow');_0x293231?.['contains'](_0x203ec3['relatedTarget'])||_0x3d5a0f?.['contains'](_0x203ec3['relatedTarget'])||this['fire']('presencelist:hide');})}});}}class mt extends _0xe6ad67{constructor(_0x3e8880,_0x578cac){super(_0x3e8880);const _0x3db4f0=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0x578cac?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0x3db4f0['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0x3db4f0['to']('role'),'aria-label':_0x3db4f0['to']('ariaLabel'),'aria-labelledby':_0x3db4f0['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0x3719d6['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0xfc0984=this['element'];_0xfc0984&&(this['_isScrollable']=Math['max'](_0xfc0984['scrollHeight'],_0xfc0984['clientHeight'])>0.8*window['innerHeight']);}}class k extends rt{['userView'];constructor(_0x494cc2,_0x165367,_0x1f62bf){super(_0x494cc2);const _0x1d6930=this['bindTemplate'];this['userView']=new ct(_0x494cc2,_0x165367);const _0x52017e={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0x165367['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0x165367['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x165367['color']['getBackgroundColorClass']()],'aria-hidden':'true'}}]};_0x1f62bf&&(_0x52017e['tag']='button',_0x52017e['on']={'click':_0x1d6930['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x52017e);}['focus'](){this['element']['focus']();}}class y extends _0x4af3b1{['userView'];['markerView'];constructor(_0x9bcea2,_0x365cab,_0x218062){super(_0x9bcea2);const _0x2b43d9=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new ct(_0x9bcea2,_0x365cab),this['markerView']=new at(_0x9bcea2,_0x365cab);const _0x4d737f=new ot(_0x9bcea2);_0x4d737f['template']['tag']='span',_0x4d737f['text']=_0x365cab['name'];const _0x14fe85={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0x2b43d9['to']('isFocusable',_0x5395ab=>!!_0x5395ab&&0x0),'aria-labelledby':_0x4d737f['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0x2b43d9['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0x2b43d9['to']('hasTooltip',_0x5049d6=>!_0x5049d6),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0x4d737f]};_0x218062&&(_0x14fe85['tag']='button',_0x14fe85['on']={'click':_0x2b43d9['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x14fe85);}}class at extends _0x4af3b1{constructor(_0x5b0b4e,_0x368053){super(_0x5b0b4e),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x368053['color']['getBackgroundColorClass']()],'aria-hidden':'true'}});}}const C={'collapseAt':0x6,'displayMe':!0x0};class r extends _0x202947{['currentDisplayedUsers'];['balloonPanelView'];['view'];['presenceDropdownView'];['_bodyCollection']=null;static get['pluginName'](){return'PresenceListUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x99b36a){super(_0x99b36a),this['context']['config']['define']('presenceList',C);const _0x57d349=_0x99b36a['config']['get']('presenceList.collapseAt');if('number'!=typeof _0x57d349)throw new _0x45c929('presencelist-collapseat-invalid-format',this);if(_0x57d349<0x1)throw new _0x45c929('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](i)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0xf9bc7a(),this['balloonPanelView']=new _0x52a3b3(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get['requires'](){return[i];}['init'](){for(const _0x33f596 of this['_allConnectedUsers'])this['_handleUserAdd'](_0x33f596);this['listenTo'](this['_allConnectedUsers'],'add',(_0x1c3cb2,_0x515247)=>{this['_handleUserAdd'](_0x515247);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0x18b059,_0xcccff9)=>{this['_handleUserRemove'](_0xcccff9);});}['_createView'](){const _0x80efbf=this['context'],_0x22c520=new j(this['context']['locale'],this['context']['config']['get']('presenceList.collapseAt')),_0x4a4aba=this['balloonPanelView'];if(!_0x2272bb(_0x80efbf['config']['get']('presenceList.container')))throw new _0x45c929('presencelist-missing-container',this);return _0x22c520['counterView']['bind']('usersCount')['to'](this),_0x22c520['bind']('isCollapsed')['to'](this,'usersCount',_0x544c13=>{const {collapseAt:_0x1f9bf9}=_0x80efbf['config']['get']('presenceList'),_0x19b257=_0x544c13>=_0x1f9bf9;if(_0x19b257&&!_0x22c520['inlineListView']['items']['find'](_0x11fa09=>_0x11fa09 instanceof A)){const _0x4a09df=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['currentDisplayedUsers']['length']==_0x4a09df&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](this['currentDisplayedUsers']['length']-0x1),_0x22c520['inlineListView']['items']['add'](_0x22c520['counterView']);}return _0x19b257||this['hideDropdown'](),_0x19b257;}),_0x22c520['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0x57ab14=>{const _0x329600=_0x80efbf['config']['get']('presenceList'),_0x679339=new y(_0x80efbf['locale'],_0x57ab14,!!_0x329600['onClick']);return _0x679339['bind']('hasTooltip')['to'](_0x22c520,'isCollapsed',_0x20c2ac=>!_0x20c2ac),_0x679339['bind']('isFocusable')['to'](_0x22c520,'isCollapsed',_0x333945=>!_0x333945),_0x329600['onClick']&&this['listenTo'](_0x679339,'execute',()=>{this['view']['isCollapsed']||_0x329600['onClick'](_0x57ab14,_0x679339['element']);}),_0x679339;}),this['listenTo'](_0x22c520['inlineListView'],'presencelist:show',()=>{this['view']['isCollapsed']&&this['showDropdown']();}),this['listenTo'](_0x22c520['inlineListView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();}),_0x22c520['inlineListView']['keystrokes']['set']('Enter',(_0x69964a,_0x2f33d7)=>{this['view']['isCollapsed']&&(this['showDropdown'](),_0x2f33d7());}),_0x22c520['render'](),_0x4a4aba['render'](),_0x3afe94({'emitter':_0x22c520,'activator':()=>_0x4a4aba['isVisible'],'contextElements':[_0x4a4aba['element'],_0x22c520['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0x80efbf['config']['get']('presenceList.container')['appendChild'](_0x22c520['element']),this['_bodyCollection']=new _0x43b7da(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_bodyCollection']['add'](this['balloonPanelView']),_0x22c520;}['_handleUserAdd'](_0x49c71){if(!this['context']['config']['get']('presenceList.displayMe')&&_0x49c71['isMe'])return;const _0x19827d=this['context']['config']['get']('presenceList.collapseAt')-0x1;for(this['usersCount']++;this['currentDisplayedUsers']['length']>=_0x19827d-(this['view']['isCollapsed']?0x1:0x0)&&this['currentDisplayedUsers']['length']>0x1;)this['currentDisplayedUsers']['remove'](0x1);const _0xf2594b=_0x49c71['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0x49c71,_0xf2594b);}['_handleUserRemove'](_0x2f5220){this['usersCount']--;const {collapseAt:_0x3ad4da}=this['context']['config']['get']('presenceList'),_0x2b0e00=this['usersCount']>=_0x3ad4da;if(this['currentDisplayedUsers']['get'](_0x2f5220['id']))this['currentDisplayedUsers']['remove'](_0x2f5220['id']);else{if(_0x2b0e00&&this['currentDisplayedUsers']['length']+0x1===_0x3ad4da-0x1)return;}if(this['currentDisplayedUsers']['length']+(_0x2b0e00?0x1:0x0)<this['usersCount']){for(const _0x5a71cc of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0x5a71cc['id'])&&(this['currentDisplayedUsers']['add'](_0x5a71cc,Math['min'](this['currentDisplayedUsers']['length']-(_0x2b0e00?0x1:0x0),0x1)),this['currentDisplayedUsers']['length']+(_0x2b0e00?0x1:0x0)===_0x3ad4da-0x1))return;}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0x1bc636=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new x(this['context']['locale'],!!_0x1bc636['onClick']),this['view']['inlineListView']['isExpanded']=!0x0,this['listenTo'](this['presenceDropdownView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();});const {listWrapperView:_0xbd0720}=this['presenceDropdownView'];_0xbd0720['items']['bindTo'](this['_allConnectedUsers'])['using'](_0x45b66e=>{if(!_0x1bc636['displayMe']&&_0x45b66e['isMe'])return null;const _0x55c871=new k(this['context']['locale'],_0x45b66e,!!_0x1bc636['onClick']);return _0x1bc636['onClick']&&this['listenTo'](_0x55c871,'execute',()=>{_0x1bc636['onClick'](_0x45b66e,_0x55c871['element']);}),_0x55c871;}),this['balloonPanelView']['content']['add'](this['presenceDropdownView']),this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element']}),_0xbd0720['focus'](),_0xbd0720['checkIfScrollable']();const _0x5ed4bf=(_0xd083cb,_0x2d28e0)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0x2d28e0();};_0xbd0720['keystrokes']['set']('Esc',_0x5ed4bf),_0xbd0720['keystrokes']['set']('Shift+Tab',_0x5ed4bf),_0xbd0720['keystrokes']['set']('Tab',(_0x3a1157,_0x4dde9b)=>{!function(_0x1cfd87){const _0x3eb98c=['a','button','input','select','textarea','[tabindex]','[contenteditable]']['map'](_0x6337ce=>_0x6337ce+':not([disabled]):not([tabindex=\x22-1\x22])')['join'](','),_0x4f62f3=[...document['body']['querySelectorAll'](_0x3eb98c)]['filter'](_0x2d4eda=>_0x2d4eda===document['activeElement']||_0x2d4eda['offsetWidth']+_0x2d4eda['offsetHeight']>0x0)['sort']((_0x5eea23,_0xc2140e)=>(_0x5eea23['tabIndex']||0x0)-(_0xc2140e['tabIndex']||0x0)),_0x2860bf=_0x4f62f3['indexOf'](_0x1cfd87),_0x1c677e=_0x4f62f3[(_0x2860bf+0x1)%_0x4f62f3['length']];_0x1c677e&&_0x1c677e['focus']();}(this['view']['element']),this['hideDropdown'](),_0x4dde9b();}),_0xbd0720['focusTracker']['add'](this['view']['element']),_0xbd0720['focusTracker']['on']('change:isFocused',(_0x3e5f27,_0x138620,_0x4fedf2)=>{_0x4fedf2||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 _0x202947{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 _0x1e9e2c,Plugin as _0x20916b,PendingActions as _0x214519,Context as _0x477adb}from'@ckeditor/ckeditor5-core/dist/index.js';import{DomEmitterMixin as _0x3a5f17,CKEditorError as _0x33aefe,Collection as _0x45ec41,global as _0x9f47bb,version as nt,uid as _0x54b238,KeystrokeHandler as _0x31ddfb}from'@ckeditor/ckeditor5-utils/dist/index.js';import{Notification as _0x5c3da0,View as _0x5f4aca,ListView as _0x48119e,ListItemView as rt,LabelView as ot,BalloonPanelView as _0x181e94,clickOutsideHandler as _0x322879,BodyCollection as _0x188f88}from'@ckeditor/ckeditor5-ui/dist/index.js';import{LiveRange as ht,History as _0x266e39,NoOperation as _0x171dfb,InsertOperation as _0x4a7479,MarkerOperation as _0x51983f,RootAttributeOperation as _0x20e10e,transformSets as _0x39c88a,OperationFactory as _0x3ac639}from'@ckeditor/ckeditor5-engine/dist/index.js';import{WebSocketGateway as lt,WEB_SOCKET_GATEWAY_STATES as _0x14ebd0,CollaborativeEditingService as _0x3f3ce7,User as dt,CommentsService as _0x397a38,TrackChangesService as et,RevisionHistoryService as it,EditorService as tt}from'@ckeditor/ckeditor-cloud-services-collaboration/dist/index.js';import{Users as _0x4b25d7,UserView as ct}from'ckeditor5-collaboration/dist/index.js';import{Compressor as _0x5874be}from'@ckeditor/ckeditor5-operations-compressor/dist/index.js';import{isElement as _0xf9bf6f}from'es-toolkit/compat';class c extends _0x1e9e2c{static ['WebSocketGateway']=/* #__PURE__ -- @preserve */
|
|
24
|
+
((()=>lt)());static ['initialReconnectionInterval']=0x3e8;['connection'];['_reconnectionStack'];['_shouldPluginsReconnect'];['_domEmitter'];static get['requires'](){return['CloudServices',_0x5c3da0];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x26395d){super(_0x26395d),this['set']('state',_0x14ebd0['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=Object['create'](_0x3a5f17);}['init'](){const _0x39f4f0=this['context'],_0x25f2ec=_0x39f4f0['plugins']['get']('CloudServices'),_0x4dff67=_0x39f4f0['plugins']['get'](_0x5c3da0);if(!_0x25f2ec['token'])throw new _0x33aefe('websocketgateway-missing-token',this);if(!_0x25f2ec['webSocketUrl'])throw new _0x33aefe('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'](_0x25f2ec['token'],_0x25f2ec['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0x5c10e4=>{if(this['connection']=_0x5c10e4,this['bind']('state')['to'](_0x5c10e4,'state',this,'_isBrowserOffline',(_0x2a0f12,_0x479404)=>('connected'!==_0x2a0f12&&(this['_shouldPluginsReconnect']=!0x0),_0x479404||_0x2a0f12!==_0x14ebd0['CONNECTED']?_0x14ebd0['DISCONNECTED']:this['state']==_0x14ebd0['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),_0x14ebd0['CONNECTING']):_0x14ebd0['CONNECTED'])),this['connection']['on']('error',(_0x47b674,_0x43b576)=>{if('limitExceeded'!==_0x43b576['code'])throw console['error'](_0x43b576),new _0x33aefe('cloudservices-init',null,{'originalError':_0x43b576});_0x4dff67['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'});}),!_0x5c10e4['me'])return new Promise(_0x5c25a9=>_0x5c10e4['on']('change:me',_0x5c25a9));})['catch'](_0x2fa8fc=>{throw console['error'](_0x2fa8fc),new _0x33aefe('cloudservices-init',null,{'originalError':_0x2fa8fc});});}['addToReconnectionStack'](_0xabb0b8){if('function'!=typeof _0xabb0b8['reconnect'])throw new _0x33aefe('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0xabb0b8))throw new _0x33aefe('websocketgateway-plugin-already-registered',this,{'name':_0xabb0b8['constructor']['pluginName']});this['_reconnectionStack']['add'](_0xabb0b8);}['removeFromReconnectionStack'](_0x8d1ea1){this['_reconnectionStack']['delete'](_0x8d1ea1);}['isInReconnectionStack'](_0x17a5e5){return this['_reconnectionStack']['has'](_0x17a5e5);}['_reconnect'](){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0x421e94=>_0x421e94['reconnect']())))['then'](()=>this['state']=_0x14ebd0['CONNECTED'])['catch'](_0xf0861b=>{throw console['error'](_0xf0861b),new _0x33aefe('cloudservices-reconnection-error',this['context']);});}['disconnect'](){this['connection']&&this['connection']['disconnect'](),this['state']=_0x14ebd0['DISCONNECTED'],this['_domEmitter']['stopListening']();}['destroy'](){this['disconnect'](),super['destroy']();}}class i extends _0x1e9e2c{['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,_0x4b25d7];}constructor(_0x3494d4){super(_0x3494d4),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0x45ec41(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x4b25d7);}['init'](){const _0x222db9=this['context']['plugins']['get'](c);this['listenTo'](_0x222db9,'change:state',(_0x1929ce,_0x431c5e,_0x577705)=>{if('connected'!==_0x577705)this['channelSessions']['forEach'](_0xf07ac2=>_0xf07ac2['clear']()),this['channelConnectedUsers']['forEach'](_0x58d1d0=>_0x58d1d0['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x1f332c,_0x1ba335]of this['_registeredSessions'])for(const _0x3fd4ad of _0x1ba335)this['_handleSessionAdd'](_0x1f332c,_0x3fd4ad);}}),this['_createUser'](_0x222db9['connection']['me'],!0x0);}['register'](_0x36ad12,_0x254371){if(this['_registeredSessions']['has'](_0x36ad12))throw new _0x33aefe('sessions-register-already-registered',null,{'channelId':_0x36ad12});this['_registeredSessions']['set'](_0x36ad12,_0x254371),this['channelSessions']['set'](_0x36ad12,new _0x45ec41()),this['channelConnectedUsers']['set'](_0x36ad12,new _0x45ec41()),this['listenTo'](_0x254371,'add',(_0x1b6563,_0x8a8470)=>this['_handleSessionAdd'](_0x36ad12,_0x8a8470)),this['listenTo'](_0x254371,'remove',(_0x1f3405,_0x133e76)=>this['_handleSessionRemove'](_0x36ad12,_0x133e76));for(const _0x32f061 of _0x254371)this['_handleSessionAdd'](_0x36ad12,_0x32f061);}['unregister'](_0x16673b){if(!this['_registeredSessions']['has'](_0x16673b))throw new _0x33aefe('sessions-unregister-not-exist',null,{'channelId':_0x16673b});const _0x3e5b11=this['_registeredSessions']['get'](_0x16673b);this['stopListening'](_0x3e5b11);for(const _0x25ef92 of _0x3e5b11)'connected'===this['context']['plugins']['get'](c)['state']&&this['_handleSessionRemove'](_0x16673b,_0x25ef92);this['_registeredSessions']['delete'](_0x16673b),this['channelSessions']['delete'](_0x16673b),this['channelConnectedUsers']['delete'](_0x16673b);}get['mySessionId'](){return this['context']['plugins']['get'](c)['connection']['sessionId'];}['getUserBySessionId'](_0x11ba69){for(const _0x55813f of this['channelSessions']['values']())for(const _0x5608a1 of _0x55813f)if(_0x5608a1['id']===_0x11ba69)return _0x5608a1['user'];}['getUserSessions'](_0x835f67,_0x2ce133){const _0x5a69f7=_0x2ce133?[this['channelSessions']['get'](_0x2ce133)]:this['channelSessions']['values'](),_0x5b89a6=new Set();for(const _0x2eb693 of _0x5a69f7)for(const _0xce8c49 of _0x2eb693)_0xce8c49['user']['id']===_0x835f67['id']&&_0x5b89a6['add'](_0xce8c49['id']);return _0x5b89a6;}['getUserRole'](_0x39558b){for(const _0x12377a of this['channelSessions']['values']())for(const _0x56c2ef of _0x12377a)if(_0x56c2ef['user']===_0x39558b)return _0x56c2ef['role'];}['_handleSessionAdd'](_0x14ab28,_0x37397b){if('connected'!==this['context']['plugins']['get'](c)['state'])return;const _0x26521f=_0x37397b['user'],_0x44481c=this['_users']['getUser'](_0x26521f['id'])||this['_createUser'](_0x26521f),_0x3fcf7a=Object['assign']({},_0x37397b,{'user':_0x44481c});this['channelSessions']['get'](_0x14ab28)['add'](_0x3fcf7a);const _0x572b09=this['channelConnectedUsers']['get'](_0x14ab28);_0x572b09['has'](_0x44481c['id'])||_0x572b09['add'](_0x44481c),this['allConnectedUsers']['has'](_0x44481c['id'])||this['allConnectedUsers']['add'](_0x44481c,_0x44481c['isMe']?0x0:void 0x0),this['fire']('sessionAdd:'+_0x14ab28,{'channelId':_0x14ab28,'session':_0x3fcf7a});}['_handleSessionRemove'](_0x40d861,_0x1d304d){if('connected'!==this['context']['plugins']['get'](c)['state'])return;const _0x2178ff=this['channelConnectedUsers']['get'](_0x40d861),_0x5b9421=_0x1d304d['user'];_0x5b9421['id']&&(this['channelSessions']['get'](_0x40d861)['remove'](_0x1d304d['id']),_0x2178ff['has'](_0x5b9421['id'])&&!this['getUserSessions'](_0x5b9421,_0x40d861)['size']&&_0x2178ff['remove'](_0x5b9421['id']),this['allConnectedUsers']['get'](_0x5b9421['id'])&&!this['getUserSessions'](_0x5b9421)['size']&&this['allConnectedUsers']['remove'](_0x5b9421['id']));}['_createUser'](_0x349092,_0x77ba5c){const _0x53e76b=this['_users']['addUser'](_0x349092);return _0x77ba5c&&this['_users']['defineMe'](_0x349092['id']),_0x53e76b['orderNumber']=this['_uniqueUsersCount']++,_0x53e76b;}}class q extends _0x20916b{['_domEmitter']=new(_0x3a5f17())();static get['requires'](){return[i];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x5615ee=this['editor'],_0x3efbd6=_0x5615ee['plugins']['get'](i);_0x5615ee['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x39c310,{writer:_0x338634})=>function(_0x459458,_0xeeafcc,_0x53c297,_0x416129){const _0x16b5a0=_0x459458['markerName']['split'](':')[0x2],_0x4c6aaf=_0x53c297['getUserBySessionId'](_0x16b5a0);if(!_0x4c6aaf||_0x16b5a0===_0x53c297['mySessionId'])return;if(!_0x416129['model']['schema']['checkChild'](_0x459458['markerRange']['start'],'$text'))return;const _0x901d0d={'class':'ck-user__marker\x20'+_0x4c6aaf['color']['getMarkerClass'](),'data-name':_0x4c6aaf['name'],'data-session-id':_0x16b5a0},_0x1f0a04=_0x416129['model']['markers']['get'](_0x459458['markerName']),_0x520384=_0x1f0a04['getStart'](),_0x492018=_0x520384['nodeAfter'],_0x495e4f=_0x416129['model']['schema'];if(_0x492018&&_0x495e4f['isObject'](_0x492018)&&_0x495e4f['isInline'](_0x492018)&&!_0x416129['model']['markers']['get']('user:range:'+_0x16b5a0)['getRange']()['isCollapsed'])return;const _0x4c9a7f=_0x520384['parent'];return _0x416129['model']['schema']['isLimit'](_0x4c9a7f)&&!_0x416129['model']['hasContent'](_0x4c9a7f)&&(_0x901d0d['contenteditable']=!0x1),function(_0x14626f,_0x1f531d,_0x441306){const _0x1c2e13=_0x14626f['createUIElement']('span',_0x1f531d);return _0x14626f['setCustomProperty']('userPositionMarker',!0x0,_0x1c2e13),_0x1c2e13['render']=function(_0xe2a58c){const _0xd7fa31=this['toDomElement'](_0xe2a58c),_0x18fada=document['createElement']('span');return _0x18fada['classList']['add']('ck-user__marker-tooltip'),_0x18fada['setAttribute']('contenteditable','false'),_0x18fada['setAttribute']('spellcheck','false'),_0x18fada['textContent']=_0x441306['name'],_0xd7fa31['innerHTML']='<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span>'+_0x18fada['outerHTML']+'',_0xd7fa31['addEventListener']('mouseenter',()=>{_0xd7fa31['classList']['add']('ck-user__marker_hovered');}),_0xd7fa31['addEventListener']('mouseleave',()=>{_0xd7fa31['classList']['remove']('ck-user__marker_hovered');}),_0xd7fa31;},_0x1c2e13['isSimilar']=function(_0x288f9c){return!(!this['getCustomProperty']('userPositionMarker')||!_0x288f9c['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0x288f9c['getAttribute']('data-session-id'));},_0x1c2e13;}(_0xeeafcc,_0x901d0d,_0x4c6aaf);}(_0x39c310,_0x338634,_0x3efbd6,_0x5615ee)}),_0x5615ee['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0x310039=>function(_0x4391eb,_0x5cc009){const _0x3c7544=_0x4391eb['markerName']['split'](':')[0x2];if(_0x3c7544===_0x5cc009['mySessionId'])return null;const _0x241aa4=_0x5cc009['getUserBySessionId'](_0x3c7544);if(!_0x241aa4)return{'id':_0x3c7544,'classes':[]};return{'id':_0x3c7544,'classes':['ck-user__selection',_0x241aa4['color']['getSelectionClass']()],'attributes':{'data-session-id':_0x3c7544},'priority':0x7d0+_0x241aa4['orderNumber']};}(_0x310039,_0x3efbd6)}),function(_0x494654){const _0x5b71d7=_0x494654['model'],_0x54577e=new Map(),_0x5d4b4a=_0x494654['plugins']['get'](i);_0x5b71d7['markers']['on']('update:user:range',(_0x17749c,_0x2670cd,_0x22b9d3,_0x418e65)=>{if(!_0x418e65&&_0x54577e['get'](_0x2670cd['name']))return _0x54577e['get'](_0x2670cd['name'])['detach'](),void _0x54577e['delete'](_0x2670cd['name']);const _0x5d7ca9=_0x2670cd['name']['split'](':')[0x2];if(_0x5d7ca9===_0x5d4b4a['mySessionId'])return;const _0x4ad6a5='user:position:'+_0x5d7ca9;_0x5b71d7['markers']['has'](_0x4ad6a5)&&_0x494654['editing']['reconvertMarker'](_0x4ad6a5),_0x2670cd['on']('change:range',(_0x401318,_0x31cd8a,_0x2dea8a)=>{if('$graveyard'!=_0x31cd8a['root']['rootName']&&'$graveyard'==_0x2670cd['getRange']()['root']['rootName']&&!_0x54577e['has'](_0x2670cd['name'])){const _0x3c879e=_0x5b71d7['schema']['getNearestSelectionRange'](_0x2dea8a['deletionPosition']);if(_0x3c879e){const _0x25adc5=ht['fromRange'](_0x3c879e);_0x54577e['set'](_0x2670cd['name'],_0x25adc5),_0x25adc5['on']('change:range',(_0x58b814,_0x31babc,_0xabfd1)=>{if('$graveyard'==_0x25adc5['root']['rootName']){const _0x2139c1=_0x5b71d7['schema']['getNearestSelectionRange'](_0xabfd1['deletionPosition']);_0x2139c1?(_0x25adc5['start']=_0x2139c1['start'],_0x25adc5['end']=_0x2139c1['end']):(_0x54577e['delete'](_0x2670cd['name']),_0x25adc5['detach']());}});}}});}),_0x5b71d7['document']['on']('change',()=>{_0x54577e['size']>0x0&&_0x5b71d7['enqueueChange']({'isUndoable':!0x1},_0x2e760d=>{for(const [_0xa31b4,_0x418b54]of _0x54577e)'$graveyard'==_0x5b71d7['markers']['get'](_0xa31b4)['getRange']()['root']['rootName']&&(te(_0xa31b4['split'](':')[0x2],_0x418b54['toRange'](),_0x5b71d7,_0x2e760d),_0x418b54['detach']());_0x54577e['clear']();});});}(_0x5615ee),this['_domEmitter']['listenTo'](_0x9f47bb['document'],'keydown',(_0x4279fe,{key:_0x59c620})=>{'Escape'===_0x59c620&&function(_0x96f3d4){_0x96f3d4['editing']['view']['change'](_0x1631f9=>{for(const _0x593c0b of _0x96f3d4['model']['markers']){if(!_0x593c0b['name']['startsWith']('user:position'))continue;const _0xf7a909=_0x96f3d4['editing']['mapper']['markerNameToElements'](_0x593c0b['name']);if(_0xf7a909){for(const _0x8994cc of _0xf7a909)_0x1631f9['removeClass']('ck-user__marker_hovered',_0x8994cc);}}});}(_0x5615ee);},{'useCapture':!0x0});}['afterInit'](){const _0x30e78e=this['editor'],_0x50f707=_0x30e78e['commands']['get']('undo');_0x50f707&&_0x30e78e['model']['on']('applyOperation',(_0x4c0491,_0x479940)=>{const _0x46a93c=_0x479940[0x0];if(!_0x46a93c['isDocumentOperation'])return;if('marker'!=_0x46a93c['type']||!_0x46a93c['name']['startsWith']('user:'))return;const _0x25d2bf=_0x46a93c['batch'];_0x50f707['_createdBatches']['has'](_0x25d2bf)&&(_0x46a93c['newRange']=_0x46a93c['oldRange']?_0x30e78e['model']['createRange'](_0x46a93c['oldRange']['start'],_0x46a93c['oldRange']['end']):null);},{'priority':'highest'});}['destroy'](){return this['_domEmitter']['stopListening'](),super['destroy']();}['createUserMarkerOperations'](){const _0x446db7=this['editor'],_0x5c7f9f=_0x446db7['model']['document'],_0xea1db9=_0x446db7['plugins']['get'](i);_0x446db7['model']['enqueueChange']({'isUndoable':!0x1},_0x11f7d7=>{const _0x4cc701='user:range:'+_0xea1db9['mySessionId'],_0x4d65be='user:position:'+_0xea1db9['mySessionId'],_0x2d1db9=_0x446db7['model']['markers']['has'](_0x4cc701);_0x446db7['editing']['view']['hasDomSelection']?te(_0xea1db9['mySessionId'],_0x5c7f9f['selection']['getFirstRange'](),_0x446db7['model'],_0x11f7d7):_0x2d1db9&&(_0x11f7d7['removeMarker'](_0x4cc701),_0x11f7d7['removeMarker'](_0x4d65be));});}}function te(_0x12f1f7,_0x134d24,_0x5526ba,_0x4d44aa){const _0x1224cc='user:range:'+_0x12f1f7,_0x29f53e='user:position:'+_0x12f1f7,_0x45c2da=_0x134d24['getContainedElement']();let _0x5e2d7e=_0x134d24['start'];_0x45c2da&&_0x45c2da['is']('element','tableCell')&&(_0x5e2d7e=function(_0x1634d1,_0x48f87a){for(const _0xcd80f9 of _0x1634d1['getPositions']())if(_0x48f87a['schema']['checkChild'](_0xcd80f9,'$text'))return _0xcd80f9;}(_0x134d24,_0x5526ba),_0x134d24=_0x4d44aa['createRange'](_0x5e2d7e));const _0x1bdfd6=_0x4d44aa['createRange'](_0x5e2d7e);_0x5526ba['markers']['has'](_0x1224cc)?(_0x4d44aa['updateMarker'](_0x1224cc,{'range':_0x134d24}),_0x4d44aa['updateMarker'](_0x29f53e,{'range':_0x1bdfd6})):(_0x4d44aa['addMarker'](_0x1224cc,{'range':_0x134d24,'usingOperation':!0x0}),_0x4d44aa['addMarker'](_0x29f53e,{'range':_0x1bdfd6,'usingOperation':!0x0}));}function G(_0x508767,_0x3b2f53,_0x562d87){const _0x255f46=_0x508767['t'],t=_0x508767['t'];switch(_0x3b2f53){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 _0x255f46({'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'},_0x562d87);default:return'';}}let J=0x1;class l extends _0x20916b{static ['CollaborativeEditingService']=/* #__PURE__ -- @preserve */
|
|
25
|
+
((()=>_0x3f3ce7)());['_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,_0x214519,_0x4b25d7,_0x5c3da0];}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 _0x5cb369=this['serverHistory']['getOperations']();for(let _0x3e8d19=_0x5cb369['length']-0x1;_0x3e8d19>=0x0;_0x3e8d19--){const _0x5a834f=_0x5cb369[_0x3e8d19];if(!this['_disconnectionOperations']['has'](_0x5a834f))return _0x5a834f['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0xce836){if(super(_0xce836),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x266e39(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0x33aefe('collaboration-missing-channelid',this);const _0x264846=_0xce836['config']['get']('cloudServices.bundleVersion')||nt;this['_service']=new l['CollaborativeEditingService'](_0x264846,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0x5874be(),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 _0x3f9e98=this['editor'],_0x4250bb=_0x3f9e98['plugins']['get'](_0x4b25d7),_0x499169=_0x3f9e98['plugins']['get'](c);this['listenTo'](_0x4250bb,'getOperationAuthor',(_0x109ee3,_0x48aaa7)=>{const _0x1a7411=_0x48aaa7[0x0];_0x1a7411['_authorId']&&(_0x109ee3['return']=_0x4250bb['getUser'](_0x1a7411['_authorId']),_0x109ee3['stop']()),null===_0x1a7411['_authorId']&&(_0x109ee3['return']=null,_0x109ee3['stop']());},{'priority':'high'}),this['listenTo'](_0x3f9e98['model']['document']['selection'],'change:range',(_0x613593,_0x498d11)=>{_0x498d11['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x3f9e98['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x3f9e98['model']['on']('applyOperation',(_0x2233cd,_0x4047d)=>{const _0x1738d7=_0x4047d[0x0];_0x1738d7['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0x1738d7),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['bind']('_isEditingAllowed')['to'](_0x499169,'state',this,'_hasSynchronizationProblem',(_0x31b9d4,_0x45b787)=>'connected'===_0x31b9d4&&!_0x45b787),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x3f9e98['disableReadOnlyMode']('rtc-offline'):_0x3f9e98['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x3f9e98['disableReadOnlyMode']('rtc-offline'):_0x3f9e98['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async['reconnect'](){const _0xa4f4f9=this['editor']['plugins']['get'](i),_0x37f422=this['editor']['plugins']['get'](c);try{this['_isPendingUpdate']=!0x0,_0xa4f4f9['unregister'](this['_channelId']);const _0x1ea2de=await this['_service']['reconnect'](_0x37f422['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0x1ea2de)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x4062e6=await this['_service']['getConnectedSessions']();_0xa4f4f9['register'](this['_channelId'],_0x4062e6),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x429429){if(function(_0x339314){return'404'===_0x339314['code'];}(_0x429429)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0x3345f0){return'409'===_0x3345f0['code'];}(_0x429429)){const _0x36651b=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'](_0x36651b);}else{if(!(_0x429429 instanceof Q))throw _0x429429;this['_handleReconnectionError']();}}}}['destroy'](){const _0x2664a7=this['editor']['plugins']['get'](c),_0x431c1c=this['editor']['plugins']['get'](i);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x431c1c['channelSessions']['has'](this['_channelId'])&&_0x431c1c['unregister'](this['_channelId']),_0x2664a7['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async['_handleReconnectionResponse'](_0x34694f){if(this['sessionId']!==_0x34694f['sessionId']&&this['_lastSyncedOperationId']!==_0x34694f['lastOperationId'])throw new Q();return this['sessionId']=_0x34694f['sessionId'],this['_handleServerResponse']([],{..._0x34694f,'wereChangesApplied':!0x1,'data':_0x34694f['data']},'reconnect');}async['_connectService'](_0x1ad6cc,_0x578aed=!0x1){const {connection:_0x2dde66}=this['editor']['plugins']['get'](c);l['CollaborativeEditingService']['getConnectedSessions'](_0x2dde66,this['_channelId'])['then'](_0x21c963=>this['_initSessionsHandling'](_0x21c963))['catch'](_0x1c041a=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x1c041a);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0xecad3,_0xf432d)=>{this['_crash']('realtimecollaborationclient-init-service-internal-error',_0xf432d);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_isConnected']=!0x1;});const _0x471d87=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x1ad6cc);this['_isPendingUpdate']=!0x0;const _0x13da57=await this['_service']['connect'](_0x2dde66,this['_compressOperations'](_0x1ad6cc),_0x471d87);if(this['sessionId']=_0x13da57['sessionId'],_0x578aed){if(!_0x13da57['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x13da57['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0x1ad6cc,_0x13da57,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x13da57,_0x1ad6cc);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}['_handleSendingSelectionMarkers'](){const _0x33e4dc=this['editor']['plugins']['get'](i),_0x1c8ffa=this['editor']['plugins']['get'](q),_0x189901=_0x33e4dc['channelSessions']['get'](this['_channelId']);_0x189901&&_0x189901['length']>0x1?_0x1c8ffa['createUserMarkerOperations']():this['listenTo'](_0x33e4dc,'sessionAdd:'+this['_channelId'],()=>{0x2===_0x33e4dc['channelSessions']['get'](this['_channelId'])['length']&&_0x1c8ffa['createUserMarkerOperations']();});}async['_handleReceivedOperations'](_0x2464eb,_0x20373c,_0x4485fb,_0xa27b03){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x20373c){const _0x3769c0=this['_decompressOperations'](_0x4485fb,_0xa27b03);await this['_fetchMissingUsers'](_0x3769c0),this['_handleExternalOperations'](_0x3769c0,_0x20373c,_0x4485fb['lastOperationId'])||this['_crash']('realtimecollaborationclient-init-service-incorrect-server-operation');}}async['_connectAfterSessionHasBeenFlushed'](){this['_disconnectService']();const {locale:_0x26b791}=this['editor'];let _0x2a8d27;try{_0x2a8d27=await this['_service']['getDocumentDetails']();}catch(_0x3a35f7){const _0x3fbed7=G(_0x26b791,'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'](_0x3fbed7);}const _0x4fde9e=_0x2a8d27['currentDocumentSession']||_0x2a8d27['lastDocumentSession'];if(this['_lastSyncedOperationId']===_0x4fde9e['lastOperationId'])await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);else{const _0x46dbac=G(_0x26b791,'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'](_0x46dbac);}}['_disconnectService'](){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['stopListening'](this['_service']);}['_initSessionsHandling'](_0x29e812){const _0x1722f1=this['editor']['plugins']['get'](i);this['listenTo'](_0x1722f1,'sessionAdd:'+this['_channelId'],(_0x454ba6,{session:_0x3dd404})=>{if(_0x3dd404['id']===_0x1722f1['mySessionId']){_0x454ba6['off']();const _0x5f04cf=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0xaf8ea8=_0x3dd404['permissions'];_0x5f04cf&&_0x5f04cf['isEnabled']&&(_0xaf8ea8=_0xaf8ea8['filter'](_0x410df7=>'document:write'!==_0x410df7)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0xaf8ea8,this['_channelId']);}}),_0x1722f1['register'](this['_channelId'],_0x29e812);}['_initThrowingOnDataSet'](){const _0x51f57a=this['editor']['data']['set'];this['editor']['data']['set']=(..._0x3037a8)=>{if(!_0x3037a8[_0x3037a8['length']-0x1]['suppressErrorInCollaboration'])throw new _0x33aefe('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x51f57a['apply'](this['editor']['data'],_0x3037a8);};}['_setUpDataInit'](){this['editor']['data']['on']('init',(_0x18d81f,[_0x2c2bd6])=>{if(this['_document']['version'])throw new _0x33aefe('realtimecollaborationclient-init-document-already-initialized',this);_0x18d81f['stop'](),this['_setPendingAction']();const _0x589989=this['editor']['config']['get']('rootsAttributes'),_0x281586=this['_getOperationsFromInitData'](_0x2c2bd6,_0x589989);0x0==_0x281586['length']&&_0x281586['push'](new _0x171dfb(0x0)),_0x18d81f['return']=this['_connectService'](_0x281586)['then'](()=>{this['editor']['plugins']['get'](c)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0xdf8c9c=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0xdf8c9c))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x3c44c1,[_0x278c6d,_0x4ba368])=>{_0x3c44c1['stop']();const _0x4b11c6=this['editor']['model']['document']['getRoot'](_0x278c6d);if(!this['_knownRootNames']['has'](_0x278c6d)){const _0x312c1e=_0x4ba368&&_0x4ba368['data']?_0x4ba368['data']:'',_0x35381f=_0x4ba368&&_0x4ba368['attributes']?_0x4ba368['attributes']:{};await this['_loadRoot'](_0x278c6d,_0x312c1e,_0x35381f);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0x4b11c6['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0x4b11c6);});},{'priority':'high'});}async['_fetchMissingUsers'](_0xb3a6bb){const _0x69e5f1=this['editor']['plugins']['get'](_0x4b25d7),{connection:_0x2b4f1c}=this['editor']['plugins']['get'](c),_0x313309=new Set();for(const _0x4cf7cc of _0xb3a6bb){const _0x307d8f=_0x4cf7cc['_authorId'];_0x307d8f&&!_0x69e5f1['getUser'](_0x307d8f)&&_0x313309['add'](_0x307d8f);}if(0x0===_0x313309['size'])return;const _0x11587e=await dt['getMany'](_0x2b4f1c,Array['from'](_0x313309));for(const _0x4011e0 of _0x11587e)_0x69e5f1['getUser'](_0x4011e0['id'])||_0x69e5f1['addUser'](_0x4011e0);}['_getOperationsFromInitData'](_0x5ad6e0,_0x1ad591={}){const _0x1a12c1=this['editor']['model'],_0xf6ff6f=[];let _0xd66811=0x0;const _0x2ddef4='string'==typeof _0x5ad6e0?{'main':_0x5ad6e0}:_0x5ad6e0;for(const _0x26f1de of Object['keys'](_0x2ddef4)){if(!this['_document']['roots']['has'](_0x26f1de))throw new _0x33aefe('realtimecollaborationclient-init-non-existent-root',this);const _0x502e41=this['editor']['data']['parse'](_0x2ddef4[_0x26f1de]),_0x5cbc93=this['_document']['getRoot'](_0x26f1de),_0x81811c=new _0x4a7479(_0x1a12c1['createPositionAt'](_0x5cbc93,0x0),_0x502e41,_0xd66811++);_0xf6ff6f['push'](_0x81811c);for(const [_0x58d279,_0x52d88c]of _0x502e41['markers']){const _0x203635=_0x1a12c1['createRange'](_0x1a12c1['createPositionFromPath'](_0x5cbc93,_0x52d88c['start']['path']['slice']()),_0x1a12c1['createPositionFromPath'](_0x5cbc93,_0x52d88c['end']['path']['slice']())),_0x161279=new _0x51983f(_0x58d279,null,_0x203635,_0x1a12c1['markers'],!0x0,_0xd66811++);_0xf6ff6f['push'](_0x161279);}}if(_0x1ad591)for(const [_0x376512,_0x454b60]of Object['entries'](_0x1ad591)){const _0x1da146=_0x1a12c1['document']['getRoot'](_0x376512);if(!_0x1da146)throw new _0x33aefe('multi-root-editor-root-attributes-no-root',null);for(const [_0x4846e0,_0x5b488f]of Object['entries'](_0x454b60))if(null!==_0x5b488f){const _0x1ba884=new _0x20e10e(_0x1da146,_0x4846e0,null,_0x5b488f,_0xd66811++);_0xf6ff6f['push'](_0x1ba884);}}return _0xf6ff6f;}async['_loadRoot'](_0x11a5db,_0x971923,_0x34f82a){this['_getOperationsFromInitData']({[_0x11a5db]:_0x971923},{[_0x11a5db]:_0x34f82a})['forEach']((_0x1f9ccf,_0x196c55)=>{_0x1f9ccf['baseVersion']=this['_document']['version']+_0x196c55,_0x1f9ccf['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x1f9ccf);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async['_handleInitialConnectionData'](_0x266f90,_0x9ceece){let _0x2a6aab;this['_offset']=_0x266f90['offset'];const _0x52e8e6=_0x266f90['wereChangesApplied']&&!_0x266f90['initData'],_0x8266ba=_0x52e8e6?0x0:_0x266f90['data']['baseVersion'];if(_0x9ceece['forEach'](_0x565240=>{_0x565240['_isInit']=!0x0,_0x565240['createdAt']=_0x266f90['sessionCreatedAt'],_0x565240['_authorId']=null;}),_0x52e8e6)_0x2a6aab=_0x9ceece,this['_applyOperationsSet'](_0x2a6aab,_0x52e8e6);else{if(_0x266f90['initData']){const _0xc4d8df=this['_getOperationsFromInitData'](_0x266f90['initData']);this['_document']['history']['version']=-_0xc4d8df['length'],_0xc4d8df['forEach'](_0x596a9a=>{_0x596a9a['baseVersion']-=_0xc4d8df['length'],_0x596a9a['createdAt']=_0x266f90['sessionCreatedAt'],_0x596a9a['_isInit']=!0x0,_0x596a9a['_authorId']=null;}),this['_applyOperationsSet'](_0xc4d8df,!0x0),this['serverHistory']['version']=-_0xc4d8df['length']+this['_offset'],this['_updateServerHistory'](_0xc4d8df);}this['_document']['history']['version']=_0x8266ba,_0x2a6aab=this['_decompressOperations'](_0x266f90['data'],_0x266f90['metadata']),await this['_fetchMissingUsers'](_0x2a6aab),this['_applyOperationsSet'](_0x2a6aab,_0x52e8e6);}_0x266f90['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x2a6aab,_0x266f90['lastOperationId']),this['_lastSyncedOperationId']=_0x266f90['lastOperationId']),this['serverHistory']['version']=_0x8266ba+this['_offset'],this['_updateServerHistory'](_0x2a6aab),_0x9ceece['filter'](_0xa96740=>{const _0x42511e=this['_getAffectedRoot'](_0xa96740);return _0x42511e&&!this['_knownRootNames']['has'](_0x42511e);})['forEach']((_0x299636,_0xc0e245)=>{_0x299636['baseVersion']=this['_document']['version']+_0xc0e245,this['_saveOperationInBuffer'](_0x299636);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x44c3b5,_0x44eacb){const _0x3e267d=_0x44eacb&&_0x44eacb['message'];if(_0x3e267d&&_0x3e267d['startsWith']('realtimecollaborationclient'))throw _0x44eacb;const _0xa7937a=this['editor']['plugins']['get'](c);throw this['_isPendingUpdate']=!0x0,_0xa7937a['disconnect'](),this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0x33aefe(_0x44c3b5,this['editor'],_0x3e267d?{'originalError':_0x3e267d}:void 0x0);}['_saveOperationInBuffer'](_0x36006b){this['_knownOperations']['has'](_0x36006b)||(this['_knownOperations']['add'](_0x36006b),this['_bufferedOperations']['push'](_0x36006b),this['_pendingAction']||'marker'==_0x36006b['type']&&!_0x36006b['affectsData']||this['_setPendingAction']());}['_sendBufferedOperationsDelayed'](_0x25bead=!0x1){!_0x25bead&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0x20968a=>{_0x20968a&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0x105351=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0x3a7229){return _0x3a7229['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x3a7229['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0x3a7229['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0x105351)||this['_crash'](_0x105351['message'],_0x105351);});},this['_currentBufferDelay']));}['_waitUntilSynced'](){return new Promise(_0x28eae0=>{this['on']('change:_isPendingUpdate',()=>{_0x28eae0();});});}async['_sendBufferedOperations'](){const _0x3ec1a0=this['editor']['plugins']['get'](q);if(this['_shouldSendSelectionUpdate']()&&(_0x3ec1a0['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x21f833=[...this['_bufferedOperations']];for(const _0x2126b6 of _0x21f833)_0x2126b6['wasUndone']=this['_document']['history']['isUndoneOperation'](_0x2126b6);const _0x26f060=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x21f833),_0x2d4a39=J++,_0x3f49c7=this['_compressOperations'](_0x21f833),_0x358d7d=await this['_service']['sendOperations'](_0x3f49c7,_0x3f49c7['baseVersion'],_0x26f060);try{return await this['_handleServerResponse'](_0x21f833,_0x358d7d,_0x2d4a39);}catch(_0x321a02){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0x321a02);}}async['_handleServerResponse'](_0x5e80ee,_0x414227,_0x2982b2){if('error'in _0x414227)throw _0x414227['error'];let _0x261218=!0x1;if(_0x414227['wereChangesApplied']){_0x414227['lastOperationId']&&(this['_lastSyncedOperationId']=_0x414227['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x458571=>!_0x5e80ee['includes'](_0x458571));for(const _0xa987c3 of _0x5e80ee)_0xa987c3['createdAt']='lastOperationAcceptedAt'in _0x414227&&_0x414227['lastOperationAcceptedAt']||void 0x0;X(_0x5e80ee,_0x414227['version']-_0x5e80ee['length']),this['_updateServerHistory'](_0x5e80ee);const _0x303e59=_0x5e80ee['filter'](_0x5d1b99=>{if(!_0x5d1b99['_isInit'])return!0x1;const _0x289f5a=this['_getAffectedRoot'](_0x5d1b99);return _0x289f5a&&!this['_knownRootNames']['has'](_0x289f5a);});X(_0x303e59,this['_document']['version']),this['_applyOperationsSet'](_0x303e59),_0x261218=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0x51aa29=this['_decompressOperations'](_0x414227['data'],_0x414227['metadata'])['filter'](_0x18c87a=>_0x18c87a['baseVersion']>=this['_lastServerVersion']);_0x51aa29['forEach'](_0x516ba8=>this['_addKnownRoot'](_0x516ba8)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x362af3=>!_0x362af3['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x362af3))),this['_bufferedOperations']['length']&&X(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0x51aa29),_0x261218=this['_handleExternalOperations'](_0x51aa29,_0x414227['version'],_0x414227['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x261218?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}['_handleExternalOperations'](_0x205040,_0x4e0eb4,_0x7ad584){try{const _0xa4f498={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x1e75a0,operationsB:_0x532814,originalOperations:_0x334818}=_0x39c88a(_0x205040,this['_bufferedOperations'],_0xa4f498);X(_0x1e75a0,this['_document']['version']),X(_0x532814,_0x4e0eb4);for(const _0x1ae4b5 of _0x1e75a0){const _0x5a6fdf=_0x334818['get'](_0x1ae4b5);_0x1ae4b5['_authorId']=_0x5a6fdf?_0x5a6fdf['_authorId']:null;}_0x7ad584&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x205040,_0x7ad584),this['_lastSyncedOperationId']=_0x7ad584),this['_bufferedOperations']=[..._0x532814],this['_applyOperationsSet'](_0x1e75a0),this['_updateServerHistory'](_0x205040);}catch(_0x208f7a){return console['error'](_0x208f7a),!0x1;}return!0x0;}['_applyOperationsSet'](_0x17c7a8,_0x52c695=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0x235b58=>{for(const _0x522909 of _0x17c7a8)this['_knownOperations']['add'](_0x522909),this['_addKnownRoot'](_0x522909),_0x235b58['batch']['addOperation'](_0x522909),this['editor']['model']['applyOperation'](_0x522909);});}['_addKnownRoot'](_0x162903){const _0x397c4e=this['_getAffectedRoot'](_0x162903);_0x397c4e&&this['_knownRootNames']['add'](_0x397c4e);}['_getAffectedRoot'](_0x270773){let _0x190b19,_0x238692;switch(_0x270773['type']){case'insert':_0x190b19=_0x270773['position']['root'];break;case'marker':if(_0x238692=_0x270773['newRange'],!_0x238692)return null;_0x190b19=_0x238692['root'];break;case'addRootAttribute':_0x190b19=_0x270773['root'];break;case'addRoot':_0x190b19=_0x270773['affectedSelectable'];break;case'move':_0x190b19=_0x270773['targetPosition']['root'];break;default:return null;}return _0x190b19['rootName'];}['_updateServerHistory'](_0xd9c309){_0xd9c309['forEach'](_0x48de21=>{const _0x477930=_0x48de21['clone']();_0x477930['_authorId']=_0x48de21['_authorId'],_0x477930['_isInit']=!!_0x48de21['_isInit'],_0x477930['createdAt']=_0x48de21['createdAt'],_0x477930['baseVersion']+=this['_offset'],_0x48de21['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x477930),this['serverHistory']['addOperation'](_0x477930);});}['_handleReconnectionError'](_0x17785a){const _0x1a6755=this['editor']['plugins']['get']('Notification'),_0x2bdf4f=this['editor']['locale'];_0x17785a||(_0x17785a=G(_0x2bdf4f,'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.')),_0x1a6755['showWarning'](_0x17785a,{'title':G(_0x2bdf4f,'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'](_0x214519)['add'](G(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}['_clearPendingAction'](){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x214519)['remove'](this['_pendingAction']),this['_pendingAction']=null);}['_compressOperations'](_0x41f9b0){const _0x3571ca=_0x41f9b0['map'](_0x5a1f64=>_0x5a1f64['toJSON']());return this['_compressor']['compress'](_0x3571ca);}['_decompressOperations'](_0x265a7a,_0x12fe68){return this['_compressor']['decompress'](_0x265a7a)['map']((_0x57e12e,_0x4b1c0e)=>{const _0x21de53='init'==_0x12fe68[_0x4b1c0e]['type'];if('InsertOperation'==_0x57e12e['__className']){const _0x5e3c93=_0x57e12e['position']['root'];!this['_document']['getRoot'](_0x5e3c93)&&(this['_document']['createRoot']('$root',_0x5e3c93)['_isAttached']=!0x1);}const _0x30e90a=_0x3ac639['fromJSON'](_0x57e12e,this['_document']);return _0x30e90a['wasUndone']=_0x57e12e['wasUndone'],_0x30e90a['_isInit']=_0x21de53,_0x30e90a['_authorId']=_0x21de53?null:_0x12fe68[_0x4b1c0e]['userId'],_0x30e90a['_isDisconnection']='cs:removeUser'===_0x12fe68[_0x4b1c0e]['type'],_0x30e90a['createdAt']=_0x12fe68[_0x4b1c0e]['createdAt'],_0x30e90a;});}['_refreshUserSelectionMarkers'](){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}['_shouldSendSelectionUpdate'](){const _0x3699be=this['editor']['plugins']['get'](i)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0x3699be&&_0x3699be['length']>0x1&&this['_hasSelectionChanged'];}['_shouldSendUpdate'](){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}}class Q extends Error{}function X(_0x3ffa91,_0x5ba1d1){for(const _0x4aca63 of _0x3ffa91)_0x4aca63['baseVersion']=_0x5ba1d1++;}class Y{['_ignoredOperations'];['_operationToId'];constructor(_0x482c41){this['_ignoredOperations']=_0x482c41,this['_operationToId']=new WeakMap();}['getIdOfTheLastOperation'](_0x2c91e8){let _0x15d77c=_0x2c91e8['length'];for(;_0x15d77c--;){const _0x45b0ba=_0x2c91e8[_0x15d77c];if(!this['_ignoredOperations']['has'](_0x45b0ba)){if(!this['_operationToId']['has'](_0x45b0ba)){const _0x42d773=_0x54b238()['slice'](0x1,0x12);this['_operationToId']['set'](_0x45b0ba,_0x42d773);}return this['_operationToId']['get'](_0x45b0ba);}}}['setIdForTheLastOperation'](_0xe2c01b,_0x32528e){if(!_0x32528e)return;let _0x1c4c4b=_0xe2c01b['length'];for(;_0x1c4c4b--;){const _0x4664bb=_0xe2c01b[_0x1c4c4b];this['_ignoredOperations']['has'](_0x4664bb)||this['_operationToId']['set'](_0x4664bb,_0x32528e);}}}class n extends _0x20916b{static get['requires'](){return[l];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class a extends _0x1e9e2c{static ['CommentsService']=/* #__PURE__ -- @preserve */
|
|
26
|
+
((()=>_0x397a38)());['_services'];static get['requires'](){return[c,'CommentsRepository',i,_0x4b25d7];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x1201f9){super(_0x1201f9),this['_services']=new Map();}async['init'](){const _0x4f9952=this['context'],_0x8e988e=_0x4f9952['plugins']['get']('CommentsRepository');if(_0x4f9952['plugins']['get'](c)['addToReconnectionStack'](this),_0x8e988e['adapter']={'addCommentThread':async({channelId:_0x5039bb,threadId:_0x420a31,comments:_0x2f09b6,resolvedAt:_0x58b1b0,resolvedBy:_0x172981,context:_0x49626c,attributes:_0x3eb94f})=>{const _0x48b141=await this['_getService'](_0x5039bb)['addCommentThread']({'commentThreadId':_0x420a31,'comments':_0x2f09b6['map'](_0x19ad92=>function(_0x6d6bb3,_0x15e5d8,_0x50ea4d){return{'commentThreadId':_0x50ea4d,'commentId':_0x6d6bb3['commentId'],'userId':_0x6d6bb3['authorId'],'content':_0x6d6bb3['content'],'documentId':_0x15e5d8,'createdAt':_0x6d6bb3['createdAt'],'attributes':_0x6d6bb3['attributes']||{}};}(_0x19ad92,_0x5039bb,_0x420a31)),'resolvedAt':_0x58b1b0,'resolvedBy':_0x172981,'context':_0x49626c,'attributes':_0x3eb94f})['catch'](ut);return{'threadId':_0x48b141['commentThreadId'],'comments':_0x48b141['comments']};},'getCommentThread':async({channelId:_0x3c2938,threadId:_0x297321})=>{const _0x19c7f2=await this['_getService'](_0x3c2938)['getCommentThread'](_0x297321)['catch'](ut);return _0x19c7f2['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0x19c7f2]),{'threadId':_0x19c7f2['commentThreadId'],'comments':_0x19c7f2['comments']['map'](_),'context':_0x19c7f2['context'],'resolvedAt':_0x19c7f2['resolvedAt'],'resolvedBy':_0x19c7f2['resolvedBy'],'attributes':_0x19c7f2['attributes']||{}});},'updateCommentThread':async({channelId:_0x90f6b7,threadId:_0x2a0186,context:_0x52334a,unlinkedAt:_0x564ba6,attributes:_0x62e2d6})=>this['_getService'](_0x90f6b7)['updateCommentThread']({'commentThreadId':_0x2a0186,'context':_0x52334a,'attributes':_0x62e2d6,'unlinkedAt':_0x564ba6})['catch'](S)['catch'](ut),'resolveCommentThread':async({channelId:_0x5249ff,threadId:_0x5f4fd2})=>{const _0x313efb=await this['_getService'](_0x5249ff)['resolveCommentThread'](_0x5f4fd2)['catch'](S)['catch'](ut);return{'threadId':_0x313efb['commentThreadId'],'resolvedAt':_0x313efb['resolvedAt'],'resolvedBy':_0x313efb['resolvedBy']};},'reopenCommentThread':async({channelId:_0x264b79,threadId:_0x28299c})=>this['_getService'](_0x264b79)['reopenCommentThread'](_0x28299c)['catch'](S)['catch'](ut),'removeCommentThread':({channelId:_0x26c0b5,threadId:_0x5eea5e})=>this['_getService'](_0x26c0b5)['removeCommentThread'](_0x5eea5e)['catch'](S)['catch'](ut),'addComment':({channelId:_0x1a7943,threadId:_0x1cfcd6,commentId:_0x31217c,content:_0x3583f4,attributes:_0x655e57})=>this['_getService'](_0x1a7943)['addComment'](_0x1cfcd6,_0x31217c,_0x3583f4,_0x655e57)['catch'](ut),'updateComment':({channelId:_0x9e7911,threadId:_0x1fbf7e,commentId:_0x46b899,content:_0x44db21,attributes:_0x278bf4})=>this['_getService'](_0x9e7911)['updateComment'](_0x1fbf7e,_0x46b899,_0x44db21,_0x278bf4)['catch'](S)['catch'](ut),'removeComment':({channelId:_0x27fa52,threadId:_0x235bfa,commentId:_0x3b2b46})=>this['_getService'](_0x27fa52)['removeComment'](_0x235bfa,_0x3b2b46)['catch'](S)['catch'](ut)},_0x4f9952 instanceof _0x477adb){const _0x3ae219=_0x4f9952['config']['get']('collaboration.channelId'),_0x870ebc=_0x4f9952['plugins']['get'](i);await this['_setUpService'](_0x3ae219);const _0x29dec3=await this['_services']['get'](_0x3ae219)['getConnectedSessions']();this['listenTo'](_0x870ebc,'sessionAdd:'+_0x3ae219,(_0x1fcda4,{session:_0x242940})=>{_0x242940['id']===_0x870ebc['mySessionId']&&(_0x1fcda4['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x242940['permissions'],_0x3ae219));}),_0x870ebc['register'](_0x3ae219,_0x29dec3);}}async['_setUpService'](_0x13fb49){if(this['_services']['has'](_0x13fb49))throw new _0x33aefe('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0x13fb49});const _0x4de6a0=this['context']['plugins']['get']('CommentsRepository'),_0x3db26d=new a['CommentsService'](_0x13fb49);this['_services']['set'](_0x13fb49,_0x3db26d),this['listenTo'](_0x3db26d,'commentThreadAdded',(_0x72ebe3,_0x28d9c5)=>{const {commentThreadId:_0x3fe169,documentId:_0x23fd4f,context:_0x4c92d1,attributes:_0x172ba1,resolvedAt:_0x3708f9,resolvedBy:_0x1fec12,comments:_0x21986c}=_0x28d9c5;_0x4de6a0['getCommentThread'](_0x3fe169)||_0x4de6a0['addCommentThread']({'threadId':_0x3fe169,'channelId':_0x23fd4f,'comments':_0x21986c?_0x21986c['map'](_):[],'context':_0x4c92d1,'attributes':_0x172ba1,'resolvedAt':_0x3708f9,'resolvedBy':_0x1fec12,'isFromAdapter':!0x0});}),this['listenTo'](_0x3db26d,'commentThreadUpdated',(_0x3e7265,{commentThreadId:_0x147e31,documentId:_0x3abccc,context:_0x381a2f,unlinkedAt:_0x2d1da8,attributes:_0x2c5779})=>{_0x4de6a0['getCommentThread'](_0x147e31)&&_0x4de6a0['updateCommentThread']({'threadId':_0x147e31,'channelId':_0x3abccc,'context':_0x381a2f,'unlinkedAt':_0x2d1da8,'attributes':_0x2c5779,'isFromAdapter':!0x0});}),this['listenTo'](_0x3db26d,'commentThreadResolved',(_0x439b0e,{commentThreadId:_0x4a6490,resolvedBy:_0x57aec4,resolvedAt:_0x1da3d9})=>{const _0x41194e=_0x4de6a0['getCommentThread'](_0x4a6490);_0x41194e&&_0x41194e['resolve']({'resolvedBy':_0x57aec4,'resolvedAt':_0x1da3d9,'isFromAdapter':!0x0});}),this['listenTo'](_0x3db26d,'commentThreadReopened',(_0x34f239,{commentThreadId:_0x54cd41})=>{const _0xf7dad2=_0x4de6a0['getCommentThread'](_0x54cd41);_0xf7dad2&&_0xf7dad2['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0x3db26d,'commentThreadRemoved',(_0x53dc0f,{commentThreadId:_0x2d6507})=>{const _0xa860ba=_0x4de6a0['getCommentThread'](_0x2d6507);_0xa860ba&&_0xa860ba['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0x3db26d,'commentAdded',(_0x24892b,_0x24a0b7)=>{const _0x224b9a=_0x24a0b7['commentThreadId'],_0x53eb15=_0x4de6a0['getCommentThread'](_0x224b9a);_0x53eb15&&_0x53eb15['addComment']({..._(_0x24a0b7),'isFromAdapter':!0x0});}),this['listenTo'](_0x3db26d,'commentUpdated',(_0x22c5e6,{commentThreadId:_0x33e5ae,commentId:_0x5a3c4d,content:_0x560019,attributes:_0x58860f})=>{const _0x3200d6=_0x4de6a0['getCommentThread'](_0x33e5ae);if(_0x3200d6){const _0x51e778=_0x3200d6['getComment'](_0x5a3c4d);_0x51e778&&_0x51e778['update']({'content':_0x560019,'attributes':_0x58860f,'isFromAdapter':!0x0});}}),this['listenTo'](_0x3db26d,'commentRemoved',(_0x909a51,{commentThreadId:_0x671ef2,commentId:_0x47fb7f})=>{const _0x158812=_0x4de6a0['getCommentThread'](_0x671ef2);if(_0x158812){const _0x1da6d7=_0x158812['getComment'](_0x47fb7f);_0x1da6d7&&_0x1da6d7['remove']({'isFromAdapter':!0x0});}}),await this['_connectService'](_0x13fb49);}['destroy'](){if(this['context']instanceof _0x477adb){const _0x341cec=this['context']['config']['get']('collaboration.channelId');this['_terminateService'](_0x341cec);}}['_terminateService'](_0x5748f9){if(!this['_services']['has'](_0x5748f9))throw new _0x33aefe('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0x5748f9});this['_getService'](_0x5748f9)['disconnect'](),this['_services']['delete'](_0x5748f9);}async['reconnect'](){for(const _0x2968bd of this['_services']['keys']())await this['_connectService'](_0x2968bd);if(this['context']instanceof _0x477adb){const _0xe3344c=this['context']['config']['get']('collaboration.channelId'),_0x31671b=this['context']['plugins']['get'](i);_0x31671b['unregister'](_0xe3344c);const _0x496d38=await this['_services']['get'](_0xe3344c)['getConnectedSessions']();_0x31671b['register'](_0xe3344c,_0x496d38);}}async['_connectService'](_0x4815ed){const {connection:_0x376892}=this['context']['plugins']['get'](c),_0x50cd1f=this['context']['plugins']['get']('CommentsRepository'),_0x2124b9=this['_services']['get'](_0x4815ed),_0x280a81=await _0x2124b9['connect'](_0x376892);await this['_fetchMissingUsersForThreads'](_0x280a81);const _0x2680c7=new Set(Array['from'](_0x50cd1f['getCommentThreads']({'channelId':_0x4815ed}),_0x10d8c1=>_0x10d8c1['id']));for(const _0x33c581 of _0x280a81)_0x33c581['deletedAt']||_0x2680c7['delete'](_0x33c581['commentThreadId']);for(const _0x1f05ed of _0x2680c7)_0x50cd1f['getCommentThread'](_0x1f05ed)['remove']({'isFromAdapter':!0x0});for(const _0x48fd07 of _0x280a81){let _0x5342f3=_0x50cd1f['getCommentThread'](_0x48fd07['commentThreadId']);const {commentThreadId:_0x37449d,context:_0x1cfc76,attributes:_0x4c4d45,resolvedBy:_0x2bcd04,resolvedAt:_0x5701bd,unlinkedAt:_0x2df50e,deletedAt:_0x2fbf84}=_0x48fd07;if(_0x2fbf84)continue;_0x5342f3||(_0x5342f3=_0x50cd1f['addCommentThread']({'channelId':_0x4815ed,'threadId':_0x37449d,'context':_0x1cfc76,'attributes':_0x4c4d45||{},'resolvedBy':_0x2bcd04,'resolvedAt':_0x5701bd,'unlinkedAt':_0x2df50e,'isFromAdapter':!0x0}));const _0x2b3d70=new Set(Array['from'](_0x5342f3['comments'],_0x300ce4=>_0x300ce4['id']));for(const _0x5bd3c9 of _0x48fd07['comments'])_0x2b3d70['delete'](_0x5bd3c9['commentId']);for(const _0x1ca154 of _0x2b3d70)_0x5342f3['getComment'](_0x1ca154)['remove']({'isFromAdapter':!0x0});for(const _0x17e041 of _0x48fd07['comments']){const _0x2e02ba=_0x5342f3['getComment'](_0x17e041['commentId']);_0x2e02ba?_0x2e02ba['content']!==_0x17e041['content']&&_0x2e02ba['update']({'content':_0x17e041['content'],'isFromAdapter':!0x0}):_0x5342f3['addComment'](Object['assign'](_(_0x17e041),{'isFromAdapter':!0x0}));}}}['_getService'](_0x4eab2f){if(!this['_services']['has'](_0x4eab2f))throw new _0x33aefe('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0x4eab2f});return this['_services']['get'](_0x4eab2f);}async['_fetchMissingUsersForThreads'](_0x44fae9){const _0x3f5e34=this['context']['plugins']['get'](_0x4b25d7),{connection:_0x583641}=this['context']['plugins']['get'](c),_0x372030=new Set();for(const {resolvedBy:_0x2a0313,comments:_0x477c36}of _0x44fae9){_0x2a0313&&!_0x3f5e34['getUser'](_0x2a0313)&&_0x372030['add'](_0x2a0313);for(const {userId:_0x22ddd5}of _0x477c36)_0x3f5e34['getUser'](_0x22ddd5)||_0x372030['add'](_0x22ddd5);}if(0x0===_0x372030['size'])return;const _0x525628=await dt['getMany'](_0x583641,Array['from'](_0x372030));for(const _0x3f0498 of _0x525628)_0x3f5e34['getUser'](_0x3f0498['id'])||_0x3f5e34['addUser'](_0x3f0498);}}async function S(_0x3ad7cf){if('404'!==_0x3ad7cf['code'])throw _0x3ad7cf;}function ut(_0x356c0f){if((_0x1b7b62=_0x356c0f)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0x1b7b62['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x1b7b62['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0x1b7b62;throw _0x356c0f;}function _(_0x3db2e3){return{'threadId':_0x3db2e3['commentThreadId'],'commentId':_0x3db2e3['commentId'],'content':_0x3db2e3['content'],'createdAt':_0x3db2e3['createdAt'],'authorId':_0x3db2e3['userId'],'attributes':_0x3db2e3['attributes']||{}};}class f extends _0x20916b{static ['TrackChangesService']=/* #__PURE__ -- @preserve */
|
|
27
|
+
((()=>et)());['_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(_0x49ed2f){super(_0x49ed2f);const _0x48087c=this['editor']['config']['get']('collaboration.channelId');this['_bufferedRequests']=new Map(),this['_trackChangesService']=new f['TrackChangesService'](_0x48087c);}['init'](){const _0x30328b=this['editor']['plugins']['get'](c),_0x58752c=this['editor']['plugins']['get']('TrackChangesEditing');return _0x58752c['adapter']={'getSuggestion':async _0x28df5a=>{await this['_waitForServiceReady']();const _0x2f4205=await this['_trackChangesService']['get'](_0x28df5a)['catch'](R);return await this['_fetchMissingUsersForThreads']([_0x2f4205]),_0x2f4205;},'addSuggestion':async({id:_0x365e0b,type:_0x543bdb,data:_0x5025d5,originalSuggestionId:_0x1858cd,attributes:_0x545443})=>{await this['_waitForServiceReady']();const _0x451232={'id':_0x365e0b,'type':_0x543bdb,'data':_0x5025d5,'originalSuggestionId':_0x1858cd,'attributes':_0x545443},_0x2f2ab3=await this['_trackChangesService']['add'](_0x365e0b,_0x543bdb,_0x5025d5,_0x1858cd,_0x545443)['catch'](_0x35ecf2=>{if(ft(_0x35ecf2))return new Promise(_0x3a857a=>{this['_bufferedRequests']['set'](_0x365e0b,{'resolve':_0x3a857a,'suggestionData':_0x451232});});throw _0x35ecf2;});return this['_bufferedRequests']['delete'](_0x365e0b),_0x2f2ab3;},'updateSuggestion':async(_0x4931d5,_0x342778)=>{if(await this['_waitForServiceReady'](),'open'!==_0x342778['state'])return this['_trackChangesService']['update'](_0x4931d5,_0x342778)['catch'](R);}},this['listenTo'](this['_trackChangesService'],'suggestionUpdated',(_0x1bac4c,_0x253ee2)=>{_0x58752c['hasSuggestion'](_0x253ee2['id'])&&(_0x58752c['getSuggestion'](_0x253ee2['id'])['attributes']=_0x253ee2['attributes']);}),this['_trackChangesService']['connect'](_0x30328b['connection'])['then'](_0x1d4647=>(_0x30328b['addToReconnectionStack'](this),this['_fetchMissingUsersForThreads'](_0x1d4647)['then'](()=>{for(const _0x4e6ea6 of _0x1d4647){_0x58752c['addSuggestionData'](_0x4e6ea6)['_saved']=!0x0;}})));}async['reconnect'](){const _0x282109=this['editor']['plugins']['get']('TrackChangesEditing'),{connection:_0x157851}=this['editor']['plugins']['get'](c),_0x2ab271=await this['_trackChangesService']['connect'](_0x157851);await this['_fetchMissingUsersForThreads'](_0x2ab271);for(const {suggestionData:_0x1d599d,resolve:_0x2fe761}of this['_bufferedRequests']['values']()){let _0xbc3d7c=_0x2ab271['find'](_0x28c150=>_0x28c150['id']===_0x1d599d['id']);_0xbc3d7c||(_0xbc3d7c=await this['_trackChangesService']['add'](_0x1d599d['id'],_0x1d599d['type'],_0x1d599d['data'],_0x1d599d['originalSuggestionId'])),_0x2fe761(_0xbc3d7c);}for(const _0x1ebac8 of _0x2ab271)_0x282109['hasSuggestion'](_0x1ebac8['id'])||_0x282109['addSuggestionData'](_0x1ebac8);}async['_waitForServiceReady'](){this['_trackChangesService']['isConnected']||await new Promise(_0x2f3d26=>{this['listenTo'](this['_trackChangesService'],'connected',_0x54e617=>{_0x54e617['off'](),_0x2f3d26();});});}async['_fetchMissingUsersForThreads'](_0x271067){const _0x5b9ee9=this['editor']['plugins']['get'](_0x4b25d7),{connection:_0x91828e}=this['editor']['plugins']['get'](c),_0xef6834=new Set();for(const {authorId:_0x4679af}of _0x271067)_0x5b9ee9['getUser'](_0x4679af)||_0xef6834['add'](_0x4679af);if(0x0===_0xef6834['size'])return;const _0x2db269=await dt['getMany'](_0x91828e,Array['from'](_0xef6834));for(const _0x58b192 of _0x2db269)_0x5b9ee9['getUser'](_0x58b192['id'])||_0x5b9ee9['addUser'](_0x58b192);}}function R(_0x50618b){if(ft(_0x50618b))return new Promise(()=>{});throw _0x50618b;}function ft(_0x1e2d42){return _0x1e2d42['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x1e2d42['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class m extends _0x20916b{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 _0x18bdb8=this['editor']['plugins']['get'](c),_0x30658c=this['editor']['plugins']['get']('CommentsEditing'),_0x5e2db1=this['editor']['plugins']['get'](a);return this['editor']['data']['once']('ready',()=>{this['listenTo'](_0x18bdb8,'change:state',(_0x1ba7a4,_0x124510,_0x219c23)=>{_0x30658c['isThreadsLoadingPaused']='connected'!==_0x219c23;});}),this['listenTo'](_0x18bdb8,'change:state',(_0x40b12a,_0x68b17d,_0x226fe9)=>{this['editor']['plugins']['get']('CommentsRepository')['switchReadOnly']('connected'!==_0x226fe9);}),_0x5e2db1['_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 _0x20916b{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 _0x20916b{static ['RevisionHistoryService']=/* #__PURE__ -- @preserve */
|
|
28
|
+
((()=>it)());['_lastRequestId'];['_revisionTracker'];['_revisionHistoryService'];['_oldOffset'];static get['requires'](){return[c,l,'RevisionHistory',i,_0x4b25d7];}static get['pluginName'](){return'CloudServicesRevisionHistoryAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x321ba9){super(_0x321ba9);const _0x4a6660=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new u['RevisionHistoryService'](_0x4a6660);}async['init'](){const _0x2d51a9=this['editor']['plugins']['get'](l),_0x36b6b5=_0x2d51a9['serverHistory'],_0xd73f4e=this['editor']['plugins']['get'](c);this['_revisionTracker']['setSource']({'history':_0x36b6b5,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0x2d51a9['sessionId']});const _0x3143ae=this['editor']['config']['get']('cloudServices.bundleVersion')||nt,_0x34885b=await tt['isBundleUploaded'](_0xd73f4e['connection'],_0x3143ae);this['editor']['plugins']['get']('RevisionHistory')['adapter']={'getRevision':async({revisionId:_0x128215})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0x128215)),'updateRevisions':async _0x4d6342=>{await this['_waitForServiceReady']();const _0x3fcfc6=this['_revisionTracker']['currentRevision'];if(_0x34885b&&0x1===_0x4d6342['length']&&_0x4d6342[0x0]['id']===_0x3fcfc6['id'])return _0x4d6342;for(const _0xedb828 of _0x4d6342)_0xedb828['id']===_0x3fcfc6['id']&&(_0xedb828['isEmptyCurrent']=_0xedb828['fromVersion']===_0xedb828['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0x4d6342,this['_lastRequestId'])['then'](_0xab5ee9=>(this['_lastRequestId']=_0xab5ee9,_0x4d6342))['catch'](_0x253b7e=>{if(st(_0x253b7e)||'400'===_0x253b7e['code']&&void 0x0!==_0x253b7e['data']['wrongRequestId']){for(const _0x3a1639 of _0x4d6342){!this['_revisionTracker']['repository']['getRevision'](_0x3a1639['id'])||this['_revisionTracker']['_bufferUpdate'](_0x3a1639['id'],_0x3a1639,!0x1);}if(st(_0x253b7e))throw _0x253b7e;return _0x4d6342;}throw _0x253b7e;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0x16225d,{revisionsData:_0x2253f2,requestId:_0x3ad627})=>{Math['max'](..._0x2253f2['map'](_0x2920fd=>_0x2920fd['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0x2253f2,_0x3ad627);}):this['_handleRevisionsUpdate'](_0x2253f2,_0x3ad627);});const {revisions:_0x1c95d1,requestId:_0x4d01c1}=await this['_revisionHistoryService']['connect'](_0xd73f4e['connection']);_0xd73f4e['addToReconnectionStack'](this),this['_lastRequestId']=_0x4d01c1,await this['_fetchMissingUsers'](_0x1c95d1);for(const _0x157410 of _0x1c95d1)this['_revisionTracker']['addRevisionData'](_0x157410);this['listenTo'](_0x2d51a9,'change:_isConnected',(_0x4c3cb8,_0x2eadbd,_0x191612)=>{_0x191612&&(this['_oldOffset']=_0x2d51a9['_offset'],_0x4c3cb8['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](_0xd73f4e,'state',_0x13b4bc=>_0x13b4bc===_0x14ebd0['CONNECTED']);}async['reconnect'](){const _0x30f828=this['editor']['plugins']['get'](c),_0x319fb4=this['editor']['plugins']['get'](l),_0x5d783f=async()=>{const _0x1385c5=this['_revisionTracker']['currentRevision'],_0x34d23e=_0x1385c5['id'],_0x5223b7=_0x34d23e!==_0x319fb4['sessionId'];if(_0x5223b7){const _0x18d129=_0x319fb4['_offset']-this['_oldOffset'],_0xa2566=this['_getLatestVersionFromServerOperations']();this['_revisionTracker']['_revisionDataBuilder']['reInit']();if(_0x1385c5['toVersion']+_0x18d129!==_0xa2566){const _0x229341=_0x1385c5['fromVersion']+_0x18d129,_0xbf9e1f=this['editor']['plugins']['get'](_0x4b25d7),_0x31466d=this['_revisionTracker']['buildRevisionData']({'revision':_0x1385c5,'from':_0x229341,'to':_0xa2566});_0x31466d['id']=_0x1385c5['id'];const _0x3dc57b=_0x31466d['authorsIds']['map'](_0x29a5f4=>_0xbf9e1f['getUser'](_0x29a5f4));_0x1385c5['_update']({..._0x31466d,'authors':_0x3dc57b},!0x0),this['_revisionTracker']['_bufferUpdate'](_0x1385c5['id'],_0x31466d,!0x0);}this['_revisionTracker']['_startingVersion']=_0xa2566,(_0x1385c5['toVersion']===_0x1385c5['fromVersion']&&!this['_revisionTracker']['_bufferedUpdates']['has'](_0x34d23e)&&this['_revisionTracker']['repository']['_revisions']['remove'](_0x34d23e),this['_revisionTracker']['_createCurrentRevision'](_0xa2566));}const {revisions:_0x179da1,requestId:_0x40d1b0}=await this['_revisionHistoryService']['reconnect'](_0x30f828['connection'],this['_lastRequestId']);_0x5223b7&&_0x179da1['length']>0x0?_0x319fb4['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x179da1),this['_handleRevisionsUpdate'](_0x179da1,_0x40d1b0),this['_revisionTracker']['sendBufferedUpdates']());};return _0x319fb4['_isConnected']?_0x5d783f():new Promise((_0x149778,_0x5c4a90)=>{_0x319fb4['once']('change:_isConnected',()=>{_0x5d783f()['then'](_0x149778)['catch'](_0x5c4a90);});});}['destroy'](){super['destroy']();}async['_waitForServiceReady'](){this['_revisionHistoryService']['isConnected']||await new Promise(_0x388e51=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x5dba49=>{_0x5dba49['off'](),_0x388e51();});});}['_getLatestVersionFromServerOperations'](){const _0x25c745=this['editor']['plugins']['get'](l)['serverHistory']['getOperations']()['reverse']();for(const _0x3d6ba4 of _0x25c745)if('marker'!==_0x3d6ba4['type']||_0x3d6ba4['affectsData'])return _0x3d6ba4['baseVersion']+0x1;}['_getLatestVersion'](){const _0x472868=this['editor']['plugins']['get'](l);return new Promise(_0x3b272b=>{_0x472868['_isPendingUpdate']?_0x472868['once']('change:_isPendingUpdate',()=>{_0x3b272b(this['_getLatestVersionFromServerOperations']());}):_0x3b272b(this['_getLatestVersionFromServerOperations']());});}['_handleRevisionsUpdate'](_0x505ed4,_0x405cb5){const _0x2747c3=this['_revisionTracker']['repository'];this['_lastRequestId']=_0x405cb5;for(const _0x5b2f39 of _0x505ed4){const _0xc4913e=_0x2747c3['getRevision'](_0x5b2f39['id']);if(_0xc4913e){if((_0x5b2f39['fromVersion']||_0x5b2f39['toVersion'])&&(_0x5b2f39['diffData']=null),_0xc4913e===this['_revisionTracker']['currentRevision']){const _0x18881f=Math['max'](_0xc4913e['toVersion'],_0x5b2f39['toVersion']),_0x33a22c=Math['max'](_0xc4913e['fromVersion'],_0x5b2f39['fromVersion']);let _0x54c684;_0xc4913e['toVersion']===_0x5b2f39['toVersion']&&_0xc4913e['fromVersion']===_0x5b2f39['fromVersion']?(_0x54c684=!0x0,this['_preventResendingRevisionData'](_0x5b2f39)):_0x5b2f39['toVersion']===_0x18881f&&_0x5b2f39['fromVersion']===_0x33a22c?_0x54c684=!0x1:(_0xc4913e['toVersion']===_0x18881f&&_0xc4913e['fromVersion']===_0x33a22c||this['_fixRevision']({'revision':_0xc4913e,'from':_0x33a22c,'to':_0x18881f}),_0x54c684=!0x0),_0x54c684&&(delete _0x5b2f39['fromVersion'],delete _0x5b2f39['toVersion'],delete _0x5b2f39['diffData'],delete _0x5b2f39['createdAt'],delete _0x5b2f39['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0x5b2f39),this['_preventResendingRevisionData'](_0x5b2f39);}else this['_revisionTracker']['addRevisionData'](_0x5b2f39);}const _0x47f4f2=_0x2747c3['getRevisions']();_0x47f4f2['reverse']();for(let _0x4de859=0x0;_0x4de859<_0x47f4f2['length']-0x1;_0x4de859++){const _0x453b7e=_0x47f4f2[_0x4de859],_0x555b4c=_0x47f4f2[_0x4de859+0x1];if(_0x453b7e['fromVersion']<_0x555b4c['toVersion']){const _0x5ec466=_0x555b4c['toVersion'],_0x447a8b=Math['max'](_0x5ec466,_0x453b7e['toVersion']);this['_fixRevision']({'revision':_0x453b7e,'from':_0x5ec466,'to':_0x447a8b});}}}['_fixRevision']({revision:_0x5e35d6,from:_0x465bc6,to:_0x447e6c}={}){const _0x5b7894=this['editor']['plugins']['get'](_0x4b25d7),_0x48af08=this['_revisionTracker']['buildRevisionData']({'revision':_0x5e35d6,'from':_0x465bc6,'to':_0x447e6c});_0x48af08['authors']=_0x48af08['authorsIds']['map'](_0x2c28af=>_0x5b7894['getUser'](_0x2c28af)),_0x5e35d6['_update'](_0x48af08);}['_preventResendingRevisionData'](_0x526b2c){const _0x23228a={};_0x23228a['id']=_0x526b2c['id'];for(const _0x210469 of Object['keys'](_0x526b2c))'id'!==_0x210469&&(_0x23228a[_0x210469]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0x23228a['id'],_0x23228a,!0x0);}async['_fetchMissingUsers'](_0x3e1f67){const _0x55d176=this['editor']['plugins']['get'](_0x4b25d7),{connection:_0x1600ff}=this['editor']['plugins']['get'](c),_0x3c93ca=new Set();for(const _0x37b5ad of _0x3e1f67){for(const _0x2616b0 of _0x37b5ad['authorsIds'])_0xd3f9d9(_0x2616b0);_0x37b5ad['creatorId']&&_0xd3f9d9(_0x37b5ad['creatorId']);}if(0x0===_0x3c93ca['size'])return;const _0x5d4ede=await dt['getMany'](_0x1600ff,Array['from'](_0x3c93ca));for(const _0x5177df of _0x5d4ede)_0x55d176['getUser'](_0x5177df['id'])||_0x55d176['addUser'](_0x5177df);function _0xd3f9d9(_0x336257){_0x55d176['getUser'](_0x336257)||_0x3c93ca['add'](_0x336257);}}}function st(_0x14873b){return _0x14873b['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0x14873b['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x14873b['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class g extends _0x20916b{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 _0x5f4aca{['_collapseAt'];constructor(_0x5b1f3d,_0x2cfa09=0x6){super(_0x5b1f3d);const _0x199b39=this['bindTemplate'];this['set']('isHidden',!0x0),this['set']('usersCount',0x0),this['_collapseAt']=_0x2cfa09,this['bind']('isHidden')['to'](this,'usersCount',_0x34c9da=>_0x34c9da<_0x2cfa09),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item',_0x199b39['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':_0x199b39['to']('usersCount',_0x544b19=>'+'+(_0x544b19-this['_collapseAt']+0x2)['toString']())}]}]}]});}}class ts extends _0x5f4aca{['items'];['keystrokes'];constructor(_0x15e45d){super(_0x15e45d);const _0x1d9181=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0x31ddfb(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0x1d9181['if']('hasPopup'),'aria-expanded':_0x1d9181['to']('isExpanded',_0x4fc9a1=>this['hasPopup']&&String(_0x4fc9a1)),'aria-label':_0x1d9181['to']('hasPopup',_0x4fbceb=>G(_0x15e45d,_0x4fbceb?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0x1d9181['to']('hasPopup',_0x29b8f4=>!!_0x29b8f4&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items'],'on':{'mouseenter':_0x1d9181['to'](()=>this['fire']('presencelist:show')),'mouseleave':_0x1d9181['to'](_0x5c807f=>{const _0x27c87e=_0x5c807f,_0x1dc61d=document['querySelector']('.ck-presence-list__dropdown-list'),_0x296d89=document['querySelector']('.ck-balloon-panel_with-arrow');_0x1dc61d?.['contains'](_0x27c87e['relatedTarget'])||_0x296d89?.['contains'](_0x27c87e['relatedTarget'])||this['fire']('presencelist:hide');})}}),this['on']('change:hasPopup',(_0x252039,_0x470f93,_0x36baa1)=>{this['element']&&(_0x36baa1?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 _0x5f4aca{['counterView'];['inlineListView'];constructor(_0x2e8f0c,_0x2bb256=0x6){super(_0x2e8f0c);const _0x48d618=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new A(this['locale'],_0x2bb256),this['inlineListView']=new ts(_0x2e8f0c),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x4d17ef of this['inlineListView']['items'])_0x4d17ef['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',_0x48d618['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['inlineListView']]});}}class x extends _0x5f4aca{['listWrapperView'];constructor(_0x38b53d,_0x53d945){super(_0x38b53d);const _0x41d7c3=this['bindTemplate'];this['listWrapperView']=new mt(_0x38b53d,_0x53d945),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':G(_0x38b53d,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']],'on':{'mouseleave':_0x41d7c3['to'](_0x220b53=>{const _0x4254a3=_0x220b53,_0x26cc76=document['querySelector']('.ck-presence-list__list'),_0xa1577d=document['querySelector']('.ck-balloon-panel_with-arrow');_0x26cc76?.['contains'](_0x4254a3['relatedTarget'])||_0xa1577d?.['contains'](_0x4254a3['relatedTarget'])||this['fire']('presencelist:hide');})}});}}class mt extends _0x48119e{constructor(_0x2fd969,_0x18bdee){super(_0x2fd969);const _0x33cc5a=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0x18bdee?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0x33cc5a['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0x33cc5a['to']('role'),'aria-label':_0x33cc5a['to']('ariaLabel'),'aria-labelledby':_0x33cc5a['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0x9f47bb['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0x1ba90c=this['element'];_0x1ba90c&&(this['_isScrollable']=Math['max'](_0x1ba90c['scrollHeight'],_0x1ba90c['clientHeight'])>0.8*window['innerHeight']);}}class k extends rt{['userView'];constructor(_0x3fc4e9,_0xf9cef8,_0xf60f33){super(_0x3fc4e9);const _0x2cdd74=this['bindTemplate'];this['userView']=new ct(_0x3fc4e9,_0xf9cef8);const _0x53983d={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0xf9cef8['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0xf9cef8['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0xf9cef8['color']['getBackgroundColorClass']()],'aria-hidden':'true'}}]};_0xf60f33&&(_0x53983d['tag']='button',_0x53983d['on']={'click':_0x2cdd74['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x53983d);}['focus'](){this['element']['focus']();}}class y extends _0x5f4aca{['userView'];['markerView'];constructor(_0x55a217,_0x1c493f,_0xe3e4a2){super(_0x55a217);const _0x3b2cee=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new ct(_0x55a217,_0x1c493f),this['markerView']=new at(_0x55a217,_0x1c493f);const _0x2284ad=new ot(_0x55a217);_0x2284ad['template']['tag']='span',_0x2284ad['text']=_0x1c493f['name'];const _0x2c9c22={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0x3b2cee['to']('isFocusable',_0x4025f2=>!!_0x4025f2&&0x0),'aria-labelledby':_0x2284ad['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0x3b2cee['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0x3b2cee['to']('hasTooltip',_0x3e34a7=>!_0x3e34a7),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0x2284ad]};_0xe3e4a2&&(_0x2c9c22['tag']='button',_0x2c9c22['on']={'click':_0x3b2cee['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x2c9c22);}}class at extends _0x5f4aca{constructor(_0x36aa7a,_0x21f203){super(_0x36aa7a),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x21f203['color']['getBackgroundColorClass']()],'aria-hidden':'true'}});}}const C={'collapseAt':0x6,'displayMe':!0x0};class r extends _0x1e9e2c{['currentDisplayedUsers'];['balloonPanelView'];['view'];['presenceDropdownView'];['_bodyCollection']=null;static get['pluginName'](){return'PresenceListUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x1987fb){super(_0x1987fb),this['context']['config']['define']('presenceList',C);const _0x333372=_0x1987fb['config']['get']('presenceList.collapseAt');if('number'!=typeof _0x333372)throw new _0x33aefe('presencelist-collapseat-invalid-format',this);if(_0x333372<0x1)throw new _0x33aefe('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](i)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0x45ec41(),this['balloonPanelView']=new _0x181e94(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get['requires'](){return[i];}['init'](){for(const _0x5ae2ec of this['_allConnectedUsers'])this['_handleUserAdd'](_0x5ae2ec);this['listenTo'](this['_allConnectedUsers'],'add',(_0x296be4,_0xda2d3d)=>{this['_handleUserAdd'](_0xda2d3d);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0x331aa7,_0x478275)=>{this['_handleUserRemove'](_0x478275);});}['_createView'](){const _0x2eca6c=this['context'],_0x35f843=new j(this['context']['locale'],this['context']['config']['get']('presenceList.collapseAt')),_0x237433=this['balloonPanelView'];if(!_0xf9bf6f(_0x2eca6c['config']['get']('presenceList.container')))throw new _0x33aefe('presencelist-missing-container',this);return _0x35f843['counterView']['bind']('usersCount')['to'](this),_0x35f843['bind']('isCollapsed')['to'](this,'usersCount',_0x1b86ed=>{const {collapseAt:_0xc7b035}=_0x2eca6c['config']['get']('presenceList'),_0x2fafbc=_0x1b86ed>=_0xc7b035;if(_0x2fafbc&&!_0x35f843['inlineListView']['items']['find'](_0x1c78fd=>_0x1c78fd instanceof A)){const _0x1f5ef3=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['currentDisplayedUsers']['length']==_0x1f5ef3&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](this['currentDisplayedUsers']['length']-0x1),_0x35f843['inlineListView']['items']['add'](_0x35f843['counterView']);}return _0x2fafbc||this['hideDropdown'](),_0x2fafbc;}),_0x35f843['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0x14fa08=>{const _0x2ca02d=_0x2eca6c['config']['get']('presenceList'),_0x5580d6=new y(_0x2eca6c['locale'],_0x14fa08,!!_0x2ca02d['onClick']);return _0x5580d6['bind']('hasTooltip')['to'](_0x35f843,'isCollapsed',_0x41d90f=>!_0x41d90f),_0x5580d6['bind']('isFocusable')['to'](_0x35f843,'isCollapsed',_0x419319=>!_0x419319),_0x2ca02d['onClick']&&this['listenTo'](_0x5580d6,'execute',()=>{this['view']['isCollapsed']||_0x2ca02d['onClick'](_0x14fa08,_0x5580d6['element']);}),_0x5580d6;}),this['listenTo'](_0x35f843['inlineListView'],'presencelist:show',()=>{this['view']['isCollapsed']&&this['showDropdown']();}),this['listenTo'](_0x35f843['inlineListView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();}),_0x35f843['inlineListView']['keystrokes']['set']('Enter',(_0x53fe09,_0x4aeb9c)=>{this['view']['isCollapsed']&&(this['showDropdown'](),_0x4aeb9c());}),_0x35f843['render'](),_0x237433['render'](),_0x322879({'emitter':_0x35f843,'activator':()=>_0x237433['isVisible'],'contextElements':[_0x237433['element'],_0x35f843['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0x2eca6c['config']['get']('presenceList.container')['appendChild'](_0x35f843['element']),this['_bodyCollection']=new _0x188f88(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_bodyCollection']['add'](this['balloonPanelView']),_0x35f843;}['_handleUserAdd'](_0x60575c){if(!this['context']['config']['get']('presenceList.displayMe')&&_0x60575c['isMe'])return;const _0x2b7cda=this['context']['config']['get']('presenceList.collapseAt')-0x1;for(this['usersCount']++;this['currentDisplayedUsers']['length']>=_0x2b7cda-(this['view']['isCollapsed']?0x1:0x0)&&this['currentDisplayedUsers']['length']>0x1;)this['currentDisplayedUsers']['remove'](0x1);const _0xffc457=_0x60575c['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0x60575c,_0xffc457);}['_handleUserRemove'](_0x422528){this['usersCount']--;const {collapseAt:_0x375e21}=this['context']['config']['get']('presenceList'),_0x442be5=this['usersCount']>=_0x375e21;if(this['currentDisplayedUsers']['get'](_0x422528['id']))this['currentDisplayedUsers']['remove'](_0x422528['id']);else{if(_0x442be5&&this['currentDisplayedUsers']['length']+0x1===_0x375e21-0x1)return;}if(this['currentDisplayedUsers']['length']+(_0x442be5?0x1:0x0)<this['usersCount']){for(const _0x30ef12 of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0x30ef12['id'])&&(this['currentDisplayedUsers']['add'](_0x30ef12,Math['min'](this['currentDisplayedUsers']['length']-(_0x442be5?0x1:0x0),0x1)),this['currentDisplayedUsers']['length']+(_0x442be5?0x1:0x0)===_0x375e21-0x1))return;}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0x5b71cc=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new x(this['context']['locale'],!!_0x5b71cc['onClick']),this['view']['inlineListView']['isExpanded']=!0x0,this['listenTo'](this['presenceDropdownView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();});const {listWrapperView:_0x3a150f}=this['presenceDropdownView'];_0x3a150f['items']['bindTo'](this['_allConnectedUsers'])['using'](_0x56bba4=>{if(!_0x5b71cc['displayMe']&&_0x56bba4['isMe'])return null;const _0x2310d8=new k(this['context']['locale'],_0x56bba4,!!_0x5b71cc['onClick']);return _0x5b71cc['onClick']&&this['listenTo'](_0x2310d8,'execute',()=>{_0x5b71cc['onClick'](_0x56bba4,_0x2310d8['element']);}),_0x2310d8;}),this['balloonPanelView']['content']['add'](this['presenceDropdownView']),this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element']}),_0x3a150f['focus'](),_0x3a150f['checkIfScrollable']();const _0x454801=(_0x49447f,_0x3491ee)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0x3491ee();};_0x3a150f['keystrokes']['set']('Esc',_0x454801),_0x3a150f['keystrokes']['set']('Shift+Tab',_0x454801),_0x3a150f['keystrokes']['set']('Tab',(_0x3df900,_0x3f375b)=>{!function(_0xf16bde){const _0x1d9f60=['a','button','input','select','textarea','[tabindex]','[contenteditable]']['map'](_0x48a602=>_0x48a602+':not([disabled]):not([tabindex=\x22-1\x22])')['join'](','),_0x54d52e=[...document['body']['querySelectorAll'](_0x1d9f60)]['filter'](_0x43d437=>_0x43d437===document['activeElement']||_0x43d437['offsetWidth']+_0x43d437['offsetHeight']>0x0)['sort']((_0x205bdc,_0x381584)=>(_0x205bdc['tabIndex']||0x0)-(_0x381584['tabIndex']||0x0)),_0x34c409=_0x54d52e['indexOf'](_0xf16bde),_0x2ca6dd=_0x54d52e[(_0x34c409+0x1)%_0x54d52e['length']];_0x2ca6dd&&_0x2ca6dd['focus']();}(this['view']['element']),this['hideDropdown'](),_0x3f375b();}),_0x3a150f['focusTracker']['add'](this['view']['element']),_0x3a150f['focusTracker']['on']('change:isFocused',(_0x5721aa,_0x226918,_0x49db35)=>{_0x49db35||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 _0x1e9e2c{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};
|