import "../../../../dialect-helpers-DRI5pyY3.mjs";
import "../../../../after-B1IIdH3Y.mjs";
import "../../../../object-cache-Bok5j2ae.mjs";
import "../../../../base64-CmWvODNW.mjs";
import "../../../../types-CuW0zWDA.mjs";
import "../../../../media-BrXIaMFN.mjs";
import "../../../../options-DTTML-Tx.mjs";
import "../../../../request-cache-KCNHp_RJ.mjs";
import "../../../../loader-CB6YHeul.mjs";
import "../../../../settings-zhmdKyJQ.mjs";
import { t as SsrfError } from "../../../../ssrf-1g7usGBg.mjs";
import { n as apiSuccess, r as handleError, t as apiError } from "../../../../error-CkAseSqZ.mjs";
import { n as parseBody, t as isParseError } from "../../../../parse-GmjecGct.mjs";
import "../../../../redirects-DXEXBAII.mjs";
import { f as importProbeBody } from "../../../../byline-fields-2Lp5Hbgf.mjs";
import "../../../../status-CqJQX1QN.mjs";
import "../../../../api/schemas/index.mjs";
import { h as probeUrl } from "../../../../import-fYLf14Co.mjs";
import "../../../../ssrf-CmuGgCq3.mjs";
import "../../../../utils-BJXElxdw.mjs";
import { n as requirePerm } from "../../../../authorize-Dz88F_Fw.mjs";

//#region src/astro/routes/api/import/probe.ts
const prerender = false;
const POST = async ({ request, locals }) => {
	const { user } = locals;
	const denied = requirePerm(user, "import:execute");
	if (denied) return denied;
	try {
		const body = await parseBody(request, importProbeBody);
		if (isParseError(body)) return body;
		return apiSuccess({
			success: true,
			result: await probeUrl(body.url)
		});
	} catch (error) {
		if (error instanceof SsrfError) return apiError("SSRF_BLOCKED", error.message, 400);
		return handleError(error, "Failed to probe URL", "PROBE_ERROR");
	}
};

//#endregion
export { POST, prerender };
//# sourceMappingURL=probe.mjs.map