bloub-to-vue-and-react 0.1.2

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