@zencemarketing/spin-scratch-sdk 0.1.0-alpha.1 → 0.1.0-alpha.2
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.
- package/dist/react.cjs.js +79 -17
- package/dist/react.cjs.js.map +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.esm.mjs +79 -17
- package/dist/react.esm.mjs.map +1 -1
- package/dist/spin-wheel-sdk.cjs.js +79 -17
- package/dist/spin-wheel-sdk.cjs.js.map +1 -1
- package/dist/spin-wheel-sdk.d.ts +1 -1
- package/dist/spin-wheel-sdk.esm.mjs +79 -17
- package/dist/spin-wheel-sdk.esm.mjs.map +1 -1
- package/dist/spin-wheel-sdk.umd.js +77 -18
- package/dist/spin-wheel-sdk.umd.js.map +1 -1
- package/dist/spin-wheel-sdk.umd.min.js +1 -1
- package/dist/spin-wheel-sdk.umd.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spin-wheel-sdk.esm.mjs","sources":["../src/styles.js","../src/utils.js","../src/SpinWheel.js","../src/SpinWheelReact.js","../src/scratchStyles.js","../src/ScratchCard.js","../src/ScratchCardReact.js"],"sourcesContent":["/**\n * Generates the full SDK stylesheet as a string, interpolated with theme colors.\n * @param {object} config - Style configuration object\n * @param {object} config.theme - Theme colors\n * @param {string} [config.titleColor] - Custom title color\n * @param {string} [config.subtitleColor] - Custom subtitle color\n * @param {string} [config.backgroundColor] - Custom background color\n * @param {string} [config.backgroundImage] - Custom background image URL\n * @param {string} [config.ringColor] - Custom ring color\n * @param {boolean} [config.ringShadow] - Enable ring shadow\n * @param {boolean} [config.ringAnimation] - Enable ring animation\n * @param {string} [config.pointerColor] - Custom pointer color\n * @param {string} [config.buttonColor] - Custom button color\n * @param {boolean} [config.buttonShadow] - Enable button shadow\n * @param {boolean} [config.buttonAnimation] - Enable button animation\n * @param {string} [config.winCardRedeemButtonColorTop] - Redeem button gradient top\n * @param {string} [config.winCardRedeemButtonColorBottom] - Redeem button gradient bottom\n * @param {string} [config.winCardRedeemButtonTextColor] - Redeem button text color\n * @param {function} hexToRGBA\n * @returns {string}\n */\nexport function buildCSS(config, hexToRGBA) {\n const t = config.theme || {};\n \n // Extract theme colors with fallbacks\n const gold = t.gold || '#e8c547';\n const goldLight = t.goldLight || '#f5d76e';\n const goldDark = t.goldDark || '#c9a227';\n const bgDark = t.bgDark || '#0d0d12';\n const textMuted = t.textMuted || '#9ca3af';\n \n // Configurable colors\n const titleColor = config.titleColor || goldLight;\n const subtitleColor = config.subtitleColor || textMuted;\n const ringColor = config.ringColor || gold;\n const pointerColor = config.pointerColor || gold;\n const buttonBaseColor = config.buttonColor || gold;\n const redeemBtnTop = config.winCardRedeemButtonColorTop || '#15803d';\n const redeemBtnBottom = config.winCardRedeemButtonColorBottom || '#166534';\n const redeemBtnText = config.winCardRedeemButtonTextColor || '#ffffff';\n \n // Feature toggles\n const ringShadow = config.ringShadow !== false;\n const ringAnimation = config.ringAnimation !== false;\n const buttonShadow = config.buttonShadow !== false;\n const buttonAnimation = config.buttonAnimation !== false;\n \n // Computed values\n const glow = hexToRGBA(gold, 0.4);\n const ringGlow = hexToRGBA(ringColor, 0.4);\n const buttonGlow = hexToRGBA(buttonBaseColor, 0.4);\n \n // Background styles\n const bgStyle = config.backgroundColor \n ? `background-color:${config.backgroundColor};` \n : '';\n const bgImageStyle = config.backgroundImage \n ? `background-image:url('${config.backgroundImage}');background-size:cover;background-position:center;` \n : '';\n\n // Ring shadow and animation\n const ringBoxShadow = ringShadow \n ? `box-shadow:0 0 0 2px rgba(0,0,0,.5), 0 0 50px ${ringGlow}, inset 0 2px 4px rgba(255,255,255,.35), inset 0 -2px 4px rgba(0,0,0,.2);`\n : `box-shadow:0 0 0 2px rgba(0,0,0,.5), inset 0 2px 4px rgba(255,255,255,.35), inset 0 -2px 4px rgba(0,0,0,.2);`;\n \n const ringAnimationCSS = ringAnimation \n ? `animation:sw-ring-pulse 3s ease-in-out infinite;` \n : '';\n\n // Button shadow and animation\n const buttonBoxShadow = buttonShadow\n ? `box-shadow:0 4px 0 ${goldDark}, 0 6px 20px ${buttonGlow}, inset 0 1px 0 rgba(255,255,255,.3);`\n : `box-shadow:0 4px 0 ${goldDark}, inset 0 1px 0 rgba(255,255,255,.3);`;\n \n const buttonHoverStyle = buttonAnimation\n ? `.sw-spin-btn:hover:not(:disabled){transform:translateY(-2px);box-shadow:0 6px 0 ${goldDark},0 8px 28px ${buttonGlow},inset 0 1px 0 rgba(255,255,255,.3)}`\n : `.sw-spin-btn:hover:not(:disabled){filter:brightness(1.05)}`;\n \n const buttonActiveStyle = buttonAnimation\n ? `.sw-spin-btn:active:not(:disabled){transform:translateY(2px);box-shadow:0 2px 0 ${goldDark},0 4px 15px ${buttonGlow},inset 0 1px 0 rgba(255,255,255,.2)}`\n : `.sw-spin-btn:active:not(:disabled){transform:translateY(1px)}`;\n\n return `\n/* === SpinWheel SDK v2.1 === */\n@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700;800&family=Outfit:wght@300;500;600;700&display=swap');\n\n.sw-root *, .sw-overlay * { margin:0; padding:0; box-sizing:border-box; }\n\n.sw-root {\n font-family:'Outfit',sans-serif;\n display:flex; flex-direction:column; align-items:center; width:100%;\n ${bgStyle}\n ${bgImageStyle}\n}\n\n/* ── header ── */\n.sw-header { text-align:center; margin-bottom:.5rem; }\n.sw-title {\n font-family:'Playfair Display',serif;\n font-size:clamp(2rem,6vw,3.5rem); font-weight:800; letter-spacing:.02em;\n}\n.sw-title .sw-spin-text {\n color:${titleColor};\n text-shadow:0 0 30px ${hexToRGBA(titleColor, 0.4)}, 0 0 60px ${hexToRGBA(titleColor, 0.2)};\n}\n.sw-title .sw-win-text { color:${goldDark}; }\n.sw-subtitle { margin-top:.5rem; color:${subtitleColor}; font-size:1rem; font-weight:300; }\n\n/* ── wheel ── */\n.sw-wheel-container {\n position:relative; width:min(340px,90vw); aspect-ratio:1; margin:2rem; padding-top:28px;\n}\n.sw-wheel-outer {\n position:absolute; inset:-10px; border-radius:50%;\n background:linear-gradient(145deg,${goldLight} 0%,${ringColor} 25%,${goldDark} 50%,${ringColor} 75%,${goldDark} 100%);\n padding:8px;\n ${ringBoxShadow}\n ${ringAnimationCSS}\n}\n${ringAnimation ? `\n@keyframes sw-ring-pulse {\n 0%,100%{box-shadow:0 0 0 2px rgba(0,0,0,.5),0 0 50px ${ringGlow},inset 0 2px 4px rgba(255,255,255,.35),inset 0 -2px 4px rgba(0,0,0,.2)}\n 50%{box-shadow:0 0 0 2px rgba(0,0,0,.5),0 0 65px ${hexToRGBA(ringColor, 0.5)},inset 0 2px 6px rgba(255,255,255,.4),inset 0 -2px 4px rgba(0,0,0,.2)}\n}` : ''}\n.sw-wheel-inner {\n width:100%; height:100%; border-radius:50%; overflow:hidden;\n position:relative; background:transparent;\n box-shadow:inset 0 0 0 3px rgba(0,0,0,.6);\n}\n.sw-wheel {\n width:100%; height:100%; border-radius:50%; position:relative;\n transition:transform .1s linear; will-change:transform;\n}\n.sw-wheel.sw-spinning { transition:none; }\n\n/* ── hub ── */\n.sw-wheel-hub {\n position:absolute; left:50%; top:50%; transform:translate(-50%,-50%);\n width:20%; height:20%; min-width:52px; min-height:52px; border-radius:50%;\n background:linear-gradient(145deg,${goldLight} 0%,${gold} 40%,${goldDark} 100%);\n box-shadow:0 3px 12px rgba(0,0,0,.4), inset 0 2px 4px rgba(255,255,255,.4), inset 0 -1px 2px rgba(0,0,0,.2);\n display:flex; flex-direction:column; align-items:center; justify-content:center;\n z-index:10; cursor:pointer; transition:transform .15s ease, filter .15s ease;\n}\n.sw-wheel-hub:hover { transform:translate(-50%,-50%) scale(1.05); filter:brightness(1.1); }\n.sw-wheel-hub:active { transform:translate(-50%,-50%) scale(.98); }\n.sw-wheel-hub-icon { font-size:12px; color:#1a1a1f; line-height:1; margin-bottom:1px; }\n.sw-wheel-hub-brand { font-size:8px; font-weight:700; color:#1a1a1f; letter-spacing:.02em; text-transform:lowercase; }\n.sw-wheel-hub-brand::first-letter { text-transform:uppercase; }\n\n/* ── segments ── */\n.sw-segment {\n position:absolute; width:50%; height:50%; left:50%; top:50%;\n transform-origin:0% 0%; display:flex; align-items:center; justify-content:center; border:none;\n}\n.sw-segment-content {\n position:absolute; width:70%; top:30%; text-align:center; color:#000; font-weight:600;\n font-size:clamp(.6rem,2vw,.8rem); text-shadow:0 1px 3px rgb(220 220 220/50%);\n display:flex; flex-direction:row; align-items:center; justify-content:center;\n gap:4px; word-wrap:break-word; left:30%;\n}\n.sw-segment-icon { font-size:1em; line-height:1; flex-shrink:0; }\n.sw-segment-label { display:inline-block; }\n\n/* ── pointer ── */\n.sw-pointer {\n position:absolute; top:4px; left:50%; transform:translateX(-50%); z-index:20; width:0; height:0;\n}\n.sw-pointer-outer {\n position:absolute; left:50%; transform:translateX(-50%); width:0; height:0;\n border-left:22px solid transparent; border-right:22px solid transparent;\n border-top:36px solid ${pointerColor};\n filter:drop-shadow(0 3px 8px rgba(0,0,0,.5)) drop-shadow(0 0 10px ${hexToRGBA(pointerColor, 0.4)}); top:-40px;\n}\n.sw-pointer.sw-highlight .sw-pointer-outer {\n animation:sw-pointer-bounce .5s cubic-bezier(.34,1.56,.64,1);\n}\n@keyframes sw-pointer-bounce {\n 0%{transform:translateX(-50%) scale(1)}\n 40%{transform:translateX(-50%) scale(1.12)}\n 100%{transform:translateX(-50%) scale(1)}\n}\n\n/* ── spin button ── */\n.sw-spin-btn {\n font-family:'Outfit',sans-serif; font-size:1.25rem; font-weight:700;\n letter-spacing:.15em; padding:1rem 3rem; border:none; border-radius:12px;\n background:linear-gradient(180deg,${goldLight},${goldDark}); color:#1a1a1f;\n cursor:pointer;\n ${buttonBoxShadow}\n transition:transform .15s ease, box-shadow .2s ease, filter .2s ease;\n}\n${buttonHoverStyle}\n${buttonActiveStyle}\n.sw-spin-btn:disabled{opacity:.6;cursor:not-allowed}\n\n/* ── overlay & win card ── */\n.sw-overlay {\n position:fixed; inset:0; background:rgba(0,0,0,.6); backdrop-filter:blur(6px);\n display:flex; align-items:center; justify-content:center;\n z-index:100; opacity:0; visibility:hidden;\n transition:opacity .4s ease, visibility .4s ease;\n font-family:'Outfit',sans-serif;\n}\n.sw-overlay.sw-visible { opacity:1; visibility:visible; }\n\n.sw-win-card {\n position:relative; max-width:340px; width:90%; border-radius:12px; overflow:hidden;\n box-shadow:0 25px 50px -12px rgba(0,0,0,.5), 0 0 0 1px rgba(0,0,0,.1);\n transform:scale(.6); opacity:0; transition:none;\n}\n.sw-overlay.sw-visible .sw-win-card {\n animation:sw-card-flare .6s cubic-bezier(.34,1.56,.64,1) forwards;\n}\n@keyframes sw-card-flare {\n 0%{transform:scale(.6);opacity:0;filter:blur(8px)}\n 50%{transform:scale(1.08);opacity:1;filter:blur(0)}\n 70%{transform:scale(.98)}\n 100%{transform:scale(1);opacity:1;filter:blur(0)}\n}\n\n.sw-win-card-top {\n background:linear-gradient(160deg,#fff,#fff); padding:1.75rem 1.25rem;\n text-align:center; position:relative;\n}\n.sw-win-card-product {\n width:100px; height:100px; margin:0 auto .75rem; border-radius:12px;\n display:flex; align-items:center; justify-content:center; font-size:3rem;\n box-shadow:0 8px 24px rgba(0,0,0,.3); background:linear-gradient(145deg,#252530,#1c1c24);\n}\n.sw-win-card-brand { font-size:1rem; font-weight:600; color:#000; letter-spacing:.05em; }\n\n.sw-win-card-perf { height:14px; background:#fff; position:relative; }\n.sw-win-card-perf::after {\n content:''; position:absolute; left:0; right:0; top:-7px; height:14px;\n background:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='14' viewBox='0 0 12 14'%3E%3Cpath fill='%231a1a22' d='M0 14V7h2v7H0zm2 0V4h2v10H2zm2 0V7h2v7H4zm2 0V4h2v10H6zm2 0V7h2v7H8zm2 0V0h2v14h-2z'/%3E%3C/svg%3E\") repeat-x;\n background-size:12px 14px;\n}\n\n.sw-win-card-mid {\n background:#fff; padding:1.25rem 1.25rem 1.25rem 1rem; position:relative;\n}\n.sw-win-card-title {\n font-size:1rem; font-weight:700; color:#1a1a1f;\n text-transform:lowercase; margin-bottom:.25rem; line-height:1.3;\n}\n.sw-win-card-title::first-letter { text-transform:uppercase; }\n.sw-win-card-worth { font-size:.8rem; color:#6b7280; margin-bottom:.75rem; font-weight:500; }\n.sw-win-card-code-wrap { display:flex; align-items:center; gap:.5rem; }\n.sw-win-card-code {\n flex:1; font-size:.85rem; font-weight:600; letter-spacing:.08em;\n color:#374151; background:#f3f4f6; border:none; border-radius:8px;\n padding:.5rem .75rem; font-family:'Outfit',monospace;\n}\n.sw-win-card-copy {\n width:40px; height:40px; border-radius:8px; border:none;\n background:#e5e7eb; color:#4b5563; cursor:pointer;\n display:flex; align-items:center; justify-content:center;\n transition:background .2s, color .2s;\n}\n.sw-win-card-copy:hover { background:#d1d5db; color:#1f2937; }\n.sw-win-card-copy svg { width:18px; height:18px; }\n\n.sw-win-card-bot {\n background:linear-gradient(180deg,${redeemBtnTop},${redeemBtnBottom});\n padding:1rem 1.25rem; display:flex; align-items:center;\n justify-content:center; gap:.5rem; cursor:pointer;\n transition:filter .2s; position:relative;\n}\n.sw-win-card-bot:hover { filter:brightness(1.08); }\n.sw-win-card-redeem { font-size:1rem; font-weight:700; color:${redeemBtnText}; letter-spacing:.02em; }\n.sw-win-card-arrow { width:20px; height:20px; color:${redeemBtnText}; }\n\n/* ── confetti ── */\n.sw-confetti {\n position:fixed; inset:0; pointer-events:none; z-index:99; overflow:hidden;\n}\n.sw-confetti span {\n position:absolute; width:10px; height:10px; border-radius:2px;\n animation:sw-confetti-fall 1.2s ease-out forwards; opacity:0;\n}\n.sw-overlay.sw-visible .sw-confetti span { opacity:1; }\n@keyframes sw-confetti-fall {\n 0%{transform:translateY(-20px) rotate(0deg);opacity:1}\n 100%{transform:translateY(100vh) rotate(720deg);opacity:0}\n}\n\n/* ── prefers-reduced-motion ── */\n@media (prefers-reduced-motion: reduce) {\n .sw-wheel { transition:none !important; }\n .sw-wheel-outer { animation:none !important; }\n .sw-spin-btn { transition:none !important; }\n .sw-spin-btn:hover:not(:disabled) { transform:none !important; }\n .sw-spin-btn:active:not(:disabled) { transform:none !important; }\n .sw-overlay.sw-visible .sw-win-card { animation:none !important; opacity:1; transform:scale(1); }\n .sw-confetti span { animation:none !important; display:none; }\n .sw-pointer.sw-highlight .sw-pointer-outer { animation:none !important; }\n}\n`;\n}\n","/**\n * SpinWheel SDK – Utility helpers\n * Pure functions with no side effects.\n */\n\n/**\n * Convert a hex colour (#rrggbb) to an rgba() string.\n * @param {string} hex\n * @param {number} alpha\n * @returns {string}\n */\nexport function hexToRGBA(hex, alpha) {\n if (!hex || typeof hex !== 'string') return `rgba(0,0,0,${alpha})`;\n const cleanHex = hex.replace('#', '');\n const r = parseInt(cleanHex.slice(0, 2), 16) || 0;\n const g = parseInt(cleanHex.slice(2, 4), 16) || 0;\n const b = parseInt(cleanHex.slice(4, 6), 16) || 0;\n return `rgba(${r},${g},${b},${alpha})`;\n}\n\n/**\n * Check if a value is a plain object (not array, null, etc.)\n * @param {any} item\n * @returns {boolean}\n */\nexport function isPlainObject(item) {\n return item !== null && typeof item === 'object' && !Array.isArray(item) && item.constructor === Object;\n}\n\n/**\n * Deep merge multiple objects together.\n * Later objects override earlier ones. Arrays are replaced, not merged.\n * @param {object} target - The target object to merge into\n * @param {...object} sources - Source objects to merge from\n * @returns {object} The merged object\n */\nexport function deepMerge(target, ...sources) {\n if (!sources.length) return target;\n const source = sources.shift();\n\n if (isPlainObject(target) && isPlainObject(source)) {\n for (const key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n if (isPlainObject(source[key])) {\n if (!target[key]) {\n target[key] = {};\n }\n deepMerge(target[key], source[key]);\n } else if (source[key] !== undefined) {\n target[key] = source[key];\n }\n }\n }\n }\n\n return deepMerge(target, ...sources);\n}\n\n/**\n * Generate a random alphanumeric coupon code.\n * @param {number} [len=9]\n * @returns {string}\n */\nexport function randomCode(len = 9) {\n const chars = 'ABCDEFGHJKLMNPQRSTUVWXYZ23456789';\n let code = '';\n for (let i = 0; i < len; i++) {\n code += chars[Math.floor(Math.random() * chars.length)];\n }\n return code;\n}\n\n/**\n * Build a CSS `clip-path: polygon(…)` for a pie-slice with a curved outer edge.\n * @param {number} angleDeg – angular width of one segment in degrees\n * @returns {string}\n */\nexport function buildClipPath(angleDeg) {\n const points = ['0 0'];\n const steps = Math.max(12, Math.round(angleDeg / 3));\n const rad = (angleDeg * Math.PI) / 180;\n for (let i = 0; i <= steps; i++) {\n const a = (i / steps) * rad;\n const x = (Math.cos(a) * 100).toFixed(2);\n const y = (Math.sin(a) * 100).toFixed(2);\n points.push(`${x}% ${y}%`);\n }\n return `polygon(${points.join(', ')})`;\n}\n\n/**\n * Text rotation angle so label reads along the bisector of a segment.\n * @param {number} angleDeg\n * @returns {number}\n */\nexport function textRotation(angleDeg) {\n return 90 + angleDeg / 2;\n}\n\n/**\n * Escape HTML special characters.\n * @param {string} str\n * @returns {string}\n */\nexport function escapeHtml(str) {\n if (!str) return '';\n return String(str)\n .replace(/&/g, '&')\n .replace(/</g, '<')\n .replace(/>/g, '>')\n .replace(/\"/g, '"');\n}\n\n/** SVG markup for the copy icon */\nexport const COPY_ICON_SVG =\n '<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect x=\"9\" y=\"9\" width=\"13\" height=\"13\" rx=\"2\" ry=\"2\"/><path d=\"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1\"/></svg>';\n\n/** SVG markup for the check (copied) icon */\nexport const CHECK_ICON_SVG =\n '<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><polyline points=\"20 6 9 17 4 12\"/></svg>';\n\n/** SVG markup for the arrow icon */\nexport const ARROW_ICON_SVG =\n '<svg class=\"sw-win-card-arrow\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><line x1=\"5\" y1=\"12\" x2=\"19\" y2=\"12\"/><polyline points=\"12 5 19 12 12 19\"/></svg>';\n\n/** Default confetti palette */\nexport const CONFETTI_COLORS = ['#e8c547', '#dc2626', '#16a34a', '#2563eb', '#7c3aed', '#ea580c'];\n","/**\n * SpinWheel SDK v0.1.0\n *\n * A fully dynamic, configurable Spin & Win wheel.\n * ES6 class-based. Outputs: UMD · ESM · CJS via Rollup.\n *\n * @example\n * import { SpinWheel } from 'spin-wheel-sdk';\n *\n * const wheel = SpinWheel.init({\n * container: '#app',\n * segments: [\n * { label: 'Prize 1', color: '#55efc4', icon: '🎁' },\n * { label: 'Prize 2', color: '#81ecec', icon: '✨' },\n * ],\n * onSpinEnd(prize, idx) { console.log(prize); },\n * });\n */\n\nimport { buildCSS } from './styles.js';\nimport {\n hexToRGBA,\n randomCode,\n buildClipPath,\n textRotation,\n escapeHtml,\n deepMerge,\n COPY_ICON_SVG,\n CHECK_ICON_SVG,\n ARROW_ICON_SVG,\n CONFETTI_COLORS,\n} from './utils.js';\n\n/* ------------------------------------------------------------------ */\n/* Default configuration */\n/* ------------------------------------------------------------------ */\n\n/** @type {SpinWheelOptions} */\nconst DEFAULTS = Object.freeze({\n // ── Core ──\n container: null,\n segments: [],\n winningIndex: null,\n\n // ── Spin Behavior ──\n spinDuration: 5000,\n minSpins: 5,\n maxSpins: 8,\n spinLimit: null, // null = unlimited, number = max spins allowed\n\n // ── Header UI ──\n headerTitle: null,\n headerSubtitle: null,\n titleColor: null, // uses theme.goldLight if null\n subtitleColor: null, // uses theme.textMuted if null\n\n // ── Hub (center button) ──\n hubLabel: 'Spin & win',\n hubIcon: '▲',\n\n // ── Spin Button ──\n showButton: true,\n buttonText: 'SPIN!',\n\n // ── Wheel Appearance ──\n backgroundColor: null, // page/container background\n backgroundImage: null, // optional background image URL\n ringColor: null, // uses theme gradient if null\n ringShadow: true,\n ringAnimation: true, // pulsing ring glow animation\n pointerColor: null, // uses theme.gold if null\n buttonColor: null, // uses theme gradient if null\n buttonShadow: true,\n buttonAnimation: true, // hover/active animations\n\n // ── Win Card ──\n showWinCard: true,\n generateCode: true,\n codeLength: 9,\n redeemUrl: null,\n winCardBrandLabel: null, // uses hubLabel if null\n winCardWorthLabel: 'WORTH',\n winCardRedeemButtonText: 'Redeem Now',\n winCardRedeemButtonColorTop: '#15803d',\n winCardRedeemButtonColorBottom: '#166534',\n winCardRedeemButtonTextColor: '#ffffff',\n\n // ── Confetti ──\n confettiOnWin: true,\n confettiColors: null, // uses default CONFETTI_COLORS if null\n confettiCount: 40,\n\n // ── Theme Colors ──\n theme: Object.freeze({\n gold: '#e8c547',\n goldLight: '#f5d76e',\n goldDark: '#c9a227',\n bgDark: '#0d0d12',\n textMuted: '#9ca3af',\n }),\n\n // ── Callbacks ──\n onSpinStart: null,\n onSpinEnd: null,\n onRedeem: null,\n onSpinLimitReached: null,\n});\n\n/* ------------------------------------------------------------------ */\n/* Validation */\n/* ------------------------------------------------------------------ */\n\nfunction _validateOptions(opts) {\n // Container — truly required, cannot default\n if (!opts.container) {\n throw new Error('[SpinWheel] \"container\" is required.');\n }\n\n // Segments — truly required, cannot default\n if (!Array.isArray(opts.segments) || opts.segments.length < 2) {\n throw new Error('[SpinWheel] \"segments\" must be an array with at least 2 items.');\n }\n for (let i = 0; i < opts.segments.length; i++) {\n const s = opts.segments[i];\n if (!s || typeof s !== 'object') {\n throw new Error(`[SpinWheel] segments[${i}] must be an object.`);\n }\n if (!s.label || typeof s.label !== 'string') {\n throw new Error(`[SpinWheel] segments[${i}].label is required and must be a string.`);\n }\n if (!s.color || typeof s.color !== 'string') {\n throw new Error(`[SpinWheel] segments[${i}].color is required and must be a string.`);\n }\n }\n\n // ── Clamp / auto-fix numeric & enum values instead of crashing ──\n\n // spinDuration: clamp to min 500\n if (opts.spinDuration !== undefined) {\n if (typeof opts.spinDuration !== 'number' || isNaN(opts.spinDuration)) {\n console.warn('[SpinWheel] \"spinDuration\" must be a number. Using default (5000).');\n opts.spinDuration = DEFAULTS.spinDuration;\n } else if (opts.spinDuration <= 0) {\n console.warn(`[SpinWheel] \"spinDuration\" (${opts.spinDuration}) must be positive. Clamping to 500.`);\n opts.spinDuration = 500;\n }\n }\n\n // codeLength: clamp to min 1\n if (opts.codeLength !== undefined) {\n if (typeof opts.codeLength !== 'number' || isNaN(opts.codeLength)) {\n console.warn('[SpinWheel] \"codeLength\" must be a number. Using default (9).');\n opts.codeLength = DEFAULTS.codeLength;\n } else if (opts.codeLength < 1) {\n console.warn(`[SpinWheel] \"codeLength\" (${opts.codeLength}) is below 1. Clamping to 1.`);\n opts.codeLength = 1;\n } else {\n opts.codeLength = Math.floor(opts.codeLength);\n }\n }\n\n // confettiCount: clamp to min 0\n if (opts.confettiCount !== undefined) {\n if (typeof opts.confettiCount !== 'number' || isNaN(opts.confettiCount)) {\n console.warn('[SpinWheel] \"confettiCount\" must be a number. Using default (40).');\n opts.confettiCount = DEFAULTS.confettiCount;\n } else if (opts.confettiCount < 0) {\n console.warn(`[SpinWheel] \"confettiCount\" (${opts.confettiCount}) is negative. Clamping to 0.`);\n opts.confettiCount = 0;\n }\n }\n\n // minSpins & maxSpins: ensure min <= max, swap if needed\n if (opts.minSpins !== undefined) {\n if (typeof opts.minSpins !== 'number' || isNaN(opts.minSpins)) {\n console.warn('[SpinWheel] \"minSpins\" must be a number. Using default (5).');\n opts.minSpins = DEFAULTS.minSpins;\n } else if (opts.minSpins < 1) {\n console.warn(`[SpinWheel] \"minSpins\" (${opts.minSpins}) is below 1. Clamping to 1.`);\n opts.minSpins = 1;\n }\n }\n if (opts.maxSpins !== undefined) {\n if (typeof opts.maxSpins !== 'number' || isNaN(opts.maxSpins)) {\n console.warn('[SpinWheel] \"maxSpins\" must be a number. Using default (8).');\n opts.maxSpins = DEFAULTS.maxSpins;\n } else if (opts.maxSpins < 1) {\n console.warn(`[SpinWheel] \"maxSpins\" (${opts.maxSpins}) is below 1. Clamping to 1.`);\n opts.maxSpins = 1;\n }\n }\n const min = opts.minSpins ?? DEFAULTS.minSpins;\n const max = opts.maxSpins ?? DEFAULTS.maxSpins;\n if (typeof min === 'number' && typeof max === 'number' && min > max) {\n console.warn(`[SpinWheel] \"minSpins\" (${min}) is greater than \"maxSpins\" (${max}). Swapping values.`);\n opts.minSpins = max;\n opts.maxSpins = min;\n }\n\n // spinLimit: clamp to min 1 if not null\n if (opts.spinLimit !== undefined && opts.spinLimit !== null) {\n if (typeof opts.spinLimit !== 'number' || isNaN(opts.spinLimit)) {\n console.warn('[SpinWheel] \"spinLimit\" must be a positive number or null. Setting to null (unlimited).');\n opts.spinLimit = null;\n } else if (opts.spinLimit < 1) {\n console.warn(`[SpinWheel] \"spinLimit\" (${opts.spinLimit}) is below 1. Clamping to 1.`);\n opts.spinLimit = 1;\n }\n }\n\n // winningIndex: clamp to valid segment range\n if (opts.winningIndex !== undefined && opts.winningIndex !== null) {\n if (typeof opts.winningIndex !== 'number' || isNaN(opts.winningIndex)) {\n console.warn('[SpinWheel] \"winningIndex\" must be a number or null. Setting to null (random).');\n opts.winningIndex = null;\n } else if (opts.winningIndex < 0) {\n console.warn(`[SpinWheel] \"winningIndex\" (${opts.winningIndex}) is negative. Clamping to 0.`);\n opts.winningIndex = 0;\n } else if (opts.winningIndex >= opts.segments.length) {\n const maxIdx = opts.segments.length - 1;\n console.warn(`[SpinWheel] \"winningIndex\" (${opts.winningIndex}) exceeds max (${maxIdx}). Clamping to ${maxIdx}.`);\n opts.winningIndex = maxIdx;\n }\n }\n}\n\n/* ------------------------------------------------------------------ */\n/* SSR guard */\n/* ------------------------------------------------------------------ */\n\nconst _isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';\n\n/** @returns {boolean} Whether the user prefers reduced motion */\nfunction _prefersReducedMotion() {\n return _isBrowser && window.matchMedia?.('(prefers-reduced-motion: reduce)')?.matches;\n}\n\n/* ------------------------------------------------------------------ */\n/* CSS injection (once per page) */\n/* ------------------------------------------------------------------ */\n\nlet _injectedThemeKey = null;\n\nfunction injectCSS(options) {\n if (!_isBrowser) return;\n const theme = { ...DEFAULTS.theme, ...(options.theme || {}) };\n \n // Build a key from all style-affecting options\n const styleConfig = {\n theme,\n titleColor: options.titleColor,\n subtitleColor: options.subtitleColor,\n backgroundColor: options.backgroundColor,\n backgroundImage: options.backgroundImage,\n ringColor: options.ringColor,\n ringShadow: options.ringShadow,\n ringAnimation: options.ringAnimation,\n pointerColor: options.pointerColor,\n buttonColor: options.buttonColor,\n buttonShadow: options.buttonShadow,\n buttonAnimation: options.buttonAnimation,\n winCardRedeemButtonColorTop: options.winCardRedeemButtonColorTop,\n winCardRedeemButtonColorBottom: options.winCardRedeemButtonColorBottom,\n winCardRedeemButtonTextColor: options.winCardRedeemButtonTextColor,\n };\n \n const key = JSON.stringify(styleConfig);\n if (_injectedThemeKey === key) return;\n\n // Remove old stylesheet if exists (SSR-safe)\n const existing = _isBrowser ? document.querySelector('style[data-spin-wheel-sdk]') : null;\n if (existing) existing.remove();\n\n _injectedThemeKey = key;\n const style = document.createElement('style');\n style.setAttribute('data-spin-wheel-sdk', '');\n style.textContent = buildCSS(styleConfig, hexToRGBA);\n document.head.appendChild(style);\n}\n\n/* ------------------------------------------------------------------ */\n/* SpinWheel class */\n/* ------------------------------------------------------------------ */\n\nexport class SpinWheelInstance {\n /**\n * @param {SpinWheelOptions} opts\n */\n constructor(opts) {\n if (!_isBrowser) {\n throw new Error('[SpinWheel] SpinWheel requires a browser environment (window + document).');\n }\n\n // ── validate options ──\n _validateOptions(opts);\n\n /** @type {SpinWheelOptions} */\n this.options = deepMerge({}, DEFAULTS, opts);\n \n // Ensure theme is properly merged\n this.options.theme = { ...DEFAULTS.theme, ...(opts.theme || {}) };\n\n /** Current cumulative rotation in degrees */\n this.currentRotation = 0;\n\n /** Whether the wheel is currently animating */\n this.isSpinning = false;\n\n /** Set to true after .destroy() */\n this._destroyed = false;\n\n /** Last prize won */\n this._lastWonPrize = null;\n\n /** Last won index */\n this._lastWonIndex = -1;\n\n /** Number of spins performed */\n this._spinCount = 0;\n\n /** Active requestAnimationFrame ID (for cancellation on destroy) */\n this._rafId = null;\n\n /** Bound listeners stored for removal in destroy() */\n this._boundListeners = {};\n\n // ── resolve container ──\n this.containerEl =\n typeof this.options.container === 'string'\n ? document.querySelector(this.options.container)\n : this.options.container;\n\n if (!this.containerEl) {\n throw new Error('[SpinWheel] container not found. Ensure the container element exists in the DOM.');\n }\n\n /** Angle per segment in degrees */\n this.segmentAngle = 360 / this.options.segments.length;\n\n // ── inject CSS (idempotent) ──\n injectCSS(this.options);\n\n // ── DOM refs (set in _build) ──\n /** @type {HTMLElement} */ this._rootEl = null;\n /** @type {HTMLElement} */ this._wheelEl = null;\n /** @type {HTMLElement} */ this._hubEl = null;\n /** @type {HTMLElement} */ this._pointerEl = null;\n /** @type {HTMLButtonElement} */ this._btnEl = null;\n /** @type {HTMLElement} */ this._overlayEl = null;\n /** @type {HTMLElement} */ this._confettiEl = null;\n /** @type {HTMLElement} */ this._cardProductEl = null;\n /** @type {HTMLElement} */ this._cardBrandEl = null;\n /** @type {HTMLElement} */ this._cardTitleEl = null;\n /** @type {HTMLElement} */ this._cardWorthEl = null;\n /** @type {HTMLInputElement} */ this._cardCodeEl = null;\n /** @type {HTMLButtonElement} */ this._cardCopyEl = null;\n /** @type {HTMLElement} */ this._cardRedeemEl = null;\n /** @type {HTMLElement} */ this._cardRedeemTextEl = null;\n\n // ── build & bind ──\n this._build();\n this._bind();\n }\n\n /* ================================================================ */\n /* DOM construction */\n /* ================================================================ */\n\n /** Build the full widget DOM tree and attach it to the container. */\n _build() {\n const o = this.options;\n\n // ── root wrapper ──\n const root = document.createElement('div');\n root.className = 'sw-root';\n\n // ── header (optional) ──\n if (o.headerTitle) {\n const header = document.createElement('header');\n header.className = 'sw-header';\n const parts = o.headerTitle.split('&');\n header.innerHTML =\n `<h1 class=\"sw-title\">` +\n `<span class=\"sw-spin-text\">${escapeHtml(parts[0] || 'Spin')}</span>` +\n `${parts.length > 1 ? ` <span class=\"sw-win-text\">& ${escapeHtml(parts[1])}</span>` : ''}` +\n `</h1>` +\n (o.headerSubtitle ? `<p class=\"sw-subtitle\">${escapeHtml(o.headerSubtitle)}</p>` : '');\n root.appendChild(header);\n }\n\n // ── wheel container ──\n const wc = document.createElement('div');\n wc.className = 'sw-wheel-container';\n\n const wo = document.createElement('div');\n wo.className = 'sw-wheel-outer';\n\n const wi = document.createElement('div');\n wi.className = 'sw-wheel-inner';\n\n const wheel = document.createElement('div');\n wheel.className = 'sw-wheel';\n this._wheelEl = wheel;\n\n this._buildSegments(wheel);\n\n // hub\n const hub = document.createElement('div');\n hub.className = 'sw-wheel-hub';\n hub.title = 'Spin the wheel';\n hub.innerHTML =\n `<span class=\"sw-wheel-hub-icon\">${escapeHtml(o.hubIcon)}</span>` +\n `<span class=\"sw-wheel-hub-brand\">${escapeHtml(o.hubLabel)}</span>`;\n this._hubEl = hub;\n\n wi.append(wheel, hub);\n wo.appendChild(wi);\n wc.appendChild(wo);\n\n // pointer\n const pointer = document.createElement('div');\n pointer.className = 'sw-pointer';\n pointer.innerHTML = '<div class=\"sw-pointer-outer\"></div>';\n this._pointerEl = pointer;\n wc.appendChild(pointer);\n\n root.appendChild(wc);\n\n // ── spin button ──\n if (o.showButton) {\n const btn = document.createElement('button');\n btn.className = 'sw-spin-btn';\n btn.type = 'button';\n btn.textContent = o.buttonText;\n this._btnEl = btn;\n root.appendChild(btn);\n }\n\n this.containerEl.appendChild(root);\n this._rootEl = root;\n\n // ── overlay ──\n if (o.showWinCard) {\n this._buildOverlay();\n }\n }\n\n /**\n * Render pie-slice segments into the given wheel element.\n * @param {HTMLElement} wheel\n */\n _buildSegments(wheel) {\n const angle = this.segmentAngle;\n const clip = buildClipPath(angle);\n const rot = textRotation(angle);\n const segments = this.options.segments;\n\n for (let i = 0; i < segments.length; i++) {\n const p = segments[i];\n const seg = document.createElement('div');\n seg.className = 'sw-segment';\n seg.style.transform = `rotate(${i * angle}deg)`;\n seg.style.clipPath = clip;\n seg.style.webkitClipPath = clip;\n seg.style.background = p.color || '#ccc';\n seg.innerHTML =\n `<div class=\"sw-segment-content\" style=\"transform:rotate(${rot}deg)\">` +\n `<span class=\"sw-segment-icon\">${escapeHtml(p.icon || '')}</span>` +\n `<span class=\"sw-segment-label\">${escapeHtml(p.label)}</span>` +\n `</div>`;\n wheel.appendChild(seg);\n }\n }\n\n /** Build the win-card overlay and append it to <body>. */\n _buildOverlay() {\n const o = this.options;\n const brandLabel = o.winCardBrandLabel || o.hubLabel;\n const redeemText = o.winCardRedeemButtonText || 'Redeem Now';\n \n const overlay = document.createElement('div');\n overlay.className = 'sw-overlay';\n\n const confetti = document.createElement('div');\n confetti.className = 'sw-confetti';\n this._confettiEl = confetti;\n\n const card = document.createElement('div');\n card.className = 'sw-win-card';\n card.innerHTML =\n `<div class=\"sw-win-card-top\">` +\n ` <div class=\"sw-win-card-product\">🎁</div>` +\n ` <div class=\"sw-win-card-brand\">${escapeHtml(brandLabel)}</div>` +\n `</div>` +\n `<div class=\"sw-win-card-perf\"></div>` +\n `<div class=\"sw-win-card-mid\">` +\n ` <div class=\"sw-win-card-title\">Prize</div>` +\n ` <div class=\"sw-win-card-worth\">${escapeHtml(o.winCardWorthLabel)} ₹99</div>` +\n ` <div class=\"sw-win-card-code-wrap\">` +\n ` <input type=\"text\" class=\"sw-win-card-code\" readonly value=\"XXXXXXXXX\" />` +\n ` <button type=\"button\" class=\"sw-win-card-copy\" aria-label=\"Copy code\">${COPY_ICON_SVG}</button>` +\n ` </div>` +\n `</div>` +\n `<div class=\"sw-win-card-bot\">` +\n ` <span class=\"sw-win-card-redeem\">${escapeHtml(redeemText)}</span>` +\n ` ${ARROW_ICON_SVG}` +\n `</div>`;\n\n overlay.append(confetti, card);\n this.containerEl.appendChild(overlay);\n\n this._overlayEl = overlay;\n this._cardProductEl = card.querySelector('.sw-win-card-product');\n this._cardBrandEl = card.querySelector('.sw-win-card-brand');\n this._cardTitleEl = card.querySelector('.sw-win-card-title');\n this._cardWorthEl = card.querySelector('.sw-win-card-worth');\n this._cardCodeEl = card.querySelector('.sw-win-card-code');\n this._cardCopyEl = card.querySelector('.sw-win-card-copy');\n this._cardRedeemEl = card.querySelector('.sw-win-card-bot');\n this._cardRedeemTextEl = card.querySelector('.sw-win-card-redeem');\n }\n\n /* ================================================================ */\n /* Event binding */\n /* ================================================================ */\n\n /** Wire up all interactive event listeners with proper references for cleanup. */\n _bind() {\n const bl = this._boundListeners;\n\n // Spin button\n if (this._btnEl) {\n bl._btnClick = () => this.spin();\n this._btnEl.addEventListener('click', bl._btnClick);\n }\n\n // Hub click + keyboard (Enter / Space)\n if (this._hubEl) {\n this._hubEl.setAttribute('tabindex', '0');\n this._hubEl.setAttribute('role', 'button');\n this._hubEl.setAttribute('aria-label', 'Spin the wheel');\n\n bl._hubClick = (e) => { e.stopPropagation(); this.spin(); };\n bl._hubKeydown = (e) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n this.spin();\n }\n };\n this._hubEl.addEventListener('click', bl._hubClick);\n this._hubEl.addEventListener('keydown', bl._hubKeydown);\n }\n\n // Keyboard: Enter/Space on spin button\n if (this._btnEl) {\n bl._btnKeydown = (e) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n this.spin();\n }\n };\n this._btnEl.addEventListener('keydown', bl._btnKeydown);\n }\n\n // Overlay events\n if (this._overlayEl) {\n bl._overlayClick = (e) => {\n if (e.target === this._overlayEl) this.hideWinCard();\n };\n this._overlayEl.addEventListener('click', bl._overlayClick);\n\n bl._copyClick = (e) => {\n e.stopPropagation();\n const code = this._cardCodeEl.value;\n this._cardCodeEl.select();\n this._cardCodeEl.setSelectionRange(0, 999);\n if (navigator.clipboard?.writeText) {\n navigator.clipboard.writeText(code).then(() => this._showCopied());\n } else {\n try { document.execCommand('copy'); this._showCopied(); } catch (_) { /* noop */ }\n }\n };\n this._cardCopyEl.addEventListener('click', bl._copyClick);\n\n bl._redeemClick = (e) => {\n e.stopPropagation();\n if (typeof this.options.onRedeem === 'function') {\n try { this.options.onRedeem(this._lastWonPrize); } catch (err) { console.error('[SpinWheel] onRedeem callback error:', err); }\n }\n if (this.options.redeemUrl) {\n window.open(this.options.redeemUrl, '_blank', 'noopener,noreferrer');\n }\n this.hideWinCard();\n };\n this._cardRedeemEl.addEventListener('click', bl._redeemClick);\n }\n\n // Global keyboard: Escape closes win card\n bl._docKeydown = (e) => {\n if (e.key === 'Escape' && this._overlayEl?.classList.contains('sw-visible')) {\n this.hideWinCard();\n }\n };\n document.addEventListener('keydown', bl._docKeydown);\n }\n\n /** Temporarily swap the copy button icon to a checkmark. */\n _showCopied() {\n if (!this._cardCopyEl || this._destroyed) return;\n this._cardCopyEl.innerHTML = CHECK_ICON_SVG;\n setTimeout(() => { if (this._cardCopyEl) this._cardCopyEl.innerHTML = COPY_ICON_SVG; }, 1500);\n }\n\n /* ================================================================ */\n /* Public API */\n /* ================================================================ */\n\n /**\n * Check if spin limit has been reached.\n * @returns {boolean}\n */\n _isSpinLimitReached() {\n const limit = this.options.spinLimit;\n return typeof limit === 'number' && limit > 0 && this._spinCount >= limit;\n }\n\n /**\n * Spin the wheel.\n * Priority: forceIndex > options.winningIndex > random.\n * @param {number} [forceIndex] – optional index to force the result (overrides winningIndex)\n */\n spin(forceIndex) {\n if (this.isSpinning || this._destroyed) return;\n \n // Check spin limit\n if (this._isSpinLimitReached()) {\n if (typeof this.options.onSpinLimitReached === 'function') {\n try { this.options.onSpinLimitReached(this._spinCount); } catch (err) { console.error('[SpinWheel] onSpinLimitReached callback error:', err); }\n }\n return;\n }\n \n this.isSpinning = true;\n this._spinCount++;\n if (this._btnEl) this._btnEl.disabled = true;\n if (this._wheelEl) this._wheelEl.classList.add('sw-spinning');\n\n const { segments, minSpins, maxSpins, spinDuration, winningIndex } = this.options;\n const count = segments.length;\n const segAngle = this.segmentAngle;\n\n // Resolve winning index: forceIndex > winningIndex > random\n // Clamp forceIndex to valid range if provided\n const isValidIndex = (idx) => typeof idx === 'number' && !isNaN(idx) && idx >= 0 && idx < count;\n\n let winIndex;\n if (forceIndex !== undefined && forceIndex !== null) {\n if (typeof forceIndex === 'number' && !isNaN(forceIndex)) {\n winIndex = Math.max(0, Math.min(count - 1, Math.floor(forceIndex)));\n } else {\n console.warn(`[SpinWheel] spin(forceIndex): invalid forceIndex \"${forceIndex}\". Using random.`);\n winIndex = Math.floor(Math.random() * count);\n }\n } else if (isValidIndex(winningIndex)) {\n winIndex = winningIndex;\n } else {\n winIndex = Math.floor(Math.random() * count);\n }\n\n if (typeof this.options.onSpinStart === 'function') {\n try { this.options.onSpinStart(winIndex); } catch (err) { console.error('[SpinWheel] onSpinStart callback error:', err); }\n }\n\n const segmentCenter = winIndex * segAngle + segAngle / 2;\n const fullSpins = (minSpins || 5) + Math.floor(Math.random() * ((maxSpins || 8) - (minSpins || 5) + 1));\n const pointerAt = 270;\n const remainder = (pointerAt - segmentCenter - (this.currentRotation % 360) + 720) % 360;\n const targetAngle = 360 * fullSpins + remainder;\n const totalRotation = this.currentRotation + targetAngle;\n const duration = spinDuration || 5000;\n const startTime = performance.now();\n const startRot = this.currentRotation;\n\n const animate = (now) => {\n if (this._destroyed) return;\n const elapsed = now - startTime;\n const progress = Math.min(elapsed / duration, 1);\n const easeOut = 1 - Math.pow(1 - progress, 3);\n const rotation = startRot + targetAngle * easeOut;\n if (this._wheelEl) this._wheelEl.style.transform = `rotate(${rotation}deg)`;\n\n if (progress < 1) {\n this._rafId = requestAnimationFrame(animate);\n } else {\n this.currentRotation = totalRotation % 360;\n if (this._wheelEl) {\n this._wheelEl.classList.remove('sw-spinning');\n this._wheelEl.style.transform = `rotate(${this.currentRotation}deg)`;\n }\n this._highlightPointer();\n\n this._lastWonPrize = segments[winIndex];\n this._lastWonIndex = winIndex;\n\n if (typeof this.options.onSpinEnd === 'function') {\n try { this.options.onSpinEnd(segments[winIndex], winIndex); } catch (err) { console.error('[SpinWheel] onSpinEnd callback error:', err); }\n }\n if (this.options.showWinCard) {\n this._showWinCard(segments[winIndex]);\n }\n\n this.isSpinning = false;\n \n // Re-enable button only if spin limit not reached\n if (this._btnEl) {\n this._btnEl.disabled = this._isSpinLimitReached();\n }\n }\n };\n\n this._rafId = requestAnimationFrame(animate);\n }\n\n /** Bounce the pointer for visual feedback. */\n _highlightPointer() {\n if (!this._pointerEl || this._destroyed) return;\n this._pointerEl.classList.remove('sw-highlight');\n void this._pointerEl.offsetHeight; // force reflow\n this._pointerEl.classList.add('sw-highlight');\n setTimeout(() => this._pointerEl.classList.remove('sw-highlight'), 500);\n }\n\n /**\n * Populate and reveal the win-card overlay.\n * @param {SegmentConfig} prize\n */\n _showWinCard(prize) {\n if (!prize || this._destroyed) return;\n const o = this.options;\n \n // Update product icon and background\n if (this._cardProductEl) {\n this._cardProductEl.textContent = prize.icon || '🎁';\n this._cardProductEl.style.background =\n `linear-gradient(145deg,${prize.color || '#252530'}22,${prize.color || '#1c1c24'}11)`;\n }\n \n // Update title\n if (this._cardTitleEl) {\n this._cardTitleEl.textContent = prize.title || prize.label || '';\n }\n \n // Update worth label with configurable prefix\n if (this._cardWorthEl) {\n const worthLabel = o.winCardWorthLabel || 'WORTH';\n this._cardWorthEl.textContent = prize.worth ? `${worthLabel} ${prize.worth}` : '';\n this._cardWorthEl.style.display = prize.worth ? '' : 'none';\n }\n\n // Handle code generation/display\n if (this._cardCodeEl) {\n if (o.generateCode) {\n this._cardCodeEl.value = prize.code || randomCode(o.codeLength);\n if (this._cardCodeEl.parentElement) this._cardCodeEl.parentElement.style.display = '';\n } else if (prize.code) {\n this._cardCodeEl.value = prize.code;\n if (this._cardCodeEl.parentElement) this._cardCodeEl.parentElement.style.display = '';\n } else {\n if (this._cardCodeEl.parentElement) this._cardCodeEl.parentElement.style.display = 'none';\n }\n }\n\n // Update redeem button text if configured\n if (this._cardRedeemTextEl && o.winCardRedeemButtonText) {\n this._cardRedeemTextEl.textContent = o.winCardRedeemButtonText;\n }\n\n // Create confetti only if enabled (and no reduced motion preference)\n if (o.confettiOnWin !== false && !_prefersReducedMotion()) {\n this._createConfetti();\n }\n \n if (this._overlayEl) this._overlayEl.classList.add('sw-visible');\n\n // A11y: announce the win to screen readers\n this._announceToScreenReader(`You won ${prize.title || prize.label || 'a prize'}${prize.worth ? ', worth ' + prize.worth : ''}.`);\n }\n\n /** Programmatically close the win-card overlay. */\n hideWinCard() {\n if (this._overlayEl) this._overlayEl.classList.remove('sw-visible');\n }\n\n /** Generate confetti particles inside the overlay. */\n _createConfetti() {\n if (!this._confettiEl || this._destroyed) return;\n const o = this.options;\n const colors = o.confettiColors || CONFETTI_COLORS;\n const count = o.confettiCount || 40;\n \n this._confettiEl.innerHTML = '';\n for (let i = 0; i < count; i++) {\n const span = document.createElement('span');\n span.style.left = `${Math.random() * 100}%`;\n span.style.top = '-10px';\n span.style.background = colors[Math.floor(Math.random() * colors.length)];\n span.style.animationDelay = `${Math.random() * 0.3}s`;\n span.style.animationDuration = `${0.8 + Math.random() * 0.6}s`;\n this._confettiEl.appendChild(span);\n }\n }\n\n /**\n * Replace all segments at runtime and re-render the wheel.\n * @param {SegmentConfig[]} newSegments\n */\n updateSegments(newSegments) {\n if (this._destroyed) return;\n if (!Array.isArray(newSegments) || newSegments.length < 2) {\n console.warn('[SpinWheel] updateSegments: at least 2 segments are required. Ignoring.');\n return;\n }\n this.options.segments = newSegments;\n this.segmentAngle = 360 / newSegments.length;\n if (this._wheelEl) {\n this._wheelEl.innerHTML = '';\n this._buildSegments(this._wheelEl);\n }\n this.currentRotation = 0;\n if (this._wheelEl) this._wheelEl.style.transform = 'rotate(0deg)';\n }\n\n /**\n * Remove all SDK-created DOM, event listeners, and animation frames.\n * Safe to call multiple times.\n */\n destroy() {\n if (this._destroyed) return;\n this._destroyed = true;\n\n // ── Cancel pending animation frame ──\n if (this._rafId) {\n cancelAnimationFrame(this._rafId);\n this._rafId = null;\n }\n\n // ── Remove all event listeners ──\n const bl = this._boundListeners;\n if (bl._btnClick && this._btnEl) {\n this._btnEl.removeEventListener('click', bl._btnClick);\n this._btnEl.removeEventListener('keydown', bl._btnKeydown);\n }\n if (bl._hubClick && this._hubEl) {\n this._hubEl.removeEventListener('click', bl._hubClick);\n this._hubEl.removeEventListener('keydown', bl._hubKeydown);\n }\n if (bl._overlayClick && this._overlayEl) {\n this._overlayEl.removeEventListener('click', bl._overlayClick);\n }\n if (bl._copyClick && this._cardCopyEl) {\n this._cardCopyEl.removeEventListener('click', bl._copyClick);\n }\n if (bl._redeemClick && this._cardRedeemEl) {\n this._cardRedeemEl.removeEventListener('click', bl._redeemClick);\n }\n if (bl._docKeydown) {\n document.removeEventListener('keydown', bl._docKeydown);\n }\n this._boundListeners = {};\n\n // ── Remove live-region ──\n if (this._liveRegion?.parentNode) {\n this._liveRegion.parentNode.removeChild(this._liveRegion);\n }\n\n // ── Remove DOM ──\n this._rootEl?.parentNode?.removeChild(this._rootEl);\n this._overlayEl?.parentNode?.removeChild(this._overlayEl);\n \n // Clear all DOM references to prevent memory leaks\n this._rootEl = null;\n this._wheelEl = null;\n this._hubEl = null;\n this._pointerEl = null;\n this._btnEl = null;\n this._overlayEl = null;\n this._confettiEl = null;\n this._cardProductEl = null;\n this._cardBrandEl = null;\n this._cardTitleEl = null;\n this._cardWorthEl = null;\n this._cardCodeEl = null;\n this._cardCopyEl = null;\n this._cardRedeemEl = null;\n this._cardRedeemTextEl = null;\n this._liveRegion = null;\n }\n\n /** The last prize that was won. */\n get lastWonPrize() {\n return this._lastWonPrize;\n }\n\n /** The last won segment index. */\n get lastWonIndex() {\n return this._lastWonIndex;\n }\n\n /** The current spin count. */\n get spinCount() {\n return this._spinCount;\n }\n\n /** The remaining spins (null if unlimited). */\n get remainingSpins() {\n const limit = this.options.spinLimit;\n if (typeof limit !== 'number' || limit <= 0) return null;\n return Math.max(0, limit - this._spinCount);\n }\n\n /**\n * Reset the spin count to allow more spins.\n * @param {number} [count=0] - New spin count to set\n */\n resetSpinCount(count = 0) {\n this._spinCount = Math.max(0, typeof count === 'number' && !isNaN(count) ? Math.floor(count) : 0);\n if (this._btnEl) {\n this._btnEl.disabled = this._isSpinLimitReached();\n }\n }\n\n /**\n * Announce a message to screen readers via a visually hidden aria-live region.\n * @param {string} message\n */\n _announceToScreenReader(message) {\n if (!_isBrowser) return;\n if (!this._liveRegion) {\n const el = document.createElement('div');\n el.setAttribute('aria-live', 'assertive');\n el.setAttribute('aria-atomic', 'true');\n el.setAttribute('role', 'status');\n el.style.cssText = 'position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;';\n document.body.appendChild(el);\n this._liveRegion = el;\n }\n this._liveRegion.textContent = '';\n // Slight delay so screen readers pick up the change\n setTimeout(() => { if (this._liveRegion) this._liveRegion.textContent = message; }, 100);\n }\n\n /**\n * Update configuration options at runtime.\n * @param {Partial<SpinWheelOptions>} newOptions\n */\n updateOptions(newOptions) {\n if (this._destroyed) return;\n if (!newOptions || typeof newOptions !== 'object') {\n console.warn('[SpinWheel] updateOptions: argument must be an object. Ignoring.');\n return;\n }\n \n // Sanitize numeric/enum values before merging\n const merged = { ...this.options, ...newOptions, container: this.options.container, segments: this.options.segments };\n _validateOptions(merged);\n // Apply sanitized values back\n for (const key of Object.keys(newOptions)) {\n if (key in merged) newOptions[key] = merged[key];\n }\n \n // Merge new options\n this.options = deepMerge({}, this.options, newOptions);\n \n // Handle theme separately for proper nested merge\n if (newOptions.theme) {\n this.options.theme = { ...DEFAULTS.theme, ...this.options.theme, ...newOptions.theme };\n }\n \n // Re-inject CSS if styling options changed\n injectCSS(this.options);\n \n // Update button text if changed\n if (this._btnEl && newOptions.buttonText !== undefined) {\n this._btnEl.textContent = this.options.buttonText;\n }\n \n // Update hub if changed\n if (this._hubEl) {\n if (newOptions.hubLabel !== undefined || newOptions.hubIcon !== undefined) {\n this._hubEl.innerHTML =\n `<span class=\"sw-wheel-hub-icon\">${escapeHtml(this.options.hubIcon)}</span>` +\n `<span class=\"sw-wheel-hub-brand\">${escapeHtml(this.options.hubLabel)}</span>`;\n }\n }\n \n // Update win card brand label if changed\n if (this._cardBrandEl && (newOptions.winCardBrandLabel !== undefined || newOptions.hubLabel !== undefined)) {\n const brandLabel = this.options.winCardBrandLabel || this.options.hubLabel;\n this._cardBrandEl.textContent = brandLabel;\n }\n \n // Update redeem button text if changed\n if (this._cardRedeemTextEl && newOptions.winCardRedeemButtonText !== undefined) {\n this._cardRedeemTextEl.textContent = this.options.winCardRedeemButtonText;\n }\n }\n}\n\n/* ------------------------------------------------------------------ */\n/* Public factory (namespace) */\n/* ------------------------------------------------------------------ */\n\n/**\n * Static factory to create a SpinWheel instance.\n *\n * @example\n * const wheel = SpinWheel.init({ container: '#app', segments: [...] });\n */\nexport class SpinWheel {\n /**\n * Initialise and mount a new Spin Wheel.\n * @param {SpinWheelOptions} options\n * @returns {SpinWheelInstance}\n */\n static init(options) {\n return new SpinWheelInstance(options);\n }\n\n /** The underlying class – useful for `instanceof` checks or subclassing. */\n static Instance = SpinWheelInstance;\n\n /** Current SDK version – kept in sync with package.json via build banner */\n static VERSION = '0.1.0-alpha.1';\n \n /** Export defaults for reference */\n static DEFAULTS = DEFAULTS;\n}\n\n\n","/**\n * SpinWheel React Component (ES6 class-based wrapper)\n *\n * @example\n * import { SpinWheelReact } from 'spin-wheel-sdk/react';\n *\n * <SpinWheelReact\n * ref={wheelRef}\n * segments={[...]}\n * onSpinEnd={(prize, idx) => console.log(prize)}\n * />\n */\n\nimport { SpinWheel } from './SpinWheel.js';\n\n/**\n * All supported prop keys for SpinWheelReact component.\n * Used for copying props to SDK options.\n */\nconst PROP_KEYS = Object.freeze([\n // Core\n 'segments',\n 'winningIndex',\n \n // Spin Behavior\n 'spinDuration',\n 'minSpins',\n 'maxSpins',\n 'spinLimit',\n \n // Header UI\n 'headerTitle',\n 'headerSubtitle',\n 'titleColor',\n 'subtitleColor',\n \n // Hub\n 'hubLabel',\n 'hubIcon',\n \n // Spin Button\n 'showButton',\n 'buttonText',\n \n // Wheel Appearance\n 'backgroundColor',\n 'backgroundImage',\n 'ringColor',\n 'ringShadow',\n 'ringAnimation',\n 'pointerColor',\n 'buttonColor',\n 'buttonShadow',\n 'buttonAnimation',\n \n // Win Card\n 'showWinCard',\n 'generateCode',\n 'codeLength',\n 'redeemUrl',\n 'winCardBrandLabel',\n 'winCardWorthLabel',\n 'winCardRedeemButtonText',\n 'winCardRedeemButtonColorTop',\n 'winCardRedeemButtonColorBottom',\n 'winCardRedeemButtonTextColor',\n \n // Confetti\n 'confettiOnWin',\n 'confettiColors',\n 'confettiCount',\n \n // Theme\n 'theme',\n]);\n\n/**\n * Creates the SpinWheelReact component using the provided React instance.\n * This factory pattern avoids bundling React into the SDK.\n *\n * @param {typeof import('react')} React – the React module\n * @returns {{ SpinWheelReact: React.ForwardRefExoticComponent }}\n */\nexport function createSpinWheelReact(React) {\n const { useEffect, useRef, useImperativeHandle, forwardRef, createElement } = React;\n\n const SpinWheelReact = forwardRef(function SpinWheelReact(props, ref) {\n const containerRef = useRef(null);\n const instanceRef = useRef(null);\n\n // Keep latest callbacks in a ref so they're always fresh\n const callbacksRef = useRef({});\n callbacksRef.current.onSpinStart = props.onSpinStart;\n callbacksRef.current.onSpinEnd = props.onSpinEnd;\n callbacksRef.current.onRedeem = props.onRedeem;\n callbacksRef.current.onSpinLimitReached = props.onSpinLimitReached;\n\n // Mount the SDK once, destroy on unmount (SSR-safe)\n useEffect(() => {\n if (!containerRef.current || typeof window === 'undefined') return;\n\n const opts = {};\n\n // Copy only defined props\n PROP_KEYS.forEach((k) => {\n if (props[k] !== undefined) opts[k] = props[k];\n });\n\n opts.container = containerRef.current;\n\n // Wrap callbacks so they always point to latest prop\n opts.onSpinStart = (idx) => callbacksRef.current.onSpinStart?.(idx);\n opts.onSpinEnd = (prize, idx) => callbacksRef.current.onSpinEnd?.(prize, idx);\n opts.onRedeem = (prize) => callbacksRef.current.onRedeem?.(prize);\n opts.onSpinLimitReached = (count) => callbacksRef.current.onSpinLimitReached?.(count);\n\n try {\n instanceRef.current = SpinWheel.init(opts);\n } catch (err) {\n console.error('[SpinWheelReact] Failed to initialize SpinWheel:', err);\n }\n\n return () => {\n try {\n instanceRef.current?.destroy();\n } catch (_) { /* noop */ }\n instanceRef.current = null;\n };\n }, []); // mount-only\n\n // Live-update segments when the prop changes\n useEffect(() => {\n if (instanceRef.current && props.segments) {\n try {\n instanceRef.current.updateSegments(props.segments);\n } catch (_) { /* ignore on first mount */ }\n }\n }, [props.segments]);\n\n // Expose imperative handle\n useImperativeHandle(ref, () => ({\n /** Trigger a spin (optionally force the winning index) */\n spin(forceIndex) { instanceRef.current?.spin(forceIndex); },\n\n /** Replace segments at runtime */\n updateSegments(segs) { instanceRef.current?.updateSegments(segs); },\n\n /** Close the win-card overlay */\n hideWinCard() { instanceRef.current?.hideWinCard(); },\n\n /** Update options at runtime */\n updateOptions(opts) { instanceRef.current?.updateOptions(opts); },\n\n /** Reset the spin count */\n resetSpinCount(count) { instanceRef.current?.resetSpinCount(count); },\n\n /** Get the current spin count */\n get spinCount() { return instanceRef.current?.spinCount; },\n\n /** Get remaining spins (null if unlimited) */\n get remainingSpins() { return instanceRef.current?.remainingSpins; },\n\n /** Get the last won prize */\n get lastWonPrize() { return instanceRef.current?.lastWonPrize; },\n\n /** Get the last won index */\n get lastWonIndex() { return instanceRef.current?.lastWonIndex; },\n\n /** Access the raw SpinWheelInstance */\n get instance() { return instanceRef.current; },\n }), []);\n\n return createElement('div', {\n ref: containerRef,\n className: props.className || '',\n style: props.style || {},\n });\n });\n\n SpinWheelReact.displayName = 'SpinWheelReact';\n return SpinWheelReact;\n}\n\n/* ------------------------------------------------------------------\n Auto-detect React on `window` for UMD / CDN usage.\n In bundled ESM builds consumers call createSpinWheelReact(React).\n ------------------------------------------------------------------ */\nlet _SpinWheelReact = null;\n\nif (typeof window !== 'undefined' && window.React) {\n _SpinWheelReact = createSpinWheelReact(window.React);\n}\n\nexport { _SpinWheelReact as SpinWheelReact };\n","/**\n * Generates the ScratchCard SDK stylesheet as a string, interpolated with theme colors.\n * @param {object} config - Style configuration object\n * @param {object} config.theme - Theme colors\n * @param {string} [config.headerTitleColor] - Custom header title color\n * @param {string} [config.instructionColor] - Custom instruction color\n * @param {string} [config.coinGradientStart] - Coin gradient start color\n * @param {string} [config.coinGradientEnd] - Coin gradient end color\n * @param {string} [config.cardBackground] - Card background gradient\n * @param {boolean} [config.cardShadow] - Enable card shadow\n * @param {number} [config.cardBorderRadius] - Card border radius\n * @param {string} [config.scratchZoneBackground] - Scratch zone background\n * @param {boolean} [config.scratchZoneShadow] - Enable scratch zone shadow\n * @param {number} [config.scratchZoneBorderRadius] - Scratch zone border radius\n * @param {string} [config.prizeTextColor] - Prize text color\n * @param {string} [config.prizeNameColor] - Prize name color\n * @param {string} [config.prizeIconBackground] - Prize icon background\n * @param {string} [config.giftIconBackground] - Gift icon background\n * @param {string} [config.modalTitleColor] - Modal title color\n * @param {string} [config.modalButtonColor] - Modal button gradient\n * @param {string} [config.modalButtonTextColor] - Modal button text color\n * @param {boolean} [config.modalBackdropBlur] - Enable modal backdrop blur\n * @param {string} [config.animationType] - Animation type\n * @param {number} [config.animationDuration] - Animation duration\n * @param {function} hexToRGBA\n * @returns {string}\n */\nexport function buildScratchCSS(config, hexToRGBA) {\n const t = config.theme || {};\n \n // Extract theme colors with fallbacks\n const purpleDark = t.purpleDark || '#4a2c6a';\n const purpleMid = t.purpleMid || '#6b4a8a';\n const purpleLight = t.purpleLight || '#8b6baa';\n const gold = t.gold || '#d4a84b';\n const goldLight = t.goldLight || '#e8c547';\n const goldDark = t.goldDark || '#b8923a';\n const white = t.white || '#ffffff';\n const textDark = t.textDark || '#2d2d2d';\n const textMuted = t.textMuted || '#6b6b6b';\n \n // Configurable colors\n const headerTitleColor = config.headerTitleColor || textDark;\n const instructionColor = config.instructionColor || textMuted;\n const coinStart = config.coinGradientStart || goldLight;\n const coinEnd = config.coinGradientEnd || goldDark;\n const prizeTextColor = config.prizeTextColor || 'rgba(255,255,255,0.95)';\n const prizeNameColor = config.prizeNameColor || goldLight;\n const prizeIconBg = config.prizeIconBackground || 'rgba(255,255,255,0.15)';\n const giftIconBg = config.giftIconBackground || 'rgba(255,255,255,0.25)';\n const modalTitleColor = config.modalTitleColor || textDark;\n const modalBtnText = config.modalButtonTextColor || white;\n \n // Feature toggles\n const cardShadow = config.cardShadow !== false;\n const scratchZoneShadow = config.scratchZoneShadow !== false;\n const modalBackdropBlur = config.modalBackdropBlur !== false;\n \n // Dimension configs\n const cardBorderRadius = config.cardBorderRadius || 24;\n const scratchZoneBorderRadius = config.scratchZoneBorderRadius || 20;\n const animDuration = config.animationDuration || 600;\n const animType = config.animationType || 'default';\n \n // Background configs\n const cardBg = config.cardBackground || `linear-gradient(180deg, #faf8fc 0%, #f0ebf5 100%)`;\n const scratchZoneBg = config.scratchZoneBackground || `linear-gradient(145deg, ${purpleDark} 0%, ${purpleMid} 50%, #5a3a7a 100%)`;\n const modalBtnBg = config.modalButtonColor || `linear-gradient(145deg, ${purpleMid} 0%, ${purpleDark} 100%)`;\n \n // Computed values\n const glow = hexToRGBA(gold, 0.4);\n \n // Card shadow styles\n const cardBoxShadow = cardShadow \n ? `box-shadow:0 4px 24px ${hexToRGBA(purpleDark, 0.12)}, 0 12px 48px rgba(0,0,0,0.08);`\n : '';\n \n // Scratch zone shadow styles \n const zoneShadow = scratchZoneShadow\n ? `box-shadow:inset 0 2px 20px rgba(0,0,0,0.2), 0 8px 24px ${hexToRGBA(purpleDark, 0.35)};`\n : '';\n \n // Modal backdrop blur\n const backdropBlur = modalBackdropBlur ? 'backdrop-filter:blur(4px);' : '';\n \n // Animation styles based on type\n const cardAnimation = animType === 'none' ? '' : \n animType === 'bounce' \n ? `animation:sc-card-bounce ${animDuration}ms cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;`\n : `animation:sc-card-slide ${animDuration}ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;`;\n \n const modalAnimation = animType === 'none' ? '' :\n `transition:transform ${animDuration * 0.66}ms cubic-bezier(0.34, 1.56, 0.64, 1);`;\n\n return `\n/* === ScratchCard SDK v1.1 === */\n@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700&display=swap');\n\n.sc-root *, .sc-modal-overlay * { margin:0; padding:0; box-sizing:border-box; }\n\n.sc-root {\n font-family:'Outfit',sans-serif;\n display:flex;\n align-items:center;\n justify-content:center;\n padding:2rem 1rem;\n min-height:100%;\n background:linear-gradient(135deg, #e8e0f0 0%, #d8d0e8 50%, #e0d8f0 100%);\n position:relative;\n overflow:hidden;\n}\n\n.sc-page-bg {\n position:fixed;\n inset:0;\n background:radial-gradient(ellipse 80% 70% at 50% 40%, ${hexToRGBA(purpleMid, 0.15)} 0%, transparent 60%);\n pointer-events:none;\n animation:sc-glow-pulse 4s ease-in-out infinite;\n}\n\n@keyframes sc-glow-pulse {\n 0%, 100% { opacity:1; }\n 50% { opacity:0.7; }\n}\n\n.sc-wrapper {\n position:relative;\n width:min(360px, 92vw);\n ${cardAnimation}\n}\n\n@keyframes sc-card-slide {\n from { opacity:0; transform:translateY(24px) scale(0.96); }\n to { opacity:1; transform:translateY(0) scale(1); }\n}\n\n@keyframes sc-card-bounce {\n 0% { opacity:0; transform:scale(0.5); }\n 60% { opacity:1; transform:scale(1.05); }\n 80% { transform:scale(0.98); }\n 100% { transform:scale(1); }\n}\n\n.sc-main-card {\n background:${cardBg};\n border-radius:${cardBorderRadius}px;\n padding:28px 24px 32px;\n ${cardBoxShadow}\n}\n\n.sc-header {\n text-align:center;\n margin-bottom:20px;\n}\n\n.sc-header h1 {\n font-size:1.5rem;\n font-weight:700;\n color:${headerTitleColor};\n letter-spacing:-0.02em;\n}\n\n.sc-zone {\n position:relative;\n width:100%;\n aspect-ratio:1.05;\n max-height:320px;\n border-radius:${scratchZoneBorderRadius}px;\n overflow:hidden;\n background:${scratchZoneBg};\n ${zoneShadow}\n}\n\n.sc-zone:not(.sc-ready) .sc-prize-content {\n visibility:hidden;\n}\n\n.sc-prize-content {\n position:absolute;\n inset:0;\n z-index:0;\n display:flex;\n flex-direction:column;\n align-items:center;\n justify-content:center;\n padding:20px;\n background:\n radial-gradient(circle at 30% 30%, rgba(255,255,255,0.08) 0%, transparent 45%),\n linear-gradient(145deg, ${purpleDark} 0%, ${purpleMid} 100%);\n}\n\n.sc-prize-content::before {\n content:'';\n position:absolute;\n inset:0;\n background-image:\n url(\"data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M30 5 L35 25 L55 30 L35 35 L30 55 L25 35 L5 30 L25 25 Z' fill='none' stroke='rgba(255,255,255,0.06)' stroke-width='0.5'/%3E%3C/svg%3E\"),\n url(\"data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='20' cy='20' r='1' fill='rgba(255,255,255,0.1)'/%3E%3C/svg%3E\");\n opacity:0.9;\n pointer-events:none;\n}\n\n.sc-prize-text {\n position:relative;\n z-index:1;\n text-align:center;\n color:${prizeTextColor};\n font-size:1.25rem;\n font-weight:700;\n text-shadow:0 2px 8px rgba(0,0,0,0.3);\n margin-bottom:8px;\n}\n\n.sc-prize-name {\n font-size:1.5rem;\n font-weight:700;\n color:${prizeNameColor};\n text-shadow:0 0 20px ${hexToRGBA(gold, 0.5)};\n}\n\n.sc-prize-icon {\n width:80px;\n height:80px;\n margin:12px auto;\n background:${prizeIconBg};\n border-radius:50%;\n display:flex;\n align-items:center;\n justify-content:center;\n font-size:2.5rem;\n}\n\n.sc-prize-icon-visible {\n position:absolute;\n left:50%;\n top:50%;\n margin-left:-40px;\n margin-top:-40px;\n width:80px;\n height:80px;\n background:${giftIconBg};\n border-radius:50%;\n display:flex;\n align-items:center;\n justify-content:center;\n font-size:2.5rem;\n z-index:11;\n pointer-events:none;\n box-shadow:0 4px 20px rgba(0,0,0,0.15);\n}\n\n.sc-coin {\n position:absolute;\n left:0;\n top:0;\n width:56px;\n height:56px;\n border-radius:50%;\n background:linear-gradient(145deg, ${coinStart} 0%, ${gold} 30%, ${coinEnd} 70%, #9a7a2a 100%);\n box-shadow:\n inset 0 2px 4px rgba(255,255,255,0.4),\n inset 0 -2px 6px rgba(0,0,0,0.25),\n 0 6px 16px rgba(0,0,0,0.3);\n display:flex;\n align-items:center;\n justify-content:center;\n font-weight:800;\n font-size:1.5rem;\n color:${coinEnd};\n text-shadow:0 1px 0 rgba(255,255,255,0.4);\n z-index:12;\n pointer-events:auto;\n cursor:grab;\n touch-action:none;\n transition:box-shadow 0.15s ease;\n}\n\n.sc-coin:active {\n cursor:grabbing;\n box-shadow:\n inset 0 2px 4px rgba(255,255,255,0.3),\n 0 4px 12px rgba(0,0,0,0.35);\n}\n\n.sc-coin.dragging {\n animation:none;\n}\n\n.sc-canvas {\n position:absolute;\n top:0;\n left:0;\n right:0;\n bottom:0;\n width:100%;\n height:100%;\n z-index:10;\n display:block;\n cursor:crosshair;\n touch-action:none;\n}\n\n.sc-instruction {\n text-align:center;\n margin-top:18px;\n font-size:0.95rem;\n color:${instructionColor};\n font-weight:500;\n}\n\n/* Modal */\n.sc-modal-overlay {\n position:fixed;\n inset:0;\n background:rgba(0,0,0,0.5);\n ${backdropBlur}\n display:flex;\n align-items:center;\n justify-content:center;\n padding:1.5rem;\n z-index:100;\n opacity:0;\n visibility:hidden;\n transition:opacity 0.35s ease, visibility 0.35s ease;\n}\n\n.sc-modal-overlay.active {\n opacity:1;\n visibility:visible;\n}\n\n.sc-confetti-canvas {\n position:absolute;\n inset:0;\n width:100%;\n height:100%;\n pointer-events:none;\n z-index:1;\n}\n\n.sc-modal-bg-glow {\n position:absolute;\n inset:0;\n z-index:2;\n background:radial-gradient(\n ellipse 90% 80% at 50% 50%,\n ${hexToRGBA(purpleMid, 0.4)} 0%,\n ${hexToRGBA(purpleDark, 0.2)} 40%,\n transparent 70%\n );\n animation:sc-modal-glow 3s ease-in-out infinite;\n}\n\n@keyframes sc-modal-glow {\n 0%, 100% { opacity:1; }\n 50% { opacity:0.85; }\n}\n\n.sc-modal-card {\n position:relative;\n z-index:3;\n width:min(340px, 100%);\n background:${white};\n border-radius:${cardBorderRadius}px;\n padding:32px 24px 28px;\n box-shadow:0 24px 64px rgba(0,0,0,0.2);\n transform:scale(0.9) translateY(20px);\n ${modalAnimation}\n overflow:hidden;\n}\n\n.sc-modal-overlay.active .sc-modal-card {\n transform:scale(1) translateY(0);\n}\n\n.sc-modal-card::before {\n content:'';\n position:absolute;\n top:-50%;\n left:-50%;\n width:200%;\n height:200%;\n background:radial-gradient(circle at 50% 50%, ${hexToRGBA(purpleLight, 0.08)} 0%, transparent 50%);\n pointer-events:none;\n}\n\n.sc-modal-header {\n text-align:center;\n margin-bottom:20px;\n}\n\n.sc-modal-header h2 {\n font-size:1.5rem;\n font-weight:700;\n color:${modalTitleColor};\n line-height:1.3;\n}\n\n.sc-modal-prize-box {\n background:linear-gradient(180deg, #f8f4fc 0%, #f0eaf8 100%);\n border-radius:20px;\n padding:28px 20px;\n margin-bottom:24px;\n text-align:center;\n position:relative;\n}\n\n.sc-modal-prize-circle {\n width:100px;\n height:100px;\n margin:0 auto 16px;\n background:linear-gradient(145deg, ${purpleLight} 0%, ${purpleMid} 100%);\n border-radius:50%;\n display:flex;\n align-items:center;\n justify-content:center;\n font-size:2.8rem;\n box-shadow:0 8px 24px ${hexToRGBA(purpleDark, 0.3)};\n}\n\n.sc-modal-prize-box .sc-prize-label {\n font-size:1.1rem;\n font-weight:600;\n color:${textDark};\n}\n\n.sc-modal-prize-box .sc-prize-name {\n font-size:1.35rem;\n color:${purpleMid};\n margin-top:4px;\n}\n\n.sc-btn-claim {\n display:block;\n width:100%;\n padding:16px 24px;\n border:none;\n border-radius:14px;\n background:${modalBtnBg};\n color:${modalBtnText};\n font-family:inherit;\n font-size:1.1rem;\n font-weight:600;\n cursor:pointer;\n box-shadow:0 6px 20px ${hexToRGBA(purpleDark, 0.4)};\n transition:transform 0.2s ease, box-shadow 0.2s ease;\n}\n\n.sc-btn-claim:hover {\n transform:translateY(-2px);\n box-shadow:0 8px 28px ${hexToRGBA(purpleDark, 0.5)};\n}\n\n.sc-btn-claim:active {\n transform:translateY(0);\n}\n\n.sc-modal-terms {\n text-align:center;\n margin-top:16px;\n}\n\n.sc-modal-terms a {\n font-size:0.875rem;\n color:${textMuted};\n text-decoration:none;\n}\n\n.sc-modal-terms a:hover {\n color:${purpleMid};\n text-decoration:underline;\n}\n\n/* ── prefers-reduced-motion ── */\n@media (prefers-reduced-motion: reduce) {\n .sc-wrapper { animation:none !important; opacity:1; transform:none; }\n .sc-page-bg { animation:none !important; }\n .sc-modal-bg-glow { animation:none !important; }\n .sc-modal-card { transition:none !important; transform:scale(1) translateY(0) !important; }\n .sc-btn-claim { transition:none !important; }\n .sc-btn-claim:hover { transform:none !important; }\n .sc-coin { transition:none !important; }\n}\n`;\n}\n","/**\n * ScratchCard SDK v1.1.0\n *\n * A fully dynamic, configurable Scratch Card component.\n * ES6 class-based. Outputs: UMD · ESM · CJS via Rollup.\n *\n * @example\n * import { ScratchCard } from 'spin-wheel-sdk';\n *\n * const card = ScratchCard.init({\n * container: '#app',\n * prize: { name: 'iPhone 16', icon: '📱', label: 'Congratulations!' },\n * onReveal(prize) { console.log(prize); },\n * });\n */\n\nimport { buildScratchCSS } from './scratchStyles.js';\nimport { hexToRGBA, escapeHtml, deepMerge } from './utils.js';\n\n/* ------------------------------------------------------------------ */\n/* Default configuration */\n/* ------------------------------------------------------------------ */\n\n/** @type {ScratchCardOptions} */\nconst DEFAULTS = Object.freeze({\n // ── Core ──\n container: null,\n prize: null,\n\n // ── Header UI ──\n headerTitle: 'Scratch the Card to Win Exciting Prizes!',\n headerTitleColor: null, // uses theme.textDark if null\n \n // ── Instruction ──\n instruction: 'Scratch the card to win exciting prizes.',\n instructionColor: null, // uses theme.textMuted if null\n\n // ── Scratch Behavior ──\n revealThreshold: 55,\n brushSize: 28,\n\n // ── Coin (Eraser Tool) ──\n coinSize: 56,\n showCoin: true,\n coinIcon: '$',\n coinGradientStart: null, // uses theme.goldLight if null\n coinGradientEnd: null, // uses theme.goldDark if null\n\n // ── Card Appearance ──\n cardBackground: null, // uses default gradient if null\n cardShadow: true,\n cardBorderRadius: 24,\n\n // ── Scratch Zone ──\n scratchZoneBackground: null, // uses theme gradient if null\n scratchZoneShadow: true,\n scratchZoneBorderRadius: 20,\n\n // ── Scratch Layer ──\n scratchLayerColor: 'rgb(150, 130, 180)',\n scratchLayerSparkles: true,\n scratchLayerSparkleCount: 40,\n\n // ── Prize Display ──\n prizeTextColor: null, // uses white with opacity if null\n prizeNameColor: null, // uses theme.goldLight if null\n prizeIconBackground: null, // uses white with opacity if null\n\n // ── Gift Icon (Hint) ──\n showGiftIcon: true,\n giftIcon: '🎁',\n giftIconBackground: null, // uses white with opacity if null\n\n // ── Modal ──\n showModal: true,\n modalTitle: 'Congratulations!',\n modalTitleColor: null, // uses theme.textDark if null\n modalButtonText: 'Claim your',\n modalButtonColor: null, // uses theme gradient if null\n modalButtonTextColor: null, // uses theme.white if null\n modalBackdropBlur: true,\n\n // ── Confetti ──\n confettiEnabled: true,\n confettiColors: null, // uses default colors if null\n confettiCount: 100,\n confettiDuration: 5500,\n\n // ── Animation ──\n animationType: 'default', // 'default' | 'bounce' | 'none'\n animationDuration: 600,\n\n // ── Theme Colors ──\n theme: Object.freeze({\n purpleDark: '#4a2c6a',\n purpleMid: '#6b4a8a',\n purpleLight: '#8b6baa',\n gold: '#d4a84b',\n goldLight: '#e8c547',\n goldDark: '#b8923a',\n white: '#ffffff',\n textDark: '#2d2d2d',\n textMuted: '#6b6b6b',\n }),\n\n // ── Callbacks ──\n onScratchStart: null,\n onScratchProgress: null,\n onReveal: null,\n onClaim: null,\n});\n\n/* ------------------------------------------------------------------ */\n/* Validation */\n/* ------------------------------------------------------------------ */\n\nfunction _validateOptions(opts) {\n // Container — truly required, cannot default\n if (!opts.container) {\n throw new Error('[ScratchCard] \"container\" is required.');\n }\n\n // Prize — truly required, cannot default\n if (!opts.prize || typeof opts.prize !== 'object') {\n throw new Error('[ScratchCard] \"prize\" is required and must be an object.');\n }\n if (!opts.prize.name || typeof opts.prize.name !== 'string') {\n throw new Error('[ScratchCard] \"prize.name\" is required and must be a string.');\n }\n\n // ── Clamp / auto-fix numeric & enum values instead of crashing ──\n\n // revealThreshold: clamp to [10, 90]\n if (opts.revealThreshold !== undefined) {\n if (typeof opts.revealThreshold !== 'number' || isNaN(opts.revealThreshold)) {\n console.warn('[ScratchCard] \"revealThreshold\" must be a number. Using default (55).');\n opts.revealThreshold = DEFAULTS.revealThreshold;\n } else if (opts.revealThreshold < 10) {\n console.warn(`[ScratchCard] \"revealThreshold\" (${opts.revealThreshold}) is below 10. Clamping to 10.`);\n opts.revealThreshold = 10;\n } else if (opts.revealThreshold > 90) {\n console.warn(`[ScratchCard] \"revealThreshold\" (${opts.revealThreshold}) is above 90. Clamping to 90.`);\n opts.revealThreshold = 90;\n }\n }\n\n // brushSize: clamp to min 1\n if (opts.brushSize !== undefined) {\n if (typeof opts.brushSize !== 'number' || isNaN(opts.brushSize)) {\n console.warn('[ScratchCard] \"brushSize\" must be a number. Using default (28).');\n opts.brushSize = DEFAULTS.brushSize;\n } else if (opts.brushSize < 1) {\n console.warn(`[ScratchCard] \"brushSize\" (${opts.brushSize}) is below 1. Clamping to 1.`);\n opts.brushSize = 1;\n }\n }\n\n // coinSize: clamp to min 1\n if (opts.coinSize !== undefined) {\n if (typeof opts.coinSize !== 'number' || isNaN(opts.coinSize)) {\n console.warn('[ScratchCard] \"coinSize\" must be a number. Using default (56).');\n opts.coinSize = DEFAULTS.coinSize;\n } else if (opts.coinSize < 1) {\n console.warn(`[ScratchCard] \"coinSize\" (${opts.coinSize}) is below 1. Clamping to 1.`);\n opts.coinSize = 1;\n }\n }\n\n // confettiCount: clamp to min 0\n if (opts.confettiCount !== undefined) {\n if (typeof opts.confettiCount !== 'number' || isNaN(opts.confettiCount)) {\n console.warn('[ScratchCard] \"confettiCount\" must be a number. Using default (100).');\n opts.confettiCount = DEFAULTS.confettiCount;\n } else if (opts.confettiCount < 0) {\n console.warn(`[ScratchCard] \"confettiCount\" (${opts.confettiCount}) is negative. Clamping to 0.`);\n opts.confettiCount = 0;\n }\n }\n\n // confettiDuration: clamp to min 100\n if (opts.confettiDuration !== undefined) {\n if (typeof opts.confettiDuration !== 'number' || isNaN(opts.confettiDuration)) {\n console.warn('[ScratchCard] \"confettiDuration\" must be a number. Using default (5500).');\n opts.confettiDuration = DEFAULTS.confettiDuration;\n } else if (opts.confettiDuration <= 0) {\n console.warn(`[ScratchCard] \"confettiDuration\" (${opts.confettiDuration}) must be positive. Clamping to 100.`);\n opts.confettiDuration = 100;\n }\n }\n\n // animationDuration: clamp to min 100\n if (opts.animationDuration !== undefined) {\n if (typeof opts.animationDuration !== 'number' || isNaN(opts.animationDuration)) {\n console.warn('[ScratchCard] \"animationDuration\" must be a number. Using default (600).');\n opts.animationDuration = DEFAULTS.animationDuration;\n } else if (opts.animationDuration <= 0) {\n console.warn(`[ScratchCard] \"animationDuration\" (${opts.animationDuration}) must be positive. Clamping to 100.`);\n opts.animationDuration = 100;\n }\n }\n\n // animationType: fallback to 'default'\n if (opts.animationType !== undefined && !['default', 'bounce', 'none'].includes(opts.animationType)) {\n console.warn(`[ScratchCard] \"animationType\" (\"${opts.animationType}\") is invalid. Must be \"default\", \"bounce\", or \"none\". Using \"default\".`);\n opts.animationType = 'default';\n }\n\n // cardBorderRadius: clamp to min 0\n if (opts.cardBorderRadius !== undefined) {\n if (typeof opts.cardBorderRadius !== 'number' || isNaN(opts.cardBorderRadius)) {\n console.warn('[ScratchCard] \"cardBorderRadius\" must be a number. Using default (24).');\n opts.cardBorderRadius = DEFAULTS.cardBorderRadius;\n } else if (opts.cardBorderRadius < 0) {\n console.warn(`[ScratchCard] \"cardBorderRadius\" (${opts.cardBorderRadius}) is negative. Clamping to 0.`);\n opts.cardBorderRadius = 0;\n }\n }\n\n // scratchZoneBorderRadius: clamp to min 0\n if (opts.scratchZoneBorderRadius !== undefined) {\n if (typeof opts.scratchZoneBorderRadius !== 'number' || isNaN(opts.scratchZoneBorderRadius)) {\n console.warn('[ScratchCard] \"scratchZoneBorderRadius\" must be a number. Using default (20).');\n opts.scratchZoneBorderRadius = DEFAULTS.scratchZoneBorderRadius;\n } else if (opts.scratchZoneBorderRadius < 0) {\n console.warn(`[ScratchCard] \"scratchZoneBorderRadius\" (${opts.scratchZoneBorderRadius}) is negative. Clamping to 0.`);\n opts.scratchZoneBorderRadius = 0;\n }\n }\n\n // scratchLayerSparkleCount: clamp to min 0\n if (opts.scratchLayerSparkleCount !== undefined) {\n if (typeof opts.scratchLayerSparkleCount !== 'number' || isNaN(opts.scratchLayerSparkleCount)) {\n console.warn('[ScratchCard] \"scratchLayerSparkleCount\" must be a number. Using default (40).');\n opts.scratchLayerSparkleCount = DEFAULTS.scratchLayerSparkleCount;\n } else if (opts.scratchLayerSparkleCount < 0) {\n console.warn(`[ScratchCard] \"scratchLayerSparkleCount\" (${opts.scratchLayerSparkleCount}) is negative. Clamping to 0.`);\n opts.scratchLayerSparkleCount = 0;\n }\n }\n}\n\n/* ------------------------------------------------------------------ */\n/* SSR guard */\n/* ------------------------------------------------------------------ */\n\nconst _isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';\n\n/** @returns {boolean} Whether the user prefers reduced motion */\nfunction _prefersReducedMotion() {\n return _isBrowser && window.matchMedia?.('(prefers-reduced-motion: reduce)')?.matches;\n}\n\n/* ------------------------------------------------------------------ */\n/* CSS injection (once per page) */\n/* ------------------------------------------------------------------ */\n\nlet _injectedThemeKey = null;\n\nfunction injectCSS(options) {\n if (!_isBrowser) return;\n const theme = { ...DEFAULTS.theme, ...(options.theme || {}) };\n \n // Build a key from all style-affecting options\n const styleConfig = {\n theme,\n headerTitleColor: options.headerTitleColor,\n instructionColor: options.instructionColor,\n coinGradientStart: options.coinGradientStart,\n coinGradientEnd: options.coinGradientEnd,\n cardBackground: options.cardBackground,\n cardShadow: options.cardShadow,\n cardBorderRadius: options.cardBorderRadius,\n scratchZoneBackground: options.scratchZoneBackground,\n scratchZoneShadow: options.scratchZoneShadow,\n scratchZoneBorderRadius: options.scratchZoneBorderRadius,\n prizeTextColor: options.prizeTextColor,\n prizeNameColor: options.prizeNameColor,\n prizeIconBackground: options.prizeIconBackground,\n giftIconBackground: options.giftIconBackground,\n modalTitleColor: options.modalTitleColor,\n modalButtonColor: options.modalButtonColor,\n modalButtonTextColor: options.modalButtonTextColor,\n modalBackdropBlur: options.modalBackdropBlur,\n animationType: options.animationType,\n animationDuration: options.animationDuration,\n };\n \n const key = JSON.stringify(styleConfig);\n if (_injectedThemeKey === key) return;\n\n // Remove old stylesheet if exists (SSR-safe)\n const existing = _isBrowser ? document.querySelector('style[data-scratch-card-sdk]') : null;\n if (existing) existing.remove();\n\n _injectedThemeKey = key;\n const style = document.createElement('style');\n style.setAttribute('data-scratch-card-sdk', '');\n style.textContent = buildScratchCSS(styleConfig, hexToRGBA);\n document.head.appendChild(style);\n}\n\n/* ------------------------------------------------------------------ */\n/* ScratchCard class */\n/* ------------------------------------------------------------------ */\n\nexport class ScratchCardInstance {\n /**\n * @param {ScratchCardOptions} opts\n */\n constructor(opts) {\n if (!_isBrowser) {\n throw new Error('[ScratchCard] ScratchCard requires a browser environment (window + document).');\n }\n\n // ── validate options ──\n _validateOptions(opts);\n\n /** @type {ScratchCardOptions} */\n this.options = deepMerge({}, DEFAULTS, opts);\n \n // Ensure theme is properly merged\n this.options.theme = { ...DEFAULTS.theme, ...(opts.theme || {}) };\n\n /** Current scratch percentage (0-100) */\n this.scratchPercent = 0;\n\n /** Whether user is currently scratching */\n this.isScratching = false;\n\n /** Whether user is dragging the coin */\n this.isDraggingCoin = false;\n\n /** Whether prize has been revealed */\n this.hasRevealed = false;\n\n /** Set to true after .destroy() */\n this._destroyed = false;\n\n /** Whether onScratchStart has fired for this session */\n this._scratchStartFired = false;\n\n /** Active confetti requestAnimationFrame ID */\n this._confettiRafId = null;\n\n /** Confetti timeout IDs for burst effects */\n this._confettiTimeouts = [];\n\n /** @type {object|null} */\n this._prize = this.options.prize;\n\n // ── resolve container ──\n this.containerEl =\n typeof this.options.container === 'string'\n ? document.querySelector(this.options.container)\n : this.options.container;\n\n if (!this.containerEl) {\n throw new Error('[ScratchCard] container not found. Ensure the container element exists in the DOM.');\n }\n\n /** Canvas dimensions */\n this.zoneW = 0;\n this.zoneH = 0;\n\n /** Last mouse/touch point for continuous scratching */\n this._lastPoint = null;\n\n /** Resize observer for responsive canvas */\n this._resizeObserver = null;\n\n // ── inject CSS (idempotent) ──\n injectCSS(this.options);\n\n // ── DOM refs (set in _build) ──\n /** @type {HTMLElement} */ this._rootEl = null;\n /** @type {HTMLElement} */ this._zoneEl = null;\n /** @type {HTMLCanvasElement} */ this._canvasEl = null;\n /** @type {CanvasRenderingContext2D} */ this._ctx = null;\n /** @type {HTMLElement} */ this._coinEl = null;\n /** @type {HTMLElement} */ this._giftIconEl = null;\n /** @type {HTMLElement} */ this._modalEl = null;\n /** @type {HTMLElement} */ this._confettiCanvasEl = null;\n /** @type {HTMLElement} */ this._prizeContentEl = null;\n /** @type {HTMLElement} */ this._instructionEl = null;\n\n // ── build & bind ──\n this._build();\n this._bind();\n }\n\n /* ================================================================ */\n /* DOM construction */\n /* ================================================================ */\n\n /** Build the full widget DOM tree and attach it to the container. */\n _build() {\n const o = this.options;\n\n // ── root wrapper ──\n const root = document.createElement('div');\n root.className = 'sc-root';\n\n // ── page background glow ──\n const pageBg = document.createElement('div');\n pageBg.className = 'sc-page-bg';\n pageBg.setAttribute('aria-hidden', 'true');\n root.appendChild(pageBg);\n\n // ── main wrapper ──\n const wrapper = document.createElement('div');\n wrapper.className = 'sc-wrapper';\n\n // ── main card ──\n const card = document.createElement('div');\n card.className = 'sc-main-card';\n\n // ── header ──\n const header = document.createElement('header');\n header.className = 'sc-header';\n header.innerHTML = `<h1>${escapeHtml(o.headerTitle)}</h1>`;\n card.appendChild(header);\n\n // ── scratch zone ──\n const zone = document.createElement('div');\n zone.className = 'sc-zone';\n zone.id = `sc-zone-${this._id()}`;\n this._zoneEl = zone;\n\n // Prize content (under canvas)\n const prizeContent = document.createElement('div');\n prizeContent.className = 'sc-prize-content';\n prizeContent.innerHTML = `\n <div class=\"sc-prize-text\">${escapeHtml(this._prize.label || 'Congratulations!')}</div>\n <div class=\"sc-prize-name\">${escapeHtml(this._prize.name)}</div>\n <div class=\"sc-prize-icon\">${escapeHtml(this._prize.icon || '🎁')}</div>\n `;\n zone.appendChild(prizeContent);\n this._prizeContentEl = prizeContent;\n\n // Canvas for scratching\n const canvas = document.createElement('canvas');\n canvas.className = 'sc-canvas';\n canvas.id = `sc-canvas-${this._id()}`;\n canvas.setAttribute('aria-label', 'Scratch to reveal your prize');\n zone.appendChild(canvas);\n this._canvasEl = canvas;\n this._ctx = canvas.getContext('2d');\n\n // Gift icon visible above scratch layer (hint icon)\n if (o.showGiftIcon !== false) {\n const prizeIconVisible = document.createElement('div');\n prizeIconVisible.className = 'sc-prize-icon-visible';\n prizeIconVisible.id = `sc-gift-icon-${this._id()}`;\n prizeIconVisible.setAttribute('aria-hidden', 'true');\n prizeIconVisible.textContent = o.giftIcon || '🎁';\n zone.appendChild(prizeIconVisible);\n this._giftIconEl = prizeIconVisible;\n }\n\n // Draggable coin eraser\n if (o.showCoin) {\n const coin = document.createElement('div');\n coin.className = 'sc-coin';\n coin.id = `sc-coin-${this._id()}`;\n coin.setAttribute('aria-hidden', 'true');\n coin.textContent = o.coinIcon;\n zone.appendChild(coin);\n this._coinEl = coin;\n }\n\n card.appendChild(zone);\n\n // ── instruction ──\n const instruction = document.createElement('p');\n instruction.className = 'sc-instruction';\n instruction.textContent = o.instruction;\n card.appendChild(instruction);\n this._instructionEl = instruction;\n\n wrapper.appendChild(card);\n root.appendChild(wrapper);\n this.containerEl.appendChild(root);\n this._rootEl = root;\n\n // ── modal ──\n if (o.showModal) {\n this._buildModal();\n }\n\n // ── initialize canvas size ──\n this._initCanvas();\n }\n\n /** Generate a unique ID for this instance */\n _id() {\n return Math.random().toString(36).slice(2, 9);\n }\n\n /** Build the win modal and append it to the container */\n _buildModal() {\n const o = this.options;\n const modalTitle = o.modalTitle || 'Congratulations!';\n const modalButtonText = o.modalButtonText || 'Claim your';\n \n const overlay = document.createElement('div');\n overlay.className = 'sc-modal-overlay';\n overlay.setAttribute('role', 'dialog');\n overlay.setAttribute('aria-modal', 'true');\n overlay.setAttribute('aria-hidden', 'true');\n overlay.setAttribute('aria-label', 'Prize won');\n\n // Confetti canvas\n const confettiCanvas = document.createElement('canvas');\n confettiCanvas.className = 'sc-confetti-canvas';\n confettiCanvas.setAttribute('aria-hidden', 'true');\n overlay.appendChild(confettiCanvas);\n this._confettiCanvasEl = confettiCanvas;\n\n // Background glow\n const bgGlow = document.createElement('div');\n bgGlow.className = 'sc-modal-bg-glow';\n overlay.appendChild(bgGlow);\n\n // Modal card\n const modalCard = document.createElement('div');\n modalCard.className = 'sc-modal-card';\n modalCard.innerHTML = `\n <div class=\"sc-modal-header\">\n <h2>${escapeHtml(modalTitle)} You won ${escapeHtml(this._prize.name)}.</h2>\n </div>\n <div class=\"sc-modal-prize-box\">\n <div class=\"sc-modal-prize-circle\">${escapeHtml(this._prize.icon || '🎁')}</div>\n <div class=\"sc-prize-label\">${escapeHtml(this._prize.label || modalTitle)} You won ${escapeHtml(this._prize.name)}!</div>\n <div class=\"sc-prize-name\">${escapeHtml(this._prize.name)}</div>\n </div>\n <button type=\"button\" class=\"sc-btn-claim\">${escapeHtml(modalButtonText)} ${escapeHtml(this._prize.name)}</button>\n <p class=\"sc-modal-terms\">\n <a href=\"#\" onclick=\"return false;\">Terms & Conditions</a>\n </p>\n `;\n overlay.appendChild(modalCard);\n\n this.containerEl.appendChild(overlay);\n this._modalEl = overlay;\n }\n\n /** Initialize canvas size and draw scratch surface */\n _initCanvas() {\n const setSize = () => {\n const w = this._zoneEl.clientWidth;\n const h = this._zoneEl.clientHeight;\n if (w <= 0 || h <= 0) return;\n\n this.zoneW = w;\n this.zoneH = h;\n\n const dpr = window.devicePixelRatio || 1;\n this._canvasEl.width = Math.ceil(w * dpr);\n this._canvasEl.height = Math.ceil(h * dpr);\n this._canvasEl.style.width = w + 'px';\n this._canvasEl.style.height = h + 'px';\n\n this._ctx.setTransform(1, 0, 0, 1, 0, 0);\n this._ctx.scale(dpr, dpr);\n\n this._drawSurface();\n this._positionCoinInitial();\n this._zoneEl.classList.add('sc-ready');\n };\n\n // Use ResizeObserver for responsive sizing\n this._resizeObserver = new ResizeObserver(() => {\n requestAnimationFrame(setSize);\n });\n this._resizeObserver.observe(this._zoneEl);\n\n // Initial sizing\n requestAnimationFrame(() => requestAnimationFrame(setSize));\n }\n\n /** Draw the scratchable surface on canvas */\n _drawSurface() {\n const w = this.zoneW;\n const h = this.zoneH;\n if (w <= 0 || h <= 0) return;\n\n const ctx = this._ctx;\n const o = this.options;\n\n // Base color for scratch layer (configurable)\n ctx.fillStyle = o.scratchLayerColor || 'rgb(150, 130, 180)';\n ctx.fillRect(0, 0, w, h);\n\n // Add sparkle effect if enabled\n if (o.scratchLayerSparkles !== false) {\n const sparkleCount = o.scratchLayerSparkleCount || 40;\n ctx.globalCompositeOperation = 'overlay';\n ctx.fillStyle = 'rgba(255, 255, 255, 0.2)';\n for (let i = 0; i < sparkleCount; i++) {\n ctx.beginPath();\n ctx.arc(Math.random() * w, Math.random() * h, 2 + Math.random() * 3, 0, Math.PI * 2);\n ctx.fill();\n }\n ctx.globalCompositeOperation = 'source-over';\n }\n }\n\n /** Position coin at initial location */\n _positionCoinInitial() {\n if (!this._coinEl || this.zoneW <= 0 || this.zoneH <= 0) return;\n\n const coinRadius = this.options.coinSize / 2;\n const x = Math.round(this.zoneW * 0.15 - coinRadius);\n const y = Math.round(this.zoneH * 0.82 - coinRadius);\n this._coinEl.style.transform = `translate(${x}px, ${y}px)`;\n }\n\n /* ================================================================ */\n /* Event binding */\n /* ================================================================ */\n\n /** Wire up all interactive event listeners with proper references for cleanup. */\n _bind() {\n const canvas = this._canvasEl;\n\n // Canvas scratch events (direct mouse/touch scratching)\n this._boundStartScratch = this._onStartScratch.bind(this);\n this._boundMoveScratch = this._onMoveScratch.bind(this);\n this._boundEndScratch = this._onEndScratch.bind(this);\n\n canvas.addEventListener('mousedown', this._boundStartScratch);\n canvas.addEventListener('mousemove', this._boundMoveScratch);\n canvas.addEventListener('mouseup', this._boundEndScratch);\n canvas.addEventListener('mouseleave', this._boundEndScratch);\n\n canvas.addEventListener('touchstart', this._boundStartScratch, { passive: false });\n canvas.addEventListener('touchmove', this._boundMoveScratch, { passive: false });\n canvas.addEventListener('touchend', this._boundEndScratch);\n canvas.addEventListener('touchcancel', this._boundEndScratch);\n\n // Coin drag events\n if (this._coinEl) {\n this._boundStartCoinDrag = this._onStartCoinDrag.bind(this);\n this._coinEl.addEventListener('mousedown', this._boundStartCoinDrag);\n this._coinEl.addEventListener('touchstart', this._boundStartCoinDrag, { passive: false });\n }\n\n // Global drag events for coin – store references for cleanup in destroy()\n this._boundDocMouseMove = (e) => {\n if (this.isDraggingCoin) this._onMoveCoinDrag(e);\n };\n this._boundDocMouseUp = this._onEndCoinDrag.bind(this);\n this._boundDocTouchMove = (e) => {\n if (this.isDraggingCoin) {\n e.preventDefault();\n this._onMoveCoinDrag(e);\n }\n };\n this._boundDocTouchEnd = this._onEndCoinDrag.bind(this);\n this._boundDocTouchCancel = this._onEndCoinDrag.bind(this);\n\n document.addEventListener('mousemove', this._boundDocMouseMove);\n document.addEventListener('mouseup', this._boundDocMouseUp);\n document.addEventListener('touchmove', this._boundDocTouchMove, { passive: false });\n document.addEventListener('touchend', this._boundDocTouchEnd);\n document.addEventListener('touchcancel', this._boundDocTouchCancel);\n\n // Modal events\n if (this._modalEl) {\n this._boundModalClick = (e) => {\n if (e.target === this._modalEl || e.target.classList.contains('sc-modal-bg-glow')) {\n this.hideModal();\n }\n };\n this._modalEl.addEventListener('click', this._boundModalClick);\n\n const btnClaim = this._modalEl.querySelector('.sc-btn-claim');\n if (btnClaim) {\n this._boundClaimClick = () => {\n this.hideModal();\n if (typeof this.options.onClaim === 'function') {\n try { this.options.onClaim(this._prize); } catch (err) { console.error('[ScratchCard] onClaim callback error:', err); }\n }\n };\n this._claimBtnEl = btnClaim;\n btnClaim.addEventListener('click', this._boundClaimClick);\n }\n }\n\n // Global keyboard: Escape closes modal\n this._boundDocKeydown = (e) => {\n if (e.key === 'Escape' && this._modalEl?.classList.contains('active')) {\n this.hideModal();\n }\n };\n document.addEventListener('keydown', this._boundDocKeydown);\n }\n\n /** Get event point relative to scratch zone */\n _getEventPoint(e) {\n if (!this._zoneEl) return { x: 0, y: 0 };\n const rect = this._zoneEl.getBoundingClientRect();\n if (e.touches && e.touches.length) {\n return {\n x: e.touches[0].clientX - rect.left,\n y: e.touches[0].clientY - rect.top,\n };\n }\n return {\n x: e.clientX - rect.left,\n y: e.clientY - rect.top,\n };\n }\n\n /** Start scratching */\n _onStartScratch(e) {\n if (this.hasRevealed || this._destroyed) return;\n e.preventDefault();\n this.isScratching = true;\n\n // Hide gift icon as soon as user starts scratching\n if (this._giftIconEl) {\n this._giftIconEl.style.display = 'none';\n }\n\n this._lastPoint = this._getEventPoint(e);\n this._scratch(this._lastPoint.x, this._lastPoint.y);\n\n if (!this._scratchStartFired && typeof this.options.onScratchStart === 'function') {\n this._scratchStartFired = true;\n try { this.options.onScratchStart(); } catch (err) { console.error('[ScratchCard] onScratchStart callback error:', err); }\n }\n }\n\n /** Move scratching */\n _onMoveScratch(e) {\n if (!this.isScratching || this.hasRevealed || this._destroyed) return;\n e.preventDefault();\n const point = this._getEventPoint(e);\n const dx = point.x - this._lastPoint.x;\n const dy = point.y - this._lastPoint.y;\n const dist = Math.sqrt(dx * dx + dy * dy);\n const steps = Math.max(1, Math.floor(dist / 4));\n\n for (let i = 1; i <= steps; i++) {\n const t = i / steps;\n const x = this._lastPoint.x + dx * t;\n const y = this._lastPoint.y + dy * t;\n this._scratch(x, y);\n }\n this._lastPoint = point;\n }\n\n /** End scratching */\n _onEndScratch() {\n this.isScratching = false;\n this._lastPoint = null;\n }\n\n /** Perform scratch at position */\n _scratch(x, y, radius) {\n if (!this._ctx || this._destroyed) return;\n const r = radius !== undefined ? radius : this.options.brushSize / 2;\n const ctx = this._ctx;\n\n ctx.globalCompositeOperation = 'destination-out';\n ctx.fillStyle = 'rgba(0, 0, 0, 1)';\n ctx.beginPath();\n ctx.arc(x, y, r, 0, Math.PI * 2);\n ctx.fill();\n ctx.globalCompositeOperation = 'source-over';\n\n if (this.hasRevealed) return;\n this._updateScratchPercent();\n }\n\n /** Calculate and update scratch percentage */\n _updateScratchPercent() {\n if (!this._ctx || this._destroyed) return;\n const w = this.zoneW;\n const h = this.zoneH;\n if (w <= 0 || h <= 0) return;\n const dpr = window.devicePixelRatio || 1;\n const cw = Math.ceil(w * dpr);\n const ch = Math.ceil(h * dpr);\n if (cw <= 0 || ch <= 0) return;\n\n let imageData;\n try {\n imageData = this._ctx.getImageData(0, 0, cw, ch);\n } catch (_) { return; }\n const data = imageData.data;\n let transparent = 0;\n const step = 8; // Sample every 8th pixel for performance\n\n for (let i = 0; i < data.length; i += 4 * step) {\n if (data[i + 3] < 128) transparent++;\n }\n\n const total = (cw * ch) / step;\n this.scratchPercent = total > 0 ? Math.round((transparent / total) * 100) : 0;\n\n if (typeof this.options.onScratchProgress === 'function') {\n try { this.options.onScratchProgress(this.scratchPercent); } catch (err) { console.error('[ScratchCard] onScratchProgress callback error:', err); }\n }\n\n if (this.scratchPercent >= this.options.revealThreshold) {\n this._reveal();\n }\n }\n\n /** Reveal the prize */\n _reveal() {\n if (this.hasRevealed || this._destroyed) return;\n this.hasRevealed = true;\n\n // Clear the canvas to fully reveal\n if (this._ctx) {\n try { this._ctx.clearRect(0, 0, this.zoneW, this.zoneH); } catch (_) { /* noop */ }\n }\n\n // Hide the gift icon that sits above the scratch layer\n if (this._giftIconEl) {\n this._giftIconEl.style.display = 'none';\n }\n\n // Show modal\n if (this._modalEl) {\n this._modalEl.classList.add('active');\n this._modalEl.setAttribute('aria-hidden', 'false');\n \n // Start confetti only if enabled and motion is OK\n if (this.options.confettiEnabled !== false && !_prefersReducedMotion()) {\n this._startConfetti();\n }\n\n // Focus the claim button for keyboard users\n const claimBtn = this._modalEl.querySelector('.sc-btn-claim');\n if (claimBtn) {\n setTimeout(() => claimBtn.focus(), 100);\n }\n }\n\n // A11y: announce to screen readers\n this._announceToScreenReader(`Prize revealed: ${this._prize?.name || 'your prize'}`);\n\n if (typeof this.options.onReveal === 'function') {\n try { this.options.onReveal(this._prize); } catch (err) { console.error('[ScratchCard] onReveal callback error:', err); }\n }\n }\n\n /* ================================================================ */\n /* Coin drag handling */\n /* ================================================================ */\n\n _onStartCoinDrag(e) {\n if (this.hasRevealed || this._destroyed) return;\n e.preventDefault();\n e.stopPropagation();\n this.isDraggingCoin = true;\n if (this._coinEl) this._coinEl.classList.add('dragging');\n\n // Hide gift icon as soon as user starts scratching\n if (this._giftIconEl) {\n this._giftIconEl.style.display = 'none';\n }\n\n const point = this._getEventPoint(e);\n const c = this._clampCoinPosition(point.x, point.y);\n this._updateCoinPosition(c.x, c.y);\n this._scratch(c.x, c.y, this.options.coinSize / 2);\n\n if (!this._scratchStartFired && typeof this.options.onScratchStart === 'function') {\n this._scratchStartFired = true;\n try { this.options.onScratchStart(); } catch (err) { console.error('[ScratchCard] onScratchStart callback error:', err); }\n }\n }\n\n _onMoveCoinDrag(e) {\n if (!this.isDraggingCoin || this.hasRevealed || this._destroyed) return;\n e.preventDefault();\n e.stopPropagation();\n\n const point = this._getEventPoint(e);\n const c = this._clampCoinPosition(point.x, point.y);\n this._updateCoinPosition(c.x, c.y);\n this._scratch(c.x, c.y, this.options.coinSize / 2);\n }\n\n _onEndCoinDrag() {\n if (!this.isDraggingCoin) return;\n this.isDraggingCoin = false;\n if (this._coinEl) this._coinEl.classList.remove('dragging');\n }\n\n _clampCoinPosition(cx, cy) {\n const r = this.options.coinSize / 2;\n return {\n x: Math.max(r, Math.min(this.zoneW - r, cx)),\n y: Math.max(r, Math.min(this.zoneH - r, cy)),\n };\n }\n\n _updateCoinPosition(cx, cy) {\n if (!this._coinEl) return;\n const r = this.options.coinSize / 2;\n this._coinEl.style.transform = `translate(${cx - r}px, ${cy - r}px)`;\n }\n\n /* ================================================================ */\n /* Confetti animation */\n /* ================================================================ */\n\n _startConfetti() {\n if (!this._confettiCanvasEl || !this._modalEl || this._destroyed) return;\n\n const o = this.options;\n const rect = this._modalEl.getBoundingClientRect();\n const w = rect.width;\n const h = rect.height;\n if (w <= 0 || h <= 0) return;\n\n this._confettiCanvasEl.width = w;\n this._confettiCanvasEl.height = h;\n this._confettiCanvasEl.style.width = w + 'px';\n this._confettiCanvasEl.style.height = h + 'px';\n\n const cctx = this._confettiCanvasEl.getContext('2d');\n if (!cctx) return;\n const colors = o.confettiColors || ['#e8c547', '#d4a84b', '#6b4a8a', '#8b6baa', '#c94a6a', '#4ac97a', '#fff', '#ff6b6b'];\n const particles = [];\n const centerX = w / 2;\n const centerY = h / 2;\n const count = o.confettiCount || 100;\n\n for (let i = 0; i < count; i++) {\n const angle = (Math.PI * 2 * i) / count + Math.random() * 0.5;\n const speed = 4 + Math.random() * 10;\n particles.push({\n x: centerX,\n y: centerY,\n vx: Math.cos(angle) * speed + (Math.random() - 0.5) * 4,\n vy: Math.sin(angle) * speed - 6 + (Math.random() - 0.5) * 2,\n color: colors[Math.floor(Math.random() * colors.length)],\n size: 4 + Math.random() * 8,\n rotation: Math.random() * Math.PI * 2,\n rotationSpeed: (Math.random() - 0.5) * 0.3,\n opacity: 1,\n birth: 0,\n });\n }\n\n // Add burst effects\n this._confettiTimeouts.push(\n setTimeout(() => this._addBurst(particles, centerX, centerY, 35, cctx, w, h), 200),\n setTimeout(() => this._addBurst(particles, centerX, centerY, 30, cctx, w, h), 450)\n );\n\n const gravity = 0.22;\n const friction = 0.99;\n const startTime = Date.now();\n const duration = o.confettiDuration || 5500;\n\n const animate = () => {\n const elapsed = Date.now() - startTime;\n if (elapsed > duration || this._destroyed) {\n cctx.clearRect(0, 0, w, h);\n this._confettiRafId = null;\n return;\n }\n\n cctx.clearRect(0, 0, w, h);\n\n for (let i = 0; i < particles.length; i++) {\n const p = particles[i];\n const age = p.birth ? Date.now() - p.birth : elapsed;\n\n p.x += p.vx;\n p.y += p.vy;\n p.vy += gravity;\n p.vx *= friction;\n p.vy *= friction;\n p.rotation += p.rotationSpeed;\n\n const life = 1 - age / (p.birth ? 3200 : duration);\n p.opacity = Math.max(0, life);\n\n if (p.opacity <= 0 || p.y > h + 20) continue;\n\n cctx.save();\n cctx.globalAlpha = p.opacity;\n cctx.translate(p.x, p.y);\n cctx.rotate(p.rotation);\n cctx.fillStyle = p.color;\n cctx.fillRect(-p.size / 2, -p.size / 4, p.size, p.size / 2);\n cctx.restore();\n }\n\n this._confettiRafId = requestAnimationFrame(animate);\n };\n\n this._confettiRafId = requestAnimationFrame(animate);\n }\n\n _addBurst(particles, x, y, count, cctx, w, h) {\n const o = this.options;\n const colors = o.confettiColors || ['#e8c547', '#d4a84b', '#6b4a8a', '#8b6baa', '#c94a6a', '#4ac97a', '#fff', '#ff6b6b'];\n for (let i = 0; i < count; i++) {\n const angle = Math.random() * Math.PI * 2;\n const speed = 3 + Math.random() * 8;\n particles.push({\n x: x + (Math.random() - 0.5) * 120,\n y: y - 40 + (Math.random() - 0.5) * 20,\n vx: Math.cos(angle) * speed,\n vy: Math.sin(angle) * speed - 4,\n color: colors[Math.floor(Math.random() * colors.length)],\n size: 3 + Math.random() * 6,\n rotation: Math.random() * Math.PI * 2,\n rotationSpeed: (Math.random() - 0.5) * 0.3,\n opacity: 1,\n birth: Date.now(),\n });\n }\n }\n\n /* ================================================================ */\n /* Public API */\n /* ================================================================ */\n\n /**\n * Programmatically reveal the prize.\n */\n reveal() {\n if (this._destroyed) return;\n this._reveal();\n }\n\n /**\n * Hide the modal overlay.\n */\n hideModal() {\n if (this._destroyed || !this._modalEl) return;\n this._modalEl.classList.remove('active');\n this._modalEl.setAttribute('aria-hidden', 'true');\n }\n\n /**\n * Show the modal overlay.\n */\n showModal() {\n if (this._destroyed || !this._modalEl) return;\n this._modalEl.classList.add('active');\n this._modalEl.setAttribute('aria-hidden', 'false');\n }\n\n /**\n * Reset the scratch card for replay.\n */\n reset() {\n if (this._destroyed) return;\n\n this.hasRevealed = false;\n this.scratchPercent = 0;\n this.isScratching = false;\n this.isDraggingCoin = false;\n this._lastPoint = null;\n this._scratchStartFired = false;\n\n // Redraw canvas\n this._drawSurface();\n\n // Reset coin position\n this._positionCoinInitial();\n\n // Show the gift icon again\n if (this._giftIconEl) {\n this._giftIconEl.style.display = '';\n }\n\n // Hide modal\n this.hideModal();\n\n // Remove ready class temporarily\n if (this._zoneEl) {\n this._zoneEl.classList.remove('sc-ready');\n requestAnimationFrame(() => {\n if (this._zoneEl) this._zoneEl.classList.add('sc-ready');\n });\n }\n }\n\n /**\n * Update the prize at runtime.\n * @param {object} prize - New prize object\n */\n updatePrize(prize) {\n if (this._destroyed) return;\n if (!prize || typeof prize !== 'object') {\n console.warn('[ScratchCard] updatePrize: prize must be an object. Ignoring.');\n return;\n }\n this._prize = { ...this._prize, ...prize };\n this.reset();\n\n const o = this.options;\n const modalTitle = o.modalTitle || 'Congratulations!';\n const modalButtonText = o.modalButtonText || 'Claim your';\n\n // Update prize display\n if (this._prizeContentEl) {\n this._prizeContentEl.innerHTML = `\n <div class=\"sc-prize-text\">${escapeHtml(this._prize.label || modalTitle)}</div>\n <div class=\"sc-prize-name\">${escapeHtml(this._prize.name)}</div>\n <div class=\"sc-prize-icon\">${escapeHtml(this._prize.icon || '🎁')}</div>\n `;\n }\n\n // Update modal content\n if (this._modalEl) {\n const header = this._modalEl.querySelector('.sc-modal-header h2');\n if (header) header.textContent = `${modalTitle} You won ${this._prize.name}.`;\n\n const circle = this._modalEl.querySelector('.sc-modal-prize-circle');\n if (circle) circle.textContent = this._prize.icon || '🎁';\n\n const label = this._modalEl.querySelector('.sc-modal-prize-box .sc-prize-label');\n if (label) label.textContent = `${this._prize.label || modalTitle} You won ${this._prize.name}!`;\n\n const name = this._modalEl.querySelector('.sc-modal-prize-box .sc-prize-name');\n if (name) name.textContent = this._prize.name;\n\n const btn = this._modalEl.querySelector('.sc-btn-claim');\n if (btn) btn.textContent = `${modalButtonText} ${this._prize.name}`;\n }\n }\n\n /**\n * Update configuration options at runtime.\n * @param {Partial<ScratchCardOptions>} newOptions\n */\n updateOptions(newOptions) {\n if (this._destroyed) return;\n if (!newOptions || typeof newOptions !== 'object') {\n console.warn('[ScratchCard] updateOptions: argument must be an object. Ignoring.');\n return;\n }\n \n // Sanitize numeric/enum values before merging\n _validateOptions({ ...this.options, ...newOptions, container: this.options.container, prize: this.options.prize });\n \n // Merge new options\n this.options = deepMerge({}, this.options, newOptions);\n \n // Handle theme separately for proper nested merge\n if (newOptions.theme) {\n this.options.theme = { ...DEFAULTS.theme, ...this.options.theme, ...newOptions.theme };\n }\n \n // Re-inject CSS if styling options changed\n injectCSS(this.options);\n \n // Update header if changed\n const header = this._rootEl?.querySelector('.sc-header h1');\n if (header && newOptions.headerTitle !== undefined) {\n header.textContent = this.options.headerTitle;\n }\n \n // Update instruction if changed\n if (this._instructionEl && newOptions.instruction !== undefined) {\n this._instructionEl.textContent = this.options.instruction;\n }\n \n // Update coin icon if changed\n if (this._coinEl && newOptions.coinIcon !== undefined) {\n this._coinEl.textContent = this.options.coinIcon;\n }\n \n // Update gift icon if changed\n if (this._giftIconEl && newOptions.giftIcon !== undefined) {\n this._giftIconEl.textContent = this.options.giftIcon;\n }\n }\n\n /**\n * Announce a message to screen readers via a visually hidden aria-live region.\n * @param {string} message\n */\n _announceToScreenReader(message) {\n if (!_isBrowser) return;\n if (!this._liveRegion) {\n const el = document.createElement('div');\n el.setAttribute('aria-live', 'assertive');\n el.setAttribute('aria-atomic', 'true');\n el.setAttribute('role', 'status');\n el.style.cssText = 'position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;';\n document.body.appendChild(el);\n this._liveRegion = el;\n }\n this._liveRegion.textContent = '';\n setTimeout(() => { if (this._liveRegion) this._liveRegion.textContent = message; }, 100);\n }\n\n /**\n * Destroy the instance and clean up DOM/events.\n */\n destroy() {\n if (this._destroyed) return;\n this._destroyed = true;\n\n // ── Cancel confetti animation frame ──\n if (this._confettiRafId) {\n cancelAnimationFrame(this._confettiRafId);\n this._confettiRafId = null;\n }\n\n // ── Clear confetti burst timeouts ──\n if (this._confettiTimeouts) {\n this._confettiTimeouts.forEach(clearTimeout);\n this._confettiTimeouts = [];\n }\n\n // ── Remove canvas event listeners ──\n if (this._canvasEl) {\n this._canvasEl.removeEventListener('mousedown', this._boundStartScratch);\n this._canvasEl.removeEventListener('mousemove', this._boundMoveScratch);\n this._canvasEl.removeEventListener('mouseup', this._boundEndScratch);\n this._canvasEl.removeEventListener('mouseleave', this._boundEndScratch);\n this._canvasEl.removeEventListener('touchstart', this._boundStartScratch);\n this._canvasEl.removeEventListener('touchmove', this._boundMoveScratch);\n this._canvasEl.removeEventListener('touchend', this._boundEndScratch);\n this._canvasEl.removeEventListener('touchcancel', this._boundEndScratch);\n }\n\n // ── Remove coin listeners ──\n if (this._coinEl && this._boundStartCoinDrag) {\n this._coinEl.removeEventListener('mousedown', this._boundStartCoinDrag);\n this._coinEl.removeEventListener('touchstart', this._boundStartCoinDrag);\n }\n\n // ── Remove global document listeners (prevents memory leak) ──\n if (this._boundDocMouseMove) {\n document.removeEventListener('mousemove', this._boundDocMouseMove);\n document.removeEventListener('mouseup', this._boundDocMouseUp);\n document.removeEventListener('touchmove', this._boundDocTouchMove);\n document.removeEventListener('touchend', this._boundDocTouchEnd);\n document.removeEventListener('touchcancel', this._boundDocTouchCancel);\n }\n\n // ── Remove modal event listeners ──\n if (this._modalEl && this._boundModalClick) {\n this._modalEl.removeEventListener('click', this._boundModalClick);\n }\n if (this._claimBtnEl && this._boundClaimClick) {\n this._claimBtnEl.removeEventListener('click', this._boundClaimClick);\n }\n\n // ── Remove global keyboard listener ──\n if (this._boundDocKeydown) {\n document.removeEventListener('keydown', this._boundDocKeydown);\n }\n\n // ── Remove live-region ──\n if (this._liveRegion?.parentNode) {\n this._liveRegion.parentNode.removeChild(this._liveRegion);\n }\n\n // Disconnect resize observer\n if (this._resizeObserver) {\n this._resizeObserver.disconnect();\n this._resizeObserver = null;\n }\n\n // Remove modal\n if (this._modalEl && this._modalEl.parentNode) {\n this._modalEl.parentNode.removeChild(this._modalEl);\n }\n\n // Remove root\n if (this._rootEl && this._rootEl.parentNode) {\n this._rootEl.parentNode.removeChild(this._rootEl);\n }\n\n // Clear all references to prevent memory leaks\n this._rootEl = null;\n this._zoneEl = null;\n this._canvasEl = null;\n this._ctx = null;\n this._coinEl = null;\n this._giftIconEl = null;\n this._modalEl = null;\n this._confettiCanvasEl = null;\n this._prizeContentEl = null;\n this._instructionEl = null;\n this._prize = null;\n this._lastPoint = null;\n this._liveRegion = null;\n this._claimBtnEl = null;\n }\n\n /** Get the current prize object */\n get prize() {\n return this._prize;\n }\n}\n\n/* ------------------------------------------------------------------ */\n/* Static factory */\n/* ------------------------------------------------------------------ */\n\nexport const ScratchCard = {\n /**\n * Create and return a new ScratchCardInstance.\n * @param {ScratchCardOptions} opts\n * @returns {ScratchCardInstance}\n */\n init(opts) {\n return new ScratchCardInstance(opts);\n },\n \n /** The underlying class – useful for `instanceof` checks or subclassing. */\n Instance: ScratchCardInstance,\n \n /** Current SDK version */\n VERSION: '0.1.0-alpha.1',\n \n /** Export defaults for reference */\n DEFAULTS: DEFAULTS,\n};\n","/**\n * ScratchCard React Component (ES6 class-based wrapper)\n *\n * @example\n * import { ScratchCardReact } from 'spin-wheel-sdk/react';\n *\n * <ScratchCardReact\n * ref={cardRef}\n * prize={{ name: 'iPhone 16', icon: '📱', label: 'Congratulations!' }}\n * onReveal={(prize) => console.log(prize)}\n * />\n */\n\nimport { ScratchCard } from './ScratchCard.js';\n\n/**\n * All supported prop keys for ScratchCardReact component.\n * Used for copying props to SDK options.\n */\nconst PROP_KEYS = Object.freeze([\n // Core\n 'prize',\n \n // Header UI\n 'headerTitle',\n 'headerTitleColor',\n \n // Instruction\n 'instruction',\n 'instructionColor',\n \n // Scratch Behavior\n 'revealThreshold',\n 'brushSize',\n \n // Coin\n 'coinSize',\n 'showCoin',\n 'coinIcon',\n 'coinGradientStart',\n 'coinGradientEnd',\n \n // Card Appearance\n 'cardBackground',\n 'cardShadow',\n 'cardBorderRadius',\n \n // Scratch Zone\n 'scratchZoneBackground',\n 'scratchZoneShadow',\n 'scratchZoneBorderRadius',\n \n // Scratch Layer\n 'scratchLayerColor',\n 'scratchLayerSparkles',\n 'scratchLayerSparkleCount',\n \n // Prize Display\n 'prizeTextColor',\n 'prizeNameColor',\n 'prizeIconBackground',\n \n // Gift Icon\n 'showGiftIcon',\n 'giftIcon',\n 'giftIconBackground',\n \n // Modal\n 'showModal',\n 'modalTitle',\n 'modalTitleColor',\n 'modalButtonText',\n 'modalButtonColor',\n 'modalButtonTextColor',\n 'modalBackdropBlur',\n \n // Confetti\n 'confettiEnabled',\n 'confettiColors',\n 'confettiCount',\n 'confettiDuration',\n \n // Animation\n 'animationType',\n 'animationDuration',\n \n // Theme\n 'theme',\n]);\n\n/**\n * Creates the ScratchCardReact component using the provided React instance.\n * This factory pattern avoids bundling React into the SDK.\n *\n * @param {typeof import('react')} React – the React module\n * @returns {{ ScratchCardReact: React.ForwardRefExoticComponent }}\n */\nexport function createScratchCardReact(React) {\n const { useEffect, useRef, useImperativeHandle, forwardRef, createElement } = React;\n\n const ScratchCardReact = forwardRef(function ScratchCardReact(props, ref) {\n const containerRef = useRef(null);\n const instanceRef = useRef(null);\n\n // Keep latest callbacks in a ref so they're always fresh\n const callbacksRef = useRef({});\n callbacksRef.current.onScratchStart = props.onScratchStart;\n callbacksRef.current.onScratchProgress = props.onScratchProgress;\n callbacksRef.current.onReveal = props.onReveal;\n callbacksRef.current.onClaim = props.onClaim;\n\n // Mount the SDK once, destroy on unmount (SSR-safe)\n useEffect(() => {\n if (!containerRef.current || typeof window === 'undefined') return;\n\n const opts = {};\n\n // Copy only defined props\n PROP_KEYS.forEach((k) => {\n if (props[k] !== undefined) opts[k] = props[k];\n });\n\n opts.container = containerRef.current;\n\n // Wrap callbacks so they always point to latest prop\n opts.onScratchStart = () => callbacksRef.current.onScratchStart?.();\n opts.onScratchProgress = (percent) => callbacksRef.current.onScratchProgress?.(percent);\n opts.onReveal = (prize) => callbacksRef.current.onReveal?.(prize);\n opts.onClaim = (prize) => callbacksRef.current.onClaim?.(prize);\n\n try {\n instanceRef.current = ScratchCard.init(opts);\n } catch (err) {\n console.error('[ScratchCardReact] Failed to initialize ScratchCard:', err);\n }\n\n return () => {\n try {\n instanceRef.current?.destroy();\n } catch (_) { /* noop */ }\n instanceRef.current = null;\n };\n }, []); // mount-only\n\n // Live-update prize when the prop changes\n useEffect(() => {\n if (instanceRef.current && props.prize) {\n try {\n instanceRef.current.updatePrize(props.prize);\n } catch (_) { /* ignore on first mount */ }\n }\n }, [props.prize]);\n\n // Expose imperative handle\n useImperativeHandle(ref, () => ({\n /** Programmatically reveal the prize */\n reveal() { instanceRef.current?.reveal(); },\n\n /** Hide the modal */\n hideModal() { instanceRef.current?.hideModal(); },\n\n /** Show the modal */\n showModal() { instanceRef.current?.showModal(); },\n\n /** Reset the scratch card */\n reset() { instanceRef.current?.reset(); },\n\n /** Update prize at runtime */\n updatePrize(prize) { instanceRef.current?.updatePrize(prize); },\n\n /** Update options at runtime */\n updateOptions(opts) { instanceRef.current?.updateOptions(opts); },\n\n /** Get the current scratch percentage */\n get scratchPercent() { return instanceRef.current?.scratchPercent; },\n\n /** Get whether the prize has been revealed */\n get hasRevealed() { return instanceRef.current?.hasRevealed; },\n\n /** Get the current prize */\n get prize() { return instanceRef.current?.prize; },\n\n /** Access the raw ScratchCardInstance */\n get instance() { return instanceRef.current; },\n }), []);\n\n return createElement('div', {\n ref: containerRef,\n className: props.className || '',\n style: props.style || {},\n });\n });\n\n ScratchCardReact.displayName = 'ScratchCardReact';\n return ScratchCardReact;\n}\n\n/* ------------------------------------------------------------------\n Auto-detect React on `window` for UMD / CDN usage.\n In bundled ESM builds consumers call createScratchCardReact(React).\n ------------------------------------------------------------------ */\nlet _ScratchCardReact = null;\n\nif (typeof window !== 'undefined' && window.React) {\n _ScratchCardReact = createScratchCardReact(window.React);\n}\n\nexport { _ScratchCardReact as ScratchCardReact };\n"],"names":["buildCSS","config","hexToRGBA","t","theme","gold","goldLight","goldDark","bgDark","textMuted","titleColor","subtitleColor","ringColor","pointerColor","buttonBaseColor","buttonColor","redeemBtnTop","winCardRedeemButtonColorTop","redeemBtnBottom","winCardRedeemButtonColorBottom","redeemBtnText","winCardRedeemButtonTextColor","ringShadow","ringAnimation","buttonShadow","buttonAnimation","ringGlow","buttonGlow","bgStyle","backgroundColor","bgImageStyle","backgroundImage","ringBoxShadow","ringAnimationCSS","buttonBoxShadow","buttonHoverStyle","buttonActiveStyle","hex","alpha","cleanHex","replace","r","parseInt","slice","g","b","isPlainObject","item","Array","isArray","constructor","Object","deepMerge","target","sources","length","source","shift","key","prototype","hasOwnProperty","call","undefined","randomCode","len","chars","code","i","Math","floor","random","buildClipPath","angleDeg","points","steps","max","round","rad","PI","a","x","cos","toFixed","y","sin","push","join","textRotation","escapeHtml","str","String","COPY_ICON_SVG","CHECK_ICON_SVG","ARROW_ICON_SVG","CONFETTI_COLORS","DEFAULTS","freeze","container","segments","winningIndex","spinDuration","minSpins","maxSpins","spinLimit","headerTitle","headerSubtitle","hubLabel","hubIcon","showButton","buttonText","showWinCard","generateCode","codeLength","redeemUrl","winCardBrandLabel","winCardWorthLabel","winCardRedeemButtonText","confettiOnWin","confettiColors","confettiCount","onSpinStart","onSpinEnd","onRedeem","onSpinLimitReached","_validateOptions","_validateOptions$1","opts","Error","s","label","color","isNaN","console","warn","min","maxIdx","_isBrowser","window","document","_prefersReducedMotion","_prefersReducedMotion$1","matchMedia","matches","_injectedThemeKey","injectCSS","injectCSS$1","options","styleConfig","JSON","stringify","existing","querySelector","remove","style","createElement","setAttribute","textContent","head","appendChild","SpinWheelInstance","currentRotation","isSpinning","_destroyed","_lastWonPrize","_lastWonIndex","_spinCount","_rafId","_boundListeners","containerEl","segmentAngle","_rootEl","_wheelEl","_hubEl","_pointerEl","_btnEl","_overlayEl","_confettiEl","_cardProductEl","_cardBrandEl","_cardTitleEl","_cardWorthEl","_cardCodeEl","_cardCopyEl","_cardRedeemEl","_cardRedeemTextEl","_build","_bind","o","root","className","header","parts","split","innerHTML","wc","wo","wi","wheel","_buildSegments","hub","title","append","pointer","btn","type","_buildOverlay","angle","clip","rot","p","seg","transform","clipPath","webkitClipPath","background","icon","brandLabel","redeemText","overlay","confetti","card","bl","_btnClick","spin","addEventListener","_hubClick","e","stopPropagation","_hubKeydown","preventDefault","_btnKeydown","_overlayClick","hideWinCard","_copyClick","value","select","setSelectionRange","navigator","clipboard","writeText","then","_showCopied","execCommand","_","_redeemClick","err","error","open","_docKeydown","classList","contains","setTimeout","_isSpinLimitReached","limit","forceIndex","disabled","add","count","segAngle","isValidIndex","idx","winIndex","segmentCenter","fullSpins","pointerAt","remainder","targetAngle","totalRotation","duration","startTime","performance","now","startRot","animate","elapsed","progress","easeOut","pow","rotation","requestAnimationFrame","_highlightPointer","_showWinCard","offsetHeight","prize","worthLabel","worth","display","parentElement","_createConfetti","_announceToScreenReader","colors","span","left","top","animationDelay","animationDuration","updateSegments","newSegments","destroy","cancelAnimationFrame","removeEventListener","_liveRegion","parentNode","removeChild","lastWonPrize","lastWonIndex","spinCount","remainingSpins","resetSpinCount","message","el","cssText","body","updateOptions","newOptions","merged","keys","SpinWheel","init","Instance","VERSION","PROP_KEYS","createSpinWheelReact","React","useEffect","useRef","useImperativeHandle","forwardRef","SpinWheelReact","props","ref","containerRef","instanceRef","callbacksRef","current","forEach","k","segs","instance","displayName","_SpinWheelReact","buildScratchCSS","purpleDark","purpleMid","purpleLight","white","textDark","headerTitleColor","instructionColor","coinStart","coinGradientStart","coinEnd","coinGradientEnd","prizeTextColor","prizeNameColor","prizeIconBg","prizeIconBackground","giftIconBg","giftIconBackground","modalTitleColor","modalBtnText","modalButtonTextColor","cardShadow","scratchZoneShadow","modalBackdropBlur","cardBorderRadius","scratchZoneBorderRadius","animDuration","animType","animationType","cardBg","cardBackground","scratchZoneBg","scratchZoneBackground","modalBtnBg","modalButtonColor","cardBoxShadow","zoneShadow","backdropBlur","cardAnimation","modalAnimation","instruction","revealThreshold","brushSize","coinSize","showCoin","coinIcon","scratchLayerColor","scratchLayerSparkles","scratchLayerSparkleCount","showGiftIcon","giftIcon","showModal","modalTitle","modalButtonText","confettiEnabled","confettiDuration","onScratchStart","onScratchProgress","onReveal","onClaim","name","includes","ScratchCardInstance","scratchPercent","isScratching","isDraggingCoin","hasRevealed","_scratchStartFired","_confettiRafId","_confettiTimeouts","_prize","zoneW","zoneH","_lastPoint","_resizeObserver","_zoneEl","_canvasEl","_ctx","_coinEl","_giftIconEl","_modalEl","_confettiCanvasEl","_prizeContentEl","_instructionEl","pageBg","wrapper","zone","id","_id","prizeContent","canvas","getContext","prizeIconVisible","coin","_buildModal","_initCanvas","toString","confettiCanvas","bgGlow","modalCard","setSize","w","clientWidth","h","clientHeight","dpr","devicePixelRatio","width","ceil","height","setTransform","scale","_drawSurface","_positionCoinInitial","ResizeObserver","observe","ctx","fillStyle","fillRect","sparkleCount","globalCompositeOperation","beginPath","arc","fill","coinRadius","_boundStartScratch","_onStartScratch","bind","_boundMoveScratch","_onMoveScratch","_boundEndScratch","_onEndScratch","passive","_boundStartCoinDrag","_onStartCoinDrag","_boundDocMouseMove","_onMoveCoinDrag","_boundDocMouseUp","_onEndCoinDrag","_boundDocTouchMove","_boundDocTouchEnd","_boundDocTouchCancel","_boundModalClick","hideModal","btnClaim","_boundClaimClick","_claimBtnEl","_boundDocKeydown","_getEventPoint","rect","getBoundingClientRect","touches","clientX","clientY","_scratch","point","dx","dy","dist","sqrt","radius","_updateScratchPercent","cw","ch","imageData","getImageData","data","transparent","step","total","_reveal","clearRect","_startConfetti","claimBtn","focus","c","_clampCoinPosition","_updateCoinPosition","cx","cy","cctx","particles","centerX","centerY","speed","vx","vy","size","rotationSpeed","opacity","birth","_addBurst","gravity","friction","Date","age","life","save","globalAlpha","translate","rotate","restore","reveal","reset","updatePrize","circle","clearTimeout","disconnect","ScratchCard","createScratchCardReact","ScratchCardReact","percent","_ScratchCardReact"],"mappings":";;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,QAAQA,CAACC,MAAM,EAAEC,SAAS,EAAE;EAC1C,MAAMC,CAAC,GAAGF,MAAM,CAACG,KAAK,IAAI,CAAA,CAAE;;EAE9B;EACE,MAAMC,IAAI,GAAGF,CAAC,CAACE,IAAI,IAAI,SAAS;EAChC,MAAMC,SAAS,GAAGH,CAAC,CAACG,SAAS,IAAI,SAAS;EAC1C,MAAMC,QAAQ,GAAGJ,CAAC,CAACI,QAAQ,IAAI,SAAS;EACzBJ,CAAC,CAACK,MAAM,IAAI,SAAA;EAC3B,MAAMC,SAAS,GAAGN,CAAC,CAACM,SAAS,IAAI,SAAS;;EAE5C;EACE,MAAMC,UAAU,GAAGT,MAAM,CAACS,UAAU,IAAIJ,SAAS;EACjD,MAAMK,aAAa,GAAGV,MAAM,CAACU,aAAa,IAAIF,SAAS;EACvD,MAAMG,SAAS,GAAGX,MAAM,CAACW,SAAS,IAAIP,IAAI;EAC1C,MAAMQ,YAAY,GAAGZ,MAAM,CAACY,YAAY,IAAIR,IAAI;EAChD,MAAMS,eAAe,GAAGb,MAA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W,SAAS,CAACqV,SAAS,EAAE,IAAI,CAAC;AACrF;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAIoC,aAAa;AACjB;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,eAAeT,MAAM;AACrB,kBAAkBL,gBAAgB;AAClC;AACA,IAAIW,aAAa;AACjB;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,UAAU7B,gBAAgB;AAC1B;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,kBAAkBmB,uBAAuB;AACzC;AACA,eAAeM,aAAa;AAC5B,IAAIK,UAAU;AACd;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8BnC,UAAU,QAAQC,SAAS;AACzD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,UAAUU,cAAc;AACxB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,UAAUC,cAAc;AACxB,yBAAyBhW,SAAS,CAACG,IAAI,EAAE,GAAG,CAAC;AAC7C;;AAEA;AACA;AACA;AACA;AACA,eAAe8V,WAAW;AAC1B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAeE,UAAU;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuCR,SAAS,QAAQxV,IAAI,SAAS0V,OAAO;AAC5E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAUA,OAAO;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,UAAUH,gBAAgB;AAC1B;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAI8B,YAAY;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMxX,SAAS,CAACqV,SAAS,EAAE,GAAG,CAAC;AAC/B,MAAMrV,SAAS,CAACoV,UAAU,EAAE,GAAG,CAAC;AAChC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAeG,KAAK;AACpB,kBAAkBoB,gBAAgB;AAClC;AACA;AACA;AACA,IAAIe,cAAc;AAClB;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kDAAkD1X,SAAS,CAACsV,WAAW,EAAE,IAAI,CAAC;AAC9E;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,UAAUe,eAAe;AACzB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,uCAAuCf,WAAW,QAAQD,SAAS;AACnE;AACA;AACA;AACA;AACA;AACA,0BAA0BrV,SAAS,CAACoV,UAAU,EAAE,GAAG,CAAC;AACpD;;AAEA;AACA;AACA;AACA,UAAUI,QAAQ;AAClB;;AAEA;AACA;AACA,UAAUH,SAAS;AACnB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe+B,UAAU;AACzB,UAAUd,YAAY;AACtB;AACA;AACA;AACA;AACA,0BAA0BtW,SAAS,CAACoV,UAAU,EAAE,GAAG,CAAC;AACpD;AACA;;AAEA;AACA;AACA,0BAA0BpV,SAAS,CAACoV,UAAU,EAAE,GAAG,CAAC;AACpD;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,UAAU7U,SAAS;AACnB;A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Oha,MAAM,KAAK,WAAW,IAAIA,MAAM,CAAC0L,KAAK,EAAE;EACjDsO,iBAAiB,GAAGH,sBAAsB,CAAC7Z,MAAM,CAAC0L,KAAK,CAAC;AAC1D;"}
|
|
1
|
+
{"version":3,"file":"spin-wheel-sdk.esm.mjs","sources":["../src/styles.js","../src/utils.js","../src/SpinWheel.js","../src/SpinWheelReact.js","../src/scratchStyles.js","../src/ScratchCard.js","../src/ScratchCardReact.js"],"sourcesContent":["/**\n * Generates the full SDK stylesheet as a string, interpolated with theme colors.\n * @param {object} config - Style configuration object\n * @param {object} config.theme - Theme colors\n * @param {string} [config.titleColor] - Custom title color\n * @param {string} [config.subtitleColor] - Custom subtitle color\n * @param {string} [config.backgroundColor] - Custom background color\n * @param {string} [config.backgroundImage] - Custom background image URL\n * @param {string} [config.ringColor] - Custom ring color\n * @param {boolean} [config.ringShadow] - Enable ring shadow\n * @param {boolean} [config.ringAnimation] - Enable ring animation\n * @param {string} [config.pointerColor] - Custom pointer color\n * @param {string} [config.buttonColor] - Custom button color\n * @param {boolean} [config.buttonShadow] - Enable button shadow\n * @param {boolean} [config.buttonAnimation] - Enable button animation\n * @param {string} [config.winCardRedeemButtonColorTop] - Redeem button gradient top\n * @param {string} [config.winCardRedeemButtonColorBottom] - Redeem button gradient bottom\n * @param {string} [config.winCardRedeemButtonTextColor] - Redeem button text color\n * @param {function} hexToRGBA\n * @returns {string}\n */\nexport function buildCSS(config, hexToRGBA) {\n const t = config.theme || {};\n const isHexColor = (value) => typeof value === 'string' && /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(value.trim());\n const parseRgbLike = (value) => {\n if (typeof value !== 'string') return null;\n const m = value.trim().match(/^rgba?\\(\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})(?:\\s*,\\s*(\\d*\\.?\\d+)\\s*)?\\)$/i);\n if (!m) return null;\n const r = Math.min(255, Math.max(0, Number(m[1])));\n const g = Math.min(255, Math.max(0, Number(m[2])));\n const b = Math.min(255, Math.max(0, Number(m[3])));\n if ([r, g, b].some((n) => Number.isNaN(n))) return null;\n return { r, g, b };\n };\n const parseHex = (value) => {\n if (!isHexColor(value)) return null;\n const hex = value.trim().slice(1);\n if (hex.length === 3) {\n const r = parseInt(hex[0] + hex[0], 16);\n const g = parseInt(hex[1] + hex[1], 16);\n const b = parseInt(hex[2] + hex[2], 16);\n return { r, g, b };\n }\n const r = parseInt(hex.slice(0, 2), 16);\n const g = parseInt(hex.slice(2, 4), 16);\n const b = parseInt(hex.slice(4, 6), 16);\n return { r, g, b };\n };\n const toRGBA = (value, alpha) => {\n const rgb = parseHex(value) || parseRgbLike(value);\n if (!rgb) return `rgba(0,0,0,${alpha})`;\n return `rgba(${rgb.r},${rgb.g},${rgb.b},${alpha})`;\n };\n const darkenColor = (value, amount = 0.22) => {\n const rgb = parseHex(value) || parseRgbLike(value);\n if (!rgb) return null;\n const factor = 1 - Math.min(0.9, Math.max(0, amount));\n const r = Math.round(rgb.r * factor);\n const g = Math.round(rgb.g * factor);\n const b = Math.round(rgb.b * factor);\n return `rgb(${r},${g},${b})`;\n };\n const readableTextOn = (bg) => {\n const rgb = parseHex(bg) || parseRgbLike(bg);\n if (!rgb) return '#1a1a1f';\n const luma = (0.2126 * rgb.r + 0.7152 * rgb.g + 0.0722 * rgb.b) / 255;\n return luma < 0.55 ? '#ffffff' : '#1a1a1f';\n };\n \n // Extract theme colors with fallbacks\n const gold = t.gold || '#e8c547';\n const goldLight = t.goldLight || '#f5d76e';\n const goldDark = t.goldDark || '#c9a227';\n const bgDark = t.bgDark || '#0d0d12';\n const textMuted = t.textMuted || '#9ca3af';\n \n // Configurable colors\n const hasCustomTitleColor = config.titleColor !== null && config.titleColor !== undefined;\n const titleSpinColor = hasCustomTitleColor ? config.titleColor : goldLight;\n const titleWinColor = hasCustomTitleColor ? config.titleColor : goldDark;\n const subtitleColor = config.subtitleColor || textMuted;\n const ringColor = config.ringColor || gold;\n const pointerColor = config.pointerColor || gold;\n const hasCustomButtonColor = config.buttonColor !== null && config.buttonColor !== undefined;\n const buttonBaseColor = hasCustomButtonColor ? config.buttonColor : gold;\n const buttonTextColor = hasCustomButtonColor ? readableTextOn(buttonBaseColor) : '#1a1a1f';\n const buttonEdgeColor = hasCustomButtonColor ? (darkenColor(buttonBaseColor) || 'rgba(0,0,0,0.25)') : goldDark;\n const redeemBtnTop = config.winCardRedeemButtonColorTop || '#15803d';\n const redeemBtnBottom = config.winCardRedeemButtonColorBottom || '#166534';\n const redeemBtnText = config.winCardRedeemButtonTextColor || '#ffffff';\n \n // Feature toggles\n const ringShadow = config.ringShadow !== false;\n const ringAnimation = config.ringAnimation !== false;\n const buttonShadow = config.buttonShadow !== false;\n const buttonAnimation = config.buttonAnimation !== false;\n \n // Computed values\n const glow = hexToRGBA(gold, 0.4);\n const ringGlow = hexToRGBA(ringColor, 0.4);\n const buttonGlow = toRGBA(buttonBaseColor, 0.4);\n \n // Background styles\n const bgStyle = config.backgroundColor \n ? `background-color:${config.backgroundColor};` \n : '';\n const bgImageStyle = config.backgroundImage \n ? `background-image:url('${config.backgroundImage}');background-size:cover;background-position:center;` \n : '';\n\n // Ring shadow and animation\n const ringBoxShadow = ringShadow \n ? `box-shadow:0 0 0 2px rgba(0,0,0,.5), 0 0 50px ${ringGlow}, inset 0 2px 4px rgba(255,255,255,.35), inset 0 -2px 4px rgba(0,0,0,.2);`\n : `box-shadow:0 0 0 2px rgba(0,0,0,.5), inset 0 2px 4px rgba(255,255,255,.35), inset 0 -2px 4px rgba(0,0,0,.2);`;\n \n const ringAnimationCSS = ringAnimation \n ? `animation:sw-ring-pulse 3s ease-in-out infinite;` \n : '';\n\n // Button shadow and animation\n const buttonBoxShadow = buttonShadow\n ? `box-shadow:0 4px 0 ${buttonEdgeColor}, 0 6px 20px ${buttonGlow}, inset 0 1px 0 rgba(255,255,255,.3);`\n : `box-shadow:inset 0 1px 0 rgba(255,255,255,.25);`;\n \n const buttonHoverStyle = buttonAnimation\n ? (buttonShadow\n ? `.sw-spin-btn:hover:not(:disabled){transform:translateY(-2px);box-shadow:0 6px 0 ${buttonEdgeColor},0 8px 28px ${buttonGlow},inset 0 1px 0 rgba(255,255,255,.3)}`\n : `.sw-spin-btn:hover:not(:disabled){transform:translateY(-2px);filter:brightness(1.05)}`)\n : `.sw-spin-btn:hover:not(:disabled){filter:brightness(1.05)}`;\n \n const buttonActiveStyle = buttonAnimation\n ? (buttonShadow\n ? `.sw-spin-btn:active:not(:disabled){transform:translateY(2px);box-shadow:0 2px 0 ${buttonEdgeColor},0 4px 15px ${buttonGlow},inset 0 1px 0 rgba(255,255,255,.2)}`\n : `.sw-spin-btn:active:not(:disabled){transform:translateY(1px);filter:brightness(0.98)}`)\n : `.sw-spin-btn:active:not(:disabled){transform:translateY(1px)}`;\n\n const buttonBackground = hasCustomButtonColor\n ? `background:${buttonBaseColor};`\n : `background:linear-gradient(180deg,${goldLight},${goldDark});`;\n\n return `\n/* === SpinWheel SDK v2.1 === */\n@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700;800&family=Outfit:wght@300;500;600;700&display=swap');\n\n.sw-root *, .sw-overlay * { margin:0; padding:0; box-sizing:border-box; }\n\n.sw-root {\n font-family:'Outfit',sans-serif;\n display:flex; flex-direction:column; align-items:center; width:100%;\n ${bgStyle}\n ${bgImageStyle}\n}\n\n/* ── header ── */\n.sw-header { text-align:center; margin-bottom:.5rem; }\n.sw-title {\n font-family:'Playfair Display',serif;\n font-size:clamp(2rem,6vw,3.5rem); font-weight:800; letter-spacing:.02em;\n}\n.sw-title .sw-spin-text {\n color:${titleSpinColor};\n text-shadow:0 0 30px ${toRGBA(titleSpinColor, 0.4)}, 0 0 60px ${toRGBA(titleSpinColor, 0.2)};\n}\n.sw-title .sw-win-text { color:${titleWinColor}; }\n.sw-subtitle { margin-top:.5rem; color:${subtitleColor}; font-size:1rem; font-weight:300; }\n\n/* ── wheel ── */\n.sw-wheel-container {\n position:relative; width:min(340px,90vw); aspect-ratio:1; margin:2rem; padding-top:28px;\n}\n.sw-wheel-outer {\n position:absolute; inset:-10px; border-radius:50%;\n background:linear-gradient(145deg,${goldLight} 0%,${ringColor} 25%,${goldDark} 50%,${ringColor} 75%,${goldDark} 100%);\n padding:8px;\n ${ringBoxShadow}\n ${ringAnimationCSS}\n}\n${ringAnimation ? `\n@keyframes sw-ring-pulse {\n 0%,100%{box-shadow:0 0 0 2px rgba(0,0,0,.5),0 0 50px ${ringGlow},inset 0 2px 4px rgba(255,255,255,.35),inset 0 -2px 4px rgba(0,0,0,.2)}\n 50%{box-shadow:0 0 0 2px rgba(0,0,0,.5),0 0 65px ${hexToRGBA(ringColor, 0.5)},inset 0 2px 6px rgba(255,255,255,.4),inset 0 -2px 4px rgba(0,0,0,.2)}\n}` : ''}\n.sw-wheel-inner {\n width:100%; height:100%; border-radius:50%; overflow:hidden;\n position:relative; background:transparent;\n box-shadow:inset 0 0 0 3px rgba(0,0,0,.6);\n}\n.sw-wheel {\n width:100%; height:100%; border-radius:50%; position:relative;\n transition:transform .1s linear; will-change:transform;\n}\n.sw-wheel.sw-spinning { transition:none; }\n\n/* ── hub ── */\n.sw-wheel-hub {\n position:absolute; left:50%; top:50%; transform:translate(-50%,-50%);\n width:20%; height:20%; min-width:52px; min-height:52px; border-radius:50%;\n background:linear-gradient(145deg,${goldLight} 0%,${gold} 40%,${goldDark} 100%);\n box-shadow:0 3px 12px rgba(0,0,0,.4), inset 0 2px 4px rgba(255,255,255,.4), inset 0 -1px 2px rgba(0,0,0,.2);\n display:flex; flex-direction:column; align-items:center; justify-content:center;\n z-index:10; cursor:pointer; transition:transform .15s ease, filter .15s ease;\n}\n.sw-wheel-hub:hover { transform:translate(-50%,-50%) scale(1.05); filter:brightness(1.1); }\n.sw-wheel-hub:active { transform:translate(-50%,-50%) scale(.98); }\n.sw-wheel-hub-icon { font-size:12px; color:#1a1a1f; line-height:1; margin-bottom:1px; }\n.sw-wheel-hub-brand { font-size:8px; font-weight:700; color:#1a1a1f; letter-spacing:.02em; text-transform:lowercase; }\n.sw-wheel-hub-brand::first-letter { text-transform:uppercase; }\n\n/* ── segments ── */\n.sw-segment {\n position:absolute; width:50%; height:50%; left:50%; top:50%;\n transform-origin:0% 0%; display:flex; align-items:center; justify-content:center; border:none;\n}\n.sw-segment-content {\n position:absolute; width:70%; top:30%; text-align:center; color:#000; font-weight:600;\n font-size:clamp(.6rem,2vw,.8rem); text-shadow:0 1px 3px rgb(220 220 220/50%);\n display:flex; flex-direction:row; align-items:center; justify-content:center;\n gap:4px; word-wrap:break-word; left:30%;\n}\n.sw-segment-icon { font-size:1em; line-height:1; flex-shrink:0; }\n.sw-segment-label { display:inline-block; }\n\n/* ── pointer ── */\n.sw-pointer {\n position:absolute; top:4px; left:50%; transform:translateX(-50%); z-index:20; width:0; height:0;\n}\n.sw-pointer-outer {\n position:absolute; left:50%; transform:translateX(-50%); width:0; height:0;\n border-left:22px solid transparent; border-right:22px solid transparent;\n border-top:36px solid ${pointerColor};\n filter:drop-shadow(0 3px 8px rgba(0,0,0,.5)) drop-shadow(0 0 10px ${hexToRGBA(pointerColor, 0.4)}); top:-40px;\n}\n.sw-pointer.sw-highlight .sw-pointer-outer {\n animation:sw-pointer-bounce .5s cubic-bezier(.34,1.56,.64,1);\n}\n@keyframes sw-pointer-bounce {\n 0%{transform:translateX(-50%) scale(1)}\n 40%{transform:translateX(-50%) scale(1.12)}\n 100%{transform:translateX(-50%) scale(1)}\n}\n\n/* ── spin button ── */\n.sw-spin-btn {\n font-family:'Outfit',sans-serif; font-size:1.25rem; font-weight:700;\n letter-spacing:.15em; padding:1rem 3rem; border:none; border-radius:12px;\n ${buttonBackground} color:${buttonTextColor};\n cursor:pointer;\n ${buttonBoxShadow}\n transition:transform .15s ease, box-shadow .2s ease, filter .2s ease;\n}\n${buttonHoverStyle}\n${buttonActiveStyle}\n.sw-spin-btn:disabled{opacity:.6;cursor:not-allowed}\n\n/* ── overlay & win card ── */\n.sw-overlay {\n position:fixed; inset:0; background:rgba(0,0,0,.6); backdrop-filter:blur(6px);\n display:flex; align-items:center; justify-content:center;\n z-index:100; opacity:0; visibility:hidden;\n transition:opacity .4s ease, visibility .4s ease;\n font-family:'Outfit',sans-serif;\n}\n.sw-overlay.sw-visible { opacity:1; visibility:visible; }\n\n.sw-win-card {\n position:relative; max-width:340px; width:90%; border-radius:12px; overflow:hidden;\n box-shadow:0 25px 50px -12px rgba(0,0,0,.5), 0 0 0 1px rgba(0,0,0,.1);\n transform:scale(.6); opacity:0; transition:none;\n}\n.sw-overlay.sw-visible .sw-win-card {\n animation:sw-card-flare .6s cubic-bezier(.34,1.56,.64,1) forwards;\n}\n@keyframes sw-card-flare {\n 0%{transform:scale(.6);opacity:0;filter:blur(8px)}\n 50%{transform:scale(1.08);opacity:1;filter:blur(0)}\n 70%{transform:scale(.98)}\n 100%{transform:scale(1);opacity:1;filter:blur(0)}\n}\n\n.sw-win-card-top {\n background:linear-gradient(160deg,#fff,#fff); padding:1.75rem 1.25rem;\n text-align:center; position:relative;\n}\n.sw-win-card-product {\n width:100px; height:100px; margin:0 auto .75rem; border-radius:12px;\n display:flex; align-items:center; justify-content:center; font-size:3rem;\n box-shadow:0 8px 24px rgba(0,0,0,.3); background:linear-gradient(145deg,#252530,#1c1c24);\n}\n.sw-win-card-brand { font-size:1rem; font-weight:600; color:#000; letter-spacing:.05em; }\n\n.sw-win-card-perf { height:14px; background:#fff; position:relative; }\n.sw-win-card-perf::after {\n content:''; position:absolute; left:0; right:0; top:-7px; height:14px;\n background:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='14' viewBox='0 0 12 14'%3E%3Cpath fill='%231a1a22' d='M0 14V7h2v7H0zm2 0V4h2v10H2zm2 0V7h2v7H4zm2 0V4h2v10H6zm2 0V7h2v7H8zm2 0V0h2v14h-2z'/%3E%3C/svg%3E\") repeat-x;\n background-size:12px 14px;\n}\n\n.sw-win-card-mid {\n background:#fff; padding:1.25rem 1.25rem 1.25rem 1rem; position:relative;\n}\n.sw-win-card-title {\n font-size:1rem; font-weight:700; color:#1a1a1f;\n text-transform:lowercase; margin-bottom:.25rem; line-height:1.3;\n}\n.sw-win-card-title::first-letter { text-transform:uppercase; }\n.sw-win-card-worth { font-size:.8rem; color:#6b7280; margin-bottom:.75rem; font-weight:500; }\n.sw-win-card-code-wrap { display:flex; align-items:center; gap:.5rem; }\n.sw-win-card-code {\n flex:1; font-size:.85rem; font-weight:600; letter-spacing:.08em;\n color:#374151; background:#f3f4f6; border:none; border-radius:8px;\n padding:.5rem .75rem; font-family:'Outfit',monospace;\n}\n.sw-win-card-copy {\n width:40px; height:40px; border-radius:8px; border:none;\n background:#e5e7eb; color:#4b5563; cursor:pointer;\n display:flex; align-items:center; justify-content:center;\n transition:background .2s, color .2s;\n}\n.sw-win-card-copy:hover { background:#d1d5db; color:#1f2937; }\n.sw-win-card-copy svg { width:18px; height:18px; }\n\n.sw-win-card-bot {\n background:linear-gradient(180deg,${redeemBtnTop},${redeemBtnBottom});\n padding:1rem 1.25rem; display:flex; align-items:center;\n justify-content:center; gap:.5rem; cursor:pointer;\n transition:filter .2s; position:relative;\n}\n.sw-win-card-bot:hover { filter:brightness(1.08); }\n.sw-win-card-redeem { font-size:1rem; font-weight:700; color:${redeemBtnText}; letter-spacing:.02em; }\n.sw-win-card-arrow { width:20px; height:20px; color:${redeemBtnText}; }\n\n/* ── confetti ── */\n.sw-confetti {\n position:fixed; inset:0; pointer-events:none; z-index:99; overflow:hidden;\n}\n.sw-confetti span {\n position:absolute; width:10px; height:10px; border-radius:2px;\n animation:sw-confetti-fall 1.2s ease-out forwards; opacity:0;\n}\n.sw-overlay.sw-visible .sw-confetti span { opacity:1; }\n@keyframes sw-confetti-fall {\n 0%{transform:translateY(-20px) rotate(0deg);opacity:1}\n 100%{transform:translateY(100vh) rotate(720deg);opacity:0}\n}\n\n/* ── prefers-reduced-motion ── */\n@media (prefers-reduced-motion: reduce) {\n .sw-wheel { transition:none !important; }\n .sw-wheel-outer { animation:none !important; }\n .sw-spin-btn { transition:none !important; }\n .sw-spin-btn:hover:not(:disabled) { transform:none !important; }\n .sw-spin-btn:active:not(:disabled) { transform:none !important; }\n .sw-overlay.sw-visible .sw-win-card { animation:none !important; opacity:1; transform:scale(1); }\n .sw-confetti span { animation:none !important; display:none; }\n .sw-pointer.sw-highlight .sw-pointer-outer { animation:none !important; }\n}\n`;\n}\n","/**\n * SpinWheel SDK – Utility helpers\n * Pure functions with no side effects.\n */\n\n/**\n * Convert a hex colour (#rrggbb) to an rgba() string.\n * @param {string} hex\n * @param {number} alpha\n * @returns {string}\n */\nexport function hexToRGBA(hex, alpha) {\n if (!hex || typeof hex !== 'string') return `rgba(0,0,0,${alpha})`;\n const cleanHex = hex.replace('#', '');\n const r = parseInt(cleanHex.slice(0, 2), 16) || 0;\n const g = parseInt(cleanHex.slice(2, 4), 16) || 0;\n const b = parseInt(cleanHex.slice(4, 6), 16) || 0;\n return `rgba(${r},${g},${b},${alpha})`;\n}\n\n/**\n * Check if a value is a plain object (not array, null, etc.)\n * @param {any} item\n * @returns {boolean}\n */\nexport function isPlainObject(item) {\n return item !== null && typeof item === 'object' && !Array.isArray(item) && item.constructor === Object;\n}\n\n/**\n * Deep merge multiple objects together.\n * Later objects override earlier ones. Arrays are replaced, not merged.\n * @param {object} target - The target object to merge into\n * @param {...object} sources - Source objects to merge from\n * @returns {object} The merged object\n */\nexport function deepMerge(target, ...sources) {\n if (!sources.length) return target;\n const source = sources.shift();\n\n if (isPlainObject(target) && isPlainObject(source)) {\n for (const key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n if (isPlainObject(source[key])) {\n if (!target[key]) {\n target[key] = {};\n }\n deepMerge(target[key], source[key]);\n } else if (source[key] !== undefined) {\n target[key] = source[key];\n }\n }\n }\n }\n\n return deepMerge(target, ...sources);\n}\n\n/**\n * Generate a random alphanumeric coupon code.\n * @param {number} [len=9]\n * @returns {string}\n */\nexport function randomCode(len = 9) {\n const chars = 'ABCDEFGHJKLMNPQRSTUVWXYZ23456789';\n let code = '';\n for (let i = 0; i < len; i++) {\n code += chars[Math.floor(Math.random() * chars.length)];\n }\n return code;\n}\n\n/**\n * Build a CSS `clip-path: polygon(…)` for a pie-slice with a curved outer edge.\n * @param {number} angleDeg – angular width of one segment in degrees\n * @returns {string}\n */\nexport function buildClipPath(angleDeg) {\n const points = ['0 0'];\n const steps = Math.max(12, Math.round(angleDeg / 3));\n const rad = (angleDeg * Math.PI) / 180;\n for (let i = 0; i <= steps; i++) {\n const a = (i / steps) * rad;\n const x = (Math.cos(a) * 100).toFixed(2);\n const y = (Math.sin(a) * 100).toFixed(2);\n points.push(`${x}% ${y}%`);\n }\n return `polygon(${points.join(', ')})`;\n}\n\n/**\n * Text rotation angle so label reads along the bisector of a segment.\n * @param {number} angleDeg\n * @returns {number}\n */\nexport function textRotation(angleDeg) {\n return 90 + angleDeg / 2;\n}\n\n/**\n * Escape HTML special characters.\n * @param {string} str\n * @returns {string}\n */\nexport function escapeHtml(str) {\n if (!str) return '';\n return String(str)\n .replace(/&/g, '&')\n .replace(/</g, '<')\n .replace(/>/g, '>')\n .replace(/\"/g, '"');\n}\n\n/** SVG markup for the copy icon */\nexport const COPY_ICON_SVG =\n '<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect x=\"9\" y=\"9\" width=\"13\" height=\"13\" rx=\"2\" ry=\"2\"/><path d=\"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1\"/></svg>';\n\n/** SVG markup for the check (copied) icon */\nexport const CHECK_ICON_SVG =\n '<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><polyline points=\"20 6 9 17 4 12\"/></svg>';\n\n/** SVG markup for the arrow icon */\nexport const ARROW_ICON_SVG =\n '<svg class=\"sw-win-card-arrow\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><line x1=\"5\" y1=\"12\" x2=\"19\" y2=\"12\"/><polyline points=\"12 5 19 12 12 19\"/></svg>';\n\n/** Default confetti palette */\nexport const CONFETTI_COLORS = ['#e8c547', '#dc2626', '#16a34a', '#2563eb', '#7c3aed', '#ea580c'];\n","/**\n * SpinWheel SDK v0.1.0\n *\n * A fully dynamic, configurable Spin & Win wheel.\n * ES6 class-based. Outputs: UMD · ESM · CJS via Rollup.\n *\n * @example\n * import { SpinWheel } from 'spin-wheel-sdk';\n *\n * const wheel = SpinWheel.init({\n * container: '#app',\n * segments: [\n * { label: 'Prize 1', color: '#55efc4', icon: '🎁' },\n * { label: 'Prize 2', color: '#81ecec', icon: '✨' },\n * ],\n * onSpinEnd(prize, idx) { console.log(prize); },\n * });\n */\n\nimport { buildCSS } from './styles.js';\nimport {\n hexToRGBA,\n randomCode,\n buildClipPath,\n textRotation,\n escapeHtml,\n deepMerge,\n COPY_ICON_SVG,\n CHECK_ICON_SVG,\n ARROW_ICON_SVG,\n CONFETTI_COLORS,\n} from './utils.js';\n\n/* ------------------------------------------------------------------ */\n/* Default configuration */\n/* ------------------------------------------------------------------ */\n\n/** @type {SpinWheelOptions} */\nconst DEFAULTS = Object.freeze({\n // ── Core ──\n container: null,\n segments: [],\n winningIndex: null,\n\n // ── Spin Behavior ──\n spinDuration: 5000,\n minSpins: 5,\n maxSpins: 8,\n spinLimit: null, // null = unlimited, number = max spins allowed\n\n // ── Header UI ──\n headerTitle: null,\n headerSubtitle: null,\n titleColor: null, // uses theme.goldLight if null\n subtitleColor: null, // uses theme.textMuted if null\n\n // ── Hub (center button) ──\n hubLabel: 'Spin & win',\n hubIcon: '▲',\n\n // ── Spin Button ──\n showButton: true,\n buttonText: 'SPIN!',\n\n // ── Wheel Appearance ──\n backgroundColor: null, // page/container background\n backgroundImage: null, // optional background image URL\n ringColor: null, // uses theme gradient if null\n ringShadow: true,\n ringAnimation: true, // pulsing ring glow animation\n pointerColor: null, // uses theme.gold if null\n buttonColor: null, // uses theme gradient if null\n buttonShadow: true,\n buttonAnimation: true, // hover/active animations\n\n // ── Win Card ──\n showWinCard: true,\n generateCode: true,\n codeLength: 9,\n redeemUrl: null,\n winCardBrandLabel: null, // uses hubLabel if null\n winCardWorthLabel: 'WORTH',\n winCardRedeemButtonText: 'Redeem Now',\n winCardRedeemButtonColorTop: '#15803d',\n winCardRedeemButtonColorBottom: '#166534',\n winCardRedeemButtonTextColor: '#ffffff',\n\n // ── Confetti ──\n confettiOnWin: true,\n confettiColors: null, // uses default CONFETTI_COLORS if null\n confettiCount: 40,\n\n // ── Theme Colors ──\n theme: Object.freeze({\n gold: '#e8c547',\n goldLight: '#f5d76e',\n goldDark: '#c9a227',\n bgDark: '#0d0d12',\n textMuted: '#9ca3af',\n }),\n\n // ── Callbacks ──\n onSpinStart: null,\n onSpinEnd: null,\n onRedeem: null,\n onSpinLimitReached: null,\n});\n\n/* ------------------------------------------------------------------ */\n/* Validation */\n/* ------------------------------------------------------------------ */\n\nfunction _validateOptions(opts) {\n // Container — truly required, cannot default\n if (!opts.container) {\n throw new Error('[SpinWheel] \"container\" is required.');\n }\n\n // Segments — truly required, cannot default\n if (!Array.isArray(opts.segments) || opts.segments.length < 2) {\n throw new Error('[SpinWheel] \"segments\" must be an array with at least 2 items.');\n }\n for (let i = 0; i < opts.segments.length; i++) {\n const s = opts.segments[i];\n if (!s || typeof s !== 'object') {\n throw new Error(`[SpinWheel] segments[${i}] must be an object.`);\n }\n if (!s.label || typeof s.label !== 'string') {\n throw new Error(`[SpinWheel] segments[${i}].label is required and must be a string.`);\n }\n if (!s.color || typeof s.color !== 'string') {\n throw new Error(`[SpinWheel] segments[${i}].color is required and must be a string.`);\n }\n }\n\n // ── Clamp / auto-fix numeric & enum values instead of crashing ──\n\n // spinDuration: clamp to min 500\n if (opts.spinDuration !== undefined) {\n if (typeof opts.spinDuration !== 'number' || isNaN(opts.spinDuration)) {\n console.warn('[SpinWheel] \"spinDuration\" must be a number. Using default (5000).');\n opts.spinDuration = DEFAULTS.spinDuration;\n } else if (opts.spinDuration <= 0) {\n console.warn(`[SpinWheel] \"spinDuration\" (${opts.spinDuration}) must be positive. Clamping to 500.`);\n opts.spinDuration = 500;\n }\n }\n\n // codeLength: clamp to min 1\n if (opts.codeLength !== undefined) {\n if (typeof opts.codeLength !== 'number' || isNaN(opts.codeLength)) {\n console.warn('[SpinWheel] \"codeLength\" must be a number. Using default (9).');\n opts.codeLength = DEFAULTS.codeLength;\n } else if (opts.codeLength < 1) {\n console.warn(`[SpinWheel] \"codeLength\" (${opts.codeLength}) is below 1. Clamping to 1.`);\n opts.codeLength = 1;\n } else {\n opts.codeLength = Math.floor(opts.codeLength);\n }\n }\n\n // confettiCount: clamp to min 0\n if (opts.confettiCount !== undefined) {\n if (typeof opts.confettiCount !== 'number' || isNaN(opts.confettiCount)) {\n console.warn('[SpinWheel] \"confettiCount\" must be a number. Using default (40).');\n opts.confettiCount = DEFAULTS.confettiCount;\n } else if (opts.confettiCount < 0) {\n console.warn(`[SpinWheel] \"confettiCount\" (${opts.confettiCount}) is negative. Clamping to 0.`);\n opts.confettiCount = 0;\n }\n }\n\n // minSpins & maxSpins: ensure min <= max, swap if needed\n if (opts.minSpins !== undefined) {\n if (typeof opts.minSpins !== 'number' || isNaN(opts.minSpins)) {\n console.warn('[SpinWheel] \"minSpins\" must be a number. Using default (5).');\n opts.minSpins = DEFAULTS.minSpins;\n } else if (opts.minSpins < 1) {\n console.warn(`[SpinWheel] \"minSpins\" (${opts.minSpins}) is below 1. Clamping to 1.`);\n opts.minSpins = 1;\n }\n }\n if (opts.maxSpins !== undefined) {\n if (typeof opts.maxSpins !== 'number' || isNaN(opts.maxSpins)) {\n console.warn('[SpinWheel] \"maxSpins\" must be a number. Using default (8).');\n opts.maxSpins = DEFAULTS.maxSpins;\n } else if (opts.maxSpins < 1) {\n console.warn(`[SpinWheel] \"maxSpins\" (${opts.maxSpins}) is below 1. Clamping to 1.`);\n opts.maxSpins = 1;\n }\n }\n const min = opts.minSpins ?? DEFAULTS.minSpins;\n const max = opts.maxSpins ?? DEFAULTS.maxSpins;\n if (typeof min === 'number' && typeof max === 'number' && min > max) {\n console.warn(`[SpinWheel] \"minSpins\" (${min}) is greater than \"maxSpins\" (${max}). Swapping values.`);\n opts.minSpins = max;\n opts.maxSpins = min;\n }\n\n // spinLimit: clamp to min 1 if not null\n if (opts.spinLimit !== undefined && opts.spinLimit !== null) {\n if (typeof opts.spinLimit !== 'number' || isNaN(opts.spinLimit)) {\n console.warn('[SpinWheel] \"spinLimit\" must be a positive number or null. Setting to null (unlimited).');\n opts.spinLimit = null;\n } else if (opts.spinLimit < 1) {\n console.warn(`[SpinWheel] \"spinLimit\" (${opts.spinLimit}) is below 1. Clamping to 1.`);\n opts.spinLimit = 1;\n }\n }\n\n // winningIndex: clamp to valid segment range\n if (opts.winningIndex !== undefined && opts.winningIndex !== null) {\n if (typeof opts.winningIndex !== 'number' || isNaN(opts.winningIndex)) {\n console.warn('[SpinWheel] \"winningIndex\" must be a number or null. Setting to null (random).');\n opts.winningIndex = null;\n } else if (opts.winningIndex < 0) {\n console.warn(`[SpinWheel] \"winningIndex\" (${opts.winningIndex}) is negative. Clamping to 0.`);\n opts.winningIndex = 0;\n } else if (opts.winningIndex >= opts.segments.length) {\n const maxIdx = opts.segments.length - 1;\n console.warn(`[SpinWheel] \"winningIndex\" (${opts.winningIndex}) exceeds max (${maxIdx}). Clamping to ${maxIdx}.`);\n opts.winningIndex = maxIdx;\n }\n }\n}\n\n/* ------------------------------------------------------------------ */\n/* SSR guard */\n/* ------------------------------------------------------------------ */\n\nconst _isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';\n\n/** @returns {boolean} Whether the user prefers reduced motion */\nfunction _prefersReducedMotion() {\n return _isBrowser && window.matchMedia?.('(prefers-reduced-motion: reduce)')?.matches;\n}\n\n/* ------------------------------------------------------------------ */\n/* CSS injection (once per page) */\n/* ------------------------------------------------------------------ */\n\nlet _injectedThemeKey = null;\n\nfunction injectCSS(options) {\n if (!_isBrowser) return;\n const theme = { ...DEFAULTS.theme, ...(options.theme || {}) };\n \n // Build a key from all style-affecting options\n const styleConfig = {\n theme,\n titleColor: options.titleColor,\n subtitleColor: options.subtitleColor,\n backgroundColor: options.backgroundColor,\n backgroundImage: options.backgroundImage,\n ringColor: options.ringColor,\n ringShadow: options.ringShadow,\n ringAnimation: options.ringAnimation,\n pointerColor: options.pointerColor,\n buttonColor: options.buttonColor,\n buttonShadow: options.buttonShadow,\n buttonAnimation: options.buttonAnimation,\n winCardRedeemButtonColorTop: options.winCardRedeemButtonColorTop,\n winCardRedeemButtonColorBottom: options.winCardRedeemButtonColorBottom,\n winCardRedeemButtonTextColor: options.winCardRedeemButtonTextColor,\n };\n \n const key = JSON.stringify(styleConfig);\n if (_injectedThemeKey === key) return;\n\n // Remove old stylesheet if exists (SSR-safe)\n const existing = _isBrowser ? document.querySelector('style[data-spin-wheel-sdk]') : null;\n if (existing) existing.remove();\n\n _injectedThemeKey = key;\n const style = document.createElement('style');\n style.setAttribute('data-spin-wheel-sdk', '');\n style.textContent = buildCSS(styleConfig, hexToRGBA);\n document.head.appendChild(style);\n}\n\n/* ------------------------------------------------------------------ */\n/* SpinWheel class */\n/* ------------------------------------------------------------------ */\n\nexport class SpinWheelInstance {\n /**\n * @param {SpinWheelOptions} opts\n */\n constructor(opts) {\n if (!_isBrowser) {\n throw new Error('[SpinWheel] SpinWheel requires a browser environment (window + document).');\n }\n\n // ── validate options ──\n _validateOptions(opts);\n\n /** @type {SpinWheelOptions} */\n this.options = deepMerge({}, DEFAULTS, opts);\n \n // Ensure theme is properly merged\n this.options.theme = { ...DEFAULTS.theme, ...(opts.theme || {}) };\n\n /** Current cumulative rotation in degrees */\n this.currentRotation = 0;\n\n /** Whether the wheel is currently animating */\n this.isSpinning = false;\n\n /** Set to true after .destroy() */\n this._destroyed = false;\n\n /** Last prize won */\n this._lastWonPrize = null;\n\n /** Last won index */\n this._lastWonIndex = -1;\n\n /** Number of spins performed */\n this._spinCount = 0;\n\n /** Active requestAnimationFrame ID (for cancellation on destroy) */\n this._rafId = null;\n\n /** Bound listeners stored for removal in destroy() */\n this._boundListeners = {};\n\n // ── resolve container ──\n this.containerEl =\n typeof this.options.container === 'string'\n ? document.querySelector(this.options.container)\n : this.options.container;\n\n if (!this.containerEl) {\n throw new Error('[SpinWheel] container not found. Ensure the container element exists in the DOM.');\n }\n\n /** Angle per segment in degrees */\n this.segmentAngle = 360 / this.options.segments.length;\n\n // ── inject CSS (idempotent) ──\n injectCSS(this.options);\n\n // ── DOM refs (set in _build) ──\n /** @type {HTMLElement} */ this._rootEl = null;\n /** @type {HTMLElement} */ this._wheelEl = null;\n /** @type {HTMLElement} */ this._hubEl = null;\n /** @type {HTMLElement} */ this._pointerEl = null;\n /** @type {HTMLButtonElement} */ this._btnEl = null;\n /** @type {HTMLElement} */ this._overlayEl = null;\n /** @type {HTMLElement} */ this._confettiEl = null;\n /** @type {HTMLElement} */ this._cardProductEl = null;\n /** @type {HTMLElement} */ this._cardBrandEl = null;\n /** @type {HTMLElement} */ this._cardTitleEl = null;\n /** @type {HTMLElement} */ this._cardWorthEl = null;\n /** @type {HTMLInputElement} */ this._cardCodeEl = null;\n /** @type {HTMLButtonElement} */ this._cardCopyEl = null;\n /** @type {HTMLElement} */ this._cardRedeemEl = null;\n /** @type {HTMLElement} */ this._cardRedeemTextEl = null;\n\n // ── build & bind ──\n this._build();\n this._bind();\n }\n\n /* ================================================================ */\n /* DOM construction */\n /* ================================================================ */\n\n /** Build the full widget DOM tree and attach it to the container. */\n _build() {\n const o = this.options;\n\n // ── root wrapper ──\n const root = document.createElement('div');\n root.className = 'sw-root';\n\n // ── header (optional) ──\n if (o.headerTitle) {\n const header = document.createElement('header');\n header.className = 'sw-header';\n const parts = o.headerTitle.split('&');\n header.innerHTML =\n `<h1 class=\"sw-title\">` +\n `<span class=\"sw-spin-text\">${escapeHtml(parts[0] || 'Spin')}</span>` +\n `${parts.length > 1 ? ` <span class=\"sw-win-text\">& ${escapeHtml(parts[1])}</span>` : ''}` +\n `</h1>` +\n (o.headerSubtitle ? `<p class=\"sw-subtitle\">${escapeHtml(o.headerSubtitle)}</p>` : '');\n root.appendChild(header);\n }\n\n // ── wheel container ──\n const wc = document.createElement('div');\n wc.className = 'sw-wheel-container';\n\n const wo = document.createElement('div');\n wo.className = 'sw-wheel-outer';\n\n const wi = document.createElement('div');\n wi.className = 'sw-wheel-inner';\n\n const wheel = document.createElement('div');\n wheel.className = 'sw-wheel';\n this._wheelEl = wheel;\n\n this._buildSegments(wheel);\n\n // hub\n const hub = document.createElement('div');\n hub.className = 'sw-wheel-hub';\n hub.title = 'Spin the wheel';\n hub.innerHTML =\n `<span class=\"sw-wheel-hub-icon\">${escapeHtml(o.hubIcon)}</span>` +\n `<span class=\"sw-wheel-hub-brand\">${escapeHtml(o.hubLabel)}</span>`;\n this._hubEl = hub;\n\n wi.append(wheel, hub);\n wo.appendChild(wi);\n wc.appendChild(wo);\n\n // pointer\n const pointer = document.createElement('div');\n pointer.className = 'sw-pointer';\n pointer.innerHTML = '<div class=\"sw-pointer-outer\"></div>';\n this._pointerEl = pointer;\n wc.appendChild(pointer);\n\n root.appendChild(wc);\n\n // ── spin button ──\n if (o.showButton) {\n const btn = document.createElement('button');\n btn.className = 'sw-spin-btn';\n btn.type = 'button';\n btn.textContent = o.buttonText;\n this._btnEl = btn;\n root.appendChild(btn);\n }\n\n this.containerEl.appendChild(root);\n this._rootEl = root;\n\n // ── overlay ──\n if (o.showWinCard) {\n this._buildOverlay();\n }\n }\n\n /**\n * Render pie-slice segments into the given wheel element.\n * @param {HTMLElement} wheel\n */\n _buildSegments(wheel) {\n const angle = this.segmentAngle;\n const clip = buildClipPath(angle);\n const rot = textRotation(angle);\n const segments = this.options.segments;\n\n for (let i = 0; i < segments.length; i++) {\n const p = segments[i];\n const seg = document.createElement('div');\n seg.className = 'sw-segment';\n seg.style.transform = `rotate(${i * angle}deg)`;\n seg.style.clipPath = clip;\n seg.style.webkitClipPath = clip;\n seg.style.background = p.color || '#ccc';\n seg.innerHTML =\n `<div class=\"sw-segment-content\" style=\"transform:rotate(${rot}deg)\">` +\n `<span class=\"sw-segment-icon\">${escapeHtml(p.icon || '')}</span>` +\n `<span class=\"sw-segment-label\">${escapeHtml(p.label)}</span>` +\n `</div>`;\n wheel.appendChild(seg);\n }\n }\n\n /** Build the win-card overlay and append it to <body>. */\n _buildOverlay() {\n const o = this.options;\n const brandLabel = o.winCardBrandLabel || o.hubLabel;\n const redeemText = o.winCardRedeemButtonText || 'Redeem Now';\n \n const overlay = document.createElement('div');\n overlay.className = 'sw-overlay';\n\n const confetti = document.createElement('div');\n confetti.className = 'sw-confetti';\n this._confettiEl = confetti;\n\n const card = document.createElement('div');\n card.className = 'sw-win-card';\n card.innerHTML =\n `<div class=\"sw-win-card-top\">` +\n ` <div class=\"sw-win-card-product\">🎁</div>` +\n ` <div class=\"sw-win-card-brand\">${escapeHtml(brandLabel)}</div>` +\n `</div>` +\n `<div class=\"sw-win-card-perf\"></div>` +\n `<div class=\"sw-win-card-mid\">` +\n ` <div class=\"sw-win-card-title\">Prize</div>` +\n ` <div class=\"sw-win-card-worth\">${escapeHtml(o.winCardWorthLabel)} ₹99</div>` +\n ` <div class=\"sw-win-card-code-wrap\">` +\n ` <input type=\"text\" class=\"sw-win-card-code\" readonly value=\"XXXXXXXXX\" />` +\n ` <button type=\"button\" class=\"sw-win-card-copy\" aria-label=\"Copy code\">${COPY_ICON_SVG}</button>` +\n ` </div>` +\n `</div>` +\n `<div class=\"sw-win-card-bot\">` +\n ` <span class=\"sw-win-card-redeem\">${escapeHtml(redeemText)}</span>` +\n ` ${ARROW_ICON_SVG}` +\n `</div>`;\n\n overlay.append(confetti, card);\n this.containerEl.appendChild(overlay);\n\n this._overlayEl = overlay;\n this._cardProductEl = card.querySelector('.sw-win-card-product');\n this._cardBrandEl = card.querySelector('.sw-win-card-brand');\n this._cardTitleEl = card.querySelector('.sw-win-card-title');\n this._cardWorthEl = card.querySelector('.sw-win-card-worth');\n this._cardCodeEl = card.querySelector('.sw-win-card-code');\n this._cardCopyEl = card.querySelector('.sw-win-card-copy');\n this._cardRedeemEl = card.querySelector('.sw-win-card-bot');\n this._cardRedeemTextEl = card.querySelector('.sw-win-card-redeem');\n }\n\n /* ================================================================ */\n /* Event binding */\n /* ================================================================ */\n\n /** Wire up all interactive event listeners with proper references for cleanup. */\n _bind() {\n const bl = this._boundListeners;\n\n // Spin button\n if (this._btnEl) {\n bl._btnClick = () => this.spin();\n this._btnEl.addEventListener('click', bl._btnClick);\n }\n\n // Hub click + keyboard (Enter / Space)\n if (this._hubEl) {\n this._hubEl.setAttribute('tabindex', '0');\n this._hubEl.setAttribute('role', 'button');\n this._hubEl.setAttribute('aria-label', 'Spin the wheel');\n\n bl._hubClick = (e) => { e.stopPropagation(); this.spin(); };\n bl._hubKeydown = (e) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n this.spin();\n }\n };\n this._hubEl.addEventListener('click', bl._hubClick);\n this._hubEl.addEventListener('keydown', bl._hubKeydown);\n }\n\n // Keyboard: Enter/Space on spin button\n if (this._btnEl) {\n bl._btnKeydown = (e) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n this.spin();\n }\n };\n this._btnEl.addEventListener('keydown', bl._btnKeydown);\n }\n\n // Overlay events\n if (this._overlayEl) {\n bl._overlayClick = (e) => {\n if (e.target === this._overlayEl) this.hideWinCard();\n };\n this._overlayEl.addEventListener('click', bl._overlayClick);\n\n bl._copyClick = (e) => {\n e.stopPropagation();\n const code = this._cardCodeEl.value;\n this._cardCodeEl.select();\n this._cardCodeEl.setSelectionRange(0, 999);\n if (navigator.clipboard?.writeText) {\n navigator.clipboard.writeText(code).then(() => this._showCopied());\n } else {\n try { document.execCommand('copy'); this._showCopied(); } catch (_) { /* noop */ }\n }\n };\n this._cardCopyEl.addEventListener('click', bl._copyClick);\n\n bl._redeemClick = (e) => {\n e.stopPropagation();\n if (typeof this.options.onRedeem === 'function') {\n try { this.options.onRedeem(this._lastWonPrize); } catch (err) { console.error('[SpinWheel] onRedeem callback error:', err); }\n }\n if (this.options.redeemUrl) {\n window.open(this.options.redeemUrl, '_blank', 'noopener,noreferrer');\n }\n this.hideWinCard();\n };\n this._cardRedeemEl.addEventListener('click', bl._redeemClick);\n }\n\n // Global keyboard: Escape closes win card\n bl._docKeydown = (e) => {\n if (e.key === 'Escape' && this._overlayEl?.classList.contains('sw-visible')) {\n this.hideWinCard();\n }\n };\n document.addEventListener('keydown', bl._docKeydown);\n }\n\n /** Temporarily swap the copy button icon to a checkmark. */\n _showCopied() {\n if (!this._cardCopyEl || this._destroyed) return;\n this._cardCopyEl.innerHTML = CHECK_ICON_SVG;\n setTimeout(() => { if (this._cardCopyEl) this._cardCopyEl.innerHTML = COPY_ICON_SVG; }, 1500);\n }\n\n /* ================================================================ */\n /* Public API */\n /* ================================================================ */\n\n /**\n * Check if spin limit has been reached.\n * @returns {boolean}\n */\n _isSpinLimitReached() {\n const limit = this.options.spinLimit;\n return typeof limit === 'number' && limit > 0 && this._spinCount >= limit;\n }\n\n /**\n * Spin the wheel.\n * Priority: forceIndex > options.winningIndex > random.\n * @param {number} [forceIndex] – optional index to force the result (overrides winningIndex)\n */\n spin(forceIndex) {\n if (this.isSpinning || this._destroyed) return;\n \n // Check spin limit\n if (this._isSpinLimitReached()) {\n if (typeof this.options.onSpinLimitReached === 'function') {\n try { this.options.onSpinLimitReached(this._spinCount); } catch (err) { console.error('[SpinWheel] onSpinLimitReached callback error:', err); }\n }\n return;\n }\n \n this.isSpinning = true;\n this._spinCount++;\n if (this._btnEl) this._btnEl.disabled = true;\n if (this._wheelEl) this._wheelEl.classList.add('sw-spinning');\n\n const { segments, minSpins, maxSpins, spinDuration, winningIndex } = this.options;\n const count = segments.length;\n const segAngle = this.segmentAngle;\n\n // Resolve winning index: forceIndex > winningIndex > random\n // Clamp forceIndex to valid range if provided\n const isValidIndex = (idx) => typeof idx === 'number' && !isNaN(idx) && idx >= 0 && idx < count;\n\n let winIndex;\n if (forceIndex !== undefined && forceIndex !== null) {\n if (typeof forceIndex === 'number' && !isNaN(forceIndex)) {\n winIndex = Math.max(0, Math.min(count - 1, Math.floor(forceIndex)));\n } else {\n console.warn(`[SpinWheel] spin(forceIndex): invalid forceIndex \"${forceIndex}\". Using random.`);\n winIndex = Math.floor(Math.random() * count);\n }\n } else if (isValidIndex(winningIndex)) {\n winIndex = winningIndex;\n } else {\n winIndex = Math.floor(Math.random() * count);\n }\n\n if (typeof this.options.onSpinStart === 'function') {\n try { this.options.onSpinStart(winIndex); } catch (err) { console.error('[SpinWheel] onSpinStart callback error:', err); }\n }\n\n const segmentCenter = winIndex * segAngle + segAngle / 2;\n const fullSpins = (minSpins || 5) + Math.floor(Math.random() * ((maxSpins || 8) - (minSpins || 5) + 1));\n const pointerAt = 270;\n const remainder = (pointerAt - segmentCenter - (this.currentRotation % 360) + 720) % 360;\n const targetAngle = 360 * fullSpins + remainder;\n const totalRotation = this.currentRotation + targetAngle;\n const duration = spinDuration || 5000;\n const startTime = performance.now();\n const startRot = this.currentRotation;\n\n const animate = (now) => {\n if (this._destroyed) return;\n const elapsed = now - startTime;\n const progress = Math.min(elapsed / duration, 1);\n const easeOut = 1 - Math.pow(1 - progress, 3);\n const rotation = startRot + targetAngle * easeOut;\n if (this._wheelEl) this._wheelEl.style.transform = `rotate(${rotation}deg)`;\n\n if (progress < 1) {\n this._rafId = requestAnimationFrame(animate);\n } else {\n this.currentRotation = totalRotation % 360;\n if (this._wheelEl) {\n this._wheelEl.classList.remove('sw-spinning');\n this._wheelEl.style.transform = `rotate(${this.currentRotation}deg)`;\n }\n this._highlightPointer();\n\n this._lastWonPrize = segments[winIndex];\n this._lastWonIndex = winIndex;\n\n if (typeof this.options.onSpinEnd === 'function') {\n try { this.options.onSpinEnd(segments[winIndex], winIndex); } catch (err) { console.error('[SpinWheel] onSpinEnd callback error:', err); }\n }\n if (this.options.showWinCard) {\n this._showWinCard(segments[winIndex]);\n }\n\n this.isSpinning = false;\n \n // Re-enable button only if spin limit not reached\n if (this._btnEl) {\n this._btnEl.disabled = this._isSpinLimitReached();\n }\n }\n };\n\n this._rafId = requestAnimationFrame(animate);\n }\n\n /** Bounce the pointer for visual feedback. */\n _highlightPointer() {\n if (!this._pointerEl || this._destroyed) return;\n this._pointerEl.classList.remove('sw-highlight');\n void this._pointerEl.offsetHeight; // force reflow\n this._pointerEl.classList.add('sw-highlight');\n setTimeout(() => this._pointerEl.classList.remove('sw-highlight'), 500);\n }\n\n /**\n * Populate and reveal the win-card overlay.\n * @param {SegmentConfig} prize\n */\n _showWinCard(prize) {\n if (!prize || this._destroyed) return;\n const o = this.options;\n \n // Update product icon and background\n if (this._cardProductEl) {\n this._cardProductEl.textContent = prize.icon || '🎁';\n this._cardProductEl.style.background =\n `linear-gradient(145deg,${prize.color || '#252530'}22,${prize.color || '#1c1c24'}11)`;\n }\n \n // Update title\n if (this._cardTitleEl) {\n this._cardTitleEl.textContent = prize.title || prize.label || '';\n }\n \n // Update worth label with configurable prefix\n if (this._cardWorthEl) {\n const worthLabel = o.winCardWorthLabel || 'WORTH';\n this._cardWorthEl.textContent = prize.worth ? `${worthLabel} ${prize.worth}` : '';\n this._cardWorthEl.style.display = prize.worth ? '' : 'none';\n }\n\n // Handle code generation/display\n if (this._cardCodeEl) {\n if (o.generateCode) {\n this._cardCodeEl.value = prize.code || randomCode(o.codeLength);\n if (this._cardCodeEl.parentElement) this._cardCodeEl.parentElement.style.display = '';\n } else if (prize.code) {\n this._cardCodeEl.value = prize.code;\n if (this._cardCodeEl.parentElement) this._cardCodeEl.parentElement.style.display = '';\n } else {\n if (this._cardCodeEl.parentElement) this._cardCodeEl.parentElement.style.display = 'none';\n }\n }\n\n // Update redeem button text if configured\n if (this._cardRedeemTextEl && o.winCardRedeemButtonText) {\n this._cardRedeemTextEl.textContent = o.winCardRedeemButtonText;\n }\n\n // Create confetti only if enabled (and no reduced motion preference)\n if (o.confettiOnWin !== false && !_prefersReducedMotion()) {\n this._createConfetti();\n }\n \n if (this._overlayEl) this._overlayEl.classList.add('sw-visible');\n\n // A11y: announce the win to screen readers\n this._announceToScreenReader(`You won ${prize.title || prize.label || 'a prize'}${prize.worth ? ', worth ' + prize.worth : ''}.`);\n }\n\n /** Programmatically close the win-card overlay. */\n hideWinCard() {\n if (this._overlayEl) this._overlayEl.classList.remove('sw-visible');\n }\n\n /** Generate confetti particles inside the overlay. */\n _createConfetti() {\n if (!this._confettiEl || this._destroyed) return;\n const o = this.options;\n const colors = o.confettiColors || CONFETTI_COLORS;\n const count = o.confettiCount || 40;\n \n this._confettiEl.innerHTML = '';\n for (let i = 0; i < count; i++) {\n const span = document.createElement('span');\n span.style.left = `${Math.random() * 100}%`;\n span.style.top = '-10px';\n span.style.background = colors[Math.floor(Math.random() * colors.length)];\n span.style.animationDelay = `${Math.random() * 0.3}s`;\n span.style.animationDuration = `${0.8 + Math.random() * 0.6}s`;\n this._confettiEl.appendChild(span);\n }\n }\n\n /**\n * Replace all segments at runtime and re-render the wheel.\n * @param {SegmentConfig[]} newSegments\n */\n updateSegments(newSegments) {\n if (this._destroyed) return;\n if (!Array.isArray(newSegments) || newSegments.length < 2) {\n console.warn('[SpinWheel] updateSegments: at least 2 segments are required. Ignoring.');\n return;\n }\n this.options.segments = newSegments;\n this.segmentAngle = 360 / newSegments.length;\n if (this._wheelEl) {\n this._wheelEl.innerHTML = '';\n this._buildSegments(this._wheelEl);\n }\n this.currentRotation = 0;\n if (this._wheelEl) this._wheelEl.style.transform = 'rotate(0deg)';\n }\n\n /**\n * Remove all SDK-created DOM, event listeners, and animation frames.\n * Safe to call multiple times.\n */\n destroy() {\n if (this._destroyed) return;\n this._destroyed = true;\n\n // ── Cancel pending animation frame ──\n if (this._rafId) {\n cancelAnimationFrame(this._rafId);\n this._rafId = null;\n }\n\n // ── Remove all event listeners ──\n const bl = this._boundListeners;\n if (bl._btnClick && this._btnEl) {\n this._btnEl.removeEventListener('click', bl._btnClick);\n this._btnEl.removeEventListener('keydown', bl._btnKeydown);\n }\n if (bl._hubClick && this._hubEl) {\n this._hubEl.removeEventListener('click', bl._hubClick);\n this._hubEl.removeEventListener('keydown', bl._hubKeydown);\n }\n if (bl._overlayClick && this._overlayEl) {\n this._overlayEl.removeEventListener('click', bl._overlayClick);\n }\n if (bl._copyClick && this._cardCopyEl) {\n this._cardCopyEl.removeEventListener('click', bl._copyClick);\n }\n if (bl._redeemClick && this._cardRedeemEl) {\n this._cardRedeemEl.removeEventListener('click', bl._redeemClick);\n }\n if (bl._docKeydown) {\n document.removeEventListener('keydown', bl._docKeydown);\n }\n this._boundListeners = {};\n\n // ── Remove live-region ──\n if (this._liveRegion?.parentNode) {\n this._liveRegion.parentNode.removeChild(this._liveRegion);\n }\n\n // ── Remove DOM ──\n this._rootEl?.parentNode?.removeChild(this._rootEl);\n this._overlayEl?.parentNode?.removeChild(this._overlayEl);\n \n // Clear all DOM references to prevent memory leaks\n this._rootEl = null;\n this._wheelEl = null;\n this._hubEl = null;\n this._pointerEl = null;\n this._btnEl = null;\n this._overlayEl = null;\n this._confettiEl = null;\n this._cardProductEl = null;\n this._cardBrandEl = null;\n this._cardTitleEl = null;\n this._cardWorthEl = null;\n this._cardCodeEl = null;\n this._cardCopyEl = null;\n this._cardRedeemEl = null;\n this._cardRedeemTextEl = null;\n this._liveRegion = null;\n }\n\n /** The last prize that was won. */\n get lastWonPrize() {\n return this._lastWonPrize;\n }\n\n /** The last won segment index. */\n get lastWonIndex() {\n return this._lastWonIndex;\n }\n\n /** The current spin count. */\n get spinCount() {\n return this._spinCount;\n }\n\n /** The remaining spins (null if unlimited). */\n get remainingSpins() {\n const limit = this.options.spinLimit;\n if (typeof limit !== 'number' || limit <= 0) return null;\n return Math.max(0, limit - this._spinCount);\n }\n\n /**\n * Reset the spin count to allow more spins.\n * @param {number} [count=0] - New spin count to set\n */\n resetSpinCount(count = 0) {\n this._spinCount = Math.max(0, typeof count === 'number' && !isNaN(count) ? Math.floor(count) : 0);\n if (this._btnEl) {\n this._btnEl.disabled = this._isSpinLimitReached();\n }\n }\n\n /**\n * Announce a message to screen readers via a visually hidden aria-live region.\n * @param {string} message\n */\n _announceToScreenReader(message) {\n if (!_isBrowser) return;\n if (!this._liveRegion) {\n const el = document.createElement('div');\n el.setAttribute('aria-live', 'assertive');\n el.setAttribute('aria-atomic', 'true');\n el.setAttribute('role', 'status');\n el.style.cssText = 'position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;';\n document.body.appendChild(el);\n this._liveRegion = el;\n }\n this._liveRegion.textContent = '';\n // Slight delay so screen readers pick up the change\n setTimeout(() => { if (this._liveRegion) this._liveRegion.textContent = message; }, 100);\n }\n\n /**\n * Update configuration options at runtime.\n * @param {Partial<SpinWheelOptions>} newOptions\n */\n updateOptions(newOptions) {\n if (this._destroyed) return;\n if (!newOptions || typeof newOptions !== 'object') {\n console.warn('[SpinWheel] updateOptions: argument must be an object. Ignoring.');\n return;\n }\n \n // Sanitize numeric/enum values before merging\n const merged = { ...this.options, ...newOptions, container: this.options.container, segments: this.options.segments };\n _validateOptions(merged);\n // Apply sanitized values back\n for (const key of Object.keys(newOptions)) {\n if (key in merged) newOptions[key] = merged[key];\n }\n \n // Merge new options\n this.options = deepMerge({}, this.options, newOptions);\n \n // Handle theme separately for proper nested merge\n if (newOptions.theme) {\n this.options.theme = { ...DEFAULTS.theme, ...this.options.theme, ...newOptions.theme };\n }\n \n // Re-inject CSS if styling options changed\n injectCSS(this.options);\n \n // Update button text if changed\n if (this._btnEl && newOptions.buttonText !== undefined) {\n this._btnEl.textContent = this.options.buttonText;\n }\n \n // Update hub if changed\n if (this._hubEl) {\n if (newOptions.hubLabel !== undefined || newOptions.hubIcon !== undefined) {\n this._hubEl.innerHTML =\n `<span class=\"sw-wheel-hub-icon\">${escapeHtml(this.options.hubIcon)}</span>` +\n `<span class=\"sw-wheel-hub-brand\">${escapeHtml(this.options.hubLabel)}</span>`;\n }\n }\n \n // Update win card brand label if changed\n if (this._cardBrandEl && (newOptions.winCardBrandLabel !== undefined || newOptions.hubLabel !== undefined)) {\n const brandLabel = this.options.winCardBrandLabel || this.options.hubLabel;\n this._cardBrandEl.textContent = brandLabel;\n }\n \n // Update redeem button text if changed\n if (this._cardRedeemTextEl && newOptions.winCardRedeemButtonText !== undefined) {\n this._cardRedeemTextEl.textContent = this.options.winCardRedeemButtonText;\n }\n }\n}\n\n/* ------------------------------------------------------------------ */\n/* Public factory (namespace) */\n/* ------------------------------------------------------------------ */\n\n/**\n * Static factory to create a SpinWheel instance.\n *\n * @example\n * const wheel = SpinWheel.init({ container: '#app', segments: [...] });\n */\nexport class SpinWheel {\n /**\n * Initialise and mount a new Spin Wheel.\n * @param {SpinWheelOptions} options\n * @returns {SpinWheelInstance}\n */\n static init(options) {\n return new SpinWheelInstance(options);\n }\n\n /** The underlying class – useful for `instanceof` checks or subclassing. */\n static Instance = SpinWheelInstance;\n\n /** Current SDK version – kept in sync with package.json via build banner */\n static VERSION = '0.1.0-alpha.2';\n \n /** Export defaults for reference */\n static DEFAULTS = DEFAULTS;\n}\n\n\n","/**\n * SpinWheel React Component (ES6 class-based wrapper)\n *\n * @example\n * import { SpinWheelReact } from 'spin-wheel-sdk/react';\n *\n * <SpinWheelReact\n * ref={wheelRef}\n * segments={[...]}\n * onSpinEnd={(prize, idx) => console.log(prize)}\n * />\n */\n\nimport { SpinWheel } from './SpinWheel.js';\n\n/**\n * All supported prop keys for SpinWheelReact component.\n * Used for copying props to SDK options.\n */\nconst PROP_KEYS = Object.freeze([\n // Core\n 'segments',\n 'winningIndex',\n \n // Spin Behavior\n 'spinDuration',\n 'minSpins',\n 'maxSpins',\n 'spinLimit',\n \n // Header UI\n 'headerTitle',\n 'headerSubtitle',\n 'titleColor',\n 'subtitleColor',\n \n // Hub\n 'hubLabel',\n 'hubIcon',\n \n // Spin Button\n 'showButton',\n 'buttonText',\n \n // Wheel Appearance\n 'backgroundColor',\n 'backgroundImage',\n 'ringColor',\n 'ringShadow',\n 'ringAnimation',\n 'pointerColor',\n 'buttonColor',\n 'buttonShadow',\n 'buttonAnimation',\n \n // Win Card\n 'showWinCard',\n 'generateCode',\n 'codeLength',\n 'redeemUrl',\n 'winCardBrandLabel',\n 'winCardWorthLabel',\n 'winCardRedeemButtonText',\n 'winCardRedeemButtonColorTop',\n 'winCardRedeemButtonColorBottom',\n 'winCardRedeemButtonTextColor',\n \n // Confetti\n 'confettiOnWin',\n 'confettiColors',\n 'confettiCount',\n \n // Theme\n 'theme',\n]);\n\n/**\n * Creates the SpinWheelReact component using the provided React instance.\n * This factory pattern avoids bundling React into the SDK.\n *\n * @param {typeof import('react')} React – the React module\n * @returns {{ SpinWheelReact: React.ForwardRefExoticComponent }}\n */\nexport function createSpinWheelReact(React) {\n const { useEffect, useRef, useImperativeHandle, forwardRef, createElement } = React;\n\n const SpinWheelReact = forwardRef(function SpinWheelReact(props, ref) {\n const containerRef = useRef(null);\n const instanceRef = useRef(null);\n\n // Keep latest callbacks in a ref so they're always fresh\n const callbacksRef = useRef({});\n callbacksRef.current.onSpinStart = props.onSpinStart;\n callbacksRef.current.onSpinEnd = props.onSpinEnd;\n callbacksRef.current.onRedeem = props.onRedeem;\n callbacksRef.current.onSpinLimitReached = props.onSpinLimitReached;\n\n // Mount the SDK once, destroy on unmount (SSR-safe)\n useEffect(() => {\n if (!containerRef.current || typeof window === 'undefined') return;\n\n const opts = {};\n\n // Copy only defined props\n PROP_KEYS.forEach((k) => {\n if (props[k] !== undefined) opts[k] = props[k];\n });\n\n opts.container = containerRef.current;\n\n // Wrap callbacks so they always point to latest prop\n opts.onSpinStart = (idx) => callbacksRef.current.onSpinStart?.(idx);\n opts.onSpinEnd = (prize, idx) => callbacksRef.current.onSpinEnd?.(prize, idx);\n opts.onRedeem = (prize) => callbacksRef.current.onRedeem?.(prize);\n opts.onSpinLimitReached = (count) => callbacksRef.current.onSpinLimitReached?.(count);\n\n try {\n instanceRef.current = SpinWheel.init(opts);\n } catch (err) {\n console.error('[SpinWheelReact] Failed to initialize SpinWheel:', err);\n }\n\n return () => {\n try {\n instanceRef.current?.destroy();\n } catch (_) { /* noop */ }\n instanceRef.current = null;\n };\n }, []); // mount-only\n\n // Live-update segments when the prop changes\n useEffect(() => {\n if (instanceRef.current && props.segments) {\n try {\n instanceRef.current.updateSegments(props.segments);\n } catch (_) { /* ignore on first mount */ }\n }\n }, [props.segments]);\n\n // Expose imperative handle\n useImperativeHandle(ref, () => ({\n /** Trigger a spin (optionally force the winning index) */\n spin(forceIndex) { instanceRef.current?.spin(forceIndex); },\n\n /** Replace segments at runtime */\n updateSegments(segs) { instanceRef.current?.updateSegments(segs); },\n\n /** Close the win-card overlay */\n hideWinCard() { instanceRef.current?.hideWinCard(); },\n\n /** Update options at runtime */\n updateOptions(opts) { instanceRef.current?.updateOptions(opts); },\n\n /** Reset the spin count */\n resetSpinCount(count) { instanceRef.current?.resetSpinCount(count); },\n\n /** Get the current spin count */\n get spinCount() { return instanceRef.current?.spinCount; },\n\n /** Get remaining spins (null if unlimited) */\n get remainingSpins() { return instanceRef.current?.remainingSpins; },\n\n /** Get the last won prize */\n get lastWonPrize() { return instanceRef.current?.lastWonPrize; },\n\n /** Get the last won index */\n get lastWonIndex() { return instanceRef.current?.lastWonIndex; },\n\n /** Access the raw SpinWheelInstance */\n get instance() { return instanceRef.current; },\n }), []);\n\n return createElement('div', {\n ref: containerRef,\n className: props.className || '',\n style: props.style || {},\n });\n });\n\n SpinWheelReact.displayName = 'SpinWheelReact';\n return SpinWheelReact;\n}\n\n/* ------------------------------------------------------------------\n Auto-detect React on `window` for UMD / CDN usage.\n In bundled ESM builds consumers call createSpinWheelReact(React).\n ------------------------------------------------------------------ */\nlet _SpinWheelReact = null;\n\nif (typeof window !== 'undefined' && window.React) {\n _SpinWheelReact = createSpinWheelReact(window.React);\n}\n\nexport { _SpinWheelReact as SpinWheelReact };\n","/**\n * Generates the ScratchCard SDK stylesheet as a string, interpolated with theme colors.\n * @param {object} config - Style configuration object\n * @param {object} config.theme - Theme colors\n * @param {string} [config.headerTitleColor] - Custom header title color\n * @param {string} [config.instructionColor] - Custom instruction color\n * @param {string} [config.coinGradientStart] - Coin gradient start color\n * @param {string} [config.coinGradientEnd] - Coin gradient end color\n * @param {string} [config.cardBackground] - Card background gradient\n * @param {boolean} [config.cardShadow] - Enable card shadow\n * @param {number} [config.cardBorderRadius] - Card border radius\n * @param {string} [config.scratchZoneBackground] - Scratch zone background\n * @param {boolean} [config.scratchZoneShadow] - Enable scratch zone shadow\n * @param {number} [config.scratchZoneBorderRadius] - Scratch zone border radius\n * @param {string} [config.prizeTextColor] - Prize text color\n * @param {string} [config.prizeNameColor] - Prize name color\n * @param {string} [config.prizeIconBackground] - Prize icon background\n * @param {string} [config.giftIconBackground] - Gift icon background\n * @param {string} [config.modalTitleColor] - Modal title color\n * @param {string} [config.modalButtonColor] - Modal button gradient\n * @param {string} [config.modalButtonTextColor] - Modal button text color\n * @param {boolean} [config.modalBackdropBlur] - Enable modal backdrop blur\n * @param {string} [config.animationType] - Animation type\n * @param {number} [config.animationDuration] - Animation duration\n * @param {function} hexToRGBA\n * @returns {string}\n */\nexport function buildScratchCSS(config, hexToRGBA) {\n const t = config.theme || {};\n \n // Extract theme colors with fallbacks\n const purpleDark = t.purpleDark || '#4a2c6a';\n const purpleMid = t.purpleMid || '#6b4a8a';\n const purpleLight = t.purpleLight || '#8b6baa';\n const gold = t.gold || '#d4a84b';\n const goldLight = t.goldLight || '#e8c547';\n const goldDark = t.goldDark || '#b8923a';\n const white = t.white || '#ffffff';\n const textDark = t.textDark || '#2d2d2d';\n const textMuted = t.textMuted || '#6b6b6b';\n \n // Configurable colors\n const headerTitleColor = config.headerTitleColor || textDark;\n const instructionColor = config.instructionColor || textMuted;\n const coinStart = config.coinGradientStart || goldLight;\n const coinEnd = config.coinGradientEnd || goldDark;\n const prizeTextColor = config.prizeTextColor || 'rgba(255,255,255,0.95)';\n const prizeNameColor = config.prizeNameColor || goldLight;\n const prizeIconBg = config.prizeIconBackground || 'rgba(255,255,255,0.15)';\n const giftIconBg = config.giftIconBackground || 'rgba(255,255,255,0.25)';\n const modalTitleColor = config.modalTitleColor || textDark;\n const modalBtnText = config.modalButtonTextColor || white;\n \n // Feature toggles\n const cardShadow = config.cardShadow !== false;\n const scratchZoneShadow = config.scratchZoneShadow !== false;\n const modalBackdropBlur = config.modalBackdropBlur !== false;\n \n // Dimension configs\n const cardBorderRadius = config.cardBorderRadius || 24;\n const scratchZoneBorderRadius = config.scratchZoneBorderRadius || 20;\n const animDuration = config.animationDuration || 600;\n const animType = config.animationType || 'default';\n \n // Background configs\n const cardBg = config.cardBackground || `linear-gradient(180deg, #faf8fc 0%, #f0ebf5 100%)`;\n const hasCustomScratchZoneBg = config.scratchZoneBackground !== null && config.scratchZoneBackground !== undefined;\n const scratchZoneBg = hasCustomScratchZoneBg\n ? config.scratchZoneBackground\n : `linear-gradient(145deg, ${purpleDark} 0%, ${purpleMid} 50%, #5a3a7a 100%)`;\n const modalBtnBg = config.modalButtonColor || `linear-gradient(145deg, ${purpleMid} 0%, ${purpleDark} 100%)`;\n \n // Computed values\n const glow = hexToRGBA(gold, 0.4);\n \n // Card shadow styles\n const cardBoxShadow = cardShadow \n ? `box-shadow:0 4px 24px ${hexToRGBA(purpleDark, 0.12)}, 0 12px 48px rgba(0,0,0,0.08);`\n : '';\n \n // Scratch zone shadow styles \n const zoneShadow = scratchZoneShadow\n ? `box-shadow:inset 0 2px 20px rgba(0,0,0,0.2), 0 8px 24px ${hexToRGBA(purpleDark, 0.35)};`\n : '';\n \n // Modal backdrop blur\n const backdropBlur = modalBackdropBlur ? 'backdrop-filter:blur(4px);' : '';\n \n // Animation styles based on type\n const cardAnimation = animType === 'none' ? '' : \n animType === 'bounce' \n ? `animation:sc-card-bounce ${animDuration}ms cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;`\n : `animation:sc-card-slide ${animDuration}ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;`;\n \n const modalAnimation = animType === 'none' ? '' :\n `transition:transform ${animDuration * 0.66}ms cubic-bezier(0.34, 1.56, 0.64, 1);`;\n\n return `\n/* === ScratchCard SDK v1.1 === */\n@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700&display=swap');\n\n.sc-root *, .sc-modal-overlay * { margin:0; padding:0; box-sizing:border-box; }\n\n.sc-root {\n font-family:'Outfit',sans-serif;\n display:flex;\n align-items:center;\n justify-content:center;\n padding:2rem 1rem;\n min-height:100%;\n background:linear-gradient(135deg, #e8e0f0 0%, #d8d0e8 50%, #e0d8f0 100%);\n position:relative;\n overflow:hidden;\n}\n\n.sc-page-bg {\n position:fixed;\n inset:0;\n background:radial-gradient(ellipse 80% 70% at 50% 40%, ${hexToRGBA(purpleMid, 0.15)} 0%, transparent 60%);\n pointer-events:none;\n animation:sc-glow-pulse 4s ease-in-out infinite;\n}\n\n@keyframes sc-glow-pulse {\n 0%, 100% { opacity:1; }\n 50% { opacity:0.7; }\n}\n\n.sc-wrapper {\n position:relative;\n width:min(360px, 92vw);\n ${cardAnimation}\n}\n\n@keyframes sc-card-slide {\n from { opacity:0; transform:translateY(24px) scale(0.96); }\n to { opacity:1; transform:translateY(0) scale(1); }\n}\n\n@keyframes sc-card-bounce {\n 0% { opacity:0; transform:scale(0.5); }\n 60% { opacity:1; transform:scale(1.05); }\n 80% { transform:scale(0.98); }\n 100% { transform:scale(1); }\n}\n\n.sc-main-card {\n background:${cardBg};\n border-radius:${cardBorderRadius}px;\n padding:28px 24px 32px;\n ${cardBoxShadow}\n}\n\n.sc-header {\n text-align:center;\n margin-bottom:20px;\n}\n\n.sc-header h1 {\n font-size:1.5rem;\n font-weight:700;\n color:${headerTitleColor};\n letter-spacing:-0.02em;\n}\n\n.sc-zone {\n position:relative;\n width:100%;\n aspect-ratio:1.05;\n max-height:320px;\n border-radius:${scratchZoneBorderRadius}px;\n overflow:hidden;\n background:${scratchZoneBg};\n ${zoneShadow}\n}\n\n.sc-zone:not(.sc-ready) .sc-prize-content {\n visibility:hidden;\n}\n\n.sc-prize-content {\n position:absolute;\n inset:0;\n z-index:0;\n display:flex;\n flex-direction:column;\n align-items:center;\n justify-content:center;\n padding:20px;\n background:${hasCustomScratchZoneBg ? scratchZoneBg : `radial-gradient(circle at 30% 30%, rgba(255,255,255,0.08) 0%, transparent 45%), linear-gradient(145deg, ${purpleDark} 0%, ${purpleMid} 100%)`};\n}\n\n.sc-prize-content::before {\n content:'';\n position:absolute;\n inset:0;\n background-image:\n url(\"data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M30 5 L35 25 L55 30 L35 35 L30 55 L25 35 L5 30 L25 25 Z' fill='none' stroke='rgba(255,255,255,0.06)' stroke-width='0.5'/%3E%3C/svg%3E\"),\n url(\"data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='20' cy='20' r='1' fill='rgba(255,255,255,0.1)'/%3E%3C/svg%3E\");\n opacity:0.9;\n pointer-events:none;\n}\n\n.sc-prize-text {\n position:relative;\n z-index:1;\n text-align:center;\n color:${prizeTextColor};\n font-size:1.25rem;\n font-weight:700;\n text-shadow:0 2px 8px rgba(0,0,0,0.3);\n margin-bottom:8px;\n}\n\n.sc-prize-name {\n font-size:1.5rem;\n font-weight:700;\n color:${prizeNameColor};\n text-shadow:0 0 20px ${hexToRGBA(gold, 0.5)};\n}\n\n.sc-prize-icon {\n width:80px;\n height:80px;\n margin:12px auto;\n background:${prizeIconBg};\n border-radius:50%;\n display:flex;\n align-items:center;\n justify-content:center;\n font-size:2.5rem;\n}\n\n.sc-prize-icon-visible {\n position:absolute;\n left:50%;\n top:50%;\n margin-left:-40px;\n margin-top:-40px;\n width:80px;\n height:80px;\n background:${giftIconBg};\n border-radius:50%;\n display:flex;\n align-items:center;\n justify-content:center;\n font-size:2.5rem;\n z-index:11;\n pointer-events:none;\n box-shadow:0 4px 20px rgba(0,0,0,0.15);\n}\n\n.sc-coin {\n position:absolute;\n left:0;\n top:0;\n width:56px;\n height:56px;\n border-radius:50%;\n background:linear-gradient(145deg, ${coinStart} 0%, ${gold} 30%, ${coinEnd} 70%, #9a7a2a 100%);\n box-shadow:\n inset 0 2px 4px rgba(255,255,255,0.4),\n inset 0 -2px 6px rgba(0,0,0,0.25),\n 0 6px 16px rgba(0,0,0,0.3);\n display:flex;\n align-items:center;\n justify-content:center;\n font-weight:800;\n font-size:1.5rem;\n color:${coinEnd};\n text-shadow:0 1px 0 rgba(255,255,255,0.4);\n z-index:12;\n pointer-events:auto;\n cursor:grab;\n touch-action:none;\n transition:box-shadow 0.15s ease;\n}\n\n.sc-coin:active {\n cursor:grabbing;\n box-shadow:\n inset 0 2px 4px rgba(255,255,255,0.3),\n 0 4px 12px rgba(0,0,0,0.35);\n}\n\n.sc-coin.dragging {\n animation:none;\n}\n\n.sc-canvas {\n position:absolute;\n top:0;\n left:0;\n right:0;\n bottom:0;\n width:100%;\n height:100%;\n z-index:10;\n display:block;\n cursor:crosshair;\n touch-action:none;\n}\n\n.sc-instruction {\n text-align:center;\n margin-top:18px;\n font-size:0.95rem;\n color:${instructionColor};\n font-weight:500;\n}\n\n/* Modal */\n.sc-modal-overlay {\n position:fixed;\n inset:0;\n background:rgba(0,0,0,0.5);\n ${backdropBlur}\n display:flex;\n align-items:center;\n justify-content:center;\n padding:1.5rem;\n z-index:100;\n opacity:0;\n visibility:hidden;\n transition:opacity 0.35s ease, visibility 0.35s ease;\n}\n\n.sc-modal-overlay.active {\n opacity:1;\n visibility:visible;\n}\n\n.sc-confetti-canvas {\n position:absolute;\n inset:0;\n width:100%;\n height:100%;\n pointer-events:none;\n z-index:1;\n}\n\n.sc-modal-bg-glow {\n position:absolute;\n inset:0;\n z-index:2;\n background:radial-gradient(\n ellipse 90% 80% at 50% 50%,\n ${hexToRGBA(purpleMid, 0.4)} 0%,\n ${hexToRGBA(purpleDark, 0.2)} 40%,\n transparent 70%\n );\n animation:sc-modal-glow 3s ease-in-out infinite;\n}\n\n@keyframes sc-modal-glow {\n 0%, 100% { opacity:1; }\n 50% { opacity:0.85; }\n}\n\n.sc-modal-card {\n position:relative;\n z-index:3;\n width:min(340px, 100%);\n background:${white};\n border-radius:${cardBorderRadius}px;\n padding:32px 24px 28px;\n box-shadow:0 24px 64px rgba(0,0,0,0.2);\n transform:scale(0.9) translateY(20px);\n ${modalAnimation}\n overflow:hidden;\n}\n\n.sc-modal-overlay.active .sc-modal-card {\n transform:scale(1) translateY(0);\n}\n\n.sc-modal-card::before {\n content:'';\n position:absolute;\n top:-50%;\n left:-50%;\n width:200%;\n height:200%;\n background:radial-gradient(circle at 50% 50%, ${hexToRGBA(purpleLight, 0.08)} 0%, transparent 50%);\n pointer-events:none;\n}\n\n.sc-modal-header {\n text-align:center;\n margin-bottom:20px;\n}\n\n.sc-modal-header h2 {\n font-size:1.5rem;\n font-weight:700;\n color:${modalTitleColor};\n line-height:1.3;\n}\n\n.sc-modal-prize-box {\n background:linear-gradient(180deg, #f8f4fc 0%, #f0eaf8 100%);\n border-radius:20px;\n padding:28px 20px;\n margin-bottom:24px;\n text-align:center;\n position:relative;\n}\n\n.sc-modal-prize-circle {\n width:100px;\n height:100px;\n margin:0 auto 16px;\n background:linear-gradient(145deg, ${purpleLight} 0%, ${purpleMid} 100%);\n border-radius:50%;\n display:flex;\n align-items:center;\n justify-content:center;\n font-size:2.8rem;\n box-shadow:0 8px 24px ${hexToRGBA(purpleDark, 0.3)};\n}\n\n.sc-modal-prize-box .sc-prize-label {\n font-size:1.1rem;\n font-weight:600;\n color:${textDark};\n}\n\n.sc-modal-prize-box .sc-prize-name {\n font-size:1.35rem;\n color:${purpleMid};\n margin-top:4px;\n}\n\n.sc-btn-claim {\n display:block;\n width:100%;\n padding:16px 24px;\n border:none;\n border-radius:14px;\n background:${modalBtnBg};\n color:${modalBtnText};\n font-family:inherit;\n font-size:1.1rem;\n font-weight:600;\n cursor:pointer;\n box-shadow:0 6px 20px ${hexToRGBA(purpleDark, 0.4)};\n transition:transform 0.2s ease, box-shadow 0.2s ease;\n}\n\n.sc-btn-claim:hover {\n transform:translateY(-2px);\n box-shadow:0 8px 28px ${hexToRGBA(purpleDark, 0.5)};\n}\n\n.sc-btn-claim:active {\n transform:translateY(0);\n}\n\n.sc-modal-terms {\n text-align:center;\n margin-top:16px;\n}\n\n.sc-modal-terms a {\n font-size:0.875rem;\n color:${textMuted};\n text-decoration:none;\n}\n\n.sc-modal-terms a:hover {\n color:${purpleMid};\n text-decoration:underline;\n}\n\n/* ── prefers-reduced-motion ── */\n@media (prefers-reduced-motion: reduce) {\n .sc-wrapper { animation:none !important; opacity:1; transform:none; }\n .sc-page-bg { animation:none !important; }\n .sc-modal-bg-glow { animation:none !important; }\n .sc-modal-card { transition:none !important; transform:scale(1) translateY(0) !important; }\n .sc-btn-claim { transition:none !important; }\n .sc-btn-claim:hover { transform:none !important; }\n .sc-coin { transition:none !important; }\n}\n`;\n}\n","/**\n * ScratchCard SDK v1.1.0\n *\n * A fully dynamic, configurable Scratch Card component.\n * ES6 class-based. Outputs: UMD · ESM · CJS via Rollup.\n *\n * @example\n * import { ScratchCard } from 'spin-wheel-sdk';\n *\n * const card = ScratchCard.init({\n * container: '#app',\n * prize: { name: 'iPhone 16', icon: '📱', label: 'Congratulations!' },\n * onReveal(prize) { console.log(prize); },\n * });\n */\n\nimport { buildScratchCSS } from './scratchStyles.js';\nimport { hexToRGBA, escapeHtml, deepMerge } from './utils.js';\n\n/* ------------------------------------------------------------------ */\n/* Default configuration */\n/* ------------------------------------------------------------------ */\n\n/** @type {ScratchCardOptions} */\nconst DEFAULTS = Object.freeze({\n // ── Core ──\n container: null,\n prize: null,\n\n // ── Header UI ──\n headerTitle: 'Scratch the Card to Win Exciting Prizes!',\n headerTitleColor: null, // uses theme.textDark if null\n \n // ── Instruction ──\n instruction: 'Scratch the card to win exciting prizes.',\n instructionColor: null, // uses theme.textMuted if null\n\n // ── Scratch Behavior ──\n revealThreshold: 55,\n brushSize: 28,\n\n // ── Coin (Eraser Tool) ──\n coinSize: 56,\n showCoin: true,\n coinIcon: '$',\n coinGradientStart: null, // uses theme.goldLight if null\n coinGradientEnd: null, // uses theme.goldDark if null\n\n // ── Card Appearance ──\n cardBackground: null, // uses default gradient if null\n cardShadow: true,\n cardBorderRadius: 24,\n\n // ── Scratch Zone ──\n scratchZoneBackground: null, // uses theme gradient if null\n scratchZoneShadow: true,\n scratchZoneBorderRadius: 20,\n\n // ── Scratch Layer ──\n scratchLayerColor: 'rgb(150, 130, 180)',\n scratchLayerSparkles: true,\n scratchLayerSparkleCount: 40,\n\n // ── Prize Display ──\n prizeTextColor: null, // uses white with opacity if null\n prizeNameColor: null, // uses theme.goldLight if null\n prizeIconBackground: null, // uses white with opacity if null\n\n // ── Gift Icon (Hint) ──\n showGiftIcon: true,\n giftIcon: '🎁',\n giftIconBackground: null, // uses white with opacity if null\n\n // ── Modal ──\n showModal: true,\n modalTitle: 'Congratulations!',\n modalTitleColor: null, // uses theme.textDark if null\n modalButtonText: 'Claim your',\n modalButtonColor: null, // uses theme gradient if null\n modalButtonTextColor: null, // uses theme.white if null\n modalBackdropBlur: true,\n\n // ── Confetti ──\n confettiEnabled: true,\n confettiColors: null, // uses default colors if null\n confettiCount: 100,\n confettiDuration: 5500,\n\n // ── Animation ──\n animationType: 'default', // 'default' | 'bounce' | 'none'\n animationDuration: 600,\n\n // ── Theme Colors ──\n theme: Object.freeze({\n purpleDark: '#4a2c6a',\n purpleMid: '#6b4a8a',\n purpleLight: '#8b6baa',\n gold: '#d4a84b',\n goldLight: '#e8c547',\n goldDark: '#b8923a',\n white: '#ffffff',\n textDark: '#2d2d2d',\n textMuted: '#6b6b6b',\n }),\n\n // ── Callbacks ──\n onScratchStart: null,\n onScratchProgress: null,\n onReveal: null,\n onClaim: null,\n});\n\n/* ------------------------------------------------------------------ */\n/* Validation */\n/* ------------------------------------------------------------------ */\n\nfunction _validateOptions(opts) {\n // Container — truly required, cannot default\n if (!opts.container) {\n throw new Error('[ScratchCard] \"container\" is required.');\n }\n\n // Prize — truly required, cannot default\n if (!opts.prize || typeof opts.prize !== 'object') {\n throw new Error('[ScratchCard] \"prize\" is required and must be an object.');\n }\n if (!opts.prize.name || typeof opts.prize.name !== 'string') {\n throw new Error('[ScratchCard] \"prize.name\" is required and must be a string.');\n }\n\n // ── Clamp / auto-fix numeric & enum values instead of crashing ──\n\n // revealThreshold: clamp to [10, 90]\n if (opts.revealThreshold !== undefined) {\n if (typeof opts.revealThreshold !== 'number' || isNaN(opts.revealThreshold)) {\n console.warn('[ScratchCard] \"revealThreshold\" must be a number. Using default (55).');\n opts.revealThreshold = DEFAULTS.revealThreshold;\n } else if (opts.revealThreshold < 10) {\n console.warn(`[ScratchCard] \"revealThreshold\" (${opts.revealThreshold}) is below 10. Clamping to 10.`);\n opts.revealThreshold = 10;\n } else if (opts.revealThreshold > 90) {\n console.warn(`[ScratchCard] \"revealThreshold\" (${opts.revealThreshold}) is above 90. Clamping to 90.`);\n opts.revealThreshold = 90;\n }\n }\n\n // brushSize: clamp to min 1\n if (opts.brushSize !== undefined) {\n if (typeof opts.brushSize !== 'number' || isNaN(opts.brushSize)) {\n console.warn('[ScratchCard] \"brushSize\" must be a number. Using default (28).');\n opts.brushSize = DEFAULTS.brushSize;\n } else if (opts.brushSize < 1) {\n console.warn(`[ScratchCard] \"brushSize\" (${opts.brushSize}) is below 1. Clamping to 1.`);\n opts.brushSize = 1;\n }\n }\n\n // coinSize: clamp to min 1\n if (opts.coinSize !== undefined) {\n if (typeof opts.coinSize !== 'number' || isNaN(opts.coinSize)) {\n console.warn('[ScratchCard] \"coinSize\" must be a number. Using default (56).');\n opts.coinSize = DEFAULTS.coinSize;\n } else if (opts.coinSize < 1) {\n console.warn(`[ScratchCard] \"coinSize\" (${opts.coinSize}) is below 1. Clamping to 1.`);\n opts.coinSize = 1;\n }\n }\n\n // confettiCount: clamp to min 0\n if (opts.confettiCount !== undefined) {\n if (typeof opts.confettiCount !== 'number' || isNaN(opts.confettiCount)) {\n console.warn('[ScratchCard] \"confettiCount\" must be a number. Using default (100).');\n opts.confettiCount = DEFAULTS.confettiCount;\n } else if (opts.confettiCount < 0) {\n console.warn(`[ScratchCard] \"confettiCount\" (${opts.confettiCount}) is negative. Clamping to 0.`);\n opts.confettiCount = 0;\n }\n }\n\n // confettiDuration: clamp to min 100\n if (opts.confettiDuration !== undefined) {\n if (typeof opts.confettiDuration !== 'number' || isNaN(opts.confettiDuration)) {\n console.warn('[ScratchCard] \"confettiDuration\" must be a number. Using default (5500).');\n opts.confettiDuration = DEFAULTS.confettiDuration;\n } else if (opts.confettiDuration <= 0) {\n console.warn(`[ScratchCard] \"confettiDuration\" (${opts.confettiDuration}) must be positive. Clamping to 100.`);\n opts.confettiDuration = 100;\n }\n }\n\n // animationDuration: clamp to min 100\n if (opts.animationDuration !== undefined) {\n if (typeof opts.animationDuration !== 'number' || isNaN(opts.animationDuration)) {\n console.warn('[ScratchCard] \"animationDuration\" must be a number. Using default (600).');\n opts.animationDuration = DEFAULTS.animationDuration;\n } else if (opts.animationDuration <= 0) {\n console.warn(`[ScratchCard] \"animationDuration\" (${opts.animationDuration}) must be positive. Clamping to 100.`);\n opts.animationDuration = 100;\n }\n }\n\n // animationType: fallback to 'default'\n if (opts.animationType !== undefined && !['default', 'bounce', 'none'].includes(opts.animationType)) {\n console.warn(`[ScratchCard] \"animationType\" (\"${opts.animationType}\") is invalid. Must be \"default\", \"bounce\", or \"none\". Using \"default\".`);\n opts.animationType = 'default';\n }\n\n // cardBorderRadius: clamp to min 0\n if (opts.cardBorderRadius !== undefined) {\n if (typeof opts.cardBorderRadius !== 'number' || isNaN(opts.cardBorderRadius)) {\n console.warn('[ScratchCard] \"cardBorderRadius\" must be a number. Using default (24).');\n opts.cardBorderRadius = DEFAULTS.cardBorderRadius;\n } else if (opts.cardBorderRadius < 0) {\n console.warn(`[ScratchCard] \"cardBorderRadius\" (${opts.cardBorderRadius}) is negative. Clamping to 0.`);\n opts.cardBorderRadius = 0;\n }\n }\n\n // scratchZoneBorderRadius: clamp to min 0\n if (opts.scratchZoneBorderRadius !== undefined) {\n if (typeof opts.scratchZoneBorderRadius !== 'number' || isNaN(opts.scratchZoneBorderRadius)) {\n console.warn('[ScratchCard] \"scratchZoneBorderRadius\" must be a number. Using default (20).');\n opts.scratchZoneBorderRadius = DEFAULTS.scratchZoneBorderRadius;\n } else if (opts.scratchZoneBorderRadius < 0) {\n console.warn(`[ScratchCard] \"scratchZoneBorderRadius\" (${opts.scratchZoneBorderRadius}) is negative. Clamping to 0.`);\n opts.scratchZoneBorderRadius = 0;\n }\n }\n\n // scratchLayerSparkleCount: clamp to min 0\n if (opts.scratchLayerSparkleCount !== undefined) {\n if (typeof opts.scratchLayerSparkleCount !== 'number' || isNaN(opts.scratchLayerSparkleCount)) {\n console.warn('[ScratchCard] \"scratchLayerSparkleCount\" must be a number. Using default (40).');\n opts.scratchLayerSparkleCount = DEFAULTS.scratchLayerSparkleCount;\n } else if (opts.scratchLayerSparkleCount < 0) {\n console.warn(`[ScratchCard] \"scratchLayerSparkleCount\" (${opts.scratchLayerSparkleCount}) is negative. Clamping to 0.`);\n opts.scratchLayerSparkleCount = 0;\n }\n }\n}\n\n/* ------------------------------------------------------------------ */\n/* SSR guard */\n/* ------------------------------------------------------------------ */\n\nconst _isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';\n\n/** @returns {boolean} Whether the user prefers reduced motion */\nfunction _prefersReducedMotion() {\n return _isBrowser && window.matchMedia?.('(prefers-reduced-motion: reduce)')?.matches;\n}\n\n/* ------------------------------------------------------------------ */\n/* CSS injection (once per page) */\n/* ------------------------------------------------------------------ */\n\nlet _injectedThemeKey = null;\n\nfunction injectCSS(options) {\n if (!_isBrowser) return;\n const theme = { ...DEFAULTS.theme, ...(options.theme || {}) };\n \n // Build a key from all style-affecting options\n const styleConfig = {\n theme,\n headerTitleColor: options.headerTitleColor,\n instructionColor: options.instructionColor,\n coinGradientStart: options.coinGradientStart,\n coinGradientEnd: options.coinGradientEnd,\n cardBackground: options.cardBackground,\n cardShadow: options.cardShadow,\n cardBorderRadius: options.cardBorderRadius,\n scratchZoneBackground: options.scratchZoneBackground,\n scratchZoneShadow: options.scratchZoneShadow,\n scratchZoneBorderRadius: options.scratchZoneBorderRadius,\n prizeTextColor: options.prizeTextColor,\n prizeNameColor: options.prizeNameColor,\n prizeIconBackground: options.prizeIconBackground,\n giftIconBackground: options.giftIconBackground,\n modalTitleColor: options.modalTitleColor,\n modalButtonColor: options.modalButtonColor,\n modalButtonTextColor: options.modalButtonTextColor,\n modalBackdropBlur: options.modalBackdropBlur,\n animationType: options.animationType,\n animationDuration: options.animationDuration,\n };\n \n const key = JSON.stringify(styleConfig);\n if (_injectedThemeKey === key) return;\n\n // Remove old stylesheet if exists (SSR-safe)\n const existing = _isBrowser ? document.querySelector('style[data-scratch-card-sdk]') : null;\n if (existing) existing.remove();\n\n _injectedThemeKey = key;\n const style = document.createElement('style');\n style.setAttribute('data-scratch-card-sdk', '');\n style.textContent = buildScratchCSS(styleConfig, hexToRGBA);\n document.head.appendChild(style);\n}\n\n/* ------------------------------------------------------------------ */\n/* ScratchCard class */\n/* ------------------------------------------------------------------ */\n\nexport class ScratchCardInstance {\n /**\n * @param {ScratchCardOptions} opts\n */\n constructor(opts) {\n if (!_isBrowser) {\n throw new Error('[ScratchCard] ScratchCard requires a browser environment (window + document).');\n }\n\n // ── validate options ──\n _validateOptions(opts);\n\n /** @type {ScratchCardOptions} */\n this.options = deepMerge({}, DEFAULTS, opts);\n \n // Ensure theme is properly merged\n this.options.theme = { ...DEFAULTS.theme, ...(opts.theme || {}) };\n\n /** Current scratch percentage (0-100) */\n this.scratchPercent = 0;\n\n /** Whether user is currently scratching */\n this.isScratching = false;\n\n /** Whether user is dragging the coin */\n this.isDraggingCoin = false;\n\n /** Whether prize has been revealed */\n this.hasRevealed = false;\n\n /** Set to true after .destroy() */\n this._destroyed = false;\n\n /** Whether onScratchStart has fired for this session */\n this._scratchStartFired = false;\n\n /** Active confetti requestAnimationFrame ID */\n this._confettiRafId = null;\n\n /** Confetti timeout IDs for burst effects */\n this._confettiTimeouts = [];\n\n /** @type {object|null} */\n this._prize = this.options.prize;\n\n // ── resolve container ──\n this.containerEl =\n typeof this.options.container === 'string'\n ? document.querySelector(this.options.container)\n : this.options.container;\n\n if (!this.containerEl) {\n throw new Error('[ScratchCard] container not found. Ensure the container element exists in the DOM.');\n }\n\n /** Canvas dimensions */\n this.zoneW = 0;\n this.zoneH = 0;\n\n /** Last mouse/touch point for continuous scratching */\n this._lastPoint = null;\n\n /** Resize observer for responsive canvas */\n this._resizeObserver = null;\n\n // ── inject CSS (idempotent) ──\n injectCSS(this.options);\n\n // ── DOM refs (set in _build) ──\n /** @type {HTMLElement} */ this._rootEl = null;\n /** @type {HTMLElement} */ this._zoneEl = null;\n /** @type {HTMLCanvasElement} */ this._canvasEl = null;\n /** @type {CanvasRenderingContext2D} */ this._ctx = null;\n /** @type {HTMLElement} */ this._coinEl = null;\n /** @type {HTMLElement} */ this._giftIconEl = null;\n /** @type {HTMLElement} */ this._modalEl = null;\n /** @type {HTMLElement} */ this._confettiCanvasEl = null;\n /** @type {HTMLElement} */ this._prizeContentEl = null;\n /** @type {HTMLElement} */ this._instructionEl = null;\n\n // ── build & bind ──\n this._build();\n this._bind();\n }\n\n /* ================================================================ */\n /* DOM construction */\n /* ================================================================ */\n\n /** Build the full widget DOM tree and attach it to the container. */\n _build() {\n const o = this.options;\n\n // ── root wrapper ──\n const root = document.createElement('div');\n root.className = 'sc-root';\n\n // ── page background glow ──\n const pageBg = document.createElement('div');\n pageBg.className = 'sc-page-bg';\n pageBg.setAttribute('aria-hidden', 'true');\n root.appendChild(pageBg);\n\n // ── main wrapper ──\n const wrapper = document.createElement('div');\n wrapper.className = 'sc-wrapper';\n\n // ── main card ──\n const card = document.createElement('div');\n card.className = 'sc-main-card';\n\n // ── header ──\n const header = document.createElement('header');\n header.className = 'sc-header';\n header.innerHTML = `<h1>${escapeHtml(o.headerTitle)}</h1>`;\n card.appendChild(header);\n\n // ── scratch zone ──\n const zone = document.createElement('div');\n zone.className = 'sc-zone';\n zone.id = `sc-zone-${this._id()}`;\n this._zoneEl = zone;\n\n // Prize content (under canvas)\n const prizeContent = document.createElement('div');\n prizeContent.className = 'sc-prize-content';\n prizeContent.innerHTML = `\n <div class=\"sc-prize-text\">${escapeHtml(this._prize.label || 'Congratulations!')}</div>\n <div class=\"sc-prize-name\">${escapeHtml(this._prize.name)}</div>\n <div class=\"sc-prize-icon\">${escapeHtml(this._prize.icon || '🎁')}</div>\n `;\n zone.appendChild(prizeContent);\n this._prizeContentEl = prizeContent;\n\n // Canvas for scratching\n const canvas = document.createElement('canvas');\n canvas.className = 'sc-canvas';\n canvas.id = `sc-canvas-${this._id()}`;\n canvas.setAttribute('aria-label', 'Scratch to reveal your prize');\n zone.appendChild(canvas);\n this._canvasEl = canvas;\n this._ctx = canvas.getContext('2d');\n\n // Gift icon visible above scratch layer (hint icon)\n if (o.showGiftIcon !== false) {\n const prizeIconVisible = document.createElement('div');\n prizeIconVisible.className = 'sc-prize-icon-visible';\n prizeIconVisible.id = `sc-gift-icon-${this._id()}`;\n prizeIconVisible.setAttribute('aria-hidden', 'true');\n prizeIconVisible.textContent = o.giftIcon || '🎁';\n zone.appendChild(prizeIconVisible);\n this._giftIconEl = prizeIconVisible;\n }\n\n // Draggable coin eraser\n if (o.showCoin) {\n const coin = document.createElement('div');\n coin.className = 'sc-coin';\n coin.id = `sc-coin-${this._id()}`;\n coin.setAttribute('aria-hidden', 'true');\n coin.textContent = o.coinIcon;\n zone.appendChild(coin);\n this._coinEl = coin;\n }\n\n card.appendChild(zone);\n\n // ── instruction ──\n const instruction = document.createElement('p');\n instruction.className = 'sc-instruction';\n instruction.textContent = o.instruction;\n card.appendChild(instruction);\n this._instructionEl = instruction;\n\n wrapper.appendChild(card);\n root.appendChild(wrapper);\n this.containerEl.appendChild(root);\n this._rootEl = root;\n\n // ── modal ──\n if (o.showModal) {\n this._buildModal();\n }\n\n // ── initialize canvas size ──\n this._initCanvas();\n }\n\n /** Generate a unique ID for this instance */\n _id() {\n return Math.random().toString(36).slice(2, 9);\n }\n\n /** Build the win modal and append it to the container */\n _buildModal() {\n const o = this.options;\n const modalTitle = o.modalTitle || 'Congratulations!';\n const modalButtonText = o.modalButtonText || 'Claim your';\n \n const overlay = document.createElement('div');\n overlay.className = 'sc-modal-overlay';\n overlay.setAttribute('role', 'dialog');\n overlay.setAttribute('aria-modal', 'true');\n overlay.setAttribute('aria-hidden', 'true');\n overlay.setAttribute('aria-label', 'Prize won');\n\n // Confetti canvas\n const confettiCanvas = document.createElement('canvas');\n confettiCanvas.className = 'sc-confetti-canvas';\n confettiCanvas.setAttribute('aria-hidden', 'true');\n overlay.appendChild(confettiCanvas);\n this._confettiCanvasEl = confettiCanvas;\n\n // Background glow\n const bgGlow = document.createElement('div');\n bgGlow.className = 'sc-modal-bg-glow';\n overlay.appendChild(bgGlow);\n\n // Modal card\n const modalCard = document.createElement('div');\n modalCard.className = 'sc-modal-card';\n modalCard.innerHTML = `\n <div class=\"sc-modal-header\">\n <h2>${escapeHtml(modalTitle)} You won ${escapeHtml(this._prize.name)}.</h2>\n </div>\n <div class=\"sc-modal-prize-box\">\n <div class=\"sc-modal-prize-circle\">${escapeHtml(this._prize.icon || '🎁')}</div>\n <div class=\"sc-prize-label\">${escapeHtml(this._prize.label || modalTitle)} You won ${escapeHtml(this._prize.name)}!</div>\n <div class=\"sc-prize-name\">${escapeHtml(this._prize.name)}</div>\n </div>\n <button type=\"button\" class=\"sc-btn-claim\">${escapeHtml(modalButtonText)} ${escapeHtml(this._prize.name)}</button>\n <p class=\"sc-modal-terms\">\n <a href=\"#\" onclick=\"return false;\">Terms & Conditions</a>\n </p>\n `;\n overlay.appendChild(modalCard);\n\n this.containerEl.appendChild(overlay);\n this._modalEl = overlay;\n }\n\n /** Initialize canvas size and draw scratch surface */\n _initCanvas() {\n const setSize = () => {\n const w = this._zoneEl.clientWidth;\n const h = this._zoneEl.clientHeight;\n if (w <= 0 || h <= 0) return;\n\n this.zoneW = w;\n this.zoneH = h;\n\n const dpr = window.devicePixelRatio || 1;\n this._canvasEl.width = Math.ceil(w * dpr);\n this._canvasEl.height = Math.ceil(h * dpr);\n this._canvasEl.style.width = w + 'px';\n this._canvasEl.style.height = h + 'px';\n\n this._ctx.setTransform(1, 0, 0, 1, 0, 0);\n this._ctx.scale(dpr, dpr);\n\n this._drawSurface();\n this._positionCoinInitial();\n this._zoneEl.classList.add('sc-ready');\n };\n\n // Use ResizeObserver for responsive sizing\n this._resizeObserver = new ResizeObserver(() => {\n requestAnimationFrame(setSize);\n });\n this._resizeObserver.observe(this._zoneEl);\n\n // Initial sizing\n requestAnimationFrame(() => requestAnimationFrame(setSize));\n }\n\n /** Draw the scratchable surface on canvas */\n _drawSurface() {\n const w = this.zoneW;\n const h = this.zoneH;\n if (w <= 0 || h <= 0) return;\n\n const ctx = this._ctx;\n const o = this.options;\n\n // Base color for scratch layer (configurable)\n ctx.fillStyle = o.scratchLayerColor || 'rgb(150, 130, 180)';\n ctx.fillRect(0, 0, w, h);\n\n // Add sparkle effect if enabled\n if (o.scratchLayerSparkles !== false) {\n const sparkleCount = o.scratchLayerSparkleCount || 40;\n ctx.globalCompositeOperation = 'overlay';\n ctx.fillStyle = 'rgba(255, 255, 255, 0.2)';\n for (let i = 0; i < sparkleCount; i++) {\n ctx.beginPath();\n ctx.arc(Math.random() * w, Math.random() * h, 2 + Math.random() * 3, 0, Math.PI * 2);\n ctx.fill();\n }\n ctx.globalCompositeOperation = 'source-over';\n }\n }\n\n /** Position coin at initial location */\n _positionCoinInitial() {\n if (!this._coinEl || this.zoneW <= 0 || this.zoneH <= 0) return;\n\n const coinRadius = this.options.coinSize / 2;\n const x = Math.round(this.zoneW * 0.15 - coinRadius);\n const y = Math.round(this.zoneH * 0.82 - coinRadius);\n this._coinEl.style.transform = `translate(${x}px, ${y}px)`;\n }\n\n /* ================================================================ */\n /* Event binding */\n /* ================================================================ */\n\n /** Wire up all interactive event listeners with proper references for cleanup. */\n _bind() {\n const canvas = this._canvasEl;\n\n // Canvas scratch events (direct mouse/touch scratching)\n this._boundStartScratch = this._onStartScratch.bind(this);\n this._boundMoveScratch = this._onMoveScratch.bind(this);\n this._boundEndScratch = this._onEndScratch.bind(this);\n\n canvas.addEventListener('mousedown', this._boundStartScratch);\n canvas.addEventListener('mousemove', this._boundMoveScratch);\n canvas.addEventListener('mouseup', this._boundEndScratch);\n canvas.addEventListener('mouseleave', this._boundEndScratch);\n\n canvas.addEventListener('touchstart', this._boundStartScratch, { passive: false });\n canvas.addEventListener('touchmove', this._boundMoveScratch, { passive: false });\n canvas.addEventListener('touchend', this._boundEndScratch);\n canvas.addEventListener('touchcancel', this._boundEndScratch);\n\n // Coin drag events\n if (this._coinEl) {\n this._boundStartCoinDrag = this._onStartCoinDrag.bind(this);\n this._coinEl.addEventListener('mousedown', this._boundStartCoinDrag);\n this._coinEl.addEventListener('touchstart', this._boundStartCoinDrag, { passive: false });\n }\n\n // Global drag events for coin – store references for cleanup in destroy()\n this._boundDocMouseMove = (e) => {\n if (this.isDraggingCoin) this._onMoveCoinDrag(e);\n };\n this._boundDocMouseUp = this._onEndCoinDrag.bind(this);\n this._boundDocTouchMove = (e) => {\n if (this.isDraggingCoin) {\n e.preventDefault();\n this._onMoveCoinDrag(e);\n }\n };\n this._boundDocTouchEnd = this._onEndCoinDrag.bind(this);\n this._boundDocTouchCancel = this._onEndCoinDrag.bind(this);\n\n document.addEventListener('mousemove', this._boundDocMouseMove);\n document.addEventListener('mouseup', this._boundDocMouseUp);\n document.addEventListener('touchmove', this._boundDocTouchMove, { passive: false });\n document.addEventListener('touchend', this._boundDocTouchEnd);\n document.addEventListener('touchcancel', this._boundDocTouchCancel);\n\n // Modal events\n if (this._modalEl) {\n this._boundModalClick = (e) => {\n if (e.target === this._modalEl || e.target.classList.contains('sc-modal-bg-glow')) {\n this.hideModal();\n }\n };\n this._modalEl.addEventListener('click', this._boundModalClick);\n\n const btnClaim = this._modalEl.querySelector('.sc-btn-claim');\n if (btnClaim) {\n this._boundClaimClick = () => {\n this.hideModal();\n if (typeof this.options.onClaim === 'function') {\n try { this.options.onClaim(this._prize); } catch (err) { console.error('[ScratchCard] onClaim callback error:', err); }\n }\n };\n this._claimBtnEl = btnClaim;\n btnClaim.addEventListener('click', this._boundClaimClick);\n }\n }\n\n // Global keyboard: Escape closes modal\n this._boundDocKeydown = (e) => {\n if (e.key === 'Escape' && this._modalEl?.classList.contains('active')) {\n this.hideModal();\n }\n };\n document.addEventListener('keydown', this._boundDocKeydown);\n }\n\n /** Get event point relative to scratch zone */\n _getEventPoint(e) {\n if (!this._zoneEl) return { x: 0, y: 0 };\n const rect = this._zoneEl.getBoundingClientRect();\n if (e.touches && e.touches.length) {\n return {\n x: e.touches[0].clientX - rect.left,\n y: e.touches[0].clientY - rect.top,\n };\n }\n return {\n x: e.clientX - rect.left,\n y: e.clientY - rect.top,\n };\n }\n\n /** Start scratching */\n _onStartScratch(e) {\n if (this.hasRevealed || this._destroyed) return;\n e.preventDefault();\n this.isScratching = true;\n\n // Hide gift icon as soon as user starts scratching\n if (this._giftIconEl) {\n this._giftIconEl.style.display = 'none';\n }\n\n this._lastPoint = this._getEventPoint(e);\n this._scratch(this._lastPoint.x, this._lastPoint.y);\n\n if (!this._scratchStartFired && typeof this.options.onScratchStart === 'function') {\n this._scratchStartFired = true;\n try { this.options.onScratchStart(); } catch (err) { console.error('[ScratchCard] onScratchStart callback error:', err); }\n }\n }\n\n /** Move scratching */\n _onMoveScratch(e) {\n if (!this.isScratching || this.hasRevealed || this._destroyed) return;\n e.preventDefault();\n const point = this._getEventPoint(e);\n const dx = point.x - this._lastPoint.x;\n const dy = point.y - this._lastPoint.y;\n const dist = Math.sqrt(dx * dx + dy * dy);\n const steps = Math.max(1, Math.floor(dist / 4));\n\n for (let i = 1; i <= steps; i++) {\n const t = i / steps;\n const x = this._lastPoint.x + dx * t;\n const y = this._lastPoint.y + dy * t;\n this._scratch(x, y);\n }\n this._lastPoint = point;\n }\n\n /** End scratching */\n _onEndScratch() {\n this.isScratching = false;\n this._lastPoint = null;\n }\n\n /** Perform scratch at position */\n _scratch(x, y, radius) {\n if (!this._ctx || this._destroyed) return;\n const r = radius !== undefined ? radius : this.options.brushSize / 2;\n const ctx = this._ctx;\n\n ctx.globalCompositeOperation = 'destination-out';\n ctx.fillStyle = 'rgba(0, 0, 0, 1)';\n ctx.beginPath();\n ctx.arc(x, y, r, 0, Math.PI * 2);\n ctx.fill();\n ctx.globalCompositeOperation = 'source-over';\n\n if (this.hasRevealed) return;\n this._updateScratchPercent();\n }\n\n /** Calculate and update scratch percentage */\n _updateScratchPercent() {\n if (!this._ctx || this._destroyed) return;\n const w = this.zoneW;\n const h = this.zoneH;\n if (w <= 0 || h <= 0) return;\n const dpr = window.devicePixelRatio || 1;\n const cw = Math.ceil(w * dpr);\n const ch = Math.ceil(h * dpr);\n if (cw <= 0 || ch <= 0) return;\n\n let imageData;\n try {\n imageData = this._ctx.getImageData(0, 0, cw, ch);\n } catch (_) { return; }\n const data = imageData.data;\n let transparent = 0;\n const step = 8; // Sample every 8th pixel for performance\n\n for (let i = 0; i < data.length; i += 4 * step) {\n if (data[i + 3] < 128) transparent++;\n }\n\n const total = (cw * ch) / step;\n this.scratchPercent = total > 0 ? Math.round((transparent / total) * 100) : 0;\n\n if (typeof this.options.onScratchProgress === 'function') {\n try { this.options.onScratchProgress(this.scratchPercent); } catch (err) { console.error('[ScratchCard] onScratchProgress callback error:', err); }\n }\n\n if (this.scratchPercent >= this.options.revealThreshold) {\n this._reveal();\n }\n }\n\n /** Reveal the prize */\n _reveal() {\n if (this.hasRevealed || this._destroyed) return;\n this.hasRevealed = true;\n\n // Clear the canvas to fully reveal\n if (this._ctx) {\n try { this._ctx.clearRect(0, 0, this.zoneW, this.zoneH); } catch (_) { /* noop */ }\n }\n\n // Hide the gift icon that sits above the scratch layer\n if (this._giftIconEl) {\n this._giftIconEl.style.display = 'none';\n }\n\n // Show modal\n if (this._modalEl) {\n this._modalEl.classList.add('active');\n this._modalEl.setAttribute('aria-hidden', 'false');\n \n // Start confetti only if enabled and motion is OK\n if (this.options.confettiEnabled !== false && !_prefersReducedMotion()) {\n this._startConfetti();\n }\n\n // Focus the claim button for keyboard users\n const claimBtn = this._modalEl.querySelector('.sc-btn-claim');\n if (claimBtn) {\n setTimeout(() => claimBtn.focus(), 100);\n }\n }\n\n // A11y: announce to screen readers\n this._announceToScreenReader(`Prize revealed: ${this._prize?.name || 'your prize'}`);\n\n if (typeof this.options.onReveal === 'function') {\n try { this.options.onReveal(this._prize); } catch (err) { console.error('[ScratchCard] onReveal callback error:', err); }\n }\n }\n\n /* ================================================================ */\n /* Coin drag handling */\n /* ================================================================ */\n\n _onStartCoinDrag(e) {\n if (this.hasRevealed || this._destroyed) return;\n e.preventDefault();\n e.stopPropagation();\n this.isDraggingCoin = true;\n if (this._coinEl) this._coinEl.classList.add('dragging');\n\n // Hide gift icon as soon as user starts scratching\n if (this._giftIconEl) {\n this._giftIconEl.style.display = 'none';\n }\n\n const point = this._getEventPoint(e);\n const c = this._clampCoinPosition(point.x, point.y);\n this._updateCoinPosition(c.x, c.y);\n this._scratch(c.x, c.y, this.options.coinSize / 2);\n\n if (!this._scratchStartFired && typeof this.options.onScratchStart === 'function') {\n this._scratchStartFired = true;\n try { this.options.onScratchStart(); } catch (err) { console.error('[ScratchCard] onScratchStart callback error:', err); }\n }\n }\n\n _onMoveCoinDrag(e) {\n if (!this.isDraggingCoin || this.hasRevealed || this._destroyed) return;\n e.preventDefault();\n e.stopPropagation();\n\n const point = this._getEventPoint(e);\n const c = this._clampCoinPosition(point.x, point.y);\n this._updateCoinPosition(c.x, c.y);\n this._scratch(c.x, c.y, this.options.coinSize / 2);\n }\n\n _onEndCoinDrag() {\n if (!this.isDraggingCoin) return;\n this.isDraggingCoin = false;\n if (this._coinEl) this._coinEl.classList.remove('dragging');\n }\n\n _clampCoinPosition(cx, cy) {\n const r = this.options.coinSize / 2;\n return {\n x: Math.max(r, Math.min(this.zoneW - r, cx)),\n y: Math.max(r, Math.min(this.zoneH - r, cy)),\n };\n }\n\n _updateCoinPosition(cx, cy) {\n if (!this._coinEl) return;\n const r = this.options.coinSize / 2;\n this._coinEl.style.transform = `translate(${cx - r}px, ${cy - r}px)`;\n }\n\n /* ================================================================ */\n /* Confetti animation */\n /* ================================================================ */\n\n _startConfetti() {\n if (!this._confettiCanvasEl || !this._modalEl || this._destroyed) return;\n\n const o = this.options;\n const rect = this._modalEl.getBoundingClientRect();\n const w = rect.width;\n const h = rect.height;\n if (w <= 0 || h <= 0) return;\n\n this._confettiCanvasEl.width = w;\n this._confettiCanvasEl.height = h;\n this._confettiCanvasEl.style.width = w + 'px';\n this._confettiCanvasEl.style.height = h + 'px';\n\n const cctx = this._confettiCanvasEl.getContext('2d');\n if (!cctx) return;\n const colors = o.confettiColors || ['#e8c547', '#d4a84b', '#6b4a8a', '#8b6baa', '#c94a6a', '#4ac97a', '#fff', '#ff6b6b'];\n const particles = [];\n const centerX = w / 2;\n const centerY = h / 2;\n const count = o.confettiCount || 100;\n\n for (let i = 0; i < count; i++) {\n const angle = (Math.PI * 2 * i) / count + Math.random() * 0.5;\n const speed = 4 + Math.random() * 10;\n particles.push({\n x: centerX,\n y: centerY,\n vx: Math.cos(angle) * speed + (Math.random() - 0.5) * 4,\n vy: Math.sin(angle) * speed - 6 + (Math.random() - 0.5) * 2,\n color: colors[Math.floor(Math.random() * colors.length)],\n size: 4 + Math.random() * 8,\n rotation: Math.random() * Math.PI * 2,\n rotationSpeed: (Math.random() - 0.5) * 0.3,\n opacity: 1,\n birth: 0,\n });\n }\n\n // Add burst effects\n this._confettiTimeouts.push(\n setTimeout(() => this._addBurst(particles, centerX, centerY, 35, cctx, w, h), 200),\n setTimeout(() => this._addBurst(particles, centerX, centerY, 30, cctx, w, h), 450)\n );\n\n const gravity = 0.22;\n const friction = 0.99;\n const startTime = Date.now();\n const duration = o.confettiDuration || 5500;\n\n const animate = () => {\n const elapsed = Date.now() - startTime;\n if (elapsed > duration || this._destroyed) {\n cctx.clearRect(0, 0, w, h);\n this._confettiRafId = null;\n return;\n }\n\n cctx.clearRect(0, 0, w, h);\n\n for (let i = 0; i < particles.length; i++) {\n const p = particles[i];\n const age = p.birth ? Date.now() - p.birth : elapsed;\n\n p.x += p.vx;\n p.y += p.vy;\n p.vy += gravity;\n p.vx *= friction;\n p.vy *= friction;\n p.rotation += p.rotationSpeed;\n\n const life = 1 - age / (p.birth ? 3200 : duration);\n p.opacity = Math.max(0, life);\n\n if (p.opacity <= 0 || p.y > h + 20) continue;\n\n cctx.save();\n cctx.globalAlpha = p.opacity;\n cctx.translate(p.x, p.y);\n cctx.rotate(p.rotation);\n cctx.fillStyle = p.color;\n cctx.fillRect(-p.size / 2, -p.size / 4, p.size, p.size / 2);\n cctx.restore();\n }\n\n this._confettiRafId = requestAnimationFrame(animate);\n };\n\n this._confettiRafId = requestAnimationFrame(animate);\n }\n\n _addBurst(particles, x, y, count, cctx, w, h) {\n const o = this.options;\n const colors = o.confettiColors || ['#e8c547', '#d4a84b', '#6b4a8a', '#8b6baa', '#c94a6a', '#4ac97a', '#fff', '#ff6b6b'];\n for (let i = 0; i < count; i++) {\n const angle = Math.random() * Math.PI * 2;\n const speed = 3 + Math.random() * 8;\n particles.push({\n x: x + (Math.random() - 0.5) * 120,\n y: y - 40 + (Math.random() - 0.5) * 20,\n vx: Math.cos(angle) * speed,\n vy: Math.sin(angle) * speed - 4,\n color: colors[Math.floor(Math.random() * colors.length)],\n size: 3 + Math.random() * 6,\n rotation: Math.random() * Math.PI * 2,\n rotationSpeed: (Math.random() - 0.5) * 0.3,\n opacity: 1,\n birth: Date.now(),\n });\n }\n }\n\n /* ================================================================ */\n /* Public API */\n /* ================================================================ */\n\n /**\n * Programmatically reveal the prize.\n */\n reveal() {\n if (this._destroyed) return;\n this._reveal();\n }\n\n /**\n * Hide the modal overlay.\n */\n hideModal() {\n if (this._destroyed || !this._modalEl) return;\n this._modalEl.classList.remove('active');\n this._modalEl.setAttribute('aria-hidden', 'true');\n }\n\n /**\n * Show the modal overlay.\n */\n showModal() {\n if (this._destroyed || !this._modalEl) return;\n this._modalEl.classList.add('active');\n this._modalEl.setAttribute('aria-hidden', 'false');\n }\n\n /**\n * Reset the scratch card for replay.\n */\n reset() {\n if (this._destroyed) return;\n\n this.hasRevealed = false;\n this.scratchPercent = 0;\n this.isScratching = false;\n this.isDraggingCoin = false;\n this._lastPoint = null;\n this._scratchStartFired = false;\n\n // Redraw canvas\n this._drawSurface();\n\n // Reset coin position\n this._positionCoinInitial();\n\n // Show the gift icon again\n if (this._giftIconEl) {\n this._giftIconEl.style.display = '';\n }\n\n // Hide modal\n this.hideModal();\n\n // Remove ready class temporarily\n if (this._zoneEl) {\n this._zoneEl.classList.remove('sc-ready');\n requestAnimationFrame(() => {\n if (this._zoneEl) this._zoneEl.classList.add('sc-ready');\n });\n }\n }\n\n /**\n * Update the prize at runtime.\n * @param {object} prize - New prize object\n */\n updatePrize(prize) {\n if (this._destroyed) return;\n if (!prize || typeof prize !== 'object') {\n console.warn('[ScratchCard] updatePrize: prize must be an object. Ignoring.');\n return;\n }\n this._prize = { ...this._prize, ...prize };\n this.reset();\n\n const o = this.options;\n const modalTitle = o.modalTitle || 'Congratulations!';\n const modalButtonText = o.modalButtonText || 'Claim your';\n\n // Update prize display\n if (this._prizeContentEl) {\n this._prizeContentEl.innerHTML = `\n <div class=\"sc-prize-text\">${escapeHtml(this._prize.label || modalTitle)}</div>\n <div class=\"sc-prize-name\">${escapeHtml(this._prize.name)}</div>\n <div class=\"sc-prize-icon\">${escapeHtml(this._prize.icon || '🎁')}</div>\n `;\n }\n\n // Update modal content\n if (this._modalEl) {\n const header = this._modalEl.querySelector('.sc-modal-header h2');\n if (header) header.textContent = `${modalTitle} You won ${this._prize.name}.`;\n\n const circle = this._modalEl.querySelector('.sc-modal-prize-circle');\n if (circle) circle.textContent = this._prize.icon || '🎁';\n\n const label = this._modalEl.querySelector('.sc-modal-prize-box .sc-prize-label');\n if (label) label.textContent = `${this._prize.label || modalTitle} You won ${this._prize.name}!`;\n\n const name = this._modalEl.querySelector('.sc-modal-prize-box .sc-prize-name');\n if (name) name.textContent = this._prize.name;\n\n const btn = this._modalEl.querySelector('.sc-btn-claim');\n if (btn) btn.textContent = `${modalButtonText} ${this._prize.name}`;\n }\n }\n\n /**\n * Update configuration options at runtime.\n * @param {Partial<ScratchCardOptions>} newOptions\n */\n updateOptions(newOptions) {\n if (this._destroyed) return;\n if (!newOptions || typeof newOptions !== 'object') {\n console.warn('[ScratchCard] updateOptions: argument must be an object. Ignoring.');\n return;\n }\n \n // Sanitize numeric/enum values before merging\n _validateOptions({ ...this.options, ...newOptions, container: this.options.container, prize: this.options.prize });\n \n // Merge new options\n this.options = deepMerge({}, this.options, newOptions);\n \n // Handle theme separately for proper nested merge\n if (newOptions.theme) {\n this.options.theme = { ...DEFAULTS.theme, ...this.options.theme, ...newOptions.theme };\n }\n \n // Re-inject CSS if styling options changed\n injectCSS(this.options);\n \n // Update header if changed\n const header = this._rootEl?.querySelector('.sc-header h1');\n if (header && newOptions.headerTitle !== undefined) {\n header.textContent = this.options.headerTitle;\n }\n \n // Update instruction if changed\n if (this._instructionEl && newOptions.instruction !== undefined) {\n this._instructionEl.textContent = this.options.instruction;\n }\n \n // Update coin icon if changed\n if (this._coinEl && newOptions.coinIcon !== undefined) {\n this._coinEl.textContent = this.options.coinIcon;\n }\n \n // Update gift icon if changed\n if (this._giftIconEl && newOptions.giftIcon !== undefined) {\n this._giftIconEl.textContent = this.options.giftIcon;\n }\n }\n\n /**\n * Announce a message to screen readers via a visually hidden aria-live region.\n * @param {string} message\n */\n _announceToScreenReader(message) {\n if (!_isBrowser) return;\n if (!this._liveRegion) {\n const el = document.createElement('div');\n el.setAttribute('aria-live', 'assertive');\n el.setAttribute('aria-atomic', 'true');\n el.setAttribute('role', 'status');\n el.style.cssText = 'position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;';\n document.body.appendChild(el);\n this._liveRegion = el;\n }\n this._liveRegion.textContent = '';\n setTimeout(() => { if (this._liveRegion) this._liveRegion.textContent = message; }, 100);\n }\n\n /**\n * Destroy the instance and clean up DOM/events.\n */\n destroy() {\n if (this._destroyed) return;\n this._destroyed = true;\n\n // ── Cancel confetti animation frame ──\n if (this._confettiRafId) {\n cancelAnimationFrame(this._confettiRafId);\n this._confettiRafId = null;\n }\n\n // ── Clear confetti burst timeouts ──\n if (this._confettiTimeouts) {\n this._confettiTimeouts.forEach(clearTimeout);\n this._confettiTimeouts = [];\n }\n\n // ── Remove canvas event listeners ──\n if (this._canvasEl) {\n this._canvasEl.removeEventListener('mousedown', this._boundStartScratch);\n this._canvasEl.removeEventListener('mousemove', this._boundMoveScratch);\n this._canvasEl.removeEventListener('mouseup', this._boundEndScratch);\n this._canvasEl.removeEventListener('mouseleave', this._boundEndScratch);\n this._canvasEl.removeEventListener('touchstart', this._boundStartScratch);\n this._canvasEl.removeEventListener('touchmove', this._boundMoveScratch);\n this._canvasEl.removeEventListener('touchend', this._boundEndScratch);\n this._canvasEl.removeEventListener('touchcancel', this._boundEndScratch);\n }\n\n // ── Remove coin listeners ──\n if (this._coinEl && this._boundStartCoinDrag) {\n this._coinEl.removeEventListener('mousedown', this._boundStartCoinDrag);\n this._coinEl.removeEventListener('touchstart', this._boundStartCoinDrag);\n }\n\n // ── Remove global document listeners (prevents memory leak) ──\n if (this._boundDocMouseMove) {\n document.removeEventListener('mousemove', this._boundDocMouseMove);\n document.removeEventListener('mouseup', this._boundDocMouseUp);\n document.removeEventListener('touchmove', this._boundDocTouchMove);\n document.removeEventListener('touchend', this._boundDocTouchEnd);\n document.removeEventListener('touchcancel', this._boundDocTouchCancel);\n }\n\n // ── Remove modal event listeners ──\n if (this._modalEl && this._boundModalClick) {\n this._modalEl.removeEventListener('click', this._boundModalClick);\n }\n if (this._claimBtnEl && this._boundClaimClick) {\n this._claimBtnEl.removeEventListener('click', this._boundClaimClick);\n }\n\n // ── Remove global keyboard listener ──\n if (this._boundDocKeydown) {\n document.removeEventListener('keydown', this._boundDocKeydown);\n }\n\n // ── Remove live-region ──\n if (this._liveRegion?.parentNode) {\n this._liveRegion.parentNode.removeChild(this._liveRegion);\n }\n\n // Disconnect resize observer\n if (this._resizeObserver) {\n this._resizeObserver.disconnect();\n this._resizeObserver = null;\n }\n\n // Remove modal\n if (this._modalEl && this._modalEl.parentNode) {\n this._modalEl.parentNode.removeChild(this._modalEl);\n }\n\n // Remove root\n if (this._rootEl && this._rootEl.parentNode) {\n this._rootEl.parentNode.removeChild(this._rootEl);\n }\n\n // Clear all references to prevent memory leaks\n this._rootEl = null;\n this._zoneEl = null;\n this._canvasEl = null;\n this._ctx = null;\n this._coinEl = null;\n this._giftIconEl = null;\n this._modalEl = null;\n this._confettiCanvasEl = null;\n this._prizeContentEl = null;\n this._instructionEl = null;\n this._prize = null;\n this._lastPoint = null;\n this._liveRegion = null;\n this._claimBtnEl = null;\n }\n\n /** Get the current prize object */\n get prize() {\n return this._prize;\n }\n}\n\n/* ------------------------------------------------------------------ */\n/* Static factory */\n/* ------------------------------------------------------------------ */\n\nexport const ScratchCard = {\n /**\n * Create and return a new ScratchCardInstance.\n * @param {ScratchCardOptions} opts\n * @returns {ScratchCardInstance}\n */\n init(opts) {\n return new ScratchCardInstance(opts);\n },\n \n /** The underlying class – useful for `instanceof` checks or subclassing. */\n Instance: ScratchCardInstance,\n \n /** Current SDK version */\n VERSION: '0.1.0-alpha.2',\n \n /** Export defaults for reference */\n DEFAULTS: DEFAULTS,\n};\n","/**\n * ScratchCard React Component (ES6 class-based wrapper)\n *\n * @example\n * import { ScratchCardReact } from 'spin-wheel-sdk/react';\n *\n * <ScratchCardReact\n * ref={cardRef}\n * prize={{ name: 'iPhone 16', icon: '📱', label: 'Congratulations!' }}\n * onReveal={(prize) => console.log(prize)}\n * />\n */\n\nimport { ScratchCard } from './ScratchCard.js';\n\n/**\n * All supported prop keys for ScratchCardReact component.\n * Used for copying props to SDK options.\n */\nconst PROP_KEYS = Object.freeze([\n // Core\n 'prize',\n \n // Header UI\n 'headerTitle',\n 'headerTitleColor',\n \n // Instruction\n 'instruction',\n 'instructionColor',\n \n // Scratch Behavior\n 'revealThreshold',\n 'brushSize',\n \n // Coin\n 'coinSize',\n 'showCoin',\n 'coinIcon',\n 'coinGradientStart',\n 'coinGradientEnd',\n \n // Card Appearance\n 'cardBackground',\n 'cardShadow',\n 'cardBorderRadius',\n \n // Scratch Zone\n 'scratchZoneBackground',\n 'scratchZoneShadow',\n 'scratchZoneBorderRadius',\n \n // Scratch Layer\n 'scratchLayerColor',\n 'scratchLayerSparkles',\n 'scratchLayerSparkleCount',\n \n // Prize Display\n 'prizeTextColor',\n 'prizeNameColor',\n 'prizeIconBackground',\n \n // Gift Icon\n 'showGiftIcon',\n 'giftIcon',\n 'giftIconBackground',\n \n // Modal\n 'showModal',\n 'modalTitle',\n 'modalTitleColor',\n 'modalButtonText',\n 'modalButtonColor',\n 'modalButtonTextColor',\n 'modalBackdropBlur',\n \n // Confetti\n 'confettiEnabled',\n 'confettiColors',\n 'confettiCount',\n 'confettiDuration',\n \n // Animation\n 'animationType',\n 'animationDuration',\n \n // Theme\n 'theme',\n]);\n\n/**\n * Creates the ScratchCardReact component using the provided React instance.\n * This factory pattern avoids bundling React into the SDK.\n *\n * @param {typeof import('react')} React – the React module\n * @returns {{ ScratchCardReact: React.ForwardRefExoticComponent }}\n */\nexport function createScratchCardReact(React) {\n const { useEffect, useRef, useImperativeHandle, forwardRef, createElement } = React;\n\n const ScratchCardReact = forwardRef(function ScratchCardReact(props, ref) {\n const containerRef = useRef(null);\n const instanceRef = useRef(null);\n\n // Keep latest callbacks in a ref so they're always fresh\n const callbacksRef = useRef({});\n callbacksRef.current.onScratchStart = props.onScratchStart;\n callbacksRef.current.onScratchProgress = props.onScratchProgress;\n callbacksRef.current.onReveal = props.onReveal;\n callbacksRef.current.onClaim = props.onClaim;\n\n // Mount the SDK once, destroy on unmount (SSR-safe)\n useEffect(() => {\n if (!containerRef.current || typeof window === 'undefined') return;\n\n const opts = {};\n\n // Copy only defined props\n PROP_KEYS.forEach((k) => {\n if (props[k] !== undefined) opts[k] = props[k];\n });\n\n opts.container = containerRef.current;\n\n // Wrap callbacks so they always point to latest prop\n opts.onScratchStart = () => callbacksRef.current.onScratchStart?.();\n opts.onScratchProgress = (percent) => callbacksRef.current.onScratchProgress?.(percent);\n opts.onReveal = (prize) => callbacksRef.current.onReveal?.(prize);\n opts.onClaim = (prize) => callbacksRef.current.onClaim?.(prize);\n\n try {\n instanceRef.current = ScratchCard.init(opts);\n } catch (err) {\n console.error('[ScratchCardReact] Failed to initialize ScratchCard:', err);\n }\n\n return () => {\n try {\n instanceRef.current?.destroy();\n } catch (_) { /* noop */ }\n instanceRef.current = null;\n };\n }, []); // mount-only\n\n // Live-update prize when the prop changes\n useEffect(() => {\n if (instanceRef.current && props.prize) {\n try {\n instanceRef.current.updatePrize(props.prize);\n } catch (_) { /* ignore on first mount */ }\n }\n }, [props.prize]);\n\n // Expose imperative handle\n useImperativeHandle(ref, () => ({\n /** Programmatically reveal the prize */\n reveal() { instanceRef.current?.reveal(); },\n\n /** Hide the modal */\n hideModal() { instanceRef.current?.hideModal(); },\n\n /** Show the modal */\n showModal() { instanceRef.current?.showModal(); },\n\n /** Reset the scratch card */\n reset() { instanceRef.current?.reset(); },\n\n /** Update prize at runtime */\n updatePrize(prize) { instanceRef.current?.updatePrize(prize); },\n\n /** Update options at runtime */\n updateOptions(opts) { instanceRef.current?.updateOptions(opts); },\n\n /** Get the current scratch percentage */\n get scratchPercent() { return instanceRef.current?.scratchPercent; },\n\n /** Get whether the prize has been revealed */\n get hasRevealed() { return instanceRef.current?.hasRevealed; },\n\n /** Get the current prize */\n get prize() { return instanceRef.current?.prize; },\n\n /** Access the raw ScratchCardInstance */\n get instance() { return instanceRef.current; },\n }), []);\n\n return createElement('div', {\n ref: containerRef,\n className: props.className || '',\n style: props.style || {},\n });\n });\n\n ScratchCardReact.displayName = 'ScratchCardReact';\n return ScratchCardReact;\n}\n\n/* ------------------------------------------------------------------\n Auto-detect React on `window` for UMD / CDN usage.\n In bundled ESM builds consumers call createScratchCardReact(React).\n ------------------------------------------------------------------ */\nlet _ScratchCardReact = null;\n\nif (typeof window !== 'undefined' && window.React) {\n _ScratchCardReact = createScratchCardReact(window.React);\n}\n\nexport { _ScratchCardReact as ScratchCardReact };\n"],"names":["buildCSS","config","hexToRGBA","t","theme","isHexColor","value","test","trim","parseRgbLike","m","match","r","Math","min","max","Number","g","b","some","n","isNaN","parseHex","hex","slice","length","parseInt","toRGBA","alpha","rgb","darkenColor","amount","factor","round","readableTextOn","bg","luma","gold","goldLight","goldDark","bgDark","textMuted","hasCustomTitleColor","titleColor","undefined","titleSpinColor","titleWinColor","subtitleColor","ringColor","pointerColor","hasCustomButtonColor","buttonColor","buttonBaseColor","buttonTextColor","buttonEdgeColor","redeemBtnTop","winCardRedeemButtonColorTop","redeemBtnBottom","winCardRedeemButtonColorBottom","redeemBtnText","winCardRedeemButtonTextColor","ringShadow","ringAnimation","buttonShadow","buttonAnimation","ringGlow","buttonGlow","bgStyle","backgroundColor","bgImageStyle","backgroundImage","ringBoxShadow","ringAnimationCSS","buttonBoxShadow","buttonHoverStyle","buttonActiveStyle","buttonBackground","cleanHex","replace","isPlainObject","item","Array","isArray","constructor","Object","deepMerge","target","sources","source","shift","key","prototype","hasOwnProperty","call","randomCode","len","chars","code","i","floor","random","buildClipPath","angleDeg","points","steps","rad","PI","a","x","cos","toFixed","y","sin","push","join","textRotation","escapeHtml","str","String","COPY_ICON_SVG","CHECK_ICON_SVG","ARROW_ICON_SVG","CONFETTI_COLORS","DEFAULTS","freeze","container","segments","winningIndex","spinDuration","minSpins","maxSpins","spinLimit","headerTitle","headerSubtitle","hubLabel","hubIcon","showButton","buttonText","showWinCard","generateCode","codeLength","redeemUrl","winCardBrandLabel","winCardWorthLabel","winCardRedeemButtonText","confettiOnWin","confettiColors","confettiCount","onSpinStart","onSpinEnd","onRedeem","onSpinLimitReached","_validateOptions","_validateOptions$1","opts","Error","s","label","color","console","warn","maxIdx","_isBrowser","window","document","_prefersReducedMotion","_prefersReducedMotion$1","matchMedia","matches","_injectedThemeKey","injectCSS","injectCSS$1","options","styleConfig","JSON","stringify","existing","querySelector","remove","style","createElement","setAttribute","textContent","head","appendChild","SpinWheelInstance","currentRotation","isSpinning","_destroyed","_lastWonPrize","_lastWonIndex","_spinCount","_rafId","_boundListeners","containerEl","segmentAngle","_rootEl","_wheelEl","_hubEl","_pointerEl","_btnEl","_overlayEl","_confettiEl","_cardProductEl","_cardBrandEl","_cardTitleEl","_cardWorthEl","_cardCodeEl","_cardCopyEl","_cardRedeemEl","_cardRedeemTextEl","_build","_bind","o","root","className","header","parts","split","innerHTML","wc","wo","wi","wheel","_buildSegments","hub","title","append","pointer","btn","type","_buildOverlay","angle","clip","rot","p","seg","transform","clipPath","webkitClipPath","background","icon","brandLabel","redeemText","overlay","confetti","card","bl","_btnClick","spin","addEventListener","_hubClick","e","stopPropagation","_hubKeydown","preventDefault","_btnKeydown","_overlayClick","hideWinCard","_copyClick","select","setSelectionRange","navigator","clipboard","writeText","then","_showCopied","execCommand","_","_redeemClick","err","error","open","_docKeydown","classList","contains","setTimeout","_isSpinLimitReached","limit","forceIndex","disabled","add","count","segAngle","isValidIndex","idx","winIndex","segmentCenter","fullSpins","pointerAt","remainder","targetAngle","totalRotation","duration","startTime","performance","now","startRot","animate","elapsed","progress","easeOut","pow","rotation","requestAnimationFrame","_highlightPointer","_showWinCard","offsetHeight","prize","worthLabel","worth","display","parentElement","_createConfetti","_announceToScreenReader","colors","span","left","top","animationDelay","animationDuration","updateSegments","newSegments","destroy","cancelAnimationFrame","removeEventListener","_liveRegion","parentNode","removeChild","lastWonPrize","lastWonIndex","spinCount","remainingSpins","resetSpinCount","message","el","cssText","body","updateOptions","newOptions","merged","keys","SpinWheel","init","Instance","VERSION","PROP_KEYS","createSpinWheelReact","React","useEffect","useRef","useImperativeHandle","forwardRef","SpinWheelReact","props","ref","containerRef","instanceRef","callbacksRef","current","forEach","k","segs","instance","displayName","_SpinWheelReact","buildScratchCSS","purpleDark","purpleMid","purpleLight","white","textDark","headerTitleColor","instructionColor","coinStart","coinGradientStart","coinEnd","coinGradientEnd","prizeTextColor","prizeNameColor","prizeIconBg","prizeIconBackground","giftIconBg","giftIconBackground","modalTitleColor","modalBtnText","modalButtonTextColor","cardShadow","scratchZoneShadow","modalBackdropBlur","cardBorderRadius","scratchZoneBorderRadius","animDuration","animType","animationType","cardBg","cardBackground","hasCustomScratchZoneBg","scratchZoneBackground","scratchZoneBg","modalBtnBg","modalButtonColor","cardBoxShadow","zoneShadow","backdropBlur","cardAnimation","modalAnimation","instruction","revealThreshold","brushSize","coinSize","showCoin","coinIcon","scratchLayerColor","scratchLayerSparkles","scratchLayerSparkleCount","showGiftIcon","giftIcon","showModal","modalTitle","modalButtonText","confettiEnabled","confettiDuration","onScratchStart","onScratchProgress","onReveal","onClaim","name","includes","ScratchCardInstance","scratchPercent","isScratching","isDraggingCoin","hasRevealed","_scratchStartFired","_confettiRafId","_confettiTimeouts","_prize","zoneW","zoneH","_lastPoint","_resizeObserver","_zoneEl","_canvasEl","_ctx","_coinEl","_giftIconEl","_modalEl","_confettiCanvasEl","_prizeContentEl","_instructionEl","pageBg","wrapper","zone","id","_id","prizeContent","canvas","getContext","prizeIconVisible","coin","_buildModal","_initCanvas","toString","confettiCanvas","bgGlow","modalCard","setSize","w","clientWidth","h","clientHeight","dpr","devicePixelRatio","width","ceil","height","setTransform","scale","_drawSurface","_positionCoinInitial","ResizeObserver","observe","ctx","fillStyle","fillRect","sparkleCount","globalCompositeOperation","beginPath","arc","fill","coinRadius","_boundStartScratch","_onStartScratch","bind","_boundMoveScratch","_onMoveScratch","_boundEndScratch","_onEndScratch","passive","_boundStartCoinDrag","_onStartCoinDrag","_boundDocMouseMove","_onMoveCoinDrag","_boundDocMouseUp","_onEndCoinDrag","_boundDocTouchMove","_boundDocTouchEnd","_boundDocTouchCancel","_boundModalClick","hideModal","btnClaim","_boundClaimClick","_claimBtnEl","_boundDocKeydown","_getEventPoint","rect","getBoundingClientRect","touches","clientX","clientY","_scratch","point","dx","dy","dist","sqrt","radius","_updateScratchPercent","cw","ch","imageData","getImageData","data","transparent","step","total","_reveal","clearRect","_startConfetti","claimBtn","focus","c","_clampCoinPosition","_updateCoinPosition","cx","cy","cctx","particles","centerX","centerY","speed","vx","vy","size","rotationSpeed","opacity","birth","_addBurst","gravity","friction","Date","age","life","save","globalAlpha","translate","rotate","restore","reveal","reset","updatePrize","circle","clearTimeout","disconnect","ScratchCard","createScratchCardReact","ScratchCardReact","percent","_ScratchCardReact"],"mappings":";;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,QAAQA,CAACC,MAAM,EAAEC,SAAS,EAAE;EAC1C,MAAMC,CAAC,GAAGF,MAAM,CAACG,KAAK,IAAI,CAAA,CAAE;EAC5B,MAAMC,UAAU,GAAIC,KAAK,IAAK,OAAOA,KAAK,KAAK,QAAQ,IAAI,oCAAoC,CAACC,IAAI,CAACD,KAAK,CAACE,IAAI,EAAE,CAAC;EAClH,MAAMC,YAAY,GAAIH,KAAK,IAAK;IAC9B,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE,OAAO,IAAI;IAC1C,MAAMI,CAAC,GAAGJ,KAAK,C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C,aAAa;AACjB,IAAIC,gBAAgB;AACpB;AACA,EAAEV,aAAa,GAAG;AAClB;AACA,yDAAyDG,QAAQ;AACjE,qDAAqD/D,SAAS,CAAC8C,SAAS,EAAE,GAAG,CAAC;AAC9E,EAAE,GAAG,EAAE;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,sCAAsCV,SAAS,OAAOD,IAAI,QAAQE,QAAQ;AAC1E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0BU,YAAY;AACtC,sEAAsE/C,SAAS,CAAC+C,YAAY,EAAE,GAAG,CAAC;AAClG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAI2B,gBAAgB,UAAUvB,eAAe;AAC7C;AACA,IAAIoB,eAAe;AACnB;AACA;AACA,EAAEC,gBAAgB;AAClB,EAAEC,iBAAiB;AACnB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,sCAAsCpB,YAAY,IAAIE,eAAe;AACrE;AACA;AACA;AACA;AACA;AACA,+DAA+DE,aAAa;AAC5E,sDAAsDA,aAAa;;AAEnE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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;AAEA;AACA;AACA;AACA,UAAU9B,gBAAgB;AAC1B;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,kBAAkBmB,uBAAuB;AACzC;AACA,eAAeQ,aAAa;AAC5B,IAAII,UAAU;AACd;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAeN,sBAAsB,GAAGE,aAAa,GAAG,2GAA2GhC,UAAU,QAAQC,SAAS,QAAQ;AACtM;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,UAAUU,cAAc;AACxB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,UAAUC,cAAc;AACxB,yBAAyBzX,SAAS,CAACmC,IAAI,EAAE,GAAG,CAAC;AAC7C;;AAEA;AACA;AACA;AACA;AACA,eAAeuV,WAAW;AAC1B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAeE,UAAU;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuCR,SAAS,QAAQjV,IAAI,SAASmV,OAAO;AAC5E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAUA,OAAO;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,UAAUH,gBAAgB;AAC1B;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAI+B,YAAY;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMlZ,SAAS,CAAC8W,SAAS,EAAE,GAAG,CAAC;AAC/B,MAAM9W,SAAS,CAAC6W,UAAU,EAAE,GAAG,CAAC;AAChC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAeG,KAAK;AACpB,kBAAkBoB,gBAAgB;AAClC;AACA;AACA;AACA,IAAIgB,cAAc;AAClB;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kDAAkDpZ,SAAS,CAAC+W,WAAW,EAAE,IAAI,CAAC;AAC9E;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,UAAUe,eAAe;AACzB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,uCAAuCf,WAAW,QAAQD,SAAS;AACnE;AACA;AACA;AACA;AACA;AACA,0BAA0B9W,SAAS,CAAC6W,UAAU,EAAE,GAAG,CAAC;AACpD;;AAEA;AACA;AACA;AACA,UAAUI,QAAQ;AAClB;;AAEA;AACA;AACA,UAAUH,SAAS;AACnB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,eAAegC,UAAU;AACzB,UAAUf,YAAY;AACtB;AACA;AACA;AACA;AACA,0BAA0B/X,SAAS,CAAC6W,UAAU,EAAE,GAAG,CAAC;AACpD;AACA;;AAEA;AACA;AACA,0BAA0B7W,SAAS,CAAC6W,UAAU,EAAE,GAAG,CAAC;AACpD;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,UAAUtU,SAAS;AACnB;AACA;;AAEA;AACA,UAAUuU,SAAS;AACnB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;;ACreA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA;AACA;AACA;;AAEA;AACA,MAAMrP,QAAQ,GAAG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