@ckeditor/ckeditor5-real-time-collaboration 47.7.3-alpha.0 → 47.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/real-time-collaboration.js +1 -1
- package/dist/index.js +6 -6
- package/package.json +14 -14
- package/src/presencelist/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
|
-
((()=>ot)());static ['initialReconnectionInterval']=0x3e8;['connection'];['_reconnectionStack'];['_shouldPluginsReconnect'];['_domEmitter'];static get['requires'](){return['CloudServices',_0x3b6069];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x571c45){super(_0x571c45),this['set']('state',_0x34396e['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=new(_0x429a99())();}['init'](){const _0x27f1d6=this['context'],_0x416962=_0x27f1d6['plugins']['get']('CloudServices'),_0x541c0f=_0x27f1d6['plugins']['get'](_0x3b6069);if(!_0x416962['token'])throw new _0x138eb8('websocketgateway-missing-token',this);if(!_0x416962['webSocketUrl'])throw new _0x138eb8('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'](_0x416962['token'],_0x416962['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0x933fb6=>{if(this['connection']=_0x933fb6,this['bind']('state')['to'](_0x933fb6,'state',this,'_isBrowserOffline',(_0x5b4ffa,_0x408af9)=>('connected'!==_0x5b4ffa&&(this['_shouldPluginsReconnect']=!0x0),_0x408af9||_0x5b4ffa!==_0x34396e['CONNECTED']?_0x34396e['DISCONNECTED']:this['state']==_0x34396e['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),_0x34396e['CONNECTING']):_0x34396e['CONNECTED'])),this['connection']['on']('error',(_0x90344f,_0x41abd2)=>{if('limitExceeded'!==_0x41abd2['code'])throw console['error'](_0x41abd2),new _0x138eb8('cloudservices-init',null,{'originalError':_0x41abd2});_0x541c0f['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'});}),!_0x933fb6['me'])return new Promise(_0x319cc2=>_0x933fb6['on']('change:me',_0x319cc2));})['catch'](_0x214614=>{throw console['error'](_0x214614),new _0x138eb8('cloudservices-init',null,{'originalError':_0x214614});});}['addToReconnectionStack'](_0x5b90d3){if('function'!=typeof _0x5b90d3['reconnect'])throw new _0x138eb8('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0x5b90d3))throw new _0x138eb8('websocketgateway-plugin-already-registered',this,{'name':_0x5b90d3['constructor']['pluginName']});this['_reconnectionStack']['add'](_0x5b90d3);}['removeFromReconnectionStack'](_0x10bc3b){this['_reconnectionStack']['delete'](_0x10bc3b);}['isInReconnectionStack'](_0x594ebb){return this['_reconnectionStack']['has'](_0x594ebb);}['_reconnect'](){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0x1d65a0=>_0x1d65a0['reconnect']())))['then'](()=>this['state']=_0x34396e['CONNECTED'])['catch'](_0x216de5=>{throw console['error'](_0x216de5),new _0x138eb8('cloudservices-reconnection-error',this['context']);});}['disconnect'](){this['connection']&&this['connection']['disconnect'](),this['state']=_0x34396e['DISCONNECTED'],this['_domEmitter']['stopListening']();}['destroy'](){this['disconnect'](),super['destroy']();}}class i extends _0x38fb43{['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,_0x5d9668];}constructor(_0x1bbc4f){super(_0x1bbc4f),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0x505ced(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x5d9668);}['init'](){const _0x479939=this['context']['plugins']['get'](n);this['listenTo'](_0x479939,'change:state',(_0x24424e,_0x41ec61,_0x4c2878)=>{if('connected'!==_0x4c2878)this['channelSessions']['forEach'](_0x2e8584=>_0x2e8584['clear']()),this['channelConnectedUsers']['forEach'](_0x1e8588=>_0x1e8588['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x31ceab,_0x2cf675]of this['_registeredSessions'])for(const _0x114188 of _0x2cf675)this['_handleSessionAdd'](_0x31ceab,_0x114188);}}),this['_createUser'](_0x479939['connection']['me'],!0x0);}['register'](_0x2a4b6a,_0x3b6f0d){if(this['_registeredSessions']['has'](_0x2a4b6a))throw new _0x138eb8('sessions-register-already-registered',null,{'channelId':_0x2a4b6a});this['_registeredSessions']['set'](_0x2a4b6a,_0x3b6f0d),this['channelSessions']['set'](_0x2a4b6a,new _0x505ced()),this['channelConnectedUsers']['set'](_0x2a4b6a,new _0x505ced()),this['listenTo'](_0x3b6f0d,'add',(_0xc960b3,_0x1e2048)=>this['_handleSessionAdd'](_0x2a4b6a,_0x1e2048)),this['listenTo'](_0x3b6f0d,'remove',(_0x33d932,_0x18fbfb)=>this['_handleSessionRemove'](_0x2a4b6a,_0x18fbfb));for(const _0x5da6d2 of _0x3b6f0d)this['_handleSessionAdd'](_0x2a4b6a,_0x5da6d2);}['unregister'](_0x5c3bd3){if(!this['_registeredSessions']['has'](_0x5c3bd3))throw new _0x138eb8('sessions-unregister-not-exist',null,{'channelId':_0x5c3bd3});const _0x208648=this['_registeredSessions']['get'](_0x5c3bd3);this['stopListening'](_0x208648);for(const _0x197fe8 of _0x208648)'connected'===this['context']['plugins']['get'](n)['state']&&this['_handleSessionRemove'](_0x5c3bd3,_0x197fe8);this['_registeredSessions']['delete'](_0x5c3bd3),this['channelSessions']['delete'](_0x5c3bd3),this['channelConnectedUsers']['delete'](_0x5c3bd3);}get['mySessionId'](){return this['context']['plugins']['get'](n)['connection']['sessionId'];}['getUserBySessionId'](_0x5de3d9){for(const _0x45e8ed of this['channelSessions']['values']())for(const _0x42ba5f of _0x45e8ed)if(_0x42ba5f['id']===_0x5de3d9)return _0x42ba5f['user'];}['getUserSessions'](_0x159604,_0x4ddbd2){const _0x1cdbc6=_0x4ddbd2?[this['channelSessions']['get'](_0x4ddbd2)]:this['channelSessions']['values'](),_0x5836df=new Set();for(const _0x3257f8 of _0x1cdbc6)for(const _0x45977f of _0x3257f8)_0x45977f['user']['id']===_0x159604['id']&&_0x5836df['add'](_0x45977f['id']);return _0x5836df;}['getUserRole'](_0x585262){for(const _0x1e977e of this['channelSessions']['values']())for(const _0xeac735 of _0x1e977e)if(_0xeac735['user']===_0x585262)return _0xeac735['role'];}['_handleSessionAdd'](_0x310365,_0x401fe6){if('connected'!==this['context']['plugins']['get'](n)['state'])return;const _0x11b4c2=_0x401fe6['user'],_0x2c83bb=this['_users']['getUser'](_0x11b4c2['id'])||this['_createUser'](_0x11b4c2),_0x1a6e54=Object['assign']({},_0x401fe6,{'user':_0x2c83bb});if(this['channelSessions']['get'](_0x310365)['add'](_0x1a6e54),!_0x11b4c2['hiddenInPresenceList']){const _0x1edd0a=this['channelConnectedUsers']['get'](_0x310365);_0x1edd0a['has'](_0x2c83bb['id'])||_0x1edd0a['add'](_0x2c83bb),this['allConnectedUsers']['has'](_0x2c83bb['id'])||_0x11b4c2['hiddenInPresenceList']||this['allConnectedUsers']['add'](_0x2c83bb,_0x2c83bb['isMe']?0x0:void 0x0);}this['fire']('sessionAdd:'+_0x310365,{'channelId':_0x310365,'session':_0x1a6e54});}['_handleSessionRemove'](_0x378610,_0x18c17b){if('connected'!==this['context']['plugins']['get'](n)['state'])return;const _0x530739=this['channelConnectedUsers']['get'](_0x378610),_0x59a32c=_0x18c17b['user'];_0x59a32c['id']&&(this['channelSessions']['get'](_0x378610)['remove'](_0x18c17b['id']),_0x530739['has'](_0x59a32c['id'])&&!this['getUserSessions'](_0x59a32c,_0x378610)['size']&&_0x530739['remove'](_0x59a32c['id']),this['allConnectedUsers']['get'](_0x59a32c['id'])&&!this['getUserSessions'](_0x59a32c)['size']&&this['allConnectedUsers']['remove'](_0x59a32c['id']));}['_createUser'](_0x32597b,_0x592b00){const _0x3a21d4=this['_users']['addUser'](_0x32597b);return _0x592b00&&this['_users']['defineMe'](_0x32597b['id']),_0x3a21d4['orderNumber']=this['_uniqueUsersCount']++,_0x3a21d4;}}class G extends _0x1178f7{['_domEmitter']=new(_0x429a99())();static get['requires'](){return[i];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x3fb856=this['editor'],_0x530964=_0x3fb856['plugins']['get'](i);_0x3fb856['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x1e1725,{writer:_0x1bea8b})=>function(_0x446830,_0x378742,_0xf5041f,_0x1aec36){const _0xdb9c47=_0x446830['markerName']['split'](':')[0x2],_0x131087=_0xf5041f['getUserBySessionId'](_0xdb9c47);if(!_0x131087||_0xdb9c47===_0xf5041f['mySessionId'])return;if(!_0x1aec36['model']['schema']['checkChild'](_0x446830['markerRange']['start'],'$text'))return;const _0x3e9efc={'class':'ck-user__marker\x20'+_0x131087['color']['getMarkerClass'](),'data-name':_0x131087['name'],'data-session-id':_0xdb9c47},_0x1e8a02=_0x1aec36['model']['markers']['get'](_0x446830['markerName']),_0x1dedc5=_0x1e8a02['getStart'](),_0x31416c=_0x1dedc5['nodeAfter'],_0x5a96a3=_0x1aec36['model']['schema'];if(_0x31416c&&_0x5a96a3['isObject'](_0x31416c)&&_0x5a96a3['isInline'](_0x31416c)&&!_0x1aec36['model']['markers']['get']('user:range:'+_0xdb9c47)['getRange']()['isCollapsed'])return;const _0x16df7a=_0x1dedc5['parent'];return _0x1aec36['model']['schema']['isLimit'](_0x16df7a)&&!_0x1aec36['model']['hasContent'](_0x16df7a)&&(_0x3e9efc['contenteditable']=!0x1),function(_0x4d281b,_0x1e5fae,_0x4b5c18){const _0x4ad7f6=_0x4d281b['createUIElement']('span',_0x1e5fae);return _0x4d281b['setCustomProperty']('userPositionMarker',!0x0,_0x4ad7f6),_0x4ad7f6['render']=function(_0x4e470e){const _0x21369e=this['toDomElement'](_0x4e470e),_0x161b95=document['createElement']('span');return _0x161b95['classList']['add']('ck-user__marker-tooltip'),_0x161b95['setAttribute']('contenteditable','false'),_0x161b95['setAttribute']('spellcheck','false'),_0x161b95['textContent']=_0x4b5c18['name'],_0x21369e['innerHTML']='<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span>'+_0x161b95['outerHTML']+'',_0x21369e['addEventListener']('mouseenter',()=>{_0x21369e['classList']['add']('ck-user__marker_hovered');}),_0x21369e['addEventListener']('mouseleave',()=>{_0x21369e['classList']['remove']('ck-user__marker_hovered');}),_0x21369e;},_0x4ad7f6['isSimilar']=function(_0x54907f){return!(!this['getCustomProperty']('userPositionMarker')||!_0x54907f['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0x54907f['getAttribute']('data-session-id'));},_0x4ad7f6;}(_0x378742,_0x3e9efc,_0x131087);}(_0x1e1725,_0x1bea8b,_0x530964,_0x3fb856)}),_0x3fb856['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0x2503f8=>function(_0xe81e9e,_0x253286){const _0xaa29a0=_0xe81e9e['markerName']['split'](':')[0x2];if(_0xaa29a0===_0x253286['mySessionId'])return null;const _0x3a5696=_0x253286['getUserBySessionId'](_0xaa29a0);if(!_0x3a5696)return{'id':_0xaa29a0,'classes':[]};return{'id':_0xaa29a0,'classes':['ck-user__selection',_0x3a5696['color']['getSelectionClass']()],'attributes':{'data-session-id':_0xaa29a0},'priority':0x7d0+_0x3a5696['orderNumber']};}(_0x2503f8,_0x530964)}),function(_0x588300){const _0x2b7921=_0x588300['model'],_0x22154e=new Map(),_0x457bc0=_0x588300['plugins']['get'](i);_0x2b7921['markers']['on']('update:user:range',(_0x308648,_0x44418f,_0x27a4fb,_0x2367a3)=>{if(!_0x2367a3&&_0x22154e['get'](_0x44418f['name']))return _0x22154e['get'](_0x44418f['name'])['detach'](),void _0x22154e['delete'](_0x44418f['name']);const _0x1cde19=_0x44418f['name']['split'](':')[0x2];if(_0x1cde19===_0x457bc0['mySessionId'])return;const _0x2fb64a='user:position:'+_0x1cde19;_0x2b7921['markers']['has'](_0x2fb64a)&&_0x588300['editing']['reconvertMarker'](_0x2fb64a),_0x44418f['on']('change:range',(_0x247bc2,_0x12ae72,_0x30795)=>{if('$graveyard'!=_0x12ae72['root']['rootName']&&'$graveyard'==_0x44418f['getRange']()['root']['rootName']&&!_0x22154e['has'](_0x44418f['name'])){const _0x10bdb7=_0x2b7921['schema']['getNearestSelectionRange'](_0x30795['deletionPosition']);if(_0x10bdb7){const _0x30cc4c=_0x3b0e83['fromRange'](_0x10bdb7);_0x22154e['set'](_0x44418f['name'],_0x30cc4c),_0x30cc4c['on']('change:range',(_0x46d91b,_0x6aefc5,_0x552431)=>{if('$graveyard'==_0x30cc4c['root']['rootName']){const _0x263241=_0x2b7921['schema']['getNearestSelectionRange'](_0x552431['deletionPosition']);_0x263241?(_0x30cc4c['start']=_0x263241['start'],_0x30cc4c['end']=_0x263241['end']):(_0x22154e['delete'](_0x44418f['name']),_0x30cc4c['detach']());}});}}});}),_0x2b7921['document']['on']('change',()=>{_0x22154e['size']>0x0&&_0x2b7921['enqueueChange']({'isUndoable':!0x1},_0x4201c7=>{for(const [_0x2c2a21,_0x1e56d8]of _0x22154e)'$graveyard'==_0x2b7921['markers']['get'](_0x2c2a21)['getRange']()['root']['rootName']&&(re(_0x2c2a21['split'](':')[0x2],_0x1e56d8['toRange'](),_0x2b7921,_0x4201c7),_0x1e56d8['detach']());_0x22154e['clear']();});});}(_0x3fb856),this['_domEmitter']['listenTo'](_0x439b3d['document'],'keydown',(_0x2bd436,{key:_0x12dd3c})=>{'Escape'===_0x12dd3c&&function(_0x4e2597){_0x4e2597['editing']['view']['change'](_0x48b698=>{for(const _0x23f7dc of _0x4e2597['model']['markers']){if(!_0x23f7dc['name']['startsWith']('user:position'))continue;const _0x31f93b=_0x4e2597['editing']['mapper']['markerNameToElements'](_0x23f7dc['name']);if(_0x31f93b){for(const _0x2f57e7 of _0x31f93b)_0x48b698['removeClass']('ck-user__marker_hovered',_0x2f57e7);}}});}(_0x3fb856);},{'useCapture':!0x0});}['afterInit'](){const _0x5f179f=this['editor'],_0x1db3d7=_0x5f179f['commands']['get']('undo');_0x1db3d7&&_0x5f179f['model']['on']('applyOperation',(_0x596211,_0x26475b)=>{const _0xc100ec=_0x26475b[0x0];if(!_0xc100ec['isDocumentOperation'])return;if('marker'!=_0xc100ec['type']||!_0xc100ec['name']['startsWith']('user:'))return;const _0x4adf2a=_0xc100ec['batch'];_0x1db3d7['_createdBatches']['has'](_0x4adf2a)&&(_0xc100ec['newRange']=_0xc100ec['oldRange']?_0x5f179f['model']['createRange'](_0xc100ec['oldRange']['start'],_0xc100ec['oldRange']['end']):null);},{'priority':'highest'});}['destroy'](){return this['_domEmitter']['stopListening'](),super['destroy']();}['createUserMarkerOperations'](){const _0x404d4e=this['editor'],_0x8e5b6c=_0x404d4e['model']['document'],_0x4fbe1d=_0x404d4e['plugins']['get'](i);_0x404d4e['model']['enqueueChange']({'isUndoable':!0x1},_0xd610bb=>{const _0xb18e58='user:range:'+_0x4fbe1d['mySessionId'],_0x275e58='user:position:'+_0x4fbe1d['mySessionId'],_0x409905=_0x404d4e['model']['markers']['has'](_0xb18e58);_0x404d4e['editing']['view']['hasDomSelection']?re(_0x4fbe1d['mySessionId'],_0x8e5b6c['selection']['getFirstRange'](),_0x404d4e['model'],_0xd610bb):_0x409905&&(_0xd610bb['removeMarker'](_0xb18e58),_0xd610bb['removeMarker'](_0x275e58));});}}function re(_0x3d9c11,_0x2aa8f3,_0x48a46c,_0x18cb72){const _0x2c2c95='user:range:'+_0x3d9c11,_0x383f89='user:position:'+_0x3d9c11,_0x25c5ff=_0x2aa8f3['getContainedElement']();let _0x3b9d43=_0x2aa8f3['start'];if(_0x25c5ff&&_0x25c5ff['is']('element','tableCell')){const _0x20fb77=function(_0x36535c,_0x4774c9){for(const _0x3f4d83 of _0x36535c['getPositions']())if(_0x4774c9['schema']['checkChild'](_0x3f4d83,'$text'))return _0x3f4d83;}(_0x2aa8f3,_0x48a46c);_0x20fb77&&(_0x3b9d43=_0x20fb77,_0x2aa8f3=_0x18cb72['createRange'](_0x3b9d43));}const _0x2771ac=_0x18cb72['createRange'](_0x3b9d43);_0x48a46c['markers']['has'](_0x2c2c95)?(_0x18cb72['updateMarker'](_0x2c2c95,{'range':_0x2aa8f3}),_0x18cb72['updateMarker'](_0x383f89,{'range':_0x2771ac})):(_0x18cb72['addMarker'](_0x2c2c95,{'range':_0x2aa8f3,'usingOperation':!0x0}),_0x18cb72['addMarker'](_0x383f89,{'range':_0x2771ac,'usingOperation':!0x0}));}function $(_0x2fbf49,_0x39d501,_0x62cde2){const _0x366e91=_0x2fbf49['t'],t=_0x2fbf49['t'];switch(_0x39d501){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 _0x366e91({'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'},_0x62cde2);default:return'';}}let Q=0x1;class l extends _0x1178f7{static ['CollaborativeEditingService']=/* #__PURE__ -- @preserve */
|
|
25
|
-
((()=>_0x4aa299)());['_offset'];['sessionId'];['serverHistory'];['_channelId'];['_service'];['_document'];['_compressor'];['_bufferedOperations'];['_knownOperations'];['_knownRootNames'];['_pendingAction'];['_hasSelectionChanged'];['_sendBufferedOperationsDelayId'];['_baseBufferDelay'];['_currentBufferDelay'];['_lastSyncedOperationId'];['_disconnectionOperations'];['_operationIdentifier'];static get['requires'](){return[n,i,G,_0x477f66,_0x5d9668,_0x3b6069];}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 _0x496d54=this['serverHistory']['getOperations']();for(let _0x1cfa0d=_0x496d54['length']-0x1;_0x1cfa0d>=0x0;_0x1cfa0d--){const _0x190164=_0x496d54[_0x1cfa0d];if(!this['_disconnectionOperations']['has'](_0x190164))return _0x190164['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0x109fe7){if(super(_0x109fe7),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x3f7e60(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0x138eb8('collaboration-missing-channelid',this);const _0x4abff9=_0x109fe7['config']['get']('cloudServices.bundleVersion')||nt;this['_service']=new l['CollaborativeEditingService'](_0x4abff9,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0x3b6f0c(),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 OperationIdentifier(this['_disconnectionOperations']);}['init'](){const _0x250ef4=this['editor'],_0x8ba856=_0x250ef4['plugins']['get'](_0x5d9668),_0x2f877e=_0x250ef4['plugins']['get'](n);this['listenTo'](_0x8ba856,'getOperationAuthor',(_0x50caca,_0x14cbf7)=>{const _0x372178=_0x14cbf7[0x0];_0x372178['_authorId']&&(_0x50caca['return']=_0x8ba856['getUser'](_0x372178['_authorId']),_0x50caca['stop']()),null===_0x372178['_authorId']&&(_0x50caca['return']=null,_0x50caca['stop']());},{'priority':'high'}),this['listenTo'](_0x250ef4['model']['document']['selection'],'change:range',(_0xf8d251,_0x5366e1)=>{_0x5366e1['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x250ef4['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x250ef4['model']['on']('applyOperation',(_0x3c6181,_0x54d35f)=>{const _0x16b0fd=_0x54d35f[0x0];_0x16b0fd['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0x16b0fd),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['bind']('_isEditingAllowed')['to'](_0x2f877e,'state',this,'_hasSynchronizationProblem',(_0x12c9d9,_0x58eb47)=>'connected'===_0x12c9d9&&!_0x58eb47),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x250ef4['disableReadOnlyMode']('rtc-offline'):_0x250ef4['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x250ef4['disableReadOnlyMode']('rtc-offline'):_0x250ef4['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async['reconnect'](){const _0x5ef5a9=this['editor']['plugins']['get'](i),_0x1ee0eb=this['editor']['plugins']['get'](n);try{this['_isPendingUpdate']=!0x0,_0x5ef5a9['unregister'](this['_channelId']);const _0x1e60b9=await this['_service']['reconnect'](_0x1ee0eb['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0x1e60b9)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x2b3440=await this['_service']['getConnectedSessions']();_0x5ef5a9['register'](this['_channelId'],_0x2b3440),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x5baefd){if(function(_0x302672){return'404'===_0x302672['code'];}(_0x5baefd)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0x19cc1e){return'409'===_0x19cc1e['code'];}(_0x5baefd)){const _0x2881c4=$(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'](_0x2881c4);}else{if(!(_0x5baefd instanceof ReconnectionError))throw _0x5baefd;this['_handleReconnectionError']();}}}}['destroy'](){const _0x189883=this['editor']['plugins']['get'](n),_0x12274d=this['editor']['plugins']['get'](i);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x12274d['channelSessions']['has'](this['_channelId'])&&_0x12274d['unregister'](this['_channelId']),_0x189883['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async['_handleReconnectionResponse'](_0x1db030){if(this['sessionId']!==_0x1db030['sessionId']&&this['_lastSyncedOperationId']!==_0x1db030['lastOperationId'])throw new ReconnectionError();return this['sessionId']=_0x1db030['sessionId'],this['_handleServerResponse']([],{..._0x1db030,'wereChangesApplied':!0x1,'data':_0x1db030['data']},'reconnect');}async['_connectService'](_0x32f47d,_0x2bd8f5=!0x1){const {connection:_0x415285}=this['editor']['plugins']['get'](n);l['CollaborativeEditingService']['getConnectedSessions'](_0x415285,this['_channelId'])['then'](_0x39ec2c=>this['_initSessionsHandling'](_0x39ec2c))['catch'](_0x380663=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x380663);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x2a9d75,_0x2d09ff)=>{this['_crash']('realtimecollaborationclient-init-service-internal-error',_0x2d09ff);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_isConnected']=!0x1;});const _0x35270b=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x32f47d);this['_isPendingUpdate']=!0x0;const _0x3998c9=await this['_service']['connect'](_0x415285,this['_compressOperations'](_0x32f47d),_0x35270b);if(this['sessionId']=_0x3998c9['sessionId'],_0x2bd8f5){if(!_0x3998c9['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x3998c9['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0x32f47d,_0x3998c9,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x3998c9,_0x32f47d);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}['_handleSendingSelectionMarkers'](){const _0x51d626=this['editor']['plugins']['get'](i),_0xa0d40=this['editor']['plugins']['get'](G),_0x28d56b=_0x51d626['channelSessions']['get'](this['_channelId']);_0x28d56b&&_0x28d56b['length']>0x1?_0xa0d40['createUserMarkerOperations']():this['listenTo'](_0x51d626,'sessionAdd:'+this['_channelId'],()=>{0x2===_0x51d626['channelSessions']['get'](this['_channelId'])['length']&&_0xa0d40['createUserMarkerOperations']();});}async['_handleReceivedOperations'](_0x556763,_0x4969a8,_0x1489dc,_0x3b7b07){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x4969a8){const _0x1a367d=this['_decompressOperations'](_0x1489dc,_0x3b7b07);await this['_fetchMissingUsers'](_0x1a367d),this['_handleExternalOperations'](_0x1a367d,_0x4969a8,_0x1489dc['lastOperationId'])||this['_crash']('realtimecollaborationclient-init-service-incorrect-server-operation');}}async['_connectAfterSessionHasBeenFlushed'](){this['_disconnectService']();const {locale:_0x244cd2}=this['editor'];let _0x10fca9;try{_0x10fca9=await this['_service']['getDocumentDetails']();}catch{const _0x388086=$(_0x244cd2,'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'](_0x388086);}const _0x2ce69f=_0x10fca9['currentDocumentSession']||_0x10fca9['lastDocumentSession'];if(this['_lastSyncedOperationId']!==_0x2ce69f['lastOperationId']){const _0x3fa11c=$(_0x244cd2,'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'](_0x3fa11c);}await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);}['_disconnectService'](){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['stopListening'](this['_service']);}['_initSessionsHandling'](_0x42d829){const _0x3d413a=this['editor']['plugins']['get'](i);this['listenTo'](_0x3d413a,'sessionAdd:'+this['_channelId'],(_0x25bc19,{session:_0x1a0fd1})=>{if(_0x1a0fd1['id']===_0x3d413a['mySessionId']){_0x25bc19['off']();const _0x36a6e5=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0x3943de=_0x1a0fd1['permissions'];_0x36a6e5&&_0x36a6e5['isEnabled']&&(_0x3943de=_0x3943de['filter'](_0x37063d=>'document:write'!==_0x37063d)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0x3943de,this['_channelId']);}}),_0x3d413a['register'](this['_channelId'],_0x42d829);}['_initThrowingOnDataSet'](){const _0x1ac6b4=this['editor']['data']['set'];this['editor']['data']['set']=(..._0x13f5db)=>{if(!_0x13f5db[_0x13f5db['length']-0x1]['suppressErrorInCollaboration'])throw new _0x138eb8('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x1ac6b4['apply'](this['editor']['data'],_0x13f5db);};}['_setUpDataInit'](){this['editor']['data']['on']('init',(_0x1d971f,[_0x41fff5])=>{if(this['_document']['version'])throw new _0x138eb8('realtimecollaborationclient-init-document-already-initialized',this);_0x1d971f['stop'](),this['_setPendingAction']();const _0x576e50=this['editor']['config']['get']('rootsAttributes'),_0x45aad9=this['_getOperationsFromInitData'](_0x41fff5,_0x576e50);0x0==_0x45aad9['length']&&_0x45aad9['push'](new _0x42bd19(0x0)),_0x1d971f['return']=this['_connectService'](_0x45aad9)['then'](()=>{this['editor']['plugins']['get'](n)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x273bdf=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x273bdf))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x35a1ef,[_0x502b96,_0x5b5dd6])=>{_0x35a1ef['stop']();const _0x34b7e4=this['editor']['model']['document']['getRoot'](_0x502b96);if(!this['_knownRootNames']['has'](_0x502b96)){const _0x2008bc=_0x5b5dd6&&_0x5b5dd6['data']?_0x5b5dd6['data']:'',_0x31bcbb=_0x5b5dd6&&_0x5b5dd6['attributes']?_0x5b5dd6['attributes']:{};await this['_loadRoot'](_0x502b96,_0x2008bc,_0x31bcbb);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0x34b7e4['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0x34b7e4);});},{'priority':'high'});}async['_fetchMissingUsers'](_0x529e44){const _0x5b914e=this['editor']['plugins']['get'](_0x5d9668),{connection:_0x3b2456}=this['editor']['plugins']['get'](n),_0x3a029a=new Set();for(const _0x1ff6ec of _0x529e44){const _0x2bbcbe=_0x1ff6ec['_authorId'];_0x2bbcbe&&!_0x5b914e['getUser'](_0x2bbcbe)&&_0x3a029a['add'](_0x2bbcbe);}if(0x0===_0x3a029a['size'])return;const _0x3ba7e8=await rt['getMany'](_0x3b2456,Array['from'](_0x3a029a));for(const _0x5644f1 of _0x3ba7e8)_0x5b914e['getUser'](_0x5644f1['id'])||_0x5b914e['addUser'](_0x5644f1);}['_getOperationsFromInitData'](_0x320b20,_0x5067b3={}){const _0x1b9d7b=this['editor']['model'],_0x117e4e=[];let _0x4c7338=0x0;const _0x130d00='string'==typeof _0x320b20?{'main':_0x320b20}:_0x320b20;for(const _0x35d7c8 of Object['keys'](_0x130d00)){if(!this['_document']['roots']['has'](_0x35d7c8))throw new _0x138eb8('realtimecollaborationclient-init-non-existent-root',this);const _0x598fb7=this['editor']['data']['parse'](_0x130d00[_0x35d7c8]),_0x1e2230=this['_document']['getRoot'](_0x35d7c8),_0x3a7b43=new _0x17ca5c(_0x1b9d7b['createPositionAt'](_0x1e2230,0x0),_0x598fb7,_0x4c7338++);_0x117e4e['push'](_0x3a7b43);for(const [_0x35e894,_0x4fa1fc]of _0x598fb7['markers']){const _0x38560e=_0x1b9d7b['createRange'](_0x1b9d7b['createPositionFromPath'](_0x1e2230,_0x4fa1fc['start']['path']['slice']()),_0x1b9d7b['createPositionFromPath'](_0x1e2230,_0x4fa1fc['end']['path']['slice']())),_0x5777b7=new _0x5b36d3(_0x35e894,null,_0x38560e,_0x1b9d7b['markers'],!0x0,_0x4c7338++);_0x117e4e['push'](_0x5777b7);}}if(_0x5067b3)for(const [_0x48255a,_0x34961a]of Object['entries'](_0x5067b3)){const _0x23aaa5=_0x1b9d7b['document']['getRoot'](_0x48255a);if(!_0x23aaa5)throw new _0x138eb8('multi-root-editor-root-attributes-no-root',null);for(const [_0x2277cf,_0x3dedc6]of Object['entries'](_0x34961a))if(null!==_0x3dedc6){const _0xcac4e0=new _0x47a098(_0x23aaa5,_0x2277cf,null,_0x3dedc6,_0x4c7338++);_0x117e4e['push'](_0xcac4e0);}}return _0x117e4e;}async['_loadRoot'](_0x353643,_0x2d453a,_0x22c1a3){this['_getOperationsFromInitData']({[_0x353643]:_0x2d453a},{[_0x353643]:_0x22c1a3})['forEach']((_0x22a0e0,_0x4073a3)=>{_0x22a0e0['baseVersion']=this['_document']['version']+_0x4073a3,_0x22a0e0['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x22a0e0);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async['_handleInitialConnectionData'](_0x3e1129,_0x32c3cc){let _0x1f5c3e;this['_offset']=_0x3e1129['offset'];const _0x25c70e=_0x3e1129['wereChangesApplied']&&!_0x3e1129['initData'],_0x2f014b=_0x25c70e?0x0:_0x3e1129['data']['baseVersion'];if(_0x32c3cc['forEach'](_0x3da5c0=>{_0x3da5c0['_isInit']=!0x0,_0x3da5c0['createdAt']=_0x3e1129['sessionCreatedAt'],_0x3da5c0['_authorId']=null;}),_0x25c70e)_0x1f5c3e=_0x32c3cc,this['_applyOperationsSet'](_0x1f5c3e,_0x25c70e);else{if(_0x3e1129['initData']){const _0x592efa=this['_getOperationsFromInitData'](_0x3e1129['initData']);this['_document']['history']['version']=-_0x592efa['length'],_0x592efa['forEach'](_0x4aad44=>{_0x4aad44['baseVersion']-=_0x592efa['length'],_0x4aad44['createdAt']=_0x3e1129['sessionCreatedAt'],_0x4aad44['_isInit']=!0x0,_0x4aad44['_authorId']=null;}),this['_applyOperationsSet'](_0x592efa,!0x0),this['serverHistory']['version']=-_0x592efa['length']+this['_offset'],this['_updateServerHistory'](_0x592efa);}this['_document']['history']['version']=_0x2f014b,_0x1f5c3e=this['_decompressOperations'](_0x3e1129['data'],_0x3e1129['metadata']),await this['_fetchMissingUsers'](_0x1f5c3e),this['_applyOperationsSet'](_0x1f5c3e,_0x25c70e);}_0x3e1129['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x1f5c3e,_0x3e1129['lastOperationId']),this['_lastSyncedOperationId']=_0x3e1129['lastOperationId']),this['serverHistory']['version']=_0x2f014b+this['_offset'],this['_updateServerHistory'](_0x1f5c3e),_0x32c3cc['filter'](_0x25b807=>{const _0x11fdf9=this['_getAffectedRoot'](_0x25b807);return _0x11fdf9&&!this['_knownRootNames']['has'](_0x11fdf9);})['forEach']((_0x2277de,_0xb84cca)=>{_0x2277de['baseVersion']=this['_document']['version']+_0xb84cca,this['_saveOperationInBuffer'](_0x2277de);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x19d095,_0x1acaec){const _0x15ced5=_0x1acaec&&_0x1acaec['message'];if(_0x15ced5&&_0x15ced5['startsWith']('realtimecollaborationclient'))throw _0x1acaec;const _0x4e9ed1=this['editor']['plugins']['get'](n);throw this['_isPendingUpdate']=!0x0,_0x4e9ed1['disconnect'](),this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0x138eb8(_0x19d095,this['editor'],_0x15ced5?{'originalError':_0x15ced5}:void 0x0);}['_saveOperationInBuffer'](_0x46d8c0){this['_knownOperations']['has'](_0x46d8c0)||(this['_knownOperations']['add'](_0x46d8c0),this['_bufferedOperations']['push'](_0x46d8c0),this['_pendingAction']||'marker'==_0x46d8c0['type']&&!_0x46d8c0['affectsData']||this['_setPendingAction']());}['_sendBufferedOperationsDelayed'](_0x3c333e=!0x1){!_0x3c333e&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0x4be5d6=>{_0x4be5d6&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0x184df4=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0x4a0e2b){return _0x4a0e2b['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x4a0e2b['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0x4a0e2b['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0x184df4)||this['_crash'](_0x184df4['message'],_0x184df4);});},this['_currentBufferDelay']));}['_waitUntilSynced'](){return new Promise(_0x29abfa=>{this['on']('change:_isPendingUpdate',()=>{_0x29abfa();});});}async['_sendBufferedOperations'](){const _0x4a7c11=this['editor']['plugins']['get'](G);if(this['_shouldSendSelectionUpdate']()&&(_0x4a7c11['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x5cb1a3=[...this['_bufferedOperations']];for(const _0x3a9c60 of _0x5cb1a3)_0x3a9c60['wasUndone']=this['_document']['history']['isUndoneOperation'](_0x3a9c60);const _0x5e5a3b=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x5cb1a3),_0x345f4c=Q++,_0x5be54f=this['_compressOperations'](_0x5cb1a3),_0x3ff0e4=await this['_service']['sendOperations'](_0x5be54f,_0x5be54f['baseVersion'],_0x5e5a3b);try{return await this['_handleServerResponse'](_0x5cb1a3,_0x3ff0e4,_0x345f4c);}catch(_0x425735){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0x425735);}}async['_handleServerResponse'](_0x23f8a1,_0x329f18,_0x36b7f5){if('error'in _0x329f18)throw _0x329f18['error'];let _0x2c4166=!0x1;if(_0x329f18['wereChangesApplied']){_0x329f18['lastOperationId']&&(this['_lastSyncedOperationId']=_0x329f18['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x1ec746=>!_0x23f8a1['includes'](_0x1ec746));for(const _0x5edbe2 of _0x23f8a1)_0x5edbe2['createdAt']='lastOperationAcceptedAt'in _0x329f18&&_0x329f18['lastOperationAcceptedAt']||void 0x0;X(_0x23f8a1,_0x329f18['version']-_0x23f8a1['length']),this['_updateServerHistory'](_0x23f8a1);const _0x59d977=_0x23f8a1['filter'](_0x121e46=>{if(!_0x121e46['_isInit'])return!0x1;const _0x45915b=this['_getAffectedRoot'](_0x121e46);return _0x45915b&&!this['_knownRootNames']['has'](_0x45915b);});X(_0x59d977,this['_document']['version']),this['_applyOperationsSet'](_0x59d977),_0x2c4166=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0x44a952=this['_decompressOperations'](_0x329f18['data'],_0x329f18['metadata'])['filter'](_0x4fd408=>_0x4fd408['baseVersion']>=this['_lastServerVersion']);_0x44a952['forEach'](_0x96e8cb=>this['_addKnownRoot'](_0x96e8cb)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x553aac=>!_0x553aac['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x553aac))),this['_bufferedOperations']['length']&&X(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0x44a952),_0x2c4166=this['_handleExternalOperations'](_0x44a952,_0x329f18['version'],_0x329f18['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x2c4166?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}['_handleExternalOperations'](_0x3779bf,_0x318c15,_0x506cff){try{const _0x3d382b={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x2563fb,operationsB:_0x391588,originalOperations:_0x329e6a}=_0x4eaa7b(_0x3779bf,this['_bufferedOperations'],_0x3d382b);X(_0x2563fb,this['_document']['version']),X(_0x391588,_0x318c15);for(const _0x3ca111 of _0x2563fb){const _0x190aa2=_0x329e6a['get'](_0x3ca111);_0x3ca111['_authorId']=_0x190aa2?_0x190aa2['_authorId']:null;}_0x506cff&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x3779bf,_0x506cff),this['_lastSyncedOperationId']=_0x506cff),this['_bufferedOperations']=[..._0x391588],this['_applyOperationsSet'](_0x2563fb),this['_updateServerHistory'](_0x3779bf);}catch(_0x32e6cb){return console['error'](_0x32e6cb),!0x1;}return!0x0;}['_applyOperationsSet'](_0x183a90,_0x1155ba=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0xc45404=>{for(const _0x49f898 of _0x183a90)this['_knownOperations']['add'](_0x49f898),this['_addKnownRoot'](_0x49f898),_0xc45404['batch']['addOperation'](_0x49f898),this['editor']['model']['applyOperation'](_0x49f898);});}['_addKnownRoot'](_0x5cc1dd){const _0x3afeeb=this['_getAffectedRoot'](_0x5cc1dd);_0x3afeeb&&this['_knownRootNames']['add'](_0x3afeeb);}['_getAffectedRoot'](_0x325375){let _0xd233f2,_0x14eff1;switch(_0x325375['type']){case'insert':_0xd233f2=_0x325375['position']['root'];break;case'marker':if(_0x14eff1=_0x325375['newRange'],!_0x14eff1)return null;_0xd233f2=_0x14eff1['root'];break;case'addRootAttribute':_0xd233f2=_0x325375['root'];break;case'addRoot':_0xd233f2=_0x325375['affectedSelectable'];break;case'move':_0xd233f2=_0x325375['targetPosition']['root'];break;default:return null;}return _0xd233f2['rootName'];}['_updateServerHistory'](_0x19b7cc){_0x19b7cc['forEach'](_0x425c25=>{const _0x1cc394=_0x425c25['clone']();_0x1cc394['_authorId']=_0x425c25['_authorId'],_0x1cc394['_isInit']=!!_0x425c25['_isInit'],_0x1cc394['createdAt']=_0x425c25['createdAt'],_0x1cc394['baseVersion']+=this['_offset'],_0x425c25['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x1cc394),this['serverHistory']['addOperation'](_0x1cc394);});}['_handleReconnectionError'](_0x1672f5){const _0x83c180=this['editor']['plugins']['get']('Notification'),_0x1c146b=this['editor']['locale'];_0x1672f5||(_0x1672f5=$(_0x1c146b,'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.')),_0x83c180['showWarning'](_0x1672f5,{'title':$(_0x1c146b,'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'](_0x477f66)['add']($(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}['_clearPendingAction'](){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x477f66)['remove'](this['_pendingAction']),this['_pendingAction']=null);}['_compressOperations'](_0x18e7a0){const _0x157f62=_0x18e7a0['map'](_0x3b267c=>_0x3b267c['toJSON']());return this['_compressor']['compress'](_0x157f62);}['_decompressOperations'](_0x4d2960,_0x54ef68){return this['_compressor']['decompress'](_0x4d2960)['map']((_0x1b292c,_0xb9a8fc)=>{const _0x55cbfc='init'==_0x54ef68[_0xb9a8fc]['type'];if('InsertOperation'==_0x1b292c['__className']){const _0x423f25=_0x1b292c['position']['root'];!this['_document']['getRoot'](_0x423f25)&&(this['_document']['createRoot']('$root',_0x423f25)['_isAttached']=!0x1);}const _0x21368b=_0xc5e8b3['fromJSON'](_0x1b292c,this['_document']);return _0x21368b['wasUndone']=_0x1b292c['wasUndone'],_0x21368b['_isInit']=_0x55cbfc,_0x21368b['_authorId']=_0x55cbfc?null:_0x54ef68[_0xb9a8fc]['userId'],_0x21368b['_isDisconnection']='cs:removeUser'===_0x54ef68[_0xb9a8fc]['type'],_0x21368b['createdAt']=_0x54ef68[_0xb9a8fc]['createdAt'],_0x21368b;});}['_refreshUserSelectionMarkers'](){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}['_shouldSendSelectionUpdate'](){const _0xda53c4=this['editor']['plugins']['get'](i)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0xda53c4&&_0xda53c4['length']>0x1&&this['_hasSelectionChanged'];}['_shouldSendUpdate'](){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}}class ReconnectionError extends Error{}function X(_0x30e9c5,_0x5eb5cd){for(const _0x4254a1 of _0x30e9c5)_0x4254a1['baseVersion']=_0x5eb5cd++;}class OperationIdentifier{['_ignoredOperations'];['_operationToId'];constructor(_0x32c0c2){this['_ignoredOperations']=_0x32c0c2,this['_operationToId']=new WeakMap();}['getIdOfTheLastOperation'](_0x1e2b81){let _0x1a9641=_0x1e2b81['length'];for(;_0x1a9641--;){const _0x3140a0=_0x1e2b81[_0x1a9641];if(!this['_ignoredOperations']['has'](_0x3140a0)){if(!this['_operationToId']['has'](_0x3140a0)){const _0x2a7c46=_0x57da16()['slice'](0x1,0x12);this['_operationToId']['set'](_0x3140a0,_0x2a7c46);}return this['_operationToId']['get'](_0x3140a0);}}}['setIdForTheLastOperation'](_0x3f9fd1,_0xda224e){if(!_0xda224e)return;let _0x13c393=_0x3f9fd1['length'];for(;_0x13c393--;){const _0x2e9bfc=_0x3f9fd1[_0x13c393];this['_ignoredOperations']['has'](_0x2e9bfc)||this['_operationToId']['set'](_0x2e9bfc,_0xda224e);}}}class a extends _0x1178f7{static get['requires'](){return[l];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class s extends _0x38fb43{static ['CommentsService']=/* #__PURE__ -- @preserve */
|
|
26
|
-
((()=>_0x17ae11)());['_services'];static get['requires'](){return[n,'CommentsRepository',i,_0x5d9668];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x13e5cd){super(_0x13e5cd),this['_services']=new Map();}async['init'](){const _0x49a5ad=this['context'],_0x2bc3c5=_0x49a5ad['plugins']['get']('CommentsRepository');if(_0x49a5ad['plugins']['get'](n)['addToReconnectionStack'](this),_0x2bc3c5['adapter']={'addCommentThread':async({channelId:_0x5c02fe,threadId:_0x2d3168,comments:_0x598380,resolvedAt:_0x491b97,resolvedBy:_0x579fd4,context:_0x5db092,attributes:_0x19c09c})=>{const _0x4d9614=await this['_getService'](_0x5c02fe)['addCommentThread']({'commentThreadId':_0x2d3168,'comments':_0x598380['map'](_0x412117=>function(_0x4a4194,_0x435185,_0x438de6){return{'commentThreadId':_0x438de6,'commentId':_0x4a4194['commentId'],'userId':_0x4a4194['authorId'],'content':_0x4a4194['content'],'documentId':_0x435185,'createdAt':_0x4a4194['createdAt'],'attributes':_0x4a4194['attributes']||{}};}(_0x412117,_0x5c02fe,_0x2d3168)),'resolvedAt':_0x491b97,'resolvedBy':_0x579fd4,'context':_0x5db092,'attributes':_0x19c09c})['catch'](at);return{'threadId':_0x4d9614['commentThreadId'],'comments':_0x4d9614['comments']};},'getCommentThread':async({channelId:_0x2630f7,threadId:_0x10d1cb})=>{const _0x17ada5=await this['_getService'](_0x2630f7)['getCommentThread'](_0x10d1cb)['catch'](F)['catch'](at);return _0x17ada5?_0x17ada5['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0x17ada5]),{'threadId':_0x17ada5['commentThreadId'],'comments':_0x17ada5['comments']['map'](S),'context':_0x17ada5['context'],'resolvedAt':_0x17ada5['resolvedAt'],'resolvedBy':_0x17ada5['resolvedBy'],'attributes':_0x17ada5['attributes']||{}}):null;},'updateCommentThread':async({channelId:_0x56d48e,threadId:_0x5a2485,context:_0x179570,unlinkedAt:_0x37ffca,attributes:_0x23afa0})=>this['_getService'](_0x56d48e)['updateCommentThread']({'commentThreadId':_0x5a2485,'context':_0x179570,'attributes':_0x23afa0,'unlinkedAt':_0x37ffca})['catch'](F)['catch'](at),'resolveCommentThread':async({channelId:_0x34dec0,threadId:_0x3edf65})=>{const _0xf61d77=await this['_getService'](_0x34dec0)['resolveCommentThread'](_0x3edf65)['catch'](F)['catch'](at);return{'threadId':_0xf61d77['commentThreadId'],'resolvedAt':_0xf61d77['resolvedAt'],'resolvedBy':_0xf61d77['resolvedBy']};},'reopenCommentThread':async({channelId:_0x58e8a9,threadId:_0x187e40})=>this['_getService'](_0x58e8a9)['reopenCommentThread'](_0x187e40)['catch'](F)['catch'](at),'removeCommentThread':({channelId:_0x33d1a0,threadId:_0x17d03f})=>this['_getService'](_0x33d1a0)['removeCommentThread'](_0x17d03f)['catch'](F)['catch'](at),'addComment':({channelId:_0x572976,threadId:_0x379621,commentId:_0x2ca90a,content:_0x16eae0,attributes:_0x3da434})=>this['_getService'](_0x572976)['addComment'](_0x379621,_0x2ca90a,_0x16eae0,_0x3da434)['catch'](at),'updateComment':({channelId:_0x41d31e,threadId:_0x118389,commentId:_0x3525f2,content:_0x51dc34,attributes:_0x8cf56c})=>this['_getService'](_0x41d31e)['updateComment'](_0x118389,_0x3525f2,_0x51dc34,_0x8cf56c)['catch'](F)['catch'](at),'removeComment':({channelId:_0x2ead83,threadId:_0x39c0ff,commentId:_0x2dffce})=>this['_getService'](_0x2ead83)['removeComment'](_0x39c0ff,_0x2dffce)['catch'](F)['catch'](at)},_0x49a5ad instanceof _0x8ee687){const _0x4f9195=_0x49a5ad['config']['get']('collaboration.channelId'),_0x21b23b=_0x49a5ad['plugins']['get'](i);await this['_setUpService'](_0x4f9195);const _0xb0f426=await this['_services']['get'](_0x4f9195)['getConnectedSessions']();this['listenTo'](_0x21b23b,'sessionAdd:'+_0x4f9195,(_0x322db2,{session:_0x58bb0a})=>{_0x58bb0a['id']===_0x21b23b['mySessionId']&&(_0x322db2['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x58bb0a['permissions'],_0x4f9195));}),_0x21b23b['register'](_0x4f9195,_0xb0f426);}}async['_setUpService'](_0x4521d3){if(this['_services']['has'](_0x4521d3))throw new _0x138eb8('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0x4521d3});const _0x5eed65=this['context']['plugins']['get']('CommentsRepository'),_0x592115=new s['CommentsService'](_0x4521d3);this['_services']['set'](_0x4521d3,_0x592115),this['listenTo'](_0x592115,'commentThreadAdded',(_0x37742a,_0xc9f158)=>{const {commentThreadId:_0x23dafc,documentId:_0x350801,context:_0x4c18e0,attributes:_0x388be6,resolvedAt:_0x391b80,resolvedBy:_0x5f28dc,comments:_0x5eb94e}=_0xc9f158;_0x5eed65['getCommentThread'](_0x23dafc)||_0x5eed65['addCommentThread']({'threadId':_0x23dafc,'channelId':_0x350801,'comments':_0x5eb94e?_0x5eb94e['map'](S):[],'context':_0x4c18e0,'attributes':_0x388be6,'resolvedAt':_0x391b80,'resolvedBy':_0x5f28dc,'isFromAdapter':!0x0});}),this['listenTo'](_0x592115,'commentThreadUpdated',(_0x4e6cdf,{commentThreadId:_0x419de7,documentId:_0x375444,context:_0x5ab033,unlinkedAt:_0x2e0a21,attributes:_0x103bcc})=>{_0x5eed65['getCommentThread'](_0x419de7)&&_0x5eed65['updateCommentThread']({'threadId':_0x419de7,'channelId':_0x375444,'context':_0x5ab033,'unlinkedAt':_0x2e0a21,'attributes':_0x103bcc,'isFromAdapter':!0x0});}),this['listenTo'](_0x592115,'commentThreadResolved',(_0x27bc71,{commentThreadId:_0x447c0a,resolvedBy:_0x5dccf6,resolvedAt:_0x3eb5fc})=>{const _0x13e57c=_0x5eed65['getCommentThread'](_0x447c0a);_0x13e57c&&_0x13e57c['resolve']({'resolvedBy':_0x5dccf6,'resolvedAt':_0x3eb5fc,'isFromAdapter':!0x0});}),this['listenTo'](_0x592115,'commentThreadReopened',(_0x11cef4,{commentThreadId:_0x1baef2})=>{const _0x567062=_0x5eed65['getCommentThread'](_0x1baef2);_0x567062&&_0x567062['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0x592115,'commentThreadRemoved',(_0x61dd81,{commentThreadId:_0x361c37})=>{const _0xcf0a24=_0x5eed65['getCommentThread'](_0x361c37);_0xcf0a24&&_0xcf0a24['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0x592115,'commentAdded',(_0x21e469,_0x2599e2)=>{const _0x10fe69=_0x2599e2['commentThreadId'],_0x42b570=_0x5eed65['getCommentThread'](_0x10fe69);_0x42b570&&_0x42b570['addComment']({...S(_0x2599e2),'isFromAdapter':!0x0});}),this['listenTo'](_0x592115,'commentUpdated',(_0x56d683,{commentThreadId:_0x506572,commentId:_0x57c7a4,content:_0xfc9909,attributes:_0x360a1b})=>{const _0x2d7601=_0x5eed65['getCommentThread'](_0x506572);if(_0x2d7601){const _0x305b21=_0x2d7601['getComment'](_0x57c7a4);_0x305b21&&_0x305b21['update']({'content':_0xfc9909,'attributes':_0x360a1b,'isFromAdapter':!0x0});}}),this['listenTo'](_0x592115,'commentRemoved',(_0x224540,{commentThreadId:_0x2692b4,commentId:_0x238e69})=>{const _0x495fcd=_0x5eed65['getCommentThread'](_0x2692b4);if(_0x495fcd){const _0x246f68=_0x495fcd['getComment'](_0x238e69);_0x246f68&&_0x246f68['remove']({'isFromAdapter':!0x0});}}),await this['_connectService'](_0x4521d3);}['destroy'](){if(this['context']instanceof _0x8ee687){const _0x2f6c2b=this['context']['config']['get']('collaboration.channelId');this['_terminateService'](_0x2f6c2b);}}['_terminateService'](_0x227a06){if(!this['_services']['has'](_0x227a06))throw new _0x138eb8('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0x227a06});this['_getService'](_0x227a06)['disconnect'](),this['_services']['delete'](_0x227a06);}async['reconnect'](){for(const _0x4a4990 of this['_services']['keys']())await this['_connectService'](_0x4a4990);if(this['context']instanceof _0x8ee687){const _0x551c54=this['context']['config']['get']('collaboration.channelId'),_0x1d5c67=this['context']['plugins']['get'](i);_0x1d5c67['unregister'](_0x551c54);const _0x296be1=await this['_services']['get'](_0x551c54)['getConnectedSessions']();_0x1d5c67['register'](_0x551c54,_0x296be1);}}async['_connectService'](_0x263ca9){const {connection:_0x149509}=this['context']['plugins']['get'](n),_0x32c57d=this['context']['plugins']['get']('CommentsRepository'),_0x36041a=this['_services']['get'](_0x263ca9),_0x180c66=await _0x36041a['connect'](_0x149509);await this['_fetchMissingUsersForThreads'](_0x180c66);const _0x211615=new Set(Array['from'](_0x32c57d['getCommentThreads']({'channelId':_0x263ca9}),_0x59392a=>_0x59392a['id']));for(const _0x11e64a of _0x180c66)_0x11e64a['deletedAt']||_0x211615['delete'](_0x11e64a['commentThreadId']);for(const _0x210f47 of _0x211615)_0x32c57d['getCommentThread'](_0x210f47)['remove']({'isFromAdapter':!0x0});for(const _0x49de5c of _0x180c66){let _0x31f803=_0x32c57d['getCommentThread'](_0x49de5c['commentThreadId']);const {commentThreadId:_0x1eeddd,context:_0x56e29a,attributes:_0x5d0b56,resolvedBy:_0x55e2a4,resolvedAt:_0x250a9a,unlinkedAt:_0x5ac4a1,deletedAt:_0x2cea27}=_0x49de5c;if(_0x2cea27)continue;_0x31f803||(_0x31f803=_0x32c57d['addCommentThread']({'channelId':_0x263ca9,'threadId':_0x1eeddd,'context':_0x56e29a,'attributes':_0x5d0b56||{},'resolvedBy':_0x55e2a4,'resolvedAt':_0x250a9a,'unlinkedAt':_0x5ac4a1,'isFromAdapter':!0x0}));const _0x1b3705=new Set(Array['from'](_0x31f803['comments'],_0x4fe8b8=>_0x4fe8b8['id']));for(const _0x22e8a1 of _0x49de5c['comments'])_0x1b3705['delete'](_0x22e8a1['commentId']);for(const _0x47f00e of _0x1b3705)_0x31f803['getComment'](_0x47f00e)['remove']({'isFromAdapter':!0x0});for(const _0x50dbbb of _0x49de5c['comments']){const _0x222df1=_0x31f803['getComment'](_0x50dbbb['commentId']);_0x222df1?_0x222df1['content']!==_0x50dbbb['content']&&_0x222df1['update']({'content':_0x50dbbb['content'],'isFromAdapter':!0x0}):_0x31f803['addComment'](Object['assign'](S(_0x50dbbb),{'isFromAdapter':!0x0}));}}}['_getService'](_0x11e698){if(!this['_services']['has'](_0x11e698))throw new _0x138eb8('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0x11e698});return this['_services']['get'](_0x11e698);}async['_fetchMissingUsersForThreads'](_0xcaedb0){const _0x228f2b=this['context']['plugins']['get'](_0x5d9668),{connection:_0x5bc7bc}=this['context']['plugins']['get'](n),_0x38a5a7=new Set();for(const {resolvedBy:_0x241b4b,comments:_0x17bbce}of _0xcaedb0){_0x241b4b&&!_0x228f2b['getUser'](_0x241b4b)&&_0x38a5a7['add'](_0x241b4b);for(const {userId:_0x37bc16}of _0x17bbce)_0x228f2b['getUser'](_0x37bc16)||_0x38a5a7['add'](_0x37bc16);}if(0x0===_0x38a5a7['size'])return;const _0x394bc1=await rt['getMany'](_0x5bc7bc,Array['from'](_0x38a5a7));for(const _0x15eda4 of _0x394bc1)_0x228f2b['getUser'](_0x15eda4['id'])||_0x228f2b['addUser'](_0x15eda4);}}async function F(_0xd99f7f){if('404'!==_0xd99f7f['code'])throw _0xd99f7f;}function at(_0x1814c8){if((_0x267106=_0x1814c8)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0x267106['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x267106['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0x267106;throw _0x1814c8;}function S(_0x4fe8ea){return{'threadId':_0x4fe8ea['commentThreadId'],'commentId':_0x4fe8ea['commentId'],'content':_0x4fe8ea['content'],'createdAt':_0x4fe8ea['createdAt'],'authorId':_0x4fe8ea['userId'],'attributes':_0x4fe8ea['attributes']||{}};}class m extends _0x1178f7{static ['TrackChangesService']=/* #__PURE__ -- @preserve */
|
|
27
|
-
((()=>
|
|
28
|
-
((()=>_0x366578)());['_lastRequestId'];['_revisionTracker'];['_revisionHistoryService'];['_oldOffset'];static get['requires'](){return[n,l,'RevisionHistory',i,_0x5d9668];}static get['pluginName'](){return'CloudServicesRevisionHistoryAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x30dede){super(_0x30dede);const _0x5648e2=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new c['RevisionHistoryService'](_0x5648e2);}async['init'](){const _0x165afb=this['editor']['plugins']['get'](l),_0x182cf4=_0x165afb['serverHistory'],_0x309add=this['editor']['plugins']['get'](n);this['_revisionTracker']['setSource']({'history':_0x182cf4,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0x165afb['sessionId']});const _0x472b8c=this['editor']['config']['get']('cloudServices.bundleVersion')||nt,_0xf4c6d6=await _0x332ed7['isBundleUploaded'](_0x309add['connection'],_0x472b8c);this['editor']['plugins']['get']('RevisionHistory')['adapter']={'getRevision':async({revisionId:_0x28bc27})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0x28bc27)),'updateRevisions':async _0x4d39f1=>{await this['_waitForServiceReady']();const _0x4b310b=this['_revisionTracker']['currentRevision'];if(_0xf4c6d6&&0x1===_0x4d39f1['length']&&_0x4d39f1[0x0]['id']===_0x4b310b['id'])return _0x4d39f1;for(const _0x11361c of _0x4d39f1)_0x11361c['id']===_0x4b310b['id']&&(_0x11361c['isEmptyCurrent']=_0x11361c['fromVersion']===_0x11361c['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0x4d39f1,this['_lastRequestId'])['then'](_0x36862d=>(this['_lastRequestId']=_0x36862d,_0x4d39f1))['catch'](_0x35d00a=>{if(q(_0x35d00a)||'400'===_0x35d00a['code']&&void 0x0!==_0x35d00a['data']['wrongRequestId']){for(const _0x37a5c2 of _0x4d39f1){!this['_revisionTracker']['repository']['getRevision'](_0x37a5c2['id'])||this['_revisionTracker']['_bufferUpdate'](_0x37a5c2['id'],_0x37a5c2,!0x1);}if(q(_0x35d00a))throw _0x35d00a;return _0x4d39f1;}throw _0x35d00a;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0x3202fd,{revisionsData:_0x159708,requestId:_0x416891})=>{Math['max'](..._0x159708['map'](_0x3ef8ae=>_0x3ef8ae['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0x159708,_0x416891);}):this['_handleRevisionsUpdate'](_0x159708,_0x416891);});const {revisions:_0x1f6c66,requestId:_0x248d0d}=await this['_revisionHistoryService']['connect'](_0x309add['connection']);_0x309add['addToReconnectionStack'](this),this['_lastRequestId']=_0x248d0d,await this['_fetchMissingUsers'](_0x1f6c66);for(const _0x46406a of _0x1f6c66)this['_revisionTracker']['addRevisionData'](_0x46406a);this['listenTo'](_0x165afb,'change:_isConnected',(_0x3420ca,_0x11c8cf,_0x20a0d0)=>{_0x20a0d0&&(this['_oldOffset']=_0x165afb['_offset'],_0x3420ca['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](_0x309add,'state',_0x514d62=>_0x514d62===_0x34396e['CONNECTED']);}async['reconnect'](){const _0x49f870=this['editor']['plugins']['get'](n),_0x27af14=this['editor']['plugins']['get'](l),_0x323168=async()=>{const _0x2d1f93=this['_revisionTracker']['currentRevision'],_0x4bb6a0=_0x2d1f93['id'],_0x4ba31c=_0x4bb6a0!==_0x27af14['sessionId'];if(_0x4ba31c){const _0x3ab54e=_0x27af14['_offset']-this['_oldOffset'],_0xff6b90=this['_getLatestVersionFromServerOperations']();this['_revisionTracker']['_revisionDataBuilder']['reInit']();if(_0x2d1f93['toVersion']+_0x3ab54e!==_0xff6b90){const _0x26a906=_0x2d1f93['fromVersion']+_0x3ab54e,_0x69c619=this['editor']['plugins']['get'](_0x5d9668),_0x5df535=this['_revisionTracker']['buildRevisionData']({'revision':_0x2d1f93,'from':_0x26a906,'to':_0xff6b90});_0x5df535['id']=_0x2d1f93['id'];const _0x3fe8d0=_0x5df535['authorsIds']['map'](_0x51ea3a=>_0x69c619['getUser'](_0x51ea3a));_0x2d1f93['_update']({..._0x5df535,'authors':_0x3fe8d0},!0x0),this['_revisionTracker']['_bufferUpdate'](_0x2d1f93['id'],_0x5df535,!0x0);}this['_revisionTracker']['_startingVersion']=_0xff6b90,(_0x2d1f93['toVersion']===_0x2d1f93['fromVersion']&&!this['_revisionTracker']['_bufferedUpdates']['has'](_0x4bb6a0)&&this['_revisionTracker']['repository']['_revisions']['remove'](_0x4bb6a0),this['_revisionTracker']['_createCurrentRevision'](_0xff6b90));}const {revisions:_0x1eba7b,requestId:_0x56b61e}=await this['_revisionHistoryService']['reconnect'](_0x49f870['connection'],this['_lastRequestId']);_0x4ba31c&&_0x1eba7b['length']>0x0?_0x27af14['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x1eba7b),this['_handleRevisionsUpdate'](_0x1eba7b,_0x56b61e),this['_revisionTracker']['sendBufferedUpdates']());};return _0x27af14['_isConnected']?_0x323168():new Promise((_0x5ec513,_0x5f3b92)=>{_0x27af14['once']('change:_isConnected',()=>{_0x323168()['then'](_0x5ec513)['catch'](_0x5f3b92);});});}['destroy'](){super['destroy']();}async['_waitForServiceReady'](){this['_revisionHistoryService']['isConnected']||await new Promise(_0x29b26b=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x48404c=>{_0x48404c['off'](),_0x29b26b();});});}['_getLatestVersionFromServerOperations'](){const _0x28e8b6=this['editor']['plugins']['get'](l)['serverHistory']['getOperations']()['reverse']();for(const _0x2ec61f of _0x28e8b6)if('marker'!==_0x2ec61f['type']||_0x2ec61f['affectsData'])return _0x2ec61f['baseVersion']+0x1;}['_getLatestVersion'](){const _0x18f501=this['editor']['plugins']['get'](l);return new Promise(_0x1e8fd3=>{_0x18f501['_isPendingUpdate']?_0x18f501['once']('change:_isPendingUpdate',()=>{_0x1e8fd3(this['_getLatestVersionFromServerOperations']());}):_0x1e8fd3(this['_getLatestVersionFromServerOperations']());});}['_handleRevisionsUpdate'](_0x46abd9,_0x142875){const _0x108593=this['_revisionTracker']['repository'];this['_lastRequestId']=_0x142875;for(const _0x364fac of _0x46abd9){const _0x49bb7a=_0x108593['getRevision'](_0x364fac['id']);if(_0x49bb7a){if((_0x364fac['fromVersion']||_0x364fac['toVersion'])&&(_0x364fac['diffData']=null),_0x49bb7a===this['_revisionTracker']['currentRevision']){const _0x172e13=Math['max'](_0x49bb7a['toVersion'],_0x364fac['toVersion']),_0x27b94a=Math['max'](_0x49bb7a['fromVersion'],_0x364fac['fromVersion']);let _0x2ceae0;_0x49bb7a['toVersion']===_0x364fac['toVersion']&&_0x49bb7a['fromVersion']===_0x364fac['fromVersion']?(_0x2ceae0=!0x0,this['_preventResendingRevisionData'](_0x364fac)):_0x364fac['toVersion']===_0x172e13&&_0x364fac['fromVersion']===_0x27b94a?_0x2ceae0=!0x1:(_0x49bb7a['toVersion']===_0x172e13&&_0x49bb7a['fromVersion']===_0x27b94a||this['_fixRevision']({'revision':_0x49bb7a,'from':_0x27b94a,'to':_0x172e13}),_0x2ceae0=!0x0),_0x2ceae0&&(delete _0x364fac['fromVersion'],delete _0x364fac['toVersion'],delete _0x364fac['diffData'],delete _0x364fac['createdAt'],delete _0x364fac['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0x364fac),this['_preventResendingRevisionData'](_0x364fac);}else this['_revisionTracker']['addRevisionData'](_0x364fac);}const _0x254d9e=_0x108593['getRevisions']();_0x254d9e['reverse']();for(let _0x35e280=0x0;_0x35e280<_0x254d9e['length']-0x1;_0x35e280++){const _0x2de3cb=_0x254d9e[_0x35e280],_0x90cf37=_0x254d9e[_0x35e280+0x1];if(_0x2de3cb['fromVersion']<_0x90cf37['toVersion']){const _0x18c152=_0x90cf37['toVersion'],_0x313fa3=Math['max'](_0x18c152,_0x2de3cb['toVersion']);this['_fixRevision']({'revision':_0x2de3cb,'from':_0x18c152,'to':_0x313fa3});}}}['_fixRevision']({revision:_0x20a67c,from:_0x4e1c2c,to:_0x30a7a9}={}){const _0x34c29b=this['editor']['plugins']['get'](_0x5d9668),_0x5bf867=this['_revisionTracker']['buildRevisionData']({'revision':_0x20a67c,'from':_0x4e1c2c,'to':_0x30a7a9});_0x5bf867['authors']=_0x5bf867['authorsIds']['map'](_0x458f7e=>_0x34c29b['getUser'](_0x458f7e)),_0x20a67c['_update'](_0x5bf867);}['_preventResendingRevisionData'](_0x32679f){const _0x5da08c={};_0x5da08c['id']=_0x32679f['id'];for(const _0xa738cd of Object['keys'](_0x32679f))'id'!==_0xa738cd&&(_0x5da08c[_0xa738cd]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0x5da08c['id'],_0x5da08c,!0x0);}async['_fetchMissingUsers'](_0x39c3a3){const _0x2548f4=this['editor']['plugins']['get'](_0x5d9668),{connection:_0x4e0b1f}=this['editor']['plugins']['get'](n),_0x476bf2=new Set();for(const _0x1dc68d of _0x39c3a3){for(const _0xed4e73 of _0x1dc68d['authorsIds'])_0x569675(_0xed4e73);_0x1dc68d['creatorId']&&_0x569675(_0x1dc68d['creatorId']);}if(0x0===_0x476bf2['size'])return;const _0x5a73b2=await rt['getMany'](_0x4e0b1f,Array['from'](_0x476bf2));for(const _0x50a1a9 of _0x5a73b2)_0x2548f4['getUser'](_0x50a1a9['id'])||_0x2548f4['addUser'](_0x50a1a9);function _0x569675(_0x12cebd){_0x2548f4['getUser'](_0x12cebd)||_0x476bf2['add'](_0x12cebd);}}}function q(_0x4de56b){return _0x4de56b['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0x4de56b['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x4de56b['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class RealTimeCollaborativeRevisionHistory extends _0x1178f7{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 _0x260788{['_collapseAt'];constructor(_0x5d9543,_0x5a3d14=0x6){super(_0x5d9543);const _0x37714f=this['bindTemplate'];this['set']('isHidden',!0x0),this['set']('usersCount',0x0),this['_collapseAt']=_0x5a3d14,this['bind']('isHidden')['to'](this,'usersCount',_0x4e91df=>_0x4e91df<_0x5a3d14),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item',_0x37714f['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':_0x37714f['to']('usersCount',_0xbcccd7=>'+'+(_0xbcccd7-this['_collapseAt']+0x2)['toString']())}]}]}]});}}class is extends _0x260788{['items'];['keystrokes'];constructor(_0x1427c4){super(_0x1427c4);const _0x2d23c5=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0x5c6d96(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0x2d23c5['if']('hasPopup'),'aria-expanded':_0x2d23c5['to']('isExpanded',_0x22d0cd=>this['hasPopup']&&String(_0x22d0cd)),'aria-label':_0x2d23c5['to']('hasPopup',_0x417be1=>$(_0x1427c4,_0x417be1?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0x2d23c5['to']('hasPopup',_0x4978ca=>!!_0x4978ca&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items'],'on':{'mouseenter':_0x2d23c5['to'](()=>this['fire']('presencelist:show')),'mouseleave':_0x2d23c5['to'](_0x31f6ce=>{const _0x9276b5=_0x31f6ce,_0xd490e5=document['querySelector']('.ck-presence-list__dropdown-list'),_0x3a63a9=document['querySelector']('.ck-balloon-panel_with-arrow');_0xd490e5?.['contains'](_0x9276b5['relatedTarget'])||_0x3a63a9?.['contains'](_0x9276b5['relatedTarget'])||this['fire']('presencelist:hide');})}}),this['on']('change:hasPopup',(_0x2cd15f,_0x3d5ca1,_0x458fe8)=>{this['element']&&(_0x458fe8?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 _0x260788{['counterView'];['inlineListView'];constructor(_0xe2c1be,_0x2aba97=0x6){super(_0xe2c1be);const _0x48605d=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new b(this['locale'],_0x2aba97),this['inlineListView']=new is(_0xe2c1be),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x20e051 of this['inlineListView']['items'])_0x20e051['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',_0x48605d['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['inlineListView']]});}}class L extends _0x260788{['listWrapperView'];constructor(_0x268a9c,_0x3e69ab){super(_0x268a9c);const _0x1935ce=this['bindTemplate'];this['listWrapperView']=new PresenceDropdownListWrapperView(_0x268a9c,_0x3e69ab),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':$(_0x268a9c,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']],'on':{'mouseleave':_0x1935ce['to'](_0x1372ca=>{const _0x4d38e3=_0x1372ca,_0x49d977=document['querySelector']('.ck-presence-list__list'),_0x4ef5db=document['querySelector']('.ck-balloon-panel_with-arrow');_0x49d977?.['contains'](_0x4d38e3['relatedTarget'])||_0x4ef5db?.['contains'](_0x4d38e3['relatedTarget'])||this['fire']('presencelist:hide');})}});}}class PresenceDropdownListWrapperView extends _0x1953fa{constructor(_0x4c2635,_0x2f7bbd){super(_0x4c2635);const _0x43f77=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0x2f7bbd?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0x43f77['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0x43f77['to']('role'),'aria-label':_0x43f77['to']('ariaLabel'),'aria-labelledby':_0x43f77['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0x439b3d['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0x4e5d15=this['element'];_0x4e5d15&&(this['_isScrollable']=Math['max'](_0x4e5d15['scrollHeight'],_0x4e5d15['clientHeight'])>0.8*window['innerHeight']);}}class j extends et{['userView'];constructor(_0x3208dd,_0x288fc9,_0x4cf922){super(_0x3208dd);const _0x495055=this['bindTemplate'];this['userView']=new st(_0x3208dd,_0x288fc9);const _0x4578c1={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0x288fc9['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0x288fc9['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x288fc9['color']['getBackgroundColorClass']()],'aria-hidden':'true'}}]};_0x4cf922&&(_0x4578c1['tag']='button',_0x4578c1['on']={'click':_0x495055['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x4578c1);}['focus'](){this['element']['focus']();}}class A extends _0x260788{['userView'];['markerView'];constructor(_0x2587cb,_0x1c3929,_0x4bc803){super(_0x2587cb);const _0x64eebe=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new st(_0x2587cb,_0x1c3929),this['markerView']=new MarkerView(_0x2587cb,_0x1c3929);const _0x1dcdd4=new it(_0x2587cb);_0x1dcdd4['template']['tag']='span',_0x1dcdd4['text']=_0x1c3929['name'];const _0x147d26={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0x64eebe['to']('isFocusable',_0x2196f5=>!!_0x2196f5&&0x0),'aria-labelledby':_0x1dcdd4['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0x64eebe['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0x64eebe['to']('hasTooltip',_0x493eb3=>!_0x493eb3),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0x1dcdd4]};_0x4bc803&&(_0x147d26['tag']='button',_0x147d26['on']={'click':_0x64eebe['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x147d26);}}class MarkerView extends _0x260788{constructor(_0x43b846,_0x345cd9){super(_0x43b846),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x345cd9['color']['getBackgroundColorClass']()],'aria-hidden':'true'}});}}const x={'collapseAt':0x6,'displayMe':!0x0};class r extends _0x38fb43{['currentDisplayedUsers'];['balloonPanelView'];['view'];['presenceDropdownView'];['_bodyCollection']=null;static get['pluginName'](){return'PresenceListUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x130422){super(_0x130422),this['context']['config']['define']('presenceList',x);const _0x4843fe=_0x130422['config']['get']('presenceList.collapseAt');if('number'!=typeof _0x4843fe)throw new _0x138eb8('presencelist-collapseat-invalid-format',this);if(_0x4843fe<0x1)throw new _0x138eb8('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](i)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0x505ced(),this['balloonPanelView']=new _0x2b336b(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get['requires'](){return[i];}['init'](){for(const _0x2d20dc of this['_allConnectedUsers'])this['_handleUserAdd'](_0x2d20dc);this['listenTo'](this['_allConnectedUsers'],'add',(_0x1b613b,_0x1f175c)=>{this['_handleUserAdd'](_0x1f175c);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0x41230c,_0x32565c)=>{this['_handleUserRemove'](_0x32565c);});}['_createView'](){const _0x4c20d3=this['context'],_0x455122=new v(this['context']['locale'],this['context']['config']['get']('presenceList.collapseAt')),_0x33a27e=this['balloonPanelView'];if(!_0x3c8a9f(_0x4c20d3['config']['get']('presenceList.container')))throw new _0x138eb8('presencelist-missing-container',this);return _0x455122['counterView']['bind']('usersCount')['to'](this),_0x455122['bind']('isCollapsed')['to'](this,'usersCount',_0x50e2a3=>{const {collapseAt:_0x2a0057}=_0x4c20d3['config']['get']('presenceList'),_0x101d18=_0x50e2a3>=_0x2a0057;if(_0x101d18&&!_0x455122['inlineListView']['items']['find'](_0x1e1ac1=>_0x1e1ac1 instanceof b)){const _0x46b37f=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['currentDisplayedUsers']['length']==_0x46b37f&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](this['currentDisplayedUsers']['length']-0x1),_0x455122['inlineListView']['items']['add'](_0x455122['counterView']);}return _0x101d18||this['hideDropdown'](),_0x101d18;}),_0x455122['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0x48f685=>{const _0x2d3899=_0x4c20d3['config']['get']('presenceList'),_0x3608ee=new A(_0x4c20d3['locale'],_0x48f685,!!_0x2d3899['onClick']);return _0x3608ee['bind']('hasTooltip')['to'](_0x455122,'isCollapsed',_0x25a716=>!_0x25a716),_0x3608ee['bind']('isFocusable')['to'](_0x455122,'isCollapsed',_0x13d5d5=>!_0x13d5d5),_0x2d3899['onClick']&&this['listenTo'](_0x3608ee,'execute',()=>{this['view']['isCollapsed']||_0x2d3899['onClick'](_0x48f685,_0x3608ee['element']);}),_0x3608ee;}),this['listenTo'](_0x455122['inlineListView'],'presencelist:show',()=>{this['view']['isCollapsed']&&this['showDropdown']();}),this['listenTo'](_0x455122['inlineListView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();}),_0x455122['inlineListView']['keystrokes']['set']('Enter',(_0x7e7070,_0x3eacdf)=>{this['view']['isCollapsed']&&(this['showDropdown'](),_0x3eacdf());}),_0x455122['render'](),_0x33a27e['render'](),_0x1b15b6({'emitter':_0x455122,'activator':()=>_0x33a27e['isVisible'],'contextElements':[_0x33a27e['element'],_0x455122['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0x4c20d3['config']['get']('presenceList.container')['appendChild'](_0x455122['element']),this['_bodyCollection']=new _0x11f0a4(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_bodyCollection']['add'](this['balloonPanelView']),_0x455122;}['_handleUserAdd'](_0x350936){if(!this['context']['config']['get']('presenceList.displayMe')&&_0x350936['isMe'])return;const _0x3cddc0=this['context']['config']['get']('presenceList.collapseAt')-0x1;for(this['usersCount']++;this['currentDisplayedUsers']['length']>=_0x3cddc0-(this['view']['isCollapsed']?0x1:0x0)&&this['currentDisplayedUsers']['length']>0x1;)this['currentDisplayedUsers']['remove'](0x1);const _0xad9f92=_0x350936['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0x350936,_0xad9f92);}['_handleUserRemove'](_0x35205b){this['usersCount']--;const {collapseAt:_0x16a947}=this['context']['config']['get']('presenceList'),_0x5047ba=this['usersCount']>=_0x16a947;if(this['currentDisplayedUsers']['get'](_0x35205b['id']))this['currentDisplayedUsers']['remove'](_0x35205b['id']);else{if(_0x5047ba&&this['currentDisplayedUsers']['length']+0x1===_0x16a947-0x1)return;}if(this['currentDisplayedUsers']['length']+(_0x5047ba?0x1:0x0)<this['usersCount']){for(const _0x178558 of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0x178558['id'])&&(this['currentDisplayedUsers']['add'](_0x178558,Math['min'](this['currentDisplayedUsers']['length']-(_0x5047ba?0x1:0x0),0x1)),this['currentDisplayedUsers']['length']+(_0x5047ba?0x1:0x0)===_0x16a947-0x1))return;}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0x1c1cbb=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new L(this['context']['locale'],!!_0x1c1cbb['onClick']),this['view']['inlineListView']['isExpanded']=!0x0,this['listenTo'](this['presenceDropdownView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();});const {listWrapperView:_0x1760a7}=this['presenceDropdownView'];_0x1760a7['items']['bindTo'](this['_allConnectedUsers'])['using'](_0x1f07e9=>{if(!_0x1c1cbb['displayMe']&&_0x1f07e9['isMe'])return null;const _0x199712=new j(this['context']['locale'],_0x1f07e9,!!_0x1c1cbb['onClick']);return _0x1c1cbb['onClick']&&this['listenTo'](_0x199712,'execute',()=>{_0x1c1cbb['onClick'](_0x1f07e9,_0x199712['element']);}),_0x199712;}),this['balloonPanelView']['content']['add'](this['presenceDropdownView']),this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element']}),_0x1760a7['focus'](),_0x1760a7['checkIfScrollable']();const _0x42a6d9=(_0x52314d,_0x255e2d)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0x255e2d();};_0x1760a7['keystrokes']['set']('Esc',_0x42a6d9),_0x1760a7['keystrokes']['set']('Shift+Tab',_0x42a6d9),_0x1760a7['keystrokes']['set']('Tab',(_0xcddaea,_0x1b573b)=>{!function(_0x3f7a7e){const _0x362806=['a','button','input','select','textarea','[tabindex]','[contenteditable]']['map'](_0x294c5d=>_0x294c5d+':not([disabled]):not([tabindex=\x22-1\x22])')['join'](','),_0x3a56da=[...document['body']['querySelectorAll'](_0x362806)]['filter'](_0xfa8f3a=>_0xfa8f3a===document['activeElement']||_0xfa8f3a['offsetWidth']+_0xfa8f3a['offsetHeight']>0x0)['sort']((_0x52c314,_0x49ce5f)=>(_0x52c314['tabIndex']||0x0)-(_0x49ce5f['tabIndex']||0x0)),_0x4d3f7b=_0x3a56da['indexOf'](_0x3f7a7e),_0x52f211=_0x3a56da[(_0x4d3f7b+0x1)%_0x3a56da['length']];_0x52f211&&_0x52f211['focus']();}(this['view']['element']),this['hideDropdown'](),_0x1b573b();}),_0x1760a7['focusTracker']['add'](this['view']['element']),_0x1760a7['focusTracker']['on']('change:isFocused',(_0x43d224,_0x470a3c,_0x13654c)=>{_0x13654c||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 PresenceList extends _0x38fb43{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,PresenceList,r as PresenceListUI,l as RealTimeCollaborationClient,g as RealTimeCollaborativeComments,a as RealTimeCollaborativeEditing,RealTimeCollaborativeRevisionHistory,RealTimeCollaborativeTrackChanges,i as Sessions,n as WebSocketGateway};
|
|
23
|
+
import{ContextPlugin as _0x57ac80,Plugin as _0x38ec35,PendingActions as _0x40cd9a,Context as _0xaf36e6}from'@ckeditor/ckeditor5-core/dist/index.js';import{DomEmitterMixin as _0x47e8bf,CKEditorError as _0x533522,Collection as _0x5510de,global as _0x3be0ca,version as nt,uid as _0x404c20,KeystrokeHandler as _0x4b7810}from'@ckeditor/ckeditor5-utils/dist/index.js';import{Notification as _0x1764ff,View as _0x422411,ListView as _0x462fd8,ListItemView as st,LabelView as at,BalloonPanelView as _0x21eb1a,clickOutsideHandler as _0x32589f,BodyCollection as _0x272992}from'@ckeditor/ckeditor5-ui/dist/index.js';import{ModelLiveRange as _0x151155,History as _0x41fb4f,NoOperation as _0x5f0d00,InsertOperation as _0x43fa61,MarkerOperation as _0x596344,RootAttributeOperation as _0x5c298c,transformOperationSets as _0x3f9ccd,OperationFactory as _0x327378}from'@ckeditor/ckeditor5-engine/dist/index.js';import{WebSocketGateway as ct,WEB_SOCKET_GATEWAY_STATES as _0x207676,CollaborativeEditingService as _0x46b370,User as ht,CommentsService as _0x1e0da1,TrackChangesService as it,RevisionHistoryService as _0x1b1037,EditorService as _0x3eecac}from'@ckeditor/ckeditor-cloud-services-collaboration/dist/index.js';import{Users as _0x14383d,UserView as rt}from'ckeditor5-collaboration/dist/index.js';import{Compressor as _0xb0c797}from'@ckeditor/ckeditor5-operations-compressor/dist/index.js';import{isElement as _0x5b9bb3}from'es-toolkit/compat';class n extends _0x57ac80{static ['WebSocketGateway']=/* #__PURE__ -- @preserve */
|
|
24
|
+
((()=>ct)());static ['initialReconnectionInterval']=0x3e8;['connection'];['_reconnectionStack'];['_shouldPluginsReconnect'];['_domEmitter'];static get['requires'](){return['CloudServices',_0x1764ff];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x4ea4bc){super(_0x4ea4bc),this['set']('state',_0x207676['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=new(_0x47e8bf())();}['init'](){const _0x31a5e8=this['context'],_0x19d571=_0x31a5e8['plugins']['get']('CloudServices'),_0x1fa388=_0x31a5e8['plugins']['get'](_0x1764ff);if(!_0x19d571['token'])throw new _0x533522('websocketgateway-missing-token',this);if(!_0x19d571['webSocketUrl'])throw new _0x533522('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'](_0x19d571['token'],_0x19d571['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0x326c79=>{if(this['connection']=_0x326c79,this['bind']('state')['to'](_0x326c79,'state',this,'_isBrowserOffline',(_0x49581a,_0x24a136)=>('connected'!==_0x49581a&&(this['_shouldPluginsReconnect']=!0x0),_0x24a136||_0x49581a!==_0x207676['CONNECTED']?_0x207676['DISCONNECTED']:this['state']==_0x207676['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),_0x207676['CONNECTING']):_0x207676['CONNECTED'])),this['connection']['on']('error',(_0x37308b,_0x29fc62)=>{if('limitExceeded'!==_0x29fc62['code'])throw console['error'](_0x29fc62),new _0x533522('cloudservices-init',null,{'originalError':_0x29fc62});_0x1fa388['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'});}),!_0x326c79['me'])return new Promise(_0x5b91f8=>_0x326c79['on']('change:me',_0x5b91f8));})['catch'](_0x424412=>{throw console['error'](_0x424412),new _0x533522('cloudservices-init',null,{'originalError':_0x424412});});}['addToReconnectionStack'](_0x58d860){if('function'!=typeof _0x58d860['reconnect'])throw new _0x533522('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0x58d860))throw new _0x533522('websocketgateway-plugin-already-registered',this,{'name':_0x58d860['constructor']['pluginName']});this['_reconnectionStack']['add'](_0x58d860);}['removeFromReconnectionStack'](_0x8ff7a2){this['_reconnectionStack']['delete'](_0x8ff7a2);}['isInReconnectionStack'](_0x6d3060){return this['_reconnectionStack']['has'](_0x6d3060);}['_reconnect'](){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0x17122d=>_0x17122d['reconnect']())))['then'](()=>this['state']=_0x207676['CONNECTED'])['catch'](_0x5b22d7=>{throw console['error'](_0x5b22d7),new _0x533522('cloudservices-reconnection-error',this['context']);});}['disconnect'](){this['connection']&&this['connection']['disconnect'](),this['state']=_0x207676['DISCONNECTED'],this['_domEmitter']['stopListening']();}['destroy'](){this['disconnect'](),super['destroy']();}}class i extends _0x57ac80{['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,_0x14383d];}constructor(_0x17b5a2){super(_0x17b5a2),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0x5510de(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x14383d);}['init'](){const _0x2b06f8=this['context']['plugins']['get'](n);this['listenTo'](_0x2b06f8,'change:state',(_0x2ba0ce,_0x5e4472,_0x5d7d9b)=>{if('connected'!==_0x5d7d9b)this['channelSessions']['forEach'](_0x1204b3=>_0x1204b3['clear']()),this['channelConnectedUsers']['forEach'](_0x546915=>_0x546915['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x2cde34,_0xb45071]of this['_registeredSessions'])for(const _0x108e67 of _0xb45071)this['_handleSessionAdd'](_0x2cde34,_0x108e67);}}),this['_createUser'](_0x2b06f8['connection']['me'],!0x0);}['register'](_0x38bae8,_0x13b398){if(this['_registeredSessions']['has'](_0x38bae8))throw new _0x533522('sessions-register-already-registered',null,{'channelId':_0x38bae8});this['_registeredSessions']['set'](_0x38bae8,_0x13b398),this['channelSessions']['set'](_0x38bae8,new _0x5510de()),this['channelConnectedUsers']['set'](_0x38bae8,new _0x5510de()),this['listenTo'](_0x13b398,'add',(_0x1d43ee,_0x17c361)=>this['_handleSessionAdd'](_0x38bae8,_0x17c361)),this['listenTo'](_0x13b398,'remove',(_0x5bfdb4,_0x26bfa9)=>this['_handleSessionRemove'](_0x38bae8,_0x26bfa9));for(const _0x34f531 of _0x13b398)this['_handleSessionAdd'](_0x38bae8,_0x34f531);}['unregister'](_0x33fa18){if(!this['_registeredSessions']['has'](_0x33fa18))throw new _0x533522('sessions-unregister-not-exist',null,{'channelId':_0x33fa18});const _0x58bba6=this['_registeredSessions']['get'](_0x33fa18);this['stopListening'](_0x58bba6);for(const _0x5a8b90 of _0x58bba6)'connected'===this['context']['plugins']['get'](n)['state']&&this['_handleSessionRemove'](_0x33fa18,_0x5a8b90);this['_registeredSessions']['delete'](_0x33fa18),this['channelSessions']['delete'](_0x33fa18),this['channelConnectedUsers']['delete'](_0x33fa18);}get['mySessionId'](){return this['context']['plugins']['get'](n)['connection']['sessionId'];}['getUserBySessionId'](_0x342023){for(const _0x166cdc of this['channelSessions']['values']())for(const _0x3c1bcc of _0x166cdc)if(_0x3c1bcc['id']===_0x342023)return _0x3c1bcc['user'];}['getUserSessions'](_0x267164,_0x53db15){const _0x56c6e7=_0x53db15?[this['channelSessions']['get'](_0x53db15)]:this['channelSessions']['values'](),_0xa002df=new Set();for(const _0x15bc74 of _0x56c6e7)for(const _0x2a1363 of _0x15bc74)_0x2a1363['user']['id']===_0x267164['id']&&_0xa002df['add'](_0x2a1363['id']);return _0xa002df;}['getUserRole'](_0x53a904){for(const _0x2ca419 of this['channelSessions']['values']())for(const _0x445d6d of _0x2ca419)if(_0x445d6d['user']===_0x53a904)return _0x445d6d['role'];}['_handleSessionAdd'](_0x249e07,_0x28758f){if('connected'!==this['context']['plugins']['get'](n)['state'])return;const _0x1e322a=_0x28758f['user'],_0x5e4ddf=this['_users']['getUser'](_0x1e322a['id'])||this['_createUser'](_0x1e322a),_0x5bb888=Object['assign']({},_0x28758f,{'user':_0x5e4ddf});if(this['channelSessions']['get'](_0x249e07)['add'](_0x5bb888),!_0x1e322a['hiddenInPresenceList']){const _0x5c4489=this['channelConnectedUsers']['get'](_0x249e07);_0x5c4489['has'](_0x5e4ddf['id'])||_0x5c4489['add'](_0x5e4ddf),this['allConnectedUsers']['has'](_0x5e4ddf['id'])||_0x1e322a['hiddenInPresenceList']||this['allConnectedUsers']['add'](_0x5e4ddf,_0x5e4ddf['isMe']?0x0:void 0x0);}this['fire']('sessionAdd:'+_0x249e07,{'channelId':_0x249e07,'session':_0x5bb888});}['_handleSessionRemove'](_0x10decd,_0x38734f){if('connected'!==this['context']['plugins']['get'](n)['state'])return;const _0x1512bc=this['channelConnectedUsers']['get'](_0x10decd),_0x52225c=_0x38734f['user'];_0x52225c['id']&&(this['channelSessions']['get'](_0x10decd)['remove'](_0x38734f['id']),_0x1512bc['has'](_0x52225c['id'])&&!this['getUserSessions'](_0x52225c,_0x10decd)['size']&&_0x1512bc['remove'](_0x52225c['id']),this['allConnectedUsers']['get'](_0x52225c['id'])&&!this['getUserSessions'](_0x52225c)['size']&&this['allConnectedUsers']['remove'](_0x52225c['id']));}['_createUser'](_0x185dc4,_0xe49257){const _0x6bc89e=this['_users']['addUser'](_0x185dc4);return _0xe49257&&this['_users']['defineMe'](_0x185dc4['id']),_0x6bc89e['orderNumber']=this['_uniqueUsersCount']++,_0x6bc89e;}}class k extends _0x38ec35{['_domEmitter']=new(_0x47e8bf())();static get['requires'](){return[i];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0xb36323=this['editor'],_0x39b7e9=_0xb36323['plugins']['get'](i);_0xb36323['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x49d342,{writer:_0x18a363})=>function(_0x4a4f3f,_0x411df7,_0x500f00,_0x5f119){const _0x3f8c3e=_0x4a4f3f['markerName']['split'](':')[0x2],_0x59532c=_0x500f00['getUserBySessionId'](_0x3f8c3e);if(!_0x59532c||_0x3f8c3e===_0x500f00['mySessionId'])return;if(!_0x5f119['model']['schema']['checkChild'](_0x4a4f3f['markerRange']['start'],'$text'))return;const _0x4280ba={'class':'ck-user__marker\x20'+_0x59532c['color']['getMarkerClass'](),'data-name':_0x59532c['name'],'data-session-id':_0x3f8c3e},_0x166b2=_0x5f119['model']['markers']['get'](_0x4a4f3f['markerName']),_0x31167c=_0x166b2['getStart'](),_0x4eedda=_0x31167c['nodeAfter'],_0x529ff5=_0x5f119['model']['schema'];if(_0x4eedda&&_0x529ff5['isObject'](_0x4eedda)&&_0x529ff5['isInline'](_0x4eedda)&&!_0x5f119['model']['markers']['get']('user:range:'+_0x3f8c3e)['getRange']()['isCollapsed'])return;const _0x4da7c0=_0x31167c['parent'];return _0x5f119['model']['schema']['isLimit'](_0x4da7c0)&&!_0x5f119['model']['hasContent'](_0x4da7c0)&&(_0x4280ba['contenteditable']=!0x1),function(_0x1eb7c9,_0x198e08,_0x2cbe7e){const _0x21bf0a=_0x1eb7c9['createUIElement']('span',_0x198e08);return _0x1eb7c9['setCustomProperty']('userPositionMarker',!0x0,_0x21bf0a),_0x21bf0a['render']=function(_0x172367){const _0x32f834=this['toDomElement'](_0x172367),_0x145aa1=document['createElement']('span');return _0x145aa1['classList']['add']('ck-user__marker-tooltip'),_0x145aa1['setAttribute']('contenteditable','false'),_0x145aa1['setAttribute']('spellcheck','false'),_0x145aa1['textContent']=_0x2cbe7e['name'],_0x32f834['innerHTML']='<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span>'+_0x145aa1['outerHTML']+'',_0x32f834['addEventListener']('mouseenter',()=>{_0x32f834['classList']['add']('ck-user__marker_hovered');}),_0x32f834['addEventListener']('mouseleave',()=>{_0x32f834['classList']['remove']('ck-user__marker_hovered');}),_0x32f834;},_0x21bf0a['isSimilar']=function(_0x43d9ca){return!(!this['getCustomProperty']('userPositionMarker')||!_0x43d9ca['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0x43d9ca['getAttribute']('data-session-id'));},_0x21bf0a;}(_0x411df7,_0x4280ba,_0x59532c);}(_0x49d342,_0x18a363,_0x39b7e9,_0xb36323)}),_0xb36323['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0x5cd897=>function(_0xac4523,_0x241802){const _0x21be76=_0xac4523['markerName']['split'](':')[0x2];if(_0x21be76===_0x241802['mySessionId'])return null;const _0x3bfe02=_0x241802['getUserBySessionId'](_0x21be76);if(!_0x3bfe02)return{'id':_0x21be76,'classes':[]};return{'id':_0x21be76,'classes':['ck-user__selection',_0x3bfe02['color']['getSelectionClass']()],'attributes':{'data-session-id':_0x21be76},'priority':0x7d0+_0x3bfe02['orderNumber']};}(_0x5cd897,_0x39b7e9)}),function(_0x11f68f){const _0x343435=_0x11f68f['model'],_0x2a0854=new Map(),_0x334029=_0x11f68f['plugins']['get'](i);_0x343435['markers']['on']('update:user:range',(_0x8ec179,_0x13e0f7,_0x756ef1,_0x3a0bea)=>{if(!_0x3a0bea&&_0x2a0854['get'](_0x13e0f7['name']))return _0x2a0854['get'](_0x13e0f7['name'])['detach'](),void _0x2a0854['delete'](_0x13e0f7['name']);const _0xefa6a4=_0x13e0f7['name']['split'](':')[0x2];if(_0xefa6a4===_0x334029['mySessionId'])return;const _0x2ef644='user:position:'+_0xefa6a4;_0x343435['markers']['has'](_0x2ef644)&&_0x11f68f['editing']['reconvertMarker'](_0x2ef644),_0x13e0f7['on']('change:range',(_0x5406b1,_0x363ae7,_0x38cfb5)=>{if('$graveyard'!=_0x363ae7['root']['rootName']&&'$graveyard'==_0x13e0f7['getRange']()['root']['rootName']&&!_0x2a0854['has'](_0x13e0f7['name'])){const _0x519567=_0x343435['schema']['getNearestSelectionRange'](_0x38cfb5['deletionPosition']);if(_0x519567){const _0x9a818f=_0x151155['fromRange'](_0x519567);_0x2a0854['set'](_0x13e0f7['name'],_0x9a818f),_0x9a818f['on']('change:range',(_0x3f2aa4,_0x264216,_0x5f08eb)=>{if('$graveyard'==_0x9a818f['root']['rootName']){const _0x194d27=_0x343435['schema']['getNearestSelectionRange'](_0x5f08eb['deletionPosition']);_0x194d27?(_0x9a818f['start']=_0x194d27['start'],_0x9a818f['end']=_0x194d27['end']):(_0x2a0854['delete'](_0x13e0f7['name']),_0x9a818f['detach']());}});}}});}),_0x343435['document']['on']('change',()=>{_0x2a0854['size']>0x0&&_0x343435['enqueueChange']({'isUndoable':!0x1},_0x2b2f5e=>{for(const [_0x42b0da,_0x2e5847]of _0x2a0854)'$graveyard'==_0x343435['markers']['get'](_0x42b0da)['getRange']()['root']['rootName']&&(x(_0x42b0da['split'](':')[0x2],_0x2e5847['toRange'](),_0x343435,_0x2b2f5e),_0x2e5847['detach']());_0x2a0854['clear']();});});}(_0xb36323),this['_domEmitter']['listenTo'](_0x3be0ca['document'],'keydown',(_0xda8123,{key:_0x5a2860})=>{'Escape'===_0x5a2860&&function(_0x5bfc2b){_0x5bfc2b['editing']['view']['change'](_0xc7697b=>{for(const _0x4d7718 of _0x5bfc2b['model']['markers']){if(!_0x4d7718['name']['startsWith']('user:position'))continue;const _0x1dbeea=_0x5bfc2b['editing']['mapper']['markerNameToElements'](_0x4d7718['name']);if(_0x1dbeea){for(const _0x353fbc of _0x1dbeea)_0xc7697b['removeClass']('ck-user__marker_hovered',_0x353fbc);}}});}(_0xb36323);},{'useCapture':!0x0});}['afterInit'](){const _0x529f8d=this['editor'],_0x47322d=_0x529f8d['commands']['get']('undo');_0x47322d&&_0x529f8d['model']['on']('applyOperation',(_0x131466,_0x3be613)=>{const _0x3edcf0=_0x3be613[0x0];if(!_0x3edcf0['isDocumentOperation'])return;if('marker'!=_0x3edcf0['type']||!_0x3edcf0['name']['startsWith']('user:'))return;const _0x21d1af=_0x3edcf0['batch'];_0x47322d['_createdBatches']['has'](_0x21d1af)&&(_0x3edcf0['newRange']=_0x3edcf0['oldRange']?_0x529f8d['model']['createRange'](_0x3edcf0['oldRange']['start'],_0x3edcf0['oldRange']['end']):null);},{'priority':'highest'});}['destroy'](){return this['_domEmitter']['stopListening'](),super['destroy']();}['createUserMarkerOperations'](){const _0x55f4ee=this['editor'],_0x418e13=_0x55f4ee['model']['document'],_0x1dc636=_0x55f4ee['plugins']['get'](i);_0x55f4ee['model']['enqueueChange']({'isUndoable':!0x1},_0x5484d8=>{const _0x3ab9f0='user:range:'+_0x1dc636['mySessionId'],_0x117623='user:position:'+_0x1dc636['mySessionId'],_0x1ed0c8=_0x55f4ee['model']['markers']['has'](_0x3ab9f0);_0x55f4ee['editing']['view']['hasDomSelection']?x(_0x1dc636['mySessionId'],_0x418e13['selection']['getFirstRange'](),_0x55f4ee['model'],_0x5484d8):_0x1ed0c8&&(_0x5484d8['removeMarker'](_0x3ab9f0),_0x5484d8['removeMarker'](_0x117623));});}}function x(_0xb4c816,_0x5396fe,_0x333436,_0x41d789){const _0x381da8='user:range:'+_0xb4c816,_0x861d1f='user:position:'+_0xb4c816,_0x20ab22=_0x5396fe['getContainedElement']();let _0x385cc3=_0x5396fe['start'];if(_0x20ab22&&_0x20ab22['is']('element','tableCell')){const _0x5a2e8c=function(_0x14476f,_0x4d516a){for(const _0x4db255 of _0x14476f['getPositions']())if(_0x4d516a['schema']['checkChild'](_0x4db255,'$text'))return _0x4db255;}(_0x5396fe,_0x333436);_0x5a2e8c&&(_0x385cc3=_0x5a2e8c,_0x5396fe=_0x41d789['createRange'](_0x385cc3));}const _0x6b184f=_0x41d789['createRange'](_0x385cc3);_0x333436['markers']['has'](_0x381da8)?(_0x41d789['updateMarker'](_0x381da8,{'range':_0x5396fe}),_0x41d789['updateMarker'](_0x861d1f,{'range':_0x6b184f})):(_0x41d789['addMarker'](_0x381da8,{'range':_0x5396fe,'usingOperation':!0x0}),_0x41d789['addMarker'](_0x861d1f,{'range':_0x6b184f,'usingOperation':!0x0}));}function R(_0x1aa0e5,_0x4d112e,_0x555b7a){const _0x5f3972=_0x1aa0e5['t'],t=_0x1aa0e5['t'];switch(_0x4d112e){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 _0x5f3972({'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'},_0x555b7a);default:return'';}}let j=0x1;class l extends _0x38ec35{static ['CollaborativeEditingService']=/* #__PURE__ -- @preserve */
|
|
25
|
+
((()=>_0x46b370)());['_offset'];['sessionId'];['serverHistory'];['_channelId'];['_service'];['_document'];['_compressor'];['_bufferedOperations'];['_knownOperations'];['_knownRootNames'];['_pendingAction'];['_hasSelectionChanged'];['_sendBufferedOperationsDelayId'];['_baseBufferDelay'];['_currentBufferDelay'];['_lastSyncedOperationId'];['_disconnectionOperations'];['_operationIdentifier'];static get['requires'](){return[n,i,k,_0x40cd9a,_0x14383d,_0x1764ff];}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 _0x112e0d=this['serverHistory']['getOperations']();for(let _0x5575fd=_0x112e0d['length']-0x1;_0x5575fd>=0x0;_0x5575fd--){const _0x8c4251=_0x112e0d[_0x5575fd];if(!this['_disconnectionOperations']['has'](_0x8c4251))return _0x8c4251['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0x28bed0){if(super(_0x28bed0),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x41fb4f(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0x533522('collaboration-missing-channelid',this);const _0x2998d4=_0x28bed0['config']['get']('cloudServices.bundleVersion')||nt;this['_service']=new l['CollaborativeEditingService'](_0x2998d4,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0xb0c797(),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 OperationIdentifier(this['_disconnectionOperations']);}['init'](){const _0x2e3841=this['editor'],_0x4b06e4=_0x2e3841['plugins']['get'](_0x14383d),_0x14ace6=_0x2e3841['plugins']['get'](n);this['listenTo'](_0x4b06e4,'getOperationAuthor',(_0x3b261d,_0x59447f)=>{const _0x25b695=_0x59447f[0x0];_0x25b695['_authorId']&&(_0x3b261d['return']=_0x4b06e4['getUser'](_0x25b695['_authorId']),_0x3b261d['stop']()),null===_0x25b695['_authorId']&&(_0x3b261d['return']=null,_0x3b261d['stop']());},{'priority':'high'}),this['listenTo'](_0x2e3841['model']['document']['selection'],'change:range',(_0x1942e3,_0x3c91ea)=>{_0x3c91ea['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x2e3841['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x2e3841['model']['on']('applyOperation',(_0x74dbdd,_0x3912f0)=>{const _0x560e0d=_0x3912f0[0x0];_0x560e0d['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0x560e0d),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['bind']('_isEditingAllowed')['to'](_0x14ace6,'state',this,'_hasSynchronizationProblem',(_0x3f8d9f,_0x144e87)=>'connected'===_0x3f8d9f&&!_0x144e87),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x2e3841['disableReadOnlyMode']('rtc-offline'):_0x2e3841['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x2e3841['disableReadOnlyMode']('rtc-offline'):_0x2e3841['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async['reconnect'](){const _0x5ceac2=this['editor']['plugins']['get'](i),_0x58d5f8=this['editor']['plugins']['get'](n);try{this['_isPendingUpdate']=!0x0,_0x5ceac2['unregister'](this['_channelId']);const _0x1b7c0e=await this['_service']['reconnect'](_0x58d5f8['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0x1b7c0e)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x2092f3=await this['_service']['getConnectedSessions']();_0x5ceac2['register'](this['_channelId'],_0x2092f3),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x2e6793){if(function(_0x32afa1){return'404'===_0x32afa1['code'];}(_0x2e6793)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0x3cc451){return'409'===_0x3cc451['code'];}(_0x2e6793)){const _0xad9452=R(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'](_0xad9452);}else{if(!(_0x2e6793 instanceof ReconnectionError))throw _0x2e6793;this['_handleReconnectionError']();}}}}['destroy'](){const _0x61c27e=this['editor']['plugins']['get'](n),_0x2fbc6c=this['editor']['plugins']['get'](i);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x2fbc6c['channelSessions']['has'](this['_channelId'])&&_0x2fbc6c['unregister'](this['_channelId']),_0x61c27e['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async['_handleReconnectionResponse'](_0x5d3087){if(this['sessionId']!==_0x5d3087['sessionId']&&this['_lastSyncedOperationId']!==_0x5d3087['lastOperationId'])throw new ReconnectionError();return this['sessionId']=_0x5d3087['sessionId'],this['_handleServerResponse']([],{..._0x5d3087,'wereChangesApplied':!0x1,'data':_0x5d3087['data']},'reconnect');}async['_connectService'](_0x727a59,_0x4ed546=!0x1){const {connection:_0x4836}=this['editor']['plugins']['get'](n);l['CollaborativeEditingService']['getConnectedSessions'](_0x4836,this['_channelId'])['then'](_0x4178ad=>this['_initSessionsHandling'](_0x4178ad))['catch'](_0x47e125=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x47e125);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x3241de,_0x3a79a2)=>{this['_crash']('realtimecollaborationclient-init-service-internal-error',_0x3a79a2);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_isConnected']=!0x1;});const _0x618b9d=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x727a59);this['_isPendingUpdate']=!0x0;const _0x37cf61=await this['_service']['connect'](_0x4836,this['_compressOperations'](_0x727a59),_0x618b9d);if(this['sessionId']=_0x37cf61['sessionId'],_0x4ed546){if(!_0x37cf61['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x37cf61['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0x727a59,_0x37cf61,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x37cf61,_0x727a59);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}['_handleSendingSelectionMarkers'](){const _0x4a1755=this['editor']['plugins']['get'](i),_0x11d7ab=this['editor']['plugins']['get'](k),_0x404fa3=_0x4a1755['channelSessions']['get'](this['_channelId']);_0x404fa3&&_0x404fa3['length']>0x1?_0x11d7ab['createUserMarkerOperations']():this['listenTo'](_0x4a1755,'sessionAdd:'+this['_channelId'],()=>{0x2===_0x4a1755['channelSessions']['get'](this['_channelId'])['length']&&_0x11d7ab['createUserMarkerOperations']();});}async['_handleReceivedOperations'](_0x5bd086,_0x43170c,_0x4e1a52,_0x20c333){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x43170c){const _0x1f97ef=this['_decompressOperations'](_0x4e1a52,_0x20c333);await this['_fetchMissingUsers'](_0x1f97ef),this['_handleExternalOperations'](_0x1f97ef,_0x43170c,_0x4e1a52['lastOperationId'])||this['_crash']('realtimecollaborationclient-init-service-incorrect-server-operation');}}async['_connectAfterSessionHasBeenFlushed'](){this['_disconnectService']();const {locale:_0xb87d22}=this['editor'];let _0x56fa8a;try{_0x56fa8a=await this['_service']['getDocumentDetails']();}catch{const _0x5bba55=R(_0xb87d22,'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'](_0x5bba55);}const _0x40cd8e=_0x56fa8a['currentDocumentSession']||_0x56fa8a['lastDocumentSession'];if(this['_lastSyncedOperationId']!==_0x40cd8e['lastOperationId']){const _0x4e2c3a=R(_0xb87d22,'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'](_0x4e2c3a);}await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);}['_disconnectService'](){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['stopListening'](this['_service']);}['_initSessionsHandling'](_0x1d73ff){const _0x34ce57=this['editor']['plugins']['get'](i);this['listenTo'](_0x34ce57,'sessionAdd:'+this['_channelId'],(_0x1a6447,{session:_0x30c255})=>{if(_0x30c255['id']===_0x34ce57['mySessionId']){_0x1a6447['off']();const _0x30cce9=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0x50f240=_0x30c255['permissions'];_0x30cce9&&_0x30cce9['isEnabled']&&(_0x50f240=_0x50f240['filter'](_0x1703d3=>'document:write'!==_0x1703d3)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0x50f240,this['_channelId']);}}),_0x34ce57['register'](this['_channelId'],_0x1d73ff);}['_initThrowingOnDataSet'](){const _0x5ed38e=this['editor']['data']['set'];this['editor']['data']['set']=(..._0x2e49c3)=>{if(!_0x2e49c3[_0x2e49c3['length']-0x1]['suppressErrorInCollaboration'])throw new _0x533522('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x5ed38e['apply'](this['editor']['data'],_0x2e49c3);};}['_setUpDataInit'](){this['editor']['data']['on']('init',(_0x19a078,[_0xda7361])=>{if(this['_document']['version'])throw new _0x533522('realtimecollaborationclient-init-document-already-initialized',this);_0x19a078['stop'](),this['_setPendingAction']();const _0x2b9437=this['editor']['config']['get']('rootsAttributes'),_0x42fee0=this['_getOperationsFromInitData'](_0xda7361,_0x2b9437);0x0==_0x42fee0['length']&&_0x42fee0['push'](new _0x5f0d00(0x0)),_0x19a078['return']=this['_connectService'](_0x42fee0)['then'](()=>{this['editor']['plugins']['get'](n)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x4098ab=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x4098ab))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x57bf4b,[_0x39946a,_0x4f6dda])=>{_0x57bf4b['stop']();const _0x171a6f=this['editor']['model']['document']['getRoot'](_0x39946a);if(!this['_knownRootNames']['has'](_0x39946a)){const _0x2ec0c4=_0x4f6dda&&_0x4f6dda['data']?_0x4f6dda['data']:'',_0x5eeee8=_0x4f6dda&&_0x4f6dda['attributes']?_0x4f6dda['attributes']:{};await this['_loadRoot'](_0x39946a,_0x2ec0c4,_0x5eeee8);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0x171a6f['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0x171a6f);});},{'priority':'high'});}async['_fetchMissingUsers'](_0x41e10d){const _0xeba898=this['editor']['plugins']['get'](_0x14383d),{connection:_0x1aaf5c}=this['editor']['plugins']['get'](n),_0x56a9e9=new Set();for(const _0x11bcb5 of _0x41e10d){const _0x47d472=_0x11bcb5['_authorId'];_0x47d472&&!_0xeba898['getUser'](_0x47d472)&&_0x56a9e9['add'](_0x47d472);}if(0x0===_0x56a9e9['size'])return;const _0x187ff7=await ht['getMany'](_0x1aaf5c,Array['from'](_0x56a9e9));for(const _0x3165dd of _0x187ff7)_0xeba898['getUser'](_0x3165dd['id'])||_0xeba898['addUser'](_0x3165dd);}['_getOperationsFromInitData'](_0x4165d5,_0x11f751={}){const _0x5dce9e=this['editor']['model'],_0x61fefa=[];let _0x1088e6=0x0;const _0x567ed5='string'==typeof _0x4165d5?{'main':_0x4165d5}:_0x4165d5;for(const _0x382603 of Object['keys'](_0x567ed5)){if(!this['_document']['roots']['has'](_0x382603))throw new _0x533522('realtimecollaborationclient-init-non-existent-root',this);const _0x1fbda9=this['editor']['data']['parse'](_0x567ed5[_0x382603]),_0x26126f=this['_document']['getRoot'](_0x382603),_0x5b1dda=new _0x43fa61(_0x5dce9e['createPositionAt'](_0x26126f,0x0),_0x1fbda9,_0x1088e6++);_0x61fefa['push'](_0x5b1dda);for(const [_0x23e7cb,_0x481035]of _0x1fbda9['markers']){const _0x2a9742=_0x5dce9e['createRange'](_0x5dce9e['createPositionFromPath'](_0x26126f,_0x481035['start']['path']['slice']()),_0x5dce9e['createPositionFromPath'](_0x26126f,_0x481035['end']['path']['slice']())),_0x5297f8=new _0x596344(_0x23e7cb,null,_0x2a9742,_0x5dce9e['markers'],!0x0,_0x1088e6++);_0x61fefa['push'](_0x5297f8);}}if(_0x11f751)for(const [_0x8288ba,_0x1a883d]of Object['entries'](_0x11f751)){const _0x33b86d=_0x5dce9e['document']['getRoot'](_0x8288ba);if(!_0x33b86d)throw new _0x533522('multi-root-editor-root-attributes-no-root',null);for(const [_0x474890,_0x5d7040]of Object['entries'](_0x1a883d))if(null!==_0x5d7040){const _0x2d9550=new _0x5c298c(_0x33b86d,_0x474890,null,_0x5d7040,_0x1088e6++);_0x61fefa['push'](_0x2d9550);}}return _0x61fefa;}async['_loadRoot'](_0x142caa,_0x39f344,_0x147c81){this['_getOperationsFromInitData']({[_0x142caa]:_0x39f344},{[_0x142caa]:_0x147c81})['forEach']((_0x9b105d,_0x12ab50)=>{_0x9b105d['baseVersion']=this['_document']['version']+_0x12ab50,_0x9b105d['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x9b105d);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async['_handleInitialConnectionData'](_0x503c6c,_0x2eb7f0){let _0x4ccd66;this['_offset']=_0x503c6c['offset'];const _0x1b5e36=_0x503c6c['wereChangesApplied']&&!_0x503c6c['initData'],_0x15f036=_0x1b5e36?0x0:_0x503c6c['data']['baseVersion'];if(_0x2eb7f0['forEach'](_0x493ecb=>{_0x493ecb['_isInit']=!0x0,_0x493ecb['createdAt']=_0x503c6c['sessionCreatedAt'],_0x493ecb['_authorId']=null;}),_0x1b5e36)_0x4ccd66=_0x2eb7f0,this['_applyOperationsSet'](_0x4ccd66,_0x1b5e36);else{if(_0x503c6c['initData']){const _0x53479e=this['_getOperationsFromInitData'](_0x503c6c['initData']);this['_document']['history']['version']=-_0x53479e['length'],_0x53479e['forEach'](_0x3b3399=>{_0x3b3399['baseVersion']-=_0x53479e['length'],_0x3b3399['createdAt']=_0x503c6c['sessionCreatedAt'],_0x3b3399['_isInit']=!0x0,_0x3b3399['_authorId']=null;}),this['_applyOperationsSet'](_0x53479e,!0x0),this['serverHistory']['version']=-_0x53479e['length']+this['_offset'],this['_updateServerHistory'](_0x53479e);}this['_document']['history']['version']=_0x15f036,_0x4ccd66=this['_decompressOperations'](_0x503c6c['data'],_0x503c6c['metadata']),await this['_fetchMissingUsers'](_0x4ccd66),this['_applyOperationsSet'](_0x4ccd66,_0x1b5e36);}_0x503c6c['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x4ccd66,_0x503c6c['lastOperationId']),this['_lastSyncedOperationId']=_0x503c6c['lastOperationId']),this['serverHistory']['version']=_0x15f036+this['_offset'],this['_updateServerHistory'](_0x4ccd66),_0x2eb7f0['filter'](_0x40947d=>{const _0x3370c4=this['_getAffectedRoot'](_0x40947d);return _0x3370c4&&!this['_knownRootNames']['has'](_0x3370c4);})['forEach']((_0x5ca292,_0x3c2a34)=>{_0x5ca292['baseVersion']=this['_document']['version']+_0x3c2a34,this['_saveOperationInBuffer'](_0x5ca292);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x6abf9f,_0x4d91fa){const _0x1bee65=_0x4d91fa&&_0x4d91fa['message'];if(_0x1bee65&&_0x1bee65['startsWith']('realtimecollaborationclient'))throw _0x4d91fa;const _0xf74f8=this['editor']['plugins']['get'](n);throw this['_isPendingUpdate']=!0x0,_0xf74f8['disconnect'](),this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0x533522(_0x6abf9f,this['editor'],_0x1bee65?{'originalError':_0x1bee65}:void 0x0);}['_saveOperationInBuffer'](_0xf9a21e){this['_knownOperations']['has'](_0xf9a21e)||(this['_knownOperations']['add'](_0xf9a21e),this['_bufferedOperations']['push'](_0xf9a21e),this['_pendingAction']||'marker'==_0xf9a21e['type']&&!_0xf9a21e['affectsData']||this['_setPendingAction']());}['_sendBufferedOperationsDelayed'](_0x14e10b=!0x1){!_0x14e10b&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0x347d10=>{_0x347d10&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0x5b1086=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0x203d37){return _0x203d37['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x203d37['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0x203d37['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0x5b1086)||this['_crash'](_0x5b1086['message'],_0x5b1086);});},this['_currentBufferDelay']));}['_waitUntilSynced'](){return new Promise(_0x2c01ec=>{this['on']('change:_isPendingUpdate',()=>{_0x2c01ec();});});}async['_sendBufferedOperations'](){const _0x2b6fc0=this['editor']['plugins']['get'](k);if(this['_shouldSendSelectionUpdate']()&&(_0x2b6fc0['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x349339=[...this['_bufferedOperations']];for(const _0xf7dee3 of _0x349339)_0xf7dee3['wasUndone']=this['_document']['history']['isUndoneOperation'](_0xf7dee3);const _0x4c723b=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x349339),_0x1e0601=j++,_0x41aa32=this['_compressOperations'](_0x349339),_0x53c59f=await this['_service']['sendOperations'](_0x41aa32,_0x41aa32['baseVersion'],_0x4c723b);try{return await this['_handleServerResponse'](_0x349339,_0x53c59f,_0x1e0601);}catch(_0x3f2cd3){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0x3f2cd3);}}async['_handleServerResponse'](_0x1c3f55,_0x262f01,_0x2e6bcf){if('error'in _0x262f01)throw _0x262f01['error'];let _0x1608e1=!0x1;if(_0x262f01['wereChangesApplied']){_0x262f01['lastOperationId']&&(this['_lastSyncedOperationId']=_0x262f01['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x3a1885=>!_0x1c3f55['includes'](_0x3a1885));for(const _0x51e4b9 of _0x1c3f55)_0x51e4b9['createdAt']='lastOperationAcceptedAt'in _0x262f01&&_0x262f01['lastOperationAcceptedAt']||void 0x0;D(_0x1c3f55,_0x262f01['version']-_0x1c3f55['length']),this['_updateServerHistory'](_0x1c3f55);const _0x187c62=_0x1c3f55['filter'](_0x25352b=>{if(!_0x25352b['_isInit'])return!0x1;const _0x651e17=this['_getAffectedRoot'](_0x25352b);return _0x651e17&&!this['_knownRootNames']['has'](_0x651e17);});D(_0x187c62,this['_document']['version']),this['_applyOperationsSet'](_0x187c62),_0x1608e1=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0xfed8f5=this['_decompressOperations'](_0x262f01['data'],_0x262f01['metadata'])['filter'](_0x4ead6b=>_0x4ead6b['baseVersion']>=this['_lastServerVersion']);_0xfed8f5['forEach'](_0x40df96=>this['_addKnownRoot'](_0x40df96)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x3c590f=>!_0x3c590f['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x3c590f))),this['_bufferedOperations']['length']&&D(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0xfed8f5),_0x1608e1=this['_handleExternalOperations'](_0xfed8f5,_0x262f01['version'],_0x262f01['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x1608e1?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}['_handleExternalOperations'](_0x283619,_0x43a213,_0x5956ea){try{const _0x498ae2={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x455089,operationsB:_0x685b68,originalOperations:_0x51384c}=_0x3f9ccd(_0x283619,this['_bufferedOperations'],_0x498ae2);D(_0x455089,this['_document']['version']),D(_0x685b68,_0x43a213);for(const _0x36573f of _0x455089){const _0x2c5ff4=_0x51384c['get'](_0x36573f);_0x36573f['_authorId']=_0x2c5ff4?_0x2c5ff4['_authorId']:null;}_0x5956ea&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x283619,_0x5956ea),this['_lastSyncedOperationId']=_0x5956ea),this['_bufferedOperations']=[..._0x685b68],this['_applyOperationsSet'](_0x455089),this['_updateServerHistory'](_0x283619);}catch(_0x33ff98){return console['error'](_0x33ff98),!0x1;}return!0x0;}['_applyOperationsSet'](_0x517f9a,_0x32e92d=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0x23ce79=>{for(const _0x26b536 of _0x517f9a)this['_knownOperations']['add'](_0x26b536),this['_addKnownRoot'](_0x26b536),_0x23ce79['batch']['addOperation'](_0x26b536),this['editor']['model']['applyOperation'](_0x26b536);});}['_addKnownRoot'](_0x18812a){const _0x3bda36=this['_getAffectedRoot'](_0x18812a);_0x3bda36&&this['_knownRootNames']['add'](_0x3bda36);}['_getAffectedRoot'](_0x1f9f0d){let _0x4894ac,_0xdebdac;switch(_0x1f9f0d['type']){case'insert':_0x4894ac=_0x1f9f0d['position']['root'];break;case'marker':if(_0xdebdac=_0x1f9f0d['newRange'],!_0xdebdac)return null;_0x4894ac=_0xdebdac['root'];break;case'addRootAttribute':_0x4894ac=_0x1f9f0d['root'];break;case'addRoot':_0x4894ac=_0x1f9f0d['affectedSelectable'];break;case'move':_0x4894ac=_0x1f9f0d['targetPosition']['root'];break;default:return null;}return _0x4894ac['rootName'];}['_updateServerHistory'](_0x3d99af){_0x3d99af['forEach'](_0x2b57cb=>{const _0x4bee53=_0x2b57cb['clone']();_0x4bee53['_authorId']=_0x2b57cb['_authorId'],_0x4bee53['_isInit']=!!_0x2b57cb['_isInit'],_0x4bee53['createdAt']=_0x2b57cb['createdAt'],_0x4bee53['baseVersion']+=this['_offset'],_0x2b57cb['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x4bee53),this['serverHistory']['addOperation'](_0x4bee53);});}['_handleReconnectionError'](_0x39b5d6){const _0x4d0ca3=this['editor']['plugins']['get']('Notification'),_0x43965b=this['editor']['locale'];_0x39b5d6||(_0x39b5d6=R(_0x43965b,'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.')),_0x4d0ca3['showWarning'](_0x39b5d6,{'title':R(_0x43965b,'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'](_0x40cd9a)['add'](R(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}['_clearPendingAction'](){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x40cd9a)['remove'](this['_pendingAction']),this['_pendingAction']=null);}['_compressOperations'](_0x208e78){const _0x50f136=_0x208e78['map'](_0x3d23e9=>_0x3d23e9['toJSON']());return this['_compressor']['compress'](_0x50f136);}['_decompressOperations'](_0x4ae516,_0x475d33){return this['_compressor']['decompress'](_0x4ae516)['map']((_0x5da784,_0x20eb3f)=>{const _0x44fb63='init'==_0x475d33[_0x20eb3f]['type'];if('InsertOperation'==_0x5da784['__className']){const _0x293167=_0x5da784['position']['root'];!this['_document']['getRoot'](_0x293167)&&(this['_document']['createRoot']('$root',_0x293167)['_isAttached']=!0x1);}const _0x28882f=_0x327378['fromJSON'](_0x5da784,this['_document']);return _0x28882f['wasUndone']=_0x5da784['wasUndone'],_0x28882f['_isInit']=_0x44fb63,_0x28882f['_authorId']=_0x44fb63?null:_0x475d33[_0x20eb3f]['userId'],_0x28882f['_isDisconnection']='cs:removeUser'===_0x475d33[_0x20eb3f]['type'],_0x28882f['createdAt']=_0x475d33[_0x20eb3f]['createdAt'],_0x28882f;});}['_refreshUserSelectionMarkers'](){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}['_shouldSendSelectionUpdate'](){const _0x2a0015=this['editor']['plugins']['get'](i)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0x2a0015&&_0x2a0015['length']>0x1&&this['_hasSelectionChanged'];}['_shouldSendUpdate'](){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}}class ReconnectionError extends Error{}function D(_0x455edd,_0x271bf0){for(const _0x5bca4d of _0x455edd)_0x5bca4d['baseVersion']=_0x271bf0++;}class OperationIdentifier{['_ignoredOperations'];['_operationToId'];constructor(_0x2cb0a4){this['_ignoredOperations']=_0x2cb0a4,this['_operationToId']=new WeakMap();}['getIdOfTheLastOperation'](_0x501d92){let _0x169220=_0x501d92['length'];for(;_0x169220--;){const _0x2f5191=_0x501d92[_0x169220];if(!this['_ignoredOperations']['has'](_0x2f5191)){if(!this['_operationToId']['has'](_0x2f5191)){const _0x4ccf9e=_0x404c20()['slice'](0x1,0x12);this['_operationToId']['set'](_0x2f5191,_0x4ccf9e);}return this['_operationToId']['get'](_0x2f5191);}}}['setIdForTheLastOperation'](_0x5e7e5d,_0x58a4fc){if(!_0x58a4fc)return;let _0x22802=_0x5e7e5d['length'];for(;_0x22802--;){const _0x4a0e06=_0x5e7e5d[_0x22802];this['_ignoredOperations']['has'](_0x4a0e06)||this['_operationToId']['set'](_0x4a0e06,_0x58a4fc);}}}class a extends _0x38ec35{static get['requires'](){return[l];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class s extends _0x57ac80{static ['CommentsService']=/* #__PURE__ -- @preserve */
|
|
26
|
+
((()=>_0x1e0da1)());['_services'];static get['requires'](){return[n,'CommentsRepository',i,_0x14383d];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x2159a3){super(_0x2159a3),this['_services']=new Map();}async['init'](){const _0x59e0e2=this['context'],_0x12fb4e=_0x59e0e2['plugins']['get']('CommentsRepository');if(_0x59e0e2['plugins']['get'](n)['addToReconnectionStack'](this),_0x12fb4e['adapter']={'addCommentThread':async({channelId:_0xc821c4,threadId:_0x48b835,comments:_0x680b6e,resolvedAt:_0x291d7f,resolvedBy:_0x5e9a6b,context:_0x555c33,attributes:_0x2b7970})=>{const _0x41a8d2=await this['_getService'](_0xc821c4)['addCommentThread']({'commentThreadId':_0x48b835,'comments':_0x680b6e['map'](_0x3bb846=>function(_0x2819bc,_0x1bcaf8,_0xd6631e){return{'commentThreadId':_0xd6631e,'commentId':_0x2819bc['commentId'],'userId':_0x2819bc['authorId'],'content':_0x2819bc['content'],'documentId':_0x1bcaf8,'createdAt':_0x2819bc['createdAt'],'attributes':_0x2819bc['attributes']||{}};}(_0x3bb846,_0xc821c4,_0x48b835)),'resolvedAt':_0x291d7f,'resolvedBy':_0x5e9a6b,'context':_0x555c33,'attributes':_0x2b7970})['catch'](lt);return{'threadId':_0x41a8d2['commentThreadId'],'comments':_0x41a8d2['comments']};},'getCommentThread':async({channelId:_0x2eb857,threadId:_0x24828e})=>{const _0x835a91=await this['_getService'](_0x2eb857)['getCommentThread'](_0x24828e)['catch'](tt)['catch'](lt);return _0x835a91?_0x835a91['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0x835a91]),{'threadId':_0x835a91['commentThreadId'],'comments':_0x835a91['comments']['map'](ot),'context':_0x835a91['context'],'resolvedAt':_0x835a91['resolvedAt'],'resolvedBy':_0x835a91['resolvedBy'],'attributes':_0x835a91['attributes']||{}}):null;},'updateCommentThread':async({channelId:_0x564f4a,threadId:_0x235cf3,context:_0x5a1f24,unlinkedAt:_0x24d272,attributes:_0x8f798a})=>this['_getService'](_0x564f4a)['updateCommentThread']({'commentThreadId':_0x235cf3,'context':_0x5a1f24,'attributes':_0x8f798a,'unlinkedAt':_0x24d272})['catch'](tt)['catch'](lt),'resolveCommentThread':async({channelId:_0x72a05e,threadId:_0x26a9a8})=>{const _0x556e61=await this['_getService'](_0x72a05e)['resolveCommentThread'](_0x26a9a8)['catch'](tt)['catch'](lt);return{'threadId':_0x556e61['commentThreadId'],'resolvedAt':_0x556e61['resolvedAt'],'resolvedBy':_0x556e61['resolvedBy']};},'reopenCommentThread':async({channelId:_0xfd3697,threadId:_0x5c343f})=>this['_getService'](_0xfd3697)['reopenCommentThread'](_0x5c343f)['catch'](tt)['catch'](lt),'removeCommentThread':({channelId:_0x194c1e,threadId:_0x4e08b2})=>this['_getService'](_0x194c1e)['removeCommentThread'](_0x4e08b2)['catch'](tt)['catch'](lt),'addComment':({channelId:_0x223f30,threadId:_0x42dadf,commentId:_0x2e211b,content:_0x13b952,attributes:_0x34d9db})=>this['_getService'](_0x223f30)['addComment'](_0x42dadf,_0x2e211b,_0x13b952,_0x34d9db)['catch'](lt),'updateComment':({channelId:_0x1a3354,threadId:_0x294b55,commentId:_0x5a8f56,content:_0x21f5c9,attributes:_0x5b97be})=>this['_getService'](_0x1a3354)['updateComment'](_0x294b55,_0x5a8f56,_0x21f5c9,_0x5b97be)['catch'](tt)['catch'](lt),'removeComment':({channelId:_0x2dd463,threadId:_0x5834b1,commentId:_0x5b3951})=>this['_getService'](_0x2dd463)['removeComment'](_0x5834b1,_0x5b3951)['catch'](tt)['catch'](lt)},_0x59e0e2 instanceof _0xaf36e6){const _0x57e0ba=_0x59e0e2['config']['get']('collaboration.channelId'),_0x32a795=_0x59e0e2['plugins']['get'](i);await this['_setUpService'](_0x57e0ba);const _0x1e4769=await this['_services']['get'](_0x57e0ba)['getConnectedSessions']();this['listenTo'](_0x32a795,'sessionAdd:'+_0x57e0ba,(_0x53f4fe,{session:_0x3e64ad})=>{_0x3e64ad['id']===_0x32a795['mySessionId']&&(_0x53f4fe['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x3e64ad['permissions'],_0x57e0ba));}),_0x32a795['register'](_0x57e0ba,_0x1e4769);}}async['_setUpService'](_0x206481){if(this['_services']['has'](_0x206481))throw new _0x533522('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0x206481});const _0x4ce775=this['context']['plugins']['get']('CommentsRepository'),_0x39e30a=new s['CommentsService'](_0x206481);this['_services']['set'](_0x206481,_0x39e30a),this['listenTo'](_0x39e30a,'commentThreadAdded',(_0x2c6b47,_0x552e13)=>{const {commentThreadId:_0x2cad33,documentId:_0x502712,context:_0x18baf8,attributes:_0x3c988a,resolvedAt:_0x12b35b,resolvedBy:_0xb6dbc3,comments:_0x59ab46}=_0x552e13;_0x4ce775['getCommentThread'](_0x2cad33)||_0x4ce775['addCommentThread']({'threadId':_0x2cad33,'channelId':_0x502712,'comments':_0x59ab46?_0x59ab46['map'](ot):[],'context':_0x18baf8,'attributes':_0x3c988a,'resolvedAt':_0x12b35b,'resolvedBy':_0xb6dbc3,'isFromAdapter':!0x0});}),this['listenTo'](_0x39e30a,'commentThreadUpdated',(_0x201460,{commentThreadId:_0x4551ec,documentId:_0x62b936,context:_0x4e3c0e,unlinkedAt:_0x1a1008,attributes:_0x33dd74})=>{_0x4ce775['getCommentThread'](_0x4551ec)&&_0x4ce775['updateCommentThread']({'threadId':_0x4551ec,'channelId':_0x62b936,'context':_0x4e3c0e,'unlinkedAt':_0x1a1008,'attributes':_0x33dd74,'isFromAdapter':!0x0});}),this['listenTo'](_0x39e30a,'commentThreadResolved',(_0x3c9ddc,{commentThreadId:_0xd23732,resolvedBy:_0xd3bb0f,resolvedAt:_0x49dd60})=>{const _0x11ebad=_0x4ce775['getCommentThread'](_0xd23732);_0x11ebad&&_0x11ebad['resolve']({'resolvedBy':_0xd3bb0f,'resolvedAt':_0x49dd60,'isFromAdapter':!0x0});}),this['listenTo'](_0x39e30a,'commentThreadReopened',(_0x303ae0,{commentThreadId:_0x48155c})=>{const _0x24b9a0=_0x4ce775['getCommentThread'](_0x48155c);_0x24b9a0&&_0x24b9a0['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0x39e30a,'commentThreadRemoved',(_0x251c42,{commentThreadId:_0x5aad9a})=>{const _0xca6fa0=_0x4ce775['getCommentThread'](_0x5aad9a);_0xca6fa0&&_0xca6fa0['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0x39e30a,'commentAdded',(_0x3230d7,_0x548302)=>{const _0x1eab55=_0x548302['commentThreadId'],_0xb89b46=_0x4ce775['getCommentThread'](_0x1eab55);_0xb89b46&&_0xb89b46['addComment']({...ot(_0x548302),'isFromAdapter':!0x0});}),this['listenTo'](_0x39e30a,'commentUpdated',(_0x256940,{commentThreadId:_0x538555,commentId:_0x5db5e3,content:_0xaf75a6,attributes:_0x3c427d})=>{const _0x3ef030=_0x4ce775['getCommentThread'](_0x538555);if(_0x3ef030){const _0x575d11=_0x3ef030['getComment'](_0x5db5e3);_0x575d11&&_0x575d11['update']({'content':_0xaf75a6,'attributes':_0x3c427d,'isFromAdapter':!0x0});}}),this['listenTo'](_0x39e30a,'commentRemoved',(_0x439185,{commentThreadId:_0x547245,commentId:_0x1e6dff})=>{const _0x3f5e5b=_0x4ce775['getCommentThread'](_0x547245);if(_0x3f5e5b){const _0x4c7574=_0x3f5e5b['getComment'](_0x1e6dff);_0x4c7574&&_0x4c7574['remove']({'isFromAdapter':!0x0});}}),await this['_connectService'](_0x206481);}['destroy'](){if(this['context']instanceof _0xaf36e6){const _0x51ab22=this['context']['config']['get']('collaboration.channelId');this['_terminateService'](_0x51ab22);}}['_terminateService'](_0x1c527e){if(!this['_services']['has'](_0x1c527e))throw new _0x533522('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0x1c527e});this['_getService'](_0x1c527e)['disconnect'](),this['_services']['delete'](_0x1c527e);}async['reconnect'](){for(const _0x136fb0 of this['_services']['keys']())await this['_connectService'](_0x136fb0);if(this['context']instanceof _0xaf36e6){const _0x506ac=this['context']['config']['get']('collaboration.channelId'),_0x9131bd=this['context']['plugins']['get'](i);_0x9131bd['unregister'](_0x506ac);const _0x39171f=await this['_services']['get'](_0x506ac)['getConnectedSessions']();_0x9131bd['register'](_0x506ac,_0x39171f);}}async['_connectService'](_0x2db7c9){const {connection:_0x3be3c7}=this['context']['plugins']['get'](n),_0x4eb9ad=this['context']['plugins']['get']('CommentsRepository'),_0x109602=this['_services']['get'](_0x2db7c9),_0x3125fa=await _0x109602['connect'](_0x3be3c7);await this['_fetchMissingUsersForThreads'](_0x3125fa);const _0x1d1dc8=new Set(Array['from'](_0x4eb9ad['getCommentThreads']({'channelId':_0x2db7c9}),_0x15b330=>_0x15b330['id']));for(const _0x2f803d of _0x3125fa)_0x2f803d['deletedAt']||_0x1d1dc8['delete'](_0x2f803d['commentThreadId']);for(const _0x4dd47a of _0x1d1dc8)_0x4eb9ad['getCommentThread'](_0x4dd47a)['remove']({'isFromAdapter':!0x0});for(const _0x24fdd4 of _0x3125fa){let _0x1e0408=_0x4eb9ad['getCommentThread'](_0x24fdd4['commentThreadId']);const {commentThreadId:_0x23bd9f,context:_0x2a60da,attributes:_0x4a473a,resolvedBy:_0x32c061,resolvedAt:_0x16392e,unlinkedAt:_0x26aa2c,deletedAt:_0x5bf652}=_0x24fdd4;if(_0x5bf652)continue;_0x1e0408||(_0x1e0408=_0x4eb9ad['addCommentThread']({'channelId':_0x2db7c9,'threadId':_0x23bd9f,'context':_0x2a60da,'attributes':_0x4a473a||{},'resolvedBy':_0x32c061,'resolvedAt':_0x16392e,'unlinkedAt':_0x26aa2c,'isFromAdapter':!0x0}));const _0x23e723=new Set(Array['from'](_0x1e0408['comments'],_0x5102f6=>_0x5102f6['id']));for(const _0x29ec75 of _0x24fdd4['comments'])_0x23e723['delete'](_0x29ec75['commentId']);for(const _0x4fe1a1 of _0x23e723)_0x1e0408['getComment'](_0x4fe1a1)['remove']({'isFromAdapter':!0x0});for(const _0xaaf948 of _0x24fdd4['comments']){const _0x1304b6=_0x1e0408['getComment'](_0xaaf948['commentId']);_0x1304b6?_0x1304b6['content']!==_0xaaf948['content']&&_0x1304b6['update']({'content':_0xaaf948['content'],'isFromAdapter':!0x0}):_0x1e0408['addComment'](Object['assign'](ot(_0xaaf948),{'isFromAdapter':!0x0}));}}}['_getService'](_0xd03367){if(!this['_services']['has'](_0xd03367))throw new _0x533522('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0xd03367});return this['_services']['get'](_0xd03367);}async['_fetchMissingUsersForThreads'](_0x141c90){const _0xb828d3=this['context']['plugins']['get'](_0x14383d),{connection:_0x1974cf}=this['context']['plugins']['get'](n),_0x2c9292=new Set();for(const {resolvedBy:_0x19767c,comments:_0x5cd7f6}of _0x141c90){_0x19767c&&!_0xb828d3['getUser'](_0x19767c)&&_0x2c9292['add'](_0x19767c);for(const {userId:_0x5cfa4c}of _0x5cd7f6)_0xb828d3['getUser'](_0x5cfa4c)||_0x2c9292['add'](_0x5cfa4c);}if(0x0===_0x2c9292['size'])return;const _0x48d07b=await ht['getMany'](_0x1974cf,Array['from'](_0x2c9292));for(const _0x2410d0 of _0x48d07b)_0xb828d3['getUser'](_0x2410d0['id'])||_0xb828d3['addUser'](_0x2410d0);}}async function tt(_0x331e30){if('404'!==_0x331e30['code'])throw _0x331e30;}function lt(_0x13dae1){if((_0x15b791=_0x13dae1)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0x15b791['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x15b791['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0x15b791;throw _0x13dae1;}function ot(_0x412d33){return{'threadId':_0x412d33['commentThreadId'],'commentId':_0x412d33['commentId'],'content':_0x412d33['content'],'createdAt':_0x412d33['createdAt'],'authorId':_0x412d33['userId'],'attributes':_0x412d33['attributes']||{}};}class m extends _0x38ec35{static ['TrackChangesService']=/* #__PURE__ -- @preserve */
|
|
27
|
+
((()=>it)());['_bufferedRequests'];['_trackChangesService'];static get['requires'](){return[s,'TrackChangesEditing',n];}static get['pluginName'](){return'CloudServicesTrackChangesAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x4c8875){super(_0x4c8875);const _0x160f70=this['editor']['config']['get']('collaboration.channelId');this['_bufferedRequests']=new Map(),this['_trackChangesService']=new m['TrackChangesService'](_0x160f70);}['init'](){const _0xb8ce67=this['editor']['plugins']['get'](n),_0xdcdfd=this['editor']['plugins']['get']('TrackChangesEditing');return _0xdcdfd['adapter']={'getSuggestion':async _0x2e5da7=>{await this['_waitForServiceReady']();const _0x59f9c4=await this['_trackChangesService']['get'](_0x2e5da7)['catch'](et);return await this['_fetchMissingUsersForThreads']([_0x59f9c4]),_0x59f9c4;},'addSuggestion':async({id:_0x2d2267,type:_0x502054,data:_0x9774d0,originalSuggestionId:_0x238f01,attributes:_0x137016})=>{await this['_waitForServiceReady']();const _0x2d508f={'id':_0x2d2267,'type':_0x502054,'data':_0x9774d0,'originalSuggestionId':_0x238f01,'attributes':_0x137016},_0x1aa081=await this['_trackChangesService']['add'](_0x2d2267,_0x502054,_0x9774d0,_0x238f01,_0x137016)['catch'](_0x4db040=>{if(dt(_0x4db040))return new Promise(_0x39ba06=>{this['_bufferedRequests']['set'](_0x2d2267,{'resolve':_0x39ba06,'suggestionData':_0x2d508f});});throw _0x4db040;});return this['_bufferedRequests']['delete'](_0x2d2267),_0x1aa081;},'updateSuggestion':async(_0x103d40,_0x227096)=>{if(await this['_waitForServiceReady'](),'open'!==_0x227096['state'])return this['_trackChangesService']['update'](_0x103d40,_0x227096)['catch'](et);}},this['listenTo'](this['_trackChangesService'],'suggestionUpdated',(_0x1061d0,_0x4ac4ff)=>{_0xdcdfd['hasSuggestion'](_0x4ac4ff['id'])&&(_0xdcdfd['getSuggestion'](_0x4ac4ff['id'])['attributes']=_0x4ac4ff['attributes']);}),this['_trackChangesService']['connect'](_0xb8ce67['connection'])['then'](_0x31223d=>(_0xb8ce67['addToReconnectionStack'](this),this['_fetchMissingUsersForThreads'](_0x31223d)['then'](()=>{for(const _0x1057b1 of _0x31223d){_0xdcdfd['addSuggestionData'](_0x1057b1)['_saved']=!0x0;}})));}async['reconnect'](){const _0xb46e43=this['editor']['plugins']['get']('TrackChangesEditing'),{connection:_0x28d24c}=this['editor']['plugins']['get'](n),_0x7ad195=await this['_trackChangesService']['connect'](_0x28d24c);await this['_fetchMissingUsersForThreads'](_0x7ad195);for(const {suggestionData:_0x315a57,resolve:_0xbbf854}of this['_bufferedRequests']['values']()){let _0x8d6bcd=_0x7ad195['find'](_0x2658cd=>_0x2658cd['id']===_0x315a57['id']);_0x8d6bcd||(_0x8d6bcd=await this['_trackChangesService']['add'](_0x315a57['id'],_0x315a57['type'],_0x315a57['data'],_0x315a57['originalSuggestionId'])),_0xbbf854(_0x8d6bcd);}for(const _0x42beb6 of _0x7ad195)_0xb46e43['hasSuggestion'](_0x42beb6['id'])||_0xb46e43['addSuggestionData'](_0x42beb6);}async['_waitForServiceReady'](){this['_trackChangesService']['isConnected']||await new Promise(_0x42e07c=>{this['listenTo'](this['_trackChangesService'],'connected',_0x3df8ce=>{_0x3df8ce['off'](),_0x42e07c();});});}async['_fetchMissingUsersForThreads'](_0x182da4){const _0x4b6a2f=this['editor']['plugins']['get'](_0x14383d),{connection:_0x4447ec}=this['editor']['plugins']['get'](n),_0x47c286=new Set();for(const {authorId:_0x365743}of _0x182da4)_0x4b6a2f['getUser'](_0x365743)||_0x47c286['add'](_0x365743);if(0x0===_0x47c286['size'])return;const _0x145534=await ht['getMany'](_0x4447ec,Array['from'](_0x47c286));for(const _0x4fa9e2 of _0x145534)_0x4b6a2f['getUser'](_0x4fa9e2['id'])||_0x4b6a2f['addUser'](_0x4fa9e2);}}function et(_0x3708e5){if(dt(_0x3708e5))return new Promise(()=>{});throw _0x3708e5;}function dt(_0x1b132f){return _0x1b132f['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x1b132f['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class g extends _0x38ec35{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 _0x318d10=this['editor']['plugins']['get'](n),_0x4c5d7d=this['editor']['plugins']['get']('CommentsEditing'),_0x1ab1e3=this['editor']['plugins']['get'](s);return this['editor']['data']['once']('ready',()=>{this['listenTo'](_0x318d10,'change:state',(_0x230fa1,_0x5afbe0,_0x531597)=>{_0x4c5d7d['isThreadsLoadingPaused']='connected'!==_0x531597;});}),this['listenTo'](_0x318d10,'change:state',(_0x18de2e,_0x287efb,_0x582ebe)=>{this['editor']['plugins']['get']('CommentsRepository')['switchReadOnly']('connected'!==_0x582ebe);}),_0x1ab1e3['_setUpService'](this['editor']['config']['get']('collaboration.channelId'));}['destroy'](){this['editor']['plugins']['get'](s)['_terminateService'](this['editor']['config']['get']('collaboration.channelId')),super['destroy']();}}class RealTimeCollaborativeTrackChanges extends _0x38ec35{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 _0x38ec35{static ['RevisionHistoryService']=/* #__PURE__ -- @preserve */
|
|
28
|
+
((()=>_0x1b1037)());['_lastRequestId'];['_revisionTracker'];['_revisionHistoryService'];['_oldOffset'];static get['requires'](){return[n,l,'RevisionHistory',i,_0x14383d];}static get['pluginName'](){return'CloudServicesRevisionHistoryAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x4962bb){super(_0x4962bb);const _0x411ed7=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new c['RevisionHistoryService'](_0x411ed7);}async['init'](){const _0x29d6b8=this['editor']['plugins']['get'](l),_0x1efd95=_0x29d6b8['serverHistory'],_0x35e7b4=this['editor']['plugins']['get'](n);this['_revisionTracker']['setSource']({'history':_0x1efd95,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0x29d6b8['sessionId']});const _0x518ee4=this['editor']['config']['get']('cloudServices.bundleVersion')||nt,_0x302edf=await _0x3eecac['isBundleUploaded'](_0x35e7b4['connection'],_0x518ee4);this['editor']['plugins']['get']('RevisionHistory')['adapter']={'getRevision':async({revisionId:_0x131b0d})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0x131b0d)),'updateRevisions':async _0x7ad703=>{await this['_waitForServiceReady']();const _0x49d60e=this['_revisionTracker']['currentRevision'];if(_0x302edf&&0x1===_0x7ad703['length']&&_0x7ad703[0x0]['id']===_0x49d60e['id'])return _0x7ad703;for(const _0x5e8f3f of _0x7ad703)_0x5e8f3f['id']===_0x49d60e['id']&&(_0x5e8f3f['isEmptyCurrent']=_0x5e8f3f['fromVersion']===_0x5e8f3f['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0x7ad703,this['_lastRequestId'])['then'](_0x1df29c=>(this['_lastRequestId']=_0x1df29c,_0x7ad703))['catch'](_0x35437a=>{if(V(_0x35437a)||'400'===_0x35437a['code']&&void 0x0!==_0x35437a['data']['wrongRequestId']){for(const _0x419f28 of _0x7ad703){!this['_revisionTracker']['repository']['getRevision'](_0x419f28['id'])||this['_revisionTracker']['_bufferUpdate'](_0x419f28['id'],_0x419f28,!0x1);}if(V(_0x35437a))throw _0x35437a;return _0x7ad703;}throw _0x35437a;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0x4905dc,{revisionsData:_0x3eb8d8,requestId:_0xe16d44})=>{Math['max'](..._0x3eb8d8['map'](_0x5b4666=>_0x5b4666['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0x3eb8d8,_0xe16d44);}):this['_handleRevisionsUpdate'](_0x3eb8d8,_0xe16d44);});const {revisions:_0x26c800,requestId:_0x13da6c}=await this['_revisionHistoryService']['connect'](_0x35e7b4['connection']);_0x35e7b4['addToReconnectionStack'](this),this['_lastRequestId']=_0x13da6c,await this['_fetchMissingUsers'](_0x26c800);for(const _0x4da523 of _0x26c800)this['_revisionTracker']['addRevisionData'](_0x4da523);this['listenTo'](_0x29d6b8,'change:_isConnected',(_0x52f773,_0x56c403,_0x2c85a4)=>{_0x2c85a4&&(this['_oldOffset']=_0x29d6b8['_offset'],_0x52f773['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](_0x35e7b4,'state',_0x4cdd56=>_0x4cdd56===_0x207676['CONNECTED']);}async['reconnect'](){const _0x54d0b3=this['editor']['plugins']['get'](n),_0xbe566e=this['editor']['plugins']['get'](l),_0x298a22=async()=>{const _0x99eb89=this['_revisionTracker']['currentRevision'],_0x14d980=_0x99eb89['id'],_0x4ac747=_0x14d980!==_0xbe566e['sessionId'];if(_0x4ac747){const _0x2fb4b2=_0xbe566e['_offset']-this['_oldOffset'],_0x29b83b=this['_getLatestVersionFromServerOperations']();this['_revisionTracker']['_revisionDataBuilder']['reInit']();if(_0x99eb89['toVersion']+_0x2fb4b2!==_0x29b83b){const _0x5b2c55=_0x99eb89['fromVersion']+_0x2fb4b2,_0x89560a=this['editor']['plugins']['get'](_0x14383d),_0x2b92f5=this['_revisionTracker']['buildRevisionData']({'revision':_0x99eb89,'from':_0x5b2c55,'to':_0x29b83b});_0x2b92f5['id']=_0x99eb89['id'];const _0xd553d5=_0x2b92f5['authorsIds']['map'](_0x1fbb52=>_0x89560a['getUser'](_0x1fbb52));_0x99eb89['_update']({..._0x2b92f5,'authors':_0xd553d5},!0x0),this['_revisionTracker']['_bufferUpdate'](_0x99eb89['id'],_0x2b92f5,!0x0);}this['_revisionTracker']['_startingVersion']=_0x29b83b,(_0x99eb89['toVersion']===_0x99eb89['fromVersion']&&!this['_revisionTracker']['_bufferedUpdates']['has'](_0x14d980)&&this['_revisionTracker']['repository']['_revisions']['remove'](_0x14d980),this['_revisionTracker']['_createCurrentRevision'](_0x29b83b));}const {revisions:_0x278acc,requestId:_0x394ed8}=await this['_revisionHistoryService']['reconnect'](_0x54d0b3['connection'],this['_lastRequestId']);_0x4ac747&&_0x278acc['length']>0x0?_0xbe566e['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x278acc),this['_handleRevisionsUpdate'](_0x278acc,_0x394ed8),this['_revisionTracker']['sendBufferedUpdates']());};return _0xbe566e['_isConnected']?_0x298a22():new Promise((_0x4f9e59,_0x87e05)=>{_0xbe566e['once']('change:_isConnected',()=>{_0x298a22()['then'](_0x4f9e59)['catch'](_0x87e05);});});}['destroy'](){super['destroy']();}async['_waitForServiceReady'](){this['_revisionHistoryService']['isConnected']||await new Promise(_0x67ba50=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x3cb3bd=>{_0x3cb3bd['off'](),_0x67ba50();});});}['_getLatestVersionFromServerOperations'](){const _0x4916e6=this['editor']['plugins']['get'](l)['serverHistory']['getOperations']()['reverse']();for(const _0x157055 of _0x4916e6)if('marker'!==_0x157055['type']||_0x157055['affectsData'])return _0x157055['baseVersion']+0x1;}['_getLatestVersion'](){const _0x5df0ea=this['editor']['plugins']['get'](l);return new Promise(_0x7444d2=>{_0x5df0ea['_isPendingUpdate']?_0x5df0ea['once']('change:_isPendingUpdate',()=>{_0x7444d2(this['_getLatestVersionFromServerOperations']());}):_0x7444d2(this['_getLatestVersionFromServerOperations']());});}['_handleRevisionsUpdate'](_0x375b96,_0x3d2edf){const _0x5afd40=this['_revisionTracker']['repository'];this['_lastRequestId']=_0x3d2edf;for(const _0x5683a8 of _0x375b96){const _0x24cc7d=_0x5afd40['getRevision'](_0x5683a8['id']);if(_0x24cc7d){if((_0x5683a8['fromVersion']||_0x5683a8['toVersion'])&&(_0x5683a8['diffData']=null),_0x24cc7d===this['_revisionTracker']['currentRevision']){const _0x429411=Math['max'](_0x24cc7d['toVersion'],_0x5683a8['toVersion']),_0x1d3b03=Math['max'](_0x24cc7d['fromVersion'],_0x5683a8['fromVersion']);let _0x143c47;_0x24cc7d['toVersion']===_0x5683a8['toVersion']&&_0x24cc7d['fromVersion']===_0x5683a8['fromVersion']?(_0x143c47=!0x0,this['_preventResendingRevisionData'](_0x5683a8)):_0x5683a8['toVersion']===_0x429411&&_0x5683a8['fromVersion']===_0x1d3b03?_0x143c47=!0x1:(_0x24cc7d['toVersion']===_0x429411&&_0x24cc7d['fromVersion']===_0x1d3b03||this['_fixRevision']({'revision':_0x24cc7d,'from':_0x1d3b03,'to':_0x429411}),_0x143c47=!0x0),_0x143c47&&(delete _0x5683a8['fromVersion'],delete _0x5683a8['toVersion'],delete _0x5683a8['diffData'],delete _0x5683a8['createdAt'],delete _0x5683a8['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0x5683a8),this['_preventResendingRevisionData'](_0x5683a8);}else this['_revisionTracker']['addRevisionData'](_0x5683a8);}const _0x3c9a59=_0x5afd40['getRevisions']();_0x3c9a59['reverse']();for(let _0x4ae714=0x0;_0x4ae714<_0x3c9a59['length']-0x1;_0x4ae714++){const _0xb45451=_0x3c9a59[_0x4ae714],_0x3ba652=_0x3c9a59[_0x4ae714+0x1];if(_0xb45451['fromVersion']<_0x3ba652['toVersion']){const _0x534239=_0x3ba652['toVersion'],_0x521ed6=Math['max'](_0x534239,_0xb45451['toVersion']);this['_fixRevision']({'revision':_0xb45451,'from':_0x534239,'to':_0x521ed6});}}}['_fixRevision']({revision:_0x24751c,from:_0xf32546,to:_0xa10870}={}){const _0x4f4452=this['editor']['plugins']['get'](_0x14383d),_0x21543c=this['_revisionTracker']['buildRevisionData']({'revision':_0x24751c,'from':_0xf32546,'to':_0xa10870});_0x21543c['authors']=_0x21543c['authorsIds']['map'](_0x1e5c9b=>_0x4f4452['getUser'](_0x1e5c9b)),_0x24751c['_update'](_0x21543c);}['_preventResendingRevisionData'](_0x1b8b89){const _0x5d18f3={};_0x5d18f3['id']=_0x1b8b89['id'];for(const _0x579cbe of Object['keys'](_0x1b8b89))'id'!==_0x579cbe&&(_0x5d18f3[_0x579cbe]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0x5d18f3['id'],_0x5d18f3,!0x0);}async['_fetchMissingUsers'](_0x4b9d84){const _0x42d2ee=this['editor']['plugins']['get'](_0x14383d),{connection:_0x142750}=this['editor']['plugins']['get'](n),_0x37fc7d=new Set();for(const _0x167407 of _0x4b9d84){for(const _0x1ea203 of _0x167407['authorsIds'])_0x24970b(_0x1ea203);_0x167407['creatorId']&&_0x24970b(_0x167407['creatorId']);}if(0x0===_0x37fc7d['size'])return;const _0x392f0f=await ht['getMany'](_0x142750,Array['from'](_0x37fc7d));for(const _0x49c00a of _0x392f0f)_0x42d2ee['getUser'](_0x49c00a['id'])||_0x42d2ee['addUser'](_0x49c00a);function _0x24970b(_0x17c7cf){_0x42d2ee['getUser'](_0x17c7cf)||_0x37fc7d['add'](_0x17c7cf);}}}function V(_0x440a22){return _0x440a22['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0x440a22['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x440a22['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class RealTimeCollaborativeRevisionHistory extends _0x38ec35{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 _0x422411{['_collapseAt'];constructor(_0x4b6937,_0x10b85f=0x6){super(_0x4b6937);const _0x28b059=this['bindTemplate'];this['set']('isHidden',!0x0),this['set']('usersCount',0x0),this['_collapseAt']=_0x10b85f,this['bind']('isHidden')['to'](this,'usersCount',_0x594ce5=>_0x594ce5<_0x10b85f),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item',_0x28b059['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':_0x28b059['to']('usersCount',_0x1f5d4f=>'+'+(_0x1f5d4f-this['_collapseAt']+0x2)['toString']())}]}]}]});}}class is extends _0x422411{['items'];['keystrokes'];constructor(_0x3476c0){super(_0x3476c0);const _0xf5571=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0x4b7810(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0xf5571['if']('hasPopup'),'aria-expanded':_0xf5571['to']('isExpanded',_0x49f3f3=>this['hasPopup']&&String(_0x49f3f3)),'aria-label':_0xf5571['to']('hasPopup',_0x5ea2cc=>R(_0x3476c0,_0x5ea2cc?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0xf5571['to']('hasPopup',_0x2ec318=>!!_0x2ec318&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items'],'on':{'mouseenter':_0xf5571['to'](()=>this['fire']('presencelist:show')),'mouseleave':_0xf5571['to'](_0x1149c2=>{const _0x40ae94=_0x1149c2,_0x2e2c3c=document['querySelector']('.ck-presence-list__dropdown-list'),_0x4469d2=document['querySelector']('.ck-balloon-panel_with-arrow');_0x2e2c3c?.['contains'](_0x40ae94['relatedTarget'])||_0x4469d2?.['contains'](_0x40ae94['relatedTarget'])||this['fire']('presencelist:hide');})}}),this['on']('change:hasPopup',(_0x3e021c,_0x324e52,_0x6de396)=>{this['element']&&(_0x6de396?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 z extends _0x422411{['counterView'];['inlineListView'];constructor(_0x3938c4,_0x499062=0x6){super(_0x3938c4);const _0x250579=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new B(this['locale'],_0x499062),this['inlineListView']=new is(_0x3938c4),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x51fd36 of this['inlineListView']['items'])_0x51fd36['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',_0x250579['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['inlineListView']]});}}class J extends _0x422411{['listWrapperView'];constructor(_0x14451b,_0x11d5a5){super(_0x14451b);const _0x4efc48=this['bindTemplate'];this['listWrapperView']=new PresenceDropdownListWrapperView(_0x14451b,_0x11d5a5),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':R(_0x14451b,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']],'on':{'mouseleave':_0x4efc48['to'](_0x1b8a6d=>{const _0x43126c=_0x1b8a6d,_0x34f587=document['querySelector']('.ck-presence-list__list'),_0x52b994=document['querySelector']('.ck-balloon-panel_with-arrow');_0x34f587?.['contains'](_0x43126c['relatedTarget'])||_0x52b994?.['contains'](_0x43126c['relatedTarget'])||this['fire']('presencelist:hide');})}});}}class PresenceDropdownListWrapperView extends _0x462fd8{constructor(_0x1a8ba2,_0x312ea8){super(_0x1a8ba2);const _0x35dba6=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0x312ea8?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0x35dba6['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0x35dba6['to']('role'),'aria-label':_0x35dba6['to']('ariaLabel'),'aria-labelledby':_0x35dba6['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0x3be0ca['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0x32c1dd=this['element'];_0x32c1dd&&(this['_isScrollable']=Math['max'](_0x32c1dd['scrollHeight'],_0x32c1dd['clientHeight'])>0.8*window['innerHeight']);}}class K extends st{['userView'];constructor(_0x153273,_0x3c7fbf,_0x401228){super(_0x153273);const _0x3dba76=this['bindTemplate'];this['userView']=new rt(_0x153273,_0x3c7fbf);const _0x59c840={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0x3c7fbf['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0x3c7fbf['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x3c7fbf['color']['getBackgroundColorClass']()],'aria-hidden':'true'}}]};_0x401228&&(_0x59c840['tag']='button',_0x59c840['on']={'click':_0x3dba76['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x59c840);}['focus'](){this['element']['focus']();}}class Q extends _0x422411{['userView'];['markerView'];constructor(_0x47646a,_0x383fb1,_0xcd190b){super(_0x47646a);const _0x26f448=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new rt(_0x47646a,_0x383fb1),this['markerView']=new MarkerView(_0x47646a,_0x383fb1);const _0x4f4329=new at(_0x47646a);_0x4f4329['template']['tag']='span',_0x4f4329['text']=_0x383fb1['name'];const _0x47d768={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0x26f448['to']('isFocusable',_0x587fa9=>!!_0x587fa9&&0x0),'aria-labelledby':_0x4f4329['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0x26f448['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0x26f448['to']('hasTooltip',_0x3c3489=>!_0x3c3489),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0x4f4329]};_0xcd190b&&(_0x47d768['tag']='button',_0x47d768['on']={'click':_0x26f448['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x47d768);}}class MarkerView extends _0x422411{constructor(_0x18402e,_0x4f895c){super(_0x18402e),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x4f895c['color']['getBackgroundColorClass']()],'aria-hidden':'true'}});}}const X={'collapseAt':0x6,'displayMe':!0x0};class r extends _0x57ac80{['currentDisplayedUsers'];['balloonPanelView'];['view'];['presenceDropdownView'];['_bodyCollection']=null;static get['pluginName'](){return'PresenceListUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x37c5e2){super(_0x37c5e2),this['context']['config']['define']('presenceList',X);const _0x35f7e4=_0x37c5e2['config']['get']('presenceList.collapseAt');if('number'!=typeof _0x35f7e4)throw new _0x533522('presencelist-collapseat-invalid-format',this);if(_0x35f7e4<0x1)throw new _0x533522('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](i)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0x5510de(),this['balloonPanelView']=new _0x21eb1a(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get['requires'](){return[i];}['init'](){for(const _0x440468 of this['_allConnectedUsers'])this['_handleUserAdd'](_0x440468);this['listenTo'](this['_allConnectedUsers'],'add',(_0x472297,_0xc41ff5)=>{this['_handleUserAdd'](_0xc41ff5);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0x5ac3b2,_0x1552fd)=>{this['_handleUserRemove'](_0x1552fd);});}['_createView'](){const _0x53ca01=this['context'],_0x1850ab=new z(this['context']['locale'],this['context']['config']['get']('presenceList.collapseAt')),_0xe8efa=this['balloonPanelView'];if(!_0x5b9bb3(_0x53ca01['config']['get']('presenceList.container')))throw new _0x533522('presencelist-missing-container',this);return _0x1850ab['counterView']['bind']('usersCount')['to'](this),_0x1850ab['bind']('isCollapsed')['to'](this,'usersCount',_0x4ae286=>{const {collapseAt:_0x1cf2e3}=_0x53ca01['config']['get']('presenceList'),_0x1c661e=_0x4ae286>=_0x1cf2e3;if(_0x1c661e&&!_0x1850ab['inlineListView']['items']['find'](_0x1ab609=>_0x1ab609 instanceof B)){const _0x264e00=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['currentDisplayedUsers']['length']==_0x264e00&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](this['currentDisplayedUsers']['length']-0x1),_0x1850ab['inlineListView']['items']['add'](_0x1850ab['counterView']);}return _0x1c661e||this['hideDropdown'](),_0x1c661e;}),_0x1850ab['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0x37e96c=>{const _0x23778c=_0x53ca01['config']['get']('presenceList'),_0x402d1c=new Q(_0x53ca01['locale'],_0x37e96c,!!_0x23778c['onClick']);return _0x402d1c['bind']('hasTooltip')['to'](_0x1850ab,'isCollapsed',_0x265010=>!_0x265010),_0x402d1c['bind']('isFocusable')['to'](_0x1850ab,'isCollapsed',_0x49e4c8=>!_0x49e4c8),_0x23778c['onClick']&&this['listenTo'](_0x402d1c,'execute',()=>{this['view']['isCollapsed']||_0x23778c['onClick'](_0x37e96c,_0x402d1c['element']);}),_0x402d1c;}),this['listenTo'](_0x1850ab['inlineListView'],'presencelist:show',()=>{this['view']['isCollapsed']&&this['showDropdown']();}),this['listenTo'](_0x1850ab['inlineListView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();}),_0x1850ab['inlineListView']['keystrokes']['set']('Enter',(_0x5e4c72,_0x33f12c)=>{this['view']['isCollapsed']&&(this['showDropdown'](),_0x33f12c());}),_0x1850ab['render'](),_0xe8efa['render'](),_0x32589f({'emitter':_0x1850ab,'activator':()=>_0xe8efa['isVisible'],'contextElements':[_0xe8efa['element'],_0x1850ab['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0x53ca01['config']['get']('presenceList.container')['appendChild'](_0x1850ab['element']),this['_bodyCollection']=new _0x272992(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_bodyCollection']['add'](this['balloonPanelView']),_0x1850ab;}['_handleUserAdd'](_0x95f052){if(!this['context']['config']['get']('presenceList.displayMe')&&_0x95f052['isMe'])return;const _0x28a5e2=this['context']['config']['get']('presenceList.collapseAt')-0x1;for(this['usersCount']++;this['currentDisplayedUsers']['length']>=_0x28a5e2-(this['view']['isCollapsed']?0x1:0x0)&&this['currentDisplayedUsers']['length']>0x1;)this['currentDisplayedUsers']['remove'](0x1);const _0x5df605=_0x95f052['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0x95f052,_0x5df605);}['_handleUserRemove'](_0x235aa3){this['usersCount']--;const {collapseAt:_0x3f3f6e}=this['context']['config']['get']('presenceList'),_0x154daa=this['usersCount']>=_0x3f3f6e;if(this['currentDisplayedUsers']['get'](_0x235aa3['id']))this['currentDisplayedUsers']['remove'](_0x235aa3['id']);else{if(_0x154daa&&this['currentDisplayedUsers']['length']+0x1===_0x3f3f6e-0x1)return;}if(this['currentDisplayedUsers']['length']+(_0x154daa?0x1:0x0)<this['usersCount']){for(const _0x2a7ea0 of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0x2a7ea0['id'])&&(this['currentDisplayedUsers']['add'](_0x2a7ea0,Math['min'](this['currentDisplayedUsers']['length']-(_0x154daa?0x1:0x0),0x1)),this['currentDisplayedUsers']['length']+(_0x154daa?0x1:0x0)===_0x3f3f6e-0x1))return;}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0x276fef=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new J(this['context']['locale'],!!_0x276fef['onClick']),this['view']['inlineListView']['isExpanded']=!0x0,this['listenTo'](this['presenceDropdownView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();});const {listWrapperView:_0x202021}=this['presenceDropdownView'];_0x202021['items']['bindTo'](this['_allConnectedUsers'])['using'](_0xc012d7=>{if(!_0x276fef['displayMe']&&_0xc012d7['isMe'])return null;const _0x3bd835=new K(this['context']['locale'],_0xc012d7,!!_0x276fef['onClick']);return _0x276fef['onClick']&&this['listenTo'](_0x3bd835,'execute',()=>{_0x276fef['onClick'](_0xc012d7,_0x3bd835['element']);}),_0x3bd835;}),this['balloonPanelView']['content']['add'](this['presenceDropdownView']),this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element']}),_0x202021['focus'](),_0x202021['checkIfScrollable']();const _0x292f07=(_0x4844d0,_0x59ea25)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0x59ea25();};_0x202021['keystrokes']['set']('Esc',_0x292f07),_0x202021['keystrokes']['set']('Shift+Tab',_0x292f07),_0x202021['keystrokes']['set']('Tab',(_0x59edc4,_0x2fb99d)=>{!function(_0x1a937d){const _0x5b7cef=['a','button','input','select','textarea','[tabindex]','[contenteditable]']['map'](_0x5dbb19=>_0x5dbb19+':not([disabled]):not([tabindex=\x22-1\x22])')['join'](','),_0x35d515=[...document['body']['querySelectorAll'](_0x5b7cef)]['filter'](_0x5aba77=>_0x5aba77===document['activeElement']||_0x5aba77['offsetWidth']+_0x5aba77['offsetHeight']>0x0)['sort']((_0x2a5064,_0x281f05)=>(_0x2a5064['tabIndex']||0x0)-(_0x281f05['tabIndex']||0x0)),_0x48d9f1=_0x35d515['indexOf'](_0x1a937d),_0x24ace9=_0x35d515[(_0x48d9f1+0x1)%_0x35d515['length']];_0x24ace9&&_0x24ace9['focus']();}(this['view']['element']),this['hideDropdown'](),_0x2fb99d();}),_0x202021['focusTracker']['add'](this['view']['element']),_0x202021['focusTracker']['on']('change:isFocused',(_0x423361,_0x1d63c1,_0x3f4dc1)=>{_0x3f4dc1||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 PresenceList extends _0x57ac80{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,PresenceList,r as PresenceListUI,l as RealTimeCollaborationClient,g as RealTimeCollaborativeComments,a as RealTimeCollaborativeEditing,RealTimeCollaborativeRevisionHistory,RealTimeCollaborativeTrackChanges,i as Sessions,n as WebSocketGateway};
|