// parentScript.js function sfc32(a, b, c, d) { return function () { a >>>= 0; b >>>= 0; c >>>= 0; d >>>= 0; var t = (a + b) | 0; a = b ^ b >>> 9; b = c + (c << 3) | 0; c = (c << 21 | c >>> 11); d = d + 1 | 0; t = t + d | 0; c = c + t | 0; return (t >>> 0) / 4294967296; }; } function cyrb128(str) { let h1 = 1779033703, h2 = 3144134277, h3 = 1013904242, h4 = 2773480762; for (let i = 0, k; i < str.length; i++) { k = str.charCodeAt(i); h1 = h2 ^ Math.imul(h1 ^ k, 597399067); h2 = h3 ^ Math.imul(h2 ^ k, 2869860233); h3 = h4 ^ Math.imul(h3 ^ k, 951274213); h4 = h1 ^ Math.imul(h4 ^ k, 2716044179); } h1 = Math.imul(h3 ^ (h1 >>> 18), 597399067); h2 = Math.imul(h4 ^ (h2 >>> 22), 2869860233); h3 = Math.imul(h1 ^ (h3 >>> 17), 951274213); h4 = Math.imul(h2 ^ (h4 >>> 19), 2716044179); return [h1 >>> 0, h2 >>> 0, h3 >>> 0, h4 >>> 0]; } function randomColor(rng) { return '#' + Math.floor(rng() * 16777215).toString(16).padStart(6, '0'); } function draw(canvasId, traits) { const canvas = document.getElementById(canvasId); const ctx = canvas.getContext("2d"); ctx.fillStyle = traits.Color; ctx.fillRect(0, 0, canvas.width, canvas.height); ctx.fillStyle = '#FFFFFF'; ctx.font = '200px Arial'; ctx.textAlign = 'center'; ctx.textBaseline = 'middle'; ctx.fillText(traits.Digit, canvas.width / 2, canvas.height / 2); } function initializeArt(seed, canvasId) { const rng = sfc32(...cyrb128(seed)); const traits = { Color: randomColor(rng), Digit: Math.floor(rng() * 10).toString() }; draw(canvasId, traits); return traits; } document.addEventListener("DOMContentLoaded", function () { const scriptTag = document.querySelector('script[c]'); const seed = scriptTag ? scriptTag.getAttribute('c') : 'defaultSeed'; initializeArt(seed, "artCanvas"); });