@norbert_bodziony/bloub 0.3.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- import{Dynamic as e,escape as t,mergeProps as n,ssr as r,ssrAttribute as i,ssrClassName as a,ssrGroup as o,ssrHydrationKey as s,ssrStyle as c}from"@solidjs/web";import{For as l,Show as u,createEffect as d,createMemo as f,createSignal as p,createUniqueId as m,onCleanup as h,onSettled as g,untrack as _}from"solid-js";var v=Math.PI*2,y=(e,t=0,n=1)=>e<t?t:e>n?n:e,b=(e,t,n)=>e+(t-e)*n,x={easeOutCubic:e=>1-(1-e)**3,easeInOutCubic:e=>e<.5?4*e**3:1-(-2*e+2)**3/2,easeOutQuint:e=>1-(1-e)**5};function S(e,t,n=0){let r=e/t*v;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)}function C(e){let t=e>>>0;return()=>{t=t+1831565813>>>0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}var w=e=>Math.round(e*100)/100;function ee(e,t=.55,n=.62){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?[i,a,0]:r<120?[a,i,0]:r<180?[0,i,a]:r<240?[0,a,i]:r<300?[a,0,i]:[i,0,a],u=e=>Math.round((e+o)*255).toString(16).padStart(2,`0`);return`#${u(s)}${u(c)}${u(l)}`}function te(e,t,n,r,i=1){let a=e.phase+t*e.speed*v,o=Math.cos(e.tilt),s=Math.sin(e.tilt),c=Math.sqrt(Math.max(0,1-e.k*e.k)),l=e.sweep*v,u=``,d=``,f=null;for(let t=0;t<=64;t++){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,_=w(m*n),v=w(h*n),y=g===f?`L`:`M`;g?d+=`${y}${_} ${v}`:u+=`${y}${_} ${v}`,f=g}let p=Math.cos(e.tilt)*e.a*n,m=Math.sin(e.tilt)*e.a*n;return{id:r,front:u,back:d,width:e.width*n,opacity:i,grad:{x1:w(e.cx*n-p),y1:w(e.cy*n-m),x2:w(e.cx*n+p),y2:w(e.cy*n+m),stops:[ee(e.hue),ee(e.hue+e.hueSpan*.5),ee(e.hue+e.hueSpan)]}}}var T=C(659918),E=Array.from({length:6},(e,t)=>({a:1.3+T()*.1,k:.05+T()*.4,tilt:t/6*Math.PI+T()*.5,speed:3+T()*.7,phase:T()*v,sweep:.6+T()*.25,hue:t*360/6+T()*30,hueSpan:60+T()*60,width:.05+T()*.012,cx:0,cy:.1})),ne=Array.from({length:4},(e,t)=>({a:.78+t*.2,k:.05+t*.02,tilt:-.62+t*.05,speed:.3,phase:.06*t,sweep:.4,hue:95+t*62,hueSpan:100,width:.05,cx:0,cy:-.12})),re=[-.557,-.013,.532],D=.165,ie=1.25,O=C(48879),ae=Array.from({length:5},(e,t)=>({birth:t*.2,angle:O()*v,rho:.58+O()*.18}));function oe(e,t){let n=[];for(let r of ae){let i=e-r.birth;if(i<0||i>.62)continue;let a=r.rho*.75**(i*10),o=r.angle+i*100*Math.PI/180;n.push({x:Math.cos(o)*a*t,y:Math.sin(o)*a*t,r:(.04+.028*y(i/.55))*t,depth:y(1-a/.8),opacity:y(i/.06)*y((.62-i)/.08)})}return n}var se=C(49383),ce=Array.from({length:4},(e,t)=>{let n=t-1.5;return{a:.85*(1+n*.03),k:.15/.85*(1+n*.16),tilt:34*Math.PI/180+n*.035,speed:210/360,phase:-t*.045+se()*.012,sweep:.34,hue:t*85+se()*20,hueSpan:80,width:.095,cx:0,cy:0}}),le=.129,ue=`#2496e8`,de=1.003,fe=.15,k=1.14,A=.054,j=15.46,M=.186,N=.412,pe={yaw:28.49,pitch:28.62,roll:-13},P=e=>e*Math.PI/180;function F(e,t,n){let r=Math.cos(n),i=Math.sin(n);return[[e[0]*r+t[0]*i,e[1]*r+t[1]*i,e[2]*r+t[2]*i],[t[0]*r-e[0]*i,t[1]*r-e[1]*i,t[2]*r-e[2]*i]]}function I(e,t,n=j){let r=[0,0,1],i=[1,0,0],a=[0,1,0];[r,i]=F(r,i,P(e.yaw)),[a,r]=F(a,r,P(e.pitch)),[i,a]=F(i,a,P(e.roll));let o=e=>{let[o,s]=F(r,i,P(n*e));return{x:o[0]*t,y:o[1]*t,a:s[0],b:s[1],c:a[0],d:a[1],depth:o[2]}};return[o(-1),o(1)]}var L=C(24301),R=(()=>{let e=[],t=1.4;for(;t<900;)e.push(t),t+=1.9+L()*2.7,L()<.18&&(e.push(t),t+=.24);return e})(),me=.18;function he(e){for(let t=0;t<R.length;t++){let n=R[t];if(e<n)break;let r=(e-n)/me;if(r>=0&&r<=1)return r<.45?1-r/.45:(r-.45)/.55}return 1}function ge(e,t={}){let{wander:n=1,blink:r=!0,float:i=!0}=t;return{dYaw:(S(e,11.3,.4)*5.5+S(e,3.7,2.1)*1.6)*n,dPitch:(S(e,9.1,1.3)*4.2+S(e,4.3,.7)*1.3)*n,dRoll:S(e,13.7,3.2)*2.2*n,lid:r?he(e):1,driftX:i?S(e,7.9,1.9)*.006:0,driftY:i?S(e,5.3,.3)*.007:0,breath:i?1+Math.sin(e/3.4*Math.PI*2)*.005:1}}function z(e){return .06+.94*y(e)}var B=(e,t,n=0,r=1)=>({w:e,h:t,tilt:n,open:r}),V=(e,t,n=0,r=1)=>[B(e,t,n,r),B(e,t,-n,r)],_e=[{id:`neutre`,gaze:{...pe},split:j,eyes:[B(M,N),B(M,N)]},{id:`attentif`,gaze:{yaw:4,pitch:5,roll:-4},split:16,eyes:V(.21,.44)},{id:`surpris`,gaze:{yaw:3,pitch:-3,roll:0},split:19,eyes:V(.45,.47)},{id:`excite`,gaze:{yaw:6,pitch:-14,roll:0},split:19.5,eyes:V(.4,.56,-10)},{id:`heureux`,gaze:{yaw:5,pitch:9,roll:0},split:17,eyes:V(.27,.17,14)},{id:`hilare`,gaze:{yaw:4,pitch:14,roll:0},split:18,eyes:V(.34,.13,20)},{id:`colere`,gaze:{yaw:3,pitch:7,roll:0},split:17,eyes:V(.34,.15,30)},{id:`triste`,gaze:{yaw:3,pitch:-13,roll:0},split:16,eyes:V(.22,.4,-28)},{id:`effraye`,gaze:{yaw:2,pitch:-20,roll:0},split:20.5,eyes:V(.4,.6)},{id:`mefiant`,gaze:{yaw:12,pitch:6,roll:-6},split:16,eyes:[B(.21,.4),B(.22,.15)]},{id:`confus`,gaze:{yaw:-14,pitch:3,roll:8},split:16.5,eyes:[B(.2,.44,-18),B(.28,.17,14)]},{id:`curieux`,gaze:{yaw:16,pitch:-9,roll:-15},split:16.5,eyes:[B(.24,.46,-8),B(.2,.38,-8)]},{id:`fier`,gaze:{yaw:5,pitch:17,roll:0},split:17,eyes:V(.3,.15,18)},{id:`timide`,gaze:{yaw:-19,pitch:-14,roll:-7},split:14,eyes:V(.17,.3)},{id:`blase`,gaze:{yaw:-22,pitch:2,roll:0},split:16,eyes:V(.3,.12)},{id:`somnolent`,gaze:{yaw:6,pitch:-9,roll:-3},split:16,eyes:V(.2,.42,0,.42)}],ve=new Map(_e.map(e=>[e.id,e])),ye=`neutre`,be=(e,t,n)=>({w:b(e.w,t.w,n),h:b(e.h,t.h,n),tilt:b(e.tilt??0,t.tilt??0,n),open:b(e.open,t.open,n)});function xe(e,t,n){return{id:t.id,gaze:{yaw:b(e.gaze.yaw,t.gaze.yaw,n),pitch:b(e.gaze.pitch,t.gaze.pitch,n),roll:b(e.gaze.roll,t.gaze.roll,n)},split:b(e.split,t.split,n),eyes:[be(e.eyes[0],t.eyes[0],n),be(e.eyes[1],t.eyes[1],n)]}}var Se={egg:[.8369,.8424,.8497,.8585,.8674,.8775,.8878,.8983,.9089,.9185,.9288,.9374,.9445,.9504,.9543,.9559,.9555,.9519,.9466,.9389,.9302,.9193,.9085,.8969,.8852,.8734,.8625,.8513,.8411,.8325,.8243,.8179,.8137,.8112,.8102,.8128,.8178,.8262,.8374,.8518,.8702,.8922,.9169,.9446,.9741,1.0023,1.0267,1.0433,1.0481,1.0393,1.0216,.997,.9697,.9418,.9169,.8949,.876,.8604,.849,.8394,.8337,.8314,.8305,.8326],hexagon:[.921,.9282,.9441,.9706,.9984,1.0059,.9896,.9562,.929,.9124,.9047,.9058,.9157,.9349,.9642,.9873,.9882,.9665,.9336,.9105,.8968,.8918,.8955,.908,.9293,.9611,.982,.9812,.959,.9282,.9089,.8978,.8964,.9026,.9189,.9439,.9778,.999,.9964,.9713,.9439,.9274,.9196,.9206,.9308,.9502,.9799,1.0121,1.0226,1.0071,.9752,.951,.9366,.9316,.9351,.9485,.9711,1.0026,1.0213,1.0155,.9863,.9547,.9347,.9232],triangle:[.7819,.8211,.8747,.944,1.0223,1.096,1.1401,1.134,1.0808,1.0047,.9265,.8603,.8104,.773,.745,.7273,.7151,.7118,.7148,.7245,.7427,.768,.8037,.8518,.9148,.9876,1.0583,1.1073,1.1109,1.0667,.994,.9164,.8482,.7948,.7555,.7261,.7056,.6925,.6859,.6869,.6938,.7084,.7305,.7615,.804,.8595,.9311,1.0092,1.0791,1.1171,1.1054,1.0501,.9779,.905,.845,.799,.7656,.7413,.7258,.716,.7146,.7204,.733,.7528]},H=Array.from({length:64},(e,t)=>t/64*v),U=H.map(Math.cos),W=H.map(Math.sin);function G(e,t={}){return{radii:[...Se[e]],rot:0,cx:0,cy:0,sx:1,sy:1,...t}}function K(e,t={}){return{radii:Array(64).fill(e),rot:0,cx:0,cy:0,sx:1,sy:1,...t}}function Ce(e,t,n,r){let i=r??{radii:Array(64),rot:0,cx:0,cy:0,sx:1,sy:1};for(let r=0;r<64;r++)i.radii[r]=b(e.radii[r]??1,t.radii[r]??1,n);let a=t.rot-e.rot;for(;a>Math.PI;)a-=v;for(;a<-Math.PI;)a+=v;return i.rot=e.rot+a*n,i.cx=b(e.cx,t.cx,n),i.cy=b(e.cy,t.cy,n),i.sx=b(e.sx,t.sx,n),i.sy=b(e.sy,t.sy,n),i}function we(e,t,n=[]){let r=Math.cos(e.rot),i=Math.sin(e.rot);for(let a=0;a<64;a++){let o=e.radii[a]??1,s=o*(U[a]??0),c=o*(W[a]??0),l=s*r-c*i,u=s*i+c*r,d=n[a]??{x:0,y:0};d.x=(l*e.sx+e.cx)*t,d.y=(u*e.sy+e.cy)*t,n[a]=d}return n.length=64,n}function Te(e,t=1/6){let n=e.length;if(n<3)return``;let r=e[0],i=`M${w(r.x)} ${w(r.y)}`;for(let r=0;r<n;r++){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;i+=`C${w(l)} ${w(u)} ${w(d)} ${w(f)} ${w(s.x)} ${w(s.y)}`}return`${i}Z`}function q(e,t,n){let r=Array(64).fill(0),i=e.length;for(let a=0;a<64;a++){let o=U[a]??0,s=W[a]??0,c=0;for(let r=0;r<i;r++){let a=e[r],l=e[(r+1)%i],u=l.x-a.x,d=l.y-a.y,f=o*d-s*u;if(Math.abs(f)<1e-9)continue;let p=a.x-t,m=a.y-n,h=(p*d-m*u)/f,g=(p*s-m*o)/f;h>c&&g>=0&&g<=1&&(c=h)}r[a]=c}return r}function J(e,t,n,r,i,a,o=96){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=[];for(let r=0;r<=o/2;r++){let i=u+d+(v-2*d)*r/(o/2);f.push({x:e+Math.cos(i)*n,y:t+Math.sin(i)*n})}for(let e=0;e<=o/2;e++){let t=u-d+2*d*e/(o/2);f.push({x:r+Math.cos(t)*a,y:i+Math.sin(t)*a})}return f}function Ee(e,t){let n=e.length,r=(t/v%1+1)%1*n,i=Math.floor(r);return b(e[i%n]??1,e[(i+1)%n]??1,r-i)}function De(e,t=1,n=1){return H.map((r,i)=>(Math.abs((U[i]??0)/t)**e+Math.abs((W[i]??0)/n)**e)**(-1/e))}function Oe(e){let t=Array(64).fill(0);for(let n=0;n<64;n++){let r=U[n]??0,i=W[n]??0,a=0;for(let t of e){let e=r*t.x+i*t.y,n=e*e-(t.x*t.x+t.y*t.y-t.r*t.r);if(n<0)continue;let o=e+Math.sqrt(n);o>a&&(a=o)}t[n]=a}return t}function ke(e,t,n=10){let r=e.length,i=[],a=(e,t)=>{let n=t.x-e.x,r=t.y-e.y,i=Math.hypot(n,r)||1;return Math.atan2(-n/i,r/i)};for(let o=0;o<r;o++){let s=e[(o-1+r)%r],c=e[o],l=e[(o+1)%r],u=a(s,c),d=a(c,l)-u;for(;d>Math.PI;)d-=v;for(;d<-Math.PI;)d+=v;for(let e=0;e<=n;e++){let r=u+d*e/n;i.push({x:c.x+Math.cos(r)*t,y:c.y+Math.sin(r)*t})}}return i}function Ae(e,t,n,r=0){let i=r*Math.PI/180;return q(ke(Array.from({length:e},(r,a)=>{let o=i+a/e*v;return{x:Math.cos(o)*(t-n),y:Math.sin(o)*(t-n)}}),n),0,0)}function je(e,t=1){if(e.length<3)return``;let n=``;for(let r=0;r<e.length;r++){let i=e[r];n+=`${r===0?`M`:`L`}${w(i.x*t)} ${w(i.y*t)}`}return`${n}Z`}function Me(e,t){let n=Math.max(e,.01)/2,r=Math.max(t,.01)/2,i=Math.min(n,r);return`M${w(-n)} ${w(-r+i)}A${w(i)} ${w(i)} 0 0 1 ${w(-n+i)} ${w(-r)}L${w(n-i)} ${w(-r)}A${w(i)} ${w(i)} 0 0 1 ${w(n)} ${w(-r+i)}L${w(n)} ${w(r-i)}A${w(i)} ${w(i)} 0 0 1 ${w(n-i)} ${w(r)}L${w(-n+i)} ${w(r)}A${w(i)} ${w(i)} 0 0 1 ${w(-n)} ${w(r-i)}Z`}function Ne(e,t=1){let n=Math.max(...e);if(n<=0)return e;let r=t/n;return e.map(e=>e*r)}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([{x:-.44,y:.2,r:.54},{x:.46,y:.2,r:.5},{x:.02,y:.3,r:.6},{x:-.24,y:-.3,r:.48},{x:.3,y:-.24,r:.44}]),1.02),Ie=Ne(q(J(0,.28,.66,0,-.96,.05),0,0),1.04),Le=q(J(-.42,0,.62,.42,0,.62),0,0),Re=[{id:`cercle`,radii:Array(64).fill(1)},{id:`galet`,radii:Pe},{id:`squircle`,radii:Ne(De(4.2),1.15)},{id:`capsule`,radii:Le},{id:`triangle`,radii:Ae(3,1.12,.34,-90)},{id:`hexagone`,radii:Ae(6,1.04,.26,0)},{id:`nuage`,radii:Fe},{id:`goutte`,radii:Ie}],ze=new Map(Re.map(e=>[e.id,e])),Be=`cercle`,Ve=[{id:`encre`,hex:`#0a0a0c`},{id:`brun`,hex:`#8b5e3c`},{id:`rouge`,hex:`#e8483f`},{id:`orange`,hex:`#f08a24`},{id:`ambre`,hex:`#f0b429`},{id:`vert`,hex:`#3ecf8e`},{id:`turquoise`,hex:`#2fbfa0`},{id:`bleu`,hex:`#3b93f0`},{id:`violet`,hex:`#8b5cf6`},{id:`rose`,hex:`#e152b0`},{id:`gris`,hex:`#a3a3a3`},{id:`creme`,hex:`#f1efe9`}],He=new Map(Ve.map(e=>[e.id,e])),Ue=`encre`;function We(e,t,n){let r=e=>{let t=parseInt(e.slice(1),16);return[t>>16&255,t>>8&255,t&255]},i=r(e),a=r(t);return`#${i.map((e,t)=>Math.round(e+(a[t]-e)*n)).map(e=>e.toString(16).padStart(2,`0`)).join(``)}`}var Y=(e,t)=>[{w:e,h:t,open:1},{w:e,h:t,open:1}];function X(e={}){return{sil:K(1),offX:0,offY:0,gaze:{...pe},split:j,eyes:Y(M,N),eyeAlpha:1,bodyAlpha:1,dots:[],arcs:[],notif:null,dotsBehind:!1,...e}}var Ge=-.1875,Ke=q(J(0,-.505,.132,0,.13,.075),0,Ge),qe=q(J(0,-.2535,.1345,0,.2535,.1345),0,0),Je=(e={})=>({radii:[...Ke],rot:0,cx:0,cy:Ge,sx:1,sy:1,...e}),Ye=(e={})=>({radii:[...qe],rot:0,cx:0,cy:0,sx:1,sy:1,...e}),Xe=je(J(0,0,.118,0,.172,.012)),Ze=.213;function Qe(e){return G(`triangle`,{rot:e,cx:-.213*Math.sin(e),cy:Ze*Math.cos(e)})}function $e(e,t){let n=((e-t*.5)/1.5%1+1)%1;return y((n<.5?.5-.5*Math.cos(n*v):0)*2)}var et=[{id:`idle`,duration:2.4,morph:.45,blinkIn:!1,baseFace:!0,baseBody:!0,pose:()=>X()},{id:`thinking`,duration:2.6,morph:.4,baseFace:!1,baseBody:!1,blinkIn:!0,pose:e=>{let t=$e(e,1),n=.3+.7*x.easeOutCubic(y(e/.3));return X({sil:K(D*(1+(ie-1)*t),{cx:re[1]}),eyeAlpha:0,dots:[0,2].map(t=>{let r=$e(e,t);return{x:re[t]*n,y:0,r:D*(1+(ie-1)*r),opacity:.55+.45*r}})})}},{id:`wink`,duration:1.6,morph:.3,blinkIn:!0,baseFace:!1,baseBody:!0,pose:()=>X({gaze:{yaw:-5.37,pitch:4.55,roll:6.7},split:16.25,eyes:[{w:.236,h:.464,open:1},{w:.447,h:.089,open:1}]})},{id:`wide`,duration:1.8,morph:.55,blinkIn:!0,baseFace:!1,baseBody:!0,pose:()=>X({gaze:{yaw:6.92,pitch:-21.96,roll:11.6},split:18.43,eyes:Y(.356,.875)})},{id:`alert`,duration:2.4,minDuration:2,morph:.45,baseFace:!1,baseBody:!1,blinkIn:!1,pose:e=>{let t=y(e/1.5),n=x.easeInOutCubic(t)*.82-.087,r=e>1.6?y((e-1.6)/.4):0,i=n*(1-r)+.1*r,a=Math.sin(e*2.5*v)*.005,o=17.7*Math.PI/180;return X({sil:Ye({rot:o,cx:i,cy:-.325-a}),eyeAlpha:0,dots:[{x:i-Math.sin(o)*.58,y:-.325+Math.cos(o)*.58+a*2.8,r:.118,d:Xe,rot:o*180/Math.PI,opacity:1}]})}},{id:`notify`,duration:2.2,morph:.5,blinkIn:!0,baseFace:!1,baseBody:!0,pose:e=>{let t=y(e/.45),n=1+(k-1)*Math.sin(t*Math.PI)*(1-t*.35),r=fe*(t<1?n:1),i=-42*Math.PI/180;return X({gaze:{yaw:-21.94,pitch:-5.82,roll:-12.2},split:18.89,eyes:Y(.505,.498),notif:{x:Math.cos(i)*de,y:Math.sin(i)*de,r,notch:r+A}})}},{id:`exclaim`,duration:2,morph:.45,baseFace:!1,baseBody:!1,blinkIn:!1,pose:()=>X({sil:Je(),eyeAlpha:0,dots:[{x:-.012,y:.526,r:.113,opacity:1}]})},{id:`sleep`,duration:2.4,morph:.5,baseFace:!1,baseBody:!1,blinkIn:!1,pose:e=>X({sil:K(.1585,{cy:.11+Math.sin(v/.6*e)*.19}),eyeAlpha:0})},{id:`egg`,duration:1.8,morph:.4,baseFace:!1,baseBody:!1,blinkIn:!0,pose:()=>X({sil:G(`egg`),gaze:{yaw:19.97,pitch:26.01,roll:-17.1},split:11.07,eyes:Y(.164,.385)})},{id:`hexagon`,duration:1.6,morph:.4,baseFace:!1,baseBody:!1,blinkIn:!0,pose:()=>X({sil:G(`hexagon`),gaze:{yaw:23.11,pitch:24.42,roll:-13.3},split:13.37,eyes:Y(.177,.411)})},{id:`play`,duration:2,morph:.5,baseFace:!1,baseBody:!1,blinkIn:!0,pose:e=>{let t=y(e/.35)*y((2.2-e)/.5);return X({sil:Qe(0),gaze:{yaw:12,pitch:-8,roll:-6},split:15,eyes:Y(.18,.34),arcs:ne.map((n,r)=>({id:`sw${r}`,seed:{...n,cx:.45-e*.42},t:e,opacity:t}))})}},{id:`orbit`,duration:3.4,minDuration:2.5,morph:.6,baseFace:!1,baseBody:!1,blinkIn:!1,pose:e=>{let t=x.easeInOutCubic(y(e/.35)),n=-v*1.25*e*t,r=x.easeInOutCubic(y((e-1.6)/.9)),i=Qe(n),a=K(1,{rot:n}),o={radii:i.radii.map((e,t)=>e+(a.radii[t]-e)*r),rot:n,cx:i.cx*(1-r),cy:i.cy*(1-r),sx:1,sy:1},s=y(e/.8)*y((3.6-e)/.9);return X({sil:o,gaze:{yaw:pe.yaw+Math.sin(e*6.5)*65*(1-r),pitch:-4+r*32,roll:-13},eyes:Y(.18,.34+r*.07),arcs:E.map((t,n)=>({id:`rg${n}`,seed:t,t:e,opacity:s*y((e-n*.13)/.3)}))})}},{id:`swirl`,duration:1.3,minDuration:1.3,morph:.3,baseFace:!0,baseBody:!0,blinkIn:!0,pose:e=>X({arcs:E.slice(0,3).map((t,n)=>({id:`sw${n}`,seed:t,t:e,opacity:y((e-n*.06)/.14)*y((1.22-e)/.34)}))})},{id:`burst`,duration:2.6,minDuration:2.4,morph:.4,baseFace:!1,baseBody:!1,blinkIn:!1,pose:e=>{let t=1-.834*x.easeOutQuint(y(e/.7)),n=x.easeOutQuint(y((e-1.7)/.7));return X({sil:K(t+(1-t)*n),eyeAlpha:y((e-1.85)/.4),dots:oe(e,1),dotsBehind:!0})}},{id:`comet`,duration:2.4,minDuration:2.4,morph:.45,baseFace:!1,baseBody:!1,blinkIn:!1,pose:e=>{let t=1-(1-le)*x.easeOutQuint(y(e/.55)),n=x.easeOutQuint(y((e-1.85)/.6)),r=y((e-.15)/.25)*y((1.95-e)/.3);return X({sil:K(t+(1-t)*n,{cy:Math.sin(y(e/1.7)*Math.PI)*.035}),eyeAlpha:y((e-2)/.35),arcs:ce.map((t,n)=>({id:`cm${n}`,seed:t,t:e,opacity:r}))})}}],Z=new Map(et.map(e=>[e.id,e])),tt={idle:1,thinking:1.1,wink:.8,wide:.8,alert:.75,notify:.9,exclaim:.8,sleep:.45,egg:.8,hexagon:.8,play:.9,orbit:1.2,swirl:.5,burst:.45,comet:1.15},nt=[`idle`,`thinking`,`wink`,`wide`,`alert`,`notify`,`exclaim`,`sleep`,`egg`,`hexagon`,`play`,`orbit`,`burst`,`comet`],Q=100,rt=7.1,it=5.5,at=.006,ot=.007;function st(e,t,n){let r=[],i=I(e.gaze,Q,e.split);for(let a=0;a<2;a++){let o=i[a];if(o.depth<=.02)continue;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*Q,.01)/2,g=Math.max(s.h*Q,.01)/2,_=Math.min(h,g),v=g>h,y=v?g-_:h-_,b=Ee(n,Math.atan2(o.y,o.x)-t.rot);r.push({x:o.x*b,y:o.y*b,ax:(v?p:d)*y,ay:(v?m:f)*y,r:_,m:[d,f,p,m]})}return r}function ct(e,t,n,r,i){let a=r-t,o=i-n,s=a*a+o*o,c=1/0,l=0,u=0;for(let r=0;r<e.length;r++){let i=e[r],d=s>0?((i.x-t)*a+(i.y-n)*o)/s:0;d=d<0?0:d>1?1:d;let f=t+d*a-i.x,p=n+d*o-i.y,m=f*f+p*p;m<c&&(c=m,l=f,u=p)}let d=Math.sqrt(c);return{d,ux:d>1e-9?l/d:0,uy:d>1e-9?u/d:0}}var lt=Math.hypot(at,ot)*Q;function ut(e,t,n,r){let i=1/0,a=0,o=0;for(let s of t){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;l.d-m<i&&(i=l.d-m,a=l.ux,o=l.uy)}return{marge:i,ux:a,uy:o}}var dt=12,ft=8;function pt(e){if(!e.length)return{x:0,y:0};let t=(t,n)=>{let r=1/0;for(let i of e)r=Math.min(r,ut(i.contour,i.empreintes,t,n).marge);return r},n=1/0;for(let t of e)n=Math.min(n,ut(t.calContour,t.reference,0,0).marge);let r=0,i=0,a=e[0].empreintes;for(let e of a)r-=e.x/a.length,i-=e.y/a.length;let o=Math.max(.35*Q,Math.hypot(r,i)*1.25);n=Math.min(n,t(r,i));let s=t(0,0);if(s>=n&&s>=0)return{x:0,y:0};let c=Math.max(n,0),l=0,u=0,d=1/0,f=0,p=0,m=s;for(let e=0;e<dt;e++){let n=e/dt*Math.PI*2,r=Math.cos(n),i=Math.sin(n);if(t(r*o,i*o)<c){for(let e of[.3,.6,1]){let n=t(r*o*e,i*o*e);n>m&&(m=n,f=r*o*e,p=i*o*e)}continue}let a=0,s=o;for(let e=0;e<ft;e++){let e=(a+s)/2;t(r*e,i*e)>=c?s=e:a=e}s<d&&(d=s,l=r*s,u=i*s)}let h=d===1/0?f:l,g=d===1/0?p:u;return{x:+(h/Q).toFixed(6),y:+(g/Q).toFixed(6)}}function mt(e,t,n){return e.baseFace&&n?{gaze:n.gaze,split:n.split,eyes:n.eyes}:{gaze:t.gaze,split:t.split,eyes:t.eyes}}function ht(e){let t=e=>JSON.stringify([e.gaze,e.split,e.eyes,e.sil.rot,e.sil.cx,e.sil.cy,e.sil.sx,e.sil.sy]);return t(e.pose(0))===t(e.pose(e.duration))?[0]:Array.from({length:3},(t,n)=>n/2*e.duration)}function gt(e,t,n){let r=[];for(let i of ht(e)){let a=e.pose(i),o=we({...a.sil,radii:t},Q),s=we(a.sil,Q),c=mt(e,a,n),l=[];for(let e of[-7.1,rt])for(let t of[-5.5,it])l.push({...c,gaze:{yaw:c.gaze.yaw+e,pitch:c.gaze.pitch+t,roll:c.gaze.roll}});for(let e of l)r.push({empreintes:st(e,a.sil,t),reference:st(e,a.sil,a.sil.radii),contour:o,calContour:s})}return pt(r)}var _t={x:0,y:0},vt=(e,t)=>`${e}|${t??``}`;function yt(){return new Map(Re.map(e=>{let t=new Map;for(let n of et){if(!n.baseBody)continue;let r=n.baseFace?[null,..._e]:[null];for(let i of r)t.set(vt(n.id,i?.id??null),gt(n,e.radii,i))}return[e.radii,t]}))}var bt=yt();function xt(e,t,n){if(!e)return _t;let r=bt.get(e);return r?r.get(vt(t,n))??r.get(vt(t,null))??_t:_t}var St={yaw:0,pitch:0,mix:0,spin:0,wander:1},Ct=(e,t,n)=>({yaw:b(e.yaw,t.yaw,n),pitch:b(e.pitch,t.pitch,n),mix:b(e.mix,t.mix,n),spin:b(e.spin,t.spin,n),wander:b(e.wander,t.wander,n)}),wt=(e,t,n)=>({w:b(e.w,t.w,n),h:b(e.h,t.h,n),open:b(e.open,t.open,n),tilt:b(e.tilt??0,t.tilt??0,n)});function Tt(e,t,n){let r=1-n;return{sil:Ce(e.sil,t.sil,n),offX:b(e.offX,t.offX,n),offY:b(e.offY,t.offY,n),gaze:{yaw:b(e.gaze.yaw,t.gaze.yaw,n),pitch:b(e.gaze.pitch,t.gaze.pitch,n),roll:b(e.gaze.roll,t.gaze.roll,n)},split:b(e.split,t.split,n),eyes:[wt(e.eyes[0],t.eyes[0],n),wt(e.eyes[1],t.eyes[1],n)],eyeAlpha:b(e.eyeAlpha,t.eyeAlpha,n),bodyAlpha:b(e.bodyAlpha,t.bodyAlpha,n),dots:[...e.dots.map(e=>({...e,opacity:e.opacity*r})),...t.dots.map(e=>({...e,opacity:e.opacity*n}))],arcs:[...e.arcs.map(e=>({...e,id:`a${e.id}`,opacity:e.opacity*r})),...t.arcs.map(e=>({...e,id:`b${e.id}`,opacity:e.opacity*n}))],notif:n<.5?e.notif:t.notif,dotsBehind:n<.5?e.dotsBehind:t.dotsBehind}}var Et=class e{scale;cur;prev=null;departFige=null;tCur=0;tPrev=0;blinkAt=-10;pts=[];shape=null;shapePrev=null;shapeAt=-10;expr=null;exprPrev=null;exprAt=-10;look=St;lookPrev=St;lookAt=-10;lookMorph=.24;static SHAPE_MORPH=.45;static LOOK_MORPH=.24;constructor(e=100,t=`idle`,n=null,r=null){this.scale=e,this.cur=t,this.shape=n,this.expr=r}setExpression(e,t=0){e!==this.expr&&(this.exprPrev=this.expr,this.expr=e,this.exprAt=t)}exprAtTime(t){let n=this.expr,r=this.exprPrev;if(!n||!r)return n;let i=(t-this.exprAt)/e.SHAPE_MORPH;return i>=1?n:xe(r,n,x.easeOutQuint(y(i)))}setShape(e,t=0){e!==this.shape&&(this.shapePrev=this.shape,this.shape=e,this.shapeAt=t)}shapeAtTime(t){let n=this.shape,r=this.shapePrev;if(!n||!r)return n;let i=(t-this.shapeAt)/e.SHAPE_MORPH;if(i>=1)return n;let a=x.easeOutQuint(y(i));return n.map((e,t)=>b(r[t]??e,e,a))}setLook(t,n,r=e.LOOK_MORPH){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)}lookAtTime(e){let t=(e-this.lookAt)/this.lookMorph;return t>=1?this.look:Ct(this.lookPrev,this.look,x.easeOutQuint(y(t)))}posed(e,t,n,r){let i=e.pose(t);return e.baseBody&&n&&(i={...i,sil:{...i.sil,radii:n}}),e.baseFace&&r&&(i={...i,gaze:r.gaze,split:r.split,eyes:r.eyes}),i}decalageAtTime(t,n){let r=(e,n,r,i)=>{if(r===i)return i;let a=(t-e)/n;if(a>=1)return i;let o=x.easeOutQuint(y(a));return{x:b(r.x,i.x,o),y:b(r.y,i.y,o)}},i=t=>r(this.exprAt,e.SHAPE_MORPH,xt(t,n,this.exprPrev?.id??null),xt(t,n,this.expr?.id??null));return r(this.shapeAt,e.SHAPE_MORPH,i(this.shapePrev),i(this.shape))}get state(){return this.cur}reset(e,t){this.cur=e,this.prev=null,this.departFige=null,this.tCur=t,this.tPrev=t,this.blinkAt=-10}origine(e,t,n){if(this.departFige)return this.departFige;if(!this.prev)return null;let r=Z.get(this.prev);return this.posed(r,Math.max(0,e-this.tPrev),t,n)}poseComposee(e){let t=Z.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;if(a>=t.morph)return i;let o=this.origine(e,n,r);return o?Tt(o,i,x.easeOutQuint(y(a/t.morph))):i}setState(e,t){if(e===this.cur)return;let n=Z.get(this.cur).morph,r=this.prev!==null&&t-this.tCur<n;this.departFige=r?this.poseComposee(t):null,this.prev=this.cur,this.tPrev=this.tCur,this.cur=e,this.tCur=t,Z.get(e)?.blinkIn&&(this.blinkAt=t)}sample(e){let t=this.scale,n=Z.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;if(c){let t=x.easeOutQuint(y(s/n.morph));a=Tt(c,a,t);let r=this.prev;if(r){let n=this.decalageAtTime(e,r);o={x:b(n.x,o.x,t),y:b(n.y,o.y,t)}}}let l=a.eyeAlpha>.01,u=this.lookAtTime(e),d=ge(e,{wander:l?u.wander:0,blink:l}),f={yaw:b(a.gaze.yaw,u.yaw,u.mix)+d.dYaw-u.spin,pitch:b(a.gaze.pitch,u.pitch,u.mix)+d.dPitch,roll:a.gaze.roll+d.dRoll},p=y((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=Te(we({...a.sil,cx:a.sil.cx+g,cy:a.sil.cy+_,sy:a.sil.sy*d.breath},t,this.pts)),S=(e,t)=>Ee(a.sil.radii,Math.atan2(t,e)-a.sil.rot),C=[];if(a.eyeAlpha>.01){let e=I(f,t,a.split);for(let n=0;n<2;n++){let r=e[n];if(r.depth<=.02)continue;let i=a.eyes[n],s=S(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=z(Math.min(h,i.open));C.push({d:Me(i.w*t,i.h*t),matrix:`matrix(${w(d)},${w(f*v)},${w(p)},${w(m*v)},${w(r.x*s+(g+o.x)*t)},${w(r.y*s+(_+o.y)*t)})`,alpha:a.eyeAlpha*y(r.depth/.12)})}}let ee=a.dots.filter(e=>e.opacity>.01&&e.r>5e-4).map(e=>({...e,x:(e.x+g)*t,y:(e.y+_)*t,r:e.r*t})),T=a.notif?S(a.notif.x,a.notif.y):1,E=a.notif?(a.notif.x*T+g)*t:0,ne=a.notif?(a.notif.y*T+_)*t:0,re=a.notif?{x:E,y:ne,r:a.notif.r*t}:null,D=a.notif?{x:E,y:ne,r:a.notif.notch*t}:null;return{bodyPath:v,bodyAlpha:a.bodyAlpha,eyes:C,dots:ee,dotsBehind:a.dotsBehind,arcs:a.arcs.filter(e=>e.opacity>.01).map(e=>te(e.seed,e.t,t,e.id,e.opacity)),notif:re,notch:D}}},Dt=1.1,Ot=1.5,kt=e=>({yaw:0,pitch:0,mix:0,spin:360*(1-x.easeInOutCubic(y(e/Ot))),wander:1});function At({nx:e,ny:t,tour:n,pointer:r}){return{yaw:-26+e*16,pitch:10-t*13,mix:n,spin:360*(1-n),wander:+!r}}var jt=Math.max(...et.map(e=>e.morph)),Mt=10,Nt=200,Pt=50,Ft=.1,It=`defaut`;function Lt(e){return Math.max(jt,Z.get(e)?.minDuration??jt)}function Rt(e,t){let n=Math.round(t/Ft)*Ft,r=Math.min(10,Math.max(Lt(e),n));return Math.round(r*100)/100}function zt(e){return{state:e,duration:Rt(e,Z.get(e)?.duration??2)}}function Bt(){return{name:``,id:It,blocks:nt.map(zt)}}function Vt(e){return e.reduce((e,t)=>e+t.duration,0)}function Ht(e,t){let n=0;for(let r=0;r<t&&r<e.length;r++)n+=e[r].duration;return n}function Ut(e,t){let n=Vt(e);if(!e.length||n<=0)return{index:0,elapsed:0};let r=t>=0&&t<n?t:(t%n+n)%n,i=0;for(let t=0;t<e.length;t++){let n=i+e[t].duration;if(r<n)return{index:t,elapsed:r-i};i=n}return{index:e.length-1,elapsed:0}}function Wt(e,t){return e.length>=200?e:[...e,zt(t)]}function Gt(e,t,n){let r=e.slice(),[i]=r.splice(t,1);return i?(r.splice(Math.min(Math.max(n,0),r.length),0,i),r):e}function Kt(e,t){let n=new Set(t.map(e=>e.name));if(!n.has(e))return e;let r=2;for(;n.has(`${e} ${r}`);)r++;return`${e} ${r}`}function qt(e){let t=new Set(e.map(e=>e.id)),n=1;for(;t.has(`c${n}`);)n++;return`c${n}`}function Jt(e){if(typeof e!=`object`||!e)return null;let{state:t,duration:n}=e;return typeof t!=`string`||!nt.includes(t)||typeof n!=`number`||!Number.isFinite(n)?null:{state:t,duration:Rt(t,n)}}function Yt(e,t){if(typeof e!=`object`||!e)return null;let{id:n,name:r,blocks:i}=e;if(typeof n!=`string`||!n||typeof r!=`string`||!Array.isArray(i))return null;let a=i.slice(0,200).map(Jt).filter(e=>e!==null);return!a.length||t.some(e=>e.id===n)?null:{id:n,name:r,blocks:a}}function Xt(e){if(!e)return[];let t;try{t=JSON.parse(e)}catch{return[]}if(!Array.isArray(t))return[];let n=[];for(let e of t.slice(0,50)){let t=Yt(e,n);t&&n.push(t)}return n}var Zt=100,Qt=158,$t=[`<g`,`>`,`</g>`],en=`<svg... viewBox="." role="img". class="." style="."><defs><mask. maskUnits="userSpaceOnUse"....><path. fill="#fff"></path><!--$-->.<!--/--><!--$-->.<!--/--></mask><!--$-->.<!--/--></defs><g fill="none" stroke-linecap="round">.</g><!--$-->.<!--/--><g.><path..></path><g mask="."><rect.....></rect></g></g><!--$-->.<!--/--><!--$-->.<!--/--><g fill="none" stroke-linecap="round">.</g></svg>`.split(`.`),tn=[`<path`,``,``,``,` fill="#000"></path>`],nn=[`<circle`,``,``,``,` fill="#000"></circle>`],rn=[`<linearGradient`,` id="`,`" gradientUnits="userSpaceOnUse"`,``,``,``,`>`,`</linearGradient>`],an=[`<stop`,``,``,`></stop>`],on=[`<path`,``,` stroke="`,`"`,``,`></path>`],sn=[`<circle`,``,``,``,``,`></circle>`];function $(e,t,n){d(e,(e,n)=>{_(()=>t(e,n))},n?.defer?{defer:!0}:void 0)}function cn(v){var y,b,x,S;let C=n({size:320,shape:Be,color:Ue,expression:ye,paper:`#f9f9f9`,cycle:Bt().blocks,follow:!1,gaze:null,autoPause:!0,ariaLabel:`Animated Bloub avatar`},v),[w,ee]=p(0),[te,T]=p(`idle`),[E]=p(!1),[ne,re]=p(0),D=()=>v.block??w(),ie=()=>v.state??te(),O=()=>v.playing??E(),ae=()=>v.elapsed??ne();function oe(e){v.block===void 0&&ee(e),v.onBlockChange?.(e)}function se(e){v.state===void 0&&T(e),v.onStateChange?.(e)}function ce(e){v.elapsed===void 0&&re(e),v.onElapsedChange?.(e)}let le=f(()=>ze.get(C.shape)?.radii??null),de=f(()=>He.get(C.color)?.hex??`#0a0a0c`),fe=f(()=>ve.get(C.expression)??null),k=_(()=>new Et(100,ie(),le(),fe())),[A,j]=p(_(()=>k.sample(C.frozenAt??0)),{equals:!1}),M=m(),N=`bot-mask-${M}`,pe,P=0,F=-1/0,I=1/0,L=0,R=0,me=0,he=0,ge=-1;function z(e,t=0){let n=C.cycle[e];if(!n){I=1/0;return}me=R-t,ce(t),se(n.state),k.setState(n.state,R),I=O()?me+n.duration:1/0}function B(e){oe(e),z(e)}function V(e,t=0){if(D()===e){z(e,t);return}he=t,oe(e)}function _e(e){let t=C.cycle;if(!t.length)return;let{index:n}=Ut(t,e);if(n!==ge){let e=t[n];se(e.state),n<ge?k.reset(e.state,Ht(t,n)):k.setState(e.state,Ht(t,n)),ge=n}j(k.sample(e))}let be=!1,xe=0,Se=!1,H=1/60;function U(e){e.pointerType!==`touch`&&(e.clientX,e.clientY)}function W(){}function G(){be&&=(k.setLook(null,R,Dt),!1)}function K(){if(!Z.get(ie())?.baseFace){G();return}}function Ce(e){k.setLook(e(R-xe),R,H)}function we(){window.removeEventListener(`pointermove`,U),document.removeEventListener(`pointerleave`,W)}function Te(e){P=requestAnimationFrame(Te);let t=L?Math.min((e-L)/1e3,.064):0;L=e,R+=t;let n=C.fps&&C.fps>0?1/C.fps:0;R-F<n||(F=R,O()&&(R>=I&&C.cycle.length?B((D()+1)%C.cycle.length):ce(R-me)),C.follow?K():C.gaze&&Ce(C.gaze),j(k.sample(R)))}function q(){C.frozenAt!==void 0&&j(k.sample(C.frozenAt))}$(()=>C.gaze,e=>{e?(xe=R,Se=!0,k.setLook(e(0),R-H,H)):Se&&=(k.setLook(null,R),!1)}),$(D,e=>{z(e,he),he=0},{defer:!0}),$(ie,e=>{k.state!==e&&(k.setState(e,R),q())},{defer:!0}),$(O,e=>{e?z(D(),ae()):I=1/0},{defer:!0}),$(()=>C.cycle,e=>{if(!e.length){I=1/0;return}let t=Math.min(D(),e.length-1);t===D()?I=O()?me+e[t].duration:1/0:B(t)},{defer:!0}),$(le,e=>{k.setShape(e,R),q()},{defer:!0}),$(fe,e=>{k.setExpression(e,R),q()},{defer:!0}),$(()=>C.frozenAt,q,{defer:!0}),d(()=>C.follow&&C.frozenAt===void 0,e=>{e?(window.addEventListener(`pointermove`,U),document.addEventListener(`pointerleave`,W)):(we(),G())});function J(){P||typeof requestAnimationFrame>`u`||(L=0,P=requestAnimationFrame(Te))}function Ee(){P&&=(typeof cancelAnimationFrame<`u`&&cancelAnimationFrame(P),0)}let[De,Oe]=p(!0),[ke,Ae]=p(!0),[je,Me]=p(!1);d(()=>je()&&C.frozenAt===void 0&&(!C.autoPause||De()&&ke()),e=>{e?J():Ee()}),g(()=>{if(v.ref?.({get svg(){},seek:V,renderAt:_e}),C.frozenAt!==void 0)return;z(D(),ae());let e=()=>Ae(document.visibilityState!==`hidden`);document.addEventListener(`visibilitychange`,e),e();let t=typeof IntersectionObserver>`u`?null:new IntersectionObserver(e=>{let t=e[e.length-1];t&&Oe(t.isIntersecting)});return t?.observe(pe),Me(!0),()=>{document.removeEventListener(`visibilitychange`,e),t?.disconnect()}}),h(()=>{Ee(),typeof window<`u`&&we()});function Ne(e){let t={fill:e.color??(e.depth===void 0?de():We(C.paper,de(),e.depth)),opacity:e.opacity};return e.d?{...t,d:e.d,transform:`translate(${e.x} ${e.y}) rotate(${e.rot??0}) scale(100)`}:{...t,cx:e.x,cy:e.y,r:e.r}}let Pe=()=>l({get each(){return A().dots},keyed:!1,children:t=>e(n({get component(){return t().d?`path`:`circle`}},()=>Ne(t())))});var Fe=s(),Ie=o(()=>[i(`width`,t(C.size,!0)),i(`height`,t(C.size,!0))],2),Le=o(()=>[i(`aria-label`,t(C.ariaLabel,!0)),a(C.class),c(C.style)],3),Re=()=>i(`d`,t(A().bodyPath,!0)),Ve=t(l({get each(){return A().eyes},keyed:!1,children:e=>{var n,a;return n=s(),a=o(()=>[i(`d`,t(e().d,!0)),i(`transform`,t(e().matrix,!0)),i(`opacity`,t(e().alpha,!0))],3),r(tn,n,a,a,a)}})),Y=t(u({get when(){return A().notch},children:e=>{var n,a;return n=s(),a=o(()=>[i(`cx`,t(e().x,!0)),i(`cy`,t(e().y,!0)),i(`r`,t(e().r,!0))],3),r(nn,n,a,a,a)}})),X=t(l({get each(){return A().arcs},keyed:!1,children:e=>{var n,a,c;return n=s(),a=o(()=>[`${t(M,!0)}-${t(e().id,!0)}`,i(`x1`,t(e().grad.x1,!0)),i(`y1`,t(e().grad.y1,!0)),i(`x2`,t(e().grad.x2,!0)),i(`y2`,t(e().grad.y2,!0))],5),c=t(l({get each(){return e().grad.stops},keyed:!1,children:(n,a)=>{var c,l;return c=s(),l=o(()=>[i(`offset`,t(a,!0)/(t(e().grad.stops.length,!0)-1)),i(`stop-color`,t(n(),!0))],2),r(an,c,l,l)}})),r(rn,n,a,a,a,a,a,c)}})),Ge=t(l({get each(){return A().arcs},keyed:!1,children:e=>{var n,a;return n=s(),a=o(()=>[i(`d`,t(e().back,!0)),`url(#${t(M,!0)}-${t(e().id,!0)})`,i(`stroke-width`,t(e().width,!0)),i(`opacity`,t(e().opacity,!0))],4),r(on,n,a,a,a,a)}})),Ke=t(u({get when(){return A().dotsBehind},get children(){return y=s(),b=t(Pe({})),r($t,y,b)}})),qe=o(()=>[i(`opacity`,t(A().bodyAlpha,!0)),i(`d`,t(A().bodyPath,!0)),i(`fill`,t(C.paper,!0))],3),Je=()=>i(`fill`,t(de(),!0)),Ye=t(u({get when(){return!A().dotsBehind},get children(){return x=s(),S=t(Pe({})),r($t,x,S)}})),Xe=t(u({get when(){return A().notif},children:e=>{var n,a;return n=s(),a=o(()=>[i(`cx`,t(e().x,!0)),i(`cy`,t(e().y,!0)),i(`r`,t(e().r,!0))],3),r(sn,n,a,a,a,i(`fill`,t(ue,!0)))}})),Ze=t(l({get each(){return A().arcs},keyed:!1,children:e=>{var n,a;return n=s(),a=o(()=>[i(`d`,t(e().front,!0)),`url(#${t(M,!0)}-${t(e().id,!0)})`,i(`stroke-width`,t(e().width,!0)),i(`opacity`,t(e().opacity,!0))],4),r(on,n,a,a,a,a)}}));return r(en,Fe,Ie,Ie,`-158 -158 ${t(158,!0)*2} ${t(158,!0)*2}`,Le,Le,Le,i(`id`,t(N,!0)),i(`x`,-158),i(`y`,-158),i(`width`,t(158,!0)*2),i(`height`,t(158,!0)*2),Re,Ve,Y,X,Ge,Ke,qe,qe,qe,`url(#${t(N,!0)})`,i(`x`,-158),i(`y`,-158),i(`width`,t(158,!0)*2),i(`height`,t(158,!0)*2),Je,Ye,Xe,Ze)}export{cn as BloubBot,Et as BotEngine,Ve as COLORS,He as COLOR_BY_ID,Ue as DEFAULT_COLOR,ye as DEFAULT_EXPRESSION,Be as DEFAULT_SHAPE,Qt as DEMI_VIEWBOX,_e as EXPRESSIONS,ve 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,Z as STATE_BY_ID,Ft as STEP,Ot as TOUR_TIME,Dt as TURN_TIME,xe 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};
1
+ import{Dynamic as e,escape as t,mergeProps as n,ssr as r,ssrAttribute as i,ssrClassName as a,ssrGroup as o,ssrHydrationKey as s,ssrStyle as c}from"@solidjs/web";import{For as l,Show as u,createEffect as d,createMemo as f,createSignal as p,createUniqueId as m,onCleanup as h,onSettled as g,untrack as _}from"solid-js";var v=Math.PI*2,y=(e,t=0,n=1)=>e<t?t:e>n?n:e,b=(e,t,n)=>e+(t-e)*n,x={easeOutCubic:e=>1-(1-e)**3,easeInOutCubic:e=>e<.5?4*e**3:1-(-2*e+2)**3/2,easeOutQuint:e=>1-(1-e)**5};function S(e,t,n=0){let r=e/t*v;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)}function C(e){let t=e>>>0;return()=>{t=t+1831565813>>>0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}var w=e=>Math.round(e*100)/100;function ee(e,t=.55,n=.62){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?[i,a,0]:r<120?[a,i,0]:r<180?[0,i,a]:r<240?[0,a,i]:r<300?[a,0,i]:[i,0,a],u=e=>Math.round((e+o)*255).toString(16).padStart(2,`0`);return`#${u(s)}${u(c)}${u(l)}`}function te(e,t,n,r,i=1){let a=e.phase+t*e.speed*v,o=Math.cos(e.tilt),s=Math.sin(e.tilt),c=Math.sqrt(Math.max(0,1-e.k*e.k)),l=e.sweep*v,u=``,d=``,f=null;for(let t=0;t<=64;t++){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,_=w(m*n),v=w(h*n),y=g===f?`L`:`M`;g?d+=`${y}${_} ${v}`:u+=`${y}${_} ${v}`,f=g}let p=Math.cos(e.tilt)*e.a*n,m=Math.sin(e.tilt)*e.a*n;return{id:r,front:u,back:d,width:e.width*n,opacity:i,grad:{x1:w(e.cx*n-p),y1:w(e.cy*n-m),x2:w(e.cx*n+p),y2:w(e.cy*n+m),stops:[ee(e.hue),ee(e.hue+e.hueSpan*.5),ee(e.hue+e.hueSpan)]}}}var T=C(659918),E=Array.from({length:6},(e,t)=>({a:1.3+T()*.1,k:.05+T()*.4,tilt:t/6*Math.PI+T()*.5,speed:3+T()*.7,phase:T()*v,sweep:.6+T()*.25,hue:t*360/6+T()*30,hueSpan:60+T()*60,width:.05+T()*.012,cx:0,cy:.1})),ne=Array.from({length:4},(e,t)=>({a:.78+t*.2,k:.05+t*.02,tilt:-.62+t*.05,speed:.3,phase:.06*t,sweep:.4,hue:95+t*62,hueSpan:100,width:.05,cx:0,cy:-.12})),re=[-.557,-.013,.532],ie=.165,D=1.25,O=C(48879),k=Array.from({length:5},(e,t)=>({birth:t*.2,angle:O()*v,rho:.58+O()*.18}));function ae(e,t){let n=[];for(let r of k){let i=e-r.birth;if(i<0||i>.62)continue;let a=r.rho*.75**(i*10),o=r.angle+i*100*Math.PI/180;n.push({x:Math.cos(o)*a*t,y:Math.sin(o)*a*t,r:(.04+.028*y(i/.55))*t,depth:y(1-a/.8),opacity:y(i/.06)*y((.62-i)/.08)})}return n}var oe=C(49383),se=Array.from({length:4},(e,t)=>{let n=t-1.5;return{a:.85*(1+n*.03),k:.15/.85*(1+n*.16),tilt:34*Math.PI/180+n*.035,speed:210/360,phase:-t*.045+oe()*.012,sweep:.34,hue:t*85+oe()*20,hueSpan:80,width:.095,cx:0,cy:0}}),ce=.129,le=`#2496e8`,ue=1.003,de=.15,fe=1.14,A=.054,j=15.46,M=.186,N=.412,P={yaw:28.49,pitch:28.62,roll:-13},F=e=>e*Math.PI/180;function I(e,t,n){let r=Math.cos(n),i=Math.sin(n);return[[e[0]*r+t[0]*i,e[1]*r+t[1]*i,e[2]*r+t[2]*i],[t[0]*r-e[0]*i,t[1]*r-e[1]*i,t[2]*r-e[2]*i]]}function pe(e,t,n=j){let r=[0,0,1],i=[1,0,0],a=[0,1,0];[r,i]=I(r,i,F(e.yaw)),[a,r]=I(a,r,F(e.pitch)),[i,a]=I(i,a,F(e.roll));let o=e=>{let[o,s]=I(r,i,F(n*e));return{x:o[0]*t,y:o[1]*t,a:s[0],b:s[1],c:a[0],d:a[1],depth:o[2]}};return[o(-1),o(1)]}var L=C(24301),R=(()=>{let e=[],t=1.4;for(;t<900;)e.push(t),t+=1.9+L()*2.7,L()<.18&&(e.push(t),t+=.24);return e})(),z=.18;function me(e){for(let t=0;t<R.length;t++){let n=R[t];if(e<n)break;let r=(e-n)/z;if(r>=0&&r<=1)return r<.45?1-r/.45:(r-.45)/.55}return 1}function he(e,t={}){let{wander:n=1,blink:r=!0,float:i=!0}=t;return{dYaw:(S(e,11.3,.4)*5.5+S(e,3.7,2.1)*1.6)*n,dPitch:(S(e,9.1,1.3)*4.2+S(e,4.3,.7)*1.3)*n,dRoll:S(e,13.7,3.2)*2.2*n,lid:r?me(e):1,driftX:i?S(e,7.9,1.9)*.006:0,driftY:i?S(e,5.3,.3)*.007:0,breath:i?1+Math.sin(e/3.4*Math.PI*2)*.005:1}}function ge(e){return .06+.94*y(e)}var B=(e,t,n=0,r=1)=>({w:e,h:t,tilt:n,open:r}),V=(e,t,n=0,r=1)=>[B(e,t,n,r),B(e,t,-n,r)],_e=[{id:`neutre`,gaze:{...P},split:j,eyes:[B(M,N),B(M,N)]},{id:`attentif`,gaze:{yaw:4,pitch:5,roll:-4},split:16,eyes:V(.21,.44)},{id:`surpris`,gaze:{yaw:3,pitch:-3,roll:0},split:19,eyes:V(.45,.47)},{id:`excite`,gaze:{yaw:6,pitch:-14,roll:0},split:19.5,eyes:V(.4,.56,-10)},{id:`heureux`,gaze:{yaw:5,pitch:9,roll:0},split:17,eyes:V(.27,.17,14)},{id:`hilare`,gaze:{yaw:4,pitch:14,roll:0},split:18,eyes:V(.34,.13,20)},{id:`colere`,gaze:{yaw:3,pitch:7,roll:0},split:17,eyes:V(.34,.15,30)},{id:`triste`,gaze:{yaw:3,pitch:-13,roll:0},split:16,eyes:V(.22,.4,-28)},{id:`effraye`,gaze:{yaw:2,pitch:-20,roll:0},split:20.5,eyes:V(.4,.6)},{id:`mefiant`,gaze:{yaw:12,pitch:6,roll:-6},split:16,eyes:[B(.21,.4),B(.22,.15)]},{id:`confus`,gaze:{yaw:-14,pitch:3,roll:8},split:16.5,eyes:[B(.2,.44,-18),B(.28,.17,14)]},{id:`curieux`,gaze:{yaw:16,pitch:-9,roll:-15},split:16.5,eyes:[B(.24,.46,-8),B(.2,.38,-8)]},{id:`fier`,gaze:{yaw:5,pitch:17,roll:0},split:17,eyes:V(.3,.15,18)},{id:`timide`,gaze:{yaw:-19,pitch:-14,roll:-7},split:14,eyes:V(.17,.3)},{id:`blase`,gaze:{yaw:-22,pitch:2,roll:0},split:16,eyes:V(.3,.12)},{id:`somnolent`,gaze:{yaw:6,pitch:-9,roll:-3},split:16,eyes:V(.2,.42,0,.42)}],ve=new Map(_e.map(e=>[e.id,e])),ye=`neutre`,be=(e,t,n)=>({w:b(e.w,t.w,n),h:b(e.h,t.h,n),tilt:b(e.tilt??0,t.tilt??0,n),open:b(e.open,t.open,n)});function xe(e,t,n){return{id:t.id,gaze:{yaw:b(e.gaze.yaw,t.gaze.yaw,n),pitch:b(e.gaze.pitch,t.gaze.pitch,n),roll:b(e.gaze.roll,t.gaze.roll,n)},split:b(e.split,t.split,n),eyes:[be(e.eyes[0],t.eyes[0],n),be(e.eyes[1],t.eyes[1],n)]}}var Se={egg:[.8369,.8424,.8497,.8585,.8674,.8775,.8878,.8983,.9089,.9185,.9288,.9374,.9445,.9504,.9543,.9559,.9555,.9519,.9466,.9389,.9302,.9193,.9085,.8969,.8852,.8734,.8625,.8513,.8411,.8325,.8243,.8179,.8137,.8112,.8102,.8128,.8178,.8262,.8374,.8518,.8702,.8922,.9169,.9446,.9741,1.0023,1.0267,1.0433,1.0481,1.0393,1.0216,.997,.9697,.9418,.9169,.8949,.876,.8604,.849,.8394,.8337,.8314,.8305,.8326],hexagon:[.921,.9282,.9441,.9706,.9984,1.0059,.9896,.9562,.929,.9124,.9047,.9058,.9157,.9349,.9642,.9873,.9882,.9665,.9336,.9105,.8968,.8918,.8955,.908,.9293,.9611,.982,.9812,.959,.9282,.9089,.8978,.8964,.9026,.9189,.9439,.9778,.999,.9964,.9713,.9439,.9274,.9196,.9206,.9308,.9502,.9799,1.0121,1.0226,1.0071,.9752,.951,.9366,.9316,.9351,.9485,.9711,1.0026,1.0213,1.0155,.9863,.9547,.9347,.9232],triangle:[.7819,.8211,.8747,.944,1.0223,1.096,1.1401,1.134,1.0808,1.0047,.9265,.8603,.8104,.773,.745,.7273,.7151,.7118,.7148,.7245,.7427,.768,.8037,.8518,.9148,.9876,1.0583,1.1073,1.1109,1.0667,.994,.9164,.8482,.7948,.7555,.7261,.7056,.6925,.6859,.6869,.6938,.7084,.7305,.7615,.804,.8595,.9311,1.0092,1.0791,1.1171,1.1054,1.0501,.9779,.905,.845,.799,.7656,.7413,.7258,.716,.7146,.7204,.733,.7528]},H=Array.from({length:64},(e,t)=>t/64*v),U=H.map(Math.cos),W=H.map(Math.sin);function Ce(e,t={}){return{radii:[...Se[e]],rot:0,cx:0,cy:0,sx:1,sy:1,...t}}function G(e,t={}){return{radii:Array(64).fill(e),rot:0,cx:0,cy:0,sx:1,sy:1,...t}}function we(e,t,n,r){let i=r??{radii:Array(64),rot:0,cx:0,cy:0,sx:1,sy:1};for(let r=0;r<64;r++)i.radii[r]=b(e.radii[r]??1,t.radii[r]??1,n);let a=t.rot-e.rot;for(;a>Math.PI;)a-=v;for(;a<-Math.PI;)a+=v;return i.rot=e.rot+a*n,i.cx=b(e.cx,t.cx,n),i.cy=b(e.cy,t.cy,n),i.sx=b(e.sx,t.sx,n),i.sy=b(e.sy,t.sy,n),i}function Te(e,t,n=[]){let r=Math.cos(e.rot),i=Math.sin(e.rot);for(let a=0;a<64;a++){let o=e.radii[a]??1,s=o*(U[a]??0),c=o*(W[a]??0),l=s*r-c*i,u=s*i+c*r,d=n[a]??{x:0,y:0};d.x=(l*e.sx+e.cx)*t,d.y=(u*e.sy+e.cy)*t,n[a]=d}return n.length=64,n}function Ee(e,t=1/6){let n=e.length;if(n<3)return``;let r=e[0],i=`M${w(r.x)} ${w(r.y)}`;for(let r=0;r<n;r++){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;i+=`C${w(l)} ${w(u)} ${w(d)} ${w(f)} ${w(s.x)} ${w(s.y)}`}return`${i}Z`}function K(e,t,n){let r=Array(64).fill(0),i=e.length;for(let a=0;a<64;a++){let o=U[a]??0,s=W[a]??0,c=0;for(let r=0;r<i;r++){let a=e[r],l=e[(r+1)%i],u=l.x-a.x,d=l.y-a.y,f=o*d-s*u;if(Math.abs(f)<1e-9)continue;let p=a.x-t,m=a.y-n,h=(p*d-m*u)/f,g=(p*s-m*o)/f;h>c&&g>=0&&g<=1&&(c=h)}r[a]=c}return r}function q(e,t,n,r,i,a,o=96){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=[];for(let r=0;r<=o/2;r++){let i=u+d+(v-2*d)*r/(o/2);f.push({x:e+Math.cos(i)*n,y:t+Math.sin(i)*n})}for(let e=0;e<=o/2;e++){let t=u-d+2*d*e/(o/2);f.push({x:r+Math.cos(t)*a,y:i+Math.sin(t)*a})}return f}function De(e,t){let n=e.length,r=(t/v%1+1)%1*n,i=Math.floor(r);return b(e[i%n]??1,e[(i+1)%n]??1,r-i)}function Oe(e,t=1,n=1){return H.map((r,i)=>(Math.abs((U[i]??0)/t)**e+Math.abs((W[i]??0)/n)**e)**(-1/e))}function ke(e){let t=Array(64).fill(0);for(let n=0;n<64;n++){let r=U[n]??0,i=W[n]??0,a=0;for(let t of e){let e=r*t.x+i*t.y,n=e*e-(t.x*t.x+t.y*t.y-t.r*t.r);if(n<0)continue;let o=e+Math.sqrt(n);o>a&&(a=o)}t[n]=a}return t}function Ae(e,t,n=10){let r=e.length,i=[],a=(e,t)=>{let n=t.x-e.x,r=t.y-e.y,i=Math.hypot(n,r)||1;return Math.atan2(-n/i,r/i)};for(let o=0;o<r;o++){let s=e[(o-1+r)%r],c=e[o],l=e[(o+1)%r],u=a(s,c),d=a(c,l)-u;for(;d>Math.PI;)d-=v;for(;d<-Math.PI;)d+=v;for(let e=0;e<=n;e++){let r=u+d*e/n;i.push({x:c.x+Math.cos(r)*t,y:c.y+Math.sin(r)*t})}}return i}function je(e,t,n,r=0){let i=r*Math.PI/180;return K(Ae(Array.from({length:e},(r,a)=>{let o=i+a/e*v;return{x:Math.cos(o)*(t-n),y:Math.sin(o)*(t-n)}}),n),0,0)}function Me(e,t=1){if(e.length<3)return``;let n=``;for(let r=0;r<e.length;r++){let i=e[r];n+=`${r===0?`M`:`L`}${w(i.x*t)} ${w(i.y*t)}`}return`${n}Z`}function Ne(e,t){let n=Math.max(e,.01)/2,r=Math.max(t,.01)/2,i=Math.min(n,r);return`M${w(-n)} ${w(-r+i)}A${w(i)} ${w(i)} 0 0 1 ${w(-n+i)} ${w(-r)}L${w(n-i)} ${w(-r)}A${w(i)} ${w(i)} 0 0 1 ${w(n)} ${w(-r+i)}L${w(n)} ${w(r-i)}A${w(i)} ${w(i)} 0 0 1 ${w(n-i)} ${w(r)}L${w(-n+i)} ${w(r)}A${w(i)} ${w(i)} 0 0 1 ${w(-n)} ${w(r-i)}Z`}function Pe(e,t=1){let n=Math.max(...e);if(n<=0)return e;let r=t/n;return e.map(e=>e*r)}var Fe=Pe(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),Ie=Pe(ke([{x:-.44,y:.2,r:.54},{x:.46,y:.2,r:.5},{x:.02,y:.3,r:.6},{x:-.24,y:-.3,r:.48},{x:.3,y:-.24,r:.44}]),1.02),Le=Pe(K(q(0,.28,.66,0,-.96,.05),0,0),1.04),Re=K(q(-.42,0,.62,.42,0,.62),0,0),J=[{id:`cercle`,radii:Array(64).fill(1)},{id:`galet`,radii:Fe},{id:`squircle`,radii:Pe(Oe(4.2),1.15)},{id:`capsule`,radii:Re},{id:`triangle`,radii:je(3,1.12,.34,-90)},{id:`hexagone`,radii:je(6,1.04,.26,0)},{id:`nuage`,radii:Ie},{id:`goutte`,radii:Le}],ze=new Map(J.map(e=>[e.id,e])),Be=`cercle`,Ve=[{id:`encre`,hex:`#0a0a0c`},{id:`brun`,hex:`#8b5e3c`},{id:`rouge`,hex:`#e8483f`},{id:`orange`,hex:`#f08a24`},{id:`ambre`,hex:`#f0b429`},{id:`vert`,hex:`#3ecf8e`},{id:`turquoise`,hex:`#2fbfa0`},{id:`bleu`,hex:`#3b93f0`},{id:`violet`,hex:`#8b5cf6`},{id:`rose`,hex:`#e152b0`},{id:`gris`,hex:`#a3a3a3`},{id:`creme`,hex:`#f1efe9`}],He=new Map(Ve.map(e=>[e.id,e])),Ue=`encre`;function We(e,t,n){let r=e=>{let t=parseInt(e.slice(1),16);return[t>>16&255,t>>8&255,t&255]},i=r(e),a=r(t);return`#${i.map((e,t)=>Math.round(e+(a[t]-e)*n)).map(e=>e.toString(16).padStart(2,`0`)).join(``)}`}var Y=(e,t)=>[{w:e,h:t,open:1},{w:e,h:t,open:1}];function X(e={}){return{sil:G(1),offX:0,offY:0,gaze:{...P},split:j,eyes:Y(M,N),eyeAlpha:1,bodyAlpha:1,dots:[],arcs:[],notif:null,dotsBehind:!1,...e}}var Ge=-.1875,Ke=K(q(0,-.505,.132,0,.13,.075),0,Ge),qe=K(q(0,-.2535,.1345,0,.2535,.1345),0,0),Je=(e={})=>({radii:[...Ke],rot:0,cx:0,cy:Ge,sx:1,sy:1,...e}),Ye=(e={})=>({radii:[...qe],rot:0,cx:0,cy:0,sx:1,sy:1,...e}),Xe=Me(q(0,0,.118,0,.172,.012)),Ze=.213;function Qe(e){return Ce(`triangle`,{rot:e,cx:-.213*Math.sin(e),cy:Ze*Math.cos(e)})}function $e(e,t){let n=((e-t*.5)/1.5%1+1)%1;return y((n<.5?.5-.5*Math.cos(n*v):0)*2)}var et=[{id:`idle`,duration:2.4,morph:.45,blinkIn:!1,baseFace:!0,baseBody:!0,pose:()=>X()},{id:`thinking`,duration:2.6,morph:.4,baseFace:!1,baseBody:!1,blinkIn:!0,pose:e=>{let t=$e(e,1),n=.3+.7*x.easeOutCubic(y(e/.3));return X({sil:G(ie*(1+(D-1)*t),{cx:re[1]}),eyeAlpha:0,dots:[0,2].map(t=>{let r=$e(e,t);return{x:re[t]*n,y:0,r:ie*(1+(D-1)*r),opacity:.55+.45*r}})})}},{id:`wink`,duration:1.6,morph:.3,blinkIn:!0,baseFace:!1,baseBody:!0,pose:()=>X({gaze:{yaw:-5.37,pitch:4.55,roll:6.7},split:16.25,eyes:[{w:.236,h:.464,open:1},{w:.447,h:.089,open:1}]})},{id:`wide`,duration:1.8,morph:.55,blinkIn:!0,baseFace:!1,baseBody:!0,pose:()=>X({gaze:{yaw:6.92,pitch:-21.96,roll:11.6},split:18.43,eyes:Y(.356,.875)})},{id:`alert`,duration:2.4,minDuration:2,morph:.45,baseFace:!1,baseBody:!1,blinkIn:!1,pose:e=>{let t=y(e/1.5),n=x.easeInOutCubic(t)*.82-.087,r=e>1.6?y((e-1.6)/.4):0,i=n*(1-r)+.1*r,a=Math.sin(e*2.5*v)*.005,o=17.7*Math.PI/180;return X({sil:Ye({rot:o,cx:i,cy:-.325-a}),eyeAlpha:0,dots:[{x:i-Math.sin(o)*.58,y:-.325+Math.cos(o)*.58+a*2.8,r:.118,d:Xe,rot:o*180/Math.PI,opacity:1}]})}},{id:`notify`,duration:2.2,morph:.5,blinkIn:!0,baseFace:!1,baseBody:!0,pose:e=>{let t=y(e/.45),n=1+(fe-1)*Math.sin(t*Math.PI)*(1-t*.35),r=de*(t<1?n:1),i=-42*Math.PI/180;return X({gaze:{yaw:-21.94,pitch:-5.82,roll:-12.2},split:18.89,eyes:Y(.505,.498),notif:{x:Math.cos(i)*ue,y:Math.sin(i)*ue,r,notch:r+A}})}},{id:`exclaim`,duration:2,morph:.45,baseFace:!1,baseBody:!1,blinkIn:!1,pose:()=>X({sil:Je(),eyeAlpha:0,dots:[{x:-.012,y:.526,r:.113,opacity:1}]})},{id:`sleep`,duration:2.4,morph:.5,baseFace:!1,baseBody:!1,blinkIn:!1,pose:e=>X({sil:G(.1585,{cy:.11+Math.sin(v/.6*e)*.19}),eyeAlpha:0})},{id:`egg`,duration:1.8,morph:.4,baseFace:!1,baseBody:!1,blinkIn:!0,pose:()=>X({sil:Ce(`egg`),gaze:{yaw:19.97,pitch:26.01,roll:-17.1},split:11.07,eyes:Y(.164,.385)})},{id:`hexagon`,duration:1.6,morph:.4,baseFace:!1,baseBody:!1,blinkIn:!0,pose:()=>X({sil:Ce(`hexagon`),gaze:{yaw:23.11,pitch:24.42,roll:-13.3},split:13.37,eyes:Y(.177,.411)})},{id:`play`,duration:2,morph:.5,baseFace:!1,baseBody:!1,blinkIn:!0,pose:e=>{let t=y(e/.35)*y((2.2-e)/.5);return X({sil:Qe(0),gaze:{yaw:12,pitch:-8,roll:-6},split:15,eyes:Y(.18,.34),arcs:ne.map((n,r)=>({id:`sw${r}`,seed:{...n,cx:.45-e*.42},t:e,opacity:t}))})}},{id:`orbit`,duration:3.4,minDuration:2.5,morph:.6,baseFace:!1,baseBody:!1,blinkIn:!1,pose:e=>{let t=x.easeInOutCubic(y(e/.35)),n=-v*1.25*e*t,r=x.easeInOutCubic(y((e-1.6)/.9)),i=Qe(n),a=G(1,{rot:n}),o={radii:i.radii.map((e,t)=>e+(a.radii[t]-e)*r),rot:n,cx:i.cx*(1-r),cy:i.cy*(1-r),sx:1,sy:1},s=y(e/.8)*y((3.6-e)/.9);return X({sil:o,gaze:{yaw:P.yaw+Math.sin(e*6.5)*65*(1-r),pitch:-4+r*32,roll:-13},eyes:Y(.18,.34+r*.07),arcs:E.map((t,n)=>({id:`rg${n}`,seed:t,t:e,opacity:s*y((e-n*.13)/.3)}))})}},{id:`swirl`,duration:1.3,minDuration:1.3,morph:.3,baseFace:!0,baseBody:!0,blinkIn:!0,pose:e=>X({arcs:E.slice(0,3).map((t,n)=>({id:`sw${n}`,seed:t,t:e,opacity:y((e-n*.06)/.14)*y((1.22-e)/.34)}))})},{id:`burst`,duration:2.6,minDuration:2.4,morph:.4,baseFace:!1,baseBody:!1,blinkIn:!1,pose:e=>{let t=1-.834*x.easeOutQuint(y(e/.7)),n=x.easeOutQuint(y((e-1.7)/.7));return X({sil:G(t+(1-t)*n),eyeAlpha:y((e-1.85)/.4),dots:ae(e,1),dotsBehind:!0})}},{id:`comet`,duration:2.4,minDuration:2.4,morph:.45,baseFace:!1,baseBody:!1,blinkIn:!1,pose:e=>{let t=1-(1-ce)*x.easeOutQuint(y(e/.55)),n=x.easeOutQuint(y((e-1.85)/.6)),r=y((e-.15)/.25)*y((1.95-e)/.3);return X({sil:G(t+(1-t)*n,{cy:Math.sin(y(e/1.7)*Math.PI)*.035}),eyeAlpha:y((e-2)/.35),arcs:se.map((t,n)=>({id:`cm${n}`,seed:t,t:e,opacity:r}))})}}],Z=new Map(et.map(e=>[e.id,e])),tt={idle:1,thinking:1.1,wink:.8,wide:.8,alert:.75,notify:.9,exclaim:.8,sleep:.45,egg:.8,hexagon:.8,play:.9,orbit:1.2,swirl:.5,burst:.45,comet:1.15},nt=[`idle`,`thinking`,`wink`,`wide`,`alert`,`notify`,`exclaim`,`sleep`,`egg`,`hexagon`,`play`,`orbit`,`burst`,`comet`],Q=100,rt=7.1,it=5.5,at=.006,ot=.007;function st(e,t,n){let r=[],i=pe(e.gaze,Q,e.split);for(let a=0;a<2;a++){let o=i[a];if(o.depth<=.02)continue;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*Q,.01)/2,g=Math.max(s.h*Q,.01)/2,_=Math.min(h,g),v=g>h,y=v?g-_:h-_,b=De(n,Math.atan2(o.y,o.x)-t.rot);r.push({x:o.x*b,y:o.y*b,ax:(v?p:d)*y,ay:(v?m:f)*y,r:_,m:[d,f,p,m]})}return r}function ct(e,t,n,r,i){let a=r-t,o=i-n,s=a*a+o*o,c=1/0,l=0,u=0;for(let r=0;r<e.length;r++){let i=e[r],d=s>0?((i.x-t)*a+(i.y-n)*o)/s:0;d=d<0?0:d>1?1:d;let f=t+d*a-i.x,p=n+d*o-i.y,m=f*f+p*p;m<c&&(c=m,l=f,u=p)}let d=Math.sqrt(c);return{d,ux:d>1e-9?l/d:0,uy:d>1e-9?u/d:0}}var lt=Math.hypot(at,ot)*Q;function ut(e,t,n,r){let i=1/0,a=0,o=0;for(let s of t){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;l.d-m<i&&(i=l.d-m,a=l.ux,o=l.uy)}return{marge:i,ux:a,uy:o}}var dt=12,ft=8;function pt(e){if(!e.length)return{x:0,y:0};let t=(t,n)=>{let r=1/0;for(let i of e)r=Math.min(r,ut(i.contour,i.empreintes,t,n).marge);return r},n=1/0;for(let t of e)n=Math.min(n,ut(t.calContour,t.reference,0,0).marge);let r=0,i=0,a=e[0].empreintes;for(let e of a)r-=e.x/a.length,i-=e.y/a.length;let o=Math.max(.35*Q,Math.hypot(r,i)*1.25);n=Math.min(n,t(r,i));let s=t(0,0);if(s>=n&&s>=0)return{x:0,y:0};let c=Math.max(n,0),l=0,u=0,d=1/0,f=0,p=0,m=s;for(let e=0;e<dt;e++){let n=e/dt*Math.PI*2,r=Math.cos(n),i=Math.sin(n);if(t(r*o,i*o)<c){for(let e of[.3,.6,1]){let n=t(r*o*e,i*o*e);n>m&&(m=n,f=r*o*e,p=i*o*e)}continue}let a=0,s=o;for(let e=0;e<ft;e++){let e=(a+s)/2;t(r*e,i*e)>=c?s=e:a=e}s<d&&(d=s,l=r*s,u=i*s)}let h=d===1/0?f:l,g=d===1/0?p:u;return{x:+(h/Q).toFixed(6),y:+(g/Q).toFixed(6)}}function mt(e,t,n){return e.baseFace&&n?{gaze:n.gaze,split:n.split,eyes:n.eyes}:{gaze:t.gaze,split:t.split,eyes:t.eyes}}function ht(e){let t=e=>JSON.stringify([e.gaze,e.split,e.eyes,e.sil.rot,e.sil.cx,e.sil.cy,e.sil.sx,e.sil.sy]);return t(e.pose(0))===t(e.pose(e.duration))?[0]:Array.from({length:3},(t,n)=>n/2*e.duration)}function gt(e,t,n){let r=[];for(let i of ht(e)){let a=e.pose(i),o=Te({...a.sil,radii:t},Q),s=Te(a.sil,Q),c=mt(e,a,n),l=[];for(let e of[-7.1,rt])for(let t of[-5.5,it])l.push({...c,gaze:{yaw:c.gaze.yaw+e,pitch:c.gaze.pitch+t,roll:c.gaze.roll}});for(let e of l)r.push({empreintes:st(e,a.sil,t),reference:st(e,a.sil,a.sil.radii),contour:o,calContour:s})}return pt(r)}var _t={x:0,y:0},vt=(e,t)=>`${e}|${t??``}`;function yt(){return new Map(J.map(e=>{let t=new Map;for(let n of et){if(!n.baseBody)continue;let r=n.baseFace?[null,..._e]:[null];for(let i of r)t.set(vt(n.id,i?.id??null),gt(n,e.radii,i))}return[e.radii,t]}))}var bt=yt();function xt(e,t,n){if(!e)return _t;let r=bt.get(e);return r?r.get(vt(t,n))??r.get(vt(t,null))??_t:_t}var St={yaw:0,pitch:0,mix:0,spin:0,wander:1},Ct=(e,t,n)=>({yaw:b(e.yaw,t.yaw,n),pitch:b(e.pitch,t.pitch,n),mix:b(e.mix,t.mix,n),spin:b(e.spin,t.spin,n),wander:b(e.wander,t.wander,n)}),wt=(e,t,n)=>({w:b(e.w,t.w,n),h:b(e.h,t.h,n),open:b(e.open,t.open,n),tilt:b(e.tilt??0,t.tilt??0,n)});function Tt(e,t,n){let r=1-n;return{sil:we(e.sil,t.sil,n),offX:b(e.offX,t.offX,n),offY:b(e.offY,t.offY,n),gaze:{yaw:b(e.gaze.yaw,t.gaze.yaw,n),pitch:b(e.gaze.pitch,t.gaze.pitch,n),roll:b(e.gaze.roll,t.gaze.roll,n)},split:b(e.split,t.split,n),eyes:[wt(e.eyes[0],t.eyes[0],n),wt(e.eyes[1],t.eyes[1],n)],eyeAlpha:b(e.eyeAlpha,t.eyeAlpha,n),bodyAlpha:b(e.bodyAlpha,t.bodyAlpha,n),dots:[...e.dots.map(e=>({...e,opacity:e.opacity*r})),...t.dots.map(e=>({...e,opacity:e.opacity*n}))],arcs:[...e.arcs.map(e=>({...e,id:`a${e.id}`,opacity:e.opacity*r})),...t.arcs.map(e=>({...e,id:`b${e.id}`,opacity:e.opacity*n}))],notif:n<.5?e.notif:t.notif,dotsBehind:n<.5?e.dotsBehind:t.dotsBehind}}var Et=class e{scale;cur;prev=null;departFige=null;tCur=0;tPrev=0;posePhase=0;previousPosePhase=0;blinkAt=-10;pts=[];shape=null;shapePrev=null;shapeAt=-10;expr=null;exprPrev=null;exprAt=-10;look=St;lookPrev=St;lookAt=-10;lookMorph=.24;static SHAPE_MORPH=.45;static LOOK_MORPH=.24;constructor(e=100,t=`idle`,n=null,r=null){this.scale=e,this.cur=t,this.shape=n,this.expr=r}setExpression(e,t=0){e!==this.expr&&(this.exprPrev=this.expr,this.expr=e,this.exprAt=t)}exprAtTime(t){let n=this.expr,r=this.exprPrev;if(!n||!r)return n;let i=(t-this.exprAt)/e.SHAPE_MORPH;return i>=1?n:xe(r,n,x.easeOutQuint(y(i)))}setShape(e,t=0){e!==this.shape&&(this.shapePrev=this.shape,this.shape=e,this.shapeAt=t)}shapeAtTime(t){let n=this.shape,r=this.shapePrev;if(!n||!r)return n;let i=(t-this.shapeAt)/e.SHAPE_MORPH;if(i>=1)return n;let a=x.easeOutQuint(y(i));return n.map((e,t)=>b(r[t]??e,e,a))}setLook(t,n,r=e.LOOK_MORPH){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)}lookAtTime(e){let t=(e-this.lookAt)/this.lookMorph;return t>=1?this.look:Ct(this.lookPrev,this.look,x.easeOutQuint(y(t)))}posed(e,t,n,r){let i=e.pose(t);return e.baseBody&&n&&(i={...i,sil:{...i.sil,radii:n}}),e.baseFace&&r&&(i={...i,gaze:r.gaze,split:r.split,eyes:r.eyes}),i}decalageAtTime(t,n){let r=(e,n,r,i)=>{if(r===i)return i;let a=(t-e)/n;if(a>=1)return i;let o=x.easeOutQuint(y(a));return{x:b(r.x,i.x,o),y:b(r.y,i.y,o)}},i=t=>r(this.exprAt,e.SHAPE_MORPH,xt(t,n,this.exprPrev?.id??null),xt(t,n,this.expr?.id??null));return r(this.shapeAt,e.SHAPE_MORPH,i(this.shapePrev),i(this.shape))}get state(){return this.cur}reset(e,t){this.cur=e,this.prev=null,this.departFige=null,this.tCur=t,this.tPrev=t,this.posePhase=0,this.previousPosePhase=0,this.blinkAt=-10}origine(e,t,n){if(this.departFige)return this.departFige;if(!this.prev)return null;let r=Z.get(this.prev);return this.posed(r,Math.max(0,e-this.tPrev+this.previousPosePhase),t,n)}poseComposee(e){let t=Z.get(this.cur),n=this.shapeAtTime(e),r=this.exprAtTime(e),i=this.posed(t,Math.max(0,e-this.tCur+this.posePhase),n,r),a=e-this.tCur;if(a>=t.morph)return i;let o=this.origine(e,n,r);return o?Tt(o,i,x.easeOutQuint(y(a/t.morph))):i}setState(e,t,n=0){if(e===this.cur)return;let r=Z.get(this.cur).morph,i=this.prev!==null&&t-this.tCur<r;this.departFige=i?this.poseComposee(t):null,this.prev=this.cur,this.tPrev=this.tCur,this.previousPosePhase=this.posePhase,this.posePhase=n,this.cur=e,this.tCur=t,Z.get(e)?.blinkIn&&(this.blinkAt=t)}sample(e){let t=this.scale,n=Z.get(this.cur),r=this.shapeAtTime(e),i=this.exprAtTime(e),a=this.posed(n,Math.max(0,e-this.tCur+this.posePhase),r,i),o=this.decalageAtTime(e,this.cur),s=e-this.tCur,c=s<n.morph?this.origine(e,r,i):null;if(c){let t=x.easeOutQuint(y(s/n.morph));a=Tt(c,a,t);let r=this.prev;if(r){let n=this.decalageAtTime(e,r);o={x:b(n.x,o.x,t),y:b(n.y,o.y,t)}}}let l=a.eyeAlpha>.01,u=this.lookAtTime(e),d=he(e,{wander:l?u.wander:0,blink:l}),f={yaw:b(a.gaze.yaw,u.yaw,u.mix)+d.dYaw-u.spin,pitch:b(a.gaze.pitch,u.pitch,u.mix)+d.dPitch,roll:a.gaze.roll+d.dRoll},p=y((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=Ee(Te({...a.sil,cx:a.sil.cx+g,cy:a.sil.cy+_,sy:a.sil.sy*d.breath},t,this.pts)),S=(e,t)=>De(a.sil.radii,Math.atan2(t,e)-a.sil.rot),C=[];if(a.eyeAlpha>.01){let e=pe(f,t,a.split);for(let n=0;n<2;n++){let r=e[n];if(r.depth<=.02)continue;let i=a.eyes[n],s=S(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=ge(Math.min(h,i.open));C.push({d:Ne(i.w*t,i.h*t),matrix:`matrix(${w(d)},${w(f*v)},${w(p)},${w(m*v)},${w(r.x*s+(g+o.x)*t)},${w(r.y*s+(_+o.y)*t)})`,alpha:a.eyeAlpha*y(r.depth/.12)})}}let ee=a.dots.filter(e=>e.opacity>.01&&e.r>5e-4).map(e=>({...e,x:(e.x+g)*t,y:(e.y+_)*t,r:e.r*t})),T=a.notif?S(a.notif.x,a.notif.y):1,E=a.notif?(a.notif.x*T+g)*t:0,ne=a.notif?(a.notif.y*T+_)*t:0,re=a.notif?{x:E,y:ne,r:a.notif.r*t}:null,ie=a.notif?{x:E,y:ne,r:a.notif.notch*t}:null;return{bodyPath:v,bodyAlpha:a.bodyAlpha,eyes:C,dots:ee,dotsBehind:a.dotsBehind,arcs:a.arcs.filter(e=>e.opacity>.01).map(e=>te(e.seed,e.t,t,e.id,e.opacity)),notif:re,notch:ie}}},Dt=1.1,Ot=1.5,kt=e=>({yaw:0,pitch:0,mix:0,spin:360*(1-x.easeInOutCubic(y(e/Ot))),wander:1});function At({nx:e,ny:t,tour:n,pointer:r}){return{yaw:-26+e*16,pitch:10-t*13,mix:n,spin:360*(1-n),wander:+!r}}var jt=Math.max(...et.map(e=>e.morph)),Mt=10,Nt=200,Pt=50,Ft=.1,It=`defaut`;function Lt(e){return Math.max(jt,Z.get(e)?.minDuration??jt)}function Rt(e,t){let n=Math.round(t/Ft)*Ft,r=Math.min(10,Math.max(Lt(e),n));return Math.round(r*100)/100}function zt(e){return{state:e,duration:Rt(e,Z.get(e)?.duration??2)}}function Bt(){return{name:``,id:It,blocks:nt.map(zt)}}function Vt(e){return e.reduce((e,t)=>e+t.duration,0)}function Ht(e,t){let n=0;for(let r=0;r<t&&r<e.length;r++)n+=e[r].duration;return n}function Ut(e,t){let n=Vt(e);if(!e.length||n<=0)return{index:0,elapsed:0};let r=t>=0&&t<n?t:(t%n+n)%n,i=0;for(let t=0;t<e.length;t++){let n=i+e[t].duration;if(r<n)return{index:t,elapsed:r-i};i=n}return{index:e.length-1,elapsed:0}}function Wt(e,t){return e.length>=200?e:[...e,zt(t)]}function Gt(e,t,n){let r=e.slice(),[i]=r.splice(t,1);return i?(r.splice(Math.min(Math.max(n,0),r.length),0,i),r):e}function Kt(e,t){let n=new Set(t.map(e=>e.name));if(!n.has(e))return e;let r=2;for(;n.has(`${e} ${r}`);)r++;return`${e} ${r}`}function qt(e){let t=new Set(e.map(e=>e.id)),n=1;for(;t.has(`c${n}`);)n++;return`c${n}`}function Jt(e){if(typeof e!=`object`||!e)return null;let{state:t,duration:n}=e;return typeof t!=`string`||!nt.includes(t)||typeof n!=`number`||!Number.isFinite(n)?null:{state:t,duration:Rt(t,n)}}function Yt(e,t){if(typeof e!=`object`||!e)return null;let{id:n,name:r,blocks:i}=e;if(typeof n!=`string`||!n||typeof r!=`string`||!Array.isArray(i))return null;let a=i.slice(0,200).map(Jt).filter(e=>e!==null);return!a.length||t.some(e=>e.id===n)?null:{id:n,name:r,blocks:a}}function Xt(e){if(!e)return[];let t;try{t=JSON.parse(e)}catch{return[]}if(!Array.isArray(t))return[];let n=[];for(let e of t.slice(0,50)){let t=Yt(e,n);t&&n.push(t)}return n}var Zt=100,Qt=158,$t=[`<g`,`>`,`</g>`],en=`<svg... viewBox="." role="img". class="." style="."><defs><mask. maskUnits="userSpaceOnUse"....><path. fill="#fff"></path><!--$-->.<!--/--><!--$-->.<!--/--></mask><!--$-->.<!--/--></defs><g fill="none" stroke-linecap="round">.</g><!--$-->.<!--/--><g.><path..></path><g mask="."><rect.....></rect></g></g><!--$-->.<!--/--><!--$-->.<!--/--><g fill="none" stroke-linecap="round">.</g></svg>`.split(`.`),tn=[`<path`,``,``,``,` fill="#000"></path>`],nn=[`<circle`,``,``,``,` fill="#000"></circle>`],rn=[`<linearGradient`,` id="`,`" gradientUnits="userSpaceOnUse"`,``,``,``,`>`,`</linearGradient>`],an=[`<stop`,``,``,`></stop>`],on=[`<path`,``,` stroke="`,`"`,``,`></path>`],sn=[`<circle`,``,``,``,``,`></circle>`];function $(e,t,n){d(e,(e,n)=>{_(()=>t(e,n))},n?.defer?{defer:!0}:void 0)}function cn(v){var y,b,x,S;let C=n({size:320,shape:Be,color:Ue,expression:ye,paper:`#f9f9f9`,cycle:Bt().blocks,follow:!1,gaze:null,autoPause:!0,ariaLabel:`Animated Bloub avatar`},v),w=_(()=>{let e=C.initialPhase!==void 0&&C.frozenAt===void 0,t=e?C.initialPhase:0,n=e?Ut(C.cycle,t):{index:0,elapsed:0},r=e?C.cycle[n.index]?.state??`idle`:`idle`;return{phased:e,phase:t,...n,state:r}}),[ee,te]=p(w.index),[T,E]=p(w.state),[ne]=p(!1),[re,ie]=p(w.elapsed),D=()=>v.block??ee(),O=()=>v.state??T(),k=()=>v.playing??ne(),ae=()=>v.elapsed??re();function oe(e){v.block===void 0&&te(e),v.onBlockChange?.(e)}function se(e){v.state===void 0&&E(e),v.onStateChange?.(e)}function ce(e){v.elapsed===void 0&&ie(e),v.onElapsedChange?.(e)}let ue=f(()=>ze.get(C.shape)?.radii??null),de=f(()=>He.get(C.color)?.hex??`#0a0a0c`),fe=f(()=>ve.get(C.expression)??null),A=_(()=>{let e=new Et(100,O(),ue(),fe());return w.phased&&e.reset(O(),w.phase-w.elapsed),e}),[j,M]=p(_(()=>A.sample(C.frozenAt??w.phase)),{equals:!1}),N=m(),P=`bot-mask-${N}`,F,I=0,pe=-1/0,L=1/0,R=0,z=w.phase,me=0,he=0,ge=-1;function B(e,t=0,n=0){let r=C.cycle[e];if(!r){L=1/0;return}me=z-t,ce(t),se(r.state),A.setState(r.state,z,n),L=k()?me+r.duration:1/0}function V(e){oe(e),B(e)}function _e(e,t=0){if(D()===e){B(e,t);return}he=t,oe(e)}function be(e){let t=C.cycle;if(!t.length)return;let{index:n}=Ut(t,e);if(n!==ge){let e=t[n];se(e.state),n<ge?A.reset(e.state,Ht(t,n)):A.setState(e.state,Ht(t,n)),ge=n}M(A.sample(e))}let xe=!1,Se=0,H=!1,U=1/60;function W(e){e.pointerType!==`touch`&&(e.clientX,e.clientY)}function Ce(){}function G(){xe&&=(A.setLook(null,z,Dt),!1)}function we(){if(!Z.get(O())?.baseFace){G();return}}function Te(e){A.setLook(e(z-Se),z,U)}function Ee(){window.removeEventListener(`pointermove`,W),document.removeEventListener(`pointerleave`,Ce)}function K(e){I=requestAnimationFrame(K);let t=R?Math.min((e-R)/1e3,.064):0;R=e,z+=t;let n=C.fps&&C.fps>0?1/C.fps:0;z-pe<n||(pe=z,k()&&(z>=L&&C.cycle.length?V((D()+1)%C.cycle.length):ce(z-me)),C.follow?we():C.gaze&&Te(C.gaze),M(A.sample(z)))}function q(){C.frozenAt!==void 0&&M(A.sample(C.frozenAt))}$(()=>C.gaze,e=>{e?(Se=z,H=!0,A.setLook(e(0),z-U,U)):H&&=(A.setLook(null,z),!1)}),$(D,e=>{B(e,he),he=0},{defer:!0}),$(O,e=>{A.state!==e&&(A.setState(e,z),q())},{defer:!0}),$(k,e=>{e?B(D(),ae()):L=1/0},{defer:!0}),$(()=>C.cycle,e=>{if(!e.length){L=1/0;return}let t=Math.min(D(),e.length-1);if(t!==D())V(t);else if(e[t].state!==A.state){let n=w.phase%e[t].duration;B(t,n,n)}else L=k()?me+e[t].duration:1/0},{defer:!0}),$(ue,e=>{A.setShape(e,z),q()},{defer:!0}),$(fe,e=>{A.setExpression(e,z),q()},{defer:!0}),$(()=>C.frozenAt,q,{defer:!0}),d(()=>C.follow&&C.frozenAt===void 0,e=>{e?(window.addEventListener(`pointermove`,W),document.addEventListener(`pointerleave`,Ce)):(Ee(),G())});function De(){I||typeof requestAnimationFrame>`u`||(R=0,I=requestAnimationFrame(K))}function Oe(){I&&=(typeof cancelAnimationFrame<`u`&&cancelAnimationFrame(I),0)}let[ke,Ae]=p(!0),[je,Me]=p(!0),[Ne,Pe]=p(!1);d(()=>Ne()&&C.frozenAt===void 0&&(!C.autoPause||ke()&&je()),e=>{e?De():Oe()}),g(()=>{if(v.ref?.({get svg(){},seek:_e,renderAt:be}),C.frozenAt!==void 0)return;B(D(),ae());let e=()=>Me(document.visibilityState!==`hidden`);document.addEventListener(`visibilitychange`,e),e();let t=typeof IntersectionObserver>`u`?null:new IntersectionObserver(e=>{let t=e[e.length-1];t&&Ae(t.isIntersecting)});return t?.observe(F),Pe(!0),()=>{document.removeEventListener(`visibilitychange`,e),t?.disconnect()}}),h(()=>{Oe(),typeof window<`u`&&Ee()});function Fe(e){let t={fill:e.color??(e.depth===void 0?de():We(C.paper,de(),e.depth)),opacity:e.opacity};return e.d?{...t,d:e.d,transform:`translate(${e.x} ${e.y}) rotate(${e.rot??0}) scale(100)`}:{...t,cx:e.x,cy:e.y,r:e.r}}let Ie=()=>l({get each(){return j().dots},keyed:!1,children:t=>e(n({get component(){return t().d?`path`:`circle`}},()=>Fe(t())))});var Le=s(),Re=o(()=>[i(`width`,t(C.size,!0)),i(`height`,t(C.size,!0))],2),J=o(()=>[i(`aria-label`,t(C.ariaLabel,!0)),a(C.class),c(C.style)],3),Ve=()=>i(`d`,t(j().bodyPath,!0)),Y=t(l({get each(){return j().eyes},keyed:!1,children:e=>{var n,a;return n=s(),a=o(()=>[i(`d`,t(e().d,!0)),i(`transform`,t(e().matrix,!0)),i(`opacity`,t(e().alpha,!0))],3),r(tn,n,a,a,a)}})),X=t(u({get when(){return j().notch},children:e=>{var n,a;return n=s(),a=o(()=>[i(`cx`,t(e().x,!0)),i(`cy`,t(e().y,!0)),i(`r`,t(e().r,!0))],3),r(nn,n,a,a,a)}})),Ge=t(l({get each(){return j().arcs},keyed:!1,children:e=>{var n,a,c;return n=s(),a=o(()=>[`${t(N,!0)}-${t(e().id,!0)}`,i(`x1`,t(e().grad.x1,!0)),i(`y1`,t(e().grad.y1,!0)),i(`x2`,t(e().grad.x2,!0)),i(`y2`,t(e().grad.y2,!0))],5),c=t(l({get each(){return e().grad.stops},keyed:!1,children:(n,a)=>{var c,l;return c=s(),l=o(()=>[i(`offset`,t(a,!0)/(t(e().grad.stops.length,!0)-1)),i(`stop-color`,t(n(),!0))],2),r(an,c,l,l)}})),r(rn,n,a,a,a,a,a,c)}})),Ke=t(l({get each(){return j().arcs},keyed:!1,children:e=>{var n,a;return n=s(),a=o(()=>[i(`d`,t(e().back,!0)),`url(#${t(N,!0)}-${t(e().id,!0)})`,i(`stroke-width`,t(e().width,!0)),i(`opacity`,t(e().opacity,!0))],4),r(on,n,a,a,a,a)}})),qe=t(u({get when(){return j().dotsBehind},get children(){return y=s(),b=t(Ie({})),r($t,y,b)}})),Je=o(()=>[i(`opacity`,t(j().bodyAlpha,!0)),i(`d`,t(j().bodyPath,!0)),i(`fill`,t(C.paper,!0))],3),Ye=()=>i(`fill`,t(de(),!0)),Xe=t(u({get when(){return!j().dotsBehind},get children(){return x=s(),S=t(Ie({})),r($t,x,S)}})),Ze=t(u({get when(){return j().notif},children:e=>{var n,a;return n=s(),a=o(()=>[i(`cx`,t(e().x,!0)),i(`cy`,t(e().y,!0)),i(`r`,t(e().r,!0))],3),r(sn,n,a,a,a,i(`fill`,t(le,!0)))}})),Qe=t(l({get each(){return j().arcs},keyed:!1,children:e=>{var n,a;return n=s(),a=o(()=>[i(`d`,t(e().front,!0)),`url(#${t(N,!0)}-${t(e().id,!0)})`,i(`stroke-width`,t(e().width,!0)),i(`opacity`,t(e().opacity,!0))],4),r(on,n,a,a,a,a)}}));return r(en,Le,Re,Re,`-158 -158 ${t(158,!0)*2} ${t(158,!0)*2}`,J,J,J,i(`id`,t(P,!0)),i(`x`,-158),i(`y`,-158),i(`width`,t(158,!0)*2),i(`height`,t(158,!0)*2),Ve,Y,X,Ge,Ke,qe,Je,Je,Je,`url(#${t(P,!0)})`,i(`x`,-158),i(`y`,-158),i(`width`,t(158,!0)*2),i(`height`,t(158,!0)*2),Ye,Xe,Ze,Qe)}export{cn as BloubBot,Et as BotEngine,Ve as COLORS,He as COLOR_BY_ID,Ue as DEFAULT_COLOR,ye as DEFAULT_EXPRESSION,Be as DEFAULT_SHAPE,Qt as DEMI_VIEWBOX,_e as EXPRESSIONS,ve 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,J as SHAPES,ze as SHAPE_BY_ID,et as STATES,Z as STATE_BY_ID,Ft as STEP,Ot as TOUR_TIME,Dt as TURN_TIME,xe 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};
@@ -82,6 +82,12 @@ export declare class BotEngine {
82
82
  private departFige;
83
83
  private tCur;
84
84
  private tPrev;
85
+ /**
86
+ * Avance de la POSE de l'etat courant (et de l'etat quitte) sur son horloge : la pose se
87
+ * lit a `now - tCur + posePhase`, le fondu reste date sur `tCur`. Cf. `setState`.
88
+ */
89
+ private posePhase;
90
+ private previousPosePhase;
85
91
  private blinkAt;
86
92
  private pts;
87
93
  private shape;
@@ -200,7 +206,12 @@ export declare class BotEngine {
200
206
  * exactement l'image affichee. La lecture d'un montage, dont les blocs durent au moins
201
207
  * le plus long fondu (`MIN_BLOCK`), ne fige donc jamais rien et rend au bit ce qu'elle
202
208
  * rendait.
209
+ *
210
+ * `posePhase` avance la pose du nouvel etat sans toucher au fondu : un bot qui entre dans
211
+ * un etat au milieu de son animation (cf. `initialPhase` du composant) morphe depuis
212
+ * l'image a l'ecran, sur la duree normale, vers une pose deja en cours. A 0 — la valeur
213
+ * par defaut — le rendu est celui d'avant, au bit pres.
203
214
  */
204
- setState(id: StateId, now: number): void;
215
+ setState(id: StateId, now: number, posePhase?: number): void;
205
216
  sample(now: number): BotFrame;
206
217
  }
@@ -38,6 +38,12 @@ export interface BloubBotProps {
38
38
  * `renderAt` (l'export, lui, passe par `frozenAt` et n'a jamais de boucle).
39
39
  */
40
40
  autoPause?: boolean;
41
+ /**
42
+ * Date de depart du bot dans son montage, en secondes. Lue une fois, au montage :
43
+ * l'horloge, le bloc et la pose partent de cette date, donc plusieurs bots montes
44
+ * ensemble ne respirent pas a l'unisson. Ignoree par un bot fige (`frozenAt`).
45
+ */
46
+ initialPhase?: number;
41
47
  onBlockChange?: (value: number) => void;
42
48
  onStateChange?: (value: StateId) => void;
43
49
  onPlayingChange?: (value: boolean) => void;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@norbert_bodziony/bloub",
3
3
  "private": false,
4
- "version": "0.3.0",
4
+ "version": "0.4.1",
5
5
  "type": "module",
6
6
  "description": "SVG recreation of the x.ai bot avatar. One shape morphing through 14 states, measured off the reference video frame by frame.",
7
7
  "license": "MIT",