From 21bad1026406def4b777b7d7e8a2ae5ba345ed4c Mon Sep 17 00:00:00 2001 From: bournwog Date: Tue, 18 Apr 2023 16:28:46 +0000 Subject: [PATCH] add typograf --- .../plugins/typograf/dist/typograf.all.js | 3545 +++++++++++++++++ .../plugins/typograf/dist/typograf.all.min.js | 2 + .../plugins/typograf/dist/typograf.css | 36 + .../plugins/typograf/dist/typograf.groups.js | 87 + .../typograf/dist/typograf.groups.json | 86 + .../tinymce/plugins/typograf/dist/typograf.js | 3086 ++++++++++++++ .../plugins/typograf/dist/typograf.min.js | 2 + .../plugins/typograf/dist/typograf.titles.js | 381 ++ .../typograf/dist/typograf.titles.json | 381 ++ .../vendor/tinymce/plugins/typograf/index.js | 1 + .../tinymce/plugins/typograf/langs/en.js | 3 + .../tinymce/plugins/typograf/langs/ru.js | 3 + .../vendor/tinymce/plugins/typograf/plugin.js | 166 + .../tinymce/plugins/typograf/plugin.min.js | 4 + 14 files changed, 7783 insertions(+) create mode 100644 assets/components/tinymcerte/js/vendor/tinymce/plugins/typograf/dist/typograf.all.js create mode 100644 assets/components/tinymcerte/js/vendor/tinymce/plugins/typograf/dist/typograf.all.min.js create mode 100644 assets/components/tinymcerte/js/vendor/tinymce/plugins/typograf/dist/typograf.css create mode 100644 assets/components/tinymcerte/js/vendor/tinymce/plugins/typograf/dist/typograf.groups.js create mode 100644 assets/components/tinymcerte/js/vendor/tinymce/plugins/typograf/dist/typograf.groups.json create mode 100644 assets/components/tinymcerte/js/vendor/tinymce/plugins/typograf/dist/typograf.js create mode 100644 assets/components/tinymcerte/js/vendor/tinymce/plugins/typograf/dist/typograf.min.js create mode 100644 assets/components/tinymcerte/js/vendor/tinymce/plugins/typograf/dist/typograf.titles.js create mode 100644 assets/components/tinymcerte/js/vendor/tinymce/plugins/typograf/dist/typograf.titles.json create mode 100644 assets/components/tinymcerte/js/vendor/tinymce/plugins/typograf/index.js create mode 100644 assets/components/tinymcerte/js/vendor/tinymce/plugins/typograf/langs/en.js create mode 100644 assets/components/tinymcerte/js/vendor/tinymce/plugins/typograf/langs/ru.js create mode 100644 assets/components/tinymcerte/js/vendor/tinymce/plugins/typograf/plugin.js create mode 100644 assets/components/tinymcerte/js/vendor/tinymce/plugins/typograf/plugin.min.js diff --git a/assets/components/tinymcerte/js/vendor/tinymce/plugins/typograf/dist/typograf.all.js b/assets/components/tinymcerte/js/vendor/tinymce/plugins/typograf/dist/typograf.all.js new file mode 100644 index 0000000..98e77c3 --- /dev/null +++ b/assets/components/tinymcerte/js/vendor/tinymce/plugins/typograf/dist/typograf.all.js @@ -0,0 +1,3545 @@ +/*! typograf | © 2020 Denis Seleznev | MIT License | https://github.com/typograf/typograf */ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global.Typograf = factory()); +}(this, (function () { 'use strict'; + +function _typeof(obj) { + if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { + _typeof = function (obj) { + return typeof obj; + }; + } else { + _typeof = function (obj) { + return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }; + } + + return _typeof(obj); +} + +function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } +} + +function _defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } +} + +function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) _defineProperties(Constructor.prototype, protoProps); + if (staticProps) _defineProperties(Constructor, staticProps); + return Constructor; +} + +function _slicedToArray(arr, i) { + return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); +} + +function _arrayWithHoles(arr) { + if (Array.isArray(arr)) return arr; +} + +function _iterableToArrayLimit(arr, i) { + if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { + return; + } + + var _arr = []; + var _n = true; + var _d = false; + var _e = undefined; + + try { + for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { + _arr.push(_s.value); + + if (i && _arr.length === i) break; + } + } catch (err) { + _d = true; + _e = err; + } finally { + try { + if (!_n && _i["return"] != null) _i["return"](); + } finally { + if (_d) throw _e; + } + } + + return _arr; +} + +function _nonIterableRest() { + throw new TypeError("Invalid attempt to destructure non-iterable instance"); +} + +var 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 +}; + +// http://www.w3.org/TR/html4/sgml/entities +var visibleEntities = [['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]]; + +var invisibleEntities = [['nbsp', 160], ['thinsp', 8201], ['ensp', 8194], ['emsp', 8195], ['shy', 173], ['zwnj', 8204], ['zwj', 8205], ['lrm', 8206], ['rlm', 8207]]; + +var HtmlEntities = +/*#__PURE__*/ +function () { + function HtmlEntities() { + _classCallCheck(this, HtmlEntities); + + this._entities = this._prepareEntities([].concat(visibleEntities, invisibleEntities)); + this._entitiesByName = {}; + this._entitiesByNameEntity = {}; + this._entitiesByDigitEntity = {}; + this._entitiesByUtf = {}; + + this._entities.forEach(function (entity) { + this._entitiesByName[entity.name] = entity; + this._entitiesByNameEntity[entity.nameEntity] = entity; + this._entitiesByDigitEntity[entity.digitEntity] = entity; + this._entitiesByUtf[entity.utf] = entity; + }, this); + + this._invisibleEntities = this._prepareEntities(invisibleEntities); + } + /** + * Entities as name or digit to UTF-8. + * + * @param {Object} context + */ + + + _createClass(HtmlEntities, [{ + key: "toUtf", + value: function toUtf(context) { + var _this = this; + + if (context.text.search(/&#/) !== -1) { + context.text = this.decHexToUtf(context.text); + } + + if (context.text.search(/&[a-z]/i) !== -1) { + // 2 - min length of entity without & and ;. Example: ⅅ + // 31 - max length of entity without & and ;. Example: ∳ + context.text = context.text.replace(/&[a-z\d]{2,31};/gi, function (key) { + var entity = _this._entitiesByNameEntity[key]; + return entity ? entity.utf : key; + }); + } + } + /** + * Entities in decimal or hexadecimal form to UTF-8. + * + * @param {string} text + * @returns {string} + */ + + }, { + key: "decHexToUtf", + value: function decHexToUtf(text) { + return text.replace(/&#(\d{1,6});/gi, function ($0, $1) { + return String.fromCharCode(parseInt($1, 10)); + }).replace(/&#x([\da-f]{1,6});/gi, function ($0, $1) { + return String.fromCharCode(parseInt($1, 16)); + }); + } + /** + * Restore HTML entities in text. + * + * @param {Object} context + */ + + }, { + key: "restore", + value: function restore(context) { + var params = context.prefs.htmlEntity; + var type = params.type; + var entities = this._entities; + + if (type === 'name' || type === 'digit') { + if (params.onlyInvisible || params.list) { + entities = []; + + if (params.onlyInvisible) { + entities = entities.concat(this._invisibleEntities); + } + + if (params.list) { + entities = entities.concat(this._prepareListParam(params.list)); + } + } + + context.text = this._restoreEntitiesByIndex(context.text, type + 'Entity', entities); + } + } + /** + * Get a entity by utf using the type. + * + * @param {string} symbol + * @param {string} [type] + * @returns {string} + */ + + }, { + key: "getByUtf", + value: function getByUtf(symbol, type) { + var result = ''; + + switch (type) { + case 'digit': + result = this._entitiesByDigitEntity[symbol]; + break; + + case 'name': + result = this._entitiesByNameEntity[symbol]; + break; + + default: + result = symbol; + break; + } + + return result; + } + }, { + key: "_prepareEntities", + value: function _prepareEntities(entities) { + var result = []; + entities.forEach(function (entity) { + var _entity = _slicedToArray(entity, 2), + name = _entity[0], + digit = _entity[1]; + + var utf = String.fromCharCode(digit); + result.push({ + name: name, + nameEntity: '&' + name + ';', + //   + digitEntity: '&#' + digit + ';', + //   + utf: utf, + // \u00A0 + reName: new RegExp('&' + name + ';', 'g'), + reUtf: new RegExp(utf, 'g') + }); + }, this); + return result; + } + }, { + key: "_prepareListParam", + value: function _prepareListParam(list) { + var result = []; + list.forEach(function (name) { + var entity = this._entitiesByName[name]; + + if (entity) { + result.push(entity); + } + }, this); + return result; + } + }, { + key: "_restoreEntitiesByIndex", + value: function _restoreEntitiesByIndex(text, type, entities) { + entities.forEach(function (entity) { + text = text.replace(entity.reUtf, entity[type]); + }); + return text; + } + }]); + + return HtmlEntities; +}(); + +var HtmlEntities$1 = new HtmlEntities(); +/** + * @typedef HtmlEntity + * + * @property {string} type - 'default' - UTF-8, 'digit' -  , 'name' -   + * @property {boolean} [onlyInvisible] + * @property {string[]} [list] + */ + +var locales = []; +/** + * Add a locale. + * + * @param {string} locale + */ + +function addLocale(locale) { + var code = (locale || '').split('/')[0]; + + if (code && code !== 'common' && !hasLocale(code)) { + locales.push(code); + locales.sort(); + } +} +/** + * Get locales. + * + * @returns {Array} + */ + +function getLocales() { + return locales; +} +/** + * Has a locale. +* + * @param {string} locale + * + * @returns {boolean} + */ + +function hasLocale(locale) { + return locale === 'common' || locales.indexOf(locale) !== -1; +} +function prepareLocale(locale1, locale2) { + var locale = locale1 || locale2; + var result = locale; + + if (!Array.isArray(locale)) { + result = [locale]; + } + + return result; +} + +var data = {}; +/** + * Get data for use in rules. + * + * @param {string} key + * + * @returns {*} + */ + +function getData(key) { + return data[key]; +} +/** + * Set data for use in rules. + * + * @param {string|Object} key + * @param {*} [value] + */ + +function setData(key, value) { + if (typeof key === 'string') { + addLocale(key); + data[key] = value; + } else if (_typeof(key) === 'object') { + Object.keys(key).forEach(function (k) { + addLocale(k); + data[k] = key[k]; + }); + } +} + +var inlineElements = ['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']; + +var regExpUrl = new RegExp('(https?|file|ftp)://([a-zA-Z0-9/+-=%&:_.~?]+[a-zA-Z0-9#+]*)', 'g'); + +var privateLabel = "\uF000"; +var privateSeparateLabel = "\uF001"; + +var SafeTags = +/*#__PURE__*/ +function () { + function SafeTags() { + _classCallCheck(this, SafeTags); + + var html = [[''], [''], [''], ['<\\?xml', '\\?>'], ['']]; + ['code', 'kbd', 'object', 'pre', 'samp', 'script', 'style', 'var'].forEach(function (tag) { + html.push(['<' + tag + '(\\s[^>]*?)?>', '']); + }, this); + this._tags = { + own: [], + html: html.map(this._prepareRegExp), + url: [regExpUrl] + }; + this._groups = ['own', 'html', 'url']; + } + /** + * Add own safe tag. + * + * @param {RegExp|string[]} tag + */ + + + _createClass(SafeTags, [{ + key: "add", + value: function add(tag) { + this._tags.own.push(this._prepareRegExp(tag)); + } + /** + * Show safe tags. + * + * @param {Object} context + * @param {string} group + */ + + }, { + key: "show", + value: function show(context, group) { + var reReplace = new RegExp(privateLabel + 'tf\\d+' + privateLabel, 'g'); + var reSearch = new RegExp(privateLabel + 'tf\\d'); + + var replaceLabel = function replaceLabel(match) { + return context.safeTags.hidden[group][match] || match; + }; + + for (var i = 0, len = this._tags[group].length; i < len; i++) { + context.text = context.text.replace(reReplace, replaceLabel); + + if (context.text.search(reSearch) === -1) { + break; + } + } + } + /** + * Hide safe tags. + * + * @param {Object} context + * @param {string} group + */ + + }, { + key: "hide", + value: function hide(context, group) { + context.safeTags = context.safeTags || { + hidden: {}, + i: 0 + }; + context.safeTags.hidden[group] = {}; + + var pasteLabel = this._pasteLabel.bind(this, context, group); + + this._tags[group].forEach(function (tag) { + context.text = context.text.replace(this._prepareRegExp(tag), pasteLabel); + }, this); + } + /** + * Hide HTML tags. + * + * @param {Object} context + */ + + }, { + key: "hideHTMLTags", + value: function hideHTMLTags(context) { + if (context.isHTML) { + var pasteLabel = this._pasteLabel.bind(this, context, 'html'); + + context.text = context.text.replace(/<\/?[a-z][^]*?>/gi, pasteLabel) // Tags + .replace(/<\/?[a-z][^]*?>/gi, pasteLabel) // Escaping tags + .replace(/&[gl]t;/gi, pasteLabel); + } + } + /** + * Get previous label. + * + * @param {string} text + * @param {number} position + * + * @returns {string|false} + */ + + }, { + key: "getPrevLabel", + value: function getPrevLabel(text, position) { + for (var i = position - 1; i >= 0; i--) { + if (text[i] === privateLabel) { + return text.slice(i, position + 1); + } + } + + return false; + } + /** + * Get next label. + * + * @param {string} text + * @param {number} position + * + * @returns {string|false} + */ + + }, { + key: "getNextLabel", + value: function getNextLabel(text, position) { + for (var i = position + 1; i < text.length; i++) { + if (text[i] === privateLabel) { + return text.slice(position, i + 1); + } + } + + return false; + } + /** + * Get a tag by a label. + * + * @param {Object} context + * @param {string} label + * + * @returns {Object|boolean} + */ + + }, { + key: "getTagByLabel", + value: function getTagByLabel(context, label) { + var result = false; + + this._groups.some(function (group) { + var value = context.safeTags.hidden[group][label]; + + if (typeof value !== 'undefined') { + result = { + group: group, + value: value + }; + } + + return result; + }); + + return result; + } + /** + * Get info about a tag. + * + * @param {Object|undefined} tag + * + * @returns {Object|undefined} + */ + + }, { + key: "getTagInfo", + value: function getTagInfo(tag) { + if (!tag) { + return; + } + + var result = { + group: tag.group + }; + + switch (tag.group) { + case 'html': + result.name = tag.value.split(/[<\s>]/)[1]; + result.isInline = inlineElements.indexOf(result.name) > -1; + result.isClosing = tag.value.search(/^<\//) > -1; + break; + + case 'url': + result.isInline = true; + break; + + case 'own': + result.isInline = false; + break; + } + + return result; + } + }, { + key: "_pasteLabel", + value: function _pasteLabel(context, group, match) { + var safeTags = context.safeTags; + var key = privateLabel + 'tf' + safeTags.i + privateLabel; + safeTags.hidden[group][key] = match; + safeTags.i++; + return key; + } + }, { + key: "_prepareRegExp", + value: function _prepareRegExp(tag) { + var re; + + if (tag instanceof RegExp) { + re = tag; + } else { + var _tag = _slicedToArray(tag, 3), + startTag = _tag[0], + endTag = _tag[1], + middle = _tag[2]; + + if (typeof middle === 'undefined') { + middle = '[^]*?'; + } + + re = new RegExp(startTag + middle + endTag, 'gi'); + } + + return re; + } + }]); + + return SafeTags; +}(); + +function repeat(symbol, count) { + var result = ''; + + for (;;) { + if ((count & 1) === 1) { + result += symbol; + } + + count >>>= 1; + + if (count === 0) { + break; + } + + symbol += symbol; + } + + return result; +} +function replaceNbsp(text) { + return text.replace(/\u00A0/g, ' '); +} +function replace(text, re) { + for (var i = 0; i < re.length; i++) { + text = text.replace(re[i][0], re[i][1]); + } + + return text; +} +function isHTML(text) { + return text.search(/(<\/?[a-z]|]*?)?>[^]*?', 'gi'); + var position = 0; + context.text.replace(reTags, function ($0, $1, $2, itemPosition) { + if (position !== itemPosition) { + text.push((position ? privateSeparateLabel : '') + context.text.slice(position, itemPosition) + privateSeparateLabel); + } + + text.push($0); + position = itemPosition + $0.length; + return $0; + }); + text.push(position ? privateSeparateLabel + context.text.slice(position, context.text.length) : context.text); + return text; + } + }, { + key: "_process", + value: function _process(context) { + var _this = this; + + context.text = removeCR(context.text); + + this._executeRules(context, 'start'); + + this._safeTags.hide(context, 'own'); + + this._executeRules(context, 'hide-safe-tags-own'); + + this._safeTags.hide(context, 'html'); + + this._executeRules(context, 'hide-safe-tags-html'); + + var isRootHTML = context.isHTML, + re = new RegExp(privateSeparateLabel, 'g'); + context.text = this._splitBySeparateParts(context).map(function (item) { + context.text = item; + context.isHTML = isHTML(item); + + _this._safeTags.hideHTMLTags(context); + + _this._safeTags.hide(context, 'url'); + + _this._executeRules(context, 'hide-safe-tags-url'); + + _this._executeRules(context, 'hide-safe-tags'); + + HtmlEntities$1.toUtf(context); + + if (_this._prefs.live) { + context.text = replaceNbsp(context.text); + } + + _this._executeRules(context, 'utf'); + + _this._executeRules(context); + + HtmlEntities$1.restore(context); + + _this._executeRules(context, 'html-entities'); + + _this._safeTags.show(context, 'url'); + + _this._executeRules(context, 'show-safe-tags-url'); + + return context.text.replace(re, ''); + }).join(''); + context.isHTML = isRootHTML; + + this._safeTags.show(context, 'html'); + + this._executeRules(context, 'show-safe-tags-html'); + + this._safeTags.show(context, 'own'); + + this._executeRules(context, 'show-safe-tags-own'); + + this._executeRules(context, 'end'); + + return fixLineEnding(context.text, context.prefs.lineEnding); + } + /** + * Get a setting. + * + * @param {string} ruleName + * @param {string} setting + * + * @returns {*} + */ + + }, { + key: "getSetting", + value: function getSetting(ruleName, setting) { + return this._settings[ruleName] && this._settings[ruleName][setting]; + } + /** + * Set a setting. + * + * @param {string} ruleName + * @param {string} setting + * @param {*} [value] + * + * @returns {Typograf} + */ + + }, { + key: "setSetting", + value: function setSetting(ruleName, setting, value) { + this._settings[ruleName] = this._settings[ruleName] || {}; + this._settings[ruleName][setting] = value; + return this; + } + /** + * Is enabled a rule. + * + * @param {string} ruleName + * + * @returns {boolean} + */ + + }, { + key: "isEnabledRule", + value: function isEnabledRule(ruleName) { + return this._enabledRules[ruleName]; + } + /** + * Is disabled a rule. + * + * @param {string} ruleName + * + * @returns {boolean} + */ + + }, { + key: "isDisabledRule", + value: function isDisabledRule(ruleName) { + return !this._enabledRules[ruleName]; + } + /** + * Enable a rule. + * + * @param {string|string[]} ruleName + * + * @returns {Typograf} this + */ + + }, { + key: "enableRule", + value: function enableRule(ruleName) { + return this._enable(ruleName, true); + } + /** + * Disable a rule. + * + * @param {string|string[]} ruleName + * + * @returns {Typograf} this + */ + + }, { + key: "disableRule", + value: function disableRule(ruleName) { + return this._enable(ruleName, false); + } + /** + * Add safe tag. + * + * @example + * // var t = new Typograf({locale: 'ru'}); + * // t.addSafeTag('', ''); + * // t.addSafeTag('', '', '.*?'); + * // t.addSafeTag(/.*?/gi); + * + * @param {string|RegExp} startTag + * @param {string} [endTag] + * @param {string} [middle] + * + * @returns {Typograf} this + */ + + }, { + key: "addSafeTag", + value: function addSafeTag(startTag, endTag, middle) { + var tag = startTag instanceof RegExp ? startTag : [startTag, endTag, middle]; + + this._safeTags.add(tag); + + return this; + } + }, { + key: "_executeRules", + value: function _executeRules(context, queue) { + queue = queue || 'default'; + var rules = this._rulesByQueues[queue]; + var innerRules = this._innerRulesByQueues[queue]; + innerRules && innerRules.forEach(function (rule) { + this._ruleIterator(context, rule); + }, this); + rules && rules.forEach(function (rule) { + this._ruleIterator(context, rule); + }, this); + } + }, { + key: "_ruleIterator", + value: function _ruleIterator(context, rule) { + var rlocale = rule._locale; + var live = this._prefs.live; + + if (live === true && rule.live === false || live === false && rule.live === true) { + return; + } + + if ((rlocale === 'common' || rlocale === context.prefs.locale[0]) && this.isEnabledRule(rule.name)) { + if (context.prefs.ruleFilter && !context.prefs.ruleFilter(rule)) { + return; + } + + this._onBeforeRule && this._onBeforeRule(rule.name, context.text, context); + context.text = rule.handler.call(this, context.text, this._settings[rule.name], context); + this._onAfterRule && this._onAfterRule(rule.name, context.text, context); + } + } + }, { + key: "_prepareRule", + value: function _prepareRule(rule) { + var name = rule.name; + + var t = _typeof(rule.settings); + + var settings = {}; + + if (t === 'object') { + settings = deepCopy(rule.settings); + } else if (t === 'function') { + settings = rule.settings(rule); + } + + this._settings[name] = settings; + this._enabledRules[name] = rule._enabled; + } + }, { + key: "_enable", + value: function _enable(rule, enabled) { + if (Array.isArray(rule)) { + rule.forEach(function (el) { + this._enableByMask(el, enabled); + }, this); + } else { + this._enableByMask(rule, enabled); + } + + return this; + } + }, { + key: "_enableByMask", + value: function _enableByMask(rule, enabled) { + if (!rule) { + return; + } + + if (rule.search(/\*/) !== -1) { + var re = new RegExp(rule.replace(/\//g, '\\/').replace(/\*/g, '.*')); + + this._rules.forEach(function (el) { + var name = el.name; + + if (re.test(name)) { + this._enabledRules[name] = enabled; + } + }, this); + } else { + this._enabledRules[rule] = enabled; + } + } + }, { + key: "_getRule", + value: function _getRule(name) { + var rule = null; + + this._rules.some(function (item) { + if (item.name === name) { + rule = item; + return true; + } + + return false; + }); + + return rule; + } + }], [{ + key: "addRule", + value: function addRule(rule) { + var _rule$name$split = rule.name.split('/'), + _rule$name$split2 = _slicedToArray(_rule$name$split, 3), + locale = _rule$name$split2[0], + group = _rule$name$split2[1], + name = _rule$name$split2[2]; + + rule._enabled = rule.disabled === true ? false : true; + rule._locale = locale; + rule._group = group; + rule._name = name; + this.addLocale(rule._locale); + + this._setIndex(rule); + + this.prototype._rules.push(rule); + + this._sortRules(this.prototype._rules); + + return this; + } + /** + * Add rules. + * + * @static + * @param {TypografRule[]} rules + * + * @returns {Typograf} this + */ + + }, { + key: "addRules", + value: function addRules(rules) { + var _this2 = this; + + rules.forEach(function (item) { + _this2.addRule(item); + }); + return this; + } + /** + * Add internal rule. + * Internal rules are executed before main. + * + * @static + * @param {TypografRule} rule + * + * @returns {Typograf} this + */ + + }, { + key: "addInnerRule", + value: function addInnerRule(rule) { + this.prototype._innerRules.push(rule); + + rule._locale = rule.name.split('/')[0]; + return this; + } + /** + * Add internal rules. + * Internal rules are executed before main. + * + * @static + * @param {TypografRule[]} rules + * + * @returns {Typograf} this + */ + + }, { + key: "addInnerRules", + value: function addInnerRules(rules) { + var _this3 = this; + + rules.forEach(function (item) { + _this3.addInnerRule(item); + }); + return this; + } + }, { + key: "_setIndex", + value: function _setIndex(rule) { + var index = rule.index; + + var t = _typeof(index); + + var groupIndex = groupIndexes[rule._group]; + + if (t === 'undefined') { + index = groupIndex; + } else if (t === 'string') { + index = (groupIndex || 0) + parseInt(rule.index, 10); + } + + rule._index = index; + } + }, { + key: "_sortRules", + value: function _sortRules(rules) { + rules.sort(function (a, b) { + return a._index > b._index ? 1 : -1; + }); + } + }]); + + return Typograf; +}(); + +Typograf.version = '6.11.0'; +Typograf.addLocale = addLocale; +Typograf.getLocales = getLocales; +Typograf.hasLocale = hasLocale; +Typograf.setData = setData; +Typograf.getData = getData; // @deprecated + +Typograf.deepCopy = deepCopy; +Typograf.prototype._rules = []; +Typograf.prototype._innerRules = []; +/** + * @typedef TypografRule + * @type {object} + * + * @property {string} name Name of rule + * @property {Function} handler Processing function + * @property {number} [index] Sorting index for rule + * @property {boolean} [disabled] Rule is disabled by default + * @property {boolean} [live] Live mode + * @property {Object} [settings] Settings for rule + */ + +var common = { + 'common/char': 'a-z', + 'common/dash': '--?|‒|–|—', + // --, ‒, &ndash, &mdash + 'common/quote': '«‹»›„“‟”"' +}; + +var be = { + 'be/char': 'абвгдежзйклмнопрстуфхцчшыьэюяёіўґ', + 'be/quote': { + left: '«“', + right: '»”' + } +}; + +var bg = { + 'bg/char': 'абвгдежзийклмнопрстуфхцчшщъьюя', + 'bg/quote': { + left: '„’', + right: '“’' + } +}; + +var ca = { + 'ca/char': 'abcdefghijlmnopqrstuvxyzàçèéíïòóúü', + 'ca/quote': { + left: '«“', + right: '»”' + } +}; + +var da = { + 'da/char': 'a-zåæø', + 'da/quote': { + left: '»›', + right: '«‹' + } +}; + +var de = { + 'de/char': 'a-zßäöü', + 'de/quote': { + left: '„‚', + right: '“‘' + } +}; + +var el = { + 'el/char': 'ΐάέήίΰαβγδεζηθικλμνξοπρςστυφχψωϊϋόύώϲάέήίόύώ', + 'el/quote': { + left: '«“', + right: '»”' + } +}; + +var enGB = { + 'en-GB/char': 'a-z', + 'en-GB/quote': { + left: '‘“', + right: '’”' + } +}; + +var enUS = { + 'en-US/char': 'a-z', + 'en-US/quote': { + left: '“‘', + right: '”’' + } +}; + +var eo = { + 'eo/char': 'abcdefghijklmnoprstuvzĉĝĥĵŝŭ', + 'eo/quote': { + left: '“‘', + right: '”’' + } +}; + +var es = { + 'es/char': 'a-záéíñóúü', + 'es/quote': { + left: '«“', + right: '»”' + } +}; + +var et = { + 'et/char': 'abdefghijklmnoprstuvzäõöüšž', + 'et/quote': { + left: '„«', + right: '“»' + } +}; + +var fi = { + 'fi/char': 'abcdefghijklmnopqrstuvyöäå', + 'fi/quote': { + left: '”’', + right: '”’' + } +}; + +var fr = { + 'fr/char': 'a-zàâçèéêëîïôûüœæ', + 'fr/quote': { + left: '«‹', + right: '»›', + spacing: true + } +}; + +var ga = { + 'ga/char': 'abcdefghilmnoprstuvwxyzáéíóú', + 'ga/quote': { + left: '“‘', + right: '”’' + } +}; + +var hu = { + 'hu/char': 'a-záäéíóöúüőű', + 'hu/quote': { + left: '„»', + right: '”«' + } +}; + +var it = { + 'it/char': 'a-zàéèìòù', + 'it/quote': { + left: '«“', + right: '»”' + } +}; + +var lv = { + 'lv/char': 'abcdefghijklmnopqrstuvxzæœ', + 'lv/quote': { + left: '«„', + right: '»“' + } +}; + +var nl = { + 'nl/char': 'a-zäçèéêëîïñöûü', + 'nl/quote': { + left: '‘“', + right: '’”' + } +}; + +var no = { + 'no/char': 'a-zåæèéêòóôø', + 'no/quote': { + left: '«’', + right: '»’' + } +}; + +var pl = { + 'pl/char': 'abcdefghijklmnoprstuvwxyzóąćęłńśźż', + 'pl/quote': { + left: '„«', + right: '”»' + } +}; + +var ro = { + 'ro/char': 'abcdefghijklmnoprstuvxzîășț', + 'ro/quote': { + left: '„«', + right: '”»' + } +}; + +var ru = { + 'ru/char': 'а-яё', + 'ru/dashBefore': '(^| |\\n)', + 'ru/dashAfter': "(?=[\xA0 ,.?:!]|$)", + 'ru/dashAfterDe': "(?=[,.?:!]|[\xA0 ][^\u0410-\u042F\u0401]|$)", + 'ru/l': 'а-яёa-z', + 'ru/L': 'А-ЯЁA-Z', + 'ru/month': 'январь|февраль|март|апрель|май|июнь|июль|август|сентябрь|октябрь|ноябрь|декабрь', + 'ru/monthGenCase': 'января|февраля|марта|апреля|мая|июня|июля|августа|сентября|октября|ноября|декабря', + 'ru/monthPreCase': 'январе|феврале|марте|апреле|мае|июне|июле|августе|сентябре|октябре|ноябре|декабре', + 'ru/quote': { + left: '«„‚', + right: '»“‘', + removeDuplicateQuotes: true + }, + 'ru/shortMonth': 'янв|фев|мар|апр|ма[ейя]|июн|июл|авг|сен|окт|ноя|дек', + 'ru/weekday': 'понедельник|вторник|среда|четверг|пятница|суббота|воскресенье' +}; + +var sk = { + 'sk/char': 'abcdefghijklmnoprstuvwxyzáäéíóôúýčďľňŕšťž', + 'sk/quote': { + left: '„‚', + right: '“‘' + } +}; + +var sl = { + 'sl/char': 'a-zčšž', + 'sl/quote': { + left: '„‚', + right: '“‘' + } +}; + +var sr = { + 'sr/char': 'abcdefghijklmnoprstuvzćčđšž', + 'sr/quote': { + left: '„’', + right: '”’' + } +}; + +var sv = { + 'sv/char': 'a-zäåéö', + 'sv/quote': { + left: '”’', + right: '”’' + } +}; + +var tr = { + 'tr/char': 'abcdefghijklmnoprstuvyzâçîöûüğış', + 'tr/quote': { + left: '“‘', + right: '”’' + } +}; + +var uk = { + 'uk/char': 'абвгдежзийклмнопрстуфхцчшщьюяєіїґ', + 'uk/quote': { + left: '«„', + right: '»“' + } +}; + +var data$1 = [common, be, bg, ca, da, de, el, enGB, enUS, eo, es, et, fi, fr, ga, hu, it, lv, nl, no, pl, ro, ru, sk, sl, sr, sv, tr, uk]; +data$1.forEach(function (item) { + return setData(item); +}); + +var eMail = { + name: 'common/html/e-mail', + queue: 'end', + handler: function handler(text, settings, context) { + return context.isHTML ? text : text.replace(/(^|[\s;(])([\w\-.]{2,64})@([\w\-.]{2,64})\.([a-z]{2,64})([)\s.,!?]|$)/gi, '$1$2@$3.$4$5'); + }, + disabled: true, + htmlAttrs: false +}; + +var escape = { + name: 'common/html/escape', + index: '+100', + queue: 'end', + handler: function handler(text) { + var entityMap = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + '\'': ''', + '/': '/' + }; + return text.replace(/[&<>"'/]/g, function (s) { + return entityMap[s]; + }); + }, + disabled: true +}; + +var nbr = { + name: 'common/html/nbr', + index: '+10', + queue: 'end', + handler: function handler(text) { + return text.replace(/([^\n>])\n(?=[^\n])/g, '$1
\n'); + }, + disabled: true, + htmlAttrs: false +}; + +var blockElements = ['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']; + +var p = { + name: 'common/html/p', + index: '+5', + queue: 'end', + handler: function handler(text) { + var blockRe = new RegExp('<(' + blockElements.join('|') + ')[>\\s]'); + var separator = '\n\n'; + var buffer = text.split(separator); + buffer.forEach(function (text, i, data) { + if (!text.trim()) { + return; + } + + if (!blockRe.test(text)) { + data[i] = text.replace(/^(\s*)/, '$1

').replace(/(\s*)$/, '

$1'); + } + }); + return buffer.join(separator); + }, + disabled: true, + htmlAttrs: false +}; + +var processingAttrs = { + name: 'common/html/processingAttrs', + queue: 'hide-safe-tags-own', + // After "hide-safe-tags-own", before "hide-safe-tags-html". + handler: function handler(text, settings, context) { + var that = this; + var reAttrs = new RegExp('(^|\\s)(' + settings.attrs.join('|') + ')=("[^"]*?"|\'[^\']*?\')', 'gi'); + var prefs = deepCopy(context.prefs); + + prefs.ruleFilter = function (rule) { + return rule.htmlAttrs !== false; + }; + + return text.replace(/(<[-\w]+\s)([^>]+?)(?=>)/g, function (match, tagName, attrs) { + var resultAttrs = attrs.replace(reAttrs, function (submatch, space, attrName, attrValue) { + var lquote = attrValue[0]; + var rquote = attrValue[attrValue.length - 1]; + var value = attrValue.slice(1, -1); + return space + attrName + '=' + lquote + that.execute(value, prefs) + rquote; + }); + return tagName + resultAttrs; + }); + }, + settings: { + attrs: ['title', 'placeholder'] + }, + disabled: true, + htmlAttrs: false +}; + +var quot = { + name: 'common/html/quot', + queue: 'hide-safe-tags', + handler: function handler(text) { + return text.replace(/"/g, '"'); + } +}; + +var stripTags = { + name: 'common/html/stripTags', + index: '+99', + queue: 'end', + handler: function handler(text) { + return text.replace(/<[^>]+>/g, ''); + }, + disabled: true +}; + +var url = { + name: 'common/html/url', + queue: 'end', + handler: function handler(text, settings, context) { + return context.isHTML ? text : text.replace(regExpUrl, function ($0, protocol, path) { + path = path.replace(/([^/]+\/?)(\?|#)$/, '$1') // Remove ending ? and # + .replace(/^([^/]+)\/$/, '$1'); // Remove ending / + + if (protocol === 'http') { + path = path.replace(/^([^/]+)(:80)([^\d]|\/|$)/, '$1$3'); // Remove 80 port + } else if (protocol === 'https') { + path = path.replace(/^([^/]+)(:443)([^\d]|\/|$)/, '$1$3'); // Remove 443 port + } + + var url = path; + var fullUrl = protocol + '://' + path; + var firstPart = ''; + + if (protocol === 'http' || protocol === 'https') { + url = url.replace(/^www\./, ''); + return firstPart + (protocol === 'http' ? url : protocol + '://' + url) + ''; + } + + return firstPart + fullUrl + ''; + }); + }, + disabled: true, + htmlAttrs: false +}; + +Typograf.addRules([eMail, escape, nbr, p, processingAttrs, quot, stripTags, url]); + +var afterNumber = { + name: 'common/nbsp/afterNumber', + handler: function handler(text, settings, context) { + var re = '(^|\\D)(\\d{1,5}) ([' + context.getData('char') + ']+)'; + return text.replace(new RegExp(re, 'gi'), "$1$2\xA0$3"); + }, + disabled: true +}; + +var afterParagraphMark = { + name: 'common/nbsp/afterParagraphMark', + handler: function handler(text) { + return text.replace(/¶ ?(?=\d)/g, "\xB6\xA0"); + } +}; + +var afterSectionMark = { + name: 'common/nbsp/afterSectionMark', + handler: function handler(text, settings, context) { + // \u2009 - THIN SPACE + // \u202F - NARROW NO-BREAK SPACE + var locale = context.prefs.locale[0]; + return text.replace(/§[ \u00A0\u2009]?(?=\d|I|V|X)/g, locale === 'ru' ? "\xA7\u202F" : "\xA7\xA0"); + } +}; + +var afterShortWord = { + name: 'common/nbsp/afterShortWord', + handler: function handler(text, settings, context) { + var len = settings.lengthShortWord; + var before = " \xA0(" + privateLabel + getData('common/quote'); + var subStr = '(^|[' + before + '])([' + context.getData('char') + ']{1,' + len + '}) '; + var newSubStr = "$1$2\xA0"; + var re = new RegExp(subStr, 'gim'); + return text.replace(re, newSubStr).replace(re, newSubStr); + }, + settings: { + lengthShortWord: 2 + } +}; + +var beforeShortLastNumber = { + name: 'common/nbsp/beforeShortLastNumber', + handler: function handler(text, settings, context) { + var ch = context.getData('char'); + var CH = ch.toUpperCase(); + var re = new RegExp('([' + ch + CH + ']) (?=\\d{1,' + settings.lengthLastNumber + '}[-+−%\'"' + context.getData('quote').right + ')]?([.!?…]( [' + CH + ']|$)|$))', 'gm'); + return text.replace(re, "$1\xA0"); + }, + live: false, + settings: { + lengthLastNumber: 2 + } +}; + +var beforeShortLastWord = { + name: 'common/nbsp/beforeShortLastWord', + handler: function handler(text, settings, context) { + var ch = context.getData('char'); + var CH = ch.toUpperCase(); + var re = new RegExp('([' + ch + '\\d]) ([' + ch + CH + ']{1,' + settings.lengthLastWord + '}[.!?…])( [' + CH + ']|$)', 'g'); + return text.replace(re, "$1\xA0$2$3"); + }, + settings: { + lengthLastWord: 3 + } +}; + +var dpi = { + name: 'common/nbsp/dpi', + handler: function handler(text) { + return text.replace(/(\d) ?(lpi|dpi)(?!\w)/, "$1\xA0$2"); + } +}; + +function replaceNbsp$1($0, $1, $2, $3) { + return $1 + $2.replace(/([^\u00A0])\u00A0([^\u00A0])/g, '$1 $2') + $3; +} + +var nowrap = { + name: 'common/nbsp/nowrap', + queue: 'end', + handler: function handler(text) { + return text.replace(/()(.*?)(<\/nowrap>)/g, replaceNbsp$1).replace(/()(.*?)(<\/nobr>)/g, replaceNbsp$1); + } +}; + +var replaceNbsp$2 = { + name: 'common/nbsp/replaceNbsp', + queue: 'utf', + live: false, + handler: replaceNbsp, + disabled: true +}; + +Typograf.addRules([afterNumber, afterParagraphMark, afterSectionMark, afterShortWord, beforeShortLastNumber, beforeShortLastWord, dpi, nowrap, replaceNbsp$2]); + +var digitGrouping = { + name: 'common/number/digitGrouping', + index: '310', + disabled: true, + handler: function handler(text, settings) { + return text.replace(new RegExp("(^ ?|\\D |".concat(privateLabel, ")(\\d{1,3}([ \xA0\u202F\u2009]\\d{3})+)(?! ?[\\d-])"), 'gm'), function ($0, $1, $2) { + return $1 + $2.replace(/\s/g, settings.space); + }) // https://www.bipm.org/utils/common/pdf/si-brochure/SI-Brochure-9-EN.pdf #5.4.4 + .replace(/(\d{5,}([.,]\d+)?)/g, function ($0, $1) { + var decimalMarker = $1.match(/[.,]/); + + var _ref = decimalMarker ? $1.split(decimalMarker) : [$1], + _ref2 = _slicedToArray(_ref, 2), + integerPart = _ref2[0], + fractionalPart = _ref2[1]; + + integerPart = integerPart.replace(/(\d)(?=(\d{3})+([^\d]|$))/g, '$1' + settings.space); + return decimalMarker ? integerPart + decimalMarker + fractionalPart : integerPart; + }); + }, + settings: { + space: "\u202F" + } +}; + +var fraction = { + name: 'common/number/fraction', + handler: function handler(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'); + } +}; + +var mathSigns = { + name: 'common/number/mathSigns', + handler: function handler(text) { + return replace(text, [[/!=/g, '≠'], [/<=/g, '≤'], [/(^|[^=])>=/g, '$1≥'], [/<=>/g, '⇔'], [/<>/g, '≫'], [/~=/g, '≅'], [/(^|[^+])\+-/g, '$1±']]); + } +}; + +var times = { + name: 'common/number/times', + handler: function handler(text) { + return text.replace(/(\d)[ \u00A0]?[xх][ \u00A0]?(\d)/g, '$1×$2'); + } +}; + +Typograf.addRules([digitGrouping, fraction, mathSigns, times]); + +var delBOM = { + name: 'common/other/delBOM', + queue: 'start', + index: -1, + handler: function handler(text) { + if (text.charCodeAt(0) === 0xFEFF) { + return text.slice(1); + } + + return text; + } +}; + +var repeatWord = { + name: 'common/other/repeatWord', + handler: function handler(text, settings, context) { + var punc = '[;:,.?! \n' + getData('common/quote') + ']'; + var re = new RegExp('(' + punc + '|^)' + '([' + context.getData('char') + ']{' + settings.min + ',}) ' + '\\2(' + punc + '|$)', 'gi'); + return text.replace(re, '$1$2$3'); + }, + settings: { + min: 2 + }, + disabled: true +}; + +Typograf.addRules([delBOM, repeatWord]); + +var apostrophe = { + name: 'common/punctuation/apostrophe', + handler: function handler(text, settings, context) { + var letters = '([' + context.getData('char') + '])'; + var re = new RegExp(letters + '\'' + letters, 'gi'); + return text.replace(re, '$1’$2'); + } +}; + +var delDoublePunctuation = { + name: 'common/punctuation/delDoublePunctuation', + handler: function handler(text) { + return text.replace(/(^|[^,]),,(?!,)/g, '$1,').replace(/(^|[^:])::(?!:)/g, '$1:').replace(/(^|[^!?.])\.\.(?!\.)/g, '$1.').replace(/(^|[^;]);;(?!;)/g, '$1;').replace(/(^|[^?])\?\?(?!\?)/g, '$1?'); + } +}; + +var hellip = { + name: 'common/punctuation/hellip', + handler: function handler(text, settings, context) { + return context.prefs.locale[0] === 'ru' ? text.replace(/(^|[^.])\.{3,4}(?=[^.]|$)/g, '$1…') : text.replace(/(^|[^.])\.{3}(\.?)(?=[^.]|$)/g, '$1…$2'); + } +}; + +var Quote = { + bufferQuotes: { + left: "\uF005\uF006\uF007", + right: "\uF008\uF009\uF0A0" + }, + maxLevel: 3, + beforeLeft: " \n\t\xA0[(", + afterRight: " \n\t\xA0!?.:;#*,\u2026)", + process: function process(params) { + var text = params.context.text; + var count = this.count(text); + + if (!count.total) { + return text; + } + + var originalSettings = params.settings; + var isEqualQuotes = params.settings.left[0] === params.settings.right[0]; // For SW, FI + + if (isEqualQuotes) { + params.settings = deepCopy(params.settings); + params.settings.left = this.bufferQuotes.left.slice(0, params.settings.left.length); + params.settings.right = this.bufferQuotes.right.slice(0, params.settings.right.length); + } // For FR + + + if (params.settings.spacing) { + text = this.removeSpacing(text, params.settings); + } + + text = this.set(text, params); // For FR + + if (params.settings.spacing) { + text = this.setSpacing(text, params.settings); + } // For RU + + + if (params.settings.removeDuplicateQuotes) { + text = this.removeDuplicates(text, params.settings); + } // For SW, FI + + + if (isEqualQuotes) { + text = this.returnOriginalQuotes(text, originalSettings, params.settings); + params.settings = originalSettings; + } + + return text; + }, + returnOriginalQuotes: function returnOriginalQuotes(text, originalSettings, bufferSettings) { + var buffer = {}; + + for (var i = 0; i < bufferSettings.left.length; i++) { + buffer[bufferSettings.left[i]] = originalSettings.left[i]; + buffer[bufferSettings.right[i]] = originalSettings.right[i]; + } + + return text.replace(new RegExp('[' + bufferSettings.left + bufferSettings.right + ']', 'g'), function (quote) { + return buffer[quote]; + }); + }, + count: function count(text) { + var count = { + total: 0 + }; + text.replace(new RegExp('[' + getData('common/quote') + ']', 'g'), function (quote) { + if (!count[quote]) { + count[quote] = 0; + } + + count[quote]++; + count.total++; + return quote; + }); + return count; + }, + removeDuplicates: function removeDuplicates(text, settings) { + var lquote = settings.left[0]; + var lquote2 = settings.left[1] || lquote; + var rquote = settings.right[0]; + + if (lquote !== lquote2) { + return text; + } + + return text // ««word» word» -> «word» word» + .replace(new RegExp(lquote + lquote, 'g'), lquote) // «word «word»» -> «word «word» + .replace(new RegExp(rquote + rquote, 'g'), rquote); + }, + removeSpacing: function removeSpacing(text, settings) { + for (var i = 0, len = settings.left.length; i < len; i++) { + var lquote = settings.left[i]; + var rquote = settings.right[i]; + text = text.replace(new RegExp(lquote + "([ \u202F\xA0])", 'g'), lquote).replace(new RegExp("([ \u202F\xA0])" + rquote, 'g'), rquote); + } + + return text; + }, + setSpacing: function setSpacing(text, settings) { + for (var i = 0, len = settings.left.length; i < len; i++) { + var lquote = settings.left[i]; + var rquote = settings.right[i]; + text = text.replace(new RegExp(lquote + "([^\u202F])", 'g'), lquote + "\u202F$1").replace(new RegExp("([^\u202F])" + rquote, 'g'), "$1\u202F" + rquote); + } + + return text; + }, + set: function set(text, params) { + var quotes = getData('common/quote'); + var lquote = params.settings.left[0]; + var lquote2 = params.settings.left[1] || lquote; + var rquote = params.settings.right[0]; + var reL = new RegExp('(^|[' + this.beforeLeft + '])([' + quotes + ']{1,' + this.maxLevel + '})(?=[^\\s' + privateLabel + '])', 'gim'); + var reR = new RegExp('([^\\s' + privateLabel + '])([' + quotes + ']{1,' + this.maxLevel + '})(?=[' + this.afterRight + ']|$)', 'gim'); + text = text.replace(reL, function ($0, $1, $2) { + return $1 + repeat(lquote, $2.length); + }).replace(reR, function ($0, $1, $2) { + return $1 + repeat(rquote, $2.length); + }); + text = this.setAboveTags(text, params); + + if (lquote !== lquote2) { + text = this.setInner(text, params.settings); + } + + return text; + }, + setAboveTags: function setAboveTags(text, params) { + var _this = this; + + var quotes = getData('common/quote'); + var lquote = params.settings.left[0]; + var rquote = params.settings.right[0]; + return text.replace(new RegExp('(^|.)([' + quotes + '])(.|$)', 'gm'), function (original, prev, quote, next, pos) { + if (prev !== privateLabel && next !== privateLabel) { + return original; + } + + if (prev === privateLabel && next === privateLabel) { + if (quote === '"') { + return prev + _this.getAboveTwoTags(text, pos + 1, params) + next; + } + + return original; + } + + if (prev === privateLabel) { + var hasRight = _this.afterRight.indexOf(next) > -1; + + var prevInfo = _this.getPrevTagInfo(text, pos - 1, params); + + if (hasRight && prevInfo && prevInfo.group === 'html') { + return prev + (prevInfo.isClosing ? rquote : lquote) + next; + } + + return prev + (!next || hasRight ? rquote : lquote) + next; + } else { + var hasLeft = _this.beforeLeft.indexOf(prev) > -1; + + var nextInfo = _this.getNextTagInfo(text, pos + 1, params); + + if (hasLeft && nextInfo && nextInfo.group === 'html') { + return prev + (nextInfo.isClosing ? rquote : lquote) + next; + } + + return prev + (!prev || hasLeft ? lquote : rquote) + next; + } + }); + }, + getAboveTwoTags: function getAboveTwoTags(text, pos, params) { + var prevInfo = this.getPrevTagInfo(text, pos, params); + var nextInfo = this.getNextTagInfo(text, pos, params); + + if (prevInfo) { + if (prevInfo.group === 'html') { + if (!prevInfo.isClosing) { + return params.settings.left[0]; + } + + if (nextInfo && nextInfo.isClosing && prevInfo.isClosing) { + return params.settings.right[0]; + } + } + } + + return text[pos]; + }, + getPrevTagInfo: function getPrevTagInfo(text, pos, params) { + var prevLabel = params.safeTags.getPrevLabel(text, pos - 1); + + if (prevLabel) { + var prevTag = params.safeTags.getTagByLabel(params.context, prevLabel); + + if (prevTag) { + return params.safeTags.getTagInfo(prevTag); + } + } + + return null; + }, + getNextTagInfo: function getNextTagInfo(text, pos, params) { + var nextLabel = params.safeTags.getNextLabel(text, pos + 1); + + if (nextLabel) { + var nextTag = params.safeTags.getTagByLabel(params.context, nextLabel); + + if (nextTag) { + return params.safeTags.getTagInfo(nextTag); + } + } + + return null; + }, + setInner: function setInner(text, settings) { + var leftQuotes = []; + var rightQuotes = []; + + for (var k = 0; k < settings.left.length; k++) { + leftQuotes.push(settings.left[k]); + rightQuotes.push(settings.right[k]); + } + + var lquote = settings.left[0]; + var rquote = settings.right[0]; + var minLevel = -1; + var maxLevel = leftQuotes.length - 1; + var level = minLevel; + var result = ''; + + for (var i = 0, len = text.length; i < len; i++) { + var letter = text[i]; + + if (letter === lquote) { + level++; + + if (level > maxLevel) { + level = maxLevel; + } + + result += leftQuotes[level]; + } else if (letter === rquote) { + if (level <= minLevel) { + level = 0; + result += rightQuotes[level]; + } else { + result += rightQuotes[level]; + level--; + + if (level < minLevel) { + level = minLevel; + } + } + } else { + if (letter === '"') { + level = minLevel; + } + + result += letter; + } + } + + var count = this.count(result, settings); + return count[lquote] !== count[rquote] ? text : result; + } +}; +var quote = { + name: 'common/punctuation/quote', + handler: function handler(text, commonSettings, context) { + var locale = context.prefs.locale[0]; + var settings = commonSettings[locale]; + + if (!settings) { + return text; + } + + return Quote.process({ + context: context, + settings: settings, + safeTags: this._safeTags + }); + }, + settings: function settings() { + var settings = {}; + getLocales().forEach(function (locale) { + settings[locale] = deepCopy(getData(locale + '/quote')); + }); + return settings; + } +}; + +var quoteLink = { + name: 'common/punctuation/quoteLink', + queue: 'show-safe-tags-html', + index: '+5', + handler: function handler(text, settings, context) { + var quotes = this.getSetting('common/punctuation/quote', context.prefs.locale[0]); + + if (!quotes) { + return text; + } + + var lquote1 = HtmlEntities$1.getByUtf(quotes.left[0]); + var rquote1 = HtmlEntities$1.getByUtf(quotes.right[0]); + var lquote2 = HtmlEntities$1.getByUtf(quotes.left[1]); + var rquote2 = HtmlEntities$1.getByUtf(quotes.right[1]); + lquote2 = lquote2 ? '|' + lquote2 : ''; + rquote2 = rquote2 ? '|' + rquote2 : ''; + var re = new RegExp('(<[aA]\\s[^>]*?>)(' + lquote1 + lquote2 + ')([^]*?)(' + rquote1 + rquote2 + ')()', 'g'); + return text.replace(re, '$2$1$3$5$4'); + } +}; + +Typograf.addRules([apostrophe, delDoublePunctuation, hellip, quote, quoteLink]); + +var afterPunctuation = { + name: 'common/space/afterPunctuation', + handler: function handler(text) { + var reExcl = new RegExp('(!|;|\\?)([^).…!;?\\s[\\])' + privateLabel + getData('common/quote') + '])', 'g'); + var reComma = new RegExp('(\\D)(,|:)([^)",:.?\\s\\/\\\\' + privateLabel + '])', 'g'); + return text.replace(reExcl, '$1 $2').replace(reComma, '$1$2 $3'); + } +}; + +var beforeBracket = { + name: 'common/space/beforeBracket', + handler: function handler(text, settings, context) { + var re = new RegExp('([' + context.getData('char') + '.!?,;…)])\\(', 'gi'); + return text.replace(re, '$1 ('); + } +}; + +var bracket = { + name: 'common/space/bracket', + handler: function handler(text) { + return text.replace(/(\() +/g, '(').replace(/ +\)/g, ')'); + } +}; + +var delBeforePercent = { + name: 'common/space/delBeforePercent', + handler: function handler(text) { + return text.replace(/(\d)( |\u00A0)(%|‰|‱)/g, '$1$3'); + } +}; + +var delBeforePunctuation = { + name: 'common/space/delBeforePunctuation', + handler: function handler(text) { + return text.replace(/([!?]) (?=[!?])/g, '$1').replace(/(^|[^!?:;,.…]) ([!?:;,.])(?!\))/g, '$1$2'); + } +}; + +var delLeadingBlanks = { + name: 'common/space/delLeadingBlanks', + handler: function handler(text) { + return text.replace(/^[ \t]+/mg, ''); + }, + disabled: true +}; + +var delRepeatN = { + name: 'common/space/delRepeatN', + index: '-1', + handler: function handler(text, settings) { + var maxConsecutiveLineBreaks = settings.maxConsecutiveLineBreaks; + var consecutiveLineBreaksRegex = new RegExp("\n{".concat(maxConsecutiveLineBreaks + 1, ",}"), 'g'); + var replaceValue = repeat('\n', maxConsecutiveLineBreaks); + return text.replace(consecutiveLineBreaksRegex, replaceValue); + }, + settings: { + maxConsecutiveLineBreaks: 2 + } +}; + +var delRepeatSpace = { + name: 'common/space/delRepeatSpace', + index: '-1', + handler: function handler(text) { + return text.replace(/([^\n \t])[ \t]{2,}(?![\n \t])/g, '$1 '); + } +}; + +var delTrailingBlanks = { + name: 'common/space/delTrailingBlanks', + index: '-3', + handler: function handler(text) { + return text.replace(/[ \t]+\n/g, '\n'); + } +}; + +var insertFinalNewline = { + name: 'common/space/insertFinalNewline', + live: false, + disabled: true, + queue: 'end', + handler: function handler(text) { + return text[text.length - 1] === '\n' ? text : text + '\n'; + } +}; + +var replaceTab = { + name: 'common/space/replaceTab', + index: '-5', + handler: function handler(text) { + return text.replace(/\t/g, ' '); + } +}; + +var squareBracket = { + name: 'common/space/squareBracket', + handler: function handler(text) { + return text.replace(/(\[) +/g, '[').replace(/ +\]/g, ']'); + } +}; + +var trimLeft = { + name: 'common/space/trimLeft', + index: '-4', + handler: String.prototype.trimLeft ? function (text) { + return text.trimLeft(); + } : + /* istanbul ignore next */ + function (text) { + return text.replace(/^[\s\uFEFF\xA0]+/g, ''); + } +}; + +var trimRight = { + name: 'common/space/trimRight', + index: '-3', + live: false, + handler: String.prototype.trimRight ? function (text) { + return text.trimRight(); + } : + /* istanbul ignore next */ + function (text) { + return text.replace(/[\s\uFEFF\xA0]+$/g, ''); + } +}; + +Typograf.addRules([afterPunctuation, beforeBracket, bracket, delBeforePercent, delBeforePunctuation, delLeadingBlanks, delRepeatN, delRepeatSpace, delTrailingBlanks, insertFinalNewline, replaceTab, squareBracket, trimLeft, trimRight]); + +var arrow = { + name: 'common/symbols/arrow', + handler: function handler(text) { + return replace(text, [[/(^|[^-])->(?!>)/g, '$1→'], [/(^|[^<])<-(?!-)/g, '$1←']]); + } +}; + +var cf = { + name: 'common/symbols/cf', + handler: function handler(text) { + var re = new RegExp("(^|[\\s(\\[+\u2248\xB1\u2212\u2014\u2013\\-])(\\d+(?:[.,]\\d+)?)[ \xA0\u2009]?(C|F)([\\W\\s.,:!?\")\\]]|$)", 'mg'); + return text.replace(re, "$1$2\u2009\xB0$3$4"); + } +}; + +var copy = { + name: 'common/symbols/copy', + handler: function handler(text) { + return replace(text, [[/\(r\)/gi, '®'], [/(copyright )?\((c|с)\)/gi, '©'], [/\(tm\)/gi, '™']]); + } +}; + +Typograf.addRules([arrow, cf, copy]); + +var main = { + name: 'en-US/dash/main', + index: '-5', + handler: function handler(text) { + var dashes = getData('common/dash'); + var nonBreakingSpace = "\xA0"; + var emDash = "\u2014"; + var spaceBefore = "[ ".concat(nonBreakingSpace, "]"); // white space or a non-breaking space + + var spaceAfter = "[ ".concat(nonBreakingSpace, "\n]"); // same as spaceBefore, but includes line break + + var re = new RegExp("".concat(spaceBefore, "(").concat(dashes, ")(").concat(spaceAfter, ")"), 'g'); + return text.replace(re, "".concat(nonBreakingSpace).concat(emDash, "$2")); + } +}; + +Typograf.addRules([main]); + +var centuries = { + name: 'ru/dash/centuries', + handler: function handler(text, settings) { + var dashes = '(' + getData('common/dash') + ')'; + var re = new RegExp("(X|I|V)[ |\xA0]?" + dashes + "[ |\xA0]?(X|I|V)", 'g'); + return text.replace(re, '$1' + settings.dash + '$3'); + }, + settings: { + dash: "\u2013" // – + + } +}; + +var daysMonth = { + name: 'ru/dash/daysMonth', + handler: function handler(text, settings) { + var re = new RegExp('(^|\\s)([123]?\\d)' + '(' + getData('common/dash') + ')' + "([123]?\\d)[ \xA0]" + '(' + getData('ru/monthGenCase') + ')', 'g'); + return text.replace(re, '$1$2' + settings.dash + "$4\xA0$5"); + }, + settings: { + dash: "\u2013" // – + + } +}; + +var de$1 = { + name: 'ru/dash/de', + handler: function handler(text) { + var re = new RegExp('([a-яё]+) де' + getData('ru/dashAfterDe'), 'g'); + return text.replace(re, '$1-де'); + }, + disabled: true +}; + +var decade = { + name: 'ru/dash/decade', + handler: function handler(text, settings) { + var re = new RegExp('(^|\\s)(\\d{3}|\\d)0' + '(' + getData('common/dash') + ')' + "(\\d{3}|\\d)0(-\u0435[ \xA0])" + "(?=\u0433\\.?[ \xA0]?\u0433|\u0433\u043E\u0434)", 'g'); + return text.replace(re, '$1$20' + settings.dash + '$40$5'); + }, + settings: { + dash: "\u2013" // – + + } +}; + +var directSpeech = { + name: 'ru/dash/directSpeech', + handler: function handler(text) { + var dashes = getData('common/dash'); + var re1 = new RegExp("([\"\xBB\u2018\u201C,])[ |\xA0]?(".concat(dashes, ")[ |\xA0]"), 'g'); + var re2 = new RegExp("(^|".concat(privateLabel, ")(").concat(dashes, ")( |\xA0)"), 'gm'); + var re3 = new RegExp("([.\u2026?!])[ \xA0](".concat(dashes, ")[ \xA0]"), 'g'); + return text.replace(re1, "$1\xA0\u2014 ").replace(re2, "$1\u2014\xA0").replace(re3, "$1 \u2014\xA0"); + } +}; + +var izpod = { + name: 'ru/dash/izpod', + handler: function handler(text) { + var re = new RegExp(getData('ru/dashBefore') + '(И|и)з под' + getData('ru/dashAfter'), 'g'); + return text.replace(re, '$1$2з-под'); + } +}; + +var izza = { + name: 'ru/dash/izza', + handler: function handler(text) { + var re = new RegExp(getData('ru/dashBefore') + '(И|и)з за' + getData('ru/dashAfter'), 'g'); + return text.replace(re, '$1$2з-за'); + } +}; + +var ka = { + name: 'ru/dash/ka', + handler: function handler(text) { + var re = new RegExp('([a-яё]+) ка(сь)?' + getData('ru/dashAfter'), 'g'); + return text.replace(re, '$1-ка$2'); + } +}; + +var koe = { + name: 'ru/dash/koe', + handler: function handler(text) { + var re = new RegExp(getData('ru/dashBefore') + '([Кк]о[ей])\\s([а-яё]{3,})' + getData('ru/dashAfter'), 'g'); + return text.replace(re, '$1$2-$3'); + } +}; + +var main$1 = { + name: 'ru/dash/main', + index: '-5', + handler: function handler(text) { + var dashes = getData('common/dash'); + var re = new RegExp("([ \xA0])(" + dashes + ")([ \xA0\\n])", 'g'); + return text.replace(re, "\xA0\u2014$3"); + } +}; + +var month = { + name: 'ru/dash/month', + handler: function handler(text, settings) { + var months = '(' + getData('ru/month') + ')'; + var monthsPre = '(' + getData('ru/monthPreCase') + ')'; + var dashes = getData('common/dash'); + var re = new RegExp(months + ' ?(' + dashes + ') ?' + months, 'gi'); + var rePre = new RegExp(monthsPre + ' ?(' + dashes + ') ?' + monthsPre, 'gi'); + var newSubStr = '$1' + settings.dash + '$3'; + return text.replace(re, newSubStr).replace(rePre, newSubStr); + }, + settings: { + dash: "\u2013" // – + + } +}; + +var surname = { + name: 'ru/dash/surname', + handler: function handler(text) { + var re = new RegExp('([А-ЯЁ][а-яё]+)\\s-([а-яё]{1,3})(?![^а-яё]|$)', 'g'); + return text.replace(re, "$1\xA0\u2014$2"); + } +}; + +var taki = { + name: 'ru/dash/taki', + handler: function handler(text) { + var re = new RegExp('(верно|довольно|опять|прямо|так|вс[её]|действительно|неужели)\\s(таки)' + getData('ru/dashAfter'), 'g'); + return text.replace(re, '$1-$2'); + } +}; + +var time = { + name: 'ru/dash/time', + handler: function handler(text, settings) { + var re = new RegExp(getData('ru/dashBefore') + '(\\d?\\d:[0-5]\\d)' + getData('common/dash') + '(\\d?\\d:[0-5]\\d)' + getData('ru/dashAfter'), 'g'); + return text.replace(re, '$1$2' + settings.dash + '$3'); + }, + settings: { + dash: "\u2013" // – + + } +}; + +var to = { + name: 'ru/dash/to', + handler: function handler(text) { + var words = ['откуда', 'куда', 'где', 'когда', 'зачем', 'почему', 'как', 'како[ейм]', 'какая', 'каки[емх]', 'какими', 'какую', 'что', 'чего', 'че[йм]', 'чьим?', 'кто', 'кого', 'кому', 'кем']; + var re = new RegExp('(' + words.join('|') + ')( | -|- )(то|либо|нибудь)' + getData('ru/dashAfter'), 'gi'); + return text.replace(re, '$1-$3'); + } +}; + +var weekday = { + name: 'ru/dash/weekday', + handler: function handler(text, settings) { + var part = '(' + getData('ru/weekday') + ')'; + var re = new RegExp(part + ' ?(' + getData('common/dash') + ') ?' + part, 'gi'); + return text.replace(re, '$1' + settings.dash + '$3'); + }, + settings: { + dash: "\u2013" // – + + } +}; + +var years = { + name: 'ru/dash/years', + handler: function handler(text, settings) { + var dashes = getData('common/dash'); + var re = new RegExp("(\\D|^)(\\d{4})[ \xA0]?(" + dashes + ")[ \xA0]?(\\d{4})(?=[ \xA0]?\u0433)", 'g'); + return text.replace(re, function ($0, $1, $2, $3, $4) { + if (parseInt($2, 10) < parseInt($4, 10)) { + return $1 + $2 + settings.dash + $4; + } + + return $0; + }); + }, + settings: { + dash: "\u2013" // – + + } +}; + +Typograf.addRules([centuries, daysMonth, de$1, decade, directSpeech, izpod, izza, ka, koe, main$1, month, surname, taki, time, to, weekday, years]); + +var fromISO = { + name: 'ru/date/fromISO', + handler: function handler(text) { + var sp1 = '(-|\\.|\\/)'; + var sp2 = '(-|\\/)'; + var re1 = new RegExp('(^|\\D)(\\d{4})' + sp1 + '(\\d{2})' + sp1 + '(\\d{2})(\\D|$)', 'gi'); + var re2 = new RegExp('(^|\\D)(\\d{2})' + sp2 + '(\\d{2})' + sp2 + '(\\d{4})(\\D|$)', 'gi'); + return text.replace(re1, '$1$6.$4.$2$7').replace(re2, '$1$4.$2.$6$7'); + } +}; + +var weekday$1 = { + name: 'ru/date/weekday', + handler: function handler(text) { + var space = "( |\xA0)"; + var monthCase = getData('ru/monthGenCase'); + var weekday = getData('ru/weekday'); + var re = new RegExp('(\\d)' + space + '(' + monthCase + '),' + space + '(' + weekday + ')', 'gi'); + return text.replace(re, function () { + var a = arguments; + return a[1] + a[2] + a[3].toLowerCase() + ',' + a[4] + a[5].toLowerCase(); + }); + } +}; + +Typograf.addRules([fromISO, weekday$1]); + +var currency = { + name: 'ru/money/currency', + handler: function handler(text) { + var currency = '([$€¥Ұ£₤₽])'; + var space = "[ \xA0\u2009\u202F]"; + var re1 = new RegExp('(^|[\\D]{2})' + currency + ' ?([\\d.,]+(' + space + '\\d{3})*)(' + space + '?(тыс\\.|млн|млрд|трлн))?', 'gm'); + var re2 = new RegExp('(^|[\\D])([\\d.,]+) ?' + currency, 'gm'); + return text.replace(re1, function ($0, $1, $2, $3, $4, $5, $6) { + return $1 + $3 + ($6 ? "\xA0" + $6 : '') + "\xA0" + $2; + }).replace(re2, "$1$2\xA0$3"); + }, + disabled: true +}; + +var ruble = { + name: 'ru/money/ruble', + handler: function handler(text) { + var newSubstr = "$1\xA0\u20BD"; + var commonPart = "(\\d+)( |\xA0)?(\u0440|\u0440\u0443\u0431)\\."; + var re1 = new RegExp('^' + commonPart + '$', 'g'); + var re2 = new RegExp(commonPart + '(?=[!?,:;])', 'g'); + var re3 = new RegExp(commonPart + '(?=\\s+[A-ЯЁ])', 'g'); + return text.replace(re1, newSubstr).replace(re2, newSubstr).replace(re3, newSubstr + '.'); + }, + disabled: true +}; + +Typograf.addRules([currency, ruble]); + +var abbr = { + name: 'ru/nbsp/abbr', + handler: function handler(text) { + function abbr($0, $1, $2, $3) { + // дд.мм.гггг + if ($2 === 'дд' && $3 === 'мм') { + return $0; + } // Являются ли сокращения ссылкой + + + if (['рф', 'ру', 'рус', 'орг', 'укр', 'бг', 'срб'].indexOf($3) > -1) { + return $0; + } + + return $1 + $2 + '.' + "\xA0" + $3 + '.'; + } + + var re = new RegExp("(^|\\s|".concat(privateLabel, ")([\u0430-\u044F\u0451]{1,3})\\. ?([\u0430-\u044F\u0451]{1,3})\\."), 'g'); + return text.replace(re, abbr) // Для тройных сокращений - а.е.м. + .replace(re, abbr); + } +}; + +var addr = { + name: 'ru/nbsp/addr', + handler: function handler(text) { + return text.replace(/(\s|^)(дом|д\.|кв\.|под\.|п-д) *(\d+)/gi, "$1$2\xA0$3").replace(/(\s|^)(мкр-н|мк-н|мкр\.|мкрн)\s/gi, "$1$2\xA0") // микрорайон + .replace(/(\s|^)(эт\.) *(-?\d+)/gi, "$1$2\xA0$3").replace(/(\s|^)(\d+) +этаж([^а-яё]|$)/gi, "$1$2\xA0\u044D\u0442\u0430\u0436$3").replace(/(\s|^)литер\s([А-Я]|$)/gi, "$1\u043B\u0438\u0442\u0435\u0440\xA0$2") + /* + область, край, станция, поселок, село, + деревня, улица, переулок, проезд, проспект, + бульвар, площадь, набережная, шоссе, + тупик, офис, комната, участок, владение, строение, корпус + */ + .replace(/(\s|^)(обл|кр|ст|пос|с|д|ул|пер|пр|пр-т|просп|пл|бул|б-р|наб|ш|туп|оф|комн?|уч|вл|влад|стр|кор)\. *([а-яёa-z\d]+)/gi, "$1$2.\xA0$3") // город + .replace(/(\D[ \u00A0]|^)г\. ?([А-ЯЁ])/gm, "$1\u0433.\xA0$2"); + } +}; + +var afterNumberSign = { + name: 'ru/nbsp/afterNumberSign', + handler: function handler(text) { + // \u2009 - THIN SPACE + // \u202F - NARROW NO-BREAK SPACE + return text.replace(/№[ \u00A0\u2009]?(\d|п\/п)/g, "\u2116\u202F$1"); + } +}; + +var beforeParticle = { + name: 'ru/nbsp/beforeParticle', + index: '+5', + handler: function handler(text) { + var particles = '(ли|ль|же|ж|бы|б)'; + var re1 = new RegExp('([А-ЯЁа-яё]) ' + particles + '(?=[,;:?!"‘“»])', 'g'); + var re2 = new RegExp("([\u0410-\u042F\u0401\u0430-\u044F\u0451])[ \xA0]" + particles + "[ \xA0]", 'g'); + return text.replace(re1, "$1\xA0$2").replace(re2, "$1\xA0$2 "); + } +}; + +var centuries$1 = { + name: 'ru/nbsp/centuries', + handler: function handler(text) { + var dashes = getData('common/dash'); + var before = '(^|\\s)([VIX]+)'; + var after = '(?=[,;:?!"‘“»]|$)'; + var re1 = new RegExp(before + "[ \xA0]?\u0432\\.?" + after, 'gm'); + var re2 = new RegExp(before + '(' + dashes + ')' + "([VIX]+)[ \xA0]?\u0432\\.?([ \xA0]?\u0432\\.?)?" + after, 'gm'); + return text.replace(re1, "$1$2\xA0\u0432.").replace(re2, "$1$2$3$4\xA0\u0432\u0432."); + } +}; + +var dayMonth = { + name: 'ru/nbsp/dayMonth', + handler: function handler(text) { + var re = new RegExp('(\\d{1,2}) (' + getData('ru/shortMonth') + ')', 'gi'); + return text.replace(re, "$1\xA0$2"); + } +}; + +var initials = { + name: 'ru/nbsp/initials', + handler: function handler(text) { + var spaces = "\xA0\u202F "; // nbsp, thinsp + + var quote = getData('ru/quote'); + var re = new RegExp('(^|[' + spaces + quote.left + privateLabel + '"])([А-ЯЁ])\\.[' + spaces + ']?([А-ЯЁ])\\.[' + spaces + ']?([А-ЯЁ][а-яё]+)(?=[\\s.,;:?!"' + quote.right + ']|$)', 'gm'); + return text.replace(re, "$1$2.\xA0$3.\xA0$4"); + } +}; + +var m = { + name: 'ru/nbsp/m', + index: '+5', + handler: function handler(text) { + var re = new RegExp('(^|[\\s,.\\(' + privateLabel + '])' + "(\\d+)[ \xA0]?(\u043C\u043C?|\u0441\u043C|\u043A\u043C|\u0434\u043C|\u0433\u043C|mm?|km|cm|dm)([23\xB2\xB3])?([\\s\\).!?,;" + privateLabel + ']|$)', 'gm'); + return text.replace(re, function ($0, $1, $2, $3, $4, $5) { + var pow = { + '2': '²', + '²': '²', + '3': '³', + '³': '³', + '': '' + }[$4 || '']; + return $1 + $2 + "\xA0" + $3 + pow + ($5 === "\xA0" ? ' ' : $5); + }); + } +}; + +var mln = { + name: 'ru/nbsp/mln', + handler: function handler(text) { + return text.replace(/(\d) ?(тыс|млн|млрд|трлн)(\.|\s|$)/gi, "$1\xA0$2$3"); + } +}; + +var ooo = { + name: 'ru/nbsp/ooo', + handler: function handler(text) { + return text.replace(/(^|[^a-яёA-ЯЁ])(ООО|ОАО|ЗАО|НИИ|ПБОЮЛ) /g, "$1$2\xA0"); + } +}; + +var page = { + name: 'ru/nbsp/page', + handler: function handler(text) { + var re = new RegExp('(^|[)\\s' + privateLabel + '])' + '(стр|гл|рис|илл?|ст|п|c)\\. *(\\d+)([\\s.,?!;:]|$)', 'gim'); + return text.replace(re, "$1$2.\xA0$3$4"); + } +}; + +var ps = { + name: 'ru/nbsp/ps', + handler: function handler(text) { + var re = new RegExp("(^|\\s|".concat(privateLabel, ")[p\u0437]\\.[ \xA0]?([p\u0437]\\.[ \xA0]?)?[s\u044B]\\.:? "), 'gim'); + return text.replace(re, function ($0, $1, $2) { + return $1 + ($2 ? "P.\xA0P.\xA0S. " : "P.\xA0S. "); + }); + } +}; + +var rubleKopek = { + name: 'ru/nbsp/rubleKopek', + handler: function handler(text) { + return text.replace(/(\d) ?(?=(руб|коп)\.)/g, "$1\xA0"); + } +}; + +var see = { + name: 'ru/nbsp/see', + handler: function handler(text) { + var re = new RegExp("(^|\\s|".concat(privateLabel, "|\\()(\u0441\u043C|\u0438\u043C)\\.[ \xA0]?([\u0430-\u044F\u04510-9a-z]+)([\\s.,?!]|$)"), 'gi'); + return text.replace(re, function ($0, $1, $2, $3, $4) { + return ($1 === "\xA0" ? ' ' : $1) + $2 + ".\xA0" + $3 + $4; + }); + } +}; + +var year = { + name: 'ru/nbsp/year', + handler: function handler(text) { + return text.replace(/(^|\D)(\d{4}) ?г([ ,;.\n]|$)/g, "$1$2\xA0\u0433$3"); + } +}; + +var years$1 = { + name: 'ru/nbsp/years', + index: '+5', + handler: function handler(text) { + var dashes = getData('common/dash'); + var re = new RegExp('(^|\\D)(\\d{4})(' + dashes + ")(\\d{4})[ \xA0]?\u0433\\.?([ \xA0]?\u0433\\.)?(?=[,;:?!\"\u2018\u201C\xBB\\s]|$)", 'gm'); + return text.replace(re, "$1$2$3$4\xA0\u0433\u0433."); + } +}; + +Typograf.addRules([abbr, addr, afterNumberSign, beforeParticle, centuries$1, dayMonth, initials, m, mln, ooo, page, ps, rubleKopek, see, year, years$1]); + +var comma = { + name: 'ru/number/comma', + handler: function handler(text) { + // \u00A0 - NO-BREAK SPACE + // \u2009 - THIN SPACE + // \u202F - NARROW NO-BREAK SPACE + return text.replace(/(^|\s)(\d+)\.(\d+[\u00A0\u2009\u202F ]*?[%‰°×x])/gim, '$1$2,$3'); + } +}; + +var ordinals = { + name: 'ru/number/ordinals', + handler: function handler(text, settings, context) { + var re = new RegExp('(\\d[%‰]?)-(ый|ой|ая|ое|ые|ым|ом|ых|ого|ому|ыми)(?![' + context.getData('char') + '])', 'g'); + return text.replace(re, function ($0, $1, $2) { + var parts = { + 'ой': 'й', + 'ый': 'й', + 'ая': 'я', + 'ое': 'е', + 'ые': 'е', + 'ым': 'м', + 'ом': 'м', + 'ых': 'х', + 'ого': 'го', + 'ому': 'му', + 'ыми': 'ми' + }; + return $1 + '-' + parts[$2]; + }); + } +}; + +Typograf.addRules([comma, ordinals]); + +function removeOptAlignTags(text, classNames) { + var re = new RegExp('([^]*?)', 'g'); + return text.replace(re, '$2'); +} +function removeOptAlignTagsFromTitle(text, classNames) { + return text.replace(/[^]*?<\/title>/i, function (text) { + return removeOptAlignTags(text, classNames); + }); +} + +var classNames = ['typograf-oa-lbracket', 'typograf-oa-n-lbracket', 'typograf-oa-sp-lbracket']; +var name = 'ru/optalign/bracket'; +var bracket$1 = { + name: name, + handler: function handler(text) { + return text.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: true, + htmlAttrs: false +}; +var innerStartBracket = { + name: name, + queue: 'start', + handler: function handler(text) { + return removeOptAlignTags(text, classNames); + } +}; +var innerEndBracket = { + name: name, + queue: 'end', + handler: function handler(text) { + return removeOptAlignTagsFromTitle(text, classNames); + } +}; + +var classNames$1 = ['typograf-oa-comma', 'typograf-oa-comma-sp']; +var name$1 = 'ru/optalign/comma'; +var comma$1 = { + name: name$1, + handler: function handler(text, settings, context) { + var re = new RegExp('([' + context.getData('char') + "\\d\u0301]+), ", 'gi'); + return text.replace(re, '$1<span class="typograf-oa-comma">,</span><span class="typograf-oa-comma-sp"> </span>'); + }, + disabled: true, + htmlAttrs: false +}; +var innerStartComma = { + name: name$1, + queue: 'start', + handler: function handler(text) { + return removeOptAlignTags(text, classNames$1); + } +}; +var innerEndComma = { + name: name$1, + queue: 'end', + handler: function handler(text) { + return removeOptAlignTagsFromTitle(text, classNames$1); + } +}; + +var classNames$2 = ['typograf-oa-lquote', 'typograf-oa-n-lquote', 'typograf-oa-sp-lquote']; +var name$2 = 'ru/optalign/quote'; +var quote$1 = { + name: name$2, + handler: function handler(text) { + var quote = this.getSetting('common/punctuation/quote', 'ru'); + var lquotes = '([' + quote.left[0] + (quote.left[1] || '') + '])'; + var reNewLine = new RegExp('(^|\n\n|' + privateLabel + ')(' + lquotes + ')', 'g'); + var reInside = new RegExp('([^\n' + privateLabel + "])([ \xA0\n])(" + lquotes + ')', 'gi'); + return text.replace(reNewLine, '$1<span class="typograf-oa-n-lquote">$2</span>').replace(reInside, '$1<span class="typograf-oa-sp-lquote">$2</span><span class="typograf-oa-lquote">$3</span>'); + }, + disabled: true, + htmlAttrs: false +}; +var innerStartQuote = { + name: name$2, + queue: 'start', + handler: function handler(text) { + return removeOptAlignTags(text, classNames$2); + } +}; +var innerEndQuote = { + name: name$2, + queue: 'end', + handler: function handler(text) { + return removeOptAlignTagsFromTitle(text, classNames$2); + } +}; + +Typograf.addRules([bracket$1, comma$1, quote$1]); +Typograf.addInnerRules([innerStartBracket, innerEndBracket, innerStartComma, innerEndComma, innerStartQuote, innerEndQuote]); + +var accent = { + name: 'ru/other/accent', + handler: function handler(text) { + return text.replace(/([а-яё])([АЕЁИОУЫЭЮЯ])([^А-ЯЁ\w]|$)/g, function ($0, $1, $2, $3) { + return $1 + $2.toLowerCase() + "\u0301" + $3; + }); + }, + disabled: true +}; + +var defaultCityCodeLength = 5; +var countryCode = '7'; +var exceptions = []; +var exceptionsMax = 8; +var exceptionsMin = 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, 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 (num) { + if (typeof num === 'string') { + var buf = num.split('-'); + + for (var i = +buf[0]; i <= +buf[1]; i++) { + exceptions.push(i); + } + } else { + exceptions.push(num); + } +}); + +function phone(num) { + var firstSym = num[0]; + var cityCode = ''; + var hasPlusWithCode; + var hasEight; + + if (num.length < 8) { + return phoneBlocks(num); + } // 8 495 123-45-67, +7 495 123-45-67 + + + if (num.length > 10) { + if (firstSym === '+') { + if (num[1] === countryCode) { + hasPlusWithCode = true; + num = num.substr(2); + } else { + return num; + } + } else if (firstSym === '8') { + hasEight = true; + num = num.substr(1); + } + } + + for (var cityCodeLen = exceptionsMax; cityCodeLen >= exceptionsMin; cityCodeLen--) { + var code = +num.substr(0, cityCodeLen); + + if (exceptions.indexOf(code) > -1) { + cityCode = num.substr(0, cityCodeLen); + num = num.substr(cityCodeLen); + break; + } + } + + if (!cityCode) { + cityCode = num.substr(0, defaultCityCodeLength); + num = num.substr(defaultCityCodeLength); + } + + return (hasPlusWithCode ? '+' + countryCode + "\xA0" : '') + (hasEight ? "8\xA0" : '') + prepareCode(cityCode) + "\xA0" + phoneBlocks(num); +} + +function prepareCode(code) { + var numCode = +code; + var len = code.length; + var result = [code]; + var withoutBrackets = false; + + if (len > 3) { + switch (len) { + case 4: + result = [code.substr(0, 2), code.substr(2, 2)]; + break; + + case 5: + result = [code.substr(0, 3), code.substr(3, 3)]; + break; + + case 6: + result = [code.substr(0, 2), code.substr(2, 2), code.substr(4, 2)]; + break; + } + } else { + // Мобильные и московские номера без скобок + withoutBrackets = numCode > 900 && numCode <= 999 || numCode === 495 || numCode === 499; + } + + result = result.join('-'); + return withoutBrackets ? result : '(' + result + ')'; +} + +function phoneBlocks(num) { + var add = ''; + + if (num.length % 2) { + add = num[0]; + add += num.length <= 5 ? '-' : ''; + num = num.substr(1, num.length - 1); + } + + return add + num.split(/(?=(?:\d\d)+$)/).join('-'); +} + +function clearPhone(text) { + return text.replace(/[^\d+]/g, ''); +} + +var phoneNumber = { + name: 'ru/other/phone-number', + live: false, + handler: function handler(text) { + var re = new RegExp('(^|,| |' + privateLabel + ")(\\+7[\\d\\(\\) \xA0-]{10,18})(?=,|;|" + privateLabel + '|$)', 'gm'); + return text.replace(re, function ($0, $1, $2) { + var buf = clearPhone($2); + return buf.length === 12 ? $1 + phone(buf) : $0; + }).replace( // eslint-disable-next-line no-misleading-character-class + /(^|[^а-яё])([☎☏✆📠📞📱]|т\.|тел\.|ф\.|моб\.|факс|сотовый|мобильный|телефон)(:?\s*?)([+\d(][\d \u00A0\-()]{3,}\d)/gi, function ($0, $1, $2, $3, $4) { + var buf = clearPhone($4); + + if (buf.length >= 5) { + return $1 + $2 + $3 + phone(buf); + } + + return $0; + }); + } +}; + +Typograf.addRules([accent, phoneNumber]); + +var ano = { + name: 'ru/punctuation/ano', + handler: function handler(text) { + var re = new RegExp("([^!?,:;\\-\u2012\u2013\u2014\\s])(\\s+)(\u0430|\u043D\u043E)(?= |\xA0|\\n)", 'g'); + return text.replace(re, '$1,$2$3'); + }, + // Запятая может идти после ссылки. + queue: 'hide-safe-tags-html' +}; + +var exclamation = { + name: 'ru/punctuation/exclamation', + live: false, + handler: function handler(text) { + return text.replace(/(^|[^!])!{2}($|[^!])/gm, '$1!$2').replace(/(^|[^!])!{4}($|[^!])/gm, '$1!!!$2'); + } +}; + +var exclamationQuestion = { + name: 'ru/punctuation/exclamationQuestion', + index: '+5', + handler: function handler(text) { + var re = new RegExp('(^|[^!])!\\?([^?]|$)', 'g'); + return text.replace(re, '$1?!$2'); + } +}; + +var hellipQuestion = { + name: 'ru/punctuation/hellipQuestion', + handler: function handler(text) { + return text.replace(/(^|[^.])(\.\.\.|…),/g, '$1…').replace(/(!|\?)(\.\.\.|…)(?=[^.]|$)/g, '$1..'); + } +}; + +Typograf.addRules([ano, exclamation, exclamationQuestion, hellipQuestion]); + +var afterHellip = { + name: 'ru/space/afterHellip', + handler: function handler(text) { + return text.replace(/([а-яё])(\.\.\.|…)([А-ЯЁ])/g, '$1$2 $3').replace(/([?!]\.\.)([а-яёa-z])/gi, '$1 $2'); + } +}; + +var year$1 = { + name: 'ru/space/year', + handler: function handler(text, settings, context) { + var re = new RegExp("(^| |\xA0)(\\d{3,4})(\u0433\u043E\u0434([\u0430\u0443\u0435]|\u043E\u043C)?)([^" + context.getData('char') + ']|$)', 'g'); + return text.replace(re, '$1$2 $3$5'); + } +}; + +Typograf.addRules([afterHellip, year$1]); + +var nn = { + name: 'ru/symbols/NN', + handler: function handler(text) { + return text.replace(/№№/g, '№'); + } +}; + +Typograf.addRules([nn]); + +var replacements = { + A: 'А', + // Latin: Russian + a: 'а', + B: 'В', + E: 'Е', + e: 'е', + K: 'К', + M: 'М', + H: 'Н', + O: 'О', + o: 'о', + P: 'Р', + p: 'р', + C: 'С', + c: 'с', + T: 'Т', + y: 'у', + X: 'Х', + x: 'х' +}; +var keys = Object.keys(replacements).join(''); +var switchingKeyboardLayout = { + name: 'ru/typo/switchingKeyboardLayout', + handler: function handler(text) { + var re = new RegExp('([' + keys + ']{1,3})(?=[А-ЯЁа-яё]+?)', 'g'); + return text.replace(re, function (str, $1) { + var result = ''; + + for (var i = 0; i < $1.length; i++) { + result += replacements[$1[i]]; + } + + return result; + }); + } +}; + +Typograf.addRules([switchingKeyboardLayout]); + +var titles = { + "common/html/e-mail": { + "en-US": "Placement of links for e-mail", + "ru": "Расстановка ссылок для эл. почты" + }, + "common/html/escape": { + "en-US": "Escaping HTML", + "ru": "Экранирование HTML" + }, + "common/html/nbr": { + "en-US": "Replacement line break on <br/>", + "ru": "Замена перевода строки на <br/>" + }, + "common/html/p": { + "en-US": "Placement of paragraph", + "ru": "Расстановка абзацев" + }, + "common/html/processingAttrs": { + "en-US": "Processing HTML attributes", + "ru": "Типографирование HTML-атрибутов" + }, + "common/html/quot": { + "common": "&⁠quot; → \"" + }, + "common/html/stripTags": { + "en-US": "Removing HTML-tags", + "ru": "Удаление HTML-тегов" + }, + "common/html/url": { + "en-US": "Placement of links", + "ru": "Расстановка ссылок" + }, + "common/nbsp/afterNumber": { + "en-US": "Non-breaking space between number and word", + "ru": "Нераз. пробел между числом и словом" + }, + "common/nbsp/afterParagraphMark": { + "en-US": "Non-breaking space after ¶", + "ru": "Нераз. пробел после ¶" + }, + "common/nbsp/afterSectionMark": { + "en-US": "Non-breaking space after §", + "ru": "Нераз. узкий пробел после §" + }, + "common/nbsp/afterShortWord": { + "en-US": "Non-breaking space after short word", + "ru": "Нераз. пробел после короткого слова" + }, + "common/nbsp/beforeShortLastNumber": { + "en-US": "Non-breaking space before number (maximum 2 digits) at end of sentence", + "ru": "Нераз. пробел перед числом (не более 2 цифр) в конце предложения" + }, + "common/nbsp/beforeShortLastWord": { + "en-US": "Non-breaking space before last short word in sentence", + "ru": "Нераз. пробел перед последним коротким словом в предложении" + }, + "common/nbsp/dpi": { + "en-US": "Non-breaking space before lpi and dpi", + "ru": "Нераз. пробел перед lpi и dpi" + }, + "common/nbsp/nowrap": { + "en-US": "Replace non-breaking space to normal space in tags nowrap and nobr", + "ru": "Заменять нераз. пробел на обычный пробел в тегах nowrap и nobr" + }, + "common/nbsp/replaceNbsp": { + "en-US": "Replacing non-breaking space on normal before text correction", + "ru": "Замена неразрывного пробела на обычный перед типографированием" + }, + "common/number/digitGrouping": { + "en-US": "Divide into groups numbers with many digits", + "ru": "Разбивать длинные числа по разрядам" + }, + "common/number/fraction": { + "common": "1/2 → ½, 1/4 → ¼, 3/4 → ¾" + }, + "common/number/mathSigns": { + "common": "!= → ≠, <= → ≤, >= → ≥, ~= → ≅, +- → ±" + }, + "common/number/times": { + "common": "x → × (10 x 5 → 10×5)" + }, + "common/other/delBOM": { + "en-US": "Delete character BOM (Byte Order Mark)", + "ru": "Удаление символа BOM (Byte Order Mark)" + }, + "common/other/repeatWord": { + "en-US": "Removing repeat words", + "ru": "Удаление повтора слова" + }, + "common/punctuation/apostrophe": { + "en-US": "Placement of correct apostrophe", + "ru": "Расстановка правильного апострофа" + }, + "common/punctuation/delDoublePunctuation": { + "en-US": "Removing double punctuation", + "ru": "Удаление двойной пунктуации" + }, + "common/punctuation/hellip": { + "en-US": "Replacement of three points by ellipsis", + "ru": "Замена трёх точек на многоточие" + }, + "common/punctuation/quote": { + "en-US": "Placement of quotation marks in texts", + "ru": "Расстановка кавычек правильного вида" + }, + "common/punctuation/quoteLink": { + "en-US": "Removal quotes outside a link", + "ru": "Вынос кавычек за пределы ссылки" + }, + "common/space/afterPunctuation": { + "en-US": "space after punctuation", + "ru": "Пробел после знаков пунктуации" + }, + "common/space/beforeBracket": { + "en-US": "Space before opening bracket", + "ru": "Пробел перед открывающей скобкой" + }, + "common/space/bracket": { + "en-US": "Remove extra spaces after opening and before closing bracket", + "ru": "Удаление лишних пробелов после открывающей и перед закрывающей скобкой" + }, + "common/space/delBeforePercent": { + "en-US": "Remove space before %, ‰ and ‱", + "ru": "Удаление пробела перед %, ‰ и ‱" + }, + "common/space/delBeforePunctuation": { + "en-US": "Remove spaces before punctuation", + "ru": "Удаление пробелов перед знаками пунктуации" + }, + "common/space/delLeadingBlanks": { + "en-US": "Remove spaces at start of line", + "ru": "Удаление пробелов в начале строки" + }, + "common/space/delRepeatN": { + "en-US": "Remove duplicate line breaks", + "ru": "Удаление повторяющихся переносов строки" + }, + "common/space/delRepeatSpace": { + "en-US": "Removing duplicate spaces between characters", + "ru": "Удаление повторяющихся пробелов между символами" + }, + "common/space/delTrailingBlanks": { + "en-US": "Remove spaces at end of line", + "ru": "Удаление пробелов в конце строки" + }, + "common/space/insertFinalNewline": { + "en-US": "Insert final newline", + "ru": "Вставить в конце текста перевод строки" + }, + "common/space/replaceTab": { + "en-US": "Replacement of tab to 4 spaces", + "ru": "Замена таба на 4 пробела" + }, + "common/space/squareBracket": { + "en-US": "Remove extra spaces after opening and before closing square bracket", + "ru": "Удаление лишних пробелов после открывающей и перед закрывающей квадратной скобкой" + }, + "common/space/trimLeft": { + "en-US": "Remove spaces and line breaks in beginning of text", + "ru": "Удаление пробелов и переносов строк в начале текста" + }, + "common/space/trimRight": { + "en-US": "Remove spaces and line breaks at end of text", + "ru": "Удаление пробелов и переносов строк в конце текста" + }, + "common/symbols/arrow": { + "common": "-> → →, <- → ←" + }, + "common/symbols/cf": { + "en-US": "Adding ° to C and F", + "ru": "Добавление ° к C и F" + }, + "common/symbols/copy": { + "common": "(c) → ©, (tm) → ™, (r) → ®" + }, + "en-US/dash/main": { + "en-US": "Replace hyphens surrounded by spaces with an em-dash", + "ru": "Замена дефиса на длинное тире" + }, + "ru/dash/centuries": { + "en-US": "Hyphen to dash in centuries", + "ru": "Замена дефиса на тире в веках" + }, + "ru/dash/daysMonth": { + "en-US": "Dash between days of one month", + "ru": "Тире между днями одного месяца" + }, + "ru/dash/de": { + "en-US": "Hyphen before “де”", + "ru": "Дефис перед «де»" + }, + "ru/dash/decade": { + "en-US": "Dash in decade", + "ru": "Тире в десятилетиях, 80—90-е гг." + }, + "ru/dash/directSpeech": { + "en-US": "Dash in direct speech", + "ru": "Тире в прямой речи" + }, + "ru/dash/izpod": { + "en-US": "Hyphen between “из-под”", + "ru": "Дефис между «из-под»" + }, + "ru/dash/izza": { + "en-US": "Hyphen between “из-за”", + "ru": "Дефис между «из-за»" + }, + "ru/dash/ka": { + "en-US": "Hyphen before “ка” and “кась”", + "ru": "Дефис перед «ка» и «кась»" + }, + "ru/dash/koe": { + "en-US": "Hyphen after “кое” and “кой”", + "ru": "Дефис после «кое» и «кой»" + }, + "ru/dash/main": { + "en-US": "Replacement hyphen with dash", + "ru": "Замена дефиса на тире" + }, + "ru/dash/month": { + "en-US": "Dash between months", + "ru": "Тире между месяцами" + }, + "ru/dash/surname": { + "en-US": "Acronyms with a dash", + "ru": "Сокращения с помощью тире" + }, + "ru/dash/taki": { + "en-US": "Hyphen between “верно-таки” and etc.", + "ru": "Дефис между «верно-таки» и т. д." + }, + "ru/dash/time": { + "en-US": "Dash in time intervals", + "ru": "Тире в интервалах времени" + }, + "ru/dash/to": { + "en-US": "Hyphen before “то”, “либо”, “нибудь”", + "ru": "Дефис перед «то», «либо», «нибудь»" + }, + "ru/dash/weekday": { + "en-US": "Dash between the days of the week", + "ru": "Тире между днями недели" + }, + "ru/dash/years": { + "en-US": "Hyphen to dash in years", + "ru": "Замена дефиса на тире в годах" + }, + "ru/date/fromISO": { + "en-US": "Converting dates YYYY-MM-DD type DD.MM.YYYY", + "ru": "Преобразование дат YYYY-MM-DD к виду DD.MM.YYYY" + }, + "ru/date/weekday": { + "common": "2 Мая, Понедельник → 2 мая, понедельник" + }, + "ru/money/currency": { + "en-US": "Currency symbol ($, €, ¥, Ұ, £ and ₤) after the number, $100 → 100 $", + "ru": "Символ валюты ($, €, ¥, Ұ, £ и ₤) после числа, $100 → 100 $" + }, + "ru/money/ruble": { + "common": "1 руб. → 1 ₽" + }, + "ru/nbsp/abbr": { + "en-US": "Non-breaking space in abbreviations, e.g. “т. д.”", + "ru": "Нераз. пробел в сокращениях, например, в «т. д.»" + }, + "ru/nbsp/addr": { + "en-US": "Placement of non-breaking space after “г.”, “обл.”, “ул.”, “пр.”, “кв.” et al.", + "ru": "Расстановка нераз. пробела после «г.», «обл.», «ул.», «пр.», «кв.» и др." + }, + "ru/nbsp/afterNumberSign": { + "en-US": "Non-breaking thin space after №", + "ru": "Нераз. узкий пробел после №" + }, + "ru/nbsp/beforeParticle": { + "en-US": "Non-breaking space before “ли”, “ль”, “же”, “бы”, “б”", + "ru": "Нераз. пробел перед «ли», «ль», «же», «бы», «б»" + }, + "ru/nbsp/centuries": { + "en-US": "Remove spaces and extra points in “вв.”", + "ru": "Удаление пробелов и лишних точек в «вв.»" + }, + "ru/nbsp/dayMonth": { + "en-US": "Non-breaking space between number and month", + "ru": "Нераз. пробел между числом и месяцем" + }, + "ru/nbsp/initials": { + "en-US": "Binding of initials to the name", + "ru": "Привязка инициалов к фамилии" + }, + "ru/nbsp/m": { + "en-US": "m2 → м², m3 → м³ and non-breaking space", + "ru": "м2 → м², м3 → м³ и нераз. пробел" + }, + "ru/nbsp/mln": { + "en-US": "Non-breaking space between number and “тыс.”, “млн”, “млрд” and “трлн”", + "ru": "Неразр. пробел между числом и «тыс.», «млн», «млрд» и «трлн»" + }, + "ru/nbsp/ooo": { + "en-US": "Non-breaking space after “OOO, ОАО, ЗАО, НИИ, ПБОЮЛ”", + "ru": "Нераз. пробел после OOO, ОАО, ЗАО, НИИ и ПБОЮЛ" + }, + "ru/nbsp/page": { + "en-US": "Non-breaking space after “стр.”, “гл.”, “рис.”, “илл.”", + "ru": "Нераз. пробел после «стр.», «гл.», «рис.», «илл.»" + }, + "ru/nbsp/ps": { + "en-US": "Non-breaking space in P. S. and P. P. S.", + "ru": "Нераз. пробел в P. S. и P. P. S." + }, + "ru/nbsp/rubleKopek": { + "en-US": "Not once. space before the “rub” and “cop.”", + "ru": "Нераз. пробел перед «руб.» и «коп.»" + }, + "ru/nbsp/see": { + "en-US": "Non-breaking space after abbreviation «см.» and «им.»", + "ru": "Нераз. пробел после сокращений «см.» и «им.»" + }, + "ru/nbsp/year": { + "en-US": "Non-breaking space before XXXX г. (2012 г.)", + "ru": "Нераз. пробел после XXXX г. (2012 г.)" + }, + "ru/nbsp/years": { + "en-US": "г.г. → гг. and non-breaking space", + "ru": "г.г. → гг. и нераз. пробел" + }, + "ru/number/comma": { + "en-US": "Commas in numbers", + "ru": "Замена точки на запятую в числах" + }, + "ru/number/ordinals": { + "common": "N-ый, -ой, -ая, -ое, -ые, -ым, -ом, -ых → N-й, -я, -е, -м, -х (25-й)" + }, + "ru/optalign/bracket": { + "en-US": "for opening bracket", + "ru": "для открывающей скобки" + }, + "ru/optalign/comma": { + "en-US": "for comma", + "ru": "для запятой" + }, + "ru/optalign/quote": { + "en-US": "for opening quotation marks", + "ru": "для открывающей кавычки" + }, + "ru/other/accent": { + "en-US": "Replacement capital letters to lowercase with addition of accent", + "ru": "Замена заглавной буквы на строчную с добавлением ударения" + }, + "ru/other/phone-number": { + "en-US": "Formatting phone numbers", + "ru": "Форматирование телефонных номеров" + }, + "ru/punctuation/ano": { + "en-US": "Placement of commas before “а” and “но”", + "ru": "Расстановка запятых перед «а» и «но»" + }, + "ru/punctuation/exclamation": { + "common": "!! → !" + }, + "ru/punctuation/exclamationQuestion": { + "common": "!? → ?!" + }, + "ru/punctuation/hellipQuestion": { + "common": "«?…» → «?..», «!…» → «!..», «…,» → «…»" + }, + "ru/space/afterHellip": { + "en-US": "Space after “...”, “!..” and “?..”", + "ru": "Пробел после «...», «!..» и «?..»" + }, + "ru/space/year": { + "en-US": "Space between number and word “год”", + "ru": "Пробел между числом и словом «год»" + }, + "ru/symbols/NN": { + "common": "№№ → №" + }, + "ru/typo/switchingKeyboardLayout": { + "en-US": "Replacement of Latin letters in Russian. Typos occur when you switch keyboard layouts", + "ru": "Замена латинских букв на русские. Опечатки, возникающие при переключении клавиатурной раскладки" + } +}; + +var groups = [{ + "name": "punctuation", + "title": { + "en-US": "Punctuation", + "ru": "Пунктуация" + } +}, { + "name": "optalign", + "title": { + "en-US": "Hanging punctuation", + "ru": "Висячая пунктуация" + } +}, { + "name": "dash", + "title": { + "en-US": "Dash and hyphen", + "ru": "Тире и дефис" + } +}, { + "name": "nbsp", + "title": { + "en-US": "Non-breaking space", + "ru": "Неразрывный пробел" + } +}, { + "name": "space", + "title": { + "en-US": "Space and line ending", + "ru": "Пробел и окончание строки" + } +}, { + "name": "html", + "title": { + "en-US": "HTML", + "ru": "HTML" + } +}, { + "name": "date", + "title": { + "en-US": "Date", + "ru": "Дата" + } +}, { + "name": "money", + "title": { + "en-US": "Money", + "ru": "Деньги" + } +}, { + "name": "number", + "title": { + "en-US": "Numbers and mathematical expressions", + "ru": "Числа и математические выражения" + } +}, { + "name": "symbols", + "title": { + "en-US": "Symbols and signs", + "ru": "Символы и знаки" + } +}, { + "name": "typo", + "title": { + "en-US": "Typos", + "ru": "Опечатки" + } +}, { + "name": "other", + "title": { + "en-US": "Other", + "ru": "Прочее" + } +}]; + +Typograf.titles = titles; +Typograf.groups = groups; + +return Typograf; + +}))); diff --git a/assets/components/tinymcerte/js/vendor/tinymce/plugins/typograf/dist/typograf.all.min.js b/assets/components/tinymcerte/js/vendor/tinymce/plugins/typograf/dist/typograf.all.min.js new file mode 100644 index 0000000..66d797f --- /dev/null +++ b/assets/components/tinymcerte/js/vendor/tinymce/plugins/typograf/dist/typograf.all.min.js @@ -0,0 +1,2 @@ +/*! typograf | © 2020 Denis Seleznev | MIT License | https://github.com/typograf/typograf */ +!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):e.Typograf=n()}(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 t(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function r(e,n){for(var t=0;t<n.length;t++){var r=n[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function s(e,n,t){return n&&r(e.prototype,n),t&&r(e,t),e}function i(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var t=[],r=!0,a=!1,s=void 0;try{for(var u,i=e[Symbol.iterator]();!(r=(u=i.next()).done)&&(t.push(u.value),!n||t.length!==n);r=!0);}catch(e){a=!0,s=e}finally{try{r||null==i.return||i.return()}finally{if(a)throw s}}return t}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var u={symbols:110,space:210,dash:310,punctuation:410,nbsp:510,number:610,money:710,date:810,other:910,optalign:1010,typo:1110,html:1210},n=[["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]],o=[["nbsp",160],["thinsp",8201],["ensp",8194],["emsp",8195],["shy",173],["zwnj",8204],["zwj",8205],["lrm",8206],["rlm",8207]],c=new(function(){function e(){t(this,e),this._entities=this._prepareEntities([].concat(n,o)),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(o)}return s(e,[{key:"toUtf",value:function(e){var t=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 n=t._entitiesByNameEntity[e];return n?n.utf:e}))}},{key:"decHexToUtf",value:function(e){return e.replace(/&#(\d{1,6});/gi,function(e,n){return String.fromCharCode(parseInt(n,10))}).replace(/&#x([\da-f]{1,6});/gi,function(e,n){return String.fromCharCode(parseInt(n,16))})}},{key:"restore",value:function(e){var n=e.prefs.htmlEntity,t=n.type,r=this._entities;"name"!==t&&"digit"!==t||((n.onlyInvisible||n.list)&&(r=[],n.onlyInvisible&&(r=r.concat(this._invisibleEntities)),n.list&&(r=r.concat(this._prepareListParam(n.list)))),e.text=this._restoreEntitiesByIndex(e.text,t+"Entity",r))}},{key:"getByUtf",value:function(e,n){var t="";switch(n){case"digit":t=this._entitiesByDigitEntity[e];break;case"name":t=this._entitiesByNameEntity[e];break;default:t=e}return t}},{key:"_prepareEntities",value:function(e){var s=[];return e.forEach(function(e){var n=i(e,2),t=n[0],r=n[1],a=String.fromCharCode(r);s.push({name:t,nameEntity:"&"+t+";",digitEntity:"&#"+r+";",utf:a,reName:new RegExp("&"+t+";","g"),reUtf:new RegExp(a,"g")})},this),s}},{key:"_prepareListParam",value:function(e){var t=[];return e.forEach(function(e){var n=this._entitiesByName[e];n&&t.push(n)},this),t}},{key:"_restoreEntitiesByIndex",value:function(n,t,e){return e.forEach(function(e){n=n.replace(e.reUtf,e[t])}),n}}]),e}()),l=[];function p(e){var n=(e||"").split("/")[0];n&&"common"!==n&&!h(n)&&(l.push(n),l.sort())}function e(){return l}function h(e){return"common"===e||-1!==l.indexOf(e)}function m(e,n){var t=e||n,r=t;return Array.isArray(t)||(r=[t]),r}var g={};function d(e){return g[e]}function f(n,e){"string"==typeof n?(p(n),g[n]=e):"object"===a(n)&&Object.keys(n).forEach(function(e){p(e),g[e]=n[e]})}var b=["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"],v=new RegExp("(https?|file|ftp)://([a-zA-Z0-9/+-=%&:_.~?]+[a-zA-Z0-9#+]*)","g"),$="\uf000",y="\uf001",x=function(){function e(){t(this,e);var n=[["\x3c!--","--\x3e"],["<!ENTITY",">"],["<!DOCTYPE",">"],["<\\?xml","\\?>"],["<!\\[CDATA\\[","\\]\\]>"]];["code","kbd","object","pre","samp","script","style","var"].forEach(function(e){n.push(["<"+e+"(\\s[^>]*?)?>","</"+e+">"])},this),this._tags={own:[],html:n.map(this._prepareRegExp),url:[v]},this._groups=["own","html","url"]}return s(e,[{key:"add",value:function(e){this._tags.own.push(this._prepareRegExp(e))}},{key:"show",value:function(n,t){for(var e=new RegExp("\uf000tf\\d+\uf000","g"),r=new RegExp("\uf000tf\\d"),a=function(e){return n.safeTags.hidden[t][e]||e},s=0,u=this._tags[t].length;s<u&&(n.text=n.text.replace(e,a),-1!==n.text.search(r));s++);}},{key:"hide",value:function(n,e){n.safeTags=n.safeTags||{hidden:{},i:0},n.safeTags.hidden[e]={};var t=this._pasteLabel.bind(this,n,e);this._tags[e].forEach(function(e){n.text=n.text.replace(this._prepareRegExp(e),t)},this)}},{key:"hideHTMLTags",value:function(e){if(e.isHTML){var n=this._pasteLabel.bind(this,e,"html");e.text=e.text.replace(/<\/?[a-z][^]*?>/gi,n).replace(/<\/?[a-z][^]*?>/gi,n).replace(/&[gl]t;/gi,n)}}},{key:"getPrevLabel",value:function(e,n){for(var t=n-1;0<=t;t--)if(e[t]===$)return e.slice(t,n+1);return!1}},{key:"getNextLabel",value:function(e,n){for(var t=n+1;t<e.length;t++)if(e[t]===$)return e.slice(n,t+1);return!1}},{key:"getTagByLabel",value:function(t,r){var a=!1;return this._groups.some(function(e){var n=t.safeTags.hidden[e][r];return void 0!==n&&(a={group:e,value:n}),a}),a}},{key:"getTagInfo",value:function(e){if(e){var n={group:e.group};switch(e.group){case"html":n.name=e.value.split(/[<\s>]/)[1],n.isInline=-1<b.indexOf(n.name),n.isClosing=-1<e.value.search(/^<\//);break;case"url":n.isInline=!0;break;case"own":n.isInline=!1}return n}}},{key:"_pasteLabel",value:function(e,n,t){var r=e.safeTags,a="\uf000tf"+r.i+$;return r.hidden[n][a]=t,r.i++,a}},{key:"_prepareRegExp",value:function(e){var n;if(e instanceof RegExp)n=e;else{var t=i(e,3),r=t[0],a=t[1],s=t[2];void 0===s&&(s="[^]*?"),n=new RegExp(r+s+a,"gi")}return n}}]),e}();function R(e,n){for(var t="";1==(1&n)&&(t+=e),0!==(n>>>=1);)e+=e;return t}function w(e){return e.replace(/\u00A0/g," ")}function S(e,n){for(var t=0;t<n.length;t++)e=e.replace(n[t][0],n[t][1]);return e}function E(e){return-1!==e.search(/(<\/?[a-z]|<!|&[lg]t;)/i)}function _(e){return"object"===a(e)?JSON.parse(JSON.stringify(e)):e}var k=function(){function n(e){t(this,n),this._prefs="object"===a(e)?e:{},this._prefs.locale=m(this._prefs.locale),this._prefs.live=this._prefs.live||!1,this._safeTags=new x,this._settings={},this._enabledRules={},this._innerRulesByQueues={},this._innerRules=[].concat(this._innerRules),this._innerRules.forEach(function(e){var n=e.queue||"default";this._innerRulesByQueues[n]=this._innerRulesByQueues[n]||[],this._innerRulesByQueues[n].push(e)},this),this._rulesByQueues={},this._rules=[].concat(this._rules),this._rules.forEach(function(e){var n=e.queue||"default";this._prepareRule(e),this._rulesByQueues[n]=this._rulesByQueues[n]||[],this._rulesByQueues[n].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 s(n,[{key:"execute",value:function(e,n){if(!(e=""+e))return"";var t=this._prepareContext(e);return this._preparePrefs(t,n),this._process(t)}},{key:"_prepareContext",value:function(e){return{text:e,isHTML:E(e),prefs:_(this._prefs),getData:function(n){return"char"===n?this.prefs.locale.map(function(e){return d(e+"/"+n)}).join(""):d(this.prefs.locale[0]+"/"+n)}}}},{key:"_preparePrefs",value:function(e,n){n=n||{};for(var t=e.prefs,r=0,a=["htmlEntity","lineEnding","processingSeparateParts","ruleFilter"];r<a.length;r++){var s=a[r];s in n?t[s]=n[s]:s in this._prefs&&(t[s]=this._prefs[s])}t.htmlEntity=t.htmlEntity||{},t.locale=m(n.locale,this._prefs.locale);var u=t.locale,i=u[0];if(!u.length||!i)throw Error('Not defined the property "locale".');if(!h(i))throw Error('"'+i+'" is not supported locale.')}},{key:"_splitBySeparateParts",value:function(a){if(!a.isHTML||!1===a.prefs.processingSeparateParts)return[a.text];var s=[],e=new RegExp("<("+this._separatePartsTags.join("|")+")(\\s[^>]*?)?>[^]*?</\\1>","gi"),u=0;return a.text.replace(e,function(e,n,t,r){return u!==r&&s.push((u?y:"")+a.text.slice(u,r)+y),s.push(e),u=r+e.length,e}),s.push(u?y+a.text.slice(u,a.text.length):a.text),s}},{key:"_process",value:function(n){var t=this;n.text=n.text.replace(/\r\n?/g,"\n"),this._executeRules(n,"start"),this._safeTags.hide(n,"own"),this._executeRules(n,"hide-safe-tags-own"),this._safeTags.hide(n,"html"),this._executeRules(n,"hide-safe-tags-html");var e,r,a=n.isHTML,s=new RegExp(y,"g");return n.text=this._splitBySeparateParts(n).map(function(e){return n.text=e,n.isHTML=E(e),t._safeTags.hideHTMLTags(n),t._safeTags.hide(n,"url"),t._executeRules(n,"hide-safe-tags-url"),t._executeRules(n,"hide-safe-tags"),c.toUtf(n),t._prefs.live&&(n.text=w(n.text)),t._executeRules(n,"utf"),t._executeRules(n),c.restore(n),t._executeRules(n,"html-entities"),t._safeTags.show(n,"url"),t._executeRules(n,"show-safe-tags-url"),n.text.replace(s,"")}).join(""),n.isHTML=a,this._safeTags.show(n,"html"),this._executeRules(n,"show-safe-tags-html"),this._safeTags.show(n,"own"),this._executeRules(n,"show-safe-tags-own"),this._executeRules(n,"end"),e=n.text,"CRLF"===(r=n.prefs.lineEnding)?e.replace(/\n/g,"\r\n"):"CR"===r?e.replace(/\n/g,"\r"):e}},{key:"getSetting",value:function(e,n){return this._settings[e]&&this._settings[e][n]}},{key:"setSetting",value:function(e,n,t){return this._settings[e]=this._settings[e]||{},this._settings[e][n]=t,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,n,t){var r=e instanceof RegExp?e:[e,n,t];return this._safeTags.add(r),this}},{key:"_executeRules",value:function(n,e){e=e||"default";var t=this._rulesByQueues[e],r=this._innerRulesByQueues[e];r&&r.forEach(function(e){this._ruleIterator(n,e)},this),t&&t.forEach(function(e){this._ruleIterator(n,e)},this)}},{key:"_ruleIterator",value:function(e,n){var t=n._locale,r=this._prefs.live;if(!(!0===r&&!1===n.live||!1===r&&!0===n.live)&&("common"===t||t===e.prefs.locale[0])&&this.isEnabledRule(n.name)){if(e.prefs.ruleFilter&&!e.prefs.ruleFilter(n))return;this._onBeforeRule&&this._onBeforeRule(n.name,e.text,e),e.text=n.handler.call(this,e.text,this._settings[n.name],e),this._onAfterRule&&this._onAfterRule(n.name,e.text,e)}}},{key:"_prepareRule",value:function(e){var n=e.name,t=a(e.settings),r={};"object"===t?r=_(e.settings):"function"===t&&(r=e.settings(e)),this._settings[n]=r,this._enabledRules[n]=e._enabled}},{key:"_enable",value:function(e,n){return Array.isArray(e)?e.forEach(function(e){this._enableByMask(e,n)},this):this._enableByMask(e,n),this}},{key:"_enableByMask",value:function(e,t){if(e)if(-1!==e.search(/\*/)){var r=new RegExp(e.replace(/\//g,"\\/").replace(/\*/g,".*"));this._rules.forEach(function(e){var n=e.name;r.test(n)&&(this._enabledRules[n]=t)},this)}else this._enabledRules[e]=t}},{key:"_getRule",value:function(n){var t=null;return this._rules.some(function(e){return e.name===n&&(t=e,!0)}),t}}],[{key:"addRule",value:function(e){var n=i(e.name.split("/"),3),t=n[0],r=n[1],a=n[2];return e._enabled=!0!==e.disabled,e._locale=t,e._group=r,e._name=a,this.addLocale(e._locale),this._setIndex(e),this.prototype._rules.push(e),this._sortRules(this.prototype._rules),this}},{key:"addRules",value:function(e){var n=this;return e.forEach(function(e){n.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 n=this;return e.forEach(function(e){n.addInnerRule(e)}),this}},{key:"_setIndex",value:function(e){var n=e.index,t=a(n),r=u[e._group];"undefined"===t?n=r:"string"===t&&(n=(r||0)+parseInt(e.index,10)),e._index=n}},{key:"_sortRules",value:function(e){e.sort(function(e,n){return e._index>n._index?1:-1})}}]),n}();k.version="6.11.0",k.addLocale=p,k.getLocales=e,k.hasLocale=h,k.setData=f,k.getData=d,k.deepCopy=_,k.prototype._rules=[],k.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 f(e)});var U=["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"],q={name:"common/html/p",index:"+5",queue:"end",handler:function(e){var r=new RegExp("<("+U.join("|")+")[>\\s]"),n=e.split("\n\n");return n.forEach(function(e,n,t){e.trim()&&(r.test(e)||(t[n]=e.replace(/^(\s*)/,"$1<p>").replace(/(\s*)$/,"</p>$1")))}),n.join("\n\n")},disabled:!0,htmlAttrs:!1},T={name:"common/html/processingAttrs",queue:"hide-safe-tags-own",handler:function(e,n,t){var i=this,r=new RegExp("(^|\\s)("+n.attrs.join("|")+")=(\"[^\"]*?\"|'[^']*?')","gi"),o=_(t.prefs);return o.ruleFilter=function(e){return!1!==e.htmlAttrs},e.replace(/(<[-\w]+\s)([^>]+?)(?=>)/g,function(e,n,t){return n+t.replace(r,function(e,n,t,r){var a=r[0],s=r[r.length-1],u=r.slice(1,-1);return n+t+"="+a+i.execute(u,o)+s})})},settings:{attrs:["title","placeholder"]},disabled:!0,htmlAttrs:!1},A={name:"common/html/url",queue:"end",handler:function(e,n,t){return t.isHTML?e:e.replace(v,function(e,n,t){t=t.replace(/([^/]+\/?)(\?|#)$/,"$1").replace(/^([^/]+)\/$/,"$1"),"http"===n?t=t.replace(/^([^/]+)(:80)([^\d]|\/|$)/,"$1$3"):"https"===n&&(t=t.replace(/^([^/]+)(:443)([^\d]|\/|$)/,"$1$3"));var r=t,a=n+"://"+t,s='<a href="'+a+'">';return"http"===n||"https"===n?(r=r.replace(/^www\./,""),s+("http"===n?r:n+"://"+r)+"</a>"):s+a+"</a>"})},disabled:!0,htmlAttrs:!1};k.addRules([{name:"common/html/e-mail",queue:"end",handler:function(e,n,t){return t.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 n={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};return e.replace(/[&<>"'/]/g,function(e){return n[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},q,T,{name:"common/html/quot",queue:"hide-safe-tags",handler:function(e){return e.replace(/"/g,'"')}},{name:"common/html/stripTags",index:"+99",queue:"end",handler:function(e){return e.replace(/<[^>]+>/g,"")},disabled:!0},A]);var B={name:"common/nbsp/afterNumber",handler:function(e,n,t){var r="(^|\\D)(\\d{1,5}) (["+t.getData("char")+"]+)";return e.replace(new RegExp(r,"gi"),"$1$2\xa0$3")},disabled:!0},L={name:"common/nbsp/afterShortWord",handler:function(e,n,t){var r=n.lengthShortWord,a="(^|["+(" \xa0(\uf000"+d("common/quote"))+"])(["+t.getData("char")+"]{1,"+r+"}) ",s=new RegExp(a,"gim");return e.replace(s,"$1$2\xa0").replace(s,"$1$2\xa0")},settings:{lengthShortWord:2}},D={name:"common/nbsp/beforeShortLastNumber",handler:function(e,n,t){var r=t.getData("char"),a=r.toUpperCase(),s=new RegExp("(["+r+a+"]) (?=\\d{1,"+n.lengthLastNumber+"}[-+\u2212%'\""+t.getData("quote").right+")]?([.!?\u2026]( ["+a+"]|$)|$))","gm");return e.replace(s,"$1\xa0")},live:!1,settings:{lengthLastNumber:2}},N={name:"common/nbsp/beforeShortLastWord",handler:function(e,n,t){var r=t.getData("char"),a=r.toUpperCase(),s=new RegExp("(["+r+"\\d]) (["+r+a+"]{1,"+n.lengthLastWord+"}[.!?\u2026])( ["+a+"]|$)","g");return e.replace(s,"$1\xa0$2$3")},settings:{lengthLastWord:3}};function P(e,n,t,r){return n+t.replace(/([^\u00A0])\u00A0([^\u00A0])/g,"$1 $2")+r}var M={name:"common/nbsp/nowrap",queue:"end",handler:function(e){return e.replace(/(<nowrap>)(.*?)(<\/nowrap>)/g,P).replace(/(<nobr>)(.*?)(<\/nobr>)/g,P)}},I={name:"common/nbsp/replaceNbsp",queue:"utf",live:!1,handler:w,disabled:!0};k.addRules([B,{name:"common/nbsp/afterParagraphMark",handler:function(e){return e.replace(/\xb6 ?(?=\d)/g,"\xb6\xa0")}},{name:"common/nbsp/afterSectionMark",handler:function(e,n,t){var r=t.prefs.locale[0];return e.replace(/\xa7[ \u00A0\u2009]?(?=\d|I|V|X)/g,"ru"===r?"\xa7\u202f":"\xa7\xa0")}},L,D,N,{name:"common/nbsp/dpi",handler:function(e){return e.replace(/(\d) ?(lpi|dpi)(?!\w)/,"$1\xa0$2")}},M,I]);var z={name:"common/number/digitGrouping",index:"310",disabled:!0,handler:function(e,u){return e.replace(new RegExp("(^ ?|\\D |".concat($,")(\\d{1,3}([ \xa0\u202f\u2009]\\d{3})+)(?! ?[\\d-])"),"gm"),function(e,n,t){return n+t.replace(/\s/g,u.space)}).replace(/(\d{5,}([.,]\d+)?)/g,function(e,n){var t=n.match(/[.,]/),r=i(t?n.split(t):[n],2),a=r[0],s=r[1];return a=a.replace(/(\d)(?=(\d{3})+([^\d]|$))/g,"$1"+u.space),t?a+t+s:a})},settings:{space:"\u202f"}},C={name:"common/number/mathSigns",handler:function(e){return S(e,[[/!=/g,"\u2260"],[/<=/g,"\u2264"],[/(^|[^=])>=/g,"$1\u2265"],[/<=>/g,"\u21d4"],[/<</g,"\u226a"],[/>>/g,"\u226b"],[/~=/g,"\u2245"],[/(^|[^+])\+-/g,"$1\xb1"]])}};k.addRules([z,{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")}},C,{name:"common/number/times",handler:function(e){return e.replace(/(\d)[ \u00A0]?[x\u0445][ \u00A0]?(\d)/g,"$1\xd7$2")}}]);var O={name:"common/other/repeatWord",handler:function(e,n,t){var r="[;:,.?! \n"+d("common/quote")+"]",a=new RegExp("("+r+"|^)(["+t.getData("char")+"]{"+n.min+",}) \\2("+r+"|$)","gi");return e.replace(a,"$1$2$3")},settings:{min:2},disabled:!0};k.addRules([{name:"common/other/delBOM",queue:"start",index:-1,handler:function(e){return 65279===e.charCodeAt(0)?e.slice(1):e}},O]);var j={name:"common/punctuation/apostrophe",handler:function(e,n,t){var r="(["+t.getData("char")+"])",a=new RegExp(r+"'"+r,"gi");return e.replace(a,"$1\u2019$2")}},H={bufferQuotes:{left:"\uf005\uf006\uf007",right:"\uf008\uf009\uf0a0"},maxLevel:3,beforeLeft:" \n\t\xa0[(",afterRight:" \n\t\xa0!?.:;#*,\u2026)",process:function(e){var n=e.context.text;if(!this.count(n).total)return n;var t=e.settings,r=e.settings.left[0]===e.settings.right[0];return r&&(e.settings=_(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&&(n=this.removeSpacing(n,e.settings)),n=this.set(n,e),e.settings.spacing&&(n=this.setSpacing(n,e.settings)),e.settings.removeDuplicateQuotes&&(n=this.removeDuplicates(n,e.settings)),r&&(n=this.returnOriginalQuotes(n,t,e.settings),e.settings=t),n},returnOriginalQuotes:function(e,n,t){for(var r={},a=0;a<t.left.length;a++)r[t.left[a]]=n.left[a],r[t.right[a]]=n.right[a];return e.replace(new RegExp("["+t.left+t.right+"]","g"),function(e){return r[e]})},count:function(e){var n={total:0};return e.replace(new RegExp("["+d("common/quote")+"]","g"),function(e){return n[e]||(n[e]=0),n[e]++,n.total++,e}),n},removeDuplicates:function(e,n){var t=n.left[0],r=n.left[1]||t,a=n.right[0];return t!==r?e:e.replace(new RegExp(t+t,"g"),t).replace(new RegExp(a+a,"g"),a)},removeSpacing:function(e,n){for(var t=0,r=n.left.length;t<r;t++){var a=n.left[t],s=n.right[t];e=e.replace(new RegExp(a+"([ \u202f\xa0])","g"),a).replace(new RegExp("([ \u202f\xa0])"+s,"g"),s)}return e},setSpacing:function(e,n){for(var t=0,r=n.left.length;t<r;t++){var a=n.left[t],s=n.right[t];e=e.replace(new RegExp(a+"([^\u202f])","g"),a+"\u202f$1").replace(new RegExp("([^\u202f])"+s,"g"),"$1\u202f"+s)}return e},set:function(e,n){var t=d("common/quote"),r=n.settings.left[0],a=n.settings.left[1]||r,s=n.settings.right[0],u=new RegExp("(^|["+this.beforeLeft+"])(["+t+"]{1,"+this.maxLevel+"})(?=[^\\s"+$+"])","gim"),i=new RegExp("([^\\s\uf000])(["+t+"]{1,"+this.maxLevel+"})(?=["+this.afterRight+"]|$)","gim");return e=e.replace(u,function(e,n,t){return n+R(r,t.length)}).replace(i,function(e,n,t){return n+R(s,t.length)}),e=this.setAboveTags(e,n),r!==a&&(e=this.setInner(e,n.settings)),e},setAboveTags:function(c,l){var p=this,e=d("common/quote"),h=l.settings.left[0],m=l.settings.right[0];return c.replace(new RegExp("(^|.)(["+e+"])(.|$)","gm"),function(e,n,t,r,a){if(n!==$&&r!==$)return e;if(n===$&&r===$)return'"'===t?n+p.getAboveTwoTags(c,a+1,l)+r:e;if(n===$){var s=-1<p.afterRight.indexOf(r),u=p.getPrevTagInfo(c,a-1,l);return s&&u&&"html"===u.group?n+(u.isClosing?m:h)+r:n+(!r||s?m:h)+r}var i=-1<p.beforeLeft.indexOf(n),o=p.getNextTagInfo(c,a+1,l);return i&&o&&"html"===o.group?n+(o.isClosing?m:h)+r:n+(!n||i?h:m)+r})},getAboveTwoTags:function(e,n,t){var r=this.getPrevTagInfo(e,n,t),a=this.getNextTagInfo(e,n,t);if(r&&"html"===r.group){if(!r.isClosing)return t.settings.left[0];if(a&&a.isClosing&&r.isClosing)return t.settings.right[0]}return e[n]},getPrevTagInfo:function(e,n,t){var r=t.safeTags.getPrevLabel(e,n-1);if(r){var a=t.safeTags.getTagByLabel(t.context,r);if(a)return t.safeTags.getTagInfo(a)}return null},getNextTagInfo:function(e,n,t){var r=t.safeTags.getNextLabel(e,n+1);if(r){var a=t.safeTags.getTagByLabel(t.context,r);if(a)return t.safeTags.getTagInfo(a)}return null},setInner:function(e,n){for(var t=[],r=[],a=0;a<n.left.length;a++)t.push(n.left[a]),r.push(n.right[a]);for(var s=n.left[0],u=n.right[0],i=t.length-1,o=-1,c="",l=0,p=e.length;l<p;l++){var h=e[l];h===s?(i<++o&&(o=i),c+=t[o]):h===u?o<=-1?c+=r[o=0]:(c+=r[o],--o<-1&&(o=-1)):('"'===h&&(o=-1),c+=h)}var m=this.count(c,n);return m[s]!==m[u]?e:c}},Q={name:"common/punctuation/quote",handler:function(e,n,t){var r=n[t.prefs.locale[0]];return r?H.process({context:t,settings:r,safeTags:this._safeTags}):e},settings:function(){var n={};return e().forEach(function(e){n[e]=_(d(e+"/quote"))}),n}},Y={name:"common/punctuation/quoteLink",queue:"show-safe-tags-html",index:"+5",handler:function(e,n,t){var r=this.getSetting("common/punctuation/quote",t.prefs.locale[0]);if(!r)return e;var a=c.getByUtf(r.left[0]),s=c.getByUtf(r.right[0]),u=c.getByUtf(r.left[1]),i=c.getByUtf(r.right[1]);u=u?"|"+u:"",i=i?"|"+i:"";var o=new RegExp("(<[aA]\\s[^>]*?>)("+a+u+")([^]*?)("+s+i+")(</[aA]>)","g");return e.replace(o,"$2$1$3$5$4")}};k.addRules([j,{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,n,t){return"ru"===t.prefs.locale[0]?e.replace(/(^|[^.])\.{3,4}(?=[^.]|$)/g,"$1\u2026"):e.replace(/(^|[^.])\.{3}(\.?)(?=[^.]|$)/g,"$1\u2026$2")}},Q,Y]);var F={name:"common/space/afterPunctuation",handler:function(e){var n=new RegExp("(!|;|\\?)([^).\u2026!;?\\s[\\])\uf000"+d("common/quote")+"])","g"),t=new RegExp('(\\D)(,|:)([^)",:.?\\s\\/\\\\\uf000])',"g");return e.replace(n,"$1 $2").replace(t,"$1$2 $3")}},X={name:"common/space/beforeBracket",handler:function(e,n,t){var r=new RegExp("(["+t.getData("char")+".!?,;\u2026)])\\(","gi");return e.replace(r,"$1 (")}},W={name:"common/space/delRepeatN",index:"-1",handler:function(e,n){var t=n.maxConsecutiveLineBreaks,r=new RegExp("\n{".concat(t+1,",}"),"g"),a=R("\n",t);return e.replace(r,a)},settings:{maxConsecutiveLineBreaks:2}},G={name:"common/space/trimLeft",index:"-4",handler:String.prototype.trimLeft?function(e){return e.trimLeft()}:function(e){return e.replace(/^[\s\uFEFF\xA0]+/g,"")}},K={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,"")}};k.addRules([F,X,{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},W,{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,"]")}},G,K]);var V={name:"common/symbols/arrow",handler:function(e){return S(e,[[/(^|[^-])->(?!>)/g,"$1\u2192"],[/(^|[^<])<-(?!-)/g,"$1\u2190"]])}},Z={name:"common/symbols/cf",handler:function(e){var n=new RegExp('(^|[\\s(\\[+\u2248\xb1\u2212\u2014\u2013\\-])(\\d+(?:[.,]\\d+)?)[ \xa0\u2009]?(C|F)([\\W\\s.,:!?")\\]]|$)',"mg");return e.replace(n,"$1$2\u2009\xb0$3$4")}},J={name:"common/symbols/copy",handler:function(e){return S(e,[[/\(r\)/gi,"\xae"],[/(copyright )?\((c|\u0441)\)/gi,"\xa9"],[/\(tm\)/gi,"\u2122"]])}};k.addRules([V,Z,J]);var ee={name:"en-US/dash/main",index:"-5",handler:function(e){var n=d("common/dash"),t="[ ".concat("\xa0","]"),r="[ ".concat("\xa0","\n]"),a=new RegExp("".concat(t,"(").concat(n,")(").concat(r,")"),"g");return e.replace(a,"".concat("\xa0").concat("\u2014","$2"))}};k.addRules([ee]);var ne={name:"ru/dash/centuries",handler:function(e,n){var t="("+d("common/dash")+")",r=new RegExp("(X|I|V)[ |\xa0]?"+t+"[ |\xa0]?(X|I|V)","g");return e.replace(r,"$1"+n.dash+"$3")},settings:{dash:"\u2013"}},te={name:"ru/dash/daysMonth",handler:function(e,n){var t=new RegExp("(^|\\s)([123]?\\d)("+d("common/dash")+")([123]?\\d)[ \xa0]("+d("ru/monthGenCase")+")","g");return e.replace(t,"$1$2"+n.dash+"$4\xa0$5")},settings:{dash:"\u2013"}},re={name:"ru/dash/de",handler:function(e){var n=new RegExp("([a-\u044f\u0451]+) \u0434\u0435"+d("ru/dashAfterDe"),"g");return e.replace(n,"$1-\u0434\u0435")},disabled:!0},ae={name:"ru/dash/decade",handler:function(e,n){var t=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(t,"$1$20"+n.dash+"$40$5")},settings:{dash:"\u2013"}},se={name:"ru/dash/directSpeech",handler:function(e){var n=d("common/dash"),t=new RegExp('(["\xbb\u2018\u201c,])[ |\xa0]?('.concat(n,")[ |\xa0]"),"g"),r=new RegExp("(^|".concat($,")(").concat(n,")( |\xa0)"),"gm"),a=new RegExp("([.\u2026?!])[ \xa0](".concat(n,")[ \xa0]"),"g");return e.replace(t,"$1\xa0\u2014 ").replace(r,"$1\u2014\xa0").replace(a,"$1 \u2014\xa0")}},ue={name:"ru/dash/izpod",handler:function(e){var n=new RegExp(d("ru/dashBefore")+"(\u0418|\u0438)\u0437 \u043f\u043e\u0434"+d("ru/dashAfter"),"g");return e.replace(n,"$1$2\u0437-\u043f\u043e\u0434")}},ie={name:"ru/dash/izza",handler:function(e){var n=new RegExp(d("ru/dashBefore")+"(\u0418|\u0438)\u0437 \u0437\u0430"+d("ru/dashAfter"),"g");return e.replace(n,"$1$2\u0437-\u0437\u0430")}},oe={name:"ru/dash/ka",handler:function(e){var n=new RegExp("([a-\u044f\u0451]+) \u043a\u0430(\u0441\u044c)?"+d("ru/dashAfter"),"g");return e.replace(n,"$1-\u043a\u0430$2")}},ce={name:"ru/dash/koe",handler:function(e){var n=new RegExp(d("ru/dashBefore")+"([\u041a\u043a]\u043e[\u0435\u0439])\\s([\u0430-\u044f\u0451]{3,})"+d("ru/dashAfter"),"g");return e.replace(n,"$1$2-$3")}},le={name:"ru/dash/main",index:"-5",handler:function(e){var n=d("common/dash"),t=new RegExp("([ \xa0])("+n+")([ \xa0\\n])","g");return e.replace(t,"\xa0\u2014$3")}},pe={name:"ru/dash/month",handler:function(e,n){var t="("+d("ru/month")+")",r="("+d("ru/monthPreCase")+")",a=d("common/dash"),s=new RegExp(t+" ?("+a+") ?"+t,"gi"),u=new RegExp(r+" ?("+a+") ?"+r,"gi"),i="$1"+n.dash+"$3";return e.replace(s,i).replace(u,i)},settings:{dash:"\u2013"}},he={name:"ru/dash/surname",handler:function(e){var n=new RegExp("([\u0410-\u042f\u0401][\u0430-\u044f\u0451]+)\\s-([\u0430-\u044f\u0451]{1,3})(?![^\u0430-\u044f\u0451]|$)","g");return e.replace(n,"$1\xa0\u2014$2")}},me={name:"ru/dash/taki",handler:function(e){var n=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(n,"$1-$2")}},ge={name:"ru/dash/time",handler:function(e,n){var t=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(t,"$1$2"+n.dash+"$3")},settings:{dash:"\u2013"}},de={name:"ru/dash/to",handler:function(e){var n=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(n,"$1-$3")}},fe={name:"ru/dash/weekday",handler:function(e,n){var t="("+d("ru/weekday")+")",r=new RegExp(t+" ?("+d("common/dash")+") ?"+t,"gi");return e.replace(r,"$1"+n.dash+"$3")},settings:{dash:"\u2013"}},be={name:"ru/dash/years",handler:function(e,s){var n=d("common/dash"),t=new RegExp("(\\D|^)(\\d{4})[ \xa0]?("+n+")[ \xa0]?(\\d{4})(?=[ \xa0]?\u0433)","g");return e.replace(t,function(e,n,t,r,a){return parseInt(t,10)<parseInt(a,10)?n+t+s.dash+a:e})},settings:{dash:"\u2013"}};k.addRules([ne,te,re,ae,se,ue,ie,oe,ce,le,pe,he,me,ge,de,fe,be]);var ve={name:"ru/date/fromISO",handler:function(e){var n="(-|\\.|\\/)",t="(-|\\/)",r=new RegExp("(^|\\D)(\\d{4})"+n+"(\\d{2})"+n+"(\\d{2})(\\D|$)","gi"),a=new RegExp("(^|\\D)(\\d{2})"+t+"(\\d{2})"+t+"(\\d{4})(\\D|$)","gi");return e.replace(r,"$1$6.$4.$2$7").replace(a,"$1$4.$2.$6$7")}},$e={name:"ru/date/weekday",handler:function(e){var n=d("ru/monthGenCase"),t=d("ru/weekday"),r=new RegExp("(\\d)( |\xa0)("+n+"),( |\xa0)("+t+")","gi");return e.replace(r,function(){var e=arguments;return e[1]+e[2]+e[3].toLowerCase()+","+e[4]+e[5].toLowerCase()})}};k.addRules([ve,$e]);var ye={name:"ru/money/currency",handler:function(e){var n="([$\u20ac\xa5\u04b0\xa3\u20a4\u20bd])",t=new RegExp("(^|[\\D]{2})"+n+" ?([\\d.,]+([ \xa0\u2009\u202f]\\d{3})*)([ \xa0\u2009\u202f]?(\u0442\u044b\u0441\\.|\u043c\u043b\u043d|\u043c\u043b\u0440\u0434|\u0442\u0440\u043b\u043d))?","gm"),r=new RegExp("(^|[\\D])([\\d.,]+) ?"+n,"gm");return e.replace(t,function(e,n,t,r,a,s,u){return n+r+(u?"\xa0"+u:"")+"\xa0"+t}).replace(r,"$1$2\xa0$3")},disabled:!0},xe={name:"ru/money/ruble",handler:function(e){var n="$1\xa0\u20bd",t="(\\d+)( |\xa0)?(\u0440|\u0440\u0443\u0431)\\.",r=new RegExp("^"+t+"$","g"),a=new RegExp(t+"(?=[!?,:;])","g"),s=new RegExp(t+"(?=\\s+[A-\u042f\u0401])","g");return e.replace(r,n).replace(a,n).replace(s,n+".")},disabled:!0};k.addRules([ye,xe]);var Re={name:"ru/nbsp/abbr",handler:function(e){function n(e,n,t,r){return"\u0434\u0434"===t&&"\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:n+t+".\xa0"+r+"."}var t=new RegExp("(^|\\s|".concat($,")([\u0430-\u044f\u0451]{1,3})\\. ?([\u0430-\u044f\u0451]{1,3})\\."),"g");return e.replace(t,n).replace(t,n)}},we={name:"ru/nbsp/beforeParticle",index:"+5",handler:function(e){var n="(\u043b\u0438|\u043b\u044c|\u0436\u0435|\u0436|\u0431\u044b|\u0431)",t=new RegExp("([\u0410-\u042f\u0401\u0430-\u044f\u0451]) "+n+'(?=[,;:?!"\u2018\u201c\xbb])',"g"),r=new RegExp("([\u0410-\u042f\u0401\u0430-\u044f\u0451])[ \xa0]"+n+"[ \xa0]","g");return e.replace(t,"$1\xa0$2").replace(r,"$1\xa0$2 ")}},Se={name:"ru/nbsp/centuries",handler:function(e){var n=d("common/dash"),t="(^|\\s)([VIX]+)",r='(?=[,;:?!"\u2018\u201c\xbb]|$)',a=new RegExp(t+"[ \xa0]?\u0432\\.?"+r,"gm"),s=new RegExp(t+"("+n+")([VIX]+)[ \xa0]?\u0432\\.?([ \xa0]?\u0432\\.?)?"+r,"gm");return e.replace(a,"$1$2\xa0\u0432.").replace(s,"$1$2$3$4\xa0\u0432\u0432.")}},Ee={name:"ru/nbsp/dayMonth",handler:function(e){var n=new RegExp("(\\d{1,2}) ("+d("ru/shortMonth")+")","gi");return e.replace(n,"$1\xa0$2")}},_e={name:"ru/nbsp/initials",handler:function(e){var n=d("ru/quote"),t=new RegExp("(^|[\xa0\u202f "+n.left+$+'"])([\u0410-\u042f\u0401])\\.[\xa0\u202f ]?([\u0410-\u042f\u0401])\\.[\xa0\u202f ]?([\u0410-\u042f\u0401][\u0430-\u044f\u0451]+)(?=[\\s.,;:?!"'+n.right+"]|$)","gm");return e.replace(t,"$1$2.\xa0$3.\xa0$4")}},ke={name:"ru/nbsp/m",index:"+5",handler:function(e){var n=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(n,function(e,n,t,r,a,s){return n+t+"\xa0"+r+{2:"\xb2","\xb2":"\xb2",3:"\xb3","\xb3":"\xb3","":""}[a||""]+("\xa0"===s?" ":s)})}},Ue={name:"ru/nbsp/page",handler:function(e){var n=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(n,"$1$2.\xa0$3$4")}},qe={name:"ru/nbsp/ps",handler:function(e){var n=new RegExp("(^|\\s|".concat($,")[p\u0437]\\.[ \xa0]?([p\u0437]\\.[ \xa0]?)?[s\u044b]\\.:? "),"gim");return e.replace(n,function(e,n,t){return n+(t?"P.\xa0P.\xa0S. ":"P.\xa0S. ")})}},Te={name:"ru/nbsp/see",handler:function(e){var n=new RegExp("(^|\\s|".concat($,"|\\()(\u0441\u043c|\u0438\u043c)\\.[ \xa0]?([\u0430-\u044f\u04510-9a-z]+)([\\s.,?!]|$)"),"gi");return e.replace(n,function(e,n,t,r,a){return("\xa0"===n?" ":n)+t+".\xa0"+r+a})}},Ae={name:"ru/nbsp/years",index:"+5",handler:function(e){var n=d("common/dash"),t=new RegExp("(^|\\D)(\\d{4})("+n+')(\\d{4})[ \xa0]?\u0433\\.?([ \xa0]?\u0433\\.)?(?=[,;:?!"\u2018\u201c\xbb\\s]|$)',"gm");return e.replace(t,"$1$2$3$4\xa0\u0433\u0433.")}};k.addRules([Re,{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")}},we,Se,Ee,_e,ke,{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")}},Ue,qe,{name:"ru/nbsp/rubleKopek",handler:function(e){return e.replace(/(\d) ?(?=(\u0440\u0443\u0431|\u043a\u043e\u043f)\.)/g,"$1\xa0")}},Te,{name:"ru/nbsp/year",handler:function(e){return e.replace(/(^|\D)(\d{4}) ?\u0433([ ,;.\n]|$)/g,"$1$2\xa0\u0433$3")}},Ae]);var Be={name:"ru/number/ordinals",handler:function(e,n,t){var r=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)(?!["+t.getData("char")+"])","g");return e.replace(r,function(e,n,t){return n+"-"+{"\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"}[t]})}};function Le(e,n){var t=new RegExp('<span class="('+n.join("|")+')">([^]*?)</span>',"g");return e.replace(t,"$2")}function De(e,n){return e.replace(/<title>[^]*?<\/title>/i,function(e){return Le(e,n)})}k.addRules([{name:"ru/number/comma",handler:function(e){return e.replace(/(^|\s)(\d+)\.(\d+[\u00A0\u2009\u202F ]*?[%\u2030\xb0\xd7x])/gim,"$1$2,$3")}},Be]);var Ne=["typograf-oa-lbracket","typograf-oa-n-lbracket","typograf-oa-sp-lbracket"],Pe="ru/optalign/bracket",Me={name:Pe,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},Ie={name:Pe,queue:"start",handler:function(e){return Le(e,Ne)}},ze={name:Pe,queue:"end",handler:function(e){return De(e,Ne)}},Ce=["typograf-oa-comma","typograf-oa-comma-sp"],Oe="ru/optalign/comma",je={name:Oe,handler:function(e,n,t){var r=new RegExp("(["+t.getData("char")+"\\d\u0301]+), ","gi");return e.replace(r,'$1<span class="typograf-oa-comma">,</span><span class="typograf-oa-comma-sp"> </span>')},disabled:!0,htmlAttrs:!1},He={name:Oe,queue:"start",handler:function(e){return Le(e,Ce)}},Qe={name:Oe,queue:"end",handler:function(e){return De(e,Ce)}},Ye=["typograf-oa-lquote","typograf-oa-n-lquote","typograf-oa-sp-lquote"],Fe="ru/optalign/quote",Xe={name:Fe,handler:function(e){var n=this.getSetting("common/punctuation/quote","ru"),t="(["+n.left[0]+(n.left[1]||"")+"])",r=new RegExp("(^|\n\n|\uf000)("+t+")","g"),a=new RegExp("([^\n\uf000])([ \xa0\n])("+t+")","gi");return e.replace(r,'$1<span class="typograf-oa-n-lquote">$2</span>').replace(a,'$1<span class="typograf-oa-sp-lquote">$2</span><span class="typograf-oa-lquote">$3</span>')},disabled:!0,htmlAttrs:!1},We={name:Fe,queue:"start",handler:function(e){return Le(e,Ye)}},Ge={name:Fe,queue:"end",handler:function(e){return De(e,Ye)}};k.addRules([Me,je,Xe]),k.addInnerRules([Ie,ze,He,Qe,We,Ge]);var Ke=[];function Ve(e){var n,t,r=e[0],a="";if(e.length<8)return Ze(e);if(10<e.length)if("+"===r){if("7"!==e[1])return e;n=!0,e=e.substr(2)}else"8"===r&&(t=!0,e=e.substr(1));for(var s=8;2<=s;s--){var u=+e.substr(0,s);if(-1<Ke.indexOf(u)){a=e.substr(0,s),e=e.substr(s);break}}return a||(a=e.substr(0,5),e=e.substr(5)),(n?"+7\xa0":"")+(t?"8\xa0":"")+function(e){var n=+e,t=e.length,r=[e],a=!1;if(3<t)switch(t){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<n&&n<=999||495==n||499==n;return r=r.join("-"),a?r:"("+r+")"}(a)+"\xa0"+Ze(e)}function Ze(e){var n="";return e.length%2&&(n=e[0],n+=e.length<=5?"-":"",e=e.substr(1,e.length-1)),n+e.split(/(?=(?:\d\d)+$)/).join("-")}function Je(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 n=e.split("-"),t=+n[0];t<=+n[1];t++)Ke.push(t);else Ke.push(e)});var en={name:"ru/other/phone-number",live:!1,handler:function(e){var n=new RegExp("(^|,| |\uf000)(\\+7[\\d\\(\\) \xa0-]{10,18})(?=,|;|\uf000|$)","gm");return e.replace(n,function(e,n,t){var r=Je(t);return 12===r.length?n+Ve(r):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,n,t,r,a){var s=Je(a);return 5<=s.length?n+t+r+Ve(s):e})}};k.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,n,t,r){return n+t.toLowerCase()+"\u0301"+r})},disabled:!0},en]);var nn={name:"ru/punctuation/ano",handler:function(e){var n=new RegExp("([^!?,:;\\-\u2012\u2013\u2014\\s])(\\s+)(\u0430|\u043d\u043e)(?= |\xa0|\\n)","g");return e.replace(n,"$1,$2$3")},queue:"hide-safe-tags-html"},tn={name:"ru/punctuation/exclamationQuestion",index:"+5",handler:function(e){var n=new RegExp("(^|[^!])!\\?([^?]|$)","g");return e.replace(n,"$1?!$2")}};k.addRules([nn,{name:"ru/punctuation/exclamation",live:!1,handler:function(e){return e.replace(/(^|[^!])!{2}($|[^!])/gm,"$1!$2").replace(/(^|[^!])!{4}($|[^!])/gm,"$1!!!$2")}},tn,{name:"ru/punctuation/hellipQuestion",handler:function(e){return e.replace(/(^|[^.])(\.\.\.|\u2026),/g,"$1\u2026").replace(/(!|\?)(\.\.\.|\u2026)(?=[^.]|$)/g,"$1..")}}]);var rn={name:"ru/space/year",handler:function(e,n,t){var r=new RegExp("(^| |\xa0)(\\d{3,4})(\u0433\u043e\u0434([\u0430\u0443\u0435]|\u043e\u043c)?)([^"+t.getData("char")+"]|$)","g");return e.replace(r,"$1$2 $3$5")}};k.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")}},rn]);k.addRules([{name:"ru/symbols/NN",handler:function(e){return e.replace(/\u2116\u2116/g,"\u2116")}}]);var an={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"},sn=Object.keys(an).join(""),un={name:"ru/typo/switchingKeyboardLayout",handler:function(e){var n=new RegExp("(["+sn+"]{1,3})(?=[\u0410-\u042f\u0401\u0430-\u044f\u0451]+?)","g");return e.replace(n,function(e,n){for(var t="",r=0;r<n.length;r++)t+=an[n[r]];return t})}};k.addRules([un]);return k.titles={"common/html/e-mail":{"en-US":"Placement of links for e-mail",ru:"\u0420\u0430\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0441\u0441\u044b\u043b\u043e\u043a \u0434\u043b\u044f \u044d\u043b. \u043f\u043e\u0447\u0442\u044b"},"common/html/escape":{"en-US":"Escaping HTML",ru:"\u042d\u043a\u0440\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 HTML"},"common/html/nbr":{"en-US":"Replacement line break on <br/>",ru:"\u0417\u0430\u043c\u0435\u043d\u0430 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0430 \u0441\u0442\u0440\u043e\u043a\u0438 \u043d\u0430 <br/>"},"common/html/p":{"en-US":"Placement of paragraph",ru:"\u0420\u0430\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0430\u0431\u0437\u0430\u0446\u0435\u0432"},"common/html/processingAttrs":{"en-US":"Processing HTML attributes",ru:"\u0422\u0438\u043f\u043e\u0433\u0440\u0430\u0444\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 HTML-\u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432"},"common/html/quot":{common:'&\u2060quot; \u2192 "'},"common/html/stripTags":{"en-US":"Removing HTML-tags",ru:"\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 HTML-\u0442\u0435\u0433\u043e\u0432"},"common/html/url":{"en-US":"Placement of links",ru:"\u0420\u0430\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0441\u0441\u044b\u043b\u043e\u043a"},"common/nbsp/afterNumber":{"en-US":"Non-breaking space between number and word",ru:"\u041d\u0435\u0440\u0430\u0437. \u043f\u0440\u043e\u0431\u0435\u043b \u043c\u0435\u0436\u0434\u0443 \u0447\u0438\u0441\u043b\u043e\u043c \u0438 \u0441\u043b\u043e\u0432\u043e\u043c"},"common/nbsp/afterParagraphMark":{"en-US":"Non-breaking space after \xb6",ru:"\u041d\u0435\u0440\u0430\u0437. \u043f\u0440\u043e\u0431\u0435\u043b \u043f\u043e\u0441\u043b\u0435 \xb6"},"common/nbsp/afterSectionMark":{"en-US":"Non-breaking space after \xa7",ru:"\u041d\u0435\u0440\u0430\u0437. \u0443\u0437\u043a\u0438\u0439 \u043f\u0440\u043e\u0431\u0435\u043b \u043f\u043e\u0441\u043b\u0435 \xa7"},"common/nbsp/afterShortWord":{"en-US":"Non-breaking space after short word",ru:"\u041d\u0435\u0440\u0430\u0437. \u043f\u0440\u043e\u0431\u0435\u043b \u043f\u043e\u0441\u043b\u0435 \u043a\u043e\u0440\u043e\u0442\u043a\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430"},"common/nbsp/beforeShortLastNumber":{"en-US":"Non-breaking space before number (maximum 2 digits) at end of sentence",ru:"\u041d\u0435\u0440\u0430\u0437. \u043f\u0440\u043e\u0431\u0435\u043b \u043f\u0435\u0440\u0435\u0434 \u0447\u0438\u0441\u043b\u043e\u043c (\u043d\u0435 \u0431\u043e\u043b\u0435\u0435 2 \u0446\u0438\u0444\u0440) \u0432 \u043a\u043e\u043d\u0446\u0435 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f"},"common/nbsp/beforeShortLastWord":{"en-US":"Non-breaking space before last short word in sentence",ru:"\u041d\u0435\u0440\u0430\u0437. \u043f\u0440\u043e\u0431\u0435\u043b \u043f\u0435\u0440\u0435\u0434 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u043c \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u043c \u0441\u043b\u043e\u0432\u043e\u043c \u0432 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0438"},"common/nbsp/dpi":{"en-US":"Non-breaking space before lpi and dpi",ru:"\u041d\u0435\u0440\u0430\u0437. \u043f\u0440\u043e\u0431\u0435\u043b \u043f\u0435\u0440\u0435\u0434 lpi \u0438 dpi"},"common/nbsp/nowrap":{"en-US":"Replace non-breaking space to normal space in tags nowrap and nobr",ru:"\u0417\u0430\u043c\u0435\u043d\u044f\u0442\u044c \u043d\u0435\u0440\u0430\u0437. \u043f\u0440\u043e\u0431\u0435\u043b \u043d\u0430 \u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u043f\u0440\u043e\u0431\u0435\u043b \u0432 \u0442\u0435\u0433\u0430\u0445 nowrap \u0438 nobr"},"common/nbsp/replaceNbsp":{"en-US":"Replacing non-breaking space on normal before text correction",ru:"\u0417\u0430\u043c\u0435\u043d\u0430 \u043d\u0435\u0440\u0430\u0437\u0440\u044b\u0432\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0431\u0435\u043b\u0430 \u043d\u0430 \u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u043f\u0435\u0440\u0435\u0434 \u0442\u0438\u043f\u043e\u0433\u0440\u0430\u0444\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c"},"common/number/digitGrouping":{"en-US":"Divide into groups numbers with many digits",ru:"\u0420\u0430\u0437\u0431\u0438\u0432\u0430\u0442\u044c \u0434\u043b\u0438\u043d\u043d\u044b\u0435 \u0447\u0438\u0441\u043b\u0430 \u043f\u043e \u0440\u0430\u0437\u0440\u044f\u0434\u0430\u043c"},"common/number/fraction":{common:"1/2 \u2192 \xbd, 1/4 \u2192 \xbc, 3/4 \u2192 \xbe"},"common/number/mathSigns":{common:"!= \u2192 \u2260, <= \u2192 \u2264, >= \u2192 \u2265, ~= \u2192 \u2245, +- \u2192 \xb1"},"common/number/times":{common:"x \u2192 \xd7 (10 x 5 \u2192 10\xd75)"},"common/other/delBOM":{"en-US":"Delete character BOM (Byte Order Mark)",ru:"\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u0430 BOM (Byte Order Mark)"},"common/other/repeatWord":{"en-US":"Removing repeat words",ru:"\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u0432\u0442\u043e\u0440\u0430 \u0441\u043b\u043e\u0432\u0430"},"common/punctuation/apostrophe":{"en-US":"Placement of correct apostrophe",ru:"\u0420\u0430\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0433\u043e \u0430\u043f\u043e\u0441\u0442\u0440\u043e\u0444\u0430"},"common/punctuation/delDoublePunctuation":{"en-US":"Removing double punctuation",ru:"\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0434\u0432\u043e\u0439\u043d\u043e\u0439 \u043f\u0443\u043d\u043a\u0442\u0443\u0430\u0446\u0438\u0438"},"common/punctuation/hellip":{"en-US":"Replacement of three points by ellipsis",ru:"\u0417\u0430\u043c\u0435\u043d\u0430 \u0442\u0440\u0451\u0445 \u0442\u043e\u0447\u0435\u043a \u043d\u0430 \u043c\u043d\u043e\u0433\u043e\u0442\u043e\u0447\u0438\u0435"},"common/punctuation/quote":{"en-US":"Placement of quotation marks in texts",ru:"\u0420\u0430\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043a\u0430\u0432\u044b\u0447\u0435\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u0438\u0434\u0430"},"common/punctuation/quoteLink":{"en-US":"Removal quotes outside a link",ru:"\u0412\u044b\u043d\u043e\u0441 \u043a\u0430\u0432\u044b\u0447\u0435\u043a \u0437\u0430 \u043f\u0440\u0435\u0434\u0435\u043b\u044b \u0441\u0441\u044b\u043b\u043a\u0438"},"common/space/afterPunctuation":{"en-US":"space after punctuation",ru:"\u041f\u0440\u043e\u0431\u0435\u043b \u043f\u043e\u0441\u043b\u0435 \u0437\u043d\u0430\u043a\u043e\u0432 \u043f\u0443\u043d\u043a\u0442\u0443\u0430\u0446\u0438\u0438"},"common/space/beforeBracket":{"en-US":"Space before opening bracket",ru:"\u041f\u0440\u043e\u0431\u0435\u043b \u043f\u0435\u0440\u0435\u0434 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u044e\u0449\u0435\u0439 \u0441\u043a\u043e\u0431\u043a\u043e\u0439"},"common/space/bracket":{"en-US":"Remove extra spaces after opening and before closing bracket",ru:"\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043b\u0438\u0448\u043d\u0438\u0445 \u043f\u0440\u043e\u0431\u0435\u043b\u043e\u0432 \u043f\u043e\u0441\u043b\u0435 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u044e\u0449\u0435\u0439 \u0438 \u043f\u0435\u0440\u0435\u0434 \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u044e\u0449\u0435\u0439 \u0441\u043a\u043e\u0431\u043a\u043e\u0439"},"common/space/delBeforePercent":{"en-US":"Remove space before %, \u2030 and \u2031",ru:"\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0431\u0435\u043b\u0430 \u043f\u0435\u0440\u0435\u0434 %, \u2030 \u0438 \u2031"},"common/space/delBeforePunctuation":{"en-US":"Remove spaces before punctuation",ru:"\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0431\u0435\u043b\u043e\u0432 \u043f\u0435\u0440\u0435\u0434 \u0437\u043d\u0430\u043a\u0430\u043c\u0438 \u043f\u0443\u043d\u043a\u0442\u0443\u0430\u0446\u0438\u0438"},"common/space/delLeadingBlanks":{"en-US":"Remove spaces at start of line",ru:"\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0431\u0435\u043b\u043e\u0432 \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u0441\u0442\u0440\u043e\u043a\u0438"},"common/space/delRepeatN":{"en-US":"Remove duplicate line breaks",ru:"\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0449\u0438\u0445\u0441\u044f \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u043e\u0432 \u0441\u0442\u0440\u043e\u043a\u0438"},"common/space/delRepeatSpace":{"en-US":"Removing duplicate spaces between characters",ru:"\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0449\u0438\u0445\u0441\u044f \u043f\u0440\u043e\u0431\u0435\u043b\u043e\u0432 \u043c\u0435\u0436\u0434\u0443 \u0441\u0438\u043c\u0432\u043e\u043b\u0430\u043c\u0438"},"common/space/delTrailingBlanks":{"en-US":"Remove spaces at end of line",ru:"\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0431\u0435\u043b\u043e\u0432 \u0432 \u043a\u043e\u043d\u0446\u0435 \u0441\u0442\u0440\u043e\u043a\u0438"},"common/space/insertFinalNewline":{"en-US":"Insert final newline",ru:"\u0412\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0432 \u043a\u043e\u043d\u0446\u0435 \u0442\u0435\u043a\u0441\u0442\u0430 \u043f\u0435\u0440\u0435\u0432\u043e\u0434 \u0441\u0442\u0440\u043e\u043a\u0438"},"common/space/replaceTab":{"en-US":"Replacement of tab to 4 spaces",ru:"\u0417\u0430\u043c\u0435\u043d\u0430 \u0442\u0430\u0431\u0430 \u043d\u0430 4 \u043f\u0440\u043e\u0431\u0435\u043b\u0430"},"common/space/squareBracket":{"en-US":"Remove extra spaces after opening and before closing square bracket",ru:"\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043b\u0438\u0448\u043d\u0438\u0445 \u043f\u0440\u043e\u0431\u0435\u043b\u043e\u0432 \u043f\u043e\u0441\u043b\u0435 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u044e\u0449\u0435\u0439 \u0438 \u043f\u0435\u0440\u0435\u0434 \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u044e\u0449\u0435\u0439 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043d\u043e\u0439 \u0441\u043a\u043e\u0431\u043a\u043e\u0439"},"common/space/trimLeft":{"en-US":"Remove spaces and line breaks in beginning of text",ru:"\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0431\u0435\u043b\u043e\u0432 \u0438 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u043e\u0432 \u0441\u0442\u0440\u043e\u043a \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u0442\u0435\u043a\u0441\u0442\u0430"},"common/space/trimRight":{"en-US":"Remove spaces and line breaks at end of text",ru:"\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0431\u0435\u043b\u043e\u0432 \u0438 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u043e\u0432 \u0441\u0442\u0440\u043e\u043a \u0432 \u043a\u043e\u043d\u0446\u0435 \u0442\u0435\u043a\u0441\u0442\u0430"},"common/symbols/arrow":{common:"-> \u2192 \u2192, <- \u2192 \u2190"},"common/symbols/cf":{"en-US":"Adding \xb0 to C and F",ru:"\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \xb0 \u043a C \u0438 F"},"common/symbols/copy":{common:"(c) \u2192 \xa9, (tm) \u2192 \u2122, (r) \u2192 \xae"},"en-US/dash/main":{"en-US":"Replace hyphens surrounded by spaces with an em-dash",ru:"\u0417\u0430\u043c\u0435\u043d\u0430 \u0434\u0435\u0444\u0438\u0441\u0430 \u043d\u0430 \u0434\u043b\u0438\u043d\u043d\u043e\u0435 \u0442\u0438\u0440\u0435"},"ru/dash/centuries":{"en-US":"Hyphen to dash in centuries",ru:"\u0417\u0430\u043c\u0435\u043d\u0430 \u0434\u0435\u0444\u0438\u0441\u0430 \u043d\u0430 \u0442\u0438\u0440\u0435 \u0432 \u0432\u0435\u043a\u0430\u0445"},"ru/dash/daysMonth":{"en-US":"Dash between days of one month",ru:"\u0422\u0438\u0440\u0435 \u043c\u0435\u0436\u0434\u0443 \u0434\u043d\u044f\u043c\u0438 \u043e\u0434\u043d\u043e\u0433\u043e \u043c\u0435\u0441\u044f\u0446\u0430"},"ru/dash/de":{"en-US":"Hyphen before \u201c\u0434\u0435\u201d",ru:"\u0414\u0435\u0444\u0438\u0441 \u043f\u0435\u0440\u0435\u0434 \xab\u0434\u0435\xbb"},"ru/dash/decade":{"en-US":"Dash in decade",ru:"\u0422\u0438\u0440\u0435 \u0432 \u0434\u0435\u0441\u044f\u0442\u0438\u043b\u0435\u0442\u0438\u044f\u0445, 80\u201490-\u0435 \u0433\u0433."},"ru/dash/directSpeech":{"en-US":"Dash in direct speech",ru:"\u0422\u0438\u0440\u0435 \u0432 \u043f\u0440\u044f\u043c\u043e\u0439 \u0440\u0435\u0447\u0438"},"ru/dash/izpod":{"en-US":"Hyphen between \u201c\u0438\u0437-\u043f\u043e\u0434\u201d",ru:"\u0414\u0435\u0444\u0438\u0441 \u043c\u0435\u0436\u0434\u0443 \xab\u0438\u0437-\u043f\u043e\u0434\xbb"},"ru/dash/izza":{"en-US":"Hyphen between \u201c\u0438\u0437-\u0437\u0430\u201d",ru:"\u0414\u0435\u0444\u0438\u0441 \u043c\u0435\u0436\u0434\u0443 \xab\u0438\u0437-\u0437\u0430\xbb"},"ru/dash/ka":{"en-US":"Hyphen before \u201c\u043a\u0430\u201d and \u201c\u043a\u0430\u0441\u044c\u201d",ru:"\u0414\u0435\u0444\u0438\u0441 \u043f\u0435\u0440\u0435\u0434 \xab\u043a\u0430\xbb \u0438 \xab\u043a\u0430\u0441\u044c\xbb"},"ru/dash/koe":{"en-US":"Hyphen after \u201c\u043a\u043e\u0435\u201d and \u201c\u043a\u043e\u0439\u201d",ru:"\u0414\u0435\u0444\u0438\u0441 \u043f\u043e\u0441\u043b\u0435 \xab\u043a\u043e\u0435\xbb \u0438 \xab\u043a\u043e\u0439\xbb"},"ru/dash/main":{"en-US":"Replacement hyphen with dash",ru:"\u0417\u0430\u043c\u0435\u043d\u0430 \u0434\u0435\u0444\u0438\u0441\u0430 \u043d\u0430 \u0442\u0438\u0440\u0435"},"ru/dash/month":{"en-US":"Dash between months",ru:"\u0422\u0438\u0440\u0435 \u043c\u0435\u0436\u0434\u0443 \u043c\u0435\u0441\u044f\u0446\u0430\u043c\u0438"},"ru/dash/surname":{"en-US":"Acronyms with a dash",ru:"\u0421\u043e\u043a\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0442\u0438\u0440\u0435"},"ru/dash/taki":{"en-US":"Hyphen between \u201c\u0432\u0435\u0440\u043d\u043e-\u0442\u0430\u043a\u0438\u201d and etc.",ru:"\u0414\u0435\u0444\u0438\u0441 \u043c\u0435\u0436\u0434\u0443 \xab\u0432\u0435\u0440\u043d\u043e-\u0442\u0430\u043a\u0438\xbb \u0438 \u0442. \u0434."},"ru/dash/time":{"en-US":"Dash in time intervals",ru:"\u0422\u0438\u0440\u0435 \u0432 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u0430\u0445 \u0432\u0440\u0435\u043c\u0435\u043d\u0438"},"ru/dash/to":{"en-US":"Hyphen before \u201c\u0442\u043e\u201d, \u201c\u043b\u0438\u0431\u043e\u201d, \u201c\u043d\u0438\u0431\u0443\u0434\u044c\u201d",ru:"\u0414\u0435\u0444\u0438\u0441 \u043f\u0435\u0440\u0435\u0434 \xab\u0442\u043e\xbb, \xab\u043b\u0438\u0431\u043e\xbb, \xab\u043d\u0438\u0431\u0443\u0434\u044c\xbb"},"ru/dash/weekday":{"en-US":"Dash between the days of the week",ru:"\u0422\u0438\u0440\u0435 \u043c\u0435\u0436\u0434\u0443 \u0434\u043d\u044f\u043c\u0438 \u043d\u0435\u0434\u0435\u043b\u0438"},"ru/dash/years":{"en-US":"Hyphen to dash in years",ru:"\u0417\u0430\u043c\u0435\u043d\u0430 \u0434\u0435\u0444\u0438\u0441\u0430 \u043d\u0430 \u0442\u0438\u0440\u0435 \u0432 \u0433\u043e\u0434\u0430\u0445"},"ru/date/fromISO":{"en-US":"Converting dates YYYY-MM-DD type DD.MM.YYYY",ru:"\u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0430\u0442 YYYY-MM-DD \u043a \u0432\u0438\u0434\u0443 DD.MM.YYYY"},"ru/date/weekday":{common:"2 \u041c\u0430\u044f, \u041f\u043e\u043d\u0435\u0434\u0435\u043b\u044c\u043d\u0438\u043a \u2192 2 \u043c\u0430\u044f, \u043f\u043e\u043d\u0435\u0434\u0435\u043b\u044c\u043d\u0438\u043a"},"ru/money/currency":{"en-US":"Currency symbol ($, \u20ac, \xa5, \u04b0, \xa3 and \u20a4) after the number, $100 \u2192 100\xa0$",ru:"\u0421\u0438\u043c\u0432\u043e\u043b \u0432\u0430\u043b\u044e\u0442\u044b ($, \u20ac, \xa5, \u04b0, \xa3 \u0438 \u20a4) \u043f\u043e\u0441\u043b\u0435 \u0447\u0438\u0441\u043b\u0430, $100 \u2192 100\xa0$"},"ru/money/ruble":{common:"1 \u0440\u0443\u0431. \u2192 1 \u20bd"},"ru/nbsp/abbr":{"en-US":"Non-breaking space in abbreviations, e.g. \u201c\u0442.\xa0\u0434.\u201d",ru:"\u041d\u0435\u0440\u0430\u0437. \u043f\u0440\u043e\u0431\u0435\u043b \u0432 \u0441\u043e\u043a\u0440\u0430\u0449\u0435\u043d\u0438\u044f\u0445, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \xab\u0442.\xa0\u0434.\xbb"},"ru/nbsp/addr":{"en-US":"Placement of non-breaking space after \u201c\u0433.\u201d, \u201c\u043e\u0431\u043b.\u201d, \u201c\u0443\u043b.\u201d, \u201c\u043f\u0440.\u201d, \u201c\u043a\u0432.\u201d et al.",ru:"\u0420\u0430\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043d\u0435\u0440\u0430\u0437. \u043f\u0440\u043e\u0431\u0435\u043b\u0430 \u043f\u043e\u0441\u043b\u0435 \xab\u0433.\xbb, \xab\u043e\u0431\u043b.\xbb, \xab\u0443\u043b.\xbb, \xab\u043f\u0440.\xbb, \xab\u043a\u0432.\xbb \u0438 \u0434\u0440."},"ru/nbsp/afterNumberSign":{"en-US":"Non-breaking thin space after \u2116",ru:"\u041d\u0435\u0440\u0430\u0437. \u0443\u0437\u043a\u0438\u0439 \u043f\u0440\u043e\u0431\u0435\u043b \u043f\u043e\u0441\u043b\u0435 \u2116"},"ru/nbsp/beforeParticle":{"en-US":"Non-breaking space before \u201c\u043b\u0438\u201d, \u201c\u043b\u044c\u201d, \u201c\u0436\u0435\u201d, \u201c\u0431\u044b\u201d, \u201c\u0431\u201d",ru:"\u041d\u0435\u0440\u0430\u0437. \u043f\u0440\u043e\u0431\u0435\u043b \u043f\u0435\u0440\u0435\u0434 \xab\u043b\u0438\xbb, \xab\u043b\u044c\xbb, \xab\u0436\u0435\xbb, \xab\u0431\u044b\xbb, \xab\u0431\xbb"},"ru/nbsp/centuries":{"en-US":"Remove spaces and extra points in \u201c\u0432\u0432.\u201d",ru:"\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0431\u0435\u043b\u043e\u0432 \u0438 \u043b\u0438\u0448\u043d\u0438\u0445 \u0442\u043e\u0447\u0435\u043a \u0432 \xab\u0432\u0432.\xbb"},"ru/nbsp/dayMonth":{"en-US":"Non-breaking space between number and month",ru:"\u041d\u0435\u0440\u0430\u0437. \u043f\u0440\u043e\u0431\u0435\u043b \u043c\u0435\u0436\u0434\u0443 \u0447\u0438\u0441\u043b\u043e\u043c \u0438 \u043c\u0435\u0441\u044f\u0446\u0435\u043c"},"ru/nbsp/initials":{"en-US":"Binding of initials to the name",ru:"\u041f\u0440\u0438\u0432\u044f\u0437\u043a\u0430 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u043e\u0432 \u043a \u0444\u0430\u043c\u0438\u043b\u0438\u0438"},"ru/nbsp/m":{"en-US":"m2 \u2192 \u043c\xb2, m3 \u2192 \u043c\xb3 and non-breaking space",ru:"\u043c2 \u2192 \u043c\xb2, \u043c3 \u2192 \u043c\xb3 \u0438 \u043d\u0435\u0440\u0430\u0437. \u043f\u0440\u043e\u0431\u0435\u043b"},"ru/nbsp/mln":{"en-US":"Non-breaking space between number and \u201c\u0442\u044b\u0441.\u201d, \u201c\u043c\u043b\u043d\u201d, \u201c\u043c\u043b\u0440\u0434\u201d and \u201c\u0442\u0440\u043b\u043d\u201d",ru:"\u041d\u0435\u0440\u0430\u0437\u0440. \u043f\u0440\u043e\u0431\u0435\u043b \u043c\u0435\u0436\u0434\u0443 \u0447\u0438\u0441\u043b\u043e\u043c \u0438 \xab\u0442\u044b\u0441.\xbb, \xab\u043c\u043b\u043d\xbb, \xab\u043c\u043b\u0440\u0434\xbb \u0438 \xab\u0442\u0440\u043b\u043d\xbb"},"ru/nbsp/ooo":{"en-US":"Non-breaking space after \u201cOOO, \u041e\u0410\u041e, \u0417\u0410\u041e, \u041d\u0418\u0418, \u041f\u0411\u041e\u042e\u041b\u201d",ru:"\u041d\u0435\u0440\u0430\u0437. \u043f\u0440\u043e\u0431\u0435\u043b \u043f\u043e\u0441\u043b\u0435 OOO, \u041e\u0410\u041e, \u0417\u0410\u041e, \u041d\u0418\u0418 \u0438 \u041f\u0411\u041e\u042e\u041b"},"ru/nbsp/page":{"en-US":"Non-breaking space after \u201c\u0441\u0442\u0440.\u201d, \u201c\u0433\u043b.\u201d, \u201c\u0440\u0438\u0441.\u201d, \u201c\u0438\u043b\u043b.\u201d",ru:"\u041d\u0435\u0440\u0430\u0437. \u043f\u0440\u043e\u0431\u0435\u043b \u043f\u043e\u0441\u043b\u0435 \xab\u0441\u0442\u0440.\xbb, \xab\u0433\u043b.\xbb, \xab\u0440\u0438\u0441.\xbb, \xab\u0438\u043b\u043b.\xbb"},"ru/nbsp/ps":{"en-US":"Non-breaking space in P.\xa0S. and P.\xa0P.\xa0S.",ru:"\u041d\u0435\u0440\u0430\u0437. \u043f\u0440\u043e\u0431\u0435\u043b \u0432 P.\xa0S. \u0438 P.\xa0P.\xa0S."},"ru/nbsp/rubleKopek":{"en-US":"Not once. space before the \u201crub\u201d and \u201ccop.\u201d",ru:"\u041d\u0435\u0440\u0430\u0437. \u043f\u0440\u043e\u0431\u0435\u043b \u043f\u0435\u0440\u0435\u0434 \xab\u0440\u0443\u0431.\xbb \u0438 \xab\u043a\u043e\u043f.\xbb"},"ru/nbsp/see":{"en-US":"Non-breaking space after abbreviation \xab\u0441\u043c.\xbb and \xab\u0438\u043c.\xbb",ru:"\u041d\u0435\u0440\u0430\u0437. \u043f\u0440\u043e\u0431\u0435\u043b \u043f\u043e\u0441\u043b\u0435 \u0441\u043e\u043a\u0440\u0430\u0449\u0435\u043d\u0438\u0439 \xab\u0441\u043c.\xbb \u0438 \xab\u0438\u043c.\xbb"},"ru/nbsp/year":{"en-US":"Non-breaking space before XXXX \u0433. (2012 \u0433.)",ru:"\u041d\u0435\u0440\u0430\u0437. \u043f\u0440\u043e\u0431\u0435\u043b \u043f\u043e\u0441\u043b\u0435 XXXX \u0433. (2012 \u0433.)"},"ru/nbsp/years":{"en-US":"\u0433.\u0433. \u2192 \u0433\u0433. and non-breaking space",ru:"\u0433.\u0433. \u2192 \u0433\u0433. \u0438 \u043d\u0435\u0440\u0430\u0437. \u043f\u0440\u043e\u0431\u0435\u043b"},"ru/number/comma":{"en-US":"Commas in numbers",ru:"\u0417\u0430\u043c\u0435\u043d\u0430 \u0442\u043e\u0447\u043a\u0438 \u043d\u0430 \u0437\u0430\u043f\u044f\u0442\u0443\u044e \u0432 \u0447\u0438\u0441\u043b\u0430\u0445"},"ru/number/ordinals":{common:"N-\u044b\u0439, -\u043e\u0439, -\u0430\u044f, -\u043e\u0435, -\u044b\u0435, -\u044b\u043c, -\u043e\u043c, -\u044b\u0445 \u2192 N-\u0439, -\u044f, -\u0435, -\u043c, -\u0445 (25-\u0439)"},"ru/optalign/bracket":{"en-US":"for opening bracket",ru:"\u0434\u043b\u044f \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u044e\u0449\u0435\u0439 \u0441\u043a\u043e\u0431\u043a\u0438"},"ru/optalign/comma":{"en-US":"for comma",ru:"\u0434\u043b\u044f \u0437\u0430\u043f\u044f\u0442\u043e\u0439"},"ru/optalign/quote":{"en-US":"for opening quotation marks",ru:"\u0434\u043b\u044f \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u044e\u0449\u0435\u0439 \u043a\u0430\u0432\u044b\u0447\u043a\u0438"},"ru/other/accent":{"en-US":"Replacement capital letters to lowercase with addition of accent",ru:"\u0417\u0430\u043c\u0435\u043d\u0430 \u0437\u0430\u0433\u043b\u0430\u0432\u043d\u043e\u0439 \u0431\u0443\u043a\u0432\u044b \u043d\u0430 \u0441\u0442\u0440\u043e\u0447\u043d\u0443\u044e \u0441 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u0443\u0434\u0430\u0440\u0435\u043d\u0438\u044f"},"ru/other/phone-number":{"en-US":"Formatting phone numbers",ru:"\u0424\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u043d\u044b\u0445 \u043d\u043e\u043c\u0435\u0440\u043e\u0432"},"ru/punctuation/ano":{"en-US":"Placement of commas before \u201c\u0430\u201d and \u201c\u043d\u043e\u201d",ru:"\u0420\u0430\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0437\u0430\u043f\u044f\u0442\u044b\u0445 \u043f\u0435\u0440\u0435\u0434 \xab\u0430\xbb \u0438 \xab\u043d\u043e\xbb"},"ru/punctuation/exclamation":{common:"!! \u2192 !"},"ru/punctuation/exclamationQuestion":{common:"!? \u2192 ?!"},"ru/punctuation/hellipQuestion":{common:"\xab?\u2026\xbb \u2192 \xab?..\xbb, \xab!\u2026\xbb \u2192 \xab!..\xbb, \xab\u2026,\xbb \u2192 \xab\u2026\xbb"},"ru/space/afterHellip":{"en-US":"Space after \u201c...\u201d, \u201c!..\u201d and \u201c?..\u201d",ru:"\u041f\u0440\u043e\u0431\u0435\u043b \u043f\u043e\u0441\u043b\u0435 \xab...\xbb, \xab!..\xbb \u0438 \xab?..\xbb"},"ru/space/year":{"en-US":"Space between number and word \u201c\u0433\u043e\u0434\u201d",ru:"\u041f\u0440\u043e\u0431\u0435\u043b \u043c\u0435\u0436\u0434\u0443 \u0447\u0438\u0441\u043b\u043e\u043c \u0438 \u0441\u043b\u043e\u0432\u043e\u043c \xab\u0433\u043e\u0434\xbb"},"ru/symbols/NN":{common:"\u2116\u2116 \u2192 \u2116"},"ru/typo/switchingKeyboardLayout":{"en-US":"Replacement of Latin letters in Russian. Typos occur when you switch keyboard layouts",ru:"\u0417\u0430\u043c\u0435\u043d\u0430 \u043b\u0430\u0442\u0438\u043d\u0441\u043a\u0438\u0445 \u0431\u0443\u043a\u0432 \u043d\u0430 \u0440\u0443\u0441\u0441\u043a\u0438\u0435. \u041e\u043f\u0435\u0447\u0430\u0442\u043a\u0438, \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0449\u0438\u0435 \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u043d\u043e\u0439 \u0440\u0430\u0441\u043a\u043b\u0430\u0434\u043a\u0438"}},k.groups=[{name:"punctuation",title:{"en-US":"Punctuation",ru:"\u041f\u0443\u043d\u043a\u0442\u0443\u0430\u0446\u0438\u044f"}},{name:"optalign",title:{"en-US":"Hanging punctuation",ru:"\u0412\u0438\u0441\u044f\u0447\u0430\u044f \u043f\u0443\u043d\u043a\u0442\u0443\u0430\u0446\u0438\u044f"}},{name:"dash",title:{"en-US":"Dash and hyphen",ru:"\u0422\u0438\u0440\u0435 \u0438 \u0434\u0435\u0444\u0438\u0441"}},{name:"nbsp",title:{"en-US":"Non-breaking space",ru:"\u041d\u0435\u0440\u0430\u0437\u0440\u044b\u0432\u043d\u044b\u0439 \u043f\u0440\u043e\u0431\u0435\u043b"}},{name:"space",title:{"en-US":"Space and line ending",ru:"\u041f\u0440\u043e\u0431\u0435\u043b \u0438 \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u0435 \u0441\u0442\u0440\u043e\u043a\u0438"}},{name:"html",title:{"en-US":"HTML",ru:"HTML"}},{name:"date",title:{"en-US":"Date",ru:"\u0414\u0430\u0442\u0430"}},{name:"money",title:{"en-US":"Money",ru:"\u0414\u0435\u043d\u044c\u0433\u0438"}},{name:"number",title:{"en-US":"Numbers and mathematical expressions",ru:"\u0427\u0438\u0441\u043b\u0430 \u0438 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f"}},{name:"symbols",title:{"en-US":"Symbols and signs",ru:"\u0421\u0438\u043c\u0432\u043e\u043b\u044b \u0438 \u0437\u043d\u0430\u043a\u0438"}},{name:"typo",title:{"en-US":"Typos",ru:"\u041e\u043f\u0435\u0447\u0430\u0442\u043a\u0438"}},{name:"other",title:{"en-US":"Other",ru:"\u041f\u0440\u043e\u0447\u0435\u0435"}}],k}); \ No newline at end of file diff --git a/assets/components/tinymcerte/js/vendor/tinymce/plugins/typograf/dist/typograf.css b/assets/components/tinymcerte/js/vendor/tinymce/plugins/typograf/dist/typograf.css new file mode 100644 index 0000000..c2dbaad --- /dev/null +++ b/assets/components/tinymcerte/js/vendor/tinymce/plugins/typograf/dist/typograf.css @@ -0,0 +1,36 @@ +.typograf-nowrap +{ + white-space: nowrap; +} + +.typograf-oa-sp-lbracket +{ + margin-right: 0.3em; +} + +.typograf-oa-lbracket, +.typograf-oa-n-lbracket +{ + margin-left: -0.3em; +} + +.typograf-oa-comma +{ + margin-right: -0.2em; +} + +.typograf-oa-comma-sp +{ + margin-left: 0.2em; +} + +.typograf-oa-sp-lquote +{ + margin-right: 0.44em; +} + +.typograf-oa-lquote, +.typograf-oa-n-lquote +{ + margin-left: -0.44em; +} diff --git a/assets/components/tinymcerte/js/vendor/tinymce/plugins/typograf/dist/typograf.groups.js b/assets/components/tinymcerte/js/vendor/tinymce/plugins/typograf/dist/typograf.groups.js new file mode 100644 index 0000000..2286391 --- /dev/null +++ b/assets/components/tinymcerte/js/vendor/tinymce/plugins/typograf/dist/typograf.groups.js @@ -0,0 +1,87 @@ +export default [ + { + "name": "punctuation", + "title": { + "en-US": "Punctuation", + "ru": "Пунктуация" + } + }, + { + "name": "optalign", + "title": { + "en-US": "Hanging punctuation", + "ru": "Висячая пунктуация" + } + }, + { + "name": "dash", + "title": { + "en-US": "Dash and hyphen", + "ru": "Тире и дефис" + } + }, + { + "name": "nbsp", + "title": { + "en-US": "Non-breaking space", + "ru": "Неразрывный пробел" + } + }, + { + "name": "space", + "title": { + "en-US": "Space and line ending", + "ru": "Пробел и окончание строки" + } + }, + { + "name": "html", + "title": { + "en-US": "HTML", + "ru": "HTML" + } + }, + { + "name": "date", + "title": { + "en-US": "Date", + "ru": "Дата" + } + }, + { + "name": "money", + "title": { + "en-US": "Money", + "ru": "Деньги" + } + }, + { + "name": "number", + "title": { + "en-US": "Numbers and mathematical expressions", + "ru": "Числа и математические выражения" + } + }, + { + "name": "symbols", + "title": { + "en-US": "Symbols and signs", + "ru": "Символы и знаки" + } + }, + { + "name": "typo", + "title": { + "en-US": "Typos", + "ru": "Опечатки" + } + }, + { + "name": "other", + "title": { + "en-US": "Other", + "ru": "Прочее" + } + } +] +; diff --git a/assets/components/tinymcerte/js/vendor/tinymce/plugins/typograf/dist/typograf.groups.json b/assets/components/tinymcerte/js/vendor/tinymce/plugins/typograf/dist/typograf.groups.json new file mode 100644 index 0000000..4babead --- /dev/null +++ b/assets/components/tinymcerte/js/vendor/tinymce/plugins/typograf/dist/typograf.groups.json @@ -0,0 +1,86 @@ +[ + { + "name": "punctuation", + "title": { + "en-US": "Punctuation", + "ru": "Пунктуация" + } + }, + { + "name": "optalign", + "title": { + "en-US": "Hanging punctuation", + "ru": "Висячая пунктуация" + } + }, + { + "name": "dash", + "title": { + "en-US": "Dash and hyphen", + "ru": "Тире и дефис" + } + }, + { + "name": "nbsp", + "title": { + "en-US": "Non-breaking space", + "ru": "Неразрывный пробел" + } + }, + { + "name": "space", + "title": { + "en-US": "Space and line ending", + "ru": "Пробел и окончание строки" + } + }, + { + "name": "html", + "title": { + "en-US": "HTML", + "ru": "HTML" + } + }, + { + "name": "date", + "title": { + "en-US": "Date", + "ru": "Дата" + } + }, + { + "name": "money", + "title": { + "en-US": "Money", + "ru": "Деньги" + } + }, + { + "name": "number", + "title": { + "en-US": "Numbers and mathematical expressions", + "ru": "Числа и математические выражения" + } + }, + { + "name": "symbols", + "title": { + "en-US": "Symbols and signs", + "ru": "Символы и знаки" + } + }, + { + "name": "typo", + "title": { + "en-US": "Typos", + "ru": "Опечатки" + } + }, + { + "name": "other", + "title": { + "en-US": "Other", + "ru": "Прочее" + } + } +] diff --git a/assets/components/tinymcerte/js/vendor/tinymce/plugins/typograf/dist/typograf.js b/assets/components/tinymcerte/js/vendor/tinymce/plugins/typograf/dist/typograf.js new file mode 100644 index 0000000..c88458e --- /dev/null +++ b/assets/components/tinymcerte/js/vendor/tinymce/plugins/typograf/dist/typograf.js @@ -0,0 +1,3086 @@ +/*! typograf | © 2020 Denis Seleznev | MIT License | https://github.com/typograf/typograf */ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global.Typograf = factory()); +}(this, (function () { 'use strict'; + +function _typeof(obj) { + if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { + _typeof = function (obj) { + return typeof obj; + }; + } else { + _typeof = function (obj) { + return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }; + } + + return _typeof(obj); +} + +function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } +} + +function _defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } +} + +function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) _defineProperties(Constructor.prototype, protoProps); + if (staticProps) _defineProperties(Constructor, staticProps); + return Constructor; +} + +function _slicedToArray(arr, i) { + return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); +} + +function _arrayWithHoles(arr) { + if (Array.isArray(arr)) return arr; +} + +function _iterableToArrayLimit(arr, i) { + if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { + return; + } + + var _arr = []; + var _n = true; + var _d = false; + var _e = undefined; + + try { + for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { + _arr.push(_s.value); + + if (i && _arr.length === i) break; + } + } catch (err) { + _d = true; + _e = err; + } finally { + try { + if (!_n && _i["return"] != null) _i["return"](); + } finally { + if (_d) throw _e; + } + } + + return _arr; +} + +function _nonIterableRest() { + throw new TypeError("Invalid attempt to destructure non-iterable instance"); +} + +var 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 +}; + +// http://www.w3.org/TR/html4/sgml/entities +var visibleEntities = [['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]]; + +var invisibleEntities = [['nbsp', 160], ['thinsp', 8201], ['ensp', 8194], ['emsp', 8195], ['shy', 173], ['zwnj', 8204], ['zwj', 8205], ['lrm', 8206], ['rlm', 8207]]; + +var HtmlEntities = +/*#__PURE__*/ +function () { + function HtmlEntities() { + _classCallCheck(this, HtmlEntities); + + this._entities = this._prepareEntities([].concat(visibleEntities, invisibleEntities)); + this._entitiesByName = {}; + this._entitiesByNameEntity = {}; + this._entitiesByDigitEntity = {}; + this._entitiesByUtf = {}; + + this._entities.forEach(function (entity) { + this._entitiesByName[entity.name] = entity; + this._entitiesByNameEntity[entity.nameEntity] = entity; + this._entitiesByDigitEntity[entity.digitEntity] = entity; + this._entitiesByUtf[entity.utf] = entity; + }, this); + + this._invisibleEntities = this._prepareEntities(invisibleEntities); + } + /** + * Entities as name or digit to UTF-8. + * + * @param {Object} context + */ + + + _createClass(HtmlEntities, [{ + key: "toUtf", + value: function toUtf(context) { + var _this = this; + + if (context.text.search(/&#/) !== -1) { + context.text = this.decHexToUtf(context.text); + } + + if (context.text.search(/&[a-z]/i) !== -1) { + // 2 - min length of entity without & and ;. Example: ⅅ + // 31 - max length of entity without & and ;. Example: ∳ + context.text = context.text.replace(/&[a-z\d]{2,31};/gi, function (key) { + var entity = _this._entitiesByNameEntity[key]; + return entity ? entity.utf : key; + }); + } + } + /** + * Entities in decimal or hexadecimal form to UTF-8. + * + * @param {string} text + * @returns {string} + */ + + }, { + key: "decHexToUtf", + value: function decHexToUtf(text) { + return text.replace(/&#(\d{1,6});/gi, function ($0, $1) { + return String.fromCharCode(parseInt($1, 10)); + }).replace(/&#x([\da-f]{1,6});/gi, function ($0, $1) { + return String.fromCharCode(parseInt($1, 16)); + }); + } + /** + * Restore HTML entities in text. + * + * @param {Object} context + */ + + }, { + key: "restore", + value: function restore(context) { + var params = context.prefs.htmlEntity; + var type = params.type; + var entities = this._entities; + + if (type === 'name' || type === 'digit') { + if (params.onlyInvisible || params.list) { + entities = []; + + if (params.onlyInvisible) { + entities = entities.concat(this._invisibleEntities); + } + + if (params.list) { + entities = entities.concat(this._prepareListParam(params.list)); + } + } + + context.text = this._restoreEntitiesByIndex(context.text, type + 'Entity', entities); + } + } + /** + * Get a entity by utf using the type. + * + * @param {string} symbol + * @param {string} [type] + * @returns {string} + */ + + }, { + key: "getByUtf", + value: function getByUtf(symbol, type) { + var result = ''; + + switch (type) { + case 'digit': + result = this._entitiesByDigitEntity[symbol]; + break; + + case 'name': + result = this._entitiesByNameEntity[symbol]; + break; + + default: + result = symbol; + break; + } + + return result; + } + }, { + key: "_prepareEntities", + value: function _prepareEntities(entities) { + var result = []; + entities.forEach(function (entity) { + var _entity = _slicedToArray(entity, 2), + name = _entity[0], + digit = _entity[1]; + + var utf = String.fromCharCode(digit); + result.push({ + name: name, + nameEntity: '&' + name + ';', + //   + digitEntity: '&#' + digit + ';', + //   + utf: utf, + // \u00A0 + reName: new RegExp('&' + name + ';', 'g'), + reUtf: new RegExp(utf, 'g') + }); + }, this); + return result; + } + }, { + key: "_prepareListParam", + value: function _prepareListParam(list) { + var result = []; + list.forEach(function (name) { + var entity = this._entitiesByName[name]; + + if (entity) { + result.push(entity); + } + }, this); + return result; + } + }, { + key: "_restoreEntitiesByIndex", + value: function _restoreEntitiesByIndex(text, type, entities) { + entities.forEach(function (entity) { + text = text.replace(entity.reUtf, entity[type]); + }); + return text; + } + }]); + + return HtmlEntities; +}(); + +var HtmlEntities$1 = new HtmlEntities(); +/** + * @typedef HtmlEntity + * + * @property {string} type - 'default' - UTF-8, 'digit' -  , 'name' -   + * @property {boolean} [onlyInvisible] + * @property {string[]} [list] + */ + +var locales = []; +/** + * Add a locale. + * + * @param {string} locale + */ + +function addLocale(locale) { + var code = (locale || '').split('/')[0]; + + if (code && code !== 'common' && !hasLocale(code)) { + locales.push(code); + locales.sort(); + } +} +/** + * Get locales. + * + * @returns {Array} + */ + +function getLocales() { + return locales; +} +/** + * Has a locale. +* + * @param {string} locale + * + * @returns {boolean} + */ + +function hasLocale(locale) { + return locale === 'common' || locales.indexOf(locale) !== -1; +} +function prepareLocale(locale1, locale2) { + var locale = locale1 || locale2; + var result = locale; + + if (!Array.isArray(locale)) { + result = [locale]; + } + + return result; +} + +var data = {}; +/** + * Get data for use in rules. + * + * @param {string} key + * + * @returns {*} + */ + +function getData(key) { + return data[key]; +} +/** + * Set data for use in rules. + * + * @param {string|Object} key + * @param {*} [value] + */ + +function setData(key, value) { + if (typeof key === 'string') { + addLocale(key); + data[key] = value; + } else if (_typeof(key) === 'object') { + Object.keys(key).forEach(function (k) { + addLocale(k); + data[k] = key[k]; + }); + } +} + +var inlineElements = ['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']; + +var regExpUrl = new RegExp('(https?|file|ftp)://([a-zA-Z0-9/+-=%&:_.~?]+[a-zA-Z0-9#+]*)', 'g'); + +var privateLabel = "\uF000"; +var privateSeparateLabel = "\uF001"; + +var SafeTags = +/*#__PURE__*/ +function () { + function SafeTags() { + _classCallCheck(this, SafeTags); + + var html = [['<!--', '-->'], ['<!ENTITY', '>'], ['<!DOCTYPE', '>'], ['<\\?xml', '\\?>'], ['<!\\[CDATA\\[', '\\]\\]>']]; + ['code', 'kbd', 'object', 'pre', 'samp', 'script', 'style', 'var'].forEach(function (tag) { + html.push(['<' + tag + '(\\s[^>]*?)?>', '</' + tag + '>']); + }, this); + this._tags = { + own: [], + html: html.map(this._prepareRegExp), + url: [regExpUrl] + }; + this._groups = ['own', 'html', 'url']; + } + /** + * Add own safe tag. + * + * @param {RegExp|string[]} tag + */ + + + _createClass(SafeTags, [{ + key: "add", + value: function add(tag) { + this._tags.own.push(this._prepareRegExp(tag)); + } + /** + * Show safe tags. + * + * @param {Object} context + * @param {string} group + */ + + }, { + key: "show", + value: function show(context, group) { + var reReplace = new RegExp(privateLabel + 'tf\\d+' + privateLabel, 'g'); + var reSearch = new RegExp(privateLabel + 'tf\\d'); + + var replaceLabel = function replaceLabel(match) { + return context.safeTags.hidden[group][match] || match; + }; + + for (var i = 0, len = this._tags[group].length; i < len; i++) { + context.text = context.text.replace(reReplace, replaceLabel); + + if (context.text.search(reSearch) === -1) { + break; + } + } + } + /** + * Hide safe tags. + * + * @param {Object} context + * @param {string} group + */ + + }, { + key: "hide", + value: function hide(context, group) { + context.safeTags = context.safeTags || { + hidden: {}, + i: 0 + }; + context.safeTags.hidden[group] = {}; + + var pasteLabel = this._pasteLabel.bind(this, context, group); + + this._tags[group].forEach(function (tag) { + context.text = context.text.replace(this._prepareRegExp(tag), pasteLabel); + }, this); + } + /** + * Hide HTML tags. + * + * @param {Object} context + */ + + }, { + key: "hideHTMLTags", + value: function hideHTMLTags(context) { + if (context.isHTML) { + var pasteLabel = this._pasteLabel.bind(this, context, 'html'); + + context.text = context.text.replace(/<\/?[a-z][^]*?>/gi, pasteLabel) // Tags + .replace(/<\/?[a-z][^]*?>/gi, pasteLabel) // Escaping tags + .replace(/&[gl]t;/gi, pasteLabel); + } + } + /** + * Get previous label. + * + * @param {string} text + * @param {number} position + * + * @returns {string|false} + */ + + }, { + key: "getPrevLabel", + value: function getPrevLabel(text, position) { + for (var i = position - 1; i >= 0; i--) { + if (text[i] === privateLabel) { + return text.slice(i, position + 1); + } + } + + return false; + } + /** + * Get next label. + * + * @param {string} text + * @param {number} position + * + * @returns {string|false} + */ + + }, { + key: "getNextLabel", + value: function getNextLabel(text, position) { + for (var i = position + 1; i < text.length; i++) { + if (text[i] === privateLabel) { + return text.slice(position, i + 1); + } + } + + return false; + } + /** + * Get a tag by a label. + * + * @param {Object} context + * @param {string} label + * + * @returns {Object|boolean} + */ + + }, { + key: "getTagByLabel", + value: function getTagByLabel(context, label) { + var result = false; + + this._groups.some(function (group) { + var value = context.safeTags.hidden[group][label]; + + if (typeof value !== 'undefined') { + result = { + group: group, + value: value + }; + } + + return result; + }); + + return result; + } + /** + * Get info about a tag. + * + * @param {Object|undefined} tag + * + * @returns {Object|undefined} + */ + + }, { + key: "getTagInfo", + value: function getTagInfo(tag) { + if (!tag) { + return; + } + + var result = { + group: tag.group + }; + + switch (tag.group) { + case 'html': + result.name = tag.value.split(/[<\s>]/)[1]; + result.isInline = inlineElements.indexOf(result.name) > -1; + result.isClosing = tag.value.search(/^<\//) > -1; + break; + + case 'url': + result.isInline = true; + break; + + case 'own': + result.isInline = false; + break; + } + + return result; + } + }, { + key: "_pasteLabel", + value: function _pasteLabel(context, group, match) { + var safeTags = context.safeTags; + var key = privateLabel + 'tf' + safeTags.i + privateLabel; + safeTags.hidden[group][key] = match; + safeTags.i++; + return key; + } + }, { + key: "_prepareRegExp", + value: function _prepareRegExp(tag) { + var re; + + if (tag instanceof RegExp) { + re = tag; + } else { + var _tag = _slicedToArray(tag, 3), + startTag = _tag[0], + endTag = _tag[1], + middle = _tag[2]; + + if (typeof middle === 'undefined') { + middle = '[^]*?'; + } + + re = new RegExp(startTag + middle + endTag, 'gi'); + } + + return re; + } + }]); + + return SafeTags; +}(); + +function repeat(symbol, count) { + var result = ''; + + for (;;) { + if ((count & 1) === 1) { + result += symbol; + } + + count >>>= 1; + + if (count === 0) { + break; + } + + symbol += symbol; + } + + return result; +} +function replaceNbsp(text) { + return text.replace(/\u00A0/g, ' '); +} +function replace(text, re) { + for (var i = 0; i < re.length; i++) { + text = text.replace(re[i][0], re[i][1]); + } + + return text; +} +function isHTML(text) { + return text.search(/(<\/?[a-z]|<!|&[lg]t;)/i) !== -1; +} +function removeCR(text) { + return text.replace(/\r\n?/g, '\n'); +} +function fixLineEnding(text, type) { + if (type === 'CRLF') { + // Windows + return text.replace(/\n/g, '\r\n'); + } else if (type === 'CR') { + // Mac + return text.replace(/\n/g, '\r'); + } + + return text; +} + +/** + * Get a deep copy of a object. + * + * @param {*} obj + * + * @returns {*} + */ +function deepCopy(obj) { + return _typeof(obj) === 'object' ? JSON.parse(JSON.stringify(obj)) : obj; +} + +/** + * @constructor + * @param {Object} [prefs] + * @param {string} [prefs.locale] Locale + * @param {string} [prefs.lineEnding] Line ending. 'LF' (Unix), 'CR' (Mac) or 'CRLF' (Windows). Default: 'LF'. + * @param {HtmlEntity} [prefs.htmlEntity] + * @param {boolean} [prefs.live] Live mode + * @param {string|string[]} [prefs.enableRule] Enable a rule + * @param {string|string[]} [prefs.disableRule] Disable a rule + */ + +var Typograf = +/*#__PURE__*/ +function () { + function Typograf(prefs) { + _classCallCheck(this, Typograf); + + this._prefs = _typeof(prefs) === 'object' ? prefs : {}; + this._prefs.locale = prepareLocale(this._prefs.locale); + this._prefs.live = this._prefs.live || false; + this._safeTags = new SafeTags(); + this._settings = {}; + this._enabledRules = {}; + this._innerRulesByQueues = {}; + this._innerRules = [].concat(this._innerRules); + + this._innerRules.forEach(function (rule) { + var q = rule.queue || 'default'; + this._innerRulesByQueues[q] = this._innerRulesByQueues[q] || []; + + this._innerRulesByQueues[q].push(rule); + }, this); + + this._rulesByQueues = {}; + this._rules = [].concat(this._rules); + + this._rules.forEach(function (rule) { + var q = rule.queue || 'default'; + + this._prepareRule(rule); + + this._rulesByQueues[q] = this._rulesByQueues[q] || []; + + this._rulesByQueues[q].push(rule); + }, 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']; + } + /** + * Add a rule. + * + * @static + * @param {TypografRule} rule + * + * @returns {Typograf} this + */ + + + _createClass(Typograf, [{ + key: "execute", + + /** + * Execute typographical rules for text. + * + * @param {string} text + * @param {Object} [prefs] + * @param {string} [prefs.locale] Locale + * @param {HtmlEntity} [prefs.htmlEntity] Type of HTML entities + * @param {string} [prefs.lineEnding] Line ending. 'LF' (Unix), 'CR' (Mac) or 'CRLF' (Windows). Default: 'LF'. + * + * @returns {string} + */ + value: function execute(text, prefs) { + text = '' + text; + + if (!text) { + return ''; + } + + var context = this._prepareContext(text); + + this._preparePrefs(context, prefs); + + return this._process(context); + } + }, { + key: "_prepareContext", + value: function _prepareContext(text) { + return { + text: text, + isHTML: isHTML(text), + prefs: deepCopy(this._prefs), + getData: function getData$$1(key) { + if (key === 'char') { + return this.prefs.locale.map(function (item) { + return getData(item + '/' + key); + }).join(''); + } else { + return getData(this.prefs.locale[0] + '/' + key); + } + } + }; + } + }, { + key: "_preparePrefs", + value: function _preparePrefs(context, prefs) { + prefs = prefs || {}; + var contextPrefs = context.prefs; + + for (var _i = 0, _arr = ['htmlEntity', 'lineEnding', 'processingSeparateParts', 'ruleFilter']; _i < _arr.length; _i++) { + var name = _arr[_i]; + + if (name in prefs) { + contextPrefs[name] = prefs[name]; + } else if (name in this._prefs) { + contextPrefs[name] = this._prefs[name]; + } + } + + contextPrefs.htmlEntity = contextPrefs.htmlEntity || {}; + contextPrefs.locale = prepareLocale(prefs.locale, this._prefs.locale); + var locale = contextPrefs.locale; + var locale0 = locale[0]; + + if (!locale.length || !locale0) { + throw Error('Not defined the property "locale".'); + } + + if (!hasLocale(locale0)) { + throw Error('"' + locale0 + '" is not supported locale.'); + } + } + }, { + key: "_splitBySeparateParts", + value: function _splitBySeparateParts(context) { + if (!context.isHTML || context.prefs.processingSeparateParts === false) { + return [context.text]; + } + + var text = [], + reTags = new RegExp('<(' + this._separatePartsTags.join('|') + ')(\\s[^>]*?)?>[^]*?</\\1>', 'gi'); + var position = 0; + context.text.replace(reTags, function ($0, $1, $2, itemPosition) { + if (position !== itemPosition) { + text.push((position ? privateSeparateLabel : '') + context.text.slice(position, itemPosition) + privateSeparateLabel); + } + + text.push($0); + position = itemPosition + $0.length; + return $0; + }); + text.push(position ? privateSeparateLabel + context.text.slice(position, context.text.length) : context.text); + return text; + } + }, { + key: "_process", + value: function _process(context) { + var _this = this; + + context.text = removeCR(context.text); + + this._executeRules(context, 'start'); + + this._safeTags.hide(context, 'own'); + + this._executeRules(context, 'hide-safe-tags-own'); + + this._safeTags.hide(context, 'html'); + + this._executeRules(context, 'hide-safe-tags-html'); + + var isRootHTML = context.isHTML, + re = new RegExp(privateSeparateLabel, 'g'); + context.text = this._splitBySeparateParts(context).map(function (item) { + context.text = item; + context.isHTML = isHTML(item); + + _this._safeTags.hideHTMLTags(context); + + _this._safeTags.hide(context, 'url'); + + _this._executeRules(context, 'hide-safe-tags-url'); + + _this._executeRules(context, 'hide-safe-tags'); + + HtmlEntities$1.toUtf(context); + + if (_this._prefs.live) { + context.text = replaceNbsp(context.text); + } + + _this._executeRules(context, 'utf'); + + _this._executeRules(context); + + HtmlEntities$1.restore(context); + + _this._executeRules(context, 'html-entities'); + + _this._safeTags.show(context, 'url'); + + _this._executeRules(context, 'show-safe-tags-url'); + + return context.text.replace(re, ''); + }).join(''); + context.isHTML = isRootHTML; + + this._safeTags.show(context, 'html'); + + this._executeRules(context, 'show-safe-tags-html'); + + this._safeTags.show(context, 'own'); + + this._executeRules(context, 'show-safe-tags-own'); + + this._executeRules(context, 'end'); + + return fixLineEnding(context.text, context.prefs.lineEnding); + } + /** + * Get a setting. + * + * @param {string} ruleName + * @param {string} setting + * + * @returns {*} + */ + + }, { + key: "getSetting", + value: function getSetting(ruleName, setting) { + return this._settings[ruleName] && this._settings[ruleName][setting]; + } + /** + * Set a setting. + * + * @param {string} ruleName + * @param {string} setting + * @param {*} [value] + * + * @returns {Typograf} + */ + + }, { + key: "setSetting", + value: function setSetting(ruleName, setting, value) { + this._settings[ruleName] = this._settings[ruleName] || {}; + this._settings[ruleName][setting] = value; + return this; + } + /** + * Is enabled a rule. + * + * @param {string} ruleName + * + * @returns {boolean} + */ + + }, { + key: "isEnabledRule", + value: function isEnabledRule(ruleName) { + return this._enabledRules[ruleName]; + } + /** + * Is disabled a rule. + * + * @param {string} ruleName + * + * @returns {boolean} + */ + + }, { + key: "isDisabledRule", + value: function isDisabledRule(ruleName) { + return !this._enabledRules[ruleName]; + } + /** + * Enable a rule. + * + * @param {string|string[]} ruleName + * + * @returns {Typograf} this + */ + + }, { + key: "enableRule", + value: function enableRule(ruleName) { + return this._enable(ruleName, true); + } + /** + * Disable a rule. + * + * @param {string|string[]} ruleName + * + * @returns {Typograf} this + */ + + }, { + key: "disableRule", + value: function disableRule(ruleName) { + return this._enable(ruleName, false); + } + /** + * Add safe tag. + * + * @example + * // var t = new Typograf({locale: 'ru'}); + * // t.addSafeTag('<mytag>', '</mytag>'); + * // t.addSafeTag('<mytag>', '</mytag>', '.*?'); + * // t.addSafeTag(/<mytag>.*?</mytag>/gi); + * + * @param {string|RegExp} startTag + * @param {string} [endTag] + * @param {string} [middle] + * + * @returns {Typograf} this + */ + + }, { + key: "addSafeTag", + value: function addSafeTag(startTag, endTag, middle) { + var tag = startTag instanceof RegExp ? startTag : [startTag, endTag, middle]; + + this._safeTags.add(tag); + + return this; + } + }, { + key: "_executeRules", + value: function _executeRules(context, queue) { + queue = queue || 'default'; + var rules = this._rulesByQueues[queue]; + var innerRules = this._innerRulesByQueues[queue]; + innerRules && innerRules.forEach(function (rule) { + this._ruleIterator(context, rule); + }, this); + rules && rules.forEach(function (rule) { + this._ruleIterator(context, rule); + }, this); + } + }, { + key: "_ruleIterator", + value: function _ruleIterator(context, rule) { + var rlocale = rule._locale; + var live = this._prefs.live; + + if (live === true && rule.live === false || live === false && rule.live === true) { + return; + } + + if ((rlocale === 'common' || rlocale === context.prefs.locale[0]) && this.isEnabledRule(rule.name)) { + if (context.prefs.ruleFilter && !context.prefs.ruleFilter(rule)) { + return; + } + + this._onBeforeRule && this._onBeforeRule(rule.name, context.text, context); + context.text = rule.handler.call(this, context.text, this._settings[rule.name], context); + this._onAfterRule && this._onAfterRule(rule.name, context.text, context); + } + } + }, { + key: "_prepareRule", + value: function _prepareRule(rule) { + var name = rule.name; + + var t = _typeof(rule.settings); + + var settings = {}; + + if (t === 'object') { + settings = deepCopy(rule.settings); + } else if (t === 'function') { + settings = rule.settings(rule); + } + + this._settings[name] = settings; + this._enabledRules[name] = rule._enabled; + } + }, { + key: "_enable", + value: function _enable(rule, enabled) { + if (Array.isArray(rule)) { + rule.forEach(function (el) { + this._enableByMask(el, enabled); + }, this); + } else { + this._enableByMask(rule, enabled); + } + + return this; + } + }, { + key: "_enableByMask", + value: function _enableByMask(rule, enabled) { + if (!rule) { + return; + } + + if (rule.search(/\*/) !== -1) { + var re = new RegExp(rule.replace(/\//g, '\\/').replace(/\*/g, '.*')); + + this._rules.forEach(function (el) { + var name = el.name; + + if (re.test(name)) { + this._enabledRules[name] = enabled; + } + }, this); + } else { + this._enabledRules[rule] = enabled; + } + } + }, { + key: "_getRule", + value: function _getRule(name) { + var rule = null; + + this._rules.some(function (item) { + if (item.name === name) { + rule = item; + return true; + } + + return false; + }); + + return rule; + } + }], [{ + key: "addRule", + value: function addRule(rule) { + var _rule$name$split = rule.name.split('/'), + _rule$name$split2 = _slicedToArray(_rule$name$split, 3), + locale = _rule$name$split2[0], + group = _rule$name$split2[1], + name = _rule$name$split2[2]; + + rule._enabled = rule.disabled === true ? false : true; + rule._locale = locale; + rule._group = group; + rule._name = name; + this.addLocale(rule._locale); + + this._setIndex(rule); + + this.prototype._rules.push(rule); + + this._sortRules(this.prototype._rules); + + return this; + } + /** + * Add rules. + * + * @static + * @param {TypografRule[]} rules + * + * @returns {Typograf} this + */ + + }, { + key: "addRules", + value: function addRules(rules) { + var _this2 = this; + + rules.forEach(function (item) { + _this2.addRule(item); + }); + return this; + } + /** + * Add internal rule. + * Internal rules are executed before main. + * + * @static + * @param {TypografRule} rule + * + * @returns {Typograf} this + */ + + }, { + key: "addInnerRule", + value: function addInnerRule(rule) { + this.prototype._innerRules.push(rule); + + rule._locale = rule.name.split('/')[0]; + return this; + } + /** + * Add internal rules. + * Internal rules are executed before main. + * + * @static + * @param {TypografRule[]} rules + * + * @returns {Typograf} this + */ + + }, { + key: "addInnerRules", + value: function addInnerRules(rules) { + var _this3 = this; + + rules.forEach(function (item) { + _this3.addInnerRule(item); + }); + return this; + } + }, { + key: "_setIndex", + value: function _setIndex(rule) { + var index = rule.index; + + var t = _typeof(index); + + var groupIndex = groupIndexes[rule._group]; + + if (t === 'undefined') { + index = groupIndex; + } else if (t === 'string') { + index = (groupIndex || 0) + parseInt(rule.index, 10); + } + + rule._index = index; + } + }, { + key: "_sortRules", + value: function _sortRules(rules) { + rules.sort(function (a, b) { + return a._index > b._index ? 1 : -1; + }); + } + }]); + + return Typograf; +}(); + +Typograf.version = '6.11.0'; +Typograf.addLocale = addLocale; +Typograf.getLocales = getLocales; +Typograf.hasLocale = hasLocale; +Typograf.setData = setData; +Typograf.getData = getData; // @deprecated + +Typograf.deepCopy = deepCopy; +Typograf.prototype._rules = []; +Typograf.prototype._innerRules = []; +/** + * @typedef TypografRule + * @type {object} + * + * @property {string} name Name of rule + * @property {Function} handler Processing function + * @property {number} [index] Sorting index for rule + * @property {boolean} [disabled] Rule is disabled by default + * @property {boolean} [live] Live mode + * @property {Object} [settings] Settings for rule + */ + +var common = { + 'common/char': 'a-z', + 'common/dash': '--?|‒|–|—', + // --, ‒, &ndash, &mdash + 'common/quote': '«‹»›„“‟”"' +}; + +var be = { + 'be/char': 'абвгдежзйклмнопрстуфхцчшыьэюяёіўґ', + 'be/quote': { + left: '«“', + right: '»”' + } +}; + +var bg = { + 'bg/char': 'абвгдежзийклмнопрстуфхцчшщъьюя', + 'bg/quote': { + left: '„’', + right: '“’' + } +}; + +var ca = { + 'ca/char': 'abcdefghijlmnopqrstuvxyzàçèéíïòóúü', + 'ca/quote': { + left: '«“', + right: '»”' + } +}; + +var da = { + 'da/char': 'a-zåæø', + 'da/quote': { + left: '»›', + right: '«‹' + } +}; + +var de = { + 'de/char': 'a-zßäöü', + 'de/quote': { + left: '„‚', + right: '“‘' + } +}; + +var el = { + 'el/char': 'ΐάέήίΰαβγδεζηθικλμνξοπρςστυφχψωϊϋόύώϲάέήίόύώ', + 'el/quote': { + left: '«“', + right: '»”' + } +}; + +var enGB = { + 'en-GB/char': 'a-z', + 'en-GB/quote': { + left: '‘“', + right: '’”' + } +}; + +var enUS = { + 'en-US/char': 'a-z', + 'en-US/quote': { + left: '“‘', + right: '”’' + } +}; + +var eo = { + 'eo/char': 'abcdefghijklmnoprstuvzĉĝĥĵŝŭ', + 'eo/quote': { + left: '“‘', + right: '”’' + } +}; + +var es = { + 'es/char': 'a-záéíñóúü', + 'es/quote': { + left: '«“', + right: '»”' + } +}; + +var et = { + 'et/char': 'abdefghijklmnoprstuvzäõöüšž', + 'et/quote': { + left: '„«', + right: '“»' + } +}; + +var fi = { + 'fi/char': 'abcdefghijklmnopqrstuvyöäå', + 'fi/quote': { + left: '”’', + right: '”’' + } +}; + +var fr = { + 'fr/char': 'a-zàâçèéêëîïôûüœæ', + 'fr/quote': { + left: '«‹', + right: '»›', + spacing: true + } +}; + +var ga = { + 'ga/char': 'abcdefghilmnoprstuvwxyzáéíóú', + 'ga/quote': { + left: '“‘', + right: '”’' + } +}; + +var hu = { + 'hu/char': 'a-záäéíóöúüőű', + 'hu/quote': { + left: '„»', + right: '”«' + } +}; + +var it = { + 'it/char': 'a-zàéèìòù', + 'it/quote': { + left: '«“', + right: '»”' + } +}; + +var lv = { + 'lv/char': 'abcdefghijklmnopqrstuvxzæœ', + 'lv/quote': { + left: '«„', + right: '»“' + } +}; + +var nl = { + 'nl/char': 'a-zäçèéêëîïñöûü', + 'nl/quote': { + left: '‘“', + right: '’”' + } +}; + +var no = { + 'no/char': 'a-zåæèéêòóôø', + 'no/quote': { + left: '«’', + right: '»’' + } +}; + +var pl = { + 'pl/char': 'abcdefghijklmnoprstuvwxyzóąćęłńśźż', + 'pl/quote': { + left: '„«', + right: '”»' + } +}; + +var ro = { + 'ro/char': 'abcdefghijklmnoprstuvxzîășț', + 'ro/quote': { + left: '„«', + right: '”»' + } +}; + +var ru = { + 'ru/char': 'а-яё', + 'ru/dashBefore': '(^| |\\n)', + 'ru/dashAfter': "(?=[\xA0 ,.?:!]|$)", + 'ru/dashAfterDe': "(?=[,.?:!]|[\xA0 ][^\u0410-\u042F\u0401]|$)", + 'ru/l': 'а-яёa-z', + 'ru/L': 'А-ЯЁA-Z', + 'ru/month': 'январь|февраль|март|апрель|май|июнь|июль|август|сентябрь|октябрь|ноябрь|декабрь', + 'ru/monthGenCase': 'января|февраля|марта|апреля|мая|июня|июля|августа|сентября|октября|ноября|декабря', + 'ru/monthPreCase': 'январе|феврале|марте|апреле|мае|июне|июле|августе|сентябре|октябре|ноябре|декабре', + 'ru/quote': { + left: '«„‚', + right: '»“‘', + removeDuplicateQuotes: true + }, + 'ru/shortMonth': 'янв|фев|мар|апр|ма[ейя]|июн|июл|авг|сен|окт|ноя|дек', + 'ru/weekday': 'понедельник|вторник|среда|четверг|пятница|суббота|воскресенье' +}; + +var sk = { + 'sk/char': 'abcdefghijklmnoprstuvwxyzáäéíóôúýčďľňŕšťž', + 'sk/quote': { + left: '„‚', + right: '“‘' + } +}; + +var sl = { + 'sl/char': 'a-zčšž', + 'sl/quote': { + left: '„‚', + right: '“‘' + } +}; + +var sr = { + 'sr/char': 'abcdefghijklmnoprstuvzćčđšž', + 'sr/quote': { + left: '„’', + right: '”’' + } +}; + +var sv = { + 'sv/char': 'a-zäåéö', + 'sv/quote': { + left: '”’', + right: '”’' + } +}; + +var tr = { + 'tr/char': 'abcdefghijklmnoprstuvyzâçîöûüğış', + 'tr/quote': { + left: '“‘', + right: '”’' + } +}; + +var uk = { + 'uk/char': 'абвгдежзийклмнопрстуфхцчшщьюяєіїґ', + 'uk/quote': { + left: '«„', + right: '»“' + } +}; + +var data$1 = [common, be, bg, ca, da, de, el, enGB, enUS, eo, es, et, fi, fr, ga, hu, it, lv, nl, no, pl, ro, ru, sk, sl, sr, sv, tr, uk]; +data$1.forEach(function (item) { + return setData(item); +}); + +var eMail = { + name: 'common/html/e-mail', + queue: 'end', + handler: function handler(text, settings, context) { + return context.isHTML ? text : text.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: true, + htmlAttrs: false +}; + +var escape = { + name: 'common/html/escape', + index: '+100', + queue: 'end', + handler: function handler(text) { + var entityMap = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + '\'': ''', + '/': '/' + }; + return text.replace(/[&<>"'/]/g, function (s) { + return entityMap[s]; + }); + }, + disabled: true +}; + +var nbr = { + name: 'common/html/nbr', + index: '+10', + queue: 'end', + handler: function handler(text) { + return text.replace(/([^\n>])\n(?=[^\n])/g, '$1<br/>\n'); + }, + disabled: true, + htmlAttrs: false +}; + +var blockElements = ['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']; + +var p = { + name: 'common/html/p', + index: '+5', + queue: 'end', + handler: function handler(text) { + var blockRe = new RegExp('<(' + blockElements.join('|') + ')[>\\s]'); + var separator = '\n\n'; + var buffer = text.split(separator); + buffer.forEach(function (text, i, data) { + if (!text.trim()) { + return; + } + + if (!blockRe.test(text)) { + data[i] = text.replace(/^(\s*)/, '$1<p>').replace(/(\s*)$/, '</p>$1'); + } + }); + return buffer.join(separator); + }, + disabled: true, + htmlAttrs: false +}; + +var processingAttrs = { + name: 'common/html/processingAttrs', + queue: 'hide-safe-tags-own', + // After "hide-safe-tags-own", before "hide-safe-tags-html". + handler: function handler(text, settings, context) { + var that = this; + var reAttrs = new RegExp('(^|\\s)(' + settings.attrs.join('|') + ')=("[^"]*?"|\'[^\']*?\')', 'gi'); + var prefs = deepCopy(context.prefs); + + prefs.ruleFilter = function (rule) { + return rule.htmlAttrs !== false; + }; + + return text.replace(/(<[-\w]+\s)([^>]+?)(?=>)/g, function (match, tagName, attrs) { + var resultAttrs = attrs.replace(reAttrs, function (submatch, space, attrName, attrValue) { + var lquote = attrValue[0]; + var rquote = attrValue[attrValue.length - 1]; + var value = attrValue.slice(1, -1); + return space + attrName + '=' + lquote + that.execute(value, prefs) + rquote; + }); + return tagName + resultAttrs; + }); + }, + settings: { + attrs: ['title', 'placeholder'] + }, + disabled: true, + htmlAttrs: false +}; + +var quot = { + name: 'common/html/quot', + queue: 'hide-safe-tags', + handler: function handler(text) { + return text.replace(/"/g, '"'); + } +}; + +var stripTags = { + name: 'common/html/stripTags', + index: '+99', + queue: 'end', + handler: function handler(text) { + return text.replace(/<[^>]+>/g, ''); + }, + disabled: true +}; + +var url = { + name: 'common/html/url', + queue: 'end', + handler: function handler(text, settings, context) { + return context.isHTML ? text : text.replace(regExpUrl, function ($0, protocol, path) { + path = path.replace(/([^/]+\/?)(\?|#)$/, '$1') // Remove ending ? and # + .replace(/^([^/]+)\/$/, '$1'); // Remove ending / + + if (protocol === 'http') { + path = path.replace(/^([^/]+)(:80)([^\d]|\/|$)/, '$1$3'); // Remove 80 port + } else if (protocol === 'https') { + path = path.replace(/^([^/]+)(:443)([^\d]|\/|$)/, '$1$3'); // Remove 443 port + } + + var url = path; + var fullUrl = protocol + '://' + path; + var firstPart = '<a href="' + fullUrl + '">'; + + if (protocol === 'http' || protocol === 'https') { + url = url.replace(/^www\./, ''); + return firstPart + (protocol === 'http' ? url : protocol + '://' + url) + '</a>'; + } + + return firstPart + fullUrl + '</a>'; + }); + }, + disabled: true, + htmlAttrs: false +}; + +Typograf.addRules([eMail, escape, nbr, p, processingAttrs, quot, stripTags, url]); + +var afterNumber = { + name: 'common/nbsp/afterNumber', + handler: function handler(text, settings, context) { + var re = '(^|\\D)(\\d{1,5}) ([' + context.getData('char') + ']+)'; + return text.replace(new RegExp(re, 'gi'), "$1$2\xA0$3"); + }, + disabled: true +}; + +var afterParagraphMark = { + name: 'common/nbsp/afterParagraphMark', + handler: function handler(text) { + return text.replace(/¶ ?(?=\d)/g, "\xB6\xA0"); + } +}; + +var afterSectionMark = { + name: 'common/nbsp/afterSectionMark', + handler: function handler(text, settings, context) { + // \u2009 - THIN SPACE + // \u202F - NARROW NO-BREAK SPACE + var locale = context.prefs.locale[0]; + return text.replace(/§[ \u00A0\u2009]?(?=\d|I|V|X)/g, locale === 'ru' ? "\xA7\u202F" : "\xA7\xA0"); + } +}; + +var afterShortWord = { + name: 'common/nbsp/afterShortWord', + handler: function handler(text, settings, context) { + var len = settings.lengthShortWord; + var before = " \xA0(" + privateLabel + getData('common/quote'); + var subStr = '(^|[' + before + '])([' + context.getData('char') + ']{1,' + len + '}) '; + var newSubStr = "$1$2\xA0"; + var re = new RegExp(subStr, 'gim'); + return text.replace(re, newSubStr).replace(re, newSubStr); + }, + settings: { + lengthShortWord: 2 + } +}; + +var beforeShortLastNumber = { + name: 'common/nbsp/beforeShortLastNumber', + handler: function handler(text, settings, context) { + var ch = context.getData('char'); + var CH = ch.toUpperCase(); + var re = new RegExp('([' + ch + CH + ']) (?=\\d{1,' + settings.lengthLastNumber + '}[-+−%\'"' + context.getData('quote').right + ')]?([.!?…]( [' + CH + ']|$)|$))', 'gm'); + return text.replace(re, "$1\xA0"); + }, + live: false, + settings: { + lengthLastNumber: 2 + } +}; + +var beforeShortLastWord = { + name: 'common/nbsp/beforeShortLastWord', + handler: function handler(text, settings, context) { + var ch = context.getData('char'); + var CH = ch.toUpperCase(); + var re = new RegExp('([' + ch + '\\d]) ([' + ch + CH + ']{1,' + settings.lengthLastWord + '}[.!?…])( [' + CH + ']|$)', 'g'); + return text.replace(re, "$1\xA0$2$3"); + }, + settings: { + lengthLastWord: 3 + } +}; + +var dpi = { + name: 'common/nbsp/dpi', + handler: function handler(text) { + return text.replace(/(\d) ?(lpi|dpi)(?!\w)/, "$1\xA0$2"); + } +}; + +function replaceNbsp$1($0, $1, $2, $3) { + return $1 + $2.replace(/([^\u00A0])\u00A0([^\u00A0])/g, '$1 $2') + $3; +} + +var nowrap = { + name: 'common/nbsp/nowrap', + queue: 'end', + handler: function handler(text) { + return text.replace(/(<nowrap>)(.*?)(<\/nowrap>)/g, replaceNbsp$1).replace(/(<nobr>)(.*?)(<\/nobr>)/g, replaceNbsp$1); + } +}; + +var replaceNbsp$2 = { + name: 'common/nbsp/replaceNbsp', + queue: 'utf', + live: false, + handler: replaceNbsp, + disabled: true +}; + +Typograf.addRules([afterNumber, afterParagraphMark, afterSectionMark, afterShortWord, beforeShortLastNumber, beforeShortLastWord, dpi, nowrap, replaceNbsp$2]); + +var digitGrouping = { + name: 'common/number/digitGrouping', + index: '310', + disabled: true, + handler: function handler(text, settings) { + return text.replace(new RegExp("(^ ?|\\D |".concat(privateLabel, ")(\\d{1,3}([ \xA0\u202F\u2009]\\d{3})+)(?! ?[\\d-])"), 'gm'), function ($0, $1, $2) { + return $1 + $2.replace(/\s/g, settings.space); + }) // https://www.bipm.org/utils/common/pdf/si-brochure/SI-Brochure-9-EN.pdf #5.4.4 + .replace(/(\d{5,}([.,]\d+)?)/g, function ($0, $1) { + var decimalMarker = $1.match(/[.,]/); + + var _ref = decimalMarker ? $1.split(decimalMarker) : [$1], + _ref2 = _slicedToArray(_ref, 2), + integerPart = _ref2[0], + fractionalPart = _ref2[1]; + + integerPart = integerPart.replace(/(\d)(?=(\d{3})+([^\d]|$))/g, '$1' + settings.space); + return decimalMarker ? integerPart + decimalMarker + fractionalPart : integerPart; + }); + }, + settings: { + space: "\u202F" + } +}; + +var fraction = { + name: 'common/number/fraction', + handler: function handler(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'); + } +}; + +var mathSigns = { + name: 'common/number/mathSigns', + handler: function handler(text) { + return replace(text, [[/!=/g, '≠'], [/<=/g, '≤'], [/(^|[^=])>=/g, '$1≥'], [/<=>/g, '⇔'], [/<</g, '≪'], [/>>/g, '≫'], [/~=/g, '≅'], [/(^|[^+])\+-/g, '$1±']]); + } +}; + +var times = { + name: 'common/number/times', + handler: function handler(text) { + return text.replace(/(\d)[ \u00A0]?[xх][ \u00A0]?(\d)/g, '$1×$2'); + } +}; + +Typograf.addRules([digitGrouping, fraction, mathSigns, times]); + +var delBOM = { + name: 'common/other/delBOM', + queue: 'start', + index: -1, + handler: function handler(text) { + if (text.charCodeAt(0) === 0xFEFF) { + return text.slice(1); + } + + return text; + } +}; + +var repeatWord = { + name: 'common/other/repeatWord', + handler: function handler(text, settings, context) { + var punc = '[;:,.?! \n' + getData('common/quote') + ']'; + var re = new RegExp('(' + punc + '|^)' + '([' + context.getData('char') + ']{' + settings.min + ',}) ' + '\\2(' + punc + '|$)', 'gi'); + return text.replace(re, '$1$2$3'); + }, + settings: { + min: 2 + }, + disabled: true +}; + +Typograf.addRules([delBOM, repeatWord]); + +var apostrophe = { + name: 'common/punctuation/apostrophe', + handler: function handler(text, settings, context) { + var letters = '([' + context.getData('char') + '])'; + var re = new RegExp(letters + '\'' + letters, 'gi'); + return text.replace(re, '$1’$2'); + } +}; + +var delDoublePunctuation = { + name: 'common/punctuation/delDoublePunctuation', + handler: function handler(text) { + return text.replace(/(^|[^,]),,(?!,)/g, '$1,').replace(/(^|[^:])::(?!:)/g, '$1:').replace(/(^|[^!?.])\.\.(?!\.)/g, '$1.').replace(/(^|[^;]);;(?!;)/g, '$1;').replace(/(^|[^?])\?\?(?!\?)/g, '$1?'); + } +}; + +var hellip = { + name: 'common/punctuation/hellip', + handler: function handler(text, settings, context) { + return context.prefs.locale[0] === 'ru' ? text.replace(/(^|[^.])\.{3,4}(?=[^.]|$)/g, '$1…') : text.replace(/(^|[^.])\.{3}(\.?)(?=[^.]|$)/g, '$1…$2'); + } +}; + +var Quote = { + bufferQuotes: { + left: "\uF005\uF006\uF007", + right: "\uF008\uF009\uF0A0" + }, + maxLevel: 3, + beforeLeft: " \n\t\xA0[(", + afterRight: " \n\t\xA0!?.:;#*,\u2026)", + process: function process(params) { + var text = params.context.text; + var count = this.count(text); + + if (!count.total) { + return text; + } + + var originalSettings = params.settings; + var isEqualQuotes = params.settings.left[0] === params.settings.right[0]; // For SW, FI + + if (isEqualQuotes) { + params.settings = deepCopy(params.settings); + params.settings.left = this.bufferQuotes.left.slice(0, params.settings.left.length); + params.settings.right = this.bufferQuotes.right.slice(0, params.settings.right.length); + } // For FR + + + if (params.settings.spacing) { + text = this.removeSpacing(text, params.settings); + } + + text = this.set(text, params); // For FR + + if (params.settings.spacing) { + text = this.setSpacing(text, params.settings); + } // For RU + + + if (params.settings.removeDuplicateQuotes) { + text = this.removeDuplicates(text, params.settings); + } // For SW, FI + + + if (isEqualQuotes) { + text = this.returnOriginalQuotes(text, originalSettings, params.settings); + params.settings = originalSettings; + } + + return text; + }, + returnOriginalQuotes: function returnOriginalQuotes(text, originalSettings, bufferSettings) { + var buffer = {}; + + for (var i = 0; i < bufferSettings.left.length; i++) { + buffer[bufferSettings.left[i]] = originalSettings.left[i]; + buffer[bufferSettings.right[i]] = originalSettings.right[i]; + } + + return text.replace(new RegExp('[' + bufferSettings.left + bufferSettings.right + ']', 'g'), function (quote) { + return buffer[quote]; + }); + }, + count: function count(text) { + var count = { + total: 0 + }; + text.replace(new RegExp('[' + getData('common/quote') + ']', 'g'), function (quote) { + if (!count[quote]) { + count[quote] = 0; + } + + count[quote]++; + count.total++; + return quote; + }); + return count; + }, + removeDuplicates: function removeDuplicates(text, settings) { + var lquote = settings.left[0]; + var lquote2 = settings.left[1] || lquote; + var rquote = settings.right[0]; + + if (lquote !== lquote2) { + return text; + } + + return text // ««word» word» -> «word» word» + .replace(new RegExp(lquote + lquote, 'g'), lquote) // «word «word»» -> «word «word» + .replace(new RegExp(rquote + rquote, 'g'), rquote); + }, + removeSpacing: function removeSpacing(text, settings) { + for (var i = 0, len = settings.left.length; i < len; i++) { + var lquote = settings.left[i]; + var rquote = settings.right[i]; + text = text.replace(new RegExp(lquote + "([ \u202F\xA0])", 'g'), lquote).replace(new RegExp("([ \u202F\xA0])" + rquote, 'g'), rquote); + } + + return text; + }, + setSpacing: function setSpacing(text, settings) { + for (var i = 0, len = settings.left.length; i < len; i++) { + var lquote = settings.left[i]; + var rquote = settings.right[i]; + text = text.replace(new RegExp(lquote + "([^\u202F])", 'g'), lquote + "\u202F$1").replace(new RegExp("([^\u202F])" + rquote, 'g'), "$1\u202F" + rquote); + } + + return text; + }, + set: function set(text, params) { + var quotes = getData('common/quote'); + var lquote = params.settings.left[0]; + var lquote2 = params.settings.left[1] || lquote; + var rquote = params.settings.right[0]; + var reL = new RegExp('(^|[' + this.beforeLeft + '])([' + quotes + ']{1,' + this.maxLevel + '})(?=[^\\s' + privateLabel + '])', 'gim'); + var reR = new RegExp('([^\\s' + privateLabel + '])([' + quotes + ']{1,' + this.maxLevel + '})(?=[' + this.afterRight + ']|$)', 'gim'); + text = text.replace(reL, function ($0, $1, $2) { + return $1 + repeat(lquote, $2.length); + }).replace(reR, function ($0, $1, $2) { + return $1 + repeat(rquote, $2.length); + }); + text = this.setAboveTags(text, params); + + if (lquote !== lquote2) { + text = this.setInner(text, params.settings); + } + + return text; + }, + setAboveTags: function setAboveTags(text, params) { + var _this = this; + + var quotes = getData('common/quote'); + var lquote = params.settings.left[0]; + var rquote = params.settings.right[0]; + return text.replace(new RegExp('(^|.)([' + quotes + '])(.|$)', 'gm'), function (original, prev, quote, next, pos) { + if (prev !== privateLabel && next !== privateLabel) { + return original; + } + + if (prev === privateLabel && next === privateLabel) { + if (quote === '"') { + return prev + _this.getAboveTwoTags(text, pos + 1, params) + next; + } + + return original; + } + + if (prev === privateLabel) { + var hasRight = _this.afterRight.indexOf(next) > -1; + + var prevInfo = _this.getPrevTagInfo(text, pos - 1, params); + + if (hasRight && prevInfo && prevInfo.group === 'html') { + return prev + (prevInfo.isClosing ? rquote : lquote) + next; + } + + return prev + (!next || hasRight ? rquote : lquote) + next; + } else { + var hasLeft = _this.beforeLeft.indexOf(prev) > -1; + + var nextInfo = _this.getNextTagInfo(text, pos + 1, params); + + if (hasLeft && nextInfo && nextInfo.group === 'html') { + return prev + (nextInfo.isClosing ? rquote : lquote) + next; + } + + return prev + (!prev || hasLeft ? lquote : rquote) + next; + } + }); + }, + getAboveTwoTags: function getAboveTwoTags(text, pos, params) { + var prevInfo = this.getPrevTagInfo(text, pos, params); + var nextInfo = this.getNextTagInfo(text, pos, params); + + if (prevInfo) { + if (prevInfo.group === 'html') { + if (!prevInfo.isClosing) { + return params.settings.left[0]; + } + + if (nextInfo && nextInfo.isClosing && prevInfo.isClosing) { + return params.settings.right[0]; + } + } + } + + return text[pos]; + }, + getPrevTagInfo: function getPrevTagInfo(text, pos, params) { + var prevLabel = params.safeTags.getPrevLabel(text, pos - 1); + + if (prevLabel) { + var prevTag = params.safeTags.getTagByLabel(params.context, prevLabel); + + if (prevTag) { + return params.safeTags.getTagInfo(prevTag); + } + } + + return null; + }, + getNextTagInfo: function getNextTagInfo(text, pos, params) { + var nextLabel = params.safeTags.getNextLabel(text, pos + 1); + + if (nextLabel) { + var nextTag = params.safeTags.getTagByLabel(params.context, nextLabel); + + if (nextTag) { + return params.safeTags.getTagInfo(nextTag); + } + } + + return null; + }, + setInner: function setInner(text, settings) { + var leftQuotes = []; + var rightQuotes = []; + + for (var k = 0; k < settings.left.length; k++) { + leftQuotes.push(settings.left[k]); + rightQuotes.push(settings.right[k]); + } + + var lquote = settings.left[0]; + var rquote = settings.right[0]; + var minLevel = -1; + var maxLevel = leftQuotes.length - 1; + var level = minLevel; + var result = ''; + + for (var i = 0, len = text.length; i < len; i++) { + var letter = text[i]; + + if (letter === lquote) { + level++; + + if (level > maxLevel) { + level = maxLevel; + } + + result += leftQuotes[level]; + } else if (letter === rquote) { + if (level <= minLevel) { + level = 0; + result += rightQuotes[level]; + } else { + result += rightQuotes[level]; + level--; + + if (level < minLevel) { + level = minLevel; + } + } + } else { + if (letter === '"') { + level = minLevel; + } + + result += letter; + } + } + + var count = this.count(result, settings); + return count[lquote] !== count[rquote] ? text : result; + } +}; +var quote = { + name: 'common/punctuation/quote', + handler: function handler(text, commonSettings, context) { + var locale = context.prefs.locale[0]; + var settings = commonSettings[locale]; + + if (!settings) { + return text; + } + + return Quote.process({ + context: context, + settings: settings, + safeTags: this._safeTags + }); + }, + settings: function settings() { + var settings = {}; + getLocales().forEach(function (locale) { + settings[locale] = deepCopy(getData(locale + '/quote')); + }); + return settings; + } +}; + +var quoteLink = { + name: 'common/punctuation/quoteLink', + queue: 'show-safe-tags-html', + index: '+5', + handler: function handler(text, settings, context) { + var quotes = this.getSetting('common/punctuation/quote', context.prefs.locale[0]); + + if (!quotes) { + return text; + } + + var lquote1 = HtmlEntities$1.getByUtf(quotes.left[0]); + var rquote1 = HtmlEntities$1.getByUtf(quotes.right[0]); + var lquote2 = HtmlEntities$1.getByUtf(quotes.left[1]); + var rquote2 = HtmlEntities$1.getByUtf(quotes.right[1]); + lquote2 = lquote2 ? '|' + lquote2 : ''; + rquote2 = rquote2 ? '|' + rquote2 : ''; + var re = new RegExp('(<[aA]\\s[^>]*?>)(' + lquote1 + lquote2 + ')([^]*?)(' + rquote1 + rquote2 + ')(</[aA]>)', 'g'); + return text.replace(re, '$2$1$3$5$4'); + } +}; + +Typograf.addRules([apostrophe, delDoublePunctuation, hellip, quote, quoteLink]); + +var afterPunctuation = { + name: 'common/space/afterPunctuation', + handler: function handler(text) { + var reExcl = new RegExp('(!|;|\\?)([^).…!;?\\s[\\])' + privateLabel + getData('common/quote') + '])', 'g'); + var reComma = new RegExp('(\\D)(,|:)([^)",:.?\\s\\/\\\\' + privateLabel + '])', 'g'); + return text.replace(reExcl, '$1 $2').replace(reComma, '$1$2 $3'); + } +}; + +var beforeBracket = { + name: 'common/space/beforeBracket', + handler: function handler(text, settings, context) { + var re = new RegExp('([' + context.getData('char') + '.!?,;…)])\\(', 'gi'); + return text.replace(re, '$1 ('); + } +}; + +var bracket = { + name: 'common/space/bracket', + handler: function handler(text) { + return text.replace(/(\() +/g, '(').replace(/ +\)/g, ')'); + } +}; + +var delBeforePercent = { + name: 'common/space/delBeforePercent', + handler: function handler(text) { + return text.replace(/(\d)( |\u00A0)(%|‰|‱)/g, '$1$3'); + } +}; + +var delBeforePunctuation = { + name: 'common/space/delBeforePunctuation', + handler: function handler(text) { + return text.replace(/([!?]) (?=[!?])/g, '$1').replace(/(^|[^!?:;,.…]) ([!?:;,.])(?!\))/g, '$1$2'); + } +}; + +var delLeadingBlanks = { + name: 'common/space/delLeadingBlanks', + handler: function handler(text) { + return text.replace(/^[ \t]+/mg, ''); + }, + disabled: true +}; + +var delRepeatN = { + name: 'common/space/delRepeatN', + index: '-1', + handler: function handler(text, settings) { + var maxConsecutiveLineBreaks = settings.maxConsecutiveLineBreaks; + var consecutiveLineBreaksRegex = new RegExp("\n{".concat(maxConsecutiveLineBreaks + 1, ",}"), 'g'); + var replaceValue = repeat('\n', maxConsecutiveLineBreaks); + return text.replace(consecutiveLineBreaksRegex, replaceValue); + }, + settings: { + maxConsecutiveLineBreaks: 2 + } +}; + +var delRepeatSpace = { + name: 'common/space/delRepeatSpace', + index: '-1', + handler: function handler(text) { + return text.replace(/([^\n \t])[ \t]{2,}(?![\n \t])/g, '$1 '); + } +}; + +var delTrailingBlanks = { + name: 'common/space/delTrailingBlanks', + index: '-3', + handler: function handler(text) { + return text.replace(/[ \t]+\n/g, '\n'); + } +}; + +var insertFinalNewline = { + name: 'common/space/insertFinalNewline', + live: false, + disabled: true, + queue: 'end', + handler: function handler(text) { + return text[text.length - 1] === '\n' ? text : text + '\n'; + } +}; + +var replaceTab = { + name: 'common/space/replaceTab', + index: '-5', + handler: function handler(text) { + return text.replace(/\t/g, ' '); + } +}; + +var squareBracket = { + name: 'common/space/squareBracket', + handler: function handler(text) { + return text.replace(/(\[) +/g, '[').replace(/ +\]/g, ']'); + } +}; + +var trimLeft = { + name: 'common/space/trimLeft', + index: '-4', + handler: String.prototype.trimLeft ? function (text) { + return text.trimLeft(); + } : + /* istanbul ignore next */ + function (text) { + return text.replace(/^[\s\uFEFF\xA0]+/g, ''); + } +}; + +var trimRight = { + name: 'common/space/trimRight', + index: '-3', + live: false, + handler: String.prototype.trimRight ? function (text) { + return text.trimRight(); + } : + /* istanbul ignore next */ + function (text) { + return text.replace(/[\s\uFEFF\xA0]+$/g, ''); + } +}; + +Typograf.addRules([afterPunctuation, beforeBracket, bracket, delBeforePercent, delBeforePunctuation, delLeadingBlanks, delRepeatN, delRepeatSpace, delTrailingBlanks, insertFinalNewline, replaceTab, squareBracket, trimLeft, trimRight]); + +var arrow = { + name: 'common/symbols/arrow', + handler: function handler(text) { + return replace(text, [[/(^|[^-])->(?!>)/g, '$1→'], [/(^|[^<])<-(?!-)/g, '$1←']]); + } +}; + +var cf = { + name: 'common/symbols/cf', + handler: function handler(text) { + var re = new RegExp("(^|[\\s(\\[+\u2248\xB1\u2212\u2014\u2013\\-])(\\d+(?:[.,]\\d+)?)[ \xA0\u2009]?(C|F)([\\W\\s.,:!?\")\\]]|$)", 'mg'); + return text.replace(re, "$1$2\u2009\xB0$3$4"); + } +}; + +var copy = { + name: 'common/symbols/copy', + handler: function handler(text) { + return replace(text, [[/\(r\)/gi, '®'], [/(copyright )?\((c|с)\)/gi, '©'], [/\(tm\)/gi, '™']]); + } +}; + +Typograf.addRules([arrow, cf, copy]); + +var main = { + name: 'en-US/dash/main', + index: '-5', + handler: function handler(text) { + var dashes = getData('common/dash'); + var nonBreakingSpace = "\xA0"; + var emDash = "\u2014"; + var spaceBefore = "[ ".concat(nonBreakingSpace, "]"); // white space or a non-breaking space + + var spaceAfter = "[ ".concat(nonBreakingSpace, "\n]"); // same as spaceBefore, but includes line break + + var re = new RegExp("".concat(spaceBefore, "(").concat(dashes, ")(").concat(spaceAfter, ")"), 'g'); + return text.replace(re, "".concat(nonBreakingSpace).concat(emDash, "$2")); + } +}; + +Typograf.addRules([main]); + +var centuries = { + name: 'ru/dash/centuries', + handler: function handler(text, settings) { + var dashes = '(' + getData('common/dash') + ')'; + var re = new RegExp("(X|I|V)[ |\xA0]?" + dashes + "[ |\xA0]?(X|I|V)", 'g'); + return text.replace(re, '$1' + settings.dash + '$3'); + }, + settings: { + dash: "\u2013" // – + + } +}; + +var daysMonth = { + name: 'ru/dash/daysMonth', + handler: function handler(text, settings) { + var re = new RegExp('(^|\\s)([123]?\\d)' + '(' + getData('common/dash') + ')' + "([123]?\\d)[ \xA0]" + '(' + getData('ru/monthGenCase') + ')', 'g'); + return text.replace(re, '$1$2' + settings.dash + "$4\xA0$5"); + }, + settings: { + dash: "\u2013" // – + + } +}; + +var de$1 = { + name: 'ru/dash/de', + handler: function handler(text) { + var re = new RegExp('([a-яё]+) де' + getData('ru/dashAfterDe'), 'g'); + return text.replace(re, '$1-де'); + }, + disabled: true +}; + +var decade = { + name: 'ru/dash/decade', + handler: function handler(text, settings) { + var re = new RegExp('(^|\\s)(\\d{3}|\\d)0' + '(' + getData('common/dash') + ')' + "(\\d{3}|\\d)0(-\u0435[ \xA0])" + "(?=\u0433\\.?[ \xA0]?\u0433|\u0433\u043E\u0434)", 'g'); + return text.replace(re, '$1$20' + settings.dash + '$40$5'); + }, + settings: { + dash: "\u2013" // – + + } +}; + +var directSpeech = { + name: 'ru/dash/directSpeech', + handler: function handler(text) { + var dashes = getData('common/dash'); + var re1 = new RegExp("([\"\xBB\u2018\u201C,])[ |\xA0]?(".concat(dashes, ")[ |\xA0]"), 'g'); + var re2 = new RegExp("(^|".concat(privateLabel, ")(").concat(dashes, ")( |\xA0)"), 'gm'); + var re3 = new RegExp("([.\u2026?!])[ \xA0](".concat(dashes, ")[ \xA0]"), 'g'); + return text.replace(re1, "$1\xA0\u2014 ").replace(re2, "$1\u2014\xA0").replace(re3, "$1 \u2014\xA0"); + } +}; + +var izpod = { + name: 'ru/dash/izpod', + handler: function handler(text) { + var re = new RegExp(getData('ru/dashBefore') + '(И|и)з под' + getData('ru/dashAfter'), 'g'); + return text.replace(re, '$1$2з-под'); + } +}; + +var izza = { + name: 'ru/dash/izza', + handler: function handler(text) { + var re = new RegExp(getData('ru/dashBefore') + '(И|и)з за' + getData('ru/dashAfter'), 'g'); + return text.replace(re, '$1$2з-за'); + } +}; + +var ka = { + name: 'ru/dash/ka', + handler: function handler(text) { + var re = new RegExp('([a-яё]+) ка(сь)?' + getData('ru/dashAfter'), 'g'); + return text.replace(re, '$1-ка$2'); + } +}; + +var koe = { + name: 'ru/dash/koe', + handler: function handler(text) { + var re = new RegExp(getData('ru/dashBefore') + '([Кк]о[ей])\\s([а-яё]{3,})' + getData('ru/dashAfter'), 'g'); + return text.replace(re, '$1$2-$3'); + } +}; + +var main$1 = { + name: 'ru/dash/main', + index: '-5', + handler: function handler(text) { + var dashes = getData('common/dash'); + var re = new RegExp("([ \xA0])(" + dashes + ")([ \xA0\\n])", 'g'); + return text.replace(re, "\xA0\u2014$3"); + } +}; + +var month = { + name: 'ru/dash/month', + handler: function handler(text, settings) { + var months = '(' + getData('ru/month') + ')'; + var monthsPre = '(' + getData('ru/monthPreCase') + ')'; + var dashes = getData('common/dash'); + var re = new RegExp(months + ' ?(' + dashes + ') ?' + months, 'gi'); + var rePre = new RegExp(monthsPre + ' ?(' + dashes + ') ?' + monthsPre, 'gi'); + var newSubStr = '$1' + settings.dash + '$3'; + return text.replace(re, newSubStr).replace(rePre, newSubStr); + }, + settings: { + dash: "\u2013" // – + + } +}; + +var surname = { + name: 'ru/dash/surname', + handler: function handler(text) { + var re = new RegExp('([А-ЯЁ][а-яё]+)\\s-([а-яё]{1,3})(?![^а-яё]|$)', 'g'); + return text.replace(re, "$1\xA0\u2014$2"); + } +}; + +var taki = { + name: 'ru/dash/taki', + handler: function handler(text) { + var re = new RegExp('(верно|довольно|опять|прямо|так|вс[её]|действительно|неужели)\\s(таки)' + getData('ru/dashAfter'), 'g'); + return text.replace(re, '$1-$2'); + } +}; + +var time = { + name: 'ru/dash/time', + handler: function handler(text, settings) { + var re = new RegExp(getData('ru/dashBefore') + '(\\d?\\d:[0-5]\\d)' + getData('common/dash') + '(\\d?\\d:[0-5]\\d)' + getData('ru/dashAfter'), 'g'); + return text.replace(re, '$1$2' + settings.dash + '$3'); + }, + settings: { + dash: "\u2013" // – + + } +}; + +var to = { + name: 'ru/dash/to', + handler: function handler(text) { + var words = ['откуда', 'куда', 'где', 'когда', 'зачем', 'почему', 'как', 'како[ейм]', 'какая', 'каки[емх]', 'какими', 'какую', 'что', 'чего', 'че[йм]', 'чьим?', 'кто', 'кого', 'кому', 'кем']; + var re = new RegExp('(' + words.join('|') + ')( | -|- )(то|либо|нибудь)' + getData('ru/dashAfter'), 'gi'); + return text.replace(re, '$1-$3'); + } +}; + +var weekday = { + name: 'ru/dash/weekday', + handler: function handler(text, settings) { + var part = '(' + getData('ru/weekday') + ')'; + var re = new RegExp(part + ' ?(' + getData('common/dash') + ') ?' + part, 'gi'); + return text.replace(re, '$1' + settings.dash + '$3'); + }, + settings: { + dash: "\u2013" // – + + } +}; + +var years = { + name: 'ru/dash/years', + handler: function handler(text, settings) { + var dashes = getData('common/dash'); + var re = new RegExp("(\\D|^)(\\d{4})[ \xA0]?(" + dashes + ")[ \xA0]?(\\d{4})(?=[ \xA0]?\u0433)", 'g'); + return text.replace(re, function ($0, $1, $2, $3, $4) { + if (parseInt($2, 10) < parseInt($4, 10)) { + return $1 + $2 + settings.dash + $4; + } + + return $0; + }); + }, + settings: { + dash: "\u2013" // – + + } +}; + +Typograf.addRules([centuries, daysMonth, de$1, decade, directSpeech, izpod, izza, ka, koe, main$1, month, surname, taki, time, to, weekday, years]); + +var fromISO = { + name: 'ru/date/fromISO', + handler: function handler(text) { + var sp1 = '(-|\\.|\\/)'; + var sp2 = '(-|\\/)'; + var re1 = new RegExp('(^|\\D)(\\d{4})' + sp1 + '(\\d{2})' + sp1 + '(\\d{2})(\\D|$)', 'gi'); + var re2 = new RegExp('(^|\\D)(\\d{2})' + sp2 + '(\\d{2})' + sp2 + '(\\d{4})(\\D|$)', 'gi'); + return text.replace(re1, '$1$6.$4.$2$7').replace(re2, '$1$4.$2.$6$7'); + } +}; + +var weekday$1 = { + name: 'ru/date/weekday', + handler: function handler(text) { + var space = "( |\xA0)"; + var monthCase = getData('ru/monthGenCase'); + var weekday = getData('ru/weekday'); + var re = new RegExp('(\\d)' + space + '(' + monthCase + '),' + space + '(' + weekday + ')', 'gi'); + return text.replace(re, function () { + var a = arguments; + return a[1] + a[2] + a[3].toLowerCase() + ',' + a[4] + a[5].toLowerCase(); + }); + } +}; + +Typograf.addRules([fromISO, weekday$1]); + +var currency = { + name: 'ru/money/currency', + handler: function handler(text) { + var currency = '([$€¥Ұ£₤₽])'; + var space = "[ \xA0\u2009\u202F]"; + var re1 = new RegExp('(^|[\\D]{2})' + currency + ' ?([\\d.,]+(' + space + '\\d{3})*)(' + space + '?(тыс\\.|млн|млрд|трлн))?', 'gm'); + var re2 = new RegExp('(^|[\\D])([\\d.,]+) ?' + currency, 'gm'); + return text.replace(re1, function ($0, $1, $2, $3, $4, $5, $6) { + return $1 + $3 + ($6 ? "\xA0" + $6 : '') + "\xA0" + $2; + }).replace(re2, "$1$2\xA0$3"); + }, + disabled: true +}; + +var ruble = { + name: 'ru/money/ruble', + handler: function handler(text) { + var newSubstr = "$1\xA0\u20BD"; + var commonPart = "(\\d+)( |\xA0)?(\u0440|\u0440\u0443\u0431)\\."; + var re1 = new RegExp('^' + commonPart + '$', 'g'); + var re2 = new RegExp(commonPart + '(?=[!?,:;])', 'g'); + var re3 = new RegExp(commonPart + '(?=\\s+[A-ЯЁ])', 'g'); + return text.replace(re1, newSubstr).replace(re2, newSubstr).replace(re3, newSubstr + '.'); + }, + disabled: true +}; + +Typograf.addRules([currency, ruble]); + +var abbr = { + name: 'ru/nbsp/abbr', + handler: function handler(text) { + function abbr($0, $1, $2, $3) { + // дд.мм.гггг + if ($2 === 'дд' && $3 === 'мм') { + return $0; + } // Являются ли сокращения ссылкой + + + if (['рф', 'ру', 'рус', 'орг', 'укр', 'бг', 'срб'].indexOf($3) > -1) { + return $0; + } + + return $1 + $2 + '.' + "\xA0" + $3 + '.'; + } + + var re = new RegExp("(^|\\s|".concat(privateLabel, ")([\u0430-\u044F\u0451]{1,3})\\. ?([\u0430-\u044F\u0451]{1,3})\\."), 'g'); + return text.replace(re, abbr) // Для тройных сокращений - а.е.м. + .replace(re, abbr); + } +}; + +var addr = { + name: 'ru/nbsp/addr', + handler: function handler(text) { + return text.replace(/(\s|^)(дом|д\.|кв\.|под\.|п-д) *(\d+)/gi, "$1$2\xA0$3").replace(/(\s|^)(мкр-н|мк-н|мкр\.|мкрн)\s/gi, "$1$2\xA0") // микрорайон + .replace(/(\s|^)(эт\.) *(-?\d+)/gi, "$1$2\xA0$3").replace(/(\s|^)(\d+) +этаж([^а-яё]|$)/gi, "$1$2\xA0\u044D\u0442\u0430\u0436$3").replace(/(\s|^)литер\s([А-Я]|$)/gi, "$1\u043B\u0438\u0442\u0435\u0440\xA0$2") + /* + область, край, станция, поселок, село, + деревня, улица, переулок, проезд, проспект, + бульвар, площадь, набережная, шоссе, + тупик, офис, комната, участок, владение, строение, корпус + */ + .replace(/(\s|^)(обл|кр|ст|пос|с|д|ул|пер|пр|пр-т|просп|пл|бул|б-р|наб|ш|туп|оф|комн?|уч|вл|влад|стр|кор)\. *([а-яёa-z\d]+)/gi, "$1$2.\xA0$3") // город + .replace(/(\D[ \u00A0]|^)г\. ?([А-ЯЁ])/gm, "$1\u0433.\xA0$2"); + } +}; + +var afterNumberSign = { + name: 'ru/nbsp/afterNumberSign', + handler: function handler(text) { + // \u2009 - THIN SPACE + // \u202F - NARROW NO-BREAK SPACE + return text.replace(/№[ \u00A0\u2009]?(\d|п\/п)/g, "\u2116\u202F$1"); + } +}; + +var beforeParticle = { + name: 'ru/nbsp/beforeParticle', + index: '+5', + handler: function handler(text) { + var particles = '(ли|ль|же|ж|бы|б)'; + var re1 = new RegExp('([А-ЯЁа-яё]) ' + particles + '(?=[,;:?!"‘“»])', 'g'); + var re2 = new RegExp("([\u0410-\u042F\u0401\u0430-\u044F\u0451])[ \xA0]" + particles + "[ \xA0]", 'g'); + return text.replace(re1, "$1\xA0$2").replace(re2, "$1\xA0$2 "); + } +}; + +var centuries$1 = { + name: 'ru/nbsp/centuries', + handler: function handler(text) { + var dashes = getData('common/dash'); + var before = '(^|\\s)([VIX]+)'; + var after = '(?=[,;:?!"‘“»]|$)'; + var re1 = new RegExp(before + "[ \xA0]?\u0432\\.?" + after, 'gm'); + var re2 = new RegExp(before + '(' + dashes + ')' + "([VIX]+)[ \xA0]?\u0432\\.?([ \xA0]?\u0432\\.?)?" + after, 'gm'); + return text.replace(re1, "$1$2\xA0\u0432.").replace(re2, "$1$2$3$4\xA0\u0432\u0432."); + } +}; + +var dayMonth = { + name: 'ru/nbsp/dayMonth', + handler: function handler(text) { + var re = new RegExp('(\\d{1,2}) (' + getData('ru/shortMonth') + ')', 'gi'); + return text.replace(re, "$1\xA0$2"); + } +}; + +var initials = { + name: 'ru/nbsp/initials', + handler: function handler(text) { + var spaces = "\xA0\u202F "; // nbsp, thinsp + + var quote = getData('ru/quote'); + var re = new RegExp('(^|[' + spaces + quote.left + privateLabel + '"])([А-ЯЁ])\\.[' + spaces + ']?([А-ЯЁ])\\.[' + spaces + ']?([А-ЯЁ][а-яё]+)(?=[\\s.,;:?!"' + quote.right + ']|$)', 'gm'); + return text.replace(re, "$1$2.\xA0$3.\xA0$4"); + } +}; + +var m = { + name: 'ru/nbsp/m', + index: '+5', + handler: function handler(text) { + var re = new RegExp('(^|[\\s,.\\(' + privateLabel + '])' + "(\\d+)[ \xA0]?(\u043C\u043C?|\u0441\u043C|\u043A\u043C|\u0434\u043C|\u0433\u043C|mm?|km|cm|dm)([23\xB2\xB3])?([\\s\\).!?,;" + privateLabel + ']|$)', 'gm'); + return text.replace(re, function ($0, $1, $2, $3, $4, $5) { + var pow = { + '2': '²', + '²': '²', + '3': '³', + '³': '³', + '': '' + }[$4 || '']; + return $1 + $2 + "\xA0" + $3 + pow + ($5 === "\xA0" ? ' ' : $5); + }); + } +}; + +var mln = { + name: 'ru/nbsp/mln', + handler: function handler(text) { + return text.replace(/(\d) ?(тыс|млн|млрд|трлн)(\.|\s|$)/gi, "$1\xA0$2$3"); + } +}; + +var ooo = { + name: 'ru/nbsp/ooo', + handler: function handler(text) { + return text.replace(/(^|[^a-яёA-ЯЁ])(ООО|ОАО|ЗАО|НИИ|ПБОЮЛ) /g, "$1$2\xA0"); + } +}; + +var page = { + name: 'ru/nbsp/page', + handler: function handler(text) { + var re = new RegExp('(^|[)\\s' + privateLabel + '])' + '(стр|гл|рис|илл?|ст|п|c)\\. *(\\d+)([\\s.,?!;:]|$)', 'gim'); + return text.replace(re, "$1$2.\xA0$3$4"); + } +}; + +var ps = { + name: 'ru/nbsp/ps', + handler: function handler(text) { + var re = new RegExp("(^|\\s|".concat(privateLabel, ")[p\u0437]\\.[ \xA0]?([p\u0437]\\.[ \xA0]?)?[s\u044B]\\.:? "), 'gim'); + return text.replace(re, function ($0, $1, $2) { + return $1 + ($2 ? "P.\xA0P.\xA0S. " : "P.\xA0S. "); + }); + } +}; + +var rubleKopek = { + name: 'ru/nbsp/rubleKopek', + handler: function handler(text) { + return text.replace(/(\d) ?(?=(руб|коп)\.)/g, "$1\xA0"); + } +}; + +var see = { + name: 'ru/nbsp/see', + handler: function handler(text) { + var re = new RegExp("(^|\\s|".concat(privateLabel, "|\\()(\u0441\u043C|\u0438\u043C)\\.[ \xA0]?([\u0430-\u044F\u04510-9a-z]+)([\\s.,?!]|$)"), 'gi'); + return text.replace(re, function ($0, $1, $2, $3, $4) { + return ($1 === "\xA0" ? ' ' : $1) + $2 + ".\xA0" + $3 + $4; + }); + } +}; + +var year = { + name: 'ru/nbsp/year', + handler: function handler(text) { + return text.replace(/(^|\D)(\d{4}) ?г([ ,;.\n]|$)/g, "$1$2\xA0\u0433$3"); + } +}; + +var years$1 = { + name: 'ru/nbsp/years', + index: '+5', + handler: function handler(text) { + var dashes = getData('common/dash'); + var re = new RegExp('(^|\\D)(\\d{4})(' + dashes + ")(\\d{4})[ \xA0]?\u0433\\.?([ \xA0]?\u0433\\.)?(?=[,;:?!\"\u2018\u201C\xBB\\s]|$)", 'gm'); + return text.replace(re, "$1$2$3$4\xA0\u0433\u0433."); + } +}; + +Typograf.addRules([abbr, addr, afterNumberSign, beforeParticle, centuries$1, dayMonth, initials, m, mln, ooo, page, ps, rubleKopek, see, year, years$1]); + +var comma = { + name: 'ru/number/comma', + handler: function handler(text) { + // \u00A0 - NO-BREAK SPACE + // \u2009 - THIN SPACE + // \u202F - NARROW NO-BREAK SPACE + return text.replace(/(^|\s)(\d+)\.(\d+[\u00A0\u2009\u202F ]*?[%‰°×x])/gim, '$1$2,$3'); + } +}; + +var ordinals = { + name: 'ru/number/ordinals', + handler: function handler(text, settings, context) { + var re = new RegExp('(\\d[%‰]?)-(ый|ой|ая|ое|ые|ым|ом|ых|ого|ому|ыми)(?![' + context.getData('char') + '])', 'g'); + return text.replace(re, function ($0, $1, $2) { + var parts = { + 'ой': 'й', + 'ый': 'й', + 'ая': 'я', + 'ое': 'е', + 'ые': 'е', + 'ым': 'м', + 'ом': 'м', + 'ых': 'х', + 'ого': 'го', + 'ому': 'му', + 'ыми': 'ми' + }; + return $1 + '-' + parts[$2]; + }); + } +}; + +Typograf.addRules([comma, ordinals]); + +function removeOptAlignTags(text, classNames) { + var re = new RegExp('<span class="(' + classNames.join('|') + ')">([^]*?)</span>', 'g'); + return text.replace(re, '$2'); +} +function removeOptAlignTagsFromTitle(text, classNames) { + return text.replace(/<title>[^]*?<\/title>/i, function (text) { + return removeOptAlignTags(text, classNames); + }); +} + +var classNames = ['typograf-oa-lbracket', 'typograf-oa-n-lbracket', 'typograf-oa-sp-lbracket']; +var name = 'ru/optalign/bracket'; +var bracket$1 = { + name: name, + handler: function handler(text) { + return text.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: true, + htmlAttrs: false +}; +var innerStartBracket = { + name: name, + queue: 'start', + handler: function handler(text) { + return removeOptAlignTags(text, classNames); + } +}; +var innerEndBracket = { + name: name, + queue: 'end', + handler: function handler(text) { + return removeOptAlignTagsFromTitle(text, classNames); + } +}; + +var classNames$1 = ['typograf-oa-comma', 'typograf-oa-comma-sp']; +var name$1 = 'ru/optalign/comma'; +var comma$1 = { + name: name$1, + handler: function handler(text, settings, context) { + var re = new RegExp('([' + context.getData('char') + "\\d\u0301]+), ", 'gi'); + return text.replace(re, '$1<span class="typograf-oa-comma">,</span><span class="typograf-oa-comma-sp"> </span>'); + }, + disabled: true, + htmlAttrs: false +}; +var innerStartComma = { + name: name$1, + queue: 'start', + handler: function handler(text) { + return removeOptAlignTags(text, classNames$1); + } +}; +var innerEndComma = { + name: name$1, + queue: 'end', + handler: function handler(text) { + return removeOptAlignTagsFromTitle(text, classNames$1); + } +}; + +var classNames$2 = ['typograf-oa-lquote', 'typograf-oa-n-lquote', 'typograf-oa-sp-lquote']; +var name$2 = 'ru/optalign/quote'; +var quote$1 = { + name: name$2, + handler: function handler(text) { + var quote = this.getSetting('common/punctuation/quote', 'ru'); + var lquotes = '([' + quote.left[0] + (quote.left[1] || '') + '])'; + var reNewLine = new RegExp('(^|\n\n|' + privateLabel + ')(' + lquotes + ')', 'g'); + var reInside = new RegExp('([^\n' + privateLabel + "])([ \xA0\n])(" + lquotes + ')', 'gi'); + return text.replace(reNewLine, '$1<span class="typograf-oa-n-lquote">$2</span>').replace(reInside, '$1<span class="typograf-oa-sp-lquote">$2</span><span class="typograf-oa-lquote">$3</span>'); + }, + disabled: true, + htmlAttrs: false +}; +var innerStartQuote = { + name: name$2, + queue: 'start', + handler: function handler(text) { + return removeOptAlignTags(text, classNames$2); + } +}; +var innerEndQuote = { + name: name$2, + queue: 'end', + handler: function handler(text) { + return removeOptAlignTagsFromTitle(text, classNames$2); + } +}; + +Typograf.addRules([bracket$1, comma$1, quote$1]); +Typograf.addInnerRules([innerStartBracket, innerEndBracket, innerStartComma, innerEndComma, innerStartQuote, innerEndQuote]); + +var accent = { + name: 'ru/other/accent', + handler: function handler(text) { + return text.replace(/([а-яё])([АЕЁИОУЫЭЮЯ])([^А-ЯЁ\w]|$)/g, function ($0, $1, $2, $3) { + return $1 + $2.toLowerCase() + "\u0301" + $3; + }); + }, + disabled: true +}; + +var defaultCityCodeLength = 5; +var countryCode = '7'; +var exceptions = []; +var exceptionsMax = 8; +var exceptionsMin = 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, 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 (num) { + if (typeof num === 'string') { + var buf = num.split('-'); + + for (var i = +buf[0]; i <= +buf[1]; i++) { + exceptions.push(i); + } + } else { + exceptions.push(num); + } +}); + +function phone(num) { + var firstSym = num[0]; + var cityCode = ''; + var hasPlusWithCode; + var hasEight; + + if (num.length < 8) { + return phoneBlocks(num); + } // 8 495 123-45-67, +7 495 123-45-67 + + + if (num.length > 10) { + if (firstSym === '+') { + if (num[1] === countryCode) { + hasPlusWithCode = true; + num = num.substr(2); + } else { + return num; + } + } else if (firstSym === '8') { + hasEight = true; + num = num.substr(1); + } + } + + for (var cityCodeLen = exceptionsMax; cityCodeLen >= exceptionsMin; cityCodeLen--) { + var code = +num.substr(0, cityCodeLen); + + if (exceptions.indexOf(code) > -1) { + cityCode = num.substr(0, cityCodeLen); + num = num.substr(cityCodeLen); + break; + } + } + + if (!cityCode) { + cityCode = num.substr(0, defaultCityCodeLength); + num = num.substr(defaultCityCodeLength); + } + + return (hasPlusWithCode ? '+' + countryCode + "\xA0" : '') + (hasEight ? "8\xA0" : '') + prepareCode(cityCode) + "\xA0" + phoneBlocks(num); +} + +function prepareCode(code) { + var numCode = +code; + var len = code.length; + var result = [code]; + var withoutBrackets = false; + + if (len > 3) { + switch (len) { + case 4: + result = [code.substr(0, 2), code.substr(2, 2)]; + break; + + case 5: + result = [code.substr(0, 3), code.substr(3, 3)]; + break; + + case 6: + result = [code.substr(0, 2), code.substr(2, 2), code.substr(4, 2)]; + break; + } + } else { + // Мобильные и московские номера без скобок + withoutBrackets = numCode > 900 && numCode <= 999 || numCode === 495 || numCode === 499; + } + + result = result.join('-'); + return withoutBrackets ? result : '(' + result + ')'; +} + +function phoneBlocks(num) { + var add = ''; + + if (num.length % 2) { + add = num[0]; + add += num.length <= 5 ? '-' : ''; + num = num.substr(1, num.length - 1); + } + + return add + num.split(/(?=(?:\d\d)+$)/).join('-'); +} + +function clearPhone(text) { + return text.replace(/[^\d+]/g, ''); +} + +var phoneNumber = { + name: 'ru/other/phone-number', + live: false, + handler: function handler(text) { + var re = new RegExp('(^|,| |' + privateLabel + ")(\\+7[\\d\\(\\) \xA0-]{10,18})(?=,|;|" + privateLabel + '|$)', 'gm'); + return text.replace(re, function ($0, $1, $2) { + var buf = clearPhone($2); + return buf.length === 12 ? $1 + phone(buf) : $0; + }).replace( // eslint-disable-next-line no-misleading-character-class + /(^|[^а-яё])([☎☏✆📠📞📱]|т\.|тел\.|ф\.|моб\.|факс|сотовый|мобильный|телефон)(:?\s*?)([+\d(][\d \u00A0\-()]{3,}\d)/gi, function ($0, $1, $2, $3, $4) { + var buf = clearPhone($4); + + if (buf.length >= 5) { + return $1 + $2 + $3 + phone(buf); + } + + return $0; + }); + } +}; + +Typograf.addRules([accent, phoneNumber]); + +var ano = { + name: 'ru/punctuation/ano', + handler: function handler(text) { + var re = new RegExp("([^!?,:;\\-\u2012\u2013\u2014\\s])(\\s+)(\u0430|\u043D\u043E)(?= |\xA0|\\n)", 'g'); + return text.replace(re, '$1,$2$3'); + }, + // Запятая может идти после ссылки. + queue: 'hide-safe-tags-html' +}; + +var exclamation = { + name: 'ru/punctuation/exclamation', + live: false, + handler: function handler(text) { + return text.replace(/(^|[^!])!{2}($|[^!])/gm, '$1!$2').replace(/(^|[^!])!{4}($|[^!])/gm, '$1!!!$2'); + } +}; + +var exclamationQuestion = { + name: 'ru/punctuation/exclamationQuestion', + index: '+5', + handler: function handler(text) { + var re = new RegExp('(^|[^!])!\\?([^?]|$)', 'g'); + return text.replace(re, '$1?!$2'); + } +}; + +var hellipQuestion = { + name: 'ru/punctuation/hellipQuestion', + handler: function handler(text) { + return text.replace(/(^|[^.])(\.\.\.|…),/g, '$1…').replace(/(!|\?)(\.\.\.|…)(?=[^.]|$)/g, '$1..'); + } +}; + +Typograf.addRules([ano, exclamation, exclamationQuestion, hellipQuestion]); + +var afterHellip = { + name: 'ru/space/afterHellip', + handler: function handler(text) { + return text.replace(/([а-яё])(\.\.\.|…)([А-ЯЁ])/g, '$1$2 $3').replace(/([?!]\.\.)([а-яёa-z])/gi, '$1 $2'); + } +}; + +var year$1 = { + name: 'ru/space/year', + handler: function handler(text, settings, context) { + var re = new RegExp("(^| |\xA0)(\\d{3,4})(\u0433\u043E\u0434([\u0430\u0443\u0435]|\u043E\u043C)?)([^" + context.getData('char') + ']|$)', 'g'); + return text.replace(re, '$1$2 $3$5'); + } +}; + +Typograf.addRules([afterHellip, year$1]); + +var nn = { + name: 'ru/symbols/NN', + handler: function handler(text) { + return text.replace(/№№/g, '№'); + } +}; + +Typograf.addRules([nn]); + +var replacements = { + A: 'А', + // Latin: Russian + a: 'а', + B: 'В', + E: 'Е', + e: 'е', + K: 'К', + M: 'М', + H: 'Н', + O: 'О', + o: 'о', + P: 'Р', + p: 'р', + C: 'С', + c: 'с', + T: 'Т', + y: 'у', + X: 'Х', + x: 'х' +}; +var keys = Object.keys(replacements).join(''); +var switchingKeyboardLayout = { + name: 'ru/typo/switchingKeyboardLayout', + handler: function handler(text) { + var re = new RegExp('([' + keys + ']{1,3})(?=[А-ЯЁа-яё]+?)', 'g'); + return text.replace(re, function (str, $1) { + var result = ''; + + for (var i = 0; i < $1.length; i++) { + result += replacements[$1[i]]; + } + + return result; + }); + } +}; + +Typograf.addRules([switchingKeyboardLayout]); + +return Typograf; + +}))); diff --git a/assets/components/tinymcerte/js/vendor/tinymce/plugins/typograf/dist/typograf.min.js b/assets/components/tinymcerte/js/vendor/tinymce/plugins/typograf/dist/typograf.min.js new file mode 100644 index 0000000..0955875 --- /dev/null +++ b/assets/components/tinymcerte/js/vendor/tinymce/plugins/typograf/dist/typograf.min.js @@ -0,0 +1,2 @@ +/*! 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.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 u(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(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(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var s={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]],o=[["nbsp",160],["thinsp",8201],["ensp",8194],["emsp",8195],["shy",173],["zwnj",8204],["zwj",8205],["lrm",8206],["rlm",8207]],l=new(function(){function e(){n(this,e),this._entities=this._prepareEntities([].concat(t,o)),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(o)}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 i=[];return e.forEach(function(e){var t=u(e,2),n=t[0],r=t[1],a=String.fromCharCode(r);i.push({name:n,nameEntity:"&"+n+";",digitEntity:"&#"+r+";",utf:a,reName:new RegExp("&"+n+";","g"),reUtf:new RegExp(a,"g")})},this),i}},{key:"_prepareListParam",value:function(e){var n=[];return e.forEach(function(e){var t=this._entitiesByName[e];t&&n.push(t)},this),n}},{key:"_restoreEntitiesByIndex",value:function(t,n,e){return e.forEach(function(e){t=t.replace(e.reUtf,e[n])}),t}}]),e}()),c=[];function h(e){var t=(e||"").split("/")[0];t&&"common"!==t&&!p(t)&&(c.push(t),c.sort())}function e(){return c}function p(e){return"common"===e||-1!==c.indexOf(e)}function g(e,t){var n=e||t,r=n;return Array.isArray(n)||(r=[n]),r}var f={};function d(e){return f[e]}function m(t,e){"string"==typeof t?(h(t),f[t]=e):"object"===a(t)&&Object.keys(t).forEach(function(e){h(e),f[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"],$=new RegExp("(https?|file|ftp)://([a-zA-Z0-9/+-=%&:_.~?]+[a-zA-Z0-9#+]*)","g"),b="\uf000",x="\uf001",y=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:[$]},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){if(e.isHTML){var t=this._pasteLabel.bind(this,e,"html");e.text=e.text.replace(/<\/?[a-z][^]*?>/gi,t).replace(/<\/?[a-z][^]*?>/gi,t).replace(/&[gl]t;/gi,t)}}},{key:"getPrevLabel",value:function(e,t){for(var n=t-1;0<=n;n--)if(e[n]===b)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]===b)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,a="\uf000tf"+r.i+b;return r.hidden[t][a]=n,r.i++,a}},{key:"_prepareRegExp",value:function(e){var t;if(e instanceof RegExp)t=e;else{var n=u(e,3),r=n[0],a=n[1],i=n[2];void 0===i&&(i="[^]*?"),t=new RegExp(r+i+a,"gi")}return t}}]),e}();function R(e,t){for(var n="";1==(1&t)&&(n+=e),0!==(t>>>=1);)e+=e;return n}function E(e){return e.replace(/\u00A0/g," ")}function _(e,t){for(var n=0;n<t.length;n++)e=e.replace(t[n][0],t[n][1]);return e}function w(e){return-1!==e.search(/(<\/?[a-z]|<!|&[lg]t;)/i)}function k(e){return"object"===a(e)?JSON.parse(JSON.stringify(e)):e}var q=function(){function t(e){n(this,t),this._prefs="object"===a(e)?e:{},this._prefs.locale=g(this._prefs.locale),this._prefs.live=this._prefs.live||!1,this._safeTags=new y,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"";var n=this._prepareContext(e);return this._preparePrefs(n,t),this._process(n)}},{key:"_prepareContext",value:function(e){return{text:e,isHTML:w(e),prefs:k(this._prefs),getData:function(t){return"char"===t?this.prefs.locale.map(function(e){return d(e+"/"+t)}).join(""):d(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=g(t.locale,this._prefs.locale);var s=n.locale,u=s[0];if(!s.length||!u)throw Error('Not defined the property "locale".');if(!p(u))throw Error('"'+u+'" 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?x:"")+a.text.slice(s,r)+x),i.push(e),s=r+e.length,e}),i.push(s?x+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,a=t.isHTML,i=new RegExp(x,"g");return t.text=this._splitBySeparateParts(t).map(function(e){return t.text=e,t.isHTML=w(e),n._safeTags.hideHTMLTags(t),n._safeTags.hide(t,"url"),n._executeRules(t,"hide-safe-tags-url"),n._executeRules(t,"hide-safe-tags"),l.toUtf(t),n._prefs.live&&(t.text=E(t.text)),n._executeRules(t,"utf"),n._executeRules(t),l.restore(t),n._executeRules(t,"html-entities"),n._safeTags.show(t,"url"),n._executeRules(t,"show-safe-tags-url"),t.text.replace(i,"")}).join(""),t.isHTML=a,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){var r=e instanceof RegExp?e:[e,t,n];return this._safeTags.add(r),this}},{key:"_executeRules",value:function(t,e){e=e||"default";var n=this._rulesByQueues[e],r=this._innerRulesByQueues[e];r&&r.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;if(!(!0===r&&!1===t.live||!1===r&&!0===t.live)&&("common"===n||n===e.prefs.locale[0])&&this.isEnabledRule(t.name)){if(e.prefs.ruleFilter&&!e.prefs.ruleFilter(t))return;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=k(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,n){if(e)if(-1!==e.search(/\*/)){var r=new RegExp(e.replace(/\//g,"\\/").replace(/\*/g,".*"));this._rules.forEach(function(e){var t=e.name;r.test(t)&&(this._enabledRules[t]=n)},this)}else this._enabledRules[e]=n}},{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=u(e.name.split("/"),3),n=t[0],r=t[1],a=t[2];return e._enabled=!0!==e.disabled,e._locale=n,e._group=r,e._name=a,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=s[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}();q.version="6.11.0",q.addLocale=h,q.getLocales=e,q.hasLocale=p,q.setData=m,q.getData=d,q.deepCopy=k,q.prototype._rules=[],q.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 m(e)});var T=["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"],A={name:"common/html/p",index:"+5",queue:"end",handler:function(e){var r=new RegExp("<("+T.join("|")+")[>\\s]"),t=e.split("\n\n");return t.forEach(function(e,t,n){e.trim()&&(r.test(e)||(n[t]=e.replace(/^(\s*)/,"$1<p>").replace(/(\s*)$/,"</p>$1")))}),t.join("\n\n")},disabled:!0,htmlAttrs:!1},B={name:"common/html/processingAttrs",queue:"hide-safe-tags-own",handler:function(e,t,n){var u=this,r=new RegExp("(^|\\s)("+t.attrs.join("|")+")=(\"[^\"]*?\"|'[^']*?')","gi"),o=k(n.prefs);return o.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],s=r.slice(1,-1);return t+n+"="+a+u.execute(s,o)+i})})},settings:{attrs:["title","placeholder"]},disabled:!0,htmlAttrs:!1},L={name:"common/html/url",queue:"end",handler:function(e,t,n){return n.isHTML?e:e.replace($,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,i='<a href="'+a+'">';return"http"===t||"https"===t?(r=r.replace(/^www\./,""),i+("http"===t?r:t+"://"+r)+"</a>"):i+a+"</a>"})},disabled:!0,htmlAttrs:!1};q.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={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};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},A,B,{name:"common/html/quot",queue:"hide-safe-tags",handler:function(e){return e.replace(/"/g,'"')}},{name:"common/html/stripTags",index:"+99",queue:"end",handler:function(e){return e.replace(/<[^>]+>/g,"")},disabled:!0},L]);var D={name:"common/nbsp/afterNumber",handler:function(e,t,n){var r="(^|\\D)(\\d{1,5}) (["+n.getData("char")+"]+)";return e.replace(new RegExp(r,"gi"),"$1$2\xa0$3")},disabled:!0},S={name:"common/nbsp/afterShortWord",handler:function(e,t,n){var r=t.lengthShortWord,a="(^|["+(" \xa0(\uf000"+d("common/quote"))+"])(["+n.getData("char")+"]{1,"+r+"}) ",i=new RegExp(a,"gim");return e.replace(i,"$1$2\xa0").replace(i,"$1$2\xa0")},settings:{lengthShortWord:2}},I={name:"common/nbsp/beforeShortLastNumber",handler:function(e,t,n){var r=n.getData("char"),a=r.toUpperCase(),i=new RegExp("(["+r+a+"]) (?=\\d{1,"+t.lengthLastNumber+"}[-+\u2212%'\""+n.getData("quote").right+")]?([.!?\u2026]( ["+a+"]|$)|$))","gm");return e.replace(i,"$1\xa0")},live:!1,settings:{lengthLastNumber:2}},z={name:"common/nbsp/beforeShortLastWord",handler:function(e,t,n){var r=n.getData("char"),a=r.toUpperCase(),i=new RegExp("(["+r+"\\d]) (["+r+a+"]{1,"+t.lengthLastWord+"}[.!?\u2026])( ["+a+"]|$)","g");return e.replace(i,"$1\xa0$2$3")},settings:{lengthLastWord:3}};function C(e,t,n,r){return t+n.replace(/([^\u00A0])\u00A0([^\u00A0])/g,"$1 $2")+r}var j={name:"common/nbsp/nowrap",queue:"end",handler:function(e){return e.replace(/(<nowrap>)(.*?)(<\/nowrap>)/g,C).replace(/(<nobr>)(.*?)(<\/nobr>)/g,C)}},P={name:"common/nbsp/replaceNbsp",queue:"utf",live:!1,handler:E,disabled:!0};q.addRules([D,{name:"common/nbsp/afterParagraphMark",handler:function(e){return e.replace(/\xb6 ?(?=\d)/g,"\xb6\xa0")}},{name:"common/nbsp/afterSectionMark",handler:function(e,t,n){var r=n.prefs.locale[0];return e.replace(/\xa7[ \u00A0\u2009]?(?=\d|I|V|X)/g,"ru"===r?"\xa7\u202f":"\xa7\xa0")}},S,I,z,{name:"common/nbsp/dpi",handler:function(e){return e.replace(/(\d) ?(lpi|dpi)(?!\w)/,"$1\xa0$2")}},j,P]);var N={name:"common/number/digitGrouping",index:"310",disabled:!0,handler:function(e,s){return e.replace(new RegExp("(^ ?|\\D |".concat(b,")(\\d{1,3}([ \xa0\u202f\u2009]\\d{3})+)(?! ?[\\d-])"),"gm"),function(e,t,n){return t+n.replace(/\s/g,s.space)}).replace(/(\d{5,}([.,]\d+)?)/g,function(e,t){var n=t.match(/[.,]/),r=u(n?t.split(n):[t],2),a=r[0],i=r[1];return a=a.replace(/(\d)(?=(\d{3})+([^\d]|$))/g,"$1"+s.space),n?a+n+i:a})},settings:{space:"\u202f"}},O={name:"common/number/mathSigns",handler:function(e){return _(e,[[/!=/g,"\u2260"],[/<=/g,"\u2264"],[/(^|[^=])>=/g,"$1\u2265"],[/<=>/g,"\u21d4"],[/<</g,"\u226a"],[/>>/g,"\u226b"],[/~=/g,"\u2245"],[/(^|[^+])\+-/g,"$1\xb1"]])}};q.addRules([N,{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")}},O,{name:"common/number/times",handler:function(e){return e.replace(/(\d)[ \u00A0]?[x\u0445][ \u00A0]?(\d)/g,"$1\xd7$2")}}]);var U={name:"common/other/repeatWord",handler:function(e,t,n){var r="[;:,.?! \n"+d("common/quote")+"]",a=new RegExp("("+r+"|^)(["+n.getData("char")+"]{"+t.min+",}) \\2("+r+"|$)","gi");return e.replace(a,"$1$2$3")},settings:{min:2},disabled:!0};q.addRules([{name:"common/other/delBOM",queue:"start",index:-1,handler:function(e){return 65279===e.charCodeAt(0)?e.slice(1):e}},U]);var M={name:"common/punctuation/apostrophe",handler:function(e,t,n){var r="(["+n.getData("char")+"])",a=new RegExp(r+"'"+r,"gi");return e.replace(a,"$1\u2019$2")}},Q={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=k(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,a=t.right[0];return n!==r?e:e.replace(new RegExp(n+n,"g"),n).replace(new RegExp(a+a,"g"),a)},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"+b+"])","gim"),u=new RegExp("([^\\s\uf000])(["+n+"]{1,"+this.maxLevel+"})(?=["+this.afterRight+"]|$)","gim");return e=e.replace(s,function(e,t,n){return t+R(r,n.length)}).replace(u,function(e,t,n){return t+R(i,n.length)}),e=this.setAboveTags(e,t),r!==a&&(e=this.setInner(e,t.settings)),e},setAboveTags:function(l,c){var h=this,e=d("common/quote"),p=c.settings.left[0],g=c.settings.right[0];return l.replace(new RegExp("(^|.)(["+e+"])(.|$)","gm"),function(e,t,n,r,a){if(t!==b&&r!==b)return e;if(t===b&&r===b)return'"'===n?t+h.getAboveTwoTags(l,a+1,c)+r:e;if(t===b){var i=-1<h.afterRight.indexOf(r),s=h.getPrevTagInfo(l,a-1,c);return i&&s&&"html"===s.group?t+(s.isClosing?g:p)+r:t+(!r||i?g:p)+r}var u=-1<h.beforeLeft.indexOf(t),o=h.getNextTagInfo(l,a+1,c);return u&&o&&"html"===o.group?t+(o.isClosing?g:p)+r:t+(!t||u?p:g)+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){var r=n.safeTags.getPrevLabel(e,t-1);if(r){var a=n.safeTags.getTagByLabel(n.context,r);if(a)return n.safeTags.getTagInfo(a)}return null},getNextTagInfo:function(e,t,n){var r=n.safeTags.getNextLabel(e,t+1);if(r){var a=n.safeTags.getTagByLabel(n.context,r);if(a)return n.safeTags.getTagInfo(a)}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}},H={name:"common/punctuation/quote",handler:function(e,t,n){var r=t[n.prefs.locale[0]];return r?Q.process({context:n,settings:r,safeTags:this._safeTags}):e},settings:function(){var t={};return e().forEach(function(e){t[e]=k(d(e+"/quote"))}),t}},F={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=l.getByUtf(r.left[0]),i=l.getByUtf(r.right[0]),s=l.getByUtf(r.left[1]),u=l.getByUtf(r.right[1]);s=s?"|"+s:"",u=u?"|"+u:"";var o=new RegExp("(<[aA]\\s[^>]*?>)("+a+s+")([^]*?)("+i+u+")(</[aA]>)","g");return e.replace(o,"$2$1$3$5$4")}};q.addRules([M,{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")}},H,F]);var G={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")}},W={name:"common/space/beforeBracket",handler:function(e,t,n){var r=new RegExp("(["+n.getData("char")+".!?,;\u2026)])\\(","gi");return e.replace(r,"$1 (")}},X={name:"common/space/delRepeatN",index:"-1",handler:function(e,t){var n=t.maxConsecutiveLineBreaks,r=new RegExp("\n{".concat(n+1,",}"),"g"),a=R("\n",n);return e.replace(r,a)},settings:{maxConsecutiveLineBreaks:2}},V={name:"common/space/trimLeft",index:"-4",handler:String.prototype.trimLeft?function(e){return e.trimLeft()}:function(e){return e.replace(/^[\s\uFEFF\xA0]+/g,"")}},K={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,"")}};q.addRules([G,W,{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},X,{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,"]")}},V,K]);var Y={name:"common/symbols/arrow",handler:function(e){return _(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")}},J={name:"common/symbols/copy",handler:function(e){return _(e,[[/\(r\)/gi,"\xae"],[/(copyright )?\((c|\u0441)\)/gi,"\xa9"],[/\(tm\)/gi,"\u2122"]])}};q.addRules([Y,Z,J]);var ee={name:"en-US/dash/main",index:"-5",handler:function(e){var t=d("common/dash"),n="[ ".concat("\xa0","]"),r="[ ".concat("\xa0","\n]"),a=new RegExp("".concat(n,"(").concat(t,")(").concat(r,")"),"g");return e.replace(a,"".concat("\xa0").concat("\u2014","$2"))}};q.addRules([ee]);var te={name:"ru/dash/centuries",handler:function(e,t){var n="("+d("common/dash")+")",r=new RegExp("(X|I|V)[ |\xa0]?"+n+"[ |\xa0]?(X|I|V)","g");return e.replace(r,"$1"+t.dash+"$3")},settings:{dash:"\u2013"}},ne={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"}},re={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},ae={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"}},ie={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(b,")(").concat(t,")( |\xa0)"),"gm"),a=new RegExp("([.\u2026?!])[ \xa0](".concat(t,")[ \xa0]"),"g");return e.replace(n,"$1\xa0\u2014 ").replace(r,"$1\u2014\xa0").replace(a,"$1 \u2014\xa0")}},se={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")}},ue={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")}},oe={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")}},le={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")}},ce={name:"ru/dash/main",index:"-5",handler:function(e){var t=d("common/dash"),n=new RegExp("([ \xa0])("+t+")([ \xa0\\n])","g");return e.replace(n,"\xa0\u2014$3")}},he={name:"ru/dash/month",handler:function(e,t){var n="("+d("ru/month")+")",r="("+d("ru/monthPreCase")+")",a=d("common/dash"),i=new RegExp(n+" ?("+a+") ?"+n,"gi"),s=new RegExp(r+" ?("+a+") ?"+r,"gi"),u="$1"+t.dash+"$3";return e.replace(i,u).replace(s,u)},settings:{dash:"\u2013"}},pe={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")}},ge={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")}},fe={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"}},de={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")}},me={name:"ru/dash/weekday",handler:function(e,t){var n="("+d("ru/weekday")+")",r=new RegExp(n+" ?("+d("common/dash")+") ?"+n,"gi");return e.replace(r,"$1"+t.dash+"$3")},settings:{dash:"\u2013"}},ve={name:"ru/dash/years",handler:function(e,i){var t=d("common/dash"),n=new RegExp("(\\D|^)(\\d{4})[ \xa0]?("+t+")[ \xa0]?(\\d{4})(?=[ \xa0]?\u0433)","g");return e.replace(n,function(e,t,n,r,a){return parseInt(n,10)<parseInt(a,10)?t+n+i.dash+a:e})},settings:{dash:"\u2013"}};q.addRules([te,ne,re,ae,ie,se,ue,oe,le,ce,he,pe,ge,fe,de,me,ve]);var $e={name:"ru/date/fromISO",handler:function(e){var t="(-|\\.|\\/)",n="(-|\\/)",r=new RegExp("(^|\\D)(\\d{4})"+t+"(\\d{2})"+t+"(\\d{2})(\\D|$)","gi"),a=new RegExp("(^|\\D)(\\d{2})"+n+"(\\d{2})"+n+"(\\d{4})(\\D|$)","gi");return e.replace(r,"$1$6.$4.$2$7").replace(a,"$1$4.$2.$6$7")}},be={name:"ru/date/weekday",handler:function(e){var t=d("ru/monthGenCase"),n=d("ru/weekday"),r=new RegExp("(\\d)( |\xa0)("+t+"),( |\xa0)("+n+")","gi");return e.replace(r,function(){var e=arguments;return e[1]+e[2]+e[3].toLowerCase()+","+e[4]+e[5].toLowerCase()})}};q.addRules([$e,be]);var xe={name:"ru/money/currency",handler:function(e){var t="([$\u20ac\xa5\u04b0\xa3\u20a4\u20bd])",n=new RegExp("(^|[\\D]{2})"+t+" ?([\\d.,]+([ \xa0\u2009\u202f]\\d{3})*)([ \xa0\u2009\u202f]?(\u0442\u044b\u0441\\.|\u043c\u043b\u043d|\u043c\u043b\u0440\u0434|\u0442\u0440\u043b\u043d))?","gm"),r=new RegExp("(^|[\\D])([\\d.,]+) ?"+t,"gm");return e.replace(n,function(e,t,n,r,a,i,s){return t+r+(s?"\xa0"+s:"")+"\xa0"+n}).replace(r,"$1$2\xa0$3")},disabled:!0},ye={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"),i=new RegExp(n+"(?=\\s+[A-\u042f\u0401])","g");return e.replace(r,t).replace(a,t).replace(i,t+".")},disabled:!0};q.addRules([xe,ye]);var Re={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(b,")([\u0430-\u044f\u0451]{1,3})\\. ?([\u0430-\u044f\u0451]{1,3})\\."),"g");return e.replace(n,t).replace(n,t)}},Ee={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"),r=new RegExp("([\u0410-\u042f\u0401\u0430-\u044f\u0451])[ \xa0]"+t+"[ \xa0]","g");return e.replace(n,"$1\xa0$2").replace(r,"$1\xa0$2 ")}},_e={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"),i=new RegExp(n+"("+t+")([VIX]+)[ \xa0]?\u0432\\.?([ \xa0]?\u0432\\.?)?"+r,"gm");return e.replace(a,"$1$2\xa0\u0432.").replace(i,"$1$2$3$4\xa0\u0432\u0432.")}},we={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")}},ke={name:"ru/nbsp/initials",handler:function(e){var t=d("ru/quote"),n=new RegExp("(^|[\xa0\u202f "+t.left+b+'"])([\u0410-\u042f\u0401])\\.[\xa0\u202f ]?([\u0410-\u042f\u0401])\\.[\xa0\u202f ]?([\u0410-\u042f\u0401][\u0430-\u044f\u0451]+)(?=[\\s.,;:?!"'+t.right+"]|$)","gm");return e.replace(n,"$1$2.\xa0$3.\xa0$4")}},qe={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)})}},Te={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")}},Ae={name:"ru/nbsp/ps",handler:function(e){var t=new RegExp("(^|\\s|".concat(b,")[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. ")})}},Be={name:"ru/nbsp/see",handler:function(e){var t=new RegExp("(^|\\s|".concat(b,"|\\()(\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})}},Le={name:"ru/nbsp/years",index:"+5",handler:function(e){var t=d("common/dash"),n=new RegExp("(^|\\D)(\\d{4})("+t+')(\\d{4})[ \xa0]?\u0433\\.?([ \xa0]?\u0433\\.)?(?=[,;:?!"\u2018\u201c\xbb\\s]|$)',"gm");return e.replace(n,"$1$2$3$4\xa0\u0433\u0433.")}};q.addRules([Re,{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")}},Ee,_e,we,ke,qe,{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")}},Te,Ae,{name:"ru/nbsp/rubleKopek",handler:function(e){return e.replace(/(\d) ?(?=(\u0440\u0443\u0431|\u043a\u043e\u043f)\.)/g,"$1\xa0")}},Be,{name:"ru/nbsp/year",handler:function(e){return e.replace(/(^|\D)(\d{4}) ?\u0433([ ,;.\n]|$)/g,"$1$2\xa0\u0433$3")}},Le]);var De={name:"ru/number/ordinals",handler:function(e,t,n){var r=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(r,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 Se(e,t){var n=new RegExp('<span class="('+t.join("|")+')">([^]*?)</span>',"g");return e.replace(n,"$2")}function Ie(e,t){return e.replace(/<title>[^]*?<\/title>/i,function(e){return Se(e,t)})}q.addRules([{name:"ru/number/comma",handler:function(e){return e.replace(/(^|\s)(\d+)\.(\d+[\u00A0\u2009\u202F ]*?[%\u2030\xb0\xd7x])/gim,"$1$2,$3")}},De]);var ze=["typograf-oa-lbracket","typograf-oa-n-lbracket","typograf-oa-sp-lbracket"],Ce="ru/optalign/bracket",je={name:Ce,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},Pe={name:Ce,queue:"start",handler:function(e){return Se(e,ze)}},Ne={name:Ce,queue:"end",handler:function(e){return Ie(e,ze)}},Oe=["typograf-oa-comma","typograf-oa-comma-sp"],Ue="ru/optalign/comma",Me={name:Ue,handler:function(e,t,n){var r=new RegExp("(["+n.getData("char")+"\\d\u0301]+), ","gi");return e.replace(r,'$1<span class="typograf-oa-comma">,</span><span class="typograf-oa-comma-sp"> </span>')},disabled:!0,htmlAttrs:!1},Qe={name:Ue,queue:"start",handler:function(e){return Se(e,Oe)}},He={name:Ue,queue:"end",handler:function(e){return Ie(e,Oe)}},Fe=["typograf-oa-lquote","typograf-oa-n-lquote","typograf-oa-sp-lquote"],Ge="ru/optalign/quote",We={name:Ge,handler:function(e){var t=this.getSetting("common/punctuation/quote","ru"),n="(["+t.left[0]+(t.left[1]||"")+"])",r=new RegExp("(^|\n\n|\uf000)("+n+")","g"),a=new RegExp("([^\n\uf000])([ \xa0\n])("+n+")","gi");return e.replace(r,'$1<span class="typograf-oa-n-lquote">$2</span>').replace(a,'$1<span class="typograf-oa-sp-lquote">$2</span><span class="typograf-oa-lquote">$3</span>')},disabled:!0,htmlAttrs:!1},Xe={name:Ge,queue:"start",handler:function(e){return Se(e,Fe)}},Ve={name:Ge,queue:"end",handler:function(e){return Ie(e,Fe)}};q.addRules([je,Me,We]),q.addInnerRules([Pe,Ne,Qe,He,Xe,Ve]);var Ke=[];function Ye(e){var t,n,r=e[0],a="";if(e.length<8)return Ze(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<Ke.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"+Ze(e)}function Ze(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 Je(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++)Ke.push(n);else Ke.push(e)});var et={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){var r=Je(n);return 12===r.length?t+Ye(r):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){var i=Je(a);return 5<=i.length?t+n+r+Ye(i):e})}};q.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},et]);var tt={name:"ru/punctuation/ano",handler:function(e){var t=new RegExp("([^!?,:;\\-\u2012\u2013\u2014\\s])(\\s+)(\u0430|\u043d\u043e)(?= |\xa0|\\n)","g");return e.replace(t,"$1,$2$3")},queue:"hide-safe-tags-html"},nt={name:"ru/punctuation/exclamationQuestion",index:"+5",handler:function(e){var t=new RegExp("(^|[^!])!\\?([^?]|$)","g");return e.replace(t,"$1?!$2")}};q.addRules([tt,{name:"ru/punctuation/exclamation",live:!1,handler:function(e){return e.replace(/(^|[^!])!{2}($|[^!])/gm,"$1!$2").replace(/(^|[^!])!{4}($|[^!])/gm,"$1!!!$2")}},nt,{name:"ru/punctuation/hellipQuestion",handler:function(e){return e.replace(/(^|[^.])(\.\.\.|\u2026),/g,"$1\u2026").replace(/(!|\?)(\.\.\.|\u2026)(?=[^.]|$)/g,"$1..")}}]);var rt={name:"ru/space/year",handler:function(e,t,n){var r=new RegExp("(^| |\xa0)(\\d{3,4})(\u0433\u043e\u0434([\u0430\u0443\u0435]|\u043e\u043c)?)([^"+n.getData("char")+"]|$)","g");return e.replace(r,"$1$2 $3$5")}};q.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")}},rt]);q.addRules([{name:"ru/symbols/NN",handler:function(e){return e.replace(/\u2116\u2116/g,"\u2116")}}]);var at={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"},it=Object.keys(at).join(""),st={name:"ru/typo/switchingKeyboardLayout",handler:function(e){var t=new RegExp("(["+it+"]{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+=at[t[r]];return n})}};return q.addRules([st]),q}); \ No newline at end of file diff --git a/assets/components/tinymcerte/js/vendor/tinymce/plugins/typograf/dist/typograf.titles.js b/assets/components/tinymcerte/js/vendor/tinymce/plugins/typograf/dist/typograf.titles.js new file mode 100644 index 0000000..14080ce --- /dev/null +++ b/assets/components/tinymcerte/js/vendor/tinymce/plugins/typograf/dist/typograf.titles.js @@ -0,0 +1,381 @@ +export default { + "common/html/e-mail": { + "en-US": "Placement of links for e-mail", + "ru": "Расстановка ссылок для эл. почты" + }, + "common/html/escape": { + "en-US": "Escaping HTML", + "ru": "Экранирование HTML" + }, + "common/html/nbr": { + "en-US": "Replacement line break on <br/>", + "ru": "Замена перевода строки на <br/>" + }, + "common/html/p": { + "en-US": "Placement of paragraph", + "ru": "Расстановка абзацев" + }, + "common/html/processingAttrs": { + "en-US": "Processing HTML attributes", + "ru": "Типографирование HTML-атрибутов" + }, + "common/html/quot": { + "common": "&⁠quot; → \"" + }, + "common/html/stripTags": { + "en-US": "Removing HTML-tags", + "ru": "Удаление HTML-тегов" + }, + "common/html/url": { + "en-US": "Placement of links", + "ru": "Расстановка ссылок" + }, + "common/nbsp/afterNumber": { + "en-US": "Non-breaking space between number and word", + "ru": "Нераз. пробел между числом и словом" + }, + "common/nbsp/afterParagraphMark": { + "en-US": "Non-breaking space after ¶", + "ru": "Нераз. пробел после ¶" + }, + "common/nbsp/afterSectionMark": { + "en-US": "Non-breaking space after §", + "ru": "Нераз. узкий пробел после §" + }, + "common/nbsp/afterShortWord": { + "en-US": "Non-breaking space after short word", + "ru": "Нераз. пробел после короткого слова" + }, + "common/nbsp/beforeShortLastNumber": { + "en-US": "Non-breaking space before number (maximum 2 digits) at end of sentence", + "ru": "Нераз. пробел перед числом (не более 2 цифр) в конце предложения" + }, + "common/nbsp/beforeShortLastWord": { + "en-US": "Non-breaking space before last short word in sentence", + "ru": "Нераз. пробел перед последним коротким словом в предложении" + }, + "common/nbsp/dpi": { + "en-US": "Non-breaking space before lpi and dpi", + "ru": "Нераз. пробел перед lpi и dpi" + }, + "common/nbsp/nowrap": { + "en-US": "Replace non-breaking space to normal space in tags nowrap and nobr", + "ru": "Заменять нераз. пробел на обычный пробел в тегах nowrap и nobr" + }, + "common/nbsp/replaceNbsp": { + "en-US": "Replacing non-breaking space on normal before text correction", + "ru": "Замена неразрывного пробела на обычный перед типографированием" + }, + "common/number/digitGrouping": { + "en-US": "Divide into groups numbers with many digits", + "ru": "Разбивать длинные числа по разрядам" + }, + "common/number/fraction": { + "common": "1/2 → ½, 1/4 → ¼, 3/4 → ¾" + }, + "common/number/mathSigns": { + "common": "!= → ≠, <= → ≤, >= → ≥, ~= → ≅, +- → ±" + }, + "common/number/times": { + "common": "x → × (10 x 5 → 10×5)" + }, + "common/other/delBOM": { + "en-US": "Delete character BOM (Byte Order Mark)", + "ru": "Удаление символа BOM (Byte Order Mark)" + }, + "common/other/repeatWord": { + "en-US": "Removing repeat words", + "ru": "Удаление повтора слова" + }, + "common/punctuation/apostrophe": { + "en-US": "Placement of correct apostrophe", + "ru": "Расстановка правильного апострофа" + }, + "common/punctuation/delDoublePunctuation": { + "en-US": "Removing double punctuation", + "ru": "Удаление двойной пунктуации" + }, + "common/punctuation/hellip": { + "en-US": "Replacement of three points by ellipsis", + "ru": "Замена трёх точек на многоточие" + }, + "common/punctuation/quote": { + "en-US": "Placement of quotation marks in texts", + "ru": "Расстановка кавычек правильного вида" + }, + "common/punctuation/quoteLink": { + "en-US": "Removal quotes outside a link", + "ru": "Вынос кавычек за пределы ссылки" + }, + "common/space/afterPunctuation": { + "en-US": "space after punctuation", + "ru": "Пробел после знаков пунктуации" + }, + "common/space/beforeBracket": { + "en-US": "Space before opening bracket", + "ru": "Пробел перед открывающей скобкой" + }, + "common/space/bracket": { + "en-US": "Remove extra spaces after opening and before closing bracket", + "ru": "Удаление лишних пробелов после открывающей и перед закрывающей скобкой" + }, + "common/space/delBeforePercent": { + "en-US": "Remove space before %, ‰ and ‱", + "ru": "Удаление пробела перед %, ‰ и ‱" + }, + "common/space/delBeforePunctuation": { + "en-US": "Remove spaces before punctuation", + "ru": "Удаление пробелов перед знаками пунктуации" + }, + "common/space/delLeadingBlanks": { + "en-US": "Remove spaces at start of line", + "ru": "Удаление пробелов в начале строки" + }, + "common/space/delRepeatN": { + "en-US": "Remove duplicate line breaks", + "ru": "Удаление повторяющихся переносов строки" + }, + "common/space/delRepeatSpace": { + "en-US": "Removing duplicate spaces between characters", + "ru": "Удаление повторяющихся пробелов между символами" + }, + "common/space/delTrailingBlanks": { + "en-US": "Remove spaces at end of line", + "ru": "Удаление пробелов в конце строки" + }, + "common/space/insertFinalNewline": { + "en-US": "Insert final newline", + "ru": "Вставить в конце текста перевод строки" + }, + "common/space/replaceTab": { + "en-US": "Replacement of tab to 4 spaces", + "ru": "Замена таба на 4 пробела" + }, + "common/space/squareBracket": { + "en-US": "Remove extra spaces after opening and before closing square bracket", + "ru": "Удаление лишних пробелов после открывающей и перед закрывающей квадратной скобкой" + }, + "common/space/trimLeft": { + "en-US": "Remove spaces and line breaks in beginning of text", + "ru": "Удаление пробелов и переносов строк в начале текста" + }, + "common/space/trimRight": { + "en-US": "Remove spaces and line breaks at end of text", + "ru": "Удаление пробелов и переносов строк в конце текста" + }, + "common/symbols/arrow": { + "common": "-> → →, <- → ←" + }, + "common/symbols/cf": { + "en-US": "Adding ° to C and F", + "ru": "Добавление ° к C и F" + }, + "common/symbols/copy": { + "common": "(c) → ©, (tm) → ™, (r) → ®" + }, + "en-US/dash/main": { + "en-US": "Replace hyphens surrounded by spaces with an em-dash", + "ru": "Замена дефиса на длинное тире" + }, + "ru/dash/centuries": { + "en-US": "Hyphen to dash in centuries", + "ru": "Замена дефиса на тире в веках" + }, + "ru/dash/daysMonth": { + "en-US": "Dash between days of one month", + "ru": "Тире между днями одного месяца" + }, + "ru/dash/de": { + "en-US": "Hyphen before “де”", + "ru": "Дефис перед «де»" + }, + "ru/dash/decade": { + "en-US": "Dash in decade", + "ru": "Тире в десятилетиях, 80—90-е гг." + }, + "ru/dash/directSpeech": { + "en-US": "Dash in direct speech", + "ru": "Тире в прямой речи" + }, + "ru/dash/izpod": { + "en-US": "Hyphen between “из-под”", + "ru": "Дефис между «из-под»" + }, + "ru/dash/izza": { + "en-US": "Hyphen between “из-за”", + "ru": "Дефис между «из-за»" + }, + "ru/dash/ka": { + "en-US": "Hyphen before “ка” and “кась”", + "ru": "Дефис перед «ка» и «кась»" + }, + "ru/dash/koe": { + "en-US": "Hyphen after “кое” and “кой”", + "ru": "Дефис после «кое» и «кой»" + }, + "ru/dash/main": { + "en-US": "Replacement hyphen with dash", + "ru": "Замена дефиса на тире" + }, + "ru/dash/month": { + "en-US": "Dash between months", + "ru": "Тире между месяцами" + }, + "ru/dash/surname": { + "en-US": "Acronyms with a dash", + "ru": "Сокращения с помощью тире" + }, + "ru/dash/taki": { + "en-US": "Hyphen between “верно-таки” and etc.", + "ru": "Дефис между «верно-таки» и т. д." + }, + "ru/dash/time": { + "en-US": "Dash in time intervals", + "ru": "Тире в интервалах времени" + }, + "ru/dash/to": { + "en-US": "Hyphen before “то”, “либо”, “нибудь”", + "ru": "Дефис перед «то», «либо», «нибудь»" + }, + "ru/dash/weekday": { + "en-US": "Dash between the days of the week", + "ru": "Тире между днями недели" + }, + "ru/dash/years": { + "en-US": "Hyphen to dash in years", + "ru": "Замена дефиса на тире в годах" + }, + "ru/date/fromISO": { + "en-US": "Converting dates YYYY-MM-DD type DD.MM.YYYY", + "ru": "Преобразование дат YYYY-MM-DD к виду DD.MM.YYYY" + }, + "ru/date/weekday": { + "common": "2 Мая, Понедельник → 2 мая, понедельник" + }, + "ru/money/currency": { + "en-US": "Currency symbol ($, €, ¥, Ұ, £ and ₤) after the number, $100 → 100 $", + "ru": "Символ валюты ($, €, ¥, Ұ, £ и ₤) после числа, $100 → 100 $" + }, + "ru/money/ruble": { + "common": "1 руб. → 1 ₽" + }, + "ru/nbsp/abbr": { + "en-US": "Non-breaking space in abbreviations, e.g. “т. д.”", + "ru": "Нераз. пробел в сокращениях, например, в «т. д.»" + }, + "ru/nbsp/addr": { + "en-US": "Placement of non-breaking space after “г.”, “обл.”, “ул.”, “пр.”, “кв.” et al.", + "ru": "Расстановка нераз. пробела после «г.», «обл.», «ул.», «пр.», «кв.» и др." + }, + "ru/nbsp/afterNumberSign": { + "en-US": "Non-breaking thin space after №", + "ru": "Нераз. узкий пробел после №" + }, + "ru/nbsp/beforeParticle": { + "en-US": "Non-breaking space before “ли”, “ль”, “же”, “бы”, “б”", + "ru": "Нераз. пробел перед «ли», «ль», «же», «бы», «б»" + }, + "ru/nbsp/centuries": { + "en-US": "Remove spaces and extra points in “вв.”", + "ru": "Удаление пробелов и лишних точек в «вв.»" + }, + "ru/nbsp/dayMonth": { + "en-US": "Non-breaking space between number and month", + "ru": "Нераз. пробел между числом и месяцем" + }, + "ru/nbsp/initials": { + "en-US": "Binding of initials to the name", + "ru": "Привязка инициалов к фамилии" + }, + "ru/nbsp/m": { + "en-US": "m2 → м², m3 → м³ and non-breaking space", + "ru": "м2 → м², м3 → м³ и нераз. пробел" + }, + "ru/nbsp/mln": { + "en-US": "Non-breaking space between number and “тыс.”, “млн”, “млрд” and “трлн”", + "ru": "Неразр. пробел между числом и «тыс.», «млн», «млрд» и «трлн»" + }, + "ru/nbsp/ooo": { + "en-US": "Non-breaking space after “OOO, ОАО, ЗАО, НИИ, ПБОЮЛ”", + "ru": "Нераз. пробел после OOO, ОАО, ЗАО, НИИ и ПБОЮЛ" + }, + "ru/nbsp/page": { + "en-US": "Non-breaking space after “стр.”, “гл.”, “рис.”, “илл.”", + "ru": "Нераз. пробел после «стр.», «гл.», «рис.», «илл.»" + }, + "ru/nbsp/ps": { + "en-US": "Non-breaking space in P. S. and P. P. S.", + "ru": "Нераз. пробел в P. S. и P. P. S." + }, + "ru/nbsp/rubleKopek": { + "en-US": "Not once. space before the “rub” and “cop.”", + "ru": "Нераз. пробел перед «руб.» и «коп.»" + }, + "ru/nbsp/see": { + "en-US": "Non-breaking space after abbreviation «см.» and «им.»", + "ru": "Нераз. пробел после сокращений «см.» и «им.»" + }, + "ru/nbsp/year": { + "en-US": "Non-breaking space before XXXX г. (2012 г.)", + "ru": "Нераз. пробел после XXXX г. (2012 г.)" + }, + "ru/nbsp/years": { + "en-US": "г.г. → гг. and non-breaking space", + "ru": "г.г. → гг. и нераз. пробел" + }, + "ru/number/comma": { + "en-US": "Commas in numbers", + "ru": "Замена точки на запятую в числах" + }, + "ru/number/ordinals": { + "common": "N-ый, -ой, -ая, -ое, -ые, -ым, -ом, -ых → N-й, -я, -е, -м, -х (25-й)" + }, + "ru/optalign/bracket": { + "en-US": "for opening bracket", + "ru": "для открывающей скобки" + }, + "ru/optalign/comma": { + "en-US": "for comma", + "ru": "для запятой" + }, + "ru/optalign/quote": { + "en-US": "for opening quotation marks", + "ru": "для открывающей кавычки" + }, + "ru/other/accent": { + "en-US": "Replacement capital letters to lowercase with addition of accent", + "ru": "Замена заглавной буквы на строчную с добавлением ударения" + }, + "ru/other/phone-number": { + "en-US": "Formatting phone numbers", + "ru": "Форматирование телефонных номеров" + }, + "ru/punctuation/ano": { + "en-US": "Placement of commas before “а” and “но”", + "ru": "Расстановка запятых перед «а» и «но»" + }, + "ru/punctuation/exclamation": { + "common": "!! → !" + }, + "ru/punctuation/exclamationQuestion": { + "common": "!? → ?!" + }, + "ru/punctuation/hellipQuestion": { + "common": "«?…» → «?..», «!…» → «!..», «…,» → «…»" + }, + "ru/space/afterHellip": { + "en-US": "Space after “...”, “!..” and “?..”", + "ru": "Пробел после «...», «!..» и «?..»" + }, + "ru/space/year": { + "en-US": "Space between number and word “год”", + "ru": "Пробел между числом и словом «год»" + }, + "ru/symbols/NN": { + "common": "№№ → №" + }, + "ru/typo/switchingKeyboardLayout": { + "en-US": "Replacement of Latin letters in Russian. Typos occur when you switch keyboard layouts", + "ru": "Замена латинских букв на русские. Опечатки, возникающие при переключении клавиатурной раскладки" + } +}; diff --git a/assets/components/tinymcerte/js/vendor/tinymce/plugins/typograf/dist/typograf.titles.json b/assets/components/tinymcerte/js/vendor/tinymce/plugins/typograf/dist/typograf.titles.json new file mode 100644 index 0000000..01223fc --- /dev/null +++ b/assets/components/tinymcerte/js/vendor/tinymce/plugins/typograf/dist/typograf.titles.json @@ -0,0 +1,381 @@ +{ + "common/html/e-mail": { + "en-US": "Placement of links for e-mail", + "ru": "Расстановка ссылок для эл. почты" + }, + "common/html/escape": { + "en-US": "Escaping HTML", + "ru": "Экранирование HTML" + }, + "common/html/nbr": { + "en-US": "Replacement line break on <br/>", + "ru": "Замена перевода строки на <br/>" + }, + "common/html/p": { + "en-US": "Placement of paragraph", + "ru": "Расстановка абзацев" + }, + "common/html/processingAttrs": { + "en-US": "Processing HTML attributes", + "ru": "Типографирование HTML-атрибутов" + }, + "common/html/quot": { + "common": "&⁠quot; → \"" + }, + "common/html/stripTags": { + "en-US": "Removing HTML-tags", + "ru": "Удаление HTML-тегов" + }, + "common/html/url": { + "en-US": "Placement of links", + "ru": "Расстановка ссылок" + }, + "common/nbsp/afterNumber": { + "en-US": "Non-breaking space between number and word", + "ru": "Нераз. пробел между числом и словом" + }, + "common/nbsp/afterParagraphMark": { + "en-US": "Non-breaking space after ¶", + "ru": "Нераз. пробел после ¶" + }, + "common/nbsp/afterSectionMark": { + "en-US": "Non-breaking space after §", + "ru": "Нераз. узкий пробел после §" + }, + "common/nbsp/afterShortWord": { + "en-US": "Non-breaking space after short word", + "ru": "Нераз. пробел после короткого слова" + }, + "common/nbsp/beforeShortLastNumber": { + "en-US": "Non-breaking space before number (maximum 2 digits) at end of sentence", + "ru": "Нераз. пробел перед числом (не более 2 цифр) в конце предложения" + }, + "common/nbsp/beforeShortLastWord": { + "en-US": "Non-breaking space before last short word in sentence", + "ru": "Нераз. пробел перед последним коротким словом в предложении" + }, + "common/nbsp/dpi": { + "en-US": "Non-breaking space before lpi and dpi", + "ru": "Нераз. пробел перед lpi и dpi" + }, + "common/nbsp/nowrap": { + "en-US": "Replace non-breaking space to normal space in tags nowrap and nobr", + "ru": "Заменять нераз. пробел на обычный пробел в тегах nowrap и nobr" + }, + "common/nbsp/replaceNbsp": { + "en-US": "Replacing non-breaking space on normal before text correction", + "ru": "Замена неразрывного пробела на обычный перед типографированием" + }, + "common/number/digitGrouping": { + "en-US": "Divide into groups numbers with many digits", + "ru": "Разбивать длинные числа по разрядам" + }, + "common/number/fraction": { + "common": "1/2 → ½, 1/4 → ¼, 3/4 → ¾" + }, + "common/number/mathSigns": { + "common": "!= → ≠, <= → ≤, >= → ≥, ~= → ≅, +- → ±" + }, + "common/number/times": { + "common": "x → × (10 x 5 → 10×5)" + }, + "common/other/delBOM": { + "en-US": "Delete character BOM (Byte Order Mark)", + "ru": "Удаление символа BOM (Byte Order Mark)" + }, + "common/other/repeatWord": { + "en-US": "Removing repeat words", + "ru": "Удаление повтора слова" + }, + "common/punctuation/apostrophe": { + "en-US": "Placement of correct apostrophe", + "ru": "Расстановка правильного апострофа" + }, + "common/punctuation/delDoublePunctuation": { + "en-US": "Removing double punctuation", + "ru": "Удаление двойной пунктуации" + }, + "common/punctuation/hellip": { + "en-US": "Replacement of three points by ellipsis", + "ru": "Замена трёх точек на многоточие" + }, + "common/punctuation/quote": { + "en-US": "Placement of quotation marks in texts", + "ru": "Расстановка кавычек правильного вида" + }, + "common/punctuation/quoteLink": { + "en-US": "Removal quotes outside a link", + "ru": "Вынос кавычек за пределы ссылки" + }, + "common/space/afterPunctuation": { + "en-US": "space after punctuation", + "ru": "Пробел после знаков пунктуации" + }, + "common/space/beforeBracket": { + "en-US": "Space before opening bracket", + "ru": "Пробел перед открывающей скобкой" + }, + "common/space/bracket": { + "en-US": "Remove extra spaces after opening and before closing bracket", + "ru": "Удаление лишних пробелов после открывающей и перед закрывающей скобкой" + }, + "common/space/delBeforePercent": { + "en-US": "Remove space before %, ‰ and ‱", + "ru": "Удаление пробела перед %, ‰ и ‱" + }, + "common/space/delBeforePunctuation": { + "en-US": "Remove spaces before punctuation", + "ru": "Удаление пробелов перед знаками пунктуации" + }, + "common/space/delLeadingBlanks": { + "en-US": "Remove spaces at start of line", + "ru": "Удаление пробелов в начале строки" + }, + "common/space/delRepeatN": { + "en-US": "Remove duplicate line breaks", + "ru": "Удаление повторяющихся переносов строки" + }, + "common/space/delRepeatSpace": { + "en-US": "Removing duplicate spaces between characters", + "ru": "Удаление повторяющихся пробелов между символами" + }, + "common/space/delTrailingBlanks": { + "en-US": "Remove spaces at end of line", + "ru": "Удаление пробелов в конце строки" + }, + "common/space/insertFinalNewline": { + "en-US": "Insert final newline", + "ru": "Вставить в конце текста перевод строки" + }, + "common/space/replaceTab": { + "en-US": "Replacement of tab to 4 spaces", + "ru": "Замена таба на 4 пробела" + }, + "common/space/squareBracket": { + "en-US": "Remove extra spaces after opening and before closing square bracket", + "ru": "Удаление лишних пробелов после открывающей и перед закрывающей квадратной скобкой" + }, + "common/space/trimLeft": { + "en-US": "Remove spaces and line breaks in beginning of text", + "ru": "Удаление пробелов и переносов строк в начале текста" + }, + "common/space/trimRight": { + "en-US": "Remove spaces and line breaks at end of text", + "ru": "Удаление пробелов и переносов строк в конце текста" + }, + "common/symbols/arrow": { + "common": "-> → →, <- → ←" + }, + "common/symbols/cf": { + "en-US": "Adding ° to C and F", + "ru": "Добавление ° к C и F" + }, + "common/symbols/copy": { + "common": "(c) → ©, (tm) → ™, (r) → ®" + }, + "en-US/dash/main": { + "en-US": "Replace hyphens surrounded by spaces with an em-dash", + "ru": "Замена дефиса на длинное тире" + }, + "ru/dash/centuries": { + "en-US": "Hyphen to dash in centuries", + "ru": "Замена дефиса на тире в веках" + }, + "ru/dash/daysMonth": { + "en-US": "Dash between days of one month", + "ru": "Тире между днями одного месяца" + }, + "ru/dash/de": { + "en-US": "Hyphen before “де”", + "ru": "Дефис перед «де»" + }, + "ru/dash/decade": { + "en-US": "Dash in decade", + "ru": "Тире в десятилетиях, 80—90-е гг." + }, + "ru/dash/directSpeech": { + "en-US": "Dash in direct speech", + "ru": "Тире в прямой речи" + }, + "ru/dash/izpod": { + "en-US": "Hyphen between “из-под”", + "ru": "Дефис между «из-под»" + }, + "ru/dash/izza": { + "en-US": "Hyphen between “из-за”", + "ru": "Дефис между «из-за»" + }, + "ru/dash/ka": { + "en-US": "Hyphen before “ка” and “кась”", + "ru": "Дефис перед «ка» и «кась»" + }, + "ru/dash/koe": { + "en-US": "Hyphen after “кое” and “кой”", + "ru": "Дефис после «кое» и «кой»" + }, + "ru/dash/main": { + "en-US": "Replacement hyphen with dash", + "ru": "Замена дефиса на тире" + }, + "ru/dash/month": { + "en-US": "Dash between months", + "ru": "Тире между месяцами" + }, + "ru/dash/surname": { + "en-US": "Acronyms with a dash", + "ru": "Сокращения с помощью тире" + }, + "ru/dash/taki": { + "en-US": "Hyphen between “верно-таки” and etc.", + "ru": "Дефис между «верно-таки» и т. д." + }, + "ru/dash/time": { + "en-US": "Dash in time intervals", + "ru": "Тире в интервалах времени" + }, + "ru/dash/to": { + "en-US": "Hyphen before “то”, “либо”, “нибудь”", + "ru": "Дефис перед «то», «либо», «нибудь»" + }, + "ru/dash/weekday": { + "en-US": "Dash between the days of the week", + "ru": "Тире между днями недели" + }, + "ru/dash/years": { + "en-US": "Hyphen to dash in years", + "ru": "Замена дефиса на тире в годах" + }, + "ru/date/fromISO": { + "en-US": "Converting dates YYYY-MM-DD type DD.MM.YYYY", + "ru": "Преобразование дат YYYY-MM-DD к виду DD.MM.YYYY" + }, + "ru/date/weekday": { + "common": "2 Мая, Понедельник → 2 мая, понедельник" + }, + "ru/money/currency": { + "en-US": "Currency symbol ($, €, ¥, Ұ, £ and ₤) after the number, $100 → 100 $", + "ru": "Символ валюты ($, €, ¥, Ұ, £ и ₤) после числа, $100 → 100 $" + }, + "ru/money/ruble": { + "common": "1 руб. → 1 ₽" + }, + "ru/nbsp/abbr": { + "en-US": "Non-breaking space in abbreviations, e.g. “т. д.”", + "ru": "Нераз. пробел в сокращениях, например, в «т. д.»" + }, + "ru/nbsp/addr": { + "en-US": "Placement of non-breaking space after “г.”, “обл.”, “ул.”, “пр.”, “кв.” et al.", + "ru": "Расстановка нераз. пробела после «г.», «обл.», «ул.», «пр.», «кв.» и др." + }, + "ru/nbsp/afterNumberSign": { + "en-US": "Non-breaking thin space after №", + "ru": "Нераз. узкий пробел после №" + }, + "ru/nbsp/beforeParticle": { + "en-US": "Non-breaking space before “ли”, “ль”, “же”, “бы”, “б”", + "ru": "Нераз. пробел перед «ли», «ль», «же», «бы», «б»" + }, + "ru/nbsp/centuries": { + "en-US": "Remove spaces and extra points in “вв.”", + "ru": "Удаление пробелов и лишних точек в «вв.»" + }, + "ru/nbsp/dayMonth": { + "en-US": "Non-breaking space between number and month", + "ru": "Нераз. пробел между числом и месяцем" + }, + "ru/nbsp/initials": { + "en-US": "Binding of initials to the name", + "ru": "Привязка инициалов к фамилии" + }, + "ru/nbsp/m": { + "en-US": "m2 → м², m3 → м³ and non-breaking space", + "ru": "м2 → м², м3 → м³ и нераз. пробел" + }, + "ru/nbsp/mln": { + "en-US": "Non-breaking space between number and “тыс.”, “млн”, “млрд” and “трлн”", + "ru": "Неразр. пробел между числом и «тыс.», «млн», «млрд» и «трлн»" + }, + "ru/nbsp/ooo": { + "en-US": "Non-breaking space after “OOO, ОАО, ЗАО, НИИ, ПБОЮЛ”", + "ru": "Нераз. пробел после OOO, ОАО, ЗАО, НИИ и ПБОЮЛ" + }, + "ru/nbsp/page": { + "en-US": "Non-breaking space after “стр.”, “гл.”, “рис.”, “илл.”", + "ru": "Нераз. пробел после «стр.», «гл.», «рис.», «илл.»" + }, + "ru/nbsp/ps": { + "en-US": "Non-breaking space in P. S. and P. P. S.", + "ru": "Нераз. пробел в P. S. и P. P. S." + }, + "ru/nbsp/rubleKopek": { + "en-US": "Not once. space before the “rub” and “cop.”", + "ru": "Нераз. пробел перед «руб.» и «коп.»" + }, + "ru/nbsp/see": { + "en-US": "Non-breaking space after abbreviation «см.» and «им.»", + "ru": "Нераз. пробел после сокращений «см.» и «им.»" + }, + "ru/nbsp/year": { + "en-US": "Non-breaking space before XXXX г. (2012 г.)", + "ru": "Нераз. пробел после XXXX г. (2012 г.)" + }, + "ru/nbsp/years": { + "en-US": "г.г. → гг. and non-breaking space", + "ru": "г.г. → гг. и нераз. пробел" + }, + "ru/number/comma": { + "en-US": "Commas in numbers", + "ru": "Замена точки на запятую в числах" + }, + "ru/number/ordinals": { + "common": "N-ый, -ой, -ая, -ое, -ые, -ым, -ом, -ых → N-й, -я, -е, -м, -х (25-й)" + }, + "ru/optalign/bracket": { + "en-US": "for opening bracket", + "ru": "для открывающей скобки" + }, + "ru/optalign/comma": { + "en-US": "for comma", + "ru": "для запятой" + }, + "ru/optalign/quote": { + "en-US": "for opening quotation marks", + "ru": "для открывающей кавычки" + }, + "ru/other/accent": { + "en-US": "Replacement capital letters to lowercase with addition of accent", + "ru": "Замена заглавной буквы на строчную с добавлением ударения" + }, + "ru/other/phone-number": { + "en-US": "Formatting phone numbers", + "ru": "Форматирование телефонных номеров" + }, + "ru/punctuation/ano": { + "en-US": "Placement of commas before “а” and “но”", + "ru": "Расстановка запятых перед «а» и «но»" + }, + "ru/punctuation/exclamation": { + "common": "!! → !" + }, + "ru/punctuation/exclamationQuestion": { + "common": "!? → ?!" + }, + "ru/punctuation/hellipQuestion": { + "common": "«?…» → «?..», «!…» → «!..», «…,» → «…»" + }, + "ru/space/afterHellip": { + "en-US": "Space after “...”, “!..” and “?..”", + "ru": "Пробел после «...», «!..» и «?..»" + }, + "ru/space/year": { + "en-US": "Space between number and word “год”", + "ru": "Пробел между числом и словом «год»" + }, + "ru/symbols/NN": { + "common": "№№ → №" + }, + "ru/typo/switchingKeyboardLayout": { + "en-US": "Replacement of Latin letters in Russian. Typos occur when you switch keyboard layouts", + "ru": "Замена латинских букв на русские. Опечатки, возникающие при переключении клавиатурной раскладки" + } +} \ No newline at end of file diff --git a/assets/components/tinymcerte/js/vendor/tinymce/plugins/typograf/index.js b/assets/components/tinymcerte/js/vendor/tinymce/plugins/typograf/index.js new file mode 100644 index 0000000..35752f8 --- /dev/null +++ b/assets/components/tinymcerte/js/vendor/tinymce/plugins/typograf/index.js @@ -0,0 +1 @@ +require('./plugin.js'); \ No newline at end of file diff --git a/assets/components/tinymcerte/js/vendor/tinymce/plugins/typograf/langs/en.js b/assets/components/tinymcerte/js/vendor/tinymce/plugins/typograf/langs/en.js new file mode 100644 index 0000000..c49a185 --- /dev/null +++ b/assets/components/tinymcerte/js/vendor/tinymce/plugins/typograf/langs/en.js @@ -0,0 +1,3 @@ +tinymce.addI18n('en',{ + 'Typography' : 'Typography' +}); diff --git a/assets/components/tinymcerte/js/vendor/tinymce/plugins/typograf/langs/ru.js b/assets/components/tinymcerte/js/vendor/tinymce/plugins/typograf/langs/ru.js new file mode 100644 index 0000000..3a3301e --- /dev/null +++ b/assets/components/tinymcerte/js/vendor/tinymce/plugins/typograf/langs/ru.js @@ -0,0 +1,3 @@ +tinymce.addI18n('ru',{ + 'Typography' : 'Типографика' +}); diff --git a/assets/components/tinymcerte/js/vendor/tinymce/plugins/typograf/plugin.js b/assets/components/tinymcerte/js/vendor/tinymce/plugins/typograf/plugin.js new file mode 100644 index 0000000..16f9956 --- /dev/null +++ b/assets/components/tinymcerte/js/vendor/tinymce/plugins/typograf/plugin.js @@ -0,0 +1,166 @@ +/** + * TinyMce 5 + */ +tinymce.PluginManager.requireLangPack('typograf', 'en,ru'); +tinymce.PluginManager.add('typograf', function (editor, url) { + 'use strict'; + + let scriptLoader = new tinymce.dom.ScriptLoader(), + tp, + typo = function () { + if (tp) { + editor.setContent(tp.execute(editor.getContent())); + editor.undoManager.add(); + } + }, + data = {}, + tpDefault = {}, + tmSettings = tinymce.activeEditor.settings, + tpSettings = tmSettings.typograf; + + if (tpSettings) { + data = tpSettings; + } + + tpDefault.locale = ['ru', 'en-US']; + tpDefault.htmlEntity = {}; + + if (!data.locale) { + data.locale = tpDefault.locale; + } + if (!data.htmlEntity) { + data.htmlEntity = tpDefault.htmlEntity; + } + + scriptLoader.add(url + '/dist/typograf.all.min.js'); + + scriptLoader.loadQueue(function () { + if (data.addRule) { + addRule(data.addRule); + } + + tp = new Typograf({locale: data.locale, htmlEntity: data.htmlEntity}); + + if (data.addSafeTag) { + addSafeTag(tp, data.addSafeTag); + } + if (data.enableRule) { + registerPluginCss(data.enableRule); + enableRule(tp, data.enableRule); + } + if (data.disableRule) { + disableRule(tp, data.disableRule); + } + if (data.setSetting) { + setSetting(tp, data.setSetting); + } + }); + + /** + * Turn off typography in sections of text + * @param tp + * @param tags + */ + function addSafeTag(tp, tags) { + if (Array.isArray(tags)) { + tags.forEach(function (item) { + tp.addSafeTag(item[0], item[1]); + }); + } + } + + /** + * Add a simple rule + * @param rule + */ + function addRule(rule) { + if (Array.isArray(rule)) { + rule.forEach(function (item) { + return Typograf.addRule(item); + }); + } + } + + /** + * The change rules + * @param tp + * @param setting + */ + function setSetting(tp, setting) { + if (Array.isArray(setting)) { + setting.forEach(function (item) { + tp.setSetting(item[0], item[1], item[2]); + }); + } + } + + /** + * Enable rules + * @param tp + * @param rule + */ + function enableRule(tp, rule) { + if (Array.isArray(rule)) { + rule.forEach(function (item) { + tp.enableRule(item); + }); + } else { + tp.enableRule(rule); + } + } + + /** + * Register css this plugin if indicated rule + * Hanging punctuation + * @see https://github.com/typograf/typograf/blob/dev/docs/api_optalign.md + */ + function registerPluginCss(rules) { + let cssUrl = url + '/dist/typograf.css', + rule = 'ru/optalign/*', + linkElm = editor.dom.create('link', { + rel: 'stylesheet', + href: cssUrl + }); + if (Array.isArray(rules)) { + if (rules.indexOf(rule) !== -1) { + editor.getDoc().getElementsByTagName('head')[0].appendChild(linkElm); + } + } + } + + /** + * Disable rules + * @param tp + * @param rule + */ + function disableRule(tp, rule) { + if (Array.isArray(rule)) { + rule.forEach(function (item) { + tp.disableRule(item); + }); + } else { + tp.disableRule(rule); + } + } + + editor.ui.registry.addButton('typograf', { + icon: 'quote', + tooltip: 'Typography', + onAction: typo + }); + + editor.ui.registry.addMenuItem('typograf', { + text: 'Typography', + icon: 'quote', + onAction: typo + }); + + return { + getMetadata: function () { + return { + name: 'Typography', + url: 'https://github.com/Dominus77/typograf' + }; + } + }; +}); diff --git a/assets/components/tinymcerte/js/vendor/tinymce/plugins/typograf/plugin.min.js b/assets/components/tinymcerte/js/vendor/tinymce/plugins/typograf/plugin.min.js new file mode 100644 index 0000000..d6fa104 --- /dev/null +++ b/assets/components/tinymcerte/js/vendor/tinymce/plugins/typograf/plugin.min.js @@ -0,0 +1,4 @@ +tinymce.PluginManager.requireLangPack("typograf","en,ru"); +tinymce.PluginManager.add("typograf",function(c,f){function k(a,b){Array.isArray(b)&&b.forEach(function(b){a.addSafeTag(b[0],b[1])})}function l(a){Array.isArray(a)&&a.forEach(function(a){return Typograf.addRule(a)})}function m(a,b){Array.isArray(b)&&b.forEach(function(b){a.setSetting(b[0],b[1],b[2])})}function n(a,b){Array.isArray(b)?b.forEach(function(b){a.enableRule(b)}):a.enableRule(b)}function p(a,b){Array.isArray(b)?b.forEach(function(b){a.disableRule(b)}):a.disableRule(b)}var g=new tinymce.dom.ScriptLoader, +d,h=function(){d&&(c.setContent(d.execute(c.getContent())),c.undoManager.add())},a={},e;(e=tinymce.activeEditor.settings.typograf)&&(a=e);e=["ru","en-US"];var q={};a.locale||(a.locale=e);a.htmlEntity||(a.htmlEntity=q);g.add(f+"/dist/typograf.all.min.js");g.loadQueue(function(){a.addRule&&l(a.addRule);d=new Typograf({locale:a.locale,htmlEntity:a.htmlEntity});a.addSafeTag&&k(d,a.addSafeTag);if(a.enableRule){var e=a.enableRule,b=c.dom.create("link",{rel:"stylesheet",href:f+"/dist/typograf.css"});Array.isArray(e)&& +-1!==e.indexOf("ru/optalign/*")&&c.getDoc().getElementsByTagName("head")[0].appendChild(b);n(d,a.enableRule)}a.disableRule&&p(d,a.disableRule);a.setSetting&&m(d,a.setSetting)});c.ui.registry.addButton("typograf",{icon:"quote",tooltip:"Typography",onAction:h});c.ui.registry.addMenuItem("typograf",{text:"Typography",icon:"quote",onAction:h});return{getMetadata:function(){return{name:"Typography",url:"https://github.com/Dominus77/typograf"}}}});