@norbert_bodziony/bloub 0.2.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.
@@ -0,0 +1,2085 @@
1
+ import { Dynamic as e, createComponent as t, effect as n, insert as r, mergeProps as i, setAttribute as a, style as o, template as s, use as c } from "solid-js/web";
2
+ import { For as l, Show as u, createEffect as d, createMemo as f, createSignal as p, createUniqueId as m, mergeProps as h, on as g, onCleanup as _, onMount as v } from "solid-js";
3
+ //#region src/bot/math.ts
4
+ var y = Math.PI * 2, b = (e, t = 0, n = 1) => e < t ? t : e > n ? n : e, x = (e, t, n) => e + (t - e) * n, S = {
5
+ easeOutCubic: (e) => 1 - (1 - e) ** 3,
6
+ easeInOutCubic: (e) => e < .5 ? 4 * e ** 3 : 1 - (-2 * e + 2) ** 3 / 2,
7
+ easeOutQuint: (e) => 1 - (1 - e) ** 5
8
+ };
9
+ function C(e, t, n = 0) {
10
+ let r = e / t * y;
11
+ return .55 * Math.sin(r + n) + .3 * Math.sin(2 * r + n * 1.7 + 1.1) + .15 * Math.sin(3 * r + n * 2.3 + 2.4);
12
+ }
13
+ function w(e) {
14
+ let t = e >>> 0;
15
+ return () => {
16
+ t = t + 1831565813 >>> 0;
17
+ let e = Math.imul(t ^ t >>> 15, 1 | t);
18
+ return e = e + Math.imul(e ^ e >>> 7, 61 | e) ^ e, ((e ^ e >>> 14) >>> 0) / 4294967296;
19
+ };
20
+ }
21
+ var T = (e) => Math.round(e * 100) / 100;
22
+ //#endregion
23
+ //#region src/bot/decor.ts
24
+ function E(e, t = .55, n = .62) {
25
+ let r = (e % 360 + 360) % 360, i = (1 - Math.abs(2 * n - 1)) * t, a = i * (1 - Math.abs(r / 60 % 2 - 1)), o = n - i / 2, [s, c, l] = r < 60 ? [
26
+ i,
27
+ a,
28
+ 0
29
+ ] : r < 120 ? [
30
+ a,
31
+ i,
32
+ 0
33
+ ] : r < 180 ? [
34
+ 0,
35
+ i,
36
+ a
37
+ ] : r < 240 ? [
38
+ 0,
39
+ a,
40
+ i
41
+ ] : r < 300 ? [
42
+ a,
43
+ 0,
44
+ i
45
+ ] : [
46
+ i,
47
+ 0,
48
+ a
49
+ ], u = (e) => Math.round((e + o) * 255).toString(16).padStart(2, "0");
50
+ return `#${u(s)}${u(c)}${u(l)}`;
51
+ }
52
+ function ee(e, t, n, r, i = 1) {
53
+ let a = e.phase + t * e.speed * y, o = Math.cos(e.tilt), s = Math.sin(e.tilt), c = Math.sqrt(Math.max(0, 1 - e.k * e.k)), l = e.sweep * y, u = "", d = "", f = null;
54
+ for (let t = 0; t <= 64; t++) {
55
+ let r = a + t / 64 * l, i = Math.cos(r), p = Math.sin(r), m = e.a * (i * o + p * -s * e.k) + e.cx, h = e.a * (i * s + p * o * e.k) + e.cy, g = e.a * p * c < 0, _ = T(m * n), v = T(h * n), y = g === f ? "L" : "M";
56
+ g ? d += `${y}${_} ${v}` : u += `${y}${_} ${v}`, f = g;
57
+ }
58
+ let p = Math.cos(e.tilt) * e.a * n, m = Math.sin(e.tilt) * e.a * n;
59
+ return {
60
+ id: r,
61
+ front: u,
62
+ back: d,
63
+ width: e.width * n,
64
+ opacity: i,
65
+ grad: {
66
+ x1: T(e.cx * n - p),
67
+ y1: T(e.cy * n - m),
68
+ x2: T(e.cx * n + p),
69
+ y2: T(e.cy * n + m),
70
+ stops: [
71
+ E(e.hue),
72
+ E(e.hue + e.hueSpan * .5),
73
+ E(e.hue + e.hueSpan)
74
+ ]
75
+ }
76
+ };
77
+ }
78
+ var D = w(659918), O = Array.from({ length: 6 }, (e, t) => ({
79
+ a: 1.3 + D() * .1,
80
+ k: .05 + D() * .4,
81
+ tilt: t / 6 * Math.PI + D() * .5,
82
+ speed: 3 + D() * .7,
83
+ phase: D() * y,
84
+ sweep: .6 + D() * .25,
85
+ hue: t * 360 / 6 + D() * 30,
86
+ hueSpan: 60 + D() * 60,
87
+ width: .05 + D() * .012,
88
+ cx: 0,
89
+ cy: .1
90
+ })), k = Array.from({ length: 4 }, (e, t) => ({
91
+ a: .78 + t * .2,
92
+ k: .05 + t * .02,
93
+ tilt: -.62 + t * .05,
94
+ speed: .3,
95
+ phase: .06 * t,
96
+ sweep: .4,
97
+ hue: 95 + t * 62,
98
+ hueSpan: 100,
99
+ width: .05,
100
+ cx: 0,
101
+ cy: -.12
102
+ })), A = [
103
+ -.557,
104
+ -.013,
105
+ .532
106
+ ], te = .165, ne = 1.25, re = w(48879), ie = Array.from({ length: 5 }, (e, t) => ({
107
+ birth: t * .2,
108
+ angle: re() * y,
109
+ rho: .58 + re() * .18
110
+ }));
111
+ function ae(e, t) {
112
+ let n = [];
113
+ for (let r of ie) {
114
+ let i = e - r.birth;
115
+ if (i < 0 || i > .62) continue;
116
+ let a = r.rho * .75 ** (i * 10), o = r.angle + i * 100 * Math.PI / 180;
117
+ n.push({
118
+ x: Math.cos(o) * a * t,
119
+ y: Math.sin(o) * a * t,
120
+ r: (.04 + .028 * b(i / .55)) * t,
121
+ depth: b(1 - a / .8),
122
+ opacity: b(i / .06) * b((.62 - i) / .08)
123
+ });
124
+ }
125
+ return n;
126
+ }
127
+ var oe = w(49383), se = Array.from({ length: 4 }, (e, t) => {
128
+ let n = t - 1.5;
129
+ return {
130
+ a: .85 * (1 + n * .03),
131
+ k: .15 / .85 * (1 + n * .16),
132
+ tilt: 34 * Math.PI / 180 + n * .035,
133
+ speed: 210 / 360,
134
+ phase: -t * .045 + oe() * .012,
135
+ sweep: .34,
136
+ hue: t * 85 + oe() * 20,
137
+ hueSpan: 80,
138
+ width: .095,
139
+ cx: 0,
140
+ cy: 0
141
+ };
142
+ }), j = .129, ce = "#2496e8", M = 1.003, le = .15, ue = 1.14, de = .054, N = 15.46, P = .186, F = .412, I = {
143
+ yaw: 28.49,
144
+ pitch: 28.62,
145
+ roll: -13
146
+ }, L = (e) => e * Math.PI / 180;
147
+ function R(e, t, n) {
148
+ let r = Math.cos(n), i = Math.sin(n);
149
+ return [[
150
+ e[0] * r + t[0] * i,
151
+ e[1] * r + t[1] * i,
152
+ e[2] * r + t[2] * i
153
+ ], [
154
+ t[0] * r - e[0] * i,
155
+ t[1] * r - e[1] * i,
156
+ t[2] * r - e[2] * i
157
+ ]];
158
+ }
159
+ function fe(e, t, n = N) {
160
+ let r = [
161
+ 0,
162
+ 0,
163
+ 1
164
+ ], i = [
165
+ 1,
166
+ 0,
167
+ 0
168
+ ], a = [
169
+ 0,
170
+ 1,
171
+ 0
172
+ ];
173
+ [r, i] = R(r, i, L(e.yaw)), [a, r] = R(a, r, L(e.pitch)), [i, a] = R(i, a, L(e.roll));
174
+ let o = (e) => {
175
+ let [o, s] = R(r, i, L(n * e));
176
+ return {
177
+ x: o[0] * t,
178
+ y: o[1] * t,
179
+ a: s[0],
180
+ b: s[1],
181
+ c: a[0],
182
+ d: a[1],
183
+ depth: o[2]
184
+ };
185
+ };
186
+ return [o(-1), o(1)];
187
+ }
188
+ var pe = w(24301), z = (() => {
189
+ let e = [], t = 1.4;
190
+ for (; t < 900;) e.push(t), t += 1.9 + pe() * 2.7, pe() < .18 && (e.push(t), t += .24);
191
+ return e;
192
+ })(), me = .18;
193
+ function he(e) {
194
+ for (let t = 0; t < z.length; t++) {
195
+ let n = z[t];
196
+ if (e < n) break;
197
+ let r = (e - n) / me;
198
+ if (r >= 0 && r <= 1) return r < .45 ? 1 - r / .45 : (r - .45) / .55;
199
+ }
200
+ return 1;
201
+ }
202
+ function ge(e, t = {}) {
203
+ let { wander: n = 1, blink: r = !0, float: i = !0 } = t;
204
+ return {
205
+ dYaw: (C(e, 11.3, .4) * 5.5 + C(e, 3.7, 2.1) * 1.6) * n,
206
+ dPitch: (C(e, 9.1, 1.3) * 4.2 + C(e, 4.3, .7) * 1.3) * n,
207
+ dRoll: C(e, 13.7, 3.2) * 2.2 * n,
208
+ lid: r ? he(e) : 1,
209
+ driftX: i ? C(e, 7.9, 1.9) * .006 : 0,
210
+ driftY: i ? C(e, 5.3, .3) * .007 : 0,
211
+ breath: i ? 1 + Math.sin(e / 3.4 * Math.PI * 2) * .005 : 1
212
+ };
213
+ }
214
+ function B(e) {
215
+ return .06 + .94 * b(e);
216
+ }
217
+ //#endregion
218
+ //#region src/bot/expressions.ts
219
+ var V = (e, t, n = 0, r = 1) => ({
220
+ w: e,
221
+ h: t,
222
+ tilt: n,
223
+ open: r
224
+ }), H = (e, t, n = 0, r = 1) => [V(e, t, n, r), V(e, t, -n, r)], U = [
225
+ {
226
+ id: "neutre",
227
+ gaze: { ...I },
228
+ split: N,
229
+ eyes: [V(P, F), V(P, F)]
230
+ },
231
+ {
232
+ id: "attentif",
233
+ gaze: {
234
+ yaw: 4,
235
+ pitch: 5,
236
+ roll: -4
237
+ },
238
+ split: 16,
239
+ eyes: H(.21, .44)
240
+ },
241
+ {
242
+ id: "surpris",
243
+ gaze: {
244
+ yaw: 3,
245
+ pitch: -3,
246
+ roll: 0
247
+ },
248
+ split: 19,
249
+ eyes: H(.45, .47)
250
+ },
251
+ {
252
+ id: "excite",
253
+ gaze: {
254
+ yaw: 6,
255
+ pitch: -14,
256
+ roll: 0
257
+ },
258
+ split: 19.5,
259
+ eyes: H(.4, .56, -10)
260
+ },
261
+ {
262
+ id: "heureux",
263
+ gaze: {
264
+ yaw: 5,
265
+ pitch: 9,
266
+ roll: 0
267
+ },
268
+ split: 17,
269
+ eyes: H(.27, .17, 14)
270
+ },
271
+ {
272
+ id: "hilare",
273
+ gaze: {
274
+ yaw: 4,
275
+ pitch: 14,
276
+ roll: 0
277
+ },
278
+ split: 18,
279
+ eyes: H(.34, .13, 20)
280
+ },
281
+ {
282
+ id: "colere",
283
+ gaze: {
284
+ yaw: 3,
285
+ pitch: 7,
286
+ roll: 0
287
+ },
288
+ split: 17,
289
+ eyes: H(.34, .15, 30)
290
+ },
291
+ {
292
+ id: "triste",
293
+ gaze: {
294
+ yaw: 3,
295
+ pitch: -13,
296
+ roll: 0
297
+ },
298
+ split: 16,
299
+ eyes: H(.22, .4, -28)
300
+ },
301
+ {
302
+ id: "effraye",
303
+ gaze: {
304
+ yaw: 2,
305
+ pitch: -20,
306
+ roll: 0
307
+ },
308
+ split: 20.5,
309
+ eyes: H(.4, .6)
310
+ },
311
+ {
312
+ id: "mefiant",
313
+ gaze: {
314
+ yaw: 12,
315
+ pitch: 6,
316
+ roll: -6
317
+ },
318
+ split: 16,
319
+ eyes: [V(.21, .4), V(.22, .15)]
320
+ },
321
+ {
322
+ id: "confus",
323
+ gaze: {
324
+ yaw: -14,
325
+ pitch: 3,
326
+ roll: 8
327
+ },
328
+ split: 16.5,
329
+ eyes: [V(.2, .44, -18), V(.28, .17, 14)]
330
+ },
331
+ {
332
+ id: "curieux",
333
+ gaze: {
334
+ yaw: 16,
335
+ pitch: -9,
336
+ roll: -15
337
+ },
338
+ split: 16.5,
339
+ eyes: [V(.24, .46, -8), V(.2, .38, -8)]
340
+ },
341
+ {
342
+ id: "fier",
343
+ gaze: {
344
+ yaw: 5,
345
+ pitch: 17,
346
+ roll: 0
347
+ },
348
+ split: 17,
349
+ eyes: H(.3, .15, 18)
350
+ },
351
+ {
352
+ id: "timide",
353
+ gaze: {
354
+ yaw: -19,
355
+ pitch: -14,
356
+ roll: -7
357
+ },
358
+ split: 14,
359
+ eyes: H(.17, .3)
360
+ },
361
+ {
362
+ id: "blase",
363
+ gaze: {
364
+ yaw: -22,
365
+ pitch: 2,
366
+ roll: 0
367
+ },
368
+ split: 16,
369
+ eyes: H(.3, .12)
370
+ },
371
+ {
372
+ id: "somnolent",
373
+ gaze: {
374
+ yaw: 6,
375
+ pitch: -9,
376
+ roll: -3
377
+ },
378
+ split: 16,
379
+ eyes: H(.2, .42, 0, .42)
380
+ }
381
+ ], _e = new Map(U.map((e) => [e.id, e])), ve = "neutre", ye = (e, t, n) => ({
382
+ w: x(e.w, t.w, n),
383
+ h: x(e.h, t.h, n),
384
+ tilt: x(e.tilt ?? 0, t.tilt ?? 0, n),
385
+ open: x(e.open, t.open, n)
386
+ });
387
+ function W(e, t, n) {
388
+ return {
389
+ id: t.id,
390
+ gaze: {
391
+ yaw: x(e.gaze.yaw, t.gaze.yaw, n),
392
+ pitch: x(e.gaze.pitch, t.gaze.pitch, n),
393
+ roll: x(e.gaze.roll, t.gaze.roll, n)
394
+ },
395
+ split: x(e.split, t.split, n),
396
+ eyes: [ye(e.eyes[0], t.eyes[0], n), ye(e.eyes[1], t.eyes[1], n)]
397
+ };
398
+ }
399
+ //#endregion
400
+ //#region src/bot/profiles.ts
401
+ var be = {
402
+ egg: [
403
+ .8369,
404
+ .8424,
405
+ .8497,
406
+ .8585,
407
+ .8674,
408
+ .8775,
409
+ .8878,
410
+ .8983,
411
+ .9089,
412
+ .9185,
413
+ .9288,
414
+ .9374,
415
+ .9445,
416
+ .9504,
417
+ .9543,
418
+ .9559,
419
+ .9555,
420
+ .9519,
421
+ .9466,
422
+ .9389,
423
+ .9302,
424
+ .9193,
425
+ .9085,
426
+ .8969,
427
+ .8852,
428
+ .8734,
429
+ .8625,
430
+ .8513,
431
+ .8411,
432
+ .8325,
433
+ .8243,
434
+ .8179,
435
+ .8137,
436
+ .8112,
437
+ .8102,
438
+ .8128,
439
+ .8178,
440
+ .8262,
441
+ .8374,
442
+ .8518,
443
+ .8702,
444
+ .8922,
445
+ .9169,
446
+ .9446,
447
+ .9741,
448
+ 1.0023,
449
+ 1.0267,
450
+ 1.0433,
451
+ 1.0481,
452
+ 1.0393,
453
+ 1.0216,
454
+ .997,
455
+ .9697,
456
+ .9418,
457
+ .9169,
458
+ .8949,
459
+ .876,
460
+ .8604,
461
+ .849,
462
+ .8394,
463
+ .8337,
464
+ .8314,
465
+ .8305,
466
+ .8326
467
+ ],
468
+ hexagon: [
469
+ .921,
470
+ .9282,
471
+ .9441,
472
+ .9706,
473
+ .9984,
474
+ 1.0059,
475
+ .9896,
476
+ .9562,
477
+ .929,
478
+ .9124,
479
+ .9047,
480
+ .9058,
481
+ .9157,
482
+ .9349,
483
+ .9642,
484
+ .9873,
485
+ .9882,
486
+ .9665,
487
+ .9336,
488
+ .9105,
489
+ .8968,
490
+ .8918,
491
+ .8955,
492
+ .908,
493
+ .9293,
494
+ .9611,
495
+ .982,
496
+ .9812,
497
+ .959,
498
+ .9282,
499
+ .9089,
500
+ .8978,
501
+ .8964,
502
+ .9026,
503
+ .9189,
504
+ .9439,
505
+ .9778,
506
+ .999,
507
+ .9964,
508
+ .9713,
509
+ .9439,
510
+ .9274,
511
+ .9196,
512
+ .9206,
513
+ .9308,
514
+ .9502,
515
+ .9799,
516
+ 1.0121,
517
+ 1.0226,
518
+ 1.0071,
519
+ .9752,
520
+ .951,
521
+ .9366,
522
+ .9316,
523
+ .9351,
524
+ .9485,
525
+ .9711,
526
+ 1.0026,
527
+ 1.0213,
528
+ 1.0155,
529
+ .9863,
530
+ .9547,
531
+ .9347,
532
+ .9232
533
+ ],
534
+ triangle: [
535
+ .7819,
536
+ .8211,
537
+ .8747,
538
+ .944,
539
+ 1.0223,
540
+ 1.096,
541
+ 1.1401,
542
+ 1.134,
543
+ 1.0808,
544
+ 1.0047,
545
+ .9265,
546
+ .8603,
547
+ .8104,
548
+ .773,
549
+ .745,
550
+ .7273,
551
+ .7151,
552
+ .7118,
553
+ .7148,
554
+ .7245,
555
+ .7427,
556
+ .768,
557
+ .8037,
558
+ .8518,
559
+ .9148,
560
+ .9876,
561
+ 1.0583,
562
+ 1.1073,
563
+ 1.1109,
564
+ 1.0667,
565
+ .994,
566
+ .9164,
567
+ .8482,
568
+ .7948,
569
+ .7555,
570
+ .7261,
571
+ .7056,
572
+ .6925,
573
+ .6859,
574
+ .6869,
575
+ .6938,
576
+ .7084,
577
+ .7305,
578
+ .7615,
579
+ .804,
580
+ .8595,
581
+ .9311,
582
+ 1.0092,
583
+ 1.0791,
584
+ 1.1171,
585
+ 1.1054,
586
+ 1.0501,
587
+ .9779,
588
+ .905,
589
+ .845,
590
+ .799,
591
+ .7656,
592
+ .7413,
593
+ .7258,
594
+ .716,
595
+ .7146,
596
+ .7204,
597
+ .733,
598
+ .7528
599
+ ]
600
+ }, xe = Array.from({ length: 64 }, (e, t) => t / 64 * y), G = xe.map(Math.cos), K = xe.map(Math.sin);
601
+ function Se(e, t = {}) {
602
+ return {
603
+ radii: [...be[e]],
604
+ rot: 0,
605
+ cx: 0,
606
+ cy: 0,
607
+ sx: 1,
608
+ sy: 1,
609
+ ...t
610
+ };
611
+ }
612
+ function q(e, t = {}) {
613
+ return {
614
+ radii: Array(64).fill(e),
615
+ rot: 0,
616
+ cx: 0,
617
+ cy: 0,
618
+ sx: 1,
619
+ sy: 1,
620
+ ...t
621
+ };
622
+ }
623
+ function Ce(e, t, n, r) {
624
+ let i = r ?? {
625
+ radii: Array(64),
626
+ rot: 0,
627
+ cx: 0,
628
+ cy: 0,
629
+ sx: 1,
630
+ sy: 1
631
+ };
632
+ for (let r = 0; r < 64; r++) i.radii[r] = x(e.radii[r] ?? 1, t.radii[r] ?? 1, n);
633
+ let a = t.rot - e.rot;
634
+ for (; a > Math.PI;) a -= y;
635
+ for (; a < -Math.PI;) a += y;
636
+ return i.rot = e.rot + a * n, i.cx = x(e.cx, t.cx, n), i.cy = x(e.cy, t.cy, n), i.sx = x(e.sx, t.sx, n), i.sy = x(e.sy, t.sy, n), i;
637
+ }
638
+ function J(e, t, n = []) {
639
+ let r = Math.cos(e.rot), i = Math.sin(e.rot);
640
+ for (let a = 0; a < 64; a++) {
641
+ let o = e.radii[a] ?? 1, s = o * (G[a] ?? 0), c = o * (K[a] ?? 0), l = s * r - c * i, u = s * i + c * r, d = n[a] ?? {
642
+ x: 0,
643
+ y: 0
644
+ };
645
+ d.x = (l * e.sx + e.cx) * t, d.y = (u * e.sy + e.cy) * t, n[a] = d;
646
+ }
647
+ return n.length = 64, n;
648
+ }
649
+ function we(e, t = 1 / 6) {
650
+ let n = e.length;
651
+ if (n < 3) return "";
652
+ let r = e[0], i = `M${T(r.x)} ${T(r.y)}`;
653
+ for (let r = 0; r < n; r++) {
654
+ let a = e[(r - 1 + n) % n], o = e[r], s = e[(r + 1) % n], c = e[(r + 2) % n], l = o.x + (s.x - a.x) * t, u = o.y + (s.y - a.y) * t, d = s.x - (c.x - o.x) * t, f = s.y - (c.y - o.y) * t;
655
+ i += `C${T(l)} ${T(u)} ${T(d)} ${T(f)} ${T(s.x)} ${T(s.y)}`;
656
+ }
657
+ return `${i}Z`;
658
+ }
659
+ function Y(e, t, n) {
660
+ let r = Array(64).fill(0), i = e.length;
661
+ for (let a = 0; a < 64; a++) {
662
+ let o = G[a] ?? 0, s = K[a] ?? 0, c = 0;
663
+ for (let r = 0; r < i; r++) {
664
+ let a = e[r], l = e[(r + 1) % i], u = l.x - a.x, d = l.y - a.y, f = o * d - s * u;
665
+ if (Math.abs(f) < 1e-9) continue;
666
+ let p = a.x - t, m = a.y - n, h = (p * d - m * u) / f, g = (p * s - m * o) / f;
667
+ h > c && g >= 0 && g <= 1 && (c = h);
668
+ }
669
+ r[a] = c;
670
+ }
671
+ return r;
672
+ }
673
+ function Te(e, t, n, r, i, a, o = 96) {
674
+ let s = r - e, c = i - t, l = Math.hypot(s, c) || 1e-6, u = Math.atan2(c, s), d = Math.acos(Math.max(-1, Math.min(1, (n - a) / l))), f = [];
675
+ for (let r = 0; r <= o / 2; r++) {
676
+ let i = u + d + (y - 2 * d) * r / (o / 2);
677
+ f.push({
678
+ x: e + Math.cos(i) * n,
679
+ y: t + Math.sin(i) * n
680
+ });
681
+ }
682
+ for (let e = 0; e <= o / 2; e++) {
683
+ let t = u - d + 2 * d * e / (o / 2);
684
+ f.push({
685
+ x: r + Math.cos(t) * a,
686
+ y: i + Math.sin(t) * a
687
+ });
688
+ }
689
+ return f;
690
+ }
691
+ function Ee(e, t) {
692
+ let n = e.length, r = (t / y % 1 + 1) % 1 * n, i = Math.floor(r);
693
+ return x(e[i % n] ?? 1, e[(i + 1) % n] ?? 1, r - i);
694
+ }
695
+ function De(e, t = 1, n = 1) {
696
+ return xe.map((r, i) => (Math.abs((G[i] ?? 0) / t) ** e + Math.abs((K[i] ?? 0) / n) ** e) ** (-1 / e));
697
+ }
698
+ function Oe(e) {
699
+ let t = Array(64).fill(0);
700
+ for (let n = 0; n < 64; n++) {
701
+ let r = G[n] ?? 0, i = K[n] ?? 0, a = 0;
702
+ for (let t of e) {
703
+ let e = r * t.x + i * t.y, n = e * e - (t.x * t.x + t.y * t.y - t.r * t.r);
704
+ if (n < 0) continue;
705
+ let o = e + Math.sqrt(n);
706
+ o > a && (a = o);
707
+ }
708
+ t[n] = a;
709
+ }
710
+ return t;
711
+ }
712
+ function ke(e, t, n = 10) {
713
+ let r = e.length, i = [], a = (e, t) => {
714
+ let n = t.x - e.x, r = t.y - e.y, i = Math.hypot(n, r) || 1;
715
+ return Math.atan2(-n / i, r / i);
716
+ };
717
+ for (let o = 0; o < r; o++) {
718
+ let s = e[(o - 1 + r) % r], c = e[o], l = e[(o + 1) % r], u = a(s, c), d = a(c, l) - u;
719
+ for (; d > Math.PI;) d -= y;
720
+ for (; d < -Math.PI;) d += y;
721
+ for (let e = 0; e <= n; e++) {
722
+ let r = u + d * e / n;
723
+ i.push({
724
+ x: c.x + Math.cos(r) * t,
725
+ y: c.y + Math.sin(r) * t
726
+ });
727
+ }
728
+ }
729
+ return i;
730
+ }
731
+ function Ae(e, t, n, r = 0) {
732
+ let i = r * Math.PI / 180;
733
+ return Y(ke(Array.from({ length: e }, (r, a) => {
734
+ let o = i + a / e * y;
735
+ return {
736
+ x: Math.cos(o) * (t - n),
737
+ y: Math.sin(o) * (t - n)
738
+ };
739
+ }), n), 0, 0);
740
+ }
741
+ function je(e, t = 1) {
742
+ if (e.length < 3) return "";
743
+ let n = "";
744
+ for (let r = 0; r < e.length; r++) {
745
+ let i = e[r];
746
+ n += `${r === 0 ? "M" : "L"}${T(i.x * t)} ${T(i.y * t)}`;
747
+ }
748
+ return `${n}Z`;
749
+ }
750
+ function Me(e, t) {
751
+ let n = Math.max(e, .01) / 2, r = Math.max(t, .01) / 2, i = Math.min(n, r);
752
+ return `M${T(-n)} ${T(-r + i)}A${T(i)} ${T(i)} 0 0 1 ${T(-n + i)} ${T(-r)}L${T(n - i)} ${T(-r)}A${T(i)} ${T(i)} 0 0 1 ${T(n)} ${T(-r + i)}L${T(n)} ${T(r - i)}A${T(i)} ${T(i)} 0 0 1 ${T(n - i)} ${T(r)}L${T(-n + i)} ${T(r)}A${T(i)} ${T(i)} 0 0 1 ${T(-n)} ${T(r - i)}Z`;
753
+ }
754
+ //#endregion
755
+ //#region src/bot/skins.ts
756
+ function Ne(e, t = 1) {
757
+ let n = Math.max(...e);
758
+ if (n <= 0) return e;
759
+ let r = t / n;
760
+ return e.map((e) => e * r);
761
+ }
762
+ var Pe = Ne(Array.from({ length: 64 }, (e, t) => t / 64 * Math.PI * 2).map((e) => 1 + .075 * Math.cos(2 * e + .5) + .035 * Math.cos(3 * e + 2.1)), 1.02), Fe = Ne(Oe([
763
+ {
764
+ x: -.44,
765
+ y: .2,
766
+ r: .54
767
+ },
768
+ {
769
+ x: .46,
770
+ y: .2,
771
+ r: .5
772
+ },
773
+ {
774
+ x: .02,
775
+ y: .3,
776
+ r: .6
777
+ },
778
+ {
779
+ x: -.24,
780
+ y: -.3,
781
+ r: .48
782
+ },
783
+ {
784
+ x: .3,
785
+ y: -.24,
786
+ r: .44
787
+ }
788
+ ]), 1.02), Ie = Ne(Y(Te(0, .28, .66, 0, -.96, .05), 0, 0), 1.04), Le = Y(Te(-.42, 0, .62, .42, 0, .62), 0, 0), Re = [
789
+ {
790
+ id: "cercle",
791
+ radii: Array(64).fill(1)
792
+ },
793
+ {
794
+ id: "galet",
795
+ radii: Pe
796
+ },
797
+ {
798
+ id: "squircle",
799
+ radii: Ne(De(4.2), 1.15)
800
+ },
801
+ {
802
+ id: "capsule",
803
+ radii: Le
804
+ },
805
+ {
806
+ id: "triangle",
807
+ radii: Ae(3, 1.12, .34, -90)
808
+ },
809
+ {
810
+ id: "hexagone",
811
+ radii: Ae(6, 1.04, .26, 0)
812
+ },
813
+ {
814
+ id: "nuage",
815
+ radii: Fe
816
+ },
817
+ {
818
+ id: "goutte",
819
+ radii: Ie
820
+ }
821
+ ], ze = new Map(Re.map((e) => [e.id, e])), Be = "cercle", Ve = [
822
+ {
823
+ id: "encre",
824
+ hex: "#0a0a0c"
825
+ },
826
+ {
827
+ id: "brun",
828
+ hex: "#8b5e3c"
829
+ },
830
+ {
831
+ id: "rouge",
832
+ hex: "#e8483f"
833
+ },
834
+ {
835
+ id: "orange",
836
+ hex: "#f08a24"
837
+ },
838
+ {
839
+ id: "ambre",
840
+ hex: "#f0b429"
841
+ },
842
+ {
843
+ id: "vert",
844
+ hex: "#3ecf8e"
845
+ },
846
+ {
847
+ id: "turquoise",
848
+ hex: "#2fbfa0"
849
+ },
850
+ {
851
+ id: "bleu",
852
+ hex: "#3b93f0"
853
+ },
854
+ {
855
+ id: "violet",
856
+ hex: "#8b5cf6"
857
+ },
858
+ {
859
+ id: "rose",
860
+ hex: "#e152b0"
861
+ },
862
+ {
863
+ id: "gris",
864
+ hex: "#a3a3a3"
865
+ },
866
+ {
867
+ id: "creme",
868
+ hex: "#f1efe9"
869
+ }
870
+ ], He = new Map(Ve.map((e) => [e.id, e])), Ue = "encre";
871
+ function We(e, t, n) {
872
+ let r = (e) => {
873
+ let t = parseInt(e.slice(1), 16);
874
+ return [
875
+ t >> 16 & 255,
876
+ t >> 8 & 255,
877
+ t & 255
878
+ ];
879
+ }, i = r(e), a = r(t);
880
+ return `#${i.map((e, t) => Math.round(e + (a[t] - e) * n)).map((e) => e.toString(16).padStart(2, "0")).join("")}`;
881
+ }
882
+ //#endregion
883
+ //#region src/bot/states.ts
884
+ var X = (e, t) => [{
885
+ w: e,
886
+ h: t,
887
+ open: 1
888
+ }, {
889
+ w: e,
890
+ h: t,
891
+ open: 1
892
+ }];
893
+ function Z(e = {}) {
894
+ return {
895
+ sil: q(1),
896
+ offX: 0,
897
+ offY: 0,
898
+ gaze: { ...I },
899
+ split: N,
900
+ eyes: X(P, F),
901
+ eyeAlpha: 1,
902
+ bodyAlpha: 1,
903
+ dots: [],
904
+ arcs: [],
905
+ notif: null,
906
+ dotsBehind: !1,
907
+ ...e
908
+ };
909
+ }
910
+ var Ge = -.1875, Ke = Y(Te(0, -.505, .132, 0, .13, .075), 0, Ge), qe = Y(Te(0, -.2535, .1345, 0, .2535, .1345), 0, 0), Je = (e = {}) => ({
911
+ radii: [...Ke],
912
+ rot: 0,
913
+ cx: 0,
914
+ cy: Ge,
915
+ sx: 1,
916
+ sy: 1,
917
+ ...e
918
+ }), Ye = (e = {}) => ({
919
+ radii: [...qe],
920
+ rot: 0,
921
+ cx: 0,
922
+ cy: 0,
923
+ sx: 1,
924
+ sy: 1,
925
+ ...e
926
+ }), Xe = je(Te(0, 0, .118, 0, .172, .012)), Ze = .213;
927
+ function Qe(e) {
928
+ return Se("triangle", {
929
+ rot: e,
930
+ cx: -.213 * Math.sin(e),
931
+ cy: Ze * Math.cos(e)
932
+ });
933
+ }
934
+ function $e(e, t) {
935
+ let n = ((e - t * .5) / 1.5 % 1 + 1) % 1;
936
+ return b((n < .5 ? .5 - .5 * Math.cos(n * y) : 0) * 2);
937
+ }
938
+ var et = [
939
+ {
940
+ id: "idle",
941
+ duration: 2.4,
942
+ morph: .45,
943
+ blinkIn: !1,
944
+ baseFace: !0,
945
+ baseBody: !0,
946
+ pose: () => Z()
947
+ },
948
+ {
949
+ id: "thinking",
950
+ duration: 2.6,
951
+ morph: .4,
952
+ baseFace: !1,
953
+ baseBody: !1,
954
+ blinkIn: !0,
955
+ pose: (e) => {
956
+ let t = $e(e, 1), n = .3 + .7 * S.easeOutCubic(b(e / .3));
957
+ return Z({
958
+ sil: q(te * (1 + (ne - 1) * t), { cx: A[1] }),
959
+ eyeAlpha: 0,
960
+ dots: [0, 2].map((t) => {
961
+ let r = $e(e, t);
962
+ return {
963
+ x: A[t] * n,
964
+ y: 0,
965
+ r: te * (1 + (ne - 1) * r),
966
+ opacity: .55 + .45 * r
967
+ };
968
+ })
969
+ });
970
+ }
971
+ },
972
+ {
973
+ id: "wink",
974
+ duration: 1.6,
975
+ morph: .3,
976
+ blinkIn: !0,
977
+ baseFace: !1,
978
+ baseBody: !0,
979
+ pose: () => Z({
980
+ gaze: {
981
+ yaw: -5.37,
982
+ pitch: 4.55,
983
+ roll: 6.7
984
+ },
985
+ split: 16.25,
986
+ eyes: [{
987
+ w: .236,
988
+ h: .464,
989
+ open: 1
990
+ }, {
991
+ w: .447,
992
+ h: .089,
993
+ open: 1
994
+ }]
995
+ })
996
+ },
997
+ {
998
+ id: "wide",
999
+ duration: 1.8,
1000
+ morph: .55,
1001
+ blinkIn: !0,
1002
+ baseFace: !1,
1003
+ baseBody: !0,
1004
+ pose: () => Z({
1005
+ gaze: {
1006
+ yaw: 6.92,
1007
+ pitch: -21.96,
1008
+ roll: 11.6
1009
+ },
1010
+ split: 18.43,
1011
+ eyes: X(.356, .875)
1012
+ })
1013
+ },
1014
+ {
1015
+ id: "alert",
1016
+ duration: 2.4,
1017
+ minDuration: 2,
1018
+ morph: .45,
1019
+ baseFace: !1,
1020
+ baseBody: !1,
1021
+ blinkIn: !1,
1022
+ pose: (e) => {
1023
+ let t = b(e / 1.5), n = S.easeInOutCubic(t) * .82 - .087, r = e > 1.6 ? b((e - 1.6) / .4) : 0, i = n * (1 - r) + .1 * r, a = Math.sin(e * 2.5 * y) * .005, o = 17.7 * Math.PI / 180;
1024
+ return Z({
1025
+ sil: Ye({
1026
+ rot: o,
1027
+ cx: i,
1028
+ cy: -.325 - a
1029
+ }),
1030
+ eyeAlpha: 0,
1031
+ dots: [{
1032
+ x: i - Math.sin(o) * .58,
1033
+ y: -.325 + Math.cos(o) * .58 + a * 2.8,
1034
+ r: .118,
1035
+ d: Xe,
1036
+ rot: o * 180 / Math.PI,
1037
+ opacity: 1
1038
+ }]
1039
+ });
1040
+ }
1041
+ },
1042
+ {
1043
+ id: "notify",
1044
+ duration: 2.2,
1045
+ morph: .5,
1046
+ blinkIn: !0,
1047
+ baseFace: !1,
1048
+ baseBody: !0,
1049
+ pose: (e) => {
1050
+ let t = b(e / .45), n = 1 + (ue - 1) * Math.sin(t * Math.PI) * (1 - t * .35), r = le * (t < 1 ? n : 1), i = -42 * Math.PI / 180;
1051
+ return Z({
1052
+ gaze: {
1053
+ yaw: -21.94,
1054
+ pitch: -5.82,
1055
+ roll: -12.2
1056
+ },
1057
+ split: 18.89,
1058
+ eyes: X(.505, .498),
1059
+ notif: {
1060
+ x: Math.cos(i) * M,
1061
+ y: Math.sin(i) * M,
1062
+ r,
1063
+ notch: r + de
1064
+ }
1065
+ });
1066
+ }
1067
+ },
1068
+ {
1069
+ id: "exclaim",
1070
+ duration: 2,
1071
+ morph: .45,
1072
+ baseFace: !1,
1073
+ baseBody: !1,
1074
+ blinkIn: !1,
1075
+ pose: () => Z({
1076
+ sil: Je(),
1077
+ eyeAlpha: 0,
1078
+ dots: [{
1079
+ x: -.012,
1080
+ y: .526,
1081
+ r: .113,
1082
+ opacity: 1
1083
+ }]
1084
+ })
1085
+ },
1086
+ {
1087
+ id: "sleep",
1088
+ duration: 2.4,
1089
+ morph: .5,
1090
+ baseFace: !1,
1091
+ baseBody: !1,
1092
+ blinkIn: !1,
1093
+ pose: (e) => Z({
1094
+ sil: q(.1585, { cy: .11 + Math.sin(y / .6 * e) * .19 }),
1095
+ eyeAlpha: 0
1096
+ })
1097
+ },
1098
+ {
1099
+ id: "egg",
1100
+ duration: 1.8,
1101
+ morph: .4,
1102
+ baseFace: !1,
1103
+ baseBody: !1,
1104
+ blinkIn: !0,
1105
+ pose: () => Z({
1106
+ sil: Se("egg"),
1107
+ gaze: {
1108
+ yaw: 19.97,
1109
+ pitch: 26.01,
1110
+ roll: -17.1
1111
+ },
1112
+ split: 11.07,
1113
+ eyes: X(.164, .385)
1114
+ })
1115
+ },
1116
+ {
1117
+ id: "hexagon",
1118
+ duration: 1.6,
1119
+ morph: .4,
1120
+ baseFace: !1,
1121
+ baseBody: !1,
1122
+ blinkIn: !0,
1123
+ pose: () => Z({
1124
+ sil: Se("hexagon"),
1125
+ gaze: {
1126
+ yaw: 23.11,
1127
+ pitch: 24.42,
1128
+ roll: -13.3
1129
+ },
1130
+ split: 13.37,
1131
+ eyes: X(.177, .411)
1132
+ })
1133
+ },
1134
+ {
1135
+ id: "play",
1136
+ duration: 2,
1137
+ morph: .5,
1138
+ baseFace: !1,
1139
+ baseBody: !1,
1140
+ blinkIn: !0,
1141
+ pose: (e) => {
1142
+ let t = b(e / .35) * b((2.2 - e) / .5);
1143
+ return Z({
1144
+ sil: Qe(0),
1145
+ gaze: {
1146
+ yaw: 12,
1147
+ pitch: -8,
1148
+ roll: -6
1149
+ },
1150
+ split: 15,
1151
+ eyes: X(.18, .34),
1152
+ arcs: k.map((n, r) => ({
1153
+ id: `sw${r}`,
1154
+ seed: {
1155
+ ...n,
1156
+ cx: .45 - e * .42
1157
+ },
1158
+ t: e,
1159
+ opacity: t
1160
+ }))
1161
+ });
1162
+ }
1163
+ },
1164
+ {
1165
+ id: "orbit",
1166
+ duration: 3.4,
1167
+ minDuration: 2.5,
1168
+ morph: .6,
1169
+ baseFace: !1,
1170
+ baseBody: !1,
1171
+ blinkIn: !1,
1172
+ pose: (e) => {
1173
+ let t = S.easeInOutCubic(b(e / .35)), n = -y * 1.25 * e * t, r = S.easeInOutCubic(b((e - 1.6) / .9)), i = Qe(n), a = q(1, { rot: n }), o = {
1174
+ radii: i.radii.map((e, t) => e + (a.radii[t] - e) * r),
1175
+ rot: n,
1176
+ cx: i.cx * (1 - r),
1177
+ cy: i.cy * (1 - r),
1178
+ sx: 1,
1179
+ sy: 1
1180
+ }, s = b(e / .8) * b((3.6 - e) / .9);
1181
+ return Z({
1182
+ sil: o,
1183
+ gaze: {
1184
+ yaw: I.yaw + Math.sin(e * 6.5) * 65 * (1 - r),
1185
+ pitch: -4 + r * 32,
1186
+ roll: -13
1187
+ },
1188
+ eyes: X(.18, .34 + r * .07),
1189
+ arcs: O.map((t, n) => ({
1190
+ id: `rg${n}`,
1191
+ seed: t,
1192
+ t: e,
1193
+ opacity: s * b((e - n * .13) / .3)
1194
+ }))
1195
+ });
1196
+ }
1197
+ },
1198
+ {
1199
+ id: "swirl",
1200
+ duration: 1.3,
1201
+ minDuration: 1.3,
1202
+ morph: .3,
1203
+ baseFace: !0,
1204
+ baseBody: !0,
1205
+ blinkIn: !0,
1206
+ pose: (e) => Z({ arcs: O.slice(0, 3).map((t, n) => ({
1207
+ id: `sw${n}`,
1208
+ seed: t,
1209
+ t: e,
1210
+ opacity: b((e - n * .06) / .14) * b((1.22 - e) / .34)
1211
+ })) })
1212
+ },
1213
+ {
1214
+ id: "burst",
1215
+ duration: 2.6,
1216
+ minDuration: 2.4,
1217
+ morph: .4,
1218
+ baseFace: !1,
1219
+ baseBody: !1,
1220
+ blinkIn: !1,
1221
+ pose: (e) => {
1222
+ let t = 1 - .834 * S.easeOutQuint(b(e / .7)), n = S.easeOutQuint(b((e - 1.7) / .7));
1223
+ return Z({
1224
+ sil: q(t + (1 - t) * n),
1225
+ eyeAlpha: b((e - 1.85) / .4),
1226
+ dots: ae(e, 1),
1227
+ dotsBehind: !0
1228
+ });
1229
+ }
1230
+ },
1231
+ {
1232
+ id: "comet",
1233
+ duration: 2.4,
1234
+ minDuration: 2.4,
1235
+ morph: .45,
1236
+ baseFace: !1,
1237
+ baseBody: !1,
1238
+ blinkIn: !1,
1239
+ pose: (e) => {
1240
+ let t = 1 - (1 - j) * S.easeOutQuint(b(e / .55)), n = S.easeOutQuint(b((e - 1.85) / .6)), r = b((e - .15) / .25) * b((1.95 - e) / .3);
1241
+ return Z({
1242
+ sil: q(t + (1 - t) * n, { cy: Math.sin(b(e / 1.7) * Math.PI) * .035 }),
1243
+ eyeAlpha: b((e - 2) / .35),
1244
+ arcs: se.map((t, n) => ({
1245
+ id: `cm${n}`,
1246
+ seed: t,
1247
+ t: e,
1248
+ opacity: r
1249
+ }))
1250
+ });
1251
+ }
1252
+ }
1253
+ ], Q = new Map(et.map((e) => [e.id, e])), tt = {
1254
+ idle: 1,
1255
+ thinking: 1.1,
1256
+ wink: .8,
1257
+ wide: .8,
1258
+ alert: .75,
1259
+ notify: .9,
1260
+ exclaim: .8,
1261
+ sleep: .45,
1262
+ egg: .8,
1263
+ hexagon: .8,
1264
+ play: .9,
1265
+ orbit: 1.2,
1266
+ swirl: .5,
1267
+ burst: .45,
1268
+ comet: 1.15
1269
+ }, nt = [
1270
+ "idle",
1271
+ "thinking",
1272
+ "wink",
1273
+ "wide",
1274
+ "alert",
1275
+ "notify",
1276
+ "exclaim",
1277
+ "sleep",
1278
+ "egg",
1279
+ "hexagon",
1280
+ "play",
1281
+ "orbit",
1282
+ "burst",
1283
+ "comet"
1284
+ ], $ = 100, rt = 7.1, it = 5.5, at = .006, ot = .007;
1285
+ function st(e, t, n) {
1286
+ let r = [], i = fe(e.gaze, $, e.split);
1287
+ for (let a = 0; a < 2; a++) {
1288
+ let o = i[a];
1289
+ if (o.depth <= .02) continue;
1290
+ let s = e.eyes[a], c = (s.tilt ?? 0) * Math.PI / 180, l = Math.cos(c), u = Math.sin(c), d = o.a * l + o.c * u, f = o.b * l + o.d * u, p = -o.a * u + o.c * l, m = -o.b * u + o.d * l, h = Math.max(s.w * $, .01) / 2, g = Math.max(s.h * $, .01) / 2, _ = Math.min(h, g), v = g > h, y = v ? g - _ : h - _, b = Ee(n, Math.atan2(o.y, o.x) - t.rot);
1291
+ r.push({
1292
+ x: o.x * b,
1293
+ y: o.y * b,
1294
+ ax: (v ? p : d) * y,
1295
+ ay: (v ? m : f) * y,
1296
+ r: _,
1297
+ m: [
1298
+ d,
1299
+ f,
1300
+ p,
1301
+ m
1302
+ ]
1303
+ });
1304
+ }
1305
+ return r;
1306
+ }
1307
+ function ct(e, t, n, r, i) {
1308
+ let a = r - t, o = i - n, s = a * a + o * o, c = Infinity, l = 0, u = 0;
1309
+ for (let r = 0; r < e.length; r++) {
1310
+ let i = e[r], d = s > 0 ? ((i.x - t) * a + (i.y - n) * o) / s : 0;
1311
+ d = d < 0 ? 0 : d > 1 ? 1 : d;
1312
+ let f = t + d * a - i.x, p = n + d * o - i.y, m = f * f + p * p;
1313
+ m < c && (c = m, l = f, u = p);
1314
+ }
1315
+ let d = Math.sqrt(c);
1316
+ return {
1317
+ d,
1318
+ ux: d > 1e-9 ? l / d : 0,
1319
+ uy: d > 1e-9 ? u / d : 0
1320
+ };
1321
+ }
1322
+ var lt = Math.hypot(at, ot) * $;
1323
+ function ut(e, t, n, r) {
1324
+ let i = Infinity, a = 0, o = 0;
1325
+ for (let s of t) {
1326
+ let t = s.x + n, c = s.y + r, l = ct(e, t - s.ax, c - s.ay, t + s.ax, c + s.ay), [u, d, f, p] = s.m, m = s.r * Math.hypot(u * l.ux + d * l.uy, f * l.ux + p * l.uy) + lt;
1327
+ l.d - m < i && (i = l.d - m, a = l.ux, o = l.uy);
1328
+ }
1329
+ return {
1330
+ marge: i,
1331
+ ux: a,
1332
+ uy: o
1333
+ };
1334
+ }
1335
+ var dt = 12, ft = 8;
1336
+ function pt(e) {
1337
+ if (!e.length) return {
1338
+ x: 0,
1339
+ y: 0
1340
+ };
1341
+ let t = (t, n) => {
1342
+ let r = Infinity;
1343
+ for (let i of e) r = Math.min(r, ut(i.contour, i.empreintes, t, n).marge);
1344
+ return r;
1345
+ }, n = Infinity;
1346
+ for (let t of e) n = Math.min(n, ut(t.calContour, t.reference, 0, 0).marge);
1347
+ let r = 0, i = 0, a = e[0].empreintes;
1348
+ for (let e of a) r -= e.x / a.length, i -= e.y / a.length;
1349
+ let o = Math.max(.35 * $, Math.hypot(r, i) * 1.25);
1350
+ n = Math.min(n, t(r, i));
1351
+ let s = t(0, 0);
1352
+ if (s >= n && s >= 0) return {
1353
+ x: 0,
1354
+ y: 0
1355
+ };
1356
+ let c = Math.max(n, 0), l = 0, u = 0, d = Infinity, f = 0, p = 0, m = s;
1357
+ for (let e = 0; e < dt; e++) {
1358
+ let n = e / dt * Math.PI * 2, r = Math.cos(n), i = Math.sin(n);
1359
+ if (t(r * o, i * o) < c) {
1360
+ for (let e of [
1361
+ .3,
1362
+ .6,
1363
+ 1
1364
+ ]) {
1365
+ let n = t(r * o * e, i * o * e);
1366
+ n > m && (m = n, f = r * o * e, p = i * o * e);
1367
+ }
1368
+ continue;
1369
+ }
1370
+ let a = 0, s = o;
1371
+ for (let e = 0; e < ft; e++) {
1372
+ let e = (a + s) / 2;
1373
+ t(r * e, i * e) >= c ? s = e : a = e;
1374
+ }
1375
+ s < d && (d = s, l = r * s, u = i * s);
1376
+ }
1377
+ let h = d === Infinity ? f : l, g = d === Infinity ? p : u;
1378
+ return {
1379
+ x: +(h / $).toFixed(6),
1380
+ y: +(g / $).toFixed(6)
1381
+ };
1382
+ }
1383
+ function mt(e, t, n) {
1384
+ return e.baseFace && n ? {
1385
+ gaze: n.gaze,
1386
+ split: n.split,
1387
+ eyes: n.eyes
1388
+ } : {
1389
+ gaze: t.gaze,
1390
+ split: t.split,
1391
+ eyes: t.eyes
1392
+ };
1393
+ }
1394
+ function ht(e) {
1395
+ let t = (e) => JSON.stringify([
1396
+ e.gaze,
1397
+ e.split,
1398
+ e.eyes,
1399
+ e.sil.rot,
1400
+ e.sil.cx,
1401
+ e.sil.cy,
1402
+ e.sil.sx,
1403
+ e.sil.sy
1404
+ ]);
1405
+ return t(e.pose(0)) === t(e.pose(e.duration)) ? [0] : Array.from({ length: 3 }, (t, n) => n / 2 * e.duration);
1406
+ }
1407
+ function gt(e, t, n) {
1408
+ let r = [];
1409
+ for (let i of ht(e)) {
1410
+ let a = e.pose(i), o = J({
1411
+ ...a.sil,
1412
+ radii: t
1413
+ }, $), s = J(a.sil, $), c = mt(e, a, n), l = [];
1414
+ for (let e of [-7.1, rt]) for (let t of [-5.5, it]) l.push({
1415
+ ...c,
1416
+ gaze: {
1417
+ yaw: c.gaze.yaw + e,
1418
+ pitch: c.gaze.pitch + t,
1419
+ roll: c.gaze.roll
1420
+ }
1421
+ });
1422
+ for (let e of l) r.push({
1423
+ empreintes: st(e, a.sil, t),
1424
+ reference: st(e, a.sil, a.sil.radii),
1425
+ contour: o,
1426
+ calContour: s
1427
+ });
1428
+ }
1429
+ return pt(r);
1430
+ }
1431
+ var _t = {
1432
+ x: 0,
1433
+ y: 0
1434
+ }, vt = (e, t) => `${e}|${t ?? ""}`;
1435
+ function yt() {
1436
+ return new Map(Re.map((e) => {
1437
+ let t = /* @__PURE__ */ new Map();
1438
+ for (let n of et) {
1439
+ if (!n.baseBody) continue;
1440
+ let r = n.baseFace ? [null, ...U] : [null];
1441
+ for (let i of r) t.set(vt(n.id, i?.id ?? null), gt(n, e.radii, i));
1442
+ }
1443
+ return [e.radii, t];
1444
+ }));
1445
+ }
1446
+ var bt = yt();
1447
+ function xt(e, t, n) {
1448
+ if (!e) return _t;
1449
+ let r = bt.get(e);
1450
+ return r ? r.get(vt(t, n)) ?? r.get(vt(t, null)) ?? _t : _t;
1451
+ }
1452
+ //#endregion
1453
+ //#region src/bot/engine.ts
1454
+ var St = {
1455
+ yaw: 0,
1456
+ pitch: 0,
1457
+ mix: 0,
1458
+ spin: 0,
1459
+ wander: 1
1460
+ }, Ct = (e, t, n) => ({
1461
+ yaw: x(e.yaw, t.yaw, n),
1462
+ pitch: x(e.pitch, t.pitch, n),
1463
+ mix: x(e.mix, t.mix, n),
1464
+ spin: x(e.spin, t.spin, n),
1465
+ wander: x(e.wander, t.wander, n)
1466
+ }), wt = (e, t, n) => ({
1467
+ w: x(e.w, t.w, n),
1468
+ h: x(e.h, t.h, n),
1469
+ open: x(e.open, t.open, n),
1470
+ tilt: x(e.tilt ?? 0, t.tilt ?? 0, n)
1471
+ });
1472
+ function Tt(e, t, n) {
1473
+ let r = 1 - n;
1474
+ return {
1475
+ sil: Ce(e.sil, t.sil, n),
1476
+ offX: x(e.offX, t.offX, n),
1477
+ offY: x(e.offY, t.offY, n),
1478
+ gaze: {
1479
+ yaw: x(e.gaze.yaw, t.gaze.yaw, n),
1480
+ pitch: x(e.gaze.pitch, t.gaze.pitch, n),
1481
+ roll: x(e.gaze.roll, t.gaze.roll, n)
1482
+ },
1483
+ split: x(e.split, t.split, n),
1484
+ eyes: [wt(e.eyes[0], t.eyes[0], n), wt(e.eyes[1], t.eyes[1], n)],
1485
+ eyeAlpha: x(e.eyeAlpha, t.eyeAlpha, n),
1486
+ bodyAlpha: x(e.bodyAlpha, t.bodyAlpha, n),
1487
+ dots: [...e.dots.map((e) => ({
1488
+ ...e,
1489
+ opacity: e.opacity * r
1490
+ })), ...t.dots.map((e) => ({
1491
+ ...e,
1492
+ opacity: e.opacity * n
1493
+ }))],
1494
+ arcs: [...e.arcs.map((e) => ({
1495
+ ...e,
1496
+ id: `a${e.id}`,
1497
+ opacity: e.opacity * r
1498
+ })), ...t.arcs.map((e) => ({
1499
+ ...e,
1500
+ id: `b${e.id}`,
1501
+ opacity: e.opacity * n
1502
+ }))],
1503
+ notif: n < .5 ? e.notif : t.notif,
1504
+ dotsBehind: n < .5 ? e.dotsBehind : t.dotsBehind
1505
+ };
1506
+ }
1507
+ var Et = class e {
1508
+ scale;
1509
+ cur;
1510
+ prev = null;
1511
+ departFige = null;
1512
+ tCur = 0;
1513
+ tPrev = 0;
1514
+ blinkAt = -10;
1515
+ pts = [];
1516
+ shape = null;
1517
+ shapePrev = null;
1518
+ shapeAt = -10;
1519
+ expr = null;
1520
+ exprPrev = null;
1521
+ exprAt = -10;
1522
+ look = St;
1523
+ lookPrev = St;
1524
+ lookAt = -10;
1525
+ lookMorph = .24;
1526
+ static SHAPE_MORPH = .45;
1527
+ static LOOK_MORPH = .24;
1528
+ constructor(e = 100, t = "idle", n = null, r = null) {
1529
+ this.scale = e, this.cur = t, this.shape = n, this.expr = r;
1530
+ }
1531
+ setExpression(e, t = 0) {
1532
+ e !== this.expr && (this.exprPrev = this.expr, this.expr = e, this.exprAt = t);
1533
+ }
1534
+ exprAtTime(t) {
1535
+ let n = this.expr, r = this.exprPrev;
1536
+ if (!n || !r) return n;
1537
+ let i = (t - this.exprAt) / e.SHAPE_MORPH;
1538
+ return i >= 1 ? n : W(r, n, S.easeOutQuint(b(i)));
1539
+ }
1540
+ setShape(e, t = 0) {
1541
+ e !== this.shape && (this.shapePrev = this.shape, this.shape = e, this.shapeAt = t);
1542
+ }
1543
+ shapeAtTime(t) {
1544
+ let n = this.shape, r = this.shapePrev;
1545
+ if (!n || !r) return n;
1546
+ let i = (t - this.shapeAt) / e.SHAPE_MORPH;
1547
+ if (i >= 1) return n;
1548
+ let a = S.easeOutQuint(b(i));
1549
+ return n.map((e, t) => x(r[t] ?? e, e, a));
1550
+ }
1551
+ setLook(t, n, r = e.LOOK_MORPH) {
1552
+ t && !Number.isFinite(t.yaw + t.pitch + t.mix + t.spin + t.wander) || (this.lookPrev = this.lookAtTime(n), this.look = t ?? St, this.lookAt = n, this.lookMorph = r);
1553
+ }
1554
+ lookAtTime(e) {
1555
+ let t = (e - this.lookAt) / this.lookMorph;
1556
+ return t >= 1 ? this.look : Ct(this.lookPrev, this.look, S.easeOutQuint(b(t)));
1557
+ }
1558
+ posed(e, t, n, r) {
1559
+ let i = e.pose(t);
1560
+ return e.baseBody && n && (i = {
1561
+ ...i,
1562
+ sil: {
1563
+ ...i.sil,
1564
+ radii: n
1565
+ }
1566
+ }), e.baseFace && r && (i = {
1567
+ ...i,
1568
+ gaze: r.gaze,
1569
+ split: r.split,
1570
+ eyes: r.eyes
1571
+ }), i;
1572
+ }
1573
+ decalageAtTime(t, n) {
1574
+ let r = (e, n, r, i) => {
1575
+ if (r === i) return i;
1576
+ let a = (t - e) / n;
1577
+ if (a >= 1) return i;
1578
+ let o = S.easeOutQuint(b(a));
1579
+ return {
1580
+ x: x(r.x, i.x, o),
1581
+ y: x(r.y, i.y, o)
1582
+ };
1583
+ }, i = (t) => r(this.exprAt, e.SHAPE_MORPH, xt(t, n, this.exprPrev?.id ?? null), xt(t, n, this.expr?.id ?? null));
1584
+ return r(this.shapeAt, e.SHAPE_MORPH, i(this.shapePrev), i(this.shape));
1585
+ }
1586
+ get state() {
1587
+ return this.cur;
1588
+ }
1589
+ reset(e, t) {
1590
+ this.cur = e, this.prev = null, this.departFige = null, this.tCur = t, this.tPrev = t, this.blinkAt = -10;
1591
+ }
1592
+ origine(e, t, n) {
1593
+ if (this.departFige) return this.departFige;
1594
+ if (!this.prev) return null;
1595
+ let r = Q.get(this.prev);
1596
+ return this.posed(r, Math.max(0, e - this.tPrev), t, n);
1597
+ }
1598
+ poseComposee(e) {
1599
+ let t = Q.get(this.cur), n = this.shapeAtTime(e), r = this.exprAtTime(e), i = this.posed(t, Math.max(0, e - this.tCur), n, r), a = e - this.tCur;
1600
+ if (a >= t.morph) return i;
1601
+ let o = this.origine(e, n, r);
1602
+ return o ? Tt(o, i, S.easeOutQuint(b(a / t.morph))) : i;
1603
+ }
1604
+ setState(e, t) {
1605
+ if (e === this.cur) return;
1606
+ let n = Q.get(this.cur).morph, r = this.prev !== null && t - this.tCur < n;
1607
+ this.departFige = r ? this.poseComposee(t) : null, this.prev = this.cur, this.tPrev = this.tCur, this.cur = e, this.tCur = t, Q.get(e)?.blinkIn && (this.blinkAt = t);
1608
+ }
1609
+ sample(e) {
1610
+ let t = this.scale, n = Q.get(this.cur), r = this.shapeAtTime(e), i = this.exprAtTime(e), a = this.posed(n, Math.max(0, e - this.tCur), r, i), o = this.decalageAtTime(e, this.cur), s = e - this.tCur, c = s < n.morph ? this.origine(e, r, i) : null;
1611
+ if (c) {
1612
+ let t = S.easeOutQuint(b(s / n.morph));
1613
+ a = Tt(c, a, t);
1614
+ let r = this.prev;
1615
+ if (r) {
1616
+ let n = this.decalageAtTime(e, r);
1617
+ o = {
1618
+ x: x(n.x, o.x, t),
1619
+ y: x(n.y, o.y, t)
1620
+ };
1621
+ }
1622
+ }
1623
+ let l = a.eyeAlpha > .01, u = this.lookAtTime(e), d = ge(e, {
1624
+ wander: l ? u.wander : 0,
1625
+ blink: l
1626
+ }), f = {
1627
+ yaw: x(a.gaze.yaw, u.yaw, u.mix) + d.dYaw - u.spin,
1628
+ pitch: x(a.gaze.pitch, u.pitch, u.mix) + d.dPitch,
1629
+ roll: a.gaze.roll + d.dRoll
1630
+ }, p = b((e - this.blinkAt) / .2), m = p < 1 ? Math.abs(p * 2 - 1) : 1, h = Math.min(d.lid, m), g = a.offX + d.driftX, _ = a.offY + d.driftY, v = we(J({
1631
+ ...a.sil,
1632
+ cx: a.sil.cx + g,
1633
+ cy: a.sil.cy + _,
1634
+ sy: a.sil.sy * d.breath
1635
+ }, t, this.pts)), y = (e, t) => Ee(a.sil.radii, Math.atan2(t, e) - a.sil.rot), C = [];
1636
+ if (a.eyeAlpha > .01) {
1637
+ let e = fe(f, t, a.split);
1638
+ for (let n = 0; n < 2; n++) {
1639
+ let r = e[n];
1640
+ if (r.depth <= .02) continue;
1641
+ let i = a.eyes[n], s = y(r.x, r.y), c = (i.tilt ?? 0) * Math.PI / 180, l = Math.cos(c), u = Math.sin(c), d = r.a * l + r.c * u, f = r.b * l + r.d * u, p = -r.a * u + r.c * l, m = -r.b * u + r.d * l, v = B(Math.min(h, i.open));
1642
+ C.push({
1643
+ d: Me(i.w * t, i.h * t),
1644
+ matrix: `matrix(${T(d)},${T(f * v)},${T(p)},${T(m * v)},${T(r.x * s + (g + o.x) * t)},${T(r.y * s + (_ + o.y) * t)})`,
1645
+ alpha: a.eyeAlpha * b(r.depth / .12)
1646
+ });
1647
+ }
1648
+ }
1649
+ let w = a.dots.filter((e) => e.opacity > .01 && e.r > 5e-4).map((e) => ({
1650
+ ...e,
1651
+ x: (e.x + g) * t,
1652
+ y: (e.y + _) * t,
1653
+ r: e.r * t
1654
+ })), E = a.notif ? y(a.notif.x, a.notif.y) : 1, D = a.notif ? (a.notif.x * E + g) * t : 0, O = a.notif ? (a.notif.y * E + _) * t : 0, k = a.notif ? {
1655
+ x: D,
1656
+ y: O,
1657
+ r: a.notif.r * t
1658
+ } : null, A = a.notif ? {
1659
+ x: D,
1660
+ y: O,
1661
+ r: a.notif.notch * t
1662
+ } : null;
1663
+ return {
1664
+ bodyPath: v,
1665
+ bodyAlpha: a.bodyAlpha,
1666
+ eyes: C,
1667
+ dots: w,
1668
+ dotsBehind: a.dotsBehind,
1669
+ arcs: a.arcs.filter((e) => e.opacity > .01).map((e) => ee(e.seed, e.t, t, e.id, e.opacity)),
1670
+ notif: k,
1671
+ notch: A
1672
+ };
1673
+ }
1674
+ }, Dt = 1.1, Ot = 1.5, kt = (e) => ({
1675
+ yaw: 0,
1676
+ pitch: 0,
1677
+ mix: 0,
1678
+ spin: 360 * (1 - S.easeInOutCubic(b(e / Ot))),
1679
+ wander: 1
1680
+ });
1681
+ function At({ nx: e, ny: t, tour: n, pointer: r }) {
1682
+ return {
1683
+ yaw: -26 + e * 16,
1684
+ pitch: 10 - t * 13,
1685
+ mix: n,
1686
+ spin: 360 * (1 - n),
1687
+ wander: +!r
1688
+ };
1689
+ }
1690
+ //#endregion
1691
+ //#region src/bot/cycles.ts
1692
+ var jt = Math.max(...et.map((e) => e.morph)), Mt = 10, Nt = 200, Pt = 50, Ft = .1, It = "defaut";
1693
+ function Lt(e) {
1694
+ return Math.max(jt, Q.get(e)?.minDuration ?? jt);
1695
+ }
1696
+ function Rt(e, t) {
1697
+ let n = Math.round(t / Ft) * Ft, r = Math.min(10, Math.max(Lt(e), n));
1698
+ return Math.round(r * 100) / 100;
1699
+ }
1700
+ function zt(e) {
1701
+ return {
1702
+ state: e,
1703
+ duration: Rt(e, Q.get(e)?.duration ?? 2)
1704
+ };
1705
+ }
1706
+ function Bt() {
1707
+ return {
1708
+ name: "",
1709
+ id: It,
1710
+ blocks: nt.map(zt)
1711
+ };
1712
+ }
1713
+ function Vt(e) {
1714
+ return e.reduce((e, t) => e + t.duration, 0);
1715
+ }
1716
+ function Ht(e, t) {
1717
+ let n = 0;
1718
+ for (let r = 0; r < t && r < e.length; r++) n += e[r].duration;
1719
+ return n;
1720
+ }
1721
+ function Ut(e, t) {
1722
+ let n = Vt(e);
1723
+ if (!e.length || n <= 0) return {
1724
+ index: 0,
1725
+ elapsed: 0
1726
+ };
1727
+ let r = t >= 0 && t < n ? t : (t % n + n) % n, i = 0;
1728
+ for (let t = 0; t < e.length; t++) {
1729
+ let n = i + e[t].duration;
1730
+ if (r < n) return {
1731
+ index: t,
1732
+ elapsed: r - i
1733
+ };
1734
+ i = n;
1735
+ }
1736
+ return {
1737
+ index: e.length - 1,
1738
+ elapsed: 0
1739
+ };
1740
+ }
1741
+ function Wt(e, t) {
1742
+ return e.length >= 200 ? e : [...e, zt(t)];
1743
+ }
1744
+ function Gt(e, t, n) {
1745
+ let r = e.slice(), [i] = r.splice(t, 1);
1746
+ return i ? (r.splice(Math.min(Math.max(n, 0), r.length), 0, i), r) : e;
1747
+ }
1748
+ function Kt(e, t) {
1749
+ let n = new Set(t.map((e) => e.name));
1750
+ if (!n.has(e)) return e;
1751
+ let r = 2;
1752
+ for (; n.has(`${e} ${r}`);) r++;
1753
+ return `${e} ${r}`;
1754
+ }
1755
+ function qt(e) {
1756
+ let t = new Set(e.map((e) => e.id)), n = 1;
1757
+ for (; t.has(`c${n}`);) n++;
1758
+ return `c${n}`;
1759
+ }
1760
+ function Jt(e) {
1761
+ if (typeof e != "object" || !e) return null;
1762
+ let { state: t, duration: n } = e;
1763
+ return typeof t != "string" || !nt.includes(t) || typeof n != "number" || !Number.isFinite(n) ? null : {
1764
+ state: t,
1765
+ duration: Rt(t, n)
1766
+ };
1767
+ }
1768
+ function Yt(e, t) {
1769
+ if (typeof e != "object" || !e) return null;
1770
+ let { id: n, name: r, blocks: i } = e;
1771
+ if (typeof n != "string" || !n || typeof r != "string" || !Array.isArray(i)) return null;
1772
+ let a = i.slice(0, 200).map(Jt).filter((e) => e !== null);
1773
+ return !a.length || t.some((e) => e.id === n) ? null : {
1774
+ id: n,
1775
+ name: r,
1776
+ blocks: a
1777
+ };
1778
+ }
1779
+ function Xt(e) {
1780
+ if (!e) return [];
1781
+ let t;
1782
+ try {
1783
+ t = JSON.parse(e);
1784
+ } catch {
1785
+ return [];
1786
+ }
1787
+ if (!Array.isArray(t)) return [];
1788
+ let n = [];
1789
+ for (let e of t.slice(0, 50)) {
1790
+ let t = Yt(e, n);
1791
+ t && n.push(t);
1792
+ }
1793
+ return n;
1794
+ }
1795
+ //#endregion
1796
+ //#region src/bot/repere.ts
1797
+ var Zt = 100, Qt = 158, $t = /*#__PURE__*/ s("<svg><g></svg>", !1, !0, !1), en = /*#__PURE__*/ s("<svg role=img><defs><mask maskUnits=userSpaceOnUse><path fill=#fff></path></mask></defs><g fill=none stroke-linecap=round></g><g><path></path><g><rect></rect></g></g><g fill=none stroke-linecap=round>"), tn = /*#__PURE__*/ s("<svg><path fill=#000></svg>", !1, !0, !1), nn = /*#__PURE__*/ s("<svg><circle fill=#000></svg>", !1, !0, !1), rn = /*#__PURE__*/ s("<svg><linearGradient gradientUnits=userSpaceOnUse></svg>", !1, !0, !1), an = /*#__PURE__*/ s("<svg><stop></svg>", !1, !0, !1), on = /*#__PURE__*/ s("<svg><path></svg>", !1, !0, !1), sn = /*#__PURE__*/ s("<svg><circle></svg>", !1, !0, !1);
1798
+ function cn(s) {
1799
+ let y = h({
1800
+ size: 320,
1801
+ shape: Be,
1802
+ color: Ue,
1803
+ expression: ve,
1804
+ paper: "#f9f9f9",
1805
+ cycle: Bt().blocks,
1806
+ follow: !1,
1807
+ gaze: null,
1808
+ ariaLabel: "Animated Bloub avatar"
1809
+ }, s), [x, C] = p(0), [w, T] = p("idle"), [E] = p(!1), [ee, D] = p(0), O = () => s.block ?? x(), k = () => s.state ?? w(), A = () => s.playing ?? E(), te = () => s.elapsed ?? ee();
1810
+ function ne(e) {
1811
+ s.block === void 0 && C(e), s.onBlockChange?.(e);
1812
+ }
1813
+ function re(e) {
1814
+ s.state === void 0 && T(e), s.onStateChange?.(e);
1815
+ }
1816
+ function ie(e) {
1817
+ s.elapsed === void 0 && D(e), s.onElapsedChange?.(e);
1818
+ }
1819
+ let ae = f(() => ze.get(y.shape)?.radii ?? null), oe = f(() => He.get(y.color)?.hex ?? "#0a0a0c"), se = f(() => _e.get(y.expression) ?? null), j = new Et(100, k(), ae(), se()), [M, le] = p(j.sample(y.frozenAt ?? 0), { equals: !1 }), ue = m(), de = `bot-mask-${ue}`, N, P = 0, F = Infinity, I = 0, L = 0, R = 0, fe = 0, pe = -1;
1820
+ function z(e, t = 0) {
1821
+ let n = y.cycle[e];
1822
+ if (!n) {
1823
+ F = Infinity;
1824
+ return;
1825
+ }
1826
+ R = L - t, ie(t), re(n.state), j.setState(n.state, L), F = A() ? R + n.duration : Infinity;
1827
+ }
1828
+ function me(e) {
1829
+ ne(e), z(e);
1830
+ }
1831
+ function he(e, t = 0) {
1832
+ if (O() === e) {
1833
+ z(e, t);
1834
+ return;
1835
+ }
1836
+ fe = t, ne(e);
1837
+ }
1838
+ function ge(e) {
1839
+ let t = y.cycle;
1840
+ if (!t.length) return;
1841
+ let { index: n } = Ut(t, e);
1842
+ if (n !== pe) {
1843
+ let e = t[n];
1844
+ re(e.state), n < pe ? j.reset(e.state, Ht(t, n)) : j.setState(e.state, Ht(t, n)), pe = n;
1845
+ }
1846
+ le(j.sample(e));
1847
+ }
1848
+ let B = null, V = !1, H = 0, U = 0, ye = !1, W = 1 / 60;
1849
+ function be(e) {
1850
+ e.pointerType !== "touch" && (B = {
1851
+ x: e.clientX,
1852
+ y: e.clientY
1853
+ });
1854
+ }
1855
+ function xe() {
1856
+ B = null;
1857
+ }
1858
+ function G() {
1859
+ V &&= (j.setLook(null, L, Dt), !1);
1860
+ }
1861
+ function K() {
1862
+ if (!Q.get(k())?.baseFace) {
1863
+ G();
1864
+ return;
1865
+ }
1866
+ let e = N?.getBoundingClientRect();
1867
+ if (!e || e.width === 0 || e.height === 0) return;
1868
+ V || (H = L);
1869
+ let t = Math.max(1, window.innerWidth / 2), n = Math.max(1, window.innerHeight / 2);
1870
+ j.setLook(At({
1871
+ nx: B ? b((B.x - (e.left + e.width / 2)) / t, -1, 1) : 0,
1872
+ ny: B ? b((B.y - (e.top + e.height / 2)) / n, -1, 1) : 0,
1873
+ tour: S.easeOutQuint(b((L - H) / Dt)),
1874
+ pointer: B !== null
1875
+ }), L), V = !0;
1876
+ }
1877
+ function Se(e) {
1878
+ j.setLook(e(L - U), L, W);
1879
+ }
1880
+ function q() {
1881
+ window.removeEventListener("pointermove", be), document.removeEventListener("pointerleave", xe);
1882
+ }
1883
+ function Ce(e) {
1884
+ P = requestAnimationFrame(Ce);
1885
+ let t = I ? Math.min((e - I) / 1e3, .064) : 0;
1886
+ I = e, L += t, A() && (L >= F && y.cycle.length ? me((O() + 1) % y.cycle.length) : ie(L - R)), y.follow ? K() : y.gaze && Se(y.gaze), le(j.sample(L));
1887
+ }
1888
+ function J() {
1889
+ y.frozenAt !== void 0 && le(j.sample(y.frozenAt));
1890
+ }
1891
+ d(g(() => y.gaze, (e) => {
1892
+ e ? (U = L, ye = !0, j.setLook(e(0), L - W, W)) : ye &&= (j.setLook(null, L), !1);
1893
+ })), d(g(O, (e) => {
1894
+ z(e, fe), fe = 0;
1895
+ }, { defer: !0 })), d(g(k, (e) => {
1896
+ j.state !== e && (j.setState(e, L), J());
1897
+ }, { defer: !0 })), d(g(A, (e) => {
1898
+ e ? z(O(), te()) : F = Infinity;
1899
+ }, { defer: !0 })), d(g(() => y.cycle, (e) => {
1900
+ if (!e.length) {
1901
+ F = Infinity;
1902
+ return;
1903
+ }
1904
+ let t = Math.min(O(), e.length - 1);
1905
+ t === O() ? F = A() ? R + e[t].duration : Infinity : me(t);
1906
+ }, { defer: !0 })), d(g(ae, (e) => {
1907
+ j.setShape(e, L), J();
1908
+ }, { defer: !0 })), d(g(se, (e) => {
1909
+ j.setExpression(e, L), J();
1910
+ }, { defer: !0 })), d(g(() => y.frozenAt, J, { defer: !0 })), d(() => {
1911
+ y.follow && y.frozenAt === void 0 ? (window.addEventListener("pointermove", be), document.addEventListener("pointerleave", xe)) : (q(), G());
1912
+ }), v(() => {
1913
+ s.ref?.({
1914
+ get svg() {
1915
+ return N;
1916
+ },
1917
+ seek: he,
1918
+ renderAt: ge
1919
+ }), y.frozenAt === void 0 && (z(O(), te()), P = requestAnimationFrame(Ce));
1920
+ }), _(() => {
1921
+ typeof cancelAnimationFrame < "u" && cancelAnimationFrame(P), typeof window < "u" && q();
1922
+ });
1923
+ function we(e) {
1924
+ let t = {
1925
+ fill: e.color ?? (e.depth === void 0 ? oe() : We(y.paper, oe(), e.depth)),
1926
+ opacity: e.opacity
1927
+ };
1928
+ return e.d ? {
1929
+ ...t,
1930
+ d: e.d,
1931
+ transform: `translate(${e.x} ${e.y}) rotate(${e.rot ?? 0}) scale(100)`
1932
+ } : {
1933
+ ...t,
1934
+ cx: e.x,
1935
+ cy: e.y,
1936
+ r: e.r
1937
+ };
1938
+ }
1939
+ let Y = () => t(l, {
1940
+ get each() {
1941
+ return M().dots;
1942
+ },
1943
+ children: (n) => t(e, i({ get component() {
1944
+ return n.d ? "path" : "circle";
1945
+ } }, () => we(n)))
1946
+ });
1947
+ return (() => {
1948
+ var e = en(), i = e.firstChild, s = i.firstChild, d = s.firstChild, f = i.nextSibling, p = f.nextSibling, m = p.firstChild, h = m.nextSibling, g = h.firstChild, _ = p.nextSibling, v = N;
1949
+ return typeof v == "function" ? c(v, e) : N = e, a(e, "viewBox", "-158 -158 316 316"), a(s, "id", de), a(s, "x", -158), a(s, "y", -158), a(s, "width", 316), a(s, "height", 316), r(s, t(l, {
1950
+ get each() {
1951
+ return M().eyes;
1952
+ },
1953
+ children: (e) => (() => {
1954
+ var t = tn();
1955
+ return n((n) => {
1956
+ var r = e.d, i = e.matrix, o = e.alpha;
1957
+ return r !== n.e && a(t, "d", n.e = r), i !== n.t && a(t, "transform", n.t = i), o !== n.a && a(t, "opacity", n.a = o), n;
1958
+ }, {
1959
+ e: void 0,
1960
+ t: void 0,
1961
+ a: void 0
1962
+ }), t;
1963
+ })()
1964
+ }), null), r(s, t(u, {
1965
+ get when() {
1966
+ return M().notch;
1967
+ },
1968
+ children: (e) => (() => {
1969
+ var t = nn();
1970
+ return n((n) => {
1971
+ var r = e().x, i = e().y, o = e().r;
1972
+ return r !== n.e && a(t, "cx", n.e = r), i !== n.t && a(t, "cy", n.t = i), o !== n.a && a(t, "r", n.a = o), n;
1973
+ }, {
1974
+ e: void 0,
1975
+ t: void 0,
1976
+ a: void 0
1977
+ }), t;
1978
+ })()
1979
+ }), null), r(i, t(l, {
1980
+ get each() {
1981
+ return M().arcs;
1982
+ },
1983
+ children: (e) => (() => {
1984
+ var i = rn();
1985
+ return r(i, t(l, {
1986
+ get each() {
1987
+ return e.grad.stops;
1988
+ },
1989
+ children: (t, r) => (() => {
1990
+ var i = an();
1991
+ return a(i, "stop-color", t), n(() => a(i, "offset", r() / (e.grad.stops.length - 1))), i;
1992
+ })()
1993
+ })), n((t) => {
1994
+ var n = `${ue}-${e.id}`, r = e.grad.x1, o = e.grad.y1, s = e.grad.x2, c = e.grad.y2;
1995
+ return n !== t.e && a(i, "id", t.e = n), r !== t.t && a(i, "x1", t.t = r), o !== t.a && a(i, "y1", t.a = o), s !== t.o && a(i, "x2", t.o = s), c !== t.i && a(i, "y2", t.i = c), t;
1996
+ }, {
1997
+ e: void 0,
1998
+ t: void 0,
1999
+ a: void 0,
2000
+ o: void 0,
2001
+ i: void 0
2002
+ }), i;
2003
+ })()
2004
+ }), null), r(f, t(l, {
2005
+ get each() {
2006
+ return M().arcs;
2007
+ },
2008
+ children: (e) => (() => {
2009
+ var t = on();
2010
+ return n((n) => {
2011
+ var r = e.back, i = `url(#${ue}-${e.id})`, o = e.width, s = e.opacity;
2012
+ return r !== n.e && a(t, "d", n.e = r), i !== n.t && a(t, "stroke", n.t = i), o !== n.a && a(t, "stroke-width", n.a = o), s !== n.o && a(t, "opacity", n.o = s), n;
2013
+ }, {
2014
+ e: void 0,
2015
+ t: void 0,
2016
+ a: void 0,
2017
+ o: void 0
2018
+ }), t;
2019
+ })()
2020
+ })), r(e, t(u, {
2021
+ get when() {
2022
+ return M().dotsBehind;
2023
+ },
2024
+ get children() {
2025
+ var e = $t();
2026
+ return r(e, t(Y, {})), e;
2027
+ }
2028
+ }), p), a(h, "mask", `url(#${de})`), a(g, "x", -158), a(g, "y", -158), a(g, "width", 316), a(g, "height", 316), r(e, t(u, {
2029
+ get when() {
2030
+ return !M().dotsBehind;
2031
+ },
2032
+ get children() {
2033
+ var e = $t();
2034
+ return r(e, t(Y, {})), e;
2035
+ }
2036
+ }), _), r(e, t(u, {
2037
+ get when() {
2038
+ return M().notif;
2039
+ },
2040
+ children: (e) => (() => {
2041
+ var t = sn();
2042
+ return a(t, "fill", ce), n((n) => {
2043
+ var r = e().x, i = e().y, o = e().r;
2044
+ return r !== n.e && a(t, "cx", n.e = r), i !== n.t && a(t, "cy", n.t = i), o !== n.a && a(t, "r", n.a = o), n;
2045
+ }, {
2046
+ e: void 0,
2047
+ t: void 0,
2048
+ a: void 0
2049
+ }), t;
2050
+ })()
2051
+ }), _), r(_, t(l, {
2052
+ get each() {
2053
+ return M().arcs;
2054
+ },
2055
+ children: (e) => (() => {
2056
+ var t = on();
2057
+ return n((n) => {
2058
+ var r = e.front, i = `url(#${ue}-${e.id})`, o = e.width, s = e.opacity;
2059
+ return r !== n.e && a(t, "d", n.e = r), i !== n.t && a(t, "stroke", n.t = i), o !== n.a && a(t, "stroke-width", n.a = o), s !== n.o && a(t, "opacity", n.o = s), n;
2060
+ }, {
2061
+ e: void 0,
2062
+ t: void 0,
2063
+ a: void 0,
2064
+ o: void 0
2065
+ }), t;
2066
+ })()
2067
+ })), n((t) => {
2068
+ var n = y.size, r = y.size, i = y.ariaLabel, s = y.class, c = y.style, l = M().bodyPath, u = M().bodyAlpha, f = M().bodyPath, h = y.paper, _ = oe();
2069
+ return n !== t.e && a(e, "width", t.e = n), r !== t.t && a(e, "height", t.t = r), i !== t.a && a(e, "aria-label", t.a = i), s !== t.o && a(e, "class", t.o = s), t.i = o(e, c, t.i), l !== t.n && a(d, "d", t.n = l), u !== t.s && a(p, "opacity", t.s = u), f !== t.h && a(m, "d", t.h = f), h !== t.r && a(m, "fill", t.r = h), _ !== t.d && a(g, "fill", t.d = _), t;
2070
+ }, {
2071
+ e: void 0,
2072
+ t: void 0,
2073
+ a: void 0,
2074
+ o: void 0,
2075
+ i: void 0,
2076
+ n: void 0,
2077
+ s: void 0,
2078
+ h: void 0,
2079
+ r: void 0,
2080
+ d: void 0
2081
+ }), e;
2082
+ })();
2083
+ }
2084
+ //#endregion
2085
+ export { cn as BloubBot, Et as BotEngine, Ve as COLORS, He as COLOR_BY_ID, Ue as DEFAULT_COLOR, ve as DEFAULT_EXPRESSION, Be as DEFAULT_SHAPE, Qt as DEMI_VIEWBOX, U as EXPRESSIONS, _e as EXPRESSION_BY_ID, Mt as MAX_BLOCK, Nt as MAX_BLOCS, Pt as MAX_CYCLES, jt as MIN_BLOCK, tt as POSES, Zt as RAYON, nt as SEQUENCE, Re as SHAPES, ze as SHAPE_BY_ID, et as STATES, Q as STATE_BY_ID, Ft as STEP, Ot as TOUR_TIME, Dt as TURN_TIME, W as blendExpression, Ut as blockAt, Wt as blocksWith, Rt as clampDuration, Bt as defaultCycle, At as lookTarget, zt as makeBlock, Lt as minDurationOf, We as mixHex, Gt as moveBlock, qt as nextCycleId, Ht as offsetOf, Xt as parseCycles, Vt as totalDuration, kt as tourLook, Kt as uniqueName };