try{let e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`342cc5ae-f65e-4a7f-8f60-882a815b77eb`,e._sentryDebugIdIdentifier=`sentry-dbid-342cc5ae-f65e-4a7f-8f60-882a815b77eb`)}catch{}import{em as e,yg as t}from"./entry.client-mpghtlrl.js";e(),new t(`localNetworkAccess`);var n=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;function r(e,t){let n;try{n=new URL(e)}catch{return null}return n.protocol!==`http:`&&n.protocol!==`https:`?null:new URL(t,n).href}function i(e,t,n,r){return e>255||t>255||n>255||r>255?null:e===127?`loopback-network`:e===10||e===172&&t>=16&&t<=31||e===192&&t===168||e===169&&t===254?`local-network`:null}function a(e){let t;try{t=new URL(e).hostname}catch{return null}let r=t.startsWith(`[`)?t.slice(1,-1):t;if(r===`localhost`||r===`::1`)return`loopback-network`;let a=n.exec(r);if(a){let[,e,t,n,r]=a.map(Number);return i(e,t,n,r)}if(r.includes(`:`)){let e=r.toLowerCase();if(e.startsWith(`fc`)||e.startsWith(`fd`)||e.startsWith(`fe80`))return`local-network`}return null}function o(e){let t=a(e);if(t===null)return null;if(globalThis.location!==void 0){if(a(globalThis.location.origin)!==null)return null;try{if(new URL(globalThis.location.origin).port!==``)return null}catch{}}return t}async function s(e,t){let n=document.createElement(`iframe`);n.style.display=`none`,document.body.appendChild(n);try{let r=n.contentWindow?.fetch;if(!r)throw Error(`Native fetch is unavailable in the iframe context`);return await r.call(n.contentWindow,e,t)}finally{n.remove()}}async function c(e){let t=o(e);if(t===null)return`unsupported`;try{let t=new URL(`/v1/tabs/active/download`,e).href;await s(t,{method:`GET`,mode:`cors`})}catch{}if(globalThis.navigator?.permissions?.query)try{return(await globalThis.navigator.permissions.query({name:t})).state}catch{return`unsupported`}return`unsupported`}export{r as i,o as n,c as r,s as t};