import{t as e}from"./cctlds-DXCBpkmb.mjs";import{n as t,t as n}from"./domains-CaD5cUsD.mjs";import{n as r}from"./dub-domains-cnkoM2TR.mjs";import{h as i}from"./urls-ivBifiO_.mjs";import a from"@sindresorhus/slugify";const o=t=>{let n=a(t,{separator:``});if(n.length<3)return``;if(e.has(n.slice(-2)))return`${n.slice(0,-2)}.${n.slice(-2)}`;let r=n.replace(/[aeiou]/g,``);return r.length>=3&&e.has(r.slice(-2))?`${r.slice(0,-2)}.${r.slice(-2)}`:`${[n,r].reduce((e,t)=>e.length<t.length?e:t)}.link`},s=new RegExp(/^([a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/),c=new RegExp(/^[a-zA-Z0-9\-]+$/),l=(e,t)=>e===t?null:e.slice(0,e.length-t.length-1),u=r=>{let i;try{i=new URL(r.replace(/^[a-zA-Z]+:\/\//,`https://`)).hostname}catch{return``}if(i===`youtu.be`)return`youtube.com`;let a=i.split(`.`);return a.length>2?n.has(a[a.length-2])&&e.has(a[a.length-1])||t.has(a.slice(-2).join(`.`))?a.slice(-3).join(`.`):a.slice(-2).join(`.`):i},d=e=>{if(i(e))return new URL(e).hostname.replace(/^www\./,``);try{if(e.includes(`.`)&&!e.includes(` `))return new URL(`https://${e}`).hostname.replace(/^www\./,``)}catch{return null}},f=e=>r.some(t=>t.slug===e);export{f as a,l as i,u as n,s as o,d as r,c as s,o as t};
//# sourceMappingURL=domains-CUmgZeco.mjs.map