(()=>{"use strict";const t="wls-",n=["interdrop.com"],e={onKey:`${t}wrtc-on`,allowKey:`${t}wrtc-allow`,watchKey:`${t}watch-on`,changedEvent:`${t}wrtc-changed`};function o(t,n){return n.some(n=>function(t,n){const e=t.toLowerCase(),o=n.toLowerCase();return e===o||e.endsWith(`.${o}`)}(t,String(n)))}function c(t){const n=t.trim().split(/\s+/),e={};if(n.length<8)return e;const o=n[2];o&&(e.protocol=o.toLowerCase());const c=n[4];c&&(e.address=c);const r=Number(n[5]);Number.isNaN(r)||(e.port=r);const s=n.indexOf("typ"),a=s>=0?n[s+1]:void 0;return a&&(e.candidateType=a),e}const r=["RTCPeerConnection","webkitRTCPeerConnection","mozRTCPeerConnection"];(()=>{const t=window;if(t.__wlsWrtcInit)return;t.__wlsWrtcInit=!0;const s={};for(const n of r)s[n]=t[n];const a=t=>{try{return localStorage.getItem(t)??""}catch{return""}},i=()=>{const t=(location.hostname||"").toLowerCase();if(window.top===window.self)return t;try{const t=window.top?.location.hostname;if(t)return t.toLowerCase()}catch{}try{const t=location.ancestorOrigins,n=t&&t.length?t[t.length-1]:null;if(n)return new URL(n).hostname.toLowerCase()}catch{}return t},l=()=>"1"===a(e.watchKey),w=t=>{try{window.postMessage({__wlsWatch:!0,event:t},"*")}catch{}},d="function"==typeof RTCPeerConnection?RTCPeerConnection:void 0,u=d?class extends d{constructor(...t){super(...t),l()&&w({kind:"create",at:Date.now(),host:i()}),this.addEventListener("icecandidate",t=>{const n=t.candidate?.candidate;n&&l()&&w({kind:"candidate",at:Date.now(),host:i(),...c(n)})})}}:void 0,h=(n,e)=>{try{Object.defineProperty(t,n,{value:e,configurable:!0,writable:!0})}catch{try{t[n]=e}catch{}}};let f=null;const y=()=>{const t="1"!==a(e.onKey)||(()=>{const t=i();if(o(t,n))return!0;let c=[];try{const t=a(e.allowKey);if(t){const n=JSON.parse(t);Array.isArray(n)&&(c=n.filter(t=>"string"==typeof t))}}catch{}return o(t,c)})()?l()&&u?"watch":"normal":"block";if(t!==f){f=t;for(const n of r){const e="block"===t?void 0:"watch"===t?u:s[n];h(n,e)}}};t.__wlsWrtcApply=y,document.addEventListener(e.changedEvent,y),y()})()})();