1import{r as i,j as e,L as j}from"./react-vendor-d250d348.js";import{U as D}from"./UserAvatar-05bf91ea.js";import{S as z,E,B as y,P as C}from"./AdminShared-5d419368.js";import{A}from"./AppVersionBadge-3476e703.js";import{D as L}from"./DeletedBadge-160c6c81.js";import{B,o as H,p as T,n as U}from"./adminService-8d9391de.js";import{bx as M}from"./index-721397ec.js";import{ae as V,a4 as G,Y as I,aB as R,aM as O,b6 as Y,am as $,an as q,U as J,aG as K}from"./lucide-1ed530d4.js";import"./NameBadges-8c10539c.js";import"./dynamicBadgeIcons-e7802c8f.js";import"./utils-f85c62fa.js";import"./adminEntityUrl-6c40272a.js";import"./sentry-5ddef7e0.js";import"./supabase-b5d9a3f8.js";(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};s.SENTRY_RELEASE={id:"72d1b8b3cf2f419b3766a3c986aa32488299d6dc"};var d=new s.Error().stack;d&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[d]="5773d4b5-b673-4783-a339-d4ab0508b5b0",s._sentryDebugIdIdentifier="sentry-dbid-5773d4b5-b673-4783-a339-d4ab0508b5b0")}catch{}})();const Q=({visibility:s})=>s==="private"?e.jsx(q,{size:11}):s==="friends"?e.jsx(J,{size:11}):e.jsx(K,{size:11}),xe=()=>{const[s,d]=i.useState([]),[g,v]=i.useState(0),[w,p]=i.useState(!0),[c,N]=i.useState(""),[x,_]=i.useState("newest"),[m,u]=i.useState(0),[h,n]=i.useState(null),o=i.useCallback(async()=>{p(!0);try{const{posts:t,total:a}=await B({status:c||void 0,sort:x,page:m});d(t),v(a)}catch(t){console.error("Posts load error:",t)}p(!1)},[c,x,m]);i.useEffect(()=>{o()},[o]);const F=Math.ceil(g/20),P=async t=>{const a=prompt("Hide reason:");if(a){n(t);try{await H(t,a),await o()}catch{alert("Failed to hide post")}n(null)}},k=async t=>{n(t);try{await T(t),await o()}catch{alert("Failed to unhide post")}n(null)},S=async t=>{const a=prompt("Delete reason (this cannot be undone):");if(a){n(t);try{await U(t,a),await o()}catch{alert("Failed to delete post")}n(null)}};return e.jsxs("div",{children:[e.jsxs("div",{className:"flex gap-2 mb-4",children:[e.jsxs("select",{value:c,onChange:t=>{N(t.target.value),u(0)},className:"bg-[#1a1a1a] border border-[#2a2a2a] rounded-lg px-3 py-2 text-gray-300 text-sm focus:outline-none",children:[e.jsx("option",{value:"",children:"All Posts"}),e.jsx("option",{value:"visible",children:"Visible"}),e.jsx("option",{value:"hidden",children:"Hidden"}),e.jsx("option",{value:"deleted",children:"Deleted"})]}),e.jsxs("select",{value:x,onChange:t=>{_(t.target.value),u(0)},className:"bg-[#1a1a1a] border border-[#2a2a2a] rounded-lg px-3 py-2 text-gray-300 text-sm focus:outline-none ml-auto",children:[e.jsx("option",{value:"newest",children:"Newest First"}),e.jsx("option",{value:"oldest",children:"Oldest First"}),e.jsx("option",{value:"most_liked",children:"Most Liked"}),e.jsx("option",{value:"most_commented",children:"Most Commented"})]})]}),w?e.jsx(z,{}):s.length===0?e.jsx(E,{text:"No posts found"}):e.jsxs("div",{className:"space-y-3",children:[s.map(t=>{const a=(t.images||[]).slice().sort((l,b)=>(l.position??0)-(b.position??0)),r=a.slice(0,4),f=a.length-r.length;return e.jsxs("div",{className:"bg-[#1a1a1a] border border-[#2a2a2a] rounded-xl p-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3 mb-2",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-wrap",children:[t.profile&&e.jsx(D,{profile:t.profile,size:"xs",linkToProfile:!0}),e.jsx(j,{to:`/admin/users/${t.user_id}`,className:"text-white text-sm font-medium truncate hover:text-[#00FF7F] transition-colors",children:t.profile?.display_name||"Unknown"}),t.profile&&e.jsx(A,{version:t.profile.app_version}),t.is_hidden&&e.jsx(y,{color:"#2DD4BF",children:"Hidden"}),t.is_deleted&&e.jsx(L,{when:t.deleted_at||t.updated_at})]}),e.jsx("span",{className:"text-gray-600 text-xs whitespace-nowrap",children:M(t.created_at)})]}),t.content&&e.jsx("p",{className:"text-gray-300 text-sm mb-3 whitespace-pre-wrap",children:t.content}),r.length>0&&e.jsx("div",{className:"flex gap-2 mb-3 flex-wrap",children:r.map((l,b)=>e.jsxs("div",{className:"relative w-20 h-20 rounded-lg overflow-hidden bg-[#0a0a0a] border border-[#2a2a2a]",children:[e.jsx("img",{src:l.thumbnail_url||l.image_url,alt:"",className:"w-full h-full object-cover",loading:"lazy"}),l.media_type==="video"&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/30",children:e.jsx(V,{size:20,className:"text-white",f
1ill:"white"})}),b===r.length-1&&f>0&&e.jsxs("div",{className:"absolute inset-0 flex items-center justify-center bg-black/60 text-white text-sm font-bold",children:["+",f]})]},l.id))}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3 mb-3 text-xs text-gray-400",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(G,{size:12,className:"text-accent2"}),t.likes_count||0]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(I,{size:12,className:"text-[#00FF7F]"}),t.comments_count||0]}),t.visibility&&e.jsxs("span",{className:"flex items-center gap-1 text-gray-500",children:[e.jsx(Q,{visibility:t.visibility}),t.visibility]}),t.location_name&&e.jsxs("span",{className:"flex items-center gap-1 text-gray-500 truncate max-w-[200px]",children:[e.jsx(R,{size:12}),t.location_name]}),t.group_id&&e.jsx(y,{children:"Group Post"})]}),t.is_hidden&&t.hidden_reason&&e.jsxs("p",{className:"text-accent2 text-xs mb-3",children:["Hidden: ",t.hidden_reason]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(j,{to:`/admin/post/${t.id}`,className:"px-3 py-1 rounded-lg bg-[#0a0a0a] border border-[#2a2a2a] text-gray-400 text-xs hover:text-white transition-colors",children:"View"}),t.is_hidden?e.jsxs("button",{onClick:()=>k(t.id),disabled:h===t.id,className:"flex items-center gap-1 px-3 py-1 rounded-lg bg-[#00FF7F]/10 text-[#00FF7F] text-xs font-medium hover:bg-[#00FF7F]/20 transition-colors disabled:opacity-50",children:[e.jsx(O,{size:12})," Unhide"]}):e.jsxs("button",{onClick:()=>P(t.id),disabled:h===t.id,className:"flex items-center gap-1 px-3 py-1 rounded-lg bg-yellow-500/10 text-yellow-400 text-xs font-medium hover:bg-yellow-500/20 transition-colors disabled:opacity-50",children:[e.jsx(Y,{size:12})," Hide"]}),e.jsxs("button",{onClick:()=>S(t.id),disabled:h===t.id,className:"flex items-center gap-1 px-3 py-1 rounded-lg bg-accent2/10 text-accent2 text-xs font-medium hover:bg-accent2/20 transition-colors disabled:opacity-50",children:[e.jsx($,{size:12})," Delete"]})]})]},t.id)}),e.jsx(C,{page:m+1,totalPages:F,onPageChange:t=>u(t-1)})]})]})};export{xe 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.