@nodaro/prompts 1.38.0 → 1.40.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 (130) hide show
  1. package/dist/chunk-2EW5B7ZV.cjs +86 -0
  2. package/dist/chunk-2EW5B7ZV.cjs.map +1 -0
  3. package/dist/chunk-2P26SZX5.cjs +414 -0
  4. package/dist/chunk-2P26SZX5.cjs.map +1 -0
  5. package/dist/{chunk-7XKHDXCL.cjs → chunk-3U7X6JZN.cjs} +13 -12
  6. package/dist/chunk-3U7X6JZN.cjs.map +1 -0
  7. package/dist/chunk-4GKTOVFM.cjs +8 -0
  8. package/dist/chunk-4GKTOVFM.cjs.map +1 -0
  9. package/dist/{chunk-HRBBNODV.js → chunk-6GVFJLDL.js} +4 -3
  10. package/dist/chunk-6GVFJLDL.js.map +1 -0
  11. package/dist/{chunk-LVSH7K7R.cjs → chunk-C3NHNECH.cjs} +165 -88
  12. package/dist/chunk-C3NHNECH.cjs.map +1 -0
  13. package/dist/{chunk-CEPVQQVO.js → chunk-C46256GZ.js} +43 -5
  14. package/dist/chunk-C46256GZ.js.map +1 -0
  15. package/dist/{chunk-JKCR6WRZ.cjs → chunk-DQFQJECU.cjs} +43 -5
  16. package/dist/chunk-DQFQJECU.cjs.map +1 -0
  17. package/dist/{chunk-QDEWBBUR.js → chunk-DUXX6CBX.js} +12 -143
  18. package/dist/chunk-DUXX6CBX.js.map +1 -0
  19. package/dist/chunk-EAYEZXWT.js +388 -0
  20. package/dist/chunk-EAYEZXWT.js.map +1 -0
  21. package/dist/chunk-GILUVQQJ.js +6 -0
  22. package/dist/chunk-GILUVQQJ.js.map +1 -0
  23. package/dist/{chunk-KIYNOOPJ.js → chunk-GTDKDD7Y.js} +12 -6
  24. package/dist/chunk-GTDKDD7Y.js.map +1 -0
  25. package/dist/{chunk-QBEZMR2F.js → chunk-HQTHDTHN.js} +137 -62
  26. package/dist/chunk-HQTHDTHN.js.map +1 -0
  27. package/dist/{chunk-TLVX5PXD.cjs → chunk-IUCNJAHW.cjs} +13 -7
  28. package/dist/chunk-IUCNJAHW.cjs.map +1 -0
  29. package/dist/{chunk-ZFIXQRBZ.cjs → chunk-LXPKTI2K.cjs} +12 -83
  30. package/dist/chunk-LXPKTI2K.cjs.map +1 -0
  31. package/dist/{chunk-CVPB2N3Z.cjs → chunk-LZ53F5BN.cjs} +103 -5
  32. package/dist/chunk-LZ53F5BN.cjs.map +1 -0
  33. package/dist/{chunk-4FDNVNJE.js → chunk-N6VMPG5S.js} +12 -79
  34. package/dist/chunk-N6VMPG5S.js.map +1 -0
  35. package/dist/{chunk-LK2CZK5U.cjs → chunk-PWWM7Q3T.cjs} +7 -7
  36. package/dist/{chunk-LK2CZK5U.cjs.map → chunk-PWWM7Q3T.cjs.map} +1 -1
  37. package/dist/{chunk-N7TOWXDJ.js → chunk-QDUTMOF4.js} +3 -3
  38. package/dist/{chunk-N7TOWXDJ.js.map → chunk-QDUTMOF4.js.map} +1 -1
  39. package/dist/{chunk-NO6XHX4R.js → chunk-RB2F5JQF.js} +100 -7
  40. package/dist/chunk-RB2F5JQF.js.map +1 -0
  41. package/dist/{chunk-MENBHEAY.cjs → chunk-WRM52ZBN.cjs} +19 -161
  42. package/dist/chunk-WRM52ZBN.cjs.map +1 -0
  43. package/dist/chunk-YS6HOWMW.js +80 -0
  44. package/dist/chunk-YS6HOWMW.js.map +1 -0
  45. package/dist/entries/assembly.cjs +34 -25
  46. package/dist/entries/assembly.d.cts +121 -37
  47. package/dist/entries/assembly.d.ts +121 -37
  48. package/dist/entries/assembly.js +5 -4
  49. package/dist/entries/doctrine.cjs +46 -46
  50. package/dist/entries/doctrine.d.cts +3 -3
  51. package/dist/entries/doctrine.d.ts +3 -3
  52. package/dist/entries/doctrine.js +1 -1
  53. package/dist/entries/picker-catalogs.cjs +42 -42
  54. package/dist/entries/picker-catalogs.js +3 -3
  55. package/dist/entries/presets.cjs +49 -26
  56. package/dist/entries/presets.d.cts +53 -1
  57. package/dist/entries/presets.d.ts +53 -1
  58. package/dist/entries/presets.js +4 -1
  59. package/dist/entries/prompt-builder.cjs +135 -98
  60. package/dist/entries/prompt-builder.d.cts +22 -11
  61. package/dist/entries/prompt-builder.d.ts +22 -11
  62. package/dist/entries/prompt-builder.js +4 -3
  63. package/dist/entries/prompt-fields.cjs +41 -40
  64. package/dist/entries/prompt-fields.d.cts +2 -1
  65. package/dist/entries/prompt-fields.d.ts +2 -1
  66. package/dist/entries/prompt-fields.js +2 -1
  67. package/dist/index.cjs +339 -273
  68. package/dist/index.d.cts +4 -4
  69. package/dist/index.d.ts +4 -4
  70. package/dist/index.js +11 -9
  71. package/dist/{subject-registry-BUswuEVD.d.cts → subject-registry-CQi_CZfJ.d.cts} +78 -9
  72. package/dist/{subject-registry-D7V8PEG-.d.ts → subject-registry-DFiGx49v.d.ts} +78 -9
  73. package/package.json +2 -2
  74. package/src/__tests__/assemble-image-input-style-references.test.ts +173 -0
  75. package/src/__tests__/catalog-id-guard.test.ts +30 -0
  76. package/src/__tests__/factory-preset-previews.test.ts +123 -0
  77. package/src/__tests__/factory-preset-references.test.ts +222 -0
  78. package/src/__tests__/factory-presets-prototype-keys.test.ts +43 -0
  79. package/src/__tests__/frame-reference-slots.test.ts +43 -0
  80. package/src/__tests__/gemini-omni-inputs.test.ts +12 -10
  81. package/src/__tests__/provider-prompt-doctrine.test.ts +14 -0
  82. package/src/__tests__/user-direction-refs.test.ts +180 -0
  83. package/src/__tests__/veo-i2v-inputs.test.ts +16 -11
  84. package/src/assemble-image-input.ts +114 -13
  85. package/src/catalog-id-guard.ts +18 -2
  86. package/src/color-names.ts +192 -0
  87. package/src/direction-registry.ts +66 -5
  88. package/src/entries/assembly.ts +1 -0
  89. package/src/entries/prompt-builder.ts +2 -0
  90. package/src/factory-presets/generate-image.ts +29 -0
  91. package/src/factory-presets/index.ts +6 -1
  92. package/src/factory-presets/preview-files.generated.ts +4 -0
  93. package/src/factory-presets/previews.ts +40 -0
  94. package/src/factory-presets/references.ts +81 -0
  95. package/src/factory-presets/shared-image.ts +4 -0
  96. package/src/factory-presets/types.ts +8 -0
  97. package/src/frame-reference-slots.ts +92 -0
  98. package/src/gemini-omni-inputs.ts +23 -22
  99. package/src/image-reference-doctrine.ts +3 -3
  100. package/src/image-token-pattern.ts +13 -0
  101. package/src/node-prompt-fields.ts +5 -3
  102. package/src/own-entry.ts +11 -0
  103. package/src/prompt-builder.ts +4 -5
  104. package/src/prompt-style-section.ts +3 -3
  105. package/src/prompt-wizard-categories.ts +2 -0
  106. package/src/provider-prompt-doctrine.ts +45 -3
  107. package/src/ref-binding.ts +28 -3
  108. package/src/resolve-prompt.ts +2 -1
  109. package/src/seedance-2-inputs.ts +15 -40
  110. package/src/user-direction-refs.ts +110 -0
  111. package/src/veo-i2v-inputs.ts +24 -17
  112. package/src/video-reference-resolver.ts +1 -1
  113. package/dist/chunk-4FDNVNJE.js.map +0 -1
  114. package/dist/chunk-7XKHDXCL.cjs.map +0 -1
  115. package/dist/chunk-CEPVQQVO.js.map +0 -1
  116. package/dist/chunk-CVPB2N3Z.cjs.map +0 -1
  117. package/dist/chunk-HRBBNODV.js.map +0 -1
  118. package/dist/chunk-JKCR6WRZ.cjs.map +0 -1
  119. package/dist/chunk-KIYNOOPJ.js.map +0 -1
  120. package/dist/chunk-LVSH7K7R.cjs.map +0 -1
  121. package/dist/chunk-MENBHEAY.cjs.map +0 -1
  122. package/dist/chunk-NO6XHX4R.js.map +0 -1
  123. package/dist/chunk-QBEZMR2F.js.map +0 -1
  124. package/dist/chunk-QDEWBBUR.js.map +0 -1
  125. package/dist/chunk-TLVX5PXD.cjs.map +0 -1
  126. package/dist/chunk-UJKFHPZ7.js +0 -37
  127. package/dist/chunk-UJKFHPZ7.js.map +0 -1
  128. package/dist/chunk-W5SCZIOB.cjs +0 -43
  129. package/dist/chunk-W5SCZIOB.cjs.map +0 -1
  130. package/dist/chunk-ZFIXQRBZ.cjs.map +0 -1
