12 lines
64 KiB
JavaScript
12 lines
64 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: 1.1.2-44
|
||
|
*/
|
||
|
|
||
|
!function(){"use strict";const e=e=>parseInt(e,10),t=(e,t)=>{const n=e-t;return 0===n?0:n>0?1:-1},n=(e,t,n)=>({major:e,minor:t,patch:n}),r=t=>{const r=/([0-9]+)\.([0-9]+)\.([0-9]+)(?:(\-.+)?)/.exec(t);return r?n(e(r[1]),e(r[2]),e(r[3])):n(0,0,0)},a=e=>t=>(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&(n=r=e,(a=String).prototype.isPrototypeOf(n)||(null===(o=r.constructor)||void 0===o?void 0:o.name)===a.name)?"string":t;var n,r,a,o})(t)===e,o=a("string"),i=a("array"),s=(null,e=>null===e);const u=e=>!(e=>null==e)(e),c=e=>"function"==typeof e,l=e=>()=>e;function p(e,...t){return(...n)=>{const r=t.concat(n);return e.apply(null,r)}}const g=l(!1);class h{constructor(e,t){this.tag=e,this.value=t}static some(e){return new h(!0,e)}static none(){return h.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?h.some(e(this.value)):h.none()}bind(e){return this.tag?e(this.value):h.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:h.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(null!=e?e:"Called getOrDie on None")}static from(e){return u(e)?h.some(e):h.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()"}}h.singletonNone=new h(!1);const f=Array.prototype.indexOf,d=(e,t)=>((e,t)=>f.call(e,t))(e,t)>-1,m=(e,t)=>{for(let n=0,r=e.length;n<r;n++)if(t(e[n],n))return!0;return!1},v=(e,t)=>{const n=e.length,r=new Array(n);for(let a=0;a<n;a++){const n=e[a];r[a]=t(n,a)}return r},y=(e,t)=>{for(let n=0,r=e.length;n<r;n++)t(e[n],n)},b=(e,t)=>{const n=[];for(let r=0,a=e.length;r<a;r++){const a=e[r];t(a,r)&&n.push(a)}return n},$=Object.keys,x=e=>{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},R=x;"undefined"!=typeof window?window:Function("return this;")();const E=e=>t=>(e=>e.dom.nodeType)(t)===e,w=E(3),q=E(9),k=E(11),A=(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")}},S=(e,t)=>e.dom===t.dom,T=c(Element.prototype.attachShadow)&&c(Node.prototype.getRootNode)?e=>R(e.dom.getRootNode()):e=>q(e)?e:R(e.dom.ownerDocument),B=e=>R(e.dom.host),L=e=>{const t=w(e)?e.dom.parentNode:e.dom;if(null==t||null===t.ownerDocument)return!1;const n=t.ownerDocument;return(e=>{const t=T(e);return k(n=t)&&u(n.dom.host)?h.some(t):h.none();var n})(R(t)).fold((()=>n.body.contains(t)),(r=L,a=B,e=>r(a(e))));var r,a},C=(e,t,n)=>((e,n,r)=>{let a=e.dom;const o=c(r)?r:g;for(;a.parentNode;){a=a.parentNode;const e=R(a);if(A(e,t))return h.some(e);if(o(e))break}return h.none()})(e,0,n),D=(e,t,n)=>((e,t,n,r,a)=>e(n,r)?h.some(n):c(a)&&a(n)?h.none():t(n,r,a))(((e,t)=>A(e,t)),C,e,t,n),I=e=>e.dom.contentEditable,N=(e,t)=>{let n=[];return y(v(e.dom.childNodes,R),(e=>{t(e)&&(n=n.concat([e])),n=n.concat(N(e,t))})),n},O=((e,t)=>{const n=t=>e(t)?h.from(t.dom.nodeValue):h.none();return{get:t=>{if(!e(t))throw new Error("Can only get text value of a text node");return n(t).getOr("")},getOption:n,set:(t,n)=>{if(!e(t))throw new Error("Can only set raw text value of a text node");t.dom.nodeValue=n}}})(w),z=e=>O.get(e),M=(e,t)=>O.set(e,t),P=e=>e.dom.textContent,j=e=>t=>t.options.get(e),U=e=>t=>h.from(t.options.get(e)),_={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:
|
||
|
/*! typograf | © 2023 Denis Seleznev | MIT License | https://github.com/typograf/typograf */
|
||
|
var ee=function(){return ee=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},ee.apply(this,arguments)};function te(e,t,n){if(n||2===arguments.length)for(var r,a=0,o=t.length;a<o;a++)!r&&a in t||(r||(r=Array.prototype.slice.call(t,0,a)),r[a]=t[a]);return e.concat(r||Array.prototype.slice.call(t))}var ne=[["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]],re=[["nbsp",160],["thinsp",8201],["ensp",8194],["emsp",8195],["shy",173],["zwnj",8204],["zwj",8205],["lrm",8206],["rlm",8207]],ae=function(){function e(){var e=this;this.entities=this.prepareEntities(te(te([],ne,!0),re,!0)),this.entitiesByName={},this.entitiesByNameEn
|