const getSprite = (() => { const stripForm = ["flabebe", "floette", "florges", "vivillon", "basculin", "furfrou", "magearna"]; return pokemon => { pokemon = pokemon .replace("-alola", "-alolan") .replace("-galar", "-galarian") .replace("darmanitan-galarian", "darmanitan-galarian-standard"); if (stripForm.find(s => pokemon.includes(s))) { pokemon = pokemon.replace(/-.*$/, ""); } return `https://img.pokemondb.net/sprites/sword-shield/icon/${pokemon}.png`; } })(); const renderPokemonTileCluster = (area, totalSize, { mu, nu }, scores) => String.raw`
${(100 * scores.size / totalSize).toFixed(2)}% ${mu.hex}
σ = ${scores.sigma.toFixed(2)}
δ = ${scores.delta.toFixed(2)}
Ч = ${scores.ch.toFixed(2)}
Θ = ${scores.bigTheta.toFixed(2)}°
θ = ${scores.theta.toFixed(2)}°
ϕ = ${scores.phi.toFixed(2)}°
μ = (${mu.vector.map(c => c.toFixed(2)).join(", ")})
I = ${scores.inertia.toFixed(2)}
ν = (${nu.map(c => c.toFixed(2)).join(", ")})
N = ${scores.size}px
` const clusterToggles = {}; const renderPokemonTile = (kind, name, { total: { mu, nu, size }, clusters }, scores) => { const clusterToggleId = `${name}-${kind}-pkmn-expand-toggle`; return String.raw`
${name.split("-").map(part => part.charAt(0).toUpperCase() + part.substr(1)).join(" ")}
${mu.hex}
σ = ${scores.total.sigma.toFixed(2)} δ = ${scores.total.delta.toFixed(2)} Ч = ${scores.total.ch.toFixed(2)}
Θ = ${scores.total.bigTheta.toFixed(2)}° θ = ${scores.total.theta.toFixed(2)}° ϕ = ${scores.total.phi.toFixed(2)}°
μ = (${mu.vector.map(c => c.toFixed(2)).join(", ")}) I = ${scores.total.inertia.toFixed(2)}
ν = (${nu.map(c => c.toFixed(2)).join(", ")}) N = ${size}px
${clusters.map((c, i) => renderPokemonTileCluster(`cls${i+1}`, size, c, scores.clusters[i])).join("\n")}
` };