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

10 lines
44 KiB
JavaScript
Raw Permalink Normal View History

2023-11-01 22:54:59 -04:00
/*!
2024-03-21 17:16:22 -04:00
* Tiny Image Editing plugin
2023-11-01 22:54:59 -04:00
*
* Copyright (c) 2023 Ephox Corporation DBA Tiny Technologies, Inc.
* Licensed under the Tiny commercial license. See https://www.tiny.cloud/legal/
*
2024-03-21 17:16:22 -04:00
* Version: 7.0.0-22
2023-11-01 22:54:59 -04:00
*/
2024-03-21 17:16:22 -04:00
!function(){"use strict";const e=e=>{let t=e;return{get:()=>t,set:e=>{t=e}}},t=e=>parseInt(e,10),r=(e,t)=>{const r=e-t;return 0===r?0:r>0?1:-1},o=(e,t,r)=>({major:e,minor:t,patch:r}),n=e=>{const r=/([0-9]+)\.([0-9]+)\.([0-9]+)(?:(\-.+)?)/.exec(e);return r?o(t(r[1]),t(r[2]),t(r[3])):o(0,0,0)},a=Object.getPrototypeOf,i=(e,t,r)=>{var o;return!!r(e,t.prototype)||(null===(o=e.constructor)||void 0===o?void 0:o.name)===t.name},s=e=>t=>(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&i(e,String,((e,t)=>t.isPrototypeOf(e)))?"string":t})(t)===e,l=e=>t=>typeof t===e,d=s("string"),c=s("object"),u=e=>((e,t)=>c(e)&&i(e,t,((e,t)=>a(e)===t)))(e,Object),m=s("array"),h=l("boolean"),g=(void 0,e=>undefined===e);const p=e=>!(e=>null==e)(e),f=l("function"),y=l("number"),b=()=>{},w=e=>()=>e,v=e=>e,x=(e,t)=>e===t;function S(e,...t){return(...r)=>{const o=t.concat(r);return e.apply(null,o)}}const O=e=>e(),I=w(!1),E=w(!0);class P{constructor(e,t){this.tag=e,this.value=t}static some(e){return new P(!0,e)}static none(){return P.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?P.some(e(this.value)):P.none()}bind(e){return this.tag?e(this.value):P.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:P.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 p(e)?P.some(e):P.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()"}}P.singletonNone=new P(!1);const C=Object.keys,D=Object.hasOwnProperty,R=(e,t)=>{const r=C(e);for(let o=0,n=r.length;o<n;o++){const n=r[o];t(e[n],n)}},M=(e,t)=>D.call(e,t),U=Array.prototype.indexOf,A=(e,t)=>((e,t)=>U.call(e,t))(e,t)>-1,F=(e,t)=>{const r=e.length,o=new Array(r);for(let n=0;n<r;n++){const r=e[n];o[n]=t(r,n)}return o},T=(e,t)=>{for(let r=0,o=e.length;r<o;r++)t(e[r],r)},k=(e,t,r)=>(T(e,((e,o)=>{r=t(r,e,o)})),r),L=(e,t)=>((e,t,r)=>{for(let o=0,n=e.length;o<n;o++){const n=e[o];if(t(n,o))return P.some(n);if(r(n,o))break}return P.none()})(e,t,I),_=e=>{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},N=(e,t)=>{const r=(t||document).createElement(e);return _(r)},z=_,j=(e,t)=>{const r=void 0===t?document:t.dom;return 1!==(o=r).nodeType&&9!==o.nodeType&&11!==o.nodeType||0===o.childElementCount?P.none():P.from(r.querySelector(e)).map(z);var o};"undefined"!=typeof window?window:Function("return this;")();const B=e=>t=>(e=>e.dom.nodeType)(t)===e,G=B(1),H=B(3),V=B(9),W=B(11),X=f(Element.prototype.attachShadow)&&f(Node.prototype.getRootNode),Y=w(X),J=X?e=>z(e.dom.getRootNode()):e=>V(e)?e:z(e.dom.ownerDocument),q=e=>z(e.dom.host),K=e=>{const t=H(e)?e.dom.parentNode:e.dom;if(null==t||null===t.ownerDocument)return!1;const r=t.ownerDocument;return(e=>{const t=J(e);return W(r=t)&&p(r.dom.host)?P.some(t):P.none();var r})(z(t)).fold((()=>r.body.contains(t)),(o=K,n=q,e=>o(n(e))));var o,n},Z=(e,t)=>((e,r)=>L(e.dom.childNodes,(e=>((e,t)=>{const r=e.dom;if(1!==r.nodeType)return!1;{const e=r;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")}})(z(e),t))).map(z))(e),$=(e,t)=>j(t,e),Q=e=>{const t=z((e=>{if(Y()&&p(e.target)){const t=z(e.target);if(G(t)&&p(t.dom.shadowRoot)&&e.composed&&e.composedPath){const t=e.composedPath();if(t)return((e,t)=>0<e.length?P.some(e[0]):P.none())(t)}}return P.from(e.target)})(e).getOr(e.target)),r=()=>e.stopPropagation(),o=()=>e.preventDefault(),n=(a=o,i=r,(...e)=>a(i.