import { r as readConfigMachineState } from "./config-machine-state-Cimw2NSF.js";
import { u as mimeTypeFromFilePath } from "./mime-Hm4eS2i0.js";
import { f as saveMediaBuffer } from "./store-BSk4tp5H.js";
import { r as assertSecretOwnerAvailable } from "./runtime-degraded-state-D5EZZ925.js";
import { b as setTtsMachinePrefsPathResolver } from "./tts-settings-CwvfRgRD.js";
import { n as resolveGeneratedMediaMaxBytes } from "./configured-max-bytes-DXUAv8BU.js";
import { C as setSpeechRuntimeAvailabilityGuard, b as textToSpeechCore, u as maybeApplyTtsToPayloadCore } from "./runtime-api-Ce_-Njrs.js";
//#region src/tts/tts-audio-store.ts
const TTS_MEDIA_SUBDIR = "tool-speech-synthesis";
const persistTtsAudioToMediaStore = async ({ audioBuffer, cfg, fileExtension }) => {
	const originalFilename = `voice${fileExtension}`;
	return (await saveMediaBuffer(audioBuffer, mimeTypeFromFilePath(originalFilename), TTS_MEDIA_SUBDIR, resolveGeneratedMediaMaxBytes(cfg, "audio"), originalFilename)).path;
};
//#endregion
//#region src/tts/tts.ts
/** Public TTS runtime barrel exposed to core callers and plugin SDK facades. */
setSpeechRuntimeAvailabilityGuard(() => {
	assertSecretOwnerAvailable("capability", "tts");
});
setTtsMachinePrefsPathResolver(() => readConfigMachineState("tts.prefsPath"));
function textToSpeech(params) {
	return textToSpeechCore(params, persistTtsAudioToMediaStore);
}
function maybeApplyTtsToPayload(params) {
	return maybeApplyTtsToPayloadCore(params, persistTtsAudioToMediaStore);
}
//#endregion
export { textToSpeech as n, maybeApplyTtsToPayload as t };
