import "@js-temporal/polyfill";
import "urlpattern-polyfill";
globalThis.addEventListener = () => {};
import { $ as UrlError, et as expandIPv6Address, nt as isValidPublicIPv6Address, rt as validatePublicUrl, tt as isValidPublicIPv4Address } from "../vocab-C5EUmVTj.mjs";
import { t as test } from "../testing-BQeTO4ss.mjs";
import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
import { n as assertFalse, t as assertRejects } from "../assert_rejects-CJC9ThS-.mjs";
import { t as assert } from "../assert-DikXweDx.mjs";
//#region src/runtime/url.test.ts
test("validatePublicUrl()", async () => {
	await assertRejects(() => validatePublicUrl("ftp://localhost"), UrlError);
	await assertRejects(() => validatePublicUrl("data:text/plain;base64,SGVsbG8sIFdvcmxkIQ=="), UrlError);
	await assertRejects(() => validatePublicUrl("https://localhost"), UrlError);
	await assertRejects(() => validatePublicUrl("https://127.0.0.1"), UrlError);
	await assertRejects(() => validatePublicUrl("https://[::1]"), UrlError);
	await assertRejects(() => validatePublicUrl("http://[::ffff:7f00:1]/"), UrlError);
	await assertRejects(() => validatePublicUrl("https://[64:ff9b::7f00:1]/"), UrlError);
	await assertRejects(() => validatePublicUrl("https://[64:ff9b::a00:1]/"), UrlError);
	await assertRejects(() => validatePublicUrl("https://[64:ff9b:1::a00:1]/"), UrlError);
	await assertRejects(() => validatePublicUrl("https://[64:ff9b:1::808:808]/"), UrlError);
	await assertRejects(() => validatePublicUrl("https://[2001::]/"), UrlError);
	await assertRejects(() => validatePublicUrl("https://[2002:a00:1::]/"), UrlError);
	for (const url of [
		"https://100.64.0.1",
		"https://198.18.0.1",
		"https://224.0.0.1",
		"https://240.0.0.1",
		"https://192.0.2.1",
		"https://192.88.99.1",
		"https://198.51.100.1",
		"https://203.0.113.1"
	]) await assertRejects(() => validatePublicUrl(url), UrlError);
	await validatePublicUrl("https://[2001:db8::1]");
	await validatePublicUrl("https://[64:ff9b::8.8.8.8]");
});
test("isValidPublicIPv4Address()", () => {
	assert(isValidPublicIPv4Address("8.8.8.8"));
	assertFalse(isValidPublicIPv4Address("192.168.1.1"));
	assertFalse(isValidPublicIPv4Address("127.0.0.1"));
	assertFalse(isValidPublicIPv4Address("10.0.0.1"));
	assertFalse(isValidPublicIPv4Address("127.16.0.1"));
	assertFalse(isValidPublicIPv4Address("169.254.0.1"));
	assertFalse(isValidPublicIPv4Address("100.64.0.1"));
	assertFalse(isValidPublicIPv4Address("100.127.255.255"));
	assertFalse(isValidPublicIPv4Address("192.0.0.1"));
	assertFalse(isValidPublicIPv4Address("192.0.2.1"));
	assertFalse(isValidPublicIPv4Address("192.88.99.0"));
	assertFalse(isValidPublicIPv4Address("192.88.99.1"));
	assertFalse(isValidPublicIPv4Address("192.88.99.2"));
	assertFalse(isValidPublicIPv4Address("192.88.99.255"));
	assertFalse(isValidPublicIPv4Address("198.18.0.1"));
	assertFalse(isValidPublicIPv4Address("198.19.255.255"));
	assertFalse(isValidPublicIPv4Address("198.51.100.1"));
	assertFalse(isValidPublicIPv4Address("203.0.113.1"));
	assertFalse(isValidPublicIPv4Address("224.0.0.1"));
	assertFalse(isValidPublicIPv4Address("239.255.255.255"));
	assertFalse(isValidPublicIPv4Address("240.0.0.1"));
	assertFalse(isValidPublicIPv4Address("255.255.255.255"));
	assertFalse(isValidPublicIPv4Address("1.2.3"));
	assertFalse(isValidPublicIPv4Address("999.1.1.1"));
});
test("isValidPublicIPv6Address()", () => {
	assert(isValidPublicIPv6Address("2001:db8::1"));
	assertFalse(isValidPublicIPv6Address("::1"));
	assertFalse(isValidPublicIPv6Address("fc00::1"));
	assertFalse(isValidPublicIPv6Address("fe80::1"));
	assertFalse(isValidPublicIPv6Address("ff00::1"));
	assertFalse(isValidPublicIPv6Address("::"));
	assertFalse(isValidPublicIPv6Address("::ffff:7f00:1"));
	assertFalse(isValidPublicIPv6Address("64:ff9b::7f00:1"));
	assertFalse(isValidPublicIPv6Address("64:ff9b::127.0.0.1"));
	assertFalse(isValidPublicIPv6Address("64:ff9b::a00:1"));
	assertFalse(isValidPublicIPv6Address("64:ff9b::10.0.0.1"));
	assertFalse(isValidPublicIPv6Address("64:ff9b:1::"));
	assertFalse(isValidPublicIPv6Address("64:ff9b:1::a00:1"));
	assertFalse(isValidPublicIPv6Address("64:ff9b:1::10.0.0.1"));
	assertFalse(isValidPublicIPv6Address("2001::"));
	assertFalse(isValidPublicIPv6Address("2001:0:4136:e378:8000:63bf:3fff:fdd2"));
	assertFalse(isValidPublicIPv6Address("2002:a00:1::"));
	assertFalse(isValidPublicIPv6Address("2002:7f00:1::"));
	assertFalse(isValidPublicIPv6Address("2002:c0a8:1::"));
	assertFalse(isValidPublicIPv6Address("2002:a9fe:1::"));
	assert(isValidPublicIPv6Address("64:ff9b::808:808"));
	assert(isValidPublicIPv6Address("64:ff9b::8.8.8.8"));
});
test("expandIPv6Address()", () => {
	assertEquals(expandIPv6Address("::"), "0000:0000:0000:0000:0000:0000:0000:0000");
	assertEquals(expandIPv6Address("::1"), "0000:0000:0000:0000:0000:0000:0000:0001");
	assertEquals(expandIPv6Address("2001:db8::"), "2001:0db8:0000:0000:0000:0000:0000:0000");
	assertEquals(expandIPv6Address("2001:db8::1"), "2001:0db8:0000:0000:0000:0000:0000:0001");
	assertEquals(expandIPv6Address("64:ff9b::8.8.8.8"), "0064:ff9b:0000:0000:0000:0000:0808:0808");
});
//#endregion
export {};
