wissive 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +86 -0
- package/dist/wissive.cjs +149 -131
- package/dist/wissive.cjs.map +1 -1
- package/dist/wissive.js +1412 -1087
- package/dist/wissive.js.map +1 -1
- package/dist/wissive.umd.js +149 -131
- package/dist/wissive.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/wissive.umd.js
CHANGED
|
@@ -1,135 +1,150 @@
|
|
|
1
|
-
(function(p,y){typeof exports=="object"&&typeof module<"u"?y(exports):typeof define=="function"&&define.amd?define(["exports"],y):(p=typeof globalThis<"u"?globalThis:p||self,y(p.Wissive={}))})(this,function(p){"use strict";var co=Object.defineProperty;var ho=(p,y,ne)=>y in p?co(p,y,{enumerable:!0,configurable:!0,writable:!0,value:ne}):p[y]=ne;var M=(p,y,ne)=>ho(p,typeof y!="symbol"?y+"":y,ne);function y(o={}){return{eyeOpen:1,eyeScale:1,eyeType:0,eyeGap:32,eyeY:45,mouthY:63,mouthCurve:0,mouthWidth:.8,mouthOpen:0,mouthType:0,browY:0,browTilt:0,cheek:0,bob:0,shiftX:0,tears:0,gazeX:0,gazeY:0,turnAngle:0,zzz:0,sweat:0,storm:0,scribble:0,puff:0,...o}}const ne={name:"mochi",emotion:"happy",baseColor:"#F2A9B8",silhouette:"heart",motion:{stiffness:220,damping:14,idleSpeed:3.2,idleAmplitude:2.5,idleIntervalMin:6e3,idleIntervalMax:12e3,motionType:"bouncy"},expressions:{idle:[y({eyeType:2,eyeScale:1,eyeGap:28.33,eyeY:43.33,mouthType:0,mouthY:53.33,mouthWidth:.39,mouthCurve:.43,cheek:0}),y({eyeType:2,eyeScale:1,eyeGap:28.33,eyeY:43.33,mouthType:0,mouthY:53.33,mouthWidth:.39,mouthCurve:.43,cheek:0,bob:-1.5}),y({eyeType:2,eyeScale:1,eyeGap:28.33,eyeY:43.33,mouthType:0,mouthY:53.33,mouthWidth:.39,mouthCurve:.43,cheek:0,bob:1}),y({eyeType:2,eyeScale:1,eyeGap:28.33,eyeY:43.33,mouthType:0,mouthY:53.33,mouthWidth:.39,mouthCurve:.43,cheek:0})],near:[y({eyeType:2,eyeScale:1,eyeGap:28.33,eyeY:43.33,mouthType:0,mouthY:53.33,mouthWidth:.39,mouthCurve:.43,cheek:0,bob:-1.5}),y({eyeType:2,eyeScale:1,eyeGap:28.33,eyeY:43.33,mouthType:0,mouthY:53.33,mouthWidth:.39,mouthCurve:.43,cheek:0,bob:-2.5})],hover:[y({eyeType:2,eyeScale:1,eyeGap:28.33,eyeY:43.33,mouthType:0,mouthY:53.33,mouthWidth:.39,mouthCurve:.43,cheek:.3,bob:-4}),y({eyeType:2,eyeScale:1,eyeGap:28.33,eyeY:43.33,mouthType:0,mouthY:53.33,mouthWidth:.39,mouthCurve:.43,cheek:.3,bob:-4.5})],click:[y({eyeType:2,eyeScale:1,eyeGap:28.33,eyeY:43.33,mouthType:0,mouthY:53.33,mouthWidth:.39,mouthCurve:.43,cheek:.5,bob:-7}),y({eyeType:2,eyeScale:1,eyeGap:28.33,eyeY:43.33,mouthType:0,mouthY:53.33,mouthWidth:.39,mouthCurve:.43,cheek:.5,bob:-6})]}},je={name:"zumi",emotion:"flutter",baseColor:"#F2CB4E",silhouette:"round-blob",motion:{stiffness:300,damping:10,idleSpeed:4.5,idleAmplitude:3.8,idleIntervalMin:4e3,idleIntervalMax:9e3,motionType:"flutter"},expressions:{idle:[y({eyeType:2,eyeScale:1,eyeGap:30,eyeY:43.33,mouthType:3,mouthY:45.83,mouthWidth:.27,mouthCurve:0,cheek:.3}),y({eyeType:2,eyeScale:1,eyeGap:30,eyeY:43.33,mouthType:3,mouthY:45.83,mouthWidth:.27,mouthCurve:0,cheek:.4,bob:-1.5}),y({eyeType:2,eyeScale:1,eyeGap:30,eyeY:43.33,mouthType:3,mouthY:45.83,mouthWidth:.27,mouthCurve:0,cheek:.35,bob:1})],near:[y({eyeType:2,eyeScale:1,eyeGap:30,eyeY:43.33,mouthType:3,mouthY:45.83,mouthWidth:.27,mouthCurve:0,cheek:.5,bob:-2})],hover:[y({eyeType:2,eyeScale:1,eyeGap:30,eyeY:43.33,mouthType:3,mouthY:45.83,mouthWidth:.27,mouthCurve:0,cheek:.7,bob:-4})],click:[y({eyeType:2,eyeScale:1,eyeGap:30,eyeY:43.33,mouthType:3,mouthY:45.83,mouthWidth:.27,mouthCurve:0,cheek:.9,bob:-6})]}},_e={name:"suri",emotion:"pleasure",baseColor:"#F28FC2",silhouette:"elongated-oval",motion:{stiffness:140,damping:18,idleSpeed:1.8,idleAmplitude:1.8,idleIntervalMin:7e3,idleIntervalMax:14e3,motionType:"serene"},expressions:{idle:[y({eyeType:1,eyeScale:1,eyeGap:26.67,eyeY:45,mouthType:0,mouthY:53.33,mouthWidth:.36,mouthCurve:.48,cheek:.4}),y({eyeType:1,eyeScale:1,eyeGap:26.67,eyeY:45,mouthType:0,mouthY:53.33,mouthWidth:.36,mouthCurve:.48,cheek:.5,bob:1})],near:[y({eyeType:1,eyeScale:1,eyeGap:26.67,eyeY:45,mouthType:0,mouthY:53.33,mouthWidth:.36,mouthCurve:.48,cheek:.6,bob:2})],hover:[y({eyeType:1,eyeScale:1,eyeGap:26.67,eyeY:45,mouthType:0,mouthY:53.33,mouthWidth:.36,mouthCurve:.48,cheek:.75,bob:3.5})],click:[y({eyeType:1,eyeScale:1,eyeGap:26.67,eyeY:45,mouthType:0,mouthY:53.33,mouthWidth:.36,mouthCurve:.48,cheek:.9,bob:5})]}},Re={name:"nima",emotion:"peaceful",baseColor:"#9AC9A0",silhouette:"ghost-blob",motion:{stiffness:110,damping:22,idleSpeed:1.2,idleAmplitude:2,idleIntervalMin:8e3,idleIntervalMax:15e3,motionType:"float"},expressions:{idle:[y({eyeType:14,eyeScale:1,eyeGap:25,eyeY:43.33,mouthType:14,mouthY:51.67,mouthWidth:0,mouthCurve:0}),y({eyeType:14,eyeScale:1,eyeGap:25,eyeY:43.33,mouthType:14,mouthY:51.67,mouthWidth:0,mouthCurve:0,bob:1.5})],near:[y({eyeType:14,eyeScale:1,eyeGap:25,eyeY:43.33,mouthType:14,mouthY:51.67,mouthWidth:0,mouthCurve:0,bob:2})],hover:[y({eyeType:14,eyeScale:1,eyeGap:25,eyeY:43.33,mouthType:14,mouthY:51.67,mouthWidth:0,mouthCurve:0,cheek:.3,bob:3})],click:[y({eyeType:14,eyeScale:1,eyeGap:25,eyeY:43.33,mouthType:14,mouthY:51.67,mouthWidth:0,mouthCurve:0,cheek:.5,bob:4.5})]}},he={name:"cota",emotion:"normal",baseColor:"#C9DCD3",silhouette:"oval",motion:{stiffness:160,damping:18,idleSpeed:1.5,idleAmplitude:1.2,idleIntervalMin:8e3,idleIntervalMax:16e3,motionType:"calm"},expressions:{idle:[y({eyeType:0,eyeScale:1,eyeGap:23.33,eyeY:45.83,mouthType:3,mouthY:56.67,mouthWidth:.33,mouthCurve:0}),y({eyeType:0,eyeScale:1,eyeGap:23.33,eyeY:45.83,mouthType:3,mouthY:56.67,mouthWidth:.33,mouthCurve:0,bob:-.8})],near:[y({eyeType:0,eyeScale:1,eyeGap:23.33,eyeY:45.83,mouthType:3,mouthY:56.67,mouthWidth:.33,mouthCurve:0,bob:1.2})],hover:[y({eyeType:0,eyeScale:1,eyeGap:23.33,eyeY:45.83,mouthType:3,mouthY:56.67,mouthWidth:.33,mouthCurve:0,cheek:.2,bob:2.5})],click:[y({eyeType:0,eyeScale:1,eyeGap:23.33,eyeY:45.83,mouthType:3,mouthY:56.67,mouthWidth:.33,mouthCurve:0,cheek:.4,bob:4})]}},Ze={name:"dozy",emotion:"tired",baseColor:"#D6DBCF",silhouette:"wide-oval",motion:{stiffness:90,damping:24,idleSpeed:.9,idleAmplitude:2.8,idleIntervalMin:6e3,idleIntervalMax:12e3,motionType:"droop"},expressions:{idle:[y({eyeType:15,eyeScale:.85,eyeGap:26.67,eyeY:45.83,mouthType:3,mouthY:56.67,mouthWidth:.24,mouthCurve:0,sweat:1,puff:.7,bob:1.5}),y({eyeType:15,eyeScale:.85,eyeGap:26.67,eyeY:45.83,mouthType:3,mouthY:56.67,mouthWidth:.24,mouthCurve:0,sweat:1,puff:.7,bob:2.5})],near:[y({eyeType:15,eyeScale:.85,eyeGap:26.67,eyeY:45.83,mouthType:3,mouthY:56.67,mouthWidth:.24,mouthCurve:0,sweat:1,puff:.7,bob:3.5})],hover:[y({eyeType:15,eyeScale:.85,eyeGap:26.67,eyeY:45.83,mouthType:3,mouthY:56.67,mouthWidth:.24,mouthCurve:0,sweat:1,puff:.85,bob:4.5})],click:[y({eyeType:15,eyeScale:.85,eyeGap:26.67,eyeY:45.83,mouthType:3,mouthY:56.67,mouthWidth:.24,mouthCurve:0,sweat:1,puff:1,bob:6.5})]}},Ne={name:"lumo",emotion:"sad",baseColor:"#7FA6D9",silhouette:"teardrop-blob",motion:{stiffness:100,damping:20,idleSpeed:1.1,idleAmplitude:2.2,idleIntervalMin:7e3,idleIntervalMax:13e3,motionType:"sob"},expressions:{idle:[y({eyeType:16,eyeScale:1,eyeGap:25,eyeY:43.33,mouthType:3,mouthY:55,mouthWidth:.3,mouthCurve:0,tears:1,bob:1.8}),y({eyeType:16,eyeScale:1,eyeGap:25,eyeY:43.33,mouthType:3,mouthY:55,mouthWidth:.3,mouthCurve:0,tears:1,bob:2.8})],near:[y({eyeType:16,eyeScale:1,eyeGap:25,eyeY:43.33,mouthType:3,mouthY:55,mouthWidth:.3,mouthCurve:0,tears:1,bob:3.5})],hover:[y({eyeType:16,eyeScale:1,eyeGap:25,eyeY:43.33,mouthType:3,mouthY:55,mouthWidth:.3,mouthCurve:0,tears:1,bob:4.8})],click:[y({eyeType:16,eyeScale:1,eyeGap:25,eyeY:43.33,mouthType:3,mouthY:55,mouthWidth:.3,mouthCurve:0,tears:1,bob:6})]}},Je={name:"fidge",emotion:"anxiety",baseColor:"#A99BD9",silhouette:"cloud-blob",motion:{stiffness:350,damping:8,idleSpeed:5.5,idleAmplitude:1.5,idleIntervalMin:3e3,idleIntervalMax:7e3,motionType:"jitter"},expressions:{idle:[y({eyeType:5,eyeScale:1,eyeGap:25,eyeY:43.33,mouthType:13,mouthY:56.67,mouthWidth:.08,mouthCurve:0}),y({eyeType:5,eyeScale:1,eyeGap:25,eyeY:43.33,mouthType:13,mouthY:56.67,mouthWidth:.08,mouthCurve:0,shiftX:1.5})],near:[y({eyeType:5,eyeScale:1,eyeGap:25,eyeY:43.33,mouthType:13,mouthY:56.67,mouthWidth:.08,mouthCurve:0,shiftX:2.5})],hover:[y({eyeType:5,eyeScale:1,eyeGap:25,eyeY:43.33,mouthType:13,mouthY:56.67,mouthWidth:.08,mouthCurve:0,shiftX:4})],click:[y({eyeType:5,eyeScale:1,eyeGap:25,eyeY:43.33,mouthType:13,mouthY:56.67,mouthWidth:.08,mouthCurve:0,shiftX:6})]}},Qe={name:"brix",emotion:"anger",baseColor:"#D9566A",silhouette:"flame-blob",motion:{stiffness:280,damping:12,idleSpeed:3.8,idleAmplitude:2,idleIntervalMin:4e3,idleIntervalMax:8e3,motionType:"fiery"},expressions:{idle:[y({eyeType:17,eyeScale:1,eyeGap:28.33,eyeY:46.67,mouthType:0,mouthY:61.67,mouthWidth:.33,mouthCurve:-.48}),y({eyeType:17,eyeScale:1,eyeGap:28.33,eyeY:46.67,mouthType:0,mouthY:61.67,mouthWidth:.33,mouthCurve:-.48})],near:[y({eyeType:17,eyeScale:1,eyeGap:28.33,eyeY:46.67,mouthType:0,mouthY:61.67,mouthWidth:.33,mouthCurve:-.48})],hover:[y({eyeType:17,eyeScale:1,eyeGap:28.33,eyeY:46.67,mouthType:0,mouthY:61.67,mouthWidth:.33,mouthCurve:-.48})],click:[y({eyeType:17,eyeScale:1,eyeGap:28.33,eyeY:46.67,mouthType:0,mouthY:61.67,mouthWidth:.33,mouthCurve:-.48})]}},Ve={name:"wilt",emotion:"disappointed",baseColor:"#EBD98A",silhouette:"droopy-blob",motion:{stiffness:100,damping:22,idleSpeed:1,idleAmplitude:2,idleIntervalMin:7e3,idleIntervalMax:14e3,motionType:"wilt"},expressions:{idle:[y({eyeType:15,eyeScale:1.15,eyeGap:25,eyeY:43.33,mouthType:0,mouthY:63.33,mouthWidth:.45,mouthCurve:-.54,bob:1.5}),y({eyeType:15,eyeScale:1.15,eyeGap:25,eyeY:43.33,mouthType:0,mouthY:63.33,mouthWidth:.45,mouthCurve:-.54,bob:2.5})],near:[y({eyeType:15,eyeScale:1.15,eyeGap:25,eyeY:43.33,mouthType:0,mouthY:63.33,mouthWidth:.45,mouthCurve:-.54,bob:3.5})],hover:[y({eyeType:15,eyeScale:1.15,eyeGap:25,eyeY:43.33,mouthType:0,mouthY:63.33,mouthWidth:.45,mouthCurve:-.54,bob:4.5})],click:[y({eyeType:15,eyeScale:1.15,eyeGap:25,eyeY:43.33,mouthType:0,mouthY:63.33,mouthWidth:.45,mouthCurve:-.54,bob:6})]}},qe={name:"knot",emotion:"stress",baseColor:"#C97F76",silhouette:"bear-blob",motion:{stiffness:320,damping:9,idleSpeed:4.8,idleAmplitude:2.2,idleIntervalMin:3500,idleIntervalMax:7500,motionType:"dizzy"},expressions:{idle:[y({eyeType:18,eyeScale:1,eyeGap:26.67,eyeY:45,mouthType:3,mouthY:58.33,mouthWidth:.42,mouthCurve:0,storm:1,scribble:1}),y({eyeType:18,eyeScale:1,eyeGap:26.67,eyeY:45,mouthType:3,mouthY:58.33,mouthWidth:.42,mouthCurve:0,storm:1,scribble:1,shiftX:1.5})],near:[y({eyeType:18,eyeScale:1,eyeGap:26.67,eyeY:45,mouthType:3,mouthY:58.33,mouthWidth:.42,mouthCurve:0,storm:1,scribble:1,shiftX:3})],hover:[y({eyeType:18,eyeScale:1,eyeGap:26.67,eyeY:45,mouthType:3,mouthY:58.33,mouthWidth:.42,mouthCurve:0,storm:1,scribble:1,shiftX:4.5})],click:[y({eyeType:18,eyeScale:1,eyeGap:26.67,eyeY:45,mouthType:3,mouthY:58.33,mouthWidth:.42,mouthCurve:0,storm:1,scribble:1,shiftX:6.5})]}},Ue={name:"snug",emotion:"sleepy",baseColor:"#AFCBE0",silhouette:"soft-round",motion:{stiffness:85,damping:25,idleSpeed:.7,idleAmplitude:2.2,idleIntervalMin:6e3,idleIntervalMax:12e3,motionType:"snooze"},expressions:{idle:[y({eyeType:19,eyeScale:1,eyeGap:26.67,eyeY:45,mouthType:3,mouthY:56.67,mouthWidth:.27,mouthCurve:0,zzz:1,bob:.5}),y({eyeType:19,eyeScale:1,eyeGap:26.67,eyeY:45,mouthType:3,mouthY:56.67,mouthWidth:.27,mouthCurve:0,zzz:1,bob:1.5})],near:[y({eyeType:19,eyeScale:1,eyeGap:26.67,eyeY:45,mouthType:3,mouthY:56.67,mouthWidth:.27,mouthCurve:0,zzz:1,bob:2.5})],hover:[y({eyeType:19,eyeScale:1,eyeGap:26.67,eyeY:45,mouthType:3,mouthY:56.67,mouthWidth:.27,mouthCurve:0,zzz:1,bob:3.8})],click:[y({eyeType:19,eyeScale:1,eyeGap:26.67,eyeY:45,mouthType:3,mouthY:56.67,mouthWidth:.27,mouthCurve:0,zzz:1,bob:5.5})]}},He={name:"pip",emotion:"surprised",baseColor:"#F0B98A",silhouette:"octopus-blob",motion:{stiffness:250,damping:12,idleSpeed:2.8,idleAmplitude:3,idleIntervalMin:5e3,idleIntervalMax:1e4,motionType:"pop"},expressions:{idle:[y({eyeType:20,eyeScale:.8,eyeGap:21.67,eyeY:43.33,mouthType:1,mouthY:55,mouthWidth:.21,mouthCurve:0}),y({eyeType:20,eyeScale:.8,eyeGap:21.67,eyeY:43.33,mouthType:1,mouthY:55,mouthWidth:.21,mouthCurve:0,bob:-2})],near:[y({eyeType:20,eyeScale:.8,eyeGap:21.67,eyeY:43.33,mouthType:1,mouthY:55,mouthWidth:.21,mouthCurve:0,bob:-3})],hover:[y({eyeType:20,eyeScale:.8,eyeGap:21.67,eyeY:43.33,mouthType:1,mouthY:55,mouthWidth:.21,mouthCurve:0,bob:-5})],click:[y({eyeType:20,eyeScale:.8,eyeGap:21.67,eyeY:43.33,mouthType:1,mouthY:55,mouthWidth:.21,mouthCurve:0,bob:-8})]}},Ke={name:"void",emotion:"numbness",baseColor:"#D9C6E0",silhouette:"wave-blob",motion:{stiffness:100,damping:24,idleSpeed:.8,idleAmplitude:1.5,idleIntervalMin:9e3,idleIntervalMax:18e3,motionType:"drift"},expressions:{idle:[y({eyeType:20,eyeScale:.75,eyeGap:23.33,eyeY:44.17,mouthType:3,mouthY:56.67,mouthWidth:.33,mouthCurve:0}),y({eyeType:20,eyeScale:.75,eyeGap:23.33,eyeY:44.17,mouthType:3,mouthY:56.67,mouthWidth:.33,mouthCurve:0,bob:1})],near:[y({eyeType:20,eyeScale:.75,eyeGap:23.33,eyeY:44.17,mouthType:3,mouthY:56.67,mouthWidth:.33,mouthCurve:0,bob:2})],hover:[y({eyeType:20,eyeScale:.75,eyeGap:23.33,eyeY:44.17,mouthType:3,mouthY:56.67,mouthWidth:.33,mouthCurve:0,bob:3})],click:[y({eyeType:20,eyeScale:.75,eyeGap:23.33,eyeY:44.17,mouthType:3,mouthY:56.67,mouthWidth:.33,mouthCurve:0,bob:4.5})]}},H={mochi:ne,zumi:je,suri:_e,nima:Re,cota:he,dozy:Ze,lumo:Ne,fidge:Je,brix:Qe,wilt:Ve,knot:qe,snug:Ue,pip:He,void:Ke};function Ee(o){const t=o.toLowerCase();return H[t]?H[t]:Object.values(H).find(i=>i.emotion===t)||ne}function et(o,t={}){const{stiffness:e=180,damping:i=18,mass:s=1}=t,c={current:o,target:o,velocity:0};return{state:c,setTarget(a){c.target=a},setCurrent(a){c.current=a,c.target=a,c.velocity=0},update(a){const $=a/4;let g=!1;for(let d=0;d<4;d++){const v=c.current-c.target,k=-e*v,x=-i*c.velocity,z=(k+x)/s;c.velocity+=z*$,c.current+=c.velocity*$,(Math.abs(c.velocity)>1e-4||Math.abs(c.current-c.target)>1e-4)&&(g=!0)}return g||(c.current=c.target,c.velocity=0),g}}}function tt(o,t){const e=Object.keys(o),i={};for(const s of e)i[s]=et(o[s],t);return{getValues(){const s={};for(const c of e)s[c]=i[c].state.current;return s},setTargets(s){for(const c in s)c in i&&i[c].setTarget(s[c])},setValues(s){for(const c in s)c in i&&i[c].setCurrent(s[c])},update(s){let c=!1;for(const a of e)i[a].update(s)&&(c=!0);return c}}}function Zt(o,t){const e={...o};switch(t){case"sleeping":e.eyeOpen=.05,e.eyeType=2,e.mouthCurve=.2,e.browY=3,e.browTilt=-.1,e.cheek=.2,e.zzz=1;break;case"drowsy":case"powering-down":e.eyeOpen=.35,e.mouthCurve=0,e.browY=4,e.browTilt=.1,e.zzz=.55,e.sweat=.8,e.puff=.7;break;case"bored":e.eyeOpen=.45,e.mouthCurve=-.2,e.browY=2,e.gazeX=6,e.puff=.4;break;case"waking":case"spawning":e.eyeOpen=.75,e.eyeScale=1.1,e.mouthCurve=.4,e.browY=-2;break;case"angry":e.eyeType=3,e.browTilt=-.75,e.mouthCurve=-.65,e.mouthOpen=.2,e.eyeScale=1.15,e.storm=1;break;case"alerting":case"notifying":e.eyeScale=1.3,e.browTilt=-.4,e.mouthOpen=.45,e.mouthCurve=.1;break;case"suspicious":e.browTilt=-.5,e.eyeScale=.9,e.mouthCurve=-.3,e.gazeX=-8;break;case"excited":case"celebrate":e.eyeScale=1.35,e.mouthCurve=.9,e.mouthOpen=.55,e.cheek=.85,e.browY=-4;break;case"happy":case"playful":e.eyeScale=1.15,e.mouthCurve=.75,e.cheek=.6,e.browY=-2;break;case"laughing":e.eyeType=2,e.mouthCurve=.95,e.mouthOpen=.7,e.cheek=.9,e.bob=-3;break;case"proud":e.eyeScale=1.1,e.mouthCurve=.65,e.browY=-3,e.bob=-4;break;case"thinking":case"searching":e.browTilt=.5,e.eyeScale=1.1,e.mouthWidth=.6,e.mouthCurve=.1,e.shiftX=-4;break;case"dictating":case"listening":case"writing":case"humming":e.mouthOpen=.45,e.mouthCurve=.4,e.eyeScale=1.08,e.cheek=.4;break;case"loading":case"orbit":case"radar":case"progress":e.eyeScale=1.15,e.mouthCurve=.3,e.browY=-2;break;case"surprised":e.eyeScale=1.45,e.mouthOpen=.75,e.mouthCurve=0,e.browY=-7;break;case"scared":e.eyeScale=1.4,e.mouthOpen=.8,e.mouthCurve=-.55,e.browTilt=.5;break;case"confused":e.browTilt=.65,e.mouthCurve=-.3,e.shiftX=-5,e.scribble=1;break;case"curious":e.browTilt=-.3,e.eyeScale=1.2,e.mouthCurve=.45,e.shiftX=3;break;case"shy":e.eyeScale=.85,e.gazeY=6,e.cheek=.95,e.mouthCurve=.35;break;case"sad":e.browTilt=.6,e.mouthCurve=-.65,e.tears=.8,e.browY=2;break}return e}class ot{constructor(){M(this,"currentState","idle");M(this,"lastIndices",{})}getState(){return this.currentState}setState(t){const e=this.currentState!==t;return this.currentState=t,e}resolvePool(t,e=this.currentState){let i=[];if(t[e]&&t[e].length>0)i=t[e];else switch(e){case"happy":case"excited":case"playful":case"celebrate":case"laughing":case"proud":i=t.hover||t.idle;break;case"surprised":case"scared":case"alerting":case"notifying":case"bouncing":i=t.click||t.hover||t.idle;break;case"suspicious":case"angry":i=t.click||t.idle;break;case"curious":case"thinking":case"searching":case"listening":case"working":case"confused":case"shy":case"sad":case"dictating":case"writing":case"sending":case"receiving":case"uploading":case"dragging":case"humming":case"loading":case"orbit":case"radar":case"progress":i=t.near||t.hover||t.idle;break;default:i=t[e]||t.idle;break}return i.map(s=>Zt(s,e))}pickVariant(t,e=this.currentState){if(!t||t.length===0)throw new Error(`Empty variant pool for state "${e}"`);if(t.length===1)return this.lastIndices[e]=0,t[0];const i=this.lastIndices[e]??-1;let s=Math.floor(Math.random()*t.length);for(;s===i;)s=Math.floor(Math.random()*t.length);return this.lastIndices[e]=s,t[s]}}class Nt{constructor(){M(this,"callbacks",new Set);M(this,"handle",null);M(this,"lastTime",0)}add(t){this.callbacks.add(t),this.handle||(this.lastTime=performance.now(),this.tick=this.tick.bind(this),this.handle=requestAnimationFrame(this.tick))}remove(t){this.callbacks.delete(t),this.callbacks.size===0&&this.handle!==null&&(cancelAnimationFrame(this.handle),this.handle=null)}get size(){return this.callbacks.size}tick(t){const e=Math.min((t-this.lastTime)/1e3,.1);this.lastTime=t,this.callbacks.forEach(i=>i(e)),this.callbacks.size>0?this.handle=requestAnimationFrame(this.tick):this.handle=null}}const O=new Nt;function it(o=2.2,t=.25){const e=[],i=o*Math.PI*2;for(let s=0;s<=i;s+=t){const c=s/i;e.push([Math.cos(s)*c,Math.sin(s)*c])}return e}function nt(o){switch(o){case"circle":return"M 50 13 A 37 37 0 1 0 50 87 A 37 37 0 1 0 50 13 Z";case"heart":return"M 50 21.67 C 54.17 17.5 65 12.5 74.17 16.67 C 85 21.67 89.17 35.83 85 48.33 C 80.83 61.67 66.67 74.17 50 74.17 C 33.33 74.17 19.17 61.67 15 48.33 C 10.83 35.83 15 21.67 25.83 16.67 C 35 12.5 45.83 17.5 50 21.67 Z";case"capsule":return"M 26 26 L 74 26 C 88 26 88 74 74 74 L 26 74 C 12 74 12 26 26 26 Z";case"rounded-squircle":return"M 32 18 L 68 18 C 84 18 84 32 84 50 C 84 68 84 82 68 82 L 32 82 C 16 82 16 68 16 50 C 16 32 16 18 32 18 Z";case"pear-blob":return"M 50 14 C 66 14 72 32 80 54 C 86 70 80 86 50 86 C 20 86 14 70 20 54 C 28 32 34 14 50 14 Z";case"egg-oval":return"M 18 54 C 18 26 32 14 50 14 C 68 14 82 26 82 54 C 82 74 70 84 50 84 C 30 84 18 74 18 54 Z";case"starburst-puff":return"M 34 18 C 50 24 50 24 66 18 C 78 18 84 30 80 46 C 84 62 78 82 66 82 C 50 76 50 76 34 82 C 22 82 16 62 20 46 C 16 30 22 18 34 18 Z";case"pill-vertical":return"M 26 28 C 26 12 74 12 74 28 L 74 72 C 74 88 26 88 26 72 Z";case"round-blob":return"M 86.5 53.64 C 86.5 73.98 70.16 77.2 50 77.2 C 29.84 77.2 13.5 73.98 13.5 53.64 C 13.5 33.29 29.84 16.8 50 16.8 C 70.16 16.8 86.5 33.29 86.5 53.64 Z";case"ghost-blob":return"M 50 14.17 C 70 14.17 83.33 29.17 83.33 47.5 L 83.33 70 C 83.33 75 78.33 75.83 75.83 71.67 C 73.33 65.83 67.5 65.83 65 71.67 C 62.5 77.5 56.67 77.5 54.17 71.67 C 51.67 65.83 45.83 65.83 43.33 71.67 C 40.83 77.5 35 77.5 32.5 71.67 C 30 65.83 24.17 65.83 21.67 71.67 C 19.17 75.83 16.67 75 16.67 70 L 16.67 47.5 C 16.67 29.17 30 14.17 50 14.17 Z";case"oval":return"M 45.24 12.83 C 58.45 10.98 74.32 28.1 76.87 46.26 C 79.31 63.59 69.61 78.41 54.76 80.5 C 39.9 82.59 26.49 71.01 24.06 53.68 C 21.51 35.52 32.04 14.69 45.24 12.83 Z";case"elongated-oval":return"M 86.38 54.82 C 87.03 78.56 86.38 75.48 49.94 76.67 C 13.52 77.86 13.5 75.67 13.5 54.82 C 13.5 33.97 29.81 17.07 49.94 17.07 C 70.06 17.07 86.38 33.97 86.38 54.82 Z";case"teardrop-blob":return"M 50 14.17 C 70 14.17 84.17 28.33 84.17 47.5 C 84.17 69.17 69.17 81.67 49.17 81.67 C 30 81.67 15.83 68.33 15.83 47.5 C 15.83 28.33 30 14.17 50 14.17 Z";case"flame-blob":return"M 20 43.33 L 25.83 18.33 L 36.67 35 L 47.5 13.33 L 58.33 33.33 L 70 20 L 75.83 43.33 C 82.5 51.67 80 65.83 70 74.17 C 58.33 83.33 38.33 81.67 27.5 72.5 C 18.33 65 14.17 51.67 20 43.33 Z";case"droopy-blob":return"M 47.83 15.03 C 64.86 12.2 79.26 26.85 79.26 43.84 C 79.26 62.72 77.35 73.65 59.63 78.17 C 41.9 82.69 18.53 73.61 19.16 56.42 C 19.16 33.97 20.59 24.37 35.7 17.57 C 39.66 15.66 43.78 15.72 47.83 15.03 Z M 13.5 49.19 A 6.92 6.92 0 1 0 27.34 49.19 A 6.92 6.92 0 1 0 13.5 49.19 Z M 72.66 49.19 A 6.92 6.92 0 1 0 86.5 49.19 A 6.92 6.92 0 1 0 72.66 49.19 Z";case"bear-blob":return"M 85.2 51.24 C 85.2 71.22 69.15 78.94 49.35 78.94 C 29.55 78.94 13.5 71.22 13.5 51.24 C 13.5 31.26 29.55 15.06 49.35 15.06 C 69.15 15.06 85.2 31.26 85.2 51.24 Z M 86.5 29.08 C 86.5 34.3 81.98 38.53 76.4 38.53 C 70.82 38.53 66.29 34.3 66.29 29.08 C 66.29 23.86 70.82 19.63 76.4 19.63 C 81.98 19.63 86.5 23.86 86.5 29.08 Z M 13.5 29.08 A 10.1 9.45 0 1 0 33.7 29.08 A 10.1 9.45 0 1 0 13.5 29.08 Z";case"spiky-blob":return"M 50 12 C 76 12 88 26 88 48 C 88 64 88 78 84 86 C 78 82 72 92 64 86 C 56 82 50 90 44 86 C 36 92 30 82 12 48 C 12 26 24 12 50 12 Z";case"cloud-blob":return"M 50 12.5 C 60 9.17 69.17 15.83 71.67 21.67 C 79.17 24.17 83.33 32.5 80.83 40 C 85.83 47.5 83.33 57.5 78.33 61.67 C 76.67 70.83 68.33 76.67 60 74.17 C 53.33 80 42.5 80 35.83 74.17 C 27.5 76.67 20 70 18.33 61.67 C 13.33 56.67 11.67 47.5 16.67 40 C 14.17 32.5 20 24.17 27.5 21.67 C 30.83 15 40 9.17 50 12.5 Z";case"wide-oval":return"M 50 20.83 C 73.33 20.83 87.5 31.67 87.5 47.5 C 87.5 64.17 73.33 75.83 50 75.83 C 26.67 75.83 12.5 64.17 12.5 47.5 C 12.5 31.67 26.67 20.83 50 20.83 Z";case"soft-round":return"M 50 15 C 73.33 15 85 26.67 85 48.33 C 85 70 73.33 80 50 80 C 26.67 80 15 70 15 48.33 C 15 26.67 26.67 15 50 15 Z";case"octopus-blob":return"M 50 12.5 C 70 12.5 83.33 27.5 83.33 47.5 L 83.33 65.83 C 83.33 73.33 77.5 75 74.17 69.17 C 71.67 65 66.67 65 64.17 69.17 C 61.67 73.33 56.67 73.33 54.17 69.17 C 51.67 65 46.67 65 44.17 69.17 C 41.67 73.33 36.67 73.33 34.17 69.17 C 31.67 65 26.67 65 24.17 69.17 C 20.83 75 16.67 73.33 16.67 65.83 L 16.67 47.5 C 16.67 27.5 30 12.5 50 12.5 Z";case"wave-blob":return"M 50 13.33 C 63.33 13.33 75 20 76.67 31.67 C 77.5 40 70 43.33 76.67 50 C 82.5 56.67 75 73.33 56.67 76.67 C 50 78.33 43.33 78.33 36.67 75.83 C 21.67 70.83 17.5 58.33 23.33 51.67 C 28.33 45.83 21.67 41.67 23.33 33.33 C 25.83 20.83 36.67 13.33 50 13.33 Z";default:return"M 50 12 C 78 12 90 26 90 52 C 90 78 78 88 50 88 C 22 88 10 78 10 52 C 10 26 22 12 50 12 Z"}}const Jt="M -4 2 C 2 2 5 -2 1 -5 C -3 -8 -10 -6 -10 -1 C -10 5 -2 8 4 4 C 9 1 7 -6 0 -7";function Qt(o,t,e,i,s,c=""){return`<g transform="translate(${o.toFixed(2)}, ${t.toFixed(2)}) scale(${e.toFixed(3)})" ${c}>
|
|
2
|
-
<path d="${
|
|
3
|
-
</g>`}function
|
|
4
|
-
<ellipse cx="${
|
|
5
|
-
<circle cx="${
|
|
6
|
-
</g>`;case 6:return`<g ${
|
|
7
|
-
<line x1="${
|
|
8
|
-
<line x1="${
|
|
9
|
-
</g
|
|
10
|
-
<line x1="${
|
|
11
|
-
<line x1="${
|
|
12
|
-
</g
|
|
13
|
-
<
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
<
|
|
18
|
-
</g>`;case
|
|
19
|
-
<
|
|
20
|
-
<
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
<circle cx="${
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
<
|
|
41
|
-
<circle cx="${r}" cy="${l}" r="${1.3*n}" fill="${h}" />
|
|
42
|
-
</g>`;case 0:default:const P=2.83*X,I=Math.max(.5,P*Math.max(.05,e.eyeOpen));return`<ellipse cx="${r.toFixed(2)}" cy="${l.toFixed(2)}" rx="${P.toFixed(2)}" ry="${I.toFixed(2)}" fill="${h}" />`}};ue=G.isVisible?de(G.projX,W,G.scaleX,!1):"",Me=A.isVisible?de(A.projX,W,A.scaleX,!0):"";let le="";const se=e.tears??0;if(se>.01){const r=Math.min(1,se),l=a*.36%1;let C=0,T=r,X=1;if(l<.25){const b=l/.25;C=b*1.2,X=.75+b*.35,T=r*(.3+b*.7)}else if(l<.82){const b=(l-.25)/.57;C=1.2+b*10.5,X=1.1-b*.2,T=r}else{const b=(l-.82)/.18;C=11.7+b*2.5,X=.9-b*.4,T=r*(1-b)}if(e.cascadeTears)le=`
|
|
43
|
-
<g opacity="${T.toFixed(2)}">
|
|
44
|
-
<path d="M ${G.projX-3} ${W+4} L ${G.projX-6} 88 L ${G.projX+2} 88 Z" fill="#7FA6D9" opacity="0.85" />
|
|
45
|
-
<path d="M ${A.projX-2} ${W+4} L ${A.projX-2} 88 L ${A.projX+6} 88 Z" fill="#7FA6D9" opacity="0.85" />
|
|
1
|
+
(function(y,$){typeof exports=="object"&&typeof module<"u"?$(exports):typeof define=="function"&&define.amd?define(["exports"],$):(y=typeof globalThis<"u"?globalThis:y||self,$(y.Wissive={}))})(this,function(y){"use strict";var Bo=Object.defineProperty;var _o=(y,$,he)=>$ in y?Bo(y,$,{enumerable:!0,configurable:!0,writable:!0,value:he}):y[$]=he;var C=(y,$,he)=>_o(y,typeof $!="symbol"?$+"":$,he);function $(o={}){return{eyeOpen:1,eyeScale:1,eyeType:0,eyeGap:32,eyeY:45,mouthY:63,mouthCurve:0,mouthWidth:.8,mouthOpen:0,mouthType:0,showBrows:0,browY:0,browTilt:0,cheek:0,bob:0,shiftX:0,tears:0,gazeX:0,gazeY:0,turnAngle:0,zzz:0,sweat:0,storm:0,scribble:0,puff:0,...o}}const he={name:"mochi",emotion:"happy",baseColor:"#F2A9B8",silhouette:"heart",motion:{stiffness:220,damping:14,idleSpeed:3.2,idleAmplitude:2.5,idleIntervalMin:6e3,idleIntervalMax:12e3,motionType:"bouncy"},expressions:{idle:[$({eyeType:2,eyeScale:1,eyeGap:28.33,eyeY:43.33,mouthType:0,mouthY:53.33,mouthWidth:.39,mouthCurve:.43,cheek:0}),$({eyeType:2,eyeScale:1,eyeGap:28.33,eyeY:43.33,mouthType:0,mouthY:53.33,mouthWidth:.39,mouthCurve:.43,cheek:0,bob:-1.5}),$({eyeType:2,eyeScale:1,eyeGap:28.33,eyeY:43.33,mouthType:0,mouthY:53.33,mouthWidth:.39,mouthCurve:.43,cheek:0,bob:1}),$({eyeType:2,eyeScale:1,eyeGap:28.33,eyeY:43.33,mouthType:0,mouthY:53.33,mouthWidth:.39,mouthCurve:.43,cheek:0})],near:[$({eyeType:2,eyeScale:1,eyeGap:28.33,eyeY:43.33,mouthType:0,mouthY:53.33,mouthWidth:.39,mouthCurve:.43,cheek:0,bob:-1.5}),$({eyeType:2,eyeScale:1,eyeGap:28.33,eyeY:43.33,mouthType:0,mouthY:53.33,mouthWidth:.39,mouthCurve:.43,cheek:0,bob:-2.5})],hover:[$({eyeType:2,eyeScale:1,eyeGap:28.33,eyeY:43.33,mouthType:0,mouthY:53.33,mouthWidth:.39,mouthCurve:.43,cheek:.3,bob:-4}),$({eyeType:2,eyeScale:1,eyeGap:28.33,eyeY:43.33,mouthType:0,mouthY:53.33,mouthWidth:.39,mouthCurve:.43,cheek:.3,bob:-4.5})],click:[$({eyeType:2,eyeScale:1,eyeGap:28.33,eyeY:43.33,mouthType:0,mouthY:53.33,mouthWidth:.39,mouthCurve:.43,cheek:.5,bob:-7}),$({eyeType:2,eyeScale:1,eyeGap:28.33,eyeY:43.33,mouthType:0,mouthY:53.33,mouthWidth:.39,mouthCurve:.43,cheek:.5,bob:-6})]}},lt={name:"zumi",emotion:"flutter",baseColor:"#F2CB4E",silhouette:"round-blob",motion:{stiffness:300,damping:10,idleSpeed:4.5,idleAmplitude:3.8,idleIntervalMin:4e3,idleIntervalMax:9e3,motionType:"flutter"},expressions:{idle:[$({eyeType:2,eyeScale:1,eyeGap:30,eyeY:43.33,mouthType:3,mouthY:45.83,mouthWidth:.27,mouthCurve:0,cheek:.3}),$({eyeType:2,eyeScale:1,eyeGap:30,eyeY:43.33,mouthType:3,mouthY:45.83,mouthWidth:.27,mouthCurve:0,cheek:.4,bob:-1.5}),$({eyeType:2,eyeScale:1,eyeGap:30,eyeY:43.33,mouthType:3,mouthY:45.83,mouthWidth:.27,mouthCurve:0,cheek:.35,bob:1})],near:[$({eyeType:2,eyeScale:1,eyeGap:30,eyeY:43.33,mouthType:3,mouthY:45.83,mouthWidth:.27,mouthCurve:0,cheek:.5,bob:-2})],hover:[$({eyeType:2,eyeScale:1,eyeGap:30,eyeY:43.33,mouthType:3,mouthY:45.83,mouthWidth:.27,mouthCurve:0,cheek:.7,bob:-4})],click:[$({eyeType:2,eyeScale:1,eyeGap:30,eyeY:43.33,mouthType:3,mouthY:45.83,mouthWidth:.27,mouthCurve:0,cheek:.9,bob:-6})]}},ct={name:"suri",emotion:"pleasure",baseColor:"#F28FC2",silhouette:"elongated-oval",motion:{stiffness:140,damping:18,idleSpeed:1.8,idleAmplitude:1.8,idleIntervalMin:7e3,idleIntervalMax:14e3,motionType:"serene"},expressions:{idle:[$({eyeType:1,eyeScale:1,eyeGap:26.67,eyeY:45,mouthType:0,mouthY:53.33,mouthWidth:.36,mouthCurve:.48,cheek:.4}),$({eyeType:1,eyeScale:1,eyeGap:26.67,eyeY:45,mouthType:0,mouthY:53.33,mouthWidth:.36,mouthCurve:.48,cheek:.5,bob:1})],near:[$({eyeType:1,eyeScale:1,eyeGap:26.67,eyeY:45,mouthType:0,mouthY:53.33,mouthWidth:.36,mouthCurve:.48,cheek:.6,bob:2})],hover:[$({eyeType:1,eyeScale:1,eyeGap:26.67,eyeY:45,mouthType:0,mouthY:53.33,mouthWidth:.36,mouthCurve:.48,cheek:.75,bob:3.5})],click:[$({eyeType:1,eyeScale:1,eyeGap:26.67,eyeY:45,mouthType:0,mouthY:53.33,mouthWidth:.36,mouthCurve:.48,cheek:.9,bob:5})]}},ht={name:"nima",emotion:"peaceful",baseColor:"#9AC9A0",silhouette:"ghost-blob",motion:{stiffness:110,damping:22,idleSpeed:1.2,idleAmplitude:2,idleIntervalMin:8e3,idleIntervalMax:15e3,motionType:"float"},expressions:{idle:[$({eyeType:14,eyeScale:1,eyeGap:25,eyeY:43.33,mouthType:14,mouthY:51.67,mouthWidth:0,mouthCurve:0}),$({eyeType:14,eyeScale:1,eyeGap:25,eyeY:43.33,mouthType:14,mouthY:51.67,mouthWidth:0,mouthCurve:0,bob:1.5})],near:[$({eyeType:14,eyeScale:1,eyeGap:25,eyeY:43.33,mouthType:14,mouthY:51.67,mouthWidth:0,mouthCurve:0,bob:2})],hover:[$({eyeType:14,eyeScale:1,eyeGap:25,eyeY:43.33,mouthType:14,mouthY:51.67,mouthWidth:0,mouthCurve:0,cheek:.3,bob:3})],click:[$({eyeType:14,eyeScale:1,eyeGap:25,eyeY:43.33,mouthType:14,mouthY:51.67,mouthWidth:0,mouthCurve:0,cheek:.5,bob:4.5})]}},ve={name:"cota",emotion:"normal",baseColor:"#C9DCD3",silhouette:"oval",motion:{stiffness:160,damping:18,idleSpeed:1.5,idleAmplitude:1.2,idleIntervalMin:8e3,idleIntervalMax:16e3,motionType:"calm"},expressions:{idle:[$({eyeType:0,eyeScale:1,eyeGap:23.33,eyeY:45.83,mouthType:3,mouthY:56.67,mouthWidth:.33,mouthCurve:0}),$({eyeType:0,eyeScale:1,eyeGap:23.33,eyeY:45.83,mouthType:3,mouthY:56.67,mouthWidth:.33,mouthCurve:0,bob:-.8})],near:[$({eyeType:0,eyeScale:1,eyeGap:23.33,eyeY:45.83,mouthType:3,mouthY:56.67,mouthWidth:.33,mouthCurve:0,bob:1.2})],hover:[$({eyeType:0,eyeScale:1,eyeGap:23.33,eyeY:45.83,mouthType:3,mouthY:56.67,mouthWidth:.33,mouthCurve:0,cheek:.2,bob:2.5})],click:[$({eyeType:0,eyeScale:1,eyeGap:23.33,eyeY:45.83,mouthType:3,mouthY:56.67,mouthWidth:.33,mouthCurve:0,cheek:.4,bob:4})]}},ut={name:"dozy",emotion:"tired",baseColor:"#D6DBCF",silhouette:"wide-oval",motion:{stiffness:90,damping:24,idleSpeed:.9,idleAmplitude:2.8,idleIntervalMin:6e3,idleIntervalMax:12e3,motionType:"droop"},expressions:{idle:[$({eyeType:15,eyeScale:.85,eyeGap:26.67,eyeY:45.83,mouthType:3,mouthY:56.67,mouthWidth:.24,mouthCurve:0,sweat:1,puff:.7,bob:1.5}),$({eyeType:15,eyeScale:.85,eyeGap:26.67,eyeY:45.83,mouthType:3,mouthY:56.67,mouthWidth:.24,mouthCurve:0,sweat:1,puff:.7,bob:2.5})],near:[$({eyeType:15,eyeScale:.85,eyeGap:26.67,eyeY:45.83,mouthType:3,mouthY:56.67,mouthWidth:.24,mouthCurve:0,sweat:1,puff:.7,bob:3.5})],hover:[$({eyeType:15,eyeScale:.85,eyeGap:26.67,eyeY:45.83,mouthType:3,mouthY:56.67,mouthWidth:.24,mouthCurve:0,sweat:1,puff:.85,bob:4.5})],click:[$({eyeType:15,eyeScale:.85,eyeGap:26.67,eyeY:45.83,mouthType:3,mouthY:56.67,mouthWidth:.24,mouthCurve:0,sweat:1,puff:1,bob:6.5})]}},dt={name:"lumo",emotion:"sad",baseColor:"#7FA6D9",silhouette:"teardrop-blob",motion:{stiffness:100,damping:20,idleSpeed:1.1,idleAmplitude:2.2,idleIntervalMin:7e3,idleIntervalMax:13e3,motionType:"sob"},expressions:{idle:[$({eyeType:16,eyeScale:1,eyeGap:25,eyeY:43.33,mouthType:3,mouthY:55,mouthWidth:.3,mouthCurve:0,tears:1,bob:1.8}),$({eyeType:16,eyeScale:1,eyeGap:25,eyeY:43.33,mouthType:3,mouthY:55,mouthWidth:.3,mouthCurve:0,tears:1,bob:2.8})],near:[$({eyeType:16,eyeScale:1,eyeGap:25,eyeY:43.33,mouthType:3,mouthY:55,mouthWidth:.3,mouthCurve:0,tears:1,bob:3.5})],hover:[$({eyeType:16,eyeScale:1,eyeGap:25,eyeY:43.33,mouthType:3,mouthY:55,mouthWidth:.3,mouthCurve:0,tears:1,bob:4.8})],click:[$({eyeType:16,eyeScale:1,eyeGap:25,eyeY:43.33,mouthType:3,mouthY:55,mouthWidth:.3,mouthCurve:0,tears:1,bob:6})]}},mt={name:"fidge",emotion:"anxiety",baseColor:"#A99BD9",silhouette:"cloud-blob",motion:{stiffness:350,damping:8,idleSpeed:5.5,idleAmplitude:1.5,idleIntervalMin:3e3,idleIntervalMax:7e3,motionType:"jitter"},expressions:{idle:[$({eyeType:5,eyeScale:1,eyeGap:25,eyeY:43.33,mouthType:13,mouthY:56.67,mouthWidth:.08,mouthCurve:0}),$({eyeType:5,eyeScale:1,eyeGap:25,eyeY:43.33,mouthType:13,mouthY:56.67,mouthWidth:.08,mouthCurve:0,shiftX:1.5})],near:[$({eyeType:5,eyeScale:1,eyeGap:25,eyeY:43.33,mouthType:13,mouthY:56.67,mouthWidth:.08,mouthCurve:0,shiftX:2.5})],hover:[$({eyeType:5,eyeScale:1,eyeGap:25,eyeY:43.33,mouthType:13,mouthY:56.67,mouthWidth:.08,mouthCurve:0,shiftX:4})],click:[$({eyeType:5,eyeScale:1,eyeGap:25,eyeY:43.33,mouthType:13,mouthY:56.67,mouthWidth:.08,mouthCurve:0,shiftX:6})]}},yt={name:"brix",emotion:"anger",baseColor:"#D9566A",silhouette:"flame-blob",motion:{stiffness:280,damping:12,idleSpeed:3.8,idleAmplitude:2,idleIntervalMin:4e3,idleIntervalMax:8e3,motionType:"fiery"},expressions:{idle:[$({eyeType:17,eyeScale:1,eyeGap:28.33,eyeY:46.67,mouthType:0,mouthY:61.67,mouthWidth:.33,mouthCurve:-.48}),$({eyeType:17,eyeScale:1,eyeGap:28.33,eyeY:46.67,mouthType:0,mouthY:61.67,mouthWidth:.33,mouthCurve:-.48})],near:[$({eyeType:17,eyeScale:1,eyeGap:28.33,eyeY:46.67,mouthType:0,mouthY:61.67,mouthWidth:.33,mouthCurve:-.48})],hover:[$({eyeType:17,eyeScale:1,eyeGap:28.33,eyeY:46.67,mouthType:0,mouthY:61.67,mouthWidth:.33,mouthCurve:-.48})],click:[$({eyeType:17,eyeScale:1,eyeGap:28.33,eyeY:46.67,mouthType:0,mouthY:61.67,mouthWidth:.33,mouthCurve:-.48})]}},ft={name:"wilt",emotion:"disappointed",baseColor:"#EBD98A",silhouette:"droopy-blob",motion:{stiffness:100,damping:22,idleSpeed:1,idleAmplitude:2,idleIntervalMin:7e3,idleIntervalMax:14e3,motionType:"wilt"},expressions:{idle:[$({eyeType:15,eyeScale:1.15,eyeGap:25,eyeY:43.33,mouthType:0,mouthY:63.33,mouthWidth:.45,mouthCurve:-.54,bob:1.5}),$({eyeType:15,eyeScale:1.15,eyeGap:25,eyeY:43.33,mouthType:0,mouthY:63.33,mouthWidth:.45,mouthCurve:-.54,bob:2.5})],near:[$({eyeType:15,eyeScale:1.15,eyeGap:25,eyeY:43.33,mouthType:0,mouthY:63.33,mouthWidth:.45,mouthCurve:-.54,bob:3.5})],hover:[$({eyeType:15,eyeScale:1.15,eyeGap:25,eyeY:43.33,mouthType:0,mouthY:63.33,mouthWidth:.45,mouthCurve:-.54,bob:4.5})],click:[$({eyeType:15,eyeScale:1.15,eyeGap:25,eyeY:43.33,mouthType:0,mouthY:63.33,mouthWidth:.45,mouthCurve:-.54,bob:6})]}},pt={name:"knot",emotion:"stress",baseColor:"#C97F76",silhouette:"bear-blob",motion:{stiffness:320,damping:9,idleSpeed:4.8,idleAmplitude:2.2,idleIntervalMin:3500,idleIntervalMax:7500,motionType:"dizzy"},expressions:{idle:[$({eyeType:18,eyeScale:1,eyeGap:26.67,eyeY:45,mouthType:3,mouthY:58.33,mouthWidth:.42,mouthCurve:0,storm:1,scribble:1}),$({eyeType:18,eyeScale:1,eyeGap:26.67,eyeY:45,mouthType:3,mouthY:58.33,mouthWidth:.42,mouthCurve:0,storm:1,scribble:1,shiftX:1.5})],near:[$({eyeType:18,eyeScale:1,eyeGap:26.67,eyeY:45,mouthType:3,mouthY:58.33,mouthWidth:.42,mouthCurve:0,storm:1,scribble:1,shiftX:3})],hover:[$({eyeType:18,eyeScale:1,eyeGap:26.67,eyeY:45,mouthType:3,mouthY:58.33,mouthWidth:.42,mouthCurve:0,storm:1,scribble:1,shiftX:4.5})],click:[$({eyeType:18,eyeScale:1,eyeGap:26.67,eyeY:45,mouthType:3,mouthY:58.33,mouthWidth:.42,mouthCurve:0,storm:1,scribble:1,shiftX:6.5})]}},$t={name:"snug",emotion:"sleepy",baseColor:"#AFCBE0",silhouette:"soft-round",motion:{stiffness:85,damping:25,idleSpeed:.7,idleAmplitude:2.2,idleIntervalMin:6e3,idleIntervalMax:12e3,motionType:"snooze"},expressions:{idle:[$({eyeType:19,eyeScale:1,eyeGap:26.67,eyeY:45,mouthType:3,mouthY:56.67,mouthWidth:.27,mouthCurve:0,zzz:1,bob:.5}),$({eyeType:19,eyeScale:1,eyeGap:26.67,eyeY:45,mouthType:3,mouthY:56.67,mouthWidth:.27,mouthCurve:0,zzz:1,bob:1.5})],near:[$({eyeType:19,eyeScale:1,eyeGap:26.67,eyeY:45,mouthType:3,mouthY:56.67,mouthWidth:.27,mouthCurve:0,zzz:1,bob:2.5})],hover:[$({eyeType:19,eyeScale:1,eyeGap:26.67,eyeY:45,mouthType:3,mouthY:56.67,mouthWidth:.27,mouthCurve:0,zzz:1,bob:3.8})],click:[$({eyeType:19,eyeScale:1,eyeGap:26.67,eyeY:45,mouthType:3,mouthY:56.67,mouthWidth:.27,mouthCurve:0,zzz:1,bob:5.5})]}},bt={name:"pip",emotion:"surprised",baseColor:"#F0B98A",silhouette:"octopus-blob",motion:{stiffness:250,damping:12,idleSpeed:2.8,idleAmplitude:3,idleIntervalMin:5e3,idleIntervalMax:1e4,motionType:"pop"},expressions:{idle:[$({eyeType:20,eyeScale:.8,eyeGap:21.67,eyeY:43.33,mouthType:1,mouthY:55,mouthWidth:.21,mouthCurve:0}),$({eyeType:20,eyeScale:.8,eyeGap:21.67,eyeY:43.33,mouthType:1,mouthY:55,mouthWidth:.21,mouthCurve:0,bob:-2})],near:[$({eyeType:20,eyeScale:.8,eyeGap:21.67,eyeY:43.33,mouthType:1,mouthY:55,mouthWidth:.21,mouthCurve:0,bob:-3})],hover:[$({eyeType:20,eyeScale:.8,eyeGap:21.67,eyeY:43.33,mouthType:1,mouthY:55,mouthWidth:.21,mouthCurve:0,bob:-5})],click:[$({eyeType:20,eyeScale:.8,eyeGap:21.67,eyeY:43.33,mouthType:1,mouthY:55,mouthWidth:.21,mouthCurve:0,bob:-8})]}},gt={name:"void",emotion:"numbness",baseColor:"#D9C6E0",silhouette:"wave-blob",motion:{stiffness:100,damping:24,idleSpeed:.8,idleAmplitude:1.5,idleIntervalMin:9e3,idleIntervalMax:18e3,motionType:"drift"},expressions:{idle:[$({eyeType:20,eyeScale:.75,eyeGap:23.33,eyeY:44.17,mouthType:3,mouthY:56.67,mouthWidth:.33,mouthCurve:0}),$({eyeType:20,eyeScale:.75,eyeGap:23.33,eyeY:44.17,mouthType:3,mouthY:56.67,mouthWidth:.33,mouthCurve:0,bob:1})],near:[$({eyeType:20,eyeScale:.75,eyeGap:23.33,eyeY:44.17,mouthType:3,mouthY:56.67,mouthWidth:.33,mouthCurve:0,bob:2})],hover:[$({eyeType:20,eyeScale:.75,eyeGap:23.33,eyeY:44.17,mouthType:3,mouthY:56.67,mouthWidth:.33,mouthCurve:0,bob:3})],click:[$({eyeType:20,eyeScale:.75,eyeGap:23.33,eyeY:44.17,mouthType:3,mouthY:56.67,mouthWidth:.33,mouthCurve:0,bob:4.5})]}},te={mochi:he,zumi:lt,suri:ct,nima:ht,cota:ve,dozy:ut,lumo:dt,fidge:mt,brix:yt,wilt:ft,knot:pt,snug:$t,pip:bt,void:gt};function _e(o){const t=o.toLowerCase();return te[t]?te[t]:Object.values(te).find(i=>i.emotion===t)||he}const Re={smooth:{stiffness:170,damping:18,mass:1},bouncy:{stiffness:280,damping:8,mass:.8},snappy:{stiffness:420,damping:30,mass:.6},gentle:{stiffness:55,damping:14,mass:1.4},instant:{stiffness:99999,damping:9999,mass:.001}};function Mt(o,t={}){let{stiffness:e=170,damping:i=18,mass:a=1}=t;const r={current:o,target:o,velocity:0};return{state:r,setConfig(s){s.stiffness!==void 0&&(e=s.stiffness),s.damping!==void 0&&(i=s.damping),s.mass!==void 0&&(a=s.mass)},setTarget(s){r.target=s},setCurrent(s){r.current=s,r.target=s,r.velocity=0},update(s){const b=s/4;let f=!1;for(let u=0;u<4;u++){const F=r.current-r.target,v=-e*F,w=-i*r.velocity,A=(v+w)/a;r.velocity+=A*b,r.current+=r.velocity*b,(Math.abs(r.velocity)>1e-4||Math.abs(r.current-r.target)>1e-4)&&(f=!0)}return f||(r.current=r.target,r.velocity=0),f}}}const $o=new Set(["eyeType","mouthType","cascadeTears","showBrows"]);function Ft(o,t){const e=Object.keys(o),i={};let a=null;for(const r of e)i[r]=Mt(o[r],t);return{getValues(){const r={};for(const s of e)r[s]=i[s].state.current;return r},setConfig(r){if(typeof r=="string"){a=r;const s=Re[r]||Re.smooth;for(const c of e)i[c].setConfig(s)}else{a=null;for(const s of e)i[s].setConfig(r)}},setTargets(r){const s=a==="instant";for(const c in r)c in i&&(s||$o.has(c)?i[c].setCurrent(r[c]):i[c].setTarget(r[c]))},setValues(r){for(const s in r)s in i&&i[s].setCurrent(r[s])},update(r){let s=!1;for(const c of e)i[c].update(r)&&(s=!0);return s}}}function bo(o,t){const e={...o};switch(t){case"sleeping":e.eyeOpen=.05,e.eyeType=2,e.mouthCurve=.2,e.browY=3,e.browTilt=-.1,e.cheek=.2,e.zzz=1;break;case"drowsy":case"powering-down":e.eyeOpen=.35,e.mouthCurve=0,e.browY=4,e.browTilt=.1,e.zzz=.55,e.sweat=.8,e.puff=.7;break;case"bored":e.eyeOpen=.45,e.mouthCurve=-.2,e.browY=2,e.gazeX=6,e.puff=.4;break;case"waking":case"spawning":e.eyeOpen=.75,e.eyeScale=1.1,e.mouthCurve=.4,e.browY=-2;break;case"angry":e.eyeType=3,e.browTilt=-.75,e.mouthCurve=-.65,e.mouthOpen=.2,e.eyeScale=1.15,e.storm=1;break;case"alerting":case"notifying":e.eyeScale=1.3,e.browTilt=-.4,e.mouthOpen=.45,e.mouthCurve=.1;break;case"suspicious":e.browTilt=-.5,e.eyeScale=.9,e.mouthCurve=-.3,e.gazeX=-8;break;case"excited":case"celebrate":e.eyeScale=1.35,e.mouthCurve=.9,e.mouthOpen=.55,e.cheek=.85,e.browY=-4;break;case"happy":case"playful":e.eyeScale=1.15,e.mouthCurve=.75,e.cheek=.6,e.browY=-2;break;case"laughing":e.eyeType=2,e.mouthCurve=.95,e.mouthOpen=.7,e.cheek=.9,e.bob=-3;break;case"proud":e.eyeScale=1.1,e.mouthCurve=.65,e.browY=-3,e.bob=-4;break;case"thinking":case"searching":e.browTilt=.5,e.eyeScale=1.1,e.mouthWidth=.6,e.mouthCurve=.1,e.shiftX=-4;break;case"dictating":case"listening":case"writing":case"humming":e.mouthOpen=.45,e.mouthCurve=.4,e.eyeScale=1.08,e.cheek=.4;break;case"loading":case"orbit":case"radar":case"progress":e.eyeScale=1.15,e.mouthCurve=.3,e.browY=-2;break;case"surprised":e.eyeScale=1.45,e.mouthOpen=.75,e.mouthCurve=0,e.browY=-7;break;case"scared":e.eyeScale=1.4,e.mouthOpen=.8,e.mouthCurve=-.55,e.browTilt=.5;break;case"confused":e.browTilt=.65,e.mouthCurve=-.3,e.shiftX=-5,e.scribble=1;break;case"curious":e.browTilt=-.3,e.eyeScale=1.2,e.mouthCurve=.45,e.shiftX=3;break;case"shy":e.eyeScale=.85,e.gazeY=6,e.cheek=.95,e.mouthCurve=.35;break;case"sad":e.browTilt=.6,e.mouthCurve=-.65,e.tears=.8,e.browY=2;break}return e}class je{constructor(t="idle"){C(this,"currentState");C(this,"lastIndices",{});this.currentState=t}getState(){return this.currentState}setState(t){const e=this.currentState!==t;return this.currentState=t,e}resolvePool(t,e=this.currentState){let i=[];if(t[e]&&t[e].length>0)i=t[e];else switch(e){case"happy":case"excited":case"playful":case"celebrate":case"laughing":case"proud":i=t.hover||t.idle;break;case"surprised":case"scared":case"alerting":case"notifying":case"bouncing":i=t.click||t.hover||t.idle;break;case"suspicious":case"angry":i=t.click||t.idle;break;case"curious":case"thinking":case"searching":case"listening":case"working":case"confused":case"shy":case"sad":case"dictating":case"writing":case"sending":case"receiving":case"uploading":case"dragging":case"humming":case"loading":case"orbit":case"radar":case"progress":i=t.near||t.hover||t.idle;break;default:i=t[e]||t.idle;break}return i.map(a=>bo(a,e))}pickVariant(t,e=this.currentState){if(!t||t.length===0)throw new Error(`Empty variant pool for state "${e}"`);if(t.length===1)return this.lastIndices[e]=0,t[0];const i=this.lastIndices[e]??-1;let a=Math.floor(Math.random()*t.length);for(;a===i;)a=Math.floor(Math.random()*t.length);return this.lastIndices[e]=a,t[a]}}function go(o="idle"){return new je(o)}class Mo{constructor(){C(this,"callbacks",new Set);C(this,"handle",null);C(this,"lastTime",0)}add(t){this.callbacks.add(t),this.handle||(this.lastTime=performance.now(),this.tick=this.tick.bind(this),this.handle=requestAnimationFrame(this.tick))}remove(t){this.callbacks.delete(t),this.callbacks.size===0&&this.handle!==null&&(cancelAnimationFrame(this.handle),this.handle=null)}get size(){return this.callbacks.size}tick(t){const e=Math.min((t-this.lastTime)/1e3,.1);this.lastTime=t,this.callbacks.forEach(i=>i(e)),this.callbacks.size>0?this.handle=requestAnimationFrame(this.tick):this.handle=null}}const G=new Mo;function vt(o=2.2,t=.25){const e=[],i=o*Math.PI*2;for(let a=0;a<=i;a+=t){const r=a/i;e.push([Math.cos(a)*r,Math.sin(a)*r])}return e}const oe=64,Ze=Math.PI*2,W=Array.from({length:oe},(o,t)=>t/oe*Ze),ae=W.map(Math.cos),ue=W.map(Math.sin),re=o=>Math.round(o*100)/100,Fo=(o,t=0,e=1)=>o<t?t:o>e?e:o,kt=(o,t,e)=>o+(t-o)*e;function xt(o,t=1,e=1){return W.map((i,a)=>{const r=Math.abs((ae[a]??0)/t)**o,s=Math.abs((ue[a]??0)/e)**o;return(r+s)**(-1/o)})}function X(o,t=1){const e=Math.max(...o);if(e<=0)return o;const i=t/e;return o.map(a=>a*i)}function ke(o,t=0,e=0){const i=new Array(oe).fill(1),a=o.length;for(let r=0;r<oe;r++){const s=ae[r]??0,c=ue[r]??0;let b=0;for(let f=0;f<a;f++){const u=o[f],F=o[(f+1)%a],v=F.x-u.x,w=F.y-u.y,A=s*w-c*v;if(Math.abs(A)<1e-9)continue;const j=u.x-t,z=u.y-e,Z=(j*w-z*v)/A,B=(j*c-z*s)/A;Z>b&&B>=0&&B<=1&&(b=Z)}i[r]=b||1}return i}function Ee(o,t,e,i,a,r,s=96){const c=i-o,b=a-t,f=Math.hypot(c,b)||1e-6,u=Math.atan2(b,c),F=Math.acos(Math.max(-1,Math.min(1,(e-r)/f))),v=[];for(let w=0;w<=s/2;w++){const A=u+F+(Ze-2*F)*w/(s/2);v.push({x:o+Math.cos(A)*e,y:t+Math.sin(A)*e})}for(let w=0;w<=s/2;w++){const A=u-F+2*F*w/(s/2);v.push({x:i+Math.cos(A)*r,y:a+Math.sin(A)*r})}return v}function vo(o,t,e,i,a){const r=1-a,s=r*r,c=a*a;return{x:s*r*o.x+3*s*a*t.x+3*r*c*e.x+c*a*i.x,y:s*r*o.y+3*s*a*t.y+3*r*c*e.y+c*a*i.y}}function ko(){const o=[[{x:50,y:21.67},{x:54.17,y:17.5},{x:65,y:12.5},{x:74.17,y:16.67}],[{x:74.17,y:16.67},{x:85,y:21.67},{x:89.17,y:35.83},{x:85,y:48.33}],[{x:85,y:48.33},{x:80.83,y:61.67},{x:66.67,y:74.17},{x:50,y:74.17}],[{x:50,y:74.17},{x:33.33,y:74.17},{x:19.17,y:61.67},{x:15,y:48.33}],[{x:15,y:48.33},{x:10.83,y:35.83},{x:15,y:21.67},{x:25.83,y:16.67}],[{x:25.83,y:16.67},{x:35,y:12.5},{x:45.83,y:17.5},{x:50,y:21.67}]],t=[],e=50,i=46,a=20;for(const r of o)for(let s=0;s<a;s++){const c=vo(r[0],r[1],r[2],r[3],s/a);t.push({x:(c.x-e)/36,y:(c.y-i)/36})}return X(ke(t,0,0),1.05)}const Ne={circle:new Array(oe).fill(1),heart:ko(),"round-blob":X(W.map(o=>1+.075*Math.cos(2*o+.5)+.035*Math.cos(3*o+2.1)),1.02),capsule:X(ke(Ee(-.45,0,.62,.45,0,.62),0,0),1.08),"rounded-squircle":X(xt(4.2),1.12),"pear-blob":X(W.map(o=>1+.22*Math.sin(o)+.08*Math.cos(2*o)),1.06),"egg-oval":X(W.map((o,t)=>{const e=(ae[t]??0)/.86,i=((ue[t]??0)+.12*(1-Math.abs(ae[t]??0)))/1.16;return Math.sqrt(e*e+i*i)**-1}),1.08),"starburst-puff":X(W.map(o=>1+.16*Math.cos(4*o)),1.08),"pill-vertical":X(ke(Ee(0,-.42,.6,0,.42,.6),0,0),1.08),"ghost-blob":X(W.map(o=>{const t=Math.sin(o),e=t>.2?.12*Math.sin(o*6):0;return 1+(t<0?.08:.02)+e}),1.06),oval:X(W.map((o,t)=>{const e=(ae[t]??0)/1.15,i=(ue[t]??0)/.9;return Math.sqrt(e*e+i*i)**-1}),1.05),"elongated-oval":X(W.map((o,t)=>{const e=(ae[t]??0)/1.25,i=(ue[t]??0)/.82;return Math.sqrt(e*e+i*i)**-1}),1.08),"teardrop-blob":X(ke(Ee(0,.26,.66,0,-.92,.06),0,0),1.08),"flame-blob":X(W.map(o=>1+(Math.sin(o)<0?.24*Math.abs(Math.sin(o*2.5)):-.04*Math.cos(o*2))),1.08),"droopy-blob":X(W.map(o=>{const t=Math.sin(o);return 1+.18*Math.max(0,t)-.08*Math.max(0,-t)}),1.05),"spiky-blob":X(W.map(o=>1+.18*Math.sin(8*o)),1.06),"cloud-blob":X(W.map(o=>1+.14*Math.sin(5*o+.4)),1.06),"wide-oval":X(W.map((o,t)=>{const e=(ae[t]??0)/1.28,i=(ue[t]??0)/.78;return Math.sqrt(e*e+i*i)**-1}),1.08),"soft-round":X(W.map(o=>1+.04*Math.cos(4*o)),1.02),"octopus-blob":X(W.map(o=>1+(Math.sin(o)>.3?.15*Math.sin(o*7):0)),1.06),"wave-blob":X(W.map(o=>1+.12*Math.sin(3*o+.8)),1.04),"bear-blob":X(W.map(o=>{const t=Math.exp(-Math.pow(Math.atan2(Math.sin(o- -Math.PI*.25),Math.cos(o- -Math.PI*.25)),2)/.12)*.35,e=Math.exp(-Math.pow(Math.atan2(Math.sin(o- -Math.PI*.75),Math.cos(o- -Math.PI*.75)),2)/.12)*.35;return 1+t+e}),1.12)};function Ue(o){return xo.get(o)||Ne.circle}const xo=new Map(Object.entries(Ne));function Ct(o,t,e){const i=new Array(oe);for(let a=0;a<oe;a++)i[a]=kt(o[a]??1,t[a]??1,e);return i}function St(o,t=50,e=50,i=37,a=1,r=1){const s=new Array(oe);for(let c=0;c<oe;c++){const b=(o[c]??1)*i,f=t+(ae[c]??0)*b*a,u=e+(ue[c]??0)*b*r;s[c]={x:f,y:u}}return s}function Tt(o,t=1/6){const e=o.length;if(e<3)return"";const i=o[0];let a=`M ${re(i.x)} ${re(i.y)}`;for(let r=0;r<e;r++){const s=o[(r-1+e)%e],c=o[r],b=o[(r+1)%e],f=o[(r+2)%e],u=c.x+(b.x-s.x)*t,F=c.y+(b.y-s.y)*t,v=b.x-(f.x-c.x)*t,w=b.y-(f.y-c.y)*t;a+=` C ${re(u)} ${re(F)} ${re(v)} ${re(w)} ${re(b.x)} ${re(b.y)}`}return`${a} Z`}function wt(o,t=50,e=50,i=37){const a=St(o,t,e,i);return Tt(a)}function Yt(o){switch(o){case"circle":return"M 50 13 A 37 37 0 1 0 50 87 A 37 37 0 1 0 50 13 Z";case"heart":return"M 50 21.67 C 54.17 17.5 65 12.5 74.17 16.67 C 85 21.67 89.17 35.83 85 48.33 C 80.83 61.67 66.67 74.17 50 74.17 C 33.33 74.17 19.17 61.67 15 48.33 C 10.83 35.83 15 21.67 25.83 16.67 C 35 12.5 45.83 17.5 50 21.67 Z";case"capsule":return"M 26 26 L 74 26 C 88 26 88 74 74 74 L 26 74 C 12 74 12 26 26 26 Z";case"rounded-squircle":return"M 32 18 L 68 18 C 84 18 84 32 84 50 C 84 68 84 82 68 82 L 32 82 C 16 82 16 68 16 50 C 16 32 16 18 32 18 Z";case"pear-blob":return"M 50 14 C 66 14 72 32 80 54 C 86 70 80 86 50 86 C 20 86 14 70 20 54 C 28 32 34 14 50 14 Z";case"egg-oval":return"M 18 54 C 18 26 32 14 50 14 C 68 14 82 26 82 54 C 82 74 70 84 50 84 C 30 84 18 74 18 54 Z";case"starburst-puff":return"M 34 18 C 50 24 50 24 66 18 C 78 18 84 30 80 46 C 84 62 78 82 66 82 C 50 76 50 76 34 82 C 22 82 16 62 20 46 C 16 30 22 18 34 18 Z";case"pill-vertical":return"M 26 28 C 26 12 74 12 74 28 L 74 72 C 74 88 26 88 26 72 Z";case"round-blob":return"M 86.5 53.64 C 86.5 73.98 70.16 77.2 50 77.2 C 29.84 77.2 13.5 73.98 13.5 53.64 C 13.5 33.29 29.84 16.8 50 16.8 C 70.16 16.8 86.5 33.29 86.5 53.64 Z";case"ghost-blob":return"M 50 14.17 C 70 14.17 83.33 29.17 83.33 47.5 L 83.33 70 C 83.33 75 78.33 75.83 75.83 71.67 C 73.33 65.83 67.5 65.83 65 71.67 C 62.5 77.5 56.67 77.5 54.17 71.67 C 51.67 65.83 45.83 65.83 43.33 71.67 C 40.83 77.5 35 77.5 32.5 71.67 C 30 65.83 24.17 65.83 21.67 71.67 C 19.17 75.83 16.67 75 16.67 70 L 16.67 47.5 C 16.67 29.17 30 14.17 50 14.17 Z";case"oval":return"M 45.24 12.83 C 58.45 10.98 74.32 28.1 76.87 46.26 C 79.31 63.59 69.61 78.41 54.76 80.5 C 39.9 82.59 26.49 71.01 24.06 53.68 C 21.51 35.52 32.04 14.69 45.24 12.83 Z";case"elongated-oval":return"M 86.38 54.82 C 87.03 78.56 86.38 75.48 49.94 76.67 C 13.52 77.86 13.5 75.67 13.5 54.82 C 13.5 33.97 29.81 17.07 49.94 17.07 C 70.06 17.07 86.38 33.97 86.38 54.82 Z";case"teardrop-blob":return"M 50 14.17 C 70 14.17 84.17 28.33 84.17 47.5 C 84.17 69.17 69.17 81.67 49.17 81.67 C 30 81.67 15.83 68.33 15.83 47.5 C 15.83 28.33 30 14.17 50 14.17 Z";case"flame-blob":return"M 20 43.33 L 25.83 18.33 L 36.67 35 L 47.5 13.33 L 58.33 33.33 L 70 20 L 75.83 43.33 C 82.5 51.67 80 65.83 70 74.17 C 58.33 83.33 38.33 81.67 27.5 72.5 C 18.33 65 14.17 51.67 20 43.33 Z";case"droopy-blob":return"M 47.83 15.03 C 64.86 12.2 79.26 26.85 79.26 43.84 C 79.26 62.72 77.35 73.65 59.63 78.17 C 41.9 82.69 18.53 73.61 19.16 56.42 C 19.16 33.97 20.59 24.37 35.7 17.57 C 39.66 15.66 43.78 15.72 47.83 15.03 Z M 13.5 49.19 A 6.92 6.92 0 1 0 27.34 49.19 A 6.92 6.92 0 1 0 13.5 49.19 Z M 72.66 49.19 A 6.92 6.92 0 1 0 86.5 49.19 A 6.92 6.92 0 1 0 72.66 49.19 Z";case"bear-blob":return"M 85.2 51.24 C 85.2 71.22 69.15 78.94 49.35 78.94 C 29.55 78.94 13.5 71.22 13.5 51.24 C 13.5 31.26 29.55 15.06 49.35 15.06 C 69.15 15.06 85.2 31.26 85.2 51.24 Z M 86.5 29.08 C 86.5 34.3 81.98 38.53 76.4 38.53 C 70.82 38.53 66.29 34.3 66.29 29.08 C 66.29 23.86 70.82 19.63 76.4 19.63 C 81.98 19.63 86.5 23.86 86.5 29.08 Z M 13.5 29.08 A 10.1 9.45 0 1 0 33.7 29.08 A 10.1 9.45 0 1 0 13.5 29.08 Z";case"spiky-blob":return"M 50 12 C 76 12 88 26 88 48 C 88 64 88 78 84 86 C 78 82 72 92 64 86 C 56 82 50 90 44 86 C 36 92 30 82 12 48 C 12 26 24 12 50 12 Z";case"cloud-blob":return"M 50 12.5 C 60 9.17 69.17 15.83 71.67 21.67 C 79.17 24.17 83.33 32.5 80.83 40 C 85.83 47.5 83.33 57.5 78.33 61.67 C 76.67 70.83 68.33 76.67 60 74.17 C 53.33 80 42.5 80 35.83 74.17 C 27.5 76.67 20 70 18.33 61.67 C 13.33 56.67 11.67 47.5 16.67 40 C 14.17 32.5 20 24.17 27.5 21.67 C 30.83 15 40 9.17 50 12.5 Z";case"wide-oval":return"M 50 25 C 74 25 88 35 88 56 C 88 74 72 82 50 82 C 28 82 12 74 12 56 C 12 35 26 25 50 25 Z";case"soft-round":return"M 50 15 C 73.33 15 85 26.67 85 48.33 C 85 70 73.33 80 50 80 C 26.67 80 15 70 15 48.33 C 15 26.67 26.67 15 50 15 Z";case"octopus-blob":return"M 50 12.5 C 70 12.5 83.33 27.5 83.33 47.5 L 83.33 65.83 C 83.33 73.33 77.5 75 74.17 69.17 C 71.67 65 66.67 65 64.17 69.17 C 61.67 73.33 56.67 73.33 54.17 69.17 C 51.67 65 46.67 65 44.17 69.17 C 41.67 73.33 36.67 73.33 34.17 69.17 C 31.67 65 26.67 65 24.17 69.17 C 20.83 75 16.67 73.33 16.67 65.83 L 16.67 47.5 C 16.67 27.5 30 12.5 50 12.5 Z";case"wave-blob":return"M 50 13.33 C 63.33 13.33 75 20 76.67 31.67 C 77.5 40 70 43.33 76.67 50 C 82.5 56.67 75 73.33 56.67 76.67 C 50 78.33 43.33 78.33 36.67 75.83 C 21.67 70.83 17.5 58.33 23.33 51.67 C 28.33 45.83 21.67 41.67 23.33 33.33 C 25.83 20.83 36.67 13.33 50 13.33 Z";default:return"M 50 12 C 78 12 90 26 90 52 C 90 78 78 88 50 88 C 22 88 10 78 10 52 C 10 26 22 12 50 12 Z"}}const Co="M -4 2 C 2 2 5 -2 1 -5 C -3 -8 -10 -6 -10 -1 C -10 5 -2 8 4 4 C 9 1 7 -6 0 -7";function So(o,t,e,i,a,r=""){return`<g transform="translate(${o.toFixed(2)}, ${t.toFixed(2)}) scale(${e.toFixed(3)})" ${r}>
|
|
2
|
+
<path d="${Co}" stroke="${i}" stroke-width="${(a/e).toFixed(2)}" stroke-linecap="round" stroke-linejoin="round" fill="none" />
|
|
3
|
+
</g>`}function Je(o,t,e,i,a={},r=0){const s=r||(typeof performance<"u"?performance.now()/1e3:Date.now()/1e3),c="#2C2C2A",b="#F0997B",f=3.5;let u="";a.radii&&a.radii.length>0?u=`<path class="wissive-silhouette-path" d="${wt(a.radii)}" fill="${t}" />`:u=Yt(o).split(/(?=M )/).map(l=>l.trim()).filter(Boolean).map(l=>`<path class="wissive-silhouette-path" d="${l}" fill="${t}" />`).join("");const{flipX:F=!1,emphasis:v=!1}=a,w=Math.max(-13.2,Math.min(13.2,e.gazeX??0)),A=Math.max(-8.4,Math.min(8.4,e.gazeY??0)),j=(e.eyeGap??32)/2,z=(e.eyeY??45)+A,Z=50-j+w,B=50+j+w,N=40,me=50+(e.shiftX??0),xe=e.turnAngle??0,ie=n=>{const l=n-me,S=Math.max(-N,Math.min(N,l)),Y=Math.asin(S/N),T=Y+xe,g=Math.cos(T),Q=g>0,ne=me+N*Math.sin(T),x=Q?Math.max(0,g/Math.cos(Y)):0;return{projX:ne,scaleX:x,isVisible:Q}},_=ie(Z),D=ie(B),h=(e.eyeScale??1)*(v?1.15:1),O=Math.round(e.eyeType??0);let ze="",Ce="";const Ie=(n,l,S,Y)=>{if(S<=.01)return"";const T=h*S,g=`transform="translate(${n}, ${l}) scale(${S.toFixed(2)}, 1) translate(${-n}, ${-l})"`;switch(O){case 1:return`<g ${g}><path d="M ${n-5.83*h} ${l+2.5*h} Q ${n} ${l-5.83*h} ${n+5.83*h} ${l+2.5*h}" stroke="${c}" stroke-width="${f}" stroke-linecap="round" fill="none" /></g>`;case 2:return Y?`<g ${g}><path d="M ${n-5*h} ${l-5*h} L ${n+4.17*h} ${l} L ${n-5*h} ${l+5*h}" stroke="${c}" stroke-width="${f}" stroke-linecap="round" stroke-linejoin="round" fill="none" /></g>`:`<g ${g}><path d="M ${n+5*h} ${l-5*h} L ${n-4.17*h} ${l} L ${n+5*h} ${l+5*h}" stroke="${c}" stroke-width="${f}" stroke-linecap="round" stroke-linejoin="round" fill="none" /></g>`;case 3:return Y?`<g ${g}><path d="M ${n-5.83*h} ${l-4.17*h} L ${n+5*h} ${l+4.17*h}" stroke="${c}" stroke-width="${f}" stroke-linecap="round" fill="none" /></g>`:`<g ${g}><path d="M ${n+5.83*h} ${l-4.17*h} L ${n-5*h} ${l+4.17*h}" stroke="${c}" stroke-width="${f}" stroke-linecap="round" fill="none" /></g>`;case 4:return Y?`<g ${g}><path d="M ${n-5*h} ${l+4.17*h} L ${n+5.83*h} ${l-4.17*h}" stroke="${c}" stroke-width="${f}" stroke-linecap="round" fill="none" /></g>`:`<g ${g}><path d="M ${n+5*h} ${l+4.17*h} L ${n-5.83*h} ${l-4.17*h}" stroke="${c}" stroke-width="${f}" stroke-linecap="round" fill="none" /></g>`;case 5:return`<g ${g}>
|
|
4
|
+
<ellipse cx="${n}" cy="${l}" rx="${3.33*T}" ry="${3.33*T}" fill="${c}" />
|
|
5
|
+
<circle cx="${n-1.25*h}" cy="${l-1.25*h}" r="${1.25*h}" fill="#FFFFFF" />
|
|
6
|
+
</g>`;case 6:{const x=5.5*h;return`<g ${g}><path d="M ${n} ${l+x*.7} C ${n-x*1.1} ${l-x*.1} ${n-x*.9} ${l-x*.9} ${n} ${l-x*.35} C ${n+x*.9} ${l-x*.9} ${n+x*1.1} ${l-x*.1} ${n} ${l+x*.7} Z" fill="#E84855" /></g>`}case 7:{const x=4.2*h;return`<g ${g}>
|
|
7
|
+
<line x1="${n-x}" y1="${l-x}" x2="${n+x}" y2="${l+x}" stroke="${c}" stroke-width="${f}" stroke-linecap="round" />
|
|
8
|
+
<line x1="${n+x}" y1="${l-x}" x2="${n-x}" y2="${l+x}" stroke="${c}" stroke-width="${f}" stroke-linecap="round" />
|
|
9
|
+
</g>`}case 8:{const x=5*h;return`<g ${g}>
|
|
10
|
+
<line x1="${n-x}" y1="${l-2.2*h}" x2="${n+x}" y2="${l-2.2*h}" stroke="${c}" stroke-width="${f*.8}" stroke-linecap="round" />
|
|
11
|
+
<line x1="${n-x}" y1="${l+2.2*h}" x2="${n+x}" y2="${l+2.2*h}" stroke="${c}" stroke-width="${f*.8}" stroke-linecap="round" />
|
|
12
|
+
</g>`}case 9:return`<g ${g}>
|
|
13
|
+
<circle cx="${n}" cy="${l}" r="${5.8*h}" fill="none" stroke="${c}" stroke-width="2.6" />
|
|
14
|
+
${Y?`<line x1="${n-5.8*h}" y1="${l}" x2="${n-10*h}" y2="${l}" stroke="${c}" stroke-width="2.6" stroke-linecap="round" />`:""}
|
|
15
|
+
</g>`;case 10:return Y?`<g ${g}><path d="M ${n-5.83*h} ${l+1*h} Q ${n} ${l-5*h} ${n+5.83*h} ${l+1*h}" stroke="${c}" stroke-width="${f}" stroke-linecap="round" fill="none" /></g>`:`<ellipse cx="${n.toFixed(2)}" cy="${l.toFixed(2)}" rx="${(2.83*T).toFixed(2)}" ry="${Math.max(.5,2.83*T*Math.max(.05,e.eyeOpen)).toFixed(2)}" fill="${c}" />`;case 11:return Y?`<g ${g}><line x1="${n-5*h}" y1="${l}" x2="${n+5*h}" y2="${l}" stroke="${c}" stroke-width="${f}" stroke-linecap="round" /></g>`:`<ellipse cx="${n.toFixed(2)}" cy="${l.toFixed(2)}" rx="${(2.83*T).toFixed(2)}" ry="${(2.83*T).toFixed(2)}" fill="${c}" />`;case 12:return`<ellipse cx="${n.toFixed(2)}" cy="${l.toFixed(2)}" rx="${(2.2*T).toFixed(2)}" ry="${(5.5*T).toFixed(2)}" fill="${c}" />`;case 13:return`<circle cx="${n.toFixed(2)}" cy="${l.toFixed(2)}" r="${(4.5*T).toFixed(2)}" fill="${c}" />`;case 14:return`<g ${g}><path d="M ${n-5.83*h} ${l-1.67*h} Q ${n} ${l+5.83*h} ${n+5.83*h} ${l-1.67*h}" stroke="${c}" stroke-width="${f}" stroke-linecap="round" fill="none" /></g>`;case 15:return Y?`<g ${g}><path d="M ${n-5.5*h} ${l-1.5*h} Q ${n+1*h} ${l-3*h} ${n+6*h} ${l+3*h}" stroke="${c}" stroke-width="${f}" stroke-linecap="round" fill="none" /></g>`:`<g ${g}><path d="M ${n+5.5*h} ${l-1.5*h} Q ${n-1*h} ${l-3*h} ${n-6*h} ${l+3*h}" stroke="${c}" stroke-width="${f}" stroke-linecap="round" fill="none" /></g>`;case 16:return`<g ${g}><path d="M ${n} ${l-4.17*h} L ${n} ${l+3.33*h}" stroke="${c}" stroke-width="${f}" stroke-linecap="round" fill="none" /></g>`;case 17:return Y?`<g ${g}><path d="M ${n+5.83*h} ${l-6.67*h} L ${n-5*h} ${l+.83*h}" stroke="${c}" stroke-width="${f}" stroke-linecap="round" fill="none" /></g>`:`<g ${g}><path d="M ${n-5.83*h} ${l-6.67*h} L ${n+5*h} ${l+.83*h}" stroke="${c}" stroke-width="${f}" stroke-linecap="round" fill="none" /></g>`;case 18:{const x=4.6*h,I=vt().map(([P,K],pe)=>{const $e=(n+P*x).toFixed(2),se=(l+K*x).toFixed(2);return`${pe===0?"M":"L"} ${$e} ${se}`}).join(" ");return`<g ${g}><path d="${I}" stroke="${c}" stroke-width="1.3" stroke-linecap="round" fill="none" /></g>`}case 19:return`<g ${g}>
|
|
16
|
+
<circle cx="${n}" cy="${l}" r="${4.5*h}" fill="none" stroke="${c}" stroke-width="2.63" />
|
|
17
|
+
<path d="M ${n-2.83*h} ${l-.42*h} Q ${n} ${l+2.83*h} ${n+2.83*h} ${l-.42*h}" stroke="${c}" stroke-width="2.63" stroke-linecap="round" fill="none" />
|
|
18
|
+
</g>`;case 20:return`<g ${g}><circle cx="${n}" cy="${l}" r="${3.67*h}" fill="none" stroke="${c}" stroke-width="2.8" /></g>`;case 21:{const x=6*h,I=x*.45,K=[[n,l-x],[n+I*.59,l-I*.81],[n+x*.95,l-x*.31],[n+I*.95,l+I*.31],[n+x*.59,l+x*.81],[n,l+I],[n-x*.59,l+x*.81],[n-I*.95,l+I*.31],[n-x*.95,l-x*.31],[n-I*.59,l-I*.81]].map((pe,$e)=>`${$e===0?"M":"L"} ${pe[0].toFixed(2)} ${pe[1].toFixed(2)}`).join(" ")+" Z";return`<g ${g}><path d="${K}" fill="${c}" /></g>`}case 22:return Y?`<g ${g}><path d="M ${n-5*h} ${l-3*h} L ${n+4*h} ${l-3*h} L ${n+4*h} ${l+3*h}" stroke="${c}" stroke-width="${f}" stroke-linecap="round" stroke-linejoin="round" fill="none" /></g>`:`<g ${g}><path d="M ${n+5*h} ${l-3*h} L ${n-4*h} ${l-3*h} L ${n-4*h} ${l+3*h}" stroke="${c}" stroke-width="${f}" stroke-linecap="round" stroke-linejoin="round" fill="none" /></g>`;case 23:return Y?`<ellipse cx="${n.toFixed(2)}" cy="${l.toFixed(2)}" rx="${(2.83*T).toFixed(2)}" ry="${Math.max(.5,2.83*T*Math.max(.05,e.eyeOpen)).toFixed(2)}" fill="${c}" />`:`<g ${g}><path d="M ${n-5.83*h} ${l+1*h} Q ${n} ${l-5*h} ${n+5.83*h} ${l+1*h}" stroke="${c}" stroke-width="${f}" stroke-linecap="round" fill="none" /></g>`;case 24:return`<g ${g}>
|
|
19
|
+
<ellipse cx="${n}" cy="${l}" rx="${4.2*T}" ry="${4.8*T}" fill="${c}" />
|
|
20
|
+
<circle cx="${n-1.5*h}" cy="${l-1.8*h}" r="${1.6*h}" fill="#FFFFFF" />
|
|
21
|
+
<circle cx="${n+1.5*h}" cy="${l+1.5*h}" r="${.9*h}" fill="#FFFFFF" />
|
|
22
|
+
</g>`;case 25:return Y?`<g ${g}>
|
|
23
|
+
<path d="M ${n-5.5*h} ${l-1*h} Q ${n} ${l+5.5*h} ${n+5.5*h} ${l-1*h}" stroke="${c}" stroke-width="${f}" stroke-linecap="round" fill="none" />
|
|
24
|
+
<line x1="${n+4.5*h}" y1="${l}" x2="${n+7.5*h}" y2="${l-3*h}" stroke="${c}" stroke-width="${f*.75}" stroke-linecap="round" />
|
|
25
|
+
</g>`:`<g ${g}>
|
|
26
|
+
<path d="M ${n-5.5*h} ${l-1*h} Q ${n} ${l+5.5*h} ${n+5.5*h} ${l-1*h}" stroke="${c}" stroke-width="${f}" stroke-linecap="round" fill="none" />
|
|
27
|
+
<line x1="${n-4.5*h}" y1="${l}" x2="${n-7.5*h}" y2="${l-3*h}" stroke="${c}" stroke-width="${f*.75}" stroke-linecap="round" />
|
|
28
|
+
</g>`;case 26:return`<g ${g}>
|
|
29
|
+
<circle cx="${n}" cy="${l}" r="${5.8*T}" fill="#FFFFFF" stroke="${c}" stroke-width="2.2" />
|
|
30
|
+
<circle cx="${n+(e.gazeX?e.gazeX*.15:0)}" cy="${l+(e.gazeY?e.gazeY*.15:0)}" r="${2.5*T}" fill="${c}" />
|
|
31
|
+
</g>`;case 27:return`<g ${g}><path d="M ${n-6*h} ${l} Q ${n} ${l-5*h} ${n+6*h} ${l}" stroke="${c}" stroke-width="${f}" stroke-linecap="round" fill="none" /></g>`;case 28:return`<g ${g}><line x1="${n-5.5*h}" y1="${l}" x2="${n+5.5*h}" y2="${l}" stroke="${c}" stroke-width="${f}" stroke-linecap="round" /></g>`;case 29:return`<g ${g}>
|
|
32
|
+
<ellipse cx="${n}" cy="${l+1*h}" rx="${2.8*T}" ry="${2.8*T}" fill="${c}" />
|
|
33
|
+
<path d="M ${n-4*h} ${l-4*h} Q ${n} ${l-7*h} ${n+4*h} ${l-5*h}" stroke="${c}" stroke-width="2.2" stroke-linecap="round" fill="none" />
|
|
34
|
+
</g>`;case 30:return`<g ${g}><path d="M ${n-5*h} ${l-3*h} L ${n-1.5*h} ${l+3*h} L ${n+1.5*h} ${l-3*h} L ${n+5*h} ${l+3*h}" stroke="${c}" stroke-width="${f*.8}" stroke-linecap="round" stroke-linejoin="round" fill="none" /></g>`;case 31:return`<g ${g}>
|
|
35
|
+
<circle cx="${n}" cy="${l}" r="${4.8*T}" fill="none" stroke="${c}" stroke-width="2.2" />
|
|
36
|
+
<circle cx="${n}" cy="${l}" r="${1.8*T}" fill="${c}" />
|
|
37
|
+
</g>`;case 0:default:const Q=2.83*T,ne=Math.max(.5,Q*Math.max(.05,e.eyeOpen));return`<ellipse cx="${n.toFixed(2)}" cy="${l.toFixed(2)}" rx="${Q.toFixed(2)}" ry="${ne.toFixed(2)}" fill="${c}" />`}};ze=_.isVisible?Ie(_.projX,z,_.scaleX,!1):"",Ce=D.isVisible?Ie(D.projX,z,D.scaleX,!0):"";let Me="";const Se=e.tears??0;if(Se>.01){const n=Math.min(1,Se),l=s*.36%1;let S=0,Y=n,T=1;if(l<.25){const g=l/.25;S=g*1.2,T=.75+g*.35,Y=n*(.3+g*.7)}else if(l<.82){const g=(l-.25)/.57;S=1.2+g*10.5,T=1.1-g*.2,Y=n}else{const g=(l-.82)/.18;S=11.7+g*2.5,T=.9-g*.4,Y=n*(1-g)}if(e.cascadeTears)Me=`
|
|
38
|
+
<g opacity="${Y.toFixed(2)}">
|
|
39
|
+
<path d="M ${_.projX-3} ${z+4} L ${_.projX-6} 88 L ${_.projX+2} 88 Z" fill="#7FA6D9" opacity="0.85" />
|
|
40
|
+
<path d="M ${D.projX-2} ${z+4} L ${D.projX-2} 88 L ${D.projX+6} 88 Z" fill="#7FA6D9" opacity="0.85" />
|
|
46
41
|
</g>
|
|
47
|
-
`;else{const
|
|
48
|
-
<g opacity="${
|
|
49
|
-
<g
|
|
50
|
-
|
|
51
|
-
<path d="M ${P} ${(D-2.5).toFixed(2)} C ${(w+2.2).toFixed(2)} ${(D-.5).toFixed(2)} ${(w+2.2).toFixed(2)} ${(D+2.2).toFixed(2)} ${P} ${(D+3.2).toFixed(2)} C ${(w-2.2).toFixed(2)} ${(D+2.2).toFixed(2)} ${(w-2.2).toFixed(2)} ${(D-.5).toFixed(2)} ${P} ${(D-2.5).toFixed(2)} Z" fill="#ffffff" />
|
|
52
|
-
<!-- Lágrima redondita ojo derecho -->
|
|
53
|
-
<path d="M ${I} ${(D-2.5).toFixed(2)} C ${(E+2.2).toFixed(2)} ${(D-.5).toFixed(2)} ${(E+2.2).toFixed(2)} ${(D+2.2).toFixed(2)} ${I} ${(D+3.2).toFixed(2)} C ${(E-2.2).toFixed(2)} ${(D+2.2).toFixed(2)} ${(E-2.2).toFixed(2)} ${(D-.5).toFixed(2)} ${I} ${(D-2.5).toFixed(2)} Z" fill="#ffffff" />
|
|
42
|
+
`;else{const g=(z+7).toFixed(2),Q=(_.projX-1.2).toFixed(2),ne=(D.projX+1.2).toFixed(2),x=parseFloat(Q),I=parseFloat(ne),P=parseFloat(g);Me=`
|
|
43
|
+
<g opacity="${Y.toFixed(2)}">
|
|
44
|
+
<g class="wissive-anim-tear" style="transform-origin: ${x}px ${P}px;">
|
|
45
|
+
<path d="M ${x} ${(P+S-2.5).toFixed(2)} C ${(x-2).toFixed(2)} ${(P+S).toFixed(2)} ${(x-2.5).toFixed(2)} ${(P+S+2.5).toFixed(2)} ${x} ${(P+S+3.2).toFixed(2)} C ${(x+2.5).toFixed(2)} ${(P+S+2.5).toFixed(2)} ${(x+2).toFixed(2)} ${(P+S).toFixed(2)} ${x} ${(P+S-2.5).toFixed(2)} Z" fill="#7FA6D9" transform="scale(1, ${T.toFixed(2)})" />
|
|
54
46
|
</g>
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
<g transform="translate(${X.toFixed(2)}, ${b.toFixed(2)}) scale(${E}) translate(-72, -31)" opacity="${I.toFixed(2)}">
|
|
58
|
-
<path d="M 68 28 L 76 28 L 68 34 L 76 34" stroke-width="${w}" />
|
|
59
|
-
</g>
|
|
60
|
-
`)}Z+="</g>"}if(e.sweat){const r=[{x:80,delay:0,scale:1},{x:20,delay:.4,scale:.85},{x:71,delay:.7,scale:.7}],l=Math.min(1,e.sweat);Z+='<g fill="#7FA6D9">';for(const C of r){const T=(a*1.2+C.delay)%1,X=25+T*7,b=l*Math.sin(T*Math.PI);b>.01&&(Z+=`
|
|
61
|
-
<g transform="translate(${C.x}, ${X.toFixed(2)}) scale(${C.scale}) translate(-80, -25)" opacity="${b.toFixed(2)}">
|
|
62
|
-
<path d="M 76 26 C 76 22 80 20 80 20 C 80 20 84 22 84 26 C 84 28.5 82.2 30 80 30 C 77.8 30 76 28.5 76 26 Z" />
|
|
47
|
+
<g class="wissive-anim-tear" style="transform-origin: ${I}px ${P}px; animation-delay: -0.9s;">
|
|
48
|
+
<path d="M ${I} ${(P+S-2.5).toFixed(2)} C ${(I-2).toFixed(2)} ${(P+S).toFixed(2)} ${(I-2.5).toFixed(2)} ${(P+S+2.5).toFixed(2)} ${I} ${(P+S+3.2).toFixed(2)} C ${(I+2.5).toFixed(2)} ${(P+S+2.5).toFixed(2)} ${(I+2).toFixed(2)} ${(P+S).toFixed(2)} ${I} ${(P+S-2.5).toFixed(2)} Z" fill="#7FA6D9" transform="scale(1, ${T.toFixed(2)})" />
|
|
63
49
|
</g>
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
<
|
|
50
|
+
</g>
|
|
51
|
+
`}}let ye="";if(e.showBrows!==void 0?e.showBrows>.5:e.browY!==0||e.browTilt!==0){const n=32+(e.browY??0),l=_.projX,S=D.projX,Y=6*h,T=e.browTilt??0,g=-T;ye=`
|
|
52
|
+
<g>
|
|
53
|
+
<line
|
|
54
|
+
x1="${l-Y}"
|
|
55
|
+
y1="${n}"
|
|
56
|
+
x2="${l+Y}"
|
|
57
|
+
y2="${n}"
|
|
58
|
+
stroke="${c}"
|
|
59
|
+
stroke-width="2.6"
|
|
60
|
+
stroke-linecap="round"
|
|
61
|
+
transform="rotate(${T}, ${l}, ${n})"
|
|
62
|
+
/>
|
|
63
|
+
<line
|
|
64
|
+
x1="${S-Y}"
|
|
65
|
+
y1="${n}"
|
|
66
|
+
x2="${S+Y}"
|
|
67
|
+
y2="${n}"
|
|
68
|
+
stroke="${c}"
|
|
69
|
+
stroke-width="2.6"
|
|
70
|
+
stroke-linecap="round"
|
|
71
|
+
transform="rotate(${g}, ${S}, ${n})"
|
|
72
|
+
/>
|
|
73
|
+
</g>
|
|
74
|
+
`}let le="";if(e.sweat){const n=Math.min(1,e.sweat);le+=`
|
|
75
|
+
<g class="wissive-anim-sweat" opacity="${n.toFixed(2)}" fill="#7FA6D9">
|
|
76
|
+
<path d="M 80 28 C 78 30 77 33 79 35 C 81 37 84 36 84 33 C 84 30 81 28 80 28 Z" />
|
|
77
|
+
<path d="M 73 22 C 72 23 71.5 25 72.8 26.5 C 74 27.5 76 27 76 25 C 76 23 74 22 73 22 Z" opacity="0.75" />
|
|
68
78
|
</g>
|
|
69
|
-
`}if(e.
|
|
70
|
-
<g
|
|
71
|
-
|
|
79
|
+
`}if(e.zzz){const n=Math.min(1,e.zzz);le+=`
|
|
80
|
+
<g opacity="${n.toFixed(2)}" fill="#383835" font-family="-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif" font-weight="900">
|
|
81
|
+
<text class="wissive-zzz-1" x="78" y="24" font-size="9" letter-spacing="-0.5">Z</text>
|
|
82
|
+
<text class="wissive-zzz-2" x="84" y="16" font-size="7.5" letter-spacing="-0.5">z</text>
|
|
83
|
+
<text class="wissive-zzz-3" x="89" y="9" font-size="6" letter-spacing="-0.5">z</text>
|
|
72
84
|
</g>
|
|
73
|
-
`}if(e.
|
|
74
|
-
|
|
85
|
+
`}if(e.storm){const n=Math.min(1,e.storm),l=Math.sin(s*1.4)*1.2,S=Math.sin(s*1.4+1.8)*1.2,Y=.85+Math.sin(s*1.4)*.15,T=.85+Math.sin(s*1.4+1.8)*.15;le+=`
|
|
86
|
+
<g opacity="${n.toFixed(2)}" fill="#8a8a86">
|
|
87
|
+
<path transform="translate(${l.toFixed(2)}, ${(Math.abs(l)*-.4).toFixed(2)})" opacity="${Y.toFixed(2)}" d="M 22 6 C 22 3 25 1.5 27 2.3 C 27.6 0.5 30 -0.3 31.7 1 C 33.3 -0.7 36.5 0.3 36.5 3 C 38.2 3 39.5 4.5 39 6.2 C 39 8 37.3 9 35.6 9 L 24 9 C 22.3 9 22 7.5 22 6 Z" />
|
|
88
|
+
<path transform="translate(${S.toFixed(2)}, ${(Math.abs(S)*-.4).toFixed(2)})" opacity="${T.toFixed(2)}" d="M 62 8 C 62 5.3 64.8 3.9 66.6 4.6 C 67.2 3 69.4 2.3 71 3.5 C 72.5 1.9 75.4 2.8 75.4 5.3 C 77 5.3 78.2 6.7 77.7 8.2 C 77.7 9.8 76.1 10.7 74.6 10.7 L 63.8 10.7 C 62.3 10.7 62 9.4 62 8 Z" />
|
|
89
|
+
</g>
|
|
90
|
+
`}if(e.scribble){const n=Math.min(1,e.scribble),l=Math.sin(s*1.6)*6,S=1+Math.sin(s*2.3)*.06;le+=`
|
|
91
|
+
<g transform="translate(50, 3) rotate(${l.toFixed(2)}) translate(-50, -3)" opacity="${n.toFixed(2)}">
|
|
92
|
+
${So(50,3,S,"#5B7FD6",2.3)}
|
|
93
|
+
</g>
|
|
94
|
+
`}if(e.puff){const n=s*.55%1,l=e.mouthY??63,S=68+n*12,Y=l-n*10,T=.4+n*.9,g=Math.min(1,e.puff)*Math.sin(n*Math.PI)*.8;g>.01&&(le+=`
|
|
95
|
+
<g fill="#B9BDB6" opacity="${g.toFixed(2)}" transform="translate(${S.toFixed(2)}, ${Y.toFixed(2)}) scale(${T.toFixed(2)})">
|
|
75
96
|
<circle cx="0" cy="0" r="3.4" />
|
|
76
97
|
<circle cx="3" cy="-1.2" r="2.1" />
|
|
77
98
|
<circle cx="-2.4" cy="-1" r="1.8" />
|
|
78
99
|
</g>
|
|
79
|
-
`)}let
|
|
80
|
-
<g
|
|
81
|
-
<line x1="${
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
<line x1="${
|
|
100
|
+
`)}let Fe="";if(e.whiskers)Fe=`
|
|
101
|
+
<g stroke="${c}" stroke-width="2" stroke-linecap="round" opacity="${(e.cheek||.7).toFixed(2)}">
|
|
102
|
+
<line x1="${_.projX-10}" y1="52" x2="${_.projX-18}" y2="50" />
|
|
103
|
+
<line x1="${_.projX-10}" y1="56" x2="${_.projX-17}" y2="58" />
|
|
104
|
+
<line x1="${D.projX+10}" y1="52" x2="${D.projX+18}" y2="50" />
|
|
105
|
+
<line x1="${D.projX+10}" y1="56" x2="${D.projX+17}" y2="58" />
|
|
85
106
|
</g>
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
<
|
|
91
|
-
|
|
92
|
-
<
|
|
93
|
-
<
|
|
94
|
-
`;break
|
|
95
|
-
<
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
</g>
|
|
99
|
-
`;break;case 8:Y=`
|
|
107
|
+
`;else if(e.cheek>.05){const n=(e.cheekRadius??5.5)*(v?1.2:1),l=(e.cheekY??54)+A*.5,S=Math.min(1,e.cheek);Fe=`
|
|
108
|
+
<ellipse cx="${_.projX-3.5}" cy="${l}" rx="${(n*_.scaleX).toFixed(2)}" ry="${(n*.7).toFixed(2)}" fill="${b}" opacity="${S.toFixed(2)}" />
|
|
109
|
+
<ellipse cx="${D.projX+3.5}" cy="${l}" rx="${(n*D.scaleX).toFixed(2)}" ry="${(n*.7).toFixed(2)}" fill="${b}" opacity="${S.toFixed(2)}" />
|
|
110
|
+
`}const Le=50+w*.8,Te=(e.mouthY??63)+A*.6,M=(e.mouthScale??1)*(v?1.15:1),we=e.mouthCurve??0,ce=e.mouthOpen??0,J=Math.round(e.mouthType??0);let E="";const d=Le,m=Te,k=5.83*M;switch(J){case 1:{const n=Math.max(1.8,(2.8+ce*3.5)*M);E=`<ellipse cx="${d.toFixed(2)}" cy="${m.toFixed(2)}" rx="${n.toFixed(2)}" ry="${(n*(1+ce*.4)).toFixed(2)}" fill="${c}" />`;break}case 2:E=`<path d="M ${(d-k).toFixed(2)} ${m.toFixed(2)} Q ${(d-k*.5).toFixed(2)} ${(m-2.5*M).toFixed(2)} ${d.toFixed(2)} ${m.toFixed(2)} Q ${(d+k*.5).toFixed(2)} ${(m+2.5*M).toFixed(2)} ${(d+k).toFixed(2)} ${m.toFixed(2)}" stroke="${c}" stroke-width="${f}" stroke-linecap="round" fill="none" />`;break;case 3:E=`<line x1="${(d-k).toFixed(2)}" y1="${m.toFixed(2)}" x2="${(d+k).toFixed(2)}" y2="${m.toFixed(2)}" stroke="${c}" stroke-width="${f}" stroke-linecap="round" />`;break;case 4:{const n=7.5*M,l=4.2*M;E=`
|
|
111
|
+
<rect x="${(d-n).toFixed(2)}" y="${(m-l*.5).toFixed(2)}" width="${(n*2).toFixed(2)}" height="${l.toFixed(2)}" rx="2" fill="#FFFFFF" stroke="${c}" stroke-width="2.2" />
|
|
112
|
+
<line x1="${(d-n).toFixed(2)}" y1="${m.toFixed(2)}" x2="${(d+n).toFixed(2)}" y2="${m.toFixed(2)}" stroke="${c}" stroke-width="1.8" />
|
|
113
|
+
<line x1="${(d-n*.33).toFixed(2)}" y1="${(m-l*.5).toFixed(2)}" x2="${(d-n*.33).toFixed(2)}" y2="${(m+l*.5).toFixed(2)}" stroke="${c}" stroke-width="1.8" />
|
|
114
|
+
<line x1="${(d+n*.33).toFixed(2)}" y1="${(m-l*.5).toFixed(2)}" x2="${(d+n*.33).toFixed(2)}" y2="${(m+l*.5).toFixed(2)}" stroke="${c}" stroke-width="1.8" />
|
|
115
|
+
`;break}case 5:{const n=(3.5+ce*4.5)*M;E=`
|
|
116
|
+
<path d="M ${(d-k).toFixed(2)} ${m.toFixed(2)} Q ${d.toFixed(2)} ${(m+n*2.2).toFixed(2)} ${(d+k).toFixed(2)} ${m.toFixed(2)} Z" fill="${c}" />
|
|
117
|
+
<path d="M ${(d-k*.8).toFixed(2)} ${m.toFixed(2)} L ${(d+k*.8).toFixed(2)} ${m.toFixed(2)} L ${(d+k*.7).toFixed(2)} ${(m+n*.6).toFixed(2)} L ${(d-k*.7).toFixed(2)} ${(m+n*.6).toFixed(2)} Z" fill="#FFFFFF" />
|
|
118
|
+
`;break}case 6:{const n=(4+ce*5.5)*M;E=`
|
|
100
119
|
<g>
|
|
101
|
-
<
|
|
102
|
-
<
|
|
103
|
-
<line x1="88" y1="${u-2}" x2="${m+14}" y2="${u-2}" stroke="#ffffff" stroke-width="2" />
|
|
104
|
-
<line x1="88" y1="${u+4}" x2="${m+14}" y2="${u+4}" stroke="#ffffff" stroke-width="2" />
|
|
105
|
-
<rect x="${m-15}" y="${u-7}" width="30" height="16" rx="3" fill="#ffffff" stroke="${h}" stroke-width="2.2" />
|
|
120
|
+
<path d="M ${(d-k).toFixed(2)} ${m.toFixed(2)} Q ${d.toFixed(2)} ${(m+n*2.2).toFixed(2)} ${(d+k).toFixed(2)} ${m.toFixed(2)} Z" fill="${c}" />
|
|
121
|
+
<path d="M ${(d-k*.5).toFixed(2)} ${(m+n*1.3).toFixed(2)} Q ${d.toFixed(2)} ${(m+n*.8).toFixed(2)} ${(d+k*.5).toFixed(2)} ${(m+n*1.3).toFixed(2)} Q ${d.toFixed(2)} ${(m+n*2.1).toFixed(2)} ${(d-k*.5).toFixed(2)} ${(m+n*1.3).toFixed(2)} Z" fill="#FF7B89" />
|
|
106
122
|
</g>
|
|
107
|
-
`;break
|
|
108
|
-
<
|
|
109
|
-
<
|
|
110
|
-
`;break
|
|
111
|
-
<
|
|
112
|
-
<
|
|
113
|
-
`;break
|
|
114
|
-
<path d="M ${m-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
<path d="M ${
|
|
118
|
-
<
|
|
119
|
-
`;break
|
|
120
|
-
|
|
121
|
-
<line x1="
|
|
122
|
-
<line x1="
|
|
123
|
-
<line x1="
|
|
124
|
-
|
|
125
|
-
<
|
|
126
|
-
<
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
<svg width="${i}" height="${i}" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg" style="overflow: visible;">
|
|
123
|
+
`;break}case 7:{const n=3.5*M;E=`
|
|
124
|
+
<line x1="${(d-n).toFixed(2)}" y1="${(m-n).toFixed(2)}" x2="${(d+n).toFixed(2)}" y2="${(m+n).toFixed(2)}" stroke="${c}" stroke-width="${f}" stroke-linecap="round" />
|
|
125
|
+
<line x1="${(d+n).toFixed(2)}" y1="${(m-n).toFixed(2)}" x2="${(d-n).toFixed(2)}" y2="${(m+n).toFixed(2)}" stroke="${c}" stroke-width="${f}" stroke-linecap="round" />
|
|
126
|
+
`;break}case 8:{const n=12*M,l=7.5*M;E=`
|
|
127
|
+
<rect x="${(d-n).toFixed(2)}" y="${(m-l*.4).toFixed(2)}" width="${(n*2).toFixed(2)}" height="${l.toFixed(2)}" rx="3" fill="#FFFFFF" stroke="#8A9BA8" stroke-width="1.8" />
|
|
128
|
+
<line x1="${(d-n).toFixed(2)}" y1="${m.toFixed(2)}" x2="${(d+n).toFixed(2)}" y2="${m.toFixed(2)}" stroke="#C8D4DE" stroke-width="1.2" />
|
|
129
|
+
`;break}case 9:E=`
|
|
130
|
+
<path d="M ${(d-k).toFixed(2)} ${m.toFixed(2)} Q ${(d-k*.5).toFixed(2)} ${(m+3.2*M).toFixed(2)} ${d.toFixed(2)} ${m.toFixed(2)} Q ${(d+k*.5).toFixed(2)} ${(m+3.2*M).toFixed(2)} ${(d+k).toFixed(2)} ${m.toFixed(2)}" stroke="${c}" stroke-width="${f}" stroke-linecap="round" fill="none" />
|
|
131
|
+
`;break;case 10:E=`<circle cx="${d.toFixed(2)}" cy="${m.toFixed(2)}" r="${(1.9*M).toFixed(2)}" fill="${c}" />`;break;case 11:E=`<line x1="${(d-k*.8).toFixed(2)}" y1="${(m+2.5*M).toFixed(2)}" x2="${(d+k*.8).toFixed(2)}" y2="${(m-2.5*M).toFixed(2)}" stroke="${c}" stroke-width="${f}" stroke-linecap="round" />`;break;case 12:E=`<path d="M ${(d-k).toFixed(2)} ${(m+2*M).toFixed(2)} Q ${d.toFixed(2)} ${(m-4.5*M).toFixed(2)} ${(d+k).toFixed(2)} ${(m+2*M).toFixed(2)}" stroke="${c}" stroke-width="${f}" stroke-linecap="round" fill="none" />`;break;case 13:E=`<circle cx="${d.toFixed(2)}" cy="${m.toFixed(2)}" r="${(3.2*M).toFixed(2)}" fill="none" stroke="${c}" stroke-width="${f}" />`;break;case 14:E="";break;case 15:{const n=3.2*M,l=4.8*M;E=`
|
|
132
|
+
<line x1="${(d-k).toFixed(2)}" y1="${m.toFixed(2)}" x2="${(d+k).toFixed(2)}" y2="${m.toFixed(2)}" stroke="${c}" stroke-width="${f}" stroke-linecap="round" />
|
|
133
|
+
<path d="M ${(d-n*.7).toFixed(2)} ${m.toFixed(2)} C ${(d-n).toFixed(2)} ${(m+l).toFixed(2)} ${(d+n).toFixed(2)} ${(m+l).toFixed(2)} ${(d+n*.7).toFixed(2)} ${m.toFixed(2)} Z" fill="#FF5E7E" stroke="${c}" stroke-width="1.8" />
|
|
134
|
+
<line x1="${d.toFixed(2)}" y1="${m.toFixed(2)}" x2="${d.toFixed(2)}" y2="${(m+l*.65).toFixed(2)}" stroke="#D93856" stroke-width="1.2" />
|
|
135
|
+
`;break}case 16:E=`<path d="M ${(d-k*.4).toFixed(2)} ${m.toFixed(2)} Q ${(d+k*.4).toFixed(2)} ${(m+.5).toFixed(2)} ${(d+k*1.1).toFixed(2)} ${(m-3.5*M).toFixed(2)}" stroke="${c}" stroke-width="${f}" stroke-linecap="round" fill="none" />`;break;case 17:E=`<path d="M ${(d-k*.6).toFixed(2)} ${(m+2.5*M).toFixed(2)} L ${d.toFixed(2)} ${(m-2.5*M).toFixed(2)} L ${(d+k*.6).toFixed(2)} ${(m+2.5*M).toFixed(2)} Z" fill="${c}" />`;break;case 18:E=`<path d="M ${(d-k*.6).toFixed(2)} ${(m-2.2*M).toFixed(2)} Q ${(d+1).toFixed(2)} ${m.toFixed(2)} ${(d-k*.6).toFixed(2)} ${(m+2.2*M).toFixed(2)}" stroke="${c}" stroke-width="${f}" stroke-linecap="round" fill="none" />`;break;case 19:{const n=5*M,l=5.5*M;E=`<rect x="${(d-n).toFixed(2)}" y="${(m-l*.5).toFixed(2)}" width="${(n*2).toFixed(2)}" height="${l.toFixed(2)}" rx="1.5" fill="${c}" />`;break}case 20:E=`<path d="M ${(d-k*.7).toFixed(2)} ${(m-1).toFixed(2)} Q ${d.toFixed(2)} ${(m+2*M).toFixed(2)} ${(d+k*.7).toFixed(2)} ${(m-1).toFixed(2)}" stroke="${c}" stroke-width="${f}" stroke-linecap="round" fill="none" />`;break;case 21:{const n=8*M,l=3.8*M;E=`
|
|
136
|
+
<rect x="${(d-n).toFixed(2)}" y="${(m-l*.5).toFixed(2)}" width="${(n*2).toFixed(2)}" height="${l.toFixed(2)}" rx="2" fill="#FFFFFF" stroke="${c}" stroke-width="2.2" />
|
|
137
|
+
<line x1="${(d-n*.5).toFixed(2)}" y1="${(m-l*.5).toFixed(2)}" x2="${(d-n*.5).toFixed(2)}" y2="${(m+l*.5).toFixed(2)}" stroke="${c}" stroke-width="1.5" />
|
|
138
|
+
<line x1="${d.toFixed(2)}" y1="${(m-l*.5).toFixed(2)}" x2="${d.toFixed(2)}" y2="${(m+l*.5).toFixed(2)}" stroke="${c}" stroke-width="1.5" />
|
|
139
|
+
<line x1="${(d+n*.5).toFixed(2)}" y1="${(m-l*.5).toFixed(2)}" x2="${(d+n*.5).toFixed(2)}" y2="${(m+l*.5).toFixed(2)}" stroke="${c}" stroke-width="1.5" />
|
|
140
|
+
`;break}case 22:{E=`
|
|
141
|
+
<path d="M ${(d-k).toFixed(2)} ${m.toFixed(2)} Q ${d.toFixed(2)} ${(m+3*M).toFixed(2)} ${(d+k).toFixed(2)} ${m.toFixed(2)}" stroke="${c}" stroke-width="${f}" stroke-linecap="round" fill="none" />
|
|
142
|
+
<path d="M ${(d+k*.2).toFixed(2)} ${(m+1).toFixed(2)} C ${(d+k*.2).toFixed(2)} ${(m+5*M).toFixed(2)} ${(d+k*.8).toFixed(2)} ${(m+5*M).toFixed(2)} ${(d+k*.8).toFixed(2)} ${(m+1).toFixed(2)} Z" fill="#FF5E7E" stroke="${c}" stroke-width="1.5" />
|
|
143
|
+
`;break}case 23:{const n=5.5*M;E=`
|
|
144
|
+
<path d="M ${(d-k*1.1).toFixed(2)} ${m.toFixed(2)} Q ${d.toFixed(2)} ${(m+n*2.2).toFixed(2)} ${(d+k*1.1).toFixed(2)} ${m.toFixed(2)} Z" fill="${c}" />
|
|
145
|
+
<ellipse cx="${d.toFixed(2)}" cy="${(m+n*1.4).toFixed(2)}" rx="${(k*.65).toFixed(2)}" ry="${(n*.65).toFixed(2)}" fill="#FF6584" />
|
|
146
|
+
`;break}case 24:E=`<path d="M ${(d-k*.5).toFixed(2)} ${(m-1).toFixed(2)} Q ${(d-1).toFixed(2)} ${(m+4*M).toFixed(2)} ${(d+k*.9).toFixed(2)} ${(m+1).toFixed(2)}" stroke="${c}" stroke-width="${f}" stroke-linecap="round" fill="none" />`;break;case 0:default:if(Math.abs(we)<.05&&ce<.05)E=`<line x1="${(d-k).toFixed(2)}" y1="${m.toFixed(2)}" x2="${(d+k).toFixed(2)}" y2="${m.toFixed(2)}" stroke="${c}" stroke-width="${f}" stroke-linecap="round" />`;else if(ce>.1){const n=(ce*5+1.5)*M,l=m+we*5*M;E=`<path d="M ${(d-k).toFixed(2)} ${m.toFixed(2)} Q ${d.toFixed(2)} ${(l+n).toFixed(2)} ${(d+k).toFixed(2)} ${m.toFixed(2)} Q ${d.toFixed(2)} ${(l-n*.3).toFixed(2)} ${(d-k).toFixed(2)} ${m.toFixed(2)} Z" fill="${c}" stroke="${c}" stroke-width="1.5" stroke-linejoin="round" />`}else{const n=m+we*5*M;E=`<path d="M ${(d-k).toFixed(2)} ${m.toFixed(2)} Q ${d.toFixed(2)} ${n.toFixed(2)} ${(d+k).toFixed(2)} ${m.toFixed(2)}" stroke="${c}" stroke-width="${f}" stroke-linecap="round" fill="none" />`}break}return`
|
|
147
|
+
<svg viewBox="0 0 100 100" width="${i}" height="${i}" xmlns="http://www.w3.org/2000/svg">
|
|
133
148
|
<defs>
|
|
134
149
|
<style>
|
|
135
150
|
@keyframes wissive-zzz-loop {
|
|
@@ -150,6 +165,9 @@
|
|
|
150
165
|
50% { transform: translateY(5px); opacity: 0.95; }
|
|
151
166
|
100% { transform: translateY(9px); opacity: 0.15; }
|
|
152
167
|
}
|
|
168
|
+
.wissive-silhouette-path {
|
|
169
|
+
transition: fill 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
|
|
170
|
+
}
|
|
153
171
|
.wissive-zzz-1 { animation: wissive-zzz-loop 3s cubic-bezier(0.33, 0, 0.25, 1) infinite 0s; transform-box: fill-box; transform-origin: center; }
|
|
154
172
|
.wissive-zzz-2 { animation: wissive-zzz-loop 3s cubic-bezier(0.33, 0, 0.25, 1) infinite -1s; transform-box: fill-box; transform-origin: center; }
|
|
155
173
|
.wissive-zzz-3 { animation: wissive-zzz-loop 3s cubic-bezier(0.33, 0, 0.25, 1) infinite -2s; transform-box: fill-box; transform-origin: center; }
|
|
@@ -157,25 +175,25 @@
|
|
|
157
175
|
.wissive-anim-sweat { animation: wissive-sweat-slide 2.2s ease-in-out infinite; transform-box: fill-box; transform-origin: top center; }
|
|
158
176
|
</style>
|
|
159
177
|
</defs>
|
|
160
|
-
<g transform="${
|
|
178
|
+
<g transform="${F?"translate(100, 0) scale(-1, 1)":""}">
|
|
161
179
|
<!-- Silueta del cuerpo (una o varias subformas: cuerpo + orejas, brazos…) -->
|
|
162
|
-
${
|
|
180
|
+
${u}
|
|
163
181
|
<!-- Mejillas o Rayas -->
|
|
164
|
-
${
|
|
182
|
+
${Fe}
|
|
165
183
|
<!-- Accesorios (ZZZ, Gotas) -->
|
|
166
|
-
${Z}
|
|
167
|
-
<!-- Lágrimas -->
|
|
168
184
|
${le}
|
|
169
|
-
<!--
|
|
170
|
-
${ue}
|
|
185
|
+
<!-- Lágrimas -->
|
|
171
186
|
${Me}
|
|
187
|
+
<!-- Ojos -->
|
|
188
|
+
${ze}
|
|
189
|
+
${Ce}
|
|
172
190
|
<!-- Cejas -->
|
|
173
|
-
${
|
|
191
|
+
${ye}
|
|
174
192
|
<!-- Boca -->
|
|
175
|
-
${
|
|
193
|
+
${E}
|
|
176
194
|
</g>
|
|
177
195
|
</svg>
|
|
178
|
-
`}function
|
|
196
|
+
`}function To(o,t,e,i,a={}){return Je(o,t,e,i,a)}function qe(){return typeof window>"u"||typeof window.matchMedia!="function"?!0:window.matchMedia("(hover: hover)").matches}function Et(){return typeof window>"u"?!1:typeof window.matchMedia=="function"&&window.matchMedia("(hover: none)").matches||"ontouchstart"in window||typeof navigator<"u"&&navigator.maxTouchPoints>0}const Ae=new Set;let Pe=!1;function At(o){const t=o.clientX,e=o.clientY,i=(typeof window<"u"?window.innerWidth:1e3)/2||1,a=(typeof window<"u"?window.innerHeight:1e3)/2||1;for(const r of Ae){const s=r.element.getBoundingClientRect(),c=s.left+s.width/2,b=s.top+s.height/2;if(r.onGazeMove){const F=Math.max(-.6,Math.min(.6,(t-c)/i)),v=Math.max(-.6,Math.min(.6,(e-b)/a));r.onGazeMove(22*F,14*v)}if(r.isActive())continue;const u=Math.hypot(t-c,e-b)<=r.nearRadius;u!==r.isNear&&(r.isNear=u,r.onNearChange(u))}}function wo(o){Ae.add(o),!Pe&&typeof window<"u"&&(window.addEventListener("mousemove",At,{passive:!0}),Pe=!0)}function Yo(o){Ae.delete(o),Ae.size===0&&Pe&&typeof window<"u"&&(window.removeEventListener("mousemove",At),Pe=!1)}function Pt(o,t,e=120){if(typeof window>"u")return()=>{};let i=!1,a=!1,r=!1,s=!1;const c=()=>{i=!0,t.onHoverStart()},b=()=>{i=!1,a=!1,t.onHoverEnd()},f=N=>{N.button===0&&(a=!0,t.onClickStart())},u=()=>{a&&(a=!1,t.onClickEnd())},F=()=>{a=!0,t.onClickStart()},v=()=>{a&&(a=!1,t.onClickEnd())},w=()=>{a&&(a=!1,t.onClickEnd())},A=()=>{r=!0,t.onHoverStart()},j=()=>{r=!1,s&&(s=!1,a=!1,t.onClickEnd()),t.onHoverEnd()},z=N=>{(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),s||(s=!0,a=!0,t.onClickStart()))},Z=N=>{(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),s&&(s=!1,a=!1,t.onClickEnd()))};o.addEventListener("mouseenter",c),o.addEventListener("mouseleave",b),o.addEventListener("mousedown",f),window.addEventListener("mouseup",u),o.addEventListener("focus",A),o.addEventListener("blur",j),o.addEventListener("keydown",z),o.addEventListener("keyup",Z),o.addEventListener("touchstart",F,{passive:!0}),window.addEventListener("touchend",v,{passive:!0}),window.addEventListener("touchcancel",w,{passive:!0});const B={element:o,nearRadius:e,isNear:!1,isActive:()=>i||a||r,onNearChange:t.onNearChange,onGazeMove:t.onGazeMove};return(qe()||t.onGazeMove)&&wo(B),()=>{o.removeEventListener("mouseenter",c),o.removeEventListener("mouseleave",b),o.removeEventListener("mousedown",f),window.removeEventListener("mouseup",u),o.removeEventListener("focus",A),o.removeEventListener("blur",j),o.removeEventListener("keydown",z),o.removeEventListener("keyup",Z),o.removeEventListener("touchstart",F),window.removeEventListener("touchend",v),window.removeEventListener("touchcancel",w),Yo(B)}}let Qe;function Ve(){return Qe||(Qe=import("cuelume").catch(()=>null)),Qe}class zt{constructor(){C(this,"enabled",!0);C(this,"volume",.6);Ve().then(t=>{try{t==null||t.setVolume(this.volume)}catch{}})}setEnabled(t){this.enabled=t}isEnabled(){return this.enabled}setVolumeLevel(t){this.volume=Math.max(0,Math.min(1,t)),Ve().then(e=>{try{e==null||e.setVolume(this.volume)}catch{}})}getVolumeLevel(){return this.volume}playCue(t,e={}){this.enabled&&Ve().then(i=>{try{i==null||i.play(t,{volume:e.volume??this.volume})}catch{}})}playSound(t,e){if(!this.enabled)return;let i="tick";switch(t){case"happy":i=e==="click"?"sparkle":"chime";break;case"flutter":i=e==="click"?"pulse":"bloom";break;case"pleasure":i=e==="click"?"bloom":"droplet";break;case"peaceful":i=e==="click"?"arrival":"whisper";break;case"normal":i=e==="click"?"toggle":"tick";break;case"tired":case"sleepy":i=e==="click"?"loading":"whisper";break;case"sad":case"disappointed":i=e==="click"?"scan":"droplet";break;case"anxiety":case"stress":i=e==="click"?"pulse":"tick";break;case"anger":i=e==="click"?"press":"release";break;case"surprised":i=e==="click"?"success":"chime";break;case"numbness":i=e==="click"?"ready":"page";break;default:i=e==="click"?"sparkle":"tick";break}this.playCue(i)}}const ee=new zt;function It(o){ee.setEnabled(o)}function Lt(){return ee.isEnabled()}function Dt(o){ee.setVolumeLevel(o)}function Xt(){return ee.getVolumeLevel()}class Ot{constructor(t,e){C(this,"particles",[]);C(this,"canvas");C(this,"ctx");C(this,"animating",!1);C(this,"rafId",null);C(this,"size");C(this,"dpr");C(this,"tick",()=>{const t=this.canvas.width,e=this.canvas.height;this.ctx.clearRect(0,0,t,e);const i=.016;for(let a=this.particles.length-1;a>=0;a--){const r=this.particles[a];if(r.life-=i,r.life<=0){this.particles.splice(a,1);continue}r.vx*=.95,r.vy*=.95,r.swayFreq&&r.swayAmp&&(r.x+=Math.sin((r.maxLife-r.life)*r.swayFreq)*r.swayAmp),r.x+=r.vx,r.y+=r.vy,r.rotation+=r.rotSpeed,this.drawParticle(r)}this.particles.length>0?this.rafId=requestAnimationFrame(this.tick):(this.animating=!1,this.ctx.clearRect(0,0,t,e))});this.size=e,this.dpr=typeof window<"u"&&window.devicePixelRatio||1,this.canvas=document.createElement("canvas"),this.setupCanvas(),t.style.position="relative",t.style.overflow="visible",t.appendChild(this.canvas),this.ctx=this.canvas.getContext("2d")}setupCanvas(){const t=this.dpr,e=this.size*2.5;this.canvas.width=e*t,this.canvas.height=e*t,this.canvas.style.cssText=`
|
|
179
197
|
position: absolute;
|
|
180
198
|
top: -${this.size*.75}px;
|
|
181
199
|
left: -${this.size*.75}px;
|
|
@@ -183,5 +201,5 @@
|
|
|
183
201
|
height: ${e}px;
|
|
184
202
|
pointer-events: none;
|
|
185
203
|
z-index: 10;
|
|
186
|
-
`}resize(t){this.size=t,this.dpr=typeof window<"u"&&window.devicePixelRatio||1,this.setupCanvas()}burst(t,e=8,i,s){const c=this.size*2.5,a=i??c/2,h=s??c/2;for(let $=0;$<e;$++){const g=Math.PI*2*$/e+(Math.random()-.5)*.7,d=2.5+Math.random()*3.5,v=this.createParticle(t,a,h,g,d);this.particles.push(v)}this.animating||(this.animating=!0,this.tick())}createParticle(t,e,i,s,c){const a=10+Math.random()*15,h=e+Math.cos(s)*a,$=i+Math.sin(s)*a,g=.6+Math.random()*.5,d={x:h,y:$,vx:Math.cos(s)*c,vy:Math.sin(s)*c-1.2,life:g,maxLife:g,size:(6+Math.random()*8)*(this.size/120),rotation:Math.random()*Math.PI*2,rotSpeed:(Math.random()-.5)*.2,shape:"circle",color:"#F2A9B8",opacity:1},v=Math.random()>.6,k=x=>x[Math.floor(Math.random()*x.length)];switch(t){case"happy":d.shape=v?"sparkle":"heart",d.color=k(["#F2A9B8","#E3536C","#FF8FAB","#FFD1DC","#FFF0F5"]),d.vy-=.6;break;case"pleasure":d.shape=v?"circle":"petal",d.color=k(["#F28FC2","#FFC2DE","#FFE3F0","#E5739F"]),d.vy+=.9,d.vx*=.6,d.rotSpeed*=2.5,d.swayFreq=5+Math.random()*3,d.swayAmp=.9+Math.random()*.5;break;case"flutter":d.shape=v?"sparkle":"star",d.color=k(["#F2CB4E","#FFD700","#FFA500","#FFF4CC"]),d.vy-=1,d.vx*=1.5,d.rotSpeed*=2;break;case"peaceful":d.shape=v?"circle":"ring",d.color=k(["#9AC9A0","#B5E8B5","#7FD17F","#E8F5E9"]),d.vy-=.8,d.swayFreq=8+Math.random()*4,d.swayAmp=.4+Math.random()*.4;break;case"normal":d.shape=v?"circle":"dot",d.color=k(["#C9DCD3","#A8C7BB","#E4F0EA","#8FB3A4"]),d.size*=.65,d.vx*=.5,d.vy*=.5;break;case"tired":d.shape=v?"ring":"zzz",d.color=k(["#D6DBCF","#BFC7B8","#EDF0E8","#A9B3A0"]),d.vy-=1.2,d.vx*=.25,d.swayFreq=6+Math.random()*4,d.swayAmp=.5;break;case"sleepy":d.shape=v?"zzz":"bubble",d.color=k(["#AFCBE0","#D3E8F5","#ffffff","#8FB6D1"]),d.size*=1.35,d.vy-=1.5,d.vx*=.2,d.swayFreq=3+Math.random()*2,d.swayAmp=.7;break;case"sad":d.shape=v?"circle":"drop",d.color=k(["#7FA6D9","#A0C4E8","#6B9ACF","#E1F5FE"]),d.vy+=1.8,d.vx*=.3;break;case"disappointed":d.shape=v?"drop":"shard",d.color=k(["#EBD98A","#C9B86B","#F5E9B8","#A89550"]),d.vy+=1.2,d.vx*=.8,d.rotSpeed*=4;break;case"anxiety":d.shape=v?"circle":"zigzag",d.color=k(["#A99BD9","#C4B5F0","#8B7BC4","#D1C4E9"]),d.size*=.8,d.vx*=1.4;break;case"stress":d.shape=v?"zigzag":"spiral",d.color=k(["#C97F76","#E09A91","#A85F57","#F0BDB6"]),d.size*=.9,d.rotSpeed*=6,d.swayFreq=12+Math.random()*6,d.swayAmp=.6;break;case"anger":d.shape=v?"diamond":"ember",d.color=k(["#D9566A","#FF4444","#FF6B35","#FFA033"]),d.vy-=1.4,d.vx*=.7,d.size*=.9;break;case"surprised":d.shape=v?"dot":"burst",d.color=k(["#F0B98A","#FFCFA3","#FF9F1C","#FFE8D1"]),d.size*=1.15,d.vx*=1.8,d.vy*=1.8;break;case"numbness":d.shape=v?"dot":"glitch",d.color=k(["#D9C6E0","#C0A8CC","#EDE2F0","#A98FB8"]),d.vx*=.25,d.vy*=.25,d.life*=.6,d.rotSpeed=0;break;default:d.shape=v?"sparkle":"circle",d.color=k(["#F2A9B8","#F2CB4E","#9AC9A0"]);break}return d}drawParticle(t){const e=this.ctx,i=this.dpr,s=1-t.life/t.maxLife;let c=1;s<.18?c=s/.18:s>.65&&(c=(1-s)/.35),c=Math.max(0,Math.min(1.2,c));const a=t.size*c;if(a<=.1)return;const h=Math.max(0,Math.min(1,t.life/t.maxLife*1.2));switch(e.save(),e.translate(t.x*i,t.y*i),e.rotate(t.rotation),e.globalAlpha=h,t.shape){case"heart":e.fillStyle=t.color,e.beginPath(),e.moveTo(0,a*.35*i),e.bezierCurveTo(-a*.7*i,-a*.1*i,-a*.8*i,-a*.8*i,0,-a*.45*i),e.bezierCurveTo(a*.8*i,-a*.8*i,a*.7*i,-a*.1*i,0,a*.35*i),e.closePath(),e.fill();break;case"star":{e.fillStyle=t.color,e.beginPath();const $=5,g=a*i,d=a*.45*i;for(let v=0;v<$*2;v++){const k=v%2===0?g:d,x=v*Math.PI/$-Math.PI/2,z=Math.cos(x)*k,j=Math.sin(x)*k;v===0?e.moveTo(z,j):e.lineTo(z,j)}e.closePath(),e.fill();break}case"sparkle":{e.fillStyle=t.color,e.beginPath();const $=a*1.1*i;e.moveTo(0,-$),e.quadraticCurveTo(0,0,$,0),e.quadraticCurveTo(0,0,0,$),e.quadraticCurveTo(0,0,-$,0),e.quadraticCurveTo(0,0,0,-$),e.closePath(),e.fill();break}case"drop":e.fillStyle=t.color,e.beginPath(),e.moveTo(0,-a*.8*i),e.bezierCurveTo(a*.7*i,-a*.2*i,a*.6*i,a*.7*i,0,a*.7*i),e.bezierCurveTo(-a*.6*i,a*.7*i,-a*.7*i,-a*.2*i,0,-a*.8*i),e.closePath(),e.fill();break;case"diamond":e.fillStyle=t.color,e.beginPath(),e.moveTo(0,-a*i),e.lineTo(a*.65*i,0),e.lineTo(0,a*i),e.lineTo(-a*.65*i,0),e.closePath(),e.fill();break;case"zigzag":e.strokeStyle=t.color,e.lineWidth=Math.max(2,a*.25)*i,e.lineCap="round",e.lineJoin="round",e.beginPath(),e.moveTo(-a*.6*i,-a*.5*i),e.lineTo(-a*.1*i,-a*.1*i),e.lineTo(-a*.3*i,a*.1*i),e.lineTo(a*.6*i,a*.5*i),e.stroke();break;case"ring":e.strokeStyle=t.color,e.lineWidth=Math.max(1.5,a*.25)*i,e.beginPath(),e.arc(0,0,a*.55*i,0,Math.PI*2),e.stroke();break;case"zzz":e.strokeStyle=t.color,e.lineWidth=Math.max(2,a*.25)*i,e.lineCap="round",e.lineJoin="round",e.beginPath(),e.moveTo(-a*.4*i,-a*.5*i),e.lineTo(a*.4*i,-a*.5*i),e.lineTo(-a*.4*i,a*.5*i),e.lineTo(a*.4*i,a*.5*i),e.stroke();break;case"petal":e.fillStyle=t.color,e.beginPath(),e.moveTo(0,-a*.9*i),e.quadraticCurveTo(a*.75*i,-a*.1*i,0,a*.9*i),e.quadraticCurveTo(-a*.75*i,-a*.1*i,0,-a*.9*i),e.closePath(),e.fill();break;case"spiral":{e.strokeStyle=t.color,e.lineWidth=Math.max(1.5,a*.2)*i,e.lineCap="round",e.beginPath();const $=a*.85*i;it().forEach(([g,d],v)=>{const k=g*$,x=d*$;v===0?e.moveTo(k,x):e.lineTo(k,x)}),e.stroke();break}case"bubble":e.strokeStyle=t.color,e.lineWidth=Math.max(1,a*.14)*i,e.beginPath(),e.arc(0,0,a*.6*i,0,Math.PI*2),e.stroke(),e.fillStyle=t.color,e.globalAlpha*=.7,e.beginPath(),e.arc(-a*.22*i,-a*.24*i,a*.13*i,0,Math.PI*2),e.fill();break;case"ember":{e.fillStyle=t.color,e.beginPath(),e.moveTo(0,-a*.95*i),e.bezierCurveTo(a*.5*i,-a*.2*i,a*.62*i,a*.55*i,0,a*.75*i),e.bezierCurveTo(-a*.62*i,a*.55*i,-a*.5*i,-a*.2*i,0,-a*.95*i),e.closePath(),e.fill();break}case"shard":e.fillStyle=t.color,e.beginPath(),e.moveTo(0,-a*.9*i),e.lineTo(a*.55*i,-a*.15*i),e.lineTo(a*.2*i,a*.85*i),e.lineTo(-a*.45*i,a*.3*i),e.closePath(),e.fill();break;case"burst":{e.strokeStyle=t.color,e.lineWidth=Math.max(1.5,a*.22)*i,e.lineCap="round",e.beginPath();for(let $=0;$<4;$++){const g=$*Math.PI/2,d=a*.3*i,v=a*i;e.moveTo(Math.cos(g)*d,Math.sin(g)*d),e.lineTo(Math.cos(g)*v,Math.sin(g)*v)}e.stroke();break}case"dot":e.fillStyle=t.color,e.beginPath(),e.arc(0,0,a*.28*i,0,Math.PI*2),e.fill();break;case"glitch":e.fillStyle=t.color,e.fillRect(-a*.6*i,-a*.28*i,a*1.2*i,a*.22*i),e.globalAlpha*=.6,e.fillRect(-a*.25*i,a*.06*i,a*.9*i,a*.16*i);break;case"circle":default:e.fillStyle=t.color,e.beginPath(),e.arc(0,0,a*.5*i,0,Math.PI*2),e.fill();break}e.restore()}destroy(){this.rafId!==null&&cancelAnimationFrame(this.rafId),this.particles=[],this.canvas.remove()}}class yt{constructor(t,e,i){M(this,"posX",0);M(this,"posY",0);M(this,"velX",0);M(this,"velY",0);M(this,"dragging",!1);M(this,"startPointerX",0);M(this,"startPointerY",0);M(this,"lastPointerX",0);M(this,"lastPointerY",0);M(this,"lastPointerTime",0);M(this,"velocitySamples",[]);M(this,"MAX_SAMPLES",6);M(this,"springK",.08);M(this,"springD",.82);M(this,"tossDecay",.96);M(this,"maxStretch",.25);M(this,"animating",!1);M(this,"rafId",null);M(this,"onUpdate");M(this,"onDragStart");M(this,"onDragEnd");M(this,"el");M(this,"handlePointerDown",t=>{t.preventDefault(),this.startDrag(t.clientX,t.clientY)});M(this,"handlePointerMove",t=>{this.dragging&&this.moveDrag(t.clientX,t.clientY)});M(this,"handlePointerUp",()=>{this.dragging&&this.endDrag()});M(this,"handleTouchDown",t=>{t.preventDefault();const e=t.touches[0];this.startDrag(e.clientX,e.clientY)});M(this,"handleTouchMove",t=>{if(!this.dragging)return;t.preventDefault();const e=t.touches[0];this.moveDrag(e.clientX,e.clientY)});M(this,"handleTouchUp",()=>{this.dragging&&this.endDrag()});M(this,"physicsTick",()=>{if(this.dragging){this.emitState(),this.rafId=requestAnimationFrame(this.physicsTick);return}const t=-this.springK*this.posX,e=-this.springK*this.posY;this.velX=(this.velX+t)*this.springD,this.velY=(this.velY+e)*this.springD,this.velX*=this.tossDecay,this.velY*=this.tossDecay,this.posX+=this.velX,this.posY+=this.velY,this.emitState();const i=Math.hypot(this.posX,this.posY),s=Math.hypot(this.velX,this.velY);if(i<.3&&s<.1){this.posX=0,this.posY=0,this.velX=0,this.velY=0,this.animating=!1,this.emitState();return}this.rafId=requestAnimationFrame(this.physicsTick)});this.el=t,this.onUpdate=e,this.onDragStart=i==null?void 0:i.onDragStart,this.onDragEnd=i==null?void 0:i.onDragEnd,this.el.addEventListener("mousedown",this.handlePointerDown),window.addEventListener("mousemove",this.handlePointerMove),window.addEventListener("mouseup",this.handlePointerUp),this.el.addEventListener("touchstart",this.handleTouchDown,{passive:!1}),window.addEventListener("touchmove",this.handleTouchMove,{passive:!1}),window.addEventListener("touchend",this.handleTouchUp)}startDrag(t,e){var i;this.dragging=!0,this.startPointerX=t-this.posX,this.startPointerY=e-this.posY,this.lastPointerX=t,this.lastPointerY=e,this.lastPointerTime=performance.now(),this.velocitySamples=[],this.velX=0,this.velY=0,this.el.style.cursor="grabbing",(i=this.onDragStart)==null||i.call(this),this.startPhysicsLoop()}moveDrag(t,e){const i=performance.now(),s=Math.max(1,i-this.lastPointerTime);this.velocitySamples.push({x:(t-this.lastPointerX)/s,y:(e-this.lastPointerY)/s}),this.velocitySamples.length>this.MAX_SAMPLES&&this.velocitySamples.shift(),this.posX=t-this.startPointerX,this.posY=e-this.startPointerY,this.lastPointerX=t,this.lastPointerY=e,this.lastPointerTime=i}endDrag(){var t;if(this.dragging=!1,this.el.style.cursor="pointer",this.velocitySamples.length>0){let e=0,i=0;for(const h of this.velocitySamples)e+=h.x,i+=h.y;const s=this.velocitySamples.length;this.velX=e/s*16,this.velY=i/s*16;const c=25,a=Math.hypot(this.velX,this.velY);a>c&&(this.velX=this.velX/a*c,this.velY=this.velY/a*c)}(t=this.onDragEnd)==null||t.call(this),this.startPhysicsLoop()}startPhysicsLoop(){this.animating||(this.animating=!0,this.rafId=requestAnimationFrame(this.physicsTick))}emitState(){let t=1,e=1,i=0;if(this.dragging){const s=this.posX,c=this.posY,a=Math.hypot(s,c),h=Math.min(this.maxStretch,a*.002),$=Math.atan2(c,s);t=1+h*Math.abs(Math.cos($)),e=1-h*.5*Math.abs(Math.cos($)),Math.abs(Math.sin($))>Math.abs(Math.cos($))&&(e=1+h*Math.abs(Math.sin($)),t=1-h*.5*Math.abs(Math.sin($))),i=Math.atan2(c,s)*.06}else{const s=Math.hypot(this.velX,this.velY),c=Math.min(this.maxStretch,s*.012),a=Math.atan2(this.velY,this.velX);t=1+c*Math.abs(Math.cos(a)),e=1-c*.6*Math.abs(Math.cos(a)),Math.abs(Math.sin(a))>Math.abs(Math.cos(a))&&(e=1+c*Math.abs(Math.sin(a)),t=1-c*.6*Math.abs(Math.sin(a))),i=Math.atan2(this.velY,this.velX)*.04}this.onUpdate({offsetX:this.posX,offsetY:this.posY,scaleX:t,scaleY:e,rotation:i,isDragging:this.dragging})}destroy(){this.rafId!==null&&cancelAnimationFrame(this.rafId),this.el.removeEventListener("mousedown",this.handlePointerDown),window.removeEventListener("mousemove",this.handlePointerMove),window.removeEventListener("mouseup",this.handlePointerUp),this.el.removeEventListener("touchstart",this.handleTouchDown),window.removeEventListener("touchmove",this.handleTouchMove),window.removeEventListener("touchend",this.handleTouchUp)}}function ft(){return typeof window>"u"||!window.matchMedia?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function pt(o){if(typeof window>"u"||!window.matchMedia)return()=>{};const t=window.matchMedia("(prefers-reduced-motion: reduce)"),e=i=>o(i.matches);return t.addEventListener?(t.addEventListener("change",e),()=>t.removeEventListener("change",e)):(t.addListener(e),()=>t.removeListener(e))}function Ht(o){let t=o.trim().replace("#","");if(t.length===3&&(t=t.split("").map(e=>e+e).join("")),t.length===6){const e=parseInt(t,16);return[(e>>16&255)/255,(e>>8&255)/255,(e&255)/255]}return[0,0,0]}function Pe(o){const[t,e,i]=Ht(o),s=$=>$<=.03928?$/12.92:Math.pow(($+.055)/1.055,2.4),c=s(t),a=s(e),h=s(i);return .2126*c+.7152*a+.0722*h}function bt(o,t){const e=Pe(o),i=Pe(t),s=Math.max(e,i),c=Math.min(e,i);return(s+.05)/(c+.05)}function Kt(o,t,e=3){const i=bt(o,t);return{ratio:Number(i.toFixed(2)),passes:i>=e}}const eo={happy:{baseColor:"#F7C6CE",strokeColor:"#1c1917"},excited:{baseColor:"#FFD54F",strokeColor:"#1c1917"},celebrate:{baseColor:"#FF80AB",strokeColor:"#1c1917"},laughing:{baseColor:"#FFE082",strokeColor:"#1c1917"},playful:{baseColor:"#F48FB1",strokeColor:"#1c1917"},proud:{baseColor:"#CE93D8",strokeColor:"#1c1917"},idle:{baseColor:"#F7C6CE",strokeColor:"#1c1917"},sleeping:{baseColor:"#9FA8DA",strokeColor:"#1A237E"},drowsy:{baseColor:"#C5CAE9",strokeColor:"#283593"},"powering-down":{baseColor:"#78909C",strokeColor:"#263238"},bored:{baseColor:"#B0BEC5",strokeColor:"#37474F"},angry:{baseColor:"#EF5350",strokeColor:"#B71C1C"},alerting:{baseColor:"#FF7043",strokeColor:"#BF360C"},notifying:{baseColor:"#FFA726",strokeColor:"#E65100"},suspicious:{baseColor:"#D4E157",strokeColor:"#33691E"},thinking:{baseColor:"#4DD0E1",strokeColor:"#006064"},searching:{baseColor:"#26C6DA",strokeColor:"#004D40"},loading:{baseColor:"#4FC3F7",strokeColor:"#01579B"},listening:{baseColor:"#81C784",strokeColor:"#1B5E20"},dictating:{baseColor:"#AED581",strokeColor:"#33691E"},writing:{baseColor:"#FFF176",strokeColor:"#F57F17"},orbit:{baseColor:"#80DEEA",strokeColor:"#00838F"},radar:{baseColor:"#4DB6AC",strokeColor:"#004D40"},progress:{baseColor:"#64B5F6",strokeColor:"#0D47A1"},sad:{baseColor:"#90CAF9",strokeColor:"#1565C0"},scared:{baseColor:"#B39DDB",strokeColor:"#4527A0"},confused:{baseColor:"#FFE082",strokeColor:"#E65100"},curious:{baseColor:"#A5D6A7",strokeColor:"#1B5E20"},shy:{baseColor:"#F48FB1",strokeColor:"#880E4F"},waking:{baseColor:"#FFF59D",strokeColor:"#F57F17"},spawning:{baseColor:"#E1BEE7",strokeColor:"#4A148C"}};function $t(o){let t=o.trim().replace("#","");t.length===3&&(t=t.split("").map(i=>i+i).join(""));const e=parseInt(t,16);return isNaN(e)?{r:247,g:198,b:206}:{r:e>>16&255,g:e>>8&255,b:e&255}}function gt(o,t,e){const i=$t(o),s=$t(t),c=Math.max(0,Math.min(1,e)),a=Math.round(i.r+(s.r-i.r)*c),h=Math.round(i.g+(s.g-i.g)*c),$=Math.round(i.b+(s.b-i.b)*c),g=d=>d.toString(16).padStart(2,"0");return`#${g(a)}${g(h)}${g($)}`}function to(o,t){return{baseColor:t,strokeColor:"#1c1917"}}function Q(o,t,e){const i=o/t%1;return i<e?Math.sin(i/e*Math.PI):0}const Ie={bouncy(o,t,e,i){const s=Math.abs(Math.sin(t*e));o.bob+=s*i-i*.5,o.cheek+=s*.15,o.eyeScale+=s*.04,o.turnAngle+=Math.sin(t*e*.5)*.05},flutter(o,t,e,i){const s=Math.sin(t*e);o.shiftX+=s*i,o.bob+=Math.cos(t*e*.7)*i*.5,o.turnAngle+=s*.06,o.eyeScale-=Math.abs(s)*.03},serene(o,t,e,i){const s=Math.sin(t*e);o.bob+=s*i,o.eyeScale+=s*.05,o.cheek+=(s+1)*.06,o.turnAngle+=Math.sin(t*e*.4-.6)*.045},float(o,t,e,i){o.bob+=Math.sin(t*e)*i,o.shiftX+=Math.sin(t*e*.5)*i*1.1,o.turnAngle+=Math.sin(t*e*.5-.9)*.07},calm(o,t,e,i){const s=Math.sin(t*e);o.bob+=s*i,o.eyeScale+=s*.025,o.gazeX+=Math.sin(t*e*.23)*2.5,o.turnAngle+=Math.sin(t*e*.31)*.03},droop(o,t,e,i){const s=t*e*.18%1,c=s<.82?s/.82:1-(s-.82)/.18;o.bob+=c*i*2.2,o.eyeOpen=Math.max(0,o.eyeOpen-c*.45),o.browY+=c*2,o.turnAngle+=c*.12},sob(o,t,e,i){const s=Math.sin(t*e)+Math.sin(t*e*2.7)*.4;o.bob+=s*i,o.browY+=1+Math.sin(t*e)*.8,o.gazeY+=1.5,o.mouthCurve-=.05+Math.abs(Math.sin(t*e))*.05},jitter(o,t,e,i){o.shiftX+=(Math.random()-.5)*i,o.bob+=(Math.random()-.5)*i,o.gazeX+=Math.sin(t*e*1.7)*4+(Math.random()-.5)*2,o.turnAngle+=(Math.random()-.5)*.03},fiery(o,t,e,i){const s=Math.sin(t*e*3.1)*.35,c=Math.pow(Math.max(0,Math.sin(t*e*.35)),6);o.bob+=s*i-c*i*1.8,o.shiftX+=s*i*.5,o.eyeScale+=c*.18,o.browY-=c*2.5,o.browTilt-=c*.25},wilt(o,t,e,i){const s=(Math.sin(t*e*.6)+1)/2;o.bob+=s*i*1.8,o.mouthCurve-=s*.12,o.browY+=s*1.6,o.eyeScale-=s*.05},dizzy(o,t,e,i){o.shiftX+=Math.sin(t*e)*i,o.bob+=Math.cos(t*e)*i*.7,o.turnAngle+=Math.sin(t*e)*.14,o.gazeX+=Math.cos(t*e)*3},snooze(o,t,e,i){const s=Math.sin(t*e);o.bob+=s*i*1.6,o.eyeScale+=s*.06,o.eyeOpen*=.35,o.cheek+=(s+1)*.05,o.turnAngle+=Math.sin(t*e-.8)*.05},pop(o,t,e,i){const s=Q(t,1/(e*.1),.18),c=Math.sin(t*e*1.6)*.18;o.bob+=c*i-s*i*2.2,o.eyeScale+=c*.02+s*.22,o.browY-=s*3,o.mouthOpen+=s*.25},drift(o,t,e,i){o.bob+=Math.sin(t*e)*i*.6;const s=Q(t,3.7,.04);o.shiftX+=s*(Math.random()-.5)*5,o.gazeX+=s*(Math.random()-.5)*6,o.eyeScale-=s*.08}};function Mt(o,t,e,i,s,c=1){(Ie[o]||Ie.calm)(t,e,i,s*c)}const vt={sleeping(o,t){const e=Math.sin(t*.9);o.eyeOpen=.05,o.bob+=e*2.4,o.eyeScale+=e*.04,o.bob+=Q(t,9,.15)*1.8},waking(o,t){const e=Q(t,4,.4);o.bob+=Math.sin(t*2.2)*1.6-e*3,o.eyeOpen=Math.min(1,.35+e*.65),o.eyeScale+=e*.1,o.turnAngle+=Math.sin(t*1.1)*.06},listening(o,t){o.turnAngle+=.1+Math.sin(t*1.4)*.03,o.bob+=Q(t,2.6,.25)*2.2,o.eyeScale+=.06,o.gazeY-=.8},thinking(o,t){o.gazeX+=-6+Math.sin(t*.9)*3,o.gazeY+=-4+Math.cos(t*.7)*2,o.browY-=1+Math.sin(t*1.3)*.8,o.turnAngle+=Math.sin(t*.6)*.05},searching(o,t){o.gazeX+=Math.sin(t*5.5)*11,o.gazeY+=Math.sin(t*2.3)*2.5,o.turnAngle+=Math.sin(t*5.5)*.05,o.eyeScale+=.05},working(o,t){o.bob+=Math.sin(t*3.4)*1.4,o.turnAngle+=Math.sin(t*3.4-.5)*.035,o.gazeY+=1.5,o.mouthWidth*=.9},excited(o,t){o.bob+=-Math.abs(Math.sin(t*7))*5.5,o.eyeScale+=.1+Math.abs(Math.sin(t*7))*.06,o.cheek+=.2,o.turnAngle+=Math.sin(t*3.5)*.07},surprised(o,t){o.bob+=Math.sin(t*9)*.9,o.eyeScale+=.12,o.browY-=1.5,o.shiftX+=Math.sin(t*13)*.4},suspicious(o,t){o.gazeX+=-7+Math.sin(t*.5)*2.5,o.eyeScale-=.08,o.browTilt-=.12,o.bob+=Math.sin(t*.8)*.5},angry(o,t){o.shiftX+=(Math.random()-.5)*3,o.bob+=(Math.random()-.5)*2;const e=Q(t,2.2,.3);o.browY-=e*2,o.browTilt-=e*.2},drowsy(o,t){const e=(Math.sin(t*.8)+1)/2;o.bob+=e*3,o.eyeOpen=Math.max(.08,.5-e*.4),o.eyeOpen+=Q(t,6.5,.08)*.5,o.browY+=e*2},happy(o,t){o.bob+=-Math.abs(Math.sin(t*3.2))*2.4,o.cheek+=.15+Math.abs(Math.sin(t*3.2))*.1,o.turnAngle+=Math.sin(t*1.6)*.05},curious(o,t){o.turnAngle+=Math.sin(t*1.2)*.13,o.gazeX+=Math.sin(t*2.1)*6,o.eyeScale+=.08,o.bob+=Math.sin(t*2.4)*1},confused(o,t){o.turnAngle+=Math.sin(t*.9)*.16,o.shiftX+=Math.sin(t*.9)*1.8,o.browTilt+=.15+Math.sin(t*1.7)*.1,o.gazeX+=Math.sin(t*.6)*4},bored(o,t){o.shiftX+=Math.sin(t*.5)*2.2,o.gazeX+=6+Math.sin(t*.3)*3,o.eyeOpen=Math.min(o.eyeOpen,.5),o.bob+=Q(t,7,.2)*2},proud(o,t){o.bob+=-2+Math.sin(t*1.1)*.8,o.turnAngle+=Math.sin(t*.7)*.04,o.gazeY-=2,o.cheek+=.1},shy(o,t){o.bob+=1.5+Math.sin(t*1.3)*.7,o.gazeX+=-4+Math.sin(t*.9)*1.5,o.gazeY+=4,o.cheek+=.25,o.eyeScale-=.06},sad(o,t){o.bob+=2+Math.sin(t*.9)*1.4,o.gazeY+=3,o.browY+=1.5,o.turnAngle+=Math.sin(t*.5)*.03},laughing(o,t){o.bob+=-Math.abs(Math.sin(t*9))*4,o.mouthOpen+=.2+Math.abs(Math.sin(t*9))*.3,o.cheek+=.3,o.turnAngle+=Math.sin(t*4.5)*.05},scared(o,t){o.shiftX+=Math.sin(t*22)*1.2,o.bob+=1.2+Math.sin(t*18)*.8,o.eyeScale+=.14,o.browTilt+=.2},playful(o,t){o.bob+=(Math.sin(t*4.3)+Math.sin(t*6.7)*.5)*1.8,o.turnAngle+=Math.sin(t*3.1)*.11,o.shiftX+=Math.sin(t*2.2)*1.5,o.cheek+=.18},celebrate(o,t){o.bob+=-Math.abs(Math.sin(t*5))*7,o.turnAngle+=Math.sin(t*2.5)*.18,o.cheek+=.35,o.eyeScale+=.1},orbit(o,t){o.gazeX+=Math.cos(t*2.2)*10,o.gazeY+=Math.sin(t*2.2)*6,o.turnAngle+=Math.cos(t*2.2)*.06},radar(o,t){const e=Math.sin(t*1.6);o.gazeX+=Math.sign(e)*Math.pow(Math.abs(e),.45)*11,o.turnAngle+=e*.05,o.eyeScale+=.04},progress(o,t){const e=Math.pow(Math.max(0,Math.sin(t*3)),3);o.bob+=-e*3,o.eyeScale+=e*.09},spawning(o,t){const e=Math.exp(-(t*1.5%6)*.7);o.bob+=-Math.sin(t*6)*4*e,o.eyeScale+=e*.15},humming(o,t){o.bob+=Math.sin(t*2.6)*1.6,o.mouthOpen+=.1+Math.abs(Math.sin(t*2.6))*.08,o.turnAngle+=Math.sin(t*1.3)*.05,o.cheek+=.12},loading(o,t){o.eyeScale+=Math.sin(t*1.8)*.08,o.bob+=Math.sin(t*1.8)*1.2,o.gazeY+=Math.sin(t*.9)*1.5},dictating(o,t){o.mouthOpen=.25+Math.abs(Math.sin(t*11))*.4,o.bob+=Math.sin(t*2)*.6,o.browY-=.5},writing(o,t){o.gazeY+=4,o.gazeX+=Math.sin(t*4.5)*5,o.bob+=Math.abs(Math.sin(t*4.5))*1.2},sending(o,t){const e=Q(t,1.6,.3);o.shiftX+=e*4,o.bob+=-e*2,o.turnAngle+=e*.08},receiving(o,t){const e=Q(t,1.6,.3);o.shiftX+=-e*4,o.bob+=e*1.5,o.eyeScale+=e*.12},uploading(o,t){const e=1-t*.7%1;o.bob+=e*4-2,o.gazeY-=2,o.eyeScale+=(1-e)*.05},notifying(o,t){const e=Q(t,2.4,.12)+Q(t-.22,2.4,.12);o.bob+=-e*4,o.eyeScale+=e*.12,o.turnAngle+=e*.06},alerting(o,t){o.shiftX+=Math.sin(t*16)*2.5,o.bob+=Math.sin(t*12)*1.5,o.eyeScale+=.16,o.browY-=2},dragging(o,t){o.turnAngle+=Math.sin(t*2.4-1.2)*.14,o.shiftX+=Math.sin(t*2.4)*2,o.bob+=Math.cos(t*2.4-1.2)*1.5},bouncing(o,t){o.bob+=-Math.abs(Math.sin(t*5.5))*8},"powering-down"(o,t){const e=Math.min(1,t%8/8);o.bob+=e*4,o.eyeOpen=Math.max(.03,.4-e*.37),o.eyeOpen+=Q(t,2.7,.05)*.3,o.eyeScale-=e*.1}};function kt(o,t,e,i,s){const c=vt[o];return c?(c(t,e,i,s),!0):!1}const Ct=600;function Tt(o){let t=null,e=!1;const i=()=>{t!==null&&(clearTimeout(t),t=null),e=!1};return{play:(c,a={})=>{if(i(),c.length===0)return;const h=a.mode??"once";e=!0;let $=0,g=1;const d=()=>{if(!e)return;const v=c[$];o.applyStep(o.resolveStep(v)),t=setTimeout(()=>{var k;if(h==="ping-pong")c.length>1&&(($+g>=c.length||$+g<0)&&(g=-g),$+=g);else if($+=1,$>=c.length)if(h==="loop")$=0;else{i(),(k=a.onComplete)==null||k.call(a);return}d()},v.duration??Ct)};d()},stop:i,isPlaying:()=>e}}const Le=[{label:"Interacción",states:["idle","near","hover","click"]},{label:"Ciclo de vida",states:["sleeping","waking","listening","thinking","searching","working"]},{label:"Reacciones",states:["excited","surprised","suspicious","angry","drowsy","happy","curious","confused","bored","proud","shy","sad","laughing","scared","playful","celebrate"]},{label:"Morfos de agente",states:["orbit","radar","progress"]},{label:"Ciclo de producto",states:["spawning","humming","loading","dictating","writing","sending","receiving","uploading","notifying","alerting","dragging","bouncing","powering-down"]}],St=Le.flatMap(o=>o.states),wt=["idle","near","hover","click"],Yt=Le.find(o=>o.label==="Reacciones").states,Et=St.filter(o=>!wt.includes(o));function xt(o,t){return o??t??Yt}function Ft(o,t){if(o.length<=1)return o[0];let e=o[Math.floor(Math.random()*o.length)];for(;e===t;)e=o[Math.floor(Math.random()*o.length)];return e}class At{constructor(t=[],e={}){M(this,"instances",new Map);M(this,"options");M(this,"connectedPairs",new Map);M(this,"isRunning",!1);M(this,"update",()=>{const t=Array.from(this.instances.values());if(t.length<2)return;const e=new Set;for(let i=0;i<t.length;i++)for(let s=i+1;s<t.length;s++){const c=t[i],a=t[s],h=c.getPosition(),$=a.getPosition(),g=$.x-h.x,d=$.y-h.y,v=Math.hypot(g,d);if(v<=this.options.proximityThreshold&&v>0){const k=this.getPairKey(c.id,a.id);if(e.add(k),this.options.enableGazeSync){const z=Math.max(-.8,Math.min(.8,g/160))*22,j=Math.max(-.8,Math.min(.8,d/160))*14;c.setGaze({x:z,y:j}),a.setGaze({x:-z,y:-j})}let x=this.connectedPairs.get(k);x?Math.random()<.08&&this.options.enableSynergies&&(c.triggerParticles(1),a.triggerParticles(1)):(x={idA:c.id,idB:a.id,connectedSince:Date.now()},this.connectedPairs.set(k,x),this.triggerSynergy(c,a))}}for(const[i,s]of this.connectedPairs.entries())if(!e.has(i)){const c=this.instances.get(s.idA),a=this.instances.get(s.idB);c&&c.setGaze({x:0,y:0}),a&&a.setGaze({x:0,y:0}),this.connectedPairs.delete(i)}});this.options={proximityThreshold:e.proximityThreshold??220,enableGazeSync:e.enableGazeSync??!0,enableSynergies:e.enableSynergies??!0},t.forEach(i=>this.add(i)),this.start()}add(t){!t||!t.id||this.instances.set(t.id,t)}remove(t){!t||!t.id||this.instances.delete(t.id)}start(){this.isRunning||(this.isRunning=!0,O.add(this.update))}stop(){this.isRunning&&(this.isRunning=!1,O.remove(this.update))}getPairKey(t,e){return t<e?`${t}:${e}`:`${e}:${t}`}triggerSynergy(t,e){if(!this.options.enableSynergies)return;const i=t.emotionCategory||"happy",s=e.emotionCategory||"happy";if(q.playSound(i,"hover"),t.triggerParticles(6),e.triggerParticles(6),i==="happy"&&s==="happy")t.bounce(),e.bounce();else if(i==="happy"&&s==="sad"||i==="sad"&&s==="happy"){const c=i==="happy"?t:e,a=i==="sad"?t:e;c.setEmotion("hover"),a.setEmotion("near")}else(i==="intense"||s==="intense")&&(t.spin(.5),e.spin(.5))}destroy(){this.stop(),this.instances.clear(),this.connectedPairs.clear()}}function zt(o=[],t={}){return new At(o,t)}const Pt="wissive:custom:";function oo(o){const t={};for(const e in o)t[e]=o[e].map(i=>({...i}));return t}function It(o,t={}){var g,d,v;const e=t.eyesFrom?H[t.eyesFrom]:void 0,i=t.mouthFrom?H[t.mouthFrom]:void 0,s=t.motionFrom?H[t.motionFrom]:void 0,c=t.particlesFrom?H[t.particlesFrom]:void 0,a=t.soundFrom?H[t.soundFrom]:void 0,h=oo(he.expressions);for(const k in h){const x=e&&(((g=e.expressions[k])==null?void 0:g[0])??e.expressions.idle[0]),z=i&&(((d=i.expressions[k])==null?void 0:d[0])??i.expressions.idle[0]);h[k]=h[k].map(j=>({...j,...x&&{eyeType:x.eyeType,eyeScale:x.eyeScale},...z&&{mouthType:z.mouthType,mouthCurve:z.mouthCurve,mouthWidth:z.mouthWidth},...t.eyeTypeOverride!==void 0&&{eyeType:t.eyeTypeOverride},...t.mouthTypeOverride!==void 0&&{mouthType:t.mouthTypeOverride}}))}const $=(v=t.stateBank)==null?void 0:v.filter(k=>Et.includes(k));return{name:o,emotion:"custom",baseColor:t.baseColor||he.baseColor,silhouette:t.silhouette||"circle",motion:s?{...s.motion}:{...he.motion},expressions:h,particleEmotion:c==null?void 0:c.emotion,soundEmotion:a==null?void 0:a.emotion,...$&&$.length>0&&{autonomousStatePool:$}}}function Lt(o,t){localStorage.setItem(Pt+o,JSON.stringify(t))}function io(o){const t=localStorage.getItem(Pt+o);return t?JSON.parse(t):null}function no(o,t={}){const e=It(o,t);return H[o]=e,Lt(o,e),e}const ao={idle:1,near:.7,hover:.5,click:.35},Xt={xs:48,sm:80,base:120,lg:160,xl:200,"2xl":240};function Xe(o="base"){return typeof o=="number"?o:Xt[o]??120}function Dt(o,t){const{target:e,size:i="base",interactive:s=!0,draggable:c=!0,nearRadius:a=120,sound:h=!0,flipX:$=!1,emphasis:g=!1,gazeTracking:d=!1,ambientParticles:v=!0,autonomousStates:k=!0,autonomousStatePool:x,reducedMotion:z="auto",theme:j="auto"}=t,L=Ee(o)||Ee("mochi"),W=L.motion;let R=Xe(i),J=z,ee=j,re=L.baseColor;const te=L.particleEmotion||L.emotion,ae=L.soundEmotion||L.emotion,G=()=>typeof J=="boolean"?J:ft(),A=document.createElement("div");A.className="wissive-wrapper",A.style.width=`${R}px`,A.style.height=`${R}px`,A.style.display="inline-block",A.style.position="relative";const n=document.createElement("div");n.className="wissive-emoji",n.setAttribute("role","img"),s&&n.setAttribute("tabindex","0");const De={idle:"Reposo",near:"Cerca",hover:"Hover",click:"Presionado"},ue=f=>{n.setAttribute("aria-label",`${L.name} (${L.emotion}) emoji - Estado: ${De[f]||f}`)};ue("idle"),n.style.width=`${R}px`,n.style.height=`${R}px`,n.style.display="inline-block",n.style.userSelect="none",n.style.cursor=s?"pointer":"default",n.style.willChange="transform",n.style.transformOrigin="center center",A.appendChild(n),e.appendChild(A);const Me=pt(()=>{oe()});let de=$,le=g,se=d,Z=h,me=c,ve=v,S=k,m=xt(x,L.autonomousStatePool);const u=new ot,Y=L.expressions.idle,ye=u.pickVariant(Y,"idle"),_=tt(ye,{stiffness:W.stiffness,damping:W.damping});let ce=!1,r=!1,l=!1,C=Math.random()*100,T=!1,X=null,b=null;const P=new mt(A,R);let I={offsetX:0,offsetY:0,scaleX:1,scaleY:1,rotation:0},w=null;const E=()=>{w||(w=new yt(n,f=>{I=f,D()},{onDragStart:()=>{Z&&q.playSound(ae,"click")},onDragEnd:()=>{P.burst(te,10),Z&&q.playSound(ae,"bounce")}}))};me&&s&&E();const D=()=>{const f=G(),F=f?0:W.idleSpeed*.35,B=f?0:.04,U=1+B*Math.cos(C*F),V=1-B*Math.sin(C*F),be=I.offsetX!==0||I.offsetY!==0||I.scaleX!==1||I.scaleY!==1;let Oe,We,Be;be?(Oe=U*I.scaleX,We=V*I.scaleY,Be=I.rotation):(Oe=U,We=V,Be=0);const ro=I.offsetX,lo=I.offsetY;n.style.transform=`translate(${ro.toFixed(1)}px, ${lo.toFixed(1)}px) rotate(${(Be*180/Math.PI).toFixed(2)}deg) scale(${Oe.toFixed(4)}, ${We.toFixed(4)})`},oe=()=>{const f=_.getValues(),F=u.getState();let B=L.baseColor;if(typeof ee=="object"&&ee.baseColor&&(B=ee.baseColor),re=gt(re,B,.15),T&&(f.eyeOpen=.05),!G()&&!kt(F,f,C,W.idleSpeed,W.idleAmplitude)){const V=ao[F]??1;Mt(W.motionType,f,C,W.idleSpeed,W.idleAmplitude,V)}D(),n.innerHTML=xe(L.silhouette,re,f,R,{flipX:de,emphasis:le},C)},fe=(f=u.getState())=>{u.setState(f);const F=u.resolvePool(L.expressions,f);if(!(!F||F.length===0)){if(F.length===1){const B=u.pickVariant(F,f);_.setTargets(B),O.add(N);return}T=!0,O.add(N),setTimeout(()=>{const B=u.pickVariant(F,f);_.setTargets(B),O.add(N),setTimeout(()=>{T=!1,O.add(N)},120)},100)}},K=f=>{ue(f),fe(f)},ie=Tt({resolveStep(f){return{...f.state?u.pickVariant(u.resolvePool(L.expressions,f.state),f.state):{},...f.params}},applyStep(f){_.setTargets(f),O.add(N)}}),N=f=>{C+=f;const F=_.update(f);oe(),!F&&u.getState()!=="idle"&&O.remove(N)};O.add(N);const Ot=()=>{const B=3e3+Math.random()*4e3;b=window.setTimeout(()=>{u.getState()==="idle"&&!T&&(T=!0,O.add(N),X=window.setTimeout(()=>{T=!1,O.add(N)},180)),Ot()},B)};Ot();let ke=null;const Wt=()=>{const f=W.idleIntervalMin,F=W.idleIntervalMax,B=f+Math.random()*(F-f);ke=window.setTimeout(()=>{u.getState()==="idle"&&!ie.isPlaying()&&fe("idle"),Wt()},B)};Wt();let Ce=null,Te=null;const Bt=()=>{const B=3500+Math.random()*4500;Ce=window.setTimeout(()=>{if(u.getState()==="idle"&&!se&&!ie.isPlaying()){const U=[{x:-9,y:0},{x:9,y:0},{x:-7,y:-4},{x:7,y:-4},{x:0,y:-5},{x:0,y:4}],V=U[Math.floor(Math.random()*U.length)];_.setTargets({gazeX:V.x,gazeY:V.y}),O.add(N);const be=1200+Math.random()*1500;Te=window.setTimeout(()=>{se||(_.setTargets({gazeX:0,gazeY:0}),O.add(N))},be)}Bt()},B)};Bt();let Se=null;const jt=()=>{const B=3500+Math.random()*5e3;Se=window.setTimeout(()=>{if(ve&&!G()){const U=u.getState();if(U==="idle"||U==="near"||U==="hover"){const V=Math.floor(2+Math.random()*3);P.burst(te,V)}}jt()},B)};jt();let we=null,Ye=null,_t=null;const Rt=()=>{const B=5e3+Math.random()*6e3;we=window.setTimeout(()=>{if(S&&m.length>0&&!G()&&!ie.isPlaying()&&u.getState()==="idle"&&!ce&&!r&&!l){const V=Ft(m,_t);_t=V,K(V);const be=1800+Math.random()*2200;Ye=window.setTimeout(()=>{u.getState()===V&&!ce&&!r&&!l&&K("idle")},be)}Rt()},B)};Rt();const so=()=>{ke!==null&&(clearTimeout(ke),ke=null),b!==null&&(clearTimeout(b),b=null),X!==null&&(clearTimeout(X),X=null),Ce!==null&&(clearTimeout(Ce),Ce=null),Te!==null&&(clearTimeout(Te),Te=null),Se!==null&&(clearTimeout(Se),Se=null),we!==null&&(clearTimeout(we),we=null),Ye!==null&&(clearTimeout(Ye),Ye=null)};let Ge=null;const pe=()=>l?"click":r?"hover":ce?"near":"idle";return s&&(Ge=rt(n,{onHoverStart:()=>{r=!0,Z&&q.playSound(ae,"hover"),K(pe())},onHoverEnd:()=>{r=!1,K(pe())},onClickStart:()=>{l=!0,Z&&q.playSound(ae,"click"),G()||P.burst(te,8),K(pe())},onClickEnd:()=>{l=!1,K(pe())},onNearChange:f=>{ce=f,K(pe())},onGazeMove:(f,F)=>{se&&(_.setTargets({gazeX:f,gazeY:F}),O.add(N))}},a)),{id:"wissive-"+Math.random().toString(36).substring(2,9),name:L.name,emotionCategory:L.emotion,getElement(){return n},getPosition(){const f=n.getBoundingClientRect();return{x:f.left+f.width/2,y:f.top+f.height/2}},getCurrentState(){return u.getState()},setEmotion(f){G()||(f==="click"?P.burst(te,8):f==="hover"&&P.burst(te,4)),K(f)},spin(f=1){const F=_.getValues().turnAngle||0;_.setTargets({turnAngle:F+Math.PI*2*f}),O.add(N)},bounce(){Z&&q.playSound(ae,"bounce"),G()||P.burst(te,5);const f=_.getValues().bob||0;_.setTargets({bob:f-14}),O.add(N)},setGaze(f){_.setTargets({gazeX:f.x,gazeY:f.y}),O.add(N)},setGazeTracking(f){se=f,f||(_.setTargets({gazeX:0,gazeY:0}),O.add(N))},setSound(f){Z=f},setDraggable(f){me=f,f&&!w&&s?E():!f&&w&&(w.destroy(),w=null,I={offsetX:0,offsetY:0,scaleX:1,scaleY:1,rotation:0,isDragging:!1},D())},setFlipX(f){de=f,oe()},setEmphasis(f){le=f,oe()},setAmbientParticles(f){ve=f},setAutonomousStates(f){S=f},setAutonomousStatePool(f){m=f},setReducedMotion(f){J=f,oe()},setTheme(f){ee=f,oe()},setSize(f){R=Xe(f),A.style.width=`${R}px`,A.style.height=`${R}px`,n.style.width=`${R}px`,n.style.height=`${R}px`,P.resize(R),oe()},triggerParticles(f=8){G()||P.burst(te,f)},playSequence(f,F){ie.play(f,F)},stopSequence(){ie.stop(),fe(u.getState())},isSequencePlaying(){return ie.isPlaying()},destroy(){ie.stop(),so(),Me(),O.remove(N),P.destroy(),w&&w.destroy(),Ge&&Ge(),A.remove()}}}const Gt={create:Dt,createGroup:zt,setGlobalSound:ct,isGlobalSoundEnabled:ht,setGlobalVolume:ut,getGlobalVolume:dt,supportsHover:Fe,isTouchDevice:at};p.ALL_STATES=St,p.ALL_WANDERABLE_STATES=Et,p.AUTONOMOUS_STATES=Yt,p.DEFAULT_STEP_MS=Ct,p.DragPhysics=yt,p.EMOJI_BRIX=Qe,p.EMOJI_COTA=he,p.EMOJI_DOZY=Ze,p.EMOJI_FIDGE=Je,p.EMOJI_KNOT=qe,p.EMOJI_LUMO=Ne,p.EMOJI_MOCHI=ne,p.EMOJI_NIMA=Re,p.EMOJI_PIP=He,p.EMOJI_SNUG=Ue,p.EMOJI_SURI=_e,p.EMOJI_VOID=Ke,p.EMOJI_WILT=Ve,p.EMOJI_ZUMI=je,p.EmojiGroup=At,p.IDLE_MOTIONS=Ie,p.LIB=H,p.PERSONALITY_DRIVEN_STATES=wt,p.ParticleEmitter=mt,p.SIZE_PRESETS=Xt,p.STATE_GROUPS=Le,p.STATE_MOTIONS=vt,p.STATE_THEME_MAP=eo,p.SoundEngine=lt,p.StateManager=ot,p.Wissive=Gt,p.applyIdleMotion=Mt,p.applyStateMotion=kt,p.attachEventListeners=rt,p.blendColors=gt,p.buildCustomEmoji=It,p.buildFace=xe,p.checkContrast=Kt,p.createCustomEmoji=no,p.createEmoji=Dt,p.createEmojiGroup=zt,p.createMultiSpring=tt,p.createSequencePlayer=Tt,p.default=Gt,p.getContrastRatio=bt,p.getEmojiDefinition=Ee,p.getGlobalVolume=dt,p.getLuminance=Pe,p.getSilhouettePath=nt,p.getThemeForState=to,p.isGlobalSoundEnabled=ht,p.isReducedMotionPreferred=ft,p.isTouchDevice=at,p.loadCustomEmoji=io,p.makeSpring=et,p.pickWithoutRepeat=Ft,p.renderSvgElement=Vt,p.resolveAutonomousStatePool=xt,p.resolveSize=Xe,p.saveCustomEmoji=Lt,p.setGlobalSound=ct,p.setGlobalVolume=ut,p.sharedLoop=O,p.soundEngine=q,p.subscribeToReducedMotion=pt,p.supportsHover=Fe,Object.defineProperties(p,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
204
|
+
`}resize(t){this.size=t,this.dpr=typeof window<"u"&&window.devicePixelRatio||1,this.setupCanvas()}burst(t,e=8,i,a){const r=this.size*2.5,s=i??r/2,c=a??r/2;for(let b=0;b<e;b++){const f=Math.PI*2*b/e+(Math.random()-.5)*.7,u=2.5+Math.random()*3.5,F=this.createParticle(t,s,c,f,u);this.particles.push(F)}this.animating||(this.animating=!0,this.tick())}createParticle(t,e,i,a,r){const s=10+Math.random()*15,c=e+Math.cos(a)*s,b=i+Math.sin(a)*s,f=.6+Math.random()*.5,u={x:c,y:b,vx:Math.cos(a)*r,vy:Math.sin(a)*r-1.2,life:f,maxLife:f,size:(6+Math.random()*8)*(this.size/120),rotation:Math.random()*Math.PI*2,rotSpeed:(Math.random()-.5)*.2,shape:"circle",color:"#F2A9B8",opacity:1},F=Math.random()>.6,v=w=>w[Math.floor(Math.random()*w.length)];switch(t){case"happy":u.shape=F?"sparkle":"heart",u.color=v(["#F2A9B8","#E3536C","#FF8FAB","#FFD1DC","#FFF0F5"]),u.vy-=.6;break;case"pleasure":u.shape=F?"circle":"petal",u.color=v(["#F28FC2","#FFC2DE","#FFE3F0","#E5739F"]),u.vy+=.9,u.vx*=.6,u.rotSpeed*=2.5,u.swayFreq=5+Math.random()*3,u.swayAmp=.9+Math.random()*.5;break;case"flutter":u.shape=F?"sparkle":"star",u.color=v(["#F2CB4E","#FFD700","#FFA500","#FFF4CC"]),u.vy-=1,u.vx*=1.5,u.rotSpeed*=2;break;case"peaceful":u.shape=F?"circle":"ring",u.color=v(["#9AC9A0","#B5E8B5","#7FD17F","#E8F5E9"]),u.vy-=.8,u.swayFreq=8+Math.random()*4,u.swayAmp=.4+Math.random()*.4;break;case"normal":u.shape=F?"circle":"dot",u.color=v(["#C9DCD3","#A8C7BB","#E4F0EA","#8FB3A4"]),u.size*=.65,u.vx*=.5,u.vy*=.5;break;case"tired":u.shape=F?"ring":"zzz",u.color=v(["#D6DBCF","#BFC7B8","#EDF0E8","#A9B3A0"]),u.vy-=1.2,u.vx*=.25,u.swayFreq=6+Math.random()*4,u.swayAmp=.5;break;case"sleepy":u.shape=F?"zzz":"bubble",u.color=v(["#AFCBE0","#D3E8F5","#ffffff","#8FB6D1"]),u.size*=1.35,u.vy-=1.5,u.vx*=.2,u.swayFreq=3+Math.random()*2,u.swayAmp=.7;break;case"sad":u.shape=F?"circle":"drop",u.color=v(["#7FA6D9","#A0C4E8","#6B9ACF","#E1F5FE"]),u.vy+=1.8,u.vx*=.3;break;case"disappointed":u.shape=F?"drop":"shard",u.color=v(["#EBD98A","#C9B86B","#F5E9B8","#A89550"]),u.vy+=1.2,u.vx*=.8,u.rotSpeed*=4;break;case"anxiety":u.shape=F?"circle":"zigzag",u.color=v(["#A99BD9","#C4B5F0","#8B7BC4","#D1C4E9"]),u.size*=.8,u.vx*=1.4;break;case"stress":u.shape=F?"zigzag":"spiral",u.color=v(["#C97F76","#E09A91","#A85F57","#F0BDB6"]),u.size*=.9,u.rotSpeed*=6,u.swayFreq=12+Math.random()*6,u.swayAmp=.6;break;case"anger":u.shape=F?"diamond":"ember",u.color=v(["#D9566A","#FF4444","#FF6B35","#FFA033"]),u.vy-=1.4,u.vx*=.7,u.size*=.9;break;case"surprised":u.shape=F?"dot":"burst",u.color=v(["#F0B98A","#FFCFA3","#FF9F1C","#FFE8D1"]),u.size*=1.15,u.vx*=1.8,u.vy*=1.8;break;case"numbness":u.shape=F?"dot":"glitch",u.color=v(["#D9C6E0","#C0A8CC","#EDE2F0","#A98FB8"]),u.vx*=.25,u.vy*=.25,u.life*=.6,u.rotSpeed=0;break;default:u.shape=F?"sparkle":"circle",u.color=v(["#F2A9B8","#F2CB4E","#9AC9A0"]);break}return u}drawParticle(t){const e=this.ctx,i=this.dpr,a=1-t.life/t.maxLife;let r=1;a<.18?r=a/.18:a>.65&&(r=(1-a)/.35),r=Math.max(0,Math.min(1.2,r));const s=t.size*r;if(s<=.1)return;const c=Math.max(0,Math.min(1,t.life/t.maxLife*1.2));switch(e.save(),e.translate(t.x*i,t.y*i),e.rotate(t.rotation),e.globalAlpha=c,t.shape){case"heart":e.fillStyle=t.color,e.beginPath(),e.moveTo(0,s*.35*i),e.bezierCurveTo(-s*.7*i,-s*.1*i,-s*.8*i,-s*.8*i,0,-s*.45*i),e.bezierCurveTo(s*.8*i,-s*.8*i,s*.7*i,-s*.1*i,0,s*.35*i),e.closePath(),e.fill();break;case"star":{e.fillStyle=t.color,e.beginPath();const b=5,f=s*i,u=s*.45*i;for(let F=0;F<b*2;F++){const v=F%2===0?f:u,w=F*Math.PI/b-Math.PI/2,A=Math.cos(w)*v,j=Math.sin(w)*v;F===0?e.moveTo(A,j):e.lineTo(A,j)}e.closePath(),e.fill();break}case"sparkle":{e.fillStyle=t.color,e.beginPath();const b=s*1.1*i;e.moveTo(0,-b),e.quadraticCurveTo(0,0,b,0),e.quadraticCurveTo(0,0,0,b),e.quadraticCurveTo(0,0,-b,0),e.quadraticCurveTo(0,0,0,-b),e.closePath(),e.fill();break}case"drop":e.fillStyle=t.color,e.beginPath(),e.moveTo(0,-s*.8*i),e.bezierCurveTo(s*.7*i,-s*.2*i,s*.6*i,s*.7*i,0,s*.7*i),e.bezierCurveTo(-s*.6*i,s*.7*i,-s*.7*i,-s*.2*i,0,-s*.8*i),e.closePath(),e.fill();break;case"diamond":e.fillStyle=t.color,e.beginPath(),e.moveTo(0,-s*i),e.lineTo(s*.65*i,0),e.lineTo(0,s*i),e.lineTo(-s*.65*i,0),e.closePath(),e.fill();break;case"zigzag":e.strokeStyle=t.color,e.lineWidth=Math.max(2,s*.25)*i,e.lineCap="round",e.lineJoin="round",e.beginPath(),e.moveTo(-s*.6*i,-s*.5*i),e.lineTo(-s*.1*i,-s*.1*i),e.lineTo(-s*.3*i,s*.1*i),e.lineTo(s*.6*i,s*.5*i),e.stroke();break;case"ring":e.strokeStyle=t.color,e.lineWidth=Math.max(1.5,s*.25)*i,e.beginPath(),e.arc(0,0,s*.55*i,0,Math.PI*2),e.stroke();break;case"zzz":e.strokeStyle=t.color,e.lineWidth=Math.max(2,s*.25)*i,e.lineCap="round",e.lineJoin="round",e.beginPath(),e.moveTo(-s*.4*i,-s*.5*i),e.lineTo(s*.4*i,-s*.5*i),e.lineTo(-s*.4*i,s*.5*i),e.lineTo(s*.4*i,s*.5*i),e.stroke();break;case"petal":e.fillStyle=t.color,e.beginPath(),e.moveTo(0,-s*.9*i),e.quadraticCurveTo(s*.75*i,-s*.1*i,0,s*.9*i),e.quadraticCurveTo(-s*.75*i,-s*.1*i,0,-s*.9*i),e.closePath(),e.fill();break;case"spiral":{e.strokeStyle=t.color,e.lineWidth=Math.max(1.5,s*.2)*i,e.lineCap="round",e.beginPath();const b=s*.85*i;vt().forEach(([f,u],F)=>{const v=f*b,w=u*b;F===0?e.moveTo(v,w):e.lineTo(v,w)}),e.stroke();break}case"bubble":e.strokeStyle=t.color,e.lineWidth=Math.max(1,s*.14)*i,e.beginPath(),e.arc(0,0,s*.6*i,0,Math.PI*2),e.stroke(),e.fillStyle=t.color,e.globalAlpha*=.7,e.beginPath(),e.arc(-s*.22*i,-s*.24*i,s*.13*i,0,Math.PI*2),e.fill();break;case"ember":{e.fillStyle=t.color,e.beginPath(),e.moveTo(0,-s*.95*i),e.bezierCurveTo(s*.5*i,-s*.2*i,s*.62*i,s*.55*i,0,s*.75*i),e.bezierCurveTo(-s*.62*i,s*.55*i,-s*.5*i,-s*.2*i,0,-s*.95*i),e.closePath(),e.fill();break}case"shard":e.fillStyle=t.color,e.beginPath(),e.moveTo(0,-s*.9*i),e.lineTo(s*.55*i,-s*.15*i),e.lineTo(s*.2*i,s*.85*i),e.lineTo(-s*.45*i,s*.3*i),e.closePath(),e.fill();break;case"burst":{e.strokeStyle=t.color,e.lineWidth=Math.max(1.5,s*.22)*i,e.lineCap="round",e.beginPath();for(let b=0;b<4;b++){const f=b*Math.PI/2,u=s*.3*i,F=s*i;e.moveTo(Math.cos(f)*u,Math.sin(f)*u),e.lineTo(Math.cos(f)*F,Math.sin(f)*F)}e.stroke();break}case"dot":e.fillStyle=t.color,e.beginPath(),e.arc(0,0,s*.28*i,0,Math.PI*2),e.fill();break;case"glitch":e.fillStyle=t.color,e.fillRect(-s*.6*i,-s*.28*i,s*1.2*i,s*.22*i),e.globalAlpha*=.6,e.fillRect(-s*.25*i,s*.06*i,s*.9*i,s*.16*i);break;case"circle":default:e.fillStyle=t.color,e.beginPath(),e.arc(0,0,s*.5*i,0,Math.PI*2),e.fill();break}e.restore()}destroy(){this.rafId!==null&&cancelAnimationFrame(this.rafId),this.particles=[],this.canvas.remove()}}class Gt{constructor(t,e,i){C(this,"posX",0);C(this,"posY",0);C(this,"velX",0);C(this,"velY",0);C(this,"dragging",!1);C(this,"startPointerX",0);C(this,"startPointerY",0);C(this,"lastPointerX",0);C(this,"lastPointerY",0);C(this,"lastPointerTime",0);C(this,"velocitySamples",[]);C(this,"MAX_SAMPLES",6);C(this,"springK",.08);C(this,"springD",.82);C(this,"tossDecay",.96);C(this,"maxStretch",.25);C(this,"animating",!1);C(this,"rafId",null);C(this,"onUpdate");C(this,"onDragStart");C(this,"onDragEnd");C(this,"el");C(this,"handlePointerDown",t=>{t.preventDefault(),this.startDrag(t.clientX,t.clientY)});C(this,"handlePointerMove",t=>{this.dragging&&this.moveDrag(t.clientX,t.clientY)});C(this,"handlePointerUp",()=>{this.dragging&&this.endDrag()});C(this,"handleTouchDown",t=>{t.preventDefault();const e=t.touches[0];this.startDrag(e.clientX,e.clientY)});C(this,"handleTouchMove",t=>{if(!this.dragging)return;t.preventDefault();const e=t.touches[0];this.moveDrag(e.clientX,e.clientY)});C(this,"handleTouchUp",()=>{this.dragging&&this.endDrag()});C(this,"physicsTick",()=>{if(this.dragging){this.emitState(),this.rafId=requestAnimationFrame(this.physicsTick);return}const t=-this.springK*this.posX,e=-this.springK*this.posY;this.velX=(this.velX+t)*this.springD,this.velY=(this.velY+e)*this.springD,this.velX*=this.tossDecay,this.velY*=this.tossDecay,this.posX+=this.velX,this.posY+=this.velY,this.emitState();const i=Math.hypot(this.posX,this.posY),a=Math.hypot(this.velX,this.velY);if(i<.3&&a<.1){this.posX=0,this.posY=0,this.velX=0,this.velY=0,this.animating=!1,this.emitState();return}this.rafId=requestAnimationFrame(this.physicsTick)});this.el=t,this.onUpdate=e,this.onDragStart=i==null?void 0:i.onDragStart,this.onDragEnd=i==null?void 0:i.onDragEnd,this.el.addEventListener("mousedown",this.handlePointerDown),window.addEventListener("mousemove",this.handlePointerMove),window.addEventListener("mouseup",this.handlePointerUp),this.el.addEventListener("touchstart",this.handleTouchDown,{passive:!1}),window.addEventListener("touchmove",this.handleTouchMove,{passive:!1}),window.addEventListener("touchend",this.handleTouchUp)}startDrag(t,e){var i;this.dragging=!0,this.startPointerX=t-this.posX,this.startPointerY=e-this.posY,this.lastPointerX=t,this.lastPointerY=e,this.lastPointerTime=performance.now(),this.velocitySamples=[],this.velX=0,this.velY=0,this.el.style.cursor="grabbing",(i=this.onDragStart)==null||i.call(this),this.startPhysicsLoop()}moveDrag(t,e){const i=performance.now(),a=Math.max(1,i-this.lastPointerTime);this.velocitySamples.push({x:(t-this.lastPointerX)/a,y:(e-this.lastPointerY)/a}),this.velocitySamples.length>this.MAX_SAMPLES&&this.velocitySamples.shift(),this.posX=t-this.startPointerX,this.posY=e-this.startPointerY,this.lastPointerX=t,this.lastPointerY=e,this.lastPointerTime=i}endDrag(){var t;if(this.dragging=!1,this.el.style.cursor="pointer",this.velocitySamples.length>0){let e=0,i=0;for(const c of this.velocitySamples)e+=c.x,i+=c.y;const a=this.velocitySamples.length;this.velX=e/a*16,this.velY=i/a*16;const r=25,s=Math.hypot(this.velX,this.velY);s>r&&(this.velX=this.velX/s*r,this.velY=this.velY/s*r)}(t=this.onDragEnd)==null||t.call(this),this.startPhysicsLoop()}startPhysicsLoop(){this.animating||(this.animating=!0,this.rafId=requestAnimationFrame(this.physicsTick))}emitState(){let t=1,e=1,i=0;if(this.dragging){const a=this.posX,r=this.posY,s=Math.hypot(a,r),c=Math.min(this.maxStretch,s*.002),b=Math.atan2(r,a);t=1+c*Math.abs(Math.cos(b)),e=1-c*.5*Math.abs(Math.cos(b)),Math.abs(Math.sin(b))>Math.abs(Math.cos(b))&&(e=1+c*Math.abs(Math.sin(b)),t=1-c*.5*Math.abs(Math.sin(b))),i=Math.atan2(r,a)*.06}else{const a=Math.hypot(this.velX,this.velY),r=Math.min(this.maxStretch,a*.012),s=Math.atan2(this.velY,this.velX);t=1+r*Math.abs(Math.cos(s)),e=1-r*.6*Math.abs(Math.cos(s)),Math.abs(Math.sin(s))>Math.abs(Math.cos(s))&&(e=1+r*Math.abs(Math.sin(s)),t=1-r*.6*Math.abs(Math.sin(s))),i=Math.atan2(this.velY,this.velX)*.04}this.onUpdate({offsetX:this.posX,offsetY:this.posY,scaleX:t,scaleY:e,rotation:i,isDragging:this.dragging})}destroy(){this.rafId!==null&&cancelAnimationFrame(this.rafId),this.el.removeEventListener("mousedown",this.handlePointerDown),window.removeEventListener("mousemove",this.handlePointerMove),window.removeEventListener("mouseup",this.handlePointerUp),this.el.removeEventListener("touchstart",this.handleTouchDown),window.removeEventListener("touchmove",this.handleTouchMove),window.removeEventListener("touchend",this.handleTouchUp)}}function Wt(){return typeof window>"u"||!window.matchMedia?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function Bt(o){if(typeof window>"u"||!window.matchMedia)return()=>{};const t=window.matchMedia("(prefers-reduced-motion: reduce)"),e=i=>o(i.matches);return t.addEventListener?(t.addEventListener("change",e),()=>t.removeEventListener("change",e)):(t.addListener(e),()=>t.removeListener(e))}function Eo(o){let t=o.trim().replace("#","");if(t.length===3&&(t=t.split("").map(e=>e+e).join("")),t.length===6){const e=parseInt(t,16);return[(e>>16&255)/255,(e>>8&255)/255,(e&255)/255]}return[0,0,0]}function He(o){const[t,e,i]=Eo(o),a=b=>b<=.03928?b/12.92:Math.pow((b+.055)/1.055,2.4),r=a(t),s=a(e),c=a(i);return .2126*r+.7152*s+.0722*c}function _t(o,t){const e=He(o),i=He(t),a=Math.max(e,i),r=Math.min(e,i);return(a+.05)/(r+.05)}function Ao(o,t,e=3){const i=_t(o,t);return{ratio:Number(i.toFixed(2)),passes:i>=e}}const Po={happy:{baseColor:"#F7C6CE",strokeColor:"#1c1917"},excited:{baseColor:"#FFD54F",strokeColor:"#1c1917"},celebrate:{baseColor:"#FF80AB",strokeColor:"#1c1917"},laughing:{baseColor:"#FFE082",strokeColor:"#1c1917"},playful:{baseColor:"#F48FB1",strokeColor:"#1c1917"},proud:{baseColor:"#CE93D8",strokeColor:"#1c1917"},idle:{baseColor:"#F7C6CE",strokeColor:"#1c1917"},sleeping:{baseColor:"#9FA8DA",strokeColor:"#1A237E"},drowsy:{baseColor:"#C5CAE9",strokeColor:"#283593"},"powering-down":{baseColor:"#78909C",strokeColor:"#263238"},bored:{baseColor:"#B0BEC5",strokeColor:"#37474F"},angry:{baseColor:"#EF5350",strokeColor:"#B71C1C"},alerting:{baseColor:"#FF7043",strokeColor:"#BF360C"},notifying:{baseColor:"#FFA726",strokeColor:"#E65100"},suspicious:{baseColor:"#D4E157",strokeColor:"#33691E"},thinking:{baseColor:"#4DD0E1",strokeColor:"#006064"},searching:{baseColor:"#26C6DA",strokeColor:"#004D40"},loading:{baseColor:"#4FC3F7",strokeColor:"#01579B"},listening:{baseColor:"#81C784",strokeColor:"#1B5E20"},dictating:{baseColor:"#AED581",strokeColor:"#33691E"},writing:{baseColor:"#FFF176",strokeColor:"#F57F17"},orbit:{baseColor:"#80DEEA",strokeColor:"#00838F"},radar:{baseColor:"#4DB6AC",strokeColor:"#004D40"},progress:{baseColor:"#64B5F6",strokeColor:"#0D47A1"},sad:{baseColor:"#90CAF9",strokeColor:"#1565C0"},scared:{baseColor:"#B39DDB",strokeColor:"#4527A0"},confused:{baseColor:"#FFE082",strokeColor:"#E65100"},curious:{baseColor:"#A5D6A7",strokeColor:"#1B5E20"},shy:{baseColor:"#F48FB1",strokeColor:"#880E4F"},waking:{baseColor:"#FFF59D",strokeColor:"#F57F17"},spawning:{baseColor:"#E1BEE7",strokeColor:"#4A148C"}};function Rt(o){let t=o.trim().replace("#","");t.length===3&&(t=t.split("").map(i=>i+i).join(""));const e=parseInt(t,16);return isNaN(e)?{r:247,g:198,b:206}:{r:e>>16&255,g:e>>8&255,b:e&255}}function jt(o,t,e){const i=Rt(o),a=Rt(t),r=Math.max(0,Math.min(1,e)),s=Math.round(i.r+(a.r-i.r)*r),c=Math.round(i.g+(a.g-i.g)*r),b=Math.round(i.b+(a.b-i.b)*r),f=u=>u.toString(16).padStart(2,"0");return`#${f(s)}${f(c)}${f(b)}`}function zo(o,t){return{baseColor:t,strokeColor:"#1c1917"}}function V(o,t,e){const i=o/t%1;return i<e?Math.sin(i/e*Math.PI):0}const Ke={bouncy(o,t,e,i){const a=Math.abs(Math.sin(t*e));o.bob+=a*i-i*.5,o.cheek+=a*.15,o.eyeScale+=a*.04,o.turnAngle+=Math.sin(t*e*.5)*.05},flutter(o,t,e,i){const a=Math.sin(t*e);o.shiftX+=a*i,o.bob+=Math.cos(t*e*.7)*i*.5,o.turnAngle+=a*.06,o.eyeScale-=Math.abs(a)*.03},serene(o,t,e,i){const a=Math.sin(t*e);o.bob+=a*i,o.eyeScale+=a*.05,o.cheek+=(a+1)*.06,o.turnAngle+=Math.sin(t*e*.4-.6)*.045},float(o,t,e,i){o.bob+=Math.sin(t*e)*i,o.shiftX+=Math.sin(t*e*.5)*i*1.1,o.turnAngle+=Math.sin(t*e*.5-.9)*.07},calm(o,t,e,i){const a=Math.sin(t*e);o.bob+=a*i,o.eyeScale+=a*.025,o.gazeX+=Math.sin(t*e*.23)*2.5,o.turnAngle+=Math.sin(t*e*.31)*.03},droop(o,t,e,i){const a=t*e*.18%1,r=a<.82?a/.82:1-(a-.82)/.18;o.bob+=r*i*2.2,o.eyeOpen=Math.max(0,o.eyeOpen-r*.45),o.browY+=r*2,o.turnAngle+=r*.12},sob(o,t,e,i){const a=Math.sin(t*e)+Math.sin(t*e*2.7)*.4;o.bob+=a*i,o.browY+=1+Math.sin(t*e)*.8,o.gazeY+=1.5,o.mouthCurve-=.05+Math.abs(Math.sin(t*e))*.05},jitter(o,t,e,i){o.shiftX+=(Math.random()-.5)*i,o.bob+=(Math.random()-.5)*i,o.gazeX+=Math.sin(t*e*1.7)*4+(Math.random()-.5)*2,o.turnAngle+=(Math.random()-.5)*.03},fiery(o,t,e,i){const a=Math.sin(t*e*3.1)*.35,r=Math.pow(Math.max(0,Math.sin(t*e*.35)),6);o.bob+=a*i-r*i*1.8,o.shiftX+=a*i*.5,o.eyeScale+=r*.18,o.browY-=r*2.5,o.browTilt-=r*.25},wilt(o,t,e,i){const a=(Math.sin(t*e*.6)+1)/2;o.bob+=a*i*1.8,o.mouthCurve-=a*.12,o.browY+=a*1.6,o.eyeScale-=a*.05},dizzy(o,t,e,i){o.shiftX+=Math.sin(t*e)*i,o.bob+=Math.cos(t*e)*i*.7,o.turnAngle+=Math.sin(t*e)*.14,o.gazeX+=Math.cos(t*e)*3},snooze(o,t,e,i){const a=Math.sin(t*e);o.bob+=a*i*1.6,o.eyeScale+=a*.06,o.eyeOpen*=.35,o.cheek+=(a+1)*.05,o.turnAngle+=Math.sin(t*e-.8)*.05},pop(o,t,e,i){const a=V(t,1/(e*.1),.18),r=Math.sin(t*e*1.6)*.18;o.bob+=r*i-a*i*2.2,o.eyeScale+=r*.02+a*.22,o.browY-=a*3,o.mouthOpen+=a*.25},drift(o,t,e,i){o.bob+=Math.sin(t*e)*i*.6;const a=V(t,3.7,.04);o.shiftX+=a*(Math.random()-.5)*5,o.gazeX+=a*(Math.random()-.5)*6,o.eyeScale-=a*.08}};function Zt(o,t,e,i,a,r=1){(Ke[o]||Ke.calm)(t,e,i,a*r)}const Nt={sleeping(o,t){const e=Math.sin(t*.9);o.eyeOpen=.05,o.bob+=e*2.4,o.eyeScale+=e*.04,o.bob+=V(t,9,.15)*1.8},waking(o,t){const e=V(t,4,.4);o.bob+=Math.sin(t*2.2)*1.6-e*3,o.eyeOpen=Math.min(1,.35+e*.65),o.eyeScale+=e*.1,o.turnAngle+=Math.sin(t*1.1)*.06},listening(o,t){o.turnAngle+=.1+Math.sin(t*1.4)*.03,o.bob+=V(t,2.6,.25)*2.2,o.eyeScale+=.06,o.gazeY-=.8},thinking(o,t){o.gazeX+=-6+Math.sin(t*.9)*3,o.gazeY+=-4+Math.cos(t*.7)*2,o.browY-=1+Math.sin(t*1.3)*.8,o.turnAngle+=Math.sin(t*.6)*.05},searching(o,t){o.gazeX+=Math.sin(t*5.5)*11,o.gazeY+=Math.sin(t*2.3)*2.5,o.turnAngle+=Math.sin(t*5.5)*.05,o.eyeScale+=.05},working(o,t){o.bob+=Math.sin(t*3.4)*1.4,o.turnAngle+=Math.sin(t*3.4-.5)*.035,o.gazeY+=1.5,o.mouthWidth*=.9},excited(o,t){o.bob+=-Math.abs(Math.sin(t*7))*5.5,o.eyeScale+=.1+Math.abs(Math.sin(t*7))*.06,o.cheek+=.2,o.turnAngle+=Math.sin(t*3.5)*.07},surprised(o,t){o.bob+=Math.sin(t*9)*.9,o.eyeScale+=.12,o.browY-=1.5,o.shiftX+=Math.sin(t*13)*.4},suspicious(o,t){o.gazeX+=-7+Math.sin(t*.5)*2.5,o.eyeScale-=.08,o.browTilt-=.12,o.bob+=Math.sin(t*.8)*.5},angry(o,t){o.shiftX+=(Math.random()-.5)*3,o.bob+=(Math.random()-.5)*2;const e=V(t,2.2,.3);o.browY-=e*2,o.browTilt-=e*.2},drowsy(o,t){const e=(Math.sin(t*.8)+1)/2;o.bob+=e*3,o.eyeOpen=Math.max(.08,.5-e*.4),o.eyeOpen+=V(t,6.5,.08)*.5,o.browY+=e*2},happy(o,t){o.bob+=-Math.abs(Math.sin(t*3.2))*2.4,o.cheek+=.15+Math.abs(Math.sin(t*3.2))*.1,o.turnAngle+=Math.sin(t*1.6)*.05},curious(o,t){o.turnAngle+=Math.sin(t*1.2)*.13,o.gazeX+=Math.sin(t*2.1)*6,o.eyeScale+=.08,o.bob+=Math.sin(t*2.4)*1},confused(o,t){o.turnAngle+=Math.sin(t*.9)*.16,o.shiftX+=Math.sin(t*.9)*1.8,o.browTilt+=.15+Math.sin(t*1.7)*.1,o.gazeX+=Math.sin(t*.6)*4},bored(o,t){o.shiftX+=Math.sin(t*.5)*2.2,o.gazeX+=6+Math.sin(t*.3)*3,o.eyeOpen=Math.min(o.eyeOpen,.5),o.bob+=V(t,7,.2)*2},proud(o,t){o.bob+=-2+Math.sin(t*1.1)*.8,o.turnAngle+=Math.sin(t*.7)*.04,o.gazeY-=2,o.cheek+=.1},shy(o,t){o.bob+=1.5+Math.sin(t*1.3)*.7,o.gazeX+=-4+Math.sin(t*.9)*1.5,o.gazeY+=4,o.cheek+=.25,o.eyeScale-=.06},sad(o,t){o.bob+=2+Math.sin(t*.9)*1.4,o.gazeY+=3,o.browY+=1.5,o.turnAngle+=Math.sin(t*.5)*.03},laughing(o,t){o.bob+=-Math.abs(Math.sin(t*9))*4,o.mouthOpen+=.2+Math.abs(Math.sin(t*9))*.3,o.cheek+=.3,o.turnAngle+=Math.sin(t*4.5)*.05},scared(o,t){o.shiftX+=Math.sin(t*22)*1.2,o.bob+=1.2+Math.sin(t*18)*.8,o.eyeScale+=.14,o.browTilt+=.2},playful(o,t){o.bob+=(Math.sin(t*4.3)+Math.sin(t*6.7)*.5)*1.8,o.turnAngle+=Math.sin(t*3.1)*.11,o.shiftX+=Math.sin(t*2.2)*1.5,o.cheek+=.18},celebrate(o,t){o.bob+=-Math.abs(Math.sin(t*5))*7,o.turnAngle+=Math.sin(t*2.5)*.18,o.cheek+=.35,o.eyeScale+=.1},orbit(o,t){o.gazeX+=Math.cos(t*2.2)*10,o.gazeY+=Math.sin(t*2.2)*6,o.turnAngle+=Math.cos(t*2.2)*.06},radar(o,t){const e=Math.sin(t*1.6);o.gazeX+=Math.sign(e)*Math.pow(Math.abs(e),.45)*11,o.turnAngle+=e*.05,o.eyeScale+=.04},progress(o,t){const e=Math.pow(Math.max(0,Math.sin(t*3)),3);o.bob+=-e*3,o.eyeScale+=e*.09},spawning(o,t){const e=Math.exp(-(t*1.5%6)*.7);o.bob+=-Math.sin(t*6)*4*e,o.eyeScale+=e*.15},humming(o,t){o.bob+=Math.sin(t*2.6)*1.6,o.mouthOpen+=.1+Math.abs(Math.sin(t*2.6))*.08,o.turnAngle+=Math.sin(t*1.3)*.05,o.cheek+=.12},loading(o,t){o.eyeScale+=Math.sin(t*1.8)*.08,o.bob+=Math.sin(t*1.8)*1.2,o.gazeY+=Math.sin(t*.9)*1.5},dictating(o,t){o.mouthOpen=.25+Math.abs(Math.sin(t*11))*.4,o.bob+=Math.sin(t*2)*.6,o.browY-=.5},writing(o,t){o.gazeY+=4,o.gazeX+=Math.sin(t*4.5)*5,o.bob+=Math.abs(Math.sin(t*4.5))*1.2},sending(o,t){const e=V(t,1.6,.3);o.shiftX+=e*4,o.bob+=-e*2,o.turnAngle+=e*.08},receiving(o,t){const e=V(t,1.6,.3);o.shiftX+=-e*4,o.bob+=e*1.5,o.eyeScale+=e*.12},uploading(o,t){const e=1-t*.7%1;o.bob+=e*4-2,o.gazeY-=2,o.eyeScale+=(1-e)*.05},notifying(o,t){const e=V(t,2.4,.12)+V(t-.22,2.4,.12);o.bob+=-e*4,o.eyeScale+=e*.12,o.turnAngle+=e*.06},alerting(o,t){o.shiftX+=Math.sin(t*16)*2.5,o.bob+=Math.sin(t*12)*1.5,o.eyeScale+=.16,o.browY-=2},dragging(o,t){o.turnAngle+=Math.sin(t*2.4-1.2)*.14,o.shiftX+=Math.sin(t*2.4)*2,o.bob+=Math.cos(t*2.4-1.2)*1.5},bouncing(o,t){o.bob+=-Math.abs(Math.sin(t*5.5))*8},"powering-down"(o,t){const e=Math.min(1,t%8/8);o.bob+=e*4,o.eyeOpen=Math.max(.03,.4-e*.37),o.eyeOpen+=V(t,2.7,.05)*.3,o.eyeScale-=e*.1}};function Ut(o,t,e,i,a){const r=Nt[o];return r?(r(t,e,i,a),!0):!1}const Jt=600;function qt(o){let t=null,e=!1;const i=()=>{t!==null&&(clearTimeout(t),t=null),e=!1};return{play:(r,s={})=>{if(i(),r.length===0)return;const c=s.mode??"once";e=!0;let b=0,f=1;const u=()=>{if(!e)return;const F=r[b];o.applyStep(o.resolveStep(F)),t=setTimeout(()=>{var v;if(c==="ping-pong")r.length>1&&((b+f>=r.length||b+f<0)&&(f=-f),b+=f);else if(b+=1,b>=r.length)if(c==="loop")b=0;else{i(),(v=s.onComplete)==null||v.call(s);return}u()},F.duration??Jt)};u()},stop:i,isPlaying:()=>e}}const et=[{label:"Interacción",states:["idle","near","hover","click"]},{label:"Ciclo de vida",states:["sleeping","waking","listening","thinking","searching","working"]},{label:"Reacciones",states:["excited","surprised","suspicious","angry","drowsy","happy","curious","confused","bored","proud","shy","sad","laughing","scared","playful","celebrate"]},{label:"Morfos de agente",states:["orbit","radar","progress"]},{label:"Ciclo de producto",states:["spawning","humming","loading","dictating","writing","sending","receiving","uploading","notifying","alerting","dragging","bouncing","powering-down"]}],Qt=et.flatMap(o=>o.states),Vt=["idle","near","hover","click"],Ht=et.find(o=>o.label==="Reacciones").states,Kt=Qt.filter(o=>!Vt.includes(o));function eo(o,t){return o??t??Ht}function to(o,t){if(o.length<=1)return o[0];let e=o[Math.floor(Math.random()*o.length)];for(;e===t;)e=o[Math.floor(Math.random()*o.length)];return e}class oo{constructor(t=[],e={}){C(this,"instances",new Map);C(this,"options");C(this,"connectedPairs",new Map);C(this,"isRunning",!1);C(this,"update",()=>{const t=Array.from(this.instances.values());if(t.length<2)return;const e=new Set;for(let i=0;i<t.length;i++)for(let a=i+1;a<t.length;a++){const r=t[i],s=t[a],c=r.getPosition(),b=s.getPosition(),f=b.x-c.x,u=b.y-c.y,F=Math.hypot(f,u);if(F<=this.options.proximityThreshold&&F>0){const v=this.getPairKey(r.id,s.id);if(e.add(v),this.options.enableGazeSync){const A=Math.max(-.8,Math.min(.8,f/160))*22,j=Math.max(-.8,Math.min(.8,u/160))*14;r.setGaze({x:A,y:j}),s.setGaze({x:-A,y:-j})}let w=this.connectedPairs.get(v);w?Math.random()<.08&&this.options.enableSynergies&&(r.triggerParticles(1),s.triggerParticles(1)):(w={idA:r.id,idB:s.id,connectedSince:Date.now()},this.connectedPairs.set(v,w),this.triggerSynergy(r,s))}}for(const[i,a]of this.connectedPairs.entries())if(!e.has(i)){const r=this.instances.get(a.idA),s=this.instances.get(a.idB);r&&r.setGaze({x:0,y:0}),s&&s.setGaze({x:0,y:0}),this.connectedPairs.delete(i)}});this.options={proximityThreshold:e.proximityThreshold??220,enableGazeSync:e.enableGazeSync??!0,enableSynergies:e.enableSynergies??!0},t.forEach(i=>this.add(i)),this.start()}add(t){!t||!t.id||this.instances.set(t.id,t)}remove(t){!t||!t.id||this.instances.delete(t.id)}start(){this.isRunning||(this.isRunning=!0,G.add(this.update))}stop(){this.isRunning&&(this.isRunning=!1,G.remove(this.update))}getPairKey(t,e){return t<e?`${t}:${e}`:`${e}:${t}`}triggerSynergy(t,e){if(!this.options.enableSynergies)return;const i=t.emotionCategory||"happy",a=e.emotionCategory||"happy";if(ee.playSound(i,"hover"),t.triggerParticles(6),e.triggerParticles(6),i==="happy"&&a==="happy")t.bounce(),e.bounce();else if(i==="happy"&&a==="sad"||i==="sad"&&a==="happy"){const r=i==="happy"?t:e,s=i==="sad"?t:e;r.setEmotion("hover"),s.setEmotion("near")}else(i==="intense"||a==="intense")&&(t.spin(.5),e.spin(.5))}destroy(){this.stop(),this.instances.clear(),this.connectedPairs.clear()}}function io(o=[],t={}){return new oo(o,t)}const no="wissive:custom:";function Io(o){const t={};for(const e in o)t[e]=o[e].map(i=>({...i}));return t}function so(o,t={}){var f,u,F;const e=t.eyesFrom?te[t.eyesFrom]:void 0,i=t.mouthFrom?te[t.mouthFrom]:void 0,a=t.motionFrom?te[t.motionFrom]:void 0,r=t.particlesFrom?te[t.particlesFrom]:void 0,s=t.soundFrom?te[t.soundFrom]:void 0,c=Io(ve.expressions);for(const v in c){const w=e&&(((f=e.expressions[v])==null?void 0:f[0])??e.expressions.idle[0]),A=i&&(((u=i.expressions[v])==null?void 0:u[0])??i.expressions.idle[0]);c[v]=c[v].map(j=>({...j,...w&&{eyeType:w.eyeType,eyeScale:w.eyeScale},...A&&{mouthType:A.mouthType,mouthCurve:A.mouthCurve,mouthWidth:A.mouthWidth},...t.eyeTypeOverride!==void 0&&{eyeType:t.eyeTypeOverride},...t.mouthTypeOverride!==void 0&&{mouthType:t.mouthTypeOverride}}))}const b=(F=t.stateBank)==null?void 0:F.filter(v=>Kt.includes(v));return{name:o,emotion:"custom",baseColor:t.baseColor||ve.baseColor,silhouette:t.silhouette||"circle",motion:a?{...a.motion}:{...ve.motion},expressions:c,particleEmotion:r==null?void 0:r.emotion,soundEmotion:s==null?void 0:s.emotion,...b&&b.length>0&&{autonomousStatePool:b}}}function ao(o,t){localStorage.setItem(no+o,JSON.stringify(t))}function Lo(o){const t=localStorage.getItem(no+o);return t?JSON.parse(t):null}function Do(o,t={}){const e=so(o,t);return te[o]=e,ao(o,e),e}const Xo={idle:1,near:.7,hover:.5,click:.35},ro={xs:48,sm:80,base:120,lg:160,xl:200,"2xl":240};function tt(o="base"){return typeof o=="number"?o:ro[o]??120}function lo(o,t){const{target:e,size:i="base",interactive:a=!0,draggable:r=!0,nearRadius:s=120,sound:c=!0,flipX:b=!1,emphasis:f=!1,gazeTracking:u=!1,ambientParticles:F=!0,autonomousStates:v=!0,autonomousStatePool:w,reducedMotion:A="auto",theme:j="auto"}=t,z=_e(o)||_e("mochi"),Z=z.motion;let B=tt(i),N=A,me=j,xe=z.baseColor;const ie=z.particleEmotion||z.emotion,_=z.soundEmotion||z.emotion,D=()=>typeof N=="boolean"?N:Wt(),h=document.createElement("div");h.className="wissive-wrapper",h.style.width=`${B}px`,h.style.height=`${B}px`,h.style.display="inline-block",h.style.position="relative";const O=document.createElement("div");O.className="wissive-emoji",O.setAttribute("role","img"),a&&O.setAttribute("tabindex","0");const ze={idle:"Reposo",near:"Cerca",hover:"Hover",click:"Presionado"},Ce=p=>{O.setAttribute("aria-label",`${z.name} (${z.emotion}) emoji - Estado: ${ze[p]||p}`)};Ce("idle"),O.style.width=`${B}px`,O.style.height=`${B}px`,O.style.display="inline-block",O.style.userSelect="none",O.style.cursor=a?"pointer":"default",O.style.willChange="transform",O.style.transformOrigin="center center",h.appendChild(O),e.appendChild(h);const Ie=Bt(()=>{se()});let Me=b,Se=f,ye=u,fe=c,le=r,Fe=F,Le=v,Te=eo(w,z.autonomousStatePool);const M=new je,we=z.expressions.idle,ce=M.pickVariant(we,"idle"),J=Ft(ce,{stiffness:Z.stiffness,damping:Z.damping});let E=z.silhouette,d=[...Ue(E)],m=[...d],k=[...d],ot=0,n=400,l=!1,S=!1,Y=!1,T=!1,g=Math.random()*100,Q=!1,ne=null,x=null;const I=new Ot(h,B);let P={offsetX:0,offsetY:0,scaleX:1,scaleY:1,rotation:0},K=null;const pe=()=>{K||(K=new Gt(O,p=>{P=p,$e()},{onDragStart:()=>{fe&&ee.playSound(_,"click")},onDragEnd:()=>{I.burst(ie,10),fe&&ee.playSound(_,"bounce")}}))};le&&a&&pe();const $e=()=>{const p=D(),L=p?0:Z.idleSpeed*.35,R=p?0:.04,H=1+R*Math.cos(g*L),q=1-R*Math.sin(g*L),ge=P.offsetX!==0||P.offsetY!==0||P.scaleX!==1||P.scaleY!==1;let st,at,rt;ge?(st=H*P.scaleX,at=q*P.scaleY,rt=P.rotation):(st=H,at=q,rt=0);const Go=P.offsetX,Wo=P.offsetY;O.style.transform=`translate(${Go.toFixed(1)}px, ${Wo.toFixed(1)}px) rotate(${(rt*180/Math.PI).toFixed(2)}deg) scale(${st.toFixed(4)}, ${at.toFixed(4)})`},se=()=>{const p=J.getValues(),L=M.getState();let R=z.baseColor;if(typeof me=="object"&&me.baseColor&&(R=me.baseColor),xe=jt(xe,R,.15),Q&&(p.eyeOpen=.05),!D()&&!Ut(L,p,g,Z.idleSpeed,Z.idleAmplitude)){const q=Xo[L]??1;Zt(Z.motionType,p,g,Z.idleSpeed,Z.idleAmplitude,q)}$e(),O.innerHTML=Je(z.silhouette,xe,p,B,{flipX:Me,emphasis:Se,radii:d},g)},it=(p=M.getState())=>{M.setState(p);const L=M.resolvePool(z.expressions,p);if(!(!L||L.length===0)){if(L.length===1){const R=M.pickVariant(L,p);J.setTargets(R),G.add(U);return}Q=!0,G.add(U),setTimeout(()=>{const R=M.pickVariant(L,p);J.setTargets(R),G.add(U),setTimeout(()=>{Q=!1,G.add(U)},120)},100)}},de=p=>{Ce(p),it(p)},be=qt({resolveStep(p){return{...p.state?M.pickVariant(M.resolvePool(z.expressions,p.state),p.state):{},...p.params}},applyStep(p){J.setTargets(p),G.add(U)}}),U=p=>{g+=p;const L=J.update(p);if(l){const H=(typeof performance<"u"?performance.now():Date.now())-ot,q=Math.min(1,Math.max(0,H/n)),ge=1-Math.pow(1-q,4);d=Ct(k,m,ge),q>=1&&(l=!1,d=[...m])}se(),!L&&!l&&M.getState()!=="idle"&&G.remove(U)};G.add(U);const ho=()=>{const R=3e3+Math.random()*4e3;x=window.setTimeout(()=>{M.getState()==="idle"&&!Q&&(Q=!0,G.add(U),ne=window.setTimeout(()=>{Q=!1,G.add(U)},180)),ho()},R)};ho();let De=null;const uo=()=>{const p=Z.idleIntervalMin,L=Z.idleIntervalMax,R=p+Math.random()*(L-p);De=window.setTimeout(()=>{M.getState()==="idle"&&!be.isPlaying()&&it("idle"),uo()},R)};uo();let Xe=null,Oe=null;const mo=()=>{const R=3500+Math.random()*4500;Xe=window.setTimeout(()=>{if(M.getState()==="idle"&&!ye&&!be.isPlaying()){const H=[{x:-9,y:0},{x:9,y:0},{x:-7,y:-4},{x:7,y:-4},{x:0,y:-5},{x:0,y:4}],q=H[Math.floor(Math.random()*H.length)];J.setTargets({gazeX:q.x,gazeY:q.y}),G.add(U);const ge=1200+Math.random()*1500;Oe=window.setTimeout(()=>{ye||(J.setTargets({gazeX:0,gazeY:0}),G.add(U))},ge)}mo()},R)};mo();let Ge=null;const yo=()=>{const R=3500+Math.random()*5e3;Ge=window.setTimeout(()=>{if(Fe&&!D()){const H=M.getState();if(H==="idle"||H==="near"||H==="hover"){const q=Math.floor(2+Math.random()*3);I.burst(ie,q)}}yo()},R)};yo();let We=null,Be=null,fo=null;const po=()=>{const R=5e3+Math.random()*6e3;We=window.setTimeout(()=>{if(Le&&Te.length>0&&!D()&&!be.isPlaying()&&M.getState()==="idle"&&!S&&!Y&&!T){const q=to(Te,fo);fo=q,de(q);const ge=1800+Math.random()*2200;Be=window.setTimeout(()=>{M.getState()===q&&!S&&!Y&&!T&&de("idle")},ge)}po()},R)};po();const Oo=()=>{De!==null&&(clearTimeout(De),De=null),x!==null&&(clearTimeout(x),x=null),ne!==null&&(clearTimeout(ne),ne=null),Xe!==null&&(clearTimeout(Xe),Xe=null),Oe!==null&&(clearTimeout(Oe),Oe=null),Ge!==null&&(clearTimeout(Ge),Ge=null),We!==null&&(clearTimeout(We),We=null),Be!==null&&(clearTimeout(Be),Be=null)};let nt=null;const Ye=()=>T?"click":Y?"hover":S?"near":"idle";return a&&(nt=Pt(O,{onHoverStart:()=>{Y=!0,fe&&ee.playSound(_,"hover"),de(Ye())},onHoverEnd:()=>{Y=!1,de(Ye())},onClickStart:()=>{T=!0,fe&&ee.playSound(_,"click"),D()||I.burst(ie,8),de(Ye())},onClickEnd:()=>{T=!1,de(Ye())},onNearChange:p=>{S=p,de(Ye())},onGazeMove:(p,L)=>{ye&&(J.setTargets({gazeX:p,gazeY:L}),G.add(U))}},s)),{id:"wissive-"+Math.random().toString(36).substring(2,9),name:z.name,emotionCategory:z.emotion,getElement(){return O},getPosition(){const p=O.getBoundingClientRect();return{x:p.left+p.width/2,y:p.top+p.height/2}},getCurrentState(){return M.getState()},setEmotion(p){D()||(p==="click"?I.burst(ie,8):p==="hover"&&I.burst(ie,4)),de(p)},spin(p=1){const L=J.getValues().turnAngle||0;J.setTargets({turnAngle:L+Math.PI*2*p}),G.add(U)},bounce(){fe&&ee.playSound(_,"bounce"),D()||I.burst(ie,5);const p=J.getValues().bob||0;J.setTargets({bob:p-14}),G.add(U)},setGaze(p){J.setTargets({gazeX:p.x,gazeY:p.y}),G.add(U)},setGazeTracking(p){ye=p,p||(J.setTargets({gazeX:0,gazeY:0}),G.add(U))},setSound(p){fe=p},setDraggable(p){le=p,p&&!K&&a?pe():!p&&K&&(K.destroy(),K=null,P={offsetX:0,offsetY:0,scaleX:1,scaleY:1,rotation:0,isDragging:!1},$e())},setFlipX(p){Me=p,se()},setEmphasis(p){Se=p,se()},setAmbientParticles(p){Fe=p},setAutonomousStates(p){Le=p},setAutonomousStatePool(p){Te=p},setReducedMotion(p){N=p,se()},setTheme(p){me=p,se()},setSize(p){B=tt(p),h.style.width=`${B}px`,h.style.height=`${B}px`,O.style.width=`${B}px`,O.style.height=`${B}px`,I.resize(B),se()},setSilhouette(p,L=400){E===p&&!l||(E=p,z.silhouette=p,k=[...d],m=Ue(p),ot=typeof performance<"u"?performance.now():Date.now(),n=D()?0:L,n===0?(d=[...m],l=!1):l=!0,G.add(U),se())},setSpringConfig(p){J.setConfig(p)},triggerParticles(p=8){D()||I.burst(ie,p)},playSequence(p,L){be.play(p,L)},stopSequence(){be.stop(),it(M.getState())},isSequencePlaying(){return be.isPlaying()},destroy(){be.stop(),Oo(),Ie(),G.remove(U),I.destroy(),K&&K.destroy(),nt&&nt(),h.remove()}}}const co={create:lo,createGroup:io,setGlobalSound:It,isGlobalSoundEnabled:Lt,setGlobalVolume:Dt,getGlobalVolume:Xt,supportsHover:qe,isTouchDevice:Et};y.ALL_STATES=Qt,y.ALL_WANDERABLE_STATES=Kt,y.ANGLES=W,y.AUTONOMOUS_STATES=Ht,y.COS=ae,y.DEFAULT_STEP_MS=Jt,y.DragPhysics=Gt,y.EMOJI_BRIX=yt,y.EMOJI_COTA=ve,y.EMOJI_DOZY=ut,y.EMOJI_FIDGE=mt,y.EMOJI_KNOT=pt,y.EMOJI_LUMO=dt,y.EMOJI_MOCHI=he,y.EMOJI_NIMA=ht,y.EMOJI_PIP=bt,y.EMOJI_SNUG=$t,y.EMOJI_SURI=ct,y.EMOJI_VOID=gt,y.EMOJI_WILT=ft,y.EMOJI_ZUMI=lt,y.EmojiGroup=oo,y.IDLE_MOTIONS=Ke,y.LIB=te,y.PERSONALITY_DRIVEN_STATES=Vt,y.PROFILE_SAMPLES=oe,y.ParticleEmitter=Ot,y.SILHOUETTE_PROFILES=Ne,y.SIN=ue,y.SIZE_PRESETS=ro,y.SPRING_PRESETS=Re,y.STATE_GROUPS=et,y.STATE_MOTIONS=Nt,y.STATE_THEME_MAP=Po,y.SoundEngine=zt,y.StateManager=je,y.TAU=Ze,y.Wissive=co,y.applyIdleMotion=Zt,y.applyStateMotion=Ut,y.attachEventListeners=Pt,y.blendColors=jt,y.blendProfiles=Ct,y.buildCustomEmoji=so,y.buildFace=Je,y.checkContrast=Ao,y.clamp=Fo,y.closedCatmullRomPath=Tt,y.createCustomEmoji=Do,y.createEmoji=lo,y.createEmojiGroup=io,y.createMultiSpring=Ft,y.createSequencePlayer=qt,y.createStateManager=go,y.default=co,y.generateSilhouettePath=wt,y.getContrastRatio=_t,y.getEmojiDefinition=_e,y.getGlobalVolume=Xt,y.getLuminance=He,y.getSilhouettePath=Yt,y.getSilhouetteProfile=Ue,y.getThemeForState=zo,y.hullOfCircles=Ee,y.isGlobalSoundEnabled=Lt,y.isReducedMotionPreferred=Wt,y.isTouchDevice=Et,y.lerp=kt,y.loadCustomEmoji=Lo,y.makeSpring=Mt,y.normalizeRadii=X,y.pickWithoutRepeat=to,y.profileFromPolygon=ke,y.r2=re,y.renderSvgElement=To,y.resolveAutonomousStatePool=eo,y.resolveSize=tt,y.saveCustomEmoji=ao,y.setGlobalSound=It,y.setGlobalVolume=Dt,y.sharedLoop=G,y.soundEngine=ee,y.subscribeToReducedMotion=Bt,y.superellipseProfile=xt,y.supportsHover=qe,y.toPoints=St,Object.defineProperties(y,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
187
205
|
//# sourceMappingURL=wissive.umd.js.map
|