| 1 |
(()=>{"use strict";const t=window.ReactDOM,e=window.React,r=window.ReactJSXRuntime,o=({attributes:t})=>{const{emoji:o,height:n,align:a,emojiSize:i,density:s,animationStyle:c}=t,l=(0,e.useRef)(null);(0,e.useEffect)((()=>{if(l.current){const t=setTimeout((()=>{d(l.current,o,n,i,s)}),50);return()=>clearTimeout(t)}}),[o,n,a,i,s]);const d=(t,e,r,o,n)=>{t.innerHTML="";const a=(t=>{const e={small:{fontSize:2.5,overlap:-1},medium:{fontSize:3.75,overlap:-1.4},large:{fontSize:5,overlap:-1.8},xlarge:{fontSize:6.5,overlap:-2.3}};return e[t]||e.medium})(o),i=(t=>{const e={sparse:{overlapFactor:.5,rowMargin:-2,emojisExtra:2},normal:{overlapFactor:.65,rowMargin:-3,emojisExtra:4},dense:{overlapFactor:.75,rowMargin:-3.5,emojisExtra:6}};return e[t]||e.normal})(n),s=t.offsetWidth,c=Math.ceil(s/(60*i.overlapFactor))+i.emojisExtra;for(let r=0;r<4;r++){const o=document.createElement("div");o.className="b-blocks-emoji-stack-iemoji-row",r>0&&(o.style.marginTop=`${i.rowMargin}rem`);for(let t=0;t<c;t++){const r=document.createElement("span");r.textContent=e,r.className="b-blocks-emoji-stack-item";const n=60*Math.random()-30,i=20*Math.random()-10;r.style.fontSize=`${a.fontSize}rem`,r.style.marginRight=`${a.overlap}rem`,r.style.setProperty("--b-blocks-emoji-stack-separator-rotation",`${n}deg`),r.style.setProperty("--b-blocks-emoji-stack-separator-index",t),r.style.transform=`rotate(${n}deg) translateY(${i}px)`,o.appendChild(r)}t.appendChild(o)}};return(0,r.jsx)("div",{className:"b-blocks-emoji-stack-separator-container "+(c?`b-blocks-emoji-stack-separator-animation-${c}`:""),children:(0,r.jsx)("div",{ref:l,className:"b-blocks-emoji-stack-container"})})},n="linear-gradient(135deg, #0040E3, #18D4FD)",a=t=>{const e=(t=>{try{const e=new URL(t);return["http:","https:"].includes(e.protocol)?e.toString():null}catch(e){return"string"==typeof t&&t.startsWith("/")&&!t.startsWith("//")?t:null}})(t);return e?`url('${e.replace(/['"()]/g,"")}')`:"none"},i=(t,e)=>{return null==(r=e)||""===r||Array.isArray(r)&&0===r.length||"object"==typeof r&&0===Object.keys(r).length||"string"==typeof r&&""===r.trim()||"number"==typeof r&&0===r?"":`${t}: ${e};`;var r},s=(t,e=!0,r=!0,o=!0)=>{const{type:s="solid",color:c="",gradient:l=n,image:d={},position:m="center center",attachment:u="",repeat:p="no-repeat",size:b="",overlayColor:g=""}=t||{};return"gradient"===s&&r?i("background",l):"image"===s&&o?`background: ${a(d?.url)};\n\t\t\t\t${i("background-color",g)}\n\t\t\t\t${i("background-position",m)}\n\t\t\t\t${i("background-size",b)}\n\t\t\t\t${i("background-repeat",p)}\n\t\t\t\t${i("background-attachment",u)}\n\t\t\t\t${i("background-repeat",p)}\n\t\t\t\tbackground-blend-mode: overlay;`:e&&i("background",c)},c=t=>{if(!t)return"";const e=t=>{const{color:e="#000000",style:r="solid",width:o="0px"}=t;return`${o} ${r} ${e}`};return"object"!=typeof t||Array.isArray(t)?"":t.hasOwnProperty("top")||t.hasOwnProperty("right")||t.hasOwnProperty("bottom")||t.hasOwnProperty("left")?["top","right","bottom","left"].map((r=>t[r]?`border-${r}: ${e(t[r])};`:"")).join(" ").trim():i("border",e(t))},l=t=>{if(!t)return"";if("string"==typeof t)return t;if("object"==typeof t&&!Array.isArray(t)){const e=["top","right","bottom","left"];return e.map((e=>t[e]||"")).every((t=>!t))?"":e.map((e=>t[e]||"0")).join(" ")}return""},d=({attributes:t,id:e})=>{const{background:o,height:n,padding:a,margin:d,border:m,borderRadius:u}=t,p=`#${e} .b-blocks-emoji-stack-separator-container`;return(0,r.jsx)("style",{dangerouslySetInnerHTML:{__html:`\n ${p}{\n ${s(o)}\n ${i("height",n)}\n ${i("padding",l(a))}\n ${i("margin",l(d))}\n ${c(m)}\n ${i("border-radius",l(u))}\n }\n `}})};document.addEventListener("DOMContentLoaded",(()=>{document.querySelectorAll(".wp-block-b-blocks-emoji-stack-separator").forEach((e=>{let n={};try{const t=e.dataset.attributes;t&&"undefined"!==t&&""!==t&&(n=JSON.parse(t))}catch(t){console.warn("Emoji Stack Separator: Invalid attributes JSON",t)}(0,t.createRoot)(e).render((0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(d,{attributes:n,id:e.id}),(0,r.jsx)(o,{attributes:n})]})),e?.removeAttribute("data-attributes")}))}))})(); |