(function () { try { var K = 'mc_inv', V = 'mc_viol', pending = {}; function load(k) { try { return JSON.parse(localStorage.getItem(k) || (k === K ? '{}' : '[]')); } catch (e) { return k === K ? {} : []; } } function dirOf(e) { var t = e.initiatorType, n = e.name.split('?')[0].toLowerCase(); if (t === 'script') return 'script-src'; if (t === 'iframe' || t === 'frame') return 'frame-src'; if (t === 'fetch' || t === 'xmlhttprequest' || t === 'beacon') return 'connect-src'; if (/\.(woff2?|ttf|otf|eot)$/.test(n)) return 'font-src'; if (t === 'img' || /\.(png|jpe?g|gif|webp|svg|ico|avif|bmp)$/.test(n)) return 'img-src'; if (t === 'link' || t === 'css' || /\.css$/.test(n)) return 'style-src'; if (t === 'video' || t === 'audio' || /\.(mp4|webm|mp3|ogg)$/.test(n)) return 'media-src'; return 'other'; } function add(e) { try { var u = new URL(e.name); if (u.host === location.host || !/^https?:$/.test(u.protocol)) return; var d = dirOf(e); pending[d] = pending[d] || {}; pending[d][u.origin] = (pending[d][u.origin] || 0) + 1; } catch (x) {} } function save() { var ks = Object.keys(pending); if (!ks.length) return; var cur = load(K); ks.forEach(function (d) { cur[d] = cur[d] || {}; Object.keys(pending[d]).forEach(function (h) { cur[d][h] = (cur[d][h] || 0) + pending[d][h]; }); }); pending = {}; try { localStorage.setItem(K, JSON.stringify(cur)); } catch (x) {} } new PerformanceObserver(function (l) { l.getEntries().forEach(add); }).observe({ type: 'resource', buffered: true }); document.addEventListener('securitypolicyviolation', function (e) { try { var a = load(V); a.push({ directive: e.effectiveDirective, blocked: (e.blockedURI || 'inline').split('?')[0], page: location.pathname }); localStorage.setItem(V, JSON.stringify(a)); } catch (x) {} }); setInterval(save, 2000); window.addEventListener('pagehide', save); } catch (x) {} })();