{"version":3,"sources":["../src/strategies/fallback/variant-routing.ts"],"names":[],"mappings":";;;AAmBA,IAAM,oCAAoB,IAAI,GAAA,CAAI,CAAC,KAAA,EAAO,KAAA,EAAO,KAAK,CAAC,CAAA;AAIvD,IAAM,eAAA,uBAAsB,GAAA,CAAgB,CAAC,OAAO,KAAA,EAAO,MAAA,EAAQ,QAAA,EAAU,MAAM,CAAC,CAAA;AACpF,IAAM,eAAA,uBAAsB,GAAA,CAAgB,CAAC,QAAQ,MAAA,EAAQ,KAAA,EAAO,KAAA,EAAO,KAAK,CAAC,CAAA;AAE1E,SAAS,iBAAiB,GAAA,EAAiC;AAChE,EAAA,IAAI,iBAAA,CAAkB,GAAA,CAAI,GAAA,CAAI,SAAS,GAAG,OAAO,UAAA;AACjD,EAAA,KAAA,MAAW,CAAA,IAAK,IAAI,WAAA,EAAa;AAE/B,IAAA,IAAI,CAAC,eAAA,CAAgB,GAAA,CAAI,CAAA,CAAE,KAAK,GAAG,OAAO,UAAA;AAAA,EAC5C;AACA,EAAA,KAAA,MAAW,CAAA,IAAK,IAAI,WAAA,EAAa;AAC/B,IAAA,IAAI,CAAC,eAAA,CAAgB,GAAA,CAAI,CAAA,CAAE,KAAK,GAAG,OAAO,UAAA;AAAA,EAC5C;AACA,EAAA,OAAO,WAAA;AACT","file":"chunk-F3LQJKXK.cjs","sourcesContent":["import type { MediaContext, AudioCodec, VideoCodec } from \"../../types.js\";\nimport type { LibavVariant } from \"./libav-loader.js\";\n\n/**\n * Decide which libav.js variant to load for a given media context.\n *\n * - **webcodecs** (~5 MB, npm) — modern formats only, designed for the\n *   WebCodecs bridge. Used when the codec is browser-supported and we just\n *   need libav.js for demuxing or as a parser source.\n *\n * - **avbridge** (custom build, vendor/libav/) — has the AVI/ASF/FLV demuxers\n *   and the legacy decoders (WMV3, MPEG-4 Part 2, VC-1, MS-MPEG4 v1/2/3,\n *   AC-3, WMA*). Required for any of those formats; the npm variants ship\n *   none of them.\n *\n * Rule: pick \"avbridge\" if either the container or any codec is one only the\n * custom build can handle. Otherwise pick \"webcodecs\".\n */\n\nconst LEGACY_CONTAINERS = new Set([\"avi\", \"asf\", \"flv\"]);\n\n/** Codecs the webcodecs variant can handle (native browser codecs only).\n * Anything not in these sets needs the custom avbridge variant. */\nconst WEBCODECS_AUDIO = new Set<AudioCodec>([\"aac\", \"mp3\", \"opus\", \"vorbis\", \"flac\"]);\nconst WEBCODECS_VIDEO = new Set<VideoCodec>([\"h264\", \"h265\", \"vp8\", \"vp9\", \"av1\"]);\n\nexport function pickLibavVariant(ctx: MediaContext): LibavVariant {\n  if (LEGACY_CONTAINERS.has(ctx.container)) return \"avbridge\";\n  for (const v of ctx.videoTracks) {\n    // Any codec the webcodecs variant can't handle → need avbridge\n    if (!WEBCODECS_VIDEO.has(v.codec)) return \"avbridge\";\n  }\n  for (const a of ctx.audioTracks) {\n    if (!WEBCODECS_AUDIO.has(a.codec)) return \"avbridge\";\n  }\n  return \"webcodecs\";\n}\n"]}