PageSourceSearch

https://limitlessflo.com/assets/PostDetail-DRQwGdTP.js

js limitlessflo.com collected 2026-10-04 01:17:09 UTC 67,087 bytes, 3 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/parental-control-BEMcOgAj.js","assets/index-CiCw9Duq.js","assets/vendor-solana-BIelvPCZ.js","assets/vendor-i18n-BBu7i065.js","assets/vendor-react-BL5zx_iT.js","assets/vendor-ui-Ct1FBp4w.js","assets/vendor-supabase-DbyvBBOg.js","assets/index-DY1GOUxd.css"])))=>i.map(i=>d[i]);
2import{_ as ta}from"./vendor-solana-BIelvPCZ.js";import{e as sa,u as ns,g as aa,b as ra,s as Ge,j as e,V as Je,c as ia,A as Kt,l as es,m as X,S as ts}from"./index-CiCw9Duq.js";import{r as l}from"./vendor-i18n-BBu7i065.js";import{f as oa,u as la,L as Pe}from"./vendor-react-BL5zx_iT.js";import{supabasePosts as p}from"./supabase-posts-DO7uQrto.js";import{s as vt,M as Nt,L as cs}from"./MediaGrid-BvWAjW99.js";import{P as na,g as He,a as Ye}from"./ZoomableImage-7_cMyLco.js";import ca from"./VideoPlayer-DW-C9e56.js";import{a as da,L as ua,t as $e,U as ma}from"./TranslateButton-C9R-BEgx.js";import{P as Re}from"./ParsedText-eRiZVOn8.js";import xa from"./TipModal-B08B3b54.js";import{u as pa}from"./use-spitcoin-price-AILx_UNn.js";import{P as ds,s as ss}from"./send-tip-D5DDrVHu.js";import{c as _t}from"./clipboard-CRurzJ4W.js";import{J as ha,I as fa,P as ga}from"./JsonLd-By_FhGBf.js";import{socialPostingSchema as ba}from"./seo-utils-BL00vdR8.js";import{A as wa}from"./AdSlot-Bbh96A-3.js";import as from"./QuoteModal-NGNJWFVa.js";import{s as rs}from"./storage-Se_zNLFV.js";import{uploadVideo as is}from"./video-upload-BQd33tNZ.js";import{u as ya}from"./use-document-meta-RQbJsPUf.js";import{s as ja}from"./inline-markdown-B1SAVBKJ.js";import{P as va}from"./PostSkeleton-DI9Lh4Fi.js";import{u as ka}from"./use-nsfw-gate-B85kbaz9.js";import{supabasePolls as ge}from"./supabase-polls-CKrST-vK.js";import{A as Ze,L as kt,Z as Se,y as us,ap as ms,aj as xs,ab as Na,_ as fe,a8 as _a,w as Rt,ak as ps,aI as hs,G as fs,a9 as Xe,a7 as gs,an as bs,al as Ra,am as Pa,a2 as ws,X as _e,ac as os,ae as ls,ad as $a}from"./vendor-ui-Ct1FBp4w.js";import"./vendor-supabase-DbyvBBOg.js";import"./supabase-boosts-CUjpK0O_.js";import"./r2-upload-BrkyCMx4.js";import"./get-my-balances-jptV0jiH.js";import"./spitcoin-payment-DVTA0lAN.js";import"./solana-blockhash-Bx4Z4w3T.js";import"./solana-config-BmuqowSy.js";import"./direct-tip-service-BkK47QAd.js";import"./payout-address-CUTqBsHv.js";import"./haptics-DA4dia92.js";import"./supabase-follows-DcxNs-Be.js";import"./parental-control-BEMcOgAj.js";function fr(){const{postId:n}=oa(),f=la(),{user:a,creatorProfile:$}=sa(),{theme:ne}=ns(),i=ne==="light";da(n||"",a?.id);const[s,P]=l.useState(null),[_,k]=l.useState([]),I=ka(),S=s?.content?ja(s.content):"",ce=!!s&&(s.is_nsfw===!0||s.is_paid===!0),K=s?.id?`https://www.limitlessflo.com/post/${s.id}`:void 0;ya({title:s?`${s.user?.username?"@"+s.user.username:"Post"}${S?": "+S.slice(0,60).replace(/\s+/g," "):""}`:"Post",description:S.slice(0,200)||"View this post on LimitlessFlo.",canonical:K,image:s?.media_urls?.[0],type:"article",noindex:ce,jsonLd:s&&!ce?[{"@context":"https://schema.org","@type":"SocialMediaPosting",headline:(S.slice(0,110)||`Post by @${s.user?.username||"creator"}`)+(S.length>110?"…":""),articleBody:S.slice(0,1e3)||void 0,datePublished:s.created_at,dateModified:s.updated_at||s.created_at,url:K,image:s.media_urls?.[0]||void 0,author:s.user?.username?{"@type":"Person",name:s.user.display_name||s.user.username,url:`https://www.limitlessflo.com/profile/${s.user.username}`}:void 0,publisher:{"@type":"Organization",name:"LimitlessFlo",logo:{"@type":"ImageObject",url:"https://www.limitlessflo.com/logo-new-dark.png"}},interactionStatistic:[{"@type":"InteractionCounter",interactionType:"https://schema.org/LikeAction",userInteractionCount:s.likes_count||0},{"@type":"InteractionCounter",interactionType:"https://schema.org/CommentAction",userInteractionCount:s.replies_count||0},{"@type":"InteractionCounter",interactionType:"https://schema.org/ShareAction",userInteractionCount:s.reposts_count||0}]},{"@context":"https://schema.org","@type":"BreadcrumbList",itemListElement:[{"@type":"ListItem",position:1,name:"Home",item:"https://www.limitlessflo.com/"},{"@type":"ListItem",position:2,name:s.user?.username?`@${s.user.username}`:"Creator",item:s.user?.username?`https://www.limitlessflo.com/profile/${s.user.username}`:"https://www.limitlessflo.com/discover"},{"@type":"ListItem",position:3,name:"Post",item:K}]}]:null});const[be,ee]=l.useState(!0),[x,C]=l.useState(!0),[M,m]=l.useState(!1),[b,Q]=l.useState(!1),[A,E]=l.useState(!1),[T,L]=l.useState(!1),[we,B]=l.useState(!1),[Ce,O]=l.useState(!1),[Te,q]=l.useState(!1),[te,F]=l.useState(!1),[ye,de]=l.useState(null),[Le,ue]=l.useState(""),[Fe,se]=l.useState(!1),[Ue,V]=l.useState(!1),[me,h]=l.useState(!1),[N,Pt]=l.useState(!1),[$t,ze]=l.useState(null),[D,Ke]=l.useState(null),[js,et]=l.useState(""),[vs,St]=l.useState(!1),[Ct,Tt]=l.useState(!1),[tt,ae]=l.useState(null),[Lt,je]=l.useState("image"),[v,re]=l.useState(null),[W,st]=l.useState(""),[U,at]=l.useState(!1),[Ft,Ie]=l.useState(!1),[z,Me]=l.useState(null),[rt,Ee]=l.useState(null),ie=l.useRef(null),[oe,De]=l.useState(!1),[G,le]=l.useState(["",""]),[Ut,zt]=l.useState(24),[It,it]=l.useState(null),ot=l.useRef(null),[y,Qe]=l.useState(null),[H,lt]=l.useState(""),[Ae,nt]=l.useState(!1),[Y,ct]=l.useState(null),[dt,ut]=l.useState(null),Be=l.useRef(null),[ks,Oe]=l.useState(!1),[Ns,qe]=l.useState(null),{quickTipAmount:w,isQuickTipEnabled:Ve}=aa(),{tokenPrice:Mt}=pa(),[Ta,_s]=l.useState(()=>typeof window<"u"?window.innerWidth:400);l.useEffect(()=>{const t=()=>_s(window.innerWidth);return window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[]);const{toast:j}=ra(),[Et,Dt]=l.useState(!1),mt=l.useRef(null),[Z,ve]=l.useState(null),[xt,xe]=l.useState(!1),[We,pe]=l.useState(!1),Qt=l.useRef(null);l.useEffect(()=>{if(!We)return;const t=requestAnimationFrame(()=>{const r=Qt.current;if(r)try{r.scrollIntoView({behavior:"smooth",block:"center"})}catch{r.scrollIntoView()}});return()=>cancelAnimationFrame(t)},[We]);const At=async()=>
2{if(!(!a||!s||!w||!Ve))try{await ss({fromUserId:a.id,toUserId:s.user_id,usdAmount:w,postId:s.id,tokenPrice:Mt}),j({title:"Quick tip sent!",description:`$${w<1?w.toFixed(2):w} sent to @${s.user?.username||"creator"}`})}catch(t){j({title:"Tip failed",description:t.message,variant:"destructive"})}},Rs=async t=>{if(!(!a||!w||!Ve))try{await ss({fromUserId:a.id,toUserId:t.user_id,usdAmount:w,postId:t.id,tokenPrice:Mt}),j({title:"Quick tip sent!",description:`$${w<1?w.toFixed(2):w} sent to @${t.user?.username||"creator"}`})}catch(r){j({title:"Tip failed",description:r.message,variant:"destructive"})}},Ps=t=>{qe({userId:t.user_id,username:t.user?.username||"creator",avatar:t.creator_profile?.avatar||t.user?.avatar_url||null,postId:t.id}),Oe(!0)},[Bt,Ot]=l.useState(new Set),[pt,qt]=l.useState(new Set),R=!!a,[$s,Vt]=l.useState(!1),[Ss,Cs]=l.useState("this feature"),Ts=t=>a?R?!0:(Cs(t),Vt(!0),!1):(f("/auth"),!1);l.useEffect(()=>{n&&(ht(),ke(),Tt(!1),window.scrollTo({top:0,behavior:"instant"}))},[n]);const Wt=l.useRef(null);l.useEffect(()=>{a&&s&&Wt.current!==s.id&&(Wt.current=s.id,Fs(),Us(),zs())},[a,s?.id]),l.useEffect(()=>{a&&_.length>0&&(Is(),Ms())},[a,_.length]),l.useEffect(()=>{let t=!1;return(async()=>{if(!a?.id||!s?.id||a.id!==s.user_id){h(!1);return}try{const{data:r}=await Ge.from("users").select("pinned_post_id").eq("id",a.id).maybeSingle();t||h(r?.pinned_post_id===s.id)}catch{t||h(!1)}})(),()=>{t=!0}},[a?.id,s?.id,s?.user_id]);const Ls=async()=>{if(!(!a?.id||!s?.id||a.id!==s.user_id||N)){Pt(!0);try{me?(await p.unpinPost(a.id),h(!1),j({title:"Unpinned from profile"})):(await p.pinPost(s.id,a.id),h(!0),j({title:"Pinned to profile",description:"This post will appear at the top of your profile."}))}catch(t){j({title:"Couldn't update pin",description:t?.message||"Try again in a moment.",variant:"destructive"})}finally{Pt(!1)}}},ht=async()=>{if(n){ee(!0);try{const t=await p.getById(n);if(t?.repost_of_post_id&&t.repost_of_post_id!==n&&t?.repost_of&&(!t.content||t.content.trim().length===0)){f(`/post/${t.repost_of_post_id}`,{replace:!0});return}if(P(t),t?.id)try{const r=await ge.getByPostId(t.id,a?.id);it(r)}catch(r){console.warn("[PostDetail] poll load failed:",r),it(null)}if(t?.is_paid&&a)if(a.id===t.user_id)B(!0);else{const{data:r}=await Ge.from("paid_content_purchases").select("id").eq("post_id",t.id).eq("buyer_id",a.id).maybeSingle();B(!!r)}}catch(t){console.error("Failed to load post:",t)}finally{ee(!1)}}},ke=async()=>{if(n){C(!0);try{const t=await p.getReplies(n);k(t)}catch(t){console.error("Failed to load replies:",t)}finally{C(!1)}}},Fs=async()=>{if(!a||!s)return;const t=await p.isLiked(s.id,a.id);m(t)},Us=async()=>{if(!a||!s)return;const t=await p.isReposted(s.id,a.id);Q(t)},zs=async()=>{if(!a||!s)return;const t=await vt.isBookmarked(a.id,s.id);E(t)},Gt=async()=>{if(!a||!s)return;const t=A;E(!t);try{t?await vt.removeBookmark(a.id,s.id):await vt.bookmark(a.id,s.id)}catch(r){console.error("Bookmark error:",r),E(t)}},Is=async()=>{if(!a||_.length===0)return;const t=_.map(o=>o.id),r=await p.getLikedPosts(t,a.id);Ot(r)},Ms=async()=>{if(!a||_.length===0)return;const t=_.map(o=>o.id),r=await p.getRepostedPosts(t,a.id);qt(r)},ft=l.useRef(!1),Ht=l.useRef(M);Ht.current=M;const Yt=async()=>{if(!a||!s||!R||ft.current)return;ft.current=!0;const t=Ht.current;m(!t),P(r=>r&&{...r,likes_count:Math.max(0,r.likes_count+(t?-1:1))});try{if(t)await p.unlike(s.id,a.id);else if(await p.like(s.id,a.id),s.user_id!==a.id)try{await X.createLikeNotification(s.user_id,a.id,s.id)}catch(r){console.warn("Failed to send like notification:",r)}}catch(r){r instanceof ts&&(j({title:"Session expired",description:"Please sign in again.",variant:"destructive"}),f("/auth")),m(t);const o=await p.getById(s.id);o&&P(o)}finally{ft.current=!1}},Es=()=>{!a||!s||!R||(b?gt():F(!te))},gt=async()=>{if(!a||!s||!R)return;const t=b;Q(!t),P(r=>r&&{...r,reposts_count:r.reposts_count+(t?-1:1)}),F(!1);try{if(t)await p.unrepost(s.id,a.id);else if(await p.repost(s.id,a.id),s.user_id!==a.id)try{await X.createRepostNotification(s.user_id,a.id,s.id)}catch(r){console.warn("Failed to send repost notification:",r)}}catch{Q(t),ht()}},Ds=()=>{!a||!s||(de(s),ue(""),F(!1))},Qs=async(t,r)=>{const o=t||Le,u=!!r?.pollOptions&&r.pollOptions.filter(c=>c.trim()).length>=2;
2if(!(!a||!s)){if(!o.trim()&&!u){j({title:"Empty quote",description:"Add text or a poll to your quote",variant:"destructive"});return}se(!0);try{const c=await p.quoteRepost(a.id,s.id,o.trim(),[]);if(!c)throw new Error("Failed to post quote");if(u&&c?.id)try{await ge.create(c.id,r.pollOptions,r.pollDurationHours??24)}catch(g){j({title:"Poll wasn't attached",description:g?.message||"Quote was posted without the poll.",variant:"destructive"})}await Ge.from("posts").update({reposts_count:(s.reposts_count||0)+1}).eq("id",s.id),s.user_id!==a.id&&await X.createRepostNotification(s.user_id,a.id,s.id),j({title:"Quote posted!",description:"Your quote has been shared"}),de(null),ue(""),ht()}catch(c){console.error("Quote error:",c),j({title:"Error",description:c.message||"Failed to post quote",variant:"destructive"})}finally{se(!1)}}},As=async()=>{if(!(!a||!s||s.user_id!==a.id)&&confirm("Are you sure you want to delete this post?"))try{await p.delete(s.id),f(-1)}catch(t){alert(t.message||"Failed to delete post")}},Bs=async()=>{const t=oe?G.map(o=>o.trim()).filter(Boolean):[],r=oe&&t.length>=2;if(!(!s||!W.trim()&&!z&&!r)){if(oe&&t.length<2){alert("Please add at least 2 poll options");return}if(Ts("commenting")){at(!0);try{let o=[];if(z)try{z.type.startsWith("video")?o=[(await is(z)).playbackUrl]:o=[await rs.uploadImage(z,a.id)]}catch(c){alert(c.message||"Failed to upload media"),at(!1);return}const u=await p.createReply(a.id,s.id,W.trim(),o);if(r&&u?.id)try{await ge.create(u.id,t,Ut)}catch(c){console.warn("Failed to create reply poll:",c)}if(s.user_id!==a.id)try{await X.createReplyNotification(s.user_id,a.id,s.id,W.trim().substring(0,100))}catch(c){console.warn("Failed to send reply notification:",c)}st(""),Me(null),Ee(null),De(!1),le(["",""]),zt(24),Ie(!1),P(c=>c&&{...c,replies_count:(c.replies_count||0)+1}),await ke()}catch(o){alert(o.message||"Failed to post reply")}finally{at(!1)}}}},Os=async()=>{if(!(!y||!H.trim()&&!Y)&&a){nt(!0);try{let t=[];if(Y)try{Y.type.startsWith("video")?t=[(await is(Y)).playbackUrl]:t=[await rs.uploadImage(Y,a.id)]}catch(r){alert(r.message||"Failed to upload media"),nt(!1);return}if(await p.createReply(a.id,y.id,H.trim(),t),y.user_id!==a.id)try{await X.createReplyNotification(y.user_id,a.id,y.id,H.trim().substring(0,100))}catch(r){console.warn("Failed to send reply notification:",r)}k(r=>r.map(o=>o.id===y.id?{...o,replies_count:(o.replies_count||0)+1}:o)),Qe(null),lt(""),ct(null),ut(null)}catch(t){alert(t.message||"Failed to post reply")}finally{nt(!1)}}},bt=l.useRef(new Set),qs=async(t,r)=>{if(!a||!R||bt.current.has(t))return;bt.current.add(t);const o=Bt.has(t);Ot(u=>{const c=new Set(u);return o?c.delete(t):c.add(t),c}),k(u=>u.map(c=>c.id===t?{...c,likes_count:c.likes_count+(o?-1:1)}:c));try{if(o)await p.unlike(t,a.id);else if(await p.like(t,a.id),r!==a.id)try{await X.createLikeNotification(r,a.id,t)}catch(u){console.warn("Failed to send like notification:",u)}}catch(u){u instanceof ts&&(j({title:"Session expired",description:"Please sign in again.",variant:"destructive"}),f("/auth")),ke()}finally{bt.current.delete(t)}},Vs=t=>{!a||!R||(pt.has(t)?Ws(t):ze($t===t?null:t))},Ws=async t=>{if(!a||!R)return;const r=pt.has(t);qt(o=>{const u=new Set(o);return r?u.delete(t):u.add(t),u}),ze(null),k(o=>o.map(u=>u.id===t?{...u,reposts_count:(u.reposts_count||0)+(r?-1:1)}:u));try{if(r)await p.unrepost(t,a.id);else if(await p.repost(t,a.id),_.find(o=>o.id===t)?.user_id!==a.id)try{await X.createRepostNotification(_.find(o=>o.id===t)?.user_id||"",a.id,t)}catch(o){console.warn("Failed to send repost notification:",o)}}catch{ke()}},Gs=async t=>{if(!(!a||!window.confirm("Delete this reply?")))try{await p.delete(t),k(r=>r.filter(o=>o.id!==t)),P(r=>r&&{...r,replies_count:Math.max((r.replies_count||0)-1,0)}),j({title:"Reply deleted",description:"Your reply has been deleted"})}catch(r){j({title:"Error",description:r.message||"Failed to delete reply",variant:"destructive"})}},Hs=t=>{a&&(Ke(t),et(""),ze(null))},Ys=async t=>{const r=t||js;if(!(!a||!D)){if(!r.trim()){j({title:"Empty quote",description:"Please add some text to your quote",variant:"destructive"});return}St(!0);try{if(!await p.quoteRepost(a.id,D.id,r.trim(),[]))throw new Error("Failed to post quote");await Ge.from("posts").update({reposts_count:(D.reposts_count||0)+1}).eq("id",D.id),D.user_id!==a.id&&await X.createRepostNotification(D.user_id,a.id,D.id),j({title:"Quote posted!",description:"Your quote has been shared"}),Ke(null),et(""),ke()}catch(o){console.error("Quote error:",o),j({title:"Error",description:o.message||"Failed to post quote",variant:"destructive"})}finally{St(!1)}}},Zs=t=>
2new Date(t).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"}),Js=t=>{const r=new Date(t),o=new Date,u=o.getTime()-r.getTime(),c=Math.floor(u/6e4),g=Math.floor(u/36e5);if(c<1)return"now";if(c<60)return`${c}m`;if(g<24)return`${g}h`;const J=r.getFullYear()===o.getFullYear();return r.toLocaleDateString("en-US",J?{month:"short",day:"numeric"}:{month:"short",day:"numeric",year:"numeric"})};if(be)return e.jsx("div",{className:`min-h-screen ${i?"bg-gray-50":"bg-black"}`,children:e.jsxs("div",{className:`max-w-2xl mx-auto border-x ${i?"border-gray-200":"border-white/[0.08]"}`,children:[e.jsx("div",{className:`sticky top-0 z-10 backdrop-blur-md border-b px-4 py-3 ${i?"bg-white/95 border-gray-200":"bg-black/80 border-white/[0.06]"}`,children:e.jsx("button",{onClick:()=>window.history.length>1?f(-1):f("/home"),className:`p-2 -ml-2 rounded-full transition-colors ${i?"hover:bg-gray-100":"hover:bg-white/10"}`,"aria-label":"Go back",children:e.jsx(Ze,{className:`w-5 h-5 ${i?"text-gray-900":"text-white"}`})})}),e.jsx(va,{isLight:i,count:3,flush:!0})]})});if(!s)return e.jsx("div",{className:"min-h-screen bg-black",children:e.jsxs("div",{className:"max-w-2xl mx-auto",children:[e.jsx("div",{className:"sticky top-0 z-10 bg-black/80 backdrop-blur-md border-b border-gray-800 px-4 py-3",children:e.jsx("button",{onClick:()=>window.history.length>1?f(-1):f("/home"),className:"p-2 -ml-2 hover:bg-white/10 rounded-full transition-colors",children:e.jsx(Ze,{className:"w-5 h-5 text-white"})})}),e.jsx("div",{className:"text-center py-12",children:e.jsx("p",{className:"text-white/50",children:"Post not found"})})]})});if(!I.loading&&I.hideNsfw&&s.is_nsfw&&a?.id!==s.user_id)return e.jsx("div",{className:"min-h-screen bg-black",children:e.jsxs("div",{className:"max-w-2xl mx-auto",children:[e.jsx("div",{className:"sticky top-0 z-10 bg-black/80 backdrop-blur-md border-b border-gray-800 px-4 py-3",children:e.jsx("button",{onClick:()=>window.history.length>1?f(-1):f("/home"),className:"p-2 -ml-2 hover:bg-white/10 rounded-full transition-colors","aria-label":"Back",children:e.jsx(Ze,{className:"w-5 h-5 text-white"})})}),e.jsxs("div",{className:"text-center py-16 px-4",children:[e.jsx(kt,{className:"w-10 h-10 text-white/40 mx-auto mb-4"}),e.jsx("p",{className:"text-white font-semibold mb-1",children:"This post is restricted"}),e.jsx("p",{className:"text-white/50 text-sm",children:"Hidden by parental controls or your account's safety settings."})]})]})});const wt=a?.id===s.user_id,yt=!!s.repost_of_post_id,he=yt&&s.content&&s.content.trim().length>0,d=yt&&!he&&s.repost_of?s.repost_of:s,Zt=d.creator_profile?.avatar?.startsWith("http")?d.creator_profile.avatar:d.user?.avatar_url,Jt=d.user?.display_name||d.user?.username||"Unknown",jt=d.user?.username||"unknown",Xs=d.user?.verified===!0||d.user?.is_lifetime_member===!0||d.user?.account_type==="business",Ks=d.user?.account_type,ea=d.user?.is_diamond_member===!0||d.user?.video_subscription_active===!0;return e.jsxs("div",{className:`min-h-screen ${i?"bg-gray-50":"bg-black"}`,children:[s&&s.user?.username&&e.jsx(ha,{id:"post-social-posting",data:ba({id:s.id,content:s.content||"",created_at:s.created_at,username:s.user.username,display_name:s.user.display_name,image_url:s.media_urls?.[0]||null,likes_count:s.likes_count,replies_count:s.replies_count})}),e.jsxs("div",{className:"max-w-2xl mx-auto",children:[e.jsxs("div",{className:`sticky top-0 z-10 backdrop-blur-md border-b px-4 py-3 flex items-center gap-4 ${i?"bg-white/80 border-gray-200":"bg-black/80 border-gray-800"}`,children:[e.jsx("button",{onClick:()=>window.history.length>1?f(-1):f("/home"),className:`p-2 -ml-2 rounded-full transition-colors ${i?"hover:bg-gray-100":"hover:bg-white/10"}`,children:e.jsx(Ze,{className:`w-5 h-5 ${i?"text-gray-900":"text-white"}`})}),e.jsx("h1",{className:`text-xl font-bold ${i?"text-gray-900":"text-white"}`,children:"Post"})]}),e.jsxs("article",{className:`border-b p-4 ${i?"border-gray-200":"border-gray-800"}`,children:[yt&&!he&&e.jsxs("div",{className:"flex items-center gap-2 text-gray-500 text-sm mb-3 -mt-1",children:[e.jsx(Se,{className:"w-4 h-4"}),e.jsxs("span",{children:[e.jsxs(Pe,{to:`/profile/${s.user?.username}`,className:"hover:underline",children:["@",s.user?.username]})," ","reposted"]})]}),e.jsxs("div",{className:"flex items-start justify-between mb-3 gap-2 min-w-0",children:[e.jsxs(Pe,{to:`/profile/${jt}`,className:"flex items-center gap-3 group min-w-0 flex-1",children:[e.jsx("div",{className:`w-12 h-12 rounded-full ${i?"bg-gray-200":"bg-gray-800"} overflow-hidden`,children:Zt?.startsWith("http")?e.jsx("img",{src:Zt,alt:"",className:"w-full h-full object-cover rounded-full"}):e.jsx("div",{className:`w-full h-full ${i?"bg-gray-200":"bg-gray-900"} rounded-full flex items-center justify-center`,children:e.jsx("span",{className:"text-lg font-semibold text-white",children:Jt[0]?.toUpperCase()||"?"})})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[e.jsx("span",{className:`font-bold group-hover:underline truncate ${i?"text-gray-900":"text-white"}`,children:Jt}),Xs&&e.jsx(Je,{size:"xs",showLabel:!1,username:jt,isPrime:ea,accountType:Ks})]}),e.jsxs("span",{className:"text-gray-500 text-sm truncate block",children:["@",jt]})]})]}),e.jsxs("div",{className:"relative flex-shrink-0",children:[e.jsx("button",{onClick:()=>L(!T),className:`p-2 rounded-full transition-colors ${i?"text-gray-400 hover:text-gray-700 hover:bg-gray-100":"text-gray-500 hover:text-white hover:bg-white/10"}`,title:"Post options",children:e.jsx(us,{className:"w-5 h-5"})}),T&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-[5]",onClick:()=>L(!1)}),e.jsxs("div",{className:`absolute right-0 mt-1 rounded-xl shadow-2xl z-10 min-w-[160px] overflow-hidden ${i?"bg-white border border-gray-200":"bg-black border border-[#2f3336]"}`,children:[!wt&&e.jsxs("button",{onClick:()=>L(!1),className:`w-full text-left px-4 py-2.5 flex items-center gap-3 transition-colors text-sm ${i?"text-gray-700 hover:bg-gray-100":"text-[#e7e9ea] hover:bg-white/5"}`,children:[e.jsx(ms,{className:"w-4 h-4"}),e.jsx("span",{children:"Report"})]}),wt&&e.jsxs("button",{onClick:()=>{L(!1),As()},className:`w-full text-left px-4 py-2.5 flex items-center gap-3 transition-colors text-sm font-semibold ${i?"text-red-600 hover:bg-red-50":"text-red-400 hover:bg-red-500/10"}`,children:[e.jsx(xs,{className:"w-4 h-4"}),e.jsx("span",{children:"Delete post"})]}),e.jsx(na,{targetUsername:s.user?.username,targetUserId:s.user?.id,onClose:()=>L(!1)})]})]})]})]}),he&&e.jsx("div",{className:"mb-4",children:e.jsx("p",{className:`text-xl whitespace-pre-wrap break-words selectable-text ${i?"text-gray-900":"text-white"}`,children:e.jsx(Re,{content:s.content})})}),he&&s.repost_of&&e.jsxs("div",{className:`mb-4 border rounded-2xl p-4 transition-colors ${i?"border-gray-200 bg-gray-50 hover:bg-gray-100":"border-gray-700 bg-gray-900/30 hover:bg-gray-900/50"}`,onClick:t=>{t.target.closest("[data-media-container]")||f(`/post/${s.repost_of.id}`)},children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("div",{className:"w-8 h-8 rounded-full ${isLight ? 'bg-gray-200' : 'bg-gray-800'} overflow-hidden flex-shrink-0",children:s.repost_of.creator_profile?.avatar?.startsWith("http")?e.jsx("img",{src:s.repost_of.creator_profile.avatar,alt:"",className:"w-full h-full object-cover"}):s.repost_of.user?.avatar_url?.startsWith("http")?e.jsx("img",{src:s.repost_of.user.avatar_url,alt:"",className:"w-full h-full object-cover"}):e.jsx("div",{className:"w-full h-full bg-gray-700 flex items-center justify-center text-xs font-bold text-white",children:s.repost_of.user?.username?.[0]?.toUpperCase()||"?"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:`font-semibold text-sm truncate ${i?"text-gray-900":"text-white"}`,children:s.repost_of.user?.display_name||s.repost_of.user?.username||"Unknown"}),(s.repost_of.user?.verified||s.repost_of.user?.is_lifetime_member||s.repost_of.user?.account_type==="business")&&e.jsx(Je,{size:"xs",showLabel:!1,username:s.repost_of.user?.username||"",accountType:s.repost_of.user?.account_type||void 0,isPrime:s.repost_of.user?.is_diamond_member===!0||s.repost_of.user?.video_subscription_active===!0})]}),e.jsxs("span",{className:`text-xs ${i?"text-gray-500":"text-gray-400"}`,children:["@",s.repost_of.user?.username||"unknown"]})]})]}),e.jsx("div",{className:`text-sm mb-2 whitespace-pre-wrap break-words ${Ct?"":"line-clamp-3"} ${i?"text-gray-700":"text-white/70"}`,children:e.jsx(Re,{content:s.repost_of.content})}),s.repost_of.content&&(s.repost_of.content.length>150||s.repost_of.content.split(`
3`).length>4)&&!Ct&&e.jsx("button",{onClick:t=>{t.stopPropagation(),Tt(!0)},className:`text-xs font-medium transition-colors ${i?"text-sky-600 hover:text-sky-700":"text-sky-400 hover:text-sky-300"}`,children:"View more"}),s.repost_of.media_urls&&s.repost_of.media_urls.length>0&&e.jsx("div",{className:`mt-2 rounded-lg overflow-hidden ${i?"bg-gray-100":"bg-gray-800"}`,"data-media-container":"true",onClick:t=>t.stopPropagation(),children:s.repost_of.media_urls[0].includes(".mp4")||s.repost_of.media_urls[0].includes(".webm")||s.repost_of.media_urls[0].includes(".mov")||s.repost_of.media_urls[0].includes("stream.mux.com")?e.jsx(ca,{src:s.repost_of.media_urls[0]}):e.jsx("img",{src:s.repost_of.media_urls[0],alt:s.repost_of.content?.slice(0,80)||`Image from @${s.repost_of.user?.username||"user"}`,loading:"lazy",decoding:"async",className:"w-full object-cover max-h-[300px]"})})]}),!he&&e.jsxs("div",{className:"mb-4",children:[d.title&&e.jsx("h2",{className:`text-2xl font-bold mb-1 ${i?"text-gray-900":"text-white"}`,children:d.title}),Z?e.jsx("div",{className:`text-xl whitespace-pre-wrap break-words selectable-text ${i?"text-gray-900":"text-white"}`,children:Z}):e.jsx("p",{className:`text-xl whitespace-pre-wrap break-words selectable-text ${i?"text-gray-900":"text-white"}`,children:e.jsx(Re,{content:d.content})}),We&&e.jsxs("div",{ref:Qt,className:"mt-3 scroll-mt-24",children:[e.jsx("p",{className:`text-xs mb-2 ${i?"text-gray-500":"text-white/40"}`,children:"Post is already in your language. Translate to:"}),e.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[ua.filter(t=>t.code!==(navigator.language?.split("-")[0]||"en")).map(t=>e.jsx("button",{onClick:async()=>{xe(!0),pe(!1);try{const r=await $e(d.content,t.code);ve(r)}catch{}xe(!1)},className:`px-2.5 py-1 text-xs rounded-full border transition-colors ${i?"border-gray-200 text-gray-600 hover:bg-sky-50 hover:border-sky-300 hover:text-sky-700":"border-white/10 text-white/50 hover:bg-sky-500/10 hover:border-sky-500/30 hover:text-sky-400"}`,children:t.label},t.code)),e.jsx("button",{onClick:t=>{t.stopPropagation(),pe(!1)},"aria-label":"Close translate options",className:`self-center px-1 text-xs underline underline-offset-4 transition-colors ${i?"text-gray-500 hover:text-gray-700":"text-white/40 hover:text-white/70"}`,children:"Keep original"})]})]})]}),It&&e.jsx("div",{className:"mb-3",children:e.jsx(ds,{poll:It,userId:a?.id,postId:s.id,postAuthorId:s.user_id,onVote:async()=>{try{const t=await ge.getByPostId(s.id,a?.id);it(t)}catch{}}})}),!he&&(()=>{const t=d.is_paid,r=!t||we||a?.id===d.user_id,o=t&&d.paid_media_urls?.length?d.paid_media_urls:d.media_urls;if(!o||o.length===0)return null;const u=o[0].includes(".mp4")||o[0].includes(".webm")||o[0].includes(".mov")||o[0].includes("stream.mux.com");return e.jsx("div",{className:"mb-4",onContextMenu:t&&!r?c=>c.preventDefault():void 0,children:r?u?e.jsx(Nt,{urls:[o[0]],isLight:i,thumbnailUrl:d.thumbnail_url,onVideoClick:(c,g)=>{c.stopPropagation(),re(d),je("video"),ae(g)},allowDownload:d.allow_download===!0}):o.length>1?e.jsx(Nt,{urls:o,isLight:i,thumbnailUrl:d.thumbnail_url,onImageClick:(c,g)=>{c.stopPropagation(),re(d),je("image"),ae(g)},onVideoClick:(c,g)=>{c.stopPropagation(),re(d),je("video"),ae(g)},allowDownload:d.allow_download===!0}):e.jsxs("div",{className:`relative rounded-2xl overflow-hidden border inline-block max-w-full ${i?"border-gray-200":"border-gray-800"}`,children:[d.allow_download===!0&&e.jsx("button",{type:"button",onClick:c=>{c.stopPropagation();const g=o[0];fetch(g,{mode:"cors",credentials:"omit"}).then(J=>J.ok?J.blob():Promise.reject()).then(J=>{const Xt=URL.createObjectURL(J),Ne=document.createElement("a");Ne.href=Xt,Ne.download=(g.split("/").pop()||"image").split("?")[0]||"image",document.body.appendChild(Ne),Ne.click(),Ne.remove(),setTimeout(()=>URL.revokeObjectURL(Xt),2e3)}
3).catch(()=>window.open(g,"_blank","noopener,noreferrer"))},"aria-label":"Save image",title:"Save image",className:"absolute top-2 right-2 z-10 inline-flex items-center justify-center w-9 h-9 rounded-full bg-black/60 hover:bg-black/80 text-white backdrop-blur-sm shadow-lg",children:e.jsx(Na,{className:"w-4 h-4"})}),e.jsx("img",{src:o[0],alt:s.content?.slice(0,80)||`Image from @${s.user?.username||"user"}`,className:"block max-w-full h-auto max-h-[500px] cursor-pointer",loading:"lazy",decoding:"async",onClick:c=>{c.stopPropagation(),re(d),je("image"),ae(o[0])},onError:c=>{const g=c.currentTarget;g.dataset.errLogged!=="1"&&(g.dataset.errLogged="1",console.warn("[PostDetail] image failed to load",g.src))}})]}):e.jsxs("div",{className:`relative w-full aspect-[4/3] sm:aspect-video min-h-[240px] sm:min-h-0 watermark-overlay drm-protected rounded-2xl overflow-hidden border ${i?"border-gray-200":"border-gray-800"}`,onContextMenu:c=>c.preventDefault(),children:[u?e.jsx("video",{src:o[0],className:"absolute inset-0 w-full h-full object-cover select-none",style:{filter:"blur(18px)",transform:"scale(1.15)",WebkitUserDrag:"none"},muted:!0,playsInline:!0,draggable:!1,preload:"metadata"}):e.jsx("img",{src:o[0],alt:"","aria-hidden":"true",loading:"lazy",decoding:"async",className:"absolute inset-0 w-full h-full object-cover select-none",style:{filter:"blur(18px)",transform:"scale(1.15)"},draggable:!1}),e.jsx("div",{className:"absolute inset-0 bg-black/40 z-[6]"}),e.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center px-3 py-3 sm:p-4 z-10 min-w-0 overflow-hidden",children:[e.jsx("div",{className:"w-10 h-10 sm:w-14 sm:h-14 rounded-full bg-sky-500/20 flex items-center justify-center mb-2 flex-shrink-0",children:e.jsx(kt,{className:"w-5 h-5 sm:w-7 sm:h-7 text-sky-400"})}),e.jsx("p",{className:"text-white font-semibold text-center mb-1 text-[13px] sm:text-base max-w-full truncate w-full",children:"Exclusive Content"}),(()=>{const{percent:c}=He(a),g=Ye(d.price||0,c);return c>
30?e.jsxs("p",{className:"text-gray-300 text-[11px] sm:text-sm text-center mb-2 sm:mb-3 break-words max-w-full",children:[e.jsxs("span",{className:"line-through opacity-50",children:["$",(d.price||0).toFixed(2)]})," ","$",g.toFixed(2)," ",e.jsxs("span",{className:"text-emerald-400 text-xs whitespace-nowrap",children:["(",c,"% off)"]})]}):e.jsxs("p",{className:"text-gray-300 text-[11px] sm:text-sm text-center mb-2 sm:mb-3 break-words max-w-full",children:["Unlock for $",(d.price||0).toFixed(2)]})})(),e.jsx("button",{onClick:()=>{if(!a){f("/auth");return}q(!0)},disabled:Ce,className:"max-w-full px-3 sm:px-5 py-1.5 sm:py-2 bg-gradient-to-r from-sky-500 to-sky-600 hover:from-sky-600 hover:to-sky-700 text-white text-[12px] sm:text-sm font-semibold rounded-full transition-all inline-flex items-center justify-center gap-1.5 shadow-lg shadow-sky-500/25 flex-shrink-0 min-w-0",children:Ce?e.jsxs(e.Fragment,{children:[e.jsx(fe,{className:"w-3.5 h-3.5 animate-spin flex-shrink-0"})," ",e.jsx("span",{className:"truncate",children:"Loading..."})]}):e.jsxs(e.Fragment,{children:[e.jsx(_a,{className:"w-3.5 h-3.5 flex-shrink-0"})," ",e.jsxs("span",{className:"truncate",children:["Unlock $",Ye(d.price||0,He(a).percent).toFixed(2)]})]})})]})]})})})(),e.jsx("div",{className:`text-gray-500 text-sm mb-0 pb-3 border-b ${i?"border-gray-200":"border-gray-800"}`,children:Zs(s.created_at)}),e.jsxs("div",{className:"flex items-center justify-between pt-1 pb-1",children:[e.jsxs("div",{className:"flex items-center gap-2 xs:gap-4 xm:gap-5 md:gap-8","data-postdetail-actions":!0,children:[e.jsxs("button",{onClick:()=>{Ie(!0),setTimeout(()=>ot.current?.focus(),100)},className:"group flex items-center gap-0.5 text-gray-500 hover:text-sky-400 transition-colors",title:"Reply",children:[e.jsx("div",{className:"p-1.5 rounded-full group-hover:bg-sky-400/10 transition-colors","data-icon-wrap":!0,children:e.jsx(Rt,{className:"w-[18px] h-[18px] xs:w-5 xs:h-5","data-icon-comment":!0})}),s.replies_count>0&&e.jsx("span",{className:"text-[13px] leading-none",children:s.replies_count})]}),e.jsxs("div",{className:"relative",children:[e.jsxs("button",{onClick:t=>{t.stopPropagation(),R&&(b?gt():F(!te))},disabled:!R,className:`group flex items-center gap-0.5 transition-colors ${R?b?"text-[#00ba7c]":"text-gray-500 hover:text-[#00ba7c]":"text-gray-600 cursor-not-allowed"}`,title:b?"Undo Repost":"Repost",children:[e.jsx("div",{className:`p-1.5 rounded-full transition-colors ${b?"":"group-hover:bg-[#00ba7c]/10"}`,"data-icon-wrap":!0,children:e.jsx(Se,{className:"w-[24px] h-[24px]","data-icon-repost":!0})}),s.reposts_count>0&&e.jsx("span",{className:"text-[13px] leading-none",children:s.reposts_count})]}),te&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-[5]",onClick:t=>{t.stopPropagation(),F(!1)}}),e.jsxs("div",{className:`absolute left-0 bottom-full mb-2 rounded-xl shadow-2xl z-10 min-w-[140px] overflow-hidden ${i?"bg-white border border-gray-200":"bg-black border border-[#2f3336]"}`,children:[e.jsxs("button",{onClick:t=>{t.stopPropagation(),F(!1),gt()},className:`w-full text-left px-4 py-3 flex items-center gap-3 transition-colors text-[15px] font-bold ${i?"text-gray-900 hover:bg-gray-100":"text-[#e7e9ea] hover:bg-white/5"}`,children:[e.jsx(Se,{className:"w-5 h-5"}),e.jsx("span",{children:"Repost"})]}),e.jsxs("button",{onClick:t=>{t.stopPropagation(),F(!1),Ds()},className:`w-full text-left px-4 py-3 flex items-center gap-3 transition-colors text-[15px] font-bold ${i?"text-gray-900 hover:bg-gray-100":"text-[#e7e9ea] hover:bg-white/5"}`,children:[e.jsx(ps,{className:"w-5 h-5"}),e.jsx("span",{children:"Quote"})]})]})]})]}),e.jsx(cs,{isLiked:M,likesCount:s.likes_count,disabled:!R,onLike:Yt})]}),a&&s.user_id!==a.id&&Ve&&w&&w>=.01&&e.jsxs("button",{onClick:()=>{mt.current&&clearTimeout(mt.current),Dt(!0),mt.current=setTimeout(()=>Dt(!1),500),At()},className:"group flex items-center gap-0 text-emerald-500 hover:text-emerald-400 transition-colors flex-shrink-0 ml-2 xs:ml-10 xm:ml-12","data-postdetail-quicktip":!0,title:`Quick tip $${w<1?w.toFixed(2):w}`,"aria-label":`Quick tip $${w.toFixed(2)}`,children:[e.jsxs("div",{className:"p-1 xs:p-1.5 rounded-full group-hover:bg-emerald-500/10 transition-colors relative opacity-70 group-hover:opacity-100","data-icon-wrap":!0,
3children:[Et&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"zap-flash"}),e.jsx("span",{className:"zap-bolt",style:{"--bolt-angle":"0deg"}}),e.jsx("span",{className:"zap-bolt",style:{"--bolt-angle":"90deg"}}),e.jsx("span",{className:"zap-bolt",style:{"--bolt-angle":"180deg"}}),e.jsx("span",{className:"zap-bolt",style:{"--bolt-angle":"270deg"}})]}),e.jsx(hs,{className:`w-[14px] h-[14px] xs:w-[16px] xs:h-[16px] relative z-[1] ${Et?"zap-icon-pop fill-current":""}`,"data-icon-zap":!0})]}),e.jsxs("span",{className:"text-[11px] xs:text-[12px] leading-none font-medium whitespace-nowrap -ml-1",children:["$",w<1?w.toFixed(2):w]})]}),e.jsxs("div",{className:"flex items-center -space-x-0.5 xs:space-x-0 ml-auto","data-postdetail-right":!0,children:[a&&e.jsxs("button",{onClick:()=>{qe(null),Oe(!0)},className:"group flex items-center text-gray-500 hover:text-[#00ba7c] transition-colors flex-shrink-0",title:"Send tip","aria-label":"Send tip to creator",children:[e.jsx("div",{className:"p-1 xs:p-1.5 rounded-full group-hover:bg-[#00ba7c]/10 transition-colors","data-icon-wrap":!0,children:e.jsx(fs,{className:"w-[18px] h-[18px] xs:w-5 xs:h-5","data-icon-dollar":!0})}),e.jsx("span",{className:"text-xs font-medium -ml-1","data-postdetail-tip-text":!0,children:"TIP"})]}),e.jsx("button",{onClick:async()=>{if(!s)return;if(Z){ve(null),pe(!1);return}if(We){pe(!1);return}xe(!0);const t=navigator.language?.split("-")[0]||"en";try{const r=await $e(d.content,t);ve(r)}catch(r){r.message==="same_language"&&pe(!0)}xe(!1)},disabled:xt,className:`hidden md:flex group p-2 rounded-full transition-colors ${Z?"text-[#1d9bf0]":i?"text-gray-400 hover:text-sky-500 hover:bg-sky-50":"text-gray-500 hover:text-[#1d9bf0] hover:bg-[#1d9bf0]/10"} ${xt?"opacity-50 cursor-wait":""}`,title:Z?"Show original":"Translate",children:xt?e.jsx(fe,{className:"w-5 h-5 animate-spin"}):e.jsx(Xe,{className:"w-5 h-5"})}),e.jsxs("div",{className:"relative",children:[e.jsx("button",{onClick:()=>V(!Ue),className:`group p-1 xs:p-1.5 rounded-full transition-colors ${i?"text-gray-400 hover:bg-gray-100":"text-gray-500 hover:bg-white/10"}`,title:"More",children:e.jsx(gs,{className:"w-[18px] h-[18px] xs:w-5 xs:h-5","data-icon-more":!0})}),Ue&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-[5]",onClick:()=>V(!1)}),e.jsxs("div",{className:`absolute right-0 bottom-full mb-2 rounded-xl shadow-2xl z-10 min-w-[160px] overflow-hidden ${i?"bg-white border border-gray-200":"bg-black border border-[#2f3336]"}`,children:[e.jsxs("button",{onClick:async()=>{if(V(!1),!s)return;if(Z){ve(null);return}xe(!0);const t=navigator.language?.split("-")[0]||"en";try{const r=await $e(d.content,t);ve(r)}catch(r){r.message==="same_language"&&pe(!0)}xe(!1)},className:`w-full text-left px-4 py-2.5 flex items-center gap-3 transition-colors text-sm ${Z?i?"text-blue-600":"text-[#1d9bf0]":i?"text-gray-700 hover:bg-gray-100":"text-[#e7e9ea] hover:bg-white/5"}`,children:[e.jsx(Xe,{className:"w-4 h-4"}),e.jsx("span",{children:Z?"Show original":"Translate"})]}),e.jsxs("button",{onClick:()=>{Gt(),V(!1)},className:`w-full text-left px-4 py-2.5 flex items-center gap-3 transition-colors text-sm ${A?i?"text-blue-600":"text-[#1d9bf0]":i?"text-gray-700 hover:bg-gray-100":"text-[#e7e9ea] hover:bg-white/5"}`,children:[e.jsx(bs,{className:`w-4 h-4 ${A?"fill-current":""}`}),e.jsx("span",{children:A?"Remove bookmark":"Bookmark"})]}),wt&&e.jsxs("button",{onClick:async()=>{V(!1),await Ls()},disabled:N,className:`w-full text-left px-4 py-2.5 flex items-center gap-3 transition-colors text-sm disabled:opacity-50 ${me?i?"text-blue-600":"text-[#1d9bf0]":i?"text-gray-700 hover:bg-gray-100":"text-[#e7e9ea] hover:bg-white/5"}`,children:[me?e.jsx(Ra,{className:"w-4 h-4"}):e.jsx(Pa,{className:"w-4 h-4"}),e.jsx("span",{children:me?"Unpin from profile":"Pin to profile"})]}),e.jsxs("button",{onClick:async()=>{await _t(window.location.href),V(!1)},className:`w-full text-left px-4 py-2.5 flex items-center gap-3 transition-colors text-sm ${i?"text-gray-700 hover:bg-gray-100":"text-[#e7e9ea] hover:bg-white/5"}`,children:[e.jsx(ws,{className:"w-4 h-4"}),e.jsx("span",{children:"Copy link"})]})]})]})]})]})]})]}),a&&!Ft&&e.jsx("div",{className:`border-b p-4 ${i?"border-gray-200":"border-gray-800"}`,children:e.jsx("button",{onClick:()=>{Ie(!0),setTimeout(()=>
3ot.current?.focus(),100)},className:`w-full py-3 px-4 rounded-full text-left transition-colors ${i?"bg-gray-100 hover:bg-gray-200 border border-gray-200 text-gray-500":"bg-white/[0.03] hover:bg-white/[0.06] border border-white/[0.08] text-white/50"}`,children:"Post your reply..."})}),a&&Ft&&e.jsx("div",{className:`border-b p-4 ${i?"border-gray-200":"border-gray-800"}`,children:e.jsxs("div",{className:"flex gap-3 min-w-0",children:[e.jsx("div",{className:"w-10 h-10 rounded-full ${isLight ? 'bg-gray-200' : 'bg-gray-800'} overflow-hidden flex-shrink-0",children:$?.avatar?.startsWith("http")?e.jsx("img",{src:$.avatar,alt:"",className:"w-full h-full object-cover rounded-full"}):e.jsx("div",{className:`w-full h-full ${i?"bg-gray-200":"bg-gray-900"} rounded-full flex items-center justify-center`,children:e.jsx("span",{className:"text-sm font-semibold text-white",children:a.username?.[0]?.toUpperCase()||"?"})})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("textarea",{ref:ot,value:W,onChange:t=>st(t.target.value),placeholder:"Post your reply",className:`w-full text-lg placeholder-gray-500 resize-none outline-none min-h-[80px] rounded-2xl px-4 py-3 border transition-colors ${i?"bg-gray-100 text-gray-900 border-gray-200 focus:bg-white focus:border-sky-500":"bg-white/5 text-white border-white/10 focus:bg-white/10 focus:border-sky-500"}`,maxLength:280,disabled:!R}),rt&&e.jsxs("div",{className:"relative mt-2 inline-block max-w-full",children:[z?.type.startsWith("video")?e.jsx("video",{src:rt,controls:!0,className:"block max-w-full max-h-[510px] rounded-2xl border border-white/10 bg-black"}):e.jsx("img",{src:rt,alt:"Preview",className:`block max-w-full max-h-[510px] rounded-2xl border ${i?"border-gray-200":"border-white/10"}`}),e.jsx("button",{onClick:()=>{Me(null),Ee(null),ie.current&&(ie.current.value="")},"aria-label":"Remove attachment",className:"absolute top-2 right-2 p-1.5 bg-black/70 hover:bg-black/90 rounded-full transition-colors backdrop-blur-sm",children:e.jsx(_e,{className:"w-4 h-4 text-white"})})]}),oe&&e.jsxs("div",{className:`mt-3 p-3 rounded-xl border space-y-2 ${i?"bg-gray-50 border-gray-200":"bg-white/[0.02] border-white/10"}`,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:`text-sm font-semibold flex items-center gap-1.5 ${i?"text-gray-700":"text-white/80"}`,children:[e.jsx(os,{className:"w-4 h-4 text-sky-400"}),"Poll"]}),e.jsx("button",{type:"button",onClick:()=>{De(!1),le(["",""])},className:"text-xs text-gray-500 hover:text-red-400 transition-colors",children:"Remove"})]}),G.map((t,r)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"text",value:t,onChange:o=>{const u=[...G];u[r]=o.target.value.slice(0,80),le(u)},placeholder:`Option ${r+1}`,maxLength:80,disabled:U,className:`flex-1 text-sm rounded-lg px-3 py-2 border outline-none transition-colors ${i?"bg-white text-gray-900 border-gray-200 focus:border-sky-500":"bg-white/5 text-white border-white/10 focus:border-sky-500"}`}),G.length>2&&e.jsx("button",{type:"button",onClick:()=>le(G.filter((o,u)=>u!==r)),disabled:U,className:"p-1.5 text-gray-500 hover:text-red-400 rounded-full transition-colors","aria-label":"Remove option",children:e.jsx(_e,{className:"w-4 h-4"})})]},r)),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[G.length<4&&e.jsx("button",{type:"button",onClick:()=>le([...G,""]),disabled:U,className:"text-xs text-sky-500 hover:text-sky-400 font-medium",children:"+ Add option"}),e.jsxs("select",{value:Ut,onChange:t=>zt(Number(t.target.value)),disabled:U,className:`ml-auto text-xs rounded-lg px-2 py-1.5 border outline-none ${i?"bg-white text-gray-700 border-gray-200":"bg-white/5 text-white/80 border-white/10"}`,children:[e.jsx("option",{value:1,children:"1 hour"}),e.jsx("option",{value:6,children:"6 hours"}),e.jsx("option",{value:24,children:"1 day"}),e.jsx("option",{value:72,children:"3 days"}),e.jsx("option",{value:168,children:"7 days"})]})]})]}),e.jsxs("div",{className:"flex items-center justify-between gap-2 mt-3 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-0.5 sm:gap-1 flex-shrink-0",children:[e.jsx("input",{ref:ie,type:"file",accept:"image/*,video/*",onChange:t=>{const r=t.target.files?.[0];if(r){Me(r);const o=new FileReader;o.onload=u=>{Ee(u.target?.result)},o.readAsDataURL(r)}},className:"hidden",disabled:U}),e.jsx("button",{onClick:()=>{ie.current&&(ie.current.accept="image/*",ie.current.click(),ie.current.accept="image/*,video/*")},disabled:U,className:"p-1 sm:p-1.5 text-sky-400 hover:bg-sky-500/10 rounded-full transition-colors disabled:opacity-40 flex-shrink-0",title:z?"Replace photo":"Add photo",children:e.jsx(ls,{className:"w-4 h-4 sm:w-[18px] sm:h-[18px]"})}),e.jsx("button",{onClick:()=>{De(t=>!t),oe&&le(["",""])},disabled:U||!!z,className:`p-1 sm:p-1.5 rounded-full transition-colors disabled:opacity-40 flex-shrink-0 ${oe?"text-sky-400 bg-sky-500/10":"text-sky-400 hover:bg-sky-500/10"}`,title:z?"Remove media to add a poll":"Add poll",children:e.jsx(os,{className:"w-4 h-4 sm:w-[18px] sm:h-[18px]"})}),e.jsx("button",{disabled:U,className:"p-1 sm:p-1.5 text-sky-400 hover:bg-sky-500/10 rounded-full transition-colors disabled:opacity-40 flex-shrink-0",title:"Add location",children:e.jsx($a,{className:"w-4 h-4 sm:w-[18px] sm:h-[18px]"})})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsx("button",{onClick:()=>{Ie(!1),st(""),Me(null),Ee(null),De(!1),le(["",""])},className:"text-sm text-gray-500 hover:text-white transition-colors whitespace-nowrap flex-shrink-0",children:"Cancel"}),W.length>0&&e.jsx("span",{className:`text-sm tabular-nums flex-shrink-0 ${W.length>260?"text-yellow-500":"text-gray-500"}`,children:280-W.length}),e.jsx("button",{onClick:Bs,disabled:!W.trim()&&!z&&!(oe&&G.filter(t=>t.trim()).length>=2)||U||!R,"data-glass-surface":"",className:"px-4 sm:px-5 py-1.5 
3sm:py-2 bg-sky-500 hover:bg-sky-600 disabled:bg-sky-500/50 disabled:cursor-not-allowed text-white text-sm font-semibold rounded-full transition-colors flex items-center gap-2 whitespace-nowrap flex-shrink-0",children:U?e.jsxs(e.Fragment,{children:[e.jsx(fe,{className:"w-4 h-4 animate-spin"}),e.jsx("span",{className:"whitespace-nowrap",children:"Replying..."})]}):"Reply"})]})]}),!R&&a&&e.jsxs("p",{className:"text-xs text-gray-500 mt-2",children:[e.jsx(Pe,{to:"/spitcoin",className:"text-sky-400 hover:underline",children:"Upgrade to Lifetime Premium"})," ","to reply"]})]})]})}),e.jsx("div",{children:x?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(fe,{className:"w-6 h-6 text-sky-500 animate-spin"})}):_.length===0?e.jsxs("div",{className:"text-center py-12 px-4",children:[e.jsx(Rt,{className:"w-12 h-12 text-gray-700 mx-auto mb-3"}),e.jsx("p",{className:"text-gray-500",children:"No replies yet"}),e.jsx("p",{className:"text-gray-600 text-sm mt-1",children:"Be the first to reply!"})]}):_.map((t,r)=>e.jsxs("div",{children:[r===3&&!a?.is_diamond_member&&!a?.video_subscription_active&&e.jsx(wa,{slot:"post-replies",placement:"feed"}),e.jsx(ys,{reply:t,isLiked:Bt.has(t.id),isReposted:pt.has(t.id),onLike:()=>qs(t.id,t.user_id),onRepostClick:()=>Vs(t.id),onQuote:Hs,showRepostMenu:$t===t.id,onRepostMenuChange:o=>ze(o?t.id:null),formatTime:Js,currentUser:a,canInteract:R,onDelete:Gs,onReply:o=>{a&&(Qe(o),lt(""))},onQuickTip:Rs,onTip:Ps,onPreview:(o,u,c)=>{re(c||null),je(u||"image"),ae(o)},quickTipAmount:w,isQuickTipEnabled:Ve})]},t.id))})]}),e.jsx(ma,{isOpen:$s,onClose:()=>Vt(!1),feature:Ss}),e.jsx(fa,{src:v?null:tt,mediaType:Lt,onClose:()=>{ae(null),re(null)}}),e.jsx(ga,{open:!!v&&!!tt,post:v,mediaUrl:tt,mediaType:Lt,isLight:i,currentUser:a,quickTipAmount:w||null,isLiked:v&&s&&v.id===s.id?M:!1,isReposted:v&&s&&v.id===s.id?b:!1,isBookmarked:v&&s&&v.id===s.id?A:!1,onClose:()=>{ae(null),re(null)},onLike:()=>{v&&s&&v.id===s.id&&Yt()},onRepost:()=>{v&&s&&v.id===s.id&&Es()},onBookmark:()=>{v&&s&&v.id===s.id&&Gt()},onTip:t=>{qe({userId:t.user_id,username:t.user?.username||"creator",avatar:t.creator_profile?.avatar||t.user?.avatar_url||null,postId:t.id}),Oe(!0)},onQuickTip:()=>{v&&s&&v.id===s.id&&At()}}),ks&&s&&a&&e.jsx(xa,{target:Ns||{userId:s.user_id,username:s.user?.username||"creator",avatar:s.creator_profile?.avatar||s.user?.avatar_url||null,postId:s.id},onClose:()=>{Oe(!1),qe(null)}}),ye&&a&&e.jsx(as,{quotedPost:ye,currentUser:a,creatorProfile:$,isSubmitting:Fe,onSubmit:(t,r)=>Qs(t,r),onClose:()=>{de(null),ue("")}}),Te&&d&&a&&e.jsxs("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center p-4",children:[e.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:()=>q(!1)}),e.jsxs("div",{className:`relative w-full max-w-sm rounded-2xl border p-6 shadow-2xl ${i?"bg-white border-gray-200":"bg-gray-900 border-white/10"}`,children:[e.jsx("button",{onClick:()=>q(!1),className:`absolute top-3 right-3 p-1.5 rounded-full transition-colors ${i?"hover:bg-gray-100 text-gray-400":"hover:bg-white/10 text-gray-500"}`,children:e.jsx(_e,{className:"w-4 h-4"})}),e.jsxs("div",{className:"flex flex-col items-center text-center",children:[e.jsx("div",{className:"w-14 h-14 rounded-full bg-sky-500/15 flex items-center justify-center mb-4",children:e.jsx(kt,{className:"w-7 h-7 text-sky-400"})}),e.jsx("h3",{className:`text-lg font-bold mb-1 ${i?"text-gray-900":"text-white"}`,children:"Confirm Purchase"}),e.jsxs("p",{className:`text-sm mb-5 ${i?"text-gray-500":"text-gray-400"}`,children:["Unlock exclusive content from @",d.user?.username||"creator"]}),(()=>{const{percent:t}=He(a),r=d.price||0,o=Ye(r,t);return e.jsxs("div",{className:`w-full rounded-xl p-4 mb-5 ${i?"bg-gray-50":"bg-white/[0.04]"}`,children:[t>0&&e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:`text-xs ${i?"text-gray-400":"text-gray-500"}`,children:"Original"}),e.jsxs("span",{className:`text-xs line-through ${i?"text-gray-400":"text-gray-500"}`,children:["$",r.toFixed(2)]})]}),t>0&&e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("span",{className:"text-xs text-emerald-400",children:["Discount (",t,"% off)"]}),e.jsxs("span",{className:"text-xs text-emerald-400",children:["-$",(r-o).toFixed(2)]})]}),e.jsxs("div",{className:`flex items-center justify-between pt-2 ${t>0?`border-t ${i?"border-gray-200":"border-white/10"}`:""}`,children:[e.jsx("span",{className:`text-sm font-semibold ${i?"text-gray-900":"text-white"}`,children:"Total"}),e.jsxs("span",{className:`text-lg font-bold ${i?"text-gray-900":"text-white"}`,children:["$",o.toFixed(2)]})]})]})})(),e.jsxs("div",{className:"flex gap-3 w-full",children:[e.jsx("button",{onClick:()=>q(!1),className:`flex-1 py-2.5 text-sm font-medium rounded-xl transition-colors ${i?"bg-gray-100 text-gray-700 hover:bg-gray-200":"bg-white/[0.06] text-gray-300 hover:bg-white/10"}`,children:"Cancel"}),e.jsx("button",{onClick:async()=>{q(!1),O(!0);try{if(d.is_nsfw){const{parentalControl:c}=await ta(async()=>{const{parentalControl:J}=await import("./parental-control-BEMcOgAj.js");return{parentalControl:J}},__vite__mapDeps([0,1,2,3,4,5,6,7])),g=await c.checkPurchase(d.id);if(!g.allowed){alert(g.reason||"This content is age-restricted and cannot be purchased while parental control is on."),O(!1);return}}const{percent:t}=He(a),r=Ye(d.price||0,t),o=await ia("/api/wallet/donate",{method:"POST",body:JSON.stringify({userId:a.id,amount:r})}),u=await o.json();if(!o.ok){if(u.error==="Insufficient balance"){alert(`Insufficient balance. You need ${r} SPITCOIN.`),f("/wallet");return}throw new Error(u.error||"Purchase failed")}await p.recordPurchase(d.id,a.id,r),B(!0)}catch{alert("Purchase failed. Please try again.")}finally{O(!1)}},className:"flex-1 py-2.5 text-sm font-semibold rounded-xl bg-gradient-to-r from-sky-500 to-sky-600 hover:from-sky-600 hover:to-sky-700 text-white transition-all shadow-lg shadow-sky-500/20",children:"Confirm Purchase"})]})]})]})]}),y&&a&&e.jsxs("div",{className:"fixed inset-0 z-50 flex items-start justify-center pt-16 sm:pt-20 px-4",children:[e.jsx("div",{className:`absolute inset-0 backdrop-blur-sm ${i?"bg-black/40":"bg-black/80"}`,onClick:()=>Qe(null)}),e.jsxs("div",{className:`relative rounded-2xl max-w-lg w-full shadow-2xl z-10 ${i?"bg-white border border-gray-200":"bg-[#0a0a0a] border border-white/10"}`,children:[e.jsx("button",{onClick:()=>Qe(null),className:`absolute top-3 right-3 p-2 rounded-full transition-colors z-10 ${i?"text-gray-500 hover:text-gray-900 hover:bg-gray-100":"text-gray-400 hover:text-white hover:bg-white/10"}`,children:e.jsx(_e,{className:"w-5 h-5"})}),e.jsxs("div",{className:`p-4 border-b ${i?"border-gray-200":"border-white/[0.08]"}`,children:[e.jsxs("div",{className:"flex gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-full overflow-hidden flex-shrink-0",children:e.jsx(Kt,{src:es(y.user?.avatar_url,y.creator_profile?.avatar),username:y.user?.username,size:"md"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"min-w-0",children:e.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[e.jsx("span",{className:`font-bold truncate min-w-0 ${i?"text-gray-900":"text-white"}`,children:y.user?.display_name||y.user?.username||"Unknown"}),(y.user?.verified||y.user?.is_lifetime_member||y.user?.account_type==="business")&&e.jsx(Je,{size:"xs",showLabel:!1,username:y.user?.username,accountType:y.user?.account_type}),e.jsxs("span",{className:"text-gray-500 truncate text-[13px] hidden sm:inline min-w-0",children:["@",y.user?.username]})]})}),e.jsx("div",{className:`mt-1 text-sm line-clamp-3 ${i?"text-gray-600":"text-white/70"}`,children:e.jsx(Re,{content:y.content})})]})]}),e.jsx("div",{className:`ml-5 mt-2 pl-8 border-l-2 ${i?"border-gray-300":"border-gray-700"}`,children:e.jsxs("span",{className:"text-gray-500 text-sm",children:["Replying to ",e.jsxs("span",{className:"text-sky-400",children:["@",y.user?.username]})]})})]}),e.jsxs("div",{className:"p-4",children:[e.jsxs("div",{className:"flex gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-full overflow-hidden flex-shrink-0",children:e.jsx(Kt,{src:es(a?.avatar_url,$?.avatar),username:a?.username,size:"md"})}),e.jsx("div",{className:"flex-1",children:e.jsx("textarea",{value:H,onChange:t=>lt(t.target.value),placeholder:"Post your reply",className:`w-full text-base placeholder-gray-500 resize-none outline-none min-h-[80px] rounded-2xl px-4 py-3 border transition-colors ${i?"bg-gray-100 text-gray-900 border-gray-200 focus:bg-white focus:border-sky-500":"bg-white/5 text-white border-white/10 focus:bg-white/10 focus:border-sky-500"}`,maxLength:500,autoFocus:!0})})]}),dt&&e.jsxs("div",{className:"relative mt-2 ml-[52px] inline-block max-w-full",children:[Y?.type.startsWith("video")?e.jsx("video",{src:dt,controls:!0,className:"block max-w-full max-h-[510px] rounded-2xl border border-white/10 bg-black"}):e.jsx("img",{src:dt,alt:"Preview",className:`block max-w-full max-h-[510px] rounded-2xl border ${i?"border-gray-200":"border-white/10"}`}),e.jsx("button",{onClick:()=>{ct(null),ut(null),Be.current&&(Be.current.value="")},"aria-label":"Remove attachment",className:"absolute top-2 right-2 p-1.5 bg-black/70 hover:bg-black/90 rounded-full transition-colors backdrop-blur-sm",children:e.jsx(_e,{className:"w-4 h-4 text-white"})})]}),e.jsxs("div",{className:`flex items-center justify-between gap-2 mt-4 pt-4 border-t min-w-0 ${i?"border-gray-200":"border-white/[0.08]"}`,children:[e.jsxs("div",{className:"flex items-center gap-1 min-w-0",children:[e.jsx("input",{ref:Be,type:"file",accept:"image/*,video/*",onChange:t=>{const r=t.target.files?.[0];if(r){ct(r);const o=new FileReader;o.onload=u=>ut(u.target?.result),o.readAsDataURL(r)}},className:"hidden",disabled:Ae}),e.jsx("button",{onClick:()=>Be.current?.click(),disabled:Ae,className:"p-1.5 text-sky-400 hover:bg-sky-500/10 rounded-full transition-colors disabled:opacity-40",title:Y?"Replace photo":"Add photo",children:e.jsx(ls,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[H.length>0&&e.jsx("span",{className:`text-sm tabular-nums flex-shrink-0 ${H.length>450?"text-yellow-500":"text-gray-500"}`,children:500-H.length}),e.jsx("button",{onClick:Os,disabled:!H.trim()&&!Y||Ae,"data-glass-surface":"",className:"px-4 sm:px-5 py-1.5 
3sm:py-2 bg-sky-500 hover:bg-sky-600 disabled:bg-sky-500/50 disabled:cursor-not-allowed text-white text-sm font-semibold rounded-full transition-colors flex items-center gap-2 whitespace-nowrap flex-shrink-0",children:Ae?e.jsxs(e.Fragment,{children:[e.jsx(fe,{className:"w-4 h-4 animate-spin"})," ",e.jsx("span",{className:"whitespace-nowrap",children:"Replying..."})]}):"Reply"})]})]})]})]})]}),D&&a&&e.jsx(as,{quotedPost:D,currentUser:a,creatorProfile:$,isSubmitting:vs,onSubmit:t=>Ys(t),onClose:()=>{Ke(null),et("")},title:"Quote Reply"})]})}const Sa=4;function ys(n){const f=n.depth??0,a=n.reply.replies_count||0,[$,ne]=l.useState(!1),[i,s]=l.useState(null),[P,_]=l.useState(!1),[k,I]=l.useState(new Set),[S,ce]=l.useState(new Set),K=async()=>{if(!(i!==null||P)){_(!0);try{const x=await p.getReplies(n.reply.id);if(s(x),n.currentUser&&x.length>0){const C=x.map(b=>b.id),[M,m]=await Promise.all([p.getLikedPosts(C,n.currentUser.id),p.getRepostedPosts(C,n.currentUser.id)]);I(new Set(M)),ce(new Set(m))}}catch(x){console.warn("[ReplyThread] failed to load sub-replies:",x),s([])}finally{_(!1)}}},be=()=>{const x=!$;ne(x),x&&K()},ee=a>0&&f<Sa;return e.jsxs("div",{children:[e.jsx(Ca,{...n}),ee&&e.jsx("div",{className:"ml-12 mt-1 mb-1",style:{paddingLeft:f*8},children:e.jsx("button",{type:"button",onClick:be,className:"text-xs text-sky-500 hover:text-sky-400 hover:underline px-2 py-1","aria-expanded":$,children:$?"Hide replies":P?"Loading…":`Show ${a} ${a===1?"reply":"replies"}`})}),$&&i&&i.length>0&&e.jsx("div",{className:"border-l-2 border-gray-800 ml-8 pl-2",style:{marginLeft:32+f*8},children:i.map(x=>l.createElement(ys,{...n,key:x.id,reply:x,isLiked:k.has(x.id),isReposted:S.has(x.id),depth:f+1,onLike:()=>{if(!n.currentUser)return;const C=k.has(x.id);I(m=>{const b=new Set(m);return C?b.delete(x.id):b.add(x.id),b}),s(m=>m&&m.map(b=>b.id===x.id?{...b,likes_count:(b.likes_count||0)+(C?-1:1)}:b)),(C?p.unlike(x.id,n.currentUser.id):p.like(x.id,n.currentUser.id)).catch(()=>{})}}))})]})}function Ca({reply:n,isLiked:f,isReposted:a,onLike:$,onRepostClick:ne,onQuote:i,showRepostMenu:s,onRepostMenuChange:P,formatTime:_,currentUser:k,canInteract:I,onDelete:S,onReply:ce,onQuickTip:K,onTip:be,onPreview:ee,quickTipAmount:x,isQuickTipEnabled:C}){const{theme:M}=ns(),m=M==="light",[b,Q]=l.useState(!1),[A,E]=l.useState(!1),[T,L]=l.useState(null),[we,B]=l.useState(!1),[Ce,O]=l.useState(!1),[Te,q]=l.useState(!1),te=l.useRef(null),[F,ye]=l.useState(null),de=k?.id===n.user_id,Le=k&&k.id!==n.user_id,ue=n.creator_profile?.avatar?.startsWith("http")?n.creator_profile.avatar:n.user?.avatar_url,Fe=n.user?.display_name||n.user?.username||"Unknown",se=n.user?.username||"unknown",Ue=n.user?.verified===!0||n.user?.is_lifetime_member===!0||n.user?.account_type==="business",V=n.user?.account_type,me=n.user?.is_diamond_member===!0||n.user?.video_subscription_active===!0;return l.useEffect(()=>{let h=!1;return ge.getByPostId(n.id,k?.id).then(N=>{h||ye(N)}).catch(()=>{}),()=>{h=!0}},[n.id,k?.id]),e.jsx("article",{className:`border-b p-4 transition-colors ${m?"border-gray-200 hover:bg-gray-50":"border-gray-800 hover:bg-gray-900/30"}`,children:e.jsxs("div",{className:"flex gap-3",children:[e.jsx(Pe,{to:`/profile/${se}`,className:"flex-shrink-0",children:e.jsx("div",{className:`w-10 h-10 rounded-full ${m?"bg-gray-200":"bg-gray-800"} overflow-hidden`,children:ue?.startsWith("http")?e.jsx("img",{src:ue,alt:"",className:"w-full h-full object-cover rounded-full"}):e.jsx("div",{className:`w-full h-full ${m?"bg-gray-200":"bg-gray-900"} rounded-full flex items-center justify-center`,children:e.jsx("span",{className:"text-sm font-semibold text-white",children:Fe[0]?.toUpperCase()||"?"})})})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center justify-between gap-1",children:[e.jsx("div",{className:"min-w-0",children:e.jsxs("div",{className:"flex items-center gap-1.5 min-w-0 flex-wrap",children:[e.jsx(Pe,{to:`/profile/${se}`,className:`font-bold hover:underline truncate min-w-0 ${m?"text-gray-900":"text-white"}`,children:Fe}),Ue&&e.jsx(Je,{size:"xs",showLabel:!1,username:se,isPrime:me,accountType:V}),e.jsxs("span",{className:"text-gray-500 truncate text-[13px] min-w-0",children:["@",se]}),e.jsx("span",{className:"text-gray-500 text-[13px] flex-shrink-0",children:"·"}),e.jsx("span",{className:"text-gray-500 text-[13px] flex-shrink-0 whitespace-nowrap",children:_(n.created_at)})]})}),e.jsxs("div",{className:"relative flex-shrink-0 -mr-1",children:[e.jsx("button",{onClick:()=>
3Q(!b),className:`p-1.5 rounded-full transition-colors ${m?"text-gray-400 hover:text-gray-700 hover:bg-gray-100":"text-gray-500 hover:text-white hover:bg-white/10"}`,title:"More options",children:e.jsx(us,{className:"w-4 h-4"})}),b&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-[5]",onClick:()=>Q(!1)}),e.jsxs("div",{className:`absolute right-0 top-full mt-1 rounded-xl shadow-2xl z-10 min-w-[160px] overflow-hidden ${m?"bg-white border border-gray-200":"bg-black border border-[#2f3336]"}`,children:[!de&&e.jsxs("button",{onClick:()=>Q(!1),className:`w-full text-left px-4 py-2.5 flex items-center gap-3 transition-colors text-sm ${m?"text-gray-700 hover:bg-gray-100":"text-[#e7e9ea] hover:bg-white/5"}`,children:[e.jsx(ms,{className:"w-4 h-4"}),e.jsx("span",{children:"Report"})]}),de&&e.jsxs("button",{onClick:()=>{Q(!1),S&&S(n.id)},className:`w-full text-left px-4 py-2.5 flex items-center gap-3 transition-colors text-sm font-semibold ${m?"text-red-600 hover:bg-red-50":"text-red-400 hover:bg-red-500/10"}`,children:[e.jsx(xs,{className:"w-4 h-4"}),e.jsx("span",{children:"Delete"})]})]})]})]})]}),e.jsx("p",{className:`mt-1 whitespace-pre-wrap break-words selectable-text ${m?"text-gray-900":"text-white"}`,children:e.jsx(Re,{content:T||n.content})}),T&&e.jsx("span",{className:`text-[11px] mt-0.5 block ${m?"text-sky-500":"text-sky-400/60"}`,children:"Translated"}),n.media_urls&&n.media_urls.length>0&&e.jsx(Nt,{urls:n.media_urls,isLight:m,thumbnailUrl:n.thumbnail_url,onImageClick:(h,N)=>{h.stopPropagation(),ee?.(N,"image",n)},onVideoClick:(h,N)=>{h.stopPropagation(),ee?.(N,"video",n)},allowDownload:n.allow_download===!0}),F&&e.jsx("div",{className:"mt-3",children:e.jsx(ds,{poll:F,userId:k?.id,postAuthorId:n.user_id,postId:n.id,onVote:async()=>{try{const h=await ge.getByPostId(n.id,k?.id);ye(h)}catch{}}})}),e.jsxs("div",{className:"flex items-center mt-2 -ml-2.5 text-[#71767b] h-10",children:[e.jsx("div",{className:"flex-1 flex items-center",children:e.jsxs("button",{onClick:()=>ce?.(n),className:"group inline-flex items-center gap-0.5 hover:text-sky-400 transition-colors",title:"Reply",children:[e.jsx("div",{className:"p-2 rounded-full group-hover:bg-sky-400/10 transition-colors",children:e.jsx(Rt,{className:"w-5 h-5"})}),n.replies_count>0&&e.jsx("span",{className:"text-[13px] leading-none",children:n.replies_count})]})}),e.jsxs("div",{className:"flex-1 flex items-center relative",children:[e.jsxs("button",{onClick:h=>{h.stopPropagation(),ne()},disabled:!I,className:`group inline-flex items-center gap-0.5 transition-colors ${I?a?"text-[#00ba7c]":"hover:text-[#00ba7c]":"text-gray-600 cursor-not-allowed"}`,children:[e.jsx("div",{className:`p-2 rounded-full transition-colors ${a?"":"group-hover:bg-[#00ba7c]/10"}`,children:e.jsx(Se,{className:`w-[22px] h-[22px] ${a?"fill-current":""}`})}),n.reposts_count>0&&e.jsx("span",{className:"text-[13px] leading-none",children:n.reposts_count})]}),s&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-[5]",onClick:h=>{h.stopPropagation(),P(!1)}}),e.jsxs("div",{className:`absolute left-0 bottom-full mb-2 rounded-xl shadow-2xl z-10 min-w-[140px] overflow-hidden ${m?"bg-white border border-gray-200":"bg-black border border-[#2f3336]"}`,children:[e.jsxs("button",{onClick:h=>{h.stopPropagation(),P(!1),ne()},className:`w-full text-left px-4 py-3 flex items-center gap-3 transition-colors text-[15px] font-bold ${m?"text-gray-900 hover:bg-gray-100":"text-[#e7e9ea] hover:bg-white/5"}`,children:[e.jsx(Se,{className:"w-[18px] h-[18px]"}),e.jsx("span",{children:"Repost"})]}),e.jsxs("button",{onClick:h=>{h.stopPropagation(),P(!1),i(n)},className:`w-full text-left px-4 py-3 flex items-center gap-3 transition-colors text-[15px] font-bold ${m?"text-gray-900 hover:bg-gray-100":"text-[#e7e9ea] hover:bg-white/5"}`,children:[e.jsx(ps,{className:"w-[18px] h-[18px]"}),e.jsx("span",{children:"Quote"})]})]})]})]}),e.jsx("div",{className:"flex-1 flex items-center",children:e.jsx(cs,{isLiked:f,likesCount:n.likes_count,disabled:!I,onLike:$})}),e.jsxs("div",{className:"flex items-center gap-0.5 flex-shrink-0",children:[Le&&C&&x&&x>=.01&&e.jsxs("button",{onClick:()=>{te.current&&clearTimeout(te.current),q(!0),te.current=setTimeout(()=>q(!1),500),K?.(n)},className:"group flex items-center gap-0 text-emerald-500 hover:text-emerald-400 transition-colors flex-shrink-0",title:`Quick tip $${x<1?x.toFixed(2):x}`,children:[e.jsxs("div",{className:"p-1.5 rounded-full group-hover:bg-emerald-500/10 transition-colors relative opacity-70 group-hover:opacity-100",children:[Te&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"zap-flash"}),e.jsx("span",{className:"zap-bolt",style:{"--bolt-angle":"0deg"}}),e.jsx("span",{className:"zap-bolt",style:{"--bolt-angle":"90deg"}}),e.jsx("span",{className:"zap-bolt",style:{"--bolt-angle":"180deg"}}),e.jsx("span",{className:"zap-bolt",style:{"--bolt-angle":"270deg"}})]}),e.jsx(hs,{className:`w-[14px] h-[14px] xs:w-[16px] xs:h-[16px] relative z-[1] ${Te?"zap-icon-pop f
3ill-current":""}`})]}),e.jsxs("span",{className:"text-[11px] xs:text-[12px] leading-none font-medium whitespace-nowrap -ml-1",children:["$",x<1?x.toFixed(2):x]})]}),Le&&e.jsx("button",{onClick:()=>be?.(n),className:"group flex items-center gap-0 text-gray-500 hover:text-[#00ba7c] transition-colors flex-shrink-0",title:"Send tip",children:e.jsx("div",{className:"p-1.5 rounded-full group-hover:bg-[#00ba7c]/10 transition-colors",children:e.jsx(fs,{className:"w-[18px] h-[18px]"})})}),e.jsx("button",{onClick:async()=>{if(T){L(null),O(!1);return}if(Ce){O(!1);return}B(!0);const h=navigator.language?.split("-")[0]||"en";try{const N=await $e(n.content,h);L(N)}catch(N){N.message==="same_language"&&O(!0)}B(!1)},disabled:we,className:`hidden md:flex group p-1.5 rounded-full transition-colors ${T?"text-[#1d9bf0]":m?"text-gray-400 hover:text-sky-500 hover:bg-sky-50":"text-gray-500 hover:text-[#1d9bf0] hover:bg-[#1d9bf0]/10"} ${we?"opacity-50 cursor-wait":""}`,title:T?"Show original":"Translate",children:we?e.jsx(fe,{className:"w-[18px] h-[18px] animate-spin"}):e.jsx(Xe,{className:"w-[18px] h-[18px]"})}),e.jsxs("div",{className:"relative",children:[e.jsx("button",{onClick:()=>E(!A),className:`group p-1.5 rounded-full transition-colors ${m?"text-gray-400 hover:bg-gray-100":"text-gray-500 hover:bg-white/10"}`,title:"More",children:e.jsx(gs,{className:"w-[18px] h-[18px]"})}),A&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-[5]",onClick:()=>E(!1)}),e.jsxs("div",{className:`absolute right-0 bottom-full mb-2 rounded-xl shadow-2xl z-10 min-w-[150px] overflow-hidden ${m?"bg-white border border-gray-200":"bg-black border border-[#2f3336]"}`,children:[e.jsxs("button",{onClick:async()=>{if(E(!1),T){L(null);return}B(!0);const h=navigator.language?.split("-")[0]||"en";try{const N=await $e(n.content,h);L(N)}catch(N){N.message==="same_language"&&O(!0)}B(!1)},className:`w-full text-left px-4 py-2.5 flex items-center gap-3 transition-colors text-sm ${T?m?"text-blue-600":"text-[#1d9bf0]":m?"text-gray-700 hover:bg-gray-100":"text-[#e7e9ea] hover:bg-white/5"}`,children:[e.jsx(Xe,{className:"w-4 h-4"}),e.jsx("span",{children:T?"Show original":"Translate"})]}),e.jsxs("button",{onClick:async()=>{E(!1),await _t(`${window.location.origin}/post/${n.id}`)},className:`w-full text-left px-4 py-2.5 flex items-center gap-3 transition-colors text-sm ${m?"text-gray-700 hover:bg-gray-100":"text-[#e7e9ea] hover:bg-white/5"}`,children:[e.jsx(bs,{className:"w-4 h-4"}),e.jsx("span",{children:"Bookmark"})]}),e.jsxs("button",{onClick:async()=>{E(!1),await _t(`${window.location.origin}/post/${n.id}`)},className:`w-full text-left px-4 py-2.5 flex items-center gap-3 transition-colors text-sm ${m?"text-gray-700 hover:bg-gray-100":"text-[#e7e9ea] hover:bg-white/5"}`,children:[e.jsx(ws,{className:"w-4 h-4"}),e.jsx("span",{children:"Copy link"})]})]})]})]})]})]})]})]})})}export{fr 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.