wissive 0.1.0 → 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/README.md +194 -193
- 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 +10 -2
package/dist/wissive.cjs
CHANGED
|
@@ -1,135 +1,150 @@
|
|
|
1
|
-
"use strict";var Qt=Object.create;var Ae=Object.defineProperty;var Vt=Object.getOwnPropertyDescriptor;var qt=Object.getOwnPropertyNames;var Ut=Object.getPrototypeOf,Ht=Object.prototype.hasOwnProperty;var Kt=(o,t,e)=>t in o?Ae(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e;var eo=(o,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of qt(t))!Ht.call(o,n)&&n!==e&&Ae(o,n,{get:()=>t[n],enumerable:!(i=Vt(t,n))||i.enumerable});return o};var to=(o,t,e)=>(e=o!=null?Qt(Ut(o)):{},eo(t||!o||!o.__esModule?Ae(e,"default",{value:o,enumerable:!0}):e,o));var g=(o,t,e)=>Kt(o,typeof t!="symbol"?t+"":t,e);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});function f(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 Ge={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:[f({eyeType:2,eyeScale:1,eyeGap:28.33,eyeY:43.33,mouthType:0,mouthY:53.33,mouthWidth:.39,mouthCurve:.43,cheek:0}),f({eyeType:2,eyeScale:1,eyeGap:28.33,eyeY:43.33,mouthType:0,mouthY:53.33,mouthWidth:.39,mouthCurve:.43,cheek:0,bob:-1.5}),f({eyeType:2,eyeScale:1,eyeGap:28.33,eyeY:43.33,mouthType:0,mouthY:53.33,mouthWidth:.39,mouthCurve:.43,cheek:0,bob:1}),f({eyeType:2,eyeScale:1,eyeGap:28.33,eyeY:43.33,mouthType:0,mouthY:53.33,mouthWidth:.39,mouthCurve:.43,cheek:0})],near:[f({eyeType:2,eyeScale:1,eyeGap:28.33,eyeY:43.33,mouthType:0,mouthY:53.33,mouthWidth:.39,mouthCurve:.43,cheek:0,bob:-1.5}),f({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:[f({eyeType:2,eyeScale:1,eyeGap:28.33,eyeY:43.33,mouthType:0,mouthY:53.33,mouthWidth:.39,mouthCurve:.43,cheek:.3,bob:-4}),f({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:[f({eyeType:2,eyeScale:1,eyeGap:28.33,eyeY:43.33,mouthType:0,mouthY:53.33,mouthWidth:.39,mouthCurve:.43,cheek:.5,bob:-7}),f({eyeType:2,eyeScale:1,eyeGap:28.33,eyeY:43.33,mouthType:0,mouthY:53.33,mouthWidth:.39,mouthCurve:.43,cheek:.5,bob:-6})]}},Ve={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:[f({eyeType:2,eyeScale:1,eyeGap:30,eyeY:43.33,mouthType:3,mouthY:45.83,mouthWidth:.27,mouthCurve:0,cheek:.3}),f({eyeType:2,eyeScale:1,eyeGap:30,eyeY:43.33,mouthType:3,mouthY:45.83,mouthWidth:.27,mouthCurve:0,cheek:.4,bob:-1.5}),f({eyeType:2,eyeScale:1,eyeGap:30,eyeY:43.33,mouthType:3,mouthY:45.83,mouthWidth:.27,mouthCurve:0,cheek:.35,bob:1})],near:[f({eyeType:2,eyeScale:1,eyeGap:30,eyeY:43.33,mouthType:3,mouthY:45.83,mouthWidth:.27,mouthCurve:0,cheek:.5,bob:-2})],hover:[f({eyeType:2,eyeScale:1,eyeGap:30,eyeY:43.33,mouthType:3,mouthY:45.83,mouthWidth:.27,mouthCurve:0,cheek:.7,bob:-4})],click:[f({eyeType:2,eyeScale:1,eyeGap:30,eyeY:43.33,mouthType:3,mouthY:45.83,mouthWidth:.27,mouthCurve:0,cheek:.9,bob:-6})]}},qe={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:[f({eyeType:1,eyeScale:1,eyeGap:26.67,eyeY:45,mouthType:0,mouthY:53.33,mouthWidth:.36,mouthCurve:.48,cheek:.4}),f({eyeType:1,eyeScale:1,eyeGap:26.67,eyeY:45,mouthType:0,mouthY:53.33,mouthWidth:.36,mouthCurve:.48,cheek:.5,bob:1})],near:[f({eyeType:1,eyeScale:1,eyeGap:26.67,eyeY:45,mouthType:0,mouthY:53.33,mouthWidth:.36,mouthCurve:.48,cheek:.6,bob:2})],hover:[f({eyeType:1,eyeScale:1,eyeGap:26.67,eyeY:45,mouthType:0,mouthY:53.33,mouthWidth:.36,mouthCurve:.48,cheek:.75,bob:3.5})],click:[f({eyeType:1,eyeScale:1,eyeGap:26.67,eyeY:45,mouthType:0,mouthY:53.33,mouthWidth:.36,mouthCurve:.48,cheek:.9,bob:5})]}},Ue={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:[f({eyeType:14,eyeScale:1,eyeGap:25,eyeY:43.33,mouthType:14,mouthY:51.67,mouthWidth:0,mouthCurve:0}),f({eyeType:14,eyeScale:1,eyeGap:25,eyeY:43.33,mouthType:14,mouthY:51.67,mouthWidth:0,mouthCurve:0,bob:1.5})],near:[f({eyeType:14,eyeScale:1,eyeGap:25,eyeY:43.33,mouthType:14,mouthY:51.67,mouthWidth:0,mouthCurve:0,bob:2})],hover:[f({eyeType:14,eyeScale:1,eyeGap:25,eyeY:43.33,mouthType:14,mouthY:51.67,mouthWidth:0,mouthCurve:0,cheek:.3,bob:3})],click:[f({eyeType:14,eyeScale:1,eyeGap:25,eyeY:43.33,mouthType:14,mouthY:51.67,mouthWidth:0,mouthCurve:0,cheek:.5,bob:4.5})]}},fe={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:[f({eyeType:0,eyeScale:1,eyeGap:23.33,eyeY:45.83,mouthType:3,mouthY:56.67,mouthWidth:.33,mouthCurve:0}),f({eyeType:0,eyeScale:1,eyeGap:23.33,eyeY:45.83,mouthType:3,mouthY:56.67,mouthWidth:.33,mouthCurve:0,bob:-.8})],near:[f({eyeType:0,eyeScale:1,eyeGap:23.33,eyeY:45.83,mouthType:3,mouthY:56.67,mouthWidth:.33,mouthCurve:0,bob:1.2})],hover:[f({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:[f({eyeType:0,eyeScale:1,eyeGap:23.33,eyeY:45.83,mouthType:3,mouthY:56.67,mouthWidth:.33,mouthCurve:0,cheek:.4,bob:4})]}},He={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:[f({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}),f({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:[f({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:[f({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:[f({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})]}},Ke={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:[f({eyeType:16,eyeScale:1,eyeGap:25,eyeY:43.33,mouthType:3,mouthY:55,mouthWidth:.3,mouthCurve:0,tears:1,bob:1.8}),f({eyeType:16,eyeScale:1,eyeGap:25,eyeY:43.33,mouthType:3,mouthY:55,mouthWidth:.3,mouthCurve:0,tears:1,bob:2.8})],near:[f({eyeType:16,eyeScale:1,eyeGap:25,eyeY:43.33,mouthType:3,mouthY:55,mouthWidth:.3,mouthCurve:0,tears:1,bob:3.5})],hover:[f({eyeType:16,eyeScale:1,eyeGap:25,eyeY:43.33,mouthType:3,mouthY:55,mouthWidth:.3,mouthCurve:0,tears:1,bob:4.8})],click:[f({eyeType:16,eyeScale:1,eyeGap:25,eyeY:43.33,mouthType:3,mouthY:55,mouthWidth:.3,mouthCurve:0,tears:1,bob:6})]}},et={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:[f({eyeType:5,eyeScale:1,eyeGap:25,eyeY:43.33,mouthType:13,mouthY:56.67,mouthWidth:.08,mouthCurve:0}),f({eyeType:5,eyeScale:1,eyeGap:25,eyeY:43.33,mouthType:13,mouthY:56.67,mouthWidth:.08,mouthCurve:0,shiftX:1.5})],near:[f({eyeType:5,eyeScale:1,eyeGap:25,eyeY:43.33,mouthType:13,mouthY:56.67,mouthWidth:.08,mouthCurve:0,shiftX:2.5})],hover:[f({eyeType:5,eyeScale:1,eyeGap:25,eyeY:43.33,mouthType:13,mouthY:56.67,mouthWidth:.08,mouthCurve:0,shiftX:4})],click:[f({eyeType:5,eyeScale:1,eyeGap:25,eyeY:43.33,mouthType:13,mouthY:56.67,mouthWidth:.08,mouthCurve:0,shiftX:6})]}},tt={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:[f({eyeType:17,eyeScale:1,eyeGap:28.33,eyeY:46.67,mouthType:0,mouthY:61.67,mouthWidth:.33,mouthCurve:-.48}),f({eyeType:17,eyeScale:1,eyeGap:28.33,eyeY:46.67,mouthType:0,mouthY:61.67,mouthWidth:.33,mouthCurve:-.48})],near:[f({eyeType:17,eyeScale:1,eyeGap:28.33,eyeY:46.67,mouthType:0,mouthY:61.67,mouthWidth:.33,mouthCurve:-.48})],hover:[f({eyeType:17,eyeScale:1,eyeGap:28.33,eyeY:46.67,mouthType:0,mouthY:61.67,mouthWidth:.33,mouthCurve:-.48})],click:[f({eyeType:17,eyeScale:1,eyeGap:28.33,eyeY:46.67,mouthType:0,mouthY:61.67,mouthWidth:.33,mouthCurve:-.48})]}},ot={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:[f({eyeType:15,eyeScale:1.15,eyeGap:25,eyeY:43.33,mouthType:0,mouthY:63.33,mouthWidth:.45,mouthCurve:-.54,bob:1.5}),f({eyeType:15,eyeScale:1.15,eyeGap:25,eyeY:43.33,mouthType:0,mouthY:63.33,mouthWidth:.45,mouthCurve:-.54,bob:2.5})],near:[f({eyeType:15,eyeScale:1.15,eyeGap:25,eyeY:43.33,mouthType:0,mouthY:63.33,mouthWidth:.45,mouthCurve:-.54,bob:3.5})],hover:[f({eyeType:15,eyeScale:1.15,eyeGap:25,eyeY:43.33,mouthType:0,mouthY:63.33,mouthWidth:.45,mouthCurve:-.54,bob:4.5})],click:[f({eyeType:15,eyeScale:1.15,eyeGap:25,eyeY:43.33,mouthType:0,mouthY:63.33,mouthWidth:.45,mouthCurve:-.54,bob:6})]}},it={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:[f({eyeType:18,eyeScale:1,eyeGap:26.67,eyeY:45,mouthType:3,mouthY:58.33,mouthWidth:.42,mouthCurve:0,storm:1,scribble:1}),f({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:[f({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:[f({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:[f({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})]}},st={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:[f({eyeType:19,eyeScale:1,eyeGap:26.67,eyeY:45,mouthType:3,mouthY:56.67,mouthWidth:.27,mouthCurve:0,zzz:1,bob:.5}),f({eyeType:19,eyeScale:1,eyeGap:26.67,eyeY:45,mouthType:3,mouthY:56.67,mouthWidth:.27,mouthCurve:0,zzz:1,bob:1.5})],near:[f({eyeType:19,eyeScale:1,eyeGap:26.67,eyeY:45,mouthType:3,mouthY:56.67,mouthWidth:.27,mouthCurve:0,zzz:1,bob:2.5})],hover:[f({eyeType:19,eyeScale:1,eyeGap:26.67,eyeY:45,mouthType:3,mouthY:56.67,mouthWidth:.27,mouthCurve:0,zzz:1,bob:3.8})],click:[f({eyeType:19,eyeScale:1,eyeGap:26.67,eyeY:45,mouthType:3,mouthY:56.67,mouthWidth:.27,mouthCurve:0,zzz:1,bob:5.5})]}},at={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:[f({eyeType:20,eyeScale:.8,eyeGap:21.67,eyeY:43.33,mouthType:1,mouthY:55,mouthWidth:.21,mouthCurve:0}),f({eyeType:20,eyeScale:.8,eyeGap:21.67,eyeY:43.33,mouthType:1,mouthY:55,mouthWidth:.21,mouthCurve:0,bob:-2})],near:[f({eyeType:20,eyeScale:.8,eyeGap:21.67,eyeY:43.33,mouthType:1,mouthY:55,mouthWidth:.21,mouthCurve:0,bob:-3})],hover:[f({eyeType:20,eyeScale:.8,eyeGap:21.67,eyeY:43.33,mouthType:1,mouthY:55,mouthWidth:.21,mouthCurve:0,bob:-5})],click:[f({eyeType:20,eyeScale:.8,eyeGap:21.67,eyeY:43.33,mouthType:1,mouthY:55,mouthWidth:.21,mouthCurve:0,bob:-8})]}},nt={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:[f({eyeType:20,eyeScale:.75,eyeGap:23.33,eyeY:44.17,mouthType:3,mouthY:56.67,mouthWidth:.33,mouthCurve:0}),f({eyeType:20,eyeScale:.75,eyeGap:23.33,eyeY:44.17,mouthType:3,mouthY:56.67,mouthWidth:.33,mouthCurve:0,bob:1})],near:[f({eyeType:20,eyeScale:.75,eyeGap:23.33,eyeY:44.17,mouthType:3,mouthY:56.67,mouthWidth:.33,mouthCurve:0,bob:2})],hover:[f({eyeType:20,eyeScale:.75,eyeGap:23.33,eyeY:44.17,mouthType:3,mouthY:56.67,mouthWidth:.33,mouthCurve:0,bob:3})],click:[f({eyeType:20,eyeScale:.75,eyeGap:23.33,eyeY:44.17,mouthType:3,mouthY:56.67,mouthWidth:.33,mouthCurve:0,bob:4.5})]}},H={mochi:Ge,zumi:Ve,suri:qe,nima:Ue,cota:fe,dozy:He,lumo:Ke,fidge:et,brix:tt,wilt:ot,knot:it,snug:st,pip:at,void:nt};function Ie(o){const t=o.toLowerCase();return H[t]?H[t]:Object.values(H).find(i=>i.emotion===t)||Ge}function rt(o,t={}){const{stiffness:e=180,damping:i=18,mass:n=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 b=a/4;let $=!1;for(let d=0;d<4;d++){const M=c.current-c.target,v=-e*M,Y=-i*c.velocity,A=(v+Y)/n;c.velocity+=A*b,c.current+=c.velocity*b,(Math.abs(c.velocity)>1e-4||Math.abs(c.current-c.target)>1e-4)&&($=!0)}return $||(c.current=c.target,c.velocity=0),$}}}function lt(o,t){const e=Object.keys(o),i={};for(const n of e)i[n]=rt(o[n],t);return{getValues(){const n={};for(const c of e)n[c]=i[c].state.current;return n},setTargets(n){for(const c in n)c in i&&i[c].setTarget(n[c])},setValues(n){for(const c in n)c in i&&i[c].setCurrent(n[c])},update(n){let c=!1;for(const a of e)i[a].update(n)&&(c=!0);return c}}}function oo(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 ct{constructor(){g(this,"currentState","idle");g(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(n=>oo(n,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 n=Math.floor(Math.random()*t.length);for(;n===i;)n=Math.floor(Math.random()*t.length);return this.lastIndices[e]=n,t[n]}}class io{constructor(){g(this,"callbacks",new Set);g(this,"handle",null);g(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 io;function ht(o=2.2,t=.25){const e=[],i=o*Math.PI*2;for(let n=0;n<=i;n+=t){const c=n/i;e.push([Math.cos(n)*c,Math.sin(n)*c])}return e}function ut(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 so="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 ao(o,t,e,i,n,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*s}" fill="${h}" />
|
|
42
|
-
</g>`;case 0:default:const z=2.83*L,P=Math.max(.5,z*Math.max(.05,e.eyeOpen));return`<ellipse cx="${r.toFixed(2)}" cy="${l.toFixed(2)}" rx="${z.toFixed(2)}" ry="${P.toFixed(2)}" fill="${h}" />`}};le=D.isVisible?ce(D.projX,O,D.scaleX,!1):"",pe=F.isVisible?ce(F.projX,O,F.scaleX,!0):"";let ne="";const se=e.tears??0;if(se>.01){const r=Math.min(1,se),l=a*.36%1;let k=0,C=r,L=1;if(l<.25){const p=l/.25;k=p*1.2,L=.75+p*.35,C=r*(.3+p*.7)}else if(l<.82){const p=(l-.25)/.57;k=1.2+p*10.5,L=1.1-p*.2,C=r}else{const p=(l-.82)/.18;k=11.7+p*2.5,L=.9-p*.4,C=r*(1-p)}if(e.cascadeTears)ne=`
|
|
43
|
-
<g opacity="${C.toFixed(2)}">
|
|
44
|
-
<path d="M ${D.projX-3} ${O+4} L ${D.projX-6} 88 L ${D.projX+2} 88 Z" fill="#7FA6D9" opacity="0.85" />
|
|
45
|
-
<path d="M ${F.projX-2} ${O+4} L ${F.projX-2} 88 L ${F.projX+6} 88 Z" fill="#7FA6D9" opacity="0.85" />
|
|
1
|
+
"use strict";var Mo=Object.create;var Ne=Object.defineProperty;var xo=Object.getOwnPropertyDescriptor;var Fo=Object.getOwnPropertyNames;var ko=Object.getPrototypeOf,vo=Object.prototype.hasOwnProperty;var Co=(o,t,e)=>t in o?Ne(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e;var So=(o,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Fo(t))!vo.call(o,a)&&a!==e&&Ne(o,a,{get:()=>t[a],enumerable:!(i=xo(t,a))||i.enumerable});return o};var To=(o,t,e)=>(e=o!=null?Mo(ko(o)):{},So(t||!o||!o.__esModule?Ne(e,"default",{value:o,enumerable:!0}):e,o));var v=(o,t,e)=>Co(o,typeof t!="symbol"?t+"":t,e);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});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 tt={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})]}},pt={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})]}},ft={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})]}},$t={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})]}},Se={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})]}},bt={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})]}},gt={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})]}},xt={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})]}},kt={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})]}},vt={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})]}},Ct={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})]}},St={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})]}},ie={mochi:tt,zumi:pt,suri:ft,nima:$t,cota:Se,dozy:bt,lumo:gt,fidge:Mt,brix:xt,wilt:Ft,knot:kt,snug:vt,pip:Ct,void:St};function qe(o){const t=o.toLowerCase();return ie[t]?ie[t]:Object.values(ie).find(i=>i.emotion===t)||tt}const Qe={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 Tt(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(n){n.stiffness!==void 0&&(e=n.stiffness),n.damping!==void 0&&(i=n.damping),n.mass!==void 0&&(a=n.mass)},setTarget(n){r.target=n},setCurrent(n){r.current=n,r.target=n,r.velocity=0},update(n){const f=n/4;let y=!1;for(let u=0;u<4;u++){const M=r.current-r.target,x=-e*M,T=-i*r.velocity,E=(x+T)/a;r.velocity+=E*f,r.current+=r.velocity*f,(Math.abs(r.velocity)>1e-4||Math.abs(r.current-r.target)>1e-4)&&(y=!0)}return y||(r.current=r.target,r.velocity=0),y}}}const wo=new Set(["eyeType","mouthType","cascadeTears","showBrows"]);function wt(o,t){const e=Object.keys(o),i={};let a=null;for(const r of e)i[r]=Tt(o[r],t);return{getValues(){const r={};for(const n of e)r[n]=i[n].state.current;return r},setConfig(r){if(typeof r=="string"){a=r;const n=Qe[r]||Qe.smooth;for(const c of e)i[c].setConfig(n)}else{a=null;for(const n of e)i[n].setConfig(r)}},setTargets(r){const n=a==="instant";for(const c in r)c in i&&(n||wo.has(c)?i[c].setCurrent(r[c]):i[c].setTarget(r[c]))},setValues(r){for(const n in r)n in i&&i[n].setCurrent(r[n])},update(r){let n=!1;for(const c of e)i[c].update(r)&&(n=!0);return n}}}function Yo(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(t="idle"){v(this,"currentState");v(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=>Yo(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 Eo(o="idle"){return new ot(o)}class Ao{constructor(){v(this,"callbacks",new Set);v(this,"handle",null);v(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 Ao;function Yt(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 se=64,it=Math.PI*2,_=Array.from({length:se},(o,t)=>t/se*it),le=_.map(Math.cos),he=_.map(Math.sin),re=o=>Math.round(o*100)/100,Po=(o,t=0,e=1)=>o<t?t:o>e?e:o,Et=(o,t,e)=>o+(t-o)*e;function At(o,t=1,e=1){return _.map((i,a)=>{const r=Math.abs((le[a]??0)/t)**o,n=Math.abs((he[a]??0)/e)**o;return(r+n)**(-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 Te(o,t=0,e=0){const i=new Array(se).fill(1),a=o.length;for(let r=0;r<se;r++){const n=le[r]??0,c=he[r]??0;let f=0;for(let y=0;y<a;y++){const u=o[y],M=o[(y+1)%a],x=M.x-u.x,T=M.y-u.y,E=n*T-c*x;if(Math.abs(E)<1e-9)continue;const R=u.x-t,P=u.y-e,j=(R*T-P*x)/E,G=(R*c-P*n)/E;j>f&&G>=0&&G<=1&&(f=j)}i[r]=f||1}return i}function Xe(o,t,e,i,a,r,n=96){const c=i-o,f=a-t,y=Math.hypot(c,f)||1e-6,u=Math.atan2(f,c),M=Math.acos(Math.max(-1,Math.min(1,(e-r)/y))),x=[];for(let T=0;T<=n/2;T++){const E=u+M+(it-2*M)*T/(n/2);x.push({x:o+Math.cos(E)*e,y:t+Math.sin(E)*e})}for(let T=0;T<=n/2;T++){const E=u-M+2*M*T/(n/2);x.push({x:i+Math.cos(E)*r,y:a+Math.sin(E)*r})}return x}function zo(o,t,e,i,a){const r=1-a,n=r*r,c=a*a;return{x:n*r*o.x+3*n*a*t.x+3*r*c*e.x+c*a*i.x,y:n*r*o.y+3*n*a*t.y+3*r*c*e.y+c*a*i.y}}function Io(){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 n=0;n<a;n++){const c=zo(r[0],r[1],r[2],r[3],n/a);t.push({x:(c.x-e)/36,y:(c.y-i)/36})}return X(Te(t,0,0),1.05)}const st={circle:new Array(se).fill(1),heart:Io(),"round-blob":X(_.map(o=>1+.075*Math.cos(2*o+.5)+.035*Math.cos(3*o+2.1)),1.02),capsule:X(Te(Xe(-.45,0,.62,.45,0,.62),0,0),1.08),"rounded-squircle":X(At(4.2),1.12),"pear-blob":X(_.map(o=>1+.22*Math.sin(o)+.08*Math.cos(2*o)),1.06),"egg-oval":X(_.map((o,t)=>{const e=(le[t]??0)/.86,i=((he[t]??0)+.12*(1-Math.abs(le[t]??0)))/1.16;return Math.sqrt(e*e+i*i)**-1}),1.08),"starburst-puff":X(_.map(o=>1+.16*Math.cos(4*o)),1.08),"pill-vertical":X(Te(Xe(0,-.42,.6,0,.42,.6),0,0),1.08),"ghost-blob":X(_.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(_.map((o,t)=>{const e=(le[t]??0)/1.15,i=(he[t]??0)/.9;return Math.sqrt(e*e+i*i)**-1}),1.05),"elongated-oval":X(_.map((o,t)=>{const e=(le[t]??0)/1.25,i=(he[t]??0)/.82;return Math.sqrt(e*e+i*i)**-1}),1.08),"teardrop-blob":X(Te(Xe(0,.26,.66,0,-.92,.06),0,0),1.08),"flame-blob":X(_.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(_.map(o=>{const t=Math.sin(o);return 1+.18*Math.max(0,t)-.08*Math.max(0,-t)}),1.05),"spiky-blob":X(_.map(o=>1+.18*Math.sin(8*o)),1.06),"cloud-blob":X(_.map(o=>1+.14*Math.sin(5*o+.4)),1.06),"wide-oval":X(_.map((o,t)=>{const e=(le[t]??0)/1.28,i=(he[t]??0)/.78;return Math.sqrt(e*e+i*i)**-1}),1.08),"soft-round":X(_.map(o=>1+.04*Math.cos(4*o)),1.02),"octopus-blob":X(_.map(o=>1+(Math.sin(o)>.3?.15*Math.sin(o*7):0)),1.06),"wave-blob":X(_.map(o=>1+.12*Math.sin(3*o+.8)),1.04),"bear-blob":X(_.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 Ve(o){return Lo.get(o)||st.circle}const Lo=new Map(Object.entries(st));function Pt(o,t,e){const i=new Array(se);for(let a=0;a<se;a++)i[a]=Et(o[a]??1,t[a]??1,e);return i}function zt(o,t=50,e=50,i=37,a=1,r=1){const n=new Array(se);for(let c=0;c<se;c++){const f=(o[c]??1)*i,y=t+(le[c]??0)*f*a,u=e+(he[c]??0)*f*r;n[c]={x:y,y:u}}return n}function It(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 n=o[(r-1+e)%e],c=o[r],f=o[(r+1)%e],y=o[(r+2)%e],u=c.x+(f.x-n.x)*t,M=c.y+(f.y-n.y)*t,x=f.x-(y.x-c.x)*t,T=f.y-(y.y-c.y)*t;a+=` C ${re(u)} ${re(M)} ${re(x)} ${re(T)} ${re(f.x)} ${re(f.y)}`}return`${a} Z`}function Lt(o,t=50,e=50,i=37){const a=zt(o,t,e,i);return It(a)}function Dt(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 Do="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 Xo(o,t,e,i,a,r=""){return`<g transform="translate(${o.toFixed(2)}, ${t.toFixed(2)}) scale(${e.toFixed(3)})" ${r}>
|
|
2
|
+
<path d="${Do}" stroke="${i}" stroke-width="${(a/e).toFixed(2)}" stroke-linecap="round" stroke-linejoin="round" fill="none" />
|
|
3
|
+
</g>`}function nt(o,t,e,i,a={},r=0){const n=r||(typeof performance<"u"?performance.now()/1e3:Date.now()/1e3),c="#2C2C2A",f="#F0997B",y=3.5;let u="";a.radii&&a.radii.length>0?u=`<path class="wissive-silhouette-path" d="${Lt(a.radii)}" fill="${t}" />`:u=Dt(o).split(/(?=M )/).map(l=>l.trim()).filter(Boolean).map(l=>`<path class="wissive-silhouette-path" d="${l}" fill="${t}" />`).join("");const{flipX:M=!1,emphasis:x=!1}=a,T=Math.max(-13.2,Math.min(13.2,e.gazeX??0)),E=Math.max(-8.4,Math.min(8.4,e.gazeY??0)),R=(e.eyeGap??32)/2,P=(e.eyeY??45)+E,j=50-R+T,G=50+R+T,Z=40,ue=50+(e.shiftX??0),Me=e.turnAngle??0,ee=s=>{const l=s-ue,C=Math.max(-Z,Math.min(Z,l)),w=Math.asin(C/Z),S=w+Me,b=Math.cos(S),q=b>0,te=ue+Z*Math.sin(S),k=q?Math.max(0,b/Math.cos(w)):0;return{projX:te,scaleX:k,isVisible:q}},W=ee(j),L=ee(G),h=(e.eyeScale??1)*(x?1.15:1),D=Math.round(e.eyeType??0);let we="",xe="";const Ye=(s,l,C,w)=>{if(C<=.01)return"";const S=h*C,b=`transform="translate(${s}, ${l}) scale(${C.toFixed(2)}, 1) translate(${-s}, ${-l})"`;switch(D){case 1:return`<g ${b}><path d="M ${s-5.83*h} ${l+2.5*h} Q ${s} ${l-5.83*h} ${s+5.83*h} ${l+2.5*h}" stroke="${c}" stroke-width="${y}" stroke-linecap="round" fill="none" /></g>`;case 2:return w?`<g ${b}><path d="M ${s-5*h} ${l-5*h} L ${s+4.17*h} ${l} L ${s-5*h} ${l+5*h}" stroke="${c}" stroke-width="${y}" stroke-linecap="round" stroke-linejoin="round" fill="none" /></g>`:`<g ${b}><path d="M ${s+5*h} ${l-5*h} L ${s-4.17*h} ${l} L ${s+5*h} ${l+5*h}" stroke="${c}" stroke-width="${y}" stroke-linecap="round" stroke-linejoin="round" fill="none" /></g>`;case 3:return w?`<g ${b}><path d="M ${s-5.83*h} ${l-4.17*h} L ${s+5*h} ${l+4.17*h}" stroke="${c}" stroke-width="${y}" stroke-linecap="round" fill="none" /></g>`:`<g ${b}><path d="M ${s+5.83*h} ${l-4.17*h} L ${s-5*h} ${l+4.17*h}" stroke="${c}" stroke-width="${y}" stroke-linecap="round" fill="none" /></g>`;case 4:return w?`<g ${b}><path d="M ${s-5*h} ${l+4.17*h} L ${s+5.83*h} ${l-4.17*h}" stroke="${c}" stroke-width="${y}" stroke-linecap="round" fill="none" /></g>`:`<g ${b}><path d="M ${s+5*h} ${l+4.17*h} L ${s-5.83*h} ${l-4.17*h}" stroke="${c}" stroke-width="${y}" stroke-linecap="round" fill="none" /></g>`;case 5:return`<g ${b}>
|
|
4
|
+
<ellipse cx="${s}" cy="${l}" rx="${3.33*S}" ry="${3.33*S}" fill="${c}" />
|
|
5
|
+
<circle cx="${s-1.25*h}" cy="${l-1.25*h}" r="${1.25*h}" fill="#FFFFFF" />
|
|
6
|
+
</g>`;case 6:{const k=5.5*h;return`<g ${b}><path d="M ${s} ${l+k*.7} C ${s-k*1.1} ${l-k*.1} ${s-k*.9} ${l-k*.9} ${s} ${l-k*.35} C ${s+k*.9} ${l-k*.9} ${s+k*1.1} ${l-k*.1} ${s} ${l+k*.7} Z" fill="#E84855" /></g>`}case 7:{const k=4.2*h;return`<g ${b}>
|
|
7
|
+
<line x1="${s-k}" y1="${l-k}" x2="${s+k}" y2="${l+k}" stroke="${c}" stroke-width="${y}" stroke-linecap="round" />
|
|
8
|
+
<line x1="${s+k}" y1="${l-k}" x2="${s-k}" y2="${l+k}" stroke="${c}" stroke-width="${y}" stroke-linecap="round" />
|
|
9
|
+
</g>`}case 8:{const k=5*h;return`<g ${b}>
|
|
10
|
+
<line x1="${s-k}" y1="${l-2.2*h}" x2="${s+k}" y2="${l-2.2*h}" stroke="${c}" stroke-width="${y*.8}" stroke-linecap="round" />
|
|
11
|
+
<line x1="${s-k}" y1="${l+2.2*h}" x2="${s+k}" y2="${l+2.2*h}" stroke="${c}" stroke-width="${y*.8}" stroke-linecap="round" />
|
|
12
|
+
</g>`}case 9:return`<g ${b}>
|
|
13
|
+
<circle cx="${s}" cy="${l}" r="${5.8*h}" fill="none" stroke="${c}" stroke-width="2.6" />
|
|
14
|
+
${w?`<line x1="${s-5.8*h}" y1="${l}" x2="${s-10*h}" y2="${l}" stroke="${c}" stroke-width="2.6" stroke-linecap="round" />`:""}
|
|
15
|
+
</g>`;case 10:return w?`<g ${b}><path d="M ${s-5.83*h} ${l+1*h} Q ${s} ${l-5*h} ${s+5.83*h} ${l+1*h}" stroke="${c}" stroke-width="${y}" stroke-linecap="round" fill="none" /></g>`:`<ellipse cx="${s.toFixed(2)}" cy="${l.toFixed(2)}" rx="${(2.83*S).toFixed(2)}" ry="${Math.max(.5,2.83*S*Math.max(.05,e.eyeOpen)).toFixed(2)}" fill="${c}" />`;case 11:return w?`<g ${b}><line x1="${s-5*h}" y1="${l}" x2="${s+5*h}" y2="${l}" stroke="${c}" stroke-width="${y}" stroke-linecap="round" /></g>`:`<ellipse cx="${s.toFixed(2)}" cy="${l.toFixed(2)}" rx="${(2.83*S).toFixed(2)}" ry="${(2.83*S).toFixed(2)}" fill="${c}" />`;case 12:return`<ellipse cx="${s.toFixed(2)}" cy="${l.toFixed(2)}" rx="${(2.2*S).toFixed(2)}" ry="${(5.5*S).toFixed(2)}" fill="${c}" />`;case 13:return`<circle cx="${s.toFixed(2)}" cy="${l.toFixed(2)}" r="${(4.5*S).toFixed(2)}" fill="${c}" />`;case 14:return`<g ${b}><path d="M ${s-5.83*h} ${l-1.67*h} Q ${s} ${l+5.83*h} ${s+5.83*h} ${l-1.67*h}" stroke="${c}" stroke-width="${y}" stroke-linecap="round" fill="none" /></g>`;case 15:return w?`<g ${b}><path d="M ${s-5.5*h} ${l-1.5*h} Q ${s+1*h} ${l-3*h} ${s+6*h} ${l+3*h}" stroke="${c}" stroke-width="${y}" stroke-linecap="round" fill="none" /></g>`:`<g ${b}><path d="M ${s+5.5*h} ${l-1.5*h} Q ${s-1*h} ${l-3*h} ${s-6*h} ${l+3*h}" stroke="${c}" stroke-width="${y}" stroke-linecap="round" fill="none" /></g>`;case 16:return`<g ${b}><path d="M ${s} ${l-4.17*h} L ${s} ${l+3.33*h}" stroke="${c}" stroke-width="${y}" stroke-linecap="round" fill="none" /></g>`;case 17:return w?`<g ${b}><path d="M ${s+5.83*h} ${l-6.67*h} L ${s-5*h} ${l+.83*h}" stroke="${c}" stroke-width="${y}" stroke-linecap="round" fill="none" /></g>`:`<g ${b}><path d="M ${s-5.83*h} ${l-6.67*h} L ${s+5*h} ${l+.83*h}" stroke="${c}" stroke-width="${y}" stroke-linecap="round" fill="none" /></g>`;case 18:{const k=4.6*h,z=Yt().map(([A,H],ye)=>{const pe=(s+A*k).toFixed(2),oe=(l+H*k).toFixed(2);return`${ye===0?"M":"L"} ${pe} ${oe}`}).join(" ");return`<g ${b}><path d="${z}" stroke="${c}" stroke-width="1.3" stroke-linecap="round" fill="none" /></g>`}case 19:return`<g ${b}>
|
|
16
|
+
<circle cx="${s}" cy="${l}" r="${4.5*h}" fill="none" stroke="${c}" stroke-width="2.63" />
|
|
17
|
+
<path d="M ${s-2.83*h} ${l-.42*h} Q ${s} ${l+2.83*h} ${s+2.83*h} ${l-.42*h}" stroke="${c}" stroke-width="2.63" stroke-linecap="round" fill="none" />
|
|
18
|
+
</g>`;case 20:return`<g ${b}><circle cx="${s}" cy="${l}" r="${3.67*h}" fill="none" stroke="${c}" stroke-width="2.8" /></g>`;case 21:{const k=6*h,z=k*.45,H=[[s,l-k],[s+z*.59,l-z*.81],[s+k*.95,l-k*.31],[s+z*.95,l+z*.31],[s+k*.59,l+k*.81],[s,l+z],[s-k*.59,l+k*.81],[s-z*.95,l+z*.31],[s-k*.95,l-k*.31],[s-z*.59,l-z*.81]].map((ye,pe)=>`${pe===0?"M":"L"} ${ye[0].toFixed(2)} ${ye[1].toFixed(2)}`).join(" ")+" Z";return`<g ${b}><path d="${H}" fill="${c}" /></g>`}case 22:return w?`<g ${b}><path d="M ${s-5*h} ${l-3*h} L ${s+4*h} ${l-3*h} L ${s+4*h} ${l+3*h}" stroke="${c}" stroke-width="${y}" stroke-linecap="round" stroke-linejoin="round" fill="none" /></g>`:`<g ${b}><path d="M ${s+5*h} ${l-3*h} L ${s-4*h} ${l-3*h} L ${s-4*h} ${l+3*h}" stroke="${c}" stroke-width="${y}" stroke-linecap="round" stroke-linejoin="round" fill="none" /></g>`;case 23:return w?`<ellipse cx="${s.toFixed(2)}" cy="${l.toFixed(2)}" rx="${(2.83*S).toFixed(2)}" ry="${Math.max(.5,2.83*S*Math.max(.05,e.eyeOpen)).toFixed(2)}" fill="${c}" />`:`<g ${b}><path d="M ${s-5.83*h} ${l+1*h} Q ${s} ${l-5*h} ${s+5.83*h} ${l+1*h}" stroke="${c}" stroke-width="${y}" stroke-linecap="round" fill="none" /></g>`;case 24:return`<g ${b}>
|
|
19
|
+
<ellipse cx="${s}" cy="${l}" rx="${4.2*S}" ry="${4.8*S}" fill="${c}" />
|
|
20
|
+
<circle cx="${s-1.5*h}" cy="${l-1.8*h}" r="${1.6*h}" fill="#FFFFFF" />
|
|
21
|
+
<circle cx="${s+1.5*h}" cy="${l+1.5*h}" r="${.9*h}" fill="#FFFFFF" />
|
|
22
|
+
</g>`;case 25:return w?`<g ${b}>
|
|
23
|
+
<path d="M ${s-5.5*h} ${l-1*h} Q ${s} ${l+5.5*h} ${s+5.5*h} ${l-1*h}" stroke="${c}" stroke-width="${y}" stroke-linecap="round" fill="none" />
|
|
24
|
+
<line x1="${s+4.5*h}" y1="${l}" x2="${s+7.5*h}" y2="${l-3*h}" stroke="${c}" stroke-width="${y*.75}" stroke-linecap="round" />
|
|
25
|
+
</g>`:`<g ${b}>
|
|
26
|
+
<path d="M ${s-5.5*h} ${l-1*h} Q ${s} ${l+5.5*h} ${s+5.5*h} ${l-1*h}" stroke="${c}" stroke-width="${y}" stroke-linecap="round" fill="none" />
|
|
27
|
+
<line x1="${s-4.5*h}" y1="${l}" x2="${s-7.5*h}" y2="${l-3*h}" stroke="${c}" stroke-width="${y*.75}" stroke-linecap="round" />
|
|
28
|
+
</g>`;case 26:return`<g ${b}>
|
|
29
|
+
<circle cx="${s}" cy="${l}" r="${5.8*S}" fill="#FFFFFF" stroke="${c}" stroke-width="2.2" />
|
|
30
|
+
<circle cx="${s+(e.gazeX?e.gazeX*.15:0)}" cy="${l+(e.gazeY?e.gazeY*.15:0)}" r="${2.5*S}" fill="${c}" />
|
|
31
|
+
</g>`;case 27:return`<g ${b}><path d="M ${s-6*h} ${l} Q ${s} ${l-5*h} ${s+6*h} ${l}" stroke="${c}" stroke-width="${y}" stroke-linecap="round" fill="none" /></g>`;case 28:return`<g ${b}><line x1="${s-5.5*h}" y1="${l}" x2="${s+5.5*h}" y2="${l}" stroke="${c}" stroke-width="${y}" stroke-linecap="round" /></g>`;case 29:return`<g ${b}>
|
|
32
|
+
<ellipse cx="${s}" cy="${l+1*h}" rx="${2.8*S}" ry="${2.8*S}" fill="${c}" />
|
|
33
|
+
<path d="M ${s-4*h} ${l-4*h} Q ${s} ${l-7*h} ${s+4*h} ${l-5*h}" stroke="${c}" stroke-width="2.2" stroke-linecap="round" fill="none" />
|
|
34
|
+
</g>`;case 30:return`<g ${b}><path d="M ${s-5*h} ${l-3*h} L ${s-1.5*h} ${l+3*h} L ${s+1.5*h} ${l-3*h} L ${s+5*h} ${l+3*h}" stroke="${c}" stroke-width="${y*.8}" stroke-linecap="round" stroke-linejoin="round" fill="none" /></g>`;case 31:return`<g ${b}>
|
|
35
|
+
<circle cx="${s}" cy="${l}" r="${4.8*S}" fill="none" stroke="${c}" stroke-width="2.2" />
|
|
36
|
+
<circle cx="${s}" cy="${l}" r="${1.8*S}" fill="${c}" />
|
|
37
|
+
</g>`;case 0:default:const q=2.83*S,te=Math.max(.5,q*Math.max(.05,e.eyeOpen));return`<ellipse cx="${s.toFixed(2)}" cy="${l.toFixed(2)}" rx="${q.toFixed(2)}" ry="${te.toFixed(2)}" fill="${c}" />`}};we=W.isVisible?Ye(W.projX,P,W.scaleX,!1):"",xe=L.isVisible?Ye(L.projX,P,L.scaleX,!0):"";let be="";const Fe=e.tears??0;if(Fe>.01){const s=Math.min(1,Fe),l=n*.36%1;let C=0,w=s,S=1;if(l<.25){const b=l/.25;C=b*1.2,S=.75+b*.35,w=s*(.3+b*.7)}else if(l<.82){const b=(l-.25)/.57;C=1.2+b*10.5,S=1.1-b*.2,w=s}else{const b=(l-.82)/.18;C=11.7+b*2.5,S=.9-b*.4,w=s*(1-b)}if(e.cascadeTears)be=`
|
|
38
|
+
<g opacity="${w.toFixed(2)}">
|
|
39
|
+
<path d="M ${W.projX-3} ${P+4} L ${W.projX-6} 88 L ${W.projX+2} 88 Z" fill="#7FA6D9" opacity="0.85" />
|
|
40
|
+
<path d="M ${L.projX-2} ${P+4} L ${L.projX-2} 88 L ${L.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 ${z} ${(X-2.5).toFixed(2)} C ${(S+2.2).toFixed(2)} ${(X-.5).toFixed(2)} ${(S+2.2).toFixed(2)} ${(X+2.2).toFixed(2)} ${z} ${(X+3.2).toFixed(2)} C ${(S-2.2).toFixed(2)} ${(X+2.2).toFixed(2)} ${(S-2.2).toFixed(2)} ${(X-.5).toFixed(2)} ${z} ${(X-2.5).toFixed(2)} Z" fill="#ffffff" />
|
|
52
|
-
<!-- Lágrima redondita ojo derecho -->
|
|
53
|
-
<path d="M ${P} ${(X-2.5).toFixed(2)} C ${(x+2.2).toFixed(2)} ${(X-.5).toFixed(2)} ${(x+2.2).toFixed(2)} ${(X+2.2).toFixed(2)} ${P} ${(X+3.2).toFixed(2)} C ${(x-2.2).toFixed(2)} ${(X+2.2).toFixed(2)} ${(x-2.2).toFixed(2)} ${(X-.5).toFixed(2)} ${P} ${(X-2.5).toFixed(2)} Z" fill="#ffffff" />
|
|
42
|
+
`;else{const b=(P+7).toFixed(2),q=(W.projX-1.2).toFixed(2),te=(L.projX+1.2).toFixed(2),k=parseFloat(q),z=parseFloat(te),A=parseFloat(b);be=`
|
|
43
|
+
<g opacity="${w.toFixed(2)}">
|
|
44
|
+
<g class="wissive-anim-tear" style="transform-origin: ${k}px ${A}px;">
|
|
45
|
+
<path d="M ${k} ${(A+C-2.5).toFixed(2)} C ${(k-2).toFixed(2)} ${(A+C).toFixed(2)} ${(k-2.5).toFixed(2)} ${(A+C+2.5).toFixed(2)} ${k} ${(A+C+3.2).toFixed(2)} C ${(k+2.5).toFixed(2)} ${(A+C+2.5).toFixed(2)} ${(k+2).toFixed(2)} ${(A+C).toFixed(2)} ${k} ${(A+C-2.5).toFixed(2)} Z" fill="#7FA6D9" transform="scale(1, ${S.toFixed(2)})" />
|
|
54
46
|
</g>
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
<g transform="translate(${L.toFixed(2)}, ${p.toFixed(2)}) scale(${x}) translate(-72, -31)" opacity="${P.toFixed(2)}">
|
|
58
|
-
<path d="M 68 28 L 76 28 L 68 34 L 76 34" stroke-width="${S}" />
|
|
59
|
-
</g>
|
|
60
|
-
`)}R+="</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);R+='<g fill="#7FA6D9">';for(const k of r){const C=(a*1.2+k.delay)%1,L=25+C*7,p=l*Math.sin(C*Math.PI);p>.01&&(R+=`
|
|
61
|
-
<g transform="translate(${k.x}, ${L.toFixed(2)}) scale(${k.scale}) translate(-80, -25)" opacity="${p.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: ${z}px ${A}px; animation-delay: -0.9s;">
|
|
48
|
+
<path d="M ${z} ${(A+C-2.5).toFixed(2)} C ${(z-2).toFixed(2)} ${(A+C).toFixed(2)} ${(z-2.5).toFixed(2)} ${(A+C+2.5).toFixed(2)} ${z} ${(A+C+3.2).toFixed(2)} C ${(z+2.5).toFixed(2)} ${(A+C+2.5).toFixed(2)} ${(z+2).toFixed(2)} ${(A+C).toFixed(2)} ${z} ${(A+C-2.5).toFixed(2)} Z" fill="#7FA6D9" transform="scale(1, ${S.toFixed(2)})" />
|
|
63
49
|
</g>
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
<
|
|
50
|
+
</g>
|
|
51
|
+
`}}let de="";if(e.showBrows!==void 0?e.showBrows>.5:e.browY!==0||e.browTilt!==0){const s=32+(e.browY??0),l=W.projX,C=L.projX,w=6*h,S=e.browTilt??0,b=-S;de=`
|
|
52
|
+
<g>
|
|
53
|
+
<line
|
|
54
|
+
x1="${l-w}"
|
|
55
|
+
y1="${s}"
|
|
56
|
+
x2="${l+w}"
|
|
57
|
+
y2="${s}"
|
|
58
|
+
stroke="${c}"
|
|
59
|
+
stroke-width="2.6"
|
|
60
|
+
stroke-linecap="round"
|
|
61
|
+
transform="rotate(${S}, ${l}, ${s})"
|
|
62
|
+
/>
|
|
63
|
+
<line
|
|
64
|
+
x1="${C-w}"
|
|
65
|
+
y1="${s}"
|
|
66
|
+
x2="${C+w}"
|
|
67
|
+
y2="${s}"
|
|
68
|
+
stroke="${c}"
|
|
69
|
+
stroke-width="2.6"
|
|
70
|
+
stroke-linecap="round"
|
|
71
|
+
transform="rotate(${b}, ${C}, ${s})"
|
|
72
|
+
/>
|
|
73
|
+
</g>
|
|
74
|
+
`}let ne="";if(e.sweat){const s=Math.min(1,e.sweat);ne+=`
|
|
75
|
+
<g class="wissive-anim-sweat" opacity="${s.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" />
|
|
78
|
+
</g>
|
|
79
|
+
`}if(e.zzz){const s=Math.min(1,e.zzz);ne+=`
|
|
80
|
+
<g opacity="${s.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>
|
|
84
|
+
</g>
|
|
85
|
+
`}if(e.storm){const s=Math.min(1,e.storm),l=Math.sin(n*1.4)*1.2,C=Math.sin(n*1.4+1.8)*1.2,w=.85+Math.sin(n*1.4)*.15,S=.85+Math.sin(n*1.4+1.8)*.15;ne+=`
|
|
86
|
+
<g opacity="${s.toFixed(2)}" fill="#8a8a86">
|
|
87
|
+
<path transform="translate(${l.toFixed(2)}, ${(Math.abs(l)*-.4).toFixed(2)})" opacity="${w.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(${C.toFixed(2)}, ${(Math.abs(C)*-.4).toFixed(2)})" opacity="${S.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" />
|
|
68
89
|
</g>
|
|
69
|
-
`}if(e.scribble){const
|
|
70
|
-
<g transform="translate(50, 3) rotate(${l.toFixed(2)}) translate(-50, -3)" opacity="${
|
|
71
|
-
${
|
|
90
|
+
`}if(e.scribble){const s=Math.min(1,e.scribble),l=Math.sin(n*1.6)*6,C=1+Math.sin(n*2.3)*.06;ne+=`
|
|
91
|
+
<g transform="translate(50, 3) rotate(${l.toFixed(2)}) translate(-50, -3)" opacity="${s.toFixed(2)}">
|
|
92
|
+
${Xo(50,3,C,"#5B7FD6",2.3)}
|
|
72
93
|
</g>
|
|
73
|
-
`}if(e.puff){const
|
|
74
|
-
<g fill="#B9BDB6" opacity="${
|
|
94
|
+
`}if(e.puff){const s=n*.55%1,l=e.mouthY??63,C=68+s*12,w=l-s*10,S=.4+s*.9,b=Math.min(1,e.puff)*Math.sin(s*Math.PI)*.8;b>.01&&(ne+=`
|
|
95
|
+
<g fill="#B9BDB6" opacity="${b.toFixed(2)}" transform="translate(${C.toFixed(2)}, ${w.toFixed(2)}) scale(${S.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="${
|
|
100
|
+
`)}let ge="";if(e.whiskers)ge=`
|
|
101
|
+
<g stroke="${c}" stroke-width="2" stroke-linecap="round" opacity="${(e.cheek||.7).toFixed(2)}">
|
|
102
|
+
<line x1="${W.projX-10}" y1="52" x2="${W.projX-18}" y2="50" />
|
|
103
|
+
<line x1="${W.projX-10}" y1="56" x2="${W.projX-17}" y2="58" />
|
|
104
|
+
<line x1="${L.projX+10}" y1="52" x2="${L.projX+18}" y2="50" />
|
|
105
|
+
<line x1="${L.projX+10}" y1="56" x2="${L.projX+17}" y2="58" />
|
|
82
106
|
</g>
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
`}const
|
|
87
|
-
<rect x="${
|
|
88
|
-
<line x1="${
|
|
89
|
-
<line x1="${
|
|
90
|
-
<line x1="${
|
|
91
|
-
`;break
|
|
92
|
-
<path d="M ${
|
|
93
|
-
<path d="M ${
|
|
94
|
-
`;break
|
|
95
|
-
<g stroke="${h}" stroke-width="3.5" stroke-linecap="round">
|
|
96
|
-
<line x1="${m-5}" y1="${u-5}" x2="${m+5}" y2="${u+5}" />
|
|
97
|
-
<line x1="${m-5}" y1="${u+5}" x2="${m+5}" y2="${u-5}" />
|
|
98
|
-
</g>
|
|
99
|
-
`;break;case 8:w=`
|
|
107
|
+
`;else if(e.cheek>.05){const s=(e.cheekRadius??5.5)*(x?1.2:1),l=(e.cheekY??54)+E*.5,C=Math.min(1,e.cheek);ge=`
|
|
108
|
+
<ellipse cx="${W.projX-3.5}" cy="${l}" rx="${(s*W.scaleX).toFixed(2)}" ry="${(s*.7).toFixed(2)}" fill="${f}" opacity="${C.toFixed(2)}" />
|
|
109
|
+
<ellipse cx="${L.projX+3.5}" cy="${l}" rx="${(s*L.scaleX).toFixed(2)}" ry="${(s*.7).toFixed(2)}" fill="${f}" opacity="${C.toFixed(2)}" />
|
|
110
|
+
`}const Ee=50+T*.8,ke=(e.mouthY??63)+E*.6,g=(e.mouthScale??1)*(x?1.15:1),ve=e.mouthCurve??0,ae=e.mouthOpen??0,U=Math.round(e.mouthType??0);let Y="";const d=Ee,m=ke,F=5.83*g;switch(U){case 1:{const s=Math.max(1.8,(2.8+ae*3.5)*g);Y=`<ellipse cx="${d.toFixed(2)}" cy="${m.toFixed(2)}" rx="${s.toFixed(2)}" ry="${(s*(1+ae*.4)).toFixed(2)}" fill="${c}" />`;break}case 2:Y=`<path d="M ${(d-F).toFixed(2)} ${m.toFixed(2)} Q ${(d-F*.5).toFixed(2)} ${(m-2.5*g).toFixed(2)} ${d.toFixed(2)} ${m.toFixed(2)} Q ${(d+F*.5).toFixed(2)} ${(m+2.5*g).toFixed(2)} ${(d+F).toFixed(2)} ${m.toFixed(2)}" stroke="${c}" stroke-width="${y}" stroke-linecap="round" fill="none" />`;break;case 3:Y=`<line x1="${(d-F).toFixed(2)}" y1="${m.toFixed(2)}" x2="${(d+F).toFixed(2)}" y2="${m.toFixed(2)}" stroke="${c}" stroke-width="${y}" stroke-linecap="round" />`;break;case 4:{const s=7.5*g,l=4.2*g;Y=`
|
|
111
|
+
<rect x="${(d-s).toFixed(2)}" y="${(m-l*.5).toFixed(2)}" width="${(s*2).toFixed(2)}" height="${l.toFixed(2)}" rx="2" fill="#FFFFFF" stroke="${c}" stroke-width="2.2" />
|
|
112
|
+
<line x1="${(d-s).toFixed(2)}" y1="${m.toFixed(2)}" x2="${(d+s).toFixed(2)}" y2="${m.toFixed(2)}" stroke="${c}" stroke-width="1.8" />
|
|
113
|
+
<line x1="${(d-s*.33).toFixed(2)}" y1="${(m-l*.5).toFixed(2)}" x2="${(d-s*.33).toFixed(2)}" y2="${(m+l*.5).toFixed(2)}" stroke="${c}" stroke-width="1.8" />
|
|
114
|
+
<line x1="${(d+s*.33).toFixed(2)}" y1="${(m-l*.5).toFixed(2)}" x2="${(d+s*.33).toFixed(2)}" y2="${(m+l*.5).toFixed(2)}" stroke="${c}" stroke-width="1.8" />
|
|
115
|
+
`;break}case 5:{const s=(3.5+ae*4.5)*g;Y=`
|
|
116
|
+
<path d="M ${(d-F).toFixed(2)} ${m.toFixed(2)} Q ${d.toFixed(2)} ${(m+s*2.2).toFixed(2)} ${(d+F).toFixed(2)} ${m.toFixed(2)} Z" fill="${c}" />
|
|
117
|
+
<path d="M ${(d-F*.8).toFixed(2)} ${m.toFixed(2)} L ${(d+F*.8).toFixed(2)} ${m.toFixed(2)} L ${(d+F*.7).toFixed(2)} ${(m+s*.6).toFixed(2)} L ${(d-F*.7).toFixed(2)} ${(m+s*.6).toFixed(2)} Z" fill="#FFFFFF" />
|
|
118
|
+
`;break}case 6:{const s=(4+ae*5.5)*g;Y=`
|
|
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-F).toFixed(2)} ${m.toFixed(2)} Q ${d.toFixed(2)} ${(m+s*2.2).toFixed(2)} ${(d+F).toFixed(2)} ${m.toFixed(2)} Z" fill="${c}" />
|
|
121
|
+
<path d="M ${(d-F*.5).toFixed(2)} ${(m+s*1.3).toFixed(2)} Q ${d.toFixed(2)} ${(m+s*.8).toFixed(2)} ${(d+F*.5).toFixed(2)} ${(m+s*1.3).toFixed(2)} Q ${d.toFixed(2)} ${(m+s*2.1).toFixed(2)} ${(d-F*.5).toFixed(2)} ${(m+s*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 s=3.5*g;Y=`
|
|
124
|
+
<line x1="${(d-s).toFixed(2)}" y1="${(m-s).toFixed(2)}" x2="${(d+s).toFixed(2)}" y2="${(m+s).toFixed(2)}" stroke="${c}" stroke-width="${y}" stroke-linecap="round" />
|
|
125
|
+
<line x1="${(d+s).toFixed(2)}" y1="${(m-s).toFixed(2)}" x2="${(d-s).toFixed(2)}" y2="${(m+s).toFixed(2)}" stroke="${c}" stroke-width="${y}" stroke-linecap="round" />
|
|
126
|
+
`;break}case 8:{const s=12*g,l=7.5*g;Y=`
|
|
127
|
+
<rect x="${(d-s).toFixed(2)}" y="${(m-l*.4).toFixed(2)}" width="${(s*2).toFixed(2)}" height="${l.toFixed(2)}" rx="3" fill="#FFFFFF" stroke="#8A9BA8" stroke-width="1.8" />
|
|
128
|
+
<line x1="${(d-s).toFixed(2)}" y1="${m.toFixed(2)}" x2="${(d+s).toFixed(2)}" y2="${m.toFixed(2)}" stroke="#C8D4DE" stroke-width="1.2" />
|
|
129
|
+
`;break}case 9:Y=`
|
|
130
|
+
<path d="M ${(d-F).toFixed(2)} ${m.toFixed(2)} Q ${(d-F*.5).toFixed(2)} ${(m+3.2*g).toFixed(2)} ${d.toFixed(2)} ${m.toFixed(2)} Q ${(d+F*.5).toFixed(2)} ${(m+3.2*g).toFixed(2)} ${(d+F).toFixed(2)} ${m.toFixed(2)}" stroke="${c}" stroke-width="${y}" stroke-linecap="round" fill="none" />
|
|
131
|
+
`;break;case 10:Y=`<circle cx="${d.toFixed(2)}" cy="${m.toFixed(2)}" r="${(1.9*g).toFixed(2)}" fill="${c}" />`;break;case 11:Y=`<line x1="${(d-F*.8).toFixed(2)}" y1="${(m+2.5*g).toFixed(2)}" x2="${(d+F*.8).toFixed(2)}" y2="${(m-2.5*g).toFixed(2)}" stroke="${c}" stroke-width="${y}" stroke-linecap="round" />`;break;case 12:Y=`<path d="M ${(d-F).toFixed(2)} ${(m+2*g).toFixed(2)} Q ${d.toFixed(2)} ${(m-4.5*g).toFixed(2)} ${(d+F).toFixed(2)} ${(m+2*g).toFixed(2)}" stroke="${c}" stroke-width="${y}" stroke-linecap="round" fill="none" />`;break;case 13:Y=`<circle cx="${d.toFixed(2)}" cy="${m.toFixed(2)}" r="${(3.2*g).toFixed(2)}" fill="none" stroke="${c}" stroke-width="${y}" />`;break;case 14:Y="";break;case 15:{const s=3.2*g,l=4.8*g;Y=`
|
|
132
|
+
<line x1="${(d-F).toFixed(2)}" y1="${m.toFixed(2)}" x2="${(d+F).toFixed(2)}" y2="${m.toFixed(2)}" stroke="${c}" stroke-width="${y}" stroke-linecap="round" />
|
|
133
|
+
<path d="M ${(d-s*.7).toFixed(2)} ${m.toFixed(2)} C ${(d-s).toFixed(2)} ${(m+l).toFixed(2)} ${(d+s).toFixed(2)} ${(m+l).toFixed(2)} ${(d+s*.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:Y=`<path d="M ${(d-F*.4).toFixed(2)} ${m.toFixed(2)} Q ${(d+F*.4).toFixed(2)} ${(m+.5).toFixed(2)} ${(d+F*1.1).toFixed(2)} ${(m-3.5*g).toFixed(2)}" stroke="${c}" stroke-width="${y}" stroke-linecap="round" fill="none" />`;break;case 17:Y=`<path d="M ${(d-F*.6).toFixed(2)} ${(m+2.5*g).toFixed(2)} L ${d.toFixed(2)} ${(m-2.5*g).toFixed(2)} L ${(d+F*.6).toFixed(2)} ${(m+2.5*g).toFixed(2)} Z" fill="${c}" />`;break;case 18:Y=`<path d="M ${(d-F*.6).toFixed(2)} ${(m-2.2*g).toFixed(2)} Q ${(d+1).toFixed(2)} ${m.toFixed(2)} ${(d-F*.6).toFixed(2)} ${(m+2.2*g).toFixed(2)}" stroke="${c}" stroke-width="${y}" stroke-linecap="round" fill="none" />`;break;case 19:{const s=5*g,l=5.5*g;Y=`<rect x="${(d-s).toFixed(2)}" y="${(m-l*.5).toFixed(2)}" width="${(s*2).toFixed(2)}" height="${l.toFixed(2)}" rx="1.5" fill="${c}" />`;break}case 20:Y=`<path d="M ${(d-F*.7).toFixed(2)} ${(m-1).toFixed(2)} Q ${d.toFixed(2)} ${(m+2*g).toFixed(2)} ${(d+F*.7).toFixed(2)} ${(m-1).toFixed(2)}" stroke="${c}" stroke-width="${y}" stroke-linecap="round" fill="none" />`;break;case 21:{const s=8*g,l=3.8*g;Y=`
|
|
136
|
+
<rect x="${(d-s).toFixed(2)}" y="${(m-l*.5).toFixed(2)}" width="${(s*2).toFixed(2)}" height="${l.toFixed(2)}" rx="2" fill="#FFFFFF" stroke="${c}" stroke-width="2.2" />
|
|
137
|
+
<line x1="${(d-s*.5).toFixed(2)}" y1="${(m-l*.5).toFixed(2)}" x2="${(d-s*.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+s*.5).toFixed(2)}" y1="${(m-l*.5).toFixed(2)}" x2="${(d+s*.5).toFixed(2)}" y2="${(m+l*.5).toFixed(2)}" stroke="${c}" stroke-width="1.5" />
|
|
140
|
+
`;break}case 22:{Y=`
|
|
141
|
+
<path d="M ${(d-F).toFixed(2)} ${m.toFixed(2)} Q ${d.toFixed(2)} ${(m+3*g).toFixed(2)} ${(d+F).toFixed(2)} ${m.toFixed(2)}" stroke="${c}" stroke-width="${y}" stroke-linecap="round" fill="none" />
|
|
142
|
+
<path d="M ${(d+F*.2).toFixed(2)} ${(m+1).toFixed(2)} C ${(d+F*.2).toFixed(2)} ${(m+5*g).toFixed(2)} ${(d+F*.8).toFixed(2)} ${(m+5*g).toFixed(2)} ${(d+F*.8).toFixed(2)} ${(m+1).toFixed(2)} Z" fill="#FF5E7E" stroke="${c}" stroke-width="1.5" />
|
|
143
|
+
`;break}case 23:{const s=5.5*g;Y=`
|
|
144
|
+
<path d="M ${(d-F*1.1).toFixed(2)} ${m.toFixed(2)} Q ${d.toFixed(2)} ${(m+s*2.2).toFixed(2)} ${(d+F*1.1).toFixed(2)} ${m.toFixed(2)} Z" fill="${c}" />
|
|
145
|
+
<ellipse cx="${d.toFixed(2)}" cy="${(m+s*1.4).toFixed(2)}" rx="${(F*.65).toFixed(2)}" ry="${(s*.65).toFixed(2)}" fill="#FF6584" />
|
|
146
|
+
`;break}case 24:Y=`<path d="M ${(d-F*.5).toFixed(2)} ${(m-1).toFixed(2)} Q ${(d-1).toFixed(2)} ${(m+4*g).toFixed(2)} ${(d+F*.9).toFixed(2)} ${(m+1).toFixed(2)}" stroke="${c}" stroke-width="${y}" stroke-linecap="round" fill="none" />`;break;case 0:default:if(Math.abs(ve)<.05&&ae<.05)Y=`<line x1="${(d-F).toFixed(2)}" y1="${m.toFixed(2)}" x2="${(d+F).toFixed(2)}" y2="${m.toFixed(2)}" stroke="${c}" stroke-width="${y}" stroke-linecap="round" />`;else if(ae>.1){const s=(ae*5+1.5)*g,l=m+ve*5*g;Y=`<path d="M ${(d-F).toFixed(2)} ${m.toFixed(2)} Q ${d.toFixed(2)} ${(l+s).toFixed(2)} ${(d+F).toFixed(2)} ${m.toFixed(2)} Q ${d.toFixed(2)} ${(l-s*.3).toFixed(2)} ${(d-F).toFixed(2)} ${m.toFixed(2)} Z" fill="${c}" stroke="${c}" stroke-width="1.5" stroke-linejoin="round" />`}else{const s=m+ve*5*g;Y=`<path d="M ${(d-F).toFixed(2)} ${m.toFixed(2)} Q ${d.toFixed(2)} ${s.toFixed(2)} ${(d+F).toFixed(2)} ${m.toFixed(2)}" stroke="${c}" stroke-width="${y}" 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="${M?"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
|
+
${ge}
|
|
165
183
|
<!-- Accesorios (ZZZ, Gotas) -->
|
|
166
|
-
${R}
|
|
167
|
-
<!-- Lágrimas -->
|
|
168
184
|
${ne}
|
|
185
|
+
<!-- Lágrimas -->
|
|
186
|
+
${be}
|
|
169
187
|
<!-- Ojos -->
|
|
170
|
-
${
|
|
171
|
-
${
|
|
188
|
+
${we}
|
|
189
|
+
${xe}
|
|
172
190
|
<!-- Cejas -->
|
|
173
|
-
${
|
|
191
|
+
${de}
|
|
174
192
|
<!-- Boca -->
|
|
175
|
-
${
|
|
193
|
+
${Y}
|
|
176
194
|
</g>
|
|
177
195
|
</svg>
|
|
178
|
-
`}function
|
|
196
|
+
`}function Oo(o,t,e,i,a={}){return nt(o,t,e,i,a)}function at(){return typeof window>"u"||typeof window.matchMedia!="function"?!0:window.matchMedia("(hover: hover)").matches}function Xt(){return typeof window>"u"?!1:typeof window.matchMedia=="function"&&window.matchMedia("(hover: none)").matches||"ontouchstart"in window||typeof navigator<"u"&&navigator.maxTouchPoints>0}const Oe=new Set;let Ge=!1;function Ot(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 Oe){const n=r.element.getBoundingClientRect(),c=n.left+n.width/2,f=n.top+n.height/2;if(r.onGazeMove){const M=Math.max(-.6,Math.min(.6,(t-c)/i)),x=Math.max(-.6,Math.min(.6,(e-f)/a));r.onGazeMove(22*M,14*x)}if(r.isActive())continue;const u=Math.hypot(t-c,e-f)<=r.nearRadius;u!==r.isNear&&(r.isNear=u,r.onNearChange(u))}}function Go(o){Oe.add(o),!Ge&&typeof window<"u"&&(window.addEventListener("mousemove",Ot,{passive:!0}),Ge=!0)}function Wo(o){Oe.delete(o),Oe.size===0&&Ge&&typeof window<"u"&&(window.removeEventListener("mousemove",Ot),Ge=!1)}function Gt(o,t,e=120){if(typeof window>"u")return()=>{};let i=!1,a=!1,r=!1,n=!1;const c=()=>{i=!0,t.onHoverStart()},f=()=>{i=!1,a=!1,t.onHoverEnd()},y=Z=>{Z.button===0&&(a=!0,t.onClickStart())},u=()=>{a&&(a=!1,t.onClickEnd())},M=()=>{a=!0,t.onClickStart()},x=()=>{a&&(a=!1,t.onClickEnd())},T=()=>{a&&(a=!1,t.onClickEnd())},E=()=>{r=!0,t.onHoverStart()},R=()=>{r=!1,n&&(n=!1,a=!1,t.onClickEnd()),t.onHoverEnd()},P=Z=>{(Z.key==="Enter"||Z.key===" ")&&(Z.preventDefault(),n||(n=!0,a=!0,t.onClickStart()))},j=Z=>{(Z.key==="Enter"||Z.key===" ")&&(Z.preventDefault(),n&&(n=!1,a=!1,t.onClickEnd()))};o.addEventListener("mouseenter",c),o.addEventListener("mouseleave",f),o.addEventListener("mousedown",y),window.addEventListener("mouseup",u),o.addEventListener("focus",E),o.addEventListener("blur",R),o.addEventListener("keydown",P),o.addEventListener("keyup",j),o.addEventListener("touchstart",M,{passive:!0}),window.addEventListener("touchend",x,{passive:!0}),window.addEventListener("touchcancel",T,{passive:!0});const G={element:o,nearRadius:e,isNear:!1,isActive:()=>i||a||r,onNearChange:t.onNearChange,onGazeMove:t.onGazeMove};return(at()||t.onGazeMove)&&Go(G),()=>{o.removeEventListener("mouseenter",c),o.removeEventListener("mouseleave",f),o.removeEventListener("mousedown",y),window.removeEventListener("mouseup",u),o.removeEventListener("focus",E),o.removeEventListener("blur",R),o.removeEventListener("keydown",P),o.removeEventListener("keyup",j),o.removeEventListener("touchstart",M),window.removeEventListener("touchend",x),window.removeEventListener("touchcancel",T),Wo(G)}}let Ue;function Je(){return Ue||(Ue=import("cuelume").catch(()=>null)),Ue}class Wt{constructor(){v(this,"enabled",!0);v(this,"volume",.6);Je().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)),Je().then(e=>{try{e==null||e.setVolume(this.volume)}catch{}})}getVolumeLevel(){return this.volume}playCue(t,e={}){this.enabled&&Je().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 K=new Wt;function Bt(o){K.setEnabled(o)}function _t(){return K.isEnabled()}function Rt(o){K.setVolumeLevel(o)}function jt(){return K.getVolumeLevel()}class Zt{constructor(t,e){v(this,"particles",[]);v(this,"canvas");v(this,"ctx");v(this,"animating",!1);v(this,"rafId",null);v(this,"size");v(this,"dpr");v(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,n){const c=this.size*2.5,a=i??c/2,h=n??c/2;for(let b=0;b<e;b++){const $=Math.PI*2*b/e+(Math.random()-.5)*.7,d=2.5+Math.random()*3.5,M=this.createParticle(t,a,h,$,d);this.particles.push(M)}this.animating||(this.animating=!0,this.tick())}createParticle(t,e,i,n,c){const a=10+Math.random()*15,h=e+Math.cos(n)*a,b=i+Math.sin(n)*a,$=.6+Math.random()*.5,d={x:h,y:b,vx:Math.cos(n)*c,vy:Math.sin(n)*c-1.2,life:$,maxLife:$,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},M=Math.random()>.6,v=Y=>Y[Math.floor(Math.random()*Y.length)];switch(t){case"happy":d.shape=M?"sparkle":"heart",d.color=v(["#F2A9B8","#E3536C","#FF8FAB","#FFD1DC","#FFF0F5"]),d.vy-=.6;break;case"pleasure":d.shape=M?"circle":"petal",d.color=v(["#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=M?"sparkle":"star",d.color=v(["#F2CB4E","#FFD700","#FFA500","#FFF4CC"]),d.vy-=1,d.vx*=1.5,d.rotSpeed*=2;break;case"peaceful":d.shape=M?"circle":"ring",d.color=v(["#9AC9A0","#B5E8B5","#7FD17F","#E8F5E9"]),d.vy-=.8,d.swayFreq=8+Math.random()*4,d.swayAmp=.4+Math.random()*.4;break;case"normal":d.shape=M?"circle":"dot",d.color=v(["#C9DCD3","#A8C7BB","#E4F0EA","#8FB3A4"]),d.size*=.65,d.vx*=.5,d.vy*=.5;break;case"tired":d.shape=M?"ring":"zzz",d.color=v(["#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=M?"zzz":"bubble",d.color=v(["#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=M?"circle":"drop",d.color=v(["#7FA6D9","#A0C4E8","#6B9ACF","#E1F5FE"]),d.vy+=1.8,d.vx*=.3;break;case"disappointed":d.shape=M?"drop":"shard",d.color=v(["#EBD98A","#C9B86B","#F5E9B8","#A89550"]),d.vy+=1.2,d.vx*=.8,d.rotSpeed*=4;break;case"anxiety":d.shape=M?"circle":"zigzag",d.color=v(["#A99BD9","#C4B5F0","#8B7BC4","#D1C4E9"]),d.size*=.8,d.vx*=1.4;break;case"stress":d.shape=M?"zigzag":"spiral",d.color=v(["#C97F76","#E09A91","#A85F57","#F0BDB6"]),d.size*=.9,d.rotSpeed*=6,d.swayFreq=12+Math.random()*6,d.swayAmp=.6;break;case"anger":d.shape=M?"diamond":"ember",d.color=v(["#D9566A","#FF4444","#FF6B35","#FFA033"]),d.vy-=1.4,d.vx*=.7,d.size*=.9;break;case"surprised":d.shape=M?"dot":"burst",d.color=v(["#F0B98A","#FFCFA3","#FF9F1C","#FFE8D1"]),d.size*=1.15,d.vx*=1.8,d.vy*=1.8;break;case"numbness":d.shape=M?"dot":"glitch",d.color=v(["#D9C6E0","#C0A8CC","#EDE2F0","#A98FB8"]),d.vx*=.25,d.vy*=.25,d.life*=.6,d.rotSpeed=0;break;default:d.shape=M?"sparkle":"circle",d.color=v(["#F2A9B8","#F2CB4E","#9AC9A0"]);break}return d}drawParticle(t){const e=this.ctx,i=this.dpr,n=1-t.life/t.maxLife;let c=1;n<.18?c=n/.18:n>.65&&(c=(1-n)/.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 b=5,$=a*i,d=a*.45*i;for(let M=0;M<b*2;M++){const v=M%2===0?$:d,Y=M*Math.PI/b-Math.PI/2,A=Math.cos(Y)*v,B=Math.sin(Y)*v;M===0?e.moveTo(A,B):e.lineTo(A,B)}e.closePath(),e.fill();break}case"sparkle":{e.fillStyle=t.color,e.beginPath();const b=a*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,-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 b=a*.85*i;ht().forEach(([$,d],M)=>{const v=$*b,Y=d*b;M===0?e.moveTo(v,Y):e.lineTo(v,Y)}),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 b=0;b<4;b++){const $=b*Math.PI/2,d=a*.3*i,M=a*i;e.moveTo(Math.cos($)*d,Math.sin($)*d),e.lineTo(Math.cos($)*M,Math.sin($)*M)}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 vt{constructor(t,e,i){g(this,"posX",0);g(this,"posY",0);g(this,"velX",0);g(this,"velY",0);g(this,"dragging",!1);g(this,"startPointerX",0);g(this,"startPointerY",0);g(this,"lastPointerX",0);g(this,"lastPointerY",0);g(this,"lastPointerTime",0);g(this,"velocitySamples",[]);g(this,"MAX_SAMPLES",6);g(this,"springK",.08);g(this,"springD",.82);g(this,"tossDecay",.96);g(this,"maxStretch",.25);g(this,"animating",!1);g(this,"rafId",null);g(this,"onUpdate");g(this,"onDragStart");g(this,"onDragEnd");g(this,"el");g(this,"handlePointerDown",t=>{t.preventDefault(),this.startDrag(t.clientX,t.clientY)});g(this,"handlePointerMove",t=>{this.dragging&&this.moveDrag(t.clientX,t.clientY)});g(this,"handlePointerUp",()=>{this.dragging&&this.endDrag()});g(this,"handleTouchDown",t=>{t.preventDefault();const e=t.touches[0];this.startDrag(e.clientX,e.clientY)});g(this,"handleTouchMove",t=>{if(!this.dragging)return;t.preventDefault();const e=t.touches[0];this.moveDrag(e.clientX,e.clientY)});g(this,"handleTouchUp",()=>{this.dragging&&this.endDrag()});g(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),n=Math.hypot(this.velX,this.velY);if(i<.3&&n<.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(),n=Math.max(1,i-this.lastPointerTime);this.velocitySamples.push({x:(t-this.lastPointerX)/n,y:(e-this.lastPointerY)/n}),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 n=this.velocitySamples.length;this.velX=e/n*16,this.velY=i/n*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 n=this.posX,c=this.posY,a=Math.hypot(n,c),h=Math.min(this.maxStretch,a*.002),b=Math.atan2(c,n);t=1+h*Math.abs(Math.cos(b)),e=1-h*.5*Math.abs(Math.cos(b)),Math.abs(Math.sin(b))>Math.abs(Math.cos(b))&&(e=1+h*Math.abs(Math.sin(b)),t=1-h*.5*Math.abs(Math.sin(b))),i=Math.atan2(c,n)*.06}else{const n=Math.hypot(this.velX,this.velY),c=Math.min(this.maxStretch,n*.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 kt(){return typeof window>"u"||!window.matchMedia?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function Ct(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 co(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 Le(o){const[t,e,i]=co(o),n=b=>b<=.03928?b/12.92:Math.pow((b+.055)/1.055,2.4),c=n(t),a=n(e),h=n(i);return .2126*c+.7152*a+.0722*h}function Tt(o,t){const e=Le(o),i=Le(t),n=Math.max(e,i),c=Math.min(e,i);return(n+.05)/(c+.05)}function ho(o,t,e=3){const i=Tt(o,t);return{ratio:Number(i.toFixed(2)),passes:i>=e}}const uo={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 Qe(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 St(o,t,e){const i=Qe(o),n=Qe(t),c=Math.max(0,Math.min(1,e)),a=Math.round(i.r+(n.r-i.r)*c),h=Math.round(i.g+(n.g-i.g)*c),b=Math.round(i.b+(n.b-i.b)*c),$=d=>d.toString(16).padStart(2,"0");return`#${$(a)}${$(h)}${$(b)}`}function mo(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 Xe={bouncy(o,t,e,i){const n=Math.abs(Math.sin(t*e));o.bob+=n*i-i*.5,o.cheek+=n*.15,o.eyeScale+=n*.04,o.turnAngle+=Math.sin(t*e*.5)*.05},flutter(o,t,e,i){const n=Math.sin(t*e);o.shiftX+=n*i,o.bob+=Math.cos(t*e*.7)*i*.5,o.turnAngle+=n*.06,o.eyeScale-=Math.abs(n)*.03},serene(o,t,e,i){const n=Math.sin(t*e);o.bob+=n*i,o.eyeScale+=n*.05,o.cheek+=(n+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 n=Math.sin(t*e);o.bob+=n*i,o.eyeScale+=n*.025,o.gazeX+=Math.sin(t*e*.23)*2.5,o.turnAngle+=Math.sin(t*e*.31)*.03},droop(o,t,e,i){const n=t*e*.18%1,c=n<.82?n/.82:1-(n-.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 n=Math.sin(t*e)+Math.sin(t*e*2.7)*.4;o.bob+=n*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 n=Math.sin(t*e*3.1)*.35,c=Math.pow(Math.max(0,Math.sin(t*e*.35)),6);o.bob+=n*i-c*i*1.8,o.shiftX+=n*i*.5,o.eyeScale+=c*.18,o.browY-=c*2.5,o.browTilt-=c*.25},wilt(o,t,e,i){const n=(Math.sin(t*e*.6)+1)/2;o.bob+=n*i*1.8,o.mouthCurve-=n*.12,o.browY+=n*1.6,o.eyeScale-=n*.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 n=Math.sin(t*e);o.bob+=n*i*1.6,o.eyeScale+=n*.06,o.eyeOpen*=.35,o.cheek+=(n+1)*.05,o.turnAngle+=Math.sin(t*e-.8)*.05},pop(o,t,e,i){const n=Q(t,1/(e*.1),.18),c=Math.sin(t*e*1.6)*.18;o.bob+=c*i-n*i*2.2,o.eyeScale+=c*.02+n*.22,o.browY-=n*3,o.mouthOpen+=n*.25},drift(o,t,e,i){o.bob+=Math.sin(t*e)*i*.6;const n=Q(t,3.7,.04);o.shiftX+=n*(Math.random()-.5)*5,o.gazeX+=n*(Math.random()-.5)*6,o.eyeScale-=n*.08}};function wt(o,t,e,i,n,c=1){(Xe[o]||Xe.calm)(t,e,i,n*c)}const xt={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 Yt(o,t,e,i,n){const c=xt[o];return c?(c(t,e,i,n),!0):!1}const Et=600;function Ft(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 b=0,$=1;const d=()=>{if(!e)return;const M=c[b];o.applyStep(o.resolveStep(M)),t=setTimeout(()=>{var v;if(h==="ping-pong")c.length>1&&((b+$>=c.length||b+$<0)&&($=-$),b+=$);else if(b+=1,b>=c.length)if(h==="loop")b=0;else{i(),(v=a.onComplete)==null||v.call(a);return}d()},M.duration??Et)};d()},stop:i,isPlaying:()=>e}}const Be=[{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"]}],At=Be.flatMap(o=>o.states),zt=["idle","near","hover","click"],Pt=Be.find(o=>o.label==="Reacciones").states,It=At.filter(o=>!zt.includes(o));function Lt(o,t){return o??t??Pt}function Xt(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 Dt{constructor(t=[],e={}){g(this,"instances",new Map);g(this,"options");g(this,"connectedPairs",new Map);g(this,"isRunning",!1);g(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 n=i+1;n<t.length;n++){const c=t[i],a=t[n],h=c.getPosition(),b=a.getPosition(),$=b.x-h.x,d=b.y-h.y,M=Math.hypot($,d);if(M<=this.options.proximityThreshold&&M>0){const v=this.getPairKey(c.id,a.id);if(e.add(v),this.options.enableGazeSync){const A=Math.max(-.8,Math.min(.8,$/160))*22,B=Math.max(-.8,Math.min(.8,d/160))*14;c.setGaze({x:A,y:B}),a.setGaze({x:-A,y:-B})}let Y=this.connectedPairs.get(v);Y?Math.random()<.08&&this.options.enableSynergies&&(c.triggerParticles(1),a.triggerParticles(1)):(Y={idA:c.id,idB:a.id,connectedSince:Date.now()},this.connectedPairs.set(v,Y),this.triggerSynergy(c,a))}}for(const[i,n]of this.connectedPairs.entries())if(!e.has(i)){const c=this.instances.get(n.idA),a=this.instances.get(n.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,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",n=e.emotionCategory||"happy";if(q.playSound(i,"hover"),t.triggerParticles(6),e.triggerParticles(6),i==="happy"&&n==="happy")t.bounce(),e.bounce();else if(i==="happy"&&n==="sad"||i==="sad"&&n==="happy"){const c=i==="happy"?t:e,a=i==="sad"?t:e;c.setEmotion("hover"),a.setEmotion("near")}else(i==="intense"||n==="intense")&&(t.spin(.5),e.spin(.5))}destroy(){this.stop(),this.instances.clear(),this.connectedPairs.clear()}}function Gt(o=[],t={}){return new Dt(o,t)}const Ot="wissive:custom:";function yo(o){const t={};for(const e in o)t[e]=o[e].map(i=>({...i}));return t}function Wt(o,t={}){var $,d,M;const e=t.eyesFrom?H[t.eyesFrom]:void 0,i=t.mouthFrom?H[t.mouthFrom]:void 0,n=t.motionFrom?H[t.motionFrom]:void 0,c=t.particlesFrom?H[t.particlesFrom]:void 0,a=t.soundFrom?H[t.soundFrom]:void 0,h=yo(fe.expressions);for(const v in h){const Y=e&&((($=e.expressions[v])==null?void 0:$[0])??e.expressions.idle[0]),A=i&&(((d=i.expressions[v])==null?void 0:d[0])??i.expressions.idle[0]);h[v]=h[v].map(B=>({...B,...Y&&{eyeType:Y.eyeType,eyeScale:Y.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=(M=t.stateBank)==null?void 0:M.filter(v=>It.includes(v));return{name:o,emotion:"custom",baseColor:t.baseColor||fe.baseColor,silhouette:t.silhouette||"circle",motion:n?{...n.motion}:{...fe.motion},expressions:h,particleEmotion:c==null?void 0:c.emotion,soundEmotion:a==null?void 0:a.emotion,...b&&b.length>0&&{autonomousStatePool:b}}}function Bt(o,t){localStorage.setItem(Ot+o,JSON.stringify(t))}function fo(o){const t=localStorage.getItem(Ot+o);return t?JSON.parse(t):null}function po(o,t={}){const e=Wt(o,t);return H[o]=e,Bt(o,e),e}const bo={idle:1,near:.7,hover:.5,click:.35},jt={xs:48,sm:80,base:120,lg:160,xl:200,"2xl":240};function De(o="base"){return typeof o=="number"?o:jt[o]??120}function _t(o,t){const{target:e,size:i="base",interactive:n=!0,draggable:c=!0,nearRadius:a=120,sound:h=!0,flipX:b=!1,emphasis:$=!1,gazeTracking:d=!1,ambientParticles:M=!0,autonomousStates:v=!0,autonomousStatePool:Y,reducedMotion:A="auto",theme:B="auto"}=t,I=Ie(o)||Ie("mochi"),O=I.motion;let _=De(i),N=A,K=B,ae=I.baseColor;const ee=I.particleEmotion||I.emotion,ie=I.soundEmotion||I.emotion,D=()=>typeof N=="boolean"?N:kt(),F=document.createElement("div");F.className="wissive-wrapper",F.style.width=`${_}px`,F.style.height=`${_}px`,F.style.display="inline-block",F.style.position="relative";const s=document.createElement("div");s.className="wissive-emoji",s.setAttribute("role","img"),n&&s.setAttribute("tabindex","0");const we={idle:"Reposo",near:"Cerca",hover:"Hover",click:"Presionado"},le=y=>{s.setAttribute("aria-label",`${I.name} (${I.emotion}) emoji - Estado: ${we[y]||y}`)};le("idle"),s.style.width=`${_}px`,s.style.height=`${_}px`,s.style.display="inline-block",s.style.userSelect="none",s.style.cursor=n?"pointer":"default",s.style.willChange="transform",s.style.transformOrigin="center center",F.appendChild(s),e.appendChild(F);const pe=Ct(()=>{te()});let ce=b,ne=$,se=d,R=h,he=c,be=M,T=v,m=Lt(Y,I.autonomousStatePool);const u=new ct,w=I.expressions.idle,ue=u.pickVariant(w,"idle"),j=lt(ue,{stiffness:O.stiffness,damping:O.damping});let re=!1,r=!1,l=!1,k=Math.random()*100,C=!1,L=null,p=null;const z=new Mt(F,_);let P={offsetX:0,offsetY:0,scaleX:1,scaleY:1,rotation:0},S=null;const x=()=>{S||(S=new vt(s,y=>{P=y,X()},{onDragStart:()=>{R&&q.playSound(ie,"click")},onDragEnd:()=>{z.burst(ee,10),R&&q.playSound(ie,"bounce")}}))};he&&n&&x();const X=()=>{const y=D(),E=y?0:O.idleSpeed*.35,W=y?0:.04,V=1+W*Math.cos(k*E),J=1-W*Math.sin(k*E),ye=P.offsetX!==0||P.offsetY!==0||P.scaleX!==1||P.scaleY!==1;let Ye,Ee,Fe;ye?(Ye=V*P.scaleX,Ee=J*P.scaleY,Fe=P.rotation):(Ye=V,Ee=J,Fe=0);const Nt=P.offsetX,Jt=P.offsetY;s.style.transform=`translate(${Nt.toFixed(1)}px, ${Jt.toFixed(1)}px) rotate(${(Fe*180/Math.PI).toFixed(2)}deg) scale(${Ye.toFixed(4)}, ${Ee.toFixed(4)})`},te=()=>{const y=j.getValues(),E=u.getState();let W=I.baseColor;if(typeof K=="object"&&K.baseColor&&(W=K.baseColor),ae=St(ae,W,.15),C&&(y.eyeOpen=.05),!D()&&!Yt(E,y,k,O.idleSpeed,O.idleAmplitude)){const J=bo[E]??1;wt(O.motionType,y,k,O.idleSpeed,O.idleAmplitude,J)}X(),s.innerHTML=Oe(I.silhouette,ae,y,_,{flipX:ce,emphasis:ne},k)},de=(y=u.getState())=>{u.setState(y);const E=u.resolvePool(I.expressions,y);if(!(!E||E.length===0)){if(E.length===1){const W=u.pickVariant(E,y);j.setTargets(W),G.add(Z);return}C=!0,G.add(Z),setTimeout(()=>{const W=u.pickVariant(E,y);j.setTargets(W),G.add(Z),setTimeout(()=>{C=!1,G.add(Z)},120)},100)}},U=y=>{le(y),de(y)},oe=Ft({resolveStep(y){return{...y.state?u.pickVariant(u.resolvePool(I.expressions,y.state),y.state):{},...y.params}},applyStep(y){j.setTargets(y),G.add(Z)}}),Z=y=>{k+=y;const E=j.update(y);te(),!E&&u.getState()!=="idle"&&G.remove(Z)};G.add(Z);const je=()=>{const W=3e3+Math.random()*4e3;p=window.setTimeout(()=>{u.getState()==="idle"&&!C&&(C=!0,G.add(Z),L=window.setTimeout(()=>{C=!1,G.add(Z)},180)),je()},W)};je();let $e=null;const _e=()=>{const y=O.idleIntervalMin,E=O.idleIntervalMax,W=y+Math.random()*(E-y);$e=window.setTimeout(()=>{u.getState()==="idle"&&!oe.isPlaying()&&de("idle"),_e()},W)};_e();let ge=null,Me=null;const Re=()=>{const W=3500+Math.random()*4500;ge=window.setTimeout(()=>{if(u.getState()==="idle"&&!se&&!oe.isPlaying()){const V=[{x:-9,y:0},{x:9,y:0},{x:-7,y:-4},{x:7,y:-4},{x:0,y:-5},{x:0,y:4}],J=V[Math.floor(Math.random()*V.length)];j.setTargets({gazeX:J.x,gazeY:J.y}),G.add(Z);const ye=1200+Math.random()*1500;Me=window.setTimeout(()=>{se||(j.setTargets({gazeX:0,gazeY:0}),G.add(Z))},ye)}Re()},W)};Re();let ve=null;const Ze=()=>{const W=3500+Math.random()*5e3;ve=window.setTimeout(()=>{if(be&&!D()){const V=u.getState();if(V==="idle"||V==="near"||V==="hover"){const J=Math.floor(2+Math.random()*3);z.burst(ee,J)}}Ze()},W)};Ze();let ke=null,Ce=null,Ne=null;const Je=()=>{const W=5e3+Math.random()*6e3;ke=window.setTimeout(()=>{if(T&&m.length>0&&!D()&&!oe.isPlaying()&&u.getState()==="idle"&&!re&&!r&&!l){const J=Xt(m,Ne);Ne=J,U(J);const ye=1800+Math.random()*2200;Ce=window.setTimeout(()=>{u.getState()===J&&!re&&!r&&!l&&U("idle")},ye)}Je()},W)};Je();const Zt=()=>{$e!==null&&(clearTimeout($e),$e=null),p!==null&&(clearTimeout(p),p=null),L!==null&&(clearTimeout(L),L=null),ge!==null&&(clearTimeout(ge),ge=null),Me!==null&&(clearTimeout(Me),Me=null),ve!==null&&(clearTimeout(ve),ve=null),ke!==null&&(clearTimeout(ke),ke=null),Ce!==null&&(clearTimeout(Ce),Ce=null)};let xe=null;const me=()=>l?"click":r?"hover":re?"near":"idle";return n&&(xe=yt(s,{onHoverStart:()=>{r=!0,R&&q.playSound(ie,"hover"),U(me())},onHoverEnd:()=>{r=!1,U(me())},onClickStart:()=>{l=!0,R&&q.playSound(ie,"click"),D()||z.burst(ee,8),U(me())},onClickEnd:()=>{l=!1,U(me())},onNearChange:y=>{re=y,U(me())},onGazeMove:(y,E)=>{se&&(j.setTargets({gazeX:y,gazeY:E}),G.add(Z))}},a)),{id:"wissive-"+Math.random().toString(36).substring(2,9),name:I.name,emotionCategory:I.emotion,getElement(){return s},getPosition(){const y=s.getBoundingClientRect();return{x:y.left+y.width/2,y:y.top+y.height/2}},getCurrentState(){return u.getState()},setEmotion(y){D()||(y==="click"?z.burst(ee,8):y==="hover"&&z.burst(ee,4)),U(y)},spin(y=1){const E=j.getValues().turnAngle||0;j.setTargets({turnAngle:E+Math.PI*2*y}),G.add(Z)},bounce(){R&&q.playSound(ie,"bounce"),D()||z.burst(ee,5);const y=j.getValues().bob||0;j.setTargets({bob:y-14}),G.add(Z)},setGaze(y){j.setTargets({gazeX:y.x,gazeY:y.y}),G.add(Z)},setGazeTracking(y){se=y,y||(j.setTargets({gazeX:0,gazeY:0}),G.add(Z))},setSound(y){R=y},setDraggable(y){he=y,y&&!S&&n?x():!y&&S&&(S.destroy(),S=null,P={offsetX:0,offsetY:0,scaleX:1,scaleY:1,rotation:0,isDragging:!1},X())},setFlipX(y){ce=y,te()},setEmphasis(y){ne=y,te()},setAmbientParticles(y){be=y},setAutonomousStates(y){T=y},setAutonomousStatePool(y){m=y},setReducedMotion(y){N=y,te()},setTheme(y){K=y,te()},setSize(y){_=De(y),F.style.width=`${_}px`,F.style.height=`${_}px`,s.style.width=`${_}px`,s.style.height=`${_}px`,z.resize(_),te()},triggerParticles(y=8){D()||z.burst(ee,y)},playSequence(y,E){oe.play(y,E)},stopSequence(){oe.stop(),de(u.getState())},isSequencePlaying(){return oe.isPlaying()},destroy(){oe.stop(),Zt(),pe(),G.remove(Z),z.destroy(),S&&S.destroy(),xe&&xe(),F.remove()}}}const Rt={create:_t,createGroup:Gt,setGlobalSound:pt,isGlobalSoundEnabled:bt,setGlobalVolume:$t,getGlobalVolume:gt,supportsHover:We,isTouchDevice:dt};exports.ALL_STATES=At;exports.ALL_WANDERABLE_STATES=It;exports.AUTONOMOUS_STATES=Pt;exports.DEFAULT_STEP_MS=Et;exports.DragPhysics=vt;exports.EMOJI_BRIX=tt;exports.EMOJI_COTA=fe;exports.EMOJI_DOZY=He;exports.EMOJI_FIDGE=et;exports.EMOJI_KNOT=it;exports.EMOJI_LUMO=Ke;exports.EMOJI_MOCHI=Ge;exports.EMOJI_NIMA=Ue;exports.EMOJI_PIP=at;exports.EMOJI_SNUG=st;exports.EMOJI_SURI=qe;exports.EMOJI_VOID=nt;exports.EMOJI_WILT=ot;exports.EMOJI_ZUMI=Ve;exports.EmojiGroup=Dt;exports.IDLE_MOTIONS=Xe;exports.LIB=H;exports.PERSONALITY_DRIVEN_STATES=zt;exports.ParticleEmitter=Mt;exports.SIZE_PRESETS=jt;exports.STATE_GROUPS=Be;exports.STATE_MOTIONS=xt;exports.STATE_THEME_MAP=uo;exports.SoundEngine=ft;exports.StateManager=ct;exports.Wissive=Rt;exports.applyIdleMotion=wt;exports.applyStateMotion=Yt;exports.attachEventListeners=yt;exports.blendColors=St;exports.buildCustomEmoji=Wt;exports.buildFace=Oe;exports.checkContrast=ho;exports.createCustomEmoji=po;exports.createEmoji=_t;exports.createEmojiGroup=Gt;exports.createMultiSpring=lt;exports.createSequencePlayer=Ft;exports.default=Rt;exports.getContrastRatio=Tt;exports.getEmojiDefinition=Ie;exports.getGlobalVolume=gt;exports.getLuminance=Le;exports.getSilhouettePath=ut;exports.getThemeForState=mo;exports.isGlobalSoundEnabled=bt;exports.isReducedMotionPreferred=kt;exports.isTouchDevice=dt;exports.loadCustomEmoji=fo;exports.makeSpring=rt;exports.pickWithoutRepeat=Xt;exports.renderSvgElement=no;exports.resolveAutonomousStatePool=Lt;exports.resolveSize=De;exports.saveCustomEmoji=Bt;exports.setGlobalSound=pt;exports.setGlobalVolume=$t;exports.sharedLoop=G;exports.soundEngine=q;exports.subscribeToReducedMotion=Ct;exports.supportsHover=We;
|
|
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,n=i??r/2,c=a??r/2;for(let f=0;f<e;f++){const y=Math.PI*2*f/e+(Math.random()-.5)*.7,u=2.5+Math.random()*3.5,M=this.createParticle(t,n,c,y,u);this.particles.push(M)}this.animating||(this.animating=!0,this.tick())}createParticle(t,e,i,a,r){const n=10+Math.random()*15,c=e+Math.cos(a)*n,f=i+Math.sin(a)*n,y=.6+Math.random()*.5,u={x:c,y:f,vx:Math.cos(a)*r,vy:Math.sin(a)*r-1.2,life:y,maxLife:y,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},M=Math.random()>.6,x=T=>T[Math.floor(Math.random()*T.length)];switch(t){case"happy":u.shape=M?"sparkle":"heart",u.color=x(["#F2A9B8","#E3536C","#FF8FAB","#FFD1DC","#FFF0F5"]),u.vy-=.6;break;case"pleasure":u.shape=M?"circle":"petal",u.color=x(["#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=M?"sparkle":"star",u.color=x(["#F2CB4E","#FFD700","#FFA500","#FFF4CC"]),u.vy-=1,u.vx*=1.5,u.rotSpeed*=2;break;case"peaceful":u.shape=M?"circle":"ring",u.color=x(["#9AC9A0","#B5E8B5","#7FD17F","#E8F5E9"]),u.vy-=.8,u.swayFreq=8+Math.random()*4,u.swayAmp=.4+Math.random()*.4;break;case"normal":u.shape=M?"circle":"dot",u.color=x(["#C9DCD3","#A8C7BB","#E4F0EA","#8FB3A4"]),u.size*=.65,u.vx*=.5,u.vy*=.5;break;case"tired":u.shape=M?"ring":"zzz",u.color=x(["#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=M?"zzz":"bubble",u.color=x(["#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=M?"circle":"drop",u.color=x(["#7FA6D9","#A0C4E8","#6B9ACF","#E1F5FE"]),u.vy+=1.8,u.vx*=.3;break;case"disappointed":u.shape=M?"drop":"shard",u.color=x(["#EBD98A","#C9B86B","#F5E9B8","#A89550"]),u.vy+=1.2,u.vx*=.8,u.rotSpeed*=4;break;case"anxiety":u.shape=M?"circle":"zigzag",u.color=x(["#A99BD9","#C4B5F0","#8B7BC4","#D1C4E9"]),u.size*=.8,u.vx*=1.4;break;case"stress":u.shape=M?"zigzag":"spiral",u.color=x(["#C97F76","#E09A91","#A85F57","#F0BDB6"]),u.size*=.9,u.rotSpeed*=6,u.swayFreq=12+Math.random()*6,u.swayAmp=.6;break;case"anger":u.shape=M?"diamond":"ember",u.color=x(["#D9566A","#FF4444","#FF6B35","#FFA033"]),u.vy-=1.4,u.vx*=.7,u.size*=.9;break;case"surprised":u.shape=M?"dot":"burst",u.color=x(["#F0B98A","#FFCFA3","#FF9F1C","#FFE8D1"]),u.size*=1.15,u.vx*=1.8,u.vy*=1.8;break;case"numbness":u.shape=M?"dot":"glitch",u.color=x(["#D9C6E0","#C0A8CC","#EDE2F0","#A98FB8"]),u.vx*=.25,u.vy*=.25,u.life*=.6,u.rotSpeed=0;break;default:u.shape=M?"sparkle":"circle",u.color=x(["#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 n=t.size*r;if(n<=.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,n*.35*i),e.bezierCurveTo(-n*.7*i,-n*.1*i,-n*.8*i,-n*.8*i,0,-n*.45*i),e.bezierCurveTo(n*.8*i,-n*.8*i,n*.7*i,-n*.1*i,0,n*.35*i),e.closePath(),e.fill();break;case"star":{e.fillStyle=t.color,e.beginPath();const f=5,y=n*i,u=n*.45*i;for(let M=0;M<f*2;M++){const x=M%2===0?y:u,T=M*Math.PI/f-Math.PI/2,E=Math.cos(T)*x,R=Math.sin(T)*x;M===0?e.moveTo(E,R):e.lineTo(E,R)}e.closePath(),e.fill();break}case"sparkle":{e.fillStyle=t.color,e.beginPath();const f=n*1.1*i;e.moveTo(0,-f),e.quadraticCurveTo(0,0,f,0),e.quadraticCurveTo(0,0,0,f),e.quadraticCurveTo(0,0,-f,0),e.quadraticCurveTo(0,0,0,-f),e.closePath(),e.fill();break}case"drop":e.fillStyle=t.color,e.beginPath(),e.moveTo(0,-n*.8*i),e.bezierCurveTo(n*.7*i,-n*.2*i,n*.6*i,n*.7*i,0,n*.7*i),e.bezierCurveTo(-n*.6*i,n*.7*i,-n*.7*i,-n*.2*i,0,-n*.8*i),e.closePath(),e.fill();break;case"diamond":e.fillStyle=t.color,e.beginPath(),e.moveTo(0,-n*i),e.lineTo(n*.65*i,0),e.lineTo(0,n*i),e.lineTo(-n*.65*i,0),e.closePath(),e.fill();break;case"zigzag":e.strokeStyle=t.color,e.lineWidth=Math.max(2,n*.25)*i,e.lineCap="round",e.lineJoin="round",e.beginPath(),e.moveTo(-n*.6*i,-n*.5*i),e.lineTo(-n*.1*i,-n*.1*i),e.lineTo(-n*.3*i,n*.1*i),e.lineTo(n*.6*i,n*.5*i),e.stroke();break;case"ring":e.strokeStyle=t.color,e.lineWidth=Math.max(1.5,n*.25)*i,e.beginPath(),e.arc(0,0,n*.55*i,0,Math.PI*2),e.stroke();break;case"zzz":e.strokeStyle=t.color,e.lineWidth=Math.max(2,n*.25)*i,e.lineCap="round",e.lineJoin="round",e.beginPath(),e.moveTo(-n*.4*i,-n*.5*i),e.lineTo(n*.4*i,-n*.5*i),e.lineTo(-n*.4*i,n*.5*i),e.lineTo(n*.4*i,n*.5*i),e.stroke();break;case"petal":e.fillStyle=t.color,e.beginPath(),e.moveTo(0,-n*.9*i),e.quadraticCurveTo(n*.75*i,-n*.1*i,0,n*.9*i),e.quadraticCurveTo(-n*.75*i,-n*.1*i,0,-n*.9*i),e.closePath(),e.fill();break;case"spiral":{e.strokeStyle=t.color,e.lineWidth=Math.max(1.5,n*.2)*i,e.lineCap="round",e.beginPath();const f=n*.85*i;Yt().forEach(([y,u],M)=>{const x=y*f,T=u*f;M===0?e.moveTo(x,T):e.lineTo(x,T)}),e.stroke();break}case"bubble":e.strokeStyle=t.color,e.lineWidth=Math.max(1,n*.14)*i,e.beginPath(),e.arc(0,0,n*.6*i,0,Math.PI*2),e.stroke(),e.fillStyle=t.color,e.globalAlpha*=.7,e.beginPath(),e.arc(-n*.22*i,-n*.24*i,n*.13*i,0,Math.PI*2),e.fill();break;case"ember":{e.fillStyle=t.color,e.beginPath(),e.moveTo(0,-n*.95*i),e.bezierCurveTo(n*.5*i,-n*.2*i,n*.62*i,n*.55*i,0,n*.75*i),e.bezierCurveTo(-n*.62*i,n*.55*i,-n*.5*i,-n*.2*i,0,-n*.95*i),e.closePath(),e.fill();break}case"shard":e.fillStyle=t.color,e.beginPath(),e.moveTo(0,-n*.9*i),e.lineTo(n*.55*i,-n*.15*i),e.lineTo(n*.2*i,n*.85*i),e.lineTo(-n*.45*i,n*.3*i),e.closePath(),e.fill();break;case"burst":{e.strokeStyle=t.color,e.lineWidth=Math.max(1.5,n*.22)*i,e.lineCap="round",e.beginPath();for(let f=0;f<4;f++){const y=f*Math.PI/2,u=n*.3*i,M=n*i;e.moveTo(Math.cos(y)*u,Math.sin(y)*u),e.lineTo(Math.cos(y)*M,Math.sin(y)*M)}e.stroke();break}case"dot":e.fillStyle=t.color,e.beginPath(),e.arc(0,0,n*.28*i,0,Math.PI*2),e.fill();break;case"glitch":e.fillStyle=t.color,e.fillRect(-n*.6*i,-n*.28*i,n*1.2*i,n*.22*i),e.globalAlpha*=.6,e.fillRect(-n*.25*i,n*.06*i,n*.9*i,n*.16*i);break;case"circle":default:e.fillStyle=t.color,e.beginPath(),e.arc(0,0,n*.5*i,0,Math.PI*2),e.fill();break}e.restore()}destroy(){this.rafId!==null&&cancelAnimationFrame(this.rafId),this.particles=[],this.canvas.remove()}}class Nt{constructor(t,e,i){v(this,"posX",0);v(this,"posY",0);v(this,"velX",0);v(this,"velY",0);v(this,"dragging",!1);v(this,"startPointerX",0);v(this,"startPointerY",0);v(this,"lastPointerX",0);v(this,"lastPointerY",0);v(this,"lastPointerTime",0);v(this,"velocitySamples",[]);v(this,"MAX_SAMPLES",6);v(this,"springK",.08);v(this,"springD",.82);v(this,"tossDecay",.96);v(this,"maxStretch",.25);v(this,"animating",!1);v(this,"rafId",null);v(this,"onUpdate");v(this,"onDragStart");v(this,"onDragEnd");v(this,"el");v(this,"handlePointerDown",t=>{t.preventDefault(),this.startDrag(t.clientX,t.clientY)});v(this,"handlePointerMove",t=>{this.dragging&&this.moveDrag(t.clientX,t.clientY)});v(this,"handlePointerUp",()=>{this.dragging&&this.endDrag()});v(this,"handleTouchDown",t=>{t.preventDefault();const e=t.touches[0];this.startDrag(e.clientX,e.clientY)});v(this,"handleTouchMove",t=>{if(!this.dragging)return;t.preventDefault();const e=t.touches[0];this.moveDrag(e.clientX,e.clientY)});v(this,"handleTouchUp",()=>{this.dragging&&this.endDrag()});v(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,n=Math.hypot(this.velX,this.velY);n>r&&(this.velX=this.velX/n*r,this.velY=this.velY/n*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,n=Math.hypot(a,r),c=Math.min(this.maxStretch,n*.002),f=Math.atan2(r,a);t=1+c*Math.abs(Math.cos(f)),e=1-c*.5*Math.abs(Math.cos(f)),Math.abs(Math.sin(f))>Math.abs(Math.cos(f))&&(e=1+c*Math.abs(Math.sin(f)),t=1-c*.5*Math.abs(Math.sin(f))),i=Math.atan2(r,a)*.06}else{const a=Math.hypot(this.velX,this.velY),r=Math.min(this.maxStretch,a*.012),n=Math.atan2(this.velY,this.velX);t=1+r*Math.abs(Math.cos(n)),e=1-r*.6*Math.abs(Math.cos(n)),Math.abs(Math.sin(n))>Math.abs(Math.cos(n))&&(e=1+r*Math.abs(Math.sin(n)),t=1-r*.6*Math.abs(Math.sin(n))),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 Ut(){return typeof window>"u"||!window.matchMedia?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function Jt(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 Bo(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]=Bo(o),a=f=>f<=.03928?f/12.92:Math.pow((f+.055)/1.055,2.4),r=a(t),n=a(e),c=a(i);return .2126*r+.7152*n+.0722*c}function qt(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 _o(o,t,e=3){const i=qt(o,t);return{ratio:Number(i.toFixed(2)),passes:i>=e}}const Ro={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 yt(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 Qt(o,t,e){const i=yt(o),a=yt(t),r=Math.max(0,Math.min(1,e)),n=Math.round(i.r+(a.r-i.r)*r),c=Math.round(i.g+(a.g-i.g)*r),f=Math.round(i.b+(a.b-i.b)*r),y=u=>u.toString(16).padStart(2,"0");return`#${y(n)}${y(c)}${y(f)}`}function jo(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 Vt(o,t,e,i,a,r=1){(Ke[o]||Ke.calm)(t,e,i,a*r)}const Ht={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 Kt(o,t,e,i,a){const r=Ht[o];return r?(r(t,e,i,a),!0):!1}const eo=600;function to(o){let t=null,e=!1;const i=()=>{t!==null&&(clearTimeout(t),t=null),e=!1};return{play:(r,n={})=>{if(i(),r.length===0)return;const c=n.mode??"once";e=!0;let f=0,y=1;const u=()=>{if(!e)return;const M=r[f];o.applyStep(o.resolveStep(M)),t=setTimeout(()=>{var x;if(c==="ping-pong")r.length>1&&((f+y>=r.length||f+y<0)&&(y=-y),f+=y);else if(f+=1,f>=r.length)if(c==="loop")f=0;else{i(),(x=n.onComplete)==null||x.call(n);return}u()},M.duration??eo)};u()},stop:i,isPlaying:()=>e}}const rt=[{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"]}],oo=rt.flatMap(o=>o.states),io=["idle","near","hover","click"],so=rt.find(o=>o.label==="Reacciones").states,no=oo.filter(o=>!io.includes(o));function ao(o,t){return o??t??so}function ro(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 lo{constructor(t=[],e={}){v(this,"instances",new Map);v(this,"options");v(this,"connectedPairs",new Map);v(this,"isRunning",!1);v(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],n=t[a],c=r.getPosition(),f=n.getPosition(),y=f.x-c.x,u=f.y-c.y,M=Math.hypot(y,u);if(M<=this.options.proximityThreshold&&M>0){const x=this.getPairKey(r.id,n.id);if(e.add(x),this.options.enableGazeSync){const E=Math.max(-.8,Math.min(.8,y/160))*22,R=Math.max(-.8,Math.min(.8,u/160))*14;r.setGaze({x:E,y:R}),n.setGaze({x:-E,y:-R})}let T=this.connectedPairs.get(x);T?Math.random()<.08&&this.options.enableSynergies&&(r.triggerParticles(1),n.triggerParticles(1)):(T={idA:r.id,idB:n.id,connectedSince:Date.now()},this.connectedPairs.set(x,T),this.triggerSynergy(r,n))}}for(const[i,a]of this.connectedPairs.entries())if(!e.has(i)){const r=this.instances.get(a.idA),n=this.instances.get(a.idB);r&&r.setGaze({x:0,y:0}),n&&n.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",a=e.emotionCategory||"happy";if(K.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,n=i==="sad"?t:e;r.setEmotion("hover"),n.setEmotion("near")}else(i==="intense"||a==="intense")&&(t.spin(.5),e.spin(.5))}destroy(){this.stop(),this.instances.clear(),this.connectedPairs.clear()}}function co(o=[],t={}){return new lo(o,t)}const ho="wissive:custom:";function Zo(o){const t={};for(const e in o)t[e]=o[e].map(i=>({...i}));return t}function uo(o,t={}){var y,u,M;const e=t.eyesFrom?ie[t.eyesFrom]:void 0,i=t.mouthFrom?ie[t.mouthFrom]:void 0,a=t.motionFrom?ie[t.motionFrom]:void 0,r=t.particlesFrom?ie[t.particlesFrom]:void 0,n=t.soundFrom?ie[t.soundFrom]:void 0,c=Zo(Se.expressions);for(const x in c){const T=e&&(((y=e.expressions[x])==null?void 0:y[0])??e.expressions.idle[0]),E=i&&(((u=i.expressions[x])==null?void 0:u[0])??i.expressions.idle[0]);c[x]=c[x].map(R=>({...R,...T&&{eyeType:T.eyeType,eyeScale:T.eyeScale},...E&&{mouthType:E.mouthType,mouthCurve:E.mouthCurve,mouthWidth:E.mouthWidth},...t.eyeTypeOverride!==void 0&&{eyeType:t.eyeTypeOverride},...t.mouthTypeOverride!==void 0&&{mouthType:t.mouthTypeOverride}}))}const f=(M=t.stateBank)==null?void 0:M.filter(x=>no.includes(x));return{name:o,emotion:"custom",baseColor:t.baseColor||Se.baseColor,silhouette:t.silhouette||"circle",motion:a?{...a.motion}:{...Se.motion},expressions:c,particleEmotion:r==null?void 0:r.emotion,soundEmotion:n==null?void 0:n.emotion,...f&&f.length>0&&{autonomousStatePool:f}}}function mo(o,t){localStorage.setItem(ho+o,JSON.stringify(t))}function No(o){const t=localStorage.getItem(ho+o);return t?JSON.parse(t):null}function Uo(o,t={}){const e=uo(o,t);return ie[o]=e,mo(o,e),e}const Jo={idle:1,near:.7,hover:.5,click:.35},yo={xs:48,sm:80,base:120,lg:160,xl:200,"2xl":240};function et(o="base"){return typeof o=="number"?o:yo[o]??120}function po(o,t){const{target:e,size:i="base",interactive:a=!0,draggable:r=!0,nearRadius:n=120,sound:c=!0,flipX:f=!1,emphasis:y=!1,gazeTracking:u=!1,ambientParticles:M=!0,autonomousStates:x=!0,autonomousStatePool:T,reducedMotion:E="auto",theme:R="auto"}=t,P=qe(o)||qe("mochi"),j=P.motion;let G=et(i),Z=E,ue=R,Me=P.baseColor;const ee=P.particleEmotion||P.emotion,W=P.soundEmotion||P.emotion,L=()=>typeof Z=="boolean"?Z:Ut(),h=document.createElement("div");h.className="wissive-wrapper",h.style.width=`${G}px`,h.style.height=`${G}px`,h.style.display="inline-block",h.style.position="relative";const D=document.createElement("div");D.className="wissive-emoji",D.setAttribute("role","img"),a&&D.setAttribute("tabindex","0");const we={idle:"Reposo",near:"Cerca",hover:"Hover",click:"Presionado"},xe=p=>{D.setAttribute("aria-label",`${P.name} (${P.emotion}) emoji - Estado: ${we[p]||p}`)};xe("idle"),D.style.width=`${G}px`,D.style.height=`${G}px`,D.style.display="inline-block",D.style.userSelect="none",D.style.cursor=a?"pointer":"default",D.style.willChange="transform",D.style.transformOrigin="center center",h.appendChild(D),e.appendChild(h);const Ye=Jt(()=>{oe()});let be=f,Fe=y,de=u,me=c,ne=r,ge=M,Ee=x,ke=ao(T,P.autonomousStatePool);const g=new ot,ve=P.expressions.idle,ae=g.pickVariant(ve,"idle"),U=wt(ae,{stiffness:j.stiffness,damping:j.damping});let Y=P.silhouette,d=[...Ve(Y)],m=[...d],F=[...d],We=0,s=400,l=!1,C=!1,w=!1,S=!1,b=Math.random()*100,q=!1,te=null,k=null;const z=new Zt(h,G);let A={offsetX:0,offsetY:0,scaleX:1,scaleY:1,rotation:0},H=null;const ye=()=>{H||(H=new Nt(D,p=>{A=p,pe()},{onDragStart:()=>{me&&K.playSound(W,"click")},onDragEnd:()=>{z.burst(ee,10),me&&K.playSound(W,"bounce")}}))};ne&&a&&ye();const pe=()=>{const p=L(),I=p?0:j.idleSpeed*.35,B=p?0:.04,Q=1+B*Math.cos(b*I),J=1-B*Math.sin(b*I),$e=A.offsetX!==0||A.offsetY!==0||A.scaleX!==1||A.scaleY!==1;let Re,je,Ze;$e?(Re=Q*A.scaleX,je=J*A.scaleY,Ze=A.rotation):(Re=Q,je=J,Ze=0);const bo=A.offsetX,go=A.offsetY;D.style.transform=`translate(${bo.toFixed(1)}px, ${go.toFixed(1)}px) rotate(${(Ze*180/Math.PI).toFixed(2)}deg) scale(${Re.toFixed(4)}, ${je.toFixed(4)})`},oe=()=>{const p=U.getValues(),I=g.getState();let B=P.baseColor;if(typeof ue=="object"&&ue.baseColor&&(B=ue.baseColor),Me=Qt(Me,B,.15),q&&(p.eyeOpen=.05),!L()&&!Kt(I,p,b,j.idleSpeed,j.idleAmplitude)){const J=Jo[I]??1;Vt(j.motionType,p,b,j.idleSpeed,j.idleAmplitude,J)}pe(),D.innerHTML=nt(P.silhouette,Me,p,G,{flipX:be,emphasis:Fe,radii:d},b)},Be=(p=g.getState())=>{g.setState(p);const I=g.resolvePool(P.expressions,p);if(!(!I||I.length===0)){if(I.length===1){const B=g.pickVariant(I,p);U.setTargets(B),O.add(N);return}q=!0,O.add(N),setTimeout(()=>{const B=g.pickVariant(I,p);U.setTargets(B),O.add(N),setTimeout(()=>{q=!1,O.add(N)},120)},100)}},ce=p=>{xe(p),Be(p)},fe=to({resolveStep(p){return{...p.state?g.pickVariant(g.resolvePool(P.expressions,p.state),p.state):{},...p.params}},applyStep(p){U.setTargets(p),O.add(N)}}),N=p=>{b+=p;const I=U.update(p);if(l){const Q=(typeof performance<"u"?performance.now():Date.now())-We,J=Math.min(1,Math.max(0,Q/s)),$e=1-Math.pow(1-J,4);d=Pt(F,m,$e),J>=1&&(l=!1,d=[...m])}oe(),!I&&!l&&g.getState()!=="idle"&&O.remove(N)};O.add(N);const lt=()=>{const B=3e3+Math.random()*4e3;k=window.setTimeout(()=>{g.getState()==="idle"&&!q&&(q=!0,O.add(N),te=window.setTimeout(()=>{q=!1,O.add(N)},180)),lt()},B)};lt();let Ae=null;const ct=()=>{const p=j.idleIntervalMin,I=j.idleIntervalMax,B=p+Math.random()*(I-p);Ae=window.setTimeout(()=>{g.getState()==="idle"&&!fe.isPlaying()&&Be("idle"),ct()},B)};ct();let Pe=null,ze=null;const ht=()=>{const B=3500+Math.random()*4500;Pe=window.setTimeout(()=>{if(g.getState()==="idle"&&!de&&!fe.isPlaying()){const Q=[{x:-9,y:0},{x:9,y:0},{x:-7,y:-4},{x:7,y:-4},{x:0,y:-5},{x:0,y:4}],J=Q[Math.floor(Math.random()*Q.length)];U.setTargets({gazeX:J.x,gazeY:J.y}),O.add(N);const $e=1200+Math.random()*1500;ze=window.setTimeout(()=>{de||(U.setTargets({gazeX:0,gazeY:0}),O.add(N))},$e)}ht()},B)};ht();let Ie=null;const ut=()=>{const B=3500+Math.random()*5e3;Ie=window.setTimeout(()=>{if(ge&&!L()){const Q=g.getState();if(Q==="idle"||Q==="near"||Q==="hover"){const J=Math.floor(2+Math.random()*3);z.burst(ee,J)}}ut()},B)};ut();let Le=null,De=null,dt=null;const mt=()=>{const B=5e3+Math.random()*6e3;Le=window.setTimeout(()=>{if(Ee&&ke.length>0&&!L()&&!fe.isPlaying()&&g.getState()==="idle"&&!C&&!w&&!S){const J=ro(ke,dt);dt=J,ce(J);const $e=1800+Math.random()*2200;De=window.setTimeout(()=>{g.getState()===J&&!C&&!w&&!S&&ce("idle")},$e)}mt()},B)};mt();const $o=()=>{Ae!==null&&(clearTimeout(Ae),Ae=null),k!==null&&(clearTimeout(k),k=null),te!==null&&(clearTimeout(te),te=null),Pe!==null&&(clearTimeout(Pe),Pe=null),ze!==null&&(clearTimeout(ze),ze=null),Ie!==null&&(clearTimeout(Ie),Ie=null),Le!==null&&(clearTimeout(Le),Le=null),De!==null&&(clearTimeout(De),De=null)};let _e=null;const Ce=()=>S?"click":w?"hover":C?"near":"idle";return a&&(_e=Gt(D,{onHoverStart:()=>{w=!0,me&&K.playSound(W,"hover"),ce(Ce())},onHoverEnd:()=>{w=!1,ce(Ce())},onClickStart:()=>{S=!0,me&&K.playSound(W,"click"),L()||z.burst(ee,8),ce(Ce())},onClickEnd:()=>{S=!1,ce(Ce())},onNearChange:p=>{C=p,ce(Ce())},onGazeMove:(p,I)=>{de&&(U.setTargets({gazeX:p,gazeY:I}),O.add(N))}},n)),{id:"wissive-"+Math.random().toString(36).substring(2,9),name:P.name,emotionCategory:P.emotion,getElement(){return D},getPosition(){const p=D.getBoundingClientRect();return{x:p.left+p.width/2,y:p.top+p.height/2}},getCurrentState(){return g.getState()},setEmotion(p){L()||(p==="click"?z.burst(ee,8):p==="hover"&&z.burst(ee,4)),ce(p)},spin(p=1){const I=U.getValues().turnAngle||0;U.setTargets({turnAngle:I+Math.PI*2*p}),O.add(N)},bounce(){me&&K.playSound(W,"bounce"),L()||z.burst(ee,5);const p=U.getValues().bob||0;U.setTargets({bob:p-14}),O.add(N)},setGaze(p){U.setTargets({gazeX:p.x,gazeY:p.y}),O.add(N)},setGazeTracking(p){de=p,p||(U.setTargets({gazeX:0,gazeY:0}),O.add(N))},setSound(p){me=p},setDraggable(p){ne=p,p&&!H&&a?ye():!p&&H&&(H.destroy(),H=null,A={offsetX:0,offsetY:0,scaleX:1,scaleY:1,rotation:0,isDragging:!1},pe())},setFlipX(p){be=p,oe()},setEmphasis(p){Fe=p,oe()},setAmbientParticles(p){ge=p},setAutonomousStates(p){Ee=p},setAutonomousStatePool(p){ke=p},setReducedMotion(p){Z=p,oe()},setTheme(p){ue=p,oe()},setSize(p){G=et(p),h.style.width=`${G}px`,h.style.height=`${G}px`,D.style.width=`${G}px`,D.style.height=`${G}px`,z.resize(G),oe()},setSilhouette(p,I=400){Y===p&&!l||(Y=p,P.silhouette=p,F=[...d],m=Ve(p),We=typeof performance<"u"?performance.now():Date.now(),s=L()?0:I,s===0?(d=[...m],l=!1):l=!0,O.add(N),oe())},setSpringConfig(p){U.setConfig(p)},triggerParticles(p=8){L()||z.burst(ee,p)},playSequence(p,I){fe.play(p,I)},stopSequence(){fe.stop(),Be(g.getState())},isSequencePlaying(){return fe.isPlaying()},destroy(){fe.stop(),$o(),Ye(),O.remove(N),z.destroy(),H&&H.destroy(),_e&&_e(),h.remove()}}}const fo={create:po,createGroup:co,setGlobalSound:Bt,isGlobalSoundEnabled:_t,setGlobalVolume:Rt,getGlobalVolume:jt,supportsHover:at,isTouchDevice:Xt};exports.ALL_STATES=oo;exports.ALL_WANDERABLE_STATES=no;exports.ANGLES=_;exports.AUTONOMOUS_STATES=so;exports.COS=le;exports.DEFAULT_STEP_MS=eo;exports.DragPhysics=Nt;exports.EMOJI_BRIX=xt;exports.EMOJI_COTA=Se;exports.EMOJI_DOZY=bt;exports.EMOJI_FIDGE=Mt;exports.EMOJI_KNOT=kt;exports.EMOJI_LUMO=gt;exports.EMOJI_MOCHI=tt;exports.EMOJI_NIMA=$t;exports.EMOJI_PIP=Ct;exports.EMOJI_SNUG=vt;exports.EMOJI_SURI=ft;exports.EMOJI_VOID=St;exports.EMOJI_WILT=Ft;exports.EMOJI_ZUMI=pt;exports.EmojiGroup=lo;exports.IDLE_MOTIONS=Ke;exports.LIB=ie;exports.PERSONALITY_DRIVEN_STATES=io;exports.PROFILE_SAMPLES=se;exports.ParticleEmitter=Zt;exports.SILHOUETTE_PROFILES=st;exports.SIN=he;exports.SIZE_PRESETS=yo;exports.SPRING_PRESETS=Qe;exports.STATE_GROUPS=rt;exports.STATE_MOTIONS=Ht;exports.STATE_THEME_MAP=Ro;exports.SoundEngine=Wt;exports.StateManager=ot;exports.TAU=it;exports.Wissive=fo;exports.applyIdleMotion=Vt;exports.applyStateMotion=Kt;exports.attachEventListeners=Gt;exports.blendColors=Qt;exports.blendProfiles=Pt;exports.buildCustomEmoji=uo;exports.buildFace=nt;exports.checkContrast=_o;exports.clamp=Po;exports.closedCatmullRomPath=It;exports.createCustomEmoji=Uo;exports.createEmoji=po;exports.createEmojiGroup=co;exports.createMultiSpring=wt;exports.createSequencePlayer=to;exports.createStateManager=Eo;exports.default=fo;exports.generateSilhouettePath=Lt;exports.getContrastRatio=qt;exports.getEmojiDefinition=qe;exports.getGlobalVolume=jt;exports.getLuminance=He;exports.getSilhouettePath=Dt;exports.getSilhouetteProfile=Ve;exports.getThemeForState=jo;exports.hullOfCircles=Xe;exports.isGlobalSoundEnabled=_t;exports.isReducedMotionPreferred=Ut;exports.isTouchDevice=Xt;exports.lerp=Et;exports.loadCustomEmoji=No;exports.makeSpring=Tt;exports.normalizeRadii=X;exports.pickWithoutRepeat=ro;exports.profileFromPolygon=Te;exports.r2=re;exports.renderSvgElement=Oo;exports.resolveAutonomousStatePool=ao;exports.resolveSize=et;exports.saveCustomEmoji=mo;exports.setGlobalSound=Bt;exports.setGlobalVolume=Rt;exports.sharedLoop=O;exports.soundEngine=K;exports.subscribeToReducedMotion=Jt;exports.superellipseProfile=At;exports.supportsHover=at;exports.toPoints=zt;
|
|
187
205
|
//# sourceMappingURL=wissive.cjs.map
|