'use client';
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),l=require("react"),n=require("@heroui/react"),T=require("@heroicons/react/24/outline"),X=require("./sign-in-form.cjs"),A=require("../../../hooks/use-config.cjs"),F=a=>a&&a.__esModule?a:{default:a},G=F(l);function J({isOpen:a=!1,onClose:e,modalSize:c="md",closeOnBackdropClick:u=!0,closeOnEscape:r=!0,modalClassName:i="",showCloseButton:g=!0,methods:p=["password","oauth","magic-link"],email:M,organizationId:z,redirectUrl:m,onSuccess:d,onError:y,title:x,subtitle:f,size:I="md",showBranding:S=!0,disabled:t=!1,showSignUpLink:b=!0,showForgotPasswordLink:h=!0,footer:v,header:q,backdrop:w="blur",placement:D="center",modalHeader:_,modalFooter:j,hideHeader:o=!1,hideFooter:P=!1,scrollBehavior:k="inside"}){const{components:$}=A.useConfig(),C=$.SignInModal;if(C)return s.jsx(C,{isOpen:a,onClose:e,modalSize:c,closeOnBackdropClick:u,closeOnEscape:r,modalClassName:i,showCloseButton:g,methods:p,email:M,organizationId:z,redirectUrl:m,onSuccess:d,onError:y,title:x,subtitle:f,size:I,showBranding:S,disabled:t,showSignUpLink:b,showForgotPasswordLink:h,footer:v,header:q,backdrop:w,placement:D,modalHeader:_,modalFooter:j,hideHeader:o,hideFooter:P,scrollBehavior:k});const K=l.useCallback(N=>{d?.(N),m||e?.()},[d,e,m]),O=l.useCallback(()=>{t||e?.()},[e,t]),R=(()=>{switch(c){case"sm":return{size:"sm",className:"max-w-sm"};case"md":return{size:"md",className:"max-w-md"};case"lg":return{size:"lg",className:"max-w-lg"};case"xl":return{size:"xl",className:"max-w-xl"};case"full":return{size:"full",className:"max-w-full"};default:return{size:"md",className:"max-w-md"}}})();return s.jsx(n.Modal,{isOpen:a,onClose:O,size:R.size,backdrop:w,placement:D,scrollBehavior:k,closeButton:g,isDismissable:u&&!t,isKeyboardDismissDisabled:!r||t,className:`${i}`,classNames:{wrapper:"z-[9999]",backdrop:"z-[9998]",base:`${R.className}`},children:s.jsx(n.ModalContent,{children:N=>s.jsxs(s.Fragment,{children:[!o&&s.jsx(n.ModalHeader,{className:"flex flex-col gap-1 px-6 py-4",children:_||s.jsxs("div",{className:"flex items-center justify-between w-full",children:[s.jsxs("div",{children:[x&&s.jsx("h2",{className:"text-lg font-semibold text-foreground",children:x}),f&&s.jsx("p",{className:"text-sm text-default-500 mt-1",children:f})]}),g&&s.jsx(n.Button,{isIconOnly:!0,variant:"light",size:"sm",onPress:N,className:"text-default-400 hover:text-default-600",isDisabled:t,children:s.jsx(T.XMarkIcon,{className:"w-4 h-4"})})]})}),s.jsx(n.ModalBody,{className:"px-6 py-4",children:s.jsx(X.SignInForm,{methods:p,email:M,organizationId:z,redirectUrl:m,onSuccess:K,onError:y,title:o?x:void 0,subtitle:o?f:void 0,size:I,showBranding:S,disabled:t,showSignUpLink:b,showForgotPasswordLink:h,header:q,footer:v,variant:"minimal",className:"space-y-4"})}),!P&&j&&s.jsx(n.ModalFooter,{className:"px-6 py-4",children:j})]})})})}function Q(){const[a,e]=G.default.useState(!1),c=l.useCallback(()=>e(!0),[]),u=l.useCallback(()=>e(!1),[]),r=l.useCallback(()=>e(i=>!i),[]);return{isOpen:a,open:c,close:u,toggle:r,setIsOpen:e}}exports.SignInModal=J;exports.useSignInModal=Q;
//# sourceMappingURL=sign-in-modal.cjs.map
