(function(){"use strict";function i(o){if(o.attr("srcdoc"))return!0;const e=o.attr("src");if(!e)return!0;const a=document.createElement("a");return a.href=e,a.hostname===window.location.hostname&&a.protocol===window.location.protocol&&a.port===window.location.port}tinymce.PluginManager.add("mt_protect",function(o){o.on("PreInit",function(){const e=o.parser.getNodeFilters().find(function(n){return n.name==="iframe"});e&&e.callbacks.unshift(function(n){n.forEach(function(t){if(!i(t))return;const r=t.attr("sandbox");let c="allow-scripts";r===void 0?t.attr("data-mt-protect-no-sandbox","1"):(t.attr("data-mt-protect-sandbox",r),c=r.split(/\s+/).filter(function(s){return!/allow-same-origin/i.test(s)}).join(" ")),t.attr("sandbox",c)})});const a=o.serializer.getAttributeFilters().find(function(n){return n.name==="data-mce-object"});a&&a.callbacks.unshift(function(n){n.forEach(function(t){const r=t.attr("data-mce-p-data-mt-protect-sandbox");r!==void 0?t.attr("data-mce-p-sandbox",r):t.attr("data-mce-p-data-mt-protect-no-sandbox")&&t.attr("data-mce-p-sandbox",null),t.attr("data-mce-p-data-mt-protect-sandbox",null),t.attr("data-mce-p-data-mt-protect-no-sandbox",null)})})})})})();
