1import{fJ as p,tp as b,b as g,z as B,tq as E,tr as S}from"./commonChunk.Cws8LRLa.js";import{W as j,t as a}from"./vendorChunk.RnVA8pPs.js";import"../vendors/vendor-stable.z3coasHw.js";const y=()=>{var e;return!!p().browser.isWebSpace&&!!((e=window.jsBridge)!=null&&e.postMessage)},A=()=>b("mock.alertWsAuthResult")==="true",M=j({disabled:()=>{var e;return!((e=window.jsBridge)!=null&&e.postMessage)},sendMessage(e){var s,r;(r=(s=window.jsBridge)==null?void 0:s.postMessage)==null||r.call(s,"WSEvents",JSON.stringify(e))},registerMessage(e){if(window.jsBridge)return window.jsBridge.onWSEvents=s=>e(s),()=>{delete window.jsBridge.onWSEvents}}});let n=null;async function P(e){var w,f,d,c;const[s,r]=await a(E()),t=(w=r==null?void 0:r.data)==null?void 0:w.data;if(s||!t)return!1;const[W,o]=await a(Promise.resolve(M("attestation").send({nonce:t.nonce,origin:window.location.origin},{timeout:1e4}))),l=o==null?void 0:o.payload;if(W||Number(o==null?void 0:o.status)!==1||!l)return!1;const[m,i]=await a(S({challengeId:t.challengeId,...l})),h=(d=(f=i==null?void 0:i.data)==null?void 0:f.data)==null?void 0:d.isWsBrowser;return m||!h?!1:(typeof e=="number"&&((c=g().userInfos)==null?void 0:c.username)===e&&B().markWsBrowserVerified(e),!0)}function u(e){window.__ws_auth_result__=e,A()&&alert(`wsAuthResult: ${e}`)}function I(){var r;const e=y();if(!e)return u(!1),Promise.resolve({isPossibleWsBrowser:e,isWsBrowser:!1});if(n!==null)return n;const s=(r=g().userInfos)==null?void 0:r.username;return typeof s=="number"&&B().hasWsBrowserVerified(s)?(u(!0),Promise.resolve({isPossibleWsBrowser:e,isWsBrowser:!0})):(n=P(s).then(t=>({isPossibleWsBrowser:e,isWsBrowser:t})).catch(()=>({isPossibleWsBrowser:e,isWsBrowser:!1})),n.then(t=>{u(t.isWsBrowser),n=null}),n)}export{I as wsBrowserAuth};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.