UNPKG

@ckeditor/ckeditor5-track-changes

Version:

CKEditor 5 track changes plugin.

23 lines • 13.8 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. | * | | * | | * +---------------------------------------------------------------------------------+ * * * * */ const _0x39a643=_0x15b0;function _0x15b0(_0x5d9bc3,_0x41e7df){const _0x1d7604=_0x1d76();return _0x15b0=function(_0x15b0fd,_0x446a9a){_0x15b0fd=_0x15b0fd-0x1d6;let _0x39be1b=_0x1d7604[_0x15b0fd];return _0x39be1b;},_0x15b0(_0x5d9bc3,_0x41e7df);}function _0x1d76(){const _0x283973=['start','softBreak','14649767WkkVPQ','*Split:*\x20%0','removeFormat','pop','add','12YKxVYe','checkChild','skip','map','_customCallbacks','32101KevZcJ','addContainer','registerElementLabel','removeObject','has','_addDescriptionItems','nextSibling','label','isEqual','elementEnd','data','isInContent','name','16BIZkwF','join','_handleCustomCallbackDescription','12KOPCJm','_locale','end','$textProxy','1250757WBdFbR','remove','_handleInsertRemoveSuggestionDescription','registerDescriptionCallback','366WxnjpR','quantity','*Set\x20format:*\x20%0','getWalker','nodeAfter','_attributeLabels','EmptyContainer','_itemLabels','REPLACE_TEXT','format','isEmpty','_schema','isObject','replace','5125dUlFQt','elementStart','5287926fATXUB','length','940948jlkdSL','addEmptyContainer','ELEMENT_SPACE','*Remove\x20format:*\x20%0','type','element','push','attribute','addFormat','normal','*Insert:*\x20%0','_itemLabelsCallbacks','2qivLvr','function','$1\x20$2','*Change\x20to:*\x20%0','newValue','$text','addObject','item','text','registerAttributeLabel','match','removeEmptyContainer','*Remove:*\x20%0','6501810WRnklL','removeContainer','get','matchingCallback','set','getItemLabel','Container','_handleRenameSuggestionDescription','indexOf','*Merge:*\x20%0','previousSibling','key','_handleAttributeSuggestionDescription','getFirstRange','deletion','insertion','Object','getDescriptions','subType','_resolveDescriptionItems'];_0x1d76=function(){return _0x283973;};return _0x1d76();}(function(_0x349da1,_0xea6b9){const _0x1a175c=_0x15b0,_0x487041=_0x349da1();while(!![]){try{const _0x2b64dd=-parseInt(_0x1a175c(0x214))/0x1*(parseInt(_0x1a175c(0x1e7))/0x2)+-parseInt(_0x1a175c(0x20f))/0x3*(-parseInt(_0x1a175c(0x1db))/0x4)+-parseInt(_0x1a175c(0x1d7))/0x5*(parseInt(_0x1a175c(0x22c))/0x6)+-parseInt(_0x1a175c(0x1d9))/0x7+-parseInt(_0x1a175c(0x221))/0x8*(parseInt(_0x1a175c(0x228))/0x9)+-parseInt(_0x1a175c(0x1f4))/0xa+parseInt(_0x1a175c(0x20a))/0xb*(parseInt(_0x1a175c(0x224))/0xc);if(_0x2b64dd===_0xea6b9)break;else _0x487041['push'](_0x487041['shift']());}catch(_0x5b1b02){_0x487041['push'](_0x487041['shift']());}}}(_0x1d76,0x78bee));import{getTranslation as _0x446ead}from'./utils/common-translations.js';import{priorities as _0x44ff51,insertToPriorityArray as _0x10ead8}from'ckeditor5/src/utils.js';import{renameAttributeKey as _0x3dc1fb}from'./trackchangesediting.js';export class SuggestionDescriptionFactory{[_0x39a643(0x213)];[_0x39a643(0x233)];[_0x39a643(0x1e6)];[_0x39a643(0x231)];[_0x39a643(0x237)];[_0x39a643(0x225)];constructor(_0x4b8235,_0x4bf85e){const _0x44c823=_0x39a643;this[_0x44c823(0x213)]=[],this[_0x44c823(0x233)]=new Map(),this[_0x44c823(0x1e6)]=[],this[_0x44c823(0x231)]=new Map(),this[_0x44c823(0x237)]=_0x4b8235,this[_0x44c823(0x225)]=_0x4bf85e;}[_0x39a643(0x205)](_0x4254b9){const _0x458728=_0x39a643,_0x15f213=[],_0x1f0c56=new Set(),_0x2150b3=new Set();for(let _0x518be5=0x0;_0x518be5<_0x4254b9[_0x458728(0x1da)];_0x518be5++){const _0x573d9b=_0x4254b9[_0x518be5];if(!_0x573d9b[_0x458728(0x21f)])continue;const _0x510d34=this[_0x458728(0x223)](_0x573d9b);if(_0x510d34){if(null!=_0x573d9b[_0x458728(0x206)]){if(_0x1f0c56[_0x458728(0x218)](_0x573d9b[_0x458728(0x206)]))continue;_0x1f0c56[_0x458728(0x20e)](_0x573d9b[_0x458728(0x206)]);}_0x15f213[_0x458728(0x1e1)](_0x510d34);}else{if(_0x458728(0x1e2)==_0x573d9b[_0x458728(0x1df)]){const _0xe83a42=_0x573d9b[_0x458728(0x21e)][_0x458728(0x1ff)];if(_0x2150b3[_0x458728(0x218)](_0xe83a42))continue;_0x2150b3[_0x458728(0x20e)](_0x573d9b[_0x458728(0x21e)][_0x458728(0x1ff)]),_0xe83a42==_0x3dc1fb?this[_0x458728(0x1fb)](_0x15f213,_0x573d9b):this[_0x458728(0x200)](_0x15f213,_0x573d9b);continue;}_0x458728(0x203)!=_0x573d9b[_0x458728(0x1df)]&&_0x458728(0x202)!=_0x573d9b[_0x458728(0x1df)]||this[_0x458728(0x22a)](_0x15f213,_0x573d9b,_0x4254b9[_0x518be5+0x1]);}}return this[_0x458728(0x207)](_0x15f213);}[_0x39a643(0x22b)](_0x21f384){const _0x7dd37d=_0x39a643;this[_0x7dd37d(0x213)][_0x7dd37d(0x1e1)](_0x21f384);}[_0x39a643(0x216)](_0x1efd61,_0x4b7581,_0x43b930=_0x44ff51[_0x39a643(0x1e4)]){const _0x33fbe4=_0x39a643;_0x33fbe4(0x1e8)==typeof _0x1efd61?_0x10ead8(this[_0x33fbe4(0x1e6)],{'matchingCallback':_0x1efd61,'label':_0x4b7581,'priority':_0x43b930}):this[_0x33fbe4(0x233)][_0x33fbe4(0x1f8)](_0x1efd61,_0x4b7581);}[_0x39a643(0x1f0)](_0x5467ab,_0x1b15db){const _0x5ca01d=_0x39a643;this[_0x5ca01d(0x231)][_0x5ca01d(0x1f8)](_0x5467ab,_0x1b15db);}[_0x39a643(0x1f9)](_0x4f8135,_0x28bd13=0x1){const _0x560ad0=_0x39a643;let _0x4fe345;for(const _0x45d879 of this[_0x560ad0(0x1e6)])if(_0x45d879[_0x560ad0(0x1f7)](_0x4f8135)){_0x4fe345=_0x45d879[_0x560ad0(0x21b)];break;}return _0x4fe345||(_0x4fe345=this[_0x560ad0(0x233)][_0x560ad0(0x1f6)](_0x4f8135[_0x560ad0(0x220)])),_0x4fe345?_0x4fe345(_0x28bd13):0x1!==_0x28bd13?_0x28bd13+'\x20'+_0x4f8135[_0x560ad0(0x220)]+'s':''+_0x4f8135[_0x560ad0(0x220)];}[_0x39a643(0x219)](_0x1a2b9c,_0x5bedc4){const _0x1e0abf=_0x39a643,_0x48aa99=_0x5bedc4[_0x1e0abf(0x201)]()[_0x1e0abf(0x22f)](),_0x4d04b2=_0x1e0abf(0x203)==_0x5bedc4[_0x1e0abf(0x1df)]?_0x1e0abf(0x20e):_0x1e0abf(0x229);for(const _0x87870b of _0x48aa99){const _0x1df14a=_0x87870b[_0x1e0abf(0x1ee)],_0x3217e4=_0x1a2b9c[_0x1a2b9c[_0x1e0abf(0x1da)]-0x1];if(_0x1df14a['is'](_0x1e0abf(0x227)))_0x3217e4&&_0x3217e4[_0x1e0abf(0x1df)][_0x1e0abf(0x1fc)](_0x1e0abf(0x1fa))>-0x1&&_0x1a2b9c[_0x1e0abf(0x20d)](),_0x3217e4&&_0x1e0abf(0x1ef)==_0x3217e4[_0x1e0abf(0x1df)]?_0x3217e4[_0x4d04b2]+=_0x1df14a[_0x1e0abf(0x21e)]:_0x1a2b9c[_0x1e0abf(0x1e1)]({'type':_0x1e0abf(0x1ef),'add':_0x1e0abf(0x20e)==_0x4d04b2?_0x1df14a[_0x1e0abf(0x21e)]:'','remove':_0x1e0abf(0x229)==_0x4d04b2?_0x1df14a[_0x1e0abf(0x21e)]:''});else{if(this[_0x1e0abf(0x237)][_0x1e0abf(0x238)](_0x1df14a)){const _0x1f2762=_0x1df14a;if(_0x3217e4&&_0x3217e4[_0x1e0abf(0x1df)][_0x1e0abf(0x1fc)](_0x1e0abf(0x1fa))>-0x1&&_0x1a2b9c[_0x1e0abf(0x20d)](),_0x1e0abf(0x21d)==_0x87870b[_0x1e0abf(0x1df)])continue;_0x3217e4&&_0x3217e4[_0x1e0abf(0x1df)]==_0x4d04b2+_0x1e0abf(0x204)&&_0x3217e4[_0x1e0abf(0x1e0)][_0x1e0abf(0x220)]==_0x1f2762[_0x1e0abf(0x220)]?_0x3217e4[_0x1e0abf(0x22d)]++:_0x1a2b9c[_0x1e0abf(0x1e1)]({'type':_0x4d04b2+_0x1e0abf(0x204),'element':_0x1f2762,'quantity':0x1}),_0x48aa99[_0x1e0abf(0x211)](_0x182774=>!(_0x1e0abf(0x21d)==_0x182774[_0x1e0abf(0x1df)]&&_0x182774[_0x1e0abf(0x1ee)]==_0x1df14a));}else{if(this[_0x1e0abf(0x237)][_0x1e0abf(0x210)](_0x1df14a,_0x1e0abf(0x1ec))||_0x1df14a['is'](_0x1e0abf(0x1e0),_0x1e0abf(0x209))){const _0x2bc521=_0x1df14a;if(_0x1e0abf(0x20e)==_0x4d04b2&&_0x1e0abf(0x1d8)==_0x87870b[_0x1e0abf(0x1df)]||_0x1e0abf(0x229)==_0x4d04b2&&_0x1e0abf(0x21d)==_0x87870b[_0x1e0abf(0x1df)])continue;if(_0x3217e4&&-0x1==_0x3217e4[_0x1e0abf(0x1df)][_0x1e0abf(0x1fc)](_0x1e0abf(0x1fa))){_0x1e0abf(0x1ef)==_0x3217e4[_0x1e0abf(0x1df)]&&(_0x3217e4[_0x4d04b2]+='\x0a');continue;}let _0x154b62;if(_0x154b62=_0x1e0abf(0x20e)==_0x4d04b2?_0x2bc521[_0x1e0abf(0x21a)]&&!this[_0x1e0abf(0x237)][_0x1e0abf(0x238)](_0x2bc521[_0x1e0abf(0x21a)])?_0x2bc521[_0x1e0abf(0x21a)]:null:_0x2bc521[_0x1e0abf(0x1fe)]&&!this[_0x1e0abf(0x237)][_0x1e0abf(0x238)](_0x2bc521[_0x1e0abf(0x1fe)])?_0x2bc521[_0x1e0abf(0x1fe)]:null,_0x2bc521[_0x1e0abf(0x236)]||_0x154b62&&_0x154b62[_0x1e0abf(0x236)]){const _0xfa0a47=_0x154b62&&_0x154b62[_0x1e0abf(0x236)]?_0x154b62:_0x2bc521;_0x3217e4&&_0x3217e4[_0x1e0abf(0x1df)]==_0x4d04b2+_0x1e0abf(0x232)&&_0x3217e4[_0x1e0abf(0x1e0)][_0x1e0abf(0x220)]==_0xfa0a47[_0x1e0abf(0x220)]?_0x3217e4[_0x1e0abf(0x22d)]++:_0x1a2b9c[_0x1e0abf(0x1e1)]({'type':_0x4d04b2+_0x1e0abf(0x232),'element':_0xfa0a47,'quantity':0x1});}else _0x1a2b9c[_0x1e0abf(0x1e1)]({'type':_0x4d04b2+_0x1e0abf(0x1fa),'element':_0x2bc521});}}}}}[_0x39a643(0x207)](_0x29a1ed){const _0x351fe9=_0x39a643,_0x3e8fdd=this[_0x351fe9(0x225)],_0x358ff1=[],_0x14027c=[],_0x594fbe=[];for(const _0x5325ea of _0x29a1ed)switch(_0x5325ea[_0x351fe9(0x1df)]){case _0x351fe9(0x1ef):if(_0x5325ea[_0x351fe9(0x20e)]=_0x5325ea[_0x351fe9(0x20e)][_0x351fe9(0x1d6)](/(\S)\u000A+(\S)/g,_0x351fe9(0x1e9))[_0x351fe9(0x1d6)](/\u000A/g,''),_0x5325ea[_0x351fe9(0x229)]=_0x5325ea[_0x351fe9(0x229)][_0x351fe9(0x1d6)](/(\S)\u000A+(\S)/g,_0x351fe9(0x1e9))[_0x351fe9(0x1d6)](/\u000A/g,''),''!=_0x5325ea[_0x351fe9(0x20e)]&&''!=_0x5325ea[_0x351fe9(0x229)]){_0x358ff1[_0x351fe9(0x1e1)]({'type':_0x351fe9(0x1d6),'content':_0x446ead(_0x3e8fdd,_0x351fe9(0x234),['\x22'+_0x5325ea[_0x351fe9(0x229)]+'\x22','\x22'+_0x5325ea[_0x351fe9(0x20e)]+'\x22'])});continue;}if(null!=_0x5325ea[_0x351fe9(0x20e)][_0x351fe9(0x1f1)](/^ +$/)){_0x358ff1[_0x351fe9(0x1e1)]({'type':_0x351fe9(0x203),'content':_0x446ead(_0x3e8fdd,_0x351fe9(0x1e5),_0x446ead(_0x3e8fdd,_0x351fe9(0x1dd),_0x5325ea[_0x351fe9(0x20e)][_0x351fe9(0x1da)]))});continue;}if(null!=_0x5325ea[_0x351fe9(0x229)][_0x351fe9(0x1f1)](/^ +$/)){_0x358ff1[_0x351fe9(0x1e1)]({'type':_0x351fe9(0x202),'content':_0x446ead(_0x3e8fdd,_0x351fe9(0x1f3),_0x446ead(_0x3e8fdd,_0x351fe9(0x1dd),_0x5325ea[_0x351fe9(0x229)][_0x351fe9(0x1da)]))});continue;}if(''!=_0x5325ea[_0x351fe9(0x20e)]){_0x358ff1[_0x351fe9(0x1e1)]({'type':_0x351fe9(0x203),'content':_0x446ead(_0x3e8fdd,_0x351fe9(0x1e5),'\x22'+_0x5325ea[_0x351fe9(0x20e)]+'\x22')});continue;}_0x358ff1[_0x351fe9(0x1e1)]({'type':_0x351fe9(0x202),'content':_0x446ead(_0x3e8fdd,_0x351fe9(0x1f3),'\x22'+_0x5325ea[_0x351fe9(0x229)]+'\x22')});continue;case _0x351fe9(0x1dc):case _0x351fe9(0x1ed):_0x358ff1[_0x351fe9(0x1e1)]({'type':_0x351fe9(0x203),'content':_0x446ead(_0x3e8fdd,_0x351fe9(0x1e5),this[_0x351fe9(0x1f9)](_0x5325ea[_0x351fe9(0x1e0)],_0x5325ea[_0x351fe9(0x22d)]))});continue;case _0x351fe9(0x1f2):case _0x351fe9(0x217):_0x358ff1[_0x351fe9(0x1e1)]({'type':_0x351fe9(0x202),'content':_0x446ead(_0x3e8fdd,_0x351fe9(0x1f3),this[_0x351fe9(0x1f9)](_0x5325ea[_0x351fe9(0x1e0)],_0x5325ea[_0x351fe9(0x22d)]))});continue;case _0x351fe9(0x215):_0x358ff1[_0x351fe9(0x1e1)]({'type':_0x351fe9(0x203),'content':_0x446ead(_0x3e8fdd,_0x351fe9(0x20b),this[_0x351fe9(0x1f9)](_0x5325ea[_0x351fe9(0x1e0)],_0x5325ea[_0x351fe9(0x22d)]))});continue;case _0x351fe9(0x1f5):_0x358ff1[_0x351fe9(0x1e1)]({'type':_0x351fe9(0x202),'content':_0x446ead(_0x3e8fdd,_0x351fe9(0x1fd),this[_0x351fe9(0x1f9)](_0x5325ea[_0x351fe9(0x1e0)],_0x5325ea[_0x351fe9(0x22d)]))});continue;case _0x351fe9(0x1e3):_0x14027c[_0x351fe9(0x1e1)](_0x5325ea[_0x351fe9(0x1ff)]);continue;case _0x351fe9(0x20c):_0x594fbe[_0x351fe9(0x1e1)](_0x5325ea[_0x351fe9(0x1ff)]);continue;default:_0x358ff1[_0x351fe9(0x1e1)](_0x5325ea);}if(_0x14027c[_0x351fe9(0x1da)]){const _0x3a7402=_0x14027c[_0x351fe9(0x212)](_0x1bf840=>this[_0x351fe9(0x231)][_0x351fe9(0x218)](_0x1bf840)?this[_0x351fe9(0x231)][_0x351fe9(0x1f6)](_0x1bf840):_0x1bf840)[_0x351fe9(0x222)](',\x20');_0x358ff1[_0x351fe9(0x1e1)]({'type':_0x351fe9(0x235),'content':_0x446ead(this[_0x351fe9(0x225)],_0x351fe9(0x22e),_0x3a7402)});}if(_0x594fbe[_0x351fe9(0x1da)]){const _0x2a74bf=_0x594fbe[_0x351fe9(0x212)](_0x47a89f=>this[_0x351fe9(0x231)][_0x351fe9(0x218)](_0x47a89f)?this[_0x351fe9(0x231)][_0x351fe9(0x1f6)](_0x47a89f):_0x47a89f)[_0x351fe9(0x222)](',\x20');_0x358ff1[_0x351fe9(0x1e1)]({'type':_0x351fe9(0x235),'content':_0x446ead(this[_0x351fe9(0x225)],_0x351fe9(0x1de),_0x2a74bf)});}return _0x358ff1;}[_0x39a643(0x223)](_0x329c95){const _0x4a3774=_0x39a643;for(const _0x3d6ad7 of this[_0x4a3774(0x213)]){const _0x2716b7=_0x3d6ad7(_0x329c95);if(_0x2716b7&&_0x4a3774(0x1df)in _0x2716b7)return _0x2716b7;}}[_0x39a643(0x200)](_0x382316,_0x35e683){const _0x1d13dc=_0x39a643,_0x1cf46c=_0x35e683[_0x1d13dc(0x21e)],_0x1aaaba=void 0x0===_0x1cf46c[_0x1d13dc(0x1eb)]?_0x1d13dc(0x20c):_0x1d13dc(0x1e3);_0x382316[_0x1d13dc(0x1e1)]({'type':_0x1aaaba,'key':_0x1cf46c[_0x1d13dc(0x1ff)]});}[_0x39a643(0x1fb)](_0x1c152d,_0x4920f5){const _0x11a15f=_0x39a643;_0x1c152d[_0x11a15f(0x1e1)]({'type':_0x11a15f(0x235),'content':_0x446ead(this[_0x11a15f(0x225)],_0x11a15f(0x1ea),this[_0x11a15f(0x1f9)](_0x4920f5[_0x11a15f(0x201)]()[_0x11a15f(0x208)][_0x11a15f(0x230)],0x1))});}[_0x39a643(0x22a)](_0x265cd3,_0xf12618,_0x106f63){const _0x581f33=_0x39a643;if(this[_0x581f33(0x219)](_0x265cd3,_0xf12618),_0x106f63&&_0x106f63[_0x581f33(0x201)]()&&!_0xf12618[_0x581f33(0x201)]()[_0x581f33(0x226)][_0x581f33(0x21c)](_0x106f63[_0x581f33(0x201)]()[_0x581f33(0x208)])){const _0x6e9a04=_0x265cd3[_0x265cd3[_0x581f33(0x1da)]-0x1],_0xe846d2=_0x581f33(0x203)==_0xf12618[_0x581f33(0x1df)]?_0x581f33(0x20e):_0x581f33(0x229);_0x6e9a04&&_0x581f33(0x1ef)==_0x6e9a04[_0x581f33(0x1df)]&&(_0x6e9a04[_0xe846d2]+='\x0a');}}}