import "@js-temporal/polyfill";
import "urlpattern-polyfill";
globalThis.addEventListener = () => {};
import { l as AssertionError } from "./assert_equals-Ew3jOFa3.mjs";
//#region ../../node_modules/.pnpm/@jsr+std__assert@0.226.0/node_modules/@jsr/std__assert/assert_instance_of.js
/**
* Make an assertion that `obj` is an instance of `type`.
* If not then throw.
*
* @example Usage
* ```ts no-eval
* import { assertInstanceOf } from "@std/assert/assert-instance-of";
*
* assertInstanceOf(new Date(), Date); // Doesn't throw
* assertInstanceOf(new Date(), Number); // Throws
* ```
*
* @typeParam T The expected type of the object.
* @param actual The object to check.
* @param expectedType The expected class constructor.
* @param msg The optional message to display if the assertion fails.
*/ function assertInstanceOf(actual, expectedType, msg = "") {
	if (actual instanceof expectedType) return;
	const msgSuffix = msg ? `: ${msg}` : ".";
	const expectedTypeStr = expectedType.name;
	let actualTypeStr = "";
	if (actual === null) actualTypeStr = "null";
	else if (actual === void 0) actualTypeStr = "undefined";
	else if (typeof actual === "object") actualTypeStr = actual.constructor?.name ?? "Object";
	else actualTypeStr = typeof actual;
	if (expectedTypeStr === actualTypeStr) msg = `Expected object to be an instance of "${expectedTypeStr}"${msgSuffix}`;
	else if (actualTypeStr === "function") msg = `Expected object to be an instance of "${expectedTypeStr}" but was not an instanced object${msgSuffix}`;
	else msg = `Expected object to be an instance of "${expectedTypeStr}" but was "${actualTypeStr}"${msgSuffix}`;
	throw new AssertionError(msg);
}
//#endregion
export { assertInstanceOf as t };
