1import"../chunks/Bzak7iHL.js";import{i as it,r as Ht,a as _e,s as lt,d as Ot,e as zt}from"../chunks/BOaZkkS3.js";import{aX as ct,aR as It,aG as L,b8 as r,aj as e,aH as ut,ae as Xe,T as i,bf as g,b2 as s,aO as Ke,bt as Y,ad as O,z as h,aU as dt,bj as x,bd as ft,aM as u,bo as ie,bb as we,ah as S,W as pt,aS as At,bq as Ee}from"../chunks/BlOiJWDc.js";import{i as D}from"../chunks/LL1kkQdB.js";import{e as Je,i as Bt}from"../chunks/CRD08O-4.js";import{b as Yt}from"../chunks/CrQGA-tf.js";import{p as Dt}from"../chunks/Brg57ERc.js";import{g as ye,b as qt}from"../chunks/UMSmatl5.js";import{a as Wt}from"../chunks/B_-8dNKA.js";import{d as rt,f as jt,c as Ut}from"../chunks/CT2Z2NG-.js";import{b as Vt}from"../chunks/DeF0a2cq.js";import{I as Ze,ak as Qe,aN as Gt,aa as Kt,aw as vt,M as ot,aE as Xt,D as Jt,z as Qt,O as Zt,m as ea,a as ta,a2 as aa,a3 as ra,U as oa,ah as sa,aR as na,a0 as ia,u as la,aF as ca,$ as ua,aX as da,aM as fa,aj as pa}from"../chunks/CbrAvEBj.js";import{S as va,A as ma}from"../chunks/DLtOaQO6.js";import{s as et,r as tt}from"../chunks/yXlVkBYz.js";import{L as ga}from"../chunks/z3eCA8pX.js";import{X as ha}from"../chunks/Cg_NH43f.js";import{U as ba}from"../chunks/WMUExoR4.js";import{N as wa}from"../chunks/C1L7GUe6.js";import{P as _a}from"../chunks/CwKQXlC7.js";function st(E,C){let q=tt(C,["$$slots","$$events","$$legacy"]);const b=[["path",{d:"m5 12 7-7 7 7"}],["path",{d:"M12 19V5"}]];Ze(E,et({name:"arrow-up"},()=>q,{get iconNode(){return b}}))}function nt(E,C){let q=tt(C,["$$slots","$$events","$$legacy"]);const b=[["line",{x1:"4",x2:"20",y1:"9",y2:"9"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21"}]];Ze(E,et({name:"hash"},()=>q,{get iconNode(){return b}}))}function ya(E,C){let q=tt(C,["$$slots","$$events","$$legacy"]);const b=[["path",{d:"m21 21-4.34-4.34"}],["circle",{cx:"11",cy:"11",r:"8"}]];Ze(E,et({name:"search"},()=>q,{get iconNode(){return b}}))}const $a=!0,cr=Object.freeze(Object.defineProperty({__proto__:null,prerender:$a},Symbol.toStringTag,{value:"Module"}));var Fa=S('<button type="button"><span class="avatar mini search-kind"><!></span> <span><strong> </strong> <small>Search global posts</small></span></button>'),Sa=S('<div class="feed-search-results"></div>'),Pa=S('<img alt="" loading="lazy" referrerpolicy="no-referrer"/>'),Na=S("<span> </span>"),ka=S('<button type="button"><span class="avatar mini"><!></span> <span><strong> </strong> <small> </small></span></button>'),Ma=S('<button type="button"><span class="avatar mini search-kind"><!></span> <span><strong>Search global posts</strong> <small> </small></span></button>'),Ta=S('<div class="feed-search-empty"><!> No profile suggestions yet</div>'),xa=S('<div class="feed-search-results"><!> <!> <!></div>'),La=S('<div class="dialog-backdrop algorithm-dialog-backdrop" role="presentation" tabindex="-1"><div class="dialog-panel compact algorithm-dialog" role="dialog" aria-modal="true" aria-labelledby="mobile-algorithm-title"><div class="dialog-head"><h2 id="mobile-algorithm-title">Your algorithm</h2> <button class="icon-button" aria-label="Close algorithm settings"><!></button></div> <!></div></div>'),Ea=S('<section class="feed-search" aria-label="Global search"><div class="feed-search-row"><form class="feed-search-form"><!> <input placeholder="Search keyword, profile, npub, or NIP-05" autocomplete="off"/> <!></form> <button class="mobile-algo-button" type="button" aria-label="Open algorithm settings"><!> Algo</button></div> <!></section> <!>',1);function Ra(E,C){ct(C,!1);const q=()=>x(Qe,"$profiles",$e),b=()=>x(vt,"$relays",$e),[$e,fe]=ft(),d=u(),W=u(),Q=u(),K=u(),H=u();let R=u(""),Z=u(!1),ee=u([]),ne=u(!1),$=u(!1),Fe;const Se=["foodstr","musicstr","grownstr","nostr","introductions","bitcoin","gardening"];It(()=>{clearTimeout(Fe)});function w(){clearTimeout(Fe),r(ee,[]),!e(W)&&(e(d).replace(/^@/,"").length<2||(Fe=setTimeout(()=>void pe(e(d)),260)))}async function pe(a){r(ne,!0);try{const l=await Gt(a,b()).catch(()=>[]);a===e(d)&&(r(ee,l),l.length&&Qe.update(p=>Kt(p,l)))}finally{r(ne,!1)}}async function le(){const a=e(d);if(!a)return;const l=e(H)[0],p=await Xt(a,b()).catch(()=>"");
1if(p){r(R,""),await ye(_e(`/profile/${p}`));return}if(a.startsWith("@")&&l){Pe(l.pubkey);return}ot(a.replace(/^#/,"")),r(R,""),await ye(_e("/"))}async function Pe(a){r(R,""),await ye(_e(`/profile/${a}`))}async function Re(a){r(R,""),r($,!1),ot(a.replace(/^#/,"")),await ye(_e("/"))}function Ce(a,l){if(a.startsWith("#"))return[];const p=a.trim().replace(/^@/,"").toLowerCase();return p.length<2?[]:l.filter(F=>We(F,p)).sort((F,_)=>I(F).localeCompare(I(_)))}function We(a,l){return[a.name,a.display_name,a.nip05,a.pubkey].filter(Ne).some(p=>p.toLowerCase().includes(l))}function z(a,l){var y;const p=new Map,F=e(d).includes("@")?e(d).replace(/^@/,"").toLowerCase():"",_=(y=l.find(k=>{var P;return((P=k.nip05)==null?void 0:P.toLowerCase())===F}))==null?void 0:y.pubkey;return[...a,...l].filter(k=>{var P;return!_||k.pubkey===_||((P=k.nip05)==null?void 0:P.toLowerCase())!==F}).forEach(k=>p.set(k.pubkey,k)),[...p.values()]}function I(a){return T(a.display_name,a.name,a.nip05)||`${a.pubkey.slice(0,10)}...`}function Ne(a){return typeof a=="string"&&a.trim().length>0}function T(...a){return a.find(Ne)??""}L(()=>e(R),()=>{r(d,e(R).trim())}),L(()=>e(d),()=>{r(W,e(d).startsWith("#"))}),L(()=>e(d),()=>{r(Q,e(d).startsWith("@"))}),L(()=>(e(d),q()),()=>{r(K,Ce(e(d),Object.values(q())))}),L(()=>(e(K),e(ee)),()=>{r(H,z(e(K),e(ee)).slice(0,6))}),ut(),it();var ce=Ea(),ue=Xe(ce),te=i(ue),ae=i(te),A=i(ae);ya(A,{size:18});var j=g(A,2);Ht(j);var ke=g(j,2);{var He=a=>{ga(a,{size:17,class:"spin"})};D(ke,a=>{e(ne)&&a(He)})}s(ae);var de=g(ae,2),ve=i(de);va(ve,{size:17}),Ke(),s(de),s(te);var Me=g(te,2);{var Te=a=>{var l=Sa();Je(l,5,()=>Se,Bt,(p,F)=>{var _=Fa(),y=i(_),k=i(y);nt(k,{size:15}),s(y);var P=g(y,2),N=i(P),M=i(N);s(N),Ke(2),s(P),s(_),ie(()=>we(M,`#${e(F)??""}`)),O("mousedown",_,rt(function(B){Vt.call(this,C,B)})),O("click",_,()=>Re(e(F))),h(p,_)}),s(l),h(a,l)},Oe=a=>{var l=xa(),p=i(l);{var F=N=>{var M=pt(),B=Xe(M);Je(B,1,()=>e(H),re=>re.pubkey,(re,v)=>{var X=ka(),oe=i(X),me=i(oe);{var Ue=U=>{var J=Pa();ie(()=>lt(J,"src",(e(v),Y(()=>e(v).picture)))),h(U,J)},ze=U=>{var J=Na(),Be=i(J,!0);s(J),ie(Ye=>we(Be,Ye),[()=>(e(v),Y(()=>I(e(v)).slice(0,1).toUpperCase()))]),h(U,J)};D(me,U=>{e(v),Y(()=>e(v).picture)?U(Ue):U(ze,-1)})}s(oe);var Ie=g(oe,2),Le=i(Ie),Ae=i(Le,!0);s(Le);var ge=g(Le,2),Ve=i(ge,!0);s(ge),s(Ie),s(X),ie((U,J)=>{we(Ae,U),we(Ve,J)},[()=>(e(v),Y(()=>I(e(v)))),()=>(e(v),Y(()=>e(v).nip05||`npub ${e(v).pubkey.slice(0,10)}...`))]),O("click",X,()=>Pe(e(v).pubkey)),h(re,X)}),h(N,M)};D(p,N=>{e(W)||N(F)})}var _=g(p,2);{var y=N=>{var M=Ma(),B=i(M),re=i(B);nt(re,{size:15}),s(B);var v=g(B,2),X=g(i(v),2),oe=i(X);s(X),s(v),s(M),ie(me=>we(oe,`#${me??""}`),[()=>(e(d),Y(()=>e(d).replace(/^#/,"")))]),O("click",M,le),h(N,M)};D(_,N=>{e(Q)||N(y)})}var k=g(_,2);{var P=N=>{var M=Ta(),B=i(M);ba(B,{size:16}),Ke(),s(M),h(N,M)};D(k,N=>{e(W),e(H),e(ne),Y(()=>!e(W)&&!e(H).length&&!e(ne))&&N(P)})}s(l),h(a,l)};D(Me,a=>{e($)&&!e(d)?a(Te):(e(d),Y(()=>e(d).length>=2)&&a(Oe,1))})}s(ue);var xe=g(ue,2);{var je=a=>{var l=La(),p=i(l),F=i(p),_=g(i(F),2),y=i(_);ha(y,{size:20}),s(_),s(F);var k=g(F,2);ma(k,{title:"",labelledBy:"mobile-algorithm-title"}),s(p),s(l),O("click",_,()=>r(Z,!1)),O("click",l,P=>P.target===P.currentTarget&&r(Z,!1)),h(a,l)};D(xe,a=>{e(Z)&&a(je)})}Wt(j,()=>e(R),a=>r(R,a)),O("focus",j,()=>r($,!0)),O("blur",j,()=>setTimeout(()=>r($,!1),120)),O("input",j,w),O("submit",ae,rt(le)),O("click",de,()=>r(Z,!0)),h(E,ce),dt(),fe()}const mt="nostr-feed-scroll-state";let qe=null;function Ca(E){const C={...E,savedAt:Date.now()};qe=C,sessionStorage.setItem(mt,JSON.stringify(C))}function Ha(){if(qe)return qe;try{const E=JSON.parse(sessionStorage.getItem(mt)??"null");return qe=E,E}catch{return null}}var Oa=S('<div class="newer-feed-bubble-wrap"><button class="newer-feed-bubble" title="Scroll up to reveal new notes"><!></button></div>'),za=S('<div class="empty-state"><span>Refreshing notes</span></div>'),Ia=S('<div class="empty-state"><strong>No notes :(</strong> <span> </span></div>'),Aa=S("<span>Showing more notes</span>"),Ba=S("<span>Loading more notes</span>"),Ya=S("<span>Scroll down for older notes</span>"),Da=S('<button class="fab mobile-compose-fab" aria-label="Compose post"><!></button>'),qa=S('<section aria-label="Timeline"><!>
1 <div class="pull-newer-zone" aria-hidden="true"><!></div> <!> <section class="feed-list" aria-label="Feed"><!></section> <div class="load-more-sentinel"><!></div> <!></section>');function ur(E,C){ct(C,!1);const q=()=>x(vt,"$relays",$),b=()=>x(Jt,"$feedMode",$),$e=()=>x(Qt,"$events",$),fe=()=>x(Zt,"$follows",$),d=()=>x(ea,"$customFeedSettings",$),W=()=>x(ta,"$activeHashtag",$),Q=()=>x(aa,"$loadingFeed",$),K=()=>x(ra,"$loadingMoreFeed",$),H=()=>x(oa,"$hasMoreFeed",$),R=()=>x(sa,"$pendingNewerEvents",$),Z=()=>x(na,"$session",$),ee=()=>x(Dt,"$page",$),ne=()=>x(Qe,"$profiles",$),[$,Fe]=ft(),Se=u(),w=u(),pe=u(),le=u(),Pe=u(),Re=u(),Ce=u(),We=t=>{var o=qa();let c;var m=i(o);{var V=n=>{Ra(n,{})};D(m,n=>{Z()&&n(V)})}var he=g(m,2),Ft=i(he);st(Ft,{size:18}),s(he);var at=g(he,2);{var St=n=>{var f=Oa(),G=i(f),se=i(G);st(se,{size:20}),s(G),s(f),ie(()=>lt(G,"aria-label",(R(),Y(()=>`Scroll up to reveal ${R().length} new notes`)))),O("click",G,()=>void P()),h(n,f)};D(at,n=>{e(Re)&&n(St)})}var Ge=g(at,2),Pt=i(Ge);{var Nt=n=>{var f=pt(),G=Xe(f);Je(G,1,()=>e(pe),se=>se.id,(se,be)=>{wa(se,{get event(){return e(be)},get profile(){return ne(),e(be),Y(()=>ne()[e(be).pubkey])},prefetchThread:!0,onOpen:ht})}),h(n,f)},kt=n=>{var f=za();h(n,f)},Mt=n=>{var f=Ia(),G=g(i(f),2),se=i(G,!0);s(G),s(f),ie(()=>we(se,e(Ce))),h(n,f)};D(Pt,n=>{e(w),Y(()=>e(w).length)?n(Nt):Q()?n(kt,1):n(Mt,-1)})}s(Ge);var De=g(Ge,2),Tt=i(De);{var xt=n=>{var f=Aa();h(n,f)},Lt=n=>{var f=Ba();h(n,f)},Et=n=>{var f=Ya();h(n,f)};D(Tt,n=>{e(le)?n(xt):K()?n(Lt,1):(H(),e(w),Y(()=>H()&&e(w).length)&&n(Et,2))})}s(De),Yt(De,n=>r(z,n),()=>e(z));var Rt=g(De,2);{var Ct=n=>{var f=Da(),G=i(f);_a(G,{size:30}),s(f),O("click",f,function(...se){var be;(be=da)==null||be.apply(this,se)}),h(n,f)};D(Rt,n=>{Z()&&n(Ct)})}s(o),ie(()=>{c=Ot(o,1,"timeline",null,c,{"pulling-newer":e(A),"pull-ready":e(T)>=xe}),zt(o,`--pull-progress: ${e(Pe)}; --pull-distance: ${e(T)}px;`)}),h(t,o)};let z=u(),I=u(),Ne=0,T=u(0),ce=0,ue,te=u(!1),ae=!1,A=u(!1),j=u(!1),ke,He=!1,de=!1,ve=!1,Me=!1,Te,Oe=0;const xe=78,je=5e3,a=1800*1e3,l=5,p=1200,F=72,_=48;let y=u(F),k="";qt(()=>{de||Be()}),At(()=>{const o={"#messages":"/messages","#notifications":"/notifications","#info":"/info"}[ee().url.hash];if(o){ye(_e(o),{replaceState:!0});return}gt(),r(I,new IntersectionObserver(([m])=>{m.isIntersecting&&ge()},{rootMargin:"320px 0px"})),e(z)&&e(I).observe(e(z));const c=()=>{ze()&&ge()};return addEventListener("scroll",c,{passive:!0}),addEventListener("touchstart",N,{passive:!0}),addEventListener("touchmove",M,{passive:!1}),addEventListener("touchend",v),addEventListener("touchcancel",v),addEventListener("wheel",B,{passive:!1}),()=>{var m;de||Be(),(m=e(I))==null||m.disconnect(),clearTimeout(ke),clearTimeout(ue),clearTimeout(Te),removeEventListener("scroll",c),removeEventListener("touchstart",N),removeEventListener("touchmove",M),removeEventListener("touchend",v),removeEventListener("touchcancel",v),removeEventListener("wheel",B)}});async function P(t=!0){const o=document.documentElement.scrollHeight;ca(),await Ee();const c=document.documentElement.scrollHeight-o;t&&c>0&&window.scrollBy({top:c,left:0,behavior:"instant"})}function N(t){var o;re(t)||!X()||(r(A,!0),Ne=((o=t.touches[0])==null?void 0:o.clientY)??0,r(T,0))}function M(t){if(re(t)){r(A,!1),r(T,0);return}if(!e(A))return;const o=t.touches[0];if(!o)return;const c=o.clientY-Ne;if(c<=0||window.scrollY>2){r(T,0);return}t.preventDefault(),r(T,me(c))}function B(t){re(t)||!X()||t.deltaY>=0||(t.preventDefault(),r(A,!0),ce=Math.min(190,ce+Math.abs(t.deltaY)),r(T,me(ce)),clearTimeout(ue),ue=setTimeout(()=>void v(),150))}function re(t){return t.target instanceof Element&&!!t.target.closest(".composer-backdrop")}async function v(){if(!e(A))return;const t=e(T)>=xe;if(r(A,!1),r(T,0),ce=0,Ue(),!(!t||e(te)||!oe())){r(te,!0);try{if(R().length){await P(!1);return}const o=await ia();o!=null&&o.length&&await P(!1)}finally{r(te,!1)}}}function X(){return oe()&&window.scrollY<=2}function oe(){return W()||b()==="global"||b()==="custom"||b()==="follow"}function me(t){return Math.min(124,t*.52+Math.sqrt(t)*3.4)}function Ue(){r(j,!0),clearTimeout(ke),ke=setTimeout(()=>{r(j,!1)},je)}function ze(){return window.innerHeight+window.scrollY>=document.documentElement.scrollHeight-360}async function Ie(){if(!(ae||Q()||K()||!H())){ae=!0;try{await ua()}finally{ae=!1}}}function Le(t){k!==t&&(k=t,r(y,F))}function Ae(){return e(y)>=e(w).length?!1:(r(y,Math.min(e(w).length,e(y)+_)),!0)}function ge(...t){Q()||K()||!H()||Me||ve||(Me=!0,clearTimeout(Te),Te=setTimeout(()=>{Me=!1,Ve()},80))}
1async function Ve(){if(!ve){ve=!0;try{for(let t=0;t<l;t+=1){if(await Ee(),!U())return;const o=e(w).length,c=e(y);if(Ae()){if(await Ee(),e(y)===c)return;continue}const m=Date.now();return m-Oe<p||(Oe=m,await Ie(),await Ee(),e(w).length<=o||!U()),void 0}}finally{ve=!1}}}function U(){return Q()||K()||!H()||ae?!1:document.documentElement.scrollHeight<=window.innerHeight+180||ze()||J()}function J(){if(!e(z))return!1;const t=e(z).getBoundingClientRect();return t.top<=window.innerHeight+320&&t.bottom>=-160}function Be(){const t=wt();Ye(t)}function Ye(t){Ca({scrollY:window.scrollY,anchorId:t==null?void 0:t.dataset.noteId,anchorOffset:t==null?void 0:t.getBoundingClientRect().top})}async function gt(){if(He)return;const t=Ha();if(!(!t||Date.now()-t.savedAt>a)){He=!0;for(let o=0;o<4;o+=1){await Ee(),await _t();const c=t.anchorId?document.querySelector(`[data-note-id="${t.anchorId}"]`):null;if(c){const m=window.scrollY+c.getBoundingClientRect().top-(t.anchorOffset??0);window.scrollTo({top:Math.max(0,m),left:0,behavior:"instant"});break}else{if(t.anchorId&&Ae())continue;o===3&&window.scrollTo({top:t.scrollY,left:0,behavior:"instant"})}}}}function ht(t){const o=document.querySelector(`.feed-list [data-note-id="${t.id}"]`),c=bt(t),m=c!==t.id?`?focus=${t.id}`:"";Ye(o),fa(t),pa(t),jt(c,Ut(ee().url.pathname,ee().url.search,ee().url.hash)),de=!0,ye(_e(`/thread/${c}${m}`))}function bt(t){var m;if(t.kind!==1)return t.id;const o=t.tags.find(V=>V[0]==="e"&&V[1]&&V[3]==="root");return o!=null&&o[1]?o[1]:((m=t.tags.filter(V=>V[0]==="e"&&V[1])[0])==null?void 0:m[1])??t.id}function wt(){return[...document.querySelectorAll(".feed-list [data-note-id]")].find(t=>t.getBoundingClientRect().bottom>0)}function _t(){return new Promise(t=>requestAnimationFrame(()=>t()))}function yt(t,o){const c=o.trim().replace(/^#/,"").toLowerCase();return c?t.filter(m=>m.tags.some(V=>{var he;return V[0]==="t"&&((he=V[1])==null?void 0:he.replace(/^#/,"").toLowerCase())===c})?!0:new RegExp(`(^|\\s)#${c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`,"i").test(m.content)):t}function $t(t){return t.keywords.some(o=>o.trim())}L(()=>q(),()=>{r(Se,q().some(t=>t.enabled&&t.read))}),L(()=>(b(),$e(),fe(),d(),W()),()=>{r(w,yt(la(b(),$e(),fe(),d()),W()))}),L(()=>(e(w),e(y)),()=>{r(pe,e(w).slice(0,e(y)))}),L(()=>(e(w),e(pe)),()=>{r(le,Math.max(0,e(w).length-e(pe).length))}),L(()=>(b(),W()),()=>{Le(`${b()}:${W()}`)}),L(()=>(e(I),e(z),e(w)),()=>{e(I)&&e(z)&&e(w).length&&(e(I).unobserve(e(z)),e(I).observe(e(z)))}),L(()=>(e(w),e(le),Q(),K(),H()),()=>{ge(e(w).length,e(le),Q(),K(),H())}),L(()=>e(T),()=>{r(Pe,Math.min(1,e(T)/xe))}),L(()=>(R(),e(te),e(j),e(A),e(T)),()=>{r(Re,oe()&&R().length&&!e(te)&&!e(j)&&!e(A)&&e(T)<=0)}),L(()=>(e(Se),Z(),b(),d(),fe()),()=>{r(Ce,e(Se)&&Z()&&(b()==="follow"||b()==="custom"&&!$t(d()))&&!fe().length?"Please follow someone":"Please connect to relays")}),ut(),it(),We(E),dt(),Fe()}export{ur as component,cr as universal};
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.