@ckeditor/ckeditor5-real-time-collaboration 47.6.0-alpha.3 → 47.6.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/real-time-collaboration.js +1 -1
- package/dist/index.js +6 -6
- package/package.json +14 -14
- package/src/presencelist/view/presencedropdownlistview.js +1 -1
- package/src/presencelist/view/presenceinlinelistview.js +1 -1
- package/src/realtimecollaborativeediting/realtimecollaborationclient.js +2 -2
- package/src/realtimecollaborativeediting/websocketgateway.js +2 -2
- package/src/realtimecollaborativerevisionhistory/cloudservicesrevisionhistoryadapter.js +2 -2
- package/src/realtimecollaborativetrackchanges/cloudservicestrackchangesadapter.js +2 -2
package/dist/index.js
CHANGED
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
import{ContextPlugin as
|
|
24
|
-
((()=>rt)());static ['initialReconnectionInterval']=0x3e8;['connection'];['_reconnectionStack'];['_shouldPluginsReconnect'];['_domEmitter'];static get['requires'](){return['CloudServices',_0x378c13];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x1f72e5){super(_0x1f72e5),this['set']('state',_0xe66aa2['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=new(_0x28936a())();}['init'](){const _0x45ab72=this['context'],_0x30e9df=_0x45ab72['plugins']['get']('CloudServices'),_0x315b60=_0x45ab72['plugins']['get'](_0x378c13);if(!_0x30e9df['token'])throw new _0x1bac20('websocketgateway-missing-token',this);if(!_0x30e9df['webSocketUrl'])throw new _0x1bac20('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'](_0x30e9df['token'],_0x30e9df['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0x56c993=>{if(this['connection']=_0x56c993,this['bind']('state')['to'](_0x56c993,'state',this,'_isBrowserOffline',(_0x418536,_0x5e70dc)=>('connected'!==_0x418536&&(this['_shouldPluginsReconnect']=!0x0),_0x5e70dc||_0x418536!==_0xe66aa2['CONNECTED']?_0xe66aa2['DISCONNECTED']:this['state']==_0xe66aa2['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),_0xe66aa2['CONNECTING']):_0xe66aa2['CONNECTED'])),this['connection']['on']('error',(_0x306529,_0x209b0c)=>{if('limitExceeded'!==_0x209b0c['code'])throw console['error'](_0x209b0c),new _0x1bac20('cloudservices-init',null,{'originalError':_0x209b0c});_0x315b60['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'});}),!_0x56c993['me'])return new Promise(_0x3f1734=>_0x56c993['on']('change:me',_0x3f1734));})['catch'](_0x2e89a9=>{throw console['error'](_0x2e89a9),new _0x1bac20('cloudservices-init',null,{'originalError':_0x2e89a9});});}['addToReconnectionStack'](_0x212808){if('function'!=typeof _0x212808['reconnect'])throw new _0x1bac20('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0x212808))throw new _0x1bac20('websocketgateway-plugin-already-registered',this,{'name':_0x212808['constructor']['pluginName']});this['_reconnectionStack']['add'](_0x212808);}['removeFromReconnectionStack'](_0xa3b68b){this['_reconnectionStack']['delete'](_0xa3b68b);}['isInReconnectionStack'](_0x1f2a26){return this['_reconnectionStack']['has'](_0x1f2a26);}['_reconnect'](){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0x58ea65=>_0x58ea65['reconnect']())))['then'](()=>this['state']=_0xe66aa2['CONNECTED'])['catch'](_0x5d96c0=>{throw console['error'](_0x5d96c0),new _0x1bac20('cloudservices-reconnection-error',this['context']);});}['disconnect'](){this['connection']&&this['connection']['disconnect'](),this['state']=_0xe66aa2['DISCONNECTED'],this['_domEmitter']['stopListening']();}['destroy'](){this['disconnect'](),super['destroy']();}}class i extends _0x3a23a9{['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,_0x1ebdaa];}constructor(_0x5e7741){super(_0x5e7741),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0x16299e(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x1ebdaa);}['init'](){const _0x1eced5=this['context']['plugins']['get'](n);this['listenTo'](_0x1eced5,'change:state',(_0x5bd69c,_0x14c100,_0x351743)=>{if('connected'!==_0x351743)this['channelSessions']['forEach'](_0x5318df=>_0x5318df['clear']()),this['channelConnectedUsers']['forEach'](_0x2ce2ff=>_0x2ce2ff['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x24b045,_0x421208]of this['_registeredSessions'])for(const _0x42a68f of _0x421208)this['_handleSessionAdd'](_0x24b045,_0x42a68f);}}),this['_createUser'](_0x1eced5['connection']['me'],!0x0);}['register'](_0x5e3fa7,_0x69de10){if(this['_registeredSessions']['has'](_0x5e3fa7))throw new _0x1bac20('sessions-register-already-registered',null,{'channelId':_0x5e3fa7});this['_registeredSessions']['set'](_0x5e3fa7,_0x69de10),this['channelSessions']['set'](_0x5e3fa7,new _0x16299e()),this['channelConnectedUsers']['set'](_0x5e3fa7,new _0x16299e()),this['listenTo'](_0x69de10,'add',(_0xa6ced3,_0x5205bc)=>this['_handleSessionAdd'](_0x5e3fa7,_0x5205bc)),this['listenTo'](_0x69de10,'remove',(_0x480c32,_0x3eec02)=>this['_handleSessionRemove'](_0x5e3fa7,_0x3eec02));for(const _0x11ec16 of _0x69de10)this['_handleSessionAdd'](_0x5e3fa7,_0x11ec16);}['unregister'](_0x4bb8a1){if(!this['_registeredSessions']['has'](_0x4bb8a1))throw new _0x1bac20('sessions-unregister-not-exist',null,{'channelId':_0x4bb8a1});const _0x820026=this['_registeredSessions']['get'](_0x4bb8a1);this['stopListening'](_0x820026);for(const _0x59733e of _0x820026)'connected'===this['context']['plugins']['get'](n)['state']&&this['_handleSessionRemove'](_0x4bb8a1,_0x59733e);this['_registeredSessions']['delete'](_0x4bb8a1),this['channelSessions']['delete'](_0x4bb8a1),this['channelConnectedUsers']['delete'](_0x4bb8a1);}get['mySessionId'](){return this['context']['plugins']['get'](n)['connection']['sessionId'];}['getUserBySessionId'](_0x401edd){for(const _0x1a19b8 of this['channelSessions']['values']())for(const _0x10e6d1 of _0x1a19b8)if(_0x10e6d1['id']===_0x401edd)return _0x10e6d1['user'];}['getUserSessions'](_0x7ac79c,_0x3b8216){const _0xb92a95=_0x3b8216?[this['channelSessions']['get'](_0x3b8216)]:this['channelSessions']['values'](),_0xca48ef=new Set();for(const _0x5a6399 of _0xb92a95)for(const _0x77760e of _0x5a6399)_0x77760e['user']['id']===_0x7ac79c['id']&&_0xca48ef['add'](_0x77760e['id']);return _0xca48ef;}['getUserRole'](_0x80bf7e){for(const _0x2a3a4b of this['channelSessions']['values']())for(const _0x365127 of _0x2a3a4b)if(_0x365127['user']===_0x80bf7e)return _0x365127['role'];}['_handleSessionAdd'](_0xdd9c36,_0xca730c){if('connected'!==this['context']['plugins']['get'](n)['state'])return;const _0x52ac0f=_0xca730c['user'],_0x140acb=this['_users']['getUser'](_0x52ac0f['id'])||this['_createUser'](_0x52ac0f),_0x4e29b7=Object['assign']({},_0xca730c,{'user':_0x140acb});if(this['channelSessions']['get'](_0xdd9c36)['add'](_0x4e29b7),!_0x52ac0f['hiddenInPresenceList']){const _0x527f68=this['channelConnectedUsers']['get'](_0xdd9c36);_0x527f68['has'](_0x140acb['id'])||_0x527f68['add'](_0x140acb),this['allConnectedUsers']['has'](_0x140acb['id'])||_0x52ac0f['hiddenInPresenceList']||this['allConnectedUsers']['add'](_0x140acb,_0x140acb['isMe']?0x0:void 0x0);}this['fire']('sessionAdd:'+_0xdd9c36,{'channelId':_0xdd9c36,'session':_0x4e29b7});}['_handleSessionRemove'](_0x5b38a0,_0x556b5e){if('connected'!==this['context']['plugins']['get'](n)['state'])return;const _0xd19b36=this['channelConnectedUsers']['get'](_0x5b38a0),_0x28f769=_0x556b5e['user'];_0x28f769['id']&&(this['channelSessions']['get'](_0x5b38a0)['remove'](_0x556b5e['id']),_0xd19b36['has'](_0x28f769['id'])&&!this['getUserSessions'](_0x28f769,_0x5b38a0)['size']&&_0xd19b36['remove'](_0x28f769['id']),this['allConnectedUsers']['get'](_0x28f769['id'])&&!this['getUserSessions'](_0x28f769)['size']&&this['allConnectedUsers']['remove'](_0x28f769['id']));}['_createUser'](_0x521eed,_0x13f4ab){const _0x1abe99=this['_users']['addUser'](_0x521eed);return _0x13f4ab&&this['_users']['defineMe'](_0x521eed['id']),_0x1abe99['orderNumber']=this['_uniqueUsersCount']++,_0x1abe99;}}class $ extends _0x1e727b{['_domEmitter']=new(_0x28936a())();static get['requires'](){return[i];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x3344cb=this['editor'],_0x1f0842=_0x3344cb['plugins']['get'](i);_0x3344cb['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x527637,{writer:_0x156b41})=>function(_0x42ce23,_0x5b0a54,_0x2a4755,_0x57b3a8){const _0x4c86eb=_0x42ce23['markerName']['split'](':')[0x2],_0xb15fc=_0x2a4755['getUserBySessionId'](_0x4c86eb);if(!_0xb15fc||_0x4c86eb===_0x2a4755['mySessionId'])return;if(!_0x57b3a8['model']['schema']['checkChild'](_0x42ce23['markerRange']['start'],'$text'))return;const _0x31e9bc={'class':'ck-user__marker\x20'+_0xb15fc['color']['getMarkerClass'](),'data-name':_0xb15fc['name'],'data-session-id':_0x4c86eb},_0x548fc3=_0x57b3a8['model']['markers']['get'](_0x42ce23['markerName']),_0x29f58f=_0x548fc3['getStart'](),_0x2cb58a=_0x29f58f['nodeAfter'],_0x238631=_0x57b3a8['model']['schema'];if(_0x2cb58a&&_0x238631['isObject'](_0x2cb58a)&&_0x238631['isInline'](_0x2cb58a)&&!_0x57b3a8['model']['markers']['get']('user:range:'+_0x4c86eb)['getRange']()['isCollapsed'])return;const _0x17db23=_0x29f58f['parent'];return _0x57b3a8['model']['schema']['isLimit'](_0x17db23)&&!_0x57b3a8['model']['hasContent'](_0x17db23)&&(_0x31e9bc['contenteditable']=!0x1),function(_0x105b51,_0x4c68e2,_0x3e565b){const _0x15b6b3=_0x105b51['createUIElement']('span',_0x4c68e2);return _0x105b51['setCustomProperty']('userPositionMarker',!0x0,_0x15b6b3),_0x15b6b3['render']=function(_0x54584d){const _0x755515=this['toDomElement'](_0x54584d),_0x4a6df3=document['createElement']('span');return _0x4a6df3['classList']['add']('ck-user__marker-tooltip'),_0x4a6df3['setAttribute']('contenteditable','false'),_0x4a6df3['setAttribute']('spellcheck','false'),_0x4a6df3['textContent']=_0x3e565b['name'],_0x755515['innerHTML']='<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span>'+_0x4a6df3['outerHTML']+'',_0x755515['addEventListener']('mouseenter',()=>{_0x755515['classList']['add']('ck-user__marker_hovered');}),_0x755515['addEventListener']('mouseleave',()=>{_0x755515['classList']['remove']('ck-user__marker_hovered');}),_0x755515;},_0x15b6b3['isSimilar']=function(_0x315321){return!(!this['getCustomProperty']('userPositionMarker')||!_0x315321['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0x315321['getAttribute']('data-session-id'));},_0x15b6b3;}(_0x5b0a54,_0x31e9bc,_0xb15fc);}(_0x527637,_0x156b41,_0x1f0842,_0x3344cb)}),_0x3344cb['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0x4802d5=>function(_0x290392,_0x1b0887){const _0x47ac04=_0x290392['markerName']['split'](':')[0x2];if(_0x47ac04===_0x1b0887['mySessionId'])return null;const _0x4476fe=_0x1b0887['getUserBySessionId'](_0x47ac04);if(!_0x4476fe)return{'id':_0x47ac04,'classes':[]};return{'id':_0x47ac04,'classes':['ck-user__selection',_0x4476fe['color']['getSelectionClass']()],'attributes':{'data-session-id':_0x47ac04},'priority':0x7d0+_0x4476fe['orderNumber']};}(_0x4802d5,_0x1f0842)}),function(_0x160fd2){const _0x302c0a=_0x160fd2['model'],_0x7c6a97=new Map(),_0x1711ae=_0x160fd2['plugins']['get'](i);_0x302c0a['markers']['on']('update:user:range',(_0x1a2731,_0x2a57dc,_0x1687d9,_0x24743f)=>{if(!_0x24743f&&_0x7c6a97['get'](_0x2a57dc['name']))return _0x7c6a97['get'](_0x2a57dc['name'])['detach'](),void _0x7c6a97['delete'](_0x2a57dc['name']);const _0x289404=_0x2a57dc['name']['split'](':')[0x2];if(_0x289404===_0x1711ae['mySessionId'])return;const _0x1c9549='user:position:'+_0x289404;_0x302c0a['markers']['has'](_0x1c9549)&&_0x160fd2['editing']['reconvertMarker'](_0x1c9549),_0x2a57dc['on']('change:range',(_0x5c214f,_0x354f02,_0x3203e7)=>{if('$graveyard'!=_0x354f02['root']['rootName']&&'$graveyard'==_0x2a57dc['getRange']()['root']['rootName']&&!_0x7c6a97['has'](_0x2a57dc['name'])){const _0x20de92=_0x302c0a['schema']['getNearestSelectionRange'](_0x3203e7['deletionPosition']);if(_0x20de92){const _0x176673=_0x3639b9['fromRange'](_0x20de92);_0x7c6a97['set'](_0x2a57dc['name'],_0x176673),_0x176673['on']('change:range',(_0x31fe54,_0x543bcd,_0x43320c)=>{if('$graveyard'==_0x176673['root']['rootName']){const _0x25a4bc=_0x302c0a['schema']['getNearestSelectionRange'](_0x43320c['deletionPosition']);_0x25a4bc?(_0x176673['start']=_0x25a4bc['start'],_0x176673['end']=_0x25a4bc['end']):(_0x7c6a97['delete'](_0x2a57dc['name']),_0x176673['detach']());}});}}});}),_0x302c0a['document']['on']('change',()=>{_0x7c6a97['size']>0x0&&_0x302c0a['enqueueChange']({'isUndoable':!0x1},_0x3bcb87=>{for(const [_0x2cca4d,_0x1d5ab3]of _0x7c6a97)'$graveyard'==_0x302c0a['markers']['get'](_0x2cca4d)['getRange']()['root']['rootName']&&(te(_0x2cca4d['split'](':')[0x2],_0x1d5ab3['toRange'](),_0x302c0a,_0x3bcb87),_0x1d5ab3['detach']());_0x7c6a97['clear']();});});}(_0x3344cb),this['_domEmitter']['listenTo'](_0x4e4909['document'],'keydown',(_0x15a9ab,{key:_0x378727})=>{'Escape'===_0x378727&&function(_0x12705c){_0x12705c['editing']['view']['change'](_0xea72fc=>{for(const _0x49b31d of _0x12705c['model']['markers']){if(!_0x49b31d['name']['startsWith']('user:position'))continue;const _0x35f052=_0x12705c['editing']['mapper']['markerNameToElements'](_0x49b31d['name']);if(_0x35f052){for(const _0x250472 of _0x35f052)_0xea72fc['removeClass']('ck-user__marker_hovered',_0x250472);}}});}(_0x3344cb);},{'useCapture':!0x0});}['afterInit'](){const _0x153aa3=this['editor'],_0xed4399=_0x153aa3['commands']['get']('undo');_0xed4399&&_0x153aa3['model']['on']('applyOperation',(_0x12f4ee,_0x30445f)=>{const _0x52c576=_0x30445f[0x0];if(!_0x52c576['isDocumentOperation'])return;if('marker'!=_0x52c576['type']||!_0x52c576['name']['startsWith']('user:'))return;const _0x2e9635=_0x52c576['batch'];_0xed4399['_createdBatches']['has'](_0x2e9635)&&(_0x52c576['newRange']=_0x52c576['oldRange']?_0x153aa3['model']['createRange'](_0x52c576['oldRange']['start'],_0x52c576['oldRange']['end']):null);},{'priority':'highest'});}['destroy'](){return this['_domEmitter']['stopListening'](),super['destroy']();}['createUserMarkerOperations'](){const _0x3d79c0=this['editor'],_0x4c942f=_0x3d79c0['model']['document'],_0x42e146=_0x3d79c0['plugins']['get'](i);_0x3d79c0['model']['enqueueChange']({'isUndoable':!0x1},_0x4b59e6=>{const _0x1957c1='user:range:'+_0x42e146['mySessionId'],_0x24a2cf='user:position:'+_0x42e146['mySessionId'],_0x506006=_0x3d79c0['model']['markers']['has'](_0x1957c1);_0x3d79c0['editing']['view']['hasDomSelection']?te(_0x42e146['mySessionId'],_0x4c942f['selection']['getFirstRange'](),_0x3d79c0['model'],_0x4b59e6):_0x506006&&(_0x4b59e6['removeMarker'](_0x1957c1),_0x4b59e6['removeMarker'](_0x24a2cf));});}}function te(_0x5e440b,_0x232910,_0x484a19,_0x5159af){const _0x17fef1='user:range:'+_0x5e440b,_0x50621c='user:position:'+_0x5e440b,_0x12dde8=_0x232910['getContainedElement']();let _0x3abecb=_0x232910['start'];if(_0x12dde8&&_0x12dde8['is']('element','tableCell')){const _0x5822ea=function(_0x4c48dd,_0x31e1ba){for(const _0x200dc4 of _0x4c48dd['getPositions']())if(_0x31e1ba['schema']['checkChild'](_0x200dc4,'$text'))return _0x200dc4;}(_0x232910,_0x484a19);_0x5822ea&&(_0x3abecb=_0x5822ea,_0x232910=_0x5159af['createRange'](_0x3abecb));}const _0x2eae4c=_0x5159af['createRange'](_0x3abecb);_0x484a19['markers']['has'](_0x17fef1)?(_0x5159af['updateMarker'](_0x17fef1,{'range':_0x232910}),_0x5159af['updateMarker'](_0x50621c,{'range':_0x2eae4c})):(_0x5159af['addMarker'](_0x17fef1,{'range':_0x232910,'usingOperation':!0x0}),_0x5159af['addMarker'](_0x50621c,{'range':_0x2eae4c,'usingOperation':!0x0}));}function K(_0x1ab162,_0x35f803,_0x423cef){const _0x468040=_0x1ab162['t'],t=_0x1ab162['t'];switch(_0x35f803){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 _0x468040({'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'},_0x423cef);default:return'';}}let X=0x1;class l extends _0x1e727b{static ['CollaborativeEditingService']=/* #__PURE__ -- @preserve */
|
|
25
|
-
((()=>_0x5330c1)());['_offset'];['sessionId'];['serverHistory'];['_channelId'];['_service'];['_document'];['_compressor'];['_bufferedOperations'];['_knownOperations'];['_knownRootNames'];['_pendingAction'];['_hasSelectionChanged'];['_sendBufferedOperationsDelayId'];['_baseBufferDelay'];['_currentBufferDelay'];['_lastSyncedOperationId'];['_disconnectionOperations'];['_operationIdentifier'];static get['requires'](){return[n,i,$,_0xb0f6ab,_0x1ebdaa,_0x378c13];}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 _0x42d423=this['serverHistory']['getOperations']();for(let _0x4954e5=_0x42d423['length']-0x1;_0x4954e5>=0x0;_0x4954e5--){const _0x1a6a28=_0x42d423[_0x4954e5];if(!this['_disconnectionOperations']['has'](_0x1a6a28))return _0x1a6a28['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0xbd0613){if(super(_0xbd0613),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x524f74(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0x1bac20('collaboration-missing-channelid',this);const _0x1d7c33=_0xbd0613['config']['get']('cloudServices.bundleVersion')||nt;this['_service']=new l['CollaborativeEditingService'](_0x1d7c33,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0x5bb2bf(),this['_bufferedOperations']=[],this['_knownOperations']=new WeakSet(),this['_knownRootNames']=new Set(),this['set']('_isPendingUpdate',!0x1),this['set']('_hasSynchronizationProblem',!0x1),this['_pendingAction']=null,this['_hasSelectionChanged']=!0x1,this['_sendBufferedOperationsDelayId']=null,this['_baseBufferDelay']=0x12c,this['_currentBufferDelay']=this['_baseBufferDelay'],this['_lastSyncedOperationId']=null,this['_disconnectionOperations']=new WeakSet(),this['_operationIdentifier']=new tt(this['_disconnectionOperations']);}['init'](){const _0x4d38f6=this['editor'],_0x337b59=_0x4d38f6['plugins']['get'](_0x1ebdaa),_0x316a5d=_0x4d38f6['plugins']['get'](n);this['listenTo'](_0x337b59,'getOperationAuthor',(_0x253209,_0x3382db)=>{const _0x2e5af2=_0x3382db[0x0];_0x2e5af2['_authorId']&&(_0x253209['return']=_0x337b59['getUser'](_0x2e5af2['_authorId']),_0x253209['stop']()),null===_0x2e5af2['_authorId']&&(_0x253209['return']=null,_0x253209['stop']());},{'priority':'high'}),this['listenTo'](_0x4d38f6['model']['document']['selection'],'change:range',(_0x440e1f,_0x3fd77a)=>{_0x3fd77a['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x4d38f6['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x4d38f6['model']['on']('applyOperation',(_0x286d31,_0x23cfca)=>{const _0x4286e6=_0x23cfca[0x0];_0x4286e6['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0x4286e6),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['bind']('_isEditingAllowed')['to'](_0x316a5d,'state',this,'_hasSynchronizationProblem',(_0x3d85fd,_0x29624a)=>'connected'===_0x3d85fd&&!_0x29624a),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x4d38f6['disableReadOnlyMode']('rtc-offline'):_0x4d38f6['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x4d38f6['disableReadOnlyMode']('rtc-offline'):_0x4d38f6['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async['reconnect'](){const _0x1a2bad=this['editor']['plugins']['get'](i),_0x11b496=this['editor']['plugins']['get'](n);try{this['_isPendingUpdate']=!0x0,_0x1a2bad['unregister'](this['_channelId']);const _0x183986=await this['_service']['reconnect'](_0x11b496['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0x183986)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x21fd86=await this['_service']['getConnectedSessions']();_0x1a2bad['register'](this['_channelId'],_0x21fd86),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x104dc2){if(function(_0x5cdd6a){return'404'===_0x5cdd6a['code'];}(_0x104dc2)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0x311335){return'409'===_0x311335['code'];}(_0x104dc2)){const _0x556a81=K(this['editor']['locale'],'The\x20document\x20cannot\x20be\x20connected\x20back\x20to\x20the\x20server.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.');this['_handleReconnectionError'](_0x556a81);}else{if(!(_0x104dc2 instanceof Y))throw _0x104dc2;this['_handleReconnectionError']();}}}}['destroy'](){const _0x417c09=this['editor']['plugins']['get'](n),_0x251e02=this['editor']['plugins']['get'](i);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x251e02['channelSessions']['has'](this['_channelId'])&&_0x251e02['unregister'](this['_channelId']),_0x417c09['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async['_handleReconnectionResponse'](_0x338d3a){if(this['sessionId']!==_0x338d3a['sessionId']&&this['_lastSyncedOperationId']!==_0x338d3a['lastOperationId'])throw new Y();return this['sessionId']=_0x338d3a['sessionId'],this['_handleServerResponse']([],{..._0x338d3a,'wereChangesApplied':!0x1,'data':_0x338d3a['data']},'reconnect');}async['_connectService'](_0x44ec26,_0x2a2b75=!0x1){const {connection:_0x2b552a}=this['editor']['plugins']['get'](n);l['CollaborativeEditingService']['getConnectedSessions'](_0x2b552a,this['_channelId'])['then'](_0xdb0e9=>this['_initSessionsHandling'](_0xdb0e9))['catch'](_0x5e25a3=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x5e25a3);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x40e3f6,_0x4452e8)=>{this['_crash']('realtimecollaborationclient-init-service-internal-error',_0x4452e8);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_isConnected']=!0x1;});const _0x44c5a2=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x44ec26);this['_isPendingUpdate']=!0x0;const _0x49db10=await this['_service']['connect'](_0x2b552a,this['_compressOperations'](_0x44ec26),_0x44c5a2);if(this['sessionId']=_0x49db10['sessionId'],_0x2a2b75){if(!_0x49db10['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x49db10['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0x44ec26,_0x49db10,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x49db10,_0x44ec26);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}['_handleSendingSelectionMarkers'](){const _0x336edf=this['editor']['plugins']['get'](i),_0x31b966=this['editor']['plugins']['get']($),_0x2e2678=_0x336edf['channelSessions']['get'](this['_channelId']);_0x2e2678&&_0x2e2678['length']>0x1?_0x31b966['createUserMarkerOperations']():this['listenTo'](_0x336edf,'sessionAdd:'+this['_channelId'],()=>{0x2===_0x336edf['channelSessions']['get'](this['_channelId'])['length']&&_0x31b966['createUserMarkerOperations']();});}async['_handleReceivedOperations'](_0x10ffa6,_0x146302,_0x2d3722,_0x46d08a){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x146302){const _0x820f8=this['_decompressOperations'](_0x2d3722,_0x46d08a);await this['_fetchMissingUsers'](_0x820f8),this['_handleExternalOperations'](_0x820f8,_0x146302,_0x2d3722['lastOperationId'])||this['_crash']('realtimecollaborationclient-init-service-incorrect-server-operation');}}async['_connectAfterSessionHasBeenFlushed'](){this['_disconnectService']();const {locale:_0x22a93c}=this['editor'];let _0x10be4e;try{_0x10be4e=await this['_service']['getDocumentDetails']();}catch{const _0x5533e3=K(_0x22a93c,'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'](_0x5533e3);}const _0x2f0b35=_0x10be4e['currentDocumentSession']||_0x10be4e['lastDocumentSession'];if(this['_lastSyncedOperationId']!==_0x2f0b35['lastOperationId']){const _0x12c544=K(_0x22a93c,'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'](_0x12c544);}await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);}['_disconnectService'](){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['stopListening'](this['_service']);}['_initSessionsHandling'](_0x5eecf4){const _0x5abe5f=this['editor']['plugins']['get'](i);this['listenTo'](_0x5abe5f,'sessionAdd:'+this['_channelId'],(_0x1d4473,{session:_0x48eb57})=>{if(_0x48eb57['id']===_0x5abe5f['mySessionId']){_0x1d4473['off']();const _0x403593=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0x153d2a=_0x48eb57['permissions'];_0x403593&&_0x403593['isEnabled']&&(_0x153d2a=_0x153d2a['filter'](_0x133910=>'document:write'!==_0x133910)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0x153d2a,this['_channelId']);}}),_0x5abe5f['register'](this['_channelId'],_0x5eecf4);}['_initThrowingOnDataSet'](){const _0x19b385=this['editor']['data']['set'];this['editor']['data']['set']=(..._0x4c1327)=>{if(!_0x4c1327[_0x4c1327['length']-0x1]['suppressErrorInCollaboration'])throw new _0x1bac20('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x19b385['apply'](this['editor']['data'],_0x4c1327);};}['_setUpDataInit'](){this['editor']['data']['on']('init',(_0x3ae0a5,[_0x3ee4f8])=>{if(this['_document']['version'])throw new _0x1bac20('realtimecollaborationclient-init-document-already-initialized',this);_0x3ae0a5['stop'](),this['_setPendingAction']();const _0x35e0fa=this['editor']['config']['get']('rootsAttributes'),_0xcdb650=this['_getOperationsFromInitData'](_0x3ee4f8,_0x35e0fa);0x0==_0xcdb650['length']&&_0xcdb650['push'](new _0x4af577(0x0)),_0x3ae0a5['return']=this['_connectService'](_0xcdb650)['then'](()=>{this['editor']['plugins']['get'](n)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x27aa17=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x27aa17))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0xc149d3,[_0x4d204c,_0x109876])=>{_0xc149d3['stop']();const _0x311ee2=this['editor']['model']['document']['getRoot'](_0x4d204c);if(!this['_knownRootNames']['has'](_0x4d204c)){const _0x3a0ed6=_0x109876&&_0x109876['data']?_0x109876['data']:'',_0x2155cf=_0x109876&&_0x109876['attributes']?_0x109876['attributes']:{};await this['_loadRoot'](_0x4d204c,_0x3a0ed6,_0x2155cf);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0x311ee2['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0x311ee2);});},{'priority':'high'});}async['_fetchMissingUsers'](_0x522381){const _0x53e99f=this['editor']['plugins']['get'](_0x1ebdaa),{connection:_0x29e294}=this['editor']['plugins']['get'](n),_0x787de4=new Set();for(const _0x2d57f2 of _0x522381){const _0x385105=_0x2d57f2['_authorId'];_0x385105&&!_0x53e99f['getUser'](_0x385105)&&_0x787de4['add'](_0x385105);}if(0x0===_0x787de4['size'])return;const _0x2a8c39=await ct['getMany'](_0x29e294,Array['from'](_0x787de4));for(const _0x14bac2 of _0x2a8c39)_0x53e99f['getUser'](_0x14bac2['id'])||_0x53e99f['addUser'](_0x14bac2);}['_getOperationsFromInitData'](_0x9f6b23,_0x39f40c={}){const _0x3120f2=this['editor']['model'],_0x1cff7a=[];let _0x4a8447=0x0;const _0x286328='string'==typeof _0x9f6b23?{'main':_0x9f6b23}:_0x9f6b23;for(const _0xb14ae8 of Object['keys'](_0x286328)){if(!this['_document']['roots']['has'](_0xb14ae8))throw new _0x1bac20('realtimecollaborationclient-init-non-existent-root',this);const _0x30cccc=this['editor']['data']['parse'](_0x286328[_0xb14ae8]),_0x713181=this['_document']['getRoot'](_0xb14ae8),_0x1839c=new _0x3de77c(_0x3120f2['createPositionAt'](_0x713181,0x0),_0x30cccc,_0x4a8447++);_0x1cff7a['push'](_0x1839c);for(const [_0x34a22d,_0x53dbbb]of _0x30cccc['markers']){const _0x9293bf=_0x3120f2['createRange'](_0x3120f2['createPositionFromPath'](_0x713181,_0x53dbbb['start']['path']['slice']()),_0x3120f2['createPositionFromPath'](_0x713181,_0x53dbbb['end']['path']['slice']())),_0x264c37=new _0x52db84(_0x34a22d,null,_0x9293bf,_0x3120f2['markers'],!0x0,_0x4a8447++);_0x1cff7a['push'](_0x264c37);}}if(_0x39f40c)for(const [_0x4e0ee3,_0x22fac2]of Object['entries'](_0x39f40c)){const _0x209e97=_0x3120f2['document']['getRoot'](_0x4e0ee3);if(!_0x209e97)throw new _0x1bac20('multi-root-editor-root-attributes-no-root',null);for(const [_0x4f1eab,_0x8486b4]of Object['entries'](_0x22fac2))if(null!==_0x8486b4){const _0x25e4f8=new _0xcb2a2b(_0x209e97,_0x4f1eab,null,_0x8486b4,_0x4a8447++);_0x1cff7a['push'](_0x25e4f8);}}return _0x1cff7a;}async['_loadRoot'](_0x5a5b5a,_0x1a714b,_0x38804e){this['_getOperationsFromInitData']({[_0x5a5b5a]:_0x1a714b},{[_0x5a5b5a]:_0x38804e})['forEach']((_0x27e36c,_0x44a944)=>{_0x27e36c['baseVersion']=this['_document']['version']+_0x44a944,_0x27e36c['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x27e36c);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async['_handleInitialConnectionData'](_0x382897,_0x407b72){let _0x413ce8;this['_offset']=_0x382897['offset'];const _0x1d4902=_0x382897['wereChangesApplied']&&!_0x382897['initData'],_0x5ccfdd=_0x1d4902?0x0:_0x382897['data']['baseVersion'];if(_0x407b72['forEach'](_0x6e246=>{_0x6e246['_isInit']=!0x0,_0x6e246['createdAt']=_0x382897['sessionCreatedAt'],_0x6e246['_authorId']=null;}),_0x1d4902)_0x413ce8=_0x407b72,this['_applyOperationsSet'](_0x413ce8,_0x1d4902);else{if(_0x382897['initData']){const _0x20a779=this['_getOperationsFromInitData'](_0x382897['initData']);this['_document']['history']['version']=-_0x20a779['length'],_0x20a779['forEach'](_0x5db09f=>{_0x5db09f['baseVersion']-=_0x20a779['length'],_0x5db09f['createdAt']=_0x382897['sessionCreatedAt'],_0x5db09f['_isInit']=!0x0,_0x5db09f['_authorId']=null;}),this['_applyOperationsSet'](_0x20a779,!0x0),this['serverHistory']['version']=-_0x20a779['length']+this['_offset'],this['_updateServerHistory'](_0x20a779);}this['_document']['history']['version']=_0x5ccfdd,_0x413ce8=this['_decompressOperations'](_0x382897['data'],_0x382897['metadata']),await this['_fetchMissingUsers'](_0x413ce8),this['_applyOperationsSet'](_0x413ce8,_0x1d4902);}_0x382897['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x413ce8,_0x382897['lastOperationId']),this['_lastSyncedOperationId']=_0x382897['lastOperationId']),this['serverHistory']['version']=_0x5ccfdd+this['_offset'],this['_updateServerHistory'](_0x413ce8),_0x407b72['filter'](_0x4d460d=>{const _0x41c5ee=this['_getAffectedRoot'](_0x4d460d);return _0x41c5ee&&!this['_knownRootNames']['has'](_0x41c5ee);})['forEach']((_0x38c31a,_0x4704a1)=>{_0x38c31a['baseVersion']=this['_document']['version']+_0x4704a1,this['_saveOperationInBuffer'](_0x38c31a);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x204a10,_0x1037c8){const _0x169eac=_0x1037c8&&_0x1037c8['message'];if(_0x169eac&&_0x169eac['startsWith']('realtimecollaborationclient'))throw _0x1037c8;const _0x4bebc2=this['editor']['plugins']['get'](n);throw this['_isPendingUpdate']=!0x0,_0x4bebc2['disconnect'](),this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0x1bac20(_0x204a10,this['editor'],_0x169eac?{'originalError':_0x169eac}:void 0x0);}['_saveOperationInBuffer'](_0x1ad43a){this['_knownOperations']['has'](_0x1ad43a)||(this['_knownOperations']['add'](_0x1ad43a),this['_bufferedOperations']['push'](_0x1ad43a),this['_pendingAction']||'marker'==_0x1ad43a['type']&&!_0x1ad43a['affectsData']||this['_setPendingAction']());}['_sendBufferedOperationsDelayed'](_0x2b8a12=!0x1){!_0x2b8a12&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0xfc6c2c=>{_0xfc6c2c&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0x10d687=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0x544c47){return _0x544c47['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x544c47['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0x544c47['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0x10d687)||this['_crash'](_0x10d687['message'],_0x10d687);});},this['_currentBufferDelay']));}['_waitUntilSynced'](){return new Promise(_0x5d4b10=>{this['on']('change:_isPendingUpdate',()=>{_0x5d4b10();});});}async['_sendBufferedOperations'](){const _0x56322a=this['editor']['plugins']['get']($);if(this['_shouldSendSelectionUpdate']()&&(_0x56322a['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x4a0278=[...this['_bufferedOperations']];for(const _0x58b63d of _0x4a0278)_0x58b63d['wasUndone']=this['_document']['history']['isUndoneOperation'](_0x58b63d);const _0x2bb73a=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x4a0278),_0x230c80=X++,_0x41baf1=this['_compressOperations'](_0x4a0278),_0x57769c=await this['_service']['sendOperations'](_0x41baf1,_0x41baf1['baseVersion'],_0x2bb73a);try{return await this['_handleServerResponse'](_0x4a0278,_0x57769c,_0x230c80);}catch(_0x1c0dea){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0x1c0dea);}}async['_handleServerResponse'](_0x4effd8,_0x5434e7,_0x42feb2){if('error'in _0x5434e7)throw _0x5434e7['error'];let _0x307fd8=!0x1;if(_0x5434e7['wereChangesApplied']){_0x5434e7['lastOperationId']&&(this['_lastSyncedOperationId']=_0x5434e7['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x4e8f77=>!_0x4effd8['includes'](_0x4e8f77));for(const _0x15c4f9 of _0x4effd8)_0x15c4f9['createdAt']='lastOperationAcceptedAt'in _0x5434e7&&_0x5434e7['lastOperationAcceptedAt']||void 0x0;Z(_0x4effd8,_0x5434e7['version']-_0x4effd8['length']),this['_updateServerHistory'](_0x4effd8);const _0x4f4d9f=_0x4effd8['filter'](_0x3dff0f=>{if(!_0x3dff0f['_isInit'])return!0x1;const _0x2bc605=this['_getAffectedRoot'](_0x3dff0f);return _0x2bc605&&!this['_knownRootNames']['has'](_0x2bc605);});Z(_0x4f4d9f,this['_document']['version']),this['_applyOperationsSet'](_0x4f4d9f),_0x307fd8=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0xcfe61=this['_decompressOperations'](_0x5434e7['data'],_0x5434e7['metadata'])['filter'](_0x526b99=>_0x526b99['baseVersion']>=this['_lastServerVersion']);_0xcfe61['forEach'](_0x4fac97=>this['_addKnownRoot'](_0x4fac97)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x40e397=>!_0x40e397['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x40e397))),this['_bufferedOperations']['length']&&Z(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0xcfe61),_0x307fd8=this['_handleExternalOperations'](_0xcfe61,_0x5434e7['version'],_0x5434e7['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x307fd8?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}['_handleExternalOperations'](_0x231d43,_0x58bc08,_0x4d9a8f){try{const _0x348550={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x3d21b9,operationsB:_0x180d81,originalOperations:_0x1938c1}=_0x57f823(_0x231d43,this['_bufferedOperations'],_0x348550);Z(_0x3d21b9,this['_document']['version']),Z(_0x180d81,_0x58bc08);for(const _0x37c1c9 of _0x3d21b9){const _0x1eb294=_0x1938c1['get'](_0x37c1c9);_0x37c1c9['_authorId']=_0x1eb294?_0x1eb294['_authorId']:null;}_0x4d9a8f&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x231d43,_0x4d9a8f),this['_lastSyncedOperationId']=_0x4d9a8f),this['_bufferedOperations']=[..._0x180d81],this['_applyOperationsSet'](_0x3d21b9),this['_updateServerHistory'](_0x231d43);}catch(_0x53dd8f){return console['error'](_0x53dd8f),!0x1;}return!0x0;}['_applyOperationsSet'](_0x612695,_0x3c25ce=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0x542147=>{for(const _0x470187 of _0x612695)this['_knownOperations']['add'](_0x470187),this['_addKnownRoot'](_0x470187),_0x542147['batch']['addOperation'](_0x470187),this['editor']['model']['applyOperation'](_0x470187);});}['_addKnownRoot'](_0x180d98){const _0x1a5ba7=this['_getAffectedRoot'](_0x180d98);_0x1a5ba7&&this['_knownRootNames']['add'](_0x1a5ba7);}['_getAffectedRoot'](_0x59137f){let _0x5cadb0,_0x641047;switch(_0x59137f['type']){case'insert':_0x5cadb0=_0x59137f['position']['root'];break;case'marker':if(_0x641047=_0x59137f['newRange'],!_0x641047)return null;_0x5cadb0=_0x641047['root'];break;case'addRootAttribute':_0x5cadb0=_0x59137f['root'];break;case'addRoot':_0x5cadb0=_0x59137f['affectedSelectable'];break;case'move':_0x5cadb0=_0x59137f['targetPosition']['root'];break;default:return null;}return _0x5cadb0['rootName'];}['_updateServerHistory'](_0x459638){_0x459638['forEach'](_0x18c634=>{const _0xc763b7=_0x18c634['clone']();_0xc763b7['_authorId']=_0x18c634['_authorId'],_0xc763b7['_isInit']=!!_0x18c634['_isInit'],_0xc763b7['createdAt']=_0x18c634['createdAt'],_0xc763b7['baseVersion']+=this['_offset'],_0x18c634['_isDisconnection']&&this['_disconnectionOperations']['add'](_0xc763b7),this['serverHistory']['addOperation'](_0xc763b7);});}['_handleReconnectionError'](_0xe6cbf){const _0x4104d6=this['editor']['plugins']['get']('Notification'),_0x38b06f=this['editor']['locale'];_0xe6cbf||(_0xe6cbf=K(_0x38b06f,'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.')),_0x4104d6['showWarning'](_0xe6cbf,{'title':K(_0x38b06f,'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'](_0xb0f6ab)['add'](K(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}['_clearPendingAction'](){this['_pendingAction']&&(this['editor']['plugins']['get'](_0xb0f6ab)['remove'](this['_pendingAction']),this['_pendingAction']=null);}['_compressOperations'](_0x26baff){const _0x463097=_0x26baff['map'](_0x47bc5f=>_0x47bc5f['toJSON']());return this['_compressor']['compress'](_0x463097);}['_decompressOperations'](_0x179e91,_0x352cd2){return this['_compressor']['decompress'](_0x179e91)['map']((_0x53e4f3,_0x164d96)=>{const _0x1427f5='init'==_0x352cd2[_0x164d96]['type'];if('InsertOperation'==_0x53e4f3['__className']){const _0x4517bc=_0x53e4f3['position']['root'];!this['_document']['getRoot'](_0x4517bc)&&(this['_document']['createRoot']('$root',_0x4517bc)['_isAttached']=!0x1);}const _0x52a93c=_0x28296d['fromJSON'](_0x53e4f3,this['_document']);return _0x52a93c['wasUndone']=_0x53e4f3['wasUndone'],_0x52a93c['_isInit']=_0x1427f5,_0x52a93c['_authorId']=_0x1427f5?null:_0x352cd2[_0x164d96]['userId'],_0x52a93c['_isDisconnection']='cs:removeUser'===_0x352cd2[_0x164d96]['type'],_0x52a93c['createdAt']=_0x352cd2[_0x164d96]['createdAt'],_0x52a93c;});}['_refreshUserSelectionMarkers'](){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}['_shouldSendSelectionUpdate'](){const _0x345277=this['editor']['plugins']['get'](i)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0x345277&&_0x345277['length']>0x1&&this['_hasSelectionChanged'];}['_shouldSendUpdate'](){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}}class Y extends Error{}function Z(_0xc908b9,_0x2ae4a5){for(const _0x18d3d3 of _0xc908b9)_0x18d3d3['baseVersion']=_0x2ae4a5++;}class tt{['_ignoredOperations'];['_operationToId'];constructor(_0x546c40){this['_ignoredOperations']=_0x546c40,this['_operationToId']=new WeakMap();}['getIdOfTheLastOperation'](_0x17456a){let _0xc5f64d=_0x17456a['length'];for(;_0xc5f64d--;){const _0x3d14de=_0x17456a[_0xc5f64d];if(!this['_ignoredOperations']['has'](_0x3d14de)){if(!this['_operationToId']['has'](_0x3d14de)){const _0x117921=_0x949bf5()['slice'](0x1,0x12);this['_operationToId']['set'](_0x3d14de,_0x117921);}return this['_operationToId']['get'](_0x3d14de);}}}['setIdForTheLastOperation'](_0x21f7b0,_0xd0d0ef){if(!_0xd0d0ef)return;let _0x1e0a66=_0x21f7b0['length'];for(;_0x1e0a66--;){const _0x1824d1=_0x21f7b0[_0x1e0a66];this['_ignoredOperations']['has'](_0x1824d1)||this['_operationToId']['set'](_0x1824d1,_0xd0d0ef);}}}class a extends _0x1e727b{static get['requires'](){return[l];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class s extends _0x3a23a9{static ['CommentsService']=/* #__PURE__ -- @preserve */
|
|
26
|
-
((()=>_0x51d13b)());['_services'];static get['requires'](){return[n,'CommentsRepository',i,_0x1ebdaa];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x5e7e54){super(_0x5e7e54),this['_services']=new Map();}async['init'](){const _0x337d88=this['context'],_0x360d0a=_0x337d88['plugins']['get']('CommentsRepository');if(_0x337d88['plugins']['get'](n)['addToReconnectionStack'](this),_0x360d0a['adapter']={'addCommentThread':async({channelId:_0x34a04a,threadId:_0x13d286,comments:_0x1e28e7,resolvedAt:_0x2b3d6d,resolvedBy:_0x29c504,context:_0x5901ed,attributes:_0x67ddf2})=>{const _0x390738=await this['_getService'](_0x34a04a)['addCommentThread']({'commentThreadId':_0x13d286,'comments':_0x1e28e7['map'](_0x40a090=>function(_0x315006,_0xc4e6dd,_0x59440d){return{'commentThreadId':_0x59440d,'commentId':_0x315006['commentId'],'userId':_0x315006['authorId'],'content':_0x315006['content'],'documentId':_0xc4e6dd,'createdAt':_0x315006['createdAt'],'attributes':_0x315006['attributes']||{}};}(_0x40a090,_0x34a04a,_0x13d286)),'resolvedAt':_0x2b3d6d,'resolvedBy':_0x29c504,'context':_0x5901ed,'attributes':_0x67ddf2})['catch'](at);return{'threadId':_0x390738['commentThreadId'],'comments':_0x390738['comments']};},'getCommentThread':async({channelId:_0x315504,threadId:_0x2ab80c})=>{const _0x1f43e8=await this['_getService'](_0x315504)['getCommentThread'](_0x2ab80c)['catch'](F)['catch'](at);return _0x1f43e8?_0x1f43e8['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0x1f43e8]),{'threadId':_0x1f43e8['commentThreadId'],'comments':_0x1f43e8['comments']['map'](S),'context':_0x1f43e8['context'],'resolvedAt':_0x1f43e8['resolvedAt'],'resolvedBy':_0x1f43e8['resolvedBy'],'attributes':_0x1f43e8['attributes']||{}}):null;},'updateCommentThread':async({channelId:_0x3e5d29,threadId:_0x2f2341,context:_0x5e394d,unlinkedAt:_0x2824c3,attributes:_0x1c36a9})=>this['_getService'](_0x3e5d29)['updateCommentThread']({'commentThreadId':_0x2f2341,'context':_0x5e394d,'attributes':_0x1c36a9,'unlinkedAt':_0x2824c3})['catch'](F)['catch'](at),'resolveCommentThread':async({channelId:_0x384648,threadId:_0x5acd67})=>{const _0x21fda6=await this['_getService'](_0x384648)['resolveCommentThread'](_0x5acd67)['catch'](F)['catch'](at);return{'threadId':_0x21fda6['commentThreadId'],'resolvedAt':_0x21fda6['resolvedAt'],'resolvedBy':_0x21fda6['resolvedBy']};},'reopenCommentThread':async({channelId:_0x512425,threadId:_0x209640})=>this['_getService'](_0x512425)['reopenCommentThread'](_0x209640)['catch'](F)['catch'](at),'removeCommentThread':({channelId:_0x86fb30,threadId:_0xce06ae})=>this['_getService'](_0x86fb30)['removeCommentThread'](_0xce06ae)['catch'](F)['catch'](at),'addComment':({channelId:_0x315fcf,threadId:_0x3647cb,commentId:_0x36a967,content:_0x298662,attributes:_0x3b3d5d})=>this['_getService'](_0x315fcf)['addComment'](_0x3647cb,_0x36a967,_0x298662,_0x3b3d5d)['catch'](at),'updateComment':({channelId:_0x29be45,threadId:_0x4409e6,commentId:_0x35d1b3,content:_0x37aaef,attributes:_0x2bee10})=>this['_getService'](_0x29be45)['updateComment'](_0x4409e6,_0x35d1b3,_0x37aaef,_0x2bee10)['catch'](F)['catch'](at),'removeComment':({channelId:_0x5b4066,threadId:_0x5897b4,commentId:_0x146f92})=>this['_getService'](_0x5b4066)['removeComment'](_0x5897b4,_0x146f92)['catch'](F)['catch'](at)},_0x337d88 instanceof _0x61408d){const _0x34495f=_0x337d88['config']['get']('collaboration.channelId'),_0x2b1e10=_0x337d88['plugins']['get'](i);await this['_setUpService'](_0x34495f);const _0x340f41=await this['_services']['get'](_0x34495f)['getConnectedSessions']();this['listenTo'](_0x2b1e10,'sessionAdd:'+_0x34495f,(_0x1c3532,{session:_0x3f5998})=>{_0x3f5998['id']===_0x2b1e10['mySessionId']&&(_0x1c3532['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x3f5998['permissions'],_0x34495f));}),_0x2b1e10['register'](_0x34495f,_0x340f41);}}async['_setUpService'](_0x5837a3){if(this['_services']['has'](_0x5837a3))throw new _0x1bac20('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0x5837a3});const _0x188ac3=this['context']['plugins']['get']('CommentsRepository'),_0x2d6431=new s['CommentsService'](_0x5837a3);this['_services']['set'](_0x5837a3,_0x2d6431),this['listenTo'](_0x2d6431,'commentThreadAdded',(_0x171f97,_0x4c3a31)=>{const {commentThreadId:_0x461490,documentId:_0x3be436,context:_0xdb872f,attributes:_0x5282be,resolvedAt:_0x4df217,resolvedBy:_0x4c7de0,comments:_0x42ab16}=_0x4c3a31;_0x188ac3['getCommentThread'](_0x461490)||_0x188ac3['addCommentThread']({'threadId':_0x461490,'channelId':_0x3be436,'comments':_0x42ab16?_0x42ab16['map'](S):[],'context':_0xdb872f,'attributes':_0x5282be,'resolvedAt':_0x4df217,'resolvedBy':_0x4c7de0,'isFromAdapter':!0x0});}),this['listenTo'](_0x2d6431,'commentThreadUpdated',(_0x56e49e,{commentThreadId:_0x34a4b4,documentId:_0x59b737,context:_0x84fc59,unlinkedAt:_0x2d7cc4,attributes:_0x16f360})=>{_0x188ac3['getCommentThread'](_0x34a4b4)&&_0x188ac3['updateCommentThread']({'threadId':_0x34a4b4,'channelId':_0x59b737,'context':_0x84fc59,'unlinkedAt':_0x2d7cc4,'attributes':_0x16f360,'isFromAdapter':!0x0});}),this['listenTo'](_0x2d6431,'commentThreadResolved',(_0x1e861d,{commentThreadId:_0x2b233a,resolvedBy:_0x49df2a,resolvedAt:_0x32f5a6})=>{const _0x12a87a=_0x188ac3['getCommentThread'](_0x2b233a);_0x12a87a&&_0x12a87a['resolve']({'resolvedBy':_0x49df2a,'resolvedAt':_0x32f5a6,'isFromAdapter':!0x0});}),this['listenTo'](_0x2d6431,'commentThreadReopened',(_0x2aabeb,{commentThreadId:_0x717666})=>{const _0x4bf0f1=_0x188ac3['getCommentThread'](_0x717666);_0x4bf0f1&&_0x4bf0f1['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0x2d6431,'commentThreadRemoved',(_0x817658,{commentThreadId:_0x2c7cf5})=>{const _0xe9e7ff=_0x188ac3['getCommentThread'](_0x2c7cf5);_0xe9e7ff&&_0xe9e7ff['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0x2d6431,'commentAdded',(_0x209fa5,_0x249e95)=>{const _0x5893ca=_0x249e95['commentThreadId'],_0x18fa2e=_0x188ac3['getCommentThread'](_0x5893ca);_0x18fa2e&&_0x18fa2e['addComment']({...S(_0x249e95),'isFromAdapter':!0x0});}),this['listenTo'](_0x2d6431,'commentUpdated',(_0x59d6ae,{commentThreadId:_0x17aa04,commentId:_0x5ad015,content:_0x8f3d0e,attributes:_0x96542d})=>{const _0xbf601=_0x188ac3['getCommentThread'](_0x17aa04);if(_0xbf601){const _0x54b298=_0xbf601['getComment'](_0x5ad015);_0x54b298&&_0x54b298['update']({'content':_0x8f3d0e,'attributes':_0x96542d,'isFromAdapter':!0x0});}}),this['listenTo'](_0x2d6431,'commentRemoved',(_0x58f6ca,{commentThreadId:_0x1975f1,commentId:_0x342d13})=>{const _0x593c8a=_0x188ac3['getCommentThread'](_0x1975f1);if(_0x593c8a){const _0xf5fa05=_0x593c8a['getComment'](_0x342d13);_0xf5fa05&&_0xf5fa05['remove']({'isFromAdapter':!0x0});}}),await this['_connectService'](_0x5837a3);}['destroy'](){if(this['context']instanceof _0x61408d){const _0x2299a1=this['context']['config']['get']('collaboration.channelId');this['_terminateService'](_0x2299a1);}}['_terminateService'](_0x4a9ab2){if(!this['_services']['has'](_0x4a9ab2))throw new _0x1bac20('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0x4a9ab2});this['_getService'](_0x4a9ab2)['disconnect'](),this['_services']['delete'](_0x4a9ab2);}async['reconnect'](){for(const _0x210ead of this['_services']['keys']())await this['_connectService'](_0x210ead);if(this['context']instanceof _0x61408d){const _0x334582=this['context']['config']['get']('collaboration.channelId'),_0x2cbe89=this['context']['plugins']['get'](i);_0x2cbe89['unregister'](_0x334582);const _0x4b029d=await this['_services']['get'](_0x334582)['getConnectedSessions']();_0x2cbe89['register'](_0x334582,_0x4b029d);}}async['_connectService'](_0x102353){const {connection:_0x209588}=this['context']['plugins']['get'](n),_0x30b9d8=this['context']['plugins']['get']('CommentsRepository'),_0x55a46f=this['_services']['get'](_0x102353),_0x5e8089=await _0x55a46f['connect'](_0x209588);await this['_fetchMissingUsersForThreads'](_0x5e8089);const _0x2bce68=new Set(Array['from'](_0x30b9d8['getCommentThreads']({'channelId':_0x102353}),_0x5ea86d=>_0x5ea86d['id']));for(const _0x3f149b of _0x5e8089)_0x3f149b['deletedAt']||_0x2bce68['delete'](_0x3f149b['commentThreadId']);for(const _0x2038ea of _0x2bce68)_0x30b9d8['getCommentThread'](_0x2038ea)['remove']({'isFromAdapter':!0x0});for(const _0x1ba684 of _0x5e8089){let _0x122836=_0x30b9d8['getCommentThread'](_0x1ba684['commentThreadId']);const {commentThreadId:_0x2d9b8b,context:_0x57d82a,attributes:_0x32adb3,resolvedBy:_0x1f6926,resolvedAt:_0x57cae6,unlinkedAt:_0x4f0b36,deletedAt:_0xac6677}=_0x1ba684;if(_0xac6677)continue;_0x122836||(_0x122836=_0x30b9d8['addCommentThread']({'channelId':_0x102353,'threadId':_0x2d9b8b,'context':_0x57d82a,'attributes':_0x32adb3||{},'resolvedBy':_0x1f6926,'resolvedAt':_0x57cae6,'unlinkedAt':_0x4f0b36,'isFromAdapter':!0x0}));const _0x259b87=new Set(Array['from'](_0x122836['comments'],_0x1bfafc=>_0x1bfafc['id']));for(const _0x4fe308 of _0x1ba684['comments'])_0x259b87['delete'](_0x4fe308['commentId']);for(const _0x7cbe04 of _0x259b87)_0x122836['getComment'](_0x7cbe04)['remove']({'isFromAdapter':!0x0});for(const _0x5727d9 of _0x1ba684['comments']){const _0x88c0bd=_0x122836['getComment'](_0x5727d9['commentId']);_0x88c0bd?_0x88c0bd['content']!==_0x5727d9['content']&&_0x88c0bd['update']({'content':_0x5727d9['content'],'isFromAdapter':!0x0}):_0x122836['addComment'](Object['assign'](S(_0x5727d9),{'isFromAdapter':!0x0}));}}}['_getService'](_0x5eb9d5){if(!this['_services']['has'](_0x5eb9d5))throw new _0x1bac20('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0x5eb9d5});return this['_services']['get'](_0x5eb9d5);}async['_fetchMissingUsersForThreads'](_0xdd143c){const _0x1807d2=this['context']['plugins']['get'](_0x1ebdaa),{connection:_0x36500f}=this['context']['plugins']['get'](n),_0x32dda4=new Set();for(const {resolvedBy:_0xab03fa,comments:_0x4aea2c}of _0xdd143c){_0xab03fa&&!_0x1807d2['getUser'](_0xab03fa)&&_0x32dda4['add'](_0xab03fa);for(const {userId:_0x214c80}of _0x4aea2c)_0x1807d2['getUser'](_0x214c80)||_0x32dda4['add'](_0x214c80);}if(0x0===_0x32dda4['size'])return;const _0x104e7a=await ct['getMany'](_0x36500f,Array['from'](_0x32dda4));for(const _0x590221 of _0x104e7a)_0x1807d2['getUser'](_0x590221['id'])||_0x1807d2['addUser'](_0x590221);}}async function F(_0x68083b){if('404'!==_0x68083b['code'])throw _0x68083b;}function at(_0x5a7002){if((_0x5e54b3=_0x5a7002)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0x5e54b3['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x5e54b3['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0x5e54b3;throw _0x5a7002;}function S(_0x5e6661){return{'threadId':_0x5e6661['commentThreadId'],'commentId':_0x5e6661['commentId'],'content':_0x5e6661['content'],'createdAt':_0x5e6661['createdAt'],'authorId':_0x5e6661['userId'],'attributes':_0x5e6661['attributes']||{}};}class m extends _0x1e727b{static ['TrackChangesService']=/* #__PURE__ -- @preserve */
|
|
27
|
-
((()=>
|
|
28
|
-
((()=>_0x4e1f81)());['_lastRequestId'];['_revisionTracker'];['_revisionHistoryService'];['_oldOffset'];static get['requires'](){return[n,l,'RevisionHistory',i,_0x1ebdaa];}static get['pluginName'](){return'CloudServicesRevisionHistoryAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0xba4abd){super(_0xba4abd);const _0x4ecc53=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new c['RevisionHistoryService'](_0x4ecc53);}async['init'](){const _0x2fc567=this['editor']['plugins']['get'](l),_0x3f3af4=_0x2fc567['serverHistory'],_0x234f15=this['editor']['plugins']['get'](n);this['_revisionTracker']['setSource']({'history':_0x3f3af4,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0x2fc567['sessionId']});const _0x505c7b=this['editor']['config']['get']('cloudServices.bundleVersion')||nt,_0x1eceb8=await _0x548ff3['isBundleUploaded'](_0x234f15['connection'],_0x505c7b);this['editor']['plugins']['get']('RevisionHistory')['adapter']={'getRevision':async({revisionId:_0x595446})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0x595446)),'updateRevisions':async _0x3732a4=>{await this['_waitForServiceReady']();const _0x18b081=this['_revisionTracker']['currentRevision'];if(_0x1eceb8&&0x1===_0x3732a4['length']&&_0x3732a4[0x0]['id']===_0x18b081['id'])return _0x3732a4;for(const _0x48a77f of _0x3732a4)_0x48a77f['id']===_0x18b081['id']&&(_0x48a77f['isEmptyCurrent']=_0x48a77f['fromVersion']===_0x48a77f['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0x3732a4,this['_lastRequestId'])['then'](_0x54b5ff=>(this['_lastRequestId']=_0x54b5ff,_0x3732a4))['catch'](_0x197270=>{if(_(_0x197270)||'400'===_0x197270['code']&&void 0x0!==_0x197270['data']['wrongRequestId']){for(const _0x123df9 of _0x3732a4){!this['_revisionTracker']['repository']['getRevision'](_0x123df9['id'])||this['_revisionTracker']['_bufferUpdate'](_0x123df9['id'],_0x123df9,!0x1);}if(_(_0x197270))throw _0x197270;return _0x3732a4;}throw _0x197270;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0x33ad1b,{revisionsData:_0x570248,requestId:_0x9c2c8})=>{Math['max'](..._0x570248['map'](_0x5c9e45=>_0x5c9e45['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0x570248,_0x9c2c8);}):this['_handleRevisionsUpdate'](_0x570248,_0x9c2c8);});const {revisions:_0x46e3d0,requestId:_0x192054}=await this['_revisionHistoryService']['connect'](_0x234f15['connection']);_0x234f15['addToReconnectionStack'](this),this['_lastRequestId']=_0x192054,await this['_fetchMissingUsers'](_0x46e3d0);for(const _0x862c41 of _0x46e3d0)this['_revisionTracker']['addRevisionData'](_0x862c41);this['listenTo'](_0x2fc567,'change:_isConnected',(_0x2f0bd1,_0x149147,_0x46ea39)=>{_0x46ea39&&(this['_oldOffset']=_0x2fc567['_offset'],_0x2f0bd1['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](_0x234f15,'state',_0x2bbfe6=>_0x2bbfe6===_0xe66aa2['CONNECTED']);}async['reconnect'](){const _0x2ca084=this['editor']['plugins']['get'](n),_0x5645f0=this['editor']['plugins']['get'](l),_0x11422f=async()=>{const _0x1dae83=this['_revisionTracker']['currentRevision'],_0x117dd1=_0x1dae83['id'],_0x5c7215=_0x117dd1!==_0x5645f0['sessionId'];if(_0x5c7215){const _0x4075fb=_0x5645f0['_offset']-this['_oldOffset'],_0x7e27f2=this['_getLatestVersionFromServerOperations']();this['_revisionTracker']['_revisionDataBuilder']['reInit']();if(_0x1dae83['toVersion']+_0x4075fb!==_0x7e27f2){const _0x2686d2=_0x1dae83['fromVersion']+_0x4075fb,_0x5db2df=this['editor']['plugins']['get'](_0x1ebdaa),_0x7f8a2b=this['_revisionTracker']['buildRevisionData']({'revision':_0x1dae83,'from':_0x2686d2,'to':_0x7e27f2});_0x7f8a2b['id']=_0x1dae83['id'];const _0x5cb6b6=_0x7f8a2b['authorsIds']['map'](_0x18ffc6=>_0x5db2df['getUser'](_0x18ffc6));_0x1dae83['_update']({..._0x7f8a2b,'authors':_0x5cb6b6},!0x0),this['_revisionTracker']['_bufferUpdate'](_0x1dae83['id'],_0x7f8a2b,!0x0);}this['_revisionTracker']['_startingVersion']=_0x7e27f2,(_0x1dae83['toVersion']===_0x1dae83['fromVersion']&&!this['_revisionTracker']['_bufferedUpdates']['has'](_0x117dd1)&&this['_revisionTracker']['repository']['_revisions']['remove'](_0x117dd1),this['_revisionTracker']['_createCurrentRevision'](_0x7e27f2));}const {revisions:_0x375617,requestId:_0x4170c9}=await this['_revisionHistoryService']['reconnect'](_0x2ca084['connection'],this['_lastRequestId']);_0x5c7215&&_0x375617['length']>0x0?_0x5645f0['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x375617),this['_handleRevisionsUpdate'](_0x375617,_0x4170c9),this['_revisionTracker']['sendBufferedUpdates']());};return _0x5645f0['_isConnected']?_0x11422f():new Promise((_0x58698b,_0x59602c)=>{_0x5645f0['once']('change:_isConnected',()=>{_0x11422f()['then'](_0x58698b)['catch'](_0x59602c);});});}['destroy'](){super['destroy']();}async['_waitForServiceReady'](){this['_revisionHistoryService']['isConnected']||await new Promise(_0x7ae67=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x267aa4=>{_0x267aa4['off'](),_0x7ae67();});});}['_getLatestVersionFromServerOperations'](){const _0x1bcc9f=this['editor']['plugins']['get'](l)['serverHistory']['getOperations']()['reverse']();for(const _0x242cbf of _0x1bcc9f)if('marker'!==_0x242cbf['type']||_0x242cbf['affectsData'])return _0x242cbf['baseVersion']+0x1;}['_getLatestVersion'](){const _0x72384d=this['editor']['plugins']['get'](l);return new Promise(_0x83698e=>{_0x72384d['_isPendingUpdate']?_0x72384d['once']('change:_isPendingUpdate',()=>{_0x83698e(this['_getLatestVersionFromServerOperations']());}):_0x83698e(this['_getLatestVersionFromServerOperations']());});}['_handleRevisionsUpdate'](_0x4ada9a,_0x18eda8){const _0x63a8c1=this['_revisionTracker']['repository'];this['_lastRequestId']=_0x18eda8;for(const _0x432fb5 of _0x4ada9a){const _0x285ec6=_0x63a8c1['getRevision'](_0x432fb5['id']);if(_0x285ec6){if((_0x432fb5['fromVersion']||_0x432fb5['toVersion'])&&(_0x432fb5['diffData']=null),_0x285ec6===this['_revisionTracker']['currentRevision']){const _0x17c6ad=Math['max'](_0x285ec6['toVersion'],_0x432fb5['toVersion']),_0x195aab=Math['max'](_0x285ec6['fromVersion'],_0x432fb5['fromVersion']);let _0x298c42;_0x285ec6['toVersion']===_0x432fb5['toVersion']&&_0x285ec6['fromVersion']===_0x432fb5['fromVersion']?(_0x298c42=!0x0,this['_preventResendingRevisionData'](_0x432fb5)):_0x432fb5['toVersion']===_0x17c6ad&&_0x432fb5['fromVersion']===_0x195aab?_0x298c42=!0x1:(_0x285ec6['toVersion']===_0x17c6ad&&_0x285ec6['fromVersion']===_0x195aab||this['_fixRevision']({'revision':_0x285ec6,'from':_0x195aab,'to':_0x17c6ad}),_0x298c42=!0x0),_0x298c42&&(delete _0x432fb5['fromVersion'],delete _0x432fb5['toVersion'],delete _0x432fb5['diffData'],delete _0x432fb5['createdAt'],delete _0x432fb5['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0x432fb5),this['_preventResendingRevisionData'](_0x432fb5);}else this['_revisionTracker']['addRevisionData'](_0x432fb5);}const _0x6feae=_0x63a8c1['getRevisions']();_0x6feae['reverse']();for(let _0x3963d7=0x0;_0x3963d7<_0x6feae['length']-0x1;_0x3963d7++){const _0x58b75f=_0x6feae[_0x3963d7],_0x3f727f=_0x6feae[_0x3963d7+0x1];if(_0x58b75f['fromVersion']<_0x3f727f['toVersion']){const _0xe0cf33=_0x3f727f['toVersion'],_0x59b92b=Math['max'](_0xe0cf33,_0x58b75f['toVersion']);this['_fixRevision']({'revision':_0x58b75f,'from':_0xe0cf33,'to':_0x59b92b});}}}['_fixRevision']({revision:_0x3742f3,from:_0x155652,to:_0x30c81b}={}){const _0xf6d06f=this['editor']['plugins']['get'](_0x1ebdaa),_0x21d280=this['_revisionTracker']['buildRevisionData']({'revision':_0x3742f3,'from':_0x155652,'to':_0x30c81b});_0x21d280['authors']=_0x21d280['authorsIds']['map'](_0x3a1117=>_0xf6d06f['getUser'](_0x3a1117)),_0x3742f3['_update'](_0x21d280);}['_preventResendingRevisionData'](_0x2f20df){const _0x4f35ab={};_0x4f35ab['id']=_0x2f20df['id'];for(const _0x267ba1 of Object['keys'](_0x2f20df))'id'!==_0x267ba1&&(_0x4f35ab[_0x267ba1]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0x4f35ab['id'],_0x4f35ab,!0x0);}async['_fetchMissingUsers'](_0x15dd9f){const _0x56e106=this['editor']['plugins']['get'](_0x1ebdaa),{connection:_0x429ced}=this['editor']['plugins']['get'](n),_0x36c1f3=new Set();for(const _0x2691db of _0x15dd9f){for(const _0x276e52 of _0x2691db['authorsIds'])_0x1abf65(_0x276e52);_0x2691db['creatorId']&&_0x1abf65(_0x2691db['creatorId']);}if(0x0===_0x36c1f3['size'])return;const _0x5b2b0d=await ct['getMany'](_0x429ced,Array['from'](_0x36c1f3));for(const _0x20c19a of _0x5b2b0d)_0x56e106['getUser'](_0x20c19a['id'])||_0x56e106['addUser'](_0x20c19a);function _0x1abf65(_0x1d4091){_0x56e106['getUser'](_0x1d4091)||_0x36c1f3['add'](_0x1d4091);}}}function _(_0x28bd84){return _0x28bd84['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0x28bd84['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x28bd84['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class dt extends _0x1e727b{static get['requires'](){return['RevisionHistory',c,a];}static get['pluginName'](){return'RealTimeCollaborativeRevisionHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class b extends _0x120b7e{['_collapseAt'];constructor(_0x31ef64,_0x1d82db=0x6){super(_0x31ef64);const _0x47a434=this['bindTemplate'];this['set']('isHidden',!0x0),this['set']('usersCount',0x0),this['_collapseAt']=_0x1d82db,this['bind']('isHidden')['to'](this,'usersCount',_0x1cc2af=>_0x1cc2af<_0x1d82db),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item',_0x47a434['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':_0x47a434['to']('usersCount',_0x5b9f15=>'+'+(_0x5b9f15-this['_collapseAt']+0x2)['toString']())}]}]}]});}}class is extends _0x120b7e{['items'];['keystrokes'];constructor(_0x35b486){super(_0x35b486);const _0x7658fc=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0x24251b(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0x7658fc['if']('hasPopup'),'aria-expanded':_0x7658fc['to']('isExpanded',_0xdd9b0e=>this['hasPopup']&&String(_0xdd9b0e)),'aria-label':_0x7658fc['to']('hasPopup',_0x405538=>K(_0x35b486,_0x405538?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0x7658fc['to']('hasPopup',_0x5a22d0=>!!_0x5a22d0&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items'],'on':{'mouseenter':_0x7658fc['to'](()=>this['fire']('presencelist:show')),'mouseleave':_0x7658fc['to'](_0x812f29=>{const _0x50ee4f=_0x812f29,_0x5cd54d=document['querySelector']('.ck-presence-list__dropdown-list'),_0x41f5a9=document['querySelector']('.ck-balloon-panel_with-arrow');_0x5cd54d?.['contains'](_0x50ee4f['relatedTarget'])||_0x41f5a9?.['contains'](_0x50ee4f['relatedTarget'])||this['fire']('presencelist:hide');})}}),this['on']('change:hasPopup',(_0x18c6a7,_0x3afd41,_0x21eec0)=>{this['element']&&(_0x21eec0?this['element']['setAttribute']('aria-expanded',String(this['isExpanded'])):this['element']['removeAttribute']('aria-expanded'));});}['focus'](){this['element']['focus']();}['render'](){super['render'](),this['keystrokes']['listenTo'](this['element']);}}class v extends _0x120b7e{['counterView'];['inlineListView'];constructor(_0x2307d6,_0x34f84c=0x6){super(_0x2307d6);const _0x1bbbcf=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new b(this['locale'],_0x34f84c),this['inlineListView']=new is(_0x2307d6),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x554300 of this['inlineListView']['items'])_0x554300['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',_0x1bbbcf['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['inlineListView']]});}}class L extends _0x120b7e{['listWrapperView'];constructor(_0x3220a4,_0x223998){super(_0x3220a4);const _0x5b4494=this['bindTemplate'];this['listWrapperView']=new ut(_0x3220a4,_0x223998),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':K(_0x3220a4,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']],'on':{'mouseleave':_0x5b4494['to'](_0x56d30e=>{const _0x4d649e=_0x56d30e,_0x3a663e=document['querySelector']('.ck-presence-list__list'),_0x5dac32=document['querySelector']('.ck-balloon-panel_with-arrow');_0x3a663e?.['contains'](_0x4d649e['relatedTarget'])||_0x5dac32?.['contains'](_0x4d649e['relatedTarget'])||this['fire']('presencelist:hide');})}});}}class ut extends _0x43f1ce{constructor(_0x3272f1,_0x3d0dbd){super(_0x3272f1);const _0x166805=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0x3d0dbd?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0x166805['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0x166805['to']('role'),'aria-label':_0x166805['to']('ariaLabel'),'aria-labelledby':_0x166805['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0x4e4909['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0x370235=this['element'];_0x370235&&(this['_isScrollable']=Math['max'](_0x370235['scrollHeight'],_0x370235['clientHeight'])>0.8*window['innerHeight']);}}class j extends et{['userView'];constructor(_0x28632c,_0x36f0c2,_0x3e4a91){super(_0x28632c);const _0x2beac5=this['bindTemplate'];this['userView']=new st(_0x28632c,_0x36f0c2);const _0x14f291={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0x36f0c2['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0x36f0c2['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x36f0c2['color']['getBackgroundColorClass']()],'aria-hidden':'true'}}]};_0x3e4a91&&(_0x14f291['tag']='button',_0x14f291['on']={'click':_0x2beac5['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x14f291);}['focus'](){this['element']['focus']();}}class A extends _0x120b7e{['userView'];['markerView'];constructor(_0x3fcccb,_0x201d36,_0x2f7946){super(_0x3fcccb);const _0x2d2f61=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new st(_0x3fcccb,_0x201d36),this['markerView']=new ot(_0x3fcccb,_0x201d36);const _0x12c031=new it(_0x3fcccb);_0x12c031['template']['tag']='span',_0x12c031['text']=_0x201d36['name'];const _0x55a7d1={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0x2d2f61['to']('isFocusable',_0x2050b9=>!!_0x2050b9&&0x0),'aria-labelledby':_0x12c031['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0x2d2f61['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0x2d2f61['to']('hasTooltip',_0x286e65=>!_0x286e65),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0x12c031]};_0x2f7946&&(_0x55a7d1['tag']='button',_0x55a7d1['on']={'click':_0x2d2f61['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x55a7d1);}}class ot extends _0x120b7e{constructor(_0x17438a,_0x1071bb){super(_0x17438a),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x1071bb['color']['getBackgroundColorClass']()],'aria-hidden':'true'}});}}const x={'collapseAt':0x6,'displayMe':!0x0};class r extends _0x3a23a9{['currentDisplayedUsers'];['balloonPanelView'];['view'];['presenceDropdownView'];['_bodyCollection']=null;static get['pluginName'](){return'PresenceListUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x9fe6e8){super(_0x9fe6e8),this['context']['config']['define']('presenceList',x);const _0x54d41f=_0x9fe6e8['config']['get']('presenceList.collapseAt');if('number'!=typeof _0x54d41f)throw new _0x1bac20('presencelist-collapseat-invalid-format',this);if(_0x54d41f<0x1)throw new _0x1bac20('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](i)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0x16299e(),this['balloonPanelView']=new _0x1eb178(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get['requires'](){return[i];}['init'](){for(const _0x94f492 of this['_allConnectedUsers'])this['_handleUserAdd'](_0x94f492);this['listenTo'](this['_allConnectedUsers'],'add',(_0x19cbfb,_0x4d9af8)=>{this['_handleUserAdd'](_0x4d9af8);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0x2d291d,_0x330bf7)=>{this['_handleUserRemove'](_0x330bf7);});}['_createView'](){const _0x2c04be=this['context'],_0x1eeff5=new v(this['context']['locale'],this['context']['config']['get']('presenceList.collapseAt')),_0x46f09d=this['balloonPanelView'];if(!_0x31839f(_0x2c04be['config']['get']('presenceList.container')))throw new _0x1bac20('presencelist-missing-container',this);return _0x1eeff5['counterView']['bind']('usersCount')['to'](this),_0x1eeff5['bind']('isCollapsed')['to'](this,'usersCount',_0x3da2d3=>{const {collapseAt:_0x7b1d0b}=_0x2c04be['config']['get']('presenceList'),_0x1d4a3f=_0x3da2d3>=_0x7b1d0b;if(_0x1d4a3f&&!_0x1eeff5['inlineListView']['items']['find'](_0x25a720=>_0x25a720 instanceof b)){const _0xdd20e3=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['currentDisplayedUsers']['length']==_0xdd20e3&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](this['currentDisplayedUsers']['length']-0x1),_0x1eeff5['inlineListView']['items']['add'](_0x1eeff5['counterView']);}return _0x1d4a3f||this['hideDropdown'](),_0x1d4a3f;}),_0x1eeff5['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0x12970e=>{const _0x3bd9b3=_0x2c04be['config']['get']('presenceList'),_0x1795c2=new A(_0x2c04be['locale'],_0x12970e,!!_0x3bd9b3['onClick']);return _0x1795c2['bind']('hasTooltip')['to'](_0x1eeff5,'isCollapsed',_0x17734a=>!_0x17734a),_0x1795c2['bind']('isFocusable')['to'](_0x1eeff5,'isCollapsed',_0x2fb6c2=>!_0x2fb6c2),_0x3bd9b3['onClick']&&this['listenTo'](_0x1795c2,'execute',()=>{this['view']['isCollapsed']||_0x3bd9b3['onClick'](_0x12970e,_0x1795c2['element']);}),_0x1795c2;}),this['listenTo'](_0x1eeff5['inlineListView'],'presencelist:show',()=>{this['view']['isCollapsed']&&this['showDropdown']();}),this['listenTo'](_0x1eeff5['inlineListView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();}),_0x1eeff5['inlineListView']['keystrokes']['set']('Enter',(_0x26e96a,_0x5bbe52)=>{this['view']['isCollapsed']&&(this['showDropdown'](),_0x5bbe52());}),_0x1eeff5['render'](),_0x46f09d['render'](),_0x2e73ff({'emitter':_0x1eeff5,'activator':()=>_0x46f09d['isVisible'],'contextElements':[_0x46f09d['element'],_0x1eeff5['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0x2c04be['config']['get']('presenceList.container')['appendChild'](_0x1eeff5['element']),this['_bodyCollection']=new _0x73d6b(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_bodyCollection']['add'](this['balloonPanelView']),_0x1eeff5;}['_handleUserAdd'](_0x412a45){if(!this['context']['config']['get']('presenceList.displayMe')&&_0x412a45['isMe'])return;const _0x9e7863=this['context']['config']['get']('presenceList.collapseAt')-0x1;for(this['usersCount']++;this['currentDisplayedUsers']['length']>=_0x9e7863-(this['view']['isCollapsed']?0x1:0x0)&&this['currentDisplayedUsers']['length']>0x1;)this['currentDisplayedUsers']['remove'](0x1);const _0x38fc9b=_0x412a45['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0x412a45,_0x38fc9b);}['_handleUserRemove'](_0x18cd36){this['usersCount']--;const {collapseAt:_0x198577}=this['context']['config']['get']('presenceList'),_0x52006e=this['usersCount']>=_0x198577;if(this['currentDisplayedUsers']['get'](_0x18cd36['id']))this['currentDisplayedUsers']['remove'](_0x18cd36['id']);else{if(_0x52006e&&this['currentDisplayedUsers']['length']+0x1===_0x198577-0x1)return;}if(this['currentDisplayedUsers']['length']+(_0x52006e?0x1:0x0)<this['usersCount']){for(const _0x5aca16 of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0x5aca16['id'])&&(this['currentDisplayedUsers']['add'](_0x5aca16,Math['min'](this['currentDisplayedUsers']['length']-(_0x52006e?0x1:0x0),0x1)),this['currentDisplayedUsers']['length']+(_0x52006e?0x1:0x0)===_0x198577-0x1))return;}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0x556329=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new L(this['context']['locale'],!!_0x556329['onClick']),this['view']['inlineListView']['isExpanded']=!0x0,this['listenTo'](this['presenceDropdownView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();});const {listWrapperView:_0x3e91d2}=this['presenceDropdownView'];_0x3e91d2['items']['bindTo'](this['_allConnectedUsers'])['using'](_0x38365a=>{if(!_0x556329['displayMe']&&_0x38365a['isMe'])return null;const _0x240d68=new j(this['context']['locale'],_0x38365a,!!_0x556329['onClick']);return _0x556329['onClick']&&this['listenTo'](_0x240d68,'execute',()=>{_0x556329['onClick'](_0x38365a,_0x240d68['element']);}),_0x240d68;}),this['balloonPanelView']['content']['add'](this['presenceDropdownView']),this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element']}),_0x3e91d2['focus'](),_0x3e91d2['checkIfScrollable']();const _0x235ce0=(_0x3a40a9,_0x2372b7)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0x2372b7();};_0x3e91d2['keystrokes']['set']('Esc',_0x235ce0),_0x3e91d2['keystrokes']['set']('Shift+Tab',_0x235ce0),_0x3e91d2['keystrokes']['set']('Tab',(_0xffc3e6,_0x55a5c2)=>{!function(_0x14f42a){const _0x16d9c3=['a','button','input','select','textarea','[tabindex]','[contenteditable]']['map'](_0x878892=>_0x878892+':not([disabled]):not([tabindex=\x22-1\x22])')['join'](','),_0x480cbd=[...document['body']['querySelectorAll'](_0x16d9c3)]['filter'](_0x3f18f7=>_0x3f18f7===document['activeElement']||_0x3f18f7['offsetWidth']+_0x3f18f7['offsetHeight']>0x0)['sort']((_0x27e8a6,_0x33c828)=>(_0x27e8a6['tabIndex']||0x0)-(_0x33c828['tabIndex']||0x0)),_0x1bf7d7=_0x480cbd['indexOf'](_0x14f42a),_0x4201a2=_0x480cbd[(_0x1bf7d7+0x1)%_0x480cbd['length']];_0x4201a2&&_0x4201a2['focus']();}(this['view']['element']),this['hideDropdown'](),_0x55a5c2();}),_0x3e91d2['focusTracker']['add'](this['view']['element']),_0x3e91d2['focusTracker']['on']('change:isFocused',(_0x8e36a1,_0x5bbed7,_0x221b1b)=>{_0x221b1b||this['hideDropdown']();});}['hideDropdown'](){this['presenceDropdownView']&&(this['view']['inlineListView']['isExpanded']=!0x1,this['balloonPanelView']['unpin'](),this['balloonPanelView']['content']['remove'](this['presenceDropdownView']),this['presenceDropdownView']['destroy'](),this['presenceDropdownView']=void 0x0);}['destroy'](){super['destroy'](),this['view']&&this['view']['isRendered']&&this['view']['destroy'](),this['_bodyCollection']&&(this['_bodyCollection']['detachFromDom'](),this['_bodyCollection']['destroy'](),this['_bodyCollection']=null);}}class ft extends _0x3a23a9{static get['requires'](){return[i,r];}static get['pluginName'](){return'PresenceList';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}export{s as CloudServicesCommentsAdapter,c as CloudServicesRevisionHistoryAdapter,m as CloudServicesTrackChangesAdapter,ft as PresenceList,r as PresenceListUI,l as RealTimeCollaborationClient,g as RealTimeCollaborativeComments,a as RealTimeCollaborativeEditing,dt as RealTimeCollaborativeRevisionHistory,lt as RealTimeCollaborativeTrackChanges,i as Sessions,n as WebSocketGateway};
|
|
23
|
+
import{ContextPlugin as _0x382514,Plugin as _0x5020b7,PendingActions as _0xfa099b,Context as _0x1bb185}from'@ckeditor/ckeditor5-core/dist/index.js';import{DomEmitterMixin as _0x1e311d,CKEditorError as _0x5eee32,Collection as _0x6d1a51,global as _0x423bdf,version as nt,uid as _0x26c052,KeystrokeHandler as _0x3b9efd}from'@ckeditor/ckeditor5-utils/dist/index.js';import{Notification as _0x1dfd40,View as _0x45849d,ListView as _0x2b176e,ListItemView as et,LabelView as it,BalloonPanelView as _0x2c0dd5,clickOutsideHandler as _0x4693a3,BodyCollection as _0x59e840}from'@ckeditor/ckeditor5-ui/dist/index.js';import{ModelLiveRange as _0x578e05,History as _0x1fc730,NoOperation as _0x158a54,InsertOperation as _0x159a57,MarkerOperation as _0x45b8bd,RootAttributeOperation as _0x51c0ef,transformOperationSets as _0x5237c5,OperationFactory as _0x49b61a}from'@ckeditor/ckeditor5-engine/dist/index.js';import{WebSocketGateway as rt,WEB_SOCKET_GATEWAY_STATES as _0x58fce9,CollaborativeEditingService as _0x18f578,User as ct,CommentsService as _0x8fe397,TrackChangesService as tt,RevisionHistoryService as _0x4bbbc8,EditorService as _0x23f175}from'@ckeditor/ckeditor-cloud-services-collaboration/dist/index.js';import{Users as _0x5df8af,UserView as st}from'ckeditor5-collaboration/dist/index.js';import{Compressor as _0x5bed56}from'@ckeditor/ckeditor5-operations-compressor/dist/index.js';import{isElement as _0xf1dc26}from'es-toolkit/compat';class n extends _0x382514{static ['WebSocketGateway']=/* #__PURE__ -- @preserve */
|
|
24
|
+
((()=>rt)());static ['initialReconnectionInterval']=0x3e8;['connection'];['_reconnectionStack'];['_shouldPluginsReconnect'];['_domEmitter'];static get['requires'](){return['CloudServices',_0x1dfd40];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x226c55){super(_0x226c55),this['set']('state',_0x58fce9['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=new(_0x1e311d())();}['init'](){const _0x4ead8a=this['context'],_0x25ec43=_0x4ead8a['plugins']['get']('CloudServices'),_0x195c7f=_0x4ead8a['plugins']['get'](_0x1dfd40);if(!_0x25ec43['token'])throw new _0x5eee32('websocketgateway-missing-token',this);if(!_0x25ec43['webSocketUrl'])throw new _0x5eee32('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'](_0x25ec43['token'],_0x25ec43['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0x58de23=>{if(this['connection']=_0x58de23,this['bind']('state')['to'](_0x58de23,'state',this,'_isBrowserOffline',(_0x29036d,_0x1b4a50)=>('connected'!==_0x29036d&&(this['_shouldPluginsReconnect']=!0x0),_0x1b4a50||_0x29036d!==_0x58fce9['CONNECTED']?_0x58fce9['DISCONNECTED']:this['state']==_0x58fce9['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),_0x58fce9['CONNECTING']):_0x58fce9['CONNECTED'])),this['connection']['on']('error',(_0x399615,_0x38fdbc)=>{if('limitExceeded'!==_0x38fdbc['code'])throw console['error'](_0x38fdbc),new _0x5eee32('cloudservices-init',null,{'originalError':_0x38fdbc});_0x195c7f['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'});}),!_0x58de23['me'])return new Promise(_0x3729ea=>_0x58de23['on']('change:me',_0x3729ea));})['catch'](_0x297604=>{throw console['error'](_0x297604),new _0x5eee32('cloudservices-init',null,{'originalError':_0x297604});});}['addToReconnectionStack'](_0x3c6a0a){if('function'!=typeof _0x3c6a0a['reconnect'])throw new _0x5eee32('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0x3c6a0a))throw new _0x5eee32('websocketgateway-plugin-already-registered',this,{'name':_0x3c6a0a['constructor']['pluginName']});this['_reconnectionStack']['add'](_0x3c6a0a);}['removeFromReconnectionStack'](_0x5786cd){this['_reconnectionStack']['delete'](_0x5786cd);}['isInReconnectionStack'](_0x3a64f1){return this['_reconnectionStack']['has'](_0x3a64f1);}['_reconnect'](){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0x57636c=>_0x57636c['reconnect']())))['then'](()=>this['state']=_0x58fce9['CONNECTED'])['catch'](_0x1cd118=>{throw console['error'](_0x1cd118),new _0x5eee32('cloudservices-reconnection-error',this['context']);});}['disconnect'](){this['connection']&&this['connection']['disconnect'](),this['state']=_0x58fce9['DISCONNECTED'],this['_domEmitter']['stopListening']();}['destroy'](){this['disconnect'](),super['destroy']();}}class i extends _0x382514{['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,_0x5df8af];}constructor(_0x7fb293){super(_0x7fb293),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0x6d1a51(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x5df8af);}['init'](){const _0x4fe803=this['context']['plugins']['get'](n);this['listenTo'](_0x4fe803,'change:state',(_0x320a07,_0x285fc2,_0x4aacc7)=>{if('connected'!==_0x4aacc7)this['channelSessions']['forEach'](_0x5534f7=>_0x5534f7['clear']()),this['channelConnectedUsers']['forEach'](_0x227724=>_0x227724['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x1116b4,_0x4bf0cf]of this['_registeredSessions'])for(const _0x4dca6e of _0x4bf0cf)this['_handleSessionAdd'](_0x1116b4,_0x4dca6e);}}),this['_createUser'](_0x4fe803['connection']['me'],!0x0);}['register'](_0x4c1906,_0x4f7336){if(this['_registeredSessions']['has'](_0x4c1906))throw new _0x5eee32('sessions-register-already-registered',null,{'channelId':_0x4c1906});this['_registeredSessions']['set'](_0x4c1906,_0x4f7336),this['channelSessions']['set'](_0x4c1906,new _0x6d1a51()),this['channelConnectedUsers']['set'](_0x4c1906,new _0x6d1a51()),this['listenTo'](_0x4f7336,'add',(_0x478d1a,_0x125086)=>this['_handleSessionAdd'](_0x4c1906,_0x125086)),this['listenTo'](_0x4f7336,'remove',(_0x20f4b4,_0x1a6355)=>this['_handleSessionRemove'](_0x4c1906,_0x1a6355));for(const _0x4f034f of _0x4f7336)this['_handleSessionAdd'](_0x4c1906,_0x4f034f);}['unregister'](_0x34bbf3){if(!this['_registeredSessions']['has'](_0x34bbf3))throw new _0x5eee32('sessions-unregister-not-exist',null,{'channelId':_0x34bbf3});const _0x328ea5=this['_registeredSessions']['get'](_0x34bbf3);this['stopListening'](_0x328ea5);for(const _0x156b0b of _0x328ea5)'connected'===this['context']['plugins']['get'](n)['state']&&this['_handleSessionRemove'](_0x34bbf3,_0x156b0b);this['_registeredSessions']['delete'](_0x34bbf3),this['channelSessions']['delete'](_0x34bbf3),this['channelConnectedUsers']['delete'](_0x34bbf3);}get['mySessionId'](){return this['context']['plugins']['get'](n)['connection']['sessionId'];}['getUserBySessionId'](_0x377579){for(const _0x22da5a of this['channelSessions']['values']())for(const _0x4224aa of _0x22da5a)if(_0x4224aa['id']===_0x377579)return _0x4224aa['user'];}['getUserSessions'](_0x4f7d41,_0x2bd75e){const _0x58d40a=_0x2bd75e?[this['channelSessions']['get'](_0x2bd75e)]:this['channelSessions']['values'](),_0x3dcd4f=new Set();for(const _0x485131 of _0x58d40a)for(const _0x3d3db2 of _0x485131)_0x3d3db2['user']['id']===_0x4f7d41['id']&&_0x3dcd4f['add'](_0x3d3db2['id']);return _0x3dcd4f;}['getUserRole'](_0x1307fe){for(const _0x4286b4 of this['channelSessions']['values']())for(const _0x3608e9 of _0x4286b4)if(_0x3608e9['user']===_0x1307fe)return _0x3608e9['role'];}['_handleSessionAdd'](_0x434d60,_0x327f46){if('connected'!==this['context']['plugins']['get'](n)['state'])return;const _0x149bb2=_0x327f46['user'],_0x847228=this['_users']['getUser'](_0x149bb2['id'])||this['_createUser'](_0x149bb2),_0x3326c1=Object['assign']({},_0x327f46,{'user':_0x847228});if(this['channelSessions']['get'](_0x434d60)['add'](_0x3326c1),!_0x149bb2['hiddenInPresenceList']){const _0x185378=this['channelConnectedUsers']['get'](_0x434d60);_0x185378['has'](_0x847228['id'])||_0x185378['add'](_0x847228),this['allConnectedUsers']['has'](_0x847228['id'])||_0x149bb2['hiddenInPresenceList']||this['allConnectedUsers']['add'](_0x847228,_0x847228['isMe']?0x0:void 0x0);}this['fire']('sessionAdd:'+_0x434d60,{'channelId':_0x434d60,'session':_0x3326c1});}['_handleSessionRemove'](_0x134296,_0x2fe271){if('connected'!==this['context']['plugins']['get'](n)['state'])return;const _0x5a0f50=this['channelConnectedUsers']['get'](_0x134296),_0x19f24d=_0x2fe271['user'];_0x19f24d['id']&&(this['channelSessions']['get'](_0x134296)['remove'](_0x2fe271['id']),_0x5a0f50['has'](_0x19f24d['id'])&&!this['getUserSessions'](_0x19f24d,_0x134296)['size']&&_0x5a0f50['remove'](_0x19f24d['id']),this['allConnectedUsers']['get'](_0x19f24d['id'])&&!this['getUserSessions'](_0x19f24d)['size']&&this['allConnectedUsers']['remove'](_0x19f24d['id']));}['_createUser'](_0x34658b,_0x362c33){const _0x5ab93a=this['_users']['addUser'](_0x34658b);return _0x362c33&&this['_users']['defineMe'](_0x34658b['id']),_0x5ab93a['orderNumber']=this['_uniqueUsersCount']++,_0x5ab93a;}}class G extends _0x5020b7{['_domEmitter']=new(_0x1e311d())();static get['requires'](){return[i];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x1acedc=this['editor'],_0x2b5b5a=_0x1acedc['plugins']['get'](i);_0x1acedc['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x592ff9,{writer:_0xfabaae})=>function(_0x189ac1,_0x3ad066,_0x472738,_0x43fa44){const _0x292c07=_0x189ac1['markerName']['split'](':')[0x2],_0x1f1268=_0x472738['getUserBySessionId'](_0x292c07);if(!_0x1f1268||_0x292c07===_0x472738['mySessionId'])return;if(!_0x43fa44['model']['schema']['checkChild'](_0x189ac1['markerRange']['start'],'$text'))return;const _0x54c5f9={'class':'ck-user__marker\x20'+_0x1f1268['color']['getMarkerClass'](),'data-name':_0x1f1268['name'],'data-session-id':_0x292c07},_0x147a42=_0x43fa44['model']['markers']['get'](_0x189ac1['markerName']),_0x3412bd=_0x147a42['getStart'](),_0x40e251=_0x3412bd['nodeAfter'],_0x4e338e=_0x43fa44['model']['schema'];if(_0x40e251&&_0x4e338e['isObject'](_0x40e251)&&_0x4e338e['isInline'](_0x40e251)&&!_0x43fa44['model']['markers']['get']('user:range:'+_0x292c07)['getRange']()['isCollapsed'])return;const _0x3a2b84=_0x3412bd['parent'];return _0x43fa44['model']['schema']['isLimit'](_0x3a2b84)&&!_0x43fa44['model']['hasContent'](_0x3a2b84)&&(_0x54c5f9['contenteditable']=!0x1),function(_0x380a6a,_0x3d91a5,_0xc21f17){const _0xe7dc43=_0x380a6a['createUIElement']('span',_0x3d91a5);return _0x380a6a['setCustomProperty']('userPositionMarker',!0x0,_0xe7dc43),_0xe7dc43['render']=function(_0x5ea6c3){const _0x52b2c8=this['toDomElement'](_0x5ea6c3),_0x460a15=document['createElement']('span');return _0x460a15['classList']['add']('ck-user__marker-tooltip'),_0x460a15['setAttribute']('contenteditable','false'),_0x460a15['setAttribute']('spellcheck','false'),_0x460a15['textContent']=_0xc21f17['name'],_0x52b2c8['innerHTML']='<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span>'+_0x460a15['outerHTML']+'',_0x52b2c8['addEventListener']('mouseenter',()=>{_0x52b2c8['classList']['add']('ck-user__marker_hovered');}),_0x52b2c8['addEventListener']('mouseleave',()=>{_0x52b2c8['classList']['remove']('ck-user__marker_hovered');}),_0x52b2c8;},_0xe7dc43['isSimilar']=function(_0x205739){return!(!this['getCustomProperty']('userPositionMarker')||!_0x205739['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0x205739['getAttribute']('data-session-id'));},_0xe7dc43;}(_0x3ad066,_0x54c5f9,_0x1f1268);}(_0x592ff9,_0xfabaae,_0x2b5b5a,_0x1acedc)}),_0x1acedc['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0xde3611=>function(_0x383817,_0x5452c1){const _0x16bcc5=_0x383817['markerName']['split'](':')[0x2];if(_0x16bcc5===_0x5452c1['mySessionId'])return null;const _0x547254=_0x5452c1['getUserBySessionId'](_0x16bcc5);if(!_0x547254)return{'id':_0x16bcc5,'classes':[]};return{'id':_0x16bcc5,'classes':['ck-user__selection',_0x547254['color']['getSelectionClass']()],'attributes':{'data-session-id':_0x16bcc5},'priority':0x7d0+_0x547254['orderNumber']};}(_0xde3611,_0x2b5b5a)}),function(_0x39ad16){const _0xb038f4=_0x39ad16['model'],_0x5c48c6=new Map(),_0x1fc8ea=_0x39ad16['plugins']['get'](i);_0xb038f4['markers']['on']('update:user:range',(_0xc5093a,_0x56cf52,_0x5f1e3f,_0x1bdbce)=>{if(!_0x1bdbce&&_0x5c48c6['get'](_0x56cf52['name']))return _0x5c48c6['get'](_0x56cf52['name'])['detach'](),void _0x5c48c6['delete'](_0x56cf52['name']);const _0x278b6b=_0x56cf52['name']['split'](':')[0x2];if(_0x278b6b===_0x1fc8ea['mySessionId'])return;const _0x3e031f='user:position:'+_0x278b6b;_0xb038f4['markers']['has'](_0x3e031f)&&_0x39ad16['editing']['reconvertMarker'](_0x3e031f),_0x56cf52['on']('change:range',(_0x62b611,_0x50d771,_0x353e91)=>{if('$graveyard'!=_0x50d771['root']['rootName']&&'$graveyard'==_0x56cf52['getRange']()['root']['rootName']&&!_0x5c48c6['has'](_0x56cf52['name'])){const _0x6d4ecc=_0xb038f4['schema']['getNearestSelectionRange'](_0x353e91['deletionPosition']);if(_0x6d4ecc){const _0xf3ee10=_0x578e05['fromRange'](_0x6d4ecc);_0x5c48c6['set'](_0x56cf52['name'],_0xf3ee10),_0xf3ee10['on']('change:range',(_0x484e95,_0x5bee32,_0x5be711)=>{if('$graveyard'==_0xf3ee10['root']['rootName']){const _0x22dea6=_0xb038f4['schema']['getNearestSelectionRange'](_0x5be711['deletionPosition']);_0x22dea6?(_0xf3ee10['start']=_0x22dea6['start'],_0xf3ee10['end']=_0x22dea6['end']):(_0x5c48c6['delete'](_0x56cf52['name']),_0xf3ee10['detach']());}});}}});}),_0xb038f4['document']['on']('change',()=>{_0x5c48c6['size']>0x0&&_0xb038f4['enqueueChange']({'isUndoable':!0x1},_0x3f773c=>{for(const [_0x5ba322,_0x186919]of _0x5c48c6)'$graveyard'==_0xb038f4['markers']['get'](_0x5ba322)['getRange']()['root']['rootName']&&(te(_0x5ba322['split'](':')[0x2],_0x186919['toRange'](),_0xb038f4,_0x3f773c),_0x186919['detach']());_0x5c48c6['clear']();});});}(_0x1acedc),this['_domEmitter']['listenTo'](_0x423bdf['document'],'keydown',(_0x297406,{key:_0x3ac08a})=>{'Escape'===_0x3ac08a&&function(_0x45da29){_0x45da29['editing']['view']['change'](_0x3299e6=>{for(const _0x4e52b5 of _0x45da29['model']['markers']){if(!_0x4e52b5['name']['startsWith']('user:position'))continue;const _0x45e319=_0x45da29['editing']['mapper']['markerNameToElements'](_0x4e52b5['name']);if(_0x45e319){for(const _0x175230 of _0x45e319)_0x3299e6['removeClass']('ck-user__marker_hovered',_0x175230);}}});}(_0x1acedc);},{'useCapture':!0x0});}['afterInit'](){const _0x601a6f=this['editor'],_0x10aa5f=_0x601a6f['commands']['get']('undo');_0x10aa5f&&_0x601a6f['model']['on']('applyOperation',(_0xccbb44,_0x22554d)=>{const _0x390453=_0x22554d[0x0];if(!_0x390453['isDocumentOperation'])return;if('marker'!=_0x390453['type']||!_0x390453['name']['startsWith']('user:'))return;const _0x400f67=_0x390453['batch'];_0x10aa5f['_createdBatches']['has'](_0x400f67)&&(_0x390453['newRange']=_0x390453['oldRange']?_0x601a6f['model']['createRange'](_0x390453['oldRange']['start'],_0x390453['oldRange']['end']):null);},{'priority':'highest'});}['destroy'](){return this['_domEmitter']['stopListening'](),super['destroy']();}['createUserMarkerOperations'](){const _0x3f6248=this['editor'],_0x3f546b=_0x3f6248['model']['document'],_0x38af93=_0x3f6248['plugins']['get'](i);_0x3f6248['model']['enqueueChange']({'isUndoable':!0x1},_0x1fdd42=>{const _0xfd3d58='user:range:'+_0x38af93['mySessionId'],_0x3f2054='user:position:'+_0x38af93['mySessionId'],_0x4eb701=_0x3f6248['model']['markers']['has'](_0xfd3d58);_0x3f6248['editing']['view']['hasDomSelection']?te(_0x38af93['mySessionId'],_0x3f546b['selection']['getFirstRange'](),_0x3f6248['model'],_0x1fdd42):_0x4eb701&&(_0x1fdd42['removeMarker'](_0xfd3d58),_0x1fdd42['removeMarker'](_0x3f2054));});}}function te(_0x3c5714,_0x4c6340,_0x5e771b,_0x5db94e){const _0xda7b3c='user:range:'+_0x3c5714,_0x26385a='user:position:'+_0x3c5714,_0xbff46d=_0x4c6340['getContainedElement']();let _0x61010c=_0x4c6340['start'];if(_0xbff46d&&_0xbff46d['is']('element','tableCell')){const _0x2ccafd=function(_0x405170,_0x1e9a82){for(const _0x3199f4 of _0x405170['getPositions']())if(_0x1e9a82['schema']['checkChild'](_0x3199f4,'$text'))return _0x3199f4;}(_0x4c6340,_0x5e771b);_0x2ccafd&&(_0x61010c=_0x2ccafd,_0x4c6340=_0x5db94e['createRange'](_0x61010c));}const _0x3b182c=_0x5db94e['createRange'](_0x61010c);_0x5e771b['markers']['has'](_0xda7b3c)?(_0x5db94e['updateMarker'](_0xda7b3c,{'range':_0x4c6340}),_0x5db94e['updateMarker'](_0x26385a,{'range':_0x3b182c})):(_0x5db94e['addMarker'](_0xda7b3c,{'range':_0x4c6340,'usingOperation':!0x0}),_0x5db94e['addMarker'](_0x26385a,{'range':_0x3b182c,'usingOperation':!0x0}));}function $(_0xa0dfcf,_0x49df05,_0x37eaaa){const _0x453c62=_0xa0dfcf['t'],t=_0xa0dfcf['t'];switch(_0x49df05){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 _0x453c62({'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'},_0x37eaaa);default:return'';}}let Q=0x1;class l extends _0x5020b7{static ['CollaborativeEditingService']=/* #__PURE__ -- @preserve */
|
|
25
|
+
((()=>_0x18f578)());['_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,_0xfa099b,_0x5df8af,_0x1dfd40];}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 _0x441ca9=this['serverHistory']['getOperations']();for(let _0x490d5c=_0x441ca9['length']-0x1;_0x490d5c>=0x0;_0x490d5c--){const _0xddc73c=_0x441ca9[_0x490d5c];if(!this['_disconnectionOperations']['has'](_0xddc73c))return _0xddc73c['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0x1ee5af){if(super(_0x1ee5af),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x1fc730(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0x5eee32('collaboration-missing-channelid',this);const _0xd33b3=_0x1ee5af['config']['get']('cloudServices.bundleVersion')||nt;this['_service']=new l['CollaborativeEditingService'](_0xd33b3,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0x5bed56(),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 _0x2dfa8=this['editor'],_0x1b59ea=_0x2dfa8['plugins']['get'](_0x5df8af),_0x27dd2e=_0x2dfa8['plugins']['get'](n);this['listenTo'](_0x1b59ea,'getOperationAuthor',(_0x3b2638,_0x55da15)=>{const _0x26d6b7=_0x55da15[0x0];_0x26d6b7['_authorId']&&(_0x3b2638['return']=_0x1b59ea['getUser'](_0x26d6b7['_authorId']),_0x3b2638['stop']()),null===_0x26d6b7['_authorId']&&(_0x3b2638['return']=null,_0x3b2638['stop']());},{'priority':'high'}),this['listenTo'](_0x2dfa8['model']['document']['selection'],'change:range',(_0xa69a43,_0x4e2ef8)=>{_0x4e2ef8['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x2dfa8['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x2dfa8['model']['on']('applyOperation',(_0x1402fe,_0x34d437)=>{const _0x37e82e=_0x34d437[0x0];_0x37e82e['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0x37e82e),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['bind']('_isEditingAllowed')['to'](_0x27dd2e,'state',this,'_hasSynchronizationProblem',(_0x55572b,_0x546a71)=>'connected'===_0x55572b&&!_0x546a71),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x2dfa8['disableReadOnlyMode']('rtc-offline'):_0x2dfa8['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x2dfa8['disableReadOnlyMode']('rtc-offline'):_0x2dfa8['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async['reconnect'](){const _0x50511e=this['editor']['plugins']['get'](i),_0x1a8b32=this['editor']['plugins']['get'](n);try{this['_isPendingUpdate']=!0x0,_0x50511e['unregister'](this['_channelId']);const _0x197f04=await this['_service']['reconnect'](_0x1a8b32['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0x197f04)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x366355=await this['_service']['getConnectedSessions']();_0x50511e['register'](this['_channelId'],_0x366355),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x35b344){if(function(_0x16323e){return'404'===_0x16323e['code'];}(_0x35b344)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0x4480d0){return'409'===_0x4480d0['code'];}(_0x35b344)){const _0x2c7f45=$(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'](_0x2c7f45);}else{if(!(_0x35b344 instanceof X))throw _0x35b344;this['_handleReconnectionError']();}}}}['destroy'](){const _0x5d9906=this['editor']['plugins']['get'](n),_0x567eef=this['editor']['plugins']['get'](i);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x567eef['channelSessions']['has'](this['_channelId'])&&_0x567eef['unregister'](this['_channelId']),_0x5d9906['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async['_handleReconnectionResponse'](_0x2def33){if(this['sessionId']!==_0x2def33['sessionId']&&this['_lastSyncedOperationId']!==_0x2def33['lastOperationId'])throw new X();return this['sessionId']=_0x2def33['sessionId'],this['_handleServerResponse']([],{..._0x2def33,'wereChangesApplied':!0x1,'data':_0x2def33['data']},'reconnect');}async['_connectService'](_0x4ffb90,_0x229e64=!0x1){const {connection:_0x37bc79}=this['editor']['plugins']['get'](n);l['CollaborativeEditingService']['getConnectedSessions'](_0x37bc79,this['_channelId'])['then'](_0xff718a=>this['_initSessionsHandling'](_0xff718a))['catch'](_0x23b826=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x23b826);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x29852d,_0x1b5d26)=>{this['_crash']('realtimecollaborationclient-init-service-internal-error',_0x1b5d26);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_isConnected']=!0x1;});const _0x183ab4=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x4ffb90);this['_isPendingUpdate']=!0x0;const _0x448652=await this['_service']['connect'](_0x37bc79,this['_compressOperations'](_0x4ffb90),_0x183ab4);if(this['sessionId']=_0x448652['sessionId'],_0x229e64){if(!_0x448652['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x448652['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0x4ffb90,_0x448652,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x448652,_0x4ffb90);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}['_handleSendingSelectionMarkers'](){const _0x518c83=this['editor']['plugins']['get'](i),_0x20137d=this['editor']['plugins']['get'](G),_0x353d87=_0x518c83['channelSessions']['get'](this['_channelId']);_0x353d87&&_0x353d87['length']>0x1?_0x20137d['createUserMarkerOperations']():this['listenTo'](_0x518c83,'sessionAdd:'+this['_channelId'],()=>{0x2===_0x518c83['channelSessions']['get'](this['_channelId'])['length']&&_0x20137d['createUserMarkerOperations']();});}async['_handleReceivedOperations'](_0x42e674,_0x3da53f,_0x4a07a1,_0x376057){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x3da53f){const _0x316288=this['_decompressOperations'](_0x4a07a1,_0x376057);await this['_fetchMissingUsers'](_0x316288),this['_handleExternalOperations'](_0x316288,_0x3da53f,_0x4a07a1['lastOperationId'])||this['_crash']('realtimecollaborationclient-init-service-incorrect-server-operation');}}async['_connectAfterSessionHasBeenFlushed'](){this['_disconnectService']();const {locale:_0x299ee9}=this['editor'];let _0x10b674;try{_0x10b674=await this['_service']['getDocumentDetails']();}catch{const _0x34a45a=$(_0x299ee9,'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'](_0x34a45a);}const _0x2dceb8=_0x10b674['currentDocumentSession']||_0x10b674['lastDocumentSession'];if(this['_lastSyncedOperationId']!==_0x2dceb8['lastOperationId']){const _0x493333=$(_0x299ee9,'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'](_0x493333);}await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);}['_disconnectService'](){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['stopListening'](this['_service']);}['_initSessionsHandling'](_0x2f3017){const _0x22d9e0=this['editor']['plugins']['get'](i);this['listenTo'](_0x22d9e0,'sessionAdd:'+this['_channelId'],(_0xff67e6,{session:_0x59ce46})=>{if(_0x59ce46['id']===_0x22d9e0['mySessionId']){_0xff67e6['off']();const _0x583cb1=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0x462e8d=_0x59ce46['permissions'];_0x583cb1&&_0x583cb1['isEnabled']&&(_0x462e8d=_0x462e8d['filter'](_0x2fd889=>'document:write'!==_0x2fd889)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0x462e8d,this['_channelId']);}}),_0x22d9e0['register'](this['_channelId'],_0x2f3017);}['_initThrowingOnDataSet'](){const _0x302c1e=this['editor']['data']['set'];this['editor']['data']['set']=(..._0x4c0638)=>{if(!_0x4c0638[_0x4c0638['length']-0x1]['suppressErrorInCollaboration'])throw new _0x5eee32('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x302c1e['apply'](this['editor']['data'],_0x4c0638);};}['_setUpDataInit'](){this['editor']['data']['on']('init',(_0x6e41bf,[_0x3b824b])=>{if(this['_document']['version'])throw new _0x5eee32('realtimecollaborationclient-init-document-already-initialized',this);_0x6e41bf['stop'](),this['_setPendingAction']();const _0x5a1441=this['editor']['config']['get']('rootsAttributes'),_0x224851=this['_getOperationsFromInitData'](_0x3b824b,_0x5a1441);0x0==_0x224851['length']&&_0x224851['push'](new _0x158a54(0x0)),_0x6e41bf['return']=this['_connectService'](_0x224851)['then'](()=>{this['editor']['plugins']['get'](n)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x54ec63=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x54ec63))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x1f2ebe,[_0x2a8f38,_0x381ac6])=>{_0x1f2ebe['stop']();const _0x421f2b=this['editor']['model']['document']['getRoot'](_0x2a8f38);if(!this['_knownRootNames']['has'](_0x2a8f38)){const _0x4e28e9=_0x381ac6&&_0x381ac6['data']?_0x381ac6['data']:'',_0x1baf9b=_0x381ac6&&_0x381ac6['attributes']?_0x381ac6['attributes']:{};await this['_loadRoot'](_0x2a8f38,_0x4e28e9,_0x1baf9b);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0x421f2b['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0x421f2b);});},{'priority':'high'});}async['_fetchMissingUsers'](_0x25ae68){const _0x55d7cf=this['editor']['plugins']['get'](_0x5df8af),{connection:_0x17871b}=this['editor']['plugins']['get'](n),_0x552d9e=new Set();for(const _0x53dd21 of _0x25ae68){const _0x414492=_0x53dd21['_authorId'];_0x414492&&!_0x55d7cf['getUser'](_0x414492)&&_0x552d9e['add'](_0x414492);}if(0x0===_0x552d9e['size'])return;const _0x36eff9=await ct['getMany'](_0x17871b,Array['from'](_0x552d9e));for(const _0x23a61f of _0x36eff9)_0x55d7cf['getUser'](_0x23a61f['id'])||_0x55d7cf['addUser'](_0x23a61f);}['_getOperationsFromInitData'](_0x559d63,_0x40f6b0={}){const _0x2d90a1=this['editor']['model'],_0x321e84=[];let _0x5e5d9d=0x0;const _0x4a6e0b='string'==typeof _0x559d63?{'main':_0x559d63}:_0x559d63;for(const _0x45bf8f of Object['keys'](_0x4a6e0b)){if(!this['_document']['roots']['has'](_0x45bf8f))throw new _0x5eee32('realtimecollaborationclient-init-non-existent-root',this);const _0x508299=this['editor']['data']['parse'](_0x4a6e0b[_0x45bf8f]),_0x5bbc0c=this['_document']['getRoot'](_0x45bf8f),_0xe8428d=new _0x159a57(_0x2d90a1['createPositionAt'](_0x5bbc0c,0x0),_0x508299,_0x5e5d9d++);_0x321e84['push'](_0xe8428d);for(const [_0x235d90,_0x4f41a3]of _0x508299['markers']){const _0xe66487=_0x2d90a1['createRange'](_0x2d90a1['createPositionFromPath'](_0x5bbc0c,_0x4f41a3['start']['path']['slice']()),_0x2d90a1['createPositionFromPath'](_0x5bbc0c,_0x4f41a3['end']['path']['slice']())),_0x437a46=new _0x45b8bd(_0x235d90,null,_0xe66487,_0x2d90a1['markers'],!0x0,_0x5e5d9d++);_0x321e84['push'](_0x437a46);}}if(_0x40f6b0)for(const [_0x4e6800,_0x995a08]of Object['entries'](_0x40f6b0)){const _0xc2c7e0=_0x2d90a1['document']['getRoot'](_0x4e6800);if(!_0xc2c7e0)throw new _0x5eee32('multi-root-editor-root-attributes-no-root',null);for(const [_0x1956e9,_0x3f2afe]of Object['entries'](_0x995a08))if(null!==_0x3f2afe){const _0x47aed5=new _0x51c0ef(_0xc2c7e0,_0x1956e9,null,_0x3f2afe,_0x5e5d9d++);_0x321e84['push'](_0x47aed5);}}return _0x321e84;}async['_loadRoot'](_0x43d010,_0x1b879a,_0x306f77){this['_getOperationsFromInitData']({[_0x43d010]:_0x1b879a},{[_0x43d010]:_0x306f77})['forEach']((_0x4d64ea,_0x59d444)=>{_0x4d64ea['baseVersion']=this['_document']['version']+_0x59d444,_0x4d64ea['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x4d64ea);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async['_handleInitialConnectionData'](_0x4e5e0a,_0x3c3b7d){let _0x5ee904;this['_offset']=_0x4e5e0a['offset'];const _0x3ff7eb=_0x4e5e0a['wereChangesApplied']&&!_0x4e5e0a['initData'],_0x2f2b86=_0x3ff7eb?0x0:_0x4e5e0a['data']['baseVersion'];if(_0x3c3b7d['forEach'](_0x257670=>{_0x257670['_isInit']=!0x0,_0x257670['createdAt']=_0x4e5e0a['sessionCreatedAt'],_0x257670['_authorId']=null;}),_0x3ff7eb)_0x5ee904=_0x3c3b7d,this['_applyOperationsSet'](_0x5ee904,_0x3ff7eb);else{if(_0x4e5e0a['initData']){const _0x46b2ed=this['_getOperationsFromInitData'](_0x4e5e0a['initData']);this['_document']['history']['version']=-_0x46b2ed['length'],_0x46b2ed['forEach'](_0x2969c8=>{_0x2969c8['baseVersion']-=_0x46b2ed['length'],_0x2969c8['createdAt']=_0x4e5e0a['sessionCreatedAt'],_0x2969c8['_isInit']=!0x0,_0x2969c8['_authorId']=null;}),this['_applyOperationsSet'](_0x46b2ed,!0x0),this['serverHistory']['version']=-_0x46b2ed['length']+this['_offset'],this['_updateServerHistory'](_0x46b2ed);}this['_document']['history']['version']=_0x2f2b86,_0x5ee904=this['_decompressOperations'](_0x4e5e0a['data'],_0x4e5e0a['metadata']),await this['_fetchMissingUsers'](_0x5ee904),this['_applyOperationsSet'](_0x5ee904,_0x3ff7eb);}_0x4e5e0a['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x5ee904,_0x4e5e0a['lastOperationId']),this['_lastSyncedOperationId']=_0x4e5e0a['lastOperationId']),this['serverHistory']['version']=_0x2f2b86+this['_offset'],this['_updateServerHistory'](_0x5ee904),_0x3c3b7d['filter'](_0x145bd4=>{const _0x56f344=this['_getAffectedRoot'](_0x145bd4);return _0x56f344&&!this['_knownRootNames']['has'](_0x56f344);})['forEach']((_0x12ba49,_0xa5f182)=>{_0x12ba49['baseVersion']=this['_document']['version']+_0xa5f182,this['_saveOperationInBuffer'](_0x12ba49);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x3254b9,_0x3cf527){const _0x626a71=_0x3cf527&&_0x3cf527['message'];if(_0x626a71&&_0x626a71['startsWith']('realtimecollaborationclient'))throw _0x3cf527;const _0x5bac5b=this['editor']['plugins']['get'](n);throw this['_isPendingUpdate']=!0x0,_0x5bac5b['disconnect'](),this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0x5eee32(_0x3254b9,this['editor'],_0x626a71?{'originalError':_0x626a71}:void 0x0);}['_saveOperationInBuffer'](_0x41f42b){this['_knownOperations']['has'](_0x41f42b)||(this['_knownOperations']['add'](_0x41f42b),this['_bufferedOperations']['push'](_0x41f42b),this['_pendingAction']||'marker'==_0x41f42b['type']&&!_0x41f42b['affectsData']||this['_setPendingAction']());}['_sendBufferedOperationsDelayed'](_0xc895cd=!0x1){!_0xc895cd&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0x530a25=>{_0x530a25&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0x1a4581=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0x3042b4){return _0x3042b4['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x3042b4['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0x3042b4['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0x1a4581)||this['_crash'](_0x1a4581['message'],_0x1a4581);});},this['_currentBufferDelay']));}['_waitUntilSynced'](){return new Promise(_0x5a57d0=>{this['on']('change:_isPendingUpdate',()=>{_0x5a57d0();});});}async['_sendBufferedOperations'](){const _0x16a5b6=this['editor']['plugins']['get'](G);if(this['_shouldSendSelectionUpdate']()&&(_0x16a5b6['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x20f9a7=[...this['_bufferedOperations']];for(const _0x5d7a26 of _0x20f9a7)_0x5d7a26['wasUndone']=this['_document']['history']['isUndoneOperation'](_0x5d7a26);const _0x213cf6=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x20f9a7),_0x2e1010=Q++,_0xa19ad3=this['_compressOperations'](_0x20f9a7),_0x78dec9=await this['_service']['sendOperations'](_0xa19ad3,_0xa19ad3['baseVersion'],_0x213cf6);try{return await this['_handleServerResponse'](_0x20f9a7,_0x78dec9,_0x2e1010);}catch(_0x1d8337){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0x1d8337);}}async['_handleServerResponse'](_0x38d512,_0x5d47ee,_0x45a3d4){if('error'in _0x5d47ee)throw _0x5d47ee['error'];let _0xe4fac2=!0x1;if(_0x5d47ee['wereChangesApplied']){_0x5d47ee['lastOperationId']&&(this['_lastSyncedOperationId']=_0x5d47ee['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x543705=>!_0x38d512['includes'](_0x543705));for(const _0x174ed7 of _0x38d512)_0x174ed7['createdAt']='lastOperationAcceptedAt'in _0x5d47ee&&_0x5d47ee['lastOperationAcceptedAt']||void 0x0;Y(_0x38d512,_0x5d47ee['version']-_0x38d512['length']),this['_updateServerHistory'](_0x38d512);const _0x41a0c1=_0x38d512['filter'](_0x20f28a=>{if(!_0x20f28a['_isInit'])return!0x1;const _0xb37c2f=this['_getAffectedRoot'](_0x20f28a);return _0xb37c2f&&!this['_knownRootNames']['has'](_0xb37c2f);});Y(_0x41a0c1,this['_document']['version']),this['_applyOperationsSet'](_0x41a0c1),_0xe4fac2=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0x5d37a7=this['_decompressOperations'](_0x5d47ee['data'],_0x5d47ee['metadata'])['filter'](_0x344068=>_0x344068['baseVersion']>=this['_lastServerVersion']);_0x5d37a7['forEach'](_0x537438=>this['_addKnownRoot'](_0x537438)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x58470a=>!_0x58470a['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x58470a))),this['_bufferedOperations']['length']&&Y(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0x5d37a7),_0xe4fac2=this['_handleExternalOperations'](_0x5d37a7,_0x5d47ee['version'],_0x5d47ee['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0xe4fac2?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}['_handleExternalOperations'](_0x26bbc0,_0x2b21ff,_0x330f08){try{const _0x18b71b={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x83414b,operationsB:_0x11ff2a,originalOperations:_0x5dace0}=_0x5237c5(_0x26bbc0,this['_bufferedOperations'],_0x18b71b);Y(_0x83414b,this['_document']['version']),Y(_0x11ff2a,_0x2b21ff);for(const _0x421e33 of _0x83414b){const _0xfff642=_0x5dace0['get'](_0x421e33);_0x421e33['_authorId']=_0xfff642?_0xfff642['_authorId']:null;}_0x330f08&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x26bbc0,_0x330f08),this['_lastSyncedOperationId']=_0x330f08),this['_bufferedOperations']=[..._0x11ff2a],this['_applyOperationsSet'](_0x83414b),this['_updateServerHistory'](_0x26bbc0);}catch(_0x568d17){return console['error'](_0x568d17),!0x1;}return!0x0;}['_applyOperationsSet'](_0x71c87f,_0x33df83=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0x5a10c7=>{for(const _0x3a381a of _0x71c87f)this['_knownOperations']['add'](_0x3a381a),this['_addKnownRoot'](_0x3a381a),_0x5a10c7['batch']['addOperation'](_0x3a381a),this['editor']['model']['applyOperation'](_0x3a381a);});}['_addKnownRoot'](_0x171146){const _0x2846da=this['_getAffectedRoot'](_0x171146);_0x2846da&&this['_knownRootNames']['add'](_0x2846da);}['_getAffectedRoot'](_0x2dc722){let _0x357c6d,_0x1a42eb;switch(_0x2dc722['type']){case'insert':_0x357c6d=_0x2dc722['position']['root'];break;case'marker':if(_0x1a42eb=_0x2dc722['newRange'],!_0x1a42eb)return null;_0x357c6d=_0x1a42eb['root'];break;case'addRootAttribute':_0x357c6d=_0x2dc722['root'];break;case'addRoot':_0x357c6d=_0x2dc722['affectedSelectable'];break;case'move':_0x357c6d=_0x2dc722['targetPosition']['root'];break;default:return null;}return _0x357c6d['rootName'];}['_updateServerHistory'](_0xd8b11b){_0xd8b11b['forEach'](_0x2039a6=>{const _0x32857a=_0x2039a6['clone']();_0x32857a['_authorId']=_0x2039a6['_authorId'],_0x32857a['_isInit']=!!_0x2039a6['_isInit'],_0x32857a['createdAt']=_0x2039a6['createdAt'],_0x32857a['baseVersion']+=this['_offset'],_0x2039a6['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x32857a),this['serverHistory']['addOperation'](_0x32857a);});}['_handleReconnectionError'](_0x457c2e){const _0x55e939=this['editor']['plugins']['get']('Notification'),_0x59efb1=this['editor']['locale'];_0x457c2e||(_0x457c2e=$(_0x59efb1,'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.')),_0x55e939['showWarning'](_0x457c2e,{'title':$(_0x59efb1,'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'](_0xfa099b)['add']($(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}['_clearPendingAction'](){this['_pendingAction']&&(this['editor']['plugins']['get'](_0xfa099b)['remove'](this['_pendingAction']),this['_pendingAction']=null);}['_compressOperations'](_0x224f09){const _0x4ec6b4=_0x224f09['map'](_0x14546f=>_0x14546f['toJSON']());return this['_compressor']['compress'](_0x4ec6b4);}['_decompressOperations'](_0x1f37bf,_0x535642){return this['_compressor']['decompress'](_0x1f37bf)['map']((_0x2a5096,_0x25a2c2)=>{const _0x45ceab='init'==_0x535642[_0x25a2c2]['type'];if('InsertOperation'==_0x2a5096['__className']){const _0x54628d=_0x2a5096['position']['root'];!this['_document']['getRoot'](_0x54628d)&&(this['_document']['createRoot']('$root',_0x54628d)['_isAttached']=!0x1);}const _0x1e3c7=_0x49b61a['fromJSON'](_0x2a5096,this['_document']);return _0x1e3c7['wasUndone']=_0x2a5096['wasUndone'],_0x1e3c7['_isInit']=_0x45ceab,_0x1e3c7['_authorId']=_0x45ceab?null:_0x535642[_0x25a2c2]['userId'],_0x1e3c7['_isDisconnection']='cs:removeUser'===_0x535642[_0x25a2c2]['type'],_0x1e3c7['createdAt']=_0x535642[_0x25a2c2]['createdAt'],_0x1e3c7;});}['_refreshUserSelectionMarkers'](){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}['_shouldSendSelectionUpdate'](){const _0xfb7b4=this['editor']['plugins']['get'](i)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0xfb7b4&&_0xfb7b4['length']>0x1&&this['_hasSelectionChanged'];}['_shouldSendUpdate'](){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}}class X extends Error{}function Y(_0x7ce543,_0x14601f){for(const _0x373450 of _0x7ce543)_0x373450['baseVersion']=_0x14601f++;}class Z{['_ignoredOperations'];['_operationToId'];constructor(_0x4b715e){this['_ignoredOperations']=_0x4b715e,this['_operationToId']=new WeakMap();}['getIdOfTheLastOperation'](_0x4bc76e){let _0x470083=_0x4bc76e['length'];for(;_0x470083--;){const _0x12ce83=_0x4bc76e[_0x470083];if(!this['_ignoredOperations']['has'](_0x12ce83)){if(!this['_operationToId']['has'](_0x12ce83)){const _0xc9c51f=_0x26c052()['slice'](0x1,0x12);this['_operationToId']['set'](_0x12ce83,_0xc9c51f);}return this['_operationToId']['get'](_0x12ce83);}}}['setIdForTheLastOperation'](_0x189931,_0x488ad6){if(!_0x488ad6)return;let _0x146d98=_0x189931['length'];for(;_0x146d98--;){const _0x5102c0=_0x189931[_0x146d98];this['_ignoredOperations']['has'](_0x5102c0)||this['_operationToId']['set'](_0x5102c0,_0x488ad6);}}}class a extends _0x5020b7{static get['requires'](){return[l];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class s extends _0x382514{static ['CommentsService']=/* #__PURE__ -- @preserve */
|
|
26
|
+
((()=>_0x8fe397)());['_services'];static get['requires'](){return[n,'CommentsRepository',i,_0x5df8af];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x34d6b4){super(_0x34d6b4),this['_services']=new Map();}async['init'](){const _0xe9489d=this['context'],_0x1a52cb=_0xe9489d['plugins']['get']('CommentsRepository');if(_0xe9489d['plugins']['get'](n)['addToReconnectionStack'](this),_0x1a52cb['adapter']={'addCommentThread':async({channelId:_0x3dd475,threadId:_0x1a768a,comments:_0x26ddfa,resolvedAt:_0x37ae8b,resolvedBy:_0x4ddecd,context:_0x1b043c,attributes:_0x371bad})=>{const _0x1f3589=await this['_getService'](_0x3dd475)['addCommentThread']({'commentThreadId':_0x1a768a,'comments':_0x26ddfa['map'](_0x2ae54a=>function(_0x271633,_0x3c00cd,_0x3da5d7){return{'commentThreadId':_0x3da5d7,'commentId':_0x271633['commentId'],'userId':_0x271633['authorId'],'content':_0x271633['content'],'documentId':_0x3c00cd,'createdAt':_0x271633['createdAt'],'attributes':_0x271633['attributes']||{}};}(_0x2ae54a,_0x3dd475,_0x1a768a)),'resolvedAt':_0x37ae8b,'resolvedBy':_0x4ddecd,'context':_0x1b043c,'attributes':_0x371bad})['catch'](at);return{'threadId':_0x1f3589['commentThreadId'],'comments':_0x1f3589['comments']};},'getCommentThread':async({channelId:_0x1cc195,threadId:_0x272602})=>{const _0x42a4cc=await this['_getService'](_0x1cc195)['getCommentThread'](_0x272602)['catch'](F)['catch'](at);return _0x42a4cc?_0x42a4cc['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0x42a4cc]),{'threadId':_0x42a4cc['commentThreadId'],'comments':_0x42a4cc['comments']['map'](S),'context':_0x42a4cc['context'],'resolvedAt':_0x42a4cc['resolvedAt'],'resolvedBy':_0x42a4cc['resolvedBy'],'attributes':_0x42a4cc['attributes']||{}}):null;},'updateCommentThread':async({channelId:_0x2fa887,threadId:_0x166c60,context:_0x31bb7e,unlinkedAt:_0x4c0e40,attributes:_0x265792})=>this['_getService'](_0x2fa887)['updateCommentThread']({'commentThreadId':_0x166c60,'context':_0x31bb7e,'attributes':_0x265792,'unlinkedAt':_0x4c0e40})['catch'](F)['catch'](at),'resolveCommentThread':async({channelId:_0x1203e7,threadId:_0x2eee0a})=>{const _0x1bec92=await this['_getService'](_0x1203e7)['resolveCommentThread'](_0x2eee0a)['catch'](F)['catch'](at);return{'threadId':_0x1bec92['commentThreadId'],'resolvedAt':_0x1bec92['resolvedAt'],'resolvedBy':_0x1bec92['resolvedBy']};},'reopenCommentThread':async({channelId:_0x3b4b40,threadId:_0x3a4693})=>this['_getService'](_0x3b4b40)['reopenCommentThread'](_0x3a4693)['catch'](F)['catch'](at),'removeCommentThread':({channelId:_0xc5289,threadId:_0xd74a12})=>this['_getService'](_0xc5289)['removeCommentThread'](_0xd74a12)['catch'](F)['catch'](at),'addComment':({channelId:_0x13f3f3,threadId:_0x2d56ad,commentId:_0x5583d8,content:_0x277482,attributes:_0x2598a4})=>this['_getService'](_0x13f3f3)['addComment'](_0x2d56ad,_0x5583d8,_0x277482,_0x2598a4)['catch'](at),'updateComment':({channelId:_0x687aa0,threadId:_0x100482,commentId:_0x4e8dd1,content:_0x57b1b9,attributes:_0x3ef358})=>this['_getService'](_0x687aa0)['updateComment'](_0x100482,_0x4e8dd1,_0x57b1b9,_0x3ef358)['catch'](F)['catch'](at),'removeComment':({channelId:_0x4e7569,threadId:_0x5eea48,commentId:_0x4f6403})=>this['_getService'](_0x4e7569)['removeComment'](_0x5eea48,_0x4f6403)['catch'](F)['catch'](at)},_0xe9489d instanceof _0x1bb185){const _0x2ca37d=_0xe9489d['config']['get']('collaboration.channelId'),_0x4bb19e=_0xe9489d['plugins']['get'](i);await this['_setUpService'](_0x2ca37d);const _0x3fc12f=await this['_services']['get'](_0x2ca37d)['getConnectedSessions']();this['listenTo'](_0x4bb19e,'sessionAdd:'+_0x2ca37d,(_0x41888a,{session:_0x2e6632})=>{_0x2e6632['id']===_0x4bb19e['mySessionId']&&(_0x41888a['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x2e6632['permissions'],_0x2ca37d));}),_0x4bb19e['register'](_0x2ca37d,_0x3fc12f);}}async['_setUpService'](_0x134c42){if(this['_services']['has'](_0x134c42))throw new _0x5eee32('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0x134c42});const _0x1b9f91=this['context']['plugins']['get']('CommentsRepository'),_0x4071ee=new s['CommentsService'](_0x134c42);this['_services']['set'](_0x134c42,_0x4071ee),this['listenTo'](_0x4071ee,'commentThreadAdded',(_0x4da69f,_0x5aedda)=>{const {commentThreadId:_0x2338a2,documentId:_0x2d5ea9,context:_0xb2892,attributes:_0x5b5e1a,resolvedAt:_0x3ec700,resolvedBy:_0x13015e,comments:_0x30fcdc}=_0x5aedda;_0x1b9f91['getCommentThread'](_0x2338a2)||_0x1b9f91['addCommentThread']({'threadId':_0x2338a2,'channelId':_0x2d5ea9,'comments':_0x30fcdc?_0x30fcdc['map'](S):[],'context':_0xb2892,'attributes':_0x5b5e1a,'resolvedAt':_0x3ec700,'resolvedBy':_0x13015e,'isFromAdapter':!0x0});}),this['listenTo'](_0x4071ee,'commentThreadUpdated',(_0xced8ac,{commentThreadId:_0xdaf22b,documentId:_0x1cc211,context:_0x3aa134,unlinkedAt:_0x52ec43,attributes:_0xc4c8b})=>{_0x1b9f91['getCommentThread'](_0xdaf22b)&&_0x1b9f91['updateCommentThread']({'threadId':_0xdaf22b,'channelId':_0x1cc211,'context':_0x3aa134,'unlinkedAt':_0x52ec43,'attributes':_0xc4c8b,'isFromAdapter':!0x0});}),this['listenTo'](_0x4071ee,'commentThreadResolved',(_0x55144b,{commentThreadId:_0x32b888,resolvedBy:_0x2267aa,resolvedAt:_0x10a4f4})=>{const _0x5c2f80=_0x1b9f91['getCommentThread'](_0x32b888);_0x5c2f80&&_0x5c2f80['resolve']({'resolvedBy':_0x2267aa,'resolvedAt':_0x10a4f4,'isFromAdapter':!0x0});}),this['listenTo'](_0x4071ee,'commentThreadReopened',(_0x3a72bf,{commentThreadId:_0x548b94})=>{const _0x38e3bd=_0x1b9f91['getCommentThread'](_0x548b94);_0x38e3bd&&_0x38e3bd['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0x4071ee,'commentThreadRemoved',(_0x5ee96d,{commentThreadId:_0x409248})=>{const _0x561c15=_0x1b9f91['getCommentThread'](_0x409248);_0x561c15&&_0x561c15['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0x4071ee,'commentAdded',(_0x3ffddf,_0x485d63)=>{const _0x13bb90=_0x485d63['commentThreadId'],_0x3ba159=_0x1b9f91['getCommentThread'](_0x13bb90);_0x3ba159&&_0x3ba159['addComment']({...S(_0x485d63),'isFromAdapter':!0x0});}),this['listenTo'](_0x4071ee,'commentUpdated',(_0x2efce0,{commentThreadId:_0x39f8f6,commentId:_0x277e9d,content:_0x10d4eb,attributes:_0x1da2ce})=>{const _0x18ceb7=_0x1b9f91['getCommentThread'](_0x39f8f6);if(_0x18ceb7){const _0x1439fa=_0x18ceb7['getComment'](_0x277e9d);_0x1439fa&&_0x1439fa['update']({'content':_0x10d4eb,'attributes':_0x1da2ce,'isFromAdapter':!0x0});}}),this['listenTo'](_0x4071ee,'commentRemoved',(_0x42261b,{commentThreadId:_0x5ee2e7,commentId:_0x2b6cd6})=>{const _0x44d87c=_0x1b9f91['getCommentThread'](_0x5ee2e7);if(_0x44d87c){const _0x11f2b3=_0x44d87c['getComment'](_0x2b6cd6);_0x11f2b3&&_0x11f2b3['remove']({'isFromAdapter':!0x0});}}),await this['_connectService'](_0x134c42);}['destroy'](){if(this['context']instanceof _0x1bb185){const _0x19118d=this['context']['config']['get']('collaboration.channelId');this['_terminateService'](_0x19118d);}}['_terminateService'](_0x43806f){if(!this['_services']['has'](_0x43806f))throw new _0x5eee32('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0x43806f});this['_getService'](_0x43806f)['disconnect'](),this['_services']['delete'](_0x43806f);}async['reconnect'](){for(const _0x5ab64c of this['_services']['keys']())await this['_connectService'](_0x5ab64c);if(this['context']instanceof _0x1bb185){const _0x29fb41=this['context']['config']['get']('collaboration.channelId'),_0xaddf21=this['context']['plugins']['get'](i);_0xaddf21['unregister'](_0x29fb41);const _0x2c3433=await this['_services']['get'](_0x29fb41)['getConnectedSessions']();_0xaddf21['register'](_0x29fb41,_0x2c3433);}}async['_connectService'](_0x528bf5){const {connection:_0x2acf02}=this['context']['plugins']['get'](n),_0x3f37f1=this['context']['plugins']['get']('CommentsRepository'),_0x3ab5ef=this['_services']['get'](_0x528bf5),_0x49aad3=await _0x3ab5ef['connect'](_0x2acf02);await this['_fetchMissingUsersForThreads'](_0x49aad3);const _0x5b9ff7=new Set(Array['from'](_0x3f37f1['getCommentThreads']({'channelId':_0x528bf5}),_0x28669f=>_0x28669f['id']));for(const _0x8da0f1 of _0x49aad3)_0x8da0f1['deletedAt']||_0x5b9ff7['delete'](_0x8da0f1['commentThreadId']);for(const _0x66fb58 of _0x5b9ff7)_0x3f37f1['getCommentThread'](_0x66fb58)['remove']({'isFromAdapter':!0x0});for(const _0x4f4f8d of _0x49aad3){let _0x24dbaf=_0x3f37f1['getCommentThread'](_0x4f4f8d['commentThreadId']);const {commentThreadId:_0x1e714d,context:_0x260b77,attributes:_0x449788,resolvedBy:_0x2253f8,resolvedAt:_0x1bb325,unlinkedAt:_0x1b8896,deletedAt:_0x14e5f1}=_0x4f4f8d;if(_0x14e5f1)continue;_0x24dbaf||(_0x24dbaf=_0x3f37f1['addCommentThread']({'channelId':_0x528bf5,'threadId':_0x1e714d,'context':_0x260b77,'attributes':_0x449788||{},'resolvedBy':_0x2253f8,'resolvedAt':_0x1bb325,'unlinkedAt':_0x1b8896,'isFromAdapter':!0x0}));const _0x3eda44=new Set(Array['from'](_0x24dbaf['comments'],_0xe81288=>_0xe81288['id']));for(const _0x52816f of _0x4f4f8d['comments'])_0x3eda44['delete'](_0x52816f['commentId']);for(const _0x25ad5c of _0x3eda44)_0x24dbaf['getComment'](_0x25ad5c)['remove']({'isFromAdapter':!0x0});for(const _0x3843fd of _0x4f4f8d['comments']){const _0x218ea7=_0x24dbaf['getComment'](_0x3843fd['commentId']);_0x218ea7?_0x218ea7['content']!==_0x3843fd['content']&&_0x218ea7['update']({'content':_0x3843fd['content'],'isFromAdapter':!0x0}):_0x24dbaf['addComment'](Object['assign'](S(_0x3843fd),{'isFromAdapter':!0x0}));}}}['_getService'](_0x84b61b){if(!this['_services']['has'](_0x84b61b))throw new _0x5eee32('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0x84b61b});return this['_services']['get'](_0x84b61b);}async['_fetchMissingUsersForThreads'](_0x683a9d){const _0x21310f=this['context']['plugins']['get'](_0x5df8af),{connection:_0xc786ea}=this['context']['plugins']['get'](n),_0x1de565=new Set();for(const {resolvedBy:_0x5bc7e6,comments:_0x3734ea}of _0x683a9d){_0x5bc7e6&&!_0x21310f['getUser'](_0x5bc7e6)&&_0x1de565['add'](_0x5bc7e6);for(const {userId:_0x3cd7f2}of _0x3734ea)_0x21310f['getUser'](_0x3cd7f2)||_0x1de565['add'](_0x3cd7f2);}if(0x0===_0x1de565['size'])return;const _0x296529=await ct['getMany'](_0xc786ea,Array['from'](_0x1de565));for(const _0x5d1cf4 of _0x296529)_0x21310f['getUser'](_0x5d1cf4['id'])||_0x21310f['addUser'](_0x5d1cf4);}}async function F(_0x1a0f4a){if('404'!==_0x1a0f4a['code'])throw _0x1a0f4a;}function at(_0x22b905){if((_0x2b174d=_0x22b905)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0x2b174d['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x2b174d['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0x2b174d;throw _0x22b905;}function S(_0x35db0e){return{'threadId':_0x35db0e['commentThreadId'],'commentId':_0x35db0e['commentId'],'content':_0x35db0e['content'],'createdAt':_0x35db0e['createdAt'],'authorId':_0x35db0e['userId'],'attributes':_0x35db0e['attributes']||{}};}class m extends _0x5020b7{static ['TrackChangesService']=/* #__PURE__ -- @preserve */
|
|
27
|
+
((()=>tt)());['_bufferedRequests'];['_trackChangesService'];static get['requires'](){return[s,'TrackChangesEditing',n];}static get['pluginName'](){return'CloudServicesTrackChangesAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x473b02){super(_0x473b02);const _0x56e24e=this['editor']['config']['get']('collaboration.channelId');this['_bufferedRequests']=new Map(),this['_trackChangesService']=new m['TrackChangesService'](_0x56e24e);}['init'](){const _0x3617ed=this['editor']['plugins']['get'](n),_0x32308a=this['editor']['plugins']['get']('TrackChangesEditing');return _0x32308a['adapter']={'getSuggestion':async _0x468053=>{await this['_waitForServiceReady']();const _0x1b1854=await this['_trackChangesService']['get'](_0x468053)['catch'](k);return await this['_fetchMissingUsersForThreads']([_0x1b1854]),_0x1b1854;},'addSuggestion':async({id:_0x2d9e5f,type:_0x392247,data:_0x26831c,originalSuggestionId:_0x3ac4f6,attributes:_0x3e0993})=>{await this['_waitForServiceReady']();const _0x38b237={'id':_0x2d9e5f,'type':_0x392247,'data':_0x26831c,'originalSuggestionId':_0x3ac4f6,'attributes':_0x3e0993},_0xd0acc6=await this['_trackChangesService']['add'](_0x2d9e5f,_0x392247,_0x26831c,_0x3ac4f6,_0x3e0993)['catch'](_0x4b8f03=>{if(ht(_0x4b8f03))return new Promise(_0x3b23ea=>{this['_bufferedRequests']['set'](_0x2d9e5f,{'resolve':_0x3b23ea,'suggestionData':_0x38b237});});throw _0x4b8f03;});return this['_bufferedRequests']['delete'](_0x2d9e5f),_0xd0acc6;},'updateSuggestion':async(_0x3d08cf,_0x530b07)=>{if(await this['_waitForServiceReady'](),'open'!==_0x530b07['state'])return this['_trackChangesService']['update'](_0x3d08cf,_0x530b07)['catch'](k);}},this['listenTo'](this['_trackChangesService'],'suggestionUpdated',(_0x2051d9,_0x371dca)=>{_0x32308a['hasSuggestion'](_0x371dca['id'])&&(_0x32308a['getSuggestion'](_0x371dca['id'])['attributes']=_0x371dca['attributes']);}),this['_trackChangesService']['connect'](_0x3617ed['connection'])['then'](_0x8d098f=>(_0x3617ed['addToReconnectionStack'](this),this['_fetchMissingUsersForThreads'](_0x8d098f)['then'](()=>{for(const _0x540712 of _0x8d098f){_0x32308a['addSuggestionData'](_0x540712)['_saved']=!0x0;}})));}async['reconnect'](){const _0x56f753=this['editor']['plugins']['get']('TrackChangesEditing'),{connection:_0x34cad4}=this['editor']['plugins']['get'](n),_0x3cafa7=await this['_trackChangesService']['connect'](_0x34cad4);await this['_fetchMissingUsersForThreads'](_0x3cafa7);for(const {suggestionData:_0x5a5298,resolve:_0x4b019e}of this['_bufferedRequests']['values']()){let _0x455d16=_0x3cafa7['find'](_0x5ecccd=>_0x5ecccd['id']===_0x5a5298['id']);_0x455d16||(_0x455d16=await this['_trackChangesService']['add'](_0x5a5298['id'],_0x5a5298['type'],_0x5a5298['data'],_0x5a5298['originalSuggestionId'])),_0x4b019e(_0x455d16);}for(const _0x4ec3ef of _0x3cafa7)_0x56f753['hasSuggestion'](_0x4ec3ef['id'])||_0x56f753['addSuggestionData'](_0x4ec3ef);}async['_waitForServiceReady'](){this['_trackChangesService']['isConnected']||await new Promise(_0x39a4c1=>{this['listenTo'](this['_trackChangesService'],'connected',_0x1b3b38=>{_0x1b3b38['off'](),_0x39a4c1();});});}async['_fetchMissingUsersForThreads'](_0x134578){const _0x1d9768=this['editor']['plugins']['get'](_0x5df8af),{connection:_0x446215}=this['editor']['plugins']['get'](n),_0x3f2ad2=new Set();for(const {authorId:_0x70ba3c}of _0x134578)_0x1d9768['getUser'](_0x70ba3c)||_0x3f2ad2['add'](_0x70ba3c);if(0x0===_0x3f2ad2['size'])return;const _0x295585=await ct['getMany'](_0x446215,Array['from'](_0x3f2ad2));for(const _0x311661 of _0x295585)_0x1d9768['getUser'](_0x311661['id'])||_0x1d9768['addUser'](_0x311661);}}function k(_0x2f708b){if(ht(_0x2f708b))return new Promise(()=>{});throw _0x2f708b;}function ht(_0x584bdf){return _0x584bdf['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x584bdf['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class g extends _0x5020b7{static get['requires'](){return['Comments',s,a,n];}static get['pluginName'](){return'RealTimeCollaborativeComments';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0xc991ce=this['editor']['plugins']['get'](n),_0x32b5ea=this['editor']['plugins']['get']('CommentsEditing'),_0x11df6e=this['editor']['plugins']['get'](s);return this['editor']['data']['once']('ready',()=>{this['listenTo'](_0xc991ce,'change:state',(_0x3d1638,_0xb5cfed,_0x1699b2)=>{_0x32b5ea['isThreadsLoadingPaused']='connected'!==_0x1699b2;});}),this['listenTo'](_0xc991ce,'change:state',(_0x4900c1,_0x5eb902,_0x59b5fc)=>{this['editor']['plugins']['get']('CommentsRepository')['switchReadOnly']('connected'!==_0x59b5fc);}),_0x11df6e['_setUpService'](this['editor']['config']['get']('collaboration.channelId'));}['destroy'](){this['editor']['plugins']['get'](s)['_terminateService'](this['editor']['config']['get']('collaboration.channelId')),super['destroy']();}}class lt extends _0x5020b7{static get['requires'](){return[g,m,'TrackChanges'];}static get['pluginName'](){return'RealTimeCollaborativeTrackChanges';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class c extends _0x5020b7{static ['RevisionHistoryService']=/* #__PURE__ -- @preserve */
|
|
28
|
+
((()=>_0x4bbbc8)());['_lastRequestId'];['_revisionTracker'];['_revisionHistoryService'];['_oldOffset'];static get['requires'](){return[n,l,'RevisionHistory',i,_0x5df8af];}static get['pluginName'](){return'CloudServicesRevisionHistoryAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x3a522b){super(_0x3a522b);const _0x24827e=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new c['RevisionHistoryService'](_0x24827e);}async['init'](){const _0x3a8623=this['editor']['plugins']['get'](l),_0x414564=_0x3a8623['serverHistory'],_0x41b6fc=this['editor']['plugins']['get'](n);this['_revisionTracker']['setSource']({'history':_0x414564,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0x3a8623['sessionId']});const _0x3f5c78=this['editor']['config']['get']('cloudServices.bundleVersion')||nt,_0x2967bb=await _0x23f175['isBundleUploaded'](_0x41b6fc['connection'],_0x3f5c78);this['editor']['plugins']['get']('RevisionHistory')['adapter']={'getRevision':async({revisionId:_0x98cc8f})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0x98cc8f)),'updateRevisions':async _0x42fc2b=>{await this['_waitForServiceReady']();const _0x52a145=this['_revisionTracker']['currentRevision'];if(_0x2967bb&&0x1===_0x42fc2b['length']&&_0x42fc2b[0x0]['id']===_0x52a145['id'])return _0x42fc2b;for(const _0x4384f9 of _0x42fc2b)_0x4384f9['id']===_0x52a145['id']&&(_0x4384f9['isEmptyCurrent']=_0x4384f9['fromVersion']===_0x4384f9['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0x42fc2b,this['_lastRequestId'])['then'](_0x36c488=>(this['_lastRequestId']=_0x36c488,_0x42fc2b))['catch'](_0x317f96=>{if(q(_0x317f96)||'400'===_0x317f96['code']&&void 0x0!==_0x317f96['data']['wrongRequestId']){for(const _0x2ac474 of _0x42fc2b){!this['_revisionTracker']['repository']['getRevision'](_0x2ac474['id'])||this['_revisionTracker']['_bufferUpdate'](_0x2ac474['id'],_0x2ac474,!0x1);}if(q(_0x317f96))throw _0x317f96;return _0x42fc2b;}throw _0x317f96;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0x5d0310,{revisionsData:_0x12ec56,requestId:_0x2ab66f})=>{Math['max'](..._0x12ec56['map'](_0x33b55b=>_0x33b55b['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0x12ec56,_0x2ab66f);}):this['_handleRevisionsUpdate'](_0x12ec56,_0x2ab66f);});const {revisions:_0x38a710,requestId:_0x5c2780}=await this['_revisionHistoryService']['connect'](_0x41b6fc['connection']);_0x41b6fc['addToReconnectionStack'](this),this['_lastRequestId']=_0x5c2780,await this['_fetchMissingUsers'](_0x38a710);for(const _0x2366d8 of _0x38a710)this['_revisionTracker']['addRevisionData'](_0x2366d8);this['listenTo'](_0x3a8623,'change:_isConnected',(_0x5232d4,_0x1483b7,_0x298270)=>{_0x298270&&(this['_oldOffset']=_0x3a8623['_offset'],_0x5232d4['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](_0x41b6fc,'state',_0x1ff598=>_0x1ff598===_0x58fce9['CONNECTED']);}async['reconnect'](){const _0x641ae8=this['editor']['plugins']['get'](n),_0x1beb42=this['editor']['plugins']['get'](l),_0x48a297=async()=>{const _0x2bb11b=this['_revisionTracker']['currentRevision'],_0x277cb4=_0x2bb11b['id'],_0x5f0a93=_0x277cb4!==_0x1beb42['sessionId'];if(_0x5f0a93){const _0x555aad=_0x1beb42['_offset']-this['_oldOffset'],_0x554b3e=this['_getLatestVersionFromServerOperations']();this['_revisionTracker']['_revisionDataBuilder']['reInit']();if(_0x2bb11b['toVersion']+_0x555aad!==_0x554b3e){const _0x478a4b=_0x2bb11b['fromVersion']+_0x555aad,_0x4de86a=this['editor']['plugins']['get'](_0x5df8af),_0x112727=this['_revisionTracker']['buildRevisionData']({'revision':_0x2bb11b,'from':_0x478a4b,'to':_0x554b3e});_0x112727['id']=_0x2bb11b['id'];const _0x1a07fa=_0x112727['authorsIds']['map'](_0x37a614=>_0x4de86a['getUser'](_0x37a614));_0x2bb11b['_update']({..._0x112727,'authors':_0x1a07fa},!0x0),this['_revisionTracker']['_bufferUpdate'](_0x2bb11b['id'],_0x112727,!0x0);}this['_revisionTracker']['_startingVersion']=_0x554b3e,(_0x2bb11b['toVersion']===_0x2bb11b['fromVersion']&&!this['_revisionTracker']['_bufferedUpdates']['has'](_0x277cb4)&&this['_revisionTracker']['repository']['_revisions']['remove'](_0x277cb4),this['_revisionTracker']['_createCurrentRevision'](_0x554b3e));}const {revisions:_0x45aa61,requestId:_0x1ba754}=await this['_revisionHistoryService']['reconnect'](_0x641ae8['connection'],this['_lastRequestId']);_0x5f0a93&&_0x45aa61['length']>0x0?_0x1beb42['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x45aa61),this['_handleRevisionsUpdate'](_0x45aa61,_0x1ba754),this['_revisionTracker']['sendBufferedUpdates']());};return _0x1beb42['_isConnected']?_0x48a297():new Promise((_0x5b9a0a,_0x5d94d2)=>{_0x1beb42['once']('change:_isConnected',()=>{_0x48a297()['then'](_0x5b9a0a)['catch'](_0x5d94d2);});});}['destroy'](){super['destroy']();}async['_waitForServiceReady'](){this['_revisionHistoryService']['isConnected']||await new Promise(_0x1526ba=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x26beb1=>{_0x26beb1['off'](),_0x1526ba();});});}['_getLatestVersionFromServerOperations'](){const _0x4d7891=this['editor']['plugins']['get'](l)['serverHistory']['getOperations']()['reverse']();for(const _0x100765 of _0x4d7891)if('marker'!==_0x100765['type']||_0x100765['affectsData'])return _0x100765['baseVersion']+0x1;}['_getLatestVersion'](){const _0x8d5c49=this['editor']['plugins']['get'](l);return new Promise(_0x3c34ad=>{_0x8d5c49['_isPendingUpdate']?_0x8d5c49['once']('change:_isPendingUpdate',()=>{_0x3c34ad(this['_getLatestVersionFromServerOperations']());}):_0x3c34ad(this['_getLatestVersionFromServerOperations']());});}['_handleRevisionsUpdate'](_0x5de68e,_0x307892){const _0x2fe727=this['_revisionTracker']['repository'];this['_lastRequestId']=_0x307892;for(const _0x303f91 of _0x5de68e){const _0xab1521=_0x2fe727['getRevision'](_0x303f91['id']);if(_0xab1521){if((_0x303f91['fromVersion']||_0x303f91['toVersion'])&&(_0x303f91['diffData']=null),_0xab1521===this['_revisionTracker']['currentRevision']){const _0x1a6d57=Math['max'](_0xab1521['toVersion'],_0x303f91['toVersion']),_0x5a8483=Math['max'](_0xab1521['fromVersion'],_0x303f91['fromVersion']);let _0x362656;_0xab1521['toVersion']===_0x303f91['toVersion']&&_0xab1521['fromVersion']===_0x303f91['fromVersion']?(_0x362656=!0x0,this['_preventResendingRevisionData'](_0x303f91)):_0x303f91['toVersion']===_0x1a6d57&&_0x303f91['fromVersion']===_0x5a8483?_0x362656=!0x1:(_0xab1521['toVersion']===_0x1a6d57&&_0xab1521['fromVersion']===_0x5a8483||this['_fixRevision']({'revision':_0xab1521,'from':_0x5a8483,'to':_0x1a6d57}),_0x362656=!0x0),_0x362656&&(delete _0x303f91['fromVersion'],delete _0x303f91['toVersion'],delete _0x303f91['diffData'],delete _0x303f91['createdAt'],delete _0x303f91['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0x303f91),this['_preventResendingRevisionData'](_0x303f91);}else this['_revisionTracker']['addRevisionData'](_0x303f91);}const _0x44bed2=_0x2fe727['getRevisions']();_0x44bed2['reverse']();for(let _0x1b4b42=0x0;_0x1b4b42<_0x44bed2['length']-0x1;_0x1b4b42++){const _0x161d4e=_0x44bed2[_0x1b4b42],_0x2f34b3=_0x44bed2[_0x1b4b42+0x1];if(_0x161d4e['fromVersion']<_0x2f34b3['toVersion']){const _0x5aa5a7=_0x2f34b3['toVersion'],_0x5aca9e=Math['max'](_0x5aa5a7,_0x161d4e['toVersion']);this['_fixRevision']({'revision':_0x161d4e,'from':_0x5aa5a7,'to':_0x5aca9e});}}}['_fixRevision']({revision:_0x3ff1c3,from:_0x193f7f,to:_0x102235}={}){const _0x4abd22=this['editor']['plugins']['get'](_0x5df8af),_0x59168f=this['_revisionTracker']['buildRevisionData']({'revision':_0x3ff1c3,'from':_0x193f7f,'to':_0x102235});_0x59168f['authors']=_0x59168f['authorsIds']['map'](_0x1782a2=>_0x4abd22['getUser'](_0x1782a2)),_0x3ff1c3['_update'](_0x59168f);}['_preventResendingRevisionData'](_0x4b5020){const _0x4fcc21={};_0x4fcc21['id']=_0x4b5020['id'];for(const _0x3c32a4 of Object['keys'](_0x4b5020))'id'!==_0x3c32a4&&(_0x4fcc21[_0x3c32a4]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0x4fcc21['id'],_0x4fcc21,!0x0);}async['_fetchMissingUsers'](_0x57bc1d){const _0x2b47bf=this['editor']['plugins']['get'](_0x5df8af),{connection:_0x312be0}=this['editor']['plugins']['get'](n),_0x282273=new Set();for(const _0x242f4d of _0x57bc1d){for(const _0x9e1ba2 of _0x242f4d['authorsIds'])_0x412bf4(_0x9e1ba2);_0x242f4d['creatorId']&&_0x412bf4(_0x242f4d['creatorId']);}if(0x0===_0x282273['size'])return;const _0x5f3b65=await ct['getMany'](_0x312be0,Array['from'](_0x282273));for(const _0x21b2c3 of _0x5f3b65)_0x2b47bf['getUser'](_0x21b2c3['id'])||_0x2b47bf['addUser'](_0x21b2c3);function _0x412bf4(_0x2e7503){_0x2b47bf['getUser'](_0x2e7503)||_0x282273['add'](_0x2e7503);}}}function q(_0x31ae30){return _0x31ae30['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0x31ae30['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x31ae30['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class dt extends _0x5020b7{static get['requires'](){return['RevisionHistory',c,a];}static get['pluginName'](){return'RealTimeCollaborativeRevisionHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class b extends _0x45849d{['_collapseAt'];constructor(_0x13e1a3,_0xcb41c1=0x6){super(_0x13e1a3);const _0x1e69bf=this['bindTemplate'];this['set']('isHidden',!0x0),this['set']('usersCount',0x0),this['_collapseAt']=_0xcb41c1,this['bind']('isHidden')['to'](this,'usersCount',_0x2e2198=>_0x2e2198<_0xcb41c1),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item',_0x1e69bf['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':_0x1e69bf['to']('usersCount',_0x92d024=>'+'+(_0x92d024-this['_collapseAt']+0x2)['toString']())}]}]}]});}}class is extends _0x45849d{['items'];['keystrokes'];constructor(_0x111878){super(_0x111878);const _0x592f08=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0x3b9efd(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0x592f08['if']('hasPopup'),'aria-expanded':_0x592f08['to']('isExpanded',_0x5828c0=>this['hasPopup']&&String(_0x5828c0)),'aria-label':_0x592f08['to']('hasPopup',_0x1e91e0=>$(_0x111878,_0x1e91e0?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0x592f08['to']('hasPopup',_0x159bc8=>!!_0x159bc8&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items'],'on':{'mouseenter':_0x592f08['to'](()=>this['fire']('presencelist:show')),'mouseleave':_0x592f08['to'](_0xb6d67a=>{const _0x47dd40=_0xb6d67a,_0x1aa4ce=document['querySelector']('.ck-presence-list__dropdown-list'),_0x5add77=document['querySelector']('.ck-balloon-panel_with-arrow');_0x1aa4ce?.['contains'](_0x47dd40['relatedTarget'])||_0x5add77?.['contains'](_0x47dd40['relatedTarget'])||this['fire']('presencelist:hide');})}}),this['on']('change:hasPopup',(_0x409ef0,_0x10c212,_0x110fd2)=>{this['element']&&(_0x110fd2?this['element']['setAttribute']('aria-expanded',String(this['isExpanded'])):this['element']['removeAttribute']('aria-expanded'));});}['focus'](){this['element']['focus']();}['render'](){super['render'](),this['keystrokes']['listenTo'](this['element']);}}class v extends _0x45849d{['counterView'];['inlineListView'];constructor(_0xb02243,_0x4164ef=0x6){super(_0xb02243);const _0x3f90de=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new b(this['locale'],_0x4164ef),this['inlineListView']=new is(_0xb02243),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x587fbd of this['inlineListView']['items'])_0x587fbd['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',_0x3f90de['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['inlineListView']]});}}class L extends _0x45849d{['listWrapperView'];constructor(_0x379dfb,_0x134a8f){super(_0x379dfb);const _0x404d7a=this['bindTemplate'];this['listWrapperView']=new ut(_0x379dfb,_0x134a8f),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':$(_0x379dfb,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']],'on':{'mouseleave':_0x404d7a['to'](_0x40bc35=>{const _0x22b25d=_0x40bc35,_0x23e8ff=document['querySelector']('.ck-presence-list__list'),_0xf6af85=document['querySelector']('.ck-balloon-panel_with-arrow');_0x23e8ff?.['contains'](_0x22b25d['relatedTarget'])||_0xf6af85?.['contains'](_0x22b25d['relatedTarget'])||this['fire']('presencelist:hide');})}});}}class ut extends _0x2b176e{constructor(_0x437418,_0x338b66){super(_0x437418);const _0x3063d3=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0x338b66?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0x3063d3['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0x3063d3['to']('role'),'aria-label':_0x3063d3['to']('ariaLabel'),'aria-labelledby':_0x3063d3['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0x423bdf['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0x568280=this['element'];_0x568280&&(this['_isScrollable']=Math['max'](_0x568280['scrollHeight'],_0x568280['clientHeight'])>0.8*window['innerHeight']);}}class j extends et{['userView'];constructor(_0x4d20fe,_0x18148b,_0x53ef7d){super(_0x4d20fe);const _0x45ca67=this['bindTemplate'];this['userView']=new st(_0x4d20fe,_0x18148b);const _0x294948={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0x18148b['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0x18148b['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x18148b['color']['getBackgroundColorClass']()],'aria-hidden':'true'}}]};_0x53ef7d&&(_0x294948['tag']='button',_0x294948['on']={'click':_0x45ca67['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x294948);}['focus'](){this['element']['focus']();}}class A extends _0x45849d{['userView'];['markerView'];constructor(_0x49c467,_0x527522,_0x288cab){super(_0x49c467);const _0x2b65c2=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new st(_0x49c467,_0x527522),this['markerView']=new ot(_0x49c467,_0x527522);const _0x358fc9=new it(_0x49c467);_0x358fc9['template']['tag']='span',_0x358fc9['text']=_0x527522['name'];const _0x5d5791={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0x2b65c2['to']('isFocusable',_0x1f64d8=>!!_0x1f64d8&&0x0),'aria-labelledby':_0x358fc9['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0x2b65c2['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0x2b65c2['to']('hasTooltip',_0x512a20=>!_0x512a20),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0x358fc9]};_0x288cab&&(_0x5d5791['tag']='button',_0x5d5791['on']={'click':_0x2b65c2['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x5d5791);}}class ot extends _0x45849d{constructor(_0x5e2d60,_0x2bf292){super(_0x5e2d60),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x2bf292['color']['getBackgroundColorClass']()],'aria-hidden':'true'}});}}const x={'collapseAt':0x6,'displayMe':!0x0};class r extends _0x382514{['currentDisplayedUsers'];['balloonPanelView'];['view'];['presenceDropdownView'];['_bodyCollection']=null;static get['pluginName'](){return'PresenceListUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x44d1f4){super(_0x44d1f4),this['context']['config']['define']('presenceList',x);const _0x12b1f3=_0x44d1f4['config']['get']('presenceList.collapseAt');if('number'!=typeof _0x12b1f3)throw new _0x5eee32('presencelist-collapseat-invalid-format',this);if(_0x12b1f3<0x1)throw new _0x5eee32('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](i)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0x6d1a51(),this['balloonPanelView']=new _0x2c0dd5(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get['requires'](){return[i];}['init'](){for(const _0x4557a5 of this['_allConnectedUsers'])this['_handleUserAdd'](_0x4557a5);this['listenTo'](this['_allConnectedUsers'],'add',(_0x4063ca,_0x75ac97)=>{this['_handleUserAdd'](_0x75ac97);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0x3b9388,_0x5c4b92)=>{this['_handleUserRemove'](_0x5c4b92);});}['_createView'](){const _0x52e9ed=this['context'],_0x39bad5=new v(this['context']['locale'],this['context']['config']['get']('presenceList.collapseAt')),_0x55944d=this['balloonPanelView'];if(!_0xf1dc26(_0x52e9ed['config']['get']('presenceList.container')))throw new _0x5eee32('presencelist-missing-container',this);return _0x39bad5['counterView']['bind']('usersCount')['to'](this),_0x39bad5['bind']('isCollapsed')['to'](this,'usersCount',_0x4d8967=>{const {collapseAt:_0x32b0c5}=_0x52e9ed['config']['get']('presenceList'),_0x2499a6=_0x4d8967>=_0x32b0c5;if(_0x2499a6&&!_0x39bad5['inlineListView']['items']['find'](_0x58f846=>_0x58f846 instanceof b)){const _0x35b031=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['currentDisplayedUsers']['length']==_0x35b031&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](this['currentDisplayedUsers']['length']-0x1),_0x39bad5['inlineListView']['items']['add'](_0x39bad5['counterView']);}return _0x2499a6||this['hideDropdown'](),_0x2499a6;}),_0x39bad5['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0x5c89ad=>{const _0x54b571=_0x52e9ed['config']['get']('presenceList'),_0x2a188d=new A(_0x52e9ed['locale'],_0x5c89ad,!!_0x54b571['onClick']);return _0x2a188d['bind']('hasTooltip')['to'](_0x39bad5,'isCollapsed',_0x23e547=>!_0x23e547),_0x2a188d['bind']('isFocusable')['to'](_0x39bad5,'isCollapsed',_0x47848a=>!_0x47848a),_0x54b571['onClick']&&this['listenTo'](_0x2a188d,'execute',()=>{this['view']['isCollapsed']||_0x54b571['onClick'](_0x5c89ad,_0x2a188d['element']);}),_0x2a188d;}),this['listenTo'](_0x39bad5['inlineListView'],'presencelist:show',()=>{this['view']['isCollapsed']&&this['showDropdown']();}),this['listenTo'](_0x39bad5['inlineListView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();}),_0x39bad5['inlineListView']['keystrokes']['set']('Enter',(_0x512619,_0x332b61)=>{this['view']['isCollapsed']&&(this['showDropdown'](),_0x332b61());}),_0x39bad5['render'](),_0x55944d['render'](),_0x4693a3({'emitter':_0x39bad5,'activator':()=>_0x55944d['isVisible'],'contextElements':[_0x55944d['element'],_0x39bad5['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0x52e9ed['config']['get']('presenceList.container')['appendChild'](_0x39bad5['element']),this['_bodyCollection']=new _0x59e840(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_bodyCollection']['add'](this['balloonPanelView']),_0x39bad5;}['_handleUserAdd'](_0x4638ac){if(!this['context']['config']['get']('presenceList.displayMe')&&_0x4638ac['isMe'])return;const _0x66600b=this['context']['config']['get']('presenceList.collapseAt')-0x1;for(this['usersCount']++;this['currentDisplayedUsers']['length']>=_0x66600b-(this['view']['isCollapsed']?0x1:0x0)&&this['currentDisplayedUsers']['length']>0x1;)this['currentDisplayedUsers']['remove'](0x1);const _0x10bf06=_0x4638ac['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0x4638ac,_0x10bf06);}['_handleUserRemove'](_0x316d99){this['usersCount']--;const {collapseAt:_0x3e94cc}=this['context']['config']['get']('presenceList'),_0x37bfb5=this['usersCount']>=_0x3e94cc;if(this['currentDisplayedUsers']['get'](_0x316d99['id']))this['currentDisplayedUsers']['remove'](_0x316d99['id']);else{if(_0x37bfb5&&this['currentDisplayedUsers']['length']+0x1===_0x3e94cc-0x1)return;}if(this['currentDisplayedUsers']['length']+(_0x37bfb5?0x1:0x0)<this['usersCount']){for(const _0x2e0bf1 of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0x2e0bf1['id'])&&(this['currentDisplayedUsers']['add'](_0x2e0bf1,Math['min'](this['currentDisplayedUsers']['length']-(_0x37bfb5?0x1:0x0),0x1)),this['currentDisplayedUsers']['length']+(_0x37bfb5?0x1:0x0)===_0x3e94cc-0x1))return;}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0x230b0b=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new L(this['context']['locale'],!!_0x230b0b['onClick']),this['view']['inlineListView']['isExpanded']=!0x0,this['listenTo'](this['presenceDropdownView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();});const {listWrapperView:_0x219c1c}=this['presenceDropdownView'];_0x219c1c['items']['bindTo'](this['_allConnectedUsers'])['using'](_0x2c7cbe=>{if(!_0x230b0b['displayMe']&&_0x2c7cbe['isMe'])return null;const _0x2c61dd=new j(this['context']['locale'],_0x2c7cbe,!!_0x230b0b['onClick']);return _0x230b0b['onClick']&&this['listenTo'](_0x2c61dd,'execute',()=>{_0x230b0b['onClick'](_0x2c7cbe,_0x2c61dd['element']);}),_0x2c61dd;}),this['balloonPanelView']['content']['add'](this['presenceDropdownView']),this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element']}),_0x219c1c['focus'](),_0x219c1c['checkIfScrollable']();const _0x13c7a9=(_0x56706c,_0x36baf1)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0x36baf1();};_0x219c1c['keystrokes']['set']('Esc',_0x13c7a9),_0x219c1c['keystrokes']['set']('Shift+Tab',_0x13c7a9),_0x219c1c['keystrokes']['set']('Tab',(_0x1f5d7c,_0x42b78c)=>{!function(_0x9d78cd){const _0x18fbe=['a','button','input','select','textarea','[tabindex]','[contenteditable]']['map'](_0x4376a3=>_0x4376a3+':not([disabled]):not([tabindex=\x22-1\x22])')['join'](','),_0x58eb90=[...document['body']['querySelectorAll'](_0x18fbe)]['filter'](_0x1a9847=>_0x1a9847===document['activeElement']||_0x1a9847['offsetWidth']+_0x1a9847['offsetHeight']>0x0)['sort']((_0x4575ac,_0x393c72)=>(_0x4575ac['tabIndex']||0x0)-(_0x393c72['tabIndex']||0x0)),_0x347d9c=_0x58eb90['indexOf'](_0x9d78cd),_0x48a5a6=_0x58eb90[(_0x347d9c+0x1)%_0x58eb90['length']];_0x48a5a6&&_0x48a5a6['focus']();}(this['view']['element']),this['hideDropdown'](),_0x42b78c();}),_0x219c1c['focusTracker']['add'](this['view']['element']),_0x219c1c['focusTracker']['on']('change:isFocused',(_0x295303,_0x238cc9,_0x521eb6)=>{_0x521eb6||this['hideDropdown']();});}['hideDropdown'](){this['presenceDropdownView']&&(this['view']['inlineListView']['isExpanded']=!0x1,this['balloonPanelView']['unpin'](),this['balloonPanelView']['content']['remove'](this['presenceDropdownView']),this['presenceDropdownView']['destroy'](),this['presenceDropdownView']=void 0x0);}['destroy'](){super['destroy'](),this['view']&&this['view']['isRendered']&&this['view']['destroy'](),this['_bodyCollection']&&(this['_bodyCollection']['detachFromDom'](),this['_bodyCollection']['destroy'](),this['_bodyCollection']=null);}}class ft extends _0x382514{static get['requires'](){return[i,r];}static get['pluginName'](){return'PresenceList';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}export{s as CloudServicesCommentsAdapter,c as CloudServicesRevisionHistoryAdapter,m as CloudServicesTrackChangesAdapter,ft as PresenceList,r as PresenceListUI,l as RealTimeCollaborationClient,g as RealTimeCollaborativeComments,a as RealTimeCollaborativeEditing,dt as RealTimeCollaborativeRevisionHistory,lt as RealTimeCollaborativeTrackChanges,i as Sessions,n as WebSocketGateway};
|