@ckeditor/ckeditor5-real-time-collaboration 48.5.0-alpha.6 → 48.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +6 -6
- package/dist/translations/af.umd.js +1 -1
- package/dist/translations/ar.umd.js +1 -1
- package/dist/translations/ast.umd.js +1 -1
- package/dist/translations/az.umd.js +1 -1
- package/dist/translations/be.umd.js +1 -1
- package/dist/translations/bg.umd.js +1 -1
- package/dist/translations/bn.umd.js +1 -1
- package/dist/translations/bs.umd.js +1 -1
- package/dist/translations/ca.umd.js +1 -1
- package/dist/translations/cs.umd.js +1 -1
- package/dist/translations/da.umd.js +1 -1
- package/dist/translations/de-ch.umd.js +1 -1
- package/dist/translations/de.umd.js +1 -1
- package/dist/translations/el.umd.js +1 -1
- package/dist/translations/en-au.umd.js +1 -1
- package/dist/translations/en-gb.umd.js +1 -1
- package/dist/translations/en.umd.js +1 -1
- package/dist/translations/eo.umd.js +1 -1
- package/dist/translations/es-co.umd.js +1 -1
- package/dist/translations/es.umd.js +1 -1
- package/dist/translations/et.umd.js +1 -1
- package/dist/translations/eu.umd.js +1 -1
- package/dist/translations/fa.umd.js +1 -1
- package/dist/translations/fi.umd.js +1 -1
- package/dist/translations/fr.umd.js +1 -1
- package/dist/translations/gl.umd.js +1 -1
- package/dist/translations/gu.umd.js +1 -1
- package/dist/translations/he.umd.js +1 -1
- package/dist/translations/hi.umd.js +1 -1
- package/dist/translations/hr.umd.js +1 -1
- package/dist/translations/hu.umd.js +1 -1
- package/dist/translations/hy.umd.js +1 -1
- package/dist/translations/id.umd.js +1 -1
- package/dist/translations/it.umd.js +1 -1
- package/dist/translations/ja.umd.js +1 -1
- package/dist/translations/jv.umd.js +1 -1
- package/dist/translations/kk.umd.js +1 -1
- package/dist/translations/km.umd.js +1 -1
- package/dist/translations/kn.umd.js +1 -1
- package/dist/translations/ko.umd.js +1 -1
- package/dist/translations/ku.umd.js +1 -1
- package/dist/translations/lt.umd.js +1 -1
- package/dist/translations/lv.umd.js +1 -1
- package/dist/translations/ms.umd.js +1 -1
- package/dist/translations/nb.umd.js +1 -1
- package/dist/translations/ne.umd.js +1 -1
- package/dist/translations/nl.umd.js +1 -1
- package/dist/translations/no.umd.js +1 -1
- package/dist/translations/oc.umd.js +1 -1
- package/dist/translations/pl.umd.js +1 -1
- package/dist/translations/pt-br.umd.js +1 -1
- package/dist/translations/pt.umd.js +1 -1
- package/dist/translations/ro.umd.js +1 -1
- package/dist/translations/ru.umd.js +1 -1
- package/dist/translations/si.umd.js +1 -1
- package/dist/translations/sk.umd.js +1 -1
- package/dist/translations/sl.umd.js +1 -1
- package/dist/translations/sq.umd.js +1 -1
- package/dist/translations/sr-latn.umd.js +1 -1
- package/dist/translations/sr.umd.js +1 -1
- package/dist/translations/sv.umd.js +1 -1
- package/dist/translations/th.umd.js +1 -1
- package/dist/translations/ti.umd.js +1 -1
- package/dist/translations/tk.umd.js +1 -1
- package/dist/translations/tr.umd.js +1 -1
- package/dist/translations/tt.umd.js +1 -1
- package/dist/translations/ug.umd.js +1 -1
- package/dist/translations/uk.umd.js +1 -1
- package/dist/translations/ur.umd.js +1 -1
- package/dist/translations/uz.umd.js +1 -1
- package/dist/translations/vi.umd.js +1 -1
- package/dist/translations/zh-cn.umd.js +1 -1
- package/dist/translations/zh.umd.js +1 -1
- package/package.json +12 -12
package/dist/index.js
CHANGED
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
import{Context as
|
|
24
|
-
((()=>_0x2b6e0b)());static initialReconnectionInterval=0x3e8;connection;_reconnectionStack;_shouldPluginsReconnect;_domEmitter;static get requires(){return[_0x576e57,_0x5583e8];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x3a7988){super(_0x3a7988),this['set']('state',_0x277f6c['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=new(_0x4f580d())();}init(){const _0x27a3fe=this['context'],_0x4ca205=_0x27a3fe['plugins']['get'](_0x576e57),_0x3c5b45=_0x27a3fe['plugins']['get'](_0x5583e8);if(!_0x4ca205['token'])throw new _0x38aab5('websocketgateway-missing-token',this);if(!_0x4ca205['webSocketUrl'])throw new _0x38aab5('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),WebSocketGateway['WebSocketGateway']['connect'](_0x4ca205['token'],_0x4ca205['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0x12bce7=>{if(this['connection']=_0x12bce7,this['bind']('state')['to'](_0x12bce7,'state',this,'_isBrowserOffline',(_0x5c1fd7,_0x503206)=>('connected'!==_0x5c1fd7&&(this['_shouldPluginsReconnect']=!0x0),_0x503206||_0x5c1fd7!==_0x277f6c['CONNECTED']?_0x277f6c['DISCONNECTED']:this['state']==_0x277f6c['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),_0x277f6c['CONNECTING']):_0x277f6c['CONNECTED'])),this['connection']['on']('error',(_0x59b3a2,_0x23f907)=>{if('limitExceeded'!==_0x23f907['code'])throw console['error'](_0x23f907),new _0x38aab5('cloudservices-init',null,{'originalError':_0x23f907});_0x3c5b45['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'});}),!_0x12bce7['me'])return new Promise(_0x24d588=>_0x12bce7['on']('change:me',_0x24d588));})['catch'](_0x4e7c4b=>{throw console['error'](_0x4e7c4b),new _0x38aab5('cloudservices-init',null,{'originalError':_0x4e7c4b});});}addToReconnectionStack(_0x44c465){if('function'!=typeof _0x44c465['reconnect'])throw new _0x38aab5('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0x44c465))throw new _0x38aab5('websocketgateway-plugin-already-registered',this,{'name':_0x44c465['constructor']['pluginName']});this['_reconnectionStack']['add'](_0x44c465);}removeFromReconnectionStack(_0x413eb7){this['_reconnectionStack']['delete'](_0x413eb7);}isInReconnectionStack(_0x12b76f){return this['_reconnectionStack']['has'](_0x12b76f);}_reconnect(){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0x143f22=>_0x143f22['reconnect']())))['then'](()=>this['state']=_0x277f6c['CONNECTED'])['catch'](_0x4e0386=>{throw console['error'](_0x4e0386),new _0x38aab5('cloudservices-reconnection-error',this['context']);});}disconnect(){this['connection']&&this['connection']['disconnect'](),this['state']=_0x277f6c['DISCONNECTED'],this['_domEmitter']['stopListening']();}destroy(){this['disconnect'](),super['destroy']();}},Y=class extends _0x473f2b{['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[z,_0x420277];}constructor(_0x3dae89){super(_0x3dae89),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0x50f27a(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x420277);}init(){const _0x1abbd6=this['context']['plugins']['get'](z);this['listenTo'](_0x1abbd6,'change:state',(_0x463d76,_0x17fb23,_0x1eef53)=>{if('connected'!==_0x1eef53)this['channelSessions']['forEach'](_0x237124=>_0x237124['clear']()),this['channelConnectedUsers']['forEach'](_0xf09e3d=>_0xf09e3d['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x256b29,_0xf4ee12]of this['_registeredSessions'])for(const _0x5a600c of _0xf4ee12)this['_handleSessionAdd'](_0x256b29,_0x5a600c);}}),this['_createUser'](_0x1abbd6['connection']['me'],!0x0);}register(_0x42e52c,_0x3893b7){if(this['_registeredSessions']['has'](_0x42e52c))throw new _0x38aab5('sessions-register-already-registered',null,{'channelId':_0x42e52c});this['_registeredSessions']['set'](_0x42e52c,_0x3893b7),this['channelSessions']['set'](_0x42e52c,new _0x50f27a()),this['channelConnectedUsers']['set'](_0x42e52c,new _0x50f27a()),this['listenTo'](_0x3893b7,'add',(_0x5f0df8,_0x4d04a1)=>this['_handleSessionAdd'](_0x42e52c,_0x4d04a1)),this['listenTo'](_0x3893b7,'remove',(_0x49add1,_0x2918ab)=>this['_handleSessionRemove'](_0x42e52c,_0x2918ab));for(const _0x5ebb11 of _0x3893b7)this['_handleSessionAdd'](_0x42e52c,_0x5ebb11);}unregister(_0x37480c){if(!this['_registeredSessions']['has'](_0x37480c))throw new _0x38aab5('sessions-unregister-not-exist',null,{'channelId':_0x37480c});const _0x42d783=this['_registeredSessions']['get'](_0x37480c);this['stopListening'](_0x42d783);for(const _0x25349c of _0x42d783)'connected'===this['context']['plugins']['get'](z)['state']&&this['_handleSessionRemove'](_0x37480c,_0x25349c);this['_registeredSessions']['delete'](_0x37480c),this['channelSessions']['delete'](_0x37480c),this['channelConnectedUsers']['delete'](_0x37480c);}get['mySessionId'](){return this['context']['plugins']['get'](z)['connection']['sessionId'];}getUserBySessionId(_0x286e93){for(const _0x4dcf68 of this['channelSessions']['values']())for(const _0x1151ab of _0x4dcf68)if(_0x1151ab['id']===_0x286e93)return _0x1151ab['user'];}getUserSessions(_0x1490b0,_0x59caa2){const _0xe244ea=_0x59caa2?[this['channelSessions']['get'](_0x59caa2)]:this['channelSessions']['values'](),_0x546d90=new Set();for(const _0x4981ab of _0xe244ea)for(const _0x5806f2 of _0x4981ab)_0x5806f2['user']['id']===_0x1490b0['id']&&_0x546d90['add'](_0x5806f2['id']);return _0x546d90;}getUserRole(_0x562a38){for(const _0x13c454 of this['channelSessions']['values']())for(const _0x1607b7 of _0x13c454)if(_0x1607b7['user']===_0x562a38)return _0x1607b7['role'];}['_handleSessionAdd'](_0x12776c,_0x1ac1d6){if('connected'!==this['context']['plugins']['get'](z)['state'])return;const _0x5ee0f3=_0x1ac1d6['user'],_0x2ee627=this['_users']['getUser'](_0x5ee0f3['id'])||this['_createUser'](_0x5ee0f3),_0x346e5a=Object['assign']({},_0x1ac1d6,{'user':_0x2ee627});if(this['channelSessions']['get'](_0x12776c)['add'](_0x346e5a),!_0x5ee0f3['hiddenInPresenceList']){const _0x1e73f3=this['channelConnectedUsers']['get'](_0x12776c);_0x1e73f3['has'](_0x2ee627['id'])||_0x1e73f3['add'](_0x2ee627),this['allConnectedUsers']['has'](_0x2ee627['id'])||_0x5ee0f3['hiddenInPresenceList']||this['allConnectedUsers']['add'](_0x2ee627,_0x2ee627['isMe']?0x0:void 0x0);}this['fire']('sessionAdd:'+_0x12776c,{'channelId':_0x12776c,'session':_0x346e5a});}['_handleSessionRemove'](_0x21ed0d,_0x22ffd1){if('connected'!==this['context']['plugins']['get'](z)['state'])return;const _0x33df7e=this['channelConnectedUsers']['get'](_0x21ed0d),_0x2b771e=_0x22ffd1['user'];_0x2b771e['id']&&(this['channelSessions']['get'](_0x21ed0d)['remove'](_0x22ffd1['id']),_0x33df7e['has'](_0x2b771e['id'])&&!this['getUserSessions'](_0x2b771e,_0x21ed0d)['size']&&_0x33df7e['remove'](_0x2b771e['id']),this['allConnectedUsers']['get'](_0x2b771e['id'])&&!this['getUserSessions'](_0x2b771e)['size']&&this['allConnectedUsers']['remove'](_0x2b771e['id']));}_createUser(_0x4a5eee,_0x547f5f){const _0x36c5ca=this['_users']['addUser'](_0x4a5eee);return _0x547f5f&&this['_users']['defineMe'](_0x4a5eee['id']),_0x36c5ca['orderNumber']=this['_uniqueUsersCount']++,_0x36c5ca;}},K=class extends _0x21af15{_domEmitter=new(_0x4f580d())();static get requires(){return[Y];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const _0x1d3298=this['editor'],_0x43ef3f=_0x1d3298['plugins']['get'](Y);_0x1d3298['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x42d185,{writer:_0x18e9a6})=>function(_0x500e05,_0x28ceac,_0x53d3e7,_0x2815c1){const _0x1f69ab=_0x500e05['markerName']['split'](':')[0x2],_0x2ad089=_0x53d3e7['getUserBySessionId'](_0x1f69ab);if(!_0x2ad089||_0x1f69ab===_0x53d3e7['mySessionId'])return;if(!_0x2815c1['model']['schema']['checkChild'](_0x500e05['markerRange']['start'],'$text'))return;const _0x9647db={'class':'ck-user__marker\x20'+_0x2ad089['color']['getMarkerClass'](),'style':Q(_0x2ad089),'data-name':_0x2ad089['name'],'data-session-id':_0x1f69ab},_0x290bd9=_0x2815c1['model']['markers']['get'](_0x500e05['markerName'])['getStart'](),_0x518e8c=_0x290bd9['nodeAfter'],_0x3f0b7a=_0x2815c1['model']['schema'];if(_0x518e8c&&_0x3f0b7a['isObject'](_0x518e8c)&&_0x3f0b7a['isInline'](_0x518e8c)&&!_0x2815c1['model']['markers']['get']('user:range:'+_0x1f69ab)['getRange']()['isCollapsed'])return;const _0x58b853=_0x290bd9['parent'];return _0x2815c1['model']['schema']['isLimit'](_0x58b853)&&!_0x2815c1['model']['hasContent'](_0x58b853)&&(_0x9647db['contenteditable']=!0x1),function(_0x3863bd,_0x2b8fd6,_0x4ee513){const _0x9691a1=_0x3863bd['createUIElement']('span',_0x2b8fd6);return _0x3863bd['setCustomProperty']('userPositionMarker',!0x0,_0x9691a1),_0x9691a1['render']=function(_0x1773e1){const _0x302141=this['toDomElement'](_0x1773e1),_0x121ed2=document['createElement']('span');return _0x121ed2['classList']['add']('ck-user__marker-tooltip'),_0x121ed2['setAttribute']('contenteditable','false'),_0x121ed2['setAttribute']('spellcheck','false'),_0x121ed2['textContent']=_0x4ee513['name'],_0x302141['innerHTML']='<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span>'+_0x121ed2['outerHTML']+'',_0x302141['addEventListener']('mouseenter',()=>{_0x302141['classList']['add']('ck-user__marker_hovered');}),_0x302141['addEventListener']('mouseleave',()=>{_0x302141['classList']['remove']('ck-user__marker_hovered');}),_0x302141;},_0x9691a1['isSimilar']=function(_0x24e87c){return!(!this['getCustomProperty']('userPositionMarker')||!_0x24e87c['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0x24e87c['getAttribute']('data-session-id'));},_0x9691a1;}(_0x28ceac,_0x9647db,_0x2ad089);}(_0x42d185,_0x18e9a6,_0x43ef3f,_0x1d3298)}),_0x1d3298['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0x5b11b4=>function(_0x1b1dea,_0x20fd2f){const _0x157104=_0x1b1dea['markerName']['split'](':')[0x2];if(_0x157104===_0x20fd2f['mySessionId'])return null;const _0xb836cf=_0x20fd2f['getUserBySessionId'](_0x157104);return _0xb836cf?{'id':_0x157104,'classes':['ck-user__selection',_0xb836cf['color']['getSelectionClass']()],'attributes':{'style':Q(_0xb836cf),'data-session-id':_0x157104},'priority':0x7d0+_0xb836cf['orderNumber']}:{'id':_0x157104,'classes':[]};}(_0x5b11b4,_0x43ef3f)}),function(_0x35be04){const _0x8c46ee=_0x35be04['model'],_0x179edc=new Map(),_0x244345=_0x35be04['plugins']['get'](Y);_0x8c46ee['markers']['on']('update:user:range',(_0x10ad79,_0x14e360,_0x3abdad,_0x4db69a)=>{if(!_0x4db69a&&_0x179edc['get'](_0x14e360['name']))return _0x179edc['get'](_0x14e360['name'])['detach'](),void _0x179edc['delete'](_0x14e360['name']);const _0xbd2f2d=_0x14e360['name']['split'](':')[0x2];if(_0xbd2f2d===_0x244345['mySessionId'])return;const _0x536730='user:position:'+_0xbd2f2d;_0x8c46ee['markers']['has'](_0x536730)&&_0x35be04['editing']['reconvertMarker'](_0x536730),_0x14e360['on']('change:range',(_0x31690e,_0x10517a,_0x1a73cf)=>{if('$graveyard'!=_0x10517a['root']['rootName']&&'$graveyard'==_0x14e360['getRange']()['root']['rootName']&&!_0x179edc['has'](_0x14e360['name'])){const _0x21f4bd=_0x8c46ee['schema']['getNearestSelectionRange'](_0x1a73cf['deletionPosition']);if(_0x21f4bd){const _0x2eb8df=_0x24134b['fromRange'](_0x21f4bd);_0x179edc['set'](_0x14e360['name'],_0x2eb8df),_0x2eb8df['on']('change:range',(_0x190aa8,_0x4eb6c5,_0xce1624)=>{if('$graveyard'==_0x2eb8df['root']['rootName']){const _0x2505fc=_0x8c46ee['schema']['getNearestSelectionRange'](_0xce1624['deletionPosition']);_0x2505fc?(_0x2eb8df['start']=_0x2505fc['start'],_0x2eb8df['end']=_0x2505fc['end']):(_0x179edc['delete'](_0x14e360['name']),_0x2eb8df['detach']());}});}}});}),_0x8c46ee['document']['on']('change',()=>{_0x179edc['size']>0x0&&_0x8c46ee['enqueueChange']({'isUndoable':!0x1},_0x53de8d=>{for(const [_0x225951,_0x549a26]of _0x179edc)'$graveyard'==_0x8c46ee['markers']['get'](_0x225951)['getRange']()['root']['rootName']&&(J(_0x225951['split'](':')[0x2],_0x549a26['toRange'](),_0x8c46ee,_0x53de8d),_0x549a26['detach']());_0x179edc['clear']();});});}(_0x1d3298),this['_domEmitter']['listenTo'](_0x36548f['document'],'keydown',(_0x109fe2,{key:_0x16a5e9})=>{'Escape'===_0x16a5e9&&function(_0x5829e4){_0x5829e4['editing']['view']['change'](_0x177ad7=>{for(const _0x394a61 of _0x5829e4['model']['markers']){if(!_0x394a61['name']['startsWith']('user:position'))continue;const _0x15ef84=_0x5829e4['editing']['mapper']['markerNameToElements'](_0x394a61['name']);if(_0x15ef84){for(const _0x19ea93 of _0x15ef84)_0x177ad7['removeClass']('ck-user__marker_hovered',_0x19ea93);}}});}(_0x1d3298);},{'useCapture':!0x0});}afterInit(){const _0x1af9f3=this['editor'],_0xb3c4b3=_0x1af9f3['commands']['get']('undo');_0xb3c4b3&&_0x1af9f3['model']['on']('applyOperation',(_0x1d3deb,_0x2a47da)=>{const _0x5fdb8b=_0x2a47da[0x0];if(!_0x5fdb8b['isDocumentOperation'])return;if('marker'!=_0x5fdb8b['type']||!_0x5fdb8b['name']['startsWith']('user:'))return;const _0x8a593e=_0x5fdb8b['batch'];_0xb3c4b3['_createdBatches']['has'](_0x8a593e)&&(_0x5fdb8b['newRange']=_0x5fdb8b['oldRange']?_0x1af9f3['model']['createRange'](_0x5fdb8b['oldRange']['start'],_0x5fdb8b['oldRange']['end']):null);},{'priority':'highest'});}destroy(){return this['_domEmitter']['stopListening'](),super['destroy']();}createUserMarkerOperations(){const _0x362273=this['editor'],_0x264eef=_0x362273['model']['document'],_0x20bfa4=_0x362273['plugins']['get'](Y);_0x362273['model']['enqueueChange']({'isUndoable':!0x1},_0x48e71=>{const _0x6377b5='user:range:'+_0x20bfa4['mySessionId'],_0x4233c3='user:position:'+_0x20bfa4['mySessionId'],_0x3c4899=_0x362273['model']['markers']['has'](_0x6377b5);_0x362273['editing']['view']['hasDomSelection']?J(_0x20bfa4['mySessionId'],_0x264eef['selection']['getFirstRange'](),_0x362273['model'],_0x48e71):_0x3c4899&&(_0x48e71['removeMarker'](_0x6377b5),_0x48e71['removeMarker'](_0x4233c3));});}};function J(_0x44b864,_0x225868,_0xfa5da3,_0x112fdc){const _0x5d369c='user:range:'+_0x44b864,_0x1d333a='user:position:'+_0x44b864,_0x39c0ed=_0x225868['getContainedElement']();let _0x5d65d6=_0x225868['start'];if(_0x39c0ed&&_0x39c0ed['is']('element','tableCell')){const _0x2ca99a=function(_0x47515c,_0x131ef3){for(const _0x5b52c4 of _0x47515c['getPositions']())if(_0x131ef3['schema']['checkChild'](_0x5b52c4,'$text'))return _0x5b52c4;}(_0x225868,_0xfa5da3);_0x2ca99a&&(_0x5d65d6=_0x2ca99a,_0x225868=_0x112fdc['createRange'](_0x5d65d6));}const _0x43cb60=_0x112fdc['createRange'](_0x5d65d6);_0xfa5da3['markers']['has'](_0x5d369c)?(_0x112fdc['updateMarker'](_0x5d369c,{'range':_0x225868}),_0x112fdc['updateMarker'](_0x1d333a,{'range':_0x43cb60})):(_0x112fdc['addMarker'](_0x5d369c,{'range':_0x225868,'usingOperation':!0x0}),_0x112fdc['addMarker'](_0x1d333a,{'range':_0x43cb60,'usingOperation':!0x0}));}function Q(_0x18ef32){return'--ck-user-color:'+_0x18ef32['color']['getColorVariable']()+';--ck-user-color-alpha:'+_0x18ef32['color']['getColorAlphaVariable']()+';';}function X(_0x4e516f,_0x17d5dd,_0x189c5a){const _0x157cd8=_0x4e516f['t'],t=_0x4e516f['t'];switch(_0x17d5dd){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 _0x157cd8({'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'},_0x189c5a);default:return'';}}let Z=0x1;var tt=class RealTimeCollaborationClient extends _0x21af15{static CollaborativeEditingService=/* #__PURE__ -- @preserve */
|
|
25
|
-
((()=>_0x2a85e0)());_offset;['sessionId'];serverHistory;['_channelId'];['_service'];_document;['_compressor'];_bufferedOperations;_knownOperations;_knownRootNames;_pendingAction;_hasSelectionChanged;_sendBufferedOperationsDelayId;['_baseBufferDelay'];_currentBufferDelay;_lastSyncedOperationId;_disconnectionOperations;_operationIdentifier;static get requires(){return[z,Y,K,_0x207a43,_0x420277,_0x5583e8];}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 _0x52f172=this['serverHistory']['getOperations']();for(let _0x17e0a2=_0x52f172['length']-0x1;_0x17e0a2>=0x0;_0x17e0a2--){const _0x15194f=_0x52f172[_0x17e0a2];if(!this['_disconnectionOperations']['has'](_0x15194f))return _0x15194f['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0x5a47be){if(super(_0x5a47be),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x22c837(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0x38aab5('collaboration-missing-channelid',this);const _0x302475=_0x5a47be['config']['get']('cloudServices.bundleVersion')||_0x27ff94;this['_service']=new RealTimeCollaborationClient['CollaborativeEditingService'](_0x302475,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0xc72a48(),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 it(this['_disconnectionOperations']);}init(){const _0x4cd04c=this['editor'],_0x4f4d8d=_0x4cd04c['plugins']['get'](_0x420277),_0x2408b1=_0x4cd04c['plugins']['get'](z);this['listenTo'](_0x4f4d8d,'getOperationAuthor',(_0x5235ac,_0x502c76)=>{const _0x27785d=_0x502c76[0x0];_0x27785d['_authorId']&&(_0x5235ac['return']=_0x4f4d8d['getUser'](_0x27785d['_authorId']),_0x5235ac['stop']()),null===_0x27785d['_authorId']&&(_0x5235ac['return']=null,_0x5235ac['stop']());},{'priority':'high'}),this['listenTo'](_0x4cd04c['model']['document']['selection'],'change:range',(_0x4b031a,_0x5a0974)=>{_0x5a0974['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x4cd04c['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x4cd04c['model']['on']('applyOperation',(_0x3594a0,_0x4a8ba0)=>{const _0x71dc9=_0x4a8ba0[0x0];_0x71dc9['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0x71dc9),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['set']('_isChannelFlushed',!0x1),this['bind']('_isEditingAllowed')['to'](_0x2408b1,'state',this,'_hasSynchronizationProblem',this,'_isChannelFlushed',(_0x4429cf,_0x4c76b8,_0x4aa4bf)=>'connected'===_0x4429cf&&!_0x4c76b8&&!_0x4aa4bf),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x4cd04c['disableReadOnlyMode']('rtc-offline'):_0x4cd04c['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x4cd04c['disableReadOnlyMode']('rtc-offline'):_0x4cd04c['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async reconnect(){const _0xd3d94c=this['editor']['plugins']['get'](Y),_0x2f2b86=this['editor']['plugins']['get'](z);try{this['_isPendingUpdate']=!0x0,_0xd3d94c['unregister'](this['_channelId']);const _0xd97154=await this['_service']['reconnect'](_0x2f2b86['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0xd97154)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0xa6d3e5=await this['_service']['getConnectedSessions']();_0xd3d94c['register'](this['_channelId'],_0xa6d3e5),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x311559){if(function(_0x3c7ce3){return'404'===_0x3c7ce3['code'];}(_0x311559)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0x1a6eac){return'409'===_0x1a6eac['code'];}(_0x311559)){const _0x4cc2a7=X(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'](_0x4cc2a7);}else{if(!(_0x311559 instanceof et))throw _0x311559;this['_handleReconnectionError']();}}}}destroy(){const _0x4b5dda=this['editor']['plugins']['get'](z),_0x451c7d=this['editor']['plugins']['get'](Y);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x451c7d['channelSessions']['has'](this['_channelId'])&&_0x451c7d['unregister'](this['_channelId']),_0x4b5dda['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async _handleReconnectionResponse(_0x10ea48){if(this['sessionId']!==_0x10ea48['sessionId']&&this['_lastSyncedOperationId']!==_0x10ea48['lastOperationId'])throw new et();return this['sessionId']=_0x10ea48['sessionId'],this['_handleServerResponse']([],{..._0x10ea48,'wereChangesApplied':!0x1,'data':_0x10ea48['data']},'reconnect');}async _connectService(_0x2db6aa,_0x66a36e=!0x1){const {connection:_0x5c415f}=this['editor']['plugins']['get'](z);RealTimeCollaborationClient['CollaborativeEditingService']['getConnectedSessions'](_0x5c415f,this['_channelId'])['then'](_0x152ce2=>this['_initSessionsHandling'](_0x152ce2))['catch'](_0x410512=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x410512);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x58d618,_0x5f46b3)=>{this['_crash']('realtimecollaborationclient-init-service-internal-error',_0x5f46b3);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_handleChannelDisconnected']();});const _0x343385=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x2db6aa);this['_isPendingUpdate']=!0x0;const _0x5c1cd4=await this['_service']['connect'](_0x5c415f,this['_compressOperations'](_0x2db6aa),_0x343385);if(this['sessionId']=_0x5c1cd4['sessionId'],_0x66a36e){if(!_0x5c1cd4['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x5c1cd4['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0x2db6aa,_0x5c1cd4,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x5c1cd4,_0x2db6aa);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}_handleSendingSelectionMarkers(){const _0x41a4fd=this['editor']['plugins']['get'](Y),_0x2d7fa0=this['editor']['plugins']['get'](K),_0xc2cc66=_0x41a4fd['channelSessions']['get'](this['_channelId']);_0xc2cc66&&_0xc2cc66['length']>0x1?_0x2d7fa0['createUserMarkerOperations']():this['listenTo'](_0x41a4fd,'sessionAdd:'+this['_channelId'],()=>{0x2===_0x41a4fd['channelSessions']['get'](this['_channelId'])['length']&&_0x2d7fa0['createUserMarkerOperations']();});}async _handleReceivedOperations(_0x4ea3a1,_0x26a12a,_0x2d8e2c,_0x54d24f){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x26a12a){const _0x4da83e=this['_decompressOperations'](_0x2d8e2c,_0x54d24f);await this['_fetchMissingUsers'](_0x4da83e),this['_handleExternalOperations'](_0x4da83e,_0x26a12a,_0x2d8e2c['lastOperationId'])||this['_crash']('realtimecollaborationclient-init-service-incorrect-server-operation');}}async _connectAfterSessionHasBeenFlushed(){this['_disconnectService']();const {locale:_0x2e7da6}=this['editor'];let _0x479d49;try{_0x479d49=await this['_service']['getDocumentDetails']();}catch{const _0x212a05=X(_0x2e7da6,'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'](_0x212a05);}const _0x1b1b66=_0x479d49['currentDocumentSession']||_0x479d49['lastDocumentSession'];if(this['_lastSyncedOperationId']!==_0x1b1b66['lastOperationId']){const _0x360370=X(_0x2e7da6,'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'](_0x360370);}await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);}_handleChannelDisconnected(){const _0x412282=this['editor']['plugins']['get'](z);if(this['_isConnected']=!0x1,!_0x412282['connection']||'connected'!==_0x412282['connection']['state'])return;this['_isChannelFlushed']=!0x0;const _0xd6c584=this['editor']['plugins']['get'](Y);_0xd6c584['channelSessions']['has'](this['_channelId'])&&_0xd6c584['unregister'](this['_channelId']),_0x412282['removeFromReconnectionStack'](this),this['_disconnectService']();}_disconnectService(){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['stopListening'](this['_service']);}_initSessionsHandling(_0x7b9ce5){const _0x219e95=this['editor']['plugins']['get'](Y);this['listenTo'](_0x219e95,'sessionAdd:'+this['_channelId'],(_0x1abce2,{session:_0x58fa81})=>{if(_0x58fa81['id']===_0x219e95['mySessionId']){_0x1abce2['off']();const _0x51e50f=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0x3d0595=_0x58fa81['permissions'];_0x51e50f&&_0x51e50f['isEnabled']&&(_0x3d0595=_0x3d0595['filter'](_0x7077ef=>'document:write'!==_0x7077ef)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0x3d0595,this['_channelId']);}}),_0x219e95['register'](this['_channelId'],_0x7b9ce5);}_initThrowingOnDataSet(){const _0x57418c=this['editor']['data']['set'];this['editor']['data']['set']=(..._0x3b0cb6)=>{if(!_0x3b0cb6[_0x3b0cb6['length']-0x1]['suppressErrorInCollaboration'])throw new _0x38aab5('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x57418c['apply'](this['editor']['data'],_0x3b0cb6);};}_setUpDataInit(){this['editor']['data']['on']('init',(_0x2430ab,[_0x16078d])=>{if(this['_document']['version'])throw new _0x38aab5('realtimecollaborationclient-init-document-already-initialized',this);_0x2430ab['stop'](),this['_setPendingAction']();const _0x1e9cec=Object['fromEntries'](Object['entries'](this['editor']['config']['get']('roots')||{})['filter'](([,_0x191b89])=>!_0x191b89['lazyLoad'])['map'](([_0x296278,_0x492c37])=>[_0x296278,_0x492c37['modelAttributes']||{}])),_0x1cb28b=this['_getOperationsFromInitData'](_0x16078d,_0x1e9cec);0x0==_0x1cb28b['length']&&_0x1cb28b['push'](new _0x4b402e(0x0)),_0x2430ab['return']=this['_connectService'](_0x1cb28b)['then'](()=>{this['editor']['plugins']['get'](z)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x59532e=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x59532e))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x35a710,[_0x306c92,_0xf24cc4])=>{_0x35a710['stop']();const _0x182807=this['editor']['model']['document']['getRoot'](_0x306c92);if(!this['_knownRootNames']['has'](_0x306c92)){const _0x3e7e4d=_0xf24cc4&&_0xf24cc4['data']?_0xf24cc4['data']:'',_0x268d46=_0xf24cc4&&_0xf24cc4['attributes']?_0xf24cc4['attributes']:{};await this['_loadRoot'](_0x306c92,_0x3e7e4d,_0x268d46);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0x182807['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0x182807);});},{'priority':'high'});}async _fetchMissingUsers(_0x2d403a){const _0x5e5ab3=this['editor']['plugins']['get'](_0x420277),{connection:_0x21c7af}=this['editor']['plugins']['get'](z),_0x4c8045=new Set();for(const _0x459207 of _0x2d403a){const _0x2e6a33=_0x459207['_authorId'];_0x2e6a33&&!_0x5e5ab3['getUser'](_0x2e6a33)&&_0x4c8045['add'](_0x2e6a33);}if(0x0===_0x4c8045['size'])return;const _0x320887=await _0x5a3b8a['getMany'](_0x21c7af,Array['from'](_0x4c8045));for(const _0x24187b of _0x320887)_0x5e5ab3['getUser'](_0x24187b['id'])||_0x5e5ab3['addUser'](_0x24187b);}_getOperationsFromInitData(_0x41f686,_0x2de9b6={}){const _0x62ff38=this['editor']['model'],_0x4a4037=[];let _0x53289e=0x0;const _0x33d892='string'==typeof _0x41f686?{'main':_0x41f686}:_0x41f686;for(const _0x436071 of Object['keys'](_0x33d892)){if(!this['_document']['roots']['has'](_0x436071))throw new _0x38aab5('realtimecollaborationclient-init-non-existent-root',this);const _0x37d12f=this['_document']['getRoot'](_0x436071),_0x17ddfb=this['editor']['data']['parse'](_0x33d892[_0x436071],_0x37d12f),_0x545736=new _0x5a75e7(_0x62ff38['createPositionAt'](_0x37d12f,0x0),_0x17ddfb,_0x53289e++);_0x4a4037['push'](_0x545736);for(const [_0x7dfa38,_0x4476ca]of _0x17ddfb['markers']){const _0x5a45f1=_0x62ff38['createRange'](_0x62ff38['createPositionFromPath'](_0x37d12f,_0x4476ca['start']['path']['slice']()),_0x62ff38['createPositionFromPath'](_0x37d12f,_0x4476ca['end']['path']['slice']())),_0x11dbf0=new _0x50dede(_0x7dfa38,null,_0x5a45f1,_0x62ff38['markers'],!0x0,_0x53289e++);_0x4a4037['push'](_0x11dbf0);}}if(_0x2de9b6)for(const [_0x37d541,_0x1ec359]of Object['entries'](_0x2de9b6)){const _0x5a55bb=_0x62ff38['document']['getRoot'](_0x37d541);if(!_0x5a55bb)throw new _0x38aab5('multi-root-editor-root-attributes-no-root',null);for(const [_0x170691,_0x49dd71]of Object['entries'](_0x1ec359))if(null!==_0x49dd71){const _0x29cb4b=new _0x2843de(_0x5a55bb,_0x170691,null,_0x49dd71,_0x53289e++);_0x4a4037['push'](_0x29cb4b);}}return _0x4a4037;}async _loadRoot(_0x42af15,_0x33a90f,_0x4e6878){this['_getOperationsFromInitData']({[_0x42af15]:_0x33a90f},{[_0x42af15]:_0x4e6878})['forEach']((_0x1165e1,_0x3926b6)=>{_0x1165e1['baseVersion']=this['_document']['version']+_0x3926b6,_0x1165e1['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x1165e1);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async _handleInitialConnectionData(_0x335c95,_0x2f922d){let _0x382f41;this['_offset']=_0x335c95['offset'];const _0x1df082=_0x335c95['wereChangesApplied']&&!_0x335c95['initData'],_0x33f08a=_0x1df082?0x0:_0x335c95['data']['baseVersion'];if(_0x2f922d['forEach'](_0x433143=>{_0x433143['_isInit']=!0x0,_0x433143['createdAt']=_0x335c95['sessionCreatedAt'],_0x433143['_authorId']=null;}),_0x1df082)_0x382f41=_0x2f922d,this['_applyOperationsSet'](_0x382f41,_0x1df082);else{if(_0x335c95['initData']){const _0xd5063a=this['_getOperationsFromInitData'](_0x335c95['initData']);this['_document']['history']['version']=-_0xd5063a['length'],_0xd5063a['forEach'](_0x10813d=>{_0x10813d['baseVersion']-=_0xd5063a['length'],_0x10813d['createdAt']=_0x335c95['sessionCreatedAt'],_0x10813d['_isInit']=!0x0,_0x10813d['_authorId']=null;}),this['_applyOperationsSet'](_0xd5063a,!0x0),this['serverHistory']['version']=-_0xd5063a['length']+this['_offset'],this['_updateServerHistory'](_0xd5063a);}this['_document']['history']['version']=_0x33f08a,_0x382f41=this['_decompressOperations'](_0x335c95['data'],_0x335c95['metadata']),await this['_fetchMissingUsers'](_0x382f41),this['_applyOperationsSet'](_0x382f41,_0x1df082);}_0x335c95['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x382f41,_0x335c95['lastOperationId']),this['_lastSyncedOperationId']=_0x335c95['lastOperationId']),this['serverHistory']['version']=_0x33f08a+this['_offset'],this['_updateServerHistory'](_0x382f41),_0x2f922d['filter'](_0x4bef02=>{const _0x5535ec=this['_getAffectedRoot'](_0x4bef02);return _0x5535ec&&!this['_knownRootNames']['has'](_0x5535ec);})['forEach']((_0x22badc,_0x440303)=>{_0x22badc['baseVersion']=this['_document']['version']+_0x440303,this['_saveOperationInBuffer'](_0x22badc);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x2409a4,_0x5a0165){const _0x281710=_0x5a0165&&_0x5a0165['message'];if(_0x281710&&_0x281710['startsWith']('realtimecollaborationclient'))throw _0x5a0165;const _0x15154d=this['editor']['plugins']['get'](z);throw this['_isPendingUpdate']=!0x0,_0x15154d['disconnect'](),this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0x38aab5(_0x2409a4,this['editor'],_0x281710?{'originalError':_0x281710}:void 0x0);}_saveOperationInBuffer(_0x5842eb){this['_knownOperations']['has'](_0x5842eb)||(this['_knownOperations']['add'](_0x5842eb),this['_bufferedOperations']['push'](_0x5842eb),this['_pendingAction']||'marker'==_0x5842eb['type']&&!_0x5842eb['affectsData']||this['_setPendingAction']());}_sendBufferedOperationsDelayed(_0x1afb67=!0x1){!_0x1afb67&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0x2f59ca=>{_0x2f59ca&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0x590954=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0x404ae8){return _0x404ae8['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x404ae8['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0x404ae8['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0x590954)||this['_crash'](_0x590954['message'],_0x590954);});},this['_currentBufferDelay']));}_waitUntilSynced(){return new Promise(_0xb780c7=>{this['on']('change:_isPendingUpdate',()=>{_0xb780c7();});});}async _sendBufferedOperations(){const _0x3a32b5=this['editor']['plugins']['get'](K);if(this['_shouldSendSelectionUpdate']()&&(_0x3a32b5['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x2b0255=[...this['_bufferedOperations']];for(const _0x3bd2d9 of _0x2b0255)_0x3bd2d9['wasUndone']=this['_document']['history']['isUndoneOperation'](_0x3bd2d9);const _0x177203=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x2b0255),_0x137930=Z++,_0x212588=this['_compressOperations'](_0x2b0255),_0x97e5a1=await this['_service']['sendOperations'](_0x212588,_0x212588['baseVersion'],_0x177203);try{return await this['_handleServerResponse'](_0x2b0255,_0x97e5a1,_0x137930);}catch(_0x3c97a9){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0x3c97a9);}}async['_handleServerResponse'](_0x3c3256,_0x3ac59e,_0x361906){if('error'in _0x3ac59e)throw _0x3ac59e['error'];let _0x669607;if(_0x3ac59e['wereChangesApplied']){_0x3ac59e['lastOperationId']&&(this['_lastSyncedOperationId']=_0x3ac59e['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x1ee5e3=>!_0x3c3256['includes'](_0x1ee5e3));for(const _0x4a38eb of _0x3c3256)_0x4a38eb['createdAt']='lastOperationAcceptedAt'in _0x3ac59e&&_0x3ac59e['lastOperationAcceptedAt']||void 0x0;st(_0x3c3256,_0x3ac59e['version']-_0x3c3256['length']),this['_updateServerHistory'](_0x3c3256);const _0x2335c0=_0x3c3256['filter'](_0x2626a9=>{if(!_0x2626a9['_isInit'])return!0x1;const _0x496e2d=this['_getAffectedRoot'](_0x2626a9);return _0x496e2d&&!this['_knownRootNames']['has'](_0x496e2d);});st(_0x2335c0,this['_document']['version']),this['_applyOperationsSet'](_0x2335c0),_0x669607=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0x3c411e=this['_decompressOperations'](_0x3ac59e['data'],_0x3ac59e['metadata'])['filter'](_0x2f128f=>_0x2f128f['baseVersion']>=this['_lastServerVersion']);_0x3c411e['forEach'](_0x471888=>this['_addKnownRoot'](_0x471888)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x294dd5=>!_0x294dd5['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x294dd5))),this['_bufferedOperations']['length']&&st(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0x3c411e),_0x669607=this['_handleExternalOperations'](_0x3c411e,_0x3ac59e['version'],_0x3ac59e['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x669607?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}_handleExternalOperations(_0x3af489,_0x2c7519,_0x3aa096){try{const _0x7b7264={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x2dc07e,operationsB:_0x259c3c,originalOperations:_0x2aa12a}=_0x30557d(_0x3af489,this['_bufferedOperations'],_0x7b7264);st(_0x2dc07e,this['_document']['version']),st(_0x259c3c,_0x2c7519);for(const _0x70dc14 of _0x2dc07e){const _0x190335=_0x2aa12a['get'](_0x70dc14);_0x190335?(_0x70dc14['_authorId']=_0x190335['_authorId'],'noop'!==_0x70dc14['type']&&(_0x70dc14['_aiSource']=_0x190335['_aiSource'])):_0x70dc14['_authorId']=null;}for(const _0x502218 of _0x259c3c)'noop'!==_0x502218['type']&&(_0x502218['_aiSource']=_0x2aa12a['get'](_0x502218)?.['_aiSource']);_0x3aa096&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x3af489,_0x3aa096),this['_lastSyncedOperationId']=_0x3aa096),this['_bufferedOperations']=[..._0x259c3c],this['_applyOperationsSet'](_0x2dc07e),this['_updateServerHistory'](_0x3af489);}catch(_0xe3d7cb){return console['error'](_0xe3d7cb),!0x1;}return!0x0;}_applyOperationsSet(_0xe66027,_0x47249e=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0x234c67=>{for(const _0x114c8b of _0xe66027)this['_knownOperations']['add'](_0x114c8b),this['_addKnownRoot'](_0x114c8b),_0x234c67['batch']['addOperation'](_0x114c8b),this['editor']['model']['applyOperation'](_0x114c8b);});}_addKnownRoot(_0x5f3369){const _0x2d6e0c=this['_getAffectedRoot'](_0x5f3369);_0x2d6e0c&&this['_knownRootNames']['add'](_0x2d6e0c);}_getAffectedRoot(_0x4dc493){let _0x16a90a,_0x112a8b;switch(_0x4dc493['type']){case'insert':_0x16a90a=_0x4dc493['position']['root'];break;case'marker':if(_0x112a8b=_0x4dc493['newRange'],!_0x112a8b)return null;_0x16a90a=_0x112a8b['root'];break;case'addRootAttribute':_0x16a90a=_0x4dc493['root'];break;case'addRoot':_0x16a90a=_0x4dc493['affectedSelectable'];break;case'move':_0x16a90a=_0x4dc493['targetPosition']['root'];break;default:return null;}return _0x16a90a['rootName'];}_updateServerHistory(_0x51572a){_0x51572a['forEach'](_0x21b6ba=>{const _0x48017e=_0x21b6ba['clone']();_0x48017e['_authorId']=_0x21b6ba['_authorId'],_0x48017e['_isInit']=!!_0x21b6ba['_isInit'],_0x48017e['_aiSource']=_0x21b6ba['_aiSource'],_0x48017e['createdAt']=_0x21b6ba['createdAt'],_0x48017e['baseVersion']+=this['_offset'],_0x21b6ba['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x48017e),this['serverHistory']['addOperation'](_0x48017e);});}_handleReconnectionError(_0x19969d){const _0x63e85f=this['editor']['plugins']['get']('Notification'),_0x292dd8=this['editor']['locale'];_0x19969d||(_0x19969d=X(_0x292dd8,'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.')),_0x63e85f['showWarning'](_0x19969d,{'title':X(_0x292dd8,'Synchronization\x20issue'),'namespace':'real-time-collaboration'}),this['_hasSynchronizationProblem']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_bufferedOperations']=[],this['editor']['plugins']['get'](z)['disconnect']();}_setPendingAction(){this['_pendingAction']||(this['_pendingAction']=this['editor']['plugins']['get'](_0x207a43)['add'](X(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}_clearPendingAction(){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x207a43)['remove'](this['_pendingAction']),this['_pendingAction']=null);}_compressOperations(_0x7ad047){const _0x3f6a27=_0x7ad047['map'](_0x2d7174=>_0x2d7174['toJSON']());return this['_compressor']['compress'](_0x3f6a27);}_decompressOperations(_0x402aba,_0x57cb75){return this['_compressor']['decompress'](_0x402aba)['map']((_0x7a7589,_0x3b508a)=>{const _0x5d1f47='init'==_0x57cb75[_0x3b508a]['type'];if('InsertOperation'==_0x7a7589['__className']){const _0x4d3213=_0x7a7589['position']['root'];!this['_document']['getRoot'](_0x4d3213)&&(this['_document']['createRoot']('$unknown',_0x4d3213)['_isAttached']=!0x1);}else{if('RootOperation'==_0x7a7589['__className']){const _0xc330d2=this['_document']['getRoot'](_0x7a7589['rootName']);_0xc330d2&&'$unknown'==_0xc330d2['name']&&_0x7a7589['elementName']!=_0xc330d2['name']&&(_0xc330d2['name']=_0x7a7589['elementName']);}}const _0x240802=_0x2f6bf1['fromJSON'](_0x7a7589,this['_document']);return _0x240802['wasUndone']=_0x7a7589['wasUndone'],_0x240802['_isInit']=_0x5d1f47,_0x240802['_authorId']=_0x5d1f47?null:_0x57cb75[_0x3b508a]['userId'],_0x240802['_isDisconnection']='cs:removeUser'===_0x57cb75[_0x3b508a]['type'],_0x240802['_aiSource']=_0x7a7589['_aiSource']||void 0x0,_0x240802['createdAt']=_0x57cb75[_0x3b508a]['createdAt'],_0x240802;});}_refreshUserSelectionMarkers(){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}_shouldSendSelectionUpdate(){const _0x3a1b4c=this['editor']['plugins']['get'](Y)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0x3a1b4c&&_0x3a1b4c['length']>0x1&&this['_hasSelectionChanged'];}_shouldSendUpdate(){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}},et=class extends Error{};function st(_0x1512d2,_0x20f605){for(const _0x5d80cc of _0x1512d2)_0x5d80cc['baseVersion']=_0x20f605++;}var it=class{_ignoredOperations;_operationToId;constructor(_0x1bf095){this['_ignoredOperations']=_0x1bf095,this['_operationToId']=new WeakMap();}getIdOfTheLastOperation(_0x4ff326){let _0x4c83ee=_0x4ff326['length'];for(;_0x4c83ee--;){const _0x372665=_0x4ff326[_0x4c83ee];if(!this['_ignoredOperations']['has'](_0x372665)){if(!this['_operationToId']['has'](_0x372665)){const _0x2ab6b5=_0x36bd39()['slice'](0x1,0x12);this['_operationToId']['set'](_0x372665,_0x2ab6b5);}return this['_operationToId']['get'](_0x372665);}}}setIdForTheLastOperation(_0x39896c,_0x341e47){if(!_0x341e47)return;let _0x3aa2be=_0x39896c['length'];for(;_0x3aa2be--;){const _0x2aecb3=_0x39896c[_0x3aa2be];this['_ignoredOperations']['has'](_0x2aecb3)||this['_operationToId']['set'](_0x2aecb3,_0x341e47);}}},nt=class extends _0x21af15{static get requires(){return[tt];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},ot=class CloudServicesCommentsAdapter extends _0x473f2b{static CommentsService=/* #__PURE__ -- @preserve */
|
|
26
|
-
((()=>_0x889501)());['_services'];static get requires(){return[z,_0x473dd8,Y,_0x420277];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x110aa1){super(_0x110aa1),this['_services']=new Map();}async init(){const _0x5ab111=this['context'],_0x59f2c1=_0x5ab111['plugins']['get'](_0x473dd8);if(_0x5ab111['plugins']['get'](z)['addToReconnectionStack'](this),_0x59f2c1['adapter']={'addCommentThread':async({channelId:_0xa8c3e7,threadId:_0x25283a,comments:_0x2e14eb,resolvedAt:_0x595c7f,resolvedBy:_0x3a7cde,context:_0x851e71,attributes:_0x544628})=>{const _0x5f452e=await this['_getService'](_0xa8c3e7)['addCommentThread']({'commentThreadId':_0x25283a,'comments':_0x2e14eb['map'](_0x40f9e9=>function(_0x2ec41f,_0x185c2b,_0x2c89b6){return{'commentThreadId':_0x2c89b6,'commentId':_0x2ec41f['commentId'],'userId':_0x2ec41f['authorId'],'content':_0x2ec41f['content'],'documentId':_0x185c2b,'createdAt':_0x2ec41f['createdAt'],'attributes':_0x2ec41f['attributes']||{}};}(_0x40f9e9,_0xa8c3e7,_0x25283a)),'resolvedAt':_0x595c7f,'resolvedBy':_0x3a7cde,'context':_0x851e71,'attributes':_0x544628})['catch'](ct);return{'threadId':_0x5f452e['commentThreadId'],'comments':_0x5f452e['comments']};},'getCommentThread':async({channelId:_0x2853dc,threadId:_0x3e4eb8})=>{const _0x54322=await this['_getService'](_0x2853dc)['getCommentThread'](_0x3e4eb8)['catch'](rt)['catch'](ct);return _0x54322?_0x54322['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0x54322]),{'threadId':_0x54322['commentThreadId'],'comments':_0x54322['comments']['map'](at),'context':_0x54322['context'],'resolvedAt':_0x54322['resolvedAt'],'resolvedBy':_0x54322['resolvedBy'],'attributes':_0x54322['attributes']||{}}):null;},'updateCommentThread':async({channelId:_0x3f3009,threadId:_0x1f4ca9,context:_0x3e2dbc,unlinkedAt:_0x5b879d,attributes:_0x6bc408})=>this['_getService'](_0x3f3009)['updateCommentThread']({'commentThreadId':_0x1f4ca9,'context':_0x3e2dbc,'attributes':_0x6bc408,'unlinkedAt':_0x5b879d})['catch'](rt)['catch'](ct),'resolveCommentThread':async({channelId:_0x4de40f,threadId:_0x4f7844})=>{const _0x556888=await this['_getService'](_0x4de40f)['resolveCommentThread'](_0x4f7844)['catch'](rt)['catch'](ct);return{'threadId':_0x556888['commentThreadId'],'resolvedAt':_0x556888['resolvedAt'],'resolvedBy':_0x556888['resolvedBy']};},'reopenCommentThread':async({channelId:_0x2385b2,threadId:_0x281210})=>this['_getService'](_0x2385b2)['reopenCommentThread'](_0x281210)['catch'](rt)['catch'](ct),'removeCommentThread':({channelId:_0x2ace65,threadId:_0x3db73a})=>this['_getService'](_0x2ace65)['removeCommentThread'](_0x3db73a)['catch'](rt)['catch'](ct),'addComment':({channelId:_0x24f277,threadId:_0x570eb9,commentId:_0x5a94a9,content:_0x387238,attributes:_0x3bd28a})=>this['_getService'](_0x24f277)['addComment'](_0x570eb9,_0x5a94a9,_0x387238,_0x3bd28a)['catch'](ct),'updateComment':({channelId:_0x3698c5,threadId:_0x160654,commentId:_0x59b5df,content:_0x39c348,attributes:_0x11acd7})=>this['_getService'](_0x3698c5)['updateComment'](_0x160654,_0x59b5df,_0x39c348,_0x11acd7)['catch'](rt)['catch'](ct),'removeComment':({channelId:_0x5accab,threadId:_0x20d32,commentId:_0x25208e})=>this['_getService'](_0x5accab)['removeComment'](_0x20d32,_0x25208e)['catch'](rt)['catch'](ct)},_0x5ab111 instanceof _0x50a871){const _0x383558=_0x5ab111['config']['get']('collaboration.channelId'),_0x5be30e=_0x5ab111['plugins']['get'](Y);await this['_setUpService'](_0x383558);const _0x312ffc=await this['_services']['get'](_0x383558)['getConnectedSessions']();this['listenTo'](_0x5be30e,'sessionAdd:'+_0x383558,(_0x20bb4e,{session:_0x2a91d2})=>{_0x2a91d2['id']===_0x5be30e['mySessionId']&&(_0x20bb4e['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x2a91d2['permissions'],_0x383558));}),_0x5be30e['register'](_0x383558,_0x312ffc);}}async _setUpService(_0x10c671){if(this['_services']['has'](_0x10c671))throw new _0x38aab5('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0x10c671});const _0x2cdbfb=this['context']['plugins']['get'](_0x473dd8),_0x56d964=new CloudServicesCommentsAdapter['CommentsService'](_0x10c671);this['_services']['set'](_0x10c671,_0x56d964),this['listenTo'](_0x56d964,'commentThreadAdded',(_0x1c5446,_0x44f372)=>{const {commentThreadId:_0x37451e,documentId:_0x438093,context:_0x3360af,attributes:_0x143605,resolvedAt:_0x1487ef,resolvedBy:_0x909c8a,comments:_0x137616}=_0x44f372;_0x2cdbfb['getCommentThread'](_0x37451e)||_0x2cdbfb['addCommentThread']({'threadId':_0x37451e,'channelId':_0x438093,'comments':_0x137616?_0x137616['map'](at):[],'context':_0x3360af,'attributes':_0x143605,'resolvedAt':_0x1487ef,'resolvedBy':_0x909c8a,'isFromAdapter':!0x0});}),this['listenTo'](_0x56d964,'commentThreadUpdated',(_0x56f298,{commentThreadId:_0x4eb95b,documentId:_0x4b484c,context:_0x14c24a,unlinkedAt:_0x110305,attributes:_0x4c086a})=>{_0x2cdbfb['getCommentThread'](_0x4eb95b)&&_0x2cdbfb['updateCommentThread']({'threadId':_0x4eb95b,'channelId':_0x4b484c,'context':_0x14c24a,'unlinkedAt':_0x110305,'attributes':_0x4c086a,'isFromAdapter':!0x0});}),this['listenTo'](_0x56d964,'commentThreadResolved',(_0x4ddaac,{commentThreadId:_0x302427,resolvedBy:_0x54a3b1,resolvedAt:_0x33cc10})=>{const _0x3468f1=_0x2cdbfb['getCommentThread'](_0x302427);_0x3468f1&&_0x3468f1['resolve']({'resolvedBy':_0x54a3b1,'resolvedAt':_0x33cc10,'isFromAdapter':!0x0});}),this['listenTo'](_0x56d964,'commentThreadReopened',(_0xa60c48,{commentThreadId:_0x1caa31})=>{const _0x1726b9=_0x2cdbfb['getCommentThread'](_0x1caa31);_0x1726b9&&_0x1726b9['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0x56d964,'commentThreadRemoved',(_0x1b96bc,{commentThreadId:_0x62bf4d})=>{const _0x59ab5c=_0x2cdbfb['getCommentThread'](_0x62bf4d);_0x59ab5c&&_0x59ab5c['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0x56d964,'commentAdded',(_0x37aba1,_0x1ef08a)=>{const _0x30af03=_0x1ef08a['commentThreadId'],_0x17b50c=_0x2cdbfb['getCommentThread'](_0x30af03);_0x17b50c&&_0x17b50c['addComment']({...at(_0x1ef08a),'isFromAdapter':!0x0});}),this['listenTo'](_0x56d964,'commentUpdated',(_0x34e4cf,{commentThreadId:_0x1780d4,commentId:_0x1b177b,content:_0x224e37,attributes:_0x5ba3f6})=>{const _0x334571=_0x2cdbfb['getCommentThread'](_0x1780d4);if(_0x334571){const _0x210f24=_0x334571['getComment'](_0x1b177b);_0x210f24&&_0x210f24['update']({'content':_0x224e37,'attributes':_0x5ba3f6,'isFromAdapter':!0x0});}}),this['listenTo'](_0x56d964,'commentRemoved',(_0x5e6d41,{commentThreadId:_0x527cf8,commentId:_0x2ee90b})=>{const _0x121dfa=_0x2cdbfb['getCommentThread'](_0x527cf8);if(_0x121dfa){const _0x212eb6=_0x121dfa['getComment'](_0x2ee90b);_0x212eb6&&_0x212eb6['remove']({'isFromAdapter':!0x0});}}),this['listenTo'](_0x56d964,'disconnected',()=>{'connected'===this['context']['plugins']['get'](z)['connection']?.['state']&&(this['_services']['delete'](_0x10c671),this['stopListening'](_0x56d964));}),await this['_connectService'](_0x10c671);}destroy(){if(this['context']instanceof _0x50a871){const _0x936c9f=this['context']['config']['get']('collaboration.channelId');this['_services']['has'](_0x936c9f)&&this['_terminateService'](_0x936c9f);}}_terminateService(_0x4875d0){if(!this['_services']['has'](_0x4875d0))throw new _0x38aab5('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0x4875d0});this['_getService'](_0x4875d0)['disconnect'](),this['_services']['delete'](_0x4875d0);}async reconnect(){for(const _0x4bf1c3 of this['_services']['keys']())await this['_connectService'](_0x4bf1c3);if(this['context']instanceof _0x50a871){const _0xcead5f=this['context']['config']['get']('collaboration.channelId');if(this['_services']['has'](_0xcead5f)){const _0x37c8b2=this['context']['plugins']['get'](Y);_0x37c8b2['unregister'](_0xcead5f);const _0x5a7a5f=await this['_services']['get'](_0xcead5f)['getConnectedSessions']();_0x37c8b2['register'](_0xcead5f,_0x5a7a5f);}}}async _connectService(_0x5dd404){const {connection:_0x5e4046}=this['context']['plugins']['get'](z),_0x306030=this['context']['plugins']['get'](_0x473dd8),_0x2c4eea=await this['_services']['get'](_0x5dd404)['connect'](_0x5e4046);await this['_fetchMissingUsersForThreads'](_0x2c4eea);const _0x49608a=new Set(Array['from'](_0x306030['getCommentThreads']({'channelId':_0x5dd404}),_0x51e1c7=>_0x51e1c7['id']));for(const _0x5cdf0a of _0x2c4eea)_0x5cdf0a['deletedAt']||_0x49608a['delete'](_0x5cdf0a['commentThreadId']);for(const _0x372ceb of _0x49608a)_0x306030['getCommentThread'](_0x372ceb)['remove']({'isFromAdapter':!0x0});for(const _0x389b44 of _0x2c4eea){let _0x41953f=_0x306030['getCommentThread'](_0x389b44['commentThreadId']);const {commentThreadId:_0x205876,context:_0x23abba,attributes:_0x43ecb7,resolvedBy:_0xcdbc72,resolvedAt:_0x4b6a72,unlinkedAt:_0x432f79,deletedAt:_0x418b10}=_0x389b44;if(_0x418b10)continue;_0x41953f||(_0x41953f=_0x306030['addCommentThread']({'channelId':_0x5dd404,'threadId':_0x205876,'context':_0x23abba,'attributes':_0x43ecb7||{},'resolvedBy':_0xcdbc72,'resolvedAt':_0x4b6a72,'unlinkedAt':_0x432f79,'isFromAdapter':!0x0}));const _0x4b04f8=new Set(Array['from'](_0x41953f['comments'],_0x33a19f=>_0x33a19f['id']));for(const _0x1972c7 of _0x389b44['comments'])_0x4b04f8['delete'](_0x1972c7['commentId']);for(const _0x130474 of _0x4b04f8)_0x41953f['getComment'](_0x130474)['remove']({'isFromAdapter':!0x0});for(const _0xfc5a27 of _0x389b44['comments']){const _0x12771f=_0x41953f['getComment'](_0xfc5a27['commentId']);_0x12771f?_0x12771f['content']!==_0xfc5a27['content']&&_0x12771f['update']({'content':_0xfc5a27['content'],'isFromAdapter':!0x0}):_0x41953f['addComment'](Object['assign'](at(_0xfc5a27),{'isFromAdapter':!0x0}));}}}_getService(_0x4a52c3){if(!this['_services']['has'](_0x4a52c3))throw new _0x38aab5('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0x4a52c3});return this['_services']['get'](_0x4a52c3);}async _fetchMissingUsersForThreads(_0x301a86){const _0x411267=this['context']['plugins']['get'](_0x420277),{connection:_0x432207}=this['context']['plugins']['get'](z),_0x2b84ea=new Set();for(const {resolvedBy:_0x3a3d2f,comments:_0x4b5c19}of _0x301a86){_0x3a3d2f&&!_0x411267['getUser'](_0x3a3d2f)&&_0x2b84ea['add'](_0x3a3d2f);for(const {userId:_0x489c98}of _0x4b5c19)_0x411267['getUser'](_0x489c98)||_0x2b84ea['add'](_0x489c98);}if(0x0===_0x2b84ea['size'])return;const _0xfaae88=await _0x5a3b8a['getMany'](_0x432207,Array['from'](_0x2b84ea));for(const _0x21c011 of _0xfaae88)_0x411267['getUser'](_0x21c011['id'])||_0x411267['addUser'](_0x21c011);}};async function rt(_0x53696a){if('404'!==_0x53696a['code'])throw _0x53696a;}function ct(_0x4800a9){if((_0x2a2fdc=_0x4800a9)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0x2a2fdc['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x2a2fdc['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0x2a2fdc;throw _0x4800a9;}function at(_0x2a50aa){return{'threadId':_0x2a50aa['commentThreadId'],'commentId':_0x2a50aa['commentId'],'content':_0x2a50aa['content'],'createdAt':_0x2a50aa['createdAt'],'authorId':_0x2a50aa['userId'],'attributes':_0x2a50aa['attributes']||{}};}var ht=class CloudServicesTrackChangesAdapter extends _0x21af15{static ['TrackChangesService']=/* #__PURE__ -- @preserve */
|
|
27
|
-
((()=>
|
|
28
|
-
((()=>_0x53cda)());_lastRequestId;['_revisionTracker'];_revisionHistoryService;_oldOffset;static get requires(){return[z,tt,_0x396e5d,Y,_0x420277];}static get['pluginName'](){return'CloudServicesRevisionHistoryAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x3a1587){super(_0x3a1587);const _0x522a09=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new CloudServicesRevisionHistoryAdapter['RevisionHistoryService'](_0x522a09);}async init(){const _0x5bc0f0=this['editor']['plugins']['get'](tt),_0x3e7242=_0x5bc0f0['serverHistory'],_0x2071b8=this['editor']['plugins']['get'](z);this['_revisionTracker']['setSource']({'history':_0x3e7242,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0x5bc0f0['sessionId']});const _0x2cf854=this['editor']['config']['get']('cloudServices.bundleVersion')||_0x27ff94,_0x348886=await _0x44be79['isBundleUploaded'](_0x2071b8['connection'],_0x2cf854);this['editor']['plugins']['get'](_0x396e5d)['adapter']={'getRevision':async({revisionId:_0x7b9751})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0x7b9751)),'updateRevisions':async _0x4e1d18=>{await this['_waitForServiceReady']();const _0x2ac0ef=this['_revisionTracker']['currentRevision'];if(_0x348886&&0x1===_0x4e1d18['length']&&_0x4e1d18[0x0]['id']===_0x2ac0ef['id'])return _0x4e1d18;for(const _0x537f4b of _0x4e1d18)_0x537f4b['id']===_0x2ac0ef['id']&&(_0x537f4b['isEmptyCurrent']=_0x537f4b['fromVersion']===_0x537f4b['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0x4e1d18,this['_lastRequestId'])['then'](_0x4ebfc9=>(this['_lastRequestId']=_0x4ebfc9,_0x4e1d18))['catch'](_0x15e461=>{if(pt(_0x15e461)||'400'===_0x15e461['code']&&void 0x0!==_0x15e461['data']['wrongRequestId']){for(const _0x12ab04 of _0x4e1d18)this['_revisionTracker']['repository']['getRevision'](_0x12ab04['id'])&&this['_revisionTracker']['_bufferUpdate'](_0x12ab04['id'],_0x12ab04,!0x1);if(pt(_0x15e461)&&'destroyed'!==this['editor']['state'])throw _0x15e461;return _0x4e1d18;}throw _0x15e461;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0x101154,{revisionsData:_0x467c3e,requestId:_0x31c118})=>{Math['max'](..._0x467c3e['map'](_0x327457=>_0x327457['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0x467c3e,_0x31c118);}):this['_handleRevisionsUpdate'](_0x467c3e,_0x31c118);}),this['set']('_isServiceConnected',!0x1),this['listenTo'](this['_revisionHistoryService'],'connected',()=>{this['_isServiceConnected']=!0x0;}),this['listenTo'](this['_revisionHistoryService'],'disconnected',()=>{this['_isServiceConnected']=!0x1,'connected'===_0x2071b8['connection']?.['state']&&(_0x2071b8['removeFromReconnectionStack'](this),this['stopListening'](this['_revisionHistoryService']));});const {revisions:_0x4e4f55,requestId:_0x317e58}=await this['_revisionHistoryService']['connect'](_0x2071b8['connection']);_0x2071b8['addToReconnectionStack'](this),this['_lastRequestId']=_0x317e58,await this['_fetchMissingUsers'](_0x4e4f55);for(const _0x26d33a of _0x4e4f55)this['_revisionTracker']['addRevisionData'](_0x26d33a);this['listenTo'](_0x5bc0f0,'change:_isConnected',(_0x450937,_0x450dc8,_0x31c4b1)=>{_0x31c4b1&&(this['_oldOffset']=_0x5bc0f0['_offset'],_0x450937['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](this,'_isServiceConnected');}async reconnect(){const _0x5b6a7a=this['editor']['plugins']['get'](z),_0x58739f=this['editor']['plugins']['get'](tt),_0x5266a4=async()=>{const _0x5847d6=this['_revisionTracker']['currentRevision'],_0x3775cc=_0x5847d6['id'],_0x1c4f31=_0x3775cc!==_0x58739f['sessionId'];if(_0x1c4f31){const _0x110d0a=_0x58739f['_offset']-this['_oldOffset'],_0x4bbbcc=this['_getLatestVersionFromServerOperations']();if(this['_revisionTracker']['_revisionDataBuilder']['reInit'](),_0x5847d6['toVersion']+_0x110d0a!==_0x4bbbcc){const _0x444e75=_0x5847d6['fromVersion']+_0x110d0a,_0x4841f3=this['editor']['plugins']['get'](_0x420277),_0xcd80a5=this['_revisionTracker']['buildRevisionData']({'revision':_0x5847d6,'from':_0x444e75,'to':_0x4bbbcc});_0xcd80a5['id']=_0x5847d6['id'];const _0x4b275b=_0xcd80a5['authorsIds']['map'](_0x2c2321=>_0x4841f3['getUser'](_0x2c2321));_0x5847d6['_update']({..._0xcd80a5,'authors':_0x4b275b},!0x0),this['_revisionTracker']['_bufferUpdate'](_0x5847d6['id'],_0xcd80a5,!0x0);}this['_revisionTracker']['_startingVersion']=_0x4bbbcc,_0x5847d6['toVersion']!==_0x5847d6['fromVersion']||this['_revisionTracker']['_bufferedUpdates']['has'](_0x3775cc)||this['_revisionTracker']['repository']['_revisions']['remove'](_0x3775cc),this['_revisionTracker']['_createCurrentRevision'](_0x4bbbcc);}const {revisions:_0x538f08,requestId:_0x4e45f7}=await this['_revisionHistoryService']['reconnect'](_0x5b6a7a['connection'],this['_lastRequestId']);_0x1c4f31&&_0x538f08['length']>0x0?_0x58739f['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x538f08),this['_handleRevisionsUpdate'](_0x538f08,_0x4e45f7),this['_revisionTracker']['sendBufferedUpdates']());};return _0x58739f['_isConnected']?_0x5266a4():new Promise((_0xedfd83,_0x2153bc)=>{_0x58739f['once']('change:_isConnected',()=>{_0x5266a4()['then'](_0xedfd83)['catch'](_0x2153bc);});});}destroy(){super['destroy']();}async _waitForServiceReady(){this['_revisionHistoryService']['isConnected']||await new Promise(_0x50599b=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x5c9295=>{_0x5c9295['off'](),_0x50599b();});});}_getLatestVersionFromServerOperations(){const _0x710776=this['editor']['plugins']['get'](tt)['serverHistory']['getOperations']()['reverse']();for(const _0x368fe2 of _0x710776)if('marker'!==_0x368fe2['type']||_0x368fe2['affectsData'])return _0x368fe2['baseVersion']+0x1;}_getLatestVersion(){const _0x442d02=this['editor']['plugins']['get'](tt);return new Promise(_0x26427c=>{_0x442d02['_isPendingUpdate']?_0x442d02['once']('change:_isPendingUpdate',()=>{_0x26427c(this['_getLatestVersionFromServerOperations']());}):_0x26427c(this['_getLatestVersionFromServerOperations']());});}_handleRevisionsUpdate(_0x300721,_0x26dcc8){const _0x2dc7c1=this['_revisionTracker']['repository'];this['_lastRequestId']=_0x26dcc8;for(const _0x585be3 of _0x300721){const _0x48ab49=_0x2dc7c1['getRevision'](_0x585be3['id']);if(_0x48ab49){if((_0x585be3['fromVersion']||_0x585be3['toVersion'])&&(_0x585be3['diffData']=null),_0x48ab49===this['_revisionTracker']['currentRevision']){const _0x2a451d=Math['max'](_0x48ab49['toVersion'],_0x585be3['toVersion']),_0x93c773=Math['max'](_0x48ab49['fromVersion'],_0x585be3['fromVersion']);let _0x483a2e;_0x48ab49['toVersion']===_0x585be3['toVersion']&&_0x48ab49['fromVersion']===_0x585be3['fromVersion']?(_0x483a2e=!0x0,this['_preventResendingRevisionData'](_0x585be3)):_0x585be3['toVersion']===_0x2a451d&&_0x585be3['fromVersion']===_0x93c773?_0x483a2e=!0x1:(_0x48ab49['toVersion']===_0x2a451d&&_0x48ab49['fromVersion']===_0x93c773||this['_fixRevision']({'revision':_0x48ab49,'from':_0x93c773,'to':_0x2a451d}),_0x483a2e=!0x0),_0x483a2e&&(delete _0x585be3['fromVersion'],delete _0x585be3['toVersion'],delete _0x585be3['diffData'],delete _0x585be3['createdAt'],delete _0x585be3['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0x585be3),this['_preventResendingRevisionData'](_0x585be3);}else this['_revisionTracker']['addRevisionData'](_0x585be3);}const _0x552099=_0x2dc7c1['getRevisions']();_0x552099['reverse']();for(let _0x25dd61=0x0;_0x25dd61<_0x552099['length']-0x1;_0x25dd61++){const _0x526425=_0x552099[_0x25dd61],_0x9292b5=_0x552099[_0x25dd61+0x1];if(_0x526425['fromVersion']<_0x9292b5['toVersion']){const _0x534ea2=_0x9292b5['toVersion'],_0xda2e8d=Math['max'](_0x534ea2,_0x526425['toVersion']);this['_fixRevision']({'revision':_0x526425,'from':_0x534ea2,'to':_0xda2e8d});}}}['_fixRevision']({revision:_0x4285e1,from:_0xbf8f41,to:_0x297f67}={}){const _0x2906e1=this['editor']['plugins']['get'](_0x420277),_0x5363bb=this['_revisionTracker']['buildRevisionData']({'revision':_0x4285e1,'from':_0xbf8f41,'to':_0x297f67});_0x5363bb['authors']=_0x5363bb['authorsIds']['map'](_0x5d987b=>_0x2906e1['getUser'](_0x5d987b)),_0x4285e1['_update'](_0x5363bb);}_preventResendingRevisionData(_0x424bc8){const _0x3d946d={};_0x3d946d['id']=_0x424bc8['id'];for(const _0x5ac140 of Object['keys'](_0x424bc8))'id'!==_0x5ac140&&(_0x3d946d[_0x5ac140]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0x3d946d['id'],_0x3d946d,!0x0);}async _fetchMissingUsers(_0x39eba5){const _0xba3ea5=this['editor']['plugins']['get'](_0x420277),{connection:_0x508b54}=this['editor']['plugins']['get'](z),_0x124019=new Set();for(const _0x1495b8 of _0x39eba5){for(const _0x2b963c of _0x1495b8['authorsIds'])_0x28544f(_0x2b963c);_0x1495b8['creatorId']&&_0x28544f(_0x1495b8['creatorId']);}if(0x0===_0x124019['size'])return;const _0x38236c=await _0x5a3b8a['getMany'](_0x508b54,Array['from'](_0x124019));for(const _0x55a038 of _0x38236c)_0xba3ea5['getUser'](_0x55a038['id'])||_0xba3ea5['addUser'](_0x55a038);function _0x28544f(_0x4404b9){_0xba3ea5['getUser'](_0x4404b9)||_0x124019['add'](_0x4404b9);}}};function pt(_0xdc639e){return _0xdc639e['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0xdc639e['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0xdc639e['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}var gt=class extends _0x21af15{static get requires(){return[_0x396e5d,mt,nt];}static get['pluginName'](){return'RealTimeCollaborativeRevisionHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},wt=class extends _0x38cac9{_collapseAt;constructor(_0x5599d7,_0x541b4d=0x6){super(_0x5599d7);const _0x510908=this['bindTemplate'];this['set']('isHidden',!0x0),this['set']('usersCount',0x0),this['_collapseAt']=_0x541b4d,this['bind']('isHidden')['to'](this,'usersCount',_0x41aa5e=>_0x41aa5e<_0x541b4d),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item',_0x510908['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':_0x510908['to']('usersCount',_0x454797=>'+'+(_0x454797-this['_collapseAt']+0x2)['toString']())}]}]}]});}},vt=class extends _0x38cac9{items;keystrokes;constructor(_0x647488){super(_0x647488);const _0xba2bc9=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0x376c6d(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0xba2bc9['if']('hasPopup'),'aria-expanded':_0xba2bc9['to']('isExpanded',_0x1700dd=>this['hasPopup']&&String(_0x1700dd)),'aria-label':_0xba2bc9['to']('hasPopup',_0x48951a=>X(_0x647488,_0x48951a?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0xba2bc9['to']('hasPopup',_0x22da6d=>!!_0x22da6d&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items'],'on':{'mouseenter':_0xba2bc9['to'](()=>this['fire']('presencelist:show')),'mouseleave':_0xba2bc9['to'](_0x386645=>{const _0x2b6cdf=_0x386645,_0x138e9f=document['querySelector']('.ck-presence-list__dropdown-list'),_0x1dda10=document['querySelector']('.ck-balloon-panel_with-arrow');_0x138e9f?.['contains'](_0x2b6cdf['relatedTarget'])||_0x1dda10?.['contains'](_0x2b6cdf['relatedTarget'])||this['fire']('presencelist:hide');})}}),this['on']('change:hasPopup',(_0x45fa01,_0x589b41,_0xb4914)=>{this['element']&&(_0xb4914?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']);}},_t=class extends _0x38cac9{counterView;inlineListView;constructor(_0x1da959,_0x55458e=0x6){super(_0x1da959);const _0x5d1ff7=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new wt(this['locale'],_0x55458e),this['inlineListView']=new vt(_0x1da959),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x39346d of this['inlineListView']['items'])_0x39346d['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',_0x5d1ff7['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['inlineListView']]});}},yt=class extends _0x38cac9{listWrapperView;constructor(_0x193d23,_0x529207){super(_0x193d23);const _0x5778ee=this['bindTemplate'];this['listWrapperView']=new bt(_0x193d23,_0x529207),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':X(_0x193d23,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']],'on':{'mouseleave':_0x5778ee['to'](_0x54ca21=>{const _0x11899e=_0x54ca21,_0x219d00=document['querySelector']('.ck-presence-list__list'),_0x18f7cc=document['querySelector']('.ck-balloon-panel_with-arrow');_0x219d00?.['contains'](_0x11899e['relatedTarget'])||_0x18f7cc?.['contains'](_0x11899e['relatedTarget'])||this['fire']('presencelist:hide');})}});}},bt=class extends _0x43a43f{constructor(_0x3c3214,_0x45778c){super(_0x3c3214);const _0x406732=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0x45778c?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0x406732['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0x406732['to']('role'),'aria-label':_0x406732['to']('ariaLabel'),'aria-labelledby':_0x406732['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0x36548f['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0x57a3ba=this['element'];_0x57a3ba&&(this['_isScrollable']=Math['max'](_0x57a3ba['scrollHeight'],_0x57a3ba['clientHeight'])>0.8*window['innerHeight']);}},kt=class extends _0x1bada3{['userView'];constructor(_0x320490,_0xebd088,_0x13abc1){super(_0x320490);const _0x528434=this['bindTemplate'];this['userView']=new _0x36b23f(_0x320490,_0xebd088);const _0x34eab3={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0xebd088['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0xebd088['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0xebd088['color']['getBackgroundColorClass']()],'style':{'--ck-user-color':_0xebd088['color']['getColorVariable'](),'--ck-user-color-alpha':_0xebd088['color']['getColorAlphaVariable']()},'aria-hidden':'true'}}]};_0x13abc1&&(_0x34eab3['tag']='button',_0x34eab3['on']={'click':_0x528434['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x34eab3);}['focus'](){this['element']['focus']();}},It=class extends _0x38cac9{['userView'];['markerView'];constructor(_0x23ab2d,_0x2c4206,_0x4efb96){super(_0x23ab2d);const _0x5dea52=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new _0x36b23f(_0x23ab2d,_0x2c4206),this['markerView']=new St(_0x23ab2d,_0x2c4206);const _0x80f452=new _0x372dbb(_0x23ab2d);_0x80f452['template']['tag']='span',_0x80f452['text']=_0x2c4206['name'];const _0x4fd5ef={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0x5dea52['to']('isFocusable',_0x313692=>!!_0x313692&&0x0),'aria-labelledby':_0x80f452['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0x5dea52['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0x5dea52['to']('hasTooltip',_0x2f2123=>!_0x2f2123),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0x80f452]};_0x4efb96&&(_0x4fd5ef['tag']='button',_0x4fd5ef['on']={'click':_0x5dea52['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x4fd5ef);}},St=class extends _0x38cac9{constructor(_0x53e620,_0x3160cf){super(_0x53e620),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x3160cf['color']['getBackgroundColorClass']()],'style':{'--ck-user-color':_0x3160cf['color']['getColorVariable'](),'--ck-user-color-alpha':_0x3160cf['color']['getColorAlphaVariable']()},'aria-hidden':'true'}});}};const Tt={'collapseAt':0x6,'displayMe':!0x0};var Ct=class extends _0x473f2b{currentDisplayedUsers;['balloonPanelView'];['view'];['presenceDropdownView'];_bodyCollection=null;static get['pluginName'](){return'PresenceListUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x41fb2f){super(_0x41fb2f),this['context']['config']['define']('presenceList',Tt);const _0x5a0085=_0x41fb2f['config']['get']('presenceList.collapseAt');if('number'!=typeof _0x5a0085)throw new _0x38aab5('presencelist-collapseat-invalid-format',this);if(_0x5a0085<0x1)throw new _0x38aab5('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](Y)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0x50f27a(),this['balloonPanelView']=new _0x549ae0(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get requires(){return[Y];}init(){for(const _0x2e759b of this['_allConnectedUsers'])this['_handleUserAdd'](_0x2e759b);this['listenTo'](this['_allConnectedUsers'],'add',(_0x3e599a,_0x310621)=>{this['_handleUserAdd'](_0x310621);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0x1693a8,_0x19bff8)=>{this['_handleUserRemove'](_0x19bff8);});}_createView(){const _0x42d96e=this['context'],_0xa1f77=new _t(this['context']['locale'],this['context']['config']['get']('presenceList.collapseAt')),_0x152a69=this['balloonPanelView'];if(!_0x4d1a50(_0x42d96e['config']['get']('presenceList.container')))throw new _0x38aab5('presencelist-missing-container',this);return _0xa1f77['counterView']['bind']('usersCount')['to'](this),_0xa1f77['bind']('isCollapsed')['to'](this,'usersCount',_0x58e5dc=>{const {collapseAt:_0x3730db}=_0x42d96e['config']['get']('presenceList'),_0x260fe4=_0x58e5dc>=_0x3730db;if(_0x260fe4&&!_0xa1f77['inlineListView']['items']['find'](_0xd11cf5=>_0xd11cf5 instanceof wt)){const _0x4a21c8=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['currentDisplayedUsers']['length']==_0x4a21c8&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](this['currentDisplayedUsers']['length']-0x1),_0xa1f77['inlineListView']['items']['add'](_0xa1f77['counterView']);}return _0x260fe4||this['hideDropdown'](),_0x260fe4;}),_0xa1f77['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0x473ab0=>{const _0x50af56=_0x42d96e['config']['get']('presenceList'),_0x23b7e3=new It(_0x42d96e['locale'],_0x473ab0,!!_0x50af56['onClick']);return _0x23b7e3['bind']('hasTooltip')['to'](_0xa1f77,'isCollapsed',_0x39cb37=>!_0x39cb37),_0x23b7e3['bind']('isFocusable')['to'](_0xa1f77,'isCollapsed',_0x464b3f=>!_0x464b3f),_0x50af56['onClick']&&this['listenTo'](_0x23b7e3,'execute',()=>{this['view']['isCollapsed']||_0x50af56['onClick'](_0x473ab0,_0x23b7e3['element']);}),_0x23b7e3;}),this['listenTo'](_0xa1f77['inlineListView'],'presencelist:show',()=>{this['view']['isCollapsed']&&this['showDropdown']();}),this['listenTo'](_0xa1f77['inlineListView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();}),_0xa1f77['inlineListView']['keystrokes']['set']('Enter',(_0x9c57fb,_0x37c93e)=>{this['view']['isCollapsed']&&(this['showDropdown'](),_0x37c93e());}),_0xa1f77['render'](),_0x152a69['render'](),_0x40afbd({'emitter':_0xa1f77,'activator':()=>_0x152a69['isVisible'],'contextElements':[_0x152a69['element'],_0xa1f77['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0x42d96e['config']['get']('presenceList.container')['appendChild'](_0xa1f77['element']),this['_bodyCollection']=new _0x3a4fca(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_bodyCollection']['add'](this['balloonPanelView']),_0xa1f77;}['_handleUserAdd'](_0x21b324){if(!this['context']['config']['get']('presenceList.displayMe')&&_0x21b324['isMe'])return;const _0x350e90=this['context']['config']['get']('presenceList.collapseAt')-0x1;for(this['usersCount']++;this['currentDisplayedUsers']['length']>=_0x350e90-(this['view']['isCollapsed']?0x1:0x0)&&this['currentDisplayedUsers']['length']>0x1;)this['currentDisplayedUsers']['remove'](0x1);const _0x198183=_0x21b324['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0x21b324,_0x198183);}['_handleUserRemove'](_0x915b6d){this['usersCount']--;const {collapseAt:_0x59227b}=this['context']['config']['get']('presenceList'),_0x29b50a=this['usersCount']>=_0x59227b;if(this['currentDisplayedUsers']['get'](_0x915b6d['id']))this['currentDisplayedUsers']['remove'](_0x915b6d['id']);else{if(_0x29b50a&&this['currentDisplayedUsers']['length']+0x1===_0x59227b-0x1)return;}if(this['currentDisplayedUsers']['length']+(_0x29b50a?0x1:0x0)<this['usersCount']){for(const _0x52713d of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0x52713d['id'])&&(this['currentDisplayedUsers']['add'](_0x52713d,Math['min'](this['currentDisplayedUsers']['length']-(_0x29b50a?0x1:0x0),0x1)),this['currentDisplayedUsers']['length']+(_0x29b50a?0x1:0x0)===_0x59227b-0x1))return;}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0x3b163d=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new yt(this['context']['locale'],!!_0x3b163d['onClick']),this['view']['inlineListView']['isExpanded']=!0x0,this['listenTo'](this['presenceDropdownView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();});const {listWrapperView:_0x2cea81}=this['presenceDropdownView'];_0x2cea81['items']['bindTo'](this['_allConnectedUsers'])['using'](_0x127cf0=>{if(!_0x3b163d['displayMe']&&_0x127cf0['isMe'])return null;const _0x4ec6f3=new kt(this['context']['locale'],_0x127cf0,!!_0x3b163d['onClick']);return _0x3b163d['onClick']&&this['listenTo'](_0x4ec6f3,'execute',()=>{_0x3b163d['onClick'](_0x127cf0,_0x4ec6f3['element']);}),_0x4ec6f3;}),this['balloonPanelView']['content']['add'](this['presenceDropdownView']),this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element']}),_0x2cea81['focus'](),_0x2cea81['checkIfScrollable']();const _0x868c22=(_0x5823fe,_0x53beb2)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0x53beb2();};_0x2cea81['keystrokes']['set']('Esc',_0x868c22),_0x2cea81['keystrokes']['set']('Shift+Tab',_0x868c22),_0x2cea81['keystrokes']['set']('Tab',(_0x3ba7ab,_0x1ef2ef)=>{!function(_0x1b531d){const _0x5237df=['a','button','input','select','textarea','[tabindex]','[contenteditable]']['map'](_0x2a6f40=>_0x2a6f40+':not([disabled]):not([tabindex=\x22-1\x22])')['join'](','),_0x363bb2=[...document['body']['querySelectorAll'](_0x5237df)]['filter'](_0x216e8e=>_0x216e8e===document['activeElement']||_0x216e8e['offsetWidth']+_0x216e8e['offsetHeight']>0x0)['sort']((_0x5d9624,_0x5313cb)=>(_0x5d9624['tabIndex']||0x0)-(_0x5313cb['tabIndex']||0x0)),_0x45e3cc=_0x363bb2[(_0x363bb2['indexOf'](_0x1b531d)+0x1)%_0x363bb2['length']];_0x45e3cc&&_0x45e3cc['focus']();}(this['view']['element']),this['hideDropdown'](),_0x1ef2ef();}),_0x2cea81['focusTracker']['add'](this['view']['element']),_0x2cea81['focusTracker']['on']('change:isFocused',(_0x4737f0,_0x559b2d,_0x457be4)=>{_0x457be4||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);}},At=class extends _0x473f2b{static get requires(){return[Y,Ct];}static get['pluginName'](){return'PresenceList';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}};export{ot as CloudServicesCommentsAdapter,mt as CloudServicesRevisionHistoryAdapter,ht as CloudServicesTrackChangesAdapter,At as PresenceList,Ct as PresenceListUI,tt as RealTimeCollaborationClient,ut as RealTimeCollaborativeComments,nt as RealTimeCollaborativeEditing,gt as RealTimeCollaborativeRevisionHistory,ft as RealTimeCollaborativeTrackChanges,Y as Sessions,z as WebSocketGateway};
|
|
23
|
+
import{Context as _0x4b9058,ContextPlugin as _0x181a27,PendingActions as _0x36d7c3,Plugin as _0x55ae44}from'@ckeditor/ckeditor5-core';import{CKEditorError as _0xa752d3,Collection as _0x309d10,DomEmitterMixin as _0x1e70a0,KeystrokeHandler as _0x2b4fca,global as _0x59c443,uid as _0x4ad382,version as _0x559256}from'@ckeditor/ckeditor5-utils';import{BalloonPanelView as _0x241d1f,BodyCollection as _0x44ac99,LabelView as _0x522fbe,ListItemView as _0x130180,ListView as _0xd7af65,Notification as _0x12e214,View as _0x5e1e61,clickOutsideHandler as _0xc6739}from'@ckeditor/ckeditor5-ui';import{History as _0x3c190d,InsertOperation as _0x5c1955,MarkerOperation as _0x393ac7,ModelLiveRange as _0x446d30,NoOperation as _0xd0c2db,OperationFactory as _0x3f7ebd,RootAttributeOperation as _0x543856,transformOperationSets as _0x3c1840}from'@ckeditor/ckeditor5-engine';import{CloudServices as _0x63032a}from'@ckeditor/ckeditor5-cloud-services';import{CollaborativeEditingService as _0xbf1a21,CommentsService as _0x2d8629,EditorService as _0x214476,RevisionHistoryService as _0x195a98,TrackChangesService as _0x556600,User as _0x326c07,WEB_SOCKET_GATEWAY_STATES as _0x16de04,WebSocketGateway as _0x248db8}from'@ckeditor/ckeditor-cloud-services-collaboration';import{UserView as _0x4b32bb,Users as _0x2e4b5d}from'@ckeditor/ckeditor5-collaboration-core';import{Compressor as _0x196fc5}from'@ckeditor/ckeditor5-operations-compressor';import{TrackChanges as _0x2955eb,TrackChangesEditing as _0x18cb04}from'@ckeditor/ckeditor5-track-changes';import{Comments as _0x282b1b,CommentsEditing as _0x6108de,CommentsRepository as _0x299e96}from'@ckeditor/ckeditor5-comments';import{RevisionHistory as _0x2d2cfb}from'@ckeditor/ckeditor5-revision-history';import{isElement as _0x1eb77c}from'es-toolkit/compat';var z=class WebSocketGateway extends _0x181a27{static WebSocketGateway=/* #__PURE__ -- @preserve */
|
|
24
|
+
((()=>_0x248db8)());static initialReconnectionInterval=0x3e8;connection;_reconnectionStack;_shouldPluginsReconnect;_domEmitter;static get requires(){return[_0x63032a,_0x12e214];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x358704){super(_0x358704),this['set']('state',_0x16de04['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=new(_0x1e70a0())();}init(){const _0x1b626e=this['context'],_0x4642c0=_0x1b626e['plugins']['get'](_0x63032a),_0x18f95f=_0x1b626e['plugins']['get'](_0x12e214);if(!_0x4642c0['token'])throw new _0xa752d3('websocketgateway-missing-token',this);if(!_0x4642c0['webSocketUrl'])throw new _0xa752d3('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),WebSocketGateway['WebSocketGateway']['connect'](_0x4642c0['token'],_0x4642c0['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0x37fbda=>{if(this['connection']=_0x37fbda,this['bind']('state')['to'](_0x37fbda,'state',this,'_isBrowserOffline',(_0x1b5af8,_0x1b6ac6)=>('connected'!==_0x1b5af8&&(this['_shouldPluginsReconnect']=!0x0),_0x1b6ac6||_0x1b5af8!==_0x16de04['CONNECTED']?_0x16de04['DISCONNECTED']:this['state']==_0x16de04['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),_0x16de04['CONNECTING']):_0x16de04['CONNECTED'])),this['connection']['on']('error',(_0x5636ce,_0xfc77fc)=>{if('limitExceeded'!==_0xfc77fc['code'])throw console['error'](_0xfc77fc),new _0xa752d3('cloudservices-init',null,{'originalError':_0xfc77fc});_0x18f95f['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'});}),!_0x37fbda['me'])return new Promise(_0x2c012a=>_0x37fbda['on']('change:me',_0x2c012a));})['catch'](_0x599442=>{throw console['error'](_0x599442),new _0xa752d3('cloudservices-init',null,{'originalError':_0x599442});});}addToReconnectionStack(_0x4d1485){if('function'!=typeof _0x4d1485['reconnect'])throw new _0xa752d3('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0x4d1485))throw new _0xa752d3('websocketgateway-plugin-already-registered',this,{'name':_0x4d1485['constructor']['pluginName']});this['_reconnectionStack']['add'](_0x4d1485);}removeFromReconnectionStack(_0x50bf64){this['_reconnectionStack']['delete'](_0x50bf64);}isInReconnectionStack(_0x3973ab){return this['_reconnectionStack']['has'](_0x3973ab);}_reconnect(){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0x24f061=>_0x24f061['reconnect']())))['then'](()=>this['state']=_0x16de04['CONNECTED'])['catch'](_0x273ba9=>{throw console['error'](_0x273ba9),new _0xa752d3('cloudservices-reconnection-error',this['context']);});}disconnect(){this['connection']&&this['connection']['disconnect'](),this['state']=_0x16de04['DISCONNECTED'],this['_domEmitter']['stopListening']();}destroy(){this['disconnect'](),super['destroy']();}},Y=class extends _0x181a27{['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[z,_0x2e4b5d];}constructor(_0x52792a){super(_0x52792a),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0x309d10(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x2e4b5d);}init(){const _0x1d3a7c=this['context']['plugins']['get'](z);this['listenTo'](_0x1d3a7c,'change:state',(_0x28b797,_0x34e5ef,_0x47e588)=>{if('connected'!==_0x47e588)this['channelSessions']['forEach'](_0x5691dc=>_0x5691dc['clear']()),this['channelConnectedUsers']['forEach'](_0x123f6b=>_0x123f6b['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x52ab85,_0x50a881]of this['_registeredSessions'])for(const _0x26d5ce of _0x50a881)this['_handleSessionAdd'](_0x52ab85,_0x26d5ce);}}),this['_createUser'](_0x1d3a7c['connection']['me'],!0x0);}register(_0x49c194,_0x471725){if(this['_registeredSessions']['has'](_0x49c194))throw new _0xa752d3('sessions-register-already-registered',null,{'channelId':_0x49c194});this['_registeredSessions']['set'](_0x49c194,_0x471725),this['channelSessions']['set'](_0x49c194,new _0x309d10()),this['channelConnectedUsers']['set'](_0x49c194,new _0x309d10()),this['listenTo'](_0x471725,'add',(_0xe1a698,_0x51c064)=>this['_handleSessionAdd'](_0x49c194,_0x51c064)),this['listenTo'](_0x471725,'remove',(_0xb007bd,_0x480795)=>this['_handleSessionRemove'](_0x49c194,_0x480795));for(const _0x21c215 of _0x471725)this['_handleSessionAdd'](_0x49c194,_0x21c215);}unregister(_0x2e09b3){if(!this['_registeredSessions']['has'](_0x2e09b3))throw new _0xa752d3('sessions-unregister-not-exist',null,{'channelId':_0x2e09b3});const _0x2e8625=this['_registeredSessions']['get'](_0x2e09b3);this['stopListening'](_0x2e8625);for(const _0x9a98e4 of _0x2e8625)'connected'===this['context']['plugins']['get'](z)['state']&&this['_handleSessionRemove'](_0x2e09b3,_0x9a98e4);this['_registeredSessions']['delete'](_0x2e09b3),this['channelSessions']['delete'](_0x2e09b3),this['channelConnectedUsers']['delete'](_0x2e09b3);}get['mySessionId'](){return this['context']['plugins']['get'](z)['connection']['sessionId'];}getUserBySessionId(_0x15c4a3){for(const _0x2140fd of this['channelSessions']['values']())for(const _0x2ef538 of _0x2140fd)if(_0x2ef538['id']===_0x15c4a3)return _0x2ef538['user'];}getUserSessions(_0x4460c6,_0x2c8bb5){const _0x245760=_0x2c8bb5?[this['channelSessions']['get'](_0x2c8bb5)]:this['channelSessions']['values'](),_0x17f730=new Set();for(const _0x237067 of _0x245760)for(const _0x24e323 of _0x237067)_0x24e323['user']['id']===_0x4460c6['id']&&_0x17f730['add'](_0x24e323['id']);return _0x17f730;}getUserRole(_0x3316d3){for(const _0x523ac3 of this['channelSessions']['values']())for(const _0x191d15 of _0x523ac3)if(_0x191d15['user']===_0x3316d3)return _0x191d15['role'];}['_handleSessionAdd'](_0x953d2f,_0x17518c){if('connected'!==this['context']['plugins']['get'](z)['state'])return;const _0x458dae=_0x17518c['user'],_0x42fb27=this['_users']['getUser'](_0x458dae['id'])||this['_createUser'](_0x458dae),_0x20af80=Object['assign']({},_0x17518c,{'user':_0x42fb27});if(this['channelSessions']['get'](_0x953d2f)['add'](_0x20af80),!_0x458dae['hiddenInPresenceList']){const _0x56e9b4=this['channelConnectedUsers']['get'](_0x953d2f);_0x56e9b4['has'](_0x42fb27['id'])||_0x56e9b4['add'](_0x42fb27),this['allConnectedUsers']['has'](_0x42fb27['id'])||_0x458dae['hiddenInPresenceList']||this['allConnectedUsers']['add'](_0x42fb27,_0x42fb27['isMe']?0x0:void 0x0);}this['fire']('sessionAdd:'+_0x953d2f,{'channelId':_0x953d2f,'session':_0x20af80});}['_handleSessionRemove'](_0x59f9bc,_0x2b9002){if('connected'!==this['context']['plugins']['get'](z)['state'])return;const _0x1ff207=this['channelConnectedUsers']['get'](_0x59f9bc),_0xcdf87e=_0x2b9002['user'];_0xcdf87e['id']&&(this['channelSessions']['get'](_0x59f9bc)['remove'](_0x2b9002['id']),_0x1ff207['has'](_0xcdf87e['id'])&&!this['getUserSessions'](_0xcdf87e,_0x59f9bc)['size']&&_0x1ff207['remove'](_0xcdf87e['id']),this['allConnectedUsers']['get'](_0xcdf87e['id'])&&!this['getUserSessions'](_0xcdf87e)['size']&&this['allConnectedUsers']['remove'](_0xcdf87e['id']));}_createUser(_0x19beb5,_0x1d3efa){const _0x1ddb2f=this['_users']['addUser'](_0x19beb5);return _0x1d3efa&&this['_users']['defineMe'](_0x19beb5['id']),_0x1ddb2f['orderNumber']=this['_uniqueUsersCount']++,_0x1ddb2f;}},K=class extends _0x55ae44{_domEmitter=new(_0x1e70a0())();static get requires(){return[Y];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const _0x20589d=this['editor'],_0x25ad11=_0x20589d['plugins']['get'](Y);_0x20589d['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x2fd9b3,{writer:_0x2c98d0})=>function(_0x316396,_0xc2ba0a,_0xb6d3ff,_0x451c1b){const _0x24276f=_0x316396['markerName']['split'](':')[0x2],_0x2d8e53=_0xb6d3ff['getUserBySessionId'](_0x24276f);if(!_0x2d8e53||_0x24276f===_0xb6d3ff['mySessionId'])return;if(!_0x451c1b['model']['schema']['checkChild'](_0x316396['markerRange']['start'],'$text'))return;const _0x4f9dbf={'class':'ck-user__marker\x20'+_0x2d8e53['color']['getMarkerClass'](),'style':Q(_0x2d8e53),'data-name':_0x2d8e53['name'],'data-session-id':_0x24276f},_0x1f978b=_0x451c1b['model']['markers']['get'](_0x316396['markerName'])['getStart'](),_0x500e9d=_0x1f978b['nodeAfter'],_0x5947aa=_0x451c1b['model']['schema'];if(_0x500e9d&&_0x5947aa['isObject'](_0x500e9d)&&_0x5947aa['isInline'](_0x500e9d)&&!_0x451c1b['model']['markers']['get']('user:range:'+_0x24276f)['getRange']()['isCollapsed'])return;const _0x370cf1=_0x1f978b['parent'];return _0x451c1b['model']['schema']['isLimit'](_0x370cf1)&&!_0x451c1b['model']['hasContent'](_0x370cf1)&&(_0x4f9dbf['contenteditable']=!0x1),function(_0xb5a8bc,_0x4dd587,_0x3cfa90){const _0xcf208f=_0xb5a8bc['createUIElement']('span',_0x4dd587);return _0xb5a8bc['setCustomProperty']('userPositionMarker',!0x0,_0xcf208f),_0xcf208f['render']=function(_0x14c73e){const _0x351288=this['toDomElement'](_0x14c73e),_0x485e4c=document['createElement']('span');return _0x485e4c['classList']['add']('ck-user__marker-tooltip'),_0x485e4c['setAttribute']('contenteditable','false'),_0x485e4c['setAttribute']('spellcheck','false'),_0x485e4c['textContent']=_0x3cfa90['name'],_0x351288['innerHTML']='<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span>'+_0x485e4c['outerHTML']+'',_0x351288['addEventListener']('mouseenter',()=>{_0x351288['classList']['add']('ck-user__marker_hovered');}),_0x351288['addEventListener']('mouseleave',()=>{_0x351288['classList']['remove']('ck-user__marker_hovered');}),_0x351288;},_0xcf208f['isSimilar']=function(_0x4a2c7d){return!(!this['getCustomProperty']('userPositionMarker')||!_0x4a2c7d['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0x4a2c7d['getAttribute']('data-session-id'));},_0xcf208f;}(_0xc2ba0a,_0x4f9dbf,_0x2d8e53);}(_0x2fd9b3,_0x2c98d0,_0x25ad11,_0x20589d)}),_0x20589d['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0x545b2d=>function(_0x58c404,_0x2e6d74){const _0x212a81=_0x58c404['markerName']['split'](':')[0x2];if(_0x212a81===_0x2e6d74['mySessionId'])return null;const _0x2baa73=_0x2e6d74['getUserBySessionId'](_0x212a81);return _0x2baa73?{'id':_0x212a81,'classes':['ck-user__selection',_0x2baa73['color']['getSelectionClass']()],'attributes':{'style':Q(_0x2baa73),'data-session-id':_0x212a81},'priority':0x7d0+_0x2baa73['orderNumber']}:{'id':_0x212a81,'classes':[]};}(_0x545b2d,_0x25ad11)}),function(_0x2a5ee6){const _0x40c2d1=_0x2a5ee6['model'],_0x2c688f=new Map(),_0x1c0a4e=_0x2a5ee6['plugins']['get'](Y);_0x40c2d1['markers']['on']('update:user:range',(_0x4946b9,_0x1b00ed,_0x2f1a08,_0xb6d2be)=>{if(!_0xb6d2be&&_0x2c688f['get'](_0x1b00ed['name']))return _0x2c688f['get'](_0x1b00ed['name'])['detach'](),void _0x2c688f['delete'](_0x1b00ed['name']);const _0x2a761b=_0x1b00ed['name']['split'](':')[0x2];if(_0x2a761b===_0x1c0a4e['mySessionId'])return;const _0x489edb='user:position:'+_0x2a761b;_0x40c2d1['markers']['has'](_0x489edb)&&_0x2a5ee6['editing']['reconvertMarker'](_0x489edb),_0x1b00ed['on']('change:range',(_0x2fed9f,_0x5230f8,_0x217174)=>{if('$graveyard'!=_0x5230f8['root']['rootName']&&'$graveyard'==_0x1b00ed['getRange']()['root']['rootName']&&!_0x2c688f['has'](_0x1b00ed['name'])){const _0x23750d=_0x40c2d1['schema']['getNearestSelectionRange'](_0x217174['deletionPosition']);if(_0x23750d){const _0x321207=_0x446d30['fromRange'](_0x23750d);_0x2c688f['set'](_0x1b00ed['name'],_0x321207),_0x321207['on']('change:range',(_0x575856,_0x34eb55,_0x404b37)=>{if('$graveyard'==_0x321207['root']['rootName']){const _0x394e56=_0x40c2d1['schema']['getNearestSelectionRange'](_0x404b37['deletionPosition']);_0x394e56?(_0x321207['start']=_0x394e56['start'],_0x321207['end']=_0x394e56['end']):(_0x2c688f['delete'](_0x1b00ed['name']),_0x321207['detach']());}});}}});}),_0x40c2d1['document']['on']('change',()=>{_0x2c688f['size']>0x0&&_0x40c2d1['enqueueChange']({'isUndoable':!0x1},_0x7eb71e=>{for(const [_0x3c0915,_0x25cdee]of _0x2c688f)'$graveyard'==_0x40c2d1['markers']['get'](_0x3c0915)['getRange']()['root']['rootName']&&(J(_0x3c0915['split'](':')[0x2],_0x25cdee['toRange'](),_0x40c2d1,_0x7eb71e),_0x25cdee['detach']());_0x2c688f['clear']();});});}(_0x20589d),this['_domEmitter']['listenTo'](_0x59c443['document'],'keydown',(_0x5c34ab,{key:_0x1b1844})=>{'Escape'===_0x1b1844&&function(_0x785c6f){_0x785c6f['editing']['view']['change'](_0x316325=>{for(const _0x5b9d7c of _0x785c6f['model']['markers']){if(!_0x5b9d7c['name']['startsWith']('user:position'))continue;const _0x4f74b9=_0x785c6f['editing']['mapper']['markerNameToElements'](_0x5b9d7c['name']);if(_0x4f74b9){for(const _0x1d123e of _0x4f74b9)_0x316325['removeClass']('ck-user__marker_hovered',_0x1d123e);}}});}(_0x20589d);},{'useCapture':!0x0});}afterInit(){const _0x53c77b=this['editor'],_0x400991=_0x53c77b['commands']['get']('undo');_0x400991&&_0x53c77b['model']['on']('applyOperation',(_0xa6a87,_0x5af7e5)=>{const _0x45fe5c=_0x5af7e5[0x0];if(!_0x45fe5c['isDocumentOperation'])return;if('marker'!=_0x45fe5c['type']||!_0x45fe5c['name']['startsWith']('user:'))return;const _0x50bcd7=_0x45fe5c['batch'];_0x400991['_createdBatches']['has'](_0x50bcd7)&&(_0x45fe5c['newRange']=_0x45fe5c['oldRange']?_0x53c77b['model']['createRange'](_0x45fe5c['oldRange']['start'],_0x45fe5c['oldRange']['end']):null);},{'priority':'highest'});}destroy(){return this['_domEmitter']['stopListening'](),super['destroy']();}createUserMarkerOperations(){const _0x406a68=this['editor'],_0x590ce0=_0x406a68['model']['document'],_0x14e47a=_0x406a68['plugins']['get'](Y);_0x406a68['model']['enqueueChange']({'isUndoable':!0x1},_0x32b234=>{const _0x161f5e='user:range:'+_0x14e47a['mySessionId'],_0x1e9df8='user:position:'+_0x14e47a['mySessionId'],_0x98e946=_0x406a68['model']['markers']['has'](_0x161f5e);_0x406a68['editing']['view']['hasDomSelection']?J(_0x14e47a['mySessionId'],_0x590ce0['selection']['getFirstRange'](),_0x406a68['model'],_0x32b234):_0x98e946&&(_0x32b234['removeMarker'](_0x161f5e),_0x32b234['removeMarker'](_0x1e9df8));});}};function J(_0x4c0ebe,_0x431f53,_0x678152,_0x2cc7a8){const _0x92f34a='user:range:'+_0x4c0ebe,_0xfef42c='user:position:'+_0x4c0ebe,_0x4107cc=_0x431f53['getContainedElement']();let _0x520e3f=_0x431f53['start'];if(_0x4107cc&&_0x4107cc['is']('element','tableCell')){const _0x4fea97=function(_0x3d1765,_0x2a1ee6){for(const _0x1c78b7 of _0x3d1765['getPositions']())if(_0x2a1ee6['schema']['checkChild'](_0x1c78b7,'$text'))return _0x1c78b7;}(_0x431f53,_0x678152);_0x4fea97&&(_0x520e3f=_0x4fea97,_0x431f53=_0x2cc7a8['createRange'](_0x520e3f));}const _0x457619=_0x2cc7a8['createRange'](_0x520e3f);_0x678152['markers']['has'](_0x92f34a)?(_0x2cc7a8['updateMarker'](_0x92f34a,{'range':_0x431f53}),_0x2cc7a8['updateMarker'](_0xfef42c,{'range':_0x457619})):(_0x2cc7a8['addMarker'](_0x92f34a,{'range':_0x431f53,'usingOperation':!0x0}),_0x2cc7a8['addMarker'](_0xfef42c,{'range':_0x457619,'usingOperation':!0x0}));}function Q(_0x339d52){return'--ck-user-color:'+_0x339d52['color']['getColorVariable']()+';--ck-user-color-alpha:'+_0x339d52['color']['getColorAlphaVariable']()+';';}function X(_0xbd66c0,_0x335676,_0x253792){const _0x5cd180=_0xbd66c0['t'],t=_0xbd66c0['t'];switch(_0x335676){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 _0x5cd180({'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'},_0x253792);default:return'';}}let Z=0x1;var tt=class RealTimeCollaborationClient extends _0x55ae44{static CollaborativeEditingService=/* #__PURE__ -- @preserve */
|
|
25
|
+
((()=>_0xbf1a21)());_offset;['sessionId'];serverHistory;['_channelId'];['_service'];_document;['_compressor'];_bufferedOperations;_knownOperations;_knownRootNames;_pendingAction;_hasSelectionChanged;_sendBufferedOperationsDelayId;['_baseBufferDelay'];_currentBufferDelay;_lastSyncedOperationId;_disconnectionOperations;_operationIdentifier;static get requires(){return[z,Y,K,_0x36d7c3,_0x2e4b5d,_0x12e214];}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 _0x3d9dd4=this['serverHistory']['getOperations']();for(let _0x32a847=_0x3d9dd4['length']-0x1;_0x32a847>=0x0;_0x32a847--){const _0x25f5cd=_0x3d9dd4[_0x32a847];if(!this['_disconnectionOperations']['has'](_0x25f5cd))return _0x25f5cd['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0x1d2beb){if(super(_0x1d2beb),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x3c190d(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0xa752d3('collaboration-missing-channelid',this);const _0x4cc958=_0x1d2beb['config']['get']('cloudServices.bundleVersion')||_0x559256;this['_service']=new RealTimeCollaborationClient['CollaborativeEditingService'](_0x4cc958,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0x196fc5(),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 it(this['_disconnectionOperations']);}init(){const _0x4cbaf2=this['editor'],_0xad91d9=_0x4cbaf2['plugins']['get'](_0x2e4b5d),_0x8e929a=_0x4cbaf2['plugins']['get'](z);this['listenTo'](_0xad91d9,'getOperationAuthor',(_0x36a1b7,_0xd1edd5)=>{const _0x2e88a3=_0xd1edd5[0x0];_0x2e88a3['_authorId']&&(_0x36a1b7['return']=_0xad91d9['getUser'](_0x2e88a3['_authorId']),_0x36a1b7['stop']()),null===_0x2e88a3['_authorId']&&(_0x36a1b7['return']=null,_0x36a1b7['stop']());},{'priority':'high'}),this['listenTo'](_0x4cbaf2['model']['document']['selection'],'change:range',(_0x2b825,_0x5e635f)=>{_0x5e635f['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x4cbaf2['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x4cbaf2['model']['on']('applyOperation',(_0x5a97dc,_0x2861d4)=>{const _0xd872ed=_0x2861d4[0x0];_0xd872ed['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0xd872ed),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['set']('_isChannelFlushed',!0x1),this['bind']('_isEditingAllowed')['to'](_0x8e929a,'state',this,'_hasSynchronizationProblem',this,'_isChannelFlushed',(_0x201574,_0x3b028a,_0x1749b3)=>'connected'===_0x201574&&!_0x3b028a&&!_0x1749b3),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x4cbaf2['disableReadOnlyMode']('rtc-offline'):_0x4cbaf2['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x4cbaf2['disableReadOnlyMode']('rtc-offline'):_0x4cbaf2['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async reconnect(){const _0x542311=this['editor']['plugins']['get'](Y),_0x15d8b2=this['editor']['plugins']['get'](z);try{this['_isPendingUpdate']=!0x0,_0x542311['unregister'](this['_channelId']);const _0x4a49a8=await this['_service']['reconnect'](_0x15d8b2['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0x4a49a8)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x26ade7=await this['_service']['getConnectedSessions']();_0x542311['register'](this['_channelId'],_0x26ade7),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x4f09af){if(function(_0xf9c767){return'404'===_0xf9c767['code'];}(_0x4f09af)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0x222a92){return'409'===_0x222a92['code'];}(_0x4f09af)){const _0x48ff4f=X(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'](_0x48ff4f);}else{if(!(_0x4f09af instanceof et))throw _0x4f09af;this['_handleReconnectionError']();}}}}destroy(){const _0x43b8b0=this['editor']['plugins']['get'](z),_0x1e0ada=this['editor']['plugins']['get'](Y);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x1e0ada['channelSessions']['has'](this['_channelId'])&&_0x1e0ada['unregister'](this['_channelId']),_0x43b8b0['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async _handleReconnectionResponse(_0x1da7c8){if(this['sessionId']!==_0x1da7c8['sessionId']&&this['_lastSyncedOperationId']!==_0x1da7c8['lastOperationId'])throw new et();return this['sessionId']=_0x1da7c8['sessionId'],this['_handleServerResponse']([],{..._0x1da7c8,'wereChangesApplied':!0x1,'data':_0x1da7c8['data']},'reconnect');}async _connectService(_0xbe8d39,_0x5cad08=!0x1){const {connection:_0x1daeb5}=this['editor']['plugins']['get'](z);RealTimeCollaborationClient['CollaborativeEditingService']['getConnectedSessions'](_0x1daeb5,this['_channelId'])['then'](_0x446993=>this['_initSessionsHandling'](_0x446993))['catch'](_0x5a8cc6=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x5a8cc6);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x5dfb93,_0x28d7ed)=>{this['_crash']('realtimecollaborationclient-init-service-internal-error',_0x28d7ed);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_handleChannelDisconnected']();});const _0x5a515d=this['_operationIdentifier']['getIdOfTheLastOperation'](_0xbe8d39);this['_isPendingUpdate']=!0x0;const _0x213478=await this['_service']['connect'](_0x1daeb5,this['_compressOperations'](_0xbe8d39),_0x5a515d);if(this['sessionId']=_0x213478['sessionId'],_0x5cad08){if(!_0x213478['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x213478['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0xbe8d39,_0x213478,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x213478,_0xbe8d39);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}_handleSendingSelectionMarkers(){const _0x357854=this['editor']['plugins']['get'](Y),_0x3c9f0e=this['editor']['plugins']['get'](K),_0x498fe6=_0x357854['channelSessions']['get'](this['_channelId']);_0x498fe6&&_0x498fe6['length']>0x1?_0x3c9f0e['createUserMarkerOperations']():this['listenTo'](_0x357854,'sessionAdd:'+this['_channelId'],()=>{0x2===_0x357854['channelSessions']['get'](this['_channelId'])['length']&&_0x3c9f0e['createUserMarkerOperations']();});}async _handleReceivedOperations(_0xb5c690,_0x5681f2,_0x4efa7c,_0x3703aa){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x5681f2){const _0x32f8be=this['_decompressOperations'](_0x4efa7c,_0x3703aa);await this['_fetchMissingUsers'](_0x32f8be),this['_handleExternalOperations'](_0x32f8be,_0x5681f2,_0x4efa7c['lastOperationId'])||this['_crash']('realtimecollaborationclient-init-service-incorrect-server-operation');}}async _connectAfterSessionHasBeenFlushed(){this['_disconnectService']();const {locale:_0x51b0e6}=this['editor'];let _0x31aa86;try{_0x31aa86=await this['_service']['getDocumentDetails']();}catch{const _0x2742c7=X(_0x51b0e6,'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'](_0x2742c7);}const _0x18f30d=_0x31aa86['currentDocumentSession']||_0x31aa86['lastDocumentSession'];if(this['_lastSyncedOperationId']!==_0x18f30d['lastOperationId']){const _0x3421c3=X(_0x51b0e6,'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'](_0x3421c3);}await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);}_handleChannelDisconnected(){const _0x2040c4=this['editor']['plugins']['get'](z);if(this['_isConnected']=!0x1,!_0x2040c4['connection']||'connected'!==_0x2040c4['connection']['state'])return;this['_isChannelFlushed']=!0x0;const _0x4bbdb4=this['editor']['plugins']['get'](Y);_0x4bbdb4['channelSessions']['has'](this['_channelId'])&&_0x4bbdb4['unregister'](this['_channelId']),_0x2040c4['removeFromReconnectionStack'](this),this['_disconnectService']();}_disconnectService(){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['stopListening'](this['_service']);}_initSessionsHandling(_0x77ef3){const _0x5b30f6=this['editor']['plugins']['get'](Y);this['listenTo'](_0x5b30f6,'sessionAdd:'+this['_channelId'],(_0x180adf,{session:_0x2d9452})=>{if(_0x2d9452['id']===_0x5b30f6['mySessionId']){_0x180adf['off']();const _0x1e25b9=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0x10829a=_0x2d9452['permissions'];_0x1e25b9&&_0x1e25b9['isEnabled']&&(_0x10829a=_0x10829a['filter'](_0x47888e=>'document:write'!==_0x47888e)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0x10829a,this['_channelId']);}}),_0x5b30f6['register'](this['_channelId'],_0x77ef3);}_initThrowingOnDataSet(){const _0x539af8=this['editor']['data']['set'];this['editor']['data']['set']=(..._0xf409f)=>{if(!_0xf409f[_0xf409f['length']-0x1]['suppressErrorInCollaboration'])throw new _0xa752d3('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x539af8['apply'](this['editor']['data'],_0xf409f);};}_setUpDataInit(){this['editor']['data']['on']('init',(_0x53aa07,[_0xd46b9a])=>{if(this['_document']['version'])throw new _0xa752d3('realtimecollaborationclient-init-document-already-initialized',this);_0x53aa07['stop'](),this['_setPendingAction']();const _0x4391e4=Object['fromEntries'](Object['entries'](this['editor']['config']['get']('roots')||{})['filter'](([,_0x5123fa])=>!_0x5123fa['lazyLoad'])['map'](([_0x438cd9,_0x1111b2])=>[_0x438cd9,_0x1111b2['modelAttributes']||{}])),_0x22cfb7=this['_getOperationsFromInitData'](_0xd46b9a,_0x4391e4);0x0==_0x22cfb7['length']&&_0x22cfb7['push'](new _0xd0c2db(0x0)),_0x53aa07['return']=this['_connectService'](_0x22cfb7)['then'](()=>{this['editor']['plugins']['get'](z)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x5cf485=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x5cf485))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x666850,[_0x31c572,_0x276e47])=>{_0x666850['stop']();const _0x5d4c55=this['editor']['model']['document']['getRoot'](_0x31c572);if(!this['_knownRootNames']['has'](_0x31c572)){const _0x54bc3f=_0x276e47&&_0x276e47['data']?_0x276e47['data']:'',_0x22bb33=_0x276e47&&_0x276e47['attributes']?_0x276e47['attributes']:{};await this['_loadRoot'](_0x31c572,_0x54bc3f,_0x22bb33);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0x5d4c55['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0x5d4c55);});},{'priority':'high'});}async _fetchMissingUsers(_0x509193){const _0xefabd6=this['editor']['plugins']['get'](_0x2e4b5d),{connection:_0x4ad26f}=this['editor']['plugins']['get'](z),_0x44764c=new Set();for(const _0x5c54ed of _0x509193){const _0x258f34=_0x5c54ed['_authorId'];_0x258f34&&!_0xefabd6['getUser'](_0x258f34)&&_0x44764c['add'](_0x258f34);}if(0x0===_0x44764c['size'])return;const _0x7b41e1=await _0x326c07['getMany'](_0x4ad26f,Array['from'](_0x44764c));for(const _0x162b52 of _0x7b41e1)_0xefabd6['getUser'](_0x162b52['id'])||_0xefabd6['addUser'](_0x162b52);}_getOperationsFromInitData(_0x27abdd,_0x117856={}){const _0x35c791=this['editor']['model'],_0x1c844e=[];let _0x3e76bb=0x0;const _0x321b38='string'==typeof _0x27abdd?{'main':_0x27abdd}:_0x27abdd;for(const _0x317cff of Object['keys'](_0x321b38)){if(!this['_document']['roots']['has'](_0x317cff))throw new _0xa752d3('realtimecollaborationclient-init-non-existent-root',this);const _0x378a41=this['_document']['getRoot'](_0x317cff),_0x39b1d4=this['editor']['data']['parse'](_0x321b38[_0x317cff],_0x378a41),_0xb88d37=new _0x5c1955(_0x35c791['createPositionAt'](_0x378a41,0x0),_0x39b1d4,_0x3e76bb++);_0x1c844e['push'](_0xb88d37);for(const [_0x303090,_0x5a5cb1]of _0x39b1d4['markers']){const _0x3f1104=_0x35c791['createRange'](_0x35c791['createPositionFromPath'](_0x378a41,_0x5a5cb1['start']['path']['slice']()),_0x35c791['createPositionFromPath'](_0x378a41,_0x5a5cb1['end']['path']['slice']())),_0x2ea845=new _0x393ac7(_0x303090,null,_0x3f1104,_0x35c791['markers'],!0x0,_0x3e76bb++);_0x1c844e['push'](_0x2ea845);}}if(_0x117856)for(const [_0x361f01,_0x50dd59]of Object['entries'](_0x117856)){const _0x28e6ef=_0x35c791['document']['getRoot'](_0x361f01);if(!_0x28e6ef)throw new _0xa752d3('multi-root-editor-root-attributes-no-root',null);for(const [_0x2858bb,_0x30fb21]of Object['entries'](_0x50dd59))if(null!==_0x30fb21){const _0x1d5e8d=new _0x543856(_0x28e6ef,_0x2858bb,null,_0x30fb21,_0x3e76bb++);_0x1c844e['push'](_0x1d5e8d);}}return _0x1c844e;}async _loadRoot(_0x4403b2,_0x1d0c08,_0x2bd040){this['_getOperationsFromInitData']({[_0x4403b2]:_0x1d0c08},{[_0x4403b2]:_0x2bd040})['forEach']((_0x45a3da,_0x4aabf6)=>{_0x45a3da['baseVersion']=this['_document']['version']+_0x4aabf6,_0x45a3da['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x45a3da);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async _handleInitialConnectionData(_0x5682e6,_0x5759a0){let _0x3093d1;this['_offset']=_0x5682e6['offset'];const _0x7bc706=_0x5682e6['wereChangesApplied']&&!_0x5682e6['initData'],_0x9f09b=_0x7bc706?0x0:_0x5682e6['data']['baseVersion'];if(_0x5759a0['forEach'](_0x256652=>{_0x256652['_isInit']=!0x0,_0x256652['createdAt']=_0x5682e6['sessionCreatedAt'],_0x256652['_authorId']=null;}),_0x7bc706)_0x3093d1=_0x5759a0,this['_applyOperationsSet'](_0x3093d1,_0x7bc706);else{if(_0x5682e6['initData']){const _0x46e0eb=this['_getOperationsFromInitData'](_0x5682e6['initData']);this['_document']['history']['version']=-_0x46e0eb['length'],_0x46e0eb['forEach'](_0x190e8f=>{_0x190e8f['baseVersion']-=_0x46e0eb['length'],_0x190e8f['createdAt']=_0x5682e6['sessionCreatedAt'],_0x190e8f['_isInit']=!0x0,_0x190e8f['_authorId']=null;}),this['_applyOperationsSet'](_0x46e0eb,!0x0),this['serverHistory']['version']=-_0x46e0eb['length']+this['_offset'],this['_updateServerHistory'](_0x46e0eb);}this['_document']['history']['version']=_0x9f09b,_0x3093d1=this['_decompressOperations'](_0x5682e6['data'],_0x5682e6['metadata']),await this['_fetchMissingUsers'](_0x3093d1),this['_applyOperationsSet'](_0x3093d1,_0x7bc706);}_0x5682e6['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x3093d1,_0x5682e6['lastOperationId']),this['_lastSyncedOperationId']=_0x5682e6['lastOperationId']),this['serverHistory']['version']=_0x9f09b+this['_offset'],this['_updateServerHistory'](_0x3093d1),_0x5759a0['filter'](_0x2fdf5a=>{const _0x3f488d=this['_getAffectedRoot'](_0x2fdf5a);return _0x3f488d&&!this['_knownRootNames']['has'](_0x3f488d);})['forEach']((_0x511c85,_0x3c02fb)=>{_0x511c85['baseVersion']=this['_document']['version']+_0x3c02fb,this['_saveOperationInBuffer'](_0x511c85);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x3965c5,_0x1914aa){const _0x1af802=_0x1914aa&&_0x1914aa['message'];if(_0x1af802&&_0x1af802['startsWith']('realtimecollaborationclient'))throw _0x1914aa;const _0x233a9e=this['editor']['plugins']['get'](z);throw this['_isPendingUpdate']=!0x0,_0x233a9e['disconnect'](),this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0xa752d3(_0x3965c5,this['editor'],_0x1af802?{'originalError':_0x1af802}:void 0x0);}_saveOperationInBuffer(_0x32a97b){this['_knownOperations']['has'](_0x32a97b)||(this['_knownOperations']['add'](_0x32a97b),this['_bufferedOperations']['push'](_0x32a97b),this['_pendingAction']||'marker'==_0x32a97b['type']&&!_0x32a97b['affectsData']||this['_setPendingAction']());}_sendBufferedOperationsDelayed(_0x2890cc=!0x1){!_0x2890cc&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0x34e26e=>{_0x34e26e&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0x5ba660=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0x3c7151){return _0x3c7151['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x3c7151['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0x3c7151['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0x5ba660)||this['_crash'](_0x5ba660['message'],_0x5ba660);});},this['_currentBufferDelay']));}_waitUntilSynced(){return new Promise(_0x3c4c24=>{this['on']('change:_isPendingUpdate',()=>{_0x3c4c24();});});}async _sendBufferedOperations(){const _0xe89bdb=this['editor']['plugins']['get'](K);if(this['_shouldSendSelectionUpdate']()&&(_0xe89bdb['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x27f835=[...this['_bufferedOperations']];for(const _0x5edc61 of _0x27f835)_0x5edc61['wasUndone']=this['_document']['history']['isUndoneOperation'](_0x5edc61);const _0xc0d161=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x27f835),_0x25d285=Z++,_0x57e752=this['_compressOperations'](_0x27f835),_0x5d2dfd=await this['_service']['sendOperations'](_0x57e752,_0x57e752['baseVersion'],_0xc0d161);try{return await this['_handleServerResponse'](_0x27f835,_0x5d2dfd,_0x25d285);}catch(_0x265051){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0x265051);}}async['_handleServerResponse'](_0x5f463e,_0x5d99dd,_0x26d0a7){if('error'in _0x5d99dd)throw _0x5d99dd['error'];let _0x3a7b3a;if(_0x5d99dd['wereChangesApplied']){_0x5d99dd['lastOperationId']&&(this['_lastSyncedOperationId']=_0x5d99dd['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0xfd5884=>!_0x5f463e['includes'](_0xfd5884));for(const _0x1efa1c of _0x5f463e)_0x1efa1c['createdAt']='lastOperationAcceptedAt'in _0x5d99dd&&_0x5d99dd['lastOperationAcceptedAt']||void 0x0;st(_0x5f463e,_0x5d99dd['version']-_0x5f463e['length']),this['_updateServerHistory'](_0x5f463e);const _0x1bebb4=_0x5f463e['filter'](_0x107504=>{if(!_0x107504['_isInit'])return!0x1;const _0x1e4d6d=this['_getAffectedRoot'](_0x107504);return _0x1e4d6d&&!this['_knownRootNames']['has'](_0x1e4d6d);});st(_0x1bebb4,this['_document']['version']),this['_applyOperationsSet'](_0x1bebb4),_0x3a7b3a=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0x527fcc=this['_decompressOperations'](_0x5d99dd['data'],_0x5d99dd['metadata'])['filter'](_0x3e53f4=>_0x3e53f4['baseVersion']>=this['_lastServerVersion']);_0x527fcc['forEach'](_0x4e2f8a=>this['_addKnownRoot'](_0x4e2f8a)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x5ae444=>!_0x5ae444['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x5ae444))),this['_bufferedOperations']['length']&&st(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0x527fcc),_0x3a7b3a=this['_handleExternalOperations'](_0x527fcc,_0x5d99dd['version'],_0x5d99dd['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x3a7b3a?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}_handleExternalOperations(_0x18b3ff,_0x39b5eb,_0x2a9765){try{const _0x3a8ed7={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x5edb29,operationsB:_0x3759b6,originalOperations:_0x1bbb3c}=_0x3c1840(_0x18b3ff,this['_bufferedOperations'],_0x3a8ed7);st(_0x5edb29,this['_document']['version']),st(_0x3759b6,_0x39b5eb);for(const _0x2603f9 of _0x5edb29){const _0x1393b7=_0x1bbb3c['get'](_0x2603f9);_0x1393b7?(_0x2603f9['_authorId']=_0x1393b7['_authorId'],'noop'!==_0x2603f9['type']&&(_0x2603f9['_aiSource']=_0x1393b7['_aiSource'])):_0x2603f9['_authorId']=null;}for(const _0x2a46a8 of _0x3759b6)'noop'!==_0x2a46a8['type']&&(_0x2a46a8['_aiSource']=_0x1bbb3c['get'](_0x2a46a8)?.['_aiSource']);_0x2a9765&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x18b3ff,_0x2a9765),this['_lastSyncedOperationId']=_0x2a9765),this['_bufferedOperations']=[..._0x3759b6],this['_applyOperationsSet'](_0x5edb29),this['_updateServerHistory'](_0x18b3ff);}catch(_0x58cf77){return console['error'](_0x58cf77),!0x1;}return!0x0;}_applyOperationsSet(_0x39de5b,_0x5afebf=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0x1d7604=>{for(const _0x409184 of _0x39de5b)this['_knownOperations']['add'](_0x409184),this['_addKnownRoot'](_0x409184),_0x1d7604['batch']['addOperation'](_0x409184),this['editor']['model']['applyOperation'](_0x409184);});}_addKnownRoot(_0x4e2e5d){const _0x334810=this['_getAffectedRoot'](_0x4e2e5d);_0x334810&&this['_knownRootNames']['add'](_0x334810);}_getAffectedRoot(_0x42ffa6){let _0x21620a,_0x4dd83f;switch(_0x42ffa6['type']){case'insert':_0x21620a=_0x42ffa6['position']['root'];break;case'marker':if(_0x4dd83f=_0x42ffa6['newRange'],!_0x4dd83f)return null;_0x21620a=_0x4dd83f['root'];break;case'addRootAttribute':_0x21620a=_0x42ffa6['root'];break;case'addRoot':_0x21620a=_0x42ffa6['affectedSelectable'];break;case'move':_0x21620a=_0x42ffa6['targetPosition']['root'];break;default:return null;}return _0x21620a['rootName'];}_updateServerHistory(_0x254b44){_0x254b44['forEach'](_0x323ced=>{const _0x57509f=_0x323ced['clone']();_0x57509f['_authorId']=_0x323ced['_authorId'],_0x57509f['_isInit']=!!_0x323ced['_isInit'],_0x57509f['_aiSource']=_0x323ced['_aiSource'],_0x57509f['createdAt']=_0x323ced['createdAt'],_0x57509f['baseVersion']+=this['_offset'],_0x323ced['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x57509f),this['serverHistory']['addOperation'](_0x57509f);});}_handleReconnectionError(_0x7f787b){const _0x5f0403=this['editor']['plugins']['get']('Notification'),_0x47f4c8=this['editor']['locale'];_0x7f787b||(_0x7f787b=X(_0x47f4c8,'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.')),_0x5f0403['showWarning'](_0x7f787b,{'title':X(_0x47f4c8,'Synchronization\x20issue'),'namespace':'real-time-collaboration'}),this['_hasSynchronizationProblem']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_bufferedOperations']=[],this['editor']['plugins']['get'](z)['disconnect']();}_setPendingAction(){this['_pendingAction']||(this['_pendingAction']=this['editor']['plugins']['get'](_0x36d7c3)['add'](X(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}_clearPendingAction(){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x36d7c3)['remove'](this['_pendingAction']),this['_pendingAction']=null);}_compressOperations(_0x22b83c){const _0x425c6f=_0x22b83c['map'](_0x4d84b2=>_0x4d84b2['toJSON']());return this['_compressor']['compress'](_0x425c6f);}_decompressOperations(_0x164e8c,_0x27dc6f){return this['_compressor']['decompress'](_0x164e8c)['map']((_0x2e781a,_0x1835dc)=>{const _0x14983d='init'==_0x27dc6f[_0x1835dc]['type'];if('InsertOperation'==_0x2e781a['__className']){const _0x3b698d=_0x2e781a['position']['root'];!this['_document']['getRoot'](_0x3b698d)&&(this['_document']['createRoot']('$unknown',_0x3b698d)['_isAttached']=!0x1);}else{if('RootOperation'==_0x2e781a['__className']){const _0x87fb17=this['_document']['getRoot'](_0x2e781a['rootName']);_0x87fb17&&'$unknown'==_0x87fb17['name']&&_0x2e781a['elementName']!=_0x87fb17['name']&&(_0x87fb17['name']=_0x2e781a['elementName']);}}const _0x26f8b6=_0x3f7ebd['fromJSON'](_0x2e781a,this['_document']);return _0x26f8b6['wasUndone']=_0x2e781a['wasUndone'],_0x26f8b6['_isInit']=_0x14983d,_0x26f8b6['_authorId']=_0x14983d?null:_0x27dc6f[_0x1835dc]['userId'],_0x26f8b6['_isDisconnection']='cs:removeUser'===_0x27dc6f[_0x1835dc]['type'],_0x26f8b6['_aiSource']=_0x2e781a['_aiSource']||void 0x0,_0x26f8b6['createdAt']=_0x27dc6f[_0x1835dc]['createdAt'],_0x26f8b6;});}_refreshUserSelectionMarkers(){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}_shouldSendSelectionUpdate(){const _0x1f90fb=this['editor']['plugins']['get'](Y)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0x1f90fb&&_0x1f90fb['length']>0x1&&this['_hasSelectionChanged'];}_shouldSendUpdate(){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}},et=class extends Error{};function st(_0x19b5dd,_0x1b2d7d){for(const _0x4edf63 of _0x19b5dd)_0x4edf63['baseVersion']=_0x1b2d7d++;}var it=class{_ignoredOperations;_operationToId;constructor(_0x47cd9d){this['_ignoredOperations']=_0x47cd9d,this['_operationToId']=new WeakMap();}getIdOfTheLastOperation(_0x437815){let _0x3086b2=_0x437815['length'];for(;_0x3086b2--;){const _0x2b62f2=_0x437815[_0x3086b2];if(!this['_ignoredOperations']['has'](_0x2b62f2)){if(!this['_operationToId']['has'](_0x2b62f2)){const _0x1c7ecd=_0x4ad382()['slice'](0x1,0x12);this['_operationToId']['set'](_0x2b62f2,_0x1c7ecd);}return this['_operationToId']['get'](_0x2b62f2);}}}setIdForTheLastOperation(_0x2b50b0,_0x1b8907){if(!_0x1b8907)return;let _0x3a681d=_0x2b50b0['length'];for(;_0x3a681d--;){const _0x3d9974=_0x2b50b0[_0x3a681d];this['_ignoredOperations']['has'](_0x3d9974)||this['_operationToId']['set'](_0x3d9974,_0x1b8907);}}},nt=class extends _0x55ae44{static get requires(){return[tt];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},ot=class CloudServicesCommentsAdapter extends _0x181a27{static CommentsService=/* #__PURE__ -- @preserve */
|
|
26
|
+
((()=>_0x2d8629)());['_services'];static get requires(){return[z,_0x299e96,Y,_0x2e4b5d];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x50149f){super(_0x50149f),this['_services']=new Map();}async init(){const _0x1a119b=this['context'],_0x569142=_0x1a119b['plugins']['get'](_0x299e96);if(_0x1a119b['plugins']['get'](z)['addToReconnectionStack'](this),_0x569142['adapter']={'addCommentThread':async({channelId:_0x402eee,threadId:_0x210728,comments:_0x32f185,resolvedAt:_0x318b28,resolvedBy:_0x491fd1,context:_0x178447,attributes:_0x7afa46})=>{const _0x2a7019=await this['_getService'](_0x402eee)['addCommentThread']({'commentThreadId':_0x210728,'comments':_0x32f185['map'](_0x224524=>function(_0x447515,_0x2103ae,_0x5f0066){return{'commentThreadId':_0x5f0066,'commentId':_0x447515['commentId'],'userId':_0x447515['authorId'],'content':_0x447515['content'],'documentId':_0x2103ae,'createdAt':_0x447515['createdAt'],'attributes':_0x447515['attributes']||{}};}(_0x224524,_0x402eee,_0x210728)),'resolvedAt':_0x318b28,'resolvedBy':_0x491fd1,'context':_0x178447,'attributes':_0x7afa46})['catch'](ct);return{'threadId':_0x2a7019['commentThreadId'],'comments':_0x2a7019['comments']};},'getCommentThread':async({channelId:_0x5bb6bd,threadId:_0x33fd5b})=>{const _0x1961de=await this['_getService'](_0x5bb6bd)['getCommentThread'](_0x33fd5b)['catch'](rt)['catch'](ct);return _0x1961de?_0x1961de['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0x1961de]),{'threadId':_0x1961de['commentThreadId'],'comments':_0x1961de['comments']['map'](at),'context':_0x1961de['context'],'resolvedAt':_0x1961de['resolvedAt'],'resolvedBy':_0x1961de['resolvedBy'],'attributes':_0x1961de['attributes']||{}}):null;},'updateCommentThread':async({channelId:_0x2fd83d,threadId:_0x18a5a8,context:_0x2a3526,unlinkedAt:_0x1daed7,attributes:_0x54a4f2})=>this['_getService'](_0x2fd83d)['updateCommentThread']({'commentThreadId':_0x18a5a8,'context':_0x2a3526,'attributes':_0x54a4f2,'unlinkedAt':_0x1daed7})['catch'](rt)['catch'](ct),'resolveCommentThread':async({channelId:_0x29c765,threadId:_0x31257f})=>{const _0x53239b=await this['_getService'](_0x29c765)['resolveCommentThread'](_0x31257f)['catch'](rt)['catch'](ct);return{'threadId':_0x53239b['commentThreadId'],'resolvedAt':_0x53239b['resolvedAt'],'resolvedBy':_0x53239b['resolvedBy']};},'reopenCommentThread':async({channelId:_0x38ba25,threadId:_0x110981})=>this['_getService'](_0x38ba25)['reopenCommentThread'](_0x110981)['catch'](rt)['catch'](ct),'removeCommentThread':({channelId:_0x255848,threadId:_0x45d26a})=>this['_getService'](_0x255848)['removeCommentThread'](_0x45d26a)['catch'](rt)['catch'](ct),'addComment':({channelId:_0x395d7e,threadId:_0x2a1ee3,commentId:_0x42044d,content:_0x46bbb2,attributes:_0x1059bb})=>this['_getService'](_0x395d7e)['addComment'](_0x2a1ee3,_0x42044d,_0x46bbb2,_0x1059bb)['catch'](ct),'updateComment':({channelId:_0x4170c3,threadId:_0x1092b4,commentId:_0x5c8eba,content:_0xcad155,attributes:_0x35d6b0})=>this['_getService'](_0x4170c3)['updateComment'](_0x1092b4,_0x5c8eba,_0xcad155,_0x35d6b0)['catch'](rt)['catch'](ct),'removeComment':({channelId:_0x275355,threadId:_0x484401,commentId:_0x572457})=>this['_getService'](_0x275355)['removeComment'](_0x484401,_0x572457)['catch'](rt)['catch'](ct)},_0x1a119b instanceof _0x4b9058){const _0x5550bb=_0x1a119b['config']['get']('collaboration.channelId'),_0x539a38=_0x1a119b['plugins']['get'](Y);await this['_setUpService'](_0x5550bb);const _0x5c2673=await this['_services']['get'](_0x5550bb)['getConnectedSessions']();this['listenTo'](_0x539a38,'sessionAdd:'+_0x5550bb,(_0x133baf,{session:_0x353760})=>{_0x353760['id']===_0x539a38['mySessionId']&&(_0x133baf['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x353760['permissions'],_0x5550bb));}),_0x539a38['register'](_0x5550bb,_0x5c2673);}}async _setUpService(_0x140921){if(this['_services']['has'](_0x140921))throw new _0xa752d3('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0x140921});const _0x5e2fe8=this['context']['plugins']['get'](_0x299e96),_0x59aca5=new CloudServicesCommentsAdapter['CommentsService'](_0x140921);this['_services']['set'](_0x140921,_0x59aca5),this['listenTo'](_0x59aca5,'commentThreadAdded',(_0x1599f9,_0x51ec1f)=>{const {commentThreadId:_0x4d0890,documentId:_0x50b465,context:_0x12e072,attributes:_0x569920,resolvedAt:_0x71fc59,resolvedBy:_0x248197,comments:_0x768e46}=_0x51ec1f;_0x5e2fe8['getCommentThread'](_0x4d0890)||_0x5e2fe8['addCommentThread']({'threadId':_0x4d0890,'channelId':_0x50b465,'comments':_0x768e46?_0x768e46['map'](at):[],'context':_0x12e072,'attributes':_0x569920,'resolvedAt':_0x71fc59,'resolvedBy':_0x248197,'isFromAdapter':!0x0});}),this['listenTo'](_0x59aca5,'commentThreadUpdated',(_0x16a661,{commentThreadId:_0x5ede16,documentId:_0x1698d4,context:_0x16f3b2,unlinkedAt:_0x3ed646,attributes:_0x254eaa})=>{_0x5e2fe8['getCommentThread'](_0x5ede16)&&_0x5e2fe8['updateCommentThread']({'threadId':_0x5ede16,'channelId':_0x1698d4,'context':_0x16f3b2,'unlinkedAt':_0x3ed646,'attributes':_0x254eaa,'isFromAdapter':!0x0});}),this['listenTo'](_0x59aca5,'commentThreadResolved',(_0x368bb0,{commentThreadId:_0x41afef,resolvedBy:_0x2bfd6b,resolvedAt:_0x3eeab2})=>{const _0x2c0c1e=_0x5e2fe8['getCommentThread'](_0x41afef);_0x2c0c1e&&_0x2c0c1e['resolve']({'resolvedBy':_0x2bfd6b,'resolvedAt':_0x3eeab2,'isFromAdapter':!0x0});}),this['listenTo'](_0x59aca5,'commentThreadReopened',(_0xcc3f6d,{commentThreadId:_0x572239})=>{const _0x5f1db0=_0x5e2fe8['getCommentThread'](_0x572239);_0x5f1db0&&_0x5f1db0['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0x59aca5,'commentThreadRemoved',(_0x4a27f3,{commentThreadId:_0x2fbb5d})=>{const _0x1dc2cf=_0x5e2fe8['getCommentThread'](_0x2fbb5d);_0x1dc2cf&&_0x1dc2cf['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0x59aca5,'commentAdded',(_0x327d20,_0x258cc3)=>{const _0x6b18d2=_0x258cc3['commentThreadId'],_0x26df1e=_0x5e2fe8['getCommentThread'](_0x6b18d2);_0x26df1e&&_0x26df1e['addComment']({...at(_0x258cc3),'isFromAdapter':!0x0});}),this['listenTo'](_0x59aca5,'commentUpdated',(_0x4ad0d5,{commentThreadId:_0xf946a0,commentId:_0x1ed519,content:_0x47a7c6,attributes:_0x45b18f})=>{const _0x520ce0=_0x5e2fe8['getCommentThread'](_0xf946a0);if(_0x520ce0){const _0x5624f1=_0x520ce0['getComment'](_0x1ed519);_0x5624f1&&_0x5624f1['update']({'content':_0x47a7c6,'attributes':_0x45b18f,'isFromAdapter':!0x0});}}),this['listenTo'](_0x59aca5,'commentRemoved',(_0x4aebc0,{commentThreadId:_0x2d8bba,commentId:_0x38aeca})=>{const _0x4efa3a=_0x5e2fe8['getCommentThread'](_0x2d8bba);if(_0x4efa3a){const _0x911b00=_0x4efa3a['getComment'](_0x38aeca);_0x911b00&&_0x911b00['remove']({'isFromAdapter':!0x0});}}),this['listenTo'](_0x59aca5,'disconnected',()=>{'connected'===this['context']['plugins']['get'](z)['connection']?.['state']&&(this['_services']['delete'](_0x140921),this['stopListening'](_0x59aca5));}),await this['_connectService'](_0x140921);}destroy(){if(this['context']instanceof _0x4b9058){const _0x612cb4=this['context']['config']['get']('collaboration.channelId');this['_services']['has'](_0x612cb4)&&this['_terminateService'](_0x612cb4);}}_terminateService(_0x40d75a){if(!this['_services']['has'](_0x40d75a))throw new _0xa752d3('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0x40d75a});this['_getService'](_0x40d75a)['disconnect'](),this['_services']['delete'](_0x40d75a);}async reconnect(){for(const _0x3bb637 of this['_services']['keys']())await this['_connectService'](_0x3bb637);if(this['context']instanceof _0x4b9058){const _0x4d133e=this['context']['config']['get']('collaboration.channelId');if(this['_services']['has'](_0x4d133e)){const _0x20089a=this['context']['plugins']['get'](Y);_0x20089a['unregister'](_0x4d133e);const _0x462659=await this['_services']['get'](_0x4d133e)['getConnectedSessions']();_0x20089a['register'](_0x4d133e,_0x462659);}}}async _connectService(_0x4d7fab){const {connection:_0x40b788}=this['context']['plugins']['get'](z),_0x5177f1=this['context']['plugins']['get'](_0x299e96),_0x2ee9fa=await this['_services']['get'](_0x4d7fab)['connect'](_0x40b788);await this['_fetchMissingUsersForThreads'](_0x2ee9fa);const _0x52069b=new Set(Array['from'](_0x5177f1['getCommentThreads']({'channelId':_0x4d7fab}),_0x412e29=>_0x412e29['id']));for(const _0x137021 of _0x2ee9fa)_0x137021['deletedAt']||_0x52069b['delete'](_0x137021['commentThreadId']);for(const _0xe5999b of _0x52069b)_0x5177f1['getCommentThread'](_0xe5999b)['remove']({'isFromAdapter':!0x0});for(const _0x40d108 of _0x2ee9fa){let _0x5c1fdd=_0x5177f1['getCommentThread'](_0x40d108['commentThreadId']);const {commentThreadId:_0x43416e,context:_0x1cd80a,attributes:_0x453e5c,resolvedBy:_0x378911,resolvedAt:_0x3f9b1a,unlinkedAt:_0x408377,deletedAt:_0x48b05a}=_0x40d108;if(_0x48b05a)continue;_0x5c1fdd||(_0x5c1fdd=_0x5177f1['addCommentThread']({'channelId':_0x4d7fab,'threadId':_0x43416e,'context':_0x1cd80a,'attributes':_0x453e5c||{},'resolvedBy':_0x378911,'resolvedAt':_0x3f9b1a,'unlinkedAt':_0x408377,'isFromAdapter':!0x0}));const _0x2f8fd9=new Set(Array['from'](_0x5c1fdd['comments'],_0x2e8ecb=>_0x2e8ecb['id']));for(const _0x3b7db3 of _0x40d108['comments'])_0x2f8fd9['delete'](_0x3b7db3['commentId']);for(const _0x1e9c6a of _0x2f8fd9)_0x5c1fdd['getComment'](_0x1e9c6a)['remove']({'isFromAdapter':!0x0});for(const _0x27fc15 of _0x40d108['comments']){const _0x35c16e=_0x5c1fdd['getComment'](_0x27fc15['commentId']);_0x35c16e?_0x35c16e['content']!==_0x27fc15['content']&&_0x35c16e['update']({'content':_0x27fc15['content'],'isFromAdapter':!0x0}):_0x5c1fdd['addComment'](Object['assign'](at(_0x27fc15),{'isFromAdapter':!0x0}));}}}_getService(_0xa2d483){if(!this['_services']['has'](_0xa2d483))throw new _0xa752d3('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0xa2d483});return this['_services']['get'](_0xa2d483);}async _fetchMissingUsersForThreads(_0x573326){const _0x12d094=this['context']['plugins']['get'](_0x2e4b5d),{connection:_0x265b82}=this['context']['plugins']['get'](z),_0xa63bb4=new Set();for(const {resolvedBy:_0x3502a8,comments:_0x3d0d8e}of _0x573326){_0x3502a8&&!_0x12d094['getUser'](_0x3502a8)&&_0xa63bb4['add'](_0x3502a8);for(const {userId:_0x100f95}of _0x3d0d8e)_0x12d094['getUser'](_0x100f95)||_0xa63bb4['add'](_0x100f95);}if(0x0===_0xa63bb4['size'])return;const _0x34de3c=await _0x326c07['getMany'](_0x265b82,Array['from'](_0xa63bb4));for(const _0x580d54 of _0x34de3c)_0x12d094['getUser'](_0x580d54['id'])||_0x12d094['addUser'](_0x580d54);}};async function rt(_0x371526){if('404'!==_0x371526['code'])throw _0x371526;}function ct(_0x255a5a){if((_0x19e980=_0x255a5a)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0x19e980['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x19e980['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0x19e980;throw _0x255a5a;}function at(_0x3f003a){return{'threadId':_0x3f003a['commentThreadId'],'commentId':_0x3f003a['commentId'],'content':_0x3f003a['content'],'createdAt':_0x3f003a['createdAt'],'authorId':_0x3f003a['userId'],'attributes':_0x3f003a['attributes']||{}};}var ht=class CloudServicesTrackChangesAdapter extends _0x55ae44{static ['TrackChangesService']=/* #__PURE__ -- @preserve */
|
|
27
|
+
((()=>_0x556600)());_bufferedRequests;_trackChangesService;static get requires(){return[ot,_0x18cb04,z];}static get['pluginName'](){return'CloudServicesTrackChangesAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x4deb72){super(_0x4deb72);const _0x2a924e=this['editor']['config']['get']('collaboration.channelId');this['_bufferedRequests']=new Map(),this['_trackChangesService']=new CloudServicesTrackChangesAdapter['TrackChangesService'](_0x2a924e);}init(){const _0x178400=this['editor']['plugins']['get'](z),_0xccc286=this['editor']['plugins']['get'](_0x18cb04);return _0xccc286['adapter']={'getSuggestion':async _0x5cdc6c=>{await this['_waitForServiceReady']();const _0x3a7f83=await this['_trackChangesService']['get'](_0x5cdc6c)['catch'](lt);return await this['_fetchMissingUsersForThreads']([_0x3a7f83]),_0x3a7f83;},'addSuggestion':async({id:_0x2d232c,type:_0x18806c,data:_0x41ee75,originalSuggestionId:_0x42fbb1,attributes:_0x12eeca})=>{await this['_waitForServiceReady']();const _0x1e696a={'id':_0x2d232c,'type':_0x18806c,'data':_0x41ee75,'originalSuggestionId':_0x42fbb1,'attributes':_0x12eeca},_0x20ca66=await this['_trackChangesService']['add'](_0x2d232c,_0x18806c,_0x41ee75,_0x42fbb1,_0x12eeca)['catch'](_0x269f89=>{if(dt(_0x269f89))return new Promise(_0x57de85=>{this['_bufferedRequests']['set'](_0x2d232c,{'resolve':_0x57de85,'suggestionData':_0x1e696a});});throw _0x269f89;});return this['_bufferedRequests']['delete'](_0x2d232c),_0x20ca66;},'updateSuggestion':async(_0x384df1,_0xaf007b)=>{if(await this['_waitForServiceReady'](),'open'!==_0xaf007b['state'])return this['_trackChangesService']['update'](_0x384df1,_0xaf007b)['catch'](lt);}},this['listenTo'](this['_trackChangesService'],'suggestionUpdated',(_0x16f6e0,_0x56acf4)=>{_0xccc286['hasSuggestion'](_0x56acf4['id'])&&(_0xccc286['getSuggestion'](_0x56acf4['id'])['attributes']=_0x56acf4['attributes']);}),this['listenTo'](this['_trackChangesService'],'disconnected',()=>{'connected'===_0x178400['connection']?.['state']&&(_0x178400['removeFromReconnectionStack'](this),this['stopListening'](this['_trackChangesService']));}),this['_trackChangesService']['connect'](_0x178400['connection'])['then'](_0x3ffc44=>(_0x178400['addToReconnectionStack'](this),this['_fetchMissingUsersForThreads'](_0x3ffc44)['then'](()=>{for(const _0x1eeb06 of _0x3ffc44){_0xccc286['addSuggestionData'](_0x1eeb06)['_saved']=!0x0;}})));}async reconnect(){const _0x572d82=this['editor']['plugins']['get']('TrackChangesEditing'),{connection:_0xff8024}=this['editor']['plugins']['get'](z),_0x4b9e70=await this['_trackChangesService']['connect'](_0xff8024);await this['_fetchMissingUsersForThreads'](_0x4b9e70);for(const {suggestionData:_0x4a3a41,resolve:_0x1df044}of this['_bufferedRequests']['values']()){let _0x1c15af=_0x4b9e70['find'](_0x1cbd59=>_0x1cbd59['id']===_0x4a3a41['id']);_0x1c15af||(_0x1c15af=await this['_trackChangesService']['add'](_0x4a3a41['id'],_0x4a3a41['type'],_0x4a3a41['data'],_0x4a3a41['originalSuggestionId'])),_0x1df044(_0x1c15af);}for(const _0x24a66f of _0x4b9e70)_0x572d82['hasSuggestion'](_0x24a66f['id'])||_0x572d82['addSuggestionData'](_0x24a66f);}async _waitForServiceReady(){this['_trackChangesService']['isConnected']||await new Promise(_0xaf4037=>{this['listenTo'](this['_trackChangesService'],'connected',_0x397f17=>{_0x397f17['off'](),_0xaf4037();});});}async _fetchMissingUsersForThreads(_0x4ed935){const _0x10c599=this['editor']['plugins']['get'](_0x2e4b5d),{connection:_0x1d766b}=this['editor']['plugins']['get'](z),_0x1a7746=new Set();for(const {authorId:_0x2a8954}of _0x4ed935)_0x10c599['getUser'](_0x2a8954)||_0x1a7746['add'](_0x2a8954);if(0x0===_0x1a7746['size'])return;const _0xbdbedb=await _0x326c07['getMany'](_0x1d766b,Array['from'](_0x1a7746));for(const _0x2a5d51 of _0xbdbedb)_0x10c599['getUser'](_0x2a5d51['id'])||_0x10c599['addUser'](_0x2a5d51);}};function lt(_0x52fda5){if(dt(_0x52fda5))return new Promise(()=>{});throw _0x52fda5;}function dt(_0x2a8724){return _0x2a8724['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x2a8724['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}var ut=class extends _0x55ae44{static get requires(){return[_0x282b1b,ot,nt,z];}static get['pluginName'](){return'RealTimeCollaborativeComments';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const _0x756e91=this['editor']['plugins']['get'](z),_0x55f5fa=this['editor']['plugins']['get'](_0x6108de),_0x3cc403=this['editor']['plugins']['get'](ot);return this['editor']['data']['once']('ready',()=>{this['listenTo'](_0x756e91,'change:state',(_0x326674,_0x3fe890,_0x534856)=>{_0x55f5fa['isThreadsLoadingPaused']='connected'!==_0x534856;});}),this['listenTo'](_0x756e91,'change:state',(_0x38bc81,_0x5552fb,_0x25253d)=>{this['editor']['plugins']['get'](_0x299e96)['switchReadOnly']('connected'!==_0x25253d);}),_0x3cc403['_setUpService'](this['editor']['config']['get']('collaboration.channelId'));}destroy(){const _0x452bc0=this['editor']['plugins']['get'](ot),_0x2a0b81=this['editor']['config']['get']('collaboration.channelId');_0x452bc0['_services']['has'](_0x2a0b81)&&_0x452bc0['_terminateService'](_0x2a0b81),super['destroy']();}},ft=class extends _0x55ae44{static get requires(){return[ut,ht,_0x2955eb];}static get['pluginName'](){return'RealTimeCollaborativeTrackChanges';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},mt=class CloudServicesRevisionHistoryAdapter extends _0x55ae44{static RevisionHistoryService=/* #__PURE__ -- @preserve */
|
|
28
|
+
((()=>_0x195a98)());_lastRequestId;['_revisionTracker'];_revisionHistoryService;_oldOffset;static get requires(){return[z,tt,_0x2d2cfb,Y,_0x2e4b5d];}static get['pluginName'](){return'CloudServicesRevisionHistoryAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x43f96a){super(_0x43f96a);const _0x17f00f=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new CloudServicesRevisionHistoryAdapter['RevisionHistoryService'](_0x17f00f);}async init(){const _0x1046a3=this['editor']['plugins']['get'](tt),_0x1d4c32=_0x1046a3['serverHistory'],_0x220237=this['editor']['plugins']['get'](z);this['_revisionTracker']['setSource']({'history':_0x1d4c32,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0x1046a3['sessionId']});const _0x5ce659=this['editor']['config']['get']('cloudServices.bundleVersion')||_0x559256,_0x18fad3=await _0x214476['isBundleUploaded'](_0x220237['connection'],_0x5ce659);this['editor']['plugins']['get'](_0x2d2cfb)['adapter']={'getRevision':async({revisionId:_0x435b9a})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0x435b9a)),'updateRevisions':async _0x91194e=>{await this['_waitForServiceReady']();const _0x42f21e=this['_revisionTracker']['currentRevision'];if(_0x18fad3&&0x1===_0x91194e['length']&&_0x91194e[0x0]['id']===_0x42f21e['id'])return _0x91194e;for(const _0x236585 of _0x91194e)_0x236585['id']===_0x42f21e['id']&&(_0x236585['isEmptyCurrent']=_0x236585['fromVersion']===_0x236585['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0x91194e,this['_lastRequestId'])['then'](_0xec1564=>(this['_lastRequestId']=_0xec1564,_0x91194e))['catch'](_0x24b655=>{if(pt(_0x24b655)||'400'===_0x24b655['code']&&void 0x0!==_0x24b655['data']['wrongRequestId']){for(const _0xda8528 of _0x91194e)this['_revisionTracker']['repository']['getRevision'](_0xda8528['id'])&&this['_revisionTracker']['_bufferUpdate'](_0xda8528['id'],_0xda8528,!0x1);if(pt(_0x24b655)&&'destroyed'!==this['editor']['state'])throw _0x24b655;return _0x91194e;}throw _0x24b655;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0x101aa2,{revisionsData:_0x4af1b4,requestId:_0x58e759})=>{Math['max'](..._0x4af1b4['map'](_0x3e9f5e=>_0x3e9f5e['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0x4af1b4,_0x58e759);}):this['_handleRevisionsUpdate'](_0x4af1b4,_0x58e759);}),this['set']('_isServiceConnected',!0x1),this['listenTo'](this['_revisionHistoryService'],'connected',()=>{this['_isServiceConnected']=!0x0;}),this['listenTo'](this['_revisionHistoryService'],'disconnected',()=>{this['_isServiceConnected']=!0x1,'connected'===_0x220237['connection']?.['state']&&(_0x220237['removeFromReconnectionStack'](this),this['stopListening'](this['_revisionHistoryService']));});const {revisions:_0x78e15d,requestId:_0x27afcb}=await this['_revisionHistoryService']['connect'](_0x220237['connection']);_0x220237['addToReconnectionStack'](this),this['_lastRequestId']=_0x27afcb,await this['_fetchMissingUsers'](_0x78e15d);for(const _0x2e0155 of _0x78e15d)this['_revisionTracker']['addRevisionData'](_0x2e0155);this['listenTo'](_0x1046a3,'change:_isConnected',(_0x196455,_0x82d996,_0x13fbb5)=>{_0x13fbb5&&(this['_oldOffset']=_0x1046a3['_offset'],_0x196455['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](this,'_isServiceConnected');}async reconnect(){const _0x2d5b62=this['editor']['plugins']['get'](z),_0x34b524=this['editor']['plugins']['get'](tt),_0x311412=async()=>{const _0x5483de=this['_revisionTracker']['currentRevision'],_0x55d419=_0x5483de['id'],_0x2f8427=_0x55d419!==_0x34b524['sessionId'];if(_0x2f8427){const _0x501053=_0x34b524['_offset']-this['_oldOffset'],_0x42c0be=this['_getLatestVersionFromServerOperations']();if(this['_revisionTracker']['_revisionDataBuilder']['reInit'](),_0x5483de['toVersion']+_0x501053!==_0x42c0be){const _0x5c689c=_0x5483de['fromVersion']+_0x501053,_0x16ac93=this['editor']['plugins']['get'](_0x2e4b5d),_0x2c2017=this['_revisionTracker']['buildRevisionData']({'revision':_0x5483de,'from':_0x5c689c,'to':_0x42c0be});_0x2c2017['id']=_0x5483de['id'];const _0x38e2c2=_0x2c2017['authorsIds']['map'](_0x3b7956=>_0x16ac93['getUser'](_0x3b7956));_0x5483de['_update']({..._0x2c2017,'authors':_0x38e2c2},!0x0),this['_revisionTracker']['_bufferUpdate'](_0x5483de['id'],_0x2c2017,!0x0);}this['_revisionTracker']['_startingVersion']=_0x42c0be,_0x5483de['toVersion']!==_0x5483de['fromVersion']||this['_revisionTracker']['_bufferedUpdates']['has'](_0x55d419)||this['_revisionTracker']['repository']['_revisions']['remove'](_0x55d419),this['_revisionTracker']['_createCurrentRevision'](_0x42c0be);}const {revisions:_0x367f81,requestId:_0x287bf1}=await this['_revisionHistoryService']['reconnect'](_0x2d5b62['connection'],this['_lastRequestId']);_0x2f8427&&_0x367f81['length']>0x0?_0x34b524['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x367f81),this['_handleRevisionsUpdate'](_0x367f81,_0x287bf1),this['_revisionTracker']['sendBufferedUpdates']());};return _0x34b524['_isConnected']?_0x311412():new Promise((_0x3d58f8,_0x25e291)=>{_0x34b524['once']('change:_isConnected',()=>{_0x311412()['then'](_0x3d58f8)['catch'](_0x25e291);});});}destroy(){super['destroy']();}async _waitForServiceReady(){this['_revisionHistoryService']['isConnected']||await new Promise(_0x47ecec=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x5aaf84=>{_0x5aaf84['off'](),_0x47ecec();});});}_getLatestVersionFromServerOperations(){const _0x4731e8=this['editor']['plugins']['get'](tt)['serverHistory']['getOperations']()['reverse']();for(const _0x42cde9 of _0x4731e8)if('marker'!==_0x42cde9['type']||_0x42cde9['affectsData'])return _0x42cde9['baseVersion']+0x1;}_getLatestVersion(){const _0x31723a=this['editor']['plugins']['get'](tt);return new Promise(_0x31aa11=>{_0x31723a['_isPendingUpdate']?_0x31723a['once']('change:_isPendingUpdate',()=>{_0x31aa11(this['_getLatestVersionFromServerOperations']());}):_0x31aa11(this['_getLatestVersionFromServerOperations']());});}_handleRevisionsUpdate(_0x38a4d6,_0x41a050){const _0x50d18d=this['_revisionTracker']['repository'];this['_lastRequestId']=_0x41a050;for(const _0x88c385 of _0x38a4d6){const _0x2e82e=_0x50d18d['getRevision'](_0x88c385['id']);if(_0x2e82e){if((_0x88c385['fromVersion']||_0x88c385['toVersion'])&&(_0x88c385['diffData']=null),_0x2e82e===this['_revisionTracker']['currentRevision']){const _0x269bc9=Math['max'](_0x2e82e['toVersion'],_0x88c385['toVersion']),_0x2afbd0=Math['max'](_0x2e82e['fromVersion'],_0x88c385['fromVersion']);let _0x28ab95;_0x2e82e['toVersion']===_0x88c385['toVersion']&&_0x2e82e['fromVersion']===_0x88c385['fromVersion']?(_0x28ab95=!0x0,this['_preventResendingRevisionData'](_0x88c385)):_0x88c385['toVersion']===_0x269bc9&&_0x88c385['fromVersion']===_0x2afbd0?_0x28ab95=!0x1:(_0x2e82e['toVersion']===_0x269bc9&&_0x2e82e['fromVersion']===_0x2afbd0||this['_fixRevision']({'revision':_0x2e82e,'from':_0x2afbd0,'to':_0x269bc9}),_0x28ab95=!0x0),_0x28ab95&&(delete _0x88c385['fromVersion'],delete _0x88c385['toVersion'],delete _0x88c385['diffData'],delete _0x88c385['createdAt'],delete _0x88c385['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0x88c385),this['_preventResendingRevisionData'](_0x88c385);}else this['_revisionTracker']['addRevisionData'](_0x88c385);}const _0x172c83=_0x50d18d['getRevisions']();_0x172c83['reverse']();for(let _0x4595d9=0x0;_0x4595d9<_0x172c83['length']-0x1;_0x4595d9++){const _0x1da82f=_0x172c83[_0x4595d9],_0x13b862=_0x172c83[_0x4595d9+0x1];if(_0x1da82f['fromVersion']<_0x13b862['toVersion']){const _0x46d2e1=_0x13b862['toVersion'],_0x31a711=Math['max'](_0x46d2e1,_0x1da82f['toVersion']);this['_fixRevision']({'revision':_0x1da82f,'from':_0x46d2e1,'to':_0x31a711});}}}['_fixRevision']({revision:_0xa90801,from:_0x1b93bf,to:_0x40b230}={}){const _0x3244b2=this['editor']['plugins']['get'](_0x2e4b5d),_0x514580=this['_revisionTracker']['buildRevisionData']({'revision':_0xa90801,'from':_0x1b93bf,'to':_0x40b230});_0x514580['authors']=_0x514580['authorsIds']['map'](_0x2a0ef0=>_0x3244b2['getUser'](_0x2a0ef0)),_0xa90801['_update'](_0x514580);}_preventResendingRevisionData(_0x52b705){const _0x582692={};_0x582692['id']=_0x52b705['id'];for(const _0x1e435a of Object['keys'](_0x52b705))'id'!==_0x1e435a&&(_0x582692[_0x1e435a]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0x582692['id'],_0x582692,!0x0);}async _fetchMissingUsers(_0xea1430){const _0x29028b=this['editor']['plugins']['get'](_0x2e4b5d),{connection:_0x3a7e70}=this['editor']['plugins']['get'](z),_0x1032d6=new Set();for(const _0x4a65c6 of _0xea1430){for(const _0x5adb4b of _0x4a65c6['authorsIds'])_0x4d0e7e(_0x5adb4b);_0x4a65c6['creatorId']&&_0x4d0e7e(_0x4a65c6['creatorId']);}if(0x0===_0x1032d6['size'])return;const _0x412d30=await _0x326c07['getMany'](_0x3a7e70,Array['from'](_0x1032d6));for(const _0x572209 of _0x412d30)_0x29028b['getUser'](_0x572209['id'])||_0x29028b['addUser'](_0x572209);function _0x4d0e7e(_0x33c98d){_0x29028b['getUser'](_0x33c98d)||_0x1032d6['add'](_0x33c98d);}}};function pt(_0x4f43ed){return _0x4f43ed['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0x4f43ed['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x4f43ed['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}var gt=class extends _0x55ae44{static get requires(){return[_0x2d2cfb,mt,nt];}static get['pluginName'](){return'RealTimeCollaborativeRevisionHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},wt=class extends _0x5e1e61{_collapseAt;constructor(_0x4384c4,_0x117ad4=0x6){super(_0x4384c4);const _0x39a315=this['bindTemplate'];this['set']('isHidden',!0x0),this['set']('usersCount',0x0),this['_collapseAt']=_0x117ad4,this['bind']('isHidden')['to'](this,'usersCount',_0x3e74bd=>_0x3e74bd<_0x117ad4),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item',_0x39a315['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':_0x39a315['to']('usersCount',_0x23550b=>'+'+(_0x23550b-this['_collapseAt']+0x2)['toString']())}]}]}]});}},vt=class extends _0x5e1e61{items;keystrokes;constructor(_0x474ab1){super(_0x474ab1);const _0x3694dc=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0x2b4fca(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0x3694dc['if']('hasPopup'),'aria-expanded':_0x3694dc['to']('isExpanded',_0x4130d6=>this['hasPopup']&&String(_0x4130d6)),'aria-label':_0x3694dc['to']('hasPopup',_0x5bbccb=>X(_0x474ab1,_0x5bbccb?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0x3694dc['to']('hasPopup',_0x4a8016=>!!_0x4a8016&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items'],'on':{'mouseenter':_0x3694dc['to'](()=>this['fire']('presencelist:show')),'mouseleave':_0x3694dc['to'](_0x117507=>{const _0x25bacb=_0x117507,_0x3010d3=document['querySelector']('.ck-presence-list__dropdown-list'),_0x1902e6=document['querySelector']('.ck-balloon-panel_with-arrow');_0x3010d3?.['contains'](_0x25bacb['relatedTarget'])||_0x1902e6?.['contains'](_0x25bacb['relatedTarget'])||this['fire']('presencelist:hide');})}}),this['on']('change:hasPopup',(_0x26df09,_0x5186be,_0x381f1f)=>{this['element']&&(_0x381f1f?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']);}},_t=class extends _0x5e1e61{counterView;inlineListView;constructor(_0x5517c9,_0x2edae1=0x6){super(_0x5517c9);const _0x410ad1=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new wt(this['locale'],_0x2edae1),this['inlineListView']=new vt(_0x5517c9),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x1948f1 of this['inlineListView']['items'])_0x1948f1['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',_0x410ad1['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['inlineListView']]});}},yt=class extends _0x5e1e61{listWrapperView;constructor(_0x2ee717,_0x4994e1){super(_0x2ee717);const _0x34d06b=this['bindTemplate'];this['listWrapperView']=new bt(_0x2ee717,_0x4994e1),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':X(_0x2ee717,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']],'on':{'mouseleave':_0x34d06b['to'](_0x1558f2=>{const _0x32d013=_0x1558f2,_0x593f1d=document['querySelector']('.ck-presence-list__list'),_0x334bc2=document['querySelector']('.ck-balloon-panel_with-arrow');_0x593f1d?.['contains'](_0x32d013['relatedTarget'])||_0x334bc2?.['contains'](_0x32d013['relatedTarget'])||this['fire']('presencelist:hide');})}});}},bt=class extends _0xd7af65{constructor(_0x382465,_0x2c9ae2){super(_0x382465);const _0x230b7a=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0x2c9ae2?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0x230b7a['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0x230b7a['to']('role'),'aria-label':_0x230b7a['to']('ariaLabel'),'aria-labelledby':_0x230b7a['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0x59c443['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0x4fb8c3=this['element'];_0x4fb8c3&&(this['_isScrollable']=Math['max'](_0x4fb8c3['scrollHeight'],_0x4fb8c3['clientHeight'])>0.8*window['innerHeight']);}},kt=class extends _0x130180{['userView'];constructor(_0x329032,_0x4bddb8,_0x4cb329){super(_0x329032);const _0x19126b=this['bindTemplate'];this['userView']=new _0x4b32bb(_0x329032,_0x4bddb8);const _0x38d1e3={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0x4bddb8['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0x4bddb8['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x4bddb8['color']['getBackgroundColorClass']()],'style':{'--ck-user-color':_0x4bddb8['color']['getColorVariable'](),'--ck-user-color-alpha':_0x4bddb8['color']['getColorAlphaVariable']()},'aria-hidden':'true'}}]};_0x4cb329&&(_0x38d1e3['tag']='button',_0x38d1e3['on']={'click':_0x19126b['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x38d1e3);}['focus'](){this['element']['focus']();}},It=class extends _0x5e1e61{['userView'];['markerView'];constructor(_0x381489,_0x5758a2,_0x3e4bf2){super(_0x381489);const _0x365dde=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new _0x4b32bb(_0x381489,_0x5758a2),this['markerView']=new St(_0x381489,_0x5758a2);const _0x5f24a2=new _0x522fbe(_0x381489);_0x5f24a2['template']['tag']='span',_0x5f24a2['text']=_0x5758a2['name'];const _0x5ef242={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0x365dde['to']('isFocusable',_0x1c7629=>!!_0x1c7629&&0x0),'aria-labelledby':_0x5f24a2['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0x365dde['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0x365dde['to']('hasTooltip',_0x87c0cc=>!_0x87c0cc),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0x5f24a2]};_0x3e4bf2&&(_0x5ef242['tag']='button',_0x5ef242['on']={'click':_0x365dde['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x5ef242);}},St=class extends _0x5e1e61{constructor(_0x2ac7d9,_0x2db649){super(_0x2ac7d9),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x2db649['color']['getBackgroundColorClass']()],'style':{'--ck-user-color':_0x2db649['color']['getColorVariable'](),'--ck-user-color-alpha':_0x2db649['color']['getColorAlphaVariable']()},'aria-hidden':'true'}});}};const Tt={'collapseAt':0x6,'displayMe':!0x0};var Ct=class extends _0x181a27{currentDisplayedUsers;['balloonPanelView'];['view'];['presenceDropdownView'];_bodyCollection=null;static get['pluginName'](){return'PresenceListUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x4266c8){super(_0x4266c8),this['context']['config']['define']('presenceList',Tt);const _0x3b4612=_0x4266c8['config']['get']('presenceList.collapseAt');if('number'!=typeof _0x3b4612)throw new _0xa752d3('presencelist-collapseat-invalid-format',this);if(_0x3b4612<0x1)throw new _0xa752d3('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](Y)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0x309d10(),this['balloonPanelView']=new _0x241d1f(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get requires(){return[Y];}init(){for(const _0x242a9f of this['_allConnectedUsers'])this['_handleUserAdd'](_0x242a9f);this['listenTo'](this['_allConnectedUsers'],'add',(_0x235dd5,_0x5e2308)=>{this['_handleUserAdd'](_0x5e2308);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0x4ec41c,_0x49c4c1)=>{this['_handleUserRemove'](_0x49c4c1);});}_createView(){const _0x26879d=this['context'],_0x41491f=new _t(this['context']['locale'],this['context']['config']['get']('presenceList.collapseAt')),_0x3af0de=this['balloonPanelView'];if(!_0x1eb77c(_0x26879d['config']['get']('presenceList.container')))throw new _0xa752d3('presencelist-missing-container',this);return _0x41491f['counterView']['bind']('usersCount')['to'](this),_0x41491f['bind']('isCollapsed')['to'](this,'usersCount',_0x1ca3c2=>{const {collapseAt:_0x172d2e}=_0x26879d['config']['get']('presenceList'),_0x189bdb=_0x1ca3c2>=_0x172d2e;if(_0x189bdb&&!_0x41491f['inlineListView']['items']['find'](_0x274e1c=>_0x274e1c instanceof wt)){const _0x411c36=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['currentDisplayedUsers']['length']==_0x411c36&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](this['currentDisplayedUsers']['length']-0x1),_0x41491f['inlineListView']['items']['add'](_0x41491f['counterView']);}return _0x189bdb||this['hideDropdown'](),_0x189bdb;}),_0x41491f['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0x367931=>{const _0x34ac97=_0x26879d['config']['get']('presenceList'),_0x2741c5=new It(_0x26879d['locale'],_0x367931,!!_0x34ac97['onClick']);return _0x2741c5['bind']('hasTooltip')['to'](_0x41491f,'isCollapsed',_0x10c479=>!_0x10c479),_0x2741c5['bind']('isFocusable')['to'](_0x41491f,'isCollapsed',_0x4f7db1=>!_0x4f7db1),_0x34ac97['onClick']&&this['listenTo'](_0x2741c5,'execute',()=>{this['view']['isCollapsed']||_0x34ac97['onClick'](_0x367931,_0x2741c5['element']);}),_0x2741c5;}),this['listenTo'](_0x41491f['inlineListView'],'presencelist:show',()=>{this['view']['isCollapsed']&&this['showDropdown']();}),this['listenTo'](_0x41491f['inlineListView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();}),_0x41491f['inlineListView']['keystrokes']['set']('Enter',(_0x37fb50,_0x4a333c)=>{this['view']['isCollapsed']&&(this['showDropdown'](),_0x4a333c());}),_0x41491f['render'](),_0x3af0de['render'](),_0xc6739({'emitter':_0x41491f,'activator':()=>_0x3af0de['isVisible'],'contextElements':[_0x3af0de['element'],_0x41491f['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0x26879d['config']['get']('presenceList.container')['appendChild'](_0x41491f['element']),this['_bodyCollection']=new _0x44ac99(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_bodyCollection']['add'](this['balloonPanelView']),_0x41491f;}['_handleUserAdd'](_0x1c8c06){if(!this['context']['config']['get']('presenceList.displayMe')&&_0x1c8c06['isMe'])return;const _0x118e56=this['context']['config']['get']('presenceList.collapseAt')-0x1;for(this['usersCount']++;this['currentDisplayedUsers']['length']>=_0x118e56-(this['view']['isCollapsed']?0x1:0x0)&&this['currentDisplayedUsers']['length']>0x1;)this['currentDisplayedUsers']['remove'](0x1);const _0x5cf54b=_0x1c8c06['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0x1c8c06,_0x5cf54b);}['_handleUserRemove'](_0x1c3171){this['usersCount']--;const {collapseAt:_0x1c71b8}=this['context']['config']['get']('presenceList'),_0x4e29d0=this['usersCount']>=_0x1c71b8;if(this['currentDisplayedUsers']['get'](_0x1c3171['id']))this['currentDisplayedUsers']['remove'](_0x1c3171['id']);else{if(_0x4e29d0&&this['currentDisplayedUsers']['length']+0x1===_0x1c71b8-0x1)return;}if(this['currentDisplayedUsers']['length']+(_0x4e29d0?0x1:0x0)<this['usersCount']){for(const _0x2485e6 of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0x2485e6['id'])&&(this['currentDisplayedUsers']['add'](_0x2485e6,Math['min'](this['currentDisplayedUsers']['length']-(_0x4e29d0?0x1:0x0),0x1)),this['currentDisplayedUsers']['length']+(_0x4e29d0?0x1:0x0)===_0x1c71b8-0x1))return;}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0x4d42ab=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new yt(this['context']['locale'],!!_0x4d42ab['onClick']),this['view']['inlineListView']['isExpanded']=!0x0,this['listenTo'](this['presenceDropdownView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();});const {listWrapperView:_0x31267c}=this['presenceDropdownView'];_0x31267c['items']['bindTo'](this['_allConnectedUsers'])['using'](_0x15a1d1=>{if(!_0x4d42ab['displayMe']&&_0x15a1d1['isMe'])return null;const _0x47d489=new kt(this['context']['locale'],_0x15a1d1,!!_0x4d42ab['onClick']);return _0x4d42ab['onClick']&&this['listenTo'](_0x47d489,'execute',()=>{_0x4d42ab['onClick'](_0x15a1d1,_0x47d489['element']);}),_0x47d489;}),this['balloonPanelView']['content']['add'](this['presenceDropdownView']),this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element']}),_0x31267c['focus'](),_0x31267c['checkIfScrollable']();const _0x1fe849=(_0x1cae0c,_0x54a0b4)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0x54a0b4();};_0x31267c['keystrokes']['set']('Esc',_0x1fe849),_0x31267c['keystrokes']['set']('Shift+Tab',_0x1fe849),_0x31267c['keystrokes']['set']('Tab',(_0x3900f3,_0x163181)=>{!function(_0x4cce26){const _0x1d8a5e=['a','button','input','select','textarea','[tabindex]','[contenteditable]']['map'](_0x5348c1=>_0x5348c1+':not([disabled]):not([tabindex=\x22-1\x22])')['join'](','),_0x4d1cf1=[...document['body']['querySelectorAll'](_0x1d8a5e)]['filter'](_0x4675f2=>_0x4675f2===document['activeElement']||_0x4675f2['offsetWidth']+_0x4675f2['offsetHeight']>0x0)['sort']((_0x11a5ff,_0x6d1a0a)=>(_0x11a5ff['tabIndex']||0x0)-(_0x6d1a0a['tabIndex']||0x0)),_0x3f6fba=_0x4d1cf1[(_0x4d1cf1['indexOf'](_0x4cce26)+0x1)%_0x4d1cf1['length']];_0x3f6fba&&_0x3f6fba['focus']();}(this['view']['element']),this['hideDropdown'](),_0x163181();}),_0x31267c['focusTracker']['add'](this['view']['element']),_0x31267c['focusTracker']['on']('change:isFocused',(_0x3a8fab,_0x4974a6,_0x37d5b5)=>{_0x37d5b5||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);}},At=class extends _0x181a27{static get requires(){return[Y,Ct];}static get['pluginName'](){return'PresenceList';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}};export{ot as CloudServicesCommentsAdapter,mt as CloudServicesRevisionHistoryAdapter,ht as CloudServicesTrackChangesAdapter,At as PresenceList,Ct as PresenceListUI,tt as RealTimeCollaborationClient,ut as RealTimeCollaborativeComments,nt as RealTimeCollaborativeEditing,gt as RealTimeCollaborativeRevisionHistory,ft as RealTimeCollaborativeTrackChanges,Y as Sessions,z as WebSocketGateway};
|