PageSourceSearch

https://myechoboard.com/assets/FediverseFeed-CdC7R_eT.js

js myechoboard.com collected 2026-10-02 00:19:17 UTC 30,413 bytes, 1 lines download raw bytes

1import{r as e,j as t}from"./vendor-react-BfgFmtGS.js";import{t as r}from"./app-_uSXIk0p.js";import{a,d as o}from"./vendor-query-XXY4vl9u.js";import{S as s}from"./SEOHead-CHXhs1CK.js";import{PageHeader as l}from"./PageHeader-BnvONm3p.js";import{M as n}from"./MemoryFeed-BtWuNLBH.js";import{B as i}from"./button-CYJdLL_L.js";import{I as d}from"./input-Cv-gXlbe.js";import{T as u,a as c,b as m,c as h}from"./tabs-DXUueDWs.js";import{u as p,a as f}from"./useAuth-DynbexoK.js";import{b as g}from"./useUserSettings-COWmNJt_.js";import{supabase as x}from"./supabase-client-2CObC91N.js";import{n as v}from"./exploreForYouLaneFeed-CZSWPM-R.js";import{o as w}from"./viewportLoadMoreObserver-CThDFSVJ.js";import{u as b}from"./vendor-router-QOYqHwMx.js";import{G as y}from"./globe-xPKErxGR.js";import{L as _}from"./loader-circle-fXsKc0TP.js";import{R as j}from"./refresh-cw-BjP_646P.js";import{A as N}from"./arrow-up-right-BY1AkN7o.js";import{S as k}from"./search-D_LVchoc.js";import{X as C}from"./x-DV2I6wJI.js";import{I as S}from"./image-Cz6bY_bo.js";import{A as L}from"./at-sign-DPBqSE5e.js";import{F as M}from"./file-text-B5ffPq62.js";import{U as F}from"./user-minus-C1lCRWWA.js";const $="myechoboard.com",P="echo_fediverse_following",A="echo_fediverse_following_accounts",T=[{label:"Mastodon",host:"mastodon.social",tag:"Open web"},{label:"Design",host:"mastodon.design",tag:"Design"},{label:"Hachyderm",host:"hachyderm.io",tag:"Tech"},{label:"Mastodon Art",host:"mastodon.art",tag:"Art"},{label:"Pixelfed",host:"pixelfed.social",tag:"Photography"}],E=["design","art","inspiration","photography","interiors","creative"],I=[{id:"fallback-interface-archive",title:"Brutalist interface studies",handle:"@[email protected]",authorName:"Interface Archive",source:"Mastodon",url:"https://mastodon.design/explore",description:"Dense layouts, raw typography, and useful references for sharper product surfaces.",tag:"Design",publishedAt:new Date(Date.now()-204e4).toISOString(),score:124,mediaType:"note"},{id:"fallback-tinyrooms",title:"Small-space interiors",handle:"@[email protected]",authorName:"Tiny Rooms",source:"Pixelfed",url:"https://pixelfed.social/i/web/discover",description:"Warm apartments, clever storage, and moodboard-ready room details.",tag:"Interior",publishedAt:new Date(Date.now()-54e5).toISOString(),score:88,mediaType:"note"},{id:"fallback-visualculture",title:"Daily visual prompts",handle:"@[email protected]",authorName:"Visual Culture",source:"Mastodon",url:"https://mastodon.social/explore",description:"Open-web inspiration from artists, curators, and collectors outside Echo.",tag:"Inspiration",publishedAt:new Date(Date.now()-84e5).toISOString(),score:61,mediaType:"note"}],U=e=>{if("undefined"==typeof document)return e.replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim();const t=document.createElement("template");return t.innerHTML=e,(t.content.textContent||"").replace(/\s+/g," ").trim()},D=e=>e.toLowerCase().trim().replace(/[^a-z0-9_]+/g,"_").replace(/^_+|_+$/g,"").replace(/_{2,}/g,"_")||"username",H=(e,t)=>("string"==typeof(null==e?void 0:e.spoiler_text)?e.spoiler_text.trim():"")||(t?t.length>72?`${t.slice(0,69).trim()}...`:t:"Untitled fediverse post"),q=(e,t=5)=>{const r=e.toLowerCase().replace(/#/g," ").replace(/[^a-z0-9_\s-]+/g," ").trim();if(!r)return[];const a=r.split(/\s+/).map(e=>e.replace(/-/g,"")).filter(e=>e.length>1);
1return[...new Set(a)].slice(0,t)},B=e=>`${e.title} ${e.handle} ${e.authorName} ${e.description} ${e.tag} ${e.source} ${e.sourceHost||""}`.toLowerCase(),O=e=>("image"===e.mediaType||"gif"===e.mediaType||"video"===e.mediaType)&&Boolean(e.mediaUrl||e.mediaPreviewUrl),z=e=>{if("undefined"==typeof window)return;const t=new Map;e.forEach(e=>{t.set(e.handle.toLowerCase(),e)}),window.localStorage.setItem(A,JSON.stringify([...t.values()]))},R=e=>{if(!e)return null;const t=e.split(",").find(e=>e.includes('rel="next"'));if(!t)return null;const r=t.match(/[?&](?:max_id|offset)=([^&>]+)/);return r?decodeURIComponent(r[1]):null},K=(e,t,r)=>{var a;const o=(null==e?void 0:e.account)||{},s=U(String((null==e?void 0:e.content)||"")),l=`@${(null==(a=o.acct)?void 0:a.includes("@"))?o.acct:`${o.acct||"unknown"}@${t.host}`}`,n=(Array.isArray(null==e?void 0:e.media_attachments)?e.media_attachments:[]).find(e=>["image","gifv","video"].includes(String((null==e?void 0:e.type)||""))),i=String((null==n?void 0:n.type)||""),d="video"===i?"video":"gifv"===i?"gif":"image"===i?"image":"note",u=2*Number((null==e?void 0:e.reblogs_count)||0)+Number((null==e?void 0:e.favourites_count)||0)+Number((null==e?void 0:e.replies_count)||0);return{id:`${r}-${e.id}`,statusId:String(e.id||""),title:H(e,s),handle:l,authorName:o.display_name||o.username||"Fediverse creator",s
1ource:t.label,url:e.url||o.url||`https://${t.host}`,accountUrl:o.url||null,description:s||"A public post from the open social web.",tag:t.tag,publishedAt:e.created_at||(new Date).toISOString(),score:u,mediaType:d,mediaUrl:(null==n?void 0:n.url)||(null==n?void 0:n.remote_url)||(null==n?void 0:n.preview_url)||null,mediaPreviewUrl:(null==n?void 0:n.preview_url)||(null==n?void 0:n.url)||null,accountId:"string"==typeof o.id?o.id:null,sourceHost:t.host}},Y=e=>{const t=new Map;return e.forEach(e=>{e.url&&t.set(e.url,e)}),[...t.values()]};async function J(e={},t){const a=await async function(e,t,a,o){r(o);const s=e.filter(e=>null!==t[e.host]);if(!s.length)return{posts:[],nextPageParam:null};const l=new AbortController,n=()=>l.abort(null==o?void 0:o.reason);null==o||o.addEventListener("abort",n,{once:!0});const i=setTimeout(()=>l.abort(new DOMException("Federated feed timed out","TimeoutError")),1e4);try{const e=await Promise.allSettled(s.map(e=>(async(e,t,r)=>{const a=new URLSearchParams({limit:"30"});t&&a.set("offset",t);const o=await fetch(`https://${e.host}/api/v1/trends/statuses?${a.toString()}`,{headers:{Accept:"application/json"},signal:r});if(!o.ok)throw new Error(`${e.host} returned ${o.status}`);const s=await o.json();return{nextCursor:R(o.headers.get("link")),posts:Array.isArray(s)?s.map(t=>K(t,e,e.host)):[]}})(e,t[e.host]||void 0,l.signal)));if(r(o),e.every(e=>"rejected"===e.status))throw new Error("Could not load federated posts. Please retry.");const a={...t},n=[];return e.forEach((e,r)=>{const o=s[r].host;if("rejected"===e.status)return void(a[o]=t[o]||"");n.push(...e.value.posts);const l=e.value.nextCursor;a[o]=l&&l!==t[o]?l:null}),{posts:n,nextPageParam:Object.values(a).some(e=>null!==e)?a:null}}finally{clearTimeout(i),null==o||o.removeEventListener("abort",n)}}(T,e,0,t);return{...a,posts:Y(a.posts)}}async function Q(e){const t=q(e);if(0===t.length)return[];const r=await Promise.allSettled(t.flatMap(e=>T.slice(0,4).map(async t=>{const r=await fetch(`https://${t.host}/api/v1/timelines/tag/${encodeURIComponent(e)}?limit=24`,{headers:{Accept:"application/json"}});if(!r.ok)throw new Error(`${t.host} tag search returned ${r.status}`);const a=await r.json();return Array.isArray(a)?a.map(r=>{var a;const o=(null==r?void 0:r.account)||{},s=U(String((null==r?void 0:r.content)||"")),l=`@${(null==(a=o.acct)?void 0:a.includes("@"))?o.acct:`${o.acct||"unknown"}@${t.host}`}`,n=2*Number((null==r?void 0:r.reblogs_count)||0)+Number((null==r?void 0:r.favourites_count)||0)+Number((null==r?void 0:r.replies_count)||0);return{...K(r,{...t,tag:`#${e}`},`${t.host}-tag-${e}`),handle:l,authorName:o.display_name||o.username||"Fediverse creator",description:s||"A public post from the open social web.",tag:`#${e}`,score:n}}):[]})));return Y(r.flatMap(e=>"fulfilled"===e.status?e.value:[]).flat())}const V=e=>{const t=e.mediaUrl||e.mediaPreviewUrl||null,r="video"===e.mediaType||"gif"===e.mediaType,a="image"===e.mediaType&&Boolean(t),o="untitled fediverse post"===e.title.trim().toLowerCase(),s=o?"":e.title,l=e.description||s||e.handle,n=r&&t?"video":a?"image":"note";return{id:`fediverse:${e.id}`,type:n,title:s||("note"===n?e.authorName||e.handle:null),ai_title:s||null,content:l,description:null,html_content:null,image_url:"image"===n?t:"video"===n&&e.mediaPreviewUrl||null,video_url:"video"===n?t:null,audio_url:null,source_url:e.url,ai_description:null,hearts:e.score,watch_count:0,metadata:{source:"fediverse",federated_source:e.handle,federated_handle:e.handle,federated_author_name:e.authorName,federated_description:e.description,federated_media_type:e.mediaType,federated_hide_title:o,fediverse_post_id:e.id,federated_status_id:e.statusId,federated_source_host:e.sourceHost,fediverse_original_url:e.url,source_url:e.url},created_at:e.publishedAt,user_id:null,owner_id:null,is_owner:!1,can_edit:!1,owner_username:e.handle,owner_full_name:e.authorName,source_board_name:e.handle}};function G(){var r,U,H,R,G,W,X;const Z=b(),{toast:ee}=p(),{user:te,profile:re}=f(),{settings:ae,isLoading:oe}=g(),[se,le]=e.useState(""),[ne,ie]=e.useState("for_you"),[de,ue]=e.useState("feed"),[ce,me]=e.useState(()=>(e=>{if("undefined"==typeof window)return[];try{const t=JSON.parse(window.localStorage.getItem(e)||"[]");return Array.isArray(t)?t.filter(e=>"string"==typeof e):[]}catch{return[]}})(P)),[he,pe]=e.useState(()=>(()=>
1{if("undefined"==typeof window)return[];try{const e=JSON.parse(window.localStorage.getItem(A)||"[]");return Array.isArray(e)?e.filter(e=>"string"==typeof(null==e?void 0:e.handle)&&"string"==typeof(null==e?void 0:e.accountId)&&"string"==typeof(null==e?void 0:e.sourceHost)):[]}catch{return[]}})()),[fe,ge]=e.useState({}),[xe,ve]=e.useState(18),[we,be]=e.useState(!1),ye=e.useRef(null),_e=D(String((null==re?void 0:re.username)||(null==(r=null==te?void 0:te.user_metadata)?void 0:r.username)||(null==(U=null==te?void 0:te.email)?void 0:U.split("@")[0])||"")),je=`@${_e}@${$}`,Ne=a({queryKey:["fediverse-public-board-handles",null==te?void 0:te.id],enabled:Boolean((null==te?void 0:te.id)&&ae.enable_fediverse),staleTime:6e4,queryFn:async()=>{const{data:e,error:t}=await x.from("boards").select("id, name, slug").eq("user_id",te.id).eq("is_public",!0).eq("is_hidden",!1).order("updated_at",{ascending:!1}).range(0,199);if(t)throw t;return[...new Set((e||[]).filter(e=>"string"==typeof e.name&&e.name.trim().length>0).map(e=>((e,t)=>{const r=D(e),a=t.toLowerCase().trim().replace(/[^a-z0-9_]+/g,"_").replace(/^_+|_+$/g,"").replace(/_{2,}/g,"_")||null;return a?`${r}_${a}`.slice(0,64).replace(/_+$/g,"")||r:null})(_e,e.slug||e.name)).filter(e=>Boolean(e)).map(e=>`@${e}@${$}`))]}}),ke=o({queryKey:["fediverse-public-posts"],queryFn:({pageParam:e,signal:t})=>J(e,t),initialPageParam:{},getNextPageParam:e=>e.nextPageParam,enabled:Boolean(ae.enable_fediverse),staleTime:18e4,retry:1}),Ce=a({queryKey:["fediverse-tag-search",se.trim().toLowerCase()],queryFn:()=>Q(se),enabled:Boolean(ae.enable_fediverse&&q(se).length>0),staleTime:12e4,retry:1}),Se=a({queryKey:["fediverse","algorithm-facets",null==te?void 0:te.id],enabled:Boolean((null==te?void 0:te.id)&&ae.enable_fediverse),staleTime:3e5,retry:1,queryFn:async()=>{const{data:e,error:t}=await x.rpc("get_user_algorithm_facet_scores",{p_user_id:te.id,p_recent:!1,p_group_limit:7});if(t)throw t;return r=e,Array.isArray(r)?r.map(e=>{if(!e||"object"!=typeof e)return null;const t=e,r=String(t.group_name||"");if(!["tags","styles","aesthetics","categories","moods","subjects","objects","materials"].includes(r))return null;const a=v(t.value);if(!a)return null;const o=Number(t.score||0);return{group_name:r,value:a,score:Number.isFinite(o)?Math.max(o,0):0,rank:0,source:"stable"}}).filter(e=>Boolean(e)).sort((e,t)=>t.score-e.score).map((e,t)=>({...e,rank:t+1})):[];var r}}),Le=e.useMemo(()=>(e=>{const t=e.filter(e=>e.rank>0&&e.rank<=18).flatMap(e=>q(e.value,2));return[...new Set([...t,...E])].slice(0,8)})(Se.data||[]),[Se.data]),Me=a({queryKey:["fediverse","for-you-tag-posts",Le.join("|")],queryFn:()=>Q(Le.slice(0,5).join(" ")),enabled:Boolean(ae.enable_fediverse&&Le.length>0),staleTime:24e4,retry:1}),Fe=e.useMemo(()=>{var e;return(null==(e=ke.data)?void 0:e.pages.flatMap(e=>e.posts))||[]},[null==(H=ke.data)?void 0:H.pages]),$e=e.useMemo(()=>Fe.length?Y(Fe):I,[Fe]),Pe=e.useMemo(()=>Y([...Me.data||[],...$e]),[Me.data,$e]),Ae=(null==(R=Ce.data)?void 0:R.length)?Ce.data:$e,Te=Boolean(Fe.length),Ee=(null==(G=Ne.data)?void 0:G.length)?Ne.data:[],Ie=we?Ee:Ee.slice(0,4),Ue=Math.max(0,Ee.length-4),De=e.useMemo(()=>{const e=new Map;return he.forEach(t=>{ce.some(e=>e.toLowerCase()===t.handle.toLowerCase())&&e.set(t.handle.toLowerCase(),t)}),Ae.forEach(t=>{t.accountId&&t.sourceHost&&ce.some(e=>e.toLowerCase()===t.handle.toLowerCase())&&e.set(t.handle.toLowerCase(),{handle:t.handle,accountId:t.accountId,sourceHost:t.sourceHost,authorName:t.authorName})}),[...e.values()]},[Ae,he,ce]),He=a({queryKey:["fediverse-following-posts",De.map(e=>`${e.sourceHost}:${e.accountId}`).sort().join("|")],queryFn:()=>async function(e){const t=await Promise.allSettled(e.map(async e=>{const t=T.find(t=>t.host===e.sourceHost)||{label:"Mastodon",host:e.sourceHost,tag:"Following"},r=await fetch(`https://${e.sourceHost}/api/v1/accounts/${encodeURIComponent(e.accountId)}/statuses?limit=30&exclude_reblogs=false`,{headers:{Accept:"application/json"}});if(!r.ok)throw new Error(`${e.sourceHost} account statuses returned ${r.status}`);const a=await r.json();return Array.isArray(a)?a.map(r=>({...K(r,t,`${e.sourceHost}-following-${e.accountId}`),tag:"Following"})):[]}));return Y(t.flatMap(e=>"fulfilled"===e.status?e.value:[])).sort((e,t)=>
1new Date(t.publishedAt).getTime()-new Date(e.publishedAt).getTime())}(De),enabled:Boolean(ae.enable_fediverse&&De.length>0),staleTime:12e4,retry:1});e.useEffect(()=>{const e=new Set(he.map(e=>e.handle.toLowerCase())),t=De.filter(t=>!e.has(t.handle.toLowerCase()));if(0===t.length)return;const r=[...he,...t];pe(r),z(r)},[he,De]);const qe=e.useMemo(()=>{var e;const t=se.trim().toLowerCase(),r=q(se),a=new Map;(Se.data||[]).forEach(e=>{const t=a.get(e.value)||0;a.set(e.value,Math.max(t,Math.max(1,22-(e.rank||20))+Math.min(12,e.score/3)))}),Le.forEach((e,t)=>{a.set(e,Math.max(a.get(e)||0,12-t))});const o=("following"===ne&&(null==(e=He.data)?void 0:e.length)?He.data:"for_you"===ne?Pe:Ae).filter(O).filter(e=>{var a;if(!t||0===r.length||(null==(a=Ce.data)?void 0:a.length))return!0;const o=B(e);return r.some(e=>o.includes(e))});if("following"===ne)return o.filter(e=>ce.some(t=>t.toLowerCase()===e.handle.toLowerCase()));if("for_you"===ne){const e=Date.now(),t=[...a.entries()],r=new Map;return o.forEach(a=>{const o=B(a);let s=0;t.forEach(([e,t])=>{o.includes(e)&&(s+=t)});const l=Math.max(0,(e-new Date(a.publishedAt).getTime())/36e5),n=Math.max(0,18-l/8),i=O(a)?16:0;r.set(a.id,s+n+i+Math.min(30,a.score/4))}),[...o].sort((e,t)=>(r.get(t.id)||0)-(r.get(e.id)||0))}return"discover"===ne?[...o].sort((e,t)=>new Date(t.publishedAt).getTime()-new Date(e.publishedAt).getTime()):"popular"===ne?[...o].sort((e,t)=>t.score-e.score):o},[Ae,Se.data,null==(W=Ce.data)?void 0:W.length,ce,He.data,Pe,Le,se,ne]),Be=e.useMemo(()=>qe.slice(0,xe),[xe,qe]),Oe=e.useMemo(()=>((e,t)=>{const r=new Set(t.map(e=>e.toLowerCase())),a=new Map;return e.forEach((e,t)=>{const o=e.handle.toLowerCase(),s=a.get(o),l=s&&new Date(s.latestAt).getTime()>new Date(e.publishedAt).getTime()?s.latestAt:e.publishedAt,n=((null==s?void 0:s.visualCount)||0)+(O(e)?1:0),i=((null==s?void 0:s.postCount)||0)+1,d=Math.max(0,18-Math.max(0,(Date.now()-new Date(e.publishedAt).getTime())/36e5)/8),u=r.has(o)?-12:0,c=((null==s?void 0:s.score)||0)+Math.min(28,e.score/3)+d+(O(e)?10:0)+u+Math.max(0,8-t/3);a.set(o,{handle:e.handle,authorName:e.authorName,source:e.source,sourceHost:e.sourceHost,accountUrl:e.accountUrl||(null==s?void 0:s.accountUrl)||null,samplePost:(null==s?void 0:s.samplePost)||e,samplePosts:[...(null==s?void 0:s.samplePosts)||[],e].slice(0,3),score:c,postCount:i,visualCount:n,latestAt:l})}),[...a.values()].sort((e,t)=>{const a=Number(r.has(e.handle.toLowerCase()))-Number(r.has(t.handle.toLowerCase()));return 0!==a?a:t.score-e.score})})(qe,ce),[ce,qe]),ze=e.useMemo(()=>Be.map(V),[Be]),Re=e.useCallback(e=>{var t;const r=("string"==typeof(null==(t=e.metadata)?void 0:t.fediverse_post_id)?e.metadata.fediverse_post_id:"")||e.id.replace(/^fediverse:/,"");return qe.find(e=>e.id===r)||Be.find(e=>e.id===r)||null},[Be,qe]),Ke=q(se).length>0&&Boolean(null==(X=Ce.data)?void 0:X.length),Ye=xe<qe.length||"following"!==ne&&!Ke&&Boolean(ke.hasNextPage),Je="following"===ne?He.isFetching:ke.isFetchingNextPage;e.useEffect(()=>{ve(18)},[se,de,ne]);const Qe=e.useCallback(()=>{xe<qe.length?ve(e=>Math.min(e+18,qe.length)):"following"===ne||Ke||!ke.hasNextPage||ke.isFetchingNextPage||ke.fetchNextPage()},[ke,Ke,ne,xe,qe.length]);e.useEffect(()=>{const e=ye.current;if(e&&Ye)return w(e,Qe)},[Ye,Qe]);const Ve=e=>{var t,r;me(e),t=P,r=e,"undefined"!=typeof window&&window.localStorage.setItem(t,JSON.stringify([...new Set(r)]))},Ge=e=>{pe(e),z(e)},We=e=>{ce.some(t=>t.toLowerCase()===e.handle.toLowerCase())||(Ve([...ce,e.handle]),e.accountId&&e.sourceHost&&Ge([...he.filter(t=>t.handle.toLowerCase()!==e.handle.toLowerCase()),{handle:e.handle,accountId:e.accountId,sourceHost:e.sourceHost,authorName:e.authorName}]),ee({title:"Following on Fediverse",description:e.handle}))},Xe=e=>{Ve(ce.filter(t=>t.toLowerCase()!==e.toLowerCase())),Ge(he.filter(t=>t.handle.toLowerCase()!==e.toLowerCase())),ee({title:"Removed from Following",description:e})},Ze=e.useCallback(async e=>{if(!(null==te?void 0:te.id))throw new Error("Sign in to save this fediverse Echo.");const t=Re(e);if(!(null==t?void 0:t.url))throw new Error("Could not find the fediverse post to save.");const r=fe[t.url];
1if(r)return r;const{data:a,error:o}=await x.from("memories").select("id").eq("user_id",te.id).eq("metadata->>fediverse_original_url",t.url).is("deleted_at",null).maybeSingle();if(o)throw o;if(null==a?void 0:a.id){const e=a.id;return ge(r=>({...r,[t.url]:e})),e}const s="untitled fediverse post"===t.title.trim().toLowerCase()?null:t.title,l=t.mediaUrl||t.mediaPreviewUrl||null;if(!l)throw new Error("This fediverse post does not have a visual file to save.");const n="video"!==t.mediaType&&"gif"!==t.mediaType||!l?"image":"video",i={user_id:te.id,type:n,title:s,ai_title:s||null,content:t.description||s||t.url,description:null,html_content:null,image_url:"image"===n?l:"video"===n&&t.mediaPreviewUrl||null,video_url:"video"===n?l:null,audio_url:null,source_url:t.url,ai_description:null,processing_status:"done",metadata:{import_source:"fediverse",fediverse_original_url:t.url,fediverse_post_id:t.id,fediverse_status_id:t.statusId,fediverse_source_host:t.sourceHost,fediverse_source_label:t.source,original_author_handle:t.handle,original_author_name:t.authorName,original_caption:t.description,original_media_type:t.mediaType,original_media_url:l,imported_from_fediverse_feed:!0}},{data:d,error:u}=await x.from("memories").insert(i).select("id").single();if(u)throw u;const c=d.id;return ge(e=>({...e,[t.url]:c})),window.dispatchEvent(new CustomEvent("memory-added",{detail:{memory:{...e,id:c,type:n,title:s,ai_title:s,content:t.description||s||t.url,image_url:"image"===n?l:t.mediaPreviewUrl||null,video_url:"video"===n?l:null,source_url:t.url,metadata:i.metadata,user_id:te.id,owner_id:te.id,is_owner:!0,can_edit:!0}}})),c},[Re,fe,null==te?void 0:te.id]),et=e.useCallback(e=>{const t=Re(e);t&&(ce.some(e=>e.toLowerCase()===t.handle.toLowerCase())?Xe(t.handle):We(t))},[ce,Re]),tt=e.useCallback(e=>{const t=Re(e);return Boolean(t&&ce.some(e=>e.toLowerCase()===t.handle.toLowerCase()))},[ce,Re]);return t.jsxs("div",{className:"app-screen bg-background",children:[t.jsx(s,{title:"Federated Feed",noindex:!0}),t.jsx("div",{className:"pointer-events-none fixed left-0 right-0 top-0 z-50",children:t.jsx(l,{className:"pointer-events-auto",title:"Federated Feed",onCaptureClick:()=>window.dispatchEvent(new CustomEvent("open-capture-modal"))})}),t.jsxs("main",{className:"mx-auto max-w-7xl px-4 pb-32 pt-[calc(5.4rem+env(safe-area-inset-top))] md:px-6 md:pt-24",children:[oe||ae.enable_fediverse?null:t.jsx("section",{className:"mb-6 rounded-2xl border border-border/45 bg-background/70 p-5 shadow-soft",children:t.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-center md:justify-between",children:[t.jsxs("div",{children:[t.jsxs("div",{className:"mb-3 inline-flex items-center gap-2 rounded-full border border-emerald-500/20 bg-emerald-500/10 px-3 py-1 text-xs font-black uppercase tracking-widest text-emerald-600",children:[t.jsx(y,{className:"h-3.5 w-3.5"}),"Federated sharing"]}),t.jsx("h1",{className:"text-2xl font-black tracking-tight text-foreground",children:"Turn on federated sharing first"}),t.jsx("p",{className:"mt-2 max-w-2xl text-sm leading-relaxed text-muted-foreground",children:"Enable it in settings to federate your public Echo profile and public boards, then use this feed to discover the open social web."})]}),t.jsx(i,{type:"button",className:"h-11 rounded-2xl font-bold",onClick:()=>Z("/profile"),children:"Open settings"})]})}),oe||ae.enable_fediverse?t.jsxs(t.Fragment,{children:[t.jsxs("section",{className:"mb-6",children:[t.jsxs("div",{className:"flex flex-col gap-5 md:flex-row md:items-start md:justify-between",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsxs("div",{className:"mb-3 inline-flex items-center gap-2 rounded-full border border-emerald-500/20 bg-emerald-500/10 px-3 py-1 text-xs font-black uppercase tracking-widest text-emerald-600",children:[t.jsx(y,{className:"h-3.5 w-3.5"}),Te?"Live federated":"Federated"]}),t.jsx("h1",{className:"text-3xl font-black tracking-tight text-foreground",children:"Federated Feed"}),t.jsx("p",{className:"mt-2 text-sm font-semibold text-muted-foreground",children:je})]}),t.jsxs("div",{className:"flex flex-wrap gap-2",children:[t.jsxs(i,{type:"button",variant:"outline",className:"h-11 rounded-2xl font-bold",onClick:()=>{ke.refetch(),Me.refetch(),q(se).length>0&&Ce.refetch()},children:[ke.isFetching||Ce.isFetching||Me.isFetching?t.jsx(_,{className:"mr-2 h-4 w-4 animate-spin"}):t.jsx(j,{className:"mr-2 h-4 w-4"}),"Refresh"]}),t.jsxs(i,{type:"button",variant:"outline",className:"h-11 rounded-2xl font-bold",onClick:()=>Z("/profile"),children:["Manage sharing",t.jsx(N,{className:"ml-2 h-4 w-4"})]})]})]}),Ee.length>0?t.jsxs("div",{className:"mt-5",children:[t.jsxs("div",{className:"mb-2 flex items-center gap-2",children:[t.jsx("p",{className:"text-[10px] font-black uppercase tracking-widest text-muted-foreground",children:"Your public federated boards"}),t.jsx("span",{className:"rounded-full bg-muted/45 px-2 py-0.5 text-[10px] font-black text-muted-foreground",children:Ee.length})]}),t.jsxs("div",{className:"flex flex-wrap gap-2",children:[Ie.map(e=>
1t.jsx("span",{className:"rounded-full border border-foreground/10 bg-muted/35 px-3 py-1 text-xs font-bold text-muted-foreground",children:e},e)),Ue>0?t.jsx("button",{type:"button",onClick:()=>be(e=>!e),className:"rounded-full border border-primary/25 bg-primary/10 px-3 py-1 text-xs font-black text-primary transition-colors hover:bg-primary/15",children:we?"Show less":`Show all ${Ue} more`}):null]})]}):null,t.jsxs("div",{className:"relative mt-5 min-w-[260px] overflow-hidden rounded-full border border-border/55 bg-background/90 shadow-soft transition-all duration-300 focus-within:border-primary/35 dark:border-white/10 dark:bg-[linear-gradient(180deg,rgba(16,18,26,0.96),rgba(10,12,18,0.94))]",children:[t.jsx("div",{className:"pointer-events-none absolute inset-[1px] rounded-full bg-white/35 dark:bg-white/[0.03]"}),t.jsx(k,{className:"pointer-events-none absolute left-5 top-1/2 z-10 h-[18px] w-[18px] -translate-y-1/2 text-muted-foreground dark:text-white/70"}),t.jsx(d,{value:se,onChange:e=>le(e.target.value),placeholder:"Search tags, creators, captions, sources...",className:"relative z-10 h-14 rounded-full border-0 bg-transparent pl-14 pr-14 text-[16px] font-semibold tracking-normal text-foreground placeholder:text-muted-foreground/70 focus-visible:ring-0 focus-visible:ring-offset-0 dark:text-white dark:placeholder:text-white/45"}),se?t.jsx("button",{type:"button",onClick:()=>le(""),className:"absolute right-2 top-1/2 z-10 flex h-10 w-10 -translate-y-1/2 items-center justify-center rounded-full text-muted-foreground transition-all hover:bg-muted hover:text-foreground dark:text-white/65 dark:hover:bg-white/10 dark:hover:text-white","aria-label":"Clear search",children:t.jsx(C,{className:"h-4 w-4"})}):null]})]}),t.jsx("section",{children:t.jsx("div",{className:"grid grid-cols-2 gap-2",children:[{value:"feed",label:"Feed",icon:S,count:qe.length},{value:"accounts",label:"For You @s",icon:L,count:Oe.length}].map(e=>{const r=e.icon,a=de===e.value;return t.jsxs("button",{type:"button",onClick:()=>ue(e.value),className:"flex min-h-[58px] items-center justify-center gap-2 rounded-2xl px-3 text-sm font-black transition-all "+(a?"bg-primary text-primary-foreground shadow-lg shadow-primary/20":"bg-muted/35 text-muted-foreground hover:bg-muted/55 hover:text-foreground"),children:[t.jsx(r,{className:"h-4 w-4"}),t.jsx("span",{children:e.label}),t.jsx("span",{className:"rounded-full px-2 py-0.5 text-[10px] "+(a?"bg-white/20":"bg-background/70"),children:e.count})]},e.value)})})}),t.jsxs(u,{value:ne,onValueChange:e=>ie(e),children:[t.jsx(c,{className:"grid h-12 w-full grid-cols-4 rounded-2xl bg-muted/50 p-1",children:["for_you","discover","popular","following"].map(e=>t.jsx(m,{value:e,className:"rounded-xl text-xs font-black sm:text-sm",children:"for_you"===e?"For You":e[0].toUpperCase()+e.slice(1)},e))}),["for_you","discover","popular","following"].map(e=>t.jsx(h,{value:e,className:"mt-5",children:"feed"===de?qe.length>0?t.jsxs("div",{className:"min-w-0",children:[t.jsx(n,{memories:ze,searchQuery:se,hasInitiallyLoaded:!0,showEmptyState:!1,onLoadMore:Qe,hasMore:Ye,isLoadingMore:Je,showPaginationFooter:!1,onFederatedFollow:et,resolveExternalMemoryId:Ze,isFederatedFollowing:tt,showFeedSettingsTrigger:!0,waitForScrollBeforeAutoLoadMore:!1,columnPlacement:"balanced"}),t.jsx("div",{ref:ye,className:"h-1"})]}):t.jsxs("div",{className:"rounded-2xl border border-border/45 bg-background/70 p-8 text-center shadow-soft",children:[t.jsx("h2",{className:"text-lg font-black text-foreground",children:"following"===e?"No followed fediverse accounts yet":"No posts found"}),t.jsx("p",{className:"mx-auto mt-2 max-w-md text-sm text-muted-foreground",children:"following"===e?"Follow accounts from For You, Discover, or Popular and they will appear here.":"Try a broader search term or refresh the public fediverse feed."})]}):Oe.length>0?t.jsx("div",{className:"grid gap-4 lg:grid-cols-2",children:Oe.slice(0,30).map(e=>{const r=ce.some(t=>t.toLowerCase()===e.handle.toLowerCase()),a=e.accountUrl||e.samplePost.url;return t.jsxs("article",{className:"rounded-2xl border border-border/45 bg-background/80 p-4 shadow-soft",children:[t.jsxs("div",{className:"flex gap-3",children:[t.jsx("div",{className:"flex h-12 w-12 shrink-0 items-center justify-center rounded-full bg-primary/10 text-primary",children:t.jsx(L,{className:"h-5 w-5"})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("h2",{className:"truncate text-base font-black text-foreground",children:e.authorName}),t.jsx("p",{className:"truncate text-xs font-bold text-muted-foreground",children:e.handle})]}),t.jsxs("div",{className:"flex shrink-0 gap-2",children:[t.jsx(i,{type:"button",size:"sm",variant:r?"outline":"default",className:"rounded-full font-black",onClick:()=>r?Xe(e.handle):We(e.samplePost),children:r?"Following":"Follow"}),t.jsx(i,{asChild:!0,type:"button",size:"sm",variant:"outline",className:"rounded-full font-black",children:t.jsxs("a",{href:a,target:"_blank",rel:"noreferrer",children:["Open",t.jsx(N,{className:"ml-1.5 h-3.5 w-3.5"})]})})]})]}),t.jsxs("div",{className:"mt-3 flex flex-wrap gap-2 text-[10px] font-black uppercase tracking-widest text-muted-foreground",children:[t.jsx("span",{className:"rounded-full bg-muted/45 px-2 py-1",children:e.sourceHost||e.source}),t.jsxs("span",{className:"rounded-full bg-muted/45 px-2 py-1",children:[e.postCount," posts"]}),t.jsxs("span",{className:"rounded-full bg-muted/45 px-2 py-1",children:[e.visualCount," visual"]})]})]})]}),t.jsx("div",{className:"mt-4 grid gap-2",children:e.samplePosts.map(e=>t.jsxs("a",{href:e.url,target:"_blank",rel:"noreferrer",className:"group flex gap-3 rounded-xl border border-foreground
1/10 bg-muted/25 p-2 transition-colors hover:bg-muted/45",children:[O(e)?t.jsx("img",{src:e.mediaPreviewUrl||e.mediaUrl||"",alt:"",className:"h-14 w-14 shrink-0 rounded-lg object-cover",loading:"lazy",decoding:"async",fetchpriority:"low"}):t.jsx("div",{className:"flex h-14 w-14 shrink-0 items-center justify-center rounded-lg bg-background/70 text-muted-foreground",children:t.jsx(M,{className:"h-4 w-4"})}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"line-clamp-1 text-xs font-black text-foreground group-hover:text-primary",children:e.title}),t.jsx("p",{className:"line-clamp-2 text-xs font-medium leading-relaxed text-muted-foreground",children:e.description})]})]},e.id))})]},e.handle)})}):t.jsxs("div",{className:"rounded-2xl border border-border/45 bg-background/70 p-8 text-center shadow-soft",children:[t.jsx("h2",{className:"text-lg font-black text-foreground",children:"No account matches yet"}),t.jsx("p",{className:"mx-auto mt-2 max-w-md text-sm text-muted-foreground",children:"Try refreshing the feed or using a broader search to discover more fediverse creators."})]})},e))]}),ce.length>0?t.jsxs("section",{className:"mt-6 rounded-2xl border border-border/45 bg-background/70 p-4 shadow-soft",children:[t.jsx("h2",{className:"text-sm font-black uppercase tracking-widest text-muted-foreground",children:"Following controls"}),t.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:ce.map(e=>t.jsxs("button",{type:"button",onClick:()=>Xe(e),className:"inline-flex items-center gap-2 rounded-full border border-foreground
1/10 bg-muted/35 px-3 py-1.5 text-xs font-bold text-foreground transition-colors hover:bg-destructive/10 hover:text-destructive",children:[e,t.jsx(F,{className:"h-3.5 w-3.5"})]},e))})]}):null,ke.isError?t.jsx("p",{className:"mt-5 text-center text-xs font-semibold text-muted-foreground",children:"Live fediverse fetch is unavailable right now, so Echo is showing a fallback discovery set."}):null]}):null]})]})}export{G 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.