@@ -0,0 +1,86 @@
1
+ 'use strict';
2
+
3
+ var chunkLXPKTI2K_cjs = require('./chunk-LXPKTI2K.cjs');
4
+ var workflow = require('@nodaro/shared/workflow');
5
+ var social = require('@nodaro/shared/social');
6
+
7
+ // src/audio-tags.ts
8
+ function removeBracketTags(text) {
9
+ let out = "";
10
+ let from = 0;
11
+ let open = text.indexOf("[");
12
+ while (open !== -1) {
13
+ const close = text.indexOf("]", open + 1);
14
+ if (close === -1) break;
15
+ if (close === open + 1) {
16
+ open = text.indexOf("[", open + 1);
17
+ continue;
18
+ }
19
+ out += text.slice(from, open);
20
+ from = close + 1;
21
+ open = text.indexOf("[", from);
22
+ }
23
+ return out + text.slice(from);
24
+ }
25
+ function stripAudioTags(text) {
26
+ return removeBracketTags(text).replace(/\s{2,}/g, " ").trim();
27
+ }
28
+ var WIRED_OUTPUT_NODE_TYPES = /* @__PURE__ */ new Set(["webhook-output", ...social.SOCIAL_POST_NODE_TYPES]);
29
+ var TEXT_REQUIRED_NODE_TYPES = /* @__PURE__ */ new Set([
30
+ "llm-chat",
31
+ "ai-writer",
32
+ "generate-script",
33
+ "text-to-speech",
34
+ "generate-music",
35
+ "text-to-audio",
36
+ // Save to Collection refuses an empty record ("nothing to save"): a feed
37
+ // with nothing new wired straight into it must skip it, not fail the run.
38
+ "collection-write",
39
+ // Generate Image: an empty prompt is a legal request in general (references
40
+ // alone), but when the text it was WIRED produced nothing this run — the skip
41
+ // rule's precondition — an empty prompt is a paid picture of nothing.
42
+ "generate-image"
43
+ ]);
44
+ var withoutAffixes = (data) => ({ ...data, promptPrefix: void 0, promptSuffix: void 0 });
45
+ var present = (s) => typeof s === "string" && s.trim().length > 0;
46
+ function computeAiWriterInput(data, { override, wired }) {
47
+ return [override, wired, data.userInput, data.prompt].find(present) ?? "";
48
+ }
49
+ function computeNodeSendText(nodeType, data, args) {
50
+ const bare = withoutAffixes(data);
51
+ switch (nodeType) {
52
+ case "llm-chat":
53
+ return chunkLXPKTI2K_cjs.computeLlmChatFields(bare, {
54
+ override: args.override,
55
+ wiredUserInput: args.wired,
56
+ wiredSystemPrompt: args.wiredSystemPrompt,
57
+ refMap: args.refMap
58
+ }).userInput;
59
+ case "ai-writer":
60
+ return computeAiWriterInput(bare, args);
61
+ case "generate-script":
62
+ return chunkLXPKTI2K_cjs.computeScriptTopic(bare, { override: args.override, wired: args.wired, refMap: args.refMap });
63
+ case "generate-music": {
64
+ const prompt = chunkLXPKTI2K_cjs.computeNodePrompt(nodeType, bare, { override: args.override, wired: args.wired, refMap: args.refMap });
65
+ return present(prompt) ? prompt : present(data.lyrics) ? data.lyrics : "";
66
+ }
67
+ case "text-to-speech":
68
+ case "text-to-audio":
69
+ case "generate-image":
70
+ return chunkLXPKTI2K_cjs.computeNodePrompt(nodeType, bare, { override: args.override, wired: args.wired, refMap: args.refMap });
71
+ case "collection-write": {
72
+ const typed = [data.title, data.text, data.link].map((v) => typeof v === "string" ? workflow.resolveNodeRefs(v, args.refMap) : v).find((v) => present(v));
73
+ return [args.override, args.wired, typed].find(present) ?? "";
74
+ }
75
+ default:
76
+ return void 0;
77
+ }
78
+ }
79
+
80
+ exports.TEXT_REQUIRED_NODE_TYPES = TEXT_REQUIRED_NODE_TYPES;
81
+ exports.WIRED_OUTPUT_NODE_TYPES = WIRED_OUTPUT_NODE_TYPES;
82
+ exports.computeAiWriterInput = computeAiWriterInput;
83
+ exports.computeNodeSendText = computeNodeSendText;
84
+ exports.stripAudioTags = stripAudioTags;
85
+ //# sourceMappingURL=chunk-2EW5B7ZV.cjs.map
86
+ //# sourceMappingURL=chunk-2EW5B7ZV.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/audio-tags.ts","../src/node-send-text.ts"],"names":["SOCIAL_POST_NODE_TYPES","computeLlmChatFields","computeScriptTopic","computeNodePrompt","resolveNodeRefs"],"mappings":";;;;;;;AAcA,SAAS,kBAAkB,IAAA,EAAsB;AAC/C,EAAA,IAAI,GAAA,GAAM,EAAA;AACV,EAAA,IAAI,IAAA,GAAO,CAAA;AACX,EAAA,IAAI,IAAA,GAAO,IAAA,CAAK,OAAA,CAAQ,GAAG,CAAA;AAC3B,EAAA,OAAO,SAAS,EAAA,EAAI;AAClB,IAAA,MAAM,KAAA,GAAQ,IAAA,CAAK,OAAA,CAAQ,GAAA,EAAK,OAAO,CAAC,CAAA;AACxC,IAAA,IAAI,UAAU,EAAA,EAAI;AAClB,IAAA,IAAI,KAAA,KAAU,OAAO,CAAA,EAAG;AAEtB,MAAA,IAAA,GAAO,IAAA,CAAK,OAAA,CAAQ,GAAA,EAAK,IAAA,GAAO,CAAC,CAAA;AACjC,MAAA;AAAA,IACF;AACA,IAAA,GAAA,IAAO,IAAA,CAAK,KAAA,CAAM,IAAA,EAAM,IAAI,CAAA;AAC5B,IAAA,IAAA,GAAO,KAAA,GAAQ,CAAA;AACf,IAAA,IAAA,GAAO,IAAA,CAAK,OAAA,CAAQ,GAAA,EAAK,IAAI,CAAA;AAAA,EAC/B;AACA,EAAA,OAAO,GAAA,GAAM,IAAA,CAAK,KAAA,CAAM,IAAI,CAAA;AAC9B;AAEO,SAAS,eAAe,IAAA,EAAsB;AACnD,EAAA,OAAO,kBAAkB,IAAI,CAAA,CAAE,QAAQ,SAAA,EAAW,GAAG,EAAE,IAAA,EAAK;AAC9D;ACpBO,IAAM,0CAA+C,IAAI,GAAA,CAAI,CAAC,gBAAA,EAAkB,GAAGA,6BAAsB,CAAC;AAW1G,IAAM,wBAAA,uBAAoD,GAAA,CAAI;AAAA,EACnE,UAAA;AAAA,EACA,WAAA;AAAA,EACA,iBAAA;AAAA,EACA,gBAAA;AAAA,EACA,gBAAA;AAAA,EACA,eAAA;AAAA;AAAA;AAAA,EAGA,kBAAA;AAAA;AAAA;AAAA;AAAA,EAIA;AACF,CAAC;AAQD,IAAM,cAAA,GAAiB,CAAC,IAAA,MAA4D,EAAE,GAAG,IAAA,EAAM,YAAA,EAAc,MAAA,EAAW,YAAA,EAAc,MAAA,EAAU,CAAA;AAYhJ,IAAM,OAAA,GAAU,CAAC,CAAA,KAA4B,OAAO,MAAM,QAAA,IAAY,CAAA,CAAE,IAAA,EAAK,CAAE,MAAA,GAAS,CAAA;AAQjF,SAAS,oBAAA,CACd,IAAA,EACA,EAAE,QAAA,EAAU,OAAM,EACV;AACR,EAAA,OAAO,CAAC,QAAA,EAAU,KAAA,EAAO,IAAA,CAAK,SAAA,EAAiC,KAAK,MAA4B,CAAA,CAAE,IAAA,CAAK,OAAO,CAAA,IAAK,EAAA;AACrH;AASO,SAAS,mBAAA,CACd,QAAA,EACA,IAAA,EACA,IAAA,EACoB;AACpB,EAAA,MAAM,IAAA,GAAO,eAAe,IAAI,CAAA;AAChC,EAAA,QAAQ,QAAA;AAAU,IAChB,KAAK,UAAA;AACH,MAAA,OAAOC,uCAAqB,IAAA,EAAM;AAAA,QAChC,UAAU,IAAA,CAAK,QAAA;AAAA,QACf,gBAAgB,IAAA,CAAK,KAAA;AAAA,QACrB,mBAAmB,IAAA,CAAK,iBAAA;AAAA,QACxB,QAAQ,IAAA,CAAK;AAAA,OACd,CAAA,CAAE,SAAA;AAAA,IACL,KAAK,WAAA;AACH,MAAA,OAAO,oBAAA,CAAqB,MAAM,IAAI,CAAA;AAAA,IACxC,KAAK,iBAAA;AACH,MAAA,OAAOC,oCAAA,CAAmB,IAAA,EAAM,EAAE,QAAA,EAAU,IAAA,CAAK,QAAA,EAAU,KAAA,EAAO,IAAA,CAAK,KAAA,EAAO,MAAA,EAAQ,IAAA,CAAK,MAAA,EAAQ,CAAA;AAAA,IACrG,KAAK,gBAAA,EAAkB;AAErB,MAAA,MAAM,MAAA,GAASC,mCAAA,CAAkB,QAAA,EAAU,IAAA,EAAM,EAAE,QAAA,EAAU,IAAA,CAAK,QAAA,EAAU,KAAA,EAAO,IAAA,CAAK,KAAA,EAAO,MAAA,EAAQ,IAAA,CAAK,QAAQ,CAAA;AACpH,MAAA,OAAO,OAAA,CAAQ,MAAM,CAAA,GAAI,MAAA,GAAS,QAAQ,IAAA,CAAK,MAA4B,CAAA,GAAK,IAAA,CAAK,MAAA,GAAoB,EAAA;AAAA,IAC3G;AAAA,IACA,KAAK,gBAAA;AAAA,IACL,KAAK,eAAA;AAAA,IACL,KAAK,gBAAA;AACH,MAAA,OAAOA,mCAAA,CAAkB,QAAA,EAAU,IAAA,EAAM,EAAE,QAAA,EAAU,IAAA,CAAK,QAAA,EAAU,KAAA,EAAO,IAAA,CAAK,KAAA,EAAO,MAAA,EAAQ,IAAA,CAAK,QAAQ,CAAA;AAAA,IAC9G,KAAK,kBAAA,EAAoB;AAQvB,MAAA,MAAM,KAAA,GAAQ,CAAC,IAAA,CAAK,KAAA,EAAO,IAAA,CAAK,IAAA,EAAM,IAAA,CAAK,IAAI,CAAA,CAC5C,GAAA,CAAI,CAAC,CAAA,KAAO,OAAO,CAAA,KAAM,QAAA,GAAWC,wBAAA,CAAgB,CAAA,EAAG,IAAA,CAAK,MAAM,CAAA,GAAI,CAAE,CAAA,CACxE,IAAA,CAAK,CAAC,CAAA,KAAmB,OAAA,CAAQ,CAAuB,CAAC,CAAA;AAC5D,MAAA,OAAO,CAAC,KAAK,QAAA,EAAU,IAAA,CAAK,OAAO,KAAK,CAAA,CAAE,IAAA,CAAK,OAAO,CAAA,IAAK,EAAA;AAAA,IAC7D;AAAA,IACA;AACE,MAAA,OAAO,MAAA;AAAA;AAEb","file":"chunk-2EW5B7ZV.cjs","sourcesContent":["/**\n * Remove inline `[audio tags]` from speech text, for a model that does not\n * perform them (it would read them aloud). Pure, dependency-free: the\n * backend's credit counter (lib/speech-credits.ts), its payload builder and\n * the editor's estimate (frontend/src/lib/speech-estimate.ts) all read it, so\n * the two engines count exactly the same characters.\n *\n * A tag is `[`, one or more characters that are not `]`, then `]` — what\n * `/\\[[^\\]]+\\]/g` matches. That pattern is quadratic on an unclosed run of `[`\n * (every `[` rescans to the end of the text), and the credit counter runs this\n * on raw request text on the API and orchestrator event loops, so the scan is\n * written by hand: one `indexOf` per `[`, and when no `]` is left no later `[`\n * can match either, so the rest of the text is kept in one slice.\n */\nfunction removeBracketTags(text: string): string {\n let out = \"\"\n let from = 0\n let open = text.indexOf(\"[\")\n while (open !== -1) {\n const close = text.indexOf(\"]\", open + 1)\n if (close === -1) break\n if (close === open + 1) {\n // \"[]\" is not a tag (needs 1+ characters); the \"[\" stays and the scan moves on.\n open = text.indexOf(\"[\", open + 1)\n continue\n }\n out += text.slice(from, open)\n from = close + 1\n open = text.indexOf(\"[\", from)\n }\n return out + text.slice(from)\n}\n\nexport function stripAudioTags(text: string): string {\n return removeBracketTags(text).replace(/\\s{2,}/g, \" \").trim()\n}\n","import { resolveNodeRefs } from \"@nodaro/shared/workflow\"\nimport { SOCIAL_POST_NODE_TYPES } from \"@nodaro/shared/social\"\nimport { computeLlmChatFields, computeNodePrompt, computeScriptTopic } from \"./resolve-prompt.js\"\n\n/**\n * Output nodes that send exactly what is WIRED into them — a webhook's\n * parameters, a social post's caption and media. When every wire produced\n * nothing in this run (a Filter List that kept no row, a node that was itself\n * skipped), there is nothing to send: the node is skipped with\n * `skipReason: \"empty_input\"` instead of posting an empty payload (a site that\n * validates its input answers 400 and alerts its owner) or failing the run\n * (a publish route refuses a post with no text and no media). A typed caption\n * with no wire at all is the author's choice and still runs, as before. ONE\n * list, read by the orchestrator's skip rule (`empty-input-skips.ts`).\n */\nexport const WIRED_OUTPUT_NODE_TYPES: ReadonlySet<string> = new Set([\"webhook-output\", ...SOCIAL_POST_NODE_TYPES])\n\n/**\n * Node types that send TEXT to a model or a voice and fail on an empty one —\n * `userInput: Too small` (llm-chat), \"no text found\" (text-to-speech) — so a\n * run with nothing upstream can skip them instead of failing. Never an image\n * or video node (an empty prompt is a legal request there) and never a social\n * post (an empty caption is the author's choice). ONE list, read by the\n * orchestrator's skip rule (`empty-input-skips.ts`); the engine never names a\n * type on its own.\n */\nexport const TEXT_REQUIRED_NODE_TYPES: ReadonlySet<string> = new Set([\n \"llm-chat\",\n \"ai-writer\",\n \"generate-script\",\n \"text-to-speech\",\n \"generate-music\",\n \"text-to-audio\",\n // Save to Collection refuses an empty record (\"nothing to save\"): a feed\n // with nothing new wired straight into it must skip it, not fail the run.\n \"collection-write\",\n // Generate Image: an empty prompt is a legal request in general (references\n // alone), but when the text it was WIRED produced nothing this run — the skip\n // rule's precondition — an empty prompt is a paid picture of nothing.\n \"generate-image\",\n])\n\n/**\n * The node's data without its prompt pre/post text: the skip decision is about\n * the CORE text. A prefix alone (\"Write a news item about:\") is not something\n * to send — with the affixes applied, an empty core read as non-empty and an\n * idle tick paid for a model call on the prefix.\n */\nconst withoutAffixes = (data: Record<string, unknown>): Record<string, unknown> => ({ ...data, promptPrefix: undefined, promptSuffix: undefined })\n\nexport interface NodeSendTextArgs {\n /** A list fan-out item (highest precedence). */\n override?: string\n /** The text wired into the node's main text input. */\n wired?: string\n /** llm-chat only: the text wired into `system-prompt`. */\n wiredSystemPrompt?: string\n refMap: ReadonlyMap<string, string>\n}\n\nconst present = (s?: string): s is string => typeof s === \"string\" && s.trim().length > 0\n\n/**\n * ai-writer's user input — the rule its sync-HTTP body applies: a fan-out\n * item, else the wired text, else the typed `userInput`, else the legacy\n * `prompt`. (ai-writer is renamed to llm-chat on load; saved graphs that\n * never reloaded still run it.)\n */\nexport function computeAiWriterInput(\n data: Record<string, unknown>,\n { override, wired }: Pick<NodeSendTextArgs, \"override\" | \"wired\">,\n): string {\n return [override, wired, data.userInput as string | undefined, data.prompt as string | undefined].find(present) ?? \"\"\n}\n\n/**\n * The text a text-requiring node would send, by the SAME rule its executor\n * uses (`computeLlmChatFields`, `computeScriptTopic`, `computeNodePrompt`,\n * `computeAiWriterInput`) — so \"would this node run on nothing?\" is answered\n * by the function that decides what it sends, not by a second reading of it.\n * Undefined for any other node type.\n */\nexport function computeNodeSendText(\n nodeType: string,\n data: Record<string, unknown>,\n args: NodeSendTextArgs,\n): string | undefined {\n const bare = withoutAffixes(data)\n switch (nodeType) {\n case \"llm-chat\":\n return computeLlmChatFields(bare, {\n override: args.override,\n wiredUserInput: args.wired,\n wiredSystemPrompt: args.wiredSystemPrompt,\n refMap: args.refMap,\n }).userInput\n case \"ai-writer\":\n return computeAiWriterInput(bare, args)\n case \"generate-script\":\n return computeScriptTopic(bare, { override: args.override, wired: args.wired, refMap: args.refMap })\n case \"generate-music\": {\n // A music node sings typed lyrics with no prompt; only both empty is nothing to send.\n const prompt = computeNodePrompt(nodeType, bare, { override: args.override, wired: args.wired, refMap: args.refMap })\n return present(prompt) ? prompt : present(data.lyrics as string | undefined) ? (data.lyrics as string) : \"\"\n }\n case \"text-to-speech\":\n case \"text-to-audio\":\n case \"generate-image\":\n return computeNodePrompt(nodeType, bare, { override: args.override, wired: args.wired, refMap: args.refMap })\n case \"collection-write\": {\n // The record's content: the item (a fan-out row, else what reached `in`),\n // else a title, text or link typed on the node. A picture alone is a\n // record too, but it never starves the node: only a wired TEXT input that\n // produced nothing can (the skip rule's precondition).\n // A typed field counts as the engines send it, its `{Node}` references\n // resolved: `{Feed || }` over a feed with nothing new is empty, so the\n // node skips instead of failing with an empty record (#1890).\n const typed = [data.title, data.text, data.link]\n .map((v) => (typeof v === \"string\" ? resolveNodeRefs(v, args.refMap) : v))\n .find((v): v is string => present(v as string | undefined))\n return [args.override, args.wired, typed].find(present) ?? \"\"\n }\n default:\n return undefined\n }\n}\n"]}
@@ -0,0 +1,414 @@
1
+ 'use strict';
2
+
3
+ var chunkMQEXFCNU_cjs = require('./chunk-MQEXFCNU.cjs');
4
+ var chunkFY4AMIDB_cjs = require('./chunk-FY4AMIDB.cjs');
5
+ var catalogs = require('@nodaro/shared/catalogs');
6
+
7
+ // src/color-names.ts
8
+ var NAMED = [
9
+ // Neutrals
10
+ ["black", "#000000"],
11
+ ["charcoal", "#36454F"],
12
+ ["dark gray", "#555555"],
13
+ ["slate gray", "#708090"],
14
+ ["gray", "#808080"],
15
+ ["warm gray", "#9A9088"],
16
+ ["silver", "#C0C0C0"],
17
+ ["light gray", "#D3D3D3"],
18
+ ["off-white", "#F2F0EB"],
19
+ ["white", "#FFFFFF"],
20
+ ["ivory", "#FFFFF0"],
21
+ ["cream", "#FFFDD0"],
22
+ ["eggshell", "#F0EAD6"],
23
+ ["linen", "#FAF0E6"],
24
+ ["champagne", "#F7E7CE"],
25
+ ["wheat", "#F5DEB3"],
26
+ // Earth tones and browns
27
+ ["sand", "#C2B280"],
28
+ ["tan", "#D2B48C"],
29
+ ["khaki", "#C3B091"],
30
+ ["taupe", "#8B8589"],
31
+ ["camel", "#C19A6B"],
32
+ ["caramel", "#C68E17"],
33
+ ["brown", "#964B00"],
34
+ ["chocolate", "#7B3F00"],
35
+ ["coffee", "#6F4E37"],
36
+ ["espresso", "#4E312D"],
37
+ ["walnut", "#773F1A"],
38
+ ["chestnut", "#954535"],
39
+ ["mahogany", "#C04000"],
40
+ ["rust", "#B7410E"],
41
+ ["terracotta", "#E2725B"],
42
+ ["copper", "#B87333"],
43
+ ["bronze", "#CD7F32"],
44
+ ["ochre", "#CC7722"],
45
+ // Oranges
46
+ ["burnt orange", "#CC5500"],
47
+ ["orange", "#FFA500"],
48
+ ["tangerine", "#F28500"],
49
+ ["apricot", "#FBCEB1"],
50
+ ["peach", "#FFCBA4"],
51
+ ["coral", "#FF7F50"],
52
+ ["salmon", "#FA8072"],
53
+ // Reds
54
+ ["red", "#FF0000"],
55
+ ["scarlet", "#FF2400"],
56
+ ["crimson", "#DC143C"],
57
+ ["cherry red", "#D2042D"],
58
+ ["brick red", "#CB4154"],
59
+ ["burgundy", "#800020"],
60
+ ["maroon", "#800000"],
61
+ ["wine red", "#722F37"],
62
+ ["oxblood", "#4A0000"],
63
+ // Pinks
64
+ ["raspberry", "#E30B5C"],
65
+ ["rose", "#FF007F"],
66
+ ["hot pink", "#FF69B4"],
67
+ ["pink", "#FFC0CB"],
68
+ ["blush pink", "#E8B4B8"],
69
+ ["dusty rose", "#C08081"],
70
+ ["mauve", "#B784A7"],
71
+ // Purples
72
+ ["magenta", "#FF00FF"],
73
+ ["orchid", "#DA70D6"],
74
+ ["plum", "#8E4585"],
75
+ ["eggplant", "#614051"],
76
+ ["dusty purple", "#6E5A7E"],
77
+ ["lilac", "#C8A2C8"],
78
+ ["lavender", "#B57EDC"],
79
+ ["pale lavender", "#E6E6FA"],
80
+ ["amethyst", "#9966CC"],
81
+ ["violet", "#8F00FF"],
82
+ ["purple", "#800080"],
83
+ ["indigo", "#4B0082"],
84
+ // Blues
85
+ ["navy blue", "#000080"],
86
+ ["midnight blue", "#191970"],
87
+ ["prussian blue", "#003153"],
88
+ ["dusky blue", "#4B5E7D"],
89
+ ["royal blue", "#4169E1"],
90
+ ["cobalt blue", "#0047AB"],
91
+ ["blue", "#0000FF"],
92
+ ["cornflower blue", "#6495ED"],
93
+ ["denim blue", "#1560BD"],
94
+ ["steel blue", "#4682B4"],
95
+ ["slate blue", "#6A5ACD"],
96
+ ["periwinkle", "#CCCCFF"],
97
+ ["sky blue", "#87CEEB"],
98
+ ["baby blue", "#89CFF0"],
99
+ ["powder blue", "#B0E0E6"],
100
+ ["ice blue", "#D6ECEF"],
101
+ ["azure", "#007FFF"],
102
+ ["cerulean", "#007BA7"],
103
+ ["petrol blue", "#005F6A"],
104
+ // Cyans and teals
105
+ ["cyan", "#00FFFF"],
106
+ ["turquoise", "#40E0D0"],
107
+ ["aquamarine", "#7FFFD4"],
108
+ ["teal", "#008080"],
109
+ ["dark teal", "#014D4E"],
110
+ ["dark slate gray", "#2F4F4F"],
111
+ // Greens
112
+ ["sea green", "#2E8B57"],
113
+ ["emerald green", "#50C878"],
114
+ ["jade green", "#00A86B"],
115
+ ["mint green", "#98FF98"],
116
+ ["seafoam green", "#93E9BE"],
117
+ ["sage green", "#9CAF88"],
118
+ ["olive green", "#708238"],
119
+ ["olive", "#808000"],
120
+ ["moss green", "#8A9A5B"],
121
+ ["forest green", "#228B22"],
122
+ ["hunter green", "#355E3B"],
123
+ ["bottle green", "#006A4E"],
124
+ ["dark green", "#013220"],
125
+ ["green", "#008000"],
126
+ ["kelly green", "#4CBB17"],
127
+ ["lime green", "#32CD32"],
128
+ ["chartreuse", "#7FFF00"],
129
+ ["pistachio", "#93C572"],
130
+ // Yellows and golds
131
+ ["yellow", "#FFFF00"],
132
+ ["lemon yellow", "#FFF44F"],
133
+ ["pale yellow", "#FDFD96"],
134
+ ["canary yellow", "#FFEF00"],
135
+ ["mustard yellow", "#E1AD01"],
136
+ ["gold", "#FFD700"],
137
+ ["amber", "#FFBF00"],
138
+ ["honey", "#F0A830"],
139
+ ["saffron", "#F4C430"]
140
+ ];
141
+ var HEX_RE = /^#[0-9a-f]{6}$/i;
142
+ function channel(v) {
143
+ const c = v / 255;
144
+ return c <= 0.04045 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;
145
+ }
146
+ function labPivot(t) {
147
+ return t > 216 / 24389 ? Math.cbrt(t) : (24389 / 27 * t + 16) / 116;
148
+ }
149
+ function toLab(hex) {
150
+ const r = channel(parseInt(hex.slice(1, 3), 16));
151
+ const g = channel(parseInt(hex.slice(3, 5), 16));
152
+ const b = channel(parseInt(hex.slice(5, 7), 16));
153
+ const x = labPivot((0.4124564 * r + 0.3575761 * g + 0.1804375 * b) / 0.95047);
154
+ const y = labPivot(0.2126729 * r + 0.7151522 * g + 0.072175 * b);
155
+ const z = labPivot((0.0193339 * r + 0.119192 * g + 0.9503041 * b) / 1.08883);
156
+ return [116 * y - 16, 500 * (x - y), 200 * (y - z)];
157
+ }
158
+ var namedLab = null;
159
+ function nearestColorName(hex) {
160
+ if (!HEX_RE.test(hex)) return "";
161
+ namedLab ??= NAMED.map(([name, value]) => [name, toLab(value)]);
162
+ const [l, a, b] = toLab(hex);
163
+ let best = "";
164
+ let bestDistance = Infinity;
165
+ for (const [name, [nl, na, nb]] of namedLab) {
166
+ const d = (l - nl) ** 2 + (a - na) ** 2 + (b - nb) ** 2;
167
+ if (d < bestDistance) {
168
+ bestDistance = d;
169
+ best = name;
170
+ }
171
+ }
172
+ return best;
173
+ }
174
+
175
+ // src/user-direction-refs.ts
176
+ var USER_DIRECTION_REF_KINDS = ["palette", "moodboard"];
177
+ var UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
178
+ function parseUserDirectionRef(value) {
179
+ if (typeof value !== "string") return null;
180
+ for (const kind of USER_DIRECTION_REF_KINDS) {
181
+ const prefix = `${kind}:`;
182
+ if (value.startsWith(prefix)) {
183
+ const id = value.slice(prefix.length);
184
+ return { kind, id, wellFormed: UUID_RE.test(id) };
185
+ }
186
+ }
187
+ return null;
188
+ }
189
+ function userDirectionRefValue(kind, id) {
190
+ return `${kind}:${id}`;
191
+ }
192
+ function oneLine(text) {
193
+ return (text ?? "").replace(/\s+/g, " ").trim();
194
+ }
195
+ var HEX_RE2 = /^#[0-9a-f]{6}$/i;
196
+ function renderPaletteClause(colors) {
197
+ const named = colors.filter((c) => HEX_RE2.test(c)).map((c) => `${nearestColorName(c)} ${c.toUpperCase()}`);
198
+ return named.length > 0 ? `color palette: ${named.join(", ")}` : "";
199
+ }
200
+ function renderMoodboardClause(description) {
201
+ return oneLine(description);
202
+ }
203
+ function styleReferenceDescription(index, caption) {
204
+ const cap = oneLine(caption);
205
+ const tail = cap ? ` (${cap})` : "";
206
+ return index === 0 ? `match the colors, light, texture and mood of this style reference${tail}, not its subject or layout` : `another style reference${tail}`;
207
+ }
208
+
209
+ // src/direction-registry.ts
210
+ var perId = (full, compact) => (ids, mode) => {
211
+ const out = [];
212
+ for (const id of ids) {
213
+ const frag = mode === "compact" ? compact(id) : full(id);
214
+ if (frag.length > 0) out.push(frag);
215
+ }
216
+ return out;
217
+ };
218
+ var viaListBuilder = (build) => (ids, mode) => build(ids.length === 1 ? ids[0] : [...ids], mode).filter((s) => s.length > 0);
219
+ var viaStringBuilder = (build) => (ids, mode) => {
220
+ const s = build(ids.length === 1 ? ids[0] : [...ids], mode);
221
+ return s.length > 0 ? [s] : [];
222
+ };
223
+ var viaMood = (ids, mode) => chunkMQEXFCNU_cjs.buildMoodHints({ mood: ids.length === 1 ? ids[0] : [...ids] }, mode).filter(
224
+ (s) => s.length > 0
225
+ );
226
+ var framing = perId(chunkMQEXFCNU_cjs.getFramingPromptHint, chunkMQEXFCNU_cjs.getFramingTerm);
227
+ var lighting = perId(chunkMQEXFCNU_cjs.getLightingPromptHint, chunkMQEXFCNU_cjs.getLightingTerm);
228
+ var exposure = perId(chunkMQEXFCNU_cjs.getExposurePromptHint, chunkMQEXFCNU_cjs.getExposureTerm);
229
+ var temporal = perId(chunkMQEXFCNU_cjs.getTemporalPromptHint, chunkMQEXFCNU_cjs.getTemporalTerm);
230
+ var DIRECTION_FIELDS = [
231
+ { key: "cameraMotion", surface: "video", family: "motion", maxPicks: 1, render: perId(chunkMQEXFCNU_cjs.getCameraMotionPromptHint, chunkMQEXFCNU_cjs.getCameraMotionTerm) },
232
+ // Composition (the Framing catalog, one row per category).
233
+ { key: "shotSize", surface: "both", family: "look", maxPicks: 1, render: framing },
234
+ { key: "angle", surface: "both", family: "look", maxPicks: 1, render: framing },
235
+ { key: "coverage", surface: "both", family: "look", maxPicks: 1, render: framing },
236
+ { key: "composition", surface: "both", family: "look", maxPicks: 2, render: framing },
237
+ { key: "vantage", surface: "both", family: "look", maxPicks: 1, render: framing },
238
+ { key: "pose", surface: "both", family: "look", maxPicks: 1, render: perId(chunkMQEXFCNU_cjs.getPosePromptHint, chunkMQEXFCNU_cjs.getPoseTerm) },
239
+ { key: "compositionEffect", surface: "both", family: "look", maxPicks: 1, render: perId(chunkMQEXFCNU_cjs.getCompositionEffectPromptHint, chunkMQEXFCNU_cjs.getCompositionEffectTerm) },
240
+ // Camera.
241
+ { key: "cameraFormat", surface: "both", family: "look", styleGroup: "film", maxPicks: 1, render: perId(chunkMQEXFCNU_cjs.getCameraFormatPromptHint, chunkMQEXFCNU_cjs.getCameraFormatTerm) },
242
+ { key: "lens", surface: "both", family: "look", maxPicks: 1, render: perId(chunkMQEXFCNU_cjs.getLensPromptHint, chunkMQEXFCNU_cjs.getLensTerm) },
243
+ // Exposure (stills only — a video's exposure rides its own temporal levers).
244
+ { key: "aperture", surface: "image", family: "look", maxPicks: 1, render: exposure },
245
+ { key: "shutterSpeed", surface: "image", family: "look", maxPicks: 1, render: exposure },
246
+ { key: "isoValue", surface: "image", family: "look", maxPicks: 1, render: exposure },
247
+ // Light (the Lighting catalog, one row per category).
248
+ { key: "timeOfDay", surface: "both", family: "look", maxPicks: 1, render: lighting },
249
+ { key: "lightingStyle", surface: "both", family: "look", maxPicks: 2, render: lighting },
250
+ { key: "lightingDirection", surface: "both", family: "look", maxPicks: 1, render: lighting },
251
+ { key: "lightingRatio", surface: "both", family: "look", maxPicks: 1, render: lighting },
252
+ { key: "colorTemperature", surface: "both", family: "look", maxPicks: 1, render: lighting },
253
+ { key: "colorLook", surface: "both", family: "look", styleGroup: "film", maxPicks: 1, userRef: "palette", render: perId(chunkMQEXFCNU_cjs.getColorLookPromptHint, chunkMQEXFCNU_cjs.getColorLookTerm) },
254
+ { key: "atmosphere", surface: "both", family: "look", maxPicks: 2, render: viaListBuilder(chunkMQEXFCNU_cjs.buildAtmosphereHints) },
255
+ { key: "postProcess", surface: "image", family: "look", maxPicks: 2, render: viaListBuilder(chunkMQEXFCNU_cjs.buildPostProcessHints) },
256
+ // Style.
257
+ { key: "style", surface: "both", family: "look", styleGroup: "film", maxPicks: 1, userRef: "moodboard", render: perId(chunkMQEXFCNU_cjs.getStylePromptHint, chunkMQEXFCNU_cjs.getStyleTerm) },
258
+ { key: "mood", surface: "both", family: "look", maxPicks: 2, render: viaMood },
259
+ { key: "aesthetic", surface: "both", family: "look", maxPicks: 2, render: viaStringBuilder(chunkMQEXFCNU_cjs.buildAestheticHints) },
260
+ { key: "photoGenre", surface: "image", family: "look", maxPicks: 1, render: perId(chunkMQEXFCNU_cjs.getPhotoGenrePromptHint, chunkMQEXFCNU_cjs.getPhotoGenreTerm) },
261
+ { key: "photographer", surface: "image", family: "look", maxPicks: 2, render: viaStringBuilder(chunkMQEXFCNU_cjs.buildPhotographerHints) },
262
+ { key: "renderQuality", surface: "image", family: "look", maxPicks: 1, render: perId(chunkMQEXFCNU_cjs.getRenderQualityPromptHint, chunkMQEXFCNU_cjs.getRenderQualityTerm) },
263
+ // Scene.
264
+ { key: "setting", surface: "both", family: "look", maxPicks: 1, render: perId(chunkMQEXFCNU_cjs.getSettingPromptHint, chunkMQEXFCNU_cjs.getSettingTerm) },
265
+ { key: "era", surface: "both", family: "look", styleGroup: "film", maxPicks: 1, render: perId(chunkMQEXFCNU_cjs.getEraPromptHint, chunkMQEXFCNU_cjs.getEraTerm) },
266
+ { key: "backdrop", surface: "both", family: "look", maxPicks: 1, render: perId(chunkMQEXFCNU_cjs.getBackdropPromptHint, chunkMQEXFCNU_cjs.getBackdropTerm) },
267
+ // Motion & time.
268
+ { key: "actionFx", surface: "video", family: "motion", maxPicks: 2, render: viaListBuilder(chunkMQEXFCNU_cjs.buildActionFxHints) },
269
+ { key: "temporalSpeed", surface: "video", family: "motion", maxPicks: 1, render: temporal },
270
+ { key: "temporalFreeze", surface: "video", family: "motion", maxPicks: 1, render: temporal },
271
+ { key: "temporalDirection", surface: "video", family: "motion", maxPicks: 1, render: temporal },
272
+ { key: "temporalShutter", surface: "video", family: "motion", maxPicks: 1, render: temporal },
273
+ { key: "transition", surface: "video", family: "motion", maxPicks: 2, render: chunkMQEXFCNU_cjs.renderTransitionBases },
274
+ { key: "loopSubject", surface: "video", family: "motion", maxPicks: 1, render: perId(chunkMQEXFCNU_cjs.getLoopSubjectPromptHint, chunkMQEXFCNU_cjs.getLoopSubjectTerm) },
275
+ // ── LEGACY BLOCK — see the table doc above. Placed LAST, in today's exact
276
+ // `composePromptText` order, so every pre-registry caller is byte-identical.
277
+ { key: "framingId", surface: "both", family: "look", maxPicks: 1, render: framing },
278
+ { key: "framingAngleId", surface: "both", family: "look", maxPicks: 1, render: framing },
279
+ { key: "lightingId", surface: "both", family: "look", maxPicks: 1, render: lighting },
280
+ { key: "lensId", surface: "both", family: "look", maxPicks: 1, render: perId(chunkMQEXFCNU_cjs.getLensPromptHint, chunkMQEXFCNU_cjs.getLensTerm) },
281
+ { key: "cameraFormatId", surface: "both", family: "look", styleGroup: "film", maxPicks: 1, render: perId(chunkMQEXFCNU_cjs.getCameraFormatPromptHint, chunkMQEXFCNU_cjs.getCameraFormatTerm) }
282
+ ];
283
+ var DIRECTION_SPECS = DIRECTION_FIELDS;
284
+ var DIRECTION_KEYS = DIRECTION_FIELDS.map((f) => f.key);
285
+ var FILM_STYLE_KEYS = DIRECTION_SPECS.filter(
286
+ (f) => f.styleGroup === "film"
287
+ ).map((f) => f.key);
288
+ function directionKeyForUserRef(kind) {
289
+ const row = DIRECTION_SPECS.find((f) => f.userRef === kind);
290
+ if (!row) throw new Error(`no direction row takes a ${kind} reference`);
291
+ return row.key;
292
+ }
293
+ function userRefKindOfDirectionKey(key) {
294
+ return DIRECTION_SPECS.find((f) => f.key === key)?.userRef;
295
+ }
296
+ var IMAGE_HINT_MODE_DEFAULT = "full";
297
+ var VIDEO_HINT_MODE_DEFAULT = { look: "full", motion: "compact" };
298
+ function modeForFamily(mode, family) {
299
+ return typeof mode === "string" ? mode : family === "motion" ? mode.motion : mode.look;
300
+ }
301
+ var DIRECTION_ARRAY_CEILING = 8;
302
+ var DIRECTION_ID_MAX_CHARS = 100;
303
+ function normalizeDirectionIds(value, maxPicks) {
304
+ const ids = [];
305
+ if (typeof value === "string") {
306
+ if (value) ids.push(value);
307
+ } else if (Array.isArray(value)) {
308
+ for (const v of value) {
309
+ if (ids.length >= maxPicks) break;
310
+ if (typeof v === "string" && v && !ids.includes(v)) ids.push(v);
311
+ }
312
+ }
313
+ return ids.slice(0, maxPicks);
314
+ }
315
+ function renderRow(spec, ids, mode, refs) {
316
+ if (spec.userRef === void 0 || !ids.some((id) => parseUserDirectionRef(id) !== null)) {
317
+ return spec.render(ids, mode);
318
+ }
319
+ return ids.flatMap((id) => {
320
+ const ref = parseUserDirectionRef(id);
321
+ if (ref === null) return spec.render([id], mode);
322
+ const clause = ref.kind === spec.userRef ? refs?.get(id) : void 0;
323
+ return clause ? [clause] : [];
324
+ });
325
+ }
326
+ function directionFieldsForSurface(surface) {
327
+ return DIRECTION_SPECS.filter((f) => f.surface === "both" || f.surface === surface);
328
+ }
329
+ function renderDirectionHintClauses(direction, opts) {
330
+ if (!direction) return [];
331
+ const mode = opts.mode ?? "full";
332
+ const out = [];
333
+ const seen = /* @__PURE__ */ new Set();
334
+ for (const spec of DIRECTION_SPECS) {
335
+ if (spec.surface !== "both" && spec.surface !== opts.surface) continue;
336
+ const ids = normalizeDirectionIds(
337
+ direction[spec.key],
338
+ spec.maxPicks
339
+ );
340
+ if (ids.length === 0) continue;
341
+ for (const hint of renderRow(spec, ids, modeForFamily(mode, spec.family), opts.refs)) {
342
+ if (hint.length > 0 && !seen.has(hint)) {
343
+ seen.add(hint);
344
+ out.push({
345
+ key: spec.key,
346
+ family: spec.family,
347
+ ...spec.styleGroup !== void 0 ? { styleGroup: spec.styleGroup } : {},
348
+ text: hint
349
+ });
350
+ }
351
+ }
352
+ }
353
+ return out;
354
+ }
355
+ function renderDirectionHints(direction, opts) {
356
+ return renderDirectionHintClauses(direction, opts).map((c) => c.text);
357
+ }
358
+ function curatedAnimalPromptHint(id) {
359
+ if (!id) return "";
360
+ if (!chunkMQEXFCNU_cjs.composedHas("animals", id)) return "";
361
+ return chunkMQEXFCNU_cjs.composedOption("animals", id)?.promptHint ?? catalogs.getAnimalPromptHint(id);
362
+ }
363
+ function curatedAnimalTerm(id) {
364
+ if (!id) return "";
365
+ if (!chunkMQEXFCNU_cjs.composedHas("animals", id)) return "";
366
+ return chunkMQEXFCNU_cjs.composedOption("animals", id)?.term ?? catalogs.getAnimalTerm(id);
367
+ }
368
+ function objectEntityText(catalogId, id, stock, stockHint, stockTerm) {
369
+ if (!id || !chunkMQEXFCNU_cjs.composedHas(catalogId, id)) return { hint: "", term: "" };
370
+ const composed = chunkMQEXFCNU_cjs.composedOption(catalogId, id);
371
+ if (composed) return { hint: composed.promptHint, term: composed.term };
372
+ if (!stock) return { hint: "", term: "" };
373
+ return { hint: stockHint(stock), term: stockTerm(stock) };
374
+ }
375
+ function objectEntityTerm(entry) {
376
+ return entry.term ?? chunkFY4AMIDB_cjs.deriveTerm(entry.label);
377
+ }
378
+ function curatedVehicleText(id) {
379
+ return objectEntityText("vehicles", id, catalogs.getVehicle(id), (e) => `featuring a ${e.label.toLowerCase()}, ${e.description}`, objectEntityTerm);
380
+ }
381
+ function curatedWeaponText(id) {
382
+ return objectEntityText("weapons", id, catalogs.getWeapon(id), (e) => `with a ${e.label.toLowerCase()}, ${e.description}`, objectEntityTerm);
383
+ }
384
+ function curatedFurnitureText(id) {
385
+ return objectEntityText("furniture", id, catalogs.getFurniture(id), (e) => `including a ${e.label.toLowerCase()}, ${e.description}`, objectEntityTerm);
386
+ }
387
+
388
+ exports.DIRECTION_ARRAY_CEILING = DIRECTION_ARRAY_CEILING;
389
+ exports.DIRECTION_FIELDS = DIRECTION_FIELDS;
390
+ exports.DIRECTION_ID_MAX_CHARS = DIRECTION_ID_MAX_CHARS;
391
+ exports.DIRECTION_KEYS = DIRECTION_KEYS;
392
+ exports.FILM_STYLE_KEYS = FILM_STYLE_KEYS;
393
+ exports.IMAGE_HINT_MODE_DEFAULT = IMAGE_HINT_MODE_DEFAULT;
394
+ exports.USER_DIRECTION_REF_KINDS = USER_DIRECTION_REF_KINDS;
395
+ exports.VIDEO_HINT_MODE_DEFAULT = VIDEO_HINT_MODE_DEFAULT;
396
+ exports.curatedAnimalPromptHint = curatedAnimalPromptHint;
397
+ exports.curatedAnimalTerm = curatedAnimalTerm;
398
+ exports.curatedFurnitureText = curatedFurnitureText;
399
+ exports.curatedVehicleText = curatedVehicleText;
400
+ exports.curatedWeaponText = curatedWeaponText;
401
+ exports.directionFieldsForSurface = directionFieldsForSurface;
402
+ exports.directionKeyForUserRef = directionKeyForUserRef;
403
+ exports.modeForFamily = modeForFamily;
404
+ exports.nearestColorName = nearestColorName;
405
+ exports.parseUserDirectionRef = parseUserDirectionRef;
406
+ exports.renderDirectionHintClauses = renderDirectionHintClauses;
407
+ exports.renderDirectionHints = renderDirectionHints;
408
+ exports.renderMoodboardClause = renderMoodboardClause;
409
+ exports.renderPaletteClause = renderPaletteClause;
410
+ exports.styleReferenceDescription = styleReferenceDescription;
411
+ exports.userDirectionRefValue = userDirectionRefValue;
412
+ exports.userRefKindOfDirectionKey = userRefKindOfDirectionKey;
413
+ //# sourceMappingURL=chunk-2P26SZX5.cjs.map
414
+ //# sourceMappingURL=chunk-2P26SZX5.cjs.map