{"version":3,"file":"notification.mjs","names":[],"sources":["../../src/types/notification.ts"],"sourcesContent":["import {\n  PO_NOTIFICATION_ENTRY_TYPE,\n  type PoNotificationEntryData,\n  isPoNotificationEntryData,\n} from '@agimon-ai/po-core/notification';\n\nexport interface PoNotificationEntry {\n  entryId: string;\n  data: PoNotificationEntryData;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n  return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\n/** Reads only a direct, validated Po notification custom-entry frame. */\nexport function parsePoNotificationEntry(frame: unknown): PoNotificationEntry | undefined {\n  if (!isRecord(frame) || frame.type !== 'entry_appended' || !isRecord(frame.entry)) return undefined;\n  const entry = frame.entry;\n  if (\n    entry.type !== 'custom' ||\n    entry.customType !== PO_NOTIFICATION_ENTRY_TYPE ||\n    typeof entry.id !== 'string' ||\n    entry.id.trim().length === 0 ||\n    !isPoNotificationEntryData(entry.data)\n  ) {\n    return undefined;\n  }\n  return { entryId: entry.id, data: entry.data };\n}\n"],"mappings":";;AAWA,SAAS,SAAS,OAAkD;CAClE,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAC5E;;AAGA,SAAgB,yBAAyB,OAAiD;CACxF,IAAI,CAAC,SAAS,KAAK,KAAK,MAAM,SAAS,oBAAoB,CAAC,SAAS,MAAM,KAAK,GAAG,OAAO,KAAA;CAC1F,MAAM,QAAQ,MAAM;CACpB,IACE,MAAM,SAAS,YACf,MAAM,eAAe,8BACrB,OAAO,MAAM,OAAO,YACpB,MAAM,GAAG,KAAK,CAAC,CAAC,WAAW,KAC3B,CAAC,0BAA0B,MAAM,IAAI,GAErC;CAEF,OAAO;EAAE,SAAS,MAAM;EAAI,MAAM,MAAM;CAAK;AAC/C"}