PageSourceSearch

https://gogethired.io/_next/static/chunks/5ac1f982.d9cb435a4745fcb6.js

js gogethired.io collected 2026-10-02 01:58:46 UTC 131,083 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9596],{11529:(t,e,i)=>{i.d(e,{D:()=>L});var o=i(60043),a=i(53292),n=i(83670),s=i(50846),r=i(13473),h=i(63074),l=i(53167),d=i(81328),m=i(59669);let u=new i.U(i(59488)),p=new o.PTz,y=new o.O9p,g=new o.Pq0,c=new o.Pq0,x=new o.NRn;new o.kn4,new o.kn4,new o.Pq0,new o.Pq0(0,0,1);let f=new o.Pq0(1,0,0);new o.Pq0(0,1,0),new o.Pq0(0,0,1);class L{constructor(t,e=null){this.nodeAvatar=t,this.opt={jwtGet:null,ttsEndpoint:"",ttsApikey:null,ttsTrimStart:0,ttsTrimEnd:400,ttsLang:"fi-FI",ttsVoice:"fi-FI-Standard-A",ttsRate:1,ttsPitch:0,ttsVolume:0,mixerGainSpeech:null,mixerGainBackground:null,lipsyncLang:"fi",lipsyncModules:["fi","en","lt"],pcmSampleRate:22050,modelRoot:"Armature",modelPixelRatio:1,modelFPS:30,modelMovementFactor:1,cameraView:"full",dracoEnabled:!1,dracoDecoderPath:"https://www.gstatic.com/draco/v1/decoders/",cameraDistance:0,cameraX:0,cameraY:0,cameraRotateX:0,cameraRotateY:0,cameraRotateEnable:!0,cameraPanEnable:!1,cameraZoomEnable:!1,lightAmbientColor:0xffffff,lightAmbientIntensity:2,lightDirectColor:8947882,lightDirectIntensity:30,lightDirectPhi:1,lightDirectTheta:2,lightSpotIntensity:0,lightSpotColor:3377407,lightSpotPhi:.1,lightSpotTheta:4,lightSpotDispersion:1,avatarMood:"neutral",avatarMute:!1,avatarIdleEyeContact:.2,avatarIdleHeadMove:.5,avatarSpeakingEyeContact:.5,avatarSpeakingHeadMove:.5,avatarIgnoreCamera:!1,listeningSilenceThresholdLevel:40,listeningSilenceThresholdMs:2e3,listeningSilenceDurationMax:1e4,listeningActiveThresholdLevel:75,listeningActiveThresholdMs:300,listeningActiveDurationMax:24e4,update:null,avatarOnly:!1,avatarOnlyScene:null,avatarOnlyCamera:null,statsNode:null,statsStyle:null},Object.assign(this.opt,e||{}),this.opt.statsNode&&(this.stats=new d.A,this.opt.statsStyle&&(this.stats.dom.style.cssText=this.opt.statsStyle),this.opt.statsNode.appendChild(this.stats.dom)),this.poseTemplates={side:{standing:!0,props:{"Hips.position":{x:0,y:1,z:0},"Hips.rotation":{x:-.003,y:-.017,z:.1},"Spine.rotation":{x:-.103,y:-.002,z:-.063},"Spine1.rotation":{x:.042,y:-.02,z:-.069},"Spine2.rotation":{x:.131,y:-.012,z:-.065},"Neck.rotation":{x:.027,y:.006,z:0},"Head.rotation":{x:.077,y:-.065,z:0},"LeftShoulder.rotation":{x:1.599,y:.084,z:-1.77},"LeftArm.rotation":{x:1.364,y:.052,z:-.044},"LeftForeArm.rotation":{x:.002,y:-.007,z:.331},"LeftHand.rotation":{x:.104,y:-.067,z:-.174},"LeftHandThumb1.rotation":{x:.231,y:.258,z:.355},"LeftHandThumb2.rotation":{x:-.106,y:-.339,z:-.454},"LeftHandThumb3.rotation":{x:-.02,y:-.142,z:-.004},"LeftHandIndex1.rotation":{x:.148,y:.032,z:-.069},"LeftHandIndex2.rotation":{x:.326,y:-.049,z:-.029},"LeftHandIndex3.rotation":{x:.247,y:-.053,z:-.073},"LeftHandMiddle1.rotation":{x:.238,y:-.057,z:-.089},"LeftHandMiddle2.rotation":{x:.469,y:-.036,z:-.081},"LeftHandMiddle3.rotation":{x:.206,y:-.015,z:-.017},"LeftHandRing1.rotation":{x:.187,y:-.118,z:-.157},"LeftHandRing2.rotation":{x:.579,y:.02,z:-.097},"LeftHandRing3.rotation":{x:.272,y:.021,z:-.063},"LeftHandPinky1.rotation":{x:.405,y:-.182,z:-.138},"LeftHandPinky2.rotation":{x:.613,y:.128,z:-.144},"LeftHandPinky3.rotation":{x:.268,y:.094,z:-.081},"RightShoulder.rotation":{x:1.541,y:.192,z:1.775},"RightArm.rotation":{x:1.273,y:-.352,z:-.067},"RightForeArm.rotation":{x:-.011,y:-.031,z:-.357},"RightHand.rotation":{x:-.008,y:.312,z:-.028},"RightHandThumb1.rotation":{x:.23,y:-.258,z:-.355},"RightHandThumb2.rotation":{x:-.107,y:.339,z:.454},"RightHandThumb3.rotation":{x:-.02,y:.142,z:.004},"RightHandIndex1.rotation":{x:.148,y:-.031,z:.069},"RightHandIndex2.rotation":{x:.326,y:.049,z:.029},"RightHandIndex3.rotation":{x:.247,y:.053,z:.073},"RightHandMiddle1.rotation":{x:.237,y:.057,z:.089},"RightHandMiddle2.rotation":{x:.469,y:.036,z:.081},"RightHandMiddle3.rotation":{x:.206,y:.015,z:.017},"RightHandRing1.rotation":{x:.204,y:.086,z:.135},"RightHandRing2.rotation":{x:.579,y:-.02,z:.098},"RightHandRing3.rotation":{x:.272,y:-.021,z:.063},"RightHandPinky1.rotation":{x:.404,y:.182,z:.137},"RightHandPinky2.rotation":{x:.613,y:-.128,z:.144},"RightHandPinky3.rotation":{x:.268,y:-.094,z:.081},"LeftUpLeg.rotation":{x:.096,y:.209,z:2.983},"LeftLeg.rotation":{x:-.053,y:.042,z:-.017},"LeftFoot.rotation":{x:1.091,y:.15,z:.026},"LeftToeBase.rotation":{x:.469,y:-.07,z:-.015},"RightUpLeg.rotation":{x:-.307,y:-.219,z:2.912},"RightLeg.rotation":{x:-.359,y:.164,z:.015},"RightFoot.rotation":{x:1.035,y:.11,z:.005},"RightToeBase.rotation":{x:.467,y:.07,z:.015}}},hip:{standing:!0,props:{"Hips.position":{x:0,y:1,z:0},"Hips.rotation":{x:-.036,y:.09,z:.135},"Spine.rotation":{x:.076,y:-.035,z:.01},"Spine1.rotation":{x:-.096,y:.013,z:-.094},"Spine2.rotation":{x:-.014,y:.002,z:-.097},"Neck.rotation":{x:.034,y:-.051,z:-.075},"Head.rotation":{x:.298,y:-.1,z:.154},"LeftShoulder.rotation":{x:1.694,y:.011,z:-1.68},"LeftArm.rotation":{x:1.343,y:.177,z:-.153},"LeftForeArm.rotation":{x:-.049,y:.134,z:.351},"LeftHand.rotation":{x:.057,y:-.189,z:-.026},"LeftHandThumb1.rotation":{x:.368,y:-.066,z:.438},"LeftHandThumb2.rotation":{x:-.156,y:.029,z:-.369},"LeftHandThumb3.rotation":{x:.034,y:-.009,z:.016},"LeftHandIndex1.rotation":{x:.157,y:-.002,z:-.171},"LeftHandIndex2.rotation":{x:.099,y:0,z:0},"LeftHandIndex3.rotation":{x:.1,y:0,z:0}
1,"LeftHandMiddle1.rotation":{x:.222,y:-.019,z:-.16},"LeftHandMiddle2.rotation":{x:.142,y:0,z:0},"LeftHandMiddle3.rotation":{x:.141,y:0,z:0},"LeftHandRing1.rotation":{x:.333,y:-.039,z:-.174},"LeftHandRing2.rotation":{x:.214,y:0,z:0},"LeftHandRing3.rotation":{x:.213,y:0,z:0},"LeftHandPinky1.rotation":{x:.483,y:-.069,z:-.189},"LeftHandPinky2.rotation":{x:.312,y:0,z:0},"LeftHandPinky3.rotation":{x:.309,y:0,z:0},"RightShoulder.rotation":{x:1.597,y:.012,z:1.816},"RightArm.rotation":{x:.618,y:-1.274,z:-.266},"RightForeArm.rotation":{x:-.395,y:-.097,z:-1.342},"RightHand.rotation":{x:-.816,y:-.057,z:-.976},"RightHandThumb1.rotation":{x:.42,y:.23,z:-1.172},"RightHandThumb2.rotation":{x:-.027,y:.361,z:.122},"RightHandThumb3.rotation":{x:.076,y:.125,z:-.371},"RightHandIndex1.rotation":{x:-.158,y:-.045,z:.033},"RightHandIndex2.rotation":{x:.391,y:.051,z:.025},"RightHandIndex3.rotation":{x:.317,y:.058,z:.07},"RightHandMiddle1.rotation":{x:.486,y:.066,z:.014},"RightHandMiddle2.rotation":{x:.718,y:.055,z:.07},"RightHandMiddle3.rotation":{x:.453,y:.019,z:.013},"RightHandRing1.rotation":{x:.591,y:.241,z:.11},"RightHandRing2.rotation":{x:1.014,y:.023,z:.097},"RightHandRing3.rotation":{x:.708,y:.008,z:.066},"RightHandPinky1.rotation":{x:1.02,y:.305,z:.051},"RightHandPinky2.rotation":{x:1.187,y:-.028,z:.191},"RightHandPinky3.rotation":{x:.872,y:-.031,z:.121},"LeftUpLeg.rotation":{x:-.095,y:-.058,z:-3.338},"LeftLeg.rotation":{x:-.366,y:.287,z:-.021},"LeftFoot.rotation":{x:1.131,y:.21,z:.176},"LeftToeBase.rotation":{x:.739,y:-.068,z:-.001},"RightUpLeg.rotation":{x:-.502,y:.362,z:3.153},"RightLeg.rotation":{x:-1.002,y:.109,z:.008},"RightFoot.rotation":{x:.626,y:-.097,z:-.194},"RightToeBase.rotation":{x:1.33,y:.288,z:-.078}}},turn:{standing:!0,props:{"Hips.position":{x:0,y:1,z:0},"Hips.rotation":{x:-.07,y:-.604,z:-.004},"Spine.rotation":{x:-.007,y:.003,z:.071},"Spine1.rotation":{x:-.053,y:.024,z:-.06},"Spine2.rotation":{x:.074,y:.013,z:-.068},"Neck.rotation":{x:.03,y:.186,z:-.077},"Head.rotation":{x:.045,y:.243,z:-.086},"LeftShoulder.rotation":{x:1.717,y:-.085,z:-1.761},"LeftArm.rotation":{x:1.314,y:.07,z:-.057},"LeftForeArm.rotation":{x:-.151,y:.714,z:.302},"LeftHand.rotation":{x:-.069,y:.003,z:-.118},"LeftHandThumb1.rotation":{x:.23,y:.258,z:.354},"LeftHandThumb2.rotation":{x:-.107,y:-.338,z:-.455},"LeftHandThumb3.rotation":{x:-.015,y:-.142,z:.002},"LeftHandIndex1.rotation":{x:.145,y:.032,z:-.069},"LeftHandIndex2.rotation":{x:.323,y:-.049,z:-.028},"LeftHandIndex3.rotation":{x:.249,y:-.053,z:-.074},"LeftHandMiddle1.rotation":{x:.235,y:-.057,z:-.088},"LeftHandMiddle2.rotation":{x:.468,y:-.036,z:-.081},"LeftHandMiddle3.rotation":{x:.203,y:-.015,z:-.017},"LeftHandRing1.rotation":{x:.185,y:-.118,z:-.157},"LeftHandRing2.rotation":{x:.578,y:.02,z:-.097},"LeftHandRing3.rotation":{x:.27,y:.021,z:-.063},"LeftHandPinky1.rotation":{x:.404,y:-.182,z:-.138},"LeftHandPinky2.rotation":{x:.612,y:.128,z:-.144},"LeftHandPinky3.rotation":{x:.267,y:.094,z:-.081},"RightShoulder.rotation":{x:1.605,y:.17,z:1.625},"RightArm.rotation":{x:1.574,y:-.655,z:.388},"RightForeArm.rotation":{x:-.36,y:-.849,z:-.465},"RightHand.rotation":{x:.114,y:.416,z:-.069},"RightHandThumb1.rotation":{x:.486,y:.009,z:-.492},"RightHandThumb2.rotation":{x:-.073,y:-.01,z:.284},"RightHandThumb3.rotation":{x:-.054,y:-.006,z:.209},"RightHandIndex1.rotation":{x:.245,y:-.014,z:.052},"RightHandIndex2.rotation":{x:.155,y:0,z:0},"RightHandIndex3.rotation":{x:.153,y:0,z:0},"RightHandMiddle1.rotation":{x:.238,y:.004,z:.028},"RightHandMiddle2.rotation":{x:.15,y:0,z:0},"RightHandMiddle3.rotation":{x:.149,y:0,z:0},"RightHandRing1.rotation":{x:.267,y:.012,z:.007},"RightHandRing2.rotation":{x:.169,y:0,z:0},"RightHandRing3.rotation":{x:.167,y:0,z:0},"RightHandPinky1.rotation":{x:.304,y:.018,z:-.021},"RightHandPinky2.rotation":{x:.192,y:0,z:0},"RightHandPinky3.rotation":{x:.19,y:0,z:0},"LeftUpLeg.rotation":{x:-.001,y:-.058,z:-3.238},"LeftLeg.rotation":{x:-.29,y:.058,z:-.021},"LeftFoot.rotation":{x:1.288,y:.168,z:.183},"LeftToeBase.rotation":{x:.363,y:-.09,z:-.01},"RightUpLeg.rotation":{x:-.1,y:.36,z:3.062},"RightLeg.rotation":{x:-.67,y:-.304,z:.043},"RightFoot.rotation":{x:1.195,y:-.159,z:-.294},"RightToeBase.rotation":{x:.737,y:.164,z:-.002}}},bend:{bend:!0,standing:!0,props:{"Hips.position":{x:-.007,y:.943,z:-.001},"Hips.rotation":{x:1.488,y:-.633,z:1.435},"Spine.rotation":{x:-.126,y:.007,z:-.057},"Spine1.rotation":{x:-.134,y:.009,z:.01},"Spine2.rotation":{x:-.019,y:0,z:-.002},"Neck.rotation":{x:-.159,y:.572,z:-.108},"Head.rotation":{x:-.064,y:.716,z:-.257}
1,"RightShoulder.rotation":{x:1.625,y:-.043,z:1.382},"RightArm.rotation":{x:.746,y:-.96,z:-1.009},"RightForeArm.rotation":{x:-.199,y:-.528,z:-.38},"RightHand.rotation":{x:-.261,y:-.043,z:-.027},"RightHandThumb1.rotation":{x:.172,y:-.138,z:-.445},"RightHandThumb2.rotation":{x:-.158,y:.327,z:.545},"RightHandThumb3.rotation":{x:-.062,y:.138,z:.152},"RightHandIndex1.rotation":{x:.328,y:-.005,z:.132},"RightHandIndex2.rotation":{x:.303,y:.049,z:.028},"RightHandIndex3.rotation":{x:.241,y:.046,z:.077},"RightHandMiddle1.rotation":{x:.309,y:.074,z:.089},"RightHandMiddle2.rotation":{x:.392,y:.036,z:.081},"RightHandMiddle3.rotation":{x:.199,y:.014,z:.019},"RightHandRing1.rotation":{x:.239,y:.143,z:.091},"RightHandRing2.rotation":{x:.275,y:-.02,z:.097},"RightHandRing3.rotation":{x:.248,y:-.023,z:.061},"RightHandPinky1.rotation":{x:.211,y:.154,z:.029},"RightHandPinky2.rotation":{x:.348,y:-.128,z:.144},"RightHandPinky3.rotation":{x:.21,y:-.091,z:.065},"LeftShoulder.rotation":{x:1.626,y:-.027,z:-1.367},"LeftArm.rotation":{x:1.048,y:.737,z:.712},"LeftForeArm.rotation":{x:-.508,y:.879,z:.625},"LeftHand.rotation":{x:.06,y:-.243,z:-.079},"LeftHandThumb1.rotation":{x:.187,y:-.072,z:.346},"LeftHandThumb2.rotation":{x:-.066,y:.008,z:-.256},"LeftHandThumb3.rotation":{x:-.085,y:.014,z:-.334},"LeftHandIndex1.rotation":{x:-.1,y:.016,z:-.058},"LeftHandIndex2.rotation":{x:.334,y:0,z:0},"LeftHandIndex3.rotation":{x:.281,y:0,z:0},"LeftHandMiddle1.rotation":{x:-.056,y:0,z:0},"LeftHandMiddle2.rotation":{x:.258,y:0,z:0},"LeftHandMiddle3.rotation":{x:.26,y:0,z:0},"LeftHandRing1.rotation":{x:-.067,y:-.002,z:.008},"LeftHandRing2.rotation":{x:.259,y:0,z:0},"LeftHandRing3.rotation":{x:.276,y:0,z:0},"LeftHandPinky1.rotation":{x:-.128,y:-.007,z:.042},"LeftHandPinky2.rotation":{x:.227,y:0,z:0},"LeftHandPinky3.rotation":{x:.145,y:0,z:0},"RightUpLeg.rotation":{x:-1.507,y:.2,z:-3.043},"RightLeg.rotation":{x:-.689,y:-.124,z:.017},"RightFoot.rotation":{x:.909,y:.008,z:-.093},"RightToeBase.rotation":{x:.842,y:.075,z:-.008},"LeftUpLeg.rotation":{x:-1.449,y:-.2,z:3.018},"LeftLeg.rotation":{x:-.74,y:-.115,z:-.008},"LeftFoot.rotation":{x:1.048,y:-.058,z:.117},"LeftToeBase.rotation":{x:.807,y:-.067,z:.003}}},back:{standing:!0,props:{"Hips.position":{x:0,y:1,z:0},"Hips.rotation":{x:-.732,y:-1.463,z:-.637},"Spine.rotation":{x:-.171,y:.106,z:.157},"Spine1.rotation":{x:-.044,y:.138,z:-.059},"Spine2.rotation":{x:.082,y:.133,z:-.074},"Neck.rotation":{x:.39,y:.591,z:-.248},"Head.rotation":{x:-.001,y:.596,z:-.057},"LeftShoulder.rotation":{x:1.676,y:.007,z:-1.892},"LeftArm.rotation":{x:-5.566,y:1.188,z:-.173},"LeftForeArm.rotation":{x:-.673,y:-.105,z:1.702},"LeftHand.rotation":{x:-.469,y:-.739,z:.003},"LeftHandThumb1.rotation":{x:.876,y:.274,z:.793},"LeftHandThumb2.rotation":{x:.161,y:-.23,z:-.172},"LeftHandThumb3.rotation":{x:.078,y:.027,z:.156},"LeftHandIndex1.rotation":{x:-.085,y:-.002,z:.009},"LeftHandIndex2.rotation":{x:.176,y:0,z:-.002},"LeftHandIndex3.rotation":{x:-.036,y:.001,z:-.035},"LeftHandMiddle1.rotation":{x:.015,y:.144,z:-.076}
1,"LeftHandMiddle2.rotation":{x:.378,y:-.007,z:-.077},"LeftHandMiddle3.rotation":{x:-.141,y:-.001,z:.031},"LeftHandRing1.rotation":{x:.039,y:.02,z:-.2},"LeftHandRing2.rotation":{x:.25,y:-.002,z:-.073},"LeftHandRing3.rotation":{x:.236,y:.006,z:-.075},"LeftHandPinky1.rotation":{x:.172,y:-.033,z:-.275},"LeftHandPinky2.rotation":{x:.216,y:.043,z:-.054},"LeftHandPinky3.rotation":{x:.325,y:.078,z:-.13},"RightShoulder.rotation":{x:2.015,y:-.168,z:1.706},"RightArm.rotation":{x:.203,y:-1.258,z:-.782},"RightForeArm.rotation":{x:-.658,y:-.133,z:-1.401},"RightHand.rotation":{x:-1.504,y:.375,z:-.005},"RightHandThumb1.rotation":{x:.413,y:-.158,z:-1.121},"RightHandThumb2.rotation":{x:-.142,y:-.008,z:.209},"RightHandThumb3.rotation":{x:-.091,y:.021,z:.142},"RightHandIndex1.rotation":{x:-.167,y:.014,z:-.072},"RightHandIndex2.rotation":{x:.474,y:.009,z:.051},"RightHandIndex3.rotation":{x:.115,y:.006,z:.047},"RightHandMiddle1.rotation":{x:.385,y:.019,z:.144},"RightHandMiddle2.rotation":{x:.559,y:.035,z:.101},"RightHandMiddle3.rotation":{x:.229,y:0,z:.027},"RightHandRing1.rotation":{x:.48,y:.026,z:.23},"RightHandRing2.rotation":{x:.772,y:.038,z:.109},"RightHandRing3.rotation":{x:.622,y:.039,z:.106},"RightHandPinky1.rotation":{x:.767,y:.288,z:.353},"RightHandPinky2.rotation":{x:.886,y:.049,z:.122},"RightHandPinky3.rotation":{x:.662,y:.044,z:.113},"LeftUpLeg.rotation":{x:-.206,y:-.268,z:-3.343},"LeftLeg.rotation":{x:-.333,y:.757,z:-.043},"LeftFoot.rotation":{x:1.049,y:.167,z:.287},"LeftToeBase.rotation":{x:.672,y:-.069,z:-.004},"RightUpLeg.rotation":{x:.055,y:-.226,z:3.037},"RightLeg.rotation":{x:-.559,y:.39,z:-.001},"RightFoot.rotation":{x:1.2,y:.133,z:.085},"RightToeBase.rotation":{x:.92,y:.093,z:-.013}}},straight:{standing:!0,props:{"Hips.position":{x:0,y:.989,z:.001},"Hips.rotation":{x:.047,y:.007,z:-.007},"Spine.rotation":{x:-.143,y:-.007,z:.005},"Spine1.rotation":{x:-.043,y:-.014,z:.012},"Spine2.rotation":{x:.072,y:-.013,z:.013},"Neck.rotation":{x:.048,y:-.003,z:.012},"Head.rotation":{x:.05,y:-.02,z:-.017},"LeftShoulder.rotation":{x:1.62,y:-.166,z:-1.605},"LeftArm.rotation":{x:1.275,y:.544,z:-.092},"LeftForeArm.rotation":{x:0,y:0,z:.302},"LeftHand.rotation":{x:-.225,y:-.154,z:.11},"LeftHandThumb1.rotation":{x:.435,y:-.044,z:.457},"LeftHandThumb2.rotation":{x:-.028,y:.002,z:-.246},"LeftHandThumb3.rotation":{x:-.236,y:-.025,z:.113},"LeftHandIndex1.rotation":{x:.218,y:.008,z:-.081},"LeftHandIndex2.rotation":{x:.165,y:-.001,z:-.017},"LeftHandIndex3.rotation":{x:.165,y:-.001,z:-.017},"LeftHandMiddle1.rotation":{x:.235,y:-.011,z:-.065},"LeftHandMiddle2.rotation":{x:.182,y:-.002,z:-.019},"LeftHandMiddle3.rotation":{x:.182,y:-.002,z:-.019},"LeftHandRing1.rotation":{x:.316,y:-.017,z:.008},"LeftHandRing2.rotation":{x:.253,y:-.003,z:-.026},"LeftHandRing3.rotation":{x:.255,y:-.003,z:-.026},"LeftHandPinky1.rotation":{x:.336,y:-.062,z:.088},"LeftHandPinky2.rotation":{x:.276,y:-.004,z:-.028},"LeftHandPinky3.rotation":{x:.276,y:-.004,z:-.028},"RightShoulder.rotation":{x:1.615,y:.064,z:1.53},"RightArm.rotation":{x:1.313,y:-.424,z:.131},"RightForeArm.rotation":{x:0,y:0,z:-.317},"RightHand.rotation":{x:-.158,y:-.639,z:-.196},"RightHandThumb1.rotation":{x:.44,y:.048,z:-.549},"RightHandThumb2.rotation":{x:-.056,y:-.008,z:.274},"RightHandThumb3.rotation":{x:-.258,y:.031,z:-.095},"RightHandIndex1.rotation":{x:.169,y:-.011,z:.105},"RightHandIndex2.rotation":{x:.134,y:.001,z:.011},"RightHandIndex3.rotation":{x:.134,y:.001,z:.011},"RightHandMiddle1.rotation":{x:.288,y:.014,z:.092},"RightHandMiddle2.rotation":{x:.248,y:.003,z:.02},"RightHandMiddle3.rotation":{x:.249,y:.003,z:.02},"RightHandRing1.rotation":{x:.369,y:.019,z:.006},"RightHandRing2.rotation":{x:.321,y:.004,z:.026},"RightHandRing3.rotation":{x:.323,y:.004,z:.026},"RightHandPinky1.rotation":{x:.468,y:.085,z:-.03},"RightHandPinky2.rotation":{x:.427,y:.007,z:.034},"RightHandPinky3.rotation":{x:.142,y:.001,z:.012},"LeftUpLeg.rotation":{x:-.077,y:-.058,z:3.126},"LeftLeg.rotation":{x:-.252,y:.001,z:-.018},"LeftFoot.rotation":{x:1.315,y:-.064,z:.315},"LeftToeBase.rotation":{x:.577,y:-.07,z:-.009},"RightUpLeg.rotation":{x:-.083,y:-.032,z:3.124},"RightLeg.rotation":{x:-.272,y:-.003,z:.021},"RightFoot.rotation":{x:1.342,y:.076,z:-.222},"RightToeBase.rotation":{x:.44,y:.069,z:.016}}},wide:{standing:!0,props:{"Hips.position":{x:0,y:1.017,z:.016},"Hips.rotation":{x:.064,y:-.048,z:.059},"Spine.rotation":{x:-.123,y:0,z:-.018},"Spine1.rotation":{x:.014,y:.003,z:-.006},"Spine2.rotation":{x:.04,y:.003,z:-.007},"Neck.rotation":{x:.101,y:.007,z:-.035},"Head.rotation":{x:-.091,y:-.049,z:.105},"RightShoulder.rotation":{x:1.831,y:.017,z:1.731},"RightArm.rotation":{x:-1.673,y:-1.102,z:-3.132},"RightForeArm.rotation":{x:.265,y:.23,z:-.824},"RightHand.rotation":{x:-.52,y:.345,z:-.061},"RightHandThumb1.rotation":{x:.291,y:.056,z:-.428},"RightHandThumb2.rotation":{x:.025,y:.005,z:.166},"RightHandThumb3.rotation":{x:-.089,y:.009,z:.068},"RightHandIndex1.rotation":{x:.392,y:-.015,z:.11},"RightHandIndex2.rotation":{x:.391,y:.001,z:.004},"RightHandIndex3.rotation":{x:.326,y:0,z:.003},"RightHandMiddle1.rotation":{x:.285,y:.068,z:.081},"RightHandMiddle2.rotation":{x:.519,y:.004,z:.011},"RightHandMiddle3.rotation":{x:.252,y:0,z:.001},"RightHandRing1.rotation":{x:.207,y:.133,z:.146},"RightHandRing2.rotation":{x:.597,y:.004,z:.004},"RightHandRing3.rotation":{x:.292,y:.002,z:.012},"RightHandPinky1.rotation":{x:.338,y:.182,z:.136},"RightHandPinky2.rotation":{x:.533,y:.002,z:.004},"RightHandPinky3.rotation":{x:.194,y:0,z:.002},"LeftShoulder.rotation":{x:1.83,y:-.063,z:-1.808},"LeftArm.rotation":{x:-1.907,y:1.228,z:-2.959},"LeftForeArm.rotation":{x:-.159,y:.268,z:.572},"LeftHand.rotation":{x:.069,y:-.498,z:-.025},"LeftHandThumb1.rotation":{x:.738,y:.123,z:.178},"LeftHandThumb2.rotation":{x:-.26,y:.028,z:-.477}
1,"LeftHandThumb3.rotation":{x:-.448,y:.093,z:-.661},"LeftHandIndex1.rotation":{x:1.064,y:.005,z:-.13},"LeftHandIndex2.rotation":{x:1.55,y:-.143,z:-.136},"LeftHandIndex3.rotation":{x:.722,y:-.076,z:-.127},"LeftHandMiddle1.rotation":{x:1.095,y:-.091,z:.006},"LeftHandMiddle2.rotation":{x:1.493,y:-.174,z:-.151},"LeftHandMiddle3.rotation":{x:.651,y:-.031,z:-.087},"LeftHandRing1.rotation":{x:1.083,y:-.224,z:.072},"LeftHandRing2.rotation":{x:1.145,y:-.107,z:-.195},"LeftHandRing3.rotation":{x:1.208,y:-.134,z:-.158},"LeftHandPinky1.rotation":{x:.964,y:-.383,z:.128},"LeftHandPinky2.rotation":{x:1.457,y:-.146,z:-.159},"LeftHandPinky3.rotation":{x:1.019,y:-.102,z:-.141},"RightUpLeg.rotation":{x:-.221,y:-.233,z:2.87},"RightLeg.rotation":{x:-.339,y:-.043,z:-.041},"RightFoot.rotation":{x:1.081,y:.177,z:.114},"RightToeBase.rotation":{x:.775,y:0,z:0},"LeftUpLeg.rotation":{x:-.185,y:.184,z:3.131},"LeftLeg.rotation":{x:-.408,y:.129,z:.02},"LeftFoot.rotation":{x:1.167,y:-.002,z:-.007},"LeftToeBase.rotation":{x:.723,y:0,z:0}}},oneknee:{kneeling:!0,props:{"Hips.position":{x:-.005,y:.415,z:-.017},"Hips.rotation":{x:-.25,y:.04,z:-.238},"Spine.rotation":{x:.037,y:.043,z:.047},"Spine1.rotation":{x:.317,y:.103,z:.066},"Spine2.rotation":{x:.433,y:.109,z:.054},"Neck.rotation":{x:-.156,y:-.092,z:.059},"Head.rotation":{x:-.398,y:-.032,z:.018},"RightShoulder.rotation":{x:1.546,y:.119,z:1.528},"RightArm.rotation":{x:.896,y:-.247,z:-.512},"RightForeArm.rotation":{x:.007,y:0,z:-1.622},"RightHand.rotation":{x:1.139,y:-.853,z:.874},"RightHandThumb1.rotation":{x:.176,y:.107,z:-.311},"RightHandThumb2.rotation":{x:-.047,y:-.003,z:.12},"RightHandThumb3.rotation":{x:0,y:0,z:0},"RightHandIndex1.rotation":{x:.186,y:.005,z:.125},"RightHandIndex2.rotation":{x:.454,y:.005,z:.015},"RightHandIndex3.rotation":{x:0,y:0,z:0},"RightHandMiddle1.rotation":{x:.444,y:.035,z:.127},"RightHandMiddle2.rotation":{x:.403,y:-.006,z:-.04},"RightHandMiddle3.rotation":{x:0,y:0,z:0},"RightHandRing1.rotation":{x:.543,y:.074,z:.121},"RightHandRing2.rotation":{x:.48,y:-.018,z:-.063},"RightHandRing3.rotation":{x:0,y:0,z:0},"RightHandPinky1.rotation":{x:.464,y:.086,z:.113},"RightHandPinky2.rotation":{x:.667,y:-.06,z:-.128},"RightHandPinky3.rotation":{x:0,y:0,z:0},"LeftShoulder.rotation":{x:1.545,y:-.116,z:-1.529},"LeftArm.rotation":{x:.799,y:.631,z:.556},"LeftForeArm.rotation":{x:-.002,y:.007,z:.926},"LeftHand.rotation":{x:-.508,y:.439,z:.502},"LeftHandThumb1.rotation":{x:.651,y:-.035,z:.308},"LeftHandThumb2.rotation":{x:-.053,y:.008,z:-.11},"LeftHandThumb3.rotation":{x:0,y:0,z:0},"LeftHandIndex1.rotation":{x:.662,y:-.053,z:-.116},"LeftHandIndex2.rotation":{x:.309,y:-.004,z:-.02},"LeftHandIndex3.rotation":{x:0,y:0,z:0},"LeftHandMiddle1.rotation":{x:.501,y:-.062,z:-.12},"LeftHandMiddle2.rotation":{x:.144,y:-.002,z:.016},"LeftHandMiddle3.rotation":{x:0,y:0,z:0},"LeftHandRing1.rotation":{x:.397,y:-.029,z:-.143},"LeftHandRing2.rotation":{x:.328,y:.01,z:.059},"LeftHandRing3.rotation":{x:0,y:0,z:0},"LeftHandPinky1.rotation":{x:.194,y:.008,z:-.164},"LeftHandPinky2.rotation":{x:.38,y:.031,z:.128},"LeftHandPinky3.rotation":{x:0,y:0,z:0},"RightUpLeg.rotation":{x:-1.594,y:-.251,z:2.792},"RightLeg.rotation":{x:-2.301,y:-.073,z:.055},"RightFoot.rotation":{x:1.553,y:-.207,z:-.094},"RightToeBase.rotation":{x:.459,y:.069,z:.016},"LeftUpLeg.rotation":{x:-.788,y:-.236,z:-2.881},"LeftLeg.rotation":{x:-2.703,y:.012,z:-.047},"LeftFoot.rotation":{x:2.191,y:-.102,z:.019},"LeftToeBase.rotation":{x:1.215,y:-.027,z:.01}}},kneel:{kneeling:!0,lying:!0,props:{"Hips.position":{x:0,y:.532,z:-.002}
1,"Hips.rotation":{x:.018,y:-.008,z:-.017},"Spine.rotation":{x:-.139,y:-.01,z:.002},"Spine1.rotation":{x:.002,y:-.002,z:.001},"Spine2.rotation":{x:.028,y:-.002,z:.001},"Neck.rotation":{x:-.007,y:0,z:-.002},"Head.rotation":{x:-.02,y:-.008,z:-.004},"LeftShoulder.rotation":{x:1.77,y:-.428,z:-1.588},"LeftArm.rotation":{x:.911,y:.343,z:.083},"LeftForeArm.rotation":{x:0,y:0,z:.347},"LeftHand.rotation":{x:.033,y:-.052,z:-.105},"LeftHandThumb1.rotation":{x:.508,y:-.22,z:.708},"LeftHandThumb2.rotation":{x:-.323,y:-.139,z:-.56},"LeftHandThumb3.rotation":{x:-.328,y:.16,z:-.301},"LeftHandIndex1.rotation":{x:.178,y:.248,z:.045},"LeftHandIndex2.rotation":{x:.236,y:-.002,z:-.019},"LeftHandIndex3.rotation":{x:-.062,y:0,z:.005},"LeftHandMiddle1.rotation":{x:.123,y:-.005,z:-.019},"LeftHandMiddle2.rotation":{x:.589,y:-.014,z:-.045},"LeftHandMiddle3.rotation":{x:.231,y:-.002,z:-.019},"LeftHandRing1.rotation":{x:.196,y:-.008,z:-.091},"LeftHandRing2.rotation":{x:.483,y:-.009,z:-.038},"LeftHandRing3.rotation":{x:.367,y:-.005,z:-.029},"LeftHandPinky1.rotation":{x:.191,y:-.269,z:-.246},"LeftHandPinky2.rotation":{x:.37,y:-.006,z:-.029},"LeftHandPinky3.rotation":{x:.368,y:-.005,z:-.029},"RightShoulder.rotation":{x:1.73,y:.434,z:1.715},"RightArm.rotation":{x:.841,y:-.508,z:-.155},"RightForeArm.rotation":{x:0,y:0,z:-.355},"RightHand.rotation":{x:.091,y:.137,z:.197},"RightHandThumb1.rotation":{x:.33,y:.051,z:-.753},"RightHandThumb2.rotation":{x:-.113,y:.075,z:.612},"RightHandThumb3.rotation":{x:-.271,y:-.166,z:.164},"RightHandIndex1.rotation":{x:.073,y:.001,z:-.093},"RightHandIndex2.rotation":{x:.338,y:.006,z:.034},"RightHandIndex3.rotation":{x:.131,y:.001,z:.013},"RightHandMiddle1.rotation":{x:.13,y:.005,z:-.017},"RightHandMiddle2.rotation":{x:.602,y:.018,z:.058},"RightHandMiddle3.rotation":{x:-.031,y:0,z:-.003},"RightHandRing1.rotation":{x:.351,y:.019,z:.045},"RightHandRing2.rotation":{x:.19,y:.002,z:.019},"RightHandRing3.rotation":{x:.21,y:.002,z:.021},"RightHandPinky1.rotation":{x:.256,y:.17,z:.118},"RightHandPinky2.rotation":{x:.451,y:.01,z:.045},"RightHandPinky3.rotation":{x:.346,y:.006,z:.035},"LeftUpLeg.rotation":{x:-.06,y:.1,z:-2.918},"LeftLeg.rotation":{x:-1.933,y:-.01,z:.011},"LeftFoot.rotation":{x:.774,y:-.162,z:-.144},"LeftToeBase.rotation":{x:1.188,y:0,z:0},"RightUpLeg.rotation":{x:-.099,y:-.057,z:2.922},"RightLeg.rotation":{x:-1.93,y:.172,z:-.02},"RightFoot.rotation":{x:.644,y:.251,z:.212},"RightToeBase.rotation":{x:.638,y:-.034,z:-.001}}},sitting:{sitting:!0,lying:!0,props:{"Hips.position":{x:0,y:.117,z:.005},"Hips.rotation":{x:-.411,y:-.049,z:.056},"Spine.rotation":{x:.45,y:-.039,z:-.116},"Spine1.rotation":{x:.092,y:-.076,z:.08},"Spine2.rotation":{x:.073,y:.035,z:.066},"Neck.rotation":{x:.051,y:.053,z:-.079},"Head.rotation":{x:-.169,y:.009,z:.034},"LeftShoulder.rotation":{x:1.756,y:-.037,z:-1.301},"LeftArm.rotation":{x:-.098,y:.016,z:1.006},"LeftForeArm.rotation":{x:-.089,y:.08,z:.837},"LeftHand.rotation":{x:.262,y:-.399,z:.3},"LeftHandThumb1.rotation":{x:.149,y:-.043,z:.452},"LeftHandThumb2.rotation":{x:.032,y:.006,z:-.162},"LeftHandThumb3.rotation":{x:-.086,y:-.005,z:-.069},"LeftHandIndex1.rotation":{x:.145,y:.032,z:-.069},"LeftHandIndex2.rotation":{x:.325,y:-.001,z:-.004},"LeftHandIndex3.rotation":{x:.253,y:0,z:-.003},"LeftHandMiddle1.rotation":{x:.186,y:-.051,z:-.091},"LeftHandMiddle2.rotation":{x:.42,y:-.003,z:-.011},"LeftHandMiddle3.rotation":{x:.153,y:.001,z:-.001},"LeftHandRing1.rotation":{x:.087,y:-.19,z:-.078},"LeftHandRing2.rotation":{x:.488,y:-.004,z:-.005},"LeftHandRing3.rotation":{x:.183,y:-.001,z:-.012},"LeftHandPinky1.rotation":{x:.205,y:-.262,z:.051},"LeftHandPinky2.rotation":{x:.407,y:-.002,z:-.004},"LeftHandPinky3.rotation":{x:.068,y:0,z:-.002},"RightShoulder.rotation":{x:1.619,y:-.139,z:1.179},"RightArm.rotation":{x:.17,y:-.037,z:-1.07},"RightForeArm.rotation":{x:-.044,y:-.056,z:-.665},"RightHand.rotation":{x:.278,y:.454,z:-.253},"RightHandThumb1.rotation":{x:.173,y:.089,z:-.584},"RightHandThumb2.rotation":{x:-.003,y:-.004,z:.299},"RightHandThumb3.rotation":{x:-.133,y:-.002,z:.235},"RightHandIndex1.rotation":{x:.393,y:-.023,z:.108},"RightHandIndex2.rotation":{x:.391,y:.001,z:.004},"RightHandIndex3.rotation":{x:.326,y:0,z:.003},"RightHandMiddle1.rotation":{x:.285,y:.062,z:.086},"RightHandMiddle2.rotation":{x:.519,y:.003,z:.011},"RightHandMiddle3.rotation":{x:.252,y:-.001,z:.001},"RightHandRing1.rotation":{x:.207,y:.122,z:.155},"RightHandRing2.rotation":{x:.597,y:.004,z:.005},"RightHandRing3.rotation":{x:.292,y:.001,z:.012},"RightHandPinky1.rotation":{x:.338,y:.171,z:.149},"RightHandPinky2.rotation":{x:.533,y:.002,z:.004},"RightHandPinky3.rotation":{x:.194,y:0,z:.002},"LeftUpLeg.rotation":{x:-1.957,y:.083,z:-2.886},"LeftLeg.rotation":{x:-1.46,y:.123,z:.005},"LeftFoot.rotation":{x:-.013,y:.016,z:.09},"LeftToeBase.rotation":{x:.744,y:0,z:0},"RightUpLeg.rotation":{x:-1.994,y:.125,z:2.905},"RightLeg.rotation":{x:-1.5,y:-.202,z:-.006},"RightFoot.rotation":{x:-.012,y:-.065,z:.081},"RightToeBase.rotation":{x:.758,y:0,z:0}}}},this.gestureTemplates={handup:{"LeftShoulder.rotation":{x:[1.5,2,1,2],y:[.2,.4,1,2],z:[-1.5,-1.3,1,2]}
1,"LeftArm.rotation":{x:[1.5,1.7,1,2],y:[-.6,-.4,1,2],z:[1,1.2,1,2]},"LeftForeArm.rotation":{x:-.815,y:[-.4,0,1,2],z:1.575},"LeftHand.rotation":{x:-.529,y:-.2,z:.022},"LeftHandThumb1.rotation":{x:.745,y:-.526,z:.604},"LeftHandThumb2.rotation":{x:-.107,y:-.01,z:-.142},"LeftHandThumb3.rotation":{x:0,y:.001,z:0},"LeftHandIndex1.rotation":{x:-.126,y:-.035,z:-.087},"LeftHandIndex2.rotation":{x:.255,y:.007,z:-.085},"LeftHandIndex3.rotation":{x:0,y:0,z:0},"LeftHandMiddle1.rotation":{x:-.019,y:-.128,z:-.082},"LeftHandMiddle2.rotation":{x:.233,y:.019,z:-.074},"LeftHandMiddle3.rotation":{x:0,y:0,z:0},"LeftHandRing1.rotation":{x:.005,y:-.241,z:-.122},"LeftHandRing2.rotation":{x:.261,y:.021,z:-.076},"LeftHandRing3.rotation":{x:0,y:0,z:0},"LeftHandPinky1.rotation":{x:.059,y:-.336,z:-.2},"LeftHandPinky2.rotation":{x:.153,y:.019,z:.001},"LeftHandPinky3.rotation":{x:0,y:0,z:0}},index:{"LeftShoulder.rotation":{x:[1.5,2,1,2],y:[.2,.4,1,2],z:[-1.5,-1.3,1,2]},"LeftArm.rotation":{x:[1.5,1.7,1,2],y:[-.6,-.4,1,2],z:[1,1.2,1,2]},"LeftForeArm.rotation":{x:-.815,y:[-.4,0,1,2],z:1.575},"LeftHand.rotation":{x:-.276,y:-.506,z:-.208},"LeftHandThumb1.rotation":{x:.579,y:.228,z:.363},"LeftHandThumb2.rotation":{x:-.027,y:-.04,z:-.662},"LeftHandThumb3.rotation":{x:0,y:.001,z:0},"LeftHandIndex1.rotation":{x:0,y:-.105,z:.225},"LeftHandIndex2.rotation":{x:.256,y:-.103,z:-.213},"LeftHandIndex3.rotation":{x:0,y:0,z:0},"LeftHandMiddle1.rotation":{x:1.453,y:.07,z:.021},"LeftHandMiddle2.rotation":{x:1.599,y:.062,z:.07},"LeftHandMiddle3.rotation":{x:0,y:0,z:0},"LeftHandRing1.rotation":{x:1.528,y:-.073,z:.052},"LeftHandRing2.rotation":{x:1.386,y:.044,z:.053},"LeftHandRing3.rotation":{x:0,y:0,z:0},"LeftHandPinky1.rotation":{x:1.65,y:-.204,z:.031},"LeftHandPinky2.rotation":{x:1.302,y:.071,z:.085},"LeftHandPinky3.rotation":{x:0,y:0,z:0}},ok:{"LeftShoulder.rotation":{x:[1.5,2,1,2],y:[.2,.4,1,2],z:[-1.5,-1.3,1,2]},"LeftArm.rotation":{x:[1.5,1.7,1,1],y:[-.6,-.4,1,2],z:[1,1.2,1,2]},"LeftForeArm.rotation":{x:-.415,y:[-.4,0,1,2],z:1.575},"LeftHand.rotation":{x:-.476,y:-.506,z:-.208},"LeftHandThumb1.rotation":{x:.703,y:.445,z:.899},"LeftHandThumb2.rotation":{x:-.312,y:-.04,z:-.938},"LeftHandThumb3.rotation":{x:-.37,y:.024,z:-.393},"LeftHandIndex1.rotation":{x:.8,y:-.086,z:-.091},"LeftHandIndex2.rotation":{x:1.123,y:-.046,z:-.074},"LeftHandIndex3.rotation":{x:.562,y:-.013,z:-.043},"LeftHandMiddle1.rotation":{x:-.019,y:-.128,z:-.082},"LeftHandMiddle2.rotation":{x:.233,y:.019,z:-.074},"LeftHandMiddle3.rotation":{x:0,y:0,z:0},"LeftHandRing1.rotation":{x:.005,y:-.241,z:-.122},"LeftHandRing2.rotation":{x:.261,y:.021,z:-.076},"LeftHandRing3.rotation":{x:0,y:0,z:0},"LeftHandPinky1.rotation":{x:.059,y:-.336,z:-.2},"LeftHandPinky2.rotation":{x:.153,y:.019,z:.001},"LeftHandPinky3.rotation":{x:0,y:0,z:0}},thumbup:{"LeftShoulder.rotation":{x:[1.5,2,1,2],y:[.2,.4,1,2],z:[-1.5,-1.3,1,2]},"LeftArm.rotation":{x:[1.5,1.7,1,2],y:[-.6,-.4,1,2],z:[1,1.2,1,2]},"LeftForeArm.rotation":{x:-.415,y:.206,z:1.575},"LeftHand.rotation":{x:-.276,y:-.506,z:-.208},"LeftHandThumb1.rotation":{x:.208,y:-.189,z:.685},"LeftHandThumb2.rotation":{x:.129,y:-.285,z:-.163},"LeftHandThumb3.rotation":{x:-.047,y:.068,z:.401},"LeftHandIndex1.rotation":{x:1.412,y:-.102,z:-.152},"LeftHandIndex2.rotation":{x:1.903,y:-.16,z:-.114},"LeftHandIndex3.rotation":{x:.535,y:-.017,z:-.062},"LeftHandMiddle1.rotation":{x:1.424,y:-.103,z:-.12},"LeftHandMiddle2.rotation":{x:1.919,y:-.162,z:-.114},"LeftHandMiddle3.rotation":{x:.44,y:-.012,z:-.051},"LeftHandRing1.rotation":{x:1.619,y:-.127,z:-.053},"LeftHandRing2.rotation":{x:1.898,y:-.16,z:-.115},"LeftHandRing3.rotation":{x:.262,y:-.004,z:-.031},"LeftHandPinky1.rotation":{x:1.661,y:-.131,z:-.016},"LeftHandPinky2.rotation":{x:1.715,y:-.067,z:-.13},"LeftHandPinky3.rotation":{x:.627,y:-.023,z:-.071}},thumbdown:{"LeftShoulder.rotation":{x:[1.5,2,1,2],y:[.2,.4,1,2],z:[-1.5,-1.3,1,2]},"LeftArm.rotation":{x:[1.5,1.7,1,2],y:[-.6,-.4,1,2],z:[1,1.2,1,2]},"LeftForeArm.rotation":{x:-2.015,y:.406,z:1.575},"LeftHand.rotation":{x:-.176,y:-.206,z:-.208},"LeftHandThumb1.rotation":{x:.208,y:-.189,z:.685},"LeftHandThumb2.rotation":{x:.129,y:-.285,z:-.163},"LeftHandThumb3.rotation":{x:-.047,y:.068,z:.401},"LeftHandIndex1.rotation":{x:1.412,y:-.102,z:-.152},"LeftHandIndex2.rotation":{x:1.903,y:-.16,z:-.114},"LeftHandIndex3.rotation":{x:.535,y:-.017,z:-.062},"LeftHandMiddle1.rotation":{x:1.424,y:-.103,z:-.12},"LeftHandMiddle2.rotation":{x:1.919,y:-.162,z:-.114},"LeftHandMiddle3.rotation":{x:.44,y:-.012,z:-.051},"LeftHandRing1.rotation":{x:1.619,y:-.127,z:-.053},"LeftHandRing2.rotation":{x:1.898,y:-.16,z:-.115},"LeftHandRing3.rotation":{x:.262,y:-.004,z:-.031},"LeftHandPinky1.rotation":{x:1.661,y:-.131,z:-.016},"LeftHandPinky2.rotation":{x:1.715,y:-.067,z:-.13},"LeftHandPinky3.rotation":{x:.627,y:-.023,z:-.071}},side:{"LeftShoulder.rotation":{x:1.755,y:-.035,z:-1.63},"LeftArm.rotation":{x:1.263,y:-.955,z:1.024},"LeftForeArm.rotation":{x:0,y:0,z:.8},"LeftHand.rotation":{x:-.36,y:-1.353,z:-.184},"LeftHandThumb1.rotation":{x:.137,y:-.049,z:.863},"LeftHandThumb2.rotation":{x:-.293,y:.153,z:-.193},"LeftHandThumb3.rotation":{x:-.271,y:-.17,z:.18},"LeftHandIndex1.rotation":{x:-.018,y:.007,z:.28},"LeftHandIndex2.rotation":{x:.247,y:-.003,z:-.025},"LeftHandIndex3.rotation":{x:.13,y:-.001,z:-.013},"LeftHandMiddle1.rotation":{x:.333,y:-.015,z:.182},"LeftHandMiddle2.rotation":{x:.313,y:-.005,z:-.032}
1,"LeftHandMiddle3.rotation":{x:.294,y:-.004,z:-.03},"LeftHandRing1.rotation":{x:.456,y:-.028,z:-.092},"LeftHandRing2.rotation":{x:.53,y:-.014,z:-.052},"LeftHandRing3.rotation":{x:.478,y:-.012,z:-.047},"LeftHandPinky1.rotation":{x:.647,y:-.049,z:-.184},"LeftHandPinky2.rotation":{x:.29,y:-.004,z:-.029},"LeftHandPinky3.rotation":{x:.501,y:-.013,z:-.049}},shrug:{"Neck.rotation":{x:[-.3,.3,1,2],y:[-.3,.3,1,2],z:[-.1,.1]},"Head.rotation":{x:[-.3,.3],y:[-.3,.3],z:[-.1,.1]},"RightShoulder.rotation":{x:1.732,y:-.058,z:1.407},"RightArm.rotation":{x:1.305,y:.46,z:.118},"RightForeArm.rotation":{x:[0,2],y:[-1,.2],z:-1.637},"RightHand.rotation":{x:-.048,y:.165,z:-.39},"RightHandThumb1.rotation":{x:1.467,y:.599,z:-1.315},"RightHandThumb2.rotation":{x:-.255,y:-.123,z:.119},"RightHandThumb3.rotation":{x:0,y:-.002,z:0},"RightHandIndex1.rotation":{x:-.293,y:-.066,z:-.112},"RightHandIndex2.rotation":{x:.181,y:.007,z:.069},"RightHandIndex3.rotation":{x:0,y:0,z:0},"RightHandMiddle1.rotation":{x:-.063,y:-.041,z:.032},"RightHandMiddle2.rotation":{x:.149,y:.005,z:.05},"RightHandMiddle3.rotation":{x:0,y:0,z:0},"RightHandRing1.rotation":{x:.152,y:-.03,z:.132},"RightHandRing2.rotation":{x:.194,y:.007,z:.058},"RightHandRing3.rotation":{x:0,y:0,z:0},"RightHandPinky1.rotation":{x:.306,y:-.015,z:.257},"RightHandPinky2.rotation":{x:.15,y:-.003,z:-.003},"RightHandPinky3.rotation":{x:0,y:0,z:0},"LeftShoulder.rotation":{x:1.713,y:.141,z:-1.433},"LeftArm.rotation":{x:1.136,y:-.422,z:-.416},"LeftForeArm.rotation":{x:1.42,y:.123,z:1.506},"LeftHand.rotation":{x:.073,y:-.138,z:.064},"LeftHandThumb1.rotation":{x:1.467,y:-.599,z:1.314},"LeftHandThumb2.rotation":{x:-.255,y:.123,z:-.119},"LeftHandThumb3.rotation":{x:0,y:.001,z:0},"LeftHandIndex1.rotation":{x:-.293,y:.066,z:.112},"LeftHandIndex2.rotation":{x:.181,y:-.007,z:-.069},"LeftHandIndex3.rotation":{x:0,y:0,z:0},"LeftHandMiddle1.rotation":{x:-.062,y:.041,z:-.032},"LeftHandMiddle2.rotation":{x:.149,y:-.005,z:-.05},"LeftHandMiddle3.rotation":{x:0,y:0,z:0},"LeftHandRing1.rotation":{x:.152,y:.03,z:-.132},"LeftHandRing2.rotation":{x:.194,y:-.007,z:-.058},"LeftHandRing3.rotation":{x:0,y:0,z:0},"LeftHandPinky1.rotation":{x:.306,y:.015,z:-.257},"LeftHandPinky2.rotation":{x:.15,y:.003,z:.003},"LeftHandPinky3.rotation":{x:0,y:0,z:0}},namaste:{"RightShoulder.rotation":{x:1.758,y:.099,z:1.604},"RightArm.rotation":{x:.862,y:-.292,z:-.932},"RightForeArm.rotation":{x:.083,y:.066,z:-1.791},"RightHand.rotation":{x:-.52,y:-.001,z:-.176},"RightHandThumb1.rotation":{x:.227,y:.418,z:-.776},"RightHandThumb2.rotation":{x:-.011,y:-.003,z:.171},"RightHandThumb3.rotation":{x:-.041,y:-.001,z:-.013},"RightHandIndex1.rotation":{x:-.236,y:.003,z:-.028},"RightHandIndex2.rotation":{x:.004,y:0,z:.001},"RightHandIndex3.rotation":{x:.002,y:0,z:0},"RightHandMiddle1.rotation":{x:-.236,y:.003,z:-.028},"RightHandMiddle2.rotation":{x:.004,y:0,z:.001},"RightHandMiddle3.rotation":{x:.002,y:0,z:0},"RightHandRing1.rotation":{x:-.236,y:.003,z:-.028},"RightHandRing2.rotation":{x:.004,y:0,z:.001},"RightHandRing3.rotation":{x:.002,y:0,z:0},"RightHandPinky1.rotation":{x:-.236,y:.003,z:-.028},"RightHandPinky2.rotation":{x:.004,y:0,z:.001},"RightHandPinky3.rotation":{x:.002,y:0,z:0},"LeftShoulder.rotation":{x:1.711,y:-.002,z:-1.625},"LeftArm.rotation":{x:.683,y:.334,z:.977},"LeftForeArm.rotation":{x:.086,y:-.066,z:1.843},"LeftHand.rotation":{x:-.595,y:-.229,z:.096},"LeftHandThumb1.rotation":{x:.404,y:-.05,z:.537},"LeftHandThumb2.rotation":{x:-.02,y:.004,z:-.154},"LeftHandThumb3.rotation":{x:-.049,y:.002,z:-.019},"LeftHandIndex1.rotation":{x:-.113,y:-.001,z:.014},"LeftHandIndex2.rotation":{x:.003,y:0,z:0},"LeftHandIndex3.rotation":{x:.002,y:0,z:0},"LeftHandMiddle1.rotation":{x:-.113,y:-.001,z:.014},"LeftHandMiddle2.rotation":{x:.004,y:0,z:0},"LeftHandMiddle3.rotation":{x:.002,y:0,z:0},"LeftHandRing1.rotation":{x:-.113,y:-.001,z:.014},"LeftHandRing2.rotation":{x:.003,y:0,z:0},"LeftHandRing3.rotation":{x:.002,y:0,z:0},"LeftHandPinky1.rotation":{x:-.122,y:-.001,z:-.057},"LeftHandPinky2.rotation":{x:.012,y:.001,z:.07},"LeftHandPinky3.rotation":{x:.002,y:0,z:0}}},this.poseDelta={props:{"Hips.quaternion":{x:0,y:0,z:0},"Spine.quaternion":{x:0,y:0,z:0},"Spine1.quaternion":{x:0,y:0,z:0},"Neck.quaternion":{x:0,y:0,z:0},"Head.quaternion":{x:0,y:0,z:0},"Spine1.scale":{x:0,y:0,z:0},"Neck.scale":{x:0,y:0,z:0},"LeftArm.scale":{x:0,y:0,z:0},"RightArm.scale":{x:0,y:0,z:0}}},["Left","Right"].forEach(t=>
1{["Leg","UpLeg","Arm","ForeArm","Hand"].forEach(e=>{this.poseDelta.props[t+e+".quaternion"]={x:0,y:0,z:0}}),["HandThumb","HandIndex","HandMiddle","HandRing","HandPinky"].forEach(e=>{this.poseDelta.props[t+e+"1.quaternion"]={x:0,y:0,z:0},this.poseDelta.props[t+e+"2.quaternion"]={x:0,y:0,z:0},this.poseDelta.props[t+e+"3.quaternion"]={x:0,y:0,z:0}})});const i=new Set;Object.values(this.poseTemplates).forEach(t=>{Object.keys(this.propsToThreeObjects(t.props)).forEach(t=>i.add(t))}),Object.keys(this.poseDelta.props).forEach(t=>{i.add(t)}),this.posePropNames=[...i],this.poseName="side",this.poseWeightOnLeft=!0,this.gesture=null,this.poseCurrentTemplate=this.poseTemplates[this.poseName],this.poseStraight=this.propsToThreeObjects(this.poseTemplates.straight.props),this.poseBase=this.poseFactory(this.poseCurrentTemplate),this.poseTarget=this.poseFactory(this.poseCurrentTemplate),this.poseAvatar=null,this.avatarHeight=1.7,this.animTemplateEyes={name:"eyes",idle:{alt:[{p:()=>this.avatar?.hasOwnProperty("avatarIdleEyeContact")?this.avatar.avatarIdleEyeContact:this.opt.avatarIdleEyeContact,delay:[200,5e3],dt:[200,[2e3,5e3],[3e3,1e4,1,2]],vs:{headMove:[this.avatar?.hasOwnProperty("avatarIdleHeadMove")?this.avatar.avatarIdleHeadMove:this.opt.avatarIdleHeadMove],eyesRotateY:[[-.6,.6]],eyesRotateX:[[-.2,.6]],eyeContact:[null,1]}},{delay:[200,5e3],dt:[200,[2e3,5e3,1,2]],vs:{headMove:[this.avatar?.hasOwnProperty("avatarIdleHeadMove")?this.avatar.avatarIdleHeadMove:this.opt.avatarIdleHeadMove],eyesRotateY:[[-.6,.6]],eyesRotateX:[[-.2,.6]]}}]},speaking:{alt:[{p:()=>this.avatar?.hasOwnProperty("avatarSpeakingEyeContact")?this.avatar.avatarSpeakingEyeContact:this.opt.avatarSpeakingEyeContact,delay:[200,5e3],dt:[0,[3e3,1e4,1,2],[2e3,5e3]],vs:{eyeContact:[1,null],headMove:[null,this.avatar?.hasOwnProperty("avatarSpeakingHeadMove")?this.avatar.avatarSpeakingHeadMove:this.opt.avatarSpeakingHeadMove,null],eyesRotateY:[null,[-.6,.6]],eyesRotateX:[null,[-.2,.6]]}},{delay:[200,5e3],dt:[200,[2e3,5e3,1,2]],vs:{headMove:[this.avatar?.hasOwnProperty("avatarSpeakingHeadMove")?this.avatar.avatarSpeakingHeadMove:this.opt.avatarSpeakingHeadMove,null],eyesRotateY:[[-.6,.6]],eyesRotateX:[[-.2,.6]]}}]}},this.animTemplateBlink={name:"blink",alt:[{p:.85,delay:[1e3,8e3,1,2],dt:[50,[100,300],100],vs:{eyeBlinkLeft:[1,1,0],eyeBlinkRight:[1,1,0]}},{delay:[1e3,4e3,1,2],dt:[50,[100,200],100,[10,400,0],50,[100,200],100],vs:{eyeBlinkLeft:[1,1,0,0,1,1,0],eyeBlinkRight:[1,1,0,0,1,1,0]}}]},this.animMoods={neutral:{baseline:{eyesLookDown:.1},speech:{deltaRate:0,deltaPitch:0,deltaVolume:0},anims:[{name:"breathing",delay:1500,dt:[1200,500,1e3],vs:{chestInhale:[.5,.5,0]}},{name:"pose",alt:[{p:.5,delay:[5e3,3e4],vs:{pose:["side"]}},{p:.3,delay:[5e3,3e4],vs:{pose:["hip"]},M:{delay:[5e3,3e4],vs:{pose:["wide"]}}},{delay:[5e3,3e4],vs:{pose:["straight"]}}]},{name:"head",idle:{delay:[0,1e3],dt:[[200,5e3]],vs:{bodyRotateX:[[-.04,.1]],bodyRotateY:[[-.3,.3]],bodyRotateZ:[[-.08,.08]]}},speaking:{dt:[[0,1e3,0]],vs:{bodyRotateX:[[-.05,.15,1,2]],bodyRotateY:[[-.1,.1]],bodyRotateZ:[[-.1,.1]]}}},this.animTemplateEyes,this.animTemplateBlink,{name:"mouth",delay:[1e3,5e3],dt:[[100,500],[100,5e3,2]],vs:{mouthRollLower:[[0,.3,2]],mouthRollUpper:[[0,.3,2]],mouthStretchLeft:[[0,.3]],mouthStretchRight:[[0,.3]],mouthPucker:[[0,.3]]}},{name:"misc",delay:[100,5e3],dt:[[100,500],[1e3,5e3,2]],vs:{eyeSquintLeft:[[0,.3,2]],eyeSquintRight:[[0,.3,2]],browInnerUp:[[0,.3,2]],browOuterUpLeft:[[0,.3,2]],browOuterUpRight:[[0,.3,2]]}}]},happy:{baseline:{mouthSmile:.2,eyesLookDown:.1},speech:{deltaRate:0,deltaPitch:.1,deltaVolume:0},anims:[{name:"breathing",delay:1500,dt:[1200,500,1e3],vs:{chestInhale:[.5,.5,0]}},{name:"pose",idle:{alt:[{p:.6,delay:[5e3,3e4],vs:{pose:["side"]}},{p:.2,delay:[5e3,3e4],vs:{pose:["hip"]},M:{delay:[5e3,3e4],vs:{pose:["side"]}}},{p:.1,delay:[5e3,3e4],vs:{pose:["straight"]}},{delay:[5e3,1e4],vs:{pose:["wide"]}},{delay:[1e3,3e3],vs:{pose:["turn"]}}]},speaking:{alt:[{p:.4,delay:[5e3,3e4],vs:{pose:["side"]}},{p:.4,delay:[5e3,3e4],vs:{pose:["straight"]}},{delay:[5e3,2e4],vs:{pose:["hip"]},M:{delay:[5e3,3e4],vs:{pose:["wide"]}}}]}},{name:"head",idle:{dt:[[1e3,5e3]],vs:{bodyRotateX:[[-.04,.1]],bodyRotateY:[[-.3,.3]],bodyRotateZ:[[-.08,.08]]}},speaking:{dt:[[0,1e3,0]],vs:{bodyRotateX:[[-.05,.15,1,2]],bodyRotateY:[[-.1,.1]],bodyRotateZ:[[-.1,.1]]}}},this.animTemplateEyes,this.animTemplateBlink,{name:"mouth",delay:[1e3,5e3],dt:[[100,500],[100,5e3,2]],vs:{mouthLeft:[[0,.3,2]],mouthSmile:[[0,.2,3]],mouthRollLower:[[0,.3,2]],mouthRollUpper:[[0,.3,2]],mouthStretchLeft:[[0,.3]],mouthStretchRight:[[0,.3]],mouthPucker:[[0,.3]]}},{name:"misc",delay:[100,5e3],dt:[[100,500],[1e3,5e3,2]],vs:{eyeSquintLeft:[[0,.3,2]],eyeSquintRight:[[0,.3,2]],browInnerUp:[[0,.3,2]],browOuterUpLeft:[[0,.3,2]],browOuterUpRight:[[0,.3,2]]}}]},angry:{baseline:{eyesLookDown:.1,browDownLeft:.6,browDownRight:.6,jawForward:.3,mouthFrownLeft:.7,mouthFrownRight:.7,mouthRollLower:.2,mouthShrugLower:.3,handFistLeft:1,handFistRight:1},speech:{deltaRate:-.2,deltaPitch:.2,deltaVolume:0},anims:[{name:"breathing",delay:500,dt:[1e3,500,1e3],vs:{chestInhale:[.7,.7,0]}},{name:"pose",alt:[{p:.4,delay:[5e3,3e4],vs:{pose:["side"]}},{p:.4,delay:[5e3,3e4],vs:{pose:["straight"]}},{p:.2,delay:[5e3,3e4],vs:{pose:["hip"]},M:{delay:[5e3,3e4],vs:{pose:["wide"]}}}]},{name:"head",idle:{delay:[100,500],dt:[[200,5e3]],vs:{bodyRotateX:[[-.04,.1]],bodyRotateY:[[-.2,.2]],bodyRotateZ:[[-.08,.08]]}},speaking:{dt:[[0,1e3,0]],vs:{bodyRotateX:[[-.05,.15,1,2]],bodyRotateY:[[-.1,.1]],bodyRotateZ:[[-.1,.1]]}}},this.animTemplateEyes,this.animTemplateBlink,{name:"mouth",delay:[1e3,5e3],dt:[[100,500],[100,5e3,2]],vs:{mouthRollLower:[[0,.3,2]],mouthRollUpper:[[0,.3,2]],mouthStretchLeft:[[0,.3]],mouthStretchRight:[[0,.3]],mouthPucker:[[0,.3]]}},{name:"misc",delay:[100,5e3],dt:[[100,500],[1e3,5e3,2]],vs:{eyeSquintLeft:[[0,.3,2]],eyeSquintRight:[[0,.3,2]],browInnerUp:[[0,.3,2]],browOuterUpLeft:[[0,.3,2]],browOuterUpRight:[[0,.3,2]]}}]},sad:{baseline:{eyesLookDown:.2,browDownRight:.1,browInnerUp:.6,browOuterUpRight:.2,eyeSquintLeft:.7,eyeSquintRight:.7,mouthFrownLeft:.8,mouthFrownRight:.8,mouthLeft:.2,mouthPucker:.5,mouthRollLower:.2,mouthRollUpper:.2,mouthShrugLower:.2,mouthShrugUpper:.2,mouthStretchLeft:.4},speech:{deltaRate:-.2,deltaPitch:-.2,deltaVolume:0},anims:[{name:"breathing",delay:1500,dt:[1e3,500,1e3],vs:{chestInhale:[.3,.3,0]}},{name:"pose",alt:[{p:.4,delay:[5e3,3e4],vs:{pose:["side"]}},{p:.4,delay:[5e3,3e4],vs:{pose:["straight"]}},{delay:[5e3,2e4],vs:{pose:["side"]},full:{delay:[5e3,2e4],vs:{pose:["oneknee"]}}}]},{name:"head",idle:{delay:[100,500],dt:[[200,5e3]],vs:{bodyRotateX:[[-.04,.1]],bodyRotateY:[[-.2,.2]],bodyRotateZ:[[-.08,.08]]}},speaking:{dt:[[0,1e3,0]],vs:{bodyRotateX:[[-.05,.15,1,2]],bodyRotateY:[[-.1,.1]],bodyRotateZ:[[-.1,.1]]}}},this.animTemplateEyes,this.animTemplateBlink,{name:"mouth",delay:[1e3,5e3],dt:[[100,500],[100,5e3,2]],vs:{mouthRollLower:[[0,.3,2]],mouthRollUpper:[[0,.3,2]],mouthStretchLeft:[[0,.3]],mouthStretchRight:[[0,.3]],mouthPucker:[[0,.3]]}},{name:"misc",delay:[100,5e3],dt:[[100,500],[1e3,5e3,2]],vs:{eyeSquintLeft:[[0,.3,2]],eyeSquintRight:[[0,.3,2]],browInnerUp:[[0,.3,2]],browOuterUpLeft:[[0,.3,2]],browOuterUpRight:[[0,.3,2]]}}]},fear:{baseline:{browInnerUp:.7,eyeSquintLeft:.5,eyeSquintRight:.5,eyeWideLeft:.6,eyeWideRight:.6,mouthClose:.1,mouthFunnel:.3,mouthShrugLower:.5,mouthShrugUpper:.5},speech:{deltaRate:-.2,deltaPitch:0,deltaVolume:0},anims:[{name:"breathing",delay:500,dt:[1e3,500,1e3],vs:{chestInhale:[.7,.7,0]}},{name:"pose",alt:[{p:.8,delay:[5e3,3e4],vs:{pose:["side"]}},{delay:[5e3,3e4],vs:{pose:["straight"]}},{delay:[5e3,2e4],vs:{pose:["wide"]}},{delay:[5e3,2e4],vs:{pose:["side"]},full:{delay:[5e3,2e4],vs:{pose:["oneknee"]}}}]},{name:"head",idle:{delay:[100,500],dt:[[200,3e3]],vs:{bodyRotateX:[[-.06,.12]],bodyRotateY:[[-.7,.7]],bodyRotateZ:[[-.1,.1]]}},speaking:{dt:[[0,1e3,0]],vs:{bodyRotateX:[[-.05,.15,1,2]],bodyRotateY:[[-.1,.1]],bodyRotateZ:[[-.1,.1]]}}},this.animTemplateEyes,this.animTemplateBlink,{name:"mouth",delay:[1e3,5e3],dt:[[100,500],[100,5e3,2]],vs:{mouthRollLower:[[0,.3,2]],mouthRollUpper:[[0,.3,2]],mouthStretchLeft:[[0,.3]],mouthStretchRight:[[0,.3]],mouthPucker:[[0,.3]]}},{name:"misc",delay:[100,5e3],dt:[[100,500],[1e3,5e3,2]],vs:{eyeSquintLeft:[[0,.3,2]],eyeSquintRight:[[0,.3,2]],browInnerUp:[[0,.3,2]],browOuterUpLeft:[[0,.3,2]],browOuterUpRight:[[0,.3,2]]}}]},disgust:{baseline:{browDownLeft:.7,browDownRight:.1,browInnerUp:.3,eyeSquintLeft:1,eyeSquintRight:1,eyeWideLeft:.5,eyeWideRight:.5,eyesRotateX:.05,mouthLeft:.4,mouthPressLeft:.3,mouthRollLower:.3,mouthShrugLower:.3,mouthShrugUpper:.8,mouthUpperUpLeft:.3,noseSneerLeft:1,noseSneerRight:.7},speech:{deltaRate:-.2,deltaPitch:0,deltaVolume:0},anims:[{name:"breathing",delay:1500,dt:[1e3,500,1e3],vs:{chestInhale:[.5,.5,0]}},{name:"pose",alt:[{delay:[5e3,2e4],vs:{pose:["side"]}}]},{name:"head",idle:{delay:[100,500],dt:[[200,5e3]],vs:{bodyRotateX:[[-.04,.1]],bodyRotateY:[[-.2,.2]],bodyRotateZ:[[-.08,.08]]}},speaking:{dt:[[0,1e3,0]],vs:{bodyRotateX:[[-.05,.15,1,2]],bodyRotateY:[[-.1,.1]],bodyRotateZ:[[-.1,.1]]}}},this.animTemplateEyes,this.animTemplateBlink,{name:"mouth",delay:[1e3,5e3],dt:[[100,500],[100,5e3,2]],vs:{mouthRollLower:[[0,.3,2]],mouthRollUpper:[[0,.3,2]],mouthStretchLeft:[[0,.3]],mouthStretchRight:[[0,.3]],mouthPucker:[[0,.3]]}},{name:"misc",delay:[100,5e3],dt:[[100,500],[1e3,5e3,2]],vs:{eyeSquintLeft:[[0,.3,2]],eyeSquintRight:[[0,.3,2]],browInnerUp:[[0,.3,2]],browOuterUpLeft:[[0,.3,2]],browOuterUpRight:[[0,.3,2]]}}]},love:{baseline:{browInnerUp:.4,browOuterUpLeft:.2,browOuterUpRight:.2,mouthSmile:.2,eyeBlinkLeft:.6,eyeBlinkRight:.6,eyeWideLeft:.7,eyeWideRight:.7,bodyRotateX:.1,mouthDimpleLeft:.1,mouthDimpleRight:.1,mouthPressLeft:.2,mouthShrugUpper:.2,mouthUpperUpLeft:.1,mouthUpperUpRight:.1},speech:{deltaRate:-.1,deltaPitch:-.7,deltaVolume:0},anims:[{name:"breathing",delay:1500,dt:[1500,500,1500],vs:{chestInhale:[.8,.8,0]}},{name:"pose",alt:[{p:.4,delay:[5e3,3e4],vs:{pose:["side"]}},{p:.2,delay:[5e3,3e4],vs:{pose:["straight"]}},{p:.2,delay:[5e3,3e4],vs:{pose:["hip"]},M:{delay:[5e3,3e4],vs:{pose:["side"]}}},{delay:[5e3,1e4],vs:{pose:["side"]},full:{delay:[5e3,1e4],vs:{pose:["kneel"]}}},{delay:[1e3,3e3],vs:{pose:["turn"]},M:{delay:[1e3,3e3],vs:{pose:["wide"]}}},{delay:[1e3,3e3],vs:{pose:["back"]},M:{delay:[1e3,3e3],vs:{pose:["wide"]}}},{delay:[5e3,2e4],vs:{pose:["side"]},M:{delay:[5e3,2e4],vs:{pose:["side"]}},full:{delay:[5e3,2e4],vs:{pose:["bend"]}}},{delay:[1e3,3e3],vs:{pose:["side"]},full:{delay:[5e3,1e4],vs:{pose:["oneknee"]}}}]},{name:"head",idle:{dt:[[1e3,5e3]],vs:{bodyRotateX:[[-.04,.1]],bodyRotateY:[[-.3,.3]],bodyRotateZ:[[-.08,.08]]}},speaking:{dt:[[0,1e3,0]],vs:{bodyRotateX:[[-.05,.15,1,2]],bodyRotateY:[[-.1,.1]],bodyRotateZ:[[-.1,.1]]}}},this.animTemplateEyes,this.deepCopy(this.animTemplateBlink,t=>{t.alt[0].delay[0]=t.alt[1].delay[0]=2e3}),{name:"mouth",delay:[1e3,5e3],dt:[[100,500],[100,5e3,2]],vs:{mouthLeft:[[0,.3,2]],mouthRollLower:[[0,.3,2]],mouthRollUpper:[[0,.3,2]],mouthStretchLeft:[[0,.3]],mouthStretchRight:[[0,.3]],mouthPucker:[[0,.3]]}},{name:"misc",delay:[100,5e3],dt:[[500,1e3],[1e3,5e3,2]],vs:{eyeSquintLeft:[[0,.3,2]],eyeSquintRight:[[0,.3,2]],browInnerUp:[[.3,.6,2]],browOuterUpLeft:[[.1,.3,2]],browOuterUpRight:[[.1,.3,2]]}}]},sleep:{baseline:{eyeBlinkLeft:1,eyeBlinkRight:1,eyesClosed:.6},speech:{deltaRate:0,deltaPitch:-.2,deltaVolume:0},anims:[{name:"breathing",delay:1500,dt:[1e3,500,1e3],vs:{chestInhale:[.6,.6,0]}},{name:"pose",alt:[{delay:[5e3,2e4],vs:{pose:["side"]}}]},{name:"head",delay:[1e3,5e3],dt:[[2e3,1e4]],vs:{bodyRotateX:[[0,.4]],bodyRotateY:[[-.1,.1]],bodyRotateZ:[[-.04,.04]]}},{name:"eyes",delay:10010,dt:[],vs:{}},{name:"blink",delay:10020,dt:[],vs:{}},{name:"mouth",delay:10030,dt:[],vs:{}},{name:"misc",delay:10040,dt:[],vs:{}}]}},this.moodName=this.opt.avatarMood||"neutral",this.mood=this.animMoods[this.moodName],this.mood||(this.moodName="neutral",this.mood=this.animMoods.neutral),this.animEmojis={"\uD83D\uDE10":{dt:[300,2e3],rescale:[0,1],vs:{pose:["straight"],browInnerUp:[.4],eyeWideLeft:[.7],eyeWideRight:[.7],mouthPressLeft:[.6],mouthPressRight:[.6],mouthRollLower:[.3],mouthStretchLeft:[1],mouthStretchRight:[1]}},"\uD83D\uDE36":{link:"\uD83D\uDE10"},"\uD83D\uDE0F":{dt:[300,2e3],rescale:[0,1],vs:{eyeContact:[0],browDownRight:[.1],browInnerUp:[.7],browOuterUpRight:[.2],eyeLookInRight:[.7],eyeLookOutLeft:[.7],eyeSquintLeft:[1],eyeSquintRight:[.8],eyesRotateY:[.7],mouthLeft:[.4],mouthPucker:[.4],mouthShrugLower:[.3],mouthShrugUpper:[.2],mouthSmile:[.2],mouthSmileLeft:[.4],mouthSmileRight:[.2],mouthStretchLeft:[.5],mouthUpperUpLeft:[.6],noseSneerLeft:[.7]}},"\uD83D\uDE42":{dt:[300,2e3],rescale:[0,1],vs:{mouthSmile:[.5]}},"\uD83D\uDE43":{link:"\uD83D\uDE42"},"\uD83D\uDE0A":{dt:[300,2e3],rescale:[0,1],vs:{browInnerUp:[.6],eyeSquintLeft:[1],eyeSquintRight:[1],mouthSmile:[.7],noseSneerLeft:[.7],noseSneerRight:[.7]}},"\uD83D\uDE07":{link:"\uD83D\uDE0A"},"\uD83D\uDE00":{dt:[300,2e3],rescale:[0,1],vs:{browInnerUp:[.6],jawOpen:[.1],mouthDimpleLeft:[.2],mouthDimpleRight:[.2],mouthOpen:[.3],mouthPressLeft:[.3],mouthPressRight:[.3],mouthRollLower:[.4],mouthShrugUpper:[.4],mouthSmile:[.7],mouthUpperUpLeft:[.3],mouthUpperUpRight:[.3],noseSneerLeft:[.4],noseSneerRight:[.4]}},"\uD83D\uDE03":{dt:[300,2e3],rescale:[0,1],vs:{browInnerUp:[.6],eyeW
1ideLeft:[.7],eyeWideRight:[.7],jawOpen:[.1],mouthDimpleLeft:[.2],mouthDimpleRight:[.2],mouthOpen:[.3],mouthPressLeft:[.3],mouthPressRight:[.3],mouthRollLower:[.4],mouthShrugUpper:[.4],mouthSmile:[.7],mouthUpperUpLeft:[.3],mouthUpperUpRight:[.3],noseSneerLeft:[.4],noseSneerRight:[.4]}},"\uD83D\uDE04":{dt:[300,2e3],rescale:[0,1],vs:{browInnerUp:[.3],eyeSquintLeft:[1],eyeSquintRight:[1],jawOpen:[.2],mouthDimpleLeft:[.2],mouthDimpleRight:[.2],mouthOpen:[.3],mouthPressLeft:[.3],mouthPressRight:[.3],mouthRollLower:[.4],mouthShrugUpper:[.4],mouthSmile:[.7],mouthUpperUpLeft:[.3],mouthUpperUpRight:[.3],noseSneerLeft:[.4],noseSneerRight:[.4]}},"\uD83D\uDE01":{dt:[300,2e3],rescale:[0,1],vs:{browInnerUp:[.3],eyeSquintLeft:[1],eyeSquintRight:[1],jawOpen:[.3],mouthDimpleLeft:[.2],mouthDimpleRight:[.2],mouthPressLeft:[.5],mouthPressRight:[.5],mouthShrugUpper:[.4],mouthSmile:[.7],mouthUpperUpLeft:[.3],mouthUpperUpRight:[.3],noseSneerLeft:[.4],noseSneerRight:[.4]}},"\uD83D\uDE06":{dt:[300,2e3],rescale:[0,1],vs:{browInnerUp:[.3],eyeSquintLeft:[1],eyeSquintRight:[1],eyesClosed:[.6],jawOpen:[.3],mouthDimpleLeft:[.2],mouthDimpleRight:[.2],mouthPressLeft:[.5],mouthPressRight:[.5],mouthShrugUpper:[.4],mouthSmile:[.7],mouthUpperUpLeft:[.3],mouthUpperUpRight:[.3],noseSneerLeft:[.4],noseSneerRight:[.4]}},"\uD83D\uDE1D":{dt:[300,100,1500,500,500],rescale:[0,0,1,0,0],vs:{browInnerUp:[.8],eyesClosed:[1],jawOpen:[.7],mouthFunnel:[.5],mouthSmile:[1],tongueOut:[0,1,1,0]}},"\uD83D\uDE0B":{link:"\uD83D\uDE1D"},"\uD83D\uDE1B":{link:"\uD83D\uDE1D"},"\uD83D\uDE1B":{link:"\uD83D\uDE1D"},"\uD83D\uDE1C":{link:"\uD83D\uDE1D"},"\uD83E\uDD2A":{link:"\uD83D\uDE1D"},"\uD83D\uDE02":{dt:[300,2e3],rescale:[0,1],vs:{browInnerUp:[.3],eyeSquintLeft:[1],eyeSquintRight:[1],eyesClosed:[.6],jawOpen:[.3],mouthDimpleLeft:[.2],mouthDimpleRight:[.2],mouthPressLeft:[.5],mouthPressRight:[.5],mouthShrugUpper:[.4],mouthSmile:[.7],mouthUpperUpLeft:[.3],mouthUpperUpRight:[.3],noseSneerLeft:[.4],noseSneerRight:[.4]}},"\uD83E\uDD23":{link:"\uD83D\uDE02"},"\uD83D\uDE05":{link:"\uD83D\uDE02"},"\uD83D\uDE09":{dt:[500,200,500,500],rescale:[0,0,0,1],vs:{mouthSmile:[.5],mouthOpen:[.2],mouthSmileLeft:[0,.5,0],eyeBlinkLeft:[0,.7,0],eyeBlinkRight:[0,0,0],bodyRotateX:[.05,.05,.05,0],bodyRotateZ:[-.05,-.05,-.05,0],browDownLeft:[0,.7,0],cheekSquintLeft:[0,.7,0],eyeSquintLeft:[0,1,0],eyesClosed:[0]}},"\uD83D\uDE2D":{dt:[1e3,1e3],rescale:[0,1],vs:{browInnerUp:[1],eyeSquintLeft:[1],eyeSquintRight:[1],eyesClosed:[.1],jawOpen:[0],mouthFrownLeft:[1],mouthFrownRight:[1],mouthOpen:[.5],mouthPucker:[.5],mouthUpperUpLeft:[.6],mouthUpperUpRight:[.6]}},"\uD83E\uDD7A":{dt:[1e3,1e3],rescale:[0,1],vs:{browDownLeft:[.2],browDownRight:[.2],browInnerUp:[1],eyeWideLeft:[.9],eyeWideRight:[.9],eyesClosed:[.1],mouthClose:[.2],mouthFrownLeft:[1],mouthFrownRight:[1],mouthPressLeft:[.4],mouthPressRight:[.4],mouthPucker:[1],mouthRollLower:[.6],mouthRollUpper:[.2],mouthUpperUpLeft:[.8],mouthUpperUpRight:[.8]}},"\uD83D\uDE1E":{dt:[1e3,1e3],rescale:[0,1],vs:{browInnerUp:[.7],eyeSquintLeft:[1],eyeSquintRight:[1],eyesClosed:[.5],bodyRotateX:[.3],mouthClose:[.2],mouthFrownLeft:[1],mouthFrownRight:[1],mouthPucker:[1],mouthRollLower:[1],mouthShrugLower:[.2],mouthUpperUpLeft:[.8],mouthUpperUpRight:[.8]}},"\uD83D\uDE14":{dt:[1e3,1e3],rescale:[0,1],vs:{browInnerUp:[1],eyeSquintLeft:[1],eyeSquintRight:[1],eyesClosed:[.5],bodyRotateX:[.3],mouthClose:[.2],mouthFrownLeft:[1],mouthFrownRight:[1],mouthPressLeft:[.4],mouthPressRight:[.4],mouthPucker:[1],mouthRollLower:[.6],mouthRollUpper:[.2],mouthUpperUpLeft:[.8],mouthUpperUpRight:[.8]}},"\uD83D\uDE33":{dt:[1e3,1e3],rescale:[0,1],vs:{browInnerUp:[1],eyeWideLeft:[.5],eyeWideRight:[.5],eyesRotateY:[.05],eyesRotateX:[.05],mouthClose:[.2],mouthFunnel:[.5],mouthPucker:[.4],mouthRollLower:[.4],mouthRollUpper:[.4]}},"☹️":{dt:[500,1500],rescale:[0,1],vs:{mouthFrownLeft:[1],mouthFrownRight:[1],mouthPucker:[.1],mouthRollLower:[.8]}},"\uD83D\uDE1A":{dt:[500,1e3,1e3],rescale:[0,1,0],vs:{browInnerUp:[.6],eyeBlinkLeft:[1],eyeBlinkRight:[1],eyeSquintLeft:[1],eyeSquintRight:[1],mouthPucker:[0,.5],noseSneerLeft:[0,.7],noseSneerRight:[0,.7],viseme_U:[0,1]}},"\uD83D\uDE18":{dt:[500,500,200,500],rescale:[0,0,0,1],vs:{browInnerUp:[.6],eyeBlinkLeft:[
10,0,1,0],eyeBlinkRight:[0],eyesRotateY:[0],bodyRotateY:[0],bodyRotateX:[0,.05,.05,0],bodyRotateZ:[0,-.05,-.05,0],eyeSquintLeft:[1],eyeSquintRight:[1],mouthPucker:[0,.5,0],noseSneerLeft:[0,.7],noseSneerRight:[.7],viseme_U:[0,1]}},"\uD83E\uDD70":{dt:[1e3,1e3],rescale:[0,1],vs:{browInnerUp:[.6],eyeSquintLeft:[1],eyeSquintRight:[1],mouthSmile:[.7],noseSneerLeft:[.7],noseSneerRight:[.7]}},"\uD83D\uDE0D":{dt:[1e3,1e3],rescale:[0,1],vs:{browInnerUp:[.6],jawOpen:[.1],mouthDimpleLeft:[.2],mouthDimpleRight:[.2],mouthOpen:[.3],mouthPressLeft:[.3],mouthPressRight:[.3],mouthRollLower:[.4],mouthShrugUpper:[.4],mouthSmile:[.7],mouthUpperUpLeft:[.3],mouthUpperUpRight:[.3],noseSneerLeft:[.4],noseSneerRight:[.4]}},"\uD83E\uDD29":{link:"\uD83D\uDE0D"},"\uD83D\uDE21":{dt:[1e3,1500],rescale:[0,1],vs:{browDownLeft:[1],browDownRight:[1],eyesLookUp:[.2],jawForward:[.3],mouthFrownLeft:[1],mouthFrownRight:[1],bodyRotateX:[.15]}},"\uD83D\uDE20":{dt:[1e3,1500],rescale:[0,1],vs:{browDownLeft:[1],browDownRight:[1],eyesLookUp:[.2],jawForward:[.3],mouthFrownLeft:[1],mouthFrownRight:[1],bodyRotateX:[.15]}},"\uD83E\uDD2C":{link:"\uD83D\uDE20"},"\uD83D\uDE12":{dt:[1e3,1e3],rescale:[0,1],vs:{eyeContact:[0],browDownRight:[.1],browInnerUp:[.7],browOuterUpRight:[.2],eyeLookInRight:[.7],eyeLookOutLeft:[.7],eyeSquintLeft:[1],eyeSquintRight:[.8],eyesRotateY:[.7],mouthFrownLeft:[1],mouthFrownRight:[1],mouthLeft:[.2],mouthPucker:[.5],mouthRollLower:[.2],mouthRollUpper:[.2],mouthShrugLower:[.2],mouthShrugUpper:[.2],mouthStretchLeft:[.5]}},"\uD83D\uDE31":{dt:[500,1500],rescale:[0,1],vs:{browInnerUp:[.8],eyeWideLeft:[.5],eyeWideRight:[.5],jawOpen:[.7],mouthFunnel:[.5]}},"\uD83D\uDE2C":{dt:[500,1500],rescale:[0,1],vs:{browDownLeft:[1],browDownRight:[1],browInnerUp:[1],mouthDimpleLeft:[.5],mouthDimpleRight:[.5],mouthLowerDownLeft:[1],mouthLowerDownRight:[1],mouthPressLeft:[.4],mouthPressRight:[.4],mouthPucker:[.5],mouthSmile:[.1],mouthSmileLeft:[.2],mouthSmileRight:[.2],mouthStretchLeft:[1],mouthStretchRight:[1],mouthUpperUpLeft:[1],mouthUpperUpRight:[1]}},"\uD83D\uDE44":{dt:[500,1500],rescale:[0,1],vs:{browInnerUp:[.8],eyeWideLeft:[1],eyeWideRight:[1],eyesRotateX:[-.8],bodyRotateX:[.15],mouthPucker:[.5],mouthRollLower:[.6],mouthRollUpper:[.5],mouthShrugLower:[0],mouthSmile:[0]}},"\uD83E\uDD14":{dt:[500,1500],rescale:[0,1],vs:{browDownLeft:[1],browOuterUpRight:[1],eyeSquintLeft:[.6],mouthFrownLeft:[.7],mouthFrownRight:[.7],mouthLowerDownLeft:[.3],mouthPressRight:[.4],mouthPucker:[.1],mouthRight:[.5],mouthRollLower:[.5],mouthRollUpper:[.2],handRight:[{x:.1,y:.1,z:.1,d:1e3},{d:1e3}],handFistRight:[.1]}},"\uD83D\uDC40":{dt:[500,1500],rescale:[0,1],vs:{eyesRotateY:[-.8]}},"\uD83D\uDE34":{dt:[5e3,5e3],rescale:[0,1],vs:{eyeBlinkLeft:[1],eyeBlinkRight:[1],bodyRotateX:[.2],bodyRotateZ:[.1]}},"✋":{dt:[300,2e3],rescale:[0,1],vs:{mouthSmile:[.5],gesture:[["handup",2,!0],null]}},"\uD83E\uDD1A":{dt:[300,2e3],rescale:[0,1],vs:{mouthSmile:[.5],gesture:[["handup",2],null]}},"\uD83D\uDC4B":{link:"✋"},"\uD83D\uDC4D":{dt:[300,2e3],rescale:[0,1],vs:{mouthSmile:[.5],gesture:[["thumbup",2],null]}},"\uD83D\uDC4E":{dt:[300,2e3],rescale:[0,1],vs:{browDownLeft:[1],browDownRight:[1],eyesLookUp:[.2],jawForward:[.3],mouthFrownLeft:[1],mouthFrownRight:[1],bodyRotateX:[.15],gesture:[["thumbdown",2],null]}},"\uD83D\uDC4C":{dt:[300,2e3],rescale:[0,1],vs:{mouthSmile:[.5],gesture:[["ok",2],null]}},"\uD83E\uDD37‍♂️":{dt:[1e3,1500],rescale:[0,1],vs:{gesture:[["shrug",2],null]}},"\uD83E\uDD37‍♀️":{link:"\uD83E\uDD37‍♂️"},"\uD83E\uDD37":{link:"\uD83E\uDD37‍♂️"},"\uD83D\uDE4F":{dt:[1500,300,1e3],rescale:[0,1,0],vs:{eyeBlinkLeft:[0,1],eyeBlinkRight:[0,1],bodyRotateX:[0],bodyRotateZ:[.1],gesture:[["namaste",2],null]}},yes:{dt:[[200,500],[200,500],[200,500],[200,500]],vs:{headMove:[0],headRotateX:[[.1,.2],.1,[.1,.2],0],headRotateZ:[[-.2,.2]]}},no:{dt:[[200,500],[200,500],[200,500],[200,500],[200,500]],vs:{headMove:[0],headRotateY:[[-.1,-.05],[.05,.1],[-.1,-.05],[.05,.1],0],headRotateZ:[[-.2,.2]]}}},this.mtAvatar={},this.mtCustoms=["handFistLeft","handFistRight","bodyRotateX","bodyRotateY","bodyRotateZ","headRotateX","headRotateY","headRotateZ","chestInhale"],this.mtEasingDefault=this.sigmoidFactory(5),this.mtAccDefault=.01,this.mtAccExceptions={eyeBlinkLeft:.1,eyeBlinkRight:.1,eyeLookOutLeft:.1,eyeLookInLeft:.1,eyeLookOutRight:.1,eyeLookInRight:.1},this.mtMaxVDefault=5,this.mtMaxVExceptions={bodyRotateX:1,bodyRotateY:1,bodyRotateZ:1},this.mtBaselineDefault=0,this.mtBaselineExceptions={bodyRotateX:null,bodyRotateY:null,bodyRotateZ:null,eyeL
1ookOutLeft:null,eyeLookInLeft:null,eyeLookOutRight:null,eyeLookInRight:null,eyesLookDown:null,eyesLookUp:null},this.mtMinDefault=0,this.mtMinExceptions={bodyRotateX:-1,bodyRotateY:-1,bodyRotateZ:-1,headRotateX:-1,headRotateY:-1,headRotateZ:-1},this.mtMaxDefault=1,this.mtMaxExceptions={},this.mtLimits={eyeBlinkLeft:t=>Math.max(t,(this.mtAvatar.eyesLookDown.value+this.mtAvatar.browDownLeft.value)/2),eyeBlinkRight:t=>Math.max(t,(this.mtAvatar.eyesLookDown.value+this.mtAvatar.browDownRight.value)/2)},this.mtOnchange={eyesLookDown:()=>{this.mtAvatar.eyeBlinkLeft.needsUpdate=!0,this.mtAvatar.eyeBlinkRight.needsUpdate=!0},browDownLeft:()=>{this.mtAvatar.eyeBlinkLeft.needsUpdate=!0},browDownRight:()=>{this.mtAvatar.eyeBlinkRight.needsUpdate=!0}},this.mtRandomized=["mouthDimpleLeft","mouthDimpleRight","mouthLeft","mouthPressLeft","mouthPressRight","mouthStretchLeft","mouthStretchRight","mouthShrugLower","mouthShrugUpper","noseSneerLeft","noseSneerRight","mouthRollLower","mouthRollUpper","browDownLeft","browDownRight","browOuterUpLeft","browOuterUpRight","cheekPuff","cheekSquintLeft","cheekSquintRight"],this.mtExtras=[{key:"mouthOpen",mix:{jawOpen:.5}},{key:"mouthSmile",mix:{mouthSmileLeft:.8,mouthSmileRight:.8}},{key:"eyesClosed",mix:{eyeBlinkLeft:1,eyeBlinkRight:1}},{key:"eyesLookUp",mix:{eyeLookUpLeft:1,eyeLookUpRight:1}},{key:"eyesLookDown",mix:{eyeLookDownLeft:1,eyeLookDownRight:1}}],this.animQueue=[],this.animClips=[],this.animPoses=[],this.animate=this.animate.bind(this),this._raf=null,this.animFrameDur=1e3/this.opt.modelFPS,this.animClock=0,this.animSlowdownRate=1,this.animTimeLast=0,this.easing=this.sigmoidFactory(5),this.lipsync={},this.opt.lipsyncModules.forEach(t=>this.lipsyncGetProcessor(t)),this.visemeNames=["aa","E","I","O","U","PP","SS","TH","DD","FF","kk","nn","RR","CH","sil"],this.segmenter=new Intl.Segmenter("en",{granularity:"grapheme"}),this.initAudioGraph(),this.audioPlaylist=[],this.volumeFrequencyData=new Uint8Array(16),this.volumeMax=0,this.volumeHeadBase=0,this.volumeHeadTarget=0,this.volumeHeadCurrent=0,this.volumeHeadVelocity=.15,this.volumeHeadEasing=this.sigmoidFactory(3),this.isListening=!1,this.listeningAnalyzer=null,this.listeningActive=!1,this.listeningVolume=0,this.listeningSilenceThresholdLevel=this.opt.listeningSilenceThresholdLevel,this.listeningSilenceThresholdMs=this.opt.listeningSilenceThresholdMs,this.listeningSilenceDurationMax=this.opt.listeningSilenceDurationMax,this.listeningActiveThresholdLevel=this.opt.listeningActiveThresholdLevel,this.listeningActiveThresholdMs=this.opt.listeningActiveThresholdMs,this.listeningActiveDurationMax=this.opt.listeningActiveDurationMax,this.listeningTimer=0,this.listeningTimerTotal=0,this.dracoEnabled=this.opt.dracoEnabled,this.dracoDecoderPath=this.opt.dracoDecoderPath;const s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";this.b64Lookup="undefined"==typeof Uint8Array?[]:new Uint8Array(256);for(let t=0;t<s.length;t++)this.b64Lookup[s.charCodeAt(t)]=t;if(this.stateName="idle",this.speechQueue=[],this.isSpeaking=!1,this.isListening=!1,this.opt.ttsEndpoint){let t=new Audio;if(t.canPlayType("audio/ogg"))this.ttsAudioEncoding="OGG-OPUS";else if(t.canPlayType("audio/mp3"))this.ttsAudioEncoding="MP3";else throw Error("There was no support for either OGG or MP3 audio.")}if(this.isAvatarOnly=this.opt.avatarOnly,this.isAvatarOnly)this.scene=this.opt.avatarOnlyScene,this.camera=this.opt.avatarOnlyCamera;else{this.renderer=new a.JeP({antialias:!0,alpha:!0}),this.renderer.setPixelRatio(this.opt.modelPixelRatio*window.devicePixelRatio),this.renderer.setSize(this.nodeAvatar.clientWidth,this.nodeAvatar.clientHeight),this.renderer.outputColorSpace=o.er$,this.renderer.toneMapping=o.FV,this.renderer.shadowMap.enabled=!1,this.nodeAvatar.appendChild(this.renderer.domElement),this.camera=new o.ubm(10,this.nodeAvatar.clientWidth/this.nodeAvatar.clientHeight,.1,2e3),this.scene=new o.Z58,this.lightAmbient=new o.$p8(new o.Q1f(this.opt.lightAmbientColor),this.opt.lightAmbientIntensity),this.lightDirect=new o.ZyN(new o.Q1f(this.opt.lightDirectColor),this.opt.lightDirectIntensity),this.lightSpot=new o.nCl(new o.Q1f(this.opt.lightSpotColor),this.opt.lightSpotIntensity,0,this.opt.lightSpotDispersion),this.setLighting(this.opt);const t=new a.BdL(this.renderer);t.compileEquirectangularShader(),this.scene.environment=t.fromScene(new l.l).texture,this.resizeobserver=new ResizeObserver(this.onResize.bind(this)),this.resizeobserver.observe(this.nodeAvatar),this.controls=new n.N(this.camera,this.renderer.domElement),this.controls.enableZoom=this.opt.cameraZoomEnable,this.controls.enableRotate=this.opt.cameraRotateEnable,this.controls.enablePan=this.opt.cameraPanEnable,this.controls.minDistance=2,this.controls.maxDistance=2e3,this.controls.autoRotateSpeed=0,this.controls.autoRotate=!1,this.controls.update(),this.cameraClock=null}this.ikMesh=new o.I46;const r=[];Object.entries({LeftShoulder:null,LeftArm:"LeftShoulder",LeftForeArm:"LeftArm",LeftHand:"LeftForeArm",LeftHandMiddle1:"LeftHand",RightShoulder:null,RightArm:"RightShoulder",RightForeArm:"RightArm",RightHand:"RightForeArm",RightHandMiddle1:"RightHand"}
1).forEach((t,e)=>{let i=new o.$Kf;i.name=t[0],t[1]?this.ikMesh.getObjectByName(t[1]).add(i):this.ikMesh.add(i),r.push(i)}),this.ikMesh.bind(new o.EAD(r)),this.dynamicbones=new m.j,this.isStreaming=!1,this.streamWorkletNode=null,this.streamAudioStartTime=null,this.streamWaitForAudioChunks=!0,this.streamLipsyncLang=null,this.streamLipsyncType="visemes",this.streamLipsyncQueue=[]}initAudioGraph(t=null){if(this.audioCtx&&"closed"!==this.audioCtx.state&&this.audioCtx.close(),t?this.audioCtx=new AudioContext({sampleRate:t}):this.audioCtx=new AudioContext,this.audioSpeechSource=this.audioCtx.createBufferSource(),this.audioBackgroundSource=this.audioCtx.createBufferSource(),this.audioBackgroundGainNode=this.audioCtx.createGain(),this.audioSpeechGainNode=this.audioCtx.createGain(),this.audioStreamGainNode=this.audioCtx.createGain(),this.audioAnalyzerNode=this.audioCtx.createAnalyser(),this.audioAnalyzerNode.fftSize=256,this.audioAnalyzerNode.smoothingTimeConstant=.1,this.audioAnalyzerNode.minDecibels=-70,this.audioAnalyzerNode.maxDecibels=-10,this.audioReverbNode=this.audioCtx.createConvolver(),this.audioBackgroundGainNode.connect(this.audioReverbNode),this.audioAnalyzerNode.connect(this.audioSpeechGainNode),this.audioSpeechGainNode.connect(this.audioReverbNode),this.audioStreamGainNode.connect(this.audioReverbNode),this.audioReverbNode.connect(this.audioCtx.destination),this.setReverb(this.currentReverb||null),this.setMixerGain(this.opt.mixerGainSpeech,this.opt.mixerGainBackground),this.workletLoaded=!1,this.streamWorkletNode){try{this.streamWorkletNode.port.postMessage({type:"stop"}),this.streamWorkletNode.disconnect(),this.isStreaming=!1}catch(t){console.error("Error disconnecting streamWorkletNode:",t)}this.streamWorkletNode=null}}valueFn(t){return"function"==typeof t?t():t}deepCopy(t,e=null){let i=JSON.parse(JSON.stringify(t));return e&&"function"==typeof e&&e(i),i}b64ToArrayBuffer(t){let e=3*t.length/4;"="===t[t.length-1]&&(e--,"="===t[t.length-2]&&e--);let i=new ArrayBuffer(e),o=new Uint8Array(i),a,n=0,s,r,h,l;for(a=0;a<t.length;a+=4)s=this.b64Lookup[t.charCodeAt(a)],r=this.b64Lookup[t.charCodeAt(a+1)],h=this.b64Lookup[t.charCodeAt(a+2)],l=this.b64Lookup[t.charCodeAt(a+3)],o[n++]=s<<2|r>>4,o[n++]=(15&r)<<4|h>>2,o[n++]=(3&h)<<6|63&l;return i}concatArrayBuffers(t){if(1===t.length)return t[0];let e=0;for(let i=0;i<t.length;i++)e+=t[i].byteLength;let i=new ArrayBuffer(e),o=new Uint8Array(i),a=0;for(let e=0;e<t.length;e++)o.set(new Uint8Array(t[e]),a),a+=t[e].byteLength;return i}pcmToAudioBuffer(t){let e=new Int16Array(t),i=new Float32Array(e.length);for(let t=0;t<e.length;t++)i[t]=e[t]>=32768?-(65536-e[t])/32768:e[t]/32767;let o=this.audioCtx.createBuffer(1,i.length,this.opt.pcmSampleRate);return o.copyToChannel(i,0,0),o}propsToThreeObjects(t){let e={};for(let[i,a]of Object.entries(t)){let t=i.split("."),n=Array.isArray(a.x)?this.gaussianRandom(...a.x):a.x,s=Array.isArray(a.y)?this.gaussianRandom(...a.y):a.y,r=Array.isArray(a.z)?this.gaussianRandom(...a.z):a.z;"position"===t[1]||"scale"===t[1]?e[i]=new o.Pq0(n,s,r):"rotation"===t[1]?e[i=t[0]+".quaternion"]=new o.PTz().setFromEuler(new o.O9p(n,s,r,"XYZ")).normalize():"quaternion"===t[1]&&(e[i]=new o.PTz(n,s,r,a.w).normalize())}return e}clearThree(t){for(;t.children.length;)this.clearThree(t.children[0]),t.remove(t.children[0]);t.geometry&&t.geometry.dispose(),t.material&&(Array.isArray(t.material)?t.material.forEach(t=>{t.map&&t.map.dispose(),t.dispose()}):(t.material.map&&t.material.map.dispose(),t.material.dispose()))}addMixedMorphTarget(t,e,i,a=!1){t.forEach(t=>{if(!a&&t.morphTargetDictionary.hasOwnProperty(e))return;let n=t.geometry,s=null,r=null;for(let[e,a]of Object.entries(i))if(t.morphTargetDictionary.hasOwnProperty(e)){let i=t.morphTargetDictionary[e],h=n.morphAttributes.position[i],l=n.morphAttributes.normal?.[i];!s&&(s=new o.qtW(3*h.count,3),l&&(r=new o.qtW(3*h.count,3)));for(let t=0;t<h.count;t++){let e=s.getX(t)+h.getX(t)*a,i=s.getY(t)+h.getY(t)*a,o=s.getZ(t)+h.getZ(t)*a;s.setXYZ(t,e,i,o)}if(l)for(let t=0;t<h.count;t++){let e=r.getX(t)+l.getX(t)*a,i=r.getY(t)+l.getY(t)*a,o=r.getZ(t)+l.getZ(t)*a;
1r.setXYZ(t,e,i,o)}}if(s){n.morphAttributes.position.push(s),r&&n.morphAttributes.normal.push(r);let i=n.morphAttributes.position.length-1;t.morphTargetInfluences[i]=0,t.morphTargetDictionary[e]=i}})}async showAvatar(t,e=null){if(!t||!t.hasOwnProperty("url"))throw Error("Invalid parameter. The avatar must have at least 'url' specified.");let i=new s.B;if(this.dracoEnabled){let t=new r.Z;t.setDecoderPath(this.dracoDecoderPath),i.setDRACOLoader(t)}let a=await i.loadAsync(t.url,e),n=[this.opt.modelRoot];if(this.posePropNames.forEach(t=>n.push(t.split(".")[0])),n.forEach(t=>{if(!a.scene.getObjectByName(t))throw Error("Avatar object "+t+" not found")}),this.stop(),this.avatar=t,this.dynamicbones.dispose(),this.mixer&&(this.mixer.removeEventListener("finished",this._mixerHandler),this.mixer.stopAllAction(),this.mixer.uncacheRoot(this.armature),this.mixer=null,this._mixerHandler=null),this.isAvatarOnly?this.armature&&this.clearThree(this.armature):this.armature&&this.clearThree(this.scene),this.armature=a.scene.getObjectByName(this.opt.modelRoot),this.armature.scale.setScalar(1),this.animations=a.animations,this.userData=a.userData,this.morphs=[],this.armature.traverse(t=>{t.morphTargetInfluences&&t.morphTargetInfluences.length&&t.morphTargetDictionary&&this.morphs.push(t),t.frustumCulled=!1}),0===this.morphs.length)throw Error("Blend shapes not found");let h=new Set(this.mtCustoms);this.morphs.forEach(t=>{Object.keys(t.morphTargetDictionary).forEach(t=>h.add(t))}),this.mtExtras.forEach(t=>{h.has(t.key)||(this.addMixedMorphTarget(this.morphs,t.key,t.mix),h.add(t.key))});let l={};if(h.forEach(t=>{l[t]={fixed:null,realtime:null,system:null,systemd:null,newvalue:null,ref:null,min:this.mtMinExceptions.hasOwnProperty(t)?this.mtMinExceptions[t]:this.mtMinDefault,max:this.mtMaxExceptions.hasOwnProperty(t)?this.mtMaxExceptions[t]:this.mtMaxDefault,easing:this.mtEasingDefault,base:null,v:0,needsUpdate:!0,acc:(this.mtAccExceptions.hasOwnProperty(t)?this.mtAccExceptions[t]:this.mtAccDefault)/1e3,maxv:(this.mtMaxVExceptions.hasOwnProperty(t)?this.mtMaxVExceptions[t]:this.mtMaxVDefault)/1e3,limit:this.mtLimits.hasOwnProperty(t)?this.mtLimits[t]:null,onchange:this.mtOnchange.hasOwnProperty(t)?this.mtOnchange[t]:null,baseline:this.avatar.baseline?.hasOwnProperty(t)?this.avatar.baseline[t]:this.mtBaselineExceptions.hasOwnProperty(t)?this.mtBaselineExceptions[t]:this.mtBaselineDefault,ms:[],is:[]},l[t].value=l[t].baseline,l[t].applied=l[t].baseline;let e=this.mtAvatar[t];e&&["fixed","system","systemd","realtime","base","v","value","applied"].forEach(i=>{l[t][i]=e[i]}),this.morphs.forEach(e=>{let i=e.morphTargetDictionary[t];void 0!==i&&(l[t].ms.push(e.morphTargetInfluences),l[t].is.push(i),e.morphTargetInfluences[i]=l[t].applied)})}),this.mtAvatar=l,this.poseAvatar={props:{}},this.posePropNames.forEach(t=>{let e=t.split("."),i=this.armature.getObjectByName(e[0]);this.poseAvatar.props[t]=i[e[1]],this.poseBase.props.hasOwnProperty(t)?this.poseAvatar.props[t].copy(this.poseBase.props[t]):this.poseBase.props[t]=this.poseAvatar.props[t].clone(),this.poseDelta.props.hasOwnProperty(t)&&!this.poseTarget.props.hasOwnProperty(t)&&(this.poseTarget.props[t]=this.poseAvatar.props[t].clone()),this.poseTarget.props[t].t=this.animClock,this.poseTarget.props[t].d=2e3}),this.ikMesh.traverse(t=>{t.isBone&&t.position.copy(this.armature.getObjectByName(t.name).position)}),this.isAvatarOnly?this.scene&&this.scene.add(this.armature):(this.scene.add(a.scene),this.scene.add(this.lightAmbient),this.scene.add(this.lightDirect),this.scene.add(this.lightSpot),this.lightSpot.target=this.armature.getObjectByName("Head")),t.hasOwnProperty("modelDynamicBones"))try{this.dynamicbones.setup(this.scene,this.armature,t.modelDynamicBones)}catch(t){console.error("Dynamic bones setup failed: "+t)}this.objectLeftToeBase=this.armature.getObjectByName("LeftToeBase"),this.objectRightToeBase=this.armature.getObjectByName("RightToeBase"),this.objectLeftEye=this.armature.getObjectByName("LeftEye"),this.objectRightEye=this.armature.getObjectByName("RightEye"),this.objectLeftArm=this.armature.getObjectByName("LeftArm"),this.objectRightArm=this.armature.getObjectByName("RightArm"),this.objectHips=this.armature.getObjectByName("Hips"),this.objectHead=this.armature.getObjectByName("Head"),this.objectNeck=this.armature.getObjectByName("Neck");let d=new o.Pq0;this.objectLeftEye.getWorldPosition(d),this.avatarHeight=d.y+.2,this.viewName||this.setView(this.opt.cameraView),this.setMood(this.avatar.avatarMood||this.moodName||this.opt.avatarMood),this.start()}getViewNames(){return["full","mid","upper","head"]}getView(){return this.viewName}setView(t,e=null){if("full"!==(t=t||this.viewName)&&"upper"!==t&&"head"!==t&&"mid"!==t)return;if(!this.armature){this.opt.cameraView=t;return}if(this.viewName=t||this.viewName,e=e||{},this.isAvatarOnly)return;let i=e.hasOwnProperty("cameraX")?e.cameraX:this.opt.cameraX,a=e.hasOwnProperty("cameraY")?e.cameraY:this.opt.cameraY,n=e.hasOwnProperty("cameraDistance")?e.cameraDistance:this.opt.cameraDistance,s=e.hasOwnProperty("cameraRotateX")?e.cameraRotateX:this.opt.cameraRotateX,r=e.hasOwnProperty("cameraRotateY")?e.cameraRotateY:this.opt.cameraRotateY,h=this.camera.fov*(Math.PI/180),l=-i*Math.tan(h/2),d=(1-a)*Math.tan(h/2),m=n;switch(this.viewName){case"head":m+=2,d=d*m+4*this.avatarHeight/5;break;case"upper":m+=4.5,d=d*m+2*this.avatarHeight/3;break;case"mid":m+=8,d=d*m+this.avatarHeight/3;break;default:m+=12,d*=m}l*=m,this.controlsEnd=new o.Pq0(l,d,0),this.cameraEnd=new o.Pq0(l,d,m).applyEuler(new o.O9p(s,r,0)),null===this.cameraClock&&(this.controls.target.copy(this.controlsEnd),this.camera.position.copy(this.cameraEnd)),this.controlsStart=this.controls.target.clone(),this.cameraStart=this.camera.position.clone(),this.cameraClock=0}setLighting(t){!this.isAvatarOnly&&((t=t||{}).hasOwnProperty("lightAmbientColor")&&this.lightAmbient.color.set(new o.Q1f(t.lightAmbientColor)),t.hasOwnProperty("lightAmbientIntensity")&&(this.lightAmbient.intensity=t.lightAmbientIntensity,this.lightAmbient.visible=0!==t.lightAmbientIntensity),t.hasOwnProperty("lightDirectColor")&&this.lightDirect.color.set(new o.Q1f(t.lightDirectColor)),t.hasOwnProperty("lightDirectIntensity")&&(this.lightDirect.intensity=t.lightDirectIntensity,this.lightDirect.visible=0!==t.lightDirectIntensity),t.hasOwnProperty("lightDirectPhi")&&t.hasOwnProperty("lightDirectTheta")&&this.lightDirect.position.setFromSphericalCoords(2,t.lightDirectPhi,t.lightDirectTheta),t.hasOwnProperty("lightSpotColor")&&this.lightSpot.color.set(new o.Q1f(t.lightSpotColor)),t.hasOwnProperty("lightSpotIntensity")&&(this.lightSpot.intensity=t.lightSpotIntensity,this.lightSpot.visible=0!==t.lightSpotIntensity),t.hasOwnProperty("lightSpotPhi")&&t.hasOwnProperty("lightSpotTheta")&&(this.lightSpot.position.setFromSphericalCoords(2,t.lightSpotPhi,t.lightSpotTheta),this.lightSpot.position.add(new o.Pq0(0,1.5,0))),t.hasOwnProperty("lightSpotDispersion")&&(this.lightSpot.angle=t.lightSpotDispersion))}render(){this.isRunning&&!this.isAvatarOnly&&this.renderer.render(this.scene,this.camera)}onResize(){this.isAvatarOnly||(this.camera.aspect=this.nodeAvatar.clientWidth/this.nodeAvatar.clientHeight,this.camera.updateProjectionMatrix(),this.renderer.setSize(this.nodeAvatar.clientWidth,this.nodeAvatar.clientHeight),this.controls.update(),this.render())}updatePoseBase(t){for(let[e,i]of Object.entries(this.poseTarget.props)){let o=this.poseAvatar.props[e];if(o){let a=(t-i.t)/i.d;a>1||!this.poseBase.props.hasOwnProperty(e)?o.copy(i):o.isQuaternion?o.copy(this.poseBase.props[e].slerp(i,this.easing(a))):o.isVector3&&o.copy(this.poseBase.props[e].lerp(i,this.easing(a)))}}}updatePoseDelta(){for(let[t,e]of Object.entries(this.poseDelta.props)){if
1(0===e.x&&0===e.y&&0===e.z)continue;y.set(e.x,e.y,e.z);let i=this.poseAvatar.props[t];i.isQuaternion?(p.setFromEuler(y),i.multiply(p)):i.isVector3&&i.add(y)}}updateMorphTargets(t){for(let[e,i]of Object.entries(this.mtAvatar)){if(!i.needsUpdate)continue;let o=null,a=null;if(null!==i.fixed){if(o=i.fixed,i.system=null,i.systemd=null,i.newvalue=null,i.ref&&i.ref.hasOwnProperty(e)&&delete i.ref[e],i.ref=null,i.base=null,i.value===o){i.needsUpdate=!1;continue}}else null!==i.realtime?(i.ref=null,i.base=null,a=i.realtime):null!==i.system?(o=i.system,i.newvalue=null,i.ref&&i.ref.hasOwnProperty(e)&&delete i.ref[e],i.ref=null,i.base=null,null!==i.systemd?0===i.systemd?(o=null,i.system=null,i.systemd=null):(i.systemd-=t,i.systemd<0&&(i.systemd=0),i.value===o&&(o=null)):i.value===o&&(o=null,i.system=null)):null!==i.newvalue?(i.ref=null,i.base=null,a=i.newvalue,i.newvalue=null):null!==i.base?(o=i.base,i.ref=null,i.value===o&&(o=null,i.base=null,i.needsUpdate=!1)):(i.ref=null,null!==i.baseline&&i.value!==i.baseline?(o=i.baseline,i.base=i.baseline):i.needsUpdate=!1);if(null!==o){let e=o-i.value;e>=0?e<.005?(a=o,i.v=0):(i.v<i.maxv&&(i.v+=i.acc*t),a=i.v>=0?i.value+e*(1-Math.exp(-i.v*t)):i.value+i.v*t*(1-Math.exp(i.v*t))):e>-.005?(a=o,i.v=0):(i.v>-i.maxv&&(i.v-=i.acc*t),a=i.v>=0?i.value+i.v*t*(1-Math.exp(-i.v*t)):i.value+e*(1-Math.exp(i.v*t)))}if(null!==i.limit){if(null!==a&&a!==i.value&&(i.value=a,null!==i.onchange&&i.onchange(a)),(a=i.limit(i.value))===i.applied)continue}else{if(null===a||a===i.value)continue;i.value=a,null!==i.onchange&&i.onchange(a)}switch(i.applied=a,i.applied<i.min&&(i.applied=i.min),i.applied>i.max&&(i.applied=i.max),e){case"headRotateX":this.poseDelta.props["Head.quaternion"].x=i.applied+this.mtAvatar.bodyRotateX.applied;break;case"headRotateY":this.poseDelta.props["Head.quaternion"].y=i.applied+this.mtAvatar.bodyRotateY.applied;break;case"headRotateZ":this.poseDelta.props["Head.quaternion"].z=i.applied+this.mtAvatar.bodyRotateZ.applied;break;case"bodyRotateX":this.poseDelta.props["Head.quaternion"].x=i.applied+this.mtAvatar.headRotateX.applied,this.poseDelta.props["Spine1.quaternion"].x=i.applied/2,this.poseDelta.props["Spine.quaternion"].x=i.applied/8,this.poseDelta.props["Hips.quaternion"].x=i.applied/24;break;case"bodyRotateY":this.poseDelta.props["Head.quaternion"].y=i.applied+this.mtAvatar.headRotateY.applied,this.poseDelta.props["Spine1.quaternion"].y=i.applied/2,this.poseDelta.props["Spine.quaternion"].y=i.applied/2,this.poseDelta.props["Hips.quaternion"].y=i.applied/4,this.poseDelta.props["LeftUpLeg.quaternion"].y=i.applied/2,this.poseDelta.props["RightUpLeg.quaternion"].y=i.applied/2,this.poseDelta.props["LeftLeg.quaternion"].y=i.applied/4,this.poseDelta.props["RightLeg.quaternion"].y=i.applied/4;break;case"bodyRotateZ":this.poseDelta.props["Head.quaternion"].z=i.applied+this.mtAvatar.headRotateZ.applied,this.poseDelta.props["Spine1.quaternion"].z=i.applied/12,this.poseDelta.props["Spine.quaternion"].z=i.applied/12,this.poseDelta.props["Hips.quaternion"].z=i.applied/24;break;case"handFistLeft":case"handFistRight":let n=e.substring(8);["HandThumb","HandIndex","HandMiddle","HandRing","HandPinky"].forEach((t,e)=>{0===e?(this.poseDelta.props[n+t+"1.quaternion"].x=0,this.poseDelta.props[n+t+"2.quaternion"].z=("Left"===n?-1:1)*i.applied,this.poseDelta.props[n+t+"3.quaternion"].z=("Left"===n?-1:1)*i.applied):(this.poseDelta.props[n+t+"1.quaternion"].x=i.applied,this.poseDelta.props[n+t+"2.quaternion"].x=1.5*i.applied,this.poseDelta.props[n+t+"3.quaternion"].x=1.5*i.applied)});break;case"chestInhale":let s=i.applied/20,r={x:s,y:s/2,z:3*s},h={x:1/(1+s)-1,y:1/(1+s/2)-1,z:1/(1+3*s)-1};this.poseDelta.props["Spine1.scale"]=r,this.poseDelta.props["Neck.scale"]=h,this.poseDelta.props["LeftArm.scale"]=h,this.poseDelta.props["RightArm.scale"]=h;break;default:for(let t=0,e=i.ms.length;t<e;t++)i.ms[t][i.is[t]]=i.applied}}}getPoseString(t,e=1e3){let i="{";return Object.entries(t).forEach((t,a)=>{let n=t[0].split(".");if("position"===n[1]||"rotation"===n[1]||"quaternion"===n[1]){let s="quaternion"===n[1]?n[0]+".rotation":t[0],r=t[1].isQuaternion?new o.O9p().setFromQuaternion(t[1]):t[1];i+=(a?", ":"")+"'"+s+"':{x:"+Math.round(r.x*e)/e+", y:"+Math.round(r.y*e)/e+", z:"+Math.round(r.z*e)/e+"}"}}),i+="}"}getPoseTemplateProp(t){let e=t.split("."),i=e[0]+"."+("rotation"===e[1]?"quaternion":e[1]);if(this.gesture&&this.gesture.hasOwnProperty(i))return this.gesture[i].clone();{let t,o=e[0]+"."+("quaternion"===e[1]?"rotation":e[1]);if(!this.poseWeightOnLeft&&(o.startsWith("Left")?(o="Right"+o.substring(4),i="Right"+i.substring(4)):o.startsWith("Right")&&(o="Left"+o.substring(5),i="Left"+i.substring(5))),this.poseTarget.template.props.hasOwnProperty(i)){let e={};e[i]=this.poseTarget.template.props[i],t=this.propsToThreeObjects(e)[i]}else if(this.poseTarget.template.props.hasOwnProperty(o)){let e={};e[o]=this.poseTarget.template.props[o],t=this.propsToThreeObjects(e)[i]}return t&&!this.poseWeightOnLeft&&t.isQuaternion&&(t.x*=-1,t.w*=-1),t}}mirrorPose(t){let e={};for(let[i,o]of Object.entries(t))o.isQuaternion&&(i.startsWith("Left")?i="Right"+i.substring(4):i.startsWith("Right")&&(i="Left"+i.substring(5)),o.x*=-1,o.w*=-1),e[i]=o.clone(),e[i].t=o.t,e[i].d=o.d;return e}poseFactory(t,e=2e3){let i={template:t,props:this.propsToThreeObjects(t.props)};
1for(let[o,a]of Object.entries(i.props)){if(this.opt.modelMovementFactor<1&&t.standing&&("Hips.quaternion"===o||"Spine.quaternion"===o||"Spine1.quaternion"===o||"Spine2.quaternion"===o||"Neck.quaternion"===o||"LeftUpLeg.quaternion"===o||"LeftLeg.quaternion"===o||"RightUpLeg.quaternion"===o||"RightLeg.quaternion"===o)){let t=this.poseStraight[o],e=a.angleTo(t);a.rotateTowards(t,(1-this.opt.modelMovementFactor)*e)}a.t=this.animClock,a.d=e}return i}setPoseFromTemplate(t,e=2e3){let i=t&&this.poseTarget&&this.poseTarget.template&&(this.poseTarget.template.standing&&t.lying||this.poseTarget.template.lying&&t.standing),o=t&&t===this.poseCurrentTemplate,a=this.poseWeightOnLeft,n=i?1e3:e;if(i?(this.poseCurrentTemplate=this.poseTemplates.oneknee,setTimeout(()=>{this.setPoseFromTemplate(t,e)},n)):this.poseCurrentTemplate=t||this.poseCurrentTemplate,this.poseTarget=this.poseFactory(this.poseCurrentTemplate,n),this.poseWeightOnLeft=!0,(!o&&!a||o&&a)&&(this.poseTarget.props=this.mirrorPose(this.poseTarget.props),this.poseWeightOnLeft=!this.poseWeightOnLeft),this.gesture)for(let[t,e]of Object.entries(this.gesture))this.poseTarget.props.hasOwnProperty(t)&&(this.poseTarget.props[t].copy(e),this.poseTarget.props[t].t=e.t,this.poseTarget.props[t].d=e.d);Object.keys(this.poseDelta.props).forEach(t=>{this.poseTarget.props.hasOwnProperty(t)||(this.poseTarget.props[t]=this.poseBase.props[t].clone(),this.poseTarget.props[t].t=this.animClock,this.poseTarget.props[t].d=n)})}getValue(t){return this.mtAvatar[t]?.value}setValue(t,e,i=null){this.mtAvatar.hasOwnProperty(t)&&Object.assign(this.mtAvatar[t],{system:e,systemd:i,needsUpdate:!0})}getMoodNames(){return Object.keys(this.animMoods)}getMood(){return this.opt.avatarMood}setMood(t){if(t=(t||"").trim().toLowerCase(),!this.animMoods.hasOwnProperty(t))throw Error("Unknown mood.");for(let e of(this.moodName=t,this.mood=this.animMoods[this.moodName],Object.keys(this.mtAvatar))){let t=this.mtBaselineExceptions.hasOwnProperty(e)?this.mtBaselineExceptions[e]:this.mtBaselineDefault;this.mood.baseline.hasOwnProperty(e)?t=this.mood.baseline[e]:this.avatar.baseline?.hasOwnProperty(e)&&(t=this.avatar.baseline[e]),this.setBaselineValue(e,t)}this.mood.anims.forEach(t=>{let e=this.animQueue.findIndex(e=>e.template.name===t.name);-1!==e&&this.animQueue.splice(e,1),this.animQueue.push(this.animFactory(t,-1))})}getMorphTargetNames(){return["eyesRotateX","eyesRotateY",...Object.keys(this.mtAvatar)].sort()}getBaselineValue(t){if("eyesRotateY"===t){let t=this.getBaselineValue("eyeLookOutLeft");if(void 0===t)return;let e=this.getBaselineValue("eyeLookInLeft");if(void 0!==e&&void 0!==this.getBaselineValue("eyeLookOutRight")&&void 0!==this.getBaselineValue("eyeLookInRight"))return t-e}else{if("eyesRotateX"!==t)return this.mtAvatar[t]?.baseline;let e=this.getBaselineValue("eyesLookDown");if(void 0===e)return;let i=this.getBaselineValue("eyesLookUp");if(void 0===i)return;return e-i}}setBaselineValue(t,e){"eyesRotateY"===t?(this.setBaselineValue("eyeLookOutLeft",null===e?null:e>0?e:0),this.setBaselineValue("eyeLookInLeft",null===e?null:e>0?0:-e),this.setBaselineValue("eyeLookOutRight",null===e?null:e>0?0:-e),this.setBaselineValue("eyeLookInRight",null===e?null:e>0?e:0)):"eyesRotateX"===t?(this.setBaselineValue("eyesLookDown",null===e?null:e>0?e:0),this.setBaselineValue("eyesLookUp",null===e?null:e>0?0:-e)):this.mtAvatar.hasOwnProperty(t)&&Object.assign(this.mtAvatar[t],{base:null,baseline:e,needsUpdate:!0})}getFixedValue(t){if("eyesRotateY"===t){let t=this.getFixedValue("eyeLookOutLeft");if(null===t)return null;let e=this.getFixedValue("eyeLookInLeft");return null===e||null===this.getFixedValue("eyeLookOutRight")||null===this.getFixedValue("eyeLookInRight")?null:t-e}if("eyesRotateX"!==t)return this.mtAvatar[t]?.fixed;{let t=this.getFixedValue("eyesLookDown");if(null===t)return null;let e=this.getFixedValue("eyesLookUp");return null===e?null:t-e}}setFixedValue(t,e,i=null){"eyesRotateY"===t?(this.setFixedValue("eyeLookOutLeft",null===e?null:e>0?e:0,i),this.setFixedValue("eyeLookInLeft",null===e?null:e>0?0:-e,i),this.setFixedValue("eyeLookOutRight",null===e?null:e>0?0:-e,i),this.setFixedValue("eyeLookInRight",null===e?null:e>0?e:0,i)):"eyesRotateX"===t?(this.setFixedValue("eyesLookDown",null===e?null:e>0?e:0,i),this.setFixedValue("eyesLookUp",null===e?null:e>0?0:-e,i)):this.mtAvatar.hasOwnProperty(t)&&Object.assign(this.mtAvatar[t],{fixed:e,needsUpdate:!0})}animFactory(t,e=!1,i=1,o=1,a=!1){let n={template:t,ts:[0],vs:{}},s=t;for(;;)if(s.hasOwnProperty(this.stateName))s=s[this.stateName];else if(s.hasOwnProperty(this.moodName))s=s[this.moodName];else if(s.hasOwnProperty(this.poseName))s=s[this.poseName];else if(s.hasOwnProperty(this.viewName))s=s[this.viewName];else if(this.avatar.body&&s.hasOwnProperty(this.avatar.body))s=s[this.avatar.body];else if(s.hasOwnProperty("alt")){let t=s.alt[0];if(s.alt.length>1){let e=Math.random(),i=0;for(let o=0;o<s.alt.length;o++){let a=this.valueFn(s.alt[o].p);if(e<(i+=void 0===a?(1-i)/(s.alt.length-1-o):a)){t=s.alt[o];break}}}s=t}else break;let r=this.valueFn(s.delay)||0;for(let[t,e]of(Array.isArray(r)&&(r=this.gaussianRandom(...r)),s.hasOwnProperty("dt")?s.dt.forEach((t,e)=>{let i=this.valueFn(t);Array.isArray(i)&&(i=this.gaussianRandom(...i)),n.ts[e+1]=n.ts[e]+i}):n.ts=Array(Object.values(s.vs).reduce((t,e)=>e.length>t?e.length:t,0)+1).fill(0),a?n.ts=n.ts.map(t=>r+t*i):n.ts=n.ts.map(t=>this.animClock+r+t*i),Object.entries(s.vs))){let i=this.getBaselineValue(t),a=e.map(e=>{if(null===(e=this.valueFn(e)))return null;if("function"==typeof e)return e;if("string"==typeof e||e instanceof String)return e.slice();if(Array.isArray(e))if("gesture"===t)return e.slice();else return(void 0===i?0:i)+o*this.gaussianRandom(...e);if("boolean"==typeof e)return e;else if(e instanceof Object&&e.constructor===Object)return Object.assign({},e);else return(void 0===i?0:i)+o*e});"eyesRotateY"===t?(n.vs.eyeLookOutLeft=[null,...a.map(t=>t>0?t:0)],n.vs.eyeLookInLeft=[null,...a.map(t=>t>0?0:-t)],n.vs.eyeLookOutRight=[null,...a.map(t=>t>0?0:-t)],n.vs.eyeLookInRight=[null,...a.map(t=>t>0?t:0)]):"eyesRotateX"===t?(n.vs.eyesLookDown=[null,...a.map(t=>t>0?t:0)],n.vs.eyesLookUp=[null,...a.map(t=>t>0?0:-t)]):n.vs[t]=[null,...a]}for(let t of Object.keys(n.vs))for(;n.vs[t].length<=n.ts.length;)n.vs[t].push(n.vs[t][n.vs[t].length-1]);return t.hasOwnProperty("mood")&&(n.mood=this.valueFn(t.mood).slice()),e&&(n.loop=e),n}valueAnimationSeq(t,e,i,o,a,n=null){t=this.valueFn(t),e=this.valueFn(e),a<i&&(a=i),a>o&&(a=o);let s=(e-t)/(o-i);return n&&(s*=n((a-i)/(o-i))),s*a+(t-s*i)}gaussianRandom(t,e,i=1,o=5){let a=0;for(let t=0;t<o;t++)a+=Math.random();return t+Math.pow(a/o,i)*(e-t)}
1sigmoidFactory(t){function e(e){return 1/(1+Math.exp(-t*e))-.5}var i=.5/e(1);return function(t){return i*e(2*Math.max(Math.min(t,1),0)-1)+.5}}convertRange(t,e,i){return(t-e[0])*(i[1]-i[0])/(e[1]-e[0])+i[0]}animate(t){let e;if(!this.isRunning)return;if(this.isAvatarOnly)e=t;else{if(this._raf=requestAnimationFrame(this.animate),(e=t-this.animTimeLast)<this.animFrameDur)return;this.animTimeLast=t}e/=this.animSlowdownRate,this.animClock+=e;let i,a,n,s,r=0;if(this.stats&&this.stats.begin(),this.isListening){for(this.listeningAnalyzer.getByteFrequencyData(this.volumeFrequencyData),i=2,n=10;i<n;i++)this.volumeFrequencyData[i]>r&&(r=this.volumeFrequencyData[i]);this.listeningVolume=(this.listeningVolume+r)/2,this.listeningActive?(this.listeningTimerTotal+=e,this.listeningVolume<this.listeningSilenceThresholdLevel?(this.listeningTimer+=e,this.listeningTimer>this.listeningSilenceThresholdMs&&(this.listeningOnchange&&this.listeningOnchange("stop",this.listeningTimer),this.listeningActive=!1,this.listeningTimer=0,this.listeningTimerTotal=0)):this.listeningTimer*=.5,this.listeningTimerTotal>this.listeningActiveDurationMax&&(this.listeningOnchange&&this.listeningOnchange("maxactive"),this.listeningTimerTotal=0)):(this.listeningTimerTotal+=e,this.listeningVolume>this.listeningActiveThresholdLevel?(this.listeningTimer+=e,this.listeningTimer>this.listeningActiveThresholdMs&&(this.listeningOnchange&&this.listeningOnchange("start"),this.listeningActive=!0,this.listeningTimer=0,this.listeningTimerTotal=0)):this.listeningTimer*=.5,this.listeningTimerTotal>this.listeningSilenceDurationMax&&(this.listeningOnchange&&this.listeningOnchange("maxsilence"),this.listeningTimerTotal=0))}if(this.isSpeaking)for(r=0,this.audioAnalyzerNode.getByteFrequencyData(this.volumeFrequencyData),i=2,n=10;i<n;i++)this.volumeFrequencyData[i]>r&&(r=this.volumeFrequencyData[i]);let h=null,l=null,d=[];for(i=0,n=this.animQueue.length;i<n;i++){let t=this.animQueue[i];if(!(this.animClock<t.ts[0])){for(a=t.ndx||0,s=t.ts.length;a<s&&!(this.animClock<t.ts[a]);a++)for(let[e,i]of Object.entries(t.vs))if(this.mtAvatar.hasOwnProperty(e)){if(null===i[a+1])continue;let o=this.mtAvatar[e];if(null===i[a]&&(i[a]=o.value),a===s-1)o.newvalue=i[a];else{o.newvalue=i[a+1];let n=t.ts[a+1]-t.ts[a],s=1;n>1e-4&&(s=(this.animClock-t.ts[a])/n),s<1&&(o.easing&&(s=o.easing(s)),o.newvalue=(1-s)*i[a]+s*o.newvalue),o.ref&&o.ref!==t.vs&&o.ref.hasOwnProperty(e)&&delete o.ref[e],o.ref=t.vs}if(r)switch(e){case"viseme_aa":case"viseme_E":case"viseme_I":case"viseme_O":case"viseme_U":o.newvalue*=1+r/255-.5}o.needsUpdate=!0}else"eyeContact"===e&&null!==i[a]&&!1!==h?h=!!i[a]:"headMove"===e&&null!==i[a]&&!1!==l?0===i[a]?l=!1:(Math.random()<i[a]&&(l=!0),i[a]=null):null!==i[a]&&(d.push({mt:e,val:i[a]}),i[a]=null);a===s?(t.hasOwnProperty("mood")&&this.setMood(t.mood),t.loop?(s=this.isSpeaking&&("head"===t.template.name||"eyes"===t.template.name)?4:1,this.animQueue[i]=this.animFactory(t.template,t.loop>0?t.loop-1:t.loop,1,1/s)):(this.animQueue.splice(i--,1),n--)):t.ndx=a-1}}for(let t=0,e=d.length;t<e;t++)switch(a=d[t].val,d[t].mt){case"speak":this.speakText(a);break;case"subtitles":this.onSubtitles&&"function"==typeof this.onSubtitles&&this.onSubtitles(a);break;case"pose":this.poseName=a,this.setPoseFromTemplate(this.poseTemplates[this.poseName]);break;case"gesture":this.playGesture(...a);break;case"function":a&&"function"==typeof a&&a();break;case"moveto":Object.entries(a.props).forEach(t=>{t[1]?this.poseTarget.props[t[0]].copy(t[1]):this.poseTarget.props[t[0]].copy(this.getPoseTemplateProp(t[0])),this.poseTarget.props[t[0]].t=this.animClock,this.poseTarget.props[t[0]].d=t[1]&&t[1].d?t[1].d:t.duration||2e3});break;case"handLeft":this.ikSolve({iterations:20,root:"LeftShoulder",effector:"LeftHandMiddle1",links:[{link:"LeftHand",minx:-.5,maxx:.5,miny:-1,maxy:1,minz:-.5,maxz:.5},{link:"LeftForeArm",minx:-.5,maxx:1.5,miny:-1.5,maxy:1.5,minz:-.5,maxz:3},{link:"LeftArm",minx:-1.5,maxx:1.5,miny:0,maxy:0,minz:-1,maxz:3}]},a.x?new o.Pq0(a.x,a.y,a.z):null,!0,a.d);break;case"handRight":this.ikSolve({iterations:20,root:"RightShoulder",effector:"RightHandMiddle1",links:[{link:"RightHand",minx:-.5,maxx:.5,miny:-1,maxy:1,minz:-.5,maxz:.5,maxAngle:.1},{link:"RightForeArm",minx:-.5,maxx:1.5,miny:-1.5,maxy:1.5,minz:-3,maxz:.5,maxAngle:.2},{link:"RightArm",minx:-1.5,maxx:1.5,miny:0,maxy:0,minz:-1,maxz:3}]},a.x?new o.Pq0(a.x,a.y,a.z):null,!0,a.d)}if((h||l)&&(y.setFromQuaternion(this.poseAvatar.props["Head.quaternion"]),y.x=Math.max(-.9,Math.min(.9,2*y.x-.5)),y.y=Math.max(-.9,Math.min(.9,-2.5*y.y)),h?(Object.assign(this.mtAvatar.eyesLookDown,{system:y.x<0?-y.x:0,needsUpdate:!0}),Object.assign(this.mtAvatar.eyesLookUp,{system:y.x<0?0:y.x,needsUpdate:!0}),Object.assign(this.mtAvatar.eyeLookInLeft,{system:y.y<0?-y.y:0,needsUpdate:!0}),Object.assign(this.mtAvatar.eyeLookOutLeft,{system:y.y<0?0:y.y,needsUpdate:!0}),Object.assign(this.mtAvatar.eyeLookInRight,{system:y.y<0?0:y.y,needsUpdate:!0}),Object.assign(this.mtAvatar.eyeLookOutRight,{system:y.y<0?-y.y:0,needsUpdate:!0}),l&&(i=-this.mtAvatar.bodyRotateY.value,a=this.gaussianRandom(-.2,.2),this.animQueue.push(this.animFactory({name:"headmove",dt:[[1e3,2e3],[1e3,2e3,1,2],[1e3,2e3],[1e3,2e3,1,2]],vs:{headRotateY:[i,i,0],headRotateX:[a,a,0],headRotateZ:[-i/4,-i/4,0]}})))):(i=this.mtAvatar.eyeLookInLeft.value-this.mtAvatar.eyeLookOutLeft.value,a=this.gaussianRandom(-.2,.2),this.animQueue.push(this.animFactory({name:"headmove",dt:[[1e3,2e3],[1e3,2e3,1,2],[1e3,2e3],[1e3,2e3,1,2]],vs:{headRotateY:[null,i,i,0],headRotateX:[null,a,a,0],headRotateZ:[null,-i/4,-i/4,0],eyeLookInLeft:[null,0],eyeLookOutLeft:[null,0],eyeLookInRight:[null,0],eyeLookOutRight:[null,0],eyeContact:[0]}})))),e>2*this.animFrameDur&&(e=2*this.animFrameDur),("full"!==this.viewName||this.isAvatarOnly)&&(i=this.mtRandomized[Math.floor(Math.random()*this.mtRandomized.length)],(a=this.mtAvatar[i]).needsUpdate||Object.assign(a,{base:(this.mood.baseline[i]||0)+(1+r/255)*Math.random()/5,needsUpdate:!0})),this.updatePoseBase(this.animClock),this.mixer&&this.mixer.update(e/1e3*this.mixer.timeScale),this.updatePoseDelta(),(this.isSpeaking||this.isListening)&&h?r>this.volumeMax?(this.volumeHeadBase=.05,Math.random()>.6&&(this.volumeHeadTarget=-.05-Math.random()/15),this.volumeMax=r):(this.volumeMax*=.92,this.volumeHeadTarget=this.volumeHeadBase-.9*(this.volumeHeadBase-this.volumeHeadTarget)):(this.volumeHeadTarget=0,this.volumeMax=0),(a=Math.abs(i=this.volumeHeadTarget-this.volumeHeadCurrent))>1e-4&&(s=a*(this.volumeHeadEasing(Math.min(1,this.volumeHeadVelocity*e/1e3/a)/2+.5)-.5),this.volumeHeadCurrent+=Math.sign(i)*Math.min(a,s)),Math.abs(this.volumeHeadCurrent)>1e-4&&(p.setFromAxisAngle(f,this.volumeHeadCurrent),this.objectNeck.quaternion.multiply(
1p)),x.setFromObject(this.armature),this.objectLeftToeBase.getWorldPosition(g),g.sub(this.armature.position),this.objectRightToeBase.getWorldPosition(c),c.sub(this.armature.position),this.objectHips.position.y-=x.min.y/2,this.objectHips.position.x-=(g.x+c.x)/4,this.objectHips.position.z-=(g.z+c.z)/2,this.dynamicbones.update(e),this.opt.update&&this.opt.update(e),this.updateMorphTargets(e),this.isAvatarOnly)this.stats&&this.stats.end();else{if(null!==this.cameraClock&&this.cameraClock<1e3){this.cameraClock+=e,this.cameraClock>1e3&&(this.cameraClock=1e3);let t=new o.YHV().setFromVector3(this.cameraStart),i=new o.YHV().setFromVector3(this.cameraEnd);t.phi+=this.easing(this.cameraClock/1e3)*(i.phi-t.phi),t.theta+=this.easing(this.cameraClock/1e3)*(i.theta-t.theta),t.radius+=this.easing(this.cameraClock/1e3)*(i.radius-t.radius),t.makeSafe(),this.camera.position.setFromSpherical(t),this.controlsStart.x!==this.controlsEnd.x?this.controls.target.copy(this.controlsStart.lerp(this.controlsEnd,this.easing(this.cameraClock/1e3))):(t.setFromVector3(this.controlsStart),i.setFromVector3(this.controlsEnd),t.phi+=this.easing(this.cameraClock/1e3)*(i.phi-t.phi),t.theta+=this.easing(this.cameraClock/1e3)*(i.theta-t.theta),t.radius+=this.easing(this.cameraClock/1e3)*(i.radius-t.radius),t.makeSafe(),this.controls.target.setFromSpherical(t)),this.controls.update()}this.controls.autoRotate&&this.controls.update(),this.stats&&this.stats.end(),this.render()}}resetLips(){this.visemeNames.forEach(t=>{this.morphs.forEach(e=>{let i=e.morphTargetDictionary["viseme_"+t];void 0!==i&&(e.morphTargetInfluences[i]=0)})})}lipsyncGetProcessor(t,e="./"){if(!this.lipsync.hasOwnProperty(t)){let o=e+"lipsync-"+t.toLowerCase()+".mjs",a="Lipsync"+t.charAt(0).toUpperCase()+t.slice(1);i(75925)(o).then(e=>{this.lipsync[t]=new e[a]})}}lipsyncPreProcessText(t,e){return(this.lipsync[e]||Object.values(this.lipsync)[0]).preProcessText(t)}lipsyncWordsToVisemes(t,e){return(this.lipsync[e]||Object.values(this.lipsync)[0]).wordsToVisemes(t)}speakText(t,e=null,i=null,o=null){let a=/[!\.\?\n\p{Extended_Pictographic}]/ug,n=/[ ]/ug,s=/[\p{L}\p{N},\.\p{Quotation_Mark}!€\$\+\p{Dash_Punctuation}%&\?]/ug,r=/[\p{Extended_Pictographic}]/ug,h=(e=e||{}).lipsyncLang||this.avatar.lipsyncLang||this.opt.lipsyncLang,l="",d="",m=0,u=[],p=[],y=Array.from(this.segmenter.segment(t),t=>t.segment);for(let t=0;t<y.length;t++){let g=t===y.length-1,c=y[t].match(s),x=y[t].match(a),f=y[t].match(r),L=y[t].match(n);if(x&&!g&&!f&&y[t+1].match(a)&&(x=!1),i&&(l+=y[t]),c&&(!o||o.every(e=>t<e[0]||t>e[1]))&&(d+=y[t]),(L||x||g)&&(d.length&&(d=this.lipsyncPreProcessText(d,h)).length&&u.push({mark:m,word:d}),l.length&&(p.push({mark:m,template:{name:"subtitles"},ts:[0],vs:{subtitles:[l]}}),l=""),d.length)){let t=this.lipsyncWordsToVisemes(d,h);if(t&&t.visemes&&t.visemes.length){let e=t.times[t.visemes.length-1]+t.durations[t.visemes.length-1];for(let i=0;i<t.visemes.length;i++)p.push({mark:m,template:{name:"viseme"},ts:[(t.times[i]-.6)/e,(t.times[i]+.5)/e,(t.times[i]+t.durations[i]+.5)/e],vs:{["viseme_"+t.visemes[i]]:[null,"PP"===t.visemes[i]||"FF"===t.visemes[i]?.9:.6,0]}})}d="",m++}if(x||g){if(u.length||g&&p.length){let t={anim:p};i&&(t.onSubtitles=i),u.length&&!e.avatarMute&&(t.text=u,e.avatarMood&&(t.mood=e.avatarMood),e.ttsLang&&(t.lang=e.ttsLang),e.ttsVoice&&(t.voice=e.ttsVoice),e.ttsRate&&(t.rate=e.ttsRate),e.ttsVoice&&(t.pitch=e.ttsPitch),e.ttsVolume&&(t.volume=e.ttsVolume)),this.speechQueue.push(t),u=[],d="",m=0,p=[]}if(f){let e=this.animEmojis[y[t]];e&&e.link&&(e=this.animEmojis[e.link]),e&&this.speechQueue.push({emoji:e})}this.speechQueue.push({break:100})}}this.speechQueue.push({break:1e3}),this.startSpeaking()}async speakEmoji(t){let e=this.animEmojis[t];e&&e.link&&(e=this.animEmojis[e.link]),e&&this.speechQueue.push({emoji:e}),this.startSpeaking()}async speakBreak(t){this.speechQueue.push({break:t}),this.startSpeaking()}async speakMarker(t){this.speechQueue.push({marker:t}),this.startSpeaking()}async playBackgroundAudio(t){let e=await fetch(t),i=await e.arrayBuffer();
1this.stopBackgroundAudio(),this.audioBackgroundSource=this.audioCtx.createBufferSource(),this.audioBackgroundSource.loop=!0,this.audioBackgroundSource.buffer=await this.audioCtx.decodeAudioData(i),this.audioBackgroundSource.playbackRate.value=1/this.animSlowdownRate,this.audioBackgroundSource.connect(this.audioBackgroundGainNode),this.audioBackgroundSource.start(0)}stopBackgroundAudio(){try{this.audioBackgroundSource.stop()}catch(t){}this.audioBackgroundSource.disconnect()}async setReverb(t=null){if(t){let e=await fetch(t),i=await e.arrayBuffer();this.audioReverbNode.buffer=await this.audioCtx.decodeAudioData(i)}else{let t=this.audioCtx.sampleRate,e=this.audioCtx.createBuffer(2,t,t);e.getChannelData(0)[0]=1,e.getChannelData(1)[0]=1,this.audioReverbNode.buffer=e}}setMixerGain(t,e=null,i=0){null!==t&&(this.audioSpeechGainNode.gain.cancelScheduledValues(this.audioCtx.currentTime),i?(this.audioSpeechGainNode.gain.setValueAtTime(Math.max(this.audioSpeechGainNode.gain.value,1e-4),this.audioCtx.currentTime),this.audioSpeechGainNode.gain.exponentialRampToValueAtTime(Math.max(t,1e-4),this.audioCtx.currentTime+i)):this.audioSpeechGainNode.gain.setValueAtTime(t,this.audioCtx.currentTime)),null!==e&&(this.audioBackgroundGainNode.gain.cancelScheduledValues(this.audioCtx.currentTime),i?(this.audioBackgroundGainNode.gain.setValueAtTime(Math.max(this.audioBackgroundGainNode.gain.value,1e-4),this.audioCtx.currentTime),this.audioBackgroundGainNode.gain.exponentialRampToValueAtTime(Math.max(e,1e-4),this.audioCtx.currentTime+i)):this.audioBackgroundGainNode.gain.setValueAtTime(e,this.audioCtx.currentTime))}speakAudio(t,e=null,i=null){let o=(e=e||{}).lipsyncLang||this.avatar.lipsyncLang||this.opt.lipsyncLang,a={};if(t.words){let e=[];for(let a=0;a<t.words.length;a++){let n=t.words[a],s=t.wtimes[a],r=t.wdurations[a];if(n.length&&(i&&e.push({template:{name:"subtitles"},ts:[s],vs:{subtitles:[" "+n]}}),!t.visemes)){let t=this.lipsyncPreProcessText(n,o),i=this.lipsyncWordsToVisemes(t,o);if(i&&i.visemes&&i.visemes.length){let t=i.times[i.visemes.length-1]+i.durations[i.visemes.length-1],o=Math.min(r,Math.max(0,r-150*i.visemes.length)),a=.6+this.convertRange(o,[0,r],[0,.4]);if(r=Math.min(r,200*i.visemes.length),t>0)for(let o=0;o<i.visemes.length;o++){let n=s+i.times[o]/t*r,h=i.durations[o]/t*r;e.push({template:{name:"viseme"},ts:[n-Math.min(60,2*h/3),n+Math.min(25,h/2),n+h+Math.min(60,h/2)],vs:{["viseme_"+i.visemes[o]]:[null,"PP"===i.visemes[o]||"FF"===i.visemes[o]?.9:a,0]}})}}}}if(t.visemes)for(let i=0;i<t.visemes.length;i++){let o=t.visemes[i],a=t.vtimes[i],n=t.vdurations[i];e.push({template:{name:"viseme"},ts:[a-2*n/3,a+n/2,a+n+n/2],vs:{["viseme_"+o]:[null,"PP"===o||"FF"===o?.9:.6,0]}})}if(t.markers)for(let i=0;i<t.markers.length;i++){let o=t.markers[i],a=t.mtimes[i];e.push({template:{name:"markers"},ts:[a],vs:{function:[o]}})}e.length&&(a.anim=e)}if(t.audio&&(a.audio=t.audio),t.anim?.name){let e=this.animFactory(t.anim,!1,1,1,!0);a.anim?a.anim.push(e):a.anim=[e]}i&&(a.onSubtitles=i),e.isRaw&&(a.isRaw=!0),Object.keys(a).length&&(this.speechQueue.push(a),a.isRaw||this.speechQueue.push({break:300}),this.startSpeaking())}async playAudio(t=!1){if(this.armature&&(!this.isAudioPlaying||t))if(this.isAudioPlaying=!0,this.audioPlaylist.length){let t,e=this.audioPlaylist.shift();if("suspended"===this.audioCtx.state||"interrupted"===this.audioCtx.state){let t=this.audioCtx.resume(),e=new Promise((t,e)=>setTimeout(()=>e("p2"),1e3));try{await Promise.race([t,e])}catch(t){console.log("Can't play audio. Web Audio API suspended. This is often due to calling some speak method before the first user action, which is typically prevented by the browser."),this.playAudio(!0);return}}if(Array.isArray(e.audio)){let i=this.concatArrayBuffers(e.audio);t=this.pcmToAudioBuffer(i)}else t=e.audio;if(this.audioSpeechSource){try{this.audioSpeechSource.stop?.()}catch(t){}this.audioSpeechSource.disconnect(),this.audioSpeechSource.onended=null,this.audioSpeechSource=null}let i=this.audioCtx.createBufferSource();this.audioSpeechSource=i,i.buffer=t,i.playbackRate.value=1/this.animSlowdownRate,i.connect(this.audioAnalyzerNode),i.onended=()=>{i.disconnect(),i.onended=null,this.audioSpeechSource===i&&(this.audioSpeechSource=null),this.playAudio(!0)};let o=0;e.anim&&(e.isRaw||(o=Math.abs(Math.min(0,...e.anim.map(t=>Math.min(...t.ts))))),e.anim.forEach(t=>{for(let e=0;e<t.ts.length;e++)t.ts[e]=this.animClock+t.ts[e]+o;this.animQueue.push(t)})),i.start(this.audioCtx.currentTime+o/1e3)}else this.isAudioPlaying=!1,this.startSpeaking(!0)}async startSpeaking(t=!1){if(this.armature&&(!this.isSpeaking||t))if(this.stateName="speaking",this.isSpeaking=!0,this.speechQueue.length){let t=this.speechQueue.shift();if(t.emoji){this.lookAtCamera(500);let e=t.emoji.dt.reduce((t,e)=>t+e,0);this.animQueue.push(this.animFactory(t.emoji)),setTimeout(this.startSpeaking.bind(this),e,!0)}else if(t.break)setTimeout(this.startSpeaking.bind(this),t.break,!0);else if(t.audio)t.isRaw||(this.lookAtCamera(500),this.speakWithHands(),this.resetLips()),this.audioPlaylist.push({anim:t.anim,audio:t.audio,isRaw:t.isRaw}),this.onSubtitles=t.onSubtitles||null,t.mood&&this.setMood(t.mood),this.playAudio();else if(t.text){this.lookAtCamera(500);try{let e="<speak>";t.text.forEach((t,i)=>{i>0&&(e+=" <mark name='"+t.mark+"'/>"),e+=t.word.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&apos;").replace(/^\p{Dash_Punctuation}$/ug,'<break time="750ms"/>')}),e+="</speak>";let i={method:"POST",headers:{"Content-Type":"application/json; charset=utf-8"},body:JSON.stringify({input:{ssml:e},voice:{languageCode:t.lang||this.avatar.ttsLang||this.opt.ttsLang,name:t.voice||this.avatar.ttsVoice||this.opt.ttsVoice},audioConfig:{audioEncoding:this.ttsAudioEncoding,speakingRate:(t.rate||this.avatar.ttsRate||this.opt.ttsRate)+this.mood.speech.deltaRate,pitch:(t.pitch||this.avatar.ttsPitch||this.opt.ttsPitch)+this.mood.speech.deltaPitch,volumeGainDb:(t.volume||this.avatar.ttsVolume||this.opt.ttsVolume)+this.mood.speech.deltaVolume},enableTimePointing:[1]})};this.opt.jwtGet&&"function"==typeof this.opt.jwtGet&&(i.headers.Authorization="Bearer "+await this.opt.jwtGet());let o=await fetch(this.opt.ttsEndpoint+(this.opt.ttsApikey?"?key="+this.opt.ttsApikey:""),i),a=await o.json();if(200===o.status&&a&&a.audioContent){let e=this.b64ToArrayBuffer(a.audioContent),i=await this.audioCtx.decodeAudioData(e);this.speakWithHands();let o=[0],n=0;t.text.forEach((t,e)=>{if(e>0){let e=o[o.length-1];a.timepoints[n]&&(e=1e3*a.timepoints[n].timeSeconds,a.timepoints[n].markName===""+t.mark&&n++),o.push(e)}});let s=[{mark:0,time:0}];o.forEach((t,e)=>{if(e>0){let i=t-o[e-1];s[e-1].duration=i,s.push({mark:e,time:t})}});let r=1e3*i.duration;r>this.opt.ttsTrimEnd&&(r-=this.opt.ttsTrimEnd),s[s.length-1].duration=r-s[s.length-1].time,t.anim.forEach(t=>{let e=s[t.mark];if(e)for(let i=0;i<t.ts.length;i++)t.ts[i]=e.time+t.ts[i]*e.duration+this.opt.ttsTrimStart}),this.audioPlaylist.push({anim:t.anim,audio:i}),this.onSubtitles=t.onSubtitles||null,this.resetLips(),t.mood&&this.setMood(t.mood),this.playAudio()}else this.startSpeaking(!0)}catch(t){console.error("Error:",t),this.startSpeaking(!0)}}else t.anim?(this.onSubtitles=t.onSubtitles||null,this.resetLips(),t.mood&&this.setMood(t.mood),t.anim.forEach((t,e)=>{for(let i=0;i<t.ts.length;i++)t.ts[i]=this.animClock+10*e;this.animQueue.push(t)}),setTimeout(this.startSpeaking.bind(this),10*t.anim.length,!0)):(t.marker&&"function"==typeof t.marker&&t.marker(),this.startSpeaking(!0))}else this.stateName="idle",this.isSpeaking=!1}pauseSpeaking(){try{this.audioSpeechSource?.stop()}catch(t){}this.audioPlaylist.length=0,this.stateName="idle",this.isSpeaking=!1,this.isAudioPlaying=!1,this.animQueue=this.animQueue.filter(t=>
1"viseme"!==t.template.name&&"subtitles"!==t.template.name&&"blendshapes"!==t.template.name),this.armature&&(this.resetLips(),this.render())}stopSpeaking(){try{this.audioSpeechSource?.stop()}catch(t){}this.audioPlaylist.length=0,this.speechQueue.length=0,this.animQueue=this.animQueue.filter(t=>"viseme"!==t.template.name&&"subtitles"!==t.template.name&&"blendshapes"!==t.template.name),this.stateName="idle",this.isSpeaking=!1,this.isAudioPlaying=!1,this.armature&&(this.resetLips(),this.render())}async streamStart(t={},e=null,i=null,o=null,a=null){if(this.stopSpeaking(),this.isStreaming=!0,void 0!==t.waitForAudioChunks&&(this.streamWaitForAudioChunks=t.waitForAudioChunks),this.streamWaitForAudioChunks||(this.streamAudioStartTime=this.animClock),this.streamLipsyncQueue=[],this.streamLipsyncType=t.lipsyncType||this.streamLipsyncType||"visemes",this.streamLipsyncLang=t.lipsyncLang||this.streamLipsyncLang||this.avatar.lipsyncLang||this.opt.lipsyncLang,this.onAudioStart=e,this.onAudioEnd=i,this.onMetrics=a,void 0!==t.sampleRate){let e=t.sampleRate;"number"==typeof e&&e>=8e3&&e<=96e3?e!==this.audioCtx.sampleRate&&this.initAudioGraph(e):console.warn("Invalid sampleRate provided. It must be a number between 8000 and 96000 Hz.")}if(void 0!==t.gain&&(this.audioStreamGainNode.gain.value=t.gain),!this.streamWorkletNode||!this.streamWorkletNode.port||0===this.streamWorkletNode.numberOfOutputs||this.streamWorkletNode.context!==this.audioCtx){if(this.streamWorkletNode)try{this.streamWorkletNode.disconnect(),this.streamWorkletNode=null}catch(t){}if(!this.workletLoaded)try{let t=this.audioCtx.audioWorklet.addModule(u.href),e=new Promise((t,e)=>setTimeout(()=>e(Error("Worklet loading timed out")),5e3));await Promise.race([t,e]),this.workletLoaded=!0}catch(t){throw console.error("Failed to load audio worklet:",t),Error("Failed to initialize streaming speech")}this.streamWorkletNode=new AudioWorkletNode(this.audioCtx,"playback-worklet",{processorOptions:{sampleRate:this.audioCtx.sampleRate,metrics:t.metrics||{enabled:!1}}}),this.streamWorkletNode.connect(this.audioStreamGainNode),this.streamWorkletNode.connect(this.audioAnalyzerNode),this.streamWorkletNode.port.onmessage=t=>{if("playback-started"===t.data.type&&(this.isSpeaking=!0,this.stateName="speaking",this.streamWaitForAudioChunks&&(this.streamAudioStartTime=this.animClock),this._processStreamLipsyncQueue(),this.speakWithHands(),this.onAudioStart))try{this.onAudioStart?.()}catch(t){console.error(t)}if("playback-ended"===t.data.type&&(this._streamPause(),this.onAudioEnd))try{this.onAudioEnd()}catch(t){}if(this.onMetrics&&"metrics"===t.data.type)try{this.onMetrics(t.data)}catch(t){}}}if(t.metrics)try{this.streamWorkletNode.port.postMessage({type:"config-metrics",data:t.metrics})}catch(t){}if(this.resetLips(),this.lookAtCamera(500),t.mood&&this.setMood(t.mood),this.onSubtitles=o||null,"suspended"===this.audioCtx.state||"interrupted"===this.audioCtx.state){let t=this.audioCtx.resume(),e=new Promise((t,e)=>setTimeout(()=>e("p2"),1e3));try{await Promise.race([t,e])}catch(t){console.warn("Can't play audio. Web Audio API suspended. This is often due to calling some speak method before the first user action, which is typically prevented by the browser.");return}}}streamNotifyEnd(){this.isStreaming&&this.streamWorkletNode&&this.streamWorkletNode.port.postMessage({type:"no-more-data"})}streamInterrupt(){if(!this.isStreaming)return;let t=this.isSpeaking;if(this.streamWorkletNode)try{this.streamWorkletNode.port.postMessage({type:"stop"})}catch(t){}if(this._streamPause(!0),t&&this.onAudioEnd)try{this.onAudioEnd()}catch(t){}}streamStop(){if(this.isStreaming){if(this.streamInterrupt(),this.streamWorkletNode){try{this.streamWorkletNode.disconnect()}catch(t){}this.streamWorkletNode=null}this.isStreaming=!1}}_streamPause(t=!1){this.isSpeaking=!1,this.stateName="idle",t&&(this.streamWaitForAudioChunks&&(this.streamAudioStartTime=null),this.streamLipsyncQueue=[],this.animQueue=this.animQueue.filter(t=>"viseme"!==t.template.name&&"subtitles"!==t.template.name&&"blendshapes"!==t.template.name),this.armature&&(this.resetLips(),this.render()))}_processStreamLipsyncQueue(){if(this.isStreaming)for(;this.streamLipsyncQueue.length>0;){let t=this.streamLipsyncQueue.shift();this._processLipsyncData(t,this.streamAudioStartTime)}}_processLipsyncData(t,e){if(this.isStreaming){if(t.visemes&&"visemes"==this.streamLipsyncType)for(let i=0;i<t.visemes.length;i++){let o=t.visemes[i],a=e+t.vtimes[i],n=t.vdurations[i],s={template:{name:"viseme"},ts:[a-2*n/3,a+n/2,a+n+n/2],vs:{["viseme_"+o]:[null,"PP"===o||"FF"===o?.9:.6,0]}};this.animQueue.push(s)}if(t.words&&(this.onSubtitles||"words"==this.streamLipsyncType))for(let i=0;i<t.words.length;i++){let o=t.words[i],a=t.wtimes[i],n=t.wdurations[i];if(o.length&&(this.onSubtitles&&this.animQueue.push({template:{name:"subtitles"},ts:[e+a],vs:{subtitles:[" "+o]}}),"words"==this.streamLipsyncType)){let t=this.streamLipsyncLang||this.avatar.lipsyncLang||this.opt.lipsyncLang,i=this.lipsyncPreProcessText(o,t),s=this.lipsyncWordsToVisemes(i,t);if(s&&s.visemes&&s.visemes.length){let t=s.times[s.visemes.length-1]+s.durations[s.visemes.length-1],i=Math.min(n,Math.max(0,n-150*s.visemes.length)),o=.6+this.convertRange(i,[0,n],[0,.4]);if(n=Math.min(n,200*s.visemes.length),t>0)for(let i=0;i<s.visemes.length;i++){let r=e+a+s.times[i]/t*n,h=s.durations[i]/t*n;this.animQueue.push({template:{name:"viseme"},ts:[r-Math.min(60,2*h/3),r+Math.min(25,h/2),r+h+Math.min(60,h/2)],vs:{["viseme_"+s.visemes[i]]:[null,"PP"===s.visemes[i]||"FF"===s.visemes[i]?.9:o,0]}})}}}}
1if(t.anims&&"blendshapes"==this.streamLipsyncType)for(let i=0;i<t.anims.length;i++){let o=t.anims[i];o.delay+=e;let a=this.animFactory(o,!1,1,1,!0);this.animQueue.push(a)}}}streamAudio(t){if(this.isStreaming&&this.streamWorkletNode){if(this.isSpeaking||(this.streamLipsyncQueue=[],this.streamAudioStartTime=null),this.isSpeaking=!0,this.stateName="speaking",void 0!==t.audio){let e={type:"audioData",data:null};if(t.audio instanceof ArrayBuffer)e.data=t.audio,this.streamWorkletNode.port.postMessage(e,[e.data]);else if(t.audio instanceof Int16Array||t.audio instanceof Uint8Array)e.data=t.audio.buffer.slice(t.audio.byteOffset,t.audio.byteOffset+t.audio.byteLength),this.streamWorkletNode.port.postMessage(e,[e.data]);else if(t.audio instanceof Float32Array){let i=new Int16Array(t.audio.length);for(let e=0;e<t.audio.length;e++){let o=Math.max(-1,Math.min(1,t.audio[e]));i[e]=o<0?32768*o:32767*o}e.data=i.buffer,this.streamWorkletNode.port.postMessage(e,[e.data])}else console.error("r.audio is not a supported type. Must be ArrayBuffer, Int16Array, Uint8Array, or Float32Array:",t.audio)}if(t.visemes||t.anims||t.words){if(this.streamWaitForAudioChunks&&!this.streamAudioStartTime){this.streamLipsyncQueue.length>=200&&this.streamLipsyncQueue.shift(),this.streamLipsyncQueue.push(t);return}this.streamWaitForAudioChunks||this.streamAudioStartTime||(this.streamAudioStartTime=this.animClock),this._processLipsyncData(t,this.streamAudioStartTime)}}}makeEyeContact(t){this.animQueue.push(this.animFactory({name:"eyecontact",dt:[0,t],vs:{eyeContact:[1]}}))}lookAhead(t){if(t){let e=(Math.random()-.5)/4,i=(Math.random()-.5)/4,o=this.animQueue.findIndex(t=>"lookat"===t.template.name);-1!==o&&this.animQueue.splice(o,1),this.animQueue.push(this.animFactory({name:"lookat",dt:[750,t],vs:{bodyRotateX:[e],bodyRotateY:[i],eyesRotateX:[-3*e+.1],eyesRotateY:[-5*i],browInnerUp:[[0,.7]],mouthLeft:[[0,.7]],mouthRight:[[0,.7]],eyeContact:[0],headMove:[0]}}))}}lookAtCamera(t){let e;if(this.speakTo&&(e=new o.Pq0,this.speakTo.objectLeftEye?.isObject3D?(this.speakTo.armature.objectHead,this.speakTo.objectLeftEye.updateMatrixWorld(!0),this.speakTo.objectRightEye.updateMatrixWorld(!0),g.setFromMatrixPosition(this.speakTo.objectLeftEye.matrixWorld),c.setFromMatrixPosition(this.speakTo.objectRightEye.matrixWorld),e.addVectors(g,c).divideScalar(2)):this.speakTo.isObject3D?this.speakTo.getWorldPosition(e):this.speakTo.isVector3?e.set(this.speakTo):this.speakTo.x&&this.speakTo.y&&this.speakTo.z&&e.set(this.speakTo.x,this.speakTo.y,this.speakTo.z)),!e){if(this.avatar.hasOwnProperty("avatarIgnoreCamera")){if(this.avatar.avatarIgnoreCamera)return void this.lookAhead(t)}else if(this.opt.avatarIgnoreCamera)return void this.lookAhead(t);return void this.lookAt(null,null,t)}this.objectLeftEye.updateMatrixWorld(!0),this.objectRightEye.updateMatrixWorld(!0),g.setFromMatrixPosition(this.objectLeftEye.matrixWorld),c.setFromMatrixPosition(this.objectRightEye.matrixWorld),g.add(c).divideScalar(2),p.copy(this.armature.quaternion),p.multiply(this.poseTarget.props["Hips.quaternion"]),p.multiply(this.poseTarget.props["Spine.quaternion"]),p.multiply(this.poseTarget.props["Spine1.quaternion"]),p.multiply(this.poseTarget.props["Spine2.quaternion"]),p.multiply(this.poseTarget.props["Neck.quaternion"]),p.multiply(this.poseTarget.props["Head.quaternion"]);let i=new o.Pq0().subVectors(e,g).normalize(),a=Math.atan2(i.x,i.z),n=Math.asin(-i.y);y.set(n,a,0,"YXZ");let s=new o.PTz().setFromEuler(y),r=new o.PTz().copy(s).multiply(
1p.clone().invert());y.setFromQuaternion(r,"YXZ");let h=y.x/(40/24)+.2,l=y.y/(9/4),d=Math.min(.6,Math.max(-.3,h)),m=Math.min(.8,Math.max(-.8,l)),u=(Math.random()-.5)/4,x=(Math.random()-.5)/4;if(t){let e=this.animQueue.findIndex(t=>"lookat"===t.template.name);-1!==e&&this.animQueue.splice(e,1),this.animQueue.push(this.animFactory({name:"lookat",dt:[750,t],vs:{bodyRotateX:[d+u],bodyRotateY:[m+x],eyesRotateX:[-3*u+.1],eyesRotateY:[-5*x],browInnerUp:[[0,.7]],mouthLeft:[[0,.7]],mouthRight:[[0,.7]],eyeContact:[0],headMove:[0]}}))}}lookAt(t,e,i){if(!this.camera)return;let a=this.nodeAvatar.getBoundingClientRect();this.objectLeftEye.updateMatrixWorld(!0),this.objectRightEye.updateMatrixWorld(!0);let n=new o.Pq0().setFromMatrixPosition(this.objectLeftEye.matrixWorld),s=new o.Pq0().setFromMatrixPosition(this.objectRightEye.matrixWorld),r=new o.Pq0().addVectors(n,s).divideScalar(2);r.project(this.camera);let h=(r.x+1)/2*a.width+a.left,l=-(r.y-1)/2*a.height+a.top;null===t&&(t=h),null===e&&(e=l),p.copy(this.armature.quaternion),p.multiply(this.poseTarget.props["Hips.quaternion"]),p.multiply(this.poseTarget.props["Spine.quaternion"]),p.multiply(this.poseTarget.props["Spine1.quaternion"]),p.multiply(this.poseTarget.props["Spine2.quaternion"]),p.multiply(this.poseTarget.props["Neck.quaternion"]),p.multiply(this.poseTarget.props["Head.quaternion"]),y.setFromQuaternion(p);let d=y.x/(40/24),m=y.y/(9/4),u=Math.min(.4,Math.max(-.4,this.camera.rotation.x)),g=Math.min(.4,Math.max(-.4,this.camera.rotation.y)),c=Math.max(window.innerWidth-h,h),x=Math.max(window.innerHeight-l,l),f=this.convertRange(e,[l-x,l+x],[-.3,.6])-d+u,L=this.convertRange(t,[h-c,h+c],[-.8,.8])-m+g;f=Math.min(.6,Math.max(-.3,f)),L=Math.min(.8,Math.max(-.8,L));let R=(Math.random()-.5)/4,z=(Math.random()-.5)/4;if(i){let t=this.animQueue.findIndex(t=>"lookat"===t.template.name);-1!==t&&this.animQueue.splice(t,1);let e={name:"lookat",dt:[750,i],vs:{bodyRotateX:[f+R],bodyRotateY:[L+z],eyesRotateX:[-3*R+.1],eyesRotateY:[-5*z],browInnerUp:[[0,.7]],mouthLeft:[[0,.7]],mouthRight:[[0,.7]],eyeContact:[0],headMove:[0]}};this.animQueue.push(this.animFactory(e))}}touchAt(t,e){if(!this.camera)return;let i=this.nodeAvatar.getBoundingClientRect(),a=new o.I9Y((t-i.left)/i.width*2-1,-(2*((e-i.top)/i.height))+1),n=new o.tBo;n.setFromCamera(a,this.camera);let s=n.intersectObject(this.armature);if(s.length>0){let t=s[0].point,e=new o.Pq0,i=new o.Pq0;this.objectLeftArm.getWorldPosition(e),this.objectRightArm.getWorldPosition(i),e.distanceToSquared(t)<i.distanceToSquared(t)?(this.ikSolve({iterations:20,root:"LeftShoulder",effector:"LeftHandMiddle1",links:[{link:"LeftHand",minx:-.5,maxx:.5,miny:-1,maxy:1,minz:-.5,maxz:.5,maxAngle:.1},{link:"LeftForeArm",minx:-.5,maxx:1.5,miny:-1.5,maxy:1.5,minz:-.5,maxz:3,maxAngle:.2},{link:"LeftArm",minx:-1.5,maxx:1.5,miny:0,maxy:0,minz:-1,maxz:3}]},t,!1,1e3),this.setValue("handFistLeft",0)):(this.ikSolve({iterations:20,root:"RightShoulder",effector:"RightHandMiddle1",links:[{link:"RightHand",minx:-.5,maxx:.5,miny:-1,maxy:1,minz:-.5,maxz:.5,maxAngle:.1},{link:"RightForeArm",minx:-.5,maxx:1.5,miny:-1.5,maxy:1.5,minz:-3,maxz:.5,maxAngle:.2},{link:"RightArm",minx:-1.5,maxx:1.5,miny:0,maxy:0,minz:-1,maxz:3}]},t,!1,1e3),this.setValue("handFistRight",0))}else["LeftArm","LeftForeArm","LeftHand","RightArm","RightForeArm","RightHand"].forEach(t=>{let e=t+".quaternion";this.poseTarget.props[e].copy(this.getPoseTemplateProp(e)),this.poseTarget.props[e].t=this.animClock,this.poseTarget.props[e].d=1e3});return s.length>0}speakWithHands(t=0,e=.5){if(this.mixer||this.gesture||!this.poseTarget.template.standing||this.poseTarget.template.bend||Math.random()>e)return;this.ikSolve({root:"LeftShoulder",effector:"LeftHandMiddle1",links:[{link:"LeftHand",minx:-.5,maxx:.5,miny:-1,maxy:1,minz:-.5,maxz:.5},{link:"LeftForeArm",minx:-.5,maxx:1.5,miny:-1.5,maxy:1.5,minz:-.5,maxz:3},{link:"LeftArm",minx:-1.5,maxx:1.5,miny:-1.5,maxy:1.5,minz:-1,maxz:3}]},new o.Pq0(this.gaussianRandom(0,.5),this.gaussianRandom(-.8,-.2),this.gaussianRandom(0,.5)),!0),this.ikSolve({root:"RightShoulder",effector:"RightHandMiddle1",links:[{link:"RightHand",minx:-.5,maxx:.5,miny:-1,maxy:1,minz:-.5,maxz:.5},{link:"RightForeArm",minx:-.5,maxx:1.5,miny:-1.5,maxy:1.5,minz:-3,maxz:.5},{link:"RightArm"}]},new o.Pq0(this.gaussianRandom(-.5,0),this.gaussianRandom(-.8,-.2),this.gaussianRandom(0,.5)),!0);let i=[],a=[];i.push(100+Math.round(500*Math.random())),a.push({duration:1e3,props:{"LeftHand.quaternion":new o.PTz().setFromEuler(new o.O9p(0,-1-Math.random(),0)),"RightHand.quaternion":new o.PTz().setFromEuler(new o.O9p(0,1+Math.random(),0))}}),["LeftArm","LeftForeArm","RightArm","RightForeArm"].forEach(t=>{a[0].props[t+".quaternion"]=this.ikMesh.getObjectByName(t).quaternion.clone()}),i.push(1e3+Math.round(500*Math.random())),a.push({duration:2e3,props:{}}),["LeftArm","LeftForeArm","RightArm","RightForeArm","LeftHand","RightHand"].forEach(t=>{a[1].props[t+".quaternion"]=null});let n=this.animFactory({name:"talkinghands",delay:t,dt:i,vs:{moveto:a}});this.animQueue.push(n)}getSlowdownRate(t){return this.animSlowdownRate}setSlowdownRate(t){this.animSlowdownRate=t,this.audioSpeechSource&&(this.audioSpeechSource.playbackRate.value=1/this.animSlowdownRate),this.audioBackgroun
1dSource&&(this.audioBackgroundSource.playbackRate.value=1/this.animSlowdownRate)}getAutoRotateSpeed(t){return this.controls.autoRotateSpeed}setAutoRotateSpeed(t){this.controls.autoRotateSpeed=t,this.controls.autoRotate=t>0}start(){this.armature&&!1===this.isRunning&&(this.audioCtx.resume(),this.animTimeLast=performance.now(),this.isRunning=!0,this.isAvatarOnly||(this._raf=requestAnimationFrame(this.animate)))}stop(){this.isRunning=!1,this.audioCtx.suspend()}startListening(t,e={},i=null){this.listeningAnalyzer=t,this.listeningAnalyzer.fftSize=256,this.listeningAnalyzer.smoothingTimeConstant=.1,this.listeningAnalyzer.minDecibels=-70,this.listeningAnalyzer.maxDecibels=-10,this.listeningOnchange=i&&"function"==typeof i?i:null,this.listeningSilenceThresholdLevel=e?.hasOwnProperty("listeningSilenceThresholdLevel")?e.listeningSilenceThresholdLevel:this.opt.listeningSilenceThresholdLevel,this.listeningSilenceThresholdMs=e?.hasOwnProperty("listeningSilenceThresholdMs")?e.listeningSilenceThresholdMs:this.opt.listeningSilenceThresholdMs,this.listeningSilenceDurationMax=e?.hasOwnProperty("listeningSilenceDurationMax")?e.listeningSilenceDurationMax:this.opt.listeningSilenceDurationMax,this.listeningActiveThresholdLevel=e?.hasOwnProperty("listeningActiveThresholdLevel")?e.listeningActiveThresholdLevel:this.opt.listeningActiveThresholdLevel,this.listeningActiveThresholdMs=e?.hasOwnProperty("listeningActiveThresholdMs")?e.listeningActiveThresholdMs:this.opt.listeningActiveThresholdMs,this.listeningActiveDurationMax=e?.hasOwnProperty("listeningActiveDurationMax")?e.listeningActiveDurationMax:this.opt.listeningActiveDurationMax,this.listeningActive=!1,this.listeningVolume=0,this.listeningTimer=0,this.listeningTimerTotal=0,this.isListening=!0}stopListening(){this.isListening=!1}async playAnimation(t,e=null,i=10,a=0,n=.01){if(!this.armature)return;let s=this.animClips.find(e=>e.url===t+"-"+a);if(s){let t=this.animQueue.find(t=>"pose"===t.template.name);t&&(t.ts[0]=1/0),Object.entries(s.pose.props).forEach(t=>{this.poseBase.props[t[0]]=t[1].clone(),this.poseTarget.props[t[0]]=t[1].clone(),this.poseTarget.props[t[0]].t=0,this.poseTarget.props[t[0]].d=1e3}),this.mixer&&(this.mixer.removeEventListener("finished",this._mixerHandler),this.mixer.stopAllAction(),this.mixer.uncacheRoot(this.armature),this.mixer=null,this._mixerHandler=null),this.mixer=new o.Iw4(this.armature),this._mixerHandler=()=>{this.stopAnimation(),this.mixer?.removeEventListener("finished",this._mixerHandler)},this.mixer.addEventListener("finished",this._mixerHandler);let e=Math.ceil(i/s.clip.duration),a=this.mixer.clipAction(s.clip);a.setLoop(o.aMy,e),a.clampWhenFinished=!0,a.fadeIn(.5).play()}else{let s=new h.w,r=await s.loadAsync(t,e);if(r&&r.animations&&r.animations[a]){let s=r.animations[a],h={};s.tracks.forEach(t=>{t.name=t.name.replaceAll("mixamorig","");let e=t.name.split(".");if("position"===e[1]){for(let e=0;e<t.values.length;e++)t.values[e]=t.values[e]*n;h[t.name]=new o.Pq0(t.values[0],t.values[1],t.values[2])}else"quaternion"===e[1]?h[t.name]=new o.PTz(t.values[0],t.values[1],t.values[2],t.values[3]):"rotation"===e[1]&&(h[e[0]+".quaternion"]=new o.PTz().setFromEuler(new o.O9p(t.values[0],t.values[1],t.values[2],"XYZ")).normalize())});let l={props:h};h["Hips.position"]&&(h["Hips.position"].y<.5?l.lying=!0:l.standing=!0),this.animClips.push({url:t+"-"+a,clip:s,pose:l}),this.playAnimation(t,e,i,a,n)}else console.error("Animation "+t+" (ndx="+a+") not found")}}stopAnimation(){if(this.mixer&&(this.mixer.removeEventListener("finished",this._mixerHandler),this.mixer.stopAllAction(),this.mixer.uncacheRoot(this.armature),this.mixer=null,this._mixerHandler=null),this.gesture)for(let[t,e]of Object.entries(this.gesture))e.t=this.animClock,e.d=1e3,this.poseTarget.props.hasOwnProperty(t)&&(this.poseTarget.props[t].copy(e),this.poseTarget.props[t].t=this.animClock,this.poseTarget.props[t].d=1e3);let t=this.animQueue.find(t=>"pose"===t.template.name);t&&(t.ts[0]=this.animClock),this.setPoseFromTemplate(null)}async playPose(t,e=null,i=5,a=0,n=.01){if(!this.armature)return;let s=this.poseTemplates[t];if(!s){let e=this.animPoses.find(e=>e.url===t+"-"+a);e&&(s=e.pose)}if(s){this.poseName=t,this.mixer&&(this.mixer.removeEventListener("finished",this._mixerHandler),this.mixer.stopAllAction(),this.mixer.uncacheRoot(this.armature),this.mixer=null,this._mixerHandler=null);let e=this.animQueue.find(t=>"pose"===t.template.name);e&&(e.ts[0]=this.animClock+1e3*i+2e3),this.setPoseFromTemplate(s)}else{let s=new h.w,r=await s.loadAsync(t,e);if(r&&r.animations&&r.animations[a]){let s=r.animations[a],h={};s.tracks.forEach(t=>{t.name=t.name.replaceAll("mixamorig","");let e=t.name.split(".");"position"===e[1]?h[t.name]=new o.Pq0(t.values[0]*n,t.values[1]*n,t.values[2]*n):"quaternion"===e[1]?h[t.name]=new o.PTz(t.values[0],t.values[1],t.values[2],t.values[3]):"rotation"===e[1]&&(h[e[0]+".quaternion"]=new o.PTz().setFromEuler(new o.O9p(t.values[0],t.values[1],t.values[2],"XYZ")).normalize())});let l={props:h};h["Hips.position"]&&(h["Hips.position"].y<.5?l.lying=!0:l.standing=!0),this.animPoses.push({url:t+"-"+a,pose:l}),this.playPose(t,e,i,a,n)}else console.error("Pose "+t+" (ndx="+a+") not found")}}stopPose(){this.stopAnimation()}playGesture(t,e=3,i=!1,a=1e3){if(!this.armature)return;let n=this.gestureTemplates[t];if(n){this.gestureTimeout&&(clearTimeout(this.gestureTimeout),this.gestureTimeout=null);let s=this.animQueue.findIndex(t=>"talkinghands"===t.template.name);for(let[e,r]of(-1!==s&&(this.animQueue[s].ts=this.animQueue[s].ts.map(t=>0)),this.gesture=this.propsToThreeObjects(n),i&&(this.gesture=this.mirrorPose(this.gesture)),"namaste"===t&&"M"===this.avatar.body&&(this.gesture["RightArm.quaternion"].rotateTowards(new o.PTz(0,1,0,0),-.25),this.gesture["LeftArm.quaternion"].rotateTowards(new o.PTz(0,1,0,0),-.25)),Object.entries(this.gesture)))r.t=this.animClock,r.d=a,this.poseTarget.props.hasOwnProperty(e)&&(this.poseTarget.props[e].copy(r),this.poseTarget.props[e].t=this.animClock,this.poseTarget.props[e].d=a);e&&Number.isFinite(e)&&(this.gestureTimeout=setTimeout(this.stopGesture.bind(this,a),1e3*e))}let s=this.animEmojis[t];if(s&&(s&&s.link&&(s=this.animEmojis[s.link]),s)){this.lookAtCamera(500);let t=this.animFactory(s);if(t.gesture=!0,e&&Number.isFinite(e)){let i=t.ts[0],o=t.ts[t.ts.length-1]-i;if(1e3*e-o>0){let a=[];for(let e=1;e<t.ts.length;e++)a.push(t.ts[e]-t.ts[e-1]);let n=s.template?.rescale||a.map(t=>
1t/o),r=1e3*e-o;t.ts=t.ts.map((t,e,o)=>0===e?i:o[e-1]+a[e-1]+n[e-1]*r)}else{let a=1e3*e/o;t.ts=t.ts.map(t=>i+a*(t-i))}}this.animQueue.push(t)}}stopGesture(t=1e3){if(this.gestureTimeout&&(clearTimeout(this.gestureTimeout),this.gestureTimeout=null),this.gesture){let e=Object.entries(this.gesture);for(let[i,o]of(this.gesture=null,e))this.poseTarget.props.hasOwnProperty(i)&&(this.poseTarget.props[i].copy(this.getPoseTemplateProp(i)),this.poseTarget.props[i].t=this.animClock,this.poseTarget.props[i].d=t)}let e=this.animQueue.findIndex(t=>t.gesture);-1!==e&&this.animQueue.splice(e,1)}ikSolve(t,e=null,i=!1,a=null){let n=new o.Pq0,s=new o.Pq0,r=new o.Pq0,h=new o.Pq0,l=new o.PTz,d=new o.Pq0,m=new o.Pq0,u=new o.Pq0,y=this.ikMesh.getObjectByName(t.root);y.position.setFromMatrixPosition(this.armature.getObjectByName(t.root).matrixWorld),y.quaternion.setFromRotationMatrix(this.armature.getObjectByName(t.root).matrixWorld),e&&i&&e.applyQuaternion(this.armature.quaternion).add(y.position);let g=this.ikMesh.getObjectByName(t.effector),c=t.links;c.forEach(t=>{t.bone=this.ikMesh.getObjectByName(t.link),t.bone.quaternion.copy(this.getPoseTemplateProp(t.link+".quaternion"))}),y.updateMatrixWorld(!0);let x=t.iterations||10;if(e)for(let t=0;t<x;t++){let t=!1;for(let i=0,a=c.length;i<a;i++){let a=c[i].bone;a.matrixWorld.decompose(h,l,d),l.invert(),s.setFromMatrixPosition(g.matrixWorld),r.subVectors(s,h),r.applyQuaternion(l),r.normalize(),n.subVectors(e,h),n.applyQuaternion(l),n.normalize();let y=n.dot(r);y>1?y=1:y<-1&&(y=-1),(y=Math.acos(y))<1e-5||(void 0!==c[i].minAngle&&y<c[i].minAngle&&(y=c[i].minAngle),void 0!==c[i].maxAngle&&y>c[i].maxAngle&&(y=c[i].maxAngle),m.crossVectors(r,n),m.normalize(),p.setFromAxisAngle(m,y),a.quaternion.multiply(p),a.rotation.setFromVector3(u.setFromEuler(a.rotation).clamp(new o.Pq0(void 0!==c[i].minx?c[i].minx:-1/0,void 0!==c[i].miny?c[i].miny:-1/0,void 0!==c[i].minz?c[i].minz:-1/0),new o.Pq0(void 0!==c[i].maxx?c[i].maxx:1/0,void 0!==c[i].maxy?c[i].maxy:1/0,void 0!==c[i].maxz?c[i].maxz:1/0))),a.updateMatrixWorld(!0),t=!0)}if(!t)break}a&&c.forEach(t=>{this.poseTarget.props[t.link+".quaternion"].copy(t.bone.quaternion),this.poseTarget.props[t.link+".quaternion"].t=this.animClock,this.poseTarget.props[t.link+".quaternion"].d=a})}dispose(){if(this.stop(),this.stopSpeaking(),this.streamStop(),this.stopAnimation(),null!==this._raf&&(cancelAnimationFrame(this._raf),this._raf=null),["audioSpeechSource","audioBackgroundSource"].forEach(t=>{let e=this[t];if(e){try{e.stop?.()}catch(t){}e.disconnect(),e.onended=null}}),["audioBackgroundGainNode","audioSpeechGainNode","audioStreamGainNode","audioAnalyzerNode"].forEach(t=>{let e=this[t];e&&e.disconnect()}),this.isAvatarOnly)this.armature&&(this.armature.parent&&this.armature.parent.remove(this.armature),this.clearThree(this.armature));else{if(this.clearThree(this.scene),this.resizeobserver.disconnect(),this.resizeobserver=null,this.renderer){this.renderer.dispose();let t=this.renderer.getContext();t.getExtension("WEBGL_lose_context")?.loseContext(),this.renderer.domElement?.remove(),this.renderer.domElement=null,this.renderer=null}this.controls&&(this.controls.dispose(),this.controls=null)}this.clearThree(this.ikMesh),this.dynamicbones.dispose(),this.nodeAvatar=null}}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.