asciify-engine 1.0.85 → 1.0.87

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/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var t=require("gifuct-js"),e={standard:" .:-=+*#%@",blocks:" ░▒▓█",minimal:" .:+",dense:" .'`^\",:;Il!i><~+_-?][}{1)(|/tfjrxnuvczXYUJCLQ0OZmwqpdbkhao*#MW&8%B@$",binary:"01",dots:" ⠁⠃⠇⡇⣇⣧⣷⣿",letters:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",claudeCode:" ╔╗╚╝║═╠╣╦╩╬░▒▓█│─┌┐└┘├┤┬┴┼",box:" ▪◾◼■█",lines:" ˗‐–—―━",braille:" ⠁⠂⠃⠄⠅⠆⠇⠈⠉⠊⠋⠌⠍⠎⠏⠐⠑⠒⠓⠔⠕⠖⠗⠘⠙⠚⠛⠜⠝⠞⠟⠠⠡⠢⠣⠤⠥⠦⠧⠨⠩⠪⠫⠬⠭⠮⠯⠰⠱⠲⠳⠴⠵⠶⠷⠸⠹⠺⠻⠼⠽⠾⠿⡀⡁⡂⡃⡄⡅⡆⡇⣀⣁⣂⣃⣄⣅⣆⣇⣈⣉⣊⣋⣌⣍⣎⣏⣐⣑⣒⣓⣔⣕⣖⣗⣘⣙⣚⣛⣜⣝⣞⣟⣠⣡⣢⣣⣤⣥⣦⣧⣨⣩⣪⣫⣬⣭⣮⣯⣰⣱⣲⣳⣴⣵⣶⣷⣸⣹⣺⣻⣼⣽⣾⣿",katakana:" ヲァィゥェォャュョッアイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワン",musical:" ♩♪♫♬♭♮♯",emoji:" ⬛🟫🟥🟧🟨🟩🟦🟪⬜",circles:" .·:∘○◦°•∙",shadows:" ·∘◦○◎⊙●◉",starfield:" ˙·∘∗✦✧★◆●",geometric:" ·△▷◇◈◆▣■█",pipes:" ╶─┐└├┤┬┴┼╬▒▓█",waves:" ˜∼≈〰≋∿∾∭∫",shards:" ╱╲╳◤◥◣◢△▲◆◼█",smoke:" ·˙⁚⁖∶∷⋮⋰⋱∴∵",ascii:" .'`^\",:;~-_+<>i!lI?/\\|()[]{}1tfjrxnuvczXYUJCLQ0OZmwqpdbkhao*#MW&8%B@$",interface:" ·•-–—+=:;<>[]{}()⌘⌥⇧⌃↵↗↘◇◆◈□■",prompt:" .:;>_`/\\|{}[]()=+*#@$",data:" ·∙•◦○●◇◆◈▱▰▣█",humanist:" ·˙,:;∴∵∷∶⁚⋮⋯∼≈≋∞",mesh:" ·╶╴╷╵─│┌┐└┘├┤┬┴┼╬░▒▓█"},o={cosmic:[e.starfield,e.circles,e.shadows],rain:[e.katakana,e.braille,e.binary],terminal:[e.pipes,e.claudeCode,e.standard],crystal:[e.shards,e.geometric,e.blocks],fluid:[e.waves,e.smoke,e.circles],pulse:[e.dense,e.standard,e.blocks],dream:[e.braille,e.shadows,e.smoke],angular:[e.geometric,e.shards,e.starfield],assistant:[e.interface,e.prompt,e.data],signal:[e.mesh,e.data,e.ascii],editorial:[e.humanist,e.waves,e.smoke]},n={classic:{renderMode:"ascii",charset:e.standard,colorMode:"grayscale"},particles:{renderMode:"dots",colorMode:"fullcolor",dotSizeRatio:.8},letters:{renderMode:"ascii",charset:e.letters,colorMode:"fullcolor"},claudeCode:{renderMode:"ascii",charset:e.claudeCode,colorMode:"accent",accentColor:"#f97316"},art:{renderMode:"ascii",charset:e.dense,colorMode:"fullcolor"},terminal:{renderMode:"ascii",charset:e.standard,colorMode:"matrix"},box:{renderMode:"ascii",charset:e.box,colorMode:"grayscale"},lines:{renderMode:"ascii",charset:e.lines,colorMode:"fullcolor"},braille:{renderMode:"ascii",charset:e.braille,colorMode:"fullcolor"},katakana:{renderMode:"ascii",charset:e.katakana,colorMode:"matrix"},musical:{renderMode:"ascii",charset:e.musical,colorMode:"accent",accentColor:"#e040fb"},emoji:{renderMode:"ascii",charset:e.emoji,colorMode:"fullcolor"},circles:{renderMode:"ascii",charset:e.circles,colorMode:"accent",accentColor:"#d4ff00"},shadows:{renderMode:"ascii",charset:e.shadows,colorMode:"accent",accentColor:"#50a0ff"},starfield:{renderMode:"ascii",charset:e.starfield,colorMode:"fullcolor"},geometric:{renderMode:"ascii",charset:e.geometric,colorMode:"grayscale"},pipes:{renderMode:"ascii",charset:e.pipes,colorMode:"accent",accentColor:"#00ff88"},waves:{renderMode:"ascii",charset:e.waves,colorMode:"fullcolor"},shards:{renderMode:"ascii",charset:e.shards,colorMode:"grayscale"},smoke:{renderMode:"ascii",charset:e.smoke,colorMode:"accent",accentColor:"#c850ff"},ascii:{renderMode:"ascii",charset:e.ascii,colorMode:"grayscale"},interface:{renderMode:"ascii",charset:e.interface,colorMode:"accent",accentColor:"#f4f1ea"},prompt:{renderMode:"ascii",charset:e.prompt,colorMode:"matrix"},data:{renderMode:"ascii",charset:e.data,colorMode:"fullcolor"},humanist:{renderMode:"ascii",charset:e.humanist,colorMode:"accent",accentColor:"#d6ccc2"},mesh:{renderMode:"ascii",charset:e.mesh,colorMode:"accent",accentColor:"#8fd3ff"}},r={agentField:{...n.interface,charsetFrames:o.assistant,charsetFps:1.6,animationStyle:"breathe",animationSpeed:.75,ditherStrength:.12,hoverEffect:"glow",hoverStrength:.42,hoverRadius:.18,hoverColor:"#f4f1ea",normalize:!0},liquidSignal:{...n.data,charsetFrames:o.signal,charsetFps:2.4,animationStyle:"melt",animationSpeed:.65,ditherStrength:.45,hoverEffect:"repel",hoverStrength:.55,hoverRadius:.22,hoverColor:"#8fd3ff",normalize:!0},cursorGravity:{...n.mesh,charsetFrames:o.angular,charsetFps:1.2,animationStyle:"orbit",animationSpeed:.9,ditherStrength:.2,hoverEffect:"attract",hoverStrength:.82,hoverRadius:.24,hoverColor:"#ffffff",normalize:!0},editorialPulse:{...n.humanist,charsetFrames:o.editorial,charsetFps:.9,animationStyle:"ripple",animationSpeed:.55,ditherStrength:.18,hoverEffect:"spotlight",hoverStrength:.35,hoverRadius:.2,hoverColor:"#fff8ea",normalize:!0},terminalFlow:{...n.prompt,charsetFrames:o.terminal,charsetFps:3,animationStyle:"rain",animationSpeed:1.1,ditherStrength:.22,hoverEffect:"glitchText",hoverStrength:.65,hoverRadius:.16,hoverColor:"#d4ff00",hoverText:["BUILD","SHIP","RUN","ASK","MODEL"],normalize:!0}},a={fontSize:10,charSpacing:1,brightness:0,contrast:0,charset:e.standard,colorMode:"grayscale",accentColor:"#d4ff00",invert:!1,renderMode:"ascii",animationStyle:"none",animationSpeed:1,dotSizeRatio:.8,ditherStrength:0,charAspect:.55,normalize:!1,hoverStrength:0,hoverRadius:.2,hoverEffect:"spotlight",hoverColor:"#ffffff",hoverShape:"circle",hoverText:"ASCIIFY",artStyle:"classic",customText:"",chromaKey:null,chromaKeyTolerance:60};function i(t,e){const o=document.createElement("canvas");o.width=t,o.height=e;const n=o.getContext("2d",{willReadFrequently:!0});return{canvas:o,ctx:n}}function s(t,e,o){let n=t+255*e;return n=259*(255*o+255)/(255*(259-255*o))*(n-128)+128,Math.max(0,Math.min(255,n))}function c(t,e,o){const n=o?1-t/255:t/255,r=[...e],a=Math.floor(n*(r.length-1));return r[Math.max(0,Math.min(r.length-1,a))]}function l(t,e,o,n,r,a){if((a?1-t/255:t/255)<.12)return" ";const i=[...e];return i[(n*r+o)%i.length]}var h=[[0,8,2,10],[12,4,14,6],[3,11,1,9],[15,7,13,5]];function f(t,e,o,n){if(n<=0)return t;const r=(h[o%4][e%4]/16-.5)*n*128;return Math.max(0,Math.min(255,t+r))}var d=new Array(256),u=new Array(256);for(let t=0;t<256;t++)d[t]=`rgb(${t},${t},${t})`,u[t]=`rgb(0,${t},0)`;function m(t,e,o,n,r,a=!1){switch(e){case"fullcolor":return`rgb(${t.r},${t.g},${t.b})`;case"matrix":return u[.299*t.r+.587*t.g+.114*t.b|0];case"accent":return`rgb(${o},${n},${r})`;default:{const e=.299*t.r+.587*t.g+.114*t.b|0;return d[e]}}}var g=[0,0,0];function M(t,e,o,n,r,a=!1){switch(e){case"fullcolor":g[0]=t.r,g[1]=t.g,g[2]=t.b;break;case"matrix":{const e=.299*t.r+.587*t.g+.114*t.b|0;g[0]=0,g[1]=e,g[2]=0;break}case"accent":g[0]=o,g[1]=n,g[2]=r;break;default:{const e=.299*t.r+.587*t.g+.114*t.b|0;g[0]=e,g[1]=e,g[2]=e;break}}return g}function p(t){const e=t.match(/rgba?\(\s*(\d+)\s*[,\s]\s*(\d+)\s*[,\s]\s*(\d+)(?:\s*[,/]\s*([\d.]+))?\s*\)/);return e?{r:+e[1],g:+e[2],b:+e[3],a:void 0!==e[4]?+e[4]:1}:null}function b(t){let e=t;for(;e&&e!==document.documentElement.parentElement;){const t=getComputedStyle(e).backgroundColor;if(t&&"transparent"!==t&&"rgba(0, 0, 0, 0)"!==t){const e=p(t);if(e&&e.a>.1)return e}e=e.parentElement}return null}function v(t){if(t){const e=b(t);if(e){return(.299*e.r+.587*e.g+.114*e.b)/255<.4}}if("undefined"!=typeof document){const t=document.documentElement,e=(t.getAttribute("data-theme")||"").toLowerCase();if("dark"===e)return!0;if("light"===e)return!1;if(t.classList.contains("dark"))return!0;if(document.body){const t=b(document.body);if(t){return(.299*t.r+.587*t.g+.114*t.b)/255<.4}}}return"undefined"!=typeof window&&window.matchMedia("(prefers-color-scheme: dark)").matches}function x(t){if("string"!=typeof t)return t;const e=document.createElement("canvas");e.width=1,e.height=1;const o=e.getContext("2d");o.fillStyle=t,o.fillRect(0,0,1,1);const n=o.getImageData(0,0,1,1).data;return{r:n[0],g:n[1],b:n[2]}}function w(t,e,o,n,r,a,i){if("none"===a)return 1;const s=r*i;switch(a){case"wave":return.3+.7*(.6*(.5*Math.sin(t/o*Math.PI*4+3*s)+.5)+.4*(.5*Math.sin(e/n*Math.PI*3+2*s)+.5));case"pulse":{const r=o/2,a=n/2,i=Math.sqrt((t-r)**2+(e-a)**2),c=Math.sqrt(r**2+a**2);return.2+.8*(.5*Math.sin(i/c*Math.PI*6-4*s)+.5)}case"rain":return.1+.9*(.5*Math.sin(e/n*Math.PI*8-5*s+.3*t)+.5)*(.3*Math.sin(t/o*Math.PI*2+s)+.7);case"breathe":{const o=.3*Math.sin(2*s)+.7,n=.1*Math.sin(.1*(t+e)+s);return Math.max(.1,Math.min(1,o+n))}case"sparkle":{const o=43758.5453*Math.sin(127.1*t+311.7*e+43758.5453*Math.floor(8*s)),n=o-Math.floor(o);return n>.7?1:.15+.4*n}case"glitch":{const t=Math.floor(e/(.05*n)),o=43758.5453*Math.sin(43.23*t+17.89*Math.floor(6*s));if(o-Math.floor(o)>.85){const e=.5*Math.sin(30*s+t)+.5;return e<.3?0:e}return 1}case"spiral":{const r=o/2,a=n/2,i=t-r,c=e-a,l=Math.atan2(c,i),h=Math.sqrt(i*i+c*c),f=Math.sqrt(r*r+a*a);return.15+.85*(.5*Math.sin(3*l+h/f*Math.PI*8-3*s)+.5)}case"typewriter":{const r=o*n,a=e*o+t-.5*s%1*r*1.3;if(a>0)return 0;const i=Math.max(0,1+a/(.15*r));return Math.min(1,i)}case"scatter":{const r=o/2,a=n/2,i=t-r,c=e-a,l=Math.sqrt(i*i+c*c)/Math.sqrt(r*r+a*a),h=.5*Math.sin(1.5*s)+.5;return l>h?Math.max(0,1-3*(l-h)):.7+.3*Math.sin(10*l-2*s)}case"waveField":default:return 1;case"ripple":{const r=o/2,a=n/2,i=t-r,c=e-a,l=Math.sqrt(i*i+c*c),h=Math.sqrt(r*r+a*a);return.1+.9*(.5*Math.sin(l/h*Math.PI*10-5*s)+.5)*(.4+.6*(1-Math.min(1,l/(1.1*h))))}case"melt":{const o=e/n*Math.PI;return.05+(.5*Math.sin(o-1.8*s+.15*t)+.5)*(1-.6*(Math.max(0,e/n-.1)/.9))*.95}case"orbit":{const r=o/2,a=n/2,i=t-r,c=e-a,l=Math.atan2(c,i),h=Math.sqrt(i*i+c*c)/Math.sqrt(r*r+a*a);return.1+.9*(.5*Math.sin(2*l+6*h-2.5*s)+.5)}case"cellular":{const o=Math.floor(4*s),n=(t,e)=>{const n=43758.5453*Math.sin(127.1*t+311.7*e+43758.5453*o);return n-Math.floor(n)>.38?1:0},r=n(t,e),a=n(t-1,e)+n(t+1,e)+n(t,e-1)+n(t,e+1)+n(t-1,e-1)+n(t+1,e-1)+n(t-1,e+1)+n(t+1,e+1);return 1===(1===r?2===a||3===a?1:0:3===a?1:0)?1:.05}}}var y={scale:1,offsetX:0,offsetY:0,glow:0,colorBlend:0,proximity:0};function S(t,e,o,n,r,a,i,s,c="spotlight",l=.5,h="circle"){const f=t-o,d=e-n,u=.08+.35*l+.04*a;let m,g;if("box"===h){const t=Math.abs(f),e=Math.abs(d);m=Math.max(t,e),g=u}else m=Math.sqrt(f*f+d*d),g=u;if(m>=g)return y.scale=1,y.offsetX=0,y.offsetY=0,y.glow=0,y.colorBlend=0,y.proximity=0,y;const M=function(t){return t*t*(3-2*t)}(1-m/g)*r;let p=1,b=0,v=0,x=0,w=0;switch(c){case"spotlight":{p=1+M*a*1.8;const t=Math.atan2(d,f),e=M*M*a*.6;b=Math.cos(t)*e*i,v=Math.sin(t)*e*s,x=M*a*.4,w=M*M*a*.25;break}case"magnify":p=1+M*a*2.5,x=M*a*.15;break;case"repel":{p=1+M*a*.3;const t=Math.atan2(d,f),e=M*M*a*1.2;b=Math.cos(t)*e*i,v=Math.sin(t)*e*s;break}case"glow":x=M*a*.8,w=M*a*.4;break;case"colorShift":p=1+M*a*.4,x=M*a*.2,w=M*a*.7;break;case"attract":{const t=Math.atan2(d,f),e=M*M*a*1;b=-Math.cos(t)*e*i,v=-Math.sin(t)*e*s,x=M*a*.3;break}case"shatter":{const t=Math.atan2(d,f),e=.5*Math.sin(43.7*f+29.3*d),o=M*a*1.4*(.7+.3*e);b=Math.cos(t+e)*o*i,v=Math.sin(t+e)*o*s,p=Math.max(.1,1-M*a*.6),x=M*a*.25;break}case"trail":w=M*a*.9,x=M*a*.6,p=1+M*a*.15;break;case"glitchText":p=1,x=M*a*.5,w=M*a*.6}return y.scale=p,y.offsetX=b,y.offsetY=v,y.glow=x,y.colorBlend=w,y.proximity=M,y}function $(t){const e=t.match(/^#([0-9a-f]{3,8})$/i)?.[1];if(e){const t=e.length<=4?e.split("").map(t=>parseInt(t+t,16)):[parseInt(e.slice(0,2),16),parseInt(e.slice(2,4),16),parseInt(e.slice(4,6),16)];return{r:t[0],g:t[1],b:t[2]}}const o=t.match(/rgba?\(\s*(\d+)[,\s]+(\d+)[,\s]+(\d+)/i);return o?{r:+o[1],g:+o[2],b:+o[3]}:null}function E(t){return t*t*t*(t*(6*t-15)+10)}function C(t,e,o){return t+(e-t)*o}function T(t,e){let o=127*t+311*e;return o^=o>>13,(o*(o*o*15731+789221)+1376312589&2147483647)/2147483647}function A(t,e){const o=Math.floor(t),n=Math.floor(e),r=e-n,a=E(t-o),i=E(r),s=T(o,n),c=T(o+1,n),l=T(o,n+1),h=T(o+1,n+1);return C(C(s,c,a),C(l,h,a),i)}function R(t,e){return(.5*A(t,e)+.25*A(2.1*t,2.1*e)+.125*A(4.3*t,4.3*e))/.875}function I(t,e,o,n,r={x:.5,y:.5},a={}){const{fontSize:i=13,charAspect:s=.62,lineHeightRatio:c=1.4,chars:l=" .:-=+*#%@",baseColor:h=null,accentColor:f,accentThreshold:d=.52,mouseInfluence:u=.55,mouseFalloff:m=2.8,speed:g=1,vortex:M=!0,sparkles:p=!0,breathe:b=!0,lightMode:v=!1}=a,x=f??(v?"#6b8700":"#d4ff00"),w=i*s,y=i*c,S=Math.ceil(e/w),$=Math.ceil(o/y),E=r.x,C=r.y;let A=212,I=255,k=0;{const t=x.replace("#","");6===t.length&&(A=parseInt(t.slice(0,2),16),I=parseInt(t.slice(2,4),16),k=parseInt(t.slice(4,6),16))}t.clearRect(0,0,e,o),t.font=`${i}px "JetBrains Mono", monospace`,t.textBaseline="top";const F=n*g,L=b?.12*(.5*Math.sin(.22*F)+.5):0;for(let e=0;e<$;e++)for(let o=0;o<S;o++){const n=o/S,r=e/$,a=.045,i=.08*F,s=.06,c=.45*((.5*Math.sin(.08*o+.05*e+.6*F)+.5+(.5*Math.sin(.03*o-.07*e+.4*F)+.5)+(.5*Math.sin(.05*o+.03*e+.8*F)+.5))/3)+.35*(.5*R(o*a+i,e*a*1.4-.7*i)+.5)+.2*(.5*Math.sin((o+.65*e)*s+1.1*F)+.5)+L,f=n-E,g=r-C,b=Math.sqrt(f*f+g*g);let x=0;if(M&&b<.35){const t=Math.atan2(g,f),e=Math.sin(4*t+2.2*F-14*b),o=Math.max(0,1-b/.35);x=e*o*o*.22}const B=c*(1-u)+(Math.max(0,1-b*m)+.5*x)*u+.15*x,z=Math.min(1,Math.max(0,B));let P=z;if(p&&z>.72){const t=Math.floor(8*F),n=T(7*o+3*t,11*e+t);n>.88&&(P=Math.min(1,z+4*(n-.88)))}const q=Math.floor(P*(l.length-1));if(" "===l[q])continue;const H=.015+.07*P;if(P>d){const e=Math.min(v?.9:.28,H*(v?14:2.8));t.fillStyle=`rgba(${A},${I},${k},${e})`}else t.fillStyle=h?h.replace("{a}",String(H)):v?`rgba(55,55,55,${7*H})`:`rgba(255,255,255,${H})`;t.fillText(l[q],o*w,e*y)}}function k(t,e){return"auto"!==t?t:!v(e)}function F(t){const e=t.match(/^#([0-9a-fA-F]{3,6})$/);if(e){let t=e[1];if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return t}const o=t.match(/rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/);return o?[o[1],o[2],o[3]].map(t=>parseInt(t).toString(16).padStart(2,"0")).join(""):null}function L(t){const e=t||"auto";if("auto"!==e)return e.replace("#","");if("undefined"!=typeof document){const t=getComputedStyle(document.documentElement);for(const e of["--accent-color","--color-accent","--accent","--color-primary","--primary","--brand-color"]){const o=F(t.getPropertyValue(e).trim());if(o)return o}const e=F(getComputedStyle(document.body).accentColor??"");if(e)return e}return v("undefined"!=typeof document?document.body:null)?"faf9f7":"0d0d0d"}function B(t,e,o,n){const r=t instanceof HTMLVideoElement?t.videoWidth:t.width,a=t instanceof HTMLVideoElement?t.videoHeight:t.height;if(0===r||0===a)return{frame:[],cols:0,rows:0};const h=e.charAspect,d=e.fontSize*e.charSpacing,u=e.fontSize/h*e.charSpacing,m=o||r,g=n||a,M=Math.floor(m/d),p=Math.floor(g/u);if(M<=0||p<=0)return{frame:[],cols:0,rows:0};const b=Math.max(1,Math.min(Math.floor(2048/M),Math.floor(r/M))),v=Math.max(1,Math.min(Math.floor(2048/p),Math.floor(a/p))),w=M*b,y=p*v,{ctx:S}=i(w,y);S.drawImage(t,0,0,w,y);const $=S.getImageData(0,0,w,y).data,E=e.chromaKey,C=null!=E&&!1!==E,T=!0===E,A="blue-screen"===E;let R=null,I=0;!C||T||A||(R=x(E),I=(e.chromaKeyTolerance??60)**2);let F=0,L=255;if(e.normalize){let t=255,e=0;for(let o=0;o<$.length;o+=4){if(C){const t=$[o],e=$[o+1],n=$[o+2];let r=!1;if(T)r=e>1.4*t&&e>1.4*n&&e>80;else if(A)r=n>1.4*t&&n>1.4*e&&n>80;else if(null!==R){const o=t-R.r,a=e-R.g,i=n-R.b;r=o*o+a*a+i*i<=I}if(r)continue}const n=.299*$[o]+.587*$[o+1]+.114*$[o+2];n<t&&(t=n),n>e&&(e=n)}F=t,L=e>t?e-t:255}const B=[],z=k(e.invert),P=C&&e.charset.replace(/ /g,"")||e.charset,q=b*v;for(let t=0;t<p;t++){const o=[];for(let n=0;n<M;n++){let r=0,a=0,i=0,h=0,d=0;for(let e=0;e<v;e++){const o=(t*v+e)*w;for(let t=0;t<b;t++){const e=4*(o+n*b+t),s=$[e],c=$[e+1],l=$[e+2],f=$[e+3];if(C){let t=!1;if(T)t=c>1.4*s&&c>1.4*l&&c>80;else if(A)t=l>1.4*s&&l>1.4*c&&l>80;else if(null!==R){const e=s-R.r,o=c-R.g,n=l-R.b;t=e*e+o*o+n*n<=I}if(t){d++;continue}}r+=s,a+=c,i+=l,h+=f}}if(C&&d>q/2){o.push({char:" ",r:0,g:0,b:0,a:0});continue}const u=q-d,m=u>0?r/u:0,g=u>0?a/u:0,p=u>0?i/u:0,x=u>0?h/u:0,y=.299*m+.587*g+.114*p,S=f(s(e.normalize?(y-F)/L*255:y,e.brightness,e.contrast),n,t,e.ditherStrength),E=e.customText?l(S,e.customText,n,t,M,z):c(S,P,z);o.push({char:E,r:m,g:g,b:p,a:x,lum:S})}B.push(o)}return{frame:B,cols:M,rows:p}}function z(t,e,o,n){const r=t instanceof HTMLVideoElement?t.videoWidth:t.width,a=t instanceof HTMLVideoElement?t.videoHeight:t.height;if(0===r||0===a)return{rows:[],cols:0,rowCount:0};const h=e.charAspect,d=e.fontSize*e.charSpacing,u=e.fontSize/h*e.charSpacing,m=o||r,g=n||a,M=Math.floor(m/d),p=Math.floor(g/u);if(M<=0||p<=0)return{rows:[],cols:0,rowCount:0};const b=Math.max(1,Math.min(Math.floor(2048/M),Math.floor(r/M))),v=Math.max(1,Math.min(Math.floor(2048/p),Math.floor(a/p))),w=M*b,y=p*v,{ctx:S}=i(w,y);S.drawImage(t,0,0,w,y);const $=S.getImageData(0,0,w,y).data,E=e.chromaKey,C=null!=E&&!1!==E,T=!0===E,A="blue-screen"===E;let R=null,I=0;!C||T||A||(R=x(E),I=(e.chromaKeyTolerance??60)**2);let F=0,L=255;if(e.normalize){let t=255,e=0;for(let o=0;o<$.length;o+=4){if(C){const t=$[o],e=$[o+1],n=$[o+2];let r=!1;if(T)r=e>1.4*t&&e>1.4*n&&e>80;else if(A)r=n>1.4*t&&n>1.4*e&&n>80;else if(null!==R){const o=t-R.r,a=e-R.g,i=n-R.b;r=o*o+a*a+i*i<=I}if(r)continue}const n=.299*$[o]+.587*$[o+1]+.114*$[o+2];n<t&&(t=n),n>e&&(e=n)}F=t,L=e>t?e-t:255}const B=k(e.invert),z=C&&e.charset.replace(/ /g,"")||e.charset,P=b*v,q=[];for(let t=0;t<p;t++){let o="";for(let n=0;n<M;n++){let r=0,a=0,i=0,h=0;for(let e=0;e<v;e++){const o=(t*v+e)*w;for(let t=0;t<b;t++){const e=4*(o+n*b+t),s=$[e],c=$[e+1],l=$[e+2];if(C){let t=!1;if(T)t=c>1.4*s&&c>1.4*l&&c>80;else if(A)t=l>1.4*s&&l>1.4*c&&l>80;else if(null!==R){const e=s-R.r,o=c-R.g,n=l-R.b;t=e*e+o*o+n*n<=I}if(t){h++;continue}}r+=s,a+=c,i+=l}}if(C&&h>P/2){o+=" ";continue}const d=P-h,u=.299*(d>0?r/d:0)+.587*(d>0?a/d:0)+.114*(d>0?i/d:0),m=f(s(e.normalize?(u-F)/L*255:u,e.brightness,e.contrast),n,t,e.ditherStrength);o+=e.customText?l(m,e.customText,n,t,M,B):c(m,z,B)}q.push(o)}return{rows:q,cols:M,rowCount:p}}function P(t,e,o,n,r){if(0===e.rows.length)return;t.clearRect(0,0,n,r);const a=t.canvas;o.chromaKey||e.rows.some(t=>t.includes(" "))||(t.fillStyle=v(a)?"#0a0a0a":"#faf9f7",t.fillRect(0,0,n,r));const i=L(o.accentColor),s=parseInt(i.substring(0,2),16)||255,c=parseInt(i.substring(2,4),16)||255,l=parseInt(i.substring(4,6),16)||255,h=n/e.cols,f=r/e.rowCount,d=.9*Math.min(h/.55,f);t.font=`${d}px "JetBrains Mono", monospace`,t.textAlign="left",t.textBaseline="middle",t.fillStyle="matrix"===o.colorMode?"rgb(0,255,0)":`rgb(${s},${c},${l})`,t.globalAlpha=1;for(let o=0;o<e.rows.length;o++){const n=e.rows[o];0!==n.trim().length&&t.fillText(n,.5*h,o*f+.5*f)}t.globalAlpha=1}async function q(t,e,o,n,r=12,a=10,i,s=0){const c=Math.min(t.duration-s,a),l=Math.ceil(c*r),h=[];let f=0,d=0;for(let a=0;a<l;a++){const u=s+a/r;if(u>s+c)break;t.currentTime=u,await new Promise(e=>{const o=()=>{t.removeEventListener("seeked",o),e()};t.addEventListener("seeked",o)});const m=B(t,e,o,n);h.push(m.frame),f=m.cols,d=m.rows,i?.((a+1)/l)}return{frames:h,cols:f,rows:d,fps:r}}async function H(e,o,n,r,a){const i=t.parseGIF(e),s=t.decompressFrames(i,!0);if(0===s.length)return{frames:[],cols:0,rows:0,fps:10};const c=s[0].dims.width,l=s[0].dims.height,h=i.lsd?.width||c,f=i.lsd?.height||l,d=document.createElement("canvas");d.width=h,d.height=f;const u=d.getContext("2d"),m=document.createElement("canvas");m.width=h,m.height=f;const g=m.getContext("2d"),M=[];let p=0,b=0,v=0;for(const t of s)v+=t.delay||100;const x=v/s.length,w=Math.round(Math.min(30,Math.max(5,1e3/x))),y=Math.min(s.length,300);for(let t=0;t<y;t++){const e=s[t],{dims:i,patch:c,disposalType:l}=e;3===l&&(g.clearRect(0,0,h,f),g.drawImage(d,0,0));const v=new ImageData(new Uint8ClampedArray(c.buffer),i.width,i.height),x=document.createElement("canvas");x.width=i.width,x.height=i.height;x.getContext("2d").putImageData(v,0,0),u.drawImage(x,i.left||0,i.top||0);const w=B(d,o,n,r);M.push(w.frame),p=w.cols,b=w.rows,2===l?u.clearRect(i.left||0,i.top||0,i.width,i.height):3===l&&(u.clearRect(0,0,h,f),u.drawImage(m,0,0)),a?.((t+1)/y)}return{frames:M,cols:p,rows:b,fps:w}}function W(t,e,o,n,r,a=0,i){if("waveField"===o.animationStyle){return void I(t,n,r,a,i?{x:i.x,y:i.y}:{x:.5,y:.5},{accentColor:`#${o.accentColor?L(o.accentColor):"d4ff00"}`,accentThreshold:.52,mouseInfluence:o.hoverStrength>0?Math.min(1,.3+.5*o.hoverStrength):.55,mouseFalloff:2.8,speed:o.animationSpeed,vortex:o.hoverStrength>0,sparkles:!0,breathe:!0})}const s=e.length;if(0===s)return;const l=e[0].length;t.clearRect(0,0,n,r);let h=!1;const f=Math.max(1,s>>2),d=Math.max(1,l>>2);t:for(let t=0;t<s;t+=f){const o=e[t];for(let t=0;t<l;t+=d)if(o[t].a<200){h=!0;break t}}const u=t.canvas,g=v(u);h||(t.fillStyle=g?"#0a0a0a":"#faf9f7",t.fillRect(0,0,n,r));const p=n/l,b=r/s,x=s*l,y=i?.intensity??1,$=!("none"!==o.animationStyle&&x>5e3)&&!!(i&&o.hoverStrength>0&&y>.005),E=o.hoverColor||"#ffffff",C=parseInt(E.slice(1,3),16)||255,T=parseInt(E.slice(3,5),16)||255,A=parseInt(E.slice(5,7),16)||255,R=L(o.accentColor),F=parseInt(R.substring(0,2),16)||255,B=parseInt(R.substring(2,4),16)||255,z=parseInt(R.substring(4,6),16)||255,P=x>3e4?.25:x>15e3?.4:x>5e3?.6:1,q=o.hoverRadius*P;let H=0,W=l,j=0,U=s,O=0,V=0;if($&&i){O=i.x,V=i.y;const t=.08+.35*q+.04*o.hoverStrength;H=Math.max(0,Math.floor((O-t)*l)-1),W=Math.min(l,Math.ceil((O+t)*l)+1),j=Math.max(0,Math.floor((V-t)*s)-1),U=Math.min(s,Math.ceil((V+t)*s)+1)}const _=o.animationStyle,D=o.animationSpeed,Y="none"===_,N=o.hoverStrength,G=o.hoverEffect,X=q,J=o.hoverShape||"circle",K=k(o.invert,u),Q=o.colorMode,Z=2*Math.PI,tt=1/l,et=1/s;let ot="",nt=-1;if("dots"===o.renderMode){const n=.5*Math.min(p,b)*o.dotSizeRatio;for(let o=0;o<s;o++){const r=e[o];for(let e=0;e<l;e++){const i=r[e];if(i.a<10)continue;const c=.00392156863*(.299*i.r+.587*i.g+.114*i.b),h=K?1-c:c;if(h<.02)continue;const f=Y?1:w(e,o,l,s,a,_,D);let d=1,u=0,g=0,v=0,x=0;if($&&e>=H&&e<=W&&o>=j&&o<=U){const t=S(e*tt,o*et,O,V,y,N,p,b,G,X,J);d=t.scale,u=t.offsetX,g=t.offsetY,v=t.glow,x=t.colorBlend}const E=n*h*f*d;if(E<.3)continue;const R=e*p+.5*p+u,I=o*b+.5*b+g;let k;if(x>0){const t=M(i,Q,F,B,z,K);k=`rgb(${Math.min(255,t[0]+(C-t[0])*x|0)},${Math.min(255,t[1]+(T-t[1])*x|0)},${Math.min(255,t[2]+(A-t[2])*x|0)})`}else k=m(i,Q,F,B,z,K);const L=Math.min(1,.00392156863*i.a*f*(1+v));if(L!==nt&&(t.globalAlpha=L,nt=L),k!==ot&&(t.fillStyle=k,ot=k),E<=3){const e=2*E;t.fillRect(R-E,I-E,e,e)}else t.beginPath(),t.arc(R,I,E,0,Z),t.fill()}}}else{const n=.55,r=.9*Math.min(p/n,b),i=r<6;if(!i){const e="emoji"===o.artStyle;t.font=e?`${r}px "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Twemoji Mozilla", sans-serif`:`${r}px "JetBrains Mono", monospace`,t.textAlign="center",t.textBaseline="middle"}let h=null;const f=o.charsetFrames,d=!!f?.length,u=d?f[Math.floor(Math.max(0,a)*(o.charsetFps??2))%f.length]:o.charset;if(i){h={};const t=[...u],e=t.length;for(let o=0;o<e;o++)h[t[o]]=Math.max(.1,(o+.3)/e)}const g=i?null:t.getTransform();if(!i&&!$&&Y&&!d&&"accent"===Q){t.fillStyle=`rgb(${F},${B},${z})`,t.globalAlpha=1,t.textAlign="left";for(let o=0;o<s;o++){const n=e[o];let r="";for(let t=0;t<l;t++){const e=n[t];r+=e.a<10?" ":e.char}0!==r.trim().length&&t.fillText(r,.5*p,o*b+.5*b)}return void(t.globalAlpha=1)}const v="glitchText"===G&&$,x="!@#$%^&*<>{}[]|/\\~`0123456789",E=x.length;let R="",I=0,k=0,L=0,P=0,Z=0,rt=0;if(v){const t=o.hoverText??"ASCIIFY";if(k=Math.round(O*l),L=Math.round(V*s),Array.isArray(t)){const e=t.filter(t=>t.length>0);0===e.length&&e.push("ASCIIFY");R=e[((7*Math.floor(k/Math.max(1,Math.ceil(l/5)))+13*Math.floor(L/Math.max(1,Math.ceil(s/3))))%e.length+e.length)%e.length]}else R=t||"ASCIIFY";I=R.length,P=Math.max(3,Math.min(12,Math.round(s*q*.6)));const e=Math.floor(P/2);Z=Math.max(0,L-e),Z+P>s&&(Z=Math.max(0,s-P)),rt=k-Math.floor(I/2)}for(let o=0;o<s;o++){const n=e[o];for(let e=0;e<l;e++){const r=n[e];if(r.a<10)continue;let f=d&&null!=r.lum?c(r.lum,u,K):r.char;if(" "===f)continue;const q=Y?1:w(e,o,l,s,a,_,D);if(q<.05)continue;let at=1,it=0,st=0,ct=0,lt=0;if($&&!v&&e>=H&&e<=W&&o>=j&&o<=U){const t=S(e*tt,o*et,O,V,y,N,p,b,G,X,J);at=t.scale,it=t.offsetX,st=t.offsetY,ct=t.glow,lt=t.colorBlend}if(v&&o>=Z&&o<Z+P){const t=e-rt;if(t>=0&&t<I){const n=R[t],r=Math.abs(o-L)/Math.max(1,.5*P),i=Math.abs(e-k)/Math.max(1,I),s=Math.max(r,i),c=Math.max(0,Math.min(1,1-.9*s)),l=43758.5453*Math.sin(127.1*e+311.7*o+43758.5453*Math.floor(12*a));f=Math.abs(l-Math.floor(l))<c?n:x[Math.abs(Math.floor(97*l))%E],ct=.3+.7*c,lt=.3+.65*c}}const ht=e*p+.5*p+it,ft=o*b+.5*b+st;let dt;if(lt>0){const t=M(r,Q,F,B,z,K);dt=`rgb(${Math.min(255,t[0]+(C-t[0])*lt|0)},${Math.min(255,t[1]+(T-t[1])*lt|0)},${Math.min(255,t[2]+(A-t[2])*lt|0)})`}else dt=m(r,Q,F,B,z,K);if(i){const e=h[f]??.5,o=Math.min(1,.00392156863*r.a*q*(1+ct))*e;if(o<.02)continue;o!==nt&&(t.globalAlpha=o,nt=o),dt!==ot&&(t.fillStyle=dt,ot=dt);const n=p*at,a=b*at;t.fillRect(ht-.5*n,ft-.5*a,n,a)}else{const e=Math.min(1,.00392156863*r.a*q*(1+ct));e!==nt&&(t.globalAlpha=e,nt=e),dt!==ot&&(t.fillStyle=dt,ot=dt),1!==at?(t.translate(ht,ft),t.scale(at,at),t.fillText(f,0,0),t.setTransform(g)):t.fillText(f,ht,ft)}}}}t.globalAlpha=1}function j(t){return Math.max(0,Math.min(1,t))}function U(t){return"string"==typeof t?document.querySelector(t):t instanceof HTMLElement?t:null}function O(t,e,o={}){if(!Number.isFinite(t.duration)||t.duration<=0)return;const n=o.from??0,r=o.to??t.duration,a=Math.max(n,Math.min(r,t.duration)),i=j(o.ease?o.ease(j(e)):e),s=n+(a-n)*i;t.currentTime=Math.min(Math.max(n,s),Math.max(n,a-.04)),o.onUpdate?.(i,t)}function V(t){const e=t.requestVideoFrameCallback;return new Promise(e?o=>e.call(t,()=>o()):t=>requestAnimationFrame(()=>t()))}function _(t,e={}){const o=U(e.trigger)??t;t.pause();const n=e.gsap,r=e.ScrollTrigger??n?.ScrollTrigger;if(n&&r?.create){n.registerPlugin?.(r);const a=r.create({trigger:o,start:e.start??"top bottom",end:e.end??"bottom top",scrub:e.scrub??!0,onUpdate:o=>O(t,o.progress,e)});return()=>a.kill?.()}return function(t,e,o){let n=0;const r=()=>{n=0;const r=e.getBoundingClientRect(),a=window.innerHeight||document.documentElement.clientHeight,i=r.height+a,s=i>0?j((a-r.top)/i):0;O(t,s,o)},a=()=>{n||(n=requestAnimationFrame(r))};return window.addEventListener("scroll",a,{passive:!0}),window.addEventListener("resize",a),a(),()=>{window.removeEventListener("scroll",a),window.removeEventListener("resize",a),n&&cancelAnimationFrame(n)}}(t,o,e)}function D(t,e,o){const n=e.gsap,r=e.ScrollTrigger??n?.ScrollTrigger;if(n&&r?.create){n.registerPlugin?.(r);const a=r.create({trigger:t,start:e.start??"top bottom",end:e.end??"bottom top",scrub:e.scrub??!0,onUpdate:t=>o(t.progress)});return()=>a.kill?.()}return function(t,e){let o=0;const n=()=>{o=0;const n=t.getBoundingClientRect(),r=window.innerHeight||document.documentElement.clientHeight,a=n.height+r,i=a>0?j((r-n.top)/a):0;e(i)},r=()=>{o||(o=requestAnimationFrame(n))};return window.addEventListener("scroll",r,{passive:!0}),window.addEventListener("resize",r),r(),()=>{window.removeEventListener("scroll",r),window.removeEventListener("resize",r),o&&cancelAnimationFrame(o)}}(t,o)}function Y(t,e,o=2048){const n=o,r=Math.min(1,n/Math.max(t,e));return{renderW:Math.round(t*r),renderH:Math.round(e*r)}}function N(t,e,o,n,r,a=2048){const{width:i,height:s}=e.getBoundingClientRect();if(!i||!s)return{renderW:0,renderH:0,dpr:1};let c,l,h=i,f=h/o;f>s&&(f=s,h=f*o),h=Math.round(h),f=Math.round(f),n&&r?({renderW:c,renderH:l}=Y(n,r,a)):(c=h,l=f);const d="undefined"!=typeof window&&window.devicePixelRatio||1,u=8e6,m=c*d*l*d>u?Math.sqrt(u/(c*l)):d;return t.width=Math.round(c*m),t.height=Math.round(l*m),t.style.width=h+"px",t.style.height=f+"px",{renderW:c,renderH:l,dpr:m}}async function G(t,e,{fontSize:o,artStyle:r="classic",options:i={},fitTo:s,preExtract:c=!1,fps:l,maxRenderDimension:h=2048,trim:f,scroll:d,onReady:u,onFrame:m}={}){const g=f?.start??0,M=f?.end,p=o??i.fontSize??10,b={...a,...n[r],...i,fontSize:p},v=e.getContext("2d");if(!v)throw new Error("asciifyVideo: could not get 2d context from canvas.");const x="string"==typeof s?document.querySelector(s):s instanceof HTMLElement?s:null;if(c){let o;"string"==typeof t?(o=document.createElement("video"),o.crossOrigin="anonymous",o.src=t,o.readyState<2&&await new Promise((e,n)=>{o.onloadeddata=()=>e(),o.onerror=()=>n(new Error(`asciifyVideo: failed to load "${t}"`))})):o=t,x&&N(e,x,o.videoWidth/o.videoHeight,o.videoWidth,o.videoHeight,h);const{renderW:n,renderH:r}=Y(o.videoWidth,o.videoHeight,h),a="undefined"!=typeof window&&window.devicePixelRatio||1,i=8e6,s=n*a*r*a>i?Math.sqrt(i/(n*r)):a;e.width<Math.round(n*s)&&(e.width=Math.round(n*s),e.height=Math.round(r*s));const c=void 0!==M?M-g:10,f=l??(d?18:void 0),{frames:p,fps:w}=await q(o,b,n,r,f,c,void 0,g),y=t=>{const e=p[t];e&&(v.save(),v.setTransform(s,0,0,s,0,0),W(v,e,b,n,r),v.restore(),m?.())};if(d){let t=!1,n=-1;const r=!0===d?{}:d,a=D(U(r.trigger)??x??e,r,e=>{const a=j(r.ease?r.ease(j(e)):e),i=Math.max(0,Math.min(p.length-1,Math.round(a*(p.length-1))));i!==n&&(n=i,y(i),t||(t=!0,u?.(o)),r.onUpdate?.(a,o))});return y(0),t=!0,u?.(o),a}let S,$=!1,E=0,C=performance.now(),T=!0;const A=1e3/w,R=t=>{$||(t-C>=A&&(y(E),E=(E+1)%p.length,C=t,T&&(T=!1,u?.(o))),S=requestAnimationFrame(R))};return S=requestAnimationFrame(R),()=>{$=!0,cancelAnimationFrame(S)}}let w,y=!1;"string"==typeof t?(w=document.createElement("video"),w.src=t,w.muted=!0,w.loop=!0,w.playsInline=!0,w.setAttribute("playsinline",""),Object.assign(w.style,{position:"fixed",top:"0",left:"0",width:"1px",height:"1px",opacity:"0",pointerEvents:"none",zIndex:"-1"}),document.body.appendChild(w),y=!0,await new Promise((e,o)=>{w.onloadedmetadata=()=>e(),w.onerror=()=>o(new Error(`asciifyVideo: failed to load "${t}"`))}),await w.play().catch(()=>{})):(w=t,w.readyState<HTMLMediaElement.HAVE_METADATA&&await new Promise((t,e)=>{const o=()=>{w.removeEventListener("loadedmetadata",n),w.removeEventListener("error",r)},n=()=>{o(),t()},r=()=>{o(),e(new Error("asciifyVideo: provided video element failed to load metadata."))};w.addEventListener("loadedmetadata",n),w.addEventListener("error",r),w.load()}),w.paused&&await w.play().catch(()=>{})),g>0&&(w.currentTime=g,await new Promise(t=>{const e=()=>{w.removeEventListener("seeked",e),t()};w.addEventListener("seeked",e)}));let S=null;(g>0||void 0!==M)&&(S=()=>{(void 0!==M&&w.currentTime>=M||g>0&&w.currentTime<g)&&(w.currentTime=g)},w.addEventListener("timeupdate",S));let $=null;const{renderW:E,renderH:C}=Y(w.videoWidth,w.videoHeight,h);if(x){const t=w.videoWidth/w.videoHeight,o=w.videoWidth,n=w.videoHeight,r=N(e,x,t,o,n,h),a=e.getContext("2d");a&&a.setTransform(r.dpr,0,0,r.dpr,0,0),$=new ResizeObserver(()=>{const r=N(e,x,t,o,n,h),a=e.getContext("2d");a&&a.setTransform(r.dpr,0,0,r.dpr,0,0)}),$.observe(x)}else{const t="undefined"!=typeof window&&window.devicePixelRatio||1,o=8e6,n=E*t*C*t>o?Math.sqrt(o/(E*C)):t;e.width<Math.round(E*n)&&(e.width=Math.round(E*n),e.height=Math.round(C*n)),v.setTransform(n,0,0,n,0,0)}let T,A=!1,R=!0,I=null;const k=d&&!c,F=l&&l>0?1e3/l:0;let L=0,H=-1;if(k&&"ascii"===b.renderMode&&("accent"===b.colorMode||"matrix"===b.colorMode)&&"none"===b.animationStyle&&b.hoverStrength<=0&&!b.charsetFrames?.length){const t=!0===d?{}:d,o=U(t.trigger)??x??e,n=t.from??g,r=t.to??M??w.duration,a=Math.max(n,Math.min(r,w.duration)),i=Math.max(.001,a-n),s=Math.min(60,Math.max(12,l??30)),c=Math.max(2,Math.ceil(i*s)+1),h=new Array(c);let f=0,p=0,T=-1,A=0,R=!1,k=!1,F=!1;const L=new Set;w.pause();const B=t=>n+i*t/Math.max(1,c-1),q=t=>Math.max(0,Math.min(c-1,Math.round(t*(c-1)))),H=z(w,b,E,C);H.rows.length>0&&(h[0]=H,P(v,H,b,E,C),F=!0,u?.(w),m?.());const W=t=>{if(h[t])return t;for(let e=1;e<c;e++){const o=t-e,n=t+e;if(o>=0&&h[o])return o;if(n<c&&h[n])return n}return-1},O=()=>{if(!h[f])return f;for(const t of L)if(!h[t])return t;for(let t=1;t<c;t++){const e=f-t,o=f+t;if(e>=0&&!h[e])return e;if(o<c&&!h[o])return o}return-1},_=t=>{t<0||t>=c||h[t]||(L.add(t),Y())},Y=async()=>{if(R||k)return;const t=O();if(!(t<0)){L.delete(t),k=!0;try{if(await function(t,e){return Math.abs(t.currentTime-e)<1/240?V(t):new Promise(o=>{const n=()=>{t.removeEventListener("seeked",n),o()};t.addEventListener("seeked",n,{once:!0}),t.currentTime=e})}(w,B(t)),await V(w),!R){const e=z(w,b,E,C);e.rows.length>0&&(h[t]=e)}}finally{k=!1,R||requestAnimationFrame(()=>{Y()})}}},N=()=>{if(R)return;const t=W(f);if(t>=0&&t!==T){const e=h[t];e&&(P(v,e,b,E,C),T=t,F||(F=!0,u?.(w)),m?.())}_(f),A=requestAnimationFrame(N)};return I=D(o,t,e=>{const o=function(t,e,o={}){if(!Number.isFinite(t.duration)||t.duration<=0)return null;const n=o.from??0,r=o.to??t.duration,a=Math.max(n,Math.min(r,t.duration)),i=j(o.ease?o.ease(j(e)):e),s=n+(a-n)*i;return{progress:i,time:Math.min(Math.max(n,s),Math.max(n,a-.04))}}(w,e,{...t,from:n,to:a});p=o?.progress??j(e),f=q(p),_(f),_(f-1),_(f+1),t.onUpdate?.(p,w)}),_(0),_(1),A=requestAnimationFrame(N),()=>{R=!0,cancelAnimationFrame(A),I?.(),$?.disconnect(),S&&w.removeEventListener("timeupdate",S),y&&(w.pause(),w.src="",document.body.removeChild(w))}}if(k){const t=!0===d?{}:d;I=_(w,{...t,trigger:t.trigger??x??e,from:t.from??g,to:t.to??M})}const O=t=>{if(A)return;if(T=requestAnimationFrame(O),w.readyState<2||0===e.width||0===e.height)return;if(F>0&&t-L<F)return;if(g>0&&w.currentTime<g)return;if(void 0!==M&&w.currentTime>=M)return;if(k&&Math.abs(w.currentTime-H)<1/240)return;const{frame:o}=B(w,b,E,C);o.length>0&&(W(v,o,b,E,C,0,null),L=t,H=w.currentTime,R&&(R=!1,u?.(w)),m?.())};return T=requestAnimationFrame(O),()=>{A=!0,cancelAnimationFrame(T),I?.(),$?.disconnect(),S&&w.removeEventListener("timeupdate",S),y&&(w.pause(),w.src="",document.body.removeChild(w))}}function X(t,e,o,n,r={}){const{fontSize:a=13,chars:i="0123456789ABCDEF@#$&*+=/<>",accentColor:s,color:c,speed:l=1,density:h=.55,tailLength:f=14,lightMode:d=!1}=r,u=s??(d?"#6b8700":"#d4ff00"),m=.62*a,g=1.4*a,M=Math.ceil(e/m),p=Math.ceil(o/g);t.clearRect(0,0,e,o),t.font=`${a}px monospace`,t.textBaseline="top";let b=255,v=255,x=255;if(d&&(b=55,v=55,x=55),c){const t=$(c);t&&(b=t.r,v=t.g,x=t.b)}let w=212,y=255,S=0;const E=$(u);E&&(w=E.r,y=E.g,S=E.b);const C=p+f;for(let e=0;e<M;e++){if(T(17*e,3)>h)continue;const o=(.5+1.5*T(31*e,7))*l,r=T(13*e,11)*C,a=Math.floor((n*o*7+r)%C),s=e*m;for(let o=0;o<=f;o++){const r=a-(f-o);if(r<0||r>=p)continue;const c=r*g,l=T(53*e+Math.floor(5*n+o),7*r),h=i[Math.floor(l*i.length)],u=o/f;if(o===f)t.fillStyle=`rgba(${w},${y},${S},${d?.7:.85})`;else{const e=d?.85*u:.15*u;t.fillStyle=`rgba(${b},${v},${x},${e})`}t.fillText(h,s,c)}}}function J(t,e,o,n,r={x:.5,y:.5},a={}){const{fontSize:i=14,chars:s=" . · * + ° ★",accentColor:c,color:l,speed:h=1,count:f=180,lightMode:d=!1}=a,u=c??(d?"#6b8700":"#d4ff00");t.clearRect(0,0,e,o),t.textBaseline="middle",t.textAlign="center";const m=e*(.2+.6*r.x),g=o*(.2+.6*r.y),M=.65*Math.sqrt(e*e+o*o);let p=255,b=255,v=255;if(d&&(p=55,b=55,v=55),l){const t=$(l);t&&(p=t.r,b=t.g,v=t.b)}let x=212,w=255,y=0;const S=$(u);S&&(x=S.r,w=S.g,y=S.b);const E=s.replace(/ /g,"").split("");if(0!==E.length){for(let r=0;r<f;r++){const a=T(17*r,3)*Math.PI*2,s=(n*(.15+.85*T(31*r,7))*h*.22+T(13*r,11))%1,c=m+Math.cos(a)*s*M,l=g+Math.sin(a)*s*M;if(c<-20||c>e+20||l<-20||l>o+20)continue;const f=Math.max(6,i*(.4+.9*s));t.font=`${f}px monospace`;const u=E[Math.min(E.length-1,Math.floor(s*E.length))],S=s>.72,$=d?.85*s:.2*s;t.fillStyle=S?`rgba(${x},${w},${y},${Math.min(d?.92:.32,2.2*$)})`:`rgba(${p},${b},${v},${$})`,t.fillText(u,c,l)}t.textAlign="left"}}function K(t,e,o,n,r={x:.5,y:.5},a={}){const{fontSize:i=14,chars:s=". · ○ ◎ ●",accentColor:c,color:l,rings:h=5,speed:f=1,sharpness:d=4,lightMode:u=!1}=a,m=c??(u?"#007a5e":"#00ffcc");t.clearRect(0,0,e,o),t.textBaseline="middle",t.textAlign="center";const g=e*r.x,M=o*r.y,p=1.6*Math.sqrt(g*g+M*M)+.2*Math.sqrt(e*e+o*o);let b=255,v=255,x=255;if(u&&(b=55,v=55,x=55),l){const t=$(l);t&&(b=t.r,v=t.g,x=t.b)}let w=0,y=255,S=204;const E=$(m);E&&(w=E.r,y=E.g,S=E.b);const C=s.replace(/ /g,"").split("");if(0===C.length)return;const T=Math.ceil(e/i),A=Math.ceil(o/i);for(let e=0;e<A;e++)for(let o=0;o<T;o++){const r=o*i+.5*i,a=e*i+.5*i,s=r-g,c=a-M,l=Math.sqrt(s*s+c*c)/p;let m=0;for(let t=0;t<h;t++){const e=(n*f*.38+t/h)%1,o=Math.abs(l-e),r=Math.max(0,1-o*p/(i*(12-d)));m+=Math.cos(r*Math.PI*.5)*r}if(m=Math.min(1,m),m<.02)continue;const $=m>.6;t.font=`${i}px monospace`;const E=Math.floor(m*(C.length-1)),T=C[Math.min(E,C.length-1)],A=u?.88*m:.22*m;t.fillStyle=$?`rgba(${w},${y},${S},${Math.min(u?.95:.4,.55*m)})`:`rgba(${b},${v},${x},${A})`,t.fillText(T,r,a)}t.textAlign="left"}function Q(t,e,o,n,r={x:.5,y:.5},a={}){const{fontSize:i=14,chars:s=" .·:;=+*#%@░▒▓",accentColor:c,color:l,octaves:h=4,speed:f=1,scale:d=1,accentThreshold:u=.78,mouseWarp:m=.3,lightMode:g=!1}=a,M=c??(g?"#6b8700":"#d4ff00"),p=.62*i,b=1.4*i,v=Math.ceil(e/p),x=Math.ceil(o/b);t.clearRect(0,0,e,o),t.font=`${i}px monospace`,t.textBaseline="top";let w=255,y=255,S=255;if(g&&(w=55,y=55,S=55),l){const t=$(l);t&&(w=t.r,y=t.g,S=t.b)}let E=212,C=255,T=0;const R=$(M);R&&(E=R.r,C=R.g,T=R.b);const I=.035*d,k=n*f,F=Math.min(6,Math.max(1,h)),L=(t,e)=>{let o=0,n=.5,r=1,a=0;for(let i=0;i<F;i++)o+=A(t*r,e*r)*n,a+=n,n*=.5,r*=2.1;return o/a};for(let e=0;e<x;e++)for(let o=0;o<v;o++){const n=o*I+.06*k,a=e*I*1.3-.04*k,i=o/v-r.x,c=e/x-r.y,l=Math.sqrt(i*i+c*c),h=m>0?.12*Math.max(0,1-l/m):0,f=.5*L(n+h*Math.sin(1.3*k+8*c),a+h*Math.cos(.9*k+8*i))+.5;if(f<.12)continue;const d=s[Math.floor(f*(s.length-1))];if(" "===d)continue;const M=f>u,$=g?.82*f:.13*f;t.fillStyle=M?`rgba(${E},${C},${T},${g?.92:.28})`:`rgba(${w},${y},${S},${$})`,t.fillText(d,o*p,e*b)}}function Z(t,e,o,n,r={x:.5,y:.5},a={}){const{fontSize:i=12,chars:s="·-=+|/",accentColor:c,color:l,bands:h=3,speed:f=1,bandWidth:d=.12,glitch:u=!0,lightMode:m=!1}=a,g=c??(m?"#6b8700":"#d4ff00"),M=.62*i,p=1.4*i,b=Math.ceil(e/M),v=Math.ceil(o/p);t.clearRect(0,0,e,o),t.font=`${i}px monospace`,t.textBaseline="top";let x=255,w=255,y=255;if(m&&(x=55,w=55,y=55),l){const t=$(l);t&&(x=t.r,w=t.g,y=t.b)}let S=212,E=255,C=0;const A=$(g);A&&(S=A.r,E=A.g,C=A.b);const R=n*f;for(let e=0;e<v;e++)for(let o=0;o<b;o++){const n=e/v,a=((n*h-.5*R)%1+1)%1,i=Math.max(0,1-a/d),c=.35*(.5*T(3*o,7*e)+.5);let l=0;if(u){const t=o/b-r.x,a=n-r.y,i=Math.sqrt(t*t+a*a);if(i<.18){const t=T(11*o+Math.floor(12*R),5*e);l=Math.max(0,1-i/.18)*(t>.5?t-.3:0)}}const f=Math.min(1,c+.8*i+.6*l);if(f<.04)continue;const g=s[Math.floor(f*(s.length-1))],$=i>.55,A=m?.82*f:.12*f;t.fillStyle=$?`rgba(${S},${E},${C},${m?.92:.28})`:`rgba(${x},${w},${y},${A})`,t.fillText(g,o*M,e*p)}}function tt(t,e,o,n,r={x:.5,y:.5},a={}){const{fontSize:i=14,chars:s=" ·∙•:;+=≡≣#@",color:c,accentColor:l,speed:h=1,layers:f=5,softness:d=1.2,mouseRipple:u=.2,lightMode:m=!1}=a,g=l??(m?"#6b8700":"#d4ff00"),M=.62*i,p=1.4*i,b=Math.ceil(e/M),v=Math.ceil(o/p);t.clearRect(0,0,e,o),t.font=`${i}px monospace`,t.textBaseline="top";let x=255,w=255,y=255;if(m&&(x=55,w=55,y=55),c){const t=$(c);t&&(x=t.r,w=t.g,y=t.b)}let S=212,E=255,C=0;const A=$(g);A&&(S=A.r,E=A.g,C=A.b);const R=n*h,I=[];for(let t=0;t<f;t++){const e=T(17*t,31*t+7),o=T(23*t+5,11*t);I.push({fx:.8+2.2*e,fy:1.2+1.8*o,phase:e*Math.PI*4,dt:(.3+.5*T(7*t,13*t+3))*(t%2==0?1:-1),amp:.55+.45*T(29*t,3*t)})}for(let e=0;e<v;e++){const o=e/v;for(let n=0;n<b;n++){const a=n/b,i=a-r.x,c=o-r.y,l=Math.sqrt(i*i+c*c),h=u*Math.exp(-l*l/.06),g=a+i*h,v=o+c*h;let $=0,T=0;for(let t=0;t<f;t++){const{fx:e,fy:o,phase:n,dt:r,amp:a}=I[t];$+=Math.sin(g*e*Math.PI*2+R*r+n)*Math.cos(v*o*Math.PI*2+R*r*.7+1.3*n)*a,T+=a}const A=$/T,k=.5+.5*Math.tanh(A*d*2.2);if(k<.12)continue;const F=(k-.12)/.88,L=s[Math.min(s.length-1,Math.floor(F*s.length))],B=k>.82,z=m?.82*k:.14*k;t.fillStyle=B?`rgba(${S},${E},${C},${m?.92:.32})`:`rgba(${x},${w},${y},${z})`,t.fillText(L,n*M,e*p)}}}function et(t,e,o,n,r={}){const{fontSize:a=13,color:i,accentColor:s,speed:c=.4,layers:l=4,turbulence:h=.8,lightMode:f=!1}=r,d=s??(f?"#6b8700":"#d4ff00"),u=.62*a,m=1.4*a,g=Math.ceil(e/u),M=Math.ceil(o/m);t.clearRect(0,0,e,o),t.font=`${a}px monospace`,t.textBaseline="top";let p=255,b=255,v=255;if(f&&(p=55,b=55,v=55),i){const t=$(i);t&&(p=t.r,b=t.g,v=t.b)}let x=212,w=255,y=0;const S=$(d);S&&(x=S.r,w=S.g,y=S.b);const E=n*c,C=["─","─","╌","·","╌","─","─","╌","·"];for(let e=0;e<M;e++){const o=e/M;for(let n=0;n<g;n++){const r=n/g;let a=0,i=0;for(let t=0;t<l;t++){const e=T(13*t,7*t+3),n=1.1+2.4*e,s=.9+2*T(29*t,11*t+1),c=e*Math.PI*6,l=(.2+.5*T(41*t,17*t))*(t%2==0?1:-1.3),f=Math.sin(r*n*Math.PI*2+E*l+c),d=Math.cos(o*s*Math.PI*2+E*l*.6+1.7*c),u=Math.sin(r*s*Math.PI*h+o*n*Math.PI*h+E*l*.4);a+=Math.atan2(d+.3*u,f),i+=.5*(f*d+1)}const s=a/l,c=Math.min(1,i/l);if(c<.1)continue;const d=(s+Math.PI)/(2*Math.PI),M=C[Math.floor(d*C.length)%C.length],S=c>.8,$=f?.8*c:.13*c;t.fillStyle=S?`rgba(${x},${w},${y},${f?.9:.26})`:`rgba(${p},${b},${v},${$})`,t.fillText(M,n*u,e*m)}}}function ot(t,e,o,n,r={x:.5,y:.5},a={}){const{fontSize:i=13,chars:s=" ·:;=+*#%@",color:c,accentColor:l,speed:h=1,radius:f=.38,swirl:d=3,lightMode:u=!1}=a,m=l??(u?"#6b8700":"#d4ff00"),g=.62*i,M=1.4*i,p=Math.ceil(e/g),b=Math.ceil(o/M),v=e/o;t.clearRect(0,0,e,o),t.font=`${i}px monospace`,t.textBaseline="top";let x=255,w=255,y=255;if(u&&(x=55,w=55,y=55),c){const t=$(c);t&&(x=t.r,w=t.g,y=t.b)}let S=212,E=255,C=0;const A=$(m);A&&(S=A.r,E=A.g,C=A.b);const R=n*h;for(let e=0;e<b;e++){const o=e/b;for(let n=0;n<p;n++){const a=(n/p-r.x)*v,i=o-r.y,c=Math.sqrt(a*a+i*i)/f;if(c>1){const o=T(3*n,7*e)*Math.max(0,1-3*(c-1));if(o<.62)continue;const r=o*(u?.28:.04);t.fillStyle=`rgba(${x},${w},${y},${r})`,t.fillText(s[1],n*g,e*M);continue}const l=Math.max(0,1-Math.abs(c-(.15+.12*Math.sin(1.1*R)))/.07),h=Math.pow(1-c,2.2),d=Math.min(1,h+.6*l);if(d<.06)continue;const m=Math.floor(d*(s.length-1)),b=s[Math.min(s.length-1,m)],$=l>.35||c<.08,A=u?.85*d:.18*d;t.fillStyle=$?`rgba(${S},${E},${C},${u?.95:.38})`:`rgba(${x},${w},${y},${A})`,t.fillText(b,n*g,e*M)}}}function nt(t,e,o,n,r={}){const{fontSize:a=14,chars:i=" ·∙•:-=+*#",color:s,accentColor:c,speed:l=.5,harmonics:h=3,lightMode:f=!1}=r,d=c??(f?"#6b8700":"#d4ff00"),u=.62*a,m=1.4*a,g=Math.ceil(e/u),M=Math.ceil(o/m);t.clearRect(0,0,e,o),t.font=`${a}px monospace`,t.textBaseline="top";let p=255,b=255,v=255;if(f&&(p=55,b=55,v=55),s){const t=$(s);t&&(p=t.r,b=t.g,v=t.b)}let x=212,w=255,y=0;const S=$(d);S&&(x=S.r,w=S.g,y=S.b);const E=n*l,C=Array.from({length:h},(t,e)=>1/(e+1)).reduce((t,e)=>t+e,0);for(let e=0;e<M;e++)for(let o=0;o<g;o++){let n=0;for(let t=0;t<h;t++){const r=.18+1.4*T(o*(t+3)+7,e*(t+5)+11),a=T(o*(t+7),e*(t+9)+3)*Math.PI*2,i=1/(t+1);n+=Math.sin(E*r+a)*i}const r=.5*(n/C+1);if(r<.28)continue;const a=(r-.28)/.72,s=i[Math.min(i.length-1,Math.floor(a*i.length))],c=r>.88,l=f?.82*a:.13*a;t.fillStyle=c?`rgba(${x},${w},${y},${f?.92:.28})`:`rgba(${p},${b},${v},${l})`,t.fillText(s,o*u,e*m)}}function rt(t,e,o,n,r={}){const{fontSize:a=13,chars:i=" .,:;i+xX#&@",color:s="#ff4500",hotColor:c="#ffe066",intensity:l=.85,wind:h=0,speed:f=1,lightMode:d=!1}=r,u=.62*a,m=1.4*a,g=Math.ceil(e/u),M=Math.ceil(o/m),p=g*M,b="__fire_heat__",v=t.canvas;let x=v[b];x&&x.length===p||(x=new Float32Array(p),v[b]=x);const w=.18*(.016*f),y=h*f*.8,S=M-1,E=n*f;for(let t=0;t<g;t++){const e=(.6*(.5*Math.sin(.31*t+4.1*E)+.5)+.4*(.5*Math.sin(.73*t-2.7*E)+.5))*l;x[S*g+t]=Math.min(1,e+.15*Math.random()*l),S>0&&(x[(S-1)*g+t]=Math.min(1,.85*e+.1*Math.random()*l))}const C=new Float32Array(p);for(let t=0;t<M-2;t++)for(let e=0;e<g;e++){const o=.4*x[(t+1)*g+e]+.25*x[(t+2)*g+Math.max(0,Math.min(g-1,e+Math.round(y)))]+.175*x[(t+1)*g+Math.max(0,e-1)]+.175*x[(t+1)*g+Math.min(g-1,e+1)];C[t*g+e]=Math.max(0,o-w-.02*Math.random()*f)}for(let t=0;t<g;t++)C[(M-1)*g+t]=x[(M-1)*g+t],M>1&&(C[(M-2)*g+t]=x[(M-2)*g+t]);v[b]=C;const T=$(s)??{r:255,g:69,b:0},A=$(c)??{r:255,g:224,b:102};t.clearRect(0,0,e,o),t.font=`${a}px "JetBrains Mono", monospace`,t.textBaseline="top";for(let e=0;e<M;e++)for(let o=0;o<g;o++){const n=C[e*g+o];if(n<.03)continue;const r=i[Math.min(i.length-1,Math.floor(n*i.length))];if(" "===r)continue;const a=Math.min(1,1.2*n),s=T.r+(A.r-T.r)*a|0,c=T.g+(A.g-T.g)*a|0,l=T.b+(A.b-T.b)*a|0,h=d?1-.3*n:Math.min(1,n+.15);t.globalAlpha=h,t.fillStyle=`rgb(${s},${c},${l})`,t.fillText(r,o*u,e*m)}t.globalAlpha=1}function at(t,e,o,n,r={}){const{fontSize:a=13,baseChars:i="ATCG",bridgeChars:s="-=≡",color:c="#00e5ff",color2:l="#ff4081",bridgeColor:h="#88ffcc",speed:f=1,helixCount:d,lightMode:u=!1}=r,m=.62*a,g=1.4*a,M=Math.ceil(e/m),p=Math.ceil(o/g),b=d??Math.max(1,Math.floor(e/80)),v=M/b,x=$(c)??{r:0,g:229,b:255},w=$(l)??{r:255,g:64,b:129},y=$(h)??{r:136,g:255,b:204};t.clearRect(0,0,e,o),t.font=`${a}px "JetBrains Mono", monospace`,t.textBaseline="top";const S=n*f,E=.35*v;for(let e=0;e<b;e++){const o=v*(e+.5);for(let n=0;n<p;n++){const r=n/p*Math.PI*6-1.8*S,a=o+Math.sin(r)*E,c=o+Math.sin(r+Math.PI)*E,l=Math.round(a),h=Math.round(c);if(l<0||l>=M)continue;const f=T(31*e+7*n,3),d=i[Math.floor(f*i.length)],u=.5*(Math.sin(r)+1),b=.5*(Math.sin(r+Math.PI)+1);if(t.globalAlpha=.35+.65*u,t.fillStyle=`rgb(${x.r},${x.g},${x.b})`,t.fillText(d,l*m,n*g),h>=0&&h<M){const o=T(53*e+11*n,7),r=i[Math.floor(o*i.length)];t.globalAlpha=.35+.65*b,t.fillStyle=`rgb(${w.r},${w.g},${w.b})`,t.fillText(r,h*m,n*g)}if(n%3===0){const o=Math.min(l,h),r=Math.max(l,h);if(r-o>1){const a=T(17*n+43*e,5),i=s[Math.floor(a*s.length)],c=.25*(u+b)+.2;t.globalAlpha=c,t.fillStyle=`rgb(${y.r},${y.g},${y.b})`;for(let e=o+1;e<r;e++)t.fillText(i,e*m,n*g)}}}}t.globalAlpha=1}function it(t,e,o,n,r={}){const{fontSize:a=13,chars:i=" .,:;+*#@",color:s="#4caf50",skyColor:c="#1a237e",peakColor:l="#e0e0e0",speed:h=1,roughness:f=.55,heightScale:d=.55,stars:u=!0,lightMode:m=!1}=r,g=.62*a,M=1.4*a,p=Math.ceil(e/g),b=Math.ceil(o/M),v=$(s)??{r:76,g:175,b:80},x=$(c)??{r:26,g:35,b:126},w=$(l)??{r:224,g:224,b:224};t.clearRect(0,0,e,o),t.font=`${a}px "JetBrains Mono", monospace`,t.textBaseline="top";const y=n*h*.4,S=new Array(p);for(let t=0;t<p;t++){const e=(.5*R((t/p+y)*f*3,.5)+.5)*d;S[t]=Math.floor(e*b)}for(let e=0;e<b;e++)for(let o=0;o<p;o++){const r=b-1-S[o],a=e===r;if(!(e>=r)){if(u){const r=T(7*o+Math.floor(.3*y),13*e);if(r>.97){const a=.3*Math.sin(2*n+100*r)+.7;t.globalAlpha=.5*a,t.fillStyle=`rgb(${x.r+60},${x.g+60},${x.b+80})`,t.fillText("·",o*g,e*M)}}continue}const s=(e-r)/Math.max(1,S[o]),c=i[Math.min(i.length-1,Math.floor(s*i.length))];if(" "===c&&!a)continue;const l=a?1:Math.max(0,1-4*s),h=v.r+(w.r-v.r)*l|0,f=v.g+(w.g-v.g)*l|0,d=v.b+(w.b-v.b)*l|0;t.globalAlpha=.5+.5*s,t.fillStyle=`rgb(${h},${f},${d})`,t.fillText(a?i[i.length-1]:c,o*g,e*M)}t.globalAlpha=1}var st=1,ct=2,lt=4,ht=8,ft={3:"─",12:"│",9:"┌",10:"┐",5:"└",6:"┘",11:"┬",7:"┴",13:"├",14:"┤",15:"┼",[st]:"╶",[ct]:"╴",[lt]:"╵",[ht]:"╷"};function dt(t,e,o,n,r={}){const{fontSize:a=13,pulseColor:i="#ffffff",color:s="#00ff88",density:c=.38,speed:l=1,lightMode:h=!1}=r,f=.62*a,d=1.4*a,u=Math.ceil(e/f),m=Math.ceil(o/d),g=$(s)??{r:0,g:255,b:136},M=$(i)??{r:255,g:255,b:255},p=(t,e)=>{if(T(17*t+1,7*e+2)>c)return 0;let o=0;return t+1<u&&T(17*t+1,7*e+2)>.15&&(o|=1),t-1>=0&&T(17*(t-1)+1,7*e+2)>.15&&(o|=2),e+1<m&&T(17*t+1,7*(e+1)+2)>.15&&(o|=8),e-1>=0&&T(17*t+1,7*(e-1)+2)>.15&&(o|=4),o};t.clearRect(0,0,e,o),t.font=`${a}px "JetBrains Mono", monospace`,t.textBaseline="top";const b=n*l;for(let e=0;e<m;e++)for(let o=0;o<u;o++){const n=p(o,e);if(0===n)continue;const r=ft[n]??"·",a=(8*b+40*T(o,23*e))%u,i=(6*b+40*T(17*e,11*o))%m,s=(1&n||2&n)&&Math.abs(o-a)<1.5,c=(4&n||8&n)&&Math.abs(e-i)<1.5,l=s||c,h=.25+.35*T(3*o,5*e);l?(t.globalAlpha=.95,t.fillStyle=`rgb(${M.r},${M.g},${M.b})`):(t.globalAlpha=h,t.fillStyle=`rgb(${g.r},${g.g},${g.b})`),t.fillText(r,o*f,e*d)}t.globalAlpha=1}function ut(t,e={}){const{type:o="wave",opacity:n=.2,className:r,zIndex:a=0,colorScheme:i="auto",color:s,...c}=e,l="string"==typeof t?document.querySelector(t):t;if(!l)return console.warn("[asciify] asciiBackground: target not found",t),{destroy:()=>{}};const h=l.style.position;"static"===getComputedStyle(l).position&&(l.style.position="relative");const f=document.createElement("canvas");f.style.cssText=["position:absolute","inset:0","width:100%","height:100%",`opacity:${n}`,"pointer-events:none",`z-index:${a}`].join(";"),r&&(f.className=r),l.prepend(f);const d=f.getContext("2d"),u=window.devicePixelRatio||1,m={x:.5,y:.5},g={x:.5,y:.5},M=()=>"light"===i||"dark"!==i&&(()=>{let t=l;for(;t&&t!==document.documentElement.parentElement;){const e=getComputedStyle(t).backgroundColor;if(e&&"transparent"!==e&&"rgba(0, 0, 0, 0)"!==e){const t=e.match(/rgba?\(\s*(\d+)\s*[,\s]\s*(\d+)\s*[,\s]\s*(\d+)/);if(t)return(.299*+t[1]+.587*+t[2]+.114*+t[3])/255>=.4}t=t.parentElement}const e=document.documentElement,o=(e.getAttribute("data-theme")||"").toLowerCase();return"dark"!==o&&("light"===o||!e.classList.contains("dark")&&window.matchMedia("(prefers-color-scheme: light)").matches)})(),p=s?function(t){const e=t.match(/^#([0-9a-f]{3,8})$/i)?.[1];if(e){const t=e.length<=4?e.split("").map(t=>parseInt(t+t,16)):[parseInt(e.slice(0,2),16),parseInt(e.slice(2,4),16),parseInt(e.slice(4,6),16)];return{r:t[0],g:t[1],b:t[2]}}const o=t.match(/rgba?\(\s*(\d+)[,\s]+(\d+)[,\s]+(\d+)/i);return o?{r:+o[1],g:+o[2],b:+o[3]}:null}(s):null,b=()=>({...c,lightMode:void 0!==c.lightMode?c.lightMode:M(),baseColor:p?`rgba(${p.r},${p.g},${p.b},{a})`:c.baseColor}),v={current:b()},x=()=>{v.current="rain"===o||"stars"===o||"pulse"===o||"noise"===o||"grid"===o||"aurora"===o||"silk"===o||"void"===o||"morph"===o?{...c,lightMode:void 0!==c.lightMode?c.lightMode:M(),color:s??c.color}:"fire"===o||"dna"===o?{...c,color:s??c.color}:"terrain"===o||"circuit"===o?{...c,color:s??c.color,lightMode:void 0!==c.lightMode?c.lightMode:M()}:b()};x();const w=window.matchMedia("(prefers-color-scheme: light)"),y=()=>{x()};let S=null;"auto"===i&&(w.addEventListener("change",y),S=new MutationObserver(y),S.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme","class"]}));const $=()=>{const t=l.getBoundingClientRect();f.width=t.width*u,f.height=t.height*u,d.setTransform(u,0,0,u,0,0)};$();const E=t=>{const e=l.getBoundingClientRect();m.x=(t.clientX-e.left)/e.width,m.y=(t.clientY-e.top)/e.height},C=new ResizeObserver($);C.observe(l),window.addEventListener("mousemove",E);let T=0,A=0;const R=()=>{g.x+=.07*(m.x-g.x),g.y+=.07*(m.y-g.y);const t=l.getBoundingClientRect();"rain"===o?X(d,t.width,t.height,T,v.current):"stars"===o?J(d,t.width,t.height,T,g,v.current):"pulse"===o?K(d,t.width,t.height,T,g,v.current):"noise"===o?Q(d,t.width,t.height,T,g,v.current):"grid"===o?Z(d,t.width,t.height,T,g,v.current):"aurora"===o?tt(d,t.width,t.height,T,g,v.current):"silk"===o?et(d,t.width,t.height,T,v.current):"void"===o?ot(d,t.width,t.height,T,g,v.current):"morph"===o?nt(d,t.width,t.height,T,v.current):"fire"===o?rt(d,t.width,t.height,T,v.current):"dna"===o?at(d,t.width,t.height,T,v.current):"terrain"===o?it(d,t.width,t.height,T,v.current):"circuit"===o?dt(d,t.width,t.height,T,v.current):I(d,t.width,t.height,T,g,v.current),T+=.016,A=requestAnimationFrame(R)};return A=requestAnimationFrame(R),{destroy:()=>{cancelAnimationFrame(A),C.disconnect(),"auto"===i&&(w.removeEventListener("change",y),S?.disconnect()),window.removeEventListener("mousemove",E),f.remove(),l.style.position=h}}}var mt=ut;function gt(t,e,o,n="#505050",r=100){if(!t||e<=0||o<=0)return[];const a=$(n)??{r:80,g:80,b:80},i=t,s=i.length;return Array.from({length:o},(t,o)=>Array.from({length:e},(t,n)=>({char:i[(o*e+n)%s],r:a.r,g:a.g,b:a.b,a:r})))}function Mt(t,{format:e="png",quality:o=.92,scale:n=1}={}){return new Promise((r,a)=>{let i=t;if(1!==n){const e=document.createElement("canvas");e.width=Math.round(t.width*n),e.height=Math.round(t.height*n);const o=e.getContext("2d");if(!o)return void a(new Error("captureSnapshot: could not get 2d context"));o.drawImage(t,0,0,e.width,e.height),i=e}i.toBlob(t=>t?r(t):a(new Error("captureSnapshot: toBlob returned null")),`image/${e}`,o)})}var pt={A:[28,54,99,127,99,99,99],B:[126,99,99,126,99,99,126],C:[62,99,96,96,96,99,62],D:[124,102,99,99,99,102,124],E:[127,96,96,124,96,96,127],F:[127,96,96,124,96,96,96],G:[62,99,96,111,99,99,62],H:[99,99,99,127,99,99,99],I:[127,8,8,8,8,8,127],J:[63,6,6,6,102,102,60],K:[99,102,108,120,108,102,99],L:[96,96,96,96,96,96,127],M:[99,119,107,107,99,99,99],N:[99,115,107,103,99,99,99],O:[62,99,99,99,99,99,62],P:[126,99,99,126,96,96,96],Q:[62,99,99,99,107,102,61],R:[126,99,99,126,108,102,99],S:[62,99,96,62,3,99,62],T:[127,8,8,8,8,8,8],U:[99,99,99,99,99,99,62],V:[99,99,99,99,54,28,8],W:[99,99,99,107,107,54,20],X:[99,54,28,8,28,54,99],Y:[99,99,54,28,8,8,8],Z:[127,3,6,12,24,48,127],a:[0,0,60,3,62,99,61],b:[96,96,124,99,99,99,124],c:[0,0,62,96,96,96,62],d:[3,3,31,99,99,99,31],e:[0,0,62,99,127,96,62],f:[30,48,48,126,48,48,48],g:[0,0,63,99,63,3,62],h:[96,96,124,99,99,99,99],i:[8,0,24,8,8,8,28],j:[4,0,12,4,4,36,24],k:[96,96,102,108,120,108,102],l:[24,8,8,8,8,8,28],m:[0,0,92,107,107,99,99],n:[0,0,94,99,99,99,99],o:[0,0,62,99,99,99,62],p:[0,0,126,99,126,96,96],q:[0,0,63,99,63,3,3],r:[0,0,94,99,96,96,96],s:[0,0,62,96,62,3,124],t:[48,48,126,48,48,48,30],u:[0,0,99,99,99,103,59],v:[0,0,99,99,54,28,8],w:[0,0,99,99,107,54,20],x:[0,0,99,54,28,54,99],y:[0,0,99,99,63,3,62],z:[0,0,127,6,12,24,127],0:[62,99,103,107,115,99,62],1:[8,24,56,8,8,8,62],2:[62,99,3,6,24,48,127],3:[62,99,3,30,3,99,62],4:[6,14,22,38,127,6,6],5:[127,96,126,3,3,99,62],6:[62,99,96,126,99,99,62],7:[127,3,6,12,24,24,24],8:[62,99,99,62,99,99,62],9:[62,99,99,63,3,99,62]," ":[0,0,0,0,0,0,0],"!":[24,24,24,24,24,0,24],"?":[62,99,3,14,8,0,8],".":[0,0,0,0,0,24,24],",":[0,0,0,0,0,24,48],";":[0,24,24,0,24,24,48],":":[0,24,24,0,24,24,0],"-":[0,0,0,62,0,0,0],_:[0,0,0,0,0,0,127],"'":[24,24,32,0,0,0,0],'"':[54,54,36,0,0,0,0],"`":[24,8,0,0,0,0,0],")":[24,12,6,6,6,12,24],"(":[12,24,48,48,48,24,12],"[":[60,48,48,48,48,48,60],"]":[30,6,6,6,6,6,30],"{":[14,24,24,48,24,24,14],"}":[56,12,12,6,12,12,56],"/":[3,6,12,24,48,96,0],"\\":[96,48,24,12,6,3,0],"|":[8,8,8,8,8,8,8],"+":[0,8,8,62,8,8,0],"=":[0,0,62,0,62,0,0],"*":[0,42,28,127,28,42,0],"#":[36,36,127,36,127,36,36],"@":[62,99,111,107,111,96,62],"&":[24,36,24,60,74,68,58],"%":[99,38,4,8,16,50,99],$:[8,62,72,62,9,62,8],"^":[8,20,34,0,0,0,0],"~":[0,0,50,76,0,0,0],"<":[6,12,24,48,24,12,6],">":[48,24,12,6,12,24,48]},bt=[127,65,65,65,65,65,127];function vt(t){return pt[t]??pt[t.toUpperCase()]??bt}function xt(t,e={}){if(!t)return"";const{char:o="█",scale:n=1}=e,r=[...o][0]??"█",a=Math.max(1,Math.floor(n)),i=7*a,s=a,c=Array.from({length:i},()=>"");for(let e=0;e<t.length;e++){const o=vt(t[e]);for(let t=0;t<7;t++){const e=o[t];let n="";for(let t=6;t>=0;t--)n+=(e>>t&1?r:" ").repeat(a);for(let e=0;e<a;e++)c[t*a+e]+=n}if(e<t.length-1)for(let t=0;t<i;t++)c[t]+=" ".repeat(s)}return c.join("\n")}exports.ART_STYLE_PRESETS=n,exports.BACKGROUND_TYPES=["wave","rain","stars","pulse","noise","grid","aurora","silk","void","morph","fire","dna","terrain","circuit"],exports.CHARSETS=e,exports.CHARSET_SEQUENCES=o,exports.DEFAULT_OPTIONS=a,exports.HOVER_PRESETS={none:{label:"Off",options:{hoverStrength:0,hoverEffect:"spotlight",hoverRadius:.2,hoverColor:"#ffffff"}},subtle:{label:"Subtle",options:{hoverStrength:.25,hoverEffect:"glow",hoverRadius:.12,hoverColor:"#ffffff"}},flashlight:{label:"Flashlight",options:{hoverStrength:.6,hoverEffect:"spotlight",hoverRadius:.15,hoverColor:"#fffbe6"}},magnifier:{label:"Magnifier",options:{hoverStrength:.7,hoverEffect:"magnify",hoverRadius:.12,hoverColor:"#ffffff"}},forceField:{label:"Force Field",options:{hoverStrength:.7,hoverEffect:"repel",hoverRadius:.15,hoverColor:"#a0e8ff"}},neon:{label:"Neon",options:{hoverStrength:.6,hoverEffect:"colorShift",hoverRadius:.15,hoverColor:"#d946ef"}},fire:{label:"Fire",options:{hoverStrength:.7,hoverEffect:"spotlight",hoverRadius:.15,hoverColor:"#ff6b2b"}},ice:{label:"Ice",options:{hoverStrength:.5,hoverEffect:"glow",hoverRadius:.15,hoverColor:"#60d5f7"}},gravity:{label:"Gravity",options:{hoverStrength:.7,hoverEffect:"attract",hoverRadius:.18,hoverColor:"#a5d6ff"}},shatter:{label:"Shatter",options:{hoverStrength:.8,hoverEffect:"shatter",hoverRadius:.14,hoverColor:"#ff6090"}},ghost:{label:"Ghost",options:{hoverStrength:.55,hoverEffect:"trail",hoverRadius:.2,hoverColor:"#b39ddb"}},glitchReveal:{label:"Glitch Reveal",options:{hoverStrength:.8,hoverEffect:"glitchText",hoverRadius:.18,hoverColor:"#a3e635"}}},exports.LIVING_STYLE_PRESETS=r,exports.PALETTE_THEMES={dracula:{name:"Dracula",accent:"#bd93f9",bg:"#282a36",fg:"#f8f8f2"},monokai:{name:"Monokai",accent:"#a6e22e",bg:"#272822",fg:"#f8f8f2"},nord:{name:"Nord",accent:"#88c0d0",bg:"#2e3440",fg:"#eceff4"},catppuccin:{name:"Catppuccin",accent:"#cba6f7",bg:"#1e1e2e",fg:"#cdd6f4"},solarized:{name:"Solarized",accent:"#268bd2",bg:"#002b36",fg:"#839496"},gruvbox:{name:"Gruvbox",accent:"#b8bb26",bg:"#282828",fg:"#ebdbb2"}},exports.asciiBackground=ut,exports.asciiText=function(t,e={},o,n){const r={...a,...e},{frame:i,cols:s}=B(t,r,o,n);if(!i.length||0===s)return"";const c=[];for(const t of i)c.push(t.map(t=>t.char).join(""));return c.join("\n")},exports.asciiTextAnsi=function(t,e={},o,n){const r={...a,...e},{frame:i,cols:s}=B(t,r,o,n);if(!i.length||0===s)return"";const c=[];for(const t of i){let e="";for(const o of t)" "===o.char||o.a<10?e+=" ":e+=`[38;2;${o.r};${o.g};${o.b}m${o.char}`;c.push(e)}return c.join("\n")},exports.asciify=async function(t,e,{fontSize:o,artStyle:r="classic",options:i={}}={}){let s;if("string"==typeof t){const e=new Image;e.crossOrigin="anonymous",await new Promise((o,n)=>{e.onload=()=>o(),e.onerror=()=>n(new Error(`Failed to load image: ${t}`)),e.src=t}),s=e}else t instanceof HTMLImageElement&&!t.complete?(await new Promise((e,o)=>{t.onload=()=>e(),t.onerror=()=>o(new Error("Image failed to load"))}),s=t):s=t;const c=n[r],l=o??i.fontSize??10,h={...a,...c,...i,fontSize:l},f=e.getContext("2d");if(!f)throw new Error("Could not get 2d context from canvas");const{w:d,h:u}=function(t){return t instanceof HTMLVideoElement?{w:t.videoWidth,h:t.videoHeight}:t instanceof HTMLImageElement?{w:t.naturalWidth||t.width,h:t.naturalHeight||t.height}:{w:t.width,h:t.height}}(s),{renderW:m,renderH:g}=Y(d,u),M="undefined"!=typeof window&&window.devicePixelRatio||1,p=8e6,b=m*M*g*M>p?Math.sqrt(p/(m*g)):M;(e.width<m||e.height<g)&&(e.width=Math.round(m*b),e.height=Math.round(g*b));const{frame:v}=B(s,h,m,g);if(h.hoverStrength>0){let t=null,o=!1,n=0;const r=o=>{const n=e.getBoundingClientRect();t={x:(o.clientX-n.left)/n.width,y:(o.clientY-n.top)/n.height}},a=()=>{t=null};e.addEventListener("mousemove",r),e.addEventListener("mouseleave",a);const i=e=>{o||(f.save(),f.setTransform(b,0,0,b,0,0),W(f,v,h,m,g,e/1e3,t),f.restore(),n=requestAnimationFrame(i))};return n=requestAnimationFrame(i),()=>{o=!0,cancelAnimationFrame(n),e.removeEventListener("mousemove",r),e.removeEventListener("mouseleave",a)}}f.save(),f.setTransform(b,0,0,b,0,0),W(f,v,h,m,g),f.restore()},exports.asciifyGif=async function(t,e,{fontSize:o,artStyle:r="classic",options:i={}}={}){const s="string"==typeof t?await fetch(t).then(t=>t.arrayBuffer()):t,c=o??i.fontSize??10,l={...a,...n[r],...i,fontSize:c},h=e.getContext("2d");if(!h)throw new Error("Could not get 2d context from canvas");const{frames:f,fps:d}=await H(s,l,e.width,e.height);let u,m=!1,g=0,M=performance.now();const p=1e3/d,b=t=>{m||(t-M>=p&&(W(h,f[g],l,e.width,e.height),g=(g+1)%f.length,M=t),u=requestAnimationFrame(b))};return u=requestAnimationFrame(b),()=>{m=!0,cancelAnimationFrame(u)}},exports.asciifyLiveVideo=function(t,e,o){return G(t,e,o)},exports.asciifyText=xt,exports.asciifyVideo=G,exports.asciifyWebcam=async function(t,{fontSize:e=10,style:o="classic",options:r={},liveOptions:i,mirror:s=!0,constraints:c={facingMode:"user"},dpr:l}={}){if(!navigator.mediaDevices?.getUserMedia)throw new Error("asciifyWebcam: getUserMedia is not supported in this browser.");const h=await navigator.mediaDevices.getUserMedia({video:c}),f=document.createElement("video");f.srcObject=h,f.muted=!0,f.playsInline=!0,await new Promise((t,e)=>{f.onloadedmetadata=()=>t(),f.onerror=()=>e(new Error("asciifyWebcam: video stream failed to load.")),f.play().catch(e)});const d={...a,...n[o],...r,fontSize:e},u=t.getContext("2d");if(!u)throw new Error("asciifyWebcam: could not get 2d context from canvas.");const m=l??("undefined"!=typeof window?window.devicePixelRatio:1)??1;1!==m&&u.scale(m,m);let g=null;const M={x:.5,y:.5,intensity:0},p=e=>{const o=t.getBoundingClientRect();g={x:(e.clientX-o.left)/o.width,y:(e.clientY-o.top)/o.height}},b=()=>{g=null};d.hoverStrength>0&&(t.addEventListener("mousemove",p),t.addEventListener("mouseleave",b));let v,x=!1;const w=performance.now(),y=e=>{if(!x){if(f.readyState>=f.HAVE_CURRENT_DATA){const o=t.width/m,n=t.height/m,r=(e-w)/1e3,a=i?{...d,...i()}:d;a.hoverStrength>0?(t.addEventListener("mousemove",p),t.addEventListener("mouseleave",b)):(t.removeEventListener("mousemove",p),t.removeEventListener("mouseleave",b));const{frame:c}=B(f,a,o,n);if(g){const t=g.x-M.x,e=g.y-M.y,o=Math.sqrt(t*t+e*e),n=Math.min(.25,.06+.8*o);M.x+=t*n,M.y+=e*n,M.intensity+=.12*(1-M.intensity)}else M.intensity*=.965,M.intensity<.003&&(M.intensity=0);const l=M.intensity>.003?{x:M.x,y:M.y,intensity:M.intensity}:null;s?(u.save(),u.scale(-1,1),u.translate(-o,0),W(u,c,a,o,n,r,l),u.restore()):W(u,c,a,o,n,r,l)}v=requestAnimationFrame(y)}};return v=requestAnimationFrame(y),()=>{x=!0,cancelAnimationFrame(v),t.removeEventListener("mousemove",p),t.removeEventListener("mouseleave",b),h.getTracks().forEach(t=>t.stop()),f.srcObject=null}},exports.buildTextFrame=gt,exports.captureSnapshot=Mt,exports.createVideoScrollScrub=_,exports.gifToAsciiFrames=H,exports.imageToAsciiFrame=B,exports.mountWaveBackground=mt,exports.renderAuroraBackground=tt,exports.renderCircuitBackground=dt,exports.renderDnaBackground=at,exports.renderFireBackground=rt,exports.renderFrameToCanvas=W,exports.renderGridBackground=Z,exports.renderMorphBackground=nt,exports.renderNoiseBackground=Q,exports.renderPulseBackground=K,exports.renderRainBackground=X,exports.renderSilkBackground=et,exports.renderStarsBackground=J,exports.renderTerrainBackground=it,exports.renderTextBackground=function(t,e,o,n,r={},i){const{fontSize:s=10,lineHeight:c=1.6,color:l="#505050",opacity:h=100,hoverEffect:f="spotlight",hoverStrength:d=.85,hoverRadius:u=.18,hoverColor:m="#d4ff00"}=r;W(t,gt(n,Math.max(1,Math.floor(e/s)),Math.max(1,Math.floor(o/(s*c))),l,h),{...a,hoverEffect:f,hoverStrength:d,hoverRadius:u,hoverColor:m},e,o,0,i??null)},exports.renderTextToCanvas=function(t,e,o={}){const{color:n="#d4ff00",bgColor:r,fontSize:a=10}=o,i=xt(e,o);if(!i)return;const s=i.split("\n"),c=Math.max(...s.map(t=>[...t].length));t.width=Math.ceil(c*a*.6),t.height=Math.ceil(s.length*a);const l=t.getContext("2d");r&&"transparent"!==r?(l.fillStyle=r,l.fillRect(0,0,t.width,t.height)):l.clearRect(0,0,t.width,t.height),l.fillStyle=n,l.font=`${a}px monospace`,l.textBaseline="top",s.forEach((t,e)=>l.fillText(t,0,e*a))},exports.renderVoidBackground=ot,exports.renderWaveBackground=I,exports.snapshotAndDownload=async function(t,e={}){const{filename:o="asciify-snapshot",format:n="png",...r}=e,a=await Mt(t,{format:n,...r}),i="jpeg"===n?"jpg":n,s=document.createElement("a");s.href=URL.createObjectURL(a),s.download=`${o}.${i}`,s.click(),setTimeout(()=>URL.revokeObjectURL(s.href),1e4)},exports.videoToAsciiFrames=q;//# sourceMappingURL=index.cjs.map
1
+ "use strict";var e=require("gifuct-js"),t={standard:" .:-=+*#%@",blocks:" ░▒▓█",minimal:" .:+",dense:" .'`^\",:;Il!i><~+_-?][}{1)(|/tfjrxnuvczXYUJCLQ0OZmwqpdbkhao*#MW&8%B@$",binary:"01",dots:" ⠁⠃⠇⡇⣇⣧⣷⣿",letters:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",claudeCode:" ╔╗╚╝║═╠╣╦╩╬░▒▓█│─┌┐└┘├┤┬┴┼",box:" ▪◾◼■█",lines:" ˗‐–—―━",braille:" ⠁⠂⠃⠄⠅⠆⠇⠈⠉⠊⠋⠌⠍⠎⠏⠐⠑⠒⠓⠔⠕⠖⠗⠘⠙⠚⠛⠜⠝⠞⠟⠠⠡⠢⠣⠤⠥⠦⠧⠨⠩⠪⠫⠬⠭⠮⠯⠰⠱⠲⠳⠴⠵⠶⠷⠸⠹⠺⠻⠼⠽⠾⠿⡀⡁⡂⡃⡄⡅⡆⡇⣀⣁⣂⣃⣄⣅⣆⣇⣈⣉⣊⣋⣌⣍⣎⣏⣐⣑⣒⣓⣔⣕⣖⣗⣘⣙⣚⣛⣜⣝⣞⣟⣠⣡⣢⣣⣤⣥⣦⣧⣨⣩⣪⣫⣬⣭⣮⣯⣰⣱⣲⣳⣴⣵⣶⣷⣸⣹⣺⣻⣼⣽⣾⣿",katakana:" ヲァィゥェォャュョッアイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワン",musical:" ♩♪♫♬♭♮♯",emoji:" ⬛🟫🟥🟧🟨🟩🟦🟪⬜",circles:" .·:∘○◦°•∙",shadows:" ·∘◦○◎⊙●◉",starfield:" ˙·∘∗✦✧★◆●",geometric:" ·△▷◇◈◆▣■█",pipes:" ╶─┐└├┤┬┴┼╬▒▓█",waves:" ˜∼≈〰≋∿∾∭∫",shards:" ╱╲╳◤◥◣◢△▲◆◼█",smoke:" ·˙⁚⁖∶∷⋮⋰⋱∴∵",ascii:" .'`^\",:;~-_+<>i!lI?/\\|()[]{}1tfjrxnuvczXYUJCLQ0OZmwqpdbkhao*#MW&8%B@$",interface:" ·•-–—+=:;<>[]{}()⌘⌥⇧⌃↵↗↘◇◆◈□■",prompt:" .:;>_`/\\|{}[]()=+*#@$",data:" ·∙•◦○●◇◆◈▱▰▣█",humanist:" ·˙,:;∴∵∷∶⁚⋮⋯∼≈≋∞",mesh:" ·╶╴╷╵─│┌┐└┘├┤┬┴┼╬░▒▓█"},o={cosmic:[t.starfield,t.circles,t.shadows],rain:[t.katakana,t.braille,t.binary],terminal:[t.pipes,t.claudeCode,t.standard],crystal:[t.shards,t.geometric,t.blocks],fluid:[t.waves,t.smoke,t.circles],pulse:[t.dense,t.standard,t.blocks],dream:[t.braille,t.shadows,t.smoke],angular:[t.geometric,t.shards,t.starfield],assistant:[t.interface,t.prompt,t.data],signal:[t.mesh,t.data,t.ascii],editorial:[t.humanist,t.waves,t.smoke]},n={classic:{renderMode:"ascii",charset:t.standard,colorMode:"grayscale"},particles:{renderMode:"dots",colorMode:"fullcolor",dotSizeRatio:.8},letters:{renderMode:"ascii",charset:t.letters,colorMode:"fullcolor"},claudeCode:{renderMode:"ascii",charset:t.claudeCode,colorMode:"accent",accentColor:"#f97316"},art:{renderMode:"ascii",charset:t.dense,colorMode:"fullcolor"},terminal:{renderMode:"ascii",charset:t.standard,colorMode:"matrix"},box:{renderMode:"ascii",charset:t.box,colorMode:"grayscale"},lines:{renderMode:"ascii",charset:t.lines,colorMode:"fullcolor"},braille:{renderMode:"ascii",charset:t.braille,colorMode:"fullcolor"},katakana:{renderMode:"ascii",charset:t.katakana,colorMode:"matrix"},musical:{renderMode:"ascii",charset:t.musical,colorMode:"accent",accentColor:"#e040fb"},emoji:{renderMode:"ascii",charset:t.emoji,colorMode:"fullcolor"},circles:{renderMode:"ascii",charset:t.circles,colorMode:"accent",accentColor:"#d4ff00"},shadows:{renderMode:"ascii",charset:t.shadows,colorMode:"accent",accentColor:"#50a0ff"},starfield:{renderMode:"ascii",charset:t.starfield,colorMode:"fullcolor"},geometric:{renderMode:"ascii",charset:t.geometric,colorMode:"grayscale"},pipes:{renderMode:"ascii",charset:t.pipes,colorMode:"accent",accentColor:"#00ff88"},waves:{renderMode:"ascii",charset:t.waves,colorMode:"fullcolor"},shards:{renderMode:"ascii",charset:t.shards,colorMode:"grayscale"},smoke:{renderMode:"ascii",charset:t.smoke,colorMode:"accent",accentColor:"#c850ff"},ascii:{renderMode:"ascii",charset:t.ascii,colorMode:"grayscale"},interface:{renderMode:"ascii",charset:t.interface,colorMode:"accent",accentColor:"#f4f1ea"},prompt:{renderMode:"ascii",charset:t.prompt,colorMode:"matrix"},data:{renderMode:"ascii",charset:t.data,colorMode:"fullcolor"},humanist:{renderMode:"ascii",charset:t.humanist,colorMode:"accent",accentColor:"#d6ccc2"},mesh:{renderMode:"ascii",charset:t.mesh,colorMode:"accent",accentColor:"#8fd3ff"}},r={agentField:{...n.interface,charsetFrames:o.assistant,charsetFps:1.6,animationStyle:"breathe",animationSpeed:.75,ditherStrength:.12,hoverEffect:"glow",hoverStrength:.42,hoverRadius:.18,hoverColor:"#f4f1ea",normalize:!0},liquidSignal:{...n.data,charsetFrames:o.signal,charsetFps:2.4,animationStyle:"melt",animationSpeed:.65,ditherStrength:.45,hoverEffect:"repel",hoverStrength:.55,hoverRadius:.22,hoverColor:"#8fd3ff",normalize:!0},cursorGravity:{...n.mesh,charsetFrames:o.angular,charsetFps:1.2,animationStyle:"orbit",animationSpeed:.9,ditherStrength:.2,hoverEffect:"attract",hoverStrength:.82,hoverRadius:.24,hoverColor:"#ffffff",normalize:!0},editorialPulse:{...n.humanist,charsetFrames:o.editorial,charsetFps:.9,animationStyle:"ripple",animationSpeed:.55,ditherStrength:.18,hoverEffect:"spotlight",hoverStrength:.35,hoverRadius:.2,hoverColor:"#fff8ea",normalize:!0},terminalFlow:{...n.prompt,charsetFrames:o.terminal,charsetFps:3,animationStyle:"rain",animationSpeed:1.1,ditherStrength:.22,hoverEffect:"glitchText",hoverStrength:.65,hoverRadius:.16,hoverColor:"#d4ff00",hoverText:["BUILD","SHIP","RUN","ASK","MODEL"],normalize:!0}},a={fontSize:10,charSpacing:1,brightness:0,contrast:0,charset:t.standard,colorMode:"grayscale",accentColor:"#d4ff00",invert:!1,renderMode:"ascii",animationStyle:"none",animationSpeed:1,dotSizeRatio:.8,ditherStrength:0,charAspect:.55,normalize:!1,hoverStrength:0,hoverRadius:.2,hoverEffect:"spotlight",hoverColor:"#ffffff",hoverShape:"circle",hoverText:"ASCIIFY",artStyle:"classic",customText:"",chromaKey:null,chromaKeyTolerance:60};function i(e,t){const o=document.createElement("canvas");o.width=e,o.height=t;const n=o.getContext("2d",{willReadFrequently:!0});return{canvas:o,ctx:n}}function s(e,t,o){let n=e+255*t;return n=259*(255*o+255)/(255*(259-255*o))*(n-128)+128,Math.max(0,Math.min(255,n))}function c(e,t,o){const n=o?1-e/255:e/255,r=[...t],a=Math.floor(n*(r.length-1));return r[Math.max(0,Math.min(r.length-1,a))]}function l(e,t,o,n,r,a){if((a?1-e/255:e/255)<.12)return" ";const i=[...t];return i[(n*r+o)%i.length]}var h=[[0,8,2,10],[12,4,14,6],[3,11,1,9],[15,7,13,5]];function f(e,t,o,n){if(n<=0)return e;const r=(h[o%4][t%4]/16-.5)*n*128;return Math.max(0,Math.min(255,e+r))}var d=new Array(256),u=new Array(256);for(let e=0;e<256;e++)d[e]=`rgb(${e},${e},${e})`,u[e]=`rgb(0,${e},0)`;function m(e,t,o,n,r,a=!1){switch(t){case"fullcolor":return`rgb(${e.r},${e.g},${e.b})`;case"matrix":return u[.299*e.r+.587*e.g+.114*e.b|0];case"accent":return`rgb(${o},${n},${r})`;default:{const t=.299*e.r+.587*e.g+.114*e.b|0;return d[t]}}}var g=[0,0,0];function M(e,t,o,n,r,a=!1){switch(t){case"fullcolor":g[0]=e.r,g[1]=e.g,g[2]=e.b;break;case"matrix":{const t=.299*e.r+.587*e.g+.114*e.b|0;g[0]=0,g[1]=t,g[2]=0;break}case"accent":g[0]=o,g[1]=n,g[2]=r;break;default:{const t=.299*e.r+.587*e.g+.114*e.b|0;g[0]=t,g[1]=t,g[2]=t;break}}return g}function p(e){const t=e.match(/rgba?\(\s*(\d+)\s*[,\s]\s*(\d+)\s*[,\s]\s*(\d+)(?:\s*[,/]\s*([\d.]+))?\s*\)/);return t?{r:+t[1],g:+t[2],b:+t[3],a:void 0!==t[4]?+t[4]:1}:null}function v(e){let t=e;for(;t&&t!==document.documentElement.parentElement;){const e=getComputedStyle(t).backgroundColor;if(e&&"transparent"!==e&&"rgba(0, 0, 0, 0)"!==e){const t=p(e);if(t&&t.a>.1)return t}t=t.parentElement}return null}function b(e){if(e){const t=v(e);if(t){return(.299*t.r+.587*t.g+.114*t.b)/255<.4}}if("undefined"!=typeof document){const e=document.documentElement,t=(e.getAttribute("data-theme")||"").toLowerCase();if("dark"===t)return!0;if("light"===t)return!1;if(e.classList.contains("dark"))return!0;if(document.body){const e=v(document.body);if(e){return(.299*e.r+.587*e.g+.114*e.b)/255<.4}}}return"undefined"!=typeof window&&window.matchMedia("(prefers-color-scheme: dark)").matches}function x(e){if("string"!=typeof e)return e;const t=document.createElement("canvas");t.width=1,t.height=1;const o=t.getContext("2d");o.fillStyle=e,o.fillRect(0,0,1,1);const n=o.getImageData(0,0,1,1).data;return{r:n[0],g:n[1],b:n[2]}}function w(e,t,o,n,r,a,i){if("none"===a)return 1;const s=r*i;switch(a){case"wave":return.3+.7*(.6*(.5*Math.sin(e/o*Math.PI*4+3*s)+.5)+.4*(.5*Math.sin(t/n*Math.PI*3+2*s)+.5));case"pulse":{const r=o/2,a=n/2,i=Math.sqrt((e-r)**2+(t-a)**2),c=Math.sqrt(r**2+a**2);return.2+.8*(.5*Math.sin(i/c*Math.PI*6-4*s)+.5)}case"rain":return.1+.9*(.5*Math.sin(t/n*Math.PI*8-5*s+.3*e)+.5)*(.3*Math.sin(e/o*Math.PI*2+s)+.7);case"breathe":{const o=.3*Math.sin(2*s)+.7,n=.1*Math.sin(.1*(e+t)+s);return Math.max(.1,Math.min(1,o+n))}case"sparkle":{const o=43758.5453*Math.sin(127.1*e+311.7*t+43758.5453*Math.floor(8*s)),n=o-Math.floor(o);return n>.7?1:.15+.4*n}case"glitch":{const e=Math.floor(t/(.05*n)),o=43758.5453*Math.sin(43.23*e+17.89*Math.floor(6*s));if(o-Math.floor(o)>.85){const t=.5*Math.sin(30*s+e)+.5;return t<.3?0:t}return 1}case"spiral":{const r=o/2,a=n/2,i=e-r,c=t-a,l=Math.atan2(c,i),h=Math.sqrt(i*i+c*c),f=Math.sqrt(r*r+a*a);return.15+.85*(.5*Math.sin(3*l+h/f*Math.PI*8-3*s)+.5)}case"typewriter":{const r=o*n,a=t*o+e-.5*s%1*r*1.3;if(a>0)return 0;const i=Math.max(0,1+a/(.15*r));return Math.min(1,i)}case"scatter":{const r=o/2,a=n/2,i=e-r,c=t-a,l=Math.sqrt(i*i+c*c)/Math.sqrt(r*r+a*a),h=.5*Math.sin(1.5*s)+.5;return l>h?Math.max(0,1-3*(l-h)):.7+.3*Math.sin(10*l-2*s)}case"waveField":default:return 1;case"ripple":{const r=o/2,a=n/2,i=e-r,c=t-a,l=Math.sqrt(i*i+c*c),h=Math.sqrt(r*r+a*a);return.1+.9*(.5*Math.sin(l/h*Math.PI*10-5*s)+.5)*(.4+.6*(1-Math.min(1,l/(1.1*h))))}case"melt":{const o=t/n*Math.PI;return.05+(.5*Math.sin(o-1.8*s+.15*e)+.5)*(1-.6*(Math.max(0,t/n-.1)/.9))*.95}case"orbit":{const r=o/2,a=n/2,i=e-r,c=t-a,l=Math.atan2(c,i),h=Math.sqrt(i*i+c*c)/Math.sqrt(r*r+a*a);return.1+.9*(.5*Math.sin(2*l+6*h-2.5*s)+.5)}case"cellular":{const o=Math.floor(4*s),n=(e,t)=>{const n=43758.5453*Math.sin(127.1*e+311.7*t+43758.5453*o);return n-Math.floor(n)>.38?1:0},r=n(e,t),a=n(e-1,t)+n(e+1,t)+n(e,t-1)+n(e,t+1)+n(e-1,t-1)+n(e+1,t-1)+n(e-1,t+1)+n(e+1,t+1);return 1===(1===r?2===a||3===a?1:0:3===a?1:0)?1:.05}}}var y={scale:1,offsetX:0,offsetY:0,glow:0,colorBlend:0,proximity:0};function S(e,t,o,n,r,a,i,s,c="spotlight",l=.5,h="circle"){const f=e-o,d=t-n,u=.08+.35*l+.04*a;let m,g;if("box"===h){const e=Math.abs(f),t=Math.abs(d);m=Math.max(e,t),g=u}else m=Math.sqrt(f*f+d*d),g=u;if(m>=g)return y.scale=1,y.offsetX=0,y.offsetY=0,y.glow=0,y.colorBlend=0,y.proximity=0,y;const M=function(e){return e*e*(3-2*e)}(1-m/g)*r;let p=1,v=0,b=0,x=0,w=0;switch(c){case"spotlight":{p=1+M*a*1.8;const e=Math.atan2(d,f),t=M*M*a*.6;v=Math.cos(e)*t*i,b=Math.sin(e)*t*s,x=M*a*.4,w=M*M*a*.25;break}case"magnify":p=1+M*a*2.5,x=M*a*.15;break;case"repel":{p=1+M*a*.3;const e=Math.atan2(d,f),t=M*M*a*1.2;v=Math.cos(e)*t*i,b=Math.sin(e)*t*s;break}case"glow":x=M*a*.8,w=M*a*.4;break;case"colorShift":p=1+M*a*.4,x=M*a*.2,w=M*a*.7;break;case"attract":{const e=Math.atan2(d,f),t=M*M*a*1;v=-Math.cos(e)*t*i,b=-Math.sin(e)*t*s,x=M*a*.3;break}case"shatter":{const e=Math.atan2(d,f),t=.5*Math.sin(43.7*f+29.3*d),o=M*a*1.4*(.7+.3*t);v=Math.cos(e+t)*o*i,b=Math.sin(e+t)*o*s,p=Math.max(.1,1-M*a*.6),x=M*a*.25;break}case"trail":w=M*a*.9,x=M*a*.6,p=1+M*a*.15;break;case"glitchText":p=1,x=M*a*.5,w=M*a*.6}return y.scale=p,y.offsetX=v,y.offsetY=b,y.glow=x,y.colorBlend=w,y.proximity=M,y}function $(e){const t=e.match(/^#([0-9a-f]{3,8})$/i)?.[1];if(t){const e=t.length<=4?t.split("").map(e=>parseInt(e+e,16)):[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)];return{r:e[0],g:e[1],b:e[2]}}const o=e.match(/rgba?\(\s*(\d+)[,\s]+(\d+)[,\s]+(\d+)/i);return o?{r:+o[1],g:+o[2],b:+o[3]}:null}function E(e){return e*e*e*(e*(6*e-15)+10)}function C(e,t,o){return e+(t-e)*o}function T(e,t){let o=127*e+311*t;return o^=o>>13,(o*(o*o*15731+789221)+1376312589&2147483647)/2147483647}function A(e,t){const o=Math.floor(e),n=Math.floor(t),r=t-n,a=E(e-o),i=E(r),s=T(o,n),c=T(o+1,n),l=T(o,n+1),h=T(o+1,n+1);return C(C(s,c,a),C(l,h,a),i)}function R(e,t){return(.5*A(e,t)+.25*A(2.1*e,2.1*t)+.125*A(4.3*e,4.3*t))/.875}function I(e,t,o,n,r={x:.5,y:.5},a={}){const{fontSize:i=13,charAspect:s=.62,lineHeightRatio:c=1.4,chars:l=" .:-=+*#%@",baseColor:h=null,accentColor:f,accentThreshold:d=.52,mouseInfluence:u=.55,mouseFalloff:m=2.8,speed:g=1,vortex:M=!0,sparkles:p=!0,breathe:v=!0,lightMode:b=!1}=a,x=f??(b?"#6b8700":"#d4ff00"),w=i*s,y=i*c,S=Math.ceil(t/w),$=Math.ceil(o/y),E=r.x,C=r.y;let A=212,I=255,k=0;{const e=x.replace("#","");6===e.length&&(A=parseInt(e.slice(0,2),16),I=parseInt(e.slice(2,4),16),k=parseInt(e.slice(4,6),16))}e.clearRect(0,0,t,o),e.font=`${i}px "JetBrains Mono", monospace`,e.textBaseline="top";const F=n*g,L=v?.12*(.5*Math.sin(.22*F)+.5):0;for(let t=0;t<$;t++)for(let o=0;o<S;o++){const n=o/S,r=t/$,a=.045,i=.08*F,s=.06,c=.45*((.5*Math.sin(.08*o+.05*t+.6*F)+.5+(.5*Math.sin(.03*o-.07*t+.4*F)+.5)+(.5*Math.sin(.05*o+.03*t+.8*F)+.5))/3)+.35*(.5*R(o*a+i,t*a*1.4-.7*i)+.5)+.2*(.5*Math.sin((o+.65*t)*s+1.1*F)+.5)+L,f=n-E,g=r-C,v=Math.sqrt(f*f+g*g);let x=0;if(M&&v<.35){const e=Math.atan2(g,f),t=Math.sin(4*e+2.2*F-14*v),o=Math.max(0,1-v/.35);x=t*o*o*.22}const B=c*(1-u)+(Math.max(0,1-v*m)+.5*x)*u+.15*x,z=Math.min(1,Math.max(0,B));let P=z;if(p&&z>.72){const e=Math.floor(8*F),n=T(7*o+3*e,11*t+e);n>.88&&(P=Math.min(1,z+4*(n-.88)))}const q=Math.floor(P*(l.length-1));if(" "===l[q])continue;const H=.015+.07*P;if(P>d){const t=Math.min(b?.9:.28,H*(b?14:2.8));e.fillStyle=`rgba(${A},${I},${k},${t})`}else e.fillStyle=h?h.replace("{a}",String(H)):b?`rgba(55,55,55,${7*H})`:`rgba(255,255,255,${H})`;e.fillText(l[q],o*w,t*y)}}function k(e,t){return"auto"!==e?e:!b(t)}function F(e){const t=e.match(/^#([0-9a-fA-F]{3,6})$/);if(t){let e=t[1];if(3===e.length&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),6===e.length)return e}const o=e.match(/rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/);return o?[o[1],o[2],o[3]].map(e=>parseInt(e).toString(16).padStart(2,"0")).join(""):null}function L(e){const t=e||"auto";if("auto"!==t)return t.replace("#","");if("undefined"!=typeof document){const e=getComputedStyle(document.documentElement);for(const t of["--accent-color","--color-accent","--accent","--color-primary","--primary","--brand-color"]){const o=F(e.getPropertyValue(t).trim());if(o)return o}const t=F(getComputedStyle(document.body).accentColor??"");if(t)return t}return b("undefined"!=typeof document?document.body:null)?"faf9f7":"0d0d0d"}function B(e,t,o,n){const r=e instanceof HTMLVideoElement?e.videoWidth:e.width,a=e instanceof HTMLVideoElement?e.videoHeight:e.height;if(0===r||0===a)return{frame:[],cols:0,rows:0};const h=t.charAspect,d=t.fontSize*t.charSpacing,u=t.fontSize/h*t.charSpacing,m=o||r,g=n||a,M=Math.floor(m/d),p=Math.floor(g/u);if(M<=0||p<=0)return{frame:[],cols:0,rows:0};const v=Math.max(1,Math.min(Math.floor(2048/M),Math.floor(r/M))),b=Math.max(1,Math.min(Math.floor(2048/p),Math.floor(a/p))),w=M*v,y=p*b,{ctx:S}=i(w,y);S.drawImage(e,0,0,w,y);const $=S.getImageData(0,0,w,y).data,E=t.chromaKey,C=null!=E&&!1!==E,T=!0===E,A="blue-screen"===E;let R=null,I=0;!C||T||A||(R=x(E),I=(t.chromaKeyTolerance??60)**2);let F=0,L=255;if(t.normalize){let e=255,t=0;for(let o=0;o<$.length;o+=4){if(C){const e=$[o],t=$[o+1],n=$[o+2];let r=!1;if(T)r=t>1.4*e&&t>1.4*n&&t>80;else if(A)r=n>1.4*e&&n>1.4*t&&n>80;else if(null!==R){const o=e-R.r,a=t-R.g,i=n-R.b;r=o*o+a*a+i*i<=I}if(r)continue}const n=.299*$[o]+.587*$[o+1]+.114*$[o+2];n<e&&(e=n),n>t&&(t=n)}F=e,L=t>e?t-e:255}const B=[],z=k(t.invert),P=C&&t.charset.replace(/ /g,"")||t.charset,q=v*b;for(let e=0;e<p;e++){const o=[];for(let n=0;n<M;n++){let r=0,a=0,i=0,h=0,d=0;for(let t=0;t<b;t++){const o=(e*b+t)*w;for(let e=0;e<v;e++){const t=4*(o+n*v+e),s=$[t],c=$[t+1],l=$[t+2],f=$[t+3];if(C){let e=!1;if(T)e=c>1.4*s&&c>1.4*l&&c>80;else if(A)e=l>1.4*s&&l>1.4*c&&l>80;else if(null!==R){const t=s-R.r,o=c-R.g,n=l-R.b;e=t*t+o*o+n*n<=I}if(e){d++;continue}}r+=s,a+=c,i+=l,h+=f}}if(C&&d>q/2){o.push({char:" ",r:0,g:0,b:0,a:0});continue}const u=q-d,m=u>0?r/u:0,g=u>0?a/u:0,p=u>0?i/u:0,x=u>0?h/u:0,y=.299*m+.587*g+.114*p,S=f(s(t.normalize?(y-F)/L*255:y,t.brightness,t.contrast),n,e,t.ditherStrength),E=t.customText?l(S,t.customText,n,e,M,z):c(S,P,z);o.push({char:E,r:m,g:g,b:p,a:x,lum:S})}B.push(o)}return{frame:B,cols:M,rows:p}}function z(e,t,o,n){const r=e instanceof HTMLVideoElement?e.videoWidth:e.width,a=e instanceof HTMLVideoElement?e.videoHeight:e.height;if(0===r||0===a)return{rows:[],cols:0,rowCount:0};const h=t.charAspect,d=t.fontSize*t.charSpacing,u=t.fontSize/h*t.charSpacing,m=o||r,g=n||a,M=Math.floor(m/d),p=Math.floor(g/u);if(M<=0||p<=0)return{rows:[],cols:0,rowCount:0};const v=Math.max(1,Math.min(Math.floor(2048/M),Math.floor(r/M))),b=Math.max(1,Math.min(Math.floor(2048/p),Math.floor(a/p))),w=M*v,y=p*b,{ctx:S}=i(w,y);S.drawImage(e,0,0,w,y);const $=S.getImageData(0,0,w,y).data,E=t.chromaKey,C=null!=E&&!1!==E,T=!0===E,A="blue-screen"===E;let R=null,I=0;!C||T||A||(R=x(E),I=(t.chromaKeyTolerance??60)**2);let F=0,L=255;if(t.normalize){let e=255,t=0;for(let o=0;o<$.length;o+=4){if(C){const e=$[o],t=$[o+1],n=$[o+2];let r=!1;if(T)r=t>1.4*e&&t>1.4*n&&t>80;else if(A)r=n>1.4*e&&n>1.4*t&&n>80;else if(null!==R){const o=e-R.r,a=t-R.g,i=n-R.b;r=o*o+a*a+i*i<=I}if(r)continue}const n=.299*$[o]+.587*$[o+1]+.114*$[o+2];n<e&&(e=n),n>t&&(t=n)}F=e,L=t>e?t-e:255}const B=k(t.invert),z=C&&t.charset.replace(/ /g,"")||t.charset,P=v*b,q=[];for(let e=0;e<p;e++){let o="";for(let n=0;n<M;n++){let r=0,a=0,i=0,h=0;for(let t=0;t<b;t++){const o=(e*b+t)*w;for(let e=0;e<v;e++){const t=4*(o+n*v+e),s=$[t],c=$[t+1],l=$[t+2];if(C){let e=!1;if(T)e=c>1.4*s&&c>1.4*l&&c>80;else if(A)e=l>1.4*s&&l>1.4*c&&l>80;else if(null!==R){const t=s-R.r,o=c-R.g,n=l-R.b;e=t*t+o*o+n*n<=I}if(e){h++;continue}}r+=s,a+=c,i+=l}}if(C&&h>P/2){o+=" ";continue}const d=P-h,u=.299*(d>0?r/d:0)+.587*(d>0?a/d:0)+.114*(d>0?i/d:0),m=f(s(t.normalize?(u-F)/L*255:u,t.brightness,t.contrast),n,e,t.ditherStrength);o+=t.customText?l(m,t.customText,n,e,M,B):c(m,z,B)}q.push(o)}return{rows:q,cols:M,rowCount:p}}function P(e,t,o,n,r){if(0===t.rows.length)return;e.clearRect(0,0,n,r);const a=e.canvas;o.chromaKey||t.rows.some(e=>e.includes(" "))||(e.fillStyle=b(a)?"#0a0a0a":"#faf9f7",e.fillRect(0,0,n,r));const i=L(o.accentColor),s=parseInt(i.substring(0,2),16)||255,c=parseInt(i.substring(2,4),16)||255,l=parseInt(i.substring(4,6),16)||255,h=n/t.cols,f=r/t.rowCount,d=.9*Math.min(h/.55,f);e.font=`${d}px "JetBrains Mono", monospace`,e.textAlign="left",e.textBaseline="middle",e.fillStyle="matrix"===o.colorMode?"rgb(0,255,0)":`rgb(${s},${c},${l})`,e.globalAlpha=1;for(let o=0;o<t.rows.length;o++){const n=t.rows[o];0!==n.trim().length&&e.fillText(n,.5*h,o*f+.5*f)}e.globalAlpha=1}async function q(e,t,o,n,r=12,a=10,i,s=0){const c=Math.min(e.duration-s,a),l=Math.ceil(c*r),h=[];let f=0,d=0;for(let a=0;a<l;a++){const u=s+a/r;if(u>s+c)break;e.currentTime=u,await new Promise(t=>{const o=()=>{e.removeEventListener("seeked",o),t()};e.addEventListener("seeked",o)});const m=B(e,t,o,n);h.push(m.frame),f=m.cols,d=m.rows,i?.((a+1)/l)}return{frames:h,cols:f,rows:d,fps:r}}async function H(t,o,n,r,a){const i=e.parseGIF(t),s=e.decompressFrames(i,!0);if(0===s.length)return{frames:[],cols:0,rows:0,fps:10};const c=s[0].dims.width,l=s[0].dims.height,h=i.lsd?.width||c,f=i.lsd?.height||l,d=document.createElement("canvas");d.width=h,d.height=f;const u=d.getContext("2d"),m=document.createElement("canvas");m.width=h,m.height=f;const g=m.getContext("2d"),M=[];let p=0,v=0,b=0;for(const e of s)b+=e.delay||100;const x=b/s.length,w=Math.round(Math.min(30,Math.max(5,1e3/x))),y=Math.min(s.length,300);for(let e=0;e<y;e++){const t=s[e],{dims:i,patch:c,disposalType:l}=t;3===l&&(g.clearRect(0,0,h,f),g.drawImage(d,0,0));const b=new ImageData(new Uint8ClampedArray(c.buffer),i.width,i.height),x=document.createElement("canvas");x.width=i.width,x.height=i.height;x.getContext("2d").putImageData(b,0,0),u.drawImage(x,i.left||0,i.top||0);const w=B(d,o,n,r);M.push(w.frame),p=w.cols,v=w.rows,2===l?u.clearRect(i.left||0,i.top||0,i.width,i.height):3===l&&(u.clearRect(0,0,h,f),u.drawImage(m,0,0)),a?.((e+1)/y)}return{frames:M,cols:p,rows:v,fps:w}}function W(e,t,o,n,r,a=0,i){if("waveField"===o.animationStyle){return void I(e,n,r,a,i?{x:i.x,y:i.y}:{x:.5,y:.5},{accentColor:`#${o.accentColor?L(o.accentColor):"d4ff00"}`,accentThreshold:.52,mouseInfluence:o.hoverStrength>0?Math.min(1,.3+.5*o.hoverStrength):.55,mouseFalloff:2.8,speed:o.animationSpeed,vortex:o.hoverStrength>0,sparkles:!0,breathe:!0})}const s=t.length;if(0===s)return;const l=t[0].length;e.clearRect(0,0,n,r);let h=!1;const f=Math.max(1,s>>2),d=Math.max(1,l>>2);e:for(let e=0;e<s;e+=f){const o=t[e];for(let e=0;e<l;e+=d)if(o[e].a<200){h=!0;break e}}const u=e.canvas,g=b(u);h||(e.fillStyle=g?"#0a0a0a":"#faf9f7",e.fillRect(0,0,n,r));const p=n/l,v=r/s,x=s*l,y=i?.intensity??1,$=!("none"!==o.animationStyle&&x>5e3)&&!!(i&&o.hoverStrength>0&&y>.005),E=o.hoverColor||"#ffffff",C=parseInt(E.slice(1,3),16)||255,T=parseInt(E.slice(3,5),16)||255,A=parseInt(E.slice(5,7),16)||255,R=L(o.accentColor),F=parseInt(R.substring(0,2),16)||255,B=parseInt(R.substring(2,4),16)||255,z=parseInt(R.substring(4,6),16)||255,P=x>3e4?.25:x>15e3?.4:x>5e3?.6:1,q=o.hoverRadius*P;let H=0,W=l,j=0,U=s,O=0,V=0;if($&&i){O=i.x,V=i.y;const e=.08+.35*q+.04*o.hoverStrength;H=Math.max(0,Math.floor((O-e)*l)-1),W=Math.min(l,Math.ceil((O+e)*l)+1),j=Math.max(0,Math.floor((V-e)*s)-1),U=Math.min(s,Math.ceil((V+e)*s)+1)}const _=o.animationStyle,D=o.animationSpeed,Y="none"===_,N=o.hoverStrength,G=o.hoverEffect,X=q,J=o.hoverShape||"circle",K=k(o.invert,u),Q=o.colorMode,Z=2*Math.PI,ee=1/l,te=1/s;let oe="",ne=-1;if("dots"===o.renderMode){const n=.5*Math.min(p,v)*o.dotSizeRatio;for(let o=0;o<s;o++){const r=t[o];for(let t=0;t<l;t++){const i=r[t];if(i.a<10)continue;const c=.00392156863*(.299*i.r+.587*i.g+.114*i.b),h=K?1-c:c;if(h<.02)continue;const f=Y?1:w(t,o,l,s,a,_,D);let d=1,u=0,g=0,b=0,x=0;if($&&t>=H&&t<=W&&o>=j&&o<=U){const e=S(t*ee,o*te,O,V,y,N,p,v,G,X,J);d=e.scale,u=e.offsetX,g=e.offsetY,b=e.glow,x=e.colorBlend}const E=n*h*f*d;if(E<.3)continue;const R=t*p+.5*p+u,I=o*v+.5*v+g;let k;if(x>0){const e=M(i,Q,F,B,z,K);k=`rgb(${Math.min(255,e[0]+(C-e[0])*x|0)},${Math.min(255,e[1]+(T-e[1])*x|0)},${Math.min(255,e[2]+(A-e[2])*x|0)})`}else k=m(i,Q,F,B,z,K);const L=Math.min(1,.00392156863*i.a*f*(1+b));if(L!==ne&&(e.globalAlpha=L,ne=L),k!==oe&&(e.fillStyle=k,oe=k),E<=3){const t=2*E;e.fillRect(R-E,I-E,t,t)}else e.beginPath(),e.arc(R,I,E,0,Z),e.fill()}}}else{const n=.55,r=.9*Math.min(p/n,v),i=r<6;if(!i){const t="emoji"===o.artStyle;e.font=t?`${r}px "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Twemoji Mozilla", sans-serif`:`${r}px "JetBrains Mono", monospace`,e.textAlign="center",e.textBaseline="middle"}let h=null;const f=o.charsetFrames,d=!!f?.length,u=d?f[Math.floor(Math.max(0,a)*(o.charsetFps??2))%f.length]:o.charset;if(i){h={};const e=[...u],t=e.length;for(let o=0;o<t;o++)h[e[o]]=Math.max(.1,(o+.3)/t)}const g=i?null:e.getTransform();if(!i&&!$&&Y&&!d&&"accent"===Q){e.fillStyle=`rgb(${F},${B},${z})`,e.globalAlpha=1,e.textAlign="left";for(let o=0;o<s;o++){const n=t[o];let r="";for(let e=0;e<l;e++){const t=n[e];r+=t.a<10?" ":t.char}0!==r.trim().length&&e.fillText(r,.5*p,o*v+.5*v)}return void(e.globalAlpha=1)}const b="glitchText"===G&&$,x="!@#$%^&*<>{}[]|/\\~`0123456789",E=x.length;let R="",I=0,k=0,L=0,P=0,Z=0,re=0;if(b){const e=o.hoverText??"ASCIIFY";if(k=Math.round(O*l),L=Math.round(V*s),Array.isArray(e)){const t=e.filter(e=>e.length>0);0===t.length&&t.push("ASCIIFY");R=t[((7*Math.floor(k/Math.max(1,Math.ceil(l/5)))+13*Math.floor(L/Math.max(1,Math.ceil(s/3))))%t.length+t.length)%t.length]}else R=e||"ASCIIFY";I=R.length,P=Math.max(3,Math.min(12,Math.round(s*q*.6)));const t=Math.floor(P/2);Z=Math.max(0,L-t),Z+P>s&&(Z=Math.max(0,s-P)),re=k-Math.floor(I/2)}for(let o=0;o<s;o++){const n=t[o];for(let t=0;t<l;t++){const r=n[t];if(r.a<10)continue;let f=d&&null!=r.lum?c(r.lum,u,K):r.char;if(" "===f)continue;const q=Y?1:w(t,o,l,s,a,_,D);if(q<.05)continue;let ae=1,ie=0,se=0,ce=0,le=0;if($&&!b&&t>=H&&t<=W&&o>=j&&o<=U){const e=S(t*ee,o*te,O,V,y,N,p,v,G,X,J);ae=e.scale,ie=e.offsetX,se=e.offsetY,ce=e.glow,le=e.colorBlend}if(b&&o>=Z&&o<Z+P){const e=t-re;if(e>=0&&e<I){const n=R[e],r=Math.abs(o-L)/Math.max(1,.5*P),i=Math.abs(t-k)/Math.max(1,I),s=Math.max(r,i),c=Math.max(0,Math.min(1,1-.9*s)),l=43758.5453*Math.sin(127.1*t+311.7*o+43758.5453*Math.floor(12*a));f=Math.abs(l-Math.floor(l))<c?n:x[Math.abs(Math.floor(97*l))%E],ce=.3+.7*c,le=.3+.65*c}}const he=t*p+.5*p+ie,fe=o*v+.5*v+se;let de;if(le>0){const e=M(r,Q,F,B,z,K);de=`rgb(${Math.min(255,e[0]+(C-e[0])*le|0)},${Math.min(255,e[1]+(T-e[1])*le|0)},${Math.min(255,e[2]+(A-e[2])*le|0)})`}else de=m(r,Q,F,B,z,K);if(i){const t=h[f]??.5,o=Math.min(1,.00392156863*r.a*q*(1+ce))*t;if(o<.02)continue;o!==ne&&(e.globalAlpha=o,ne=o),de!==oe&&(e.fillStyle=de,oe=de);const n=p*ae,a=v*ae;e.fillRect(he-.5*n,fe-.5*a,n,a)}else{const t=Math.min(1,.00392156863*r.a*q*(1+ce));t!==ne&&(e.globalAlpha=t,ne=t),de!==oe&&(e.fillStyle=de,oe=de),1!==ae?(e.translate(he,fe),e.scale(ae,ae),e.fillText(f,0,0),e.setTransform(g)):e.fillText(f,he,fe)}}}}e.globalAlpha=1}function j(e){return Math.max(0,Math.min(1,e))}function U(e){return"string"==typeof e?document.querySelector(e):e instanceof HTMLElement?e:null}function O(e,t,o={}){if(!Number.isFinite(e.duration)||e.duration<=0)return;const n=o.from??0,r=o.to??e.duration,a=Math.max(n,Math.min(r,e.duration)),i=j(o.ease?o.ease(j(t)):t),s=n+(a-n)*i;e.currentTime=Math.min(Math.max(n,s),Math.max(n,a-.04)),o.onUpdate?.(i,e)}function V(e){const t=e.requestVideoFrameCallback;return new Promise(t?o=>{let n=!1;const r=()=>{n||(n=!0,o())};t.call(e,r),window.setTimeout(r,80)}:e=>requestAnimationFrame(()=>e()))}function _(e,t={}){const o=U(t.trigger)??e;e.pause();const n=t.gsap,r=t.ScrollTrigger??n?.ScrollTrigger;if(n&&r?.create){n.registerPlugin?.(r);const a=r.create({trigger:o,start:t.start??"top bottom",end:t.end??"bottom top",scrub:t.scrub??!0,onUpdate:o=>O(e,o.progress,t)});return()=>a.kill?.()}return function(e,t,o){let n=0;const r=()=>{n=0;const r=t.getBoundingClientRect(),a=window.innerHeight||document.documentElement.clientHeight,i=r.height+a,s=i>0?j((a-r.top)/i):0;O(e,s,o)},a=()=>{n||(n=requestAnimationFrame(r))};return window.addEventListener("scroll",a,{passive:!0}),window.addEventListener("resize",a),a(),()=>{window.removeEventListener("scroll",a),window.removeEventListener("resize",a),n&&cancelAnimationFrame(n)}}(e,o,t)}function D(e,t,o){const n=t.gsap,r=t.ScrollTrigger??n?.ScrollTrigger;if(n&&r?.create){n.registerPlugin?.(r);const a=r.create({trigger:e,start:t.start??"top bottom",end:t.end??"bottom top",scrub:t.scrub??!0,onUpdate:e=>o(e.progress)});return()=>a.kill?.()}return function(e,t){let o=0;const n=()=>{o=0;const n=e.getBoundingClientRect(),r=window.innerHeight||document.documentElement.clientHeight,a=n.height+r,i=a>0?j((r-n.top)/a):0;t(i)},r=()=>{o||(o=requestAnimationFrame(n))};return window.addEventListener("scroll",r,{passive:!0}),window.addEventListener("resize",r),r(),()=>{window.removeEventListener("scroll",r),window.removeEventListener("resize",r),o&&cancelAnimationFrame(o)}}(e,o)}function Y(e,t,o=2048){const n=o,r=Math.min(1,n/Math.max(e,t));return{renderW:Math.round(e*r),renderH:Math.round(t*r)}}function N(e,t,o,n,r,a=2048){const{width:i,height:s}=t.getBoundingClientRect();if(!i||!s)return{renderW:0,renderH:0,dpr:1};let c,l,h=i,f=h/o;f>s&&(f=s,h=f*o),h=Math.round(h),f=Math.round(f),n&&r?({renderW:c,renderH:l}=Y(n,r,a)):(c=h,l=f);const d="undefined"!=typeof window&&window.devicePixelRatio||1,u=8e6,m=c*d*l*d>u?Math.sqrt(u/(c*l)):d;return e.width=Math.round(c*m),e.height=Math.round(l*m),e.style.width=h+"px",e.style.height=f+"px",{renderW:c,renderH:l,dpr:m}}async function G(e,t,{fontSize:o,artStyle:r="classic",options:i={},fitTo:s,preExtract:c=!1,fps:l,maxRenderDimension:h=2048,trim:f,scroll:d,onReady:u,onFrame:m}={}){const g=f?.start??0,M=f?.end,p=o??i.fontSize??10,v={...a,...n[r],...i,fontSize:p},b=t.getContext("2d");if(!b)throw new Error("asciifyVideo: could not get 2d context from canvas.");const x="string"==typeof s?document.querySelector(s):s instanceof HTMLElement?s:null;if(c){let o;"string"==typeof e?(o=document.createElement("video"),o.crossOrigin="anonymous",o.src=e,o.readyState<2&&await new Promise((t,n)=>{o.onloadeddata=()=>t(),o.onerror=()=>n(new Error(`asciifyVideo: failed to load "${e}"`))})):o=e,x&&N(t,x,o.videoWidth/o.videoHeight,o.videoWidth,o.videoHeight,h);const{renderW:n,renderH:r}=Y(o.videoWidth,o.videoHeight,h),a="undefined"!=typeof window&&window.devicePixelRatio||1,i=8e6,s=n*a*r*a>i?Math.sqrt(i/(n*r)):a;t.width<Math.round(n*s)&&(t.width=Math.round(n*s),t.height=Math.round(r*s));const c=void 0!==M?M-g:10,f=l??(d?18:void 0),{frames:p,fps:w}=await q(o,v,n,r,f,c,void 0,g),y=e=>{const t=p[e];t&&(b.save(),b.setTransform(s,0,0,s,0,0),W(b,t,v,n,r),b.restore(),m?.())};if(d){let e=!1,n=-1;const r=!0===d?{}:d,a=D(U(r.trigger)??x??t,r,t=>{const a=j(r.ease?r.ease(j(t)):t),i=Math.max(0,Math.min(p.length-1,Math.round(a*(p.length-1))));i!==n&&(n=i,y(i),e||(e=!0,u?.(o)),r.onUpdate?.(a,o))});return y(0),e=!0,u?.(o),a}let S,$=!1,E=0,C=performance.now(),T=!0;const A=1e3/w,R=e=>{$||(e-C>=A&&(y(E),E=(E+1)%p.length,C=e,T&&(T=!1,u?.(o))),S=requestAnimationFrame(R))};return S=requestAnimationFrame(R),()=>{$=!0,cancelAnimationFrame(S)}}let w,y=!1;"string"==typeof e?(w=document.createElement("video"),w.src=e,w.muted=!0,w.loop=!0,w.playsInline=!0,w.setAttribute("playsinline",""),Object.assign(w.style,{position:"fixed",top:"0",left:"0",width:"1px",height:"1px",opacity:"0",pointerEvents:"none",zIndex:"-1"}),document.body.appendChild(w),y=!0,await new Promise((t,o)=>{w.onloadedmetadata=()=>t(),w.onerror=()=>o(new Error(`asciifyVideo: failed to load "${e}"`))}),await w.play().catch(()=>{})):(w=e,w.readyState<HTMLMediaElement.HAVE_METADATA&&await new Promise((e,t)=>{const o=()=>{w.removeEventListener("loadedmetadata",n),w.removeEventListener("error",r)},n=()=>{o(),e()},r=()=>{o(),t(new Error("asciifyVideo: provided video element failed to load metadata."))};w.addEventListener("loadedmetadata",n),w.addEventListener("error",r),w.load()}),w.paused&&await w.play().catch(()=>{})),g>0&&(w.currentTime=g,await new Promise(e=>{const t=()=>{w.removeEventListener("seeked",t),e()};w.addEventListener("seeked",t)}));let S=null;(g>0||void 0!==M)&&(S=()=>{(void 0!==M&&w.currentTime>=M||g>0&&w.currentTime<g)&&(w.currentTime=g)},w.addEventListener("timeupdate",S));let $=null;const{renderW:E,renderH:C}=Y(w.videoWidth,w.videoHeight,h);if(x){const e=w.videoWidth/w.videoHeight,o=w.videoWidth,n=w.videoHeight,r=N(t,x,e,o,n,h),a=t.getContext("2d");a&&a.setTransform(r.dpr,0,0,r.dpr,0,0),$=new ResizeObserver(()=>{const r=N(t,x,e,o,n,h),a=t.getContext("2d");a&&a.setTransform(r.dpr,0,0,r.dpr,0,0)}),$.observe(x)}else{const e="undefined"!=typeof window&&window.devicePixelRatio||1,o=8e6,n=E*e*C*e>o?Math.sqrt(o/(E*C)):e;t.width<Math.round(E*n)&&(t.width=Math.round(E*n),t.height=Math.round(C*n)),b.setTransform(n,0,0,n,0,0)}let T,A=!1,R=!0,I=null;const k=d&&!c,F=l&&l>0?1e3/l:0;let L=0,H=-1;if(k&&"ascii"===v.renderMode&&("accent"===v.colorMode||"matrix"===v.colorMode)&&"none"===v.animationStyle&&v.hoverStrength<=0&&!v.charsetFrames?.length){const e=!0===d?{}:d,o=U(e.trigger)??x??t,n=e.from??g,r=e.to??M??w.duration,a=Math.max(n,Math.min(r,w.duration)),i=Math.max(.001,a-n),s=Math.min(60,Math.max(12,l??30)),c=Math.max(2,Math.ceil(i*s)+1),h=new Array(c);let f=0,p=0,T=-1,A=0,R=!1,k=!1,B=!1;const q=new Set,H=document.createElement("video");H.muted=!0,H.playsInline=!0,H.preload="auto",H.crossOrigin=w.crossOrigin||"anonymous",H.src=w.currentSrc||w.src,Object.assign(H.style,{position:"fixed",top:"0",left:"0",width:"1px",height:"1px",opacity:"0",pointerEvents:"none",zIndex:"-1"}),document.body.appendChild(H),H.readyState<HTMLMediaElement.HAVE_METADATA&&await new Promise((e,t)=>{const o=()=>{H.removeEventListener("loadedmetadata",n),H.removeEventListener("error",r)},n=()=>{o(),e()},r=()=>{o(),t(new Error("asciifyVideo: cache video failed to load metadata."))};H.addEventListener("loadedmetadata",n),H.addEventListener("error",r),H.load()}),H.pause(),w.paused&&await w.play().catch(()=>{});const W=e=>n+i*e/Math.max(1,c-1),O=e=>Math.max(0,Math.min(c-1,Math.round(e*(c-1)))),_=e=>{if(h[e])return e;for(let t=1;t<c;t++){const o=e-t,n=e+t;if(o>=0&&h[o])return o;if(n<c&&h[n])return n}return-1},Y=()=>{if(!h[f])return f;for(const e of q)if(!h[e])return e;for(let e=1;e<c;e++){const t=f-e,o=f+e;if(t>=0&&!h[t])return t;if(o<c&&!h[o])return o}return-1},N=e=>{e<0||e>=c||h[e]||(q.add(e),G())},G=async()=>{if(R||k)return;const e=Y();if(!(e<0)){q.delete(e),k=!0;try{if(await function(e,t){return Math.abs(e.currentTime-t)<1/240?V(e):new Promise(o=>{const n=()=>{e.removeEventListener("seeked",n),o()};e.addEventListener("seeked",n,{once:!0}),e.currentTime=t})}(H,W(e)),await V(H),!R){const t=z(H,v,E,C);t.rows.length>0&&(h[e]=t)}}finally{k=!1,R||requestAnimationFrame(()=>{G()})}}},X=()=>{if(R)return;const e=_(f);if(e>=0&&e!==T){const t=h[e];t&&(P(b,t,v,E,C),T=e,B||(B=!0,u?.(w)),m?.())}else if(e<0||T<0){const e=performance.now();if(F<=0||e-L>=F){const t=z(w,v,E,C);t.rows.length>0&&(P(b,t,v,E,C),L=e,B||(B=!0,u?.(w)),m?.())}}N(f),A=requestAnimationFrame(X)};return I=D(o,e,t=>{const o=function(e,t,o={}){if(!Number.isFinite(e.duration)||e.duration<=0)return null;const n=o.from??0,r=o.to??e.duration,a=Math.max(n,Math.min(r,e.duration)),i=j(o.ease?o.ease(j(t)):t),s=n+(a-n)*i;return{progress:i,time:Math.min(Math.max(n,s),Math.max(n,a-.04))}}(w,t,{...e,from:n,to:a});p=o?.progress??j(t),f=O(p),N(f),N(f-1),N(f+1),e.onUpdate?.(p,w)}),N(0),N(1),A=requestAnimationFrame(X),()=>{R=!0,cancelAnimationFrame(A),I?.(),$?.disconnect(),H.pause(),H.src="",document.body.removeChild(H),S&&w.removeEventListener("timeupdate",S),y&&(w.pause(),w.src="",document.body.removeChild(w))}}if(k){const e=!0===d?{}:d;I=_(w,{...e,trigger:e.trigger??x??t,from:e.from??g,to:e.to??M})}const O=e=>{if(A)return;if(T=requestAnimationFrame(O),w.readyState<2||0===t.width||0===t.height)return;if(F>0&&e-L<F)return;if(g>0&&w.currentTime<g)return;if(void 0!==M&&w.currentTime>=M)return;if(k&&Math.abs(w.currentTime-H)<1/240)return;const{frame:o}=B(w,v,E,C);o.length>0&&(W(b,o,v,E,C,0,null),L=e,H=w.currentTime,R&&(R=!1,u?.(w)),m?.())};return T=requestAnimationFrame(O),()=>{A=!0,cancelAnimationFrame(T),I?.(),$?.disconnect(),S&&w.removeEventListener("timeupdate",S),y&&(w.pause(),w.src="",document.body.removeChild(w))}}function X(e,t,o,n,r={}){const{fontSize:a=13,chars:i="0123456789ABCDEF@#$&*+=/<>",accentColor:s,color:c,speed:l=1,density:h=.55,tailLength:f=14,lightMode:d=!1}=r,u=s??(d?"#6b8700":"#d4ff00"),m=.62*a,g=1.4*a,M=Math.ceil(t/m),p=Math.ceil(o/g);e.clearRect(0,0,t,o),e.font=`${a}px monospace`,e.textBaseline="top";let v=255,b=255,x=255;if(d&&(v=55,b=55,x=55),c){const e=$(c);e&&(v=e.r,b=e.g,x=e.b)}let w=212,y=255,S=0;const E=$(u);E&&(w=E.r,y=E.g,S=E.b);const C=p+f;for(let t=0;t<M;t++){if(T(17*t,3)>h)continue;const o=(.5+1.5*T(31*t,7))*l,r=T(13*t,11)*C,a=Math.floor((n*o*7+r)%C),s=t*m;for(let o=0;o<=f;o++){const r=a-(f-o);if(r<0||r>=p)continue;const c=r*g,l=T(53*t+Math.floor(5*n+o),7*r),h=i[Math.floor(l*i.length)],u=o/f;if(o===f)e.fillStyle=`rgba(${w},${y},${S},${d?.7:.85})`;else{const t=d?.85*u:.15*u;e.fillStyle=`rgba(${v},${b},${x},${t})`}e.fillText(h,s,c)}}}function J(e,t,o,n,r={x:.5,y:.5},a={}){const{fontSize:i=14,chars:s=" . · * + ° ★",accentColor:c,color:l,speed:h=1,count:f=180,lightMode:d=!1}=a,u=c??(d?"#6b8700":"#d4ff00");e.clearRect(0,0,t,o),e.textBaseline="middle",e.textAlign="center";const m=t*(.2+.6*r.x),g=o*(.2+.6*r.y),M=.65*Math.sqrt(t*t+o*o);let p=255,v=255,b=255;if(d&&(p=55,v=55,b=55),l){const e=$(l);e&&(p=e.r,v=e.g,b=e.b)}let x=212,w=255,y=0;const S=$(u);S&&(x=S.r,w=S.g,y=S.b);const E=s.replace(/ /g,"").split("");if(0!==E.length){for(let r=0;r<f;r++){const a=T(17*r,3)*Math.PI*2,s=(n*(.15+.85*T(31*r,7))*h*.22+T(13*r,11))%1,c=m+Math.cos(a)*s*M,l=g+Math.sin(a)*s*M;if(c<-20||c>t+20||l<-20||l>o+20)continue;const f=Math.max(6,i*(.4+.9*s));e.font=`${f}px monospace`;const u=E[Math.min(E.length-1,Math.floor(s*E.length))],S=s>.72,$=d?.85*s:.2*s;e.fillStyle=S?`rgba(${x},${w},${y},${Math.min(d?.92:.32,2.2*$)})`:`rgba(${p},${v},${b},${$})`,e.fillText(u,c,l)}e.textAlign="left"}}function K(e,t,o,n,r={x:.5,y:.5},a={}){const{fontSize:i=14,chars:s=". · ○ ◎ ●",accentColor:c,color:l,rings:h=5,speed:f=1,sharpness:d=4,lightMode:u=!1}=a,m=c??(u?"#007a5e":"#00ffcc");e.clearRect(0,0,t,o),e.textBaseline="middle",e.textAlign="center";const g=t*r.x,M=o*r.y,p=1.6*Math.sqrt(g*g+M*M)+.2*Math.sqrt(t*t+o*o);let v=255,b=255,x=255;if(u&&(v=55,b=55,x=55),l){const e=$(l);e&&(v=e.r,b=e.g,x=e.b)}let w=0,y=255,S=204;const E=$(m);E&&(w=E.r,y=E.g,S=E.b);const C=s.replace(/ /g,"").split("");if(0===C.length)return;const T=Math.ceil(t/i),A=Math.ceil(o/i);for(let t=0;t<A;t++)for(let o=0;o<T;o++){const r=o*i+.5*i,a=t*i+.5*i,s=r-g,c=a-M,l=Math.sqrt(s*s+c*c)/p;let m=0;for(let e=0;e<h;e++){const t=(n*f*.38+e/h)%1,o=Math.abs(l-t),r=Math.max(0,1-o*p/(i*(12-d)));m+=Math.cos(r*Math.PI*.5)*r}if(m=Math.min(1,m),m<.02)continue;const $=m>.6;e.font=`${i}px monospace`;const E=Math.floor(m*(C.length-1)),T=C[Math.min(E,C.length-1)],A=u?.88*m:.22*m;e.fillStyle=$?`rgba(${w},${y},${S},${Math.min(u?.95:.4,.55*m)})`:`rgba(${v},${b},${x},${A})`,e.fillText(T,r,a)}e.textAlign="left"}function Q(e,t,o,n,r={x:.5,y:.5},a={}){const{fontSize:i=14,chars:s=" .·:;=+*#%@░▒▓",accentColor:c,color:l,octaves:h=4,speed:f=1,scale:d=1,accentThreshold:u=.78,mouseWarp:m=.3,lightMode:g=!1}=a,M=c??(g?"#6b8700":"#d4ff00"),p=.62*i,v=1.4*i,b=Math.ceil(t/p),x=Math.ceil(o/v);e.clearRect(0,0,t,o),e.font=`${i}px monospace`,e.textBaseline="top";let w=255,y=255,S=255;if(g&&(w=55,y=55,S=55),l){const e=$(l);e&&(w=e.r,y=e.g,S=e.b)}let E=212,C=255,T=0;const R=$(M);R&&(E=R.r,C=R.g,T=R.b);const I=.035*d,k=n*f,F=Math.min(6,Math.max(1,h)),L=(e,t)=>{let o=0,n=.5,r=1,a=0;for(let i=0;i<F;i++)o+=A(e*r,t*r)*n,a+=n,n*=.5,r*=2.1;return o/a};for(let t=0;t<x;t++)for(let o=0;o<b;o++){const n=o*I+.06*k,a=t*I*1.3-.04*k,i=o/b-r.x,c=t/x-r.y,l=Math.sqrt(i*i+c*c),h=m>0?.12*Math.max(0,1-l/m):0,f=.5*L(n+h*Math.sin(1.3*k+8*c),a+h*Math.cos(.9*k+8*i))+.5;if(f<.12)continue;const d=s[Math.floor(f*(s.length-1))];if(" "===d)continue;const M=f>u,$=g?.82*f:.13*f;e.fillStyle=M?`rgba(${E},${C},${T},${g?.92:.28})`:`rgba(${w},${y},${S},${$})`,e.fillText(d,o*p,t*v)}}function Z(e,t,o,n,r={x:.5,y:.5},a={}){const{fontSize:i=12,chars:s="·-=+|/",accentColor:c,color:l,bands:h=3,speed:f=1,bandWidth:d=.12,glitch:u=!0,lightMode:m=!1}=a,g=c??(m?"#6b8700":"#d4ff00"),M=.62*i,p=1.4*i,v=Math.ceil(t/M),b=Math.ceil(o/p);e.clearRect(0,0,t,o),e.font=`${i}px monospace`,e.textBaseline="top";let x=255,w=255,y=255;if(m&&(x=55,w=55,y=55),l){const e=$(l);e&&(x=e.r,w=e.g,y=e.b)}let S=212,E=255,C=0;const A=$(g);A&&(S=A.r,E=A.g,C=A.b);const R=n*f;for(let t=0;t<b;t++)for(let o=0;o<v;o++){const n=t/b,a=((n*h-.5*R)%1+1)%1,i=Math.max(0,1-a/d),c=.35*(.5*T(3*o,7*t)+.5);let l=0;if(u){const e=o/v-r.x,a=n-r.y,i=Math.sqrt(e*e+a*a);if(i<.18){const e=T(11*o+Math.floor(12*R),5*t);l=Math.max(0,1-i/.18)*(e>.5?e-.3:0)}}const f=Math.min(1,c+.8*i+.6*l);if(f<.04)continue;const g=s[Math.floor(f*(s.length-1))],$=i>.55,A=m?.82*f:.12*f;e.fillStyle=$?`rgba(${S},${E},${C},${m?.92:.28})`:`rgba(${x},${w},${y},${A})`,e.fillText(g,o*M,t*p)}}function ee(e,t,o,n,r={x:.5,y:.5},a={}){const{fontSize:i=14,chars:s=" ·∙•:;+=≡≣#@",color:c,accentColor:l,speed:h=1,layers:f=5,softness:d=1.2,mouseRipple:u=.2,lightMode:m=!1}=a,g=l??(m?"#6b8700":"#d4ff00"),M=.62*i,p=1.4*i,v=Math.ceil(t/M),b=Math.ceil(o/p);e.clearRect(0,0,t,o),e.font=`${i}px monospace`,e.textBaseline="top";let x=255,w=255,y=255;if(m&&(x=55,w=55,y=55),c){const e=$(c);e&&(x=e.r,w=e.g,y=e.b)}let S=212,E=255,C=0;const A=$(g);A&&(S=A.r,E=A.g,C=A.b);const R=n*h,I=[];for(let e=0;e<f;e++){const t=T(17*e,31*e+7),o=T(23*e+5,11*e);I.push({fx:.8+2.2*t,fy:1.2+1.8*o,phase:t*Math.PI*4,dt:(.3+.5*T(7*e,13*e+3))*(e%2==0?1:-1),amp:.55+.45*T(29*e,3*e)})}for(let t=0;t<b;t++){const o=t/b;for(let n=0;n<v;n++){const a=n/v,i=a-r.x,c=o-r.y,l=Math.sqrt(i*i+c*c),h=u*Math.exp(-l*l/.06),g=a+i*h,b=o+c*h;let $=0,T=0;for(let e=0;e<f;e++){const{fx:t,fy:o,phase:n,dt:r,amp:a}=I[e];$+=Math.sin(g*t*Math.PI*2+R*r+n)*Math.cos(b*o*Math.PI*2+R*r*.7+1.3*n)*a,T+=a}const A=$/T,k=.5+.5*Math.tanh(A*d*2.2);if(k<.12)continue;const F=(k-.12)/.88,L=s[Math.min(s.length-1,Math.floor(F*s.length))],B=k>.82,z=m?.82*k:.14*k;e.fillStyle=B?`rgba(${S},${E},${C},${m?.92:.32})`:`rgba(${x},${w},${y},${z})`,e.fillText(L,n*M,t*p)}}}function te(e,t,o,n,r={}){const{fontSize:a=13,color:i,accentColor:s,speed:c=.4,layers:l=4,turbulence:h=.8,lightMode:f=!1}=r,d=s??(f?"#6b8700":"#d4ff00"),u=.62*a,m=1.4*a,g=Math.ceil(t/u),M=Math.ceil(o/m);e.clearRect(0,0,t,o),e.font=`${a}px monospace`,e.textBaseline="top";let p=255,v=255,b=255;if(f&&(p=55,v=55,b=55),i){const e=$(i);e&&(p=e.r,v=e.g,b=e.b)}let x=212,w=255,y=0;const S=$(d);S&&(x=S.r,w=S.g,y=S.b);const E=n*c,C=["─","─","╌","·","╌","─","─","╌","·"];for(let t=0;t<M;t++){const o=t/M;for(let n=0;n<g;n++){const r=n/g;let a=0,i=0;for(let e=0;e<l;e++){const t=T(13*e,7*e+3),n=1.1+2.4*t,s=.9+2*T(29*e,11*e+1),c=t*Math.PI*6,l=(.2+.5*T(41*e,17*e))*(e%2==0?1:-1.3),f=Math.sin(r*n*Math.PI*2+E*l+c),d=Math.cos(o*s*Math.PI*2+E*l*.6+1.7*c),u=Math.sin(r*s*Math.PI*h+o*n*Math.PI*h+E*l*.4);a+=Math.atan2(d+.3*u,f),i+=.5*(f*d+1)}const s=a/l,c=Math.min(1,i/l);if(c<.1)continue;const d=(s+Math.PI)/(2*Math.PI),M=C[Math.floor(d*C.length)%C.length],S=c>.8,$=f?.8*c:.13*c;e.fillStyle=S?`rgba(${x},${w},${y},${f?.9:.26})`:`rgba(${p},${v},${b},${$})`,e.fillText(M,n*u,t*m)}}}function oe(e,t,o,n,r={x:.5,y:.5},a={}){const{fontSize:i=13,chars:s=" ·:;=+*#%@",color:c,accentColor:l,speed:h=1,radius:f=.38,swirl:d=3,lightMode:u=!1}=a,m=l??(u?"#6b8700":"#d4ff00"),g=.62*i,M=1.4*i,p=Math.ceil(t/g),v=Math.ceil(o/M),b=t/o;e.clearRect(0,0,t,o),e.font=`${i}px monospace`,e.textBaseline="top";let x=255,w=255,y=255;if(u&&(x=55,w=55,y=55),c){const e=$(c);e&&(x=e.r,w=e.g,y=e.b)}let S=212,E=255,C=0;const A=$(m);A&&(S=A.r,E=A.g,C=A.b);const R=n*h;for(let t=0;t<v;t++){const o=t/v;for(let n=0;n<p;n++){const a=(n/p-r.x)*b,i=o-r.y,c=Math.sqrt(a*a+i*i)/f;if(c>1){const o=T(3*n,7*t)*Math.max(0,1-3*(c-1));if(o<.62)continue;const r=o*(u?.28:.04);e.fillStyle=`rgba(${x},${w},${y},${r})`,e.fillText(s[1],n*g,t*M);continue}const l=Math.max(0,1-Math.abs(c-(.15+.12*Math.sin(1.1*R)))/.07),h=Math.pow(1-c,2.2),d=Math.min(1,h+.6*l);if(d<.06)continue;const m=Math.floor(d*(s.length-1)),v=s[Math.min(s.length-1,m)],$=l>.35||c<.08,A=u?.85*d:.18*d;e.fillStyle=$?`rgba(${S},${E},${C},${u?.95:.38})`:`rgba(${x},${w},${y},${A})`,e.fillText(v,n*g,t*M)}}}function ne(e,t,o,n,r={}){const{fontSize:a=14,chars:i=" ·∙•:-=+*#",color:s,accentColor:c,speed:l=.5,harmonics:h=3,lightMode:f=!1}=r,d=c??(f?"#6b8700":"#d4ff00"),u=.62*a,m=1.4*a,g=Math.ceil(t/u),M=Math.ceil(o/m);e.clearRect(0,0,t,o),e.font=`${a}px monospace`,e.textBaseline="top";let p=255,v=255,b=255;if(f&&(p=55,v=55,b=55),s){const e=$(s);e&&(p=e.r,v=e.g,b=e.b)}let x=212,w=255,y=0;const S=$(d);S&&(x=S.r,w=S.g,y=S.b);const E=n*l,C=Array.from({length:h},(e,t)=>1/(t+1)).reduce((e,t)=>e+t,0);for(let t=0;t<M;t++)for(let o=0;o<g;o++){let n=0;for(let e=0;e<h;e++){const r=.18+1.4*T(o*(e+3)+7,t*(e+5)+11),a=T(o*(e+7),t*(e+9)+3)*Math.PI*2,i=1/(e+1);n+=Math.sin(E*r+a)*i}const r=.5*(n/C+1);if(r<.28)continue;const a=(r-.28)/.72,s=i[Math.min(i.length-1,Math.floor(a*i.length))],c=r>.88,l=f?.82*a:.13*a;e.fillStyle=c?`rgba(${x},${w},${y},${f?.92:.28})`:`rgba(${p},${v},${b},${l})`,e.fillText(s,o*u,t*m)}}function re(e,t,o,n,r={}){const{fontSize:a=13,chars:i=" .,:;i+xX#&@",color:s="#ff4500",hotColor:c="#ffe066",intensity:l=.85,wind:h=0,speed:f=1,lightMode:d=!1}=r,u=.62*a,m=1.4*a,g=Math.ceil(t/u),M=Math.ceil(o/m),p=g*M,v="__fire_heat__",b=e.canvas;let x=b[v];x&&x.length===p||(x=new Float32Array(p),b[v]=x);const w=.18*(.016*f),y=h*f*.8,S=M-1,E=n*f;for(let e=0;e<g;e++){const t=(.6*(.5*Math.sin(.31*e+4.1*E)+.5)+.4*(.5*Math.sin(.73*e-2.7*E)+.5))*l;x[S*g+e]=Math.min(1,t+.15*Math.random()*l),S>0&&(x[(S-1)*g+e]=Math.min(1,.85*t+.1*Math.random()*l))}const C=new Float32Array(p);for(let e=0;e<M-2;e++)for(let t=0;t<g;t++){const o=.4*x[(e+1)*g+t]+.25*x[(e+2)*g+Math.max(0,Math.min(g-1,t+Math.round(y)))]+.175*x[(e+1)*g+Math.max(0,t-1)]+.175*x[(e+1)*g+Math.min(g-1,t+1)];C[e*g+t]=Math.max(0,o-w-.02*Math.random()*f)}for(let e=0;e<g;e++)C[(M-1)*g+e]=x[(M-1)*g+e],M>1&&(C[(M-2)*g+e]=x[(M-2)*g+e]);b[v]=C;const T=$(s)??{r:255,g:69,b:0},A=$(c)??{r:255,g:224,b:102};e.clearRect(0,0,t,o),e.font=`${a}px "JetBrains Mono", monospace`,e.textBaseline="top";for(let t=0;t<M;t++)for(let o=0;o<g;o++){const n=C[t*g+o];if(n<.03)continue;const r=i[Math.min(i.length-1,Math.floor(n*i.length))];if(" "===r)continue;const a=Math.min(1,1.2*n),s=T.r+(A.r-T.r)*a|0,c=T.g+(A.g-T.g)*a|0,l=T.b+(A.b-T.b)*a|0,h=d?1-.3*n:Math.min(1,n+.15);e.globalAlpha=h,e.fillStyle=`rgb(${s},${c},${l})`,e.fillText(r,o*u,t*m)}e.globalAlpha=1}function ae(e,t,o,n,r={}){const{fontSize:a=13,baseChars:i="ATCG",bridgeChars:s="-=≡",color:c="#00e5ff",color2:l="#ff4081",bridgeColor:h="#88ffcc",speed:f=1,helixCount:d,lightMode:u=!1}=r,m=.62*a,g=1.4*a,M=Math.ceil(t/m),p=Math.ceil(o/g),v=d??Math.max(1,Math.floor(t/80)),b=M/v,x=$(c)??{r:0,g:229,b:255},w=$(l)??{r:255,g:64,b:129},y=$(h)??{r:136,g:255,b:204};e.clearRect(0,0,t,o),e.font=`${a}px "JetBrains Mono", monospace`,e.textBaseline="top";const S=n*f,E=.35*b;for(let t=0;t<v;t++){const o=b*(t+.5);for(let n=0;n<p;n++){const r=n/p*Math.PI*6-1.8*S,a=o+Math.sin(r)*E,c=o+Math.sin(r+Math.PI)*E,l=Math.round(a),h=Math.round(c);if(l<0||l>=M)continue;const f=T(31*t+7*n,3),d=i[Math.floor(f*i.length)],u=.5*(Math.sin(r)+1),v=.5*(Math.sin(r+Math.PI)+1);if(e.globalAlpha=.35+.65*u,e.fillStyle=`rgb(${x.r},${x.g},${x.b})`,e.fillText(d,l*m,n*g),h>=0&&h<M){const o=T(53*t+11*n,7),r=i[Math.floor(o*i.length)];e.globalAlpha=.35+.65*v,e.fillStyle=`rgb(${w.r},${w.g},${w.b})`,e.fillText(r,h*m,n*g)}if(n%3===0){const o=Math.min(l,h),r=Math.max(l,h);if(r-o>1){const a=T(17*n+43*t,5),i=s[Math.floor(a*s.length)],c=.25*(u+v)+.2;e.globalAlpha=c,e.fillStyle=`rgb(${y.r},${y.g},${y.b})`;for(let t=o+1;t<r;t++)e.fillText(i,t*m,n*g)}}}}e.globalAlpha=1}function ie(e,t,o,n,r={}){const{fontSize:a=13,chars:i=" .,:;+*#@",color:s="#4caf50",skyColor:c="#1a237e",peakColor:l="#e0e0e0",speed:h=1,roughness:f=.55,heightScale:d=.55,stars:u=!0,lightMode:m=!1}=r,g=.62*a,M=1.4*a,p=Math.ceil(t/g),v=Math.ceil(o/M),b=$(s)??{r:76,g:175,b:80},x=$(c)??{r:26,g:35,b:126},w=$(l)??{r:224,g:224,b:224};e.clearRect(0,0,t,o),e.font=`${a}px "JetBrains Mono", monospace`,e.textBaseline="top";const y=n*h*.4,S=new Array(p);for(let e=0;e<p;e++){const t=(.5*R((e/p+y)*f*3,.5)+.5)*d;S[e]=Math.floor(t*v)}for(let t=0;t<v;t++)for(let o=0;o<p;o++){const r=v-1-S[o],a=t===r;if(!(t>=r)){if(u){const r=T(7*o+Math.floor(.3*y),13*t);if(r>.97){const a=.3*Math.sin(2*n+100*r)+.7;e.globalAlpha=.5*a,e.fillStyle=`rgb(${x.r+60},${x.g+60},${x.b+80})`,e.fillText("·",o*g,t*M)}}continue}const s=(t-r)/Math.max(1,S[o]),c=i[Math.min(i.length-1,Math.floor(s*i.length))];if(" "===c&&!a)continue;const l=a?1:Math.max(0,1-4*s),h=b.r+(w.r-b.r)*l|0,f=b.g+(w.g-b.g)*l|0,d=b.b+(w.b-b.b)*l|0;e.globalAlpha=.5+.5*s,e.fillStyle=`rgb(${h},${f},${d})`,e.fillText(a?i[i.length-1]:c,o*g,t*M)}e.globalAlpha=1}var se=1,ce=2,le=4,he=8,fe={3:"─",12:"│",9:"┌",10:"┐",5:"└",6:"┘",11:"┬",7:"┴",13:"├",14:"┤",15:"┼",[se]:"╶",[ce]:"╴",[le]:"╵",[he]:"╷"};function de(e,t,o,n,r={}){const{fontSize:a=13,pulseColor:i="#ffffff",color:s="#00ff88",density:c=.38,speed:l=1,lightMode:h=!1}=r,f=.62*a,d=1.4*a,u=Math.ceil(t/f),m=Math.ceil(o/d),g=$(s)??{r:0,g:255,b:136},M=$(i)??{r:255,g:255,b:255},p=(e,t)=>{if(T(17*e+1,7*t+2)>c)return 0;let o=0;return e+1<u&&T(17*e+1,7*t+2)>.15&&(o|=1),e-1>=0&&T(17*(e-1)+1,7*t+2)>.15&&(o|=2),t+1<m&&T(17*e+1,7*(t+1)+2)>.15&&(o|=8),t-1>=0&&T(17*e+1,7*(t-1)+2)>.15&&(o|=4),o};e.clearRect(0,0,t,o),e.font=`${a}px "JetBrains Mono", monospace`,e.textBaseline="top";const v=n*l;for(let t=0;t<m;t++)for(let o=0;o<u;o++){const n=p(o,t);if(0===n)continue;const r=fe[n]??"·",a=(8*v+40*T(o,23*t))%u,i=(6*v+40*T(17*t,11*o))%m,s=(1&n||2&n)&&Math.abs(o-a)<1.5,c=(4&n||8&n)&&Math.abs(t-i)<1.5,l=s||c,h=.25+.35*T(3*o,5*t);l?(e.globalAlpha=.95,e.fillStyle=`rgb(${M.r},${M.g},${M.b})`):(e.globalAlpha=h,e.fillStyle=`rgb(${g.r},${g.g},${g.b})`),e.fillText(r,o*f,t*d)}e.globalAlpha=1}function ue(e,t={}){const{type:o="wave",opacity:n=.2,className:r,zIndex:a=0,colorScheme:i="auto",color:s,...c}=t,l="string"==typeof e?document.querySelector(e):e;if(!l)return console.warn("[asciify] asciiBackground: target not found",e),{destroy:()=>{}};const h=l.style.position;"static"===getComputedStyle(l).position&&(l.style.position="relative");const f=document.createElement("canvas");f.style.cssText=["position:absolute","inset:0","width:100%","height:100%",`opacity:${n}`,"pointer-events:none",`z-index:${a}`].join(";"),r&&(f.className=r),l.prepend(f);const d=f.getContext("2d"),u=window.devicePixelRatio||1,m={x:.5,y:.5},g={x:.5,y:.5},M=()=>"light"===i||"dark"!==i&&(()=>{let e=l;for(;e&&e!==document.documentElement.parentElement;){const t=getComputedStyle(e).backgroundColor;if(t&&"transparent"!==t&&"rgba(0, 0, 0, 0)"!==t){const e=t.match(/rgba?\(\s*(\d+)\s*[,\s]\s*(\d+)\s*[,\s]\s*(\d+)/);if(e)return(.299*+e[1]+.587*+e[2]+.114*+e[3])/255>=.4}e=e.parentElement}const t=document.documentElement,o=(t.getAttribute("data-theme")||"").toLowerCase();return"dark"!==o&&("light"===o||!t.classList.contains("dark")&&window.matchMedia("(prefers-color-scheme: light)").matches)})(),p=s?function(e){const t=e.match(/^#([0-9a-f]{3,8})$/i)?.[1];if(t){const e=t.length<=4?t.split("").map(e=>parseInt(e+e,16)):[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)];return{r:e[0],g:e[1],b:e[2]}}const o=e.match(/rgba?\(\s*(\d+)[,\s]+(\d+)[,\s]+(\d+)/i);return o?{r:+o[1],g:+o[2],b:+o[3]}:null}(s):null,v=()=>({...c,lightMode:void 0!==c.lightMode?c.lightMode:M(),baseColor:p?`rgba(${p.r},${p.g},${p.b},{a})`:c.baseColor}),b={current:v()},x=()=>{b.current="rain"===o||"stars"===o||"pulse"===o||"noise"===o||"grid"===o||"aurora"===o||"silk"===o||"void"===o||"morph"===o?{...c,lightMode:void 0!==c.lightMode?c.lightMode:M(),color:s??c.color}:"fire"===o||"dna"===o?{...c,color:s??c.color}:"terrain"===o||"circuit"===o?{...c,color:s??c.color,lightMode:void 0!==c.lightMode?c.lightMode:M()}:v()};x();const w=window.matchMedia("(prefers-color-scheme: light)"),y=()=>{x()};let S=null;"auto"===i&&(w.addEventListener("change",y),S=new MutationObserver(y),S.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme","class"]}));const $=()=>{const e=l.getBoundingClientRect();f.width=e.width*u,f.height=e.height*u,d.setTransform(u,0,0,u,0,0)};$();const E=e=>{const t=l.getBoundingClientRect();m.x=(e.clientX-t.left)/t.width,m.y=(e.clientY-t.top)/t.height},C=new ResizeObserver($);C.observe(l),window.addEventListener("mousemove",E);let T=0,A=0;const R=()=>{g.x+=.07*(m.x-g.x),g.y+=.07*(m.y-g.y);const e=l.getBoundingClientRect();"rain"===o?X(d,e.width,e.height,T,b.current):"stars"===o?J(d,e.width,e.height,T,g,b.current):"pulse"===o?K(d,e.width,e.height,T,g,b.current):"noise"===o?Q(d,e.width,e.height,T,g,b.current):"grid"===o?Z(d,e.width,e.height,T,g,b.current):"aurora"===o?ee(d,e.width,e.height,T,g,b.current):"silk"===o?te(d,e.width,e.height,T,b.current):"void"===o?oe(d,e.width,e.height,T,g,b.current):"morph"===o?ne(d,e.width,e.height,T,b.current):"fire"===o?re(d,e.width,e.height,T,b.current):"dna"===o?ae(d,e.width,e.height,T,b.current):"terrain"===o?ie(d,e.width,e.height,T,b.current):"circuit"===o?de(d,e.width,e.height,T,b.current):I(d,e.width,e.height,T,g,b.current),T+=.016,A=requestAnimationFrame(R)};return A=requestAnimationFrame(R),{destroy:()=>{cancelAnimationFrame(A),C.disconnect(),"auto"===i&&(w.removeEventListener("change",y),S?.disconnect()),window.removeEventListener("mousemove",E),f.remove(),l.style.position=h}}}var me=ue;function ge(e,t,o,n="#505050",r=100){if(!e||t<=0||o<=0)return[];const a=$(n)??{r:80,g:80,b:80},i=e,s=i.length;return Array.from({length:o},(e,o)=>Array.from({length:t},(e,n)=>({char:i[(o*t+n)%s],r:a.r,g:a.g,b:a.b,a:r})))}function Me(e,{format:t="png",quality:o=.92,scale:n=1}={}){return new Promise((r,a)=>{let i=e;if(1!==n){const t=document.createElement("canvas");t.width=Math.round(e.width*n),t.height=Math.round(e.height*n);const o=t.getContext("2d");if(!o)return void a(new Error("captureSnapshot: could not get 2d context"));o.drawImage(e,0,0,t.width,t.height),i=t}i.toBlob(e=>e?r(e):a(new Error("captureSnapshot: toBlob returned null")),`image/${t}`,o)})}var pe={A:[28,54,99,127,99,99,99],B:[126,99,99,126,99,99,126],C:[62,99,96,96,96,99,62],D:[124,102,99,99,99,102,124],E:[127,96,96,124,96,96,127],F:[127,96,96,124,96,96,96],G:[62,99,96,111,99,99,62],H:[99,99,99,127,99,99,99],I:[127,8,8,8,8,8,127],J:[63,6,6,6,102,102,60],K:[99,102,108,120,108,102,99],L:[96,96,96,96,96,96,127],M:[99,119,107,107,99,99,99],N:[99,115,107,103,99,99,99],O:[62,99,99,99,99,99,62],P:[126,99,99,126,96,96,96],Q:[62,99,99,99,107,102,61],R:[126,99,99,126,108,102,99],S:[62,99,96,62,3,99,62],T:[127,8,8,8,8,8,8],U:[99,99,99,99,99,99,62],V:[99,99,99,99,54,28,8],W:[99,99,99,107,107,54,20],X:[99,54,28,8,28,54,99],Y:[99,99,54,28,8,8,8],Z:[127,3,6,12,24,48,127],a:[0,0,60,3,62,99,61],b:[96,96,124,99,99,99,124],c:[0,0,62,96,96,96,62],d:[3,3,31,99,99,99,31],e:[0,0,62,99,127,96,62],f:[30,48,48,126,48,48,48],g:[0,0,63,99,63,3,62],h:[96,96,124,99,99,99,99],i:[8,0,24,8,8,8,28],j:[4,0,12,4,4,36,24],k:[96,96,102,108,120,108,102],l:[24,8,8,8,8,8,28],m:[0,0,92,107,107,99,99],n:[0,0,94,99,99,99,99],o:[0,0,62,99,99,99,62],p:[0,0,126,99,126,96,96],q:[0,0,63,99,63,3,3],r:[0,0,94,99,96,96,96],s:[0,0,62,96,62,3,124],t:[48,48,126,48,48,48,30],u:[0,0,99,99,99,103,59],v:[0,0,99,99,54,28,8],w:[0,0,99,99,107,54,20],x:[0,0,99,54,28,54,99],y:[0,0,99,99,63,3,62],z:[0,0,127,6,12,24,127],0:[62,99,103,107,115,99,62],1:[8,24,56,8,8,8,62],2:[62,99,3,6,24,48,127],3:[62,99,3,30,3,99,62],4:[6,14,22,38,127,6,6],5:[127,96,126,3,3,99,62],6:[62,99,96,126,99,99,62],7:[127,3,6,12,24,24,24],8:[62,99,99,62,99,99,62],9:[62,99,99,63,3,99,62]," ":[0,0,0,0,0,0,0],"!":[24,24,24,24,24,0,24],"?":[62,99,3,14,8,0,8],".":[0,0,0,0,0,24,24],",":[0,0,0,0,0,24,48],";":[0,24,24,0,24,24,48],":":[0,24,24,0,24,24,0],"-":[0,0,0,62,0,0,0],_:[0,0,0,0,0,0,127],"'":[24,24,32,0,0,0,0],'"':[54,54,36,0,0,0,0],"`":[24,8,0,0,0,0,0],")":[24,12,6,6,6,12,24],"(":[12,24,48,48,48,24,12],"[":[60,48,48,48,48,48,60],"]":[30,6,6,6,6,6,30],"{":[14,24,24,48,24,24,14],"}":[56,12,12,6,12,12,56],"/":[3,6,12,24,48,96,0],"\\":[96,48,24,12,6,3,0],"|":[8,8,8,8,8,8,8],"+":[0,8,8,62,8,8,0],"=":[0,0,62,0,62,0,0],"*":[0,42,28,127,28,42,0],"#":[36,36,127,36,127,36,36],"@":[62,99,111,107,111,96,62],"&":[24,36,24,60,74,68,58],"%":[99,38,4,8,16,50,99],$:[8,62,72,62,9,62,8],"^":[8,20,34,0,0,0,0],"~":[0,0,50,76,0,0,0],"<":[6,12,24,48,24,12,6],">":[48,24,12,6,12,24,48]},ve=[127,65,65,65,65,65,127];function be(e){return pe[e]??pe[e.toUpperCase()]??ve}function xe(e,t={}){if(!e)return"";const{char:o="█",scale:n=1}=t,r=[...o][0]??"█",a=Math.max(1,Math.floor(n)),i=7*a,s=a,c=Array.from({length:i},()=>"");for(let t=0;t<e.length;t++){const o=be(e[t]);for(let e=0;e<7;e++){const t=o[e];let n="";for(let e=6;e>=0;e--)n+=(t>>e&1?r:" ").repeat(a);for(let t=0;t<a;t++)c[e*a+t]+=n}if(t<e.length-1)for(let e=0;e<i;e++)c[e]+=" ".repeat(s)}return c.join("\n")}exports.ART_STYLE_PRESETS=n,exports.BACKGROUND_TYPES=["wave","rain","stars","pulse","noise","grid","aurora","silk","void","morph","fire","dna","terrain","circuit"],exports.CHARSETS=t,exports.CHARSET_SEQUENCES=o,exports.DEFAULT_OPTIONS=a,exports.HOVER_PRESETS={none:{label:"Off",options:{hoverStrength:0,hoverEffect:"spotlight",hoverRadius:.2,hoverColor:"#ffffff"}},subtle:{label:"Subtle",options:{hoverStrength:.25,hoverEffect:"glow",hoverRadius:.12,hoverColor:"#ffffff"}},flashlight:{label:"Flashlight",options:{hoverStrength:.6,hoverEffect:"spotlight",hoverRadius:.15,hoverColor:"#fffbe6"}},magnifier:{label:"Magnifier",options:{hoverStrength:.7,hoverEffect:"magnify",hoverRadius:.12,hoverColor:"#ffffff"}},forceField:{label:"Force Field",options:{hoverStrength:.7,hoverEffect:"repel",hoverRadius:.15,hoverColor:"#a0e8ff"}},neon:{label:"Neon",options:{hoverStrength:.6,hoverEffect:"colorShift",hoverRadius:.15,hoverColor:"#d946ef"}},fire:{label:"Fire",options:{hoverStrength:.7,hoverEffect:"spotlight",hoverRadius:.15,hoverColor:"#ff6b2b"}},ice:{label:"Ice",options:{hoverStrength:.5,hoverEffect:"glow",hoverRadius:.15,hoverColor:"#60d5f7"}},gravity:{label:"Gravity",options:{hoverStrength:.7,hoverEffect:"attract",hoverRadius:.18,hoverColor:"#a5d6ff"}},shatter:{label:"Shatter",options:{hoverStrength:.8,hoverEffect:"shatter",hoverRadius:.14,hoverColor:"#ff6090"}},ghost:{label:"Ghost",options:{hoverStrength:.55,hoverEffect:"trail",hoverRadius:.2,hoverColor:"#b39ddb"}},glitchReveal:{label:"Glitch Reveal",options:{hoverStrength:.8,hoverEffect:"glitchText",hoverRadius:.18,hoverColor:"#a3e635"}}},exports.LIVING_STYLE_PRESETS=r,exports.PALETTE_THEMES={dracula:{name:"Dracula",accent:"#bd93f9",bg:"#282a36",fg:"#f8f8f2"},monokai:{name:"Monokai",accent:"#a6e22e",bg:"#272822",fg:"#f8f8f2"},nord:{name:"Nord",accent:"#88c0d0",bg:"#2e3440",fg:"#eceff4"},catppuccin:{name:"Catppuccin",accent:"#cba6f7",bg:"#1e1e2e",fg:"#cdd6f4"},solarized:{name:"Solarized",accent:"#268bd2",bg:"#002b36",fg:"#839496"},gruvbox:{name:"Gruvbox",accent:"#b8bb26",bg:"#282828",fg:"#ebdbb2"}},exports.asciiBackground=ue,exports.asciiText=function(e,t={},o,n){const r={...a,...t},{frame:i,cols:s}=B(e,r,o,n);if(!i.length||0===s)return"";const c=[];for(const e of i)c.push(e.map(e=>e.char).join(""));return c.join("\n")},exports.asciiTextAnsi=function(e,t={},o,n){const r={...a,...t},{frame:i,cols:s}=B(e,r,o,n);if(!i.length||0===s)return"";const c=[];for(const e of i){let t="";for(const o of e)" "===o.char||o.a<10?t+=" ":t+=`[38;2;${o.r};${o.g};${o.b}m${o.char}`;c.push(t)}return c.join("\n")},exports.asciify=async function(e,t,{fontSize:o,artStyle:r="classic",options:i={}}={}){let s;if("string"==typeof e){const t=new Image;t.crossOrigin="anonymous",await new Promise((o,n)=>{t.onload=()=>o(),t.onerror=()=>n(new Error(`Failed to load image: ${e}`)),t.src=e}),s=t}else e instanceof HTMLImageElement&&!e.complete?(await new Promise((t,o)=>{e.onload=()=>t(),e.onerror=()=>o(new Error("Image failed to load"))}),s=e):s=e;const c=n[r],l=o??i.fontSize??10,h={...a,...c,...i,fontSize:l},f=t.getContext("2d");if(!f)throw new Error("Could not get 2d context from canvas");const{w:d,h:u}=function(e){return e instanceof HTMLVideoElement?{w:e.videoWidth,h:e.videoHeight}:e instanceof HTMLImageElement?{w:e.naturalWidth||e.width,h:e.naturalHeight||e.height}:{w:e.width,h:e.height}}(s),{renderW:m,renderH:g}=Y(d,u),M="undefined"!=typeof window&&window.devicePixelRatio||1,p=8e6,v=m*M*g*M>p?Math.sqrt(p/(m*g)):M;(t.width<m||t.height<g)&&(t.width=Math.round(m*v),t.height=Math.round(g*v));const{frame:b}=B(s,h,m,g);if(h.hoverStrength>0){let e=null,o=!1,n=0;const r=o=>{const n=t.getBoundingClientRect();e={x:(o.clientX-n.left)/n.width,y:(o.clientY-n.top)/n.height}},a=()=>{e=null};t.addEventListener("mousemove",r),t.addEventListener("mouseleave",a);const i=t=>{o||(f.save(),f.setTransform(v,0,0,v,0,0),W(f,b,h,m,g,t/1e3,e),f.restore(),n=requestAnimationFrame(i))};return n=requestAnimationFrame(i),()=>{o=!0,cancelAnimationFrame(n),t.removeEventListener("mousemove",r),t.removeEventListener("mouseleave",a)}}f.save(),f.setTransform(v,0,0,v,0,0),W(f,b,h,m,g),f.restore()},exports.asciifyGif=async function(e,t,{fontSize:o,artStyle:r="classic",options:i={}}={}){const s="string"==typeof e?await fetch(e).then(e=>e.arrayBuffer()):e,c=o??i.fontSize??10,l={...a,...n[r],...i,fontSize:c},h=t.getContext("2d");if(!h)throw new Error("Could not get 2d context from canvas");const{frames:f,fps:d}=await H(s,l,t.width,t.height);let u,m=!1,g=0,M=performance.now();const p=1e3/d,v=e=>{m||(e-M>=p&&(W(h,f[g],l,t.width,t.height),g=(g+1)%f.length,M=e),u=requestAnimationFrame(v))};return u=requestAnimationFrame(v),()=>{m=!0,cancelAnimationFrame(u)}},exports.asciifyLiveVideo=function(e,t,o){return G(e,t,o)},exports.asciifyText=xe,exports.asciifyVideo=G,exports.asciifyWebcam=async function(e,{fontSize:t=10,style:o="classic",options:r={},liveOptions:i,mirror:s=!0,constraints:c={facingMode:"user"},dpr:l}={}){if(!navigator.mediaDevices?.getUserMedia)throw new Error("asciifyWebcam: getUserMedia is not supported in this browser.");const h=await navigator.mediaDevices.getUserMedia({video:c}),f=document.createElement("video");f.srcObject=h,f.muted=!0,f.playsInline=!0,await new Promise((e,t)=>{f.onloadedmetadata=()=>e(),f.onerror=()=>t(new Error("asciifyWebcam: video stream failed to load.")),f.play().catch(t)});const d={...a,...n[o],...r,fontSize:t},u=e.getContext("2d");if(!u)throw new Error("asciifyWebcam: could not get 2d context from canvas.");const m=l??("undefined"!=typeof window?window.devicePixelRatio:1)??1;1!==m&&u.scale(m,m);let g=null;const M={x:.5,y:.5,intensity:0},p=t=>{const o=e.getBoundingClientRect();g={x:(t.clientX-o.left)/o.width,y:(t.clientY-o.top)/o.height}},v=()=>{g=null};d.hoverStrength>0&&(e.addEventListener("mousemove",p),e.addEventListener("mouseleave",v));let b,x=!1;const w=performance.now(),y=t=>{if(!x){if(f.readyState>=f.HAVE_CURRENT_DATA){const o=e.width/m,n=e.height/m,r=(t-w)/1e3,a=i?{...d,...i()}:d;a.hoverStrength>0?(e.addEventListener("mousemove",p),e.addEventListener("mouseleave",v)):(e.removeEventListener("mousemove",p),e.removeEventListener("mouseleave",v));const{frame:c}=B(f,a,o,n);if(g){const e=g.x-M.x,t=g.y-M.y,o=Math.sqrt(e*e+t*t),n=Math.min(.25,.06+.8*o);M.x+=e*n,M.y+=t*n,M.intensity+=.12*(1-M.intensity)}else M.intensity*=.965,M.intensity<.003&&(M.intensity=0);const l=M.intensity>.003?{x:M.x,y:M.y,intensity:M.intensity}:null;s?(u.save(),u.scale(-1,1),u.translate(-o,0),W(u,c,a,o,n,r,l),u.restore()):W(u,c,a,o,n,r,l)}b=requestAnimationFrame(y)}};return b=requestAnimationFrame(y),()=>{x=!0,cancelAnimationFrame(b),e.removeEventListener("mousemove",p),e.removeEventListener("mouseleave",v),h.getTracks().forEach(e=>e.stop()),f.srcObject=null}},exports.buildTextFrame=ge,exports.captureSnapshot=Me,exports.createVideoScrollScrub=_,exports.gifToAsciiFrames=H,exports.imageToAsciiFrame=B,exports.mountWaveBackground=me,exports.renderAuroraBackground=ee,exports.renderCircuitBackground=de,exports.renderDnaBackground=ae,exports.renderFireBackground=re,exports.renderFrameToCanvas=W,exports.renderGridBackground=Z,exports.renderMorphBackground=ne,exports.renderNoiseBackground=Q,exports.renderPulseBackground=K,exports.renderRainBackground=X,exports.renderSilkBackground=te,exports.renderStarsBackground=J,exports.renderTerrainBackground=ie,exports.renderTextBackground=function(e,t,o,n,r={},i){const{fontSize:s=10,lineHeight:c=1.6,color:l="#505050",opacity:h=100,hoverEffect:f="spotlight",hoverStrength:d=.85,hoverRadius:u=.18,hoverColor:m="#d4ff00"}=r;W(e,ge(n,Math.max(1,Math.floor(t/s)),Math.max(1,Math.floor(o/(s*c))),l,h),{...a,hoverEffect:f,hoverStrength:d,hoverRadius:u,hoverColor:m},t,o,0,i??null)},exports.renderTextToCanvas=function(e,t,o={}){const{color:n="#d4ff00",bgColor:r,fontSize:a=10}=o,i=xe(t,o);if(!i)return;const s=i.split("\n"),c=Math.max(...s.map(e=>[...e].length));e.width=Math.ceil(c*a*.6),e.height=Math.ceil(s.length*a);const l=e.getContext("2d");r&&"transparent"!==r?(l.fillStyle=r,l.fillRect(0,0,e.width,e.height)):l.clearRect(0,0,e.width,e.height),l.fillStyle=n,l.font=`${a}px monospace`,l.textBaseline="top",s.forEach((e,t)=>l.fillText(e,0,t*a))},exports.renderVoidBackground=oe,exports.renderWaveBackground=I,exports.snapshotAndDownload=async function(e,t={}){const{filename:o="asciify-snapshot",format:n="png",...r}=t,a=await Me(e,{format:n,...r}),i="jpeg"===n?"jpg":n,s=document.createElement("a");s.href=URL.createObjectURL(a),s.download=`${o}.${i}`,s.click(),setTimeout(()=>URL.revokeObjectURL(s.href),1e4)},exports.videoToAsciiFrames=q;//# sourceMappingURL=index.cjs.map