/*!
 * Yett v0.1.9
 * https://snipsco.github.io/yett/
 * MIT License
 * Copyright (c) 2018 Snips
 */
!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){for(var e=0;e<t.length;e++)for(var i=t[e].addedNodes,r=function(t){var r=i[t];if(1===r.nodeType&&"SCRIPT"===r.tagName){var e=r.src,n=r.type;if(o(e,n)){a.blacklisted.push(r.cloneNode()),r.type=l;r.addEventListener("beforescriptexecute",function t(e){r.getAttribute("type")===l&&e.preventDefault(),r.removeEventListener("beforescriptexecute",t)}),r.parentElement.removeChild(r)}}},n=0;n<i.length;n++)r(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,r=new Array(t.length);e<t.length;e++)r[e]=t[e];return r}}(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),r=0;r<t;r++)e[r]=arguments[r];if("script"!==e[0].toLowerCase())return c.bind(document).apply(void 0,e);var n=c.bind(document).apply(void 0,e),i=n.setAttribute.bind(n);return Object.defineProperties(n,{src:{get:function(){return n.getAttribute("src")},set:function(t){return o(t,n.type)&&i("type",l),i("src",t),!0}},type:{set:function(t){var e=o(n.src,n.type)?l:t;return i("type",e),!0}}}),n.setAttribute=function(t,e){"type"===t||"src"===t?n[t]=e:HTMLScriptElement.prototype.setAttribute.call(n,t,e)},n};var d=new RegExp("[|\\{}()[\\]^$+*?.]","g");t.unblock=function(){for(var t=arguments.length,r=new Array(t),e=0;e<t;e++)r[e]=arguments[e];r.length<1?(s.blacklist=[],s.whitelist=[]):(s.blacklist&&(s.blacklist=s.blacklist.filter(function(e){return r.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(r.map(function(e){if("string"==typeof e){var r=".*"+e.replace(d,"\\$&")+".*";if(s.whitelist.every(function(t){return t.toString()!==r.toString()}))return new RegExp(r)}else if(e instanceof RegExp&&s.whitelist.every(function(t){return t.toString()!==e.toString()}))return e;return null}).filter(Boolean)))));for(var n=document.querySelectorAll('script[type="'.concat(l,'"]')),i=0;i<n.length;i++){var o=n[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 r=document.createElement("script");r.setAttribute("src",t.src),r.setAttribute("type","application/javascript"),document.head.appendChild(r),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
