'use client';
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime");require("@emotion/styled");const C=require("../../ui/button/button.cjs"),p=require("../../ui/modal/modal.cjs"),I=require("@heroicons/react/24/outline"),i=require("react"),R=require("../../../hooks/use-config.cjs"),U=require("./sign-up-form.cjs"),$=a=>a&&a.__esModule?a:{default:a},k=$(i);function H({isOpen:a=!1,onClose:s,modalSize:o="md",closeOnBackdropClick:r=!0,closeOnEscape:n=!0,modalClassName:c="",showCloseButton:u=!0,methods:t=["password","oauth","magic-link"],email:g,organizationId:v,invitationToken:N,redirectUrl:m,onSuccess:d,onError:j,title:x,subtitle:h,size:b="md",showBranding:M=!0,disabled:l=!1,requireTerms:S=!0,termsUrl:y="/terms",privacyUrl:z="/privacy",backdrop:w="blur",placement:B="center"}){const{components:P}=R.useConfig(),q=P.SignUpModal;if(q)return e.jsx(q,{isOpen:a,onClose:s,modalSize:o,closeOnBackdropClick:r,closeOnEscape:n,modalClassName:c,showCloseButton:u,methods:t,email:g,organizationId:v,invitationToken:N,redirectUrl:m,onSuccess:d,onError:j,title:x,subtitle:h,size:b,showBranding:M,disabled:l,requireTerms:S,termsUrl:y,privacyUrl:z,backdrop:w,placement:B});const _=i.useCallback(F=>{d?.(F),m||setTimeout(()=>{s?.()},2e3)},[d,s,m]),D=i.useCallback(()=>{l||s?.()},[s,l]),f=(()=>{switch(o){case"sm":return{size:"sm",className:"max-w-sm max-h-[90vh]",scrollBehavior:"inside"};case"md":return{size:"md",className:"max-w-md max-h-[90vh]",scrollBehavior:"inside"};case"lg":return{size:"lg",className:"max-w-lg max-h-[90vh]",scrollBehavior:"inside"};case"xl":return{size:"xl",className:"max-w-xl max-h-[90vh]",scrollBehavior:"inside"};case"full":return{size:"full",className:"max-w-full h-full",scrollBehavior:"outside"};default:return{size:"md",className:"max-w-md max-h-[90vh]",scrollBehavior:"inside"}}})();return e.jsx(p.Modal,{isOpen:a,onClose:D,size:f.size,backdrop:w,placement:B,scrollBehavior:f.scrollBehavior,closeButton:!1,isDismissable:r&&!l,isKeyboardDismissDisabled:!n||l,className:`${c}`,classNames:{wrapper:"z-[9999]",backdrop:"z-[9998]",base:`${f.className}`,body:"px-0 py-0"},children:e.jsxs(e.Fragment,{children:[e.jsxs(p.ModalHeader,{className:"flex items-center justify-between px-6 py-4 border-b border-divider",children:[e.jsxs("div",{className:"flex-1",children:[x&&e.jsx("h2",{className:"text-lg font-semibold text-foreground",children:x}),h&&e.jsx("p",{className:"text-sm text-default-500 mt-1",children:h})]}),u&&e.jsx(C.Button,{isIconOnly:!0,variant:"light",size:"sm",onPress:D,className:"text-default-400 hover:text-default-600 -mr-2",isDisabled:l,children:e.jsx(I.XMarkIcon,{className:"w-4 h-4"})})]}),e.jsx(p.ModalBody,{children:e.jsx("div",{className:"px-6 py-6",children:e.jsx(U.SignUpForm,{methods:t,email:g,organizationId:v,invitationToken:N,redirectUrl:m,onSuccess:_,onError:j,title:void 0,subtitle:void 0,size:b,showBranding:M,disabled:l,requireTerms:S,termsUrl:y,privacyUrl:z,variant:"minimal",className:"space-y-4",showSignInLink:!0,autoFocus:!0})})})]})})}function K(){const[a,s]=k.default.useState(!1),[o,r]=k.default.useState({}),n=i.useCallback(t=>{t&&r(t),s(!0)},[]),c=i.useCallback(()=>{s(!1),setTimeout(()=>{r({})},300)},[]),u=i.useCallback(()=>s(t=>!t),[]);return{isOpen:a,open:n,close:c,toggle:u,setIsOpen:s,modalData:o,setModalData:r}}exports.SignUpModal=H;exports.useSignUpModal=K;
//# sourceMappingURL=sign-up-modal.cjs.map
