import type { SystemNotificationPayload } from './framework-menu-system-notifications-types'; export const escapeAppleScriptString = (value: string): string => value.replace(/\\/g, '\\\\').replace(/"/g, '\\"').replace(/\n/g, ' ').trim(); export const buildDisplayNotificationScript = (payload: SystemNotificationPayload): string => { const title = escapeAppleScriptString(payload.title); const message = escapeAppleScriptString(payload.message); const subtitleFragment = payload.subtitle ? ` subtitle "${escapeAppleScriptString(payload.subtitle)}"` : ''; const soundFragment = payload.soundName ? ` sound name "${escapeAppleScriptString(payload.soundName)}"` : ''; return `display notification "${message}" with title "${title}"${subtitleFragment}${soundFragment}`; };