'use client';
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("react/jsx-runtime"),u=require("./auth-provider.cjs"),c=require("@heroui/react"),m=require("react"),i=require("./config-provider.cjs"),t=require("./theme-provider.cjs"),v=r=>r&&r.__esModule?r:{default:r},d=v(m);function g({children:r,config:e,onError:s,onSignIn:o,onSignOut:a,onConfigChange:n,onThemeChange:l}){if(!e.publishableKey)throw new Error("publishableKey is required in FrankAuthProvider config");if(!e.userType)throw new Error("userType is required in FrankAuthProvider config");return h.jsx(c.HeroUIProvider,{children:h.jsx(i.ConfigProvider,{config:e,onConfigChange:n,children:h.jsx(t.ThemeProvider,{theme:e.theme,mode:e.theme?.mode,organizationBranding:e.organization?.settings?.branding?{primaryColor:e.organization.settings.branding.primaryColor,secondaryColor:e.organization.settings.branding.secondaryColor,logo:e.organization.settings.branding.logo,customCSS:e.organization.settings.branding.customCSS}:void 0,onThemeChange:l,children:h.jsx(u.AuthProvider,{publishableKey:e.publishableKey,secretKey:e.secretKey,userType:e.userType,apiUrl:e.apiUrl,projectId:e.projectId,onError:s,onSignIn:o,onSignOut:a,debug:e.debug,children:r})})})})}function f(){const[r,e]=d.default.useState(!1),[s,o]=d.default.useState(!1),[a,n]=d.default.useState(!1);return d.default.useEffect(()=>{try{u.useAuth(),e(!0)}catch{e(!1)}try{i.useConfig(),o(!0)}catch{o(!1)}try{t.useTheme(),n(!0)}catch{n(!1)}},[]),{auth:r,config:s,theme:a,allAvailable:r&&s&&a}}function b(r){const e=s=>{const o=u.useAuth(),a=i.useConfig(),n=t.useTheme();return h.jsx(r,{...s,auth:o,config:a,theme:n})};return e.displayName=`withProviders(${r.displayName||r.name})`,e}function P(){const r=u.useAuth(),e=i.useConfig(),s=t.useTheme();return{auth:r,config:e,theme:s}}exports.AuthProvider=u.AuthProvider;exports.useAuth=u.useAuth;exports.useAuthGuard=u.useAuthGuard;exports.ConfigProvider=i.ConfigProvider;exports.useComponentOverrides=i.useComponentOverrides;exports.useConfig=i.useConfig;exports.useFeatures=i.useFeatures;exports.useOrganizationConfig=i.useOrganizationConfig;exports.withConfig=i.withConfig;exports.ThemeProvider=t.ThemeProvider;exports.ThemeSwitcher=t.ThemeSwitcher;exports.useOrganizationBranding=t.useOrganizationBranding;exports.useTheme=t.useTheme;exports.useThemeMode=t.useThemeMode;exports.useThemeVariables=t.useThemeVariables;exports.withTheme=t.withTheme;exports.FrankAuthProvider=g;exports.useAllProviders=P;exports.useProviderStatus=f;exports.withProviders=b;
//# sourceMappingURL=index.cjs.map
