'use client';
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("react/jsx-runtime"),t=require("./error-boundary.cjs"),e=require("./loading-spinner.cjs"),u=require("./magic-link.cjs"),d=require("./oauth-buttons.cjs"),c=require("./redirect-handler.cjs"),l={LoadingSpinner:e.default,LoadingButton:e.LoadingButton,ErrorBoundary:t.default,RedirectHandler:c.default,OAuthButtons:d.default,OAuthDivider:d.OAuthDivider,MagicLink:u.default,MagicLinkVerification:u.MagicLinkVerification},w={LoadingSpinner:e.default,LoadingButton:e.LoadingButton,LoadingProvider:e.LoadingProvider},f={ErrorBoundary:t.default,AuthErrorBoundary:t.AuthErrorBoundary,FormErrorBoundary:t.FormErrorBoundary,ApiErrorBoundary:t.ApiErrorBoundary},g={OAuthButtons:d.default,OAuthDivider:d.OAuthDivider},m={MagicLink:u.default,MagicLinkVerification:u.MagicLinkVerification},E={LOADING:"loading",SUCCESS:"success",ERROR:"error",IDLE:"idle",PROCESSING:"processing",VERIFYING:"verifying",REDIRECTING:"redirecting"},A={NETWORK_ERROR:"network_error",AUTHENTICATION_ERROR:"authentication_error",AUTHORIZATION_ERROR:"authorization_error",VALIDATION_ERROR:"validation_error",TIMEOUT_ERROR:"timeout_error",UNKNOWN_ERROR:"unknown_error"},L={OAUTH:"oauth",MAGIC_LINK:"magic-link",INVITATION:"invitation",VERIFICATION:"verification",ERROR:"error"};function R(r,n){const i=o=>{const{isLoading:a,...s}=o;return a?h.jsx(e.default,{...n}):h.jsx(r,{...s})};return i.displayName=`withLoading(${r.displayName||r.name})`,i}function p(r,n){return t.withErrorBoundary(r,{title:"Authentication Error",subtitle:"There was a problem with the authentication process.",showDetails:process.env.NODE_ENV==="development",...n})}function y(){if(typeof window>"u")return!1;const r=new URLSearchParams(window.location.search),n=new URLSearchParams(window.location.hash.slice(1));return!!(r.has("code")||n.has("code")||r.has("token")||n.has("token")||r.has("invitation_token")||r.has("invite")||r.has("error")||n.has("error"))}function O(){if(typeof window>"u")return{};const r=new URLSearchParams(window.location.search),n=new URLSearchParams(window.location.hash.slice(1)),i={};return[...r.entries(),...n.entries()].forEach(([o,a])=>{i[o]=a}),i}function B(){if(typeof window>"u")return;const r=["code","state","error","error_description","token","type","invitation_token","invite","verification_token","verify"],n=new URLSearchParams(window.location.search);let i=!1;if(r.forEach(o=>{n.has(o)&&(n.delete(o),i=!0)}),i){const o=n.toString()?`${window.location.pathname}?${n.toString()}`:window.location.pathname;window.history.replaceState({},document.title,o)}if(window.location.hash){const o=new URLSearchParams(window.location.hash.slice(1));let a=!1;if(r.forEach(s=>{o.has(s)&&(o.delete(s),a=!0)}),a){const s=o.toString()?`#${o.toString()}`:"";window.history.replaceState({},document.title,window.location.pathname+window.location.search+s)}}}exports.ApiErrorBoundary=t.ApiErrorBoundary;exports.AuthErrorBoundary=t.AuthErrorBoundary;exports.ErrorBoundary=t.ErrorBoundary;exports.FormErrorBoundary=t.FormErrorBoundary;exports.useAsyncError=t.useAsyncError;exports.withErrorBoundary=t.withErrorBoundary;exports.LoadingButton=e.LoadingButton;exports.LoadingProvider=e.LoadingProvider;exports.LoadingSpinner=e.LoadingSpinner;exports.LoadingStates=e.LoadingStates;exports.useLoading=e.useLoading;exports.MagicLink=u.MagicLink;exports.MagicLinkVerification=u.MagicLinkVerification;exports.OAuthButtons=d.OAuthButtons;exports.OAuthDivider=d.OAuthDivider;exports.RedirectHandler=c.RedirectHandler;exports.useRedirectHandler=c.useRedirectHandler;exports.AuthErrorTypes=A;exports.AuthStates=E;exports.CommonAuthComponents=l;exports.ErrorComponents=f;exports.LoadingComponents=w;exports.MagicLinkComponents=m;exports.OAuthComponents=g;exports.RedirectTypes=L;exports.cleanAuthParams=B;exports.getAuthParams=O;exports.isAuthRedirect=y;exports.withAuthErrorBoundary=p;exports.withLoading=R;
//# sourceMappingURL=index.cjs.map
