1import{$ as e,H as t,U as n,V as r,W as i,Z as a,et as o}from"./index-D-yw_Bjc.js";var s=n(`<canvas class=peach-rune-canvas style=display:block>`),c=17,l=c*2.3,u=c*1.35,d=c*.18,f=[18,24,14],p=`#F49C70`;function m(){let e=getComputedStyle(document.documentElement).getPropertyValue(`--peach-accent`).trim();return/^#[0-9a-fA-F]{6}$/.test(e)?e:p}function h(n){let h,g=0,_=!1,v=p,y=[244,156,112];function b(e){v=e,y=[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}return o(()=>{let t=h.getContext(`2d`);if(!t)return;b(m());let r=new MutationObserver(()=>{let e=m();e!==v&&b(e)});r.observe(document.documentElement,{attributes:!0,attributeFilter:[`style`]});let i=n.width,a=n.height,o=Math.ceil(i/(u+d))+4,s=Math.floor(a/l)+1,p=s*o,x=Math.min(8,Math.max(3,Math.floor(p*.03))),S=()=>({row:Math.floor(Math.random()*s),col:Math.floor(Math.random()*o),phase:Math.random(),speed:.4+Math.random()*.4,lifetime:2e3+Math.random()*3e3,age:0}),C=Array.from({length:x},S),w=Array.from({length:s},()=>Math.random()*n.runeString.length*(u+d)),T=n.runeString.length*(u+d)||1,E=performance.now(),D=e=>{let r=Math.min(e-E,64);E=e,t.clearRect(0,0,i,a),t.fillStyle=`#1a1410`,t.fillRect(0,0,i,a),t.font=`${c}px PeachScript, monospace`,t.textBaseline=`alphabetic`;let p=new Map;for(let e of C){e.age+=r,e.phase=(e.phase+e.speed*r/1e3)%1;let t=e.age/e.lifetime,n=Math.sin(t*Math.PI),i=Math.sin(e.phase*Math.PI*2)*.5+.5,a=Math.max(0,n)*i*.85;p.set(`${e.row},${e.col}`,a),e.age>=e.lifetime&&Object.assign(e,S())}let[m,h,_]=y,v=n.runeString,b=v.length;if(b===0){g=requestAnimationFrame(D);return}for(let e=0;e<s;e++){let n=f[e%f.length];w[e]=(w[e]+n*r/1e3)%T;let a=e*l+c+12;for(let n=0;n<o;n++){let r=n*(u+d)-w[e]%(u+d);if(r<-u||r>i+u)continue;let o=v[((Math.floor(w[e]/(u+d))+n)%b+b)%b],s=p.get(`${e},${n}`)??0;s>.01?(t.save(),t.shadowColor=`rgba(${m}, ${h}, ${_}, ${s*.9})`,t.shadowBlur=10,t.fillStyle=`rgba(${m}, ${h}, ${_}, ${.6+s*.4})`,t.fillText(o,r,a),t.restore()):(t.fillStyle=`rgba(245, 240, 234, 0.82)`,t.fillText(o,r,a))}}g=requestAnimationFrame(D)},O=()=>{_||(_=!0,E=performance.now(),g=requestAnimationFrame(D))},k=()=>{_&&(_=!1,cancelAnimationFrame(g))},A=()=>{document.hidden?k():O()};document.addEventListener(`visibilitychange`,A),document.fonts.load(`${c}px PeachScript`).finally(O),e(()=>{k(),r.disconnect(),document.removeEventListener(`visibilitychange`,A)})}),(()=>{var e=s(),o=h;return typeof o==`function`?i(o,e):h=e,a(i=>{var a=n.width,o=n.height,s=`${n.width}px`,c=`${n.height}px`;return a!==i.e&&r(e,`width`,i.e=a),o!==i.t&&r(e,`height`,i.t=o),s!==i.a&&t(e,`width`,i.a=s),c!==i.o&&t(e,`height`,i.o=c),i},{e:void 0,t:void 0,a:void 0,o:void 0}),e})()}export{h as t};