@ckeditor/ckeditor5-real-time-collaboration 47.5.0-alpha.8 → 47.5.0
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/presencelistui.js +1 -1
- package/src/presencelist/view/presencedropdownlistitemview.js +1 -1
- package/src/presencelist/view/presencedropdownlistview.js +1 -1
- package/src/presencelist/view/presenceinlinelistitemview.js +1 -1
- package/src/presencelist/view/presenceinlinelistview.js +1 -1
- package/src/presencelist/view/presencelistview.js +1 -1
- package/src/realtimecollaborativecomments/cloudservicescommentsadapter.js +2 -2
- package/src/realtimecollaborativeediting/realtimecollaborationclient.js +2 -2
- package/src/realtimecollaborativeediting/sessions.js +1 -1
- package/src/realtimecollaborativeediting/usermarkers.js +1 -1
- package/src/realtimecollaborativeediting/websocketgateway.js +2 -2
- package/src/realtimecollaborativerevisionhistory/cloudservicesrevisionhistoryadapter.js +2 -2
- package/src/realtimecollaborativetrackchanges/cloudservicestrackchangesadapter.js +2 -2
package/dist/index.js
CHANGED
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
import{ContextPlugin as
|
|
24
|
-
((()=>rt)());static ['initialReconnectionInterval']=0x3e8;['connection'];['_reconnectionStack'];['_shouldPluginsReconnect'];['_domEmitter'];static get['requires'](){return['CloudServices',_0x4e1b91];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x48782c){super(_0x48782c),this['set']('state',_0x2008f1['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=new(_0x2f47ff())();}['init'](){const _0x202d05=this['context'],_0x53ae55=_0x202d05['plugins']['get']('CloudServices'),_0x74b1b7=_0x202d05['plugins']['get'](_0x4e1b91);if(!_0x53ae55['token'])throw new _0x1cfd0a('websocketgateway-missing-token',this);if(!_0x53ae55['webSocketUrl'])throw new _0x1cfd0a('websocketgateway-missing-websocket-url',this);return this['_domEmitter']['listenTo'](window,'offline',()=>this['_isBrowserOffline']=!0x0),this['_domEmitter']['listenTo'](window,'online',()=>this['_isBrowserOffline']=!0x1),this['context']['config']['define']('cloudServices.connectionTimeout',0xa),this['context']['config']['define']('cloudServices.requestTimeout',0x14),n['WebSocketGateway']['connect'](_0x53ae55['token'],_0x53ae55['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0x398759=>{if(this['connection']=_0x398759,this['bind']('state')['to'](_0x398759,'state',this,'_isBrowserOffline',(_0x1b3094,_0x54a2ef)=>('connected'!==_0x1b3094&&(this['_shouldPluginsReconnect']=!0x0),_0x54a2ef||_0x1b3094!==_0x2008f1['CONNECTED']?_0x2008f1['DISCONNECTED']:this['state']==_0x2008f1['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),_0x2008f1['CONNECTING']):_0x2008f1['CONNECTED'])),this['connection']['on']('error',(_0x43b2ec,_0x31caf7)=>{if('limitExceeded'!==_0x31caf7['code'])throw console['error'](_0x31caf7),new _0x1cfd0a('cloudservices-init',null,{'originalError':_0x31caf7});_0x74b1b7['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'});}),!_0x398759['me'])return new Promise(_0x576305=>_0x398759['on']('change:me',_0x576305));})['catch'](_0x269f88=>{throw console['error'](_0x269f88),new _0x1cfd0a('cloudservices-init',null,{'originalError':_0x269f88});});}['addToReconnectionStack'](_0x530e4c){if('function'!=typeof _0x530e4c['reconnect'])throw new _0x1cfd0a('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0x530e4c))throw new _0x1cfd0a('websocketgateway-plugin-already-registered',this,{'name':_0x530e4c['constructor']['pluginName']});this['_reconnectionStack']['add'](_0x530e4c);}['removeFromReconnectionStack'](_0x294f30){this['_reconnectionStack']['delete'](_0x294f30);}['isInReconnectionStack'](_0x245d14){return this['_reconnectionStack']['has'](_0x245d14);}['_reconnect'](){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0x2d9882=>_0x2d9882['reconnect']())))['then'](()=>this['state']=_0x2008f1['CONNECTED'])['catch'](_0x4bb855=>{throw console['error'](_0x4bb855),new _0x1cfd0a('cloudservices-reconnection-error',this['context']);});}['disconnect'](){this['connection']&&this['connection']['disconnect'](),this['state']=_0x2008f1['DISCONNECTED'],this['_domEmitter']['stopListening']();}['destroy'](){this['disconnect'](),super['destroy']();}}class i extends _0x3fd05c{['channelSessions'];['channelConnectedUsers'];['allConnectedUsers'];['_registeredSessions'];['_uniqueUsersCount'];['_users'];static get['pluginName'](){return'Sessions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}static get['requires'](){return[n,_0x143e71];}constructor(_0x2cb75b){super(_0x2cb75b),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0xae27f4(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x143e71);}['init'](){const _0xeb4a3d=this['context']['plugins']['get'](n);this['listenTo'](_0xeb4a3d,'change:state',(_0x3e5efc,_0x498b6f,_0x176b50)=>{if('connected'!==_0x176b50)this['channelSessions']['forEach'](_0x473866=>_0x473866['clear']()),this['channelConnectedUsers']['forEach'](_0x1ac79e=>_0x1ac79e['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x5dbd83,_0x560998]of this['_registeredSessions'])for(const _0x50b512 of _0x560998)this['_handleSessionAdd'](_0x5dbd83,_0x50b512);}}),this['_createUser'](_0xeb4a3d['connection']['me'],!0x0);}['register'](_0x13ffe7,_0x22d4ab){if(this['_registeredSessions']['has'](_0x13ffe7))throw new _0x1cfd0a('sessions-register-already-registered',null,{'channelId':_0x13ffe7});this['_registeredSessions']['set'](_0x13ffe7,_0x22d4ab),this['channelSessions']['set'](_0x13ffe7,new _0xae27f4()),this['channelConnectedUsers']['set'](_0x13ffe7,new _0xae27f4()),this['listenTo'](_0x22d4ab,'add',(_0x315450,_0x535510)=>this['_handleSessionAdd'](_0x13ffe7,_0x535510)),this['listenTo'](_0x22d4ab,'remove',(_0xbae917,_0x1d72b3)=>this['_handleSessionRemove'](_0x13ffe7,_0x1d72b3));for(const _0xea744d of _0x22d4ab)this['_handleSessionAdd'](_0x13ffe7,_0xea744d);}['unregister'](_0x4a874b){if(!this['_registeredSessions']['has'](_0x4a874b))throw new _0x1cfd0a('sessions-unregister-not-exist',null,{'channelId':_0x4a874b});const _0x3224cd=this['_registeredSessions']['get'](_0x4a874b);this['stopListening'](_0x3224cd);for(const _0x5034b7 of _0x3224cd)'connected'===this['context']['plugins']['get'](n)['state']&&this['_handleSessionRemove'](_0x4a874b,_0x5034b7);this['_registeredSessions']['delete'](_0x4a874b),this['channelSessions']['delete'](_0x4a874b),this['channelConnectedUsers']['delete'](_0x4a874b);}get['mySessionId'](){return this['context']['plugins']['get'](n)['connection']['sessionId'];}['getUserBySessionId'](_0xaa5c17){for(const _0x56760c of this['channelSessions']['values']())for(const _0x43b1b2 of _0x56760c)if(_0x43b1b2['id']===_0xaa5c17)return _0x43b1b2['user'];}['getUserSessions'](_0x58f841,_0x5574d2){const _0x1f2c52=_0x5574d2?[this['channelSessions']['get'](_0x5574d2)]:this['channelSessions']['values'](),_0x3889ec=new Set();for(const _0x3c0a8f of _0x1f2c52)for(const _0x5960ee of _0x3c0a8f)_0x5960ee['user']['id']===_0x58f841['id']&&_0x3889ec['add'](_0x5960ee['id']);return _0x3889ec;}['getUserRole'](_0x119b78){for(const _0x18e72f of this['channelSessions']['values']())for(const _0x3b984e of _0x18e72f)if(_0x3b984e['user']===_0x119b78)return _0x3b984e['role'];}['_handleSessionAdd'](_0x56f4ce,_0x165a43){if('connected'!==this['context']['plugins']['get'](n)['state'])return;const _0x668049=_0x165a43['user'],_0x329f1a=this['_users']['getUser'](_0x668049['id'])||this['_createUser'](_0x668049),_0x39b4b1=Object['assign']({},_0x165a43,{'user':_0x329f1a});if(this['channelSessions']['get'](_0x56f4ce)['add'](_0x39b4b1),!_0x668049['hiddenInPresenceList']){const _0xaf5dcf=this['channelConnectedUsers']['get'](_0x56f4ce);_0xaf5dcf['has'](_0x329f1a['id'])||_0xaf5dcf['add'](_0x329f1a),this['allConnectedUsers']['has'](_0x329f1a['id'])||_0x668049['hiddenInPresenceList']||this['allConnectedUsers']['add'](_0x329f1a,_0x329f1a['isMe']?0x0:void 0x0);}this['fire']('sessionAdd:'+_0x56f4ce,{'channelId':_0x56f4ce,'session':_0x39b4b1});}['_handleSessionRemove'](_0x15c0d0,_0x4bd31a){if('connected'!==this['context']['plugins']['get'](n)['state'])return;const _0x1273e1=this['channelConnectedUsers']['get'](_0x15c0d0),_0x2525fb=_0x4bd31a['user'];_0x2525fb['id']&&(this['channelSessions']['get'](_0x15c0d0)['remove'](_0x4bd31a['id']),_0x1273e1['has'](_0x2525fb['id'])&&!this['getUserSessions'](_0x2525fb,_0x15c0d0)['size']&&_0x1273e1['remove'](_0x2525fb['id']),this['allConnectedUsers']['get'](_0x2525fb['id'])&&!this['getUserSessions'](_0x2525fb)['size']&&this['allConnectedUsers']['remove'](_0x2525fb['id']));}['_createUser'](_0x781138,_0x531ab1){const _0x2910b2=this['_users']['addUser'](_0x781138);return _0x531ab1&&this['_users']['defineMe'](_0x781138['id']),_0x2910b2['orderNumber']=this['_uniqueUsersCount']++,_0x2910b2;}}class $ extends _0x45471e{['_domEmitter']=new(_0x2f47ff())();static get['requires'](){return[i];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x451323=this['editor'],_0x40d7fa=_0x451323['plugins']['get'](i);_0x451323['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x14800c,{writer:_0x22bb70})=>function(_0x2398ba,_0x36f84a,_0x37996c,_0x2a9181){const _0x49ddb4=_0x2398ba['markerName']['split'](':')[0x2],_0x3a7ef9=_0x37996c['getUserBySessionId'](_0x49ddb4);if(!_0x3a7ef9||_0x49ddb4===_0x37996c['mySessionId'])return;if(!_0x2a9181['model']['schema']['checkChild'](_0x2398ba['markerRange']['start'],'$text'))return;const _0x4164d4={'class':'ck-user__marker\x20'+_0x3a7ef9['color']['getMarkerClass'](),'data-name':_0x3a7ef9['name'],'data-session-id':_0x49ddb4},_0x1fceec=_0x2a9181['model']['markers']['get'](_0x2398ba['markerName']),_0x33b60=_0x1fceec['getStart'](),_0x2f89b7=_0x33b60['nodeAfter'],_0x53485d=_0x2a9181['model']['schema'];if(_0x2f89b7&&_0x53485d['isObject'](_0x2f89b7)&&_0x53485d['isInline'](_0x2f89b7)&&!_0x2a9181['model']['markers']['get']('user:range:'+_0x49ddb4)['getRange']()['isCollapsed'])return;const _0x3de385=_0x33b60['parent'];return _0x2a9181['model']['schema']['isLimit'](_0x3de385)&&!_0x2a9181['model']['hasContent'](_0x3de385)&&(_0x4164d4['contenteditable']=!0x1),function(_0x3eae87,_0x5aa3c3,_0x3cab57){const _0x8590da=_0x3eae87['createUIElement']('span',_0x5aa3c3);return _0x3eae87['setCustomProperty']('userPositionMarker',!0x0,_0x8590da),_0x8590da['render']=function(_0xf573a){const _0x541ab5=this['toDomElement'](_0xf573a),_0x361d59=document['createElement']('span');return _0x361d59['classList']['add']('ck-user__marker-tooltip'),_0x361d59['setAttribute']('contenteditable','false'),_0x361d59['setAttribute']('spellcheck','false'),_0x361d59['textContent']=_0x3cab57['name'],_0x541ab5['innerHTML']='<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span>'+_0x361d59['outerHTML']+'',_0x541ab5['addEventListener']('mouseenter',()=>{_0x541ab5['classList']['add']('ck-user__marker_hovered');}),_0x541ab5['addEventListener']('mouseleave',()=>{_0x541ab5['classList']['remove']('ck-user__marker_hovered');}),_0x541ab5;},_0x8590da['isSimilar']=function(_0x7746a4){return!(!this['getCustomProperty']('userPositionMarker')||!_0x7746a4['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0x7746a4['getAttribute']('data-session-id'));},_0x8590da;}(_0x36f84a,_0x4164d4,_0x3a7ef9);}(_0x14800c,_0x22bb70,_0x40d7fa,_0x451323)}),_0x451323['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0x1169a0=>function(_0x39d074,_0x2b73da){const _0x26b0e6=_0x39d074['markerName']['split'](':')[0x2];if(_0x26b0e6===_0x2b73da['mySessionId'])return null;const _0x50b0eb=_0x2b73da['getUserBySessionId'](_0x26b0e6);if(!_0x50b0eb)return{'id':_0x26b0e6,'classes':[]};return{'id':_0x26b0e6,'classes':['ck-user__selection',_0x50b0eb['color']['getSelectionClass']()],'attributes':{'data-session-id':_0x26b0e6},'priority':0x7d0+_0x50b0eb['orderNumber']};}(_0x1169a0,_0x40d7fa)}),function(_0x159bc7){const _0x3dbbbc=_0x159bc7['model'],_0x44022a=new Map(),_0x5ef1f4=_0x159bc7['plugins']['get'](i);_0x3dbbbc['markers']['on']('update:user:range',(_0x18f132,_0x432f61,_0x3f16f9,_0x3284c2)=>{if(!_0x3284c2&&_0x44022a['get'](_0x432f61['name']))return _0x44022a['get'](_0x432f61['name'])['detach'](),void _0x44022a['delete'](_0x432f61['name']);const _0x1d2ee0=_0x432f61['name']['split'](':')[0x2];if(_0x1d2ee0===_0x5ef1f4['mySessionId'])return;const _0x3e9c1e='user:position:'+_0x1d2ee0;_0x3dbbbc['markers']['has'](_0x3e9c1e)&&_0x159bc7['editing']['reconvertMarker'](_0x3e9c1e),_0x432f61['on']('change:range',(_0x4311f4,_0x22b073,_0x7d7083)=>{if('$graveyard'!=_0x22b073['root']['rootName']&&'$graveyard'==_0x432f61['getRange']()['root']['rootName']&&!_0x44022a['has'](_0x432f61['name'])){const _0x4ea1d6=_0x3dbbbc['schema']['getNearestSelectionRange'](_0x7d7083['deletionPosition']);if(_0x4ea1d6){const _0x2db4e0=_0xba9f9a['fromRange'](_0x4ea1d6);_0x44022a['set'](_0x432f61['name'],_0x2db4e0),_0x2db4e0['on']('change:range',(_0x1d709c,_0x874fb,_0x12876d)=>{if('$graveyard'==_0x2db4e0['root']['rootName']){const _0xb78c22=_0x3dbbbc['schema']['getNearestSelectionRange'](_0x12876d['deletionPosition']);_0xb78c22?(_0x2db4e0['start']=_0xb78c22['start'],_0x2db4e0['end']=_0xb78c22['end']):(_0x44022a['delete'](_0x432f61['name']),_0x2db4e0['detach']());}});}}});}),_0x3dbbbc['document']['on']('change',()=>{_0x44022a['size']>0x0&&_0x3dbbbc['enqueueChange']({'isUndoable':!0x1},_0x71e76d=>{for(const [_0x4400f1,_0x4128dc]of _0x44022a)'$graveyard'==_0x3dbbbc['markers']['get'](_0x4400f1)['getRange']()['root']['rootName']&&(te(_0x4400f1['split'](':')[0x2],_0x4128dc['toRange'](),_0x3dbbbc,_0x71e76d),_0x4128dc['detach']());_0x44022a['clear']();});});}(_0x451323),this['_domEmitter']['listenTo'](_0x44c7ea['document'],'keydown',(_0x501823,{key:_0x4e8398})=>{'Escape'===_0x4e8398&&function(_0x51ed56){_0x51ed56['editing']['view']['change'](_0x8473c6=>{for(const _0x19c22e of _0x51ed56['model']['markers']){if(!_0x19c22e['name']['startsWith']('user:position'))continue;const _0x279992=_0x51ed56['editing']['mapper']['markerNameToElements'](_0x19c22e['name']);if(_0x279992){for(const _0x3ad00d of _0x279992)_0x8473c6['removeClass']('ck-user__marker_hovered',_0x3ad00d);}}});}(_0x451323);},{'useCapture':!0x0});}['afterInit'](){const _0x526f6e=this['editor'],_0x5125a4=_0x526f6e['commands']['get']('undo');_0x5125a4&&_0x526f6e['model']['on']('applyOperation',(_0x581c56,_0x318ec5)=>{const _0x9abda6=_0x318ec5[0x0];if(!_0x9abda6['isDocumentOperation'])return;if('marker'!=_0x9abda6['type']||!_0x9abda6['name']['startsWith']('user:'))return;const _0x61b78d=_0x9abda6['batch'];_0x5125a4['_createdBatches']['has'](_0x61b78d)&&(_0x9abda6['newRange']=_0x9abda6['oldRange']?_0x526f6e['model']['createRange'](_0x9abda6['oldRange']['start'],_0x9abda6['oldRange']['end']):null);},{'priority':'highest'});}['destroy'](){return this['_domEmitter']['stopListening'](),super['destroy']();}['createUserMarkerOperations'](){const _0x5b5a82=this['editor'],_0x55e444=_0x5b5a82['model']['document'],_0x51e379=_0x5b5a82['plugins']['get'](i);_0x5b5a82['model']['enqueueChange']({'isUndoable':!0x1},_0x2587c2=>{const _0x323993='user:range:'+_0x51e379['mySessionId'],_0x413425='user:position:'+_0x51e379['mySessionId'],_0x153fea=_0x5b5a82['model']['markers']['has'](_0x323993);_0x5b5a82['editing']['view']['hasDomSelection']?te(_0x51e379['mySessionId'],_0x55e444['selection']['getFirstRange'](),_0x5b5a82['model'],_0x2587c2):_0x153fea&&(_0x2587c2['removeMarker'](_0x323993),_0x2587c2['removeMarker'](_0x413425));});}}function te(_0x5358cc,_0x17cbd8,_0x4a5c6,_0x4b6bcd){const _0x3475d9='user:range:'+_0x5358cc,_0xd0b0ef='user:position:'+_0x5358cc,_0x32dee4=_0x17cbd8['getContainedElement']();let _0x37426c=_0x17cbd8['start'];if(_0x32dee4&&_0x32dee4['is']('element','tableCell')){const _0x57fdf7=function(_0x5f39de,_0xf5e989){for(const _0xacd705 of _0x5f39de['getPositions']())if(_0xf5e989['schema']['checkChild'](_0xacd705,'$text'))return _0xacd705;}(_0x17cbd8,_0x4a5c6);_0x57fdf7&&(_0x37426c=_0x57fdf7,_0x17cbd8=_0x4b6bcd['createRange'](_0x37426c));}const _0x3bbdb2=_0x4b6bcd['createRange'](_0x37426c);_0x4a5c6['markers']['has'](_0x3475d9)?(_0x4b6bcd['updateMarker'](_0x3475d9,{'range':_0x17cbd8}),_0x4b6bcd['updateMarker'](_0xd0b0ef,{'range':_0x3bbdb2})):(_0x4b6bcd['addMarker'](_0x3475d9,{'range':_0x17cbd8,'usingOperation':!0x0}),_0x4b6bcd['addMarker'](_0xd0b0ef,{'range':_0x3bbdb2,'usingOperation':!0x0}));}function K(_0x383b8c,_0x59335b,_0x3c7447){const _0x4d87f6=_0x383b8c['t'],t=_0x383b8c['t'];switch(_0x59335b){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 _0x4d87f6({'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'},_0x3c7447);default:return'';}}let X=0x1;class l extends _0x45471e{static ['CollaborativeEditingService']=/* #__PURE__ -- @preserve */
|
|
25
|
-
((()=>_0x349243)());['_offset'];['sessionId'];['serverHistory'];['_channelId'];['_service'];['_document'];['_compressor'];['_bufferedOperations'];['_knownOperations'];['_knownRootNames'];['_pendingAction'];['_hasSelectionChanged'];['_sendBufferedOperationsDelayId'];['_baseBufferDelay'];['_currentBufferDelay'];['_lastSyncedOperationId'];['_disconnectionOperations'];['_operationIdentifier'];static get['requires'](){return[n,i,$,_0x2f85ae,_0x143e71,_0x4e1b91];}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 _0x58f6d6=this['serverHistory']['getOperations']();for(let _0x49e60b=_0x58f6d6['length']-0x1;_0x49e60b>=0x0;_0x49e60b--){const _0x108401=_0x58f6d6[_0x49e60b];if(!this['_disconnectionOperations']['has'](_0x108401))return _0x108401['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0x43ebfa){if(super(_0x43ebfa),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x3d54e6(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0x1cfd0a('collaboration-missing-channelid',this);const _0x5d87e4=_0x43ebfa['config']['get']('cloudServices.bundleVersion')||nt;this['_service']=new l['CollaborativeEditingService'](_0x5d87e4,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0x25d87a(),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 tt(this['_disconnectionOperations']);}['init'](){const _0x3beaf9=this['editor'],_0x3a4e71=_0x3beaf9['plugins']['get'](_0x143e71),_0x2e1e65=_0x3beaf9['plugins']['get'](n);this['listenTo'](_0x3a4e71,'getOperationAuthor',(_0x36aed7,_0x14c159)=>{const _0x50d246=_0x14c159[0x0];_0x50d246['_authorId']&&(_0x36aed7['return']=_0x3a4e71['getUser'](_0x50d246['_authorId']),_0x36aed7['stop']()),null===_0x50d246['_authorId']&&(_0x36aed7['return']=null,_0x36aed7['stop']());},{'priority':'high'}),this['listenTo'](_0x3beaf9['model']['document']['selection'],'change:range',(_0x16a40b,_0x126f0a)=>{_0x126f0a['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x3beaf9['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x3beaf9['model']['on']('applyOperation',(_0x205da5,_0x12ad22)=>{const _0x2506c0=_0x12ad22[0x0];_0x2506c0['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0x2506c0),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['bind']('_isEditingAllowed')['to'](_0x2e1e65,'state',this,'_hasSynchronizationProblem',(_0x4d7d0a,_0xb8e205)=>'connected'===_0x4d7d0a&&!_0xb8e205),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x3beaf9['disableReadOnlyMode']('rtc-offline'):_0x3beaf9['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x3beaf9['disableReadOnlyMode']('rtc-offline'):_0x3beaf9['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async['reconnect'](){const _0x36dd85=this['editor']['plugins']['get'](i),_0x36d218=this['editor']['plugins']['get'](n);try{this['_isPendingUpdate']=!0x0,_0x36dd85['unregister'](this['_channelId']);const _0x3bd0db=await this['_service']['reconnect'](_0x36d218['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0x3bd0db)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x14d28b=await this['_service']['getConnectedSessions']();_0x36dd85['register'](this['_channelId'],_0x14d28b),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x650139){if(function(_0x499692){return'404'===_0x499692['code'];}(_0x650139)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0x11b84d){return'409'===_0x11b84d['code'];}(_0x650139)){const _0x7285dc=K(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'](_0x7285dc);}else{if(!(_0x650139 instanceof Y))throw _0x650139;this['_handleReconnectionError']();}}}}['destroy'](){const _0x5ef2aa=this['editor']['plugins']['get'](n),_0x446b99=this['editor']['plugins']['get'](i);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x446b99['channelSessions']['has'](this['_channelId'])&&_0x446b99['unregister'](this['_channelId']),_0x5ef2aa['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async['_handleReconnectionResponse'](_0x43788f){if(this['sessionId']!==_0x43788f['sessionId']&&this['_lastSyncedOperationId']!==_0x43788f['lastOperationId'])throw new Y();return this['sessionId']=_0x43788f['sessionId'],this['_handleServerResponse']([],{..._0x43788f,'wereChangesApplied':!0x1,'data':_0x43788f['data']},'reconnect');}async['_connectService'](_0x24afda,_0x590124=!0x1){const {connection:_0x4af481}=this['editor']['plugins']['get'](n);l['CollaborativeEditingService']['getConnectedSessions'](_0x4af481,this['_channelId'])['then'](_0x22ea74=>this['_initSessionsHandling'](_0x22ea74))['catch'](_0x213b0d=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x213b0d);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x1aaf1e,_0x11c9b0)=>{this['_crash']('realtimecollaborationclient-init-service-internal-error',_0x11c9b0);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_isConnected']=!0x1;});const _0x19af98=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x24afda);this['_isPendingUpdate']=!0x0;const _0x1f5a29=await this['_service']['connect'](_0x4af481,this['_compressOperations'](_0x24afda),_0x19af98);if(this['sessionId']=_0x1f5a29['sessionId'],_0x590124){if(!_0x1f5a29['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x1f5a29['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0x24afda,_0x1f5a29,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x1f5a29,_0x24afda);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}['_handleSendingSelectionMarkers'](){const _0x64fd7=this['editor']['plugins']['get'](i),_0x5bcfbf=this['editor']['plugins']['get']($),_0x3abc1e=_0x64fd7['channelSessions']['get'](this['_channelId']);_0x3abc1e&&_0x3abc1e['length']>0x1?_0x5bcfbf['createUserMarkerOperations']():this['listenTo'](_0x64fd7,'sessionAdd:'+this['_channelId'],()=>{0x2===_0x64fd7['channelSessions']['get'](this['_channelId'])['length']&&_0x5bcfbf['createUserMarkerOperations']();});}async['_handleReceivedOperations'](_0x4e4362,_0x4d8c6a,_0x2b90a1,_0x531b67){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x4d8c6a){const _0x25ffef=this['_decompressOperations'](_0x2b90a1,_0x531b67);await this['_fetchMissingUsers'](_0x25ffef),this['_handleExternalOperations'](_0x25ffef,_0x4d8c6a,_0x2b90a1['lastOperationId'])||this['_crash']('realtimecollaborationclient-init-service-incorrect-server-operation');}}async['_connectAfterSessionHasBeenFlushed'](){this['_disconnectService']();const {locale:_0x1fb594}=this['editor'];let _0x380867;try{_0x380867=await this['_service']['getDocumentDetails']();}catch{const _0x5ddb33=K(_0x1fb594,'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'](_0x5ddb33);}const _0x556b92=_0x380867['currentDocumentSession']||_0x380867['lastDocumentSession'];if(this['_lastSyncedOperationId']!==_0x556b92['lastOperationId']){const _0x3353db=K(_0x1fb594,'The\x20last\x20saved\x20version\x20of\x20the\x20document\x20does\x20not\x20match\x20the\x20local\x20version.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.');return void this['_handleReconnectionError'](_0x3353db);}await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);}['_disconnectService'](){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['stopListening'](this['_service']);}['_initSessionsHandling'](_0x168cd6){const _0x2d9c50=this['editor']['plugins']['get'](i);this['listenTo'](_0x2d9c50,'sessionAdd:'+this['_channelId'],(_0x59c7a1,{session:_0x11a5ad})=>{if(_0x11a5ad['id']===_0x2d9c50['mySessionId']){_0x59c7a1['off']();const _0x5b91b1=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0x1175ec=_0x11a5ad['permissions'];_0x5b91b1&&_0x5b91b1['isEnabled']&&(_0x1175ec=_0x1175ec['filter'](_0x3bec4a=>'document:write'!==_0x3bec4a)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0x1175ec,this['_channelId']);}}),_0x2d9c50['register'](this['_channelId'],_0x168cd6);}['_initThrowingOnDataSet'](){const _0x52ee86=this['editor']['data']['set'];this['editor']['data']['set']=(..._0x53a0ae)=>{if(!_0x53a0ae[_0x53a0ae['length']-0x1]['suppressErrorInCollaboration'])throw new _0x1cfd0a('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x52ee86['apply'](this['editor']['data'],_0x53a0ae);};}['_setUpDataInit'](){this['editor']['data']['on']('init',(_0xec9f85,[_0x58b581])=>{if(this['_document']['version'])throw new _0x1cfd0a('realtimecollaborationclient-init-document-already-initialized',this);_0xec9f85['stop'](),this['_setPendingAction']();const _0x249558=this['editor']['config']['get']('rootsAttributes'),_0xe07674=this['_getOperationsFromInitData'](_0x58b581,_0x249558);0x0==_0xe07674['length']&&_0xe07674['push'](new _0xba81a2(0x0)),_0xec9f85['return']=this['_connectService'](_0xe07674)['then'](()=>{this['editor']['plugins']['get'](n)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x2c1a53=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x2c1a53))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x481a4b,[_0x1f1dbe,_0x532da9])=>{_0x481a4b['stop']();const _0xa22592=this['editor']['model']['document']['getRoot'](_0x1f1dbe);if(!this['_knownRootNames']['has'](_0x1f1dbe)){const _0x4f09bf=_0x532da9&&_0x532da9['data']?_0x532da9['data']:'',_0x38428b=_0x532da9&&_0x532da9['attributes']?_0x532da9['attributes']:{};await this['_loadRoot'](_0x1f1dbe,_0x4f09bf,_0x38428b);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0xa22592['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0xa22592);});},{'priority':'high'});}async['_fetchMissingUsers'](_0x47eae5){const _0x4b6fc2=this['editor']['plugins']['get'](_0x143e71),{connection:_0x5cecbf}=this['editor']['plugins']['get'](n),_0x3c5c5a=new Set();for(const _0x4da8e3 of _0x47eae5){const _0x1195f0=_0x4da8e3['_authorId'];_0x1195f0&&!_0x4b6fc2['getUser'](_0x1195f0)&&_0x3c5c5a['add'](_0x1195f0);}if(0x0===_0x3c5c5a['size'])return;const _0x26c5ed=await ct['getMany'](_0x5cecbf,Array['from'](_0x3c5c5a));for(const _0x3590eb of _0x26c5ed)_0x4b6fc2['getUser'](_0x3590eb['id'])||_0x4b6fc2['addUser'](_0x3590eb);}['_getOperationsFromInitData'](_0x54c5a,_0x1744c0={}){const _0x525aa9=this['editor']['model'],_0x31c881=[];let _0x46de14=0x0;const _0x3070ab='string'==typeof _0x54c5a?{'main':_0x54c5a}:_0x54c5a;for(const _0x18ea45 of Object['keys'](_0x3070ab)){if(!this['_document']['roots']['has'](_0x18ea45))throw new _0x1cfd0a('realtimecollaborationclient-init-non-existent-root',this);const _0x5300fa=this['editor']['data']['parse'](_0x3070ab[_0x18ea45]),_0x42b55c=this['_document']['getRoot'](_0x18ea45),_0x12caa3=new _0x592aca(_0x525aa9['createPositionAt'](_0x42b55c,0x0),_0x5300fa,_0x46de14++);_0x31c881['push'](_0x12caa3);for(const [_0x2b5208,_0x1e97a6]of _0x5300fa['markers']){const _0xd95894=_0x525aa9['createRange'](_0x525aa9['createPositionFromPath'](_0x42b55c,_0x1e97a6['start']['path']['slice']()),_0x525aa9['createPositionFromPath'](_0x42b55c,_0x1e97a6['end']['path']['slice']())),_0x366dd3=new _0xbcb16d(_0x2b5208,null,_0xd95894,_0x525aa9['markers'],!0x0,_0x46de14++);_0x31c881['push'](_0x366dd3);}}if(_0x1744c0)for(const [_0x2324ff,_0x31e905]of Object['entries'](_0x1744c0)){const _0x25c510=_0x525aa9['document']['getRoot'](_0x2324ff);if(!_0x25c510)throw new _0x1cfd0a('multi-root-editor-root-attributes-no-root',null);for(const [_0x5e8056,_0x4cee68]of Object['entries'](_0x31e905))if(null!==_0x4cee68){const _0x965dbe=new _0x3b5e5f(_0x25c510,_0x5e8056,null,_0x4cee68,_0x46de14++);_0x31c881['push'](_0x965dbe);}}return _0x31c881;}async['_loadRoot'](_0x5584f4,_0x248d48,_0x1ce39e){this['_getOperationsFromInitData']({[_0x5584f4]:_0x248d48},{[_0x5584f4]:_0x1ce39e})['forEach']((_0x1a8002,_0xac0019)=>{_0x1a8002['baseVersion']=this['_document']['version']+_0xac0019,_0x1a8002['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x1a8002);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async['_handleInitialConnectionData'](_0x494760,_0x1272a6){let _0x5ea93c;this['_offset']=_0x494760['offset'];const _0x413f03=_0x494760['wereChangesApplied']&&!_0x494760['initData'],_0x2eca0d=_0x413f03?0x0:_0x494760['data']['baseVersion'];if(_0x1272a6['forEach'](_0x1f4592=>{_0x1f4592['_isInit']=!0x0,_0x1f4592['createdAt']=_0x494760['sessionCreatedAt'],_0x1f4592['_authorId']=null;}),_0x413f03)_0x5ea93c=_0x1272a6,this['_applyOperationsSet'](_0x5ea93c,_0x413f03);else{if(_0x494760['initData']){const _0x57c3c9=this['_getOperationsFromInitData'](_0x494760['initData']);this['_document']['history']['version']=-_0x57c3c9['length'],_0x57c3c9['forEach'](_0x25775f=>{_0x25775f['baseVersion']-=_0x57c3c9['length'],_0x25775f['createdAt']=_0x494760['sessionCreatedAt'],_0x25775f['_isInit']=!0x0,_0x25775f['_authorId']=null;}),this['_applyOperationsSet'](_0x57c3c9,!0x0),this['serverHistory']['version']=-_0x57c3c9['length']+this['_offset'],this['_updateServerHistory'](_0x57c3c9);}this['_document']['history']['version']=_0x2eca0d,_0x5ea93c=this['_decompressOperations'](_0x494760['data'],_0x494760['metadata']),await this['_fetchMissingUsers'](_0x5ea93c),this['_applyOperationsSet'](_0x5ea93c,_0x413f03);}_0x494760['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x5ea93c,_0x494760['lastOperationId']),this['_lastSyncedOperationId']=_0x494760['lastOperationId']),this['serverHistory']['version']=_0x2eca0d+this['_offset'],this['_updateServerHistory'](_0x5ea93c),_0x1272a6['filter'](_0x1dd553=>{const _0x5e9df8=this['_getAffectedRoot'](_0x1dd553);return _0x5e9df8&&!this['_knownRootNames']['has'](_0x5e9df8);})['forEach']((_0x46f00e,_0x4eb1d8)=>{_0x46f00e['baseVersion']=this['_document']['version']+_0x4eb1d8,this['_saveOperationInBuffer'](_0x46f00e);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x4f9d91,_0xbfacf7){const _0x4d7197=_0xbfacf7&&_0xbfacf7['message'];if(_0x4d7197&&_0x4d7197['startsWith']('realtimecollaborationclient'))throw _0xbfacf7;const _0x444122=this['editor']['plugins']['get'](n);throw this['_isPendingUpdate']=!0x0,_0x444122['disconnect'](),this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0x1cfd0a(_0x4f9d91,this['editor'],_0x4d7197?{'originalError':_0x4d7197}:void 0x0);}['_saveOperationInBuffer'](_0x4fbdc9){this['_knownOperations']['has'](_0x4fbdc9)||(this['_knownOperations']['add'](_0x4fbdc9),this['_bufferedOperations']['push'](_0x4fbdc9),this['_pendingAction']||'marker'==_0x4fbdc9['type']&&!_0x4fbdc9['affectsData']||this['_setPendingAction']());}['_sendBufferedOperationsDelayed'](_0x51a480=!0x1){!_0x51a480&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0x2c1db7=>{_0x2c1db7&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0x2e2bf2=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0x12cd84){return _0x12cd84['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x12cd84['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0x12cd84['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0x2e2bf2)||this['_crash'](_0x2e2bf2['message'],_0x2e2bf2);});},this['_currentBufferDelay']));}['_waitUntilSynced'](){return new Promise(_0x55053e=>{this['on']('change:_isPendingUpdate',()=>{_0x55053e();});});}async['_sendBufferedOperations'](){const _0x48ca68=this['editor']['plugins']['get']($);if(this['_shouldSendSelectionUpdate']()&&(_0x48ca68['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x3a4a09=[...this['_bufferedOperations']];for(const _0x165c4f of _0x3a4a09)_0x165c4f['wasUndone']=this['_document']['history']['isUndoneOperation'](_0x165c4f);const _0x3c7f07=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x3a4a09),_0x51b278=X++,_0x139afb=this['_compressOperations'](_0x3a4a09),_0x28dae5=await this['_service']['sendOperations'](_0x139afb,_0x139afb['baseVersion'],_0x3c7f07);try{return await this['_handleServerResponse'](_0x3a4a09,_0x28dae5,_0x51b278);}catch(_0x42aec7){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0x42aec7);}}async['_handleServerResponse'](_0x2506d9,_0x5072ac,_0x20ba6a){if('error'in _0x5072ac)throw _0x5072ac['error'];let _0x2de79f=!0x1;if(_0x5072ac['wereChangesApplied']){_0x5072ac['lastOperationId']&&(this['_lastSyncedOperationId']=_0x5072ac['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x19c331=>!_0x2506d9['includes'](_0x19c331));for(const _0x203763 of _0x2506d9)_0x203763['createdAt']='lastOperationAcceptedAt'in _0x5072ac&&_0x5072ac['lastOperationAcceptedAt']||void 0x0;Z(_0x2506d9,_0x5072ac['version']-_0x2506d9['length']),this['_updateServerHistory'](_0x2506d9);const _0x24a456=_0x2506d9['filter'](_0x299c87=>{if(!_0x299c87['_isInit'])return!0x1;const _0x3b7f3c=this['_getAffectedRoot'](_0x299c87);return _0x3b7f3c&&!this['_knownRootNames']['has'](_0x3b7f3c);});Z(_0x24a456,this['_document']['version']),this['_applyOperationsSet'](_0x24a456),_0x2de79f=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0x697c63=this['_decompressOperations'](_0x5072ac['data'],_0x5072ac['metadata'])['filter'](_0x386df9=>_0x386df9['baseVersion']>=this['_lastServerVersion']);_0x697c63['forEach'](_0x5756fb=>this['_addKnownRoot'](_0x5756fb)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x3a5220=>!_0x3a5220['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x3a5220))),this['_bufferedOperations']['length']&&Z(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0x697c63),_0x2de79f=this['_handleExternalOperations'](_0x697c63,_0x5072ac['version'],_0x5072ac['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x2de79f?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}['_handleExternalOperations'](_0x411bc3,_0x4a1a87,_0x506de3){try{const _0x4c7005={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x48e270,operationsB:_0x1f281a,originalOperations:_0x2f1fc5}=_0x5e7815(_0x411bc3,this['_bufferedOperations'],_0x4c7005);Z(_0x48e270,this['_document']['version']),Z(_0x1f281a,_0x4a1a87);for(const _0x4f2d27 of _0x48e270){const _0x1d2aa0=_0x2f1fc5['get'](_0x4f2d27);_0x4f2d27['_authorId']=_0x1d2aa0?_0x1d2aa0['_authorId']:null;}_0x506de3&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x411bc3,_0x506de3),this['_lastSyncedOperationId']=_0x506de3),this['_bufferedOperations']=[..._0x1f281a],this['_applyOperationsSet'](_0x48e270),this['_updateServerHistory'](_0x411bc3);}catch(_0x18bc8f){return console['error'](_0x18bc8f),!0x1;}return!0x0;}['_applyOperationsSet'](_0x1c813a,_0x1f3f2e=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0x4be90d=>{for(const _0x201f5c of _0x1c813a)this['_knownOperations']['add'](_0x201f5c),this['_addKnownRoot'](_0x201f5c),_0x4be90d['batch']['addOperation'](_0x201f5c),this['editor']['model']['applyOperation'](_0x201f5c);});}['_addKnownRoot'](_0x45b2a5){const _0x58abce=this['_getAffectedRoot'](_0x45b2a5);_0x58abce&&this['_knownRootNames']['add'](_0x58abce);}['_getAffectedRoot'](_0x3d4e2a){let _0xfad1a3,_0x179df8;switch(_0x3d4e2a['type']){case'insert':_0xfad1a3=_0x3d4e2a['position']['root'];break;case'marker':if(_0x179df8=_0x3d4e2a['newRange'],!_0x179df8)return null;_0xfad1a3=_0x179df8['root'];break;case'addRootAttribute':_0xfad1a3=_0x3d4e2a['root'];break;case'addRoot':_0xfad1a3=_0x3d4e2a['affectedSelectable'];break;case'move':_0xfad1a3=_0x3d4e2a['targetPosition']['root'];break;default:return null;}return _0xfad1a3['rootName'];}['_updateServerHistory'](_0x59deee){_0x59deee['forEach'](_0x1aa694=>{const _0x4b3c5a=_0x1aa694['clone']();_0x4b3c5a['_authorId']=_0x1aa694['_authorId'],_0x4b3c5a['_isInit']=!!_0x1aa694['_isInit'],_0x4b3c5a['createdAt']=_0x1aa694['createdAt'],_0x4b3c5a['baseVersion']+=this['_offset'],_0x1aa694['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x4b3c5a),this['serverHistory']['addOperation'](_0x4b3c5a);});}['_handleReconnectionError'](_0x21645b){const _0x18e046=this['editor']['plugins']['get']('Notification'),_0x8c3696=this['editor']['locale'];_0x21645b||(_0x21645b=K(_0x8c3696,'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.')),_0x18e046['showWarning'](_0x21645b,{'title':K(_0x8c3696,'Synchronization\x20issue'),'namespace':'real-time-collaboration'}),this['_hasSynchronizationProblem']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_bufferedOperations']=[],this['editor']['plugins']['get'](n)['disconnect']();}['_setPendingAction'](){this['_pendingAction']||(this['_pendingAction']=this['editor']['plugins']['get'](_0x2f85ae)['add'](K(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}['_clearPendingAction'](){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x2f85ae)['remove'](this['_pendingAction']),this['_pendingAction']=null);}['_compressOperations'](_0x22d1c5){const _0x50e8d8=_0x22d1c5['map'](_0x1b0d16=>_0x1b0d16['toJSON']());return this['_compressor']['compress'](_0x50e8d8);}['_decompressOperations'](_0x335413,_0x15f158){return this['_compressor']['decompress'](_0x335413)['map']((_0x459032,_0x2a6473)=>{const _0xf05faf='init'==_0x15f158[_0x2a6473]['type'];if('InsertOperation'==_0x459032['__className']){const _0x3683ff=_0x459032['position']['root'];!this['_document']['getRoot'](_0x3683ff)&&(this['_document']['createRoot']('$root',_0x3683ff)['_isAttached']=!0x1);}const _0x1d7882=_0x2782e3['fromJSON'](_0x459032,this['_document']);return _0x1d7882['wasUndone']=_0x459032['wasUndone'],_0x1d7882['_isInit']=_0xf05faf,_0x1d7882['_authorId']=_0xf05faf?null:_0x15f158[_0x2a6473]['userId'],_0x1d7882['_isDisconnection']='cs:removeUser'===_0x15f158[_0x2a6473]['type'],_0x1d7882['createdAt']=_0x15f158[_0x2a6473]['createdAt'],_0x1d7882;});}['_refreshUserSelectionMarkers'](){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}['_shouldSendSelectionUpdate'](){const _0x5b271a=this['editor']['plugins']['get'](i)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0x5b271a&&_0x5b271a['length']>0x1&&this['_hasSelectionChanged'];}['_shouldSendUpdate'](){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}}class Y extends Error{}function Z(_0x24c054,_0x5c5aed){for(const _0xc53a55 of _0x24c054)_0xc53a55['baseVersion']=_0x5c5aed++;}class tt{['_ignoredOperations'];['_operationToId'];constructor(_0x19896f){this['_ignoredOperations']=_0x19896f,this['_operationToId']=new WeakMap();}['getIdOfTheLastOperation'](_0x5986ff){let _0x5ebbcd=_0x5986ff['length'];for(;_0x5ebbcd--;){const _0x5d2397=_0x5986ff[_0x5ebbcd];if(!this['_ignoredOperations']['has'](_0x5d2397)){if(!this['_operationToId']['has'](_0x5d2397)){const _0x345d46=_0xa3a1e2()['slice'](0x1,0x12);this['_operationToId']['set'](_0x5d2397,_0x345d46);}return this['_operationToId']['get'](_0x5d2397);}}}['setIdForTheLastOperation'](_0x4df113,_0x4ed8a8){if(!_0x4ed8a8)return;let _0x190811=_0x4df113['length'];for(;_0x190811--;){const _0x10091a=_0x4df113[_0x190811];this['_ignoredOperations']['has'](_0x10091a)||this['_operationToId']['set'](_0x10091a,_0x4ed8a8);}}}class a extends _0x45471e{static get['requires'](){return[l];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class s extends _0x3fd05c{static ['CommentsService']=/* #__PURE__ -- @preserve */
|
|
26
|
-
((()=>_0x3618f8)());['_services'];static get['requires'](){return[n,'CommentsRepository',i,_0x143e71];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x58da04){super(_0x58da04),this['_services']=new Map();}async['init'](){const _0x3ceb8c=this['context'],_0x49d981=_0x3ceb8c['plugins']['get']('CommentsRepository');if(_0x3ceb8c['plugins']['get'](n)['addToReconnectionStack'](this),_0x49d981['adapter']={'addCommentThread':async({channelId:_0x193223,threadId:_0x257bdb,comments:_0x8ec7d0,resolvedAt:_0x5b2547,resolvedBy:_0x4e291a,context:_0x1ae9de,attributes:_0x24d68b})=>{const _0x4e28ac=await this['_getService'](_0x193223)['addCommentThread']({'commentThreadId':_0x257bdb,'comments':_0x8ec7d0['map'](_0x49329c=>function(_0x56a586,_0x35f823,_0x50c1c5){return{'commentThreadId':_0x50c1c5,'commentId':_0x56a586['commentId'],'userId':_0x56a586['authorId'],'content':_0x56a586['content'],'documentId':_0x35f823,'createdAt':_0x56a586['createdAt'],'attributes':_0x56a586['attributes']||{}};}(_0x49329c,_0x193223,_0x257bdb)),'resolvedAt':_0x5b2547,'resolvedBy':_0x4e291a,'context':_0x1ae9de,'attributes':_0x24d68b})['catch'](at);return{'threadId':_0x4e28ac['commentThreadId'],'comments':_0x4e28ac['comments']};},'getCommentThread':async({channelId:_0x924025,threadId:_0x59ed02})=>{const _0x1ae421=await this['_getService'](_0x924025)['getCommentThread'](_0x59ed02)['catch'](F)['catch'](at);return _0x1ae421?_0x1ae421['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0x1ae421]),{'threadId':_0x1ae421['commentThreadId'],'comments':_0x1ae421['comments']['map'](S),'context':_0x1ae421['context'],'resolvedAt':_0x1ae421['resolvedAt'],'resolvedBy':_0x1ae421['resolvedBy'],'attributes':_0x1ae421['attributes']||{}}):null;},'updateCommentThread':async({channelId:_0x5cc11b,threadId:_0x3846af,context:_0x437223,unlinkedAt:_0x568868,attributes:_0x3d24a0})=>this['_getService'](_0x5cc11b)['updateCommentThread']({'commentThreadId':_0x3846af,'context':_0x437223,'attributes':_0x3d24a0,'unlinkedAt':_0x568868})['catch'](F)['catch'](at),'resolveCommentThread':async({channelId:_0x525da1,threadId:_0x3257a9})=>{const _0xe9dfa9=await this['_getService'](_0x525da1)['resolveCommentThread'](_0x3257a9)['catch'](F)['catch'](at);return{'threadId':_0xe9dfa9['commentThreadId'],'resolvedAt':_0xe9dfa9['resolvedAt'],'resolvedBy':_0xe9dfa9['resolvedBy']};},'reopenCommentThread':async({channelId:_0x16fe57,threadId:_0x3f906c})=>this['_getService'](_0x16fe57)['reopenCommentThread'](_0x3f906c)['catch'](F)['catch'](at),'removeCommentThread':({channelId:_0x13bff6,threadId:_0x45d080})=>this['_getService'](_0x13bff6)['removeCommentThread'](_0x45d080)['catch'](F)['catch'](at),'addComment':({channelId:_0x5f35d4,threadId:_0x2ffd7d,commentId:_0x458810,content:_0x865699,attributes:_0x1aac41})=>this['_getService'](_0x5f35d4)['addComment'](_0x2ffd7d,_0x458810,_0x865699,_0x1aac41)['catch'](at),'updateComment':({channelId:_0x2803d0,threadId:_0x6666b3,commentId:_0x207fe1,content:_0x236587,attributes:_0x4c7b75})=>this['_getService'](_0x2803d0)['updateComment'](_0x6666b3,_0x207fe1,_0x236587,_0x4c7b75)['catch'](F)['catch'](at),'removeComment':({channelId:_0x403bba,threadId:_0x57c537,commentId:_0x3fa41f})=>this['_getService'](_0x403bba)['removeComment'](_0x57c537,_0x3fa41f)['catch'](F)['catch'](at)},_0x3ceb8c instanceof _0x4d43e8){const _0x55f5cd=_0x3ceb8c['config']['get']('collaboration.channelId'),_0x5f29e8=_0x3ceb8c['plugins']['get'](i);await this['_setUpService'](_0x55f5cd);const _0x5849b7=await this['_services']['get'](_0x55f5cd)['getConnectedSessions']();this['listenTo'](_0x5f29e8,'sessionAdd:'+_0x55f5cd,(_0x1be10a,{session:_0x4818f3})=>{_0x4818f3['id']===_0x5f29e8['mySessionId']&&(_0x1be10a['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x4818f3['permissions'],_0x55f5cd));}),_0x5f29e8['register'](_0x55f5cd,_0x5849b7);}}async['_setUpService'](_0x17f6d9){if(this['_services']['has'](_0x17f6d9))throw new _0x1cfd0a('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0x17f6d9});const _0x352df3=this['context']['plugins']['get']('CommentsRepository'),_0x43026a=new s['CommentsService'](_0x17f6d9);this['_services']['set'](_0x17f6d9,_0x43026a),this['listenTo'](_0x43026a,'commentThreadAdded',(_0x60d8f6,_0x5c44df)=>{const {commentThreadId:_0x2db9f9,documentId:_0x13a7f4,context:_0x3ece58,attributes:_0x59ba7a,resolvedAt:_0x469972,resolvedBy:_0x164e2e,comments:_0x4e94bc}=_0x5c44df;_0x352df3['getCommentThread'](_0x2db9f9)||_0x352df3['addCommentThread']({'threadId':_0x2db9f9,'channelId':_0x13a7f4,'comments':_0x4e94bc?_0x4e94bc['map'](S):[],'context':_0x3ece58,'attributes':_0x59ba7a,'resolvedAt':_0x469972,'resolvedBy':_0x164e2e,'isFromAdapter':!0x0});}),this['listenTo'](_0x43026a,'commentThreadUpdated',(_0x4f32fe,{commentThreadId:_0x3f9712,documentId:_0x1838bd,context:_0x9bebf3,unlinkedAt:_0x12d58b,attributes:_0x59918b})=>{_0x352df3['getCommentThread'](_0x3f9712)&&_0x352df3['updateCommentThread']({'threadId':_0x3f9712,'channelId':_0x1838bd,'context':_0x9bebf3,'unlinkedAt':_0x12d58b,'attributes':_0x59918b,'isFromAdapter':!0x0});}),this['listenTo'](_0x43026a,'commentThreadResolved',(_0x17d437,{commentThreadId:_0x4c9da2,resolvedBy:_0x562ee6,resolvedAt:_0x5785a6})=>{const _0x172f06=_0x352df3['getCommentThread'](_0x4c9da2);_0x172f06&&_0x172f06['resolve']({'resolvedBy':_0x562ee6,'resolvedAt':_0x5785a6,'isFromAdapter':!0x0});}),this['listenTo'](_0x43026a,'commentThreadReopened',(_0x3b0265,{commentThreadId:_0x33d9da})=>{const _0x383d8d=_0x352df3['getCommentThread'](_0x33d9da);_0x383d8d&&_0x383d8d['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0x43026a,'commentThreadRemoved',(_0x5d5a80,{commentThreadId:_0xcc4aab})=>{const _0x33a0d7=_0x352df3['getCommentThread'](_0xcc4aab);_0x33a0d7&&_0x33a0d7['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0x43026a,'commentAdded',(_0x1c0eef,_0x1c04e7)=>{const _0x11fed5=_0x1c04e7['commentThreadId'],_0x52fd64=_0x352df3['getCommentThread'](_0x11fed5);_0x52fd64&&_0x52fd64['addComment']({...S(_0x1c04e7),'isFromAdapter':!0x0});}),this['listenTo'](_0x43026a,'commentUpdated',(_0x2a8284,{commentThreadId:_0x26241c,commentId:_0x2392e4,content:_0x55796f,attributes:_0x44c9e6})=>{const _0x47d581=_0x352df3['getCommentThread'](_0x26241c);if(_0x47d581){const _0x2f0ef0=_0x47d581['getComment'](_0x2392e4);_0x2f0ef0&&_0x2f0ef0['update']({'content':_0x55796f,'attributes':_0x44c9e6,'isFromAdapter':!0x0});}}),this['listenTo'](_0x43026a,'commentRemoved',(_0x2877bf,{commentThreadId:_0x3b6f63,commentId:_0x4731f9})=>{const _0x4cf391=_0x352df3['getCommentThread'](_0x3b6f63);if(_0x4cf391){const _0x4fdc80=_0x4cf391['getComment'](_0x4731f9);_0x4fdc80&&_0x4fdc80['remove']({'isFromAdapter':!0x0});}}),await this['_connectService'](_0x17f6d9);}['destroy'](){if(this['context']instanceof _0x4d43e8){const _0x378373=this['context']['config']['get']('collaboration.channelId');this['_terminateService'](_0x378373);}}['_terminateService'](_0x2bb271){if(!this['_services']['has'](_0x2bb271))throw new _0x1cfd0a('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0x2bb271});this['_getService'](_0x2bb271)['disconnect'](),this['_services']['delete'](_0x2bb271);}async['reconnect'](){for(const _0x1d0ff9 of this['_services']['keys']())await this['_connectService'](_0x1d0ff9);if(this['context']instanceof _0x4d43e8){const _0x2062aa=this['context']['config']['get']('collaboration.channelId'),_0x6543f7=this['context']['plugins']['get'](i);_0x6543f7['unregister'](_0x2062aa);const _0x25eadd=await this['_services']['get'](_0x2062aa)['getConnectedSessions']();_0x6543f7['register'](_0x2062aa,_0x25eadd);}}async['_connectService'](_0x4252da){const {connection:_0x5963a0}=this['context']['plugins']['get'](n),_0x17ddb7=this['context']['plugins']['get']('CommentsRepository'),_0xbc1c1f=this['_services']['get'](_0x4252da),_0x3df46d=await _0xbc1c1f['connect'](_0x5963a0);await this['_fetchMissingUsersForThreads'](_0x3df46d);const _0x891f66=new Set(Array['from'](_0x17ddb7['getCommentThreads']({'channelId':_0x4252da}),_0x1c1c3e=>_0x1c1c3e['id']));for(const _0x30e856 of _0x3df46d)_0x30e856['deletedAt']||_0x891f66['delete'](_0x30e856['commentThreadId']);for(const _0x33e244 of _0x891f66)_0x17ddb7['getCommentThread'](_0x33e244)['remove']({'isFromAdapter':!0x0});for(const _0x5a7130 of _0x3df46d){let _0x162955=_0x17ddb7['getCommentThread'](_0x5a7130['commentThreadId']);const {commentThreadId:_0x38d353,context:_0xcb4aa5,attributes:_0x66468a,resolvedBy:_0x3807c7,resolvedAt:_0x15f4b5,unlinkedAt:_0x4c883b,deletedAt:_0x48c214}=_0x5a7130;if(_0x48c214)continue;_0x162955||(_0x162955=_0x17ddb7['addCommentThread']({'channelId':_0x4252da,'threadId':_0x38d353,'context':_0xcb4aa5,'attributes':_0x66468a||{},'resolvedBy':_0x3807c7,'resolvedAt':_0x15f4b5,'unlinkedAt':_0x4c883b,'isFromAdapter':!0x0}));const _0x2ec4da=new Set(Array['from'](_0x162955['comments'],_0x339ff9=>_0x339ff9['id']));for(const _0x3710a4 of _0x5a7130['comments'])_0x2ec4da['delete'](_0x3710a4['commentId']);for(const _0x5cae02 of _0x2ec4da)_0x162955['getComment'](_0x5cae02)['remove']({'isFromAdapter':!0x0});for(const _0x462456 of _0x5a7130['comments']){const _0x5e8a13=_0x162955['getComment'](_0x462456['commentId']);_0x5e8a13?_0x5e8a13['content']!==_0x462456['content']&&_0x5e8a13['update']({'content':_0x462456['content'],'isFromAdapter':!0x0}):_0x162955['addComment'](Object['assign'](S(_0x462456),{'isFromAdapter':!0x0}));}}}['_getService'](_0x5c5896){if(!this['_services']['has'](_0x5c5896))throw new _0x1cfd0a('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0x5c5896});return this['_services']['get'](_0x5c5896);}async['_fetchMissingUsersForThreads'](_0x4398a9){const _0x13a8a2=this['context']['plugins']['get'](_0x143e71),{connection:_0x373786}=this['context']['plugins']['get'](n),_0x1288fe=new Set();for(const {resolvedBy:_0x43f3cc,comments:_0x4eab18}of _0x4398a9){_0x43f3cc&&!_0x13a8a2['getUser'](_0x43f3cc)&&_0x1288fe['add'](_0x43f3cc);for(const {userId:_0x3b5d6e}of _0x4eab18)_0x13a8a2['getUser'](_0x3b5d6e)||_0x1288fe['add'](_0x3b5d6e);}if(0x0===_0x1288fe['size'])return;const _0x4f92b6=await ct['getMany'](_0x373786,Array['from'](_0x1288fe));for(const _0x511879 of _0x4f92b6)_0x13a8a2['getUser'](_0x511879['id'])||_0x13a8a2['addUser'](_0x511879);}}async function F(_0x480b64){if('404'!==_0x480b64['code'])throw _0x480b64;}function at(_0x21f525){if((_0x1c6ac5=_0x21f525)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0x1c6ac5['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x1c6ac5['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0x1c6ac5;throw _0x21f525;}function S(_0x3b3d2f){return{'threadId':_0x3b3d2f['commentThreadId'],'commentId':_0x3b3d2f['commentId'],'content':_0x3b3d2f['content'],'createdAt':_0x3b3d2f['createdAt'],'authorId':_0x3b3d2f['userId'],'attributes':_0x3b3d2f['attributes']||{}};}class m extends _0x45471e{static ['TrackChangesService']=/* #__PURE__ -- @preserve */
|
|
27
|
-
((()=>
|
|
28
|
-
((()=>_0x415442)());['_lastRequestId'];['_revisionTracker'];['_revisionHistoryService'];['_oldOffset'];static get['requires'](){return[n,l,'RevisionHistory',i,_0x143e71];}static get['pluginName'](){return'CloudServicesRevisionHistoryAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0xa63bd9){super(_0xa63bd9);const _0x338890=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new c['RevisionHistoryService'](_0x338890);}async['init'](){const _0x5c5666=this['editor']['plugins']['get'](l),_0x366166=_0x5c5666['serverHistory'],_0x29fa17=this['editor']['plugins']['get'](n);this['_revisionTracker']['setSource']({'history':_0x366166,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0x5c5666['sessionId']});const _0x5ca910=this['editor']['config']['get']('cloudServices.bundleVersion')||nt,_0x3edfa3=await _0x20f0df['isBundleUploaded'](_0x29fa17['connection'],_0x5ca910);this['editor']['plugins']['get']('RevisionHistory')['adapter']={'getRevision':async({revisionId:_0x3d894e})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0x3d894e)),'updateRevisions':async _0x424e46=>{await this['_waitForServiceReady']();const _0x1eed9f=this['_revisionTracker']['currentRevision'];if(_0x3edfa3&&0x1===_0x424e46['length']&&_0x424e46[0x0]['id']===_0x1eed9f['id'])return _0x424e46;for(const _0x4f5c50 of _0x424e46)_0x4f5c50['id']===_0x1eed9f['id']&&(_0x4f5c50['isEmptyCurrent']=_0x4f5c50['fromVersion']===_0x4f5c50['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0x424e46,this['_lastRequestId'])['then'](_0x4a95c2=>(this['_lastRequestId']=_0x4a95c2,_0x424e46))['catch'](_0x4d9bb8=>{if(q(_0x4d9bb8)||'400'===_0x4d9bb8['code']&&void 0x0!==_0x4d9bb8['data']['wrongRequestId']){for(const _0x22ae5d of _0x424e46){!this['_revisionTracker']['repository']['getRevision'](_0x22ae5d['id'])||this['_revisionTracker']['_bufferUpdate'](_0x22ae5d['id'],_0x22ae5d,!0x1);}if(q(_0x4d9bb8))throw _0x4d9bb8;return _0x424e46;}throw _0x4d9bb8;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0x27a452,{revisionsData:_0x23a548,requestId:_0x20293b})=>{Math['max'](..._0x23a548['map'](_0x37cc4b=>_0x37cc4b['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0x23a548,_0x20293b);}):this['_handleRevisionsUpdate'](_0x23a548,_0x20293b);});const {revisions:_0x3006a6,requestId:_0x18a774}=await this['_revisionHistoryService']['connect'](_0x29fa17['connection']);_0x29fa17['addToReconnectionStack'](this),this['_lastRequestId']=_0x18a774,await this['_fetchMissingUsers'](_0x3006a6);for(const _0x2903d0 of _0x3006a6)this['_revisionTracker']['addRevisionData'](_0x2903d0);this['listenTo'](_0x5c5666,'change:_isConnected',(_0x4fac35,_0x5e6e37,_0x5d22e4)=>{_0x5d22e4&&(this['_oldOffset']=_0x5c5666['_offset'],_0x4fac35['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](_0x29fa17,'state',_0x18f2a9=>_0x18f2a9===_0x2008f1['CONNECTED']);}async['reconnect'](){const _0x572a1b=this['editor']['plugins']['get'](n),_0x524edd=this['editor']['plugins']['get'](l),_0x3a1958=async()=>{const _0x494535=this['_revisionTracker']['currentRevision'],_0x388071=_0x494535['id'],_0x274e58=_0x388071!==_0x524edd['sessionId'];if(_0x274e58){const _0x3485f3=_0x524edd['_offset']-this['_oldOffset'],_0x2261b3=this['_getLatestVersionFromServerOperations']();this['_revisionTracker']['_revisionDataBuilder']['reInit']();if(_0x494535['toVersion']+_0x3485f3!==_0x2261b3){const _0x2f24a6=_0x494535['fromVersion']+_0x3485f3,_0x56cf15=this['editor']['plugins']['get'](_0x143e71),_0x4ca09b=this['_revisionTracker']['buildRevisionData']({'revision':_0x494535,'from':_0x2f24a6,'to':_0x2261b3});_0x4ca09b['id']=_0x494535['id'];const _0x4c7625=_0x4ca09b['authorsIds']['map'](_0x143b25=>_0x56cf15['getUser'](_0x143b25));_0x494535['_update']({..._0x4ca09b,'authors':_0x4c7625},!0x0),this['_revisionTracker']['_bufferUpdate'](_0x494535['id'],_0x4ca09b,!0x0);}this['_revisionTracker']['_startingVersion']=_0x2261b3,(_0x494535['toVersion']===_0x494535['fromVersion']&&!this['_revisionTracker']['_bufferedUpdates']['has'](_0x388071)&&this['_revisionTracker']['repository']['_revisions']['remove'](_0x388071),this['_revisionTracker']['_createCurrentRevision'](_0x2261b3));}const {revisions:_0x5e57ac,requestId:_0x49e8fd}=await this['_revisionHistoryService']['reconnect'](_0x572a1b['connection'],this['_lastRequestId']);_0x274e58&&_0x5e57ac['length']>0x0?_0x524edd['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x5e57ac),this['_handleRevisionsUpdate'](_0x5e57ac,_0x49e8fd),this['_revisionTracker']['sendBufferedUpdates']());};return _0x524edd['_isConnected']?_0x3a1958():new Promise((_0x111d0d,_0x399c1e)=>{_0x524edd['once']('change:_isConnected',()=>{_0x3a1958()['then'](_0x111d0d)['catch'](_0x399c1e);});});}['destroy'](){super['destroy']();}async['_waitForServiceReady'](){this['_revisionHistoryService']['isConnected']||await new Promise(_0x4c952a=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x367b05=>{_0x367b05['off'](),_0x4c952a();});});}['_getLatestVersionFromServerOperations'](){const _0x2a226a=this['editor']['plugins']['get'](l)['serverHistory']['getOperations']()['reverse']();for(const _0x5586d5 of _0x2a226a)if('marker'!==_0x5586d5['type']||_0x5586d5['affectsData'])return _0x5586d5['baseVersion']+0x1;}['_getLatestVersion'](){const _0x1b0192=this['editor']['plugins']['get'](l);return new Promise(_0x206daf=>{_0x1b0192['_isPendingUpdate']?_0x1b0192['once']('change:_isPendingUpdate',()=>{_0x206daf(this['_getLatestVersionFromServerOperations']());}):_0x206daf(this['_getLatestVersionFromServerOperations']());});}['_handleRevisionsUpdate'](_0x452ccf,_0x497637){const _0x2a7283=this['_revisionTracker']['repository'];this['_lastRequestId']=_0x497637;for(const _0x2b49d5 of _0x452ccf){const _0x5516e7=_0x2a7283['getRevision'](_0x2b49d5['id']);if(_0x5516e7){if((_0x2b49d5['fromVersion']||_0x2b49d5['toVersion'])&&(_0x2b49d5['diffData']=null),_0x5516e7===this['_revisionTracker']['currentRevision']){const _0x552b06=Math['max'](_0x5516e7['toVersion'],_0x2b49d5['toVersion']),_0x3d85ff=Math['max'](_0x5516e7['fromVersion'],_0x2b49d5['fromVersion']);let _0x597113;_0x5516e7['toVersion']===_0x2b49d5['toVersion']&&_0x5516e7['fromVersion']===_0x2b49d5['fromVersion']?(_0x597113=!0x0,this['_preventResendingRevisionData'](_0x2b49d5)):_0x2b49d5['toVersion']===_0x552b06&&_0x2b49d5['fromVersion']===_0x3d85ff?_0x597113=!0x1:(_0x5516e7['toVersion']===_0x552b06&&_0x5516e7['fromVersion']===_0x3d85ff||this['_fixRevision']({'revision':_0x5516e7,'from':_0x3d85ff,'to':_0x552b06}),_0x597113=!0x0),_0x597113&&(delete _0x2b49d5['fromVersion'],delete _0x2b49d5['toVersion'],delete _0x2b49d5['diffData'],delete _0x2b49d5['createdAt'],delete _0x2b49d5['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0x2b49d5),this['_preventResendingRevisionData'](_0x2b49d5);}else this['_revisionTracker']['addRevisionData'](_0x2b49d5);}const _0x318ec2=_0x2a7283['getRevisions']();_0x318ec2['reverse']();for(let _0x4bd135=0x0;_0x4bd135<_0x318ec2['length']-0x1;_0x4bd135++){const _0x2d88ba=_0x318ec2[_0x4bd135],_0x3be434=_0x318ec2[_0x4bd135+0x1];if(_0x2d88ba['fromVersion']<_0x3be434['toVersion']){const _0x3ba961=_0x3be434['toVersion'],_0x53781e=Math['max'](_0x3ba961,_0x2d88ba['toVersion']);this['_fixRevision']({'revision':_0x2d88ba,'from':_0x3ba961,'to':_0x53781e});}}}['_fixRevision']({revision:_0x57bdc4,from:_0x37486a,to:_0x482c67}={}){const _0xba8a13=this['editor']['plugins']['get'](_0x143e71),_0x44cdf0=this['_revisionTracker']['buildRevisionData']({'revision':_0x57bdc4,'from':_0x37486a,'to':_0x482c67});_0x44cdf0['authors']=_0x44cdf0['authorsIds']['map'](_0x4b6ada=>_0xba8a13['getUser'](_0x4b6ada)),_0x57bdc4['_update'](_0x44cdf0);}['_preventResendingRevisionData'](_0x2bec39){const _0x343a5b={};_0x343a5b['id']=_0x2bec39['id'];for(const _0x51c066 of Object['keys'](_0x2bec39))'id'!==_0x51c066&&(_0x343a5b[_0x51c066]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0x343a5b['id'],_0x343a5b,!0x0);}async['_fetchMissingUsers'](_0x3ca3fa){const _0x154039=this['editor']['plugins']['get'](_0x143e71),{connection:_0x451c42}=this['editor']['plugins']['get'](n),_0x38cc8b=new Set();for(const _0x55b7e7 of _0x3ca3fa){for(const _0x293d01 of _0x55b7e7['authorsIds'])_0x47ac1f(_0x293d01);_0x55b7e7['creatorId']&&_0x47ac1f(_0x55b7e7['creatorId']);}if(0x0===_0x38cc8b['size'])return;const _0x46d9a6=await ct['getMany'](_0x451c42,Array['from'](_0x38cc8b));for(const _0x4be538 of _0x46d9a6)_0x154039['getUser'](_0x4be538['id'])||_0x154039['addUser'](_0x4be538);function _0x47ac1f(_0x46be8a){_0x154039['getUser'](_0x46be8a)||_0x38cc8b['add'](_0x46be8a);}}}function q(_0x1c9619){return _0x1c9619['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0x1c9619['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x1c9619['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class dt extends _0x45471e{static get['requires'](){return['RevisionHistory',c,a];}static get['pluginName'](){return'RealTimeCollaborativeRevisionHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class b extends _0x31d797{['_collapseAt'];constructor(_0x481baa,_0x387bd9=0x6){super(_0x481baa);const _0xbc124b=this['bindTemplate'];this['set']('isHidden',!0x0),this['set']('usersCount',0x0),this['_collapseAt']=_0x387bd9,this['bind']('isHidden')['to'](this,'usersCount',_0x1611cc=>_0x1611cc<_0x387bd9),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item',_0xbc124b['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':_0xbc124b['to']('usersCount',_0x4c3edd=>'+'+(_0x4c3edd-this['_collapseAt']+0x2)['toString']())}]}]}]});}}class is extends _0x31d797{['items'];['keystrokes'];constructor(_0x39133b){super(_0x39133b);const _0x3917ba=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0x3c3f79(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0x3917ba['if']('hasPopup'),'aria-expanded':_0x3917ba['to']('isExpanded',_0x2e9b48=>this['hasPopup']&&String(_0x2e9b48)),'aria-label':_0x3917ba['to']('hasPopup',_0xbafabd=>K(_0x39133b,_0xbafabd?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0x3917ba['to']('hasPopup',_0x1164b4=>!!_0x1164b4&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items'],'on':{'mouseenter':_0x3917ba['to'](()=>this['fire']('presencelist:show')),'mouseleave':_0x3917ba['to'](_0x238aff=>{const _0x4a6650=_0x238aff,_0x115b61=document['querySelector']('.ck-presence-list__dropdown-list'),_0x5d6093=document['querySelector']('.ck-balloon-panel_with-arrow');_0x115b61?.['contains'](_0x4a6650['relatedTarget'])||_0x5d6093?.['contains'](_0x4a6650['relatedTarget'])||this['fire']('presencelist:hide');})}}),this['on']('change:hasPopup',(_0xc8bdcb,_0x4ae2aa,_0x53be8a)=>{this['element']&&(_0x53be8a?this['element']['setAttribute']('aria-expanded',String(this['isExpanded'])):this['element']['removeAttribute']('aria-expanded'));});}['focus'](){this['element']['focus']();}['render'](){super['render'](),this['keystrokes']['listenTo'](this['element']);}}class v extends _0x31d797{['counterView'];['inlineListView'];constructor(_0x54760f,_0x39d268=0x6){super(_0x54760f);const _0x41df6b=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new b(this['locale'],_0x39d268),this['inlineListView']=new is(_0x54760f),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x4c7774 of this['inlineListView']['items'])_0x4c7774['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',_0x41df6b['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['inlineListView']]});}}class L extends _0x31d797{['listWrapperView'];constructor(_0xc19fdc,_0x17631c){super(_0xc19fdc);const _0x1878ca=this['bindTemplate'];this['listWrapperView']=new ut(_0xc19fdc,_0x17631c),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':K(_0xc19fdc,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']],'on':{'mouseleave':_0x1878ca['to'](_0x8bd2ec=>{const _0x591de2=_0x8bd2ec,_0x317c3f=document['querySelector']('.ck-presence-list__list'),_0x42e2a2=document['querySelector']('.ck-balloon-panel_with-arrow');_0x317c3f?.['contains'](_0x591de2['relatedTarget'])||_0x42e2a2?.['contains'](_0x591de2['relatedTarget'])||this['fire']('presencelist:hide');})}});}}class ut extends _0x40026c{constructor(_0x3f702e,_0x561c94){super(_0x3f702e);const _0x5db6e7=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0x561c94?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0x5db6e7['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0x5db6e7['to']('role'),'aria-label':_0x5db6e7['to']('ariaLabel'),'aria-labelledby':_0x5db6e7['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0x44c7ea['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0x54e1f1=this['element'];_0x54e1f1&&(this['_isScrollable']=Math['max'](_0x54e1f1['scrollHeight'],_0x54e1f1['clientHeight'])>0.8*window['innerHeight']);}}class j extends et{['userView'];constructor(_0x273e77,_0x14a404,_0x287439){super(_0x273e77);const _0x5397a2=this['bindTemplate'];this['userView']=new st(_0x273e77,_0x14a404);const _0x53339a={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0x14a404['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0x14a404['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x14a404['color']['getBackgroundColorClass']()],'aria-hidden':'true'}}]};_0x287439&&(_0x53339a['tag']='button',_0x53339a['on']={'click':_0x5397a2['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x53339a);}['focus'](){this['element']['focus']();}}class A extends _0x31d797{['userView'];['markerView'];constructor(_0x34ba6f,_0x466ff6,_0x37f208){super(_0x34ba6f);const _0x492e59=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new st(_0x34ba6f,_0x466ff6),this['markerView']=new ot(_0x34ba6f,_0x466ff6);const _0x4e9025=new it(_0x34ba6f);_0x4e9025['template']['tag']='span',_0x4e9025['text']=_0x466ff6['name'];const _0x2ed7d8={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0x492e59['to']('isFocusable',_0x52f844=>!!_0x52f844&&0x0),'aria-labelledby':_0x4e9025['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0x492e59['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0x492e59['to']('hasTooltip',_0xd296fe=>!_0xd296fe),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0x4e9025]};_0x37f208&&(_0x2ed7d8['tag']='button',_0x2ed7d8['on']={'click':_0x492e59['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x2ed7d8);}}class ot extends _0x31d797{constructor(_0x2b5a1e,_0x25bcd1){super(_0x2b5a1e),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x25bcd1['color']['getBackgroundColorClass']()],'aria-hidden':'true'}});}}const x={'collapseAt':0x6,'displayMe':!0x0};class r extends _0x3fd05c{['currentDisplayedUsers'];['balloonPanelView'];['view'];['presenceDropdownView'];['_bodyCollection']=null;static get['pluginName'](){return'PresenceListUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x37feee){super(_0x37feee),this['context']['config']['define']('presenceList',x);const _0x388a89=_0x37feee['config']['get']('presenceList.collapseAt');if('number'!=typeof _0x388a89)throw new _0x1cfd0a('presencelist-collapseat-invalid-format',this);if(_0x388a89<0x1)throw new _0x1cfd0a('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](i)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0xae27f4(),this['balloonPanelView']=new _0x4722b0(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get['requires'](){return[i];}['init'](){for(const _0x30b61 of this['_allConnectedUsers'])this['_handleUserAdd'](_0x30b61);this['listenTo'](this['_allConnectedUsers'],'add',(_0x598bae,_0x2a2c5c)=>{this['_handleUserAdd'](_0x2a2c5c);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0x3a7fcf,_0x1fd810)=>{this['_handleUserRemove'](_0x1fd810);});}['_createView'](){const _0x580fd2=this['context'],_0x6741ab=new v(this['context']['locale'],this['context']['config']['get']('presenceList.collapseAt')),_0x531baa=this['balloonPanelView'];if(!_0x5b93fd(_0x580fd2['config']['get']('presenceList.container')))throw new _0x1cfd0a('presencelist-missing-container',this);return _0x6741ab['counterView']['bind']('usersCount')['to'](this),_0x6741ab['bind']('isCollapsed')['to'](this,'usersCount',_0x104d8c=>{const {collapseAt:_0x23608d}=_0x580fd2['config']['get']('presenceList'),_0x3e57a5=_0x104d8c>=_0x23608d;if(_0x3e57a5&&!_0x6741ab['inlineListView']['items']['find'](_0x2e0a73=>_0x2e0a73 instanceof b)){const _0xa3ab8d=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['currentDisplayedUsers']['length']==_0xa3ab8d&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](this['currentDisplayedUsers']['length']-0x1),_0x6741ab['inlineListView']['items']['add'](_0x6741ab['counterView']);}return _0x3e57a5||this['hideDropdown'](),_0x3e57a5;}),_0x6741ab['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0x1beb7a=>{const _0x15108a=_0x580fd2['config']['get']('presenceList'),_0x5216f5=new A(_0x580fd2['locale'],_0x1beb7a,!!_0x15108a['onClick']);return _0x5216f5['bind']('hasTooltip')['to'](_0x6741ab,'isCollapsed',_0xd200c5=>!_0xd200c5),_0x5216f5['bind']('isFocusable')['to'](_0x6741ab,'isCollapsed',_0x2db848=>!_0x2db848),_0x15108a['onClick']&&this['listenTo'](_0x5216f5,'execute',()=>{this['view']['isCollapsed']||_0x15108a['onClick'](_0x1beb7a,_0x5216f5['element']);}),_0x5216f5;}),this['listenTo'](_0x6741ab['inlineListView'],'presencelist:show',()=>{this['view']['isCollapsed']&&this['showDropdown']();}),this['listenTo'](_0x6741ab['inlineListView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();}),_0x6741ab['inlineListView']['keystrokes']['set']('Enter',(_0x67844b,_0x11f036)=>{this['view']['isCollapsed']&&(this['showDropdown'](),_0x11f036());}),_0x6741ab['render'](),_0x531baa['render'](),_0x1e72d8({'emitter':_0x6741ab,'activator':()=>_0x531baa['isVisible'],'contextElements':[_0x531baa['element'],_0x6741ab['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0x580fd2['config']['get']('presenceList.container')['appendChild'](_0x6741ab['element']),this['_bodyCollection']=new _0x3befab(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_bodyCollection']['add'](this['balloonPanelView']),_0x6741ab;}['_handleUserAdd'](_0x7f2576){if(!this['context']['config']['get']('presenceList.displayMe')&&_0x7f2576['isMe'])return;const _0x35f3d0=this['context']['config']['get']('presenceList.collapseAt')-0x1;for(this['usersCount']++;this['currentDisplayedUsers']['length']>=_0x35f3d0-(this['view']['isCollapsed']?0x1:0x0)&&this['currentDisplayedUsers']['length']>0x1;)this['currentDisplayedUsers']['remove'](0x1);const _0x1e31c1=_0x7f2576['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0x7f2576,_0x1e31c1);}['_handleUserRemove'](_0x57fda3){this['usersCount']--;const {collapseAt:_0x29a673}=this['context']['config']['get']('presenceList'),_0x3e0fb3=this['usersCount']>=_0x29a673;if(this['currentDisplayedUsers']['get'](_0x57fda3['id']))this['currentDisplayedUsers']['remove'](_0x57fda3['id']);else{if(_0x3e0fb3&&this['currentDisplayedUsers']['length']+0x1===_0x29a673-0x1)return;}if(this['currentDisplayedUsers']['length']+(_0x3e0fb3?0x1:0x0)<this['usersCount']){for(const _0x3cc8e6 of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0x3cc8e6['id'])&&(this['currentDisplayedUsers']['add'](_0x3cc8e6,Math['min'](this['currentDisplayedUsers']['length']-(_0x3e0fb3?0x1:0x0),0x1)),this['currentDisplayedUsers']['length']+(_0x3e0fb3?0x1:0x0)===_0x29a673-0x1))return;}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0x3890a1=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new L(this['context']['locale'],!!_0x3890a1['onClick']),this['view']['inlineListView']['isExpanded']=!0x0,this['listenTo'](this['presenceDropdownView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();});const {listWrapperView:_0x53e9e0}=this['presenceDropdownView'];_0x53e9e0['items']['bindTo'](this['_allConnectedUsers'])['using'](_0x637a53=>{if(!_0x3890a1['displayMe']&&_0x637a53['isMe'])return null;const _0x213138=new j(this['context']['locale'],_0x637a53,!!_0x3890a1['onClick']);return _0x3890a1['onClick']&&this['listenTo'](_0x213138,'execute',()=>{_0x3890a1['onClick'](_0x637a53,_0x213138['element']);}),_0x213138;}),this['balloonPanelView']['content']['add'](this['presenceDropdownView']),this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element']}),_0x53e9e0['focus'](),_0x53e9e0['checkIfScrollable']();const _0x5eecb8=(_0x59e858,_0x19814d)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0x19814d();};_0x53e9e0['keystrokes']['set']('Esc',_0x5eecb8),_0x53e9e0['keystrokes']['set']('Shift+Tab',_0x5eecb8),_0x53e9e0['keystrokes']['set']('Tab',(_0xeed191,_0x16dcb2)=>{!function(_0x2fe709){const _0xaf540=['a','button','input','select','textarea','[tabindex]','[contenteditable]']['map'](_0x47dba8=>_0x47dba8+':not([disabled]):not([tabindex=\x22-1\x22])')['join'](','),_0x3024d2=[...document['body']['querySelectorAll'](_0xaf540)]['filter'](_0x22e6fd=>_0x22e6fd===document['activeElement']||_0x22e6fd['offsetWidth']+_0x22e6fd['offsetHeight']>0x0)['sort']((_0x429fe8,_0x304a91)=>(_0x429fe8['tabIndex']||0x0)-(_0x304a91['tabIndex']||0x0)),_0x47182c=_0x3024d2['indexOf'](_0x2fe709),_0xa99fee=_0x3024d2[(_0x47182c+0x1)%_0x3024d2['length']];_0xa99fee&&_0xa99fee['focus']();}(this['view']['element']),this['hideDropdown'](),_0x16dcb2();}),_0x53e9e0['focusTracker']['add'](this['view']['element']),_0x53e9e0['focusTracker']['on']('change:isFocused',(_0x33aeeb,_0x5af8bf,_0x23177d)=>{_0x23177d||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 ft extends _0x3fd05c{static get['requires'](){return[i,r];}static get['pluginName'](){return'PresenceList';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}export{s as CloudServicesCommentsAdapter,c as CloudServicesRevisionHistoryAdapter,m as CloudServicesTrackChangesAdapter,ft as PresenceList,r as PresenceListUI,l as RealTimeCollaborationClient,g as RealTimeCollaborativeComments,a as RealTimeCollaborativeEditing,dt as RealTimeCollaborativeRevisionHistory,lt as RealTimeCollaborativeTrackChanges,i as Sessions,n as WebSocketGateway};
|
|
23
|
+
import{ContextPlugin as _0x77b109,Plugin as _0x4216e6,PendingActions as _0x736766,Context as _0x297d04}from'@ckeditor/ckeditor5-core/dist/index.js';import{DomEmitterMixin as _0x89c488,CKEditorError as _0x2c6f5e,Collection as _0x130090,global as _0x394bfc,version as nt,uid as _0x1f53b8,KeystrokeHandler as _0x2cea49}from'@ckeditor/ckeditor5-utils/dist/index.js';import{Notification as _0x47f2c1,View as _0x1f794e,ListView as _0x5c2ac1,ListItemView as rt,LabelView as ot,BalloonPanelView as _0x3b1622,clickOutsideHandler as _0x36837a,BodyCollection as _0xd9147d}from'@ckeditor/ckeditor5-ui/dist/index.js';import{ModelLiveRange as _0x372fd9,History as _0x5d359f,NoOperation as _0x5301fb,InsertOperation as _0x4091fe,MarkerOperation as _0x24b5ac,RootAttributeOperation as _0x2e17b6,transformOperationSets as _0x568b8c,OperationFactory as _0xb3bcba}from'@ckeditor/ckeditor5-engine/dist/index.js';import{WebSocketGateway as ht,WEB_SOCKET_GATEWAY_STATES as te,CollaborativeEditingService as _0x50807a,User as lt,CommentsService as _0x3e3b54,TrackChangesService as et,RevisionHistoryService as it,EditorService as tt}from'@ckeditor/ckeditor-cloud-services-collaboration/dist/index.js';import{Users as _0x328575,UserView as ct}from'ckeditor5-collaboration/dist/index.js';import{Compressor as _0xf671e3}from'@ckeditor/ckeditor5-operations-compressor/dist/index.js';import{isElement as _0x2dfc6f}from'es-toolkit/compat';class n extends _0x77b109{static ['WebSocketGateway']=/* #__PURE__ -- @preserve */
|
|
24
|
+
((()=>ht)());static ['initialReconnectionInterval']=0x3e8;['connection'];['_reconnectionStack'];['_shouldPluginsReconnect'];['_domEmitter'];static get['requires'](){return['CloudServices',_0x47f2c1];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x39c199){super(_0x39c199),this['set']('state',te['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=new(_0x89c488())();}['init'](){const _0x205b67=this['context'],_0x5f29f3=_0x205b67['plugins']['get']('CloudServices'),_0x58fab5=_0x205b67['plugins']['get'](_0x47f2c1);if(!_0x5f29f3['token'])throw new _0x2c6f5e('websocketgateway-missing-token',this);if(!_0x5f29f3['webSocketUrl'])throw new _0x2c6f5e('websocketgateway-missing-websocket-url',this);return this['_domEmitter']['listenTo'](window,'offline',()=>this['_isBrowserOffline']=!0x0),this['_domEmitter']['listenTo'](window,'online',()=>this['_isBrowserOffline']=!0x1),this['context']['config']['define']('cloudServices.connectionTimeout',0xa),this['context']['config']['define']('cloudServices.requestTimeout',0x14),n['WebSocketGateway']['connect'](_0x5f29f3['token'],_0x5f29f3['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0x2684dc=>{if(this['connection']=_0x2684dc,this['bind']('state')['to'](_0x2684dc,'state',this,'_isBrowserOffline',(_0x48ea71,_0x27f9bf)=>('connected'!==_0x48ea71&&(this['_shouldPluginsReconnect']=!0x0),_0x27f9bf||_0x48ea71!==te['CONNECTED']?te['DISCONNECTED']:this['state']==te['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),te['CONNECTING']):te['CONNECTED'])),this['connection']['on']('error',(_0x7215a9,_0x5bfd1e)=>{if('limitExceeded'!==_0x5bfd1e['code'])throw console['error'](_0x5bfd1e),new _0x2c6f5e('cloudservices-init',null,{'originalError':_0x5bfd1e});_0x58fab5['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'});}),!_0x2684dc['me'])return new Promise(_0x3815de=>_0x2684dc['on']('change:me',_0x3815de));})['catch'](_0x1a933f=>{throw console['error'](_0x1a933f),new _0x2c6f5e('cloudservices-init',null,{'originalError':_0x1a933f});});}['addToReconnectionStack'](_0x313900){if('function'!=typeof _0x313900['reconnect'])throw new _0x2c6f5e('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0x313900))throw new _0x2c6f5e('websocketgateway-plugin-already-registered',this,{'name':_0x313900['constructor']['pluginName']});this['_reconnectionStack']['add'](_0x313900);}['removeFromReconnectionStack'](_0x25c02d){this['_reconnectionStack']['delete'](_0x25c02d);}['isInReconnectionStack'](_0x5e31c1){return this['_reconnectionStack']['has'](_0x5e31c1);}['_reconnect'](){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0x20caa2=>_0x20caa2['reconnect']())))['then'](()=>this['state']=te['CONNECTED'])['catch'](_0x54dc01=>{throw console['error'](_0x54dc01),new _0x2c6f5e('cloudservices-reconnection-error',this['context']);});}['disconnect'](){this['connection']&&this['connection']['disconnect'](),this['state']=te['DISCONNECTED'],this['_domEmitter']['stopListening']();}['destroy'](){this['disconnect'](),super['destroy']();}}class i extends _0x77b109{['channelSessions'];['channelConnectedUsers'];['allConnectedUsers'];['_registeredSessions'];['_uniqueUsersCount'];['_users'];static get['pluginName'](){return'Sessions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}static get['requires'](){return[n,_0x328575];}constructor(_0xd2eb33){super(_0xd2eb33),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0x130090(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x328575);}['init'](){const _0x40c062=this['context']['plugins']['get'](n);this['listenTo'](_0x40c062,'change:state',(_0x59ce55,_0x48f848,_0x116f49)=>{if('connected'!==_0x116f49)this['channelSessions']['forEach'](_0x508065=>_0x508065['clear']()),this['channelConnectedUsers']['forEach'](_0x428bb9=>_0x428bb9['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x48f39b,_0x39e74d]of this['_registeredSessions'])for(const _0x1c640a of _0x39e74d)this['_handleSessionAdd'](_0x48f39b,_0x1c640a);}}),this['_createUser'](_0x40c062['connection']['me'],!0x0);}['register'](_0x483620,_0x1ea33e){if(this['_registeredSessions']['has'](_0x483620))throw new _0x2c6f5e('sessions-register-already-registered',null,{'channelId':_0x483620});this['_registeredSessions']['set'](_0x483620,_0x1ea33e),this['channelSessions']['set'](_0x483620,new _0x130090()),this['channelConnectedUsers']['set'](_0x483620,new _0x130090()),this['listenTo'](_0x1ea33e,'add',(_0x2e70d8,_0x4694ee)=>this['_handleSessionAdd'](_0x483620,_0x4694ee)),this['listenTo'](_0x1ea33e,'remove',(_0x4bae58,_0x33d27e)=>this['_handleSessionRemove'](_0x483620,_0x33d27e));for(const _0x2426e5 of _0x1ea33e)this['_handleSessionAdd'](_0x483620,_0x2426e5);}['unregister'](_0x44b97e){if(!this['_registeredSessions']['has'](_0x44b97e))throw new _0x2c6f5e('sessions-unregister-not-exist',null,{'channelId':_0x44b97e});const _0x2ae140=this['_registeredSessions']['get'](_0x44b97e);this['stopListening'](_0x2ae140);for(const _0x562ed4 of _0x2ae140)'connected'===this['context']['plugins']['get'](n)['state']&&this['_handleSessionRemove'](_0x44b97e,_0x562ed4);this['_registeredSessions']['delete'](_0x44b97e),this['channelSessions']['delete'](_0x44b97e),this['channelConnectedUsers']['delete'](_0x44b97e);}get['mySessionId'](){return this['context']['plugins']['get'](n)['connection']['sessionId'];}['getUserBySessionId'](_0x128fe9){for(const _0xdb8f6f of this['channelSessions']['values']())for(const _0x315f3d of _0xdb8f6f)if(_0x315f3d['id']===_0x128fe9)return _0x315f3d['user'];}['getUserSessions'](_0x1fcbb2,_0x1bf517){const _0x21397b=_0x1bf517?[this['channelSessions']['get'](_0x1bf517)]:this['channelSessions']['values'](),_0x111937=new Set();for(const _0x156227 of _0x21397b)for(const _0x425826 of _0x156227)_0x425826['user']['id']===_0x1fcbb2['id']&&_0x111937['add'](_0x425826['id']);return _0x111937;}['getUserRole'](_0x4eebb1){for(const _0x425fe1 of this['channelSessions']['values']())for(const _0x1268c6 of _0x425fe1)if(_0x1268c6['user']===_0x4eebb1)return _0x1268c6['role'];}['_handleSessionAdd'](_0x5f0c38,_0x33298b){if('connected'!==this['context']['plugins']['get'](n)['state'])return;const _0x4a2132=_0x33298b['user'],_0x2ddfe7=this['_users']['getUser'](_0x4a2132['id'])||this['_createUser'](_0x4a2132),_0x8b3ded=Object['assign']({},_0x33298b,{'user':_0x2ddfe7});if(this['channelSessions']['get'](_0x5f0c38)['add'](_0x8b3ded),!_0x4a2132['hiddenInPresenceList']){const _0x203f87=this['channelConnectedUsers']['get'](_0x5f0c38);_0x203f87['has'](_0x2ddfe7['id'])||_0x203f87['add'](_0x2ddfe7),this['allConnectedUsers']['has'](_0x2ddfe7['id'])||_0x4a2132['hiddenInPresenceList']||this['allConnectedUsers']['add'](_0x2ddfe7,_0x2ddfe7['isMe']?0x0:void 0x0);}this['fire']('sessionAdd:'+_0x5f0c38,{'channelId':_0x5f0c38,'session':_0x8b3ded});}['_handleSessionRemove'](_0x78d7c9,_0x592cc4){if('connected'!==this['context']['plugins']['get'](n)['state'])return;const _0x10a399=this['channelConnectedUsers']['get'](_0x78d7c9),_0x36d70c=_0x592cc4['user'];_0x36d70c['id']&&(this['channelSessions']['get'](_0x78d7c9)['remove'](_0x592cc4['id']),_0x10a399['has'](_0x36d70c['id'])&&!this['getUserSessions'](_0x36d70c,_0x78d7c9)['size']&&_0x10a399['remove'](_0x36d70c['id']),this['allConnectedUsers']['get'](_0x36d70c['id'])&&!this['getUserSessions'](_0x36d70c)['size']&&this['allConnectedUsers']['remove'](_0x36d70c['id']));}['_createUser'](_0x323171,_0x5be5c6){const _0x5d3bbc=this['_users']['addUser'](_0x323171);return _0x5be5c6&&this['_users']['defineMe'](_0x323171['id']),_0x5d3bbc['orderNumber']=this['_uniqueUsersCount']++,_0x5d3bbc;}}class V extends _0x4216e6{['_domEmitter']=new(_0x89c488())();static get['requires'](){return[i];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x1b1a62=this['editor'],_0x5334fe=_0x1b1a62['plugins']['get'](i);_0x1b1a62['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x155158,{writer:_0x1122be})=>function(_0x2ffed4,_0x4f346f,_0x287a1f,_0x206b66){const _0x35677a=_0x2ffed4['markerName']['split'](':')[0x2],_0x552d4a=_0x287a1f['getUserBySessionId'](_0x35677a);if(!_0x552d4a||_0x35677a===_0x287a1f['mySessionId'])return;if(!_0x206b66['model']['schema']['checkChild'](_0x2ffed4['markerRange']['start'],'$text'))return;const _0x52cb19={'class':'ck-user__marker\x20'+_0x552d4a['color']['getMarkerClass'](),'data-name':_0x552d4a['name'],'data-session-id':_0x35677a},_0x33d445=_0x206b66['model']['markers']['get'](_0x2ffed4['markerName']),_0x20c87e=_0x33d445['getStart'](),_0x191aae=_0x20c87e['nodeAfter'],_0x34eb19=_0x206b66['model']['schema'];if(_0x191aae&&_0x34eb19['isObject'](_0x191aae)&&_0x34eb19['isInline'](_0x191aae)&&!_0x206b66['model']['markers']['get']('user:range:'+_0x35677a)['getRange']()['isCollapsed'])return;const _0x251650=_0x20c87e['parent'];return _0x206b66['model']['schema']['isLimit'](_0x251650)&&!_0x206b66['model']['hasContent'](_0x251650)&&(_0x52cb19['contenteditable']=!0x1),function(_0x59642f,_0xbba189,_0x57231c){const _0x1d54ca=_0x59642f['createUIElement']('span',_0xbba189);return _0x59642f['setCustomProperty']('userPositionMarker',!0x0,_0x1d54ca),_0x1d54ca['render']=function(_0x10a19d){const _0x458412=this['toDomElement'](_0x10a19d),_0x386c92=document['createElement']('span');return _0x386c92['classList']['add']('ck-user__marker-tooltip'),_0x386c92['setAttribute']('contenteditable','false'),_0x386c92['setAttribute']('spellcheck','false'),_0x386c92['textContent']=_0x57231c['name'],_0x458412['innerHTML']='<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span>'+_0x386c92['outerHTML']+'',_0x458412['addEventListener']('mouseenter',()=>{_0x458412['classList']['add']('ck-user__marker_hovered');}),_0x458412['addEventListener']('mouseleave',()=>{_0x458412['classList']['remove']('ck-user__marker_hovered');}),_0x458412;},_0x1d54ca['isSimilar']=function(_0x3f9c48){return!(!this['getCustomProperty']('userPositionMarker')||!_0x3f9c48['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0x3f9c48['getAttribute']('data-session-id'));},_0x1d54ca;}(_0x4f346f,_0x52cb19,_0x552d4a);}(_0x155158,_0x1122be,_0x5334fe,_0x1b1a62)}),_0x1b1a62['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0x4f8561=>function(_0x3f4c71,_0x2520a8){const _0x3e9c91=_0x3f4c71['markerName']['split'](':')[0x2];if(_0x3e9c91===_0x2520a8['mySessionId'])return null;const _0x36e84a=_0x2520a8['getUserBySessionId'](_0x3e9c91);if(!_0x36e84a)return{'id':_0x3e9c91,'classes':[]};return{'id':_0x3e9c91,'classes':['ck-user__selection',_0x36e84a['color']['getSelectionClass']()],'attributes':{'data-session-id':_0x3e9c91},'priority':0x7d0+_0x36e84a['orderNumber']};}(_0x4f8561,_0x5334fe)}),function(_0x563863){const _0x45ba46=_0x563863['model'],_0x243f8a=new Map(),_0x2fa2c3=_0x563863['plugins']['get'](i);_0x45ba46['markers']['on']('update:user:range',(_0x5c9f2b,_0x2f26ab,_0x4f9b11,_0x1263c6)=>{if(!_0x1263c6&&_0x243f8a['get'](_0x2f26ab['name']))return _0x243f8a['get'](_0x2f26ab['name'])['detach'](),void _0x243f8a['delete'](_0x2f26ab['name']);const _0x4980f9=_0x2f26ab['name']['split'](':')[0x2];if(_0x4980f9===_0x2fa2c3['mySessionId'])return;const _0x4dc6c1='user:position:'+_0x4980f9;_0x45ba46['markers']['has'](_0x4dc6c1)&&_0x563863['editing']['reconvertMarker'](_0x4dc6c1),_0x2f26ab['on']('change:range',(_0x2d39dd,_0x180b0e,_0x4a21ff)=>{if('$graveyard'!=_0x180b0e['root']['rootName']&&'$graveyard'==_0x2f26ab['getRange']()['root']['rootName']&&!_0x243f8a['has'](_0x2f26ab['name'])){const _0x33ed74=_0x45ba46['schema']['getNearestSelectionRange'](_0x4a21ff['deletionPosition']);if(_0x33ed74){const _0x491b51=_0x372fd9['fromRange'](_0x33ed74);_0x243f8a['set'](_0x2f26ab['name'],_0x491b51),_0x491b51['on']('change:range',(_0x3f6eb3,_0x48a5a6,_0x1f7ed2)=>{if('$graveyard'==_0x491b51['root']['rootName']){const _0xa75379=_0x45ba46['schema']['getNearestSelectionRange'](_0x1f7ed2['deletionPosition']);_0xa75379?(_0x491b51['start']=_0xa75379['start'],_0x491b51['end']=_0xa75379['end']):(_0x243f8a['delete'](_0x2f26ab['name']),_0x491b51['detach']());}});}}});}),_0x45ba46['document']['on']('change',()=>{_0x243f8a['size']>0x0&&_0x45ba46['enqueueChange']({'isUndoable':!0x1},_0x1ad3bc=>{for(const [_0x49c7d0,_0x33c89d]of _0x243f8a)'$graveyard'==_0x45ba46['markers']['get'](_0x49c7d0)['getRange']()['root']['rootName']&&(Z(_0x49c7d0['split'](':')[0x2],_0x33c89d['toRange'](),_0x45ba46,_0x1ad3bc),_0x33c89d['detach']());_0x243f8a['clear']();});});}(_0x1b1a62),this['_domEmitter']['listenTo'](_0x394bfc['document'],'keydown',(_0x3874f5,{key:_0x27f3c5})=>{'Escape'===_0x27f3c5&&function(_0x47ee66){_0x47ee66['editing']['view']['change'](_0x24ea89=>{for(const _0x474646 of _0x47ee66['model']['markers']){if(!_0x474646['name']['startsWith']('user:position'))continue;const _0x15d84a=_0x47ee66['editing']['mapper']['markerNameToElements'](_0x474646['name']);if(_0x15d84a){for(const _0x5964e9 of _0x15d84a)_0x24ea89['removeClass']('ck-user__marker_hovered',_0x5964e9);}}});}(_0x1b1a62);},{'useCapture':!0x0});}['afterInit'](){const _0x37f901=this['editor'],_0x3d7b05=_0x37f901['commands']['get']('undo');_0x3d7b05&&_0x37f901['model']['on']('applyOperation',(_0xc182e3,_0x168acb)=>{const _0xc7cd4b=_0x168acb[0x0];if(!_0xc7cd4b['isDocumentOperation'])return;if('marker'!=_0xc7cd4b['type']||!_0xc7cd4b['name']['startsWith']('user:'))return;const _0x3a93ea=_0xc7cd4b['batch'];_0x3d7b05['_createdBatches']['has'](_0x3a93ea)&&(_0xc7cd4b['newRange']=_0xc7cd4b['oldRange']?_0x37f901['model']['createRange'](_0xc7cd4b['oldRange']['start'],_0xc7cd4b['oldRange']['end']):null);},{'priority':'highest'});}['destroy'](){return this['_domEmitter']['stopListening'](),super['destroy']();}['createUserMarkerOperations'](){const _0x4ea9d2=this['editor'],_0x2bc507=_0x4ea9d2['model']['document'],_0x40bbeb=_0x4ea9d2['plugins']['get'](i);_0x4ea9d2['model']['enqueueChange']({'isUndoable':!0x1},_0x3928c7=>{const _0x28a081='user:range:'+_0x40bbeb['mySessionId'],_0x40036e='user:position:'+_0x40bbeb['mySessionId'],_0x5cc305=_0x4ea9d2['model']['markers']['has'](_0x28a081);_0x4ea9d2['editing']['view']['hasDomSelection']?Z(_0x40bbeb['mySessionId'],_0x2bc507['selection']['getFirstRange'](),_0x4ea9d2['model'],_0x3928c7):_0x5cc305&&(_0x3928c7['removeMarker'](_0x28a081),_0x3928c7['removeMarker'](_0x40036e));});}}function Z(_0x160303,_0xe0b8b2,_0x2325d1,_0x2369c2){const _0x136354='user:range:'+_0x160303,_0x2d8e92='user:position:'+_0x160303,_0x453b91=_0xe0b8b2['getContainedElement']();let _0x2e2ed3=_0xe0b8b2['start'];if(_0x453b91&&_0x453b91['is']('element','tableCell')){const _0x4475e9=function(_0x1790ca,_0x529783){for(const _0x33a715 of _0x1790ca['getPositions']())if(_0x529783['schema']['checkChild'](_0x33a715,'$text'))return _0x33a715;}(_0xe0b8b2,_0x2325d1);_0x4475e9&&(_0x2e2ed3=_0x4475e9,_0xe0b8b2=_0x2369c2['createRange'](_0x2e2ed3));}const _0x32bfa6=_0x2369c2['createRange'](_0x2e2ed3);_0x2325d1['markers']['has'](_0x136354)?(_0x2369c2['updateMarker'](_0x136354,{'range':_0xe0b8b2}),_0x2369c2['updateMarker'](_0x2d8e92,{'range':_0x32bfa6})):(_0x2369c2['addMarker'](_0x136354,{'range':_0xe0b8b2,'usingOperation':!0x0}),_0x2369c2['addMarker'](_0x2d8e92,{'range':_0x32bfa6,'usingOperation':!0x0}));}function W(_0x195e07,_0x2bd653,_0x1221f8){const _0x289133=_0x195e07['t'],t=_0x195e07['t'];switch(_0x2bd653){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 _0x289133({'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'},_0x1221f8);default:return'';}}let G=0x1;class l extends _0x4216e6{static ['CollaborativeEditingService']=/* #__PURE__ -- @preserve */
|
|
25
|
+
((()=>_0x50807a)());['_offset'];['sessionId'];['serverHistory'];['_channelId'];['_service'];['_document'];['_compressor'];['_bufferedOperations'];['_knownOperations'];['_knownRootNames'];['_pendingAction'];['_hasSelectionChanged'];['_sendBufferedOperationsDelayId'];['_baseBufferDelay'];['_currentBufferDelay'];['_lastSyncedOperationId'];['_disconnectionOperations'];['_operationIdentifier'];static get['requires'](){return[n,i,V,_0x736766,_0x328575,_0x47f2c1];}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 _0x31b4c6=this['serverHistory']['getOperations']();for(let _0x4f4124=_0x31b4c6['length']-0x1;_0x4f4124>=0x0;_0x4f4124--){const _0x5da909=_0x31b4c6[_0x4f4124];if(!this['_disconnectionOperations']['has'](_0x5da909))return _0x5da909['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0x36cc2c){if(super(_0x36cc2c),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x5d359f(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0x2c6f5e('collaboration-missing-channelid',this);const _0xb2ab2a=_0x36cc2c['config']['get']('cloudServices.bundleVersion')||nt;this['_service']=new l['CollaborativeEditingService'](_0xb2ab2a,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0xf671e3(),this['_bufferedOperations']=[],this['_knownOperations']=new WeakSet(),this['_knownRootNames']=new Set(),this['set']('_isPendingUpdate',!0x1),this['set']('_hasSynchronizationProblem',!0x1),this['_pendingAction']=null,this['_hasSelectionChanged']=!0x1,this['_sendBufferedOperationsDelayId']=null,this['_baseBufferDelay']=0x12c,this['_currentBufferDelay']=this['_baseBufferDelay'],this['_lastSyncedOperationId']=null,this['_disconnectionOperations']=new WeakSet(),this['_operationIdentifier']=new J(this['_disconnectionOperations']);}['init'](){const _0x5da708=this['editor'],_0xb9a8e0=_0x5da708['plugins']['get'](_0x328575),_0x8cc077=_0x5da708['plugins']['get'](n);this['listenTo'](_0xb9a8e0,'getOperationAuthor',(_0x109c8b,_0x2e0e10)=>{const _0x539cb4=_0x2e0e10[0x0];_0x539cb4['_authorId']&&(_0x109c8b['return']=_0xb9a8e0['getUser'](_0x539cb4['_authorId']),_0x109c8b['stop']()),null===_0x539cb4['_authorId']&&(_0x109c8b['return']=null,_0x109c8b['stop']());},{'priority':'high'}),this['listenTo'](_0x5da708['model']['document']['selection'],'change:range',(_0x4a2b85,_0x1d0ecc)=>{_0x1d0ecc['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x5da708['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x5da708['model']['on']('applyOperation',(_0x2703f4,_0x397630)=>{const _0x9368b3=_0x397630[0x0];_0x9368b3['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0x9368b3),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['bind']('_isEditingAllowed')['to'](_0x8cc077,'state',this,'_hasSynchronizationProblem',(_0x174324,_0xf8c5b1)=>'connected'===_0x174324&&!_0xf8c5b1),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x5da708['disableReadOnlyMode']('rtc-offline'):_0x5da708['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x5da708['disableReadOnlyMode']('rtc-offline'):_0x5da708['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async['reconnect'](){const _0x4c2a57=this['editor']['plugins']['get'](i),_0x5be7a0=this['editor']['plugins']['get'](n);try{this['_isPendingUpdate']=!0x0,_0x4c2a57['unregister'](this['_channelId']);const _0x3cda45=await this['_service']['reconnect'](_0x5be7a0['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0x3cda45)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x1bb71a=await this['_service']['getConnectedSessions']();_0x4c2a57['register'](this['_channelId'],_0x1bb71a),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x2d21f6){if(function(_0x4cd7cf){return'404'===_0x4cd7cf['code'];}(_0x2d21f6)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0x74ff8e){return'409'===_0x74ff8e['code'];}(_0x2d21f6)){const _0x2dfeed=W(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'](_0x2dfeed);}else{if(!(_0x2d21f6 instanceof $))throw _0x2d21f6;this['_handleReconnectionError']();}}}}['destroy'](){const _0x476fc3=this['editor']['plugins']['get'](n),_0x19f1b8=this['editor']['plugins']['get'](i);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x19f1b8['channelSessions']['has'](this['_channelId'])&&_0x19f1b8['unregister'](this['_channelId']),_0x476fc3['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async['_handleReconnectionResponse'](_0x481c6e){if(this['sessionId']!==_0x481c6e['sessionId']&&this['_lastSyncedOperationId']!==_0x481c6e['lastOperationId'])throw new $();return this['sessionId']=_0x481c6e['sessionId'],this['_handleServerResponse']([],{..._0x481c6e,'wereChangesApplied':!0x1,'data':_0x481c6e['data']},'reconnect');}async['_connectService'](_0x570a2a,_0x22d8ca=!0x1){const {connection:_0x1cd116}=this['editor']['plugins']['get'](n);l['CollaborativeEditingService']['getConnectedSessions'](_0x1cd116,this['_channelId'])['then'](_0x49c5a9=>this['_initSessionsHandling'](_0x49c5a9))['catch'](_0x18b109=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x18b109);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x27eca4,_0xc8a016)=>{this['_crash']('realtimecollaborationclient-init-service-internal-error',_0xc8a016);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_isConnected']=!0x1;});const _0x563d09=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x570a2a);this['_isPendingUpdate']=!0x0;const _0x3ed37f=await this['_service']['connect'](_0x1cd116,this['_compressOperations'](_0x570a2a),_0x563d09);if(this['sessionId']=_0x3ed37f['sessionId'],_0x22d8ca){if(!_0x3ed37f['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x3ed37f['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0x570a2a,_0x3ed37f,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x3ed37f,_0x570a2a);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}['_handleSendingSelectionMarkers'](){const _0x25e0fd=this['editor']['plugins']['get'](i),_0x5b2f7f=this['editor']['plugins']['get'](V),_0x280d3e=_0x25e0fd['channelSessions']['get'](this['_channelId']);_0x280d3e&&_0x280d3e['length']>0x1?_0x5b2f7f['createUserMarkerOperations']():this['listenTo'](_0x25e0fd,'sessionAdd:'+this['_channelId'],()=>{0x2===_0x25e0fd['channelSessions']['get'](this['_channelId'])['length']&&_0x5b2f7f['createUserMarkerOperations']();});}async['_handleReceivedOperations'](_0x234f89,_0x42cbb5,_0x286313,_0x370a10){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x42cbb5){const _0x55c82c=this['_decompressOperations'](_0x286313,_0x370a10);await this['_fetchMissingUsers'](_0x55c82c),this['_handleExternalOperations'](_0x55c82c,_0x42cbb5,_0x286313['lastOperationId'])||this['_crash']('realtimecollaborationclient-init-service-incorrect-server-operation');}}async['_connectAfterSessionHasBeenFlushed'](){this['_disconnectService']();const {locale:_0x37de68}=this['editor'];let _0x9ed4f;try{_0x9ed4f=await this['_service']['getDocumentDetails']();}catch{const _0x2d6f1d=W(_0x37de68,'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'](_0x2d6f1d);}const _0x40d152=_0x9ed4f['currentDocumentSession']||_0x9ed4f['lastDocumentSession'];if(this['_lastSyncedOperationId']!==_0x40d152['lastOperationId']){const _0x5e8760=W(_0x37de68,'The\x20last\x20saved\x20version\x20of\x20the\x20document\x20does\x20not\x20match\x20the\x20local\x20version.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.');return void this['_handleReconnectionError'](_0x5e8760);}await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);}['_disconnectService'](){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['stopListening'](this['_service']);}['_initSessionsHandling'](_0x15d7ad){const _0x37f848=this['editor']['plugins']['get'](i);this['listenTo'](_0x37f848,'sessionAdd:'+this['_channelId'],(_0x2fbf42,{session:_0x540629})=>{if(_0x540629['id']===_0x37f848['mySessionId']){_0x2fbf42['off']();const _0x183fec=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0x2bccf0=_0x540629['permissions'];_0x183fec&&_0x183fec['isEnabled']&&(_0x2bccf0=_0x2bccf0['filter'](_0x341df9=>'document:write'!==_0x341df9)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0x2bccf0,this['_channelId']);}}),_0x37f848['register'](this['_channelId'],_0x15d7ad);}['_initThrowingOnDataSet'](){const _0x5aaa66=this['editor']['data']['set'];this['editor']['data']['set']=(..._0x5c2ef6)=>{if(!_0x5c2ef6[_0x5c2ef6['length']-0x1]['suppressErrorInCollaboration'])throw new _0x2c6f5e('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x5aaa66['apply'](this['editor']['data'],_0x5c2ef6);};}['_setUpDataInit'](){this['editor']['data']['on']('init',(_0x7a8cc,[_0x2ec739])=>{if(this['_document']['version'])throw new _0x2c6f5e('realtimecollaborationclient-init-document-already-initialized',this);_0x7a8cc['stop'](),this['_setPendingAction']();const _0x357bf3=this['editor']['config']['get']('rootsAttributes'),_0x208337=this['_getOperationsFromInitData'](_0x2ec739,_0x357bf3);0x0==_0x208337['length']&&_0x208337['push'](new _0x5301fb(0x0)),_0x7a8cc['return']=this['_connectService'](_0x208337)['then'](()=>{this['editor']['plugins']['get'](n)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x329b08=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x329b08))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x3e3b71,[_0x1099f1,_0x46e89d])=>{_0x3e3b71['stop']();const _0xdb6fdb=this['editor']['model']['document']['getRoot'](_0x1099f1);if(!this['_knownRootNames']['has'](_0x1099f1)){const _0x52440a=_0x46e89d&&_0x46e89d['data']?_0x46e89d['data']:'',_0x54b114=_0x46e89d&&_0x46e89d['attributes']?_0x46e89d['attributes']:{};await this['_loadRoot'](_0x1099f1,_0x52440a,_0x54b114);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0xdb6fdb['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0xdb6fdb);});},{'priority':'high'});}async['_fetchMissingUsers'](_0x54eab1){const _0x4418ff=this['editor']['plugins']['get'](_0x328575),{connection:_0x6520d8}=this['editor']['plugins']['get'](n),_0x2463d8=new Set();for(const _0x19dd14 of _0x54eab1){const _0x9733f3=_0x19dd14['_authorId'];_0x9733f3&&!_0x4418ff['getUser'](_0x9733f3)&&_0x2463d8['add'](_0x9733f3);}if(0x0===_0x2463d8['size'])return;const _0x416d21=await lt['getMany'](_0x6520d8,Array['from'](_0x2463d8));for(const _0x6071fc of _0x416d21)_0x4418ff['getUser'](_0x6071fc['id'])||_0x4418ff['addUser'](_0x6071fc);}['_getOperationsFromInitData'](_0x2fe0e3,_0x166656={}){const _0x941754=this['editor']['model'],_0x2e5cdc=[];let _0x2c1751=0x0;const _0x3c2095='string'==typeof _0x2fe0e3?{'main':_0x2fe0e3}:_0x2fe0e3;for(const _0x522dbd of Object['keys'](_0x3c2095)){if(!this['_document']['roots']['has'](_0x522dbd))throw new _0x2c6f5e('realtimecollaborationclient-init-non-existent-root',this);const _0x104933=this['editor']['data']['parse'](_0x3c2095[_0x522dbd]),_0xfa22f4=this['_document']['getRoot'](_0x522dbd),_0x12f23a=new _0x4091fe(_0x941754['createPositionAt'](_0xfa22f4,0x0),_0x104933,_0x2c1751++);_0x2e5cdc['push'](_0x12f23a);for(const [_0x1cac91,_0x2f469c]of _0x104933['markers']){const _0x2615d2=_0x941754['createRange'](_0x941754['createPositionFromPath'](_0xfa22f4,_0x2f469c['start']['path']['slice']()),_0x941754['createPositionFromPath'](_0xfa22f4,_0x2f469c['end']['path']['slice']())),_0x120d0e=new _0x24b5ac(_0x1cac91,null,_0x2615d2,_0x941754['markers'],!0x0,_0x2c1751++);_0x2e5cdc['push'](_0x120d0e);}}if(_0x166656)for(const [_0x33d97c,_0x53764d]of Object['entries'](_0x166656)){const _0x2a30d7=_0x941754['document']['getRoot'](_0x33d97c);if(!_0x2a30d7)throw new _0x2c6f5e('multi-root-editor-root-attributes-no-root',null);for(const [_0x3f07d9,_0x15c7aa]of Object['entries'](_0x53764d))if(null!==_0x15c7aa){const _0x2acee7=new _0x2e17b6(_0x2a30d7,_0x3f07d9,null,_0x15c7aa,_0x2c1751++);_0x2e5cdc['push'](_0x2acee7);}}return _0x2e5cdc;}async['_loadRoot'](_0x3b14ea,_0xbc882d,_0x4126c9){this['_getOperationsFromInitData']({[_0x3b14ea]:_0xbc882d},{[_0x3b14ea]:_0x4126c9})['forEach']((_0x326bb0,_0x56be5b)=>{_0x326bb0['baseVersion']=this['_document']['version']+_0x56be5b,_0x326bb0['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x326bb0);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async['_handleInitialConnectionData'](_0x2831c2,_0x454746){let _0x222a75;this['_offset']=_0x2831c2['offset'];const _0x16088b=_0x2831c2['wereChangesApplied']&&!_0x2831c2['initData'],_0x3924cb=_0x16088b?0x0:_0x2831c2['data']['baseVersion'];if(_0x454746['forEach'](_0x1c7577=>{_0x1c7577['_isInit']=!0x0,_0x1c7577['createdAt']=_0x2831c2['sessionCreatedAt'],_0x1c7577['_authorId']=null;}),_0x16088b)_0x222a75=_0x454746,this['_applyOperationsSet'](_0x222a75,_0x16088b);else{if(_0x2831c2['initData']){const _0x470ae2=this['_getOperationsFromInitData'](_0x2831c2['initData']);this['_document']['history']['version']=-_0x470ae2['length'],_0x470ae2['forEach'](_0x1ac91f=>{_0x1ac91f['baseVersion']-=_0x470ae2['length'],_0x1ac91f['createdAt']=_0x2831c2['sessionCreatedAt'],_0x1ac91f['_isInit']=!0x0,_0x1ac91f['_authorId']=null;}),this['_applyOperationsSet'](_0x470ae2,!0x0),this['serverHistory']['version']=-_0x470ae2['length']+this['_offset'],this['_updateServerHistory'](_0x470ae2);}this['_document']['history']['version']=_0x3924cb,_0x222a75=this['_decompressOperations'](_0x2831c2['data'],_0x2831c2['metadata']),await this['_fetchMissingUsers'](_0x222a75),this['_applyOperationsSet'](_0x222a75,_0x16088b);}_0x2831c2['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x222a75,_0x2831c2['lastOperationId']),this['_lastSyncedOperationId']=_0x2831c2['lastOperationId']),this['serverHistory']['version']=_0x3924cb+this['_offset'],this['_updateServerHistory'](_0x222a75),_0x454746['filter'](_0x1fe59f=>{const _0x46202f=this['_getAffectedRoot'](_0x1fe59f);return _0x46202f&&!this['_knownRootNames']['has'](_0x46202f);})['forEach']((_0x4f19d6,_0x532cf0)=>{_0x4f19d6['baseVersion']=this['_document']['version']+_0x532cf0,this['_saveOperationInBuffer'](_0x4f19d6);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x5b076f,_0x579d62){const _0x24f740=_0x579d62&&_0x579d62['message'];if(_0x24f740&&_0x24f740['startsWith']('realtimecollaborationclient'))throw _0x579d62;const _0x3ee7eb=this['editor']['plugins']['get'](n);throw this['_isPendingUpdate']=!0x0,_0x3ee7eb['disconnect'](),this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0x2c6f5e(_0x5b076f,this['editor'],_0x24f740?{'originalError':_0x24f740}:void 0x0);}['_saveOperationInBuffer'](_0x328cee){this['_knownOperations']['has'](_0x328cee)||(this['_knownOperations']['add'](_0x328cee),this['_bufferedOperations']['push'](_0x328cee),this['_pendingAction']||'marker'==_0x328cee['type']&&!_0x328cee['affectsData']||this['_setPendingAction']());}['_sendBufferedOperationsDelayed'](_0x4f4928=!0x1){!_0x4f4928&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0xd93584=>{_0xd93584&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0x4db233=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0x2dcf82){return _0x2dcf82['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x2dcf82['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0x2dcf82['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0x4db233)||this['_crash'](_0x4db233['message'],_0x4db233);});},this['_currentBufferDelay']));}['_waitUntilSynced'](){return new Promise(_0x516236=>{this['on']('change:_isPendingUpdate',()=>{_0x516236();});});}async['_sendBufferedOperations'](){const _0x5a1f23=this['editor']['plugins']['get'](V);if(this['_shouldSendSelectionUpdate']()&&(_0x5a1f23['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x2cc1d9=[...this['_bufferedOperations']];for(const _0x34e428 of _0x2cc1d9)_0x34e428['wasUndone']=this['_document']['history']['isUndoneOperation'](_0x34e428);const _0xa47b5=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x2cc1d9),_0x4f550b=G++,_0x14093d=this['_compressOperations'](_0x2cc1d9),_0x2e6208=await this['_service']['sendOperations'](_0x14093d,_0x14093d['baseVersion'],_0xa47b5);try{return await this['_handleServerResponse'](_0x2cc1d9,_0x2e6208,_0x4f550b);}catch(_0x12bf55){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0x12bf55);}}async['_handleServerResponse'](_0xf8d8b3,_0x5ac57c,_0x5b0e1e){if('error'in _0x5ac57c)throw _0x5ac57c['error'];let _0x53b59f=!0x1;if(_0x5ac57c['wereChangesApplied']){_0x5ac57c['lastOperationId']&&(this['_lastSyncedOperationId']=_0x5ac57c['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x12514b=>!_0xf8d8b3['includes'](_0x12514b));for(const _0x39d10c of _0xf8d8b3)_0x39d10c['createdAt']='lastOperationAcceptedAt'in _0x5ac57c&&_0x5ac57c['lastOperationAcceptedAt']||void 0x0;K(_0xf8d8b3,_0x5ac57c['version']-_0xf8d8b3['length']),this['_updateServerHistory'](_0xf8d8b3);const _0x327abe=_0xf8d8b3['filter'](_0x361d0b=>{if(!_0x361d0b['_isInit'])return!0x1;const _0x3ea1f1=this['_getAffectedRoot'](_0x361d0b);return _0x3ea1f1&&!this['_knownRootNames']['has'](_0x3ea1f1);});K(_0x327abe,this['_document']['version']),this['_applyOperationsSet'](_0x327abe),_0x53b59f=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0x6dfe3e=this['_decompressOperations'](_0x5ac57c['data'],_0x5ac57c['metadata'])['filter'](_0x24778d=>_0x24778d['baseVersion']>=this['_lastServerVersion']);_0x6dfe3e['forEach'](_0x68dd70=>this['_addKnownRoot'](_0x68dd70)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x1a9e91=>!_0x1a9e91['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x1a9e91))),this['_bufferedOperations']['length']&&K(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0x6dfe3e),_0x53b59f=this['_handleExternalOperations'](_0x6dfe3e,_0x5ac57c['version'],_0x5ac57c['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x53b59f?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}['_handleExternalOperations'](_0x2d0057,_0x1a2a84,_0x33ccca){try{const _0x7241bf={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x4e2b62,operationsB:_0x1bf4ec,originalOperations:_0x527992}=_0x568b8c(_0x2d0057,this['_bufferedOperations'],_0x7241bf);K(_0x4e2b62,this['_document']['version']),K(_0x1bf4ec,_0x1a2a84);for(const _0x1bdb92 of _0x4e2b62){const _0x17e93a=_0x527992['get'](_0x1bdb92);_0x1bdb92['_authorId']=_0x17e93a?_0x17e93a['_authorId']:null;}_0x33ccca&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x2d0057,_0x33ccca),this['_lastSyncedOperationId']=_0x33ccca),this['_bufferedOperations']=[..._0x1bf4ec],this['_applyOperationsSet'](_0x4e2b62),this['_updateServerHistory'](_0x2d0057);}catch(_0xaf4849){return console['error'](_0xaf4849),!0x1;}return!0x0;}['_applyOperationsSet'](_0x2856d7,_0x364823=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0x18b362=>{for(const _0x34c6c5 of _0x2856d7)this['_knownOperations']['add'](_0x34c6c5),this['_addKnownRoot'](_0x34c6c5),_0x18b362['batch']['addOperation'](_0x34c6c5),this['editor']['model']['applyOperation'](_0x34c6c5);});}['_addKnownRoot'](_0x44e1f6){const _0x54239c=this['_getAffectedRoot'](_0x44e1f6);_0x54239c&&this['_knownRootNames']['add'](_0x54239c);}['_getAffectedRoot'](_0x10ea09){let _0x3b18ec,_0x1310ad;switch(_0x10ea09['type']){case'insert':_0x3b18ec=_0x10ea09['position']['root'];break;case'marker':if(_0x1310ad=_0x10ea09['newRange'],!_0x1310ad)return null;_0x3b18ec=_0x1310ad['root'];break;case'addRootAttribute':_0x3b18ec=_0x10ea09['root'];break;case'addRoot':_0x3b18ec=_0x10ea09['affectedSelectable'];break;case'move':_0x3b18ec=_0x10ea09['targetPosition']['root'];break;default:return null;}return _0x3b18ec['rootName'];}['_updateServerHistory'](_0x3c480){_0x3c480['forEach'](_0x2548ec=>{const _0x5203f6=_0x2548ec['clone']();_0x5203f6['_authorId']=_0x2548ec['_authorId'],_0x5203f6['_isInit']=!!_0x2548ec['_isInit'],_0x5203f6['createdAt']=_0x2548ec['createdAt'],_0x5203f6['baseVersion']+=this['_offset'],_0x2548ec['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x5203f6),this['serverHistory']['addOperation'](_0x5203f6);});}['_handleReconnectionError'](_0x24aef4){const _0x18e5d8=this['editor']['plugins']['get']('Notification'),_0x280204=this['editor']['locale'];_0x24aef4||(_0x24aef4=W(_0x280204,'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.')),_0x18e5d8['showWarning'](_0x24aef4,{'title':W(_0x280204,'Synchronization\x20issue'),'namespace':'real-time-collaboration'}),this['_hasSynchronizationProblem']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_bufferedOperations']=[],this['editor']['plugins']['get'](n)['disconnect']();}['_setPendingAction'](){this['_pendingAction']||(this['_pendingAction']=this['editor']['plugins']['get'](_0x736766)['add'](W(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}['_clearPendingAction'](){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x736766)['remove'](this['_pendingAction']),this['_pendingAction']=null);}['_compressOperations'](_0x236f21){const _0x57b7de=_0x236f21['map'](_0xb5c14d=>_0xb5c14d['toJSON']());return this['_compressor']['compress'](_0x57b7de);}['_decompressOperations'](_0x276daf,_0x1c872e){return this['_compressor']['decompress'](_0x276daf)['map']((_0x5e68a3,_0x4f1259)=>{const _0x30f2ce='init'==_0x1c872e[_0x4f1259]['type'];if('InsertOperation'==_0x5e68a3['__className']){const _0x19e6d5=_0x5e68a3['position']['root'];!this['_document']['getRoot'](_0x19e6d5)&&(this['_document']['createRoot']('$root',_0x19e6d5)['_isAttached']=!0x1);}const _0x5c2255=_0xb3bcba['fromJSON'](_0x5e68a3,this['_document']);return _0x5c2255['wasUndone']=_0x5e68a3['wasUndone'],_0x5c2255['_isInit']=_0x30f2ce,_0x5c2255['_authorId']=_0x30f2ce?null:_0x1c872e[_0x4f1259]['userId'],_0x5c2255['_isDisconnection']='cs:removeUser'===_0x1c872e[_0x4f1259]['type'],_0x5c2255['createdAt']=_0x1c872e[_0x4f1259]['createdAt'],_0x5c2255;});}['_refreshUserSelectionMarkers'](){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}['_shouldSendSelectionUpdate'](){const _0x4e3c1b=this['editor']['plugins']['get'](i)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0x4e3c1b&&_0x4e3c1b['length']>0x1&&this['_hasSelectionChanged'];}['_shouldSendUpdate'](){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}}class $ extends Error{}function K(_0x2297dd,_0x31adce){for(const _0x2d1690 of _0x2297dd)_0x2d1690['baseVersion']=_0x31adce++;}class J{['_ignoredOperations'];['_operationToId'];constructor(_0x1f1c3c){this['_ignoredOperations']=_0x1f1c3c,this['_operationToId']=new WeakMap();}['getIdOfTheLastOperation'](_0x251bdc){let _0x6d5a26=_0x251bdc['length'];for(;_0x6d5a26--;){const _0xdd48f1=_0x251bdc[_0x6d5a26];if(!this['_ignoredOperations']['has'](_0xdd48f1)){if(!this['_operationToId']['has'](_0xdd48f1)){const _0x365cb7=_0x1f53b8()['slice'](0x1,0x12);this['_operationToId']['set'](_0xdd48f1,_0x365cb7);}return this['_operationToId']['get'](_0xdd48f1);}}}['setIdForTheLastOperation'](_0x1a4d45,_0x1dbf02){if(!_0x1dbf02)return;let _0x3a626c=_0x1a4d45['length'];for(;_0x3a626c--;){const _0x3f1674=_0x1a4d45[_0x3a626c];this['_ignoredOperations']['has'](_0x3f1674)||this['_operationToId']['set'](_0x3f1674,_0x1dbf02);}}}class a extends _0x4216e6{static get['requires'](){return[l];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class s extends _0x77b109{static ['CommentsService']=/* #__PURE__ -- @preserve */
|
|
26
|
+
((()=>_0x3e3b54)());['_services'];static get['requires'](){return[n,'CommentsRepository',i,_0x328575];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x421314){super(_0x421314),this['_services']=new Map();}async['init'](){const _0x1ddefd=this['context'],_0x358fcc=_0x1ddefd['plugins']['get']('CommentsRepository');if(_0x1ddefd['plugins']['get'](n)['addToReconnectionStack'](this),_0x358fcc['adapter']={'addCommentThread':async({channelId:_0x504669,threadId:_0x416c3d,comments:_0x556cf1,resolvedAt:_0x5ba5a0,resolvedBy:_0x274066,context:_0x4804aa,attributes:_0x3da877})=>{const _0x175a04=await this['_getService'](_0x504669)['addCommentThread']({'commentThreadId':_0x416c3d,'comments':_0x556cf1['map'](_0x9cbf1c=>function(_0x29eec5,_0x368c8,_0x1531cd){return{'commentThreadId':_0x1531cd,'commentId':_0x29eec5['commentId'],'userId':_0x29eec5['authorId'],'content':_0x29eec5['content'],'documentId':_0x368c8,'createdAt':_0x29eec5['createdAt'],'attributes':_0x29eec5['attributes']||{}};}(_0x9cbf1c,_0x504669,_0x416c3d)),'resolvedAt':_0x5ba5a0,'resolvedBy':_0x274066,'context':_0x4804aa,'attributes':_0x3da877})['catch'](dt);return{'threadId':_0x175a04['commentThreadId'],'comments':_0x175a04['comments']};},'getCommentThread':async({channelId:_0xf22eb1,threadId:_0x57c248})=>{const _0x54e480=await this['_getService'](_0xf22eb1)['getCommentThread'](_0x57c248)['catch'](f)['catch'](dt);return _0x54e480?_0x54e480['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0x54e480]),{'threadId':_0x54e480['commentThreadId'],'comments':_0x54e480['comments']['map'](p),'context':_0x54e480['context'],'resolvedAt':_0x54e480['resolvedAt'],'resolvedBy':_0x54e480['resolvedBy'],'attributes':_0x54e480['attributes']||{}}):null;},'updateCommentThread':async({channelId:_0x54ef43,threadId:_0x3f4c1c,context:_0x48d131,unlinkedAt:_0x437942,attributes:_0xc7b237})=>this['_getService'](_0x54ef43)['updateCommentThread']({'commentThreadId':_0x3f4c1c,'context':_0x48d131,'attributes':_0xc7b237,'unlinkedAt':_0x437942})['catch'](f)['catch'](dt),'resolveCommentThread':async({channelId:_0x4d0815,threadId:_0x2b5e58})=>{const _0x2cc049=await this['_getService'](_0x4d0815)['resolveCommentThread'](_0x2b5e58)['catch'](f)['catch'](dt);return{'threadId':_0x2cc049['commentThreadId'],'resolvedAt':_0x2cc049['resolvedAt'],'resolvedBy':_0x2cc049['resolvedBy']};},'reopenCommentThread':async({channelId:_0x171b39,threadId:_0x416498})=>this['_getService'](_0x171b39)['reopenCommentThread'](_0x416498)['catch'](f)['catch'](dt),'removeCommentThread':({channelId:_0x53bc9a,threadId:_0x25809e})=>this['_getService'](_0x53bc9a)['removeCommentThread'](_0x25809e)['catch'](f)['catch'](dt),'addComment':({channelId:_0xedaa25,threadId:_0x55b906,commentId:_0x54e790,content:_0x468024,attributes:_0x503b87})=>this['_getService'](_0xedaa25)['addComment'](_0x55b906,_0x54e790,_0x468024,_0x503b87)['catch'](dt),'updateComment':({channelId:_0x5c1bf3,threadId:_0x240f3b,commentId:_0x45a333,content:_0x23ddee,attributes:_0x4a514a})=>this['_getService'](_0x5c1bf3)['updateComment'](_0x240f3b,_0x45a333,_0x23ddee,_0x4a514a)['catch'](f)['catch'](dt),'removeComment':({channelId:_0x5cb632,threadId:_0x29d0cb,commentId:_0x2492a8})=>this['_getService'](_0x5cb632)['removeComment'](_0x29d0cb,_0x2492a8)['catch'](f)['catch'](dt)},_0x1ddefd instanceof _0x297d04){const _0x573568=_0x1ddefd['config']['get']('collaboration.channelId'),_0x1b8764=_0x1ddefd['plugins']['get'](i);await this['_setUpService'](_0x573568);const _0x43568d=await this['_services']['get'](_0x573568)['getConnectedSessions']();this['listenTo'](_0x1b8764,'sessionAdd:'+_0x573568,(_0x2b3c3e,{session:_0x50653a})=>{_0x50653a['id']===_0x1b8764['mySessionId']&&(_0x2b3c3e['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x50653a['permissions'],_0x573568));}),_0x1b8764['register'](_0x573568,_0x43568d);}}async['_setUpService'](_0x408b66){if(this['_services']['has'](_0x408b66))throw new _0x2c6f5e('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0x408b66});const _0x452e45=this['context']['plugins']['get']('CommentsRepository'),_0x1611dc=new s['CommentsService'](_0x408b66);this['_services']['set'](_0x408b66,_0x1611dc),this['listenTo'](_0x1611dc,'commentThreadAdded',(_0x1d9db7,_0x299e41)=>{const {commentThreadId:_0x19fc92,documentId:_0x2bc86c,context:_0x3ab8c3,attributes:_0xc257db,resolvedAt:_0x3cda4f,resolvedBy:_0x13e91d,comments:_0x4017fb}=_0x299e41;_0x452e45['getCommentThread'](_0x19fc92)||_0x452e45['addCommentThread']({'threadId':_0x19fc92,'channelId':_0x2bc86c,'comments':_0x4017fb?_0x4017fb['map'](p):[],'context':_0x3ab8c3,'attributes':_0xc257db,'resolvedAt':_0x3cda4f,'resolvedBy':_0x13e91d,'isFromAdapter':!0x0});}),this['listenTo'](_0x1611dc,'commentThreadUpdated',(_0x4957f2,{commentThreadId:_0x30a03a,documentId:_0x390555,context:_0x407e1f,unlinkedAt:_0x5bfc7a,attributes:_0x1d5600})=>{_0x452e45['getCommentThread'](_0x30a03a)&&_0x452e45['updateCommentThread']({'threadId':_0x30a03a,'channelId':_0x390555,'context':_0x407e1f,'unlinkedAt':_0x5bfc7a,'attributes':_0x1d5600,'isFromAdapter':!0x0});}),this['listenTo'](_0x1611dc,'commentThreadResolved',(_0x279b74,{commentThreadId:_0x15ff1a,resolvedBy:_0x9ede3f,resolvedAt:_0x3cb38b})=>{const _0x47c88a=_0x452e45['getCommentThread'](_0x15ff1a);_0x47c88a&&_0x47c88a['resolve']({'resolvedBy':_0x9ede3f,'resolvedAt':_0x3cb38b,'isFromAdapter':!0x0});}),this['listenTo'](_0x1611dc,'commentThreadReopened',(_0x1a4648,{commentThreadId:_0x43519e})=>{const _0x3c8c40=_0x452e45['getCommentThread'](_0x43519e);_0x3c8c40&&_0x3c8c40['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0x1611dc,'commentThreadRemoved',(_0x38b28a,{commentThreadId:_0x28b468})=>{const _0x548f61=_0x452e45['getCommentThread'](_0x28b468);_0x548f61&&_0x548f61['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0x1611dc,'commentAdded',(_0x3596fe,_0x33abda)=>{const _0x3ec34f=_0x33abda['commentThreadId'],_0x2db3ec=_0x452e45['getCommentThread'](_0x3ec34f);_0x2db3ec&&_0x2db3ec['addComment']({...p(_0x33abda),'isFromAdapter':!0x0});}),this['listenTo'](_0x1611dc,'commentUpdated',(_0x538dc6,{commentThreadId:_0x2414ce,commentId:_0x24f066,content:_0x3d6bdd,attributes:_0x41e5bb})=>{const _0x433b59=_0x452e45['getCommentThread'](_0x2414ce);if(_0x433b59){const _0x2ef238=_0x433b59['getComment'](_0x24f066);_0x2ef238&&_0x2ef238['update']({'content':_0x3d6bdd,'attributes':_0x41e5bb,'isFromAdapter':!0x0});}}),this['listenTo'](_0x1611dc,'commentRemoved',(_0x356032,{commentThreadId:_0x46ed14,commentId:_0x14bf7c})=>{const _0x35d25a=_0x452e45['getCommentThread'](_0x46ed14);if(_0x35d25a){const _0x47013e=_0x35d25a['getComment'](_0x14bf7c);_0x47013e&&_0x47013e['remove']({'isFromAdapter':!0x0});}}),await this['_connectService'](_0x408b66);}['destroy'](){if(this['context']instanceof _0x297d04){const _0xab6438=this['context']['config']['get']('collaboration.channelId');this['_terminateService'](_0xab6438);}}['_terminateService'](_0x2741d0){if(!this['_services']['has'](_0x2741d0))throw new _0x2c6f5e('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0x2741d0});this['_getService'](_0x2741d0)['disconnect'](),this['_services']['delete'](_0x2741d0);}async['reconnect'](){for(const _0x2be00a of this['_services']['keys']())await this['_connectService'](_0x2be00a);if(this['context']instanceof _0x297d04){const _0x2603c8=this['context']['config']['get']('collaboration.channelId'),_0x2e1f56=this['context']['plugins']['get'](i);_0x2e1f56['unregister'](_0x2603c8);const _0x2f6069=await this['_services']['get'](_0x2603c8)['getConnectedSessions']();_0x2e1f56['register'](_0x2603c8,_0x2f6069);}}async['_connectService'](_0x4c22d0){const {connection:_0x52e65c}=this['context']['plugins']['get'](n),_0x49b64d=this['context']['plugins']['get']('CommentsRepository'),_0x49ff6f=this['_services']['get'](_0x4c22d0),_0x1bac74=await _0x49ff6f['connect'](_0x52e65c);await this['_fetchMissingUsersForThreads'](_0x1bac74);const _0x304e1f=new Set(Array['from'](_0x49b64d['getCommentThreads']({'channelId':_0x4c22d0}),_0x31cc0f=>_0x31cc0f['id']));for(const _0x1368c9 of _0x1bac74)_0x1368c9['deletedAt']||_0x304e1f['delete'](_0x1368c9['commentThreadId']);for(const _0x3d75f8 of _0x304e1f)_0x49b64d['getCommentThread'](_0x3d75f8)['remove']({'isFromAdapter':!0x0});for(const _0x2c425c of _0x1bac74){let _0x302240=_0x49b64d['getCommentThread'](_0x2c425c['commentThreadId']);const {commentThreadId:_0x12746d,context:_0x37141f,attributes:_0x2d7f6b,resolvedBy:_0x2abeaa,resolvedAt:_0x2157d0,unlinkedAt:_0x3bcc8f,deletedAt:_0x3f7448}=_0x2c425c;if(_0x3f7448)continue;_0x302240||(_0x302240=_0x49b64d['addCommentThread']({'channelId':_0x4c22d0,'threadId':_0x12746d,'context':_0x37141f,'attributes':_0x2d7f6b||{},'resolvedBy':_0x2abeaa,'resolvedAt':_0x2157d0,'unlinkedAt':_0x3bcc8f,'isFromAdapter':!0x0}));const _0x582cc4=new Set(Array['from'](_0x302240['comments'],_0x1327b3=>_0x1327b3['id']));for(const _0x46a1f of _0x2c425c['comments'])_0x582cc4['delete'](_0x46a1f['commentId']);for(const _0x19488b of _0x582cc4)_0x302240['getComment'](_0x19488b)['remove']({'isFromAdapter':!0x0});for(const _0x63472d of _0x2c425c['comments']){const _0x2fefc0=_0x302240['getComment'](_0x63472d['commentId']);_0x2fefc0?_0x2fefc0['content']!==_0x63472d['content']&&_0x2fefc0['update']({'content':_0x63472d['content'],'isFromAdapter':!0x0}):_0x302240['addComment'](Object['assign'](p(_0x63472d),{'isFromAdapter':!0x0}));}}}['_getService'](_0x51378){if(!this['_services']['has'](_0x51378))throw new _0x2c6f5e('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0x51378});return this['_services']['get'](_0x51378);}async['_fetchMissingUsersForThreads'](_0x1a7b5b){const _0x4c0cf0=this['context']['plugins']['get'](_0x328575),{connection:_0x44f83d}=this['context']['plugins']['get'](n),_0x276b97=new Set();for(const {resolvedBy:_0xb8ab68,comments:_0x35955e}of _0x1a7b5b){_0xb8ab68&&!_0x4c0cf0['getUser'](_0xb8ab68)&&_0x276b97['add'](_0xb8ab68);for(const {userId:_0x429cb0}of _0x35955e)_0x4c0cf0['getUser'](_0x429cb0)||_0x276b97['add'](_0x429cb0);}if(0x0===_0x276b97['size'])return;const _0x33d420=await lt['getMany'](_0x44f83d,Array['from'](_0x276b97));for(const _0x5d2e9c of _0x33d420)_0x4c0cf0['getUser'](_0x5d2e9c['id'])||_0x4c0cf0['addUser'](_0x5d2e9c);}}async function f(_0x5040a5){if('404'!==_0x5040a5['code'])throw _0x5040a5;}function dt(_0x5a15bc){if((_0x13f46f=_0x5a15bc)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0x13f46f['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x13f46f['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0x13f46f;throw _0x5a15bc;}function p(_0x41a729){return{'threadId':_0x41a729['commentThreadId'],'commentId':_0x41a729['commentId'],'content':_0x41a729['content'],'createdAt':_0x41a729['createdAt'],'authorId':_0x41a729['userId'],'attributes':_0x41a729['attributes']||{}};}class m extends _0x4216e6{static ['TrackChangesService']=/* #__PURE__ -- @preserve */
|
|
27
|
+
((()=>et)());['_bufferedRequests'];['_trackChangesService'];static get['requires'](){return[s,'TrackChangesEditing',n];}static get['pluginName'](){return'CloudServicesTrackChangesAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x533f8c){super(_0x533f8c);const _0x2aa559=this['editor']['config']['get']('collaboration.channelId');this['_bufferedRequests']=new Map(),this['_trackChangesService']=new m['TrackChangesService'](_0x2aa559);}['init'](){const _0x48519f=this['editor']['plugins']['get'](n),_0x26a3d3=this['editor']['plugins']['get']('TrackChangesEditing');return _0x26a3d3['adapter']={'getSuggestion':async _0x35adb7=>{await this['_waitForServiceReady']();const _0x1978c8=await this['_trackChangesService']['get'](_0x35adb7)['catch'](A);return await this['_fetchMissingUsersForThreads']([_0x1978c8]),_0x1978c8;},'addSuggestion':async({id:_0x171684,type:_0x3c1067,data:_0x127ab1,originalSuggestionId:_0x2a8cd1,attributes:_0x396add})=>{await this['_waitForServiceReady']();const _0x58c1bd={'id':_0x171684,'type':_0x3c1067,'data':_0x127ab1,'originalSuggestionId':_0x2a8cd1,'attributes':_0x396add},_0x15ebe4=await this['_trackChangesService']['add'](_0x171684,_0x3c1067,_0x127ab1,_0x2a8cd1,_0x396add)['catch'](_0x1bac32=>{if(ut(_0x1bac32))return new Promise(_0x2e01a4=>{this['_bufferedRequests']['set'](_0x171684,{'resolve':_0x2e01a4,'suggestionData':_0x58c1bd});});throw _0x1bac32;});return this['_bufferedRequests']['delete'](_0x171684),_0x15ebe4;},'updateSuggestion':async(_0x36323d,_0x284ed2)=>{if(await this['_waitForServiceReady'](),'open'!==_0x284ed2['state'])return this['_trackChangesService']['update'](_0x36323d,_0x284ed2)['catch'](A);}},this['listenTo'](this['_trackChangesService'],'suggestionUpdated',(_0x10f382,_0x2d8818)=>{_0x26a3d3['hasSuggestion'](_0x2d8818['id'])&&(_0x26a3d3['getSuggestion'](_0x2d8818['id'])['attributes']=_0x2d8818['attributes']);}),this['_trackChangesService']['connect'](_0x48519f['connection'])['then'](_0x1b3a0e=>(_0x48519f['addToReconnectionStack'](this),this['_fetchMissingUsersForThreads'](_0x1b3a0e)['then'](()=>{for(const _0x1db2d4 of _0x1b3a0e){_0x26a3d3['addSuggestionData'](_0x1db2d4)['_saved']=!0x0;}})));}async['reconnect'](){const _0xb4509e=this['editor']['plugins']['get']('TrackChangesEditing'),{connection:_0x24c7c0}=this['editor']['plugins']['get'](n),_0x2fee84=await this['_trackChangesService']['connect'](_0x24c7c0);await this['_fetchMissingUsersForThreads'](_0x2fee84);for(const {suggestionData:_0x50b6a3,resolve:_0x3ff242}of this['_bufferedRequests']['values']()){let _0x515baa=_0x2fee84['find'](_0x2c514a=>_0x2c514a['id']===_0x50b6a3['id']);_0x515baa||(_0x515baa=await this['_trackChangesService']['add'](_0x50b6a3['id'],_0x50b6a3['type'],_0x50b6a3['data'],_0x50b6a3['originalSuggestionId'])),_0x3ff242(_0x515baa);}for(const _0x422dbe of _0x2fee84)_0xb4509e['hasSuggestion'](_0x422dbe['id'])||_0xb4509e['addSuggestionData'](_0x422dbe);}async['_waitForServiceReady'](){this['_trackChangesService']['isConnected']||await new Promise(_0x527499=>{this['listenTo'](this['_trackChangesService'],'connected',_0x10d583=>{_0x10d583['off'](),_0x527499();});});}async['_fetchMissingUsersForThreads'](_0x4ed9f9){const _0x21540e=this['editor']['plugins']['get'](_0x328575),{connection:_0x33bdfe}=this['editor']['plugins']['get'](n),_0x3cc6f2=new Set();for(const {authorId:_0x1ccf67}of _0x4ed9f9)_0x21540e['getUser'](_0x1ccf67)||_0x3cc6f2['add'](_0x1ccf67);if(0x0===_0x3cc6f2['size'])return;const _0x1ab671=await lt['getMany'](_0x33bdfe,Array['from'](_0x3cc6f2));for(const _0x1a97ef of _0x1ab671)_0x21540e['getUser'](_0x1a97ef['id'])||_0x21540e['addUser'](_0x1a97ef);}}function A(_0x47a0b9){if(ut(_0x47a0b9))return new Promise(()=>{});throw _0x47a0b9;}function ut(_0x3f589a){return _0x3f589a['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x3f589a['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class g extends _0x4216e6{static get['requires'](){return['Comments',s,a,n];}static get['pluginName'](){return'RealTimeCollaborativeComments';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x3f9c6f=this['editor']['plugins']['get'](n),_0x3a0e0d=this['editor']['plugins']['get']('CommentsEditing'),_0x442c9c=this['editor']['plugins']['get'](s);return this['editor']['data']['once']('ready',()=>{this['listenTo'](_0x3f9c6f,'change:state',(_0x178624,_0x19b1cc,_0x1dd45a)=>{_0x3a0e0d['isThreadsLoadingPaused']='connected'!==_0x1dd45a;});}),this['listenTo'](_0x3f9c6f,'change:state',(_0x1935ae,_0x40762e,_0x1e33a0)=>{this['editor']['plugins']['get']('CommentsRepository')['switchReadOnly']('connected'!==_0x1e33a0);}),_0x442c9c['_setUpService'](this['editor']['config']['get']('collaboration.channelId'));}['destroy'](){this['editor']['plugins']['get'](s)['_terminateService'](this['editor']['config']['get']('collaboration.channelId')),super['destroy']();}}class ft extends _0x4216e6{static get['requires'](){return[g,m,'TrackChanges'];}static get['pluginName'](){return'RealTimeCollaborativeTrackChanges';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class c extends _0x4216e6{static ['RevisionHistoryService']=/* #__PURE__ -- @preserve */
|
|
28
|
+
((()=>it)());['_lastRequestId'];['_revisionTracker'];['_revisionHistoryService'];['_oldOffset'];static get['requires'](){return[n,l,'RevisionHistory',i,_0x328575];}static get['pluginName'](){return'CloudServicesRevisionHistoryAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x4eca1d){super(_0x4eca1d);const _0x5a8b8e=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new c['RevisionHistoryService'](_0x5a8b8e);}async['init'](){const _0x16c545=this['editor']['plugins']['get'](l),_0xccd42e=_0x16c545['serverHistory'],_0x2ba8cd=this['editor']['plugins']['get'](n);this['_revisionTracker']['setSource']({'history':_0xccd42e,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0x16c545['sessionId']});const _0x4c2458=this['editor']['config']['get']('cloudServices.bundleVersion')||nt,_0x2bb166=await tt['isBundleUploaded'](_0x2ba8cd['connection'],_0x4c2458);this['editor']['plugins']['get']('RevisionHistory')['adapter']={'getRevision':async({revisionId:_0x1b7619})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0x1b7619)),'updateRevisions':async _0x4314df=>{await this['_waitForServiceReady']();const _0x30db55=this['_revisionTracker']['currentRevision'];if(_0x2bb166&&0x1===_0x4314df['length']&&_0x4314df[0x0]['id']===_0x30db55['id'])return _0x4314df;for(const _0x5ab3b4 of _0x4314df)_0x5ab3b4['id']===_0x30db55['id']&&(_0x5ab3b4['isEmptyCurrent']=_0x5ab3b4['fromVersion']===_0x5ab3b4['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0x4314df,this['_lastRequestId'])['then'](_0x854445=>(this['_lastRequestId']=_0x854445,_0x4314df))['catch'](_0xf20730=>{if(st(_0xf20730)||'400'===_0xf20730['code']&&void 0x0!==_0xf20730['data']['wrongRequestId']){for(const _0x384f97 of _0x4314df){!this['_revisionTracker']['repository']['getRevision'](_0x384f97['id'])||this['_revisionTracker']['_bufferUpdate'](_0x384f97['id'],_0x384f97,!0x1);}if(st(_0xf20730))throw _0xf20730;return _0x4314df;}throw _0xf20730;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0x5356b9,{revisionsData:_0x5a56b1,requestId:_0x148a01})=>{Math['max'](..._0x5a56b1['map'](_0x1a344a=>_0x1a344a['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0x5a56b1,_0x148a01);}):this['_handleRevisionsUpdate'](_0x5a56b1,_0x148a01);});const {revisions:_0x1df96c,requestId:_0x9074e9}=await this['_revisionHistoryService']['connect'](_0x2ba8cd['connection']);_0x2ba8cd['addToReconnectionStack'](this),this['_lastRequestId']=_0x9074e9,await this['_fetchMissingUsers'](_0x1df96c);for(const _0x57ab3c of _0x1df96c)this['_revisionTracker']['addRevisionData'](_0x57ab3c);this['listenTo'](_0x16c545,'change:_isConnected',(_0x521c8d,_0x217bd7,_0x1b0744)=>{_0x1b0744&&(this['_oldOffset']=_0x16c545['_offset'],_0x521c8d['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](_0x2ba8cd,'state',_0x32889c=>_0x32889c===te['CONNECTED']);}async['reconnect'](){const _0x4c30da=this['editor']['plugins']['get'](n),_0x5b30c4=this['editor']['plugins']['get'](l),_0x3b1075=async()=>{const _0x464fa7=this['_revisionTracker']['currentRevision'],_0x24e6f4=_0x464fa7['id'],_0x13b033=_0x24e6f4!==_0x5b30c4['sessionId'];if(_0x13b033){const _0x7ef64c=_0x5b30c4['_offset']-this['_oldOffset'],_0x3b4fe8=this['_getLatestVersionFromServerOperations']();this['_revisionTracker']['_revisionDataBuilder']['reInit']();if(_0x464fa7['toVersion']+_0x7ef64c!==_0x3b4fe8){const _0x37950a=_0x464fa7['fromVersion']+_0x7ef64c,_0x10ba3c=this['editor']['plugins']['get'](_0x328575),_0x13e0f6=this['_revisionTracker']['buildRevisionData']({'revision':_0x464fa7,'from':_0x37950a,'to':_0x3b4fe8});_0x13e0f6['id']=_0x464fa7['id'];const _0x365d0d=_0x13e0f6['authorsIds']['map'](_0x5d7402=>_0x10ba3c['getUser'](_0x5d7402));_0x464fa7['_update']({..._0x13e0f6,'authors':_0x365d0d},!0x0),this['_revisionTracker']['_bufferUpdate'](_0x464fa7['id'],_0x13e0f6,!0x0);}this['_revisionTracker']['_startingVersion']=_0x3b4fe8,(_0x464fa7['toVersion']===_0x464fa7['fromVersion']&&!this['_revisionTracker']['_bufferedUpdates']['has'](_0x24e6f4)&&this['_revisionTracker']['repository']['_revisions']['remove'](_0x24e6f4),this['_revisionTracker']['_createCurrentRevision'](_0x3b4fe8));}const {revisions:_0x330ccc,requestId:_0x1fbfbd}=await this['_revisionHistoryService']['reconnect'](_0x4c30da['connection'],this['_lastRequestId']);_0x13b033&&_0x330ccc['length']>0x0?_0x5b30c4['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x330ccc),this['_handleRevisionsUpdate'](_0x330ccc,_0x1fbfbd),this['_revisionTracker']['sendBufferedUpdates']());};return _0x5b30c4['_isConnected']?_0x3b1075():new Promise((_0x3dbe1a,_0x3c6c6d)=>{_0x5b30c4['once']('change:_isConnected',()=>{_0x3b1075()['then'](_0x3dbe1a)['catch'](_0x3c6c6d);});});}['destroy'](){super['destroy']();}async['_waitForServiceReady'](){this['_revisionHistoryService']['isConnected']||await new Promise(_0xeb1862=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x18e856=>{_0x18e856['off'](),_0xeb1862();});});}['_getLatestVersionFromServerOperations'](){const _0x5ae3e2=this['editor']['plugins']['get'](l)['serverHistory']['getOperations']()['reverse']();for(const _0x4ee259 of _0x5ae3e2)if('marker'!==_0x4ee259['type']||_0x4ee259['affectsData'])return _0x4ee259['baseVersion']+0x1;}['_getLatestVersion'](){const _0x365dce=this['editor']['plugins']['get'](l);return new Promise(_0x21358a=>{_0x365dce['_isPendingUpdate']?_0x365dce['once']('change:_isPendingUpdate',()=>{_0x21358a(this['_getLatestVersionFromServerOperations']());}):_0x21358a(this['_getLatestVersionFromServerOperations']());});}['_handleRevisionsUpdate'](_0x4d47fc,_0xe86a4c){const _0x3bb59c=this['_revisionTracker']['repository'];this['_lastRequestId']=_0xe86a4c;for(const _0x2f1ec2 of _0x4d47fc){const _0x57fb9d=_0x3bb59c['getRevision'](_0x2f1ec2['id']);if(_0x57fb9d){if((_0x2f1ec2['fromVersion']||_0x2f1ec2['toVersion'])&&(_0x2f1ec2['diffData']=null),_0x57fb9d===this['_revisionTracker']['currentRevision']){const _0x2d70fe=Math['max'](_0x57fb9d['toVersion'],_0x2f1ec2['toVersion']),_0x1d8fa7=Math['max'](_0x57fb9d['fromVersion'],_0x2f1ec2['fromVersion']);let _0x57c9d;_0x57fb9d['toVersion']===_0x2f1ec2['toVersion']&&_0x57fb9d['fromVersion']===_0x2f1ec2['fromVersion']?(_0x57c9d=!0x0,this['_preventResendingRevisionData'](_0x2f1ec2)):_0x2f1ec2['toVersion']===_0x2d70fe&&_0x2f1ec2['fromVersion']===_0x1d8fa7?_0x57c9d=!0x1:(_0x57fb9d['toVersion']===_0x2d70fe&&_0x57fb9d['fromVersion']===_0x1d8fa7||this['_fixRevision']({'revision':_0x57fb9d,'from':_0x1d8fa7,'to':_0x2d70fe}),_0x57c9d=!0x0),_0x57c9d&&(delete _0x2f1ec2['fromVersion'],delete _0x2f1ec2['toVersion'],delete _0x2f1ec2['diffData'],delete _0x2f1ec2['createdAt'],delete _0x2f1ec2['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0x2f1ec2),this['_preventResendingRevisionData'](_0x2f1ec2);}else this['_revisionTracker']['addRevisionData'](_0x2f1ec2);}const _0x2f6863=_0x3bb59c['getRevisions']();_0x2f6863['reverse']();for(let _0x23d264=0x0;_0x23d264<_0x2f6863['length']-0x1;_0x23d264++){const _0x211e23=_0x2f6863[_0x23d264],_0x283638=_0x2f6863[_0x23d264+0x1];if(_0x211e23['fromVersion']<_0x283638['toVersion']){const _0x4038b0=_0x283638['toVersion'],_0x2ac8f6=Math['max'](_0x4038b0,_0x211e23['toVersion']);this['_fixRevision']({'revision':_0x211e23,'from':_0x4038b0,'to':_0x2ac8f6});}}}['_fixRevision']({revision:_0x4eacdc,from:_0x310d17,to:_0xfbf19d}={}){const _0xb9fd8d=this['editor']['plugins']['get'](_0x328575),_0x142e61=this['_revisionTracker']['buildRevisionData']({'revision':_0x4eacdc,'from':_0x310d17,'to':_0xfbf19d});_0x142e61['authors']=_0x142e61['authorsIds']['map'](_0x1e55dc=>_0xb9fd8d['getUser'](_0x1e55dc)),_0x4eacdc['_update'](_0x142e61);}['_preventResendingRevisionData'](_0x412574){const _0xa75e5b={};_0xa75e5b['id']=_0x412574['id'];for(const _0x2b326e of Object['keys'](_0x412574))'id'!==_0x2b326e&&(_0xa75e5b[_0x2b326e]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0xa75e5b['id'],_0xa75e5b,!0x0);}async['_fetchMissingUsers'](_0x59a0d7){const _0x5304be=this['editor']['plugins']['get'](_0x328575),{connection:_0x5bb678}=this['editor']['plugins']['get'](n),_0x877e6=new Set();for(const _0x1704c4 of _0x59a0d7){for(const _0x2f0f8b of _0x1704c4['authorsIds'])_0x29cb04(_0x2f0f8b);_0x1704c4['creatorId']&&_0x29cb04(_0x1704c4['creatorId']);}if(0x0===_0x877e6['size'])return;const _0x31464d=await lt['getMany'](_0x5bb678,Array['from'](_0x877e6));for(const _0x31d506 of _0x31464d)_0x5304be['getUser'](_0x31d506['id'])||_0x5304be['addUser'](_0x31d506);function _0x29cb04(_0xa24c){_0x5304be['getUser'](_0xa24c)||_0x877e6['add'](_0xa24c);}}}function st(_0x8d747f){return _0x8d747f['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0x8d747f['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x8d747f['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class mt extends _0x4216e6{static get['requires'](){return['RevisionHistory',c,a];}static get['pluginName'](){return'RealTimeCollaborativeRevisionHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class y extends _0x1f794e{['_collapseAt'];constructor(_0x1fc95e,_0x190104=0x6){super(_0x1fc95e);const _0x52b7ca=this['bindTemplate'];this['set']('isHidden',!0x0),this['set']('usersCount',0x0),this['_collapseAt']=_0x190104,this['bind']('isHidden')['to'](this,'usersCount',_0x442978=>_0x442978<_0x190104),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item',_0x52b7ca['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':_0x52b7ca['to']('usersCount',_0x5ab311=>'+'+(_0x5ab311-this['_collapseAt']+0x2)['toString']())}]}]}]});}}class is extends _0x1f794e{['items'];['keystrokes'];constructor(_0x3478dd){super(_0x3478dd);const _0x4be742=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0x2cea49(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0x4be742['if']('hasPopup'),'aria-expanded':_0x4be742['to']('isExpanded',_0x1db8a9=>this['hasPopup']&&String(_0x1db8a9)),'aria-label':_0x4be742['to']('hasPopup',_0x1c75ed=>W(_0x3478dd,_0x1c75ed?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0x4be742['to']('hasPopup',_0x7303ba=>!!_0x7303ba&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items'],'on':{'mouseenter':_0x4be742['to'](()=>this['fire']('presencelist:show')),'mouseleave':_0x4be742['to'](_0xf335ad=>{const _0x4ca5ed=_0xf335ad,_0x3f5f34=document['querySelector']('.ck-presence-list__dropdown-list'),_0x4ece85=document['querySelector']('.ck-balloon-panel_with-arrow');_0x3f5f34?.['contains'](_0x4ca5ed['relatedTarget'])||_0x4ece85?.['contains'](_0x4ca5ed['relatedTarget'])||this['fire']('presencelist:hide');})}}),this['on']('change:hasPopup',(_0x3e5967,_0x2ceaaa,_0x2d8fce)=>{this['element']&&(_0x2d8fce?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 k extends _0x1f794e{['counterView'];['inlineListView'];constructor(_0x3bd03b,_0x598a90=0x6){super(_0x3bd03b);const _0x28434b=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new y(this['locale'],_0x598a90),this['inlineListView']=new is(_0x3bd03b),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x60f3f8 of this['inlineListView']['items'])_0x60f3f8['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',_0x28434b['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['inlineListView']]});}}class C extends _0x1f794e{['listWrapperView'];constructor(_0x101354,_0x4fb3d5){super(_0x101354);const _0x438606=this['bindTemplate'];this['listWrapperView']=new pt(_0x101354,_0x4fb3d5),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':W(_0x101354,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']],'on':{'mouseleave':_0x438606['to'](_0x3a9bcb=>{const _0xae621b=_0x3a9bcb,_0x457e4e=document['querySelector']('.ck-presence-list__list'),_0x31a2fe=document['querySelector']('.ck-balloon-panel_with-arrow');_0x457e4e?.['contains'](_0xae621b['relatedTarget'])||_0x31a2fe?.['contains'](_0xae621b['relatedTarget'])||this['fire']('presencelist:hide');})}});}}class pt extends _0x5c2ac1{constructor(_0x1deaf0,_0x104856){super(_0x1deaf0);const _0x2a94d4=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0x104856?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0x2a94d4['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0x2a94d4['to']('role'),'aria-label':_0x2a94d4['to']('ariaLabel'),'aria-labelledby':_0x2a94d4['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0x394bfc['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0x38b6b3=this['element'];_0x38b6b3&&(this['_isScrollable']=Math['max'](_0x38b6b3['scrollHeight'],_0x38b6b3['clientHeight'])>0.8*window['innerHeight']);}}class P extends rt{['userView'];constructor(_0x2161e6,_0x36d527,_0x1f30de){super(_0x2161e6);const _0x400f33=this['bindTemplate'];this['userView']=new ct(_0x2161e6,_0x36d527);const _0x5aa4c0={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0x36d527['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0x36d527['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x36d527['color']['getBackgroundColorClass']()],'aria-hidden':'true'}}]};_0x1f30de&&(_0x5aa4c0['tag']='button',_0x5aa4c0['on']={'click':_0x400f33['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x5aa4c0);}['focus'](){this['element']['focus']();}}class _ extends _0x1f794e{['userView'];['markerView'];constructor(_0x4d7b09,_0x5bdd1a,_0x5147fd){super(_0x4d7b09);const _0x49785f=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new ct(_0x4d7b09,_0x5bdd1a),this['markerView']=new at(_0x4d7b09,_0x5bdd1a);const _0x50b22a=new ot(_0x4d7b09);_0x50b22a['template']['tag']='span',_0x50b22a['text']=_0x5bdd1a['name'];const _0x500470={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0x49785f['to']('isFocusable',_0x21c94e=>!!_0x21c94e&&0x0),'aria-labelledby':_0x50b22a['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0x49785f['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0x49785f['to']('hasTooltip',_0x450756=>!_0x450756),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0x50b22a]};_0x5147fd&&(_0x500470['tag']='button',_0x500470['on']={'click':_0x49785f['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x500470);}}class at extends _0x1f794e{constructor(_0x48205c,_0x187b96){super(_0x48205c),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x187b96['color']['getBackgroundColorClass']()],'aria-hidden':'true'}});}}const U={'collapseAt':0x6,'displayMe':!0x0};class r extends _0x77b109{['currentDisplayedUsers'];['balloonPanelView'];['view'];['presenceDropdownView'];['_bodyCollection']=null;static get['pluginName'](){return'PresenceListUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x33ece6){super(_0x33ece6),this['context']['config']['define']('presenceList',U);const _0xf887ee=_0x33ece6['config']['get']('presenceList.collapseAt');if('number'!=typeof _0xf887ee)throw new _0x2c6f5e('presencelist-collapseat-invalid-format',this);if(_0xf887ee<0x1)throw new _0x2c6f5e('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](i)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0x130090(),this['balloonPanelView']=new _0x3b1622(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get['requires'](){return[i];}['init'](){for(const _0x181386 of this['_allConnectedUsers'])this['_handleUserAdd'](_0x181386);this['listenTo'](this['_allConnectedUsers'],'add',(_0x11ddda,_0x573c5e)=>{this['_handleUserAdd'](_0x573c5e);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0x13fa71,_0x271024)=>{this['_handleUserRemove'](_0x271024);});}['_createView'](){const _0x3c1260=this['context'],_0x5416be=new k(this['context']['locale'],this['context']['config']['get']('presenceList.collapseAt')),_0x40149a=this['balloonPanelView'];if(!_0x2dfc6f(_0x3c1260['config']['get']('presenceList.container')))throw new _0x2c6f5e('presencelist-missing-container',this);return _0x5416be['counterView']['bind']('usersCount')['to'](this),_0x5416be['bind']('isCollapsed')['to'](this,'usersCount',_0x157831=>{const {collapseAt:_0x5ada46}=_0x3c1260['config']['get']('presenceList'),_0x50555f=_0x157831>=_0x5ada46;if(_0x50555f&&!_0x5416be['inlineListView']['items']['find'](_0x4712ee=>_0x4712ee instanceof y)){const _0x4c53ac=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['currentDisplayedUsers']['length']==_0x4c53ac&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](this['currentDisplayedUsers']['length']-0x1),_0x5416be['inlineListView']['items']['add'](_0x5416be['counterView']);}return _0x50555f||this['hideDropdown'](),_0x50555f;}),_0x5416be['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0x4fdd14=>{const _0x18a7d6=_0x3c1260['config']['get']('presenceList'),_0x581f20=new _(_0x3c1260['locale'],_0x4fdd14,!!_0x18a7d6['onClick']);return _0x581f20['bind']('hasTooltip')['to'](_0x5416be,'isCollapsed',_0x3d2859=>!_0x3d2859),_0x581f20['bind']('isFocusable')['to'](_0x5416be,'isCollapsed',_0x3e0ec9=>!_0x3e0ec9),_0x18a7d6['onClick']&&this['listenTo'](_0x581f20,'execute',()=>{this['view']['isCollapsed']||_0x18a7d6['onClick'](_0x4fdd14,_0x581f20['element']);}),_0x581f20;}),this['listenTo'](_0x5416be['inlineListView'],'presencelist:show',()=>{this['view']['isCollapsed']&&this['showDropdown']();}),this['listenTo'](_0x5416be['inlineListView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();}),_0x5416be['inlineListView']['keystrokes']['set']('Enter',(_0x10977d,_0x4eefd7)=>{this['view']['isCollapsed']&&(this['showDropdown'](),_0x4eefd7());}),_0x5416be['render'](),_0x40149a['render'](),_0x36837a({'emitter':_0x5416be,'activator':()=>_0x40149a['isVisible'],'contextElements':[_0x40149a['element'],_0x5416be['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0x3c1260['config']['get']('presenceList.container')['appendChild'](_0x5416be['element']),this['_bodyCollection']=new _0xd9147d(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_bodyCollection']['add'](this['balloonPanelView']),_0x5416be;}['_handleUserAdd'](_0x6fe0b3){if(!this['context']['config']['get']('presenceList.displayMe')&&_0x6fe0b3['isMe'])return;const _0x244feb=this['context']['config']['get']('presenceList.collapseAt')-0x1;for(this['usersCount']++;this['currentDisplayedUsers']['length']>=_0x244feb-(this['view']['isCollapsed']?0x1:0x0)&&this['currentDisplayedUsers']['length']>0x1;)this['currentDisplayedUsers']['remove'](0x1);const _0x58d1c1=_0x6fe0b3['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0x6fe0b3,_0x58d1c1);}['_handleUserRemove'](_0x22dfd8){this['usersCount']--;const {collapseAt:_0x4c794c}=this['context']['config']['get']('presenceList'),_0x576aab=this['usersCount']>=_0x4c794c;if(this['currentDisplayedUsers']['get'](_0x22dfd8['id']))this['currentDisplayedUsers']['remove'](_0x22dfd8['id']);else{if(_0x576aab&&this['currentDisplayedUsers']['length']+0x1===_0x4c794c-0x1)return;}if(this['currentDisplayedUsers']['length']+(_0x576aab?0x1:0x0)<this['usersCount']){for(const _0x1dd3ab of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0x1dd3ab['id'])&&(this['currentDisplayedUsers']['add'](_0x1dd3ab,Math['min'](this['currentDisplayedUsers']['length']-(_0x576aab?0x1:0x0),0x1)),this['currentDisplayedUsers']['length']+(_0x576aab?0x1:0x0)===_0x4c794c-0x1))return;}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0x244f9e=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new C(this['context']['locale'],!!_0x244f9e['onClick']),this['view']['inlineListView']['isExpanded']=!0x0,this['listenTo'](this['presenceDropdownView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();});const {listWrapperView:_0x1ad8b5}=this['presenceDropdownView'];_0x1ad8b5['items']['bindTo'](this['_allConnectedUsers'])['using'](_0x12054b=>{if(!_0x244f9e['displayMe']&&_0x12054b['isMe'])return null;const _0x446662=new P(this['context']['locale'],_0x12054b,!!_0x244f9e['onClick']);return _0x244f9e['onClick']&&this['listenTo'](_0x446662,'execute',()=>{_0x244f9e['onClick'](_0x12054b,_0x446662['element']);}),_0x446662;}),this['balloonPanelView']['content']['add'](this['presenceDropdownView']),this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element']}),_0x1ad8b5['focus'](),_0x1ad8b5['checkIfScrollable']();const _0x3a090a=(_0x1c2df7,_0x1ecb75)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0x1ecb75();};_0x1ad8b5['keystrokes']['set']('Esc',_0x3a090a),_0x1ad8b5['keystrokes']['set']('Shift+Tab',_0x3a090a),_0x1ad8b5['keystrokes']['set']('Tab',(_0xd48395,_0x2796c9)=>{!function(_0x3d0531){const _0x1a2450=['a','button','input','select','textarea','[tabindex]','[contenteditable]']['map'](_0xfd5156=>_0xfd5156+':not([disabled]):not([tabindex=\x22-1\x22])')['join'](','),_0x1d2cf2=[...document['body']['querySelectorAll'](_0x1a2450)]['filter'](_0x3fe471=>_0x3fe471===document['activeElement']||_0x3fe471['offsetWidth']+_0x3fe471['offsetHeight']>0x0)['sort']((_0x51f6d0,_0x1906ac)=>(_0x51f6d0['tabIndex']||0x0)-(_0x1906ac['tabIndex']||0x0)),_0x4dd541=_0x1d2cf2['indexOf'](_0x3d0531),_0x406a5e=_0x1d2cf2[(_0x4dd541+0x1)%_0x1d2cf2['length']];_0x406a5e&&_0x406a5e['focus']();}(this['view']['element']),this['hideDropdown'](),_0x2796c9();}),_0x1ad8b5['focusTracker']['add'](this['view']['element']),_0x1ad8b5['focusTracker']['on']('change:isFocused',(_0x651882,_0x54b749,_0x22d84e)=>{_0x22d84e||this['hideDropdown']();});}['hideDropdown'](){this['presenceDropdownView']&&(this['view']['inlineListView']['isExpanded']=!0x1,this['balloonPanelView']['unpin'](),this['balloonPanelView']['content']['remove'](this['presenceDropdownView']),this['presenceDropdownView']['destroy'](),this['presenceDropdownView']=void 0x0);}['destroy'](){super['destroy'](),this['view']&&this['view']['isRendered']&&this['view']['destroy'](),this['_bodyCollection']&&(this['_bodyCollection']['detachFromDom'](),this['_bodyCollection']['destroy'](),this['_bodyCollection']=null);}}class gt extends _0x77b109{static get['requires'](){return[i,r];}static get['pluginName'](){return'PresenceList';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}export{s as CloudServicesCommentsAdapter,c as CloudServicesRevisionHistoryAdapter,m as CloudServicesTrackChangesAdapter,gt as PresenceList,r as PresenceListUI,l as RealTimeCollaborationClient,g as RealTimeCollaborativeComments,a as RealTimeCollaborativeEditing,mt as RealTimeCollaborativeRevisionHistory,ft as RealTimeCollaborativeTrackChanges,i as Sessions,n as WebSocketGateway};
|