@nodaro/shared 3.41.0 → 3.43.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. package/dist/{chunk-N2KG5AMQ.cjs → chunk-3J6JYP4X.cjs} +4 -4
  2. package/dist/{chunk-N2KG5AMQ.cjs.map → chunk-3J6JYP4X.cjs.map} +1 -1
  3. package/dist/{chunk-YEZ2YUKK.js → chunk-3UAQVTIO.js} +3 -3
  4. package/dist/{chunk-YEZ2YUKK.js.map → chunk-3UAQVTIO.js.map} +1 -1
  5. package/dist/{chunk-ZXIP5T5V.js → chunk-4GYMWGUG.js} +3 -3
  6. package/dist/{chunk-ZXIP5T5V.js.map → chunk-4GYMWGUG.js.map} +1 -1
  7. package/dist/{chunk-DC5EYYVX.cjs → chunk-4URFSG3O.cjs} +38 -39
  8. package/dist/chunk-4URFSG3O.cjs.map +1 -0
  9. package/dist/{chunk-4LKEOIOT.cjs → chunk-4VDQFY27.cjs} +6 -6
  10. package/dist/{chunk-4LKEOIOT.cjs.map → chunk-4VDQFY27.cjs.map} +1 -1
  11. package/dist/{chunk-TUUEQ2WR.cjs → chunk-52IHBMTM.cjs} +8 -8
  12. package/dist/{chunk-TUUEQ2WR.cjs.map → chunk-52IHBMTM.cjs.map} +1 -1
  13. package/dist/{chunk-LOTL72UI.js → chunk-5C6WODPL.js} +4 -5
  14. package/dist/chunk-5C6WODPL.js.map +1 -0
  15. package/dist/{chunk-4IWVZR44.cjs → chunk-7TQRTEWG.cjs} +5 -5
  16. package/dist/{chunk-4IWVZR44.cjs.map → chunk-7TQRTEWG.cjs.map} +1 -1
  17. package/dist/{chunk-PYDZ7ZGH.js → chunk-BJGJXYGO.js} +3 -3
  18. package/dist/{chunk-PYDZ7ZGH.js.map → chunk-BJGJXYGO.js.map} +1 -1
  19. package/dist/{chunk-BOUEGYGI.cjs → chunk-CDEWNDBO.cjs} +33 -37
  20. package/dist/chunk-CDEWNDBO.cjs.map +1 -0
  21. package/dist/{chunk-IKCFSNNH.cjs → chunk-CLYX5WIS.cjs} +21 -21
  22. package/dist/{chunk-IKCFSNNH.cjs.map → chunk-CLYX5WIS.cjs.map} +1 -1
  23. package/dist/{chunk-ZAOBNW6Y.cjs → chunk-DFBWBEXO.cjs} +12 -20
  24. package/dist/chunk-DFBWBEXO.cjs.map +1 -0
  25. package/dist/{chunk-RLVZ3RLE.cjs → chunk-DUWBODKW.cjs} +8 -8
  26. package/dist/{chunk-RLVZ3RLE.cjs.map → chunk-DUWBODKW.cjs.map} +1 -1
  27. package/dist/{chunk-VNC5DNIQ.cjs → chunk-ESBO2KR7.cjs} +11 -13
  28. package/dist/chunk-ESBO2KR7.cjs.map +1 -0
  29. package/dist/chunk-GAPZHS2X.cjs +27 -0
  30. package/dist/{chunk-XOZIHGR5.cjs.map → chunk-GAPZHS2X.cjs.map} +1 -1
  31. package/dist/{chunk-E4MLBJKG.js → chunk-GBUHNZZU.js} +8 -8
  32. package/dist/{chunk-E4MLBJKG.js.map → chunk-GBUHNZZU.js.map} +1 -1
  33. package/dist/{chunk-5J5L26IZ.js → chunk-IAH67SHO.js} +5 -7
  34. package/dist/chunk-IAH67SHO.js.map +1 -0
  35. package/dist/{chunk-YEET2QGF.cjs → chunk-IHPDWGBN.cjs} +4 -4
  36. package/dist/{chunk-YEET2QGF.cjs.map → chunk-IHPDWGBN.cjs.map} +1 -1
  37. package/dist/{chunk-VSDJCJKP.cjs → chunk-J32WVEJH.cjs} +46 -45
  38. package/dist/chunk-J32WVEJH.cjs.map +1 -0
  39. package/dist/{chunk-MLB6YNLS.js → chunk-KUWE6E2E.js} +4 -4
  40. package/dist/{chunk-MLB6YNLS.js.map → chunk-KUWE6E2E.js.map} +1 -1
  41. package/dist/{chunk-LOWOJN65.js → chunk-KZGGUDAB.js} +45 -7
  42. package/dist/chunk-KZGGUDAB.js.map +1 -0
  43. package/dist/{chunk-CWQC6IGE.js → chunk-L6G6G5BB.js} +4 -5
  44. package/dist/chunk-L6G6G5BB.js.map +1 -0
  45. package/dist/{chunk-5CKTBGB6.js → chunk-LRJAGGKY.js} +5 -24
  46. package/dist/chunk-LRJAGGKY.js.map +1 -0
  47. package/dist/{chunk-DJIRIBKX.cjs → chunk-LZBJJ6TC.cjs} +5 -6
  48. package/dist/chunk-LZBJJ6TC.cjs.map +1 -0
  49. package/dist/{chunk-GNY2S63W.js → chunk-N5NT3WZD.js} +4 -4
  50. package/dist/{chunk-GNY2S63W.js.map → chunk-N5NT3WZD.js.map} +1 -1
  51. package/dist/{chunk-BWQRAQUD.cjs → chunk-NSTIHL5G.cjs} +43 -43
  52. package/dist/{chunk-BWQRAQUD.cjs.map → chunk-NSTIHL5G.cjs.map} +1 -1
  53. package/dist/{chunk-X7IRSO4L.js → chunk-O2VQLVKB.js} +3 -3
  54. package/dist/{chunk-X7IRSO4L.js.map → chunk-O2VQLVKB.js.map} +1 -1
  55. package/dist/{chunk-SYUY7GNT.js → chunk-OAAQG66Y.js} +7 -6
  56. package/dist/chunk-OAAQG66Y.js.map +1 -0
  57. package/dist/{chunk-YX5FW7ON.js → chunk-PLU7RIDO.js} +4 -12
  58. package/dist/chunk-PLU7RIDO.js.map +1 -0
  59. package/dist/{chunk-A4NDZBSJ.js → chunk-PVAOXI2W.js} +14 -20
  60. package/dist/chunk-PVAOXI2W.js.map +1 -0
  61. package/dist/{chunk-GXTWKAJF.js → chunk-PZE6WTA3.js} +3 -3
  62. package/dist/{chunk-GXTWKAJF.js.map → chunk-PZE6WTA3.js.map} +1 -1
  63. package/dist/{chunk-TGZJXCLL.cjs → chunk-QHODM5TS.cjs} +46 -6
  64. package/dist/chunk-QHODM5TS.cjs.map +1 -0
  65. package/dist/{chunk-JN3V33AN.cjs → chunk-QJ2VGB5J.cjs} +6 -6
  66. package/dist/{chunk-JN3V33AN.cjs.map → chunk-QJ2VGB5J.cjs.map} +1 -1
  67. package/dist/{chunk-ADYPAGQF.cjs → chunk-RPQ2KF6L.cjs} +5 -24
  68. package/dist/chunk-RPQ2KF6L.cjs.map +1 -0
  69. package/dist/{chunk-2BJADMEX.js → chunk-S4UAYQQV.js} +3 -3
  70. package/dist/{chunk-2BJADMEX.js.map → chunk-S4UAYQQV.js.map} +1 -1
  71. package/dist/{chunk-FVZMFDRO.js → chunk-TTD6MZAM.js} +4 -4
  72. package/dist/{chunk-FVZMFDRO.js.map → chunk-TTD6MZAM.js.map} +1 -1
  73. package/dist/entries/apps.cjs +42 -42
  74. package/dist/entries/apps.js +7 -7
  75. package/dist/entries/credits.cjs +150 -150
  76. package/dist/entries/credits.d.cts +1 -1
  77. package/dist/entries/credits.d.ts +1 -1
  78. package/dist/entries/credits.js +7 -7
  79. package/dist/entries/llm-models.d.cts +1 -1
  80. package/dist/entries/llm-models.d.ts +1 -1
  81. package/dist/entries/media.cjs +56 -48
  82. package/dist/entries/media.d.cts +65 -3
  83. package/dist/entries/media.d.ts +65 -3
  84. package/dist/entries/media.js +1 -1
  85. package/dist/entries/model-catalog.cjs +66 -66
  86. package/dist/entries/model-catalog.js +4 -4
  87. package/dist/entries/models.cjs +252 -244
  88. package/dist/entries/models.d.cts +2 -7
  89. package/dist/entries/models.d.ts +2 -7
  90. package/dist/entries/models.js +4 -4
  91. package/dist/entries/nodes.cjs +206 -206
  92. package/dist/entries/nodes.js +8 -8
  93. package/dist/entries/pipeline.cjs +149 -149
  94. package/dist/entries/pipeline.d.cts +10 -14
  95. package/dist/entries/pipeline.d.ts +10 -14
  96. package/dist/entries/pipeline.js +3 -3
  97. package/dist/entries/ugc.cjs +71 -71
  98. package/dist/entries/ugc.js +4 -4
  99. package/dist/entries/video.cjs +117 -117
  100. package/dist/entries/video.js +4 -4
  101. package/dist/index.cjs +1085 -1069
  102. package/dist/index.d.cts +2 -2
  103. package/dist/index.d.ts +2 -2
  104. package/dist/index.js +18 -18
  105. package/dist/{model-constants-B5ka4TQr.d.cts → model-constants-BL-Ae0OU.d.cts} +24 -7
  106. package/dist/{model-constants-B5ka4TQr.d.ts → model-constants-BL-Ae0OU.d.ts} +24 -7
  107. package/package.json +1 -1
  108. package/src/__tests__/credit-identifiers.test.ts +13 -32
  109. package/src/__tests__/pricing-default-duration.test.ts +0 -2
  110. package/src/__tests__/retired-video-provider.test.ts +42 -0
  111. package/src/__tests__/video-audio-capability.test.ts +4 -13
  112. package/src/__tests__/video-mask.test.ts +31 -0
  113. package/src/__tests__/video-mode-aliases.test.ts +10 -1
  114. package/src/credit-identifiers.ts +4 -1
  115. package/src/entries/models.ts +2 -0
  116. package/src/film-pricing.ts +0 -1
  117. package/src/model-catalog.ts +3 -22
  118. package/src/model-constants.ts +29 -15
  119. package/src/pipeline-types.ts +4 -2
  120. package/src/provider-directive-defaults.ts +0 -1
  121. package/src/video-mask.ts +69 -2
  122. package/src/video-output-canvas.ts +0 -8
  123. package/dist/chunk-5CKTBGB6.js.map +0 -1
  124. package/dist/chunk-5J5L26IZ.js.map +0 -1
  125. package/dist/chunk-A4NDZBSJ.js.map +0 -1
  126. package/dist/chunk-ADYPAGQF.cjs.map +0 -1
  127. package/dist/chunk-BOUEGYGI.cjs.map +0 -1
  128. package/dist/chunk-CWQC6IGE.js.map +0 -1
  129. package/dist/chunk-DC5EYYVX.cjs.map +0 -1
  130. package/dist/chunk-DJIRIBKX.cjs.map +0 -1
  131. package/dist/chunk-LOTL72UI.js.map +0 -1
  132. package/dist/chunk-LOWOJN65.js.map +0 -1
  133. package/dist/chunk-SYUY7GNT.js.map +0 -1
  134. package/dist/chunk-TGZJXCLL.cjs.map +0 -1
  135. package/dist/chunk-VNC5DNIQ.cjs.map +0 -1
  136. package/dist/chunk-VSDJCJKP.cjs.map +0 -1
  137. package/dist/chunk-XOZIHGR5.cjs +0 -27
  138. package/dist/chunk-YX5FW7ON.js.map +0 -1
  139. package/dist/chunk-ZAOBNW6Y.cjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/ugc-call-body.ts","../src/ugc-lane-wires.ts"],"names":["pick"],"mappings":";;;AAkBA,IAA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AE,QAAQ,QAAA,IAAY,MAAA,CAAO,QAAA,CAAS,CAAA,CAAE,GAAG,CAAA,IAAK,CAAA,CAAE,MAAM,CAAA,GAAI,CAAA,CAAE,MAAM,IAAA;AAAK,KACjH,CAAE;AAAA,GACJ;AACF;AAMO,SAAS,cAAA,CACd,KAAA,EACA,KAAA,EACA,OAAA,EACS;AACT,EAAA,MAAM,SAAA,GAAY,IAAI,GAAA,CAAI,KAAA,CAAM,OAAO,CAAC,CAAA,KAAM,EAAE,IAAA,KAAS,qBAAA,IAAyB,OAAO,CAAA,CAAE,EAAA,KAAO,QAAQ,CAAA,CAAE,GAAA,CAAI,CAAC,CAAA,KAAM,CAAA,CAAE,EAAY,CAAC,CAAA;AACtI,EAAA,OAAO,KAAA,CAAM,KAAK,CAAC,CAAA,KAAM,EAAE,MAAA,KAAW,OAAA,IAAW,EAAE,YAAA,KAAiB,UAAA,IAAc,EAAE,MAAA,KAAW,MAAA,IAAa,UAAU,GAAA,CAAI,CAAA,CAAE,MAAM,CAAA,IAAA,CAAM,CAAA,CAAE,YAAA,IAAgB,EAAA,MAAQ,MAAM,CAAA;AAC1K;AAGO,SAAS,kBAAA,CACd,KAAA,EACA,KAAA,EACA,OAAA,EACe;AACf,EAAA,OAAO,cAAA,CAAe,KAAA,EAAO,KAAA,EAAO,OAAO,IAAI,IAAA,GAAO,wBAAA;AACxD","file":"chunk-GXTWKAJF.js","sourcesContent":["/**\n * A UGC builder call `{ tool, args }` (MCP argument names) → the REST body of\n * the public route that tool dispatches to. The builder sets every price lever;\n * this adds none — its one addition is the image of a call that needs the\n * previous step's image (`imageArg`, or the photo of `image_to_text`). A tool\n * it does not know → undefined, so an app older than the builder fails plainly\n * instead of guessing. Kept equal to the MCP verbs by ugc-call-body-parity.test.ts.\n */\nexport interface UgcToolCall {\n readonly tool: string\n readonly args: Readonly<Record<string, unknown>>\n readonly imageArg?: string\n}\nexport type UgcRouteBody = {\n readonly path: \"/v1/generate-image\" | \"/v1/image-to-image\" | \"/v1/image-to-text/describe\"\n readonly body: Record<string, unknown>\n}\n\nconst pick = (a: Readonly<Record<string, unknown>>, from: string, to: string): Record<string, unknown> =>\n a[from] !== undefined && a[from] !== null ? { [to]: a[from] } : {}\n\n/** The LLM levers image_to_text forwards (the verb's llmPayloadFields). */\nfunction llmFields(a: Readonly<Record<string, unknown>>): Record<string, unknown> {\n return {\n ...pick(a, \"llmModel\", \"llmModel\"),\n ...pick(a, \"reasoning_effort\", \"reasoningEffort\"),\n ...(a.advanced_mode === true ? { advancedMode: true } : {}),\n ...pick(a, \"temperature\", \"temperature\"),\n ...pick(a, \"max_tokens\", \"maxTokens\"),\n }\n}\n\nexport function ugcCallToRouteBody(\n call: UgcToolCall,\n opts: { readonly image?: string } = {},\n): UgcRouteBody | { readonly error: string } | undefined {\n const args: Record<string, unknown> = { ...call.args }\n if (call.imageArg) {\n if (!opts.image) return { error: `${call.tool} needs the previous step's image` }\n args[call.imageArg] = opts.image\n }\n switch (call.tool) {\n case \"generate_image\":\n return {\n path: \"/v1/generate-image\",\n body: {\n ...pick(args, \"prompt\", \"prompt\"),\n ...pick(args, \"model\", \"provider\"),\n ...pick(args, \"aspect_ratio\", \"aspectRatio\"),\n ...pick(args, \"resolution\", \"resolution\"),\n ...pick(args, \"quality\", \"quality\"),\n ...pick(args, \"negative_prompt\", \"negativePrompt\"),\n },\n }\n case \"image_to_image\":\n return {\n path: \"/v1/image-to-image\",\n body: {\n ...pick(args, \"image_url\", \"imageUrl\"),\n ...pick(args, \"prompt\", \"prompt\"),\n ...pick(args, \"model\", \"provider\"),\n ...pick(args, \"resolution\", \"resolution\"),\n ...pick(args, \"quality\", \"quality\"),\n ...pick(args, \"strength\", \"strength\"),\n ...pick(args, \"aspect_ratio\", \"aspectRatio\"),\n ...pick(args, \"negative_prompt\", \"negativePrompt\"),\n ...pick(args, \"seed\", \"seed\"),\n },\n }\n case \"image_to_text\": {\n const image = opts.image ?? (typeof args.image_url === \"string\" ? args.image_url : undefined)\n if (!image) return { error: \"image_to_text needs an image\" }\n return {\n path: \"/v1/image-to-text/describe\",\n body: {\n imageUrl: image,\n ...pick(args, \"detail_level\", \"detailLevel\"),\n ...pick(args, \"custom_prompt\", \"customPrompt\"),\n ...llmFields(args),\n },\n }\n }\n default:\n return undefined\n }\n}\n","/**\n * The UGC wires of a language whose clips are cut from one recorded speech (the\n * segmented lane): UGC Clips' prelude (record the speech, time its words, split\n * it at its pauses, then ask for the clips again with the segments) and UGC\n * Finish (lay the speech back over the rendered clips and trim the dead air,\n * as one job over all of them). One pure implementation both engines call, as\n * the rest of the UGC wires (`ugc-node-wires.ts`).\n *\n * Content-free: an answer is read only for `phase`, its three calls' `tool`\n * and `args` (argument names, never their meaning), the `finish` call's\n * `args`, and a finished job's clip list. Which language takes this lane, which\n * voice speaks and what the calls say are the builder's.\n */\nimport {\n UGC_FINISH_NEEDS_CLIPS_MESSAGE,\n UGC_FINISH_NOT_READY_MESSAGE,\n UGC_NEEDS_FINISH_MESSAGE,\n UGC_NEWER_APP_MESSAGE,\n UGC_NODE_MESSAGES,\n UGC_OVER_HOLD_MESSAGE,\n UGC_SCRIPT_LANGUAGES,\n readUgcWire,\n ugcPlanLengthSec,\n ugcPlanScreenshotCount,\n} from \"./ugc-node-wires.js\"\nimport type { FanOutItemMeta } from \"./fan-out-meta.js\"\n\ntype Obj = Record<string, unknown>\nconst isObject = (x: unknown): x is Obj => !!x && typeof x === \"object\" && !Array.isArray(x)\n\n/** UGC Finish's node type. Not the plugin job it runs (`ugc-finish`): a price, a dispatch or a reconcile keyed on a type never confuses the two. */\nexport const UGC_FINISH_CLIPS_TYPE = \"ugc-finish-clips\"\n\n/** The child steps of UGC Clips' prelude, in run order: each is a job of its own, keyed by its step. */\nexport const UGC_PRELUDE_STEPS = [\"speech\", \"alignment\", \"split\"] as const\nexport type UgcPreludeStep = (typeof UGC_PRELUDE_STEPS)[number]\n\n/** The public route each prelude step runs on, and the node type its job is read as. */\nexport const UGC_PRELUDE_ROUTES: Readonly<Record<UgcPreludeStep, { readonly path: string; readonly jobType: string }>> = {\n speech: { path: \"/v1/text-to-speech\", jobType: \"text-to-speech\" },\n alignment: { path: \"/v1/forced-alignment\", jobType: \"forced-alignment\" },\n split: { path: \"/v1/ugc/segments\", jobType: \"ugc-segments\" },\n}\n\n/** The `/v1/ugc/clips` answer's phase: 1 = the prelude must run first, 2 = the clips; null = an answer with no phase (one call, as English). */\nexport function ugcClipsPhase(answer: Readonly<Obj>): 1 | 2 | null {\n return answer.phase === 1 ? 1 : answer.phase === 2 ? 2 : null\n}\n\nconst callOf = (raw: unknown, tool: string): Obj | undefined => {\n if (!isObject(raw) || raw.tool !== tool || !isObject(raw.args)) return undefined\n return raw.args\n}\nconst pick = (a: Readonly<Obj>, from: string, to: string): Obj => (a[from] !== undefined && a[from] !== null ? { [to]: a[from] } : {})\n\n/** What the prelude runs: the speech's route body, and the two that need the step before them. */\nexport interface UgcPrelude {\n readonly speech: Obj\n readonly alignment: (audioUrl: string) => Obj\n readonly split: (audioUrl: string, alignment: unknown) => Obj\n}\n\n/**\n * A phase-1 answer's three calls (`speech`, `align`, `split`, MCP argument names) → the REST bodies of\n * the public routes their MCP tools dispatch to: `generate_speech` → `/v1/text-to-speech` (text, voice,\n * voice type, model as provider, language code, as the verb maps them), `forced_alignment` →\n * `/v1/forced-alignment` (the transcript, with the speech's audio), `ugc_split_speech` →\n * `/v1/ugc/segments` (the plan, with the speech's audio and its word timings). A call that is missing\n * or names another tool → the newer-app sentence: the app never guesses.\n */\nexport function ugcPrelude(answer: Readonly<Obj>): UgcPrelude | { readonly error: string } {\n const speech = callOf(answer.speech, \"generate_speech\")\n const align = callOf(answer.align, \"forced_alignment\")\n const split = callOf(answer.split, \"ugc_split_speech\")\n if (!speech || !align || !split || typeof speech.text !== \"string\" || !isObject(split.plan)) return { error: UGC_NEWER_APP_MESSAGE }\n return {\n speech: {\n text: speech.text,\n ...pick(speech, \"voice_id\", \"voice\"),\n ...pick(speech, \"voice_type\", \"voiceType\"),\n ...pick(speech, \"model\", \"provider\"),\n ...pick(speech, \"language_code\", \"languageCode\"),\n },\n alignment: (audioUrl) => ({ ...pick(align, \"transcript\", \"transcript\"), audioUrl }),\n split: (audioUrl, alignment) => ({ plan: split.plan, audioUrl, alignment }),\n }\n}\n\n/** The finished speech job's audio, its word timings and its segments, as their jobs write them. */\nexport function ugcPreludeOutput(step: UgcPreludeStep, output: Readonly<Obj> | undefined): { value: unknown } | { error: string } {\n const value = step === \"speech\" ? output?.audioUrl : step === \"alignment\" ? output?.alignment : output?.segments\n const ok = step === \"speech\" ? typeof value === \"string\" && value !== \"\" : Array.isArray(value) && value.length > 0\n return ok ? { value } : { error: UGC_NEWER_APP_MESSAGE }\n}\n\n/** The second `/v1/ugc/clips` call: the first call's body with the segments the split returned. */\nexport function ugcClipsPhase2Body(body: Readonly<Obj>, segments: readonly unknown[]): Obj {\n return { ...body, segments: [...segments] }\n}\n\n// ── The hold check once the speech is split ──────────────────────────────────\n\n/** The estimate input of a video cut from one recorded speech, as the hold check names it (`runEstimate`). */\nexport interface UgcRunEstimateInput {\n readonly targetDurationSec: number\n readonly screenshotCount: number\n readonly source: \"sampled\"\n readonly language: string\n}\n\n/**\n * The estimate input of the video a UGC Clips run belongs to, read from the plan the node was sent: its\n * length, its screenshot cards and its language — the reading a kept plan is priced with. Read on a\n * phase-1 answer, before the prelude spends anything, so a plan the check cannot read refuses the run\n * while nothing is paid. The creator's source prices no clip, so it is not read. A plan without a length,\n * or without a language this lane takes → the newer-app sentence: the check never guesses.\n */\nexport function ugcRunEstimateInput(plan: unknown): { runEstimate: UgcRunEstimateInput } | { error: string } {\n const targetDurationSec = ugcPlanLengthSec(plan)\n const language = planOf(plan)?.language\n if (targetDurationSec === undefined || typeof language !== \"string\" || language === \"en\" || !(UGC_SCRIPT_LANGUAGES as readonly unknown[]).includes(language)) {\n return { error: UGC_NEWER_APP_MESSAGE }\n }\n return { runEstimate: { targetDurationSec, screenshotCount: ugcPlanScreenshotCount(plan) ?? 0, source: \"sampled\", language } }\n}\n\n/**\n * The quote that checks a video cut from one recorded speech before any of its clips renders: the clips\n * the second `/v1/ugc/clips` call handed on, priced as the UGC Clips quote prices them (`tickets`,\n * `hasCards`, `finishes`), with `runEstimate` (`ugcRunEstimateInput`). The route then also answers\n * `runHold`, the most the video's estimate holds for the clips and the steps after them, which the run's\n * balance was checked against before it started (`ugcRenderHoldVerdict`). No clips → the newer-app sentence.\n */\nexport function ugcRenderHoldBody(input: { runEstimate: UgcRunEstimateInput; tickets: unknown; hasCards: boolean; finishes: boolean }): { path: \"/v1/ugc/quote\"; body: Obj } | { error: string } {\n if (!Array.isArray(input.tickets) || input.tickets.length === 0) return { error: UGC_NEWER_APP_MESSAGE }\n return {\n path: \"/v1/ugc/quote\",\n body: {\n tickets: [...input.tickets],\n hasCards: input.hasCards,\n ...(input.finishes ? { finishes: true } : {}),\n runEstimate: { ...input.runEstimate },\n },\n }\n}\n\n/** A plan, or its wire (a JSON string), as an object; undefined for anything else. */\nfunction planOf(plan: unknown): Obj | undefined {\n if (typeof plan !== \"string\") return isObject(plan) ? plan : undefined\n try {\n const parsed: unknown = JSON.parse(plan)\n return isObject(parsed) ? parsed : undefined\n } catch {\n return undefined\n }\n}\n\nconst isCredits = (x: unknown): x is number => typeof x === \"number\" && Number.isFinite(x) && x >= 0\n\n/**\n * The hold check's answer → go on, or stop before any clip renders: the clips and the steps after them\n * (`ceiling`, each clip at its hold) over what the run was checked for (`runHold`) → the over-hold\n * sentence. An answer without both figures stops too (the newer-app sentence): a clip never renders\n * on a figure nobody checked.\n */\nexport function ugcRenderHoldVerdict(answer: unknown): { readonly ok: true } | { readonly error: string } {\n if (!isObject(answer) || !isCredits(answer.ceiling) || !isCredits(answer.runHold)) return { error: UGC_NEWER_APP_MESSAGE }\n return answer.ceiling > answer.runHold ? { error: UGC_OVER_HOLD_MESSAGE } : { ok: true }\n}\n\n// ── UGC Finish ───────────────────────────────────────────────────────────────\n\n/** What UGC Finish does with the clips it was handed. */\nexport type UgcFinishPlan =\n /** No finish call on the plan (English): the clips go on as they came, no call, no job. */\n | { readonly kind: \"pass\"; readonly clips: readonly string[] }\n /** The finish job's body: the segments with their room, one roll per clip, in order. */\n | { readonly kind: \"job\"; readonly path: \"/v1/ugc/finish\"; readonly body: Obj }\n\n/**\n * UGC Finish's input → what it does. The `plan` input is UGC Clips' Script (sized) output; a plan\n * carrying `finish` (the segmented lane) asks for the finish job over the clips, in order; any other\n * plan passes the clips through. Clips are the fan-in list (`inputs.inputs`), in clip order.\n */\nexport function ugcFinishPlan(input: { planOutWire: unknown; clipUrls: readonly unknown[] }): UgcFinishPlan | { readonly error: string } {\n const clips = input.clipUrls.filter((u): u is string => typeof u === \"string\" && u !== \"\")\n if (clips.length === 0) return { error: UGC_FINISH_NEEDS_CLIPS_MESSAGE }\n const read = readUgcWire(input.planOutWire, UGC_NODE_MESSAGES.needsPlanOut)\n if (\"error\" in read) return read\n const finish = read.value.finish\n if (finish === undefined) return { kind: \"pass\", clips }\n if (!isObject(finish) || !Array.isArray(finish.segments) || finish.segments.length === 0) return { error: UGC_NEWER_APP_MESSAGE }\n if (finish.segments.length !== clips.length) return { error: UGC_NEWER_APP_MESSAGE }\n return {\n kind: \"job\",\n path: \"/v1/ugc/finish\",\n body: { segments: finish.segments, clips: clips.map((url, i) => ({ clip: i + 1, rolls: [url] })) },\n }\n}\n\n/** A finished clip, as UGC Finish hands it on: its URL and the notes its downstream nodes read. */\nexport interface UgcFinishedClip { readonly url: string; readonly meta: FanOutItemMeta }\n\n/**\n * A finished `ugc-finish` job → the finished clips in clip order, each with its real length. `ready: false`\n * (a clip that does not follow its speech) → the not-ready sentence: the node fails, never hands on a\n * partial list. A dry finish's warning rides every clip's notes.\n */\nexport function ugcFinishOutputs(output: Readonly<Obj> | undefined): { clips: UgcFinishedClip[] } | { error: string } {\n if (!output) return { error: UGC_NEWER_APP_MESSAGE }\n if (output.ready === false) return { error: UGC_FINISH_NOT_READY_MESSAGE }\n if (output.ready !== true || !Array.isArray(output.clips) || output.clips.length === 0) return { error: UGC_NEWER_APP_MESSAGE }\n const warnings = Array.isArray(output.warnings)\n ? output.warnings.flatMap((w) => (isObject(w) && typeof w.code === \"string\" ? [w.code] : typeof w === \"string\" ? [w] : []))\n : []\n const rows = [...output.clips].filter(isObject).sort((a, b) => Number(a.clip) - Number(b.clip))\n if (rows.length !== output.clips.length || rows.some((r, i) => r.clip !== i + 1 || typeof r.url !== \"string\" || r.url === \"\")) return { error: UGC_NEWER_APP_MESSAGE }\n return {\n clips: rows.map((r) => ({\n url: r.url as string,\n meta: { warnings, durationSec: typeof r.sec === \"number\" && Number.isFinite(r.sec) && r.sec > 0 ? r.sec : null },\n })),\n }\n}\n\n/**\n * Whether a UGC Finish reads this UGC Clips node's Script (sized) output: the graph can finish a video\n * whose clips are cut from one recorded speech. Read before the prelude spends anything.\n */\nexport function ugcFinishWired(\n edges: ReadonlyArray<{ readonly source?: string; readonly target?: string; readonly sourceHandle?: string | null; readonly targetHandle?: string | null }>,\n nodes: ReadonlyArray<{ readonly id?: string; readonly type?: string | null }>,\n clipsId: string,\n): boolean {\n const finishIds = new Set(nodes.filter((n) => n.type === UGC_FINISH_CLIPS_TYPE && typeof n.id === \"string\").map((n) => n.id as string))\n return edges.some((e) => e.source === clipsId && e.sourceHandle === \"plan-out\" && e.target !== undefined && finishIds.has(e.target) && (e.targetHandle ?? \"\") === \"plan\")\n}\n\n/** UGC Clips' refusal before its prelude: the sentence when no UGC Finish reads its Script (sized) output, else null. */\nexport function ugcLaneNeedsFinish(\n edges: Parameters<typeof ugcFinishWired>[0],\n nodes: Parameters<typeof ugcFinishWired>[1],\n clipsId: string,\n): string | null {\n return ugcFinishWired(edges, nodes, clipsId) ? null : UGC_NEEDS_FINISH_MESSAGE\n}\n"]}
