-
Notifications
You must be signed in to change notification settings - Fork 4
/
jstypograph_minified.js
11 lines (11 loc) · 15.3 KB
/
jstypograph_minified.js
1
2
3
4
5
6
7
8
9
10
11
/*!
* JS Typograph
* The Javascript Typography Correcter
*
* @version 3.0.2
* @author «BufferOverflow»
* @copyright Данил Ерошенко «BufferOverflow» <buffer.overflow.x86 at gmail dot com>
* @link https://github.com/BufferOverflowx86/JSTypography3
* @license MIT; https://opensource.org/licenses/MIT
*/
!function(){function v(r,t){return new RegExp(r,t)}Array.indexOf||(Array.prototype.indexOf=function(r){for(var t=0;t<this.length;t++)if(this[t]==r)return t;return-1}),String.r||(String.prototype.r=String.prototype.replace);var g={protectStack:[],defaultConfig:{mode:"text",br:!1,chars:!0,tabs:!0,quotes:!0,quotesLevel:2,lang:"rus",href:!0,functions:!0,spaces:!0,dashs:!0,h1:!0,nbsp:!0,clearUntypo:!1,nbsptabs:!1},fixConfig:function(r){return Object.assign(this.defaultConfig,r)},protect:function(r,t){s=t.match(v("<untypoX?>[\\s\\S]+?</untypoX?>","g"));var $=0;if(s)for(;$<s.length;$++)t=t.r(s[$],"✁UNTYPO"+this.protectStack.length+"S✃"),this.protectStack.push(s[$]);return t},unprotect:function(r,t){for(;0<this.protectStack.length;){var $=this.protectStack.pop().r(v("<\\/?untypoX>","g"),""),$=r.clearUntypo?$.r(v("<\\/?untypo>","g"),""):$;t=t.r("✁UNTYPO"+this.protectStack.length+"S✃",$)}return t},typographySelection:function(r,t){typobegin=!0,typoend=!0;var $,g,n,e,o="",a=t.scrollTop;t&&t.value&&null!=t.selectionStart?(g=t.selectionStart,n=t.selectionEnd,""==(o=t.value.substring(g,n))?t.value=this.typographyText(r,t.value,typobegin,typoend):(0!=g&&"\n"!=t.value.charAt(g-1)&&"\r"!=t.value.charAt(g-1)&&(typobegin=!1),n!=t.value.length&&"\n"!=t.value.charAt(n)&&"\r"!=t.value.charAt(n)&&(typoend=!1),$=this.typographyText(r,o,typobegin,typoend),t.value=t.value.substring(0,g)+$+t.value.substring(n))):!document.selection||!document.selection.createRange||""==(o=(e=document.selection.createRange()).text)?t.value=this.typographyText(r,t.value,typobegin,typoend):(typobegin=!1,typoend=!1,$=this.typographyText(r,o,typobegin,typoend),e.text=$),t.scrollTop=a},typographyText:function(e,o,r,t){null==r&&(r=!0),null==t&&(t=!0);var $,g=-1!=e.mode.indexOf("forum"),n=-1!=e.mode.indexOf("html"),a=["—","«","»","…","©","®","™","←","→","↑","↓","↔","°","́","×","≠","±","↕","‘","’","−","–","“","”","„","≥","≤","§","€","£","″","√","∫","½","¼","¾"," ","‚","¹","²","³","⅓","⅔","⅕","⅖","⅗","⅘","⅙","⅚","⅛","⅜","⅝","⅞","≈",'"',"⁰","⁴","⁵","⁶","⁷","⁸","⁹","⁺","⁻","⁼","⁽","⁾","ⁿ","ⁱ","₀","₁","₂","₃","₄","₅","₆","₇","₈","₉","₊","₋","₌","₍","₎"],i=["mdash","laquo","raquo","hellip","copy","reg","trade","larr","rarr","uarr","darr","harr","deg","#769","times","ne","plusmn","#8597","lsquo","rsquo","minus","ndash","ldquo","rdquo","bdquo","ge","le","sect","euro","pound","Prime","radic","int","frac12","frac14","frac34","nbsp","sbquo","sup1","sup2","sup3","#8531","#8532","#8533","#8534","#8535","#8536","#8537","#8538","#8539","#8540","#8541","#8542","#8776","quot","#8304","#8308","#8309","#8310","#8311","#8312","#8313","#8314","#8315","#8316","#8317","#8318","#8319","#8305","#8320","#8321","#8322","#8323","#8324","#8325","#8326","#8327","#8328","#8329","#8330","#8331","#8332","#8333","#8334"],s=v("([ \n\t\v]|^)(((ht|f)tps?://)?([\\-\\w]+:[\\-\\w]+@)?([0-9a-z][\\-0-9a-z]*[0-9a-z]\\.)+[a-z]{2,6}(:\\d{1,5})?([?/\\\\#][?!^$.(){}:|=[\\]+\\-/\\\\*;&~#@,%\\wА-Яа-я]*)?)([ \n\t\v]|$)","gi"),p=v("([ \n\t\v]|^)([\\-a-z0-9!#$%&'*+\\/=?^_`{|}~]+(\\.[\\-a-z0-9!#$%&'*+\\/=?^_`{|}~]+)*@([a-z0-9]([\\-a-z0-9]{0,61}[a-z0-9])?.)*([a-z]{2,6}))([ \n\t\v]|$)","gi");o=o.r(/(\r\n|\r)/g,"\n"),g&&(o=o.r(/(\[code[^\]$\n]*\\]|\[quote[^\]$\n]*\]|\[img\])/g,"<untypoX>$1").r(/(\[\/code\]|\[\/quote\]|\[\/img\])/g,"$1</untypoX>").r(/(\[url[^\[\]]+?\])/g,"<untypoX>$1</untypoX>")),n&&(o=o.r(/(<pre[^<>]*?>)/g,"<untypoX>$1").r(/(<\/pre>)/g,"$1</untypoX>").r(/(<script[^<>]*?>|<style[^<>]*?>)/g,"<untypoX>$1").r(/(<\/script>|<\/style>)/g,"$1</untypoX>").r(/(<!--(.|\n)*?-->)/g,"<untypoX>$1</untypoX>").r(/(="[^"\n\r]*")/g,"<untypoX>$1</untypoX>"));for(var u=0;u<10;++u)o=(o=o.r(v("(<untypoX>)([\\s\\S]*?)(<\\/?untypoX>)","g"),function(r,t,$,g){return"/"!=g.charAt(1)?t+$:r})).r(v("(<\\/untypoX>)([\\s\\S]*?)(<\\/?untypoX>)","g"),function(r,t,$,g){return"/"==g.charAt(1)?$+g:r});if(o=this.protect(e,o),n&&e.href)for(u=0;u<2;++u)o=(o=o.r(s,'$1<untypoX><a href="$2">$2</a></untypoX>$9')).r(p,'$1<untypoX><a href="mailto:$2">$2</a></untypoX>$7');else for(u=0;u<2;++u)o=o.r(s,"$1<untypoX>$2</untypoX>$9").r(p,"$1<untypoX>$2</untypoX$7");o=this.protect(e,o);for(var h,c,u=0;u<i.length;++u)o=o.r(v("&"+i[u]+";","g"),a[u]);if(e.br&&(o=o.r(/<br( *[^\n>]*?)?\/?>/gi,"\n")),o=(o=(o=o.r(/<\/?p>/gi,"")).r(/<\/?h1>/gi,"")).r(/<\/?nobr>/gi,""),e.chars&&(o=o.r(/\(c\)/g,"©").r(/\(r\)/g,"®").r(/\(tm\)/g,"™"),n||(o=o.r(/</g,"<").r(/>/g,">")),o=o.r(/…/g,"...")),e.quotes&&(o=o.r(/«|»|”|“|„/g,'"'),"eng"!=e.lang&&(o=o.r(/‚|‘/g,'"'))),e.functions){if($=(o=(o=o.r(/(УДАР|ACNT)\(([\wА-яёЁ]?)\)/g,"$2́").r(/(СТРЛ|ARRW)\(([\wА-яёЁ]+?)\)/g,function(r,t,$){return"В"==$||"U"==$?"↑":"Н"==$||"D"==$?"↓":"Л"==$||"L"==$?"←":"П"==$||"R"==$?"→":"ЛП"==$||"LR"==$?"↔":"ВН"==$||"UD"==$?"↕":r})).r(/(ГРАД|DEGR)\(([0-9\.]*)\)/g,"$2°").r(/(ПАРА|SECT)\(([IVXLСDМ0-9]*)\)/g,"§ $2").r(/(ЕВРО|EURO)\(([0-9\.]*)\)/g,"$2€").r(/(ФУНТ|PUND)\(([0-9\.]*)\)/g,"$2£").r(/(ДЮЙМ|INCH)\(([0-9\.]*)\)/g,"$2″").r(/(КОРН|SQRT)\(([\w0-9]*)\)/g,"√$2").r(/(ИНТГ|INTG)\(([\w0-9]*)\)/g,"∫$2").r(/(ГРЕЧ|GREK)\(([A-Za-z])\)/g,function(r,t,$){for(var g=0;g<52;++g)if($=="ABGDEZHJIKLMNQCOPRSTYUFXVWabgdezhjiklmnqcoprstyufxvw".charAt(g))return"ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΞΟΠΡΣΤΥΥΦΧΨΩαβγδεζηθικλμνξξοπρστυυφχψω".charAt(g);return"?"})).match(/(ВЕРХ|SUPS)\[([0-9+\-=\(\)ni]+)\]/g))for(u=0;u<$.length;++u){for(var l="0123456789-=ni",f="⁰¹²³⁴⁵⁶⁷⁸⁹⁻⁼ⁿⁱ",y=$[u].r(/(ВЕРХ|SUPS)\[([0-9+\-=\(\)ni]+)\]/g,"$2"),d=0;d<14;++d)y=y.r(v(l.charAt(d),"g"),f.charAt(d));y=y.r(/\+/g,"⁺").r(/\(/g,"⁽").r(/\)/g,"⁾"),o=o.r($[u],y)}if($=o.match(/(НИЖН|SUBS)\[([0-9+\-=\(\)]+)\]/g))for(u=0;u<$.length;++u){for(l="0123456789-=",f="₀₁₂₃₄₅₆₇₈₉₋₌",y=$[u].r(/(НИЖН|SUBS)\[([0-9+\-=\(\)]+)\]/g,"$2"),d=0;d<12;++d)y=y.r(v(l.charAt(d),"g"),f.charAt(d));y=y.r(/\+/g,"₊").r(/\(/g,"₍").r(/\)/g,"₎"),o=o.r($[u],y)}}if(e.spaces){r&&(o=o.r(/(^)[ \t]+/g,"$1")),o=(o=(o=o.r(/([\d]) ?(€|£|л\.|[скм]?м[\/\^¹²³\.\s]|г[аг]?[\s\.]|ц\.|т[\s\.]|р\.|руб\.|уе|тыс\.|млн|млрд)/g,"$1 $2").r(/([\d]) г\.[ ]?г\./g,"$1 гг.").r(/([IVXLCDM]) ?(вв?\.)/g,"$1 $2").r(/([IVXLCDM]) в\.[ ]?в\./g,"$1 вв.")).r(/([^\d]|^)([\d]+(?:[\.,][\d]+)?) ?\$/g,"$1$$$2").r(/(\,|;|:|!|\?|\))([^\d\s=?!:,\.'’‘‚"«»“”\[])/gi,"$1 $2").r(/(\[color=[^\n]*\])( | )( | )( | )( | )/g,"$2$3$4$5$1").r(/ {2,}/g," ").r(/\.([^\s\dA-Za-z\n=?:;,\.'’‘"»„“”\[]+)/gi,". $1").r(/([А-яёЁ])\.([^\sA-Za-z\n=?:;,\.'’‘"»„“”\[]+)/g,"$1. $2").r(/ (\.|,|!|\?|;|:)/g,"$1").r(/(—|–|-)\.{2,4} /g,"$1 ...").r(/(\n|^|&)( *)\.{2,4} /g,"$1$2...").r(/(['‘‚"«„“\(])\.{2,4} /g,"$1...").r(/(\s|^)\.{2,4}[ ]/g,"$1...").r(/\( /g,"(").r(/ \)/g,")").r(/([^\s])\(/g,"$1 (").r(/([^\d])(,|\.)([\d])/g,"$1$2 $3").r(/(!|\?|\))([^\s=?!:,\.'’‘‚"«»“”\[]+)/gi,"$1 $2").r(/ %/g,"%").r(/P\. ?P\. ?S\./g,"P. P. S.").r(/P\. ?S\./g,"P. S.").r(/и др\./g,"и др.").r(/([\s]|^)(гл?|ул|д|илл)\. ([A-Za-zА-яёЁ0-9])/g,"$1$2. $3").r(/(\s|^)([тнсюзв])\. ?([еочнпдшдэ])\./g,"$1$2. $3.").r(/(\s|^)т\.? ?([нпдч])\./g,"$1т. $2.").r(/ н\. э\./g," н. э").r(/([№§]) ?([\dIVXLCDM])/g,"$1 $2").r(/(\d)([lpd]pi)([\s,\.!?]|$)/g,"$1 $2$3").r(/ГОСТ /gi,"ГОСТ ").r(/ГОСТ Р /gi,"ГОСТ Р ").r(/([\s]|^)до[ ]нэ\./g,"$1до н. э.")).r(/ {2,}/g," ");for(u=0;u<2;++u)o=o.r(/([ \n\t\v]|^)([иаксуов]|же|до|из|н[аое]|по|о[тб]|за|как|что|над|под|пр[ои]|или|для|без|если|едва|л?ибо|зато|пока|дабы|ежели|когда|перед|чтобы|через|пусть|будто|однако|словно) ([А-яёЁ])/gi,"$1$2 $3")}if(o=o.r(/(\n|^)[ \t]+/g,"$1"),e.tabs&&(n||(o=o.r(/(\n)([^\s])/g,"$1 $2").r(/(^|\n) +/g,"$1 ").r(/(\n|^) +\n/g,"$1\n"),r&&(o=o.r(/(^)([^\s])/g,"$1 $2")))),e.dashs&&("rus"==e.lang&&(h="(где|зачем|как|какая|каки[емх]|како[ейм]|какого|какому|кем|когда|кого|кому?|кто|куда|откуда|почему|чего|чему?|что|ч[её]м)",c="(январ"+(c="(?:[ьяюе]|[её]м)")+"|феврал"+c+"|март"+(g="(?:[ауе]|ом)")+"|апрел"+c+"|ма(?:[йяюе]|ем)|ию[нл]"+c+"август"+g+"|сентябр"+c+"|ноябр"+c+"|октябр"+c+"|декабр"+c+")",o=(o=(o=(o=(o=(o=o.r(/(\s|^|<p>)([«"„‚]*)(-|–)([\s]|$)/g,"$1$2—$4")).r(/([A-Za-zА-яёЁ0-9]) —/g,"$1 —")).r(/([\.,!?] |\n|^|<p>)— ([A-Za-zА-яёЁ0-9«"„‚])/g,"$1— $2")).r(v("([^А-яёЁ]|^)"+h+"(?:[ ]?|-[ ]|[ ]-)(то|либо|нибудь)([^А-яёЁ]|$)","gi"),"$1$2-$3$4").r(v("([^А-яёЁ]|^)"+h+"(?:[ ]?|-[ ]|[ ]-)(то|либо|нибудь)([^А-яёЁ]|$)","gi"),"$1$2-$3$4").r(v("([^А-яёЁ]|^)(кое|кой)(?:[ ]?[-—]?[ ]?)"+h+"([^А-яёЁ]|$)","gi"),"$1$2-$3$4").r(v("([^А-яёЁ]|^)(ко[ей])(?:[ ]?[-—]?[ ]?)"+h+"([^А-яёЁ]|$)","gi"),"$1$2-$3$4").r(/([\s]|^)(из)(?:[ ]?[-—]?[ ]?)(за)([\s]|$)/gi,"$1$2-$3$4").r(/([\s]|^)(из)(?:[ ]?[-—]?[ ]?)(под)([\s]|$)/gi,"$1$2-$3$4").r(/([А-яёЁ]{2,}) (ка|кась)([\s,\.\?!]|$)/g,"$1-$2$3").r(/([^А-яёЁ]|^)(вс[ёе]|так)(?:[ ]?|-[ ]|[ ]-)(таки)([^А-яёЁ]|$)/gi,"$1$2-$3$4").r(/(ГОСТ(?:[ ]Р)?(?:[ ](?:ИСО|ISO))?)[ ]([\d\.]+)-([\d]+)/gi,"$1 $2–$3")).r(/([IVXLCDM]{1,3})-([IVXLCDM]{1,3})[ ]?вв?\.?([\s\.,?!;\)])/g,"$1—$2 вв.$3").r(/([\d]{1,4})-([\d]{1,4})[ ]?гг?\.([\s\.,?!;\)])/g,"$1–$2 гг.$3").r(/([^\d]|^)([0-2][0-9]:[0-5][0-9])-([0-2][0-9]:[0-5][0-9])([^\d]|$)/g,"$1$2–$3$4")).r(v("([\\s]|^)([1-3]?[\\d])-([1-3]?[\\d])[ ]?"+c+"([^А-яёЁ]|$)","gi"),"$1$2–$3 $4$5").r(v("([^А-яёЁ]|^)"+c+"-"+c+"([^А-яёЁ]|&)","gi"),"$1$2—$3$4")),o=o.r(/(\d)--(\d)/g,"$1–$2").r(/([^-]|\s|^)--([^-]|$|\n)/g,"$1—$2").r(/([^-\d]|^)(\d+)-(\d+)([^-\d]|$)/g,"$1$2−$3$4").r(/([^a-z][a-z]|[Α-Ωα-ω+=*\/])-(\d)/g,"$1−$2")),e.chars&&(h="([^0-9A-Za-zА-яёЁ/]|^)",c="([^0-9A-Za-zА-яёЁ/]|$)",o=(o=(o=o.r(/([^\.])\.{2,4}/g,"$1...").r(/(\?!|!\?)\.{3}/g,"?!.").r(/\?\.{3}/g,"?..").r(/!\.{3}/g,"!..").r(/(!+)(\?+)/g,"$2$1").r(/(\d+?)[xх](\d+?)/g,"$1×$2").r(/(\d+?)([ ])[xх]([ ])(\d+?)/g,"$1×$4").r(/([0-9a-zA-ZΑ-Ωα-ωА-яёЁ])\^([0-9]+)/g,function(r,t,$){for(var g=$,n=0;n<10;++n)g=g.r(v("0123456789".charAt(n),"g"),"⁰¹²³⁴⁵⁶⁷⁸⁹".charAt(n));return t+g}).r(/!=/g,"≠").r(/\+\/[\-−]/g,"±").r(/~=/g,"≈").r(/<=/g,"≤").r(/>=/g,"≥").r(/<->/g,"↔").r(/<-([^-]|&)/g,"←$1").r(/([^-]|^)->/g,"$1→").r(/(!+)(\?+)/g,"$2$1").r(/\?{3,}/g,"???").r(/!{3,}/g,"!!!")).r(v(h+"1/2"+c,"g"),"$1½$2").r(v(h+"1/4"+c,"g"),"$1¼$2").r(v(h+"2/4"+c,"g"),"$1½$2").r(v(h+"3/4"+c,"g"),"$1¾$2").r(v(h+"1/3"+c,"g"),"$1⅓$2").r(v(h+"2/3"+c,"g"),"$1⅔$2").r(v(h+"1/5"+c,"g"),"$1⅕$2").r(v(h+"2/5"+c,"g"),"$1⅖$2").r(v(h+"3/5"+c,"g"),"$1⅗$2").r(v(h+"4/5"+c,"g"),"$1⅘$2").r(v(h+"1/6"+c,"g"),"$1⅙$2").r(v(h+"2/6"+c,"g"),"$1⅓$2").r(v(h+"3/6"+c,"g"),"$1½$2").r(v(h+"4/6"+c,"g"),"$1⅔$2").r(v(h+"5/6"+c,"g"),"$1⅚$2").r(v(h+"1/8"+c,"g"),"$1⅛$2").r(v(h+"2/8"+c,"g"),"$1¼$2").r(v(h+"3/8"+c,"g"),"$1⅜$2").r(v(h+"4/8"+c,"g"),"$1½$2").r(v(h+"5/8"+c,"g"),"$1⅝$2").r(v(h+"6/8"+c,"g"),"$1¾$2").r(v(h+"7/8"+c,"g"),"$1⅞$2").r(/,+/g,",").r(/:+/g,":").r(/;+/g,";").r(/([a-zA-ZА-яёЁ0-9]) (а|но)([\s$,]|\.\.\.)/g,"$1, $2$3").r(/([a-zA-ZА-яёЁ0-9]) однако([\s$,\.!?:])/g,"$1, однако$2")).r(/([^a-zА-яёЁ]|^)([a-zА-яёЁ]+)[ ](\2)([^a-zA-ZА-яёЁ]|$)/gi,"$1$2$4")),e.quotes)if(o=(o=(o=o.r(/(^|\n|\s|—|-|\()"/g,"$1«").r(/"($|\n|\s|—|-|\.|,|!|\?|:|;|\))/g,"»$1").r(/«\)/g,"»)").r(/«( ?)/g,"«").r(/( ?)»/g,"»").r(/>"/g,">«").r(/"</g,"»<").r(/«""/g,"«««").r(/«"/g,"««").r(/""»/g,"»»»").r(/"»/g,"»»").r(/("{2}|"»)/g,"»»").r(/$"/g,"«").r(/([A-Za-zа-яА-ЯёЁ])'/g,"$1’")).r(/[a-zA-ZА-яёЁ]"-/g,"$1»-").r(/-"[a-zA-ZА-яёЁ]/g,"-«$1")).r(/(^[^«»]*)"/g,"$1«").r(/"([^«»]*$)/g,"»$1").r(/«([^«»]*)"/g,"«$1»").r(/"([^«»]*)»/g,"«$1»"),"rus"==e.lang&&1<e.quotesLevel){for(var A=0,u=0;u<o.length;++u)if("«"==o.charAt(u)){++A;for(d=u+1;d<o.length;++d)if("«"==o.charAt(d)&&++A,"»"==o.charAt(d)&&--A<=0){o=function(r,t){var $,g="",n="";for(0!=r&&(g=o.substring(0,r)),t!=o.length-1&&(n=o.substring(t+1,o.length)),$=o.substring(r,t+1),r=0;r<32;++r)$=$.r(/«([^«»]*)«([^»]*)»/g,"«$1„$2“"),2<e.quotesLevel&&($=$.r(/„([^„“]*)„([^“]*)“/g,"„$1‚$2‘"));return g+$+n}(u,d),u=d;break}A=0}}else o=o.r(/'([A-Za-zа-яА-ЯёЁ])/g,"‘$1");if(n&&(e.chars&&(o=o.r(/<(?!\/?[A-Za-z][^\n$<>]*>|!--)/g,"<").r(/(<\/?[A-Za-z][^\n$<>]*|--)?>/g,function(r,t){return t?r:">"})),e.tabs&&(o=o.r(/(\n)(?!<p>)([^\n]*)(?!<\/p>)(\n)/g,"$1<p>$2</p>$3").r(/(\n)(?!<p>)([^\n]*)(?!<\/p>)(\n)/g,"$1<p>$2</p>$3").r(/ +<\/p>(\n)/g,"</p>$1"),r&&(o=o.r(/(^)(?!<p>)([^\n]*)(?!<\/p>)(\n)/g,"$1<p>$2</p>$3"),t&&(o=o.r(/(^)(?!<p>)([^\n]*)(?!<\/p>)($)/g,"$1<p>$2</p>$3"))),t&&(o=o.r(/(\n)(?!<p>)([^\n]*)(?!<\/p>)($)/g,"$1<p>$2</p>$3").r(/ +<\/p>(\n|$)/g,"</p>$1")),o=(o=(o=o.r(/<p>(UNTYPO[\d]+)<\/p>/g,"$1")).r(/<p><\/p>/g,"").r(/<p>(UNTYPO[\d]+S)<\/p>/g,"$1")).r(/<p>(.*?<\/?)([uo]l|li|h\d)(>.*?)<\/p>/g,"$1$2$3")),e.h1&&(r=e.tabs?"<p>":"",t=e.tabs?"</p>":"",o=o.r(v("(\n|^)"+r+'([А-яёЁa-zA-Z0-9"«“][^\n]{1,50}[А-яёЁa-zA-Z0-9"»”)])'+t+"(\n|$)","g"),"$1<h1>$2</h1>$3").r(/<h1>([^а-яА-ЯёЁa-zA-Z§]+?)<\/h1>/g,r+"$1"+t).r(v("(\n|^)"+r+"(Глава|Chapter|Section|§)([ ]?[IVXLСDМ0-9][^\n]{0,43})"+t+"(\n|$)","g"),"$1<h1>$2$3</h1>$4").r(v("(\n|^)"+r+"(Эпилог|Пролог|Epilogue|Prologue)(.?)"+t+"(\n|$)","g"),"$1<h1>$2$3</h1>$4").r(/<h1>(UNTYPO[\d]+S)<\/h1>/g,"$1")),e.nbsp&&(o=o.r(/([А-яёЁa-zA-Z0-9]+)((?:-[А-яёЁa-zA-Z0-9]+)+)/g,"<nobr>$1$2</nobr>"))),"eng"==e.lang&&(o=o.r(/«/g,"“").r(/»/g,"”")),e.nbsp||(o=o.r(/ /g," ")),e.br&&(o=o.r(/\n/g,"<br />")),o=o.r(/ (\))/g,"$1"),n)for(u=0;u<a.length;++u)o=o.r(v(a[u],"g"),"&"+i[u]+";");return e.nbsptabs&&(o=o.r(/ /g," ")),o=this.unprotect(e,o)}};window.JsTypograph=function(r){this.config=g.fixConfig(r),this.textAreas=[],this.setConfig=function(r){this.config=Object.assign(this.config,r)},this.typographyText=function(r,t=!0,$=!0){return g.typographyText(this.config,r,t,$)},this.typographySelection=function(r){return g.typographySelection(this.config,textArea)},this.typography=function(){for(var r=0;r<this.textAreas.length;++r)this.typographySelection(this.textAreas[r])},this.addTextArea=function(r){this.textAreas.push(r)},this.removeTextArea=function(r){r=textAreas.indexOf(r);-1<r&&textAreas.splice(r,1)},this.typography=this.typography.bind(this),this.addButton=function(r){var t,$;t=r,$="click",r=this.typography,t.addEventListener?t.addEventListener($,r,!1):aelementattachEvent("on"+$,r)},this.removeButton=function(r){var t,$;t=r,$="click",r=this.typography,t.removeEventListener?t.removeEventListener(b,c,!1):t.detachEvent("on"+$,r)}},window.JsTypographCore=g}();