import{u as S,r as o,j as e,A as M}from"./index-XAQEFxR0.js";const U=({onClose:i,title:b,message:u})=>{const j=S(),[s,d]=o.useState("monthly"),[t,N]=o.useState(null);o.useEffect(()=>{(async()=>{try{const r=await fetch(`${M}/api/auth/config`);if(r.ok){const P=await r.json();N(P)}}catch(r){console.error("Failed to load config",r)}})()},[]);const v=()=>{i(),j("/dashboard?view=subscription")},l=f=>parseFloat((f||"0").toString().replace("$","")),x=(t==null?void 0:t.stripe_price_display_monthly)||"$9.99",m=(t==null?void 0:t.stripe_price_original_monthly)||"$19.99",h=(t==null?void 0:t.stripe_price_display_yearly)||"$98";t!=null&&t.stripe_price_original_yearly;const y=s==="monthly"?x:h,g=l(y),n=l(m),p=n*12,w=`$${p.toFixed(2)}`,_=s==="monthly"?m:w,c=s==="monthly"?n:p,a=c>g?Math.round((c-g)/c*100):0;l(x);const k=l(h),$=Math.round((n*12-k)/(n*12)*100);return e.jsx("div",{className:"fixed inset-0 bg-black/80 backdrop-blur-sm flex items-center justify-center z-50 p-4",children:e.jsxs("div",{className:"bg-[#1a1b1e] border border-infosec-accent/30 rounded-2xl max-w-md w-full overflow-hidden shadow-[0_0_50px_rgba(0,255,65,0.1)] relative",children:[a>=10&&e.jsxs("div",{className:"absolute top-4 right-4 bg-gradient-to-r from-orange-500 to-yellow-500 text-black text-xs font-bold px-3 py-1 rounded-full shadow-lg transform rotate-2",children:["SAVE ",a,"%"]}),e.jsxs("div",{className:"p-6 text-center",children:[e.jsx("div",{className:"w-16 h-16 bg-infosec-accent/10 rounded-full flex items-center justify-center mx-auto mb-4",children:e.jsx("span",{className:"text-3xl",children:"🚀"})}),e.jsx("h2",{className:"text-2xl font-bold text-white mb-2",children:b||"Limit Reached"}),e.jsx("p",{className:"text-gray-400 mb-6",children:u||"You've reached your monthly limit of 3 alerts on the Free plan. Upgrade to Pro to investigate unlimited alerts!"}),e.jsx("div",{className:"flex justify-center mb-6",children:e.jsxs("div",{className:"bg-gray-800 p-1 rounded-lg flex",children:[e.jsx("button",{onClick:()=>d("monthly"),className:`px-4 py-1.5 rounded-md text-sm font-medium transition-all ${s==="monthly"?"bg-gray-700 text-white shadow":"text-gray-400 hover:text-white"}`,children:"Monthly"}),e.jsxs("button",{onClick:()=>d("yearly"),className:`px-4 py-1.5 rounded-md text-sm font-medium transition-all ${s==="yearly"?"bg-gray-700 text-white shadow":"text-gray-400 hover:text-white"}`,children:["Yearly ",e.jsxs("span",{className:"text-xs text-green-400 ml-1",children:["-",$,"%"]})]})]})}),e.jsxs("div",{className:"bg-gray-800/50 rounded-xl p-4 mb-6 border border-gray-700 text-left relative overflow-hidden",children:[a>0&&e.jsxs("div",{className:"absolute top-0 right-0 bg-yellow-500 text-black text-[10px] font-bold px-2 py-0.5 rounded-bl-lg",children:[a,"% OFF"]}),e.jsxs("div",{className:"flex justify-between items-center mb-2 mt-1",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("span",{className:"font-bold text-white",children:"Pro Plan"})}),e.jsxs("div",{className:"flex items-center gap-2",children:[a>0&&e.jsx("span",{className:"text-gray-500 line-through text-sm font-medium",children:_}),e.jsxs("span",{className:"text-infosec-accent font-bold text-lg",children:[y,"/",s==="monthly"?"mo":"yr"]})]})]}),e.jsxs("ul",{className:"space-y-2 text-sm text-gray-300",children:[e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-infosec-accent",children:"✓"})," Unlimited Investigations"]}),e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-infosec-accent",children:"✓"})," Priority Support"]}),e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-infosec-accent",children:"✓"})," Advanced Analytics"]})]})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx("button",{onClick:i,className:"flex-1 px-4 py-2 rounded-lg border border-gray-600 text-gray-300 hover:bg-gray-800 transition font-medium",children:"Maybe Later"}),e.jsx("button",{onClick:v,className:"flex-1 px-4 py-2 rounded-lg bg-infosec-accent text-black font-bold hover:bg-infosec-accentHover transition shadow-lg shadow-infosec-accent/20",children:"Upgrade Now"})]})]})]})})};export{U};
