UNPKG

@ckeditor/ckeditor5-ai

Version:

AI features for CKEditor 5.

23 lines 9.14 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 _0x3d3b59=_0x5607;(function(_0x28a477,_0x111671){const _0x259083=_0x5607,_0xbfc3c5=_0x28a477();while(!![]){try{const _0x1e5dfb=-parseInt(_0x259083(0x1f6))/0x1+-parseInt(_0x259083(0x1f7))/0x2*(parseInt(_0x259083(0x22a))/0x3)+parseInt(_0x259083(0x225))/0x4+parseInt(_0x259083(0x20d))/0x5*(parseInt(_0x259083(0x212))/0x6)+-parseInt(_0x259083(0x223))/0x7+parseInt(_0x259083(0x207))/0x8*(-parseInt(_0x259083(0x1f5))/0x9)+parseInt(_0x259083(0x20b))/0xa;if(_0x1e5dfb===_0x111671)break;else _0xbfc3c5['push'](_0xbfc3c5['shift']());}catch(_0x3d9977){_0xbfc3c5['push'](_0xbfc3c5['shift']());}}}(_0x4353,0x5689b));function _0x4353(){const _0x5aee4a=['isStreaming','147drqxjj','addEventListener','strong','map','delay','tagName','mark','join','9IQQjLz','543365fnxxZn','16084GsFRkx','sup','parent','currentIndex','div','entries','querySelectorAll','splitTextNodeIntoWordNodes','includes','textNodeStyle','isWordSplitResult','span[data-ck-html-streamer-word-chunk]','childNodes','signal','match','from','641720lgNozF','cleanUpAnimations','replaceWith','sub','16820370WhQCgr','ins','5EPtTJy','push','timeoutAbortController','abort','bind','85620Yylbcm','document','span','reverse','shouldBeStreamed','children','renderNode','nodesList','getParsedDocumentNodeList','del','onStreamUpdate','code','ai-html-streamer-current-index-out-of-bounds','isWordSplitSource','options','now','stream','4190137MmcHmx','attribs','1097524TFIKYT','length','stop','forEach'];_0x4353=function(){return _0x5aee4a;};return _0x4353();}import _0x5c750f from'morphdom';function _0x5607(_0xf81bba,_0x5a507e){const _0x435337=_0x4353();return _0x5607=function(_0x560754,_0x25bb67){_0x560754=_0x560754-0x1f4;let _0x3ac46e=_0x435337[_0x560754];return _0x3ac46e;},_0x5607(_0xf81bba,_0x5a507e);}import{NodeWithChildren as _0x1f917b,Text as _0xf97fcd,Element as _0x55a4c5,isText as _0x22914d,isDocument as _0x52f139,isTag as _0x54e023,cloneNode as _0x30b9d3,getChildren as _0x53f377,prepend as _0x3a1765,removeElement as _0x45b3e1,textContent as _0x22d713,render as _0x14e5f7}from'./htmlparser.js';import{logWarning as _0x33fd07}from'ckeditor5/src/utils.js';export class HTMLStreamer{[_0x3d3b59(0x220)];[_0x3d3b59(0x229)]=!0x1;[_0x3d3b59(0x213)]=null;[_0x3d3b59(0x219)]=[];[_0x3d3b59(0x1fa)]=0x0;[_0x3d3b59(0x20f)]=null;constructor(_0x4d02dd){const _0x2b4195=_0x3d3b59;this[_0x2b4195(0x220)]={'delay':_0x4d02dd[_0x2b4195(0x22e)]??0x14,'textNodeStyle':_0x4d02dd[_0x2b4195(0x200)],'onStreamUpdate':_0x4d02dd[_0x2b4195(0x21c)]||(()=>{})};}async[_0x3d3b59(0x222)]({document:_0x54a05c,targetElement:_0x501935,abortSignal:_0x236c08}){const _0x425710=_0x3d3b59;this[_0x425710(0x229)]&&this[_0x425710(0x227)](),_0x236c08?.[_0x425710(0x22b)](_0x425710(0x210),this[_0x425710(0x227)][_0x425710(0x211)](this)),this[_0x425710(0x213)]=_0x30b9d3(_0x54a05c,!0x0),this[_0x425710(0x219)]=this[_0x425710(0x21a)](),this[_0x425710(0x229)]=!0x0,this[_0x425710(0x1fa)]>this[_0x425710(0x219)][_0x425710(0x226)]&&(_0x33fd07(_0x425710(0x21e),{'currentIndex':this[_0x425710(0x1fa)],'nodeList':this[_0x425710(0x219)]}),this[_0x425710(0x1fa)]=this[_0x425710(0x219)][_0x425710(0x226)]);for(let _0x49c9be=0x0;_0x49c9be<this[_0x425710(0x1fa)];_0x49c9be++)this[_0x425710(0x219)][_0x49c9be][_0x425710(0x216)]=!0x0;let _0x35317c=0x0;for(let _0x3bc118=this[_0x425710(0x1fa)];_0x3bc118<this[_0x425710(0x219)][_0x425710(0x226)];_0x3bc118++){const _0xd7070f=Date[_0x425710(0x221)](),_0x4b7cf6=this[_0x425710(0x219)][_0x3bc118],_0x500dcd=_0xd7070f-_0x35317c;_0x4b7cf6[_0x425710(0x216)]=!0x0;let _0x3c0c1d=_0x4b7cf6[_0x425710(0x1f9)];for(;_0x3c0c1d;)_0x3c0c1d[_0x425710(0x216)]=!0x0,_0x3c0c1d=_0x3c0c1d[_0x425710(0x1f9)];if(_0x500dcd<this[_0x425710(0x220)][_0x425710(0x22e)])try{const {promise:_0x3d7905,abortController:_0x12de14}=pr(this[_0x425710(0x220)][_0x425710(0x22e)]-_0x500dcd);this[_0x425710(0x20f)]=_0x12de14,await _0x3d7905;}catch(_0x585d4b){return;}_0x5c750f(_0x501935,'<'+_0x501935[_0x425710(0x22f)]+'>'+this[_0x425710(0x218)](this[_0x425710(0x213)])+'</'+_0x501935[_0x425710(0x22f)]+'>',{'childrenOnly':!0x0}),this[_0x425710(0x220)][_0x425710(0x21c)]&&this[_0x425710(0x220)][_0x425710(0x21c)](),this[_0x425710(0x1fa)]=_0x3bc118,_0x35317c=Date[_0x425710(0x221)]();}this[_0x425710(0x229)]=!0x1;}[_0x3d3b59(0x208)]({targetElement:_0xb190f7}){const _0x477360=_0x3d3b59;Array[_0x477360(0x206)](_0xb190f7[_0x477360(0x1fd)](_0x477360(0x202)))[_0x477360(0x215)]()[_0x477360(0x228)](_0x5eb1c7=>{const _0x2728d9=_0x477360;_0x5eb1c7[_0x2728d9(0x209)](_0x5eb1c7[_0x2728d9(0x203)][0x0]);});}[_0x3d3b59(0x227)](){const _0x492156=_0x3d3b59;this[_0x492156(0x229)]=!0x1,this[_0x492156(0x20f)]&&(this[_0x492156(0x20f)][_0x492156(0x210)](),this[_0x492156(0x20f)]=null);}[_0x3d3b59(0x218)](_0x29e041){const _0xc56cc5=_0x3d3b59;let _0x4c3bab='';if(function(_0x38a89f){return _0x52f139(_0x38a89f);}(_0x29e041)){for(const _0x1566ad of _0x29e041[_0xc56cc5(0x217)])_0x4c3bab+=this[_0xc56cc5(0x218)](_0x1566ad);}else{if(dr(_0x29e041)){if(!_0x29e041[_0xc56cc5(0x216)])return'';const _0x56a86c=_0x29e041,_0x390751=Object[_0xc56cc5(0x1fc)](_0x56a86c[_0xc56cc5(0x224)])[_0xc56cc5(0x22d)](([_0x4c5794,_0x25d2e2])=>_0x4c5794+'=\x22'+_0x25d2e2+'\x22')[_0xc56cc5(0x1f4)]('\x20');_0x4c3bab+='<'+_0x56a86c[_0xc56cc5(0x22f)]+(_0x390751?'\x20'+_0x390751:'')+'>';for(const _0x120ac2 of _0x53f377(_0x56a86c))_0x4c3bab+=this[_0xc56cc5(0x218)](_0x120ac2);_0x4c3bab+='</'+_0x56a86c[_0xc56cc5(0x22f)]+'>';}else{if(!ar(_0x29e041))return'';if(!_0x29e041[_0xc56cc5(0x216)])return'';!function(_0xc9d36b){const _0x14bc10=_0xc56cc5;if(!_0xc9d36b[_0x14bc10(0x1f9)]||!dr(_0xc9d36b[_0x14bc10(0x1f9)]))return!0x1;if(!cr[_0x14bc10(0x1ff)](_0xc9d36b[_0x14bc10(0x1f9)][_0x14bc10(0x22f)]))return!0x1;return!_0x22d713(_0xc9d36b)[_0x14bc10(0x205)](/^\s*[<>]\s*$/);}(_0x29e041)?_0x4c3bab+=_0x14e5f7(_0x29e041):_0x4c3bab+=_0x14e5f7(new _0x55a4c5(_0xc56cc5(0x214),{'data-ck-html-streamer-word-chunk':'','style':this[_0xc56cc5(0x220)][_0xc56cc5(0x200)]},[_0x29e041]));}}return _0x4c3bab;}[_0x3d3b59(0x21a)](){const _0x11c9b3=_0x3d3b59,_0xb056a3=[];return function(_0x5c28d5,_0x3438c4){const _0x1130ff=_0x5607,_0x4ecc2c=_0x53e40e=>{const _0x116ee2=_0x5607;if(_0x3438c4(_0x53e40e),_0x53e40e instanceof _0x1f917b)for(let _0x199596=0x0;_0x199596<_0x53e40e[_0x116ee2(0x217)][_0x116ee2(0x226)];_0x199596++){const _0x213ad4=_0x53e40e[_0x116ee2(0x217)][_0x199596];_0x4ecc2c(_0x213ad4);}};for(let _0x283f84=0x0;_0x283f84<_0x5c28d5[_0x1130ff(0x217)][_0x1130ff(0x226)];_0x283f84++)_0x4ecc2c(_0x5c28d5[_0x1130ff(0x217)][_0x283f84]);}(this[_0x11c9b3(0x213)],_0x305493=>{const _0xf8bc04=_0x11c9b3;if(ar(_0x305493)){const _0x3f1d71=this[_0xf8bc04(0x1fe)](_0x305493);_0x3f1d71[_0xf8bc04(0x226)]&&_0xb056a3[_0xf8bc04(0x20e)](..._0x3f1d71);}_0x305493[_0xf8bc04(0x21f)]||_0x305493[_0xf8bc04(0x201)]||_0xb056a3[_0xf8bc04(0x20e)](_0x305493);}),_0xb056a3;}[_0x3d3b59(0x1fe)](_0x566022){const _0x12414e=_0x3d3b59;if(_0x566022[_0x12414e(0x21f)]||_0x566022[_0x12414e(0x201)])return[];const _0x327e35=_0x22d713(_0x566022)[_0x12414e(0x205)](/(?:\s*\S+\s*)/g),_0x1616b0=[];if(_0x327e35&&_0x327e35[_0x12414e(0x226)]>0x1){for(const _0x327626 of _0x327e35){const _0x552060=new _0xf97fcd(_0x327626);_0x552060[_0x12414e(0x201)]=!0x0,_0x3a1765(_0x566022,_0x552060),_0x1616b0[_0x12414e(0x20e)](_0x552060);}_0x566022[_0x12414e(0x21f)]=!0x0,_0x45b3e1(_0x566022);}return _0x1616b0;}}const cr=['p','li','td','th',_0x3d3b59(0x214),'h1','h2','h3','h4','h5','h6','b',_0x3d3b59(0x22c),'i','em',_0x3d3b59(0x230),_0x3d3b59(0x21b),_0x3d3b59(0x20c),_0x3d3b59(0x1f8),_0x3d3b59(0x20a),'a',_0x3d3b59(0x21d),_0x3d3b59(0x1fb)];function ar(_0x1c193f){return _0x22914d(_0x1c193f);}function dr(_0x1ce329){return _0x54e023(_0x1ce329);}function pr(_0x25eade){const _0x112ac4=new AbortController();return{'promise':new Promise((_0x52206a,_0x196c95)=>{const _0x51cb48=_0x5607,_0x2469db=setTimeout(_0x52206a,_0x25eade);_0x112ac4[_0x51cb48(0x204)][_0x51cb48(0x22b)](_0x51cb48(0x210),()=>{clearTimeout(_0x2469db),_0x196c95();});}),'abortController':_0x112ac4};}