import { getTag as e } from "../_internal/getTag.js";
import { argumentsTag as t, booleanTag as n, numberTag as r, stringTag as i } from "../_internal/tags.js";
import { cloneDeepWith as a, copyProperties as o } from "../../object/cloneDeepWith.js";
//#region ../../node_modules/es-toolkit/dist/compat/object/cloneDeepWith.mjs
function s(s, c) {
	return a(s, (a, l, u, d) => {
		let f = c?.(a, l, u, d);
		if (f !== void 0) return f;
		if (typeof s == "object") {
			if (e(s) === "[object Object]" && typeof s.constructor != "function") {
				let e = {};
				return d.set(s, e), o(e, s, u, d), e;
			}
			switch (Object.prototype.toString.call(s)) {
				case r:
				case i:
				case n: {
					let e = new s.constructor(s?.valueOf());
					return o(e, s), e;
				}
				case t: {
					let e = {};
					return o(e, s), e.length = s.length, e[Symbol.iterator] = s[Symbol.iterator], e;
				}
				default: return;
			}
		}
	});
}
//#endregion
export { s as cloneDeepWith };

//# sourceMappingURL=cloneDeepWith.js.map