var e=`https://agora.spot`,t=new URL(e).hostname;function n(t=``){return`${e}${t?`/${t.replace(/^\/+/,``)}`:``}`}var r=[`npub`,`nprofile`,`note`,`nevent`,`naddr`],i=new Set([t,`localhost`,`127.0.0.1`]);function a(e){let t;try{t=new URL(e)}catch{return}if(t.protocol!==`https:`&&t.protocol!==`http:`||!i.has(t.hostname))return;let n=t.pathname.replace(/^\/+/,``).replace(/\/+$/,``);if(!n||n.includes(`/`))return;let a=n.toLowerCase();if(r.some(e=>a.startsWith(e+`1`))&&/^[a-z0-9]+$/.test(a))return n}function o(e){return e.replace(/https?:\/\/[^\s<>()]+/gi,e=>{let t=e.match(/^(.*?)([.,;:!?)\]]+)$/),n=t?t[1]:e,r=t?t[2]:``,i=a(n);return i?`nostr:${i}${r}`:e})}export{o as i,e as n,n as r,t};