UNPKG

@ckeditor/ckeditor5-collaboration-core

Version:

Base utilities used by CKEditor 5 collaboration features to support multiple users working together in a rich text editor.

23 lines • 22.6 kB
/* * Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved. * * * * * +---------------------------------------------------------------------------------+ * | | * | Hello stranger! | * | | * | | * | What you're currently looking at is the source code of a legally protected, | * | proprietary software. Any attempts to deobfuscate / disassemble this code | * | are forbidden and will result in legal consequences. | * | | * | | * +---------------------------------------------------------------------------------+ * * * * */ import{ContextPlugin as _0x30556f,Editor as _0x4e591f}from'@ckeditor/ckeditor5-core/dist/index.js';import{CKEditorError as _0x51afc3,Collection as _0xd94d64,uid as _0xf7ee4e,first as _0xed8fc,FocusTracker as _0x32e900,KeystrokeHandler as _0x1a0f9b}from'@ckeditor/ckeditor5-utils/dist/index.js';import{View as _0x137f4e,IconView as _0x5ebed7,ButtonView as _0x2e8a4b,DropdownButtonView as _0xa5ef83,FocusCycler as _0x25cb5d,isViewWithFocusCycler as _0x4119e0}from'@ckeditor/ckeditor5-ui/dist/index.js';import{IconNotification as _0x391740,IconCheck as _0x39f84b,IconCancel as _0x269646}from'@ckeditor/ckeditor5-icons/dist/index.js';import{DateTime as _0xda94b1}from'luxon';class o extends _0x30556f{static get['pluginName'](){return'Permissions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['setPermissions'](_0x23f682,_0x34876a){let _0x8155d;if(_0x34876a||(_0x34876a=this['context']['config']['get']('collaboration.channelId')),this['context']['config']['get']('collaboration.channelId')==_0x34876a?_0x8155d=this['context']:'editors'in this['context']&&this['context']['editors']&&(_0x8155d=this['context']['editors']['find'](_0x5364e7=>_0x5364e7['config']['get']('collaboration.channelId')==_0x34876a)),!_0x8155d)throw new _0x51afc3('permissions-set-permissions-invalid-channel-id',null);const _0x30a29e=_0x8155d['plugins'],_0x12d8fd=_0x30a29e['has']('CommentsRepository')?_0x30a29e['get']('CommentsRepository'):void 0x0,_0x3214b8=_0x30a29e['has']('CommentsOnly')&&_0x30a29e['get']('CommentsOnly'),_0xb5df9a=_0x23f682['includes']('document:write'),_0x6fa6ea=_0x23f682['includes']('comment:modify_all'),_0x1b6743=_0x23f682['includes']('comment:admin'),_0x4f2f7d=_0x23f682['includes']('comment:write'),_0x332e55=_0x4f2f7d||_0x1b6743,_0x54761c=_0x332e55||_0x6fa6ea,_0x18ade4=_0xb5df9a||_0x332e55;(_0x3214b8&&(_0x3214b8['isEnabled']=!_0xb5df9a&&_0x54761c),_0x8155d instanceof _0x4e591f)&&(!(_0xb5df9a||_0x54761c&&_0x12d8fd)?_0x8155d['enableReadOnlyMode']('no-permissions'):_0x8155d['disableReadOnlyMode']('no-permissions'));if(_0x12d8fd){_0x12d8fd['setPermissions']({'admin':_0x1b6743,'modifyAll':_0x6fa6ea,'write':_0x4f2f7d,'resolve':_0x18ade4},_0x34876a);const _0x4f8c8d=_0x8155d instanceof _0x4e591f&&_0x8155d['commands']['get']('addCommentThread');_0x4f8c8d&&(_0x332e55?_0x4f8c8d['clearForceDisabled']('noPermissions'):_0x4f8c8d['forceDisabled']('noPermissions'));}}}function n(_0x485eb2,_0x47cc4f){const t=_0x485eb2['t'];switch(_0x47cc4f){case'Anonymous':return t('Anonymous');case'Yes':return t('Yes');case'No':return t('No');case'Are\x20you\x20sure?':return t('Are\x20you\x20sure?');case'Today':return t('Today');case'Yesterday':return t('Yesterday');case'Last':return t('Last');case'Monday':return t('Monday');case'Tuesday':return t('Tuesday');case'Wednesday':return t('Wednesday');case'Thursday':return t('Thursday');case'Friday':return t('Friday');case'Saturday':return t('Saturday');case'Sunday':return t('Sunday');default:return'';}}class C extends _0x30556f{['users'];['_lastColor'];['_myId'];['_locale'];static get['pluginName'](){return'Users';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}static get['requires'](){return[o];}constructor(_0x1ed798){super(_0x1ed798),this['context']['config']['define']('users.anonymousUserId','anonymous-user'),this['context']['config']['define']('users.colorsCount',0x8),this['users']=new _0xd94d64(),this['_locale']=_0x1ed798['locale'],this['_lastColor']=0x0,this['_myId']=null,this['decorate']('getOperationAuthor');}['init'](){this['_addAnonymousUser']();}get['me'](){return null==this['_myId']?null:this['getUser'](this['_myId']);}['addUser']({id:_0x2884cb,name:_0x456b4c,..._0x460d39}){if(!_0x2884cb||'string'!=typeof _0x2884cb)throw new _0x51afc3('users-add-invalid-id');if(this['users']['has'](_0x2884cb))throw new _0x51afc3('users-add-duplicated-id',null,{'id':_0x2884cb});const _0x32f9da=this['context']['config']['get']('users.getInitialsCallback'),_0xa4bf76={..._0x460d39,'id':_0x2884cb,'name':u(this['_locale'],_0x456b4c),'color':this['_getNextColor']()};_0xa4bf76['name']=u(this['_locale'],_0xa4bf76['name']);const _0x248c3f=new $(_0xa4bf76,_0x32f9da);return this['users']['add'](_0x248c3f),_0x248c3f;}['getUser'](_0x8610ec){return this['users']['get'](_0x8610ec);}['useAnonymousUser'](){const _0x2b3145=this['context']['config']['get']('users.anonymousUserId');this['_myId']||this['defineMe'](_0x2b3145);}['defineMe'](_0x27dc7b){if(this['_myId'])throw new _0x51afc3('users-me-already-defined',null);const _0x2be7dd=this['getUser'](_0x27dc7b);if(!_0x2be7dd)throw new _0x51afc3('users-me-missing-user',null);this['_myId']=_0x27dc7b,_0x2be7dd['_isMe']=!0x0;}['getOperationAuthor'](){return this['me'];}['_getNextColor'](){const _0xf58890=this['context']['config']['get']('users.colorsCount');return this['_lastColor']>=_0xf58890&&(this['_lastColor']=0x0),new P(this['_lastColor']++);}['_addAnonymousUser'](){const _0x126d22=this['context']['config']['get']('users.anonymousUserId');this['addUser']({'id':_0x126d22,'name':n(this['_locale'],'Anonymous')})['_isAnonymous']=!0x0;}}class ${['id'];['color'];['name'];['initials'];['avatar'];['_isMe'];['_isAnonymous'];constructor(_0x2379c3,_0x57534b){this['id']=_0x2379c3['id'],this['color']=_0x2379c3['color'],this['name']=_0x2379c3['name'],this['initials']=_0x57534b?_0x57534b(this['name']):this['_computeInitials'](),this['avatar']=_0x2379c3['avatar'],this['_isAnonymous']=!0x1,this['_isMe']=!0x1;}get['isAnonymous'](){return this['_isAnonymous'];}get['isMe'](){return this['_isMe'];}['_computeInitials'](){const _0x489e5c=this['name']['split']('\x20')['filter'](_0x74873d=>/^[\p{Letter}]/u['test'](_0x74873d));return 0x1===_0x489e5c['length']?this['_getInitial'](_0x489e5c[0x0]):0x0===_0x489e5c['length']?this['_getInitial'](this['name']):this['_getInitial'](_0x489e5c[0x0])+this['_getInitial'](_0x489e5c[_0x489e5c['length']-0x1]);}['_getInitial'](_0x53a3a9){return String['fromCodePoint'](_0x53a3a9['codePointAt'](0x0))['toUpperCase']();}}function u(_0x2e8e8e,_0x3368f2=''){return''==(_0x3368f2=_0x3368f2['trim']())?n(_0x2e8e8e,'Anonymous'):_0x3368f2;}class P{['_id'];constructor(_0x14e1f5){this['_id']=_0x14e1f5;}['getBackgroundColorClass'](){return'ck-user__bg-color--'+this['_id'];}['getSelectionClass'](){return'ck-user__selection--'+this['_id'];}['getMarkerClass'](){return'ck-user__marker--'+this['_id'];}}class I extends _0x137f4e{['name'];['notificationView'];constructor(_0x1d21db,_0x42af2d,_0x3cbbe1){super(_0x1d21db),this['name']=_0x42af2d['name'],this['notificationView']=null;const _0x35ec66=['ck','ck-user'],_0x2f8db7=['ck','ck-user__img'];if(_0x42af2d['isAnonymous']&&_0x2f8db7['push']('ck-user__anonymous'),!_0x42af2d['isAnonymous']&&_0x42af2d['isMe']&&_0x35ec66['push']('ck-user_me'),_0x42af2d['avatar']&&_0x2f8db7['push']('ck-user__avatar'),_0x3cbbe1){const _0x37caaa=new _0x5ebed7();_0x37caaa['extendTemplate']({'attributes':{'class':['ck-user__icon']}}),_0x37caaa['content']=_0x391740,this['notificationView']={'tag':'div','attributes':{'class':['ck','ck-user__notification'],'data-cke-tooltip-position':'n','data-cke-tooltip-text':_0x3cbbe1},'children':[_0x37caaa]};}const _0xf2252c=[{'tag':'div','attributes':{'class':_0x2f8db7,'style':{'background-image':_0x42af2d['avatar']?'url(\x27'+_0x42af2d['avatar']+'\x27)':''}}},{'tag':'div','attributes':{'class':_0x42af2d['avatar']?'ck\x20ck-user__name\x20ck-user__name--hidden':'ck\x20ck-user__name','aria-label':_0x42af2d['name']},'children':[{'text':_0x42af2d['initials']}]}];this['notificationView']&&_0xf2252c['push'](this['notificationView']),this['setTemplate']({'tag':'div','attributes':{'class':_0x35ec66,'data-user-id':_0x42af2d['id']},'children':_0xf2252c});}}class S extends _0x137f4e{['id'];constructor(_0xb35579,_0x2eaab8){super(_0xb35579),this['id']='ck-aria-description-'+_0xf7ee4e(),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-aria-description'],'id':this['id']},'children':[{'text':_0x2eaab8}]});}}class M extends _0x2e8a4b{['render'](){super['render'](),F(this);}}class U extends _0xa5ef83{['render'](){super['render'](),F(this);}}function F(_0x21bcca){_0x21bcca['listenTo'](_0x21bcca['element'],'mousedown',(_0x436261,_0xc8011a)=>{_0xc8011a['stopPropagation'](),_0xc8011a['preventDefault']();}),_0x21bcca['listenTo'](_0x21bcca['element'],'mouseup',()=>{_0x21bcca['element']['focus']();});}function L(_0x2fcd53={},_0x5e6fc9){if(void 0x0!==_0x2fcd53['dateTimeFormat']&&'function'!=typeof _0x2fcd53['dateTimeFormat'])throw new _0x51afc3('invalid-date-time-format');return _0x4d097f=>{const _0x525943='string'==typeof _0x4d097f?_0xda94b1['fromISO'](_0x4d097f):_0xda94b1['fromJSDate'](_0x4d097f),_0x2f16d4=_0xda94b1['now'](),_0x2d84ee=Math['floor'](_0x2f16d4['diff'](_0x525943,'days')['days']);return _0x2fcd53['dateTimeFormat']?_0x2fcd53['dateTimeFormat'](_0x525943['toJSDate'](),_0x5e6fc9&&_0x5e6fc9['t']?_0x5e6fc9['t']:void 0x0):0x0===_0x2d84ee?_0x5e6fc9?n(_0x5e6fc9,'Today')+'\x20'+_0x525943['toFormat']('hh:mma'):_0x525943['toFormat']('\x27Today\x27\x20hh:mma'):0x1===_0x2d84ee?_0x5e6fc9?n(_0x5e6fc9,'Yesterday')+'\x20'+_0x525943['toFormat']('hh:mma'):_0x525943['toFormat']('\x27Yesterday\x27\x20hh:mma'):_0x2d84ee<0x7?_0x5e6fc9?n(_0x5e6fc9,'Last')+'\x20'+n(_0x5e6fc9,_0x525943['toFormat']('EEEE'))+'\x20'+_0x525943['toFormat']('hh:mma'):_0x525943['toFormat']('\x27Last\x27\x20EEEE\x20hh:mma'):_0x525943['toFormat']('LL-dd-yyyy\x20hh:mma');};}function Y(_0x5ec073,_0x5fc106){const _0x1381b5=_0x5ec073['mapper']['markerNameToElements'](_0x5fc106['name']);if(!_0x1381b5)return null;const _0x6d1e7d=_0xed8fc(_0x1381b5['values']());return _0x5ec073['view']['domConverter']['mapViewToDom'](_0x6d1e7d)||null;}function V(_0x80179,_0x23d3ad){if(0x0===_0x23d3ad['length'])return null;const _0x1834d2=[],_0x4cfa51=_0x80179['view']['domConverter'];for(const _0x6ef7a3 of _0x23d3ad){const _0x1c4ccd=_0x80179['mapper']['markerNameToElements'](_0x6ef7a3['name']);if(!_0x1c4ccd)continue;const _0x43eee2=Array['from'](_0x1c4ccd)['map'](_0x325348=>_0x4cfa51['mapViewToDom'](_0x325348))['filter'](_0x54cee4=>!!_0x54cee4);_0x1834d2['push'](..._0x43eee2);}if(0x0===_0x1834d2['length'])return null;const _0x54c9eb=[];for(const _0x52b3fa of _0x1834d2){const _0x5e8539=_0x52b3fa['getClientRects']()['item'](0x0);_0x5e8539&&_0x54c9eb['push']({'x':_0x5e8539['x'],'y':_0x5e8539['y'],'domElement':_0x52b3fa});}return 0x0===_0x54c9eb['length']?null:(_0x54c9eb['sort']((_0x3548a5,_0x4363ef)=>_0x3548a5['y']-_0x4363ef['y']||_0x3548a5['x']-_0x4363ef['x']),_0x54c9eb['map'](_0x2a84f9=>_0x2a84f9['domElement']));}function R(_0x4351fe,{limit:_0x114f89,suffix:_0x21e82d='...'}){const _0x317ac2=[];let _0x4b6120=0x0;const _0x59d148=_0x4351fe['replace'](/</g,'\x0a<')['replace'](/>/g,'>\x0a')['replace'](/^\n/g,'')['replace'](/\n$/g,'')['split']('\x0a');for(let _0x2b5b23=0x0;_0x2b5b23<_0x59d148['length'];_0x2b5b23++){let _0x67b7ae=_0x59d148[_0x2b5b23];const _0x8f7bbe=z(_0x67b7ae);if(_0x67b7ae['startsWith']('<')){if(_0x4b6120>=_0x114f89){const _0x4041aa=_0x67b7ae['match'](/[a-zA-Z]+/);if(!_0x4041aa){_0x59d148[_0x2b5b23]='';continue;}const _0x5931e7=_0x4041aa[0x0];_0x67b7ae['startsWith']('</')?(_0x317ac2['length']&&(_0x67b7ae=''),_0x317ac2['pop']()):(_0x317ac2['push'](_0x5931e7),_0x67b7ae='');}}else{if(_0x4b6120>=_0x114f89)_0x67b7ae='';else{if(_0x4b6120+_0x8f7bbe['length']>=_0x114f89){let _0x282af7=_0x114f89-_0x4b6120;if('\x20'===_0x8f7bbe[_0x282af7-0x1])_0x282af7--;else{const _0x15ab39=_0x8f7bbe['slice'](_0x282af7)['indexOf']('\x20');-0x1!==_0x15ab39?_0x282af7+=_0x15ab39:_0x282af7=_0x67b7ae['length'];}_0x67b7ae=_0x8f7bbe['slice'](0x0,_0x282af7)['join']('')+_0x21e82d,_0x4b6120=_0x114f89;}else _0x4b6120+=_0x8f7bbe['length'];}}_0x59d148[_0x2b5b23]=_0x67b7ae;}return _0x59d148['join']('\x0a')['replace'](/\n/g,'');}function z(_0x5215b3){const _0x2101e8=[];for(let _0x3d500d=0x0;_0x3d500d<_0x5215b3['length'];_0x3d500d++){const _0x72dd02=_0x5215b3['substring'](_0x3d500d)['match'](/^&[a-z0-9#]+;/);if(_0x72dd02){const _0x3b50a2=_0x72dd02[0x0];_0x2101e8['push'](_0x3b50a2),_0x3d500d+=_0x3b50a2['length']-0x1;}else _0x2101e8['push'](_0x5215b3[_0x3d500d]);}return _0x2101e8;}class h extends _0x137f4e{['submitView'];['cancelView'];['focusTracker'];['keystrokes'];['focusCycler'];['focusables'];constructor(_0x1ead23){super(_0x1ead23);const _0x1e4b1a=this['bindTemplate'];this['set']('message',n(_0x1ead23,'Are\x20you\x20sure?')),this['submitView']=this['_createButtonView'](_0x1ead23,n(_0x1ead23,'Yes'),_0x39f84b,'submit'),this['cancelView']=this['_createButtonView'](_0x1ead23,n(_0x1ead23,'No'),_0x269646,'cancel'),this['focusables']=this['createCollection']([this['submitView'],this['cancelView']]),this['focusTracker']=new _0x32e900(),this['keystrokes']=new _0x1a0f9b(),this['focusCycler']=new _0x25cb5d({'focusables':this['focusables'],'focusTracker':this['focusTracker'],'keystrokeHandler':this['keystrokes'],'actions':{'focusPrevious':'shift+tab','focusNext':'tab'}}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-thread__remove-confirm'],'tabindex':-0x1,'role':'alertdialog'},'children':[{'tag':'div','attributes':{'class':'ck-thread__remove-confirm-inner','role':'presentation'},'children':[{'tag':'p','children':[{'text':_0x1e4b1a['to']('message')}]},{'tag':'div','attributes':{'class':'ck-thread__remove-confirm-actions'},'children':[this['submitView'],this['cancelView']]}]}]});}['render'](){super['render'](),this['_setupKeyboardNavigation']();}['focus'](){this['cancelView']['element']['focus']({'preventScroll':!0x0});}['_createButtonView'](_0x4757b6,_0x3ceb1f,_0x16942f,_0x1eed7f){const _0xed361d=new _0x2e8a4b(_0x4757b6);return _0xed361d['label']=_0x3ceb1f,_0xed361d['icon']=_0x16942f,_0xed361d['extendTemplate']({'attributes':{'class':'ck-thread__remove-confirm-'+_0x1eed7f}}),_0xed361d['on']('execute',()=>this['fire'](_0x1eed7f)),_0xed361d;}['_setupKeyboardNavigation'](){this['focusables']['forEach'](_0x517529=>{this['keystrokes']['listenTo'](_0x517529['element']),this['focusTracker']['add'](_0x517529['element']);}),this['keystrokes']['set']('esc',(_0x4c1c4c,_0x3f06ac)=>{this['fire']('cancel'),_0x3f06ac();});}}function q(_0x42bc31){return class extends _0x42bc31{['showConfirm'](_0x41f080,_0x2c9604){return this['confirmView']=new h(this['locale']),this['confirmView']['render'](),this['confirmView']['message']=_0x41f080,this['confirmView']['once']('cancel',()=>{this['_removeConfirm']();}),this['confirmView']['once']('submit',()=>{this['_removeConfirm']();}),_0x2c9604['appendChild'](this['confirmView']['element']),this['registerChild'](this['confirmView']),this['confirmView']['focus'](),this['set']('isConfirm',!0x0),new Promise(_0x1dc30e=>this['confirmView']['on']('submit',_0x1dc30e));}['cancelConfirm'](){this['isConfirm']&&this['confirmView']['fire']('cancel');}['_removeConfirm'](){this['element']&&this['confirmView']&&this['confirmView']['element']&&(this['element']['focus'](),this['confirmView']['element']['remove'](),this['deregisterChild'](this['confirmView']),this['isConfirm']=!0x1,this['fire']('removeConfirm'),this['confirmView']['destroy'](),this['confirmView']=void 0x0);}};}function G(_0x84c705){let _0x2c646e=0x0,_0x347f61=0x0;for(const _0x55ac26 of j(_0x84c705))_0x2c646e=(_0x2c646e<<0x5)-_0x2c646e+_0x55ac26,_0x2c646e&=_0x2c646e,[_0x2c646e,_0x347f61]=[_0x347f61,_0x2c646e];return x(_0x2c646e)+x(_0x347f61);}function*b(_0x138e7b){null==_0x138e7b||null==_0x138e7b?yield 0x12b9b0a1:0x0===_0x138e7b||!0x1===_0x138e7b?yield 0x0:0x1===_0x138e7b||0x1==_0x138e7b?yield 0x1:Array['isArray'](_0x138e7b)?yield*function*(_0x1dce46){for(const _0x1f1796 of _0x1dce46)yield*b(_0x1f1796);}(_0x138e7b):'object'==typeof _0x138e7b?yield*j(_0x138e7b):'string'==typeof _0x138e7b?yield*O(_0x138e7b):'number'==typeof _0x138e7b&&(yield _0x138e7b);}function*j(_0x56d096){if(yield g('{'),_0x56d096){const _0x5873b8=Object['keys'](_0x56d096)['sort']();for(const _0x4c8f86 of _0x5873b8){yield*O(_0x4c8f86),yield g(':');const _0x2e65d7=_0x56d096[_0x4c8f86];yield*b(_0x2e65d7);}}yield g('}');}function*O(_0x2c7be0){yield g('\x22');for(const _0x8eda47 of _0x2c7be0)yield g(_0x8eda47);yield g('\x22');}function g(_0x484441){return _0x484441['charCodeAt'](0x0);}function x(_0x14eeb3){return(_0x14eeb3*=Math['sign'](_0x14eeb3))['toString'](0x24);}const w=['initialData','context','toolbar','rootsAttributes'],A=['WebSocketGateway','RevisionTracker','Autosave','WordCount','DocumentOutline','WProofreader'];function W(_0x3a1ee2,_0x3a474c,_0x4c2f97,_0x34f26b=[]){const _0x2113e0='string'==typeof _0x3a1ee2?_0x4c2f97['get'](_0x3a1ee2)['constructor']:_0x3a1ee2['prototype']['constructor'];if(_0x3a474c['has'](_0x2113e0))return _0x3a474c['get'](_0x2113e0);_0x3a474c['set'](_0x2113e0,!0x0);const _0x13e83e=[...A,..._0x34f26b]['map'](_0x5997d4=>{if(_0x4c2f97['has'](_0x5997d4))return _0x4c2f97['get'](_0x5997d4)['constructor'];})['filter'](_0x49a0d8=>_0x49a0d8);if(_0x2113e0&&_0x13e83e['includes'](_0x2113e0))return _0x3a474c['set'](_0x2113e0,!0x1),!0x1;if(!_0x2113e0['requires'])return _0x3a474c['set'](_0x2113e0,!0x0),!0x0;const _0x5f5740=_0x2113e0['requires']['every'](_0x473493=>W(_0x473493,_0x3a474c,_0x4c2f97,_0x34f26b));return _0x3a474c['set'](_0x2113e0,_0x5f5740),_0x5f5740;}function H(_0x137941,_0x3cc210){const _0x2ce2a0={};for(const _0x6a76e0 of _0x137941['config']['names']())w['includes'](_0x6a76e0)||(_0x2ce2a0[_0x6a76e0]=_0x137941['config']['get'](_0x6a76e0));const _0x21ce86=_0x2ce2a0['plugins']||[],_0x13e18e=_0x137941['constructor']['builtinPlugins']||[],_0x467239=_0x21ce86['length']?_0x21ce86:_0x13e18e,_0x7bca27=_0x2ce2a0['extraPlugins']||[];delete _0x2ce2a0['extraPlugins'];const _0x137b57=_0x2ce2a0['removePlugins']||[];delete _0x2ce2a0['removePlugins'];const _0x422b32=_0x137941['_context']['config']['get']('plugins')||[],_0x4075cd=_0x467239['concat'](_0x7bca27)['concat'](_0x422b32)['map'](_0x50ee9a=>'string'==typeof _0x50ee9a?_0x13e18e['find'](_0x127a7d=>_0x127a7d['pluginName']==_0x50ee9a):_0x50ee9a)['filter'](_0x117ea9=>!_0x137b57['includes'](_0x117ea9)&&!_0x137b57['includes'](_0x117ea9['pluginName'])),_0x213a90=Array['from'](new Set(_0x4075cd)),_0xd4762=new Map();return _0x2ce2a0['plugins']=_0x213a90['filter'](_0x45e004=>W(_0x45e004,_0xd4762,_0x137941['plugins'],_0x3cc210)),_0x2ce2a0;}function K(_0x1051c6,_0x49f840){const _0x27a07b=[];_0x1051c6['document']['selection']['on']('change:range',()=>{const _0x1fb695=function(_0x5bdf8f,_0x3fd6cb){const _0x29d8da=[];for(const _0x41fc66 of _0x5bdf8f['markers']){const _0x1617b5=_0x41fc66['getRange']();(_0x1617b5['containsPosition'](_0x3fd6cb)||_0x1617b5['start']['isEqual'](_0x3fd6cb)||_0x1617b5['end']['isEqual'](_0x3fd6cb))&&_0x29d8da['push'](_0x41fc66);}return _0x29d8da;}(_0x1051c6,_0x1051c6['document']['selection']['focus']),_0x34746a=[],_0x5b6ba4=[],_0x38709e=[];for(const _0x1c761b of _0x27a07b)_0x1fb695['includes'](_0x1c761b)||_0x34746a['push'](_0x1c761b);for(const _0x35bd09 of _0x1fb695)_0x27a07b['includes'](_0x35bd09)||_0x5b6ba4['push'](_0x35bd09),_0x38709e['push'](_0x35bd09);(_0x34746a['length']||_0x5b6ba4['length'])&&_0x49f840({'left':_0x34746a,'entered':_0x5b6ba4}),_0x27a07b['length']=0x0,_0x27a07b['push'](..._0x38709e);});}const Z='Ctrl+Shift+E';function J(_0x20f85e,_0x2fb3e5){const _0x2fc319=_0x20f85e['element'];_0x20f85e['keystrokes']['listenTo'](_0x2fc319);for(const _0x3ba3b7 of _0x2fb3e5)T(_0x20f85e,_0x3ba3b7);_0x2fb3e5['on']('change',(_0x4a6abd,_0x43082a)=>{for(const _0x265670 of _0x43082a['removed'])E(_0x20f85e,_0x265670);for(const _0x5f8cba of Array['from'](_0x43082a['added'])['reverse']())T(_0x20f85e,_0x5f8cba);}),_0x20f85e['keystrokes']['set']('enter',(_0x32d164,_0x10a560)=>{_0x2fc319===_0x32d164['target']&&(_0x20f85e['focusCycler']['focusFirst'](),_0x10a560());},{'filter':_0x1deab3=>_0x1deab3['target']===_0x2fc319}),_0x20f85e['keystrokes']['set']('esc',(_0x26483f,_0x2c960a)=>{_0x2fc319!==_0x26483f['target']?_0x20f85e['focus']():_0x20f85e['fire']('escape'),_0x2c960a();}),_0x20f85e['keystrokes']['set']('arrowdown',(_0x1567c8,_0x1a9be7)=>{_0x2fc319===_0x1567c8['target']&&(_0x20f85e['fire']('arrowdown'),_0x1a9be7());}),_0x20f85e['keystrokes']['set']('arrowup',(_0x21fd50,_0x15271a)=>{_0x2fc319===_0x21fd50['target']&&(_0x20f85e['fire']('arrowup'),_0x15271a());});}function T(_0x39bc38,_0xbb5eb7){_0xbb5eb7['isRendered']&&(_0x39bc38['focusTracker']['add'](_0xbb5eb7['element']),_0x39bc38['keystrokes']['listenTo'](_0xbb5eb7['element']),_0x4119e0(_0xbb5eb7)&&function(_0x5b5251,_0x2d33f6){const _0x106f8b=_0x5b5251['actions'],_0x4fbf75=_0x2d33f6['actions'];for(const _0x48b30c of Object['keys'](_0x106f8b))if(_0x48b30c in _0x4fbf75&&_0x106f8b[_0x48b30c]!==_0x4fbf75[_0x48b30c])return!0x1;return!0x0;}(_0x39bc38['focusCycler'],_0xbb5eb7['focusCycler'])&&_0x39bc38['focusCycler']['chain'](_0xbb5eb7['focusCycler']));}function E(_0x296822,_0x1fa3a9){_0x296822['focusTracker']['remove'](_0x1fa3a9['element']),_0x296822['keystrokes']['stopListening'](_0x1fa3a9['element']),_0x4119e0(_0x1fa3a9)&&_0x296822['focusCycler']['unchain'](_0x1fa3a9['focusCycler']);}export{S as AriaDescriptionView,q as ConfirmMixin,Z as FOCUS_ANNOTATION_KEYSTROKE,M as LateFocusButtonView,U as LateFocusDropdownButtonView,o as Permissions,I as UserView,C as Users,V as getAllMarkersDomElementsSorted,L as getDateTimeFormatter,Y as getMarkerDomElement,G as hashObject,H as sanitizeEditorConfig,J as setupThreadKeyboardNavigation,K as surroundingMarkersDetector,R as trimHtml};