1import{j as e,_ as xe}from"./three-vendor-CwHCqgiE.js";import{a as o,O as ue,Z as Q,a5 as pe,U as me,N as he,aW as be,aX as ge,au as fe,d as Y,Y as we,m as je,L as P,aY as ve,b as ee,aI as ie,ad as H,J,X as ye,W as Ne,aG as ke,y as Ce}from"./ui-vendor-DZKZzj9B.js";import{d as E,C as W,i as O,aW as ne,aX as Se,aT as se,aY as q,aZ as ze,a_ as Ie,T as oe,u as Ee,n as Re,a$ as Ae,b0 as Te,j as $,P as De,b1 as B}from"./index-BNIIfNKd.js";import{a5 as ae,G as X,X as _e,w as Oe,y as Le,A as Ue,x as Fe}from"./firebase-vendor-C7BnWFiW.js";import{O as K}from"./opportunityClient-DDS9Uy2Z.js";import"./react-vendor-D2XMRl9g.js";const Me={createCollection:async(t,a)=>{if(!E||W)return{id:`local_${Date.now()}`,title:t,coverUrl:a,itemCount:0,createdAt:Date.now()};const x=O.getActiveUserId();if(!x)return null;try{return{id:(await ae(X(E,`profiles/${x}/collections`),{title:t,coverUrl:a||null,itemCount:0,createdAt:Date.now()})).id,title:t,coverUrl:a,itemCount:0,createdAt:Date.now()}}catch{return{id:`local_${Date.now()}`,title:t,coverUrl:a,itemCount:0,createdAt:Date.now()}}},getCollections:async t=>{if(!E||W)return re(t);try{const a=Le(X(E,`profiles/${t}/collections`),Ue("createdAt","desc"));return(await Fe(a)).docs.map(p=>({id:p.id,authorId:t,...p.data()}))}catch(a){return a.code==="permission-denied"||a.code==="unavailable"?re(t):(console.warn("Fetch collections failed",a),[])}},getTrendingCollections:async()=>[],deleteCollection:async t=>{if(!E||W)return;const a=O.getActiveUserId();if(a)try{await _e(Oe(E,`profiles/${a}/collections`,t))}catch{}},addItemToCollection:async(t,a)=>{if(!E||W)return;const x=O.getActiveUserId();if(x)try{await ae(X(E,`profiles/${x}/collections/${t}/items`),{postId:a,addedAt:Date.now()})}catch{}}};function re(t){const a=O.getActiveUserId();return t===a?[{id:"mc1",title:"My Favorites",itemCount:3,createdAt:Date.now(),authorId:t,coverUrl:"https://images.unsplash.com/photo-1550684848-fac1c5b4e853?q=80&w=800"},{id:"mc2",title:"Watch Later",itemCount:1,createdAt:Date.now()-1e4,authorId:t}]:[]}class Pe{appearances=new Map;limit=2;canInclude(a){return(this.appearances.get(a)||0)<this.limit}register(a){this.appearances.set(a,(this.appearances.get(a)||0)+1)}}const We={getDiscoverySnapshot:async t=>{const a=new Pe,x=[],p=Date.now(),[b,k,y]=await Promise.all([ne.getSuggestedCreators(),Me.getTrendingCollections(),Se.getFeed(void 0,20,"for_you")]),g=b.filter(s=>{const d=se.getOperatorProfile(s.userId);return d.tier===q.SOVEREIGN||d.reputationIndex>=80}),c=[];for(const s of g)if(a.canInclude(s.userId)&&(c.push({id:s.userId,type:"CREATOR",data:{...s,isGold:!0}}),a.register(s.userId)),c.length>=6)break;c.length>0&&x.push({id:"rail_pow_gold",type:"POW_GOLD",title:"Gold Tier Architects",items:c});const m=[];for(const s of k)s.authorId&&a.register(s.authorId),m.push({id:s.id,type:"COLLECTION",data:s});m.length>0&&x.push({id:"rail_trending_collections",type:"TRENDING_COLLECTIONS",title:"Trending Curations",items:m});const r=[];for(const s of y.items)if(a.canInclude(s.authorId)&&(r.push({id:s.id,type:"POST",data:s}),a.register(s.authorId)),r.length>=5)break;r.length>0&&x.push({id:"rail_weekly_prompt",type:"WEEKLY_PROMPT",title:"Recent Signals",items:r});const w=[...b].sort((s,d)=>d.reputationIndex-s.reputationIndex),l=[],n=w.slice(0,10);for(let s=0;s<n.length;s++){const d=n[s];if(l.push({id:d.userId,type:"CREATOR",data:{...d,todayEarnings:0}}),l.length>=5)break}l.sort((s,d)=>{const u=s.data.reputationIndex||0;return(d.data.reputationIndex||0)-u}),l.length>0&&x.push({id:"rail_top_earners",type:"TOP_EARNERS",title:"Top Creators",items:l});const i=b.filter(s=>{const d=se.getOperatorProfile(s.userId);return d.tier!==q.SOVEREIGN&&d.tier!==q.ARCHITECT}),h=[];i.slice(0,20).forEach(s=>{const d=s.reputationIndex*.3;a.canInclude(s.userId)&&(h.push({id:s.userId,type:"CREATOR",data:{...s,todayEarnings:0,velocityScore:d}}),a.register(s.userId))}),h.sort((s,d)=>{const u=s.data.velocityScore||0,v=d.data.velocityScore||0;return v!==u?v-u:s.id.localeCompare(d.id)});const j=h.slice(0,6);return j.length>0&&x.push({id:"rail_rising",type:"RISING_CREATORS",title:"Rising Signals",items:j}),{rails:x,generatedAt:Date.now(),ttlMs:600*1e3,debug:{duration:Date.now()-p,railCount:x.length}}}},$e=({profile:t,isGold:a,earnings:x,rank:p,isFollowing:b,onNavigateToProfile:k,onFollow:y})=>{const g=t.userId||t.id;return e.jsxs("div",{className:"min-w-[140px] w-[140px] p-3 rounded-lg bg-zinc-900 border border-white/5 hover:border-white/10 transition-all group relative overflow-hidden",style:{cursor:g?"pointer":"default"},onClick:()=>g&&k?.(g),children:[p&&p<=3&&e.jsxs("div",{className:`absolute top-0 left-0 px-2 py-1 rounded-br-lg text-[10px] font-black z-20 shadow-lg 2 ${p===1?"bg-gold text-black":p===2?"bg-zinc-300 text-black":"bg-orange-700 text-white"}`,children:["#",p]}),a&&e.jsx("div",{className:"absolute top-0 right-0 w-8 h-8 bg-gold/10 blur-xl rounded-full"}),e.jsxs("div",{className:"flex flex-col items-center text-center gap-2",children:[e.jsx("div",{className:`w-12 h-12 rounded-full overflow-hidden border-2 ${a?"border-gold":"border-white/10"} group-hover:scale-105 transition-transform bg-zinc-800 flex items-center justify-center`,children:t.avatarUrl||t.photoUrl?e.jsx("img",{src:t.avatarUrl||t.photoUrl,alt:t.displayName,className:"w-full h-full object-cover",loading:"lazy"}):e.jsx("span",{className:"text-base font-bold text-zinc-500",children:(t.displayName?.[0]??"?").toUpperCase()})}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-bold text-white truncate w-full max-w-[110px]",children:t.displayName}),e.jsxs("div",{className:"text-[9px] text-zinc-500 font-mono mt-0.5",children:[t.followerCount," Followers"]})]}),x?e.jsxs("div",{className:"mt-2 text-[10px] font-bold text-signal bg-signal/5 px-2 py-0.5 rounded border border-signal/20",children:[x," REP"]}):b?e.jsxs("button",{disabled:!0,className:"mt-2 w-full py-1 text-[9px] font-bold uppercase tracking-wider bg-arc-blue/15 text-arc-blue rounded border border-arc-blue/30 flex items-center justify-center gap-1 cursor-default",children:[e.jsx(he,{size:10})," Following"]}):e.jsxs("button",{onClick:c=>{c.stopPropagation(),y?.(g)},className:"mt-2 w-full py-1 text-[9px] font-bold uppercase tracking-wider bg-white/5 hover:bg-white text-white hover:text-black rounded transition-colors flex items-center justify-center gap-1",children:[e.jsx(be,{size:10})," Follow"]})]})]})},Be=({collection:t})=>e.jsxs("div",{className:"min-w-[200px] w-[200px] group cursor-pointer",role:"button",tabIndex:0,onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&a.currentTarget.click()},children:[e.jsxs("div",{className:"aspect-video bg-zinc-800 rounded-lg overflow-hidden relative mb-2 border border-white/5 group-hover:border-white/20 transition-all",children:[t.coverUrl?e.jsx("img",{src:t.coverUrl,className:"w-full h-full object-cover opacity-80 group-hover:opacity-100 transition-opacity",alt:t.title,loading:"lazy"}):e.jsx("div",{className:"w-full h-full flex items-center justify-center bg-zinc-900",children:e.jsx(ge,{size:24,className:"text-zinc-700"})}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/80 to-transparent flex items-end p-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-6 h-6 rounded-full bg-black/50 border border-white/10 flex items-center justify-center backdrop-blur-sm",children:e.jsx(fe,{size:10,
2className:"text-white fill-white ml-0.5"})}),e.jsx("span",{className:"text-[9px] font-bold text-white uppercase tracking-wider",children:"Play All"})]})}),e.jsxs("div",{className:"absolute top-2 right-2 bg-black/60 px-1.5 py-0.5 rounded text-[8px] font-mono text-white",children:[t.itemCount," items"]})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-bold text-zinc-200 group-hover:text-white truncate",children:t.title}),e.jsxs("p",{className:"text-[9px] text-zinc-500",children:["by ",t.authorName||"a member"]})]})]}),Ve=({post:t,onOpenPost:a,onNavigateToProfile:x,shareFromSurface:p="discovery_rail"})=>{const[b,k]=o.useState(!1),[y,g]=o.useState(!1),c=String(t?.content??"No preview available"),m=String(t?.author??t?.authorName??"Unknown creator"),r=String(t?.authorId??t?.id??"post"),w=String(t?.id??""),l=t?.type,n=l==="LORA",i=l==="WORKFLOW",h=n||i,N=h?"":String(t?.mediaUrl??""),j=h?"":String(t?.thumbnailUrl??""),d=!h&&(l==="VIDEO"||l==="ANIMATION"||(S=>/\.(mp4|webm|mov|m4v|ogg|ogv)(?:\?|$)/i.test(S))(N)),u=j||(d?"":N),v=n?t?.loraMetadata?.sampleImagePaths?.[0]:i?t?.workflowMetadata?.sampleImagePaths?.[0]:void 0,A=typeof v=="string"&&v.length>0?v:null,T=ze(A),D=String(t?.authorAvatarUrl??t?.authorAvatar??""),C=!!(w&&r&&r!=="post"&&a),U=!!(r&&r!=="post"&&x);return e.jsxs("div",{role:C?"button":void 0,tabIndex:C?0:void 0,onClick:C?()=>a(w,r):void 0,onKeyDown:C?S=>{(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),a(w,r))}:void 0,className:`min-w-[160px] w-[160px] group ${C?"cursor-pointer":"cursor-default"} relative rounded-lg overflow-hidden aspect-[3/4] border border-white/5 hover:border-white/20 transition-all bg-zinc-900`,children:[h&&T?e.jsxs("div",{className:"relative w-full h-full",children:[e.jsx("img",{src:T,alt:"",loading:"lazy",className:"w-full h-full object-cover opacity-95 group-hover:opacity-100 transition-opacity"}),e.jsx("div",{className:"absolute left-0 right-0 bottom-0 px-2 py-1 text-[8px] font-bold uppercase tracking-[0.14em]",style:{background:"linear-gradient(to top, rgba(0,0,0,0.85), transparent)",color:n?"#E6C15A":"#67E8F9"},children:n?`${t?.loraMetadata?.baseModel??"LoRA"} · LoRA`:`${t?.workflowMetadata?.workflowFormat??"Workflow"} · Workflow`})]}):n?e.jsxs("div",{className:"w-full h-full p-3 flex flex-col items-center justify-center text-center gap-1.5",style:{background:"linear-gradient(135deg, rgba(230,193,90,0.18), rgba(5,5,5,0.92))"},children:[e.jsx(Y,{size:20,className:"text-gold"}),e.jsx("div",{className:"text-[9px] font-bold uppercase tracking-[0.16em] text-gold",children:t?.loraMetadata?.baseModel??"LoRA"}),Array.isArray(t?.loraMetadata?.triggerWords)&&t.loraMetadata.triggerWords.length>0&&e.jsx("div",{className:"text-[8px] text-zinc-300 line-clamp-2",children:t.loraMetadata.triggerWords.slice(0,3).join(", ")})]}):i?e.jsxs("div",{className:"w-full h-full p-3 flex flex-col items-center justify-center text-center gap-1.5",style:{background:"linear-gradient(135deg, rgba(103,232,249,0.18), rgba(5,5,5,0.92))"},children:[e.jsx(we,{size:20,style:{color:"#67E8F9"}}),e.jsx("div",{className:"text-[9px] font-bold uppercase tracking-[0.16em]",style:{color:"#67E8F9"},children:t?.workflowMetadata?.workflowFormat??"Workflow"}),Array.isArray(t?.workflowMetadata?.requiredModels)&&t.workflowMetadata.requiredModels.length>0&&e.jsx("div",{className:"text-[8px] text-zinc-300 line-clamp-2",children:t.workflowMetadata.requiredModels.slice(0,2).join(", ")})]}):u&&!y?e.jsx("img",{src:u,className:"w-full h-full object-cover opacity-90 group-hover:opacity-100 transition-opacity",alt:"",loading:"lazy",onError:()=>g(!0)}):e.jsx("div",{className:"w-full h-full bg-zinc-900 p-4 flex items-center justify-center text-center",children:e.jsxs("span",{className:"text-[10px] text-zinc-400 font-serif italic",children:['"',c.substring(0,50),'..."']})}),e.jsxs("div",{className:"absolute inset-0 bg-gradient-to-b from-transparent via-transparent to-black/90 p-3 flex flex-col justify-end",children:[e.jsx("h4",{className:"text-[10px] font-bold text-white line-clamp-2 leading-tight mb-2",children:c}),e.jsx("div",{className:"flex items-center gap-2 mt-1",children:e.jsxs("button",{type:"button",onClick:U?S=>{S.stopPropagation(),x(r)}:void 0,disabled:!U,className:"flex items-center gap-2 min-w-0 flex-1 text-left disabled:cursor-default cursor-pointer","aria-label":U?`View ${m}'s profile`:m,children:[e.jsx("div",{className:"w-4 h-4 rounded-full bg-zinc-800 overflow-hidden shrink-0 flex items-center justify-center",children:D?e.jsx("img",{src:D,className:"w-full h-full object-cover",alt:m,loading:"lazy"}):e.jsx("span",{className:"text-[8px] font-bold text-zinc-500",children:(m?.[0]??"?").toUpperCase()})}),e.jsx("span",{className:"text-[9px] text-zinc-400 truncate flex-1",children:m})]})})]}),(t?.signalScore??0)!==85&&e.jsxs("div",{className:"absolute top-2 right-2 flex items-center gap-1 bg-black/40 px-1.5 py-0.5 rounded backdrop-blur-sm border border-white/5",children:[e.jsx(Q,{size:8,className:"text-white/40"}),e.jsx("span",{className:"text-[8px] font-bold text-white/60",children:t.signalScore})]}),w&&e.jsx("button",{type:"button","aria-label":`Share ${m}'s signal`,onClick:S=>{S.stopPropagation(),k(!0)},className:"absolute top-2 left-2 flex items-center justify-center rounded-full bg-black/45 backdrop-blur-sm border border-white/10 hover:bg-black/70 hover:border-white/25 transition-colors",style:{width:22,height:22},children:e.jsx(je,{size:11,className:"text-white/70"})}),b&&w&&e.jsx(Ie,{isOpen:b,onClose:()=>k(!1),signalId:w,shortId:t?.shortId,signalTitle:t?.title||c,creatorName:m,fromSurface:p})]})},Ge=()=>e.jsxs("div",{className:"py-6 border-b border-white/5",children:[e.jsx("div",{className:"px-6 md:px-10 mb-4 flex items-end justify-between",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"h-4 w-32 bg-zinc-800 rounded animate-pulse"}),e.jsx("div",{className:"h-3 w-48 bg-zinc-900 rounded animate-pulse"})]})}),e.jsx("div",{className:"overflow-hidden px-6 md:px-10 flex gap-4",children:[1,2,3,4].map(t=>e.jsx("div",{className:"min-w-[140px] h-[180px] bg-zinc-900 rounded-lg animate-pulse border border-white/5"},t))})]}),V=({rail:t,loading:a,showRank:x,onNavigateToProfile:p,onFollow:b,onOpenPost:k})=>{const y=O.getActiveUserId(),[g,c]=o.useState(new Set),[m,r]=o.useState(null),w=l=>{if(!(!l||g.has(l))){if(c(n=>{const i=new Set(n);return i.add(l),i}),b){b(l),r("Following"),setTimeout(()=>r(n=>n==="Following"?null:n),1800);return}ne.followUser(l).then(n=>
2{n.ok&&n.isFollowing?(r("Following"),setTimeout(()=>r(i=>i==="Following"?null:i),1800)):(c(i=>{const h=new Set(i);return h.delete(l),h}),r("Could not follow â try again"),setTimeout(()=>r(i=>i==="Could not follow â try again"?null:i),2400))}).catch(()=>{c(n=>{const i=new Set(n);return i.delete(l),i}),r("Could not follow â try again"),setTimeout(()=>r(n=>n==="Could not follow â try again"?null:n),2400)})}};return a?e.jsx(Ge,{}):!t||t.items.length===0?null:e.jsxs("div",{className:"py-6 border-b border-white/5 animate-in fade-in duration-500 relative",children:[m&&e.jsx("div",{role:"status","aria-live":"polite",className:"absolute top-2 right-6 md:right-10 z-30 px-3 py-1.5 text-[9px] font-bold uppercase tracking-wider rounded border bg-black/80 text-white border-white/20 backdrop-blur-sm",children:m}),e.jsxs("div",{className:"px-6 md:px-10 mb-4 flex items-end justify-between",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[t.type==="POW_GOLD"&&e.jsx(ue,{size:12,className:"text-gold fill-gold/20"}),t.type==="TOP_EARNERS"&&e.jsx(Q,{size:12,className:"text-signal"}),t.type==="RISING_CREATORS"&&e.jsx(pe,{size:12,className:"text-arc-blue"}),e.jsx("h3",{className:"text-sm font-bold text-white uppercase tracking-wider",children:t.title})]}),t.description&&e.jsx("p",{className:"text-[10px] text-zinc-500 font-mono",children:t.description})]}),e.jsxs("button",{className:"text-[10px] font-bold text-zinc-600 hover:text-white uppercase tracking-wider flex items-center gap-1 transition-colors",children:["View All ",e.jsx(me,{size:10})]})]}),e.jsx("div",{className:"overflow-x-auto custom-scrollbar px-6 md:px-10 pb-4",children:e.jsx("div",{className:"flex gap-4",children:t.items.map((l,n)=>{if(l.type==="CREATOR"){const i=l.data,h=x?n+1:void 0;if(i.userId===y||i.id===y)return null;const N=i.userId||i.id;return e.jsx($e,{profile:i,isGold:t.type==="POW_GOLD",earnings:i.todayEarnings??i.earnings,rank:h,isFollowing:N?g.has(N):!1,onNavigateToProfile:p,onFollow:w},l.id)}return l.type==="COLLECTION"?e.jsx(Be,{collection:l.data},l.id):l.type==="POST"?e.jsx(Ve,{post:l.data,onOpenPost:k,onNavigateToProfile:p},l.id):null})})})]})},Ye=t=>t?new Date(t).toLocaleString():"Just now",qe=t=>t.actionTarget?.surface==="PROFILE"||t.subjectType==="creator",Xe=({onOpenItem:t,onViewCreatorOpportunity:a,onSupportCreatorOpportunity:x,onViewPostOpportunity:p,onBoostOpportunity:b})=>{const[k,y]=o.useState([]),[g,c]=o.useState("idle"),[m,r]=o.useState(null),[w,l]=o.useState(null),n=o.useCallback(async()=>{c("loading"),r(null);try{const s=await K.getFeed(8);y(s.items||[]),c("success")}catch{r("Unable to load opportunities right now. Please refresh to try again."),c("failure")}},[]);o.useEffect(()=>{n()},[n]);const i=k.length>0,h=o.useMemo(()=>"Opportunities",[]),N=o.useCallback(async s=>{l(s.id),r(null);try{await K.dismiss(s.id),y(d=>d.filter(u=>
2u.id!==s.id))}catch{r("Unable to dismiss this opportunity right now.")}finally{l(null)}},[]),j=o.useCallback(async(s,d,u)=>{l(s.id),r(null);try{oe.track("alpha.opportunity_action",{action:d,subjectType:s.subjectType,signalType:s.signalType},1),u(),await K.markActed(s.id),y(v=>v.filter(A=>A.id!==s.id))}catch{r("Unable to update this opportunity right now.")}finally{l(null)}},[]);return e.jsxs("section",{className:"mb-8 rounded-2xl border border-white/10 bg-zinc-950/75 p-5 shadow-[0_24px_80px_rgba(0,0,0,0.35)]",children:[e.jsxs("div",{className:"flex flex-col gap-3 md:flex-row md:items-start md:justify-between",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 text-[11px] font-bold uppercase tracking-[0.28em] text-cyan-400",children:[e.jsx(Y,{size:14}),"ArcVelvet Opportunities"]}),e.jsx("h2",{className:"mt-2 text-xl font-semibold text-white",children:h})]}),e.jsxs("button",{onClick:()=>{n()},disabled:g==="loading",className:"inline-flex items-center gap-2 rounded-full border border-white/10 bg-white/5 px-4 py-2 text-xs font-semibold uppercase tracking-[0.22em] text-white transition hover:border-white/20 hover:bg-white/10 disabled:opacity-60",children:[g==="loading"?e.jsx(P,{size:14,className:"animate-spin"}):e.jsx(ve,{size:14}),"Refresh"]})]}),m?e.jsxs("div",{className:"mt-4 flex items-center gap-2 rounded-xl border border-red-500/30 bg-red-500/10 px-4 py-3 text-sm text-red-200",children:[e.jsx(ee,{size:16}),e.jsx("span",{children:m})]}):null,g==="loading"?e.jsxs("div",{className:"mt-6 flex items-center justify-center gap-2 rounded-2xl border border-white/10 bg-black/20 px-4 py-12 text-sm text-zinc-500",children:[e.jsx(P,{size:16,className:"animate-spin"}),"Loading current opportunities..."]}):i?e.jsx("div",{className:"mt-6 space-y-4",children:k.map((s,d)=>{const u=w===s.id,v=qe(s),A=()=>{if(a){a(s);return}t?.(s)},T=()=>{if(x){x(s);return}t?.(s)},D=()=>{if(p){p(s);return}t?.(s)},C=()=>{if(b){b(s);return}t?.(s)};return e.jsx("article",{className:"rounded-2xl border border-white/10 bg-black/25 p-4",children:e.jsxs("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between",children:[e.jsxs("div",{className:"flex gap-4",children:[s.imageUrl?e.jsx("img",{src:s.imageUrl,alt:s.title,className:"hidden h-24 w-24 rounded-xl object-cover sm:block",loading:"lazy"}):s.avatarUrl?e.jsx("img",{src:s.avatarUrl,alt:s.subjectName||s.title,className:"hidden h-16 w-16 rounded-full object-cover sm:block",loading:"lazy"}):null,e.jsxs("div",{children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"rounded-full border border-cyan-400/20 bg-cyan-400/10 px-2.5 py-1 text-[10px] font-semibold uppercase tracking-[0.22em] text-cyan-200",children:s.label}),d===0?e.jsx("span",{className:"rounded-full border border-emerald-500/20 bg-emerald-500/10 px-2.5 py-1 text-[10px] font-semibold uppercase tracking-[0.22em] text-emerald-200",children:"Start here"}):null,e.jsxs("span",{className:"signal-pulse rounded-full border border-white/10 px-2.5 py-1 text-[10px] uppercase tracking-[0.22em] text-zinc-300",children:["Opportunity signal ",Math.round(s.score*100),"%"]})]}),e.jsx("h3",{className:"mt-3 text-lg font-semibold text-white",children:s.title}),e.jsx("p",{className:"mt-2 max-w-2xl text-sm text-zinc-400",children:s.reasonText}),e.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-3 text-xs text-zinc-500",children:[e.jsxs("span",{children:["Updated ",Ye(s.emittedAt)]}),s.supportingMetricLabel&&typeof s.supportingMetricValue=="number"?e.jsxs("span",{children:[s.supportingMetricLabel,": ",e.jsx("span",{className:"text-zinc-300",children:s.supportingMetricValue.toLocaleString()})]}):null,s.subjectName?e.jsxs("span",{children:["Subject: ",e.jsx("span",{className:"text-zinc-300",children:s.subjectName})]}):null]})]})]}),e.jsxs("div",{className:"flex flex-col gap-2 lg:min-w-[180px] lg:items-end",children:[v?e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>{j(s,"view_creator",A)},disabled:u,className:"inline-flex items-center justify-center gap-2 rounded-full bg-white px-4 py-2 text-xs font-semibold uppercase tracking-[0.22em] text-black transition hover:bg-zinc-200 disabled:opacity-60",children:[u?e.jsx(P,{size:14,className:"animate-spin"}):e.jsx(ie,{size:14}),"View Creator"]}),e.jsxs("button",{onClick:()=>{j(s,"support_creator",T)},disabled:u,className:"inline-flex items-center justify-center gap-2 rounded-full border border-gold/30 bg-gold/10 px-4 py-2 text-xs font-semibold uppercase tracking-[0.22em] text-gold transition hover:border-gold/50 hover:bg-gold/20 disabled:opacity-60",children:[e.jsx(Y,{size:14}),"Support Creator"]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>{j(s,"view_post",D)},disabled:u,className:"inline-flex items-center justify-center gap-2 rounded-full bg-white px-4 py-2 text-xs font-semibold uppercase tracking-[0.22em] text-black transition hover:bg-zinc-200 disabled:opacity-60",children:[u?e.jsx(P,{size:14,className:"animate-spin"}):e.jsx(H,{size:14}),"View Post"]}),e.jsxs("button",{onClick:()=>{j(s,"boost_post",C)},disabled:u,className:"inline-flex items-center justify-center gap-2 rounded-full border border-arc-purple/30 bg-arc-purple/10 px-4 py-2 text-xs font-semibold uppercase tracking-[0.22em] text-arc-purple transition hover:border-arc-purple/50 hover:bg-arc-purple/20 disabled:opacity-60",children:[e.jsx(J,{size:14}),"Boost Post"]})]}),e.jsxs("button",{onClick:()=>{N(s)},disabled:u,className:"inline-flex items-center justify-center gap-2 rounded-full border border-white/10 bg-white/5 px-4 py-2 text-xs font-semibold uppercase tracking-[0.22em] text-zinc-300 transition hover:border-white/20 hover:bg-white/10 disabled:opacity-60",children:[e.jsx(ye,{size:14}),"Dismiss"]})]})]})},s.id)})}):e.jsx("div",{className:"mt-6 rounded-2xl border border-dashed border-white/10 bg-black/20 px-4 py-12 text-center text-sm text-zinc-500",children:"No active opportunities"})]})},G=t=>
2`${Number(t||0).toLocaleString()} ${De}`,Z=t=>t?new Date(t).toLocaleString():"No activity yet",le=t=>t.actionTarget?.surface==="PROFILE"||t.subjectType==="creator";B.VAULT,B.PROFILE,B.EXPLORE,B.FEED;const Ke=t=>{const a=String(t||"").toLowerCase();return a.includes("rising")||a.includes("increasing")||a.includes("emerging")?"border-emerald-500/20 bg-emerald-500/10 text-emerald-100":a.includes("steady")?"border-cyan-400/20 bg-cyan-400/10 text-cyan-100":"border-amber-400/20 bg-amber-400/10 text-amber-100"},Ze=({onOpenOpportunity:t,onViewCreatorOpportunity:a,onSupportCreatorOpportunity:x,onViewPostOpportunity:p,onBoostOpportunity:b,onOpenWallet:k,onOpenProfile:y,onOpenFeed:g})=>{Ee("wallet-balance-panel","DailyCheckDashboard");const[c,m]=o.useState(null),[r,w]=o.useState(null),[l,n]=o.useState(null),[i,h]=o.useState([]),[N,j]=o.useState("idle"),[s,d]=o.useState(null),[u,v]=o.useState(null),[A,T]=o.useState(!1);o.useEffect(()=>{const f=O.getActiveUserId();if(!f||!E)return;let z=!1,I;return(async()=>{const{doc:R,onSnapshot:F}=await xe(async()=>{const{doc:_,onSnapshot:L}=await import("./firebase-vendor-C7BnWFiW.js").then(M=>M.M);return{doc:_,onSnapshot:L}},[]);z||(I=F(R(E,"wallet_rollups",f),_=>{if(z||!_.exists())return;const L=_.data();v(Number(L?.balances?.AEYES??L?.balances?.AEYE??0)||0),T(!1)},_=>{Re("DailyCheckDashboard.balance",_,{path:"wallet_rollups"}),T(!0)}))})(),()=>{z=!0,I&&I()}},[]),o.useEffect(()=>{const f=Ae(I=>v(Number(I)||0)),z=Te(I=>v(R=>R===null?R:R+Number(I||0)));return()=>{f(),z()}},[]);const D=o.useCallback(async()=>{j("loading"),d(null);const f=await Promise.allSettled([$.getWalletSummary(),$.getMomentumSummary(),$.getCreatorEarningsSummary(),$.getOpportunityFeed({limit:4})]),[z,I,R,F]=f;if([z,I,F].filter(M=>M.status==="rejected").length===3){m(null),w(null),n(null),h([]),d("Unable to load your dashboard right now. Please refresh to try again."),j("failure");return}m(z.status==="fulfilled"?z.value:null),w(I.status==="fulfilled"?I.value:null),n(R.status==="fulfilled"?R.value:null),h(F.status==="fulfilled"?F.value.items||[]:[]);const L=f.some(M=>M.status==="rejected");d(L?"Some sections are temporarily unavailable. Confirmed data shown here is still current.":null),j("success")},[]);o.useEffect(()=>{oe.track("alpha.dashboard_open",{surface:"EXPLORE"},1),D()},[D]);const C=o.useMemo(()=>i.slice(0,3),[i]),U=u??c?.availableBalance??c?.balance??0,S=l?.totalEarned??0,ce=l?.supporterCount??0,de=l?.contentUnlockCount??0;c?.transactionCount;const te=C[0]||i[0]||null;return te&&le(te),e.jsxs("section",{className:"rounded-[28px] border border-white/10 bg-black/80 p-5 shadow-[0_24px_80px_rgba(0,0,0,0.38)] md:p-6",children:[s?e.jsxs("div",{className:`mt-4 flex items-start gap-2 rounded-2xl px-4 py-3 text-sm ${N==="failure"?"border border-red-500/30 bg-red-500/10 text-red-200":"border border-amber-500/20 bg-amber-500/10 text-amber-100"}`,children:[e.jsx(ee,{size:16,className:"mt-0.5 shrink-0"}),e.jsx("span",{children:s})]}):null,N==="loading"&&!c&&!r&&i.length===0?e.jsx("div",{className:"mt-6 grid gap-4 lg:grid-cols-[1.4fr_1fr]",children:e.jsx("div",{className:"rounded-2xl border border-white/10 bg-white/5 p-6 text-sm text-zinc-400",children:e.jsx("div",{className:"flex items-center gap-2 text-white",children:e.jsx("div",{style:{height:16,borderRadius:8,background:"rgba(255,255,255,0.06)",animation:"pulse 1.5s ease-in-out infinite",width:"60%"}})})})}):N==="failure"?e.jsx("div",{className:"mt-6 rounded-2xl border border-dashed border-white/10 bg-black/20 px-5 py-12 text-center text-sm text-zinc-500",children:"ArcVelvet could not load the daily check right now. Refresh to reconnect."}):e.jsxs("div",{className:"mt-6 space-y-6",children:[e.jsxs("div",{className:"grid gap-4 xl:grid-cols-[1.2fr_0.8fr]",children:[e.jsxs("div",{className:"rounded-2xl border border-white/[0.08] bg-white/[0.03] p-5",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[9px] font-bold uppercase tracking-[0.18em] text-white/25",children:"Ledger"}),e.jsx("div",{className:"mt-2 text-5xl font-semibold text-white",children:G(U)}),e.jsx("div",{className:"mt-1 text-sm text-white/25",children:A?"Last known â couldn't refresh":"Available now"})]}),e.jsx("div",{className:"rounded-full border border-emerald-500/20 bg-emerald-500/10 p-3 text-emerald-100",children:e.jsx(Ne,{size:18})})]}),e.jsxs("div",{className:"mt-5 grid gap-3 md:grid-cols-3",children:[e.jsxs("div",{className:"rounded-xl bg-black/20 p-3",children:[e.jsx("div",{className:"text-[9px] uppercase tracking-[0.18em] text-zinc-500",children:"Transactions"}),e.jsx("div",{className:"mt-2 text-4xl font-bold text-white",children:Number(c?.transactionCount||0).toLocaleStr
2ing()})]}),e.jsxs("div",{className:"rounded-xl bg-black/20 p-3",children:[e.jsx("div",{className:"text-[9px] uppercase tracking-[0.18em] text-zinc-500",children:"Last wallet activity"}),e.jsx("div",{className:"mt-2 text-sm font-semibold text-white",children:Z(c?.lastTransactionTimestamp||c?.lastTxAt)})]}),e.jsxs("div",{className:"rounded-xl bg-black/20 p-3",children:[e.jsx("div",{className:"text-[9px] uppercase tracking-[0.18em] text-zinc-500",children:"Pending"}),e.jsx("div",{className:"mt-2 text-4xl font-bold text-white",children:G(c?.pendingAmount)})]})]})]}),e.jsxs("div",{className:"rounded-2xl border border-white/10 bg-black/25 p-5",children:[e.jsxs("div",{className:"flex items-center gap-2 text-[9px] font-bold uppercase tracking-[0.18em] text-white/40",children:[e.jsx(J,{size:14}),"Momentum"]}),e.jsx("div",{className:`mt-3 inline-flex rounded-full border px-2.5 py-1 text-[10px] font-semibold uppercase tracking-[0.22em] ${Ke(r?.momentumLabel)}`,children:r?.momentumLabel||"No movement yet"}),e.jsxs("div",{className:"mt-4 text-sm text-zinc-300",children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",borderBottom:"1px solid rgba(255,255,255,0.06)",paddingBottom:"12px",paddingTop:"12px"},children:[e.jsx("span",{className:"text-4xl font-bold text-white",children:r?.currentWindow.supportEvents??0}),e.jsx("span",{className:"text-[9px] tracking-[0.18em] uppercase text-white/25",children:"Signal Events"})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",borderBottom:"1px solid rgba(255,255,255,0.06)",paddingBottom:"12px",paddingTop:"12px"},children:[e.jsx("span",{className:"text-4xl font-bold text-white",children:r?.currentWindow.unlockCount??0}),e.jsx("span",{className:"text-[9px] tracking-[0.18em] uppercase text-white/25",children:"Unlocks"})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",paddingBottom:"12px",paddingTop:"12px"},children:[e.jsx("span",{className:"text-4xl font-bold text-white",children:r?.activeOpportunityCount??i.length}),e.jsx("span",{className:"text-[9px] tracking-[0.18em] uppercase text-white/25",children:"Active Ops"})]}),e.jsxs("div",{className:"flex items-center justify-between gap-4",style:{borderTop:"1px solid rgba(255,255,255,0.06)",paddingTop:"12px",paddingBottom:"4px"},children:[e.jsx("span",{children:"Last recorded activity"}),e.jsx("span",{className:"text-right text-2xl font-bold text-white",children:Z(r?.lastActivityAt||c?.lastTransactionTimestamp||c?.lastTxAt)})]})]})]})]}),e.jsxs("div",{className:"grid gap-4 xl:grid-cols-[1.1fr_0.9fr]",children:[e.jsxs("div",{className:"rounded-2xl border border-white/10 bg-black/25 p-5",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{children:e.jsxs("div",{className:"flex items-center gap-2 text-[9px] font-bold uppercase tracking-[0.18em] text-white/40",children:[e.jsx(Q,{size:14}),"Signal Ops"]})}),e.jsxs("button",{onClick:g,className:"inline-flex items-center gap-2 rounded-full border border-white/10 bg-white/5 px-4 py-2 text-[11px] font-semibold uppercase tracking-[0.22em] text-zinc-200 transition hover:border-white/20 hover:bg-white/10",children:["Enter Sky",e.
2jsx(H,{size:13})]})]}),C.length===0?e.jsx("div",{className:"mt-5 rounded-2xl border border-dashed border-white/10 bg-black/20 px-4 py-10 text-center text-sm text-zinc-500",children:"No active ops"}):e.jsx("div",{className:"mt-5 space-y-3",children:C.map(f=>{const z=le(f);return e.jsxs("div",{className:"rounded-2xl border border-white/10 bg-white/5 p-4",children:[e.jsxs("button",{onClick:()=>t?.(f),className:"w-full text-left",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"rounded-full border border-cyan-400/20 bg-cyan-400/10 px-2.5 py-1 text-[10px] font-semibold uppercase tracking-[0.22em] text-cyan-100",children:f.label}),e.jsxs("span",{className:"text-[9px] uppercase tracking-[0.18em] text-zinc-500",children:["Updated ",Z(f.emittedAt)]})]}),e.jsx("div",{className:"mt-3 text-base font-semibold text-white",children:f.title}),e.jsx("div",{className:"mt-2 text-sm text-zinc-400",children:f.reasonText})]}),e.jsx("div",{className:"mt-4 flex flex-wrap gap-2",children:z?e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>a?.(f),className:"inline-flex items-center gap-2 rounded-full bg-white px-4 py-2 text-xs font-semibold uppercase tracking-[0.22em] text-black transition hover:bg-zinc-200",children:[e.jsx(ie,{size:13}),"View Creator"]}),e.jsxs("button",{onClick:()=>x?.(f),className:"inline-flex items-center gap-2 rounded-full border border-gold/30 bg-gold/10 px-4 py-2 text-xs font-semibold uppercase tracking-[0.22em] text-gold transition hover:border-gold/50 hover:bg-gold/20",children:[e.jsx(Y,{size:13}),"Support Creator"]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>p?.(f),className:"inline-flex items-center gap-2 rounded-full bg-white px-4 py-2 text-xs font-semibold uppercase tracking-[0.22em] text-black transition hover:bg-zinc-200",children:[e.jsx(H,{size:13}),"View Post"]}),e.jsxs("button",{onClick:()=>b?.(f),className:"inline-flex items-center gap-2 rounded-full border border-arc-purple/30 bg-arc-purple/10 px-4 py-2 text-xs font-semibold uppercase tracking-[0.22em] text-arc-purple transition hover:border-arc-purple/50 hover:bg-arc-purple/20",children:[e.jsx(J,{size:13}),"Boost Post"]})]})})]},f.id)})})]}),e.jsxs("div",{className:"rounded-2xl border border-white/10 bg-black/25 p-5",children:[e.jsxs("div",{className:"flex items-center gap-2 text-[9px] font-bold uppercase tracking-[0.18em] text-white/40",children:[e.jsx(ke,{size:14}),"Earned"]}),l?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mt-4 grid gap-3 sm:grid-cols-2",children:[e.jsxs("div",{className:"rounded-xl border border-white/[0.08] bg-white/[0.03] p-4",children:[e.jsx("div",{className:"text-[9px] uppercase tracking-[0.18em] text-white/25",children:"Earned"}),e.jsx("div",{className:"mt-2 text-3xl font-semibold text-white",children:G(S)})]}),e.jsxs("div",{className:"rounded-xl bg-white/5 p-4",children:[e.jsx("div",{className:"text-[9px] uppercase tracking-[0.18em] text-zinc-500",children:"Supporters"}),e.jsx("div",{className:"mt-2 text-3xl font-semibold text-white",children:ce.toLocaleString()})]}),e.jsxs("div",{className:"rounded-xl bg-white/5 p-4",children:[e.jsx("div",{className:"text-[9px] uppercase tracking-[0.18em] text-zinc-500",children:"Content unlocks"}),e.jsx("div",{className:"mt-2 text-3xl font-semibold text-white",children:de.toLocaleString()})]}),e.jsxs("div",{className:"rounded-xl bg-white/5 p-4",children:[e.jsx("div",{className:"text-[9px] uppercase tracking-[0.18em] text-zinc-500",children:"Recent creator earnings"}),e.jsx("div",{className:"mt-2 text-3xl font-semibold text-white",children:G(l.grossEarned7d)})]})]}),e.jsx("p",{className:"mt-4 text-sm text-zinc-400",children:r?.momentumReason||"Creator momentum and support changes will become clearer after more confirmed activity is recorded."})]}):null]})]})]})]})},at=({onOpenOpportunity:t,onViewCreatorOpportunity:a,onSupportCreatorOpportunity:x,onViewPostOpportunity:p,onBoostOpportunity:b,onOpenWallet:k,onOpenProfile:y,onOpenFeed:g,onNavigateToProfile:c,onOpenPost:m})=>
2{const[r,w]=o.useState(null),[l,n]=o.useState(!0),[i,h]=o.useState(null),N=o.useRef(0),j=o.useCallback(async(s=!1)=>{const d=Date.now();if(!(!s&&r&&d-N.current<15e3)){n(!0),h(null);try{const u=O.getActiveUserId(),v=await We.getDiscoverySnapshot(u);w(v),N.current=Date.now()}catch(u){console.error("Discovery Fetch Failed",u),h("Discovery rails are unavailable right now. Dashboard and opportunity data may still load.")}finally{n(!1)}}},[r]);return o.useEffect(()=>{j()},[j]),e.jsx("div",{className:"min-h-full bg-black pb-20",children:e.jsxs("div",{className:"space-y-6 px-4 pt-4 md:px-8",children:[i?e.jsxs("div",{className:"flex items-start gap-2 rounded-2xl border border-amber-500/20 bg-amber-500/10 px-4 py-3 text-sm text-amber-100",children:[e.jsx(ee,{size:16,className:"mt-0.5 shrink-0"}),e.jsx("span",{children:i})]}):null,e.jsx(Ze,{onOpenOpportunity:t,onViewCreatorOpportunity:a,onSupportCreatorOpportunity:x,onViewPostOpportunity:p,onBoostOpportunity:b,onOpenWallet:k,onOpenProfile:y,onOpenFeed:g}),e.jsx(Xe,{onOpenItem:t,onViewCreatorOpportunity:a,onSupportCreatorOpportunity:x,onViewPostOpportunity:p,onBoostOpportunity:b}),l&&!r?e.jsxs("div",{className:"space-y-4",children:[e.jsx(V,{loading:!0}),e.jsx(V,{loading:!0}),e.jsx(V,{loading:!0})]}):e.jsxs(e.Fragment,{children:[r?.rails.map(s=>e.jsx(V,{rail:s,showRank:s.type==="TOP_EARNERS"||s.type==="RISING_CREATORS",onNavigateToProfile:c,onOpenPost:m},s.id)),(!r?.rails||r.rails.length===0)&&e.jsx("div",{className:"py-20 text-center font-mono text-xs text-zinc-500",children:i?"Discovery rails could not be loaded. Try refreshing to retry.":"No discovery rails are active right now."}),e.jsx("div",{className:"flex justify-center py-12",children:e.jsxs("button",{onClick:()=>{j(!0)},disabled:l,className:"flex items-center gap-2 rounded-full border border-white/10 bg-white/5 px-6 py-3 text-xs font-bold uppercase tracking-widest text-zinc-400 transition-all hover:bg-white/10 hover:text-white disabled:opacity-50",children:[e.jsx(Ce,{size:14,className:l?"animate-spin":""}),l?"Refreshing...":"Refresh Discovery"]})})]})]})})};export{at as SurfaceDiscovery}; 3//# sourceMappingURL=SurfaceDiscovery-CUWGvxDV.js.map
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.