rumine-web/static/wagtailadmin/js/vendor/rangy-core.6171145a0149.js

1 line
46 KiB
JavaScript
Raw Permalink Normal View History

2024-03-13 07:49:06 +01:00
!function(e,t){"function"==typeof define&&define.amd?define(e):"undefined"!=typeof module&&"object"==typeof exports?module.exports=e():t.rangy=e()}((function(){function e(e,t){var n=typeof e[t];return n==C||!(n!=v||!e[t])||"unknown"==n}function t(e,t){return!(typeof e[t]!=v||!e[t])}function n(e,t){return typeof e[t]!=N}function r(e){return function(t,n){for(var r=n.length;r--;)if(!e(t,n[r]))return!1;return!0}}function o(e){return e&&T(e,w)&&_(e,y)}function i(e){return t(e,"body")?e.body:e.getElementsByTagName("body")[0]}function a(t){typeof console!=N&&e(console,"log")&&console.log(t)}function s(e,t){x&&t?alert(e):a(e)}function c(e){P.initialized=!0,P.supported=!1,s("Rangy is not supported in this environment. Reason: "+e,P.config.alertOnFail)}function d(e){return e.message||e.description||String(e)}function f(){if(x&&!P.initialized){var t,n=!1,r=!1;e(document,"createRange")&&(t=document.createRange(),T(t,S)&&_(t,E)&&(n=!0));var s,f=i(document);if(!f||"body"!=f.nodeName.toLowerCase())return void c("No body element found");if(f&&e(f,"createTextRange")&&o(t=f.createTextRange())&&(r=!0),!n&&!r)return void c("Neither Range nor TextRange are available");for(var u in P.initialized=!0,P.features={implementsDomRange:n,implementsTextRange:r},A)(s=A[u])instanceof h&&s.init(s,P);for(var l=0,g=I.length;g>l;++l)try{I[l](P)}catch(e){a("Rangy init listener threw an exception. Continuing. Detail: "+d(e))}}}function u(e,t,n){n&&(e+=" in module "+n.name),P.warn("DEPRECATED: "+e+" is deprecated. Please use "+t+" instead.")}function l(e,t,n,r){e[t]=function(){return u(t,n,r),e[n].apply(e,b.toArray(arguments))}}function h(e,t,n){this.name=e,this.dependencies=t,this.initialized=!1,this.supported=!1,this.initializer=n}function g(e,t,n){var r=new h(e,t,(function(t){if(!t.initialized){t.initialized=!0;try{n(P,t),t.supported=!0}catch(t){a("Module '"+e+"' failed to load: "+d(t)),t.stack&&a(t.stack)}}}));return A[e]=r,r}function p(){}var m,R,v="object",C="function",N="undefined",E=["startContainer","startOffset","endContainer","endOffset","collapsed","commonAncestorContainer"],S=["setStart","setStartBefore","setStartAfter","setEnd","setEndBefore","setEndAfter","collapse","selectNode","selectNodeContents","compareBoundaryPoints","deleteContents","extractContents","cloneContents","insertNode","surroundContents","cloneRange","toString","detach"],y=["boundingHeight","boundingLeft","boundingTop","boundingWidth","htmlText","text"],w=["collapse","compareEndPoints","duplicate","moveToElementText","parentElement","select","setEndPoint","getBoundingClientRect"],T=r(e),O=r(t),_=r(n),D=[].forEach?function(e,t){e.forEach(t)}:function(e,t){for(var n=0,r=e.length;r>n;++n)t(e[n],n)},A={},x=typeof window!=N&&typeof document!=N,b={isHostMethod:e,isHostObject:t,isHostProperty:n,areHostMethods:T,areHostObjects:O,areHostProperties:_,isTextRange:o,getBody:i,forEach:D},P={version:"1.3.0",initialized:!1,isBrowser:x,supported:!0,util:b,features:{},modules:A,config:{alertOnFail:!1,alertOnWarn:!1,preferTextRange:!1,autoInitialize:typeof rangyAutoInitialize==N||rangyAutoInitialize}};P.fail=c,P.warn=function(e){s("Rangy warning: "+e,P.config.alertOnWarn)},{}.hasOwnProperty?(b.extend=m=function(e,t,n){var r,o;for(var i in t)t.hasOwnProperty(i)&&(r=e[i],o=t[i],n&&null!==r&&"object"==typeof r&&null!==o&&"object"==typeof o&&m(r,o,!0),e[i]=o);return t.hasOwnProperty("toString")&&(e.toString=t.toString),e},b.createOptions=function(e,t){var n={};return m(n,t),e&&m(n,e),n}):c("hasOwnProperty not supported"),x||c("Rangy can only run in a browser"),function(){var e;if(x){var t=document.createElement("div");t.appendChild(document.createElement("span"));var n=[].slice;try{1==n.call(t.childNodes,0)[0].nodeType&&(e=function(e){return n.call(e,0)})}catch(e){}}e||(e=function(e){for(var t=[],n=0,r=e.length;r>n;++n)t[n]=e[n];return t}),b.toArray=e}(),x&&(e(document,"addEventListener")?R=function(e,t,n){e.addEventListener(t,n,!1)}:e(document,"attachEvent")?R=function(e,t,n){e.attachEvent("on"+t,n)}:c("Document does not have required addEventListener or attachEvent method"),b.addListener=R);var