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

10 lines
31 KiB
JavaScript
Raw Normal View History

2023-11-01 22:54:59 -04:00
/*!
* Tiny Comments plugin
*
* Copyright (c) 2023 Ephox Corporation DBA Tiny Technologies, Inc.
* Licensed under the Tiny commercial license. See https://www.tiny.cloud/legal/
*
* Version: 3.4.0-125
2023-11-01 22:54:59 -04:00
*/
!function(){"use strict";const e=e=>{let t=e;return{get:()=>t,set:e=>{t=e}}},t=Object.getPrototypeOf,o=(e,t,o)=>{var n;return!!o(e,t.prototype)||(null===(n=e.constructor)||void 0===n?void 0:n.name)===t.name},n=e=>t=>(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&o(e,String,((e,t)=>t.isPrototypeOf(e)))?"string":t})(t)===e,r=e=>t=>typeof t===e,s=e=>t=>e===t,a=n("string"),i=n("object"),c=e=>((e,n)=>i(e)&&o(e,n,((e,o)=>t(e)===o)))(e,Object),l=s(null),m=r("boolean"),d=s(void 0),u=e=>!(e=>null==e)(e),h=r("function"),_=r("number");class v{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(null!=e?e:"Called getOrDie on None")}static from(e){return u(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()"}}v.singletonNone=new v(!1);const p=e=>parseInt(e,10),g=(e,t)=>{const o=e-t;return 0===o?0:o>0?1:-1},y=(e,t,o)=>({major:e,minor:t,patch:o}),f=e=>{const t=/([0-9]+)\.([0-9]+)\.([0-9]+)(?:(\-.+)?)/.exec(e);return t?y(p(t[1]),p(t[2]),p(t[3])):y(0,0,0)};let b=0;const w=e=>{const t=(new Date).getTime(),o=Math.floor(1e9*Math.random());return b++,e+"_"+o+b+String(t)},S=()=>{},C=e=>()=>e,x=e=>e,O=e=>e(),A=C(!1),R=C(!0),E=Array.prototype.indexOf,D=(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},k=(e,t)=>{for(let o=0,n=e.length;o<n;o++)t(e[o],o)},T=(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},M=(e,t)=>((e,t,o)=>{for(let n=0,r=e.length;n<r;n++){const r=e[n];if(t(r,n))return v.some(r);if(o(r,n))break}return v.none()})(e,t,A),L=Object.keys,N=Object.hasOwnProperty,U=(e,t)=>{const o=L(e);for(let n=0,r=o.length;n<r;n++){const r=o[n];t(e[r],r)}},j=(e,t)=>P(e,((e,o)=>({k:o,v:t(e,o)}))),P=(e,t)=>{const o={};return U(e,((e,n)=>{const r=t(e,n);o[r.k]=r.v})),o},$=(e,t)=>N.call(e,t);"undefined"!=typeof window?window:Function("return this;")();const I=e=>t=>(e=>e.dom.nodeType)(t)===e,F=I(1),H=I(9),B=e=>t=>F(t)&&t.dom.nodeName.toLowerCase()===e,V=(e,t,o)=>{if(!(a(o)||m(o)||_(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+"")},Y=(e,t,o)=>{V(e.dom,t,o)},W=(e,t)=>{const o=e.dom.getAttribute(t);return null===o?void 0:o},G=(e,t)=>v.from(W(e,t)),q=(e,t)=>{e.dom.removeAttribute(t)},z=(e,t,o=0,n)=>{const r=e.indexOf(t,o);return-1!==r&&(!!d(n)||r+t.length<=n)},J=e=>t=>t.replace(e,""),K=J(/^\s+|\s+$/g),Q=J(/^\s+/g),X=e=>{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},Z=(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 X(o.childNodes[0])},ee=(e,t)=>{const o=(t||document).createElement(e);return X(o)},te=X,oe=e=>1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType||0===e.childElementCount,ne=e=>te(e.dom.ownerDocument),re=e=>v.from(e.dom.parentNode).map(te),se=e=>D(e.dom.childNodes,te),ae=h(Element.prototype.attachShadow)&&h(Node.prototype.getRootNode)?e=>te(e.dom.getRootNode()):e=>H(e)?e:ne(e),ie=()=>ce(te(document)),ce=e=>{const t=e.dom.body;if(null==t)throw new Error("Body is not available yet");return te(t)},le=(e,t)=>{e.dom.appendChild(t.dom)},me=e=>{e.dom.textContent="",