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

10 lines
60 KiB
JavaScript
Raw Normal View History

2023-11-01 22:54:59 -04:00
/*!
* Tiny Page Embed plugin
*
* Copyright (c) 2023 Ephox Corporation DBA Tiny Technologies, Inc.
* Licensed under the Tiny commercial license. See https://www.tiny.cloud/legal/
*
* Version: 2.3.0-72
2023-11-01 22:54:59 -04:00
*/
!function(){"use strict";const t=t=>parseInt(t,10),e=(t,e)=>{const n=t-e;return 0===n?0:n>0?1:-1},n=(t,e,n)=>({major:t,minor:e,patch:n}),r=e=>{const r=/([0-9]+)\.([0-9]+)\.([0-9]+)(?:(\-.+)?)/.exec(e);return r?n(t(r[1]),t(r[2]),t(r[3])):n(0,0,0)},i=[{text:"Responsive - 21x9",value:"tiny-pageembed--21by9"},{text:"Responsive - 16x9",value:"tiny-pageembed--16by9"},{text:"Responsive - 4x3",value:"tiny-pageembed--4by3"},{text:"Responsive - 1x1",value:"tiny-pageembed--1by1"}],s=t=>e=>e.options.get(t),o=s("tiny_pageembed_classes"),a=s("tiny_pageembed_inline_styles"),l=s("tiny_pageembed_css_url"),c=t=>e=>(t=>{const e=typeof t;return null===t?"null":"object"===e&&Array.isArray(t)?"array":"object"===e&&(n=r=t,(i=String).prototype.isPrototypeOf(n)||(null===(s=r.constructor)||void 0===s?void 0:s.name)===i.name)?"string":e;var n,r,i,s})(e)===t,u=t=>e=>typeof e===t,h=c("string"),d=c("array"),p=u("boolean"),f=(void 0,t=>undefined===t);const m=t=>!(t=>null==t)(t),g=u("function"),k=u("number"),y=()=>{};class b{constructor(t,e){this.tag=t,this.value=e}static some(t){return new b(!0,t)}static none(){return b.singletonNone}fold(t,e){return this.tag?e(this.value):t()}isSome(){return this.tag}isNone(){return!this.tag}map(t){return this.tag?b.some(t(this.value)):b.none()}bind(t){return this.tag?t(this.value):b.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:b.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 m(t)?b.some(t):b.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()"}}b.singletonNone=new b(!1);const S=Array.prototype.slice,v=Array.prototype.indexOf,C=Array.prototype.push,w=(t,e)=>((t,e)=>v.call(t,e))(t,e)>-1,x=(t,e)=>{const n=t.length,r=new Array(n);for(let i=0;i<n;i++){const n=t[i];r[i]=e(n,i)}return r},A=(t,e)=>{for(let n=0,r=t.length;n<r;n++)e(t[n],n)},L=(t,e)=>{const n=[];for(let r=0,i=t.length;r<i;r++){const i=t[r];e(i,r)&&n.push(i)}return n},_=(t,e,n)=>(A(t,((t,r)=>{n=e(n,t,r)})),n),T=t=>{const e=[];for(let n=0,r=t.length;n<r;++n){if(!d(t[n]))throw new Error("Arr.flatten item "+n+" was not an array, input: "+t);C.apply(e,t[n])}return e},E=(t,e)=>T(x(t,e)),O=Object.keys,I=Object.hasOwnProperty,P=(t,e)=>{const n=O(t);for(let r=0,i=n.length;r<i;r++){const i=n[r];e(t[i],i)}};"undefined"!=typeof window?window:Function("return this;")();const N=t=>1===(t=>t.dom.nodeType)(t),M=(t,e,n)=>{((t,e,n)=>{if(!(h(n)||p(n)||k(n)))throw console.error("Invalid call to Attribute.set. Key ",e,":: Value ",n,":: Element ",t),new Error("Attribute value was not simple");t.setAttribute(e,n+"")})(t.dom,e,n)},j=(t,e)=>{const n=t.dom.getAttribute(e);return null===n?void 0:n},D=(t,e)=>b.from(j(t,e)),R=t=>{if(null==t)throw new Error("Node cannot be null or undefined");return{dom:t}},B=(t,e)=>{const n=(e||document).createElement(t);return R(n)},z=R,U=t=>void 0!==t.dom.classList,F=(t,e)=>{U(t)?t.dom.classList.add(e):((t,e)=>{((t,e,n)=>{const r=((t,e)=>{const n=j(t,e);return void 0===n||""===n?[]:n.split(" ")})(t,e),i=r.concat([n]);M(t,e,i.join(" "))})(t,"class",e)})(t,e)},V=(t,e)=>U(t)&&t.dom.classList.contains(e),$="tiny-pageembed",G=t=>V(t,$),W=t=>{const e=t.attr("class");return m(e)&&((t,e,n=0,r)=>{const i=t.indexOf(e,n);return-1!==i&&(!!f(r)||i+e.length<=r)})(" "+e+" "," "+$+" ")},q=t=>{A(t,(t=>{if(W(t)){const e=new tinymce.html.Node("span",1);e.attr("class","mce-shim"),e.attr("data-mce-bogus","1"),t.append(e),t.attr("contenteditable","false")}}))},J=t=>{A(t,(t=>{W(t)&&t.attr("contenteditable",null)}))},H=(t,e)=>{const n=t.dom;if(1!==n.nodeType)return!1;{const t=n;if(void 0!==t.matches)return t.matches(e);if(void 0!==t.msMatchesSelector)return t.msMatchesSelector(e);if(void 0!==t.webkitMatc