fuck-tiny-cloud/plugins/footnotes/plugin.min.js

10 lines
20 KiB
JavaScript
Raw Normal View History

2023-11-01 22:54:59 -04:00
/*!
* Tiny Footnotes plugin
*
* Copyright (c) 2022 Ephox Corporation DBA Tiny Technologies, Inc.
* Licensed under the Tiny commercial license. See https://www.tiny.cloud/legal/
*
* Version: 1.0.1-38
*/
!function(){"use strict";const e=e=>parseInt(e,10),t=(e,t)=>{const o=e-t;return 0===o?0:o>0?1:-1},o=(e,t,o)=>({major:e,minor:t,patch:o}),n=t=>{const n=/([0-9]+)\.([0-9]+)\.([0-9]+)(?:(\-.+)?)/.exec(t);return n?o(e(n[1]),e(n[2]),e(n[3])):o(0,0,0)},r=e=>t=>typeof t===e,i=e=>"string"===(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&(o=n=e,(r=String).prototype.isPrototypeOf(o)||(null===(i=n.constructor)||void 0===i?void 0:i.name)===r.name)?"string":t;var o,n,r,i})(e),s=r("boolean"),a=e=>!(e=>null==e)(e),d=r("function"),l=r("number"),c=()=>{},m=e=>()=>e,u=(e,t)=>e===t,f=m(!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 a(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 g=Array.prototype.indexOf,p=(e,t)=>{return o=e,n=t,g.call(o,n)>-1;var o,n},y=(e,t)=>{for(let o=0,n=e.length;o<n;o++)if(t(e[o],o))return!0;return!1},v=(e,t)=>{const o=e.length,n=new Array(o);for(let r=0;r<o;r++){const o=e[r];n[r]=t(o,r)}return n},b=(e,t)=>{for(let o=0,n=e.length;o<n;o++)t(e[o],o)},x=(e,t)=>{const o=[];for(let n=0,r=e.length;n<r;n++){const r=e[n];t(r,n)&&o.push(r)}return o},w=(e,t,o)=>(b(e,((e,n)=>{o=t(o,e,n)})),o),T=e=>{const t=[],o=e=>{t.push(e)};for(let t=0;t<e.length;t++)e[t].each(o);return t},I=(e,t)=>k(e,t)?((e,t)=>e.substring(t))(e,t.length):e,k=(e,t)=>((e,t,o)=>""===t||e.length>=t.length&&e.substr(0,0+t.length)===t)(e,t),P=(D=/^\s+|\s+$/g,e=>e.replace(D,""));var D;const S="\xa0",C=Object.keys,N=Object.hasOwnProperty,E=(e,t)=>N.call(e,t);"undefined"!=typeof window?window:Function("return this;")();const $=e=>e.dom.nodeName.toLowerCase(),W=e=>e.dom.nodeType,A=e=>t=>W(t)===e,B=A(1),F=A(3),M=A(9),_=A(11),O=(e,t,o)=>{if(!(i(o)||s(o)||l(o)))throw console.error("Invalid call to Attribute.set. Key ",t,":: Value ",o,":: Element ",e),new Error("Attribute value was not simple");e.setAttribute(t,o+"")},U=(e,t,o)=>{O(e.dom,t,o)},j=(e,t)=>{const o=e.dom;((e,t)=>{const o=C(e);for(let n=0,r=o.length;n<r;n++){const r=o[n];t(e[r],r)}})(t,((e,t)=>{O(o,t,e)}))},L=(e,t)=>{const o=e.dom.getAttribute(t);return null===o?void 0:o},V=(e,t)=>h.from(L(e,t)),R=(e,t)=>{e.dom.removeAttribute(t)},q=e=>{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},H={fromHtml:(e,t)=>{const o=(t||document).createElement("div");if(o.innerHTML=e,!o.hasChildNodes()||o.childNodes.length>1){const t="HTML does not have a single root node";throw console.error(t,e),new Error(t)}return q(o.childNodes[0])},fromTag:(e,t)=>{const o=(t||document).createElement(e);return q(o)},fromText:(e,t)=>{const o=(t||document).createTextNode(e);return q(o)},fromDom:q,fromPoint:(e,t,o)=>h.from(e.dom.elementFromPoint(t,o)).map(q)},z=(e,t)=>{const o=e.dom;if(1!==o.nodeType)return!1;{const e=o;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")}},K=e=>1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType||0===e.childElementCount,G=(e,t)=>e.dom===t.dom,J=z,Q=e=>void 0!==e.style&&d(e.style.getPropertyValue),X=e=>H.fromDom(e.dom.ownerDocum