@ckeditor/ckeditor5-real-time-collaboration 49.0.0-alpha.6 → 49.0.0-alpha.8
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-editor.css +71 -48
- package/dist/index.css +71 -48
- 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
|
-
((()=>_0x3a22fd)());static initialReconnectionInterval=0x3e8;connection;_reconnectionStack;_shouldPluginsReconnect;_domEmitter;static get requires(){return[_0x472ed3,_0x2073ef];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x473555){super(_0x473555),this['set']('state',_0x282513['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=new(_0x4192c7())();}init(){const _0x4ec66d=this['context'],_0x546c81=_0x4ec66d['plugins']['get'](_0x472ed3),_0x36777d=_0x4ec66d['plugins']['get'](_0x2073ef);if(!_0x546c81['token'])throw new _0x4aa6b2('websocketgateway-missing-token',this);if(!_0x546c81['webSocketUrl'])throw new _0x4aa6b2('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'](_0x546c81['token'],_0x546c81['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0x326853=>{if(this['connection']=_0x326853,this['bind']('state')['to'](_0x326853,'state',this,'_isBrowserOffline',(_0x1b4145,_0x239351)=>('connected'!==_0x1b4145&&(this['_shouldPluginsReconnect']=!0x0),_0x239351||_0x1b4145!==_0x282513['CONNECTED']?_0x282513['DISCONNECTED']:this['state']==_0x282513['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),_0x282513['CONNECTING']):_0x282513['CONNECTED'])),this['connection']['on']('error',(_0x3fc129,_0xacc839)=>{if('limitExceeded'!==_0xacc839['code'])throw console['error'](_0xacc839),new _0x4aa6b2('cloudservices-init',null,{'originalError':_0xacc839});_0x36777d['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'});}),!_0x326853['me'])return new Promise(_0x1ea8fc=>_0x326853['on']('change:me',_0x1ea8fc));})['catch'](_0x56e113=>{throw console['error'](_0x56e113),new _0x4aa6b2('cloudservices-init',null,{'originalError':_0x56e113});});}addToReconnectionStack(_0x66db75){if('function'!=typeof _0x66db75['reconnect'])throw new _0x4aa6b2('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0x66db75))throw new _0x4aa6b2('websocketgateway-plugin-already-registered',this,{'name':_0x66db75['constructor']['pluginName']});this['_reconnectionStack']['add'](_0x66db75);}removeFromReconnectionStack(_0x231e13){this['_reconnectionStack']['delete'](_0x231e13);}isInReconnectionStack(_0x4ab048){return this['_reconnectionStack']['has'](_0x4ab048);}_reconnect(){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0x51ac83=>_0x51ac83['reconnect']())))['then'](()=>this['state']=_0x282513['CONNECTED'])['catch'](_0x145cad=>{throw console['error'](_0x145cad),new _0x4aa6b2('cloudservices-reconnection-error',this['context']);});}disconnect(){this['connection']&&this['connection']['disconnect'](),this['state']=_0x282513['DISCONNECTED'],this['_domEmitter']['stopListening']();}destroy(){this['disconnect'](),super['destroy']();}},Q=class extends _0x35619e{['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[J,_0x53a800];}constructor(_0x358159){super(_0x358159),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0x1f253d(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x53a800);}init(){const _0x232b2e=this['context']['plugins']['get'](J);this['listenTo'](_0x232b2e,'change:state',(_0x352bc8,_0x7e840a,_0x5f16d3)=>{if('connected'!==_0x5f16d3)this['channelSessions']['forEach'](_0x5027dd=>_0x5027dd['clear']()),this['channelConnectedUsers']['forEach'](_0x4afe65=>_0x4afe65['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x425655,_0x91a234]of this['_registeredSessions'])for(const _0x59d8b1 of _0x91a234)this['_handleSessionAdd'](_0x425655,_0x59d8b1);}}),this['_createUser'](_0x232b2e['connection']['me'],!0x0);}register(_0x52448d,_0x2778a1){if(this['_registeredSessions']['has'](_0x52448d))throw new _0x4aa6b2('sessions-register-already-registered',null,{'channelId':_0x52448d});this['_registeredSessions']['set'](_0x52448d,_0x2778a1),this['channelSessions']['set'](_0x52448d,new _0x1f253d()),this['channelConnectedUsers']['set'](_0x52448d,new _0x1f253d()),this['listenTo'](_0x2778a1,'add',(_0x253b50,_0x56bbf4)=>this['_handleSessionAdd'](_0x52448d,_0x56bbf4)),this['listenTo'](_0x2778a1,'remove',(_0x26de36,_0x49112a)=>this['_handleSessionRemove'](_0x52448d,_0x49112a));for(const _0x46fcf5 of _0x2778a1)this['_handleSessionAdd'](_0x52448d,_0x46fcf5);}unregister(_0x49dc96){if(!this['_registeredSessions']['has'](_0x49dc96))throw new _0x4aa6b2('sessions-unregister-not-exist',null,{'channelId':_0x49dc96});const _0x68637e=this['_registeredSessions']['get'](_0x49dc96);this['stopListening'](_0x68637e);for(const _0x503d67 of _0x68637e)'connected'===this['context']['plugins']['get'](J)['state']&&this['_handleSessionRemove'](_0x49dc96,_0x503d67);this['_registeredSessions']['delete'](_0x49dc96),this['channelSessions']['delete'](_0x49dc96),this['channelConnectedUsers']['delete'](_0x49dc96);}get['mySessionId'](){return this['context']['plugins']['get'](J)['connection']['sessionId'];}getUserBySessionId(_0x46b544){for(const _0x3dcb65 of this['channelSessions']['values']())for(const _0x341cf6 of _0x3dcb65)if(_0x341cf6['id']===_0x46b544)return _0x341cf6['user'];}getUserSessions(_0x1ede90,_0x2fc59e){const _0x29588d=_0x2fc59e?[this['channelSessions']['get'](_0x2fc59e)]:this['channelSessions']['values'](),_0x5dc66a=new Set();for(const _0x3f17aa of _0x29588d)for(const _0x33e732 of _0x3f17aa)_0x33e732['user']['id']===_0x1ede90['id']&&_0x5dc66a['add'](_0x33e732['id']);return _0x5dc66a;}getUserRole(_0x49d89b){for(const _0x52c9cf of this['channelSessions']['values']())for(const _0x42306a of _0x52c9cf)if(_0x42306a['user']===_0x49d89b)return _0x42306a['role'];}['_handleSessionAdd'](_0x225093,_0xb294c0){if('connected'!==this['context']['plugins']['get'](J)['state'])return;const _0x2fe138=_0xb294c0['user'],_0x162fa2=this['_users']['getUser'](_0x2fe138['id'])||this['_createUser'](_0x2fe138),_0x4b1721=Object['assign']({},_0xb294c0,{'user':_0x162fa2});if(this['channelSessions']['get'](_0x225093)['add'](_0x4b1721),!_0x2fe138['hiddenInPresenceList']){const _0x30293b=this['channelConnectedUsers']['get'](_0x225093);_0x30293b['has'](_0x162fa2['id'])||_0x30293b['add'](_0x162fa2),this['allConnectedUsers']['has'](_0x162fa2['id'])||_0x2fe138['hiddenInPresenceList']||this['allConnectedUsers']['add'](_0x162fa2,_0x162fa2['isMe']?0x0:void 0x0);}this['fire']('sessionAdd:'+_0x225093,{'channelId':_0x225093,'session':_0x4b1721});}['_handleSessionRemove'](_0xca56f9,_0x532275){if('connected'!==this['context']['plugins']['get'](J)['state'])return;const _0x4dc148=this['channelConnectedUsers']['get'](_0xca56f9),_0x4fbb8f=_0x532275['user'];_0x4fbb8f['id']&&(this['channelSessions']['get'](_0xca56f9)['remove'](_0x532275['id']),_0x4dc148['has'](_0x4fbb8f['id'])&&!this['getUserSessions'](_0x4fbb8f,_0xca56f9)['size']&&_0x4dc148['remove'](_0x4fbb8f['id']),this['allConnectedUsers']['get'](_0x4fbb8f['id'])&&!this['getUserSessions'](_0x4fbb8f)['size']&&this['allConnectedUsers']['remove'](_0x4fbb8f['id']));}_createUser(_0x4a5a65,_0x5e0f84){const _0xcdb612=this['_users']['addUser'](_0x4a5a65);return _0x5e0f84&&this['_users']['defineMe'](_0x4a5a65['id']),_0xcdb612['orderNumber']=this['_uniqueUsersCount']++,_0xcdb612;}},X=class extends _0x184fd3{_domEmitter=new(_0x4192c7())();static get requires(){return[Q];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const _0x4872cd=this['editor'],_0x30e8ed=_0x4872cd['plugins']['get'](Q);_0x4872cd['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x18ab28,{writer:_0x5f30ae})=>function(_0x5a4776,_0x54968c,_0x4d3d98,_0x2ba8b8){const _0x1d8e97=_0x5a4776['markerName']['split'](':')[0x2],_0x48f094=_0x4d3d98['getUserBySessionId'](_0x1d8e97);if(!_0x48f094||_0x1d8e97===_0x4d3d98['mySessionId'])return;if(!_0x2ba8b8['model']['schema']['checkChild'](_0x5a4776['markerRange']['start'],'$text'))return;const _0x41b4af={'class':'ck-user__marker\x20'+_0x48f094['color']['getMarkerClass'](),'style':tt(_0x48f094),'data-name':_0x48f094['name'],'data-session-id':_0x1d8e97},_0x44c326=_0x2ba8b8['model']['markers']['get'](_0x5a4776['markerName'])['getStart'](),_0x391d6d=_0x44c326['nodeAfter'],_0x1ad4d9=_0x2ba8b8['model']['schema'];if(_0x391d6d&&_0x1ad4d9['isObject'](_0x391d6d)&&_0x1ad4d9['isInline'](_0x391d6d)&&!_0x2ba8b8['model']['markers']['get']('user:range:'+_0x1d8e97)['getRange']()['isCollapsed'])return;const _0x250699=_0x44c326['parent'];return _0x2ba8b8['model']['schema']['isLimit'](_0x250699)&&!_0x2ba8b8['model']['hasContent'](_0x250699)&&(_0x41b4af['contenteditable']=!0x1),function(_0x5550ee,_0x44e409,_0x52706a){const _0x9df548=_0x5550ee['createUIElement']('span',_0x44e409);return _0x5550ee['setCustomProperty']('userPositionMarker',!0x0,_0x9df548),_0x9df548['render']=function(_0x56f0a3){const _0x102166=this['toDomElement'](_0x56f0a3),_0x4919f3=document['createElement']('span');return _0x4919f3['classList']['add']('ck-user__marker-tooltip'),_0x4919f3['setAttribute']('contenteditable','false'),_0x4919f3['setAttribute']('spellcheck','false'),_0x4919f3['textContent']=_0x52706a['name'],_0x102166['innerHTML']=_0x4d10b4('<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span>'+_0x4919f3['outerHTML']+''),_0x102166['addEventListener']('mouseenter',()=>{_0x102166['classList']['add']('ck-user__marker_hovered');}),_0x102166['addEventListener']('mouseleave',()=>{_0x102166['classList']['remove']('ck-user__marker_hovered');}),_0x102166;},_0x9df548['isSimilar']=function(_0x47a913){return!(!this['getCustomProperty']('userPositionMarker')||!_0x47a913['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0x47a913['getAttribute']('data-session-id'));},_0x9df548;}(_0x54968c,_0x41b4af,_0x48f094);}(_0x18ab28,_0x5f30ae,_0x30e8ed,_0x4872cd)}),_0x4872cd['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0x1d9287=>function(_0x1c8e41,_0x4ce71e){const _0x2d4584=_0x1c8e41['markerName']['split'](':')[0x2];if(_0x2d4584===_0x4ce71e['mySessionId'])return null;const _0x3fe924=_0x4ce71e['getUserBySessionId'](_0x2d4584);return _0x3fe924?{'id':_0x2d4584,'classes':['ck-user__selection',_0x3fe924['color']['getSelectionClass']()],'attributes':{'style':tt(_0x3fe924),'data-session-id':_0x2d4584},'priority':0x7d0+_0x3fe924['orderNumber']}:{'id':_0x2d4584,'classes':[]};}(_0x1d9287,_0x30e8ed)}),function(_0x23492d){const _0x3e572a=_0x23492d['model'],_0x22e283=new Map(),_0x5172b0=_0x23492d['plugins']['get'](Q);_0x3e572a['markers']['on']('update:user:range',(_0x5acecb,_0xbe185,_0x43c041,_0x467abd)=>{if(!_0x467abd&&_0x22e283['get'](_0xbe185['name']))return _0x22e283['get'](_0xbe185['name'])['detach'](),void _0x22e283['delete'](_0xbe185['name']);const _0x589099=_0xbe185['name']['split'](':')[0x2];if(_0x589099===_0x5172b0['mySessionId'])return;const _0x56119b='user:position:'+_0x589099;_0x3e572a['markers']['has'](_0x56119b)&&_0x23492d['editing']['reconvertMarker'](_0x56119b),_0xbe185['on']('change:range',(_0x3ca0f0,_0x3ff2a1,_0x48a10d)=>{if('$graveyard'!=_0x3ff2a1['root']['rootName']&&'$graveyard'==_0xbe185['getRange']()['root']['rootName']&&!_0x22e283['has'](_0xbe185['name'])){const _0x10c2d5=_0x3e572a['schema']['getNearestSelectionRange'](_0x48a10d['deletionPosition']);if(_0x10c2d5){const _0x5228e5=_0x2e6bd2['fromRange'](_0x10c2d5);_0x22e283['set'](_0xbe185['name'],_0x5228e5),_0x5228e5['on']('change:range',(_0x6cd958,_0x3b7aa0,_0x54075d)=>{if('$graveyard'==_0x5228e5['root']['rootName']){const _0x387bb5=_0x3e572a['schema']['getNearestSelectionRange'](_0x54075d['deletionPosition']);_0x387bb5?(_0x5228e5['start']=_0x387bb5['start'],_0x5228e5['end']=_0x387bb5['end']):(_0x22e283['delete'](_0xbe185['name']),_0x5228e5['detach']());}});}}});}),_0x3e572a['document']['on']('change',()=>{_0x22e283['size']>0x0&&_0x3e572a['enqueueChange']({'isUndoable':!0x1},_0x467c4d=>{for(const [_0x43d993,_0x5e2979]of _0x22e283)'$graveyard'==_0x3e572a['markers']['get'](_0x43d993)['getRange']()['root']['rootName']&&(Z(_0x43d993['split'](':')[0x2],_0x5e2979['toRange'](),_0x3e572a,_0x467c4d),_0x5e2979['detach']());_0x22e283['clear']();});});}(_0x4872cd),this['_domEmitter']['listenTo'](_0x530d5e['document'],'keydown',(_0x1d133d,{key:_0x4d004e})=>{'Escape'===_0x4d004e&&function(_0x4947d7){_0x4947d7['editing']['view']['change'](_0x467883=>{for(const _0x2fcadc of _0x4947d7['model']['markers']){if(!_0x2fcadc['name']['startsWith']('user:position'))continue;const _0x3afa16=_0x4947d7['editing']['mapper']['markerNameToElements'](_0x2fcadc['name']);if(_0x3afa16){for(const _0x5aa45e of _0x3afa16)_0x467883['removeClass']('ck-user__marker_hovered',_0x5aa45e);}}});}(_0x4872cd);},{'useCapture':!0x0});}afterInit(){const _0x5eb5df=this['editor'],_0x22babf=_0x5eb5df['commands']['get']('undo');_0x22babf&&_0x5eb5df['model']['on']('applyOperation',(_0x52f813,_0x5f0c78)=>{const _0x21f619=_0x5f0c78[0x0];if(!_0x21f619['isDocumentOperation'])return;if('marker'!=_0x21f619['type']||!_0x21f619['name']['startsWith']('user:'))return;const _0x1e2bb1=_0x21f619['batch'];_0x22babf['_createdBatches']['has'](_0x1e2bb1)&&(_0x21f619['newRange']=_0x21f619['oldRange']?_0x5eb5df['model']['createRange'](_0x21f619['oldRange']['start'],_0x21f619['oldRange']['end']):null);},{'priority':'highest'});}destroy(){return this['_domEmitter']['stopListening'](),super['destroy']();}createUserMarkerOperations(){const _0x8c006d=this['editor'],_0x474b75=_0x8c006d['model']['document'],_0x21919c=_0x8c006d['plugins']['get'](Q);_0x8c006d['model']['enqueueChange']({'isUndoable':!0x1},_0x18313d=>{const _0xbbef3b='user:range:'+_0x21919c['mySessionId'],_0x1a2209='user:position:'+_0x21919c['mySessionId'],_0xa76910=_0x8c006d['model']['markers']['has'](_0xbbef3b);_0x8c006d['editing']['view']['hasDomSelection']?Z(_0x21919c['mySessionId'],_0x474b75['selection']['getFirstRange'](),_0x8c006d['model'],_0x18313d):_0xa76910&&(_0x18313d['removeMarker'](_0xbbef3b),_0x18313d['removeMarker'](_0x1a2209));});}};function Z(_0x13229c,_0x167269,_0x53198b,_0x162039){const _0x1a67d8='user:range:'+_0x13229c,_0x2a6ee0='user:position:'+_0x13229c,_0x63b7a2=_0x167269['getContainedElement']();let _0x16ebbd=_0x167269['start'];if(_0x63b7a2&&_0x63b7a2['is']('element','tableCell')){const _0x4d4c42=function(_0x500555,_0x56c1a2){for(const _0x516883 of _0x500555['getPositions']())if(_0x56c1a2['schema']['checkChild'](_0x516883,'$text'))return _0x516883;}(_0x167269,_0x53198b);_0x4d4c42&&(_0x16ebbd=_0x4d4c42,_0x167269=_0x162039['createRange'](_0x16ebbd));}const _0x3c3b22=_0x162039['createRange'](_0x16ebbd);_0x53198b['markers']['has'](_0x1a67d8)?(_0x162039['updateMarker'](_0x1a67d8,{'range':_0x167269}),_0x162039['updateMarker'](_0x2a6ee0,{'range':_0x3c3b22})):(_0x162039['addMarker'](_0x1a67d8,{'range':_0x167269,'usingOperation':!0x0}),_0x162039['addMarker'](_0x2a6ee0,{'range':_0x3c3b22,'usingOperation':!0x0}));}function tt(_0x3cf8bd){return'--ck-user-color:'+_0x3cf8bd['color']['getColorVariable']()+';--ck-user-color-alpha:'+_0x3cf8bd['color']['getColorAlphaVariable']()+';';}function et(_0x2afec0,_0x5ba8b3,_0x5ebd0a){const _0x5ea15d=_0x2afec0['t'],t=_0x2afec0['t'];switch(_0x5ba8b3){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 _0x5ea15d({'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'},_0x5ebd0a);default:return'';}}let st=0x1;var it=class RealTimeCollaborationClient extends _0x184fd3{static CollaborativeEditingService=/* #__PURE__ -- @preserve */
|
|
25
|
-
((()=>_0x101e41)());_offset;['sessionId'];serverHistory;['_channelId'];['_service'];_document;['_compressor'];_bufferedOperations;_knownOperations;_knownRootNames;_pendingAction;_hasSelectionChanged;_sendBufferedOperationsDelayId;['_baseBufferDelay'];_currentBufferDelay;_lastSyncedOperationId;_disconnectionOperations;_operationIdentifier;static get requires(){return[J,Q,X,_0x573997,_0x53a800,_0x2073ef];}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 _0x3f6890=this['serverHistory']['getOperations']();for(let _0x323f2c=_0x3f6890['length']-0x1;_0x323f2c>=0x0;_0x323f2c--){const _0x4651ca=_0x3f6890[_0x323f2c];if(!this['_disconnectionOperations']['has'](_0x4651ca))return _0x4651ca['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0x244006){if(super(_0x244006),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x832863(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0x4aa6b2('collaboration-missing-channelid',this);const _0x148a67=_0x244006['config']['get']('cloudServices.bundleVersion')||_0x110cfc;this['_service']=new RealTimeCollaborationClient['CollaborativeEditingService'](_0x148a67,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0x37b49c(),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 rt(this['_disconnectionOperations']);}init(){const _0x12ddfc=this['editor'],_0x4c987d=_0x12ddfc['plugins']['get'](_0x53a800),_0x53f5f4=_0x12ddfc['plugins']['get'](J);this['listenTo'](_0x4c987d,'getOperationAuthor',(_0x1d2311,_0x1b3790)=>{const _0x4ebe2a=_0x1b3790[0x0];_0x4ebe2a['_authorId']&&(_0x1d2311['return']=_0x4c987d['getUser'](_0x4ebe2a['_authorId']),_0x1d2311['stop']()),null===_0x4ebe2a['_authorId']&&(_0x1d2311['return']=null,_0x1d2311['stop']());},{'priority':'high'}),this['listenTo'](_0x12ddfc['model']['document']['selection'],'change:range',(_0x1288ba,_0x315732)=>{_0x315732['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x12ddfc['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x12ddfc['model']['on']('applyOperation',(_0x4beab7,_0x3a3c22)=>{const _0x2db519=_0x3a3c22[0x0];_0x2db519['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0x2db519),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['set']('_isChannelFlushed',!0x1),this['bind']('_isEditingAllowed')['to'](_0x53f5f4,'state',this,'_hasSynchronizationProblem',this,'_isChannelFlushed',(_0x248f89,_0x5a1d41,_0x1b5a3a)=>'connected'===_0x248f89&&!_0x5a1d41&&!_0x1b5a3a),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x12ddfc['disableReadOnlyMode']('rtc-offline'):_0x12ddfc['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x12ddfc['disableReadOnlyMode']('rtc-offline'):_0x12ddfc['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async reconnect(){const _0x5ca742=this['editor']['plugins']['get'](Q),_0x3bf957=this['editor']['plugins']['get'](J);try{this['_isPendingUpdate']=!0x0,_0x5ca742['unregister'](this['_channelId']);const _0x5872cf=await this['_service']['reconnect'](_0x3bf957['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0x5872cf)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x1906db=await this['_service']['getConnectedSessions']();_0x5ca742['register'](this['_channelId'],_0x1906db),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x4aaee2){if(function(_0x2d5d65){return'404'===_0x2d5d65['code'];}(_0x4aaee2)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0x4e9847){return'409'===_0x4e9847['code'];}(_0x4aaee2)){const _0x25dcc6=et(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'](_0x25dcc6);}else{if(!(_0x4aaee2 instanceof nt))throw _0x4aaee2;this['_handleReconnectionError']();}}}}destroy(){const _0x19998f=this['editor']['plugins']['get'](J),_0x531c25=this['editor']['plugins']['get'](Q);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x531c25['channelSessions']['has'](this['_channelId'])&&_0x531c25['unregister'](this['_channelId']),_0x19998f['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async _handleReconnectionResponse(_0x4067fa){if(this['sessionId']!==_0x4067fa['sessionId']&&this['_lastSyncedOperationId']!==_0x4067fa['lastOperationId'])throw new nt();return this['sessionId']=_0x4067fa['sessionId'],this['_handleServerResponse']([],{..._0x4067fa,'wereChangesApplied':!0x1,'data':_0x4067fa['data']},'reconnect');}async _connectService(_0x3a87a5,_0x45858f=!0x1){const {connection:_0x5499f3}=this['editor']['plugins']['get'](J);RealTimeCollaborationClient['CollaborativeEditingService']['getConnectedSessions'](_0x5499f3,this['_channelId'])['then'](_0x5b6687=>this['_initSessionsHandling'](_0x5b6687))['catch'](_0x50b204=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x50b204);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x1ba1c3,_0x330a4c)=>{this['_crash']('realtimecollaborationclient-init-service-internal-error',_0x330a4c);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_handleChannelDisconnected']();});const _0x2246ae=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x3a87a5);this['_isPendingUpdate']=!0x0;const _0x2b8115=await this['_service']['connect'](_0x5499f3,this['_compressOperations'](_0x3a87a5),_0x2246ae);if(this['sessionId']=_0x2b8115['sessionId'],_0x45858f){if(!_0x2b8115['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x2b8115['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0x3a87a5,_0x2b8115,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x2b8115,_0x3a87a5);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}_handleSendingSelectionMarkers(){const _0x2d5905=this['editor']['plugins']['get'](Q),_0x1aea27=this['editor']['plugins']['get'](X),_0x38b8ee=_0x2d5905['channelSessions']['get'](this['_channelId']);_0x38b8ee&&_0x38b8ee['length']>0x1?_0x1aea27['createUserMarkerOperations']():this['listenTo'](_0x2d5905,'sessionAdd:'+this['_channelId'],()=>{0x2===_0x2d5905['channelSessions']['get'](this['_channelId'])['length']&&_0x1aea27['createUserMarkerOperations']();});}async _handleReceivedOperations(_0x35186e,_0x1d7a64,_0x28a276,_0x2b0e75){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x1d7a64){const _0x182da8=this['_decompressOperations'](_0x28a276,_0x2b0e75);await this['_fetchMissingUsers'](_0x182da8),this['_handleExternalOperations'](_0x182da8,_0x1d7a64,_0x28a276['lastOperationId'])||this['_crash']('realtimecollaborationclient-init-service-incorrect-server-operation');}}async _connectAfterSessionHasBeenFlushed(){this['_disconnectService']();const {locale:_0x5bb388}=this['editor'];let _0x2ef84b;try{_0x2ef84b=await this['_service']['getDocumentDetails']();}catch{const _0x599254=et(_0x5bb388,'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'](_0x599254);}const _0x2146e7=_0x2ef84b['currentDocumentSession']||_0x2ef84b['lastDocumentSession'];if(this['_lastSyncedOperationId']!==_0x2146e7['lastOperationId']){const _0xd5749=et(_0x5bb388,'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'](_0xd5749);}await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);}_handleChannelDisconnected(){const _0xbdb853=this['editor']['plugins']['get'](J);if(this['_isConnected']=!0x1,!_0xbdb853['connection']||'connected'!==_0xbdb853['connection']['state'])return;this['_isChannelFlushed']=!0x0;const _0x246e00=this['editor']['plugins']['get'](Q);_0x246e00['channelSessions']['has'](this['_channelId'])&&_0x246e00['unregister'](this['_channelId']),_0xbdb853['removeFromReconnectionStack'](this),this['_disconnectService']();}_disconnectService(){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['stopListening'](this['_service']);}_initSessionsHandling(_0x2f5f88){const _0x32874b=this['editor']['plugins']['get'](Q);this['listenTo'](_0x32874b,'sessionAdd:'+this['_channelId'],(_0x541063,{session:_0x25f55e})=>{if(_0x25f55e['id']===_0x32874b['mySessionId']){_0x541063['off']();const _0x9d8851=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0x3c43b1=_0x25f55e['permissions'];_0x9d8851&&_0x9d8851['isEnabled']&&(_0x3c43b1=_0x3c43b1['filter'](_0x5951ca=>'document:write'!==_0x5951ca)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0x3c43b1,this['_channelId']);}}),_0x32874b['register'](this['_channelId'],_0x2f5f88);}_initThrowingOnDataSet(){const _0x3dc065=this['editor']['data']['set'];this['editor']['data']['set']=(..._0x1c4a37)=>{if(!_0x1c4a37[_0x1c4a37['length']-0x1]['suppressErrorInCollaboration'])throw new _0x4aa6b2('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x3dc065['apply'](this['editor']['data'],_0x1c4a37);};}_setUpDataInit(){this['editor']['data']['on']('init',(_0x4500b4,[_0x591e2f])=>{if(this['_document']['version'])throw new _0x4aa6b2('realtimecollaborationclient-init-document-already-initialized',this);_0x4500b4['stop'](),this['_setPendingAction']();const _0x3adbc5=Object['fromEntries'](Object['entries'](this['editor']['config']['get']('roots')||{})['filter'](([,_0x3518dc])=>!_0x3518dc['lazyLoad'])['map'](([_0xc11a6,_0x58b9bc])=>[_0xc11a6,_0x58b9bc['modelAttributes']||{}])),_0x236e50=this['_getOperationsFromInitData'](_0x591e2f,_0x3adbc5);0x0==_0x236e50['length']&&_0x236e50['push'](new _0x1aa07a(0x0)),_0x4500b4['return']=this['_connectService'](_0x236e50)['then'](()=>{this['editor']['plugins']['get'](J)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x40c0e2=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x40c0e2))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x2742cb,[_0x349f98,_0x121b77])=>{_0x2742cb['stop']();const _0x77a5c8=this['editor']['model']['document']['getRoot'](_0x349f98);if(!this['_knownRootNames']['has'](_0x349f98)){const _0x1d871d=_0x121b77&&_0x121b77['data']?_0x121b77['data']:'',_0x33054d=_0x121b77&&_0x121b77['attributes']?_0x121b77['attributes']:{};await this['_loadRoot'](_0x349f98,_0x1d871d,_0x33054d);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0x77a5c8['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0x77a5c8);});},{'priority':'high'});}async _fetchMissingUsers(_0x54d834){const _0x585993=this['editor']['plugins']['get'](_0x53a800),{connection:_0x24d600}=this['editor']['plugins']['get'](J),_0x13c935=new Set();for(const _0x38dcfa of _0x54d834){const _0x118741=_0x38dcfa['_authorId'];_0x118741&&!_0x585993['getUser'](_0x118741)&&_0x13c935['add'](_0x118741);}if(0x0===_0x13c935['size'])return;const _0x4bff63=await _0xbfb52f['getMany'](_0x24d600,Array['from'](_0x13c935));for(const _0x4f209d of _0x4bff63)_0x585993['getUser'](_0x4f209d['id'])||_0x585993['addUser'](_0x4f209d);}_getOperationsFromInitData(_0x1e8f77,_0x1b6396={}){const _0x47ddaf=this['editor']['model'],_0x4aac95=[];let _0xaeb80d=0x0;const _0x5666cc='string'==typeof _0x1e8f77?{'main':_0x1e8f77}:_0x1e8f77;for(const _0x17599c of Object['keys'](_0x5666cc)){if(!this['_document']['roots']['has'](_0x17599c))throw new _0x4aa6b2('realtimecollaborationclient-init-non-existent-root',this);const _0x46c138=this['_document']['getRoot'](_0x17599c),_0x1e2d1e=this['editor']['data']['parse'](_0x5666cc[_0x17599c],_0x46c138),_0x6ce0dd=new _0x52b205(_0x47ddaf['createPositionAt'](_0x46c138,0x0),_0x1e2d1e,_0xaeb80d++);_0x4aac95['push'](_0x6ce0dd);for(const [_0x3d4889,_0x48c531]of _0x1e2d1e['markers']){const _0x42936e=_0x47ddaf['createRange'](_0x47ddaf['createPositionFromPath'](_0x46c138,_0x48c531['start']['path']['slice']()),_0x47ddaf['createPositionFromPath'](_0x46c138,_0x48c531['end']['path']['slice']())),_0x372149=new _0x34bab7(_0x3d4889,null,_0x42936e,_0x47ddaf['markers'],!0x0,_0xaeb80d++);_0x4aac95['push'](_0x372149);}}if(_0x1b6396)for(const [_0x458f6e,_0x25b860]of Object['entries'](_0x1b6396)){const _0x268910=_0x47ddaf['document']['getRoot'](_0x458f6e);if(!_0x268910)throw new _0x4aa6b2('multi-root-editor-root-attributes-no-root',null);for(const [_0x5078ff,_0xe585bf]of Object['entries'](_0x25b860))if(null!==_0xe585bf){const _0x1aeb74=new _0x8400b6(_0x268910,_0x5078ff,null,_0xe585bf,_0xaeb80d++);_0x4aac95['push'](_0x1aeb74);}}return _0x4aac95;}async _loadRoot(_0x199cb6,_0x37b4a2,_0x207093){this['_getOperationsFromInitData']({[_0x199cb6]:_0x37b4a2},{[_0x199cb6]:_0x207093})['forEach']((_0x4c32b4,_0x50611c)=>{_0x4c32b4['baseVersion']=this['_document']['version']+_0x50611c,_0x4c32b4['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x4c32b4);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async _handleInitialConnectionData(_0x1a6ab4,_0x5019a6){let _0x1083e1;this['_offset']=_0x1a6ab4['offset'];const _0x78ea7c=_0x1a6ab4['wereChangesApplied']&&!_0x1a6ab4['initData'],_0x211200=_0x78ea7c?0x0:_0x1a6ab4['data']['baseVersion'];if(_0x5019a6['forEach'](_0x3729ee=>{_0x3729ee['_isInit']=!0x0,_0x3729ee['createdAt']=_0x1a6ab4['sessionCreatedAt'],_0x3729ee['_authorId']=null;}),_0x78ea7c)_0x1083e1=_0x5019a6,this['_applyOperationsSet'](_0x1083e1,_0x78ea7c);else{if(_0x1a6ab4['initData']){const _0x5cb7a3=this['_getOperationsFromInitData'](_0x1a6ab4['initData']);this['_document']['history']['version']=-_0x5cb7a3['length'],_0x5cb7a3['forEach'](_0x4ef79d=>{_0x4ef79d['baseVersion']-=_0x5cb7a3['length'],_0x4ef79d['createdAt']=_0x1a6ab4['sessionCreatedAt'],_0x4ef79d['_isInit']=!0x0,_0x4ef79d['_authorId']=null;}),this['_applyOperationsSet'](_0x5cb7a3,!0x0),this['serverHistory']['version']=-_0x5cb7a3['length']+this['_offset'],this['_updateServerHistory'](_0x5cb7a3);}this['_document']['history']['version']=_0x211200,_0x1083e1=this['_decompressOperations'](_0x1a6ab4['data'],_0x1a6ab4['metadata']),await this['_fetchMissingUsers'](_0x1083e1),this['_applyOperationsSet'](_0x1083e1,_0x78ea7c);}_0x1a6ab4['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x1083e1,_0x1a6ab4['lastOperationId']),this['_lastSyncedOperationId']=_0x1a6ab4['lastOperationId']),this['serverHistory']['version']=_0x211200+this['_offset'],this['_updateServerHistory'](_0x1083e1),_0x5019a6['filter'](_0x5f0f59=>{const _0x32db28=this['_getAffectedRoot'](_0x5f0f59);return _0x32db28&&!this['_knownRootNames']['has'](_0x32db28);})['forEach']((_0x1e638b,_0x46fbfc)=>{_0x1e638b['baseVersion']=this['_document']['version']+_0x46fbfc,this['_saveOperationInBuffer'](_0x1e638b);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x36c582,_0x336d07){const _0x4afeb6=_0x336d07&&_0x336d07['message'];if(_0x4afeb6&&_0x4afeb6['startsWith']('realtimecollaborationclient'))throw _0x336d07;const _0x446da5=this['editor']['plugins']['get'](J);throw this['_isPendingUpdate']=!0x0,_0x446da5['disconnect'](),this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0x4aa6b2(_0x36c582,this['editor'],_0x4afeb6?{'originalError':_0x4afeb6}:void 0x0);}_saveOperationInBuffer(_0x563c7c){this['_knownOperations']['has'](_0x563c7c)||(this['_knownOperations']['add'](_0x563c7c),this['_bufferedOperations']['push'](_0x563c7c),this['_pendingAction']||'marker'==_0x563c7c['type']&&!_0x563c7c['affectsData']||this['_setPendingAction']());}_sendBufferedOperationsDelayed(_0x2faf67=!0x1){!_0x2faf67&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0x239c3b=>{_0x239c3b&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0xcda18=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0x1ca104){return _0x1ca104['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x1ca104['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0x1ca104['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0xcda18)||this['_crash'](_0xcda18['message'],_0xcda18);});},this['_currentBufferDelay']));}_waitUntilSynced(){return new Promise(_0x529555=>{this['on']('change:_isPendingUpdate',()=>{_0x529555();});});}async _sendBufferedOperations(){const _0x1fbda4=this['editor']['plugins']['get'](X);if(this['_shouldSendSelectionUpdate']()&&(_0x1fbda4['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x18ab89=[...this['_bufferedOperations']];for(const _0x17a323 of _0x18ab89)_0x17a323['wasUndone']=this['_document']['history']['isUndoneOperation'](_0x17a323);const _0x3039b9=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x18ab89),_0x4b6015=st++,_0x100af5=this['_compressOperations'](_0x18ab89),_0x5a93f2=await this['_service']['sendOperations'](_0x100af5,_0x100af5['baseVersion'],_0x3039b9);try{return await this['_handleServerResponse'](_0x18ab89,_0x5a93f2,_0x4b6015);}catch(_0x1bcc51){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0x1bcc51);}}async['_handleServerResponse'](_0x668ba8,_0x30bfaf,_0x23f049){if('error'in _0x30bfaf)throw _0x30bfaf['error'];let _0x10ae47;if(_0x30bfaf['wereChangesApplied']){_0x30bfaf['lastOperationId']&&(this['_lastSyncedOperationId']=_0x30bfaf['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x5020e6=>!_0x668ba8['includes'](_0x5020e6));for(const _0x3f2717 of _0x668ba8)_0x3f2717['createdAt']='lastOperationAcceptedAt'in _0x30bfaf&&_0x30bfaf['lastOperationAcceptedAt']||void 0x0;ot(_0x668ba8,_0x30bfaf['version']-_0x668ba8['length']),this['_updateServerHistory'](_0x668ba8);const _0x4bf67b=_0x668ba8['filter'](_0x282343=>{if(!_0x282343['_isInit'])return!0x1;const _0x2eac5f=this['_getAffectedRoot'](_0x282343);return _0x2eac5f&&!this['_knownRootNames']['has'](_0x2eac5f);});ot(_0x4bf67b,this['_document']['version']),this['_applyOperationsSet'](_0x4bf67b),_0x10ae47=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0x4a0739=this['_decompressOperations'](_0x30bfaf['data'],_0x30bfaf['metadata'])['filter'](_0x11e9b9=>_0x11e9b9['baseVersion']>=this['_lastServerVersion']);_0x4a0739['forEach'](_0x2dfb62=>this['_addKnownRoot'](_0x2dfb62)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x1e4fe=>!_0x1e4fe['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x1e4fe))),this['_bufferedOperations']['length']&&ot(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0x4a0739),_0x10ae47=this['_handleExternalOperations'](_0x4a0739,_0x30bfaf['version'],_0x30bfaf['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x10ae47?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}_handleExternalOperations(_0x217ee6,_0x50018b,_0x55e4fe){try{const _0x21f53b={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0xfef99f,operationsB:_0x5e9c6d,originalOperations:_0x1078a6}=_0x5c3fcc(_0x217ee6,this['_bufferedOperations'],_0x21f53b);ot(_0xfef99f,this['_document']['version']),ot(_0x5e9c6d,_0x50018b);for(const _0x33f2f0 of _0xfef99f){const _0x1f84d5=_0x1078a6['get'](_0x33f2f0);_0x1f84d5?(_0x33f2f0['_authorId']=_0x1f84d5['_authorId'],'noop'!==_0x33f2f0['type']&&(_0x33f2f0['_aiSource']=_0x1f84d5['_aiSource'])):_0x33f2f0['_authorId']=null;}for(const _0x4c5214 of _0x5e9c6d)'noop'!==_0x4c5214['type']&&(_0x4c5214['_aiSource']=_0x1078a6['get'](_0x4c5214)?.['_aiSource']);_0x55e4fe&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x217ee6,_0x55e4fe),this['_lastSyncedOperationId']=_0x55e4fe),this['_bufferedOperations']=[..._0x5e9c6d],this['_applyOperationsSet'](_0xfef99f),this['_updateServerHistory'](_0x217ee6);}catch(_0x16013a){return console['error'](_0x16013a),!0x1;}return!0x0;}_applyOperationsSet(_0x35a63f,_0x33ea38=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0x2fce31=>{for(const _0x226b2c of _0x35a63f)this['_knownOperations']['add'](_0x226b2c),this['_addKnownRoot'](_0x226b2c),_0x2fce31['batch']['addOperation'](_0x226b2c),this['editor']['model']['applyOperation'](_0x226b2c);});}_addKnownRoot(_0x2b688c){const _0x58e030=this['_getAffectedRoot'](_0x2b688c);_0x58e030&&this['_knownRootNames']['add'](_0x58e030);}_getAffectedRoot(_0x44bce5){let _0x4e983a,_0x465f01;switch(_0x44bce5['type']){case'insert':_0x4e983a=_0x44bce5['position']['root'];break;case'marker':if(_0x465f01=_0x44bce5['newRange'],!_0x465f01)return null;_0x4e983a=_0x465f01['root'];break;case'addRootAttribute':_0x4e983a=_0x44bce5['root'];break;case'addRoot':_0x4e983a=_0x44bce5['affectedSelectable'];break;case'move':_0x4e983a=_0x44bce5['targetPosition']['root'];break;default:return null;}return _0x4e983a['rootName'];}_updateServerHistory(_0x769a4d){_0x769a4d['forEach'](_0x1a38c9=>{const _0x330960=_0x1a38c9['clone']();_0x330960['_authorId']=_0x1a38c9['_authorId'],_0x330960['_isInit']=!!_0x1a38c9['_isInit'],_0x330960['_aiSource']=_0x1a38c9['_aiSource'],_0x330960['createdAt']=_0x1a38c9['createdAt'],_0x330960['baseVersion']+=this['_offset'],_0x1a38c9['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x330960),this['serverHistory']['addOperation'](_0x330960);});}_handleReconnectionError(_0x205e35){const _0x521456=this['editor']['plugins']['get']('Notification'),_0x5adf6b=this['editor']['locale'];_0x205e35||(_0x205e35=et(_0x5adf6b,'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.')),_0x521456['showWarning'](_0x205e35,{'title':et(_0x5adf6b,'Synchronization\x20issue'),'namespace':'real-time-collaboration'}),this['_hasSynchronizationProblem']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_bufferedOperations']=[],this['editor']['plugins']['get'](J)['disconnect']();}_setPendingAction(){this['_pendingAction']||(this['_pendingAction']=this['editor']['plugins']['get'](_0x573997)['add'](et(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}_clearPendingAction(){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x573997)['remove'](this['_pendingAction']),this['_pendingAction']=null);}_compressOperations(_0x1b8942){const _0x2c5cd9=_0x1b8942['map'](_0x313f12=>_0x313f12['toJSON']());return this['_compressor']['compress'](_0x2c5cd9);}_decompressOperations(_0x5c12df,_0x1a90ea){return this['_compressor']['decompress'](_0x5c12df)['map']((_0x49e348,_0x350045)=>{const _0x31ef09='init'==_0x1a90ea[_0x350045]['type'];if('InsertOperation'==_0x49e348['__className']){const _0x5a83a7=_0x49e348['position']['root'];!this['_document']['getRoot'](_0x5a83a7)&&(this['_document']['createRoot']('$unknown',_0x5a83a7)['_isAttached']=!0x1);}else{if('RootOperation'==_0x49e348['__className']){const _0x5effc2=this['_document']['getRoot'](_0x49e348['rootName']);_0x5effc2&&'$unknown'==_0x5effc2['name']&&_0x49e348['elementName']!=_0x5effc2['name']&&(_0x5effc2['name']=_0x49e348['elementName']);}}const _0x39a12f=_0x2df5c2['fromJSON'](_0x49e348,this['_document']);return _0x39a12f['wasUndone']=_0x49e348['wasUndone'],_0x39a12f['_isInit']=_0x31ef09,_0x39a12f['_authorId']=_0x31ef09?null:_0x1a90ea[_0x350045]['userId'],_0x39a12f['_isDisconnection']='cs:removeUser'===_0x1a90ea[_0x350045]['type'],_0x39a12f['_aiSource']=_0x49e348['_aiSource']||void 0x0,_0x39a12f['createdAt']=_0x1a90ea[_0x350045]['createdAt'],_0x39a12f;});}_refreshUserSelectionMarkers(){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}_shouldSendSelectionUpdate(){const _0x4af598=this['editor']['plugins']['get'](Q)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0x4af598&&_0x4af598['length']>0x1&&this['_hasSelectionChanged'];}_shouldSendUpdate(){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}},nt=class extends Error{};function ot(_0x14bd0a,_0x426cf1){for(const _0x54fd97 of _0x14bd0a)_0x54fd97['baseVersion']=_0x426cf1++;}var rt=class{_ignoredOperations;_operationToId;constructor(_0x87d7ca){this['_ignoredOperations']=_0x87d7ca,this['_operationToId']=new WeakMap();}getIdOfTheLastOperation(_0x2e6ac2){let _0x15ffb5=_0x2e6ac2['length'];for(;_0x15ffb5--;){const _0x5ccc7c=_0x2e6ac2[_0x15ffb5];if(!this['_ignoredOperations']['has'](_0x5ccc7c)){if(!this['_operationToId']['has'](_0x5ccc7c)){const _0x3440d1=_0x378125()['slice'](0x1,0x12);this['_operationToId']['set'](_0x5ccc7c,_0x3440d1);}return this['_operationToId']['get'](_0x5ccc7c);}}}setIdForTheLastOperation(_0x440a06,_0x43899a){if(!_0x43899a)return;let _0x142ac7=_0x440a06['length'];for(;_0x142ac7--;){const _0x40e983=_0x440a06[_0x142ac7];this['_ignoredOperations']['has'](_0x40e983)||this['_operationToId']['set'](_0x40e983,_0x43899a);}}},ct=class extends _0x184fd3{static get requires(){return[it];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},at=class CloudServicesCommentsAdapter extends _0x35619e{static CommentsService=/* #__PURE__ -- @preserve */
|
|
26
|
-
((()=>_0x49580d)());['_services'];static get requires(){return[J,_0x432ec3,Q,_0x53a800];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x48d327){super(_0x48d327),this['_services']=new Map();}async init(){const _0x2cdcf7=this['context'],_0x431ac6=_0x2cdcf7['plugins']['get'](_0x432ec3);if(_0x2cdcf7['plugins']['get'](J)['addToReconnectionStack'](this),_0x431ac6['adapter']={'addCommentThread':async({channelId:_0x179120,threadId:_0x3364bb,comments:_0x67e851,resolvedAt:_0x58c59b,resolvedBy:_0x3d18ee,context:_0x107738,attributes:_0x1ccc97})=>{const _0xea914a=await this['_getService'](_0x179120)['addCommentThread']({'commentThreadId':_0x3364bb,'comments':_0x67e851['map'](_0x502aae=>function(_0x544937,_0x2ce709,_0xec219e){return{'commentThreadId':_0xec219e,'commentId':_0x544937['commentId'],'userId':_0x544937['authorId'],'content':_0x544937['content'],'documentId':_0x2ce709,'createdAt':_0x544937['createdAt'],'attributes':_0x544937['attributes']||{}};}(_0x502aae,_0x179120,_0x3364bb)),'resolvedAt':_0x58c59b,'resolvedBy':_0x3d18ee,'context':_0x107738,'attributes':_0x1ccc97})['catch'](lt);return{'threadId':_0xea914a['commentThreadId'],'comments':_0xea914a['comments']};},'getCommentThread':async({channelId:_0x14f938,threadId:_0x309706})=>{const _0x1e6a62=await this['_getService'](_0x14f938)['getCommentThread'](_0x309706)['catch'](ht)['catch'](lt);return _0x1e6a62?_0x1e6a62['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0x1e6a62]),{'threadId':_0x1e6a62['commentThreadId'],'comments':_0x1e6a62['comments']['map'](dt),'context':_0x1e6a62['context'],'resolvedAt':_0x1e6a62['resolvedAt'],'resolvedBy':_0x1e6a62['resolvedBy'],'attributes':_0x1e6a62['attributes']||{}}):null;},'updateCommentThread':async({channelId:_0x37d3fc,threadId:_0x1d91e4,context:_0x57233d,unlinkedAt:_0x47f3ae,attributes:_0xf1ca34})=>this['_getService'](_0x37d3fc)['updateCommentThread']({'commentThreadId':_0x1d91e4,'context':_0x57233d,'attributes':_0xf1ca34,'unlinkedAt':_0x47f3ae})['catch'](ht)['catch'](lt),'resolveCommentThread':async({channelId:_0x146b28,threadId:_0xd0f808})=>{const _0x4987ac=await this['_getService'](_0x146b28)['resolveCommentThread'](_0xd0f808)['catch'](ht)['catch'](lt);return{'threadId':_0x4987ac['commentThreadId'],'resolvedAt':_0x4987ac['resolvedAt'],'resolvedBy':_0x4987ac['resolvedBy']};},'reopenCommentThread':async({channelId:_0x1afd24,threadId:_0x35488b})=>this['_getService'](_0x1afd24)['reopenCommentThread'](_0x35488b)['catch'](ht)['catch'](lt),'removeCommentThread':({channelId:_0x3ae7d0,threadId:_0x253929})=>this['_getService'](_0x3ae7d0)['removeCommentThread'](_0x253929)['catch'](ht)['catch'](lt),'addComment':({channelId:_0x4ef6ca,threadId:_0x225c26,commentId:_0x2a1ba3,content:_0x555948,attributes:_0x4c76cf})=>this['_getService'](_0x4ef6ca)['addComment'](_0x225c26,_0x2a1ba3,_0x555948,_0x4c76cf)['catch'](lt),'updateComment':({channelId:_0x2e1cb9,threadId:_0x492ad4,commentId:_0x5365f9,content:_0x8cb79d,attributes:_0x15d7f1})=>this['_getService'](_0x2e1cb9)['updateComment'](_0x492ad4,_0x5365f9,_0x8cb79d,_0x15d7f1)['catch'](ht)['catch'](lt),'removeComment':({channelId:_0x217eb8,threadId:_0x4cbc93,commentId:_0x51308d})=>this['_getService'](_0x217eb8)['removeComment'](_0x4cbc93,_0x51308d)['catch'](ht)['catch'](lt)},_0x2cdcf7 instanceof _0x570df0){const _0x250b6a=_0x2cdcf7['config']['get']('collaboration.channelId'),_0x1e7a36=_0x2cdcf7['plugins']['get'](Q);await this['_setUpService'](_0x250b6a);const _0x44a657=await this['_services']['get'](_0x250b6a)['getConnectedSessions']();this['listenTo'](_0x1e7a36,'sessionAdd:'+_0x250b6a,(_0x10be0f,{session:_0x96fc65})=>{_0x96fc65['id']===_0x1e7a36['mySessionId']&&(_0x10be0f['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x96fc65['permissions'],_0x250b6a));}),_0x1e7a36['register'](_0x250b6a,_0x44a657);}}async _setUpService(_0xb5a0e4){if(this['_services']['has'](_0xb5a0e4))throw new _0x4aa6b2('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0xb5a0e4});const _0x2691ec=this['context']['plugins']['get'](_0x432ec3),_0x38f7d1=new CloudServicesCommentsAdapter['CommentsService'](_0xb5a0e4);this['_services']['set'](_0xb5a0e4,_0x38f7d1),this['listenTo'](_0x38f7d1,'commentThreadAdded',(_0x32183f,_0x13fe79)=>{const {commentThreadId:_0x2ca277,documentId:_0x40cec5,context:_0x20729b,attributes:_0x3210da,resolvedAt:_0x3142fa,resolvedBy:_0x39e840,comments:_0x6dfe62}=_0x13fe79;_0x2691ec['getCommentThread'](_0x2ca277)||_0x2691ec['addCommentThread']({'threadId':_0x2ca277,'channelId':_0x40cec5,'comments':_0x6dfe62?_0x6dfe62['map'](dt):[],'context':_0x20729b,'attributes':_0x3210da,'resolvedAt':_0x3142fa,'resolvedBy':_0x39e840,'isFromAdapter':!0x0});}),this['listenTo'](_0x38f7d1,'commentThreadUpdated',(_0x78e0b3,{commentThreadId:_0x5abce4,documentId:_0x125296,context:_0x5903a9,unlinkedAt:_0x1fe8cb,attributes:_0x163bc0})=>{_0x2691ec['getCommentThread'](_0x5abce4)&&_0x2691ec['updateCommentThread']({'threadId':_0x5abce4,'channelId':_0x125296,'context':_0x5903a9,'unlinkedAt':_0x1fe8cb,'attributes':_0x163bc0,'isFromAdapter':!0x0});}),this['listenTo'](_0x38f7d1,'commentThreadResolved',(_0x53d3d3,{commentThreadId:_0x30b96b,resolvedBy:_0x4a519,resolvedAt:_0x449e8c})=>{const _0xde99bb=_0x2691ec['getCommentThread'](_0x30b96b);_0xde99bb&&_0xde99bb['resolve']({'resolvedBy':_0x4a519,'resolvedAt':_0x449e8c,'isFromAdapter':!0x0});}),this['listenTo'](_0x38f7d1,'commentThreadReopened',(_0x21da35,{commentThreadId:_0x715d39})=>{const _0x4d174c=_0x2691ec['getCommentThread'](_0x715d39);_0x4d174c&&_0x4d174c['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0x38f7d1,'commentThreadRemoved',(_0x5adc70,{commentThreadId:_0x58a962})=>{const _0x23b010=_0x2691ec['getCommentThread'](_0x58a962);_0x23b010&&_0x23b010['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0x38f7d1,'commentAdded',(_0x22153b,_0x4882a4)=>{const _0x5b996a=_0x4882a4['commentThreadId'],_0x2576b4=_0x2691ec['getCommentThread'](_0x5b996a);_0x2576b4&&_0x2576b4['addComment']({...dt(_0x4882a4),'isFromAdapter':!0x0});}),this['listenTo'](_0x38f7d1,'commentUpdated',(_0x208c8e,{commentThreadId:_0x237b83,commentId:_0x2b83c6,content:_0x48657c,attributes:_0xca2b40})=>{const _0x130d2b=_0x2691ec['getCommentThread'](_0x237b83);if(_0x130d2b){const _0x5a66ae=_0x130d2b['getComment'](_0x2b83c6);_0x5a66ae&&_0x5a66ae['update']({'content':_0x48657c,'attributes':_0xca2b40,'isFromAdapter':!0x0});}}),this['listenTo'](_0x38f7d1,'commentRemoved',(_0x26eb6b,{commentThreadId:_0x226004,commentId:_0x41fa63})=>{const _0x326ed9=_0x2691ec['getCommentThread'](_0x226004);if(_0x326ed9){const _0x402f24=_0x326ed9['getComment'](_0x41fa63);_0x402f24&&_0x402f24['remove']({'isFromAdapter':!0x0});}}),this['listenTo'](_0x38f7d1,'disconnected',()=>{'connected'===this['context']['plugins']['get'](J)['connection']?.['state']&&(this['_services']['delete'](_0xb5a0e4),this['stopListening'](_0x38f7d1));}),await this['_connectService'](_0xb5a0e4);}destroy(){if(this['context']instanceof _0x570df0){const _0x5c48df=this['context']['config']['get']('collaboration.channelId');this['_services']['has'](_0x5c48df)&&this['_terminateService'](_0x5c48df);}}_terminateService(_0x5098b4){if(!this['_services']['has'](_0x5098b4))throw new _0x4aa6b2('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0x5098b4});this['_getService'](_0x5098b4)['disconnect'](),this['_services']['delete'](_0x5098b4);}async reconnect(){for(const _0x5523d2 of this['_services']['keys']())await this['_connectService'](_0x5523d2);if(this['context']instanceof _0x570df0){const _0x5a13d=this['context']['config']['get']('collaboration.channelId');if(this['_services']['has'](_0x5a13d)){const _0x3f638d=this['context']['plugins']['get'](Q);_0x3f638d['unregister'](_0x5a13d);const _0x3e5827=await this['_services']['get'](_0x5a13d)['getConnectedSessions']();_0x3f638d['register'](_0x5a13d,_0x3e5827);}}}async _connectService(_0x45cc5c){const {connection:_0x413cad}=this['context']['plugins']['get'](J),_0xf8d126=this['context']['plugins']['get'](_0x432ec3),_0x4fae3f=await this['_services']['get'](_0x45cc5c)['connect'](_0x413cad);await this['_fetchMissingUsersForThreads'](_0x4fae3f);const _0x72ed37=new Set(Array['from'](_0xf8d126['getCommentThreads']({'channelId':_0x45cc5c}),_0x3d82b4=>_0x3d82b4['id']));for(const _0x1ba70a of _0x4fae3f)_0x1ba70a['deletedAt']||_0x72ed37['delete'](_0x1ba70a['commentThreadId']);for(const _0x110447 of _0x72ed37)_0xf8d126['getCommentThread'](_0x110447)['remove']({'isFromAdapter':!0x0});for(const _0x1ef8b2 of _0x4fae3f){let _0x1b4da2=_0xf8d126['getCommentThread'](_0x1ef8b2['commentThreadId']);const {commentThreadId:_0x48761a,context:_0x508960,attributes:_0x4a1af8,resolvedBy:_0x48e41d,resolvedAt:_0xbcf268,unlinkedAt:_0x4ed32a,deletedAt:_0x3ba057}=_0x1ef8b2;if(_0x3ba057)continue;_0x1b4da2||(_0x1b4da2=_0xf8d126['addCommentThread']({'channelId':_0x45cc5c,'threadId':_0x48761a,'context':_0x508960,'attributes':_0x4a1af8||{},'resolvedBy':_0x48e41d,'resolvedAt':_0xbcf268,'unlinkedAt':_0x4ed32a,'isFromAdapter':!0x0}));const _0x4ea87f=new Set(Array['from'](_0x1b4da2['comments'],_0x507bcf=>_0x507bcf['id']));for(const _0xb0d8f9 of _0x1ef8b2['comments'])_0x4ea87f['delete'](_0xb0d8f9['commentId']);for(const _0x45ac1d of _0x4ea87f)_0x1b4da2['getComment'](_0x45ac1d)['remove']({'isFromAdapter':!0x0});for(const _0x3a257b of _0x1ef8b2['comments']){const _0x160251=_0x1b4da2['getComment'](_0x3a257b['commentId']);_0x160251?_0x160251['content']!==_0x3a257b['content']&&_0x160251['update']({'content':_0x3a257b['content'],'isFromAdapter':!0x0}):_0x1b4da2['addComment'](Object['assign'](dt(_0x3a257b),{'isFromAdapter':!0x0}));}}}_getService(_0x52c341){if(!this['_services']['has'](_0x52c341))throw new _0x4aa6b2('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0x52c341});return this['_services']['get'](_0x52c341);}async _fetchMissingUsersForThreads(_0x268f15){const _0xe9147c=this['context']['plugins']['get'](_0x53a800),{connection:_0x267e33}=this['context']['plugins']['get'](J),_0x36dc9c=new Set();for(const {resolvedBy:_0x3321d5,comments:_0x8a6458}of _0x268f15){_0x3321d5&&!_0xe9147c['getUser'](_0x3321d5)&&_0x36dc9c['add'](_0x3321d5);for(const {userId:_0x5746b0}of _0x8a6458)_0xe9147c['getUser'](_0x5746b0)||_0x36dc9c['add'](_0x5746b0);}if(0x0===_0x36dc9c['size'])return;const _0xcef3d8=await _0xbfb52f['getMany'](_0x267e33,Array['from'](_0x36dc9c));for(const _0x462235 of _0xcef3d8)_0xe9147c['getUser'](_0x462235['id'])||_0xe9147c['addUser'](_0x462235);}};async function ht(_0xc7fc93){if('404'!==_0xc7fc93['code'])throw _0xc7fc93;}function lt(_0x50e6b5){if((_0x550262=_0x50e6b5)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0x550262['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x550262['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0x550262;throw _0x50e6b5;}function dt(_0x5a0113){return{'threadId':_0x5a0113['commentThreadId'],'commentId':_0x5a0113['commentId'],'content':_0x5a0113['content'],'createdAt':_0x5a0113['createdAt'],'authorId':_0x5a0113['userId'],'attributes':_0x5a0113['attributes']||{}};}var ut=class CloudServicesTrackChangesAdapter extends _0x184fd3{static ['TrackChangesService']=/* #__PURE__ -- @preserve */
|
|
27
|
-
((()=>
|
|
28
|
-
((()=>_0x2bbd58)());_lastRequestId;['_revisionTracker'];_revisionHistoryService;_oldOffset;static get requires(){return[J,it,_0x18afd8,Q,_0x53a800];}static get['pluginName'](){return'CloudServicesRevisionHistoryAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x508d31){super(_0x508d31);const _0x173f9=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new CloudServicesRevisionHistoryAdapter['RevisionHistoryService'](_0x173f9);}async init(){const _0xbc2b65=this['editor']['plugins']['get'](it),_0x585d67=_0xbc2b65['serverHistory'],_0x91fd59=this['editor']['plugins']['get'](J);this['_revisionTracker']['setSource']({'history':_0x585d67,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0xbc2b65['sessionId']});const _0x456157=this['editor']['config']['get']('cloudServices.bundleVersion')||_0x110cfc,_0x115042=await _0x49ae78['isBundleUploaded'](_0x91fd59['connection'],_0x456157);this['editor']['plugins']['get'](_0x18afd8)['adapter']={'getRevision':async({revisionId:_0x27a2b8})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0x27a2b8)),'updateRevisions':async _0x470ef8=>{await this['_waitForServiceReady']();const _0x41f2f9=this['_revisionTracker']['currentRevision'];if(_0x115042&&0x1===_0x470ef8['length']&&_0x470ef8[0x0]['id']===_0x41f2f9['id'])return _0x470ef8;for(const _0x3bd89c of _0x470ef8)_0x3bd89c['id']===_0x41f2f9['id']&&(_0x3bd89c['isEmptyCurrent']=_0x3bd89c['fromVersion']===_0x3bd89c['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0x470ef8,this['_lastRequestId'])['then'](_0x49bc31=>(this['_lastRequestId']=_0x49bc31,_0x470ef8))['catch'](_0x54c95f=>{if(vt(_0x54c95f)||'400'===_0x54c95f['code']&&void 0x0!==_0x54c95f['data']['wrongRequestId']){for(const _0x9746d1 of _0x470ef8)this['_revisionTracker']['repository']['getRevision'](_0x9746d1['id'])&&this['_revisionTracker']['_bufferUpdate'](_0x9746d1['id'],_0x9746d1,!0x1);if(vt(_0x54c95f)&&'destroyed'!==this['editor']['state'])throw _0x54c95f;return _0x470ef8;}throw _0x54c95f;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0x490d75,{revisionsData:_0x571c83,requestId:_0x1a282b})=>{Math['max'](..._0x571c83['map'](_0x4f9d44=>_0x4f9d44['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0x571c83,_0x1a282b);}):this['_handleRevisionsUpdate'](_0x571c83,_0x1a282b);}),this['set']('_isServiceConnected',!0x1),this['listenTo'](this['_revisionHistoryService'],'connected',()=>{this['_isServiceConnected']=!0x0;}),this['listenTo'](this['_revisionHistoryService'],'disconnected',()=>{this['_isServiceConnected']=!0x1,'connected'===_0x91fd59['connection']?.['state']&&(_0x91fd59['removeFromReconnectionStack'](this),this['stopListening'](this['_revisionHistoryService']));});const {revisions:_0x2134c7,requestId:_0x37e549}=await this['_revisionHistoryService']['connect'](_0x91fd59['connection']);_0x91fd59['addToReconnectionStack'](this),this['_lastRequestId']=_0x37e549,await this['_fetchMissingUsers'](_0x2134c7);for(const _0x217ecd of _0x2134c7)this['_revisionTracker']['addRevisionData'](_0x217ecd);this['listenTo'](_0xbc2b65,'change:_isConnected',(_0x36d90b,_0x29e1f1,_0x5153a8)=>{_0x5153a8&&(this['_oldOffset']=_0xbc2b65['_offset'],_0x36d90b['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](this,'_isServiceConnected');}async reconnect(){const _0x17a754=this['editor']['plugins']['get'](J),_0x5f50d3=this['editor']['plugins']['get'](it),_0x3b029f=async()=>{const _0x1c85c1=this['_revisionTracker']['currentRevision'],_0x2adcc1=_0x1c85c1['id'],_0x35a4b7=_0x2adcc1!==_0x5f50d3['sessionId'];if(_0x35a4b7){const _0x7bf721=_0x5f50d3['_offset']-this['_oldOffset'],_0x12463b=this['_getLatestVersionFromServerOperations']();if(this['_revisionTracker']['_revisionDataBuilder']['reInit'](),_0x1c85c1['toVersion']+_0x7bf721!==_0x12463b){const _0x3499ab=_0x1c85c1['fromVersion']+_0x7bf721,_0x280567=this['editor']['plugins']['get'](_0x53a800),_0x11ed5a=this['_revisionTracker']['buildRevisionData']({'revision':_0x1c85c1,'from':_0x3499ab,'to':_0x12463b});_0x11ed5a['id']=_0x1c85c1['id'];const _0x18cc57=_0x11ed5a['authorsIds']['map'](_0x1b08ce=>_0x280567['getUser'](_0x1b08ce));_0x1c85c1['_update']({..._0x11ed5a,'authors':_0x18cc57},!0x0),this['_revisionTracker']['_bufferUpdate'](_0x1c85c1['id'],_0x11ed5a,!0x0);}this['_revisionTracker']['_startingVersion']=_0x12463b,_0x1c85c1['toVersion']!==_0x1c85c1['fromVersion']||this['_revisionTracker']['_bufferedUpdates']['has'](_0x2adcc1)||this['_revisionTracker']['repository']['_revisions']['remove'](_0x2adcc1),this['_revisionTracker']['_createCurrentRevision'](_0x12463b);}const {revisions:_0x3f6420,requestId:_0x36a2d5}=await this['_revisionHistoryService']['reconnect'](_0x17a754['connection'],this['_lastRequestId']);_0x35a4b7&&_0x3f6420['length']>0x0?_0x5f50d3['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x3f6420),this['_handleRevisionsUpdate'](_0x3f6420,_0x36a2d5),this['_revisionTracker']['sendBufferedUpdates']());};return _0x5f50d3['_isConnected']?_0x3b029f():new Promise((_0x19e2f4,_0x1b2f01)=>{_0x5f50d3['once']('change:_isConnected',()=>{_0x3b029f()['then'](_0x19e2f4)['catch'](_0x1b2f01);});});}destroy(){super['destroy']();}async _waitForServiceReady(){this['_revisionHistoryService']['isConnected']||await new Promise(_0x3cc7b7=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x2626d1=>{_0x2626d1['off'](),_0x3cc7b7();});});}_getLatestVersionFromServerOperations(){const _0x1e8bc1=this['editor']['plugins']['get'](it)['serverHistory']['getOperations']()['reverse']();for(const _0x32917a of _0x1e8bc1)if('marker'!==_0x32917a['type']||_0x32917a['affectsData'])return _0x32917a['baseVersion']+0x1;}_getLatestVersion(){const _0x5b68ae=this['editor']['plugins']['get'](it);return new Promise(_0x590db1=>{_0x5b68ae['_isPendingUpdate']?_0x5b68ae['once']('change:_isPendingUpdate',()=>{_0x590db1(this['_getLatestVersionFromServerOperations']());}):_0x590db1(this['_getLatestVersionFromServerOperations']());});}_handleRevisionsUpdate(_0x291172,_0x3507f0){const _0x8c0995=this['_revisionTracker']['repository'];this['_lastRequestId']=_0x3507f0;for(const _0x3787d2 of _0x291172){const _0x591b64=_0x8c0995['getRevision'](_0x3787d2['id']);if(_0x591b64){if((_0x3787d2['fromVersion']||_0x3787d2['toVersion'])&&(_0x3787d2['diffData']=null),_0x591b64===this['_revisionTracker']['currentRevision']){const _0x2dfac3=Math['max'](_0x591b64['toVersion'],_0x3787d2['toVersion']),_0x28eebf=Math['max'](_0x591b64['fromVersion'],_0x3787d2['fromVersion']);let _0x3c6239;_0x591b64['toVersion']===_0x3787d2['toVersion']&&_0x591b64['fromVersion']===_0x3787d2['fromVersion']?(_0x3c6239=!0x0,this['_preventResendingRevisionData'](_0x3787d2)):_0x3787d2['toVersion']===_0x2dfac3&&_0x3787d2['fromVersion']===_0x28eebf?_0x3c6239=!0x1:(_0x591b64['toVersion']===_0x2dfac3&&_0x591b64['fromVersion']===_0x28eebf||this['_fixRevision']({'revision':_0x591b64,'from':_0x28eebf,'to':_0x2dfac3}),_0x3c6239=!0x0),_0x3c6239&&(delete _0x3787d2['fromVersion'],delete _0x3787d2['toVersion'],delete _0x3787d2['diffData'],delete _0x3787d2['createdAt'],delete _0x3787d2['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0x3787d2),this['_preventResendingRevisionData'](_0x3787d2);}else this['_revisionTracker']['addRevisionData'](_0x3787d2);}const _0x48fae0=_0x8c0995['getRevisions']();_0x48fae0['reverse']();for(let _0xb304c5=0x0;_0xb304c5<_0x48fae0['length']-0x1;_0xb304c5++){const _0x460af7=_0x48fae0[_0xb304c5],_0x31cf95=_0x48fae0[_0xb304c5+0x1];if(_0x460af7['fromVersion']<_0x31cf95['toVersion']){const _0x24cdf0=_0x31cf95['toVersion'],_0x355b41=Math['max'](_0x24cdf0,_0x460af7['toVersion']);this['_fixRevision']({'revision':_0x460af7,'from':_0x24cdf0,'to':_0x355b41});}}}['_fixRevision']({revision:_0x4ce410,from:_0x290bbe,to:_0x3a3325}={}){const _0x2007dd=this['editor']['plugins']['get'](_0x53a800),_0x41438b=this['_revisionTracker']['buildRevisionData']({'revision':_0x4ce410,'from':_0x290bbe,'to':_0x3a3325});_0x41438b['authors']=_0x41438b['authorsIds']['map'](_0xd0a24=>_0x2007dd['getUser'](_0xd0a24)),_0x4ce410['_update'](_0x41438b);}_preventResendingRevisionData(_0x2792b9){const _0x8e1e14={};_0x8e1e14['id']=_0x2792b9['id'];for(const _0x30933d of Object['keys'](_0x2792b9))'id'!==_0x30933d&&(_0x8e1e14[_0x30933d]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0x8e1e14['id'],_0x8e1e14,!0x0);}async _fetchMissingUsers(_0x1e47a2){const _0x38eead=this['editor']['plugins']['get'](_0x53a800),{connection:_0x2de608}=this['editor']['plugins']['get'](J),_0x3c5de0=new Set();for(const _0xbddb01 of _0x1e47a2){for(const _0x23672f of _0xbddb01['authorsIds'])_0x145d4e(_0x23672f);_0xbddb01['creatorId']&&_0x145d4e(_0xbddb01['creatorId']);}if(0x0===_0x3c5de0['size'])return;const _0x1361f0=await _0xbfb52f['getMany'](_0x2de608,Array['from'](_0x3c5de0));for(const _0x1dc96b of _0x1361f0)_0x38eead['getUser'](_0x1dc96b['id'])||_0x38eead['addUser'](_0x1dc96b);function _0x145d4e(_0x297736){_0x38eead['getUser'](_0x297736)||_0x3c5de0['add'](_0x297736);}}};function vt(_0x2834fd){return _0x2834fd['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0x2834fd['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x2834fd['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}var _t=class extends _0x184fd3{static get requires(){return[_0x18afd8,wt,ct];}static get['pluginName'](){return'RealTimeCollaborativeRevisionHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},yt=class extends _0x3e1902{_collapseAt;constructor(_0x522eae,_0x414c23=0x6){super(_0x522eae);const _0x110759=this['bindTemplate'];this['set']('isHidden',!0x0),this['set']('usersCount',0x0),this['_collapseAt']=_0x414c23,this['bind']('isHidden')['to'](this,'usersCount',_0x52780b=>_0x52780b<_0x414c23),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item',_0x110759['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':_0x110759['to']('usersCount',_0x24cd9e=>'+'+(_0x24cd9e-this['_collapseAt']+0x2)['toString']())}]}]}]});}},bt=class extends _0x3e1902{items;keystrokes;constructor(_0x1d4ef8){super(_0x1d4ef8);const _0x10770a=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0x4a20eb(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0x10770a['if']('hasPopup'),'aria-expanded':_0x10770a['to']('isExpanded',_0x14097c=>this['hasPopup']&&String(_0x14097c)),'aria-label':_0x10770a['to']('hasPopup',_0x49ddf=>et(_0x1d4ef8,_0x49ddf?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0x10770a['to']('hasPopup',_0x3d0bb5=>!!_0x3d0bb5&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items']}),this['on']('change:hasPopup',(_0x4128c7,_0x45d6c7,_0x201e44)=>{this['element']&&(_0x201e44?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']);}},kt=class extends _0x3e1902{counterView;inlineListView;constructor(_0x1ee0a4,_0x64e2d=0x6){super(_0x1ee0a4);const _0x4a08e0=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new yt(this['locale'],_0x64e2d),this['inlineListView']=new bt(_0x1ee0a4),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x4a1457 of this['inlineListView']['items'])_0x4a1457['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',_0x4a08e0['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['inlineListView']]});}},It=class extends _0x3e1902{listWrapperView;constructor(_0x210cf0,_0x5cc536){super(_0x210cf0),this['listWrapperView']=new St(_0x210cf0,_0x5cc536),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':et(_0x210cf0,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']]});}},St=class extends _0x504fdf{constructor(_0x10f4ac,_0x3aeaa0){super(_0x10f4ac);const _0x36224d=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0x3aeaa0?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0x36224d['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0x36224d['to']('role'),'aria-label':_0x36224d['to']('ariaLabel'),'aria-labelledby':_0x36224d['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0x530d5e['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0x15c150=this['element'];_0x15c150&&(this['_isScrollable']=Math['max'](_0x15c150['scrollHeight'],_0x15c150['clientHeight'])>0.8*window['innerHeight']);}},Tt=class extends _0x550a9f{['userView'];constructor(_0x5c0d13,_0x4806e8,_0x14e352){super(_0x5c0d13);const _0x507ca1=this['bindTemplate'];this['userView']=new _0x151f2b(_0x5c0d13,_0x4806e8);const _0x409a9b={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0x4806e8['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0x4806e8['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x4806e8['color']['getBackgroundColorClass']()],'style':{'--ck-user-color':_0x4806e8['color']['getColorVariable'](),'--ck-user-color-alpha':_0x4806e8['color']['getColorAlphaVariable']()},'aria-hidden':'true'}}]};_0x14e352&&(_0x409a9b['tag']='button',_0x409a9b['on']={'click':_0x507ca1['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x409a9b);}['focus'](){this['element']['focus']();}},Ct=class extends _0x3e1902{['userView'];['markerView'];constructor(_0x7156bf,_0x57efae,_0x1ee68e){super(_0x7156bf);const _0x348059=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new _0x151f2b(_0x7156bf,_0x57efae),this['markerView']=new At(_0x7156bf,_0x57efae);const _0x45c599=new _0x3cf6aa(_0x7156bf);_0x45c599['template']['tag']='span',_0x45c599['text']=_0x57efae['name'];const _0x23d2cf={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0x348059['to']('isFocusable',_0x3aabd6=>!!_0x3aabd6&&0x0),'aria-labelledby':_0x45c599['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0x348059['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0x348059['to']('hasTooltip',_0xa93557=>!_0xa93557),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0x45c599]};_0x1ee68e&&(_0x23d2cf['tag']='button',_0x23d2cf['on']={'click':_0x348059['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x23d2cf);}},At=class extends _0x3e1902{constructor(_0xbe8493,_0x12ebd1){super(_0xbe8493),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x12ebd1['color']['getBackgroundColorClass']()],'style':{'--ck-user-color':_0x12ebd1['color']['getColorVariable'](),'--ck-user-color-alpha':_0x12ebd1['color']['getColorAlphaVariable']()},'aria-hidden':'true'}});}};const Pt={'collapseAt':0x6,'displayMe':!0x0};var Ot=class extends _0x35619e{currentDisplayedUsers;['balloonPanelView'];['view'];['presenceDropdownView'];_overlayHost=null;static get['pluginName'](){return'PresenceListUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x3f9c45){super(_0x3f9c45),this['context']['config']['define']('presenceList',Pt);const _0x4f2fb0=_0x3f9c45['config']['get']('presenceList.collapseAt');if('number'!=typeof _0x4f2fb0)throw new _0x4aa6b2('presencelist-collapseat-invalid-format',this);if(_0x4f2fb0<0x1)throw new _0x4aa6b2('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](Q)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0x1f253d(),this['balloonPanelView']=new _0x1b91d3(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get requires(){return[Q];}init(){for(const _0x1ef040 of this['_allConnectedUsers'])this['_handleUserAdd'](_0x1ef040);this['listenTo'](this['_allConnectedUsers'],'add',(_0x4a112e,_0x3fe51e)=>{this['_handleUserAdd'](_0x3fe51e);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0x37c210,_0x51ff7a)=>{this['_handleUserRemove'](_0x51ff7a);});}_createView(){const _0x4f0a4c=this['context'],_0xad52ca=new kt(this['context']['locale'],this['context']['config']['get']('presenceList.collapseAt')),_0x4bf16e=this['balloonPanelView'];if(!_0x15e8aa(_0x4f0a4c['config']['get']('presenceList.container')))throw new _0x4aa6b2('presencelist-missing-container',this);_0xad52ca['counterView']['bind']('usersCount')['to'](this),_0xad52ca['bind']('isCollapsed')['to'](this,'usersCount',_0x8be97d=>{const {collapseAt:_0x3a39a2}=_0x4f0a4c['config']['get']('presenceList'),_0x500f9f=_0x8be97d>=_0x3a39a2;if(_0x500f9f&&!_0xad52ca['inlineListView']['items']['find'](_0x37a7c0=>_0x37a7c0 instanceof yt)){const _0x1eedfd=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['currentDisplayedUsers']['length']==_0x1eedfd&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](this['currentDisplayedUsers']['length']-0x1),_0xad52ca['inlineListView']['items']['add'](_0xad52ca['counterView']);}return _0x500f9f||this['hideDropdown'](),_0x500f9f;}),_0xad52ca['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0x4cd0c1=>{const _0x13aca4=_0x4f0a4c['config']['get']('presenceList'),_0x84cd6=new Ct(_0x4f0a4c['locale'],_0x4cd0c1,!!_0x13aca4['onClick']);return _0x84cd6['bind']('hasTooltip')['to'](_0xad52ca,'isCollapsed',_0x40e535=>!_0x40e535),_0x84cd6['bind']('isFocusable')['to'](_0xad52ca,'isCollapsed',_0x1ec435=>!_0x1ec435),_0x13aca4['onClick']&&this['listenTo'](_0x84cd6,'execute',()=>{this['view']['isCollapsed']||_0x13aca4['onClick'](_0x4cd0c1,_0x84cd6['element']);}),_0x84cd6;}),_0xad52ca['inlineListView']['keystrokes']['set']('Enter',(_0x382b07,_0x5c5217)=>{this['view']['isCollapsed']&&(this['showDropdown'](),this['presenceDropdownView']?.['listWrapperView']['focus'](),_0x5c5217());}),_0xad52ca['render'](),_0x4bf16e['render'](),_0xad52ca['listenTo'](_0xad52ca['inlineListView']['element'],'mouseenter',()=>{this['view']['isCollapsed']&&this['showDropdown']();});const _0x2ffbf6=(_0xe744da,_0x412d53)=>{this['_hideDropdownUnlessPointerInside'](_0x412d53);};return _0xad52ca['listenTo'](_0xad52ca['inlineListView']['element'],'mouseleave',_0x2ffbf6),_0xad52ca['listenTo'](_0x4bf16e['element'],'mouseleave',_0x2ffbf6),_0x21bc0f({'emitter':_0xad52ca,'activator':()=>_0x4bf16e['isVisible'],'contextElements':[_0x4bf16e['element'],_0xad52ca['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0x4f0a4c['config']['get']('presenceList.container')['appendChild'](_0xad52ca['element']),this['_overlayHost']=new _0x565793(this['context']['locale'],{'resolveMountTarget':()=>this['_resolveOverlayTarget'](),'resolveInlineContainer':()=>this['context']['config']['get']('presenceList.container')}),this['_overlayHost']['sync'](),this['_overlayHost']['bodyCollection']['add'](this['balloonPanelView']),_0xad52ca;}_resolveOverlayTarget(){const _0x1e43a4=this['context']['config']['get']('presenceList.overlayContainer')||this['context']['config']['get']('ui.overlayContainer');if(_0x1e43a4)return _0x1e43a4;const _0x2e7fe3=this['context']['config']['get']('presenceList.container');return _0x2e7fe3?_0x432c87(_0x2e7fe3):null;}['_handleUserAdd'](_0x2bf2dd){if(!this['context']['config']['get']('presenceList.displayMe')&&_0x2bf2dd['isMe'])return;const _0x4c52d6=this['context']['config']['get']('presenceList.collapseAt')-0x1;for(this['usersCount']++;this['currentDisplayedUsers']['length']>=_0x4c52d6-(this['view']['isCollapsed']?0x1:0x0)&&this['currentDisplayedUsers']['length']>0x1;)this['currentDisplayedUsers']['remove'](0x1);const _0x1713b0=_0x2bf2dd['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0x2bf2dd,_0x1713b0);}['_handleUserRemove'](_0x370544){this['usersCount']--;const {collapseAt:_0x1dc6ff}=this['context']['config']['get']('presenceList'),_0x38061f=this['usersCount']>=_0x1dc6ff;if(this['currentDisplayedUsers']['get'](_0x370544['id']))this['currentDisplayedUsers']['remove'](_0x370544['id']);else{if(_0x38061f&&this['currentDisplayedUsers']['length']+0x1===_0x1dc6ff-0x1)return;}if(this['currentDisplayedUsers']['length']+(_0x38061f?0x1:0x0)<this['usersCount']){for(const _0x1472bc of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0x1472bc['id'])&&(this['currentDisplayedUsers']['add'](_0x1472bc,Math['min'](this['currentDisplayedUsers']['length']-(_0x38061f?0x1:0x0),0x1)),this['currentDisplayedUsers']['length']+(_0x38061f?0x1:0x0)===_0x1dc6ff-0x1))return;}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0xcf8a54=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new It(this['context']['locale'],!!_0xcf8a54['onClick']),this['view']['inlineListView']['isExpanded']=!0x0;const {listWrapperView:_0x18e2d1}=this['presenceDropdownView'];_0x18e2d1['items']['bindTo'](this['_allConnectedUsers'])['using'](_0x52cc46=>{if(!_0xcf8a54['displayMe']&&_0x52cc46['isMe'])return null;const _0x68cf57=new Tt(this['context']['locale'],_0x52cc46,!!_0xcf8a54['onClick']);return _0xcf8a54['onClick']&&this['listenTo'](_0x68cf57,'execute',()=>{_0xcf8a54['onClick'](_0x52cc46,_0x68cf57['element']);}),_0x68cf57;}),this['_overlayHost']?.['sync'](),this['balloonPanelView']['content']['add'](this['presenceDropdownView']),this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element']}),_0x18e2d1['focus'](),_0x18e2d1['checkIfScrollable']();const _0x828dd4=(_0x4dc4cd,_0x9014b8)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0x9014b8();};_0x18e2d1['keystrokes']['set']('Esc',_0x828dd4),_0x18e2d1['keystrokes']['set']('Shift+Tab',_0x828dd4),_0x18e2d1['keystrokes']['set']('Tab',()=>{this['view']['inlineListView']['focus'](),this['hideDropdown']();}),_0x18e2d1['focusTracker']['add'](this['view']['element']),_0x18e2d1['focusTracker']['on']('change:isFocused',(_0x1a4d12,_0x54295d,_0x27c511)=>{_0x27c511||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);}_hideDropdownUnlessPointerInside(_0x495379){this['presenceDropdownView']&&([this['view']['inlineListView']['element'],this['balloonPanelView']['element']]['some'](_0x39dd87=>_0x3a6c3e(_0x39dd87,_0x495379))||this['hideDropdown']());}destroy(){super['destroy'](),this['view']&&this['view']['isRendered']&&this['view']['destroy'](),this['_overlayHost']&&(this['_overlayHost']['destroy'](),this['_overlayHost']=null);}},xt=class extends _0x35619e{static get requires(){return[Q,Ot];}static get['pluginName'](){return'PresenceList';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}};export{at as CloudServicesCommentsAdapter,wt as CloudServicesRevisionHistoryAdapter,ut as CloudServicesTrackChangesAdapter,xt as PresenceList,Ot as PresenceListUI,it as RealTimeCollaborationClient,pt as RealTimeCollaborativeComments,ct as RealTimeCollaborativeEditing,_t as RealTimeCollaborativeRevisionHistory,gt as RealTimeCollaborativeTrackChanges,Q as Sessions,J as WebSocketGateway};
|
|
23
|
+
import{Context as _0x46ea9b,ContextPlugin as _0x2470ea,PendingActions as _0x1bbdfc,Plugin as _0x2b96e7}from'@ckeditor/ckeditor5-core';import{CKEditorError as _0x1cba4d,Collection as _0x30b45c,DomEmitterMixin as _0x54b94a,KeystrokeHandler as _0x4cd84c,getOverlayMountRoot as _0x445939,global as _0x327fcb,trustedHtml as _0x74deec,uid as _0x467ff8,version as _0x3a3f2b}from'@ckeditor/ckeditor5-utils';import{BalloonPanelView as _0x92771e,LabelView as _0x2576ff,ListItemView as _0x3fc642,ListView as _0x461b02,Notification as _0x3bbe7d,OverlayHost as _0x52da97,View as _0x1bdd03,clickOutsideHandler as _0x4d491f}from'@ckeditor/ckeditor5-ui';import{History as _0x31e537,InsertOperation as _0x215f26,MarkerOperation as _0x524ea7,ModelLiveRange as _0x294958,NoOperation as _0x3884c7,OperationFactory as _0x5bcd72,RootAttributeOperation as _0xdd6fed,transformOperationSets as _0x94c6ca}from'@ckeditor/ckeditor5-engine';import{CloudServices as _0x395891}from'@ckeditor/ckeditor5-cloud-services';import{CollaborativeEditingService as _0x1c22d4,CommentsService as _0x1f5016,EditorService as _0x4f77ac,RevisionHistoryService as _0x15f775,TrackChangesService as _0x58ce33,User as _0x11acf3,WEB_SOCKET_GATEWAY_STATES as _0x5377a0,WebSocketGateway as _0x261987}from'@ckeditor/ckeditor-cloud-services-collaboration';import{UserView as _0x30b579,Users as _0x4857ba,isPointerStillOver as _0x149d83}from'@ckeditor/ckeditor5-collaboration-core';import{Compressor as _0x3559a5}from'@ckeditor/ckeditor5-operations-compressor';import{TrackChanges as _0x318f0b,TrackChangesEditing as _0x5d8e67}from'@ckeditor/ckeditor5-track-changes';import{Comments as _0x1ea26e,CommentsEditing as _0x360017,CommentsRepository as _0x5ee2c7}from'@ckeditor/ckeditor5-comments';import{RevisionHistory as _0x422c21}from'@ckeditor/ckeditor5-revision-history';import{isElement as _0x3663b3}from'es-toolkit/compat';var J=class WebSocketGateway extends _0x2470ea{static WebSocketGateway=/* #__PURE__ -- @preserve */
|
|
24
|
+
((()=>_0x261987)());static initialReconnectionInterval=0x3e8;connection;_reconnectionStack;_shouldPluginsReconnect;_domEmitter;static get requires(){return[_0x395891,_0x3bbe7d];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x182969){super(_0x182969),this['set']('state',_0x5377a0['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=new(_0x54b94a())();}init(){const _0x2ae94b=this['context'],_0x516a7e=_0x2ae94b['plugins']['get'](_0x395891),_0x5ad676=_0x2ae94b['plugins']['get'](_0x3bbe7d);if(!_0x516a7e['token'])throw new _0x1cba4d('websocketgateway-missing-token',this);if(!_0x516a7e['webSocketUrl'])throw new _0x1cba4d('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'](_0x516a7e['token'],_0x516a7e['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0xb09b33=>{if(this['connection']=_0xb09b33,this['bind']('state')['to'](_0xb09b33,'state',this,'_isBrowserOffline',(_0x33dd00,_0x1fbd3a)=>('connected'!==_0x33dd00&&(this['_shouldPluginsReconnect']=!0x0),_0x1fbd3a||_0x33dd00!==_0x5377a0['CONNECTED']?_0x5377a0['DISCONNECTED']:this['state']==_0x5377a0['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),_0x5377a0['CONNECTING']):_0x5377a0['CONNECTED'])),this['connection']['on']('error',(_0x2db714,_0x209d14)=>{if('limitExceeded'!==_0x209d14['code'])throw console['error'](_0x209d14),new _0x1cba4d('cloudservices-init',null,{'originalError':_0x209d14});_0x5ad676['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'});}),!_0xb09b33['me'])return new Promise(_0x2af85c=>_0xb09b33['on']('change:me',_0x2af85c));})['catch'](_0xe743e=>{throw console['error'](_0xe743e),new _0x1cba4d('cloudservices-init',null,{'originalError':_0xe743e});});}addToReconnectionStack(_0x5e731a){if('function'!=typeof _0x5e731a['reconnect'])throw new _0x1cba4d('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0x5e731a))throw new _0x1cba4d('websocketgateway-plugin-already-registered',this,{'name':_0x5e731a['constructor']['pluginName']});this['_reconnectionStack']['add'](_0x5e731a);}removeFromReconnectionStack(_0x35f1a9){this['_reconnectionStack']['delete'](_0x35f1a9);}isInReconnectionStack(_0x493c8b){return this['_reconnectionStack']['has'](_0x493c8b);}_reconnect(){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0x4f0e13=>_0x4f0e13['reconnect']())))['then'](()=>this['state']=_0x5377a0['CONNECTED'])['catch'](_0x4fa554=>{throw console['error'](_0x4fa554),new _0x1cba4d('cloudservices-reconnection-error',this['context']);});}disconnect(){this['connection']&&this['connection']['disconnect'](),this['state']=_0x5377a0['DISCONNECTED'],this['_domEmitter']['stopListening']();}destroy(){this['disconnect'](),super['destroy']();}},Q=class extends _0x2470ea{['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[J,_0x4857ba];}constructor(_0x57e4fb){super(_0x57e4fb),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0x30b45c(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x4857ba);}init(){const _0x4fbad8=this['context']['plugins']['get'](J);this['listenTo'](_0x4fbad8,'change:state',(_0x568dc8,_0x52bf15,_0x5c38bb)=>{if('connected'!==_0x5c38bb)this['channelSessions']['forEach'](_0x4d422f=>_0x4d422f['clear']()),this['channelConnectedUsers']['forEach'](_0x435150=>_0x435150['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x3395b4,_0x2e10bd]of this['_registeredSessions'])for(const _0x5f3685 of _0x2e10bd)this['_handleSessionAdd'](_0x3395b4,_0x5f3685);}}),this['_createUser'](_0x4fbad8['connection']['me'],!0x0);}register(_0x106e6a,_0x2a6a6b){if(this['_registeredSessions']['has'](_0x106e6a))throw new _0x1cba4d('sessions-register-already-registered',null,{'channelId':_0x106e6a});this['_registeredSessions']['set'](_0x106e6a,_0x2a6a6b),this['channelSessions']['set'](_0x106e6a,new _0x30b45c()),this['channelConnectedUsers']['set'](_0x106e6a,new _0x30b45c()),this['listenTo'](_0x2a6a6b,'add',(_0x4d7a8e,_0x1d61d6)=>this['_handleSessionAdd'](_0x106e6a,_0x1d61d6)),this['listenTo'](_0x2a6a6b,'remove',(_0xd8b718,_0x151af6)=>this['_handleSessionRemove'](_0x106e6a,_0x151af6));for(const _0x2e9583 of _0x2a6a6b)this['_handleSessionAdd'](_0x106e6a,_0x2e9583);}unregister(_0x3fbdfa){if(!this['_registeredSessions']['has'](_0x3fbdfa))throw new _0x1cba4d('sessions-unregister-not-exist',null,{'channelId':_0x3fbdfa});const _0x42fbac=this['_registeredSessions']['get'](_0x3fbdfa);this['stopListening'](_0x42fbac);for(const _0x3b4368 of _0x42fbac)'connected'===this['context']['plugins']['get'](J)['state']&&this['_handleSessionRemove'](_0x3fbdfa,_0x3b4368);this['_registeredSessions']['delete'](_0x3fbdfa),this['channelSessions']['delete'](_0x3fbdfa),this['channelConnectedUsers']['delete'](_0x3fbdfa);}get['mySessionId'](){return this['context']['plugins']['get'](J)['connection']['sessionId'];}getUserBySessionId(_0x5d9a08){for(const _0xfa848b of this['channelSessions']['values']())for(const _0x12b49f of _0xfa848b)if(_0x12b49f['id']===_0x5d9a08)return _0x12b49f['user'];}getUserSessions(_0x4e6cfb,_0x1430d2){const _0x5a9579=_0x1430d2?[this['channelSessions']['get'](_0x1430d2)]:this['channelSessions']['values'](),_0x19b95a=new Set();for(const _0x3ceba8 of _0x5a9579)for(const _0x108fe7 of _0x3ceba8)_0x108fe7['user']['id']===_0x4e6cfb['id']&&_0x19b95a['add'](_0x108fe7['id']);return _0x19b95a;}getUserRole(_0x249e51){for(const _0x5ebcbe of this['channelSessions']['values']())for(const _0x2adf27 of _0x5ebcbe)if(_0x2adf27['user']===_0x249e51)return _0x2adf27['role'];}['_handleSessionAdd'](_0x4cc9c7,_0x569434){if('connected'!==this['context']['plugins']['get'](J)['state'])return;const _0x113243=_0x569434['user'],_0x3c892f=this['_users']['getUser'](_0x113243['id'])||this['_createUser'](_0x113243),_0x2ad924=Object['assign']({},_0x569434,{'user':_0x3c892f});if(this['channelSessions']['get'](_0x4cc9c7)['add'](_0x2ad924),!_0x113243['hiddenInPresenceList']){const _0x3ddc15=this['channelConnectedUsers']['get'](_0x4cc9c7);_0x3ddc15['has'](_0x3c892f['id'])||_0x3ddc15['add'](_0x3c892f),this['allConnectedUsers']['has'](_0x3c892f['id'])||_0x113243['hiddenInPresenceList']||this['allConnectedUsers']['add'](_0x3c892f,_0x3c892f['isMe']?0x0:void 0x0);}this['fire']('sessionAdd:'+_0x4cc9c7,{'channelId':_0x4cc9c7,'session':_0x2ad924});}['_handleSessionRemove'](_0x51862d,_0x15f636){if('connected'!==this['context']['plugins']['get'](J)['state'])return;const _0x51f197=this['channelConnectedUsers']['get'](_0x51862d),_0x177ad=_0x15f636['user'];_0x177ad['id']&&(this['channelSessions']['get'](_0x51862d)['remove'](_0x15f636['id']),_0x51f197['has'](_0x177ad['id'])&&!this['getUserSessions'](_0x177ad,_0x51862d)['size']&&_0x51f197['remove'](_0x177ad['id']),this['allConnectedUsers']['get'](_0x177ad['id'])&&!this['getUserSessions'](_0x177ad)['size']&&this['allConnectedUsers']['remove'](_0x177ad['id']));}_createUser(_0x4d9ead,_0x5a9e4f){const _0x109ec5=this['_users']['addUser'](_0x4d9ead);return _0x5a9e4f&&this['_users']['defineMe'](_0x4d9ead['id']),_0x109ec5['orderNumber']=this['_uniqueUsersCount']++,_0x109ec5;}},X=class extends _0x2b96e7{_domEmitter=new(_0x54b94a())();static get requires(){return[Q];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const _0x1f2a25=this['editor'],_0x146a26=_0x1f2a25['plugins']['get'](Q);_0x1f2a25['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x194cc5,{writer:_0x58917d})=>function(_0x155671,_0x309a2f,_0x598766,_0x546bbf){const _0x110dd1=_0x155671['markerName']['split'](':')[0x2],_0x19e7b4=_0x598766['getUserBySessionId'](_0x110dd1);if(!_0x19e7b4||_0x110dd1===_0x598766['mySessionId'])return;if(!_0x546bbf['model']['schema']['checkChild'](_0x155671['markerRange']['start'],'$text'))return;const _0x39ad66={'class':'ck-user__marker\x20'+_0x19e7b4['color']['getMarkerClass'](),'style':tt(_0x19e7b4),'data-name':_0x19e7b4['name'],'data-session-id':_0x110dd1},_0x1781dd=_0x546bbf['model']['markers']['get'](_0x155671['markerName'])['getStart'](),_0x190c1c=_0x1781dd['nodeAfter'],_0x4c624f=_0x546bbf['model']['schema'];if(_0x190c1c&&_0x4c624f['isObject'](_0x190c1c)&&_0x4c624f['isInline'](_0x190c1c)&&!_0x546bbf['model']['markers']['get']('user:range:'+_0x110dd1)['getRange']()['isCollapsed'])return;const _0x45f301=_0x1781dd['parent'];return _0x546bbf['model']['schema']['isLimit'](_0x45f301)&&!_0x546bbf['model']['hasContent'](_0x45f301)&&(_0x39ad66['contenteditable']=!0x1),function(_0x462f52,_0x2fa887,_0x269e15){const _0x57fc22=_0x462f52['createUIElement']('span',_0x2fa887);return _0x462f52['setCustomProperty']('userPositionMarker',!0x0,_0x57fc22),_0x57fc22['render']=function(_0x1ee579){const _0x3ac6d7=this['toDomElement'](_0x1ee579),_0x34a5a0=document['createElement']('span');return _0x34a5a0['classList']['add']('ck-user__marker-tooltip'),_0x34a5a0['setAttribute']('contenteditable','false'),_0x34a5a0['setAttribute']('spellcheck','false'),_0x34a5a0['textContent']=_0x269e15['name'],_0x3ac6d7['innerHTML']=_0x74deec('<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span>'+_0x34a5a0['outerHTML']+''),_0x3ac6d7['addEventListener']('mouseenter',()=>{_0x3ac6d7['classList']['add']('ck-user__marker_hovered');}),_0x3ac6d7['addEventListener']('mouseleave',()=>{_0x3ac6d7['classList']['remove']('ck-user__marker_hovered');}),_0x3ac6d7;},_0x57fc22['isSimilar']=function(_0x220943){return!(!this['getCustomProperty']('userPositionMarker')||!_0x220943['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0x220943['getAttribute']('data-session-id'));},_0x57fc22;}(_0x309a2f,_0x39ad66,_0x19e7b4);}(_0x194cc5,_0x58917d,_0x146a26,_0x1f2a25)}),_0x1f2a25['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0x54997c=>function(_0x320e8a,_0x6e38a0){const _0x27eb24=_0x320e8a['markerName']['split'](':')[0x2];if(_0x27eb24===_0x6e38a0['mySessionId'])return null;const _0x25f60c=_0x6e38a0['getUserBySessionId'](_0x27eb24);return _0x25f60c?{'id':_0x27eb24,'classes':['ck-user__selection',_0x25f60c['color']['getSelectionClass']()],'attributes':{'style':tt(_0x25f60c),'data-session-id':_0x27eb24},'priority':0x7d0+_0x25f60c['orderNumber']}:{'id':_0x27eb24,'classes':[]};}(_0x54997c,_0x146a26)}),function(_0x52a7d0){const _0xe893f5=_0x52a7d0['model'],_0x4577a5=new Map(),_0x38953f=_0x52a7d0['plugins']['get'](Q);_0xe893f5['markers']['on']('update:user:range',(_0x3cba9c,_0x5111c3,_0x352bf8,_0x47fbc7)=>{if(!_0x47fbc7&&_0x4577a5['get'](_0x5111c3['name']))return _0x4577a5['get'](_0x5111c3['name'])['detach'](),void _0x4577a5['delete'](_0x5111c3['name']);const _0x2ce23e=_0x5111c3['name']['split'](':')[0x2];if(_0x2ce23e===_0x38953f['mySessionId'])return;const _0x3f0ea3='user:position:'+_0x2ce23e;_0xe893f5['markers']['has'](_0x3f0ea3)&&_0x52a7d0['editing']['reconvertMarker'](_0x3f0ea3),_0x5111c3['on']('change:range',(_0x4dd89d,_0x5c2c14,_0x18e5b8)=>{if('$graveyard'!=_0x5c2c14['root']['rootName']&&'$graveyard'==_0x5111c3['getRange']()['root']['rootName']&&!_0x4577a5['has'](_0x5111c3['name'])){const _0x4e022d=_0xe893f5['schema']['getNearestSelectionRange'](_0x18e5b8['deletionPosition']);if(_0x4e022d){const _0x4192d9=_0x294958['fromRange'](_0x4e022d);_0x4577a5['set'](_0x5111c3['name'],_0x4192d9),_0x4192d9['on']('change:range',(_0xe6b2d0,_0x3285aa,_0x2d46b8)=>{if('$graveyard'==_0x4192d9['root']['rootName']){const _0xecfbf5=_0xe893f5['schema']['getNearestSelectionRange'](_0x2d46b8['deletionPosition']);_0xecfbf5?(_0x4192d9['start']=_0xecfbf5['start'],_0x4192d9['end']=_0xecfbf5['end']):(_0x4577a5['delete'](_0x5111c3['name']),_0x4192d9['detach']());}});}}});}),_0xe893f5['document']['on']('change',()=>{_0x4577a5['size']>0x0&&_0xe893f5['enqueueChange']({'isUndoable':!0x1},_0x19cbd7=>{for(const [_0x1b44eb,_0x34cfdc]of _0x4577a5)'$graveyard'==_0xe893f5['markers']['get'](_0x1b44eb)['getRange']()['root']['rootName']&&(Z(_0x1b44eb['split'](':')[0x2],_0x34cfdc['toRange'](),_0xe893f5,_0x19cbd7),_0x34cfdc['detach']());_0x4577a5['clear']();});});}(_0x1f2a25),this['_domEmitter']['listenTo'](_0x327fcb['document'],'keydown',(_0x4c7349,{key:_0x5a9249})=>{'Escape'===_0x5a9249&&function(_0x2dfca9){_0x2dfca9['editing']['view']['change'](_0xdb818=>{for(const _0x4ea777 of _0x2dfca9['model']['markers']){if(!_0x4ea777['name']['startsWith']('user:position'))continue;const _0x4dbbf9=_0x2dfca9['editing']['mapper']['markerNameToElements'](_0x4ea777['name']);if(_0x4dbbf9){for(const _0x417d4d of _0x4dbbf9)_0xdb818['removeClass']('ck-user__marker_hovered',_0x417d4d);}}});}(_0x1f2a25);},{'useCapture':!0x0});}afterInit(){const _0x2bc6c8=this['editor'],_0x13c1d8=_0x2bc6c8['commands']['get']('undo');_0x13c1d8&&_0x2bc6c8['model']['on']('applyOperation',(_0x409e53,_0x5b8d31)=>{const _0x3f9f7d=_0x5b8d31[0x0];if(!_0x3f9f7d['isDocumentOperation'])return;if('marker'!=_0x3f9f7d['type']||!_0x3f9f7d['name']['startsWith']('user:'))return;const _0x414d3d=_0x3f9f7d['batch'];_0x13c1d8['_createdBatches']['has'](_0x414d3d)&&(_0x3f9f7d['newRange']=_0x3f9f7d['oldRange']?_0x2bc6c8['model']['createRange'](_0x3f9f7d['oldRange']['start'],_0x3f9f7d['oldRange']['end']):null);},{'priority':'highest'});}destroy(){return this['_domEmitter']['stopListening'](),super['destroy']();}createUserMarkerOperations(){const _0x53f523=this['editor'],_0x42c516=_0x53f523['model']['document'],_0x4a2f7a=_0x53f523['plugins']['get'](Q);_0x53f523['model']['enqueueChange']({'isUndoable':!0x1},_0x10eec7=>{const _0x4503f0='user:range:'+_0x4a2f7a['mySessionId'],_0x5ab6f9='user:position:'+_0x4a2f7a['mySessionId'],_0x2b76de=_0x53f523['model']['markers']['has'](_0x4503f0);_0x53f523['editing']['view']['hasDomSelection']?Z(_0x4a2f7a['mySessionId'],_0x42c516['selection']['getFirstRange'](),_0x53f523['model'],_0x10eec7):_0x2b76de&&(_0x10eec7['removeMarker'](_0x4503f0),_0x10eec7['removeMarker'](_0x5ab6f9));});}};function Z(_0x2d2478,_0xc75fd7,_0x4153bf,_0x4d480e){const _0x2fe118='user:range:'+_0x2d2478,_0x1d0243='user:position:'+_0x2d2478,_0x38520d=_0xc75fd7['getContainedElement']();let _0x5bf7da=_0xc75fd7['start'];if(_0x38520d&&_0x38520d['is']('element','tableCell')){const _0x4063c9=function(_0x3e0141,_0x59dfe6){for(const _0x2b0bd1 of _0x3e0141['getPositions']())if(_0x59dfe6['schema']['checkChild'](_0x2b0bd1,'$text'))return _0x2b0bd1;}(_0xc75fd7,_0x4153bf);_0x4063c9&&(_0x5bf7da=_0x4063c9,_0xc75fd7=_0x4d480e['createRange'](_0x5bf7da));}const _0xc692df=_0x4d480e['createRange'](_0x5bf7da);_0x4153bf['markers']['has'](_0x2fe118)?(_0x4d480e['updateMarker'](_0x2fe118,{'range':_0xc75fd7}),_0x4d480e['updateMarker'](_0x1d0243,{'range':_0xc692df})):(_0x4d480e['addMarker'](_0x2fe118,{'range':_0xc75fd7,'usingOperation':!0x0}),_0x4d480e['addMarker'](_0x1d0243,{'range':_0xc692df,'usingOperation':!0x0}));}function tt(_0x32a0b6){return'--ck-user-color:'+_0x32a0b6['color']['getColorVariable']()+';--ck-user-color-alpha:'+_0x32a0b6['color']['getColorAlphaVariable']()+';';}function et(_0x1a4a1c,_0x486945,_0x2b5ac9){const _0x45e1e5=_0x1a4a1c['t'],t=_0x1a4a1c['t'];switch(_0x486945){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 _0x45e1e5({'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'},_0x2b5ac9);default:return'';}}let st=0x1;var it=class RealTimeCollaborationClient extends _0x2b96e7{static CollaborativeEditingService=/* #__PURE__ -- @preserve */
|
|
25
|
+
((()=>_0x1c22d4)());_offset;['sessionId'];serverHistory;['_channelId'];['_service'];_document;['_compressor'];_bufferedOperations;_knownOperations;_knownRootNames;_pendingAction;_hasSelectionChanged;_sendBufferedOperationsDelayId;['_baseBufferDelay'];_currentBufferDelay;_lastSyncedOperationId;_disconnectionOperations;_operationIdentifier;static get requires(){return[J,Q,X,_0x1bbdfc,_0x4857ba,_0x3bbe7d];}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 _0x587a56=this['serverHistory']['getOperations']();for(let _0x3f93c0=_0x587a56['length']-0x1;_0x3f93c0>=0x0;_0x3f93c0--){const _0xd0e3cd=_0x587a56[_0x3f93c0];if(!this['_disconnectionOperations']['has'](_0xd0e3cd))return _0xd0e3cd['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0x1eb691){if(super(_0x1eb691),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x31e537(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0x1cba4d('collaboration-missing-channelid',this);const _0x62e0fb=_0x1eb691['config']['get']('cloudServices.bundleVersion')||_0x3a3f2b;this['_service']=new RealTimeCollaborationClient['CollaborativeEditingService'](_0x62e0fb,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0x3559a5(),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 rt(this['_disconnectionOperations']);}init(){const _0x113caf=this['editor'],_0x10efa8=_0x113caf['plugins']['get'](_0x4857ba),_0x3c2ee4=_0x113caf['plugins']['get'](J);this['listenTo'](_0x10efa8,'getOperationAuthor',(_0x29b5f7,_0x7e56be)=>{const _0x5e1645=_0x7e56be[0x0];_0x5e1645['_authorId']&&(_0x29b5f7['return']=_0x10efa8['getUser'](_0x5e1645['_authorId']),_0x29b5f7['stop']()),null===_0x5e1645['_authorId']&&(_0x29b5f7['return']=null,_0x29b5f7['stop']());},{'priority':'high'}),this['listenTo'](_0x113caf['model']['document']['selection'],'change:range',(_0x40b134,_0x19ff98)=>{_0x19ff98['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x113caf['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x113caf['model']['on']('applyOperation',(_0x418991,_0x160673)=>{const _0x1f1b2c=_0x160673[0x0];_0x1f1b2c['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0x1f1b2c),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['set']('_isChannelFlushed',!0x1),this['bind']('_isEditingAllowed')['to'](_0x3c2ee4,'state',this,'_hasSynchronizationProblem',this,'_isChannelFlushed',(_0xd1e5cd,_0x451249,_0x9bca16)=>'connected'===_0xd1e5cd&&!_0x451249&&!_0x9bca16),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x113caf['disableReadOnlyMode']('rtc-offline'):_0x113caf['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x113caf['disableReadOnlyMode']('rtc-offline'):_0x113caf['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async reconnect(){const _0x408179=this['editor']['plugins']['get'](Q),_0x1034fe=this['editor']['plugins']['get'](J);try{this['_isPendingUpdate']=!0x0,_0x408179['unregister'](this['_channelId']);const _0x142bf7=await this['_service']['reconnect'](_0x1034fe['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0x142bf7)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x4a832f=await this['_service']['getConnectedSessions']();_0x408179['register'](this['_channelId'],_0x4a832f),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x292e2a){if(function(_0x2da8fe){return'404'===_0x2da8fe['code'];}(_0x292e2a)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0x5ef61f){return'409'===_0x5ef61f['code'];}(_0x292e2a)){const _0x35f2fc=et(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'](_0x35f2fc);}else{if(!(_0x292e2a instanceof nt))throw _0x292e2a;this['_handleReconnectionError']();}}}}destroy(){const _0x493432=this['editor']['plugins']['get'](J),_0x5bcd54=this['editor']['plugins']['get'](Q);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x5bcd54['channelSessions']['has'](this['_channelId'])&&_0x5bcd54['unregister'](this['_channelId']),_0x493432['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async _handleReconnectionResponse(_0x28c1c3){if(this['sessionId']!==_0x28c1c3['sessionId']&&this['_lastSyncedOperationId']!==_0x28c1c3['lastOperationId'])throw new nt();return this['sessionId']=_0x28c1c3['sessionId'],this['_handleServerResponse']([],{..._0x28c1c3,'wereChangesApplied':!0x1,'data':_0x28c1c3['data']},'reconnect');}async _connectService(_0x24a14a,_0x27bcb6=!0x1){const {connection:_0x555c4c}=this['editor']['plugins']['get'](J);RealTimeCollaborationClient['CollaborativeEditingService']['getConnectedSessions'](_0x555c4c,this['_channelId'])['then'](_0x3eb2fa=>this['_initSessionsHandling'](_0x3eb2fa))['catch'](_0x22d122=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x22d122);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x1132a0,_0x4d5a1c)=>{this['_crash']('realtimecollaborationclient-init-service-internal-error',_0x4d5a1c);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_handleChannelDisconnected']();});const _0x1a6c35=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x24a14a);this['_isPendingUpdate']=!0x0;const _0x3c12f5=await this['_service']['connect'](_0x555c4c,this['_compressOperations'](_0x24a14a),_0x1a6c35);if(this['sessionId']=_0x3c12f5['sessionId'],_0x27bcb6){if(!_0x3c12f5['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x3c12f5['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0x24a14a,_0x3c12f5,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x3c12f5,_0x24a14a);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}_handleSendingSelectionMarkers(){const _0x3f0981=this['editor']['plugins']['get'](Q),_0x12b822=this['editor']['plugins']['get'](X),_0x556ab1=_0x3f0981['channelSessions']['get'](this['_channelId']);_0x556ab1&&_0x556ab1['length']>0x1?_0x12b822['createUserMarkerOperations']():this['listenTo'](_0x3f0981,'sessionAdd:'+this['_channelId'],()=>{0x2===_0x3f0981['channelSessions']['get'](this['_channelId'])['length']&&_0x12b822['createUserMarkerOperations']();});}async _handleReceivedOperations(_0x3b0354,_0x2a256a,_0x1675d4,_0x4b4b64){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x2a256a){const _0x16b33e=this['_decompressOperations'](_0x1675d4,_0x4b4b64);await this['_fetchMissingUsers'](_0x16b33e),this['_handleExternalOperations'](_0x16b33e,_0x2a256a,_0x1675d4['lastOperationId'])||this['_crash']('realtimecollaborationclient-init-service-incorrect-server-operation');}}async _connectAfterSessionHasBeenFlushed(){this['_disconnectService']();const {locale:_0x56e421}=this['editor'];let _0x153180;try{_0x153180=await this['_service']['getDocumentDetails']();}catch{const _0x2fae61=et(_0x56e421,'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'](_0x2fae61);}const _0x2392e5=_0x153180['currentDocumentSession']||_0x153180['lastDocumentSession'];if(this['_lastSyncedOperationId']!==_0x2392e5['lastOperationId']){const _0x11820a=et(_0x56e421,'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'](_0x11820a);}await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);}_handleChannelDisconnected(){const _0x467bb6=this['editor']['plugins']['get'](J);if(this['_isConnected']=!0x1,!_0x467bb6['connection']||'connected'!==_0x467bb6['connection']['state'])return;this['_isChannelFlushed']=!0x0;const _0x18edf1=this['editor']['plugins']['get'](Q);_0x18edf1['channelSessions']['has'](this['_channelId'])&&_0x18edf1['unregister'](this['_channelId']),_0x467bb6['removeFromReconnectionStack'](this),this['_disconnectService']();}_disconnectService(){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['stopListening'](this['_service']);}_initSessionsHandling(_0xb93949){const _0x37f805=this['editor']['plugins']['get'](Q);this['listenTo'](_0x37f805,'sessionAdd:'+this['_channelId'],(_0x199cf7,{session:_0x1f6e85})=>{if(_0x1f6e85['id']===_0x37f805['mySessionId']){_0x199cf7['off']();const _0x2ac4ea=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0x144823=_0x1f6e85['permissions'];_0x2ac4ea&&_0x2ac4ea['isEnabled']&&(_0x144823=_0x144823['filter'](_0xa1f040=>'document:write'!==_0xa1f040)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0x144823,this['_channelId']);}}),_0x37f805['register'](this['_channelId'],_0xb93949);}_initThrowingOnDataSet(){const _0x2e0c92=this['editor']['data']['set'];this['editor']['data']['set']=(..._0x146860)=>{if(!_0x146860[_0x146860['length']-0x1]['suppressErrorInCollaboration'])throw new _0x1cba4d('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x2e0c92['apply'](this['editor']['data'],_0x146860);};}_setUpDataInit(){this['editor']['data']['on']('init',(_0x3aff83,[_0x49ed80])=>{if(this['_document']['version'])throw new _0x1cba4d('realtimecollaborationclient-init-document-already-initialized',this);_0x3aff83['stop'](),this['_setPendingAction']();const _0x50f38e=Object['fromEntries'](Object['entries'](this['editor']['config']['get']('roots')||{})['filter'](([,_0x11c12a])=>!_0x11c12a['lazyLoad'])['map'](([_0xf032d2,_0x5f4584])=>[_0xf032d2,_0x5f4584['modelAttributes']||{}])),_0x586c24=this['_getOperationsFromInitData'](_0x49ed80,_0x50f38e);0x0==_0x586c24['length']&&_0x586c24['push'](new _0x3884c7(0x0)),_0x3aff83['return']=this['_connectService'](_0x586c24)['then'](()=>{this['editor']['plugins']['get'](J)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x482828=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x482828))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x159885,[_0x5aeb41,_0x3ddb7f])=>{_0x159885['stop']();const _0x6a65c6=this['editor']['model']['document']['getRoot'](_0x5aeb41);if(!this['_knownRootNames']['has'](_0x5aeb41)){const _0x54e52b=_0x3ddb7f&&_0x3ddb7f['data']?_0x3ddb7f['data']:'',_0x1bbb92=_0x3ddb7f&&_0x3ddb7f['attributes']?_0x3ddb7f['attributes']:{};await this['_loadRoot'](_0x5aeb41,_0x54e52b,_0x1bbb92);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0x6a65c6['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0x6a65c6);});},{'priority':'high'});}async _fetchMissingUsers(_0x3b91a8){const _0x1fda01=this['editor']['plugins']['get'](_0x4857ba),{connection:_0x30ecec}=this['editor']['plugins']['get'](J),_0x107b21=new Set();for(const _0x1db2b4 of _0x3b91a8){const _0x112db8=_0x1db2b4['_authorId'];_0x112db8&&!_0x1fda01['getUser'](_0x112db8)&&_0x107b21['add'](_0x112db8);}if(0x0===_0x107b21['size'])return;const _0x205927=await _0x11acf3['getMany'](_0x30ecec,Array['from'](_0x107b21));for(const _0x5718b8 of _0x205927)_0x1fda01['getUser'](_0x5718b8['id'])||_0x1fda01['addUser'](_0x5718b8);}_getOperationsFromInitData(_0x3b5b75,_0x581ef1={}){const _0x2129f1=this['editor']['model'],_0x156b26=[];let _0xd2fef2=0x0;const _0x21ac30='string'==typeof _0x3b5b75?{'main':_0x3b5b75}:_0x3b5b75;for(const _0x458c89 of Object['keys'](_0x21ac30)){if(!this['_document']['roots']['has'](_0x458c89))throw new _0x1cba4d('realtimecollaborationclient-init-non-existent-root',this);const _0x24cc2f=this['_document']['getRoot'](_0x458c89),_0x5f4b3b=this['editor']['data']['parse'](_0x21ac30[_0x458c89],_0x24cc2f),_0x1d6e02=new _0x215f26(_0x2129f1['createPositionAt'](_0x24cc2f,0x0),_0x5f4b3b,_0xd2fef2++);_0x156b26['push'](_0x1d6e02);for(const [_0x46faa5,_0x2ebb76]of _0x5f4b3b['markers']){const _0x3c483d=_0x2129f1['createRange'](_0x2129f1['createPositionFromPath'](_0x24cc2f,_0x2ebb76['start']['path']['slice']()),_0x2129f1['createPositionFromPath'](_0x24cc2f,_0x2ebb76['end']['path']['slice']())),_0x56a61f=new _0x524ea7(_0x46faa5,null,_0x3c483d,_0x2129f1['markers'],!0x0,_0xd2fef2++);_0x156b26['push'](_0x56a61f);}}if(_0x581ef1)for(const [_0xe9d46c,_0x13a8f4]of Object['entries'](_0x581ef1)){const _0x3e1761=_0x2129f1['document']['getRoot'](_0xe9d46c);if(!_0x3e1761)throw new _0x1cba4d('multi-root-editor-root-attributes-no-root',null);for(const [_0x5de652,_0x49b02c]of Object['entries'](_0x13a8f4))if(null!==_0x49b02c){const _0x1d3200=new _0xdd6fed(_0x3e1761,_0x5de652,null,_0x49b02c,_0xd2fef2++);_0x156b26['push'](_0x1d3200);}}return _0x156b26;}async _loadRoot(_0x40485f,_0x5120f0,_0x4f1888){this['_getOperationsFromInitData']({[_0x40485f]:_0x5120f0},{[_0x40485f]:_0x4f1888})['forEach']((_0x2684c7,_0x56d6d2)=>{_0x2684c7['baseVersion']=this['_document']['version']+_0x56d6d2,_0x2684c7['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x2684c7);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async _handleInitialConnectionData(_0x3b3fed,_0x4c5fd2){let _0x2a2098;this['_offset']=_0x3b3fed['offset'];const _0x1b1701=_0x3b3fed['wereChangesApplied']&&!_0x3b3fed['initData'],_0x393dd8=_0x1b1701?0x0:_0x3b3fed['data']['baseVersion'];if(_0x4c5fd2['forEach'](_0x352ce5=>{_0x352ce5['_isInit']=!0x0,_0x352ce5['createdAt']=_0x3b3fed['sessionCreatedAt'],_0x352ce5['_authorId']=null;}),_0x1b1701)_0x2a2098=_0x4c5fd2,this['_applyOperationsSet'](_0x2a2098,_0x1b1701);else{if(_0x3b3fed['initData']){const _0x3d9e6f=this['_getOperationsFromInitData'](_0x3b3fed['initData']);this['_document']['history']['version']=-_0x3d9e6f['length'],_0x3d9e6f['forEach'](_0x5d4dcd=>{_0x5d4dcd['baseVersion']-=_0x3d9e6f['length'],_0x5d4dcd['createdAt']=_0x3b3fed['sessionCreatedAt'],_0x5d4dcd['_isInit']=!0x0,_0x5d4dcd['_authorId']=null;}),this['_applyOperationsSet'](_0x3d9e6f,!0x0),this['serverHistory']['version']=-_0x3d9e6f['length']+this['_offset'],this['_updateServerHistory'](_0x3d9e6f);}this['_document']['history']['version']=_0x393dd8,_0x2a2098=this['_decompressOperations'](_0x3b3fed['data'],_0x3b3fed['metadata']),await this['_fetchMissingUsers'](_0x2a2098),this['_applyOperationsSet'](_0x2a2098,_0x1b1701);}_0x3b3fed['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x2a2098,_0x3b3fed['lastOperationId']),this['_lastSyncedOperationId']=_0x3b3fed['lastOperationId']),this['serverHistory']['version']=_0x393dd8+this['_offset'],this['_updateServerHistory'](_0x2a2098),_0x4c5fd2['filter'](_0x5b0f56=>{const _0x25eb18=this['_getAffectedRoot'](_0x5b0f56);return _0x25eb18&&!this['_knownRootNames']['has'](_0x25eb18);})['forEach']((_0x4ee752,_0x330946)=>{_0x4ee752['baseVersion']=this['_document']['version']+_0x330946,this['_saveOperationInBuffer'](_0x4ee752);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x2ef435,_0x5ebe70){const _0x3a9b5a=_0x5ebe70&&_0x5ebe70['message'];if(_0x3a9b5a&&_0x3a9b5a['startsWith']('realtimecollaborationclient'))throw _0x5ebe70;const _0x128ec9=this['editor']['plugins']['get'](J);throw this['_isPendingUpdate']=!0x0,_0x128ec9['disconnect'](),this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0x1cba4d(_0x2ef435,this['editor'],_0x3a9b5a?{'originalError':_0x3a9b5a}:void 0x0);}_saveOperationInBuffer(_0x332a2b){this['_knownOperations']['has'](_0x332a2b)||(this['_knownOperations']['add'](_0x332a2b),this['_bufferedOperations']['push'](_0x332a2b),this['_pendingAction']||'marker'==_0x332a2b['type']&&!_0x332a2b['affectsData']||this['_setPendingAction']());}_sendBufferedOperationsDelayed(_0x5481c1=!0x1){!_0x5481c1&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0xcc4d95=>{_0xcc4d95&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0xb5c27e=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0x2fa172){return _0x2fa172['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x2fa172['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0x2fa172['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0xb5c27e)||this['_crash'](_0xb5c27e['message'],_0xb5c27e);});},this['_currentBufferDelay']));}_waitUntilSynced(){return new Promise(_0x26c031=>{this['on']('change:_isPendingUpdate',()=>{_0x26c031();});});}async _sendBufferedOperations(){const _0x275be4=this['editor']['plugins']['get'](X);if(this['_shouldSendSelectionUpdate']()&&(_0x275be4['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x1d80f3=[...this['_bufferedOperations']];for(const _0x25207b of _0x1d80f3)_0x25207b['wasUndone']=this['_document']['history']['isUndoneOperation'](_0x25207b);const _0x31e202=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x1d80f3),_0x53a232=st++,_0x2421d3=this['_compressOperations'](_0x1d80f3),_0x46e209=await this['_service']['sendOperations'](_0x2421d3,_0x2421d3['baseVersion'],_0x31e202);try{return await this['_handleServerResponse'](_0x1d80f3,_0x46e209,_0x53a232);}catch(_0xb54601){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0xb54601);}}async['_handleServerResponse'](_0xe832cb,_0xe027fe,_0x44b504){if('error'in _0xe027fe)throw _0xe027fe['error'];let _0x3d875c;if(_0xe027fe['wereChangesApplied']){_0xe027fe['lastOperationId']&&(this['_lastSyncedOperationId']=_0xe027fe['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x46587d=>!_0xe832cb['includes'](_0x46587d));for(const _0x585158 of _0xe832cb)_0x585158['createdAt']='lastOperationAcceptedAt'in _0xe027fe&&_0xe027fe['lastOperationAcceptedAt']||void 0x0;ot(_0xe832cb,_0xe027fe['version']-_0xe832cb['length']),this['_updateServerHistory'](_0xe832cb);const _0x6a258c=_0xe832cb['filter'](_0x1144ed=>{if(!_0x1144ed['_isInit'])return!0x1;const _0x436ff3=this['_getAffectedRoot'](_0x1144ed);return _0x436ff3&&!this['_knownRootNames']['has'](_0x436ff3);});ot(_0x6a258c,this['_document']['version']),this['_applyOperationsSet'](_0x6a258c),_0x3d875c=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0x3a80b4=this['_decompressOperations'](_0xe027fe['data'],_0xe027fe['metadata'])['filter'](_0xbf30c6=>_0xbf30c6['baseVersion']>=this['_lastServerVersion']);_0x3a80b4['forEach'](_0x4a85ca=>this['_addKnownRoot'](_0x4a85ca)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x370cea=>!_0x370cea['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x370cea))),this['_bufferedOperations']['length']&&ot(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0x3a80b4),_0x3d875c=this['_handleExternalOperations'](_0x3a80b4,_0xe027fe['version'],_0xe027fe['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x3d875c?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}_handleExternalOperations(_0x3d3f87,_0x31b514,_0x487c79){try{const _0x4a55a0={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x288df3,operationsB:_0x19a241,originalOperations:_0xd7c972}=_0x94c6ca(_0x3d3f87,this['_bufferedOperations'],_0x4a55a0);ot(_0x288df3,this['_document']['version']),ot(_0x19a241,_0x31b514);for(const _0x385820 of _0x288df3){const _0x5e2c89=_0xd7c972['get'](_0x385820);_0x5e2c89?(_0x385820['_authorId']=_0x5e2c89['_authorId'],'noop'!==_0x385820['type']&&(_0x385820['_aiSource']=_0x5e2c89['_aiSource'])):_0x385820['_authorId']=null;}for(const _0x8aac99 of _0x19a241)'noop'!==_0x8aac99['type']&&(_0x8aac99['_aiSource']=_0xd7c972['get'](_0x8aac99)?.['_aiSource']);_0x487c79&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x3d3f87,_0x487c79),this['_lastSyncedOperationId']=_0x487c79),this['_bufferedOperations']=[..._0x19a241],this['_applyOperationsSet'](_0x288df3),this['_updateServerHistory'](_0x3d3f87);}catch(_0x3d6c48){return console['error'](_0x3d6c48),!0x1;}return!0x0;}_applyOperationsSet(_0x4f01c0,_0x3f78a7=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0x693090=>{for(const _0xaa2a40 of _0x4f01c0)this['_knownOperations']['add'](_0xaa2a40),this['_addKnownRoot'](_0xaa2a40),_0x693090['batch']['addOperation'](_0xaa2a40),this['editor']['model']['applyOperation'](_0xaa2a40);});}_addKnownRoot(_0x1d773b){const _0x3c4ab5=this['_getAffectedRoot'](_0x1d773b);_0x3c4ab5&&this['_knownRootNames']['add'](_0x3c4ab5);}_getAffectedRoot(_0x48c3d8){let _0x12375f,_0x2907ee;switch(_0x48c3d8['type']){case'insert':_0x12375f=_0x48c3d8['position']['root'];break;case'marker':if(_0x2907ee=_0x48c3d8['newRange'],!_0x2907ee)return null;_0x12375f=_0x2907ee['root'];break;case'addRootAttribute':_0x12375f=_0x48c3d8['root'];break;case'addRoot':_0x12375f=_0x48c3d8['affectedSelectable'];break;case'move':_0x12375f=_0x48c3d8['targetPosition']['root'];break;default:return null;}return _0x12375f['rootName'];}_updateServerHistory(_0x15922a){_0x15922a['forEach'](_0x34c1a4=>{const _0x5a6217=_0x34c1a4['clone']();_0x5a6217['_authorId']=_0x34c1a4['_authorId'],_0x5a6217['_isInit']=!!_0x34c1a4['_isInit'],_0x5a6217['_aiSource']=_0x34c1a4['_aiSource'],_0x5a6217['createdAt']=_0x34c1a4['createdAt'],_0x5a6217['baseVersion']+=this['_offset'],_0x34c1a4['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x5a6217),this['serverHistory']['addOperation'](_0x5a6217);});}_handleReconnectionError(_0x3353bb){const _0x45209b=this['editor']['plugins']['get']('Notification'),_0x366872=this['editor']['locale'];_0x3353bb||(_0x3353bb=et(_0x366872,'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.')),_0x45209b['showWarning'](_0x3353bb,{'title':et(_0x366872,'Synchronization\x20issue'),'namespace':'real-time-collaboration'}),this['_hasSynchronizationProblem']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_bufferedOperations']=[],this['editor']['plugins']['get'](J)['disconnect']();}_setPendingAction(){this['_pendingAction']||(this['_pendingAction']=this['editor']['plugins']['get'](_0x1bbdfc)['add'](et(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}_clearPendingAction(){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x1bbdfc)['remove'](this['_pendingAction']),this['_pendingAction']=null);}_compressOperations(_0x2b5187){const _0x178797=_0x2b5187['map'](_0x12c1c0=>_0x12c1c0['toJSON']());return this['_compressor']['compress'](_0x178797);}_decompressOperations(_0x148e45,_0x4edd98){return this['_compressor']['decompress'](_0x148e45)['map']((_0x347c83,_0x344b96)=>{const _0x4a8e7a='init'==_0x4edd98[_0x344b96]['type'];if('InsertOperation'==_0x347c83['__className']){const _0x3c12ad=_0x347c83['position']['root'];!this['_document']['getRoot'](_0x3c12ad)&&(this['_document']['createRoot']('$unknown',_0x3c12ad)['_isAttached']=!0x1);}else{if('RootOperation'==_0x347c83['__className']){const _0x563c77=this['_document']['getRoot'](_0x347c83['rootName']);_0x563c77&&'$unknown'==_0x563c77['name']&&_0x347c83['elementName']!=_0x563c77['name']&&(_0x563c77['name']=_0x347c83['elementName']);}}const _0xa6e8a0=_0x5bcd72['fromJSON'](_0x347c83,this['_document']);return _0xa6e8a0['wasUndone']=_0x347c83['wasUndone'],_0xa6e8a0['_isInit']=_0x4a8e7a,_0xa6e8a0['_authorId']=_0x4a8e7a?null:_0x4edd98[_0x344b96]['userId'],_0xa6e8a0['_isDisconnection']='cs:removeUser'===_0x4edd98[_0x344b96]['type'],_0xa6e8a0['_aiSource']=_0x347c83['_aiSource']||void 0x0,_0xa6e8a0['createdAt']=_0x4edd98[_0x344b96]['createdAt'],_0xa6e8a0;});}_refreshUserSelectionMarkers(){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}_shouldSendSelectionUpdate(){const _0x1a4ef5=this['editor']['plugins']['get'](Q)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0x1a4ef5&&_0x1a4ef5['length']>0x1&&this['_hasSelectionChanged'];}_shouldSendUpdate(){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}},nt=class extends Error{};function ot(_0x29a2a9,_0x3945cf){for(const _0x439aa6 of _0x29a2a9)_0x439aa6['baseVersion']=_0x3945cf++;}var rt=class{_ignoredOperations;_operationToId;constructor(_0x2ac582){this['_ignoredOperations']=_0x2ac582,this['_operationToId']=new WeakMap();}getIdOfTheLastOperation(_0x19ff3b){let _0x42b3a0=_0x19ff3b['length'];for(;_0x42b3a0--;){const _0x13ffd2=_0x19ff3b[_0x42b3a0];if(!this['_ignoredOperations']['has'](_0x13ffd2)){if(!this['_operationToId']['has'](_0x13ffd2)){const _0x5ea22e=_0x467ff8()['slice'](0x1,0x12);this['_operationToId']['set'](_0x13ffd2,_0x5ea22e);}return this['_operationToId']['get'](_0x13ffd2);}}}setIdForTheLastOperation(_0x21ae6e,_0x1997e6){if(!_0x1997e6)return;let _0x1c29f3=_0x21ae6e['length'];for(;_0x1c29f3--;){const _0x28b801=_0x21ae6e[_0x1c29f3];this['_ignoredOperations']['has'](_0x28b801)||this['_operationToId']['set'](_0x28b801,_0x1997e6);}}},ct=class extends _0x2b96e7{static get requires(){return[it];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},at=class CloudServicesCommentsAdapter extends _0x2470ea{static CommentsService=/* #__PURE__ -- @preserve */
|
|
26
|
+
((()=>_0x1f5016)());['_services'];static get requires(){return[J,_0x5ee2c7,Q,_0x4857ba];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x15ccc1){super(_0x15ccc1),this['_services']=new Map();}async init(){const _0x1bf167=this['context'],_0x3f13ac=_0x1bf167['plugins']['get'](_0x5ee2c7);if(_0x1bf167['plugins']['get'](J)['addToReconnectionStack'](this),_0x3f13ac['adapter']={'addCommentThread':async({channelId:_0x4beff3,threadId:_0x18caa7,comments:_0x5c2792,resolvedAt:_0x2927ba,resolvedBy:_0x156437,context:_0x4bc959,attributes:_0x3ddcf4})=>{const _0x3e63e3=await this['_getService'](_0x4beff3)['addCommentThread']({'commentThreadId':_0x18caa7,'comments':_0x5c2792['map'](_0x3a15a0=>function(_0x27cfcf,_0x20447f,_0x32b559){return{'commentThreadId':_0x32b559,'commentId':_0x27cfcf['commentId'],'userId':_0x27cfcf['authorId'],'content':_0x27cfcf['content'],'documentId':_0x20447f,'createdAt':_0x27cfcf['createdAt'],'attributes':_0x27cfcf['attributes']||{}};}(_0x3a15a0,_0x4beff3,_0x18caa7)),'resolvedAt':_0x2927ba,'resolvedBy':_0x156437,'context':_0x4bc959,'attributes':_0x3ddcf4})['catch'](lt);return{'threadId':_0x3e63e3['commentThreadId'],'comments':_0x3e63e3['comments']};},'getCommentThread':async({channelId:_0x254049,threadId:_0x51245d})=>{const _0x19e859=await this['_getService'](_0x254049)['getCommentThread'](_0x51245d)['catch'](ht)['catch'](lt);return _0x19e859?_0x19e859['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0x19e859]),{'threadId':_0x19e859['commentThreadId'],'comments':_0x19e859['comments']['map'](dt),'context':_0x19e859['context'],'resolvedAt':_0x19e859['resolvedAt'],'resolvedBy':_0x19e859['resolvedBy'],'attributes':_0x19e859['attributes']||{}}):null;},'updateCommentThread':async({channelId:_0x3f4bfa,threadId:_0x6480b2,context:_0x2db593,unlinkedAt:_0x55ada6,attributes:_0x2f69d0})=>this['_getService'](_0x3f4bfa)['updateCommentThread']({'commentThreadId':_0x6480b2,'context':_0x2db593,'attributes':_0x2f69d0,'unlinkedAt':_0x55ada6})['catch'](ht)['catch'](lt),'resolveCommentThread':async({channelId:_0x315351,threadId:_0x22e629})=>{const _0x286b11=await this['_getService'](_0x315351)['resolveCommentThread'](_0x22e629)['catch'](ht)['catch'](lt);return{'threadId':_0x286b11['commentThreadId'],'resolvedAt':_0x286b11['resolvedAt'],'resolvedBy':_0x286b11['resolvedBy']};},'reopenCommentThread':async({channelId:_0xca9231,threadId:_0x10873d})=>this['_getService'](_0xca9231)['reopenCommentThread'](_0x10873d)['catch'](ht)['catch'](lt),'removeCommentThread':({channelId:_0x55d11e,threadId:_0x4452d3})=>this['_getService'](_0x55d11e)['removeCommentThread'](_0x4452d3)['catch'](ht)['catch'](lt),'addComment':({channelId:_0x11a3e1,threadId:_0x44212a,commentId:_0x15b44e,content:_0x5766cb,attributes:_0x3a3608})=>this['_getService'](_0x11a3e1)['addComment'](_0x44212a,_0x15b44e,_0x5766cb,_0x3a3608)['catch'](lt),'updateComment':({channelId:_0x41a17f,threadId:_0x279e96,commentId:_0x38ca7d,content:_0x37eb78,attributes:_0x4797ca})=>this['_getService'](_0x41a17f)['updateComment'](_0x279e96,_0x38ca7d,_0x37eb78,_0x4797ca)['catch'](ht)['catch'](lt),'removeComment':({channelId:_0x1b140e,threadId:_0x59883f,commentId:_0x73061})=>this['_getService'](_0x1b140e)['removeComment'](_0x59883f,_0x73061)['catch'](ht)['catch'](lt)},_0x1bf167 instanceof _0x46ea9b){const _0x40bcc7=_0x1bf167['config']['get']('collaboration.channelId'),_0x1a718e=_0x1bf167['plugins']['get'](Q);await this['_setUpService'](_0x40bcc7);const _0x1286ce=await this['_services']['get'](_0x40bcc7)['getConnectedSessions']();this['listenTo'](_0x1a718e,'sessionAdd:'+_0x40bcc7,(_0x1b64c7,{session:_0x184cb3})=>{_0x184cb3['id']===_0x1a718e['mySessionId']&&(_0x1b64c7['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x184cb3['permissions'],_0x40bcc7));}),_0x1a718e['register'](_0x40bcc7,_0x1286ce);}}async _setUpService(_0x32c545){if(this['_services']['has'](_0x32c545))throw new _0x1cba4d('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0x32c545});const _0x496bac=this['context']['plugins']['get'](_0x5ee2c7),_0x9fd76c=new CloudServicesCommentsAdapter['CommentsService'](_0x32c545);this['_services']['set'](_0x32c545,_0x9fd76c),this['listenTo'](_0x9fd76c,'commentThreadAdded',(_0x1bc7fa,_0x533ef5)=>{const {commentThreadId:_0x21cd86,documentId:_0x33d231,context:_0x1a6eb0,attributes:_0x1c8b2c,resolvedAt:_0x156dde,resolvedBy:_0x26f26a,comments:_0x493754}=_0x533ef5;_0x496bac['getCommentThread'](_0x21cd86)||_0x496bac['addCommentThread']({'threadId':_0x21cd86,'channelId':_0x33d231,'comments':_0x493754?_0x493754['map'](dt):[],'context':_0x1a6eb0,'attributes':_0x1c8b2c,'resolvedAt':_0x156dde,'resolvedBy':_0x26f26a,'isFromAdapter':!0x0});}),this['listenTo'](_0x9fd76c,'commentThreadUpdated',(_0x6f0754,{commentThreadId:_0x4ceb24,documentId:_0x3a6eab,context:_0x486287,unlinkedAt:_0x5b8aa8,attributes:_0x1ae8e1})=>{_0x496bac['getCommentThread'](_0x4ceb24)&&_0x496bac['updateCommentThread']({'threadId':_0x4ceb24,'channelId':_0x3a6eab,'context':_0x486287,'unlinkedAt':_0x5b8aa8,'attributes':_0x1ae8e1,'isFromAdapter':!0x0});}),this['listenTo'](_0x9fd76c,'commentThreadResolved',(_0x25aa1b,{commentThreadId:_0xd36ddb,resolvedBy:_0x52748f,resolvedAt:_0x41b099})=>{const _0x28ec49=_0x496bac['getCommentThread'](_0xd36ddb);_0x28ec49&&_0x28ec49['resolve']({'resolvedBy':_0x52748f,'resolvedAt':_0x41b099,'isFromAdapter':!0x0});}),this['listenTo'](_0x9fd76c,'commentThreadReopened',(_0x32285d,{commentThreadId:_0x2028e2})=>{const _0x33b09e=_0x496bac['getCommentThread'](_0x2028e2);_0x33b09e&&_0x33b09e['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0x9fd76c,'commentThreadRemoved',(_0x473158,{commentThreadId:_0xaddebf})=>{const _0x5b760d=_0x496bac['getCommentThread'](_0xaddebf);_0x5b760d&&_0x5b760d['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0x9fd76c,'commentAdded',(_0x3e2b65,_0x3986c3)=>{const _0x3fa505=_0x3986c3['commentThreadId'],_0x494a7a=_0x496bac['getCommentThread'](_0x3fa505);_0x494a7a&&_0x494a7a['addComment']({...dt(_0x3986c3),'isFromAdapter':!0x0});}),this['listenTo'](_0x9fd76c,'commentUpdated',(_0x5ec0ce,{commentThreadId:_0x5295bd,commentId:_0x31aefd,content:_0xda58d5,attributes:_0x2a7641})=>{const _0xdc5667=_0x496bac['getCommentThread'](_0x5295bd);if(_0xdc5667){const _0xda8afb=_0xdc5667['getComment'](_0x31aefd);_0xda8afb&&_0xda8afb['update']({'content':_0xda58d5,'attributes':_0x2a7641,'isFromAdapter':!0x0});}}),this['listenTo'](_0x9fd76c,'commentRemoved',(_0x5029b3,{commentThreadId:_0x146876,commentId:_0xd1b908})=>{const _0x194905=_0x496bac['getCommentThread'](_0x146876);if(_0x194905){const _0xde32cb=_0x194905['getComment'](_0xd1b908);_0xde32cb&&_0xde32cb['remove']({'isFromAdapter':!0x0});}}),this['listenTo'](_0x9fd76c,'disconnected',()=>{'connected'===this['context']['plugins']['get'](J)['connection']?.['state']&&(this['_services']['delete'](_0x32c545),this['stopListening'](_0x9fd76c));}),await this['_connectService'](_0x32c545);}destroy(){if(this['context']instanceof _0x46ea9b){const _0x4e6047=this['context']['config']['get']('collaboration.channelId');this['_services']['has'](_0x4e6047)&&this['_terminateService'](_0x4e6047);}}_terminateService(_0x2c3a0f){if(!this['_services']['has'](_0x2c3a0f))throw new _0x1cba4d('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0x2c3a0f});this['_getService'](_0x2c3a0f)['disconnect'](),this['_services']['delete'](_0x2c3a0f);}async reconnect(){for(const _0x41c5e0 of this['_services']['keys']())await this['_connectService'](_0x41c5e0);if(this['context']instanceof _0x46ea9b){const _0x3345c9=this['context']['config']['get']('collaboration.channelId');if(this['_services']['has'](_0x3345c9)){const _0x526938=this['context']['plugins']['get'](Q);_0x526938['unregister'](_0x3345c9);const _0x3dd858=await this['_services']['get'](_0x3345c9)['getConnectedSessions']();_0x526938['register'](_0x3345c9,_0x3dd858);}}}async _connectService(_0x4f156c){const {connection:_0x2347a4}=this['context']['plugins']['get'](J),_0x1b4738=this['context']['plugins']['get'](_0x5ee2c7),_0x2fc9d0=await this['_services']['get'](_0x4f156c)['connect'](_0x2347a4);await this['_fetchMissingUsersForThreads'](_0x2fc9d0);const _0x5abbea=new Set(Array['from'](_0x1b4738['getCommentThreads']({'channelId':_0x4f156c}),_0x286024=>_0x286024['id']));for(const _0x5e1dd7 of _0x2fc9d0)_0x5e1dd7['deletedAt']||_0x5abbea['delete'](_0x5e1dd7['commentThreadId']);for(const _0x499242 of _0x5abbea)_0x1b4738['getCommentThread'](_0x499242)['remove']({'isFromAdapter':!0x0});for(const _0x28275d of _0x2fc9d0){let _0x5d9d93=_0x1b4738['getCommentThread'](_0x28275d['commentThreadId']);const {commentThreadId:_0x323574,context:_0x30cb2c,attributes:_0x100d56,resolvedBy:_0x3e9e3c,resolvedAt:_0x5b1648,unlinkedAt:_0x4a7908,deletedAt:_0x5a4fa7}=_0x28275d;if(_0x5a4fa7)continue;_0x5d9d93||(_0x5d9d93=_0x1b4738['addCommentThread']({'channelId':_0x4f156c,'threadId':_0x323574,'context':_0x30cb2c,'attributes':_0x100d56||{},'resolvedBy':_0x3e9e3c,'resolvedAt':_0x5b1648,'unlinkedAt':_0x4a7908,'isFromAdapter':!0x0}));const _0x37e888=new Set(Array['from'](_0x5d9d93['comments'],_0x15e5b2=>_0x15e5b2['id']));for(const _0x534b90 of _0x28275d['comments'])_0x37e888['delete'](_0x534b90['commentId']);for(const _0x15077b of _0x37e888)_0x5d9d93['getComment'](_0x15077b)['remove']({'isFromAdapter':!0x0});for(const _0x4615ad of _0x28275d['comments']){const _0x44285a=_0x5d9d93['getComment'](_0x4615ad['commentId']);_0x44285a?_0x44285a['content']!==_0x4615ad['content']&&_0x44285a['update']({'content':_0x4615ad['content'],'isFromAdapter':!0x0}):_0x5d9d93['addComment'](Object['assign'](dt(_0x4615ad),{'isFromAdapter':!0x0}));}}}_getService(_0x3197c7){if(!this['_services']['has'](_0x3197c7))throw new _0x1cba4d('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0x3197c7});return this['_services']['get'](_0x3197c7);}async _fetchMissingUsersForThreads(_0x5e89dc){const _0x597a9d=this['context']['plugins']['get'](_0x4857ba),{connection:_0x19379e}=this['context']['plugins']['get'](J),_0x316747=new Set();for(const {resolvedBy:_0x25de98,comments:_0x538666}of _0x5e89dc){_0x25de98&&!_0x597a9d['getUser'](_0x25de98)&&_0x316747['add'](_0x25de98);for(const {userId:_0x229c15}of _0x538666)_0x597a9d['getUser'](_0x229c15)||_0x316747['add'](_0x229c15);}if(0x0===_0x316747['size'])return;const _0x5e924b=await _0x11acf3['getMany'](_0x19379e,Array['from'](_0x316747));for(const _0x3d9d5f of _0x5e924b)_0x597a9d['getUser'](_0x3d9d5f['id'])||_0x597a9d['addUser'](_0x3d9d5f);}};async function ht(_0x19d3c0){if('404'!==_0x19d3c0['code'])throw _0x19d3c0;}function lt(_0x492a71){if((_0x181ef1=_0x492a71)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0x181ef1['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x181ef1['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0x181ef1;throw _0x492a71;}function dt(_0x5e448b){return{'threadId':_0x5e448b['commentThreadId'],'commentId':_0x5e448b['commentId'],'content':_0x5e448b['content'],'createdAt':_0x5e448b['createdAt'],'authorId':_0x5e448b['userId'],'attributes':_0x5e448b['attributes']||{}};}var ut=class CloudServicesTrackChangesAdapter extends _0x2b96e7{static ['TrackChangesService']=/* #__PURE__ -- @preserve */
|
|
27
|
+
((()=>_0x58ce33)());_bufferedRequests;_trackChangesService;static get requires(){return[at,_0x5d8e67,J];}static get['pluginName'](){return'CloudServicesTrackChangesAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x5cdeae){super(_0x5cdeae);const _0x1b0fde=this['editor']['config']['get']('collaboration.channelId');this['_bufferedRequests']=new Map(),this['_trackChangesService']=new CloudServicesTrackChangesAdapter['TrackChangesService'](_0x1b0fde);}init(){const _0x4be64b=this['editor']['plugins']['get'](J),_0x49a395=this['editor']['plugins']['get'](_0x5d8e67);return _0x49a395['adapter']={'getSuggestion':async _0x57e8a1=>{await this['_waitForServiceReady']();const _0x283778=await this['_trackChangesService']['get'](_0x57e8a1)['catch'](ft);return await this['_fetchMissingUsersForThreads']([_0x283778]),_0x283778;},'addSuggestion':async({id:_0x1eb1ab,type:_0x49666e,data:_0x1a7830,originalSuggestionId:_0x3badba,attributes:_0x4d0ab4})=>{await this['_waitForServiceReady']();const _0x2def0c={'id':_0x1eb1ab,'type':_0x49666e,'data':_0x1a7830,'originalSuggestionId':_0x3badba,'attributes':_0x4d0ab4},_0x5d9810=await this['_trackChangesService']['add'](_0x1eb1ab,_0x49666e,_0x1a7830,_0x3badba,_0x4d0ab4)['catch'](_0x53ab14=>{if(mt(_0x53ab14))return new Promise(_0x448e43=>{this['_bufferedRequests']['set'](_0x1eb1ab,{'resolve':_0x448e43,'suggestionData':_0x2def0c});});throw _0x53ab14;});return this['_bufferedRequests']['delete'](_0x1eb1ab),_0x5d9810;},'updateSuggestion':async(_0x300f24,_0x5cad25)=>{if(await this['_waitForServiceReady'](),'open'!==_0x5cad25['state'])return this['_trackChangesService']['update'](_0x300f24,_0x5cad25)['catch'](ft);}},this['listenTo'](this['_trackChangesService'],'suggestionUpdated',(_0x20711d,_0x505230)=>{_0x49a395['hasSuggestion'](_0x505230['id'])&&(_0x49a395['getSuggestion'](_0x505230['id'])['attributes']=_0x505230['attributes']);}),this['listenTo'](this['_trackChangesService'],'disconnected',()=>{'connected'===_0x4be64b['connection']?.['state']&&(_0x4be64b['removeFromReconnectionStack'](this),this['stopListening'](this['_trackChangesService']));}),this['_trackChangesService']['connect'](_0x4be64b['connection'])['then'](_0x399187=>(_0x4be64b['addToReconnectionStack'](this),this['_fetchMissingUsersForThreads'](_0x399187)['then'](()=>{for(const _0x1da3b3 of _0x399187){_0x49a395['addSuggestionData'](_0x1da3b3)['_saved']=!0x0;}})));}async reconnect(){const _0x18d2f5=this['editor']['plugins']['get']('TrackChangesEditing'),{connection:_0x3a9637}=this['editor']['plugins']['get'](J),_0x45d00b=await this['_trackChangesService']['connect'](_0x3a9637);await this['_fetchMissingUsersForThreads'](_0x45d00b);for(const {suggestionData:_0xd6b477,resolve:_0x2650a3}of this['_bufferedRequests']['values']()){let _0x196edc=_0x45d00b['find'](_0x2c9753=>_0x2c9753['id']===_0xd6b477['id']);_0x196edc||(_0x196edc=await this['_trackChangesService']['add'](_0xd6b477['id'],_0xd6b477['type'],_0xd6b477['data'],_0xd6b477['originalSuggestionId'])),_0x2650a3(_0x196edc);}for(const _0x499133 of _0x45d00b)_0x18d2f5['hasSuggestion'](_0x499133['id'])||_0x18d2f5['addSuggestionData'](_0x499133);}async _waitForServiceReady(){this['_trackChangesService']['isConnected']||await new Promise(_0x23d121=>{this['listenTo'](this['_trackChangesService'],'connected',_0x19a850=>{_0x19a850['off'](),_0x23d121();});});}async _fetchMissingUsersForThreads(_0x5d9d28){const _0x3d2f7f=this['editor']['plugins']['get'](_0x4857ba),{connection:_0x22fd6b}=this['editor']['plugins']['get'](J),_0x1ee263=new Set();for(const {authorId:_0x2127a5}of _0x5d9d28)_0x3d2f7f['getUser'](_0x2127a5)||_0x1ee263['add'](_0x2127a5);if(0x0===_0x1ee263['size'])return;const _0xfa296e=await _0x11acf3['getMany'](_0x22fd6b,Array['from'](_0x1ee263));for(const _0x34f132 of _0xfa296e)_0x3d2f7f['getUser'](_0x34f132['id'])||_0x3d2f7f['addUser'](_0x34f132);}};function ft(_0x142031){if(mt(_0x142031))return new Promise(()=>{});throw _0x142031;}function mt(_0x2655ba){return _0x2655ba['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x2655ba['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}var pt=class extends _0x2b96e7{static get requires(){return[_0x1ea26e,at,ct,J];}static get['pluginName'](){return'RealTimeCollaborativeComments';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const _0x446873=this['editor']['plugins']['get'](J),_0x546eff=this['editor']['plugins']['get'](_0x360017),_0x3781ee=this['editor']['plugins']['get'](at);return this['editor']['data']['once']('ready',()=>{this['listenTo'](_0x446873,'change:state',(_0x13fa0e,_0x3749a2,_0x24589f)=>{_0x546eff['isThreadsLoadingPaused']='connected'!==_0x24589f;});}),this['listenTo'](_0x446873,'change:state',(_0x3460bd,_0x349359,_0x3ad233)=>{this['editor']['plugins']['get'](_0x5ee2c7)['switchReadOnly']('connected'!==_0x3ad233);}),_0x3781ee['_setUpService'](this['editor']['config']['get']('collaboration.channelId'));}destroy(){const _0x47fc53=this['editor']['plugins']['get'](at),_0x20cb6d=this['editor']['config']['get']('collaboration.channelId');_0x47fc53['_services']['has'](_0x20cb6d)&&_0x47fc53['_terminateService'](_0x20cb6d),super['destroy']();}},gt=class extends _0x2b96e7{static get requires(){return[pt,ut,_0x318f0b];}static get['pluginName'](){return'RealTimeCollaborativeTrackChanges';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},wt=class CloudServicesRevisionHistoryAdapter extends _0x2b96e7{static RevisionHistoryService=/* #__PURE__ -- @preserve */
|
|
28
|
+
((()=>_0x15f775)());_lastRequestId;['_revisionTracker'];_revisionHistoryService;_oldOffset;static get requires(){return[J,it,_0x422c21,Q,_0x4857ba];}static get['pluginName'](){return'CloudServicesRevisionHistoryAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x12190a){super(_0x12190a);const _0x45b128=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new CloudServicesRevisionHistoryAdapter['RevisionHistoryService'](_0x45b128);}async init(){const _0x9682e6=this['editor']['plugins']['get'](it),_0x4c398e=_0x9682e6['serverHistory'],_0x588f25=this['editor']['plugins']['get'](J);this['_revisionTracker']['setSource']({'history':_0x4c398e,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0x9682e6['sessionId']});const _0x549b04=this['editor']['config']['get']('cloudServices.bundleVersion')||_0x3a3f2b,_0x1bb4c5=await _0x4f77ac['isBundleUploaded'](_0x588f25['connection'],_0x549b04);this['editor']['plugins']['get'](_0x422c21)['adapter']={'getRevision':async({revisionId:_0x2c5953})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0x2c5953)),'updateRevisions':async _0x25aecd=>{await this['_waitForServiceReady']();const _0x4f512b=this['_revisionTracker']['currentRevision'];if(_0x1bb4c5&&0x1===_0x25aecd['length']&&_0x25aecd[0x0]['id']===_0x4f512b['id'])return _0x25aecd;for(const _0x29a23e of _0x25aecd)_0x29a23e['id']===_0x4f512b['id']&&(_0x29a23e['isEmptyCurrent']=_0x29a23e['fromVersion']===_0x29a23e['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0x25aecd,this['_lastRequestId'])['then'](_0x1cfb9=>(this['_lastRequestId']=_0x1cfb9,_0x25aecd))['catch'](_0x31afe2=>{if(vt(_0x31afe2)||'400'===_0x31afe2['code']&&void 0x0!==_0x31afe2['data']['wrongRequestId']){for(const _0x473188 of _0x25aecd)this['_revisionTracker']['repository']['getRevision'](_0x473188['id'])&&this['_revisionTracker']['_bufferUpdate'](_0x473188['id'],_0x473188,!0x1);if(vt(_0x31afe2)&&'destroyed'!==this['editor']['state'])throw _0x31afe2;return _0x25aecd;}throw _0x31afe2;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0x4d9e41,{revisionsData:_0x31d010,requestId:_0x53258c})=>{Math['max'](..._0x31d010['map'](_0x388b26=>_0x388b26['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0x31d010,_0x53258c);}):this['_handleRevisionsUpdate'](_0x31d010,_0x53258c);}),this['set']('_isServiceConnected',!0x1),this['listenTo'](this['_revisionHistoryService'],'connected',()=>{this['_isServiceConnected']=!0x0;}),this['listenTo'](this['_revisionHistoryService'],'disconnected',()=>{this['_isServiceConnected']=!0x1,'connected'===_0x588f25['connection']?.['state']&&(_0x588f25['removeFromReconnectionStack'](this),this['stopListening'](this['_revisionHistoryService']));});const {revisions:_0x47f72c,requestId:_0x5492b6}=await this['_revisionHistoryService']['connect'](_0x588f25['connection']);_0x588f25['addToReconnectionStack'](this),this['_lastRequestId']=_0x5492b6,await this['_fetchMissingUsers'](_0x47f72c);for(const _0x2c5f98 of _0x47f72c)this['_revisionTracker']['addRevisionData'](_0x2c5f98);this['listenTo'](_0x9682e6,'change:_isConnected',(_0x270eb3,_0x45ef92,_0x3023c1)=>{_0x3023c1&&(this['_oldOffset']=_0x9682e6['_offset'],_0x270eb3['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](this,'_isServiceConnected');}async reconnect(){const _0xa42c4a=this['editor']['plugins']['get'](J),_0x5f53ff=this['editor']['plugins']['get'](it),_0x2ab015=async()=>{const _0x290328=this['_revisionTracker']['currentRevision'],_0x4600a2=_0x290328['id'],_0x582ff0=_0x4600a2!==_0x5f53ff['sessionId'];if(_0x582ff0){const _0x48b4fe=_0x5f53ff['_offset']-this['_oldOffset'],_0x37eef3=this['_getLatestVersionFromServerOperations']();if(this['_revisionTracker']['_revisionDataBuilder']['reInit'](),_0x290328['toVersion']+_0x48b4fe!==_0x37eef3){const _0x33f02c=_0x290328['fromVersion']+_0x48b4fe,_0x244613=this['editor']['plugins']['get'](_0x4857ba),_0x43cdaf=this['_revisionTracker']['buildRevisionData']({'revision':_0x290328,'from':_0x33f02c,'to':_0x37eef3});_0x43cdaf['id']=_0x290328['id'];const _0x17697f=_0x43cdaf['authorsIds']['map'](_0x3083f9=>_0x244613['getUser'](_0x3083f9));_0x290328['_update']({..._0x43cdaf,'authors':_0x17697f},!0x0),this['_revisionTracker']['_bufferUpdate'](_0x290328['id'],_0x43cdaf,!0x0);}this['_revisionTracker']['_startingVersion']=_0x37eef3,_0x290328['toVersion']!==_0x290328['fromVersion']||this['_revisionTracker']['_bufferedUpdates']['has'](_0x4600a2)||this['_revisionTracker']['repository']['_revisions']['remove'](_0x4600a2),this['_revisionTracker']['_createCurrentRevision'](_0x37eef3);}const {revisions:_0x42ab51,requestId:_0x156b3a}=await this['_revisionHistoryService']['reconnect'](_0xa42c4a['connection'],this['_lastRequestId']);_0x582ff0&&_0x42ab51['length']>0x0?_0x5f53ff['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x42ab51),this['_handleRevisionsUpdate'](_0x42ab51,_0x156b3a),this['_revisionTracker']['sendBufferedUpdates']());};return _0x5f53ff['_isConnected']?_0x2ab015():new Promise((_0x4b8ab8,_0x8417de)=>{_0x5f53ff['once']('change:_isConnected',()=>{_0x2ab015()['then'](_0x4b8ab8)['catch'](_0x8417de);});});}destroy(){super['destroy']();}async _waitForServiceReady(){this['_revisionHistoryService']['isConnected']||await new Promise(_0x335017=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x5cb928=>{_0x5cb928['off'](),_0x335017();});});}_getLatestVersionFromServerOperations(){const _0x3193a4=this['editor']['plugins']['get'](it)['serverHistory']['getOperations']()['reverse']();for(const _0x414c16 of _0x3193a4)if('marker'!==_0x414c16['type']||_0x414c16['affectsData'])return _0x414c16['baseVersion']+0x1;}_getLatestVersion(){const _0x5a80e5=this['editor']['plugins']['get'](it);return new Promise(_0xd0e871=>{_0x5a80e5['_isPendingUpdate']?_0x5a80e5['once']('change:_isPendingUpdate',()=>{_0xd0e871(this['_getLatestVersionFromServerOperations']());}):_0xd0e871(this['_getLatestVersionFromServerOperations']());});}_handleRevisionsUpdate(_0x558426,_0x3133){const _0x489b76=this['_revisionTracker']['repository'];this['_lastRequestId']=_0x3133;for(const _0x354312 of _0x558426){const _0x339aba=_0x489b76['getRevision'](_0x354312['id']);if(_0x339aba){if((_0x354312['fromVersion']||_0x354312['toVersion'])&&(_0x354312['diffData']=null),_0x339aba===this['_revisionTracker']['currentRevision']){const _0x5b266d=Math['max'](_0x339aba['toVersion'],_0x354312['toVersion']),_0x28cba4=Math['max'](_0x339aba['fromVersion'],_0x354312['fromVersion']);let _0x2c58a4;_0x339aba['toVersion']===_0x354312['toVersion']&&_0x339aba['fromVersion']===_0x354312['fromVersion']?(_0x2c58a4=!0x0,this['_preventResendingRevisionData'](_0x354312)):_0x354312['toVersion']===_0x5b266d&&_0x354312['fromVersion']===_0x28cba4?_0x2c58a4=!0x1:(_0x339aba['toVersion']===_0x5b266d&&_0x339aba['fromVersion']===_0x28cba4||this['_fixRevision']({'revision':_0x339aba,'from':_0x28cba4,'to':_0x5b266d}),_0x2c58a4=!0x0),_0x2c58a4&&(delete _0x354312['fromVersion'],delete _0x354312['toVersion'],delete _0x354312['diffData'],delete _0x354312['createdAt'],delete _0x354312['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0x354312),this['_preventResendingRevisionData'](_0x354312);}else this['_revisionTracker']['addRevisionData'](_0x354312);}const _0x5252f3=_0x489b76['getRevisions']();_0x5252f3['reverse']();for(let _0x5a9c91=0x0;_0x5a9c91<_0x5252f3['length']-0x1;_0x5a9c91++){const _0x2adb0f=_0x5252f3[_0x5a9c91],_0x25980a=_0x5252f3[_0x5a9c91+0x1];if(_0x2adb0f['fromVersion']<_0x25980a['toVersion']){const _0x4b19b=_0x25980a['toVersion'],_0x37d95a=Math['max'](_0x4b19b,_0x2adb0f['toVersion']);this['_fixRevision']({'revision':_0x2adb0f,'from':_0x4b19b,'to':_0x37d95a});}}}['_fixRevision']({revision:_0x3620ae,from:_0x5acd4e,to:_0x3bb4b4}={}){const _0x112a06=this['editor']['plugins']['get'](_0x4857ba),_0x5201fd=this['_revisionTracker']['buildRevisionData']({'revision':_0x3620ae,'from':_0x5acd4e,'to':_0x3bb4b4});_0x5201fd['authors']=_0x5201fd['authorsIds']['map'](_0x34b99b=>_0x112a06['getUser'](_0x34b99b)),_0x3620ae['_update'](_0x5201fd);}_preventResendingRevisionData(_0x37f5ae){const _0x12067a={};_0x12067a['id']=_0x37f5ae['id'];for(const _0x1f2417 of Object['keys'](_0x37f5ae))'id'!==_0x1f2417&&(_0x12067a[_0x1f2417]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0x12067a['id'],_0x12067a,!0x0);}async _fetchMissingUsers(_0x157750){const _0x5bac06=this['editor']['plugins']['get'](_0x4857ba),{connection:_0x8f8e3}=this['editor']['plugins']['get'](J),_0xb22b5f=new Set();for(const _0x558d03 of _0x157750){for(const _0x14f162 of _0x558d03['authorsIds'])_0x1223fd(_0x14f162);_0x558d03['creatorId']&&_0x1223fd(_0x558d03['creatorId']);}if(0x0===_0xb22b5f['size'])return;const _0x4ef119=await _0x11acf3['getMany'](_0x8f8e3,Array['from'](_0xb22b5f));for(const _0x167644 of _0x4ef119)_0x5bac06['getUser'](_0x167644['id'])||_0x5bac06['addUser'](_0x167644);function _0x1223fd(_0x5d05ac){_0x5bac06['getUser'](_0x5d05ac)||_0xb22b5f['add'](_0x5d05ac);}}};function vt(_0xe7dc9a){return _0xe7dc9a['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0xe7dc9a['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0xe7dc9a['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}var _t=class extends _0x2b96e7{static get requires(){return[_0x422c21,wt,ct];}static get['pluginName'](){return'RealTimeCollaborativeRevisionHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},yt=class extends _0x1bdd03{_collapseAt;constructor(_0x397476,_0x575d84=0x6){super(_0x397476);const _0x1404fa=this['bindTemplate'];this['set']('isHidden',!0x0),this['set']('usersCount',0x0),this['_collapseAt']=_0x575d84,this['bind']('isHidden')['to'](this,'usersCount',_0x3788c3=>_0x3788c3<_0x575d84),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item',_0x1404fa['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':_0x1404fa['to']('usersCount',_0x34723c=>'+'+(_0x34723c-this['_collapseAt']+0x2)['toString']())}]}]}]});}},bt=class extends _0x1bdd03{items;keystrokes;constructor(_0xb1f413){super(_0xb1f413);const _0xc8ce28=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0x4cd84c(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0xc8ce28['if']('hasPopup'),'aria-expanded':_0xc8ce28['to']('isExpanded',_0xc53284=>this['hasPopup']&&String(_0xc53284)),'aria-label':_0xc8ce28['to']('hasPopup',_0x367e96=>et(_0xb1f413,_0x367e96?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0xc8ce28['to']('hasPopup',_0x5f1b42=>!!_0x5f1b42&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items']}),this['on']('change:hasPopup',(_0x2e5ac5,_0x16db95,_0x5ad3cd)=>{this['element']&&(_0x5ad3cd?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']);}},kt=class extends _0x1bdd03{counterView;inlineListView;constructor(_0x10e938,_0x27f9ab=0x6){super(_0x10e938);const _0x32a7e8=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new yt(this['locale'],_0x27f9ab),this['inlineListView']=new bt(_0x10e938),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x205f4c of this['inlineListView']['items'])_0x205f4c['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',_0x32a7e8['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['inlineListView']]});}},It=class extends _0x1bdd03{listWrapperView;constructor(_0x288956,_0x45c6af){super(_0x288956),this['listWrapperView']=new St(_0x288956,_0x45c6af),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':et(_0x288956,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']]});}},St=class extends _0x461b02{constructor(_0x22211f,_0x21a6a4){super(_0x22211f);const _0xef543e=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0x21a6a4?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0xef543e['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0xef543e['to']('role'),'aria-label':_0xef543e['to']('ariaLabel'),'aria-labelledby':_0xef543e['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0x327fcb['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0x1a895e=this['element'];_0x1a895e&&(this['_isScrollable']=Math['max'](_0x1a895e['scrollHeight'],_0x1a895e['clientHeight'])>0.8*window['innerHeight']);}},Tt=class extends _0x3fc642{['userView'];constructor(_0x130637,_0xe0d589,_0x124563){super(_0x130637);const _0x2a1598=this['bindTemplate'];this['userView']=new _0x30b579(_0x130637,_0xe0d589);const _0x1fd676={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0xe0d589['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0xe0d589['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0xe0d589['color']['getBackgroundColorClass']()],'style':{'--ck-user-color':_0xe0d589['color']['getColorVariable'](),'--ck-user-color-alpha':_0xe0d589['color']['getColorAlphaVariable']()},'aria-hidden':'true'}}]};_0x124563&&(_0x1fd676['tag']='button',_0x1fd676['on']={'click':_0x2a1598['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x1fd676);}['focus'](){this['element']['focus']();}},Ct=class extends _0x1bdd03{['userView'];['markerView'];constructor(_0x36bb9b,_0x18be7d,_0x4a3b85){super(_0x36bb9b);const _0x577e43=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new _0x30b579(_0x36bb9b,_0x18be7d),this['markerView']=new At(_0x36bb9b,_0x18be7d);const _0x559385=new _0x2576ff(_0x36bb9b);_0x559385['template']['tag']='span',_0x559385['text']=_0x18be7d['name'];const _0x5dd60d={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0x577e43['to']('isFocusable',_0xa08e26=>_0xa08e26?0x0:-0x1),'aria-labelledby':_0x559385['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0x577e43['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0x577e43['to']('hasTooltip',_0x1950d5=>!_0x1950d5),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0x559385]};_0x4a3b85&&(_0x5dd60d['tag']='button',_0x5dd60d['on']={'click':_0x577e43['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x5dd60d);}},At=class extends _0x1bdd03{constructor(_0x55702c,_0x26254d){super(_0x55702c),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x26254d['color']['getBackgroundColorClass']()],'style':{'--ck-user-color':_0x26254d['color']['getColorVariable'](),'--ck-user-color-alpha':_0x26254d['color']['getColorAlphaVariable']()},'aria-hidden':'true'}});}};const Pt={'collapseAt':0x6,'displayMe':!0x0};var Ot=class extends _0x2470ea{currentDisplayedUsers;['balloonPanelView'];['view'];['presenceDropdownView'];_overlayHost=null;static get['pluginName'](){return'PresenceListUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x3b3fe5){super(_0x3b3fe5),this['context']['config']['define']('presenceList',Pt);const _0x3a71b3=_0x3b3fe5['config']['get']('presenceList.collapseAt');if('number'!=typeof _0x3a71b3)throw new _0x1cba4d('presencelist-collapseat-invalid-format',this);if(_0x3a71b3<0x1)throw new _0x1cba4d('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](Q)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0x30b45c(),this['balloonPanelView']=new _0x92771e(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get requires(){return[Q];}init(){for(const _0x55de38 of this['_allConnectedUsers'])this['_handleUserAdd'](_0x55de38);this['listenTo'](this['_allConnectedUsers'],'add',(_0x5aac83,_0x4f0772)=>{this['_handleUserAdd'](_0x4f0772);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0x9a56e7,_0x4cff28)=>{this['_handleUserRemove'](_0x4cff28);});}_createView(){const _0xfb0b34=this['context'],_0x2ff383=new kt(this['context']['locale'],this['context']['config']['get']('presenceList.collapseAt')),_0x110a68=this['balloonPanelView'];if(!_0x3663b3(_0xfb0b34['config']['get']('presenceList.container')))throw new _0x1cba4d('presencelist-missing-container',this);_0x2ff383['counterView']['bind']('usersCount')['to'](this),_0x2ff383['bind']('isCollapsed')['to'](this,'usersCount',_0x5a05e1=>{const {collapseAt:_0x9bde70}=_0xfb0b34['config']['get']('presenceList'),_0x53583b=_0x5a05e1>=_0x9bde70;if(_0x53583b&&!_0x2ff383['inlineListView']['items']['find'](_0x53dbb2=>_0x53dbb2 instanceof yt)){const _0x48d0f9=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['currentDisplayedUsers']['length']==_0x48d0f9&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](this['currentDisplayedUsers']['length']-0x1),_0x2ff383['inlineListView']['items']['add'](_0x2ff383['counterView']);}return _0x53583b||this['hideDropdown'](),_0x53583b;}),_0x2ff383['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0x13ac4c=>{const _0x19b2f1=_0xfb0b34['config']['get']('presenceList'),_0x45ae07=new Ct(_0xfb0b34['locale'],_0x13ac4c,!!_0x19b2f1['onClick']);return _0x45ae07['bind']('hasTooltip')['to'](_0x2ff383,'isCollapsed',_0x2b1c6e=>!_0x2b1c6e),_0x45ae07['bind']('isFocusable')['to'](_0x2ff383,'isCollapsed',_0x47f810=>!_0x47f810),_0x19b2f1['onClick']&&this['listenTo'](_0x45ae07,'execute',()=>{this['view']['isCollapsed']||_0x19b2f1['onClick'](_0x13ac4c,_0x45ae07['element']);}),_0x45ae07;}),_0x2ff383['inlineListView']['keystrokes']['set']('Enter',(_0x392460,_0x49bf9d)=>{this['view']['isCollapsed']&&(this['showDropdown'](),this['presenceDropdownView']?.['listWrapperView']['focus'](),_0x49bf9d());}),_0x2ff383['render'](),_0x110a68['render'](),_0x2ff383['listenTo'](_0x2ff383['inlineListView']['element'],'mouseenter',()=>{this['view']['isCollapsed']&&this['showDropdown']();});const _0x4e2e4f=(_0xbbf262,_0x3fd55a)=>{this['_hideDropdownUnlessPointerInside'](_0x3fd55a);};return _0x2ff383['listenTo'](_0x2ff383['inlineListView']['element'],'mouseleave',_0x4e2e4f),_0x2ff383['listenTo'](_0x110a68['element'],'mouseleave',_0x4e2e4f),_0x4d491f({'emitter':_0x2ff383,'activator':()=>_0x110a68['isVisible'],'contextElements':[_0x110a68['element'],_0x2ff383['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0xfb0b34['config']['get']('presenceList.container')['appendChild'](_0x2ff383['element']),this['_overlayHost']=new _0x52da97(this['context']['locale'],{'resolveMountTarget':()=>this['_resolveOverlayTarget'](),'resolveInlineContainer':()=>this['context']['config']['get']('presenceList.container')}),this['_overlayHost']['sync'](),this['_overlayHost']['bodyCollection']['add'](this['balloonPanelView']),_0x2ff383;}_resolveOverlayTarget(){const _0x5d3218=this['context']['config']['get']('presenceList.overlayContainer')||this['context']['config']['get']('ui.overlayContainer');if(_0x5d3218)return _0x5d3218;const _0x55d362=this['context']['config']['get']('presenceList.container');return _0x55d362?_0x445939(_0x55d362):null;}['_handleUserAdd'](_0x233a04){if(!this['context']['config']['get']('presenceList.displayMe')&&_0x233a04['isMe'])return;const _0x26fd14=this['context']['config']['get']('presenceList.collapseAt')-0x1;for(this['usersCount']++;this['currentDisplayedUsers']['length']>=_0x26fd14-(this['view']['isCollapsed']?0x1:0x0)&&this['currentDisplayedUsers']['length']>0x1;)this['currentDisplayedUsers']['remove'](0x1);const _0x3faa74=_0x233a04['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0x233a04,_0x3faa74);}['_handleUserRemove'](_0x342fdd){this['usersCount']--;const {collapseAt:_0x36332b}=this['context']['config']['get']('presenceList'),_0x3cdf11=this['usersCount']>=_0x36332b;if(this['currentDisplayedUsers']['get'](_0x342fdd['id']))this['currentDisplayedUsers']['remove'](_0x342fdd['id']);else{if(_0x3cdf11&&this['currentDisplayedUsers']['length']+0x1===_0x36332b-0x1)return;}if(this['currentDisplayedUsers']['length']+(_0x3cdf11?0x1:0x0)<this['usersCount']){for(const _0x129af0 of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0x129af0['id'])&&(this['currentDisplayedUsers']['add'](_0x129af0,Math['min'](this['currentDisplayedUsers']['length']-(_0x3cdf11?0x1:0x0),0x1)),this['currentDisplayedUsers']['length']+(_0x3cdf11?0x1:0x0)===_0x36332b-0x1))return;}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0x3606be=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new It(this['context']['locale'],!!_0x3606be['onClick']),this['view']['inlineListView']['isExpanded']=!0x0;const {listWrapperView:_0x4cac2a}=this['presenceDropdownView'];_0x4cac2a['items']['bindTo'](this['_allConnectedUsers'])['using'](_0x288a3b=>{if(!_0x3606be['displayMe']&&_0x288a3b['isMe'])return null;const _0xe2fe14=new Tt(this['context']['locale'],_0x288a3b,!!_0x3606be['onClick']);return _0x3606be['onClick']&&this['listenTo'](_0xe2fe14,'execute',()=>{_0x3606be['onClick'](_0x288a3b,_0xe2fe14['element']);}),_0xe2fe14;}),this['_overlayHost']?.['sync'](),this['balloonPanelView']['content']['add'](this['presenceDropdownView']);const _0x560a53=_0x92771e['generatePositions']({'heightOffset':0x3,'config':{'withArrow':!0x1}});this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element'],'positions':[_0x560a53['southArrowNorth'],_0x560a53['southArrowNorthMiddleWest'],_0x560a53['southArrowNorthMiddleEast'],_0x560a53['southArrowNorthWest'],_0x560a53['southArrowNorthEast'],_0x560a53['northArrowSouth'],_0x560a53['northArrowSouthMiddleWest'],_0x560a53['northArrowSouthMiddleEast'],_0x560a53['northArrowSouthWest'],_0x560a53['northArrowSouthEast'],_0x560a53['viewportStickyNorth']]}),_0x4cac2a['focus'](),_0x4cac2a['checkIfScrollable']();const _0x4ce5b8=(_0x4f2035,_0xf6353)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0xf6353();};_0x4cac2a['keystrokes']['set']('Esc',_0x4ce5b8),_0x4cac2a['keystrokes']['set']('Shift+Tab',_0x4ce5b8),_0x4cac2a['keystrokes']['set']('Tab',()=>{this['view']['inlineListView']['focus'](),this['hideDropdown']();}),_0x4cac2a['focusTracker']['add'](this['view']['element']),_0x4cac2a['focusTracker']['on']('change:isFocused',(_0x45550e,_0x352a18,_0x817355)=>{_0x817355||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);}_hideDropdownUnlessPointerInside(_0x483e9e){this['presenceDropdownView']&&([this['view']['inlineListView']['element'],this['balloonPanelView']['element']]['some'](_0x156215=>_0x149d83(_0x156215,_0x483e9e))||this['hideDropdown']());}destroy(){super['destroy'](),this['view']&&this['view']['isRendered']&&this['view']['destroy'](),this['_overlayHost']&&(this['_overlayHost']['destroy'](),this['_overlayHost']=null);}},xt=class extends _0x2470ea{static get requires(){return[Q,Ot];}static get['pluginName'](){return'PresenceList';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}};export{at as CloudServicesCommentsAdapter,wt as CloudServicesRevisionHistoryAdapter,ut as CloudServicesTrackChangesAdapter,xt as PresenceList,Ot as PresenceListUI,it as RealTimeCollaborationClient,pt as RealTimeCollaborativeComments,ct as RealTimeCollaborativeEditing,_t as RealTimeCollaborativeRevisionHistory,gt as RealTimeCollaborativeTrackChanges,Q as Sessions,J as WebSocketGateway};
|