@ckeditor/ckeditor5-real-time-collaboration 45.1.0-alpha.3 → 45.1.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/real-time-collaboration.js +1 -1
- package/dist/index.js +6 -6
- package/package.json +14 -14
- package/src/presencelist/view/presencedropdownlistitemview.js +1 -1
- package/src/presencelist/view/presencedropdownlistview.js +1 -1
- package/src/presencelist/view/presenceinlinelistitemview.js +1 -1
- package/src/presencelist/view/presenceinlinelistview.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/usermarkers.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
|
-
((()=>lt)());static ['initialReconnectionInterval']=0x3e8;['connection'];['_reconnectionStack'];['_shouldPluginsReconnect'];['_domEmitter'];static get['requires'](){return['CloudServices',_0x445d56];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0xb54a5a){super(_0xb54a5a),this['set']('state',_0x22666b['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=Object['create'](_0x5d5780);}['init'](){const _0x16053f=this['context'],_0xfbe31e=_0x16053f['plugins']['get']('CloudServices'),_0x1e37c1=_0x16053f['plugins']['get'](_0x445d56);if(!_0xfbe31e['token'])throw new _0x71c4af('websocketgateway-missing-token',this);if(!_0xfbe31e['webSocketUrl'])throw new _0x71c4af('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),c['WebSocketGateway']['connect'](_0xfbe31e['token'],_0xfbe31e['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0x4dc1f2=>{if(this['connection']=_0x4dc1f2,this['bind']('state')['to'](_0x4dc1f2,'state',this,'_isBrowserOffline',(_0x197254,_0x5b09bc)=>('connected'!==_0x197254&&(this['_shouldPluginsReconnect']=!0x0),_0x5b09bc||_0x197254!==_0x22666b['CONNECTED']?_0x22666b['DISCONNECTED']:this['state']==_0x22666b['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),_0x22666b['CONNECTING']):_0x22666b['CONNECTED'])),this['connection']['on']('error',(_0x43be55,_0x1169c1)=>{if('limitExceeded'!==_0x1169c1['code'])throw console['error'](_0x1169c1),new _0x71c4af('cloudservices-init',null,{'originalError':_0x1169c1});_0x1e37c1['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'});}),!_0x4dc1f2['me'])return new Promise(_0x4dd840=>_0x4dc1f2['on']('change:me',_0x4dd840));})['catch'](_0x353477=>{throw console['error'](_0x353477),new _0x71c4af('cloudservices-init',null,{'originalError':_0x353477});});}['addToReconnectionStack'](_0x51933e){if('function'!=typeof _0x51933e['reconnect'])throw new _0x71c4af('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0x51933e))throw new _0x71c4af('websocketgateway-plugin-already-registered',this,{'name':_0x51933e['constructor']['pluginName']});this['_reconnectionStack']['add'](_0x51933e);}['removeFromReconnectionStack'](_0x1cc599){this['_reconnectionStack']['delete'](_0x1cc599);}['isInReconnectionStack'](_0x3690b4){return this['_reconnectionStack']['has'](_0x3690b4);}['_reconnect'](){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0x192c68=>_0x192c68['reconnect']())))['then'](()=>this['state']=_0x22666b['CONNECTED'])['catch'](_0xa718c5=>{throw console['error'](_0xa718c5),new _0x71c4af('cloudservices-reconnection-error',this['context']);});}['disconnect'](){this['connection']&&this['connection']['disconnect'](),this['state']=_0x22666b['DISCONNECTED'],this['_domEmitter']['stopListening']();}['destroy'](){this['disconnect'](),super['destroy']();}}class i extends _0x51d4ec{['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[c,_0x398766];}constructor(_0x451076){super(_0x451076),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0x447489(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x398766);}['init'](){const _0x306b97=this['context']['plugins']['get'](c);this['listenTo'](_0x306b97,'change:state',(_0x375d20,_0x38c219,_0x462a9a)=>{if('connected'!==_0x462a9a)this['channelSessions']['forEach'](_0xb42cac=>_0xb42cac['clear']()),this['channelConnectedUsers']['forEach'](_0x5353f1=>_0x5353f1['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x5cbeec,_0x12bd8d]of this['_registeredSessions'])for(const _0x2612ab of _0x12bd8d)this['_handleSessionAdd'](_0x5cbeec,_0x2612ab);}}),this['_createUser'](_0x306b97['connection']['me'],!0x0);}['register'](_0x5617d5,_0x18ac51){if(this['_registeredSessions']['has'](_0x5617d5))throw new _0x71c4af('sessions-register-already-registered',null,{'channelId':_0x5617d5});this['_registeredSessions']['set'](_0x5617d5,_0x18ac51),this['channelSessions']['set'](_0x5617d5,new _0x447489()),this['channelConnectedUsers']['set'](_0x5617d5,new _0x447489()),this['listenTo'](_0x18ac51,'add',(_0x56d604,_0x11291d)=>this['_handleSessionAdd'](_0x5617d5,_0x11291d)),this['listenTo'](_0x18ac51,'remove',(_0x1c65fb,_0x9ed9d0)=>this['_handleSessionRemove'](_0x5617d5,_0x9ed9d0));for(const _0x512b2b of _0x18ac51)this['_handleSessionAdd'](_0x5617d5,_0x512b2b);}['unregister'](_0x13330f){if(!this['_registeredSessions']['has'](_0x13330f))throw new _0x71c4af('sessions-unregister-not-exist',null,{'channelId':_0x13330f});const _0xcdf9a2=this['_registeredSessions']['get'](_0x13330f);this['stopListening'](_0xcdf9a2);for(const _0x5e55dc of _0xcdf9a2)'connected'===this['context']['plugins']['get'](c)['state']&&this['_handleSessionRemove'](_0x13330f,_0x5e55dc);this['_registeredSessions']['delete'](_0x13330f),this['channelSessions']['delete'](_0x13330f),this['channelConnectedUsers']['delete'](_0x13330f);}get['mySessionId'](){return this['context']['plugins']['get'](c)['connection']['sessionId'];}['getUserBySessionId'](_0x4cd441){for(const _0x582515 of this['channelSessions']['values']())for(const _0x5710e4 of _0x582515)if(_0x5710e4['id']===_0x4cd441)return _0x5710e4['user'];}['getUserSessions'](_0x13c054,_0x27dfbe){const _0x1cc70d=_0x27dfbe?[this['channelSessions']['get'](_0x27dfbe)]:this['channelSessions']['values'](),_0x188de0=new Set();for(const _0x1984dd of _0x1cc70d)for(const _0x272fff of _0x1984dd)_0x272fff['user']['id']===_0x13c054['id']&&_0x188de0['add'](_0x272fff['id']);return _0x188de0;}['getUserRole'](_0x16b2d2){for(const _0x2b2af4 of this['channelSessions']['values']())for(const _0x2534dc of _0x2b2af4)if(_0x2534dc['user']===_0x16b2d2)return _0x2534dc['role'];}['_handleSessionAdd'](_0x260dea,_0x2d15af){if('connected'!==this['context']['plugins']['get'](c)['state'])return;const _0xaf0957=_0x2d15af['user'],_0x1101ca=this['_users']['getUser'](_0xaf0957['id'])||this['_createUser'](_0xaf0957),_0x400daf=Object['assign']({},_0x2d15af,{'user':_0x1101ca});this['channelSessions']['get'](_0x260dea)['add'](_0x400daf);const _0x36d143=this['channelConnectedUsers']['get'](_0x260dea);_0x36d143['has'](_0x1101ca['id'])||_0x36d143['add'](_0x1101ca),this['allConnectedUsers']['has'](_0x1101ca['id'])||this['allConnectedUsers']['add'](_0x1101ca,_0x1101ca['isMe']?0x0:void 0x0),this['fire']('sessionAdd:'+_0x260dea,{'channelId':_0x260dea,'session':_0x400daf});}['_handleSessionRemove'](_0xaa169e,_0xed341){if('connected'!==this['context']['plugins']['get'](c)['state'])return;const _0x12da46=this['channelConnectedUsers']['get'](_0xaa169e),_0x37c5cc=_0xed341['user'];_0x37c5cc['id']&&(this['channelSessions']['get'](_0xaa169e)['remove'](_0xed341['id']),_0x12da46['has'](_0x37c5cc['id'])&&!this['getUserSessions'](_0x37c5cc,_0xaa169e)['size']&&_0x12da46['remove'](_0x37c5cc['id']),this['allConnectedUsers']['get'](_0x37c5cc['id'])&&!this['getUserSessions'](_0x37c5cc)['size']&&this['allConnectedUsers']['remove'](_0x37c5cc['id']));}['_createUser'](_0x48cec6,_0x1a10ce){const _0x119663=this['_users']['addUser'](_0x48cec6);return _0x1a10ce&&this['_users']['defineMe'](_0x48cec6['id']),_0x119663['orderNumber']=this['_uniqueUsersCount']++,_0x119663;}}class q extends _0x58ccc3{['_domEmitter']=new(_0x5d5780())();static get['requires'](){return[i];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0xba1f96=this['editor'],_0x39ea3f=_0xba1f96['plugins']['get'](i);_0xba1f96['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x4faac8,{writer:_0x4b67bf})=>function(_0x517f3a,_0x14b644,_0x57b0e1,_0x5f3a49){const _0x432bd5=_0x517f3a['markerName']['split'](':')[0x2],_0x19d843=_0x57b0e1['getUserBySessionId'](_0x432bd5);if(!_0x19d843||_0x432bd5===_0x57b0e1['mySessionId'])return;if(!_0x5f3a49['model']['schema']['checkChild'](_0x517f3a['markerRange']['start'],'$text'))return;const _0x1786ad={'class':'ck-user__marker\x20'+_0x19d843['color']['getMarkerClass'](),'data-name':_0x19d843['name'],'data-session-id':_0x432bd5},_0x4b7e21=_0x5f3a49['model']['markers']['get'](_0x517f3a['markerName']),_0x1bf43c=_0x4b7e21['getStart'](),_0x335b0e=_0x1bf43c['nodeAfter'],_0x523700=_0x5f3a49['model']['schema'];if(_0x335b0e&&_0x523700['isObject'](_0x335b0e)&&_0x523700['isInline'](_0x335b0e)&&!_0x5f3a49['model']['markers']['get']('user:range:'+_0x432bd5)['getRange']()['isCollapsed'])return;const _0x54ec89=_0x1bf43c['parent'];return _0x5f3a49['model']['schema']['isLimit'](_0x54ec89)&&!_0x5f3a49['model']['hasContent'](_0x54ec89)&&(_0x1786ad['contenteditable']=!0x1),function(_0x15859e,_0x3c6d29,_0x1689a0){const _0x3bc2c7=_0x15859e['createUIElement']('span',_0x3c6d29);return _0x15859e['setCustomProperty']('userPositionMarker',!0x0,_0x3bc2c7),_0x3bc2c7['render']=function(_0x23a1d9){const _0x267318=this['toDomElement'](_0x23a1d9),_0x5dc2ec=document['createElement']('span');return _0x5dc2ec['classList']['add']('ck-user__marker-tooltip'),_0x5dc2ec['setAttribute']('contenteditable','false'),_0x5dc2ec['setAttribute']('spellcheck','false'),_0x5dc2ec['textContent']=_0x1689a0['name'],_0x267318['innerHTML']='<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span>'+_0x5dc2ec['outerHTML']+'',_0x267318['addEventListener']('mouseenter',()=>{_0x267318['classList']['add']('ck-user__marker_hovered');}),_0x267318['addEventListener']('mouseleave',()=>{_0x267318['classList']['remove']('ck-user__marker_hovered');}),_0x267318;},_0x3bc2c7['isSimilar']=function(_0x12c209){return!(!this['getCustomProperty']('userPositionMarker')||!_0x12c209['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0x12c209['getAttribute']('data-session-id'));},_0x3bc2c7;}(_0x14b644,_0x1786ad,_0x19d843);}(_0x4faac8,_0x4b67bf,_0x39ea3f,_0xba1f96)}),_0xba1f96['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0x448d36=>function(_0x43051e,_0x179718){const _0x58cb91=_0x43051e['markerName']['split'](':')[0x2];if(_0x58cb91===_0x179718['mySessionId'])return null;const _0x56898e=_0x179718['getUserBySessionId'](_0x58cb91);if(!_0x56898e)return{'id':_0x58cb91,'classes':[]};return{'id':_0x58cb91,'classes':['ck-user__selection',_0x56898e['color']['getSelectionClass']()],'attributes':{'data-session-id':_0x58cb91},'priority':0x7d0+_0x56898e['orderNumber']};}(_0x448d36,_0x39ea3f)}),function(_0x4616d1){const _0x60b144=_0x4616d1['model'],_0x4f951a=new Map(),_0x19ccfd=_0x4616d1['plugins']['get'](i);_0x60b144['markers']['on']('update:user:range',(_0x59d7da,_0x55783d,_0x15b5a7,_0x2a71d5)=>{if(!_0x2a71d5&&_0x4f951a['get'](_0x55783d['name']))return _0x4f951a['get'](_0x55783d['name'])['detach'](),void _0x4f951a['delete'](_0x55783d['name']);const _0x25b8eb=_0x55783d['name']['split'](':')[0x2];if(_0x25b8eb===_0x19ccfd['mySessionId'])return;const _0x20e2da='user:position:'+_0x25b8eb;_0x60b144['markers']['has'](_0x20e2da)&&_0x4616d1['editing']['reconvertMarker'](_0x20e2da),_0x55783d['on']('change:range',(_0x2f2e3f,_0xf345fd,_0x2115c9)=>{if('$graveyard'!=_0xf345fd['root']['rootName']&&'$graveyard'==_0x55783d['getRange']()['root']['rootName']&&!_0x4f951a['has'](_0x55783d['name'])){const _0x327a98=_0x60b144['schema']['getNearestSelectionRange'](_0x2115c9['deletionPosition']);if(_0x327a98){const _0x3b6f99=ht['fromRange'](_0x327a98);_0x4f951a['set'](_0x55783d['name'],_0x3b6f99),_0x3b6f99['on']('change:range',(_0x474ced,_0x54fdb4,_0x129ba2)=>{if('$graveyard'==_0x3b6f99['root']['rootName']){const _0x285c40=_0x60b144['schema']['getNearestSelectionRange'](_0x129ba2['deletionPosition']);_0x285c40?(_0x3b6f99['start']=_0x285c40['start'],_0x3b6f99['end']=_0x285c40['end']):(_0x4f951a['delete'](_0x55783d['name']),_0x3b6f99['detach']());}});}}});}),_0x60b144['document']['on']('change',()=>{_0x4f951a['size']>0x0&&_0x60b144['enqueueChange']({'isUndoable':!0x1},_0x35347c=>{for(const [_0x231203,_0x58ca12]of _0x4f951a)'$graveyard'==_0x60b144['markers']['get'](_0x231203)['getRange']()['root']['rootName']&&(te(_0x231203['split'](':')[0x2],_0x58ca12['toRange'](),_0x60b144,_0x35347c),_0x58ca12['detach']());_0x4f951a['clear']();});});}(_0xba1f96),this['_domEmitter']['listenTo'](_0xeaa953['document'],'keydown',(_0x2008b8,{key:_0x272cda})=>{'Escape'===_0x272cda&&function(_0x113532){_0x113532['editing']['view']['change'](_0x39fee4=>{for(const _0x5163ee of _0x113532['model']['markers']){if(!_0x5163ee['name']['startsWith']('user:position'))continue;const _0x172148=_0x113532['editing']['mapper']['markerNameToElements'](_0x5163ee['name']);if(_0x172148){for(const _0x5ed200 of _0x172148)_0x39fee4['removeClass']('ck-user__marker_hovered',_0x5ed200);}}});}(_0xba1f96);},{'useCapture':!0x0});}['afterInit'](){const _0x5e97c7=this['editor'],_0x5b5a5d=_0x5e97c7['commands']['get']('undo');_0x5b5a5d&&_0x5e97c7['model']['on']('applyOperation',(_0x33c862,_0x1d1212)=>{const _0x2ffd54=_0x1d1212[0x0];if(!_0x2ffd54['isDocumentOperation'])return;if('marker'!=_0x2ffd54['type']||!_0x2ffd54['name']['startsWith']('user:'))return;const _0x1a513b=_0x2ffd54['batch'];_0x5b5a5d['_createdBatches']['has'](_0x1a513b)&&(_0x2ffd54['newRange']=_0x2ffd54['oldRange']?_0x5e97c7['model']['createRange'](_0x2ffd54['oldRange']['start'],_0x2ffd54['oldRange']['end']):null);},{'priority':'highest'});}['destroy'](){return this['_domEmitter']['stopListening'](),super['destroy']();}['createUserMarkerOperations'](){const _0x3019ee=this['editor'],_0x491390=_0x3019ee['model']['document'],_0x83808b=_0x3019ee['plugins']['get'](i);_0x3019ee['model']['enqueueChange']({'isUndoable':!0x1},_0x203c71=>{const _0xc0760='user:range:'+_0x83808b['mySessionId'],_0x539f0a='user:position:'+_0x83808b['mySessionId'],_0x1512f1=_0x3019ee['model']['markers']['has'](_0xc0760);_0x3019ee['editing']['view']['hasDomSelection']?te(_0x83808b['mySessionId'],_0x491390['selection']['getFirstRange'](),_0x3019ee['model'],_0x203c71):_0x1512f1&&(_0x203c71['removeMarker'](_0xc0760),_0x203c71['removeMarker'](_0x539f0a));});}}function te(_0x12b5c1,_0x7c1765,_0x1ea0ed,_0x47787c){const _0x36df13='user:range:'+_0x12b5c1,_0xeeb566='user:position:'+_0x12b5c1,_0x3df595=_0x7c1765['getContainedElement']();let _0x5182ee=_0x7c1765['start'];_0x3df595&&_0x3df595['is']('element','tableCell')&&(_0x5182ee=function(_0x1f925c,_0x27608d){for(const _0xd5a17c of _0x1f925c['getPositions']())if(_0x27608d['schema']['checkChild'](_0xd5a17c,'$text'))return _0xd5a17c;}(_0x7c1765,_0x1ea0ed),_0x7c1765=_0x47787c['createRange'](_0x5182ee));const _0x1b21b7=_0x47787c['createRange'](_0x5182ee);_0x1ea0ed['markers']['has'](_0x36df13)?(_0x47787c['updateMarker'](_0x36df13,{'range':_0x7c1765}),_0x47787c['updateMarker'](_0xeeb566,{'range':_0x1b21b7})):(_0x47787c['addMarker'](_0x36df13,{'range':_0x7c1765,'usingOperation':!0x0}),_0x47787c['addMarker'](_0xeeb566,{'range':_0x1b21b7,'usingOperation':!0x0}));}function G(_0x248604,_0x428b52,_0x4e2d5d){const _0x1d0d93=_0x248604['t'],t=_0x248604['t'];switch(_0x428b52){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 _0x1d0d93({'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'},_0x4e2d5d);default:return'';}}let J=0x1;class l extends _0x58ccc3{static ['CollaborativeEditingService']=/* #__PURE__ -- @preserve */
|
|
25
|
-
((()=>_0x239c9f)());['_offset'];['sessionId'];['serverHistory'];['_channelId'];['_service'];['_document'];['_compressor'];['_bufferedOperations'];['_knownOperations'];['_knownRootNames'];['_pendingAction'];['_hasSelectionChanged'];['_sendBufferedOperationsDelayId'];['_baseBufferDelay'];['_currentBufferDelay'];['_lastSyncedOperationId'];['_disconnectionOperations'];['_operationIdentifier'];static get['requires'](){return[c,i,q,_0x507fb3,_0x398766,_0x445d56];}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 _0x5e25ab=this['serverHistory']['getOperations']();for(let _0x1ec99a=_0x5e25ab['length']-0x1;_0x1ec99a>=0x0;_0x1ec99a--){const _0x5b96d4=_0x5e25ab[_0x1ec99a];if(!this['_disconnectionOperations']['has'](_0x5b96d4))return _0x5b96d4['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0x2663b6){if(super(_0x2663b6),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x7e212a(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0x71c4af('collaboration-missing-channelid',this);const _0x282703=_0x2663b6['config']['get']('cloudServices.bundleVersion')||nt;this['_service']=new l['CollaborativeEditingService'](_0x282703,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0x4dd3cc(),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 Y(this['_disconnectionOperations']);}['init'](){const _0x357408=this['editor'],_0x2fb0eb=_0x357408['plugins']['get'](_0x398766),_0x200691=_0x357408['plugins']['get'](c);this['listenTo'](_0x2fb0eb,'getOperationAuthor',(_0x3a95b1,_0x3a18f9)=>{const _0x46659a=_0x3a18f9[0x0];_0x46659a['_authorId']&&(_0x3a95b1['return']=_0x2fb0eb['getUser'](_0x46659a['_authorId']),_0x3a95b1['stop']()),null===_0x46659a['_authorId']&&(_0x3a95b1['return']=null,_0x3a95b1['stop']());},{'priority':'high'}),this['listenTo'](_0x357408['model']['document']['selection'],'change:range',(_0x5e0175,_0x1eb7f5)=>{_0x1eb7f5['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x357408['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x357408['model']['on']('applyOperation',(_0xdec675,_0x21f989)=>{const _0x16809a=_0x21f989[0x0];_0x16809a['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0x16809a),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['bind']('_isEditingAllowed')['to'](_0x200691,'state',this,'_hasSynchronizationProblem',(_0x53eddb,_0x12450c)=>'connected'===_0x53eddb&&!_0x12450c),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x357408['disableReadOnlyMode']('rtc-offline'):_0x357408['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x357408['disableReadOnlyMode']('rtc-offline'):_0x357408['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async['reconnect'](){const _0x444cfb=this['editor']['plugins']['get'](i),_0x1f2010=this['editor']['plugins']['get'](c);try{this['_isPendingUpdate']=!0x0,_0x444cfb['unregister'](this['_channelId']);const _0x75a1b1=await this['_service']['reconnect'](_0x1f2010['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0x75a1b1)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x309724=await this['_service']['getConnectedSessions']();_0x444cfb['register'](this['_channelId'],_0x309724),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x197b09){if(function(_0x43eb1a){return'404'===_0x43eb1a['code'];}(_0x197b09)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0x699029){return'409'===_0x699029['code'];}(_0x197b09)){const _0x53512c=G(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'](_0x53512c);}else{if(!(_0x197b09 instanceof Q))throw _0x197b09;this['_handleReconnectionError']();}}}}['destroy'](){const _0x3c5ddd=this['editor']['plugins']['get'](c),_0x1c669e=this['editor']['plugins']['get'](i);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x1c669e['channelSessions']['has'](this['_channelId'])&&_0x1c669e['unregister'](this['_channelId']),_0x3c5ddd['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async['_handleReconnectionResponse'](_0x13b2c3){if(this['sessionId']!==_0x13b2c3['sessionId']&&this['_lastSyncedOperationId']!==_0x13b2c3['lastOperationId'])throw new Q();return this['sessionId']=_0x13b2c3['sessionId'],this['_handleServerResponse']([],{..._0x13b2c3,'wereChangesApplied':!0x1,'data':_0x13b2c3['data']},'reconnect');}async['_connectService'](_0x27350b,_0x5a811c=!0x1){const {connection:_0x15c085}=this['editor']['plugins']['get'](c);l['CollaborativeEditingService']['getConnectedSessions'](_0x15c085,this['_channelId'])['then'](_0x26c8f6=>this['_initSessionsHandling'](_0x26c8f6))['catch'](_0x1e2ab9=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x1e2ab9);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x3ba7b9,_0x1e8d2a)=>{this['_crash']('realtimecollaborationclient-init-service-internal-error',_0x1e8d2a);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_isConnected']=!0x1;});const _0x52ae15=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x27350b);this['_isPendingUpdate']=!0x0;const _0x21c969=await this['_service']['connect'](_0x15c085,this['_compressOperations'](_0x27350b),_0x52ae15);if(this['sessionId']=_0x21c969['sessionId'],_0x5a811c){if(!_0x21c969['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x21c969['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0x27350b,_0x21c969,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x21c969,_0x27350b);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}['_handleSendingSelectionMarkers'](){const _0x4f5637=this['editor']['plugins']['get'](i),_0x588919=this['editor']['plugins']['get'](q),_0x57bec1=_0x4f5637['channelSessions']['get'](this['_channelId']);_0x57bec1&&_0x57bec1['length']>0x1?_0x588919['createUserMarkerOperations']():this['listenTo'](_0x4f5637,'sessionAdd:'+this['_channelId'],()=>{0x2===_0x4f5637['channelSessions']['get'](this['_channelId'])['length']&&_0x588919['createUserMarkerOperations']();});}async['_handleReceivedOperations'](_0x221be0,_0x1e732c,_0x3301ab,_0xc7ce27){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x1e732c){const _0x27453a=this['_decompressOperations'](_0x3301ab,_0xc7ce27);await this['_fetchMissingUsers'](_0x27453a),this['_handleExternalOperations'](_0x27453a,_0x1e732c,_0x3301ab['lastOperationId'])||this['_crash']('realtimecollaborationclient-init-service-incorrect-server-operation');}}async['_connectAfterSessionHasBeenFlushed'](){this['_disconnectService']();const {locale:_0xb75d6}=this['editor'];let _0x9f8c85;try{_0x9f8c85=await this['_service']['getDocumentDetails']();}catch(_0x50cfd3){const _0x5991c9=G(_0xb75d6,'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'](_0x5991c9);}const _0x14c043=_0x9f8c85['currentDocumentSession']||_0x9f8c85['lastDocumentSession'];if(this['_lastSyncedOperationId']===_0x14c043['lastOperationId'])await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);else{const _0x543ada=G(_0xb75d6,'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.');this['_handleReconnectionError'](_0x543ada);}}['_disconnectService'](){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['stopListening'](this['_service']);}['_initSessionsHandling'](_0x3622d9){const _0x2b5286=this['editor']['plugins']['get'](i);this['listenTo'](_0x2b5286,'sessionAdd:'+this['_channelId'],(_0x5127d1,{session:_0x412aba})=>{if(_0x412aba['id']===_0x2b5286['mySessionId']){_0x5127d1['off']();const _0x5a6a95=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0x18c0c2=_0x412aba['permissions'];_0x5a6a95&&_0x5a6a95['isEnabled']&&(_0x18c0c2=_0x18c0c2['filter'](_0x194373=>'document:write'!==_0x194373)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0x18c0c2,this['_channelId']);}}),_0x2b5286['register'](this['_channelId'],_0x3622d9);}['_initThrowingOnDataSet'](){const _0x3f244a=this['editor']['data']['set'];this['editor']['data']['set']=(..._0x3c3fb5)=>{if(!_0x3c3fb5[_0x3c3fb5['length']-0x1]['suppressErrorInCollaboration'])throw new _0x71c4af('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x3f244a['apply'](this['editor']['data'],_0x3c3fb5);};}['_setUpDataInit'](){this['editor']['data']['on']('init',(_0x46b628,[_0x479182])=>{if(this['_document']['version'])throw new _0x71c4af('realtimecollaborationclient-init-document-already-initialized',this);_0x46b628['stop'](),this['_setPendingAction']();const _0x462528=this['editor']['config']['get']('rootsAttributes'),_0x505bcf=this['_getOperationsFromInitData'](_0x479182,_0x462528);0x0==_0x505bcf['length']&&_0x505bcf['push'](new _0x29c09c(0x0)),_0x46b628['return']=this['_connectService'](_0x505bcf)['then'](()=>{this['editor']['plugins']['get'](c)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x4cd715=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x4cd715))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x36f350,[_0x57fa7e,_0x587618])=>{_0x36f350['stop']();const _0x45c8fa=this['editor']['model']['document']['getRoot'](_0x57fa7e);if(!this['_knownRootNames']['has'](_0x57fa7e)){const _0x198f6e=_0x587618&&_0x587618['data']?_0x587618['data']:'',_0x242517=_0x587618&&_0x587618['attributes']?_0x587618['attributes']:{};await this['_loadRoot'](_0x57fa7e,_0x198f6e,_0x242517);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0x45c8fa['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0x45c8fa);});},{'priority':'high'});}async['_fetchMissingUsers'](_0x123cf1){const _0x3c3276=this['editor']['plugins']['get'](_0x398766),{connection:_0x594ebd}=this['editor']['plugins']['get'](c),_0x3971c7=new Set();for(const _0x7284a3 of _0x123cf1){const _0x1c5a29=_0x7284a3['_authorId'];_0x1c5a29&&!_0x3c3276['getUser'](_0x1c5a29)&&_0x3971c7['add'](_0x1c5a29);}if(0x0===_0x3971c7['size'])return;const _0x1f3944=await dt['getMany'](_0x594ebd,Array['from'](_0x3971c7));for(const _0x39d9f6 of _0x1f3944)_0x3c3276['getUser'](_0x39d9f6['id'])||_0x3c3276['addUser'](_0x39d9f6);}['_getOperationsFromInitData'](_0x4a4519,_0x17c6ac={}){const _0xbf3fce=this['editor']['model'],_0x4c7ea0=[];let _0x2c8ef8=0x0;const _0x529d57='string'==typeof _0x4a4519?{'main':_0x4a4519}:_0x4a4519;for(const _0x4d9201 of Object['keys'](_0x529d57)){if(!this['_document']['roots']['has'](_0x4d9201))throw new _0x71c4af('realtimecollaborationclient-init-non-existent-root',this);const _0x200160=this['editor']['data']['parse'](_0x529d57[_0x4d9201]),_0x1d19b5=this['_document']['getRoot'](_0x4d9201),_0x12ce6c=new _0xd86e04(_0xbf3fce['createPositionAt'](_0x1d19b5,0x0),_0x200160,_0x2c8ef8++);_0x4c7ea0['push'](_0x12ce6c);for(const [_0x3b27b5,_0x339b65]of _0x200160['markers']){const _0x40ac03=_0xbf3fce['createRange'](_0xbf3fce['createPositionFromPath'](_0x1d19b5,_0x339b65['start']['path']['slice']()),_0xbf3fce['createPositionFromPath'](_0x1d19b5,_0x339b65['end']['path']['slice']())),_0x537289=new _0x42fab9(_0x3b27b5,null,_0x40ac03,_0xbf3fce['markers'],!0x0,_0x2c8ef8++);_0x4c7ea0['push'](_0x537289);}}if(_0x17c6ac)for(const [_0x38328b,_0x130e1c]of Object['entries'](_0x17c6ac)){const _0x2efe5f=_0xbf3fce['document']['getRoot'](_0x38328b);if(!_0x2efe5f)throw new _0x71c4af('multi-root-editor-root-attributes-no-root',null);for(const [_0x2fee53,_0x71a354]of Object['entries'](_0x130e1c))if(null!==_0x71a354){const _0x3fed00=new _0x22d82a(_0x2efe5f,_0x2fee53,null,_0x71a354,_0x2c8ef8++);_0x4c7ea0['push'](_0x3fed00);}}return _0x4c7ea0;}async['_loadRoot'](_0x457e89,_0xfbf1aa,_0x2ec836){this['_getOperationsFromInitData']({[_0x457e89]:_0xfbf1aa},{[_0x457e89]:_0x2ec836})['forEach']((_0x52fa29,_0x5b8e82)=>{_0x52fa29['baseVersion']=this['_document']['version']+_0x5b8e82,_0x52fa29['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x52fa29);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async['_handleInitialConnectionData'](_0x5d0e71,_0x4a924c){let _0x5956d4;this['_offset']=_0x5d0e71['offset'];const _0x36dc85=_0x5d0e71['wereChangesApplied']&&!_0x5d0e71['initData'],_0x55adef=_0x36dc85?0x0:_0x5d0e71['data']['baseVersion'];if(_0x4a924c['forEach'](_0x38a739=>{_0x38a739['_isInit']=!0x0,_0x38a739['createdAt']=_0x5d0e71['sessionCreatedAt'],_0x38a739['_authorId']=null;}),_0x36dc85)_0x5956d4=_0x4a924c,this['_applyOperationsSet'](_0x5956d4,_0x36dc85);else{if(_0x5d0e71['initData']){const _0x2a6442=this['_getOperationsFromInitData'](_0x5d0e71['initData']);this['_document']['history']['version']=-_0x2a6442['length'],_0x2a6442['forEach'](_0x109ad4=>{_0x109ad4['baseVersion']-=_0x2a6442['length'],_0x109ad4['createdAt']=_0x5d0e71['sessionCreatedAt'],_0x109ad4['_isInit']=!0x0,_0x109ad4['_authorId']=null;}),this['_applyOperationsSet'](_0x2a6442,!0x0),this['serverHistory']['version']=-_0x2a6442['length']+this['_offset'],this['_updateServerHistory'](_0x2a6442);}this['_document']['history']['version']=_0x55adef,_0x5956d4=this['_decompressOperations'](_0x5d0e71['data'],_0x5d0e71['metadata']),await this['_fetchMissingUsers'](_0x5956d4),this['_applyOperationsSet'](_0x5956d4,_0x36dc85);}_0x5d0e71['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x5956d4,_0x5d0e71['lastOperationId']),this['_lastSyncedOperationId']=_0x5d0e71['lastOperationId']),this['serverHistory']['version']=_0x55adef+this['_offset'],this['_updateServerHistory'](_0x5956d4),_0x4a924c['filter'](_0x2e23f8=>{const _0x494afc=this['_getAffectedRoot'](_0x2e23f8);return _0x494afc&&!this['_knownRootNames']['has'](_0x494afc);})['forEach']((_0x5a07dd,_0x1e108d)=>{_0x5a07dd['baseVersion']=this['_document']['version']+_0x1e108d,this['_saveOperationInBuffer'](_0x5a07dd);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x1ebfac,_0x48217a){const _0xc1b065=_0x48217a&&_0x48217a['message'];if(_0xc1b065&&_0xc1b065['startsWith']('realtimecollaborationclient'))throw _0x48217a;const _0x2f1495=this['editor']['plugins']['get'](c);throw this['_isPendingUpdate']=!0x0,_0x2f1495['disconnect'](),this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0x71c4af(_0x1ebfac,this['editor'],_0xc1b065?{'originalError':_0xc1b065}:void 0x0);}['_saveOperationInBuffer'](_0x93e899){this['_knownOperations']['has'](_0x93e899)||(this['_knownOperations']['add'](_0x93e899),this['_bufferedOperations']['push'](_0x93e899),this['_pendingAction']||'marker'==_0x93e899['type']&&!_0x93e899['affectsData']||this['_setPendingAction']());}['_sendBufferedOperationsDelayed'](_0x251144=!0x1){!_0x251144&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0x39506e=>{_0x39506e&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0x68956c=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0x3c9295){return _0x3c9295['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x3c9295['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0x3c9295['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0x68956c)||this['_crash'](_0x68956c['message'],_0x68956c);});},this['_currentBufferDelay']));}['_waitUntilSynced'](){return new Promise(_0x33f634=>{this['on']('change:_isPendingUpdate',()=>{_0x33f634();});});}async['_sendBufferedOperations'](){const _0xce202d=this['editor']['plugins']['get'](q);if(this['_shouldSendSelectionUpdate']()&&(_0xce202d['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x1064fb=[...this['_bufferedOperations']];for(const _0x325480 of _0x1064fb)_0x325480['wasUndone']=this['_document']['history']['isUndoneOperation'](_0x325480);const _0x45a61a=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x1064fb),_0x4112a6=J++,_0x4abe46=this['_compressOperations'](_0x1064fb),_0xa76f4f=await this['_service']['sendOperations'](_0x4abe46,_0x4abe46['baseVersion'],_0x45a61a);try{return await this['_handleServerResponse'](_0x1064fb,_0xa76f4f,_0x4112a6);}catch(_0x4e7a25){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0x4e7a25);}}async['_handleServerResponse'](_0x2dc75c,_0xd58c4d,_0x425342){if('error'in _0xd58c4d)throw _0xd58c4d['error'];let _0x4e4490=!0x1;if(_0xd58c4d['wereChangesApplied']){_0xd58c4d['lastOperationId']&&(this['_lastSyncedOperationId']=_0xd58c4d['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x58c0bb=>!_0x2dc75c['includes'](_0x58c0bb));for(const _0x23bb2f of _0x2dc75c)_0x23bb2f['createdAt']='lastOperationAcceptedAt'in _0xd58c4d&&_0xd58c4d['lastOperationAcceptedAt']||void 0x0;X(_0x2dc75c,_0xd58c4d['version']-_0x2dc75c['length']),this['_updateServerHistory'](_0x2dc75c);const _0x42425c=_0x2dc75c['filter'](_0x2ae147=>{if(!_0x2ae147['_isInit'])return!0x1;const _0x5aedbe=this['_getAffectedRoot'](_0x2ae147);return _0x5aedbe&&!this['_knownRootNames']['has'](_0x5aedbe);});X(_0x42425c,this['_document']['version']),this['_applyOperationsSet'](_0x42425c),_0x4e4490=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0x39404d=this['_decompressOperations'](_0xd58c4d['data'],_0xd58c4d['metadata'])['filter'](_0x1c8254=>_0x1c8254['baseVersion']>=this['_lastServerVersion']);_0x39404d['forEach'](_0xc3f8d3=>this['_addKnownRoot'](_0xc3f8d3)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x2a3999=>!_0x2a3999['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x2a3999))),this['_bufferedOperations']['length']&&X(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0x39404d),_0x4e4490=this['_handleExternalOperations'](_0x39404d,_0xd58c4d['version'],_0xd58c4d['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x4e4490?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}['_handleExternalOperations'](_0x1f4d9d,_0x477e17,_0x1bad6f){try{const _0x200633={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x5e5984,operationsB:_0x173cbe,originalOperations:_0x557cbc}=_0x181f13(_0x1f4d9d,this['_bufferedOperations'],_0x200633);X(_0x5e5984,this['_document']['version']),X(_0x173cbe,_0x477e17);for(const _0x5aeeef of _0x5e5984){const _0x360f19=_0x557cbc['get'](_0x5aeeef);_0x5aeeef['_authorId']=_0x360f19?_0x360f19['_authorId']:null;}_0x1bad6f&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x1f4d9d,_0x1bad6f),this['_lastSyncedOperationId']=_0x1bad6f),this['_bufferedOperations']=[..._0x173cbe],this['_applyOperationsSet'](_0x5e5984),this['_updateServerHistory'](_0x1f4d9d);}catch(_0x4f7b43){return console['error'](_0x4f7b43),!0x1;}return!0x0;}['_applyOperationsSet'](_0x707acd,_0x1b6b65=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0x164213=>{for(const _0x3bd82a of _0x707acd)this['_knownOperations']['add'](_0x3bd82a),this['_addKnownRoot'](_0x3bd82a),_0x164213['batch']['addOperation'](_0x3bd82a),this['editor']['model']['applyOperation'](_0x3bd82a);});}['_addKnownRoot'](_0x3d8390){const _0x27feb7=this['_getAffectedRoot'](_0x3d8390);_0x27feb7&&this['_knownRootNames']['add'](_0x27feb7);}['_getAffectedRoot'](_0x447694){let _0x18c464,_0x225c31;switch(_0x447694['type']){case'insert':_0x18c464=_0x447694['position']['root'];break;case'marker':if(_0x225c31=_0x447694['newRange'],!_0x225c31)return null;_0x18c464=_0x225c31['root'];break;case'addRootAttribute':_0x18c464=_0x447694['root'];break;case'addRoot':_0x18c464=_0x447694['affectedSelectable'];break;case'move':_0x18c464=_0x447694['targetPosition']['root'];break;default:return null;}return _0x18c464['rootName'];}['_updateServerHistory'](_0x52c653){_0x52c653['forEach'](_0xdbefcf=>{const _0x3eab36=_0xdbefcf['clone']();_0x3eab36['_authorId']=_0xdbefcf['_authorId'],_0x3eab36['_isInit']=!!_0xdbefcf['_isInit'],_0x3eab36['createdAt']=_0xdbefcf['createdAt'],_0x3eab36['baseVersion']+=this['_offset'],_0xdbefcf['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x3eab36),this['serverHistory']['addOperation'](_0x3eab36);});}['_handleReconnectionError'](_0x5109ad){const _0x34be39=this['editor']['plugins']['get']('Notification'),_0x3cb9fe=this['editor']['locale'];_0x5109ad||(_0x5109ad=G(_0x3cb9fe,'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.')),_0x34be39['showWarning'](_0x5109ad,{'title':G(_0x3cb9fe,'Synchronization\x20issue'),'namespace':'real-time-collaboration'}),this['_hasSynchronizationProblem']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_bufferedOperations']=[],this['editor']['plugins']['get'](c)['disconnect']();}['_setPendingAction'](){this['_pendingAction']||(this['_pendingAction']=this['editor']['plugins']['get'](_0x507fb3)['add'](G(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}['_clearPendingAction'](){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x507fb3)['remove'](this['_pendingAction']),this['_pendingAction']=null);}['_compressOperations'](_0x3d7710){const _0x554f0e=_0x3d7710['map'](_0x66ca56=>_0x66ca56['toJSON']());return this['_compressor']['compress'](_0x554f0e);}['_decompressOperations'](_0x482301,_0x4fd359){return this['_compressor']['decompress'](_0x482301)['map']((_0x116827,_0x191575)=>{const _0x548c7c='init'==_0x4fd359[_0x191575]['type'];if('InsertOperation'==_0x116827['__className']){const _0x4c4af6=_0x116827['position']['root'];!this['_document']['getRoot'](_0x4c4af6)&&(this['_document']['createRoot']('$root',_0x4c4af6)['_isAttached']=!0x1);}const _0x59892c=_0x498110['fromJSON'](_0x116827,this['_document']);return _0x59892c['wasUndone']=_0x116827['wasUndone'],_0x59892c['_isInit']=_0x548c7c,_0x59892c['_authorId']=_0x548c7c?null:_0x4fd359[_0x191575]['userId'],_0x59892c['_isDisconnection']='cs:removeUser'===_0x4fd359[_0x191575]['type'],_0x59892c['createdAt']=_0x4fd359[_0x191575]['createdAt'],_0x59892c;});}['_refreshUserSelectionMarkers'](){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}['_shouldSendSelectionUpdate'](){const _0x5e7047=this['editor']['plugins']['get'](i)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0x5e7047&&_0x5e7047['length']>0x1&&this['_hasSelectionChanged'];}['_shouldSendUpdate'](){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}}class Q extends Error{}function X(_0x323346,_0xf1caa9){for(const _0x55148e of _0x323346)_0x55148e['baseVersion']=_0xf1caa9++;}class Y{['_ignoredOperations'];['_operationToId'];constructor(_0x44467d){this['_ignoredOperations']=_0x44467d,this['_operationToId']=new WeakMap();}['getIdOfTheLastOperation'](_0x1feab6){let _0x552a43=_0x1feab6['length'];for(;_0x552a43--;){const _0xae01cb=_0x1feab6[_0x552a43];if(!this['_ignoredOperations']['has'](_0xae01cb)){if(!this['_operationToId']['has'](_0xae01cb)){const _0x517313=_0x5048e5()['slice'](0x1,0x12);this['_operationToId']['set'](_0xae01cb,_0x517313);}return this['_operationToId']['get'](_0xae01cb);}}}['setIdForTheLastOperation'](_0x330762,_0x30c732){if(!_0x30c732)return;let _0x418814=_0x330762['length'];for(;_0x418814--;){const _0x5158e8=_0x330762[_0x418814];this['_ignoredOperations']['has'](_0x5158e8)||this['_operationToId']['set'](_0x5158e8,_0x30c732);}}}class n extends _0x58ccc3{static get['requires'](){return[l];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class a extends _0x51d4ec{static ['CommentsService']=/* #__PURE__ -- @preserve */
|
|
26
|
-
((()=>_0x1c305a)());['_services'];static get['requires'](){return[c,'CommentsRepository',i,_0x398766];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0xc67fe7){super(_0xc67fe7),this['_services']=new Map();}async['init'](){const _0x4cacc1=this['context'],_0x5209d5=_0x4cacc1['plugins']['get']('CommentsRepository');if(_0x4cacc1['plugins']['get'](c)['addToReconnectionStack'](this),_0x5209d5['adapter']={'addCommentThread':async({channelId:_0x114951,threadId:_0x1142aa,comments:_0x53f790,resolvedAt:_0x1dcc71,resolvedBy:_0x25c0b7,context:_0x4dd5b9,attributes:_0x5bd2be})=>{const _0x4c0d73=await this['_getService'](_0x114951)['addCommentThread']({'commentThreadId':_0x1142aa,'comments':_0x53f790['map'](_0x1ffa1b=>function(_0x2acd81,_0x10af58,_0x3167d8){return{'commentThreadId':_0x3167d8,'commentId':_0x2acd81['commentId'],'userId':_0x2acd81['authorId'],'content':_0x2acd81['content'],'documentId':_0x10af58,'createdAt':_0x2acd81['createdAt'],'attributes':_0x2acd81['attributes']||{}};}(_0x1ffa1b,_0x114951,_0x1142aa)),'resolvedAt':_0x1dcc71,'resolvedBy':_0x25c0b7,'context':_0x4dd5b9,'attributes':_0x5bd2be})['catch'](ut);return{'threadId':_0x4c0d73['commentThreadId'],'comments':_0x4c0d73['comments']};},'getCommentThread':async({channelId:_0x3a0e4d,threadId:_0x59da27})=>{const _0x2d5d6f=await this['_getService'](_0x3a0e4d)['getCommentThread'](_0x59da27)['catch'](ut);return _0x2d5d6f['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0x2d5d6f]),{'threadId':_0x2d5d6f['commentThreadId'],'comments':_0x2d5d6f['comments']['map'](_),'context':_0x2d5d6f['context'],'resolvedAt':_0x2d5d6f['resolvedAt'],'resolvedBy':_0x2d5d6f['resolvedBy'],'attributes':_0x2d5d6f['attributes']||{}});},'updateCommentThread':async({channelId:_0x5129b6,threadId:_0x3566aa,context:_0x10727f,unlinkedAt:_0x1b7161,attributes:_0x266195})=>this['_getService'](_0x5129b6)['updateCommentThread']({'commentThreadId':_0x3566aa,'context':_0x10727f,'attributes':_0x266195,'unlinkedAt':_0x1b7161})['catch'](S)['catch'](ut),'resolveCommentThread':async({channelId:_0x1cfad4,threadId:_0x51b2af})=>{const _0x4ba0ab=await this['_getService'](_0x1cfad4)['resolveCommentThread'](_0x51b2af)['catch'](S)['catch'](ut);return{'threadId':_0x4ba0ab['commentThreadId'],'resolvedAt':_0x4ba0ab['resolvedAt'],'resolvedBy':_0x4ba0ab['resolvedBy']};},'reopenCommentThread':async({channelId:_0x32bf9b,threadId:_0x5115e2})=>this['_getService'](_0x32bf9b)['reopenCommentThread'](_0x5115e2)['catch'](S)['catch'](ut),'removeCommentThread':({channelId:_0x42e5ca,threadId:_0x4db8d3})=>this['_getService'](_0x42e5ca)['removeCommentThread'](_0x4db8d3)['catch'](S)['catch'](ut),'addComment':({channelId:_0x5971ad,threadId:_0x10edb4,commentId:_0x5af7e5,content:_0x42b49b,attributes:_0x58ea69})=>this['_getService'](_0x5971ad)['addComment'](_0x10edb4,_0x5af7e5,_0x42b49b,_0x58ea69)['catch'](ut),'updateComment':({channelId:_0x555831,threadId:_0x41233c,commentId:_0x16fa10,content:_0x53d075,attributes:_0x343def})=>this['_getService'](_0x555831)['updateComment'](_0x41233c,_0x16fa10,_0x53d075,_0x343def)['catch'](S)['catch'](ut),'removeComment':({channelId:_0x4c011c,threadId:_0x52d2bb,commentId:_0xb33741})=>this['_getService'](_0x4c011c)['removeComment'](_0x52d2bb,_0xb33741)['catch'](S)['catch'](ut)},_0x4cacc1 instanceof _0x5ee6a1){const _0x1e35b9=_0x4cacc1['config']['get']('collaboration.channelId'),_0xda3b37=_0x4cacc1['plugins']['get'](i);await this['_setUpService'](_0x1e35b9);const _0x4b6466=await this['_services']['get'](_0x1e35b9)['getConnectedSessions']();this['listenTo'](_0xda3b37,'sessionAdd:'+_0x1e35b9,(_0x1ecd93,{session:_0x5702b9})=>{_0x5702b9['id']===_0xda3b37['mySessionId']&&(_0x1ecd93['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x5702b9['permissions'],_0x1e35b9));}),_0xda3b37['register'](_0x1e35b9,_0x4b6466);}}async['_setUpService'](_0x40de82){if(this['_services']['has'](_0x40de82))throw new _0x71c4af('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0x40de82});const _0x2b815c=this['context']['plugins']['get']('CommentsRepository'),_0x3767df=new a['CommentsService'](_0x40de82);this['_services']['set'](_0x40de82,_0x3767df),this['listenTo'](_0x3767df,'commentThreadAdded',(_0x149466,_0x6897ac)=>{const {commentThreadId:_0x4ad6bd,documentId:_0x18aad8,context:_0x454deb,attributes:_0x448fb5,resolvedAt:_0x346bd9,resolvedBy:_0x38412b,comments:_0x1123e1}=_0x6897ac;_0x2b815c['getCommentThread'](_0x4ad6bd)||_0x2b815c['addCommentThread']({'threadId':_0x4ad6bd,'channelId':_0x18aad8,'comments':_0x1123e1?_0x1123e1['map'](_):[],'context':_0x454deb,'attributes':_0x448fb5,'resolvedAt':_0x346bd9,'resolvedBy':_0x38412b,'isFromAdapter':!0x0});}),this['listenTo'](_0x3767df,'commentThreadUpdated',(_0x2a9b82,{commentThreadId:_0x49fd99,documentId:_0x489223,context:_0x1b7fa9,unlinkedAt:_0x2c8e55,attributes:_0x466761})=>{_0x2b815c['getCommentThread'](_0x49fd99)&&_0x2b815c['updateCommentThread']({'threadId':_0x49fd99,'channelId':_0x489223,'context':_0x1b7fa9,'unlinkedAt':_0x2c8e55,'attributes':_0x466761,'isFromAdapter':!0x0});}),this['listenTo'](_0x3767df,'commentThreadResolved',(_0x583b6d,{commentThreadId:_0x5ad1a5,resolvedBy:_0x31221b,resolvedAt:_0x385dd4})=>{const _0x4e799a=_0x2b815c['getCommentThread'](_0x5ad1a5);_0x4e799a&&_0x4e799a['resolve']({'resolvedBy':_0x31221b,'resolvedAt':_0x385dd4,'isFromAdapter':!0x0});}),this['listenTo'](_0x3767df,'commentThreadReopened',(_0x3b931d,{commentThreadId:_0x28bb70})=>{const _0x6d6a60=_0x2b815c['getCommentThread'](_0x28bb70);_0x6d6a60&&_0x6d6a60['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0x3767df,'commentThreadRemoved',(_0x1c2322,{commentThreadId:_0x1a50f9})=>{const _0x18b4c7=_0x2b815c['getCommentThread'](_0x1a50f9);_0x18b4c7&&_0x18b4c7['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0x3767df,'commentAdded',(_0x3f5a9a,_0x3abaeb)=>{const _0x409604=_0x3abaeb['commentThreadId'],_0x1b4a3b=_0x2b815c['getCommentThread'](_0x409604);_0x1b4a3b&&_0x1b4a3b['addComment']({..._(_0x3abaeb),'isFromAdapter':!0x0});}),this['listenTo'](_0x3767df,'commentUpdated',(_0x93718d,{commentThreadId:_0x2e99f4,commentId:_0x398e16,content:_0x22e2a9,attributes:_0x42e688})=>{const _0x2cd90a=_0x2b815c['getCommentThread'](_0x2e99f4);if(_0x2cd90a){const _0x1a55b8=_0x2cd90a['getComment'](_0x398e16);_0x1a55b8&&_0x1a55b8['update']({'content':_0x22e2a9,'attributes':_0x42e688,'isFromAdapter':!0x0});}}),this['listenTo'](_0x3767df,'commentRemoved',(_0x3fe88f,{commentThreadId:_0x109000,commentId:_0x91627f})=>{const _0x5c50fb=_0x2b815c['getCommentThread'](_0x109000);if(_0x5c50fb){const _0x19bdf9=_0x5c50fb['getComment'](_0x91627f);_0x19bdf9&&_0x19bdf9['remove']({'isFromAdapter':!0x0});}}),await this['_connectService'](_0x40de82);}['destroy'](){if(this['context']instanceof _0x5ee6a1){const _0x2bc3d7=this['context']['config']['get']('collaboration.channelId');this['_terminateService'](_0x2bc3d7);}}['_terminateService'](_0x209bc2){if(!this['_services']['has'](_0x209bc2))throw new _0x71c4af('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0x209bc2});this['_getService'](_0x209bc2)['disconnect'](),this['_services']['delete'](_0x209bc2);}async['reconnect'](){for(const _0x473dc1 of this['_services']['keys']())await this['_connectService'](_0x473dc1);if(this['context']instanceof _0x5ee6a1){const _0x1c3988=this['context']['config']['get']('collaboration.channelId'),_0x15bd52=this['context']['plugins']['get'](i);_0x15bd52['unregister'](_0x1c3988);const _0x3214ed=await this['_services']['get'](_0x1c3988)['getConnectedSessions']();_0x15bd52['register'](_0x1c3988,_0x3214ed);}}async['_connectService'](_0x389b5d){const {connection:_0x3ed790}=this['context']['plugins']['get'](c),_0x21fbe3=this['context']['plugins']['get']('CommentsRepository'),_0x1b3459=this['_services']['get'](_0x389b5d),_0x456bf9=await _0x1b3459['connect'](_0x3ed790);await this['_fetchMissingUsersForThreads'](_0x456bf9);const _0x27f1f4=new Set(Array['from'](_0x21fbe3['getCommentThreads']({'channelId':_0x389b5d}),_0x30ed10=>_0x30ed10['id']));for(const _0x16a4e5 of _0x456bf9)_0x16a4e5['deletedAt']||_0x27f1f4['delete'](_0x16a4e5['commentThreadId']);for(const _0x2c0d6c of _0x27f1f4)_0x21fbe3['getCommentThread'](_0x2c0d6c)['remove']({'isFromAdapter':!0x0});for(const _0x14189d of _0x456bf9){let _0x1c1ed8=_0x21fbe3['getCommentThread'](_0x14189d['commentThreadId']);const {commentThreadId:_0x4fe005,context:_0x593340,attributes:_0x492df1,resolvedBy:_0xfdc9f8,resolvedAt:_0x1dfe71,unlinkedAt:_0x3a13ec,deletedAt:_0x469b86}=_0x14189d;if(_0x469b86)continue;_0x1c1ed8||(_0x1c1ed8=_0x21fbe3['addCommentThread']({'channelId':_0x389b5d,'threadId':_0x4fe005,'context':_0x593340,'attributes':_0x492df1||{},'resolvedBy':_0xfdc9f8,'resolvedAt':_0x1dfe71,'unlinkedAt':_0x3a13ec,'isFromAdapter':!0x0}));const _0x5589d7=new Set(Array['from'](_0x1c1ed8['comments'],_0xe85599=>_0xe85599['id']));for(const _0x5b256d of _0x14189d['comments'])_0x5589d7['delete'](_0x5b256d['commentId']);for(const _0x31d686 of _0x5589d7)_0x1c1ed8['getComment'](_0x31d686)['remove']({'isFromAdapter':!0x0});for(const _0x1e9a93 of _0x14189d['comments']){const _0x66fde4=_0x1c1ed8['getComment'](_0x1e9a93['commentId']);_0x66fde4?_0x66fde4['content']!==_0x1e9a93['content']&&_0x66fde4['update']({'content':_0x1e9a93['content'],'isFromAdapter':!0x0}):_0x1c1ed8['addComment'](Object['assign'](_(_0x1e9a93),{'isFromAdapter':!0x0}));}}}['_getService'](_0x58eadf){if(!this['_services']['has'](_0x58eadf))throw new _0x71c4af('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0x58eadf});return this['_services']['get'](_0x58eadf);}async['_fetchMissingUsersForThreads'](_0xdd016f){const _0x5ec297=this['context']['plugins']['get'](_0x398766),{connection:_0x25412d}=this['context']['plugins']['get'](c),_0x17c4ca=new Set();for(const {resolvedBy:_0x10575d,comments:_0x311122}of _0xdd016f){_0x10575d&&!_0x5ec297['getUser'](_0x10575d)&&_0x17c4ca['add'](_0x10575d);for(const {userId:_0x278bef}of _0x311122)_0x5ec297['getUser'](_0x278bef)||_0x17c4ca['add'](_0x278bef);}if(0x0===_0x17c4ca['size'])return;const _0x329fa6=await dt['getMany'](_0x25412d,Array['from'](_0x17c4ca));for(const _0x1a11a8 of _0x329fa6)_0x5ec297['getUser'](_0x1a11a8['id'])||_0x5ec297['addUser'](_0x1a11a8);}}async function S(_0x4d9d63){if('404'!==_0x4d9d63['code'])throw _0x4d9d63;}function ut(_0x1fe025){if((_0x22d9af=_0x1fe025)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0x22d9af['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x22d9af['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0x22d9af;throw _0x1fe025;}function _(_0x3e11db){return{'threadId':_0x3e11db['commentThreadId'],'commentId':_0x3e11db['commentId'],'content':_0x3e11db['content'],'createdAt':_0x3e11db['createdAt'],'authorId':_0x3e11db['userId'],'attributes':_0x3e11db['attributes']||{}};}class f extends _0x58ccc3{static ['TrackChangesService']=/* #__PURE__ -- @preserve */
|
|
27
|
-
((()=>
|
|
28
|
-
((()=>it)());['_lastRequestId'];['_revisionTracker'];['_revisionHistoryService'];['_oldOffset'];static get['requires'](){return[c,l,'RevisionHistory',i,_0x398766];}static get['pluginName'](){return'CloudServicesRevisionHistoryAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x5078f2){super(_0x5078f2);const _0x4ea9df=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new u['RevisionHistoryService'](_0x4ea9df);}async['init'](){const _0xc3d258=this['editor']['plugins']['get'](l),_0x1eae25=_0xc3d258['serverHistory'],_0x479b8a=this['editor']['plugins']['get'](c);this['_revisionTracker']['setSource']({'history':_0x1eae25,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0xc3d258['sessionId']});const _0x5e6842=this['editor']['config']['get']('cloudServices.bundleVersion')||nt,_0x69f7d4=await tt['isBundleUploaded'](_0x479b8a['connection'],_0x5e6842);this['editor']['plugins']['get']('RevisionHistory')['adapter']={'getRevision':async({revisionId:_0xc03778})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0xc03778)),'updateRevisions':async _0x54de47=>{await this['_waitForServiceReady']();const _0x317292=this['_revisionTracker']['currentRevision'];if(_0x69f7d4&&0x1===_0x54de47['length']&&_0x54de47[0x0]['id']===_0x317292['id'])return _0x54de47;for(const _0x503a42 of _0x54de47)_0x503a42['id']===_0x317292['id']&&(_0x503a42['isEmptyCurrent']=_0x503a42['fromVersion']===_0x503a42['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0x54de47,this['_lastRequestId'])['then'](_0x3d6e65=>(this['_lastRequestId']=_0x3d6e65,_0x54de47))['catch'](_0x14624f=>{if(st(_0x14624f)||'400'===_0x14624f['code']&&void 0x0!==_0x14624f['data']['wrongRequestId']){for(const _0x5bccde of _0x54de47){!this['_revisionTracker']['repository']['getRevision'](_0x5bccde['id'])||this['_revisionTracker']['_bufferUpdate'](_0x5bccde['id'],_0x5bccde,!0x1);}if(st(_0x14624f))throw _0x14624f;return _0x54de47;}throw _0x14624f;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0x101fd2,{revisionsData:_0x599fa8,requestId:_0xad1ec3})=>{Math['max'](..._0x599fa8['map'](_0x241d05=>_0x241d05['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0x599fa8,_0xad1ec3);}):this['_handleRevisionsUpdate'](_0x599fa8,_0xad1ec3);});const {revisions:_0x3aface,requestId:_0x1c6588}=await this['_revisionHistoryService']['connect'](_0x479b8a['connection']);_0x479b8a['addToReconnectionStack'](this),this['_lastRequestId']=_0x1c6588,await this['_fetchMissingUsers'](_0x3aface);for(const _0x302bb3 of _0x3aface)this['_revisionTracker']['addRevisionData'](_0x302bb3);this['listenTo'](_0xc3d258,'change:_isConnected',(_0x593e5e,_0x5daa09,_0x5c9d81)=>{_0x5c9d81&&(this['_oldOffset']=_0xc3d258['_offset'],_0x593e5e['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](_0x479b8a,'state',_0x153fac=>_0x153fac===_0x22666b['CONNECTED']);}async['reconnect'](){const _0x348f31=this['editor']['plugins']['get'](c),_0x461c54=this['editor']['plugins']['get'](l),_0x1cd336=async()=>{const _0x2d1bcf=this['_revisionTracker']['currentRevision'],_0x52382e=_0x2d1bcf['id'],_0x57dcdf=_0x52382e!==_0x461c54['sessionId'];if(_0x57dcdf){const _0x52ddc7=_0x461c54['_offset']-this['_oldOffset'],_0x5e54a1=this['_getLatestVersionFromServerOperations']();this['_revisionTracker']['_revisionDataBuilder']['reInit']();if(_0x2d1bcf['toVersion']+_0x52ddc7!==_0x5e54a1){const _0x34eaa4=_0x2d1bcf['fromVersion']+_0x52ddc7,_0x58d134=this['editor']['plugins']['get'](_0x398766),_0x440ae8=this['_revisionTracker']['buildRevisionData']({'revision':_0x2d1bcf,'from':_0x34eaa4,'to':_0x5e54a1});_0x440ae8['id']=_0x2d1bcf['id'];const _0x26a48d=_0x440ae8['authorsIds']['map'](_0x216ec4=>_0x58d134['getUser'](_0x216ec4));_0x2d1bcf['_update']({..._0x440ae8,'authors':_0x26a48d},!0x0),this['_revisionTracker']['_bufferUpdate'](_0x2d1bcf['id'],_0x440ae8,!0x0);}this['_revisionTracker']['_startingVersion']=_0x5e54a1,(_0x2d1bcf['toVersion']===_0x2d1bcf['fromVersion']&&!this['_revisionTracker']['_bufferedUpdates']['has'](_0x52382e)&&this['_revisionTracker']['repository']['_revisions']['remove'](_0x52382e),this['_revisionTracker']['_createCurrentRevision'](_0x5e54a1));}const {revisions:_0x57bb3b,requestId:_0xfc1c16}=await this['_revisionHistoryService']['reconnect'](_0x348f31['connection'],this['_lastRequestId']);_0x57dcdf&&_0x57bb3b['length']>0x0?_0x461c54['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x57bb3b),this['_handleRevisionsUpdate'](_0x57bb3b,_0xfc1c16),this['_revisionTracker']['sendBufferedUpdates']());};return _0x461c54['_isConnected']?_0x1cd336():new Promise((_0x1d7844,_0x2c1b14)=>{_0x461c54['once']('change:_isConnected',()=>{_0x1cd336()['then'](_0x1d7844)['catch'](_0x2c1b14);});});}['destroy'](){super['destroy']();}async['_waitForServiceReady'](){this['_revisionHistoryService']['isConnected']||await new Promise(_0x24f391=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x588cf7=>{_0x588cf7['off'](),_0x24f391();});});}['_getLatestVersionFromServerOperations'](){const _0x229e58=this['editor']['plugins']['get'](l)['serverHistory']['getOperations']()['reverse']();for(const _0x553ead of _0x229e58)if('marker'!==_0x553ead['type']||_0x553ead['affectsData'])return _0x553ead['baseVersion']+0x1;}['_getLatestVersion'](){const _0x523850=this['editor']['plugins']['get'](l);return new Promise(_0x1a06c9=>{_0x523850['_isPendingUpdate']?_0x523850['once']('change:_isPendingUpdate',()=>{_0x1a06c9(this['_getLatestVersionFromServerOperations']());}):_0x1a06c9(this['_getLatestVersionFromServerOperations']());});}['_handleRevisionsUpdate'](_0x38bcfc,_0x120575){const _0x22c371=this['_revisionTracker']['repository'];this['_lastRequestId']=_0x120575;for(const _0x462f96 of _0x38bcfc){const _0x57c20b=_0x22c371['getRevision'](_0x462f96['id']);if(_0x57c20b){if((_0x462f96['fromVersion']||_0x462f96['toVersion'])&&(_0x462f96['diffData']=null),_0x57c20b===this['_revisionTracker']['currentRevision']){const _0x4cd205=Math['max'](_0x57c20b['toVersion'],_0x462f96['toVersion']),_0x1fe35a=Math['max'](_0x57c20b['fromVersion'],_0x462f96['fromVersion']);let _0x49db2f;_0x57c20b['toVersion']===_0x462f96['toVersion']&&_0x57c20b['fromVersion']===_0x462f96['fromVersion']?(_0x49db2f=!0x0,this['_preventResendingRevisionData'](_0x462f96)):_0x462f96['toVersion']===_0x4cd205&&_0x462f96['fromVersion']===_0x1fe35a?_0x49db2f=!0x1:(_0x57c20b['toVersion']===_0x4cd205&&_0x57c20b['fromVersion']===_0x1fe35a||this['_fixRevision']({'revision':_0x57c20b,'from':_0x1fe35a,'to':_0x4cd205}),_0x49db2f=!0x0),_0x49db2f&&(delete _0x462f96['fromVersion'],delete _0x462f96['toVersion'],delete _0x462f96['diffData'],delete _0x462f96['createdAt'],delete _0x462f96['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0x462f96),this['_preventResendingRevisionData'](_0x462f96);}else this['_revisionTracker']['addRevisionData'](_0x462f96);}const _0x36ce15=_0x22c371['getRevisions']();_0x36ce15['reverse']();for(let _0x318393=0x0;_0x318393<_0x36ce15['length']-0x1;_0x318393++){const _0x42611c=_0x36ce15[_0x318393],_0x147e3e=_0x36ce15[_0x318393+0x1];if(_0x42611c['fromVersion']<_0x147e3e['toVersion']){const _0x4aa512=_0x147e3e['toVersion'],_0xc6ffa9=Math['max'](_0x4aa512,_0x42611c['toVersion']);this['_fixRevision']({'revision':_0x42611c,'from':_0x4aa512,'to':_0xc6ffa9});}}}['_fixRevision']({revision:_0xfeb6fe,from:_0x1388bb,to:_0x134404}={}){const _0x4f6748=this['editor']['plugins']['get'](_0x398766),_0x356a7d=this['_revisionTracker']['buildRevisionData']({'revision':_0xfeb6fe,'from':_0x1388bb,'to':_0x134404});_0x356a7d['authors']=_0x356a7d['authorsIds']['map'](_0x534c38=>_0x4f6748['getUser'](_0x534c38)),_0xfeb6fe['_update'](_0x356a7d);}['_preventResendingRevisionData'](_0x892738){const _0x29c91c={};_0x29c91c['id']=_0x892738['id'];for(const _0x3e709f of Object['keys'](_0x892738))'id'!==_0x3e709f&&(_0x29c91c[_0x3e709f]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0x29c91c['id'],_0x29c91c,!0x0);}async['_fetchMissingUsers'](_0x5a6ceb){const _0xe474b9=this['editor']['plugins']['get'](_0x398766),{connection:_0x23484a}=this['editor']['plugins']['get'](c),_0x3c81d2=new Set();for(const _0x2642d1 of _0x5a6ceb){for(const _0x1a6186 of _0x2642d1['authorsIds'])_0xceb3b(_0x1a6186);_0x2642d1['creatorId']&&_0xceb3b(_0x2642d1['creatorId']);}if(0x0===_0x3c81d2['size'])return;const _0x503e46=await dt['getMany'](_0x23484a,Array['from'](_0x3c81d2));for(const _0x151f89 of _0x503e46)_0xe474b9['getUser'](_0x151f89['id'])||_0xe474b9['addUser'](_0x151f89);function _0xceb3b(_0x5091ca){_0xe474b9['getUser'](_0x5091ca)||_0x3c81d2['add'](_0x5091ca);}}}function st(_0x4c7774){return _0x4c7774['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0x4c7774['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x4c7774['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class g extends _0x58ccc3{static get['requires'](){return['RevisionHistory',u,n];}static get['pluginName'](){return'RealTimeCollaborativeRevisionHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class A extends _0x471b2e{['_collapseAt'];constructor(_0x35d6fa,_0x4310e3=0x6){super(_0x35d6fa);const _0x20826c=this['bindTemplate'];this['set']('isHidden',!0x0),this['set']('usersCount',0x0),this['_collapseAt']=_0x4310e3,this['bind']('isHidden')['to'](this,'usersCount',_0x5626f1=>_0x5626f1<_0x4310e3),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item',_0x20826c['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':_0x20826c['to']('usersCount',_0x29e82d=>'+'+(_0x29e82d-this['_collapseAt']+0x2)['toString']())}]}]}]});}}class ts extends _0x471b2e{['items'];['keystrokes'];constructor(_0x3afe18){super(_0x3afe18);const _0x57d02e=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0x30a9a4(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0x57d02e['if']('hasPopup'),'aria-expanded':_0x57d02e['to']('isExpanded',_0x409bd3=>this['hasPopup']&&String(_0x409bd3)),'aria-label':_0x57d02e['to']('hasPopup',_0x251997=>G(_0x3afe18,_0x251997?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0x57d02e['to']('hasPopup',_0x569295=>!!_0x569295&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items'],'on':{'mouseenter':_0x57d02e['to'](()=>this['fire']('presencelist:show')),'mouseleave':_0x57d02e['to'](_0x12920b=>{const _0x3ca370=_0x12920b,_0x2781c8=document['querySelector']('.ck-presence-list__dropdown-list'),_0x2dad2b=document['querySelector']('.ck-balloon-panel_with-arrow');_0x2781c8?.['contains'](_0x3ca370['relatedTarget'])||_0x2dad2b?.['contains'](_0x3ca370['relatedTarget'])||this['fire']('presencelist:hide');})}}),this['on']('change:hasPopup',(_0xa9ba65,_0x1012b1,_0xfa823b)=>{this['element']&&(_0xfa823b?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 j extends _0x471b2e{['counterView'];['inlineListView'];constructor(_0x3554f6,_0x20715c=0x6){super(_0x3554f6);const _0x3526c3=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new A(this['locale'],_0x20715c),this['inlineListView']=new ts(_0x3554f6),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x5abcb6 of this['inlineListView']['items'])_0x5abcb6['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',_0x3526c3['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['inlineListView']]});}}class x extends _0x471b2e{['listWrapperView'];constructor(_0x360afd,_0x583734){super(_0x360afd);const _0x131b26=this['bindTemplate'];this['listWrapperView']=new mt(_0x360afd,_0x583734),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':G(_0x360afd,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']],'on':{'mouseleave':_0x131b26['to'](_0x34aa37=>{const _0x5078ba=_0x34aa37,_0x5d6086=document['querySelector']('.ck-presence-list__list'),_0x264e75=document['querySelector']('.ck-balloon-panel_with-arrow');_0x5d6086?.['contains'](_0x5078ba['relatedTarget'])||_0x264e75?.['contains'](_0x5078ba['relatedTarget'])||this['fire']('presencelist:hide');})}});}}class mt extends _0x4e71d5{constructor(_0x4514ea,_0x2a4779){super(_0x4514ea);const _0x595025=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0x2a4779?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0x595025['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0x595025['to']('role'),'aria-label':_0x595025['to']('ariaLabel'),'aria-labelledby':_0x595025['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0xeaa953['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0x451c44=this['element'];_0x451c44&&(this['_isScrollable']=Math['max'](_0x451c44['scrollHeight'],_0x451c44['clientHeight'])>0.8*window['innerHeight']);}}class k extends rt{['userView'];constructor(_0xadf7a3,_0x244955,_0x11ea26){super(_0xadf7a3);const _0x1fa6d7=this['bindTemplate'];this['userView']=new ct(_0xadf7a3,_0x244955);const _0x4b29e6={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0x244955['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0x244955['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x244955['color']['getBackgroundColorClass']()],'aria-hidden':'true'}}]};_0x11ea26&&(_0x4b29e6['tag']='button',_0x4b29e6['on']={'click':_0x1fa6d7['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x4b29e6);}['focus'](){this['element']['focus']();}}class y extends _0x471b2e{['userView'];['markerView'];constructor(_0x43f700,_0x278513,_0x50a02d){super(_0x43f700);const _0x3cb000=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new ct(_0x43f700,_0x278513),this['markerView']=new at(_0x43f700,_0x278513);const _0x5b3fe4=new ot(_0x43f700);_0x5b3fe4['template']['tag']='span',_0x5b3fe4['text']=_0x278513['name'];const _0x1b03c1={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0x3cb000['to']('isFocusable',_0x3eba61=>!!_0x3eba61&&0x0),'aria-labelledby':_0x5b3fe4['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0x3cb000['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0x3cb000['to']('hasTooltip',_0x3fc615=>!_0x3fc615),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0x5b3fe4]};_0x50a02d&&(_0x1b03c1['tag']='button',_0x1b03c1['on']={'click':_0x3cb000['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x1b03c1);}}class at extends _0x471b2e{constructor(_0x30d483,_0x2c6236){super(_0x30d483),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x2c6236['color']['getBackgroundColorClass']()],'aria-hidden':'true'}});}}const C={'collapseAt':0x6,'displayMe':!0x0};class r extends _0x51d4ec{['currentDisplayedUsers'];['balloonPanelView'];['view'];['presenceDropdownView'];['_bodyCollection']=null;static get['pluginName'](){return'PresenceListUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x282f05){super(_0x282f05),this['context']['config']['define']('presenceList',C);const _0x33be9a=_0x282f05['config']['get']('presenceList.collapseAt');if('number'!=typeof _0x33be9a)throw new _0x71c4af('presencelist-collapseat-invalid-format',this);if(_0x33be9a<0x1)throw new _0x71c4af('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](i)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0x447489(),this['balloonPanelView']=new _0x460bdf(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get['requires'](){return[i];}['init'](){for(const _0x3a3e6a of this['_allConnectedUsers'])this['_handleUserAdd'](_0x3a3e6a);this['listenTo'](this['_allConnectedUsers'],'add',(_0x5f5014,_0x247530)=>{this['_handleUserAdd'](_0x247530);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0x56869c,_0x2ee243)=>{this['_handleUserRemove'](_0x2ee243);});}['_createView'](){const _0x3a2b29=this['context'],_0x597419=new j(this['context']['locale'],this['context']['config']['get']('presenceList.collapseAt')),_0x222dd5=this['balloonPanelView'];if(!_0x4f25f1(_0x3a2b29['config']['get']('presenceList.container')))throw new _0x71c4af('presencelist-missing-container',this);return _0x597419['counterView']['bind']('usersCount')['to'](this),_0x597419['bind']('isCollapsed')['to'](this,'usersCount',_0x4dd22f=>{const {collapseAt:_0x37fc40}=_0x3a2b29['config']['get']('presenceList'),_0x36fdfd=_0x4dd22f>=_0x37fc40;if(_0x36fdfd&&!_0x597419['inlineListView']['items']['find'](_0x14a885=>_0x14a885 instanceof A)){const _0x2a138a=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['currentDisplayedUsers']['length']==_0x2a138a&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](this['currentDisplayedUsers']['length']-0x1),_0x597419['inlineListView']['items']['add'](_0x597419['counterView']);}return _0x36fdfd||this['hideDropdown'](),_0x36fdfd;}),_0x597419['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0xfe547=>{const _0x290219=_0x3a2b29['config']['get']('presenceList'),_0xff4ddf=new y(_0x3a2b29['locale'],_0xfe547,!!_0x290219['onClick']);return _0xff4ddf['bind']('hasTooltip')['to'](_0x597419,'isCollapsed',_0x2ec75f=>!_0x2ec75f),_0xff4ddf['bind']('isFocusable')['to'](_0x597419,'isCollapsed',_0x35e335=>!_0x35e335),_0x290219['onClick']&&this['listenTo'](_0xff4ddf,'execute',()=>{this['view']['isCollapsed']||_0x290219['onClick'](_0xfe547,_0xff4ddf['element']);}),_0xff4ddf;}),this['listenTo'](_0x597419['inlineListView'],'presencelist:show',()=>{this['view']['isCollapsed']&&this['showDropdown']();}),this['listenTo'](_0x597419['inlineListView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();}),_0x597419['inlineListView']['keystrokes']['set']('Enter',(_0x337b37,_0x462ccd)=>{this['view']['isCollapsed']&&(this['showDropdown'](),_0x462ccd());}),_0x597419['render'](),_0x222dd5['render'](),_0x4bb096({'emitter':_0x597419,'activator':()=>_0x222dd5['isVisible'],'contextElements':[_0x222dd5['element'],_0x597419['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0x3a2b29['config']['get']('presenceList.container')['appendChild'](_0x597419['element']),this['_bodyCollection']=new _0x5df3c7(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_bodyCollection']['add'](this['balloonPanelView']),_0x597419;}['_handleUserAdd'](_0x294a63){if(!this['context']['config']['get']('presenceList.displayMe')&&_0x294a63['isMe'])return;const _0x25e329=this['context']['config']['get']('presenceList.collapseAt')-0x1;for(this['usersCount']++;this['currentDisplayedUsers']['length']>=_0x25e329-(this['view']['isCollapsed']?0x1:0x0)&&this['currentDisplayedUsers']['length']>0x1;)this['currentDisplayedUsers']['remove'](0x1);const _0x14323c=_0x294a63['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0x294a63,_0x14323c);}['_handleUserRemove'](_0x5c13ba){this['usersCount']--;const {collapseAt:_0x30c5c7}=this['context']['config']['get']('presenceList'),_0x8997cf=this['usersCount']>=_0x30c5c7;if(this['currentDisplayedUsers']['get'](_0x5c13ba['id']))this['currentDisplayedUsers']['remove'](_0x5c13ba['id']);else{if(_0x8997cf&&this['currentDisplayedUsers']['length']+0x1===_0x30c5c7-0x1)return;}if(this['currentDisplayedUsers']['length']+(_0x8997cf?0x1:0x0)<this['usersCount']){for(const _0xf18676 of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0xf18676['id'])&&(this['currentDisplayedUsers']['add'](_0xf18676,Math['min'](this['currentDisplayedUsers']['length']-(_0x8997cf?0x1:0x0),0x1)),this['currentDisplayedUsers']['length']+(_0x8997cf?0x1:0x0)===_0x30c5c7-0x1))return;}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0x3a82fb=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new x(this['context']['locale'],!!_0x3a82fb['onClick']),this['view']['inlineListView']['isExpanded']=!0x0,this['listenTo'](this['presenceDropdownView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();});const {listWrapperView:_0x4fcd3f}=this['presenceDropdownView'];_0x4fcd3f['items']['bindTo'](this['_allConnectedUsers'])['using'](_0x1caa4b=>{if(!_0x3a82fb['displayMe']&&_0x1caa4b['isMe'])return null;const _0x577bb4=new k(this['context']['locale'],_0x1caa4b,!!_0x3a82fb['onClick']);return _0x3a82fb['onClick']&&this['listenTo'](_0x577bb4,'execute',()=>{_0x3a82fb['onClick'](_0x1caa4b,_0x577bb4['element']);}),_0x577bb4;}),this['balloonPanelView']['content']['add'](this['presenceDropdownView']),this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element']}),_0x4fcd3f['focus'](),_0x4fcd3f['checkIfScrollable']();const _0x24f381=(_0x58e71d,_0x3a390d)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0x3a390d();};_0x4fcd3f['keystrokes']['set']('Esc',_0x24f381),_0x4fcd3f['keystrokes']['set']('Shift+Tab',_0x24f381),_0x4fcd3f['keystrokes']['set']('Tab',(_0x1f5da3,_0x584a94)=>{!function(_0x2500b8){const _0x2cafb9=['a','button','input','select','textarea','[tabindex]','[contenteditable]']['map'](_0x4451a6=>_0x4451a6+':not([disabled]):not([tabindex=\x22-1\x22])')['join'](','),_0x2ecaed=[...document['body']['querySelectorAll'](_0x2cafb9)]['filter'](_0x67874e=>_0x67874e===document['activeElement']||_0x67874e['offsetWidth']+_0x67874e['offsetHeight']>0x0)['sort']((_0x3ce505,_0xd8e4fd)=>(_0x3ce505['tabIndex']||0x0)-(_0xd8e4fd['tabIndex']||0x0)),_0x3cdcec=_0x2ecaed['indexOf'](_0x2500b8),_0xe5e097=_0x2ecaed[(_0x3cdcec+0x1)%_0x2ecaed['length']];_0xe5e097&&_0xe5e097['focus']();}(this['view']['element']),this['hideDropdown'](),_0x584a94();}),_0x4fcd3f['focusTracker']['add'](this['view']['element']),_0x4fcd3f['focusTracker']['on']('change:isFocused',(_0x1fc14d,_0x1e57b6,_0x18f1e4)=>{_0x18f1e4||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 s extends _0x51d4ec{static get['requires'](){return[i,r];}static get['pluginName'](){return'PresenceList';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}export{a as CloudServicesCommentsAdapter,u as CloudServicesRevisionHistoryAdapter,f as CloudServicesTrackChangesAdapter,s as PresenceList,r as PresenceListUI,l as RealTimeCollaborationClient,m as RealTimeCollaborativeComments,n as RealTimeCollaborativeEditing,g as RealTimeCollaborativeRevisionHistory,p as RealTimeCollaborativeTrackChanges,i as Sessions};
|
|
23
|
+
import{ContextPlugin as _0x191ba5,Plugin as _0x12cabc,PendingActions as _0x41d3fc,Context as tt}from'@ckeditor/ckeditor5-core/dist/index.js';import{DomEmitterMixin as _0x5a4a16,CKEditorError as _0x3ddc56,Collection as _0x4b426b,global as _0x1686f2,version as ht,uid as _0x5cb9c1,KeystrokeHandler as _0x4733e4}from'@ckeditor/ckeditor5-utils/dist/index.js';import{Notification as _0x95186,View as _0x58240d,ListView as _0x5f11c8,ListItemView as lt,LabelView as pt,BalloonPanelView as _0x5d639d,clickOutsideHandler as _0x1b51db,BodyCollection as _0x1d3b66}from'@ckeditor/ckeditor5-ui/dist/index.js';import{LiveRange as ft,History as _0x523900,NoOperation as _0x108116,InsertOperation as _0x226075,MarkerOperation as _0x1ab205,RootAttributeOperation as _0x229d03,transformSets as _0x1eec30,OperationFactory as _0x2e4736}from'@ckeditor/ckeditor5-engine/dist/index.js';import{WebSocketGateway as mt,WEB_SOCKET_GATEWAY_STATES as _0x1f4b62,CollaborativeEditingService as _0x43271b,User as gt,CommentsService as et,TrackChangesService as at,RevisionHistoryService as rt,EditorService as it}from'@ckeditor/ckeditor-cloud-services-collaboration/dist/index.js';import{Users as _0x50fdcb,UserView as ut}from'ckeditor5-collaboration/dist/index.js';import{Compressor as _0x53e424}from'@ckeditor/ckeditor5-operations-compressor/dist/index.js';import{isElement as _0x3744a5}from'es-toolkit/compat';class c extends _0x191ba5{static ['WebSocketGateway']=/* #__PURE__ -- @preserve */
|
|
24
|
+
((()=>mt)());static ['initialReconnectionInterval']=0x3e8;['connection'];['_reconnectionStack'];['_shouldPluginsReconnect'];['_domEmitter'];static get['requires'](){return['CloudServices',_0x95186];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x22a07d){super(_0x22a07d),this['set']('state',_0x1f4b62['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=Object['create'](_0x5a4a16);}['init'](){const _0x38488f=this['context'],_0xf7e682=_0x38488f['plugins']['get']('CloudServices'),_0x10df4f=_0x38488f['plugins']['get'](_0x95186);if(!_0xf7e682['token'])throw new _0x3ddc56('websocketgateway-missing-token',this);if(!_0xf7e682['webSocketUrl'])throw new _0x3ddc56('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),c['WebSocketGateway']['connect'](_0xf7e682['token'],_0xf7e682['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0xd4fbf2=>{if(this['connection']=_0xd4fbf2,this['bind']('state')['to'](_0xd4fbf2,'state',this,'_isBrowserOffline',(_0x36238c,_0x235cf7)=>('connected'!==_0x36238c&&(this['_shouldPluginsReconnect']=!0x0),_0x235cf7||_0x36238c!==_0x1f4b62['CONNECTED']?_0x1f4b62['DISCONNECTED']:this['state']==_0x1f4b62['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),_0x1f4b62['CONNECTING']):_0x1f4b62['CONNECTED'])),this['connection']['on']('error',(_0x38c9e1,_0x468fe7)=>{if('limitExceeded'!==_0x468fe7['code'])throw console['error'](_0x468fe7),new _0x3ddc56('cloudservices-init',null,{'originalError':_0x468fe7});_0x10df4f['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'});}),!_0xd4fbf2['me'])return new Promise(_0x38444b=>_0xd4fbf2['on']('change:me',_0x38444b));})['catch'](_0xa35161=>{throw console['error'](_0xa35161),new _0x3ddc56('cloudservices-init',null,{'originalError':_0xa35161});});}['addToReconnectionStack'](_0x11a2ad){if('function'!=typeof _0x11a2ad['reconnect'])throw new _0x3ddc56('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0x11a2ad))throw new _0x3ddc56('websocketgateway-plugin-already-registered',this,{'name':_0x11a2ad['constructor']['pluginName']});this['_reconnectionStack']['add'](_0x11a2ad);}['removeFromReconnectionStack'](_0x5440cf){this['_reconnectionStack']['delete'](_0x5440cf);}['isInReconnectionStack'](_0x9ee179){return this['_reconnectionStack']['has'](_0x9ee179);}['_reconnect'](){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0x75da62=>_0x75da62['reconnect']())))['then'](()=>this['state']=_0x1f4b62['CONNECTED'])['catch'](_0x1346cc=>{throw console['error'](_0x1346cc),new _0x3ddc56('cloudservices-reconnection-error',this['context']);});}['disconnect'](){this['connection']&&this['connection']['disconnect'](),this['state']=_0x1f4b62['DISCONNECTED'],this['_domEmitter']['stopListening']();}['destroy'](){this['disconnect'](),super['destroy']();}}class i extends _0x191ba5{['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[c,_0x50fdcb];}constructor(_0x10e6cb){super(_0x10e6cb),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0x4b426b(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x50fdcb);}['init'](){const _0x26ddc0=this['context']['plugins']['get'](c);this['listenTo'](_0x26ddc0,'change:state',(_0x28ce8b,_0x3f7136,_0x49a641)=>{if('connected'!==_0x49a641)this['channelSessions']['forEach'](_0x5518ba=>_0x5518ba['clear']()),this['channelConnectedUsers']['forEach'](_0x408136=>_0x408136['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x5e8112,_0x723b35]of this['_registeredSessions'])for(const _0x183228 of _0x723b35)this['_handleSessionAdd'](_0x5e8112,_0x183228);}}),this['_createUser'](_0x26ddc0['connection']['me'],!0x0);}['register'](_0x49f7f2,_0x323756){if(this['_registeredSessions']['has'](_0x49f7f2))throw new _0x3ddc56('sessions-register-already-registered',null,{'channelId':_0x49f7f2});this['_registeredSessions']['set'](_0x49f7f2,_0x323756),this['channelSessions']['set'](_0x49f7f2,new _0x4b426b()),this['channelConnectedUsers']['set'](_0x49f7f2,new _0x4b426b()),this['listenTo'](_0x323756,'add',(_0x1056f7,_0x4db3c2)=>this['_handleSessionAdd'](_0x49f7f2,_0x4db3c2)),this['listenTo'](_0x323756,'remove',(_0x5c7443,_0x1e8dea)=>this['_handleSessionRemove'](_0x49f7f2,_0x1e8dea));for(const _0x34c8ab of _0x323756)this['_handleSessionAdd'](_0x49f7f2,_0x34c8ab);}['unregister'](_0x2c7893){if(!this['_registeredSessions']['has'](_0x2c7893))throw new _0x3ddc56('sessions-unregister-not-exist',null,{'channelId':_0x2c7893});const _0x35ae9d=this['_registeredSessions']['get'](_0x2c7893);this['stopListening'](_0x35ae9d);for(const _0xd48541 of _0x35ae9d)'connected'===this['context']['plugins']['get'](c)['state']&&this['_handleSessionRemove'](_0x2c7893,_0xd48541);this['_registeredSessions']['delete'](_0x2c7893),this['channelSessions']['delete'](_0x2c7893),this['channelConnectedUsers']['delete'](_0x2c7893);}get['mySessionId'](){return this['context']['plugins']['get'](c)['connection']['sessionId'];}['getUserBySessionId'](_0x574795){for(const _0x49e50d of this['channelSessions']['values']())for(const _0x5efc64 of _0x49e50d)if(_0x5efc64['id']===_0x574795)return _0x5efc64['user'];}['getUserSessions'](_0xa76f35,_0x1e5023){const _0x3d5db4=_0x1e5023?[this['channelSessions']['get'](_0x1e5023)]:this['channelSessions']['values'](),_0x556bc7=new Set();for(const _0x5eb9e5 of _0x3d5db4)for(const _0x25a316 of _0x5eb9e5)_0x25a316['user']['id']===_0xa76f35['id']&&_0x556bc7['add'](_0x25a316['id']);return _0x556bc7;}['getUserRole'](_0x4f534b){for(const _0x2606dc of this['channelSessions']['values']())for(const _0x17850d of _0x2606dc)if(_0x17850d['user']===_0x4f534b)return _0x17850d['role'];}['_handleSessionAdd'](_0x4ac809,_0x55e631){if('connected'!==this['context']['plugins']['get'](c)['state'])return;const _0x23d50c=_0x55e631['user'],_0x370328=this['_users']['getUser'](_0x23d50c['id'])||this['_createUser'](_0x23d50c),_0x2c9ad3=Object['assign']({},_0x55e631,{'user':_0x370328});this['channelSessions']['get'](_0x4ac809)['add'](_0x2c9ad3);const _0x106ee6=this['channelConnectedUsers']['get'](_0x4ac809);_0x106ee6['has'](_0x370328['id'])||_0x106ee6['add'](_0x370328),this['allConnectedUsers']['has'](_0x370328['id'])||this['allConnectedUsers']['add'](_0x370328,_0x370328['isMe']?0x0:void 0x0),this['fire']('sessionAdd:'+_0x4ac809,{'channelId':_0x4ac809,'session':_0x2c9ad3});}['_handleSessionRemove'](_0x18c909,_0x32d654){if('connected'!==this['context']['plugins']['get'](c)['state'])return;const _0x59f0c1=this['channelConnectedUsers']['get'](_0x18c909),_0x57e22f=_0x32d654['user'];_0x57e22f['id']&&(this['channelSessions']['get'](_0x18c909)['remove'](_0x32d654['id']),_0x59f0c1['has'](_0x57e22f['id'])&&!this['getUserSessions'](_0x57e22f,_0x18c909)['size']&&_0x59f0c1['remove'](_0x57e22f['id']),this['allConnectedUsers']['get'](_0x57e22f['id'])&&!this['getUserSessions'](_0x57e22f)['size']&&this['allConnectedUsers']['remove'](_0x57e22f['id']));}['_createUser'](_0x1fcfd1,_0x961504){const _0x28a430=this['_users']['addUser'](_0x1fcfd1);return _0x961504&&this['_users']['defineMe'](_0x1fcfd1['id']),_0x28a430['orderNumber']=this['_uniqueUsersCount']++,_0x28a430;}}class B extends _0x12cabc{['_domEmitter']=new(_0x5a4a16())();static get['requires'](){return[i];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x5f0d86=this['editor'],_0x12a59f=_0x5f0d86['plugins']['get'](i);_0x5f0d86['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x19cca5,{writer:_0x3b15f8})=>function(_0x10a5fe,_0x4cd053,_0x58df04,_0x1b978c){const _0x5822fe=_0x10a5fe['markerName']['split'](':')[0x2],_0x5e957b=_0x58df04['getUserBySessionId'](_0x5822fe);if(!_0x5e957b||_0x5822fe===_0x58df04['mySessionId'])return;if(!_0x1b978c['model']['schema']['checkChild'](_0x10a5fe['markerRange']['start'],'$text'))return;const _0x3817c2={'class':'ck-user__marker\x20'+_0x5e957b['color']['getMarkerClass'](),'data-name':_0x5e957b['name'],'data-session-id':_0x5822fe},_0x3bb676=_0x1b978c['model']['markers']['get'](_0x10a5fe['markerName']),_0x24475b=_0x3bb676['getStart'](),_0xaab0f4=_0x24475b['nodeAfter'],_0x336706=_0x1b978c['model']['schema'];if(_0xaab0f4&&_0x336706['isObject'](_0xaab0f4)&&_0x336706['isInline'](_0xaab0f4)&&!_0x1b978c['model']['markers']['get']('user:range:'+_0x5822fe)['getRange']()['isCollapsed'])return;const _0xd1b4b8=_0x24475b['parent'];return _0x1b978c['model']['schema']['isLimit'](_0xd1b4b8)&&!_0x1b978c['model']['hasContent'](_0xd1b4b8)&&(_0x3817c2['contenteditable']=!0x1),function(_0x45a3c9,_0x532821,_0x4d269e){const _0x4c7ad6=_0x45a3c9['createUIElement']('span',_0x532821);return _0x45a3c9['setCustomProperty']('userPositionMarker',!0x0,_0x4c7ad6),_0x4c7ad6['render']=function(_0x199d71){const _0x37413e=this['toDomElement'](_0x199d71),_0x48bc18=document['createElement']('span');return _0x48bc18['classList']['add']('ck-user__marker-tooltip'),_0x48bc18['setAttribute']('contenteditable','false'),_0x48bc18['setAttribute']('spellcheck','false'),_0x48bc18['textContent']=_0x4d269e['name'],_0x37413e['innerHTML']='<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span>'+_0x48bc18['outerHTML']+'',_0x37413e['addEventListener']('mouseenter',()=>{_0x37413e['classList']['add']('ck-user__marker_hovered');}),_0x37413e['addEventListener']('mouseleave',()=>{_0x37413e['classList']['remove']('ck-user__marker_hovered');}),_0x37413e;},_0x4c7ad6['isSimilar']=function(_0x427fbf){return!(!this['getCustomProperty']('userPositionMarker')||!_0x427fbf['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0x427fbf['getAttribute']('data-session-id'));},_0x4c7ad6;}(_0x4cd053,_0x3817c2,_0x5e957b);}(_0x19cca5,_0x3b15f8,_0x12a59f,_0x5f0d86)}),_0x5f0d86['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0x38e1a0=>function(_0x58b355,_0x3ca184){const _0x313988=_0x58b355['markerName']['split'](':')[0x2];if(_0x313988===_0x3ca184['mySessionId'])return null;const _0x37f5d8=_0x3ca184['getUserBySessionId'](_0x313988);if(!_0x37f5d8)return{'id':_0x313988,'classes':[]};return{'id':_0x313988,'classes':['ck-user__selection',_0x37f5d8['color']['getSelectionClass']()],'attributes':{'data-session-id':_0x313988},'priority':0x7d0+_0x37f5d8['orderNumber']};}(_0x38e1a0,_0x12a59f)}),function(_0x1b10e7){const _0x10ba3f=_0x1b10e7['model'],_0x32e6ce=new Map(),_0x2b385a=_0x1b10e7['plugins']['get'](i);_0x10ba3f['markers']['on']('update:user:range',(_0x4ad7fa,_0x22413c,_0x4a2628,_0x169cf9)=>{if(!_0x169cf9&&_0x32e6ce['get'](_0x22413c['name']))return _0x32e6ce['get'](_0x22413c['name'])['detach'](),void _0x32e6ce['delete'](_0x22413c['name']);const _0x351814=_0x22413c['name']['split'](':')[0x2];if(_0x351814===_0x2b385a['mySessionId'])return;const _0x51bc2f='user:position:'+_0x351814;_0x10ba3f['markers']['has'](_0x51bc2f)&&_0x1b10e7['editing']['reconvertMarker'](_0x51bc2f),_0x22413c['on']('change:range',(_0x258d1c,_0x4b7029,_0x4123a0)=>{if('$graveyard'!=_0x4b7029['root']['rootName']&&'$graveyard'==_0x22413c['getRange']()['root']['rootName']&&!_0x32e6ce['has'](_0x22413c['name'])){const _0x2c6053=_0x10ba3f['schema']['getNearestSelectionRange'](_0x4123a0['deletionPosition']);if(_0x2c6053){const _0x28b64a=ft['fromRange'](_0x2c6053);_0x32e6ce['set'](_0x22413c['name'],_0x28b64a),_0x28b64a['on']('change:range',(_0x3e11a5,_0x76cad2,_0x59d053)=>{if('$graveyard'==_0x28b64a['root']['rootName']){const _0x3c51cc=_0x10ba3f['schema']['getNearestSelectionRange'](_0x59d053['deletionPosition']);_0x3c51cc?(_0x28b64a['start']=_0x3c51cc['start'],_0x28b64a['end']=_0x3c51cc['end']):(_0x32e6ce['delete'](_0x22413c['name']),_0x28b64a['detach']());}});}}});}),_0x10ba3f['document']['on']('change',()=>{_0x32e6ce['size']>0x0&&_0x10ba3f['enqueueChange']({'isUndoable':!0x1},_0x48db22=>{for(const [_0x29f3e6,_0x295fb3]of _0x32e6ce)'$graveyard'==_0x10ba3f['markers']['get'](_0x29f3e6)['getRange']()['root']['rootName']&&(X(_0x29f3e6['split'](':')[0x2],_0x295fb3['toRange'](),_0x10ba3f,_0x48db22),_0x295fb3['detach']());_0x32e6ce['clear']();});});}(_0x5f0d86),this['_domEmitter']['listenTo'](_0x1686f2['document'],'keydown',(_0x516d88,{key:_0x32f740})=>{'Escape'===_0x32f740&&function(_0x49918c){_0x49918c['editing']['view']['change'](_0x4e0f24=>{for(const _0x2182c7 of _0x49918c['model']['markers']){if(!_0x2182c7['name']['startsWith']('user:position'))continue;const _0x4e9dac=_0x49918c['editing']['mapper']['markerNameToElements'](_0x2182c7['name']);if(_0x4e9dac){for(const _0x18eeb6 of _0x4e9dac)_0x4e0f24['removeClass']('ck-user__marker_hovered',_0x18eeb6);}}});}(_0x5f0d86);},{'useCapture':!0x0});}['afterInit'](){const _0x9b2e2a=this['editor'],_0x144f9e=_0x9b2e2a['commands']['get']('undo');_0x144f9e&&_0x9b2e2a['model']['on']('applyOperation',(_0x393343,_0x5d9346)=>{const _0xdb9052=_0x5d9346[0x0];if(!_0xdb9052['isDocumentOperation'])return;if('marker'!=_0xdb9052['type']||!_0xdb9052['name']['startsWith']('user:'))return;const _0x12bb3e=_0xdb9052['batch'];_0x144f9e['_createdBatches']['has'](_0x12bb3e)&&(_0xdb9052['newRange']=_0xdb9052['oldRange']?_0x9b2e2a['model']['createRange'](_0xdb9052['oldRange']['start'],_0xdb9052['oldRange']['end']):null);},{'priority':'highest'});}['destroy'](){return this['_domEmitter']['stopListening'](),super['destroy']();}['createUserMarkerOperations'](){const _0x290a3a=this['editor'],_0x34f044=_0x290a3a['model']['document'],_0x1a2020=_0x290a3a['plugins']['get'](i);_0x290a3a['model']['enqueueChange']({'isUndoable':!0x1},_0x10e00f=>{const _0x2b91c5='user:range:'+_0x1a2020['mySessionId'],_0x41a6ba='user:position:'+_0x1a2020['mySessionId'],_0x2cdf7c=_0x290a3a['model']['markers']['has'](_0x2b91c5);_0x290a3a['editing']['view']['hasDomSelection']?X(_0x1a2020['mySessionId'],_0x34f044['selection']['getFirstRange'](),_0x290a3a['model'],_0x10e00f):_0x2cdf7c&&(_0x10e00f['removeMarker'](_0x2b91c5),_0x10e00f['removeMarker'](_0x41a6ba));});}}function X(_0x1b70ff,_0x4ce889,_0x2f0881,_0x5ea24c){const _0x357e08='user:range:'+_0x1b70ff,_0x43d3a4='user:position:'+_0x1b70ff,_0x2e372f=_0x4ce889['getContainedElement']();let _0x30ce9c=_0x4ce889['start'];_0x2e372f&&_0x2e372f['is']('element','tableCell')&&(_0x30ce9c=function(_0x24d3e3,_0x1291bb){for(const _0x1ebefe of _0x24d3e3['getPositions']())if(_0x1291bb['schema']['checkChild'](_0x1ebefe,'$text'))return _0x1ebefe;}(_0x4ce889,_0x2f0881),_0x4ce889=_0x5ea24c['createRange'](_0x30ce9c));const _0x219391=_0x5ea24c['createRange'](_0x30ce9c);_0x2f0881['markers']['has'](_0x357e08)?(_0x5ea24c['updateMarker'](_0x357e08,{'range':_0x4ce889}),_0x5ea24c['updateMarker'](_0x43d3a4,{'range':_0x219391})):(_0x5ea24c['addMarker'](_0x357e08,{'range':_0x4ce889,'usingOperation':!0x0}),_0x5ea24c['addMarker'](_0x43d3a4,{'range':_0x219391,'usingOperation':!0x0}));}function M(_0x611d3a,_0x3755bd,_0x227212){const _0x4daf2f=_0x611d3a['t'],t=_0x611d3a['t'];switch(_0x3755bd){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 _0x4daf2f({'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'},_0x227212);default:return'';}}let F=0x1;class l extends _0x12cabc{static ['CollaborativeEditingService']=/* #__PURE__ -- @preserve */
|
|
25
|
+
((()=>_0x43271b)());['_offset'];['sessionId'];['serverHistory'];['_channelId'];['_service'];['_document'];['_compressor'];['_bufferedOperations'];['_knownOperations'];['_knownRootNames'];['_pendingAction'];['_hasSelectionChanged'];['_sendBufferedOperationsDelayId'];['_baseBufferDelay'];['_currentBufferDelay'];['_lastSyncedOperationId'];['_disconnectionOperations'];['_operationIdentifier'];static get['requires'](){return[c,i,B,_0x41d3fc,_0x50fdcb,_0x95186];}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 _0x207d70=this['serverHistory']['getOperations']();for(let _0x37c77e=_0x207d70['length']-0x1;_0x37c77e>=0x0;_0x37c77e--){const _0x4a795e=_0x207d70[_0x37c77e];if(!this['_disconnectionOperations']['has'](_0x4a795e))return _0x4a795e['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0x2a20b8){if(super(_0x2a20b8),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x523900(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0x3ddc56('collaboration-missing-channelid',this);const _0x5ef343=_0x2a20b8['config']['get']('cloudServices.bundleVersion')||ht;this['_service']=new l['CollaborativeEditingService'](_0x5ef343,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0x53e424(),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 $(this['_disconnectionOperations']);}['init'](){const _0xe42816=this['editor'],_0x116446=_0xe42816['plugins']['get'](_0x50fdcb),_0x2d10fd=_0xe42816['plugins']['get'](c);this['listenTo'](_0x116446,'getOperationAuthor',(_0xb2b9e5,_0x251641)=>{const _0x121f6e=_0x251641[0x0];_0x121f6e['_authorId']&&(_0xb2b9e5['return']=_0x116446['getUser'](_0x121f6e['_authorId']),_0xb2b9e5['stop']()),null===_0x121f6e['_authorId']&&(_0xb2b9e5['return']=null,_0xb2b9e5['stop']());},{'priority':'high'}),this['listenTo'](_0xe42816['model']['document']['selection'],'change:range',(_0x2ffeaf,_0x7c77d7)=>{_0x7c77d7['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0xe42816['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0xe42816['model']['on']('applyOperation',(_0x3ab08e,_0x1a059f)=>{const _0x87ee58=_0x1a059f[0x0];_0x87ee58['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0x87ee58),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['bind']('_isEditingAllowed')['to'](_0x2d10fd,'state',this,'_hasSynchronizationProblem',(_0x5c89f1,_0x2ba9b8)=>'connected'===_0x5c89f1&&!_0x2ba9b8),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0xe42816['disableReadOnlyMode']('rtc-offline'):_0xe42816['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0xe42816['disableReadOnlyMode']('rtc-offline'):_0xe42816['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async['reconnect'](){const _0x588579=this['editor']['plugins']['get'](i),_0x56e8d0=this['editor']['plugins']['get'](c);try{this['_isPendingUpdate']=!0x0,_0x588579['unregister'](this['_channelId']);const _0x439083=await this['_service']['reconnect'](_0x56e8d0['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0x439083)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x5ef3ba=await this['_service']['getConnectedSessions']();_0x588579['register'](this['_channelId'],_0x5ef3ba),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x1b4b4a){if(function(_0x42176c){return'404'===_0x42176c['code'];}(_0x1b4b4a)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0x24757a){return'409'===_0x24757a['code'];}(_0x1b4b4a)){const _0xf595d6=M(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'](_0xf595d6);}else{if(!(_0x1b4b4a instanceof q))throw _0x1b4b4a;this['_handleReconnectionError']();}}}}['destroy'](){const _0x28f2ba=this['editor']['plugins']['get'](c),_0x5e338d=this['editor']['plugins']['get'](i);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x5e338d['channelSessions']['has'](this['_channelId'])&&_0x5e338d['unregister'](this['_channelId']),_0x28f2ba['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async['_handleReconnectionResponse'](_0x540330){if(this['sessionId']!==_0x540330['sessionId']&&this['_lastSyncedOperationId']!==_0x540330['lastOperationId'])throw new q();return this['sessionId']=_0x540330['sessionId'],this['_handleServerResponse']([],{..._0x540330,'wereChangesApplied':!0x1,'data':_0x540330['data']},'reconnect');}async['_connectService'](_0x314cda,_0x1dbb0a=!0x1){const {connection:_0x11bd01}=this['editor']['plugins']['get'](c);l['CollaborativeEditingService']['getConnectedSessions'](_0x11bd01,this['_channelId'])['then'](_0x4168cb=>this['_initSessionsHandling'](_0x4168cb))['catch'](_0x3cf15b=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x3cf15b);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x12954a,_0x32cfec)=>{this['_crash']('realtimecollaborationclient-init-service-internal-error',_0x32cfec);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_isConnected']=!0x1;});const _0x469ce1=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x314cda);this['_isPendingUpdate']=!0x0;const _0x590407=await this['_service']['connect'](_0x11bd01,this['_compressOperations'](_0x314cda),_0x469ce1);if(this['sessionId']=_0x590407['sessionId'],_0x1dbb0a){if(!_0x590407['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x590407['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0x314cda,_0x590407,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x590407,_0x314cda);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}['_handleSendingSelectionMarkers'](){const _0xc37fe9=this['editor']['plugins']['get'](i),_0xf4a1c2=this['editor']['plugins']['get'](B),_0x2a31c2=_0xc37fe9['channelSessions']['get'](this['_channelId']);_0x2a31c2&&_0x2a31c2['length']>0x1?_0xf4a1c2['createUserMarkerOperations']():this['listenTo'](_0xc37fe9,'sessionAdd:'+this['_channelId'],()=>{0x2===_0xc37fe9['channelSessions']['get'](this['_channelId'])['length']&&_0xf4a1c2['createUserMarkerOperations']();});}async['_handleReceivedOperations'](_0x3892d6,_0x2628ef,_0x575820,_0x469e62){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x2628ef){const _0x517a9b=this['_decompressOperations'](_0x575820,_0x469e62);await this['_fetchMissingUsers'](_0x517a9b),this['_handleExternalOperations'](_0x517a9b,_0x2628ef,_0x575820['lastOperationId'])||this['_crash']('realtimecollaborationclient-init-service-incorrect-server-operation');}}async['_connectAfterSessionHasBeenFlushed'](){this['_disconnectService']();const {locale:_0x1b5929}=this['editor'];let _0x3d1a81;try{_0x3d1a81=await this['_service']['getDocumentDetails']();}catch(_0x5f97be){const _0x224a64=M(_0x1b5929,'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'](_0x224a64);}const _0x39fd70=_0x3d1a81['currentDocumentSession']||_0x3d1a81['lastDocumentSession'];if(this['_lastSyncedOperationId']===_0x39fd70['lastOperationId'])await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);else{const _0x1a83e2=M(_0x1b5929,'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.');this['_handleReconnectionError'](_0x1a83e2);}}['_disconnectService'](){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['stopListening'](this['_service']);}['_initSessionsHandling'](_0x8a916e){const _0x3cf79c=this['editor']['plugins']['get'](i);this['listenTo'](_0x3cf79c,'sessionAdd:'+this['_channelId'],(_0xb5e65c,{session:_0xe1974a})=>{if(_0xe1974a['id']===_0x3cf79c['mySessionId']){_0xb5e65c['off']();const _0x20f8e7=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0x2f59f0=_0xe1974a['permissions'];_0x20f8e7&&_0x20f8e7['isEnabled']&&(_0x2f59f0=_0x2f59f0['filter'](_0x5450e1=>'document:write'!==_0x5450e1)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0x2f59f0,this['_channelId']);}}),_0x3cf79c['register'](this['_channelId'],_0x8a916e);}['_initThrowingOnDataSet'](){const _0x4c9fe0=this['editor']['data']['set'];this['editor']['data']['set']=(..._0x5b97ea)=>{if(!_0x5b97ea[_0x5b97ea['length']-0x1]['suppressErrorInCollaboration'])throw new _0x3ddc56('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x4c9fe0['apply'](this['editor']['data'],_0x5b97ea);};}['_setUpDataInit'](){this['editor']['data']['on']('init',(_0x312d33,[_0x504c63])=>{if(this['_document']['version'])throw new _0x3ddc56('realtimecollaborationclient-init-document-already-initialized',this);_0x312d33['stop'](),this['_setPendingAction']();const _0x33e86a=this['editor']['config']['get']('rootsAttributes'),_0x5607df=this['_getOperationsFromInitData'](_0x504c63,_0x33e86a);0x0==_0x5607df['length']&&_0x5607df['push'](new _0x108116(0x0)),_0x312d33['return']=this['_connectService'](_0x5607df)['then'](()=>{this['editor']['plugins']['get'](c)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x44edf8=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x44edf8))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x17b493,[_0x28946f,_0x2d267d])=>{_0x17b493['stop']();const _0x37ee30=this['editor']['model']['document']['getRoot'](_0x28946f);if(!this['_knownRootNames']['has'](_0x28946f)){const _0xc76269=_0x2d267d&&_0x2d267d['data']?_0x2d267d['data']:'',_0x957254=_0x2d267d&&_0x2d267d['attributes']?_0x2d267d['attributes']:{};await this['_loadRoot'](_0x28946f,_0xc76269,_0x957254);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0x37ee30['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0x37ee30);});},{'priority':'high'});}async['_fetchMissingUsers'](_0xbca6ec){const _0x46a445=this['editor']['plugins']['get'](_0x50fdcb),{connection:_0x521d28}=this['editor']['plugins']['get'](c),_0x121c42=new Set();for(const _0x42444b of _0xbca6ec){const _0x48bb93=_0x42444b['_authorId'];_0x48bb93&&!_0x46a445['getUser'](_0x48bb93)&&_0x121c42['add'](_0x48bb93);}if(0x0===_0x121c42['size'])return;const _0xaf3612=await gt['getMany'](_0x521d28,Array['from'](_0x121c42));for(const _0x23cb82 of _0xaf3612)_0x46a445['getUser'](_0x23cb82['id'])||_0x46a445['addUser'](_0x23cb82);}['_getOperationsFromInitData'](_0x4d26b4,_0x35ec71={}){const _0x22cc38=this['editor']['model'],_0x1ea2dc=[];let _0x15c741=0x0;const _0x51ea54='string'==typeof _0x4d26b4?{'main':_0x4d26b4}:_0x4d26b4;for(const _0xb0018d of Object['keys'](_0x51ea54)){if(!this['_document']['roots']['has'](_0xb0018d))throw new _0x3ddc56('realtimecollaborationclient-init-non-existent-root',this);const _0x301d89=this['editor']['data']['parse'](_0x51ea54[_0xb0018d]),_0x17a7c7=this['_document']['getRoot'](_0xb0018d),_0x2efaac=new _0x226075(_0x22cc38['createPositionAt'](_0x17a7c7,0x0),_0x301d89,_0x15c741++);_0x1ea2dc['push'](_0x2efaac);for(const [_0x2fa5db,_0x4e1bf3]of _0x301d89['markers']){const _0x4f360f=_0x22cc38['createRange'](_0x22cc38['createPositionFromPath'](_0x17a7c7,_0x4e1bf3['start']['path']['slice']()),_0x22cc38['createPositionFromPath'](_0x17a7c7,_0x4e1bf3['end']['path']['slice']())),_0x173b19=new _0x1ab205(_0x2fa5db,null,_0x4f360f,_0x22cc38['markers'],!0x0,_0x15c741++);_0x1ea2dc['push'](_0x173b19);}}if(_0x35ec71)for(const [_0x1cf1b3,_0x201fdf]of Object['entries'](_0x35ec71)){const _0x301304=_0x22cc38['document']['getRoot'](_0x1cf1b3);if(!_0x301304)throw new _0x3ddc56('multi-root-editor-root-attributes-no-root',null);for(const [_0x46db0e,_0x8ca9e9]of Object['entries'](_0x201fdf))if(null!==_0x8ca9e9){const _0x2d7e0f=new _0x229d03(_0x301304,_0x46db0e,null,_0x8ca9e9,_0x15c741++);_0x1ea2dc['push'](_0x2d7e0f);}}return _0x1ea2dc;}async['_loadRoot'](_0x5cf729,_0x44d069,_0x57a6c2){this['_getOperationsFromInitData']({[_0x5cf729]:_0x44d069},{[_0x5cf729]:_0x57a6c2})['forEach']((_0x44909c,_0x57b46f)=>{_0x44909c['baseVersion']=this['_document']['version']+_0x57b46f,_0x44909c['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x44909c);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async['_handleInitialConnectionData'](_0x53b4e4,_0x3679af){let _0xd5440c;this['_offset']=_0x53b4e4['offset'];const _0x4e7167=_0x53b4e4['wereChangesApplied']&&!_0x53b4e4['initData'],_0x121639=_0x4e7167?0x0:_0x53b4e4['data']['baseVersion'];if(_0x3679af['forEach'](_0x51171f=>{_0x51171f['_isInit']=!0x0,_0x51171f['createdAt']=_0x53b4e4['sessionCreatedAt'],_0x51171f['_authorId']=null;}),_0x4e7167)_0xd5440c=_0x3679af,this['_applyOperationsSet'](_0xd5440c,_0x4e7167);else{if(_0x53b4e4['initData']){const _0xbf699f=this['_getOperationsFromInitData'](_0x53b4e4['initData']);this['_document']['history']['version']=-_0xbf699f['length'],_0xbf699f['forEach'](_0x4f78b2=>{_0x4f78b2['baseVersion']-=_0xbf699f['length'],_0x4f78b2['createdAt']=_0x53b4e4['sessionCreatedAt'],_0x4f78b2['_isInit']=!0x0,_0x4f78b2['_authorId']=null;}),this['_applyOperationsSet'](_0xbf699f,!0x0),this['serverHistory']['version']=-_0xbf699f['length']+this['_offset'],this['_updateServerHistory'](_0xbf699f);}this['_document']['history']['version']=_0x121639,_0xd5440c=this['_decompressOperations'](_0x53b4e4['data'],_0x53b4e4['metadata']),await this['_fetchMissingUsers'](_0xd5440c),this['_applyOperationsSet'](_0xd5440c,_0x4e7167);}_0x53b4e4['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0xd5440c,_0x53b4e4['lastOperationId']),this['_lastSyncedOperationId']=_0x53b4e4['lastOperationId']),this['serverHistory']['version']=_0x121639+this['_offset'],this['_updateServerHistory'](_0xd5440c),_0x3679af['filter'](_0x3be6af=>{const _0x4a644e=this['_getAffectedRoot'](_0x3be6af);return _0x4a644e&&!this['_knownRootNames']['has'](_0x4a644e);})['forEach']((_0x578bc1,_0x237dec)=>{_0x578bc1['baseVersion']=this['_document']['version']+_0x237dec,this['_saveOperationInBuffer'](_0x578bc1);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x1741cb,_0x12ee20){const _0x1aa126=_0x12ee20&&_0x12ee20['message'];if(_0x1aa126&&_0x1aa126['startsWith']('realtimecollaborationclient'))throw _0x12ee20;const _0x2203e=this['editor']['plugins']['get'](c);throw this['_isPendingUpdate']=!0x0,_0x2203e['disconnect'](),this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0x3ddc56(_0x1741cb,this['editor'],_0x1aa126?{'originalError':_0x1aa126}:void 0x0);}['_saveOperationInBuffer'](_0x18b44b){this['_knownOperations']['has'](_0x18b44b)||(this['_knownOperations']['add'](_0x18b44b),this['_bufferedOperations']['push'](_0x18b44b),this['_pendingAction']||'marker'==_0x18b44b['type']&&!_0x18b44b['affectsData']||this['_setPendingAction']());}['_sendBufferedOperationsDelayed'](_0x5c1637=!0x1){!_0x5c1637&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0x167099=>{_0x167099&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0x2523df=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0x41f862){return _0x41f862['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x41f862['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0x41f862['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0x2523df)||this['_crash'](_0x2523df['message'],_0x2523df);});},this['_currentBufferDelay']));}['_waitUntilSynced'](){return new Promise(_0x175f67=>{this['on']('change:_isPendingUpdate',()=>{_0x175f67();});});}async['_sendBufferedOperations'](){const _0x29dec0=this['editor']['plugins']['get'](B);if(this['_shouldSendSelectionUpdate']()&&(_0x29dec0['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x45ce03=[...this['_bufferedOperations']];for(const _0x12df3c of _0x45ce03)_0x12df3c['wasUndone']=this['_document']['history']['isUndoneOperation'](_0x12df3c);const _0x9c4da1=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x45ce03),_0x5a66a6=F++,_0x13e7ba=this['_compressOperations'](_0x45ce03),_0x22aa60=await this['_service']['sendOperations'](_0x13e7ba,_0x13e7ba['baseVersion'],_0x9c4da1);try{return await this['_handleServerResponse'](_0x45ce03,_0x22aa60,_0x5a66a6);}catch(_0x46cd6c){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0x46cd6c);}}async['_handleServerResponse'](_0xebc9b5,_0x5097fe,_0x3344b5){if('error'in _0x5097fe)throw _0x5097fe['error'];let _0x44e1f5=!0x1;if(_0x5097fe['wereChangesApplied']){_0x5097fe['lastOperationId']&&(this['_lastSyncedOperationId']=_0x5097fe['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x3747be=>!_0xebc9b5['includes'](_0x3747be));for(const _0x5748f5 of _0xebc9b5)_0x5748f5['createdAt']='lastOperationAcceptedAt'in _0x5097fe&&_0x5097fe['lastOperationAcceptedAt']||void 0x0;G(_0xebc9b5,_0x5097fe['version']-_0xebc9b5['length']),this['_updateServerHistory'](_0xebc9b5);const _0x427dcf=_0xebc9b5['filter'](_0x291264=>{if(!_0x291264['_isInit'])return!0x1;const _0x647705=this['_getAffectedRoot'](_0x291264);return _0x647705&&!this['_knownRootNames']['has'](_0x647705);});G(_0x427dcf,this['_document']['version']),this['_applyOperationsSet'](_0x427dcf),_0x44e1f5=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0x16f27c=this['_decompressOperations'](_0x5097fe['data'],_0x5097fe['metadata'])['filter'](_0x5188db=>_0x5188db['baseVersion']>=this['_lastServerVersion']);_0x16f27c['forEach'](_0x487a8b=>this['_addKnownRoot'](_0x487a8b)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x5e4ca2=>!_0x5e4ca2['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x5e4ca2))),this['_bufferedOperations']['length']&&G(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0x16f27c),_0x44e1f5=this['_handleExternalOperations'](_0x16f27c,_0x5097fe['version'],_0x5097fe['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x44e1f5?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}['_handleExternalOperations'](_0x38d1d7,_0x289cab,_0xf0b547){try{const _0x47dbeb={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x378307,operationsB:_0x55f934,originalOperations:_0x42e3b9}=_0x1eec30(_0x38d1d7,this['_bufferedOperations'],_0x47dbeb);G(_0x378307,this['_document']['version']),G(_0x55f934,_0x289cab);for(const _0xc0eb9f of _0x378307){const _0x1210c2=_0x42e3b9['get'](_0xc0eb9f);_0xc0eb9f['_authorId']=_0x1210c2?_0x1210c2['_authorId']:null;}_0xf0b547&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x38d1d7,_0xf0b547),this['_lastSyncedOperationId']=_0xf0b547),this['_bufferedOperations']=[..._0x55f934],this['_applyOperationsSet'](_0x378307),this['_updateServerHistory'](_0x38d1d7);}catch(_0x19385d){return console['error'](_0x19385d),!0x1;}return!0x0;}['_applyOperationsSet'](_0x15218b,_0x31bffb=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0x551773=>{for(const _0x1a6e03 of _0x15218b)this['_knownOperations']['add'](_0x1a6e03),this['_addKnownRoot'](_0x1a6e03),_0x551773['batch']['addOperation'](_0x1a6e03),this['editor']['model']['applyOperation'](_0x1a6e03);});}['_addKnownRoot'](_0x48490f){const _0x1b38b4=this['_getAffectedRoot'](_0x48490f);_0x1b38b4&&this['_knownRootNames']['add'](_0x1b38b4);}['_getAffectedRoot'](_0x36f920){let _0x9bb0db,_0x525562;switch(_0x36f920['type']){case'insert':_0x9bb0db=_0x36f920['position']['root'];break;case'marker':if(_0x525562=_0x36f920['newRange'],!_0x525562)return null;_0x9bb0db=_0x525562['root'];break;case'addRootAttribute':_0x9bb0db=_0x36f920['root'];break;case'addRoot':_0x9bb0db=_0x36f920['affectedSelectable'];break;case'move':_0x9bb0db=_0x36f920['targetPosition']['root'];break;default:return null;}return _0x9bb0db['rootName'];}['_updateServerHistory'](_0x332e6d){_0x332e6d['forEach'](_0xd24213=>{const _0x2b2a95=_0xd24213['clone']();_0x2b2a95['_authorId']=_0xd24213['_authorId'],_0x2b2a95['_isInit']=!!_0xd24213['_isInit'],_0x2b2a95['createdAt']=_0xd24213['createdAt'],_0x2b2a95['baseVersion']+=this['_offset'],_0xd24213['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x2b2a95),this['serverHistory']['addOperation'](_0x2b2a95);});}['_handleReconnectionError'](_0xcc5e9d){const _0x1c4df9=this['editor']['plugins']['get']('Notification'),_0x1db35b=this['editor']['locale'];_0xcc5e9d||(_0xcc5e9d=M(_0x1db35b,'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.')),_0x1c4df9['showWarning'](_0xcc5e9d,{'title':M(_0x1db35b,'Synchronization\x20issue'),'namespace':'real-time-collaboration'}),this['_hasSynchronizationProblem']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_bufferedOperations']=[],this['editor']['plugins']['get'](c)['disconnect']();}['_setPendingAction'](){this['_pendingAction']||(this['_pendingAction']=this['editor']['plugins']['get'](_0x41d3fc)['add'](M(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}['_clearPendingAction'](){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x41d3fc)['remove'](this['_pendingAction']),this['_pendingAction']=null);}['_compressOperations'](_0x1561bc){const _0xc3a7c0=_0x1561bc['map'](_0xd7244c=>_0xd7244c['toJSON']());return this['_compressor']['compress'](_0xc3a7c0);}['_decompressOperations'](_0x464732,_0x13d9ad){return this['_compressor']['decompress'](_0x464732)['map']((_0xff5fc3,_0x23b9e7)=>{const _0x54e489='init'==_0x13d9ad[_0x23b9e7]['type'];if('InsertOperation'==_0xff5fc3['__className']){const _0x252460=_0xff5fc3['position']['root'];!this['_document']['getRoot'](_0x252460)&&(this['_document']['createRoot']('$root',_0x252460)['_isAttached']=!0x1);}const _0x24b1a0=_0x2e4736['fromJSON'](_0xff5fc3,this['_document']);return _0x24b1a0['wasUndone']=_0xff5fc3['wasUndone'],_0x24b1a0['_isInit']=_0x54e489,_0x24b1a0['_authorId']=_0x54e489?null:_0x13d9ad[_0x23b9e7]['userId'],_0x24b1a0['_isDisconnection']='cs:removeUser'===_0x13d9ad[_0x23b9e7]['type'],_0x24b1a0['createdAt']=_0x13d9ad[_0x23b9e7]['createdAt'],_0x24b1a0;});}['_refreshUserSelectionMarkers'](){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}['_shouldSendSelectionUpdate'](){const _0x3819db=this['editor']['plugins']['get'](i)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0x3819db&&_0x3819db['length']>0x1&&this['_hasSelectionChanged'];}['_shouldSendUpdate'](){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}}class q extends Error{}function G(_0x35f4b,_0x3b2bc0){for(const _0x142688 of _0x35f4b)_0x142688['baseVersion']=_0x3b2bc0++;}class ${['_ignoredOperations'];['_operationToId'];constructor(_0x4c36dd){this['_ignoredOperations']=_0x4c36dd,this['_operationToId']=new WeakMap();}['getIdOfTheLastOperation'](_0x2d9b63){let _0x3e3efc=_0x2d9b63['length'];for(;_0x3e3efc--;){const _0x412465=_0x2d9b63[_0x3e3efc];if(!this['_ignoredOperations']['has'](_0x412465)){if(!this['_operationToId']['has'](_0x412465)){const _0x4898df=_0x5cb9c1()['slice'](0x1,0x12);this['_operationToId']['set'](_0x412465,_0x4898df);}return this['_operationToId']['get'](_0x412465);}}}['setIdForTheLastOperation'](_0x51ca5d,_0x1fd6da){if(!_0x1fd6da)return;let _0x22c2d0=_0x51ca5d['length'];for(;_0x22c2d0--;){const _0x5ee39f=_0x51ca5d[_0x22c2d0];this['_ignoredOperations']['has'](_0x5ee39f)||this['_operationToId']['set'](_0x5ee39f,_0x1fd6da);}}}class n extends _0x12cabc{static get['requires'](){return[l];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class a extends _0x191ba5{static ['CommentsService']=/* #__PURE__ -- @preserve */
|
|
26
|
+
((()=>et)());['_services'];static get['requires'](){return[c,'CommentsRepository',i,_0x50fdcb];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x5c1302){super(_0x5c1302),this['_services']=new Map();}async['init'](){const _0x54b16c=this['context'],_0x477940=_0x54b16c['plugins']['get']('CommentsRepository');if(_0x54b16c['plugins']['get'](c)['addToReconnectionStack'](this),_0x477940['adapter']={'addCommentThread':async({channelId:_0x426457,threadId:_0x1623a9,comments:_0x774268,resolvedAt:_0x366eea,resolvedBy:_0x3fb138,context:_0x4d1bdb,attributes:_0x50d4da})=>{const _0x294228=await this['_getService'](_0x426457)['addCommentThread']({'commentThreadId':_0x1623a9,'comments':_0x774268['map'](_0x1cced7=>function(_0x4bd066,_0x4bdb7c,_0x134f9f){return{'commentThreadId':_0x134f9f,'commentId':_0x4bd066['commentId'],'userId':_0x4bd066['authorId'],'content':_0x4bd066['content'],'documentId':_0x4bdb7c,'createdAt':_0x4bd066['createdAt'],'attributes':_0x4bd066['attributes']||{}};}(_0x1cced7,_0x426457,_0x1623a9)),'resolvedAt':_0x366eea,'resolvedBy':_0x3fb138,'context':_0x4d1bdb,'attributes':_0x50d4da})['catch'](wt);return{'threadId':_0x294228['commentThreadId'],'comments':_0x294228['comments']};},'getCommentThread':async({channelId:_0x4c350c,threadId:_0x5c117d})=>{const _0x516b80=await this['_getService'](_0x4c350c)['getCommentThread'](_0x5c117d)['catch'](wt);return _0x516b80['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0x516b80]),{'threadId':_0x516b80['commentThreadId'],'comments':_0x516b80['comments']['map'](st),'context':_0x516b80['context'],'resolvedAt':_0x516b80['resolvedAt'],'resolvedBy':_0x516b80['resolvedBy'],'attributes':_0x516b80['attributes']||{}});},'updateCommentThread':async({channelId:_0x56bc8f,threadId:_0x5c5cab,context:_0x3f69ac,unlinkedAt:_0x2d983e,attributes:_0x565aac})=>this['_getService'](_0x56bc8f)['updateCommentThread']({'commentThreadId':_0x5c5cab,'context':_0x3f69ac,'attributes':_0x565aac,'unlinkedAt':_0x2d983e})['catch'](ot)['catch'](wt),'resolveCommentThread':async({channelId:_0x9ce457,threadId:_0x27d61d})=>{const _0x306272=await this['_getService'](_0x9ce457)['resolveCommentThread'](_0x27d61d)['catch'](ot)['catch'](wt);return{'threadId':_0x306272['commentThreadId'],'resolvedAt':_0x306272['resolvedAt'],'resolvedBy':_0x306272['resolvedBy']};},'reopenCommentThread':async({channelId:_0x563278,threadId:_0x7c3e37})=>this['_getService'](_0x563278)['reopenCommentThread'](_0x7c3e37)['catch'](ot)['catch'](wt),'removeCommentThread':({channelId:_0x2c5222,threadId:_0x55343e})=>this['_getService'](_0x2c5222)['removeCommentThread'](_0x55343e)['catch'](ot)['catch'](wt),'addComment':({channelId:_0x1c53c1,threadId:_0x3ef737,commentId:_0x55abb5,content:_0x1f903b,attributes:_0x335e91})=>this['_getService'](_0x1c53c1)['addComment'](_0x3ef737,_0x55abb5,_0x1f903b,_0x335e91)['catch'](wt),'updateComment':({channelId:_0x2c6feb,threadId:_0x1589fa,commentId:_0x7ef82d,content:_0x415d94,attributes:_0x54c67c})=>this['_getService'](_0x2c6feb)['updateComment'](_0x1589fa,_0x7ef82d,_0x415d94,_0x54c67c)['catch'](ot)['catch'](wt),'removeComment':({channelId:_0x36b238,threadId:_0x5c6491,commentId:_0xc1c712})=>this['_getService'](_0x36b238)['removeComment'](_0x5c6491,_0xc1c712)['catch'](ot)['catch'](wt)},_0x54b16c instanceof tt){const _0x496a58=_0x54b16c['config']['get']('collaboration.channelId'),_0xb22e17=_0x54b16c['plugins']['get'](i);await this['_setUpService'](_0x496a58);const _0x5c5d54=await this['_services']['get'](_0x496a58)['getConnectedSessions']();this['listenTo'](_0xb22e17,'sessionAdd:'+_0x496a58,(_0x5d8aa6,{session:_0x35432d})=>{_0x35432d['id']===_0xb22e17['mySessionId']&&(_0x5d8aa6['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x35432d['permissions'],_0x496a58));}),_0xb22e17['register'](_0x496a58,_0x5c5d54);}}async['_setUpService'](_0x33a29c){if(this['_services']['has'](_0x33a29c))throw new _0x3ddc56('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0x33a29c});const _0x470beb=this['context']['plugins']['get']('CommentsRepository'),_0x168303=new a['CommentsService'](_0x33a29c);this['_services']['set'](_0x33a29c,_0x168303),this['listenTo'](_0x168303,'commentThreadAdded',(_0x34102b,_0x3b5dd1)=>{const {commentThreadId:_0x1838bf,documentId:_0x27d10b,context:_0x56d1f4,attributes:_0x31fcb3,resolvedAt:_0x3a06f1,resolvedBy:_0x1f99e2,comments:_0x7dab21}=_0x3b5dd1;_0x470beb['getCommentThread'](_0x1838bf)||_0x470beb['addCommentThread']({'threadId':_0x1838bf,'channelId':_0x27d10b,'comments':_0x7dab21?_0x7dab21['map'](st):[],'context':_0x56d1f4,'attributes':_0x31fcb3,'resolvedAt':_0x3a06f1,'resolvedBy':_0x1f99e2,'isFromAdapter':!0x0});}),this['listenTo'](_0x168303,'commentThreadUpdated',(_0x142f1c,{commentThreadId:_0x362e68,documentId:_0x5e588c,context:_0x411d37,unlinkedAt:_0x4a1cae,attributes:_0x1a8360})=>{_0x470beb['getCommentThread'](_0x362e68)&&_0x470beb['updateCommentThread']({'threadId':_0x362e68,'channelId':_0x5e588c,'context':_0x411d37,'unlinkedAt':_0x4a1cae,'attributes':_0x1a8360,'isFromAdapter':!0x0});}),this['listenTo'](_0x168303,'commentThreadResolved',(_0x447616,{commentThreadId:_0xb33b2,resolvedBy:_0x48e30b,resolvedAt:_0x51fca6})=>{const _0x45b73b=_0x470beb['getCommentThread'](_0xb33b2);_0x45b73b&&_0x45b73b['resolve']({'resolvedBy':_0x48e30b,'resolvedAt':_0x51fca6,'isFromAdapter':!0x0});}),this['listenTo'](_0x168303,'commentThreadReopened',(_0x316ab8,{commentThreadId:_0x2a9d91})=>{const _0x36f32=_0x470beb['getCommentThread'](_0x2a9d91);_0x36f32&&_0x36f32['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0x168303,'commentThreadRemoved',(_0x1aa89e,{commentThreadId:_0x4245a5})=>{const _0x5dacec=_0x470beb['getCommentThread'](_0x4245a5);_0x5dacec&&_0x5dacec['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0x168303,'commentAdded',(_0x5ca8f5,_0x847461)=>{const _0x20f425=_0x847461['commentThreadId'],_0x2d83c2=_0x470beb['getCommentThread'](_0x20f425);_0x2d83c2&&_0x2d83c2['addComment']({...st(_0x847461),'isFromAdapter':!0x0});}),this['listenTo'](_0x168303,'commentUpdated',(_0x40c0db,{commentThreadId:_0x44ec2c,commentId:_0x315362,content:_0x510201,attributes:_0x5319c4})=>{const _0x1fcafd=_0x470beb['getCommentThread'](_0x44ec2c);if(_0x1fcafd){const _0x54be6d=_0x1fcafd['getComment'](_0x315362);_0x54be6d&&_0x54be6d['update']({'content':_0x510201,'attributes':_0x5319c4,'isFromAdapter':!0x0});}}),this['listenTo'](_0x168303,'commentRemoved',(_0x2cd584,{commentThreadId:_0x366efb,commentId:_0x386748})=>{const _0x40cdda=_0x470beb['getCommentThread'](_0x366efb);if(_0x40cdda){const _0x42e0c4=_0x40cdda['getComment'](_0x386748);_0x42e0c4&&_0x42e0c4['remove']({'isFromAdapter':!0x0});}}),await this['_connectService'](_0x33a29c);}['destroy'](){if(this['context']instanceof tt){const _0x2c13b7=this['context']['config']['get']('collaboration.channelId');this['_terminateService'](_0x2c13b7);}}['_terminateService'](_0x5105ea){if(!this['_services']['has'](_0x5105ea))throw new _0x3ddc56('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0x5105ea});this['_getService'](_0x5105ea)['disconnect'](),this['_services']['delete'](_0x5105ea);}async['reconnect'](){for(const _0x66cd55 of this['_services']['keys']())await this['_connectService'](_0x66cd55);if(this['context']instanceof tt){const _0x4ffaeb=this['context']['config']['get']('collaboration.channelId'),_0x1c27ff=this['context']['plugins']['get'](i);_0x1c27ff['unregister'](_0x4ffaeb);const _0x51864c=await this['_services']['get'](_0x4ffaeb)['getConnectedSessions']();_0x1c27ff['register'](_0x4ffaeb,_0x51864c);}}async['_connectService'](_0xd58324){const {connection:_0xa2df8}=this['context']['plugins']['get'](c),_0x31f715=this['context']['plugins']['get']('CommentsRepository'),_0x3cbeb0=this['_services']['get'](_0xd58324),_0xfb33dd=await _0x3cbeb0['connect'](_0xa2df8);await this['_fetchMissingUsersForThreads'](_0xfb33dd);const _0x2d8e6a=new Set(Array['from'](_0x31f715['getCommentThreads']({'channelId':_0xd58324}),_0x4067d0=>_0x4067d0['id']));for(const _0x2b0bdd of _0xfb33dd)_0x2b0bdd['deletedAt']||_0x2d8e6a['delete'](_0x2b0bdd['commentThreadId']);for(const _0x251151 of _0x2d8e6a)_0x31f715['getCommentThread'](_0x251151)['remove']({'isFromAdapter':!0x0});for(const _0x2aeb58 of _0xfb33dd){let _0x164a4d=_0x31f715['getCommentThread'](_0x2aeb58['commentThreadId']);const {commentThreadId:_0x5740c0,context:_0x4e3ef4,attributes:_0x40cf29,resolvedBy:_0x1cb8f0,resolvedAt:_0x489ad7,unlinkedAt:_0x5db607,deletedAt:_0x1dbf5e}=_0x2aeb58;if(_0x1dbf5e)continue;_0x164a4d||(_0x164a4d=_0x31f715['addCommentThread']({'channelId':_0xd58324,'threadId':_0x5740c0,'context':_0x4e3ef4,'attributes':_0x40cf29||{},'resolvedBy':_0x1cb8f0,'resolvedAt':_0x489ad7,'unlinkedAt':_0x5db607,'isFromAdapter':!0x0}));const _0x21bf57=new Set(Array['from'](_0x164a4d['comments'],_0x6a92c9=>_0x6a92c9['id']));for(const _0x39958d of _0x2aeb58['comments'])_0x21bf57['delete'](_0x39958d['commentId']);for(const _0xf523e7 of _0x21bf57)_0x164a4d['getComment'](_0xf523e7)['remove']({'isFromAdapter':!0x0});for(const _0x3f5d75 of _0x2aeb58['comments']){const _0x46b91b=_0x164a4d['getComment'](_0x3f5d75['commentId']);_0x46b91b?_0x46b91b['content']!==_0x3f5d75['content']&&_0x46b91b['update']({'content':_0x3f5d75['content'],'isFromAdapter':!0x0}):_0x164a4d['addComment'](Object['assign'](st(_0x3f5d75),{'isFromAdapter':!0x0}));}}}['_getService'](_0x365e3e){if(!this['_services']['has'](_0x365e3e))throw new _0x3ddc56('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0x365e3e});return this['_services']['get'](_0x365e3e);}async['_fetchMissingUsersForThreads'](_0x2cbddb){const _0x14bbc1=this['context']['plugins']['get'](_0x50fdcb),{connection:_0x2b5f5e}=this['context']['plugins']['get'](c),_0x2d95e9=new Set();for(const {resolvedBy:_0x2bc230,comments:_0x3a486a}of _0x2cbddb){_0x2bc230&&!_0x14bbc1['getUser'](_0x2bc230)&&_0x2d95e9['add'](_0x2bc230);for(const {userId:_0x47e22c}of _0x3a486a)_0x14bbc1['getUser'](_0x47e22c)||_0x2d95e9['add'](_0x47e22c);}if(0x0===_0x2d95e9['size'])return;const _0x3ae57a=await gt['getMany'](_0x2b5f5e,Array['from'](_0x2d95e9));for(const _0x590f9f of _0x3ae57a)_0x14bbc1['getUser'](_0x590f9f['id'])||_0x14bbc1['addUser'](_0x590f9f);}}async function ot(_0xdbc04c){if('404'!==_0xdbc04c['code'])throw _0xdbc04c;}function wt(_0x98edb3){if((_0x3d725c=_0x98edb3)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0x3d725c['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x3d725c['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0x3d725c;throw _0x98edb3;}function st(_0x1eab5e){return{'threadId':_0x1eab5e['commentThreadId'],'commentId':_0x1eab5e['commentId'],'content':_0x1eab5e['content'],'createdAt':_0x1eab5e['createdAt'],'authorId':_0x1eab5e['userId'],'attributes':_0x1eab5e['attributes']||{}};}class f extends _0x12cabc{static ['TrackChangesService']=/* #__PURE__ -- @preserve */
|
|
27
|
+
((()=>at)());['_bufferedRequests'];['_trackChangesService'];static get['requires'](){return[a,'TrackChangesEditing',c];}static get['pluginName'](){return'CloudServicesTrackChangesAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x43f583){super(_0x43f583);const _0x31f057=this['editor']['config']['get']('collaboration.channelId');this['_bufferedRequests']=new Map(),this['_trackChangesService']=new f['TrackChangesService'](_0x31f057);}['init'](){const _0x4b327e=this['editor']['plugins']['get'](c),_0x13a170=this['editor']['plugins']['get']('TrackChangesEditing');return _0x13a170['adapter']={'getSuggestion':async _0x32f2c9=>{await this['_waitForServiceReady']();const _0x434623=await this['_trackChangesService']['get'](_0x32f2c9)['catch'](nt);return await this['_fetchMissingUsersForThreads']([_0x434623]),_0x434623;},'addSuggestion':async({id:_0xdbeb1f,type:_0x2b519e,data:_0xc6b56d,originalSuggestionId:_0x47eb46,attributes:_0x1bb528})=>{await this['_waitForServiceReady']();const _0x2d0f50={'id':_0xdbeb1f,'type':_0x2b519e,'data':_0xc6b56d,'originalSuggestionId':_0x47eb46,'attributes':_0x1bb528},_0x3754ac=await this['_trackChangesService']['add'](_0xdbeb1f,_0x2b519e,_0xc6b56d,_0x47eb46,_0x1bb528)['catch'](_0x1acc59=>{if(vt(_0x1acc59))return new Promise(_0x53e1c9=>{this['_bufferedRequests']['set'](_0xdbeb1f,{'resolve':_0x53e1c9,'suggestionData':_0x2d0f50});});throw _0x1acc59;});return this['_bufferedRequests']['delete'](_0xdbeb1f),_0x3754ac;},'updateSuggestion':async(_0x38f6e3,_0x4e6f9a)=>{if(await this['_waitForServiceReady'](),'open'!==_0x4e6f9a['state'])return this['_trackChangesService']['update'](_0x38f6e3,_0x4e6f9a)['catch'](nt);}},this['listenTo'](this['_trackChangesService'],'suggestionUpdated',(_0x29f302,_0x2d03c0)=>{_0x13a170['hasSuggestion'](_0x2d03c0['id'])&&(_0x13a170['getSuggestion'](_0x2d03c0['id'])['attributes']=_0x2d03c0['attributes']);}),this['_trackChangesService']['connect'](_0x4b327e['connection'])['then'](_0x3693df=>(_0x4b327e['addToReconnectionStack'](this),this['_fetchMissingUsersForThreads'](_0x3693df)['then'](()=>{for(const _0x2cf77e of _0x3693df){_0x13a170['addSuggestionData'](_0x2cf77e)['_saved']=!0x0;}})));}async['reconnect'](){const _0x261998=this['editor']['plugins']['get']('TrackChangesEditing'),{connection:_0x4d1e0c}=this['editor']['plugins']['get'](c),_0x426949=await this['_trackChangesService']['connect'](_0x4d1e0c);await this['_fetchMissingUsersForThreads'](_0x426949);for(const {suggestionData:_0x25c2f3,resolve:_0x1903cd}of this['_bufferedRequests']['values']()){let _0x3d191b=_0x426949['find'](_0x4002b4=>_0x4002b4['id']===_0x25c2f3['id']);_0x3d191b||(_0x3d191b=await this['_trackChangesService']['add'](_0x25c2f3['id'],_0x25c2f3['type'],_0x25c2f3['data'],_0x25c2f3['originalSuggestionId'])),_0x1903cd(_0x3d191b);}for(const _0x388430 of _0x426949)_0x261998['hasSuggestion'](_0x388430['id'])||_0x261998['addSuggestionData'](_0x388430);}async['_waitForServiceReady'](){this['_trackChangesService']['isConnected']||await new Promise(_0x5f1cee=>{this['listenTo'](this['_trackChangesService'],'connected',_0x573346=>{_0x573346['off'](),_0x5f1cee();});});}async['_fetchMissingUsersForThreads'](_0x54e1bb){const _0x4de367=this['editor']['plugins']['get'](_0x50fdcb),{connection:_0x5cce75}=this['editor']['plugins']['get'](c),_0x3f17d1=new Set();for(const {authorId:_0x2c07f3}of _0x54e1bb)_0x4de367['getUser'](_0x2c07f3)||_0x3f17d1['add'](_0x2c07f3);if(0x0===_0x3f17d1['size'])return;const _0x291a1f=await gt['getMany'](_0x5cce75,Array['from'](_0x3f17d1));for(const _0x540218 of _0x291a1f)_0x4de367['getUser'](_0x540218['id'])||_0x4de367['addUser'](_0x540218);}}function nt(_0x3767ff){if(vt(_0x3767ff))return new Promise(()=>{});throw _0x3767ff;}function vt(_0xa1a062){return _0xa1a062['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0xa1a062['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class m extends _0x12cabc{static get['requires'](){return['Comments',a,n,c];}static get['pluginName'](){return'RealTimeCollaborativeComments';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x2e2bd3=this['editor']['plugins']['get'](c),_0x4debe8=this['editor']['plugins']['get']('CommentsEditing'),_0x17e7a8=this['editor']['plugins']['get'](a);return this['editor']['data']['once']('ready',()=>{this['listenTo'](_0x2e2bd3,'change:state',(_0x2e3e81,_0x251bac,_0x101a5a)=>{_0x4debe8['isThreadsLoadingPaused']='connected'!==_0x101a5a;});}),this['listenTo'](_0x2e2bd3,'change:state',(_0x3ce81f,_0x19b457,_0x1a2fbe)=>{this['editor']['plugins']['get']('CommentsRepository')['switchReadOnly']('connected'!==_0x1a2fbe);}),_0x17e7a8['_setUpService'](this['editor']['config']['get']('collaboration.channelId'));}['destroy'](){this['editor']['plugins']['get'](a)['_terminateService'](this['editor']['config']['get']('collaboration.channelId')),super['destroy']();}}class p extends _0x12cabc{static get['requires'](){return[m,f,'TrackChanges'];}static get['pluginName'](){return'RealTimeCollaborativeTrackChanges';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class u extends _0x12cabc{static ['RevisionHistoryService']=/* #__PURE__ -- @preserve */
|
|
28
|
+
((()=>rt)());['_lastRequestId'];['_revisionTracker'];['_revisionHistoryService'];['_oldOffset'];static get['requires'](){return[c,l,'RevisionHistory',i,_0x50fdcb];}static get['pluginName'](){return'CloudServicesRevisionHistoryAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0xb54c3f){super(_0xb54c3f);const _0x540578=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new u['RevisionHistoryService'](_0x540578);}async['init'](){const _0x287532=this['editor']['plugins']['get'](l),_0x478d4d=_0x287532['serverHistory'],_0x1cccb0=this['editor']['plugins']['get'](c);this['_revisionTracker']['setSource']({'history':_0x478d4d,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0x287532['sessionId']});const _0x3a9670=this['editor']['config']['get']('cloudServices.bundleVersion')||ht,_0x1bfeb0=await it['isBundleUploaded'](_0x1cccb0['connection'],_0x3a9670);this['editor']['plugins']['get']('RevisionHistory')['adapter']={'getRevision':async({revisionId:_0x207a44})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0x207a44)),'updateRevisions':async _0x3349b9=>{await this['_waitForServiceReady']();const _0xb7cf65=this['_revisionTracker']['currentRevision'];if(_0x1bfeb0&&0x1===_0x3349b9['length']&&_0x3349b9[0x0]['id']===_0xb7cf65['id'])return _0x3349b9;for(const _0x1c32db of _0x3349b9)_0x1c32db['id']===_0xb7cf65['id']&&(_0x1c32db['isEmptyCurrent']=_0x1c32db['fromVersion']===_0x1c32db['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0x3349b9,this['_lastRequestId'])['then'](_0x5c4f50=>(this['_lastRequestId']=_0x5c4f50,_0x3349b9))['catch'](_0x10da0e=>{if(ct(_0x10da0e)||'400'===_0x10da0e['code']&&void 0x0!==_0x10da0e['data']['wrongRequestId']){for(const _0x1d5495 of _0x3349b9){!this['_revisionTracker']['repository']['getRevision'](_0x1d5495['id'])||this['_revisionTracker']['_bufferUpdate'](_0x1d5495['id'],_0x1d5495,!0x1);}if(ct(_0x10da0e))throw _0x10da0e;return _0x3349b9;}throw _0x10da0e;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0x38c900,{revisionsData:_0x135092,requestId:_0x2e86bc})=>{Math['max'](..._0x135092['map'](_0x21df5b=>_0x21df5b['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0x135092,_0x2e86bc);}):this['_handleRevisionsUpdate'](_0x135092,_0x2e86bc);});const {revisions:_0xac93e4,requestId:_0x2a1a9e}=await this['_revisionHistoryService']['connect'](_0x1cccb0['connection']);_0x1cccb0['addToReconnectionStack'](this),this['_lastRequestId']=_0x2a1a9e,await this['_fetchMissingUsers'](_0xac93e4);for(const _0x53dfbd of _0xac93e4)this['_revisionTracker']['addRevisionData'](_0x53dfbd);this['listenTo'](_0x287532,'change:_isConnected',(_0x3c49eb,_0x23c540,_0x451555)=>{_0x451555&&(this['_oldOffset']=_0x287532['_offset'],_0x3c49eb['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](_0x1cccb0,'state',_0x444d04=>_0x444d04===_0x1f4b62['CONNECTED']);}async['reconnect'](){const _0x515f0e=this['editor']['plugins']['get'](c),_0x5592f8=this['editor']['plugins']['get'](l),_0x5d7312=async()=>{const _0x5af11c=this['_revisionTracker']['currentRevision'],_0x2f0985=_0x5af11c['id'],_0x4f371c=_0x2f0985!==_0x5592f8['sessionId'];if(_0x4f371c){const _0x4d20c2=_0x5592f8['_offset']-this['_oldOffset'],_0x364e67=this['_getLatestVersionFromServerOperations']();this['_revisionTracker']['_revisionDataBuilder']['reInit']();if(_0x5af11c['toVersion']+_0x4d20c2!==_0x364e67){const _0x3e0951=_0x5af11c['fromVersion']+_0x4d20c2,_0x3a3303=this['editor']['plugins']['get'](_0x50fdcb),_0x3f28fc=this['_revisionTracker']['buildRevisionData']({'revision':_0x5af11c,'from':_0x3e0951,'to':_0x364e67});_0x3f28fc['id']=_0x5af11c['id'];const _0x326dc5=_0x3f28fc['authorsIds']['map'](_0x506d10=>_0x3a3303['getUser'](_0x506d10));_0x5af11c['_update']({..._0x3f28fc,'authors':_0x326dc5},!0x0),this['_revisionTracker']['_bufferUpdate'](_0x5af11c['id'],_0x3f28fc,!0x0);}this['_revisionTracker']['_startingVersion']=_0x364e67,(_0x5af11c['toVersion']===_0x5af11c['fromVersion']&&!this['_revisionTracker']['_bufferedUpdates']['has'](_0x2f0985)&&this['_revisionTracker']['repository']['_revisions']['remove'](_0x2f0985),this['_revisionTracker']['_createCurrentRevision'](_0x364e67));}const {revisions:_0x37457b,requestId:_0x399ca3}=await this['_revisionHistoryService']['reconnect'](_0x515f0e['connection'],this['_lastRequestId']);_0x4f371c&&_0x37457b['length']>0x0?_0x5592f8['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x37457b),this['_handleRevisionsUpdate'](_0x37457b,_0x399ca3),this['_revisionTracker']['sendBufferedUpdates']());};return _0x5592f8['_isConnected']?_0x5d7312():new Promise((_0x21e202,_0x5ccae7)=>{_0x5592f8['once']('change:_isConnected',()=>{_0x5d7312()['then'](_0x21e202)['catch'](_0x5ccae7);});});}['destroy'](){super['destroy']();}async['_waitForServiceReady'](){this['_revisionHistoryService']['isConnected']||await new Promise(_0x3e8745=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x56b41b=>{_0x56b41b['off'](),_0x3e8745();});});}['_getLatestVersionFromServerOperations'](){const _0x41314a=this['editor']['plugins']['get'](l)['serverHistory']['getOperations']()['reverse']();for(const _0x418daa of _0x41314a)if('marker'!==_0x418daa['type']||_0x418daa['affectsData'])return _0x418daa['baseVersion']+0x1;}['_getLatestVersion'](){const _0x28e182=this['editor']['plugins']['get'](l);return new Promise(_0x24ce2b=>{_0x28e182['_isPendingUpdate']?_0x28e182['once']('change:_isPendingUpdate',()=>{_0x24ce2b(this['_getLatestVersionFromServerOperations']());}):_0x24ce2b(this['_getLatestVersionFromServerOperations']());});}['_handleRevisionsUpdate'](_0x155188,_0x5cdf82){const _0x495d36=this['_revisionTracker']['repository'];this['_lastRequestId']=_0x5cdf82;for(const _0x1fb6a7 of _0x155188){const _0x25be47=_0x495d36['getRevision'](_0x1fb6a7['id']);if(_0x25be47){if((_0x1fb6a7['fromVersion']||_0x1fb6a7['toVersion'])&&(_0x1fb6a7['diffData']=null),_0x25be47===this['_revisionTracker']['currentRevision']){const _0x574f18=Math['max'](_0x25be47['toVersion'],_0x1fb6a7['toVersion']),_0xbe4282=Math['max'](_0x25be47['fromVersion'],_0x1fb6a7['fromVersion']);let _0x1afe65;_0x25be47['toVersion']===_0x1fb6a7['toVersion']&&_0x25be47['fromVersion']===_0x1fb6a7['fromVersion']?(_0x1afe65=!0x0,this['_preventResendingRevisionData'](_0x1fb6a7)):_0x1fb6a7['toVersion']===_0x574f18&&_0x1fb6a7['fromVersion']===_0xbe4282?_0x1afe65=!0x1:(_0x25be47['toVersion']===_0x574f18&&_0x25be47['fromVersion']===_0xbe4282||this['_fixRevision']({'revision':_0x25be47,'from':_0xbe4282,'to':_0x574f18}),_0x1afe65=!0x0),_0x1afe65&&(delete _0x1fb6a7['fromVersion'],delete _0x1fb6a7['toVersion'],delete _0x1fb6a7['diffData'],delete _0x1fb6a7['createdAt'],delete _0x1fb6a7['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0x1fb6a7),this['_preventResendingRevisionData'](_0x1fb6a7);}else this['_revisionTracker']['addRevisionData'](_0x1fb6a7);}const _0x21c416=_0x495d36['getRevisions']();_0x21c416['reverse']();for(let _0x51883b=0x0;_0x51883b<_0x21c416['length']-0x1;_0x51883b++){const _0x46dc39=_0x21c416[_0x51883b],_0x5f22bc=_0x21c416[_0x51883b+0x1];if(_0x46dc39['fromVersion']<_0x5f22bc['toVersion']){const _0x4c5dde=_0x5f22bc['toVersion'],_0x3dc173=Math['max'](_0x4c5dde,_0x46dc39['toVersion']);this['_fixRevision']({'revision':_0x46dc39,'from':_0x4c5dde,'to':_0x3dc173});}}}['_fixRevision']({revision:_0x40da1c,from:_0x4abbbe,to:_0x2c4817}={}){const _0x5390bf=this['editor']['plugins']['get'](_0x50fdcb),_0x4d2c4c=this['_revisionTracker']['buildRevisionData']({'revision':_0x40da1c,'from':_0x4abbbe,'to':_0x2c4817});_0x4d2c4c['authors']=_0x4d2c4c['authorsIds']['map'](_0x165df9=>_0x5390bf['getUser'](_0x165df9)),_0x40da1c['_update'](_0x4d2c4c);}['_preventResendingRevisionData'](_0x35c385){const _0x32f9e4={};_0x32f9e4['id']=_0x35c385['id'];for(const _0x4c71c3 of Object['keys'](_0x35c385))'id'!==_0x4c71c3&&(_0x32f9e4[_0x4c71c3]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0x32f9e4['id'],_0x32f9e4,!0x0);}async['_fetchMissingUsers'](_0x480cbc){const _0x28c9f9=this['editor']['plugins']['get'](_0x50fdcb),{connection:_0x47892d}=this['editor']['plugins']['get'](c),_0x597be4=new Set();for(const _0x507ac5 of _0x480cbc){for(const _0x44e6ba of _0x507ac5['authorsIds'])_0x5312c5(_0x44e6ba);_0x507ac5['creatorId']&&_0x5312c5(_0x507ac5['creatorId']);}if(0x0===_0x597be4['size'])return;const _0x29e347=await gt['getMany'](_0x47892d,Array['from'](_0x597be4));for(const _0x41b4b4 of _0x29e347)_0x28c9f9['getUser'](_0x41b4b4['id'])||_0x28c9f9['addUser'](_0x41b4b4);function _0x5312c5(_0x4b8b45){_0x28c9f9['getUser'](_0x4b8b45)||_0x597be4['add'](_0x4b8b45);}}}function ct(_0x3c2180){return _0x3c2180['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0x3c2180['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x3c2180['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class g extends _0x12cabc{static get['requires'](){return['RevisionHistory',u,n];}static get['pluginName'](){return'RealTimeCollaborativeRevisionHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class A extends _0x58240d{['_collapseAt'];constructor(_0x544c6c,_0x1449c1=0x6){super(_0x544c6c);const _0x8f09b6=this['bindTemplate'];this['set']('isHidden',!0x0),this['set']('usersCount',0x0),this['_collapseAt']=_0x1449c1,this['bind']('isHidden')['to'](this,'usersCount',_0x5a9a57=>_0x5a9a57<_0x1449c1),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item',_0x8f09b6['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':_0x8f09b6['to']('usersCount',_0x433cd9=>'+'+(_0x433cd9-this['_collapseAt']+0x2)['toString']())}]}]}]});}}class ts extends _0x58240d{['items'];['keystrokes'];constructor(_0x5e04a8){super(_0x5e04a8);const _0xebec5=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0x4733e4(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0xebec5['if']('hasPopup'),'aria-expanded':_0xebec5['to']('isExpanded',_0x473e2d=>this['hasPopup']&&String(_0x473e2d)),'aria-label':_0xebec5['to']('hasPopup',_0x1c0800=>M(_0x5e04a8,_0x1c0800?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0xebec5['to']('hasPopup',_0x1f95bf=>!!_0x1f95bf&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items'],'on':{'mouseenter':_0xebec5['to'](()=>this['fire']('presencelist:show')),'mouseleave':_0xebec5['to'](_0x1e21e7=>{const _0x40e074=_0x1e21e7,_0x336f31=document['querySelector']('.ck-presence-list__dropdown-list'),_0x329994=document['querySelector']('.ck-balloon-panel_with-arrow');_0x336f31?.['contains'](_0x40e074['relatedTarget'])||_0x329994?.['contains'](_0x40e074['relatedTarget'])||this['fire']('presencelist:hide');})}}),this['on']('change:hasPopup',(_0x204323,_0x4dfdac,_0x970297)=>{this['element']&&(_0x970297?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 j extends _0x58240d{['counterView'];['inlineListView'];constructor(_0x3a7a00,_0x1b7ae1=0x6){super(_0x3a7a00);const _0x241f54=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new A(this['locale'],_0x1b7ae1),this['inlineListView']=new ts(_0x3a7a00),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x4a7202 of this['inlineListView']['items'])_0x4a7202['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',_0x241f54['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['inlineListView']]});}}class x extends _0x58240d{['listWrapperView'];constructor(_0x507e32,_0x367735){super(_0x507e32);const _0x3d54c1=this['bindTemplate'];this['listWrapperView']=new _t(_0x507e32,_0x367735),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':M(_0x507e32,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']],'on':{'mouseleave':_0x3d54c1['to'](_0x2ecbcf=>{const _0x284f6c=_0x2ecbcf,_0x3136bb=document['querySelector']('.ck-presence-list__list'),_0x484162=document['querySelector']('.ck-balloon-panel_with-arrow');_0x3136bb?.['contains'](_0x284f6c['relatedTarget'])||_0x484162?.['contains'](_0x284f6c['relatedTarget'])||this['fire']('presencelist:hide');})}});}}class _t extends _0x5f11c8{constructor(_0x59b12f,_0x15ca8d){super(_0x59b12f);const _0x16859a=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0x15ca8d?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0x16859a['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0x16859a['to']('role'),'aria-label':_0x16859a['to']('ariaLabel'),'aria-labelledby':_0x16859a['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0x1686f2['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0x30d908=this['element'];_0x30d908&&(this['_isScrollable']=Math['max'](_0x30d908['scrollHeight'],_0x30d908['clientHeight'])>0.8*window['innerHeight']);}}class k extends lt{['userView'];constructor(_0x30710b,_0x32f64e,_0x95afe6){super(_0x30710b);const _0x5210ac=this['bindTemplate'];this['userView']=new ut(_0x30710b,_0x32f64e);const _0x4953d9={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0x32f64e['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0x32f64e['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x32f64e['color']['getBackgroundColorClass']()],'aria-hidden':'true'}}]};_0x95afe6&&(_0x4953d9['tag']='button',_0x4953d9['on']={'click':_0x5210ac['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x4953d9);}['focus'](){this['element']['focus']();}}class y extends _0x58240d{['userView'];['markerView'];constructor(_0x3a3989,_0x3d1633,_0x3af8eb){super(_0x3a3989);const _0x1f09ac=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new ut(_0x3a3989,_0x3d1633),this['markerView']=new dt(_0x3a3989,_0x3d1633);const _0x1d8848=new pt(_0x3a3989);_0x1d8848['template']['tag']='span',_0x1d8848['text']=_0x3d1633['name'];const _0x336676={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0x1f09ac['to']('isFocusable',_0x42cbd5=>!!_0x42cbd5&&0x0),'aria-labelledby':_0x1d8848['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0x1f09ac['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0x1f09ac['to']('hasTooltip',_0x597900=>!_0x597900),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0x1d8848]};_0x3af8eb&&(_0x336676['tag']='button',_0x336676['on']={'click':_0x1f09ac['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x336676);}}class dt extends _0x58240d{constructor(_0x59dafc,_0xb3c143){super(_0x59dafc),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0xb3c143['color']['getBackgroundColorClass']()],'aria-hidden':'true'}});}}const C={'collapseAt':0x6,'displayMe':!0x0};class r extends _0x191ba5{['currentDisplayedUsers'];['balloonPanelView'];['view'];['presenceDropdownView'];['_bodyCollection']=null;static get['pluginName'](){return'PresenceListUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x12ee77){super(_0x12ee77),this['context']['config']['define']('presenceList',C);const _0x1739a8=_0x12ee77['config']['get']('presenceList.collapseAt');if('number'!=typeof _0x1739a8)throw new _0x3ddc56('presencelist-collapseat-invalid-format',this);if(_0x1739a8<0x1)throw new _0x3ddc56('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](i)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0x4b426b(),this['balloonPanelView']=new _0x5d639d(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get['requires'](){return[i];}['init'](){for(const _0x341c5f of this['_allConnectedUsers'])this['_handleUserAdd'](_0x341c5f);this['listenTo'](this['_allConnectedUsers'],'add',(_0x46afa1,_0x47d2b6)=>{this['_handleUserAdd'](_0x47d2b6);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0x48e0da,_0x26fc9e)=>{this['_handleUserRemove'](_0x26fc9e);});}['_createView'](){const _0x171367=this['context'],_0xd40fe5=new j(this['context']['locale'],this['context']['config']['get']('presenceList.collapseAt')),_0x3fb582=this['balloonPanelView'];if(!_0x3744a5(_0x171367['config']['get']('presenceList.container')))throw new _0x3ddc56('presencelist-missing-container',this);return _0xd40fe5['counterView']['bind']('usersCount')['to'](this),_0xd40fe5['bind']('isCollapsed')['to'](this,'usersCount',_0x4702fa=>{const {collapseAt:_0x5532a3}=_0x171367['config']['get']('presenceList'),_0x3d0d32=_0x4702fa>=_0x5532a3;if(_0x3d0d32&&!_0xd40fe5['inlineListView']['items']['find'](_0x2dd9b3=>_0x2dd9b3 instanceof A)){const _0x46eb74=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['currentDisplayedUsers']['length']==_0x46eb74&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](this['currentDisplayedUsers']['length']-0x1),_0xd40fe5['inlineListView']['items']['add'](_0xd40fe5['counterView']);}return _0x3d0d32||this['hideDropdown'](),_0x3d0d32;}),_0xd40fe5['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0xbef49b=>{const _0x2ccaa8=_0x171367['config']['get']('presenceList'),_0x476433=new y(_0x171367['locale'],_0xbef49b,!!_0x2ccaa8['onClick']);return _0x476433['bind']('hasTooltip')['to'](_0xd40fe5,'isCollapsed',_0x4c9e05=>!_0x4c9e05),_0x476433['bind']('isFocusable')['to'](_0xd40fe5,'isCollapsed',_0x228914=>!_0x228914),_0x2ccaa8['onClick']&&this['listenTo'](_0x476433,'execute',()=>{this['view']['isCollapsed']||_0x2ccaa8['onClick'](_0xbef49b,_0x476433['element']);}),_0x476433;}),this['listenTo'](_0xd40fe5['inlineListView'],'presencelist:show',()=>{this['view']['isCollapsed']&&this['showDropdown']();}),this['listenTo'](_0xd40fe5['inlineListView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();}),_0xd40fe5['inlineListView']['keystrokes']['set']('Enter',(_0xda4ea4,_0x1de983)=>{this['view']['isCollapsed']&&(this['showDropdown'](),_0x1de983());}),_0xd40fe5['render'](),_0x3fb582['render'](),_0x1b51db({'emitter':_0xd40fe5,'activator':()=>_0x3fb582['isVisible'],'contextElements':[_0x3fb582['element'],_0xd40fe5['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0x171367['config']['get']('presenceList.container')['appendChild'](_0xd40fe5['element']),this['_bodyCollection']=new _0x1d3b66(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_bodyCollection']['add'](this['balloonPanelView']),_0xd40fe5;}['_handleUserAdd'](_0x3156f5){if(!this['context']['config']['get']('presenceList.displayMe')&&_0x3156f5['isMe'])return;const _0x49e39d=this['context']['config']['get']('presenceList.collapseAt')-0x1;for(this['usersCount']++;this['currentDisplayedUsers']['length']>=_0x49e39d-(this['view']['isCollapsed']?0x1:0x0)&&this['currentDisplayedUsers']['length']>0x1;)this['currentDisplayedUsers']['remove'](0x1);const _0x432382=_0x3156f5['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0x3156f5,_0x432382);}['_handleUserRemove'](_0x3ac85d){this['usersCount']--;const {collapseAt:_0x15fce2}=this['context']['config']['get']('presenceList'),_0x2e49d3=this['usersCount']>=_0x15fce2;if(this['currentDisplayedUsers']['get'](_0x3ac85d['id']))this['currentDisplayedUsers']['remove'](_0x3ac85d['id']);else{if(_0x2e49d3&&this['currentDisplayedUsers']['length']+0x1===_0x15fce2-0x1)return;}if(this['currentDisplayedUsers']['length']+(_0x2e49d3?0x1:0x0)<this['usersCount']){for(const _0x24ba97 of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0x24ba97['id'])&&(this['currentDisplayedUsers']['add'](_0x24ba97,Math['min'](this['currentDisplayedUsers']['length']-(_0x2e49d3?0x1:0x0),0x1)),this['currentDisplayedUsers']['length']+(_0x2e49d3?0x1:0x0)===_0x15fce2-0x1))return;}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0x551f5b=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new x(this['context']['locale'],!!_0x551f5b['onClick']),this['view']['inlineListView']['isExpanded']=!0x0,this['listenTo'](this['presenceDropdownView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();});const {listWrapperView:_0x32f8a8}=this['presenceDropdownView'];_0x32f8a8['items']['bindTo'](this['_allConnectedUsers'])['using'](_0x2b91ab=>{if(!_0x551f5b['displayMe']&&_0x2b91ab['isMe'])return null;const _0x5f0177=new k(this['context']['locale'],_0x2b91ab,!!_0x551f5b['onClick']);return _0x551f5b['onClick']&&this['listenTo'](_0x5f0177,'execute',()=>{_0x551f5b['onClick'](_0x2b91ab,_0x5f0177['element']);}),_0x5f0177;}),this['balloonPanelView']['content']['add'](this['presenceDropdownView']),this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element']}),_0x32f8a8['focus'](),_0x32f8a8['checkIfScrollable']();const _0x2569e6=(_0xc980dc,_0x267d5c)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0x267d5c();};_0x32f8a8['keystrokes']['set']('Esc',_0x2569e6),_0x32f8a8['keystrokes']['set']('Shift+Tab',_0x2569e6),_0x32f8a8['keystrokes']['set']('Tab',(_0x2ef6bc,_0x754437)=>{!function(_0x32dbc4){const _0x6f3cf2=['a','button','input','select','textarea','[tabindex]','[contenteditable]']['map'](_0xca6efa=>_0xca6efa+':not([disabled]):not([tabindex=\x22-1\x22])')['join'](','),_0x20d2da=[...document['body']['querySelectorAll'](_0x6f3cf2)]['filter'](_0x2e32be=>_0x2e32be===document['activeElement']||_0x2e32be['offsetWidth']+_0x2e32be['offsetHeight']>0x0)['sort']((_0xe4272f,_0x5131c1)=>(_0xe4272f['tabIndex']||0x0)-(_0x5131c1['tabIndex']||0x0)),_0x5e3e29=_0x20d2da['indexOf'](_0x32dbc4),_0x2072b8=_0x20d2da[(_0x5e3e29+0x1)%_0x20d2da['length']];_0x2072b8&&_0x2072b8['focus']();}(this['view']['element']),this['hideDropdown'](),_0x754437();}),_0x32f8a8['focusTracker']['add'](this['view']['element']),_0x32f8a8['focusTracker']['on']('change:isFocused',(_0x194f37,_0x3f46b1,_0x29dcd3)=>{_0x29dcd3||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 s extends _0x191ba5{static get['requires'](){return[i,r];}static get['pluginName'](){return'PresenceList';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}export{a as CloudServicesCommentsAdapter,u as CloudServicesRevisionHistoryAdapter,f as CloudServicesTrackChangesAdapter,s as PresenceList,r as PresenceListUI,l as RealTimeCollaborationClient,m as RealTimeCollaborativeComments,n as RealTimeCollaborativeEditing,g as RealTimeCollaborativeRevisionHistory,p as RealTimeCollaborativeTrackChanges,i as Sessions};
|