//#region src/atomic/molecules/markdown/helpers/isExternalLink.ts
var e = new Set([
	"javascript",
	"data",
	"vbscript"
].map((e) => `${e}:`)), t = /^[a-zA-Z][a-zA-Z\d+\-.]*:/;
function n() {
	return typeof window < "u" ? window.location.origin : "http://localhost";
}
function r(e) {
	let r = e.trim();
	if (r === "") return null;
	try {
		return t.test(r) ? r.startsWith("//") ? new URL(`http:${r}`) : new URL(r) : new URL(r, n());
	} catch {
		return null;
	}
}
function i(e) {
	let n = e.trim();
	return n === "" ? !1 : n.startsWith("#") ? !0 : n.startsWith("//") ? !1 : !t.test(n) && !n.startsWith("mailto:");
}
function a(e) {
	let t = r(e);
	if (t == null) return !1;
	if (t.protocol === "mailto:") return !0;
	let i = n();
	return t.origin !== i;
}
function o(n) {
	let i = r(n);
	if (i == null || e.has(i.protocol)) return !1;
	if (i.protocol === "http:" || i.protocol === "https:" || i.protocol === "mailto:") return !0;
	let a = n.trim();
	return !t.test(a) && !a.startsWith("#");
}
var s = {
	getBaseOrigin: n,
	resolveUrl: r
};
//#endregion
export { s as __test, a as isExternalLink, i as isRelativeUrl, o as isSafeHttpUrl };

//# sourceMappingURL=isExternalLink.js.map