import{n as e}from"./rolldown-runtime-DF2fYuay.js";import{l as t}from"./vendor-map-UawGledW.js";import{t as n}from"./vendor-react-Botiei7A.js";import{t as r}from"./useTranslation-8J697w9K.js";import{n as i}from"./index-CYOX-9qz.js";import{t as a}from"./adminService-CdtS3hOA.js";var o=e(t()),s=n();function c({targetType:e,targetId:t,targetName:n,reporterUserId:c,className:l}){let{t:u}=r(),[d,f]=(0,o.useState)(!1),[p,m]=(0,o.useState)(``),[h,g]=(0,o.useState)(``),[_,v]=(0,o.useState)(!1),y=i(),b=[{value:`spam`,label:u(`ui.reportButton.reasonSpam`)},{value:`inappropriate`,label:u(`ui.reportButton.reasonInappropriate`)},{value:`harassment`,label:u(`ui.reportButton.reasonHarassment`)},{value:`misinformation`,label:u(`ui.reportButton.reasonMisinformation`)},{value:`illegal`,label:u(`ui.reportButton.reasonIllegal`)},{value:`other`,label:u(`ui.reportButton.reasonOther`)}],x=()=>f(!0),S=()=>{f(!1),m(``),g(``)};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(`button`,{onClick:x,className:`text-sm text-gray-400 hover:text-red-500 transition-colors flex items-center gap-1 ${l??``}`,title:u(`ui.reportButton.reportContent`),children:[(0,s.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,className:`h-4 w-4`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,children:(0,s.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M3 21v-4m0 0V5a2 2 0 012-2h6.5l1 1H21l-3 6 3 6h-8.5l-1-1H5a2 2 0 00-2 2zm9-13.5V9`})}),u(`ui.reportButton.report`)]}),d&&(0,s.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/50`,onClick:S,children:(0,s.jsxs)(`div`,{className:`bg-white rounded-xl p-6 w-full max-w-md shadow-xl mx-4`,onClick:e=>e.stopPropagation(),children:[(0,s.jsx)(`h3`,{className:`text-lg font-semibold text-gray-900 font-LeagueSpartan mb-1`,children:u(`ui.reportButton.report`)}),(0,s.jsxs)(`p`,{className:`text-sm text-gray-500 mb-4 font-Montserrat truncate`,children:[`"`,n,`"`]}),(0,s.jsxs)(`label`,{className:`block text-sm font-medium text-gray-700 mb-1`,children:[u(`ui.reportButton.reason`),` `,(0,s.jsx)(`span`,{className:`text-red-500`,children:`*`})]}),(0,s.jsxs)(`select`,{value:p,onChange:e=>m(e.target.value),className:`w-full border border-gray-300 text-gray-900 rounded-lg px-3 py-2 mb-4 focus:outline-none focus:ring-2 focus:ring-red-500 focus:border-transparent`,children:[(0,s.jsx)(`option`,{value:``,children:u(`ui.reportButton.selectReason`)}),b.map(e=>(0,s.jsx)(`option`,{value:e.value,children:e.label},e.value))]}),(0,s.jsxs)(`label`,{className:`block text-sm font-medium text-gray-700 mb-1`,children:[u(`ui.reportButton.description`),` `,(0,s.jsxs)(`span`,{className:`text-gray-400`,children:[`(`,u(`ui.reportButton.optional`),`)`]})]}),(0,s.jsx)(`textarea`,{value:h,onChange:e=>g(e.target.value),rows:3,placeholder:u(`ui.reportButton.descriptionPlaceholder`),className:`w-full border border-gray-300 text-gray-900 rounded-lg px-3 py-2 mb-6 focus:outline-none focus:ring-2 focus:ring-red-500 focus:border-transparent resize-none`}),(0,s.jsxs)(`div`,{className:`flex gap-3 justify-end`,children:[(0,s.jsx)(`button`,{onClick:S,className:`px-4 py-2 text-sm text-gray-600 hover:text-gray-900 transition-colors`,children:u(`ui.confirmDialog.cancel`)}),(0,s.jsx)(`button`,{onClick:async()=>{if(p){v(!0);try{await a.createReport({type:e,target:t,reason:p,reporter:c,description:h||void 0}),y.success(u(`ui.reportButton.reportSent`)),S()}catch{y.error(u(`ui.reportButton.reportError`))}finally{v(!1)}}},disabled:!p||_,className:`px-4 py-2 text-sm bg-red-600 hover:bg-red-700 disabled:opacity-50 disabled:cursor-not-allowed text-white rounded-lg transition-colors`,children:u(_?`ui.reportButton.sending`:`ui.reportButton.send`)})]})]})})]})}export{c as t};