import{c as m,r as s,j as e,A as p,y as c}from"./index-XAQEFxR0.js";import{X as u}from"./x-BjlbuifP.js";import{S as y}from"./send-gqAzuMSb.js";/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const j=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],k=m("message-square",j),N=({user:b,token:g})=>{const[a,n]=s.useState(!1),[r,i]=s.useState(""),[t,d]=s.useState("feedback"),[l,x]=s.useState(!1),h=async o=>{if(o.preventDefault(),!!r.trim()){x(!0);try{(await fetch(`${p}/api/feedback`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${g}`},body:JSON.stringify({message:r,type:t})})).ok?(c.success("Feedback sent! Thank you."),i(""),n(!1)):c.error("Failed to send feedback.")}catch(f){console.error(f),c.error("Error sending feedback.")}finally{x(!1)}}};return b?e.jsxs("div",{className:"fixed bottom-6 right-6 z-50 flex flex-col items-end",children:[a&&e.jsxs("div",{className:"mb-4 bg-[#1a1b1e] border border-gray-800 rounded-xl shadow-2xl p-4 w-80 animate-fadeIn",children:[e.jsxs("div",{className:"flex justify-between items-center mb-3",children:[e.jsx("h3",{className:"text-white font-bold text-sm",children:"Send Feedback"}),e.jsx("button",{onClick:()=>n(!1),className:"text-gray-400 hover:text-white",children:e.jsx(u,{size:18})})]}),e.jsxs("form",{onSubmit:h,children:[e.jsxs("div",{className:"flex gap-2 mb-3 bg-gray-900 p-1 rounded-lg",children:[e.jsx("button",{type:"button",onClick:()=>d("feedback"),className:`flex-1 text-xs py-1.5 rounded-md transition-colors ${t==="feedback"?"bg-gray-700 text-white":"text-gray-400 hover:text-gray-300"}`,children:"General Feedback"}),e.jsx("button",{type:"button",onClick:()=>d("upgrade"),className:`flex-1 text-xs py-1.5 rounded-md transition-colors ${t==="upgrade"?"bg-infosec-accent text-white":"text-gray-400 hover:text-gray-300"}`,children:"Upgrade Request"})]}),e.jsx("textarea",{className:"w-full bg-[#0e0f11] border border-gray-800 rounded-lg p-3 text-sm text-gray-300 focus:outline-none focus:border-infosec-accent resize-none h-24 mb-3",placeholder:t==="feedback"?"Tell us what you like or what we can improve...":"Interested in a Pro plan? Let us know!",value:r,onChange:o=>i(o.target.value)}),e.jsx("button",{type:"submit",disabled:l,className:"w-full bg-infosec-accent hover:bg-infosec-accent/90 text-white py-2 rounded-lg text-sm font-bold flex items-center justify-center gap-2 transition-colors disabled:opacity-50",children:l?"Sending...":e.jsxs(e.Fragment,{children:[e.jsx(y,{size:14})," Send Message"]})})]})]}),e.jsx("button",{onClick:()=>n(!a),className:"bg-infosec-accent hover:bg-infosec-accent/90 text-white p-3 rounded-full shadow-lg shadow-infosec-accent/20 transition-all transform hover:scale-105",title:"Send Feedback",children:a?e.jsx(u,{size:24}):e.jsx(k,{size:24})})]}):null};export{N as F,k as M};
