!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t=t||self).yett={})}(this,function(t){"use strict";var l="javascript/blocked",s={blacklist:window.YETT_BLACKLIST,whitelist:window.YETT_WHITELIST},a={blacklisted:[]},o=function(e,t){return e&&(!t||t!==l)&&(!s.blacklist||s.blacklist.some(function(t){return t.test(e)}))&&(!s.whitelist||s.whitelist.every(function(t){return!t.test(e)}))},u=function(t){var e=t.getAttribute("src");return s.blacklist&&s.blacklist.every(function(t){return!t.test(e)})||s.whitelist&&s.whitelist.some(function(t){return t.test(e)})},f=new MutationObserver(function(t){t.forEach(function(t){for(var i=t.addedNodes,e=function(t){var n=i[t];if(1===n.nodeType&&"SCRIPT"===n.tagName){var e=n.src,r=n.type;if(o(e,r)){a.blacklisted.push(n.cloneNode()),n.type=l;n.addEventListener("beforescriptexecute",function t(e){n.getAttribute("type")===l&&e.preventDefault(),n.removeEventListener("beforescriptexecute",t)}),n.parentElement.removeChild(n)}}},n=0;n<i.length;n++)e(n)})});f.observe(document.documentElement,{childList:!0,subtree:!0});var c=document.createElement;function p(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e<t.length;e++)n[e]=t[e];return n}}(t)||function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}document.createElement=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];if("script"!==e[0].toLowerCase())return c.bind(document).apply(void 0,e);var r=c.bind(document).apply(void 0,e),i=r.setAttribute.bind(r);return Object.defineProperties(r,{src:{get:function(){return r.getAttribute("src")},set:function(t){return o(t,r.type)&&i("type",l),i("src",t),!0}},type:{set:function(t){var e=o(r.src,r.type)?l:t;return i("type",e),!0}}}),r.setAttribute=function(t,e){"type"===t||"src"===t?r[t]=e:HTMLScriptElement.prototype.setAttribute.call(r,t,e)},r};var d=new RegExp("[|\\{}()[\\]^$+*?.]","g");t.unblock=function(){for(var t=arguments.length,n=new Array(t),e=0;e<t;e++)n[e]=arguments[e];n.length<1?(s.blacklist=[],s.whitelist=[]):(s.blacklist&&(s.blacklist=s.blacklist.filter(function(e){return n.every(function(t){return"string"==typeof t?!e.test(t):t instanceof RegExp?e.toString()!==t.toString():void 0})})),s.whitelist&&(s.whitelist=[].concat(p(s.whitelist),p(n.map(function(e){if("string"==typeof e){var n=".*"+e.replace(d,"\\$&")+".*";if(s.whitelist.every(function(t){return t.toString()!==n.toString()}))return new RegExp(n)}else if(e instanceof RegExp&&s.whitelist.every(function(t){return t.toString()!==e.toString()}))return e;return null}).filter(Boolean)))));for(var r=document.querySelectorAll('script[type="'.concat(l,'"]')),i=0;i<r.length;i++){var o=r[i];u(o)&&(o.type="application/javascript",a.blacklisted.push(o),o.parentElement.removeChild(o))}var c=0;p(a.blacklisted).forEach(function(t,e){if(u(t)){var n=document.createElement("script");n.setAttribute("src",t.src),n.setAttribute("type","application/javascript"),document.head.appendChild(n),a.blacklisted.splice(e-c,1),c++}}),s.blacklist&&s.blacklist.length<1&&f.disconnect()},Object.defineProperty(t,"__esModule",{value:!0})});
//# sourceMappingURL=yett.min.js.map
