@ckeditor/ckeditor5-real-time-collaboration 46.0.1-alpha.4 → 46.0.1-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 +2 -2
- package/dist/index.js +6 -6
- package/package.json +14 -14
- package/src/presencelist/presencelistui.js +1 -1
- package/src/presencelist/view/presencedropdownlistview.js +1 -1
- package/src/presencelist/view/presenceinlinelistview.js +1 -1
- package/src/presencelist/view/presencelistview.js +1 -1
- package/src/realtimecollaborativecomments/cloudservicescommentsadapter.js +2 -2
- package/src/realtimecollaborativeediting/realtimecollaborationclient.js +2 -2
- package/src/realtimecollaborativeediting/sessions.js +1 -1
- package/src/realtimecollaborativeediting/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',_0x554080];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x47f9f7){super(_0x47f9f7),this['set']('state',_0x543ce6['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=new(_0x11d6ab())();}['init'](){const _0x22d93e=this['context'],_0x473fb8=_0x22d93e['plugins']['get']('CloudServices'),_0x29011c=_0x22d93e['plugins']['get'](_0x554080);if(!_0x473fb8['token'])throw new _0x189f6f('websocketgateway-missing-token',this);if(!_0x473fb8['webSocketUrl'])throw new _0x189f6f('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'](_0x473fb8['token'],_0x473fb8['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0x182c3f=>{if(this['connection']=_0x182c3f,this['bind']('state')['to'](_0x182c3f,'state',this,'_isBrowserOffline',(_0x463616,_0x461b5a)=>('connected'!==_0x463616&&(this['_shouldPluginsReconnect']=!0x0),_0x461b5a||_0x463616!==_0x543ce6['CONNECTED']?_0x543ce6['DISCONNECTED']:this['state']==_0x543ce6['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),_0x543ce6['CONNECTING']):_0x543ce6['CONNECTED'])),this['connection']['on']('error',(_0x2f159c,_0x3c6086)=>{if('limitExceeded'!==_0x3c6086['code'])throw console['error'](_0x3c6086),new _0x189f6f('cloudservices-init',null,{'originalError':_0x3c6086});_0x29011c['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'});}),!_0x182c3f['me'])return new Promise(_0x1c53d1=>_0x182c3f['on']('change:me',_0x1c53d1));})['catch'](_0x1b9328=>{throw console['error'](_0x1b9328),new _0x189f6f('cloudservices-init',null,{'originalError':_0x1b9328});});}['addToReconnectionStack'](_0x48c423){if('function'!=typeof _0x48c423['reconnect'])throw new _0x189f6f('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0x48c423))throw new _0x189f6f('websocketgateway-plugin-already-registered',this,{'name':_0x48c423['constructor']['pluginName']});this['_reconnectionStack']['add'](_0x48c423);}['removeFromReconnectionStack'](_0x4c7c25){this['_reconnectionStack']['delete'](_0x4c7c25);}['isInReconnectionStack'](_0x1b3094){return this['_reconnectionStack']['has'](_0x1b3094);}['_reconnect'](){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0xacf6b1=>_0xacf6b1['reconnect']())))['then'](()=>this['state']=_0x543ce6['CONNECTED'])['catch'](_0x3d6b12=>{throw console['error'](_0x3d6b12),new _0x189f6f('cloudservices-reconnection-error',this['context']);});}['disconnect'](){this['connection']&&this['connection']['disconnect'](),this['state']=_0x543ce6['DISCONNECTED'],this['_domEmitter']['stopListening']();}['destroy'](){this['disconnect'](),super['destroy']();}}class i extends _0x24e504{['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,_0x47e255];}constructor(_0x2d9d46){super(_0x2d9d46),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0x26414e(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x47e255);}['init'](){const _0x2487bc=this['context']['plugins']['get'](n);this['listenTo'](_0x2487bc,'change:state',(_0x295ece,_0x2f07df,_0x428368)=>{if('connected'!==_0x428368)this['channelSessions']['forEach'](_0x4afd6a=>_0x4afd6a['clear']()),this['channelConnectedUsers']['forEach'](_0x5c9ecb=>_0x5c9ecb['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x2a089c,_0x4f8847]of this['_registeredSessions'])for(const _0x2911c3 of _0x4f8847)this['_handleSessionAdd'](_0x2a089c,_0x2911c3);}}),this['_createUser'](_0x2487bc['connection']['me'],!0x0);}['register'](_0x2d866f,_0x52aa0b){if(this['_registeredSessions']['has'](_0x2d866f))throw new _0x189f6f('sessions-register-already-registered',null,{'channelId':_0x2d866f});this['_registeredSessions']['set'](_0x2d866f,_0x52aa0b),this['channelSessions']['set'](_0x2d866f,new _0x26414e()),this['channelConnectedUsers']['set'](_0x2d866f,new _0x26414e()),this['listenTo'](_0x52aa0b,'add',(_0x59fc01,_0x273a9d)=>this['_handleSessionAdd'](_0x2d866f,_0x273a9d)),this['listenTo'](_0x52aa0b,'remove',(_0x30d0e8,_0x396e30)=>this['_handleSessionRemove'](_0x2d866f,_0x396e30));for(const _0x44df0e of _0x52aa0b)this['_handleSessionAdd'](_0x2d866f,_0x44df0e);}['unregister'](_0x142573){if(!this['_registeredSessions']['has'](_0x142573))throw new _0x189f6f('sessions-unregister-not-exist',null,{'channelId':_0x142573});const _0x14b1f4=this['_registeredSessions']['get'](_0x142573);this['stopListening'](_0x14b1f4);for(const _0x2be622 of _0x14b1f4)'connected'===this['context']['plugins']['get'](n)['state']&&this['_handleSessionRemove'](_0x142573,_0x2be622);this['_registeredSessions']['delete'](_0x142573),this['channelSessions']['delete'](_0x142573),this['channelConnectedUsers']['delete'](_0x142573);}get['mySessionId'](){return this['context']['plugins']['get'](n)['connection']['sessionId'];}['getUserBySessionId'](_0x502e46){for(const _0x1aa21b of this['channelSessions']['values']())for(const _0x21ee04 of _0x1aa21b)if(_0x21ee04['id']===_0x502e46)return _0x21ee04['user'];}['getUserSessions'](_0x12caa8,_0x2b70f5){const _0x577eed=_0x2b70f5?[this['channelSessions']['get'](_0x2b70f5)]:this['channelSessions']['values'](),_0x3dca1f=new Set();for(const _0x22e1d2 of _0x577eed)for(const _0x3f00f6 of _0x22e1d2)_0x3f00f6['user']['id']===_0x12caa8['id']&&_0x3dca1f['add'](_0x3f00f6['id']);return _0x3dca1f;}['getUserRole'](_0x39764d){for(const _0x4a56db of this['channelSessions']['values']())for(const _0x4e6d9c of _0x4a56db)if(_0x4e6d9c['user']===_0x39764d)return _0x4e6d9c['role'];}['_handleSessionAdd'](_0x3ad00e,_0x183421){if('connected'!==this['context']['plugins']['get'](n)['state'])return;const _0x5ec579=_0x183421['user'],_0x42b851=this['_users']['getUser'](_0x5ec579['id'])||this['_createUser'](_0x5ec579),_0x43b728=Object['assign']({},_0x183421,{'user':_0x42b851});this['channelSessions']['get'](_0x3ad00e)['add'](_0x43b728);const _0x3c460e=this['channelConnectedUsers']['get'](_0x3ad00e);_0x3c460e['has'](_0x42b851['id'])||_0x3c460e['add'](_0x42b851),this['allConnectedUsers']['has'](_0x42b851['id'])||this['allConnectedUsers']['add'](_0x42b851,_0x42b851['isMe']?0x0:void 0x0),this['fire']('sessionAdd:'+_0x3ad00e,{'channelId':_0x3ad00e,'session':_0x43b728});}['_handleSessionRemove'](_0x572641,_0x48158c){if('connected'!==this['context']['plugins']['get'](n)['state'])return;const _0x121e44=this['channelConnectedUsers']['get'](_0x572641),_0x2df636=_0x48158c['user'];_0x2df636['id']&&(this['channelSessions']['get'](_0x572641)['remove'](_0x48158c['id']),_0x121e44['has'](_0x2df636['id'])&&!this['getUserSessions'](_0x2df636,_0x572641)['size']&&_0x121e44['remove'](_0x2df636['id']),this['allConnectedUsers']['get'](_0x2df636['id'])&&!this['getUserSessions'](_0x2df636)['size']&&this['allConnectedUsers']['remove'](_0x2df636['id']));}['_createUser'](_0x80ee98,_0x2e9c80){const _0x3f0fe3=this['_users']['addUser'](_0x80ee98);return _0x2e9c80&&this['_users']['defineMe'](_0x80ee98['id']),_0x3f0fe3['orderNumber']=this['_uniqueUsersCount']++,_0x3f0fe3;}}class $ extends _0x23684a{['_domEmitter']=new(_0x11d6ab())();static get['requires'](){return[i];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x59f466=this['editor'],_0x4db363=_0x59f466['plugins']['get'](i);_0x59f466['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x259331,{writer:_0xe5f2af})=>function(_0x51a20e,_0x3f488d,_0x16e08d,_0x4634c1){const _0x2fe52a=_0x51a20e['markerName']['split'](':')[0x2],_0x5cb015=_0x16e08d['getUserBySessionId'](_0x2fe52a);if(!_0x5cb015||_0x2fe52a===_0x16e08d['mySessionId'])return;if(!_0x4634c1['model']['schema']['checkChild'](_0x51a20e['markerRange']['start'],'$text'))return;const _0x2e9169={'class':'ck-user__marker\x20'+_0x5cb015['color']['getMarkerClass'](),'data-name':_0x5cb015['name'],'data-session-id':_0x2fe52a},_0x27567e=_0x4634c1['model']['markers']['get'](_0x51a20e['markerName']),_0x2b5244=_0x27567e['getStart'](),_0x1e4504=_0x2b5244['nodeAfter'],_0x501958=_0x4634c1['model']['schema'];if(_0x1e4504&&_0x501958['isObject'](_0x1e4504)&&_0x501958['isInline'](_0x1e4504)&&!_0x4634c1['model']['markers']['get']('user:range:'+_0x2fe52a)['getRange']()['isCollapsed'])return;const _0x5ba253=_0x2b5244['parent'];return _0x4634c1['model']['schema']['isLimit'](_0x5ba253)&&!_0x4634c1['model']['hasContent'](_0x5ba253)&&(_0x2e9169['contenteditable']=!0x1),function(_0x491ec0,_0x264c84,_0x2b8573){const _0x4d1544=_0x491ec0['createUIElement']('span',_0x264c84);return _0x491ec0['setCustomProperty']('userPositionMarker',!0x0,_0x4d1544),_0x4d1544['render']=function(_0xd82ec5){const _0x124447=this['toDomElement'](_0xd82ec5),_0x2894ad=document['createElement']('span');return _0x2894ad['classList']['add']('ck-user__marker-tooltip'),_0x2894ad['setAttribute']('contenteditable','false'),_0x2894ad['setAttribute']('spellcheck','false'),_0x2894ad['textContent']=_0x2b8573['name'],_0x124447['innerHTML']='<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span>'+_0x2894ad['outerHTML']+'',_0x124447['addEventListener']('mouseenter',()=>{_0x124447['classList']['add']('ck-user__marker_hovered');}),_0x124447['addEventListener']('mouseleave',()=>{_0x124447['classList']['remove']('ck-user__marker_hovered');}),_0x124447;},_0x4d1544['isSimilar']=function(_0x9363f9){return!(!this['getCustomProperty']('userPositionMarker')||!_0x9363f9['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0x9363f9['getAttribute']('data-session-id'));},_0x4d1544;}(_0x3f488d,_0x2e9169,_0x5cb015);}(_0x259331,_0xe5f2af,_0x4db363,_0x59f466)}),_0x59f466['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0x2b9b84=>function(_0x2192bd,_0x4afead){const _0x5a7408=_0x2192bd['markerName']['split'](':')[0x2];if(_0x5a7408===_0x4afead['mySessionId'])return null;const _0x43b0b1=_0x4afead['getUserBySessionId'](_0x5a7408);if(!_0x43b0b1)return{'id':_0x5a7408,'classes':[]};return{'id':_0x5a7408,'classes':['ck-user__selection',_0x43b0b1['color']['getSelectionClass']()],'attributes':{'data-session-id':_0x5a7408},'priority':0x7d0+_0x43b0b1['orderNumber']};}(_0x2b9b84,_0x4db363)}),function(_0x1618cf){const _0x3eca40=_0x1618cf['model'],_0x22dfc2=new Map(),_0x26f242=_0x1618cf['plugins']['get'](i);_0x3eca40['markers']['on']('update:user:range',(_0x592dbf,_0x1a8a9d,_0x3efc9a,_0x32fe3b)=>{if(!_0x32fe3b&&_0x22dfc2['get'](_0x1a8a9d['name']))return _0x22dfc2['get'](_0x1a8a9d['name'])['detach'](),void _0x22dfc2['delete'](_0x1a8a9d['name']);const _0x164e9b=_0x1a8a9d['name']['split'](':')[0x2];if(_0x164e9b===_0x26f242['mySessionId'])return;const _0x47ab98='user:position:'+_0x164e9b;_0x3eca40['markers']['has'](_0x47ab98)&&_0x1618cf['editing']['reconvertMarker'](_0x47ab98),_0x1a8a9d['on']('change:range',(_0x2e2bf5,_0x353d9e,_0x5f1fb2)=>{if('$graveyard'!=_0x353d9e['root']['rootName']&&'$graveyard'==_0x1a8a9d['getRange']()['root']['rootName']&&!_0x22dfc2['has'](_0x1a8a9d['name'])){const _0x2746db=_0x3eca40['schema']['getNearestSelectionRange'](_0x5f1fb2['deletionPosition']);if(_0x2746db){const _0x1286af=_0x519926['fromRange'](_0x2746db);_0x22dfc2['set'](_0x1a8a9d['name'],_0x1286af),_0x1286af['on']('change:range',(_0x40eac2,_0x4dec52,_0x3bbb7b)=>{if('$graveyard'==_0x1286af['root']['rootName']){const _0x5b5fdf=_0x3eca40['schema']['getNearestSelectionRange'](_0x3bbb7b['deletionPosition']);_0x5b5fdf?(_0x1286af['start']=_0x5b5fdf['start'],_0x1286af['end']=_0x5b5fdf['end']):(_0x22dfc2['delete'](_0x1a8a9d['name']),_0x1286af['detach']());}});}}});}),_0x3eca40['document']['on']('change',()=>{_0x22dfc2['size']>0x0&&_0x3eca40['enqueueChange']({'isUndoable':!0x1},_0x1b85fa=>{for(const [_0x11da2e,_0x2f3eed]of _0x22dfc2)'$graveyard'==_0x3eca40['markers']['get'](_0x11da2e)['getRange']()['root']['rootName']&&(te(_0x11da2e['split'](':')[0x2],_0x2f3eed['toRange'](),_0x3eca40,_0x1b85fa),_0x2f3eed['detach']());_0x22dfc2['clear']();});});}(_0x59f466),this['_domEmitter']['listenTo'](_0x2ed649['document'],'keydown',(_0xebf1f4,{key:_0x11ca11})=>{'Escape'===_0x11ca11&&function(_0x46befa){_0x46befa['editing']['view']['change'](_0x29f2f9=>{for(const _0x102df4 of _0x46befa['model']['markers']){if(!_0x102df4['name']['startsWith']('user:position'))continue;const _0x4e3cf2=_0x46befa['editing']['mapper']['markerNameToElements'](_0x102df4['name']);if(_0x4e3cf2){for(const _0x36d9d2 of _0x4e3cf2)_0x29f2f9['removeClass']('ck-user__marker_hovered',_0x36d9d2);}}});}(_0x59f466);},{'useCapture':!0x0});}['afterInit'](){const _0x20cb0b=this['editor'],_0x1d32e0=_0x20cb0b['commands']['get']('undo');_0x1d32e0&&_0x20cb0b['model']['on']('applyOperation',(_0x5b432b,_0x2a9640)=>{const _0x35e863=_0x2a9640[0x0];if(!_0x35e863['isDocumentOperation'])return;if('marker'!=_0x35e863['type']||!_0x35e863['name']['startsWith']('user:'))return;const _0x5d6993=_0x35e863['batch'];_0x1d32e0['_createdBatches']['has'](_0x5d6993)&&(_0x35e863['newRange']=_0x35e863['oldRange']?_0x20cb0b['model']['createRange'](_0x35e863['oldRange']['start'],_0x35e863['oldRange']['end']):null);},{'priority':'highest'});}['destroy'](){return this['_domEmitter']['stopListening'](),super['destroy']();}['createUserMarkerOperations'](){const _0x2daafb=this['editor'],_0x146d4c=_0x2daafb['model']['document'],_0x49f5dc=_0x2daafb['plugins']['get'](i);_0x2daafb['model']['enqueueChange']({'isUndoable':!0x1},_0x26d047=>{const _0x4b6fe6='user:range:'+_0x49f5dc['mySessionId'],_0x137980='user:position:'+_0x49f5dc['mySessionId'],_0x370254=_0x2daafb['model']['markers']['has'](_0x4b6fe6);_0x2daafb['editing']['view']['hasDomSelection']?te(_0x49f5dc['mySessionId'],_0x146d4c['selection']['getFirstRange'](),_0x2daafb['model'],_0x26d047):_0x370254&&(_0x26d047['removeMarker'](_0x4b6fe6),_0x26d047['removeMarker'](_0x137980));});}}function te(_0x5ebf38,_0x4a0684,_0x1e4910,_0x582a12){const _0x2329f8='user:range:'+_0x5ebf38,_0x3b6243='user:position:'+_0x5ebf38,_0x1fda25=_0x4a0684['getContainedElement']();let _0x1b5711=_0x4a0684['start'];if(_0x1fda25&&_0x1fda25['is']('element','tableCell')){const _0xfcb0a=function(_0x39469f,_0x5237e5){for(const _0x327c42 of _0x39469f['getPositions']())if(_0x5237e5['schema']['checkChild'](_0x327c42,'$text'))return _0x327c42;}(_0x4a0684,_0x1e4910);_0xfcb0a&&(_0x1b5711=_0xfcb0a,_0x4a0684=_0x582a12['createRange'](_0x1b5711));}const _0x5e971b=_0x582a12['createRange'](_0x1b5711);_0x1e4910['markers']['has'](_0x2329f8)?(_0x582a12['updateMarker'](_0x2329f8,{'range':_0x4a0684}),_0x582a12['updateMarker'](_0x3b6243,{'range':_0x5e971b})):(_0x582a12['addMarker'](_0x2329f8,{'range':_0x4a0684,'usingOperation':!0x0}),_0x582a12['addMarker'](_0x3b6243,{'range':_0x5e971b,'usingOperation':!0x0}));}function K(_0x29770f,_0x1f7fe7,_0x10b680){const _0x3d38e2=_0x29770f['t'],t=_0x29770f['t'];switch(_0x1f7fe7){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 _0x3d38e2({'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'},_0x10b680);default:return'';}}let X=0x1;class l extends _0x23684a{static ['CollaborativeEditingService']=/* #__PURE__ -- @preserve */
|
|
25
|
-
((()=>_0xd1b7d9)());['_offset'];['sessionId'];['serverHistory'];['_channelId'];['_service'];['_document'];['_compressor'];['_bufferedOperations'];['_knownOperations'];['_knownRootNames'];['_pendingAction'];['_hasSelectionChanged'];['_sendBufferedOperationsDelayId'];['_baseBufferDelay'];['_currentBufferDelay'];['_lastSyncedOperationId'];['_disconnectionOperations'];['_operationIdentifier'];static get['requires'](){return[n,i,$,_0x26da0c,_0x47e255,_0x554080];}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 _0x43ebee=this['serverHistory']['getOperations']();for(let _0x3a2365=_0x43ebee['length']-0x1;_0x3a2365>=0x0;_0x3a2365--){const _0x25843c=_0x43ebee[_0x3a2365];if(!this['_disconnectionOperations']['has'](_0x25843c))return _0x25843c['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0x1ce023){if(super(_0x1ce023),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x1dfb7e(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0x189f6f('collaboration-missing-channelid',this);const _0x4a8c4b=_0x1ce023['config']['get']('cloudServices.bundleVersion')||nt;this['_service']=new l['CollaborativeEditingService'](_0x4a8c4b,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0x51dc20(),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 _0x4e771a=this['editor'],_0x84c9d3=_0x4e771a['plugins']['get'](_0x47e255),_0x245641=_0x4e771a['plugins']['get'](n);this['listenTo'](_0x84c9d3,'getOperationAuthor',(_0x1dc5b1,_0x411a80)=>{const _0x14017a=_0x411a80[0x0];_0x14017a['_authorId']&&(_0x1dc5b1['return']=_0x84c9d3['getUser'](_0x14017a['_authorId']),_0x1dc5b1['stop']()),null===_0x14017a['_authorId']&&(_0x1dc5b1['return']=null,_0x1dc5b1['stop']());},{'priority':'high'}),this['listenTo'](_0x4e771a['model']['document']['selection'],'change:range',(_0x4463d1,_0x48a4fc)=>{_0x48a4fc['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x4e771a['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x4e771a['model']['on']('applyOperation',(_0x33d0de,_0x34f3f4)=>{const _0xa4317e=_0x34f3f4[0x0];_0xa4317e['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0xa4317e),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['bind']('_isEditingAllowed')['to'](_0x245641,'state',this,'_hasSynchronizationProblem',(_0x1ae8a3,_0x273203)=>'connected'===_0x1ae8a3&&!_0x273203),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x4e771a['disableReadOnlyMode']('rtc-offline'):_0x4e771a['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x4e771a['disableReadOnlyMode']('rtc-offline'):_0x4e771a['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async['reconnect'](){const _0xb3589f=this['editor']['plugins']['get'](i),_0x8a8f95=this['editor']['plugins']['get'](n);try{this['_isPendingUpdate']=!0x0,_0xb3589f['unregister'](this['_channelId']);const _0xbb12bb=await this['_service']['reconnect'](_0x8a8f95['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0xbb12bb)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x16e25a=await this['_service']['getConnectedSessions']();_0xb3589f['register'](this['_channelId'],_0x16e25a),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x166a9c){if(function(_0x5e3ed4){return'404'===_0x5e3ed4['code'];}(_0x166a9c)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0x5644e3){return'409'===_0x5644e3['code'];}(_0x166a9c)){const _0x981874=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'](_0x981874);}else{if(!(_0x166a9c instanceof Y))throw _0x166a9c;this['_handleReconnectionError']();}}}}['destroy'](){const _0x3126fe=this['editor']['plugins']['get'](n),_0x575b5a=this['editor']['plugins']['get'](i);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x575b5a['channelSessions']['has'](this['_channelId'])&&_0x575b5a['unregister'](this['_channelId']),_0x3126fe['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async['_handleReconnectionResponse'](_0x2eac6b){if(this['sessionId']!==_0x2eac6b['sessionId']&&this['_lastSyncedOperationId']!==_0x2eac6b['lastOperationId'])throw new Y();return this['sessionId']=_0x2eac6b['sessionId'],this['_handleServerResponse']([],{..._0x2eac6b,'wereChangesApplied':!0x1,'data':_0x2eac6b['data']},'reconnect');}async['_connectService'](_0x28925d,_0x107e63=!0x1){const {connection:_0x4eb5a5}=this['editor']['plugins']['get'](n);l['CollaborativeEditingService']['getConnectedSessions'](_0x4eb5a5,this['_channelId'])['then'](_0x438f9f=>this['_initSessionsHandling'](_0x438f9f))['catch'](_0x41de1a=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x41de1a);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x19c203,_0x1afc00)=>{this['_crash']('realtimecollaborationclient-init-service-internal-error',_0x1afc00);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_isConnected']=!0x1;});const _0x55adc6=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x28925d);this['_isPendingUpdate']=!0x0;const _0x1a8cca=await this['_service']['connect'](_0x4eb5a5,this['_compressOperations'](_0x28925d),_0x55adc6);if(this['sessionId']=_0x1a8cca['sessionId'],_0x107e63){if(!_0x1a8cca['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x1a8cca['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0x28925d,_0x1a8cca,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x1a8cca,_0x28925d);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}['_handleSendingSelectionMarkers'](){const _0x3a85a1=this['editor']['plugins']['get'](i),_0x5ec4ca=this['editor']['plugins']['get']($),_0x4004b6=_0x3a85a1['channelSessions']['get'](this['_channelId']);_0x4004b6&&_0x4004b6['length']>0x1?_0x5ec4ca['createUserMarkerOperations']():this['listenTo'](_0x3a85a1,'sessionAdd:'+this['_channelId'],()=>{0x2===_0x3a85a1['channelSessions']['get'](this['_channelId'])['length']&&_0x5ec4ca['createUserMarkerOperations']();});}async['_handleReceivedOperations'](_0x36944b,_0x1f5da8,_0x3af6be,_0x5b37dd){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x1f5da8){const _0x56952d=this['_decompressOperations'](_0x3af6be,_0x5b37dd);await this['_fetchMissingUsers'](_0x56952d),this['_handleExternalOperations'](_0x56952d,_0x1f5da8,_0x3af6be['lastOperationId'])||this['_crash']('realtimecollaborationclient-init-service-incorrect-server-operation');}}async['_connectAfterSessionHasBeenFlushed'](){this['_disconnectService']();const {locale:_0xedad06}=this['editor'];let _0x269d7b;try{_0x269d7b=await this['_service']['getDocumentDetails']();}catch{const _0x5036b6=K(_0xedad06,'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'](_0x5036b6);}const _0x25cd54=_0x269d7b['currentDocumentSession']||_0x269d7b['lastDocumentSession'];if(this['_lastSyncedOperationId']!==_0x25cd54['lastOperationId']){const _0x3c478e=K(_0xedad06,'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'](_0x3c478e);}await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);}['_disconnectService'](){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['stopListening'](this['_service']);}['_initSessionsHandling'](_0x41926c){const _0x19eed0=this['editor']['plugins']['get'](i);this['listenTo'](_0x19eed0,'sessionAdd:'+this['_channelId'],(_0x4fce9a,{session:_0x5325f2})=>{if(_0x5325f2['id']===_0x19eed0['mySessionId']){_0x4fce9a['off']();const _0x5b26f1=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0x232bf8=_0x5325f2['permissions'];_0x5b26f1&&_0x5b26f1['isEnabled']&&(_0x232bf8=_0x232bf8['filter'](_0xe02f2a=>'document:write'!==_0xe02f2a)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0x232bf8,this['_channelId']);}}),_0x19eed0['register'](this['_channelId'],_0x41926c);}['_initThrowingOnDataSet'](){const _0x43f819=this['editor']['data']['set'];this['editor']['data']['set']=(..._0x1cddc6)=>{if(!_0x1cddc6[_0x1cddc6['length']-0x1]['suppressErrorInCollaboration'])throw new _0x189f6f('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x43f819['apply'](this['editor']['data'],_0x1cddc6);};}['_setUpDataInit'](){this['editor']['data']['on']('init',(_0x123e7f,[_0x53535c])=>{if(this['_document']['version'])throw new _0x189f6f('realtimecollaborationclient-init-document-already-initialized',this);_0x123e7f['stop'](),this['_setPendingAction']();const _0x30a99f=this['editor']['config']['get']('rootsAttributes'),_0x3fa5f9=this['_getOperationsFromInitData'](_0x53535c,_0x30a99f);0x0==_0x3fa5f9['length']&&_0x3fa5f9['push'](new _0x372d2b(0x0)),_0x123e7f['return']=this['_connectService'](_0x3fa5f9)['then'](()=>{this['editor']['plugins']['get'](n)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x13849b=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x13849b))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x3c346d,[_0x36fbb2,_0x5d1e2c])=>{_0x3c346d['stop']();const _0x2ec9ed=this['editor']['model']['document']['getRoot'](_0x36fbb2);if(!this['_knownRootNames']['has'](_0x36fbb2)){const _0x19bd1=_0x5d1e2c&&_0x5d1e2c['data']?_0x5d1e2c['data']:'',_0x235944=_0x5d1e2c&&_0x5d1e2c['attributes']?_0x5d1e2c['attributes']:{};await this['_loadRoot'](_0x36fbb2,_0x19bd1,_0x235944);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0x2ec9ed['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0x2ec9ed);});},{'priority':'high'});}async['_fetchMissingUsers'](_0xd83ed){const _0x4d8ce6=this['editor']['plugins']['get'](_0x47e255),{connection:_0x54add0}=this['editor']['plugins']['get'](n),_0x175501=new Set();for(const _0x1422ca of _0xd83ed){const _0x49dbb9=_0x1422ca['_authorId'];_0x49dbb9&&!_0x4d8ce6['getUser'](_0x49dbb9)&&_0x175501['add'](_0x49dbb9);}if(0x0===_0x175501['size'])return;const _0x47140c=await ct['getMany'](_0x54add0,Array['from'](_0x175501));for(const _0x10afe8 of _0x47140c)_0x4d8ce6['getUser'](_0x10afe8['id'])||_0x4d8ce6['addUser'](_0x10afe8);}['_getOperationsFromInitData'](_0x47b13b,_0x15f8ce={}){const _0x59bab8=this['editor']['model'],_0x102b84=[];let _0x584715=0x0;const _0x4bf8c8='string'==typeof _0x47b13b?{'main':_0x47b13b}:_0x47b13b;for(const _0x1cdcfd of Object['keys'](_0x4bf8c8)){if(!this['_document']['roots']['has'](_0x1cdcfd))throw new _0x189f6f('realtimecollaborationclient-init-non-existent-root',this);const _0x323613=this['editor']['data']['parse'](_0x4bf8c8[_0x1cdcfd]),_0x17b8f8=this['_document']['getRoot'](_0x1cdcfd),_0x1aa6d6=new _0x1bca00(_0x59bab8['createPositionAt'](_0x17b8f8,0x0),_0x323613,_0x584715++);_0x102b84['push'](_0x1aa6d6);for(const [_0x46fe0a,_0x45ebbe]of _0x323613['markers']){const _0x2f6701=_0x59bab8['createRange'](_0x59bab8['createPositionFromPath'](_0x17b8f8,_0x45ebbe['start']['path']['slice']()),_0x59bab8['createPositionFromPath'](_0x17b8f8,_0x45ebbe['end']['path']['slice']())),_0x2430dd=new _0x59297b(_0x46fe0a,null,_0x2f6701,_0x59bab8['markers'],!0x0,_0x584715++);_0x102b84['push'](_0x2430dd);}}if(_0x15f8ce)for(const [_0x4b93ea,_0x50a6b7]of Object['entries'](_0x15f8ce)){const _0x513061=_0x59bab8['document']['getRoot'](_0x4b93ea);if(!_0x513061)throw new _0x189f6f('multi-root-editor-root-attributes-no-root',null);for(const [_0x248ab7,_0x58dec5]of Object['entries'](_0x50a6b7))if(null!==_0x58dec5){const _0x57605d=new _0x5bf9a3(_0x513061,_0x248ab7,null,_0x58dec5,_0x584715++);_0x102b84['push'](_0x57605d);}}return _0x102b84;}async['_loadRoot'](_0x154382,_0x48767f,_0x545584){this['_getOperationsFromInitData']({[_0x154382]:_0x48767f},{[_0x154382]:_0x545584})['forEach']((_0x129f98,_0x511732)=>{_0x129f98['baseVersion']=this['_document']['version']+_0x511732,_0x129f98['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x129f98);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async['_handleInitialConnectionData'](_0x4d68bd,_0x364367){let _0x1aedeb;this['_offset']=_0x4d68bd['offset'];const _0x5dacaa=_0x4d68bd['wereChangesApplied']&&!_0x4d68bd['initData'],_0xcf5d52=_0x5dacaa?0x0:_0x4d68bd['data']['baseVersion'];if(_0x364367['forEach'](_0x37ab09=>{_0x37ab09['_isInit']=!0x0,_0x37ab09['createdAt']=_0x4d68bd['sessionCreatedAt'],_0x37ab09['_authorId']=null;}),_0x5dacaa)_0x1aedeb=_0x364367,this['_applyOperationsSet'](_0x1aedeb,_0x5dacaa);else{if(_0x4d68bd['initData']){const _0x39e539=this['_getOperationsFromInitData'](_0x4d68bd['initData']);this['_document']['history']['version']=-_0x39e539['length'],_0x39e539['forEach'](_0x1fbc83=>{_0x1fbc83['baseVersion']-=_0x39e539['length'],_0x1fbc83['createdAt']=_0x4d68bd['sessionCreatedAt'],_0x1fbc83['_isInit']=!0x0,_0x1fbc83['_authorId']=null;}),this['_applyOperationsSet'](_0x39e539,!0x0),this['serverHistory']['version']=-_0x39e539['length']+this['_offset'],this['_updateServerHistory'](_0x39e539);}this['_document']['history']['version']=_0xcf5d52,_0x1aedeb=this['_decompressOperations'](_0x4d68bd['data'],_0x4d68bd['metadata']),await this['_fetchMissingUsers'](_0x1aedeb),this['_applyOperationsSet'](_0x1aedeb,_0x5dacaa);}_0x4d68bd['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x1aedeb,_0x4d68bd['lastOperationId']),this['_lastSyncedOperationId']=_0x4d68bd['lastOperationId']),this['serverHistory']['version']=_0xcf5d52+this['_offset'],this['_updateServerHistory'](_0x1aedeb),_0x364367['filter'](_0x123557=>{const _0x133672=this['_getAffectedRoot'](_0x123557);return _0x133672&&!this['_knownRootNames']['has'](_0x133672);})['forEach']((_0x4110e1,_0x50741e)=>{_0x4110e1['baseVersion']=this['_document']['version']+_0x50741e,this['_saveOperationInBuffer'](_0x4110e1);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x55b6d0,_0x2736f7){const _0x1feefd=_0x2736f7&&_0x2736f7['message'];if(_0x1feefd&&_0x1feefd['startsWith']('realtimecollaborationclient'))throw _0x2736f7;const _0xe9da6c=this['editor']['plugins']['get'](n);throw this['_isPendingUpdate']=!0x0,_0xe9da6c['disconnect'](),this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0x189f6f(_0x55b6d0,this['editor'],_0x1feefd?{'originalError':_0x1feefd}:void 0x0);}['_saveOperationInBuffer'](_0x1dab41){this['_knownOperations']['has'](_0x1dab41)||(this['_knownOperations']['add'](_0x1dab41),this['_bufferedOperations']['push'](_0x1dab41),this['_pendingAction']||'marker'==_0x1dab41['type']&&!_0x1dab41['affectsData']||this['_setPendingAction']());}['_sendBufferedOperationsDelayed'](_0x5b408a=!0x1){!_0x5b408a&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0x480305=>{_0x480305&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0x1c3862=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0x20c3c4){return _0x20c3c4['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x20c3c4['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0x20c3c4['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0x1c3862)||this['_crash'](_0x1c3862['message'],_0x1c3862);});},this['_currentBufferDelay']));}['_waitUntilSynced'](){return new Promise(_0x25a8b0=>{this['on']('change:_isPendingUpdate',()=>{_0x25a8b0();});});}async['_sendBufferedOperations'](){const _0x331809=this['editor']['plugins']['get']($);if(this['_shouldSendSelectionUpdate']()&&(_0x331809['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x518bd9=[...this['_bufferedOperations']];for(const _0x568b11 of _0x518bd9)_0x568b11['wasUndone']=this['_document']['history']['isUndoneOperation'](_0x568b11);const _0x1d5186=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x518bd9),_0x54cbd4=X++,_0x275fa8=this['_compressOperations'](_0x518bd9),_0x1814e9=await this['_service']['sendOperations'](_0x275fa8,_0x275fa8['baseVersion'],_0x1d5186);try{return await this['_handleServerResponse'](_0x518bd9,_0x1814e9,_0x54cbd4);}catch(_0x1b153b){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0x1b153b);}}async['_handleServerResponse'](_0x20bd0f,_0x3b4a8c,_0x4bdc55){if('error'in _0x3b4a8c)throw _0x3b4a8c['error'];let _0x3dc1e2=!0x1;if(_0x3b4a8c['wereChangesApplied']){_0x3b4a8c['lastOperationId']&&(this['_lastSyncedOperationId']=_0x3b4a8c['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0xc37ab0=>!_0x20bd0f['includes'](_0xc37ab0));for(const _0x537bba of _0x20bd0f)_0x537bba['createdAt']='lastOperationAcceptedAt'in _0x3b4a8c&&_0x3b4a8c['lastOperationAcceptedAt']||void 0x0;Z(_0x20bd0f,_0x3b4a8c['version']-_0x20bd0f['length']),this['_updateServerHistory'](_0x20bd0f);const _0x3578da=_0x20bd0f['filter'](_0x191179=>{if(!_0x191179['_isInit'])return!0x1;const _0x4891a1=this['_getAffectedRoot'](_0x191179);return _0x4891a1&&!this['_knownRootNames']['has'](_0x4891a1);});Z(_0x3578da,this['_document']['version']),this['_applyOperationsSet'](_0x3578da),_0x3dc1e2=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0x4e340c=this['_decompressOperations'](_0x3b4a8c['data'],_0x3b4a8c['metadata'])['filter'](_0x553da0=>_0x553da0['baseVersion']>=this['_lastServerVersion']);_0x4e340c['forEach'](_0x152524=>this['_addKnownRoot'](_0x152524)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x590407=>!_0x590407['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x590407))),this['_bufferedOperations']['length']&&Z(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0x4e340c),_0x3dc1e2=this['_handleExternalOperations'](_0x4e340c,_0x3b4a8c['version'],_0x3b4a8c['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x3dc1e2?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}['_handleExternalOperations'](_0x4a4dc8,_0x5498d7,_0x28f3f0){try{const _0x1f0404={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x498d09,operationsB:_0x49ee3a,originalOperations:_0x4c9e59}=_0x29fd05(_0x4a4dc8,this['_bufferedOperations'],_0x1f0404);Z(_0x498d09,this['_document']['version']),Z(_0x49ee3a,_0x5498d7);for(const _0x13829b of _0x498d09){const _0x28813f=_0x4c9e59['get'](_0x13829b);_0x13829b['_authorId']=_0x28813f?_0x28813f['_authorId']:null;}_0x28f3f0&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x4a4dc8,_0x28f3f0),this['_lastSyncedOperationId']=_0x28f3f0),this['_bufferedOperations']=[..._0x49ee3a],this['_applyOperationsSet'](_0x498d09),this['_updateServerHistory'](_0x4a4dc8);}catch(_0x4b7c74){return console['error'](_0x4b7c74),!0x1;}return!0x0;}['_applyOperationsSet'](_0x561b56,_0xc6d040=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0x249cda=>{for(const _0x3df38f of _0x561b56)this['_knownOperations']['add'](_0x3df38f),this['_addKnownRoot'](_0x3df38f),_0x249cda['batch']['addOperation'](_0x3df38f),this['editor']['model']['applyOperation'](_0x3df38f);});}['_addKnownRoot'](_0x55fc3a){const _0x271e2c=this['_getAffectedRoot'](_0x55fc3a);_0x271e2c&&this['_knownRootNames']['add'](_0x271e2c);}['_getAffectedRoot'](_0x1e3deb){let _0x396df2,_0x1ff7dd;switch(_0x1e3deb['type']){case'insert':_0x396df2=_0x1e3deb['position']['root'];break;case'marker':if(_0x1ff7dd=_0x1e3deb['newRange'],!_0x1ff7dd)return null;_0x396df2=_0x1ff7dd['root'];break;case'addRootAttribute':_0x396df2=_0x1e3deb['root'];break;case'addRoot':_0x396df2=_0x1e3deb['affectedSelectable'];break;case'move':_0x396df2=_0x1e3deb['targetPosition']['root'];break;default:return null;}return _0x396df2['rootName'];}['_updateServerHistory'](_0x2d57a3){_0x2d57a3['forEach'](_0x309e6b=>{const _0x1c3d40=_0x309e6b['clone']();_0x1c3d40['_authorId']=_0x309e6b['_authorId'],_0x1c3d40['_isInit']=!!_0x309e6b['_isInit'],_0x1c3d40['createdAt']=_0x309e6b['createdAt'],_0x1c3d40['baseVersion']+=this['_offset'],_0x309e6b['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x1c3d40),this['serverHistory']['addOperation'](_0x1c3d40);});}['_handleReconnectionError'](_0xc67a38){const _0x6a115d=this['editor']['plugins']['get']('Notification'),_0x3c096c=this['editor']['locale'];_0xc67a38||(_0xc67a38=K(_0x3c096c,'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.')),_0x6a115d['showWarning'](_0xc67a38,{'title':K(_0x3c096c,'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'](_0x26da0c)['add'](K(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}['_clearPendingAction'](){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x26da0c)['remove'](this['_pendingAction']),this['_pendingAction']=null);}['_compressOperations'](_0x333fc6){const _0x3361da=_0x333fc6['map'](_0x36923b=>_0x36923b['toJSON']());return this['_compressor']['compress'](_0x3361da);}['_decompressOperations'](_0x4388c3,_0xa22c2){return this['_compressor']['decompress'](_0x4388c3)['map']((_0x52deca,_0x93eec7)=>{const _0x46da59='init'==_0xa22c2[_0x93eec7]['type'];if('InsertOperation'==_0x52deca['__className']){const _0x84bf5a=_0x52deca['position']['root'];!this['_document']['getRoot'](_0x84bf5a)&&(this['_document']['createRoot']('$root',_0x84bf5a)['_isAttached']=!0x1);}const _0x168ddb=_0x35c2fd['fromJSON'](_0x52deca,this['_document']);return _0x168ddb['wasUndone']=_0x52deca['wasUndone'],_0x168ddb['_isInit']=_0x46da59,_0x168ddb['_authorId']=_0x46da59?null:_0xa22c2[_0x93eec7]['userId'],_0x168ddb['_isDisconnection']='cs:removeUser'===_0xa22c2[_0x93eec7]['type'],_0x168ddb['createdAt']=_0xa22c2[_0x93eec7]['createdAt'],_0x168ddb;});}['_refreshUserSelectionMarkers'](){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}['_shouldSendSelectionUpdate'](){const _0x243930=this['editor']['plugins']['get'](i)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0x243930&&_0x243930['length']>0x1&&this['_hasSelectionChanged'];}['_shouldSendUpdate'](){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}}class Y extends Error{}function Z(_0x3ced4f,_0x3b31ee){for(const _0x5b349e of _0x3ced4f)_0x5b349e['baseVersion']=_0x3b31ee++;}class tt{['_ignoredOperations'];['_operationToId'];constructor(_0x52f0ba){this['_ignoredOperations']=_0x52f0ba,this['_operationToId']=new WeakMap();}['getIdOfTheLastOperation'](_0x398b49){let _0x40d1a4=_0x398b49['length'];for(;_0x40d1a4--;){const _0x3bed62=_0x398b49[_0x40d1a4];if(!this['_ignoredOperations']['has'](_0x3bed62)){if(!this['_operationToId']['has'](_0x3bed62)){const _0x5e95d9=_0x34d92d()['slice'](0x1,0x12);this['_operationToId']['set'](_0x3bed62,_0x5e95d9);}return this['_operationToId']['get'](_0x3bed62);}}}['setIdForTheLastOperation'](_0x568d77,_0x6f3e58){if(!_0x6f3e58)return;let _0x4e0964=_0x568d77['length'];for(;_0x4e0964--;){const _0x1328f7=_0x568d77[_0x4e0964];this['_ignoredOperations']['has'](_0x1328f7)||this['_operationToId']['set'](_0x1328f7,_0x6f3e58);}}}class a extends _0x23684a{static get['requires'](){return[l];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class s extends _0x24e504{static ['CommentsService']=/* #__PURE__ -- @preserve */
|
|
26
|
-
((()=>_0x430834)());['_services'];static get['requires'](){return[n,'CommentsRepository',i,_0x47e255];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x3a6e70){super(_0x3a6e70),this['_services']=new Map();}async['init'](){const _0x12f0be=this['context'],_0x4956b8=_0x12f0be['plugins']['get']('CommentsRepository');if(_0x12f0be['plugins']['get'](n)['addToReconnectionStack'](this),_0x4956b8['adapter']={'addCommentThread':async({channelId:_0x3ff971,threadId:_0x4a7293,comments:_0x415171,resolvedAt:_0x1857e4,resolvedBy:_0x54e048,context:_0x1f14eb,attributes:_0x2fc12c})=>{const _0x6ef519=await this['_getService'](_0x3ff971)['addCommentThread']({'commentThreadId':_0x4a7293,'comments':_0x415171['map'](_0x121327=>function(_0x22c799,_0x533719,_0x32c958){return{'commentThreadId':_0x32c958,'commentId':_0x22c799['commentId'],'userId':_0x22c799['authorId'],'content':_0x22c799['content'],'documentId':_0x533719,'createdAt':_0x22c799['createdAt'],'attributes':_0x22c799['attributes']||{}};}(_0x121327,_0x3ff971,_0x4a7293)),'resolvedAt':_0x1857e4,'resolvedBy':_0x54e048,'context':_0x1f14eb,'attributes':_0x2fc12c})['catch'](at);return{'threadId':_0x6ef519['commentThreadId'],'comments':_0x6ef519['comments']};},'getCommentThread':async({channelId:_0x1a33f4,threadId:_0x17285e})=>{const _0x360738=await this['_getService'](_0x1a33f4)['getCommentThread'](_0x17285e)['catch'](at);return _0x360738['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0x360738]),{'threadId':_0x360738['commentThreadId'],'comments':_0x360738['comments']['map'](U),'context':_0x360738['context'],'resolvedAt':_0x360738['resolvedAt'],'resolvedBy':_0x360738['resolvedBy'],'attributes':_0x360738['attributes']||{}});},'updateCommentThread':async({channelId:_0x5b933f,threadId:_0x26764c,context:_0x236e76,unlinkedAt:_0xcfb85a,attributes:_0x372ab6})=>this['_getService'](_0x5b933f)['updateCommentThread']({'commentThreadId':_0x26764c,'context':_0x236e76,'attributes':_0x372ab6,'unlinkedAt':_0xcfb85a})['catch'](F)['catch'](at),'resolveCommentThread':async({channelId:_0x20e146,threadId:_0x31d0fd})=>{const _0x27bf92=await this['_getService'](_0x20e146)['resolveCommentThread'](_0x31d0fd)['catch'](F)['catch'](at);return{'threadId':_0x27bf92['commentThreadId'],'resolvedAt':_0x27bf92['resolvedAt'],'resolvedBy':_0x27bf92['resolvedBy']};},'reopenCommentThread':async({channelId:_0x1ee511,threadId:_0x36daad})=>this['_getService'](_0x1ee511)['reopenCommentThread'](_0x36daad)['catch'](F)['catch'](at),'removeCommentThread':({channelId:_0x4376cf,threadId:_0x401375})=>this['_getService'](_0x4376cf)['removeCommentThread'](_0x401375)['catch'](F)['catch'](at),'addComment':({channelId:_0x2cd899,threadId:_0x1c649e,commentId:_0x23ba0b,content:_0x1d168f,attributes:_0x245f34})=>this['_getService'](_0x2cd899)['addComment'](_0x1c649e,_0x23ba0b,_0x1d168f,_0x245f34)['catch'](at),'updateComment':({channelId:_0x2960b6,threadId:_0x27f906,commentId:_0xad96c,content:_0xceca4e,attributes:_0x2b36ba})=>this['_getService'](_0x2960b6)['updateComment'](_0x27f906,_0xad96c,_0xceca4e,_0x2b36ba)['catch'](F)['catch'](at),'removeComment':({channelId:_0x579d67,threadId:_0x33c70e,commentId:_0x2236e4})=>this['_getService'](_0x579d67)['removeComment'](_0x33c70e,_0x2236e4)['catch'](F)['catch'](at)},_0x12f0be instanceof _0x1ac0af){const _0x2cbd4c=_0x12f0be['config']['get']('collaboration.channelId'),_0x4308ce=_0x12f0be['plugins']['get'](i);await this['_setUpService'](_0x2cbd4c);const _0x5be6ca=await this['_services']['get'](_0x2cbd4c)['getConnectedSessions']();this['listenTo'](_0x4308ce,'sessionAdd:'+_0x2cbd4c,(_0x29a3a2,{session:_0x3c4a1e})=>{_0x3c4a1e['id']===_0x4308ce['mySessionId']&&(_0x29a3a2['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x3c4a1e['permissions'],_0x2cbd4c));}),_0x4308ce['register'](_0x2cbd4c,_0x5be6ca);}}async['_setUpService'](_0x16d70a){if(this['_services']['has'](_0x16d70a))throw new _0x189f6f('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0x16d70a});const _0x566eba=this['context']['plugins']['get']('CommentsRepository'),_0x15eb78=new s['CommentsService'](_0x16d70a);this['_services']['set'](_0x16d70a,_0x15eb78),this['listenTo'](_0x15eb78,'commentThreadAdded',(_0x2c3a4a,_0x309aeb)=>{const {commentThreadId:_0x272490,documentId:_0x55f4f9,context:_0x15af85,attributes:_0x248128,resolvedAt:_0x3d5a23,resolvedBy:_0x217458,comments:_0x3086e4}=_0x309aeb;_0x566eba['getCommentThread'](_0x272490)||_0x566eba['addCommentThread']({'threadId':_0x272490,'channelId':_0x55f4f9,'comments':_0x3086e4?_0x3086e4['map'](U):[],'context':_0x15af85,'attributes':_0x248128,'resolvedAt':_0x3d5a23,'resolvedBy':_0x217458,'isFromAdapter':!0x0});}),this['listenTo'](_0x15eb78,'commentThreadUpdated',(_0x43a31b,{commentThreadId:_0x5ba4a8,documentId:_0x55ffd6,context:_0x1c0da7,unlinkedAt:_0x3125b5,attributes:_0x28807f})=>{_0x566eba['getCommentThread'](_0x5ba4a8)&&_0x566eba['updateCommentThread']({'threadId':_0x5ba4a8,'channelId':_0x55ffd6,'context':_0x1c0da7,'unlinkedAt':_0x3125b5,'attributes':_0x28807f,'isFromAdapter':!0x0});}),this['listenTo'](_0x15eb78,'commentThreadResolved',(_0x42761b,{commentThreadId:_0xc61763,resolvedBy:_0x5bc64b,resolvedAt:_0x295463})=>{const _0x56ec8e=_0x566eba['getCommentThread'](_0xc61763);_0x56ec8e&&_0x56ec8e['resolve']({'resolvedBy':_0x5bc64b,'resolvedAt':_0x295463,'isFromAdapter':!0x0});}),this['listenTo'](_0x15eb78,'commentThreadReopened',(_0x21134c,{commentThreadId:_0x2c4697})=>{const _0x62a7b3=_0x566eba['getCommentThread'](_0x2c4697);_0x62a7b3&&_0x62a7b3['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0x15eb78,'commentThreadRemoved',(_0x34ed6b,{commentThreadId:_0x421af9})=>{const _0x3f3e8a=_0x566eba['getCommentThread'](_0x421af9);_0x3f3e8a&&_0x3f3e8a['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0x15eb78,'commentAdded',(_0x7be06b,_0x3e7fdd)=>{const _0x35961e=_0x3e7fdd['commentThreadId'],_0x5b982b=_0x566eba['getCommentThread'](_0x35961e);_0x5b982b&&_0x5b982b['addComment']({...U(_0x3e7fdd),'isFromAdapter':!0x0});}),this['listenTo'](_0x15eb78,'commentUpdated',(_0x404664,{commentThreadId:_0x5b4090,commentId:_0x41cbe1,content:_0x56aa6f,attributes:_0x5c6ed5})=>{const _0xe54462=_0x566eba['getCommentThread'](_0x5b4090);if(_0xe54462){const _0x4128ab=_0xe54462['getComment'](_0x41cbe1);_0x4128ab&&_0x4128ab['update']({'content':_0x56aa6f,'attributes':_0x5c6ed5,'isFromAdapter':!0x0});}}),this['listenTo'](_0x15eb78,'commentRemoved',(_0x596549,{commentThreadId:_0x515b00,commentId:_0x464e19})=>{const _0x1c60b5=_0x566eba['getCommentThread'](_0x515b00);if(_0x1c60b5){const _0x2dec31=_0x1c60b5['getComment'](_0x464e19);_0x2dec31&&_0x2dec31['remove']({'isFromAdapter':!0x0});}}),await this['_connectService'](_0x16d70a);}['destroy'](){if(this['context']instanceof _0x1ac0af){const _0x444c3d=this['context']['config']['get']('collaboration.channelId');this['_terminateService'](_0x444c3d);}}['_terminateService'](_0x220d98){if(!this['_services']['has'](_0x220d98))throw new _0x189f6f('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0x220d98});this['_getService'](_0x220d98)['disconnect'](),this['_services']['delete'](_0x220d98);}async['reconnect'](){for(const _0x1be548 of this['_services']['keys']())await this['_connectService'](_0x1be548);if(this['context']instanceof _0x1ac0af){const _0x44f45f=this['context']['config']['get']('collaboration.channelId'),_0x21e59f=this['context']['plugins']['get'](i);_0x21e59f['unregister'](_0x44f45f);const _0x1bd10c=await this['_services']['get'](_0x44f45f)['getConnectedSessions']();_0x21e59f['register'](_0x44f45f,_0x1bd10c);}}async['_connectService'](_0x503e3a){const {connection:_0x1cd383}=this['context']['plugins']['get'](n),_0x27e84c=this['context']['plugins']['get']('CommentsRepository'),_0x4fdc93=this['_services']['get'](_0x503e3a),_0x424c53=await _0x4fdc93['connect'](_0x1cd383);await this['_fetchMissingUsersForThreads'](_0x424c53);const _0x3c485b=new Set(Array['from'](_0x27e84c['getCommentThreads']({'channelId':_0x503e3a}),_0x44c22c=>_0x44c22c['id']));for(const _0x819c09 of _0x424c53)_0x819c09['deletedAt']||_0x3c485b['delete'](_0x819c09['commentThreadId']);for(const _0x3eb37d of _0x3c485b)_0x27e84c['getCommentThread'](_0x3eb37d)['remove']({'isFromAdapter':!0x0});for(const _0x4fabc4 of _0x424c53){let _0x28f22c=_0x27e84c['getCommentThread'](_0x4fabc4['commentThreadId']);const {commentThreadId:_0x3e87e1,context:_0x188c30,attributes:_0x5305f2,resolvedBy:_0x1f85e2,resolvedAt:_0x1ea833,unlinkedAt:_0x33eaf4,deletedAt:_0x1c0c6c}=_0x4fabc4;if(_0x1c0c6c)continue;_0x28f22c||(_0x28f22c=_0x27e84c['addCommentThread']({'channelId':_0x503e3a,'threadId':_0x3e87e1,'context':_0x188c30,'attributes':_0x5305f2||{},'resolvedBy':_0x1f85e2,'resolvedAt':_0x1ea833,'unlinkedAt':_0x33eaf4,'isFromAdapter':!0x0}));const _0x340491=new Set(Array['from'](_0x28f22c['comments'],_0x20794c=>_0x20794c['id']));for(const _0x8d4d84 of _0x4fabc4['comments'])_0x340491['delete'](_0x8d4d84['commentId']);for(const _0x121d9d of _0x340491)_0x28f22c['getComment'](_0x121d9d)['remove']({'isFromAdapter':!0x0});for(const _0x358e56 of _0x4fabc4['comments']){const _0x343ca9=_0x28f22c['getComment'](_0x358e56['commentId']);_0x343ca9?_0x343ca9['content']!==_0x358e56['content']&&_0x343ca9['update']({'content':_0x358e56['content'],'isFromAdapter':!0x0}):_0x28f22c['addComment'](Object['assign'](U(_0x358e56),{'isFromAdapter':!0x0}));}}}['_getService'](_0x4b2872){if(!this['_services']['has'](_0x4b2872))throw new _0x189f6f('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0x4b2872});return this['_services']['get'](_0x4b2872);}async['_fetchMissingUsersForThreads'](_0x16003a){const _0x21d5bf=this['context']['plugins']['get'](_0x47e255),{connection:_0x1b6a30}=this['context']['plugins']['get'](n),_0x3460dc=new Set();for(const {resolvedBy:_0x514f12,comments:_0x49a152}of _0x16003a){_0x514f12&&!_0x21d5bf['getUser'](_0x514f12)&&_0x3460dc['add'](_0x514f12);for(const {userId:_0x10df9f}of _0x49a152)_0x21d5bf['getUser'](_0x10df9f)||_0x3460dc['add'](_0x10df9f);}if(0x0===_0x3460dc['size'])return;const _0x5c5bc0=await ct['getMany'](_0x1b6a30,Array['from'](_0x3460dc));for(const _0x405934 of _0x5c5bc0)_0x21d5bf['getUser'](_0x405934['id'])||_0x21d5bf['addUser'](_0x405934);}}async function F(_0xd7a1ac){if('404'!==_0xd7a1ac['code'])throw _0xd7a1ac;}function at(_0x2cfb20){if((_0x436c06=_0x2cfb20)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0x436c06['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x436c06['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0x436c06;throw _0x2cfb20;}function U(_0x5599c1){return{'threadId':_0x5599c1['commentThreadId'],'commentId':_0x5599c1['commentId'],'content':_0x5599c1['content'],'createdAt':_0x5599c1['createdAt'],'authorId':_0x5599c1['userId'],'attributes':_0x5599c1['attributes']||{}};}class m extends _0x23684a{static ['TrackChangesService']=/* #__PURE__ -- @preserve */
|
|
27
|
-
((()=>
|
|
28
|
-
((()=>_0x29efde)());['_lastRequestId'];['_revisionTracker'];['_revisionHistoryService'];['_oldOffset'];static get['requires'](){return[n,l,'RevisionHistory',i,_0x47e255];}static get['pluginName'](){return'CloudServicesRevisionHistoryAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x4a51ea){super(_0x4a51ea);const _0x5b13a1=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new c['RevisionHistoryService'](_0x5b13a1);}async['init'](){const _0x515389=this['editor']['plugins']['get'](l),_0x1341ad=_0x515389['serverHistory'],_0x4ffba4=this['editor']['plugins']['get'](n);this['_revisionTracker']['setSource']({'history':_0x1341ad,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0x515389['sessionId']});const _0x25ccda=this['editor']['config']['get']('cloudServices.bundleVersion')||nt,_0x1cc0f9=await _0x26c726['isBundleUploaded'](_0x4ffba4['connection'],_0x25ccda);this['editor']['plugins']['get']('RevisionHistory')['adapter']={'getRevision':async({revisionId:_0x2a6cfb})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0x2a6cfb)),'updateRevisions':async _0x3d17d7=>{await this['_waitForServiceReady']();const _0x187831=this['_revisionTracker']['currentRevision'];if(_0x1cc0f9&&0x1===_0x3d17d7['length']&&_0x3d17d7[0x0]['id']===_0x187831['id'])return _0x3d17d7;for(const _0x461802 of _0x3d17d7)_0x461802['id']===_0x187831['id']&&(_0x461802['isEmptyCurrent']=_0x461802['fromVersion']===_0x461802['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0x3d17d7,this['_lastRequestId'])['then'](_0x5e3e85=>(this['_lastRequestId']=_0x5e3e85,_0x3d17d7))['catch'](_0x10717b=>{if(P(_0x10717b)||'400'===_0x10717b['code']&&void 0x0!==_0x10717b['data']['wrongRequestId']){for(const _0x2c9ea1 of _0x3d17d7){!this['_revisionTracker']['repository']['getRevision'](_0x2c9ea1['id'])||this['_revisionTracker']['_bufferUpdate'](_0x2c9ea1['id'],_0x2c9ea1,!0x1);}if(P(_0x10717b))throw _0x10717b;return _0x3d17d7;}throw _0x10717b;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0x4b141d,{revisionsData:_0x5b80ac,requestId:_0x371560})=>{Math['max'](..._0x5b80ac['map'](_0x311daf=>_0x311daf['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0x5b80ac,_0x371560);}):this['_handleRevisionsUpdate'](_0x5b80ac,_0x371560);});const {revisions:_0x24c5c8,requestId:_0x4590aa}=await this['_revisionHistoryService']['connect'](_0x4ffba4['connection']);_0x4ffba4['addToReconnectionStack'](this),this['_lastRequestId']=_0x4590aa,await this['_fetchMissingUsers'](_0x24c5c8);for(const _0x3c3ed7 of _0x24c5c8)this['_revisionTracker']['addRevisionData'](_0x3c3ed7);this['listenTo'](_0x515389,'change:_isConnected',(_0x17255e,_0x351ae3,_0x19c0e2)=>{_0x19c0e2&&(this['_oldOffset']=_0x515389['_offset'],_0x17255e['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](_0x4ffba4,'state',_0x4d81b5=>_0x4d81b5===_0x543ce6['CONNECTED']);}async['reconnect'](){const _0x57e019=this['editor']['plugins']['get'](n),_0x136372=this['editor']['plugins']['get'](l),_0x4406dc=async()=>{const _0x3334f4=this['_revisionTracker']['currentRevision'],_0x1f3615=_0x3334f4['id'],_0x57e8a0=_0x1f3615!==_0x136372['sessionId'];if(_0x57e8a0){const _0x5ca368=_0x136372['_offset']-this['_oldOffset'],_0x4240cb=this['_getLatestVersionFromServerOperations']();this['_revisionTracker']['_revisionDataBuilder']['reInit']();if(_0x3334f4['toVersion']+_0x5ca368!==_0x4240cb){const _0x18239d=_0x3334f4['fromVersion']+_0x5ca368,_0x14aa85=this['editor']['plugins']['get'](_0x47e255),_0x1fde94=this['_revisionTracker']['buildRevisionData']({'revision':_0x3334f4,'from':_0x18239d,'to':_0x4240cb});_0x1fde94['id']=_0x3334f4['id'];const _0x543366=_0x1fde94['authorsIds']['map'](_0x19ac59=>_0x14aa85['getUser'](_0x19ac59));_0x3334f4['_update']({..._0x1fde94,'authors':_0x543366},!0x0),this['_revisionTracker']['_bufferUpdate'](_0x3334f4['id'],_0x1fde94,!0x0);}this['_revisionTracker']['_startingVersion']=_0x4240cb,(_0x3334f4['toVersion']===_0x3334f4['fromVersion']&&!this['_revisionTracker']['_bufferedUpdates']['has'](_0x1f3615)&&this['_revisionTracker']['repository']['_revisions']['remove'](_0x1f3615),this['_revisionTracker']['_createCurrentRevision'](_0x4240cb));}const {revisions:_0x483383,requestId:_0x28b95e}=await this['_revisionHistoryService']['reconnect'](_0x57e019['connection'],this['_lastRequestId']);_0x57e8a0&&_0x483383['length']>0x0?_0x136372['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x483383),this['_handleRevisionsUpdate'](_0x483383,_0x28b95e),this['_revisionTracker']['sendBufferedUpdates']());};return _0x136372['_isConnected']?_0x4406dc():new Promise((_0x134c70,_0x14351a)=>{_0x136372['once']('change:_isConnected',()=>{_0x4406dc()['then'](_0x134c70)['catch'](_0x14351a);});});}['destroy'](){super['destroy']();}async['_waitForServiceReady'](){this['_revisionHistoryService']['isConnected']||await new Promise(_0xb063ca=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x48511d=>{_0x48511d['off'](),_0xb063ca();});});}['_getLatestVersionFromServerOperations'](){const _0x8fb72=this['editor']['plugins']['get'](l)['serverHistory']['getOperations']()['reverse']();for(const _0x3e9cd9 of _0x8fb72)if('marker'!==_0x3e9cd9['type']||_0x3e9cd9['affectsData'])return _0x3e9cd9['baseVersion']+0x1;}['_getLatestVersion'](){const _0x49ac26=this['editor']['plugins']['get'](l);return new Promise(_0x24e11f=>{_0x49ac26['_isPendingUpdate']?_0x49ac26['once']('change:_isPendingUpdate',()=>{_0x24e11f(this['_getLatestVersionFromServerOperations']());}):_0x24e11f(this['_getLatestVersionFromServerOperations']());});}['_handleRevisionsUpdate'](_0x3bc854,_0x1c1bb7){const _0xffa2f=this['_revisionTracker']['repository'];this['_lastRequestId']=_0x1c1bb7;for(const _0x182476 of _0x3bc854){const _0x5b9c7b=_0xffa2f['getRevision'](_0x182476['id']);if(_0x5b9c7b){if((_0x182476['fromVersion']||_0x182476['toVersion'])&&(_0x182476['diffData']=null),_0x5b9c7b===this['_revisionTracker']['currentRevision']){const _0x361163=Math['max'](_0x5b9c7b['toVersion'],_0x182476['toVersion']),_0x11f99a=Math['max'](_0x5b9c7b['fromVersion'],_0x182476['fromVersion']);let _0x145bc3;_0x5b9c7b['toVersion']===_0x182476['toVersion']&&_0x5b9c7b['fromVersion']===_0x182476['fromVersion']?(_0x145bc3=!0x0,this['_preventResendingRevisionData'](_0x182476)):_0x182476['toVersion']===_0x361163&&_0x182476['fromVersion']===_0x11f99a?_0x145bc3=!0x1:(_0x5b9c7b['toVersion']===_0x361163&&_0x5b9c7b['fromVersion']===_0x11f99a||this['_fixRevision']({'revision':_0x5b9c7b,'from':_0x11f99a,'to':_0x361163}),_0x145bc3=!0x0),_0x145bc3&&(delete _0x182476['fromVersion'],delete _0x182476['toVersion'],delete _0x182476['diffData'],delete _0x182476['createdAt'],delete _0x182476['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0x182476),this['_preventResendingRevisionData'](_0x182476);}else this['_revisionTracker']['addRevisionData'](_0x182476);}const _0x7c74dd=_0xffa2f['getRevisions']();_0x7c74dd['reverse']();for(let _0xc8115c=0x0;_0xc8115c<_0x7c74dd['length']-0x1;_0xc8115c++){const _0x4435e1=_0x7c74dd[_0xc8115c],_0x345502=_0x7c74dd[_0xc8115c+0x1];if(_0x4435e1['fromVersion']<_0x345502['toVersion']){const _0x1679c3=_0x345502['toVersion'],_0x469856=Math['max'](_0x1679c3,_0x4435e1['toVersion']);this['_fixRevision']({'revision':_0x4435e1,'from':_0x1679c3,'to':_0x469856});}}}['_fixRevision']({revision:_0x422e6e,from:_0x4feac2,to:_0x3563e5}={}){const _0x54c778=this['editor']['plugins']['get'](_0x47e255),_0x517d60=this['_revisionTracker']['buildRevisionData']({'revision':_0x422e6e,'from':_0x4feac2,'to':_0x3563e5});_0x517d60['authors']=_0x517d60['authorsIds']['map'](_0x5f4ed7=>_0x54c778['getUser'](_0x5f4ed7)),_0x422e6e['_update'](_0x517d60);}['_preventResendingRevisionData'](_0x13ecac){const _0x209fbb={};_0x209fbb['id']=_0x13ecac['id'];for(const _0x15bf35 of Object['keys'](_0x13ecac))'id'!==_0x15bf35&&(_0x209fbb[_0x15bf35]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0x209fbb['id'],_0x209fbb,!0x0);}async['_fetchMissingUsers'](_0x328b45){const _0x4fb74e=this['editor']['plugins']['get'](_0x47e255),{connection:_0x1efec0}=this['editor']['plugins']['get'](n),_0x54e756=new Set();for(const _0x5d3432 of _0x328b45){for(const _0x455930 of _0x5d3432['authorsIds'])_0x3885eb(_0x455930);_0x5d3432['creatorId']&&_0x3885eb(_0x5d3432['creatorId']);}if(0x0===_0x54e756['size'])return;const _0x3e2b77=await ct['getMany'](_0x1efec0,Array['from'](_0x54e756));for(const _0x5440bb of _0x3e2b77)_0x4fb74e['getUser'](_0x5440bb['id'])||_0x4fb74e['addUser'](_0x5440bb);function _0x3885eb(_0x614572){_0x4fb74e['getUser'](_0x614572)||_0x54e756['add'](_0x614572);}}}function P(_0xa2937a){return _0xa2937a['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0xa2937a['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0xa2937a['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class dt extends _0x23684a{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 _0x321d26{['_collapseAt'];constructor(_0x3d67eb,_0x3de3b4=0x6){super(_0x3d67eb);const _0x5b47d8=this['bindTemplate'];this['set']('isHidden',!0x0),this['set']('usersCount',0x0),this['_collapseAt']=_0x3de3b4,this['bind']('isHidden')['to'](this,'usersCount',_0x5cd5bc=>_0x5cd5bc<_0x3de3b4),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item',_0x5b47d8['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':_0x5b47d8['to']('usersCount',_0x1e0486=>'+'+(_0x1e0486-this['_collapseAt']+0x2)['toString']())}]}]}]});}}class is extends _0x321d26{['items'];['keystrokes'];constructor(_0x43e489){super(_0x43e489);const _0x52f1cb=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0x19832b(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0x52f1cb['if']('hasPopup'),'aria-expanded':_0x52f1cb['to']('isExpanded',_0x483e0f=>this['hasPopup']&&String(_0x483e0f)),'aria-label':_0x52f1cb['to']('hasPopup',_0x4c6c47=>K(_0x43e489,_0x4c6c47?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0x52f1cb['to']('hasPopup',_0x23b818=>!!_0x23b818&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items'],'on':{'mouseenter':_0x52f1cb['to'](()=>this['fire']('presencelist:show')),'mouseleave':_0x52f1cb['to'](_0x24ee0c=>{const _0x21b61f=_0x24ee0c,_0x36e48a=document['querySelector']('.ck-presence-list__dropdown-list'),_0x362c66=document['querySelector']('.ck-balloon-panel_with-arrow');_0x36e48a?.['contains'](_0x21b61f['relatedTarget'])||_0x362c66?.['contains'](_0x21b61f['relatedTarget'])||this['fire']('presencelist:hide');})}}),this['on']('change:hasPopup',(_0x223944,_0x2ee1eb,_0x582c50)=>{this['element']&&(_0x582c50?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 _0x321d26{['counterView'];['inlineListView'];constructor(_0x12daef,_0x55e575=0x6){super(_0x12daef);const _0x3ab149=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new b(this['locale'],_0x55e575),this['inlineListView']=new is(_0x12daef),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x5c08ac of this['inlineListView']['items'])_0x5c08ac['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',_0x3ab149['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['inlineListView']]});}}class L extends _0x321d26{['listWrapperView'];constructor(_0x241939,_0x127075){super(_0x241939);const _0x266483=this['bindTemplate'];this['listWrapperView']=new ut(_0x241939,_0x127075),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':K(_0x241939,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']],'on':{'mouseleave':_0x266483['to'](_0x5ccc0d=>{const _0x513760=_0x5ccc0d,_0x47d61d=document['querySelector']('.ck-presence-list__list'),_0x4460ff=document['querySelector']('.ck-balloon-panel_with-arrow');_0x47d61d?.['contains'](_0x513760['relatedTarget'])||_0x4460ff?.['contains'](_0x513760['relatedTarget'])||this['fire']('presencelist:hide');})}});}}class ut extends _0x14cb7d{constructor(_0x3d4905,_0x34464b){super(_0x3d4905);const _0x2c152f=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0x34464b?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0x2c152f['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0x2c152f['to']('role'),'aria-label':_0x2c152f['to']('ariaLabel'),'aria-labelledby':_0x2c152f['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0x2ed649['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0x1eb9a0=this['element'];_0x1eb9a0&&(this['_isScrollable']=Math['max'](_0x1eb9a0['scrollHeight'],_0x1eb9a0['clientHeight'])>0.8*window['innerHeight']);}}class j extends et{['userView'];constructor(_0x40bdbb,_0x5e89e6,_0x516dac){super(_0x40bdbb);const _0xd2ae95=this['bindTemplate'];this['userView']=new st(_0x40bdbb,_0x5e89e6);const _0xdc78e0={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0x5e89e6['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0x5e89e6['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x5e89e6['color']['getBackgroundColorClass']()],'aria-hidden':'true'}}]};_0x516dac&&(_0xdc78e0['tag']='button',_0xdc78e0['on']={'click':_0xd2ae95['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0xdc78e0);}['focus'](){this['element']['focus']();}}class A extends _0x321d26{['userView'];['markerView'];constructor(_0x285932,_0x243349,_0x4509db){super(_0x285932);const _0x5cf3c4=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new st(_0x285932,_0x243349),this['markerView']=new ot(_0x285932,_0x243349);const _0x4122fe=new it(_0x285932);_0x4122fe['template']['tag']='span',_0x4122fe['text']=_0x243349['name'];const _0x74f7={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0x5cf3c4['to']('isFocusable',_0x657ee1=>!!_0x657ee1&&0x0),'aria-labelledby':_0x4122fe['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0x5cf3c4['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0x5cf3c4['to']('hasTooltip',_0xae4d92=>!_0xae4d92),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0x4122fe]};_0x4509db&&(_0x74f7['tag']='button',_0x74f7['on']={'click':_0x5cf3c4['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x74f7);}}class ot extends _0x321d26{constructor(_0x22f50a,_0x33e910){super(_0x22f50a),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x33e910['color']['getBackgroundColorClass']()],'aria-hidden':'true'}});}}const x={'collapseAt':0x6,'displayMe':!0x0};class r extends _0x24e504{['currentDisplayedUsers'];['balloonPanelView'];['view'];['presenceDropdownView'];['_bodyCollection']=null;static get['pluginName'](){return'PresenceListUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x5498a4){super(_0x5498a4),this['context']['config']['define']('presenceList',x);const _0x1ab596=_0x5498a4['config']['get']('presenceList.collapseAt');if('number'!=typeof _0x1ab596)throw new _0x189f6f('presencelist-collapseat-invalid-format',this);if(_0x1ab596<0x1)throw new _0x189f6f('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](i)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0x26414e(),this['balloonPanelView']=new _0x52cb12(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get['requires'](){return[i];}['init'](){for(const _0xe2ec7 of this['_allConnectedUsers'])this['_handleUserAdd'](_0xe2ec7);this['listenTo'](this['_allConnectedUsers'],'add',(_0x385e4f,_0x17cb41)=>{this['_handleUserAdd'](_0x17cb41);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0x58d8a6,_0x237e89)=>{this['_handleUserRemove'](_0x237e89);});}['_createView'](){const _0x187462=this['context'],_0x5e4f56=new v(this['context']['locale'],this['context']['config']['get']('presenceList.collapseAt')),_0xa29933=this['balloonPanelView'];if(!_0x1678f1(_0x187462['config']['get']('presenceList.container')))throw new _0x189f6f('presencelist-missing-container',this);return _0x5e4f56['counterView']['bind']('usersCount')['to'](this),_0x5e4f56['bind']('isCollapsed')['to'](this,'usersCount',_0x2c1596=>{const {collapseAt:_0x441d91}=_0x187462['config']['get']('presenceList'),_0x5dad34=_0x2c1596>=_0x441d91;if(_0x5dad34&&!_0x5e4f56['inlineListView']['items']['find'](_0x398d0f=>_0x398d0f instanceof b)){const _0x29c78e=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['currentDisplayedUsers']['length']==_0x29c78e&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](this['currentDisplayedUsers']['length']-0x1),_0x5e4f56['inlineListView']['items']['add'](_0x5e4f56['counterView']);}return _0x5dad34||this['hideDropdown'](),_0x5dad34;}),_0x5e4f56['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0x1e37a3=>{const _0x11c0c4=_0x187462['config']['get']('presenceList'),_0x6bb27b=new A(_0x187462['locale'],_0x1e37a3,!!_0x11c0c4['onClick']);return _0x6bb27b['bind']('hasTooltip')['to'](_0x5e4f56,'isCollapsed',_0x15dbca=>!_0x15dbca),_0x6bb27b['bind']('isFocusable')['to'](_0x5e4f56,'isCollapsed',_0x581a31=>!_0x581a31),_0x11c0c4['onClick']&&this['listenTo'](_0x6bb27b,'execute',()=>{this['view']['isCollapsed']||_0x11c0c4['onClick'](_0x1e37a3,_0x6bb27b['element']);}),_0x6bb27b;}),this['listenTo'](_0x5e4f56['inlineListView'],'presencelist:show',()=>{this['view']['isCollapsed']&&this['showDropdown']();}),this['listenTo'](_0x5e4f56['inlineListView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();}),_0x5e4f56['inlineListView']['keystrokes']['set']('Enter',(_0x1b756c,_0x9ce4aa)=>{this['view']['isCollapsed']&&(this['showDropdown'](),_0x9ce4aa());}),_0x5e4f56['render'](),_0xa29933['render'](),_0x81fb12({'emitter':_0x5e4f56,'activator':()=>_0xa29933['isVisible'],'contextElements':[_0xa29933['element'],_0x5e4f56['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0x187462['config']['get']('presenceList.container')['appendChild'](_0x5e4f56['element']),this['_bodyCollection']=new _0x26bdd9(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_bodyCollection']['add'](this['balloonPanelView']),_0x5e4f56;}['_handleUserAdd'](_0x3996c6){if(!this['context']['config']['get']('presenceList.displayMe')&&_0x3996c6['isMe'])return;const _0x2358fa=this['context']['config']['get']('presenceList.collapseAt')-0x1;for(this['usersCount']++;this['currentDisplayedUsers']['length']>=_0x2358fa-(this['view']['isCollapsed']?0x1:0x0)&&this['currentDisplayedUsers']['length']>0x1;)this['currentDisplayedUsers']['remove'](0x1);const _0x1359fa=_0x3996c6['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0x3996c6,_0x1359fa);}['_handleUserRemove'](_0x4e6acd){this['usersCount']--;const {collapseAt:_0x5c0b6d}=this['context']['config']['get']('presenceList'),_0x22f4ef=this['usersCount']>=_0x5c0b6d;if(this['currentDisplayedUsers']['get'](_0x4e6acd['id']))this['currentDisplayedUsers']['remove'](_0x4e6acd['id']);else{if(_0x22f4ef&&this['currentDisplayedUsers']['length']+0x1===_0x5c0b6d-0x1)return;}if(this['currentDisplayedUsers']['length']+(_0x22f4ef?0x1:0x0)<this['usersCount']){for(const _0x569413 of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0x569413['id'])&&(this['currentDisplayedUsers']['add'](_0x569413,Math['min'](this['currentDisplayedUsers']['length']-(_0x22f4ef?0x1:0x0),0x1)),this['currentDisplayedUsers']['length']+(_0x22f4ef?0x1:0x0)===_0x5c0b6d-0x1))return;}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0x1b4e7e=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new L(this['context']['locale'],!!_0x1b4e7e['onClick']),this['view']['inlineListView']['isExpanded']=!0x0,this['listenTo'](this['presenceDropdownView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();});const {listWrapperView:_0x12d92a}=this['presenceDropdownView'];_0x12d92a['items']['bindTo'](this['_allConnectedUsers'])['using'](_0x567c7a=>{if(!_0x1b4e7e['displayMe']&&_0x567c7a['isMe'])return null;const _0x1d0e32=new j(this['context']['locale'],_0x567c7a,!!_0x1b4e7e['onClick']);return _0x1b4e7e['onClick']&&this['listenTo'](_0x1d0e32,'execute',()=>{_0x1b4e7e['onClick'](_0x567c7a,_0x1d0e32['element']);}),_0x1d0e32;}),this['balloonPanelView']['content']['add'](this['presenceDropdownView']),this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element']}),_0x12d92a['focus'](),_0x12d92a['checkIfScrollable']();const _0x492904=(_0x5628b8,_0x55da87)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0x55da87();};_0x12d92a['keystrokes']['set']('Esc',_0x492904),_0x12d92a['keystrokes']['set']('Shift+Tab',_0x492904),_0x12d92a['keystrokes']['set']('Tab',(_0x204dc8,_0x477cd1)=>{!function(_0x5797c6){const _0x2608c1=['a','button','input','select','textarea','[tabindex]','[contenteditable]']['map'](_0x3f2bec=>_0x3f2bec+':not([disabled]):not([tabindex=\x22-1\x22])')['join'](','),_0x2ff70c=[...document['body']['querySelectorAll'](_0x2608c1)]['filter'](_0x328741=>_0x328741===document['activeElement']||_0x328741['offsetWidth']+_0x328741['offsetHeight']>0x0)['sort']((_0x44d561,_0xf92740)=>(_0x44d561['tabIndex']||0x0)-(_0xf92740['tabIndex']||0x0)),_0x18d60b=_0x2ff70c['indexOf'](_0x5797c6),_0x4ba430=_0x2ff70c[(_0x18d60b+0x1)%_0x2ff70c['length']];_0x4ba430&&_0x4ba430['focus']();}(this['view']['element']),this['hideDropdown'](),_0x477cd1();}),_0x12d92a['focusTracker']['add'](this['view']['element']),_0x12d92a['focusTracker']['on']('change:isFocused',(_0x22aa58,_0x4c0529,_0x4cb81d)=>{_0x4cb81d||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 _0x24e504{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 _0x209765,Plugin as _0xc3a9c,PendingActions as _0x4d3072,Context as _0x43e148}from'@ckeditor/ckeditor5-core/dist/index.js';import{DomEmitterMixin as _0x7f6fd1,CKEditorError as _0x213e64,Collection as _0x1085f1,global as _0x46f1c0,version as nt,uid as _0x322f72,KeystrokeHandler as _0x58ca83}from'@ckeditor/ckeditor5-utils/dist/index.js';import{Notification as _0x1b6091,View as _0x56ef61,ListView as _0x34d1d2,ListItemView as et,LabelView as it,BalloonPanelView as _0x5272a8,clickOutsideHandler as _0x2af274,BodyCollection as _0x27fcf6}from'@ckeditor/ckeditor5-ui/dist/index.js';import{ModelLiveRange as _0x1d0b9e,History as _0x23a121,NoOperation as _0x2fc71e,InsertOperation as _0x475008,MarkerOperation as _0x4dfdf2,RootAttributeOperation as _0x2d41d3,transformOperationSets as _0x65b94f,OperationFactory as _0x5e5f99}from'@ckeditor/ckeditor5-engine/dist/index.js';import{WebSocketGateway as rt,WEB_SOCKET_GATEWAY_STATES as _0x5f0b2d,CollaborativeEditingService as _0x360198,User as ct,CommentsService as _0x35df08,TrackChangesService as tt,RevisionHistoryService as _0x11a9e4,EditorService as _0x1d9c68}from'@ckeditor/ckeditor-cloud-services-collaboration/dist/index.js';import{Users as _0x5a0a2c,UserView as st}from'ckeditor5-collaboration/dist/index.js';import{Compressor as _0x26ced4}from'@ckeditor/ckeditor5-operations-compressor/dist/index.js';import{isElement as _0x580414}from'es-toolkit/compat';class n extends _0x209765{static ['WebSocketGateway']=/* #__PURE__ -- @preserve */
|
|
24
|
+
((()=>rt)());static ['initialReconnectionInterval']=0x3e8;['connection'];['_reconnectionStack'];['_shouldPluginsReconnect'];['_domEmitter'];static get['requires'](){return['CloudServices',_0x1b6091];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x36453c){super(_0x36453c),this['set']('state',_0x5f0b2d['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=new(_0x7f6fd1())();}['init'](){const _0xe79552=this['context'],_0xbb1495=_0xe79552['plugins']['get']('CloudServices'),_0xf7f571=_0xe79552['plugins']['get'](_0x1b6091);if(!_0xbb1495['token'])throw new _0x213e64('websocketgateway-missing-token',this);if(!_0xbb1495['webSocketUrl'])throw new _0x213e64('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'](_0xbb1495['token'],_0xbb1495['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0x2d577a=>{if(this['connection']=_0x2d577a,this['bind']('state')['to'](_0x2d577a,'state',this,'_isBrowserOffline',(_0x1897aa,_0x47d40c)=>('connected'!==_0x1897aa&&(this['_shouldPluginsReconnect']=!0x0),_0x47d40c||_0x1897aa!==_0x5f0b2d['CONNECTED']?_0x5f0b2d['DISCONNECTED']:this['state']==_0x5f0b2d['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),_0x5f0b2d['CONNECTING']):_0x5f0b2d['CONNECTED'])),this['connection']['on']('error',(_0x406229,_0x1144f3)=>{if('limitExceeded'!==_0x1144f3['code'])throw console['error'](_0x1144f3),new _0x213e64('cloudservices-init',null,{'originalError':_0x1144f3});_0xf7f571['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'});}),!_0x2d577a['me'])return new Promise(_0x4d19b9=>_0x2d577a['on']('change:me',_0x4d19b9));})['catch'](_0x624e01=>{throw console['error'](_0x624e01),new _0x213e64('cloudservices-init',null,{'originalError':_0x624e01});});}['addToReconnectionStack'](_0x371d47){if('function'!=typeof _0x371d47['reconnect'])throw new _0x213e64('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0x371d47))throw new _0x213e64('websocketgateway-plugin-already-registered',this,{'name':_0x371d47['constructor']['pluginName']});this['_reconnectionStack']['add'](_0x371d47);}['removeFromReconnectionStack'](_0x1006ec){this['_reconnectionStack']['delete'](_0x1006ec);}['isInReconnectionStack'](_0x23b604){return this['_reconnectionStack']['has'](_0x23b604);}['_reconnect'](){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0x1482f3=>_0x1482f3['reconnect']())))['then'](()=>this['state']=_0x5f0b2d['CONNECTED'])['catch'](_0x66f2b6=>{throw console['error'](_0x66f2b6),new _0x213e64('cloudservices-reconnection-error',this['context']);});}['disconnect'](){this['connection']&&this['connection']['disconnect'](),this['state']=_0x5f0b2d['DISCONNECTED'],this['_domEmitter']['stopListening']();}['destroy'](){this['disconnect'](),super['destroy']();}}class i extends _0x209765{['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,_0x5a0a2c];}constructor(_0x4259ab){super(_0x4259ab),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0x1085f1(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x5a0a2c);}['init'](){const _0x419ef5=this['context']['plugins']['get'](n);this['listenTo'](_0x419ef5,'change:state',(_0x41267e,_0x394296,_0xc31e8d)=>{if('connected'!==_0xc31e8d)this['channelSessions']['forEach'](_0x5ad079=>_0x5ad079['clear']()),this['channelConnectedUsers']['forEach'](_0x86e9a6=>_0x86e9a6['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x9c57f5,_0x7ccced]of this['_registeredSessions'])for(const _0x3f63cf of _0x7ccced)this['_handleSessionAdd'](_0x9c57f5,_0x3f63cf);}}),this['_createUser'](_0x419ef5['connection']['me'],!0x0);}['register'](_0x4a501c,_0x4919e8){if(this['_registeredSessions']['has'](_0x4a501c))throw new _0x213e64('sessions-register-already-registered',null,{'channelId':_0x4a501c});this['_registeredSessions']['set'](_0x4a501c,_0x4919e8),this['channelSessions']['set'](_0x4a501c,new _0x1085f1()),this['channelConnectedUsers']['set'](_0x4a501c,new _0x1085f1()),this['listenTo'](_0x4919e8,'add',(_0x109d55,_0x3d0f5e)=>this['_handleSessionAdd'](_0x4a501c,_0x3d0f5e)),this['listenTo'](_0x4919e8,'remove',(_0x47b2be,_0x56b0cc)=>this['_handleSessionRemove'](_0x4a501c,_0x56b0cc));for(const _0x5991b5 of _0x4919e8)this['_handleSessionAdd'](_0x4a501c,_0x5991b5);}['unregister'](_0x4b42b9){if(!this['_registeredSessions']['has'](_0x4b42b9))throw new _0x213e64('sessions-unregister-not-exist',null,{'channelId':_0x4b42b9});const _0x514eb2=this['_registeredSessions']['get'](_0x4b42b9);this['stopListening'](_0x514eb2);for(const _0x1cf909 of _0x514eb2)'connected'===this['context']['plugins']['get'](n)['state']&&this['_handleSessionRemove'](_0x4b42b9,_0x1cf909);this['_registeredSessions']['delete'](_0x4b42b9),this['channelSessions']['delete'](_0x4b42b9),this['channelConnectedUsers']['delete'](_0x4b42b9);}get['mySessionId'](){return this['context']['plugins']['get'](n)['connection']['sessionId'];}['getUserBySessionId'](_0x518035){for(const _0x40bd30 of this['channelSessions']['values']())for(const _0x5a0475 of _0x40bd30)if(_0x5a0475['id']===_0x518035)return _0x5a0475['user'];}['getUserSessions'](_0x50e06e,_0x47cc60){const _0x3aa010=_0x47cc60?[this['channelSessions']['get'](_0x47cc60)]:this['channelSessions']['values'](),_0xb93e2=new Set();for(const _0x50da1c of _0x3aa010)for(const _0x5ce695 of _0x50da1c)_0x5ce695['user']['id']===_0x50e06e['id']&&_0xb93e2['add'](_0x5ce695['id']);return _0xb93e2;}['getUserRole'](_0x4ce73d){for(const _0x411641 of this['channelSessions']['values']())for(const _0x57d3f8 of _0x411641)if(_0x57d3f8['user']===_0x4ce73d)return _0x57d3f8['role'];}['_handleSessionAdd'](_0x33184b,_0x12240e){if('connected'!==this['context']['plugins']['get'](n)['state'])return;const _0x4f42fb=_0x12240e['user'],_0x42abbb=this['_users']['getUser'](_0x4f42fb['id'])||this['_createUser'](_0x4f42fb),_0x5ab0c6=Object['assign']({},_0x12240e,{'user':_0x42abbb});this['channelSessions']['get'](_0x33184b)['add'](_0x5ab0c6);const _0x2e28ee=this['channelConnectedUsers']['get'](_0x33184b);_0x2e28ee['has'](_0x42abbb['id'])||_0x2e28ee['add'](_0x42abbb),this['allConnectedUsers']['has'](_0x42abbb['id'])||this['allConnectedUsers']['add'](_0x42abbb,_0x42abbb['isMe']?0x0:void 0x0),this['fire']('sessionAdd:'+_0x33184b,{'channelId':_0x33184b,'session':_0x5ab0c6});}['_handleSessionRemove'](_0x1ad427,_0x330807){if('connected'!==this['context']['plugins']['get'](n)['state'])return;const _0x5934fd=this['channelConnectedUsers']['get'](_0x1ad427),_0x4f1d2d=_0x330807['user'];_0x4f1d2d['id']&&(this['channelSessions']['get'](_0x1ad427)['remove'](_0x330807['id']),_0x5934fd['has'](_0x4f1d2d['id'])&&!this['getUserSessions'](_0x4f1d2d,_0x1ad427)['size']&&_0x5934fd['remove'](_0x4f1d2d['id']),this['allConnectedUsers']['get'](_0x4f1d2d['id'])&&!this['getUserSessions'](_0x4f1d2d)['size']&&this['allConnectedUsers']['remove'](_0x4f1d2d['id']));}['_createUser'](_0x5ba660,_0xfc0551){const _0x2957e0=this['_users']['addUser'](_0x5ba660);return _0xfc0551&&this['_users']['defineMe'](_0x5ba660['id']),_0x2957e0['orderNumber']=this['_uniqueUsersCount']++,_0x2957e0;}}class G extends _0xc3a9c{['_domEmitter']=new(_0x7f6fd1())();static get['requires'](){return[i];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x46908d=this['editor'],_0x1ce923=_0x46908d['plugins']['get'](i);_0x46908d['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x531d4b,{writer:_0x53ea17})=>function(_0x7daeee,_0x37c47d,_0x25d2f8,_0x2cf971){const _0x5654af=_0x7daeee['markerName']['split'](':')[0x2],_0x46e89f=_0x25d2f8['getUserBySessionId'](_0x5654af);if(!_0x46e89f||_0x5654af===_0x25d2f8['mySessionId'])return;if(!_0x2cf971['model']['schema']['checkChild'](_0x7daeee['markerRange']['start'],'$text'))return;const _0x37e7fa={'class':'ck-user__marker\x20'+_0x46e89f['color']['getMarkerClass'](),'data-name':_0x46e89f['name'],'data-session-id':_0x5654af},_0x33a77b=_0x2cf971['model']['markers']['get'](_0x7daeee['markerName']),_0x9b1597=_0x33a77b['getStart'](),_0xef6060=_0x9b1597['nodeAfter'],_0x508d2a=_0x2cf971['model']['schema'];if(_0xef6060&&_0x508d2a['isObject'](_0xef6060)&&_0x508d2a['isInline'](_0xef6060)&&!_0x2cf971['model']['markers']['get']('user:range:'+_0x5654af)['getRange']()['isCollapsed'])return;const _0x113eb8=_0x9b1597['parent'];return _0x2cf971['model']['schema']['isLimit'](_0x113eb8)&&!_0x2cf971['model']['hasContent'](_0x113eb8)&&(_0x37e7fa['contenteditable']=!0x1),function(_0x19d392,_0xb4b299,_0x3c7bea){const _0x5c8816=_0x19d392['createUIElement']('span',_0xb4b299);return _0x19d392['setCustomProperty']('userPositionMarker',!0x0,_0x5c8816),_0x5c8816['render']=function(_0x304429){const _0x1c89f3=this['toDomElement'](_0x304429),_0x595a0e=document['createElement']('span');return _0x595a0e['classList']['add']('ck-user__marker-tooltip'),_0x595a0e['setAttribute']('contenteditable','false'),_0x595a0e['setAttribute']('spellcheck','false'),_0x595a0e['textContent']=_0x3c7bea['name'],_0x1c89f3['innerHTML']='<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span>'+_0x595a0e['outerHTML']+'',_0x1c89f3['addEventListener']('mouseenter',()=>{_0x1c89f3['classList']['add']('ck-user__marker_hovered');}),_0x1c89f3['addEventListener']('mouseleave',()=>{_0x1c89f3['classList']['remove']('ck-user__marker_hovered');}),_0x1c89f3;},_0x5c8816['isSimilar']=function(_0x51d4e2){return!(!this['getCustomProperty']('userPositionMarker')||!_0x51d4e2['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0x51d4e2['getAttribute']('data-session-id'));},_0x5c8816;}(_0x37c47d,_0x37e7fa,_0x46e89f);}(_0x531d4b,_0x53ea17,_0x1ce923,_0x46908d)}),_0x46908d['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0x1c8f74=>function(_0x2cfdc9,_0x5071d5){const _0x5b71d8=_0x2cfdc9['markerName']['split'](':')[0x2];if(_0x5b71d8===_0x5071d5['mySessionId'])return null;const _0x3eb42b=_0x5071d5['getUserBySessionId'](_0x5b71d8);if(!_0x3eb42b)return{'id':_0x5b71d8,'classes':[]};return{'id':_0x5b71d8,'classes':['ck-user__selection',_0x3eb42b['color']['getSelectionClass']()],'attributes':{'data-session-id':_0x5b71d8},'priority':0x7d0+_0x3eb42b['orderNumber']};}(_0x1c8f74,_0x1ce923)}),function(_0x27662e){const _0x32866d=_0x27662e['model'],_0x123e2a=new Map(),_0x53beb1=_0x27662e['plugins']['get'](i);_0x32866d['markers']['on']('update:user:range',(_0xdce792,_0x21be06,_0x3957b0,_0x2835d4)=>{if(!_0x2835d4&&_0x123e2a['get'](_0x21be06['name']))return _0x123e2a['get'](_0x21be06['name'])['detach'](),void _0x123e2a['delete'](_0x21be06['name']);const _0x54b0a6=_0x21be06['name']['split'](':')[0x2];if(_0x54b0a6===_0x53beb1['mySessionId'])return;const _0x3e6c66='user:position:'+_0x54b0a6;_0x32866d['markers']['has'](_0x3e6c66)&&_0x27662e['editing']['reconvertMarker'](_0x3e6c66),_0x21be06['on']('change:range',(_0x4768cb,_0x360aad,_0x16250b)=>{if('$graveyard'!=_0x360aad['root']['rootName']&&'$graveyard'==_0x21be06['getRange']()['root']['rootName']&&!_0x123e2a['has'](_0x21be06['name'])){const _0x2ecd99=_0x32866d['schema']['getNearestSelectionRange'](_0x16250b['deletionPosition']);if(_0x2ecd99){const _0x1d98aa=_0x1d0b9e['fromRange'](_0x2ecd99);_0x123e2a['set'](_0x21be06['name'],_0x1d98aa),_0x1d98aa['on']('change:range',(_0x3cbc2e,_0x517c3a,_0x5e6f45)=>{if('$graveyard'==_0x1d98aa['root']['rootName']){const _0x1291be=_0x32866d['schema']['getNearestSelectionRange'](_0x5e6f45['deletionPosition']);_0x1291be?(_0x1d98aa['start']=_0x1291be['start'],_0x1d98aa['end']=_0x1291be['end']):(_0x123e2a['delete'](_0x21be06['name']),_0x1d98aa['detach']());}});}}});}),_0x32866d['document']['on']('change',()=>{_0x123e2a['size']>0x0&&_0x32866d['enqueueChange']({'isUndoable':!0x1},_0x34c93d=>{for(const [_0x25a589,_0x104707]of _0x123e2a)'$graveyard'==_0x32866d['markers']['get'](_0x25a589)['getRange']()['root']['rootName']&&(te(_0x25a589['split'](':')[0x2],_0x104707['toRange'](),_0x32866d,_0x34c93d),_0x104707['detach']());_0x123e2a['clear']();});});}(_0x46908d),this['_domEmitter']['listenTo'](_0x46f1c0['document'],'keydown',(_0x903e4a,{key:_0x3371ca})=>{'Escape'===_0x3371ca&&function(_0x4d315b){_0x4d315b['editing']['view']['change'](_0x214882=>{for(const _0x2ffe7c of _0x4d315b['model']['markers']){if(!_0x2ffe7c['name']['startsWith']('user:position'))continue;const _0x477535=_0x4d315b['editing']['mapper']['markerNameToElements'](_0x2ffe7c['name']);if(_0x477535){for(const _0xf69871 of _0x477535)_0x214882['removeClass']('ck-user__marker_hovered',_0xf69871);}}});}(_0x46908d);},{'useCapture':!0x0});}['afterInit'](){const _0x4b9b02=this['editor'],_0x3a81c9=_0x4b9b02['commands']['get']('undo');_0x3a81c9&&_0x4b9b02['model']['on']('applyOperation',(_0x50cd5f,_0x5c7f15)=>{const _0x4ef601=_0x5c7f15[0x0];if(!_0x4ef601['isDocumentOperation'])return;if('marker'!=_0x4ef601['type']||!_0x4ef601['name']['startsWith']('user:'))return;const _0x41309a=_0x4ef601['batch'];_0x3a81c9['_createdBatches']['has'](_0x41309a)&&(_0x4ef601['newRange']=_0x4ef601['oldRange']?_0x4b9b02['model']['createRange'](_0x4ef601['oldRange']['start'],_0x4ef601['oldRange']['end']):null);},{'priority':'highest'});}['destroy'](){return this['_domEmitter']['stopListening'](),super['destroy']();}['createUserMarkerOperations'](){const _0x3b010e=this['editor'],_0x3d47a7=_0x3b010e['model']['document'],_0x55a41a=_0x3b010e['plugins']['get'](i);_0x3b010e['model']['enqueueChange']({'isUndoable':!0x1},_0x1e5d74=>{const _0x13fccd='user:range:'+_0x55a41a['mySessionId'],_0x248d11='user:position:'+_0x55a41a['mySessionId'],_0x2f0832=_0x3b010e['model']['markers']['has'](_0x13fccd);_0x3b010e['editing']['view']['hasDomSelection']?te(_0x55a41a['mySessionId'],_0x3d47a7['selection']['getFirstRange'](),_0x3b010e['model'],_0x1e5d74):_0x2f0832&&(_0x1e5d74['removeMarker'](_0x13fccd),_0x1e5d74['removeMarker'](_0x248d11));});}}function te(_0x4c333c,_0x25e053,_0x4b8305,_0x2697b1){const _0x56d2e4='user:range:'+_0x4c333c,_0x1fca03='user:position:'+_0x4c333c,_0x45945b=_0x25e053['getContainedElement']();let _0x29cb38=_0x25e053['start'];if(_0x45945b&&_0x45945b['is']('element','tableCell')){const _0x3d8c8a=function(_0x14d9f5,_0x541e23){for(const _0x294d2d of _0x14d9f5['getPositions']())if(_0x541e23['schema']['checkChild'](_0x294d2d,'$text'))return _0x294d2d;}(_0x25e053,_0x4b8305);_0x3d8c8a&&(_0x29cb38=_0x3d8c8a,_0x25e053=_0x2697b1['createRange'](_0x29cb38));}const _0x2eb8ed=_0x2697b1['createRange'](_0x29cb38);_0x4b8305['markers']['has'](_0x56d2e4)?(_0x2697b1['updateMarker'](_0x56d2e4,{'range':_0x25e053}),_0x2697b1['updateMarker'](_0x1fca03,{'range':_0x2eb8ed})):(_0x2697b1['addMarker'](_0x56d2e4,{'range':_0x25e053,'usingOperation':!0x0}),_0x2697b1['addMarker'](_0x1fca03,{'range':_0x2eb8ed,'usingOperation':!0x0}));}function $(_0x1f1e46,_0x3a534b,_0x653431){const _0x480a00=_0x1f1e46['t'],t=_0x1f1e46['t'];switch(_0x3a534b){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 _0x480a00({'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'},_0x653431);default:return'';}}let Q=0x1;class l extends _0xc3a9c{static ['CollaborativeEditingService']=/* #__PURE__ -- @preserve */
|
|
25
|
+
((()=>_0x360198)());['_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,_0x4d3072,_0x5a0a2c,_0x1b6091];}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 _0x5c508c=this['serverHistory']['getOperations']();for(let _0x5272b8=_0x5c508c['length']-0x1;_0x5272b8>=0x0;_0x5272b8--){const _0x3eff8a=_0x5c508c[_0x5272b8];if(!this['_disconnectionOperations']['has'](_0x3eff8a))return _0x3eff8a['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0x63aa96){if(super(_0x63aa96),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x23a121(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0x213e64('collaboration-missing-channelid',this);const _0x5e0d6a=_0x63aa96['config']['get']('cloudServices.bundleVersion')||nt;this['_service']=new l['CollaborativeEditingService'](_0x5e0d6a,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0x26ced4(),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 _0x11294b=this['editor'],_0x10eefe=_0x11294b['plugins']['get'](_0x5a0a2c),_0x214f69=_0x11294b['plugins']['get'](n);this['listenTo'](_0x10eefe,'getOperationAuthor',(_0x2629c5,_0x4690d4)=>{const _0x2685d0=_0x4690d4[0x0];_0x2685d0['_authorId']&&(_0x2629c5['return']=_0x10eefe['getUser'](_0x2685d0['_authorId']),_0x2629c5['stop']()),null===_0x2685d0['_authorId']&&(_0x2629c5['return']=null,_0x2629c5['stop']());},{'priority':'high'}),this['listenTo'](_0x11294b['model']['document']['selection'],'change:range',(_0x47d587,_0x363b8f)=>{_0x363b8f['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x11294b['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x11294b['model']['on']('applyOperation',(_0x46dac9,_0x9b5f4f)=>{const _0x19e28e=_0x9b5f4f[0x0];_0x19e28e['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0x19e28e),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['bind']('_isEditingAllowed')['to'](_0x214f69,'state',this,'_hasSynchronizationProblem',(_0x2381b0,_0x15da46)=>'connected'===_0x2381b0&&!_0x15da46),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x11294b['disableReadOnlyMode']('rtc-offline'):_0x11294b['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x11294b['disableReadOnlyMode']('rtc-offline'):_0x11294b['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async['reconnect'](){const _0x4652a1=this['editor']['plugins']['get'](i),_0x43602f=this['editor']['plugins']['get'](n);try{this['_isPendingUpdate']=!0x0,_0x4652a1['unregister'](this['_channelId']);const _0x41de8a=await this['_service']['reconnect'](_0x43602f['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0x41de8a)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x4f371e=await this['_service']['getConnectedSessions']();_0x4652a1['register'](this['_channelId'],_0x4f371e),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x4996f2){if(function(_0x46cfa3){return'404'===_0x46cfa3['code'];}(_0x4996f2)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0xc2a561){return'409'===_0xc2a561['code'];}(_0x4996f2)){const _0x2998b5=$(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'](_0x2998b5);}else{if(!(_0x4996f2 instanceof X))throw _0x4996f2;this['_handleReconnectionError']();}}}}['destroy'](){const _0x539754=this['editor']['plugins']['get'](n),_0x52cabf=this['editor']['plugins']['get'](i);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x52cabf['channelSessions']['has'](this['_channelId'])&&_0x52cabf['unregister'](this['_channelId']),_0x539754['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async['_handleReconnectionResponse'](_0x6d8790){if(this['sessionId']!==_0x6d8790['sessionId']&&this['_lastSyncedOperationId']!==_0x6d8790['lastOperationId'])throw new X();return this['sessionId']=_0x6d8790['sessionId'],this['_handleServerResponse']([],{..._0x6d8790,'wereChangesApplied':!0x1,'data':_0x6d8790['data']},'reconnect');}async['_connectService'](_0x51f823,_0x50f14e=!0x1){const {connection:_0x8674f5}=this['editor']['plugins']['get'](n);l['CollaborativeEditingService']['getConnectedSessions'](_0x8674f5,this['_channelId'])['then'](_0x206940=>this['_initSessionsHandling'](_0x206940))['catch'](_0x4abb86=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x4abb86);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x21908e,_0x2b13b0)=>{this['_crash']('realtimecollaborationclient-init-service-internal-error',_0x2b13b0);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_isConnected']=!0x1;});const _0x4c2c23=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x51f823);this['_isPendingUpdate']=!0x0;const _0x123703=await this['_service']['connect'](_0x8674f5,this['_compressOperations'](_0x51f823),_0x4c2c23);if(this['sessionId']=_0x123703['sessionId'],_0x50f14e){if(!_0x123703['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x123703['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0x51f823,_0x123703,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x123703,_0x51f823);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}['_handleSendingSelectionMarkers'](){const _0x322944=this['editor']['plugins']['get'](i),_0x189c99=this['editor']['plugins']['get'](G),_0x37c44d=_0x322944['channelSessions']['get'](this['_channelId']);_0x37c44d&&_0x37c44d['length']>0x1?_0x189c99['createUserMarkerOperations']():this['listenTo'](_0x322944,'sessionAdd:'+this['_channelId'],()=>{0x2===_0x322944['channelSessions']['get'](this['_channelId'])['length']&&_0x189c99['createUserMarkerOperations']();});}async['_handleReceivedOperations'](_0xc38a07,_0x24c78a,_0x4be95a,_0x409694){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x24c78a){const _0x4d020b=this['_decompressOperations'](_0x4be95a,_0x409694);await this['_fetchMissingUsers'](_0x4d020b),this['_handleExternalOperations'](_0x4d020b,_0x24c78a,_0x4be95a['lastOperationId'])||this['_crash']('realtimecollaborationclient-init-service-incorrect-server-operation');}}async['_connectAfterSessionHasBeenFlushed'](){this['_disconnectService']();const {locale:_0x54c4e3}=this['editor'];let _0x1addc4;try{_0x1addc4=await this['_service']['getDocumentDetails']();}catch{const _0x1e3347=$(_0x54c4e3,'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'](_0x1e3347);}const _0x43c417=_0x1addc4['currentDocumentSession']||_0x1addc4['lastDocumentSession'];if(this['_lastSyncedOperationId']!==_0x43c417['lastOperationId']){const _0x56777c=$(_0x54c4e3,'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'](_0x56777c);}await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);}['_disconnectService'](){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['stopListening'](this['_service']);}['_initSessionsHandling'](_0x5438db){const _0x1dd73a=this['editor']['plugins']['get'](i);this['listenTo'](_0x1dd73a,'sessionAdd:'+this['_channelId'],(_0x269a9a,{session:_0x57212a})=>{if(_0x57212a['id']===_0x1dd73a['mySessionId']){_0x269a9a['off']();const _0xe5de99=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0x5c364a=_0x57212a['permissions'];_0xe5de99&&_0xe5de99['isEnabled']&&(_0x5c364a=_0x5c364a['filter'](_0x34386c=>'document:write'!==_0x34386c)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0x5c364a,this['_channelId']);}}),_0x1dd73a['register'](this['_channelId'],_0x5438db);}['_initThrowingOnDataSet'](){const _0x2ce412=this['editor']['data']['set'];this['editor']['data']['set']=(..._0x4c9321)=>{if(!_0x4c9321[_0x4c9321['length']-0x1]['suppressErrorInCollaboration'])throw new _0x213e64('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x2ce412['apply'](this['editor']['data'],_0x4c9321);};}['_setUpDataInit'](){this['editor']['data']['on']('init',(_0x4e917b,[_0x10d715])=>{if(this['_document']['version'])throw new _0x213e64('realtimecollaborationclient-init-document-already-initialized',this);_0x4e917b['stop'](),this['_setPendingAction']();const _0x43a894=this['editor']['config']['get']('rootsAttributes'),_0x435ff6=this['_getOperationsFromInitData'](_0x10d715,_0x43a894);0x0==_0x435ff6['length']&&_0x435ff6['push'](new _0x2fc71e(0x0)),_0x4e917b['return']=this['_connectService'](_0x435ff6)['then'](()=>{this['editor']['plugins']['get'](n)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x1f59fd=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x1f59fd))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x23853e,[_0x37baba,_0x2b65c3])=>{_0x23853e['stop']();const _0x390b5a=this['editor']['model']['document']['getRoot'](_0x37baba);if(!this['_knownRootNames']['has'](_0x37baba)){const _0x188dd3=_0x2b65c3&&_0x2b65c3['data']?_0x2b65c3['data']:'',_0x5b2081=_0x2b65c3&&_0x2b65c3['attributes']?_0x2b65c3['attributes']:{};await this['_loadRoot'](_0x37baba,_0x188dd3,_0x5b2081);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0x390b5a['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0x390b5a);});},{'priority':'high'});}async['_fetchMissingUsers'](_0x352142){const _0x48f0eb=this['editor']['plugins']['get'](_0x5a0a2c),{connection:_0x24d033}=this['editor']['plugins']['get'](n),_0x2f3087=new Set();for(const _0x3ebfdc of _0x352142){const _0x54f8cc=_0x3ebfdc['_authorId'];_0x54f8cc&&!_0x48f0eb['getUser'](_0x54f8cc)&&_0x2f3087['add'](_0x54f8cc);}if(0x0===_0x2f3087['size'])return;const _0x2dcb04=await ct['getMany'](_0x24d033,Array['from'](_0x2f3087));for(const _0x3e8972 of _0x2dcb04)_0x48f0eb['getUser'](_0x3e8972['id'])||_0x48f0eb['addUser'](_0x3e8972);}['_getOperationsFromInitData'](_0x110eb7,_0x1904c9={}){const _0x19c01d=this['editor']['model'],_0x4c3602=[];let _0x2d3f10=0x0;const _0x414f65='string'==typeof _0x110eb7?{'main':_0x110eb7}:_0x110eb7;for(const _0x8902c8 of Object['keys'](_0x414f65)){if(!this['_document']['roots']['has'](_0x8902c8))throw new _0x213e64('realtimecollaborationclient-init-non-existent-root',this);const _0x3749ed=this['editor']['data']['parse'](_0x414f65[_0x8902c8]),_0x43aeef=this['_document']['getRoot'](_0x8902c8),_0x2e1d87=new _0x475008(_0x19c01d['createPositionAt'](_0x43aeef,0x0),_0x3749ed,_0x2d3f10++);_0x4c3602['push'](_0x2e1d87);for(const [_0x7eb64f,_0x1d92cb]of _0x3749ed['markers']){const _0x4034de=_0x19c01d['createRange'](_0x19c01d['createPositionFromPath'](_0x43aeef,_0x1d92cb['start']['path']['slice']()),_0x19c01d['createPositionFromPath'](_0x43aeef,_0x1d92cb['end']['path']['slice']())),_0x17ffd8=new _0x4dfdf2(_0x7eb64f,null,_0x4034de,_0x19c01d['markers'],!0x0,_0x2d3f10++);_0x4c3602['push'](_0x17ffd8);}}if(_0x1904c9)for(const [_0x85454e,_0x3d954a]of Object['entries'](_0x1904c9)){const _0x377d88=_0x19c01d['document']['getRoot'](_0x85454e);if(!_0x377d88)throw new _0x213e64('multi-root-editor-root-attributes-no-root',null);for(const [_0xdec6c,_0x4044e4]of Object['entries'](_0x3d954a))if(null!==_0x4044e4){const _0x2e63b5=new _0x2d41d3(_0x377d88,_0xdec6c,null,_0x4044e4,_0x2d3f10++);_0x4c3602['push'](_0x2e63b5);}}return _0x4c3602;}async['_loadRoot'](_0x57d1d2,_0x11c420,_0x2b23f2){this['_getOperationsFromInitData']({[_0x57d1d2]:_0x11c420},{[_0x57d1d2]:_0x2b23f2})['forEach']((_0x559059,_0x499d33)=>{_0x559059['baseVersion']=this['_document']['version']+_0x499d33,_0x559059['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x559059);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async['_handleInitialConnectionData'](_0x47ddde,_0x1d4334){let _0x8432ce;this['_offset']=_0x47ddde['offset'];const _0x51251d=_0x47ddde['wereChangesApplied']&&!_0x47ddde['initData'],_0x16f9aa=_0x51251d?0x0:_0x47ddde['data']['baseVersion'];if(_0x1d4334['forEach'](_0x1050cd=>{_0x1050cd['_isInit']=!0x0,_0x1050cd['createdAt']=_0x47ddde['sessionCreatedAt'],_0x1050cd['_authorId']=null;}),_0x51251d)_0x8432ce=_0x1d4334,this['_applyOperationsSet'](_0x8432ce,_0x51251d);else{if(_0x47ddde['initData']){const _0x484dc9=this['_getOperationsFromInitData'](_0x47ddde['initData']);this['_document']['history']['version']=-_0x484dc9['length'],_0x484dc9['forEach'](_0x5bfaeb=>{_0x5bfaeb['baseVersion']-=_0x484dc9['length'],_0x5bfaeb['createdAt']=_0x47ddde['sessionCreatedAt'],_0x5bfaeb['_isInit']=!0x0,_0x5bfaeb['_authorId']=null;}),this['_applyOperationsSet'](_0x484dc9,!0x0),this['serverHistory']['version']=-_0x484dc9['length']+this['_offset'],this['_updateServerHistory'](_0x484dc9);}this['_document']['history']['version']=_0x16f9aa,_0x8432ce=this['_decompressOperations'](_0x47ddde['data'],_0x47ddde['metadata']),await this['_fetchMissingUsers'](_0x8432ce),this['_applyOperationsSet'](_0x8432ce,_0x51251d);}_0x47ddde['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x8432ce,_0x47ddde['lastOperationId']),this['_lastSyncedOperationId']=_0x47ddde['lastOperationId']),this['serverHistory']['version']=_0x16f9aa+this['_offset'],this['_updateServerHistory'](_0x8432ce),_0x1d4334['filter'](_0x236240=>{const _0x4cbb73=this['_getAffectedRoot'](_0x236240);return _0x4cbb73&&!this['_knownRootNames']['has'](_0x4cbb73);})['forEach']((_0x174dc6,_0x13945a)=>{_0x174dc6['baseVersion']=this['_document']['version']+_0x13945a,this['_saveOperationInBuffer'](_0x174dc6);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0xf6906,_0x3f7392){const _0x40d90e=_0x3f7392&&_0x3f7392['message'];if(_0x40d90e&&_0x40d90e['startsWith']('realtimecollaborationclient'))throw _0x3f7392;const _0x1bec69=this['editor']['plugins']['get'](n);throw this['_isPendingUpdate']=!0x0,_0x1bec69['disconnect'](),this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0x213e64(_0xf6906,this['editor'],_0x40d90e?{'originalError':_0x40d90e}:void 0x0);}['_saveOperationInBuffer'](_0x41b340){this['_knownOperations']['has'](_0x41b340)||(this['_knownOperations']['add'](_0x41b340),this['_bufferedOperations']['push'](_0x41b340),this['_pendingAction']||'marker'==_0x41b340['type']&&!_0x41b340['affectsData']||this['_setPendingAction']());}['_sendBufferedOperationsDelayed'](_0x54b933=!0x1){!_0x54b933&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0x16689d=>{_0x16689d&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0x1caf41=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0xb59674){return _0xb59674['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0xb59674['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0xb59674['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0x1caf41)||this['_crash'](_0x1caf41['message'],_0x1caf41);});},this['_currentBufferDelay']));}['_waitUntilSynced'](){return new Promise(_0x228521=>{this['on']('change:_isPendingUpdate',()=>{_0x228521();});});}async['_sendBufferedOperations'](){const _0x4a9bca=this['editor']['plugins']['get'](G);if(this['_shouldSendSelectionUpdate']()&&(_0x4a9bca['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x125300=[...this['_bufferedOperations']];for(const _0x3d1740 of _0x125300)_0x3d1740['wasUndone']=this['_document']['history']['isUndoneOperation'](_0x3d1740);const _0x4c372c=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x125300),_0x5e92cf=Q++,_0x3face5=this['_compressOperations'](_0x125300),_0x53d7cf=await this['_service']['sendOperations'](_0x3face5,_0x3face5['baseVersion'],_0x4c372c);try{return await this['_handleServerResponse'](_0x125300,_0x53d7cf,_0x5e92cf);}catch(_0x2cb100){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0x2cb100);}}async['_handleServerResponse'](_0xdf7610,_0x3e8266,_0x4d32a2){if('error'in _0x3e8266)throw _0x3e8266['error'];let _0x39c84a=!0x1;if(_0x3e8266['wereChangesApplied']){_0x3e8266['lastOperationId']&&(this['_lastSyncedOperationId']=_0x3e8266['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x64f06d=>!_0xdf7610['includes'](_0x64f06d));for(const _0x2c426e of _0xdf7610)_0x2c426e['createdAt']='lastOperationAcceptedAt'in _0x3e8266&&_0x3e8266['lastOperationAcceptedAt']||void 0x0;Y(_0xdf7610,_0x3e8266['version']-_0xdf7610['length']),this['_updateServerHistory'](_0xdf7610);const _0x2abc27=_0xdf7610['filter'](_0x33741a=>{if(!_0x33741a['_isInit'])return!0x1;const _0x478643=this['_getAffectedRoot'](_0x33741a);return _0x478643&&!this['_knownRootNames']['has'](_0x478643);});Y(_0x2abc27,this['_document']['version']),this['_applyOperationsSet'](_0x2abc27),_0x39c84a=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0x44289f=this['_decompressOperations'](_0x3e8266['data'],_0x3e8266['metadata'])['filter'](_0x200020=>_0x200020['baseVersion']>=this['_lastServerVersion']);_0x44289f['forEach'](_0x37fd6f=>this['_addKnownRoot'](_0x37fd6f)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x383bd7=>!_0x383bd7['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x383bd7))),this['_bufferedOperations']['length']&&Y(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0x44289f),_0x39c84a=this['_handleExternalOperations'](_0x44289f,_0x3e8266['version'],_0x3e8266['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x39c84a?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}['_handleExternalOperations'](_0x54f6d5,_0x5dfb62,_0x47e372){try{const _0x3e4b56={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x36830a,operationsB:_0x20abff,originalOperations:_0x1e06b5}=_0x65b94f(_0x54f6d5,this['_bufferedOperations'],_0x3e4b56);Y(_0x36830a,this['_document']['version']),Y(_0x20abff,_0x5dfb62);for(const _0x2cb39c of _0x36830a){const _0x1a5056=_0x1e06b5['get'](_0x2cb39c);_0x2cb39c['_authorId']=_0x1a5056?_0x1a5056['_authorId']:null;}_0x47e372&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x54f6d5,_0x47e372),this['_lastSyncedOperationId']=_0x47e372),this['_bufferedOperations']=[..._0x20abff],this['_applyOperationsSet'](_0x36830a),this['_updateServerHistory'](_0x54f6d5);}catch(_0x16a175){return console['error'](_0x16a175),!0x1;}return!0x0;}['_applyOperationsSet'](_0x3b85f1,_0x1896f9=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0x1fdbc1=>{for(const _0x16cc73 of _0x3b85f1)this['_knownOperations']['add'](_0x16cc73),this['_addKnownRoot'](_0x16cc73),_0x1fdbc1['batch']['addOperation'](_0x16cc73),this['editor']['model']['applyOperation'](_0x16cc73);});}['_addKnownRoot'](_0x558ce8){const _0x4d57c2=this['_getAffectedRoot'](_0x558ce8);_0x4d57c2&&this['_knownRootNames']['add'](_0x4d57c2);}['_getAffectedRoot'](_0x23ce1e){let _0x53cc81,_0x7c6ae3;switch(_0x23ce1e['type']){case'insert':_0x53cc81=_0x23ce1e['position']['root'];break;case'marker':if(_0x7c6ae3=_0x23ce1e['newRange'],!_0x7c6ae3)return null;_0x53cc81=_0x7c6ae3['root'];break;case'addRootAttribute':_0x53cc81=_0x23ce1e['root'];break;case'addRoot':_0x53cc81=_0x23ce1e['affectedSelectable'];break;case'move':_0x53cc81=_0x23ce1e['targetPosition']['root'];break;default:return null;}return _0x53cc81['rootName'];}['_updateServerHistory'](_0x1f3c10){_0x1f3c10['forEach'](_0x451277=>{const _0x57692f=_0x451277['clone']();_0x57692f['_authorId']=_0x451277['_authorId'],_0x57692f['_isInit']=!!_0x451277['_isInit'],_0x57692f['createdAt']=_0x451277['createdAt'],_0x57692f['baseVersion']+=this['_offset'],_0x451277['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x57692f),this['serverHistory']['addOperation'](_0x57692f);});}['_handleReconnectionError'](_0x4b73f7){const _0xf00095=this['editor']['plugins']['get']('Notification'),_0x565289=this['editor']['locale'];_0x4b73f7||(_0x4b73f7=$(_0x565289,'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.')),_0xf00095['showWarning'](_0x4b73f7,{'title':$(_0x565289,'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'](_0x4d3072)['add']($(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}['_clearPendingAction'](){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x4d3072)['remove'](this['_pendingAction']),this['_pendingAction']=null);}['_compressOperations'](_0x6d426b){const _0xc52aff=_0x6d426b['map'](_0x46eaa5=>_0x46eaa5['toJSON']());return this['_compressor']['compress'](_0xc52aff);}['_decompressOperations'](_0xdb8b4b,_0x508338){return this['_compressor']['decompress'](_0xdb8b4b)['map']((_0x24ca31,_0x2876cc)=>{const _0xf29f81='init'==_0x508338[_0x2876cc]['type'];if('InsertOperation'==_0x24ca31['__className']){const _0x2c21a6=_0x24ca31['position']['root'];!this['_document']['getRoot'](_0x2c21a6)&&(this['_document']['createRoot']('$root',_0x2c21a6)['_isAttached']=!0x1);}const _0x106810=_0x5e5f99['fromJSON'](_0x24ca31,this['_document']);return _0x106810['wasUndone']=_0x24ca31['wasUndone'],_0x106810['_isInit']=_0xf29f81,_0x106810['_authorId']=_0xf29f81?null:_0x508338[_0x2876cc]['userId'],_0x106810['_isDisconnection']='cs:removeUser'===_0x508338[_0x2876cc]['type'],_0x106810['createdAt']=_0x508338[_0x2876cc]['createdAt'],_0x106810;});}['_refreshUserSelectionMarkers'](){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}['_shouldSendSelectionUpdate'](){const _0x11f8b4=this['editor']['plugins']['get'](i)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0x11f8b4&&_0x11f8b4['length']>0x1&&this['_hasSelectionChanged'];}['_shouldSendUpdate'](){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}}class X extends Error{}function Y(_0x14909c,_0x557cc3){for(const _0x48cb4d of _0x14909c)_0x48cb4d['baseVersion']=_0x557cc3++;}class Z{['_ignoredOperations'];['_operationToId'];constructor(_0x5168bc){this['_ignoredOperations']=_0x5168bc,this['_operationToId']=new WeakMap();}['getIdOfTheLastOperation'](_0x358de6){let _0x8dedc8=_0x358de6['length'];for(;_0x8dedc8--;){const _0x356d97=_0x358de6[_0x8dedc8];if(!this['_ignoredOperations']['has'](_0x356d97)){if(!this['_operationToId']['has'](_0x356d97)){const _0x28ceeb=_0x322f72()['slice'](0x1,0x12);this['_operationToId']['set'](_0x356d97,_0x28ceeb);}return this['_operationToId']['get'](_0x356d97);}}}['setIdForTheLastOperation'](_0x2b72c2,_0x40676a){if(!_0x40676a)return;let _0xcc540c=_0x2b72c2['length'];for(;_0xcc540c--;){const _0x49cec0=_0x2b72c2[_0xcc540c];this['_ignoredOperations']['has'](_0x49cec0)||this['_operationToId']['set'](_0x49cec0,_0x40676a);}}}class a extends _0xc3a9c{static get['requires'](){return[l];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class s extends _0x209765{static ['CommentsService']=/* #__PURE__ -- @preserve */
|
|
26
|
+
((()=>_0x35df08)());['_services'];static get['requires'](){return[n,'CommentsRepository',i,_0x5a0a2c];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x54f32e){super(_0x54f32e),this['_services']=new Map();}async['init'](){const _0x3a1038=this['context'],_0x2354a1=_0x3a1038['plugins']['get']('CommentsRepository');if(_0x3a1038['plugins']['get'](n)['addToReconnectionStack'](this),_0x2354a1['adapter']={'addCommentThread':async({channelId:_0x462444,threadId:_0x54c2ff,comments:_0x318eba,resolvedAt:_0x162278,resolvedBy:_0x520fb3,context:_0x1664f5,attributes:_0x3c494a})=>{const _0x25c5b4=await this['_getService'](_0x462444)['addCommentThread']({'commentThreadId':_0x54c2ff,'comments':_0x318eba['map'](_0x3d5882=>function(_0x514746,_0x394f0a,_0x61eade){return{'commentThreadId':_0x61eade,'commentId':_0x514746['commentId'],'userId':_0x514746['authorId'],'content':_0x514746['content'],'documentId':_0x394f0a,'createdAt':_0x514746['createdAt'],'attributes':_0x514746['attributes']||{}};}(_0x3d5882,_0x462444,_0x54c2ff)),'resolvedAt':_0x162278,'resolvedBy':_0x520fb3,'context':_0x1664f5,'attributes':_0x3c494a})['catch'](at);return{'threadId':_0x25c5b4['commentThreadId'],'comments':_0x25c5b4['comments']};},'getCommentThread':async({channelId:_0x15103d,threadId:_0xebd68e})=>{const _0x514bd2=await this['_getService'](_0x15103d)['getCommentThread'](_0xebd68e)['catch'](at);return _0x514bd2['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0x514bd2]),{'threadId':_0x514bd2['commentThreadId'],'comments':_0x514bd2['comments']['map'](p),'context':_0x514bd2['context'],'resolvedAt':_0x514bd2['resolvedAt'],'resolvedBy':_0x514bd2['resolvedBy'],'attributes':_0x514bd2['attributes']||{}});},'updateCommentThread':async({channelId:_0xdd6eda,threadId:_0x11e272,context:_0x5f035f,unlinkedAt:_0x260379,attributes:_0x835e52})=>this['_getService'](_0xdd6eda)['updateCommentThread']({'commentThreadId':_0x11e272,'context':_0x5f035f,'attributes':_0x835e52,'unlinkedAt':_0x260379})['catch'](v)['catch'](at),'resolveCommentThread':async({channelId:_0x59a472,threadId:_0x9b968d})=>{const _0x9523b5=await this['_getService'](_0x59a472)['resolveCommentThread'](_0x9b968d)['catch'](v)['catch'](at);return{'threadId':_0x9523b5['commentThreadId'],'resolvedAt':_0x9523b5['resolvedAt'],'resolvedBy':_0x9523b5['resolvedBy']};},'reopenCommentThread':async({channelId:_0x4342a2,threadId:_0x425e2b})=>this['_getService'](_0x4342a2)['reopenCommentThread'](_0x425e2b)['catch'](v)['catch'](at),'removeCommentThread':({channelId:_0x3c80f5,threadId:_0x2b682e})=>this['_getService'](_0x3c80f5)['removeCommentThread'](_0x2b682e)['catch'](v)['catch'](at),'addComment':({channelId:_0x5942f4,threadId:_0x7fcbdc,commentId:_0xb476b5,content:_0x535213,attributes:_0x5a623a})=>this['_getService'](_0x5942f4)['addComment'](_0x7fcbdc,_0xb476b5,_0x535213,_0x5a623a)['catch'](at),'updateComment':({channelId:_0x4ccb8b,threadId:_0x3a50e6,commentId:_0x188bf6,content:_0x530ad3,attributes:_0x9ea24a})=>this['_getService'](_0x4ccb8b)['updateComment'](_0x3a50e6,_0x188bf6,_0x530ad3,_0x9ea24a)['catch'](v)['catch'](at),'removeComment':({channelId:_0x4722be,threadId:_0x4d49c6,commentId:_0x5b1d76})=>this['_getService'](_0x4722be)['removeComment'](_0x4d49c6,_0x5b1d76)['catch'](v)['catch'](at)},_0x3a1038 instanceof _0x43e148){const _0x1faa73=_0x3a1038['config']['get']('collaboration.channelId'),_0x18b212=_0x3a1038['plugins']['get'](i);await this['_setUpService'](_0x1faa73);const _0x1b200e=await this['_services']['get'](_0x1faa73)['getConnectedSessions']();this['listenTo'](_0x18b212,'sessionAdd:'+_0x1faa73,(_0x5412db,{session:_0x397342})=>{_0x397342['id']===_0x18b212['mySessionId']&&(_0x5412db['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x397342['permissions'],_0x1faa73));}),_0x18b212['register'](_0x1faa73,_0x1b200e);}}async['_setUpService'](_0x3e755f){if(this['_services']['has'](_0x3e755f))throw new _0x213e64('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0x3e755f});const _0x2dd2f0=this['context']['plugins']['get']('CommentsRepository'),_0x1b98aa=new s['CommentsService'](_0x3e755f);this['_services']['set'](_0x3e755f,_0x1b98aa),this['listenTo'](_0x1b98aa,'commentThreadAdded',(_0x341fa3,_0x3d8f9b)=>{const {commentThreadId:_0x14ae9b,documentId:_0x314bc4,context:_0x5bc60a,attributes:_0x40fa82,resolvedAt:_0x2775ee,resolvedBy:_0x9311ca,comments:_0x29b363}=_0x3d8f9b;_0x2dd2f0['getCommentThread'](_0x14ae9b)||_0x2dd2f0['addCommentThread']({'threadId':_0x14ae9b,'channelId':_0x314bc4,'comments':_0x29b363?_0x29b363['map'](p):[],'context':_0x5bc60a,'attributes':_0x40fa82,'resolvedAt':_0x2775ee,'resolvedBy':_0x9311ca,'isFromAdapter':!0x0});}),this['listenTo'](_0x1b98aa,'commentThreadUpdated',(_0x2a3fae,{commentThreadId:_0x38d1b9,documentId:_0x2aa0b4,context:_0x3a5e41,unlinkedAt:_0x2e843a,attributes:_0x853037})=>{_0x2dd2f0['getCommentThread'](_0x38d1b9)&&_0x2dd2f0['updateCommentThread']({'threadId':_0x38d1b9,'channelId':_0x2aa0b4,'context':_0x3a5e41,'unlinkedAt':_0x2e843a,'attributes':_0x853037,'isFromAdapter':!0x0});}),this['listenTo'](_0x1b98aa,'commentThreadResolved',(_0x165ea4,{commentThreadId:_0xaa3070,resolvedBy:_0x44a6c1,resolvedAt:_0x337584})=>{const _0x56e5a1=_0x2dd2f0['getCommentThread'](_0xaa3070);_0x56e5a1&&_0x56e5a1['resolve']({'resolvedBy':_0x44a6c1,'resolvedAt':_0x337584,'isFromAdapter':!0x0});}),this['listenTo'](_0x1b98aa,'commentThreadReopened',(_0x1c14a5,{commentThreadId:_0x49f8eb})=>{const _0x5e6ba9=_0x2dd2f0['getCommentThread'](_0x49f8eb);_0x5e6ba9&&_0x5e6ba9['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0x1b98aa,'commentThreadRemoved',(_0x3add11,{commentThreadId:_0x349969})=>{const _0x1f5645=_0x2dd2f0['getCommentThread'](_0x349969);_0x1f5645&&_0x1f5645['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0x1b98aa,'commentAdded',(_0x2418ce,_0x52a7a5)=>{const _0x1a0707=_0x52a7a5['commentThreadId'],_0x416266=_0x2dd2f0['getCommentThread'](_0x1a0707);_0x416266&&_0x416266['addComment']({...p(_0x52a7a5),'isFromAdapter':!0x0});}),this['listenTo'](_0x1b98aa,'commentUpdated',(_0x1dc876,{commentThreadId:_0x1daeda,commentId:_0x471ffa,content:_0x174c01,attributes:_0x4aab39})=>{const _0x136823=_0x2dd2f0['getCommentThread'](_0x1daeda);if(_0x136823){const _0x55f61d=_0x136823['getComment'](_0x471ffa);_0x55f61d&&_0x55f61d['update']({'content':_0x174c01,'attributes':_0x4aab39,'isFromAdapter':!0x0});}}),this['listenTo'](_0x1b98aa,'commentRemoved',(_0x5cbb5c,{commentThreadId:_0x3233e2,commentId:_0x2b9083})=>{const _0xd0c311=_0x2dd2f0['getCommentThread'](_0x3233e2);if(_0xd0c311){const _0x3ef29c=_0xd0c311['getComment'](_0x2b9083);_0x3ef29c&&_0x3ef29c['remove']({'isFromAdapter':!0x0});}}),await this['_connectService'](_0x3e755f);}['destroy'](){if(this['context']instanceof _0x43e148){const _0x58a77b=this['context']['config']['get']('collaboration.channelId');this['_terminateService'](_0x58a77b);}}['_terminateService'](_0x5dccf6){if(!this['_services']['has'](_0x5dccf6))throw new _0x213e64('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0x5dccf6});this['_getService'](_0x5dccf6)['disconnect'](),this['_services']['delete'](_0x5dccf6);}async['reconnect'](){for(const _0x2f7f14 of this['_services']['keys']())await this['_connectService'](_0x2f7f14);if(this['context']instanceof _0x43e148){const _0x383a62=this['context']['config']['get']('collaboration.channelId'),_0x2d90e2=this['context']['plugins']['get'](i);_0x2d90e2['unregister'](_0x383a62);const _0x207f27=await this['_services']['get'](_0x383a62)['getConnectedSessions']();_0x2d90e2['register'](_0x383a62,_0x207f27);}}async['_connectService'](_0x17b506){const {connection:_0x264ec7}=this['context']['plugins']['get'](n),_0x1cd97e=this['context']['plugins']['get']('CommentsRepository'),_0x420c2e=this['_services']['get'](_0x17b506),_0x5b8de7=await _0x420c2e['connect'](_0x264ec7);await this['_fetchMissingUsersForThreads'](_0x5b8de7);const _0x2a6479=new Set(Array['from'](_0x1cd97e['getCommentThreads']({'channelId':_0x17b506}),_0x2d9b3b=>_0x2d9b3b['id']));for(const _0xfd7efd of _0x5b8de7)_0xfd7efd['deletedAt']||_0x2a6479['delete'](_0xfd7efd['commentThreadId']);for(const _0x4e96e0 of _0x2a6479)_0x1cd97e['getCommentThread'](_0x4e96e0)['remove']({'isFromAdapter':!0x0});for(const _0x57fcb3 of _0x5b8de7){let _0xabfb0e=_0x1cd97e['getCommentThread'](_0x57fcb3['commentThreadId']);const {commentThreadId:_0x51a9c8,context:_0xffdf00,attributes:_0x18a6ee,resolvedBy:_0x3952da,resolvedAt:_0x1a1f1f,unlinkedAt:_0x31026e,deletedAt:_0x4ba25e}=_0x57fcb3;if(_0x4ba25e)continue;_0xabfb0e||(_0xabfb0e=_0x1cd97e['addCommentThread']({'channelId':_0x17b506,'threadId':_0x51a9c8,'context':_0xffdf00,'attributes':_0x18a6ee||{},'resolvedBy':_0x3952da,'resolvedAt':_0x1a1f1f,'unlinkedAt':_0x31026e,'isFromAdapter':!0x0}));const _0x4d70aa=new Set(Array['from'](_0xabfb0e['comments'],_0x375fe6=>_0x375fe6['id']));for(const _0x25e0c7 of _0x57fcb3['comments'])_0x4d70aa['delete'](_0x25e0c7['commentId']);for(const _0x45dc10 of _0x4d70aa)_0xabfb0e['getComment'](_0x45dc10)['remove']({'isFromAdapter':!0x0});for(const _0x4b715a of _0x57fcb3['comments']){const _0x2c4454=_0xabfb0e['getComment'](_0x4b715a['commentId']);_0x2c4454?_0x2c4454['content']!==_0x4b715a['content']&&_0x2c4454['update']({'content':_0x4b715a['content'],'isFromAdapter':!0x0}):_0xabfb0e['addComment'](Object['assign'](p(_0x4b715a),{'isFromAdapter':!0x0}));}}}['_getService'](_0x575112){if(!this['_services']['has'](_0x575112))throw new _0x213e64('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0x575112});return this['_services']['get'](_0x575112);}async['_fetchMissingUsersForThreads'](_0x46ca9e){const _0x1cca64=this['context']['plugins']['get'](_0x5a0a2c),{connection:_0x504b21}=this['context']['plugins']['get'](n),_0x4408d1=new Set();for(const {resolvedBy:_0x22ab9f,comments:_0x2e9327}of _0x46ca9e){_0x22ab9f&&!_0x1cca64['getUser'](_0x22ab9f)&&_0x4408d1['add'](_0x22ab9f);for(const {userId:_0x496ec4}of _0x2e9327)_0x1cca64['getUser'](_0x496ec4)||_0x4408d1['add'](_0x496ec4);}if(0x0===_0x4408d1['size'])return;const _0x454e60=await ct['getMany'](_0x504b21,Array['from'](_0x4408d1));for(const _0x396637 of _0x454e60)_0x1cca64['getUser'](_0x396637['id'])||_0x1cca64['addUser'](_0x396637);}}async function v(_0x5204b6){if('404'!==_0x5204b6['code'])throw _0x5204b6;}function at(_0x21d110){if((_0x2af84e=_0x21d110)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0x2af84e['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x2af84e['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0x2af84e;throw _0x21d110;}function p(_0x55e7d8){return{'threadId':_0x55e7d8['commentThreadId'],'commentId':_0x55e7d8['commentId'],'content':_0x55e7d8['content'],'createdAt':_0x55e7d8['createdAt'],'authorId':_0x55e7d8['userId'],'attributes':_0x55e7d8['attributes']||{}};}class m extends _0xc3a9c{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(_0x5b5306){super(_0x5b5306);const _0x1b508d=this['editor']['config']['get']('collaboration.channelId');this['_bufferedRequests']=new Map(),this['_trackChangesService']=new m['TrackChangesService'](_0x1b508d);}['init'](){const _0x44bede=this['editor']['plugins']['get'](n),_0x456a13=this['editor']['plugins']['get']('TrackChangesEditing');return _0x456a13['adapter']={'getSuggestion':async _0x52ce3d=>{await this['_waitForServiceReady']();const _0xab5a61=await this['_trackChangesService']['get'](_0x52ce3d)['catch'](A);return await this['_fetchMissingUsersForThreads']([_0xab5a61]),_0xab5a61;},'addSuggestion':async({id:_0x7403b5,type:_0x2ef97c,data:_0x2e32c1,originalSuggestionId:_0x150b4f,attributes:_0x1c4713})=>{await this['_waitForServiceReady']();const _0x1a2aee={'id':_0x7403b5,'type':_0x2ef97c,'data':_0x2e32c1,'originalSuggestionId':_0x150b4f,'attributes':_0x1c4713},_0x6107e8=await this['_trackChangesService']['add'](_0x7403b5,_0x2ef97c,_0x2e32c1,_0x150b4f,_0x1c4713)['catch'](_0x196eeb=>{if(ht(_0x196eeb))return new Promise(_0xef6191=>{this['_bufferedRequests']['set'](_0x7403b5,{'resolve':_0xef6191,'suggestionData':_0x1a2aee});});throw _0x196eeb;});return this['_bufferedRequests']['delete'](_0x7403b5),_0x6107e8;},'updateSuggestion':async(_0xc05c09,_0x58827f)=>{if(await this['_waitForServiceReady'](),'open'!==_0x58827f['state'])return this['_trackChangesService']['update'](_0xc05c09,_0x58827f)['catch'](A);}},this['listenTo'](this['_trackChangesService'],'suggestionUpdated',(_0x4ee95a,_0x2cec7c)=>{_0x456a13['hasSuggestion'](_0x2cec7c['id'])&&(_0x456a13['getSuggestion'](_0x2cec7c['id'])['attributes']=_0x2cec7c['attributes']);}),this['_trackChangesService']['connect'](_0x44bede['connection'])['then'](_0x15fc1e=>(_0x44bede['addToReconnectionStack'](this),this['_fetchMissingUsersForThreads'](_0x15fc1e)['then'](()=>{for(const _0x329602 of _0x15fc1e){_0x456a13['addSuggestionData'](_0x329602)['_saved']=!0x0;}})));}async['reconnect'](){const _0xe661f2=this['editor']['plugins']['get']('TrackChangesEditing'),{connection:_0x2753ab}=this['editor']['plugins']['get'](n),_0x5d1b56=await this['_trackChangesService']['connect'](_0x2753ab);await this['_fetchMissingUsersForThreads'](_0x5d1b56);for(const {suggestionData:_0x159d77,resolve:_0x5712ad}of this['_bufferedRequests']['values']()){let _0x5c76cd=_0x5d1b56['find'](_0x56895a=>_0x56895a['id']===_0x159d77['id']);_0x5c76cd||(_0x5c76cd=await this['_trackChangesService']['add'](_0x159d77['id'],_0x159d77['type'],_0x159d77['data'],_0x159d77['originalSuggestionId'])),_0x5712ad(_0x5c76cd);}for(const _0x4879ff of _0x5d1b56)_0xe661f2['hasSuggestion'](_0x4879ff['id'])||_0xe661f2['addSuggestionData'](_0x4879ff);}async['_waitForServiceReady'](){this['_trackChangesService']['isConnected']||await new Promise(_0x5f5b23=>{this['listenTo'](this['_trackChangesService'],'connected',_0x14b746=>{_0x14b746['off'](),_0x5f5b23();});});}async['_fetchMissingUsersForThreads'](_0x49cbf7){const _0x327b05=this['editor']['plugins']['get'](_0x5a0a2c),{connection:_0x1beae1}=this['editor']['plugins']['get'](n),_0x24b362=new Set();for(const {authorId:_0xd3ea00}of _0x49cbf7)_0x327b05['getUser'](_0xd3ea00)||_0x24b362['add'](_0xd3ea00);if(0x0===_0x24b362['size'])return;const _0xbc2559=await ct['getMany'](_0x1beae1,Array['from'](_0x24b362));for(const _0x46a626 of _0xbc2559)_0x327b05['getUser'](_0x46a626['id'])||_0x327b05['addUser'](_0x46a626);}}function A(_0x2eb894){if(ht(_0x2eb894))return new Promise(()=>{});throw _0x2eb894;}function ht(_0x5b0ee3){return _0x5b0ee3['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x5b0ee3['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class g extends _0xc3a9c{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 _0x378c50=this['editor']['plugins']['get'](n),_0x5ac9ae=this['editor']['plugins']['get']('CommentsEditing'),_0x5cd8a8=this['editor']['plugins']['get'](s);return this['editor']['data']['once']('ready',()=>{this['listenTo'](_0x378c50,'change:state',(_0x45827c,_0x5da531,_0x2cefcb)=>{_0x5ac9ae['isThreadsLoadingPaused']='connected'!==_0x2cefcb;});}),this['listenTo'](_0x378c50,'change:state',(_0x5d743f,_0x36a387,_0x2d3b3e)=>{this['editor']['plugins']['get']('CommentsRepository')['switchReadOnly']('connected'!==_0x2d3b3e);}),_0x5cd8a8['_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 _0xc3a9c{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 _0xc3a9c{static ['RevisionHistoryService']=/* #__PURE__ -- @preserve */
|
|
28
|
+
((()=>_0x11a9e4)());['_lastRequestId'];['_revisionTracker'];['_revisionHistoryService'];['_oldOffset'];static get['requires'](){return[n,l,'RevisionHistory',i,_0x5a0a2c];}static get['pluginName'](){return'CloudServicesRevisionHistoryAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x311665){super(_0x311665);const _0x55b43d=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new c['RevisionHistoryService'](_0x55b43d);}async['init'](){const _0xe2b307=this['editor']['plugins']['get'](l),_0x199aee=_0xe2b307['serverHistory'],_0x26fd8e=this['editor']['plugins']['get'](n);this['_revisionTracker']['setSource']({'history':_0x199aee,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0xe2b307['sessionId']});const _0x24c4fa=this['editor']['config']['get']('cloudServices.bundleVersion')||nt,_0x221264=await _0x1d9c68['isBundleUploaded'](_0x26fd8e['connection'],_0x24c4fa);this['editor']['plugins']['get']('RevisionHistory')['adapter']={'getRevision':async({revisionId:_0x1114d6})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0x1114d6)),'updateRevisions':async _0x2f0731=>{await this['_waitForServiceReady']();const _0x3d82bb=this['_revisionTracker']['currentRevision'];if(_0x221264&&0x1===_0x2f0731['length']&&_0x2f0731[0x0]['id']===_0x3d82bb['id'])return _0x2f0731;for(const _0x4889e8 of _0x2f0731)_0x4889e8['id']===_0x3d82bb['id']&&(_0x4889e8['isEmptyCurrent']=_0x4889e8['fromVersion']===_0x4889e8['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0x2f0731,this['_lastRequestId'])['then'](_0x1b673c=>(this['_lastRequestId']=_0x1b673c,_0x2f0731))['catch'](_0x106cfd=>{if(M(_0x106cfd)||'400'===_0x106cfd['code']&&void 0x0!==_0x106cfd['data']['wrongRequestId']){for(const _0x2e429e of _0x2f0731){!this['_revisionTracker']['repository']['getRevision'](_0x2e429e['id'])||this['_revisionTracker']['_bufferUpdate'](_0x2e429e['id'],_0x2e429e,!0x1);}if(M(_0x106cfd))throw _0x106cfd;return _0x2f0731;}throw _0x106cfd;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0x416e92,{revisionsData:_0x21e7a4,requestId:_0x5045cc})=>{Math['max'](..._0x21e7a4['map'](_0x3ed862=>_0x3ed862['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0x21e7a4,_0x5045cc);}):this['_handleRevisionsUpdate'](_0x21e7a4,_0x5045cc);});const {revisions:_0x1e4bc7,requestId:_0x24efff}=await this['_revisionHistoryService']['connect'](_0x26fd8e['connection']);_0x26fd8e['addToReconnectionStack'](this),this['_lastRequestId']=_0x24efff,await this['_fetchMissingUsers'](_0x1e4bc7);for(const _0x3469ac of _0x1e4bc7)this['_revisionTracker']['addRevisionData'](_0x3469ac);this['listenTo'](_0xe2b307,'change:_isConnected',(_0x19f813,_0x2bbfea,_0x331326)=>{_0x331326&&(this['_oldOffset']=_0xe2b307['_offset'],_0x19f813['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](_0x26fd8e,'state',_0x941110=>_0x941110===_0x5f0b2d['CONNECTED']);}async['reconnect'](){const _0x2548c8=this['editor']['plugins']['get'](n),_0x224a20=this['editor']['plugins']['get'](l),_0x17f1c7=async()=>{const _0x1d22d7=this['_revisionTracker']['currentRevision'],_0x1b442b=_0x1d22d7['id'],_0x39cbf7=_0x1b442b!==_0x224a20['sessionId'];if(_0x39cbf7){const _0x5a7683=_0x224a20['_offset']-this['_oldOffset'],_0x170bc9=this['_getLatestVersionFromServerOperations']();this['_revisionTracker']['_revisionDataBuilder']['reInit']();if(_0x1d22d7['toVersion']+_0x5a7683!==_0x170bc9){const _0x52decf=_0x1d22d7['fromVersion']+_0x5a7683,_0x19277a=this['editor']['plugins']['get'](_0x5a0a2c),_0x29d362=this['_revisionTracker']['buildRevisionData']({'revision':_0x1d22d7,'from':_0x52decf,'to':_0x170bc9});_0x29d362['id']=_0x1d22d7['id'];const _0x572736=_0x29d362['authorsIds']['map'](_0x120f2e=>_0x19277a['getUser'](_0x120f2e));_0x1d22d7['_update']({..._0x29d362,'authors':_0x572736},!0x0),this['_revisionTracker']['_bufferUpdate'](_0x1d22d7['id'],_0x29d362,!0x0);}this['_revisionTracker']['_startingVersion']=_0x170bc9,(_0x1d22d7['toVersion']===_0x1d22d7['fromVersion']&&!this['_revisionTracker']['_bufferedUpdates']['has'](_0x1b442b)&&this['_revisionTracker']['repository']['_revisions']['remove'](_0x1b442b),this['_revisionTracker']['_createCurrentRevision'](_0x170bc9));}const {revisions:_0x57a5f8,requestId:_0x4e5780}=await this['_revisionHistoryService']['reconnect'](_0x2548c8['connection'],this['_lastRequestId']);_0x39cbf7&&_0x57a5f8['length']>0x0?_0x224a20['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x57a5f8),this['_handleRevisionsUpdate'](_0x57a5f8,_0x4e5780),this['_revisionTracker']['sendBufferedUpdates']());};return _0x224a20['_isConnected']?_0x17f1c7():new Promise((_0x498d4c,_0x251d8c)=>{_0x224a20['once']('change:_isConnected',()=>{_0x17f1c7()['then'](_0x498d4c)['catch'](_0x251d8c);});});}['destroy'](){super['destroy']();}async['_waitForServiceReady'](){this['_revisionHistoryService']['isConnected']||await new Promise(_0x969061=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x5d757b=>{_0x5d757b['off'](),_0x969061();});});}['_getLatestVersionFromServerOperations'](){const _0x2639c9=this['editor']['plugins']['get'](l)['serverHistory']['getOperations']()['reverse']();for(const _0x457dc2 of _0x2639c9)if('marker'!==_0x457dc2['type']||_0x457dc2['affectsData'])return _0x457dc2['baseVersion']+0x1;}['_getLatestVersion'](){const _0xe8b56a=this['editor']['plugins']['get'](l);return new Promise(_0x3254f7=>{_0xe8b56a['_isPendingUpdate']?_0xe8b56a['once']('change:_isPendingUpdate',()=>{_0x3254f7(this['_getLatestVersionFromServerOperations']());}):_0x3254f7(this['_getLatestVersionFromServerOperations']());});}['_handleRevisionsUpdate'](_0x1a03a8,_0x2882a6){const _0x5ce572=this['_revisionTracker']['repository'];this['_lastRequestId']=_0x2882a6;for(const _0x68f7b7 of _0x1a03a8){const _0x213947=_0x5ce572['getRevision'](_0x68f7b7['id']);if(_0x213947){if((_0x68f7b7['fromVersion']||_0x68f7b7['toVersion'])&&(_0x68f7b7['diffData']=null),_0x213947===this['_revisionTracker']['currentRevision']){const _0x50ab59=Math['max'](_0x213947['toVersion'],_0x68f7b7['toVersion']),_0x3cda34=Math['max'](_0x213947['fromVersion'],_0x68f7b7['fromVersion']);let _0x3472f7;_0x213947['toVersion']===_0x68f7b7['toVersion']&&_0x213947['fromVersion']===_0x68f7b7['fromVersion']?(_0x3472f7=!0x0,this['_preventResendingRevisionData'](_0x68f7b7)):_0x68f7b7['toVersion']===_0x50ab59&&_0x68f7b7['fromVersion']===_0x3cda34?_0x3472f7=!0x1:(_0x213947['toVersion']===_0x50ab59&&_0x213947['fromVersion']===_0x3cda34||this['_fixRevision']({'revision':_0x213947,'from':_0x3cda34,'to':_0x50ab59}),_0x3472f7=!0x0),_0x3472f7&&(delete _0x68f7b7['fromVersion'],delete _0x68f7b7['toVersion'],delete _0x68f7b7['diffData'],delete _0x68f7b7['createdAt'],delete _0x68f7b7['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0x68f7b7),this['_preventResendingRevisionData'](_0x68f7b7);}else this['_revisionTracker']['addRevisionData'](_0x68f7b7);}const _0x19fb21=_0x5ce572['getRevisions']();_0x19fb21['reverse']();for(let _0x35b0db=0x0;_0x35b0db<_0x19fb21['length']-0x1;_0x35b0db++){const _0x1d192b=_0x19fb21[_0x35b0db],_0x28b080=_0x19fb21[_0x35b0db+0x1];if(_0x1d192b['fromVersion']<_0x28b080['toVersion']){const _0x575a27=_0x28b080['toVersion'],_0x3a022c=Math['max'](_0x575a27,_0x1d192b['toVersion']);this['_fixRevision']({'revision':_0x1d192b,'from':_0x575a27,'to':_0x3a022c});}}}['_fixRevision']({revision:_0x1b5659,from:_0x53a1a5,to:_0x14347f}={}){const _0x3eb29a=this['editor']['plugins']['get'](_0x5a0a2c),_0x23070c=this['_revisionTracker']['buildRevisionData']({'revision':_0x1b5659,'from':_0x53a1a5,'to':_0x14347f});_0x23070c['authors']=_0x23070c['authorsIds']['map'](_0x583d5b=>_0x3eb29a['getUser'](_0x583d5b)),_0x1b5659['_update'](_0x23070c);}['_preventResendingRevisionData'](_0x3e8f6f){const _0x27421a={};_0x27421a['id']=_0x3e8f6f['id'];for(const _0x56121a of Object['keys'](_0x3e8f6f))'id'!==_0x56121a&&(_0x27421a[_0x56121a]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0x27421a['id'],_0x27421a,!0x0);}async['_fetchMissingUsers'](_0xabf2dd){const _0x354691=this['editor']['plugins']['get'](_0x5a0a2c),{connection:_0x42bc51}=this['editor']['plugins']['get'](n),_0x31e97f=new Set();for(const _0x1a6935 of _0xabf2dd){for(const _0x333a1e of _0x1a6935['authorsIds'])_0x33c4b7(_0x333a1e);_0x1a6935['creatorId']&&_0x33c4b7(_0x1a6935['creatorId']);}if(0x0===_0x31e97f['size'])return;const _0x27724c=await ct['getMany'](_0x42bc51,Array['from'](_0x31e97f));for(const _0xaa319e of _0x27724c)_0x354691['getUser'](_0xaa319e['id'])||_0x354691['addUser'](_0xaa319e);function _0x33c4b7(_0x4f8d11){_0x354691['getUser'](_0x4f8d11)||_0x31e97f['add'](_0x4f8d11);}}}function M(_0x5c701b){return _0x5c701b['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0x5c701b['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x5c701b['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class dt extends _0xc3a9c{static get['requires'](){return['RevisionHistory',c,a];}static get['pluginName'](){return'RealTimeCollaborativeRevisionHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class y extends _0x56ef61{['_collapseAt'];constructor(_0x41f365,_0x3e5460=0x6){super(_0x41f365);const _0x1524cc=this['bindTemplate'];this['set']('isHidden',!0x0),this['set']('usersCount',0x0),this['_collapseAt']=_0x3e5460,this['bind']('isHidden')['to'](this,'usersCount',_0x2b9857=>_0x2b9857<_0x3e5460),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item',_0x1524cc['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':_0x1524cc['to']('usersCount',_0xb72bbc=>'+'+(_0xb72bbc-this['_collapseAt']+0x2)['toString']())}]}]}]});}}class is extends _0x56ef61{['items'];['keystrokes'];constructor(_0x1adb69){super(_0x1adb69);const _0x1609d6=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0x58ca83(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0x1609d6['if']('hasPopup'),'aria-expanded':_0x1609d6['to']('isExpanded',_0x1310e1=>this['hasPopup']&&String(_0x1310e1)),'aria-label':_0x1609d6['to']('hasPopup',_0x2a2354=>$(_0x1adb69,_0x2a2354?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0x1609d6['to']('hasPopup',_0x6a020d=>!!_0x6a020d&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items'],'on':{'mouseenter':_0x1609d6['to'](()=>this['fire']('presencelist:show')),'mouseleave':_0x1609d6['to'](_0x82b620=>{const _0x3df603=_0x82b620,_0x3780e1=document['querySelector']('.ck-presence-list__dropdown-list'),_0x39e3b5=document['querySelector']('.ck-balloon-panel_with-arrow');_0x3780e1?.['contains'](_0x3df603['relatedTarget'])||_0x39e3b5?.['contains'](_0x3df603['relatedTarget'])||this['fire']('presencelist:hide');})}}),this['on']('change:hasPopup',(_0x169737,_0x51a1e1,_0x1f1e60)=>{this['element']&&(_0x1f1e60?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 k extends _0x56ef61{['counterView'];['inlineListView'];constructor(_0x5933b3,_0x2ac06f=0x6){super(_0x5933b3);const _0x2f1e93=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new y(this['locale'],_0x2ac06f),this['inlineListView']=new is(_0x5933b3),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x3bf1a9 of this['inlineListView']['items'])_0x3bf1a9['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',_0x2f1e93['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['inlineListView']]});}}class C extends _0x56ef61{['listWrapperView'];constructor(_0x5961c5,_0x45bff4){super(_0x5961c5);const _0x3ce3bd=this['bindTemplate'];this['listWrapperView']=new ut(_0x5961c5,_0x45bff4),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':$(_0x5961c5,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']],'on':{'mouseleave':_0x3ce3bd['to'](_0x7d4490=>{const _0x5b9b77=_0x7d4490,_0x5c5ff5=document['querySelector']('.ck-presence-list__list'),_0x133f41=document['querySelector']('.ck-balloon-panel_with-arrow');_0x5c5ff5?.['contains'](_0x5b9b77['relatedTarget'])||_0x133f41?.['contains'](_0x5b9b77['relatedTarget'])||this['fire']('presencelist:hide');})}});}}class ut extends _0x34d1d2{constructor(_0x5e8945,_0x501fac){super(_0x5e8945);const _0x2babf0=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0x501fac?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0x2babf0['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0x2babf0['to']('role'),'aria-label':_0x2babf0['to']('ariaLabel'),'aria-labelledby':_0x2babf0['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0x46f1c0['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0x19d71e=this['element'];_0x19d71e&&(this['_isScrollable']=Math['max'](_0x19d71e['scrollHeight'],_0x19d71e['clientHeight'])>0.8*window['innerHeight']);}}class P extends et{['userView'];constructor(_0x2ad101,_0x3ed62e,_0x28c635){super(_0x2ad101);const _0x1a0b1f=this['bindTemplate'];this['userView']=new st(_0x2ad101,_0x3ed62e);const _0x2b5d44={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0x3ed62e['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0x3ed62e['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x3ed62e['color']['getBackgroundColorClass']()],'aria-hidden':'true'}}]};_0x28c635&&(_0x2b5d44['tag']='button',_0x2b5d44['on']={'click':_0x1a0b1f['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x2b5d44);}['focus'](){this['element']['focus']();}}class _ extends _0x56ef61{['userView'];['markerView'];constructor(_0x438233,_0x37a0b1,_0x253870){super(_0x438233);const _0x2f165b=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new st(_0x438233,_0x37a0b1),this['markerView']=new ot(_0x438233,_0x37a0b1);const _0x3b0415=new it(_0x438233);_0x3b0415['template']['tag']='span',_0x3b0415['text']=_0x37a0b1['name'];const _0x2dd270={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0x2f165b['to']('isFocusable',_0x129366=>!!_0x129366&&0x0),'aria-labelledby':_0x3b0415['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0x2f165b['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0x2f165b['to']('hasTooltip',_0x214024=>!_0x214024),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0x3b0415]};_0x253870&&(_0x2dd270['tag']='button',_0x2dd270['on']={'click':_0x2f165b['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x2dd270);}}class ot extends _0x56ef61{constructor(_0x58ab53,_0x337a0f){super(_0x58ab53),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x337a0f['color']['getBackgroundColorClass']()],'aria-hidden':'true'}});}}const U={'collapseAt':0x6,'displayMe':!0x0};class r extends _0x209765{['currentDisplayedUsers'];['balloonPanelView'];['view'];['presenceDropdownView'];['_bodyCollection']=null;static get['pluginName'](){return'PresenceListUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x44895a){super(_0x44895a),this['context']['config']['define']('presenceList',U);const _0x23db9a=_0x44895a['config']['get']('presenceList.collapseAt');if('number'!=typeof _0x23db9a)throw new _0x213e64('presencelist-collapseat-invalid-format',this);if(_0x23db9a<0x1)throw new _0x213e64('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](i)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0x1085f1(),this['balloonPanelView']=new _0x5272a8(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get['requires'](){return[i];}['init'](){for(const _0x5a33a5 of this['_allConnectedUsers'])this['_handleUserAdd'](_0x5a33a5);this['listenTo'](this['_allConnectedUsers'],'add',(_0x146413,_0x5d4ea2)=>{this['_handleUserAdd'](_0x5d4ea2);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0x5bb2ca,_0x9dbb7b)=>{this['_handleUserRemove'](_0x9dbb7b);});}['_createView'](){const _0x1c1f15=this['context'],_0x39ee35=new k(this['context']['locale'],this['context']['config']['get']('presenceList.collapseAt')),_0x1e2ad7=this['balloonPanelView'];if(!_0x580414(_0x1c1f15['config']['get']('presenceList.container')))throw new _0x213e64('presencelist-missing-container',this);return _0x39ee35['counterView']['bind']('usersCount')['to'](this),_0x39ee35['bind']('isCollapsed')['to'](this,'usersCount',_0x28951a=>{const {collapseAt:_0x5eda97}=_0x1c1f15['config']['get']('presenceList'),_0x2a8fba=_0x28951a>=_0x5eda97;if(_0x2a8fba&&!_0x39ee35['inlineListView']['items']['find'](_0x5b782e=>_0x5b782e instanceof y)){const _0x566b05=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['currentDisplayedUsers']['length']==_0x566b05&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](this['currentDisplayedUsers']['length']-0x1),_0x39ee35['inlineListView']['items']['add'](_0x39ee35['counterView']);}return _0x2a8fba||this['hideDropdown'](),_0x2a8fba;}),_0x39ee35['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0x575eab=>{const _0x253018=_0x1c1f15['config']['get']('presenceList'),_0x130292=new _(_0x1c1f15['locale'],_0x575eab,!!_0x253018['onClick']);return _0x130292['bind']('hasTooltip')['to'](_0x39ee35,'isCollapsed',_0x3eca32=>!_0x3eca32),_0x130292['bind']('isFocusable')['to'](_0x39ee35,'isCollapsed',_0x53eade=>!_0x53eade),_0x253018['onClick']&&this['listenTo'](_0x130292,'execute',()=>{this['view']['isCollapsed']||_0x253018['onClick'](_0x575eab,_0x130292['element']);}),_0x130292;}),this['listenTo'](_0x39ee35['inlineListView'],'presencelist:show',()=>{this['view']['isCollapsed']&&this['showDropdown']();}),this['listenTo'](_0x39ee35['inlineListView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();}),_0x39ee35['inlineListView']['keystrokes']['set']('Enter',(_0x722d28,_0x292467)=>{this['view']['isCollapsed']&&(this['showDropdown'](),_0x292467());}),_0x39ee35['render'](),_0x1e2ad7['render'](),_0x2af274({'emitter':_0x39ee35,'activator':()=>_0x1e2ad7['isVisible'],'contextElements':[_0x1e2ad7['element'],_0x39ee35['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0x1c1f15['config']['get']('presenceList.container')['appendChild'](_0x39ee35['element']),this['_bodyCollection']=new _0x27fcf6(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_bodyCollection']['add'](this['balloonPanelView']),_0x39ee35;}['_handleUserAdd'](_0x23f8da){if(!this['context']['config']['get']('presenceList.displayMe')&&_0x23f8da['isMe'])return;const _0x738945=this['context']['config']['get']('presenceList.collapseAt')-0x1;for(this['usersCount']++;this['currentDisplayedUsers']['length']>=_0x738945-(this['view']['isCollapsed']?0x1:0x0)&&this['currentDisplayedUsers']['length']>0x1;)this['currentDisplayedUsers']['remove'](0x1);const _0x37fb4f=_0x23f8da['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0x23f8da,_0x37fb4f);}['_handleUserRemove'](_0x44ba3d){this['usersCount']--;const {collapseAt:_0x23ab9f}=this['context']['config']['get']('presenceList'),_0x595a66=this['usersCount']>=_0x23ab9f;if(this['currentDisplayedUsers']['get'](_0x44ba3d['id']))this['currentDisplayedUsers']['remove'](_0x44ba3d['id']);else{if(_0x595a66&&this['currentDisplayedUsers']['length']+0x1===_0x23ab9f-0x1)return;}if(this['currentDisplayedUsers']['length']+(_0x595a66?0x1:0x0)<this['usersCount']){for(const _0x548c5b of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0x548c5b['id'])&&(this['currentDisplayedUsers']['add'](_0x548c5b,Math['min'](this['currentDisplayedUsers']['length']-(_0x595a66?0x1:0x0),0x1)),this['currentDisplayedUsers']['length']+(_0x595a66?0x1:0x0)===_0x23ab9f-0x1))return;}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0x5b32dd=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new C(this['context']['locale'],!!_0x5b32dd['onClick']),this['view']['inlineListView']['isExpanded']=!0x0,this['listenTo'](this['presenceDropdownView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();});const {listWrapperView:_0x2a0fa8}=this['presenceDropdownView'];_0x2a0fa8['items']['bindTo'](this['_allConnectedUsers'])['using'](_0x3044c0=>{if(!_0x5b32dd['displayMe']&&_0x3044c0['isMe'])return null;const _0x3c7bc1=new P(this['context']['locale'],_0x3044c0,!!_0x5b32dd['onClick']);return _0x5b32dd['onClick']&&this['listenTo'](_0x3c7bc1,'execute',()=>{_0x5b32dd['onClick'](_0x3044c0,_0x3c7bc1['element']);}),_0x3c7bc1;}),this['balloonPanelView']['content']['add'](this['presenceDropdownView']),this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element']}),_0x2a0fa8['focus'](),_0x2a0fa8['checkIfScrollable']();const _0x2e6ff4=(_0x1cbbec,_0x3d0614)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0x3d0614();};_0x2a0fa8['keystrokes']['set']('Esc',_0x2e6ff4),_0x2a0fa8['keystrokes']['set']('Shift+Tab',_0x2e6ff4),_0x2a0fa8['keystrokes']['set']('Tab',(_0x554b32,_0x249fd6)=>{!function(_0x27efce){const _0x4d212a=['a','button','input','select','textarea','[tabindex]','[contenteditable]']['map'](_0x1b45ce=>_0x1b45ce+':not([disabled]):not([tabindex=\x22-1\x22])')['join'](','),_0x4b97a1=[...document['body']['querySelectorAll'](_0x4d212a)]['filter'](_0x1641a5=>_0x1641a5===document['activeElement']||_0x1641a5['offsetWidth']+_0x1641a5['offsetHeight']>0x0)['sort']((_0x16c073,_0x337e93)=>(_0x16c073['tabIndex']||0x0)-(_0x337e93['tabIndex']||0x0)),_0x4d0c20=_0x4b97a1['indexOf'](_0x27efce),_0x14942f=_0x4b97a1[(_0x4d0c20+0x1)%_0x4b97a1['length']];_0x14942f&&_0x14942f['focus']();}(this['view']['element']),this['hideDropdown'](),_0x249fd6();}),_0x2a0fa8['focusTracker']['add'](this['view']['element']),_0x2a0fa8['focusTracker']['on']('change:isFocused',(_0x3303b4,_0x8f4810,_0x324e9d)=>{_0x324e9d||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 _0x209765{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};
|