import { c as normalizeOptionalString } from "../string-coerce-DKw2K5wM.js";
import { l as buildPluginApprovalResolvedMessage, s as buildPluginApprovalExpiredMessage } from "../plugin-approvals-BAd_Vwt-.js";
import { t as resolveApprovalOverGateway } from "../approval-gateway-resolver-BP9v-KcE.js";
import "../approval-gateway-runtime-WzQb4w6o.js";
import { n as createLazyChannelApprovalNativeRuntimeAdapter, t as CHANNEL_APPROVAL_NATIVE_RUNTIME_CONTEXT_CAPABILITY } from "../approval-handler-adapter-runtime-uo1rB4v-.js";
import { n as createChannelApprovalHandlerFromCapability, r as createChannelApprovalNativeRuntimeAdapter, t as createChannelApprovalHandler } from "../approval-handler-runtime-BnSktZEs.js";
import { n as buildApprovalResolvedReplyPayload } from "../approval-renderers-BFdypibW.js";
//#region src/plugin-sdk/approval-handler-runtime.ts
function buildChannelApprovalResolvedText(params) {
	if (params.view.approvalKind === "plugin") return buildPluginApprovalResolvedMessage(params.resolved);
	const resolvedByText = params.resolved.resolvedBy ? ` Resolved by ${params.resolved.resolvedBy}.` : "";
	return buildApprovalResolvedReplyPayload({
		approvalId: params.request.id,
		approvalSlug: params.request.id.slice(0, 8),
		text: `✅ Exec approval ${params.resolved.decision}.${resolvedByText} ID: ${params.request.id}`
	}).text ?? "";
}
function buildChannelApprovalExpiredText(params) {
	if (params.view.approvalKind === "plugin") return buildPluginApprovalExpiredMessage(params.request);
	return `⏱️ Exec approval expired. ID: ${params.request.id}`;
}
function resolvePreparedApprovalAccountId(params) {
	return normalizeOptionalString(params.plannedAccountId) ?? normalizeOptionalString(params.contextAccountId) ?? normalizeOptionalString(params.fallbackAccountId);
}
//#endregion
export { CHANNEL_APPROVAL_NATIVE_RUNTIME_CONTEXT_CAPABILITY, buildChannelApprovalExpiredText, buildChannelApprovalResolvedText, createChannelApprovalHandler, createChannelApprovalHandlerFromCapability, createChannelApprovalNativeRuntimeAdapter, createLazyChannelApprovalNativeRuntimeAdapter, resolveApprovalOverGateway, resolvePreparedApprovalAccountId };
