Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

typograf

Package Overview
Dependencies
Maintainers
1
Versions
101
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

typograf - npm Package Compare versions

Comparing version 5.5.0 to 5.5.1

dist/typograf.all.min.js

3

CHANGELOG.md
# Changelog
# v5.5.1
Внесены правки по расстановке кавычек при пропуске пробелов #158.
# v5.5.0

@@ -4,0 +7,0 @@ - Новое правило `ru/typo/switchingKeyboardLayout` исправляет опечатки, возникающие при переключении клавиатурной раскладки.

102

dist/typograf.js

@@ -150,2 +150,3 @@ /*! Typograf | © 2015 Denis Seleznev | https://github.com/typograf/typograf/ */

Typograf._privateLabel = '\uDBFF';
Typograf._privateQuote = '\uDBFE';

@@ -327,5 +328,8 @@ Typograf.prototype = {

reClosingTag = new RegExp(privateLabel + quotes + '([\\s!?.:;#*,]|$)', 'g'),
count = 0;
count = 0,
symbols = this.data('lLd');
text = text
// Hide incorrect quotes.
.replace(new RegExp('([' + symbols + '])"(?=[' + symbols + '])', 'g'), '$1' + Typograf._privateQuote)
.replace(reQuotes, function() {

@@ -342,13 +346,11 @@ count++;

if (lquote2 && rquote2 && count % 2 === 0) {
return this._innerQuote(text, settings);
text = this._innerQuote(text, settings);
}
return text;
// Restore incorrect quotes.
return text.replace(new RegExp(Typograf._privateQuote, 'g'), '"');
},
_innerQuote: function(text, settings) {
var openingQuotes = [settings.lquote],
closingQuotes = [settings.rquote],
lquote = settings.lquote,
rquote = settings.rquote,
bufText = new Array(text.length);
closingQuotes = [settings.rquote];

@@ -365,7 +367,13 @@ if (settings.lquote2 && settings.rquote2) {

var level = -1,
maxLevel = openingQuotes.length - 1;
var lquote = settings.lquote,
rquote = settings.rquote,
bufText = new Array(text.length),
privateQuote = Typograf._privateQuote,
minLevel = -1,
maxLevel = openingQuotes.length - 1,
level = minLevel;
for (var i = 0, len = text.length; i < len; i++) {
var letter = text[i];
if (letter === lquote) {

@@ -378,3 +386,3 @@ level++;

} else if (letter === rquote) {
if (level <= -1) {
if (level <= minLevel) {
level = 0;

@@ -385,7 +393,11 @@ bufText.push(openingQuotes[level]);

level--;
if (level < -1) {
level = -1;
if (level < minLevel) {
level = minLevel;
}
}
} else {
if (letter === privateQuote) {
level = minLevel;
}
bufText.push(letter);

@@ -630,3 +642,3 @@ }

Typograf.version = '5.5.0';
Typograf.version = '5.5.1';

@@ -1166,2 +1178,34 @@ Typograf.groupIndexes = {

Typograf.rule({
name: 'common/number/fraction',
handler: function(text) {
return text.replace(/(^|\D)1\/2(\D|$)/g, '$1½$2')
.replace(/(^|\D)1\/4(\D|$)/g, '$1¼$2')
.replace(/(^|\D)3\/4(\D|$)/g, '$1¾$2');
}
});
Typograf.rule({
name: 'common/number/mathSigns',
handler: function(text) {
return Typograf._replace(text, [
[/!=/g, '≠'],
[/<=/g, '≤'],
[/(^|[^=])>=/g, '$1≥'],
[/<=>/g, '⇔'],
[/<</g, '≪'],
[/>>/g, '≫'],
[/~=/g, '≅'],
[/(^|[^+])\+-/g, '$1±']
]);
}
});
Typograf.rule({
name: 'common/number/times',
handler: function(text) {
return text.replace(/(\d)[ \u00A0]?[xх][ \u00A0]?(\d)/g, '$1×$2');
}
});
Typograf.rule({
name: 'common/other/delBOM',

@@ -2205,34 +2249,2 @@ queue: 'start',

Typograf.rule({
name: 'common/number/fraction',
handler: function(text) {
return text.replace(/(^|\D)1\/2(\D|$)/g, '$1½$2')
.replace(/(^|\D)1\/4(\D|$)/g, '$1¼$2')
.replace(/(^|\D)3\/4(\D|$)/g, '$1¾$2');
}
});
Typograf.rule({
name: 'common/number/mathSigns',
handler: function(text) {
return Typograf._replace(text, [
[/!=/g, '≠'],
[/<=/g, '≤'],
[/(^|[^=])>=/g, '$1≥'],
[/<=>/g, '⇔'],
[/<</g, '≪'],
[/>>/g, '≫'],
[/~=/g, '≅'],
[/(^|[^+])\+-/g, '$1±']
]);
}
});
Typograf.rule({
name: 'common/number/times',
handler: function(text) {
return text.replace(/(\d)[ \u00A0]?[xх][ \u00A0]?(\d)/g, '$1×$2');
}
});
Typograf._sortRules();

@@ -2239,0 +2251,0 @@ Typograf._needSortRules = true;

/*! Typograf | © 2015 Denis Seleznev | https://github.com/typograf/typograf/ */
!function(e,r){"function"==typeof define&&define.amd?define("typograf",[],r):"object"==typeof exports?module.exports=r():e.Typograf=r()}(this,function(){"use strict";function e(e){this._prefs="object"==typeof e?e:{},this._prefs.live=this._prefs.live||!1,this._settings={},this._enabledRules={},this._replaceLabel=this._replaceLabel.bind(this),this._pasteLabel=this._pasteLabel.bind(this),this._initSafeTags(),this._rules.forEach(this._prepareRule,this),this._prefs.disable&&this.disable(this._prefs.disable),this._prefs.enable&&this.enable(this._prefs.enable)}return e.rule=function(r){var n=r.name.split("/");return r._enabled=r.disabled!==!0,r._lang=n[0],r._group=n[1],r._name=n[2],e._setIndex(r),e.prototype._rules.push(r),e._needSortRules&&this._sortRules(),this},e._langs=["en","ru"],e._setIndex=function(r){var n=r.index,a=typeof n,t=e.groupIndexes[r._group];"undefined"===a?n=t:"string"===a&&(n=t+parseInt(r.index,10)),r._index=n},e.innerRule=function(r){return e.prototype._innerRules.push(r),r._lang=r.name.split("/")[0],this},e.data=function(r,n){if("string"==typeof r){if(1===arguments.length)return e._data[r];e._data[r]=n}else"object"==typeof r&&Object.keys(r).forEach(function(n){e._data[n]=r[n]})},e._data={},e._sortRules=function(){e.prototype._rules.sort(function(e,r){return e._index>r._index?1:-1})},e._replace=function(e,r){for(var n=0;n<r.length;n++)e=e.replace(r[n][0],r[n][1]);return e},e._replaceNbsp=function(e){return e.replace(/\u00A0/g," ")},e._privateLabel="\udbff",e.prototype={constructor:e,execute:function(r,n){if(r=""+r,!r)return"";n=n||{};var a=this,t={},u={},i="undefined"==typeof n.mode?this._prefs.mode:n.mode,s=function(e){r=a._executeRules(r,t[e],u[e])};return this._lang=n.lang||this._prefs.lang||"common",r=this._fixLineEnd(r),this._innerRules.forEach(function(e){var r=e.queue;u[r]=u[r]||[],u[r].push(e)}),this._rules.forEach(function(e){var r=e.queue;t[r]=t[r]||[],t[r].push(e)}),this._isHTML=r.search(/(<\/?[a-z]|<!|&[lg]t;)/i)!==-1,s("start"),r=this._hideSafeTags(r),r=this._utfication(r),this._prefs.live&&(r=e._replaceNbsp(r)),s("utf"),s(),r=this._modification(r,i),s("entity"),r=this._showSafeTags(r),s("end"),this._lang=null,this._isHTML=null,r},setting:function(e,r,n){return arguments.length<=2?this._settings[e]&&this._settings[e][r]:(this._settings[e]=this._settings[e]||{},this._settings[e][r]=n,this)},enabled:function(e){return this._enabledRules[e]},disabled:function(e){return!this._enabledRules[e]},enable:function(e){return this._enable(e,!0)},disable:function(e){return this._enable(e,!1)},addSafeTag:function(e,r,n){var a=e instanceof RegExp?e:[e,r,n];return this._safeTags.own.push(this._prepareSafeTag(a)),this},data:function(r){var n="";return r.search("/")===-1&&(n=(this._lang||this._prefs.lang)+"/"),e.data(n+r)},_quote:function(r,n){var a=this.data("l")+"\u0301\\d",t=e._privateLabel,u=n.lquote,i=n.rquote,s=n.lquote2,l=n.rquote2,o="["+e.data("common/quote")+"]",c="["+a+")!?.:;#*,\u2026]*?",p=new RegExp('"(['+a+"])","gi"),d=new RegExp("("+c+')"('+c+")","gi"),h=new RegExp(o,"g"),g=new RegExp("^(\\s)?("+o+")","g"),m=new RegExp("(^|\\s)"+o+t,"g"),f=new RegExp(t+o+"([\\s!?.:;#*,]|$)","g"),$=0;return r=r.replace(h,function(){return $++,'"'}).replace(p,u+"$1").replace(d,"$1"+i+"$2").replace(m,"$1"+u+t).replace(f,t+i+"$1").replace(g,"$1"+u),s&&l&&$%2===0?this._innerQuote(r,n):r},_innerQuote:function(e,r){var n=[r.lquote],a=[r.rquote],t=r.lquote,u=r.rquote,i=new Array(e.length);r.lquote2&&r.rquote2&&(n.push(r.lquote2),a.push(r.rquote2),r.lquote3&&r.rquote3&&(n.push(r.lquote3),a.push(r.rquote3)));for(var s=-1,l=n.length-1,o=0,c=e.length;o<c;o++){var p=e[o];p===t?(s++,s>l&&(s=l),i.push(n[s])):p===u?s<=-1?(s=0,i.push(n[s])):(i.push(a[s]),s--,s<-1&&(s=-1)):i.push(p)}return i.join("")},_executeRules:function(e,r,n){return n&&n.forEach(function(r){e=this._ruleIterator(e,r)},this),r&&r.forEach(function(r){e=this._ruleIterator(e,r)},this),e},_ruleIterator:function(e,r){var n=r._lang,a=this._prefs.live;return a===!0&&r.live===!1||a===!1&&r.live===!0?e:("common"!==n&&n!==this._lang||!this.enabled(r.name)||(this._onBeforeRule&&this._onBeforeRule(r.name,e),e=r.handler.call(this,e,this._settings[r.name]),this._onAfterRule&&this._onAfterRule(r.name,e)),e)},_fixLineEnd:function(e){return e.replace(/\r\n/g,"\n")},_prepareRule:function(e){var r=e.name,n={};"object"==typeof e.settings&&Object.keys(e.settings).forEach(function(r){n[r]=e.settings[r]}),this._settings[r]=n,this._enabledRules[r]=e._enabled},_enable:function(e,r){return Array.isArray(e)?e.forEach(function(e){this._enableByMask(e,r)},this):this._enableByMask(e,r),this},_enableByMask:function(e,r){var n;e.search(/\*/)!==-1?(n=new RegExp(e.replace(/\//g,"\\/").replace(/\*/g,".*")),this._rules.forEach(function(e){var a=e.name;n.test(a)&&(this._enabledRules[a]=r)},this)):this._enabledRules[e]=r},_rules:[],_innerRules:[],_getRule:function(e){var r=null;return this._rules.some(function(n){return n.name===e&&(r=n,!0)}),r},_initSafeTags:function(){var e=[["<!--","-->"],["<!ENTITY",">"],["<!DOCTYPE",">"],["<\\?xml","\\?>"],["<!\\[CDATA\\[","\\]\\]>"]];["code","kbd","object","pre","samp","script","style","var"].forEach(function(r){e.push(["<"+r+"(\\s[^>]*?)?>","</"+r+">"])},this),this._safeTags={html:e.map(this._prepareSafeTag),own:[],url:[this._reUrl]}},_reUrl:new RegExp("(https?|file|ftp)://([a-zA-Z0-9/+-=%&:_.~?]+[a-zA-Z0-9#+]*)","g"),_hideSafeTags:function(e){var r=this,n=function(n){e=e.replace(r._prepareSafeTag(n),r._pasteLabel)},a=function(e){r._safeTags[e].forEach(n)};return this._hiddenSafeTags={},this._iLabel=0,a("own"),this._isHTML&&(a("html"),e=this._hideHTMLTags(e)),a("url"),e},_prepareSafeTag:function(e){var r;if(e instanceof RegExp)r=e;else{var n=e[0],a=e[1],t="undefined"==typeof e[2]?"[^]*?":e[2];r=new RegExp(n+t+a,"gi")}return r},_getPrivateLabel:function(r){var n=e._privateLabel;return n+"tf"+r+n},_pasteLabel:function(e){var r=this._getPrivateLabel(this._iLabel);return this._hiddenSafeTags[r]=e,this._iLabel++,r},_replaceLabel:function(e){return this._hiddenSafeTags[e]},_hideHTMLTags:function(e){return e.replace(/<\/?[a-z][^]*?>/gi,this._pasteLabel).replace(/&lt;\/?[a-z][^]*?&gt;/gi,this._pasteLabel).replace(/&[gl]t;/gi,this._pasteLabel)},_showSafeTags:function(r){var n=e._privateLabel,a=new RegExp(n+"tf\\d+"+n,"g"),t=new RegExp(n+"tf\\d"),u=0;Object.keys(this._safeTags).forEach(function(e){u+=e.length});for(var i=0;i<u&&(r=r.replace(a,this._replaceLabel),r.search(t)!==-1);i++);return this._hiddenSafeTags={},r},_utfication:function(e){return e.search(/&#/)!==-1&&(e=this._decHexToUtf(e)),e.search(/&[a-z]/i)!==-1&&this.entities.forEach(function(r){e=e.replace(r[3],r[2])}),e.replace(/&quot;/g,'"')},_decHexToUtf:function(e){return e.replace(/&#(\d{1,6});/gi,function(e,r){return String.fromCharCode(parseInt(r,10))}).replace(/&#x([\da-f]{1,6});/gi,function(e,r){return String.fromCharCode(parseInt(r,16))})},_modification:function(e,r){if("name"===r||"digit"===r){var n="name"===r?0:1;this.entities.forEach(function(r){r[n]&&(e=e.replace(r[4],r[n]))})}return e}},e.version="5.5.0",e.groupIndexes={symbols:110,space:210,dash:310,punctuation:410,nbsp:510,number:610,money:710,date:810,other:910,optalign:1010,typo:1110,html:1210},e.prototype.entities=[],[["nbsp",160],["iexcl",161],["cent",162],["pound",163],["curren",164],["yen",165],["brvbar",166],["sect",167],["uml",168],["copy",169],["ordf",170],["laquo",171],["not",172],["shy",173],["reg",174],["macr",175],["deg",176],["plusmn",177],["sup2",178],["sup3",179],["acute",180],["micro",181],["para",182],["middot",183],["cedil",184],["sup1",185],["ordm",186],["raquo",187],["frac14",188],["frac12",189],["frac34",190],["iquest",191],["Agrave",192],["Aacute",193],["Acirc",194],["Atilde",195],["Auml",196],["Aring",197],["AElig",198],["Ccedil",199],["Egrave",200],["Eacute",201],["Ecirc",202],["Euml",203],["Igrave",204],["Iacute",205],["Icirc",206],["Iuml",207],["ETH",208],["Ntilde",209],["Ograve",210],["Oacute",211],["Ocirc",212],["Otilde",213],["Ouml",214],["times",215],["Oslash",216],["Ugrave",217],["Uacute",218],["Ucirc",219],["Uuml",220],["Yacute",221],["THORN",222],["szlig",223],["agrave",224],["aacute",225],["acirc",226],["atilde",227],["auml",228],["aring",229],["aelig",230],["ccedil",231],["egrave",232],["eacute",233],["ecirc",234],["euml",235],["igrave",236],["iacute",237],["icirc",238],["iuml",239],["eth",240],["ntilde",241],["ograve",242],["oacute",243],["ocirc",244],["otilde",245],["ouml",246],["divide",247],["oslash",248],["ugrave",249],["uacute",250],["ucirc",251],["uuml",252],["yacute",253],["thorn",254],["yuml",255],["fnof",402],["Alpha",913],["Beta",914],["Gamma",915],["Delta",916],["Epsilon",917],["Zeta",918],["Eta",919],["Theta",920],["Iota",921],["Kappa",922],["Lambda",923],["Mu",924],["Nu",925],["Xi",926],["Omicron",927],["Pi",928],["Rho",929],["Sigma",931],["Tau",932],["Upsilon",933],["Phi",934],["Chi",935],["Psi",936],["Omega",937],["alpha",945],["beta",946],["gamma",947],["delta",948],["epsilon",949],["zeta",950],["eta",951],["theta",952],["iota",953],["kappa",954],["lambda",955],["mu",956],["nu",957],["xi",958],["omicron",959],["pi",960],["rho",961],["sigmaf",962],["sigma",963],["tau",964],["upsilon",965],["phi",966],["chi",967],["psi",968],["omega",969],["thetasym",977],["upsih",978],["piv",982],["bull",8226],["hellip",8230],["prime",8242],["Prime",8243],["oline",8254],["frasl",8260],["weierp",8472],["image",8465],["real",8476],["trade",8482],["alefsym",8501],["larr",8592],["uarr",8593],["rarr",8594],["darr",8595],["harr",8596],["crarr",8629],["lArr",8656],["uArr",8657],["rArr",8658],["dArr",8659],["hArr",8660],["forall",8704],["part",8706],["exist",8707],["empty",8709],["nabla",8711],["isin",8712],["notin",8713],["ni",8715],["prod",8719],["sum",8721],["minus",8722],["lowast",8727],["radic",8730],["prop",8733],["infin",8734],["ang",8736],["and",8743],["or",8744],["cap",8745],["cup",8746],["int",8747],["there4",8756],["sim",8764],["cong",8773],["asymp",8776],["ne",8800],["equiv",8801],["le",8804],["ge",8805],["sub",8834],["sup",8835],["nsub",8836],["sube",8838],["supe",8839],["oplus",8853],["otimes",8855],["perp",8869],["sdot",8901],["lceil",8968],["rceil",8969],["lfloor",8970],["rfloor",8971],["lang",9001],["rang",9002],["spades",9824],["clubs",9827],["hearts",9829],["diams",9830],["loz",9674],["OElig",338],["oelig",339],["Scaron",352],["scaron",353],["Yuml",376],["circ",710],["tilde",732],["ensp",8194],["emsp",8195],["thinsp",8201],["zwnj",8204],["zwj",8205],["lrm",8206],["rlm",8207],["ndash",8211],["mdash",8212],["lsquo",8216],["rsquo",8217],["sbquo",8218],["ldquo",8220],["rdquo",8221],["bdquo",8222],["dagger",8224],["Dagger",8225],["permil",8240],["lsaquo",8249],["rsaquo",8250],["euro",8364],["NestedGreaterGreater",8811],["NestedLessLess",8810]].forEach(function(r){var n=r[0],a=r[1],t=String.fromCharCode(a),u=["&"+n+";","&#"+a+";",t,new RegExp("&"+n+";","g"),new RegExp(t,"g")];e.prototype.entities.push(u)},this),e.data("common/dash","--?|\u2012|\u2013|\u2014"),e.data("common/quote",'\xab\u2039\xbb\u203a\u201e\u201a\u201c\u201f\u2018\u201b\u201d\u2019"'),e.data({"en/l":"a-z","en/ld":"a-z\\d","en/L":"A-Z","en/Ld":"A-Z\\d","en/lL":"a-zA-Z","en/lLd":"a-zA-Z\\d"}),e.data("en/lquote","\u201c\u2018"),e.data("en/rquote","\u201d\u2019"),e.data({"ru/dashBefore":"(^| |\\n)","ru/dashAfter":"(?=[\xa0 ,.?:!]|$)","ru/dashAfterDe":"(?=[,.?:!]|[\xa0 ][^\u0410-\u042f\u0401]|$)"}),e.data({"ru/l":"\u0430-\u044f\u0451a-z","ru/ld":"\u0430-\u044f\u0451a-z\\d","ru/L":"\u0410-\u042f\u0401A-Z","ru/Ld":"\u0410-\u042f\u0401A-Z\\d","ru/lL":"\u0430-\u044f\u0451\u0410-\u042f\u0401a-zA-Z","ru/lLd":"\u0430-\u044f\u0451\u0410-\u042f\u0401a-zA-Z\\d"}),e.data("ru/lquote","\xab\u201e\u201a"),e.data({"ru/month":"\u044f\u043d\u0432\u0430\u0440\u044c|\u0444\u0435\u0432\u0440\u0430\u043b\u044c|\u043c\u0430\u0440\u0442|\u0430\u043f\u0440\u0435\u043b\u044c|\u043c\u0430\u0439|\u0438\u044e\u043d\u044c|\u0438\u044e\u043b\u044c|\u0430\u0432\u0433\u0443\u0441\u0442|\u0441\u0435\u043d\u0442\u044f\u0431\u0440\u044c|\u043e\u043a\u0442\u044f\u0431\u0440\u044c|\u043d\u043e\u044f\u0431\u0440\u044c|\u0434\u0435\u043a\u0430\u0431\u0440\u044c","ru/monthGenCase":"\u044f\u043d\u0432\u0430\u0440\u044f|\u0444\u0435\u0432\u0440\u0430\u043b\u044f|\u043c\u0430\u0440\u0442\u0430|\u0430\u043f\u0440\u0435\u043b\u044f|\u043c\u0430\u044f|\u0438\u044e\u043d\u044f|\u0438\u044e\u043b\u044f|\u0430\u0432\u0433\u0443\u0441\u0442\u0430|\u0441\u0435\u043d\u0442\u044f\u0431\u0440\u044f|\u043e\u043a\u0442\u044f\u0431\u0440\u044f|\u043d\u043e\u044f\u0431\u0440\u044f|\u0434\u0435\u043a\u0430\u0431\u0440\u044f","ru/monthPreCase":"\u044f\u043d\u0432\u0430\u0440\u0435|\u0444\u0435\u0432\u0440\u0430\u043b\u0435|\u043c\u0430\u0440\u0442\u0435|\u0430\u043f\u0440\u0435\u043b\u0435|\u043c\u0430\u0435|\u0438\u044e\u043d\u0435|\u0438\u044e\u043b\u0435|\u0430\u0432\u0433\u0443\u0441\u0442\u0435|\u0441\u0435\u043d\u0442\u044f\u0431\u0440\u0435|\u043e\u043a\u0442\u044f\u0431\u0440\u0435|\u043d\u043e\u044f\u0431\u0440\u0435|\u0434\u0435\u043a\u0430\u0431\u0440\u0435","ru/shortMonth":"\u044f\u043d\u0432|\u0444\u0435\u0432|\u043c\u0430\u0440|\u0430\u043f\u0440|\u043c\u0430[\u0435\u0439\u044f]|\u0438\u044e\u043d|\u0438\u044e\u043b|\u0430\u0432\u0433|\u0441\u0435\u043d|\u043e\u043a\u0442|\u043d\u043e\u044f|\u0434\u0435\u043a"}),e.data("ru/rquote","\xbb\u201c\u2018"),e.data("ru/weekday","\u043f\u043e\u043d\u0435\u0434\u0435\u043b\u044c\u043d\u0438\u043a|\u0432\u0442\u043e\u0440\u043d\u0438\u043a|\u0441\u0440\u0435\u0434\u0430|\u0447\u0435\u0442\u0432\u0435\u0440\u0433|\u043f\u044f\u0442\u043d\u0438\u0446\u0430|\u0441\u0443\u0431\u0431\u043e\u0442\u0430|\u0432\u043e\u0441\u043a\u0440\u0435\u0441\u0435\u043d\u044c\u0435"),e.rule({name:"common/html/e-mail",queue:"end",handler:function(e){return this._isHTML?e:e.replace(/(^|[\s;(])([\w\-.]{2,})@([\w\-.]{2,})\.([a-z]{2,6})([)\s.,!?]|$)/gi,'$1<a href="mailto:$2@$3.$4">$2@$3.$4</a>$5')},disabled:!0}),e.rule({name:"common/html/escape",index:"+100",queue:"end",handler:function(e){var r={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};return e.replace(/[&<>"'\/]/g,function(e){return r[e]})},disabled:!0}),e.rule({name:"common/html/nbr",index:"+5",queue:"end",handler:function(e){return e.search(/<br/)===-1?e.replace(/\n/g,"<br/>\n"):e},disabled:!0}),e.rule({name:"common/html/pbr",queue:"end",handler:function(e){return e.search(/<(p|br)[\s\/>]/)===-1&&(e.search(/\n/)===-1?e="<p>"+e+"</p>":(e="<p>"+e.replace(/\n\n/g,"</p>\n<p>")+"</p>",e=e.replace(/([^>])\n/g,"$1<br/>\n"))),e},disabled:!0}),e.rule({name:"common/html/stripTags",index:"+99",queue:"end",handler:function(e){return e.replace(/<[^>]+>/g,"")},disabled:!0}),e.rule({name:"common/html/url",queue:"end",handler:function(e){return this._isHTML?e:e.replace(this._reUrl,function(e,r,n){n=n.replace(/([^\/]+\/?)(\?|#)$/,"$1").replace(/^([^\/]+)\/$/,"$1"),"http"===r?n=n.replace(/^([^\/]+)(:80)([^\d]|\/|$)/,"$1$3"):"https"===r&&(n=n.replace(/^([^\/]+)(:443)([^\d]|\/|$)/,"$1$3"));var a=n,t=r+"://"+n,u='<a href="'+t+'">';return"http"===r||"https"===r?(a=a.replace(/^www\./,""),u+("http"===r?a:r+"://"+a)+"</a>"):u+t+"</a>"})},disabled:!0}),e.rule({name:"common/nbsp/afterNumber",handler:function(e){var r="(^|\\D)(\\d{1,5}) (["+this.data("l")+"]{2,})";return e.replace(new RegExp(r,"gi"),"$1$2\xa0$3")},disabled:!0}),e.rule({name:"common/nbsp/afterParagraph",handler:function(e){return e.replace(/\u00A7[ \u00A0\u2009]?(\d|I|V|X)/g,"\xa7\u202f$1")}}),e.rule({name:"common/nbsp/afterShortWord",handler:function(r,n){var a=n.lengthShortWord,t=" \xa0("+e._privateLabel+this.data("common/quote"),u="(^|["+t+"])(["+this.data("l")+"]{1,"+a+"}) ",i="$1$2\xa0",s=new RegExp(u,"gim");return r.replace(s,i).replace(s,i)},settings:{lengthShortWord:2}}),e.rule({name:"common/nbsp/beforeShortLastNumber",handler:function(e,r){var n=new RegExp("(["+this.data("lL")+"]) (?=\\d{1,"+r.lengthLastNumber+"}[-+\u2212%'\""+this.data("rquote")+"]?([.!?\u2026]( ["+this.data("L")+"]|$)|$))","gm");return e.replace(n,"$1\xa0")},live:!1,settings:{lengthLastNumber:2}}),e.rule({name:"common/nbsp/beforeShortLastWord",handler:function(e,r){var n=new RegExp("(["+this.data("ld")+"]) (["+this.data("lL")+"]{1,"+r.lengthLastWord+"}[.!?\u2026])( ["+this.data("L")+"]|$)","g");return e.replace(n,"$1\xa0$2$3")},settings:{lengthLastWord:3}}),e.rule({name:"common/nbsp/dpi",handler:function(e){return e.replace(/(\d) ?(lpi|dpi)(?!\w)/,"$1\xa0$2")}}),function(){function r(e,r,n,a){return r+n.replace(/([^\u00A0])\u00A0([^\u00A0])/g,"$1 $2")+a}e.rule({name:"common/nbsp/nowrap",queue:"end",handler:function(e){return e.replace(/(<nowrap>)(.*?)(<\/nowrap>)/g,r).replace(/(<nobr>)(.*?)(<\/nobr>)/g,r)}})}(),e.rule({name:"common/nbsp/replaceNbsp",queue:"utf",live:!1,handler:e._replaceNbsp,disabled:!0}),e.rule({name:"common/other/delBOM",queue:"start",index:-1,handler:function(e){return 65279===e.charCodeAt(0)?e.slice(1):e}}),e.rule({name:"common/other/repeatWord",handler:function(e,r){var n="[;:,.?! \n"+this.data("common/quote")+"]",a=new RegExp("("+n+"|^)(["+this.data("l")+"]{"+r.min+",}) \\2("+n+"|$)","gi");return e.replace(a,"$1$2$3")},settings:{min:2},disabled:!0}),e.rule({name:"common/punctuation/delDoublePunctuation",handler:function(e){return e.replace(/(^|[^,]),,(?!,)/g,"$1,").replace(/(^|[^:])::(?!:)/g,"$1:").replace(/(^|[^!?\.])\.\.(?!\.)/g,"$1.").replace(/(^|[^;]);;(?!;)/g,"$1;").replace(/(^|[^?])\?\?(?!\?)/g,"$1?")}}),e.rule({name:"common/space/afterPunctuation",handler:function(r){var n=e._privateLabel,a=new RegExp("(!|;|\\?)([^).!;?\\s[\\])"+n+this.data("common/quote")+"])","g"),t=new RegExp('(\\D)(,|:)([^)",:.?\\s\\/\\\\'+n+"])","g");return r.replace(a,"$1 $2").replace(t,"$1$2 $3")}}),e.rule({name:"common/space/beforeBracket",handler:function(e){var r=new RegExp("(["+this.data("l")+".!?,;\u2026)])\\(","gi");return e.replace(r,"$1 (")}}),e.rule({name:"common/space/bracket",handler:function(e){return e.replace(/(\() +/g,"(").replace(/ +\)/g,")")}}),e.rule({name:"common/space/delBeforePercent",handler:function(e){return e.replace(/(\d)( |\u00A0)(%|\u2030|\u2031)/g,"$1$3")}}),e.rule({name:"common/space/delBeforePunctuation",handler:function(e){return e.replace(/ ([!;,?.:])(?!\))/g,"$1")}}),e.rule({name:"common/space/delLeadingBlanks",handler:function(e){return e.replace(/\n[ \t]+/g,"\n")},disabled:!0}),e.rule({name:"common/space/delRepeatN",index:"-1",handler:function(e){return e.replace(/\n{3,}/g,"\n\n")}}),e.rule({name:"common/space/delRepeatSpace",index:"-1",handler:function(e){return e.replace(/([^\n \t])[ \t]{2,}(?![\n \t])/g,"$1 ")}}),e.rule({name:"common/space/delTrailingBlanks",index:"-3",handler:function(e){return e.replace(/[ \t]+\n/g,"\n")}}),e.rule({name:"common/space/replaceTab",index:"-5",handler:function(e){return e.replace(/\t/g," ")}}),e.rule({name:"common/space/squareBracket",handler:function(e){return e.replace(/(\[) +/g,"[").replace(/ +\]/g,"]")}}),e.rule({name:"common/space/trimLeft",index:"-4",handler:String.prototype.trimLeft?function(e){return e.trimLeft()}:function(e){return e.replace(/^[\s\uFEFF\xA0]+/g,"")}}),e.rule({name:"common/space/trimRight",index:"-3",live:!1,handler:String.prototype.trimRight?function(e){return e.trimRight()}:function(e){return e.replace(/[\s\uFEFF\xA0]+$/g,"")}}),e.rule({name:"common/symbols/arrow",handler:function(r){return e._replace(r,[[/(^|[^-])->(?!>)/g,"$1\u2192"],[/(^|[^<])<-(?!-)/g,"$1\u2190"]])}}),e.rule({name:"common/symbols/cf",handler:function(e){var r=new RegExp('(^|[^%])(\\d+)( |\xa0)?(C|F)([\\W \\.,:!\\?"\\]\\)]|$)',"g");return e.replace(r,"$1$2\u2009\xb0$4$5")}}),e.rule({name:"common/symbols/copy",handler:function(r){return e._replace(r,[[/\(r\)/gi,"\xae"],[/(copyright )?\((c|\u0441)\)/gi,"\xa9"],[/\(tm\)/gi,"\u2122"]])}}),e.rule({name:"en/punctuation/quote",handler:function(e,r){return this._quote(e,r)},settings:{lquote:"\u201c",rquote:"\u201d",lquote2:"\u2018",rquote2:"\u2019"}}),e.rule({name:"ru/dash/centuries",handler:function(e,r){var n="("+this.data("common/dash")+")",a=new RegExp("(X|I|V)[ |\xa0]?"+n+"[ |\xa0]?(X|I|V)","g");return e.replace(a,"$1"+r.dash+"$3")},settings:{dash:"\u2013"}}),e.rule({name:"ru/dash/daysMonth",handler:function(e,r){var n=new RegExp("(^|\\s)([123]?\\d)("+this.data("common/dash")+")([123]?\\d)[ \xa0]("+this.data("ru/monthGenCase")+")","g");return e.replace(n,"$1$2"+r.dash+"$4\xa0$5")},settings:{dash:"\u2013"}}),e.rule({name:"ru/dash/de",handler:function(e){var r=new RegExp("([a-\u044f\u0451]+) \u0434\u0435"+this.data("ru/dashAfterDe"),"g");return e.replace(r,"$1-\u0434\u0435")},disabled:!0}),e.rule({name:"ru/dash/decade",handler:function(e,r){var n=new RegExp("(^|\\s)(\\d{3}|\\d)0("+this.data("common/dash")+")(\\d{3}|\\d)0(-\u0435[ \xa0])(?=\u0433\\.?[ \xa0]?\u0433|\u0433\u043e\u0434)","g");return e.replace(n,"$1$20"+r.dash+"$40$5")},settings:{dash:"\u2013"}}),e.rule({name:"ru/dash/directSpeech",handler:function(r){var n=this.data("common/dash"),a=new RegExp('(["\xbb\u2018\u201c,])[ |\xa0]?('+n+")[ |\xa0]","g"),t=new RegExp("(^|"+e._privateLabel+")("+n+")( |\xa0)","gm"),u=new RegExp("([.\u2026?!])[ \xa0]("+n+")[ \xa0]","g");return r.replace(a,"$1\xa0\u2014 ").replace(t,"$1\u2014\xa0").replace(u,"$1 \u2014\xa0")}}),e.rule({name:"ru/dash/izpod",handler:function(e){var r=new RegExp(this.data("ru/dashBefore")+"(\u0418|\u0438)\u0437 \u043f\u043e\u0434"+this.data("ru/dashAfter"),"g");return e.replace(r,"$1$2\u0437-\u043f\u043e\u0434")}}),e.rule({name:"ru/dash/izza",handler:function(e){var r=new RegExp(this.data("ru/dashBefore")+"(\u0418|\u0438)\u0437 \u0437\u0430"+this.data("ru/dashAfter"),"g");return e.replace(r,"$1$2\u0437-\u0437\u0430")}}),e.rule({name:"ru/dash/ka",handler:function(e){var r=new RegExp("([a-\u044f\u0451]+) \u043a\u0430(\u0441\u044c)?"+this.data("ru/dashAfter"),"g");return e.replace(r,"$1-\u043a\u0430$2")}}),e.rule({name:"ru/dash/koe",handler:function(e){var r=new RegExp(this.data("ru/dashBefore")+"([\u041a\u043a]\u043e[\u0435\u0439])\\s([\u0430-\u044f\u0451]{3,})"+this.data("ru/dashAfter"),"g");return e.replace(r,"$1$2-$3")}}),e.rule({name:"ru/dash/main",index:"-5",handler:function(e){var r=this.data("common/dash"),n=new RegExp("([ \xa0])("+r+")([ \xa0\\n])","g");return e.replace(n,"\xa0\u2014$3")}}),e.rule({name:"ru/dash/month",handler:function(e,r){var n="("+this.data("ru/month")+")",a="("+this.data("ru/monthPreCase")+")",t=this.data("common/dash"),u=new RegExp(n+" ?("+t+") ?"+n,"gi"),i=new RegExp(a+" ?("+t+") ?"+a,"gi"),s="$1"+r.dash+"$3";return e.replace(u,s).replace(i,s)},settings:{dash:"\u2013"}}),e.rule({name:"ru/dash/surname",handler:function(e){var r=new RegExp("([\u0410-\u042f\u0401][\u0430-\u044f\u0451]+)\\s-([\u0430-\u044f\u0451]{1,3})(?![^\u0430-\u044f\u0451]|$)","g");return e.replace(r,"$1\xa0\u2014$2")}}),e.rule({name:"ru/dash/taki",handler:function(e){var r=new RegExp("(\u0432\u0435\u0440\u043d\u043e|\u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e|\u043e\u043f\u044f\u0442\u044c|\u043f\u0440\u044f\u043c\u043e|\u0442\u0430\u043a|\u0432\u0441[\u0435\u0451]|\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e|\u043d\u0435\u0443\u0436\u0435\u043b\u0438)\\s(\u0442\u0430\u043a\u0438)"+this.data("ru/dashAfter"),"g");return e.replace(r,"$1-$2")}}),e.rule({name:"ru/dash/time",handler:function(e,r){var n=new RegExp(this.data("ru/dashBefore")+"(\\d?\\d:[0-5]\\d)"+this.data("common/dash")+"(\\d?\\d:[0-5]\\d)"+this.data("ru/dashAfter"),"g");return e.replace(n,"$1$2"+r.dash+"$3")},settings:{dash:"\u2013"}}),e.rule({name:"ru/dash/to",handler:function(e){var r=["\u043e\u0442\u043a\u0443\u0434\u0430","\u043a\u0443\u0434\u0430","\u0433\u0434\u0435","\u043a\u043e\u0433\u0434\u0430","\u0437\u0430\u0447\u0435\u043c","\u043f\u043e\u0447\u0435\u043c\u0443","\u043a\u0430\u043a","\u043a\u0430\u043a\u043e[\u0435\u0439\u043c]","\u043a\u0430\u043a\u0430\u044f","\u043a\u0430\u043a\u0438[\u0435\u043c\u0445]","\u043a\u0430\u043a\u0438\u043c\u0438","\u043a\u0430\u043a\u0443\u044e","\u0447\u0442\u043e","\u0447\u0435\u0433\u043e","\u0447\u0435[\u0439\u043c]","\u0447\u044c\u0438\u043c?","\u043a\u0442\u043e","\u043a\u043e\u0433\u043e","\u043a\u043e\u043c\u0443","\u043a\u0435\u043c"],n=new RegExp("("+r.join("|")+")( | -|- )(\u0442\u043e|\u043b\u0438\u0431\u043e|\u043d\u0438\u0431\u0443\u0434\u044c)"+this.data("ru/dashAfter"),"gi");return e.replace(n,"$1-$3")}}),e.rule({name:"ru/dash/weekday",handler:function(e,r){var n="("+this.data("ru/weekday")+")",a=new RegExp(n+" ?("+this.data("common/dash")+") ?"+n,"gi");return e.replace(a,"$1"+r.dash+"$3")},settings:{dash:"\u2013"}}),e.rule({name:"ru/dash/years",handler:function(e,r){var n=this.data("common/dash"),a=new RegExp("(\\D|^)(\\d{4})[ \xa0]?("+n+")[ \xa0]?(\\d{4})(?=[ \xa0]?\u0433)","g");return e.replace(a,function(e,n,a,t,u){return parseInt(a,10)<parseInt(u,10)?n+a+r.dash+u:e})},settings:{dash:"\u2013"}}),e.rule({name:"ru/date/fromISO",handler:function(e){var r="(-|\\.|\\/)",n="(-|\\/)",a=new RegExp("(^|\\D)(\\d{4})"+r+"(\\d{2})"+r+"(\\d{2})(\\D|$)","gi"),t=new RegExp("(^|\\D)(\\d{2})"+n+"(\\d{2})"+n+"(\\d{4})(\\D|$)","gi");return e.replace(a,"$1$6.$4.$2$7").replace(t,"$1$4.$2.$6$7")}}),e.rule({name:"ru/date/weekday",handler:function(e){var r="( |\xa0)",n=this.data("ru/monthGenCase"),a=this.data("ru/weekday"),t=new RegExp("(\\d)"+r+"("+n+"),"+r+"("+a+")","gi");return e.replace(t,function(){var e=arguments;return e[1]+e[2]+e[3].toLowerCase()+","+e[4]+e[5].toLowerCase()})}}),e.rule({name:"ru/money/currency",handler:function(e){var r="([$\u20ac\xa5\u04b0\xa3\u20a4\u20bd])",n=new RegExp("(^|[\\D]{2})"+r+" ?([\\d.,]+([ \xa0\u2009\u202f]\\d{3})*)","g"),a=new RegExp("(^|[\\D])([\\d.,]+) ?"+r,"g"),t="$1$3\xa0$2",u="$1$2\xa0$3";return e.replace(n,t).replace(a,u)}}),e.rule({name:"ru/money/ruble",handler:function(e){var r="$1\xa0\u20bd",n="(\\d+)( |\xa0)?(\u0440|\u0440\u0443\u0431)\\.",a=new RegExp("^"+n+"$","g"),t=new RegExp(n+"(?=[!?,:;])","g"),u=new RegExp(n+"(?=\\s+[A-\u042f\u0401])","g");return e.replace(a,r).replace(t,r).replace(u,r+".")},disabled:!0}),e.rule({name:"ru/nbsp/abbr",handler:function(r){var n=new RegExp("(^|\\s|"+e._privateLabel+")(([\u0430-\u044f\u0451]{1,3}\\.){2,})(?![\u0430-\u044f\u0451])","g");return r.replace(n,function(e,r,n){var a=n.split(/\./);return["\u0440\u0444","\u0440\u0443","\u0440\u0443\u0441","\u043e\u0440\u0433","\u0443\u043a\u0440","\u0431\u0433","\u0441\u0440\u0431"].indexOf(a[a.length-2])>-1?e:r+n.split(/\./).join(".\xa0").trim()})}}),e.rule({name:"ru/nbsp/addr",handler:function(e){return e.replace(/(\s|^)(\u0434\u043e\u043c|\u0434\.|\u043a\u0432\.|\u043f\u043e\u0434\.|\u043f\-\u0434) *(\d+)/gi,"$1$2\xa0$3").replace(/(\s|^)(\u043c\u043a\u0440-\u043d|\u043c\u043a-\u043d|\u043c\u043a\u0440\.|\u043c\u043a\u0440\u043d)\s/gi,"$1$2\xa0").replace(/(\s|^)(\u044d\u0442\.) *(-?\d+)/gi,"$1$2\xa0$3").replace(/(\s|^)(\d+) +\u044d\u0442\u0430\u0436([^\u0430-\u044f\u0451]|$)/gi,"$1$2\xa0\u044d\u0442\u0430\u0436$3").replace(/(\s|^)\u043b\u0438\u0442\u0435\u0440\s([\u0410-\u042f]|$)/gi,"$1\u043b\u0438\u0442\u0435\u0440\xa0$2").replace(/(\s|^)(\u043e\u0431\u043b|\u043a\u0440|\u0441\u0442|\u043f\u043e\u0441|\u0441|\u0434|\u0443\u043b|\u043f\u0435\u0440|\u043f\u0440|\u043f\u0440\-\u0442|\u043f\u0440\u043e\u0441\u043f|\u043f\u043b|\u0431\u0443\u043b|\u0431\-\u0440|\u043d\u0430\u0431|\u0448|\u0442\u0443\u043f|\u043e\u0444|\u043a\u043e\u043c\u043d?|\u0443\u0447|\u0432\u043b|\u0432\u043b\u0430\u0434|\u0441\u0442\u0440|\u043a\u043e\u0440)\. *([\u0430-\u044f\u0451a-z\d]+)/gi,"$1$2.\xa0$3").replace(/(\D[ \u00A0]|^)\u0433\. ?([\u0410-\u042f\u0401])/gm,"$1\u0433.\xa0$2")}}),e.rule({name:"ru/nbsp/afterNumberSign",handler:function(e){return e.replace(/\u2116[ \u00A0\u2009]?(\d|\u043f\/\u043f)/g,"\u2116\u202f$1")}}),e.rule({name:"ru/nbsp/beforeParticle",index:"+5",handler:function(e){var r="(\u043b\u0438|\u043b\u044c|\u0436\u0435|\u0436|\u0431\u044b|\u0431)",n=new RegExp("([\u0410-\u042f\u0401\u0430-\u044f\u0451]) "+r+'(?=[,;:?!"\u2018\u201c\xbb])',"g"),a=new RegExp("([\u0410-\u042f\u0401\u0430-\u044f\u0451])[ \xa0]"+r+"[ \xa0]","g");return e.replace(n,"$1\xa0$2").replace(a,"$1\xa0$2 ")}}),e.rule({name:"ru/nbsp/centuries",handler:function(e){var r=this.data("common/dash"),n="(^|\\s)([VIX]+)",a='(?=[,;:?!"\u2018\u201c\xbb]|$)',t=new RegExp(n+"[ \xa0]?\u0432\\.?"+a,"gm"),u=new RegExp(n+"("+r+")([VIX]+)[ \xa0]?\u0432\\.?([ \xa0]?\u0432\\.?)?"+a,"gm");return e.replace(t,"$1$2\xa0\u0432.").replace(u,"$1$2$3$4\xa0\u0432\u0432.")}}),e.rule({name:"ru/nbsp/dayMonth",handler:function(e){var r=new RegExp("(\\d{1,2}) ("+this.data("ru/shortMonth")+")","gi");return e.replace(r,"$1\xa0$2")}}),e.rule({name:"ru/nbsp/groupNumbers",handler:function(e){return e.replace(/(^ ?|\D )(\d{1,3}([ \u00A0\u202F\u2009]\d{3})+)(?! ?[\d-])/gm,function(e,r,n){return r+n.replace(/\s/g,"\u202f")})}}),e.rule({name:"ru/nbsp/initials",handler:function(r){var n="\xa0\u202f ",a=this.data("ru/lquote"),t=this.data("ru/rquote"),u=new RegExp("(^|["+n+a+e._privateLabel+'"])([\u0410-\u042f\u0401])\\.['+n+"]?([\u0410-\u042f\u0401])\\.["+n+']?([\u0410-\u042f\u0401][\u0430-\u044f\u0451]+)(?=[\\s.,;:?!"'+t+"]|$)","gm");return r.replace(u,"$1$2.\xa0$3.\xa0$4")}}),e.rule({name:"ru/nbsp/m",index:"+5",handler:function(r){var n=e._privateLabel,a=new RegExp("(^|[\\s,."+n+"])(\\d+)[ \xa0]?(\u043c\u043c?|\u0441\u043c|\u043a\u043c|\u0434\u043c|\u0433\u043c|mm?|km|cm|dm)([23\xb2\xb3])?([\\s.!?,;"+n+"]|$)","gm");return r.replace(a,function(e,r,n,a,t,u){var i={2:"\xb2","\xb2":"\xb2",3:"\xb3","\xb3":"\xb3","":""}[t||""];return r+n+"\xa0"+a+i+("\xa0"===u?" ":u)})}}),e.rule({name:"ru/nbsp/ooo",handler:function(e){return e.replace(/(^|[^a-\u044f\u0451A-\u042f\u0401])(\u041e\u041e\u041e|\u041e\u0410\u041e|\u0417\u0410\u041e|\u041d\u0418\u0418|\u041f\u0411\u041e\u042e\u041b) /g,"$1$2\xa0")}}),e.rule({name:"ru/nbsp/page",handler:function(r){var n=new RegExp("(^|[)\\s"+e._privateLabel+"])(\u0441\u0442\u0440|\u0433\u043b|\u0440\u0438\u0441|\u0438\u043b\u043b?|\u0441\u0442|\u043f|c)\\. *(\\d+)([\\s.,?!;:]|$)","gim");return r.replace(n,"$1$2.\xa0$3$4")}}),e.rule({name:"ru/nbsp/ps",handler:function(r){var n=new RegExp("(^|\\s|"+e._privateLabel+")[p\u0437]\\.[ \xa0]?([p\u0437]\\.[ \xa0]?)?[s\u044b]\\.:? ","gim");return r.replace(n,function(e,r,n){return r+(n?"P.\xa0P.\xa0S. ":"P.\xa0S. ")})}}),e.rule({name:"ru/nbsp/rubleKopek",handler:function(e){return e.replace(/(\d) ?(?=(\u0440\u0443\u0431|\u043a\u043e\u043f)\.)/g,"$1\xa0")}}),e.rule({name:"ru/nbsp/see",handler:function(r){var n=new RegExp("(^|\\s|"+e._privateLabel+"|\\()(\u0441\u043c|\u0438\u043c)\\.[ \xa0]?([\u0430-\u044f\u04510-9a-z]+)([\\s.,?!]|$)","gi");return r.replace(n,function(e,r,n,a,t){return("\xa0"===r?" ":r)+n+".\xa0"+a+t})}}),e.rule({name:"ru/nbsp/year",handler:function(e){return e.replace(/(^|\D)(\d{4}) ?\u0433([ ,;.\n]|$)/g,"$1$2\xa0\u0433$3")}}),e.rule({name:"ru/nbsp/years",index:"+5",handler:function(e){var r=this.data("common/dash"),n=new RegExp("(^|\\D)(\\d{4})("+r+')(\\d{4})[ \xa0]?\u0433\\.?([ \xa0]?\u0433\\.)?(?=[,;:?!"\u2018\u201c\xbb\\s]|$)',"gm");return e.replace(n,"$1$2$3$4\xa0\u0433\u0433.")}}),e.rule({name:"ru/number/ordinals",handler:function(e){var r=new RegExp("(\\d)-(\u044b\u0439|\u043e\u0439|\u0430\u044f|\u043e\u0435|\u044b\u0435|\u044b\u043c|\u043e\u043c|\u044b\u0445|\u043e\u0433\u043e|\u043e\u043c\u0443|\u044b\u043c\u0438)(?!["+this.data("l")+"])","g");return e.replace(r,function(e,r,n){var a={"\u043e\u0439":"\u0439","\u044b\u0439":"\u0439","\u0430\u044f":"\u044f","\u043e\u0435":"\u0435","\u044b\u0435":"\u0435","\u044b\u043c":"\u043c","\u043e\u043c":"\u043c","\u044b\u0445":"\u0445","\u043e\u0433\u043e":"\u0433\u043e","\u043e\u043c\u0443":"\u043c\u0443","\u044b\u043c\u0438":"\u043c\u0438"};return r+"-"+a[n]})}}),e.rule({name:"ru/optalign/bracket",handler:function(e){return e.replace(/( |\u00A0)\(/g,'<span class="typograf-oa-sp-lbracket">$1</span><span class="typograf-oa-lbracket">(</span>').replace(/^\(/gm,'<span class="typograf-oa-n-lbracket">(</span>')},disabled:!0}).innerRule({name:"ru/optalign/bracket",handler:function(e){return e.replace(/<span class="typograf-oa-(n-|sp-)?lbracket">(.*?)<\/span>/g,"$2");
}}),e.rule({name:"ru/optalign/comma",handler:function(e){var r=new RegExp("(["+this.data("l")+"\\d\u0301]+), ","gi");return e.replace(r,'$1<span class="typograf-oa-comma">,</span><span class="typograf-oa-comma-sp"> </span>')},disabled:!0}).innerRule({name:"ru/optalign/comma",handler:function(e){return e.replace(/<span class="typograf-oa-comma(-sp)?">(.*?)<\/span>/g,"$2")}}),e.rule({name:"ru/optalign/quote",handler:function(r){var n="ru/punctuation/quote",a='(["'+this.setting(n,"lquote")+this.setting(n,"lquote2")+this.setting(n,"lquote3")+"])",t=new RegExp("([\\d"+this.data("l")+"\\-\u0301!?.:;,]+)( |\xa0)("+a+")","gi"),u=new RegExp("(^|"+e._privateLabel+")"+a,"gm");return r.replace(t,'$1<span class="typograf-oa-sp-lquote">$2</span><span class="typograf-oa-lquote">$3</span>').replace(u,'$1<span class="typograf-oa-n-lquote">$2</span>')},disabled:!0}).innerRule({name:"ru/optalign/quote",handler:function(e){return e.replace(/<span class="typograf-oa-(n-|sp-)?lquote">(.*?)<\/span>/g,"$2")}}),e.rule({name:"ru/other/accent",handler:function(e){return e.replace(/([\u0430-\u044f\u0451])([\u0410\u0415\u0401\u0418\u041e\u0423\u042b\u042d\u042e\u042f])([^\u0410-\u042f\u0401\w]|$)/g,function(e,r,n,a){return r+n.toLowerCase()+"\u0301"+a})},disabled:!0}),function(){function r(e){var r,o,c="",p=e[0];if(e.length<8)return a(e);if(e.length>10)if("+"===p){if(e[1]!==u)return e;r=!0,e=e.substr(2)}else"8"===p&&(o=!0,e=e.substr(1));for(var d=s;d>=l;d--){var h=+e.substr(0,d);if(i.indexOf(h)>-1){c=e.substr(0,d),e=e.substr(d);break}}return c||(c=e.substr(0,t),e=e.substr(t)),(r?"+"+u+"\xa0":"")+(o?"8\xa0":"")+n(c)+"\xa0"+a(e)}function n(e){var r=+e,n=e.length,a=[e],t=!1;if(n>3)switch(n){case 4:a=[e.substr(0,2),e.substr(2,4)];break;case 5:a=[e.substr(0,3),e.substr(3,5)];break;case 6:a=[e.substr(0,2),e.substr(2,4),e.substr(4,6)]}else t=r>900&&r<=999||495===r||499===r;return a=a.join("-"),t?a:"("+a+")"}function a(e){var r="";return e.length%2&&(r=e[0],r+=e.length<=5?"-":"",e=e.substr(1,e.length-1)),r+e.split(/(?=(?:\d\d)+$)/).join("-")}var t=5,u="7",i=[],s=8,l=2;[4162,416332,8512,851111,4722,4725,391379,8442,4732,4152,4154451,4154459,4154455,41544513,8142,8332,8612,8622,3525,812,8342,8152,3812,4862,3422,342633,8112,9142,8452,3432,3434,3435,4812,3919,8432,8439,3822,4872,3412,3511,3512,3022,4112,4852,4855,3852,3854,8182,818,90,3472,4741,4764,4832,4922,8172,8202,8722,4932,493,3952,3951,3953,411533,4842,3842,3843,8212,4942,3912,4712,4742,8362,495,499,4966,4964,4967,498,8312,8313,3832,383612,3532,8412,4232,423370,423630,8632,8642,8482,4242,8672,8652,4752,4822,482502,4826300,3452,8422,4212,3466,3462,8712,8352,"901-934","936-939","950-953",958,"960-969","977-989","991-997",999].forEach(function(e){if("string"==typeof e)for(var r=e.split("-"),n=+r[0];n<=+r[1];n++)i.push(n);else i.push(e)}),e.rule({name:"ru/other/phone-number",live:!1,handler:function(e){return e.replace(/(\u0442.|\u0442\u0435\u043b.|\u0444.|\u043c\u043e\u0431.|\u0444\u0430\u043a\u0441|\u0441\u043e\u0442\u043e\u0432\u044b\u0439|\u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0439|\u0442\u0435\u043b\u0435\u0444\u043e\u043d)(\:?\s*?)([\+\d\(][\d \u00A0\-\(\)]{3,}\d)/gi,function(e,n,a,t){var u=t.replace(/[^\d\+]/g,"");return u.length>=5?n+a+r(u):e})}})}(),e.rule({name:"ru/punctuation/ano",handler:function(e){var r=new RegExp("([^!?,:;\\-\u2012\u2013\u2014])([ \xa0\\n])(\u0430|\u043d\u043e)(?= |\xa0|\\n)","g");return e.replace(r,"$1,$2$3")}}),e.rule({name:"ru/punctuation/apostrophe",index:"-5",handler:function(e){var r="(["+this.data("l")+"])",n=new RegExp(r+"['\u2019]"+r,"gi");return e.replace(n,"$1\u02bc$2")}}),e.rule({name:"ru/punctuation/exclamation",live:!1,handler:function(e){return e.replace(/(^|[^!])!{2}($|[^!])/,"$1!$2").replace(/(^|[^!])!{4}($|[^!])/,"$1!!!$2")}}),e.rule({name:"ru/punctuation/exclamationQuestion",index:"+5",handler:function(e){var r=new RegExp("(^|[^!])!\\?([^?]|$)","g");return e.replace(r,"$1?!$2")}}),e.rule({name:"ru/punctuation/hellip",handler:function(e){return e.replace(/(^|[^.])\.{3,4}([^.]|$)/g,"$1\u2026$2").replace(/(^|[^.])(\.\.\.|\u2026),/g,"$1\u2026").replace(/(\!|\?)(\.\.\.|\u2026)([^.]|$)/g,"$1..$3")}}),e.rule({name:"ru/punctuation/quote",handler:function(e,r){var n=r.lquote,a=r.rquote;return e=this._quote(e,r),n===r.lquote2&&a===r.rquote2?e.replace(new RegExp(n+n,"g"),n).replace(new RegExp(a+a,"g"),a):e},settings:{lquote:"\xab",rquote:"\xbb",lquote2:"\u201e",rquote2:"\u201c",lquote3:"\u201a",rquote3:"\u2018"}}),e.rule({name:"ru/space/afterHellip",handler:function(e){return e.replace(/([\u0430-\u044f\u0451])(\.\.\.|\u2026)([\u0410-\u042f\u0401])/g,"$1$2 $3").replace(/([?!]\.\.)([\u0430-\u044f\u0451a-z])/gi,"$1 $2")}}),e.rule({name:"ru/space/year",handler:function(e){var r=new RegExp("(^| |\xa0)(\\d{3,4})(\u0433\u043e\u0434([\u0430\u0443\u0435]|\u043e\u043c)?)([^"+this.data("l")+"]|$)","g");return e.replace(r,"$1$2 $3$5")}}),function(){var r={A:"\u0410",a:"\u0430",B:"\u0412",E:"\u0415",e:"\u0435",K:"\u041a",M:"\u041c",H:"\u041d",O:"\u041e",o:"\u043e",P:"\u0440",p:"\u0420",C:"\u0421",c:"\u0441",T:"\u0422",y:"\u0443",X:"\u0425",x:"\u0445"},n=Object.keys(r).join("");e.rule({name:"ru/typo/switchingKeyboardLayout",handler:function(e){var a=new RegExp("(["+n+"]{1,3})(?=[\u0410-\u042f\u0401\u0430-\u044f\u0451]+?)","g");return e.replace(a,function(e,n){for(var a="",t=0;t<n.length;t++)a+=r[n[t]];return a})}})}(),e.rule({name:"common/number/fraction",handler:function(e){return e.replace(/(^|\D)1\/2(\D|$)/g,"$1\xbd$2").replace(/(^|\D)1\/4(\D|$)/g,"$1\xbc$2").replace(/(^|\D)3\/4(\D|$)/g,"$1\xbe$2")}}),e.rule({name:"common/number/mathSigns",handler:function(r){return e._replace(r,[[/!=/g,"\u2260"],[/<=/g,"\u2264"],[/(^|[^=])>=/g,"$1\u2265"],[/<=>/g,"\u21d4"],[/<</g,"\u226a"],[/>>/g,"\u226b"],[/~=/g,"\u2245"],[/(^|[^+])\+-/g,"$1\xb1"]])}}),e.rule({name:"common/number/times",handler:function(e){return e.replace(/(\d)[ \u00A0]?[x\u0445][ \u00A0]?(\d)/g,"$1\xd7$2")}}),e._sortRules(),e._needSortRules=!0,e});
!function(e,r){"function"==typeof define&&define.amd?define("typograf",[],r):"object"==typeof exports?module.exports=r():e.Typograf=r()}(this,function(){"use strict";function e(e){this._prefs="object"==typeof e?e:{},this._prefs.live=this._prefs.live||!1,this._settings={},this._enabledRules={},this._replaceLabel=this._replaceLabel.bind(this),this._pasteLabel=this._pasteLabel.bind(this),this._initSafeTags(),this._rules.forEach(this._prepareRule,this),this._prefs.disable&&this.disable(this._prefs.disable),this._prefs.enable&&this.enable(this._prefs.enable)}return e.rule=function(r){var n=r.name.split("/");return r._enabled=r.disabled!==!0,r._lang=n[0],r._group=n[1],r._name=n[2],e._setIndex(r),e.prototype._rules.push(r),e._needSortRules&&this._sortRules(),this},e._langs=["en","ru"],e._setIndex=function(r){var n=r.index,a=typeof n,t=e.groupIndexes[r._group];"undefined"===a?n=t:"string"===a&&(n=t+parseInt(r.index,10)),r._index=n},e.innerRule=function(r){return e.prototype._innerRules.push(r),r._lang=r.name.split("/")[0],this},e.data=function(r,n){if("string"==typeof r){if(1===arguments.length)return e._data[r];e._data[r]=n}else"object"==typeof r&&Object.keys(r).forEach(function(n){e._data[n]=r[n]})},e._data={},e._sortRules=function(){e.prototype._rules.sort(function(e,r){return e._index>r._index?1:-1})},e._replace=function(e,r){for(var n=0;n<r.length;n++)e=e.replace(r[n][0],r[n][1]);return e},e._replaceNbsp=function(e){return e.replace(/\u00A0/g," ")},e._privateLabel="\udbff",e._privateQuote="\udbfe",e.prototype={constructor:e,execute:function(r,n){if(r=""+r,!r)return"";n=n||{};var a=this,t={},u={},i="undefined"==typeof n.mode?this._prefs.mode:n.mode,s=function(e){r=a._executeRules(r,t[e],u[e])};return this._lang=n.lang||this._prefs.lang||"common",r=this._fixLineEnd(r),this._innerRules.forEach(function(e){var r=e.queue;u[r]=u[r]||[],u[r].push(e)}),this._rules.forEach(function(e){var r=e.queue;t[r]=t[r]||[],t[r].push(e)}),this._isHTML=r.search(/(<\/?[a-z]|<!|&[lg]t;)/i)!==-1,s("start"),r=this._hideSafeTags(r),r=this._utfication(r),this._prefs.live&&(r=e._replaceNbsp(r)),s("utf"),s(),r=this._modification(r,i),s("entity"),r=this._showSafeTags(r),s("end"),this._lang=null,this._isHTML=null,r},setting:function(e,r,n){return arguments.length<=2?this._settings[e]&&this._settings[e][r]:(this._settings[e]=this._settings[e]||{},this._settings[e][r]=n,this)},enabled:function(e){return this._enabledRules[e]},disabled:function(e){return!this._enabledRules[e]},enable:function(e){return this._enable(e,!0)},disable:function(e){return this._enable(e,!1)},addSafeTag:function(e,r,n){var a=e instanceof RegExp?e:[e,r,n];return this._safeTags.own.push(this._prepareSafeTag(a)),this},data:function(r){var n="";return r.search("/")===-1&&(n=(this._lang||this._prefs.lang)+"/"),e.data(n+r)},_quote:function(r,n){var a=this.data("l")+"\u0301\\d",t=e._privateLabel,u=n.lquote,i=n.rquote,s=n.lquote2,l=n.rquote2,o="["+e.data("common/quote")+"]",c="["+a+")!?.:;#*,\u2026]*?",p=new RegExp('"(['+a+"])","gi"),d=new RegExp("("+c+')"('+c+")","gi"),h=new RegExp(o,"g"),g=new RegExp("^(\\s)?("+o+")","g"),m=new RegExp("(^|\\s)"+o+t,"g"),f=new RegExp(t+o+"([\\s!?.:;#*,]|$)","g"),$=0,b=this.data("lLd");return r=r.replace(new RegExp("(["+b+'])"(?=['+b+"])","g"),"$1"+e._privateQuote).replace(h,function(){return $++,'"'}).replace(p,u+"$1").replace(d,"$1"+i+"$2").replace(m,"$1"+u+t).replace(f,t+i+"$1").replace(g,"$1"+u),s&&l&&$%2===0&&(r=this._innerQuote(r,n)),r.replace(new RegExp(e._privateQuote,"g"),'"')},_innerQuote:function(r,n){var a=[n.lquote],t=[n.rquote];n.lquote2&&n.rquote2&&(a.push(n.lquote2),t.push(n.rquote2),n.lquote3&&n.rquote3&&(a.push(n.lquote3),t.push(n.rquote3)));for(var u=n.lquote,i=n.rquote,s=new Array(r.length),l=e._privateQuote,o=-1,c=a.length-1,p=o,d=0,h=r.length;d<h;d++){var g=r[d];g===u?(p++,p>c&&(p=c),s.push(a[p])):g===i?p<=o?(p=0,s.push(a[p])):(s.push(t[p]),p--,p<o&&(p=o)):(g===l&&(p=o),s.push(g))}return s.join("")},_executeRules:function(e,r,n){return n&&n.forEach(function(r){e=this._ruleIterator(e,r)},this),r&&r.forEach(function(r){e=this._ruleIterator(e,r)},this),e},_ruleIterator:function(e,r){var n=r._lang,a=this._prefs.live;return a===!0&&r.live===!1||a===!1&&r.live===!0?e:("common"!==n&&n!==this._lang||!this.enabled(r.name)||(this._onBeforeRule&&this._onBeforeRule(r.name,e),e=r.handler.call(this,e,this._settings[r.name]),this._onAfterRule&&this._onAfterRule(r.name,e)),e)},_fixLineEnd:function(e){return e.replace(/\r\n/g,"\n")},_prepareRule:function(e){var r=e.name,n={};"object"==typeof e.settings&&Object.keys(e.settings).forEach(function(r){n[r]=e.settings[r]}),this._settings[r]=n,this._enabledRules[r]=e._enabled},_enable:function(e,r){return Array.isArray(e)?e.forEach(function(e){this._enableByMask(e,r)},this):this._enableByMask(e,r),this},_enableByMask:function(e,r){var n;e.search(/\*/)!==-1?(n=new RegExp(e.replace(/\//g,"\\/").replace(/\*/g,".*")),this._rules.forEach(function(e){var a=e.name;n.test(a)&&(this._enabledRules[a]=r)},this)):this._enabledRules[e]=r},_rules:[],_innerRules:[],_getRule:function(e){var r=null;return this._rules.some(function(n){return n.name===e&&(r=n,!0)}),r},_initSafeTags:function(){var e=[["<!--","-->"],["<!ENTITY",">"],["<!DOCTYPE",">"],["<\\?xml","\\?>"],["<!\\[CDATA\\[","\\]\\]>"]];["code","kbd","object","pre","samp","script","style","var"].forEach(function(r){e.push(["<"+r+"(\\s[^>]*?)?>","</"+r+">"])},this),this._safeTags={html:e.map(this._prepareSafeTag),own:[],url:[this._reUrl]}},_reUrl:new RegExp("(https?|file|ftp)://([a-zA-Z0-9/+-=%&:_.~?]+[a-zA-Z0-9#+]*)","g"),_hideSafeTags:function(e){var r=this,n=function(n){e=e.replace(r._prepareSafeTag(n),r._pasteLabel)},a=function(e){r._safeTags[e].forEach(n)};return this._hiddenSafeTags={},this._iLabel=0,a("own"),this._isHTML&&(a("html"),e=this._hideHTMLTags(e)),a("url"),e},_prepareSafeTag:function(e){var r;if(e instanceof RegExp)r=e;else{var n=e[0],a=e[1],t="undefined"==typeof e[2]?"[^]*?":e[2];r=new RegExp(n+t+a,"gi")}return r},_getPrivateLabel:function(r){var n=e._privateLabel;return n+"tf"+r+n},_pasteLabel:function(e){var r=this._getPrivateLabel(this._iLabel);return this._hiddenSafeTags[r]=e,this._iLabel++,r},_replaceLabel:function(e){return this._hiddenSafeTags[e]},_hideHTMLTags:function(e){return e.replace(/<\/?[a-z][^]*?>/gi,this._pasteLabel).replace(/&lt;\/?[a-z][^]*?&gt;/gi,this._pasteLabel).replace(/&[gl]t;/gi,this._pasteLabel)},_showSafeTags:function(r){var n=e._privateLabel,a=new RegExp(n+"tf\\d+"+n,"g"),t=new RegExp(n+"tf\\d"),u=0;Object.keys(this._safeTags).forEach(function(e){u+=e.length});for(var i=0;i<u&&(r=r.replace(a,this._replaceLabel),r.search(t)!==-1);i++);return this._hiddenSafeTags={},r},_utfication:function(e){return e.search(/&#/)!==-1&&(e=this._decHexToUtf(e)),e.search(/&[a-z]/i)!==-1&&this.entities.forEach(function(r){e=e.replace(r[3],r[2])}),e.replace(/&quot;/g,'"')},_decHexToUtf:function(e){return e.replace(/&#(\d{1,6});/gi,function(e,r){return String.fromCharCode(parseInt(r,10))}).replace(/&#x([\da-f]{1,6});/gi,function(e,r){return String.fromCharCode(parseInt(r,16))})},_modification:function(e,r){if("name"===r||"digit"===r){var n="name"===r?0:1;this.entities.forEach(function(r){r[n]&&(e=e.replace(r[4],r[n]))})}return e}},e.version="5.5.1",e.groupIndexes={symbols:110,space:210,dash:310,punctuation:410,nbsp:510,number:610,money:710,date:810,other:910,optalign:1010,typo:1110,html:1210},e.prototype.entities=[],[["nbsp",160],["iexcl",161],["cent",162],["pound",163],["curren",164],["yen",165],["brvbar",166],["sect",167],["uml",168],["copy",169],["ordf",170],["laquo",171],["not",172],["shy",173],["reg",174],["macr",175],["deg",176],["plusmn",177],["sup2",178],["sup3",179],["acute",180],["micro",181],["para",182],["middot",183],["cedil",184],["sup1",185],["ordm",186],["raquo",187],["frac14",188],["frac12",189],["frac34",190],["iquest",191],["Agrave",192],["Aacute",193],["Acirc",194],["Atilde",195],["Auml",196],["Aring",197],["AElig",198],["Ccedil",199],["Egrave",200],["Eacute",201],["Ecirc",202],["Euml",203],["Igrave",204],["Iacute",205],["Icirc",206],["Iuml",207],["ETH",208],["Ntilde",209],["Ograve",210],["Oacute",211],["Ocirc",212],["Otilde",213],["Ouml",214],["times",215],["Oslash",216],["Ugrave",217],["Uacute",218],["Ucirc",219],["Uuml",220],["Yacute",221],["THORN",222],["szlig",223],["agrave",224],["aacute",225],["acirc",226],["atilde",227],["auml",228],["aring",229],["aelig",230],["ccedil",231],["egrave",232],["eacute",233],["ecirc",234],["euml",235],["igrave",236],["iacute",237],["icirc",238],["iuml",239],["eth",240],["ntilde",241],["ograve",242],["oacute",243],["ocirc",244],["otilde",245],["ouml",246],["divide",247],["oslash",248],["ugrave",249],["uacute",250],["ucirc",251],["uuml",252],["yacute",253],["thorn",254],["yuml",255],["fnof",402],["Alpha",913],["Beta",914],["Gamma",915],["Delta",916],["Epsilon",917],["Zeta",918],["Eta",919],["Theta",920],["Iota",921],["Kappa",922],["Lambda",923],["Mu",924],["Nu",925],["Xi",926],["Omicron",927],["Pi",928],["Rho",929],["Sigma",931],["Tau",932],["Upsilon",933],["Phi",934],["Chi",935],["Psi",936],["Omega",937],["alpha",945],["beta",946],["gamma",947],["delta",948],["epsilon",949],["zeta",950],["eta",951],["theta",952],["iota",953],["kappa",954],["lambda",955],["mu",956],["nu",957],["xi",958],["omicron",959],["pi",960],["rho",961],["sigmaf",962],["sigma",963],["tau",964],["upsilon",965],["phi",966],["chi",967],["psi",968],["omega",969],["thetasym",977],["upsih",978],["piv",982],["bull",8226],["hellip",8230],["prime",8242],["Prime",8243],["oline",8254],["frasl",8260],["weierp",8472],["image",8465],["real",8476],["trade",8482],["alefsym",8501],["larr",8592],["uarr",8593],["rarr",8594],["darr",8595],["harr",8596],["crarr",8629],["lArr",8656],["uArr",8657],["rArr",8658],["dArr",8659],["hArr",8660],["forall",8704],["part",8706],["exist",8707],["empty",8709],["nabla",8711],["isin",8712],["notin",8713],["ni",8715],["prod",8719],["sum",8721],["minus",8722],["lowast",8727],["radic",8730],["prop",8733],["infin",8734],["ang",8736],["and",8743],["or",8744],["cap",8745],["cup",8746],["int",8747],["there4",8756],["sim",8764],["cong",8773],["asymp",8776],["ne",8800],["equiv",8801],["le",8804],["ge",8805],["sub",8834],["sup",8835],["nsub",8836],["sube",8838],["supe",8839],["oplus",8853],["otimes",8855],["perp",8869],["sdot",8901],["lceil",8968],["rceil",8969],["lfloor",8970],["rfloor",8971],["lang",9001],["rang",9002],["spades",9824],["clubs",9827],["hearts",9829],["diams",9830],["loz",9674],["OElig",338],["oelig",339],["Scaron",352],["scaron",353],["Yuml",376],["circ",710],["tilde",732],["ensp",8194],["emsp",8195],["thinsp",8201],["zwnj",8204],["zwj",8205],["lrm",8206],["rlm",8207],["ndash",8211],["mdash",8212],["lsquo",8216],["rsquo",8217],["sbquo",8218],["ldquo",8220],["rdquo",8221],["bdquo",8222],["dagger",8224],["Dagger",8225],["permil",8240],["lsaquo",8249],["rsaquo",8250],["euro",8364],["NestedGreaterGreater",8811],["NestedLessLess",8810]].forEach(function(r){var n=r[0],a=r[1],t=String.fromCharCode(a),u=["&"+n+";","&#"+a+";",t,new RegExp("&"+n+";","g"),new RegExp(t,"g")];e.prototype.entities.push(u)},this),e.data("common/dash","--?|\u2012|\u2013|\u2014"),e.data("common/quote",'\xab\u2039\xbb\u203a\u201e\u201a\u201c\u201f\u2018\u201b\u201d\u2019"'),e.data({"en/l":"a-z","en/ld":"a-z\\d","en/L":"A-Z","en/Ld":"A-Z\\d","en/lL":"a-zA-Z","en/lLd":"a-zA-Z\\d"}),e.data("en/lquote","\u201c\u2018"),e.data("en/rquote","\u201d\u2019"),e.data({"ru/dashBefore":"(^| |\\n)","ru/dashAfter":"(?=[\xa0 ,.?:!]|$)","ru/dashAfterDe":"(?=[,.?:!]|[\xa0 ][^\u0410-\u042f\u0401]|$)"}),e.data({"ru/l":"\u0430-\u044f\u0451a-z","ru/ld":"\u0430-\u044f\u0451a-z\\d","ru/L":"\u0410-\u042f\u0401A-Z","ru/Ld":"\u0410-\u042f\u0401A-Z\\d","ru/lL":"\u0430-\u044f\u0451\u0410-\u042f\u0401a-zA-Z","ru/lLd":"\u0430-\u044f\u0451\u0410-\u042f\u0401a-zA-Z\\d"}),e.data("ru/lquote","\xab\u201e\u201a"),e.data({"ru/month":"\u044f\u043d\u0432\u0430\u0440\u044c|\u0444\u0435\u0432\u0440\u0430\u043b\u044c|\u043c\u0430\u0440\u0442|\u0430\u043f\u0440\u0435\u043b\u044c|\u043c\u0430\u0439|\u0438\u044e\u043d\u044c|\u0438\u044e\u043b\u044c|\u0430\u0432\u0433\u0443\u0441\u0442|\u0441\u0435\u043d\u0442\u044f\u0431\u0440\u044c|\u043e\u043a\u0442\u044f\u0431\u0440\u044c|\u043d\u043e\u044f\u0431\u0440\u044c|\u0434\u0435\u043a\u0430\u0431\u0440\u044c","ru/monthGenCase":"\u044f\u043d\u0432\u0430\u0440\u044f|\u0444\u0435\u0432\u0440\u0430\u043b\u044f|\u043c\u0430\u0440\u0442\u0430|\u0430\u043f\u0440\u0435\u043b\u044f|\u043c\u0430\u044f|\u0438\u044e\u043d\u044f|\u0438\u044e\u043b\u044f|\u0430\u0432\u0433\u0443\u0441\u0442\u0430|\u0441\u0435\u043d\u0442\u044f\u0431\u0440\u044f|\u043e\u043a\u0442\u044f\u0431\u0440\u044f|\u043d\u043e\u044f\u0431\u0440\u044f|\u0434\u0435\u043a\u0430\u0431\u0440\u044f","ru/monthPreCase":"\u044f\u043d\u0432\u0430\u0440\u0435|\u0444\u0435\u0432\u0440\u0430\u043b\u0435|\u043c\u0430\u0440\u0442\u0435|\u0430\u043f\u0440\u0435\u043b\u0435|\u043c\u0430\u0435|\u0438\u044e\u043d\u0435|\u0438\u044e\u043b\u0435|\u0430\u0432\u0433\u0443\u0441\u0442\u0435|\u0441\u0435\u043d\u0442\u044f\u0431\u0440\u0435|\u043e\u043a\u0442\u044f\u0431\u0440\u0435|\u043d\u043e\u044f\u0431\u0440\u0435|\u0434\u0435\u043a\u0430\u0431\u0440\u0435","ru/shortMonth":"\u044f\u043d\u0432|\u0444\u0435\u0432|\u043c\u0430\u0440|\u0430\u043f\u0440|\u043c\u0430[\u0435\u0439\u044f]|\u0438\u044e\u043d|\u0438\u044e\u043b|\u0430\u0432\u0433|\u0441\u0435\u043d|\u043e\u043a\u0442|\u043d\u043e\u044f|\u0434\u0435\u043a"}),e.data("ru/rquote","\xbb\u201c\u2018"),e.data("ru/weekday","\u043f\u043e\u043d\u0435\u0434\u0435\u043b\u044c\u043d\u0438\u043a|\u0432\u0442\u043e\u0440\u043d\u0438\u043a|\u0441\u0440\u0435\u0434\u0430|\u0447\u0435\u0442\u0432\u0435\u0440\u0433|\u043f\u044f\u0442\u043d\u0438\u0446\u0430|\u0441\u0443\u0431\u0431\u043e\u0442\u0430|\u0432\u043e\u0441\u043a\u0440\u0435\u0441\u0435\u043d\u044c\u0435"),e.rule({name:"common/html/e-mail",queue:"end",handler:function(e){return this._isHTML?e:e.replace(/(^|[\s;(])([\w\-.]{2,})@([\w\-.]{2,})\.([a-z]{2,6})([)\s.,!?]|$)/gi,'$1<a href="mailto:$2@$3.$4">$2@$3.$4</a>$5')},disabled:!0}),e.rule({name:"common/html/escape",index:"+100",queue:"end",handler:function(e){var r={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};return e.replace(/[&<>"'\/]/g,function(e){return r[e]})},disabled:!0}),e.rule({name:"common/html/nbr",index:"+5",queue:"end",handler:function(e){return e.search(/<br/)===-1?e.replace(/\n/g,"<br/>\n"):e},disabled:!0}),e.rule({name:"common/html/pbr",queue:"end",handler:function(e){return e.search(/<(p|br)[\s\/>]/)===-1&&(e.search(/\n/)===-1?e="<p>"+e+"</p>":(e="<p>"+e.replace(/\n\n/g,"</p>\n<p>")+"</p>",e=e.replace(/([^>])\n/g,"$1<br/>\n"))),e},disabled:!0}),e.rule({name:"common/html/stripTags",index:"+99",queue:"end",handler:function(e){return e.replace(/<[^>]+>/g,"")},disabled:!0}),e.rule({name:"common/html/url",queue:"end",handler:function(e){return this._isHTML?e:e.replace(this._reUrl,function(e,r,n){n=n.replace(/([^\/]+\/?)(\?|#)$/,"$1").replace(/^([^\/]+)\/$/,"$1"),"http"===r?n=n.replace(/^([^\/]+)(:80)([^\d]|\/|$)/,"$1$3"):"https"===r&&(n=n.replace(/^([^\/]+)(:443)([^\d]|\/|$)/,"$1$3"));var a=n,t=r+"://"+n,u='<a href="'+t+'">';return"http"===r||"https"===r?(a=a.replace(/^www\./,""),u+("http"===r?a:r+"://"+a)+"</a>"):u+t+"</a>"})},disabled:!0}),e.rule({name:"common/nbsp/afterNumber",handler:function(e){var r="(^|\\D)(\\d{1,5}) (["+this.data("l")+"]{2,})";return e.replace(new RegExp(r,"gi"),"$1$2\xa0$3")},disabled:!0}),e.rule({name:"common/nbsp/afterParagraph",handler:function(e){return e.replace(/\u00A7[ \u00A0\u2009]?(\d|I|V|X)/g,"\xa7\u202f$1")}}),e.rule({name:"common/nbsp/afterShortWord",handler:function(r,n){var a=n.lengthShortWord,t=" \xa0("+e._privateLabel+this.data("common/quote"),u="(^|["+t+"])(["+this.data("l")+"]{1,"+a+"}) ",i="$1$2\xa0",s=new RegExp(u,"gim");return r.replace(s,i).replace(s,i)},settings:{lengthShortWord:2}}),e.rule({name:"common/nbsp/beforeShortLastNumber",handler:function(e,r){var n=new RegExp("(["+this.data("lL")+"]) (?=\\d{1,"+r.lengthLastNumber+"}[-+\u2212%'\""+this.data("rquote")+"]?([.!?\u2026]( ["+this.data("L")+"]|$)|$))","gm");return e.replace(n,"$1\xa0")},live:!1,settings:{lengthLastNumber:2}}),e.rule({name:"common/nbsp/beforeShortLastWord",handler:function(e,r){var n=new RegExp("(["+this.data("ld")+"]) (["+this.data("lL")+"]{1,"+r.lengthLastWord+"}[.!?\u2026])( ["+this.data("L")+"]|$)","g");return e.replace(n,"$1\xa0$2$3")},settings:{lengthLastWord:3}}),e.rule({name:"common/nbsp/dpi",handler:function(e){return e.replace(/(\d) ?(lpi|dpi)(?!\w)/,"$1\xa0$2")}}),function(){function r(e,r,n,a){return r+n.replace(/([^\u00A0])\u00A0([^\u00A0])/g,"$1 $2")+a}e.rule({name:"common/nbsp/nowrap",queue:"end",handler:function(e){return e.replace(/(<nowrap>)(.*?)(<\/nowrap>)/g,r).replace(/(<nobr>)(.*?)(<\/nobr>)/g,r)}})}(),e.rule({name:"common/nbsp/replaceNbsp",queue:"utf",live:!1,handler:e._replaceNbsp,disabled:!0}),e.rule({name:"common/number/fraction",handler:function(e){return e.replace(/(^|\D)1\/2(\D|$)/g,"$1\xbd$2").replace(/(^|\D)1\/4(\D|$)/g,"$1\xbc$2").replace(/(^|\D)3\/4(\D|$)/g,"$1\xbe$2")}}),e.rule({name:"common/number/mathSigns",handler:function(r){return e._replace(r,[[/!=/g,"\u2260"],[/<=/g,"\u2264"],[/(^|[^=])>=/g,"$1\u2265"],[/<=>/g,"\u21d4"],[/<</g,"\u226a"],[/>>/g,"\u226b"],[/~=/g,"\u2245"],[/(^|[^+])\+-/g,"$1\xb1"]])}}),e.rule({name:"common/number/times",handler:function(e){return e.replace(/(\d)[ \u00A0]?[x\u0445][ \u00A0]?(\d)/g,"$1\xd7$2")}}),e.rule({name:"common/other/delBOM",queue:"start",index:-1,handler:function(e){return 65279===e.charCodeAt(0)?e.slice(1):e}}),e.rule({name:"common/other/repeatWord",handler:function(e,r){var n="[;:,.?! \n"+this.data("common/quote")+"]",a=new RegExp("("+n+"|^)(["+this.data("l")+"]{"+r.min+",}) \\2("+n+"|$)","gi");return e.replace(a,"$1$2$3")},settings:{min:2},disabled:!0}),e.rule({name:"common/punctuation/delDoublePunctuation",handler:function(e){return e.replace(/(^|[^,]),,(?!,)/g,"$1,").replace(/(^|[^:])::(?!:)/g,"$1:").replace(/(^|[^!?\.])\.\.(?!\.)/g,"$1.").replace(/(^|[^;]);;(?!;)/g,"$1;").replace(/(^|[^?])\?\?(?!\?)/g,"$1?")}}),e.rule({name:"common/space/afterPunctuation",handler:function(r){var n=e._privateLabel,a=new RegExp("(!|;|\\?)([^).!;?\\s[\\])"+n+this.data("common/quote")+"])","g"),t=new RegExp('(\\D)(,|:)([^)",:.?\\s\\/\\\\'+n+"])","g");return r.replace(a,"$1 $2").replace(t,"$1$2 $3")}}),e.rule({name:"common/space/beforeBracket",handler:function(e){var r=new RegExp("(["+this.data("l")+".!?,;\u2026)])\\(","gi");return e.replace(r,"$1 (")}}),e.rule({name:"common/space/bracket",handler:function(e){return e.replace(/(\() +/g,"(").replace(/ +\)/g,")")}}),e.rule({name:"common/space/delBeforePercent",handler:function(e){return e.replace(/(\d)( |\u00A0)(%|\u2030|\u2031)/g,"$1$3")}}),e.rule({name:"common/space/delBeforePunctuation",handler:function(e){return e.replace(/ ([!;,?.:])(?!\))/g,"$1")}}),e.rule({name:"common/space/delLeadingBlanks",handler:function(e){return e.replace(/\n[ \t]+/g,"\n")},disabled:!0}),e.rule({name:"common/space/delRepeatN",index:"-1",handler:function(e){return e.replace(/\n{3,}/g,"\n\n")}}),e.rule({name:"common/space/delRepeatSpace",index:"-1",handler:function(e){return e.replace(/([^\n \t])[ \t]{2,}(?![\n \t])/g,"$1 ")}}),e.rule({name:"common/space/delTrailingBlanks",index:"-3",handler:function(e){return e.replace(/[ \t]+\n/g,"\n")}}),e.rule({name:"common/space/replaceTab",index:"-5",handler:function(e){return e.replace(/\t/g," ")}}),e.rule({name:"common/space/squareBracket",handler:function(e){return e.replace(/(\[) +/g,"[").replace(/ +\]/g,"]")}}),e.rule({name:"common/space/trimLeft",index:"-4",handler:String.prototype.trimLeft?function(e){return e.trimLeft()}:function(e){return e.replace(/^[\s\uFEFF\xA0]+/g,"")}}),e.rule({name:"common/space/trimRight",index:"-3",live:!1,handler:String.prototype.trimRight?function(e){return e.trimRight()}:function(e){return e.replace(/[\s\uFEFF\xA0]+$/g,"")}}),e.rule({name:"common/symbols/arrow",handler:function(r){return e._replace(r,[[/(^|[^-])->(?!>)/g,"$1\u2192"],[/(^|[^<])<-(?!-)/g,"$1\u2190"]])}}),e.rule({name:"common/symbols/cf",handler:function(e){var r=new RegExp('(^|[^%])(\\d+)( |\xa0)?(C|F)([\\W \\.,:!\\?"\\]\\)]|$)',"g");return e.replace(r,"$1$2\u2009\xb0$4$5")}}),e.rule({name:"common/symbols/copy",handler:function(r){return e._replace(r,[[/\(r\)/gi,"\xae"],[/(copyright )?\((c|\u0441)\)/gi,"\xa9"],[/\(tm\)/gi,"\u2122"]])}}),e.rule({name:"en/punctuation/quote",handler:function(e,r){return this._quote(e,r)},settings:{lquote:"\u201c",rquote:"\u201d",lquote2:"\u2018",rquote2:"\u2019"}}),e.rule({name:"ru/dash/centuries",handler:function(e,r){var n="("+this.data("common/dash")+")",a=new RegExp("(X|I|V)[ |\xa0]?"+n+"[ |\xa0]?(X|I|V)","g");return e.replace(a,"$1"+r.dash+"$3")},settings:{dash:"\u2013"}}),e.rule({name:"ru/dash/daysMonth",handler:function(e,r){var n=new RegExp("(^|\\s)([123]?\\d)("+this.data("common/dash")+")([123]?\\d)[ \xa0]("+this.data("ru/monthGenCase")+")","g");return e.replace(n,"$1$2"+r.dash+"$4\xa0$5")},settings:{dash:"\u2013"}}),e.rule({name:"ru/dash/de",handler:function(e){var r=new RegExp("([a-\u044f\u0451]+) \u0434\u0435"+this.data("ru/dashAfterDe"),"g");return e.replace(r,"$1-\u0434\u0435")},disabled:!0}),e.rule({name:"ru/dash/decade",handler:function(e,r){var n=new RegExp("(^|\\s)(\\d{3}|\\d)0("+this.data("common/dash")+")(\\d{3}|\\d)0(-\u0435[ \xa0])(?=\u0433\\.?[ \xa0]?\u0433|\u0433\u043e\u0434)","g");return e.replace(n,"$1$20"+r.dash+"$40$5")},settings:{dash:"\u2013"}}),e.rule({name:"ru/dash/directSpeech",handler:function(r){var n=this.data("common/dash"),a=new RegExp('(["\xbb\u2018\u201c,])[ |\xa0]?('+n+")[ |\xa0]","g"),t=new RegExp("(^|"+e._privateLabel+")("+n+")( |\xa0)","gm"),u=new RegExp("([.\u2026?!])[ \xa0]("+n+")[ \xa0]","g");return r.replace(a,"$1\xa0\u2014 ").replace(t,"$1\u2014\xa0").replace(u,"$1 \u2014\xa0")}}),e.rule({name:"ru/dash/izpod",handler:function(e){var r=new RegExp(this.data("ru/dashBefore")+"(\u0418|\u0438)\u0437 \u043f\u043e\u0434"+this.data("ru/dashAfter"),"g");return e.replace(r,"$1$2\u0437-\u043f\u043e\u0434")}}),e.rule({name:"ru/dash/izza",handler:function(e){var r=new RegExp(this.data("ru/dashBefore")+"(\u0418|\u0438)\u0437 \u0437\u0430"+this.data("ru/dashAfter"),"g");return e.replace(r,"$1$2\u0437-\u0437\u0430")}}),e.rule({name:"ru/dash/ka",handler:function(e){var r=new RegExp("([a-\u044f\u0451]+) \u043a\u0430(\u0441\u044c)?"+this.data("ru/dashAfter"),"g");return e.replace(r,"$1-\u043a\u0430$2")}}),e.rule({name:"ru/dash/koe",handler:function(e){var r=new RegExp(this.data("ru/dashBefore")+"([\u041a\u043a]\u043e[\u0435\u0439])\\s([\u0430-\u044f\u0451]{3,})"+this.data("ru/dashAfter"),"g");return e.replace(r,"$1$2-$3")}}),e.rule({name:"ru/dash/main",index:"-5",handler:function(e){var r=this.data("common/dash"),n=new RegExp("([ \xa0])("+r+")([ \xa0\\n])","g");return e.replace(n,"\xa0\u2014$3")}}),e.rule({name:"ru/dash/month",handler:function(e,r){var n="("+this.data("ru/month")+")",a="("+this.data("ru/monthPreCase")+")",t=this.data("common/dash"),u=new RegExp(n+" ?("+t+") ?"+n,"gi"),i=new RegExp(a+" ?("+t+") ?"+a,"gi"),s="$1"+r.dash+"$3";return e.replace(u,s).replace(i,s)},settings:{dash:"\u2013"}}),e.rule({name:"ru/dash/surname",handler:function(e){var r=new RegExp("([\u0410-\u042f\u0401][\u0430-\u044f\u0451]+)\\s-([\u0430-\u044f\u0451]{1,3})(?![^\u0430-\u044f\u0451]|$)","g");return e.replace(r,"$1\xa0\u2014$2")}}),e.rule({name:"ru/dash/taki",handler:function(e){var r=new RegExp("(\u0432\u0435\u0440\u043d\u043e|\u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e|\u043e\u043f\u044f\u0442\u044c|\u043f\u0440\u044f\u043c\u043e|\u0442\u0430\u043a|\u0432\u0441[\u0435\u0451]|\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e|\u043d\u0435\u0443\u0436\u0435\u043b\u0438)\\s(\u0442\u0430\u043a\u0438)"+this.data("ru/dashAfter"),"g");return e.replace(r,"$1-$2")}}),e.rule({name:"ru/dash/time",handler:function(e,r){var n=new RegExp(this.data("ru/dashBefore")+"(\\d?\\d:[0-5]\\d)"+this.data("common/dash")+"(\\d?\\d:[0-5]\\d)"+this.data("ru/dashAfter"),"g");return e.replace(n,"$1$2"+r.dash+"$3")},settings:{dash:"\u2013"}}),e.rule({name:"ru/dash/to",handler:function(e){var r=["\u043e\u0442\u043a\u0443\u0434\u0430","\u043a\u0443\u0434\u0430","\u0433\u0434\u0435","\u043a\u043e\u0433\u0434\u0430","\u0437\u0430\u0447\u0435\u043c","\u043f\u043e\u0447\u0435\u043c\u0443","\u043a\u0430\u043a","\u043a\u0430\u043a\u043e[\u0435\u0439\u043c]","\u043a\u0430\u043a\u0430\u044f","\u043a\u0430\u043a\u0438[\u0435\u043c\u0445]","\u043a\u0430\u043a\u0438\u043c\u0438","\u043a\u0430\u043a\u0443\u044e","\u0447\u0442\u043e","\u0447\u0435\u0433\u043e","\u0447\u0435[\u0439\u043c]","\u0447\u044c\u0438\u043c?","\u043a\u0442\u043e","\u043a\u043e\u0433\u043e","\u043a\u043e\u043c\u0443","\u043a\u0435\u043c"],n=new RegExp("("+r.join("|")+")( | -|- )(\u0442\u043e|\u043b\u0438\u0431\u043e|\u043d\u0438\u0431\u0443\u0434\u044c)"+this.data("ru/dashAfter"),"gi");return e.replace(n,"$1-$3")}}),e.rule({name:"ru/dash/weekday",handler:function(e,r){var n="("+this.data("ru/weekday")+")",a=new RegExp(n+" ?("+this.data("common/dash")+") ?"+n,"gi");return e.replace(a,"$1"+r.dash+"$3")},settings:{dash:"\u2013"}}),e.rule({name:"ru/dash/years",handler:function(e,r){var n=this.data("common/dash"),a=new RegExp("(\\D|^)(\\d{4})[ \xa0]?("+n+")[ \xa0]?(\\d{4})(?=[ \xa0]?\u0433)","g");return e.replace(a,function(e,n,a,t,u){return parseInt(a,10)<parseInt(u,10)?n+a+r.dash+u:e})},settings:{dash:"\u2013"}}),e.rule({name:"ru/date/fromISO",handler:function(e){var r="(-|\\.|\\/)",n="(-|\\/)",a=new RegExp("(^|\\D)(\\d{4})"+r+"(\\d{2})"+r+"(\\d{2})(\\D|$)","gi"),t=new RegExp("(^|\\D)(\\d{2})"+n+"(\\d{2})"+n+"(\\d{4})(\\D|$)","gi");return e.replace(a,"$1$6.$4.$2$7").replace(t,"$1$4.$2.$6$7")}}),e.rule({name:"ru/date/weekday",handler:function(e){var r="( |\xa0)",n=this.data("ru/monthGenCase"),a=this.data("ru/weekday"),t=new RegExp("(\\d)"+r+"("+n+"),"+r+"("+a+")","gi");return e.replace(t,function(){var e=arguments;return e[1]+e[2]+e[3].toLowerCase()+","+e[4]+e[5].toLowerCase()})}}),e.rule({name:"ru/money/currency",handler:function(e){var r="([$\u20ac\xa5\u04b0\xa3\u20a4\u20bd])",n=new RegExp("(^|[\\D]{2})"+r+" ?([\\d.,]+([ \xa0\u2009\u202f]\\d{3})*)","g"),a=new RegExp("(^|[\\D])([\\d.,]+) ?"+r,"g"),t="$1$3\xa0$2",u="$1$2\xa0$3";return e.replace(n,t).replace(a,u)}}),e.rule({name:"ru/money/ruble",handler:function(e){var r="$1\xa0\u20bd",n="(\\d+)( |\xa0)?(\u0440|\u0440\u0443\u0431)\\.",a=new RegExp("^"+n+"$","g"),t=new RegExp(n+"(?=[!?,:;])","g"),u=new RegExp(n+"(?=\\s+[A-\u042f\u0401])","g");return e.replace(a,r).replace(t,r).replace(u,r+".")},disabled:!0}),e.rule({name:"ru/nbsp/abbr",handler:function(r){var n=new RegExp("(^|\\s|"+e._privateLabel+")(([\u0430-\u044f\u0451]{1,3}\\.){2,})(?![\u0430-\u044f\u0451])","g");return r.replace(n,function(e,r,n){var a=n.split(/\./);return["\u0440\u0444","\u0440\u0443","\u0440\u0443\u0441","\u043e\u0440\u0433","\u0443\u043a\u0440","\u0431\u0433","\u0441\u0440\u0431"].indexOf(a[a.length-2])>-1?e:r+n.split(/\./).join(".\xa0").trim()})}}),e.rule({name:"ru/nbsp/addr",handler:function(e){return e.replace(/(\s|^)(\u0434\u043e\u043c|\u0434\.|\u043a\u0432\.|\u043f\u043e\u0434\.|\u043f\-\u0434) *(\d+)/gi,"$1$2\xa0$3").replace(/(\s|^)(\u043c\u043a\u0440-\u043d|\u043c\u043a-\u043d|\u043c\u043a\u0440\.|\u043c\u043a\u0440\u043d)\s/gi,"$1$2\xa0").replace(/(\s|^)(\u044d\u0442\.) *(-?\d+)/gi,"$1$2\xa0$3").replace(/(\s|^)(\d+) +\u044d\u0442\u0430\u0436([^\u0430-\u044f\u0451]|$)/gi,"$1$2\xa0\u044d\u0442\u0430\u0436$3").replace(/(\s|^)\u043b\u0438\u0442\u0435\u0440\s([\u0410-\u042f]|$)/gi,"$1\u043b\u0438\u0442\u0435\u0440\xa0$2").replace(/(\s|^)(\u043e\u0431\u043b|\u043a\u0440|\u0441\u0442|\u043f\u043e\u0441|\u0441|\u0434|\u0443\u043b|\u043f\u0435\u0440|\u043f\u0440|\u043f\u0440\-\u0442|\u043f\u0440\u043e\u0441\u043f|\u043f\u043b|\u0431\u0443\u043b|\u0431\-\u0440|\u043d\u0430\u0431|\u0448|\u0442\u0443\u043f|\u043e\u0444|\u043a\u043e\u043c\u043d?|\u0443\u0447|\u0432\u043b|\u0432\u043b\u0430\u0434|\u0441\u0442\u0440|\u043a\u043e\u0440)\. *([\u0430-\u044f\u0451a-z\d]+)/gi,"$1$2.\xa0$3").replace(/(\D[ \u00A0]|^)\u0433\. ?([\u0410-\u042f\u0401])/gm,"$1\u0433.\xa0$2")}}),e.rule({name:"ru/nbsp/afterNumberSign",handler:function(e){return e.replace(/\u2116[ \u00A0\u2009]?(\d|\u043f\/\u043f)/g,"\u2116\u202f$1")}}),e.rule({name:"ru/nbsp/beforeParticle",index:"+5",handler:function(e){var r="(\u043b\u0438|\u043b\u044c|\u0436\u0435|\u0436|\u0431\u044b|\u0431)",n=new RegExp("([\u0410-\u042f\u0401\u0430-\u044f\u0451]) "+r+'(?=[,;:?!"\u2018\u201c\xbb])',"g"),a=new RegExp("([\u0410-\u042f\u0401\u0430-\u044f\u0451])[ \xa0]"+r+"[ \xa0]","g");return e.replace(n,"$1\xa0$2").replace(a,"$1\xa0$2 ")}}),e.rule({name:"ru/nbsp/centuries",handler:function(e){var r=this.data("common/dash"),n="(^|\\s)([VIX]+)",a='(?=[,;:?!"\u2018\u201c\xbb]|$)',t=new RegExp(n+"[ \xa0]?\u0432\\.?"+a,"gm"),u=new RegExp(n+"("+r+")([VIX]+)[ \xa0]?\u0432\\.?([ \xa0]?\u0432\\.?)?"+a,"gm");return e.replace(t,"$1$2\xa0\u0432.").replace(u,"$1$2$3$4\xa0\u0432\u0432.")}}),e.rule({name:"ru/nbsp/dayMonth",handler:function(e){var r=new RegExp("(\\d{1,2}) ("+this.data("ru/shortMonth")+")","gi");return e.replace(r,"$1\xa0$2")}}),e.rule({name:"ru/nbsp/groupNumbers",handler:function(e){return e.replace(/(^ ?|\D )(\d{1,3}([ \u00A0\u202F\u2009]\d{3})+)(?! ?[\d-])/gm,function(e,r,n){return r+n.replace(/\s/g,"\u202f")})}}),e.rule({name:"ru/nbsp/initials",handler:function(r){var n="\xa0\u202f ",a=this.data("ru/lquote"),t=this.data("ru/rquote"),u=new RegExp("(^|["+n+a+e._privateLabel+'"])([\u0410-\u042f\u0401])\\.['+n+"]?([\u0410-\u042f\u0401])\\.["+n+']?([\u0410-\u042f\u0401][\u0430-\u044f\u0451]+)(?=[\\s.,;:?!"'+t+"]|$)","gm");return r.replace(u,"$1$2.\xa0$3.\xa0$4")}}),e.rule({name:"ru/nbsp/m",index:"+5",handler:function(r){var n=e._privateLabel,a=new RegExp("(^|[\\s,."+n+"])(\\d+)[ \xa0]?(\u043c\u043c?|\u0441\u043c|\u043a\u043c|\u0434\u043c|\u0433\u043c|mm?|km|cm|dm)([23\xb2\xb3])?([\\s.!?,;"+n+"]|$)","gm");return r.replace(a,function(e,r,n,a,t,u){var i={2:"\xb2","\xb2":"\xb2",3:"\xb3","\xb3":"\xb3","":""}[t||""];return r+n+"\xa0"+a+i+("\xa0"===u?" ":u)})}}),e.rule({name:"ru/nbsp/ooo",handler:function(e){return e.replace(/(^|[^a-\u044f\u0451A-\u042f\u0401])(\u041e\u041e\u041e|\u041e\u0410\u041e|\u0417\u0410\u041e|\u041d\u0418\u0418|\u041f\u0411\u041e\u042e\u041b) /g,"$1$2\xa0")}}),e.rule({name:"ru/nbsp/page",handler:function(r){var n=new RegExp("(^|[)\\s"+e._privateLabel+"])(\u0441\u0442\u0440|\u0433\u043b|\u0440\u0438\u0441|\u0438\u043b\u043b?|\u0441\u0442|\u043f|c)\\. *(\\d+)([\\s.,?!;:]|$)","gim");return r.replace(n,"$1$2.\xa0$3$4")}}),e.rule({name:"ru/nbsp/ps",handler:function(r){var n=new RegExp("(^|\\s|"+e._privateLabel+")[p\u0437]\\.[ \xa0]?([p\u0437]\\.[ \xa0]?)?[s\u044b]\\.:? ","gim");return r.replace(n,function(e,r,n){return r+(n?"P.\xa0P.\xa0S. ":"P.\xa0S. ")})}}),e.rule({name:"ru/nbsp/rubleKopek",handler:function(e){return e.replace(/(\d) ?(?=(\u0440\u0443\u0431|\u043a\u043e\u043f)\.)/g,"$1\xa0")}}),e.rule({name:"ru/nbsp/see",handler:function(r){var n=new RegExp("(^|\\s|"+e._privateLabel+"|\\()(\u0441\u043c|\u0438\u043c)\\.[ \xa0]?([\u0430-\u044f\u04510-9a-z]+)([\\s.,?!]|$)","gi");return r.replace(n,function(e,r,n,a,t){return("\xa0"===r?" ":r)+n+".\xa0"+a+t})}}),e.rule({name:"ru/nbsp/year",handler:function(e){return e.replace(/(^|\D)(\d{4}) ?\u0433([ ,;.\n]|$)/g,"$1$2\xa0\u0433$3")}}),e.rule({name:"ru/nbsp/years",index:"+5",handler:function(e){var r=this.data("common/dash"),n=new RegExp("(^|\\D)(\\d{4})("+r+')(\\d{4})[ \xa0]?\u0433\\.?([ \xa0]?\u0433\\.)?(?=[,;:?!"\u2018\u201c\xbb\\s]|$)',"gm");return e.replace(n,"$1$2$3$4\xa0\u0433\u0433.")}}),e.rule({name:"ru/number/ordinals",handler:function(e){var r=new RegExp("(\\d)-(\u044b\u0439|\u043e\u0439|\u0430\u044f|\u043e\u0435|\u044b\u0435|\u044b\u043c|\u043e\u043c|\u044b\u0445|\u043e\u0433\u043e|\u043e\u043c\u0443|\u044b\u043c\u0438)(?!["+this.data("l")+"])","g");
return e.replace(r,function(e,r,n){var a={"\u043e\u0439":"\u0439","\u044b\u0439":"\u0439","\u0430\u044f":"\u044f","\u043e\u0435":"\u0435","\u044b\u0435":"\u0435","\u044b\u043c":"\u043c","\u043e\u043c":"\u043c","\u044b\u0445":"\u0445","\u043e\u0433\u043e":"\u0433\u043e","\u043e\u043c\u0443":"\u043c\u0443","\u044b\u043c\u0438":"\u043c\u0438"};return r+"-"+a[n]})}}),e.rule({name:"ru/optalign/bracket",handler:function(e){return e.replace(/( |\u00A0)\(/g,'<span class="typograf-oa-sp-lbracket">$1</span><span class="typograf-oa-lbracket">(</span>').replace(/^\(/gm,'<span class="typograf-oa-n-lbracket">(</span>')},disabled:!0}).innerRule({name:"ru/optalign/bracket",handler:function(e){return e.replace(/<span class="typograf-oa-(n-|sp-)?lbracket">(.*?)<\/span>/g,"$2")}}),e.rule({name:"ru/optalign/comma",handler:function(e){var r=new RegExp("(["+this.data("l")+"\\d\u0301]+), ","gi");return e.replace(r,'$1<span class="typograf-oa-comma">,</span><span class="typograf-oa-comma-sp"> </span>')},disabled:!0}).innerRule({name:"ru/optalign/comma",handler:function(e){return e.replace(/<span class="typograf-oa-comma(-sp)?">(.*?)<\/span>/g,"$2")}}),e.rule({name:"ru/optalign/quote",handler:function(r){var n="ru/punctuation/quote",a='(["'+this.setting(n,"lquote")+this.setting(n,"lquote2")+this.setting(n,"lquote3")+"])",t=new RegExp("([\\d"+this.data("l")+"\\-\u0301!?.:;,]+)( |\xa0)("+a+")","gi"),u=new RegExp("(^|"+e._privateLabel+")"+a,"gm");return r.replace(t,'$1<span class="typograf-oa-sp-lquote">$2</span><span class="typograf-oa-lquote">$3</span>').replace(u,'$1<span class="typograf-oa-n-lquote">$2</span>')},disabled:!0}).innerRule({name:"ru/optalign/quote",handler:function(e){return e.replace(/<span class="typograf-oa-(n-|sp-)?lquote">(.*?)<\/span>/g,"$2")}}),e.rule({name:"ru/other/accent",handler:function(e){return e.replace(/([\u0430-\u044f\u0451])([\u0410\u0415\u0401\u0418\u041e\u0423\u042b\u042d\u042e\u042f])([^\u0410-\u042f\u0401\w]|$)/g,function(e,r,n,a){return r+n.toLowerCase()+"\u0301"+a})},disabled:!0}),function(){function r(e){var r,o,c="",p=e[0];if(e.length<8)return a(e);if(e.length>10)if("+"===p){if(e[1]!==u)return e;r=!0,e=e.substr(2)}else"8"===p&&(o=!0,e=e.substr(1));for(var d=s;d>=l;d--){var h=+e.substr(0,d);if(i.indexOf(h)>-1){c=e.substr(0,d),e=e.substr(d);break}}return c||(c=e.substr(0,t),e=e.substr(t)),(r?"+"+u+"\xa0":"")+(o?"8\xa0":"")+n(c)+"\xa0"+a(e)}function n(e){var r=+e,n=e.length,a=[e],t=!1;if(n>3)switch(n){case 4:a=[e.substr(0,2),e.substr(2,4)];break;case 5:a=[e.substr(0,3),e.substr(3,5)];break;case 6:a=[e.substr(0,2),e.substr(2,4),e.substr(4,6)]}else t=r>900&&r<=999||495===r||499===r;return a=a.join("-"),t?a:"("+a+")"}function a(e){var r="";return e.length%2&&(r=e[0],r+=e.length<=5?"-":"",e=e.substr(1,e.length-1)),r+e.split(/(?=(?:\d\d)+$)/).join("-")}var t=5,u="7",i=[],s=8,l=2;[4162,416332,8512,851111,4722,4725,391379,8442,4732,4152,4154451,4154459,4154455,41544513,8142,8332,8612,8622,3525,812,8342,8152,3812,4862,3422,342633,8112,9142,8452,3432,3434,3435,4812,3919,8432,8439,3822,4872,3412,3511,3512,3022,4112,4852,4855,3852,3854,8182,818,90,3472,4741,4764,4832,4922,8172,8202,8722,4932,493,3952,3951,3953,411533,4842,3842,3843,8212,4942,3912,4712,4742,8362,495,499,4966,4964,4967,498,8312,8313,3832,383612,3532,8412,4232,423370,423630,8632,8642,8482,4242,8672,8652,4752,4822,482502,4826300,3452,8422,4212,3466,3462,8712,8352,"901-934","936-939","950-953",958,"960-969","977-989","991-997",999].forEach(function(e){if("string"==typeof e)for(var r=e.split("-"),n=+r[0];n<=+r[1];n++)i.push(n);else i.push(e)}),e.rule({name:"ru/other/phone-number",live:!1,handler:function(e){return e.replace(/(\u0442.|\u0442\u0435\u043b.|\u0444.|\u043c\u043e\u0431.|\u0444\u0430\u043a\u0441|\u0441\u043e\u0442\u043e\u0432\u044b\u0439|\u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0439|\u0442\u0435\u043b\u0435\u0444\u043e\u043d)(\:?\s*?)([\+\d\(][\d \u00A0\-\(\)]{3,}\d)/gi,function(e,n,a,t){var u=t.replace(/[^\d\+]/g,"");return u.length>=5?n+a+r(u):e})}})}(),e.rule({name:"ru/punctuation/ano",handler:function(e){var r=new RegExp("([^!?,:;\\-\u2012\u2013\u2014])([ \xa0\\n])(\u0430|\u043d\u043e)(?= |\xa0|\\n)","g");return e.replace(r,"$1,$2$3")}}),e.rule({name:"ru/punctuation/apostrophe",index:"-5",handler:function(e){var r="(["+this.data("l")+"])",n=new RegExp(r+"['\u2019]"+r,"gi");return e.replace(n,"$1\u02bc$2")}}),e.rule({name:"ru/punctuation/exclamation",live:!1,handler:function(e){return e.replace(/(^|[^!])!{2}($|[^!])/,"$1!$2").replace(/(^|[^!])!{4}($|[^!])/,"$1!!!$2")}}),e.rule({name:"ru/punctuation/exclamationQuestion",index:"+5",handler:function(e){var r=new RegExp("(^|[^!])!\\?([^?]|$)","g");return e.replace(r,"$1?!$2")}}),e.rule({name:"ru/punctuation/hellip",handler:function(e){return e.replace(/(^|[^.])\.{3,4}([^.]|$)/g,"$1\u2026$2").replace(/(^|[^.])(\.\.\.|\u2026),/g,"$1\u2026").replace(/(\!|\?)(\.\.\.|\u2026)([^.]|$)/g,"$1..$3")}}),e.rule({name:"ru/punctuation/quote",handler:function(e,r){var n=r.lquote,a=r.rquote;return e=this._quote(e,r),n===r.lquote2&&a===r.rquote2?e.replace(new RegExp(n+n,"g"),n).replace(new RegExp(a+a,"g"),a):e},settings:{lquote:"\xab",rquote:"\xbb",lquote2:"\u201e",rquote2:"\u201c",lquote3:"\u201a",rquote3:"\u2018"}}),e.rule({name:"ru/space/afterHellip",handler:function(e){return e.replace(/([\u0430-\u044f\u0451])(\.\.\.|\u2026)([\u0410-\u042f\u0401])/g,"$1$2 $3").replace(/([?!]\.\.)([\u0430-\u044f\u0451a-z])/gi,"$1 $2")}}),e.rule({name:"ru/space/year",handler:function(e){var r=new RegExp("(^| |\xa0)(\\d{3,4})(\u0433\u043e\u0434([\u0430\u0443\u0435]|\u043e\u043c)?)([^"+this.data("l")+"]|$)","g");return e.replace(r,"$1$2 $3$5")}}),function(){var r={A:"\u0410",a:"\u0430",B:"\u0412",E:"\u0415",e:"\u0435",K:"\u041a",M:"\u041c",H:"\u041d",O:"\u041e",o:"\u043e",P:"\u0440",p:"\u0420",C:"\u0421",c:"\u0441",T:"\u0422",y:"\u0443",X:"\u0425",x:"\u0445"},n=Object.keys(r).join("");e.rule({name:"ru/typo/switchingKeyboardLayout",handler:function(e){var a=new RegExp("(["+n+"]{1,3})(?=[\u0410-\u042f\u0401\u0430-\u044f\u0451]+?)","g");return e.replace(a,function(e,n){for(var a="",t=0;t<n.length;t++)a+=r[n[t]];return a})}})}(),e._sortRules(),e._needSortRules=!0,e});
{
"name": "typograf",
"description": "The client and server typographer",
"version": "5.5.0",
"version": "5.5.1",
"author": {

@@ -54,12 +54,13 @@ "name": "Denis Seleznev",

"benchmark": "node benchmark/test.js",
"dist": "./node_modules/.bin/gulp dist",
"jscs": "./node_modules/.bin/jscs .",
"eslint": "./node_modules/.bin/eslint .",
"rebuild": "./node_modules/.bin/gulp",
"test": "npm run-script rebuild && npm run-script eslint && npm run-script jscs && npm run-script unit-test-coverage",
"unit-test": "./node_modules/.bin/mocha -u bdd -R spec --recursive test",
"unit-test-coverage": "./node_modules/.bin/istanbul cover ./node_modules/mocha/bin/_mocha -- -u bdd -R spec --recursive test",
"yaspeller": "./node_modules/.bin/yaspeller ."
"dist": "gulp dist",
"jscs": "jscs .",
"eslint": "eslint .",
"prepublish": "npm run dist",
"rebuild": "gulp",
"test": "npm run rebuild && npm run eslint && npm run jscs && npm run unit-test-coverage",
"unit-test": "mocha -u bdd -R spec --recursive test",
"unit-test-coverage": "istanbul cover ./node_modules/mocha/bin/_mocha -- -u bdd -R spec --recursive test",
"yaspeller": "yaspeller ."
},
"typings": "./typograf.d.ts"
}

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc