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