1import{g as w,t as u,r as l,T as I,j as t,m as b}from"./index-D7y7cMf2.js";function M(i){const{redirectOnUnauthenticated:r=!1,redirectPath:c=w()}={},a=u.useUtils(),s=u.auth.me.useQuery(void 0,{retry:!1,refetchOnWindowFocus:!1}),n=u.auth.logout.useMutation({onSuccess:()=>{a.auth.me.setData(void 0,null)}}),g=l.useCallback(async()=>{try{await n.mutateAsync()}catch(x){if(x instanceof I&&x.data?.code==="UNAUTHORIZED")return;throw x}finally{a.auth.me.setData(void 0,null),await a.auth.me.invalidate()}},[n,a]),d=l.useMemo(()=>(localStorage.setItem("manus-runtime-user-info",JSON.stringify(s.data)),{user:s.data??null,loading:s.isLoading||n.isPending,error:s.error??n.error??null,isAuthenticated:!!s.data}),[s.data,s.error,s.isLoading,n.error,n.isPending]);return l.useEffect(()=>{r&&(s.isLoading||n.isPending||d.user||typeof window>"u"||window.location.pathname!==c&&(window.location.href=c))},[r,c,n.isPending,s.isLoading,d.user]),{...d,refresh:()=>s.refetch(),logout:g}}function A({label:i,value:r,color:c}){return t.jsxs("div",{"data-loc":"client/src/pages/Admin.tsx:9",className:"p-5 rounded-lg",style:{background:"oklch(0.14 0.04 260)",border:"1px solid oklch(0.22 0.02 260)"},children:[t.jsx("p",{"data-loc":"client/src/pages/Admin.tsx:13",className:"text-xs font-mono uppercase tracking-wider mb-1",style:{color:"oklch(0.55 0.02 260)"},children:i}),t.jsx("p",{"data-loc":"client/src/pages/Admin.tsx:16",className:"text-2xl font-display font-bold",style:{color:c},children:r})]})}function R(){const{user:i,loading:r,isAuthenticated:c}=M(),[a,s]=l.useState(1),[n,g]=l.useState(""),[d,x]=l.useState(""),m=50,S=l.useMemo(()=>({page:a,pageSize:m,search:n||void 0}),[a,m,n]),{data:p,isLoading:C}=u.admin.signatures.useQuery(S),{data:h,isLoading:f}=u.admin.stats.useQuery(),{data:T,refetch:P,isFetching:N}=u.admin.exportSignatures.useQuery(void 0,{enabled:!1}),L=e=>{e.preventDefault(),g(d),s(1)},O=async()=>{const e=await P();if(!e.data?.signatures)return;const j=e.data.signatures,E=[["ID","Full Name","Country","Email","Organization","Public","Signed At"].join(","),...j.map(o=>[o.id,`"${(o.fullName||"").replace(/"/g,'""')}"`,`"${(o.country||"").replace(/"/g,'""')}"`,`"${(o.email||"").replace(/"/g,'""')}"`,`"${(o.organization||"").replace(/"/g,'""')}"`,o.displayPublicly?"Yes":"No",o.signedAt?new Date(o.signedAt).toISOString():""].join(","))].join(` 2`),D=new Blob(["\uFEFF"+E],{type:"text/csv;charset=utf-8;"}),v=URL.createObjectURL(D),k=document.createElement("a");k.href=v,k.download=`contain-now-signatures-${new Date().toISOString().slice(0,10)}.csv`,k.click(),URL.revokeObjectURL(v)};if(r)return t.jsx("div",{"data-loc":"client/src/pages/Admin.tsx:78",className:"min-h-screen flex items-center justify-center",style:{background:"oklch(0.12 0.04 260)"},children:t.jsxs("div",{"data-loc":"client/src/pages/Admin.tsx:79",className:"text-center",children:[t.jsx("div",{"data-loc":"client/src/pages/Admin.tsx:80",className:"w-8 h-8 border-2 border-t-transparent rounded-full animate-spin mx-auto mb-4",style:{borderColor:"oklch(0.65 0.18 250)",borderTopColor:"transparent"}}),t.jsx("p",{"data-loc":"client/src/pages/Admin.tsx:81",className:"text-muted-foreground font-mono text-sm",children:"Verifying access..."})]})});if(!c)return t.jsx("div",{"data-loc":"client/src/pages/Admin.tsx:89",className:"min-h-screen flex items-center justify-center",style:{background:"oklch(0.12 0.04 260)"},children:t.jsxs("div",{"data-loc":"client/src/pages/Admin.tsx:90",className:"text-center max-w-md p-8 rounded-lg",style:{background:"oklch(0.14 0.04 260)",border:"1px solid oklch(0.22 0.02 260)"},children:[t.jsx("h1",{"data-loc":"client/src/pages/Admin.tsx:91",className:"font-display text-2xl font-bold text-foreground mb-4",children:"Admin Access Required"}),t.jsx("p",{"data-loc":"client/src/pages/Admin.tsx:92",className:"text-muted-foreground mb-6",children:"You need to log in with an admin account to access this panel."}),t.jsx("a",{"data-loc":"client/src/pages/Admin.tsx:93",href:w(),className:"inline-block px-6 py-2.5 rounded-md font-display font-semibold text-sm text-white transition-all",style:{background:"oklch(0.65 0.18 250)"},children:"Log In"}),t.jsx("a",{"data-loc":"client/src/pages/Admin.tsx:100",href:"/",className:"block mt-4 text-sm text-muted-foreground hover:text-foreground transition-colors",children:"Back to Manifesto"})]})});if(i?.role!=="admin")return t.jsx("div",{"data-loc":"client/src/pages/Admin.tsx:110",className:"min-h-screen flex items-center justify-center",style:{background:"oklch(0.12 0.04 260)"},children:t.jsxs("div",{"data-loc":"client/src/pages/Admin.tsx:111",className:"text-center max-w-md p-8 rounded-lg",style:{background:"oklch(0.14 0.04 260)",border:"1px solid oklch(0.22 0.02 260)"},children:[t.jsx("h1",{"data-loc":"client/src/pages/Admin.tsx:112",className:"font-display text-2xl font-bold mb-4",style:{color:"oklch(0.60 0.20 25)"},children:"Access Denied"}),t.jsx("p",{"data-loc":"client/src/pages/Admin.tsx:113",className:"text-muted-foreground mb-6",children:"You do not have admin privileges. Contact the site owner for access."}),t.jsx("a",{"data-loc":"client/src/pages/Admin.tsx:114",href:"/",className:"inline-block px-6 py-2.5 rounded-md font-display font-semibold text-sm text-white transition-all",style:{background:"oklch(0.65 0.18 250)"},children:"Back to Manifesto"})]})});const y=p?Math.ceil(p.total/m):0;return t.jsxs("div",{"data-loc":"client/src/pages/Admin.tsx:125",className:"min-h-screen",style:{background:"oklch(0.12 0.04 260)"},children:[t.jsx("header",{"data-loc":"client/src/pages/Admin.tsx:127",className:"sticky top-0 z-50 px-6 py-4",style:{background:"oklch(0.10 0.04 260)",borderBottom:"1px solid oklch(0.22 0.02 260)"},children:t.jsxs("div",{"data-loc":"client/src/pages/Admin.tsx:128",className:"max-w-7xl mx-auto flex items-center justify-between",children:[t.jsxs("div",{"data-loc":"client/src/pages/Admin.tsx:129",className:"flex items-center gap-4",children:[t.jsxs("a",{"data-loc":"client/src/pages/Admin.tsx:130",href:"/",className:"font-display font-bold text-lg text-foreground hover:opacity-80 transition-opacity",children:["CONT",t.jsx("span",{"data-loc":"client/src/pages/Admin.tsx:131",style:{color:"oklch(0.60 0.20 25)"},children:"AI"}),"N NOW"]}),t.jsx("span",{"data-loc":"client/src/pages/Admin.tsx:133",className:"text-xs font-mono px-2 py-1 rounded",style:{background:"oklch(0.65 0.18 250 / 0.15)",color:"oklch(0.65 0.18 250)"},children:"ADMIN PANEL"})]}),t.jsxs("div",{"data-loc":"client/src/pages/Admin.tsx:137",className:"flex items-center gap-3",children:[t.jsx("span",{"data-loc":"client/src/pages/Admin.tsx:138",className:"text-xs text-muted-foreground font-mono",children:i?.name||i?.email}),t.jsx("a",{"data-loc":"client/src/pages/Admin.tsx:139",href:"/",className:"text-xs text-muted-foreground hover:text-foreground transition-colors font-mono",children:"Back to Site"})]})]})}),t.jsxs("main",{"data-loc":"client/src/pages/Admin.tsx:146",className:"max-w-7xl mx-auto px-6 py-8",children:[t.jsxs(b.div,{"data-loc":"client/src/pages/Admin.tsx:147",initial:{opacity:0,y:10}
2,animate:{opacity:1,y:0},transition:{duration:.5},children:[t.jsx("h1",{"data-loc":"client/src/pages/Admin.tsx:148",className:"font-display text-3xl font-bold text-foreground mb-2",children:"Petition Signatures"}),t.jsx("p",{"data-loc":"client/src/pages/Admin.tsx:149",className:"text-muted-foreground mb-8",children:"Manage and export petition signatures for the CONTAIN NOW movement."})]}),t.jsxs(b.div,{"data-loc":"client/src/pages/Admin.tsx:153",initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.5,delay:.1},className:"grid grid-cols-2 md:grid-cols-4 gap-4 mb-8",children:[t.jsx(A,{"data-loc":"client/src/pages/Admin.tsx:159",label:"Total Signatures",value:f?"...":h?.total??0,color:"oklch(0.65 0.18 250)"}),t.jsx(A,{"data-loc":"client/src/pages/Admin.tsx:160",label:"Countries",value:f?"...":h?.countries??0,color:"oklch(0.72 0.14 85)"}),t.jsx(A,{"data-loc":"client/src/pages/Admin.tsx:161",label:"With Organization",value:f?"...":h?.withOrg??0,color:"oklch(0.65 0.20 150)"}),t.jsx(A,{"data-loc":"client/src/pages/Admin.tsx:162",label:"Public Signatures",value:f?"...":h?.publicCount??0,color:"oklch(0.60 0.20 25)"})]}),t.jsxs(b.div,{"data-loc":"client/src/pages/Admin.tsx:166",initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.5,delay:.2},className:"flex flex-col sm:flex-row gap-4 mb-6",children:[t.jsxs("form",{"data-loc":"client/src/pages/Admin.tsx:172",onSubmit:L,className:"flex-1 flex gap-2",children:[t.jsx("input",{"data-loc":"client/src/pages/Admin.tsx:173",type:"text",value:d,onChange:e=>x(e.target.value),placeholder:"Search by name, country, organization, or email...",className:"flex-1 px-4 py-2.5 rounded-md text-foreground placeholder:text-muted-foreground/50 focus:outline-none focus:ring-2 text-sm",style:{background:"oklch(0.14 0.04 260)",border:"1px solid oklch(0.25 0.02 260)"}}),t.jsx("button",{"data-loc":"client/src/pages/Admin.tsx:184",type:"submit",className:"px-4 py-2.5 rounded-md font-display font-semibold text-sm text-white transition-all hover:opacity-90",style:{background:"oklch(0.65 0.18 250)"},children:"Search"}),n&&t.jsx("button",{"data-loc":"client/src/pages/Admin.tsx:192",type:"button",onClick:()=>{g(""),x(""),s(1)},className:"px-3 py-2.5 rounded-md text-sm text-muted-foreground hover:text-foreground transition-colors",style:{border:"1px solid oklch(0.25 0.02 260)"},children:"Clear"})]}),t.jsx("button",{"data-loc":"client/src/pages/Admin.tsx:202",onClick:O,disabled:N,className:"px-5 py-2.5 rounded-md font-display font-semibold text-sm transition-all hover:opacity-90 disabled:opacity-50 whitespace-nowrap",style:{background:"oklch(0.72 0.14 85 / 0.15)",color:"oklch(0.72 0.14 85)",border:"1px solid oklch(0.72 0.14 85 / 0.3)"},children:N?"Exporting...":"Export CSV"})]}),t.jsxs(b.div,{"data-loc":"client/src/pages/Admin.tsx:213",initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.5,delay:.3},className:"rounded-lg overflow-hidden",style:{background:"oklch(0.14 0.04 260)",border:"1px solid oklch(0.22 0.02 260)"},children:[t.jsx("div",{"data-loc":"client/src/pages/Admin.tsx:220",className:"overflow-x-auto",children:t.jsxs("table",{"data-loc":"client/src/pages/Admin.tsx:221",className:"w-full text-sm",children:[t.jsx("thead",{"data-loc":"client/src/pages/Admin.tsx:222",children:t.jsxs("tr",{"data-loc":"client/src/pages/Admin.tsx:223",style:{background:"oklch(0.10 0.04 260)"},children:[t.jsx("th",{"data-loc":"client/src/pages/Admin.tsx:224",className:"text-left px-4 py-3 font-mono text-xs uppercase tracking-wider text-muted-foreground",children:"#"}),t.jsx("th",{"data-loc":"client/src/pages/Admin.tsx:225",className:"text-left px-4 py-3 font-mono text-xs uppercase tracking-wider text-muted-foreground",children:"Name"}),t.jsx("th",{"data-loc":"client/src/pages/Admin.tsx:226",className:"text-left px-4 py-3 font-mono text-xs uppercase tracking-wider text-muted-foreground",children:"Country"}),t.jsx("th",{"data-loc":"client/src/pages/Admin.tsx:227",className:"text-left px-4 py-3 font-mono text-xs uppercase tracking-wider text-muted-foreground",children:"Email"}),t.jsx("th",{"data-loc":"client/src/pages/Admin.tsx:228",className:"text-left px-4 py-3 font-mono text-xs uppercase tracking-wider text-muted-foreground",children:"Organization"}),t.jsx("th",{"data-loc":"client/src/pages/Admin.tsx:229",className:"text-left px-4 py-3 font-mono text-xs uppercase tracking-wider text-muted-foreground",children:"Public"}),t.jsx("th",{"data-loc":"client/src/pages/Admin.tsx:230",className:"text-left px-4 py-3 font-mono text-xs uppercase tracking-wider text-muted-foreground",children:"Signed At"})]})}),t.jsx("tbody",{"data-loc":"client/src/pages/Admin.tsx:233",children:C?t.jsx("tr",{"data-loc":"client/src/pages/Admin.tsx:235",children:t.jsxs("td",{"data-loc":"client/src/pages/Admin.tsx:236",colSpan:7,className:"text-center py-12 text-muted-foreground",children:[t.jsx("div",{"data-loc":"client/src/pages/Admin.tsx:237",className:"w-6 h-6 border-2 border-t-transparent roun
2ded-full animate-spin mx-auto mb-2",style:{borderColor:"oklch(0.65 0.18 250)",borderTopColor:"transparent"}}),"Loading signatures..."]})}):p?.signatures.length===0?t.jsx("tr",{"data-loc":"client/src/pages/Admin.tsx:242",children:t.jsx("td",{"data-loc":"client/src/pages/Admin.tsx:243",colSpan:7,className:"text-center py-12 text-muted-foreground",children:n?"No signatures match your search.":"No signatures yet."})}):p?.signatures.map((e,j)=>t.jsxs("tr",{"data-loc":"client/src/pages/Admin.tsx:249",className:"transition-colors hover:bg-white/5",style:{borderTop:"1px solid oklch(0.20 0.02 260)"},children:[t.jsx("td",{"data-loc":"client/src/pages/Admin.tsx:254",className:"px-4 py-3 font-mono text-xs text-muted-foreground",children:(a-1)*m+j+1}),t.jsx("td",{"data-loc":"client/src/pages/Admin.tsx:257",className:"px-4 py-3 font-medium text-foreground",children:e.fullName}),t.jsx("td",{"data-loc":"client/src/pages/Admin.tsx:258",className:"px-4 py-3 text-foreground/80",children:e.country}),t.jsx("td",{"data-loc":"client/src/pages/Admin.tsx:259",className:"px-4 py-3 text-foreground/70 font-mono text-xs",children:e.email||"â"}),t.jsx("td",{"data-loc":"client/src/pages/Admin.tsx:260",className:"px-4 py-3 text-foreground/70",children:e.organization||"â"}),t.jsx("td",{"data-loc":"client/src/pages/Admin.tsx:261",className:"px-4 py-3",children:t.jsx("span",{"data-loc":"client/src/pages/Admin.tsx:262",className:"text-xs px-2 py-0.5 rounded-full font-mono",style:{background:e.displayPublicly?"oklch(0.65 0.20 150 / 0.15)":"oklch(0.50 0.02 260 / 0.15)",color:e.displayPublicly?"oklch(0.65 0.20 150)":"oklch(0.55 0.02 260)"},children:e.displayPublicly?"Yes":"No"})}),t.jsx("td",{"data-loc":"client/src/pages/Admin.tsx:272",className:"px-4 py-3 font-mono text-xs text-muted-foreground whitespace-nowrap",children:e.signedAt?new Date(e.signedAt).toLocaleString():"â"})]},e.id))})]})}),y>1&&t.jsxs("div",{"data-loc":"client/src/pages/Admin.tsx:284",className:"flex items-center justify-between px-4 py-3",style:{borderTop:"1px solid oklch(0.20 0.02 260)"},children:[t.jsxs("p",{"data-loc":"client/src/pages/Admin.tsx:288",className:"text-xs text-muted-foreground font-mono",children:["Showing ",(a-1)*m+1,"â",Math.min(a*m,p?.total??0)," of ",p?.total??0]}),t.jsxs("div",{"data-loc":"client/src/pages/Admin.tsx:291",className:"flex gap-2",children:[t.jsx("button",{"data-loc":"client/src/pages/Admin.tsx:292",onClick:()=>s(e=>Math.max(1,e-1)),disabled:a===1,className:"px-3 py-1.5 rounded text-xs font-mono disabled:opacity-30 transition-all hover:bg-white/5",style:{border:"1px solid oklch(0.25 0.02 260)",color:"oklch(0.82 0.01 250)"},children:"Previous"}),t.jsxs("span",{"data-loc":"client/src/pages/Admin.tsx:300",className:"px-3 py-1.5 text-xs font-mono text-muted-foreground",children:["Page ",a," of ",y]}),t.jsx("button",{"data-loc":"client/src/pages/Admin.tsx:303",onClick:()=>s(e=>Math.min(y,e+1)),disabled:a===y,className:"px-3 py-1.5 rounded text-xs font-mono disabled:opacity-30 transition-all hover:bg-white/5",style:{border:"1px solid oklch(0.25 0.02 260)",color:"oklch(0.82 0.01 250)"},children:"Next"})]})]})]})]})]})}export{R 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.