{"version":3,"sources":["../src/index.ts","../src/errors.ts","../src/ids.ts","../src/responses.ts","../src/session.ts","../src/timeZone.ts","../src/http.ts","../src/ndjson.ts","../src/chat.ts","../src/signals.ts","../src/conversation.ts","../src/carryOver.ts","../src/deliveryClass.ts","../src/eventLog.ts","../src/client.ts","../src/sports.ts","../src/matchKey.ts","../src/types.ts","../src/unavailable.ts","../src/events.ts","../src/rateLimit.ts"],"sourcesContent":["export { StatsWidgetClient } from './client'\nexport { Conversation } from './conversation'\nexport { matchKey } from './matchKey'\nexport type { ChatCallbacks, ChatHandle } from './chat'\nexport { SIGNAL_TYPE_CODES, ENTITY_TYPE_CODES } from './signals'\nexport {\n  WidgetSdkError, AuthError, ForbiddenError, RateLimitError, UpstreamError, NetworkError, ParseError,\n  LimitError, LIMIT_CODES, isLimitCode,\n} from './errors'\nexport type { LimitCode, LimitDetails } from './errors'\nexport type {\n  StatsWidgetClientOptions, FetchLike, UserContext, ChatInput, ChatGrounding, ChatPreset, PageContext,\n  SignalType, SignalEntityType, SignalInput,\n  OddsFormat, WidgetSettings, SlipSport, SlipSelection, SlipDisplay, AddToSlipRejectReason, AddToSlipResult, AddToSlipHandler,\n} from './types'\nexport { isAddToSlipResult } from './types'\nexport { observingFetch } from './unavailable'\nexport { endpointTemplate } from './responses'\nexport type { ResponseReport } from './responses'\nexport type { UnavailableReason, UnavailableProblem } from './unavailable'\nexport type { Teaser, TeaserPrice, PriceResult } from './teaser'\nexport { MAX_SWAPPED_IDS } from './events'\nexport { SPORTS, sportOf, slipSportOf, mayPinOrSlip, toWireSport, fromWireSport, qualifiedId, localIdOf } from './sports'\nexport type { SportSpec, NonFootballSport, WireSport, QualifiedType } from './sports'\nexport type { PluralRow, StringTable, WidgetStrings } from './strings'\nexport { createNdjsonParser } from './ndjson'\nexport type { NdjsonParser } from './ndjson'\nexport { createEventLogger } from './eventLog'\nexport { DELIVERY_CLASS, isWidgetEventName } from './deliveryClass'\nexport type { DeliveryClass } from './deliveryClass'\nexport { createRateLimiter } from './rateLimit'\nexport { openSession, SESSION_IDLE_MS } from './session'\nexport type { SessionStore } from './session'\nexport { openCarryOver, PENDING_TTL_MS, PENDING_MAX_EVENTS, PENDING_MAX_BYTES } from './carryOver'\nexport type { CarryOverStore } from './carryOver'\nexport { newId } from './ids'\nexport { postDirectEvent } from './http'\nexport type {\n  WidgetTrackingEvent, WidgetTrackingEventName, WidgetTrackingBody, WidgetTrackingEnvelope, WidgetTrackingHandler, WidgetTrackingTab, QuestionSource, AddToSlipOutcome,\n  TabChangeSource, WidgetCloseMethod, FavouriteSurface, SlipSurface,\n} from './tracking'\nexport type { CatalogueEventProps, CatalogueEventName } from './catalogueEvents'\nexport type {\n  WidgetEventName, WidgetEntityEventName, WidgetPopupEventName, WidgetPopupAskEventName, WidgetOpenEventName, WidgetSportSwitchEventName, WidgetGreetingEventName, WidgetEntityType, WidgetEventInput,\n  ComboAddMetadata, WidgetMarketChooseEventInput, WidgetPopupEventInput, WidgetPopupAskEventInput, WidgetOpenEventInput, WidgetSportSwitchEventInput, WidgetGreetingEventInput, GreetingEventPayload, WidgetLogInput, WireEvent, EventBatch, EventLoggerOptions, EventLogger,\n  WidgetPublicOnlyName, WidgetPropsEventName, WidgetPublicPropsEventInput, WidgetWirePropsEventInput, WidgetCatalogueEventInput, WidgetPropsEventInput, WirePropValue, WireProps, WireContext, WireEventScope,\n} from './eventLog'\nexport type {\n  ChatEvent, ProgressEventData, AnswerEventData, EntityCard, EntityCardStat, EntityCardRecord, EntityCardScope, EntityCardEventData,\n  CompareCell, CompareColumn, CompareRow, CompareCard, CompareCardEventData,\n  ActionButtonEventData, IntentChipEventData, ActionsLoadingEventData,\n  TurnCompleteEventData, StreamErrorEventData, GreetingEventMeta,\n  BettingInsight, BettingInsightOdds, BettingInsightEventData,\n  NbaInsightSelection, NbaGameValue, NbaListedTeammate, NbaPropReasonEvidence, NbaLinePoint, NbaLineLane,\n  NbaInjuryEvent, NbaLineMoveEvidence, NbaSplitRow, NbaTeammateOutEvidence, NbaCoHitLeg, NbaJointGame,\n  NbaCoHitEvidence, NbaLadderRung, NbaLadderStat, NbaLadderEvidence,\n  NbaMatchupTeam, NbaMatchupPosition, NbaMatchupEvidence, NbaVsOpponentEvidence, NbaVsMeeting, NbaQuarterRung, NbaQuarterStat, NbaQuarterLadderEvidence,\n  NbaSettleLine, NbaSettlePlayer, NbaSettleSummary, NbaSettleRecapEvidence, NbaInsight, NbaInsightEventData,\n  NflInsightKind, NflInsightSelection, NflPropReasonGame, NflPropReasonEvidence, NflLadderRung, NflLadderEvidence,\n  NflInjuryPlayer, NflInjuryReportEvidence, NflLineMoveLane, NflLineMoveEvidence, NflAtsGame, NflAtsRecordEvidence,\n  NflMatchupEvidence, NflSettleRecapLine, NflSettleRecapPlayer, NflSettleRecapSummary, NflSettleRecapEvidence,\n  NflInsight, NflInsightEventData,\n  TennisInsightKind, TennisInsightPlayer, TennisInsightPrices, TennisFieldDot, TennisMarkedPlayer, TennisServeReturnEvidence,\n  TennisServeFormMatch, TennisServeFormLabels, TennisServeFormEvidence, TennisSeasonEvent, TennisSurfaceLegend, TennisSeasonPathEvidence,\n  TennisInsight, TennisInsightEventData,\n  MarketOddsRow, MarketOddsCard, MarketOddsCardInsight, MarketOddsLiveBlock, MarketOddsEventData,\n  ComboCard, ComboLeg, ComboReplacedLeg, ComboCardEventData,\n  PresetPick, PresetComboCell, PresetGrid, PresetGridOptions, BuilderGridPayload, BuilderGridRequest, BuilderGridStatus,\n  OddsMovementPoint, OddsMovementCard, OddsMovementEventData,\n  GreetingDashboard, GreetingDashboardSet, GreetingSetChip, GreetingDashboardTile, GreetingDashboardLayout, GreetingDashboardSpan, GreetingDashboardTileEmphasis, GreetingDashboardSignalRef,\n  GreetingPersonalSection, GreetingMarketFirstSection, GreetingFeaturedCard, GreetingFactRow, GreetingTopBet, GreetingTopBets, GreetingStripRow, GreetingMarketRow, GreetingPriceSelection, GreetingPriceTrail, GreetingTrailPoint, GreetingBubble, GreetingBubblePrice, GreetingChipToken, GreetingPersonalTier, GreetingEntityKind, GreetingGamesScope, GreetingEntityChip, GreetingTeamCard, GreetingPlayerCard, GreetingPlayerStatus, GreetingPlayerHit, GreetingBuilderPreset, GreetingFact, GreetingFactReference, GreetingInjury, GreetingGameFacts, GreetingMarketOption, GreetingGamesOption, GreetingIdleTeam, GreetingFormResult,\n  ClubFanDashboardPayload, ClubFanDashboardCard, ClubFanDashboardHeadToHead,\n  FixtureCard, FixtureCardData, FormMatch, CountdownCard, CountdownData,\n  InjuriesCard, InjuriesCardData, InjuryRow,\n  ReasonToBetCard, ReasonToBetData, WhereToWatchCard, WhereToWatchData,\n  CongestedWeekCard, CongestedWeekData, CongestedWeekEntry,\n  TransfersCard, TransfersData, TransferRow,\n  LinksCard, LinksData, LinkRow,\n  PostMatchResultCard, PostMatchResultData,\n  PostMatchGoalsCard, PostMatchGoalsData, PostMatchGoalLine,\n  PostMatchStatsCard, PostMatchStatsData, PostMatchStatRow,\n  PostMatchTopPerformerCard, PostMatchTopPerformerData,\n  OddsForms, PriceOption,\n  PostMatchNextCard, PostMatchNextData,\n  RestingNextCard, RestingNextData,\n  RestingStandingsCard, RestingStandingsData,\n  RestingSeasonCard, RestingSeasonData,\n  RestingFormCard, RestingFormData,\n  LiveScoreCard, LiveScoreData, LiveTimelineCard, LiveTimelineData, LiveEventLine,\n  LiveStatsCard, LiveStatsData, LiveStatRow, MomentumPoint,\n  PinKind, PinRef, MonitorPhase, HeadToHead, FormAndH2H,\n  LiveMonitorStatPrice, LiveMonitorStatRow, LiveMonitorEvent,\n  LiveMonitorFact, LiveMonitorFactEvidence, LiveMonitorMatch, LiveMonitorMarket, LiveMonitorSnapshot,\n  MonitorSport, LiveMonitorBasketball, LiveMonitorAmericanFootball, NflSituation, NflPropLive,\n  AvailableMarket, MarketOddsBlock,\n  FavouritesPayload, FavouritesNoIdentity, FavouriteEntity, FavouriteKind, FavouriteStarResult, FavouriteStarResponse,\n  PlayerPropPrice, PlayerPropStat, PlayerPropGame, PlayerPropLive, PlayerPropStatGame, PlayerPropFact, PlayerPropsBundle,\n  NflForm, NflFormGame, NbaFormRest, NbaTeamFormRest, NbaFormGame, NbaNextGame,\n  ScheduleSport, ScheduleMatch, ScheduleGroup, ScheduleMatchDays, SchedulePayload, LeagueStarResult, MatchState, StatesPayload, TennisWinnerPrice, TennisRowPrice, TennisMatchKey,\n  LiveMonitorTennis, TennisPlayerSide, TennisMatchHeader, TennisWl, TennisPlayerRecord, TennisMeeting, TennisHeadToHead, TennisCardLabels,\n  TennisScore, TennisEndState, TennisSetScore, TennisStatKind, TennisStatRow, TennisStatTable, TennisStatSet, TennisServeReturn, TennisTodayRow, TennisTodayVsSeason, TennisLiveLabels, TennisLiveBlock,\n  GameSummary, GameListPayload, GameStatePayload,\n  SubmitPlayBody, SubmitPlayResult,\n  GameResultPayload,\n  LeaderboardRow, AllTimeRow, LeaderboardPayload, LeaderboardChampion,\n  ClubFixture, ClubFixturesPayload, ClubStandingRow, ClubStandingsPayload, ClubSquadPlayer, ClubSquadPayload,\n  ClubPlayerSeasonStats, ClubSquadStatsPayload, ClubPlayerDetailPayload,\n  ClubPlayerAvailability, ClubPlayerAvailabilityStatus, ClubNextFixture, ClubMatchLogRow, ClubPlayerPerformance, ClubPerformanceMetric, ClubRecordEntry, ClubRecordsPayload,\n} from './events'\n","export class WidgetSdkError extends Error {\n  readonly code: string\n  readonly status?: number\n  constructor(message: string, code: string, status?: number) {\n    super(message)\n    this.name = new.target.name\n    this.code = code\n    this.status = status\n    Object.setPrototypeOf(this, new.target.prototype)\n  }\n}\nexport class AuthError extends WidgetSdkError {\n  constructor(message = 'Invalid or missing public key') { super(message, 'unauthorized', 401) }\n}\nexport class ForbiddenError extends WidgetSdkError {\n  constructor(message = 'Origin not allowed or widget disabled') { super(message, 'forbidden', 403) }\n}\nexport class RateLimitError extends WidgetSdkError {\n  readonly retryAfter?: number\n  constructor(retryAfter?: number, message = 'Rate limited') { super(message, 'rate_limited', 429); this.retryAfter = retryAfter }\n}\n// B4 Q7: the codes a brand's limit refuses with. Any other 429 stays a plain RateLimitError.\nexport const LIMIT_CODES = ['daily_cap', 'quota_exhausted', 'assistant_paused'] as const\nexport type LimitCode = (typeof LIMIT_CODES)[number]\nexport function isLimitCode(code: unknown): code is LimitCode {\n  return typeof code === 'string' && (LIMIT_CODES as readonly string[]).includes(code)\n}\nexport interface LimitDetails {\n  limitCode: LimitCode\n  resetsAt?: string\n  /** The brand's or the built-in text, already in the user's language. */\n  message?: string\n}\nexport class LimitError extends RateLimitError {\n  readonly limitCode: LimitCode\n  readonly resetsAt?: string\n  readonly limitMessage?: string\n  constructor(details: LimitDetails, retryAfter?: number) {\n    super(retryAfter, details.message ?? 'Limit reached')\n    this.limitCode = details.limitCode\n    this.resetsAt = details.resetsAt\n    this.limitMessage = details.message\n  }\n}\nexport class UpstreamError extends WidgetSdkError {\n  constructor(status: number, message = 'Upstream error') { super(message, 'upstream_error', status) }\n}\nexport class NetworkError extends WidgetSdkError {\n  readonly cause?: unknown\n  constructor(message = 'Network request failed', cause?: unknown) { super(message, 'network_error'); this.cause = cause }\n}\nexport class ParseError extends WidgetSdkError {\n  readonly line?: string\n  constructor(message = 'Malformed NDJSON line', line?: string) { super(message, 'parse_error'); this.line = line }\n}\n","const HEX: string[] = Array.from({ length: 256 }, (_, i) => (i + 0x100).toString(16).slice(1))\n\nfunction randomBytes(): Uint8Array {\n  const bytes = new Uint8Array(16)\n  const c: Crypto | undefined = globalThis.crypto\n  if (c && typeof c.getRandomValues === 'function') {\n    try {\n      c.getRandomValues(bytes)\n      return bytes\n    } catch { /* fall through to Math.random */ }\n  }\n  for (let i = 0; i < 16; i++) bytes[i] = Math.floor(Math.random() * 256)\n  return bytes\n}\n\n/** A v4 uuid in the 8-4-4-4-12 form, from crypto.randomUUID, else crypto.getRandomValues, else Math.random. */\nexport function newId(): string {\n  const c: Crypto | undefined = globalThis.crypto\n  if (c && typeof c.randomUUID === 'function') {\n    try { return c.randomUUID() } catch { /* fall through */ }\n  }\n  const b = randomBytes()\n  b[6] = (b[6]! & 0x0f) | 0x40\n  b[8] = (b[8]! & 0x3f) | 0x80\n  const h = (i: number): string => HEX[b[i]!]!\n  return `${h(0)}${h(1)}${h(2)}${h(3)}-${h(4)}${h(5)}-${h(6)}${h(7)}-${h(8)}${h(9)}-${h(10)}${h(11)}${h(12)}${h(13)}${h(14)}${h(15)}`\n}\n","import type { FetchLike } from './types'\n\nexport const STATIC_SEGMENTS: ReadonlySet<string> = new Set([\n  'chat', 'signals', 'events', 'widget-settings', 'strings', 'live-dashboard', 'live-monitor', 'market', 'props', 'schedule', 'states',\n  'leagues', 'star', 'games', 'result', 'plays', 'leaderboard', 'club', 'fixtures', 'standings', 'squad', 'stats', 'player', 'records',\n  'price-presets', 'favourites', 'search', 'hide',\n])\n\n/** The route a request went to, ids masked, or null for the events POST and for a URL outside the base. */\nexport function endpointTemplate(url: string, cfg: { baseUrl: string; operatorId: string }): string | null {\n  const prefix = `${cfg.baseUrl.replace(/\\/+$/, '')}/v1/${encodeURIComponent(cfg.operatorId)}/`\n  if (!url.startsWith(prefix)) return null\n  const path = url.slice(prefix.length).split('?')[0]!.split('#')[0]!\n  const segments = path.split('/').filter((s) => s !== '')\n  if (segments.length === 0 || segments[0] === 'events') return null\n  return segments.map((s) => (STATIC_SEGMENTS.has(s) ? s : ':id')).join('/')\n}\n\nconst DESIGNED = new WeakMap<object, readonly number[]>()\n\n/** Marks the statuses a request's route answers by design, so the observer does not report them as failures. */\nexport function designed(init: RequestInit, statuses: readonly number[]): RequestInit {\n  DESIGNED.set(init, statuses)\n  return init\n}\n\nexport type ResponseReport = { endpoint: string; status: number }\n\nexport function observeFetch(base: FetchLike, cfg: { baseUrl: string; operatorId: string }, emit: (r: ResponseReport) => void): FetchLike {\n  const report = (url: string, status: number): void => {\n    try {\n      const endpoint = endpointTemplate(url, cfg)\n      if (endpoint !== null) emit({ endpoint, status })\n    } catch { /* telemetry never breaks a request */ }\n  }\n  return async (input, init) => {\n    let res: Response\n    try {\n      res = await base(input, init)\n    } catch (error) {\n      if ((error as { name?: string } | null)?.name !== 'AbortError') report(input, 0)\n      throw error\n    }\n    if (!res.ok && !DESIGNED.get(init)?.includes(res.status)) report(input, res.status)\n    return res\n  }\n}\n","import { newId } from './ids'\n\nexport interface SessionStore {\n  readonly id: string\n  readonly storage: 'session' | 'memory'\n  touch(at: number): void\n}\n\nexport const SESSION_IDLE_MS = 30 * 60_000\n\nfunction defaultStorage(): Storage | undefined {\n  try { return globalThis.sessionStorage } catch { return undefined }\n}\n\nfunction memorySession(): SessionStore {\n  return { id: newId(), storage: 'memory', touch() {} }\n}\n\n/** The session id lives in sessionStorage with a last-activity time, so a reload within 30 minutes keeps it. */\nexport function openSession(operatorId: string, now: number, storage: () => Storage | undefined = defaultStorage): SessionStore {\n  const key = `ss-w-session:${operatorId}`\n  try {\n    const store = storage()\n    if (!store) return memorySession()\n    let id: string | undefined\n    try {\n      const parsed: unknown = JSON.parse(store.getItem(key) ?? 'null')\n      if (typeof parsed === 'object' && parsed !== null) {\n        const p = parsed as { id?: unknown; last?: unknown }\n        if (typeof p.id === 'string' && p.id !== '' && typeof p.last === 'number' && now - p.last < SESSION_IDLE_MS) id = p.id\n      }\n    } catch { /* an unreadable value is a new session */ }\n    const sessionId = id ?? newId()\n    store.setItem(key, JSON.stringify({ id: sessionId, last: now }))\n    return {\n      id: sessionId,\n      storage: 'session',\n      touch(at) {\n        try { store.setItem(key, JSON.stringify({ id: sessionId, last: at })) } catch { /* telemetry never throws */ }\n      },\n    }\n  } catch {\n    return memorySession()\n  }\n}\n","export function knownZone(zone: string | undefined): string | undefined {\n  const z = zone?.trim()\n  if (!z) return undefined\n  try {\n    new Intl.DateTimeFormat('en', { timeZone: z })\n    return z\n  } catch {\n    return undefined\n  }\n}\n\nfunction browserZone(): string | undefined {\n  try {\n    return Intl.DateTimeFormat().resolvedOptions().timeZone\n  } catch {\n    return undefined\n  }\n}\n\nexport function visitorZone(explicit?: string): string | undefined {\n  return knownZone(explicit) ?? knownZone(browserZone())\n}\n","import { AuthError, ForbiddenError, isLimitCode, LimitError, NetworkError, RateLimitError, UpstreamError, WidgetSdkError } from './errors'\nimport type {\n  BuilderGridPayload, BuilderGridRequest, ClubFanDashboardPayload, ClubFixturesPayload, ClubSquadPayload, ClubSquadStatsPayload, ClubPlayerDetailPayload, ClubRecordsPayload, ClubStandingsPayload, GameListPayload, GameResultPayload, GameStatePayload, LeaderboardPayload,\n  FavouriteEntity, FavouriteKind, FavouritesNoIdentity, FavouritesPayload, FavouriteStarResponse, LeagueStarResult, LiveMonitorSnapshot, MarketOddsBlock, PinRef, PlayerPropsBundle, PresetGrid, PresetGridOptions, SchedulePayload, StatesPayload, SubmitPlayBody, TennisMatchKey, SubmitPlayResult,\n} from './events'\nimport type { WidgetEventName, WireContext, WireProps } from './eventLog'\nimport { newId } from './ids'\nimport { designed } from './responses'\nimport { openSession } from './session'\nimport { visitorZone } from './timeZone'\nimport type { SlipSport } from './sports'\nimport type { WidgetStrings } from './strings'\nimport type { ChatInput, FetchLike, WidgetSettings } from './types'\n\nexport interface ResolvedConfig {\n  operatorId: string\n  publicKey: string\n  baseUrl: string\n  fetch: FetchLike\n  client?: string\n  /** The visitor's IANA zone; the server writes its times and \"today\" in it. */\n  timeZone?: string\n}\n\nexport function headersFor(cfg: ResolvedConfig, json: boolean): Record<string, string> {\n  const h: Record<string, string> = json ? { 'Content-Type': 'application/json', 'X-SS-Public-Key': cfg.publicKey } : { 'X-SS-Public-Key': cfg.publicKey }\n  if (cfg.client) h['X-SS-Client'] = cfg.client\n  if (cfg.timeZone) h['X-SS-Time-Zone'] = cfg.timeZone\n  return h\n}\n\nconst OPERATOR_USER_ID_HEADER = 'X-SS-Operator-User-Id'\nconst ANONYMOUS_USER_ID_HEADER = 'X-SS-Anonymous-User-Id'\n\n// Same rule as the gateway's VisitorIdHeaders.IsValid: printable ASCII, 1 to 128 characters.\nconst SENDABLE_ID = /^[\\x20-\\x7E]{1,128}$/\n\n// Visitor ids travel in these two headers on every gateway call, never in the query string or the JSON\n// body. The trimmed id is sent (fetch strips edge whitespace anyway). An id that is blank or that the\n// gateway would reject is left out like a blank one, so a bad id can never make fetch throw.\nexport function isSendableId(id?: string): boolean {\n  const v = id?.trim()\n  return !!v && SENDABLE_ID.test(v)\n}\n\nexport function identityHeaders(operatorUserId?: string, anonymousUserId?: string): Record<string, string> {\n  const h: Record<string, string> = {}\n  if (isSendableId(operatorUserId)) h[OPERATOR_USER_ID_HEADER] = operatorUserId!.trim()\n  if (isSendableId(anonymousUserId)) h[ANONYMOUS_USER_ID_HEADER] = anonymousUserId!.trim()\n  return h\n}\n\ninterface BodyIds { operatorUserId?: string; anonymousUserId?: string }\n\nfunction splitIdentity(body: object): { identity: Record<string, string>; rest: Record<string, unknown> } {\n  const { operatorUserId, anonymousUserId, ...rest } = body as BodyIds & Record<string, unknown>\n  return { identity: identityHeaders(operatorUserId, anonymousUserId), rest }\n}\n\nfunction endpoint(cfg: ResolvedConfig, path: string): string {\n  return `${cfg.baseUrl.replace(/\\/+$/, '')}/v1/${encodeURIComponent(cfg.operatorId)}/${path}`\n}\n\nexport function toWidgetError(status: number, retryAfterHeader: string | null): WidgetSdkError {\n  switch (status) {\n    case 401: return new AuthError()\n    case 403: return new ForbiddenError()\n    case 429: {\n      const n = retryAfterHeader != null ? Number(retryAfterHeader) : undefined\n      return new RateLimitError(Number.isFinite(n) ? (n as number) : undefined)\n    }\n    default: return new UpstreamError(status)\n  }\n}\n\n// B4 Q7: a limit refusal is a 429 whose problem+json body names the limit. The gateway's own per-minute 429 sets\n// Retry-After without exposing it to browsers, so a missing header is normal: the body's retryAfterSeconds covers\n// it, and no countdown is shown when neither is present.\nexport async function chatError(res: Response): Promise<WidgetSdkError> {\n  const base = toWidgetError(res.status, res.headers.get('Retry-After'))\n  if (!(base instanceof RateLimitError)) return base\n  let body: unknown\n  try { body = await res.json() } catch { return base }\n  if (typeof body !== 'object' || body === null) return base\n  const b = body as Record<string, unknown>\n  if (!isLimitCode(b.errorCode)) return base\n  const text = (v: unknown): string | undefined => (typeof v === 'string' && v.trim() !== '' ? v : undefined)\n  const header = res.headers.get('Retry-After')?.trim()\n  const headerRetry = header != null && /^\\d+$/.test(header) ? Number(header) : undefined\n  const bodyRetry = typeof b.retryAfterSeconds === 'number' && Number.isFinite(b.retryAfterSeconds) && b.retryAfterSeconds >= 0 ? b.retryAfterSeconds : undefined\n  return new LimitError(\n    { limitCode: b.errorCode, resetsAt: text(b.resetsAt), message: text(b.message) },\n    headerRetry ?? bodyRetry,\n  )\n}\n\n// Statuses a route answers by design (\"feature off\", \"nothing here\", a refused id) are not failures: the observer skips them.\nfunction fetchDesigned(cfg: ResolvedConfig, statuses: readonly number[], url: string, init: RequestInit): Promise<Response> {\n  return cfg.fetch(url, designed(init, statuses))\n}\n\nfunction isAbort(error: unknown): boolean {\n  return error instanceof Error && error.name === 'AbortError'\n}\n\nasync function send(\n  cfg: ResolvedConfig, path: string, body: object, signal?: AbortSignal, identity: Record<string, string> = {},\n): Promise<Response> {\n  try {\n    return await cfg.fetch(endpoint(cfg, path), {\n      method: 'POST',\n      headers: { ...headersFor(cfg, true), ...identity },\n      body: JSON.stringify(body),\n      signal,\n    })\n  } catch (error) {\n    if (isAbort(error)) throw error\n    throw new NetworkError('Network request failed', error)\n  }\n}\n\nexport async function postChat(cfg: ResolvedConfig, input: ChatInput, signal: AbortSignal): Promise<Response> {\n  const { userContext, ...rest } = input\n  let body: object = rest\n  let identity: Record<string, string> = {}\n  if (userContext) {\n    const split = splitIdentity(userContext)\n    identity = split.identity\n    body = Object.keys(split.rest).length > 0 ? { ...rest, userContext: split.rest } : rest\n  }\n  const res = await send(cfg, 'chat', body, signal, identity)\n  if (!res.ok || res.body == null) throw await chatError(res)\n  return res\n}\n\nexport async function postSignal(cfg: ResolvedConfig, wireBody: object, signal?: AbortSignal): Promise<void> {\n  const { identity, rest } = splitIdentity(wireBody)\n  const res = await send(cfg, 'signals', rest, signal, identity)\n  if (!res.ok) throw toWidgetError(res.status, res.headers.get('Retry-After'))\n}\n\nexport async function postEvents(cfg: ResolvedConfig, batch: object): Promise<void> {\n  const { identity, rest } = splitIdentity(batch)\n  const res = await send(cfg, 'events', rest, undefined, identity)\n  if (!res.ok) throw toWidgetError(res.status, res.headers.get('Retry-After'))\n}\n\n// Best-effort tail flush on page hide/unload. Uses fetch keepalive (not sendBeacon) because the\n// gateway requires the X-SS-Public-Key header, which sendBeacon cannot set. Both the synchronous\n// call and the returned promise are guarded -- an async rejection (real network failure, or\n// Chrome's ~64KB keepalive body cap) must never surface as an unhandled rejection, since this\n// runs inside an operator-embedded widget during page-hide and would show up as noise in the\n// OPERATOR's own error monitoring.\nexport function postEventsKeepalive(cfg: ResolvedConfig, batch: object): void {\n  try {\n    const { identity, rest } = splitIdentity(batch)\n    void cfg.fetch(endpoint(cfg, 'events'), {\n      method: 'POST',\n      headers: { ...headersFor(cfg, true), ...identity },\n      body: JSON.stringify(rest),\n      keepalive: true,\n    }).catch(() => { /* best-effort tail flush -- swallow async rejection too */ })\n  } catch {\n    /* best-effort tail flush -- never throw on unload */\n  }\n}\n\n// One event sent with no widget running: the mobile page that never got a user has no logger to carry it.\nexport function postDirectEvent(\n  target: { operatorId: string; publicKey: string; baseUrl: string; fetch?: FetchLike; client?: string },\n  event: { name: WidgetEventName; props?: WireProps },\n  context: Omit<WireContext, 'storage'>,\n): void {\n  try {\n    const at = Date.now()\n    const session = openSession(target.operatorId, at)\n    session.touch(at)\n    const zone = visitorZone()\n    const cfg: ResolvedConfig = {\n      operatorId: target.operatorId,\n      publicKey: target.publicKey,\n      baseUrl: target.baseUrl,\n      fetch: target.fetch ?? ((input, init) => fetch(input, init)),\n      ...(target.client ? { client: target.client } : {}),\n      ...(zone ? { timeZone: zone } : {}),\n    }\n    postEventsKeepalive(cfg, {\n      v: 2,\n      batchId: newId(),\n      builtAt: at,\n      sessionId: session.id,\n      context: { ...context, storage: session.storage },\n      events: [{ ...event, eventId: newId(), seq: 1, at }],\n    })\n  } catch {\n    /* a direct event never throws into the page */\n  }\n}\n\nexport async function getWidgetSettings(cfg: ResolvedConfig): Promise<WidgetSettings> {\n  const res = await cfg.fetch(endpoint(cfg, 'widget-settings'), { method: 'GET', headers: headersFor(cfg, false) })\n  if (!res.ok) throw new Error(`widget-settings failed: ${res.status}`)\n  return (await res.json()) as WidgetSettings\n}\n\nexport async function getWidgetStrings(cfg: ResolvedConfig, lang?: string, v?: string): Promise<WidgetStrings> {\n  const res = await cfg.fetch(endpoint(cfg, 'strings' + q({ lang, v })), { method: 'GET', headers: headersFor(cfg, false) })\n  if (!res.ok) {\n    const err = toWidgetError(res.status, res.headers.get('Retry-After'))\n    throw err instanceof UpstreamError ? new UpstreamError(res.status, `strings failed: ${res.status}`) : err\n  }\n  return (await res.json()) as WidgetStrings\n}\n\nexport async function getLiveDashboard(cfg: ResolvedConfig): Promise<ClubFanDashboardPayload | null> {\n  const res = await cfg.fetch(endpoint(cfg, 'live-dashboard'), { method: 'GET', headers: headersFor(cfg, false) })\n  // 204 is the definitive \"not live / match over\" signal -- the poll loop stops on it.\n  // Any other non-ok status (e.g. a transient 502/503/504) must throw rather than return\n  // null, so the poll loop's per-tick try/catch retries on the next tick instead of stopping.\n  if (res.status === 204) return null\n  if (!res.ok) throw new Error(`live-dashboard ${res.status}`)\n  return (await res.json()) as ClubFanDashboardPayload\n}\n\n// 404 is the definitive \"live monitor disabled for this operator\" signal -- the poll loop\n// stops and the tabs disable. Any other non-ok status must throw so the per-tick\n// try/catch retries next tick instead of silently disabling the feature.\nexport async function postLiveMonitor(cfg: ResolvedConfig, pins: PinRef[], locale?: string): Promise<LiveMonitorSnapshot | null> {\n  const body: { pins: PinRef[]; locale?: string } = { pins }\n  if (locale) body.locale = locale\n  const res = await fetchDesigned(cfg, [404], endpoint(cfg, 'live-monitor'), {\n    method: 'POST',\n    headers: headersFor(cfg, true),\n    body: JSON.stringify(body),\n  })\n  if (res.status === 404) return null\n  if (!res.ok) throw new Error(`live-monitor ${res.status}`)\n  return (await res.json()) as LiveMonitorSnapshot\n}\n\nexport async function postMarketOdds(\n  cfg: ResolvedConfig, matchId: number, marketDeveloperName: string, sport?: SlipSport,\n): Promise<MarketOddsBlock | null> {\n  const body: { matchId: number; marketDeveloperName: string; sport?: SlipSport } = { matchId, marketDeveloperName }\n  if (sport) body.sport = sport\n  const res = await fetchDesigned(cfg, [404], endpoint(cfg, 'live-monitor/market'), {\n    method: 'POST',\n    headers: headersFor(cfg, true),\n    body: JSON.stringify(body),\n  })\n  if (res.status === 404) return null\n  if (!res.ok) throw new Error(`live-monitor/market ${res.status}`)\n  return (await res.json()) as MarketOddsBlock\n}\n\nexport async function postPlayerProps(cfg: ResolvedConfig, matchId: number, sport?: 'americanfootball', locale?: string): Promise<PlayerPropsBundle | null> {\n  const res = await fetchDesigned(cfg, [404], endpoint(cfg, 'live-monitor/props'), {\n    method: 'POST',\n    headers: headersFor(cfg, true),\n    body: JSON.stringify({ matchId, ...(sport ? { sport } : {}), ...(locale ? { locale } : {}) }),\n  })\n  if (res.status === 404) return null\n  if (!res.ok) throw new Error(`live-monitor/props ${res.status}`)\n  return (await res.json()) as PlayerPropsBundle\n}\n\n// 404 mirrors postLiveMonitor: the definitive \"live monitor disabled for this operator\" signal.\n// Every other non-ok status throws so the caller's per-tick catch retries next tick.\nexport async function postSchedule(\n  cfg: ResolvedConfig, localDate: string, utcOffsetMinutes: number,\n  operatorUserId?: string, anonymousUserId?: string,\n): Promise<SchedulePayload | null> {\n  const res = await fetchDesigned(cfg, [404], endpoint(cfg, 'live-monitor/schedule'), {\n    method: 'POST',\n    headers: { ...headersFor(cfg, true), ...identityHeaders(operatorUserId, anonymousUserId) },\n    body: JSON.stringify({ localDate, utcOffsetMinutes, sports: ['basketball', 'americanfootball', 'tennis'] }),\n  })\n  if (res.status === 404) return null\n  if (!res.ok) throw new Error(`live-monitor/schedule ${res.status}`)\n  return (await res.json()) as SchedulePayload\n}\n\nexport async function postLeagueStar(\n  cfg: ResolvedConfig, competitionId: number, starred: boolean,\n  operatorUserId?: string, anonymousUserId?: string,\n): Promise<LeagueStarResult | null> {\n  const res = await fetchDesigned(cfg, [404], endpoint(cfg, `leagues/${competitionId}/star`), {\n    method: 'POST',\n    headers: { ...headersFor(cfg, true), ...identityHeaders(operatorUserId, anonymousUserId) },\n    body: JSON.stringify({ starred }),\n  })\n  if (res.status === 404) return null\n  if (!res.ok) throw new Error(`leagues/star ${res.status}`)\n  return (await res.json()) as LeagueStarResult\n}\n\nexport async function postStates(\n  cfg: ResolvedConfig, matchIds: number[], nbaGameIds?: number[], nflGameIds?: number[], locale?: string,\n  tennisMatches?: TennisMatchKey[], tennisPriceMatches?: TennisMatchKey[],\n): Promise<StatesPayload | null> {\n  const res = await fetchDesigned(cfg, [404], endpoint(cfg, 'live-monitor/states'), {\n    method: 'POST',\n    headers: headersFor(cfg, true),\n    body: JSON.stringify({\n      matchIds,\n      ...(nbaGameIds?.length ? { nbaGameIds } : {}),\n      ...(nflGameIds?.length ? { nflGameIds } : {}),\n      ...(tennisMatches?.length ? { tennisMatches } : {}),\n      ...(tennisPriceMatches?.length ? { tennisPriceMatches } : {}),\n      ...(locale ? { locale } : {}),\n    }),\n  })\n  if (res.status === 404) return null\n  if (!res.ok) throw new Error(`live-monitor/states ${res.status}`)\n  return (await res.json()) as StatesPayload\n}\n\nfunction q(parts: Record<string, string | number | undefined>): string {\n  const kept = Object.entries(parts)\n    .filter(([, v]) => v !== undefined && v !== '')\n    .map(([k, v]) => `${k}=${encodeURIComponent(String(v))}`)\n  return kept.length ? `?${kept.join('&')}` : ''\n}\n\nexport async function getGames(cfg: ResolvedConfig, operatorUserId?: string, gameDay?: string): Promise<GameListPayload | null> {\n  const res = await fetchDesigned(cfg, [404], endpoint(cfg, 'games' + q({ gameDay })), { method: 'GET', headers: { ...headersFor(cfg, false), ...identityHeaders(operatorUserId) } })\n  if (res.status === 404) return null\n  if (!res.ok) throw new Error(`games ${res.status}`)\n  return (await res.json()) as GameListPayload\n}\n\nexport async function getGameConfig(cfg: ResolvedConfig, gameId: string, fixtureId?: number, gameDay?: string, locale?: string): Promise<GameStatePayload | null> {\n  const res = await fetchDesigned(cfg, [404], endpoint(cfg, `games/${encodeURIComponent(gameId)}` + q({ fixtureId, gameDay, locale })), { method: 'GET', headers: headersFor(cfg, false) })\n  if (res.status === 404) return null\n  if (!res.ok) throw new Error(`game-config ${res.status}`)\n  return (await res.json()) as GameStatePayload\n}\n\nexport async function getGameResult(cfg: ResolvedConfig, gameId: string, operatorUserId: string, fixtureId?: number, gameDay?: string, locale?: string): Promise<GameResultPayload | null> {\n  const res = await fetchDesigned(cfg, [404], endpoint(cfg, `games/${encodeURIComponent(gameId)}/result` + q({ fixtureId, gameDay, locale })), { method: 'GET', headers: { ...headersFor(cfg, false), ...identityHeaders(operatorUserId) } })\n  if (res.status === 404) return null\n  if (!res.ok) throw new Error(`game-result ${res.status}`)\n  return (await res.json()) as GameResultPayload\n}\n\nexport async function postPlay(cfg: ResolvedConfig, gameId: string, body: SubmitPlayBody, locale?: string): Promise<SubmitPlayResult | null> {\n  const { identity, rest } = splitIdentity(body)\n  const res = await fetchDesigned(cfg, [404], endpoint(cfg, `games/${encodeURIComponent(gameId)}/plays` + q({ locale })), {\n    method: 'POST',\n    headers: { ...headersFor(cfg, true), ...identity },\n    body: JSON.stringify(rest),\n  })\n  if (res.status === 404) return null\n  if (!res.ok) throw new Error(`play ${res.status}`)\n  return (await res.json()) as SubmitPlayResult\n}\n\nexport async function getLeaderboard(cfg: ResolvedConfig, operatorUserId?: string, week?: string): Promise<LeaderboardPayload | null> {\n  const res = await fetchDesigned(cfg, [404], endpoint(cfg, 'games/leaderboard' + q({ week })), { method: 'GET', headers: { ...headersFor(cfg, false), ...identityHeaders(operatorUserId) } })\n  if (res.status === 404) return null\n  if (!res.ok) throw new Error(`leaderboard ${res.status}`)\n  return (await res.json()) as LeaderboardPayload\n}\n\nexport async function getClubFixtures(cfg: ResolvedConfig, competitionId?: number, limit?: number): Promise<ClubFixturesPayload | null> {\n  const res = await fetchDesigned(cfg, [404], endpoint(cfg, 'club/fixtures' + q({ competitionId, limit })), { method: 'GET', headers: headersFor(cfg, false) })\n  if (res.status === 404) return null\n  if (!res.ok) throw new Error(`club-fixtures ${res.status}`)\n  return (await res.json()) as ClubFixturesPayload\n}\n\nexport async function getClubStandings(cfg: ResolvedConfig, competitionId?: number): Promise<ClubStandingsPayload | null> {\n  const res = await fetchDesigned(cfg, [404], endpoint(cfg, 'club/standings' + q({ competitionId })), { method: 'GET', headers: headersFor(cfg, false) })\n  if (res.status === 404) return null\n  if (!res.ok) throw new Error(`club-standings ${res.status}`)\n  return (await res.json()) as ClubStandingsPayload\n}\n\nexport async function getClubSquad(cfg: ResolvedConfig): Promise<ClubSquadPayload | null> {\n  const res = await fetchDesigned(cfg, [404], endpoint(cfg, 'club/squad'), { method: 'GET', headers: headersFor(cfg, false) })\n  if (res.status === 404) return null\n  if (!res.ok) throw new Error(`club-squad ${res.status}`)\n  return (await res.json()) as ClubSquadPayload\n}\n\nexport async function getClubSquadStats(cfg: ResolvedConfig): Promise<ClubSquadStatsPayload | null> {\n  const res = await fetchDesigned(cfg, [404], endpoint(cfg, 'club/squad/stats'), { method: 'GET', headers: headersFor(cfg, false) })\n  if (res.status === 404) return null\n  if (!res.ok) throw new Error(`club-squad-stats ${res.status}`)\n  return (await res.json()) as ClubSquadStatsPayload\n}\n\nexport async function getClubPlayerDetail(cfg: ResolvedConfig, playerId: number): Promise<ClubPlayerDetailPayload | null> {\n  const res = await fetchDesigned(cfg, [404], endpoint(cfg, `club/player/${encodeURIComponent(String(playerId))}`), { method: 'GET', headers: headersFor(cfg, false) })\n  if (res.status === 404) return null\n  if (!res.ok) throw new Error(`club-player ${res.status}`)\n  return (await res.json()) as ClubPlayerDetailPayload\n}\n\nexport async function getClubRecords(cfg: ResolvedConfig, limit?: number): Promise<ClubRecordsPayload | null> {\n  const res = await fetchDesigned(cfg, [404], endpoint(cfg, 'club/records' + q({ limit })), { method: 'GET', headers: headersFor(cfg, false) })\n  if (res.status === 404) return null\n  if (!res.ok) throw new Error(`club-records ${res.status}`)\n  return (await res.json()) as ClubRecordsPayload\n}\n\n// Onboarding presets stage 2 (contract §1). 404 is the definitive \"no presets for this visitor\"\n// answer (flag off, not a betting operator, or cool-off). 503 and every other non-ok status throw:\n// the widget keeps any grid it already has and asks again on the next panel open.\n// operatorUserId is optional, sent as the games routes send it (in its header): the cool-off check (D3)\n// needs it, and a request without it is an anonymous visitor.\nexport async function getPricePresets(\n  cfg: ResolvedConfig, locale?: string, operatorUserId?: string, options?: PresetGridOptions, anonymousUserId?: string,\n): Promise<PresetGrid | null> {\n  const res = await fetchDesigned(cfg, [404], endpoint(cfg, 'price-presets' + q({ locale, pool: options?.pool })), { method: 'GET', headers: { ...headersFor(cfg, false), ...identityHeaders(operatorUserId, anonymousUserId) } })\n  if (res.status === 404) return null\n  if (!res.ok) throw new Error(`price-presets ${res.status}`)\n  return (await res.json()) as PresetGrid\n}\n\n// 404 is the cool-off / non-betting-operator answer, as getPricePresets. Identity travels in headers only, never the query.\nexport async function getBuilderGrid(\n  cfg: ResolvedConfig, locale: string | undefined, req: BuilderGridRequest,\n): Promise<BuilderGridPayload | null> {\n  const query = q({\n    locale,\n    sport: req.sport,\n    legs: req.legs,\n    total: req.total,\n    marketKey: req.marketKey ?? undefined,\n    matchIds: req.widen ? undefined : req.matchIds.join(','),\n    widen: req.widen ? 'true' : undefined,\n    allLegs: req.allLegs ? 'true' : undefined,\n    variant: req.variant || undefined,\n    keep: req.keep?.length ? [...req.keep].sort((a, b) => a - b).join(',') : undefined,\n    swapped: req.swapped?.length ? [...req.swapped].sort((a, b) => a - b).join(',') : undefined,\n    reprice: req.reprice,\n  })\n  const res = await fetchDesigned(cfg, [404], endpoint(cfg, 'price-presets' + query), {\n    method: 'GET',\n    headers: { ...headersFor(cfg, false), ...identityHeaders(req.operatorUserId, req.anonymousUserId) },\n  })\n  if (res.status === 404) return null\n  if (!res.ok) throw new Error(`price-presets ${res.status}`)\n  return (await res.json()) as BuilderGridPayload\n}\n\n// Favourites routes carry identity in headers only and send no body. A non-ok answer, including the\n// gateway's 429 TooManyVisitorIds, resolves the call's failure value; only a transport failure throws.\nfunction favouritePath(kind: FavouriteKind, id: string): string {\n  return `favourites/${encodeURIComponent(kind)}/${encodeURIComponent(id)}`\n}\n\nfunction favouritesFetch(\n  cfg: ResolvedConfig, method: 'GET' | 'PUT' | 'POST' | 'DELETE', path: string, designedStatuses: readonly number[], operatorUserId?: string, anonymousUserId?: string,\n): Promise<Response> {\n  return fetchDesigned(cfg, designedStatuses, endpoint(cfg, path), { method, headers: { ...headersFor(cfg, false), ...identityHeaders(operatorUserId, anonymousUserId) } })\n}\n\nexport async function getFavourites(\n  cfg: ResolvedConfig, sport: string, operatorUserId?: string, anonymousUserId?: string,\n): Promise<FavouritesPayload | FavouritesNoIdentity | null> {\n  const res = await favouritesFetch(cfg, 'GET', 'favourites' + q({ sport }), [400], operatorUserId, anonymousUserId)\n  if (res.status === 400) {\n    const body = (await res.json().catch(() => null)) as { code?: string } | null\n    return body?.code === 'NoAcceptedIdentity' ? 'noAcceptedIdentity' : null\n  }\n  if (!res.ok) return null\n  return (await res.json()) as FavouritesPayload\n}\n\nconst MIN_FAVOURITES_QUERY = 2\n\nexport async function searchFavourites(\n  cfg: ResolvedConfig, sport: string, query: string, kind: FavouriteKind, operatorUserId?: string, anonymousUserId?: string,\n): Promise<FavouriteEntity[] | null> {\n  const text = query.trim()\n  if (text.length < MIN_FAVOURITES_QUERY) return []\n  const res = await favouritesFetch(cfg, 'GET', 'favourites/search' + q({ sport, q: text, kind }), [], operatorUserId, anonymousUserId)\n  if (!res.ok) return null\n  return ((await res.json()) as { results: FavouriteEntity[] }).results\n}\n\n// A 409 whose body says atCap is an answer, not a failure: it carries the count and cap.\nexport async function putFavourite(\n  cfg: ResolvedConfig, kind: FavouriteKind, id: string, operatorUserId?: string, anonymousUserId?: string,\n): Promise<FavouriteStarResponse | null> {\n  const res = await favouritesFetch(cfg, 'PUT', favouritePath(kind, id), [409], operatorUserId, anonymousUserId)\n  if (res.ok) return (await res.json()) as FavouriteStarResponse\n  if (res.status !== 409) return null\n  const body = (await res.json().catch(() => null)) as { status?: string; count?: number; cap?: number } | null\n  return body?.status === 'atCap' ? { status: 'atCap', count: body.count, cap: body.cap } : null\n}\n\nexport async function deleteFavourite(\n  cfg: ResolvedConfig, kind: FavouriteKind, id: string, operatorUserId?: string, anonymousUserId?: string,\n): Promise<boolean> {\n  return (await favouritesFetch(cfg, 'DELETE', favouritePath(kind, id), [], operatorUserId, anonymousUserId)).ok\n}\n\nexport async function clearFavourites(\n  cfg: ResolvedConfig, sport: string, operatorUserId?: string, anonymousUserId?: string,\n): Promise<boolean> {\n  return (await favouritesFetch(cfg, 'DELETE', 'favourites' + q({ sport }), [], operatorUserId, anonymousUserId)).ok\n}\n\n// 404 NotLearned and 409 Starred are not ok, so both resolve false.\nexport async function hideFavourite(\n  cfg: ResolvedConfig, kind: FavouriteKind, id: string, operatorUserId?: string, anonymousUserId?: string,\n): Promise<boolean> {\n  return (await favouritesFetch(cfg, 'POST', `${favouritePath(kind, id)}/hide`, [404, 409], operatorUserId, anonymousUserId)).ok\n}\n","import { ParseError } from './errors'\n\nexport interface NdjsonParser {\n  push(text: string): unknown[]\n  flush(): unknown[]\n}\n\nfunction parseLine(line: string): unknown | undefined {\n  const trimmed = line.trim()\n  if (trimmed === '') return undefined\n  try {\n    return JSON.parse(trimmed)\n  } catch {\n    throw new ParseError('Malformed NDJSON line', line)\n  }\n}\n\nexport function createNdjsonParser(): NdjsonParser {\n  let buffer = ''\n  return {\n    push(text: string): unknown[] {\n      buffer += text\n      const out: unknown[] = []\n      let idx: number\n      while ((idx = buffer.indexOf('\\n')) >= 0) {\n        const line = buffer.slice(0, idx)\n        buffer = buffer.slice(idx + 1)\n        const parsed = parseLine(line)\n        if (parsed !== undefined) out.push(parsed)\n      }\n      return out\n    },\n    flush(): unknown[] {\n      const rest = buffer\n      buffer = ''\n      const parsed = parseLine(rest)\n      return parsed === undefined ? [] : [parsed]\n    },\n  }\n}\n","import { NetworkError, WidgetSdkError } from './errors'\nimport type {\n  ActionButtonEventData, ActionsLoadingEventData, AnswerEventData, ChatEvent,\n  EntityCardEventData, IntentChipEventData, ProgressEventData, StreamErrorEventData, TurnCompleteEventData,\n} from './events'\nimport { postChat, type ResolvedConfig } from './http'\nimport { createNdjsonParser } from './ndjson'\nimport type { ChatInput } from './types'\n\nexport interface ChatCallbacks {\n  onProgress?(data: ProgressEventData): void\n  onAnswer?(data: AnswerEventData): void\n  onEntityCard?(data: EntityCardEventData): void\n  onActionButton?(data: ActionButtonEventData): void\n  onIntentChip?(data: IntentChipEventData): void\n  onActionsLoading?(data: ActionsLoadingEventData): void\n  onError?(error: StreamErrorEventData | WidgetSdkError): void\n  onComplete?(data: TurnCompleteEventData): void\n}\n\nexport interface ChatHandle extends AsyncIterable<ChatEvent>, PromiseLike<void> {\n  cancel(): void\n}\n\nfunction dispatch(ev: ChatEvent, cb: ChatCallbacks): void {\n  switch (ev.type) {\n    case 'progress': cb.onProgress?.(ev.data); break\n    case 'answer': cb.onAnswer?.(ev.data); break\n    case 'entity_card': cb.onEntityCard?.(ev.data); break\n    case 'action_button': cb.onActionButton?.(ev.data); break\n    case 'intent_chip': cb.onIntentChip?.(ev.data); break\n    case 'actions_loading': cb.onActionsLoading?.(ev.data); break\n    case 'turn_complete': cb.onComplete?.(ev.data); break\n    case 'error': cb.onError?.(ev.data); break\n  }\n}\n\nfunction isAbort(error: unknown): boolean {\n  return error instanceof Error && error.name === 'AbortError'\n}\n\nasync function* streamEvents(cfg: ResolvedConfig, input: ChatInput, signal: AbortSignal): AsyncGenerator<ChatEvent> {\n  const res = await postChat(cfg, input, signal)\n  const reader = res.body!.getReader()\n  const decoder = new TextDecoder()\n  const parser = createNdjsonParser()\n  try {\n    for (;;) {\n      let chunk: ReadableStreamReadResult<Uint8Array>\n      try {\n        chunk = await reader.read()\n      } catch (error) {\n        if (isAbort(error)) throw error\n        throw new NetworkError('Network request failed', error)\n      }\n      const { done, value } = chunk\n      if (done) break\n      for (const obj of parser.push(decoder.decode(value, { stream: true }))) yield obj as ChatEvent\n    }\n    for (const obj of parser.flush()) yield obj as ChatEvent\n  } finally {\n    await reader.cancel().catch(() => {})\n  }\n}\n\nexport function runChat(\n  cfg: ResolvedConfig,\n  input: ChatInput,\n  callbacks?: ChatCallbacks,\n  opts?: { signal?: AbortSignal; tap?: (ev: ChatEvent) => void },\n): ChatHandle {\n  const controller = new AbortController()\n  const external = opts?.signal\n  if (external) {\n    if (external.aborted) controller.abort()\n    else external.addEventListener('abort', () => controller.abort(), { once: true })\n  }\n\n  async function* source(): AsyncGenerator<ChatEvent> {\n    for await (const ev of streamEvents(cfg, input, controller.signal)) {\n      opts?.tap?.(ev)\n      yield ev\n    }\n  }\n\n  const iterator = source()\n  let consumed = false\n\n  async function drive(): Promise<void> {\n    try {\n      for await (const ev of iterator) { if (callbacks) dispatch(ev, callbacks) }\n    } catch (error) {\n      if (callbacks?.onError && error instanceof WidgetSdkError) { callbacks.onError(error); return }\n      throw error\n    }\n  }\n\n  return {\n    [Symbol.asyncIterator](): AsyncIterator<ChatEvent> {\n      if (consumed) throw new Error('chat stream already consumed')\n      consumed = true\n      return iterator\n    },\n    then<TResult1 = void, TResult2 = never>(\n      onfulfilled?: ((value: void) => TResult1 | PromiseLike<TResult1>) | null,\n      onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null,\n    ): PromiseLike<TResult1 | TResult2> {\n      if (consumed) return Promise.resolve().then(onfulfilled, onrejected)\n      consumed = true\n      return drive().then(onfulfilled, onrejected)\n    },\n    cancel(): void { controller.abort() },\n  }\n}\n","import type { SignalEntityType, SignalInput, SignalType } from './types'\n\nexport const SIGNAL_TYPE_CODES: Record<SignalType, number> = {\n  MatchPageView: 1, PlayerPageView: 2, TeamPageView: 3, MarketView: 4,\n  SearchQuery: 5, SessionDepth: 6, TimeOnPage: 7, InsightViewed: 8,\n  InsightMarketClicked: 9, BetPlacedFromInsight: 10, InsightScrollDepth: 11,\n  ToolCall: 12, EntityMention: 13, Handoff: 14, FollowUpQuery: 15, RecommendationDismissed: 16,\n}\n\nexport const ENTITY_TYPE_CODES: Record<SignalEntityType, number> = {\n  Match: 1, Team: 2, Player: 3, Competition: 4, Market: 5,\n  Article: 6, Session: 7, Query: 8, Conversation: 9,\n}\n\nexport function toSignalWireBody(input: SignalInput): {\n  signalType: number; entityType: number; entityName?: string; entityId?: string\n  operatorUserId?: string; anonymousUserId?: string; dashboardLayout?: string; tileIndex?: number\n  sport?: string\n} {\n  const signalType = SIGNAL_TYPE_CODES[input.signalType]\n  const entityType = ENTITY_TYPE_CODES[input.entityType]\n  if (signalType === undefined) throw new Error(`Unknown signalType: ${String(input.signalType)}`)\n  if (entityType === undefined) throw new Error(`Unknown entityType: ${String(input.entityType)}`)\n  return {\n    signalType, entityType, entityName: input.entityName, entityId: input.entityId,\n    operatorUserId: input.operatorUserId, anonymousUserId: input.anonymousUserId,\n    dashboardLayout: input.dashboardLayout, tileIndex: input.tileIndex, sport: input.sport,\n  }\n}\n","import { runChat, type ChatCallbacks, type ChatHandle } from './chat'\nimport type {\n  BuilderGridPayload, BuilderGridRequest, ClubFanDashboardPayload, ClubFixturesPayload, ClubSquadPayload, ClubSquadStatsPayload, ClubPlayerDetailPayload, ClubRecordsPayload, ClubStandingsPayload, GameListPayload, GameResultPayload, GameStatePayload, LeaderboardPayload,\n  FavouriteEntity, FavouriteKind, FavouritesNoIdentity, FavouritesPayload, FavouriteStarResponse, LeagueStarResult, LiveMonitorSnapshot, MarketOddsBlock, PinRef, PlayerPropsBundle, PresetGrid, PresetGridOptions, SchedulePayload, StatesPayload, SubmitPlayResult, TennisMatchKey,\n} from './events'\nimport {\n  clearFavourites, deleteFavourite, getFavourites, hideFavourite, putFavourite, searchFavourites,\n  getClubFixtures, getClubPlayerDetail, getClubRecords, getClubSquad, getClubSquadStats, getClubStandings, getGameConfig, getGameResult, getGames, getLeaderboard, getLiveDashboard, getWidgetSettings, getWidgetStrings, getBuilderGrid, getPricePresets,\n  postLeagueStar, postLiveMonitor, postMarketOdds, postPlayerProps, postPlay, postSchedule, postSignal, postStates, type ResolvedConfig,\n} from './http'\nimport { toSignalWireBody } from './signals'\nimport type { SlipSport } from './sports'\nimport type { WidgetStrings } from './strings'\nimport type { ChatInput, SignalInput, UserContext, WidgetSettings } from './types'\n\nexport class Conversation {\n  conversationId?: string\n\n  constructor(private readonly cfg: ResolvedConfig, private readonly context?: UserContext) {}\n\n  send(input: ChatInput, callbacks?: ChatCallbacks): ChatHandle {\n    const mergedContext: UserContext = { ...this.context, ...input.userContext }\n    const full: ChatInput = {\n      ...input,\n      conversationId: input.conversationId ?? this.conversationId,\n      userContext: Object.keys(mergedContext).length > 0 ? mergedContext : undefined,\n    }\n    return runChat(this.cfg, full, callbacks, {\n      tap: (ev) => { if (ev.type === 'turn_complete') this.conversationId = ev.data.conversationId },\n    })\n  }\n\n  sendSignal(input: SignalInput): Promise<void> {\n    const operatorUserId = input.operatorUserId ?? this.context?.operatorUserId\n    const anonymousUserId = input.anonymousUserId ?? this.context?.anonymousUserId\n    if (!operatorUserId && !anonymousUserId) {\n      throw new Error('operatorUserId or anonymousUserId is required (set it on conversation() or pass it to sendSignal)')\n    }\n    if (!input.entityId && !input.entityName) {\n      throw new Error('entityId or entityName is required')\n    }\n    return postSignal(this.cfg, toSignalWireBody({ ...input, operatorUserId, anonymousUserId }))\n  }\n\n  getWidgetSettings(): Promise<WidgetSettings> {\n    return getWidgetSettings(this.cfg)\n  }\n\n  getWidgetStrings(lang?: string, v?: string): Promise<WidgetStrings> {\n    return getWidgetStrings(this.cfg, lang, v)\n  }\n\n  getLiveDashboard(): Promise<ClubFanDashboardPayload | null> {\n    return getLiveDashboard(this.cfg)\n  }\n\n  getLiveMonitor(pins: PinRef[], locale?: string): Promise<LiveMonitorSnapshot | null> {\n    return postLiveMonitor(this.cfg, pins, locale)\n  }\n\n  getMarketOdds(matchId: number, marketDeveloperName: string, sport?: SlipSport): Promise<MarketOddsBlock | null> {\n    return postMarketOdds(this.cfg, matchId, marketDeveloperName, sport)\n  }\n\n  getPlayerProps(matchId: number, sport?: 'americanfootball', locale?: string): Promise<PlayerPropsBundle | null> {\n    return postPlayerProps(this.cfg, matchId, sport, locale)\n  }\n\n  getPricePresets(locale?: string, options?: PresetGridOptions): Promise<PresetGrid | null> {\n    return getPricePresets(this.cfg, locale, this.context?.operatorUserId, options, this.context?.anonymousUserId)\n  }\n\n  getBuilderGrid(locale: string | undefined, req: BuilderGridRequest): Promise<BuilderGridPayload | null> {\n    return getBuilderGrid(this.cfg, locale, req)\n  }\n\n  getSchedule(\n    localDate: string, utcOffsetMinutes: number, operatorUserId?: string, anonymousUserId?: string,\n  ): Promise<SchedulePayload | null> {\n    return postSchedule(this.cfg, localDate, utcOffsetMinutes, operatorUserId, anonymousUserId)\n  }\n\n  starLeague(\n    competitionId: number, starred: boolean, operatorUserId?: string, anonymousUserId?: string,\n  ): Promise<LeagueStarResult | null> {\n    return postLeagueStar(this.cfg, competitionId, starred, operatorUserId, anonymousUserId)\n  }\n\n  getFavourites(sport: string, operatorUserId?: string, anonymousUserId?: string): Promise<FavouritesPayload | FavouritesNoIdentity | null> {\n    return getFavourites(this.cfg, sport, operatorUserId, anonymousUserId)\n  }\n\n  searchFavourites(\n    sport: string, query: string, kind: FavouriteKind, operatorUserId?: string, anonymousUserId?: string,\n  ): Promise<FavouriteEntity[] | null> {\n    return searchFavourites(this.cfg, sport, query, kind, operatorUserId, anonymousUserId)\n  }\n\n  putFavourite(kind: FavouriteKind, id: string, operatorUserId?: string, anonymousUserId?: string): Promise<FavouriteStarResponse | null> {\n    return putFavourite(this.cfg, kind, id, operatorUserId, anonymousUserId)\n  }\n\n  deleteFavourite(kind: FavouriteKind, id: string, operatorUserId?: string, anonymousUserId?: string): Promise<boolean> {\n    return deleteFavourite(this.cfg, kind, id, operatorUserId, anonymousUserId)\n  }\n\n  clearFavourites(sport: string, operatorUserId?: string, anonymousUserId?: string): Promise<boolean> {\n    return clearFavourites(this.cfg, sport, operatorUserId, anonymousUserId)\n  }\n\n  hideFavourite(kind: FavouriteKind, id: string, operatorUserId?: string, anonymousUserId?: string): Promise<boolean> {\n    return hideFavourite(this.cfg, kind, id, operatorUserId, anonymousUserId)\n  }\n\n  getStates(matchIds: number[], nbaGameIds?: number[], nflGameIds?: number[], locale?: string, tennisMatches?: TennisMatchKey[], tennisPriceMatches?: TennisMatchKey[]): Promise<StatesPayload | null> {\n    return postStates(this.cfg, matchIds, nbaGameIds, nflGameIds, locale, tennisMatches, tennisPriceMatches)\n  }\n\n  getGames(gameDay?: string): Promise<GameListPayload | null> {\n    return getGames(this.cfg, this.context?.operatorUserId, gameDay)\n  }\n\n  getGameConfig(gameId: string, fixtureId?: number, gameDay?: string, locale?: string): Promise<GameStatePayload | null> {\n    return getGameConfig(this.cfg, gameId, fixtureId, gameDay, locale)\n  }\n\n  getGameResult(gameId: string, fixtureId?: number, gameDay?: string, locale?: string): Promise<GameResultPayload | null> {\n    const operatorUserId = this.context?.operatorUserId\n    if (!operatorUserId) return Promise.resolve(null)\n    return getGameResult(this.cfg, gameId, operatorUserId, fixtureId, gameDay, locale)\n  }\n\n  postPlay(gameId: string, answerJson: string, gameDay: string, fixtureId?: number, locale?: string): Promise<SubmitPlayResult | null> {\n    const operatorUserId = this.context?.operatorUserId\n    if (!operatorUserId) return Promise.resolve(null)\n    return postPlay(this.cfg, gameId, { operatorUserId, gameDay, answerJson, fixtureId }, locale)\n  }\n\n  getLeaderboard(week?: string): Promise<LeaderboardPayload | null> {\n    return getLeaderboard(this.cfg, this.context?.operatorUserId, week)\n  }\n\n  getClubFixtures(competitionId?: number, limit?: number): Promise<ClubFixturesPayload | null> {\n    return getClubFixtures(this.cfg, competitionId, limit)\n  }\n  getClubStandings(competitionId?: number): Promise<ClubStandingsPayload | null> {\n    return getClubStandings(this.cfg, competitionId)\n  }\n  getClubSquad(): Promise<ClubSquadPayload | null> {\n    return getClubSquad(this.cfg)\n  }\n  getClubSquadStats(): Promise<ClubSquadStatsPayload | null> {\n    return getClubSquadStats(this.cfg)\n  }\n  getClubPlayerDetail(playerId: number): Promise<ClubPlayerDetailPayload | null> {\n    return getClubPlayerDetail(this.cfg, playerId)\n  }\n  getClubRecords(limit?: number): Promise<ClubRecordsPayload | null> {\n    return getClubRecords(this.cfg, limit)\n  }\n}\n","import type { EventBatch } from './eventLog'\n\nexport const PENDING_TTL_MS = 7 * 24 * 3_600_000\nexport const PENDING_MAX_EVENTS = 200\nexport const PENDING_MAX_BYTES = 256 * 1024\n\nexport interface CarryOverStore {\n  has(): boolean\n  save(owner: string, batches: readonly EventBatch[], keepaliveSent: ReadonlySet<string>, now: number): ReadonlySet<string>\n  remove(batchId: string): void\n  take(owner: string, now: number): EventBatch[]\n  addDropped(count: number): void\n  takeDropped(): number\n}\n\ninterface Entry {\n  owner: string\n  savedAt: number\n  keepalive: boolean\n  batch: EventBatch\n}\n\nexport function utf8Bytes(s: string): number {\n  let n = 0\n  for (let i = 0; i < s.length; i++) {\n    const c = s.charCodeAt(i)\n    if (c < 0x80) n += 1\n    else if (c < 0x800) n += 2\n    else if (c >= 0xd800 && c <= 0xdbff && i + 1 < s.length && (s.charCodeAt(i + 1) & 0xfc00) === 0xdc00) { n += 4; i++ }\n    else n += 3\n  }\n  return n\n}\n\nfunction defaultStorage(): Storage | undefined {\n  try { return globalThis.localStorage } catch { return undefined }\n}\n\nfunction isEntry(v: unknown): v is Entry {\n  if (typeof v !== 'object' || v === null) return false\n  const e = v as Partial<Entry>\n  const b = e.batch as Partial<EventBatch> | undefined\n  return typeof e.owner === 'string' && typeof e.savedAt === 'number' && typeof b === 'object' && b !== null\n    && typeof b.batchId === 'string' && typeof b.builtAt === 'number' && Array.isArray(b.events)\n}\n\n// A copy of the batch for storage: typed text never goes to localStorage, so a question's text is cut from the copy.\nfunction storedCopy(batch: EventBatch): EventBatch {\n  const copy = JSON.parse(JSON.stringify(batch)) as EventBatch\n  for (const event of copy.events) {\n    const props = (event as { props?: Record<string, unknown> }).props\n    if (event.name === 'question_asked' && props && typeof props === 'object') delete props.text\n  }\n  return copy\n}\n\n/** Batches the page could not confirm, kept for the next visit. Null when localStorage is blocked. */\nexport function openCarryOver(operatorId: string, storage: () => Storage | undefined = defaultStorage): CarryOverStore | null {\n  const batchesKey = `ss-w-pending:${operatorId}`\n  const droppedKey = `ss-w-pending-dropped:${operatorId}`\n  const probeKey = `ss-w-pending-probe:${operatorId}`\n\n  try {\n    const probe = storage()\n    if (!probe) return null\n    probe.setItem(probeKey, '1')\n    probe.removeItem(probeKey)\n  } catch {\n    return null\n  }\n\n  const read = (): Entry[] => {\n    try {\n      const raw = storage()?.getItem(batchesKey)\n      if (!raw) return []\n      const parsed: unknown = JSON.parse(raw)\n      if (typeof parsed !== 'object' || parsed === null) return []\n      const entries = (parsed as { entries?: unknown }).entries\n      return Array.isArray(entries) ? entries.filter(isEntry) : []\n    } catch {\n      return []\n    }\n  }\n\n  const write = (entries: readonly Entry[]): boolean => {\n    try {\n      const s = storage()\n      if (!s) return false\n      if (entries.length === 0) s.removeItem(batchesKey)\n      else s.setItem(batchesKey, JSON.stringify({ v: 2, entries }))\n      return true\n    } catch {\n      return false\n    }\n  }\n\n  const addDropped = (count: number): void => {\n    try {\n      if (!(count > 0)) return\n      const s = storage()\n      if (!s) return\n      const current = Number(s.getItem(droppedKey) ?? 0)\n      s.setItem(droppedKey, String((Number.isFinite(current) && current > 0 ? current : 0) + count))\n    } catch { /* telemetry never throws */ }\n  }\n\n  const alive = (e: Entry, now: number): boolean => now - e.savedAt < PENDING_TTL_MS\n\n  return {\n    has: () => read().length > 0,\n\n    save(owner, batches, keepaliveSent, now) {\n      const written = new Set<string>()\n      try {\n        const entries = read().filter((e) => alive(e, now))\n        for (const batch of batches) {\n          const existing = entries.find((e) => e.batch.batchId === batch.batchId)\n          if (existing) {\n            existing.owner = owner\n            existing.keepalive = existing.keepalive || keepaliveSent.has(batch.batchId)\n          } else {\n            entries.push({ owner, savedAt: now, keepalive: keepaliveSent.has(batch.batchId), batch: storedCopy(batch) })\n          }\n        }\n\n        let events = 0\n        let bytes = 0\n        const sizes = new Map<Entry, number>()\n        for (const e of entries) {\n          events += e.batch.events.length\n          const size = utf8Bytes(JSON.stringify(e))\n          sizes.set(e, size)\n          bytes += size\n        }\n        const live = new Set(batches.map((b) => b.batchId))\n        let trimmedEvents = 0\n        while (entries.length > 0 && (events > PENDING_MAX_EVENTS || bytes > PENDING_MAX_BYTES)) {\n          let oldest = 0\n          for (let i = 1; i < entries.length; i++) {\n            if (entries[i]!.batch.builtAt < entries[oldest]!.batch.builtAt) oldest = i\n          }\n          const [gone] = entries.splice(oldest, 1)\n          events -= gone!.batch.events.length\n          bytes -= sizes.get(gone!)!\n          if (!gone!.keepalive && !live.has(gone!.batch.batchId)) trimmedEvents += gone!.batch.events.length\n        }\n\n        if (!write(entries)) return written\n        for (const b of batches) if (entries.some((e) => e.batch.batchId === b.batchId)) written.add(b.batchId)\n        addDropped(trimmedEvents)\n      } catch { /* return what was written */ }\n      return written\n    },\n\n    remove(batchId) {\n      try {\n        const entries = read()\n        const kept = entries.filter((e) => e.batch.batchId !== batchId)\n        if (kept.length !== entries.length) write(kept)\n      } catch { /* telemetry never throws */ }\n    },\n\n    take(owner, now) {\n      try {\n        const entries = read()\n        const live = entries.filter((e) => alive(e, now))\n        if (live.length !== entries.length) write(live)\n        return live\n          .map((e, i) => ({ e, i }))\n          .filter(({ e }) => e.owner !== owner)\n          .sort((a, b) => a.e.batch.builtAt - b.e.batch.builtAt || a.i - b.i)\n          .map(({ e }) => e.batch)\n      } catch {\n        return []\n      }\n    },\n\n    addDropped,\n\n    takeDropped() {\n      try {\n        const s = storage()\n        if (!s) return 0\n        const raw = s.getItem(droppedKey)\n        if (raw === null) return 0\n        s.removeItem(droppedKey)\n        const n = Number(raw)\n        return Number.isFinite(n) && n > 0 ? n : 0\n      } catch {\n        return 0\n      }\n    },\n  }\n}\n","import type { WidgetEventName } from './eventLog'\n\nexport type DeliveryClass = 'immediate' | 'timer' | 'deferred' | 'held'\n\nexport const DELIVERY_CLASS: Readonly<Record<WidgetEventName, DeliveryClass>> = {\n  pin_add: 'immediate',\n  pin_remove: 'immediate',\n  slip_click: 'immediate',\n  slip_result: 'immediate',\n  slip_remove: 'immediate',\n  bet_placed: 'immediate',\n  combo_add: 'immediate',\n  fact_ask: 'immediate',\n  market_choose: 'immediate',\n  host_bet_placed: 'immediate',\n  host_slip_removed: 'immediate',\n  widget_unavailable: 'immediate',\n  match_view: 'deferred',\n  fact_view: 'deferred',\n  host_match_opened: 'held',\n  host_page_change: 'held',\n  tile_tap: 'timer',\n  match_open: 'timer',\n  hook_view: 'timer',\n  popup_shown: 'timer',\n  popup_opened: 'timer',\n  popup_dismissed: 'timer',\n  popup_ask_tap: 'timer',\n  widget_open: 'timer',\n  dashboard_sport_switch: 'timer',\n  greeting_shown: 'timer',\n  greeting_cta_click: 'timer',\n  greeting_card_tap: 'timer',\n  greeting_ask_tap: 'timer',\n  launcher_click: 'timer',\n  bubble_click: 'timer',\n  widget_close: 'timer',\n  tab_change: 'timer',\n  question_asked: 'timer',\n  answer_received: 'timer',\n  answer_failed: 'timer',\n  answer_stopped: 'timer',\n  new_conversation: 'timer',\n  combo_variant_click: 'timer',\n  combo_swap_click: 'timer',\n  combo_add_click: 'timer',\n  favourite_change: 'timer',\n  native_command: 'timer',\n  props_too_large: 'timer',\n  widget_loaded: 'held',\n  widget_init_failed: 'immediate',\n  strings_state: 'held',\n  slip_unavailable: 'held',\n  storage_blocked: 'held',\n  widget_error: 'immediate',\n  request_failed: 'held',\n  visibility_change: 'held',\n  identity_change: 'held',\n  language_change: 'held',\n  bubble_suppressed: 'held',\n  bubble_intro_played: 'held',\n  tab_redirect: 'held',\n  tab_view: 'deferred',\n  tab_dot_shown: 'deferred',\n  menu_open: 'timer',\n  sheet_open: 'timer',\n  sheet_close: 'timer',\n  panel_back: 'timer',\n  layout_change: 'timer',\n  squad_view_change: 'timer',\n  greeting_loaded: 'held',\n  greeting_failed: 'held',\n  greeting_section_view: 'deferred',\n  greeting_chip_click: 'timer',\n  you_ribbon_more: 'timer',\n  guess_dismiss: 'timer',\n  market_menu_open: 'timer',\n  market_rechoose: 'timer',\n  dashboard_card_expand: 'timer',\n  fan_card_tap: 'timer',\n  builder_cooloff: 'timer',\n  input_start: 'timer',\n  input_blocked: 'timer',\n  draft_abandoned: 'timer',\n  answer_link_click: 'timer',\n  chips_shown: 'deferred',\n  card_view: 'deferred',\n  card_scope_change: 'timer',\n  cards_expand: 'timer',\n  fact_history_expand: 'timer',\n  monitor_section_toggle: 'timer',\n  conversation_restored: 'held',\n  conversation_reset: 'held',\n  odds_more_toggle: 'timer',\n  add_all_result: 'immediate',\n  add_all_blocked: 'timer',\n  pin_blocked: 'timer',\n  all_markets_blocked: 'timer',\n  price_stale_shown: 'deferred',\n  card_closed: 'deferred',\n  slip_unavailable_shown: 'deferred',\n  market_accordion_toggle: 'timer',\n  market_retry: 'timer',\n  market_load_failed: 'timer',\n  market_suspended_shown: 'deferred',\n  price_update_seen: 'deferred',\n  builder_choice: 'timer',\n  builder_custom_total_open: 'timer',\n  builder_custom_total: 'timer',\n  builder_auto_widen: 'timer',\n  builder_error: 'timer',\n  builder_retry: 'timer',\n  builder_paused_shown: 'deferred',\n  builder_empty_shown: 'deferred',\n  builder_swap_unavailable: 'deferred',\n  builder_sport_switch: 'timer',\n  combo_change_click: 'timer',\n  combo_tool_adjust: 'timer',\n  live_filter: 'timer',\n  schedule_filter: 'timer',\n  schedule_search: 'timer',\n  schedule_retry: 'timer',\n  league_group_toggle: 'timer',\n  league_show_all: 'timer',\n  league_live_jump: 'timer',\n  see_all_matches_click: 'timer',\n  match_sheet_open: 'timer',\n  followed_match_select: 'timer',\n  trend_select: 'timer',\n  player_open: 'timer',\n  player_close: 'timer',\n  games_segment_change: 'timer',\n  leaderboard_segment_change: 'timer',\n  leaderboard_empty_cta: 'timer',\n  game_open: 'timer',\n  game_close: 'timer',\n  game_start: 'timer',\n  game_answer: 'timer',\n  game_hint: 'timer',\n  game_complete: 'timer',\n  login_wall_shown: 'deferred',\n  favourites_sport_change: 'timer',\n  favourites_search: 'timer',\n  favourites_clear: 'timer',\n  favourites_refused: 'held',\n  favourites_load_failed: 'held',\n  setting_change: 'timer',\n  settings_rows_shown: 'deferred',\n  widget_settings_failed: 'held',\n  limit_shown: 'deferred',\n  limit_cleared: 'timer',\n  toast_shown: 'deferred',\n  empty_state_shown: 'deferred',\n  monitor_poll_failed: 'held',\n  monitor_disabled: 'held',\n  props_load_failed: 'timer',\n}\n\nexport function isWidgetEventName(name: string): name is WidgetEventName {\n  return Object.prototype.hasOwnProperty.call(DELIVERY_CLASS, name)\n}\n","import { type CarryOverStore, utf8Bytes } from './carryOver'\nimport type { CatalogueEventInput, CatalogueEventName } from './catalogueEvents'\nimport { DELIVERY_CLASS } from './deliveryClass'\nimport { newId } from './ids'\nimport type { SessionStore } from './session'\nimport type { PageContext } from './types'\n\nexport type WidgetEntityEventName =\n  | 'pin_add' | 'pin_remove' | 'slip_click' | 'slip_result'\n  | 'tile_tap'\n  | 'slip_remove' | 'bet_placed' | 'match_view' | 'match_open' | 'combo_add'\n  | 'fact_view' | 'fact_ask' | 'market_choose' | 'hook_view'\n\nexport type WidgetPopupEventName = 'popup_shown' | 'popup_opened' | 'popup_dismissed'\n\nexport type WidgetPopupAskEventName = 'popup_ask_tap'\n\nexport type WidgetOpenEventName = 'widget_open'\n\nexport type WidgetSportSwitchEventName = 'dashboard_sport_switch'\n\nexport type WidgetGreetingEventName = 'greeting_shown' | 'greeting_cta_click' | 'greeting_card_tap' | 'greeting_ask_tap'\n\n/** Public events that had no wire form before u676: they now ride the wire under their public names, their body in `props`. */\nexport type WidgetPublicOnlyName =\n  | 'launcher_click' | 'bubble_click' | 'widget_close' | 'tab_change' | 'question_asked' | 'answer_received' | 'answer_failed'\n  | 'answer_stopped' | 'new_conversation' | 'combo_variant_click' | 'combo_swap_click' | 'combo_add_click' | 'favourite_change'\n\n/** Events whose fields all live in `props`. */\nexport type WidgetPropsEventName =\n  | WidgetPublicOnlyName\n  | 'host_bet_placed' | 'host_slip_removed' | 'host_match_opened' | 'host_page_change' | 'native_command' | 'widget_unavailable'\n  | 'props_too_large'\n  | CatalogueEventName\n\nexport type WidgetEventName =\n  WidgetEntityEventName | WidgetPopupEventName | WidgetPopupAskEventName | WidgetOpenEventName | WidgetSportSwitchEventName\n  | WidgetGreetingEventName | WidgetPropsEventName\n\nexport type WirePropValue = string | number | boolean | null | readonly WirePropValue[] | { readonly [key: string]: WirePropValue }\nexport type WireProps = { readonly [key: string]: WirePropValue }\n\nexport type WidgetEntityType = 'match' | 'team' | 'player' | 'competition' | 'market'\n\n/** `totalChosen` is the visitor's total control as a string on the wire (`custom` when the visitor typed their own total); `totalActual` is the server's total for the shown combo. */\nexport interface ComboAddMetadata {\n  sport: string\n  legs: number\n  totalChosen: 'any' | '3' | '5' | '10' | '20' | '50' | 'custom'\n  totalActual: number\n  markets: string[]\n}\n\nexport interface WidgetEventInput {\n  name: Exclude<WidgetEntityEventName, 'market_choose'>\n  entityType: WidgetEntityType\n  entityId?: string\n  entityName?: string\n  marketDeveloperName?: string\n  outcome?: string\n  /** Football match id of the slip selection (slip_click / slip_result). */\n  matchId?: number\n  /** Odds row id of the slip selection, a positive integer; the server rejects the whole batch on a non-positive one. */\n  matchOddsId?: number\n  /** The raw odds label as stored (\"Home\", \"Over\", \"Home/Draw\"), never a joined display string. Max 64. */\n  selection?: string\n  /** The raw line (\"2.5\"). Max 32; omit when empty. */\n  line?: string\n  /** Decimal price shown when the selection was added. */\n  odds?: number\n  /** Wire sport key ('nba'); absent means football. */\n  sport?: string\n  /** Tennis only: 'atp' | 'wta'. */\n  tour?: string\n  /** combo_add only: what the visitor asked for and what the server returned. */\n  metadata?: ComboAddMetadata\n  /** fact_view / fact_ask: the live fact's id, as a string (the wire type is string, not number). */\n  factId?: string\n  /** fact_view / fact_ask: the live fact's rule key. */\n  factKey?: string\n  /** What led the greeting this event comes from: `fact`, `price_move`, `popular_match`, `big_change` or `none`. */\n  hook?: string\n  /** Event fields of the events that carry them in `props`. */\n  props?: WireProps\n}\n\n/** The visitor's market pick (chooser or \"Another market\"): the developer name is the entity id and is required. */\nexport type WidgetMarketChooseEventInput =\n  { name: 'market_choose'; entityType: 'market'; entityId: string; props?: WireProps } & { [K in Exclude<keyof WidgetEventInput, 'name' | 'entityType' | 'entityId' | 'props'>]?: never }\n\n/** Launcher popup telemetry: counted server-side, never tied to an entity. */\nexport type WidgetPopupEventInput =\n  { name: WidgetPopupEventName; props?: WireProps } & { [K in Exclude<keyof WidgetEventInput, 'name' | 'props'>]?: never }\n\n/** A tap on one of the launcher bubble's asks. `outcome` carries the ask's position, \"0\" or \"1\"\n *  (contract §5): the gateway forwards only the fields of its own event model, and outcome is its\n *  one free-text field. */\nexport type WidgetPopupAskEventInput =\n  { name: WidgetPopupAskEventName; outcome: string; props?: WireProps } & { [K in Exclude<keyof WidgetEventInput, 'name' | 'outcome' | 'props'>]?: never }\n\n/** The panel opening: entity-free, each open is added to the user's count for the day. */\nexport type WidgetOpenEventInput =\n  { name: WidgetOpenEventName; props?: WireProps } & { [K in Exclude<keyof WidgetEventInput, 'name' | 'props'>]?: never }\n\n/** The greeting sport switch: `outcome` is the sport switched to (a server sport key). Entity-free; the server drops an unknown outcome. */\nexport type WidgetSportSwitchEventInput =\n  { name: WidgetSportSwitchEventName; outcome: string; props?: WireProps } & { [K in Exclude<keyof WidgetEventInput, 'name' | 'outcome' | 'props'>]?: never }\n\n/** `matchId` and `competitionId` are strings and `slot` a number: a wrong JSON type inside `greeting` makes the gateway reject the whole batch. */\nexport interface GreetingEventPayload {\n  greetingId: string\n  surface?: 'bubble' | 'panel'\n  case?: string\n  sport?: string\n  market?: string | null\n  marketStep?: string\n  matchStep?: string\n  matchId?: string | null\n  competitionId?: string | null\n  chooserShown?: boolean\n  slot?: number\n}\n\n/** A greeting impression or tap: entity-free, the payload rides in `greeting`. */\nexport type WidgetGreetingEventInput =\n  { name: WidgetGreetingEventName; greeting: GreetingEventPayload; props?: WireProps } & { [K in Exclude<keyof WidgetEventInput, 'name' | 'props'>]?: never }\n\n/** A public-only event on the wire: the public body (minus its name) is its `props`. */\nexport type WidgetPublicPropsEventInput =\n  { name: WidgetPublicOnlyName; props?: WireProps } & { [K in Exclude<keyof WidgetEventInput, 'name' | 'props'>]?: never }\n\n/** The other props-only events: the host calls, native commands, availability and the oversize replacement. */\nexport type WidgetWirePropsEventInput =\n  { name: Exclude<WidgetPropsEventName, WidgetPublicOnlyName | CatalogueEventName>; props?: WireProps } & { [K in Exclude<keyof WidgetEventInput, 'name' | 'props'>]?: never }\n\nexport type WidgetCatalogueEventInput = CatalogueEventInput\n\nexport type WidgetPropsEventInput = WidgetPublicPropsEventInput | WidgetWirePropsEventInput\n\nexport type WidgetLogInput =\n  WidgetEventInput | WidgetMarketChooseEventInput | WidgetPopupEventInput | WidgetPopupAskEventInput | WidgetOpenEventInput | WidgetSportSwitchEventInput\n  | WidgetGreetingEventInput | WidgetPublicPropsEventInput | WidgetWirePropsEventInput | WidgetCatalogueEventInput\n\n\n/** Where the widget stood when an event fired: stamped at log time, never at send time. */\nexport interface WireEventScope {\n  tab?: string\n  page?: PageContext\n}\n\n/** Stable facts about the widget, read per batch so a changed theme or language reaches the next one. */\nexport interface WireContext {\n  widgetVersion: string\n  surface: 'web' | 'react' | 'mobile'\n  client?: 'ios' | 'android' | 'flutter' | 'react-native'\n  language?: string\n  resolvedLanguage?: string\n  tenant?: 'sportsbook' | 'club'\n  oddsFormat?: string\n  theme?: string\n  layout?: 'modal' | 'fullscreen'\n  viewport?: { w: number; h: number }\n  storage: 'session' | 'memory'\n}\n\nexport type WireEvent = WidgetLogInput & {\n  eventId: string\n  seq: number\n  at: number\n  tab?: string\n  page?: PageContext\n}\n\nexport interface EventBatch {\n  v: 2\n  /** Made once when the batch is built and kept on every resend and replay. */\n  batchId: string\n  builtAt: number\n  sessionId: string\n  conversationId?: string\n  operatorUserId?: string\n  anonymousUserId?: string\n  /**\n   * Events dropped after exhausting delivery attempts during a PRIOR flush cycle — not a count of\n   * this batch's own events. Moved in when the batch is built and never changed afterwards.\n   */\n  dropped?: number\n  /** Failed delivery attempts from a PRIOR flush cycle — not retries of this batch's own events. */\n  retries?: number\n  /** Host calls the widget's bounded queue pushed out before the widget attached. */\n  hostDropped?: number\n  context?: WireContext\n  events: WireEvent[]\n}\n\nexport interface EventLoggerOptions {\n  /** Normal delivery (fetch). Rejecting triggers the retry/backoff loop. */\n  flush: (batch: EventBatch) => Promise<void>\n  /** Best-effort tail flush on page hide/unload (fetch keepalive). Never awaited. */\n  flushKeepalive: (batch: EventBatch) => void\n  /** Injectable clock (tests). Defaults to Date.now. */\n  now?: () => number\n  batchIntervalMs?: number\n  maxBatch?: number\n  maxAttempts?: number\n  /** A batch never passes this many UTF-8 bytes, envelope included. */\n  maxBatchBytes?: number\n  session?: SessionStore\n  context?: () => Omit<WireContext, 'storage'>\n  scope?: () => WireEventScope\n  carryOver?: CarryOverStore | null\n}\n\nexport interface EventLogger {\n  log(input: WidgetLogInput): void\n  setIdentity(id: { operatorUserId?: string; anonymousUserId?: string; conversationId?: string }): void\n  flushNow(): Promise<void>\n  flushOnHide(): void\n  dispose(): void\n  /** Undoes dispose(). React StrictMode runs an effect's cleanup and then its setup again on the\n   *  same logger, so the widget's setup has to be able to bring a disposed logger back. */\n  resume(): void\n  /** The visitor opened the panel: held events leave at once. */\n  markOpened?(): void\n  /** The page is visible again: keepalive is re-armed and an unsent outbox goes out. */\n  markVisible?(): void\n  /** Host calls dropped before the widget attached; they ride the next batch as `hostDropped`. */\n  addHostDropped?(count: number): void\n}\n\nconst DEFAULT_BATCH_INTERVAL_MS = 10_000\nconst DEFAULT_MAX_BATCH = 50\nconst DEFAULT_MAX_ATTEMPTS = 3\nconst DEFAULT_MAX_BATCH_BYTES = 60_000\nconst MAX_PROPS_BYTES = 4096\nconst HELD_MAX = 200\nconst KEEPALIVE_MAX_BATCHES = 4\nconst KEEPALIVE_MAX_BYTES = 60_000\nconst TOUCH_INTERVAL_MS = 30_000\n\ninterface QueuedEvent {\n  event: WireEvent\n  bytes: number\n}\n\ninterface OutboxEntry {\n  batch: EventBatch\n  bytes: number\n  /** Written to localStorage, so a failure is not counted as dropped and a 2xx removes the entry. */\n  stored: boolean\n}\n\nfunction delay(ms: number): Promise<void> {\n  return new Promise((resolve) => setTimeout(resolve, ms))\n}\n\nfunction memorySession(): SessionStore {\n  return { id: newId(), storage: 'memory', touch() {} }\n}\n\nfunction sizeOf(value: unknown): number {\n  return utf8Bytes(JSON.stringify(value))\n}\n\nfunction tooLarge(event: WireEvent): WireEvent {\n  const { eventId, seq, at, tab, page } = event\n  return {\n    name: 'props_too_large', props: { name: event.name }, eventId, seq, at,\n    ...(tab !== undefined ? { tab } : {}),\n    ...(page !== undefined ? { page } : {}),\n  }\n}\n\n// Retrying these cannot succeed: the server refused the batch itself.\nfunction isNonRetryable(error: unknown): boolean {\n  const status = typeof error === 'object' && error !== null ? (error as { status?: unknown }).status : undefined\n  return status === 400 || status === 401 || status === 403 || status === 413\n}\n\nclass EventLoggerImpl implements EventLogger {\n  private readonly session: SessionStore\n  private readonly owner = newId()\n  private readonly now: () => number\n  private readonly batchIntervalMs: number\n  private readonly maxBatch: number\n  private readonly maxAttempts: number\n  private readonly maxBatchBytes: number\n  private readonly carryOver: CarryOverStore | null\n\n  private queue: QueuedEvent[] = []\n  private held: QueuedEvent[] = []\n  private outbox: OutboxEntry[] = []\n  private readonly keepaliveSent = new Set<string>()\n  private opened = false\n  private keepaliveArmed = true\n  private replayTaken = false\n  private carryDroppedTaken = false\n  private seq = 0\n  private retries = 0\n  private dropped = 0\n  private hostDropped = 0\n  private identity: { operatorUserId?: string; anonymousUserId?: string; conversationId?: string } = {}\n  private timer: ReturnType<typeof setTimeout> | null = null\n  private inFlight: Promise<void> | null = null\n  private disposed = false\n  private lastTouch: number\n\n  constructor(private readonly opts: EventLoggerOptions) {\n    this.now = opts.now ?? (() => Date.now())\n    this.batchIntervalMs = opts.batchIntervalMs ?? DEFAULT_BATCH_INTERVAL_MS\n    this.maxBatch = opts.maxBatch ?? DEFAULT_MAX_BATCH\n    this.maxAttempts = opts.maxAttempts ?? DEFAULT_MAX_ATTEMPTS\n    this.maxBatchBytes = opts.maxBatchBytes ?? DEFAULT_MAX_BATCH_BYTES\n    this.session = opts.session ?? memorySession()\n    this.carryOver = opts.carryOver ?? null\n    this.lastTouch = this.now()\n    if (this.carryOver?.has()) this.armTimer()\n  }\n\n  log(input: WidgetLogInput): void {\n    try {\n      if (this.disposed) return\n      const at = this.now()\n      let scope: WireEventScope = {}\n      try { scope = this.opts.scope?.() ?? {} } catch { /* a throwing scope leaves the event unstamped */ }\n      let event = {\n        ...input, eventId: newId(), seq: ++this.seq, at,\n        ...(scope.tab !== undefined ? { tab: scope.tab } : {}),\n        ...(scope.page !== undefined ? { page: scope.page } : {}),\n      } as WireEvent\n      const props = (input as { props?: unknown }).props\n      const cls = DELIVERY_CLASS[event.name] ?? 'timer'\n      if (props !== undefined && sizeOf(props) > MAX_PROPS_BYTES) event = tooLarge(event)\n      this.touchSession(at, false)\n\n      const queued: QueuedEvent = { event, bytes: sizeOf(event) }\n      if (cls === 'held' && !this.opened) {\n        this.held.push(queued)\n        if (this.held.length > HELD_MAX) {\n          this.held.shift()\n          this.dropped++\n        }\n        return\n      }\n      this.queue.push(queued)\n      if (cls === 'immediate') {\n        this.trigger()\n      } else if (this.queue.length >= this.maxBatch) {\n        this.trigger()\n      } else if (cls !== 'deferred') {\n        this.armTimer()\n      }\n    } catch { /* telemetry never throws into the widget */ }\n  }\n\n  private touchSession(at: number, force: boolean): void {\n    if (!force && at - this.lastTouch < TOUCH_INTERVAL_MS) return\n    this.lastTouch = at\n    try { this.session.touch(at) } catch { /* telemetry never throws */ }\n  }\n\n  setIdentity(id: { operatorUserId?: string; anonymousUserId?: string; conversationId?: string }): void {\n    const changed = (id.operatorUserId !== undefined && id.operatorUserId !== this.identity.operatorUserId)\n      || (id.anonymousUserId !== undefined && id.anonymousUserId !== this.identity.anonymousUserId)\n    if (changed && this.queue.length > 0) {\n      try {\n        while (this.queue.length > 0) {\n          const batch = this.buildBatch()\n          if (batch === null) break\n          this.addToOutbox(batch, false)\n        }\n        this.armTimer()\n      } catch { /* telemetry never throws */ }\n    }\n    this.identity = { ...this.identity, ...id }\n  }\n\n  markOpened(): void {\n    try {\n      if (this.opened) return\n      this.opened = true\n      this.releaseHeld()\n      if (this.hasWork()) this.trigger()\n    } catch { /* telemetry never throws */ }\n  }\n\n  markVisible(): void {\n    try {\n      this.keepaliveArmed = true\n      if (this.outbox.length > 0 || this.replayPending()) this.trigger()\n    } catch { /* telemetry never throws */ }\n  }\n\n  addHostDropped(count: number): void {\n    if (Number.isFinite(count) && count > 0) this.hostDropped += count\n  }\n\n  async flushNow(): Promise<void> {\n    for (;;) {\n      if (this.inFlight) {\n        await this.inFlight\n        continue\n      }\n      if (!this.hasWork()) return\n      const run: Promise<void> = this.doFlush().finally(() => { if (this.inFlight === run) this.inFlight = null })\n      this.inFlight = run\n      await run\n    }\n  }\n\n  flushOnHide(): void {\n    try {\n      this.clearTimer()\n      this.touchSession(this.now(), true)\n      if (!this.opened) this.releaseHeld()\n      for (let batch = this.buildBatch(); batch !== null; batch = this.buildBatch()) this.addToOutbox(batch, false)\n      this.sendKeepalive()\n      if (this.carryOver) {\n        const written = this.carryOver.save(this.owner, this.outbox.map((e) => e.batch), this.keepaliveSent, this.now())\n        for (const entry of this.outbox) entry.stored = written.has(entry.batch.batchId)\n      }\n    } catch { /* telemetry never throws on unload */ }\n  }\n\n  dispose(): void {\n    this.disposed = true\n    this.clearTimer()\n  }\n\n  resume(): void {\n    this.disposed = false\n    this.keepaliveArmed = true\n    if (this.carryOver?.has() || this.queue.length > 0) this.armTimer()\n  }\n\n  private releaseHeld(): void {\n    if (this.held.length === 0) return\n    this.queue = [...this.queue, ...this.held].sort((a, b) => a.event.seq - b.event.seq)\n    this.held = []\n  }\n\n  private replayPending(): boolean {\n    return !this.replayTaken && this.carryOver !== null && this.carryOver.has()\n  }\n\n  private hasWork(): boolean {\n    return this.queue.length > 0 || this.outbox.length > 0 || this.replayPending()\n  }\n\n  private armTimer(): void {\n    if (this.timer !== null) return\n    this.timer = setTimeout(() => {\n      this.timer = null\n      this.trigger()\n    }, this.batchIntervalMs)\n  }\n\n  private clearTimer(): void {\n    if (this.timer === null) return\n    clearTimeout(this.timer)\n    this.timer = null\n  }\n\n  private trigger(): void {\n    if (this.disposed) return\n    if (this.inFlight) return\n    this.inFlight = this.doFlush().finally(() => {\n      this.inFlight = null\n      // An immediate (or maxBatch-triggered) log() call that arrived while this flush was\n      // in-flight was a no-op above -- drain it now instead of stranding it until some later\n      // log()/flushNow()/dispose() call. Guarded by the disposed check at the top of trigger()\n      // itself, so a straggler queued just before dispose() does not fire a flush after it.\n      if (this.queue.length > 0 || this.outbox.length > 0) this.trigger()\n    })\n  }\n\n  private addToOutbox(batch: EventBatch, stored: boolean): OutboxEntry {\n    const entry: OutboxEntry = { batch, bytes: sizeOf(batch), stored }\n    this.outbox.push(entry)\n    return entry\n  }\n\n  private takeReplay(): void {\n    if (this.replayTaken) return\n    this.replayTaken = true\n    if (!this.carryOver) return\n    const replay = this.carryOver.take(this.owner, this.now()).map((batch): OutboxEntry => ({ batch, bytes: sizeOf(batch), stored: true }))\n    this.outbox = [...replay, ...this.outbox]\n  }\n\n  /**\n   * Takes events off the queue while the batch stays within 50 events and `maxBatchBytes`, and moves\n   * the pending counters (dropped, retries, hostDropped) into it. Returns null only when there is truly\n   * nothing to report -- an empty queue AND all three counters at 0 -- so a counter-only report still\n   * gets built and delivered.\n   */\n  private buildBatch(): EventBatch | null {\n    if (!this.carryDroppedTaken) {\n      this.carryDroppedTaken = true\n      this.dropped += this.carryOver?.takeDropped() ?? 0\n    }\n    if (this.queue.length === 0 && this.retries === 0 && this.dropped === 0 && this.hostDropped === 0) return null\n\n    const builtAt = this.now()\n    const envelope: Omit<EventBatch, 'events'> = { v: 2, batchId: newId(), builtAt, sessionId: this.session.id, ...this.identity }\n    try {\n      const context = this.opts.context?.()\n      if (context) envelope.context = { ...context, storage: this.session.storage }\n    } catch { /* a throwing context leaves it out of this batch */ }\n    if (this.dropped > 0) envelope.dropped = this.dropped\n    if (this.retries > 0) envelope.retries = this.retries\n    if (this.hostDropped > 0) envelope.hostDropped = this.hostDropped\n    this.dropped = 0\n    this.retries = 0\n    this.hostDropped = 0\n\n    let size = sizeOf({ ...envelope, events: [] })\n    const events: WireEvent[] = []\n    while (this.queue.length > 0 && events.length < this.maxBatch) {\n      let next = this.queue[0]!\n      let add = next.bytes + (events.length > 0 ? 1 : 0)\n      if (size + add > this.maxBatchBytes) {\n        if (events.length > 0) break\n        const event = tooLarge(next.event)\n        next = { event, bytes: sizeOf(event) }\n        add = next.bytes\n      }\n      this.queue.shift()\n      events.push(next.event)\n      size += add\n    }\n    return { ...envelope, events }\n  }\n\n  private sendKeepalive(): void {\n    if (!this.keepaliveArmed) return\n    let sent = 0\n    let total = 0\n    for (const entry of this.outbox) {\n      if (sent >= KEEPALIVE_MAX_BATCHES || total + entry.bytes > KEEPALIVE_MAX_BYTES) break\n      this.opts.flushKeepalive(entry.batch)\n      this.keepaliveSent.add(entry.batch.batchId)\n      sent++\n      total += entry.bytes\n    }\n    if (sent > 0) this.keepaliveArmed = false\n  }\n\n  private loseBatch(batch: EventBatch): void {\n    this.dropped += batch.events.length + (batch.dropped ?? 0)\n    this.retries += batch.retries ?? 0\n    this.hostDropped += batch.hostDropped ?? 0\n  }\n\n  private leaveOutbox(batchId: string): void {\n    this.outbox = this.outbox.filter((e) => e.batch.batchId !== batchId)\n  }\n\n  private async doFlush(): Promise<void> {\n    this.clearTimer()\n    this.takeReplay()\n    let entry = this.outbox[0]\n    if (!entry) {\n      const batch = this.buildBatch()\n      if (batch === null) return\n      entry = this.addToOutbox(batch, false)\n    }\n    await this.send(entry)\n  }\n\n  private async send(entry: OutboxEntry): Promise<void> {\n    const { batch } = entry\n    let failure: unknown\n    for (let attempt = 1; attempt <= this.maxAttempts; attempt++) {\n      try {\n        await this.opts.flush(batch)\n        this.leaveOutbox(batch.batchId)\n        this.keepaliveSent.delete(batch.batchId)\n        this.carryOver?.remove(batch.batchId)\n        return\n      } catch (error) {\n        failure = error\n        this.retries++\n        if (attempt >= this.maxAttempts || (entry.stored && isNonRetryable(error))) break\n        await delay(2 ** attempt * 50)\n      }\n    }\n    this.leaveOutbox(batch.batchId)\n    this.keepaliveSent.delete(batch.batchId)\n    if (!entry.stored) {\n      this.loseBatch(batch)\n    } else if (isNonRetryable(failure)) {\n      this.carryOver?.remove(batch.batchId)\n      this.loseBatch(batch)\n    }\n  }\n}\n\nexport function createEventLogger(opts: EventLoggerOptions): EventLogger {\n  return new EventLoggerImpl(opts)\n}\n","import { runChat, type ChatCallbacks, type ChatHandle } from './chat'\nimport { Conversation } from './conversation'\nimport { openCarryOver } from './carryOver'\nimport { createEventLogger, type EventBatch, type EventLogger, type WireContext, type WireEventScope } from './eventLog'\nimport { observeFetch, type ResponseReport } from './responses'\nimport { postEvents, postEventsKeepalive, postSignal, type ResolvedConfig } from './http'\nimport { openSession } from './session'\nimport { toSignalWireBody } from './signals'\nimport { visitorZone } from './timeZone'\nimport type { ChatInput, SignalInput, StatsWidgetClientOptions, UserContext } from './types'\n\nconst DEFAULT_BASE_URL = 'https://widget.sensiblestats.com'\n\nexport class StatsWidgetClient {\n  private readonly cfg: ResolvedConfig\n  private readonly responseListeners = new Set<(r: ResponseReport) => void>()\n\n  constructor(options: StatsWidgetClientOptions) {\n    if (!options.operatorId) throw new Error('operatorId is required')\n    if (!options.publicKey) throw new Error('publicKey is required')\n    const fetchImpl = options.fetch ?? (globalThis.fetch ? globalThis.fetch.bind(globalThis) : undefined)\n    if (!fetchImpl) throw new Error('No fetch implementation available; pass options.fetch')\n    const baseUrl = options.baseUrl ?? DEFAULT_BASE_URL\n    this.cfg = {\n      operatorId: options.operatorId,\n      publicKey: options.publicKey,\n      baseUrl,\n      fetch: observeFetch(fetchImpl, { baseUrl, operatorId: options.operatorId }, (r) => {\n        for (const listener of [...this.responseListeners]) {\n          try { listener(r) } catch { /* a listener never fails a request */ }\n        }\n      }),\n      client: options.client,\n      timeZone: visitorZone(options.timeZone),\n    }\n  }\n\n  /** Called once per request that is not the events POST: with the status of every non-2xx response the route does not answer by design (a 404 for \"feature off\", a refused favourite id), and with status 0 when fetch rejects for any reason but an abort. */\n  onResponse(listener: (r: ResponseReport) => void): () => void {\n    this.responseListeners.add(listener)\n    return () => { this.responseListeners.delete(listener) }\n  }\n\n  chat(input: ChatInput, callbacks?: ChatCallbacks): ChatHandle {\n    return runChat(this.cfg, input, callbacks)\n  }\n\n  async sendSignal(input: SignalInput): Promise<void> {\n    await postSignal(this.cfg, toSignalWireBody(input))\n  }\n\n  conversation(context?: UserContext): Conversation {\n    return new Conversation(this.cfg, context)\n  }\n\n  sendEvents(batch: EventBatch): Promise<void> {\n    return postEvents(this.cfg, batch)\n  }\n\n  sendEventsKeepalive(batch: EventBatch): void {\n    postEventsKeepalive(this.cfg, batch)\n  }\n\n  /** `transport` replaces this client's own delivery, so a logger can outlive the client it was made from. */\n  createEventLogger(\n    identity?: { operatorUserId?: string; anonymousUserId?: string; conversationId?: string },\n    options?: {\n      context?: () => Omit<WireContext, 'storage'>\n      scope?: () => WireEventScope\n      transport?: { flush: (batch: EventBatch) => Promise<void>; flushKeepalive: (batch: EventBatch) => void }\n    },\n  ): EventLogger {\n    const logger = createEventLogger({\n      flush: options?.transport?.flush ?? ((batch) => postEvents(this.cfg, batch)),\n      flushKeepalive: options?.transport?.flushKeepalive ?? ((batch) => postEventsKeepalive(this.cfg, batch)),\n      session: openSession(this.cfg.operatorId, Date.now()),\n      carryOver: openCarryOver(this.cfg.operatorId),\n      ...(options?.context ? { context: options.context } : {}),\n      ...(options?.scope ? { scope: options.scope } : {}),\n    })\n    if (identity) logger.setIdentity(identity)\n    return logger\n  }\n}\n","export interface SportSpec { readonly slipPrefix: string; readonly monitorPrefix: string; readonly label: string; readonly slippable: boolean; readonly wireKey: string | undefined }\n\nexport const SPORTS = {\n  basketball: { slipPrefix: 'bb:', monitorPrefix: 'nba:', label: 'NBA', slippable: true, wireKey: 'nba' },\n  americanfootball: { slipPrefix: 'af:', monitorPrefix: 'nfl:', label: 'NFL', slippable: true, wireKey: 'nfl' },\n  tennis: { slipPrefix: 'tn:', monitorPrefix: 'tennis:', label: 'Tennis', slippable: true, wireKey: 'tennis' },\n} as const satisfies Record<string, SportSpec>\n\nexport type NonFootballSport = keyof typeof SPORTS\n/** The sport keys the server accepts on a signal or widget event: only a sport with a wireKey. */\nexport type WireSport = NonNullable<(typeof SPORTS)[NonFootballSport]['wireKey']>\nexport type QualifiedType = 'game' | 'team' | 'player' | 'competition' | 'market'\n/** The sports whose prices can reach an operator slip or a pin: those the map marks slippable. */\nexport type SlipSport = { [K in NonFootballSport]: (typeof SPORTS)[K]['slippable'] extends true ? K : never }[NonFootballSport]\n\n/** undefined means football: every sport the map does not know is football. */\nexport function sportOf(v: unknown): NonFootballSport | undefined {\n  return typeof v === 'string' && Object.prototype.hasOwnProperty.call(SPORTS, v) ? (v as NonFootballSport) : undefined\n}\n\n/** True for football (no sport) and for a sport the map marks slippable: the only cases that may pin or slip. */\nexport function mayPinOrSlip(v: unknown): boolean {\n  const sport = sportOf(v)\n  return sport === undefined || SPORTS[sport].slippable\n}\n\n/** The sport when it may take a slip pick or a pin; undefined for football and for a sport that never does. */\nexport function slipSportOf(v: unknown): SlipSport | undefined {\n  const sport = sportOf(v)\n  return sport !== undefined && SPORTS[sport].slippable ? (sport as SlipSport) : undefined\n}\n\n/** The key the server reads as `sport`; undefined for football and for a sport without a wireKey. */\nexport function toWireSport(v: unknown): WireSport | undefined {\n  const sport = sportOf(v)\n  return sport === undefined ? undefined : (SPORTS[sport].wireKey as WireSport | undefined)\n}\n\n/** A server sport key (a set's `sport`) back to the key the server reads on a signal; undefined unless the map carries it as a wireKey. */\nexport function fromWireSport(v: unknown): WireSport | undefined {\n  return typeof v === 'string' && Object.values(SPORTS).some((s) => s.wireKey === v) ? (v as WireSport) : undefined\n}\n\n/** The local part of a qualified id. A tennis match id is unique only within its tour, so it carries the tour (ADR 0004). */\nexport function localIdOf(sport: unknown, id: number | string, tour?: string): string {\n  return sportOf(sport) === 'tennis' && tour ? `${tour}-${id}` : String(id)\n}\n\nexport function qualifiedId(sport: unknown, type: QualifiedType, id: string): string {\n  const wire = toWireSport(sport)\n  return wire ? `${wire}:${type}:${id}` : id\n}\n","import { localIdOf } from './sports'\n\nexport function matchKey(sport: string | undefined, id: number, tour?: string): string {\n  return `${sport ?? 'football'}:${localIdOf(sport, id, tour)}`\n}\n","import type { SlipSport } from './sports'\n\nexport type FetchLike = (input: string, init: RequestInit) => Promise<Response>\n\nexport interface StatsWidgetClientOptions {\n  operatorId: string\n  publicKey: string\n  baseUrl?: string\n  /** Advanced/testing: inject a fetch implementation. Defaults to globalThis.fetch. */\n  fetch?: FetchLike\n  /** Sent as X-SS-Client; set by widget-react. */\n  client?: string\n  /** IANA zone sent as X-SS-Time-Zone; the browser's zone when absent or not one Intl knows. */\n  timeZone?: string\n}\n\nexport type OddsFormat = 'decimal' | 'american' | 'fractional'\n\nexport interface WidgetSettings { oddsOffered: boolean }\n\nexport interface UserContext {\n  operatorUserId?: string\n  defaultLanguage?: string\n  anonymousUserId?: string\n  oddsFormat?: OddsFormat\n}\n\nexport interface ChatGrounding {\n  kind?: string\n  matchId?: number\n  opponentTeamId?: number\n  teamId?: number\n  competitionId?: number\n  season?: string\n  subject?: string\n  personaHint?: string\n  sport?: string\n  /** Tennis only: a match id is unique within its tour. */\n  tour?: string\n}\n\n/** The page the widget sits on. Sent on greeting requests only, so the greeting can lead with that page. */\nexport interface PageContext {\n  sport: 'football' | 'basketball' | 'americanfootball' | 'tennis'\n  kind?: 'section' | 'competition' | 'match'\n  matchId?: string | number\n  competitionId?: string | number\n}\n\n/** Onboarding presets stage 2 (contract §3): what a tool's Send asked for. Sent only from a tool's\n *  Send, beside the full sentence in `message`. The server ignores it unless every value is valid. */\nexport interface ChatPreset {\n  kind: 'combo'\n  total: number\n  legs: number\n  /** The legs the builder showed, in the order shown (R12: the answer reprices exactly these). */\n  matchOddsIds: number[]\n  /** The same legs' matchId, index for index with matchOddsIds (from the grid). */\n  matchIds: number[]\n}\n\nexport interface ChatInput {\n  message: string\n  conversationId?: string\n  actionId?: string\n  /** Opaque predefined-action-contract ref (e.g. a club-dashboard tap). Authoritative over `message` when present. */\n  actionRef?: string\n  userContext?: UserContext\n  grounding?: ChatGrounding\n  /** Features this client can draw (e.g. \"price_presets\"). The server sends nothing that needs a\n   *  feature the list does not name; an absent list means today's responses. */\n  clientCapabilities?: string[]\n  /** The sport the visitor last chose on the greeting's sport switch (a server sport key such as \"nba\"); a hint for the default sport. */\n  rememberedSport?: string\n  /** Onboarding presets stage 2: set only by a preset tool's Send (contract §3). */\n  preset?: ChatPreset\n  page?: PageContext\n}\n\nexport type SignalType =\n  | 'MatchPageView' | 'PlayerPageView' | 'TeamPageView' | 'MarketView'\n  | 'SearchQuery' | 'SessionDepth' | 'TimeOnPage' | 'InsightViewed'\n  | 'InsightMarketClicked' | 'BetPlacedFromInsight' | 'InsightScrollDepth'\n  | 'ToolCall' | 'EntityMention' | 'Handoff' | 'FollowUpQuery' | 'RecommendationDismissed'\n\nexport type SignalEntityType =\n  | 'Match' | 'Team' | 'Player' | 'Competition' | 'Market'\n  | 'Article' | 'Session' | 'Query' | 'Conversation'\n\nexport interface SignalInput {\n  signalType: SignalType\n  entityType: SignalEntityType\n  /** Either this or entityId is required -- an operator's UI mostly knows a display name. */\n  entityName?: string\n  /** Either this or entityName is required -- a dashboard tile knows its entity by id. */\n  entityId?: string\n  operatorUserId?: string\n  anonymousUserId?: string\n  /** Greeting dashboard layout this signal came from, when it is a dashboard tap. */\n  dashboardLayout?: string\n  /** Zero-based tile position within the dashboard, when it is a dashboard tap. */\n  tileIndex?: number\n  /** Wire sport key ('nba'); absent means football. Set by the widget, never by an operator. */\n  sport?: string\n}\n\nexport type { SlipSport }\n\nexport interface SlipSelection {\n  matchOddsId: number\n  matchId: number\n  oddsDecimal: number\n  odds?: { format: OddsFormat; text: string }\n  quotedAtUtc?: string\n  insightId?: string\n  conversationId?: string\n  sport?: SlipSport\n  /** Tennis only: a tennis match id is unique within its tour. */\n  tour?: string\n  /** The pick as the widget knows it, for a host that cannot look `matchOddsId` up. Display only: never price or settle from it. */\n  display?: SlipDisplay\n}\n\n/** `market` is the feed's developer name. `selection` is the selection as the widget drew it: a feed label such as `Home` or `over`, or a label from an insight card such as `Boston Celtics -3.5` or `Over 220.5`, which can carry the team name and the line. `marketLabel` is the market as the widget showed it in its language. `player` names a player prop's player; `home`/`away` are team abbreviations on a prop. */\nexport interface SlipDisplay {\n  home?: string\n  away?: string\n  kickoffUtc?: string\n  market?: string\n  marketLabel?: string\n  selection?: string\n  line?: string\n  player?: string\n}\n\nexport type AddToSlipRejectReason =\n  | 'suspended' | 'closed' | 'login_required'\n  | 'not_found' | 'limit' | 'unsupported'\n\nexport type AddToSlipResult =\n  | { status: 'added'; slip?: { selectionCount: number; totalOddsDecimal?: number } }\n  | { status: 'duplicate' }\n  | { status: 'price_changed'; newOdds: string; accepted: boolean }\n  | { status: 'rejected'; reason: AddToSlipRejectReason; message?: string }\n\nexport type AddToSlipHandler = (\n  selection: SlipSelection,\n) => Promise<AddToSlipResult | void> | AddToSlipResult | void\n\nconst REJECT_REASONS = ['suspended', 'closed', 'login_required', 'not_found', 'limit', 'unsupported']\n\nexport function isAddToSlipResult(v: unknown): v is AddToSlipResult {\n  if (typeof v !== 'object' || v === null) return false\n  const o = v as Record<string, unknown>\n  switch (o.status) {\n    case 'added':\n    case 'duplicate':\n      return true\n    case 'price_changed':\n      return typeof o.newOdds === 'string'\n        && o.newOdds.length > 0\n        && typeof o.accepted === 'boolean'\n    case 'rejected':\n      return typeof o.reason === 'string'\n        && REJECT_REASONS.includes(o.reason)\n    default:\n      return false\n  }\n}\n","import type { FetchLike } from './types'\n\nexport type UnavailableReason = 'no_user' | 'mobile_disabled' | 'widget_disabled' | 'auth_failed'\n\nexport type UnavailableProblem = Exclude<UnavailableReason, 'no_user'>\n\nconst BY_TITLE: Record<string, UnavailableProblem> = {\n  MobileNotEnabled: 'mobile_disabled',\n  WidgetNotEnabled: 'widget_disabled',\n  MissingCredentials: 'auth_failed',\n  InvalidPublicKey: 'auth_failed',\n  OriginNotAllowed: 'auth_failed',\n}\n\n/** Reports the first 401 or 403 the gateway answers, once, as the reason the widget cannot run. The response itself passes through unread. */\nexport function observingFetch(base: FetchLike, onProblem: (reason: UnavailableProblem) => void): FetchLike {\n  let reported = false\n  return async (input, init) => {\n    const res = await base(input, init)\n    if (res.status === 401 || res.status === 403) {\n      let reason: UnavailableProblem = 'auth_failed'\n      try {\n        const body = (await res.clone().json()) as { title?: unknown }\n        if (typeof body.title === 'string' && Object.prototype.hasOwnProperty.call(BY_TITLE, body.title)) reason = BY_TITLE[body.title]!\n      } catch {\n        // an unreadable body is an auth failure\n      }\n      if (!reported) { reported = true; onProblem(reason) }\n    }\n    return res\n  }\n}\n","import type { SlipSport } from './sports'\nexport interface ProgressEventData { phase: string; message: string }\nexport interface AnswerEventData { text: string }\nexport interface EntityCardRecord { wins: number; losses: number; draws?: number; ties?: number }\nexport interface EntityCardStat { label: string; value: string; note?: string | null; muted?: boolean; record?: EntityCardRecord }\nexport interface EntityCardScope {\n  competitionId: number | null\n  label: string\n  imagePath?: string | null\n  period?: string | null\n  stats: EntityCardStat[]\n}\nexport interface EntityCard {\n  entityId: number\n  entityType: string\n  mentionText: string\n  canonicalName: string\n  isUsed?: boolean\n  imagePath?: string\n  subtitle?: string\n  seasonName?: string\n  chip?: string | null\n  scopes?: EntityCardScope[]\n  [key: string]: unknown\n}\nexport interface EntityCardEventData { card: EntityCard }\nexport interface CompareCell { value: string | null; note?: string }\nexport interface CompareColumn { label: string; entityId?: number; seasonName?: string }\nexport interface CompareRow { key: string; label: string; cells: CompareCell[]; lead?: 0 | 1 }\nexport interface CompareCard {\n  kind: 'players' | 'seasons'\n  columns: CompareColumn[]\n  title?: string\n  seasonName?: string\n  scopeLabel?: string\n  competitionId?: number\n  scopeImagePath?: string\n  chip?: string\n  rows: CompareRow[]\n  period?: string\n}\nexport interface CompareCardEventData { card: CompareCard }\nexport interface ActionButtonEventData { action: Record<string, unknown> }\nexport interface IntentChipEventData { intent: Record<string, unknown> }\nexport interface ActionsLoadingEventData { message: string }\nexport type GreetingDashboardLayout = 'market' | 'goal' | 'discovery'\nexport type GreetingDashboardSpan = 'half' | 'full'\nexport type GreetingDashboardTileEmphasis = 'hero'\n\nexport interface GreetingDashboardSignalRef {\n  entityType: string\n  entityId: string\n}\n\nexport interface OddsForms { decimal: string; american?: string; fractional?: string }\nexport interface PriceOption { key: string; value: number; formats: OddsForms }\n\nexport interface GreetingDashboardTile {\n  icon: string\n  title: string\n  titleFormats?: OddsForms | null\n  subtitle?: string | null\n  subtitleFormats?: OddsForms | null\n  span: GreetingDashboardSpan\n  badgeText?: string | null\n  badgeFormats?: OddsForms | null\n  imageUrls?: string[] | null\n  actionValue: string\n  actionValueFormats?: OddsForms | null\n  priceFormats?: OddsForms | null\n  // Opaque predefined-action ref for a server-bound tile: when present the widget forwards it on\n  // tap (the server resolves it, skipping the LLM planning turn) and actionValue is the fallback.\n  actionRef?: string | null\n  signal: GreetingDashboardSignalRef\n  /** \"hero\": the personalized lead tile (always full width). Older servers omit it. */\n  emphasis?: GreetingDashboardTileEmphasis | null\n  /** Hero top-row line (\"Tip-off 02:30 · in 6 h\"); shown only when the hero has no price. Older servers omit it. */\n  meta?: string | null\n  /** Short text marks (team abbreviations) drawn as circles when imageUrls is empty. Older servers omit it. */\n  imageCodes?: string[] | null\n}\n\nexport interface GreetingDashboard {\n  layout: GreetingDashboardLayout\n  title: string\n  subtitle?: string | null\n  footerTip?: string | null\n  tiles: GreetingDashboardTile[]\n  /** Per-visitor layer. Absent when the server has nothing to add. */\n  personal?: GreetingPersonalSection\n  /** greeting_v2 only: the market-first board. */\n  marketFirst?: GreetingMarketFirstSection\n}\n\n/** `another_market` and `build_combo` are sent only by a server older than the canvas greeting. */\nexport type GreetingChipToken = 'live_games' | 'another_market' | 'build_combo'\nexport interface GreetingPriceSelection {\n  label: string\n  /** Invariant decimal text (\"2.5\"). */\n  line?: string\n  /** Provider side (\"Over\", \"Home\", a player name). */\n  side?: string\n  matchOddsId: number\n  formats: OddsForms\n  quotedAtUtc: string\n  /** The price's moves since the visitor's last visit; absent when there is nothing to show. */\n  trail?: GreetingPriceTrail\n}\n/** When isNew is false, points[0] is the price at the last visit; when true, the line was first posted after it. */\nexport interface GreetingPriceTrail {\n  isNew: boolean\n  points: GreetingTrailPoint[]\n}\nexport interface GreetingTrailPoint {\n  atUtc: string\n  price: number\n  priceFormats: OddsForms\n}\nexport interface GreetingStripRow {\n  market: string; marketLabel: string; yourMarket: boolean\n  selections: GreetingPriceSelection[]\n  stat?: string\n}\n/** One sentence about the game with one pick: the card's hook row and its fact rows. */\nexport interface GreetingFactRow { market: string; label: string; selection: GreetingPriceSelection; stat: string }\n/** One game of the \"What can I bet on\" answer: its title and kick-off, and the fact row with the pick it speaks to. */\nexport interface GreetingTopBet { matchId: string; title: string; startsAtUtc: string; competition?: string; fact: GreetingFactRow }\n/** The answer to the \"What can I bet on tonight/today?\" chip: up to three bets, in the order the server ranked them. */\nexport interface GreetingTopBets { sport: string; day: 'tonight' | 'today'; bets: GreetingTopBet[] }\nexport interface GreetingFeaturedCard {\n  matchId: string; startsAtUtc: string; competition?: string\n  /** The matchup line the server words (\"Wales v Portugal\"); absent from an older server. */\n  title?: string\n  home: GreetingEntityChip; away: GreetingEntityChip\n  market: string; marketLabel: string; yourMarket: boolean; player?: string\n  /** @deprecated Only an older server sends it. */\n  chooser?: boolean\n  selections: GreetingPriceSelection[]\n  stat?: string\n  /** The bubble's fact with its pick, drawn above the market chip. */\n  hook?: GreetingFactRow\n  facts?: GreetingFactRow[]\n  /** How many markets the match has priced; the All markets button shows at 2 or more. */\n  marketCount?: number\n  /** The other markets the card's menu names. */\n  markets?: GreetingStripRow[]\n  /** @deprecated Only an older server sends it. */\n  strip?: GreetingStripRow[]\n  /** @deprecated Only an older server sends it; `markets` replaces it. */\n  otherMarkets?: GreetingStripRow[]\n}\n/** @deprecated Only an older server sends alternatives. */\nexport interface GreetingMarketRow {\n  matchId: string; home: string; away: string; startsAtUtc: string; competition?: string\n  selections: GreetingPriceSelection[]\n  stat?: string\n  /** This game's own market label (an NBA row names its player); absent when the row shares the card's. */\n  marketLabel?: string\n}\nexport interface GreetingMarketFirstSection {\n  /** The partner-voice line above the card. */\n  hello?: string\n  featured?: GreetingFeaturedCard\n  /** @deprecated Only an older server sends it. */\n  alternatives?: GreetingMarketRow[]\n  asks: { actionLabel: string; actionValue: string }[]\n  since: { text: string }[]\n  chips: GreetingChipToken[]\n  /** The Smart Acca tab's preset. Optional: absent when the server has no preset to send. */\n  builder?: GreetingBuilderPreset\n  coolOff: boolean\n  /** The visitor has no favourite in any sport: the panel offers the Favourites sheet below the chips. */\n  favouritesPrompt?: boolean\n  yourMarketLabel: string\n  /** @deprecated Only an older server sends it. */\n  chooserPrompt?: string\n}\n/** The one price the bubble's lead speaks about; the widget reprices it on add and never sells this stored price. */\nexport interface GreetingBubblePrice {\n  market: string\n  marketLabel: string\n  /** The pick's own label (\"Over 2.5 goals\"); absent from an older server, where `marketLabel` is the provider's name. */\n  label?: string\n  selection: GreetingPriceSelection\n}\nexport interface GreetingBubble {\n  greetingId: string\n  matchId?: string\n  market?: string\n  text: string\n  cta?: string\n  price?: GreetingBubblePrice\n  /** The sport the bubble speaks about; absent from older servers, where the pill is football. */\n  sport?: string\n  /** The matchup title the bubble draws above its text, with the kick-off time. */\n  game?: string\n  startsAtUtc?: string\n}\n\nexport type GreetingPersonalTier = 'cold' | 'some' | 'known'\nexport type GreetingEntityKind = 'competition' | 'team' | 'player' | 'match'\nexport type GreetingGamesScope = 'page' | 'pinned' | 'starredTeams' | 'starredLeagues' | 'learnedTeam' | 'all'\nexport interface GreetingEntityChip {\n  kind: GreetingEntityKind; id: string; label: string; playing: boolean\n  /** True or absent, never false; competitions only: the league has no game in the window. The widget reads `nextGameAtUtc` first and the flag only when there is no usable instant, so a flag beside a parseable instant is ignored. Absent from older servers. */\n  noGamesToday?: true\n  /** Competitions only: the kick-off of the league's next game that has not started, omitted when a game is live or the server cannot tell. The widget decides \"today\" in the visitor's zone. */\n  nextGameAtUtc?: string\n  /** Team or player image; absent when the server has none (NFL sends none yet). */\n  imagePath?: string\n}\nexport interface GreetingPersonalSection {\n  tier: GreetingPersonalTier\n  ribbon?: { stars: GreetingEntityChip[]; moreStars: number; usual?: { marketKey: string; label: string }; fromChats: GreetingEntityChip[] }\n  /** followTargets: the team or player itself, or both teams of a pinned match; may be empty. One Follow button per entry. */\n  guess?: { kind: GreetingEntityKind; id: string; label: string; reason: string; followTargets: GreetingEntityChip[]; card?: GreetingTeamCard; imagePath?: string }\n  /** Absent in cool-off only; with no key it is the default preset (pack's first market, all games, singles). legs 1 = singles. matchIds: bare ids, max 12; send an empty list with gamesScope 'all' to the grid endpoint as widen=true. The only place combo size and total travel; render as control state, never as text. */\n  builder?: GreetingBuilderPreset\n  teamCards: GreetingTeamCard[]\n  playerCards: GreetingPlayerCard[]\n  facts: GreetingFact[]\n  /** NBA and NFL only: the team availability line, apart from the facts and not one of the three. `text` carries no time; the widget draws `asOfUtc` beside it. Absent from older servers. */\n  injury?: GreetingInjury\n  /** Facts and injury line for each game in the builder's games select. Absent from an older server: the top-level facts then stay. */\n  gameFacts?: GreetingGameFacts[]\n  /** The bare id of the game the top-level `facts` and `injury` are about; always set when they are about a game, omitted otherwise and by older servers. With it the widget keeps them on the opening choice when that is All games or holds this game, and drops them under a single game or a league that does not. Without it the widget goes by each fact's own `matchId`. */\n  factsMatchId?: string\n  asks: { actionLabel: string; actionValue: string }[]\n  since: { text: string }[]\n  followSuggestions: GreetingEntityChip[]\n  /** Starred teams with no game in the window, at most 2. */\n  idleTeams?: GreetingIdleTeam[]\n  /** True when the visitor has a starred team, player or league in a sport other than this section's. Omitted when false and by older servers. */\n  hasStarsElsewhere?: boolean\n}\n/** `imagePath`: the subject's image (team crest or player headshot), absent when the server has none. */\nexport interface GreetingFact { marketKey: string; text: string; hits: number; window: number; matchId?: string; reference?: GreetingFactReference; imagePath?: string }\n/** What a fact speaks to, never a price: the widget prices it live from the builder grid. Absent means the fact is text only. */\nexport interface GreetingFactReference {\n  /** The value to send as BuilderGridRequest.sport. */\n  sport: string\n  /** Bare id, as in the grid's matchIds. */\n  matchId: string\n  /** The value to send as BuilderGridRequest.marketKey. */\n  marketKey: string\n  /** Omitted when the pick has no line (a spread). */\n  line?: number\n  /** The grid leg's own `side`. */\n  side?: 'home' | 'away' | 'over'\n  /** The player, props only. */\n  subject?: string\n  /** Football team totals only, which are Over-only today. The widget shows the leg only if its own `direction` equals this. */\n  direction?: 'over'\n}\nexport interface GreetingInjury { text: string; asOfUtc: string }\nexport interface GreetingGameFacts { matchId: string; facts: GreetingFact[]; injury?: GreetingInjury }\nexport interface GreetingBuilderPreset {\n  marketKey: string\n  gamesScope: GreetingGamesScope\n  matchIds: string[]\n  legs: number\n  totalTarget: string\n  totalOptions: PriceOption[]\n  /** The visitor's usual market first, then pack order. Absent from older servers; never empty when present. */\n  marketOptions?: GreetingMarketOption[]\n  /** Option ids: 'all' (matchIds [] means widen), 'teams', 'leagues', 'learned', 'league:<id>', 'game:<id>'. Absent from older servers. */\n  gamesOptions?: GreetingGamesOption[]\n  /** The option the preset opens on. */\n  gamesOptionId?: string\n  /** A short localized line about when games return (\"Next games tomorrow.\"); shown with the pause note. Omitted when the server has nothing to say. */\n  nextGames?: string | null\n  /** The kick-off of the next games, the instant `nextGames` speaks about; the widget writes the sentence in the visitor's zone. Absent from older servers. */\n  nextGamesAtUtc?: string\n  /** True or absent, never false: the visitor's usual market had no lines in the first-choice games, so the games slot moved wider (C13). */\n  widenedForMarket?: true\n}\nexport interface GreetingMarketOption { key: string; label: string; usual?: boolean }\nexport interface GreetingGamesOption { id: string; label: string; group?: 'league' | 'game'; matchIds: string[]; startsAtUtc?: string; mine?: boolean }\nexport interface GreetingIdleTeam { teamId: string; label: string; actionLabel: string; actionValue: string; imagePath?: string }\nexport type GreetingFormResult = 'W' | 'D' | 'L'\n/** `lines` stays on the wire for older widgets; the widget never draws a team card's lines. `h2h.wins` are the home side's. */\nexport interface GreetingTeamCard {\n  teamId: string; label: string; matchId?: string\n  form: GreetingFormResult[]\n  h2h?: { meetings: number; wins: number; draws: number; losses: number }\n  lines: string[]\n  homeLabel?: string; awayLabel?: string\n  homeForm?: GreetingFormResult[]; awayForm?: GreetingFormResult[]\n  startsAtUtc?: string; competitionLabel?: string\n  fact?: string\n  imagePath?: string; homeTeamImagePath?: string; awayTeamImagePath?: string\n}\nexport type GreetingPlayerStatus = 'available' | 'doubtful' | 'out' | 'unknown'\nexport interface GreetingPlayerHit { label: string; hits: number; window: number }\n/** `lines` stays on the wire for older widgets: drawn only when `hits` is absent. */\nexport interface GreetingPlayerCard {\n  playerId: string; label: string; status: GreetingPlayerStatus; statusAsOfUtc?: string; lines: string[]\n  hits?: GreetingPlayerHit[]; matchLabel?: string; startsAtUtc?: string\n  imagePath?: string\n}\n\n/** One sport's dashboard in a multi-sport greeting. `sport` is the server key (\"football\", \"nba\"); `label` is localized by the server. */\nexport interface GreetingDashboardSet {\n  sport: string\n  label: string\n  /** Absent when there is no live count to mark. */\n  liveGames?: number\n  dashboard: GreetingDashboard\n  /** This sport's chips; absent from older servers, where the turn's own chips are shown for every sport. */\n  suggestedActions?: GreetingSetChip[]\n  /** This sport's own greeting meta; absent from older servers and single-payload turns. */\n  greeting?: GreetingEventMeta\n}\n\n/** Identifies the greeting for the greeting events. `sport`, `case` and the step fields are open tokens, not closed lists. */\nexport interface GreetingEventMeta {\n  greetingId: string\n  case: string\n  sport: string\n  market?: string\n  marketStep: string\n  matchStep: string\n  matchId?: string\n  competitionId?: string\n  chooserShown: boolean\n  /** What led the greeting: `fact`, `price_move`, `popular_match`, `big_change` or `none`. Absent from older servers. */\n  hook?: string\n  /** The fact key (`goals`, `btts`, `result`) when `hook` is `fact`. */\n  hookFact?: string\n}\n\n/** A bound chip carries `actionRef`; a prose chip carries `actionValue`. */\nexport interface GreetingSetChip {\n  actionLabel: string\n  actionRef?: string\n  actionValue?: string\n}\n\n// Every human-readable label below is server-localized; the widget renders it verbatim (no widget i18n).\nexport interface ClubFanDashboardHeadToHead {\n  meetings: number; wins: number; draws: number; losses: number\n  label: string; homeWinsLabel: string; drawsLabel: string; awayWinsLabel: string\n}\nexport interface ClubFanDashboardCardBase { title?: string | null }\n// actionValue (prose command) no longer reaches the wire -- taps now resolve through the opaque\n// actionRef against the server-issued action binding (see ClubFanDashboardPayload.cs Task 11).\nexport interface ClubFanDashboardPrefillCard extends ClubFanDashboardCardBase {\n  actionLabel: string\n  actionRef: string\n  actionType: string\n  rank: number\n}\n\nexport interface FormMatch {\n  result: 'W' | 'D' | 'L'\n  teamScore: number\n  oppScore: number\n  teamIsHome: boolean\n  opponentCrestUrl?: string | null\n}\n\nexport interface FixtureCardData {\n  homeName: string\n  awayName: string\n  competition: string\n  kickoffUnix: number\n  venue?: string | null\n  homeForm: FormMatch[]\n  awayForm: FormMatch[]\n  h2H?: ClubFanDashboardHeadToHead | null\n  fact?: string | null\n  homeCrestUrl?: string | null\n  awayCrestUrl?: string | null\n  kickoffLabel: string\n  dateLabel: string\n  venueLabel: string\n  formLabel: string\n}\nexport interface FixtureCard extends ClubFanDashboardCardBase { cardType: 'fixture'; data: FixtureCardData }\n\nexport interface CountdownData {\n  kickoffUnix: number; homeName: string; awayName: string\n  daysUnit: string; hoursUnit: string; minutesUnit: string; secondsUnit: string\n}\nexport interface CountdownCard extends ClubFanDashboardCardBase { cardType: 'countdown'; data: CountdownData }\n\nexport interface InjuryRow { playerName: string; status: string; injuryType?: string | null; expectedReturnLabel?: string | null }\nexport interface InjuriesCardData {\n  ours: InjuryRow[]; theirs: InjuryRow[]\n  oursName: string; theirsName: string; oursCrestUrl?: string | null; theirsCrestUrl?: string | null; emptyLabel: string\n  oursIsHome: boolean\n}\nexport interface InjuriesCard extends ClubFanDashboardCardBase { cardType: 'injuries'; data: InjuriesCardData }\n\nexport interface ReasonToBetData { angles: string[] }\nexport interface ReasonToBetCard extends ClubFanDashboardCardBase { cardType: 'reasonToBet'; data: ReasonToBetData }\n\nexport interface WhereToWatchData { stations: string[] }\nexport interface WhereToWatchCard extends ClubFanDashboardCardBase { cardType: 'whereToWatch'; data: WhereToWatchData }\n\nexport interface CongestedWeekEntry { opponent: string; kickoffUnix: number; competition: string; dayLabel: string; timeLabel: string }\nexport interface CongestedWeekData { entries: CongestedWeekEntry[] }\nexport interface CongestedWeekCard extends ClubFanDashboardPrefillCard { cardType: 'congestedWeek'; data: CongestedWeekData }\n\nexport interface TransferRow { playerName: string; otherClub: string; type?: string | null }\nexport interface TransfersData { in: TransferRow[]; out: TransferRow[] }\nexport interface TransfersCard extends ClubFanDashboardCardBase { cardType: 'transfers'; data: TransfersData }\n\nexport interface LinkRow { label: string; url: string }\nexport interface LinksData { links: LinkRow[] }\nexport interface LinksCard extends ClubFanDashboardCardBase { cardType: 'links'; data: LinksData }\n\nexport interface PostMatchResultData {\n  homeName: string\n  awayName: string\n  homeScore: number\n  awayScore: number\n  competition?: string | null\n  kickoffLabel: string\n  resultLabel: string\n  homeCrestUrl?: string | null\n  awayCrestUrl?: string | null\n  outcome: 'win' | 'draw' | 'loss'\n}\nexport interface PostMatchGoalLine { text: string; scoredByClub: boolean }\nexport interface PostMatchGoalsData { goals: PostMatchGoalLine[] }\nexport interface PostMatchStatRow { label: string; clubValue: string; oppValue: string; clubNum: number; oppNum: number }\nexport interface PostMatchStatsData { rows: PostMatchStatRow[]; clubIsHome: boolean; homeName: string; awayName: string }\nexport interface PostMatchTopPerformerData { playerName: string; ratingLabel: string }\nexport interface PostMatchNextData { opponentName: string; clubIsHome: boolean; whenLabel: string }\n\nexport interface PostMatchResultCard extends ClubFanDashboardCardBase { cardType: 'postMatchResult'; data: PostMatchResultData }\nexport interface PostMatchGoalsCard extends ClubFanDashboardPrefillCard { cardType: 'postMatchGoals'; data: PostMatchGoalsData }\nexport interface PostMatchStatsCard extends ClubFanDashboardPrefillCard { cardType: 'postMatchStats'; data: PostMatchStatsData }\nexport interface PostMatchTopPerformerCard extends ClubFanDashboardPrefillCard { cardType: 'postMatchTopPerformer'; data: PostMatchTopPerformerData }\nexport interface PostMatchNextCard extends ClubFanDashboardCardBase { cardType: 'postMatchNext'; data: PostMatchNextData }\n\nexport interface RestingNextData { opponentName: string; competition?: string | null; clubIsHome: boolean; whenLabel: string }\nexport interface RestingStandingsData { position: number; points: number; played: number; wins: number; draws: number; losses: number; goalDifference: number; seasonName?: string | null; positionLabel: string; recordLabel: string }\nexport interface RestingSeasonData { topScorerName?: string | null; topScorerGoals: number; keyPlayerName?: string | null; seasonGames: number; seasonScored: number; seasonConceded: number; scorerLabel: string; playerLabel: string; tallyLabel: string }\nexport interface RestingFormData { letters: string[] }\n\nexport interface RestingNextCard extends ClubFanDashboardPrefillCard { cardType: 'restingNext'; data: RestingNextData }\nexport interface RestingStandingsCard extends ClubFanDashboardPrefillCard { cardType: 'restingStandings'; data: RestingStandingsData }\nexport interface RestingSeasonCard extends ClubFanDashboardPrefillCard { cardType: 'restingSeason'; data: RestingSeasonData }\nexport interface RestingFormCard extends ClubFanDashboardCardBase { cardType: 'restingForm'; data: RestingFormData }\n\nexport interface LiveScoreData { homeName: string; awayName: string; homeScore: number; awayScore: number; competition?: string | null; minuteLabel: string; statusLabel: string; minute: number; clockRunning: boolean; homeCrestUrl?: string | null; awayCrestUrl?: string | null }\nexport interface LiveEventLine { minuteLabel: string; text: string; scoredByClub: boolean; minute: number; type: 'goal'|'yellow'|'red'|'sub'|'other'; side: 'home'|'away'; player?: string | null; playerOff?: string | null }\nexport interface LiveTimelineData { events: LiveEventLine[] }\nexport interface LiveStatRow { label: string; clubValue: string; oppValue: string; clubNum: number; oppNum: number }\nexport interface MomentumPoint { minute: number; value: number }\nexport interface LiveStatsData { rows: LiveStatRow[]; momentumLabel?: string | null; momentum: MomentumPoint[]; clubIsHome: boolean; homeName: string; awayName: string }\nexport interface LiveScoreCard extends ClubFanDashboardCardBase { cardType: 'liveScore'; data: LiveScoreData }\nexport interface LiveTimelineCard extends ClubFanDashboardCardBase { cardType: 'liveTimeline'; data: LiveTimelineData }\nexport interface LiveStatsCard extends ClubFanDashboardCardBase { cardType: 'liveStats'; data: LiveStatsData }\n\nexport type ClubFanDashboardCard =\n  | FixtureCard\n  | CountdownCard\n  | InjuriesCard\n  | ReasonToBetCard\n  | WhereToWatchCard\n  | CongestedWeekCard\n  | TransfersCard\n  | LinksCard\n  | PostMatchResultCard\n  | PostMatchGoalsCard\n  | PostMatchStatsCard\n  | PostMatchTopPerformerCard\n  | PostMatchNextCard\n  | RestingNextCard\n  | RestingStandingsCard\n  | RestingSeasonCard\n  | RestingFormCard\n  | LiveScoreCard\n  | LiveTimelineCard\n  | LiveStatsCard\n\nexport interface ClubFanDashboardPayload {\n  phase: string\n  greeting: string\n  greetingIsLead?: boolean\n  cards: ClubFanDashboardCard[]\n}\n\nexport interface TurnCompleteEventData {\n  conversationId: string\n  agentId?: string | null\n  routeDecision: string\n  isAgentRouted: boolean\n  totalLatencyMs: number\n  dashboard?: GreetingDashboard | null\n  /** One dashboard per offered sport; sent only to a widget that named `sport_switch`, for a brand with 2+ sports. `dashboard` is the default sport's. */\n  dashboards?: GreetingDashboardSet[]\n  /** The sport `dashboard` belongs to. Present only with `dashboards`. */\n  defaultSport?: string\n  /** Why `defaultSport` won: hero, page, remembered, lean or first. */\n  defaultSportSource?: string\n  clubFanDashboard?: ClubFanDashboardPayload | null\n  /** The opened sport's greeting meta; absent for a non-betting greeting and from older servers. */\n  greeting?: GreetingEventMeta\n  greetingBubble?: GreetingBubble\n  /** The three-bets answer; sent only on the turn the \"What can I bet on\" chip starts. */\n  topBets?: GreetingTopBets | null\n}\nexport interface StreamErrorEventData {\n  code: string\n  message: string\n  terminal: boolean\n  /** B4 Q7: set only on a limit refusal or the greeting's limit notice. */\n  resetsAt?: string | null\n  retryAfterSeconds?: number | null\n}\n\nexport interface BettingInsightOdds {\n  value: number\n  valueFormats: OddsForms\n  bookmakerId?: number\n  bookmakerName?: string\n  quotedAtUtc?: string\n  isLive?: boolean\n  matchOddsId?: number\n  previousValue?: number | null\n  previousValueFormats?: OddsForms | null\n  previousValueAtUtc?: string | null\n  movementDirection?: 'shortened' | 'drifted' | null\n}\nexport interface BettingInsight {\n  insightId: string\n  matchId: number\n  phase: string\n  ruleId: string\n  text: string\n  marketDeveloperName?: string\n  marketLabel?: string\n  selectionLabel?: string\n  selectionSide?: string | null\n  line?: string | null\n  odds?: BettingInsightOdds | null\n  strength?: number\n  disclaimer?: string | null\n  homeTeamName?: string\n  awayTeamName?: string\n  competitionName?: string\n  addToSlipEnabled?: boolean\n  homeTeamImagePath?: string\n  awayTeamImagePath?: string\n  competitionImagePath?: string\n  kickoffUtc?: string\n  isMarketFloor?: boolean\n  pinEnabled?: boolean\n  /** Server-rendered kickoff chip in the operator's zone + language (e.g. \"Today 19:00\"). Prefer over local formatting of kickoffUtc. */\n  kickoffLabel?: string | null\n  // Forward-compatible: the server may add fields the widget doesn't model yet.\n  [key: string]: unknown\n}\nexport interface BettingInsightEventData { insight: BettingInsight }\nexport interface NbaInsightSelection {\n  key: string\n  marketDeveloperName: string\n  selectionLabel: string\n  side?: string | null\n  line?: string | null\n  price: number\n  priceFormats: OddsForms\n  quotedAtUtc: string\n  matchOddsId?: number | null\n}\nexport interface NbaGameValue { date: string; opponent?: string | null; value: number; minutes: number }\nexport interface NbaListedTeammate { name: string; status: string; statusLabel: string }\nexport interface NbaPropReasonEvidence {\n  playerId: number; playerName: string; stat: string; statLabel: string; line: string; side: string\n  hits: number; n: number; pushes: number; average: number; averageMinutes: number\n  games: NbaGameValue[]; openingLine?: string | null\n  teammates: NbaListedTeammate[]; leftOut: string[]\n}\nexport interface NbaLinePoint { atUtc: string; line: string; price: number; priceFormats: OddsForms; text: string; textFormats: OddsForms }\nexport interface NbaLineLane { points: NbaLinePoint[]; selectionKey?: string | null }\nexport interface NbaInjuryEvent { atUtc: string; teamName: string; text: string }\nexport interface NbaLineMoveEvidence {\n  dateLabel: string; spread?: NbaLineLane | null; total?: NbaLineLane | null; injuries: NbaInjuryEvent[]\n}\nexport interface NbaSplitRow {\n  playerId: number; playerName: string; stat: string; statLabel: string; line: string\n  withoutHits: number; withoutN: number; withHits: number; withN: number; selectionKey: string\n}\nexport interface NbaTeammateOutEvidence {\n  outPlayerId: number; outPlayerName: string; teamName: string; status: string; statusLabel: string\n  seenAtUtc?: string | null; missedGames: number; rows: NbaSplitRow[]\n}\nexport interface NbaCoHitLeg {\n  playerId: number; playerName: string; stat: string; statLabel: string; rung: string; hits: number; n: number; selectionKey: string\n}\nexport interface NbaJointGame { date: string; valueA: number; valueB: number; both: boolean }\nexport interface NbaCoHitEvidence {\n  legs: NbaCoHitLeg[]; games: NbaJointGame[]; bothHits: number; n: number\n  /** @deprecated no longer rendered; older servers still send it */\n  combinedPrice?: number\n}\nexport interface NbaLadderRung { at: string; l5Hits: number; l5N: number; l8Hits: number; l8N: number; selectionKey: string }\nexport interface NbaLadderStat {\n  stat: string; statLabel: string; mainLine?: string | null; overPrice?: number | null; overPriceFormats?: OddsForms | null; underPrice?: number | null; underPriceFormats?: OddsForms | null; rungs: NbaLadderRung[]\n}\nexport interface NbaLadderEvidence { playerId: number; playerName: string; stats: NbaLadderStat[] }\nexport interface NbaMatchupTeam {\n  teamId: number; abbr: string; name: string; n: number\n  pace: number; offRating: number; defRating: number\n  paceRank: number | null; offRatingRank: number | null; defRatingRank: number | null\n  teamsRanked: number; smallSample: boolean; daysRest: number | null; backToBack: boolean\n}\nexport interface NbaMatchupPosition {\n  defendingTeamAbbr: string; position: string; positionLabel: string; stat: string; statLabel: string; allowedPerGame: number\n  rank: number; teamsRanked: number; leagueAvg: number; n: number; smallSample: boolean\n  playerName: string | null; mainLine: string | null; overSelectionKey: string | null; underSelectionKey: string | null\n}\nexport interface NbaMatchupEvidence { teams: NbaMatchupTeam[]; position: NbaMatchupPosition | null }\nexport interface NbaQuarterRung { at: string; hits: number; n: number; selectionKey: string }\nexport interface NbaQuarterStat { stat: string; statLabel: string; rungs: NbaQuarterRung[] }\nexport interface NbaQuarterLadderEvidence {\n  playerId: number; playerName: string; window: '1q' | 'first3min'\n  stats: NbaQuarterStat[]; gamesWithoutPlayByPlay: number\n}\nexport interface NbaSettleLine { stat: string; statLabel: string; line: string; actual: string | null; result: 'over' | 'under' | 'push' | 'void' }\nexport interface NbaSettlePlayer { playerId: number; playerName: string; lines: NbaSettleLine[] }\nexport interface NbaSettleSummary { over: number; under: number; pushes: number; voids: number; n: number }\nexport interface NbaSettleRecapEvidence {\n  finalScore: string; lineBasis: 'last_before_tip'; players: NbaSettlePlayer[]; morePlayers: number; summary: NbaSettleSummary\n}\nexport interface NbaVsMeeting { date: string; value: number; result: 'over' | 'under' | 'push' }\nexport interface NbaVsOpponentEvidence {\n  playerId: number; playerName: string; stat: string; statLabel: string\n  opponentTeamId: number; opponentName: string; mainLine: string\n  overSelectionKey: string | null; underSelectionKey: string | null\n  meetings: NbaVsMeeting[]; meetingsN: number\n  vsAverage: number; othersAverage: number; othersN: number\n  fromSeason: string; smallSample: boolean\n}\nexport interface NbaInsight {\n  insightId: string\n  matchId: number\n  kind: string\n  ruleId: string\n  text: string\n  title: string\n  marketDeveloperName: string\n  marketLabel: string\n  selections: NbaInsightSelection[]\n  notes: string[]\n  disclaimer?: string | null\n  homeTeamName?: string | null\n  awayTeamName?: string | null\n  competitionName?: string | null\n  addToSlipEnabled: boolean\n  kickoffUtc?: string | null\n  pinEnabled: boolean\n  kickoffLabel?: string | null\n  quotedAtUtc: string\n  propReason?: NbaPropReasonEvidence | null\n  lineMove?: NbaLineMoveEvidence | null\n  teammateOut?: NbaTeammateOutEvidence | null\n  coHit?: NbaCoHitEvidence | null\n  ladder?: NbaLadderEvidence | null\n  matchup?: NbaMatchupEvidence | null\n  quarterLadder?: NbaQuarterLadderEvidence | null\n  settleRecap?: NbaSettleRecapEvidence | null\n  vsOpponent?: NbaVsOpponentEvidence | null\n  homeTeamImagePath?: string | null\n  awayTeamImagePath?: string | null\n  competitionImagePath?: string | null\n}\nexport interface NbaInsightEventData { insight: NbaInsight }\nexport type NflInsightKind = 'settle_recap' | 'prop_reason' | 'ladder' | 'injury_report' | 'line_move' | 'ats_record' | 'matchup'\nexport interface NflInsightSelection {\n  key: string\n  marketDeveloperName: string\n  selectionLabel: string\n  side: string\n  line?: string | null\n  price: number\n  priceFormats: OddsForms\n  quotedAtUtc: string\n  matchOddsId?: number | null\n}\nexport interface NflPropReasonGame { week: number; opponent: string; value?: number | null; result?: string | null }\nexport interface NflPropReasonEvidence {\n  playerId: number; playerName: string; propType: string; propLabel: string; line: string\n  hits: number; misses: number; pushes: number; n: number; games: NflPropReasonGame[]\n}\nexport interface NflLadderRung { at: string; hits: number; selectionKey: string }\nexport interface NflLadderEvidence { playerId: number; playerName: string; propType: string; propLabel: string; n: number; rungs: NflLadderRung[] }\nexport interface NflInjuryPlayer { name: string; position?: string | null; status: string; statusLabel: string }\nexport interface NflInjuryReportEvidence {\n  teamId: number; teamName: string; teamAbbr: string; opponentAbbr: string; players: NflInjuryPlayer[]; morePlayers: number\n}\nexport interface NflLineMoveLane {\n  market: string; side: string; openLine?: string | null; openPrice: number; openPriceFormats: OddsForms; openAt: string\n  line?: string | null; price: number; priceFormats: OddsForms; quotedAtUtc: string\n}\nexport interface NflLineMoveEvidence { lanes: NflLineMoveLane[] }\nexport interface NflAtsGame { week: number; opponentAbbr: string; spreadLine: string; result: string }\nexport interface NflAtsRecordEvidence {\n  teamId: number; teamName: string; teamAbbr: string; finishedGames: number\n  n: number; w: number; l: number; p: number; withoutOpening: number; games: NflAtsGame[]\n}\nexport interface NflMatchupEvidence {\n  defenseTeamName: string; defenseAbbr: string; offenseTeamName: string; offenseAbbr: string\n  position: string; basis: string; yardsPerGame: number; touchdownsPerGame: number\n  rank: number; rankedTeams: number; n: number\n}\nexport interface NflSettleRecapLine { propType: string; propLabel: string; line?: string | null; actual?: number | null; result: string }\nexport interface NflSettleRecapPlayer { playerId: number; name: string; lines: NflSettleRecapLine[] }\nexport interface NflSettleRecapSummary { over: number; under: number; pushes: number; yes: number; no: number; voids: number; n: number }\nexport interface NflSettleRecapEvidence {\n  finalScore: string; lineBasis: string; players: NflSettleRecapPlayer[]; morePlayers: number; summary: NflSettleRecapSummary\n}\nexport interface NflInsight {\n  insightId: string\n  matchId: number\n  kind: string\n  text: string\n  title: string\n  marketDeveloperName?: string | null\n  marketLabel?: string | null\n  selections: NflInsightSelection[]\n  disclaimer?: string | null\n  homeTeamName: string\n  awayTeamName: string\n  homeTeamAbbr: string\n  awayTeamAbbr: string\n  competitionName: string\n  addToSlipEnabled: boolean\n  pinEnabled: boolean\n  kickoffUtc?: string | null\n  kickoffLabel?: string | null\n  quotedAtUtc?: string | null\n  sport: string\n  propReason?: NflPropReasonEvidence | null\n  ladder?: NflLadderEvidence | null\n  injuryReport?: NflInjuryReportEvidence | null\n  lineMove?: NflLineMoveEvidence | null\n  atsRecord?: NflAtsRecordEvidence | null\n  matchup?: NflMatchupEvidence | null\n  settleRecap?: NflSettleRecapEvidence | null\n  homeTeamImagePath?: string | null\n  awayTeamImagePath?: string | null\n  competitionImagePath?: string | null\n  [key: string]: unknown\n}\nexport interface NflInsightEventData { insight: NflInsight }\n\nexport type TennisInsightKind = 'serve_return' | 'serve_form' | 'season_path'\nexport interface TennisInsightPlayer { playerId: number; name: string; shortName: string; countryCode?: string | null }\nexport interface TennisInsightPrices {\n  label: string\n  p1Name: string\n  p1: OddsForms\n  p2Name: string\n  p2: OddsForms\n  quotedAtUtc: string\n}\nexport interface TennisFieldDot { playerId: number; servePct: number; returnPct: number }\nexport interface TennisMarkedPlayer {\n  player: TennisInsightPlayer\n  servePct: number\n  returnPct: number\n  matches: number\n  serveRank?: number | null\n  returnRank?: number | null\n  rankLine: string\n}\nexport interface TennisServeReturnEvidence {\n  tourServePct: number\n  tourReturnPct: number\n  fieldSize: number\n  field: TennisFieldDot[]\n  marked: TennisMarkedPlayer[]\n  xAxis: string\n  yAxis: string\n  tourAverage: string\n}\nexport interface TennisServeFormMatch {\n  matchId: number\n  opponent: string\n  opponentCountryCode?: string | null\n  result: 'W' | 'L'\n  score?: string | null\n  roundLabel?: string | null\n  tournamentName?: string | null\n  servePct: number\n  firstServeWonPct?: number | null\n  breakPointsSavedPct?: number | null\n}\nexport interface TennisServeFormLabels {\n  metric: string; tourAverage: string; average: string; inWins: string; inLosses: string; range: string; win: string; loss: string\n}\nexport interface TennisServeFormEvidence {\n  player: TennisInsightPlayer\n  tourServePct: number\n  tourSeason: number\n  matches: TennisServeFormMatch[]\n  average: number\n  winsAverage?: number | null\n  lossesAverage?: number | null\n  min: number\n  max: number\n  labels: TennisServeFormLabels\n}\nexport interface TennisSeasonEvent {\n  tournamentId: number\n  /** May be \"\" when the source has no name; the event still counts in the record. */\n  name: string\n  surface?: string | null\n  round: string\n  roundIndex: number\n  roundLabel: string\n  /** Short axis form of `roundLabel` (e.g. \"QF\"). */\n  roundShort: string\n  wins: number\n  losses: number\n  title: boolean\n  alive: boolean\n  laterRoundsMissing: boolean\n}\n/** `code` is \"hard\", \"clay\", \"grass\", or \"other\" for a bar with no known surface. */\nexport interface TennisSurfaceLegend { code: string; label: string }\nexport interface TennisSeasonPathEvidence {\n  player: TennisInsightPlayer\n  wins: number\n  losses: number\n  titles: number\n  events: TennisSeasonEvent[]\n  record: string\n  legend: TennisSurfaceLegend[]\n  titleMark: string\n  laterRoundsMissingLabel: string\n  /** Names the dashed outline on an event still being played. Absent -> that outline is not drawn. */\n  aliveLabel?: string | null\n}\nexport interface TennisInsight {\n  insightId: string\n  kind: string\n  tour: string\n  season: number\n  title: string\n  subtitle?: string | null\n  matchId?: number | null\n  prices?: TennisInsightPrices | null\n  serveReturn?: TennisServeReturnEvidence | null\n  serveForm?: TennisServeFormEvidence | null\n  seasonPath?: TennisSeasonPathEvidence | null\n}\nexport interface TennisInsightEventData { insight: TennisInsight }\nexport interface MarketOddsRow {\n  selectionLabel: string\n  side?: string | null\n  line?: string | null\n  price: number\n  priceFormats: OddsForms\n  bookmakerId?: number\n  bookmakerName?: string | null\n  isLive?: boolean\n  quotedAtUtc?: string\n  matchOddsId?: number | null\n  isMainLine?: boolean\n  /** The bookmaker is not taking this selection. Absent on older servers -> treated as open. */\n  isSuspended?: boolean\n  /** The selection text exactly as the visitor should read it. Present only when it differs from `selectionLabel` + `line`, which the slip keeps getting raw. */\n  displayLabel?: string | null\n  previousPrice?: number | null\n  previousPriceFormats?: OddsForms | null\n  previousPriceAtUtc?: string | null\n  movementDirection?: 'shortened' | 'drifted' | null\n  movementLookbackHours?: number | null\n  [key: string]: unknown\n}\nexport interface MarketOddsCard {\n  matchId: number\n  homeTeamName?: string | null\n  awayTeamName?: string | null\n  competitionName?: string | null\n  kickoffUtc?: string | null\n  marketDeveloperName?: string\n  marketLabel?: string\n  mainLine?: string | null\n  rows?: MarketOddsRow[]\n  disclaimer?: string | null\n  addToSlipEnabled?: boolean\n  pinEnabled?: boolean\n  homeTeamImagePath?: string | null\n  awayTeamImagePath?: string | null\n  competitionImagePath?: string | null\n  /** Server-rendered kickoff chip in the operator's zone + language. Prefer over local formatting of kickoffUtc. */\n  kickoffLabel?: string | null\n  /** `basketball` on an NBA game card, `americanfootball` on an NFL one; absent or null reads as football. */\n  sport?: string | null\n  /** Short team names (NFL), drawn as the badge in place of a crest. */\n  homeTeamAbbr?: string | null\n  awayTeamAbbr?: string | null\n  /** The strongest stat for this card's market and fixture, already in the turn's language. */\n  insight?: MarketOddsCardInsight | null\n  /** Up to 2 stats for this card's exact market, strongest first; insights[0] is always the same\n   *  object as insight. Null exactly when insight is null. Absent on older servers. */\n  insights?: MarketOddsCardInsight[] | null\n  /** Why the server sent this card unasked: `your_market` for the market the user bets on. */\n  tag?: string | null\n  /** Present when the card is for a live (in-progress) fixture; null on pre-match cards. */\n  live?: MarketOddsLiveBlock | null\n  /** Open markets the Following tab lists for this match. The widget shows \"All markets (N)\"\n   *  when it is 2 or more. Absent on older servers. */\n  marketCount?: number | null\n  // Forward-compatible: the server may add fields the widget doesn't model yet.\n  [key: string]: unknown\n}\n/** Live state snapshot attached to a MarketOddsCard for an in-progress fixture. */\nexport interface MarketOddsLiveBlock {\n  /** LiveMonitorPhase vocabulary: preMatch | live | fullTime | postponed | gone. */\n  phase: string\n  homeScore?: number | null\n  awayScore?: number | null\n  minuteLabel?: string | null\n  isSuspended: boolean\n  isSettled: boolean\n  /** ISO-8601 UTC timestamp of the newest price in this snapshot. */\n  asOfUtc: string\n  /** null when the market is open; \"suspended\" | \"no_live_price\" | \"full_time\" when closed. */\n  closedReason?: string | null\n  /** The live fact for this match. The server sends it only while the card is open; the widget refreshes or clears it on each live update. */\n  fact?: LiveMonitorFact | null\n}\nexport interface MarketOddsCardInsight {\n  insightId: string\n  ruleId: string\n  text: string\n}\nexport interface MarketOddsEventData { card: MarketOddsCard }\n\nexport interface ComboLeg {\n  matchId: number\n  homeTeamName: string\n  awayTeamName: string\n  competitionName?: string | null\n  kickoffUtc: string\n  /** Server-rendered, operator zone + language, like MarketOddsCard. */\n  kickoffLabel?: string | null\n  homeTeamImagePath?: string | null\n  awayTeamImagePath?: string | null\n  marketDeveloperName: string\n  marketLabel: string\n  selectionLabel: string\n  side?: string | null\n  line?: string | null\n  price: number\n  priceFormats: OddsForms\n  matchOddsId: number\n  bookmakerId: number\n  quotedAtUtc: string\n  /** Over or Under, derived from the bookmaker's raw label and never from the localized `selectionLabel`. Absent for a market that is not Over/Under and from an older server. */\n  direction?: 'over' | 'under'\n  /** The server allows pinning this leg's match. Absent on an older server, which means no pin. */\n  pinEnabled?: boolean\n  /** The stat behind the leg. Absent or null on an open answer when the leg has none (stage 3 contract §3);\n   *  an older server always sends one. */\n  insight?: { insightId: string, ruleId: string, text: string } | null\n  /** A player prop's recent-games count for its own side: `hits` of the last `games` games (5 to `window`).\n   *  Counts only, the widget writes the sentence. Absent when the leg has none. */\n  fact?: { hits: number, games: number, window: number } | null\n}\nexport interface ComboReplacedLeg {\n  matchId: number\n  homeTeamName: string\n  awayTeamName: string\n  reason: 'no_price' | 'suspended' | 'kicked_off' | 'outside_limits'\n}\nexport interface ComboCard {\n  /** Stable for the same legs: the sorted matchOddsIds joined by \"-\". */\n  comboId: string\n  kind: 'around' | 'at_least'\n  target: number\n  targetFormats: OddsForms\n  legCount: number\n  /** In kickoff order. */\n  legs: ComboLeg[]\n  /** Product of leg prices, rounded half-away-from-zero to 2 dp. */\n  total: number\n  totalFormats: OddsForms\n  /** \"1.57 × 2.20 × 1.44 = 4.97\", prices with 2 dp, \"×\" is U+00D7. */\n  multiplication: string\n  /** R12: legs swapped out since the tile was built; usually empty. */\n  replacedLegs: ComboReplacedLeg[]\n  /** Server-rendered in the turn's language; null when replacedLegs is empty (G5). Shown as given. */\n  replacedNote: string | null\n  /** The operator's AddToSlipEnabled. */\n  addToSlipEnabled: boolean\n  // Forward-compatible, like MarketOddsCard.\n  [key: string]: unknown\n}\nexport interface ComboCardEventData { card: ComboCard }\n\n/** Onboarding presets stage 2 grid (contract §2). A pick has exactly ComboLeg's fields, so the\n *  widget draws one leg shape everywhere. */\nexport type PresetPick = ComboLeg\nexport interface PresetComboCell {\n  /** The asked target, e.g. 5.0. */\n  total: number\n  totalFormats: OddsForms\n  /** The asked leg count. */\n  legs: number\n  combo: {\n    comboId: string\n    /** The built product, 2 dp. */\n    total: number\n    totalFormats: OddsForms\n    /** \"1.57 × 2.20 × 1.44 = 4.97\", as ComboCard.multiplication. */\n    multiplication: string\n    /** In kickoff order. */\n    legs: PresetPick[]\n  }\n}\n/** Stage 3 contract §2: `pool: 'open'` asks for the open grid, whose legs may carry no stat. */\nexport interface PresetGridOptions { pool?: 'open' }\nexport interface PresetGrid {\n  builtAtUtc: string\n  /** min(6, OperatorConfig.MaxAccaLegs), G9. */\n  maxLegs: number\n  combos: PresetComboCell[]\n  totalOptions: PriceOption[]\n  // Forward-compatible.\n  [key: string]: unknown\n}\n/** The sentence builder's grid: GET price-presets with a combo size and a total. Every field is always present; nulls are null. */\nexport type BuilderGridStatus = 'ok' | 'miss' | 'paused' | 'noSwap'\nexport interface BuilderGridPayload {\n  status: BuilderGridStatus\n  sport: string\n  requestedLegs: number\n  totalTarget: string\n  widened: boolean\n  total: number | null\n  totalFormats: OddsForms | null\n  multiplication: string | null\n  legs: ComboLeg[]\n  legCountThatLands: number | null\n  /** True when no combo lands on the asked total and `legs` is the closest one. */\n  nearest?: boolean\n  /** Which combo of `variants` this is (0 is the best). Null on miss, paused and noSwap; absent from an older server. */\n  variant?: number | null\n  /** How many distinct combos the server can offer for this ask. */\n  variants?: number | null\n}\n/** The most ids a builder request may list in `swapped`; the server answers 400 for more. */\nexport const MAX_SWAPPED_IDS = 12\n/** `total` and the combo size are the visitor's control state; the server decides what lands. */\nexport interface BuilderGridRequest {\n  sport: string\n  marketKey?: string | null\n  matchIds: string[]\n  legs: number\n  total: string\n  widen: boolean\n  /**\n   * Ask for every allowed pick of the market in the one game in `matchIds` (with legs 1, total 'any', widen false) instead of the one best pick.\n   * A fact's price uses it to find its own bet among them. A server that does not know the flag drops it and answers the one pick.\n   */\n  allLegs?: boolean\n  /** Which combo to answer: 0 is the best, 1 and up are the next ones. Left out at 0. */\n  variant?: number\n  /** The `matchOddsId`s of the legs a swap keeps; the answer is those legs plus one new leg. */\n  keep?: number[]\n  /** The `matchOddsId`s of legs already swapped out of this slot; the new leg is none of them. */\n  swapped?: number[]\n  /** The `matchOddsId` of one price to look up again for add-to-slip; needs one matchId and a marketKey, and no widen. */\n  reprice?: number\n  operatorUserId?: string\n  anonymousUserId?: string\n}\n/** Favourites. `id` is opaque to the widget (sport-qualified upstream: `nba:team:14`; football is bare). */\nexport type FavouriteKind = 'competition' | 'team' | 'player'\nexport interface FavouriteEntity {\n  kind: FavouriteKind\n  id: string\n  name: string\n  imageUrl?: string\n  /** Players only. */\n  teamName?: string\n  /** Search results only. */\n  starred?: boolean\n}\nexport interface FavouritesPayload {\n  competitions: FavouriteEntity[]\n  teams: FavouriteEntity[]\n  players: FavouriteEntity[]\n  /** Always present; teams and players only. */\n  suggestions: FavouriteEntity[]\n}\n/** The list call's answer when the server refuses the visitor's ids (400 NoAcceptedIdentity): the brand has anonymous ids off. */\nexport type FavouritesNoIdentity = 'noAcceptedIdentity'\nexport type FavouriteStarResult = 'starred' | 'alreadyStarred' | 'atCap'\nexport interface FavouriteStarResponse {\n  status: FavouriteStarResult\n  count?: number\n  cap?: number\n}\nexport interface AvailableMarket {\n  marketDeveloperName: string\n  marketLabel: string\n  rank: number\n  hasInsight: boolean\n  suspended: boolean\n}\nexport interface MarketOddsBlock {\n  card: MarketOddsCard\n  insight?: { text: string }\n}\nexport interface PlayerPropPrice {\n  matchOddsId: number\n  label: string\n  line: number | null\n  price: number\n  priceFormats: OddsForms\n  quotedAtUtc: string\n  /** Games in the sample that cleared this price. NFL only. */\n  hits?: number | null\n}\nexport interface PlayerPropStatGame {\n  opponent: string\n  isHome: boolean\n  value: number\n}\nexport interface PlayerPropStat {\n  /** `points`, `rebounds`, `assists` or `threes` for NBA; an NFL stat key otherwise. */\n  stat: string\n  /** Server-localized long and short stat words. */\n  label: string\n  shortLabel: string\n  marketDeveloperName: string\n  line: number | null\n  over: PlayerPropPrice | null\n  under: PlayerPropPrice | null\n  ladder: PlayerPropPrice[]\n  /** Newest first. NFL only; `hits` on the prices in this stat count within these games. */\n  games?: PlayerPropStatGame[] | null\n}\nexport interface PlayerPropFact {\n  playerId: number\n  playerName: string\n  side: 'home' | 'away'\n  stat: string\n  /** Server-localized long and short stat words. */\n  label: string\n  shortLabel: string\n  marketDeveloperName: string\n  at: number\n  hits: number\n  games: number\n  window: 'last' | 'home' | 'away'\n  price: PlayerPropPrice\n}\nexport interface NflFormGame {\n  opponent: string\n  isHome: boolean\n  teamScore: number\n  opponentScore: number\n  openingSpread: number | null\n  ats: 'covered' | 'missed' | 'push' | null\n  year: number\n  opponentCrestUrl?: string | null\n}\nexport interface NflForm {\n  home: NflFormGame[]\n  away: NflFormGame[]\n  headToHead: NflFormGame[]\n}\nexport interface NbaFormGame {\n  etDate: string\n  opponent: string\n  isHome: boolean\n  teamScore: number\n  opponentScore: number\n  openingSpread: number | null\n  ats: 'covered' | 'missed' | 'push' | null\n  opponentCrestUrl?: string | null\n}\nexport interface NbaNextGame {\n  etDate: string\n  opponent: string\n  isHome: boolean\n  opponentCrestUrl?: string | null\n}\nexport interface NbaTeamFormRest {\n  rest: 'b2b_second' | 'three_in_four' | 'b2b_first' | 'rest'\n  restDays: number\n  previousEtDate: string\n  next: NbaNextGame | null\n  last5: NbaFormGame[]\n  wins: number\n  losses: number\n  venueWins: number\n  venueLosses: number\n}\nexport interface NbaFormRest {\n  etDate: string\n  home?: NbaTeamFormRest | null\n  away?: NbaTeamFormRest | null\n}\nexport interface PlayerPropGame {\n  pts: number\n  reb: number\n  ast: number\n  fg3m: number\n  opponent: string\n}\n/** A player's box line so far in a game in progress. */\nexport interface PlayerPropLive {\n  secondsPlayed: number\n  pts: number\n  reb: number\n  ast: number\n  fg3m: number\n  fgm: number\n  fga: number\n  pf: number\n}\nexport interface PlayerPropsBundle {\n  matchId: number\n  startsAtUtc: string\n  homeAbbreviation: string\n  awayAbbreviation: string\n  addToSlipEnabled: boolean\n  /** True for in-game prices on a game in progress. Absent from servers older than live props. */\n  live?: boolean\n  /** When the live box was last refreshed. Only on a live bundle. */\n  boxAsOfUtc?: string | null\n  players: Array<{\n    playerId: number\n    name: string\n    position: string | null\n    jerseyNumber: string | null\n    side: 'home' | 'away'\n    imagePath?: string | null\n    last5: PlayerPropGame[]\n    stats: PlayerPropStat[]\n    /** The player's box line so far. Only on a live bundle. */\n    live?: PlayerPropLive | null\n    /** NFL only. The player's live box line. Only on a live bundle. */\n    nflLive?: NflPropLive | null\n  }>\n  /** NFL only. */\n  facts?: PlayerPropFact[] | null\n  /** NFL only. */\n  form?: NflForm | null\n  /** NBA only. */\n  nbaForm?: NbaFormRest | null\n}\nexport interface OddsMovementPoint {\n  atUtc?: string | null\n  price?: number | null\n  priceFormats: OddsForms\n}\nexport interface OddsMovementCard {\n  matchId: number\n  homeTeamName?: string | null\n  awayTeamName?: string | null\n  competitionName?: string | null\n  kickoffUtc?: string | null\n  marketDeveloperName?: string\n  marketLabel?: string\n  selectionLabel?: string\n  side?: string | null\n  line?: string | null\n  bookmakerId?: number\n  bookmakerName?: string | null\n  openingPrice?: number\n  openingPriceFormats: OddsForms\n  currentPrice?: number\n  currentPriceFormats: OddsForms\n  movementDirection?: 'shortened' | 'drifted' | null\n  windowHours?: number\n  points?: OddsMovementPoint[]\n  excludedSuspendedCount?: number\n  disclaimer?: string | null\n  isSuspended?: boolean\n  pinEnabled?: boolean\n  matchOddsId?: number | null\n  /** Server-rendered kickoff chip in the operator's zone + language. Prefer over local formatting of kickoffUtc. */\n  kickoffLabel?: string | null\n  /** The selection as the widget shows it, when selectionLabel and line would not read right joined. selectionLabel and line stay raw for the pin, history and slip. */\n  displayLabel?: string | null\n  [key: string]: unknown\n}\nexport interface OddsMovementEventData { card: OddsMovementCard }\n\nexport type PinKind = 'match' | 'market' | 'selection'\nexport interface PinRef {\n  key: string\n  kind: PinKind\n  matchId: number\n  marketDeveloperName?: string\n  line?: string | null\n  selectionLabel?: string\n  matchOddsId?: number | null\n  withHistory?: boolean\n  /** Absent reads as football on the server, so football pins and stored pins stay unchanged. */\n  sport?: SlipSport\n  /** 'atp' | 'wta', required on a tennis pin (lowercase; the server is case-sensitive). */\n  tour?: string\n}\nexport interface LiveMonitorStatPrice {\n  marketDeveloperName: string\n  marketLabel: string\n  selectionLabel: string\n  price?: number | null\n  priceFormats?: OddsForms | null\n  matchOddsId?: number | null\n  isSuspended: boolean\n  addToSlipEnabled: boolean\n  /** The chip's selection text as the visitor should read it; `selectionLabel` is still what the slip gets. */\n  displayLabel?: string | null\n}\nexport interface LiveMonitorStatRow {\n  label: string\n  homeValue: string\n  awayValue: string\n  homeNum: number\n  awayNum: number\n  market?: LiveMonitorStatPrice | null\n}\n/** Events arrive oldest first. */\nexport interface LiveMonitorEvent {\n  minuteLabel: string\n  text: string\n  type: 'goal' | 'yellow' | 'red' | 'sub' | 'other' | 'td' | 'fg' | 'safety' | 'turnover'\n  /** The team that made the play; for an NFL `turnover` row, the team that took the ball. */\n  side: 'home' | 'away'\n  player?: string | null\n  /** True when this goal is an own goal (type stays 'goal'); the scorer strip marks it \"(OG)\". */\n  ownGoal?: boolean\n  /** True when this goal is a scored in-play penalty (type stays 'goal'); the scorer strip marks it \"(pen)\". */\n  penalty?: boolean\n}\nexport type MonitorPhase = 'preMatch' | 'live' | 'fullTime' | 'postponed' | 'gone'\n// Same shape as ClubFanDashboardHeadToHead -- a distinct, feature-scoped name since this isn't\n// club-fan-dashboard data, but no reason to duplicate the fields.\nexport type HeadToHead = ClubFanDashboardHeadToHead\nexport interface FormAndH2H {\n  homeForm: FormMatch[]\n  awayForm: FormMatch[]\n  h2h: HeadToHead | null\n  homeShortCode?: string | null\n  awayShortCode?: string | null\n}\nexport interface LiveMonitorFact {\n  id: number\n  factKey: string\n  kind: 'league' | 'lookup' | 'tested' | 'record' | 'coachEurope' | 'milestone' | 'quarterLead' | 'quarterTotal'\n  minute: number\n  minuteLabel: string\n  subjectLabel: string\n  text: string\n  basis: string\n  market?: LiveMonitorStatPrice | null\n  marketState?: 'open' | 'held' | 'suspended' | null\n  evidence?: LiveMonitorFactEvidence | null\n  kickoffPrice?: number | null\n  kickoffPriceFormats?: OddsForms | null\n}\nexport interface LiveMonitorFactEvidence {\n  hits?: number | null\n  cases?: number | null\n  ratePct?: number | null\n  similarPct?: number | null\n  since?: string | null\n}\nexport type MonitorSport = 'football' | SlipSport\n/** Basketball block of a followed game. Away is the visitor. */\nexport interface LiveMonitorBasketball {\n  period: number\n  clock?: string | null\n  /** Raw feed word: \"Half\", \"End of Q3\", \"Final\". */\n  statusText?: string | null\n  homeAbbreviation: string\n  awayAbbreviation: string\n  homeNickname: string\n  awayNickname: string\n  homePeriods: (number | null)[]\n  awayPeriods: (number | null)[]\n  homeTimeoutsLeft?: number | null\n  awayTimeoutsLeft?: number | null\n}\nexport interface NflSituation { possession: 'home' | 'away'; down: number; distance: number; ballOn: string; goalToGo: boolean }\nexport interface NflPropLive {\n  passCmp: number; passAtt: number; passYds: number; passTd: number; int: number\n  rushAtt: number; rushYds: number; rushTd: number; rec: number; recYds: number; recTd: number\n}\n/** American football block of a followed game. Away is the visitor. Period is null before kickoff and after the game. */\nexport interface LiveMonitorAmericanFootball {\n  period: number | null\n  clock: string | null\n  statusText: string | null\n  homeAbbreviation: string\n  awayAbbreviation: string\n  homeNickname: string\n  awayNickname: string\n  homePeriods: (number | null)[]\n  awayPeriods: (number | null)[]\n  situation?: NflSituation | null\n  lastPlay?: string | null\n}\nexport interface LiveMonitorMatch {\n  matchId: number\n  phase: MonitorPhase\n  status: 'ok' | 'stale' | 'gone'\n  homeTeamName?: string | null\n  awayTeamName?: string | null\n  competitionName?: string | null\n  kickoffUtc?: string | null\n  homeScore?: number | null\n  awayScore?: number | null\n  liveMinute?: number | null\n  liveAddedTime?: number | null\n  liveStatus?: string | null\n  minuteLabel?: string | null\n  events: LiveMonitorEvent[]\n  statRows: LiveMonitorStatRow[]\n  momentum: MomentumPoint[]\n  availableMarkets?: AvailableMarket[]\n  homeCrestUrl?: string | null\n  awayCrestUrl?: string | null\n  competitionCrestUrl?: string | null\n  asOfUtc: string\n  momentumHomePct?: number | null\n  /** Active live facts, current first. Absent on older servers. */\n  facts?: LiveMonitorFact[]\n  /** Pinned + pre-match only -- absent/null once the match goes live, is unpinned, or on older servers. */\n  formAndH2H?: FormAndH2H | null\n  /** Absent on older servers; read it as football. */\n  sport?: MonitorSport\n  /** Set only on a basketball match. */\n  basketball?: LiveMonitorBasketball | null\n  /** Set only on an American football match. */\n  americanFootball?: LiveMonitorAmericanFootball | null\n  /** Set only on a tennis match, even a gone one: a tennis id is unique only within its tour. */\n  tour?: string\n  /** Set only on a pinned tennis match that was found. */\n  tennis?: LiveMonitorTennis | null\n  [key: string]: unknown\n}\nexport interface TennisPlayerSide {\n  playerId: number\n  name: string\n  shortName: string\n  countryCode?: string | null\n  rank?: number | null\n  racePosition?: number | null\n}\nexport interface TennisMatchHeader {\n  tour: string\n  matchId: number\n  tournamentId: number\n  season: number\n  tournamentName?: string | null\n  category?: string | null\n  surface?: string | null\n  round?: string | null\n  bestOf?: number | null\n  startsAtUtc?: string | null\n  scheduledDate?: string | null\n  timeTba: boolean\n  phase: string\n}\nexport interface TennisWl { w: number; l: number }\nexport interface TennisPlayerRecord {\n  surfaceWl?: TennisWl | null\n  tiebreakWl?: TennisWl | null\n  decidingWl?: TennisWl | null\n  /** Omitted when the player has no career row. */\n  seasonWl?: TennisWl | null\n  titles?: number | null\n}\nexport interface TennisMeeting {\n  year: number\n  tournamentName?: string | null\n  round?: string | null\n  surface?: string | null\n  winnerId: number\n  score?: string | null\n}\nexport interface TennisHeadToHead {\n  p1Wins: number\n  p2Wins: number\n  last?: TennisMeeting | null\n  /** Newest first, at most three. Absent on an older server; the widget falls back to `last`. */\n  meetings?: TennisMeeting[] | null\n}\nexport interface TennisCardLabels {\n  p1RankRace?: string | null\n  p2RankRace?: string | null\n  matchWinner: string\n  surfaceSeason?: string | null\n  tiebreaks: string\n  decidingSets: string\n  seasonWl?: string | null\n  titles?: string | null\n  /** Null when the stats read failed; the widget hides the whole head to head section. */\n  headToHead?: string | null\n  lastMeeting?: string | null\n  ask: string\n}\nexport interface LiveMonitorTennis {\n  header: TennisMatchHeader\n  p1: TennisPlayerSide\n  p2: TennisPlayerSide\n  price?: TennisWinnerPrice | null\n  /** 'W' | 'L', newest first. */\n  p1Form?: string[] | null\n  p2Form?: string[] | null\n  p1Record?: TennisPlayerRecord | null\n  p2Record?: TennisPlayerRecord | null\n  headToHead?: TennisHeadToHead | null\n  labels: TennisCardLabels\n  askPrompt: string\n  /** Present while live and on a final card; absent before the start. */\n  score?: TennisScore | null\n  live?: TennisLiveBlock | null\n}\n\nexport interface TennisSetScore {\n  setNumber: number\n  p1Games?: number | null\n  p2Games?: number | null\n  p1Tiebreak?: number | null\n  p2Tiebreak?: number | null\n  isComplete: boolean\n}\n/** How a match ended when it was not played out; absent when it was. */\nexport type TennisEndState = 'retired' | 'walkover' | 'canceled' | 'abandoned'\nexport interface TennisScore {\n  sets: TennisSetScore[]\n  p1Sets: number\n  p2Sets: number\n  /** Absent once the match is final. */\n  currentSet?: number | null\n  /** Raw feed strings \"0\" \"15\" \"30\" \"40\" \"A\"; only while live. */\n  p1Point?: string | null\n  p2Point?: string | null\n  isDeuce: boolean\n  isTiebreak: boolean\n  /** Only while live. */\n  server?: 1 | 2 | null\n  asOfUtc: string\n  /** Set on a final that was not played out. For walkover, canceled and abandoned the set counts mean nothing\n   *  and the row's homeScore/awayScore are null; a retirement keeps its sets, the last one unfinished. */\n  endState?: TennisEndState | null\n}\nexport type TennisStatKind = 'pct' | 'count' | 'rating'\nexport interface TennisStatRow {\n  key: string\n  kind: TennisStatKind\n  p1Value?: number | null\n  p2Value?: number | null\n  label: string\n  shortLabel: string\n}\nexport interface TennisStatTable { serve: TennisStatRow[]; return: TennisStatRow[] }\nexport interface TennisStatSet { setNumber: number; table: TennisStatTable }\nexport interface TennisServeReturn { match: TennisStatTable; sets: TennisStatSet[] }\nexport interface TennisTodayRow {\n  key: string\n  label: string\n  p1Today?: number | null\n  p1Season?: number | null\n  p2Today?: number | null\n  p2Season?: number | null\n}\nexport interface TennisTodayVsSeason { rows: TennisTodayRow[] }\nexport interface TennisLiveLabels {\n  baseline?: string | null\n  pricesPaused: string\n  setsSoFar: string\n  sets?: string | null\n  setLines: string[]\n  serve?: string\n  return?: string\n  matchTab?: string\n  note?: string\n  todayVsSeason?: string\n  seasonScope?: string\n  /** The localized end-state marker (\"Ret.\", \"Walkover\"); only when score.endState is set. */\n  endState?: string | null\n}\nexport interface TennisLiveBlock {\n  elapsedSeconds?: number | null\n  pricesPaused: boolean\n  labels: TennisLiveLabels\n  serveReturn?: TennisServeReturn | null\n  todayVsSeason?: TennisTodayVsSeason | null\n}\nexport interface LiveMonitorMarket {\n  key: string\n  status: 'ok' | 'stale' | 'gone'\n  phase: MonitorPhase\n  homeScore?: number | null\n  awayScore?: number | null\n  minuteLabel?: string | null\n  /** Only on a chat live card's entry (key `live:card:{matchId}`): the match's live facts, current first. */\n  facts?: LiveMonitorFact[] | null\n  homeTeamName?: string | null\n  awayTeamName?: string | null\n  card?: MarketOddsCard | null\n  history?: OddsMovementCard | null\n  isSettled: boolean\n  isSuspended: boolean\n  asOfUtc: string\n  homeCrestUrl?: string | null\n  awayCrestUrl?: string | null\n  kickoffUtc?: string | null\n  [key: string]: unknown\n}\nexport interface LiveMonitorSnapshot {\n  matches: LiveMonitorMatch[]\n  markets: LiveMonitorMarket[]\n  serverNowUtc: string\n  nextPollSeconds: number\n}\n\nexport type ScheduleSport = 'football' | 'basketball' | 'americanfootball' | 'tennis'\n\nexport interface ScheduleMatch {\n  matchId: number\n  /** Absent means football. */\n  sport?: ScheduleSport\n  homeTeamName: string\n  awayTeamName: string\n  homeTeamImagePath?: string | null\n  awayTeamImagePath?: string | null\n  homeTeamAbbr?: string | null\n  awayTeamAbbr?: string | null\n  kickoffUnix: number\n  timeTba?: boolean | null\n  homeCountryCode?: string | null\n  awayCountryCode?: string | null\n  round?: string | null\n  /** Tennis only: 'atp' | 'wta'. */\n  tour?: string\n}\n\nexport interface ScheduleGroup {\n  /** Absent means football. */\n  sport?: ScheduleSport\n  competitionId: number\n  competitionName: string\n  /** Tennis only: 'atp' | 'wta'. */\n  tour?: string\n  /** Catalog country, null for continental competitions. competitionName is not an identity —\n   *  a real Saturday returns four competitions all named \"Premier League\". */\n  competitionCountry?: string | null\n  competitionImagePath?: string | null\n  rank: number\n  expandedByDefault: boolean\n  matches: ScheduleMatch[]\n  isStarred: boolean\n  isLearned: boolean\n  learnedRank: number | null\n  category?: string | null\n  surface?: string | null\n}\n\nexport interface ScheduleMatchDays {\n  sport: ScheduleSport\n  /** Local dates (YYYY-MM-DD) that have at least one match for this sport. */\n  dates: string[]\n}\n\nexport interface LeagueStarResult {\n  starred: boolean\n}\n\nexport interface SchedulePayload {\n  localDate: string\n  groups: ScheduleGroup[]\n  matchDays: ScheduleMatchDays[]\n}\n\nexport interface MatchState {\n  matchId: number\n  /** Absent means football. Football match ids and NBA game ids share a numeric space, so key on both. */\n  sport?: ScheduleSport\n  /** Tennis only: 'atp' | 'wta'. */\n  tour?: string\n  phase: MonitorPhase\n  minuteLabel?: string | null\n  homeScore?: number | null\n  awayScore?: number | null\n  /** Paused between halves. Phase stays 'live' — still in play — but there is no minute to show:\n   *  the provider holds the clock at 45 through the break. */\n  isHalfTime?: boolean\n  /** When the sync last wrote this reading. The client ages the minute against it, because the\n   *  value was already up to one sync interval old before we polled for it. */\n  stateAsOfUtc?: string | null\n  /** Tennis only: the score, on a live row of the Live tab, on a pinned live or final card, and on a final row\n   *  that was not played out (then with endState and no localized label: rows carry only the code). */\n  tennis?: TennisScore | null\n}\n\nexport interface TennisWinnerPrice {\n  bookmaker: string\n  p1: OddsForms\n  p2: OddsForms\n  p1Value: number\n  p2Value: number\n  p1OddsId?: number | null\n  p2OddsId?: number | null\n  addToSlipEnabled: boolean\n  quotedAtUtc: string\n  isLive: boolean\n  /** The opening price, pre-match only; absent when the price never moved off it. */\n  p1Previous?: OddsForms | null\n  p2Previous?: OddsForms | null\n  previousAtUtc?: string | null\n  /** 'shortened' | 'drifted'; absent when equal to the opening. */\n  p1Direction?: string | null\n  p2Direction?: string | null\n  /** Live price only: which price the movement arrows compare against. */\n  baselineKind?: 'opening' | 'preMatch' | null\n}\n\nexport interface TennisRowPrice { matchId: number; tour: string; price?: TennisWinnerPrice | null }\n\n/** A tennis match is unique only within its tour. */\nexport interface TennisMatchKey { tour: string; matchId: number }\n\nexport interface StatesPayload {\n  states: MatchState[]\n  /** Absent or null: no price column (odds off, persona off, or no ids sent). */\n  tennisPrices?: TennisRowPrice[] | null\n}\n\ninterface EventEnvelope<TType extends string, TData> {\n  type: TType\n  requestId: string\n  timestamp: string\n  data: TData\n}\nexport type ChatEvent =\n  | EventEnvelope<'progress', ProgressEventData>\n  | EventEnvelope<'answer', AnswerEventData>\n  | EventEnvelope<'entity_card', EntityCardEventData>\n  | EventEnvelope<'action_button', ActionButtonEventData>\n  | EventEnvelope<'intent_chip', IntentChipEventData>\n  | EventEnvelope<'actions_loading', ActionsLoadingEventData>\n  | EventEnvelope<'turn_complete', TurnCompleteEventData>\n  | EventEnvelope<'betting_insight', BettingInsightEventData>\n  | EventEnvelope<'nba_insight', NbaInsightEventData>\n  | EventEnvelope<'nfl_insight', NflInsightEventData>\n  | EventEnvelope<'tennis_insight', TennisInsightEventData>\n  | EventEnvelope<'compare_card', CompareCardEventData>\n  | EventEnvelope<'market_odds', MarketOddsEventData>\n  | EventEnvelope<'combo_card', ComboCardEventData>\n  | EventEnvelope<'odds_movement', OddsMovementEventData>\n  | EventEnvelope<'error', StreamErrorEventData>\n\nexport interface GameSummary {\n  gameId: string\n  gameDay: string\n  fixtureId: number\n  kind: 'daily' | 'fixture'\n  ranked: boolean\n  status: 'available' | 'in_progress' | 'played' | 'locked' | 'graded' | 'voided'\n  score?: number | null\n  isCorrect?: boolean | null\n  lockAtUtc?: string | null\n  kickoffUtc?: string | null\n  title?: string | null\n}\n\nexport interface GameListPayload {\n  gameDay: string\n  games: GameSummary[]\n}\n\nexport interface GameStatePayload {\n  gameId: string\n  gameDay: string\n  configJson?: string | null\n}\n\nexport interface SubmitPlayBody {\n  operatorUserId: string\n  gameDay: string\n  answerJson?: string | null\n  fixtureId?: number\n}\n\nexport interface SubmitPlayResult {\n  alreadyPlayed: boolean\n  score: number\n  isCorrect: boolean\n  clientStateJson?: string | null\n  attemptsUsed: number\n  weeklyRank?: number | null\n  pointsDelta?: number | null\n  currentStreak?: number | null\n}\n\nexport interface GameResultPayload {\n  status: 'in_progress' | 'played' | 'graded' | 'pending' | 'voided'\n  score: number\n  isCorrect: boolean\n  clientStateJson?: string | null\n  attemptsUsed: number\n}\n\nexport interface LeaderboardRow {\n  rank: number\n  operatorUserId: string\n  handle: string\n  points: number\n  currentStreak: number\n}\n\nexport interface AllTimeRow {\n  rank: number\n  operatorUserId: string\n  handle: string\n  allTimePoints: number\n}\n\n/** Winner of the previous (frozen) week, surfaced on the empty-board state for continuity. */\nexport interface LeaderboardChampion {\n  handle: string\n  points: number\n}\n\nexport interface LeaderboardPayload {\n  week: string\n  weeklyTop: LeaderboardRow[]\n  myWeeklyRow?: LeaderboardRow | null\n  allTimeTop: AllTimeRow[]\n  myAllTimeRow?: AllTimeRow | null\n  /** Prize label configured for the current week; absent/null when no prize is set. */\n  weeklyPrize?: string | null\n  /** Previous week's champion; absent/null on a club's first-ever week (cold start). */\n  lastWeek?: LeaderboardChampion | null\n}\n\nexport interface ClubFixture {\n  id: number\n  competitionId: number | null\n  competitionName: string | null\n  seasonName: string | null\n  round: string | null\n  matchDateTime: string | null\n  stadiumName: string | null\n  matchState: string | null\n  homeTeamId: number | null\n  homeTeamName: string | null\n  homeScore: number | null\n  awayTeamId: number | null\n  awayTeamName: string | null\n  awayScore: number | null\n}\nexport interface ClubFixturesPayload { fixtures: ClubFixture[] }\n\nexport interface ClubStandingRow {\n  table: string | null\n  position: number\n  teamId: number\n  teamName: string\n  playedGames: number\n  wins: number\n  draws: number\n  losses: number\n  goalsFor: number\n  goalsAgainst: number\n  goalDifference: number\n  points: number\n}\nexport interface ClubStandingsPayload { competitionId: number; seasonName: string; rows: ClubStandingRow[] }\n\nexport interface ClubSquadPlayer {\n  playerId: number\n  playerName: string\n  positionId: number | null\n  positionName: string | null\n  detailedPositionName: string | null\n  jerseyNumber: number | null\n}\nexport interface ClubSquadPayload { players: ClubSquadPlayer[] }\n\nexport interface ClubPlayerSeasonStats {\n  playerId: number\n  playerName: string\n  positionName: string | null\n  jerseyNumber: number | null\n  appearances: number\n  goals: number\n  assists: number\n  yellowCards: number\n  redCards: number\n  minutesPlayed: number\n  averageRating: number | null\n  expectedGoals: number | null\n  totalShots: number | null\n  starts?: number\n  positionCode?: string | null\n}\nexport interface ClubSquadStatsPayload {\n  seasonName: string\n  competitionName?: string | null\n  clubMatchesPlayed?: number\n  players: ClubPlayerSeasonStats[]\n}\n\nexport type ClubPlayerAvailabilityStatus = 'available' | 'injured' | 'suspended' | 'unavailable'\nexport interface ClubPlayerAvailability {\n  status: ClubPlayerAvailabilityStatus\n  detail?: string | null\n  expectedReturnUnixMs?: number | null\n}\nexport interface ClubNextFixture { matchId: number; kickoffUnixMs: number; opponentName: string; isHome: boolean }\nexport interface ClubMatchLogRow {\n  matchId: number\n  kickoffUnixMs: number\n  opponentName: string\n  isHome: boolean\n  goalsFor: number\n  goalsAgainst: number\n  result: 'W' | 'D' | 'L'\n  minutes: number\n  goals: number\n  assists: number\n  yellowCards: number\n  sentOff: boolean\n  rating?: number | null\n}\nexport interface ClubPerformanceMetric {\n  key: string\n  group: 'shooting' | 'passing' | 'possession' | 'defending'\n  total?: number | null\n  per90?: number | null\n  totalRank?: number | null\n  per90Rank?: number | null\n  isPercent: boolean\n}\nexport interface ClubPlayerPerformance {\n  positionGroup: 'G' | 'D' | 'M' | 'F'\n  cohortSize: number\n  ranked: boolean\n  /** Why `ranked` is false; null when ranked. Absent from APIs older than this field. */\n  unrankedReason?: 'minutes' | 'cohort' | 'noLeague' | null\n  metrics: ClubPerformanceMetric[]\n}\n\nexport interface ClubPlayerDetailPayload {\n  playerId: number\n  playerName: string\n  positionName: string | null\n  jerseyNumber: number | null\n  nationality: string | null\n  dateOfBirthUnixMs: number | null\n  heightCm: number | null\n  foot: string | null\n  seasonStats: ClubPlayerSeasonStats\n  photoUrl?: string | null\n  teamName?: string | null\n  positionCode?: string | null\n  competitionName?: string | null\n  availability?: ClubPlayerAvailability | null\n  nextFixture?: ClubNextFixture | null\n  matchLog?: ClubMatchLogRow[]\n  performance?: ClubPlayerPerformance | null\n}\n\nexport interface ClubRecordEntry { playerId: number; playerName: string; value: number }\nexport interface ClubRecordsPayload {\n  topScorers: ClubRecordEntry[]\n  mostAssists: ClubRecordEntry[]\n  mostAppearances: ClubRecordEntry[]\n  sinceSeasonName: string | null\n}\n","/** True the first time for a key, and again once `intervalMs` has passed since the last true. */\nexport function createRateLimiter(intervalMs: number, now: () => number = () => Date.now()): (key: string) => boolean {\n  const last = new Map<string, number>()\n  return (key) => {\n    const t = now()\n    const prev = last.get(key)\n    if (prev !== undefined && t - prev < intervalMs) return false\n    last.set(key, t)\n    return true\n  }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAO,IAAM,iBAAN,cAA6B,MAAM;AAAA,EAGxC,YAAY,SAAiB,MAAc,QAAiB;AAC1D,UAAM,OAAO;AACb,SAAK,OAAO,WAAW;AACvB,SAAK,OAAO;AACZ,SAAK,SAAS;AACd,WAAO,eAAe,MAAM,WAAW,SAAS;AAAA,EAClD;AACF;AACO,IAAM,YAAN,cAAwB,eAAe;AAAA,EAC5C,YAAY,UAAU,iCAAiC;AAAE,UAAM,SAAS,gBAAgB,GAAG;AAAA,EAAE;AAC/F;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