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

10 lines
9.4 KiB
JavaScript
Raw Normal View History

2023-11-01 22:54:59 -04:00
/*!
* Tiny Checklist plugin
*
* Copyright (c) 2023 Ephox Corporation DBA Tiny Technologies, Inc.
* Licensed under the Tiny commercial license. See https://www.tiny.cloud/legal/
*
* Version: 2.0.6-56
*/
!function(){"use strict";const t=t=>parseInt(t,10),e=(t,e)=>{const o=t-e;return 0===o?0:o>0?1:-1},o=(t,e,o)=>({major:t,minor:e,patch:o}),n=e=>{const n=/([0-9]+)\.([0-9]+)\.([0-9]+)(?:(\-.+)?)/.exec(e);return n?o(t(n[1]),t(n[2]),t(n[3])):o(0,0,0)},r=t=>e=>typeof e===t,s=t=>"string"===(t=>{const e=typeof t;return null===t?"null":"object"===e&&Array.isArray(t)?"array":"object"===e&&(o=n=t,(r=String).prototype.isPrototypeOf(o)||(null===(s=n.constructor)||void 0===s?void 0:s.name)===r.name)?"string":e;var o,n,r,s})(t),i=r("boolean"),l=t=>!(t=>null==t)(t),c=r("function"),a=r("number");class u{constructor(t,e){this.tag=t,this.value=e}static some(t){return new u(!0,t)}static none(){return u.singletonNone}fold(t,e){return this.tag?e(this.value):t()}isSome(){return this.tag}isNone(){return!this.tag}map(t){return this.tag?u.some(t(this.value)):u.none()}bind(t){return this.tag?t(this.value):u.none()}exists(t){return this.tag&&t(this.value)}forall(t){return!this.tag||t(this.value)}filter(t){return!this.tag||t(this.value)?this:u.none()}getOr(t){return this.tag?this.value:t}or(t){return this.tag?this:t}getOrThunk(t){return this.tag?this.value:t()}orThunk(t){return this.tag?this:t()}getOrDie(t){if(this.tag)return this.value;throw new Error(null!=t?t:"Called getOrDie on None")}static from(t){return l(t)?u.some(t):u.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(t){this.tag&&t(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}u.singletonNone=new u(!1);const d=(!1,()=>false);const m=Array.prototype.indexOf,h=(t,e)=>{return o=t,n=e,m.call(o,n)>-1;var o,n},g=(t,e)=>{const o=t.length,n=new Array(o);for(let r=0;r<o;r++){const o=t[r];n[r]=e(o,r)}return n},f=(t,e)=>{for(let o=0,n=t.length;o<n;o++)e(t[o],o)},p=(t,e)=>{const o=[];for(let n=0,r=t.length;n<r;n++){const r=t[n];e(r,n)&&o.push(r)}return o},v=Object.keys;"undefined"!=typeof window?window:Function("return this;")();const k=t=>t.dom.nodeName.toLowerCase(),y=t=>e=>(t=>t.dom.nodeType)(e)===t,w=y(1),L=y(3),b=y(9),N=y(11),S=t=>e=>w(e)&&k(e)===t,x=(t,e,o)=>{if(!(s(o)||i(o)||a(o)))throw console.error("Invalid call to Attribute.set. Key ",e,":: Value ",o,":: Element ",t),new Error("Attribute value was not simple");t.setAttribute(e,o+"")},T=(t,e,o)=>{x(t.dom,e,o)},C=(t,e)=>{t.dom.removeAttribute(e)},O=(t,e)=>{const o=((t,e)=>{const o=t.dom.getAttribute(e);return null===o?void 0:o})(t,e);return void 0===o||""===o?[]:o.split(" ")},A=t=>void 0!==t.dom.classList,E=t=>O(t,"class"),D=(t,e)=>((t,e,o)=>{const n=O(t,e).concat([o]);return T(t,e,n.join(" ")),!0})(t,"class",e),M=(t,e)=>((t,e,o)=>{const n=p(O(t,e),(t=>t!==o));return n.length>0?T(t,e,n.join(" ")):C(t,e),!1})(t,"class",e),j=(t,e)=>{A(t)?t.dom.classList.add(e):D(t,e)},B=t=>{0===(A(t)?t.dom.classList:E(t)).length&&C(t,"class")},P=(t,e)=>{A(t)?t.dom.classList.remove(e):M(t,e),B(t)},I=(t,e)=>A(t)&&t.dom.classList.contains(e),U=t=>{if(null==t)throw new Error("Node cannot be null or undefined");return{dom:t}},V=(t,e)=>{const o=(e||document).createElement(t);return U(o)},R=U,q=(t,e)=>{const o=t.dom;if(1!==o.nodeType)return!1;{const t=o;if(void 0!==t.matches)return t.matches(e);if(void 0!==t.msMatchesSelector)return t.msMatchesSelector(e);if(void 0!==t.webkitMatchesSelector)return t.webkitMatchesSelector(e);if(void 0!==t.mozMatchesSelector)return t.mozMatchesSelector(e);throw new Error("Browser lacks native selectors")}},X=t=>u.from(t.dom.parentNode).map(R),$=t=>g(t.dom.childNodes,R),z=t=>((t,e)=>{const o=t.dom.childNodes;return u.from(o[0]).map(R)})(t),F=c(Element.prototype.attachShadow)&&c(Node.prototype.getRootNode)?t=>R(t.dom.getRootNode()):t=>b(t)?t:R(t.dom.ownerDocument),K=t=>R(t.dom.host),Y=t=>{const e=L(t)?t.dom.parentNode:t.dom;if(null==e||null===e.ownerDocument)return!1;const o=e.ownerDocument;return(t=>{const e=F(t);return N(o=e)&&l(o.dom.host)?u.some(e):u.none();var o})(R(e)).fold((()=>o.body.contains(e)),(n=Y,r=K,t=>n(r(t))));var n,r},G=(t,e)=>({left:t,top:e,translate:(o,n)=>G(t+o,e+n)}),H=G,J=(t,e)=>void 0!==t?t:void 0!==e?e:0,Q=t=>