{"version":3,"file":"functions.mjs","names":["canTransitionApprovalRun","LEGAL_APPROVAL_RUN_TRANSITIONS","from","state","to","classifyPendingRunAt","now","expiresAt"],"sources":["../../../src/components/approvals/functions.ts"],"sourcesContent":["import type { ApprovalRunState } from './constants'\n\nexport function canTransitionApprovalRun(from: ApprovalRunState, to: ApprovalRunState): boolean {\n\treturn LEGAL_APPROVAL_RUN_TRANSITIONS[from].some((state) => state === to)\n}\n\nexport function classifyPendingRunAt(now: number, expiresAt: number): 'pending' | 'expired' {\n\treturn now >= expiresAt ? 'expired' : 'pending'\n}\n\nconst LEGAL_APPROVAL_RUN_TRANSITIONS = {\n\tpending: ['approved', 'rejected', 'expired', 'canceled'],\n\tapproved: [],\n\trejected: [],\n\texpired: [],\n\tcanceled: [],\n} as const satisfies Readonly<Record<ApprovalRunState, readonly ApprovalRunState[]>>\n"],"mappings":"AAEA,SAAgBA,EAAyB,EAAwB,EAA+B,CAC/F,OAAOC,EAA+BC,EAAK,CAAC,KAAM,GAAUC,IAAUC,CAAE,CACzE,CAEA,SAAgBC,EAAqB,EAAa,EAA0C,CAC3F,OAAOC,GAAOC,EAAY,UAAY,SACvC,CAEA,MAAMN,EAAiC,CACtC,QAAS,CAAC,WAAY,WAAY,UAAW,UAAU,EACvD,SAAU,CAAC,EACX,SAAU,CAAC,EACX,QAAS,CAAC,EACV,SAAU,CAAC,CACZ"}