asciify-engine 2.0.1 → 4.0.0

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.
@@ -1,401 +0,0 @@
1
- interface WaveBackgroundOptions {
2
- /** Font size in CSS pixels (default: 13) */
3
- fontSize?: number;
4
- /** Character aspect ratio width/height (default: 0.62) */
5
- charAspect?: number;
6
- /** Line height multiplier (default: 1.4) */
7
- lineHeightRatio?: number;
8
- /** Character set from dark→bright (default: ' .:-=+*#%@') */
9
- chars?: string;
10
- /** Base colour — use '{a}' as alpha placeholder */
11
- baseColor?: string;
12
- /** Accent colour applied near the cursor and on wave peaks (default: '#d4ff00') */
13
- accentColor?: string;
14
- /** Accent threshold: normalised intensity above which accent kicks in (default: 0.52) */
15
- accentThreshold?: number;
16
- /** How strongly the mouse influences local intensity (default: 0.55) */
17
- mouseInfluence?: number;
18
- /** Radial falloff for mouse influence (default: 2.8) */
19
- mouseFalloff?: number;
20
- /** Base wave animation speed (default: 1) */
21
- speed?: number;
22
- /** Enable vortex swirl effect around cursor (default: true) */
23
- vortex?: boolean;
24
- /** Enable sparkle / pop flicker (default: true) */
25
- sparkles?: boolean;
26
- /** Enable a slow global breathe pulse (default: true) */
27
- breathe?: boolean;
28
- /** Light mode: swap fill colours to dark-on-light (default: false) */
29
- lightMode?: boolean;
30
- }
31
- declare function renderWaveBackground(ctx: CanvasRenderingContext2D, width: number, height: number, time: number, mousePos?: {
32
- x: number;
33
- y: number;
34
- }, options?: WaveBackgroundOptions): void;
35
-
36
- interface RainBackgroundOptions {
37
- fontSize?: number;
38
- /** Characters drawn in columns */
39
- chars?: string;
40
- /** Head / accent colour (default: '#d4ff00') */
41
- accentColor?: string;
42
- /** Custom character colour */
43
- color?: string;
44
- /** Global speed multiplier (default: 1) */
45
- speed?: number;
46
- /** Fraction of columns active at once 0-1 (default: 0.55) */
47
- density?: number;
48
- /** Number of cells in the fading tail (default: 14) */
49
- tailLength?: number;
50
- /** Light mode (default: false) */
51
- lightMode?: boolean;
52
- }
53
- declare function renderRainBackground(ctx: CanvasRenderingContext2D, width: number, height: number, time: number, options?: RainBackgroundOptions): void;
54
-
55
- interface StarsBackgroundOptions {
56
- fontSize?: number;
57
- /** Characters used as stars */
58
- chars?: string;
59
- /** Accent/trail colour for fast near-edge stars (default: '#d4ff00') */
60
- accentColor?: string;
61
- /** Custom base colour */
62
- color?: string;
63
- /** Global speed multiplier (default: 1) */
64
- speed?: number;
65
- /** Number of star particles (default: 180) */
66
- count?: number;
67
- /** Light mode (default: false) */
68
- lightMode?: boolean;
69
- }
70
- declare function renderStarsBackground(ctx: CanvasRenderingContext2D, width: number, height: number, time: number, mousePos?: {
71
- x: number;
72
- y: number;
73
- }, options?: StarsBackgroundOptions): void;
74
-
75
- interface PulseBackgroundOptions {
76
- fontSize?: number;
77
- /** Characters to tile (default: '. · ○ ◎ ●') */
78
- chars?: string;
79
- /** Ring peak colour (default: '#00ffcc') */
80
- accentColor?: string;
81
- /** Custom base colour */
82
- color?: string;
83
- /** Number of simultaneous rings (default: 5) */
84
- rings?: number;
85
- /** Animation speed (default: 1) */
86
- speed?: number;
87
- /** Ring edge sharpness 1–10 (default: 4) */
88
- sharpness?: number;
89
- /** Light mode (default: false) */
90
- lightMode?: boolean;
91
- }
92
- declare function renderPulseBackground(ctx: CanvasRenderingContext2D, width: number, height: number, time: number, mousePos?: {
93
- x: number;
94
- y: number;
95
- }, options?: PulseBackgroundOptions): void;
96
-
97
- interface NoiseBackgroundOptions {
98
- /** Font size in CSS pixels (default: 14). */
99
- fontSize?: number;
100
- /** Character ramp dark → bright (default: ' .·:;=+*#%@░▒▓'). */
101
- chars?: string;
102
- /** Accent colour on intensity peaks (default: '#d4ff00'). */
103
- accentColor?: string;
104
- /** Custom base character colour (any CSS colour string). */
105
- color?: string;
106
- /** Number of noise octaves for FBM detail (default: 4, max: 6). */
107
- octaves?: number;
108
- /** Drift / scroll speed (default: 1). */
109
- speed?: number;
110
- /** Noise scale — lower = larger blobs (default: 1). */
111
- scale?: number;
112
- /** Accent threshold 0-1 (default: 0.78). */
113
- accentThreshold?: number;
114
- /** Mouse warp radius 0-1 (default: 0.3). */
115
- mouseWarp?: number;
116
- /** Light mode (default: false). */
117
- lightMode?: boolean;
118
- }
119
- declare function renderNoiseBackground(ctx: CanvasRenderingContext2D, width: number, height: number, time: number, mousePos?: {
120
- x: number;
121
- y: number;
122
- }, options?: NoiseBackgroundOptions): void;
123
-
124
- interface GridBackgroundOptions {
125
- /** Font size in CSS pixels (default: 12). */
126
- fontSize?: number;
127
- /** Character set (default: '·-=+|/'). */
128
- chars?: string;
129
- /** Accent / scan-band colour (default: '#d4ff00'). */
130
- accentColor?: string;
131
- /** Custom base character colour (any CSS colour string). */
132
- color?: string;
133
- /** Number of scan bands visible at once (default: 3). */
134
- bands?: number;
135
- /** Band travel speed (default: 1). */
136
- speed?: number;
137
- /** Band width as fraction of canvas height (default: 0.12). */
138
- bandWidth?: number;
139
- /** Enable cursor disruption glitch zone (default: true). */
140
- glitch?: boolean;
141
- /** Light mode (default: false). */
142
- lightMode?: boolean;
143
- }
144
- declare function renderGridBackground(ctx: CanvasRenderingContext2D, width: number, height: number, time: number, mousePos?: {
145
- x: number;
146
- y: number;
147
- }, options?: GridBackgroundOptions): void;
148
-
149
- interface AuroraBackgroundOptions {
150
- /** Character grid density. Default 14. */
151
- fontSize?: number;
152
- /** Character ramp from sparse to dense. */
153
- chars?: string;
154
- /** Base character color. Default theme-aware white/black. */
155
- color?: string;
156
- /** Accent color for intensity peaks. Default '#d4ff00'. */
157
- accentColor?: string;
158
- /** Animation speed multiplier. Default 1. */
159
- speed?: number;
160
- /** Number of wave layers stacked. More = richer interference. Default 5. */
161
- layers?: number;
162
- /** Wave spread/softness — higher = broader, more diffuse bands. Default 1.2. */
163
- softness?: number;
164
- /** Mouse distortion radius (0–1). Elegant ripple that follows the cursor. Default 0.2. */
165
- mouseRipple?: number;
166
- /** Force light mode (dark chars on light bg). Default false. */
167
- lightMode?: boolean;
168
- }
169
- declare function renderAuroraBackground(ctx: CanvasRenderingContext2D, width: number, height: number, time: number, mousePos?: {
170
- x: number;
171
- y: number;
172
- }, options?: AuroraBackgroundOptions): void;
173
-
174
- interface SilkBackgroundOptions {
175
- /** Character grid density. Default 13. */
176
- fontSize?: number;
177
- /** Base character color. Default theme-aware white/black. */
178
- color?: string;
179
- /** Accent color for intensity peaks. Default '#d4ff00'. */
180
- accentColor?: string;
181
- /** Animation speed multiplier. Default 0.4 (intentionally slow). */
182
- speed?: number;
183
- /** Number of flow-field layers. More = richer ribbons. Default 4. */
184
- layers?: number;
185
- /** Flow turbulence (0–2). Higher = more folded, tangled ribbons. Default 0.8. */
186
- turbulence?: number;
187
- /** Force light mode. Default false. */
188
- lightMode?: boolean;
189
- }
190
- declare function renderSilkBackground(ctx: CanvasRenderingContext2D, width: number, height: number, time: number, options?: SilkBackgroundOptions): void;
191
-
192
- interface VoidBackgroundOptions {
193
- /** Character grid density. Default 13. */
194
- fontSize?: number;
195
- /** Character ramp. Default space-to-dense. */
196
- chars?: string;
197
- /** Base character color. Default theme-aware. */
198
- color?: string;
199
- /** Accent color for the inner singularity ring. Default '#d4ff00'. */
200
- accentColor?: string;
201
- /** Animation speed multiplier. Default 1. */
202
- speed?: number;
203
- /** Gravity well radius (fraction of canvas width). Default 0.38. */
204
- radius?: number;
205
- /** Spiral tightness — higher = more rotation per unit distance. Default 3. */
206
- swirl?: number;
207
- /** Force light mode. Default false. */
208
- lightMode?: boolean;
209
- }
210
- declare function renderVoidBackground(ctx: CanvasRenderingContext2D, width: number, height: number, time: number, mousePos?: {
211
- x: number;
212
- y: number;
213
- }, options?: VoidBackgroundOptions): void;
214
-
215
- interface MorphBackgroundOptions {
216
- /** Character grid density. Default 14. */
217
- fontSize?: number;
218
- /** Character ramp. Default clean gradient. */
219
- chars?: string;
220
- /** Base character color. Default theme-aware. */
221
- color?: string;
222
- /** Accent color for intensity peaks. Default '#d4ff00'. */
223
- accentColor?: string;
224
- /** Animation speed multiplier. Default 0.5 (intentionally slow). */
225
- speed?: number;
226
- /** How many frequency harmonics per cell. More = richer shimmer. Default 3. */
227
- harmonics?: number;
228
- /** Force light mode. Default false. */
229
- lightMode?: boolean;
230
- }
231
- declare function renderMorphBackground(ctx: CanvasRenderingContext2D, width: number, height: number, time: number, options?: MorphBackgroundOptions): void;
232
-
233
- interface FireBackgroundOptions {
234
- /** Font size in CSS pixels (default: 13) */
235
- fontSize?: number;
236
- /** Characters mapped from cool→hot (default: ' .,:;i+xX#&@') */
237
- chars?: string;
238
- /** Base flame colour (default: '#ff4500') */
239
- color?: string;
240
- /** Secondary hot-tip colour (default: '#ffe066') */
241
- hotColor?: string;
242
- /** Flame intensity 0–1 (default: 0.85) */
243
- intensity?: number;
244
- /** Horizontal wind force -1..1 (default: 0) */
245
- wind?: number;
246
- /** Global speed multiplier (default: 1) */
247
- speed?: number;
248
- /** Light mode: invert text colours (default: false) */
249
- lightMode?: boolean;
250
- }
251
- declare function renderFireBackground(ctx: CanvasRenderingContext2D, width: number, height: number, time: number, options?: FireBackgroundOptions): void;
252
-
253
- interface DnaBackgroundOptions {
254
- /** Font size in CSS pixels (default: 13) */
255
- fontSize?: number;
256
- /** Characters for strand nodes (default: 'ATCG') */
257
- baseChars?: string;
258
- /** Characters for the connectors between strands (default: '-=≡') */
259
- bridgeChars?: string;
260
- /** Primary strand colour (default: '#00e5ff') */
261
- color?: string;
262
- /** Secondary strand colour (default: '#ff4081') */
263
- color2?: string;
264
- /** Bridge / connector colour (default: '#88ffcc') */
265
- bridgeColor?: string;
266
- /** Speed multiplier (default: 1) */
267
- speed?: number;
268
- /** Number of helix columns (default: auto, ~1 per 80px) */
269
- helixCount?: number;
270
- /** Light mode (default: false) */
271
- lightMode?: boolean;
272
- }
273
- declare function renderDnaBackground(ctx: CanvasRenderingContext2D, width: number, height: number, time: number, options?: DnaBackgroundOptions): void;
274
-
275
- interface TerrainBackgroundOptions {
276
- /** Font size in CSS pixels (default: 13) */
277
- fontSize?: number;
278
- /** Characters for terrain density (default: ' .,:;+*#@') */
279
- chars?: string;
280
- /** Foreground ground colour (default: '#4caf50') */
281
- color?: string;
282
- /** Sky / star colour (default: '#1a237e') */
283
- skyColor?: string;
284
- /** Peak / snow-cap colour (default: '#e0e0e0') */
285
- peakColor?: string;
286
- /** Horizontal scroll speed (default: 1) */
287
- speed?: number;
288
- /** Terrain roughness 0.1–1 (default: 0.55) */
289
- roughness?: number;
290
- /** Mountain height fraction 0–1 (default: 0.55) */
291
- heightScale?: number;
292
- /** Show faint background stars (default: true) */
293
- stars?: boolean;
294
- /** Light mode (default: false) */
295
- lightMode?: boolean;
296
- }
297
- declare function renderTerrainBackground(ctx: CanvasRenderingContext2D, width: number, height: number, time: number, options?: TerrainBackgroundOptions): void;
298
-
299
- interface CircuitBackgroundOptions {
300
- /** Font size in CSS pixels (default: 13) */
301
- fontSize?: number;
302
- /** Trace characters (default: '─│┌┐└┘├┤┬┴┼') */
303
- chars?: string;
304
- /** Trace colour (default: '#00ff88') */
305
- color?: string;
306
- /** Signal pulse colour (default: '#ffffff') */
307
- pulseColor?: string;
308
- /** Fraction of cells that have a trace (default: 0.38) */
309
- density?: number;
310
- /** Signal pulse speed (default: 1) */
311
- speed?: number;
312
- /** Light mode (default: false) */
313
- lightMode?: boolean;
314
- }
315
- declare function renderCircuitBackground(ctx: CanvasRenderingContext2D, width: number, height: number, time: number, options?: CircuitBackgroundOptions): void;
316
-
317
- /**
318
- * ASCII Background — public entry point for the backgrounds sub-system.
319
- *
320
- * Exports:
321
- * - All 10 render functions
322
- * - All 10 option interfaces
323
- * - `AsciiBackgroundOptions` — combined union type + mount options
324
- * - `asciiBackground()` — the drop-in mount helper
325
- * - `mountWaveBackground` / `MountWaveOptions` — deprecated aliases
326
- */
327
-
328
- /**
329
- * Combined options for `asciiBackground()`. Extends all 10 background option
330
- * interfaces so every background's options can be passed through one object.
331
- */
332
- interface AsciiBackgroundOptions extends WaveBackgroundOptions, RainBackgroundOptions, StarsBackgroundOptions, PulseBackgroundOptions, NoiseBackgroundOptions, GridBackgroundOptions, AuroraBackgroundOptions, SilkBackgroundOptions, VoidBackgroundOptions, MorphBackgroundOptions, FireBackgroundOptions, DnaBackgroundOptions, TerrainBackgroundOptions, CircuitBackgroundOptions {
333
- /**
334
- * Which background to render (default: 'wave').
335
- * - 'wave' — interactive ASCII field with vortex, sparkles, breathe
336
- * - 'rain' — digital column rain (Matrix-style falling characters)
337
- * - 'stars' — 3D star-warp / hyperspace chars fly toward the viewer
338
- * - 'pulse' — concentric ASCII ripples radiating from the mouse
339
- * - 'noise' — slow-drifting organic fractal noise field
340
- * - 'grid' — CRT-style horizontal scan bands with cursor glitch zone
341
- * - 'aurora' — premium slow-drifting light bands
342
- * - 'silk' — smooth directional flow-field ribbons
343
- * - 'void' — gravitational singularity follows the cursor
344
- * - 'morph' — per-cell multi-frequency shimmer
345
- * - 'fire' — upward cellular-automata flame simulation
346
- * - 'dna' — double-helix strand scrolling with base-pair chars
347
- * - 'terrain' — scrolling ASCII side-scroll heightmap landscape
348
- * - 'circuit' — procedural PCB traces with traveling signal pulses
349
- */
350
- type?: 'wave' | 'rain' | 'stars' | 'pulse' | 'noise' | 'grid' | 'aurora' | 'silk' | 'void' | 'morph' | 'fire' | 'dna' | 'terrain' | 'circuit';
351
- /** CSS opacity applied to the canvas element (default: 0.2) */
352
- opacity?: number;
353
- /** Extra CSS class names added to the injected canvas */
354
- className?: string;
355
- /** z-index of the canvas (default: 0) */
356
- zIndex?: number;
357
- /**
358
- * Colour scheme handling (default: 'auto').
359
- * - 'auto' — follows system prefers-color-scheme and updates live
360
- * - 'dark' — always render bright chars on dark background
361
- * - 'light' — always render dark chars on light background
362
- */
363
- colorScheme?: 'auto' | 'light' | 'dark';
364
- /**
365
- * Custom character colour. Accepts any CSS colour string: hex, rgb(), hsl().
366
- * Overrides the default white/black for ASCII chars.
367
- * @example '#6b8700'
368
- */
369
- color?: string;
370
- }
371
- /**
372
- * All supported background type identifiers — single source of truth for
373
- * counts, type-safe option values, and documentation.
374
- */
375
- declare const BACKGROUND_TYPES: readonly ["wave", "rain", "stars", "pulse", "noise", "grid", "aurora", "silk", "void", "morph", "fire", "dna", "terrain", "circuit"];
376
- type BackgroundType = typeof BACKGROUND_TYPES[number];
377
- /**
378
- * Drop-in helper that mounts an interactive ASCII background onto any element.
379
- * Injects a canvas, wires DPR resize, mouse tracking, and the RAF loop.
380
- * Auto-detects light/dark mode and stays in sync if the system theme changes.
381
- *
382
- * Returns a `destroy()` function to clean everything up.
383
- *
384
- * @example
385
- * ```ts
386
- * // 1 line:
387
- * const { destroy } = asciiBackground('#hero', { opacity: 0.2 });
388
- *
389
- * // React — return destroy as cleanup:
390
- * useEffect(() => asciiBackground(ref.current).destroy, []);
391
- * ```
392
- */
393
- declare function asciiBackground(target: string | HTMLElement | null, options?: AsciiBackgroundOptions): {
394
- destroy: () => void;
395
- };
396
- /** @deprecated Use `asciiBackground` instead. */
397
- declare const mountWaveBackground: typeof asciiBackground;
398
- /** @deprecated Use `AsciiBackgroundOptions` instead. */
399
- type MountWaveOptions = AsciiBackgroundOptions;
400
-
401
- export { type AsciiBackgroundOptions, type AuroraBackgroundOptions, BACKGROUND_TYPES, type BackgroundType, type CircuitBackgroundOptions, type DnaBackgroundOptions, type FireBackgroundOptions, type GridBackgroundOptions, type MorphBackgroundOptions, type MountWaveOptions, type NoiseBackgroundOptions, type PulseBackgroundOptions, type RainBackgroundOptions, type SilkBackgroundOptions, type StarsBackgroundOptions, type TerrainBackgroundOptions, type VoidBackgroundOptions, type WaveBackgroundOptions, asciiBackground, mountWaveBackground, renderAuroraBackground, renderCircuitBackground, renderDnaBackground, renderFireBackground, renderGridBackground, renderMorphBackground, renderNoiseBackground, renderPulseBackground, renderRainBackground, renderSilkBackground, renderStarsBackground, renderTerrainBackground, renderVoidBackground, renderWaveBackground };
@@ -1 +0,0 @@
1
- function t(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 o(t,e,o){return t+(e-t)*o}function n(t,e){let o=127*t+311*e;return o^=o>>13,(o*(o*o*15731+789221)+1376312589&2147483647)/2147483647}function l(t,l){const a=Math.floor(t),i=Math.floor(l),r=l-i,c=e(t-a),s=e(r),h=n(a,i),f=n(a+1,i),g=n(a,i+1),M=n(a+1,i+1);return o(o(h,f,c),o(g,M,c),s)}function a(t,e){return(.5*l(t,e)+.25*l(2.1*t,2.1*e)+.125*l(4.3*t,4.3*e))/.875}function i(t,e,o,l,i={x:.5,y:.5},r={}){const{fontSize:c=13,charAspect:s=.62,lineHeightRatio:h=1.4,chars:f=" .:-=+*#%@",baseColor:g=null,accentColor:M,accentThreshold:d=.52,mouseInfluence:u=.55,mouseFalloff:p=2.8,speed:$=1,vortex:b=!0,sparkles:m=!0,breathe:x=!0,lightMode:y=!1}=r,S=M??(y?"#6b8700":"#d4ff00"),w=c*s,v=c*h,C=Math.ceil(e/w),I=Math.ceil(o/v),A=i.x,B=i.y;let T=212,R=255,z=0;{const t=S.replace("#","");6===t.length&&(T=parseInt(t.slice(0,2),16),R=parseInt(t.slice(2,4),16),z=parseInt(t.slice(4,6),16))}t.clearRect(0,0,e,o),t.font=`${c}px "JetBrains Mono", monospace`,t.textBaseline="top";const P=l*$,q=x?.12*(.5*Math.sin(.22*P)+.5):0;for(let e=0;e<I;e++)for(let o=0;o<C;o++){const l=o/C,i=e/I,r=.045,c=.08*P,s=.06,h=.45*((.5*Math.sin(.08*o+.05*e+.6*P)+.5+(.5*Math.sin(.03*o-.07*e+.4*P)+.5)+(.5*Math.sin(.05*o+.03*e+.8*P)+.5))/3)+.35*(.5*a(o*r+c,e*r*1.4-.7*c)+.5)+.2*(.5*Math.sin((o+.65*e)*s+1.1*P)+.5)+q,M=l-A,$=i-B,x=Math.sqrt(M*M+$*$);let S=0;if(b&&x<.35){const t=Math.atan2($,M),e=Math.sin(4*t+2.2*P-14*x),o=Math.max(0,1-x/.35);S=e*o*o*.22}const k=h*(1-u)+(Math.max(0,1-x*p)+.5*S)*u+.15*S,E=Math.min(1,Math.max(0,k));let F=E;if(m&&E>.72){const t=Math.floor(8*P),l=n(7*o+3*t,11*e+t);l>.88&&(F=Math.min(1,E+4*(l-.88)))}const L=Math.floor(F*(f.length-1));if(" "===f[L])continue;const J=.015+.07*F;if(F>d){const e=Math.min(y?.9:.28,J*(y?14:2.8));t.fillStyle=`rgba(${T},${R},${z},${e})`}else t.fillStyle=g?g.replace("{a}",String(J)):y?`rgba(55,55,55,${7*J})`:`rgba(255,255,255,${J})`;t.fillText(f[L],o*w,e*v)}}function r(e,o,l,a,i={}){const{fontSize:r=13,chars:c="0123456789ABCDEF@#$&*+=/<>",accentColor:s,color:h,speed:f=1,density:g=.55,tailLength:M=14,lightMode:d=!1}=i,u=s??(d?"#6b8700":"#d4ff00"),p=.62*r,$=1.4*r,b=Math.ceil(o/p),m=Math.ceil(l/$);e.clearRect(0,0,o,l),e.font=`${r}px monospace`,e.textBaseline="top";let x=255,y=255,S=255;if(d&&(x=55,y=55,S=55),h){const e=t(h);e&&(x=e.r,y=e.g,S=e.b)}let w=212,v=255,C=0;const I=t(u);I&&(w=I.r,v=I.g,C=I.b);const A=m+M;for(let t=0;t<b;t++){if(n(17*t,3)>g)continue;const o=(.5+1.5*n(31*t,7))*f,l=n(13*t,11)*A,i=Math.floor((a*o*7+l)%A),r=t*p;for(let o=0;o<=M;o++){const l=i-(M-o);if(l<0||l>=m)continue;const s=l*$,h=n(53*t+Math.floor(5*a+o),7*l),f=c[Math.floor(h*c.length)],g=o/M;if(o===M)e.fillStyle=`rgba(${w},${v},${C},${d?.7:.85})`;else{const t=d?.85*g:.15*g;e.fillStyle=`rgba(${x},${y},${S},${t})`}e.fillText(f,r,s)}}}function c(e,o,l,a,i={x:.5,y:.5},r={}){const{fontSize:c=14,chars:s=" . · * + ° ★",accentColor:h,color:f,speed:g=1,count:M=180,lightMode:d=!1}=r,u=h??(d?"#6b8700":"#d4ff00");e.clearRect(0,0,o,l),e.textBaseline="middle",e.textAlign="center";const p=o*(.2+.6*i.x),$=l*(.2+.6*i.y),b=.65*Math.sqrt(o*o+l*l);let m=255,x=255,y=255;if(d&&(m=55,x=55,y=55),f){const e=t(f);e&&(m=e.r,x=e.g,y=e.b)}let S=212,w=255,v=0;const C=t(u);C&&(S=C.r,w=C.g,v=C.b);const I=s.replace(/ /g,"").split("");if(0!==I.length){for(let t=0;t<M;t++){const i=n(17*t,3)*Math.PI*2,r=(a*(.15+.85*n(31*t,7))*g*.22+n(13*t,11))%1,s=p+Math.cos(i)*r*b,h=$+Math.sin(i)*r*b;if(s<-20||s>o+20||h<-20||h>l+20)continue;const f=Math.max(6,c*(.4+.9*r));e.font=`${f}px monospace`;const M=I[Math.min(I.length-1,Math.floor(r*I.length))],u=r>.72,C=d?.85*r:.2*r;e.fillStyle=u?`rgba(${S},${w},${v},${Math.min(d?.92:.32,2.2*C)})`:`rgba(${m},${x},${y},${C})`,e.fillText(M,s,h)}e.textAlign="left"}}function s(e,o,n,l,a={x:.5,y:.5},i={}){const{fontSize:r=14,chars:c=". · ○ ◎ ●",accentColor:s,color:h,rings:f=5,speed:g=1,sharpness:M=4,lightMode:d=!1}=i,u=s??(d?"#007a5e":"#00ffcc");e.clearRect(0,0,o,n),e.textBaseline="middle",e.textAlign="center";const p=o*a.x,$=n*a.y,b=1.6*Math.sqrt(p*p+$*$)+.2*Math.sqrt(o*o+n*n);let m=255,x=255,y=255;if(d&&(m=55,x=55,y=55),h){const e=t(h);e&&(m=e.r,x=e.g,y=e.b)}let S=0,w=255,v=204;const C=t(u);C&&(S=C.r,w=C.g,v=C.b);const I=c.replace(/ /g,"").split("");if(0===I.length)return;const A=Math.ceil(o/r),B=Math.ceil(n/r);for(let t=0;t<B;t++)for(let o=0;o<A;o++){const n=o*r+.5*r,a=t*r+.5*r,i=n-p,c=a-$,s=Math.sqrt(i*i+c*c)/b;let h=0;for(let t=0;t<f;t++){const e=(l*g*.38+t/f)%1,o=Math.abs(s-e),n=Math.max(0,1-o*b/(r*(12-M)));h+=Math.cos(n*Math.PI*.5)*n}if(h=Math.min(1,h),h<.02)continue;const u=h>.6;e.font=`${r}px monospace`;const C=Math.floor(h*(I.length-1)),A=I[Math.min(C,I.length-1)],B=d?.88*h:.22*h;e.fillStyle=u?`rgba(${S},${w},${v},${Math.min(d?.95:.4,.55*h)})`:`rgba(${m},${x},${y},${B})`,e.fillText(A,n,a)}e.textAlign="left"}function h(e,o,n,a,i={x:.5,y:.5},r={}){const{fontSize:c=14,chars:s=" .·:;=+*#%@░▒▓",accentColor:h,color:f,octaves:g=4,speed:M=1,scale:d=1,accentThreshold:u=.78,mouseWarp:p=.3,lightMode:$=!1}=r,b=h??($?"#6b8700":"#d4ff00"),m=.62*c,x=1.4*c,y=Math.ceil(o/m),S=Math.ceil(n/x);e.clearRect(0,0,o,n),e.font=`${c}px monospace`,e.textBaseline="top";let w=255,v=255,C=255;if($&&(w=55,v=55,C=55),f){const e=t(f);e&&(w=e.r,v=e.g,C=e.b)}let I=212,A=255,B=0;const T=t(b);T&&(I=T.r,A=T.g,B=T.b);const R=.035*d,z=a*M,P=Math.min(6,Math.max(1,g)),q=(t,e)=>{let o=0,n=.5,a=1,i=0;for(let r=0;r<P;r++)o+=l(t*a,e*a)*n,i+=n,n*=.5,a*=2.1;return o/i};for(let t=0;t<S;t++)for(let o=0;o<y;o++){const n=o*R+.06*z,l=t*R*1.3-.04*z,a=o/y-i.x,r=t/S-i.y,c=Math.sqrt(a*a+r*r),h=p>0?.12*Math.max(0,1-c/p):0,f=.5*q(n+h*Math.sin(1.3*z+8*r),l+h*Math.cos(.9*z+8*a))+.5;if(f<.12)continue;const g=s[Math.floor(f*(s.length-1))];if(" "===g)continue;const M=f>u,d=$?.82*f:.13*f;e.fillStyle=M?`rgba(${I},${A},${B},${$?.92:.28})`:`rgba(${w},${v},${C},${d})`,e.fillText(g,o*m,t*x)}}function f(e,o,l,a,i={x:.5,y:.5},r={}){const{fontSize:c=12,chars:s="·-=+|/",accentColor:h,color:f,bands:g=3,speed:M=1,bandWidth:d=.12,glitch:u=!0,lightMode:p=!1}=r,$=h??(p?"#6b8700":"#d4ff00"),b=.62*c,m=1.4*c,x=Math.ceil(o/b),y=Math.ceil(l/m);e.clearRect(0,0,o,l),e.font=`${c}px monospace`,e.textBaseline="top";let S=255,w=255,v=255;if(p&&(S=55,w=55,v=55),f){const e=t(f);e&&(S=e.r,w=e.g,v=e.b)}let C=212,I=255,A=0;const B=t($);B&&(C=B.r,I=B.g,A=B.b);const T=a*M;for(let t=0;t<y;t++)for(let o=0;o<x;o++){const l=t/y,a=((l*g-.5*T)%1+1)%1,r=Math.max(0,1-a/d),c=.35*(.5*n(3*o,7*t)+.5);let h=0;if(u){const e=o/x-i.x,a=l-i.y,r=Math.sqrt(e*e+a*a);if(r<.18){const e=n(11*o+Math.floor(12*T),5*t);h=Math.max(0,1-r/.18)*(e>.5?e-.3:0)}}const f=Math.min(1,c+.8*r+.6*h);if(f<.04)continue;const M=s[Math.floor(f*(s.length-1))],$=r>.55,B=p?.82*f:.12*f;e.fillStyle=$?`rgba(${C},${I},${A},${p?.92:.28})`:`rgba(${S},${w},${v},${B})`,e.fillText(M,o*b,t*m)}}function g(e,o,l,a,i={x:.5,y:.5},r={}){const{fontSize:c=14,chars:s=" ·∙•:;+=≡≣#@",color:h,accentColor:f,speed:g=1,layers:M=5,softness:d=1.2,mouseRipple:u=.2,lightMode:p=!1}=r,$=f??(p?"#6b8700":"#d4ff00"),b=.62*c,m=1.4*c,x=Math.ceil(o/b),y=Math.ceil(l/m);e.clearRect(0,0,o,l),e.font=`${c}px monospace`,e.textBaseline="top";let S=255,w=255,v=255;if(p&&(S=55,w=55,v=55),h){const e=t(h);e&&(S=e.r,w=e.g,v=e.b)}let C=212,I=255,A=0;const B=t($);B&&(C=B.r,I=B.g,A=B.b);const T=a*g,R=[];for(let t=0;t<M;t++){const e=n(17*t,31*t+7),o=n(23*t+5,11*t);R.push({fx:.8+2.2*e,fy:1.2+1.8*o,phase:e*Math.PI*4,dt:(.3+.5*n(7*t,13*t+3))*(t%2==0?1:-1),amp:.55+.45*n(29*t,3*t)})}for(let t=0;t<y;t++){const o=t/y;for(let n=0;n<x;n++){const l=n/x,a=l-i.x,r=o-i.y,c=Math.sqrt(a*a+r*r),h=u*Math.exp(-c*c/.06),f=l+a*h,g=o+r*h;let $=0,y=0;for(let t=0;t<M;t++){const{fx:e,fy:o,phase:n,dt:l,amp:a}=R[t];$+=Math.sin(f*e*Math.PI*2+T*l+n)*Math.cos(g*o*Math.PI*2+T*l*.7+1.3*n)*a,y+=a}const B=$/y,z=.5+.5*Math.tanh(B*d*2.2);if(z<.12)continue;const P=(z-.12)/.88,q=s[Math.min(s.length-1,Math.floor(P*s.length))],k=z>.82,E=p?.82*z:.14*z;e.fillStyle=k?`rgba(${C},${I},${A},${p?.92:.32})`:`rgba(${S},${w},${v},${E})`,e.fillText(q,n*b,t*m)}}}function M(e,o,l,a,i={}){const{fontSize:r=13,color:c,accentColor:s,speed:h=.4,layers:f=4,turbulence:g=.8,lightMode:M=!1}=i,d=s??(M?"#6b8700":"#d4ff00"),u=.62*r,p=1.4*r,$=Math.ceil(o/u),b=Math.ceil(l/p);e.clearRect(0,0,o,l),e.font=`${r}px monospace`,e.textBaseline="top";let m=255,x=255,y=255;if(M&&(m=55,x=55,y=55),c){const e=t(c);e&&(m=e.r,x=e.g,y=e.b)}let S=212,w=255,v=0;const C=t(d);C&&(S=C.r,w=C.g,v=C.b);const I=a*h,A=["─","─","╌","·","╌","─","─","╌","·"];for(let t=0;t<b;t++){const o=t/b;for(let l=0;l<$;l++){const a=l/$;let i=0,r=0;for(let t=0;t<f;t++){const e=n(13*t,7*t+3),l=1.1+2.4*e,c=.9+2*n(29*t,11*t+1),s=e*Math.PI*6,h=(.2+.5*n(41*t,17*t))*(t%2==0?1:-1.3),f=Math.sin(a*l*Math.PI*2+I*h+s),M=Math.cos(o*c*Math.PI*2+I*h*.6+1.7*s),d=Math.sin(a*c*Math.PI*g+o*l*Math.PI*g+I*h*.4);i+=Math.atan2(M+.3*d,f),r+=.5*(f*M+1)}const c=i/f,s=Math.min(1,r/f);if(s<.1)continue;const h=(c+Math.PI)/(2*Math.PI),d=A[Math.floor(h*A.length)%A.length],b=s>.8,C=M?.8*s:.13*s;e.fillStyle=b?`rgba(${S},${w},${v},${M?.9:.26})`:`rgba(${m},${x},${y},${C})`,e.fillText(d,l*u,t*p)}}}function d(e,o,l,a,i={x:.5,y:.5},r={}){const{fontSize:c=13,chars:s=" ·:;=+*#%@",color:h,accentColor:f,speed:g=1,radius:M=.38,swirl:d=3,lightMode:u=!1}=r,p=f??(u?"#6b8700":"#d4ff00"),$=.62*c,b=1.4*c,m=Math.ceil(o/$),x=Math.ceil(l/b),y=o/l;e.clearRect(0,0,o,l),e.font=`${c}px monospace`,e.textBaseline="top";let S=255,w=255,v=255;if(u&&(S=55,w=55,v=55),h){const e=t(h);e&&(S=e.r,w=e.g,v=e.b)}let C=212,I=255,A=0;const B=t(p);B&&(C=B.r,I=B.g,A=B.b);const T=a*g;for(let t=0;t<x;t++){const o=t/x;for(let l=0;l<m;l++){const a=(l/m-i.x)*y,r=o-i.y,c=Math.sqrt(a*a+r*r)/M;if(c>1){const o=n(3*l,7*t)*Math.max(0,1-3*(c-1));if(o<.62)continue;const a=o*(u?.28:.04);e.fillStyle=`rgba(${S},${w},${v},${a})`,e.fillText(s[1],l*$,t*b);continue}const h=Math.max(0,1-Math.abs(c-(.15+.12*Math.sin(1.1*T)))/.07),f=Math.pow(1-c,2.2),g=Math.min(1,f+.6*h);if(g<.06)continue;const d=Math.floor(g*(s.length-1)),p=s[Math.min(s.length-1,d)],x=h>.35||c<.08,B=u?.85*g:.18*g;e.fillStyle=x?`rgba(${C},${I},${A},${u?.95:.38})`:`rgba(${S},${w},${v},${B})`,e.fillText(p,l*$,t*b)}}}function u(e,o,l,a,i={}){const{fontSize:r=14,chars:c=" ·∙•:-=+*#",color:s,accentColor:h,speed:f=.5,harmonics:g=3,lightMode:M=!1}=i,d=h??(M?"#6b8700":"#d4ff00"),u=.62*r,p=1.4*r,$=Math.ceil(o/u),b=Math.ceil(l/p);e.clearRect(0,0,o,l),e.font=`${r}px monospace`,e.textBaseline="top";let m=255,x=255,y=255;if(M&&(m=55,x=55,y=55),s){const e=t(s);e&&(m=e.r,x=e.g,y=e.b)}let S=212,w=255,v=0;const C=t(d);C&&(S=C.r,w=C.g,v=C.b);const I=a*f,A=Array.from({length:g},(t,e)=>1/(e+1)).reduce((t,e)=>t+e,0);for(let t=0;t<b;t++)for(let o=0;o<$;o++){let l=0;for(let e=0;e<g;e++){const a=.18+1.4*n(o*(e+3)+7,t*(e+5)+11),i=n(o*(e+7),t*(e+9)+3)*Math.PI*2,r=1/(e+1);l+=Math.sin(I*a+i)*r}const a=.5*(l/A+1);if(a<.28)continue;const i=(a-.28)/.72,r=c[Math.min(c.length-1,Math.floor(i*c.length))],s=a>.88,h=M?.82*i:.13*i;e.fillStyle=s?`rgba(${S},${w},${v},${M?.92:.28})`:`rgba(${m},${x},${y},${h})`,e.fillText(r,o*u,t*p)}}function p(e,o,n,l,a={}){const{fontSize:i=13,chars:r=" .,:;i+xX#&@",color:c="#ff4500",hotColor:s="#ffe066",intensity:h=.85,wind:f=0,speed:g=1,lightMode:M=!1}=a,d=.62*i,u=1.4*i,p=Math.ceil(o/d),$=Math.ceil(n/u),b=p*$,m="__fire_heat__",x=e.canvas;let y=x[m];y&&y.length===b||(y=new Float32Array(b),x[m]=y);const S=.18*(.016*g),w=f*g*.8,v=$-1,C=l*g;for(let t=0;t<p;t++){const e=(.6*(.5*Math.sin(.31*t+4.1*C)+.5)+.4*(.5*Math.sin(.73*t-2.7*C)+.5))*h;y[v*p+t]=Math.min(1,e+.15*Math.random()*h),v>0&&(y[(v-1)*p+t]=Math.min(1,.85*e+.1*Math.random()*h))}const I=new Float32Array(b);for(let t=0;t<$-2;t++)for(let e=0;e<p;e++){const o=.4*y[(t+1)*p+e]+.25*y[(t+2)*p+Math.max(0,Math.min(p-1,e+Math.round(w)))]+.175*y[(t+1)*p+Math.max(0,e-1)]+.175*y[(t+1)*p+Math.min(p-1,e+1)];I[t*p+e]=Math.max(0,o-S-.02*Math.random()*g)}for(let t=0;t<p;t++)I[($-1)*p+t]=y[($-1)*p+t],$>1&&(I[($-2)*p+t]=y[($-2)*p+t]);x[m]=I;const A=t(c)??{r:255,g:69,b:0},B=t(s)??{r:255,g:224,b:102};e.clearRect(0,0,o,n),e.font=`${i}px "JetBrains Mono", monospace`,e.textBaseline="top";for(let t=0;t<$;t++)for(let o=0;o<p;o++){const n=I[t*p+o];if(n<.03)continue;const l=r[Math.min(r.length-1,Math.floor(n*r.length))];if(" "===l)continue;const a=Math.min(1,1.2*n),i=A.r+(B.r-A.r)*a|0,c=A.g+(B.g-A.g)*a|0,s=A.b+(B.b-A.b)*a|0,h=M?1-.3*n:Math.min(1,n+.15);e.globalAlpha=h,e.fillStyle=`rgb(${i},${c},${s})`,e.fillText(l,o*d,t*u)}e.globalAlpha=1}function $(e,o,l,a,i={}){const{fontSize:r=13,baseChars:c="ATCG",bridgeChars:s="-=≡",color:h="#00e5ff",color2:f="#ff4081",bridgeColor:g="#88ffcc",speed:M=1,helixCount:d,lightMode:u=!1}=i,p=.62*r,$=1.4*r,b=Math.ceil(o/p),m=Math.ceil(l/$),x=d??Math.max(1,Math.floor(o/80)),y=b/x,S=t(h)??{r:0,g:229,b:255},w=t(f)??{r:255,g:64,b:129},v=t(g)??{r:136,g:255,b:204};e.clearRect(0,0,o,l),e.font=`${r}px "JetBrains Mono", monospace`,e.textBaseline="top";const C=a*M,I=.35*y;for(let t=0;t<x;t++){const o=y*(t+.5);for(let l=0;l<m;l++){const a=l/m*Math.PI*6-1.8*C,i=o+Math.sin(a)*I,r=o+Math.sin(a+Math.PI)*I,h=Math.round(i),f=Math.round(r);if(h<0||h>=b)continue;const g=n(31*t+7*l,3),M=c[Math.floor(g*c.length)],d=.5*(Math.sin(a)+1),u=.5*(Math.sin(a+Math.PI)+1);if(e.globalAlpha=.35+.65*d,e.fillStyle=`rgb(${S.r},${S.g},${S.b})`,e.fillText(M,h*p,l*$),f>=0&&f<b){const o=n(53*t+11*l,7),a=c[Math.floor(o*c.length)];e.globalAlpha=.35+.65*u,e.fillStyle=`rgb(${w.r},${w.g},${w.b})`,e.fillText(a,f*p,l*$)}if(l%3===0){const o=Math.min(h,f),a=Math.max(h,f);if(a-o>1){const i=n(17*l+43*t,5),r=s[Math.floor(i*s.length)],c=.25*(d+u)+.2;e.globalAlpha=c,e.fillStyle=`rgb(${v.r},${v.g},${v.b})`;for(let t=o+1;t<a;t++)e.fillText(r,t*p,l*$)}}}}e.globalAlpha=1}function b(e,o,l,i,r={}){const{fontSize:c=13,chars:s=" .,:;+*#@",color:h="#4caf50",skyColor:f="#1a237e",peakColor:g="#e0e0e0",speed:M=1,roughness:d=.55,heightScale:u=.55,stars:p=!0,lightMode:$=!1}=r,b=.62*c,m=1.4*c,x=Math.ceil(o/b),y=Math.ceil(l/m),S=t(h)??{r:76,g:175,b:80},w=t(f)??{r:26,g:35,b:126},v=t(g)??{r:224,g:224,b:224};e.clearRect(0,0,o,l),e.font=`${c}px "JetBrains Mono", monospace`,e.textBaseline="top";const C=i*M*.4,I=new Array(x);for(let t=0;t<x;t++){const e=(.5*a((t/x+C)*d*3,.5)+.5)*u;I[t]=Math.floor(e*y)}for(let t=0;t<y;t++)for(let o=0;o<x;o++){const l=y-1-I[o],a=t===l;if(!(t>=l)){if(p){const l=n(7*o+Math.floor(.3*C),13*t);if(l>.97){const n=.3*Math.sin(2*i+100*l)+.7;e.globalAlpha=.5*n,e.fillStyle=`rgb(${w.r+60},${w.g+60},${w.b+80})`,e.fillText("·",o*b,t*m)}}continue}const r=(t-l)/Math.max(1,I[o]),c=s[Math.min(s.length-1,Math.floor(r*s.length))];if(" "===c&&!a)continue;const h=a?1:Math.max(0,1-4*r),f=S.r+(v.r-S.r)*h|0,g=S.g+(v.g-S.g)*h|0,M=S.b+(v.b-S.b)*h|0;e.globalAlpha=.5+.5*r,e.fillStyle=`rgb(${f},${g},${M})`,e.fillText(a?s[s.length-1]:c,o*b,t*m)}e.globalAlpha=1}var m=1,x=2,y=4,S=8,w={3:"─",12:"│",9:"┌",10:"┐",5:"└",6:"┘",11:"┬",7:"┴",13:"├",14:"┤",15:"┼",[m]:"╶",[x]:"╴",[y]:"╵",[S]:"╷"};function v(e,o,l,a,i={}){const{fontSize:r=13,pulseColor:c="#ffffff",color:s="#00ff88",density:h=.38,speed:f=1,lightMode:g=!1}=i,M=.62*r,d=1.4*r,u=Math.ceil(o/M),p=Math.ceil(l/d),$=t(s)??{r:0,g:255,b:136},b=t(c)??{r:255,g:255,b:255},m=(t,e)=>{if(n(17*t+1,7*e+2)>h)return 0;let o=0;return t+1<u&&n(17*t+1,7*e+2)>.15&&(o|=1),t-1>=0&&n(17*(t-1)+1,7*e+2)>.15&&(o|=2),e+1<p&&n(17*t+1,7*(e+1)+2)>.15&&(o|=8),e-1>=0&&n(17*t+1,7*(e-1)+2)>.15&&(o|=4),o};e.clearRect(0,0,o,l),e.font=`${r}px "JetBrains Mono", monospace`,e.textBaseline="top";const x=a*f;for(let t=0;t<p;t++)for(let o=0;o<u;o++){const l=m(o,t);if(0===l)continue;const a=w[l]??"·",i=(8*x+40*n(o,23*t))%u,r=(6*x+40*n(17*t,11*o))%p,c=(1&l||2&l)&&Math.abs(o-i)<1.5,s=(4&l||8&l)&&Math.abs(t-r)<1.5,h=c||s,f=.25+.35*n(3*o,5*t);h?(e.globalAlpha=.95,e.fillStyle=`rgb(${b.r},${b.g},${b.b})`):(e.globalAlpha=f,e.fillStyle=`rgb(${$.r},${$.g},${$.b})`),e.fillText(a,o*M,t*d)}e.globalAlpha=1}var C=["wave","rain","stars","pulse","noise","grid","aurora","silk","void","morph","fire","dna","terrain","circuit"];function I(t,e={}){const{type:o="wave",opacity:n=.2,className:l,zIndex:a=0,colorScheme:m="auto",color:x,...y}=e,S="string"==typeof t?document.querySelector(t):t;if(!S)return console.warn("[asciify] asciiBackground: target not found",t),{destroy:()=>{}};const w=S.style.position;"static"===getComputedStyle(S).position&&(S.style.position="relative");const C=document.createElement("canvas");C.style.cssText=["position:absolute","inset:0","width:100%","height:100%",`opacity:${n}`,"pointer-events:none",`z-index:${a}`].join(";"),l&&(C.className=l),S.prepend(C);const I=C.getContext("2d"),A=window.devicePixelRatio||1,B={x:.5,y:.5},T={x:.5,y:.5},R=()=>"light"===m||"dark"!==m&&(()=>{let t=S;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)})(),z=x?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}(x):null,P=()=>({...y,lightMode:void 0!==y.lightMode?y.lightMode:R(),baseColor:z?`rgba(${z.r},${z.g},${z.b},{a})`:y.baseColor}),q={current:P()},k=()=>{q.current="rain"===o||"stars"===o||"pulse"===o||"noise"===o||"grid"===o||"aurora"===o||"silk"===o||"void"===o||"morph"===o?{...y,lightMode:void 0!==y.lightMode?y.lightMode:R(),color:x??y.color}:"fire"===o||"dna"===o?{...y,color:x??y.color}:"terrain"===o||"circuit"===o?{...y,color:x??y.color,lightMode:void 0!==y.lightMode?y.lightMode:R()}:P()};k();const E=window.matchMedia("(prefers-color-scheme: light)"),F=()=>{k()};let L=null;"auto"===m&&(E.addEventListener("change",F),L=new MutationObserver(F),L.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme","class"]}));const J=()=>{const t=S.getBoundingClientRect();C.width=t.width*A,C.height=t.height*A,I.setTransform(A,0,0,A,0,0)};J();const _=t=>{const e=S.getBoundingClientRect();B.x=(t.clientX-e.left)/e.width,B.y=(t.clientY-e.top)/e.height},N=new ResizeObserver(J);N.observe(S),window.addEventListener("mousemove",_);let O=0,W=0;const X=()=>{T.x+=.07*(B.x-T.x),T.y+=.07*(B.y-T.y);const t=S.getBoundingClientRect();"rain"===o?r(I,t.width,t.height,O,q.current):"stars"===o?c(I,t.width,t.height,O,T,q.current):"pulse"===o?s(I,t.width,t.height,O,T,q.current):"noise"===o?h(I,t.width,t.height,O,T,q.current):"grid"===o?f(I,t.width,t.height,O,T,q.current):"aurora"===o?g(I,t.width,t.height,O,T,q.current):"silk"===o?M(I,t.width,t.height,O,q.current):"void"===o?d(I,t.width,t.height,O,T,q.current):"morph"===o?u(I,t.width,t.height,O,q.current):"fire"===o?p(I,t.width,t.height,O,q.current):"dna"===o?$(I,t.width,t.height,O,q.current):"terrain"===o?b(I,t.width,t.height,O,q.current):"circuit"===o?v(I,t.width,t.height,O,q.current):i(I,t.width,t.height,O,T,q.current),O+=.016,W=requestAnimationFrame(X)};return W=requestAnimationFrame(X),{destroy:()=>{cancelAnimationFrame(W),N.disconnect(),"auto"===m&&(E.removeEventListener("change",F),L?.disconnect()),window.removeEventListener("mousemove",_),C.remove(),S.style.position=w}}}var A=I;export{C as BACKGROUND_TYPES,I as asciiBackground,A as mountWaveBackground,g as renderAuroraBackground,v as renderCircuitBackground,$ as renderDnaBackground,p as renderFireBackground,f as renderGridBackground,u as renderMorphBackground,h as renderNoiseBackground,s as renderPulseBackground,r as renderRainBackground,M as renderSilkBackground,c as renderStarsBackground,b as renderTerrainBackground,d as renderVoidBackground,i as renderWaveBackground};//# sourceMappingURL=backgrounds.js.map