1import { r as reactExports, j as jsxRuntimeExports } from "./vendor-react-Bay9Y7Lb.js"; 2import { d as defaultBackgroundConfig, a as defaultBackgroundPresets, m as mergeAllConfigsWithGorilla, b as defaultClothingGraphics, S as StagePuppetEngine, f as defaultPuppetConfigs } from "./StagePuppetEngine-BtPqoUG7.js"; 3import { d as defaultPercussionGraphics, a as defaultMelodicGraphics } from "./InstrumentMappings-UYUlFRMy.js"; 4import "./synth-BE1TSTD4.js"; 5import "./vendor-react-three-MDLA5jog.js"; 6import "./vendor-dVNaLJx_.js"; 7import "./vendor-i18n-R-bMoYp_.js"; 8import "./wasm-synth-adapter-BrqgBX1y.js"; 9import "./vendor-spessasynth-DH8n6o_V.js"; 10import "./vendor-audio-DH3w0BzW.js"; 11import "./IkMath-D6fi1ppd.js"; 12import "./vendor-gsap-50Lx19ak.js"; 13import "./vendor-framer-C8eEgkdL.js"; 14function useStageBackground(track) { 15 const [backgroundConfig, setBackgroundConfig] = reactExports.useState(defaultBackgroundConfig); 16 const [backgroundPresets, setBackgroundPresets] = reactExports.useState(defaultBackgroundPresets); 17 reactExports.useEffect(() => { 18 const loadConfigs = async () => { 19 try { 20 const [bgRes, presetsRes] = await Promise.all([ 21 fetch("/api/settings/stage_background_config"), 22 fetch("/api/settings/stage_background_presets") 23 ]); 24 if (bgRes.ok) { 25 const data = await bgRes.json(); 26 if (data && data.value) { 27 setBackgroundConfig(data.value); 28 } 29 } 30 if (presetsRes.ok) { 31 const data = await presetsRes.json(); 32 if (data && data.value && Array.isArray(data.value)) { 33 setBackgroundPresets(data.value); 34 } 35 } 36 } catch (e) { 37 console.log("Using default background configs"); 38 } 39 }; 40 loadConfigs(); 41 }, []); 42 const resolvedBackgroundConfig = reactExports.useMemo(() => { 43 var _a; 44 if (track.backgroundImageUrl) { 45 return { 46 type: "image", 47 color: "#050505", 48 image: { 49 url: track.backgroundImageUrl, 50 size: "cover", 51 position: "center center", 52 repeat: "no-repeat", 53 blur: 0 54 }, 55 overlay: { 56 enabled: true, 57 color: "#000000", 58 opacity: 0.15 59 }, 60 particles: { 61 enabled: false, 62 type: "stars", 63 count: 50, 64 speed: 1, 65 color: "#ffffff", 66 size: 2 67 } 68 }; 69 } 70 if (Array.isArray(track.tags) && track.tags.length > 0) { 71 const tagNames = track.tags.map((t) => { 72 if (typeof t === "string") return t.toLowerCase(); 73 if (t && typeof t === "object" && "name" in t) return t.name.toLowerCase(); 74 return ""; 75 }).filter(Boolean); 76 for (const preset of backgroundPresets) { 77 if (Array.isArray(preset.tags) && preset.tags.length > 0) { 78 const matches = preset.tags.some((tag) => { 79 const cleanTag = tag.toLowerCase().trim(); 80 if (!cleanTag) return false; 81 return tagNames.some((tn) => { 82 if (tn.includes(cleanTag) || cleanTag.includes(tn)) return true; 83 const tnWords = tn.split(/[\s,\-_]+/); 84 const tagWords = cleanTag.split(/[\s,\-_]+/); 85 return tagWords.some((tw) => tw.length > 2 && tnWords.includes(tw)); 86 }); 87 }); 88 if (matches && preset.config) { 89 return preset.config; 90 } 91 } 92 } 93 } 94 if (backgroundPresets && backgroundPresets.length > 0) { 95 const imagePresets = backgroundPresets.filter((p) => { 96 var _a2; 97 return p.config && p.config.type === "image" && ((_a2 = p.config.image) == null ? void 0 : _a2.url); 98 }); 99 const pool = imagePresets.length > 0 ? imagePresets : backgroundPresets; 100 const trackStr = ((_a = track.id) == null ? void 0 : _a.toString()) || track.title || "default"; 101 let hash = 0; 102 for (let i = 0; i < trackStr.length; i++) { 103 hash = trackStr.charCodeAt(i) + ((hash << 5) - hash); 104 } 105 const index = Math.abs(hash) % pool.length; 106 return pool[index].config; 107 }
108 return backgroundConfig || defaultBackgroundConfig; 109 }, [track.id, track.title, track.backgroundImageUrl, track.tags, backgroundConfig, backgroundPresets]); 110 return resolvedBackgroundConfig; 111} 112const OrchestraVisualizer = ({ 113 track, 114 currentTime, 115 isPlaying, 116 pianoRollData, 117 processedInstruments, 118 uniqueNames, 119 soloedIndex, 120 onSolo, 121 mutedIndices, 122 onMute, 123 onPanChange, 124 hiddenTracks = /* @__PURE__ */ new Set() 125}) => { 126 const [puppetConfigs, setPuppetConfigs] = reactExports.useState(() => mergeAllConfigsWithGorilla(defaultPuppetConfigs)); 127 const [instrumentConfigs, setInstrumentConfigs] = reactExports.useState({ 128 melodic: defaultMelodicGraphics, 129 percussion: defaultPercussionGraphics 130 }); 131 const [clothingConfigs, setClothingConfigs] = reactExports.useState(defaultClothingGraphics); 132 const resolvedBackgroundConfig = useStageBackground(track); 133 reactExports.useEffect(() => { 134 const loadConfigs = async () => { 135 try { 136 const [charRes, instRes, clothRes, bgRes, presetsRes] = await Promise.all([ 137 fetch("/api/settings/stage_characters_config"), 138 fetch("/api/settings/stage_instruments_config"), 139 fetch("/api/settings/stage_clothing_config") 140 ]); 141 if (charRes.ok) { 142 const data = await charRes.json(); 143 if (data && data.value && Object.keys(data.value).length > 0) { 144 setPuppetConfigs(mergeAllConfigsWithGorilla(data.value)); 145 } 146 } 147 if (instRes.ok) { 148 const data = await instRes.json(); 149 if (data && data.value && data.value.melodic && data.value.percussion) { 150 const melodic = {}; 151 const percussion = {}; 152 Object.entries(data.value.melodic).forEach(([k, v]) => { 153 melodic[Number(k)] = v; 154 }); 155 Object.entries(data.value.percussion).forEach(([k, v]) => { 156 percussion[Number(k)] = v; 157 }); 158 setInstrumentConfigs({ melodic, percussion }); 159 } 160 } 161 if (clothRes.ok) { 162 const data = await clothRes.json(); 163 if (data && data.value && Object.keys(data.value).length > 0) { 164 const merged = { ...defaultClothingGraphics }; 165 Object.entries(data.value).forEach(([id, savedDef]) => { 166 if (merged[id]) { 167 merged[id] = { 168 ...merged[id], 169 ...savedDef, 170 parts: { 171 ...merged[id].parts, 172 ...savedDef.parts 173 }, 174 gluing: { 175 ...merged[id].gluing, 176 ...savedDef.gluing 177 } 178 }; 179 } else { 180 merged[id] = savedDef; 181 } 182 }); 183 setClothingConfigs(merged); 184 } 185 } 186 } catch (e) { 187 console.log("Using default configs"); 188 } 189 }; 190 loadConfigs(); 191 }, []); 192 return /* @__PURE__ */ jsxRuntimeExports.jsx( 193 StagePuppetEngine, 194 { 195 track, 196 currentTime, 197 isPlaying, 198 pianoRollData, 199 processedInstruments, 200 uniqueNames, 201 soloedIndex, 202 onSolo, 203 mutedIndices, 204 onMute, 205 onPanChange, 206 puppetConfigs, 207 instrumentConfigs, 208 hiddenTracks, 209 clothingConfigs, 210 backgroundConfig: resolvedBackgroundConfig 211 } 212 ); 213}; 214export { 215 OrchestraVisualizer, 216 OrchestraVisualizer as default 217};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.