1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1937],{14135:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>j});var r=a(37876),s=a(14232),n=a(98477),l=a(89099),i=a(62422),o=a(62406),d=a(94430);function c({children:e}){let[t,a]=(0,s.useState)(null);return(0,s.useEffect)(()=>{let e=document.createElement("div");return e.className="app-shell",document.body.appendChild(e),a(e),()=>{document.body.removeChild(e)}},[]),t?(0,n.createPortal)(e,t):null}let x=e=>e?new Date(e).toLocaleString("en-US",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit",timeZone:"America/New_York"}):"",h={app:"APP",website:"WEBSITE",email:"EMAIL",phone:"PHONE / TEXT","in-person":"IN PERSON",internal:"INTERNAL"},m=["general","app","account","technical","event","ticketing","donation","sponsorship","vendor","volunteer","membership","refund","feedback","media","data-deletion","internal","spam","other"],p=["low","normal","high","urgent"],b={low:"#9ca3af",normal:"#3b82f6",high:"#f59e0b",urgent:"#ef4444"},u=(e,t)=>(String(e||t||"?").trim()[0]||"?").toUpperCase(),g=["#F26644","#0F2044","#2e9664","#7c3aed","#0891b2","#db2777"],f=e=>g[String(e||"").split("").reduce((e,t)=>e+t.charCodeAt(0),0)%g.length],y=e=>e>1e6?`${(e/1e6).toFixed(1)} MB`:`${Math.max(1,Math.round(e/1024))} KB`;function j(){let e=(0,l.useRouter)(),{member:t,loading:a}=(0,o.IG)(),{toast:n,confirm:g,promptText:j}=(0,d.j)(),k=t?.staff_role==="admin",[N,v]=(0,s.useState)("open"),[C,S]=(0,s.useState)(""),[$,D]=(0,s.use
1State)({source:"",category:"",priority:"",mine:!1}),[_,E]=(0,s.useState)(null),[M,P]=(0,s.useState)(null),[T,z]=(0,s.useState)(""),[F,A]=(0,s.useState)([]),[B,R]=(0,s.useState)(!1),[O,L]=(0,s.useState)(!1),[I,U]=(0,s.useState)(!1),[W,q]=(0,s.useState)(!1);function X(){let e=new URLSearchParams({status:N});C&&e.set("search",C),$.source&&e.set("source",$.source),$.category&&e.set("category",$.category),$.priority&&e.set("priority",$.priority),$.mine&&e.set("assignee","me"),fetch(`/api/member/mod/support-tickets?${e}`,{cache:"no-store"}).then(e=>e.json()).then(e=>E(e.error?{tickets:[]}:e)).catch(()=>E({tickets:[]}))}function J(e){P("loading"),z(""),fetch(`/api/member/mod/support-tickets?id=${e}`,{cache:"no-store"}).then(e=>e.json()).then(e=>P(e.ticket||null)).catch(()=>P(null))}async function G(e){let t=await fetch("/api/member/mod/support-tickets",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),a=await t.json().catch(()=>({}));if(!t.ok||!a.ok)throw Error(a.error||"Failed");return a}async function H(e=!1){if((T.trim()||F.length)&&M?.id){R(!0);try{let t=await G({action:e?"reply-close":"reply",id:M.id,body:T,attachments:F});P(t.ticket),z(""),A([]),n(e?"Sent & closed.":"Reply sent.","success"),X()}catch(e){n(e.message,"error")}finally{R(!1)}}}async function K(e){let t=Array.from(e||[]).slice(0,10),a=(await Promise.all(t.map(e=>new Promise(t=>{let a=new FileReader;a.onload=()=>t({name:e.name,contentType:e.type||"application/octet-stream",size:e.size,dataBase64:String(a.result).split(",")[1]||""}),a.onerror=()=>t(null),a.readAsDataURL(e)})))).filter(Boolean);A(e=>{let t=[...e,...a];return t.reduce((e,t)=>e+(t.size||0),0)>0xc00000?(n("Attachments must total under 12 MB.","error"),e):t})}async function V(){if(M?.id){L(!0);try{let e=await G({action:"draft",id:M.id,body:T});e.draft&&z(e.draft)}catch(e){n(e.message,"error")}finally{L(!1)}}}async function Y(){P((await fetch(`/api/member/mod/support-tickets?id=${M.id}`,{cache:"no-store"}).then(e=>e.json())).ticket),X()}async function Z(e,t={},a){if(M?.id&&(!a||await g({title:a,danger:!0,confirmLabel:"Confirm"})))try{let a=await G({action:e,id:M.id,...t});if(a.deleted){n(`Ticket #${M.ref} deleted.`,"success"),P(null),X();return}if(a.merged){P(null),X();return}let r=a.contactsSuppressed>0?` ${a.contactsSuppressed} contact${1===a.contactsSuppressed?"":"s"} taken off the contacts list.`:"";a.blocked?n(`Blocked ${a.blocked} â future mail from that domain won't open a ticket.${r}`,"success"):"spam"===e&&n(`Marked as spam and sender blocked.${r}`,"success"),a.ticket?(P(a.ticket),X()):await Y()}catch(e){n(e.message,"error")}}async function Q(){let e=await j({title:`Merge ticket #${M.ref}`,message:"Enter the ticket number to merge this one INTO.",placeholder:"e.g. 1042",confirmLabel:"Merge"});if(e)try{let t=await G({action:"merge",id:M.id,intoRef:e.trim().replace(/^#/,"")});n(`Merged into #${t.intoRef}.`,"success"),P(null),X()}catch(e){n(e.message,"error")}}async function ee(e){let t=await fetch("/api/member/mod/support-tickets",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"create",...e})}),a=await t.json().catch(()=>({}));if(!t.ok||!a.ok)throw Error(a.error||"Could not create ticket");U(!1),n(`Ticket #${a.ref} created.`,"success"),X(),a.id&&J(a.id)}(0,s.useEffect)(()=>{if(!a){if(t&&!(t.is_staff&&["staff","admin"].includes(t.staff_role)))return void e.replace("/app");X()}},[a,t,N,C,$]);let et=_?.tickets||[],ea=_?.macros||[],er=_?.counts||{},es=({children:e,cls:t})=>(0,r.jsx)("span",{className:`text-[10px] font-bold rounded-full px-2 py-0.5 ${t}`,children:e});return(0,r.jsxs)(i.Ay,{title:"Support",active:"/app/admin",children:[(0,r.jsxs)("div",{className:"app-fade-up flex items-center justify-between gap-2 mb-3",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"text-xl font-extrabold text-brand-navy dark:text-white",children:"Support"}),null!=er.open&&(0,r.jsxs)("p",{className:"text-xs text-gray-400 dark:text-white/45",children:[er.open," open \xb7 ",er.closed||0," archived"]})]}),(0,r.jsxs)("button",{onClick:()=>U(!0),className:"inline-flex items-center gap-1 text-white text-sm font-bold rounded-full px-4 py-2 shadow-xs active:scale-95 transition-transform",style:{background:"linear-gradient(135deg,#F26644,#FF9933)"},children:[(0,r.jsx)("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.6",strokeLinecap:"round",children:(0,r.jsx)("path",{d:"M12 5v14M5 12h14"})}),"New"]})]}),(0,r.jsx)("div",{className:"flex gap-1 bg-gray-100 rounded-2xl p-1 mb-2",children:[["open",`Open${null!=er.open?` (${er.open})`:""}`],["closed","Archived"]].map(([e,t])=>(0,r.jsx)("button",{onClick:()=>v(e),className:`flex-1 py-2 rounded-xl text-sm font-bold ${N===e?"bg-white text-brand-navy dark:text-white shadow-xs":"text-gray-500 dark:text-white/55"}`,children:t},e))}),(0,r.jsxs)("div",{className:"relative mb-2",children:[(0,r.jsxs)("svg",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-gray-400 dark:text-white/45",width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,r.jsx)("circle",{cx:"11",cy:"11",r:"7"}),(0,r.jsx)("path",{d:"m21 21-4.3-4.3"})]}),(0,r.jsx)("input",{value:C,onChange:e=>S(e.target.value),placeholder:"Search #, subject, email, phoneâ¦",className:"w-full border border-orange-100 rounded-xl pl-9 pr-3 py-2.5 text-sm"})]}),(0,r.jsxs)("div",{className:"flex gap-2 mb-3 overflow-x-auto pb-1",children:[(0,r.jsx)("button",{onClick:()=>D({...$,mine:!$.mine}),className:`px-3 py-1.5 text-xs font-bold rounded-xl border shrink-0 ${$.mine?"bg-brand-navy text-white border-brand-navy":"bg-white text-gray-500 dark:text-white/55 border-orange-100"}`,children:"Mine"}
1),(0,r.jsxs)("select",{value:$.source,onChange:e=>D({...$,source:e.target.value}),className:"border border-orange-100 rounded-xl px-3 py-1.5 text-xs bg-white shrink-0",children:[(0,r.jsx)("option",{value:"",children:"Platform"}),Object.entries(h).map(([e,t])=>(0,r.jsx)("option",{value:e,children:t},e))]}),(0,r.jsxs)("select",{value:$.category,onChange:e=>D({...$,category:e.target.value}),className:"border border-orange-100 rounded-xl px-3 py-1.5 text-xs bg-white shrink-0 capitalize",children:[(0,r.jsx)("option",{value:"",children:"Category"}),m.map(e=>(0,r.jsx)("option",{value:e,children:e},e))]}),(0,r.jsxs)("select",{value:$.priority,onChange:e=>D({...$,priority:e.target.value}),className:"border border-orange-100 rounded-xl px-3 py-1.5 text-xs bg-white shrink-0 capitalize",children:[(0,r.jsx)("option",{value:"",children:"Priority"}),p.map(e=>(0,r.jsx)("option",{value:e,children:e},e))]})]}),null===_?(0,r.jsx)("div",{className:"space-y-2",children:[0,1,2].map(e=>(0,r.jsx)("div",{className:"h-[76px] rounded-2xl bg-white border border-orange-100 app-shine"},e))}):0===et.length?(0,r.jsxs)("div",{className:"bg-white border border-dashed border-orange-100 rounded-2xl p-10 text-center",children:[(0,r.jsx)("p",{className:"text-gray-500 dark:text-white/55 text-sm font-semibold",children:"No tickets here"}),(0,r.jsx)("p",{className:"text-gray-400 dark:text-white/45 text-xs mt-1",children:"open"===N?"The inbox is clear.":"Nothing archived yet."})]}):(0,r.jsx)("div",{className:"space-y-2",children:et.map(e=>{let t="open"===e.status&&!e.first_response_at;return(0,r.jsx)("button",{onClick:()=>J(e.id),className:"w-full text-left bg-white border border-orange-100 rounded-2xl p-3.5 shadow-xs active:scale-[.99] transition-transform",children:(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("div",{className:"w-9 h-9 rounded-full flex items-center justify-center text-white text-xs font-bold shrink-0 mt-0.5",style:{background:f(e.name||e.email)},children:u(e.name,e.email)}),(0,r.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,r.jsxs)("p",{className:"font-bold text-brand-navy dark:text-white truncate flex items-center gap-1.5",children:[e.priority&&"normal"!==e.priority&&(0,r.jsx)("span",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{background:b[e.priority]}}),e.subject||"(no subject)"]}),(0,r.jsxs)("span",{className:"text-[11px] font-mono text-gray-400 dark:text-white/45 shrink-0",children:["#",e.ref]})]}),(0,r.jsxs)("p",{className:"text-gray-500 dark:text-white/55 text-xs truncate mt-0.5",children:[e.name?`${e.name} \xb7 `:"",e.email||e.phone||"no contact"]}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5 mt-1.5",children:[e.source&&(0,r.jsx)(es,{cls:"bg-brand-navy text-white",children:h[e.source]||String(e.source).toUpperCase()}),e.category&&(0,r.jsx)(es,{cls:"bg-orange-50 text-brand-orange dark:text-brand-saffron",children:(0,r.jsx)("span",{className:"capitalize",children:e.category})}),t&&(0,r.jsxs)(es,{cls:(e=>{let t=(Date.now()-new Date(e).getTime())/6e4;return t>1440?"bg-red-50 text-red-600":t>240?"bg-amber-50 text-amber-700":"bg-gray-100 text-gray-500 dark:text-white/55"})(e.created_at),children:["awaiting ",(e=>{if(!e)return"";let t=Math.max(0,Math.round((Date.now()-new Date(e).getTime())/6e4));return t<60?`${t}m`:t<1440?`${Math.round(t/60)}h`:`${Math.round(t/1440)}d`})(e.created_at)]}),e.assignee_email&&(0,r.jsxs)(es,{cls:"bg-indigo-50 text-indigo-600",children:["@",(e.assignee_name||e.assignee_email).split(" ")[0].split("@")[0]]}),1===e.csat&&(0,r.jsx)("span",{children:"\uD83D\uDC4D"}),-1===e.csat&&(0,r.jsx)("span",{children:"\uD83D\uDC4E"}),e.auto_closed&&(0,r.jsx)(es,{cls:"bg-green-50 text-brand-green-dark dark:text-brand-green-light",children:"auto"}),(0,r.jsx)("span",{className:"text-gray-400 dark:text-white/45 text-[11px] ml-auto",children:x(e.last_msg_at)})]})]})]})},e.id)})}),M&&(0,r.jsx)(c,{children:(0,r.jsx)("div",{className:"fixed inset-0 z-100 bg-[#FBFAF8] flex flex-col",style:{paddingTop:"env(safe-area-inset-top)"},children:"loading"===M?(0,r.jsx)("div",{className:"flex-1 flex items-center justify-center text-gray-400 dark:text-white/45 text-sm",children:"Loadingâ¦"}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"px-4 py-3 border-b border-orange-100 bg-white flex items-start justify-between gap-2",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2.5 min-w-0",children:[(0,r.jsx)("div",{className:"w-9 h-9 rounded-full flex items-center justify-center text-white text-xs font-bold shrink-0",style:{background:f(M.name||M.email)},children:u(M.name,M.email)}),(0,r.jsxs)("div",{className:"min-w-0",children:[(0,r.jsxs)("p",{className:"font-bold text-brand-navy dark:text-white truncate flex items-center gap-1.5",children:[M.subject,1===M.csat&&(0,r.jsx)("span",{children:"\uD83D\uDC4D"}),-1===M.csat&&(0,r.jsx)("span",{children:"\uD83D\uDC4E"})]}),(0,r.jsxs)("p",{className:"text-gray-400 dark:text-white/45 text-xs",children:["#",M.ref," \xb7 ",x(M.created_at)]})]})]}),(0,r.jsx)("button",{onClick:()=>P(null),className:"w-9 h-9 rounded-full bg-orange-50 text-brand-orange dark:text-brand-saffron flex items-center justify-center text-xl leading-none shrink-0",children:"\xd7"})]}),(0,r.jsxs)("div",{className:"flex-1 overflow-y-auto",children:[(0,r.jsxs)("div",{className:"px-4 py-3 border-b border-orange-50 bg-white",children:[(0,r.jsxs)("div",{className:"text-xs text-gray-600 dark:text-white/70 space-y-0.5 mb-2",children:[M.name&&(0,r.jsxs)("p",{children:[(0,r.jsx)("span",{className:"text-gray-400 dark:text-white/45 w-14 inline-block",children:"Name"}),M.name]}),M.email&&(0,r.jsxs)("p",{children:[(0,r.jsx)("span",{className:"text-gray-400 dark:text-white/45 w-14 inline-block",children:"Email"}),(0,r.jsx)("a",{href:`mailto:${M.email}`,className:"text-brand-navy dark:text-white",children:M.email})]}),M.phone&&(0,r.jsxs)("p",{children:[(0,r.jsx)("span",{className:"text-gray-400 dark:text-white/45 w-14 inline-block",children:"Phone"}),(0,r.jsx)("a",{href:`tel:${M.phone}`,className:"text-brand-navy dark:text-white",children:M.phone})]}),(0,r.jsxs)("p",{children:[(0,r.jsx)("span",{className:"text-gray-400 dark:text-white/45 w-14 inline-block",children:"Platform"}),h[M.source]||M.source||"â"]}),M.contact_id&&(0,r.jsxs)("p",{children:[(0,r.jsx)("span",{className:"text-gray-400 dark:text-white/45 w-14 inline-block",children:"Contact"}),(0,r.jsx)("button",{onClick:()=>e.push(`/app/admin/contact/${M.contact_id}`),className:"text-brand-orange dark:text-brand-saffron font-semibold",children:"View CRM profile â"})]})]}),(0,r.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,r.jsx)("select",{value:M.priority||"normal",onChange:e=>Z("priority",{priority:e.target.value}),className:"border border-orange-100 rounded-lg px-2 py-1 text-xs bg-white capitalize",children:p.map(e=>(0,r.jsxs)("option",{value:e,children:[e," priority"]},e))}),(0,r.jsx)("select",{value:M.category||"general",onChange:e=>Z("category",{category:e.target.value}),className:"border border-orange-100 rounded-lg px-2 py-1 text-xs bg-white capitalize",children:m.map(e=>(0,r.jsx)("option",{value:e,children:e},e))}),(0,r.jsx)(es,{cls:"open"===M.status?"bg-green-50 text-green-700 self-center":"bg-gray-100 text-gray-500 dark:text-white/55 self-center",children:"open"===M.status?"Open":"Archived"})]})]}),(0,r.jsx)("div",{className:"px-4 py-3 space-y-3",children:(M.messages||[]).map(e=>{let t="outbound"===e.direction,a="note"===e.direction;return(0,r.jsxs)("div",{className:`flex flex-col ${t?"items-end":"items-start"}`,children:[(0,r.jsxs)("div",{className:`rounded-2xl px-3.5 py-2.5 text-sm whitespace-pre-wrap max-w-[85%] shadow-xs ${t?"bg-brand-navy text-white rounded-br-md":a?"bg-amber-50 text-amber-900 border border-amber-200":"bg-white text-brand-navy dark:text-white border border-orange-100 rounded-bl-md"}`,children:[e.body,Array.isArray(e.attachments)&&e.attachments.length>0&&(0,r.jsx)("div",{className:`mt-2 pt-2 space-y-1 border-t ${t?"border-white/20":"border-gray-200"}`,children:e.attachments.map((e,a)=>e.missing||!(e.path||e.url)?(0,r.jsxs)("span",{className:`flex items-center gap-1.5 text-xs ${t?"text-orange-200/70":"text-gray-500 dark:text-white/50"}`,children:["\uD83D\uDCCE ",e.name,e.size?(0,r.jsxs)("span",{className:"opacity-60",children:[" \xb7 ",y(e.size)]}):null," ",(0,r.jsx)("span",{className:"opacity-70",children:"â not retrieved"})]},a):(0,r.jsxs)("a",{href:e.path?`/api/support/attachment?p=${encodeURIComponent(e.path)}&n=${encodeURIComponent(e.name||"file")}`:e.url,target:"_blank",rel:"noreferrer",className:`flex items-center gap-1.5 text-xs font-semibold ${t?"text-orange-200":"text-brand-orange dark:text-brand-saffron"}`,children:["\uD83D\uDCCE ",e.name," ",(0,r.jsxs)("span",{className:"opacity-60",children:["\xb7 ",y(e.size||0)]})]},a))})]}),(0,r.jsxs)("p",{className:"text-[10px] text-gray-400 dark:text-white/45 mt-1 px-1",children:[a?`Note \xb7 ${e.author||""}
1`:t?e.author||"Support":M.name||M.email||"Requester"," \xb7 ",x(e.created_at)]})]},e.id)})}),(0,r.jsxs)("div",{className:"px-4 py-2 flex flex-wrap gap-2 border-t border-orange-50",children:[(0,r.jsx)("button",{onClick:()=>Z("assign",{assign:M.assignee_email?"none":"me"}),className:"border border-indigo-200 text-indigo-600 text-xs font-bold rounded-lg px-3 py-1.5 bg-white",children:M.assignee_email?"Unassign":"Assign to me"}),(0,r.jsx)("button",{onClick:Q,className:"border border-orange-100 text-gray-600 dark:text-white/70 text-xs font-bold rounded-lg px-3 py-1.5 bg-white",children:"Merge"}),(0,r.jsx)("button",{onClick:()=>Z("status",{status:"open"===M.status?"closed":"open"}),className:"border border-orange-100 text-gray-600 dark:text-white/70 text-xs font-bold rounded-lg px-3 py-1.5 bg-white",children:"open"===M.status?"Close":"Reopen"}),(0,r.jsx)("button",{onClick:()=>Z("spam",{},`Mark spam & block ${M.email||"sender"}?`),className:"border border-amber-200 text-amber-700 text-xs font-bold rounded-lg px-3 py-1.5 bg-white",children:"Spam"}),(0,r.jsx)("button",{onClick:()=>Z("block-domain",{},`Block @${(M.email||"").split("@")[1]||""}?`),className:"border border-red-200 text-red-600 text-xs font-bold rounded-lg px-3 py-1.5 bg-white",children:"Block domain"}),k&&(0,r.jsx)("button",{onClick:()=>Z("delete",{},`Delete #${M.ref}?`),className:"border border-red-200 text-red-700 text-xs font-bold rounded-lg px-3 py-1.5 bg-white",children:"Delete"})]})]}),(0,r.jsxs)("div",{className:"px-4 py-3 border-t border-orange-100 bg-white space-y-2",style:{paddingBottom:"calc(12px + env(safe-area-inset-bottom))"},children:[W&&(0,r.jsxs)("div",{className:"border border-orange-100 rounded-xl max-h-48 overflow-y-auto bg-white",children:[0===ea.length&&(0,r.jsx)("p",{className:"text-xs text-gray-400 dark:text-white/45 p-3",children:"No canned replies yet."}),ea.map(e=>(0,r.jsxs)("button",{onClick:()=>{z(t=>t?`${t} 2 3${e.body}`:e.body),q(!1)},className:"w-full text-left px-3 py-2 hover:bg-orange-50 border-b border-orange-50 last:border-0",children:[(0,r.jsx)("span",{className:"text-sm font-semibold text-brand-navy dark:text-white block",children:e.title}),(0,r.jsx)("span",{className:"text-[11px] text-gray-400 dark:text-white/45 line-clamp-1",children:e.body})]},e.id))]}),(0,r.jsx)("textarea",{value:T,onChange:e=>z(e.target.value),rows:2,placeholder:M.email?"Reply â emailed to the requesterâ¦":"No email to reply to",disabled:!M.email,className:"w-full border border-orange-100 rounded-xl px-3 py-2 text-sm resize-none disabled:bg-gray-50"}),F.length>0&&(0,r.jsx)("div",{className:"flex flex-wrap gap-1.5",children:F.map((e,t)=>(0,r.jsxs)("span",{className:"inline-flex items-center gap-1 bg-gray-100 text-gray-600 dark:text-white/70 text-[11px] rounded-lg px-2 py-1",children:["\uD83D\uDCCE ",e.name,(0,r.jsx)("button",{onClick:()=>A(F.filter((e,a)=>a!==t)),className:"text-gray-400 dark:text-white/45",children:"\xd7"})]},t))}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsxs)("label",{className:`inline-flex items-center justify-center border border-orange-100 text-gray-500 dark:text-white/55 rounded-xl px-3 py-2.5 cursor-pointer ${!M.email?"opacity-50 pointer-events-none":""}`,title:"Attach files",children:[(0,r.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,r.jsx)("path",{d:"M21.44 11.05l-9.19 9.19a5 5 0 0 1-7.07-7.07l9.19-9.19a3.5 3.5 0 0 1 4.95 4.95l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"})}),(0,r.jsx)("input",{type:"file",multiple:!0,className:"hidden",onChange:e=>{K(e.target.files),e.target.value=""}})]}),(0,r.jsx)("button",{onClick:()=>q(e=>!e),disabled:!M.email,className:"border border-orange-100 text-gray-600 dark:text-white/70 text-sm font-bold rounded-xl px-3 py-2.5 disabled:opacity-50",title:"Canned replies",children:"â°"}),(0,r.jsxs)("button",{onClick:V,disabled:O||!M.email,className:"inline-flex items-center gap-1 border border-orange-100 text-brand-orange dark:text-brand-saffron text-sm font-bold rounded-xl px-3 py-2.5 disabled:opacity-50",children:[(0,r.jsx)("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,r.jsx)("path",{d:"m12 3 1.9 4.6L18.5 9.5 13.9 11.4 12 16l-1.9-4.6L5.5 9.5l4.6-1.9z"})}),O?"â¦":T.trim()?"Polish":"Draft"]}),(0,r.jsx)("button",{onClick:()=>H(!1),disabled:B||!T.trim()&&!F.length||!M.email,className:"text-white text-sm font-bold rounded-xl px-4 py-2.5 disabled:opacity-50",style:{background:"linear-gradient(135deg,#F26644,#FF9933)"},children:B?"â¦":"Send"}),(0,r.jsx)("button",{onClick:()=>H(!0),disabled:B||!T.trim()&&!F.length||!M.email,className:"flex-1 bg-brand-navy text-white text-sm font-bold rounded-xl py-2.5 disabled:opacity-50",children:"Send & close"})]})]})]})})}),I&&(0,r.jsx)(c,{children:(0,r.jsx)(w,{onClose:()=>U(!1),onSubmit:ee})})]})}function w({onClose:e,onSubmit:t}
3){let[a,n]=(0,s.useState)({name:"",email:"",phone:"",subject:"",body:"",source:"email",category:"general",priority:"normal",notify:!0}),[l,i]=(0,s.useState)(!1),[o,d]=(0,s.useState)(""),c=e=>t=>n({...a,[e]:"checkbox"===t.target.type?t.target.checked:t.target.value});async function x(e){if(e.preventDefault(),!a.subject.trim())return void d("A subject is required.");i(!0),d("");try{await t(a)}catch(e){d(e.message),i(!1)}}let b="w-full border border-orange-100 rounded-xl px-3 py-2.5 text-sm";return(0,r.jsxs)("div",{className:"fixed inset-0 z-110 bg-white flex flex-col",style:{paddingTop:"env(safe-area-inset-top)"},children:[(0,r.jsxs)("div",{className:"px-4 py-3 border-b border-orange-100 flex items-center justify-between",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h2",{className:"font-extrabold text-brand-navy dark:text-white text-lg",children:"New ticket"}),(0,r.jsx)("p",{className:"text-xs text-gray-400 dark:text-white/45",children:"Log a phone, text, walk-in, or email request."})]}),(0,r.jsx)("button",{type:"button",onClick:e,className:"w-9 h-9 rounded-full bg-orange-50 text-brand-orange dark:text-brand-saffron flex items-center justify-center text-xl leading-none",children:"\xd7"})]}),(0,r.jsxs)("form",{onSubmit:x,className:"flex-1 overflow-y-auto p-4 space-y-3",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"text-xs font-semibold text-gray-500 dark:text-white/55 block mb-1",children:"Name"}),(0,r.jsx)("input",{value:a.name,onChange:c("name"),className:b,placeholder:"Requester name"})]}),(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"text-xs font-semibold text-gray-500 dark:text-white/55 block mb-1",children:"Email"}),(0,r.jsx)("input",{type:"email",value:a.email,onChange:c("email"),className:b,placeholder:"To reply"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"text-xs font-semibold text-gray-500 dark:text-white/55 block mb-1",children:"Phone"}),(0,r.jsx)("input",{value:a.phone,onChange:c("phone"),className:b,placeholder:"Optional"})]})]}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("label",{className:"text-xs font-semibold text-gray-500 dark:text-white/55 block mb-1",children:["Subject ",(0,r.jsx)("span",{className:"text-brand-orange dark:text-brand-saffron",children:"*"})]}),(0,r.jsx)("input",{value:a.subject,onChange:c("subject"),className:b,placeholder:"Short summary"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"text-xs font-semibold text-gray-500 dark:text-white/55 block mb-1",children:"Message"}),(0,r.jsx)("textarea",{value:a.body,onChange:c("body"),rows:4,className:`${b} resize-none`,placeholder:"What did they ask for?"})]}),(0,r.jsxs)("div",{className:"grid grid-cols-3 gap-2",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"text-xs font-semibold text-gray-500 dark:text-white/55 block mb-1",children:"Platform"}),(0,r.jsx)("select",{value:a.source,onChange:c("source"),className:b,children:Object.entries(h).map(([e,t])=>(0,r.jsx)("option",{value:e,children:t},e))})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"text-xs font-semibold text-gray-500 dark:text-white/55 block mb-1",children:"Category"}),(0,r.jsx)("select",{value:a.category,onChange:c("category"),className:`${b} capitalize`,children:m.map(e=>(0,r.jsx)("option",{value:e,children:e},e))})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"text-xs font-semibold text-gray-500 dark:text-white/55 block mb-1",children:"Priority"}),(0,r.jsx)("select",{value:a.priority,onChange:c("priority"),className:`${b} capitalize`,children:p.map(e=>(0,r.jsx)("option",{value:e,children:e},e))})]})]}),(0,r.jsxs)("label",{className:"flex items-center gap-2 text-sm text-gray-600 dark:text-white/70 pt-1",children:[(0,r.jsx)("input",{type:"checkbox",checked:a.notify,onChange:c("notify"),className:"w-4 h-4 rounded-sm accent-brand-orange"}),"Email a confirmation with the ticket number"]}),o&&(0,r.jsx)("p",{className:"text-red-600 text-sm bg-red-50 border border-red-100 rounded-lg px-3 py-2",children:o})]}),(0,r.jsxs)("div",{className:"px-4 py-3 border-t border-orange-100 flex gap-2",style:{paddingBottom:"calc(12px + env(safe-area-inset-bottom))"},children:[(0,r.jsx)("button",{type:"button",onClick:e,className:"text-gray-500 dark:text-white/55 text-sm font-semibold rounded-xl px-4 py-2.5",children:"Cancel"}),(0,r.jsx)("button",{onClick:x,disabled:l,className:"flex-1 text-white text-sm font-bold rounded-xl py-2.5 disabled:opacity-50",style:{background:"linear-gradient(135deg,#F26644,#FF9933)"},children:l?"Creatingâ¦":"Create ticket"})]})]})}},58358:(e,t,a)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/app/admin/support",function(){return a(14135)}])}},e=>
3{e.O(0,[8230,900,6475,2422,636,6593,8792],()=>e(e.s=58358)),_N_E=e.O()}]);
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.