1import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{i as t}from"./framework-DwC86aKE.js";import{t as n}from"./logger-BgAmdgJr.js";import{t as r}from"./web-routes-C1hIxcbF.js";import{t as i}from"./v4-DqR3yzBO.js";var a=(e,t)=>{let r=t?.response?.status;n.warn(`[Auth] operation failed`,{phase:e,status:typeof r==`number`&&r>=400&&r<=599?r:void 0,kind:t instanceof TypeError?`TypeError`:t instanceof Error?`Error`:`unknown`})},o=(e,t)=>{let n=e?.response?.status;return n===401||n===403?`Sign in could not be authorized. Please try again or use another sign-in method.`:n===429?`Too many attempts. Please wait a moment and try again.`:t},s=e=>{try{e()}catch{a(`telemetry`)}},c=e(t(),1),l=!1,u=()=>l,d=()=>{if(window.AppleID)try{let e=i();sessionStorage.setItem(`apple_auth_state`,e),window.AppleID.auth.init({clientId:`com.lalals.web.signin`,scope:`name email`,redirectURI:`https://lalals.com/auth${r.SIGN_IN}`,state:e,usePopup:!0}),l=!1}catch(e){l=!0,a(`apple-sdk-init`,e)}},f=e=>{let[t,n]=(0,c.useState)(!1),r=(0,c.useRef)(!1);return(0,c.useEffect)(()=>(r.current=!0,()=>{r.current=!1}),[]),{initiateAppleLogin:async(t=e)=>{if(typeof window.AppleID?.auth?.signIn!=`function`){t.onUnavailable?.(),t.onError?.(Error(`Apple Sign In SDK not loaded`));return}try{n(!0);let e;try{e=window.AppleID.auth.signIn()}catch(e){throw t.onUnavailable?.(),e}let r=await e,i=sessionStorage.getItem(`apple_auth_state`);if(r.authorization.state!==i)throw Error(`State mismatch - possible CSRF attack`);t.onSuccess(r)}catch(e){t.onError?.(e)}finally{r.current&&n(!1)}},isLoading:t}},p=new Set([`0`,`false`,`no`,`off`,`disabled`]),m=((e,t=!0)=>{let n=e?.trim().toLowerCase();return n?!p.has(n):t})(``),h=!1,g=()=>h,_=()=>{if(m&&window.FB)try{window.FB.init({appId:`748740073643075`,cookie:!0,xfbml:!0,version:`v24.0`}),h=!1}catch(e){h=!0,a(`facebook-sdk-init`,e)}},v=e=>{let[t,n]=(0,c.useState)(!1),r=(0,c.useRef)(!1);return(0,c.useEffect)(()=>(r.current=!0,()=>{r.current=!1}),[]),{initiateFacebookLogin:(t=e)=>{let i=()=>{r.current&&n(!1)},a=e=>{i(),t.onError?.(e)};if(!m){t.onUnavailable?.(),a(Error(`Facebook sign in is unavailable`));return}if(typeof window.FB?.login!=`function`){t.onUnavailable?.(),a(Error(`Facebook SDK not loaded`));return}try{n(!0),window.FB.login(e=>{i(),e.status===`connected`&&e.authResponse?t.onSuccess(e):e.status===`unknown`&&t.onCancel?t.onCancel():a(Error(`Facebook authorization failed`))},{scope:`public_profile,email`,return_scopes:!0})}catch(e){t.onUnavailable?.(),a(e instanceof Error?e:Error(`Facebook SDK failed`))}},checkLoginStatus:async()=>new Promise(e=>{if(!window.FB){e(null);return}window.FB.getLoginStatus(t=>{t.status===`connected`?e(t):e(null)})}),logout:async()=>new Promise(e=>{if(!window.FB){e();return}window.FB.logout(()=>{e()})}),isLoading:t}};export{d as a,o as c,m as i,a as l,g as n,u as o,v as r,f as s,_ as t,s as u};
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.