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

10 lines
72 KiB
JavaScript
Raw Normal View History

2023-11-01 22:54:59 -04:00
/*!
* Tiny Enhanced Media Embed plugin
*
* 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=Object.getPrototypeOf,t=(e,t,r)=>{var n;return!!r(e,t.prototype)||(null===(n=e.constructor)||void 0===n?void 0:n.name)===t.name},r=e=>r=>(e=>{const r=typeof e;return null===e?"null":"object"===r&&Array.isArray(e)?"array":"object"===r&&t(e,String,((e,t)=>t.isPrototypeOf(e)))?"string":r})(r)===e,n=e=>t=>typeof t===e,o=r("string"),s=r("object"),i=r=>((r,n)=>s(r)&&t(r,n,((t,r)=>e(t)===r)))(r,Object),a=r("array"),l=n("boolean"),c=(void 0,e=>undefined===e);const u=e=>!(e=>null==e)(e),h=n("function"),d=n("number");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 u(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 f=(e,t)=>((e,t,r)=>""===t||e.length>=t.length&&e.substr(0,0+t.length)===t)(e,t),m=e=>parseInt(e,10),g=(e,t)=>{const r=e-t;return 0===r?0:r>0?1:-1},k=(e,t,r)=>({major:e,minor:t,patch:r}),y=e=>{const t=/([0-9]+)\.([0-9]+)\.([0-9]+)(?:(\-.+)?)/.exec(e);return t?k(m(t[1]),m(t[2]),m(t[3])):k(0,0,0)},b=e=>t=>t.options.get(e),v=b("mediaembed_content_css"),S=b("mediaembed_max_width"),C=b("mediaembed_inline_styles"),w=b("mediaembed_service_url"),x=e=>{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},A=(e,t)=>{const r=(t||document).createElement(e);return x(r)},T=x;"undefined"!=typeof window?window:Function("return this;")();const E=e=>1===(e=>e.dom.nodeType)(e),L=e=>t=>E(t)&&t.dom.nodeName.toLowerCase()===e,O=()=>{},_=e=>()=>e,I=e=>e,N=e=>e(),P=_(!1),j=_(!0),M=Array.prototype.slice,R=Array.prototype.indexOf,D=Array.prototype.push,B=(e,t)=>((e,t)=>R.call(e,t))(e,t)>-1,F=(e,t)=>{const r=e.length,n=new Array(r);for(let o=0;o<r;o++){const r=e[o];n[o]=t(r,o)}return n},U=(e,t)=>{for(let r=0,n=e.length;r<n;r++)t(e[r],r)},V=(e,t)=>{const r=[];for(let n=0,o=e.length;n<o;n++){const o=e[n];t(o,n)&&r.push(o)}return r},z=(e,t,r)=>(U(e,((e,n)=>{r=t(r,e,n)})),r),$=(e,t)=>((e,t,r)=>{for(let n=0,o=e.length;n<o;n++){const o=e[n];if(t(o,n))return p.some(o);if(r(o,n))break}return p.none()})(e,t,P),q=(e,t)=>(e=>{const t=[];for(let r=0,n=e.length;r<n;++r){if(!a(e[r]))throw new Error("Arr.flatten item "+r+" was not an array, input: "+e);D.apply(t,e[r])}return t})(F(e,t)),J=h(Array.from)?Array.from:e=>M.call(e),W=(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")}},H=e=>p.from(e.dom.parentNode).map(T),G=e=>p.from(e.dom.nextSibling).map(T),K=e=>F(e.dom.childNodes,T),Q=e=>((e,t)=>{const r=e.dom.childNodes;return p.from(r[0]).map(T)})(e),Y=Object.keys,X=Object.hasOwnProperty,Z=(e,t)=>{const r=Y(e);for(let n=0,o=r.length;n<o;n++){const o=r[n];t(e[o],o)}},ee=(e,t)=>te(e,t)?p.from(e[t]):p.none(),te=(e,t)=>X.call(e,t),re=(e,t,r)=>{((e,t,r)=>{if(!(o(r)||l(r)||d(r)))throw console.error("Invalid call to Attribute.set. Key ",t,":: Value ",r,":: Element ",e),new Error("Attribute value was not simple");e.setAttribute(t,r+"")})(e.dom,t,r)},ne=(e,t,r)=>{if(!o(r))throw console.error("Invalid call to CSS.set. Property ",t,":: Value ",r,":: Element