20 lines
101 KiB
JavaScript
20 lines
101 KiB
JavaScript
/*!
|
||
* Tiny Advanced Typography plugin
|
||
*
|
||
* Copyright (c) 2023 Ephox Corporation DBA Tiny Technologies, Inc.
|
||
* Licensed under the Tiny commercial license. See https://www.tiny.cloud/legal/
|
||
*
|
||
* Version: 8.3.0-112
|
||
*/
|
||
|
||
/*!
|
||
* This resource uses the code from the following libraries:
|
||
*
|
||
* typograf
|
||
* 2014–2023 Денис Селезнёв, <hcodes@yandex.ru>
|
||
* https://github.com/typograf/typograf
|
||
*/
|
||
|
||
!function(){"use strict";const e=e=>t=>(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&(n=r=e,(o=String).prototype.isPrototypeOf(n)||r.constructor?.name===o.name)?"string":t;var n,r,o})(t)===e,t=e=>t=>typeof t===e,n=e("string"),r=e("array"),o=e=>null===e;const a=t("boolean"),s=e=>null==e,i=e=>!s(e),l=t("function"),u=t("number"),c=()=>{},p=(e,t)=>(...n)=>e(t.apply(null,n)),d=e=>()=>e,g=e=>e,m=(e,t)=>e===t;function h(e,...t){return(...n)=>{const r=t.concat(n);return e.apply(null,r)}}const f=d(!1),y=d(!0);class v{tag;value;static singletonNone=new v(!1);constructor(e,t){this.tag=e,this.value=t}static some(e){return new v(!0,e)}static none(){return v.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?v.some(e(this.value)):v.none()}bind(e){return this.tag?e(this.value):v.none()}exists(e){return this.tag&&e(this.value)}forall(e){return!this.tag||e(this.value)}filter(e){return!this.tag||e(this.value)?this:v.none()}getOr(e){return this.tag?this.value:e}or(e){return this.tag?this:e}getOrThunk(e){return this.tag?this.value:e()}orThunk(e){return this.tag?this:e()}getOrDie(e){if(this.tag)return this.value;throw new Error(e??"Called getOrDie on None")}static from(e){return i(e)?v.some(e):v.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(e){this.tag&&e(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}const b=Array.prototype.slice,x=Array.prototype.indexOf,$=Array.prototype.push,w=(e,t)=>((e,t)=>x.call(e,t))(e,t)>-1,E=(e,t)=>{for(let n=0,r=e.length;n<r;n++)if(t(e[n],n))return!0;return!1},R=(e,t)=>{const n=e.length,r=new Array(n);for(let o=0;o<n;o++){const n=e[o];r[o]=t(n,o)}return r},S=(e,t)=>{for(let n=0,r=e.length;n<r;n++)t(e[n],n)},T=(e,t)=>{const n=[];for(let r=0,o=e.length;r<o;r++){const o=e[r];t(o,r)&&n.push(o)}return n},C=(e,t,n)=>(S(e,((e,r)=>{n=t(n,e,r)})),n),A=(e,t)=>((e,t,n)=>{for(let r=0,o=e.length;r<o;r++){const o=e[r];if(t(o,r))return v.some(o);if(n(o,r))break}return v.none()})(e,t,f),k=(e,t)=>{for(let n=0,r=e.length;n<r;n++)if(t(e[n],n))return v.some(n);return v.none()},q=(e,t)=>(e=>{const t=[];for(let n=0,o=e.length;n<o;++n){if(!r(e[n]))throw new Error("Arr.flatten item "+n+" was not an array, input: "+e);$.apply(t,e[n])}return t})(R(e,t)),B=(e,t)=>{for(let n=0,r=e.length;n<r;++n)if(!0!==t(e[n],n))return!1;return!0},D=Object.keys,L=(e,t)=>{const n=D(e);for(let r=0,o=n.length;r<o;r++){const o=n[r];t(e[o],o)}},P=(e,t)=>N(e,((e,n)=>({k:n,v:t(e,n)}))),N=(e,t)=>{const n={};return L(e,((e,r)=>{const o=t(e,r);n[o.k]=o.v})),n},O=e=>{if(!r(e))throw new Error("cases must be an array");if(0===e.length)throw new Error("there must be at least one case");const t=[],n={};return S(e,((o,a)=>{const s=D(o);if(1!==s.length)throw new Error("one and only one name per case");const i=s[0],l=o[i];if(void 0!==n[i])throw new Error("duplicate key detected:"+i);if("cata"===i)throw new Error("cannot have a case named cata (sorry)");if(!r(l))throw new Error("case arguments must be an array");t.push(i),n[i]=(...n)=>{const r=n.length;if(r!==l.length)throw new Error("Wrong number of arguments to case "+i+". Expected "+l.length+" ("+l+"), got "+r);return{fold:(...t)=>{if(t.length!==e.length)throw new Error("Wrong number of arguments to fold. Expected "+e.length+", got "+t.length);return t[a].apply(null,n)},match:e=>{const r=D(e);if(t.length!==r.length)throw new Error("Wrong number of arguments to match. Expected: "+t.join(",")+"\nActual: "+r.join(","));if(!B(t,(e=>w(r,e))))throw new Error("Not all branches were specified when using match. Specified: "+r.join(", ")+"\nRequired: "+t.join(", "));return e[i].apply(null,n)},log:e=>{console.log(e,{constructors:t,constructor:i,params:n})}}}})),n},I=(M=/^\s+|\s+$/g,e=>e.replace(M,""));var M;const z=(e,t)=>{const{type:n,message:r}=t;e.notificationManager.open({type:n,text:r})},j=e=>{const t=(e=>{switch(e){case"error":return console.error;case"info":return console.info;case"warn":return console.warn;default:return console.log}})(e.type);t(e.message)},U=(e,t)=>{const{protect:n,allowList:r=[],blockList:o=[]}=null!=e?e:{};let a;return a=i(n)?n:r.length>0||o.length>0||t,{protect:a,allowList:r,blockList:o}},H=e=>{const{protect:t,allowList:n,blockList:r}=null!=e?e:{};return e=>{const o=e.toLowerCase();return n.length>0?!E(n,(e=>e.toLowerCase()===o)):r.length>0?E(r,(e=>e.toLowerCase()===o)):t}},W=e=>{const t=H(e);return(e,n)=>{const r=((e,t)=>`${e}:${t}`)(n,e.toLowerCase());return t(r)}},F=(e,t,n,r)=>{const o=Reflect.get(e,"on"),a={protectedEventHandlers:[],cleanupScheduled:!1},s=(e,t)=>{r&&console.log(`[EventsProxy] ${e}`,t||"")},i=t=>{"invalid"===t&&a.protectedEventHandlers.length>0&&(s("Removing event handlers",a.protectedEventHandlers),S(a.protectedEventHandlers,(t=>{e.off(t.name,t.callback)})),a.protectedEventHandlers=[])},l=t.onStatusChange(i);return e.on("remove",l),(r,l,u)=>{s(`Adding event listener: ${r}`,{shouldProtect:n(r)});const p=((e,r)=>{const o=n(e),s=t.getStatus(),i=o&&"invalid"===s?c:r;return o&&a.protectedEventHandlers.push({name:e,callback:i}),i})(r,l);return a.cleanupScheduled||(a.cleanupScheduled=!0,window.setTimeout((()=>{i(t.getStatus()),a.cleanupScheduled=!1}),0)),Reflect.apply(o,e,[r,p,u])}},Q=(e,t,n)=>r=>{const o="invalid"!==t.getStatus()&&i(n)?n(r):c,a=((e,t,n)=>{const r=e=>{"invalid"===e&&n.setEnabled(!1)},o=()=>r(t.getStatus());r(t.getStatus()),e.on("NodeChange",o);const a=t.onStatusChange(r);return()=>{e.off("NodeChange",o),a()}})(e,t,r);return e=>{null==o||o(e),a()}},V=(e,t,n)=>(...r)=>{var o;return"invalid"===e.getStatus()?n:null!==(o=null==t?void 0:t(...r))&&void 0!==o?o:n},_=(e,t)=>V(e,t,Promise.resolve([])),G=(e,t)=>V(e,t,[]),K=(e,t)=>V(e,t,!1),X=(e,t,r,o)=>{const a=t=>{const{command:a,value:s}=t,i=v.from(s).filter(n).map((e=>e.toLowerCase())),l=a.toLowerCase()===o.toLowerCase(),u=i.exists((e=>r.has(e))),c=i.exists((t=>t===e.queryCommandValue(o)));l&&u&&!c&&t.preventDefault()},s=t.onStatusChange((t=>{if("invalid"===t){e.on("BeforeExecCommand",a);const t=()=>{const t=e.queryCommandValue(o);r.has(t.toLowerCase())&&e.execCommand(o,!1,t)};e.initialized?t():e.on("init",t)}}));e.on("remove",(()=>{s(),e.off("BeforeExecCommand",a)}))},Z=(e,t,r,o,a,s=!1)=>{const i=new Set,l=new Set,u=(e,t)=>{s&&console.log(`[UiProxy] ${e}`,t||"")};((e,t,n)=>{X(e,t,n,"ToggleView")})(e,r,i),((e,t,n)=>{X(e,t,n,"ToggleSidebar")})(e,r,l);const c=(t,n,s,i)=>{const l=a(t,s);return u(`${i}: ${t}`,{spec:n,context:o,shouldProtect:l}),l?{...n,onSetup:Q(e,r,n.onSetup)}:n};return new Proxy(t,{get:(e,t,s)=>{const p=Reflect.get(e,t,s);if(!n(t))return p;switch(t){case"addButton":case"addGroupToolbarButton":case"addToggleButton":case"addMenuButton":case"addSplitButton":return(...n)=>{const[r,o,...a]=n,s=c(r,o,"button",String(t));return Reflect.apply(p,e,[r,s,...a])};case"addMenuItem":case"addToggleMenuItem":case"addNestedMenuItem":return(...n)=>{const[r,o,...a]=n,s=c(r,o,"menuitem",String(t));return Reflect.apply(p,e,[r,s,...a])};case"addAutocompleter":return(...n)=>{const[s,i,...l]=n,c=a(s,"autocompleter");if(u(`${String(t)}: ${s}`,{spec:i,context:o,shouldProtect:c}),c){const t={...i,fetch:_(r,i.fetch)};return Reflect.apply(p,e,[s,t,...l])}return Reflect.apply(p,e,[s,i,...l])};case"addSidebar":return(...n)=>{const[r,s,...i]=n,c=a(r,"sidebar");if(u(`${String(t)}: ${r}`,{spec:s,context:o,shouldProtect:c}),c){l.add(r.toLowerCase());const t={...s};return Reflect.apply(p,e,[r,t,...i])}return Reflect.apply(p,e,[r,s,...i])};case"addView":return(...n)=>{const[r,s,...l]=n,c=a(r,"view");if(u(`${String(t)}: ${r}`,{spec:s,context:o,shouldProtect:c}),c){i.add(r.toLowerCase());const t={...s};return Reflect.apply(p,e,[r,t,...l])}return Reflect.apply(p,e,[r,s,...l])};case"addContextMenu":return(...n)=>{const[s,i,...l]=n,c=a(s,"contextmenu");if(u(`${String(t)}: ${s}`,{spec:i,context:o,shouldProtect:c}),c){const t={...i,update:G(r,i.update)};return Reflect.apply(p,e,[s,t,...l])}return Reflect.apply(p,e,[s,i,...l])};case"addContextToolbar":case"addContextForm":return(...n)=>{const[s,i,...l]=n,c=a(s,"contexttoolbar");if(u(`${String(t)}: ${s}`,{spec:i,context:o,shouldProtect:c}),c){const t={...i,predicate:K(r,i.predicate)};return Reflect.apply(p,e,[s,t,...l])}return Reflect.apply(p,e,[s,i,...l])};case"addIcon":case"getAll":case"addContext":return p}}})},Y=new Set(["addCommand","addCommands","addQueryStateHandler","addQueryValueHandler"]),J=e=>(t,n)=>{e&&console.log(`[EditorProxy] ${t}`,n||"")},ee=(e,t)=>{const{statusProvider:n,uiContext:r,protection:o,debug:a=!1}=t,{events:s,commands:i,ui:u}=o;J(a)("Creating enhanced editor with options:",{hasStatusProvider:!!n,uiContext:r,debug:a,protection:o});const{editorUiProxy:p,editorCommandsProxy:d,editorEventListenerProxy:g}=((e,t,n,r,o,a,s)=>{const i=a.protect?{...e.ui,registry:Z(e,e.ui.registry,t,n,W(a),s)}:e.ui,l=r.protect?((e,t,n,r,o)=>{const a={protectedCommands:[],cleanupScheduled:!1},s=(e,t)=>{o&&console.log(`[CommandsProxy] ${e}`,t||"")},i=(e,t)=>{const o=r(e),s=n.getStatus();return o&&a.protectedCommands.push(e),o&&"invalid"===s?c:t},l=t=>{"invalid"===t&&a.protectedCommands.length>0&&(s("Removing commands",a.protectedCommands),S(a.protectedCommands,(t=>{e.editorCommands.removeCommand(t)})),a.protectedCommands=[])},u=()=>{a.cleanupScheduled||(a.cleanupScheduled=!0,window.setTimeout((()=>{l(n.getStatus()),a.cleanupScheduled=!1}),0))},p=n.onStatusChange(l);return e.on("remove",p),new Proxy(t,{get:(e,n,o)=>{if(s(`Accessing property: ${String(n)}`),"addCommand"===n){const a=Reflect.get(e,n,o);return(e,n,...o)=>{s(`Adding command: ${e}`,{shouldProtect:r(e)});const l=i(e,n);return u(),Reflect.apply(a,t,[e,l,...o])}}if("addCommands"===n){const r=Reflect.get(e,n,o);return(e,n="exec")=>{s(`Adding commands (${n})`,{commandCount:Object.keys(e).length,willApplyEnforcement:"exec"===n});const o="exec"!==n?e:P(e,((e,t)=>i(t,e)));return u(),Reflect.apply(r,t,[o,n])}}return Reflect.get(e,n,o)}})})(e,e.editorCommands,t,H(r),s):e.editorCommands;return{editorUiProxy:i,editorCommandsProxy:l,editorEventListenerProxy:o.protect?F(e,t,H(o),s):e.on.bind(e)}})(e,n,r||"",i,s,u,a),m=((e,t,n,r)=>(o,a,s)=>{const i=String(a);if("on"===a)return J(r)("on intercepted"),n;if(Y.has(i))return J(r)(`${i} intercepted`),t[i].bind(t);if("editorCommands"===a)return J(r)("editorCommands accessed"),t;if("ui"===a)return J(r)("ui accessed"),e;const u=Reflect.get(o,a,s);return l(u)?u.bind(o):u})(p,d,g,a);return new Proxy(e,{get:m,set:(e,t,n,r)=>Reflect.set(e,t,n,r),has:(e,t)=>Reflect.has(e,t),ownKeys:e=>Reflect.ownKeys(e),getOwnPropertyDescriptor:(e,t)=>Reflect.getOwnPropertyDescriptor(e,t),defineProperty:(e,t,n)=>Reflect.defineProperty(e,t,n),deleteProperty:(e,t)=>Reflect.deleteProperty(e,t),isExtensible:e=>Reflect.isExtensible(e),preventExtensions:e=>Reflect.preventExtensions(e),getPrototypeOf:e=>Reflect.getPrototypeOf(e),setPrototypeOf:(e,t)=>Reflect.setPrototypeOf(e,t)})},te=e=>parseInt(e,10),ne=(e,t)=>{const n=e-t;return 0===n?0:n>0?1:-1},re=(e,t,n)=>({major:e,minor:t,patch:n}),oe=e=>{const t=/([0-9]+)\.([0-9]+)\.([0-9]+)(?:(\-.+)?)/.exec(e);return t?re(te(t[1]),te(t[2]),te(t[3])):re(0,0,0)},ae=(e,t)=>!!e&&-1===((e,t)=>{const n=ne(e.major,t.major);if(0!==n)return n;const r=ne(e.minor,t.minor);if(0!==r)return r;const o=ne(e.patch,t.patch);return 0!==o?o:0})((e=>oe((e=>[e.majorVersion,e.minorVersion].join(".").split(".").slice(0,3).join("."))(e)))(e),oe(t)),se=oe("8.3.0"),ie=`${se.major}.${se.minor}.0`,le=`${se.major+1}.0.0`,ue=(e,t)=>{const{setup:n,protection:r}=t;return(o,a)=>{if(!((e,t)=>ae(e,ie)?(console.error(`The "${t}" plugin requires at least version ${ie} of TinyMCE.`),!1):!!ae(e,le)||(console.error(`The "${t}" plugin requires at least version ${ie} of TinyMCE but less than ${le}.`),!1))(tinymce,e)||((e,t)=>!!(e=>{var t;const n=null===(t=e.options.get("license_key"))||void 0===t?void 0:t.toLowerCase(),r=e.options.get("online_license_key");return s(r)&&"gpl"===n})(e)&&(((e,t)=>{const{console:n,editor:r}=t;i(r)&&(e._skinLoaded?z(e,r):e.on("SkinLoaded",(()=>{z(e,r)}))),i(n)&&j(n)})(e,{console:{type:"error",message:[`The "${t}" plugin requires a valid TinyMCE license key.`,"Read more: https://www.tiny.cloud/docs/tinymce/latest/license-key/"].join(" ")}}),!0))(o,e))return{};const u=(e=>{const{protect:t=!0,events:n,commands:r,ui:o,api:a}=null!=e?e:{};return{protect:t,events:U(n,false),commands:U(r,true),ui:U(o,true),api:U(a,true)}})(r),c=((e="pre-validation")=>{const t=(e=>{let t=e;return{get:()=>t,set:e=>{t=e}}})(e),n=new Set;let r=!1;const{enableLogging:o=!1}={},a=(e,...t)=>{o&&console.log(`[StatusProvider] ${e}`,...t)};return{setStatus:e=>{const r=t.get();if(r===e)return a("Status unchanged:",e),!1;t.set(e),a("Status changed:",r,"->",e);const o={currentStatus:e,previousStatus:r},s=Array.from(n);return S(s,(e=>{e(o.currentStatus,o.previousStatus)})),!0},onStatusChange:e=>(n.add(e),a("Callback registered, total listeners:",n.size),()=>{n.delete(e)&&a("Callback unregistered, remaining listeners:",n.size)}),getStatus:t.get,hasListeners:()=>n.size>0,destroy:()=>{r||(a("Destroying StatusProvider, clearing",n.size,"listeners"),n.clear(),r=!0)}}})(),p=((e,t,n)=>{const r=`commercial-license-${t}`;return e.ui.registry.addContext(r,(()=>"invalid"!==n.getStatus()&&!e.mode.isReadOnly())),e.licenseKeyManager.validate({plugin:t}).then((e=>{n.setStatus(e?"valid":"invalid")}),(e=>{console.error(e),console.error(`An unknown error occurred when trying to validate "${t}" plugin.`),n.setStatus("invalid")})),{ui:{context:r}}})(o,e,c),d=u.protect?ee(o,{statusProvider:c,uiContext:p.ui.context,debug:t.debug||!1,protection:u}):o,g=((e,t)=>({pluginCode:e,enforcer:{isInvalid:()=>"invalid"===t.getStatus(),onInvalid:e=>t.onStatusChange(((t,n)=>{"invalid"===t&&e(t,n)}))}}))(e,c);return((e,t,n,r)=>{if(t.protect&&t.api.protect&&i(e)){const a=H(t.api);return(o=e=>"invalid"===n.getStatus()&&a(e),(e,t)=>P(e,((e,n)=>l(e)?(...r)=>{if(o(n.toLowerCase())){const e=`Method "${i(t)?`${t}.`:""}${n}" is not available due to license key restrictions.`,r=new Error(e);throw console.error(e),r}return e(...r)}:e)))(e,r)}var o;return e})(n(d,a,g),u,c,e)}},ce=e=>{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},pe={fromHtml:(e,t)=>{const n=(t||document).createElement("div");if(n.innerHTML=e,!n.hasChildNodes()||n.childNodes.length>1){const t="HTML does not have a single root node";throw console.error(t,e),new Error(t)}return ce(n.childNodes[0])},fromTag:(e,t)=>{const n=(t||document).createElement(e);return ce(n)},fromText:(e,t)=>{const n=(t||document).createTextNode(e);return ce(n)},fromDom:ce,fromPoint:(e,t,n)=>v.from(e.dom.elementFromPoint(t,n)).map(ce)},de=(e,t)=>{const n=e.dom;if(1!==n.nodeType)return!1;{const e=n;if(void 0!==e.matches)return e.matches(t);if(void 0!==e.msMatchesSelector)return e.msMatchesSelector(t);if(void 0!==e.webkitMatchesSelector)return e.webkitMatchesSelector(t);if(void 0!==e.mozMatchesSelector)return e.mozMatchesSelector(t);throw new Error("Browser lacks native selectors")}},ge=(e,t)=>e.dom===t.dom,me=de,he=e=>e.dom.nodeName.toLowerCase(),fe=e=>e.dom.nodeType,ye=e=>t=>fe(t)===e,ve=e=>8===fe(e)||"#comment"===he(e),be=ye(1),xe=ye(3),$e=ye(9),we=ye(11),Ee=e=>v.from(e.dom.parentNode).map(pe.fromDom),Re=e=>v.from(e.dom.parentElement).map(pe.fromDom),Se=(e,t)=>{const n=l(t)?t:f;let r=e.dom;const o=[];for(;null!==r.parentNode&&void 0!==r.parentNode;){const e=r.parentNode,t=pe.fromDom(e);if(o.push(t),!0===n(t))break;r=e}return o},Te=e=>v.from(e.dom.previousSibling).map(pe.fromDom),Ce=e=>v.from(e.dom.nextSibling).map(pe.fromDom),Ae=e=>R(e.dom.childNodes,pe.fromDom),ke=e=>pe.fromDom(e.dom.host),qe=(e,t)=>{Ee(e).each((n=>{n.dom.insertBefore(t.dom,e.dom)}))},Be=(e,t)=>{Ce(e).fold((()=>{Ee(e).each((e=>{Le(e,t)}))}),(e=>{qe(e,t)}))},De=(e,t)=>{(e=>(e=>{const t=e.dom.childNodes;return v.from(t[0]).map(pe.fromDom)})(e))(e).fold((()=>{Le(e,t)}),(n=>{e.dom.insertBefore(t.dom,n.dom)}))},Le=(e,t)=>{e.dom.appendChild(t.dom)},Pe=(e,t)=>{qe(e,t),Le(t,e)},Ne=(e,t)=>{S(t,((n,r)=>{const o=0===r?e:t[r-1];Be(o,n)}))},Oe=(e,t)=>{S(t,(t=>{Le(e,t)}))},Ie=(e,t,r)=>{if(!(n(r)||a(r)||u(r)))throw console.error("Invalid call to Attribute.set. Key ",t,":: Value ",r,":: Element ",e),new Error("Attribute value was not simple");e.setAttribute(t,r+"")},Me=(e,t,n)=>{Ie(e.dom,t,n)},ze=(e,t)=>{const n=e.dom.getAttribute(t);return null===n?void 0:n},je=(e,t)=>v.from(ze(e,t)),Ue=(e,t)=>{const n=e.dom;return!(!n||!n.hasAttribute)&&n.hasAttribute(t)},He=(e,t)=>{e.dom.removeAttribute(t)},We=e=>{const t=e.dom;null!==t.parentNode&&t.parentNode.removeChild(t)},Fe=e=>{const t=Ae(e);t.length>0&&Ne(e,t),We(e)},Qe=e=>void 0!==e.style&&l(e.style.getPropertyValue),Ve=e=>{const t=xe(e)?e.dom.parentNode:e.dom;if(null==t||null===t.ownerDocument)return!1;const n=t.ownerDocument;return(e=>{const t=(e=>pe.fromDom(e.dom.getRootNode()))(e);return we(n=t)&&i(n.dom.host)?v.some(t):v.none();var n})(pe.fromDom(t)).fold((()=>n.body.contains(t)),(r=Ve,o=ke,e=>r(o(e))));var r,o},_e=(e,t,r)=>{((e,t,r)=>{if(!n(r))throw console.error("Invalid call to CSS.set. Property ",t,":: Value ",r,":: Element ",e),new Error("CSS value must be a string: "+r);Qe(e)&&e.style.setProperty(t,r)})(e.dom,t,r)},Ge=(e,t)=>{const n=e.dom,r=window.getComputedStyle(n).getPropertyValue(t);return""!==r||Ve(e)?r:Ke(n,t)},Ke=(e,t)=>Qe(e)?e.style.getPropertyValue(t):"",Xe=(e,t)=>{const n=e.dom,r=Ke(n,t);return v.from(r).filter((e=>e.length>0))},Ze=(e,t)=>{((e,t)=>{Qe(e)&&e.style.removeProperty(t)})(e.dom,t),((e,t,n=m)=>e.exists((e=>n(e,t))))(je(e,"style").map(I),"")&&He(e,"style")},Ye=(e=>{const t=t=>e(t)?v.from(t.dom.nodeValue):v.none();return{get:n=>{if(!e(n))throw new Error("Can only get text value of a text node");return t(n).getOr("")},getOption:t,set:(t,n)=>{if(!e(t))throw new Error("Can only set raw text value of a text node");t.dom.nodeValue=n}}})(xe),Je=e=>Ye.get(e),et=(e,t)=>Ye.set(e,t),tt=(e,t,n)=>{let r=e.dom;const o=l(n)?n:f;for(;r.parentNode;){r=r.parentNode;const e=pe.fromDom(r);if(t(e))return v.some(e);if(o(e))break}return v.none()},nt=(e,t,n)=>tt(e,(e=>de(e,t)),n),rt=(e,t,n)=>((e,t,n,r,o)=>((e,t)=>de(e,t))(n,r)?v.some(n):l(o)&&o(n)?v.none():t(n,r,o))(0,nt,e,t,n),ot=e=>e.dom.contentEditable,at=e=>e.dom.textContent,st=(e,t)=>{let n=[];return S(Ae(e),(e=>{t(e)&&(n=n.concat([e])),n=n.concat(st(e,t))})),n},it=(e,t)=>((e,t)=>{const n=void 0===t?document:t.dom;return 1!==(r=n).nodeType&&9!==r.nodeType&&11!==r.nodeType||0===r.childElementCount?[]:R(n.querySelectorAll(e),pe.fromDom);var r})(t,e);var lt=["body","p","div","article","aside","figcaption","figure","footer","header","nav","section","ol","ul","li","table","thead","tbody","tfoot","caption","tr","td","th","h1","h2","h3","h4","h5","h6","blockquote","pre","address"],ut=()=>({up:d({selector:nt,closest:rt,predicate:tt,all:Se}),down:d({selector:it,predicate:st}),styles:d({get:Ge,getRaw:Xe,set:_e,remove:Ze}),attrs:d({get:ze,set:Me,remove:He,copyTo:(e,t)=>{((e,t)=>{const n=e.dom;L(t,((e,t)=>{Ie(n,t,e)}))})(t,C(e.dom.attributes,((e,t)=>(e[t.name]=t.value,e)),{}))}}),insert:d({before:qe,after:Be,afterAll:Ne,append:Le,appendAll:Oe,prepend:De,wrap:Pe}),remove:d({unwrap:Fe,remove:We}),create:d({nu:pe.fromTag,clone:e=>pe.fromDom(e.dom.cloneNode(!1)),text:pe.fromText}),query:d({comparePosition:(e,t)=>e.dom.compareDocumentPosition(t.dom),prevSibling:Te,nextSibling:Ce}),property:d({children:Ae,name:he,parent:Ee,document:e=>{return(t=e,$e(t)?t:pe.fromDom(t.dom.ownerDocument)).dom;var t},isText:xe,isComment:ve,isElement:be,isSpecial:e=>{const t=he(e);return w(["script","noscript","iframe","noframes","noembed","title","style","textarea","xmp"],t)},getLanguage:e=>be(e)?je(e,"lang"):v.none(),getText:Je,setText:et,isBoundary:e=>!!be(e)&&("body"===he(e)||w(lt,he(e))),isEmptyTag:e=>!!be(e)&&w(["br","img","hr","input"],he(e)),isNonEditable:e=>be(e)&&"false"===ze(e,"contenteditable")}),eq:ge,is:me});const ct=(e,t)=>({item:e,mode:t}),pt=(e,t,n,r=dt)=>e.property().parent(t).map((e=>ct(e,r))),dt=(e,t,n,r=gt)=>n.sibling(e,t).map((e=>ct(e,r))),gt=(e,t,n,r=gt)=>{const o=e.property().children(t);return n.first(o).map((e=>ct(e,r)))},mt=[{current:pt,next:dt,fallback:v.none()},{current:dt,next:gt,fallback:v.some(pt)},{current:gt,next:gt,fallback:v.some(dt)}],ht=(e,t,n,r,o=mt)=>A(o,(e=>e.current===n)).bind((n=>n.current(e,t,r,n.next).orThunk((()=>n.fallback.bind((n=>ht(e,t,n,r))))))),ft={left:()=>({sibling:(e,t)=>e.query().prevSibling(t),first:e=>e.length>0?v.some(e[e.length-1]):v.none()}),right:()=>({sibling:(e,t)=>e.query().nextSibling(t),first:e=>e.length>0?v.some(e[0]):v.none()})},yt=(e,t)=>({element:e,offset:t}),vt=(e,t,n)=>({element:e,start:t,finish:n}),bt=O([{boundary:["item","universe"]},{empty:["item","universe"]},{text:["item","universe"]},{nonEditable:["item","universe"]}]),xt=f,$t=y,wt=d(0),Et=d(1),Rt=e=>({...e,isBoundary:()=>e.fold($t,xt,xt,xt),toText:()=>e.fold(v.none,v.none,(e=>v.some(e)),v.none),is:t=>e.fold(xt,xt,((e,n)=>n.eq(e,t)),xt),len:()=>e.fold(wt,Et,((e,t)=>t.property().getText(e).length),Et)}),St={text:p(Rt,bt.text),boundary:p(Rt,bt.boundary),empty:p(Rt,bt.empty),nonEditable:p(Rt,bt.empty),cata:(e,t,n,r,o)=>e.fold(t,n,r,o)},Tt=(e,t)=>{if(e.property().isText(t))return yt(t,e.property().getText(t).length);{const n=e.property().children(t);return n.length>0?Tt(e,n[n.length-1]):yt(t,n.length)}},Ct=(e,t,n)=>{const r=e.property().children(t);return r.length>0&&n<r.length?Ct(e,r[n],0):r.length>0&&e.property().isElement(t)&&r.length===n?Tt(e,r[r.length-1]):yt(t,n)},At=Ct,kt=O([{include:["item"]},{excludeWith:["item"]},{excludeWithout:["item"]}]),qt={include:kt.include,excludeWith:kt.excludeWith,excludeWithout:kt.excludeWithout,cata:(e,t,n,r)=>e.fold(t,n,r)},Bt="[-'\\.\u2018\u2019\u2024\ufe52\uff07\uff0e]",Dt="[:\xb7\xb7\u05f4\u2027\ufe13\ufe55\uff1a]",Lt="[\xb1+*/,;;\u0589\u060c\u060d\u066c\u07f8\u2044\ufe10\ufe14\ufe50\ufe54\uff0c\uff1b]",Pt="[0-9\u0660-\u0669\u066b\u06f0-\u06f9\u07c0-\u07c9\u0966-\u096f\u09e6-\u09ef\u0a66-\u0a6f\u0ae6-\u0aef\u0b66-\u0b6f\u0be6-\u0bef\u0c66-\u0c6f\u0ce6-\u0cef\u0d66-\u0d6f\u0e50-\u0e59\u0ed0-\u0ed9\u0f20-\u0f29\u1040-\u1049\u1090-\u1099\u17e0-\u17e9\u1810-\u1819\u1946-\u194f\u19d0-\u19d9\u1a80-\u1a89\u1a90-\u1a99\u1b50-\u1b59\u1bb0-\u1bb9\u1c40-\u1c49\u1c50-\u1c59\ua620-\ua629\ua8d0-\ua8d9\ua900-\ua909\ua9d0-\ua9d9\uaa50-\uaa59\uabf0-\uabf9]",Nt="\\r",Ot="\\n",It="[\v\f\x85\u2028\u2029]",Mt="[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065f\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u0900-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0c01-\u0c03\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c82\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d02\u0d03\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d82\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f\u109a-\u109d\u135d-\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b6-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u192b\u1930-\u193b\u19b0-\u19c0\u19c8\u19c9\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f\u1b00-\u1b04\u1b34-\u1b44\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1baa\u1be6-\u1bf3\u1c24-\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf2\u1dc0-\u1de6\u1dfc-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua880\ua881\ua8b4-\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa7b\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe3-\uabea\uabec\uabed\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]",zt="[\xad\u0600-\u0603\u06dd\u070f\u17b4\u17b5\u200e\u200f\u202a-\u202e\u2060-\u2064\u206a-\u206f\ufeff\ufff9-\ufffb]",jt="[\u3031-\u3035\u309b\u309c\u30a0-\u30fa\u30fc-\u30ff\u31f0-\u31ff\u32d0-\u32fe\u3300-\u3357\uff66-\uff9d]",Ut="[=_\u203f\u2040\u2054\ufe33\ufe34\ufe4d-\ufe4f\uff3f\u2200-\u22ff<>]",Ht="[~\u2116|!-*+-\\/:;?@\\[-`{}\xa1\xab\xb7\xbb\xbf;\xb7\u055a-\u055f\u0589\u058a\u05be\u05c0\u05c3\u05c6\u05f3\u05f4\u0609\u060a\u060c\u060d\u061b\u061e\u061f\u066a-\u066d\u06d4\u0700-\u070d\u07f7-\u07f9\u0830-\u083e\u085e\u0964\u0965\u0970\u0df4\u0e4f\u0e5a\u0e5b\u0f04-\u0f12\u0f3a-\u0f3d\u0f85\u0fd0-\u0fd4\u0fd9\u0fda\u104a-\u104f\u10fb\u1361-\u1368\u1400\u166d\u166e\u169b\u169c\u16eb-\u16ed\u1735\u1736\u17d4-\u17d6\u17d8-\u17da\u1800-\u180a\u1944\u1945\u1a1e\u1a1f\u1aa0-\u1aa6\u1aa8-\u1aad\u1b5a-\u1b60\u1bfc-\u1bff\u1c3b-\u1c3f\u1c7e\u1c7f\u1cd3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205e\u207d\u207e\u208d\u208e\u3008\u3009\u2768-\u2775\u27c5\u27c6\u27e6-\u27ef\u2983-\u2998\u29d8-\u29db\u29fc\u29fd\u2cf9-\u2cfc\u2cfe\u2cff\u2d70\u2e00-\u2e2e\u2e30\u2e31\u3001-\u3003\u3008-\u3011\u3014-\u301f\u3030\u303d\u30a0\u30fb\ua4fe\ua4ff\ua60d-\ua60f\ua673\ua67e\ua6f2-\ua6f7\ua874-\ua877\ua8ce\ua8cf\ua8f8-\ua8fa\ua92e\ua92f\ua95f\ua9c1-\ua9cd\ua9de\ua9df\uaa5c-\uaa5f\uaade\uaadf\uabeb\ufd3e\ufd3f\ufe10-\ufe19\ufe30-\ufe52\ufe54-\ufe61\ufe63\ufe68\ufe6a\ufe6b\uff01-\uff03\uff05-\uff0a\uff0c-\uff0f\uff1a\uff1b\uff1f\uff20\uff3b-\uff3d\uff3f\uff5b\uff5d\uff5f-\uff65]",Wt=10,Ft=[new RegExp("[A-Za-z\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05d0-\u05ea\u05f0-\u05f3\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097f\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c33\u0c35-\u0c39\u0c3d\u0c58\u0c59\u0c60\u0c61\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d60\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u10a0-\u10c5\u10d0-\u10fa\u10fc\u1100-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f4\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f0\u1700-\u170c\u170e-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1820-\u1877\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191c\u1a00-\u1a16\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae\u1baf\u1bc0-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1ce9-\u1cec\u1cee-\u1cf1\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u212f-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u24b6-\u24e9\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cee\u2d00-\u2d25\u2d30-\u2d65\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u2e2f\u3005\u303b\u303c\u3105-\u312d\u3131-\u318e\u31a0-\u31ba\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua697\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua78e\ua790\ua791\ua7a0-\ua7a9\ua7fa-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uabc0-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uffa0-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc]"),new RegExp(Bt),new RegExp(Dt),new RegExp(Lt),new RegExp(Pt),new RegExp(Nt),new RegExp(Ot),new RegExp(It),new RegExp(Mt),new RegExp(zt),new RegExp(jt),new RegExp(Ut),new RegExp("@")],Qt=new RegExp("^"+Ht+"$"),Vt=d("[^\\w'\\-\xad\\u0100-\\u017F\\u00C0-\\u00FF\ufeff\\u2018\\u2019]"),_t=(e,t,n,r)=>({term:()=>new RegExp(e,r.getOr("g")),prefix:t,suffix:n}),Gt=_t,Kt=Vt,Xt=(e,t)=>k(e,(e=>e.start===t)),Zt=(e,t,n=0)=>C(e,((e,n)=>t(n,e.len).fold(d(e),(t=>({len:t.finish,list:e.list.concat([t])})))),{len:n,list:[]}).list,Yt=(e,t,n)=>0===t.length?e:q(e,(e=>{const r=q(t,(t=>((e,t)=>t>=e.start&&t<=e.finish)(e,t)?[t-e.start]:[]));return r.length>0?((e,t,n)=>{return r=n(e,t),o=e.start,R(r,(e=>({...e,start:e.start+o,finish:e.finish+o})));var r,o})(e,r,n):[e]})),Jt=(e,t)=>{const n=t.term(),r=[];let o=n.exec(e);for(;o;){const a=o.index+t.prefix(o),s=o[0].length-t.prefix(o)-t.suffix(o);r.push({start:a,finish:a+s}),n.lastIndex=a+s,o=n.exec(e)}return r},en=Jt,tn=(e,t)=>{const n=q(t,(t=>{const n=Jt(e,t.pattern);return R(n,(e=>({...t,...e})))}));return(e=>{const t=(e=>(e=>{const t=b.call(e,0);return t.sort(((e,t)=>e.start-t.start)),t})(e))(e);return C(t,((e,t)=>{const n=E(e,(e=>t.start>=e.start&&t.finish<=e.finish||t.finish>e.start&&t.start<e.start||t.finish>e.finish&&t.start<e.finish));return k(e,(e=>t.start===e.start)).fold((()=>n?e:[...e,t]),(n=>t.finish>e[n].finish?[...e.slice(0,n),t]:e))}),[])})(n)},nn=Ft,rn=e=>{let t=13;const n=nn.length;for(let r=0;r<n;++r){const n=nn[r];if(n&&n.test(e)){t=r;break}}return t},on=(e,t)=>{const n=e[t],r=e[t+1];if(t<0||t>e.length-1&&0!==t)return!1;if(0===n&&0===r)return!1;const o=e[t+2];if(0===n&&(2===r||1===r||12===r)&&0===o)return!1;const a=e[t-1];return(2!==n&&1!==n&&12!==r||0!==r||0!==a)&&(4!==n&&0!==n||4!==r&&0!==r)&&(3!==n&&1!==n||4!==r||4!==a)&&(4!==n||3!==r&&1!==r||4!==o)&&(8!==n&&9!==n||0!==r&&4!==r&&r!==Wt&&8!==r&&9!==r)&&(8!==r&&(9!==r||0!==o&&4!==o&&o!==Wt&&8!==o&&9!==o)||0!==n&&4!==n&&n!==Wt&&8!==n&&9!==n)&&(5!==n||6!==r)&&(7===n||5===n||6===n||7===r||5===r||6===r||(n!==Wt||r!==Wt)&&(11!==r||0!==n&&4!==n&&n!==Wt&&11!==n)&&(11!==n||0!==r&&4!==r&&r!==Wt)&&12!==n)},an=/^\s+$/,sn=Qt,ln=e=>"http"===e||"https"===e,un=(e,t)=>{const n=((e,t)=>{let n;for(n=t;n<e.length&&!an.test(e[n]);n++);return n})(e,t+1);return"://"===e.slice(t+1,n).join("").substr(0,3)?n:t},cn=d([]),pn=(e,t,n)=>{if(e.property().isText(t))return[St.text(t,e)];if(e.property().isEmptyTag(t))return[St.empty(t,e)];if(e.property().isNonEditable(t))return[];if(e.property().isElement(t)){const r=e.property().children(t),o=e.property().isBoundary(t)?[St.boundary(t,e)]:[],a=void 0!==n&&n(t)?[]:q(r,(t=>pn(e,t,n)));return o.concat(a).concat(o)}return[]},dn=pn,gn=(e,t,n)=>{const r=((e,t)=>{const n=[];let r=[];return S(e,(e=>{const o=t(e);qt.cata(o,(()=>{r.push(e)}),(()=>{r.length>0&&n.push(r),n.push([e]),r=[]}),(()=>{r.length>0&&n.push(r),r=[]}))})),r.length>0&&n.push(r),n})(q(t,(t=>dn(e,t,n))),(e=>e.match({boundary:()=>qt.excludeWithout(e),empty:()=>qt.excludeWith(e),text:()=>qt.include(e),nonEditable:()=>qt.excludeWithout(e)})));return T(r,(e=>e.length>0))},mn=()=>({left:ft.left,right:ft.right}),hn=ht,fn=(e,t,n)=>{const r=q(n,(e=>[e.start,e.finish])),o=Yt(t,r,((t,n)=>((e,t,n)=>{const r=e.property().getText(t),o=T(((e,t)=>{if(0===t.length)return[e];const n=C(t,((t,n)=>{if(0===n)return t;const r=e.substring(t.prev,n);return{prev:n,values:t.values.concat([r])}}),{prev:0,values:[]}),r=t[t.length-1];return r<e.length?n.values.concat(e.substring(r)):n.values})(r,n),(e=>e.length>0));if(o.length<=1)return[vt(t,0,r.length)];e.property().setText(t,o[0]);const a=Zt(o.slice(1),((t,n)=>{const r=e.create().text(t),o=vt(r,n,n+t.length);return v.some(o)}),o[0].length),s=R(a,(e=>e.element));return e.insert().afterAll(t,s),[vt(t,0,o[0].length)].concat(a)})(e,t.element,n)));return R(n,(t=>{const n=((e,t,n)=>{const r=Xt(e,t),o=Xt(e,n);return r.bind((t=>{const r=o.getOr(((e,t)=>e[e.length-1]&&e[e.length-1].finish===t?e.length+1:-1)(e,n));return r>-1?v.some(e.slice(t,r)):v.none()})).getOr([])})(o,t.start,t.finish),r=R(n,(e=>e.element)),a=R(r,e.property().getText).join("");return{elements:r,word:t.word,exact:a}}))},yn=(e,t,n,r)=>((e,t,n,r)=>{const o=gn(e,t,r);return q(o,(t=>{const r=q(t,(e=>e.fold(cn,cn,(e=>[e]),cn))),o=R(r,e.property().getText).join(""),a=tn(o,n),s=((e,t)=>Zt(t,((t,n)=>{const r=n+e.property().getText(t).length;return v.from(vt(t,n,r))})))(e,r);return fn(e,s,a)}))})(e,t,R(n,(e=>((e,t)=>({word:e,pattern:t}))(e,(e=>{const t="((?:^'?)|(?:"+Vt()+"+'?))"+e+"((?:'?$)|(?:'?"+Vt()+"+))";return _t(t,(e=>e.length>1?e[1].length:0),(e=>e.length>2?e[2].length:0),v.none())})(e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"))))),r),vn=ut(),bn=(e,t)=>h(e.eq,t),xn=(e,t,n)=>{const r=((e,t,n,r=f)=>{const o=[t].concat(e.up().all(t)),a=[n].concat(e.up().all(n)),s=e=>k(e,r).fold((()=>e),(t=>e.slice(0,t+1))),i=s(o),l=s(a),u=A(i,(t=>E(l,bn(e,t))));return{firstpath:i,secondpath:l,shared:u}})(e,t,n);return r.shared.bind((t=>((e,t,n,r)=>{const o=e.property().children(t);if(e.eq(t,n[0]))return v.some([n[0]]);if(e.eq(t,r[0]))return v.some([r[0]]);const a=n=>{const r=(e=>{const t=b.call(e,0);return t.reverse(),t})(n),a=k(r,bn(e,t)).getOr(-1),s=a<r.length-1?r[a+1]:r[a];return k(o,bn(e,s))},s=a(n),i=a(r);return s.bind((e=>i.map((t=>{const n=Math.min(e,t),r=Math.max(e,t);return o.slice(n,r+1)}))))})(e,t,r.firstpath,r.secondpath)))},$n=new RegExp(Kt()+"+","g"),wn=d(0),En=(e,t)=>{const n=e.property();return n.getLanguage(t).orThunk((()=>((e,t)=>{for(let n=0;n<e.length;n++){const r=t(e[n],n);if(r.isSome())return r}return v.none()})(e.up().all(t,f),n.getLanguage)))},Rn=(e,t,n,r)=>({item:e,start:t,finish:n,text:r}),Sn=(e,t)=>({items:e,abort:t}),Tn=(e,t)=>{const n=e.property().getText(t);return Rn(t,0,n.length,n)},Cn=(e,t,n)=>Sn([],!0),An=(e,t,n)=>Sn([],!1),kn=(e,t,n)=>{const r=e.property().getText(t);return n(r).fold((()=>Sn([Rn(t,0,r.length,r)],!1)),(e=>{const n=e[0]===e[1]?[]:[Rn(t,e[0],e[1],r.substring(e[0],e[1]))];return Sn(n,!0)}))},qn=Tn,Bn=(e,t)=>e.property().isText(t)?Tn(e,t):Rn(t,0,0,""),Dn=(e,t,n,r)=>(e.property().isBoundary(t)||e.property().isEmptyTag(t)||r(e,t)?Cn:e.property().isText(t)?kn:An)(e,t,n),Ln=mn(),Pn=Ln.left(),Nn=Ln.right(),On={left:{sibling:Pn.sibling,first:Pn.first,slicer:e=>(e=>{const t=en(e,Gt(Kt(),wn,wn,v.none()));return v.from(t[t.length-1]).map((e=>e.start))})(e).map((t=>[t+1,e.length]))},right:{sibling:Nn.sibling,first:Nn.first,slicer:e=>(e=>{const t=e.search($n);return t>-1?v.some(t):v.none()})(e).map((e=>[0,e]))}},In=(e,t,n,r,o)=>{const a=hn(e,t,n,r).map((t=>{const n=Dn(e,t.item,r.slicer,o),a=n.abort?[]:In(e,t.item,t.mode,r,o);return n.items.concat(a)})).getOr([]);return T(a,(e=>e.text.trim().length>0))},Mn=(e,t,n,r)=>{const o=((e,t,n)=>In(e,t,dt,On.left,n))(e,t,r),a=((e,t,n)=>In(e,t,dt,On.right,n))(e,n,r);return{left:o.length>0?o[o.length-1]:Bn(e,t),right:a.length>0?a[a.length-1]:Bn(e,n),isEmpty:0===o.length&&0===a.length}},zn={...O([{aboveView:["item"]},{inView:["item"]},{belowView:["item"]}]),cata:(e,t,n,r)=>e.fold(t,n,r)},jn=(e,t,n)=>({word:e,left:t,right:n}),Un=["'","\u2018","\u2019"],Hn=q(Un,(e=>R(["twas"],(t=>e+t)))),Wn=e=>w(Un,e),Fn=e=>{const{words:t,indices:n}=((e,t,n)=>{n={includeWhitespace:!1,includePunctuation:!1,...n};const r=R(e,t);return((e,t,n,r)=>{const o=[],a=[];let s=[];for(let i=0;i<n.length;++i)if(s.push(e[i]),on(n,i)){const n=t[i];if((r.includeWhitespace||!an.test(n))&&(r.includePunctuation||!sn.test(n))){const n=i-s.length+1,r=i+1,l=t.slice(n,r).join("");if(ln(l)){const n=un(t,i),o=e.slice(r,n);Array.prototype.push.apply(s,o),i=n}"."===t[i+1]&&/^([a-zA-Z]\.)+$/.test(l+".")?(s.push(e[i+1]),a.push({start:n,end:r+1})):a.push({start:n,end:r}),o.push(s)}s=[]}return{words:o,indices:a}})(e,r,(e=>{const t=(e=>{const t={};return n=>{if(t[n])return t[n];{const r=e(n);return t[n]=r,r}}})(rn);return R(e,t)})(r),n)})(e.split(""),g),r=e.length;return R(t,((t,o)=>{const a=n[o],s=a.start,i=a.end,l=t.join(""),u=s>0?v.some(e.charAt(s-1)):v.none(),c=i<r?v.some(e.charAt(i)):v.none();return(e=>{const t=(e=>{const t=e.word;return t.length>=2&&Wn(t.charAt(t.length-1))&&!Wn(t.charAt(t.length-2))?(e=>{const t=e.word;return jn(t.substring(0,t.length-1),e.left,v.some(t.charAt(t.length-1)))})(e):e})(e);return(e=>{const t=e.word,n=E(Hn,(e=>t.indexOf(e)>-1))?2:1,r=t.substring(0,n);return B(r,Wn)&&!Wn(t.charAt(n))?(e=>{const t=e.word;return jn(t.substring(1),v.some(t.charAt(0)),e.right)})(e):e})(t)})(jn(l,u,c))}))},Qn=(e,t,n)=>e.property().isSpecial(n.item)||e.property().isNonEditable(n.item)?v.some({item:n.item,mode:dt}):e.property().isBoundary(n.item)?zn.cata(t.assess(n.item),(()=>n.mode!==pt?v.some({item:n.item,mode:dt}):v.none()),(()=>v.some(n)),(()=>v.none())):v.some(n),Vn=(e,t,n,r,o)=>{const a=e.property().getLanguage(o.item);e.property().isText(o.item)?t.addDetail(n(e,o.item)):e.property().isBoundary(o.item)?zn.cata(r.assess(o.item),c,(()=>(o.mode===gt?t.openBoundary(a,o.item):t.closeBoundary(a,o.item),v.some(o))),c):e.property().isEmptyTag(o.item)?t.addEmpty(o.item):o.mode===gt?t.openInline(a,o.item):t.closeInline(a,o.item)},_n=(e,t,n,r,o,a)=>(e.eq(t,n)?v.some(t):e.property().parent(t)).map((s=>{const i=En(e,s).getOr(r);return((e,t,n,r,o,a)=>{const s=t=>!e.eq(t.item,n)||t.mode===gt&&!e.property().isText(t.item)&&0!==e.property().children(t.item).length,i=(e=>{let t=[];const n=[];let r=[],o=e;const a=e=>{e.each((e=>{t.push(e)}))},s=e=>{e.each((e=>{t=t.slice(0,t.length-1)}))},i=()=>{r.length>0&&n.push({lang:o,details:r})},l=e=>{i(),r=[],o=e},u=n=>n.or(v.from(t[t.length-1])).getOr(e);return{openInline:(e,t)=>{const n=u(e);n!==o&&l(n),a(e)},closeInline:(e,t)=>{s(e)},addDetail:e=>{const t=u(v.none());t!==o&&l(t),r.push(e)},addEmpty:e=>{const t=u(v.none());l(t)},openBoundary:(e,t)=>{a(e);const n=u(e);l(n)},closeBoundary:(e,t)=>{s(e);const n=u(e);l(n)},done:()=>(i(),n.slice(0))}})(r);let l=v.some({item:t,mode:gt}).filter(s);for(;l.isSome();)l.each((t=>Vn(e,i,o,a,t))),l=l.bind((t=>Qn(e,a,t))).filter(s).bind((t=>hn(e,t.item,t.mode,mn().right()))).filter(s);return e.property().isText(n)&&i.addDetail(o(e,n)),i.done()})(e,t,n,i,o,a)})),Gn=(e,t,n,r,o,a)=>{const s=xn(e,t,n).bind((t=>{if(0===t.length)return v.none();const n=t[0],s=t[t.length-1];return _n(e,n,s,r,o,a)})).getOr([]);return((e,t)=>{const n=R(t,(e=>{const t=e.details,n=e.lang,r=R(t,(e=>e.text)).join(""),o=R(t,(e=>e.item));return{lang:n,words:Fn(r),elements:o}}));return{zones:n}})(0,s)},Kn=(e,t)=>(n,r)=>n.eq(r,e.item)?e:n.eq(r,t.item)?t:qn(n,r),Xn=()=>({zones:[]}),Zn=(e,t,n,r)=>e.property().isBoundary(t)?((e,t,n,r,o)=>Gn(e,t,n,r,qn,o))(e,t,t,n,r):e.property().isEmptyTag(t)?Yn():((e,t,n,r)=>{const o=((e,t)=>{const n=Mn(e,t,t,f),r=n.isEmpty&&((e,t)=>!e.property().isText(t)&&0===e.down().predicate(t,e.property().isText).length)(e,t);return{left:n.left,right:n.right,isEmpty:r}})(e,t),a=Kn(o.left,o.right);return o.isEmpty?Xn():Gn(e,o.left.item,o.right.item,n,a,r)})(e,t,n,r),Yn=Xn,Jn=e=>t=>t.options.get(e),er=e=>t=>v.from(t.options.get(e)),tr={et:"Estonian",eo:"Esperanto","en-US":"English (US)","en-GB":"English (UK)",bg:"Bulgarian",be:"Belarusian",ca:"Catalan",cs:"Czech",ga:"Irish",da:"Danish",nl:"Dutch",fi:"Finnish",de:"German",el:"Greek",hu:"Hungarian",it:"Italian",lv:"Latvian",no:"Norwegian",pl:"Polish",ro:"Romanian",ru:"Russian",sk:"Slovak",sl:"Slovenian",sr:"Serbian",es:"Spanish",sv:"Swedish",tr:"Turkish",uk:"Ukrainian"},nr=D(tr),rr="en-US",or=e=>e in tr,ar=e=>r(e)?{value:e.filter((e=>n(e)&&or(e))),valid:!0}:{valid:!1,message:"Must be an array of strings."},sr=er("typography_rules"),ir=Jn("typography_langs"),lr=er("typography_ignore"),ur=Jn("typography_default_lang"),cr="tinymce-typography-lang",pr=e=>{const t=v.from(tinymce.util.LocalStorage.getItem(cr)).getOr(ur(e));return((e,t)=>!!or(t)&&ir(e).includes(t))(e,t)?t:rr},dr=(e,t)=>{const n=pe.fromDom(e.getBody()),r=e=>ge(e,n),o=rt(t,"[lang]",r).filter((a=r,e=>!a(e))).bind((e=>je(e,"lang"))).getOr(pr(e));var a;return or(o)?o:rr};
|
||
/*! typograf | © 2023 Denis Seleznev | MIT License | https://github.com/typograf/typograf */
|
||
var gr=function(){return gr=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},gr.apply(this,arguments)};function mr(e,t,n){for(var r,o=0,a=t.length;o<a;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var hr=[["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]],fr=[["nbsp",160],["thinsp",8201],["ensp",8194],["emsp",8195],["shy",173],["zwnj",8204],["zwj",8205],["lrm",8206],["rlm",8207]],yr=function(){function e(){var e=this;this.entities=this.prepareEntities(mr(mr([],hr),fr)),this.entitiesByName={},this.entitiesByNameEntity={},this.entitiesByDigitEntity={},this.entitiesByUtf={},this.entities.forEach((function(t){e.entitiesByName[t.name]=t,e.entitiesByNameEntity[t.nameEntity]=t,e.entitiesByDigitEntity[t.digitEntity]=t,e.entitiesByUtf[t.utf]=t})),this.invisibleEntities=this.prepareEntities(fr)}return e.prototype.toUtf=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})))},e.prototype.decHexToUtf=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))}))},e.prototype.restore=function(e){var t=e.prefs.htmlEntity,n=t.type,r=this.entities;if("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))));var o="name"===n?"nameEntity":"digitEntity";e.text=this.restoreEntitiesByIndex(e.text,o,r)}},e.prototype.getByUtf=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},e.prototype.prepareEntities=function(e){var t=[];return e.forEach((function(e){var n=e[0],r=e[1],o=String.fromCharCode(r);t.push({name:n,nameEntity:"&"+n+";",digitEntity:"&#"+r+";",utf:o,reName:new RegExp("&"+n+";","g"),reUtf:new RegExp(o,"g")})})),t},e.prototype.prepareListParam=function(e){var t=this,n=[];return e.forEach((function(e){var r=t.entitiesByName[e];r&&n.push(r)})),n},e.prototype.restoreEntitiesByIndex=function(e,t,n){return n.forEach((function(n){e=e.replace(n.reUtf,n[t])})),e},e}(),vr=new yr,br=[];function xr(e){var t=(e||"").split("/")[0];t&&"common"!==t&&!wr(t)&&(br.push(t),br.sort())}function $r(){return br}function wr(e){return"common"===e||-1!==br.indexOf(e)}function Er(e,t){var n=e||t;return n?Array.isArray(n)?n:[n]:[]}function Rr(e){if(!e.length)throw Error('Not defined the property "locale".');e.forEach((function(e){if(!wr(e))throw Error('"'.concat(e,'" is not supported locale.'))}))}var Sr={};function Tr(e){return Sr[e]}function Cr(e){Object.keys(e).forEach((function(t){xr(t),Sr[t]=e[t]}))}var Ar=["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"],kr=new RegExp("(https?|file|ftp)://([a-zA-Z0-9/+-=%&:_.~?]+[a-zA-Z0-9#+]*)","g"),qr="\\d+([.,]\\d+)?",Br=/\d/;function Dr(e){return e.search(Br)>-1}var Lr="\uf000",Pr="\uf001",Nr=function(){function e(){this.groups=["own","html","url"],this.hidden={},this.counter=0;var e=[["\x3c!--","--\x3e"],["<!ENTITY",">"],["<!DOCTYPE",">"],["<\\?xml","\\?>"],["<!\\[CDATA\\[","\\]\\]>"]];["code","kbd","object","pre","samp","script","style","var"].forEach((function(t){e.push(["<".concat(t,"(\\s[^>]*?)?>"),"</".concat(t,">")])})),this.tags={own:[],html:e.map(this.prepareRegExp),url:[kr]}}return e.prototype.add=function(e){this.tags.own.push(this.prepareRegExp(e))},e.prototype.show=function(e,t){for(var n=new RegExp("\uf000tf\\d+\uf000","g"),r=new RegExp("\uf000tf\\d"),o=function(n){return e.safeTags.hidden[t][n]||n},a=0,s=this.tags[t].length;a<s&&(e.text=e.text.replace(n,o),-1!==e.text.search(r));a++);},e.prototype.hide=function(e,t){var n=this;e.safeTags.hidden[t]={};var r=this.pasteLabel.bind(this,e,t);this.tags[t].forEach((function(t){e.text=e.text.replace(n.prepareRegExp(t),r)}))},e.prototype.hideHTMLTags=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)}},e.prototype.getPrevLabel=function(e,t){for(var n=t-1;n>=0;n--)if(e[n]===Lr)return e.slice(n,t+1);return""},e.prototype.getNextLabel=function(e,t){for(var n=t+1;n<e.length;n++)if(e[n]===Lr)return e.slice(t,n+1);return""},e.prototype.getTagByLabel=function(e,t){var n=null;return this.groups.some((function(r){var o=e.safeTags.hidden[r][t];return void 0!==o&&(n={group:r,value:o}),n})),n},e.prototype.getTagInfo=function(e){if(!e)return null;var t={group:e.group};switch(e.group){case"html":t.name=e.value.split(/[<\s>]/)[1],t.isInline=Ar.indexOf(t.name)>-1,t.isClosing=e.value.search(/^<\//)>-1;break;case"url":t.isInline=!0;break;case"own":t.isInline=!1}return t},e.prototype.pasteLabel=function(e,t,n){var r=e.safeTags,o="\uf000tf"+r.counter+Lr;return r.hidden[t][o]=n,r.counter++,o},e.prototype.prepareRegExp=function(e){if(e instanceof RegExp)return e;var t=e[0],n=e[1],r=e[2];return new RegExp(t+(void 0===r?"[^]*?":r)+n,"gi")},e.prototype.getPrevTagInfo=function(e,t,n){var r=this.getPrevLabel(t,n-1);if(r){var o=this.getTagByLabel(e,r);if(o)return this.getTagInfo(o)}return null},e.prototype.getNextTagInfo=function(e,t,n){var r=this.getNextLabel(t,n+1);if(r){var o=this.getTagByLabel(e,r);if(o)return this.getTagInfo(o)}return null},e}();function Or(e,t){for(var n="";1&~t||(n+=e),0!=(t>>>=1);)e+=e;return n}function Ir(e){return e.replace(/\u00A0/g," ")}function Mr(e,t){for(var n=0;n<t.length;n++)e=e.replace(t[n][0],t[n][1]);return e}function zr(e){return-1!==e.search(/(<\/?[a-z]|<!|&[lg]t;)/i)}function jr(e){return"object"==typeof e?JSON.parse(JSON.stringify(e)):e}var Ur={symbols:110,number:150,space:210,dash:310,punctuation:410,nbsp:510,money:710,date:810,other:910,optalign:1010,typo:1110,html:1210},Hr="default",Wr=[],Fr=[];function Qr(){var e=mr([],Wr);return function(e){e.sort((function(e,t){return e.index>t.index?1:-1}))}(e),e}function Vr(){return mr([],Fr)}function _r(e){if("number"==typeof e.index)return e.index;var t=e.name.split("/")[1],n=Ur[t];return void 0===n&&(n=0),"string"==typeof e.index?n+parseInt(e.index,10):n}function Gr(e){var t=e.name.split("/"),n=t[0],r=t[1],o=t[2];return{name:e.name,shortName:o,handler:e.handler,queue:e.queue||Hr,enabled:!0!==e.disabled,locale:n,group:r,index:_r(e),settings:e.settings,live:e.live,htmlAttrs:e.htmlAttrs}}function Kr(e){return{type:(null==e?void 0:e.type)||"default",list:null==e?void 0:e.list,onlyInvisible:Boolean(null==e?void 0:e.onlyInvisible)}}function Xr(e){return e||"LF"}var Zr=function(){function e(e){var t=this;this.rules=[],this.innerRules=[],this.rulesByQueues={},this.innerRulesByQueues={},this.separatePartsTags=["title","p","h[1-6]","select","legend"],this.prefs=function(e){return{locale:Er(e.locale),lineEnding:Xr(e.lineEnding),live:Boolean(e.live),ruleFilter:e.ruleFilter,enableRule:e.enableRule,disableRule:e.disableRule,processingSeparateParts:e.processingSeparateParts,htmlEntity:Kr(e.htmlEntity)}}(e),Rr(this.prefs.locale),this.safeTags=new Nr,this.settings={},this.enabledRules={},this.innerRulesByQueues={},this.innerRules=Vr(),this.innerRules.forEach((function(e){t.innerRulesByQueues[e.queue]=t.innerRulesByQueues[e.queue]||[],t.innerRulesByQueues[e.queue].push(e)})),this.rulesByQueues={},this.rules=Qr(),this.rules.forEach((function(e){t.prepareRuleSettings(e),t.rulesByQueues[e.queue]=t.rulesByQueues[e.queue]||[],t.rulesByQueues[e.queue].push(e)})),this.prefs.disableRule&&this.disableRule(this.prefs.disableRule),this.prefs.enableRule&&this.enableRule(this.prefs.enableRule)}return e.addRule=function(e){!function(e){var t=Gr(e);xr(t.locale),Wr.push(t)}(e)},e.addRules=function(e){var t=this;e.forEach((function(e){t.addRule(e)}))},e.addInnerRule=function(e){!function(e){Fr.push(Gr(e))}(e)},e.addInnerRules=function(e){var t=this;e.forEach((function(e){t.addInnerRule(e)}))},e.getRule=function(e){var t=null;return Qr().some((function(n){return n.name===e&&(t=n,!0)})),t},e.getRules=function(){return Qr()},e.getInnerRules=function(){return Vr()},e.getLocales=function(){return $r()},e.addLocale=function(e){xr(e)},e.hasLocale=function(e){return wr(e)},e.setData=function(e){Cr(e)},e.getData=function(e){return Tr(e)},e.prototype.execute=function(e,t){if(!(e=""+e))return"";var n=function(e,t){var n=gr({},e);return t?("locale"in t&&(n.locale=Er(t.locale)),"htmlEntity"in t&&(n.htmlEntity=Kr(t.htmlEntity)),"lineEnding"in t&&(n.lineEnding=Xr(t.lineEnding)),"processingSeparateParts"in t&&(n.processingSeparateParts=t.processingSeparateParts),"ruleFilter"in t&&(n.ruleFilter=t.ruleFilter),n):n}(this.prefs,t);Rr(n.locale);var r=this.prepareContext(e,n);return this.process(r)},e.prototype.getSetting=function(e,t){return this.settings[e]&&this.settings[e][t]},e.prototype.setSetting=function(e,t,n){this.settings[e]=this.settings[e]||{},this.settings[e][t]=n},e.prototype.isEnabledRule=function(e){return!1!==this.enabledRules[e]},e.prototype.isDisabledRule=function(e){return!this.enabledRules[e]},e.prototype.enableRule=function(e){return this.enable(e,!0)},e.prototype.disableRule=function(e){return this.enable(e,!1)},e.prototype.addSafeTag=function(e,t,n){var r=e instanceof RegExp?e:[e,t,n];this.safeTags.add(r)},e.prototype.prepareContext=function(e,t){return{text:e,isHTML:zr(e),prefs:t,getData:function(e){return"char"===e?t.locale.map((function(t){return Tr(t+"/"+e)})).join(""):Tr(t.locale[0]+"/"+e)},safeTags:this.safeTags}},e.prototype.splitBySeparateParts=function(e){if(!e.isHTML||!1===e.prefs.processingSeparateParts)return[e.text];var t=[],n=new RegExp("<("+this.separatePartsTags.join("|")+")(\\s[^>]*?)?>[^]*?</\\1>","gi"),r=0;return e.text.replace(n,(function(n,o,a,s){return r!==s&&t.push((r?Pr:"")+e.text.slice(r,s)+Pr),t.push(n),r=s+n.length,n})),t.push(r?Pr+e.text.slice(r,e.text.length):e.text),t},e.prototype.process=function(e){var t=this;e.text=e.text.replace(/\r\n?/g,"\n"),this.executeRules(e,"start"),this.safeTags.hide(e,"own"),this.executeRules(e,"hide-safe-tags-own"),this.safeTags.hide(e,"html"),this.executeRules(e,"hide-safe-tags-html");var n=e.isHTML,r=new RegExp(Pr,"g");return e.text=this.splitBySeparateParts(e).map((function(n){return e.text=n,e.isHTML=zr(n),t.safeTags.hideHTMLTags(e),t.safeTags.hide(e,"url"),t.executeRules(e,"hide-safe-tags-url"),t.executeRules(e,"hide-safe-tags"),vr.toUtf(e),e.prefs.live&&(e.text=Ir(e.text)),t.executeRules(e,"utf"),t.executeRules(e),vr.restore(e),t.executeRules(e,"html-entities"),t.safeTags.show(e,"url"),t.executeRules(e,"show-safe-tags-url"),e.text.replace(r,"")})).join(""),e.isHTML=n,this.safeTags.show(e,"html"),this.executeRules(e,"show-safe-tags-html"),this.safeTags.show(e,"own"),this.executeRules(e,"show-safe-tags-own"),this.executeRules(e,"end"),function(e,t){return"CRLF"===t?e.replace(/\n/g,"\r\n"):"CR"===t?e.replace(/\n/g,"\r"):e}(e.text,e.prefs.lineEnding)},e.prototype.executeRules=function(e,t){var n=this;void 0===t&&(t=Hr);var r=this.rulesByQueues[t],o=this.innerRulesByQueues[t];o&&o.forEach((function(t){n.ruleIterator(e,t)})),r&&r.forEach((function(t){n.ruleIterator(e,t)}))},e.prototype.ruleIterator=function(e,t){if(!(!0===e.prefs.live&&!1===t.live||!1===e.prefs.live&&!0===t.live)&&("common"===t.locale||t.locale===e.prefs.locale[0])&&this.isEnabledRule(t.name)){if(e.prefs.ruleFilter&&!e.prefs.ruleFilter(t))return;this.onBeforeRule&&this.onBeforeRule(t.name,e),e.text=t.handler.call(this,e.text,this.settings[t.name],e),this.onAfterRule&&this.onAfterRule(t.name,e)}},e.prototype.prepareRuleSettings=function(e){this.settings[e.name]=jr(e.settings),this.enabledRules[e.name]=e.enabled},e.prototype.enable=function(e,t){var n=this;Array.isArray(e)?e.forEach((function(e){n.enableByMask(e,t)})):this.enableByMask(e,t)},e.prototype.enableByMask=function(e,t){var n=this;if(e)if(-1!==e.search(/\*/)){var r=new RegExp(e.replace(/\//g,"\\/").replace(/\*/g,".*"));this.rules.forEach((function(e){var o=e.name;r.test(o)&&(n.enabledRules[o]=t)}))}else this.enabledRules[e]=t},e.groups=[],e.titles={},e.version="7.3.0",e}();[{"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"}},{"cs/char":"a-z\xe1\xe9\xed\xf3\xfa\xfd\u010d\u010f\u011b\u0148\u0159\u0161\u0165\u016f\u017e","cs/quote":{left:"\u201e\u201a",right:"\u201c\u2018"}},{"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"},"en-US/shortWord":"a|an|and|as|at|bar|but|by|for|if|in|nor|not|of|off|on|or|out|per|pro|so|the|to|up|via|yet"},{"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/shortWord":"\u0430|\u0431\u044b|\u0432|\u0432\u043e|\u0434\u0430|\u0434\u043e|\u0436\u0435|\u0437\u0430|\u0438|\u0438\u0437|\u043a|\u043a\u043e|\u043b\u0438|\u043d\u0430|\u043d\u0435|\u043d\u0438|\u043d\u043e|\u043e|\u043e\u0431|\u043e\u0442|\u043f\u043e|\u0441|\u0441\u043e|\u0442\u043e|\u0443","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 Cr(e)}));var Yr={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"},Jr={name:"common/html/escape",index:"+100",queue:"end",handler:function(e){return e.replace(/[&<>"'/]/g,(function(e){return Yr[e]}))},disabled:!0},eo=new RegExp("<("+["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"].join("|")+")[>\\s]"),to={name:"common/html/p",index:"+5",queue:"end",handler:function(e){var t=e.split("\n\n");return t.forEach((function(e,t,n){e.trim()&&(eo.test(e)||(n[t]=e.replace(/^(\s*)/,"$1<p>").replace(/(\s*)$/,"</p>$1")))})),t.join("\n\n")},disabled:!0,htmlAttrs:!1},no={name:"common/html/processingAttrs",queue:"hide-safe-tags-own",handler:function(e,t,n){var r=this,o=new RegExp("(^|\\s)("+t.attrs.join("|")+")=(\"[^\"]*?\"|'[^']*?')","gi"),a=jr(n.prefs);return a.ruleFilter=function(e){return!1!==e.htmlAttrs},e.replace(/(<[-\w]+\s)([^>]+?)(?=>)/g,(function(e,t,n){return t+n.replace(o,(function(e,t,n,o){var s=o[0],i=o[o.length-1],l=o.slice(1,-1);return t+n+"="+s+r.execute(l,a)+i}))}))},settings:{attrs:["title","placeholder"]},disabled:!0,htmlAttrs:!1},ro={name:"common/html/url",queue:"end",handler:function(e,t,n){return n.isHTML?e:e.replace(kr,(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,o=t+"://"+n,a='<a href="'+o+'">';return"http"===t||"https"===t?(r=r.replace(/^www\./,""),a+("http"===t?r:t+"://"+r)+"</a>"):a+o+"</a>"}))},disabled:!0,htmlAttrs:!1};Zr.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},Jr,{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},to,no,{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},ro]);var oo={name:"common/nbsp/afterNumber",handler:function(e,t,n){var r="(^|\\s)(\\d{1,5}) (["+n.getData("char")+"]+)";return e.replace(new RegExp(r,"gi"),"$1$2\xa0$3")},disabled:!0},ao={name:"common/nbsp/afterShortWord",handler:function(e,t,n){var r=t.lengthShortWord,o=t.useShortWordList,a=Tr("common/quote"),s=n.getData("char"),i=n.getData("shortWord"),l=" \xa0(\uf000"+a,u="$1$2\xa0",c=new RegExp(o&&void 0!==i?"(^|["+l+"])("+i+") ":"(^|["+l+"])(["+s+"]{1,"+r+"}) ","gim");return e.replace(c,u).replace(c,u)},settings:{lengthShortWord:2,useShortWordList:!1}},so={name:"common/nbsp/beforeShortLastNumber",handler:function(e,t,n){var r=n.getData("quote"),o=n.getData("char"),a=o.toUpperCase(),s=new RegExp("(["+o+a+"]) (?=\\d{1,"+t.lengthLastNumber+"}[-+\u2212%'\""+r.right+")]?([.!?\u2026]( ["+a+"]|$)|$))","gm");return e.replace(s,"$1\xa0")},live:!1,settings:{lengthLastNumber:2}},io={name:"common/nbsp/beforeShortLastWord",handler:function(e,t,n){var r=n.getData("char"),o=r.toUpperCase(),a=new RegExp("(["+r+"\\d]) (["+r+o+"]{1,"+t.lengthLastWord+"}[.!?\u2026])( ["+o+"]|$)","g");return e.replace(a,"$1\xa0$2$3")},settings:{lengthLastWord:3}};function lo(e,t,n,r){return t+n.replace(/([^\u00A0])\u00A0([^\u00A0])/g,"$1 $2")+r}var uo={name:"common/nbsp/nowrap",queue:"end",handler:function(e){return e.replace(/(<nowrap>)(.*?)(<\/nowrap>)/g,lo).replace(/(<nobr>)(.*?)(<\/nobr>)/g,lo)}},co={name:"common/nbsp/replaceNbsp",queue:"utf",live:!1,handler:Ir,disabled:!0};Zr.addRules([oo,{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")}},ao,so,io,{name:"common/nbsp/dpi",handler:function(e){return e.replace(/(\d) ?(lpi|dpi)(?!\w)/,"$1\xa0$2")}},uo,co]);var po={name:"common/number/digitGrouping",index:"310",disabled:!0,handler:function(e,t){return e.replace(new RegExp("(^ ?|\\D |".concat(Lr,")(\\d{1,3}([ \xa0\u202f\u2009]\\d{3})+)(?! ?[\\d-])"),"gm"),(function(e,n,r){return n+r.replace(/\s/g,t.space)})).replace(/(\d{5,}([.,]\d+)?)/g,(function(e,n){var r=n.match(/[.,]/),o=r?n.split(r):[n],a=o[0],s=o[1];return a=a.replace(/(\d)(?=(\d{3})+([^\d]|$))/g,"$1"+t.space),r?a+r+s:a}))},settings:{space:"\u202f"}},go={name:"common/number/mathSigns",handler:function(e){return Mr(e,[[/!=/g,"\u2260"],[/<=/g,"\u2264"],[/(^|[^=])>=/g,"$1\u2265"],[/<=>/g,"\u21d4"],[/<</g,"\u226a"],[/>>/g,"\u226b"],[/~=/g,"\u2245"],[/(^|[^+])\+-/g,"$1\xb1"]])}};Zr.addRules([po,{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")}},go,{name:"common/number/times",handler:function(e){return e.replace(/(\d)[ \u00A0]?[x\u0445][ \u00A0]?(\d)/g,"$1\xd7$2")}}]);var mo={name:"common/other/repeatWord",handler:function(e,t,n){var r=Tr("common/quote"),o=n.getData("char"),a="[;:,.?! \n"+r+"]",s=new RegExp("("+a+"|^)(["+o+"]{"+t.min+",}) \\2("+a+"|$)","gi");return e.replace(s,"$1$2$3")},settings:{min:2},disabled:!0};Zr.addRules([{name:"common/other/delBOM",queue:"start",index:-1,handler:function(e){return 65279===e.charCodeAt(0)?e.slice(1):e}},mo]);var ho={name:"common/punctuation/apostrophe",handler:function(e,t,n){var r="(["+n.getData("char")+"])",o=new RegExp(r+"'"+r,"gi");return e.replace(o,"$1\u2019$2")}},fo=function(){function e(){this.bufferQuotes={left:"\uf005\uf006\uf007",right:"\uf008\uf009\uf0a0"},this.beforeLeft=" \n\t\xa0[(",this.afterRight=" \n\t\xa0!?.:;#*,\u2026)\\]"}return e.prototype.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=jr(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},e.prototype.returnOriginalQuotes=function(e,t,n){for(var r={},o=0;o<n.left.length;o++)r[n.left[o]]=t.left[o],r[n.right[o]]=t.right[o];return e.replace(new RegExp("["+n.left+n.right+"]","g"),(function(e){return r[e]}))},e.prototype.count=function(e){var t={total:0};return e.replace(new RegExp("["+Tr("common/quote")+"]","g"),(function(e){return t[e]||(t[e]=0),t[e]++,t.total++,e})),t},e.prototype.removeDuplicates=function(e,t){var n=t.left[0],r=t.left[1]||n,o=t.right[0];return n!==r?e:e.replace(new RegExp(n+n,"g"),n).replace(new RegExp(o+o,"g"),o)},e.prototype.removeSpacing=function(e,t){for(var n=0,r=t.left.length;n<r;n++){var o=t.left[n],a=t.right[n];e=e.replace(new RegExp(o+"([ \u202f\xa0])","g"),o).replace(new RegExp("([ \u202f\xa0])"+a,"g"),a)}return e},e.prototype.setSpacing=function(e,t){for(var n=0,r=t.left.length;n<r;n++){var o=t.left[n],a=t.right[n];e=e.replace(new RegExp(o+"([^\u202f])","g"),o+"\u202f$1").replace(new RegExp("([^\u202f])"+a,"g"),"$1\u202f"+a)}return e},e.prototype.set=function(e,t){var n=Tr("common/quote"),r=t.settings.left[0],o=t.settings.left[1]||r,a=t.settings.right[0],s=new RegExp("(^|["+this.beforeLeft+"])(["+n+"]+)(?=[^\\s\uf000])","gim"),i=new RegExp("([^\\s\uf000])(["+n+"]+)(?=["+this.afterRight+"]|$)","gim");return e=e.replace(s,(function(e,t,n){return t+Or(r,n.length)})).replace(i,(function(e,t,n){return t+Or(a,n.length)})),e=this.setAboveTags(e,t),r!==o&&(e=this.setInner(e,t.settings)),e},e.prototype.setAboveTags=function(e,t){var n=this,r=Tr("common/quote"),o=t.settings.left[0],a=t.settings.right[0];return e.replace(new RegExp("(^|.)(["+r+"])(.|$)","gm"),(function(r,s,i,l,u){if(s!==Lr&&l!==Lr)return r;if(s===Lr&&l===Lr)return'"'===i?s+n.getAboveTwoTags(e,u+1,t)+l:r;if(s===Lr){var c=n.afterRight.indexOf(l)>-1,p=t.safeTags.getPrevTagInfo(t.context,e,u-1);return c&&p&&"html"===p.group?s+(p.isClosing?a:o)+l:s+(!l||c?a:o)+l}var d=n.beforeLeft.indexOf(s)>-1,g=t.safeTags.getNextTagInfo(t.context,e,u+1);return d&&g&&"html"===g.group?s+(g.isClosing?a:o)+l:s+(!s||d?o:a)+l}))},e.prototype.getAboveTwoTags=function(e,t,n){var r=n.safeTags.getPrevTagInfo(n.context,e,t),o=n.safeTags.getNextTagInfo(n.context,e,t);if(r&&"html"===r.group){if(!r.isClosing)return n.settings.left[0];if(o&&o.isClosing&&r.isClosing)return n.settings.right[0]}return e[t]},e.prototype.setInner=function(e,t){for(var n=t.left[0],r=t.right[0],o=this.getMaxLevel(e,n,r,t.left.length),a=0,s="",i=0,l=e.length;i<l;i++){var u=e[i];u===n?(s+=t.left[a>o-1?o-1:a],++a>o&&(a=o)):u===r?(--a<0&&(a=0),s+=t.right[a]):('"'===u&&(a=0),s+=u)}return s},e.prototype.getMaxLevel=function(e,t,n,r){var o=this.count(e);return o[t]===o[n]?r:Math.min(r,2)},e}(),yo=new fo,vo={};$r().forEach((function(e){vo[e]=jr(Tr(e+"/quote"))}));var bo={name:"common/punctuation/quote",handler:function(e,t,n){var r=t[n.prefs.locale[0]];return r?yo.process({context:n,settings:r,safeTags:this.safeTags}):e},settings:vo},xo={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]),o=vr.getByUtf(r.left[0]),a=vr.getByUtf(r.right[0]),s=vr.getByUtf(r.left[1]),i=vr.getByUtf(r.right[1]);s=s?"|"+s:"",i=i?"|"+i:"";var l=new RegExp("(<[aA]\\s[^>]*?>)("+o+s+")([^]*?)("+a+i+")(</[aA]>)","g");return e.replace(l,"$2$1$3$5$4")}};Zr.addRules([ho,{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")}},bo,xo]);var $o={name:"common/space/beforeBracket",handler:function(e,t,n){var r=n.getData("char"),o=new RegExp("(["+r+".!?,;\u2026)])\\(","gi");return e.replace(o,"$1 (")}},wo={name:"common/space/delRepeatN",index:"-1",handler:function(e,t){var n=t.maxConsecutiveLineBreaks,r=new RegExp("\n{".concat(n+1,",}"),"g"),o=Or("\n",n);return e.replace(r,o)},settings:{maxConsecutiveLineBreaks:2}},Eo={name:"common/space/trimLeft",index:"-4",handler:String.prototype.trimLeft?function(e){return e.trimLeft()}:function(e){return e.replace(/^[\s\uFEFF\xA0]+/g,"")}},Ro={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,"")}},So=new RegExp('(\\D):([^)",:.?\\s\\/\\\\\uf000])',"g"),To={name:"common/space/afterColon",handler:function(e){return e.replace(So,"$1: $2")}},Co={name:"common/space/afterComma",handler:function(e,t,n){var r=n.getData("quote"),o="string"==typeof r?r:r.right;return e.replace(new RegExp('(.),([^)",:.?\\s\\/\\\\\uf000'+o+"])","g"),(function(e,t,n){return Dr(t)&&Dr(n)?e:t+", "+n}))}},Ao=new RegExp("\\?([^).\u2026!;?\\s[\\])\uf000"+Tr("common/quote")+"])","g"),ko={name:"common/space/afterQuestionMark",handler:function(e){return e.replace(Ao,"? $1")}},qo=new RegExp("!([^).\u2026!;?\\s[\\])\uf000"+Tr("common/quote")+"])","g"),Bo={name:"common/space/afterExclamationMark",handler:function(e){return e.replace(qo,"! $1")}},Do=new RegExp(";([^).\u2026!;?\\s[\\])\uf000"+Tr("common/quote")+"])","g"),Lo={name:"common/space/afterSemicolon",handler:function(e){return e.replace(Do,"; $1")}};Zr.addRules([To,Co,ko,Bo,Lo,$o,{name:"common/space/bracket",handler:function(e){return e.replace(/(\() +/g,"(").replace(/ +\)/g,")")}},{name:"common/space/delBeforeDot",handler:function(e){return e.replace(/(^|[^!?:;,.\u2026]) (\.|\.\.\.)(\s|$)/g,"$1$2$3")}},{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(/(^|[^!?:;,.\u2026]) ([!?:;,])(?!\))/g,"$1$2")}},{name:"common/space/delBetweenExclamationMarks",handler:function(e){return e.replace(/([!?]) (?=[!?])/g,"$1")}},{name:"common/space/delLeadingBlanks",handler:function(e){return e.replace(/^[ \t]+/gm,"")},disabled:!0},wo,{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",queue:"end",handler:function(e){return"\n"===e[e.length-1]?e:e+"\n"},live:!1,disabled:!0},{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,"]")}},Eo,Ro]);var Po={name:"common/symbols/arrow",handler:function(e){return Mr(e,[[/(^|[^-])->(?!>)/g,"$1\u2192"],[/(^|[^<])<-(?!-)/g,"$1\u2190"]])}},No={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")}},Oo={name:"common/symbols/copy",handler:function(e){return Mr(e,[[/\(r\)/gi,"\xae"],[/(copyright )?\((c|\u0441)\)/gi,"\xa9"],[/\(tm\)/gi,"\u2122"]])}};Zr.addRules([Po,No,Oo]);var Io={name:"en-US/dash/main",index:"-5",handler:function(e){var t=Tr("common/dash"),n="[ ".concat("\xa0","]"),r="[ ".concat("\xa0","\n]"),o=new RegExp("".concat(n,"(").concat(t,")(").concat(r,")"),"g");return e.replace(o,"".concat("\xa0").concat("\u2014","$2"))}};Zr.addRules([Io]);var Mo={name:"ru/dash/centuries",handler:function(e,t){var n="("+Tr("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"}},zo={name:"ru/dash/daysMonth",handler:function(e,t){var n=new RegExp("(^|\\s)([123]?\\d)("+Tr("common/dash")+")([123]?\\d)[ \xa0]("+Tr("ru/monthGenCase")+")","g");return e.replace(n,"$1$2"+t.dash+"$4\xa0$5")},settings:{dash:"\u2013"}},jo={name:"ru/dash/de",handler:function(e){var t=new RegExp("([a-\u044f\u0451]+) \u0434\u0435"+Tr("ru/dashAfterDe"),"g");return e.replace(t,"$1-\u0434\u0435")},disabled:!0},Uo={name:"ru/dash/decade",handler:function(e,t){var n=new RegExp("(^|\\s)(\\d{3}|\\d)0("+Tr("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"}},Ho={name:"ru/dash/directSpeech",handler:function(e){var t=Tr("common/dash"),n=new RegExp('(["\xbb\u2018\u201c,])[ |\xa0]?('.concat(t,")[ |\xa0]"),"g"),r=new RegExp("(^|".concat(Lr,")(").concat(t,")( |\xa0)"),"gm"),o=new RegExp("([.\u2026?!])[ \xa0](".concat(t,")[ \xa0]"),"g");return e.replace(n,"$1\xa0\u2014 ").replace(r,"$1\u2014\xa0").replace(o,"$1 \u2014\xa0")}},Wo={name:"ru/dash/izpod",handler:function(e){var t=new RegExp(Tr("ru/dashBefore")+"(\u0418|\u0438)\u0437 \u043f\u043e\u0434"+Tr("ru/dashAfter"),"g");return e.replace(t,"$1$2\u0437-\u043f\u043e\u0434")}},Fo={name:"ru/dash/izza",handler:function(e){var t=new RegExp(Tr("ru/dashBefore")+"(\u0418|\u0438)\u0437 \u0437\u0430"+Tr("ru/dashAfter"),"g");return e.replace(t,"$1$2\u0437-\u0437\u0430")}},Qo={name:"ru/dash/ka",handler:function(e){var t=new RegExp("([a-\u044f\u0451]+) \u043a\u0430(\u0441\u044c)?"+Tr("ru/dashAfter"),"g");return e.replace(t,"$1-\u043a\u0430$2")}},Vo={name:"ru/dash/koe",handler:function(e){var t=new RegExp(Tr("ru/dashBefore")+"([\u041a\u043a]\u043e[\u0435\u0439])\\s([\u0430-\u044f\u0451]{3,})"+Tr("ru/dashAfter"),"g");return e.replace(t,"$1$2-$3")}},_o={name:"ru/dash/main",index:"-5",handler:function(e){var t=Tr("common/dash"),n=new RegExp("([ \xa0])("+t+")([ \xa0\\n])","g");return e.replace(n,"\xa0\u2014$3")}},Go={name:"ru/dash/month",handler:function(e,t){var n="("+Tr("ru/month")+")",r="("+Tr("ru/monthPreCase")+")",o=Tr("common/dash"),a=new RegExp(n+" ?("+o+") ?"+n,"gi"),s=new RegExp(r+" ?("+o+") ?"+r,"gi"),i="$1"+t.dash+"$3";return e.replace(a,i).replace(s,i)},settings:{dash:"\u2013"}},Ko={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")}},Xo={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)"+Tr("ru/dashAfter"),"g");return e.replace(t,"$1-$2")}},Zo={name:"ru/dash/time",handler:function(e,t){var n=new RegExp(Tr("ru/dashBefore")+"(\\d?\\d:[0-5]\\d)"+Tr("common/dash")+"(\\d?\\d:[0-5]\\d)"+Tr("ru/dashAfter"),"g");return e.replace(n,"$1$2"+t.dash+"$3")},settings:{dash:"\u2013"}},Yo={name:"ru/dash/to",handler:function(e){var t=new RegExp("(^|[^\u0410-\u042f\u0401\u0430-\u044f\u0451\\w])([\u041e\u043e]\u0442\u043a\u0443\u0434\u0430|[\u041a\u043a]\u0443\u0434\u0430|[\u0413\u0433]\u0434\u0435|[\u041a\u043a]\u043e\u0433\u0434\u0430|[\u0417\u0437]\u0430\u0447\u0435\u043c|[\u041f\u043f]\u043e\u0447\u0435\u043c\u0443|[\u041a\u043a]\u0430\u043a|[\u041a\u043a]\u0430\u043a\u043e[\u0435\u0439\u043c]|[\u041a\u043a]\u0430\u043a\u0430\u044f|[\u041a\u043a]\u0430\u043a\u0438[\u0435\u043c\u0445]|[\u041a\u043a]\u0430\u043a\u0438\u043c\u0438|[\u041a\u043a]\u0430\u043a\u0443\u044e|[\u0427\u0447]\u0442\u043e|[\u0427\u0447]\u0435\u0433\u043e|[\u0427\u0447]\u0435[\u0439\u043c]|[\u0427\u0447]\u044c\u0438\u043c?|[\u041a\u043a]\u0442\u043e|[\u041a\u043a]\u043e\u0433\u043e|[\u041a\u043a]\u043e\u043c\u0443|[\u041a\u043a]\u0435\u043c)( | -|- )(\u0442\u043e|\u043b\u0438\u0431\u043e|\u043d\u0438\u0431\u0443\u0434\u044c)"+Tr("ru/dashAfter"),"g");return e.replace(t,(function(e,t,n,r,o){var a=n+r+o;return"\u043a\u0430\u043a \u0442\u043e"===a||"\u041a\u0430\u043a \u0442\u043e"===a?e:t+n+"-"+o}))}},Jo={name:"ru/dash/kakto",handler:function(e){var t=new RegExp("(^|[^\u0410-\u042f\u0401\u0430-\u044f\u0451\\w])([\u041a\u043a]\u0430\u043a) \u0442\u043e"+Tr("ru/dashAfter"),"g");return e.replace(t,"$1$2-\u0442\u043e")}},ea={name:"ru/dash/weekday",handler:function(e,t){var n="("+Tr("ru/weekday")+")",r=new RegExp(n+" ?("+Tr("common/dash")+") ?"+n,"gi");return e.replace(r,"$1"+t.dash+"$3")},settings:{dash:"\u2013"}},ta={name:"ru/dash/years",handler:function(e,t){var n=Tr("common/dash"),r=new RegExp("(\\D|^)(\\d{4})[ \xa0]?("+n+")[ \xa0]?(\\d{4})(?=[ \xa0]?\u0433)","g");return e.replace(r,(function(e,n,r,o,a){return parseInt(r,10)<parseInt(a,10)?n+r+t.dash+a:e}))},settings:{dash:"\u2013"}};Zr.addRules([Mo,zo,jo,Uo,Ho,Wo,Fo,Qo,Vo,_o,Go,Ko,Xo,Zo,Yo,Jo,ea,ta]);var na="(-|\\.|\\/)",ra="(-|\\/)",oa=new RegExp("(^|\\D)(\\d{4})"+na+"(\\d{2})"+na+"(\\d{2})(\\D|$)","gi"),aa=new RegExp("(^|\\D)(\\d{2})"+ra+"(\\d{2})"+ra+"(\\d{4})(\\D|$)","gi"),sa={name:"ru/date/fromISO",handler:function(e){return e.replace(oa,"$1$6.$4.$2$7").replace(aa,"$1$4.$2.$6$7")}},ia={name:"ru/date/weekday",handler:function(e){var t=Tr("ru/monthGenCase"),n=Tr("ru/weekday"),r=new RegExp("(\\d)( |\xa0)("+t+"),( |\xa0)("+n+")","gi");return e.replace(r,(function(e,t,n,r,o,a){return t+n+r.toLowerCase()+","+o+a.toLowerCase()}))}};Zr.addRules([sa,ia]);var la={name:"ru/money/currency",handler:function(e){var t="([$\u20ac\xa5\u04b0\xa3\u20a4\u20bd])",n="[ \xa0\u2009\u202f]",r=new RegExp("(^|[\\D]{2})"+t+" ?("+qr+"("+n+"\\d{3})*)("+n+"?(\u0442\u044b\u0441\\.|\u043c\u043b\u043d|\u043c\u043b\u0440\u0434|\u0442\u0440\u043b\u043d))?","gm"),o=new RegExp("(^|[\\D])("+qr+") ?"+t,"gm");return e.replace(r,(function(e,t,n,r,o,a,s,i){return t+r+(i?"\xa0"+i:"")+"\xa0"+n})).replace(o,"$1$2\xa0$4")},disabled:!0},ua={name:"ru/money/ruble",handler:function(e){var t="$1\xa0\u20bd",n="(\\d+)( |\xa0)?(\u0440|\u0440\u0443\u0431)\\.",r=new RegExp("^"+n+"$","g"),o=new RegExp(n+"(?=[!?,:;])","g"),a=new RegExp(n+"(?=\\s+[A-\u042f\u0401])","g");return e.replace(r,t).replace(o,t).replace(a,t+".")},disabled:!0};function ca(e,t,n,r){return"\u0434\u0434"===n&&"\u043c\u043c"===r||["\u0440\u0444","\u0440\u0443","\u0440\u0443\u0441","\u043e\u0440\u0433","\u0443\u043a\u0440","\u0431\u0433","\u0441\u0440\u0431"].indexOf(r)>-1?e:t+n+".\xa0"+r+"."}Zr.addRules([la,ua]);var pa={name:"ru/nbsp/abbr",handler:function(e){var t=new RegExp("(^|\\s|".concat(Lr,")([\u0430-\u044f\u0451]{1,3})\\. ?([\u0430-\u044f\u0451]{1,3})\\."),"g");return e.replace(t,ca).replace(t,ca)}},da={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 ")}},ga={name:"ru/nbsp/centuries",handler:function(e){var t=Tr("common/dash"),n="(^|\\s)([VIX]+)",r='(?=[,;:?!"\u2018\u201c\xbb]|$)',o=new RegExp(n+"[ \xa0]?\u0432\\.?"+r,"gm"),a=new RegExp(n+"("+t+")([VIX]+)[ \xa0]?\u0432\\.?([ \xa0]?\u0432\\.?)?"+r,"gm");return e.replace(o,"$1$2\xa0\u0432.").replace(a,"$1$2$3$4\xa0\u0432\u0432.")}},ma={name:"ru/nbsp/dayMonth",handler:function(e){var t=new RegExp("(\\d{1,2}) ("+Tr("ru/shortMonth")+")","gi");return e.replace(t,"$1\xa0$2")}},ha={name:"ru/nbsp/initials",handler:function(e){var t="\xa0\u202f ",n=Tr("ru/quote"),r=new RegExp("(^|["+t+n.left+'\uf000"])([\u0410-\u042f\u0401])\\.['+t+"]?([\u0410-\u042f\u0401])\\.["+t+"]?([\u0410-\u042f\u0401][\u0430-\u044f\u0451]+)","gm");return e.replace(r,"$1$2.\xa0$3.\xa0$4")}},fa={2:"\xb2","\xb2":"\xb2",3:"\xb3","\xb3":"\xb3","":""},ya={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,o,a){return t+n+"\xa0"+r+fa[o||""]+("\xa0"===a?" ":a)}))}},va={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")}},ba={name:"ru/nbsp/ps",handler:function(e){var t=new RegExp("(^|\\s|".concat(Lr,")[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. ")}))}},xa={name:"ru/nbsp/see",handler:function(e){var t=new RegExp("(^|\\s|".concat(Lr,"|\\()(\u0441\u043c|\u0438\u043c)\\.[ \xa0]?([\u0430-\u044f\u04510-9a-z]+)([\\s.,?!]|$)"),"gi");return e.replace(t,(function(e,t,n,r,o){return("\xa0"===t?" ":t)+n+".\xa0"+r+o}))}},$a={name:"ru/nbsp/years",index:"+5",handler:function(e){var t=Tr("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.")}};Zr.addRules([pa,{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")}},da,ga,ma,ha,ya,{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")}},va,ba,{name:"ru/nbsp/rubleKopek",handler:function(e){return e.replace(/(\d) ?(?=(\u0440\u0443\u0431|\u043a\u043e\u043f)\.)/g,"$1\xa0")}},xa,{name:"ru/nbsp/year",handler:function(e){return e.replace(/(^|\D)(\d{4}) ?\u0433([ ,;.\n]|$)/g,"$1$2\xa0\u0433$3")}},$a]);var wa={name:"ru/number/ordinals",handler:function(e,t,n){var r=n.getData("char"),o=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)(?!["+r+"])","g");return e.replace(o,(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 Ea(e,t){var n=new RegExp('<span class="('+t.join("|")+')">([^]*?)</span>',"g");return e.replace(n,"$2")}function Ra(e,t){return e.replace(/<title>[^]*?<\/title>/i,(function(e){return Ea(e,t)}))}Zr.addRules([{name:"ru/number/comma",handler:function(e){return e.replace(/(^|\s)(\d+)\.(\d+[\u00A0\u2009\u202F ]*?[%\u2030\xb0\xd7x])/gim,"$1$2,$3")}},wa]);var Sa=["typograf-oa-lbracket","typograf-oa-n-lbracket","typograf-oa-sp-lbracket"],Ta="ru/optalign/bracket",Ca={name:Ta,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},Aa={name:Ta,queue:"start",handler:function(e){return Ea(e,Sa)},htmlAttrs:!1},ka={name:Ta,queue:"end",handler:function(e){return Ra(e,Sa)},htmlAttrs:!1},qa=["typograf-oa-comma","typograf-oa-comma-sp"],Ba="ru/optalign/comma",Da={name:Ba,handler:function(e,t,n){var r=n.getData("char"),o=new RegExp("(["+r+"\\d\u0301]+), ","gi");return e.replace(o,'$1<span class="typograf-oa-comma">,</span><span class="typograf-oa-comma-sp"> </span>')},disabled:!0,htmlAttrs:!1},La={name:Ba,queue:"start",handler:function(e){return Ea(e,qa)},htmlAttrs:!1},Pa={name:Ba,queue:"end",handler:function(e){return Ra(e,qa)},htmlAttrs:!1},Na=["typograf-oa-lquote","typograf-oa-n-lquote","typograf-oa-sp-lquote"],Oa="ru/optalign/quote",Ia={name:Oa,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"),o=new RegExp("([^\n\uf000])([ \xa0\n])("+n+")","gi");return e.replace(r,'$1<span class="typograf-oa-n-lquote">$2</span>').replace(o,'$1<span class="typograf-oa-sp-lquote">$2</span><span class="typograf-oa-lquote">$3</span>')},disabled:!0,htmlAttrs:!1},Ma={name:Oa,queue:"start",handler:function(e){return Ea(e,Na)},htmlAttrs:!1},za={name:Oa,queue:"end",handler:function(e){return Ra(e,Na)},htmlAttrs:!1};Zr.addRules([Ca,Da,Ia]),Zr.addInnerRules([Aa,ka,La,Pa,Ma,za]);var ja=[];function Ua(e){var t,n,r=e[0],o="";if(e.length<8)return Ha(e);if(e.length>10)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 a=8;a>=2;a--){var s=+e.substr(0,a);if(ja.indexOf(s)>-1){o=e.substr(0,a),e=e.substr(a);break}}return o||(o=e.substr(0,5),e=e.substr(5)),(t?"+7\xa0":"")+(n?"8\xa0":"")+function(e){var t=+e,n=e.length,r=[e],o=!1;if(n>3)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 o=t>900&&t<=999||495===t||499===t;var a=r.join("-");return o?a:"("+a+")"}(o)+"\xa0"+Ha(e)}function Ha(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 Wa(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++)ja.push(n);else ja.push(e)}));var Fa={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=Wa(n);return 12===r.length?t+Ua(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,o){var a=Wa(o);return a.length>=5?t+n+r+Ua(a):e}))}};Zr.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},Fa]);var Qa={name:"ru/punctuation/ano",handler:function(e){var t=new RegExp("([^\xab\u201e[(!?,:;\\-\u2012\u2013\u2014\\s\uf000])(\\s+)(\u0430|\u043d\u043e)(?= |\xa0|\\n)","g");return e.replace(t,"$1,$2$3")}},Va={name:"ru/punctuation/exclamationQuestion",index:"+5",handler:function(e){var t=new RegExp("(^|[^!])!\\?([^?]|$)","g");return e.replace(t,"$1?!$2")}};Zr.addRules([Qa,{name:"ru/punctuation/exclamation",handler:function(e){return e.replace(/(^|[^!])!{2}($|[^!])/gm,"$1!$2").replace(/(^|[^!])!{4}($|[^!])/gm,"$1!!!$2")},live:!1},Va,{name:"ru/punctuation/hellipQuestion",handler:function(e){return e.replace(/(^|[^.])(\.\.\.|\u2026),/g,"$1\u2026").replace(/(!|\?)(\.\.\.|\u2026)(?=[^.]|$)/g,"$1..")}}]);var _a={name:"ru/space/year",handler:function(e,t,n){var r=n.getData("char"),o=new RegExp("(^| |\xa0)(\\d{3,4})(\u0433\u043e\u0434([\u0430\u0443\u0435]|\u043e\u043c)?)([^"+r+"]|$)","g");return e.replace(o,"$1$2 $3$5")}};Zr.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")}},_a]),Zr.addRules([{name:"ru/symbols/NN",handler:function(e){return e.replace(/\u2116\u2116/g,"\u2116")}}]);var Ga={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"},Ka=Object.keys(Ga).join(""),Xa={name:"ru/typo/switchingKeyboardLayout",handler:function(e){var t=new RegExp("(["+Ka+"]{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+=Ga[t[r]];return n}))}};Zr.addRules([Xa]),Zr.setData("fr/quote",{left:"\xab\u2039",right:"\xbb\u203a",spacing:!1});const Za=["common/punctuation/quote","en-US/dash/main","common/nbsp/afterParagraphMark","common/nbsp/afterShortWord","common/nbsp/beforeShortLastNumber","common/nbsp/beforeShortLastWord","common/nbsp/dpi","common/punctuation/apostrophe"],Ya=(e,t,n)=>{const r=new Zr({locale:n});return r.disableRule("*"),r.enableRule(T(sr(e).getOr(Za),h(w,Za))),r.execute(t)},Ja=["common/space/delBeforePunctuation","common/space/afterComma","common/space/afterColon","common/space/delBetweenExclamationMarks","common/space/afterExclamationMark","common/space/afterQuestionMark","common/space/afterSemicolon","common/space/beforeBracket","common/space/bracket","common/space/delBeforeDot","common/space/delBeforePercent","common/space/squareBracket","common/number/mathSigns","common/number/times","common/number/fraction","common/symbols/arrow","common/symbols/cf","common/symbols/copy","common/punctuation/delDoublePunctuation","common/punctuation/hellip","common/nbsp/afterSectionMark"],es=(e,t,n)=>{const r=new Zr({locale:n});return r.disableRule("*"),r.enableRule(T(sr(e).getOr(Ja),h(w,Ja))),r.execute(t)},ts=(e,t)=>{const n=((e,t,n,r,o,a,s)=>{const i=At(e,t,n),l=At(e,r,o);return e.eq(i.element,l.element)?Zn(e,i.element,a,s):((e,t,n,r,o)=>{const a=Mn(e,t,n,f),s=Kn(a.left,a.right);return Gn(e,a.left.item,a.right.item,r,s,o)})(e,i.element,l.element,a,s)})(ut(),t,0,t,"img"===he(r=t)?1:(e=>Ye.getOption(e))(r).fold((()=>Ae(r).length),(e=>e.length)),pr(e),{assess:e=>zn.inView(e)});var r;return C(n.zones,((e,t)=>e.concat((e=>((e,t,n)=>yn(vn,e,t,n))(e.elements,R(e.words,(e=>`${e.left.getOr("")}${e.word}${e.right.getOr("")}`)),f))(t))),[])},ns=(e,t)=>st(t,(t=>"false"!==e.dom.getContentEditableParent(t.dom)&&xe(t)&&!("\ufeff"===t.dom.data))),rs=(e,t)=>!E(lr(e).getOr([]),(e=>((e,t)=>nt(e,t,void 0).isSome())(t,e))),os=(e,t)=>{S(ns(e,t),(t=>{rs(e,t)&&et(t,es(e,Je(t),dr(e,t)))})),((e,t)=>{const n=e=>{for(let r=0;r<e.childNodes.length;r++){const o=pe.fromDom(e.childNodes[r]);if(t(o))return v.some(o);const a=n(e.childNodes[r]);if(a.isSome())return a}return v.none()};return n(e.dom)})(t,(e=>Ue(e,"data-mce-bogus"))).isSome()&&S(ts(e,t),(t=>{var n;E(t.elements,(t=>rs(e,t)))&&(n=t.elements,E(n,(e=>Re(e).exists((e=>Ue(e,"data-mce-bogus")))))&&S(t.elements,((n,r)=>{const o=es(e,t.word,dr(e,pe.fromHtml(t.word)));o!==t.word&&(Re(n).each((e=>{Ue(e,"data-mce-bogus")&&Fe(e)})),0===r?n.dom.replaceWith(o):We(n))})))}))},as=(e,t)=>{e.notificationManager.open({text:t,type:"success",timeout:3e3})},ss=e=>{let t=e.getBody();const n=Se(pe.fromDom(e.selection.getNode()));for(const r of n){if(!e.dom.isEditable(r.dom))break;t=r.dom}S(e.dom.select(((e,t)=>{const n=[],r=l(t)?e=>E(n,(n=>t(n,e))):e=>w(n,e);for(let t=0,o=e.length;t<o;t++){const o=e[t];r(o)||n.push(o)}return n})(R(D(e.schema.getBlockElements()),(e=>e.toLowerCase()))).join(","),t),(t=>{const n=pe.fromDom(t);((e,t=!1)=>{return Ve(e)?e.dom.isContentEditable:(n=e,rt(n,"[contenteditable]")).fold(d(t),(e=>"true"===ot(e)));var n})(n)&&(os(e,n),((e,t)=>{const n=v.from(at(t)).getOr("");let r=0;S(ns(e,t),(t=>{const{length:o}=Je(t);rs(e,t)&&et(t,Ya(e,n,dr(e,t)).slice(r,r+o)),r+=o}))})(e,n))})),as(e,"Document typography has been enhanced")},is=e=>{const t=e.selection.getRng();((e,t)=>{const{startOffset:n,endOffset:r}=t,o=pe.fromDom(t.startContainer),a=pe.fromDom(t.endContainer);let s=!1;S(e.selection.getSelectedBlocks(),(t=>{const i=pe.fromDom(t),l=v.from(at(i)).getOr("");let u=0;S(ns(e,i),(t=>{const i=Je(t),{length:c}=i,p=Ya(e,l,dr(e,t)),d=u,g=u+c;u+=c,rs(e,t)&&(ge(t,o)&&ge(t,a)?et(t,i.slice(0,n)+p.slice(d,g).slice(n,r)+i.slice(r,c)):ge(t,o)?(s=!0,et(t,i.slice(0,n)+p.slice(d,g).slice(n,c))):ge(t,a)?(s=!1,et(t,p.slice(d,g).slice(0,r)+i.slice(r,c))):s&&et(t,p.slice(d,g)))}))}))})(e,t),((e,t)=>{const{startContainer:n,endContainer:r,startOffset:o,endOffset:a}=t,s=(l=pe.fromDom(n),u=o,c=pe.fromDom(r),{start:l,soffset:u,finish:c,foffset:a}),i=e.model.table.getSelectedCells();var l,u,c;i.length>0?S(i,(t=>os(e,pe.fromDom(t)))):tinymce.dom.RangeUtils(e.dom).walk(t,(n=>{S(0===n.length?[t.commonAncestorContainer]:n,(t=>((e,t,n)=>{if(!rs(n,e))return;if(!ge(e,t.start)&&!ge(e,t.finish))return void os(n,e);const r=dr(n,e);if(ge(e,t.start)&&xe(e)){const o=Je(e);et(e,o.slice(0,t.soffset)+es(n,o.slice(t.soffset,o.length),r))}if(ge(e,t.finish)&&xe(e)){const o=Je(e);et(e,es(n,o.slice(0,t.foffset),r)+o.slice(t.foffset,o.length))}})(pe.fromDom(t),s,e)))}))})(e,t),as(e,"The selected content typography has been enhanced")},ls=(e,t)=>{const n=e.dom.isEditable(e.selection.getNode());t.setEnabled(n&&!e.dom.isEmpty(e.getBody())&&!e.mode.isReadOnly())},us=e=>t=>{ls(e,t);const n=(e=>{let t=null;const n=()=>{o(t)||(clearTimeout(t),t=null)};return{cancel:n,throttle:(...r)=>{n(),t=setTimeout((()=>{t=null,e.apply(null,r)}),50)}}})((()=>ls(e,t)));return e.on("SelectionChange AfterSetSelectionRange",n.throttle),e.on("remove",n.cancel),()=>{n.cancel(),e.off("SelectionChange AfterSetSelectionRange",n.throttle),e.off("remove",n.cancel)}};((e,t)=>{const{i18n:n=!0}=t;n&&tinymce.PluginManager.requireLangPack(e,"ar,bg-BG,ca,cs,da,de,el,es,eu,fa,fi,fr-FR,he-IL,hi,hr,hu-HU,id,it,ja,kk,ko-KR,ms,nb-NO,nl,pl,pt-BR,pt-PT,ro,ru,sk,sl-SI,sv-SE,th-TH,tr,uk,vi,zh-CN,zh-TW"),tinymce.PluginManager.add(e,ue(e,t))})("typography",{setup:e=>{(e=>{var t;e.addCommand("mceTypography",(t=()=>(e=>{e.dom.isEditable(e.selection.getNode())&&e.undoManager.transact((()=>{const t=e.selection.isCollapsed(),n=t?e.selection.getBookmark(2):e.selection.getBookmark();t?ss(e):is(e),e.focus(),e.selection.moveToBookmark(n)}))})(e),()=>{e.mode.isReadOnly()||t()}))})(e),(e=>{const t=e.options.register;t("typography_rules",{processor:"string[]"}),t("typography_langs",{processor:ar,default:nr}),t("typography_ignore",{processor:"string[]",default:[]}),t("typography_default_lang",{processor:"string",default:rr})})(e),(e=>{const t=ir(e),n=t=>{t.isEnabled()&&e.execCommand("mceTypography")};if(t.length<=1)e.ui.registry.addButton("typography",{icon:"typography",tooltip:"Typography",onAction:n,onSetup:us(e)}),e.ui.registry.addMenuItem("typography",{icon:"typography",text:"Typography",onAction:n,onSetup:us(e)});else{const r=t=>t===pr(e),o=t=>{(e=>{tinymce.util.LocalStorage.setItem(cr,e)})(t),e.execCommand("mceTypography")};e.ui.registry.addSplitButton("typography",{icon:"typography",tooltip:"Typography",onAction:n,select:r,onSetup:us(e),onItemAction:(e,t)=>o(t),fetch:e=>e(R(t,(e=>({value:e,type:"choiceitem",text:tr[e]}))))}),e.ui.registry.addNestedMenuItem("typography",{icon:"typography",text:"Typography",onSetup:us(e),getSubmenuItems:()=>[{type:"menuitem",text:"Enhance",onAction:n},{type:"nestedmenuitem",text:"Language",getSubmenuItems:()=>R(t,(e=>({active:r(e),type:"togglemenuitem",text:tr[e],onAction:()=>o(e)})))}]})}})(e)}})}(); |