'use client'; import { parseLeaderRevivalClaim, type LeaderRevivalClaim } from '@/game/leader-revival-promises'; type LeaderChoice = { id: string; name: string }; export function leaderRevivalClaimInputError(value: unknown, leaders?: readonly LeaderChoice[]): string | null { try { const claim = parseLeaderRevivalClaim(value); return leaders && !leaders.some(leader => leader.id === claim.leader) ? 'Choose one of the current named leaders.' : null; } catch (error) { return error instanceof Error ? error.message : 'Choose the current turn and a named leader.'; } } /** The parent supplies the current turn and authorized public name choices. * Eligibility and the native return quote remain authoritative on the server. */ export function LeaderRevivalClaimFields(props: { value: LeaderRevivalClaim; onChange: (claim: LeaderRevivalClaim) => void; leaders: readonly LeaderChoice[]; disabled?: boolean; }) { const error = leaderRevivalClaimInputError(props.value, props.leaders); return
; }