import { isPrimitive as e } from "../predicate/isPrimitive.js";
import { isTypedArray as t } from "../predicate/isTypedArray.js";
//#region ../../node_modules/es-toolkit/dist/object/clone.mjs
function n(n) {
	if (e(n)) return n;
	if (Array.isArray(n) || t(n) || n instanceof ArrayBuffer || typeof SharedArrayBuffer < "u" && n instanceof SharedArrayBuffer) return n.slice(0);
	let r = Object.getPrototypeOf(n);
	if (r == null) return Object.assign(Object.create(r), n);
	let i = r.constructor;
	if (n instanceof Date || n instanceof Map || n instanceof Set) return new i(n);
	if (n instanceof RegExp) {
		let e = new i(n);
		return e.lastIndex = n.lastIndex, e;
	}
	if (n instanceof DataView) return new i(n.buffer.slice(0));
	if (n instanceof Error) {
		let e;
		return e = n instanceof AggregateError ? new i(n.errors, n.message, { cause: n.cause }) : new i(n.message, { cause: n.cause }), e.stack = n.stack, Object.assign(e, n), e;
	}
	return typeof File < "u" && n instanceof File ? new i([n], n.name, {
		type: n.type,
		lastModified: n.lastModified
	}) : typeof n == "object" ? Object.assign(Object.create(r), n) : n;
}
//#endregion
export { n as clone };

//# sourceMappingURL=clone.js.map