"use client";
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
import { useLicense } from "./LicenseContext";
import { EmailEntry } from "./EmailEntry";
import { LicenseActivationForm } from "./LicenseActivationForm";
import { LicenseCodeEntry } from "./LicenseCodeEntry";
import { AlertCircle, CheckCircle, KeyRound, RefreshCw } from "lucide-react";
export function LicenseOverlay() {
    const { activationState, error, isLoading, licenseType, daysRemaining, activationEmail, activationRetryAfterSeconds, checkEmail, submitLicenseRequest, submitActivationCode, startActivation, } = useLicense();
    // Don't render if idle or just checking
    if (activationState === "idle") {
        return null;
    }
    return (_jsx("div", { className: "fixed inset-0 z-[9999] flex items-center justify-center bg-gray-900/40 backdrop-blur-sm p-4", children: _jsxs("div", { className: "w-full max-w-2xl", children: [_jsxs("div", { className: "shadow-2xl border-none overflow-hidden bg-white rounded-2xl", children: [_jsx("div", { className: "h-1 w-full bg-gray-100", children: _jsx("div", { className: "h-full w-full bg-blue-600" }) }), _jsxs("div", { className: "min-h-[520px] flex flex-col items-center justify-center p-12", children: [_jsx("div", { className: "mb-8 rounded-2xl bg-blue-50 p-6 ring-1 ring-blue-100", children: _jsx(KeyRound, { className: "h-16 w-12 text-blue-600", strokeWidth: 1.5 }) }), activationState === "loading" && (_jsxs("div", { className: "flex flex-col items-center gap-3 text-gray-600", children: [_jsx(RefreshCw, { className: "h-10 w-10 animate-spin text-blue-600" }), _jsx("p", { className: "text-sm font-medium", children: "Processing..." })] })), activationState === "email_entry" && (_jsx(EmailEntry, { onSubmit: checkEmail, error: error })), activationState === "trial_form" && activationEmail && (_jsx(LicenseActivationForm, { email: activationEmail, onSubmit: submitLicenseRequest, onBack: () => startActivation(), error: error })), activationState === "code_entry" && (_jsx(LicenseCodeEntry, { email: activationEmail || "", onSubmit: submitActivationCode, onBack: () => startActivation(), error: error, retryAfterSeconds: activationRetryAfterSeconds })), activationState === "trial_expired" && (_jsxs("div", { className: "max-w-md text-center", children: [_jsx("div", { className: "mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-amber-100", children: _jsx(AlertCircle, { className: "h-8 w-8 text-amber-600" }) }), _jsx("h2", { className: "text-3xl font-bold text-gray-900 mb-4 tracking-tight", children: "Trial Expired" }), _jsx("p", { className: "text-gray-500 leading-relaxed", children: "Your trial period has ended. Please contact us to purchase a license." }), _jsx("a", { href: "mailto:sales@parhelia.ai?subject=License%20Inquiry", className: "mt-8 inline-block rounded-full bg-blue-600 px-8 py-2.5 text-xs font-black uppercase tracking-widest text-white shadow-lg shadow-blue-200 transition-colors hover:bg-blue-700", children: "Contact Sales" })] })), activationState === "welcome_back" && (_jsxs("div", { className: "flex flex-col items-center gap-3 text-green-600 animate-in fade-in zoom-in duration-500", children: [_jsx("div", { className: "rounded-full bg-green-100 p-3", children: _jsx(CheckCircle, { className: "h-10 w-10", strokeWidth: 2 }) }), _jsx("h2", { className: "text-xl font-semibold text-gray-900", children: "Welcome back" }), _jsx("p", { className: "text-gray-600 text-center", children: licenseType === "trial" ? (_jsxs(_Fragment, { children: ["Your trial is active again on this environment.", " ", daysRemaining != null && `${daysRemaining} days remaining.`] })) : ("Your license has been restored.") })] })), activationState === "success" && (_jsxs("div", { className: "flex flex-col items-center gap-3 text-green-600 animate-in fade-in zoom-in duration-500", children: [_jsx("div", { className: "rounded-full bg-green-100 p-3", children: _jsx(CheckCircle, { className: "h-10 w-10", strokeWidth: 2 }) }), _jsx("h2", { className: "text-xl font-semibold text-gray-900", children: "License Activated!" }), _jsx("p", { className: "text-gray-600 text-center", children: licenseType === "trial" ? (_jsxs(_Fragment, { children: ["Your trial is now active.", " ", daysRemaining && `${daysRemaining} days remaining.`] })) : ("Your license has been activated successfully.") })] })), activationState === "error" && (_jsxs("div", { className: "max-w-md text-center", children: [_jsx("div", { className: "mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-red-100", children: _jsx(AlertCircle, { className: "h-8 w-8 text-red-600" }) }), _jsx("h2", { className: "text-2xl font-bold text-gray-900 mb-2", children: "Error" }), _jsx("p", { className: "text-gray-600", children: error || "An error occurred" }), _jsx("button", { onClick: () => startActivation(), className: "mt-8 rounded-full bg-blue-600 px-8 py-2.5 text-xs font-black uppercase tracking-widest text-white shadow-lg shadow-blue-200 transition-colors hover:bg-blue-700", children: "Try Again" })] }))] })] }), _jsxs("p", { className: "mt-8 text-center text-xs text-gray-400", children: ["\u00A9 ", new Date().getFullYear(), " Parhelia. All rights reserved."] })] }) }));
}
//# sourceMappingURL=LicenseOverlay.js.map