{"version":3,"sources":["../../../src/components/features/video-bites-shared.ts"],"names":[],"mappings":";;;AAiBO,IAAM,yBAAA,GAA4B;AAsBlC,SAAS,cAAA,CACd,GACA,gBAAA,EAC8B;AAC9B,EAAA,IAAI,CAAC,CAAA,EAAG,SAAA,EAAW,OAAO,IAAA;AAC1B,EAAA,OAAO;AAAA,IACL,MAAM,CAAA,CAAE,SAAA;AAAA,IACR,SAAA,EAAW,EAAE,UAAA,IAAc,IAAA;AAAA,IAC3B,QAAA,EAAU,CAAA,CAAE,SAAA,IAAa,gBAAA,IAAoB;AAAA,GAC/C;AACF;AAOO,SAAS,wBAAA,CAAyB,GAAgB,CAAA,EAAwB;AAC/E,EAAA,IAAI,CAAC,CAAA,CAAE,UAAA,IAAc,CAAC,CAAA,CAAE,YAAY,OAAO,CAAA;AAC3C,EAAA,IAAI,CAAC,CAAA,CAAE,UAAA,EAAY,OAAO,CAAA;AAC1B,EAAA,IAAI,CAAC,CAAA,CAAE,UAAA,EAAY,OAAO,EAAA;AAC1B,EAAA,OAAO,IAAI,IAAA,CAAK,CAAA,CAAE,UAAU,CAAA,CAAE,OAAA,EAAQ,GAAI,IAAI,IAAA,CAAK,CAAA,CAAE,UAAU,CAAA,CAAE,OAAA,EAAQ;AAC3E;AAWO,SAAS,yBAAA,CAA0B,GAAgB,CAAA,EAAwB;AAChF,EAAA,IAAI,CAAC,CAAA,CAAE,WAAA,IAAe,CAAC,CAAA,CAAE,aAAa,OAAO,CAAA;AAC7C,EAAA,IAAI,CAAC,CAAA,CAAE,WAAA,EAAa,OAAO,CAAA;AAC3B,EAAA,IAAI,CAAC,CAAA,CAAE,WAAA,EAAa,OAAO,EAAA;AAC3B,EAAA,OAAO,IAAI,IAAA,CAAK,CAAA,CAAE,WAAW,CAAA,CAAE,OAAA,EAAQ,GAAI,IAAI,IAAA,CAAK,CAAA,CAAE,WAAW,CAAA,CAAE,OAAA,EAAQ;AAC7E","file":"video-bites-shared.cjs","sourcesContent":["/**\n * video-bites-shared — SERVER-SAFE leaf for the video-bites surface.\n *\n * No React imports, no 'use client'. Published as its own subpath\n * (`@flamingo-stack/openframe-frontend-core/components/features/video-bites-shared`)\n * so server-side consumers (the hub's featured-video-bites DAL) can import the\n * title constant, profile adapter, and sort comparator WITHOUT pulling the\n * 'use client' strip/MuxPlayer module graph into a server bundle — same\n * pattern (and reason) as `mux-origins.ts`.\n *\n * Client components (`<VideoBitesStrip>`, the features barrel) re-export from\n * here; there must never be a second definition of any of these.\n */\n\nimport type { VideoTeaser } from '../../types/video-processing'\n\n/** Single exported home for the unified public bites-section title. */\nexport const DEFAULT_VIDEO_BITES_TITLE = 'Key Moments'\n\n/**\n * Profile rendered in the strip's hover overlay. Structurally identical to\n * `UserDisplayProps` — the overlay renders it via `<UserDisplay>` 1:1.\n */\nexport interface VideoBiteStripProfile {\n  name: string\n  avatarUrl?: string | null\n  subtitle?: string | null\n}\n\n/**\n * Adapter SSoT: builds a strip profile from the repo-wide author/user shape\n * (`profiles` rows and hydrated authors all expose full_name / avatar_url /\n * job_title). ALL strip call sites and the featured DAL's mapProfile route\n * through this — never hand-roll the mapping.\n *\n * Returns NULL (never `{name: ''}`) when `full_name` is null/empty: callers\n * rely on `profile ?? fallback` chains, and some producers (e.g. the release\n * kit) pass null-field author stubs.\n */\nexport function toStripProfile(\n  p?: { full_name?: string | null; avatar_url?: string | null; job_title?: string | null } | null,\n  fallbackSubtitle?: string | null,\n): VideoBiteStripProfile | null {\n  if (!p?.full_name) return null\n  return {\n    name: p.full_name,\n    avatarUrl: p.avatar_url ?? null,\n    subtitle: p.job_title ?? fallbackSubtitle ?? null,\n  }\n}\n\n/**\n * Null-safe created_at-desc COMPARATOR (missing dates sort last).\n * Call as `[...arr].sort(sortBitesByCreatedAtDesc)` — shared by the strip,\n * the hub admin editor, and the hub featured DAL.\n */\nexport function sortBitesByCreatedAtDesc(a: VideoTeaser, b: VideoTeaser): number {\n  if (!a.created_at && !b.created_at) return 0\n  if (!a.created_at) return 1\n  if (!b.created_at) return -1\n  return new Date(b.created_at).getTime() - new Date(a.created_at).getTime()\n}\n\n/**\n * FEATURED-recency comparator: `featured_at` DESC — the stamp every featured\n * bite carries (written by the admin star toggle; pre-existing featured bites\n * were backfilled 2026-08-19, so there is no date-fallback ranking). The\n * comparator FEATURED surfaces (the cross-entity aggregation + its strips)\n * must use — ranking those surfaces by `created_at` made featuring any older\n * bite a silent no-op once the surface cap filled with newer bites. A missing\n * stamp (only possible from a stale mid-deploy writer) sorts last.\n */\nexport function sortBitesByFeaturedAtDesc(a: VideoTeaser, b: VideoTeaser): number {\n  if (!a.featured_at && !b.featured_at) return 0\n  if (!a.featured_at) return 1\n  if (!b.featured_at) return -1\n  return new Date(b.featured_at).getTime() - new Date(a.featured_at).getTime()\n}\n"]}