import{i as e}from"./giftsCache--pqQjzkU.js";var t=[`pulse`,`bounce`,`glow`,`shake`],n=[`none`,`soft`,`strong`,`glow`],r=[`none`,`circle`,`rounded`];function i(e){switch(e){case`none`:return`none`;case`strong`:return`drop-shadow(0 4px 10px rgba(0,0,0,.85))`;case`glow`:return`drop-shadow(0 0 8px rgba(255,220,120,.95)) drop-shadow(0 0 18px rgba(255,190,60,.55))`;default:return`drop-shadow(0 2px 6px rgba(0,0,0,.55))`}}function a(e){let t=e.bgShape??`none`;if(t===`none`)return{background:`transparent`,borderRadius:`6px`,padding:`0`};let{r:n,g:r,b:i}=o(e.bgColor??`#000000`);return{background:`rgba(${n},${r},${i},${typeof e.bgOpacity==`number`?e.bgOpacity:.35})`,borderRadius:t===`circle`?`50%`:`18%`,padding:`12%`}}function o(e){let t=e.trim().replace(/^#/,``);return t.length===3&&(t=t.split(``).map(e=>e+e).join(``)),/^[0-9a-fA-F]{6}$/.test(t)?{r:parseInt(t.slice(0,2),16),g:parseInt(t.slice(2,4),16),b:parseInt(t.slice(4,6),16)}:{r:0,g:0,b:0}}function s(e){if(!e||typeof e!=`object`)return null;let i=e;return{imageUrl:typeof i.imageUrl==`string`?i.imageUrl:``,aspect:typeof i.aspect==`number`&&isFinite(i.aspect)&&i.aspect>0?i.aspect:16/9,items:(Array.isArray(i.items)?i.items:[]).filter(e=>!!e&&typeof e==`object`).map(e=>({triggerId:typeof e.triggerId==`string`?e.triggerId:``,xPct:u(l(e.xPct,.5)),yPct:u(l(e.yPct,.5)),scale:Math.min(4,Math.max(.2,l(e.scale,1))),anim:t.includes(String(e.anim))?e.anim:`pulse`,showName:e.showName===!0,shadow:n.includes(String(e.shadow))?e.shadow:`soft`,bgShape:r.includes(String(e.bgShape))?e.bgShape:`none`,bgColor:typeof e.bgColor==`string`&&/^#[0-9a-fA-F]{6}$/.test(e.bgColor)?e.bgColor:`#000000`,bgOpacity:Math.min(1,Math.max(0,l(e.bgOpacity,.35)))})).filter(e=>e.triggerId)}}function c(t,n){let r=t.event,i=e({gifts:r.gifts,giftNames:r.giftNames,giftImages:r.giftImages},n)[0];if(i?.imgUrl)return{imgUrl:i.imgUrl,name:i.name||t.name};if(r.rewardImage)return{imgUrl:r.rewardImage,name:r.rewardName||t.name};let a=r.emotes?.[0]?.imageUrl;return a?{imgUrl:a,name:r.emotes?.[0]?.name||t.name}:t.image?{imgUrl:t.image,name:i?.name||t.name}:{emoji:i?.emoji??`🎁`,name:i?.name||t.name}}function l(e,t){return typeof e==`number`&&isFinite(e)?e:t}function u(e){return Math.max(0,Math.min(1,e))}export{c as a,a as i,r as n,s as o,n as r,i as s,t};