"use strict";(globalThis.webpackChunk_tsparticles_wordpress=globalThis.webpackChunk_tsparticles_wordpress||[]).push([[6097],{6097(t,e,n){n.d(e,{loadTextShape:()=>h});var a=n(3199);const i=["text","character","char","multiline-text"];function o(t,e,n,i,o,s){const l={x:-e.length*n*a.MXx,y:n*a.MXx+i*n};o&&t.fillText(e,l.x,l.y),s&&t.strokeText(e,l.x,l.y)}var s=n(9306);class l{draw(t){!function(t){const{context:e,particle:n,fill:i,stroke:s,radius:l,opacity:h}=t,r=n.shapeData;if(!r)return;const c=r.value;if(n.textLines??=(0,a.TA3)(c,n.randomIndexData)?.split("\n")??[],n.maxTextLength??=n.textLines.length?Math.max(...n.textLines.map(t=>t.length)):n.textLines[0]?.length??0,!n.textLines.length||!n.maxTextLength)return;const x=n.textLines,g=r.style??"",d=r.weight??"400",u=r.font??"Verdana",p=Math.round(l)*a.gdl/(x.length*n.maxTextLength);e.font=`${g} ${d} ${p.toString()}px "${u}"`;const f=e.globalAlpha;e.globalAlpha=h;for(let t=0;t<x.length;t++){const n=x[t];n&&o(e,n,p,t,i,s)}e.globalAlpha=f}(t)}async init(t){const e=t.actualOptions;if(i.find(t=>(0,a.hnD)(t,e.particles.shape.type))){const t=i.map(t=>e.particles.shape.options[t]).find(t=>!!t),n=[];(0,a.wJ2)(t,t=>{n.push((0,s.Al)(t.font,t.weight))}),await Promise.all(n)}}particleInit(t,e){if(!e.shape||!i.includes(e.shape))return;const n=e.shapeData;if(void 0===n)return;const o=n.value;o&&(e.textLines=(0,a.TA3)(o,e.randomIndexData)?.split("\n")??[],e.maxTextLength=e.textLines.length?Math.max(...e.textLines.map(t=>t.length)):e.textLines[0]?.length??0)}}async function h(t){t.checkVersion("4.1.3"),await t.pluginManager.register(t=>{t.pluginManager.addShape(i,()=>Promise.resolve(new l))})}},9306(t,e,n){n.d(e,{V6:()=>o,YL:()=>s,M5:()=>l,iO:()=>h,Al:()=>r});var a=n(3199);const i=a.D_O/255;function o(t,e,n){t.beginPath(),t.moveTo(e.x,e.y),t.lineTo(n.x,n.y),t.closePath()}function s(t,e,n,o=!0){const s=t.getImageData(a.boI.x,a.boI.y,e.width,e.height).data;o&&t.clearRect(a.boI.x,a.boI.y,e.width,e.height);const l=[];for(let t=0;t<s.length;t+=n){const o=t/n,h={x:o%e.width,y:Math.floor(o/e.width)};l[h.y]??=[];const r=l[h.y];r&&(r[h.x]={r:s[t+0]??a.Fli,g:s[t+1]??a.Fli,b:s[t+2]??a.Fli,a:(s[t+3]??a.aZx)*i})}return{pixels:l,width:Math.min(...l.map(t=>t.length)),height:l.length}}function l(t,e,n){const i=new Image;i.crossOrigin="Anonymous";const o=new Promise((t,o)=>{i.onerror=o,i.onload=()=>{const l=(0,a.T5G)().createElement("canvas");l.width=i.width,l.height=i.height;const h=l.getContext("2d",n);h?(h.drawImage(i,a.boI.x,a.boI.y,i.width,i.height,a.boI.x,a.boI.y,l.width,l.height),t(s(h,l,e))):o(new Error("Could not get canvas context"))}});return i.src=t,o}function h(t,e,n,i){const o=(0,a.T5G)().createElement("canvas"),l=o.getContext("2d",i),{font:h,text:r,lines:c,color:x}=t;if(!r||!l)return;const g=r.split(c.separator),d=(0,a.EtT)(h.size)?`${h.size.toString()}px`:h.size,u=[];let p=0,f=0;for(const t of g){l.font=`${h.style||""} ${h.variant||""} ${h.weight||""} ${d} ${h.family}`;const e=l.measureText(t),n={measure:e,text:t,height:e.actualBoundingBoxAscent+e.actualBoundingBoxDescent,width:e.width};p=Math.max(p||0,n.width),f+=n.height+c.spacing,u.push(n)}o.width=p,o.height=f;let m=0;for(const t of u)l.font=`${h.style||""} ${h.variant||""} ${h.weight||""} ${d} ${h.family}`,n?(l.fillStyle=x,l.fillText(t.text,a.boI.x,m+t.measure.actualBoundingBoxAscent)):(l.strokeStyle=x,l.strokeText(t.text,a.boI.x,m+t.measure.actualBoundingBoxAscent)),m+=t.height+c.spacing;return s(l,o,e)}async function r(t,e){try{await(0,a.T5G)().fonts.load(`${e??"400"} 36px '${t??"Verdana"}'`)}catch{}}}}]);