UNPKG

@ckeditor/ckeditor5-real-time-collaboration

Version:

A set of CKEditor 5 features enabling real-time collaboration within the editor using CKEditor Cloud Services.

26 lines 89.5 kB
/* * Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved. * * * * * +---------------------------------------------------------------------------------+ * | | * | Hello stranger! | * | | * | | * | What you're currently looking at is the source code of a legally protected, | * | proprietary software. Any attempts to deobfuscate / disassemble this code | * | are forbidden and will result in legal consequences. | * | | * | | * +---------------------------------------------------------------------------------+ * * * * */ import{ContextPlugin as _0x3037e3,Plugin as _0x5543a5,PendingActions as _0x3e4bfe,Context as _0x446099}from'@ckeditor/ckeditor5-core/dist/index.js';import{DomEmitterMixin as _0x9b49aa,CKEditorError as _0x1c2f2a,Collection as _0x56572f,global as _0x3979c9,version as nt,uid as _0xc06c50,KeystrokeHandler as _0x9966a1}from'@ckeditor/ckeditor5-utils/dist/index.js';import{Notification as _0x3ae107,View as _0x4d2917,ListView as _0x4941b4,ListItemView as et,LabelView as it,BalloonPanelView as _0x1f3152,clickOutsideHandler as _0x3495ca,BodyCollection as _0x212a26}from'@ckeditor/ckeditor5-ui/dist/index.js';import{ModelLiveRange as _0x13075d,History as _0x14c899,NoOperation as _0x570a93,InsertOperation as _0x552824,MarkerOperation as _0x242d8c,RootAttributeOperation as _0x40307c,transformOperationSets as _0x31ad0e,OperationFactory as _0xcfa427}from'@ckeditor/ckeditor5-engine/dist/index.js';import{WebSocketGateway as rt,WEB_SOCKET_GATEWAY_STATES as _0x7ec47c,CollaborativeEditingService as _0xf7aeca,User as ct,CommentsService as _0x42707b,TrackChangesService as tt,RevisionHistoryService as _0x5f0b95,EditorService as _0x167f86}from'@ckeditor/ckeditor-cloud-services-collaboration/dist/index.js';import{Users as _0x222559,UserView as st}from'ckeditor5-collaboration/dist/index.js';import{Compressor as _0x232fab}from'@ckeditor/ckeditor5-operations-compressor/dist/index.js';import{isElement as _0x143b0d}from'es-toolkit/compat';class n extends _0x3037e3{static ['WebSocketGateway']=/* #__PURE__ -- @preserve */ ((()=>rt)());static ['initialReconnectionInterval']=0x3e8;['connection'];['_reconnectionStack'];['_shouldPluginsReconnect'];['_domEmitter'];static get['requires'](){return['CloudServices',_0x3ae107];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x15174a){super(_0x15174a),this['set']('state',_0x7ec47c['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=new(_0x9b49aa())();}['init'](){const _0x280a23=this['context'],_0x4e90a4=_0x280a23['plugins']['get']('CloudServices'),_0x41bf38=_0x280a23['plugins']['get'](_0x3ae107);if(!_0x4e90a4['token'])throw new _0x1c2f2a('websocketgateway-missing-token',this);if(!_0x4e90a4['webSocketUrl'])throw new _0x1c2f2a('websocketgateway-missing-websocket-url',this);return this['_domEmitter']['listenTo'](window,'offline',()=>this['_isBrowserOffline']=!0x0),this['_domEmitter']['listenTo'](window,'online',()=>this['_isBrowserOffline']=!0x1),this['context']['config']['define']('cloudServices.connectionTimeout',0xa),this['context']['config']['define']('cloudServices.requestTimeout',0x14),n['WebSocketGateway']['connect'](_0x4e90a4['token'],_0x4e90a4['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0x1b9c4a=>{if(this['connection']=_0x1b9c4a,this['bind']('state')['to'](_0x1b9c4a,'state',this,'_isBrowserOffline',(_0xfc886a,_0x18a42f)=>('connected'!==_0xfc886a&&(this['_shouldPluginsReconnect']=!0x0),_0x18a42f||_0xfc886a!==_0x7ec47c['CONNECTED']?_0x7ec47c['DISCONNECTED']:this['state']==_0x7ec47c['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),_0x7ec47c['CONNECTING']):_0x7ec47c['CONNECTED'])),this['connection']['on']('error',(_0xfbec45,_0x535547)=>{if('limitExceeded'!==_0x535547['code'])throw console['error'](_0x535547),new _0x1c2f2a('cloudservices-init',null,{'originalError':_0x535547});_0x41bf38['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'});}),!_0x1b9c4a['me'])return new Promise(_0x441b59=>_0x1b9c4a['on']('change:me',_0x441b59));})['catch'](_0x103ca3=>{throw console['error'](_0x103ca3),new _0x1c2f2a('cloudservices-init',null,{'originalError':_0x103ca3});});}['addToReconnectionStack'](_0x351fcf){if('function'!=typeof _0x351fcf['reconnect'])throw new _0x1c2f2a('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0x351fcf))throw new _0x1c2f2a('websocketgateway-plugin-already-registered',this,{'name':_0x351fcf['constructor']['pluginName']});this['_reconnectionStack']['add'](_0x351fcf);}['removeFromReconnectionStack'](_0x432faf){this['_reconnectionStack']['delete'](_0x432faf);}['isInReconnectionStack'](_0x4f6a64){return this['_reconnectionStack']['has'](_0x4f6a64);}['_reconnect'](){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0x1dc86d=>_0x1dc86d['reconnect']())))['then'](()=>this['state']=_0x7ec47c['CONNECTED'])['catch'](_0x1bc761=>{throw console['error'](_0x1bc761),new _0x1c2f2a('cloudservices-reconnection-error',this['context']);});}['disconnect'](){this['connection']&&this['connection']['disconnect'](),this['state']=_0x7ec47c['DISCONNECTED'],this['_domEmitter']['stopListening']();}['destroy'](){this['disconnect'](),super['destroy']();}}class i extends _0x3037e3{['channelSessions'];['channelConnectedUsers'];['allConnectedUsers'];['_registeredSessions'];['_uniqueUsersCount'];['_users'];static get['pluginName'](){return'Sessions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}static get['requires'](){return[n,_0x222559];}constructor(_0x35af9b){super(_0x35af9b),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0x56572f(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x222559);}['init'](){const _0x40d43d=this['context']['plugins']['get'](n);this['listenTo'](_0x40d43d,'change:state',(_0x20eb25,_0x47f98f,_0x3be615)=>{if('connected'!==_0x3be615)this['channelSessions']['forEach'](_0x3055c0=>_0x3055c0['clear']()),this['channelConnectedUsers']['forEach'](_0x175f3c=>_0x175f3c['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0xeb2540,_0x5dd7a9]of this['_registeredSessions'])for(const _0x572d30 of _0x5dd7a9)this['_handleSessionAdd'](_0xeb2540,_0x572d30);}}),this['_createUser'](_0x40d43d['connection']['me'],!0x0);}['register'](_0x1c5059,_0x9f58f4){if(this['_registeredSessions']['has'](_0x1c5059))throw new _0x1c2f2a('sessions-register-already-registered',null,{'channelId':_0x1c5059});this['_registeredSessions']['set'](_0x1c5059,_0x9f58f4),this['channelSessions']['set'](_0x1c5059,new _0x56572f()),this['channelConnectedUsers']['set'](_0x1c5059,new _0x56572f()),this['listenTo'](_0x9f58f4,'add',(_0x259f80,_0x28d7de)=>this['_handleSessionAdd'](_0x1c5059,_0x28d7de)),this['listenTo'](_0x9f58f4,'remove',(_0x5c9367,_0x460d11)=>this['_handleSessionRemove'](_0x1c5059,_0x460d11));for(const _0x2f3b27 of _0x9f58f4)this['_handleSessionAdd'](_0x1c5059,_0x2f3b27);}['unregister'](_0x1cab75){if(!this['_registeredSessions']['has'](_0x1cab75))throw new _0x1c2f2a('sessions-unregister-not-exist',null,{'channelId':_0x1cab75});const _0x3726ab=this['_registeredSessions']['get'](_0x1cab75);this['stopListening'](_0x3726ab);for(const _0x316419 of _0x3726ab)'connected'===this['context']['plugins']['get'](n)['state']&&this['_handleSessionRemove'](_0x1cab75,_0x316419);this['_registeredSessions']['delete'](_0x1cab75),this['channelSessions']['delete'](_0x1cab75),this['channelConnectedUsers']['delete'](_0x1cab75);}get['mySessionId'](){return this['context']['plugins']['get'](n)['connection']['sessionId'];}['getUserBySessionId'](_0x21719c){for(const _0xd70251 of this['channelSessions']['values']())for(const _0x1f466d of _0xd70251)if(_0x1f466d['id']===_0x21719c)return _0x1f466d['user'];}['getUserSessions'](_0x65e718,_0x2479fd){const _0x37364a=_0x2479fd?[this['channelSessions']['get'](_0x2479fd)]:this['channelSessions']['values'](),_0x38c5c8=new Set();for(const _0x15348f of _0x37364a)for(const _0x2e4998 of _0x15348f)_0x2e4998['user']['id']===_0x65e718['id']&&_0x38c5c8['add'](_0x2e4998['id']);return _0x38c5c8;}['getUserRole'](_0x1ba11d){for(const _0x4d904d of this['channelSessions']['values']())for(const _0x59b9d4 of _0x4d904d)if(_0x59b9d4['user']===_0x1ba11d)return _0x59b9d4['role'];}['_handleSessionAdd'](_0x27f4a8,_0x8eb78b){if('connected'!==this['context']['plugins']['get'](n)['state'])return;const _0x34a1fc=_0x8eb78b['user'],_0x6550c=this['_users']['getUser'](_0x34a1fc['id'])||this['_createUser'](_0x34a1fc),_0x5e90bf=Object['assign']({},_0x8eb78b,{'user':_0x6550c});this['channelSessions']['get'](_0x27f4a8)['add'](_0x5e90bf);const _0x411c7e=this['channelConnectedUsers']['get'](_0x27f4a8);_0x411c7e['has'](_0x6550c['id'])||_0x411c7e['add'](_0x6550c),this['allConnectedUsers']['has'](_0x6550c['id'])||this['allConnectedUsers']['add'](_0x6550c,_0x6550c['isMe']?0x0:void 0x0),this['fire']('sessionAdd:'+_0x27f4a8,{'channelId':_0x27f4a8,'session':_0x5e90bf});}['_handleSessionRemove'](_0x4ac939,_0x11cdf0){if('connected'!==this['context']['plugins']['get'](n)['state'])return;const _0x41bb0d=this['channelConnectedUsers']['get'](_0x4ac939),_0x59f8fc=_0x11cdf0['user'];_0x59f8fc['id']&&(this['channelSessions']['get'](_0x4ac939)['remove'](_0x11cdf0['id']),_0x41bb0d['has'](_0x59f8fc['id'])&&!this['getUserSessions'](_0x59f8fc,_0x4ac939)['size']&&_0x41bb0d['remove'](_0x59f8fc['id']),this['allConnectedUsers']['get'](_0x59f8fc['id'])&&!this['getUserSessions'](_0x59f8fc)['size']&&this['allConnectedUsers']['remove'](_0x59f8fc['id']));}['_createUser'](_0x2933b3,_0x5c347d){const _0x24972c=this['_users']['addUser'](_0x2933b3);return _0x5c347d&&this['_users']['defineMe'](_0x2933b3['id']),_0x24972c['orderNumber']=this['_uniqueUsersCount']++,_0x24972c;}}class G extends _0x5543a5{['_domEmitter']=new(_0x9b49aa())();static get['requires'](){return[i];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x3efaa5=this['editor'],_0xa8eb58=_0x3efaa5['plugins']['get'](i);_0x3efaa5['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x1a3b81,{writer:_0x565a16})=>function(_0x4909b7,_0x49f498,_0x573df7,_0x17eff9){const _0x1be190=_0x4909b7['markerName']['split'](':')[0x2],_0x4254c2=_0x573df7['getUserBySessionId'](_0x1be190);if(!_0x4254c2||_0x1be190===_0x573df7['mySessionId'])return;if(!_0x17eff9['model']['schema']['checkChild'](_0x4909b7['markerRange']['start'],'$text'))return;const _0x886191={'class':'ck-user__marker\x20'+_0x4254c2['color']['getMarkerClass'](),'data-name':_0x4254c2['name'],'data-session-id':_0x1be190},_0x5bbe2b=_0x17eff9['model']['markers']['get'](_0x4909b7['markerName']),_0x43964d=_0x5bbe2b['getStart'](),_0x1856af=_0x43964d['nodeAfter'],_0x3c6e83=_0x17eff9['model']['schema'];if(_0x1856af&&_0x3c6e83['isObject'](_0x1856af)&&_0x3c6e83['isInline'](_0x1856af)&&!_0x17eff9['model']['markers']['get']('user:range:'+_0x1be190)['getRange']()['isCollapsed'])return;const _0xeb5fe1=_0x43964d['parent'];return _0x17eff9['model']['schema']['isLimit'](_0xeb5fe1)&&!_0x17eff9['model']['hasContent'](_0xeb5fe1)&&(_0x886191['contenteditable']=!0x1),function(_0x3166e9,_0x3a30e0,_0xa08d5d){const _0x166053=_0x3166e9['createUIElement']('span',_0x3a30e0);return _0x3166e9['setCustomProperty']('userPositionMarker',!0x0,_0x166053),_0x166053['render']=function(_0x65f1b){const _0x429fc3=this['toDomElement'](_0x65f1b),_0x2caa75=document['createElement']('span');return _0x2caa75['classList']['add']('ck-user__marker-tooltip'),_0x2caa75['setAttribute']('contenteditable','false'),_0x2caa75['setAttribute']('spellcheck','false'),_0x2caa75['textContent']=_0xa08d5d['name'],_0x429fc3['innerHTML']='⁠<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span>'+_0x2caa75['outerHTML']+'⁠',_0x429fc3['addEventListener']('mouseenter',()=>{_0x429fc3['classList']['add']('ck-user__marker_hovered');}),_0x429fc3['addEventListener']('mouseleave',()=>{_0x429fc3['classList']['remove']('ck-user__marker_hovered');}),_0x429fc3;},_0x166053['isSimilar']=function(_0x300e16){return!(!this['getCustomProperty']('userPositionMarker')||!_0x300e16['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0x300e16['getAttribute']('data-session-id'));},_0x166053;}(_0x49f498,_0x886191,_0x4254c2);}(_0x1a3b81,_0x565a16,_0xa8eb58,_0x3efaa5)}),_0x3efaa5['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0x3b9716=>function(_0x40bb4c,_0x4932ad){const _0x205075=_0x40bb4c['markerName']['split'](':')[0x2];if(_0x205075===_0x4932ad['mySessionId'])return null;const _0x41183e=_0x4932ad['getUserBySessionId'](_0x205075);if(!_0x41183e)return{'id':_0x205075,'classes':[]};return{'id':_0x205075,'classes':['ck-user__selection',_0x41183e['color']['getSelectionClass']()],'attributes':{'data-session-id':_0x205075},'priority':0x7d0+_0x41183e['orderNumber']};}(_0x3b9716,_0xa8eb58)}),function(_0x269476){const _0x1a0aca=_0x269476['model'],_0x51675d=new Map(),_0x1dd114=_0x269476['plugins']['get'](i);_0x1a0aca['markers']['on']('update:user:range',(_0x221ae8,_0x253b39,_0xf2f89a,_0x22e9c3)=>{if(!_0x22e9c3&&_0x51675d['get'](_0x253b39['name']))return _0x51675d['get'](_0x253b39['name'])['detach'](),void _0x51675d['delete'](_0x253b39['name']);const _0x1f3eff=_0x253b39['name']['split'](':')[0x2];if(_0x1f3eff===_0x1dd114['mySessionId'])return;const _0x59ab54='user:position:'+_0x1f3eff;_0x1a0aca['markers']['has'](_0x59ab54)&&_0x269476['editing']['reconvertMarker'](_0x59ab54),_0x253b39['on']('change:range',(_0x124570,_0x1a7747,_0x47aae5)=>{if('$graveyard'!=_0x1a7747['root']['rootName']&&'$graveyard'==_0x253b39['getRange']()['root']['rootName']&&!_0x51675d['has'](_0x253b39['name'])){const _0x236567=_0x1a0aca['schema']['getNearestSelectionRange'](_0x47aae5['deletionPosition']);if(_0x236567){const _0x5a6f6a=_0x13075d['fromRange'](_0x236567);_0x51675d['set'](_0x253b39['name'],_0x5a6f6a),_0x5a6f6a['on']('change:range',(_0x293e23,_0x58c91b,_0x54cefb)=>{if('$graveyard'==_0x5a6f6a['root']['rootName']){const _0x420e53=_0x1a0aca['schema']['getNearestSelectionRange'](_0x54cefb['deletionPosition']);_0x420e53?(_0x5a6f6a['start']=_0x420e53['start'],_0x5a6f6a['end']=_0x420e53['end']):(_0x51675d['delete'](_0x253b39['name']),_0x5a6f6a['detach']());}});}}});}),_0x1a0aca['document']['on']('change',()=>{_0x51675d['size']>0x0&&_0x1a0aca['enqueueChange']({'isUndoable':!0x1},_0x14383a=>{for(const [_0x557136,_0x38d5f8]of _0x51675d)'$graveyard'==_0x1a0aca['markers']['get'](_0x557136)['getRange']()['root']['rootName']&&(te(_0x557136['split'](':')[0x2],_0x38d5f8['toRange'](),_0x1a0aca,_0x14383a),_0x38d5f8['detach']());_0x51675d['clear']();});});}(_0x3efaa5),this['_domEmitter']['listenTo'](_0x3979c9['document'],'keydown',(_0x57ea1d,{key:_0x5e5712})=>{'Escape'===_0x5e5712&&function(_0x55e692){_0x55e692['editing']['view']['change'](_0x25c8b8=>{for(const _0x2a8b8f of _0x55e692['model']['markers']){if(!_0x2a8b8f['name']['startsWith']('user:position'))continue;const _0x159ac8=_0x55e692['editing']['mapper']['markerNameToElements'](_0x2a8b8f['name']);if(_0x159ac8){for(const _0xf69b14 of _0x159ac8)_0x25c8b8['removeClass']('ck-user__marker_hovered',_0xf69b14);}}});}(_0x3efaa5);},{'useCapture':!0x0});}['afterInit'](){const _0x1e1247=this['editor'],_0x6e2855=_0x1e1247['commands']['get']('undo');_0x6e2855&&_0x1e1247['model']['on']('applyOperation',(_0x11a0de,_0x4d1469)=>{const _0x32828b=_0x4d1469[0x0];if(!_0x32828b['isDocumentOperation'])return;if('marker'!=_0x32828b['type']||!_0x32828b['name']['startsWith']('user:'))return;const _0x521a4b=_0x32828b['batch'];_0x6e2855['_createdBatches']['has'](_0x521a4b)&&(_0x32828b['newRange']=_0x32828b['oldRange']?_0x1e1247['model']['createRange'](_0x32828b['oldRange']['start'],_0x32828b['oldRange']['end']):null);},{'priority':'highest'});}['destroy'](){return this['_domEmitter']['stopListening'](),super['destroy']();}['createUserMarkerOperations'](){const _0x5e6553=this['editor'],_0x3d7540=_0x5e6553['model']['document'],_0x35c67b=_0x5e6553['plugins']['get'](i);_0x5e6553['model']['enqueueChange']({'isUndoable':!0x1},_0xe23f8d=>{const _0x38f683='user:range:'+_0x35c67b['mySessionId'],_0x3a4ad1='user:position:'+_0x35c67b['mySessionId'],_0xb88c42=_0x5e6553['model']['markers']['has'](_0x38f683);_0x5e6553['editing']['view']['hasDomSelection']?te(_0x35c67b['mySessionId'],_0x3d7540['selection']['getFirstRange'](),_0x5e6553['model'],_0xe23f8d):_0xb88c42&&(_0xe23f8d['removeMarker'](_0x38f683),_0xe23f8d['removeMarker'](_0x3a4ad1));});}}function te(_0x308156,_0x20f78a,_0x16a094,_0x5dbd5d){const _0x4a0ca4='user:range:'+_0x308156,_0x3baa0e='user:position:'+_0x308156,_0xd4709c=_0x20f78a['getContainedElement']();let _0xabb32d=_0x20f78a['start'];if(_0xd4709c&&_0xd4709c['is']('element','tableCell')){const _0x3aaf02=function(_0x3da217,_0x23e79a){for(const _0x3f88b1 of _0x3da217['getPositions']())if(_0x23e79a['schema']['checkChild'](_0x3f88b1,'$text'))return _0x3f88b1;}(_0x20f78a,_0x16a094);_0x3aaf02&&(_0xabb32d=_0x3aaf02,_0x20f78a=_0x5dbd5d['createRange'](_0xabb32d));}const _0x54e5f5=_0x5dbd5d['createRange'](_0xabb32d);_0x16a094['markers']['has'](_0x4a0ca4)?(_0x5dbd5d['updateMarker'](_0x4a0ca4,{'range':_0x20f78a}),_0x5dbd5d['updateMarker'](_0x3baa0e,{'range':_0x54e5f5})):(_0x5dbd5d['addMarker'](_0x4a0ca4,{'range':_0x20f78a,'usingOperation':!0x0}),_0x5dbd5d['addMarker'](_0x3baa0e,{'range':_0x54e5f5,'usingOperation':!0x0}));}function $(_0xc768ff,_0x220542,_0x2847c3){const _0xbc10aa=_0xc768ff['t'],t=_0xc768ff['t'];switch(_0x220542){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 _0xbc10aa({'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'},_0x2847c3);default:return'';}}let Q=0x1;class l extends _0x5543a5{static ['CollaborativeEditingService']=/* #__PURE__ -- @preserve */ ((()=>_0xf7aeca)());['_offset'];['sessionId'];['serverHistory'];['_channelId'];['_service'];['_document'];['_compressor'];['_bufferedOperations'];['_knownOperations'];['_knownRootNames'];['_pendingAction'];['_hasSelectionChanged'];['_sendBufferedOperationsDelayId'];['_baseBufferDelay'];['_currentBufferDelay'];['_lastSyncedOperationId'];['_disconnectionOperations'];['_operationIdentifier'];static get['requires'](){return[n,i,G,_0x3e4bfe,_0x222559,_0x3ae107];}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 _0x57ec61=this['serverHistory']['getOperations']();for(let _0x3a4fcb=_0x57ec61['length']-0x1;_0x3a4fcb>=0x0;_0x3a4fcb--){const _0x3df23b=_0x57ec61[_0x3a4fcb];if(!this['_disconnectionOperations']['has'](_0x3df23b))return _0x3df23b['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0xf51147){if(super(_0xf51147),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x14c899(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0x1c2f2a('collaboration-missing-channelid',this);const _0x573f7f=_0xf51147['config']['get']('cloudServices.bundleVersion')||nt;this['_service']=new l['CollaborativeEditingService'](_0x573f7f,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0x232fab(),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 Z(this['_disconnectionOperations']);}['init'](){const _0x46b394=this['editor'],_0x3acc56=_0x46b394['plugins']['get'](_0x222559),_0x296c46=_0x46b394['plugins']['get'](n);this['listenTo'](_0x3acc56,'getOperationAuthor',(_0x3019ed,_0x319d93)=>{const _0x5f5912=_0x319d93[0x0];_0x5f5912['_authorId']&&(_0x3019ed['return']=_0x3acc56['getUser'](_0x5f5912['_authorId']),_0x3019ed['stop']()),null===_0x5f5912['_authorId']&&(_0x3019ed['return']=null,_0x3019ed['stop']());},{'priority':'high'}),this['listenTo'](_0x46b394['model']['document']['selection'],'change:range',(_0x3b06e3,_0x2073fd)=>{_0x2073fd['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x46b394['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x46b394['model']['on']('applyOperation',(_0x1d04dd,_0x3f3acd)=>{const _0x392084=_0x3f3acd[0x0];_0x392084['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0x392084),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['bind']('_isEditingAllowed')['to'](_0x296c46,'state',this,'_hasSynchronizationProblem',(_0x14962f,_0x49e493)=>'connected'===_0x14962f&&!_0x49e493),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x46b394['disableReadOnlyMode']('rtc-offline'):_0x46b394['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x46b394['disableReadOnlyMode']('rtc-offline'):_0x46b394['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async['reconnect'](){const _0x5acb31=this['editor']['plugins']['get'](i),_0x4e87a0=this['editor']['plugins']['get'](n);try{this['_isPendingUpdate']=!0x0,_0x5acb31['unregister'](this['_channelId']);const _0x1b5fd8=await this['_service']['reconnect'](_0x4e87a0['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0x1b5fd8)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x2f5866=await this['_service']['getConnectedSessions']();_0x5acb31['register'](this['_channelId'],_0x2f5866),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x3fb6b3){if(function(_0x1d56e9){return'404'===_0x1d56e9['code'];}(_0x3fb6b3)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0x2bbe1d){return'409'===_0x2bbe1d['code'];}(_0x3fb6b3)){const _0x492120=$(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'](_0x492120);}else{if(!(_0x3fb6b3 instanceof X))throw _0x3fb6b3;this['_handleReconnectionError']();}}}}['destroy'](){const _0xd2cb4d=this['editor']['plugins']['get'](n),_0x232257=this['editor']['plugins']['get'](i);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x232257['channelSessions']['has'](this['_channelId'])&&_0x232257['unregister'](this['_channelId']),_0xd2cb4d['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async['_handleReconnectionResponse'](_0x3991c4){if(this['sessionId']!==_0x3991c4['sessionId']&&this['_lastSyncedOperationId']!==_0x3991c4['lastOperationId'])throw new X();return this['sessionId']=_0x3991c4['sessionId'],this['_handleServerResponse']([],{..._0x3991c4,'wereChangesApplied':!0x1,'data':_0x3991c4['data']},'reconnect');}async['_connectService'](_0x54633a,_0x56dad2=!0x1){const {connection:_0x2b4a19}=this['editor']['plugins']['get'](n);l['CollaborativeEditingService']['getConnectedSessions'](_0x2b4a19,this['_channelId'])['then'](_0x2d565e=>this['_initSessionsHandling'](_0x2d565e))['catch'](_0x137b1f=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x137b1f);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x6aeadd,_0x225fdc)=>{this['_crash']('realtimecollaborationclient-init-service-internal-error',_0x225fdc);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_isConnected']=!0x1;});const _0x7db345=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x54633a);this['_isPendingUpdate']=!0x0;const _0x36db2a=await this['_service']['connect'](_0x2b4a19,this['_compressOperations'](_0x54633a),_0x7db345);if(this['sessionId']=_0x36db2a['sessionId'],_0x56dad2){if(!_0x36db2a['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x36db2a['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0x54633a,_0x36db2a,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x36db2a,_0x54633a);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}['_handleSendingSelectionMarkers'](){const _0x25b5f0=this['editor']['plugins']['get'](i),_0x253e32=this['editor']['plugins']['get'](G),_0x4a5355=_0x25b5f0['channelSessions']['get'](this['_channelId']);_0x4a5355&&_0x4a5355['length']>0x1?_0x253e32['createUserMarkerOperations']():this['listenTo'](_0x25b5f0,'sessionAdd:'+this['_channelId'],()=>{0x2===_0x25b5f0['channelSessions']['get'](this['_channelId'])['length']&&_0x253e32['createUserMarkerOperations']();});}async['_handleReceivedOperations'](_0x35aa56,_0x7b2009,_0x8f7d03,_0x1807ef){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x7b2009){const _0x4368fe=this['_decompressOperations'](_0x8f7d03,_0x1807ef);await this['_fetchMissingUsers'](_0x4368fe),this['_handleExternalOperations'](_0x4368fe,_0x7b2009,_0x8f7d03['lastOperationId'])||this['_crash']('realtimecollaborationclient-init-service-incorrect-server-operation');}}async['_connectAfterSessionHasBeenFlushed'](){this['_disconnectService']();const {locale:_0x1962cc}=this['editor'];let _0x20747a;try{_0x20747a=await this['_service']['getDocumentDetails']();}catch{const _0x14558c=$(_0x1962cc,'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'](_0x14558c);}const _0x2fcd2f=_0x20747a['currentDocumentSession']||_0x20747a['lastDocumentSession'];if(this['_lastSyncedOperationId']!==_0x2fcd2f['lastOperationId']){const _0x1af39e=$(_0x1962cc,'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'](_0x1af39e);}await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);}['_disconnectService'](){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['stopListening'](this['_service']);}['_initSessionsHandling'](_0x15ac54){const _0x5489b2=this['editor']['plugins']['get'](i);this['listenTo'](_0x5489b2,'sessionAdd:'+this['_channelId'],(_0x4dab13,{session:_0x20f3e2})=>{if(_0x20f3e2['id']===_0x5489b2['mySessionId']){_0x4dab13['off']();const _0x3b3574=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0x1ff01d=_0x20f3e2['permissions'];_0x3b3574&&_0x3b3574['isEnabled']&&(_0x1ff01d=_0x1ff01d['filter'](_0x248b9c=>'document:write'!==_0x248b9c)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0x1ff01d,this['_channelId']);}}),_0x5489b2['register'](this['_channelId'],_0x15ac54);}['_initThrowingOnDataSet'](){const _0x13181b=this['editor']['data']['set'];this['editor']['data']['set']=(..._0xa2b575)=>{if(!_0xa2b575[_0xa2b575['length']-0x1]['suppressErrorInCollaboration'])throw new _0x1c2f2a('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x13181b['apply'](this['editor']['data'],_0xa2b575);};}['_setUpDataInit'](){this['editor']['data']['on']('init',(_0x2fcf80,[_0x4e4835])=>{if(this['_document']['version'])throw new _0x1c2f2a('realtimecollaborationclient-init-document-already-initialized',this);_0x2fcf80['stop'](),this['_setPendingAction']();const _0x3fd939=this['editor']['config']['get']('rootsAttributes'),_0x319d41=this['_getOperationsFromInitData'](_0x4e4835,_0x3fd939);0x0==_0x319d41['length']&&_0x319d41['push'](new _0x570a93(0x0)),_0x2fcf80['return']=this['_connectService'](_0x319d41)['then'](()=>{this['editor']['plugins']['get'](n)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x3035dc=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x3035dc))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x2fc560,[_0x580961,_0x5963b5])=>{_0x2fc560['stop']();const _0x50188b=this['editor']['model']['document']['getRoot'](_0x580961);if(!this['_knownRootNames']['has'](_0x580961)){const _0x298b3e=_0x5963b5&&_0x5963b5['data']?_0x5963b5['data']:'',_0x41b7d1=_0x5963b5&&_0x5963b5['attributes']?_0x5963b5['attributes']:{};await this['_loadRoot'](_0x580961,_0x298b3e,_0x41b7d1);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0x50188b['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0x50188b);});},{'priority':'high'});}async['_fetchMissingUsers'](_0x518872){const _0x578596=this['editor']['plugins']['get'](_0x222559),{connection:_0x2f707e}=this['editor']['plugins']['get'](n),_0x4397cd=new Set();for(const _0x361199 of _0x518872){const _0x145187=_0x361199['_authorId'];_0x145187&&!_0x578596['getUser'](_0x145187)&&_0x4397cd['add'](_0x145187);}if(0x0===_0x4397cd['size'])return;const _0x57043f=await ct['getMany'](_0x2f707e,Array['from'](_0x4397cd));for(const _0x41d735 of _0x57043f)_0x578596['getUser'](_0x41d735['id'])||_0x578596['addUser'](_0x41d735);}['_getOperationsFromInitData'](_0x28524e,_0x2d5cba={}){const _0x268489=this['editor']['model'],_0x41734e=[];let _0x48e07c=0x0;const _0x182055='string'==typeof _0x28524e?{'main':_0x28524e}:_0x28524e;for(const _0x2d1294 of Object['keys'](_0x182055)){if(!this['_document']['roots']['has'](_0x2d1294))throw new _0x1c2f2a('realtimecollaborationclient-init-non-existent-root',this);const _0x3bbb03=this['editor']['data']['parse'](_0x182055[_0x2d1294]),_0x4d24f2=this['_document']['getRoot'](_0x2d1294),_0x40b336=new _0x552824(_0x268489['createPositionAt'](_0x4d24f2,0x0),_0x3bbb03,_0x48e07c++);_0x41734e['push'](_0x40b336);for(const [_0x31fb85,_0x19b975]of _0x3bbb03['markers']){const _0xab7705=_0x268489['createRange'](_0x268489['createPositionFromPath'](_0x4d24f2,_0x19b975['start']['path']['slice']()),_0x268489['createPositionFromPath'](_0x4d24f2,_0x19b975['end']['path']['slice']())),_0x52a229=new _0x242d8c(_0x31fb85,null,_0xab7705,_0x268489['markers'],!0x0,_0x48e07c++);_0x41734e['push'](_0x52a229);}}if(_0x2d5cba)for(const [_0x14543f,_0x43e680]of Object['entries'](_0x2d5cba)){const _0x18ad20=_0x268489['document']['getRoot'](_0x14543f);if(!_0x18ad20)throw new _0x1c2f2a('multi-root-editor-root-attributes-no-root',null);for(const [_0x45d7d2,_0x2646ce]of Object['entries'](_0x43e680))if(null!==_0x2646ce){const _0x56a9ff=new _0x40307c(_0x18ad20,_0x45d7d2,null,_0x2646ce,_0x48e07c++);_0x41734e['push'](_0x56a9ff);}}return _0x41734e;}async['_loadRoot'](_0x54b607,_0x5dcbec,_0x5b49bd){this['_getOperationsFromInitData']({[_0x54b607]:_0x5dcbec},{[_0x54b607]:_0x5b49bd})['forEach']((_0x27b2ca,_0x1526fa)=>{_0x27b2ca['baseVersion']=this['_document']['version']+_0x1526fa,_0x27b2ca['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x27b2ca);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async['_handleInitialConnectionData'](_0x59d8db,_0x518592){let _0x3e153d;this['_offset']=_0x59d8db['offset'];const _0x21f230=_0x59d8db['wereChangesApplied']&&!_0x59d8db['initData'],_0x5cf2e3=_0x21f230?0x0:_0x59d8db['data']['baseVersion'];if(_0x518592['forEach'](_0x53b2a4=>{_0x53b2a4['_isInit']=!0x0,_0x53b2a4['createdAt']=_0x59d8db['sessionCreatedAt'],_0x53b2a4['_authorId']=null;}),_0x21f230)_0x3e153d=_0x518592,this['_applyOperationsSet'](_0x3e153d,_0x21f230);else{if(_0x59d8db['initData']){const _0xfae3cf=this['_getOperationsFromInitData'](_0x59d8db['initData']);this['_document']['history']['version']=-_0xfae3cf['length'],_0xfae3cf['forEach'](_0x40d51c=>{_0x40d51c['baseVersion']-=_0xfae3cf['length'],_0x40d51c['createdAt']=_0x59d8db['sessionCreatedAt'],_0x40d51c['_isInit']=!0x0,_0x40d51c['_authorId']=null;}),this['_applyOperationsSet'](_0xfae3cf,!0x0),this['serverHistory']['version']=-_0xfae3cf['length']+this['_offset'],this['_updateServerHistory'](_0xfae3cf);}this['_document']['history']['version']=_0x5cf2e3,_0x3e153d=this['_decompressOperations'](_0x59d8db['data'],_0x59d8db['metadata']),await this['_fetchMissingUsers'](_0x3e153d),this['_applyOperationsSet'](_0x3e153d,_0x21f230);}_0x59d8db['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x3e153d,_0x59d8db['lastOperationId']),this['_lastSyncedOperationId']=_0x59d8db['lastOperationId']),this['serverHistory']['version']=_0x5cf2e3+this['_offset'],this['_updateServerHistory'](_0x3e153d),_0x518592['filter'](_0x1506db=>{const _0x445347=this['_getAffectedRoot'](_0x1506db);return _0x445347&&!this['_knownRootNames']['has'](_0x445347);})['forEach']((_0x137e2f,_0x32ebe5)=>{_0x137e2f['baseVersion']=this['_document']['version']+_0x32ebe5,this['_saveOperationInBuffer'](_0x137e2f);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x1af4a9,_0x58a25f){const _0x3828e5=_0x58a25f&&_0x58a25f['message'];if(_0x3828e5&&_0x3828e5['startsWith']('realtimecollaborationclient'))throw _0x58a25f;const _0x209019=this['editor']['plugins']['get'](n);throw this['_isPendingUpdate']=!0x0,_0x209019['disconnect'](),this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0x1c2f2a(_0x1af4a9,this['editor'],_0x3828e5?{'originalError':_0x3828e5}:void 0x0);}['_saveOperationInBuffer'](_0x30ea78){this['_knownOperations']['has'](_0x30ea78)||(this['_knownOperations']['add'](_0x30ea78),this['_bufferedOperations']['push'](_0x30ea78),this['_pendingAction']||'marker'==_0x30ea78['type']&&!_0x30ea78['affectsData']||this['_setPendingAction']());}['_sendBufferedOperationsDelayed'](_0xbf8c8a=!0x1){!_0xbf8c8a&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0x417f18=>{_0x417f18&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0x2b4c42=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0x882fe){return _0x882fe['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x882fe['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0x882fe['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0x2b4c42)||this['_crash'](_0x2b4c42['message'],_0x2b4c42);});},this['_currentBufferDelay']));}['_waitUntilSynced'](){return new Promise(_0x284c1d=>{this['on']('change:_isPendingUpdate',()=>{_0x284c1d();});});}async['_sendBufferedOperations'](){const _0x44e5b5=this['editor']['plugins']['get'](G);if(this['_shouldSendSelectionUpdate']()&&(_0x44e5b5['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x410c7f=[...this['_bufferedOperations']];for(const _0x93c274 of _0x410c7f)_0x93c274['wasUndone']=this['_document']['history']['isUndoneOperation'](_0x93c274);const _0x23251a=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x410c7f),_0x53086d=Q++,_0x2776c4=this['_compressOperations'](_0x410c7f),_0x3351a8=await this['_service']['sendOperations'](_0x2776c4,_0x2776c4['baseVersion'],_0x23251a);try{return await this['_handleServerResponse'](_0x410c7f,_0x3351a8,_0x53086d);}catch(_0x12282b){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0x12282b);}}async['_handleServerResponse'](_0x26ee8f,_0xcbacfb,_0x3d8d94){if('error'in _0xcbacfb)throw _0xcbacfb['error'];let _0x598a46=!0x1;if(_0xcbacfb['wereChangesApplied']){_0xcbacfb['lastOperationId']&&(this['_lastSyncedOperationId']=_0xcbacfb['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x26617d=>!_0x26ee8f['includes'](_0x26617d));for(const _0x3f8515 of _0x26ee8f)_0x3f8515['createdAt']='lastOperationAcceptedAt'in _0xcbacfb&&_0xcbacfb['lastOperationAcceptedAt']||void 0x0;Y(_0x26ee8f,_0xcbacfb['version']-_0x26ee8f['length']),this['_updateServerHistory'](_0x26ee8f);const _0x3e20c3=_0x26ee8f['filter'](_0x978c67=>{if(!_0x978c67['_isInit'])return!0x1;const _0x36cfde=this['_getAffectedRoot'](_0x978c67);return _0x36cfde&&!this['_knownRootNames']['has'](_0x36cfde);});Y(_0x3e20c3,this['_document']['version']),this['_applyOperationsSet'](_0x3e20c3),_0x598a46=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0x376835=this['_decompressOperations'](_0xcbacfb['data'],_0xcbacfb['metadata'])['filter'](_0x22c27a=>_0x22c27a['baseVersion']>=this['_lastServerVersion']);_0x376835['forEach'](_0x1bf655=>this['_addKnownRoot'](_0x1bf655)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x32ce34=>!_0x32ce34['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x32ce34))),this['_bufferedOperations']['length']&&Y(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0x376835),_0x598a46=this['_handleExternalOperations'](_0x376835,_0xcbacfb['version'],_0xcbacfb['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x598a46?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}['_handleExternalOperations'](_0x5761cc,_0x32744e,_0x351913){try{const _0x5c9bdf={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x5d8907,operationsB:_0x134d2f,originalOperations:_0x1dd455}=_0x31ad0e(_0x5761cc,this['_bufferedOperations'],_0x5c9bdf);Y(_0x5d8907,this['_document']['version']),Y(_0x134d2f,_0x32744e);for(const _0x1135ff of _0x5d8907){const _0x20d4fb=_0x1dd455['get'](_0x1135ff);_0x1135ff['_authorId']=_0x20d4fb?_0x20d4fb['_authorId']:null;}_0x351913&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x5761cc,_0x351913),this['_lastSyncedOperationId']=_0x351913),this['_bufferedOperations']=[..._0x134d2f],this['_applyOperationsSet'](_0x5d8907),this['_updateServerHistory'](_0x5761cc);}catch(_0x3be95e){return console['error'](_0x3be95e),!0x1;}return!0x0;}['_applyOperationsSet'](_0x1ad799,_0x6fddd4=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0x39848d=>{for(const _0x3b4611 of _0x1ad799)this['_knownOperations']['add'](_0x3b4611),this['_addKnownRoot'](_0x3b4611),_0x39848d['batch']['addOperation'](_0x3b4611),this['editor']['model']['applyOperation'](_0x3b4611);});}['_addKnownRoot'](_0x4b7a73){const _0x1d5956=this['_getAffectedRoot'](_0x4b7a73);_0x1d5956&&this['_knownRootNames']['add'](_0x1d5956);}['_getAffectedRoot'](_0x1735c9){let _0x5d3d65,_0x390316;switch(_0x1735c9['type']){case'insert':_0x5d3d65=_0x1735c9['position']['root'];break;case'marker':if(_0x390316=_0x1735c9['newRange'],!_0x390316)return null;_0x5d3d65=_0x390316['root'];break;case'addRootAttribute':_0x5d3d65=_0x1735c9['root'];break;case'addRoot':_0x5d3d65=_0x1735c9['affectedSelectable'];break;case'move':_0x5d3d65=_0x1735c9['targetPosition']['root'];break;default:return null;}return _0x5d3d65['rootName'];}['_updateServerHistory'](_0x5c5a16){_0x5c5a16['forEach'](_0xabc812=>{const _0x2106e8=_0xabc812['clone']();_0x2106e8['_authorId']=_0xabc812['_authorId'],_0x2106e8['_isInit']=!!_0xabc812['_isInit'],_0x2106e8['createdAt']=_0xabc812['createdAt'],_0x2106e8['baseVersion']+=this['_offset'],_0xabc812['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x2106e8),this['serverHistory']['addOperation'](_0x2106e8);});}['_handleReconnectionError'](_0x21d587){const _0x5ab6a5=this['editor']['plugins']['get']('Notification'),_0x5c2625=this['editor']['locale'];_0x21d587||(_0x21d587=$(_0x5c2625,'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.')),_0x5ab6a5['showWarning'](_0x21d587,{'title':$(_0x5c2625,'Synchronization\x20issue'),'namespace':'real-time-collaboration'}),this['_hasSynchronizationProblem']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_bufferedOperations']=[],this['editor']['plugins']['get'](n)['disconnect']();}['_setPendingAction'](){this['_pendingAction']||(this['_pendingAction']=this['editor']['plugins']['get'](_0x3e4bfe)['add']($(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}['_clearPendingAction'](){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x3e4bfe)['remove'](this['_pendingAction']),this['_pendingAction']=null);}['_compressOperations'](_0x3dd214){const _0x3e9e52=_0x3dd214['map'](_0x5bc2a3=>_0x5bc2a3['toJSON']());return this['_compressor']['compress'](_0x3e9e52);}['_decompressOperations'](_0x5c8ffe,_0x2439e5){return this['_compressor']['decompress'](_0x5c8ffe)['map']((_0x5d103b,_0x2b3533)=>{const _0x355a18='init'==_0x2439e5[_0x2b3533]['type'];if('InsertOperation'==_0x5d103b['__className']){const _0x50d89d=_0x5d103b['position']['root'];!this['_document']['getRoot'](_0x50d89d)&&(this['_document']['createRoot']('$root',_0x50d89d)['_isAttached']=!0x1);}const _0x45704b=_0xcfa427['fromJSON'](_0x5d103b,this['_document']);return _0x45704b['wasUndone']=_0x5d103b['wasUndone'],_0x45704b['_isInit']=_0x355a18,_0x45704b['_authorId']=_0x355a18?null:_0x2439e5[_0x2b3533]['userId'],_0x45704b['_isDisconnection']='cs:removeUser'===_0x2439e5[_0x2b3533]['type'],_0x45704b['createdAt']=_0x2439e5[_0x2b3533]['createdAt'],_0x45704b;});}['_refreshUserSelectionMarkers'](){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}['_shouldSendSelectionUpdate'](){const _0x2456d1=this['editor']['plugins']['get'](i)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0x2456d1&&_0x2456d1['length']>0x1&&this['_hasSelectionChanged'];}['_shouldSendUpdate'](){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}}class X extends Error{}function Y(_0x6fd525,_0x38cdab){for(const _0x498de4 of _0x6fd525)_0x498de4['baseVersion']=_0x38cdab++;}class Z{['_ignoredOperations'];['_operationToId'];constructor(_0x2770d5){this['_ignoredOperations']=_0x2770d5,this['_operationToId']=new WeakMap();}['getIdOfTheLastOperation'](_0x3ae66f){let _0x480e36=_0x3ae66f['length'];for(;_0x480e36--;){const _0x400b6a=_0x3ae66f[_0x480e36];if(!this['_ignoredOperations']['has'](_0x400b6a)){if(!this['_operationToId']['has'](_0x400b6a)){const _0x481a4d=_0xc06c50()['slice'](0x1,0x12);this['_operationToId']['set'](_0x400b6a,_0x481a4d);}return this['_operationToId']['get'](_0x400b6a);}}}['setIdForTheLastOperation'](_0x480956,_0x40a7f8){if(!_0x40a7f8)return;let _0x45644d=_0x480956['length'];for(;_0x45644d--;){const _0x1279bf=_0x480956[_0x45644d];this['_ignoredOperations']['has'](_0x1279bf)||this['_operationToId']['set'](_0x1279bf,_0x40a7f8);}}}class a extends _0x5543a5{static get['requires'](){return[l];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class s extends _0x3037e3{static ['CommentsService']=/* #__PURE__ -- @preserve */ ((()=>_0x42707b)());['_services'];static get['requires'](){return[n,'CommentsRepository',i,_0x222559];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x1dcf34){super(_0x1dcf34),this['_services']=new Map();}async['init'](){const _0x23eddb=this['context'],_0x363dd3=_0x23eddb['plugins']['get']('CommentsRepository');if(_0x23eddb['plugins']['get'](n)['addToReconnectionStack'](this),_0x363dd3['adapter']={'addCommentThread':async({channelId:_0x289b53,threadId:_0x5c5c8a,comments:_0x1d8331,resolvedAt:_0x228716,resolvedBy:_0x13996a,context:_0x39be1b,attributes:_0x704b99})=>{const _0x1c81ec=await this['_getService'](_0x289b53)['addCommentThread']({'commentThreadId':_0x5c5c8a,'comments':_0x1d8331['map'](_0x54d061=>function(_0x52eed5,_0x4f115a,_0x1431d1){return{'commentThreadId':_0x1431d1,'commentId':_0x52eed5['commentId'],'userId':_0x52eed5['authorId'],'content':_0x52eed5['content'],'documentId':_0x4f115a,'createdAt':_0x52eed5['createdAt'],'attributes':_0x52eed5['attributes']||{}};}(_0x54d061,_0x289b53,_0x5c5c8a)),'resolvedAt':_0x228716,'resolvedBy':_0x13996a,'context':_0x39be1b,'attributes':_0x704b99})['catch'](at);return{'threadId':_0x1c81ec['commentThreadId'],'comments':_0x1c81ec['comments']};},'getCommentThread':async({channelId:_0x5a20b4,threadId:_0x480529})=>{const _0x5ba55=await this['_getService'](_0x5a20b4)['getCommentThread'](_0x480529)['catch'](at);return _0x5ba55['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0x5ba55]),{'threadId':_0x5ba55['commentThreadId'],'comments':_0x5ba55['comments']['map'](B),'context':_0x5ba55['context'],'resolvedAt':_0x5ba55['resolvedAt'],'resolvedBy':_0x5ba55['resolvedBy'],'attributes':_0x5ba55['attributes']||{}});},'updateCommentThread':async({channelId:_0x5c3d98,threadId:_0x42a421,context:_0x252608,unlinkedAt:_0x5ddf68,attributes