function c(e){document.readyState==="loading"||document.readyState==="uninitialized"?document.addEventListener("DOMContentLoaded",e):e()}var i=acquireVsCodeApi();function u(e){return typeof e=="object"&&e!==null&&"url"in e&&typeof e.url=="string"&&"focusLockEnabled"in e&&typeof e.focusLockEnabled=="boolean"}function g(e){return typeof e=="object"&&e!==null&&"type"in e&&(e.type==="focus"||e.type==="didChangeFocusLockIndicatorEnabled"&&"focusLockEnabled"in e&&typeof e.focusLockEnabled=="boolean")}function p(){let e=document.getElementById("simple-browser-settings");if(e){let t=e.getAttribute("data-settings");if(t){let n=JSON.parse(t);if(u(n))return n}}throw new Error("Could not load settings")}var r=p(),a=document.querySelector("iframe"),o=document.querySelector(".header"),s=o.querySelector(".url-input"),f=o.querySelector(".forward-button"),m=o.querySelector(".back-button"),E=o.querySelector(".reload-button"),y=o.querySelector(".open-external-button");window.addEventListener("message",e=>{let t=e.data;if(g(t))switch(t.type){case"focus":{a.focus();break}case"didChangeFocusLockIndicatorEnabled":{d(t.focusLockEnabled);break}}});c(()=>{setInterval(()=>{let t=document.activeElement?.tagName==="IFRAME";document.body.classList.toggle("iframe-focused",t)},50),a.addEventListener("load",()=>{}),s.addEventListener("change",t=>{let n=t.target.value;e(n)}),f.addEventListener("click",()=>{history.forward()}),m.addEventListener("click",()=>{history.back()}),y.addEventListener("click",()=>{i.postMessage({type:"openExternal",url:s.value})}),E.addEventListener("click",()=>{e(s.value)}),e(r.url),s.value=r.url,d(r.focusLockEnabled);function e(t){try{let n=new URL(t),l=new URLSearchParams(location.search);n.searchParams.append("id",l.get("id")),n.searchParams.append("vscodeBrowserReqId",Date.now().toString()),a.src=n.toString()}catch{a.src=t}i.setState({url:t})}});function d(e){document.body.classList.toggle("enable-focus-lock-indicator",e)}
