import{o as w,b as f,y as k,x as g,r as y,J as _,K as T}from"./_plugin-vue_export-helper-CX32kvNK.js";import{a as i,g as v}from"./theme-D3XJTTUJ.js";import{R as A}from"./RestrictedAuth-CyES_pxX.js";import"./pow-DUr-T9XX.js";function h(){return new URLSearchParams(location.hash.slice(1)).get("theme")||v()||""}i(h());addEventListener("hashchange",()=>i(h()));const R={__name:"RestrictedApi",setup(u){const a=y(null);function d(){const n=window.location.pathname.match(/\/auth\/([^/]+)$/);if(n){const r=n[1],c=r.split(".");if(c.length===5&&c.every(l=>l.length>0))return r}return null}const o=new URLSearchParams(window.location.hash.slice(1)),p=["reauth","forbidden"].includes(o.get("mode"))?o.get("mode"):"login";function t(e){window.parent&&window.parent!==window&&window.parent.postMessage(e,"*")}function m(e){t({type:"auth-success",authenticated:!0,sessionToken:e.session_token})}function s(){t({type:"auth-back"})}return w(()=>{a.value=d(),t({type:"auth-ready"}),window.addEventListener("keydown",e=>{e.key==="Escape"&&s()})}),(e,n)=>(f(),k(A,{mode:g(p),"remote-auth-token":a.value,onAuthenticated:m,onBack:s},null,8,["mode","remote-auth-token"]))}};_(R).mount("#app");T();
