1import{h as k,o as E,a as h,g as _,p as L,j as t,L as m}from"./react-vendor-DBxhyi1n.js";import{w as S,u as T,s as I,b as D}from"./index-CSyO7D9J.js";import{A as v}from"./arrow-left-DcnVAqpH.js";import{S as G}from"./send-4uLOfctg.js";const e={BG_CARD:"#ffffff",BG_CARD2:"#ffffff",BG_ADMIN:"#eef2fb",LINE:"rgba(15, 23, 42, .07)",LINE_GOLD:"rgba(37, 99, 235,.18)",LINE_BLUE:"rgba(59,130,246,.2)",GOLD:"#2563eb",GOLD2:"#1d4ed8",TEXT:"#0f172a",MUTED:"#64748b",DIMMED:"#94a3b8"},R={open:{bg:"rgba(34,197,94,.12)",color:"#4ade80"},in_progress:{bg:"rgba(59,130,246,.12)",color:"#60a5fa"},waiting:{bg:"rgba(245,158,11,.12)",color:"#fbbf24"},resolved:{bg:"rgba(74,82,96,.35)",color:e.MUTED},closed:{bg:"rgba(74,82,96,.35)",color:e.DIMMED}};function z({status:o,label:l}){const n=R[o]??{bg:"rgba(74,82,96,.35)",color:e.MUTED};return t.jsx("span",{style:{display:"inline-flex",alignItems:"center",padding:"2px 10px",borderRadius:"9999px",fontSize:"12px",fontWeight:600,background:n.bg,color:n.color},children:l})}function B(){var f,y;const{id:o}=k(),{toast:l}=S(),{t:n}=T(),c=E(),[a,p]=h.useState(""),[x,g]=h.useState(!1),{data:u,isLoading:j}=_({queryKey:["my-ticket",o],queryFn:()=>D.get(`/tickets/my/${o}`),enabled:!!o}),r=L({mutationFn:i=>D.post(`/tickets/my/${o}/replies`,{message:i}),onSuccess:()=>{p(""),c.invalidateQueries({queryKey:["my-ticket",o]}),c.invalidateQueries({queryKey:["my-tickets"]}),l({title:n("tickets.detail.sendReply")})},onError:i=>l({title:i.message||"Error",variant:"destructive"})});if(j)return t.jsx("div",{style:{padding:"32px",fontSize:"14px",color:e.MUTED},children:n("tickets.loading")});if(!u)return t.jsx("div",{style:{padding:"32px",color:"#f87171"},children:n("tickets.detail.notFound")});const d=i=>new Date(i).toLocaleString("en-GB",{day:"2-digit",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit"}),s=u;return t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"24px",maxWidth:"768px"},children:[t.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"16px"},children:[t.jsxs(m,{to:"/account/tickets",style:{display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"14px",fontWeight:500,color:e.MUTED,textDecoration:"none",padding:"6px 12px",borderRadius:"8px",border:`1px solid ${e.LINE}`,background:e.BG_CARD2,flexShrink:0,transition:"border-color 0.15s"},onMouseEnter:i=>i.currentTarget.style.borderColor=e.LINE_GOLD,onMouseLeave:i=>i.currentTarget.style.borderColor=e.LINE,children:[t.jsx(v,{style:{height:"16px",width:"16px"}}),n("tickets.detail.backToTickets")]}),t.jsxs("div",{style:{flex:1},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"},children:[t.jsxs("span",{style:{fontFamily:"monospace",fontSize:"12px",color:e.DIMMED},children:["#",s.ticket_number]}),t.jsx(z,{status:s.status,label:n(`tickets.status.${s.status}`)||s.status.replace("_"," ")}),s.plugin_name&&t.jsx("span",{style:{fontSize:"12px",color:e.GOLD,fontWeight:500},children:s.plugin_name}),s.license_status&&t.jsxs("span",{style:{fontSize:"12px",padding:"2px 8px",borderRadius:"9999px",fontWeight:500,background:s.license_status==="active"?"rgba(34,197,94,.12)":"rgba(239,68,68,.12)",color:s.license_status==="active"?"#4ade80":"#f87171"},children:["License ",s.license_status]})]}),t.jsx("h1",{style:{fontSize:"20px",fontWeight:700,color:e.TEXT,margin:"6px 0 0"},children:s.subject}),t.jsxs("p",{style:{fontSize:"12px",color:e.MUTED,marginTop:"2px"},children:[(f=s.category)==null?void 0:f.replace("-"," ")," · ",d(s.created_at)]})]})]}),t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:[t.jsxs("div",{style:{borderRadius:"12px",border:`1px solid ${e.LINE_GOLD}`,background:e.BG_CARD,padding:"20px"},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"12px"},children:[t.jsx("div",{style:{height:"28px",width:"28px",borderRadius:"50%",background:"rgba(37, 99, 235,.15)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"14px",fontWeight:700,color:e.GOLD},children:(y=s.name[0])==null?void 0:y.toUpperCase()}),t.jsxs("div",{children:[t.jsxs("p",{style:{fontSize:"14px",fontWeight:600,color:e.TEXT,margin:0}
1,children:[s.name," (",n("tickets.detail.you"),")"]}),t.jsx("p",{style:{fontSize:"12px",color:e.MUTED,margin:0},children:d(s.created_at)})]})]}),t.jsx("p",{style:{fontSize:"14px",color:e.TEXT,lineHeight:1.65,whiteSpace:"pre-wrap",margin:0,opacity:.9},children:s.message})]}),s.replies.map(i=>{var b;return t.jsxs("div",{style:{borderRadius:"12px",border:i.sender_type==="admin"?`1px solid ${e.LINE_BLUE}`:`1px solid ${e.LINE}`,background:i.sender_type==="admin"?e.BG_ADMIN:e.BG_CARD2,padding:"20px"},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"12px"},children:[t.jsx("div",{style:{height:"28px",width:"28px",borderRadius:"50%",background:i.sender_type==="admin"?"rgba(59,130,246,.2)":"rgba(37, 99, 235,.15)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"14px",fontWeight:700,color:i.sender_type==="admin"?"#60a5fa":e.GOLD},children:i.sender_type==="admin"?"S":(b=i.sender_name[0])==null?void 0:b.toUpperCase()}),t.jsxs("div",{children:[t.jsx("p",{style:{fontSize:"14px",fontWeight:600,color:e.TEXT,margin:0},children:i.sender_type==="admin"?n("tickets.detail.support"):`${i.sender_name} (${n("tickets.detail.you")})`}),t.jsx("p",{style:{fontSize:"12px",color:e.MUTED,margin:0},children:d(i.created_at)})]})]}),t.jsx("p",{style:{fontSize:"14px",color:e.TEXT,lineHeight:1.65,whiteSpace:"pre-wrap",margin:0,opacity:.9},children:i.message})]},i.id)})]}),s.status!=="closed"&&s.status!=="resolved"?t.jsxs("div",{style:{borderRadius:"12px",border:`1px solid ${e.LINE_GOLD}`,background:e.BG_CARD,padding:"20px",display:"flex",flexDirection:"column",gap:"12px"},children:[t.jsx("h3",{style:{fontSize:"14px",fontWeight:600,color:e.TEXT,margin:0},children:"Add a reply"}),t.jsx("textarea",{value:a,onChange:i=>p(i.target.value),placeholder:n("tickets.detail.replyPlaceholder"),rows:4,style:{width:"100%",background:e.BG_CARD2,border:`1px solid ${x?e.GOLD:"rgba(15, 23, 42, .08)"}`,borderRadius:"10px",padding:"12px",fontSize:"14px",color:e.TEXT,outline:"none",resize:"none",boxSizing:"border-box",boxShadow:x?"0 0 0 2px rgba(37, 99, 235,.2)":"none",transition:"border-color 0.15s, box-shadow 0.15s"},onFocus:()=>g(!0),onBlur:()=>g(!1)}),t.jsxs("button",{onClick:()=>r.mutate(a),disabled:!a.trim()||r.isPending,style:{alignSelf:"flex-start",display:"inline-flex",alignItems:"center",gap:"8px",borderRadius:"9999px",padding:"10px 20px",fontSize:"14px",fontWeight:600,border:"none",cursor:!a.trim()||r.isPending?"not-allowed":"pointer",background:!a.trim()||r.isPending?e.BG_CARD2:`linear-gradient(135deg, ${e.GOLD}, ${e.GOLD2})`,color:!a.trim()||r.isPending?e.DIMMED:"#f1f5fb",opacity:!a.trim()||r.isPending?.6:1,transition:"all 0.2s"},children:[r.isPending?t.jsx(I,{style:{height:"14px",width:"14px"},className:"animate-spin"}):t.jsx(G,{style:{height:"14px",width:"14px"}}),r.isPending?n("tickets.detail.sending"):n("tickets.detail.sendReply")]})]}):t.jsxs("div",{style:{borderRadius:"12px",border:`1px solid ${e.LINE}`,background:e.BG_CARD2,padding:"20px",textAlign:"center",display:"flex",flexDirection:"column",alignItems:"center",gap:"12px"},children:[t.jsx("p",{style:{fontSize:"14px",color:e.MUTED,margin:0},children:n("tickets.detail.closedNotice")}),t.jsx(m,{to:"/support",style:{display:"inline-flex",alignItems:"center",borderRadius:"9999px",padding:"8px 18px",fontSize:"14px",fontWeight:600,textDecoration:"none",border:`1px solid ${e.LINE_GOLD}`,color:e.GOLD,background:"rgba(37, 99, 235,.08)",transition:"background 0.15s"},children:"Open a new ticket"})]})]})}export{B as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.