import{a}from"./chunk-TOPVR7JX.mjs";import{a as o,b as l}from"./chunk-SYT2IXG6.mjs";import{a as c}from"./chunk-NW4N7ECX.mjs";import{a as r}from"./chunk-YUMUNL66.mjs";import u from"@sindresorhus/slugify";var f=t=>{let e=u(t,{separator:""});if(e.length<3)return"";if(r.has(e.slice(-2)))return`${e.slice(0,-2)}.${e.slice(-2)}`;let n=e.replace(/[aeiou]/g,"");return n.length>=3&&r.has(n.slice(-2))?`${n.slice(0,-2)}.${n.slice(-2)}`:`${[e,n].reduce((i,s)=>i.length<s.length?i:s)}.link`},w=new RegExp(/^([a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/),A=new RegExp(/^[a-zA-Z0-9\-]+$/),D=(t,e)=>t===e?null:t.slice(0,t.length-e.length-1),x=t=>{let e;try{e=new URL(t.replace(/^[a-zA-Z]+:\/\//,"https://")).hostname}catch{return""}if(e==="youtu.be")return"youtube.com";let n=e.split(".");return n.length>2?o.has(n[n.length-2])&&r.has(n[n.length-1])||l.has(n.slice(-2).join("."))?n.slice(-3).join("."):n.slice(-2).join("."):e},d=t=>{if(a(t))return new URL(t).hostname.replace(/^www\./,"");try{if(t.includes(".")&&!t.includes(" "))return new URL(`https://${t}`).hostname.replace(/^www\./,"")}catch{return null}},S=t=>c.some(e=>e.slug===t);export{f as a,w as b,A as c,D as d,x as e,d as f,S as g};