1
+ {"version":3,"sources":["../src/ugc-call-body.ts","../src/ugc-lane-wires.ts"],"names":["pick"],"mappings":";;;AAkBA,IAAM,IAAA,GAAO,CAAC,CAAA,EAAsC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O,QAAA,CAAS,CAAA,CAAE,GAAG,CAAA,IAAK,CAAA,CAAE,MAAM,CAAA,GAAI,CAAA,CAAE,MAAM,IAAA;AAAK,KACjH,CAAE;AAAA,GACJ;AACF;AAMO,SAAS,cAAA,CACd,KAAA,EACA,KAAA,EACA,OAAA,EACS;AACT,EAAA,MAAM,SAAA,GAAY,IAAI,GAAA,CAAI,KAAA,CAAM,OAAO,CAAC,CAAA,KAAM,EAAE,IAAA,KAAS,qBAAA,IAAyB,OAAO,CAAA,CAAE,EAAA,KAAO,QAAQ,CAAA,CAAE,GAAA,CAAI,CAAC,CAAA,KAAM,CAAA,CAAE,EAAY,CAAC,CAAA;AACtI,EAAA,OAAO,KAAA,CAAM,KAAK,CAAC,CAAA,KAAM,EAAE,MAAA,KAAW,OAAA,IAAW,EAAE,YAAA,KAAiB,UAAA,IAAc,EAAE,MAAA,KAAW,MAAA,IAAa,UAAU,GAAA,CAAI,CAAA,CAAE,MAAM,CAAA,IAAA,CAAM,CAAA,CAAE,YAAA,IAAgB,EAAA,MAAQ,MAAM,CAAA;AAC1K;AAGO,SAAS,kBAAA,CACd,KAAA,EACA,KAAA,EACA,OAAA,EACe;AACf,EAAA,OAAO,cAAA,CAAe,KAAA,EAAO,KAAA,EAAO,OAAO,IAAI,IAAA,GAAO,wBAAA;AACxD","file":"chunk-PZE6WTA3.js","sourcesContent":["/**\n * A UGC builder call `{ tool, args }` (MCP argument names) → the REST body of\n * the public route that tool dispatches to. The builder sets every price lever;\n * this adds none — its one addition is the image of a call that needs the\n * previous step's image (`imageArg`, or the photo of `image_to_text`). A tool\n * it does not know → undefined, so an app older than the builder fails plainly\n * instead of guessing. Kept equal to the MCP verbs by ugc-call-body-parity.test.ts.\n */\nexport interface UgcToolCall {\n readonly tool: string\n readonly args: Readonly<Record<string, unknown>>\n readonly imageArg?: string\n}\nexport type UgcRouteBody = {\n readonly path: \"/v1/generate-image\" | \"/v1/image-to-image\" | \"/v1/image-to-text/describe\"\n readonly body: Record<string, unknown>\n}\n\nconst pick = (a: Readonly<Record<string, unknown>>, from: string, to: string): Record<string, unknown> =>\n a[from] !== undefined && a[from] !== null ? { [to]: a[from] } : {}\n\n/** The LLM levers image_to_text forwards (the verb's llmPayloadFields). */\nfunction llmFields(a: Readonly<Record<string, unknown>>): Record<string, unknown> {\n return {\n ...pick(a, \"llmModel\", \"llmModel\"),\n ...pick(a, \"reasoning_effort\", \"reasoningEffort\"),\n ...(a.advanced_mode === true ? { advancedMode: true } : {}),\n ...pick(a, \"temperature\", \"temperature\"),\n ...pick(a, \"max_tokens\", \"maxTokens\"),\n }\n}\n\nexport function ugcCallToRouteBody(\n call: UgcToolCall,\n opts: { readonly image?: string } = {},\n): UgcRouteBody | { readonly error: string } | undefined {\n const args: Record<string, unknown> = { ...call.args }\n if (call.imageArg) {\n if (!opts.image) return { error: `${call.tool} needs the previous step's image` }\n args[call.imageArg] = opts.image\n }\n switch (call.tool) {\n case \"generate_image\":\n return {\n path: \"/v1/generate-image\",\n body: {\n ...pick(args, \"prompt\", \"prompt\"),\n ...pick(args, \"model\", \"provider\"),\n ...pick(args, \"aspect_ratio\", \"aspectRatio\"),\n ...pick(args, \"resolution\", \"resolution\"),\n ...pick(args, \"quality\", \"quality\"),\n ...pick(args, \"negative_prompt\", \"negativePrompt\"),\n },\n }\n case \"image_to_image\":\n return {\n path: \"/v1/image-to-image\",\n body: {\n ...pick(args, \"image_url\", \"imageUrl\"),\n ...pick(args, \"prompt\", \"prompt\"),\n ...pick(args, \"model\", \"provider\"),\n ...pick(args, \"resolution\", \"resolution\"),\n ...pick(args, \"quality\", \"quality\"),\n ...pick(args, \"strength\", \"strength\"),\n ...pick(args, \"aspect_ratio\", \"aspectRatio\"),\n ...pick(args, \"negative_prompt\", \"negativePrompt\"),\n ...pick(args, \"seed\", \"seed\"),\n },\n }\n case \"image_to_text\": {\n const image = opts.image ?? (typeof args.image_url === \"string\" ? args.image_url : undefined)\n if (!image) return { error: \"image_to_text needs an image\" }\n return {\n path: \"/v1/image-to-text/describe\",\n body: {\n imageUrl: image,\n ...pick(args, \"detail_level\", \"detailLevel\"),\n ...pick(args, \"custom_prompt\", \"customPrompt\"),\n ...llmFields(args),\n },\n }\n }\n default:\n return undefined\n }\n}\n","/**\n * The UGC wires of a language whose clips are cut from one recorded speech (the\n * segmented lane): UGC Clips' prelude (record the speech, time its words, split\n * it at its pauses, then ask for the clips again with the segments) and UGC\n * Finish (lay the speech back over the rendered clips and trim the dead air,\n * as one job over all of them). One pure implementation both engines call, as\n * the rest of the UGC wires (`ugc-node-wires.ts`).\n *\n * Content-free: an answer is read only for `phase`, its three calls' `tool`\n * and `args` (argument names, never their meaning), the `finish` call's\n * `args`, and a finished job's clip list. Which language takes this lane, which\n * voice speaks and what the calls say are the builder's.\n */\nimport {\n UGC_FINISH_NEEDS_CLIPS_MESSAGE,\n UGC_FINISH_NOT_READY_MESSAGE,\n UGC_NEEDS_FINISH_MESSAGE,\n UGC_NEWER_APP_MESSAGE,\n UGC_NODE_MESSAGES,\n UGC_OVER_HOLD_MESSAGE,\n UGC_SCRIPT_LANGUAGES,\n readUgcWire,\n ugcPlanLengthSec,\n ugcPlanScreenshotCount,\n} from \"./ugc-node-wires.js\"\nimport type { FanOutItemMeta } from \"./fan-out-meta.js\"\n\ntype Obj = Record<string, unknown>\nconst isObject = (x: unknown): x is Obj => !!x && typeof x === \"object\" && !Array.isArray(x)\n\n/** UGC Finish's node type. Not the plugin job it runs (`ugc-finish`): a price, a dispatch or a reconcile keyed on a type never confuses the two. */\nexport const UGC_FINISH_CLIPS_TYPE = \"ugc-finish-clips\"\n\n/** The child steps of UGC Clips' prelude, in run order: each is a job of its own, keyed by its step. */\nexport const UGC_PRELUDE_STEPS = [\"speech\", \"alignment\", \"split\"] as const\nexport type UgcPreludeStep = (typeof UGC_PRELUDE_STEPS)[number]\n\n/** The public route each prelude step runs on, and the node type its job is read as. */\nexport const UGC_PRELUDE_ROUTES: Readonly<Record<UgcPreludeStep, { readonly path: string; readonly jobType: string }>> = {\n speech: { path: \"/v1/text-to-speech\", jobType: \"text-to-speech\" },\n alignment: { path: \"/v1/forced-alignment\", jobType: \"forced-alignment\" },\n split: { path: \"/v1/ugc/segments\", jobType: \"ugc-segments\" },\n}\n\n/** The `/v1/ugc/clips` answer's phase: 1 = the prelude must run first, 2 = the clips; null = an answer with no phase (one call, as English). */\nexport function ugcClipsPhase(answer: Readonly<Obj>): 1 | 2 | null {\n return answer.phase === 1 ? 1 : answer.phase === 2 ? 2 : null\n}\n\nconst callOf = (raw: unknown, tool: string): Obj | undefined => {\n if (!isObject(raw) || raw.tool !== tool || !isObject(raw.args)) return undefined\n return raw.args\n}\nconst pick = (a: Readonly<Obj>, from: string, to: string): Obj => (a[from] !== undefined && a[from] !== null ? { [to]: a[from] } : {})\n\n/** What the prelude runs: the speech's route body, and the two that need the step before them. */\nexport interface UgcPrelude {\n readonly speech: Obj\n readonly alignment: (audioUrl: string) => Obj\n readonly split: (audioUrl: string, alignment: unknown) => Obj\n}\n\n/**\n * A phase-1 answer's three calls (`speech`, `align`, `split`, MCP argument names) → the REST bodies of\n * the public routes their MCP tools dispatch to: `generate_speech` → `/v1/text-to-speech` (text, voice,\n * voice type, model as provider, language code, as the verb maps them), `forced_alignment` →\n * `/v1/forced-alignment` (the transcript, with the speech's audio), `ugc_split_speech` →\n * `/v1/ugc/segments` (the plan, with the speech's audio and its word timings). A call that is missing\n * or names another tool → the newer-app sentence: the app never guesses.\n */\nexport function ugcPrelude(answer: Readonly<Obj>): UgcPrelude | { readonly error: string } {\n const speech = callOf(answer.speech, \"generate_speech\")\n const align = callOf(answer.align, \"forced_alignment\")\n const split = callOf(answer.split, \"ugc_split_speech\")\n if (!speech || !align || !split || typeof speech.text !== \"string\" || !isObject(split.plan)) return { error: UGC_NEWER_APP_MESSAGE }\n return {\n speech: {\n text: speech.text,\n ...pick(speech, \"voice_id\", \"voice\"),\n ...pick(speech, \"voice_type\", \"voiceType\"),\n ...pick(speech, \"model\", \"provider\"),\n ...pick(speech, \"language_code\", \"languageCode\"),\n },\n alignment: (audioUrl) => ({ ...pick(align, \"transcript\", \"transcript\"), audioUrl }),\n split: (audioUrl, alignment) => ({ plan: split.plan, audioUrl, alignment }),\n }\n}\n\n/** The finished speech job's audio, its word timings and its segments, as their jobs write them. */\nexport function ugcPreludeOutput(step: UgcPreludeStep, output: Readonly<Obj> | undefined): { value: unknown } | { error: string } {\n const value = step === \"speech\" ? output?.audioUrl : step === \"alignment\" ? output?.alignment : output?.segments\n const ok = step === \"speech\" ? typeof value === \"string\" && value !== \"\" : Array.isArray(value) && value.length > 0\n return ok ? { value } : { error: UGC_NEWER_APP_MESSAGE }\n}\n\n/** The second `/v1/ugc/clips` call: the first call's body with the segments the split returned. */\nexport function ugcClipsPhase2Body(body: Readonly<Obj>, segments: readonly unknown[]): Obj {\n return { ...body, segments: [...segments] }\n}\n\n// ── The hold check once the speech is split ──────────────────────────────────\n\n/** The estimate input of a video cut from one recorded speech, as the hold check names it (`runEstimate`). */\nexport interface UgcRunEstimateInput {\n readonly targetDurationSec: number\n readonly screenshotCount: number\n readonly source: \"sampled\"\n readonly language: string\n}\n\n/**\n * The estimate input of the video a UGC Clips run belongs to, read from the plan the node was sent: its\n * length, its screenshot cards and its language — the reading a kept plan is priced with. Read on a\n * phase-1 answer, before the prelude spends anything, so a plan the check cannot read refuses the run\n * while nothing is paid. The creator's source prices no clip, so it is not read. A plan without a length,\n * or without a language this lane takes → the newer-app sentence: the check never guesses.\n */\nexport function ugcRunEstimateInput(plan: unknown): { runEstimate: UgcRunEstimateInput } | { error: string } {\n const targetDurationSec = ugcPlanLengthSec(plan)\n const language = planOf(plan)?.language\n if (targetDurationSec === undefined || typeof language !== \"string\" || language === \"en\" || !(UGC_SCRIPT_LANGUAGES as readonly unknown[]).includes(language)) {\n return { error: UGC_NEWER_APP_MESSAGE }\n }\n return { runEstimate: { targetDurationSec, screenshotCount: ugcPlanScreenshotCount(plan) ?? 0, source: \"sampled\", language } }\n}\n\n/**\n * The quote that checks a video cut from one recorded speech before any of its clips renders: the clips\n * the second `/v1/ugc/clips` call handed on, priced as the UGC Clips quote prices them (`tickets`,\n * `hasCards`, `finishes`), with `runEstimate` (`ugcRunEstimateInput`). The route then also answers\n * `runHold`, the most the video's estimate holds for the clips and the steps after them, which the run's\n * balance was checked against before it started (`ugcRenderHoldVerdict`). No clips → the newer-app sentence.\n */\nexport function ugcRenderHoldBody(input: { runEstimate: UgcRunEstimateInput; tickets: unknown; hasCards: boolean; finishes: boolean }): { path: \"/v1/ugc/quote\"; body: Obj } | { error: string } {\n if (!Array.isArray(input.tickets) || input.tickets.length === 0) return { error: UGC_NEWER_APP_MESSAGE }\n return {\n path: \"/v1/ugc/quote\",\n body: {\n tickets: [...input.tickets],\n hasCards: input.hasCards,\n ...(input.finishes ? { finishes: true } : {}),\n runEstimate: { ...input.runEstimate },\n },\n }\n}\n\n/** A plan, or its wire (a JSON string), as an object; undefined for anything else. */\nfunction planOf(plan: unknown): Obj | undefined {\n if (typeof plan !== \"string\") return isObject(plan) ? plan : undefined\n try {\n const parsed: unknown = JSON.parse(plan)\n return isObject(parsed) ? parsed : undefined\n } catch {\n return undefined\n }\n}\n\nconst isCredits = (x: unknown): x is number => typeof x === \"number\" && Number.isFinite(x) && x >= 0\n\n/**\n * The hold check's answer → go on, or stop before any clip renders: the clips and the steps after them\n * (`ceiling`, each clip at its hold) over what the run was checked for (`runHold`) → the over-hold\n * sentence. An answer without both figures stops too (the newer-app sentence): a clip never renders\n * on a figure nobody checked.\n */\nexport function ugcRenderHoldVerdict(answer: unknown): { readonly ok: true } | { readonly error: string } {\n if (!isObject(answer) || !isCredits(answer.ceiling) || !isCredits(answer.runHold)) return { error: UGC_NEWER_APP_MESSAGE }\n return answer.ceiling > answer.runHold ? { error: UGC_OVER_HOLD_MESSAGE } : { ok: true }\n}\n\n// ── UGC Finish ───────────────────────────────────────────────────────────────\n\n/** What UGC Finish does with the clips it was handed. */\nexport type UgcFinishPlan =\n /** No finish call on the plan (English): the clips go on as they came, no call, no job. */\n | { readonly kind: \"pass\"; readonly clips: readonly string[] }\n /** The finish job's body: the segments with their room, one roll per clip, in order. */\n | { readonly kind: \"job\"; readonly path: \"/v1/ugc/finish\"; readonly body: Obj }\n\n/**\n * UGC Finish's input → what it does. The `plan` input is UGC Clips' Script (sized) output; a plan\n * carrying `finish` (the segmented lane) asks for the finish job over the clips, in order; any other\n * plan passes the clips through. Clips are the fan-in list (`inputs.inputs`), in clip order.\n */\nexport function ugcFinishPlan(input: { planOutWire: unknown; clipUrls: readonly unknown[] }): UgcFinishPlan | { readonly error: string } {\n const clips = input.clipUrls.filter((u): u is string => typeof u === \"string\" && u !== \"\")\n if (clips.length === 0) return { error: UGC_FINISH_NEEDS_CLIPS_MESSAGE }\n const read = readUgcWire(input.planOutWire, UGC_NODE_MESSAGES.needsPlanOut)\n if (\"error\" in read) return read\n const finish = read.value.finish\n if (finish === undefined) return { kind: \"pass\", clips }\n if (!isObject(finish) || !Array.isArray(finish.segments) || finish.segments.length === 0) return { error: UGC_NEWER_APP_MESSAGE }\n if (finish.segments.length !== clips.length) return { error: UGC_NEWER_APP_MESSAGE }\n return {\n kind: \"job\",\n path: \"/v1/ugc/finish\",\n body: { segments: finish.segments, clips: clips.map((url, i) => ({ clip: i + 1, rolls: [url] })) },\n }\n}\n\n/** A finished clip, as UGC Finish hands it on: its URL and the notes its downstream nodes read. */\nexport interface UgcFinishedClip { readonly url: string; readonly meta: FanOutItemMeta }\n\n/**\n * A finished `ugc-finish` job → the finished clips in clip order, each with its real length. `ready: false`\n * (a clip that does not follow its speech) → the not-ready sentence: the node fails, never hands on a\n * partial list. A dry finish's warning rides every clip's notes.\n */\nexport function ugcFinishOutputs(output: Readonly<Obj> | undefined): { clips: UgcFinishedClip[] } | { error: string } {\n if (!output) return { error: UGC_NEWER_APP_MESSAGE }\n if (output.ready === false) return { error: UGC_FINISH_NOT_READY_MESSAGE }\n if (output.ready !== true || !Array.isArray(output.clips) || output.clips.length === 0) return { error: UGC_NEWER_APP_MESSAGE }\n const warnings = Array.isArray(output.warnings)\n ? output.warnings.flatMap((w) => (isObject(w) && typeof w.code === \"string\" ? [w.code] : typeof w === \"string\" ? [w] : []))\n : []\n const rows = [...output.clips].filter(isObject).sort((a, b) => Number(a.clip) - Number(b.clip))\n if (rows.length !== output.clips.length || rows.some((r, i) => r.clip !== i + 1 || typeof r.url !== \"string\" || r.url === \"\")) return { error: UGC_NEWER_APP_MESSAGE }\n return {\n clips: rows.map((r) => ({\n url: r.url as string,\n meta: { warnings, durationSec: typeof r.sec === \"number\" && Number.isFinite(r.sec) && r.sec > 0 ? r.sec : null },\n })),\n }\n}\n\n/**\n * Whether a UGC Finish reads this UGC Clips node's Script (sized) output: the graph can finish a video\n * whose clips are cut from one recorded speech. Read before the prelude spends anything.\n */\nexport function ugcFinishWired(\n edges: ReadonlyArray<{ readonly source?: string; readonly target?: string; readonly sourceHandle?: string | null; readonly targetHandle?: string | null }>,\n nodes: ReadonlyArray<{ readonly id?: string; readonly type?: string | null }>,\n clipsId: string,\n): boolean {\n const finishIds = new Set(nodes.filter((n) => n.type === UGC_FINISH_CLIPS_TYPE && typeof n.id === \"string\").map((n) => n.id as string))\n return edges.some((e) => e.source === clipsId && e.sourceHandle === \"plan-out\" && e.target !== undefined && finishIds.has(e.target) && (e.targetHandle ?? \"\") === \"plan\")\n}\n\n/** UGC Clips' refusal before its prelude: the sentence when no UGC Finish reads its Script (sized) output, else null. */\nexport function ugcLaneNeedsFinish(\n edges: Parameters<typeof ugcFinishWired>[0],\n nodes: Parameters<typeof ugcFinishWired>[1],\n clipsId: string,\n): string | null {\n return ugcFinishWired(edges, nodes, clipsId) ? null : UGC_NEEDS_FINISH_MESSAGE\n}\n"]}
@@ -385,10 +385,20 @@ var VIDEO_MASK_DEFAULTS = {
385
385
  * Off: one pass over the whole clip. On: the clip's scene cuts are found
386
386
  * first and each shot is segmented on its own — the model starts afresh
387
387
  * after every cut (finding the new shot's subjects), and `holdLastMask`
388
- * never carries a mask across a cut. A clip with no cut (a flash is not
389
- * one) is one shot: the same mask, fitted to the clip's exact frame count.
388
+ * never carries a mask across a cut. A clip with no cut (a flash is
389
+ * usually not one) is one shot: the same mask, fitted to the clip's exact
390
+ * frame count.
390
391
  */
391
- perShot: false
392
+ perShot: false,
393
+ /**
394
+ * 0 = off: a new detection only where a request starts anyway (the clip's
395
+ * start, every 1,800 frames, and every cut with `perShot`). Above 0: the
396
+ * model is also sent a new request every this many seconds of footage, so a
397
+ * subject that first appears mid-shot is found within that time (see
398
+ * `REDETECT_EVERY_SEC_*`). These boundaries are not cuts: `holdLastMask`
399
+ * keeps holding across them.
400
+ */
401
+ redetectEverySec: 0
392
402
  };
393
403
  var VIDEO_MASK_LIMITS = {
394
404
  /** The longest input clip a run accepts, in seconds of PRICED length (see `videoMaskBilledSeconds`). */
@@ -410,6 +420,14 @@ var VIDEO_MASK_LIMITS = {
410
420
  * instead. Frames before the first detection stay as they are.
411
421
  */
412
422
  HOLD_EMPTY_BELOW_FRACTION: 2e-5,
423
+ /**
424
+ * `holdLastMask`: the longest a mask is held, in seconds of frames (at the
425
+ * clip's rate). The hold is for a subject hidden for a moment; a run of
426
+ * empty frames longer than this shows the held mask for its first second
427
+ * and then nothing, until the model finds the subject again — a mask held
428
+ * on for longer sits where the subject no longer is.
429
+ */
430
+ HOLD_MAX_SEC: 1,
413
431
  /**
414
432
  * `minSubjectHeightPct`: drop every connected white region (8-connected)
415
433
  * whose bounding box is shorter than this % of the frame height — extras'
@@ -437,8 +455,24 @@ var VIDEO_MASK_LIMITS = {
437
455
  * `holdLastMask`, so a frame left with nothing inside counts as empty.
438
456
  */
439
457
  ZONE_MARGIN_PCT_MIN: 0,
440
- ZONE_MARGIN_PCT_MAX: 49
458
+ ZONE_MARGIN_PCT_MAX: 49,
459
+ /**
460
+ * `redetectEverySec`: 0 (off) or `REDETECT_EVERY_SEC_MIN`–`MAX` seconds. The
461
+ * model picks up its subjects near the start of each request; a face that
462
+ * turns to the camera, or a person who walks in, partway through a request is
463
+ * never masked. On, the clip (each shot, with `perShot`) is cut into requests
464
+ * of at most this many seconds of frames — counted from the shot's start, a
465
+ * last piece shorter than `VIDEO_MASK_MIN_SHOT_FRAMES` joining the one before
466
+ * — so the subjects are detected again at every such boundary. Each request
467
+ * adds wall time (they run three at a time); the price follows the clip's
468
+ * length and does not change.
469
+ */
470
+ REDETECT_EVERY_SEC_MIN: 1,
471
+ REDETECT_EVERY_SEC_MAX: 10,
472
+ /** The panel's step (the API takes any value in range). */
473
+ REDETECT_EVERY_SEC_STEP: 1
441
474
  };
475
+ var VIDEO_MASK_RECIPE = "2026-10-25";
442
476
  var VIDEO_MASK_BUCKETS_SEC = [5, 10, 15, 30, 60, 90, 120, 180, 240, 300];
443
477
  function videoMaskCreditIds(provider = DEFAULT_VIDEO_MASK_PROVIDER) {
444
478
  return VIDEO_MASK_BUCKETS_SEC.map((sec) => `${provider}-video:${sec}s`);
@@ -463,6 +497,10 @@ function resolveVideoMaskZone(value) {
463
497
  const zone = { leftPct: margin(v.leftPct), rightPct: margin(v.rightPct), topPct: margin(v.topPct), bottomPct: margin(v.bottomPct) };
464
498
  return zone.leftPct > 0 || zone.rightPct > 0 || zone.topPct > 0 || zone.bottomPct > 0 ? zone : null;
465
499
  }
500
+ function resolveVideoMaskRedetectSec(value) {
501
+ if (typeof value !== "number" || !Number.isFinite(value) || value <= 0) return 0;
502
+ return Math.min(VIDEO_MASK_LIMITS.REDETECT_EVERY_SEC_MAX, Math.max(VIDEO_MASK_LIMITS.REDETECT_EVERY_SEC_MIN, value));
503
+ }
466
504
 
467
505
  // src/generate-mask.ts
468
506
  var GENERATE_MASK_LIMITS = {
@@ -575,6 +613,7 @@ exports.NODARO_RESET_PROJECT = NODARO_RESET_PROJECT;
575
613
  exports.VIDEO_MASK_DEFAULTS = VIDEO_MASK_DEFAULTS;
576
614
  exports.VIDEO_MASK_LIMITS = VIDEO_MASK_LIMITS;
577
615
  exports.VIDEO_MASK_PROVIDERS = VIDEO_MASK_PROVIDERS;
616
+ exports.VIDEO_MASK_RECIPE = VIDEO_MASK_RECIPE;
578
617
  exports.applySlots = applySlots;
579
618
  exports.deriveLottieSlotFields = deriveLottieSlotFields;
580
619
  exports.describeMaskRegion = describeMaskRegion;
@@ -591,10 +630,11 @@ exports.normalizeLottieLayers = normalizeLottieLayers;
591
630
  exports.resolveLottieOverlaySrc = resolveLottieOverlaySrc;
592
631
  exports.resolveMaskCompositeSettings = resolveMaskCompositeSettings;
593
632
  exports.resolveVideoMaskProvider = resolveVideoMaskProvider;
633
+ exports.resolveVideoMaskRedetectSec = resolveVideoMaskRedetectSec;
594
634
  exports.resolveVideoMaskZone = resolveVideoMaskZone;
595
635
  exports.rgbaArrayToHex = rgbaArrayToHex;
596
636
  exports.videoMaskBilledSeconds = videoMaskBilledSeconds;
597
637
  exports.videoMaskCreditId = videoMaskCreditId;
598
638
  exports.videoMaskCreditIds = videoMaskCreditIds;
599
- //# sourceMappingURL=chunk-TGZJXCLL.cjs.map
600
- //# sourceMappingURL=chunk-TGZJXCLL.cjs.map
639
+ //# sourceMappingURL=chunk-QHODM5TS.cjs.map
640
+ //# sourceMappingURL=chunk-QHODM5TS.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/freecut-protocol.ts","../src/inpaint-region.ts","../src/lottie-slots.ts","../src/lottie-overlay-catalog.ts","../src/audio-fx-presets.ts","../src/video-mask.ts","../src/generate-mask.ts","../src/mask-composite.ts"],"names":["clamp01","copy"],"mappings":";;;AAMO,IAAM,iBAAA,GAAoB;AAI1B,IAAM,oBAAA,GAAuB;AAC7B,IAAM,mBAAA,GAAsB;AAC5B,IAAM,oBAAA,GAAuB;AAG7B,IAAM,aAAA,GAAgB;AACtB,IAAM,uBAAA,GAA0B;AAChC,IAAM,uBAAA,GAA0B;AAChC,IAAM,sBAAA,GAAyB;;;ACPtC,SAAS,KAAK,MAAA,EAAwC;AACpD,EAAA,IAAI,MAAA,GAAS,CAAA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,IAAA,EAA+E;AACjH,EAAA,MAAM,IAAI,IAAA,EAAM,IAAA;AAChB,EAAA,OAAQ,oBAAA,CAA2C,QAAA,CAAS,CAAW,CAAA,GAAK,IAA0B,uBAAA,CAAwB,IAAA;AAChI;AAGO,SAAS,4BAA4B,IAAA,EAAkC;AAC5E,EAAA,OAAO,IAAA,KAAS,OAAA;AAClB;AAQO,SAAS,wBAAwB,IAAA,EAA0F;AAChI,EAAA,OAAO,2BAAA,CAA4B,mBAAA,CAAoB,IAAI,CAAC,IAAI,OAAA,GAAU,kBAAA;AAC5E;AAQO,SAAS,kCAAkC,CAAA,EAAkF;AAClI,EAAA,IAAI,2BAAA,CAA4B,CAAA,CAAE,IAAI,CAAA,SAAU,CAAA,CAAE,WAAA;AAClD,EAAA,OAAO,YAAA;AACT","file":"chunk-QHODM5TS.cjs","sourcesContent":["// Single source of truth for the Nodaro <-> FreeCut iframe postMessage protocol.\n// Imported by app's freecut-editor-modal and Studio's ported modal so the wire\n// format cannot drift. The fork (Nodaro-ai/freecut-fork) mirrors these strings in\n// src/features/embedded/services/embedded-message-handler.ts + use-send-back.ts.\n\n// Nodaro (parent) -> FreeCut (iframe)\nexport const NODARO_LOAD_VIDEO = \"NODARO_LOAD_VIDEO\"\n// Multi-clip analog of NODARO_LOAD_VIDEO: lay N ordered urls on the timeline as\n// sequential clips (FreeCut fetches them itself). Used by Studio's production\n// \"Edit in FreeCut\" to assemble the whole cut.\nexport const NODARO_LOAD_TIMELINE = \"NODARO_LOAD_TIMELINE\"\nexport const NODARO_IMPORT_FILES = \"NODARO_IMPORT_FILES\"\nexport const NODARO_RESET_PROJECT = \"NODARO_RESET_PROJECT\"\n\n// FreeCut (iframe) -> Nodaro (parent)\nexport const FREECUT_READY = \"FREECUT_READY\"\nexport const FREECUT_EXPORT_COMPLETE = \"FREECUT_EXPORT_COMPLETE\"\nexport const FREECUT_EXPORT_PROGRESS = \"FREECUT_EXPORT_PROGRESS\" // reserved; fork emits it, v1 parents ignore it\nexport const FREECUT_REQUEST_IMPORT = \"FREECUT_REQUEST_IMPORT\"\n\nexport interface FreecutImportFile {\n readonly name: string\n readonly type: string\n readonly size: number\n readonly buffer: ArrayBuffer\n}\n\nexport interface NodaroLoadVideoPayload {\n readonly videoUrl: string\n /** Display/file name for the primary video (\"Shot 1.mp4\") — optional; absent = URL-derived name (fork default). */\n readonly videoName?: string\n readonly videoBuffer?: ArrayBuffer\n readonly projectJson?: unknown\n readonly additionalFiles?: ReadonlyArray<FreecutImportFile>\n}\n\nexport interface NodaroLoadTimelinePayload {\n // Ordered clip urls; FreeCut fetches each and lays them end-to-end on the timeline.\n readonly clips: ReadonlyArray<string>\n}\n\nexport interface FreecutExportCompletePayload {\n readonly videoBuffer: ArrayBuffer\n readonly projectJson?: unknown\n}\n\nexport interface FreecutExportProgressPayload {\n readonly percent: number\n}\n\nexport interface FreecutRequestImportPayload {\n readonly accept?: string\n readonly multiple?: boolean\n}\n","export interface PixelBox { x: number; y: number; width: number; height: number }\n\nexport interface MaskRegionDescriptor {\n /** bbox normalized to 0..1 against the image, clamped so x+width ≤ 1 and y+height ≤ 1. */\n normBbox: PixelBox\n /** Natural-language location, e.g. \"the upper-left region\" / \"the center\". */\n location: string\n /** Prompt fragment to PREPEND to the user instruction. */\n fragment: string\n}\n\nfunction band(center: number): \"low\" | \"mid\" | \"high\" {\n if (center < 1 / 3) return \"low\"\n if (center > 2 / 3) return \"high\"\n return \"mid\"\n}\n\nconst VERT = { low: \"upper\", mid: \"middle\", high: \"lower\" } as const\nconst HORZ = { low: \"left\", mid: \"center\", high: \"right\" } as const\n\n/**\n * Turn a pixel bounding box of the masked (edit) region into a normalized bbox\n * + natural-language location + a prompt fragment. Pure — no IO. This is the\n * Tier-B descriptor injected for strong instruction-following editors, and the\n * exact primitive Phase 2 (named regions) will reuse.\n */\nexport function describeMaskRegion(box: PixelBox, image: { width: number; height: number }): MaskRegionDescriptor {\n const clamp01 = (n: number) => Math.max(0, Math.min(1, n))\n const round2 = (n: number) => Math.round(n * 100) / 100\n const nx = clamp01(box.x / image.width)\n const ny = clamp01(box.y / image.height)\n const normBbox: PixelBox = {\n x: round2(nx),\n y: round2(ny),\n width: round2(Math.max(0, Math.min(1 - nx, box.width / image.width))),\n height: round2(Math.max(0, Math.min(1 - ny, box.height / image.height))),\n }\n\n const cx = (box.x + box.width / 2) / image.width\n const cy = (box.y + box.height / 2) / image.height\n const v = VERT[band(cy)]\n const h = HORZ[band(cx)]\n const location = v === \"middle\" && h === \"center\" ? \"the center\" : `the ${v}-${h} region`\n\n const fragment =\n `Apply the following change ONLY to ${location} of the image ` +\n `(normalized region x=${normBbox.x} y=${normBbox.y} w=${normBbox.width} h=${normBbox.height}), ` +\n `leaving everything else unchanged: `\n\n return { normBbox, location, fragment }\n}\n","/**\n * Lottie slot substitution — single source of truth (design §5).\n *\n * A slotted property is an object containing a `sid` key (canonically exactly\n * `{\"sid\": \"name\"}`; tolerantly also the annotation form `{a, k, sid}`). The\n * slot manifest maps sid → { p: <whatever belongs at the reference position> }.\n * Overrides map sid → raw value (what UI controls write).\n *\n * KEY CONVENTION: a slot's `p` is, by design, EXACTLY what belongs at the\n * reference position — and we substitute it VERBATIM, never auto-wrapping it in\n * an `{a:0,k:...}` envelope. At a property position (a fill color, a shape size)\n * that means `p` is a property object like `{\"a\":0,\"k\":[1,0,0,1]}`. At a RAW\n * position inside a text document — `layers[].t.d.k[0].s.t`, where lottie-web's\n * `buildFinalText` iterates string characters — `p` is a BARE string, e.g.\n * `{ \"nameText\": { \"p\": \"John Smith\" } }` substitutes the string `\"John Smith\"`\n * straight onto `s.t`. (Auto-wrapping there produced `{a:0,k:\"John Smith\"}` and\n * broke text rendering — the defect this contract fixes.)\n *\n * An override is wrapped ONLY when it lands on a property-object default: the\n * `{...p, k: override}` form preserves the default's envelope (animated/static\n * flags). On a raw default (or a missing slot) the override is substituted\n * verbatim too — so a raw text override stays a bare string.\n *\n * Substitution is renderer-agnostic: we replace every sid node ourselves and\n * never rely on lottie-web's version-dependent native slot support.\n */\n\ntype JsonRecord = Record<string, unknown>\n\nfunction isPlainObject(v: unknown): v is JsonRecord {\n return typeof v === \"object\" && v !== null && !Array.isArray(v)\n}\n\n/** True when `p` already looks like a lottie animated-property object. */\nfunction isPropertyObject(v: unknown): v is JsonRecord {\n return isPlainObject(v) && \"k\" in v\n}\n\nfunction resolveSlotNode(\n node: JsonRecord,\n slots: JsonRecord,\n overrides: JsonRecord,\n): unknown {\n const sid = node.sid as string\n const slot = slots[sid]\n const slotP = isPlainObject(slot) ? (slot as JsonRecord).p : undefined\n const override = overrides[sid]\n\n if (override !== undefined) {\n // Wrap into the default's property-object envelope when the default IS one\n // (preserves animated/static flags); otherwise substitute the raw override\n // verbatim — a raw text override must stay a bare string at `s.t`.\n if (isPropertyObject(slotP)) return { ...slotP, k: structuredClone(override) }\n return structuredClone(override)\n }\n if (slotP !== undefined) {\n // `p` is by convention exactly what belongs at the reference position —\n // substitute it verbatim, never auto-wrap (a bare string stays a string).\n return structuredClone(slotP)\n }\n // No slot, no override — leave the node as-is (validator rule #6 should\n // prevent this; belt-and-braces for hand-fed documents).\n return node\n}\n\nfunction walk(value: unknown, slots: JsonRecord, overrides: JsonRecord): unknown {\n if (Array.isArray(value)) {\n return value.map((item) => walk(item, slots, overrides))\n }\n if (isPlainObject(value)) {\n if (typeof value.sid === \"string\") {\n const resolved = resolveSlotNode(value, slots, overrides)\n // The original node comes back only in the missing-slot case; replacements\n // are leaf property objects and need no further walking.\n if (resolved === value) {\n const copy: JsonRecord = {}\n for (const [k, v] of Object.entries(value)) copy[k] = walk(v, slots, overrides)\n return copy\n }\n return resolved\n }\n const copy: JsonRecord = {}\n for (const [k, v] of Object.entries(value)) copy[k] = walk(v, slots, overrides)\n return copy\n }\n return value\n}\n\n/** Pure: returns a new document; never mutates inputs. */\nexport function applySlots(\n lottie: JsonRecord,\n slots: JsonRecord | undefined,\n overrides: JsonRecord | undefined,\n): JsonRecord {\n return walk(lottie, slots ?? {}, overrides ?? {}) as JsonRecord\n}\n\n// ── Playback normalization ───────────────────────────────────────────────────\n//\n// lottie-web computes a layer's local time as `frame - layer.st` and gates the\n// layer on `local >= ip && local < op`. A layer missing `st` yields NaN, fails\n// the gate, and stays `display:none` forever — the document \"loads\" (DOMLoaded\n// fires) but every frame renders blank (prod incident 2026-06-12: all authored\n// lottie renders came out as empty frames in headless Chrome). `st` and `sr`\n// are spec-optional with defaults, so documents routinely omit them; complete\n// them at the playback boundary so any source — authored plan, baked export,\n// catalog asset, external URL — renders. Mutates `doc` in place and returns it\n// (callers pass freshly fetched or freshly copied documents).\n\nexport function normalizeLottieLayers<T>(doc: T): T {\n if (!isPlainObject(doc)) return doc\n const fix = (layers: unknown): void => {\n if (!Array.isArray(layers)) return\n for (const layer of layers) {\n if (!isPlainObject(layer)) continue\n if (typeof layer.st !== \"number\") layer.st = 0\n if (typeof layer.sr !== \"number\") layer.sr = 1\n }\n }\n fix((doc as JsonRecord).layers)\n const assets = (doc as JsonRecord).assets\n if (Array.isArray(assets)) {\n for (const asset of assets) {\n if (isPlainObject(asset)) fix(asset.layers)\n }\n }\n return doc\n}\n\n// ── Slot control descriptors (Phase 2 — UI mapping) ──────────────────────────\n//\n// A slot manifest entry is `{ p: <whatever belongs at the reference position> }`\n// (Amendment 1). `describeSlotControl` unwraps that envelope to the editable raw\n// value and classifies it into the control kind the config panel should render.\n// `p` is either a property object `{a, k}` (colors, sizes, scalars) whose `k`\n// holds the value, or a bare raw value (text strings live unwrapped at `s.t`).\n\nexport type SlotControlKind = \"color\" | \"text\" | \"number\" | \"point\"\nexport interface SlotControlDescriptor {\n kind: SlotControlKind\n value: unknown\n}\n\n/**\n * Unwraps a slot entry to its editable raw value and classifies it:\n * {p:{a:0,k:[1,0,0,1]}} → { kind:\"color\", value:[1,0,0,1] }\n * {p:\"John\"} → { kind:\"text\", value:\"John\" }\n * {p:{a:0,k:42}} → { kind:\"number\", value:42 }\n * {p:{a:0,k:[10,20]}} → { kind:\"point\", value:[10,20] }\n * Animated property objects (`a:1`) and anything that doesn't map to a known\n * control kind return null (no editable control).\n */\nexport function describeSlotControl(slot: unknown): SlotControlDescriptor | null {\n if (!isPlainObject(slot)) return null\n const p = (slot as JsonRecord).p\n let value: unknown = p\n if (isPropertyObject(p)) {\n if ((p as JsonRecord).a === 1) return null\n value = (p as JsonRecord).k\n }\n if (typeof value === \"string\") return { kind: \"text\", value }\n if (typeof value === \"number\") return { kind: \"number\", value }\n if (\n Array.isArray(value) &&\n value.length === 4 &&\n value.every((n) => typeof n === \"number\" && n >= 0 && n <= 1)\n ) {\n return { kind: \"color\", value }\n }\n if (Array.isArray(value) && value.length === 2 && value.every((n) => typeof n === \"number\")) {\n return { kind: \"point\", value }\n }\n return null\n}\n\nfunction clamp01(n: number): number {\n if (Number.isNaN(n)) return 0\n return n < 0 ? 0 : n > 1 ? 1 : n\n}\n\nfunction toHexByte(component: number): string {\n return Math.round(clamp01(component) * 255)\n .toString(16)\n .padStart(2, \"0\")\n}\n\n/**\n * RGBA array (components 0..1) → hex string. The alpha component is omitted\n * when it is exactly 1 (`[1,0,0,1]` → `\"#ff0000\"`); otherwise an 8-digit hex is\n * emitted (`[0,1,0,0.5]` → `\"#00ff0080\"`). Output is always lowercase.\n */\nexport function rgbaArrayToHex(rgba: number[]): string {\n const [r = 0, g = 0, b = 0, a = 1] = rgba\n const base = `#${toHexByte(r)}${toHexByte(g)}${toHexByte(b)}`\n return a >= 1 ? base : `${base}${toHexByte(a)}`\n}\n\n/**\n * Hex string → RGBA array (components 0..1). Accepts `#rgb`, `#rrggbb`, and\n * `#rrggbbaa`; alpha defaults to 1 when absent. Leading `#` is optional.\n */\nexport function hexToRgbaArray(hex: string): number[] {\n let h = hex.trim().replace(/^#/, \"\")\n if (h.length === 3) {\n h = h\n .split(\"\")\n .map((c) => c + c)\n .join(\"\")\n }\n const r = parseInt(h.slice(0, 2), 16) / 255\n const g = parseInt(h.slice(2, 4), 16) / 255\n const b = parseInt(h.slice(4, 6), 16) / 255\n const a = h.length >= 8 ? parseInt(h.slice(6, 8), 16) / 255 : 1\n return [r, g, b, a]\n}\n\n/** Manifest sids in insertion order (drives the slot-control list ordering). */\nexport function listSlotSids(slots: Record<string, unknown>): string[] {\n return Object.keys(slots ?? {})\n}\n\n// ── Slot → app-field derivation (Phase 3 — single source of truth) ────────────\n//\n// `deriveLottieSlotFields` turns a lottie-graphic plan's slot manifest into\n// ExposableField-shaped descriptors. ONE function feeds three surfaces: the\n// editor's publish picker, the published-app runtime, and the backend MCP\n// schema extractor — so the set of slots an app exposes can never drift between\n// them. It deliberately mirrors `describeSlotControl`'s classification (the\n// editor's live slot controls use the same source of truth).\n\n/** Prefix for the synthetic field key of a derived slot field: `slot:<sid>`. */\nexport const LOTTIE_SLOT_FIELD_PREFIX = \"slot:\"\n\n/** \"primaryColor\" → \"Primary Color\"; \"bar_size\" → \"Bar Size\". */\nexport function humanizeSlotSid(sid: string): string {\n return sid\n .replace(/([a-z0-9])([A-Z])/g, \"$1 $2\")\n .replace(/[_-]+/g, \" \")\n .replace(/\\s+/g, \" \")\n .trim()\n .replace(/\\b\\w/g, (c) => c.toUpperCase())\n}\n\n/** ExposableField-shaped descriptor derived from one slot. */\nexport interface LottieSlotField {\n /** Synthetic field key: `slot:<sid>`. */\n key: string\n /** Humanized sid (camelCase / snake_case → Title Case). */\n label: string\n /** Maps onto the `ExposableField.type` members used in apps. */\n type: \"color\" | \"text\" | \"slider\"\n min?: number\n max?: number\n step?: number\n /** Hex string for color; raw value for text/number. */\n defaultValue?: unknown\n}\n\n/**\n * Derive ExposableField-shaped descriptors from a motion-graphics node's plan.\n *\n * Returns [] unless `motionPlan.planType === \"lottie-graphic\"` and `slots` is a\n * non-empty object — the elements engine and absent plans expose nothing.\n *\n * Per slot, via `describeSlotControl`:\n * - color → `{ type: \"color\", defaultValue: rgbaArrayToHex(value) }`\n * - text → `{ type: \"text\", defaultValue: value }`\n * - number → `{ type: \"slider\", min, max, step, defaultValue: value }`\n * (0–1 values → 0..1 step 0.01; larger → 0..ceil(value*2) step 1)\n * - point / null → SKIPPED. Point-kind slots are intentionally not exposed in\n * apps (no paired-number card; positions are rarely end-user-meaningful).\n */\nexport function deriveLottieSlotFields(\n motionPlan: Record<string, unknown> | undefined,\n): LottieSlotField[] {\n if (!motionPlan || motionPlan.planType !== \"lottie-graphic\") return []\n const slots = motionPlan.slots\n if (!isPlainObject(slots)) return []\n\n const fields: LottieSlotField[] = []\n for (const [sid, slot] of Object.entries(slots)) {\n const control = describeSlotControl(slot)\n if (!control) continue\n const base = { key: `${LOTTIE_SLOT_FIELD_PREFIX}${sid}`, label: humanizeSlotSid(sid) }\n\n if (control.kind === \"color\") {\n fields.push({\n ...base,\n type: \"color\",\n defaultValue: rgbaArrayToHex(control.value as number[]),\n })\n } else if (control.kind === \"text\") {\n fields.push({ ...base, type: \"text\", defaultValue: control.value })\n } else if (control.kind === \"number\") {\n const value = Number(control.value)\n const isUnit = value <= 1\n fields.push({\n ...base,\n type: \"slider\",\n min: 0,\n max: isUnit ? 1 : Math.ceil(value * 2) || 100,\n step: isUnit ? 0.01 : 1,\n defaultValue: control.value,\n })\n }\n // point / unrecognized kinds are intentionally not exposed.\n }\n return fields\n}\n","/**\n * Built-in Lottie Overlay catalog — single source of truth.\n *\n * The Lottie Overlay node ships a curated set of 12 animations the overlay LLM\n * can pick from. They were originally served from the third-party lottie.host\n * CDN, which went dead (origin returns 403) and broke every catalog-based\n * overlay render in production. The replacements were authored with our own\n * Lottie engine, baked (slots resolved, no `sid` refs), and are now self-hosted\n * on the Nodaro CDN at `https://cdn.nodaro.ai/lottie-catalog/<slug>.json`.\n *\n * This module is the ONE place the catalog lives:\n * - `LOTTIE_OVERLAY_CATALOG` feeds the overlay system prompt (the LLM's menu).\n * - `LEGACY_LOTTIE_HOST_REMAP` + `resolveLottieOverlaySrc` heal saved overlay\n * plans at render time — a plan authored before the cut-over still points at\n * a dead lottie.host URL, so the renderer rewrites it to its self-hosted\n * replacement before fetching.\n */\n\nexport interface LottieOverlayCatalogEntry {\n /** Stable system key — the R2 object is `lottie-catalog/<slug>.json`. */\n readonly slug: string\n /** Display name — mirrors the original prompt's catalog labels. */\n readonly name: string\n /** Catalog group (drives the grouped layout in the system prompt). */\n readonly group:\n | \"Celebration\"\n | \"Social / Reactions\"\n | \"UI / Indicators\"\n | \"Ambient / Decorative\"\n /** One placement-intent line for the overlay LLM. */\n readonly description: string\n /** Public CDN URL: `https://cdn.nodaro.ai/lottie-catalog/<slug>.json`. */\n readonly url: string\n /** Whether the animation is continuous (loop) or a one-shot effect. */\n readonly loop: boolean\n}\n\nconst CDN_BASE = \"https://cdn.nodaro.ai/lottie-catalog\"\n\nexport const LOTTIE_OVERLAY_CATALOG: readonly LottieOverlayCatalogEntry[] = [\n // ── Celebration ────────────────────────────────────────────────────────────\n {\n slug: \"confetti-burst\",\n name: \"Confetti burst\",\n group: \"Celebration\",\n description: \"Multicolor confetti shower — large coverage at a celebratory peak; one-shot.\",\n url: `${CDN_BASE}/confetti-burst.json`,\n loop: false,\n },\n {\n slug: \"fireworks\",\n name: \"Fireworks\",\n group: \"Celebration\",\n description: \"Bursting fireworks against the sky — big-moment payoff over the upper frame; one-shot.\",\n url: `${CDN_BASE}/fireworks.json`,\n loop: false,\n },\n {\n slug: \"party-popper\",\n name: \"Party popper\",\n group: \"Celebration\",\n description: \"Party popper streamers from a corner — a quick celebratory accent; one-shot.\",\n url: `${CDN_BASE}/party-popper.json`,\n loop: false,\n },\n {\n slug: \"stars-sparkle\",\n name: \"Stars sparkle\",\n group: \"Celebration\",\n description: \"Twinkling stars/sparkles — small accent over a highlight; loops.\",\n url: `${CDN_BASE}/stars-sparkle.json`,\n loop: true,\n },\n // ── Social / Reactions ──────────────────────────────────────────────────────\n {\n slug: \"heart-pulse\",\n name: \"Heart pulse\",\n group: \"Social / Reactions\",\n description: \"Pulsing heart reaction — medium size at a corner or edge; loops.\",\n url: `${CDN_BASE}/heart-pulse.json`,\n loop: true,\n },\n {\n slug: \"thumbs-up\",\n name: \"Thumbs up\",\n group: \"Social / Reactions\",\n description: \"Thumbs-up approval reaction — medium size, pops in once; one-shot.\",\n url: `${CDN_BASE}/thumbs-up.json`,\n loop: false,\n },\n {\n slug: \"fire-flame\",\n name: \"Fire emoji\",\n group: \"Social / Reactions\",\n description: \"Flickering flame reaction (“this is fire”) — small size at an edge; loops.\",\n url: `${CDN_BASE}/fire-flame.json`,\n loop: true,\n },\n // ── UI / Indicators ─────────────────────────────────────────────────────────\n {\n slug: \"loading-spinner\",\n name: \"Loading spinner\",\n group: \"UI / Indicators\",\n description: \"Circular loading spinner — small, centered, signals progress; loops.\",\n url: `${CDN_BASE}/loading-spinner.json`,\n loop: true,\n },\n {\n slug: \"checkmark-success\",\n name: \"Checkmark success\",\n group: \"UI / Indicators\",\n description: \"Animated success checkmark — small, marks a completed/correct moment; one-shot.\",\n url: `${CDN_BASE}/checkmark-success.json`,\n loop: false,\n },\n {\n slug: \"arrow-pointer\",\n name: \"Arrow pointer\",\n group: \"UI / Indicators\",\n description: \"Animated arrow drawing attention to a spot — small, timed to a key area; loops.\",\n url: `${CDN_BASE}/arrow-pointer.json`,\n loop: true,\n },\n // ── Ambient / Decorative ────────────────────────────────────────────────────\n {\n slug: \"floating-particles\",\n name: \"Floating particles\",\n group: \"Ambient / Decorative\",\n description: \"Soft drifting particles — large coverage, low opacity, full-duration ambience; loops.\",\n url: `${CDN_BASE}/floating-particles.json`,\n loop: true,\n },\n {\n slug: \"glowing-ring\",\n name: \"Glowing ring\",\n group: \"Ambient / Decorative\",\n description: \"Pulsing glowing ring/halo — decorative accent around a focal point; loops.\",\n url: `${CDN_BASE}/glowing-ring.json`,\n loop: true,\n },\n] as const\n\n/**\n * Dead lottie.host URLs (origin returns 403) → their replacement catalog URLs.\n * Heals saved plans at render time. The keys are copied EXACTLY from the\n * original `lottie-overlay-system.ts` prompt — they are the literal `src`\n * strings the overlay LLM emitted before the cut-over.\n */\nexport const LEGACY_LOTTIE_HOST_REMAP: Readonly<Record<string, string>> = {\n // Celebration\n \"https://lottie.host/d7313e87-e4c9-4e0d-8e03-c3a59e87d8fb/TjHnrCGBjI.json\": `${CDN_BASE}/confetti-burst.json`,\n \"https://lottie.host/d5cad0dd-4e93-4bbe-b023-e94a04bc1581/JHEZMrqfMk.json\": `${CDN_BASE}/fireworks.json`,\n \"https://lottie.host/0060c9cd-75da-42d5-af7c-1a191fa8a8fd/c1xHMRnGTO.json\": `${CDN_BASE}/party-popper.json`,\n \"https://lottie.host/c04a2758-a1d9-40a9-b81f-6f3e4e13a88c/xKCYDU2w0O.json\": `${CDN_BASE}/stars-sparkle.json`,\n // Social / Reactions\n \"https://lottie.host/44c9e8d1-856c-4641-bfbe-d0e2a5c9850e/GIBsMSIkkq.json\": `${CDN_BASE}/heart-pulse.json`,\n \"https://lottie.host/9a611d56-1f35-4f51-9fa4-6a4daa6b8714/EH71MjHKPD.json\": `${CDN_BASE}/thumbs-up.json`,\n \"https://lottie.host/66db1de9-c1a8-4d0b-bb03-47a8932a8a86/q5JBGQ8fxu.json\": `${CDN_BASE}/fire-flame.json`,\n // UI / Indicators\n \"https://lottie.host/b03d748c-3b4a-4c07-a10c-e9eb3c967349/eMVAVEnb5x.json\": `${CDN_BASE}/loading-spinner.json`,\n \"https://lottie.host/3ffaab4a-58b0-4a72-9f1c-5eaa484d8c88/g27v7IPaJc.json\": `${CDN_BASE}/checkmark-success.json`,\n \"https://lottie.host/6f831c6e-693a-4d1d-90a0-d7e2b3f00e68/PFj0MwSPrj.json\": `${CDN_BASE}/arrow-pointer.json`,\n // Ambient / Decorative\n \"https://lottie.host/9c8e1aef-f8e5-4ce8-bc80-1647ffb0724d/mNDClfKJVB.json\": `${CDN_BASE}/floating-particles.json`,\n \"https://lottie.host/b5d3e7e7-40bc-44fa-9a53-78b98ad66e80/pQVdNsVDmQ.json\": `${CDN_BASE}/glowing-ring.json`,\n}\n\n/**\n * Resolve an overlay `src` through the legacy remap: a dead lottie.host URL is\n * rewritten to its self-hosted replacement; everything else (already-migrated\n * catalog URLs, user-provided assets) passes through unchanged.\n */\nexport function resolveLottieOverlaySrc(src: string): string {\n return LEGACY_LOTTIE_HOST_REMAP[src] ?? src\n}\n","/**\n * Audio FX node — preset id union (single source of truth).\n *\n * Shared so the backend Zod route enum, the frontend config dropdown, and the\n * `AudioFxData` node type can't drift. The per-preset FFmpeg filter chains\n * (IR DUR/SHAPE, delay/EQ knobs) live in the backend provider's PRESET_CHAINS\n * map — this file only fixes the id set + their human labels.\n *\n * Reverb presets are named by ON-SCREEN SCENARIO (where the voice is happening\n * in the scene) rather than abstract size, so a creator picking \"Church\" or\n * \"Car\" gets a believable space for that shot.\n */\n\nexport const AUDIO_FX_PRESETS = [\n // — reverb / spaces (afir + inline-synth IR), ordered small → large —\n \"room\", // ordinary indoor room — bedroom / office dialogue\n \"bathroom\", // small, bright, tiled — hard early reflections\n \"car\", // tight, very damped cabin\n \"hall\", // lobby / corridor / large room\n \"concert-hall\", // big, lush, musical tail\n \"church\", // cathedral — long, dark, reverberant\n \"cave\", // dark, diffuse, long\n \"arena\", // stadium / PA — huge, bright tail\n \"outdoor\", // open air — almost dry, faint early reflections\n // — character / non-reverb —\n \"telephone\", // band-limited phone line\n \"megaphone\", // PA / bullhorn — mid-forward + light grit\n \"echo\", // discrete echo / slap-back\n \"custom\", // manual: reverb wet · delay · EQ\n] as const\n\nexport type AudioFxPreset = (typeof AUDIO_FX_PRESETS)[number]\n\nexport const AUDIO_FX_PRESET_SET: ReadonlySet<string> = new Set(AUDIO_FX_PRESETS)\n\n/** Display labels for the config dropdown. */\nexport const AUDIO_FX_PRESET_LABELS: Record<AudioFxPreset, string> = {\n room: \"Room (indoor)\",\n bathroom: \"Bathroom\",\n car: \"Car interior\",\n hall: \"Hall / Lobby\",\n \"concert-hall\": \"Concert Hall\",\n church: \"Church\",\n cave: \"Cave\",\n arena: \"Arena / Stadium\",\n outdoor: \"Outdoor (open air)\",\n telephone: \"Telephone\",\n megaphone: \"Megaphone / PA\",\n echo: \"Echo / Slap-back\",\n custom: \"Custom\",\n}\n\n/** Presets that apply convolution reverb (afir + inline-synth IR). */\nexport const AUDIO_FX_REVERB_PRESETS: ReadonlySet<AudioFxPreset> = new Set<AudioFxPreset>([\n \"room\",\n \"bathroom\",\n \"car\",\n \"hall\",\n \"concert-hall\",\n \"church\",\n \"cave\",\n \"arena\",\n \"outdoor\",\n])\n","/**\n * Video Mask — text-prompted video segmentation (SAM 3.1 / SAM 3). The wire contract of\n * the `video-mask` node, `POST /v1/video-mask`, the `video_mask` MCP verb,\n * `client.media.videoMask` and `nodaro media video-mask`, defined ONCE:\n * - every bound the route schema, the node panel and the MCP verb read;\n * - `videoMaskBilledSeconds`: the length a run is priced at — the clip's\n * length at the 30 fps basis, so a 60 fps clip is priced at twice its\n * length (the segmentation works per FRAME);\n * - `videoMaskCreditId`: which price row (`model_pricing`) that length is\n * charged from. The credit amounts live in the rows, never here.\n *\n * Worked examples (repeated in docs/nodes/ai-video/video-mask.md):\n * 4 s at 30 fps → `sam-3.1-video:5s`, 12 s at 24 fps → `sam-3.1-video:15s`,\n * 10 s at 60 fps (priced as 20 s) → `sam-3.1-video:30s`, 45 s at 30 fps → `sam-3.1-video:60s`,\n * 100 s at 30 fps → `sam-3.1-video:120s`, 4 min at 30 fps on SAM 3 → `sam-3-video:240s`.\n *\n * Wire contract only — no I/O.\n */\n\n/** Segmentation models a Video Mask run can use. SAM 3.1 (the default)\n * tracks several objects in one pass and runs faster; SAM 3 costs half. */\nexport const VIDEO_MASK_PROVIDERS = [\"sam-3.1\", \"sam-3\"] as const\nexport type VideoMaskProvider = (typeof VIDEO_MASK_PROVIDERS)[number]\nexport const DEFAULT_VIDEO_MASK_PROVIDER: VideoMaskProvider = \"sam-3.1\"\n\n/**\n * `zone`: keep only the subjects whose bounding-box CENTRE lies inside an\n * inner rectangle, given as margins in % of the frame (each\n * `VIDEO_MASK_LIMITS.ZONE_MARGIN_PCT_MIN`–`ZONE_MARGIN_PCT_MAX`). All zero, or\n * no zone, = off.\n */\nexport interface VideoMaskZone {\n readonly leftPct: number\n readonly rightPct: number\n readonly topPct: number\n readonly bottomPct: number\n}\n\n/** A new Video Mask node's settings — spread into its node definition. */\nexport const VIDEO_MASK_DEFAULTS = {\n threshold: 0.5,\n provider: \"sam-3.1\" as VideoMaskProvider,\n /** Off: the mask is the model's, frame for frame (see `HOLD_EMPTY_BELOW_FRACTION`). */\n holdLastMask: false,\n /** 0 = off: every region the model finds is kept (see `MIN_SUBJECT_HEIGHT_PCT_*`). */\n minSubjectHeightPct: 0,\n /** 0 = off: no ceiling on a region's height (see `MAX_SUBJECT_HEIGHT_PCT_*`). */\n maxSubjectHeightPct: 0,\n /** Off: subjects anywhere in the frame are kept (see `ZONE_MARGIN_PCT_*`). */\n zone: null as VideoMaskZone | null,\n /**\n * Off: one pass over the whole clip. On: the clip's scene cuts are found\n * first and each shot is segmented on its own — the model starts afresh\n * after every cut (finding the new shot's subjects), and `holdLastMask`\n * never carries a mask across a cut. A clip with no cut (a flash is\n * usually not one) is one shot: the same mask, fitted to the clip's exact\n * frame count.\n */\n perShot: false,\n /**\n * 0 = off: a new detection only where a request starts anyway (the clip's\n * start, every 1,800 frames, and every cut with `perShot`). Above 0: the\n * model is also sent a new request every this many seconds of footage, so a\n * subject that first appears mid-shot is found within that time (see\n * `REDETECT_EVERY_SEC_*`). These boundaries are not cuts: `holdLastMask`\n * keeps holding across them.\n */\n redetectEverySec: 0,\n} as const\n\nexport const VIDEO_MASK_LIMITS = {\n /** The longest input clip a run accepts, in seconds of PRICED length (see `videoMaskBilledSeconds`). */\n MAX_BILLED_SEC: 300,\n /** Frame rate the price rows assume. A faster clip is priced proportionally longer. */\n FPS_BASIS: 30,\n /** Subject description length cap. */\n PROMPT_MAX_LENGTH: 500,\n /** Detection confidence bounds (the model's own range, narrowed to useful values). */\n THRESHOLD_MIN: 0.05,\n THRESHOLD_MAX: 0.95,\n THRESHOLD_STEP: 0.05,\n /** Default detection confidence. Lower finds more (and less precise) regions. */\n THRESHOLD_DEFAULT: VIDEO_MASK_DEFAULTS.threshold,\n /**\n * `holdLastMask`: a frame whose mask covers less than this fraction of the\n * picture (0.002 % — about 41 px at 1080p: a stray speck, never a subject) counts as empty — the subject lost (hidden behind a\n * hand, turned away) — and shows the most recent non-empty frame's mask\n * instead. Frames before the first detection stay as they are.\n */\n HOLD_EMPTY_BELOW_FRACTION: 0.00002,\n /**\n * `holdLastMask`: the longest a mask is held, in seconds of frames (at the\n * clip's rate). The hold is for a subject hidden for a moment; a run of\n * empty frames longer than this shows the held mask for its first second\n * and then nothing, until the model finds the subject again — a mask held\n * on for longer sits where the subject no longer is.\n */\n HOLD_MAX_SEC: 1,\n /**\n * `minSubjectHeightPct`: drop every connected white region (8-connected)\n * whose bounding box is shorter than this % of the frame height — extras'\n * small faces behind the main subject. 0 = off. Applied before\n * `holdLastMask`, so a frame left with only small regions counts as empty\n * and is held from the last frame with a big subject.\n */\n MIN_SUBJECT_HEIGHT_PCT_MIN: 0,\n MIN_SUBJECT_HEIGHT_PCT_MAX: 100,\n /**\n * `maxSubjectHeightPct`, the mirror: drop every region whose bounding box is\n * TALLER than this % of the frame height (keep only the small subjects — a\n * paste-back mask of the background faces). 0 = off. With both set, a\n * region is kept when min ≤ height ≤ max (min > max is refused). Same pass,\n * same order (before `holdLastMask`).\n */\n MAX_SUBJECT_HEIGHT_PCT_MIN: 0,\n MAX_SUBJECT_HEIGHT_PCT_MAX: 100,\n /**\n * `zone` margins (left / right / top / bottom, % of the frame width or\n * height): drop every connected region whose bounding-box centre lies\n * outside `[w·left/100, w·(1−right/100)] × [h·top/100, h·(1−bottom/100)]`\n * — the faces at the edges of the picture. At most 49 % a side, so the\n * inner rectangle is never empty. Applied after the size cut and before\n * `holdLastMask`, so a frame left with nothing inside counts as empty.\n */\n ZONE_MARGIN_PCT_MIN: 0,\n ZONE_MARGIN_PCT_MAX: 49,\n /**\n * `redetectEverySec`: 0 (off) or `REDETECT_EVERY_SEC_MIN`–`MAX` seconds. The\n * model picks up its subjects near the start of each request; a face that\n * turns to the camera, or a person who walks in, partway through a request is\n * never masked. On, the clip (each shot, with `perShot`) is cut into requests\n * of at most this many seconds of frames — counted from the shot's start, a\n * last piece shorter than `VIDEO_MASK_MIN_SHOT_FRAMES` joining the one before\n * — so the subjects are detected again at every such boundary. Each request\n * adds wall time (they run three at a time); the price follows the clip's\n * length and does not change.\n */\n REDETECT_EVERY_SEC_MIN: 1,\n REDETECT_EVERY_SEC_MAX: 10,\n /** The panel's step (the API takes any value in range). */\n REDETECT_EVERY_SEC_STEP: 1,\n} as const\n\n/**\n * The version of what a Video Mask run's mask looks like for a given clip and\n * settings: every finished `video-mask` job reports it as `output_data.recipe`.\n * A mask stored ahead of time and reused (a trend's approved face mask) is\n * held to it, and reads as out of date once it changes.\n *\n * BUMP IT (to the date of the change) whenever the algorithm changes the mask\n * a run produces from the same clip and settings: the cut rule (`perShot`),\n * the hold (`holdLastMask`, `HOLD_*`), the size and zone filters, the\n * rendering. Never for a change that leaves every mask the same (pricing,\n * limits on what is accepted, messages). `\"2026-10-25\"`: the lone-spike cut\n * rule and the 1 s hold cap.\n */\nexport const VIDEO_MASK_RECIPE = \"2026-10-25\"\n\nconst VIDEO_MASK_BUCKETS_SEC = [5, 10, 15, 30, 60, 90, 120, 180, 240, 300] as const\n\n/** Every price row a provider can be charged from, smallest first. */\nexport function videoMaskCreditIds(provider: VideoMaskProvider = DEFAULT_VIDEO_MASK_PROVIDER): string[] {\n return VIDEO_MASK_BUCKETS_SEC.map((sec) => `${provider}-video:${sec}s`)\n}\n\n/**\n * The length a clip is priced at: its duration at the 30 fps basis. A clip\n * at or under 30 fps is priced at its own length; a 60 fps clip at twice it.\n * An unknown frame rate counts as the basis.\n */\nexport function videoMaskBilledSeconds(durationSec: number, fps?: number | null): number {\n const rate = typeof fps === \"number\" && Number.isFinite(fps) && fps > 0 ? fps : VIDEO_MASK_LIMITS.FPS_BASIS\n return durationSec * Math.max(1, rate / VIDEO_MASK_LIMITS.FPS_BASIS)\n}\n\n/**\n * The price row for a clip priced at `billedSec` seconds. An unknown or\n * non-positive length prices the LONGEST row (a clip the route could not\n * measure is refused, so this is only the pre-run quote for a clip whose\n * length is not known yet); anything past the cap prices the last row.\n */\nexport function videoMaskCreditId(\n billedSec: number | null | undefined,\n provider: VideoMaskProvider = DEFAULT_VIDEO_MASK_PROVIDER,\n): string {\n const ids = videoMaskCreditIds(provider)\n if (typeof billedSec !== \"number\" || !Number.isFinite(billedSec) || billedSec <= 0) return ids[ids.length - 1]!\n const i = VIDEO_MASK_BUCKETS_SEC.findIndex((b) => billedSec <= b)\n return ids[i === -1 ? ids.length - 1 : i]!\n}\n\n/** Narrow an arbitrary value to a known provider, falling back to the default. */\nexport function resolveVideoMaskProvider(value: unknown): VideoMaskProvider {\n return (VIDEO_MASK_PROVIDERS as readonly string[]).includes(value as string)\n ? (value as VideoMaskProvider)\n : DEFAULT_VIDEO_MASK_PROVIDER\n}\n\n/**\n * A zone as the region filter reads it: each margin a finite number clamped\n * to `ZONE_MARGIN_PCT_MIN`–`ZONE_MARGIN_PCT_MAX` (anything else is 0), and\n * null when there is no zone or every margin is 0 (off). The one reading\n * shared by the worker, a workflow run's payload and the node's own run.\n */\nexport function resolveVideoMaskZone(value: unknown): VideoMaskZone | null {\n if (!value || typeof value !== \"object\") return null\n const v = value as Record<string, unknown>\n const margin = (x: unknown) =>\n typeof x === \"number\" && Number.isFinite(x)\n ? Math.min(VIDEO_MASK_LIMITS.ZONE_MARGIN_PCT_MAX, Math.max(VIDEO_MASK_LIMITS.ZONE_MARGIN_PCT_MIN, x))\n : 0\n const zone = { leftPct: margin(v.leftPct), rightPct: margin(v.rightPct), topPct: margin(v.topPct), bottomPct: margin(v.bottomPct) }\n return zone.leftPct > 0 || zone.rightPct > 0 || zone.topPct > 0 || zone.bottomPct > 0 ? zone : null\n}\n\n/**\n * `redetectEverySec` as a run reads it: a finite number above 0 clamped to\n * `REDETECT_EVERY_SEC_MIN`–`MAX` (a value between 0 and the minimum snaps up\n * to it — it asked for re-detection); anything else (absent, 0, negative,\n * not a number) is 0 = off. The one reading shared by the worker, a workflow\n * run's payload, the node's own run and its panel (the route refuses a value\n * out of range instead).\n */\nexport function resolveVideoMaskRedetectSec(value: unknown): number {\n if (typeof value !== \"number\" || !Number.isFinite(value) || value <= 0) return 0\n return Math.min(VIDEO_MASK_LIMITS.REDETECT_EVERY_SEC_MAX, Math.max(VIDEO_MASK_LIMITS.REDETECT_EVERY_SEC_MIN, value))\n}\n\n/** `POST /v1/video-mask` request body. */\nexport interface VideoMaskRequest {\n /** The clip to segment. */\n readonly videoUrl: string\n /** What to track: a short noun phrase; separate several with commas. */\n readonly prompt: string\n /** Detection confidence, `VIDEO_MASK_LIMITS.THRESHOLD_MIN`–`THRESHOLD_MAX` (default 0.5). */\n readonly threshold?: number\n readonly provider?: VideoMaskProvider\n /** Hold the last mask where the subject is lost (default false): an empty frame\n * after the first detection repeats the most recent non-empty one. */\n readonly holdLastMask?: boolean\n /** Ignore subjects smaller than this % of the frame height, 0–100 (default 0 = off):\n * connected regions whose bounding box is shorter are dropped from every frame. */\n readonly minSubjectHeightPct?: number\n /** Ignore subjects larger than this % of the frame height, 0–100 (default 0 = off):\n * connected regions whose bounding box is taller are dropped from every frame. */\n readonly maxSubjectHeightPct?: number\n /** Keep only the subjects whose bounding-box centre is inside these margins, each\n * 0–49 % of the frame (a margin left out is 0). null / omitted / all 0 = off. */\n readonly zone?: Partial<VideoMaskZone> | null\n /** Segment each shot on its own (default false): the clip's scene cuts are found\n * first and the subjects are detected again in every shot; `holdLastMask` never\n * carries a mask across a cut. The output then carries `shots`. */\n readonly perShot?: boolean\n /** Detect the subjects again every this many seconds (0 = off, the default, or\n * `VIDEO_MASK_LIMITS.REDETECT_EVERY_SEC_MIN`–`MAX`): the clip — each shot, with\n * `perShot` — is sent to the model in pieces of at most that length, so a subject\n * that first appears mid-shot is masked from the next boundary on. Not a cut:\n * `holdLastMask` holds across these boundaries. Slower (more requests); same price. */\n readonly redetectEverySec?: number\n}\n","/**\n * Generate Mask — text-prompted IMAGE segmentation (Grounded SAM). The wire\n * contract of `POST /v1/generate-mask`, the `generate_mask` MCP verb, the SDK's\n * `nodes.run(\"generate-mask\", …)` and `nodaro media generate-mask`, defined ONCE:\n * every bound the route schema and the SDK/CLI read.\n *\n * The finished job's output is `{ maskUrl, imageUrl }`: `maskUrl` is the\n * black-and-white mask PNG (white = the subject), `imageUrl` is the SOURCE\n * image passed through unchanged, so an inpainting step can take the pair.\n *\n * Wire contract only — no I/O.\n */\n\nexport const GENERATE_MASK_LIMITS = {\n /** Subject description length cap. */\n PROMPT_MAX_LENGTH: 500,\n /** Segmentation confidence bounds. */\n THRESHOLD_MIN: 0,\n THRESHOLD_MAX: 1,\n /** Default segmentation confidence. Lower selects more (and less precise) regions. */\n THRESHOLD_DEFAULT: 0.3,\n} as const\n\n/** `POST /v1/generate-mask` request body. */\nexport interface GenerateMaskRequest {\n /** The image to segment. */\n readonly imageUrl: string\n /** What to select, in plain words (e.g. \"the person\", \"sky and clouds\"). 1–500 characters. */\n readonly prompt: string\n /** Segmentation confidence, `GENERATE_MASK_LIMITS.THRESHOLD_MIN`–`THRESHOLD_MAX` (default 0.3). */\n readonly threshold?: number\n}\n\n/** A completed Generate Mask job's `output_data`. */\nexport interface GenerateMaskOutput {\n /** The mask: a black-and-white PNG, white = the subject. */\n readonly maskUrl: string\n /** The source image, passed through unchanged. */\n readonly imageUrl: string\n}\n","/**\n * Mask Composite — place a foreground video over a background video through a\n * mask video (white = keep the foreground, black = show the background). The\n * wire contract of the `mask-composite` node, `POST /v1/mask-composite`, the\n * `mask_composite` MCP verb, `client.media.maskComposite` and\n * `nodaro media mask-composite`, defined ONCE. Pair it with Video Mask, whose\n * output is exactly such a mask.\n *\n * The render follows the FOREGROUND: its size, frame rate and length. The\n * background is fitted to that frame (`backgroundFit`) and loops when shorter;\n * the mask is stretched to the frame and holds its last frame when shorter.\n *\n * `fill` picks what fills the masked area. `\"video\"` (the default) is the\n * foreground, as above. `\"pixelate\"` and `\"blur\"` fill it with the BACKGROUND\n * itself, pixelated or blurred: there is no foreground then (a sent\n * `foregroundUrl` is ignored), so the render follows the BACKGROUND (its size,\n * frame rate and length; `backgroundFit` has nothing to fit), and the run is\n * priced on the background's length. With no foreground the result always\n * carries the background's sound — `audioSource` is ignored there\n * ({@link maskCompositeEffectiveAudioSource}); the canvas hides the control.\n *\n * Priced per started 5 seconds of the result (the foreground's length), like\n * Trim / Loop / Combine Videos: the node's own `model_pricing` row is ONE unit\n * (`maskCompositeUnits` counts them). Worked examples (repeated in\n * docs/nodes/processing-video/mask-composite.md, at the 10-credit row):\n * 3 s → 1 unit (10), 10 s → 2 units (20), 61 s → 13 units (130), 5 min → 60 units (600).\n *\n * Wire contract only — no I/O.\n */\n\n/** How the background is fitted to the foreground's frame. */\nexport const MASK_COMPOSITE_BACKGROUND_FITS = [\"cover\", \"contain\", \"stretch\"] as const\nexport type MaskCompositeBackgroundFit = (typeof MASK_COMPOSITE_BACKGROUND_FITS)[number]\n\n/** What fills the masked area: the foreground video, or the background itself pixelated or blurred. */\nexport const MASK_COMPOSITE_FILLS = [\"video\", \"pixelate\", \"blur\"] as const\nexport type MaskCompositeFill = (typeof MASK_COMPOSITE_FILLS)[number]\n\n/** Which sound the result carries. `mix` blends both tracks at equal level. */\nexport const MASK_COMPOSITE_AUDIO_SOURCES = [\"foreground\", \"background\", \"mix\", \"none\"] as const\nexport type MaskCompositeAudioSource = (typeof MASK_COMPOSITE_AUDIO_SOURCES)[number]\n\nexport const MASK_COMPOSITE_BOUNDS = {\n /** Edge softening, pixels of blur radius on the mask (0 = hard edge). */\n FEATHER_MIN: 0,\n FEATHER_MAX: 20,\n /** Grow (+) or shrink (−) the white region, pixels. */\n GROW_MIN: -10,\n GROW_MAX: 10,\n /** How strongly the foreground covers the background inside the mask\n * (1 = fully, today's output; 0 = not at all). */\n OPACITY_MIN: 0,\n OPACITY_MAX: 1,\n /** Pixelate: the block size as a % of the frame's WIDTH (relative, so a\n * setting looks the same at any resolution); the worker makes the blocks\n * max(2, round(width × pct / 100)) px. 1.25 % = 16 px on a 1280-wide frame. */\n PIXEL_SIZE_PCT_MIN: 0.2,\n PIXEL_SIZE_PCT_MAX: 10,\n /** Blur: the gaussian's sigma as a % of the frame's WIDTH (2 % ≈ sigma 25 px on a 1280-wide frame). */\n BLUR_STRENGTH_PCT_MIN: 0.1,\n BLUR_STRENGTH_PCT_MAX: 5,\n /** The longest leading video (the foreground; the background when `fill` is not video) a run accepts, seconds. */\n MAX_DURATION_SEC: 300,\n} as const\n\n/** Seconds of result one pricing unit covers. */\nexport const MASK_COMPOSITE_UNIT_SEC = 5\n\n/**\n * Pricing units for a result `durationSec` long: one per started 5 seconds,\n * at least one. An unknown length counts the longest result a run accepts\n * (an upper bound — the pre-run quote for a clip whose length is not known\n * yet; every run measures its foreground).\n */\nexport function maskCompositeUnits(durationSec: number | null | undefined): number {\n const sec =\n typeof durationSec === \"number\" && Number.isFinite(durationSec) && durationSec > 0\n ? Math.min(durationSec, MASK_COMPOSITE_BOUNDS.MAX_DURATION_SEC)\n : MASK_COMPOSITE_BOUNDS.MAX_DURATION_SEC\n // The epsilon absorbs float noise (a 10.0000001 s probe is 2 units, not 3).\n return Math.max(1, Math.ceil(sec / MASK_COMPOSITE_UNIT_SEC - 1e-6))\n}\n\nexport const MASK_COMPOSITE_DEFAULTS = {\n invertMask: false,\n feather: 2,\n grow: 0,\n opacity: 1,\n fill: \"video\" as MaskCompositeFill,\n pixelSizePct: 1.25,\n blurStrengthPct: 2,\n backgroundFit: \"cover\" as MaskCompositeBackgroundFit,\n audioSource: \"foreground\" as MaskCompositeAudioSource,\n} as const\n\nexport interface MaskCompositeSettings {\n readonly invertMask: boolean\n readonly feather: number\n readonly grow: number\n /** Inside the mask: opacity × foreground + (1 − opacity) × background. */\n readonly opacity: number\n /** What fills the masked area (`video` = the foreground). */\n readonly fill: MaskCompositeFill\n /** Pixelate block size, % of the frame width (used when `fill` is `pixelate`). */\n readonly pixelSizePct: number\n /** Blur strength: the gaussian's sigma as a % of the frame width (used when `fill` is `blur`). */\n readonly blurStrengthPct: number\n readonly backgroundFit: MaskCompositeBackgroundFit\n readonly audioSource: MaskCompositeAudioSource\n}\n\nconst clampInt = (v: unknown, min: number, max: number, fallback: number): number =>\n typeof v === \"number\" && Number.isFinite(v) ? Math.min(max, Math.max(min, Math.round(v))) : fallback\n\nconst clampNumber = (v: unknown, min: number, max: number, fallback: number): number =>\n typeof v === \"number\" && Number.isFinite(v) ? Math.min(max, Math.max(min, v)) : fallback\n\n/**\n * Node data (or any loose object) → settings every engine renders with.\n * Unknown enum values fall back to the default and numbers are clamped, so a\n * node written straight into workflow JSON renders the same as one set in the\n * panel. The ONE normaliser both workflow engines and the worker call.\n */\nexport function resolveMaskCompositeSettings(data: Readonly<Record<string, unknown>>): MaskCompositeSettings {\n const d = MASK_COMPOSITE_DEFAULTS\n const b = MASK_COMPOSITE_BOUNDS\n return {\n invertMask: typeof data.invertMask === \"boolean\" ? data.invertMask : d.invertMask,\n feather: clampInt(data.feather, b.FEATHER_MIN, b.FEATHER_MAX, d.feather),\n grow: clampInt(data.grow, b.GROW_MIN, b.GROW_MAX, d.grow),\n opacity: clampNumber(data.opacity, b.OPACITY_MIN, b.OPACITY_MAX, d.opacity),\n fill: maskCompositeFillOf(data),\n pixelSizePct: clampNumber(data.pixelSizePct, b.PIXEL_SIZE_PCT_MIN, b.PIXEL_SIZE_PCT_MAX, d.pixelSizePct),\n blurStrengthPct: clampNumber(data.blurStrengthPct, b.BLUR_STRENGTH_PCT_MIN, b.BLUR_STRENGTH_PCT_MAX, d.blurStrengthPct),\n backgroundFit: (MASK_COMPOSITE_BACKGROUND_FITS as readonly string[]).includes(data.backgroundFit as string)\n ? (data.backgroundFit as MaskCompositeBackgroundFit)\n : d.backgroundFit,\n audioSource: (MASK_COMPOSITE_AUDIO_SOURCES as readonly string[]).includes(data.audioSource as string)\n ? (data.audioSource as MaskCompositeAudioSource)\n : d.audioSource,\n }\n}\n\n/** The fill a node, payload or request body asks for: an unknown value is `video` (the default). */\nexport function maskCompositeFillOf(data: Readonly<Record<string, unknown>> | null | undefined): MaskCompositeFill {\n const f = data?.fill\n return (MASK_COMPOSITE_FILLS as readonly string[]).includes(f as string) ? (f as MaskCompositeFill) : MASK_COMPOSITE_DEFAULTS.fill\n}\n\n/** Does this fill take a foreground video? Only `video` does; pixelate and blur fill from the background. */\nexport function maskCompositeUsesForeground(fill: MaskCompositeFill): boolean {\n return fill === \"video\"\n}\n\n/**\n * The input whose size, rate and length the result has (and so the one a run\n * is measured and priced on): the canvas handle — `video` (the foreground) for\n * the video fill, `background-video` for pixelate and blur. The one rule the\n * route, the workflow run, the run estimates and the length walks read.\n */\nexport function maskCompositeLeadHandle(data: Readonly<Record<string, unknown>> | null | undefined): \"video\" | \"background-video\" {\n return maskCompositeUsesForeground(maskCompositeFillOf(data)) ? \"video\" : \"background-video\"\n}\n\n/**\n * The sound a render actually carries. With no foreground (pixelate / blur) it\n * is ALWAYS the background's — the only track there is — whatever\n * `audioSource` says (the canvas hides that control for these fills, so a\n * stored `none` from the Video fill can never silently mute the result).\n */\nexport function maskCompositeEffectiveAudioSource(s: Pick<MaskCompositeSettings, \"fill\" | \"audioSource\">): MaskCompositeAudioSource {\n if (maskCompositeUsesForeground(s.fill)) return s.audioSource\n return \"background\"\n}\n\n/** `POST /v1/mask-composite` request body. */\nexport interface MaskCompositeRequest extends Partial<MaskCompositeSettings> {\n /** The video whose white-masked region is kept (its size, rate and length lead).\n * Required when `fill` is `video` (the default); not used by `pixelate` / `blur`. */\n readonly foregroundUrl?: string\n /** The video shown where the mask is black. */\n readonly backgroundUrl: string\n /** The mask video — white = foreground (Video Mask's output). */\n readonly maskUrl: string\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkADYPAGQF_cjs = require('./chunk-ADYPAGQF.cjs');
3
+ var chunkRPQ2KF6L_cjs = require('./chunk-RPQ2KF6L.cjs');
4
4
 
5
5
  // src/tts-capabilities.ts
6
6
  var TTS_PROVIDER_ALIASES = {
@@ -13,12 +13,12 @@ function canonicalTtsProvider(provider) {
13
13
  function findTtsCapabilities(provider) {
14
14
  if (typeof provider !== "string" || !provider) return void 0;
15
15
  const id = canonicalTtsProvider(provider);
16
- if (!Object.hasOwn(chunkADYPAGQF_cjs.MODEL_CATALOG, id)) return void 0;
17
- const entry = chunkADYPAGQF_cjs.MODEL_CATALOG[id];
16
+ if (!Object.hasOwn(chunkRPQ2KF6L_cjs.MODEL_CATALOG, id)) return void 0;
17
+ const entry = chunkRPQ2KF6L_cjs.MODEL_CATALOG[id];
18
18
  return entry.modes.includes("tts") ? entry.tts : void 0;
19
19
  }
20
20
  function getTtsCapabilities(provider) {
21
- return findTtsCapabilities(provider) ?? chunkADYPAGQF_cjs.MODEL_CATALOG[TTS_FALLBACK_PROVIDER].tts;
21
+ return findTtsCapabilities(provider) ?? chunkRPQ2KF6L_cjs.MODEL_CATALOG[TTS_FALLBACK_PROVIDER].tts;
22
22
  }
23
23
  function ttsSupportsAudioTags(provider) {
24
24
  return getTtsCapabilities(provider).audioTags;
@@ -50,5 +50,5 @@ exports.ttsSupportsAudioTags = ttsSupportsAudioTags;
50
50
  exports.ttsSupportsSsmlBreaks = ttsSupportsSsmlBreaks;
51
51
  exports.ttsSupportsStitching = ttsSupportsStitching;
52
52
  exports.ttsSupportsTimestamps = ttsSupportsTimestamps;
53
- //# sourceMappingURL=chunk-JN3V33AN.cjs.map
54
- //# sourceMappingURL=chunk-JN3V33AN.cjs.map
53
+ //# sourceMappingURL=chunk-QJ2VGB5J.cjs.map
54
+ //# sourceMappingURL=chunk-QJ2VGB5J.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/tts-capabilities.ts"],"names":["MODEL_CATALOG"],"mappings":";;;;;AAkBO,IAAM,oBAAA,GAAyD;AAAA,EACpE,UAAA,EAAY;AACd;AAGO,IAA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CAAA,CAAE,UAAA;AACtC;AAGO,SAAS,iBAAiB,QAAA,EAAiD;AAChF,EAAA,OAAO,kBAAA,CAAmB,QAAQ,CAAA,CAAE,SAAA;AACtC","file":"chunk-JN3V33AN.cjs","sourcesContent":["/**\n * Capability lookups for the text-to-speech lane.\n *\n * Every \"does this model do X\" decision on that lane reads the model's `tts`\n * sheet in `MODEL_CATALOG` through these helpers — tag stripping, which voice\n * settings are sent and shown, the language picker, whether neighbouring text\n * is sent. Declare the sheet honestly\n * on the catalog entry and a new model is covered everywhere; do not compare a\n * provider id by hand.\n *\n * \"The text-to-speech lane\" means the models that list the `tts` mode. The\n * dialogue models carry a sheet too, read by `dialogue-capabilities.ts`; a\n * text-to-speech request that names one runs as the fallback model, so these\n * helpers answer for the fallback there.\n */\nimport { MODEL_CATALOG, type TtsCapabilities, type TtsSettingLever } from \"./model-catalog.js\"\n\n/** Legacy provider ids that are another model under an old name. They have no catalog entry of their own. */\nexport const TTS_PROVIDER_ALIASES: Readonly<Record<string, string>> = {\n elevenlabs: \"elevenlabs-turbo\",\n}\n\n/** The model a request runs on when its provider id is missing or unknown. */\nexport const TTS_FALLBACK_PROVIDER = \"elevenlabs-turbo\"\n\n/**\n * Resolve a legacy alias to the catalog id it runs as. Any other id passes\n * through unchanged. Own properties only: an id that happens to be the name of\n * an inherited object member (`constructor`, `__proto__`, `toString`) is an\n * unknown id like any other, never a function.\n */\nexport function canonicalTtsProvider(provider: string): string {\n return typeof provider === \"string\" && Object.hasOwn(TTS_PROVIDER_ALIASES, provider) ? TTS_PROVIDER_ALIASES[provider]! : provider\n}\n\n/** The capability sheet of a text-to-speech model, or `undefined` when the id is not one. */\nexport function findTtsCapabilities(provider: string | undefined): TtsCapabilities | undefined {\n // `typeof`: node data can be written straight into workflow JSON, so the \"string\" is not guaranteed — and\n // `Object.hasOwn` would coerce an array like [\"elevenlabs-v3\"] into that model's id. A non-string is an unknown id.\n if (typeof provider !== \"string\" || !provider) return undefined\n const id = canonicalTtsProvider(provider)\n if (!Object.hasOwn(MODEL_CATALOG, id)) return undefined\n const entry = MODEL_CATALOG[id]!\n return entry.modes.includes(\"tts\") ? entry.tts : undefined\n}\n\n/**\n * The capability sheet a text-to-speech request will actually run under: a\n * missing or unknown provider id runs as {@link TTS_FALLBACK_PROVIDER}, so it\n * gets that sheet — including its `maxChars` (turbo's 40,000), where\n * `getMaxTtsChars` keeps answering its 5,000 default for such ids.\n */\nexport function getTtsCapabilities(provider: string | undefined): TtsCapabilities {\n return findTtsCapabilities(provider) ?? MODEL_CATALOG[TTS_FALLBACK_PROVIDER]!.tts!\n}\n\n/** The model performs inline `[audio tags]`. false ⇒ strip them before sending. */\nexport function ttsSupportsAudioTags(provider: string | undefined): boolean {\n return getTtsCapabilities(provider).audioTags\n}\n\n/** The model honours SSML `<break time=\"…\"/>` tags. */\nexport function ttsSupportsSsmlBreaks(provider: string | undefined): boolean {\n return getTtsCapabilities(provider).ssmlBreaks\n}\n\n/**\n * The model conditions on neighbouring text (`previous_text` / `next_text`).\n * false ⇒ the provider funnel never puts the fields on the wire, whatever the\n * request carries — the model would reject them.\n */\nexport function ttsSupportsStitching(provider: string | undefined): boolean {\n return getTtsCapabilities(provider).stitching\n}\n\n/** The model honours this voice-setting lever. */\nexport function ttsHasLever(provider: string | undefined, lever: TtsSettingLever): boolean {\n return getTtsCapabilities(provider).levers.includes(lever)\n}\n\n/** The model answers `/v1/text-to-speech/{voice}/with-timestamps` (character timings). */\nexport function ttsSupportsTimestamps(provider: string | undefined): boolean {\n return getTtsCapabilities(provider).timestamps\n}\n\n/** Language codes offered for the model, in catalog order. */\nexport function ttsLanguageCodes(provider: string | undefined): readonly string[] {\n return getTtsCapabilities(provider).languages\n}\n"]}
1
+ {"version":3,"sources":["../src/tts-capabilities.ts"],"names":["MODEL_CATALOG"],"mappings":";;;;;AAkBO,IAAM,oBAAA,GAAyD;AAAA,EACpE,UAAA,EAAY;AACd;AAGO,IAAM,qBAAA,GAAwB;AAQ9B,SAAS,q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AS,iBAAiB,QAAA,EAAiD;AAChF,EAAA,OAAO,kBAAA,CAAmB,QAAQ,CAAA,CAAE,SAAA;AACtC","file":"chunk-QJ2VGB5J.cjs","sourcesContent":["/**\n * Capability lookups for the text-to-speech lane.\n *\n * Every \"does this model do X\" decision on that lane reads the model's `tts`\n * sheet in `MODEL_CATALOG` through these helpers — tag stripping, which voice\n * settings are sent and shown, the language picker, whether neighbouring text\n * is sent. Declare the sheet honestly\n * on the catalog entry and a new model is covered everywhere; do not compare a\n * provider id by hand.\n *\n * \"The text-to-speech lane\" means the models that list the `tts` mode. The\n * dialogue models carry a sheet too, read by `dialogue-capabilities.ts`; a\n * text-to-speech request that names one runs as the fallback model, so these\n * helpers answer for the fallback there.\n */\nimport { MODEL_CATALOG, type TtsCapabilities, type TtsSettingLever } from \"./model-catalog.js\"\n\n/** Legacy provider ids that are another model under an old name. They have no catalog entry of their own. */\nexport const TTS_PROVIDER_ALIASES: Readonly<Record<string, string>> = {\n elevenlabs: \"elevenlabs-turbo\",\n}\n\n/** The model a request runs on when its provider id is missing or unknown. */\nexport const TTS_FALLBACK_PROVIDER = \"elevenlabs-turbo\"\n\n/**\n * Resolve a legacy alias to the catalog id it runs as. Any other id passes\n * through unchanged. Own properties only: an id that happens to be the name of\n * an inherited object member (`constructor`, `__proto__`, `toString`) is an\n * unknown id like any other, never a function.\n */\nexport function canonicalTtsProvider(provider: string): string {\n return typeof provider === \"string\" && Object.hasOwn(TTS_PROVIDER_ALIASES, provider) ? TTS_PROVIDER_ALIASES[provider]! : provider\n}\n\n/** The capability sheet of a text-to-speech model, or `undefined` when the id is not one. */\nexport function findTtsCapabilities(provider: string | undefined): TtsCapabilities | undefined {\n // `typeof`: node data can be written straight into workflow JSON, so the \"string\" is not guaranteed — and\n // `Object.hasOwn` would coerce an array like [\"elevenlabs-v3\"] into that model's id. A non-string is an unknown id.\n if (typeof provider !== \"string\" || !provider) return undefined\n const id = canonicalTtsProvider(provider)\n if (!Object.hasOwn(MODEL_CATALOG, id)) return undefined\n const entry = MODEL_CATALOG[id]!\n return entry.modes.includes(\"tts\") ? entry.tts : undefined\n}\n\n/**\n * The capability sheet a text-to-speech request will actually run under: a\n * missing or unknown provider id runs as {@link TTS_FALLBACK_PROVIDER}, so it\n * gets that sheet — including its `maxChars` (turbo's 40,000), where\n * `getMaxTtsChars` keeps answering its 5,000 default for such ids.\n */\nexport function getTtsCapabilities(provider: string | undefined): TtsCapabilities {\n return findTtsCapabilities(provider) ?? MODEL_CATALOG[TTS_FALLBACK_PROVIDER]!.tts!\n}\n\n/** The model performs inline `[audio tags]`. false ⇒ strip them before sending. */\nexport function ttsSupportsAudioTags(provider: string | undefined): boolean {\n return getTtsCapabilities(provider).audioTags\n}\n\n/** The model honours SSML `<break time=\"…\"/>` tags. */\nexport function ttsSupportsSsmlBreaks(provider: string | undefined): boolean {\n return getTtsCapabilities(provider).ssmlBreaks\n}\n\n/**\n * The model conditions on neighbouring text (`previous_text` / `next_text`).\n * false ⇒ the provider funnel never puts the fields on the wire, whatever the\n * request carries — the model would reject them.\n */\nexport function ttsSupportsStitching(provider: string | undefined): boolean {\n return getTtsCapabilities(provider).stitching\n}\n\n/** The model honours this voice-setting lever. */\nexport function ttsHasLever(provider: string | undefined, lever: TtsSettingLever): boolean {\n return getTtsCapabilities(provider).levers.includes(lever)\n}\n\n/** The model answers `/v1/text-to-speech/{voice}/with-timestamps` (character timings). */\nexport function ttsSupportsTimestamps(provider: string | undefined): boolean {\n return getTtsCapabilities(provider).timestamps\n}\n\n/** Language codes offered for the model, in catalog order. */\nexport function ttsLanguageCodes(provider: string | undefined): readonly string[] {\n return getTtsCapabilities(provider).languages\n}\n"]}
@@ -1555,28 +1555,9 @@ var VIDEO_MODELS = {
1555
1555
  ]
1556
1556
  },
1557
1557
  // ── Bytedance Seedance ──
1558
- "seedance": {
1559
- id: "seedance",
1560
- kind: "video",
1561
- modes: ["i2v", "t2v"],
1562
- family: "Bytedance",
1563
- maker: "bytedance",
1564
- label: "Seedance 1.5 Pro",
1565
- series: "Seedance",
1566
- description: "Bytedance Seedance 1.5 Pro \u2014 flexible duration (4/8/12s) with end-frame support.",
1567
- useCases: ["motion", "narrative"],
1568
- features: ["end-frame"],
1569
- durations: [4, 8, 12],
1570
- defaultDuration: 8,
1571
- resolutions: ["480p", "720p", "1080p"],
1572
- pricing: [
1573
- { identifier: "seedance", credits: 250, note: "8s default" },
1574
- { identifier: "seedance:4s", credits: 40 },
1575
- { identifier: "seedance:8s", credits: 70 },
1576
- { identifier: "seedance:12s", credits: 150 }
1577
- ],
1578
- mcpHidden: true
1579
- },
1558
+ // `seedance` (Seedance 1.5 Pro) was retired upstream 2026-10-25 — KIE answers
1559
+ // 410. No entry: a stored or sent "seedance" runs as Seedance 2 Mini through
1560
+ // RETIRED_VIDEO_PROVIDERS (model-constants).
1580
1561
  "seedance-2": {
1581
1562
  id: "seedance-2",
1582
1563
  kind: "video",
@@ -3667,5 +3648,5 @@ exports.resolutionOptionsByKind = resolutionOptionsByKind;
3667
3648
  exports.seedanceDraftFinalizeBillableSec = seedanceDraftFinalizeBillableSec;
3668
3649
  exports.seedanceDraftFinalizeCreditId = seedanceDraftFinalizeCreditId;
3669
3650
  exports.validateModelInput = validateModelInput;
3670
- //# sourceMappingURL=chunk-ADYPAGQF.cjs.map
3671
- //# sourceMappingURL=chunk-ADYPAGQF.cjs.map
3651
+ //# sourceMappingURL=chunk-RPQ2KF6L.cjs.map
3652
+ //# sourceMappingURL=chunk-RPQ2KF6L.cjs.map