Seditio Source
Root |
./othercms/dle15_0/upload/engine/classes/js/typograf.min.js
/*! typograf | © 2020 Denis Seleznev | MIT  License | https://github.com/typograf/typograf */
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).Typograf=t()}(this,function(){"use strict";function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}function s(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,a=!1,i=void 0;try{for(var s,u=e[Symbol.iterator]();!(r=(s=u.next()).done)&&(n.push(s.value),!t||n.length!==t);r=!0);}catch(e){a=!0,i=e}finally{try{r||null==u.return||u.return()}finally{if(a)throw i}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return u(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return u(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var o={symbols:110,space:210,dash:310,punctuation:410,nbsp:510,number:610,money:710,date:810,other:910,optalign:1010,typo:1110,html:1210},t=[["iexcl",161],["cent",162],["pound",163],["curren",164],["yen",165],["brvbar",166],["sect",167],["uml",168],["copy",169],["ordf",170],["laquo",171],["not",172],["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],["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]],l=[["nbsp",160],["thinsp",8201],["ensp",8194],["emsp",8195],["shy",173],["zwnj",8204],["zwj",8205],["lrm",8206],["rlm",8207]],c=new(function(){function e(){n(this,e),this._entities=this._prepareEntities([].concat(t,l)),this._entitiesByName={},this._entitiesByNameEntity={},this._entitiesByDigitEntity={},this._entitiesByUtf={},this._entities.forEach(function(e){this._entitiesByName[e.name]=e,this._entitiesByNameEntity[e.nameEntity]=e,this._entitiesByDigitEntity[e.digitEntity]=e,this._entitiesByUtf[e.utf]=e},this),this._invisibleEntities=this._prepareEntities(l)}return i(e,[{key:"toUtf",value:function(e){var n=this;-1!==e.text.search(/&#/)&&(e.text=this.decHexToUtf(e.text)),-1!==e.text.search(/&[a-z]/i)&&(e.text=e.text.replace(/&[a-z\d]{2,31};/gi,function(e){var t=n._entitiesByNameEntity[e];return t?t.utf:e}))}},{key:"decHexToUtf",value:function(e){return e.replace(/&#(\d{1,6});/gi,function(e,t){return String.fromCharCode(parseInt(t,10))}).replace(/&#x([\da-f]{1,6});/gi,function(e,t){return String.fromCharCode(parseInt(t,16))})}},{key:"restore",value:function(e){var t=e.prefs.htmlEntity,n=t.type,r=this._entities;"name"!==n&&"digit"!==n||((t.onlyInvisible||t.list)&&(r=[],t.onlyInvisible&&(r=r.concat(this._invisibleEntities)),t.list&&(r=r.concat(this._prepareListParam(t.list)))),e.text=this._restoreEntitiesByIndex(e.text,n+"Entity",r))}},{key:"getByUtf",value:function(e,t){var n="";switch(t){case"digit":n=this._entitiesByDigitEntity[e];break;case"name":n=this._entitiesByNameEntity[e];break;default:n=e}return n}},{key:"_prepareEntities",value:function(e){var r=[];return e.forEach(function(e){var t=s(e,2),n=t[0],e=t[1],t=String.fromCharCode(e);r.push({name:n,nameEntity:"&"+n+";",digitEntity:"&#"+e+";",utf:t,reName:new RegExp("&"+n+";","g"),reUtf:new RegExp(t,"g")})},this),r}},{key:"_prepareListParam",value:function(e){var t=[];return e.forEach(function(e){e=this._entitiesByName[e];e&&t.push(e)},this),t}},{key:"_restoreEntitiesByIndex",value:function(t,n,e){return e.forEach(function(e){t=t.replace(e.reUtf,e[n])}),t}}]),e}()),h=[];function p(e){e=(e||"").split("/")[0];e&&"common"!==e&&!g(e)&&(h.push(e),h.sort())}function e(){return h}function g(e){return"common"===e||-1!==h.indexOf(e)}function f(e,t){e=e||t,t=e;return Array.isArray(e)||(t=[e]),t}var d={};function m(e){return d[e]}function $(t,e){"string"==typeof t?(p(t),d[t]=e):"object"===a(t)&&Object.keys(t).forEach(function(e){p(e),d[e]=t[e]})}var v=["a","abbr","acronym","b","bdo","big","br","button","cite","code","dfn","em","i","img","input","kbd","label","map","object","q","samp","script","select","small","span","strong","sub","sup","textarea","time","tt","var"],b=new RegExp("(https?|file|ftp)://([a-zA-Z0-9/+-=%&:_.~?]+[a-zA-Z0-9#+]*)","g"),x="\\d+([.,]\\d+)?",y="\uf000",R="\uf001",E=function(){function e(){n(this,e);var t=[["\x3c!--","--\x3e"],["<!ENTITY",">"],["<!DOCTYPE",">"],["<\\?xml","\\?>"],["<!\\[CDATA\\[","\\]\\]>"]];["code","kbd","object","pre","samp","script","style","var"].forEach(function(e){t.push(["<"+e+"(\\s[^>]*?)?>","</"+e+">"])},this),this._tags={own:[],html:t.map(this._prepareRegExp),url:[b]},this._groups=["own","html","url"]}return i(e,[{key:"add",value:function(e){this._tags.own.push(this._prepareRegExp(e))}},{key:"show",value:function(t,n){for(var e=new RegExp("\uf000tf\\d+\uf000","g"),r=new RegExp("\uf000tf\\d"),a=function(e){return t.safeTags.hidden[n][e]||e},i=0,s=this._tags[n].length;i<s&&(t.text=t.text.replace(e,a),-1!==t.text.search(r));i++);}},{key:"hide",value:function(t,e){t.safeTags=t.safeTags||{hidden:{},i:0},t.safeTags.hidden[e]={};var n=this._pasteLabel.bind(this,t,e);this._tags[e].forEach(function(e){t.text=t.text.replace(this._prepareRegExp(e),n)},this)}},{key:"hideHTMLTags",value:function(e){var t;e.isHTML&&(t=this._pasteLabel.bind(this,e,"html"),e.text=e.text.replace(/<\/?[a-z][^]*?>/gi,t).replace(/&lt;\/?[a-z][^]*?&gt;/gi,t).replace(/&[gl]t;/gi,t))}},{key:"getPrevLabel",value:function(e,t){for(var n=t-1;0<=n;n--)if(e[n]===y)return e.slice(n,t+1);return!1}},{key:"getNextLabel",value:function(e,t){for(var n=t+1;n<e.length;n++)if(e[n]===y)return e.slice(t,n+1);return!1}},{key:"getTagByLabel",value:function(n,r){var a=!1;return this._groups.some(function(e){var t=n.safeTags.hidden[e][r];return void 0!==t&&(a={group:e,value:t}),a}),a}},{key:"getTagInfo",value:function(e){if(e){var t={group:e.group};switch(e.group){case"html":t.name=e.value.split(/[<\s>]/)[1],t.isInline=-1<v.indexOf(t.name),t.isClosing=-1<e.value.search(/^<\//);break;case"url":t.isInline=!0;break;case"own":t.isInline=!1}return t}}},{key:"_pasteLabel",value:function(e,t,n){var r=e.safeTags,e="\uf000tf"+r.i+y;return r.hidden[t][e]=n,r.i++,e}},{key:"_prepareRegExp",value:function(e){var t,n=e instanceof RegExp?e:(e=(t=s(e,3))[0],n=t[1],void 0===(t=t[2])&&(t="[^]*?"),new RegExp(e+t+n,"gi"));return n}}]),e}();function _(e,t){for(var n="";1==(1&t)&&(n+=e),0!==(t>>>=1);)e+=e;return n}function w(e){return e.replace(/\u00A0/g," ")}function k(e,t){for(var n=0;n<t.length;n++)e=e.replace(t[n][0],t[n][1]);return e}function q(e){return-1!==e.search(/(<\/?[a-z]|<!|&[lg]t;)/i)}function A(e){return"object"===a(e)?JSON.parse(JSON.stringify(e)):e}var T=function(){function t(e){n(this,t),this._prefs="object"===a(e)?e:{},this._prefs.locale=f(this._prefs.locale),this._prefs.live=this._prefs.live||!1,this._safeTags=new E,this._settings={},this._enabledRules={},this._innerRulesByQueues={},this._innerRules=[].concat(this._innerRules),this._innerRules.forEach(function(e){var t=e.queue||"default";this._innerRulesByQueues[t]=this._innerRulesByQueues[t]||[],this._innerRulesByQueues[t].push(e)},this),this._rulesByQueues={},this._rules=[].concat(this._rules),this._rules.forEach(function(e){var t=e.queue||"default";this._prepareRule(e),this._rulesByQueues[t]=this._rulesByQueues[t]||[],this._rulesByQueues[t].push(e)},this),this._prefs.disableRule&&this.disableRule(this._prefs.disableRule),this._prefs.enableRule&&this.enableRule(this._prefs.enableRule),this._separatePartsTags=["title","p","h[1-6]","select","legend"]}return i(t,[{key:"execute",value:function(e,t){if(!(e=""+e))return"";e=this._prepareContext(e);return this._preparePrefs(e,t),this._process(e)}},{key:"_prepareContext",value:function(e){return{text:e,isHTML:q(e),prefs:A(this._prefs),getData:function(t){return"char"===t?this.prefs.locale.map(function(e){return m(e+"/"+t)}).join(""):m(this.prefs.locale[0]+"/"+t)}}}},{key:"_preparePrefs",value:function(e,t){t=t||{};for(var n=e.prefs,r=0,a=["htmlEntity","lineEnding","processingSeparateParts","ruleFilter"];r<a.length;r++){var i=a[r];i in t?n[i]=t[i]:i in this._prefs&&(n[i]=this._prefs[i])}n.htmlEntity=n.htmlEntity||{},n.locale=f(t.locale,this._prefs.locale);var s=n.locale,e=s[0];if(!s.length||!e)throw Error('Not defined the property "locale".');if(!g(e))throw Error('"'+e+'" is not supported locale.')}},{key:"_splitBySeparateParts",value:function(a){if(!a.isHTML||!1===a.prefs.processingSeparateParts)return[a.text];var i=[],e=new RegExp("<("+this._separatePartsTags.join("|")+")(\\s[^>]*?)?>[^]*?</\\1>","gi"),s=0;return a.text.replace(e,function(e,t,n,r){return s!==r&&i.push((s?R:"")+a.text.slice(s,r)+R),i.push(e),s=r+e.length,e}),i.push(s?R+a.text.slice(s,a.text.length):a.text),i}},{key:"_process",value:function(t){var n=this;t.text=t.text.replace(/\r\n?/g,"\n"),this._executeRules(t,"start"),this._safeTags.hide(t,"own"),this._executeRules(t,"hide-safe-tags-own"),this._safeTags.hide(t,"html"),this._executeRules(t,"hide-safe-tags-html");var e,r=t.isHTML,a=new RegExp(R,"g");return t.text=this._splitBySeparateParts(t).map(function(e){return t.text=e,t.isHTML=q(e),n._safeTags.hideHTMLTags(t),n._safeTags.hide(t,"url"),n._executeRules(t,"hide-safe-tags-url"),n._executeRules(t,"hide-safe-tags"),c.toUtf(t),n._prefs.live&&(t.text=w(t.text)),n._executeRules(t,"utf"),n._executeRules(t),c.restore(t),n._executeRules(t,"html-entities"),n._safeTags.show(t,"url"),n._executeRules(t,"show-safe-tags-url"),t.text.replace(a,"")}).join(""),t.isHTML=r,this._safeTags.show(t,"html"),this._executeRules(t,"show-safe-tags-html"),this._safeTags.show(t,"own"),this._executeRules(t,"show-safe-tags-own"),this._executeRules(t,"end"),e=t.text,"CRLF"===(r=t.prefs.lineEnding)?e.replace(/\n/g,"\r\n"):"CR"===r?e.replace(/\n/g,"\r"):e}},{key:"getSetting",value:function(e,t){return this._settings[e]&&this._settings[e][t]}},{key:"setSetting",value:function(e,t,n){return this._settings[e]=this._settings[e]||{},this._settings[e][t]=n,this}},{key:"isEnabledRule",value:function(e){return this._enabledRules[e]}},{key:"isDisabledRule",value:function(e){return!this._enabledRules[e]}},{key:"enableRule",value:function(e){return this._enable(e,!0)}},{key:"disableRule",value:function(e){return this._enable(e,!1)}},{key:"addSafeTag",value:function(e,t,n){n=e instanceof RegExp?e:[e,t,n];return this._safeTags.add(n),this}},{key:"_executeRules",value:function(t,e){e=e||"default";var n=this._rulesByQueues[e],e=this._innerRulesByQueues[e];e&&e.forEach(function(e){this._ruleIterator(t,e)},this),n&&n.forEach(function(e){this._ruleIterator(t,e)},this)}},{key:"_ruleIterator",value:function(e,t){var n=t._locale,r=this._prefs.live;!0===r&&!1===t.live||!1===r&&!0===t.live||"common"!==n&&n!==e.prefs.locale[0]||!this.isEnabledRule(t.name)||e.prefs.ruleFilter&&!e.prefs.ruleFilter(t)||(this._onBeforeRule&&this._onBeforeRule(t.name,e.text,e),e.text=t.handler.call(this,e.text,this._settings[t.name],e),this._onAfterRule&&this._onAfterRule(t.name,e.text,e))}},{key:"_prepareRule",value:function(e){var t=e.name,n=a(e.settings),r={};"object"===n?r=A(e.settings):"function"===n&&(r=e.settings(e)),this._settings[t]=r,this._enabledRules[t]=e._enabled}},{key:"_enable",value:function(e,t){return Array.isArray(e)?e.forEach(function(e){this._enableByMask(e,t)},this):this._enableByMask(e,t),this}},{key:"_enableByMask",value:function(e,t){var n;e&&(-1!==e.search(/\*/)?(n=new RegExp(e.replace(/\//g,"\\/").replace(/\*/g,".*")),this._rules.forEach(function(e){e=e.name;n.test(e)&&(this._enabledRules[e]=t)},this)):this._enabledRules[e]=t)}},{key:"_getRule",value:function(t){var n=null;return this._rules.some(function(e){return e.name===t&&(n=e,!0)}),n}}],[{key:"addRule",value:function(e){var t=s(e.name.split("/"),3),n=t[0],r=t[1],t=t[2];return e._enabled=!0!==e.disabled,e._locale=n,e._group=r,e._name=t,this.addLocale(e._locale),this._setIndex(e),this.prototype._rules.push(e),this._sortRules(this.prototype._rules),this}},{key:"addRules",value:function(e){var t=this;return e.forEach(function(e){t.addRule(e)}),this}},{key:"addInnerRule",value:function(e){return this.prototype._innerRules.push(e),e._locale=e.name.split("/")[0],this}},{key:"addInnerRules",value:function(e){var t=this;return e.forEach(function(e){t.addInnerRule(e)}),this}},{key:"_setIndex",value:function(e){var t=e.index,n=a(t),r=o[e._group];"undefined"===n?t=r:"string"===n&&(t=(r||0)+parseInt(e.index,10)),e._index=t}},{key:"_sortRules",value:function(e){e.sort(function(e,t){return e._index>t._index?1:-1})}}]),t}();T.version="6.11.3",T.addLocale=p,T.getLocales=e,T.hasLocale=g,T.setData=$,T.getData=m,T.deepCopy=A,T.prototype._rules=[],T.prototype._innerRules=[];[{"common/char":"a-z","common/dash":"--?|\u2012|\u2013|\u2014","common/quote":'\xab\u2039\xbb\u203a\u201e\u201c\u201f\u201d"'},{"be/char":"\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0439\u043a\u043b\u043c\u043d\u043e\u043f\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u044b\u044c\u044d\u044e\u044f\u0451\u0456\u045e\u0491","be/quote":{left:"\xab\u201c",right:"\xbb\u201d"}},{"bg/char":"\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u0439\u043a\u043b\u043c\u043d\u043e\u043f\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044a\u044c\u044e\u044f","bg/quote":{left:"\u201e\u2019",right:"\u201c\u2019"}},{"ca/char":"abcdefghijlmnopqrstuvxyz\xe0\xe7\xe8\xe9\xed\xef\xf2\xf3\xfa\xfc","ca/quote":{left:"\xab\u201c",right:"\xbb\u201d"}},{"da/char":"a-z\xe5\xe6\xf8","da/quote":{left:"\xbb\u203a",right:"\xab\u2039"}},{"de/char":"a-z\xdf\xe4\xf6\xfc","de/quote":{left:"\u201e\u201a",right:"\u201c\u2018"}},{"el/char":"\u0390\u03ac\u03ad\u03ae\u03af\u03b0\u03b1\u03b2\u03b3\u03b4\u03b5\u03b6\u03b7\u03b8\u03b9\u03ba\u03bb\u03bc\u03bd\u03be\u03bf\u03c0\u03c1\u03c2\u03c3\u03c4\u03c5\u03c6\u03c7\u03c8\u03c9\u03ca\u03cb\u03cc\u03cd\u03ce\u03f2\u1f71\u1f73\u1f75\u1f77\u1f79\u1f7b\u1f7d","el/quote":{left:"\xab\u201c",right:"\xbb\u201d"}},{"en-GB/char":"a-z","en-GB/quote":{left:"\u2018\u201c",right:"\u2019\u201d"}},{"en-US/char":"a-z","en-US/quote":{left:"\u201c\u2018",right:"\u201d\u2019"}},{"eo/char":"abcdefghijklmnoprstuvz\u0109\u011d\u0125\u0135\u015d\u016d","eo/quote":{left:"\u201c\u2018",right:"\u201d\u2019"}},{"es/char":"a-z\xe1\xe9\xed\xf1\xf3\xfa\xfc","es/quote":{left:"\xab\u201c",right:"\xbb\u201d"}},{"et/char":"abdefghijklmnoprstuvz\xe4\xf5\xf6\xfc\u0161\u017e","et/quote":{left:"\u201e\xab",right:"\u201c\xbb"}},{"fi/char":"abcdefghijklmnopqrstuvy\xf6\xe4\xe5","fi/quote":{left:"\u201d\u2019",right:"\u201d\u2019"}},{"fr/char":"a-z\xe0\xe2\xe7\xe8\xe9\xea\xeb\xee\xef\xf4\xfb\xfc\u0153\xe6","fr/quote":{left:"\xab\u2039",right:"\xbb\u203a",spacing:!0}},{"ga/char":"abcdefghilmnoprstuvwxyz\xe1\xe9\xed\xf3\xfa","ga/quote":{left:"\u201c\u2018",right:"\u201d\u2019"}},{"hu/char":"a-z\xe1\xe4\xe9\xed\xf3\xf6\xfa\xfc\u0151\u0171","hu/quote":{left:"\u201e\xbb",right:"\u201d\xab"}},{"it/char":"a-z\xe0\xe9\xe8\xec\xf2\xf9","it/quote":{left:"\xab\u201c",right:"\xbb\u201d"}},{"lv/char":"abcdefghijklmnopqrstuvxz\xe6\u0153","lv/quote":{left:"\xab\u201e",right:"\xbb\u201c"}},{"nl/char":"a-z\xe4\xe7\xe8\xe9\xea\xeb\xee\xef\xf1\xf6\xfb\xfc","nl/quote":{left:"\u2018\u201c",right:"\u2019\u201d"}},{"no/char":"a-z\xe5\xe6\xe8\xe9\xea\xf2\xf3\xf4\xf8","no/quote":{left:"\xab\u2019",right:"\xbb\u2019"}},{"pl/char":"abcdefghijklmnoprstuvwxyz\xf3\u0105\u0107\u0119\u0142\u0144\u015b\u017a\u017c","pl/quote":{left:"\u201e\xab",right:"\u201d\xbb"}},{"ro/char":"abcdefghijklmnoprstuvxz\xee\u0103\u0219\u021b","ro/quote":{left:"\u201e\xab",right:"\u201d\xbb"}},{"ru/char":"\u0430-\u044f\u0451","ru/dashBefore":"(^| |\\n)","ru/dashAfter":"(?=[\xa0 ,.?:!]|$)","ru/dashAfterDe":"(?=[,.?:!]|[\xa0 ][^\u0410-\u042f\u0401]|$)","ru/l":"\u0430-\u044f\u0451a-z","ru/L":"\u0410-\u042f\u0401A-Z","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/quote":{left:"\xab\u201e\u201a",right:"\xbb\u201c\u2018",removeDuplicateQuotes:!0},"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","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"},{"sk/char":"abcdefghijklmnoprstuvwxyz\xe1\xe4\xe9\xed\xf3\xf4\xfa\xfd\u010d\u010f\u013e\u0148\u0155\u0161\u0165\u017e","sk/quote":{left:"\u201e\u201a",right:"\u201c\u2018"}},{"sl/char":"a-z\u010d\u0161\u017e","sl/quote":{left:"\u201e\u201a",right:"\u201c\u2018"}},{"sr/char":"abcdefghijklmnoprstuvz\u0107\u010d\u0111\u0161\u017e","sr/quote":{left:"\u201e\u2019",right:"\u201d\u2019"}},{"sv/char":"a-z\xe4\xe5\xe9\xf6","sv/quote":{left:"\u201d\u2019",right:"\u201d\u2019"}},{"tr/char":"abcdefghijklmnoprstuvyz\xe2\xe7\xee\xf6\xfb\xfc\u011f\u0131\u015f","tr/quote":{left:"\u201c\u2018",right:"\u201d\u2019"}},{"uk/char":"\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u0439\u043a\u043b\u043c\u043d\u043e\u043f\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044c\u044e\u044f\u0454\u0456\u0457\u0491","uk/quote":{left:"\xab\u201e",right:"\xbb\u201c"}}].forEach(function(e){return $(e)});var B=["address","article","aside","blockquote","canvas","dd","div","dl","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","li","main","nav","noscript","ol","output","p","pre","section","table","tfoot","ul","video"],L={name:"common/html/p",index:"+5",queue:"end",handler:function(e){var r=new RegExp("<("+B.join("|")+")[>\\s]"),e=e.split("\n\n");return e.forEach(function(e,t,n){e.trim()&&(r.test(e)||(n[t]=e.replace(/^(\s*)/,"$1<p>").replace(/(\s*)$/,"</p>$1")))}),e.join("\n\n")},disabled:!0,htmlAttrs:!1},S={name:"common/html/processingAttrs",queue:"hide-safe-tags-own",handler:function(e,t,n){var s=this,r=new RegExp("(^|\\s)("+t.attrs.join("|")+")=(\"[^\"]*?\"|'[^']*?')","gi"),u=A(n.prefs);return u.ruleFilter=function(e){return!1!==e.htmlAttrs},e.replace(/(<[-\w]+\s)([^>]+?)(?=>)/g,function(e,t,n){return t+n.replace(r,function(e,t,n,r){var a=r[0],i=r[r.length-1],r=r.slice(1,-1);return t+n+"="+a+s.execute(r,u)+i})})},settings:{attrs:["title","placeholder"]},disabled:!0,htmlAttrs:!1},D={name:"common/html/url",queue:"end",handler:function(e,t,n){return n.isHTML?e:e.replace(b,function(e,t,n){n=n.replace(/([^/]+\/?)(\?|#)$/,"$1").replace(/^([^/]+)\/$/,"$1"),"http"===t?n=n.replace(/^([^/]+)(:80)([^\d]|\/|$)/,"$1$3"):"https"===t&&(n=n.replace(/^([^/]+)(:443)([^\d]|\/|$)/,"$1$3"));var r=n,a=t+"://"+n,n='<a href="'+a+'">';return"http"===t||"https"===t?(r=r.replace(/^www\./,""),n+("http"===t?r:t+"://"+r)+"</a>"):n+a+"</a>"})},disabled:!0,htmlAttrs:!1};T.addRules([{name:"common/html/e-mail",queue:"end",handler:function(e,t,n){return n.isHTML?e:e.replace(/(^|[\s;(])([\w\-.]{2,64})@([\w\-.]{2,64})\.([a-z]{2,64})([)\s.,!?]|$)/gi,'$1<a href="mailto:$2@$3.$4">$2@$3.$4</a>$5')},disabled:!0,htmlAttrs:!1},{name:"common/html/escape",index:"+100",queue:"end",handler:function(e){var t={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};return e.replace(/[&<>"'/]/g,function(e){return t[e]})},disabled:!0},{name:"common/html/nbr",index:"+10",queue:"end",handler:function(e){return e.replace(/([^\n>])\n(?=[^\n])/g,"$1<br/>\n")},disabled:!0,htmlAttrs:!1},L,S,{name:"common/html/quot",queue:"hide-safe-tags",handler:function(e){return e.replace(/&quot;/g,'"')}},{name:"common/html/stripTags",index:"+99",queue:"end",handler:function(e){return e.replace(/<[^>]+>/g,"")},disabled:!0},D]);var I={name:"common/nbsp/afterNumber",handler:function(e,t,n){n="(^|\\D)(\\d{1,5}) (["+n.getData("char")+"]+)";return e.replace(new RegExp(n,"gi"),"$1$2\xa0$3")},disabled:!0},z={name:"common/nbsp/afterShortWord",handler:function(e,t,n){t=t.lengthShortWord,t="(^|["+(" \xa0(\uf000"+d["common/quote"])+"])(["+n.getData("char")+"]{1,"+t+"}) ",t=new RegExp(t,"gim");return e.replace(t,"$1$2\xa0").replace(t,"$1$2\xa0")},settings:{lengthShortWord:2}},C={name:"common/nbsp/beforeShortLastNumber",handler:function(e,t,n){var r=n.getData("char"),a=r.toUpperCase(),a=new RegExp("(["+r+a+"]) (?=\\d{1,"+t.lengthLastNumber+"}[-+\u2212%'\""+n.getData("quote").right+")]?([.!?\u2026]( ["+a+"]|$)|$))","gm");return e.replace(a,"$1\xa0")},live:!1,settings:{lengthLastNumber:2}},j={name:"common/nbsp/beforeShortLastWord",handler:function(e,t,n){var r=n.getData("char"),n=r.toUpperCase(),n=new RegExp("(["+r+"\\d]) (["+r+n+"]{1,"+t.lengthLastWord+"}[.!?\u2026])( ["+n+"]|$)","g");return e.replace(n,"$1\xa0$2$3")},settings:{lengthLastWord:3}};function P(e,t,n,r){return t+n.replace(/([^\u00A0])\u00A0([^\u00A0])/g,"$1 $2")+r}var N={name:"common/nbsp/nowrap",queue:"end",handler:function(e){return e.replace(/(<nowrap>)(.*?)(<\/nowrap>)/g,P).replace(/(<nobr>)(.*?)(<\/nobr>)/g,P)}},O={name:"common/nbsp/replaceNbsp",queue:"utf",live:!1,handler:w,disabled:!0};T.addRules([I,{name:"common/nbsp/afterParagraphMark",handler:function(e){return e.replace(/\xb6 ?(?=\d)/g,"\xb6\xa0")}},{name:"common/nbsp/afterSectionMark",handler:function(e,t,n){n=n.prefs.locale[0];return e.replace(/\xa7[ \u00A0\u2009]?(?=\d|I|V|X)/g,"ru"===n?"\xa7\u202f":"\xa7\xa0")}},z,C,j,{name:"common/nbsp/dpi",handler:function(e){return e.replace(/(\d) ?(lpi|dpi)(?!\w)/,"$1\xa0$2")}},N,O]);var U={name:"common/number/digitGrouping",index:"310",disabled:!0,handler:function(e,a){return e.replace(new RegExp("(^ ?|\\D |".concat(y,")(\\d{1,3}([ \xa0\u202f\u2009]\\d{3})+)(?! ?[\\d-])"),"gm"),function(e,t,n){return t+n.replace(/\s/g,a.space)}).replace(/(\d{5,}([.,]\d+)?)/g,function(e,t){var n=t.match(/[.,]/),r=s(n?t.split(n):[t],2),t=r[0],r=r[1],t=t.replace(/(\d)(?=(\d{3})+([^\d]|$))/g,"$1"+a.space);return n?t+n+r:t})},settings:{space:"\u202f"}},M={name:"common/number/mathSigns",handler:function(e){return k(e,[[/!=/g,"\u2260"],[/<=/g,"\u2264"],[/(^|[^=])>=/g,"$1\u2265"],[/<=>/g,"\u21d4"],[/<</g,"\u226a"],[/>>/g,"\u226b"],[/~=/g,"\u2245"],[/(^|[^+])\+-/g,"$1\xb1"]])}};T.addRules([U,{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")}},M,{name:"common/number/times",handler:function(e){return e.replace(/(\d)[ \u00A0]?[x\u0445][ \u00A0]?(\d)/g,"$1\xd7$2")}}]);var Q={name:"common/other/repeatWord",handler:function(e,t,n){var r="[;:,.?! \n"+d["common/quote"]+"]",r=new RegExp("("+r+"|^)(["+n.getData("char")+"]{"+t.min+",}) \\2("+r+"|$)","gi");return e.replace(r,"$1$2$3")},settings:{min:2},disabled:!0};T.addRules([{name:"common/other/delBOM",queue:"start",index:-1,handler:function(e){return 65279===e.charCodeAt(0)?e.slice(1):e}},Q]);var H={name:"common/punctuation/apostrophe",handler:function(e,t,n){n="(["+n.getData("char")+"])",n=new RegExp(n+"'"+n,"gi");return e.replace(n,"$1\u2019$2")}},F={bufferQuotes:{left:"\uf005\uf006\uf007",right:"\uf008\uf009\uf0a0"},maxLevel:3,beforeLeft:" \n\t\xa0[(",afterRight:" \n\t\xa0!?.:;#*,\u2026)\\]",process:function(e){var t=e.context.text;if(!this.count(t).total)return t;var n=e.settings,r=e.settings.left[0]===e.settings.right[0];return r&&(e.settings=A(e.settings),e.settings.left=this.bufferQuotes.left.slice(0,e.settings.left.length),e.settings.right=this.bufferQuotes.right.slice(0,e.settings.right.length)),e.settings.spacing&&(t=this.removeSpacing(t,e.settings)),t=this.set(t,e),e.settings.spacing&&(t=this.setSpacing(t,e.settings)),e.settings.removeDuplicateQuotes&&(t=this.removeDuplicates(t,e.settings)),r&&(t=this.returnOriginalQuotes(t,n,e.settings),e.settings=n),t},returnOriginalQuotes:function(e,t,n){for(var r={},a=0;a<n.left.length;a++)r[n.left[a]]=t.left[a],r[n.right[a]]=t.right[a];return e.replace(new RegExp("["+n.left+n.right+"]","g"),function(e){return r[e]})},count:function(e){var t={total:0};return e.replace(new RegExp("["+d["common/quote"]+"]","g"),function(e){return t[e]||(t[e]=0),t[e]++,t.total++,e}),t},removeDuplicates:function(e,t){var n=t.left[0],r=t.left[1]||n,t=t.right[0];return n!==r?e:e.replace(new RegExp(n+n,"g"),n).replace(new RegExp(t+t,"g"),t)},removeSpacing:function(e,t){for(var n=0,r=t.left.length;n<r;n++){var a=t.left[n],i=t.right[n];e=e.replace(new RegExp(a+"([ \u202f\xa0])","g"),a).replace(new RegExp("([ \u202f\xa0])"+i,"g"),i)}return e},setSpacing:function(e,t){for(var n=0,r=t.left.length;n<r;n++){var a=t.left[n],i=t.right[n];e=e.replace(new RegExp(a+"([^\u202f])","g"),a+"\u202f$1").replace(new RegExp("([^\u202f])"+i,"g"),"$1\u202f"+i)}return e},set:function(e,t){var n=d["common/quote"],r=t.settings.left[0],a=t.settings.left[1]||r,i=t.settings.right[0],s=new RegExp("(^|["+this.beforeLeft+"])(["+n+"]{1,"+this.maxLevel+"})(?=[^\\s"+y+"])","gim"),n=new RegExp("([^\\s\uf000])(["+n+"]{1,"+this.maxLevel+"})(?=["+this.afterRight+"]|$)","gim");return e=e.replace(s,function(e,t,n){return t+_(r,n.length)}).replace(n,function(e,t,n){return t+_(i,n.length)}),e=this.setAboveTags(e,t),r!==a&&(e=this.setInner(e,t.settings)),e},setAboveTags:function(s,u){var o=this,e=d["common/quote"],l=u.settings.left[0],c=u.settings.right[0];return s.replace(new RegExp("(^|.)(["+e+"])(.|$)","gm"),function(e,t,n,r,a){if(t!==y&&r!==y)return e;if(t===y&&r===y)return'"'===n?t+o.getAboveTwoTags(s,a+1,u)+r:e;if(t===y){var i=-1<o.afterRight.indexOf(r),e=o.getPrevTagInfo(s,a-1,u);return i&&e&&"html"===e.group?t+(e.isClosing?c:l)+r:t+(!r||i?c:l)+r}i=-1<o.beforeLeft.indexOf(t),a=o.getNextTagInfo(s,a+1,u);return i&&a&&"html"===a.group?t+(a.isClosing?c:l)+r:t+(!t||i?l:c)+r})},getAboveTwoTags:function(e,t,n){var r=this.getPrevTagInfo(e,t,n),a=this.getNextTagInfo(e,t,n);if(r&&"html"===r.group){if(!r.isClosing)return n.settings.left[0];if(a&&a.isClosing&&r.isClosing)return n.settings.right[0]}return e[t]},getPrevTagInfo:function(e,t,n){t=n.safeTags.getPrevLabel(e,t-1);if(t){t=n.safeTags.getTagByLabel(n.context,t);if(t)return n.safeTags.getTagInfo(t)}return null},getNextTagInfo:function(e,t,n){t=n.safeTags.getNextLabel(e,t+1);if(t){t=n.safeTags.getTagByLabel(n.context,t);if(t)return n.safeTags.getTagInfo(t)}return null},setInner:function(e,t){for(var n=[],r=[],a=0;a<t.left.length;a++)n.push(t.left[a]),r.push(t.right[a]);for(var i=t.left[0],s=t.right[0],u=n.length-1,o=-1,l="",c=0,h=e.length;c<h;c++){var p=e[c];p===i?(u<++o&&(o=u),l+=n[o]):p===s?o<=-1?l+=r[o=0]:(l+=r[o],--o<-1&&(o=-1)):('"'===p&&(o=-1),l+=p)}var g=this.count(l,t);return g[i]!==g[s]?e:l}},G={name:"common/punctuation/quote",handler:function(e,t,n){t=t[n.prefs.locale[0]];return t?F.process({context:n,settings:t,safeTags:this._safeTags}):e},settings:function(){var t={};return h.forEach(function(e){t[e]=A(m(e+"/quote"))}),t}},W={name:"common/punctuation/quoteLink",queue:"show-safe-tags-html",index:"+5",handler:function(e,t,n){var r=this.getSetting("common/punctuation/quote",n.prefs.locale[0]);if(!r)return e;var a=c.getByUtf(r.left[0]),i=c.getByUtf(r.right[0]),n=(n=c.getByUtf(r.left[1]))?"|"+n:"",r=(r=c.getByUtf(r.right[1]))?"|"+r:"",r=new RegExp("(<[aA]\\s[^>]*?>)("+a+n+")([^]*?)("+i+r+")(</[aA]>)","g");return e.replace(r,"$2$1$3$5$4")}};T.addRules([H,{name:"common/punctuation/delDoublePunctuation",handler:function(e){return e.replace(/(^|[^,]),,(?!,)/g,"$1,").replace(/(^|[^:])::(?!:)/g,"$1:").replace(/(^|[^!?.])\.\.(?!\.)/g,"$1.").replace(/(^|[^;]);;(?!;)/g,"$1;").replace(/(^|[^?])\?\?(?!\?)/g,"$1?")}},{name:"common/punctuation/hellip",handler:function(e,t,n){return"ru"===n.prefs.locale[0]?e.replace(/(^|[^.])\.{3,4}(?=[^.]|$)/g,"$1\u2026"):e.replace(/(^|[^.])\.{3}(\.?)(?=[^.]|$)/g,"$1\u2026$2")}},G,W]);var X={name:"common/space/afterPunctuation",handler:function(e){var t=new RegExp("(!|;|\\?)([^).\u2026!;?\\s[\\])\uf000"+d["common/quote"]+"])","g"),n=new RegExp('(\\D)(,|:)([^)",:.?\\s\\/\\\\\uf000])',"g");return e.replace(t,"$1 $2").replace(n,"$1$2 $3")}},V={name:"common/space/beforeBracket",handler:function(e,t,n){n=new RegExp("(["+n.getData("char")+".!?,;\u2026)])\\(","gi");return e.replace(n,"$1 (")}},L={name:"common/space/delRepeatN",index:"-1",handler:function(e,t){var n=t.maxConsecutiveLineBreaks,t=new RegExp("\n{".concat(n+1,",}"),"g"),n=_("\n",n);return e.replace(t,n)},settings:{maxConsecutiveLineBreaks:2}},S={name:"common/space/trimLeft",index:"-4",handler:String.prototype.trimLeft?function(e){return e.trimLeft()}:function(e){return e.replace(/^[\s\uFEFF\xA0]+/g,"")}},D={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,"")}};T.addRules([X,V,{name:"common/space/bracket",handler:function(e){return e.replace(/(\() +/g,"(").replace(/ +\)/g,")")}},{name:"common/space/delBeforePercent",handler:function(e){return e.replace(/(\d)( |\u00A0)(%|\u2030|\u2031)/g,"$1$3")}},{name:"common/space/delBeforePunctuation",handler:function(e){return e.replace(/([!?]) (?=[!?])/g,"$1").replace(/(^|[^!?:;,.\u2026]) ([!?:;,.])(?!\))/g,"$1$2")}},{name:"common/space/delLeadingBlanks",handler:function(e){return e.replace(/^[ \t]+/gm,"")},disabled:!0},L,{name:"common/space/delRepeatSpace",index:"-1",handler:function(e){return e.replace(/([^\n \t])[ \t]{2,}(?![\n \t])/g,"$1 ")}},{name:"common/space/delTrailingBlanks",index:"-3",handler:function(e){return e.replace(/[ \t]+\n/g,"\n")}},{name:"common/space/insertFinalNewline",live:!1,disabled:!0,queue:"end",handler:function(e){return"\n"===e[e.length-1]?e:e+"\n"}},{name:"common/space/replaceTab",index:"-5",handler:function(e){return e.replace(/\t/g,"    ")}},{name:"common/space/squareBracket",handler:function(e){return e.replace(/(\[) +/g,"[").replace(/ +\]/g,"]")}},S,D]);I={name:"common/symbols/arrow",handler:function(e){return k(e,[[/(^|[^-])->(?!>)/g,"$1\u2192"],[/(^|[^<])<-(?!-)/g,"$1\u2190"]])}},z={name:"common/symbols/cf",handler:function(e){var t=new RegExp('(^|[\\s(\\[+\u2248\xb1\u2212\u2014\u2013\\-])(\\d+(?:[.,]\\d+)?)[ \xa0\u2009]?(C|F)([\\W\\s.,:!?")\\]]|$)',"mg");return e.replace(t,"$1$2\u2009\xb0$3$4")}},C={name:"common/symbols/copy",handler:function(e){return k(e,[[/\(r\)/gi,"\xae"],[/(copyright )?\((c|\u0441)\)/gi,"\xa9"],[/\(tm\)/gi,"\u2122"]])}};T.addRules([I,z,C]);j={name:"en-US/dash/main",index:"-5",handler:function(e){var t=d["common/dash"],n="[ ".concat("\xa0","]"),r="[ ".concat("\xa0","\n]"),r=new RegExp("".concat(n,"(").concat(t,")(").concat(r,")"),"g");return e.replace(r,"".concat("\xa0").concat("\u2014","$2"))}};T.addRules([j]);N={name:"ru/dash/centuries",handler:function(e,t){var n="("+d["common/dash"]+")",n=new RegExp("(X|I|V)[ |\xa0]?"+n+"[ |\xa0]?(X|I|V)","g");return e.replace(n,"$1"+t.dash+"$3")},settings:{dash:"\u2013"}},O={name:"ru/dash/daysMonth",handler:function(e,t){var n=new RegExp("(^|\\s)([123]?\\d)("+d["common/dash"]+")([123]?\\d)[ \xa0]("+d["ru/monthGenCase"]+")","g");return e.replace(n,"$1$2"+t.dash+"$4\xa0$5")},settings:{dash:"\u2013"}},U={name:"ru/dash/de",handler:function(e){var t=new RegExp("([a-\u044f\u0451]+) \u0434\u0435"+d["ru/dashAfterDe"],"g");return e.replace(t,"$1-\u0434\u0435")},disabled:!0},M={name:"ru/dash/decade",handler:function(e,t){var n=new RegExp("(^|\\s)(\\d{3}|\\d)0("+d["common/dash"]+")(\\d{3}|\\d)0(-\u0435[ \xa0])(?=\u0433\\.?[ \xa0]?\u0433|\u0433\u043e\u0434)","g");return e.replace(n,"$1$20"+t.dash+"$40$5")},settings:{dash:"\u2013"}},Q={name:"ru/dash/directSpeech",handler:function(e){var t=d["common/dash"],n=new RegExp('(["\xbb\u2018\u201c,])[ |\xa0]?('.concat(t,")[ |\xa0]"),"g"),r=new RegExp("(^|".concat(y,")(").concat(t,")( |\xa0)"),"gm"),t=new RegExp("([.\u2026?!])[ \xa0](".concat(t,")[ \xa0]"),"g");return e.replace(n,"$1\xa0\u2014 ").replace(r,"$1\u2014\xa0").replace(t,"$1 \u2014\xa0")}},H={name:"ru/dash/izpod",handler:function(e){var t=new RegExp(d["ru/dashBefore"]+"(\u0418|\u0438)\u0437 \u043f\u043e\u0434"+d["ru/dashAfter"],"g");return e.replace(t,"$1$2\u0437-\u043f\u043e\u0434")}},G={name:"ru/dash/izza",handler:function(e){var t=new RegExp(d["ru/dashBefore"]+"(\u0418|\u0438)\u0437 \u0437\u0430"+d["ru/dashAfter"],"g");return e.replace(t,"$1$2\u0437-\u0437\u0430")}},W={name:"ru/dash/ka",handler:function(e){var t=new RegExp("([a-\u044f\u0451]+) \u043a\u0430(\u0441\u044c)?"+d["ru/dashAfter"],"g");return e.replace(t,"$1-\u043a\u0430$2")}},X={name:"ru/dash/koe",handler:function(e){var t=new RegExp(d["ru/dashBefore"]+"([\u041a\u043a]\u043e[\u0435\u0439])\\s([\u0430-\u044f\u0451]{3,})"+d["ru/dashAfter"],"g");return e.replace(t,"$1$2-$3")}},V={name:"ru/dash/main",index:"-5",handler:function(e){var t=d["common/dash"],t=new RegExp("([ \xa0])("+t+")([ \xa0\\n])","g");return e.replace(t,"\xa0\u2014$3")}},L={name:"ru/dash/month",handler:function(e,t){var n="("+d["ru/month"]+")",r="("+d["ru/monthPreCase"]+")",a=d["common/dash"],n=new RegExp(n+" ?("+a+") ?"+n,"gi"),r=new RegExp(r+" ?("+a+") ?"+r,"gi"),t="$1"+t.dash+"$3";return e.replace(n,t).replace(r,t)},settings:{dash:"\u2013"}},S={name:"ru/dash/surname",handler:function(e){var t=new RegExp("([\u0410-\u042f\u0401][\u0430-\u044f\u0451]+)\\s-([\u0430-\u044f\u0451]{1,3})(?![^\u0430-\u044f\u0451]|$)","g");return e.replace(t,"$1\xa0\u2014$2")}},D={name:"ru/dash/taki",handler:function(e){var t=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)"+d["ru/dashAfter"],"g");return e.replace(t,"$1-$2")}},I={name:"ru/dash/time",handler:function(e,t){var n=new RegExp(d["ru/dashBefore"]+"(\\d?\\d:[0-5]\\d)"+d["common/dash"]+"(\\d?\\d:[0-5]\\d)"+d["ru/dashAfter"],"g");return e.replace(n,"$1$2"+t.dash+"$3")},settings:{dash:"\u2013"}},z={name:"ru/dash/to",handler:function(e){var t=new RegExp("("+["\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"].join("|")+")( | -|- )(\u0442\u043e|\u043b\u0438\u0431\u043e|\u043d\u0438\u0431\u0443\u0434\u044c)"+d["ru/dashAfter"],"gi");return e.replace(t,"$1-$3")}},C={name:"ru/dash/weekday",handler:function(e,t){var n="("+d["ru/weekday"]+")",n=new RegExp(n+" ?("+d["common/dash"]+") ?"+n,"gi");return e.replace(n,"$1"+t.dash+"$3")},settings:{dash:"\u2013"}},j={name:"ru/dash/years",handler:function(e,i){var t=d["common/dash"],t=new RegExp("(\\D|^)(\\d{4})[ \xa0]?("+t+")[ \xa0]?(\\d{4})(?=[ \xa0]?\u0433)","g");return e.replace(t,function(e,t,n,r,a){return parseInt(n,10)<parseInt(a,10)?t+n+i.dash+a:e})},settings:{dash:"\u2013"}};T.addRules([N,O,U,M,Q,H,G,W,X,V,L,S,D,I,z,C,j]);W={name:"ru/date/fromISO",handler:function(e){var t="(-|\\.|\\/)",n="(-|\\/)",t=new RegExp("(^|\\D)(\\d{4})"+t+"(\\d{2})"+t+"(\\d{2})(\\D|$)","gi"),n=new RegExp("(^|\\D)(\\d{2})"+n+"(\\d{2})"+n+"(\\d{4})(\\D|$)","gi");return e.replace(t,"$1$6.$4.$2$7").replace(n,"$1$4.$2.$6$7")}},X={name:"ru/date/weekday",handler:function(e){var t=d["ru/monthGenCase"],n=d["ru/weekday"],n=new RegExp("(\\d)( |\xa0)("+t+"),( |\xa0)("+n+")","gi");return e.replace(n,function(){var e=arguments;return e[1]+e[2]+e[3].toLowerCase()+","+e[4]+e[5].toLowerCase()})}};T.addRules([W,X]);V={name:"ru/money/currency",handler:function(e){var t="([$\u20ac\xa5\u04b0\xa3\u20a4\u20bd])",n=new RegExp("(^|[\\D]{2})"+t+" ?("+x+"([ \xa0\u2009\u202f]\\d{3})*)([ \xa0\u2009\u202f]?(\u0442\u044b\u0441\\.|\u043c\u043b\u043d|\u043c\u043b\u0440\u0434|\u0442\u0440\u043b\u043d))?","gm"),t=new RegExp("(^|[\\D])("+x+") ?"+t,"gm");return e.replace(n,function(e,t,n,r,a,i,s,u){return t+r+(u?"\xa0"+u:"")+"\xa0"+n}).replace(t,"$1$2\xa0$4")},disabled:!0},L={name:"ru/money/ruble",handler:function(e){var t="$1\xa0\u20bd",n="(\\d+)( |\xa0)?(\u0440|\u0440\u0443\u0431)\\.",r=new RegExp("^"+n+"$","g"),a=new RegExp(n+"(?=[!?,:;])","g"),n=new RegExp(n+"(?=\\s+[A-\u042f\u0401])","g");return e.replace(r,t).replace(a,t).replace(n,t+".")},disabled:!0};T.addRules([V,L]);S={name:"ru/nbsp/abbr",handler:function(e){function t(e,t,n,r){return"\u0434\u0434"===n&&"\u043c\u043c"===r||-1<["\u0440\u0444","\u0440\u0443","\u0440\u0443\u0441","\u043e\u0440\u0433","\u0443\u043a\u0440","\u0431\u0433","\u0441\u0440\u0431"].indexOf(r)?e:t+n+".\xa0"+r+"."}var n=new RegExp("(^|\\s|".concat(y,")([\u0430-\u044f\u0451]{1,3})\\. ?([\u0430-\u044f\u0451]{1,3})\\."),"g");return e.replace(n,t).replace(n,t)}},D={name:"ru/nbsp/beforeParticle",index:"+5",handler:function(e){var t="(\u043b\u0438|\u043b\u044c|\u0436\u0435|\u0436|\u0431\u044b|\u0431)",n=new RegExp("([\u0410-\u042f\u0401\u0430-\u044f\u0451]) "+t+'(?=[,;:?!"\u2018\u201c\xbb])',"g"),t=new RegExp("([\u0410-\u042f\u0401\u0430-\u044f\u0451])[ \xa0]"+t+"[ \xa0]","g");return e.replace(n,"$1\xa0$2").replace(t,"$1\xa0$2 ")}},I={name:"ru/nbsp/centuries",handler:function(e){var t=d["common/dash"],n="(^|\\s)([VIX]+)",r='(?=[,;:?!"\u2018\u201c\xbb]|$)',a=new RegExp(n+"[ \xa0]?\u0432\\.?"+r,"gm"),r=new RegExp(n+"("+t+")([VIX]+)[ \xa0]?\u0432\\.?([ \xa0]?\u0432\\.?)?"+r,"gm");return e.replace(a,"$1$2\xa0\u0432.").replace(r,"$1$2$3$4\xa0\u0432\u0432.")}},z={name:"ru/nbsp/dayMonth",handler:function(e){var t=new RegExp("(\\d{1,2}) ("+d["ru/shortMonth"]+")","gi");return e.replace(t,"$1\xa0$2")}},C={name:"ru/nbsp/initials",handler:function(e){var t=d["ru/quote"],t=new RegExp("(^|[\xa0\u202f "+t.left+y+'"])([\u0410-\u042f\u0401])\\.[\xa0\u202f ]?([\u0410-\u042f\u0401])\\.[\xa0\u202f ]?([\u0410-\u042f\u0401][\u0430-\u044f\u0451]+)(?=[\\s.,;:?!"'+t.right+"]|$)","gm");return e.replace(t,"$1$2.\xa0$3.\xa0$4")}},j={name:"ru/nbsp/m",index:"+5",handler:function(e){var t=new RegExp("(^|[\\s,.\\(\uf000])(\\d+)[ \xa0]?(\u043c\u043c?|\u0441\u043c|\u043a\u043c|\u0434\u043c|\u0433\u043c|mm?|km|cm|dm)([23\xb2\xb3])?([\\s\\).!?,;\uf000]|$)","gm");return e.replace(t,function(e,t,n,r,a,i){return t+n+"\xa0"+r+{2:"\xb2","\xb2":"\xb2",3:"\xb3","\xb3":"\xb3","":""}[a||""]+("\xa0"===i?" ":i)})}},W={name:"ru/nbsp/page",handler:function(e){var t=new RegExp("(^|[)\\s\uf000])(\u0441\u0442\u0440|\u0433\u043b|\u0440\u0438\u0441|\u0438\u043b\u043b?|\u0441\u0442|\u043f|c)\\. *(\\d+)([\\s.,?!;:]|$)","gim");return e.replace(t,"$1$2.\xa0$3$4")}},X={name:"ru/nbsp/ps",handler:function(e){var t=new RegExp("(^|\\s|".concat(y,")[p\u0437]\\.[ \xa0]?([p\u0437]\\.[ \xa0]?)?[s\u044b]\\.:? "),"gim");return e.replace(t,function(e,t,n){return t+(n?"P.\xa0P.\xa0S. ":"P.\xa0S. ")})}},V={name:"ru/nbsp/see",handler:function(e){var t=new RegExp("(^|\\s|".concat(y,"|\\()(\u0441\u043c|\u0438\u043c)\\.[ \xa0]?([\u0430-\u044f\u04510-9a-z]+)([\\s.,?!]|$)"),"gi");return e.replace(t,function(e,t,n,r,a){return("\xa0"===t?" ":t)+n+".\xa0"+r+a})}},L={name:"ru/nbsp/years",index:"+5",handler:function(e){var t=d["common/dash"],t=new RegExp("(^|\\D)(\\d{4})("+t+')(\\d{4})[ \xa0]?\u0433\\.?([ \xa0]?\u0433\\.)?(?=[,;:?!"\u2018\u201c\xbb\\s]|$)',"gm");return e.replace(t,"$1$2$3$4\xa0\u0433\u0433.")}};T.addRules([S,{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")}},{name:"ru/nbsp/afterNumberSign",handler:function(e){return e.replace(/\u2116[ \u00A0\u2009]?(\d|\u043f\/\u043f)/g,"\u2116\u202f$1")}},D,I,z,C,j,{name:"ru/nbsp/mln",handler:function(e){return e.replace(/(\d) ?(\u0442\u044b\u0441|\u043c\u043b\u043d|\u043c\u043b\u0440\u0434|\u0442\u0440\u043b\u043d)(\.|\s|$)/gi,"$1\xa0$2$3")}},{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")}},W,X,{name:"ru/nbsp/rubleKopek",handler:function(e){return e.replace(/(\d) ?(?=(\u0440\u0443\u0431|\u043a\u043e\u043f)\.)/g,"$1\xa0")}},V,{name:"ru/nbsp/year",handler:function(e){return e.replace(/(^|\D)(\d{4}) ?\u0433([ ,;.\n]|$)/g,"$1$2\xa0\u0433$3")}},L]);D={name:"ru/number/ordinals",handler:function(e,t,n){n=new RegExp("(\\d[%\u2030]?)-(\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)(?!["+n.getData("char")+"])","g");return e.replace(n,function(e,t,n){return t+"-"+{"\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"}[n]})}};function K(e,t){t=new RegExp('<span class="('+t.join("|")+')">([^]*?)</span>',"g");return e.replace(t,"$2")}function Y(e,t){return e.replace(/<title>[^]*?<\/title>/i,function(e){return K(e,t)})}T.addRules([{name:"ru/number/comma",handler:function(e){return e.replace(/(^|\s)(\d+)\.(\d+[\u00A0\u2009\u202F ]*?[%\u2030\xb0\xd7x])/gim,"$1$2,$3")}},D]);var Z=["typograf-oa-lbracket","typograf-oa-n-lbracket","typograf-oa-sp-lbracket"],I="ru/optalign/bracket",z={name:I,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,htmlAttrs:!1},C={name:I,queue:"start",handler:function(e){return K(e,Z)}},j={name:I,queue:"end",handler:function(e){return Y(e,Z)}},J=["typograf-oa-comma","typograf-oa-comma-sp"],W="ru/optalign/comma",X={name:W,handler:function(e,t,n){n=new RegExp("(["+n.getData("char")+"\\d\u0301]+), ","gi");return e.replace(n,'$1<span class="typograf-oa-comma">,</span><span class="typograf-oa-comma-sp"> </span>')},disabled:!0,htmlAttrs:!1},V={name:W,queue:"start",handler:function(e){return K(e,J)}},L={name:W,queue:"end",handler:function(e){return Y(e,J)}},ee=["typograf-oa-lquote","typograf-oa-n-lquote","typograf-oa-sp-lquote"],D="ru/optalign/quote",I={name:D,handler:function(e){var t=this.getSetting("common/punctuation/quote","ru"),n="(["+t.left[0]+(t.left[1]||"")+"])",t=new RegExp("(^|\n\n|\uf000)("+n+")","g"),n=new RegExp("([^\n\uf000])([ \xa0\n])("+n+")","gi");return e.replace(t,'$1<span class="typograf-oa-n-lquote">$2</span>').replace(n,'$1<span class="typograf-oa-sp-lquote">$2</span><span class="typograf-oa-lquote">$3</span>')},disabled:!0,htmlAttrs:!1},W={name:D,queue:"start",handler:function(e){return K(e,ee)}},D={name:D,queue:"end",handler:function(e){return Y(e,ee)}};T.addRules([z,X,I]),T.addInnerRules([C,j,V,L,W,D]);var te=[];function ne(e){var t,n,r=e[0],a="";if(e.length<8)return re(e);if(10<e.length)if("+"===r){if("7"!==e[1])return e;t=!0,e=e.substr(2)}else"8"===r&&(n=!0,e=e.substr(1));for(var i=8;2<=i;i--){var s=+e.substr(0,i);if(-1<te.indexOf(s)){a=e.substr(0,i),e=e.substr(i);break}}return a||(a=e.substr(0,5),e=e.substr(5)),(t?"+7\xa0":"")+(n?"8\xa0":"")+function(e){var t=+e,n=e.length,r=[e],a=!1;if(3<n)switch(n){case 4:r=[e.substr(0,2),e.substr(2,2)];break;case 5:r=[e.substr(0,3),e.substr(3,3)];break;case 6:r=[e.substr(0,2),e.substr(2,2),e.substr(4,2)]}else a=900<t&&t<=999||495==t||499==t;return r=r.join("-"),a?r:"("+r+")"}(a)+"\xa0"+re(e)}function re(e){var t="";return e.length%2&&(t=e[0],t+=e.length<=5?"-":"",e=e.substr(1,e.length-1)),t+e.split(/(?=(?:\d\d)+$)/).join("-")}function ae(e){return e.replace(/[^\d+]/g,"")}[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,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,"39131-39179","39190-39199",391,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 t=e.split("-"),n=+t[0];n<=+t[1];n++)te.push(n);else te.push(e)});W={name:"ru/other/phone-number",live:!1,handler:function(e){var t=new RegExp("(^|,| |\uf000)(\\+7[\\d\\(\\) \xa0-]{10,18})(?=,|;|\uf000|$)","gm");return e.replace(t,function(e,t,n){n=ae(n);return 12===n.length?t+ne(n):e}).replace(/(^|[^\u0430-\u044f\u0451])([\u260e\u260f\u2706\ud83d\udce0\ud83d\udcde\ud83d\udcf1]|\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,t,n,r,a){a=ae(a);return 5<=a.length?t+n+r+ne(a):e})}};T.addRules([{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,t,n,r){return t+n.toLowerCase()+"\u0301"+r})},disabled:!0},W]);D={name:"ru/punctuation/ano",handler:function(e){var t=new RegExp("([^\xab\u201e[(!?,:;\\-\u2012\u2013\u2014\\s])(\\s+)(\u0430|\u043d\u043e)(?= |\xa0|\\n)","g");return e.replace(t,"$1,$2$3")},queue:"hide-safe-tags-html"},W={name:"ru/punctuation/exclamationQuestion",index:"+5",handler:function(e){var t=new RegExp("(^|[^!])!\\?([^?]|$)","g");return e.replace(t,"$1?!$2")}};T.addRules([D,{name:"ru/punctuation/exclamation",live:!1,handler:function(e){return e.replace(/(^|[^!])!{2}($|[^!])/gm,"$1!$2").replace(/(^|[^!])!{4}($|[^!])/gm,"$1!!!$2")}},W,{name:"ru/punctuation/hellipQuestion",handler:function(e){return e.replace(/(^|[^.])(\.\.\.|\u2026),/g,"$1\u2026").replace(/(!|\?)(\.\.\.|\u2026)(?=[^.]|$)/g,"$1..")}}]);W={name:"ru/space/year",handler:function(e,t,n){n=new RegExp("(^| |\xa0)(\\d{3,4})(\u0433\u043e\u0434([\u0430\u0443\u0435]|\u043e\u043c)?)([^"+n.getData("char")+"]|$)","g");return e.replace(n,"$1$2 $3$5")}};T.addRules([{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")}},W]);T.addRules([{name:"ru/symbols/NN",handler:function(e){return e.replace(/\u2116\u2116/g,"\u2116")}}]);var ie={A:"\u0410",a:"\u0430",B:"\u0412",E:"\u0415",e:"\u0435",K:"\u041a",M:"\u041c",H:"\u041d",O:"\u041e",o:"\u043e",P:"\u0420",p:"\u0440",C:"\u0421",c:"\u0441",T:"\u0422",y:"\u0443",X:"\u0425",x:"\u0445"},se=Object.keys(ie).join(""),W={name:"ru/typo/switchingKeyboardLayout",handler:function(e){var t=new RegExp("(["+se+"]{1,3})(?=[\u0410-\u042f\u0401\u0430-\u044f\u0451]+?)","g");return e.replace(t,function(e,t){for(var n="",r=0;r<t.length;r++)n+=ie[t[r]];return n})}};return T.addRules([W]),T});

var dletp = new Typograf({
    locale: ['ru', 'en-US']
});

dletp.disableRule('common/space/afterPunctuation');
dletp.disableRule('common/space/delBeforePunctuation');

dletp.addSafeTag('\\[code\\]', '\\[/code\\]');
dletp.addSafeTag('\\[', '\\]');
dletp.addSafeTag('<code>', '</code>');